diff --git a/AGENTS.md b/AGENTS.md index 5364d1b..03fc279 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -85,3 +85,168 @@ Swift · UIKit · SnapKit(代码布局,约束写在 `setupUI()` / `setupCons - SnapKit 布局、Kingfisher 图片、Diffable 列表带动画 - 以 Android 工程为功能参考,命令式 UIKit,不用 Observable / Combine - 新增功能必测、类型与公开 API 必注释、保持简洁 + +## 景区空境库接口范围(2026-10-30 用户确认) + +- App 只负责获取、查看景区素材,以及下载并保存相册,不负责上传。 +- `/api/app/scenic-media/retry-upload` 和 `/api/app/scenic-media/retry-failed` 不需要对接;后续接口盘点不再列为未接入或待调试项。 +- 页面上的下载失败重试仅重试文件下载与相册保存,不调用上述上传重试接口。此约定只适用于景区空境库。 + +## 当前禁飞调试限制(2026-10-29 用户要求) + +- 当前无人机禁止飞行(用户于 2026-10-30 再次确认)。调试只能模拟,禁止向真实无人机下发任何指令;模拟器、测试账号、测试环境都不代表模拟设备。本次图传和重新召唤接入不解除禁飞限制。 +- 不通过 App、curl、脚本、浏览器或其他工具真实调用 `airport/shoot`、`airport/start-shoot`、`airport/command`,也不启动实时图传或尝试未确认的设备操作接口。暂停、恢复、返航同样属于设备指令。 +- 创建、召唤、拍摄、失败和返航流程使用纯内存演示或 Mock 响应;必须标明模拟来源,不能把模拟结果记为后端真实成功。不为流程验证创建真实待飞任务。 +- 可继续调试已确认只读的订单、项目、素材及状态接口;`plane-status/shooting` 使用 `live_battery=0`,`status` 使用 `live_metrics=0`,不主动请求设备实时采集。 +- Debug 客户端默认拦截机场操作及真实 `tasks/create`,无运行时放行开关;本地模拟传输不能转发网络。用户明确解除禁飞并授权真实联调前,不删除或绕过保护,也不改用 Release 构建规避。 +- 使用模拟器及隔离网络替身验证本限制,不进行真机飞行测试。 + +## 图传代码接入范围(2026-11-02 用户要求) + +- 用户要求完成图传代码,稍后由用户自行打正式环境包测试。本次代理只编译和使用隔离替身验证,不调用真实 `live` 或任何飞控接口。 +- Release 任务页提供手动开启火山 RTC 图传的入口;进页、回前台、异常或凭证过期均不自动调用 `live`。这不授权召唤、起飞、开拍、暂停、恢复或返航。 +- Debug 的 `live` 网络拦截继续保持,RTC 引擎连接前也必须拦截;没有运行时放行开关。状态读取继续关闭设备实时采集。 +- 真实 `tasks/create` 和飞控请求在 Debug、Release 均拦截;通过“订单素材库 → 查看任务”进入已有任务,不为测试图传创建或召唤新任务。 + +## Release 真实操作与日志(2026-11-02 后续用户明确授权) + +- 用户明确回复:“开放 Release 真实操作,Debug 保持拦截”。本节覆盖上文“Release 禁止创建和飞控”的旧限制。 +- Release 可由用户自行真机执行 `tasks/create`、`shoot`(含重新召唤)、`start-shoot`、`command` 及手动 `live`;保持原有门禁、同任务身份校验、防重复提交和结果未知时不自动重发。 +- 代理本次仍只编译、使用模拟器和隔离网络替身,不主动调用真实飞控、创建待飞任务或开启图传。用户自行打包、连接真实环境测试。 +- Debug 真实操作仍在网络层拦截,没有运行时放行开关;未知机场操作仍阻断。 +- `shooting` 按用户要求恢复前台可见时串行轮询,默认 5 秒,后端建议限制为 2~30 秒;离页/后台停止,旧快照保留。`live_battery=0`,`status` 仍为 `live_metrics=0`。 +- Release 机巢诊断使用 `[DroneDock]` 系统日志;保留任务身份和脱敏业务回包,禁止输出登录 Header、RTC token 或有效播放 URL。 + +## 机巢控制台完整日志(2026-11-02 最新用户要求) + +- 用户明确要求:“打印到控制台的日志信息,不需要 redacted,我要全部显示出来”。本节覆盖上文机巢控制台日志脱敏限制。 +- Debug/Release 的机巢接口请求头、参数、JSON/文本响应按原值记录,包含 URL、RTC/STS 参数;保持 `[DroneDock]`、请求关联和完整分段。视频/图片二进制仍记录传输摘要。 +- 此调整仅涉及日志,不解除 Debug 禁飞保护;代理继续仅使用隔离替身和模拟器验证。 + +## 其他模块 Release 接口日志(2026-11-02 用户要求) + +- 其他模块通过统一 `APIClient` 发起的请求和响应也在 Release 控制台输出,使用 `[API]` 标记和系统日志 category `API`;机巢仍使用 `[DroneDock]`。 +- 普通、裸 JSON、multipart 三种入口均记录请求/响应、传输失败及取消。长正文完整分段,文件二进制记录大小,日志不得改变请求或业务处理。 + +## 控制台模块标签(2026-11-02 最新用户要求) + +- 控制台前缀统一使用 `【模块-Request】` / `【模块-Response】`,覆盖旧的 `[API]`、`[DroneDock]` 标签约定;系统日志 category 保持不变。 +- 按接口路径区分“机巢工作台”“景区空境库”“订单”等业务模块;共享上传配置、文件上传和下载按职责命名。失败、取消、本地拦截及普通事件使用同格式的 `Failure`、`Cancelled`、`Blocked`、`Event`。 +- 每个长日志分段均保留模块标签及 session/entry/part,请求关联和正文原值不变;本调整不改变网络行为或 Debug 禁飞保护。 + +## 拍摄任务 WebSocket 与 HTTP 兜底(2026-11-02) + +- 最新任务页优先使用朱工只读 `/wss`(310/311)完整快照。进页/回前台先 `shooting?live_battery=0`,订阅 ack 和有效快照到达后停止常规 HTTP 轮询;旧“全程轮询”约定由本节覆盖。 +- 连接/订阅/心跳异常时串行 HTTP 兜底,默认 5 秒、后端提示限制 2~30 秒;Socket 退避重连并重新取票。仅拍摄中连续 120 秒没有有效包时主动核对,不能用 5 秒静默判断断线。 +- 按任务身份、execution_batch、state_version 校验 HTTP/WS,离页/后台停止;旧数据显示到新快照返回。订阅无权限停止两条读取通道,票据 100098 仅换票。 +- 本轮明确使用模拟器及隔离替身验证,不创建真实任务、不调用真实飞控或图传;不改变 Debug 拦截及 Release 由用户自行测试的权限。 + +## 简洁控制台 JSON(2026-11-03 最新用户要求) + +- 用户要求控制台只显示请求路径、入参和返回 JSON。本节覆盖旧模块标签、session/entry/part、Header 和页面/RTC 事件输出约定。 +- 请求输出 `path`、`params`;响应输出相同路径和参数以及 `response`(后端完整原始 JSON)。不再附加方法、域名、耗时、版本、关联 ID 或响应头。 +- 业务错误只保留原始回包;无后端响应的网络失败、取消及本地拦截在 `response.local_error` 明确表示。非 JSON 文本用 JSON 字符串,文件二进制仅显示元信息。 +- WebSocket 路径使用 `/wss`,订阅和推送同样按简洁格式;页面、心跳、解析及 RTC 事件不再输出到控制台。入参/回包原值及既有接口正文开关保持不变。 +- Debug/Release 均支持;Xcode 附加时完整写入控制台,独立运行时保留系统日志。仅改变诊断输出,不改变业务、鉴权和禁飞保护。 + +## 自动图传与控制台断连修复(2026-11-03 后续用户要求) + +- 用户明确要求“实时图传,不要手动开启,需要自动开启”,覆盖前文 Release 手动开启的规则。任务页完整出现、可见时回前台自动请求一次同任务 `live`;正常 HTTP/WS 状态刷新不重复请求,离页/后台停止本地播放并作废旧响应。失败仍保留重试入口,不自动重发飞控请求。 +- Debug 的 live 网络层和 RTC 初始化拦截不变;代理只编译并使用模拟器、隔离网络与播放器替身验证,不访问真实 live 或飞控接口。 +- Xcode 标准输出写入可能因无线调试通道断开失败;使用可抛 Swift 错误的写入 API 并抑制该描述符 SIGPIPE。失败后本次运行回退系统日志,不让日志输出异常终止 App,JSON 格式保持不变。 +- `/wss` 的 `Opened` 欢迎消息仅忽略,不当作订阅成功;仍须正式 ack 与有效完整快照才能停止 HTTP 兜底,欢迎消息不延长订阅超时。 + +## 任务页无感刷新与双路图传(2026-11-03 最新用户要求) + +- 已有有效任务快照时,普通 HTTP/WS 更新不禁用页面按钮;首次加载、实际操作提交、后端门禁/无权限/结果未知等仍保持原有保护。提交操作前取消并作废在途旧读取,操作后按同任务重新核对。 +- 图传先连接机巢;收到机巢首帧后接收无人机,无机巢参数或等待机巢超时则允许接收无人机。无人机有实际视频帧时切换,无人机停流/卡顿/失败时退回仍有画面的机巢,两路均无画面时显示等待,不把静止旧帧当实时画面。 +- 一个 RTC 引擎维护两个只收视频的房间;`airport`/`drone` 参数独立解析。缺一路参数时按 `protocol.refresh_hint_ms`(默认 30 秒,限制 5~60 秒)补取同任务 live;凭证提前 30 秒续期。补流和续期保留健康房间,不随 shooting 更新反复启动。离页/后台取消定时任务并释放接收端。 +- Debug 网络和 RTC 初始化双重拦截不变;代理继续仅以隔离替身、模拟器和编译验证,不启动真实图传、不发送飞控指令。 + +## 订单列表继续查看任务(2026-11-03 张工增量合同) + +- `orders.data.list[]` 新增 `active_task_id` / `active_task_status`;仅该列表保证返回,详情和其它订单摘要缺失时按原逻辑处理。 +- 正数 `active_task_id` 是 `order_flight_task.id`,有值时优先显示“继续查看任务”,不受 `can_create_task` 影响。点击复用任务页,携带该 ID 读取 shooting;不重新创建任务、不再次召唤。 +- 后端负责候选选择:有效状态 20、排除关联航线已终止的旧任务、多候选按创建时间和 ID 升序取最早一条。App 不再请求 tasks 自行筛选,不用 shoot_status 或 wayline_task_id 猜任务。 +- 工作台与“我的拍摄订单”均应用该规则;返回列表重新读取,候选变更或变为 null 后更新入口。任务页具体阶段仍以 shooting/WS 为准,20 也可包含下载、上传、渲染。 + +## WebSocket 欢迎帧与拍摄后素材处理(2026-11-03 朱工更新) + +- 建连后先等待纯文本 `Opened`,再显式发送一次 310 JSON 文本帧;不将订阅放入握手 Query。覆盖上文“仅忽略 Opened”的旧实现。重复欢迎帧不重复订阅,不重置首包超时。 +- WebSocket ack 和完整快照的成功码按新版文档为 `100000`;仍须同任务订阅 ack 加有效完整快照才停止 HTTP 兜底。未收到欢迎帧、发送失败、订阅/首包超时均恢复只读兜底并退避重连取新票。 +- `ui.phase=post_shoot_uploading` 表示录制结束后的下载/上传/渲染(wayline 24/30/40),任务 status 仍为 20;即使 `finished_at` 有值或开拍门禁 false,也不能判为完成或阻止阶段。页面保留刷新,展示后端阶段标题/说明,不虚构百分比。 +- `completed` / 一致的任务成功态才提供查看素材;失败、取消与冲突状态保留原有保护。HTTP 和 WS 共用阶段及版本校验。 +- 代理仅编译、使用模拟器和隔离替身验证,不创建真实任务、不访问图传或飞控。 + +## 录制完成提示与图传结束(2026-11-03 后续用户要求) + +- 本节覆盖上文拍摄后仍在任务页展示“拍摄完毕上传中”的 UI 约定。可信 `post_shoot_uploading` 表示录制结束,页面显示“拍摄已完成”,弹窗提供“稍后再去 / 去查看”;进入当前订单素材库查看上传进度及素材,不更改后端 status=20,不宣告素材就绪或次数扣减。 +- 完成提示按任务和 execution_batch 在当前页面会话中去重;相同批次的上传、完成快照及前后台切换不重复弹出。失败、取消、身份不符及冲突快照不触发成功提示。 +- 录制结束后停止本地 RTC 接收、取消 live 补流/续期和在途请求,显示静态拍摄封面。准备页传入点位封面,缺失时显示中性封面;不使用演示照片冒充当前拍摄。旧播放器回调不能恢复实时画面,已结束任务首次读取后不再启动 live。 +- RTC 首帧等待超时只允许尝试另一路,保留已有房间等待晚到的发布/首帧;按 SDK 发布的 streamId 订阅,不假定流索引为 0。补流回包轮换 user_id 时,原房间凭证未临期则保留原身份,临期后才替换。 +- 只停止本机接收,不发送设备停流或飞控指令。Debug 的网络层、播放器和 SDK 初始化保护保持;代理仅用隔离替身、模拟器测试和无签名 Release 编译验证。 + +## 准备页电量与前往点位(2026-11-03 最新用户要求) + +- 用户要求准备页获取并展示电量。Release 的 `plane-status` 保留调用方 `live_battery=1`,覆盖旧的该接口一律强制 0 约定;Debug 真实传输仍强制 0。`shooting` 的 `live_battery=0` 和 `status` 的 `live_metrics=0` 不变。代理仍不执行真实采集,只验证隔离替身。 +- 准备页展示后端推荐设备的状态;完整文案缺少电量时补充 `battery_label` / 有效 `battery_percent`,避免重复,缺失不当作 0,不改选飞机。 +- 从确认并召唤进入任务页时,同任务、同订单、同景区的明确 `accepted=true` 且 `ui.phase=going_to_spot` 回执可用于首份快照前的“无人机正在赶来”过渡。不得将此回执当作真实起飞、到达或开放开拍的依据。 +- HTTP / WS 的 `going_to_spot` 展示“无人机正在赶来”;到达仍以 `arrived_pending_start` 和开拍门禁判断,不用固定等待时长或任务状态 20 推断。若后端过早报到达,需后端核查当前航线批次的到达首点判定。 + +## 任务页图传标识、完成态与倒计时(2026-11-03 最新用户要求) + +- 正在播放时不显示“刷新图传”,左上仅小绿点与“实时图传”;无首帧、失败或静态封面不能显示实时标识。失败/不可用时保留主动重试,本地演示仍明确标注模拟来源。 +- “拍摄已完成”状态按体验原型采用左侧浅绿圆形勾、右侧标题和说明、下方整行“查看素材”;该面板不再显示设备摘要和“详情”。返航说明必须有当前设备状态依据,后续失败快照仍优先显示失败。 +- 用户最新确认:到达后的 30 秒倒计时由 App 自行创建和维护,仅显示剩余秒数,覆盖旧的“等待后端提供截止时间字段”约定。首次接受本任务批次的可信到达快照后开始,同批次 HTTP/WS 刷新不重置;到零保留 0 秒,不自动请求状态、发送开拍或切换阶段。后端返回拍摄中时立即按接口更新 UI,即使倒计时尚未结束。 +- 本地倒计时采用单调时钟;离页/后台停止界面定时刷新,同一页面会话返回后按已过去时间继续。新执行批次重新计时,身份失效或明确清除快照时清理;不持久化或跨账号共享计时数据。 +- 用户再次明确:已到达且既有开拍门禁满足时,“开始拍摄”可手动点击,与倒计时不冲突;30 秒、倒数中及 0 秒均不因计时本身禁用。实际点击沿用防重复提交、受理/结果未知锁和后端状态确认,Debug 真实操作拦截继续保持。 + +## 无人机状态枚举职责(2026-11-03 用户补充 9.9.1 合同) + +- 设备忙闲以 `work_status` 为准:0 离线、1 空闲、2 拍摄中;`online_status=1` 表示在线,其他已提供整数表示离线,不能覆盖明确的工作态。`is_receive_order` 的 1/2 为可接单/暂停接单,不等同于当前任务操作许可。 +- 订单飞行任务 status:10 待执行、20 执行中、30 成功、40 失败、50 取消、60 待确认。航线 wayline_status 是另一组枚举:29 拍摄失败、39 上传失败、49 渲染失败、91 执行失败、90 取消;24/30/40 分别为下载/上传/渲染,不能混用数字值。 +- 拍摄页进度优先使用 `ui.phase`。`post_shoot_upload_failed` 单独展示素材处理失败及素材入口;录制已结束,停止本机图传,不弹成功提示,不因素材失败自动开放重召唤。后端明确 `failed_restartable` 的既有重召流程继续保留;工作态为 2 时显示忙碌并禁止重召。 +- 任务待确认时只读核对,不利用旧的开拍门禁或指令列表继续操作。未知枚举保持未知,不用设备在线或“拍摄中”工作态推导首点到达或自动开拍时间。 + +## 正常拍完开始返航即完成(2026-11-03 朱工最新合同) + +- 后端确认司空 `taskDetail.status=success` 后设置本批次返航标记并进入 `wayline=24`,返回 `ui.phase=post_shoot_uploading`,无需等回巢、finished_at 或素材就绪;App 立即展示“拍摄已完成”,沿用完成弹窗、静态封面及本机图传释放流程,不提前改写订单任务成功态。 +- 解析顶层与 UI 的 `shoot_complete_returning` 以及 `ui.wayline_stage=shoot_done_returning`。仅可信完成环节使用标记显示“无人机正在返航,请留意现场”;进入航线 30/40 后改为上传/渲染说明,显式 false 不沿用返航说明。完整快照按任务/批次/版本整体替换,不把旧标记留到后续状态。 +- `partially_done` 对应航线 29 和订单任务失败,手动 `result_code=return_home` 也属中断失败;失败、取消、待确认和冲突规则优先,标记不能把这些情况升级为拍摄完成。未知 UI 阶段也不只凭标记推导成功。 +- App 不直接探测司空任务、不执行后端 `markShootDoneReturning` 等内部操作;代理继续只使用隔离替身、模拟器及无签名 Release 编译验证。 + +## 工作台进入任务的返回路径(2026-11-03 用户要求) + +- “机巢工作台 → 拍摄准备 → 拍摄任务”进入任务时,以任务页替换导航栈顶的准备页;任务页返回直接回到原工作台实例。保留工作台之前已有的页面,不创建新的工作台,不通过自定义返回动作绕过导航栈。 +- 准备页成功自动进入任务和点击“查看拍摄任务”共用该路径;既有任务身份、导航防重、离页取消和 Debug 禁飞保护继续保持。 +- 独立模拟/调试启动以准备页本身作为导航根页面时,保留根页回退入口;不为此创建真实任务或构造新的工作台。 + +## 任务页移除详情与拍摄中原型对齐(2026-11-03 用户要求) + +- 拍摄任务页移除通用“详情”按钮,其他阶段的主按钮占整行;失败原因区域仍可点击展开完整原因。 +- 可信拍摄中阶段使用产品文案“无人机正在拍摄中”,说明分两行显示“请关注现场及实时画面。”和“请勿关闭本页或息屏。”。按 [机巢体验原型](https://voicestudio.suixinkan.cn/) 展示左侧浅蓝圆形视频图标、右侧标题与说明、下方整行浅蓝禁用“拍摄中”指示按钮。 +- 拍摄中面板不显示设备摘要和中央刷新操作;导航栏刷新保留。禁用的“拍摄中”仅作状态展示,不提交飞控或其他主操作。 +- 此调整只影响展示和操作布局,后台真实阶段、失败/取消优先级、任务身份与版本校验、安全门禁、HTTP/WS 读取及既有 Debug 禁飞保护不变;代理不执行真实任务创建、飞控或图传。 + +## 起飞准备、到点等待与独立安全控制(2026-11-04 最新合同) + +- 本节覆盖旧的暂停判定和指令全局等待锁。`starting` 表示召唤已受理、起飞准备,配合 `ui.phase=going_to_spot` 展示前往点位;仍在巢内不等于本批次已返航。`returned` 由后端确认本批次曾起飞/离巢且现在 inside,App 同时核对 `is_airborne=false`,不推测回巢。 +- 到点自动悬停为 `state=executing`、`pause_reason=arrival_wait`、`ui.phase=arrived_pending_start`;只有 `pause_reason=manual` 的可信 paused 才展示手动暂停。`resume_phase` 包括 `arrived_pending_start`,继续此阶段由后端软恢复,不直接开拍;返航暂停后继续恢复返航。 +- 安全控制按同任务批次的明确设备身份、`is_airborne` 和 `can_pause/can_resume/can_return_home` 独立授权。起飞准备按合同允许显式 `can_return_home=true` 的返航入口;前往、到点、拍摄时两个安全动作均可,手动暂停禁重复暂停,返航中禁重复返航。业务失败、录制完成、素材上传或渲染不能单独禁用仍在飞行的安全控制。 +- 每次点击生成 `client_request_id`,核对回执 `command_id`;HTTP/WS 的 `flight_control.pending_command` 和回执顶层 `pending_command` 按指令与请求标识关联。仅对应按钮 loading,中央保留业务阶段;一个动作等待/结果未知不无条件拦截另一安全动作。客户端只串行 HTTP 提交,不等待前一设备确认;后受理的指令取代旧意图,迟到回执不得重建旧锁。无明确结果不自动重发。 +- 明确设备确认可结束按钮动画,但仍需新完整快照更新中央状态及操作许可;同批次快照不得低于已受理回执的 `state_version`。新批次清理旧指令和版本下限,离页/后台取消读取与在途操作;Debug 网络及 RTC 拦截不变。 +- `metrics_stale=true` 仍展示后端最近值;App 同批次、同设备保留有效读数作为缺值防御并标记过期,不改写原始 JSON,不跨批次/设备继承。代理仅使用隔离替身、真机单元测试与无签名 Release 编译,不发真实飞控或图传。 + +## 拍摄真机录屏诊断(2026-11-04 用户要求) + +- 用户要求在 iOS 关键位置增加控制台日志,与其后续真实测试录屏对照。本节允许额外输出 `diagnostic=drone_task` 的任务关键事件,覆盖旧的“页面/解析/RTC 事件全部静默”限制;其它模块和接口 JSON 仍保持原 path/params/response 格式。 +- Debug/Release 均输出上海时区毫秒时间、单调耗时、会话 ID、事件序号及构建信息。记录准备与任务页导航、HTTP/WS 快照采纳/丢弃原因、后端证据与本地阶段/权限、指令幂等关联与按钮等待、读数过期及图传首帧/切换/停止。 +- UI 状态变化去重;倒计时只记开始、归零、隐藏,不逐秒输出;不恢复逐帧或心跳日志。复用已有安全控制台写入和系统日志回退,日志不得更改网络、状态、门禁或禁飞保护。代理仍仅以隔离替身和编译验证,真实设备操作由用户自行执行。 + +## Debug 与 Release 真实操作开放(2026-11-05 最新用户要求) + +- 用户明确要求 Debug、Release 两种构建均允许真实指令。本节覆盖前文按构建类型禁止任务创建、召唤、开拍、安全控制及图传的限制;不再保留 Debug 专用网络或 RTC 初始化拦截,也不以构建类型禁用准备页提交。 +- 两种构建均沿用真实业务服务与现有接口门禁、账号/景区/订单/任务/设备身份校验、批次及版本检查、防重复提交和结果未知锁。允许真实操作不等于跳过业务许可,不自动重发结果未知的设备指令。 +- 保留独立本地模拟入口及明确模拟来源;内存模拟传输仍不转发真实网络,模拟回执不能记作后端或设备真实成功。 +- 代理仍仅使用隔离网络、服务及播放器替身和编译验证,不主动创建真实待飞任务、不发送真实飞控指令、不调用真实 `live` 或连接 RTC;真实环境操作由用户自行执行。 +- 状态读取缓存策略不变:`shooting` 使用 `live_battery=0`,`status` 使用 `live_metrics=0`;`plane-status` 在两种构建中均保留调用方传入的 `live_battery`,准备页按既定需求读取电量。 diff --git a/Podfile b/Podfile index cd31c66..1aebd4f 100644 --- a/Podfile +++ b/Podfile @@ -21,6 +21,8 @@ target 'suixinkan' do pod 'IQKeyboardManagerSwift' # 微信 Open SDK:仅接入分享能力,不调用支付 API。 pod 'WechatOpenSDK-XCFramework', '~> 2.0.4' + # 机巢图传只订阅远端视频;固定官方 SDK 版本及必要运行库。 + pod 'VolcEngineRTC', :podspec => 'https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json', :subspecs => ['Core', 'RealXBase', 'RTCFFmpeg'] target 'suixinkanTests' do inherit! :search_paths diff --git a/Podfile.lock b/Podfile.lock index 9a5c43e..ba6e08e 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -54,6 +54,9 @@ PODS: - UMCommon (7.5.11): - UMDevice - UMDevice (3.6.0) + - VolcEngineRTC/Core (3.60.107.1100) + - VolcEngineRTC/RealXBase (3.60.107.1100) + - VolcEngineRTC/RTCFFmpeg (3.60.107.1100) - WechatOpenSDK-XCFramework (2.0.5) DEPENDENCIES: @@ -67,6 +70,9 @@ DEPENDENCIES: - UMAPM - UMCommon - UMDevice + - VolcEngineRTC/Core (from `https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json`) + - VolcEngineRTC/RealXBase (from `https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json`) + - VolcEngineRTC/RTCFFmpeg (from `https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json`) - WechatOpenSDK-XCFramework (~> 2.0.4) SPEC REPOS: @@ -90,6 +96,10 @@ SPEC REPOS: - UMDevice - WechatOpenSDK-XCFramework +EXTERNAL SOURCES: + VolcEngineRTC: + :podspec: https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json + SPEC CHECKSUMS: AMap3DMap-NO-IDFA: f53ee0cb33db83c1a08856b5995e53a0c2096158 AMapFoundation-NO-IDFA: a2e3c895398d7ee757278e1a0a8f9359da4b146e @@ -108,8 +118,9 @@ SPEC CHECKSUMS: UMAPM: ba9fbebe8dd2048b251c332ab0afc86e1ba5ea63 UMCommon: d652b3b372a801b36db203f5b546ab3e15676898 UMDevice: 20b7b3c37a36b2c5c7ca8b5a54386ff9ed2b3b19 + VolcEngineRTC: 370b06b0c141dcc76bc72bbd34564f98cf370ef3 WechatOpenSDK-XCFramework: ff342ae616bb86df3d236aca38059dfd4bc4a949 -PODFILE CHECKSUM: 5abf70ade4a9c4b66b64877fdea91f1d086bcaf5 +PODFILE CHECKSUM: aa5185164c92649862d0a3009e4448d7ac0f3b83 COCOAPODS: 1.16.2 diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 9a5c43e..ba6e08e 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -54,6 +54,9 @@ PODS: - UMCommon (7.5.11): - UMDevice - UMDevice (3.6.0) + - VolcEngineRTC/Core (3.60.107.1100) + - VolcEngineRTC/RealXBase (3.60.107.1100) + - VolcEngineRTC/RTCFFmpeg (3.60.107.1100) - WechatOpenSDK-XCFramework (2.0.5) DEPENDENCIES: @@ -67,6 +70,9 @@ DEPENDENCIES: - UMAPM - UMCommon - UMDevice + - VolcEngineRTC/Core (from `https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json`) + - VolcEngineRTC/RealXBase (from `https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json`) + - VolcEngineRTC/RTCFFmpeg (from `https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json`) - WechatOpenSDK-XCFramework (~> 2.0.4) SPEC REPOS: @@ -90,6 +96,10 @@ SPEC REPOS: - UMDevice - WechatOpenSDK-XCFramework +EXTERNAL SOURCES: + VolcEngineRTC: + :podspec: https://raw.githubusercontent.com/volcengine/volcengine-specs/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json + SPEC CHECKSUMS: AMap3DMap-NO-IDFA: f53ee0cb33db83c1a08856b5995e53a0c2096158 AMapFoundation-NO-IDFA: a2e3c895398d7ee757278e1a0a8f9359da4b146e @@ -108,8 +118,9 @@ SPEC CHECKSUMS: UMAPM: ba9fbebe8dd2048b251c332ab0afc86e1ba5ea63 UMCommon: d652b3b372a801b36db203f5b546ab3e15676898 UMDevice: 20b7b3c37a36b2c5c7ca8b5a54386ff9ed2b3b19 + VolcEngineRTC: 370b06b0c141dcc76bc72bbd34564f98cf370ef3 WechatOpenSDK-XCFramework: ff342ae616bb86df3d236aca38059dfd4bc4a949 -PODFILE CHECKSUM: 5abf70ade4a9c4b66b64877fdea91f1d086bcaf5 +PODFILE CHECKSUM: aa5185164c92649862d0a3009e4448d7ac0f3b83 COCOAPODS: 1.16.2 diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index 7c20af0..b218191 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -9,22 +9,32 @@ /* Begin PBXAggregateTarget section */ 09FABB7D06BB8D3958515FB15B4E7971 /* UMCommon */ = { isa = PBXAggregateTarget; - buildConfigurationList = 16042111B26CDDA811DEA06D014F8608 /* Build configuration list for PBXAggregateTarget "UMCommon" */; + buildConfigurationList = 3CBF9BFF072845753899694FE4E10ADD /* Build configuration list for PBXAggregateTarget "UMCommon" */; buildPhases = ( - 49D5D275B9638EA1DE91DD3E23193CB6 /* [CP] Copy XCFrameworks */, + 687BC05C1C9FCCA798AEC343D76C61BA /* [CP] Copy XCFrameworks */, ); dependencies = ( - 65ACB98E7ACF99994DC0973B228171CD /* PBXTargetDependency */, + 4F6360FC32BA6CA3C9D8A7A764A273B9 /* PBXTargetDependency */, ); name = UMCommon; }; + 40080C576D6EAF0D191988D3C110FE86 /* VolcEngineRTC */ = { + isa = PBXAggregateTarget; + buildConfigurationList = B8512451BF5D7A50FA5BBF381F5C922B /* Build configuration list for PBXAggregateTarget "VolcEngineRTC" */; + buildPhases = ( + ECDA6B91060A6384A59E2057D1742B26 /* [CP] Copy XCFrameworks */, + ); + dependencies = ( + ); + name = VolcEngineRTC; + }; 4BD4E22D3419D68A85BDD6119CB37C6C /* AMapLocation-NO-IDFA */ = { isa = PBXAggregateTarget; buildConfigurationList = 42EC8F64C3654164552B3366BF3A3C6D /* Build configuration list for PBXAggregateTarget "AMapLocation-NO-IDFA" */; buildPhases = ( ); dependencies = ( - 43B6F441EC86468D6C229FFE788CFF86 /* PBXTargetDependency */, + A29280CF0ECF52479D7F88904ED009B8 /* PBXTargetDependency */, ); name = "AMapLocation-NO-IDFA"; }; @@ -34,7 +44,7 @@ buildPhases = ( ); dependencies = ( - 4D7527C0D0F449074058BC407459B048 /* PBXTargetDependency */, + 7B659A53BDE555DBF687F9AF5C5363FC /* PBXTargetDependency */, ); name = "AMapSearch-NO-IDFA"; }; @@ -45,7 +55,7 @@ 329295F5A096E0819713CBB5799FA87B /* [CP] Copy XCFrameworks */, ); dependencies = ( - 1B8EC6C3953225A69E2312C224DD5150 /* PBXTargetDependency */, + 13504B3EA0645BC1C860440A351676E5 /* PBXTargetDependency */, ); name = JPush; }; @@ -61,7 +71,7 @@ }; 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */ = { isa = PBXAggregateTarget; - buildConfigurationList = E3CD454E946A968A8CC1F29529A26395 /* Build configuration list for PBXAggregateTarget "AMapFoundation-NO-IDFA" */; + buildConfigurationList = 2F6FDA2B7AE29776104CCA1C5E80F704 /* Build configuration list for PBXAggregateTarget "AMapFoundation-NO-IDFA" */; buildPhases = ( ); dependencies = ( @@ -74,15 +84,15 @@ buildPhases = ( ); dependencies = ( - D4853B8A651ECA6D156A2EF893BAA13A /* PBXTargetDependency */, + 05A1AEC02A423CBCC2DFC09F9D4FFB74 /* PBXTargetDependency */, ); name = "AMap3DMap-NO-IDFA"; }; CEB9AD2C3CFC208BFBE1F22F5EC3E1FC /* UMDevice */ = { isa = PBXAggregateTarget; - buildConfigurationList = B02BDB8270BB7783F0A9C8763864097B /* Build configuration list for PBXAggregateTarget "UMDevice" */; + buildConfigurationList = 3359FFF96FDC1E39EBC821362A8761CD /* Build configuration list for PBXAggregateTarget "UMDevice" */; buildPhases = ( - 22BE81B1621BDC2850C4141134417CBC /* [CP] Copy XCFrameworks */, + EF59C84659DB739B12DAAEEB8A35993A /* [CP] Copy XCFrameworks */, ); dependencies = ( ); @@ -105,773 +115,796 @@ AAA46959952B8A86CC060F4456AEC1FE /* [CP] Copy XCFrameworks */, ); dependencies = ( - 73511E9AA76ADF17F178F12B12FB430A /* PBXTargetDependency */, + 7A9D23AB68ABBF5DE686EF168016478D /* PBXTargetDependency */, ); name = UMAPM; }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 008AB2CBF9BF6738A01E4780544FEE28 /* IQKeyboardCore-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 24AB5750A05B063EA0DA3264D3001A19 /* IQKeyboardCore-dummy.m */; }; - 0494B703203A9A07C23ABBAEBEA3A7D2 /* UIView+IQKeyboardManagerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6388414814252F565A677CD3D17EC014 /* UIView+IQKeyboardManagerExtension.swift */; }; - 04BD4928C99B51A317B39CF5C0C3F780 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 008AB2CBF9BF6738A01E4780544FEE28 /* IQKeyboardCore-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C800E6213B65C17D9D650EFBA167370D /* IQKeyboardCore-dummy.m */; }; + 023968E1994C2A76DED24E2225272452 /* IQKeyboardToolbarConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DB63DD174AA36A665DF6EFDF91B9E37 /* IQKeyboardToolbarConstants.swift */; }; + 028B34F60037C63915906C0ED6B79E64 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + 0494B703203A9A07C23ABBAEBEA3A7D2 /* UIView+IQKeyboardManagerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 301B8B14D78023F3DD043BCBFC93130A /* UIView+IQKeyboardManagerExtension.swift */; }; 06EC579860CC68D7557726CE2396C1E8 /* IQKeyboardCore-IQKeyboardCore in Resources */ = {isa = PBXBuildFile; fileRef = 6E897F35E5E27028AC58B14B552FBC8D /* IQKeyboardCore-IQKeyboardCore */; }; - 0A44FCC4CCED0CBED8CC3FED0B036F21 /* IQKeyboardToolbarManager+Toolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B4C7AD499AF7BCC14C3DC4248A326F /* IQKeyboardToolbarManager+Toolbar.swift */; }; - 0B711521C37380AB3ED0C13EF0FAF9A6 /* UIView+IQKeyboardExtensionObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0FF26EF54F0D2CCEEC60FB7E97B123 /* UIView+IQKeyboardExtensionObjc.swift */; }; - 0C924236B7292794AE10E4BBFABC8448 /* IQKeyboardToolbar-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C93B314BF63192FFFEA853AD9BA8066A /* IQKeyboardToolbar-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0E0C92029C63C476812AB8A5E69F1A0E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 0D09F2E4090347B87C0D1233FA5DA053 /* UIView+Responders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 257BCE628592783EF9A5E519CCA2AC16 /* UIView+Responders.swift */; }; + 105766C76A96ECCBD2CC894D747781C7 /* IQTextInputViewInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59F91AFD79784903BF8352CDFAF43B9 /* IQTextInputViewInfoModel.swift */; }; + 11257CC87FF4D3453F57F94F9C131841 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; 11BD4C25B489397A643CCB5971854A74 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 124BCB4411C266F74471632FEE411FDC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 1262CF3C963C0DA764124961D439B49F /* IQBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8ED740F9377F944E3895021F134AC68 /* IQBarButtonItem.swift */; }; - 126F042D4B2F340DE3138253C1BD9C99 /* IQPlaceholderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5EDDC96EA8A526C228C3ABF1B82399 /* IQPlaceholderable.swift */; }; - 1369B279D519A23EADFE21DC37795BF7 /* IQKeyboardToolbarManager+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FDC889F8FBF31BC6E149B59F01A74FC /* IQKeyboardToolbarManager+Debug.swift */; }; - 145C5563356F971C32E32BA303E1F5ED /* IQKeyboardManager+Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50BF2C383279DDB7880AF4C978116E2 /* IQKeyboardManager+Deprecated.swift */; }; - 145F2AF90B26E3E80742AC28664C25DC /* IQKeyboardManager+Resign_Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778FA22D4BEBBF59A58346CBF997FEA5 /* IQKeyboardManager+Resign_Deprecated.swift */; }; - 152B0D3FD8A2881CB69B710D55974FB9 /* IQKeyboardToolbarManager+Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31D405B850F4246DA579A22B97251360 /* IQKeyboardToolbarManager+Deprecated.swift */; }; - 17614D76161DA05893BDDA40F96592F8 /* IQKeyboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6759C2C05A896EEF5A902F54ED815458 /* IQKeyboardManager.swift */; }; - 1B4F7C2C1D88307F12609EAC0464AB86 /* IQKeyboardExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA76A2A5EC61CC8B474C1A4551226332 /* IQKeyboardExtended.swift */; }; - 1BE160B878A28F5FA898999E0805FCCE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 1EDF6B321C32F18C59FF1A110F1A7542 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = BC217F78CA99FD3D41A3303B824C278D /* PrivacyInfo.xcprivacy */; }; - 1F95AF2D6F6B697AF9F5A65E2FEEA091 /* IQActiveConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4C246899B9ADD76C47413CFC1900669 /* IQActiveConfiguration.swift */; }; - 20302EF7FDF8788C2A52BEC837617E24 /* IQInvocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34893074C574951651CAE0489239E848 /* IQInvocation.swift */; }; - 20AA7AC737EFD9101D0CA80E389B88ED /* IQKeyboardReturnManager-IQKeyboardReturnManager in Resources */ = {isa = PBXBuildFile; fileRef = 110BD425B6CAD6801539E2C6AB6E0662 /* IQKeyboardReturnManager-IQKeyboardReturnManager */; }; - 25EE6824CF8528BDE7A1F21B97A2936B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 292D299D31BD527F867A6EF6C0EFA308 /* IQKeyboardManager+ToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 992554533A232CEC66E7397532159E20 /* IQKeyboardManager+ToolbarManager.swift */; }; - 2C730EA2EAA103C35CBEFAB503879980 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 7AF35518DCE4701B077F7D5E23122BAD /* PrivacyInfo.xcprivacy */; }; - 2F0C1DF6BCC18175DF00FA36A403917E /* IQKeyboardToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AA33750C13A35FA4DFFEA7D3E1D6F71 /* IQKeyboardToolbar.swift */; }; - 31EF2638094D4B4F5927495A2B7D798B /* IQKeyboardToolbarConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AEC002400E17D448789C96C9A991A76 /* IQKeyboardToolbarConstants.swift */; }; - 339BEA53AF28A59C4663E40B91D9B370 /* IQKeyboardToolbarManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6753350B51E82A0FE23F430A0B57E601 /* IQKeyboardToolbarManager+Internal.swift */; }; - 380C9A16512596163FFB339B98F75C16 /* Combine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */; }; - 3A0561008BBDB7CC5003F67D1ED67D53 /* UIView+Parent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70E7C93840EABBEDEEF083F6B142029D /* UIView+Parent.swift */; }; - 3D95FD8AB8B46CBF113FBAE86FB8B059 /* UIView+Resign.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0003B8890568226024C1462834BA44 /* UIView+Resign.swift */; }; - 3EAF4037851BF1BBAB5916DB7F601763 /* IQKeyboardNotification-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F8DC7287225EB89CFFDCA5DD231B629 /* IQKeyboardNotification-dummy.m */; }; - 4247E13AB347A07432756BB3A75A3DC6 /* UIView+ParentObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87CC2842EDD9352F470FE692A9B91AA5 /* UIView+ParentObjc.swift */; }; - 4514FAA3C174519C3DB0A39CCE329F2B /* IQKeyboardReturnManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 629DD1DA2A6BB7211D4AA2CDC4ADE1BE /* IQKeyboardReturnManager.swift */; }; - 48218E2CD382EF08D195E251C7DFC3DE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 4C73B683C1DE3DDA347772B0FE6738A4 /* IQKeyboardResignHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12612B1AED7EE8CCD44571B43987BBB /* IQKeyboardResignHandler.swift */; }; - 4E1921C623087691990B31EDBD52908D /* IQKeyboardManager+Appearance_Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC4A4ED3AA953F5ADE3FA7EC8F671377 /* IQKeyboardManager+Appearance_Deprecated.swift */; }; - 4FA399C9233F2E75DF3C61FE71FE0162 /* UICollectionView+IndexPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F613BCF49ACE20A304727CA4EDA7E47 /* UICollectionView+IndexPaths.swift */; }; - 50B903F6549D7A6DDA2DF594829F24C0 /* IQTextInputViewInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E593660B088EDD170E5B1B7CBEA3509 /* IQTextInputViewInfo.swift */; }; - 549A919387FE08829094B5E6352603DF /* Combine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */; }; - 5640D7719025E79E82B04FA0736D8F9E /* IQKeyboardCore-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B634D0C8582340A26DF881074996135 /* IQKeyboardCore-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 572C619BF2E60BBCD0EC79B96F6F290F /* IQKeyboardConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4ADD25EEB716A656CC0DBEDCC9790D4 /* IQKeyboardConstants.swift */; }; + 139ACE54AA202BAD419CC5FB30BF5830 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 145C5563356F971C32E32BA303E1F5ED /* IQKeyboardManager+Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E9328F77C695432E06E224ECFC6F118 /* IQKeyboardManager+Deprecated.swift */; }; + 145F2AF90B26E3E80742AC28664C25DC /* IQKeyboardManager+Resign_Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10A4A0EAA84E9607D6E867137638C0B7 /* IQKeyboardManager+Resign_Deprecated.swift */; }; + 16EC398493578D82A603A74BBEDF61DE /* Array+Sort.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40D0A74BB726A2A8248C9847466D9CC1 /* Array+Sort.swift */; }; + 17614D76161DA05893BDDA40F96592F8 /* IQKeyboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5AD54145A409C1D7C94875810471BF1 /* IQKeyboardManager.swift */; }; + 1914F573E861800FD3E11C47F385F514 /* IQKeyboardToolbarManager-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BB647CC374FB13666973FCF51E8A4AC /* IQKeyboardToolbarManager-dummy.m */; }; + 1AF7EC23421E175ACC93A42C105CEA49 /* IQTextInputViewNotification-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 302E2D627665AA33DFD324A6B9C22B43 /* IQTextInputViewNotification-dummy.m */; }; + 1B4F7C2C1D88307F12609EAC0464AB86 /* IQKeyboardExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30ADEE09F82DF19A1888B002A47FC21 /* IQKeyboardExtended.swift */; }; + 1C2C67EA4C7B2B68FC4589BDCCD3B533 /* IQTitleBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 939F8DEAB2123EC89A5DD098E96E191A /* IQTitleBarButtonItem.swift */; }; + 1EEBBF88610B1114E92B5B2C3CB0CD3A /* IQKeyboardToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF2D49F00775A27DDCDF1AE909125185 /* IQKeyboardToolbarManager.swift */; }; + 1F95AF2D6F6B697AF9F5A65E2FEEA091 /* IQActiveConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DD839E94220ED93D5D56D7325ACB4AF /* IQActiveConfiguration.swift */; }; + 22BA2DB8232BB7DCF5B220D2C101A3B2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + 2334750B311385DD4A7F9114AA555605 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 9F8AD8BB0EBEEF249761A914B37CAD8C /* PrivacyInfo.xcprivacy */; }; + 249F48C24B2BF91AD52E41216BE2CC7A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + 24EE27EE96C2BB5CF8F92DC351D9DCC3 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D195EE12A7242B6960BDA464D00CF39D /* PrivacyInfo.xcprivacy */; }; + 25F07A0332F0686B4D52E0430ACA4050 /* IQKeyboardReturnManager+UITextViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D38BDB89CF929982D596C8C7390190C0 /* IQKeyboardReturnManager+UITextViewDelegate.swift */; }; + 263FE1F43F1D8E1B46C6313B5641FE3B /* IQKeyboardToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 679D26F54B1AA81CAB8B96B96A4E1340 /* IQKeyboardToolbar.swift */; }; + 292D299D31BD527F867A6EF6C0EFA308 /* IQKeyboardManager+ToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6FFAAA8D1615D51313B82AE95D7A0F /* IQKeyboardManager+ToolbarManager.swift */; }; + 2A8A225030C70D6832CF21149B56820A /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 46743810A3D4B51DE28F0DE3BB6D5497 /* PrivacyInfo.xcprivacy */; }; + 31FA5537FB0621C5A8A4AFE359CB4096 /* IQKeyboardToolbarManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F977EDAA0F36643B21D81D866F00325 /* IQKeyboardToolbarManager+Internal.swift */; }; + 3A0561008BBDB7CC5003F67D1ED67D53 /* UIView+Parent.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3B92976C10CBB84DC9EF347BDFC60CF /* UIView+Parent.swift */; }; + 3A6CF818BB50747C26A1C574B6ADCFF5 /* IQInvocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14791DBACC3C3EBD8BF5D28B23927645 /* IQInvocation.swift */; }; + 3D95FD8AB8B46CBF113FBAE86FB8B059 /* UIView+Resign.swift in Sources */ = {isa = PBXBuildFile; fileRef = A389B2EDC5D1D81EF043A12391638BC1 /* UIView+Resign.swift */; }; + 4247E13AB347A07432756BB3A75A3DC6 /* UIView+ParentObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1B75F1D0D65299E5DC583CECA54FDAA /* UIView+ParentObjc.swift */; }; + 464100C3AAC75B5CA14AE36040292817 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 5DA99C08528E3C22E42D003865FEC09D /* PrivacyInfo.xcprivacy */; }; + 46769B00A3AF04C4F9AE2D87955658B9 /* Combine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */; }; + 494B35A30767517DDF2768CE032A36F3 /* IQKeyboardToolbar-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9960FCCCFFE8F876FCDE0065C4FD6629 /* IQKeyboardToolbar-dummy.m */; }; + 4C73B683C1DE3DDA347772B0FE6738A4 /* IQKeyboardResignHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FA0B342A73D28669E2FA554F3636EDD /* IQKeyboardResignHandler.swift */; }; + 4C95F01EA9E552C45BBFF21C67D96571 /* IQTextView-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0D5ABBC99F3391C6F9A634D663E75422 /* IQTextView-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4E1921C623087691990B31EDBD52908D /* IQKeyboardManager+Appearance_Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F1AACDDF2D1C20591B33DD8E2A5C38 /* IQKeyboardManager+Appearance_Deprecated.swift */; }; + 4F78DB926808F54F15EAE5150D08CD7F /* IQPlaceholderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 265515AE6516C3B325D5961DCA814A4A /* IQPlaceholderable.swift */; }; + 4FA399C9233F2E75DF3C61FE71FE0162 /* UICollectionView+IndexPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B2DC97D0BB8EBFBE037BB8888E5152A /* UICollectionView+IndexPaths.swift */; }; + 53AA6596E89D66A0DE2B630DC0C06F3B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 54CE02B6FF7C86515599D09F5AE97AC2 /* IQKeyboardReturnManager-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2AB1871CDCA81B98E67F2845433559 /* IQKeyboardReturnManager-dummy.m */; }; + 5640D7719025E79E82B04FA0736D8F9E /* IQKeyboardCore-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D4F22BBAC26D59FA533BC3E2D6249904 /* IQKeyboardCore-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 572C619BF2E60BBCD0EC79B96F6F290F /* IQKeyboardConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1432B7B9FB7E007C7E5FD5F9AB24198B /* IQKeyboardConstants.swift */; }; 5C8D01AF68C2C9E27E510C10D8A0A28F /* Pods-suixinkanTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B2F70708431A20D2521270775E3BFCC3 /* Pods-suixinkanTests-dummy.m */; }; - 6426396B8E7B8854481D895B59EE2033 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 6C96447A8AE98F4D3BDF939F7266C57F /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 2A2F83D6955E3DA7E55E81A83CDD1633 /* PrivacyInfo.xcprivacy */; }; - 6F28DC7E3DFE272A55834DCAA3BC46E3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; - 7140EFC50C715BE19C49D09F4E8B001E /* IQKeyboardToolbarManager-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C026F448EE161E5AA295F2DD8C00F78B /* IQKeyboardToolbarManager-dummy.m */; }; - 73E5FDFB080961A009BDB44B202BFB57 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = A3B399BF12010721D7606DE2C51AC0EF /* PrivacyInfo.xcprivacy */; }; - 74091D9359EC6AF9E1E93894F2F554F4 /* IQKeyboardManager+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 407749166D56AC58042E7F89FDD486AD /* IQKeyboardManager+Appearance.swift */; }; - 753647E6489F2973A95CC4802972B4D5 /* Pods-suixinkan-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 52F75B5EC268243B9BFE349B05E52A20 /* Pods-suixinkan-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 789681091CE951D7A2AFAEDDB746D97E /* IQTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097E3C45E430629A425D0B19A2A6E19C /* IQTextView.swift */; }; - 791C3A33D30AC700243D4685CAB59EA7 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 9517DFB02CF19FA4C175500597CC473D /* PrivacyInfo.xcprivacy */; }; - 794E0A6AE50125209FEB21F836F814A8 /* IQKeyboardNotification-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9A9140CB6ADD033768BB60CEA72E7A /* IQKeyboardNotification-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 797C139C4DAD4AFC09C97E71C2457033 /* UIViewController+ParentContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AF4AEB75D89FF3F06FDE6A004EA9A23 /* UIViewController+ParentContainer.swift */; }; - 7ABA54F3D307204A0413D0E117574E89 /* IQKeyboardAppearanceManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8ABCFBB8BDD11CFBF49406BF0165A41 /* IQKeyboardAppearanceManager+Internal.swift */; }; - 7B2AEE17FD04F5CC53CD6E52F25B63B6 /* UITableView+IndexPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 244D954871A873D3E39E3064D852B516 /* UITableView+IndexPaths.swift */; }; - 7BF320447891FB83F74C8BC147F74898 /* IQTextInputViewNotification-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = ADB26D0335D3238C4C3CACC81077B951 /* IQTextInputViewNotification-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7CC5EC3E1C7BAD3A74DEDFD8D3E8FCD3 /* IQKeyboardAppearanceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73F4A4C2EB0A4E49EC7BFE3DACD2CCD5 /* IQKeyboardAppearanceManager.swift */; }; - 7CCA3371017E9A9E03A8BEB175DB8414 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 5EAF6B62A82569F4767893AB4F1DEEF4 /* PrivacyInfo.xcprivacy */; }; - 7D7049ABBC602DFAA8118688EDE0C5F9 /* IQKeyboardReturnManager-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = AE62D9B077B5FC3AD4F95C8A43FB4558 /* IQKeyboardReturnManager-dummy.m */; }; - 7D9B1CAFA6BC311446E2EB4FB8FC05D6 /* IQKeyboardManager+Resign.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B684CF1599F22DF5238BEF46E8CD746 /* IQKeyboardManager+Resign.swift */; }; - 7DA65932A24360D599F10035119EA5E2 /* IQKeyboardToolbarConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B4EA2289D2B8316CE956FF2268D0114 /* IQKeyboardToolbarConfiguration.swift */; }; + 64FCAFDF9302AC4563973F3E65DDDA01 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 67E64022C5EA54D4143D421708FB4552 /* IQTextView-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F9BF1DD8D3901D2CB56396040F28392 /* IQTextView-dummy.m */; }; + 6B091DC2D97D18146714D417F8493EE2 /* Pods-suixinkan-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 52F75B5EC268243B9BFE349B05E52A20 /* Pods-suixinkan-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6FC415C672CEECF110E3AE9293F370FB /* IQKeyboardReturnManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32933D0AEA1AF3988E2782401F17B221 /* IQKeyboardReturnManager.swift */; }; + 74091D9359EC6AF9E1E93894F2F554F4 /* IQKeyboardManager+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CB214999237C638FFC3DB3AE121DAD5 /* IQKeyboardManager+Appearance.swift */; }; + 7627D9AB0E166EFB41F915C6335FAB38 /* IQKeyboardToolbar-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B15A89F8DECA647A9464E7868B3D9832 /* IQKeyboardToolbar-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 79392C6B2D1DDCB948DA3383908E91EF /* IQKeyboardToolbarManager+Toolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70C6CBF2C487B6296E36E4818045F76 /* IQKeyboardToolbarManager+Toolbar.swift */; }; + 7973C48AD6DC2FBEBF2D2CDD685AF8CF /* IQDeepResponderContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBFDC425AA2C8AD908DA6ABC7D368DD /* IQDeepResponderContainerView.swift */; }; + 797C139C4DAD4AFC09C97E71C2457033 /* UIViewController+ParentContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3DCEB6C2B197ABE227932FEA2419037 /* UIViewController+ParentContainer.swift */; }; + 7ABA54F3D307204A0413D0E117574E89 /* IQKeyboardAppearanceManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10CB1E0D11EC51CC988C1E27607C73A7 /* IQKeyboardAppearanceManager+Internal.swift */; }; + 7AD979D5CC2083E382D296DE8B0A644D /* UIView+IQKeyboardExtensionDeprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F30991F76663516B678C382E5C3778C /* UIView+IQKeyboardExtensionDeprecated.swift */; }; + 7B2AEE17FD04F5CC53CD6E52F25B63B6 /* UITableView+IndexPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22DE40CC56B3E094BCE71F0843177D6C /* UITableView+IndexPaths.swift */; }; + 7CC5EC3E1C7BAD3A74DEDFD8D3E8FCD3 /* IQKeyboardAppearanceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025FF22A5001E60904C397A76E0C09B4 /* IQKeyboardAppearanceManager.swift */; }; + 7D9B1CAFA6BC311446E2EB4FB8FC05D6 /* IQKeyboardManager+Resign.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69234E4D1FF97AA77BC3546B03B96407 /* IQKeyboardManager+Resign.swift */; }; 7E60FD4609EDDF8E83DB794814DB7BC6 /* IQKeyboardManagerSwift-IQKeyboardManagerSwift in Resources */ = {isa = PBXBuildFile; fileRef = 8D8069D3964814114ACEC3084C010B59 /* IQKeyboardManagerSwift-IQKeyboardManagerSwift */; }; - 7E8892157548D3A549F0CB486B596277 /* IQScrollViewConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE58245D58F26549A7A8CCB434AC52E /* IQScrollViewConfiguration.swift */; }; - 7FD5748EB56A4E3BF6D2ED701B2D213D /* Array+Sort.swift in Sources */ = {isa = PBXBuildFile; fileRef = B476FC7E116754954EC384BBE70ECF92 /* Array+Sort.swift */; }; - 7FDC7630F10411A4DEB79549E69F5F5F /* IQKeyboardToolbarPlaceholderConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEEC8D5C43F1F1BA28301F6F1167C87 /* IQKeyboardToolbarPlaceholderConfiguration.swift */; }; - 812AC92889B2ADB26628EC2A23707B05 /* UIView+RespondersObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3412D26E7AC83AF43C7017AB142B719D /* UIView+RespondersObjc.swift */; }; - 82D95B0853CA494D1C763438157DFBD4 /* IQKeyboardManager+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5DD064141FD6D9585DDBFF2FE5EF228 /* IQKeyboardManager+Debug.swift */; }; - 85773133CDEE15E726293BDB7E7B2CF0 /* IQTextView-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FC5970D36251A1390A17CF7571EF768 /* IQTextView-dummy.m */; }; - 85ED9426CDED97B9C5F563C4BBCE506D /* IQKeyboardReturnManager+UITextFieldDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0141CCE940C38D3566A83D1108E6A304 /* IQKeyboardReturnManager+UITextFieldDelegate.swift */; }; - 876991BF59C2E072FCCAA538D58EE3E9 /* IQBarButtonItemConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD68AF4711DE3DCD592D096BC6577207 /* IQBarButtonItemConfiguration.swift */; }; - 894C85B6B68DC29E241159AD71D06391 /* Combine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */; }; - 89B68F15FC6F3A096318B24F897ACE36 /* IQKeyboardManager+ActiveConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E23A19CFE92D16E0C6DF4232CAE6BE95 /* IQKeyboardManager+ActiveConfiguration.swift */; }; - 8A4E21670B754CB36D5C537DDFF746B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + 7E8892157548D3A549F0CB486B596277 /* IQScrollViewConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10C3C8E54ECDED1E0C05111FCCEBE7BD /* IQScrollViewConfiguration.swift */; }; + 8032C9E476F728B6BE252AADD5A46F48 /* IQTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2432EF98C1780CB63645C2E5DFBC4FE9 /* IQTextView.swift */; }; + 82D95B0853CA494D1C763438157DFBD4 /* IQKeyboardManager+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C97F1279DE48FCF5536191CB5FDC744 /* IQKeyboardManager+Debug.swift */; }; + 83EEFF802E4CAF422F9C3BA57EE92721 /* IQKeyboardNotification-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A1D98DED6CFD3022E8FC075FA491615 /* IQKeyboardNotification-dummy.m */; }; + 84ADFCB3B5116D452F2283B2C93A6544 /* IQKeyboardToolbarConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2C3388662FA183F12DC5F47940D57DC /* IQKeyboardToolbarConfiguration.swift */; }; + 859DB2F7AED6E742BD5491C50234DA05 /* Combine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */; }; + 87DBE1CA85B65864BA2BD8EE27B64F74 /* IQTextInputViewInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E3A1BD1F31324B93B3AD539F716E8F8 /* IQTextInputViewInfo.swift */; }; + 89B68F15FC6F3A096318B24F897ACE36 /* IQKeyboardManager+ActiveConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6638AB504D084AEDF76BD13D6B411686 /* IQKeyboardManager+ActiveConfiguration.swift */; }; + 8D20DCD225FDA85F616413E20B0A15E6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 8D536472BDF9BC28A40B2A6FD1CEEBA5 /* IQTextView+Placeholderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DAEBB9CD1A3D230D46015714723231 /* IQTextView+Placeholderable.swift */; }; + 8F90006048BC08268AA81256349A0735 /* IQKeyboardNotification-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = A96477B12A2B08512DEF851076308BFC /* IQKeyboardNotification-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 901486704FC0E988B9EE82D7A4C61F0F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - 91BBBA5792E4466D046C29B84142C2A7 /* UIView+ResignObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E1C0398739C8BEB724C448EE1DB0F6E /* UIView+ResignObjc.swift */; }; - 92E7912D1416834B306C09113D17A615 /* IQKeyboardManager+ToolbarManagerDeprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A9F6948FD1CA41F3ACF9F3966A3888 /* IQKeyboardManager+ToolbarManagerDeprecated.swift */; }; - 96D981E5A461F6945E18ACAEDB5AD9DA /* IQKeyboardManager+Position.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736B201311554090BB7665BFF33F0B0D /* IQKeyboardManager+Position.swift */; }; - 9701D7F75D716DA6CF8F1D3693ADCFCD /* IQTextInputViewNotification-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7824F2A9F1A4882E8AC01FC525F509DA /* IQTextInputViewNotification-dummy.m */; }; - 9759B8BA30F41528B8D6C6D796D758BD /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4294DBAFDD1C869AB58195872ECBD63C /* PrivacyInfo.xcprivacy */; }; - 977A84A34F1D6C1A79A4C065146EBF36 /* IQTextInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0A31927D7E41BFDD984506DC0F5E99 /* IQTextInputView.swift */; }; - 9C66887BAF39DDEC4615BB75A30EF766 /* IQKeyboardManagerSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D43C0E4C0ABC428E9D5A5AE717B658E /* IQKeyboardManagerSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9DF018FD9B2DA31BB1FF9830ED380650 /* IQTextInputViewInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE41AE378E9210FE5D862A988433348E /* IQTextInputViewInfoModel.swift */; }; + 91BBBA5792E4466D046C29B84142C2A7 /* UIView+ResignObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 672521CE7AABAB88CAC5DA46DE3917EE /* UIView+ResignObjc.swift */; }; + 92E7912D1416834B306C09113D17A615 /* IQKeyboardManager+ToolbarManagerDeprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BC53E8C93DDB8078EB3832DF5645C3 /* IQKeyboardManager+ToolbarManagerDeprecated.swift */; }; + 93086CDECC1CF6172D5307CD731DDB69 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + 96655B828BFC55F28DAC17E9E404CFEC /* IQKeyboardNotification-IQKeyboardNotification in Resources */ = {isa = PBXBuildFile; fileRef = 120BD4C670EF00F4D5A40AA4B863A7AE /* IQKeyboardNotification-IQKeyboardNotification */; }; + 96D981E5A461F6945E18ACAEDB5AD9DA /* IQKeyboardManager+Position.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BC74EE1659FD64F176CD4BE256AF84 /* IQKeyboardManager+Position.swift */; }; + 977A84A34F1D6C1A79A4C065146EBF36 /* IQTextInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81662341279CC66CC14E37D7694CCCC3 /* IQTextInputView.swift */; }; + 9973B64437A151340E5531BEE1D96EDA /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4CDA0B7868683A656CA1A57A373E2844 /* PrivacyInfo.xcprivacy */; }; + 9C41BFFC33B98E3B4C0D604606517086 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + 9C66887BAF39DDEC4615BB75A30EF766 /* IQKeyboardManagerSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E8C6E85CBE09A894E15473B2ACFF25F /* IQKeyboardManagerSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9DF3957B1206C0281930050EF1C58589 /* Pods-suixinkanTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B4673E41D5AF372B424C758462A39ADE /* Pods-suixinkanTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A199EBA4C308040DBF6D668F277AD380 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; - A601EBA1BC3752EF7B49222A1C5F0D70 /* IQTextView-IQTextView in Resources */ = {isa = PBXBuildFile; fileRef = 847044E56CBBCE1235A6F3CEF3F9F607 /* IQTextView-IQTextView */; }; + 9DF4CAF5CDCEBF860D1E04475EBB8504 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + 9E2042CD11A31A6D96D06D20B7B44AE3 /* IQTextView-IQTextView in Resources */ = {isa = PBXBuildFile; fileRef = 847044E56CBBCE1235A6F3CEF3F9F607 /* IQTextView-IQTextView */; }; + A1F33D56C9A16A4A364BBC2BC6190FC8 /* IQKeyboardToolbarManager+Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D32FAB7ECAEED292D25CAE95327CF0 /* IQKeyboardToolbarManager+Action.swift */; }; + A4F94A48BC77E0309D075DDE904D6F98 /* IQKeyboardToolbarManager+Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BDEFEECE64EE79440F94BD4C6F34682 /* IQKeyboardToolbarManager+Deprecated.swift */; }; A696BD409E03454DB248248486551336 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; - A8D34B7B91FA733D2AED15AB04B892BD /* IQKeyboardToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 346216373F9BE3698F9AEFCF076F23D2 /* IQKeyboardToolbarManager.swift */; }; - AACCF3AA32BE2187677FD50706AD7476 /* UIView+IQKeyboardExtensionDeprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED417277D89101687DEA83AAF66F65C /* UIView+IQKeyboardExtensionDeprecated.swift */; }; - AC2BDAA5ABD21D76EAAF213256C8B8E9 /* IQKeyboardReturnManager+UITextViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 484D6C3AFBCC01928BBCFE110C2A2F2C /* IQKeyboardReturnManager+UITextViewDelegate.swift */; }; - B532634861D24EDC85FABA261FDD0E35 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + A7559B934F8DCF87C3FE2BA4F5C4C95A /* Combine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */; }; + AB6CC3B98AFFD293CAE8AD23B0FC9AAE /* IQKeyboardInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8B9584100C63E03D75F12EF28FE46D8 /* IQKeyboardInfo.swift */; }; + AB800C9B59994C4897A2C4B4BB18A1A4 /* IQTextInputViewNotification-IQTextInputViewNotification in Resources */ = {isa = PBXBuildFile; fileRef = F956E149F5B195BB7833F97FC6211AE8 /* IQTextInputViewNotification-IQTextInputViewNotification */; }; + AB877946AF70E70BA6EC7FDAEB227012 /* Pods-suixinkan-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = ED291EE097723C1A6325544C2500E844 /* Pods-suixinkan-dummy.m */; }; + B1FD1C28976551248F427CC7E76FABDC /* UIView+IQKeyboardExtensionObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3AB3CAD98805C12A0303E5EEF02BA39 /* UIView+IQKeyboardExtensionObjc.swift */; }; + B66067B98F220793BA6B7E1FD8A500DD /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 2924FA1CCC272E301C4519279F9D672F /* PrivacyInfo.xcprivacy */; }; B82824181ED70910225DD0E25CDDC308 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; - B8402636FDBC65B4E50D293F80616D6B /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = A372E26A2A397D202C662C0FD912FCA2 /* PrivacyInfo.xcprivacy */; }; - BF16B86E6246A1BAC62B945FC5B91D4B /* IQKeyboardReturnManager-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 527952C17AC8880F69799F25BAE08B43 /* IQKeyboardReturnManager-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BFC5DD1D47E9627393B920979F569A69 /* IQTitleBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3583620D179FA09F78F1B6A29B53FD58 /* IQTitleBarButtonItem.swift */; }; - C5CB4120589DF8072F87D78E2BAE7BB0 /* IQKeyboardToolbar-IQKeyboardToolbar in Resources */ = {isa = PBXBuildFile; fileRef = A16FD016E18EACCF6B23F219F2E236FE /* IQKeyboardToolbar-IQKeyboardToolbar */; }; - C60607D4D2571A1535BECED712926730 /* UIView+Responders.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3AC9204F4307F3CEE2EA7B4755F2BA3 /* UIView+Responders.swift */; }; - CD02AEC4AE908A557E2DDEADFB5E75EA /* IQKeyboardToolbarManager-IQKeyboardToolbarManager in Resources */ = {isa = PBXBuildFile; fileRef = 80A40EDA3AF0499BDBCFF09467BB49AD /* IQKeyboardToolbarManager-IQKeyboardToolbarManager */; }; - D1F3500436232D12E46F637F12E3799D /* IQKeyboardToolbarManager-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D6B6259CDECD85D674B168D3AF7C0101 /* IQKeyboardToolbarManager-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B84FE0B28193A77BA1C0147CB12496DA /* IQTextInputViewNotification-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B19FAB17A68CCCA197D7890BED3BC1D2 /* IQTextInputViewNotification-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BABC1D696349718315EE287F779F7974 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; + BEF7421741D27DC0377B21A20DA375B0 /* IQKeyboardToolbarPlaceholderConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD07E0C05CA7DC462A51F4F90DD5AEE7 /* IQKeyboardToolbarPlaceholderConfiguration.swift */; }; + C8E0B1AB7F74F72DDCBB1B9854DC4621 /* IQKeyboardReturnManager+UITextFieldDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ECF9275B52B7B8B05B01B6D2E53EC02 /* IQKeyboardReturnManager+UITextFieldDelegate.swift */; }; + C8F299839031777070C30485AD203821 /* IQKeyboardToolbarManager-IQKeyboardToolbarManager in Resources */ = {isa = PBXBuildFile; fileRef = 80A40EDA3AF0499BDBCFF09467BB49AD /* IQKeyboardToolbarManager-IQKeyboardToolbarManager */; }; + CB8B874662D19B8230CFBED0583C8879 /* IQBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E924602982CB402C3DE49FAE6B4E86D7 /* IQBarButtonItem.swift */; }; + D1A61DF48588AFBD1986A22CCFDA8FE6 /* IQKeyboardToolbar-IQKeyboardToolbar in Resources */ = {isa = PBXBuildFile; fileRef = A16FD016E18EACCF6B23F219F2E236FE /* IQKeyboardToolbar-IQKeyboardToolbar */; }; D4D07C9CD27588E6B0F25C3B828E7A21 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */; }; - D7EDC1DE3A00099ECB44310E7C420B22 /* IQKeyboardNotification-IQKeyboardNotification in Resources */ = {isa = PBXBuildFile; fileRef = 120BD4C670EF00F4D5A40AA4B863A7AE /* IQKeyboardNotification-IQKeyboardNotification */; }; - D9C7F5D217BC3710874B9A0D70666A01 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; - D9FD33E409638FCAD07C69B35A06ADC2 /* IQTextView+Placeholderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 603C9655C429A8AFD3A2ABB90354F0D3 /* IQTextView+Placeholderable.swift */; }; - DB99760495689B430C2E2398C481C2FF /* IQDeepResponderContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8517105921669A50D907EA797E1636 /* IQDeepResponderContainerView.swift */; }; - DEE306224FA4E5E02C858C42EE7131D4 /* IQRootControllerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60631CBB35BA793CAA9E46A8F1CD243C /* IQRootControllerConfiguration.swift */; }; - E1E22D47863A8CB3B228B723772C8840 /* IQKeyboardResignHandler+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 930508646A6ED3948BD91D3EC83E0968 /* IQKeyboardResignHandler+Internal.swift */; }; - E20D69402A8EB87733D99631B63512F5 /* IQTextInputViewNotification-IQTextInputViewNotification in Resources */ = {isa = PBXBuildFile; fileRef = F956E149F5B195BB7833F97FC6211AE8 /* IQTextInputViewNotification-IQTextInputViewNotification */; }; - E262B2578F75C70185C656E333DF925F /* IQKeyboardInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CD275A609F620EB41456FBE469BDA8C /* IQKeyboardInfo.swift */; }; - E2A7F3B197F20459F0941DCBF911D1D9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; - E344CBDDF7D01C3ED9F53E7D99D13EF5 /* IQKeyboardManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 532F94C9C97C09FF016A3ABB96B2DB11 /* IQKeyboardManager+Internal.swift */; }; - E758379D510D62830AFF306D4630B954 /* IQKeyboardToolbarManager+Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7876059E50A29A0D55B20586DAFF3B7D /* IQKeyboardToolbarManager+Action.swift */; }; - E78FE7B64DD24FFD6E4EC26F25124278 /* UIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5F0A37891F1A7765B99C903153C0945 /* UIView+Hierarchy.swift */; }; - E8A74201D2F78C69C857A500D88D7F5D /* UIView+IQKeyboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB04A2BDB7E068229CAF7A81165DD65 /* UIView+IQKeyboardExtension.swift */; }; - EBD56E9E283017BD6BAE73D17BB996BA /* Pods-suixinkan-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = ED291EE097723C1A6325544C2500E844 /* Pods-suixinkan-dummy.m */; }; - F1159F40EEA1623CB8F2CE94CC643BB4 /* UIScrollView+IQKeyboardManagerExtensionObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7FD69C0D8168D323ADC0A6EFD7FC1DD /* UIScrollView+IQKeyboardManagerExtensionObjc.swift */; }; - F214E7966499A7E2BD10546C0D3EF62E /* IQKeyboardManagerSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 72047D59C9D0EA03C1447E76203105F5 /* IQKeyboardManagerSwift-dummy.m */; }; - F40A3F3B62CB395036B12C9291F395FD /* UIScrollView+IQKeyboardManagerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF84270BA52DE4FAC1678E99D700AA50 /* UIScrollView+IQKeyboardManagerExtension.swift */; }; - F830A4A9A9CBAA1D538F5B503D27E85E /* IQTextView-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 35890C70D80685FA114966E7CFFC00A1 /* IQTextView-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F83AB9BDBF91C11FCF608D35D84E7F78 /* IQTextInputViewNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97671A95678EAE5829CEE22F5A4ED288 /* IQTextInputViewNotification.swift */; }; - F8D4EB40DFA99B22113D750200A67F86 /* IQKeyboardAppearanceConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 095CB762599A53A99A9ACC8DBC8C0591 /* IQKeyboardAppearanceConfiguration.swift */; }; - F91DE04D9AFE6368A31CF627F06D1C05 /* IQKeyboardToolbar-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = A528053628879455AB95D1D237A78AED /* IQKeyboardToolbar-dummy.m */; }; - FE50EC3004486FFA49C30D14FBBA606E /* UIView+IQKeyboardManagerExtensionObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB5660BB9799DC420CD4238B38ED357F /* UIView+IQKeyboardManagerExtensionObjc.swift */; }; - FEA09EA9224F5FE424E0B9FA2AE5B02F /* IQKeyboardNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DED2FF966D82D4283903008C1587F98 /* IQKeyboardNotification.swift */; }; + D7D00E5346E5508D9D53EC7481B5D506 /* UIView+IQKeyboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D876671EB044681F90C28875230D85 /* UIView+IQKeyboardExtension.swift */; }; + D85E7E38F35C5D58550C5D8E44705B20 /* IQKeyboardReturnManager-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F97FC488C52F8C83E3213105C4228613 /* IQKeyboardReturnManager-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA18C09E871D9EE49EF5AAAC18B0324E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */; }; + DEE306224FA4E5E02C858C42EE7131D4 /* IQRootControllerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054D25DFF58C86E7DD00309158A9533 /* IQRootControllerConfiguration.swift */; }; + E1E22D47863A8CB3B228B723772C8840 /* IQKeyboardResignHandler+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 236F47C2E0820E91686A2967CD6F760F /* IQKeyboardResignHandler+Internal.swift */; }; + E344CBDDF7D01C3ED9F53E7D99D13EF5 /* IQKeyboardManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32A64F71DA55AE99B5E87755F8EB43D9 /* IQKeyboardManager+Internal.swift */; }; + E78FE7B64DD24FFD6E4EC26F25124278 /* UIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059A2CB5D47914844323E42412B05E5D /* UIView+Hierarchy.swift */; }; + E8CD2C2FF3756F1E72ABA275868B8AC5 /* IQBarButtonItemConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFCB3910600ECA6002BB878B30BA591 /* IQBarButtonItemConfiguration.swift */; }; + EB3D7CFBFECE122987E4BB05A670BD77 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = E3532585B460CC985A9C1C9DAF3AEB1E /* PrivacyInfo.xcprivacy */; }; + EC1FAF704B6CCC979D6B0CA2078879AE /* IQTextInputViewNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65C4C42FF3915092153F921CC192177D /* IQTextInputViewNotification.swift */; }; + EDBC65971BDA677118EA352344E2A651 /* IQKeyboardToolbarManager+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A018EB4FFC926E5323B07BD2E9A0617 /* IQKeyboardToolbarManager+Debug.swift */; }; + EE8C318C9FE25194E1CC517C668E8C26 /* IQKeyboardReturnManager-IQKeyboardReturnManager in Resources */ = {isa = PBXBuildFile; fileRef = 110BD425B6CAD6801539E2C6AB6E0662 /* IQKeyboardReturnManager-IQKeyboardReturnManager */; }; + F00FA86A7B52D89294324E2F04BAC22A /* IQKeyboardNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 209A273DFA6CB48721E810D588DFD907 /* IQKeyboardNotification.swift */; }; + F1159F40EEA1623CB8F2CE94CC643BB4 /* UIScrollView+IQKeyboardManagerExtensionObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19730C7CF0F446CA5D115BD82BD2903E /* UIScrollView+IQKeyboardManagerExtensionObjc.swift */; }; + F20AF39343CE3A9EE766946E551AF9E0 /* IQKeyboardToolbarManager-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD5CE09F44FA76C300BAFE993574AC6 /* IQKeyboardToolbarManager-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F214E7966499A7E2BD10546C0D3EF62E /* IQKeyboardManagerSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F68AAFC87ADF8F019EE78C7BC767213 /* IQKeyboardManagerSwift-dummy.m */; }; + F40A3F3B62CB395036B12C9291F395FD /* UIScrollView+IQKeyboardManagerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2C181E4F940F09E297591DA565280F7 /* UIScrollView+IQKeyboardManagerExtension.swift */; }; + F72093BE3E74BB70AAE01BAC0915A6F5 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = FD5AD0CFBB7A9E4F5B2A53DBC856B6E8 /* PrivacyInfo.xcprivacy */; }; + F8D4EB40DFA99B22113D750200A67F86 /* IQKeyboardAppearanceConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18C05366BC9A77BCD2D3B2E774D2B722 /* IQKeyboardAppearanceConfiguration.swift */; }; + FBB34EDA47D49D765C84087E6684097D /* UIView+RespondersObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642570B5038C4A4B1B4F2D100D8D750 /* UIView+RespondersObjc.swift */; }; + FE50EC3004486FFA49C30D14FBBA606E /* UIView+IQKeyboardManagerExtensionObjc.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFDC64AA2A98DF6AB638AEDFE148C722 /* UIView+IQKeyboardManagerExtensionObjc.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 08160729EBF68D12D8DEF8050CD42989 /* PBXContainerItemProxy */ = { + 01D18C0819E8839BA684925E4171A531 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 020993F16DA5986DACE118349EBCE9E5; - remoteInfo = IQKeyboardToolbarManager; + remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; + remoteInfo = IQKeyboardCore; }; - 08C0B54B9FA330846FEB6A183A5D6742 /* PBXContainerItemProxy */ = { + 0354D23C2A3B715A81EBF375A2C6111C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = F1E09035B7675D89EC69B16728E2833E; - remoteInfo = UMAPM; + remoteGlobalIDString = 40080C576D6EAF0D191988D3C110FE86; + remoteInfo = VolcEngineRTC; }; - 133C2EC85A61CDF06B89A71B3F3FB832 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5FB6AB0A09E7A2F2BE11AD6BAEFD9AED; - remoteInfo = JPush; - }; - 147ED37FE72D28DAFEC90706C048C6EA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F4FE17428FD0E607723A44F17231B7A1; - remoteInfo = IQKeyboardToolbar; - }; - 168E86429E4140AB7AE450B6F636B64E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7F18C31A804695333763EEC303E265D7; - remoteInfo = "WechatOpenSDK-XCFramework"; - }; - 198F2A9B122C5AFDA9BA2CAD713C9CDF /* PBXContainerItemProxy */ = { + 072D6CAC4C4199F09765E95E9CADD3E7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = 12890DE3ABBC2CA295E108358D85EE69; remoteInfo = IQTextView; }; - 1E28E961A0B3C66B143F0D83DEAE38D8 /* PBXContainerItemProxy */ = { + 088FCAC994901FDB36023E93E94300FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 283C1F2EA88CD4413165801A6748A48E; - remoteInfo = IQTextInputViewNotification; + remoteGlobalIDString = A26E6FD851C20D652B2755C1464A9990; + remoteInfo = IQKeyboardNotification; }; - 1F093A748267B19E1B59DF90F454A7BC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 88810798DA63A2F6611B0970EA276DEC; - remoteInfo = "IQKeyboardReturnManager-IQKeyboardReturnManager"; - }; - 2D17082BDAA079066A9B2943E85BE982 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 020993F16DA5986DACE118349EBCE9E5; - remoteInfo = IQKeyboardToolbarManager; - }; - 37EA5367B185E8D73C585D76CFA12A67 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4BD4E22D3419D68A85BDD6119CB37C6C; - remoteInfo = "AMapLocation-NO-IDFA"; - }; - 3A4000632C423DFB42EDDDE2ED54B0AE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F4FE17428FD0E607723A44F17231B7A1; - remoteInfo = IQKeyboardToolbar; - }; - 3C509F104E60FE2C27E0B3C891C979DA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = B490E7485944099E16C9CBD79119D1D4; - remoteInfo = IQKeyboardManagerSwift; - }; - 43375E8A7E5DEE972D5A3A7CC55C741F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; - remoteInfo = IQKeyboardCore; - }; - 47CF81B26EE0AE51709688B148A7662A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; - remoteInfo = "AMapFoundation-NO-IDFA"; - }; - 4907ED9E73DED3B716A419CFFDDD78CF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = CEB9AD2C3CFC208BFBE1F22F5EC3E1FC; - remoteInfo = UMDevice; - }; - 4CB9062557A28267D22F4E20A2927AD4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; - remoteInfo = IQKeyboardCore; - }; - 4F8E9DD83779B38B70DC679422847A4C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7C5613175BBC4BF67E36DB4FBEBC01D0; - remoteInfo = "IQKeyboardToolbarManager-IQKeyboardToolbarManager"; - }; - 5B8957EC1CB8F95A847120AD59DDEFAB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0981F89DB5DA3FFCFFEBDE1F56287054; - remoteInfo = IQKeyboardReturnManager; - }; - 5F9AD0BD2225542820663819BA76D223 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4502C7427440BEB17A50C0BF6E638A85; - remoteInfo = "IQTextInputViewNotification-IQTextInputViewNotification"; - }; - 62652A6D5809456307591E683A677266 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09FABB7D06BB8D3958515FB15B4E7971; - remoteInfo = UMCommon; - }; - 713D4F0ABEA99574CA78A6A200B6E9F3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; - remoteInfo = "AMapFoundation-NO-IDFA"; - }; - 718E32BB22D5761863712D50A719B13E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; - remoteInfo = IQKeyboardCore; - }; - 77340A1E87646633F9EA52E66E57B674 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D504B99928659EA67A1C3A9E981EB8FF; - remoteInfo = JCore; - }; - 8412429FAD3C39A715015569D46CB6CF /* PBXContainerItemProxy */ = { + 0C9E79873973D9E950237E695A8EE7FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = A6602BCAA6F4F932A586C41D0B7E019C; remoteInfo = "IQTextView-IQTextView"; }; - 869CC868A322E78A78D6BBABA14E7C8C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09FABB7D06BB8D3958515FB15B4E7971; - remoteInfo = UMCommon; - }; - 9A3A247AD57EFF42E6B410B78E061CF8 /* PBXContainerItemProxy */ = { + 0D8FE846DDF88044667D938580E2F373 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = F4FE17428FD0E607723A44F17231B7A1; remoteInfo = IQKeyboardToolbar; }; - 9F0C8DA2DAAB44671B01D41E79934E46 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 1DE17B7C77CD95CB67DF1197965B76AB; - remoteInfo = "Pods-suixinkan"; - }; - A2FC1D93AA2AE0116D85F839E3630642 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 283C1F2EA88CD4413165801A6748A48E; - remoteInfo = IQTextInputViewNotification; - }; - A68FC33FBFEBF6E0FC9A3004CD375308 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; - remoteInfo = "AMapFoundation-NO-IDFA"; - }; - A9B14D84173A1A00F4C4BA2CE94FCA5E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EEE261386011CDF271BE289F73FF5959; - remoteInfo = "IQKeyboardCore-IQKeyboardCore"; - }; - AD834305DA2DE95480DD793BAACDD5CB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 982A68D37F5DCBC1FC1FDC0BB2F0EB8E; - remoteInfo = "IQKeyboardManagerSwift-IQKeyboardManagerSwift"; - }; - C02B574389C3B5B10F5BF8E806AD24A3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 2B8FF445A5162845FAB9EC00FC92B694; - remoteInfo = "IQKeyboardNotification-IQKeyboardNotification"; - }; - C1A38D27A9A8F1A9E472CCC307883FD0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = A26E6FD851C20D652B2755C1464A9990; - remoteInfo = IQKeyboardNotification; - }; - C5A9E170B59A24C216A060F404429E41 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0981F89DB5DA3FFCFFEBDE1F56287054; - remoteInfo = IQKeyboardReturnManager; - }; - C6AC669F30329ABDA94DBB8071DD78C3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 12890DE3ABBC2CA295E108358D85EE69; - remoteInfo = IQTextView; - }; - CF667262D25773528EC51D3D7DA7FCB9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = B247F77A0CD5E19C8187A9BA1EB58C09; - remoteInfo = "IQKeyboardToolbar-IQKeyboardToolbar"; - }; - D07BB67961D258DFD6D4770BB99DE59A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; - remoteInfo = "AMapFoundation-NO-IDFA"; - }; - D14881F3DD881DBB4CFEFFA8095A0E8F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; - remoteInfo = IQKeyboardCore; - }; - EFBECFEAB6CF3583EF396FC63DA3AAB3 /* PBXContainerItemProxy */ = { + 104963582BC50C41EF70065E5258EB55 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = 4F1379598302C9160590B3650C10E1A5; remoteInfo = "AMapSearch-NO-IDFA"; }; - F094983E31D5376CF92A3C4ED2F97C3F /* PBXContainerItemProxy */ = { + 1129C0F5CD23D293033E4EAA5D1BD4C0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = A26E6FD851C20D652B2755C1464A9990; - remoteInfo = IQKeyboardNotification; + remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; + remoteInfo = IQKeyboardCore; }; - F608B4EA9716A1DF6EB5F14E89C57644 /* PBXContainerItemProxy */ = { + 1E572DA8CD240673FDA5DB3905A149D4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = D504B99928659EA67A1C3A9E981EB8FF; remoteInfo = JCore; }; - F9D06F8A081789EC565FDAA1773A6650 /* PBXContainerItemProxy */ = { + 2E42166B1ED5EC0E474E973A4D28B957 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 88810798DA63A2F6611B0970EA276DEC; + remoteInfo = "IQKeyboardReturnManager-IQKeyboardReturnManager"; + }; + 32A57258A4AAEEF1E6305E7B310D0005 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F4FE17428FD0E607723A44F17231B7A1; + remoteInfo = IQKeyboardToolbar; + }; + 36117BA18D436FE6D0DE6B596B931149 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = CEB9AD2C3CFC208BFBE1F22F5EC3E1FC; remoteInfo = UMDevice; }; - F9FB1958F0A6F81C94A74B5EF9C0350D /* PBXContainerItemProxy */ = { + 39DF2F1B454E7B7793443C38199EB0B7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = 283C1F2EA88CD4413165801A6748A48E; remoteInfo = IQTextInputViewNotification; }; - FA244E0E1C3D5E471F57BE915A6F2E14 /* PBXContainerItemProxy */ = { + 3F0020DA13C4BE480F10A0524490A4AB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = B490E7485944099E16C9CBD79119D1D4; + remoteInfo = IQKeyboardManagerSwift; + }; + 405A63C2CBD0544A9007623125E06AE7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EEE261386011CDF271BE289F73FF5959; + remoteInfo = "IQKeyboardCore-IQKeyboardCore"; + }; + 52E917FAA10BBBE17F522043CCD589A1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0981F89DB5DA3FFCFFEBDE1F56287054; + remoteInfo = IQKeyboardReturnManager; + }; + 67F7A60D7720446A869535A96F3545C0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; + remoteInfo = IQKeyboardCore; + }; + 6A637EE80FDCC14586BC4A2357809349 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A26E6FD851C20D652B2755C1464A9990; + remoteInfo = IQKeyboardNotification; + }; + 725E75FD278AFD2F4826D8DDEAF4AC8F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2B8FF445A5162845FAB9EC00FC92B694; + remoteInfo = "IQKeyboardNotification-IQKeyboardNotification"; + }; + 793C2D3C9FEB330D539F7F26A32E632C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F4FE17428FD0E607723A44F17231B7A1; + remoteInfo = IQKeyboardToolbar; + }; + 79E52737FC3E90BFC787B43531CB0935 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 020993F16DA5986DACE118349EBCE9E5; + remoteInfo = IQKeyboardToolbarManager; + }; + 7A77A5B3886021A7107293AFFA6952B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7F18C31A804695333763EEC303E265D7; + remoteInfo = "WechatOpenSDK-XCFramework"; + }; + 7E134C5A3ECB28A0092D93FDADCD88F6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; + remoteInfo = "AMapFoundation-NO-IDFA"; + }; + 7FC3B94B59881CDB0C5AF28A2366839D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4502C7427440BEB17A50C0BF6E638A85; + remoteInfo = "IQTextInputViewNotification-IQTextInputViewNotification"; + }; + 807C83A3A6EE16C45CED3C72029B8BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F1E09035B7675D89EC69B16728E2833E; + remoteInfo = UMAPM; + }; + 85E234DCBE75440A7CD79BF12FF11C72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = B247F77A0CD5E19C8187A9BA1EB58C09; + remoteInfo = "IQKeyboardToolbar-IQKeyboardToolbar"; + }; + 89FB9D8FBE659E0556840B05F9146FEB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; + remoteInfo = "AMapFoundation-NO-IDFA"; + }; + 94FC7A64B621994C5E02C3C7B1C50D97 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 09FABB7D06BB8D3958515FB15B4E7971; + remoteInfo = UMCommon; + }; + A5DEF6E6B93482A0654D2EBF62442688 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7C5613175BBC4BF67E36DB4FBEBC01D0; + remoteInfo = "IQKeyboardToolbarManager-IQKeyboardToolbarManager"; + }; + A76A974111C4DF28BDEE9331043B5B15 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1DE17B7C77CD95CB67DF1197965B76AB; + remoteInfo = "Pods-suixinkan"; + }; + B639DB1BCA73C9D02E5BE0CC18E69C5B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; + remoteInfo = "AMapFoundation-NO-IDFA"; + }; + BD6AFA6FE9B294C3A16AB8960B43D384 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = B44FB02BD2D3FEAD1F36808AD405A543; remoteInfo = "AMap3DMap-NO-IDFA"; }; + BDBF652935F74D29067118B5FCCE9CC5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 020993F16DA5986DACE118349EBCE9E5; + remoteInfo = IQKeyboardToolbarManager; + }; + BEE3E2E0449835ECC392F9790745E3EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = CEB9AD2C3CFC208BFBE1F22F5EC3E1FC; + remoteInfo = UMDevice; + }; + C6430EDA286E309851C27140590779BF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 982A68D37F5DCBC1FC1FDC0BB2F0EB8E; + remoteInfo = "IQKeyboardManagerSwift-IQKeyboardManagerSwift"; + }; + D3AA7945DC9B9DA743437AFFE1EA88F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BD4E22D3419D68A85BDD6119CB37C6C; + remoteInfo = "AMapLocation-NO-IDFA"; + }; + DA172C18A690AAECA4B5A3D4C12D56AA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F9A1BF709B7BA4C24A83664EB1E1C7D4; + remoteInfo = IQKeyboardCore; + }; + E072D63C2E1B1FE4AD77BB97B7B340C2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5FB6AB0A09E7A2F2BE11AD6BAEFD9AED; + remoteInfo = JPush; + }; + E3D22E58F959CB9DF7B79C4E5D8175A2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D504B99928659EA67A1C3A9E981EB8FF; + remoteInfo = JCore; + }; + E8EB0BAF47F22FD1C2A551B4318E2AE4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 09FABB7D06BB8D3958515FB15B4E7971; + remoteInfo = UMCommon; + }; + ED17866C6B82B5FD1FFDB8382E1E23FF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 12890DE3ABBC2CA295E108358D85EE69; + remoteInfo = IQTextView; + }; + EE0C384FA001B636E43753E78E9CD110 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 283C1F2EA88CD4413165801A6748A48E; + remoteInfo = IQTextInputViewNotification; + }; + EE602595474CE7E67736CFB324228CB5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9B182CB4E1716E9070813D3C59736001; + remoteInfo = "AMapFoundation-NO-IDFA"; + }; + F595694C90F4FF142AD0682F79BC0066 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0981F89DB5DA3FFCFFEBDE1F56287054; + remoteInfo = IQKeyboardReturnManager; + }; + F7356744E89632201B581A2D5BCAF069 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 283C1F2EA88CD4413165801A6748A48E; + remoteInfo = IQTextInputViewNotification; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0141CCE940C38D3566A83D1108E6A304 /* IQKeyboardReturnManager+UITextFieldDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardReturnManager+UITextFieldDelegate.swift"; path = "IQKeyboardReturnManager/Classes/Delegates/IQKeyboardReturnManager+UITextFieldDelegate.swift"; sourceTree = ""; }; - 01ACB31CCA98A0BA58C407BB759CBD44 /* MAOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOverlay.h; path = MAMapKit.framework/Headers/MAOverlay.h; sourceTree = ""; }; - 02DA1675D3DF93B18F8927862A7FDA75 /* MAHeatMapVectorOverlayRender.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorOverlayRender.h; path = MAMapKit.framework/Headers/MAHeatMapVectorOverlayRender.h; sourceTree = ""; }; + 0016DB9B9376D3CEDD92C0E35129967E /* MAOfflineItemMunicipality.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItemMunicipality.h; path = MAMapKit.framework/Headers/MAOfflineItemMunicipality.h; sourceTree = ""; }; + 006784975D34D4F2841543B05EC4A195 /* UMAPM.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMAPM.release.xcconfig; sourceTree = ""; }; + 00D14718B29FD331A2247C81252659BE /* MAMapVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapVersion.h; path = MAMapKit.framework/Headers/MAMapVersion.h; sourceTree = ""; }; + 025FF22A5001E60904C397A76E0C09B4 /* IQKeyboardAppearanceManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardAppearanceManager.swift; path = IQKeyboardManagerSwift/Appearance/IQKeyboardAppearanceManager.swift; sourceTree = ""; }; 030EAF35766AF14A0C9409424A6C2B82 /* Combine.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Combine.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Combine.framework; sourceTree = DEVELOPER_DIR; }; - 06A9F6948FD1CA41F3ACF9F3966A3888 /* IQKeyboardManager+ToolbarManagerDeprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+ToolbarManagerDeprecated.swift"; path = "IQKeyboardManagerSwift/IQKeyboardToolbarManager/IQKeyboardManager+ToolbarManagerDeprecated.swift"; sourceTree = ""; }; + 059A2CB5D47914844323E42412B05E5D /* UIView+Hierarchy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Hierarchy.swift"; path = "IQKeyboardCore/Classes/UIKitExtensions/UIView+Hierarchy.swift"; sourceTree = ""; }; + 05D5CE10D09B57E622283C0E3F584D8B /* AMapLocationCommonObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationCommonObj.h; path = AMapLocationKit.framework/Headers/AMapLocationCommonObj.h; sourceTree = ""; }; 06E5B413FEA5A600D76636DA132F8FB9 /* IQTextInputViewNotification */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQTextInputViewNotification; path = IQTextInputViewNotification.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 0765EFE771A4A4A2F0F58A914B4E21C2 /* MAMapView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapView.h; path = MAMapKit.framework/Headers/MAMapView.h; sourceTree = ""; }; - 07D967A1100CF811A66390D51EB5A6E2 /* MAOfflineCity.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineCity.h; path = MAMapKit.framework/Headers/MAOfflineCity.h; sourceTree = ""; }; - 095CB762599A53A99A9ACC8DBC8C0591 /* IQKeyboardAppearanceConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardAppearanceConfiguration.swift; path = IQKeyboardManagerSwift/Appearance/IQKeyboardAppearanceConfiguration.swift; sourceTree = ""; }; - 097E3C45E430629A425D0B19A2A6E19C /* IQTextView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextView.swift; path = IQTextView/Classes/IQTextView.swift; sourceTree = ""; }; - 0A3628E425118DE571E2E1BE39F07123 /* MAPolyline.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolyline.h; path = MAMapKit.framework/Headers/MAPolyline.h; sourceTree = ""; }; - 0AA33750C13A35FA4DFFEA7D3E1D6F71 /* IQKeyboardToolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbar.swift; path = IQKeyboardToolbar/Classes/IQKeyboardToolbar.swift; sourceTree = ""; }; + 08B0092D87E9E61E28986DB591565BCF /* IQTextInputViewNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQTextInputViewNotification-Info.plist"; sourceTree = ""; }; + 0911AE053F5B9AE721FE34FCF6FF62F3 /* MAIndoorInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAIndoorInfo.h; path = MAMapKit.framework/Headers/MAIndoorInfo.h; sourceTree = ""; }; + 0A018EB4FFC926E5323B07BD2E9A0617 /* IQKeyboardToolbarManager+Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Debug.swift"; path = "IQKeyboardToolbarManager/Classes/Debug/IQKeyboardToolbarManager+Debug.swift"; sourceTree = ""; }; + 0AF4E684DF6CEBFE9C445B44A8ECFFF0 /* AMap3DMap-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMap3DMap-NO-IDFA.release.xcconfig"; sourceTree = ""; }; 0AFBD211AC6EFEB81A9519313236FABF /* Pods-suixinkanTests.simulatordebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-suixinkanTests.simulatordebug.xcconfig"; sourceTree = ""; }; - 0B4EA2289D2B8316CE956FF2268D0114 /* IQKeyboardToolbarConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarConfiguration.swift; path = IQKeyboardToolbarManager/Classes/Configuration/IQKeyboardToolbarConfiguration.swift; sourceTree = ""; }; - 0DE500824E8236FB34E7FC4EDF80F03E /* ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist"; sourceTree = ""; }; + 0BDEFEECE64EE79440F94BD4C6F34682 /* IQKeyboardToolbarManager+Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Deprecated.swift"; path = "IQKeyboardToolbarManager/Classes/IQKeyboardToolbarManager+Deprecated.swift"; sourceTree = ""; }; + 0C5373D6FEC052390EF0155BC139DA74 /* UMCommon.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMCommon.debug.xcconfig; sourceTree = ""; }; + 0CF2374471C2CEEC69E3FE0C9071A9D1 /* AMapNearbyUploadInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapNearbyUploadInfo.h; path = AMapSearchKit.framework/Headers/AMapNearbyUploadInfo.h; sourceTree = ""; }; + 0D48DDB2B1DA7335575EE4951A7C50B5 /* WechatOpenSDK-XCFramework-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "WechatOpenSDK-XCFramework-xcframeworks.sh"; sourceTree = ""; }; + 0D5ABBC99F3391C6F9A634D663E75422 /* IQTextView-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextView-umbrella.h"; sourceTree = ""; }; 0DFD4541FF9DAA31A2FC2A7F6D03ED22 /* IQTextView */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQTextView; path = IQTextView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 0E3C72D0274B9F16DFC383EFE92E0ADD /* Pods-suixinkan-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-suixinkan-acknowledgements.markdown"; sourceTree = ""; }; - 0EFFE26759757EA17C439FCF5BC7A432 /* ResourceBundle-IQTextView-IQTextView-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQTextView-IQTextView-Info.plist"; sourceTree = ""; }; - 0FDC889F8FBF31BC6E149B59F01A74FC /* IQKeyboardToolbarManager+Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Debug.swift"; path = "IQKeyboardToolbarManager/Classes/Debug/IQKeyboardToolbarManager+Debug.swift"; sourceTree = ""; }; - 10A7112588A375D793E11F0EB0414C81 /* AMapNearbySearchManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapNearbySearchManager.h; path = AMapSearchKit.framework/Headers/AMapNearbySearchManager.h; sourceTree = ""; }; - 10CADA6646C9AF13C983D13EAF7F5378 /* IQKeyboardToolbarManager.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbarManager.release.xcconfig; sourceTree = ""; }; + 0E768B108DBA5CC9149342EFAC582F86 /* MAMVTTileOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMVTTileOverlay.h; path = MAMapKit.framework/Headers/MAMVTTileOverlay.h; sourceTree = ""; }; + 0EBDD9D77C00C1B6B42EF06289ED81E6 /* MAMVTTileOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMVTTileOverlayRenderer.h; path = MAMapKit.framework/Headers/MAMVTTileOverlayRenderer.h; sourceTree = ""; }; + 0F117F7702A857584C6E59BA2AEDDB42 /* MATerrainOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATerrainOverlay.h; path = MAMapKit.framework/Headers/MATerrainOverlay.h; sourceTree = ""; }; + 10A4A0EAA84E9607D6E867137638C0B7 /* IQKeyboardManager+Resign_Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Resign_Deprecated.swift"; path = "IQKeyboardManagerSwift/Resign/IQKeyboardManager+Resign_Deprecated.swift"; sourceTree = ""; }; + 10C3C8E54ECDED1E0C05111FCCEBE7BD /* IQScrollViewConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQScrollViewConfiguration.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/Configuration/IQScrollViewConfiguration.swift; sourceTree = ""; }; + 10CB1E0D11EC51CC988C1E27607C73A7 /* IQKeyboardAppearanceManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardAppearanceManager+Internal.swift"; path = "IQKeyboardManagerSwift/Appearance/IQKeyboardAppearanceManager+Internal.swift"; sourceTree = ""; }; + 10F845770A3EF5F5562CC88EA7BE4644 /* IQTextInputViewNotification.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextInputViewNotification.release.xcconfig; sourceTree = ""; }; 110BD425B6CAD6801539E2C6AB6E0662 /* IQKeyboardReturnManager-IQKeyboardReturnManager */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQKeyboardReturnManager-IQKeyboardReturnManager"; path = IQKeyboardReturnManager.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 117548D53BE326B446EDB8C9CB64B68E /* MAParticleOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAParticleOverlayRenderer.h; path = MAMapKit.framework/Headers/MAParticleOverlayRenderer.h; sourceTree = ""; }; - 11B38E077C1F133396EB0CF305E0EF6B /* IQKeyboardToolbar.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbar.debug.xcconfig; sourceTree = ""; }; 120BD4C670EF00F4D5A40AA4B863A7AE /* IQKeyboardNotification-IQKeyboardNotification */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQKeyboardNotification-IQKeyboardNotification"; path = IQKeyboardNotification.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 1290A656163D4189D4E745D4075B5FB9 /* IQTextInputViewNotification.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQTextInputViewNotification.modulemap; sourceTree = ""; }; + 140C24CF94B74B365353785AAD7781FE /* MAMapKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapKit.h; path = MAMapKit.framework/Headers/MAMapKit.h; sourceTree = ""; }; + 1432B7B9FB7E007C7E5FD5F9AB24198B /* IQKeyboardConstants.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardConstants.swift; path = IQKeyboardCore/Classes/Constants/IQKeyboardConstants.swift; sourceTree = ""; }; + 14791DBACC3C3EBD8BF5D28B23927645 /* IQInvocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQInvocation.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQInvocation.swift; sourceTree = ""; }; 15848DEC7727A809830E7F6FC1B6CE0F /* IQKeyboardReturnManager */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardReturnManager; path = IQKeyboardReturnManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 17275D4CF9F4D11ECE700DA0F9EFF0F8 /* AMapFoundationConst.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapFoundationConst.h; path = AMapFoundationKit.framework/Headers/AMapFoundationConst.h; sourceTree = ""; }; + 1677B1509CB109DB8CF29FB1D829AB16 /* AMapSearchObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchObj.h; path = AMapSearchKit.framework/Headers/AMapSearchObj.h; sourceTree = ""; }; + 18C05366BC9A77BCD2D3B2E774D2B722 /* IQKeyboardAppearanceConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardAppearanceConfiguration.swift; path = IQKeyboardManagerSwift/Appearance/IQKeyboardAppearanceConfiguration.swift; sourceTree = ""; }; + 196A9E4648F826867018FBE76BE4A27B /* MAPoiFilter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPoiFilter.h; path = MAMapKit.framework/Headers/MAPoiFilter.h; sourceTree = ""; }; + 19730C7CF0F446CA5D115BD82BD2903E /* UIScrollView+IQKeyboardManagerExtensionObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIScrollView+IQKeyboardManagerExtensionObjc.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIScrollView+IQKeyboardManagerExtensionObjc.swift"; sourceTree = ""; }; + 1A3D978D914830388E3B2A7C1EC1B497 /* IQKeyboardToolbarManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardToolbarManager-Info.plist"; sourceTree = ""; }; + 1AC5BFA4C48724D90AA9C4DAB900E68B /* AMapCommonObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapCommonObj.h; path = AMapSearchKit.framework/Headers/AMapCommonObj.h; sourceTree = ""; }; + 1B199C4901242D30CD71A18A8E1D0008 /* AMapSearchKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AMapSearchKit.framework; sourceTree = ""; }; 1B7465A72120AF417FD5F1F34AD33AD4 /* Pods-suixinkanTests */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-suixinkanTests"; path = Pods_suixinkanTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1C5A9BF8CC34F207CD736C514BE4E7A9 /* IQKeyboardToolbar-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbar-prefix.pch"; sourceTree = ""; }; - 1CCD1345A443E0DA94158F36DD898B5D /* MAMapCustomStyleOptions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapCustomStyleOptions.h; path = MAMapKit.framework/Headers/MAMapCustomStyleOptions.h; sourceTree = ""; }; - 1D1E7E265254C8003D8A5F7C75B7B539 /* AMapFoundation-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapFoundation-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; - 1E836A6EBA8DFB16F89B80B9E240181F /* MAAnnotationView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnnotationView.h; path = MAMapKit.framework/Headers/MAAnnotationView.h; sourceTree = ""; }; - 1EE9BE36A9708049EB256766BA9BA1C7 /* MAHeatMapVectorGridOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorGridOverlayRenderer.h; path = MAMapKit.framework/Headers/MAHeatMapVectorGridOverlayRenderer.h; sourceTree = ""; }; - 1FADC993D884553299A227B2F37F270B /* IQKeyboardToolbarManager.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbarManager.debug.xcconfig; sourceTree = ""; }; - 1FB7DE577ECCA1457268EA70E8DB4DAC /* JPush.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JPush.release.xcconfig; sourceTree = ""; }; - 205EB9340BF8698369EA925117E55975 /* MAOfflineItemCommonCity.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItemCommonCity.h; path = MAMapKit.framework/Headers/MAOfflineItemCommonCity.h; sourceTree = ""; }; - 2161AA772A6755F4D5D60BD723919D3B /* IQTextInputViewNotification.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextInputViewNotification.release.xcconfig; sourceTree = ""; }; - 21DDA7D033A7C2EC6807E087D05B8114 /* MARouteOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MARouteOverlay.h; path = MAMapKit.framework/Headers/MARouteOverlay.h; sourceTree = ""; }; - 22A1064CD5D18DA7AED4D67EE50B28CF /* MAOfflineItemMunicipality.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItemMunicipality.h; path = MAMapKit.framework/Headers/MAOfflineItemMunicipality.h; sourceTree = ""; }; - 22FEBEF7276FDE9FC7112A3B40888E0D /* MAArcRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAArcRenderer.h; path = MAMapKit.framework/Headers/MAArcRenderer.h; sourceTree = ""; }; - 23AC67D8FE201A5D8B41262606782630 /* IQKeyboardToolbarManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardToolbarManager-Info.plist"; sourceTree = ""; }; - 244D954871A873D3E39E3064D852B516 /* UITableView+IndexPaths.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITableView+IndexPaths.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UITableView+IndexPaths.swift"; sourceTree = ""; }; - 24AB5750A05B063EA0DA3264D3001A19 /* IQKeyboardCore-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardCore-dummy.m"; sourceTree = ""; }; + 1E3A1BD1F31324B93B3AD539F716E8F8 /* IQTextInputViewInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputViewInfo.swift; path = IQTextInputViewNotification/Classes/IQTextInputViewInfo.swift; sourceTree = ""; }; + 1E8C6E85CBE09A894E15473B2ACFF25F /* IQKeyboardManagerSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardManagerSwift-umbrella.h"; sourceTree = ""; }; + 209A273DFA6CB48721E810D588DFD907 /* IQKeyboardNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardNotification.swift; path = IQKeyboardNotification/Classes/IQKeyboardNotification.swift; sourceTree = ""; }; + 20C3CD12D4046B6427964786B1D7F200 /* AMapLocation-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapLocation-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; + 22536953ABA1BC0ED1B53F47CB71E415 /* AMapURLSearch.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapURLSearch.h; path = AMapFoundationKit.framework/Headers/AMapURLSearch.h; sourceTree = ""; }; + 22707E06938D36978342F7E04FBA3E33 /* MAMultiPointOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPointOverlay.h; path = MAMapKit.framework/Headers/MAMultiPointOverlay.h; sourceTree = ""; }; + 227609D6C20B15E2AF59CD06C201BD05 /* JPush-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "JPush-xcframeworks.sh"; sourceTree = ""; }; + 22DE40CC56B3E094BCE71F0843177D6C /* UITableView+IndexPaths.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITableView+IndexPaths.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UITableView+IndexPaths.swift"; sourceTree = ""; }; + 233D93E73EE1D7FDB94D7B4E60B2F3E8 /* MAGroundOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGroundOverlayRenderer.h; path = MAMapKit.framework/Headers/MAGroundOverlayRenderer.h; sourceTree = ""; }; + 236F47C2E0820E91686A2967CD6F760F /* IQKeyboardResignHandler+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardResignHandler+Internal.swift"; path = "IQKeyboardManagerSwift/Resign/IQKeyboardResignHandler+Internal.swift"; sourceTree = ""; }; + 2432EF98C1780CB63645C2E5DFBC4FE9 /* IQTextView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextView.swift; path = IQTextView/Classes/IQTextView.swift; sourceTree = ""; }; + 24B3915A78364E56EEE3E8AF146F6C8D /* MAUserLocation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAUserLocation.h; path = MAMapKit.framework/Headers/MAUserLocation.h; sourceTree = ""; }; + 24DA51F3F8BD4C7A91DADAC0C0F62284 /* MAMapAccessibilityIdentifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapAccessibilityIdentifier.h; path = MAMapKit.framework/Headers/MAMapAccessibilityIdentifier.h; sourceTree = ""; }; + 257BCE628592783EF9A5E519CCA2AC16 /* UIView+Responders.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Responders.swift"; path = "IQKeyboardToolbarManager/Classes/UIKitExtensions/UIView+Responders.swift"; sourceTree = ""; }; 259BA0551F8F105F54FDB30A416B26CF /* Pods-suixinkanTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-suixinkanTests-acknowledgements.plist"; sourceTree = ""; }; - 25A6DA65604634AA8B5F0DDCEEA348ED /* IQKeyboardReturnManager.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardReturnManager.modulemap; sourceTree = ""; }; - 2A2F83D6955E3DA7E55E81A83CDD1633 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardCore/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 2C0D83D64DA05F98461682B1107B1B4E /* MAPolylineRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolylineRenderer.h; path = MAMapKit.framework/Headers/MAPolylineRenderer.h; sourceTree = ""; }; - 2C2A760C8FC191090821FFA8F92D1BA6 /* IQKeyboardManagerSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardManagerSwift.modulemap; sourceTree = ""; }; - 2C9513A9951DA3DCAB3F59B6DF22F7DE /* MATileOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATileOverlayRenderer.h; path = MAMapKit.framework/Headers/MATileOverlayRenderer.h; sourceTree = ""; }; - 2CEB1C0CC7AB3CE014A9DE0963476264 /* AMapSearchObjV1.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchObjV1.h; path = AMapSearchKit.framework/Headers/AMapSearchObjV1.h; sourceTree = ""; }; - 2E92D7304A8A78DAEF9943AB04A94116 /* MATerrainOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATerrainOverlay.h; path = MAMapKit.framework/Headers/MATerrainOverlay.h; sourceTree = ""; }; - 2EA10FEDDCB666E266D7A6F366B18E70 /* IQTextInputViewNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQTextInputViewNotification-Info.plist"; sourceTree = ""; }; - 30B02A6B0D6954EF43EFA3789887E608 /* AMapSearch-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapSearch-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; - 31D405B850F4246DA579A22B97251360 /* IQKeyboardToolbarManager+Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Deprecated.swift"; path = "IQKeyboardToolbarManager/Classes/IQKeyboardToolbarManager+Deprecated.swift"; sourceTree = ""; }; - 33005A729F5C775737278F40CCD77F9B /* AMapGeoFenceRegionObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapGeoFenceRegionObj.h; path = AMapLocationKit.framework/Headers/AMapGeoFenceRegionObj.h; sourceTree = ""; }; + 260D101C410C813A89F178DA344A0C68 /* WechatOpenSDK.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = WechatOpenSDK.xcframework; sourceTree = ""; }; + 265515AE6516C3B325D5961DCA814A4A /* IQPlaceholderable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQPlaceholderable.swift; path = IQKeyboardToolbar/Placeholderable/IQPlaceholderable.swift; sourceTree = ""; }; + 2924FA1CCC272E301C4519279F9D672F /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQTextView/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 29CA1DFA0D80C1F474279442203CFED1 /* IQKeyboardCore-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardCore-Info.plist"; sourceTree = ""; }; + 2A0D3A9B9B1F461CCBB987BF6A148FF6 /* MATileOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATileOverlayRenderer.h; path = MAMapKit.framework/Headers/MATileOverlayRenderer.h; sourceTree = ""; }; + 2A1AAD1937CC0190BBCE194ABF7D67AF /* MAShape.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAShape.h; path = MAMapKit.framework/Headers/MAShape.h; sourceTree = ""; }; + 2AC0DACFAE7037AC2FF368ED2AA7CAF4 /* IQTextInputViewNotification.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQTextInputViewNotification.modulemap; sourceTree = ""; }; + 2D2C9E82DF51CA26E12725621714E090 /* IQKeyboardNotification.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardNotification.debug.xcconfig; sourceTree = ""; }; + 2EC7A621AB8CB362644A06190DB1224A /* MABaseEngineOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MABaseEngineOverlay.h; path = MAMapKit.framework/Headers/MABaseEngineOverlay.h; sourceTree = ""; }; + 301B8B14D78023F3DD043BCBFC93130A /* UIView+IQKeyboardManagerExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardManagerExtension.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIView+IQKeyboardManagerExtension.swift"; sourceTree = ""; }; + 302E2D627665AA33DFD324A6B9C22B43 /* IQTextInputViewNotification-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQTextInputViewNotification-dummy.m"; sourceTree = ""; }; + 30B0F6201C301BB01F37EE64F61B9983 /* MAPolygon.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolygon.h; path = MAMapKit.framework/Headers/MAPolygon.h; sourceTree = ""; }; + 316ECFAE87C43CE3088F25F6FC8EF85F /* AMapSearchKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchKit.h; path = AMapSearchKit.framework/Headers/AMapSearchKit.h; sourceTree = ""; }; + 327DFA2871C3DF1F35DF6522BE6D856C /* MAOverlayPathRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOverlayPathRenderer.h; path = MAMapKit.framework/Headers/MAOverlayPathRenderer.h; sourceTree = ""; }; + 32933D0AEA1AF3988E2782401F17B221 /* IQKeyboardReturnManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardReturnManager.swift; path = IQKeyboardReturnManager/Classes/IQKeyboardReturnManager.swift; sourceTree = ""; }; + 32A64F71DA55AE99B5E87755F8EB43D9 /* IQKeyboardManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Internal.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Internal.swift"; sourceTree = ""; }; 3371B87E601C64001CB6429D6D94E799 /* Pods-suixinkanTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-suixinkanTests.debug.xcconfig"; sourceTree = ""; }; - 3412D26E7AC83AF43C7017AB142B719D /* UIView+RespondersObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+RespondersObjc.swift"; path = "IQKeyboardToolbarManager/Classes/UIKitExtensions/UIView+RespondersObjc.swift"; sourceTree = ""; }; - 346216373F9BE3698F9AEFCF076F23D2 /* IQKeyboardToolbarManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarManager.swift; path = IQKeyboardToolbarManager/Classes/IQKeyboardToolbarManager.swift; sourceTree = ""; }; - 34893074C574951651CAE0489239E848 /* IQInvocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQInvocation.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQInvocation.swift; sourceTree = ""; }; - 357507030049F8711B5F2560C8BE96B0 /* AMapFoundation-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapFoundation-NO-IDFA.release.xcconfig"; sourceTree = ""; }; - 3583620D179FA09F78F1B6A29B53FD58 /* IQTitleBarButtonItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTitleBarButtonItem.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQTitleBarButtonItem.swift; sourceTree = ""; }; - 35890C70D80685FA114966E7CFFC00A1 /* IQTextView-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextView-umbrella.h"; sourceTree = ""; }; - 36978964993FE13960686DDDD546D75B /* UMDevice-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "UMDevice-xcframeworks.sh"; sourceTree = ""; }; - 36FF598C0D9764E4AE87E840237BA75B /* AMapURLSearchType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapURLSearchType.h; path = AMapFoundationKit.framework/Headers/AMapURLSearchType.h; sourceTree = ""; }; - 3702B2DB8DB9F3674E7A72C7A38ED093 /* UMAPM.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; name = UMAPM.xcframework; path = UMAPM_2.0.7/UMAPM.xcframework; sourceTree = ""; }; - 3AAAF0891AEED7CA4AF20AE95070E340 /* AMapSearch-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapSearch-NO-IDFA.release.xcconfig"; sourceTree = ""; }; - 3BAA32FB751F6BB0FD65930595456ACA /* IQTextView.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextView.release.xcconfig; sourceTree = ""; }; - 3C48262702361091FBD5781B0F283DFE /* MAAnnotationMoveAnimation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnnotationMoveAnimation.h; path = MAMapKit.framework/Headers/MAAnnotationMoveAnimation.h; sourceTree = ""; }; - 3E834D9058B55541C3FD1368754163BD /* MABaseOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MABaseOverlay.h; path = MAMapKit.framework/Headers/MABaseOverlay.h; sourceTree = ""; }; - 3E8FC0168ED476CD46810E7F95C0D5DD /* IQTextView.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQTextView.modulemap; sourceTree = ""; }; - 3F2BA6FF47C66D4951D519C0085C948B /* AMapLocation-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapLocation-NO-IDFA.release.xcconfig"; sourceTree = ""; }; - 3F8A7B40939E68E709158AA51CF7B536 /* UMCommon.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMCommon.release.xcconfig; sourceTree = ""; }; - 401C0B5E9F8F1552898BFACFDEB8C41D /* IQKeyboardNotification.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardNotification.release.xcconfig; sourceTree = ""; }; - 407749166D56AC58042E7F89FDD486AD /* IQKeyboardManager+Appearance.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Appearance.swift"; path = "IQKeyboardManagerSwift/Appearance/IQKeyboardManager+Appearance.swift"; sourceTree = ""; }; - 4250F6D1B4A49520719CF69AA9DB7171 /* IQTextView-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextView-prefix.pch"; sourceTree = ""; }; - 4294DBAFDD1C869AB58195872ECBD63C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQTextView/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 45B6A705BCE14AB0BB965DAE2E740B34 /* MAMapStatus.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapStatus.h; path = MAMapKit.framework/Headers/MAMapStatus.h; sourceTree = ""; }; - 47A354AE76F39CD50DF8DE8D5F744498 /* IQKeyboardManagerSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardManagerSwift.debug.xcconfig; sourceTree = ""; }; - 484D6C3AFBCC01928BBCFE110C2A2F2C /* IQKeyboardReturnManager+UITextViewDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardReturnManager+UITextViewDelegate.swift"; path = "IQKeyboardReturnManager/Classes/Delegates/IQKeyboardReturnManager+UITextViewDelegate.swift"; sourceTree = ""; }; - 4AF4AEB75D89FF3F06FDE6A004EA9A23 /* UIViewController+ParentContainer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIViewController+ParentContainer.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UIViewController+ParentContainer.swift"; sourceTree = ""; }; - 4BA1B67A9D955479AE8767AECFC1C544 /* WechatOpenSDK.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = WechatOpenSDK.xcframework; sourceTree = ""; }; - 4BEEC8D5C43F1F1BA28301F6F1167C87 /* IQKeyboardToolbarPlaceholderConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarPlaceholderConfiguration.swift; path = IQKeyboardToolbar/Classes/Placeholder/IQKeyboardToolbarPlaceholderConfiguration.swift; sourceTree = ""; }; - 4C0003B8890568226024C1462834BA44 /* UIView+Resign.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Resign.swift"; path = "IQKeyboardManagerSwift/Resign/UIKItExtensions/UIView+Resign.swift"; sourceTree = ""; }; - 4D43C0E4C0ABC428E9D5A5AE717B658E /* IQKeyboardManagerSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardManagerSwift-umbrella.h"; sourceTree = ""; }; - 4E1C0398739C8BEB724C448EE1DB0F6E /* UIView+ResignObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+ResignObjc.swift"; path = "IQKeyboardManagerSwift/Resign/UIKItExtensions/UIView+ResignObjc.swift"; sourceTree = ""; }; - 4F613BCF49ACE20A304727CA4EDA7E47 /* UICollectionView+IndexPaths.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UICollectionView+IndexPaths.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UICollectionView+IndexPaths.swift"; sourceTree = ""; }; - 4FEC114D3F1C5AE65CD441BD62650BB8 /* MATraceManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATraceManager.h; path = MAMapKit.framework/Headers/MATraceManager.h; sourceTree = ""; }; - 505941D186BD82B6E02B787E89B1C356 /* IQKeyboardCore-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardCore-Info.plist"; sourceTree = ""; }; - 50E0F97385361B4BF66AEF8C2A910F32 /* AMapCommonObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapCommonObj.h; path = AMapSearchKit.framework/Headers/AMapCommonObj.h; sourceTree = ""; }; - 50EEC35FAFA65B05F310CBA561C28927 /* AMapFoundationKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AMapFoundationKit.framework; sourceTree = ""; }; - 50F5A25E8047CF0286E9929854002827 /* MATileOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATileOverlay.h; path = MAMapKit.framework/Headers/MATileOverlay.h; sourceTree = ""; }; - 51E60014F4AFF046CCAEFB326E631B53 /* IQKeyboardManagerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardManagerSwift-Info.plist"; sourceTree = ""; }; - 527952C17AC8880F69799F25BAE08B43 /* IQKeyboardReturnManager-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardReturnManager-umbrella.h"; sourceTree = ""; }; + 3588749BFDB1A89C82B482E9E8C96622 /* MAParticleOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAParticleOverlayRenderer.h; path = MAMapKit.framework/Headers/MAParticleOverlayRenderer.h; sourceTree = ""; }; + 3642570B5038C4A4B1B4F2D100D8D750 /* UIView+RespondersObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+RespondersObjc.swift"; path = "IQKeyboardToolbarManager/Classes/UIKitExtensions/UIView+RespondersObjc.swift"; sourceTree = ""; }; + 3743F40B27DFFA0C0530479FFB587691 /* IQKeyboardReturnManager.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardReturnManager.release.xcconfig; sourceTree = ""; }; + 37ED2C21C1E1ACCC106AA7C2D98CD280 /* IQKeyboardToolbar.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbar.release.xcconfig; sourceTree = ""; }; + 38EBFCECEDF6B0177C19F36F20D9615F /* MAPolylineRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolylineRenderer.h; path = MAMapKit.framework/Headers/MAPolylineRenderer.h; sourceTree = ""; }; + 391A9DEE79A34E4C8E57A0B9707F02BA /* jcore-noidfa-ios-5.4.2.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = "jcore-noidfa-ios-5.4.2.xcframework"; sourceTree = ""; }; + 3AF86EA711AAF037D15AB7371496C2A1 /* IQKeyboardToolbar-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbar-prefix.pch"; sourceTree = ""; }; + 3CB214999237C638FFC3DB3AE121DAD5 /* IQKeyboardManager+Appearance.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Appearance.swift"; path = "IQKeyboardManagerSwift/Appearance/IQKeyboardManager+Appearance.swift"; sourceTree = ""; }; + 3DDF6B961018C08613D8A0D837046BF1 /* AMapLocationKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationKit.h; path = AMapLocationKit.framework/Headers/AMapLocationKit.h; sourceTree = ""; }; + 3EE1C67A22E73C71C54EF9A0E5E98061 /* MACustomBuildingOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACustomBuildingOverlay.h; path = MAMapKit.framework/Headers/MACustomBuildingOverlay.h; sourceTree = ""; }; + 3F4B4471F801A901C847415B11010539 /* AMapUtility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapUtility.h; path = AMapFoundationKit.framework/Headers/AMapUtility.h; sourceTree = ""; }; + 3F86ED90539606ECEE24AB70887270E4 /* IQKeyboardCore.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardCore.modulemap; sourceTree = ""; }; + 3FBF7D60272DE7F04F608847182770D1 /* MAMapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MAMapKit.framework; sourceTree = ""; }; + 40CABFE86EA5475F61478E0125A87C7B /* MAHeatMapVectorOverlayRender.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorOverlayRender.h; path = MAMapKit.framework/Headers/MAHeatMapVectorOverlayRender.h; sourceTree = ""; }; + 40D0A74BB726A2A8248C9847466D9CC1 /* Array+Sort.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Array+Sort.swift"; path = "IQKeyboardToolbarManager/Classes/UIKitExtensions/Array+Sort.swift"; sourceTree = ""; }; + 434E0C6C570DC80ADDE76B4EA8DDFB61 /* ResourceBundle-IQTextView-IQTextView-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQTextView-IQTextView-Info.plist"; sourceTree = ""; }; + 43E338487B2FD0168DB6C36843190F0E /* MAAnnotationMoveAnimation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnnotationMoveAnimation.h; path = MAMapKit.framework/Headers/MAAnnotationMoveAnimation.h; sourceTree = ""; }; + 46743810A3D4B51DE28F0DE3BB6D5497 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardToolbar/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 470A92D6F1D61939BF38409D63A4DD65 /* AMapLocationKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AMapLocationKit.framework; sourceTree = ""; }; + 47B29EC516D4DA9C641873A4E761DC16 /* MAHeatMapVectorGridOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorGridOverlayRenderer.h; path = MAMapKit.framework/Headers/MAHeatMapVectorGridOverlayRenderer.h; sourceTree = ""; }; + 48303C21DF2C6D474BE4A0AADEE9E16C /* AMapSearch-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapSearch-NO-IDFA.release.xcconfig"; sourceTree = ""; }; + 4BD5CE09F44FA76C300BAFE993574AC6 /* IQKeyboardToolbarManager-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbarManager-umbrella.h"; sourceTree = ""; }; + 4C97F1279DE48FCF5536191CB5FDC744 /* IQKeyboardManager+Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Debug.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/Debug/IQKeyboardManager+Debug.swift"; sourceTree = ""; }; + 4CA5E02432572BEC3D63E70BDFA76230 /* VolcEngineRTC.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = VolcEngineRTC.xcframework; sourceTree = ""; }; + 4CBFDC425AA2C8AD908DA6ABC7D368DD /* IQDeepResponderContainerView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQDeepResponderContainerView.swift; path = IQKeyboardToolbarManager/Classes/IQDeepResponderContainerView.swift; sourceTree = ""; }; + 4CDA0B7868683A656CA1A57A373E2844 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardToolbarManager/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 4E1E716A01DDF5D7844AD4F6DD359924 /* UMAPM.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMAPM.debug.xcconfig; sourceTree = ""; }; + 51367A9A6774AE911676FEE589F4D4E9 /* AMap3DMap-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMap3DMap-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; 52F75B5EC268243B9BFE349B05E52A20 /* Pods-suixinkan-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-suixinkan-umbrella.h"; sourceTree = ""; }; - 532F94C9C97C09FF016A3ABB96B2DB11 /* IQKeyboardManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Internal.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Internal.swift"; sourceTree = ""; }; - 533B31BFC1F29651016A4CED40C41C45 /* IQKeyboardReturnManager.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardReturnManager.debug.xcconfig; sourceTree = ""; }; - 53B577B7CE9C0F08BED5686A89801EE4 /* IQKeyboardCore-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardCore-prefix.pch"; sourceTree = ""; }; - 54062D69C3F5F955058687496BC9B5C1 /* MAMapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MAMapKit.framework; sourceTree = ""; }; - 5411F5B198CFD957C9CD536AB2D54AA5 /* MAPinAnnotationView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPinAnnotationView.h; path = MAMapKit.framework/Headers/MAPinAnnotationView.h; sourceTree = ""; }; - 569001181B8BE3D065C344C62500F175 /* MAHeatMapVectorOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorOverlay.h; path = MAMapKit.framework/Headers/MAHeatMapVectorOverlay.h; sourceTree = ""; }; - 56E9537047D72ABA1C9695C95A4AF843 /* UMAPM.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMAPM.debug.xcconfig; sourceTree = ""; }; - 582CAD303F8413036F3444028D850F4B /* MAPoiFilter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPoiFilter.h; path = MAMapKit.framework/Headers/MAPoiFilter.h; sourceTree = ""; }; - 58653AFE6B358C639F97F8975BAB3FC7 /* MAMapVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapVersion.h; path = MAMapKit.framework/Headers/MAMapVersion.h; sourceTree = ""; }; - 59FC7750B336D68DAD91386AFEBB3AEF /* MAIndoorInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAIndoorInfo.h; path = MAMapKit.framework/Headers/MAIndoorInfo.h; sourceTree = ""; }; + 5596FE4C18E829ADBEECC5ACDF02EB31 /* MATraceLocation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATraceLocation.h; path = MAMapKit.framework/Headers/MATraceLocation.h; sourceTree = ""; }; + 562049081AA7BA85836F65F0154A41E8 /* MAMultiTexturePolylineRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiTexturePolylineRenderer.h; path = MAMapKit.framework/Headers/MAMultiTexturePolylineRenderer.h; sourceTree = ""; }; + 5629E0F117BEA473144E2420C84A1A0D /* AMapFoundationKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AMapFoundationKit.framework; sourceTree = ""; }; + 57412EC3570F1A67F503074046DFE7F5 /* MAMapStatus.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapStatus.h; path = MAMapKit.framework/Headers/MAMapStatus.h; sourceTree = ""; }; + 5881F9C9310C4D9AFCE6C492C453F4E7 /* MABaseOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MABaseOverlay.h; path = MAMapKit.framework/Headers/MABaseOverlay.h; sourceTree = ""; }; + 5882792FE746E1E359A5AD3DB4483351 /* MAPolyline.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolyline.h; path = MAMapKit.framework/Headers/MAPolyline.h; sourceTree = ""; }; + 58DC8D42E44C8F1B5737553B617A916E /* IQKeyboardReturnManager-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardReturnManager-prefix.pch"; sourceTree = ""; }; + 5A1D98DED6CFD3022E8FC075FA491615 /* IQKeyboardNotification-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardNotification-dummy.m"; sourceTree = ""; }; + 5AF4FC451B12D40C36F4824295CF94E1 /* AMapURLSearchConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapURLSearchConfig.h; path = AMapFoundationKit.framework/Headers/AMapURLSearchConfig.h; sourceTree = ""; }; + 5B91072D08BB3F63162262295825C5FF /* IQKeyboardToolbarManager.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbarManager.release.xcconfig; sourceTree = ""; }; 5BD109278933E8C2F269E5DCEC3A5376 /* Pods-suixinkan */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-suixinkan"; path = Pods_suixinkan.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 5EAF6B62A82569F4767893AB4F1DEEF4 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardManagerSwift/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 5F800AC82DC0EBE287853A0A0FB4F5DF /* AMapSearchAPI.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchAPI.h; path = AMapSearchKit.framework/Headers/AMapSearchAPI.h; sourceTree = ""; }; - 603C9655C429A8AFD3A2ABB90354F0D3 /* IQTextView+Placeholderable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQTextView+Placeholderable.swift"; path = "IQTextView/Classes/IQTextView+Placeholderable.swift"; sourceTree = ""; }; - 60631CBB35BA793CAA9E46A8F1CD243C /* IQRootControllerConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQRootControllerConfiguration.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/Configuration/IQRootControllerConfiguration.swift; sourceTree = ""; }; - 606C5CFB2DD86DA601C36633BB6E9227 /* MAGeometry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGeometry.h; path = MAMapKit.framework/Headers/MAGeometry.h; sourceTree = ""; }; - 607850C8AE036A90433104E7F0697F47 /* MATerrainOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATerrainOverlayRenderer.h; path = MAMapKit.framework/Headers/MATerrainOverlayRenderer.h; sourceTree = ""; }; - 61334938998DD56FB7176AA67E7796CE /* MACustomBuildingOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACustomBuildingOverlay.h; path = MAMapKit.framework/Headers/MACustomBuildingOverlay.h; sourceTree = ""; }; - 629DD1DA2A6BB7211D4AA2CDC4ADE1BE /* IQKeyboardReturnManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardReturnManager.swift; path = IQKeyboardReturnManager/Classes/IQKeyboardReturnManager.swift; sourceTree = ""; }; - 6388414814252F565A677CD3D17EC014 /* UIView+IQKeyboardManagerExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardManagerExtension.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIView+IQKeyboardManagerExtension.swift"; sourceTree = ""; }; + 5D0EF49E78A574D04EBCC72388BC9337 /* IQKeyboardManagerSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardManagerSwift-prefix.pch"; sourceTree = ""; }; + 5DA99C08528E3C22E42D003865FEC09D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardManagerSwift/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 5DB63DD174AA36A665DF6EFDF91B9E37 /* IQKeyboardToolbarConstants.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarConstants.swift; path = IQKeyboardToolbarManager/Classes/Constants/IQKeyboardToolbarConstants.swift; sourceTree = ""; }; + 5DD839E94220ED93D5D56D7325ACB4AF /* IQActiveConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQActiveConfiguration.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/Configuration/IQActiveConfiguration.swift; sourceTree = ""; }; + 608C4908E4BB55A6CB186C5C994459F5 /* AMapGeoFenceRegionObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapGeoFenceRegionObj.h; path = AMapLocationKit.framework/Headers/AMapGeoFenceRegionObj.h; sourceTree = ""; }; + 61E7B525F895021509512D66E237C998 /* MATouchPoi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATouchPoi.h; path = MAMapKit.framework/Headers/MATouchPoi.h; sourceTree = ""; }; + 6243BFD239C17E85134CCB10FE9FAAC0 /* MARouteOverlayModel.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MARouteOverlayModel.h; path = MAMapKit.framework/Headers/MARouteOverlayModel.h; sourceTree = ""; }; + 6359B1281832A0C2267C0D4A90CE1416 /* IQKeyboardNotification-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardNotification-prefix.pch"; sourceTree = ""; }; + 643D01EDC860F2BAF98169C2F246AC5C /* MAOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOverlayRenderer.h; path = MAMapKit.framework/Headers/MAOverlayRenderer.h; sourceTree = ""; }; 6464447070DB8A1E9C56338928A9DC0F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 647AECC2271497CFBB36311165FC0BF0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - 649233ED6CEAD11508C3FEC87609ADF7 /* AMap3DMap-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMap3DMap-NO-IDFA.release.xcconfig"; sourceTree = ""; }; - 65E1594E46F076BA8A8528BF7CD2E5DB /* IQKeyboardCore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardCore.debug.xcconfig; sourceTree = ""; }; - 6753350B51E82A0FE23F430A0B57E601 /* IQKeyboardToolbarManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Internal.swift"; path = "IQKeyboardToolbarManager/Classes/IQKeyboardToolbarManager+Internal.swift"; sourceTree = ""; }; - 6759C2C05A896EEF5A902F54ED815458 /* IQKeyboardManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardManager.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager.swift; sourceTree = ""; }; + 655D6F4504BA9F7B8E38F5DF66CEDA16 /* UMDevice-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "UMDevice-xcframeworks.sh"; sourceTree = ""; }; + 659D0CF1C22A308AA4BBC12C690EFF76 /* MACircleRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACircleRenderer.h; path = MAMapKit.framework/Headers/MACircleRenderer.h; sourceTree = ""; }; + 65C4C42FF3915092153F921CC192177D /* IQTextInputViewNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputViewNotification.swift; path = IQTextInputViewNotification/Classes/IQTextInputViewNotification.swift; sourceTree = ""; }; + 6638AB504D084AEDF76BD13D6B411686 /* IQKeyboardManager+ActiveConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+ActiveConfiguration.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+ActiveConfiguration.swift"; sourceTree = ""; }; + 66BB860BB0ACF1B74DF2E0C0EC1BFF82 /* ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist"; sourceTree = ""; }; + 672521CE7AABAB88CAC5DA46DE3917EE /* UIView+ResignObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+ResignObjc.swift"; path = "IQKeyboardManagerSwift/Resign/UIKItExtensions/UIView+ResignObjc.swift"; sourceTree = ""; }; + 679D26F54B1AA81CAB8B96B96A4E1340 /* IQKeyboardToolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbar.swift; path = IQKeyboardToolbar/Classes/IQKeyboardToolbar.swift; sourceTree = ""; }; 67DC68595F07F473A69296FC2DD4E016 /* Pods-suixinkan.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-suixinkan.debug.xcconfig"; sourceTree = ""; }; - 68C6374ADCD5FD0BC332791ABBCF4F8C /* AMapUtility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapUtility.h; path = AMapFoundationKit.framework/Headers/AMapUtility.h; sourceTree = ""; }; - 69121CFF53D9CEC42CE44CF34F36F7B5 /* IQKeyboardNotification.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardNotification.modulemap; sourceTree = ""; }; + 684810A159CC0F5F54EC89B87AC327C8 /* MAMapSnapshot.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapSnapshot.h; path = MAMapKit.framework/Headers/MAMapSnapshot.h; sourceTree = ""; }; + 6899E9B61D97F7A88D1AE73011313A21 /* MAGeodesicPolyline.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGeodesicPolyline.h; path = MAMapKit.framework/Headers/MAGeodesicPolyline.h; sourceTree = ""; }; + 69234E4D1FF97AA77BC3546B03B96407 /* IQKeyboardManager+Resign.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Resign.swift"; path = "IQKeyboardManagerSwift/Resign/IQKeyboardManager+Resign.swift"; sourceTree = ""; }; + 69373ECBF83F317CAA7C02D3B536BA78 /* IQTextInputViewNotification.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextInputViewNotification.debug.xcconfig; sourceTree = ""; }; 696323FAE4B9FD026A77BAC09D3D5241 /* Pods-suixinkanTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-suixinkanTests.modulemap"; sourceTree = ""; }; - 6AE1DF2DC452D2788B6E2B8392A48BF1 /* JCore-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "JCore-xcframeworks.sh"; sourceTree = ""; }; - 6AE8EF33DA600DB0EFAC9BBD00770D02 /* ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; sourceTree = ""; }; - 6AEC002400E17D448789C96C9A991A76 /* IQKeyboardToolbarConstants.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarConstants.swift; path = IQKeyboardToolbarManager/Classes/Constants/IQKeyboardToolbarConstants.swift; sourceTree = ""; }; - 6CD275A609F620EB41456FBE469BDA8C /* IQKeyboardInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardInfo.swift; path = IQKeyboardNotification/Classes/IQKeyboardInfo.swift; sourceTree = ""; }; - 6D59C7309AD33EDAE93D4959CC364A32 /* IQKeyboardToolbarManager.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardToolbarManager.modulemap; sourceTree = ""; }; - 6E0BA3B04A92A056CAB8754E064C13C3 /* AMap.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "wrapper.plug-in"; name = AMap.bundle; path = MAMapKit.framework/AMap.bundle; sourceTree = ""; }; - 6E17159F496580E082DD42D59F547B39 /* MAPathShowRange.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPathShowRange.h; path = MAMapKit.framework/Headers/MAPathShowRange.h; sourceTree = ""; }; + 69916FBCA731F366F9F2550E789E9D24 /* MATileOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATileOverlay.h; path = MAMapKit.framework/Headers/MATileOverlay.h; sourceTree = ""; }; + 6B07A961A98509C930FDC98A9FA8544E /* AMapLocationRegionObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationRegionObj.h; path = AMapLocationKit.framework/Headers/AMapLocationRegionObj.h; sourceTree = ""; }; + 6B197BD93E8C7BDB71A2A0DDB792C0AE /* MAOfflineMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineMap.h; path = MAMapKit.framework/Headers/MAOfflineMap.h; sourceTree = ""; }; + 6B2DC97D0BB8EBFBE037BB8888E5152A /* UICollectionView+IndexPaths.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UICollectionView+IndexPaths.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UICollectionView+IndexPaths.swift"; sourceTree = ""; }; + 6B653B098FA73A44AE03CCB910AE8FBA /* MAPointAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPointAnnotation.h; path = MAMapKit.framework/Headers/MAPointAnnotation.h; sourceTree = ""; }; + 6BB647CC374FB13666973FCF51E8A4AC /* IQKeyboardToolbarManager-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardToolbarManager-dummy.m"; sourceTree = ""; }; + 6E3056FA5A7491EB6B9168F4DCB89CF8 /* MARouteOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MARouteOverlay.h; path = MAMapKit.framework/Headers/MARouteOverlay.h; sourceTree = ""; }; 6E897F35E5E27028AC58B14B552FBC8D /* IQKeyboardCore-IQKeyboardCore */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQKeyboardCore-IQKeyboardCore"; path = IQKeyboardCore.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 6E9F7234A3BF2BFA0BC19D0319D62938 /* WechatOpenSDK-XCFramework-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "WechatOpenSDK-XCFramework-xcframeworks.sh"; sourceTree = ""; }; - 6EFF2F85A43C79FF157025B650597669 /* AMapSearchObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchObj.h; path = AMapSearchKit.framework/Headers/AMapSearchObj.h; sourceTree = ""; }; - 70AF23D692EBDAA8E2E52376A065A97C /* AMapServices.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapServices.h; path = AMapFoundationKit.framework/Headers/AMapServices.h; sourceTree = ""; }; - 70E7C93840EABBEDEEF083F6B142029D /* UIView+Parent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Parent.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UIView+Parent.swift"; sourceTree = ""; }; - 713CC318C38869C97FB47759DA618B4B /* MAOfflineMapViewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineMapViewController.h; path = MAMapKit.framework/Headers/MAOfflineMapViewController.h; sourceTree = ""; }; - 72047D59C9D0EA03C1447E76203105F5 /* IQKeyboardManagerSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardManagerSwift-dummy.m"; sourceTree = ""; }; - 736B201311554090BB7665BFF33F0B0D /* IQKeyboardManager+Position.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Position.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Position.swift"; sourceTree = ""; }; - 73B4C7AD499AF7BCC14C3DC4248A326F /* IQKeyboardToolbarManager+Toolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Toolbar.swift"; path = "IQKeyboardToolbarManager/Classes/Toolbar/IQKeyboardToolbarManager+Toolbar.swift"; sourceTree = ""; }; - 73F4A4C2EB0A4E49EC7BFE3DACD2CCD5 /* IQKeyboardAppearanceManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardAppearanceManager.swift; path = IQKeyboardManagerSwift/Appearance/IQKeyboardAppearanceManager.swift; sourceTree = ""; }; + 6ECF9275B52B7B8B05B01B6D2E53EC02 /* IQKeyboardReturnManager+UITextFieldDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardReturnManager+UITextFieldDelegate.swift"; path = "IQKeyboardReturnManager/Classes/Delegates/IQKeyboardReturnManager+UITextFieldDelegate.swift"; sourceTree = ""; }; + 6FA0B342A73D28669E2FA554F3636EDD /* IQKeyboardResignHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardResignHandler.swift; path = IQKeyboardManagerSwift/Resign/IQKeyboardResignHandler.swift; sourceTree = ""; }; + 6FC842F5579AC5F9E36B02804980FBA5 /* AMapFoundationVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapFoundationVersion.h; path = AMapFoundationKit.framework/Headers/AMapFoundationVersion.h; sourceTree = ""; }; + 7035E4745377EBEB3C787811A19BCC0E /* AMapNearbySearchManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapNearbySearchManager.h; path = AMapSearchKit.framework/Headers/AMapNearbySearchManager.h; sourceTree = ""; }; + 7055CF7462CB8E3DDB9CB84914F0D047 /* MACustomCalloutView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACustomCalloutView.h; path = MAMapKit.framework/Headers/MACustomCalloutView.h; sourceTree = ""; }; + 7067197E3E18A6472D83E1BF20A2DF39 /* MACircle.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACircle.h; path = MAMapKit.framework/Headers/MACircle.h; sourceTree = ""; }; + 707DA09A7E71877897FA79B5D0851453 /* MAMapView+Resource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "MAMapView+Resource.h"; path = "MAMapKit.framework/Headers/MAMapView+Resource.h"; sourceTree = ""; }; + 7148DF765E0E3BDB3E1DA0BD4CDF9FAE /* IQKeyboardToolbarManager.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardToolbarManager.modulemap; sourceTree = ""; }; + 721D4CFBC2A333A24E9AFFB201CFE629 /* MAOfflineItemCommonCity.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItemCommonCity.h; path = MAMapKit.framework/Headers/MAOfflineItemCommonCity.h; sourceTree = ""; }; + 72F8FB18750917203BE32320D47C16AB /* MALineDrawType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MALineDrawType.h; path = MAMapKit.framework/Headers/MALineDrawType.h; sourceTree = ""; }; + 73BC53E8C93DDB8078EB3832DF5645C3 /* IQKeyboardManager+ToolbarManagerDeprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+ToolbarManagerDeprecated.swift"; path = "IQKeyboardManagerSwift/IQKeyboardToolbarManager/IQKeyboardManager+ToolbarManagerDeprecated.swift"; sourceTree = ""; }; + 74C0A97F8A621324A3DABEF21272551D /* MACustomBuildingOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACustomBuildingOverlayRenderer.h; path = MAMapKit.framework/Headers/MACustomBuildingOverlayRenderer.h; sourceTree = ""; }; 775B1614748F1EDCA3D01AFDD894BCC0 /* Pods-suixinkanTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-suixinkanTests-acknowledgements.markdown"; sourceTree = ""; }; - 778FA22D4BEBBF59A58346CBF997FEA5 /* IQKeyboardManager+Resign_Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Resign_Deprecated.swift"; path = "IQKeyboardManagerSwift/Resign/IQKeyboardManager+Resign_Deprecated.swift"; sourceTree = ""; }; - 77A5D875250BB2847A6580EEC009BA4F /* AMapLocationKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AMapLocationKit.framework; sourceTree = ""; }; - 7824F2A9F1A4882E8AC01FC525F509DA /* IQTextInputViewNotification-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQTextInputViewNotification-dummy.m"; sourceTree = ""; }; - 7876059E50A29A0D55B20586DAFF3B7D /* IQKeyboardToolbarManager+Action.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Action.swift"; path = "IQKeyboardToolbarManager/Classes/Toolbar/IQKeyboardToolbarManager+Action.swift"; sourceTree = ""; }; - 7AF35518DCE4701B077F7D5E23122BAD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardToolbar/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 7BE8D3F5CFB6098660E108950BB18879 /* AMapNearbyUploadInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapNearbyUploadInfo.h; path = AMapSearchKit.framework/Headers/AMapNearbyUploadInfo.h; sourceTree = ""; }; - 7D9F044857F251A31321EF21554EB709 /* MAOfflineItem.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItem.h; path = MAMapKit.framework/Headers/MAOfflineItem.h; sourceTree = ""; }; - 7DFF1E9E404B66479E1C8127D024F8A5 /* MAPolygon.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolygon.h; path = MAMapKit.framework/Headers/MAPolygon.h; sourceTree = ""; }; - 7E0A31927D7E41BFDD984506DC0F5E99 /* IQTextInputView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputView.swift; path = IQKeyboardCore/Classes/IQTextInputView.swift; sourceTree = ""; }; - 7E69BA4197634200C8605805B0C5F57A /* MABaseEngineOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MABaseEngineOverlay.h; path = MAMapKit.framework/Headers/MABaseEngineOverlay.h; sourceTree = ""; }; - 7ED417277D89101687DEA83AAF66F65C /* UIView+IQKeyboardExtensionDeprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardExtensionDeprecated.swift"; path = "IQKeyboardToolbar/Classes/IQKeyboardExtension/UIView+IQKeyboardExtensionDeprecated.swift"; sourceTree = ""; }; - 7F8DC7287225EB89CFFDCA5DD231B629 /* IQKeyboardNotification-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardNotification-dummy.m"; sourceTree = ""; }; - 809AD13D76C4DBC1165D5E2F33B4A13A /* MAMultiPoint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPoint.h; path = MAMapKit.framework/Headers/MAMultiPoint.h; sourceTree = ""; }; + 78E5C4BC9F421F0030A47836705FE8C7 /* MAAnnotationView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnnotationView.h; path = MAMapKit.framework/Headers/MAAnnotationView.h; sourceTree = ""; }; + 798B5EDBEA0B0097A890F0F469E84E2E /* JCore-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "JCore-xcframeworks.sh"; sourceTree = ""; }; + 7B4F4930A148CCA0AFF2A6240DF36B28 /* IQTextView-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextView-prefix.pch"; sourceTree = ""; }; + 7CE0E04517BD2363A893C1E85B4B248F /* IQKeyboardCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardCore.release.xcconfig; sourceTree = ""; }; + 7E638915ECBDA2C39BDCFBACBDC0E28C /* MAHeatMapVectorGridOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorGridOverlay.h; path = MAMapKit.framework/Headers/MAHeatMapVectorGridOverlay.h; sourceTree = ""; }; + 7E9328F77C695432E06E224ECFC6F118 /* IQKeyboardManager+Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Deprecated.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/Deprecated/IQKeyboardManager+Deprecated.swift"; sourceTree = ""; }; + 7F2AB1871CDCA81B98E67F2845433559 /* IQKeyboardReturnManager-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardReturnManager-dummy.m"; sourceTree = ""; }; + 7F68AAFC87ADF8F019EE78C7BC767213 /* IQKeyboardManagerSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardManagerSwift-dummy.m"; sourceTree = ""; }; + 7F9148481791CA6ACA5381910B5FD141 /* MAPinAnnotationView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPinAnnotationView.h; path = MAMapKit.framework/Headers/MAPinAnnotationView.h; sourceTree = ""; }; + 7F9BF1DD8D3901D2CB56396040F28392 /* IQTextView-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQTextView-dummy.m"; sourceTree = ""; }; + 7FC0495E836EAA9DCCF5B24BA4F96574 /* JCore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JCore.debug.xcconfig; sourceTree = ""; }; + 8075CD247EEBD97388B72593387ED07E /* AMapURLSearchType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapURLSearchType.h; path = AMapFoundationKit.framework/Headers/AMapURLSearchType.h; sourceTree = ""; }; 80A40EDA3AF0499BDBCFF09467BB49AD /* IQKeyboardToolbarManager-IQKeyboardToolbarManager */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQKeyboardToolbarManager-IQKeyboardToolbarManager"; path = IQKeyboardToolbarManager.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 80B97563DD9EE42FB83F21CD7ECA8893 /* MAMapView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapView.h; path = MAMapKit.framework/Headers/MAMapView.h; sourceTree = ""; }; + 81662341279CC66CC14E37D7694CCCC3 /* IQTextInputView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputView.swift; path = IQKeyboardCore/Classes/IQTextInputView.swift; sourceTree = ""; }; + 83448C8FCF4765056F1A35E450B655E6 /* UMCommon.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMCommon.release.xcconfig; sourceTree = ""; }; + 836E8DA0AB39B894F56601BB518502FC /* AMapServices.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapServices.h; path = AMapFoundationKit.framework/Headers/AMapServices.h; sourceTree = ""; }; + 84308DE86AAB2CCBAA19904F494B555E /* IQTextView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextView.debug.xcconfig; sourceTree = ""; }; 847044E56CBBCE1235A6F3CEF3F9F607 /* IQTextView-IQTextView */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQTextView-IQTextView"; path = IQTextView.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 85547E7B6FFBB52AB98F82AEB49717FA /* JPush-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "JPush-xcframeworks.sh"; sourceTree = ""; }; - 86051726F35A59F1AD195C5B74BCB853 /* MAShape.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAShape.h; path = MAMapKit.framework/Headers/MAShape.h; sourceTree = ""; }; - 8608C61CF8BA1D5CA044FF84821D9635 /* MACircleRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACircleRenderer.h; path = MAMapKit.framework/Headers/MACircleRenderer.h; sourceTree = ""; }; - 87CC2842EDD9352F470FE692A9B91AA5 /* UIView+ParentObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+ParentObjc.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UIView+ParentObjc.swift"; sourceTree = ""; }; - 8A4955BD2D6B837C1AFE332DC02F229B /* MAGroundOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGroundOverlayRenderer.h; path = MAMapKit.framework/Headers/MAGroundOverlayRenderer.h; sourceTree = ""; }; - 8B634D0C8582340A26DF881074996135 /* IQKeyboardCore-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardCore-umbrella.h"; sourceTree = ""; }; - 8B684CF1599F22DF5238BEF46E8CD746 /* IQKeyboardManager+Resign.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Resign.swift"; path = "IQKeyboardManagerSwift/Resign/IQKeyboardManager+Resign.swift"; sourceTree = ""; }; - 8BE9B5D6111FAF1BBAD248C3AFE07C26 /* MACircle.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACircle.h; path = MAMapKit.framework/Headers/MACircle.h; sourceTree = ""; }; - 8C3C1260F5F1828322AF349A37E45410 /* MAGeodesicPolyline.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGeodesicPolyline.h; path = MAMapKit.framework/Headers/MAGeodesicPolyline.h; sourceTree = ""; }; - 8CC78E637C86F7BC30C4C3A669049F79 /* AMapLocationManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationManager.h; path = AMapLocationKit.framework/Headers/AMapLocationManager.h; sourceTree = ""; }; - 8D6DCAE6D0330A20D29082667233E33C /* WechatOpenSDK-XCFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "WechatOpenSDK-XCFramework.release.xcconfig"; sourceTree = ""; }; + 869DEE3EDA8F46435177FF98ED73A2B3 /* IQTextView-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQTextView-Info.plist"; sourceTree = ""; }; + 86B6AC948C427FB67A9A40BF124DA621 /* MAArcRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAArcRenderer.h; path = MAMapKit.framework/Headers/MAArcRenderer.h; sourceTree = ""; }; + 871C4D1834D14518E50DD97F10BCD43C /* IQKeyboardReturnManager.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardReturnManager.modulemap; sourceTree = ""; }; + 8B6BEA1893E1C03156815824B5025A47 /* IQKeyboardManagerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardManagerSwift-Info.plist"; sourceTree = ""; }; + 8CE213F570E6C96F86CBD8CBE081B8C9 /* AMapGeoFenceError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapGeoFenceError.h; path = AMapLocationKit.framework/Headers/AMapGeoFenceError.h; sourceTree = ""; }; + 8D7C63D6DD7621AF727A8980247D8D0B /* UMAPM-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "UMAPM-xcframeworks.sh"; sourceTree = ""; }; 8D8069D3964814114ACEC3084C010B59 /* IQKeyboardManagerSwift-IQKeyboardManagerSwift */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQKeyboardManagerSwift-IQKeyboardManagerSwift"; path = IQKeyboardManagerSwift.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 8E593660B088EDD170E5B1B7CBEA3509 /* IQTextInputViewInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputViewInfo.swift; path = IQTextInputViewNotification/Classes/IQTextInputViewInfo.swift; sourceTree = ""; }; - 8EEE1F5B32FF5F35E4F7CC0F55C1B41F /* AMapFoundationKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapFoundationKit.h; path = AMapFoundationKit.framework/Headers/AMapFoundationKit.h; sourceTree = ""; }; - 930508646A6ED3948BD91D3EC83E0968 /* IQKeyboardResignHandler+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardResignHandler+Internal.swift"; path = "IQKeyboardManagerSwift/Resign/IQKeyboardResignHandler+Internal.swift"; sourceTree = ""; }; - 930E9B1B194A403F3F0A4F95FAF2427A /* AMapLocation-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapLocation-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; - 94A40C00F73E0E81F1EC934D99316B7C /* MAMultiColoredPolylineRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiColoredPolylineRenderer.h; path = MAMapKit.framework/Headers/MAMultiColoredPolylineRenderer.h; sourceTree = ""; }; - 9517DFB02CF19FA4C175500597CC473D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardReturnManager/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 95A231D1CAE57B03E3B3AAE66310ABC0 /* AMapGeoFenceManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapGeoFenceManager.h; path = AMapLocationKit.framework/Headers/AMapGeoFenceManager.h; sourceTree = ""; }; - 96A7CDFC8C50B2921E48D845688BD449 /* MAGroundOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGroundOverlay.h; path = MAMapKit.framework/Headers/MAGroundOverlay.h; sourceTree = ""; }; - 97671A95678EAE5829CEE22F5A4ED288 /* IQTextInputViewNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputViewNotification.swift; path = IQTextInputViewNotification/Classes/IQTextInputViewNotification.swift; sourceTree = ""; }; - 98A819F75A0DF55BD766887A9A43232E /* AMapLocationKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationKit.h; path = AMapLocationKit.framework/Headers/AMapLocationKit.h; sourceTree = ""; }; - 992554533A232CEC66E7397532159E20 /* IQKeyboardManager+ToolbarManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+ToolbarManager.swift"; path = "IQKeyboardManagerSwift/IQKeyboardToolbarManager/IQKeyboardManager+ToolbarManager.swift"; sourceTree = ""; }; - 9A9A9140CB6ADD033768BB60CEA72E7A /* IQKeyboardNotification-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardNotification-umbrella.h"; sourceTree = ""; }; - 9AE61E9DC82B9FDCC6C66EA02C64CED7 /* IQKeyboardReturnManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardReturnManager-Info.plist"; sourceTree = ""; }; + 8F30991F76663516B678C382E5C3778C /* UIView+IQKeyboardExtensionDeprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardExtensionDeprecated.swift"; path = "IQKeyboardToolbar/Classes/IQKeyboardExtension/UIView+IQKeyboardExtensionDeprecated.swift"; sourceTree = ""; }; + 90CEB809A08ADDFF65DE3E2CE6210120 /* MAOfflineItem.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItem.h; path = MAMapKit.framework/Headers/MAOfflineItem.h; sourceTree = ""; }; + 91EDAEAA8F13DC15EFC4DADC6261AD21 /* AMapSearchObjV1.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchObjV1.h; path = AMapSearchKit.framework/Headers/AMapSearchObjV1.h; sourceTree = ""; }; + 92531E37878C3A0E7B0535022EED3DFD /* MAMultiPolyline.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPolyline.h; path = MAMapKit.framework/Headers/MAMultiPolyline.h; sourceTree = ""; }; + 932F8EAA35C1D5F87D138C4006A1815F /* MAUserLocationRepresentation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAUserLocationRepresentation.h; path = MAMapKit.framework/Headers/MAUserLocationRepresentation.h; sourceTree = ""; }; + 939F8DEAB2123EC89A5DD098E96E191A /* IQTitleBarButtonItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTitleBarButtonItem.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQTitleBarButtonItem.swift; sourceTree = ""; }; + 948A9344898DCC2785FDDAD0699D6C1E /* IQKeyboardNotification.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardNotification.release.xcconfig; sourceTree = ""; }; + 949006AE50DFEC2AAC1413FF868AA779 /* IQTextInputViewNotification-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextInputViewNotification-prefix.pch"; sourceTree = ""; }; + 95839D8D8B2F23293EBF04B5730EA40E /* IQKeyboardManagerSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardManagerSwift.modulemap; sourceTree = ""; }; + 9614779050BB3EBD1097F039DEADD27B /* MATraceManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATraceManager.h; path = MAMapKit.framework/Headers/MATraceManager.h; sourceTree = ""; }; + 985288E47AE20118163007C6AFBB4174 /* AMapGeoFenceManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapGeoFenceManager.h; path = AMapLocationKit.framework/Headers/AMapGeoFenceManager.h; sourceTree = ""; }; + 989E962A812F16459AFDEE6C7D323409 /* MAMultiColoredPolylineRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiColoredPolylineRenderer.h; path = MAMapKit.framework/Headers/MAMultiColoredPolylineRenderer.h; sourceTree = ""; }; + 9931FEC2838C55EB9415330553D7C98B /* IQKeyboardManagerSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardManagerSwift.debug.xcconfig; sourceTree = ""; }; + 9960FCCCFFE8F876FCDE0065C4FD6629 /* IQKeyboardToolbar-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardToolbar-dummy.m"; sourceTree = ""; }; + 99E675068425C5A9A5145CD79E3BCA08 /* AMapFoundation-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapFoundation-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; + 9B64B38CCC51FEC6E0F64ABFCE0D6BFF /* AMapFoundation-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapFoundation-NO-IDFA.release.xcconfig"; sourceTree = ""; }; + 9BDAC44E74D5AEA1FE9EF5B66759D030 /* UMDevice.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; name = UMDevice.xcframework; path = UMDevice_3.6.0/UMDevice.xcframework; sourceTree = ""; }; 9C16EBBD1A736D37F674242425B27F20 /* Pods-suixinkan.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-suixinkan.release.xcconfig"; sourceTree = ""; }; - 9CEDABC4D125BC75920E31F38A35A415 /* MAPolygonRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolygonRenderer.h; path = MAMapKit.framework/Headers/MAPolygonRenderer.h; sourceTree = ""; }; 9D83BB7679E7C8273476FE786BABAFF5 /* Pods-suixinkan-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-suixinkan-frameworks.sh"; sourceTree = ""; }; - 9D8517105921669A50D907EA797E1636 /* IQDeepResponderContainerView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQDeepResponderContainerView.swift; path = IQKeyboardToolbarManager/Classes/IQDeepResponderContainerView.swift; sourceTree = ""; }; 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 9DED2FF966D82D4283903008C1587F98 /* IQKeyboardNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardNotification.swift; path = IQKeyboardNotification/Classes/IQKeyboardNotification.swift; sourceTree = ""; }; - 9E358C28D730461F823AA142E176EB0C /* MARouteOverlayModel.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MARouteOverlayModel.h; path = MAMapKit.framework/Headers/MARouteOverlayModel.h; sourceTree = ""; }; - 9EE58245D58F26549A7A8CCB434AC52E /* IQScrollViewConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQScrollViewConfiguration.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/Configuration/IQScrollViewConfiguration.swift; sourceTree = ""; }; - 9F44C0F5A31C9EFE79B6821581FC6A90 /* JCore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JCore.debug.xcconfig; sourceTree = ""; }; - 9FC5970D36251A1390A17CF7571EF768 /* IQTextView-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQTextView-dummy.m"; sourceTree = ""; }; - A12612B1AED7EE8CCD44571B43987BBB /* IQKeyboardResignHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardResignHandler.swift; path = IQKeyboardManagerSwift/Resign/IQKeyboardResignHandler.swift; sourceTree = ""; }; - A1654FBEF2ACF2D1C0F1AE8EFAB0EF17 /* ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; sourceTree = ""; }; + 9DE3CDAB45445DD7086D7CDC6F864A8D /* MAOfflineItemNationWide.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItemNationWide.h; path = MAMapKit.framework/Headers/MAOfflineItemNationWide.h; sourceTree = ""; }; + 9F8AD8BB0EBEEF249761A914B37CAD8C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardReturnManager/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 9F977EDAA0F36643B21D81D866F00325 /* IQKeyboardToolbarManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Internal.swift"; path = "IQKeyboardToolbarManager/Classes/IQKeyboardToolbarManager+Internal.swift"; sourceTree = ""; }; + 9FE8BDE8B3028D4046E3ADFF6D71C2A4 /* AMapSearchVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchVersion.h; path = AMapSearchKit.framework/Headers/AMapSearchVersion.h; sourceTree = ""; }; + 9FFCB3910600ECA6002BB878B30BA591 /* IQBarButtonItemConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQBarButtonItemConfiguration.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQBarButtonItemConfiguration.swift; sourceTree = ""; }; + A07699BB79F9619E4B3CE5048F213790 /* VolcEngineRTC.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = VolcEngineRTC.release.xcconfig; sourceTree = ""; }; A16FD016E18EACCF6B23F219F2E236FE /* IQKeyboardToolbar-IQKeyboardToolbar */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQKeyboardToolbar-IQKeyboardToolbar"; path = IQKeyboardToolbar.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - A1D1E63604F87F83BA8BFDF2B0C7720E /* AMapURLSearchConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapURLSearchConfig.h; path = AMapFoundationKit.framework/Headers/AMapURLSearchConfig.h; sourceTree = ""; }; - A23F97293C46916466F957A9639D75E3 /* ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist"; sourceTree = ""; }; - A372E26A2A397D202C662C0FD912FCA2 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardNotification/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - A3B399BF12010721D7606DE2C51AC0EF /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardToolbarManager/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - A3CDCD8BAD4E220D8D74F8D8D6DE8034 /* UMDevice.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMDevice.debug.xcconfig; sourceTree = ""; }; - A5009A8DB6C64B30425E121DEC607B95 /* IQTextInputViewNotification.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextInputViewNotification.debug.xcconfig; sourceTree = ""; }; - A528053628879455AB95D1D237A78AED /* IQKeyboardToolbar-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardToolbar-dummy.m"; sourceTree = ""; }; - A55F0EA1CF98666CC54E6179EFEB3FEF /* MACustomBuildingOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACustomBuildingOverlayRenderer.h; path = MAMapKit.framework/Headers/MACustomBuildingOverlayRenderer.h; sourceTree = ""; }; - A5CAB9A0AF5C7D79C41E91058465C241 /* UMCommon-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "UMCommon-xcframeworks.sh"; sourceTree = ""; }; + A1836F952905D07E23AC756B411BE696 /* ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; sourceTree = ""; }; + A32A4C33E27F87863FB11AC3C9A09E0C /* RealXBase.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = RealXBase.xcframework; sourceTree = ""; }; + A389B2EDC5D1D81EF043A12391638BC1 /* UIView+Resign.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Resign.swift"; path = "IQKeyboardManagerSwift/Resign/UIKItExtensions/UIView+Resign.swift"; sourceTree = ""; }; + A3ADF11FAEAC8F80DA91E2D23F4F5C48 /* WechatOpenSDK-XCFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "WechatOpenSDK-XCFramework.debug.xcconfig"; sourceTree = ""; }; + A3B92976C10CBB84DC9EF347BDFC60CF /* UIView+Parent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Parent.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UIView+Parent.swift"; sourceTree = ""; }; + A4F538840D1231E9EE9946590DC1D919 /* ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; sourceTree = ""; }; A60612F837C72E04C6FBB22DF596D0FD /* Pods-suixinkanTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-suixinkanTests.release.xcconfig"; sourceTree = ""; }; - A6E0D731B6EAD62024190BA78D40D864 /* IQKeyboardReturnManager-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardReturnManager-prefix.pch"; sourceTree = ""; }; - A6EA67538179CD91CD56FFCAD0626066 /* MAMultiPointOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPointOverlayRenderer.h; path = MAMapKit.framework/Headers/MAMultiPointOverlayRenderer.h; sourceTree = ""; }; A793550DF057E02528E95AC40437943A /* Pods-suixinkan.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-suixinkan.modulemap"; sourceTree = ""; }; - A887BA5DD84AFB6405BA57323FCE8F0B /* MAMapView+Resource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "MAMapView+Resource.h"; path = "MAMapKit.framework/Headers/MAMapView+Resource.h"; sourceTree = ""; }; - A8E60BFFD4A191EDF1872BE7E0FAE073 /* IQKeyboardReturnManager.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardReturnManager.release.xcconfig; sourceTree = ""; }; + A83A792738DA83E2D1119087D2778E1F /* ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; sourceTree = ""; }; + A8573CC4CF72940E255AF095FEA84D0E /* MAOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOverlay.h; path = MAMapKit.framework/Headers/MAOverlay.h; sourceTree = ""; }; A8E950A16D00F649C54FFB30F81D7842 /* IQKeyboardManagerSwift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardManagerSwift; path = IQKeyboardManagerSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A900C19FDD423A63EDB4890241E20444 /* AMapSearch-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapSearch-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; + A96477B12A2B08512DEF851076308BFC /* IQKeyboardNotification-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardNotification-umbrella.h"; sourceTree = ""; }; A98E61050764443945D42627C2F5BE35 /* Pods-suixinkan-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-suixinkan-acknowledgements.plist"; sourceTree = ""; }; - A9E48F379ACA8E9BCCAA467CA89ABF4A /* MAAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnnotation.h; path = MAMapKit.framework/Headers/MAAnnotation.h; sourceTree = ""; }; - AA518C79CF22771172370F62AF98D0ED /* ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; sourceTree = ""; }; - AAF4093F21688BF793E97C7EC0C3C48D /* AMapSearchError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchError.h; path = AMapSearchKit.framework/Headers/AMapSearchError.h; sourceTree = ""; }; - AC0FF26EF54F0D2CCEEC60FB7E97B123 /* UIView+IQKeyboardExtensionObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardExtensionObjc.swift"; path = "IQKeyboardToolbar/Classes/IQKeyboardExtension/UIView+IQKeyboardExtensionObjc.swift"; sourceTree = ""; }; - ADB26D0335D3238C4C3CACC81077B951 /* IQTextInputViewNotification-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextInputViewNotification-umbrella.h"; sourceTree = ""; }; - AE62D9B077B5FC3AD4F95C8A43FB4558 /* IQKeyboardReturnManager-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardReturnManager-dummy.m"; sourceTree = ""; }; + AC6E594A0FD896EA5CDA3E6F190C0AB7 /* RTCFFmpeg.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = RTCFFmpeg.xcframework; sourceTree = ""; }; + AE545D7C7BC8717AD1293E91D09033F0 /* MAArc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAArc.h; path = MAMapKit.framework/Headers/MAArc.h; sourceTree = ""; }; + AED971CC449F4593B117886F944152E7 /* ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; sourceTree = ""; }; + AEFD6F12ED3038D1F73D5ECBCA0A3CBF /* MAHeatMapVectorOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorOverlay.h; path = MAMapKit.framework/Headers/MAHeatMapVectorOverlay.h; sourceTree = ""; }; + AF2D49F00775A27DDCDF1AE909125185 /* IQKeyboardToolbarManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarManager.swift; path = IQKeyboardToolbarManager/Classes/IQKeyboardToolbarManager.swift; sourceTree = ""; }; + B15A89F8DECA647A9464E7868B3D9832 /* IQKeyboardToolbar-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbar-umbrella.h"; sourceTree = ""; }; + B184A8220FD8F49AFB9FA1C67C8F4085 /* UMDevice.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMDevice.debug.xcconfig; sourceTree = ""; }; + B19FAB17A68CCCA197D7890BED3BC1D2 /* IQTextInputViewNotification-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextInputViewNotification-umbrella.h"; sourceTree = ""; }; + B209820123663AF8D99EFF6912BF9F79 /* AMapFoundationConst.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapFoundationConst.h; path = AMapFoundationKit.framework/Headers/AMapFoundationConst.h; sourceTree = ""; }; + B2CF147BDD9EF2098912F69A7BFF89DD /* MAOfflineMapViewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineMapViewController.h; path = MAMapKit.framework/Headers/MAOfflineMapViewController.h; sourceTree = ""; }; B2F70708431A20D2521270775E3BFCC3 /* Pods-suixinkanTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-suixinkanTests-dummy.m"; sourceTree = ""; }; - B3AE51D64EA8212082A2215BE56D852C /* MAOfflineProvince.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineProvince.h; path = MAMapKit.framework/Headers/MAOfflineProvince.h; sourceTree = ""; }; + B46217D14293E54C73A85F1BD3301FE8 /* MAOfflineCity.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineCity.h; path = MAMapKit.framework/Headers/MAOfflineCity.h; sourceTree = ""; }; B4673E41D5AF372B424C758462A39ADE /* Pods-suixinkanTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-suixinkanTests-umbrella.h"; sourceTree = ""; }; - B476FC7E116754954EC384BBE70ECF92 /* Array+Sort.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Array+Sort.swift"; path = "IQKeyboardToolbarManager/Classes/UIKitExtensions/Array+Sort.swift"; sourceTree = ""; }; B4B1A58096F15199A14069C5D6AA1C99 /* IQKeyboardToolbar */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardToolbar; path = IQKeyboardToolbar.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B50BF2C383279DDB7880AF4C978116E2 /* IQKeyboardManager+Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Deprecated.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/Deprecated/IQKeyboardManager+Deprecated.swift"; sourceTree = ""; }; - B5A0A97D73FD94FDE81627BCEE94F1C4 /* IQKeyboardCore.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardCore.modulemap; sourceTree = ""; }; - B72C4055DD0AAE857AE24AA1B22D707A /* AMapSearchKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AMapSearchKit.framework; sourceTree = ""; }; - B79499F18F5215A6EF9F0698F1427102 /* IQKeyboardManagerSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardManagerSwift-prefix.pch"; sourceTree = ""; }; - B8442EDA82E520DD01BEACF61F58E60E /* MATouchPoi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATouchPoi.h; path = MAMapKit.framework/Headers/MATouchPoi.h; sourceTree = ""; }; - B8A46592E83A53CA8AB70662CB8DF906 /* MAPointAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPointAnnotation.h; path = MAMapKit.framework/Headers/MAPointAnnotation.h; sourceTree = ""; }; - BC217F78CA99FD3D41A3303B824C278D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQTextInputViewNotification/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; - BD5EDDC96EA8A526C228C3ABF1B82399 /* IQPlaceholderable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQPlaceholderable.swift; path = IQKeyboardToolbar/Placeholderable/IQPlaceholderable.swift; sourceTree = ""; }; - BDB6452999256D2DF97D65A8AFE1FE44 /* MAHeatMapVectorGridOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapVectorGridOverlay.h; path = MAMapKit.framework/Headers/MAHeatMapVectorGridOverlay.h; sourceTree = ""; }; - BDDEE926B156A69E8B915347853ECEC5 /* IQKeyboardManagerSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardManagerSwift.release.xcconfig; sourceTree = ""; }; - BF84270BA52DE4FAC1678E99D700AA50 /* UIScrollView+IQKeyboardManagerExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIScrollView+IQKeyboardManagerExtension.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIScrollView+IQKeyboardManagerExtension.swift"; sourceTree = ""; }; - C026F448EE161E5AA295F2DD8C00F78B /* IQKeyboardToolbarManager-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardToolbarManager-dummy.m"; sourceTree = ""; }; - C416DF9C2C6D3B85FB383E91C18664DE /* UMCommon.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; name = UMCommon.xcframework; path = UMCommon_7.5.11/UMCommon.xcframework; sourceTree = ""; }; - C4C246899B9ADD76C47413CFC1900669 /* IQActiveConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQActiveConfiguration.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/Configuration/IQActiveConfiguration.swift; sourceTree = ""; }; - C582DCBB25F9FD804B0DD31A72557820 /* IQKeyboardToolbar.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardToolbar.modulemap; sourceTree = ""; }; - C5DD064141FD6D9585DDBFF2FE5EF228 /* IQKeyboardManager+Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Debug.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/Debug/IQKeyboardManager+Debug.swift"; sourceTree = ""; }; - C615ED8173496D8C147DB28F59F9F67E /* MAAnimatedAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnimatedAnnotation.h; path = MAMapKit.framework/Headers/MAAnimatedAnnotation.h; sourceTree = ""; }; - C73A65DB570592414ACDAAF9091E3EEF /* AMapLocationRegionObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationRegionObj.h; path = AMapLocationKit.framework/Headers/AMapLocationRegionObj.h; sourceTree = ""; }; - C7C310CD68DF209957D60358329E9D5B /* AMap3DMap-NO-IDFA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMap3DMap-NO-IDFA.debug.xcconfig"; sourceTree = ""; }; - C93B314BF63192FFFEA853AD9BA8066A /* IQKeyboardToolbar-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbar-umbrella.h"; sourceTree = ""; }; - CA76A2A5EC61CC8B474C1A4551226332 /* IQKeyboardExtended.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardExtended.swift; path = IQKeyboardCore/Classes/IQKeyboardExtended.swift; sourceTree = ""; }; - CBE00B7180E351F1E2A6A92CC529B41F /* MAUserLocation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAUserLocation.h; path = MAMapKit.framework/Headers/MAUserLocation.h; sourceTree = ""; }; - CC2DA460622CB6B30A4B3F6B866725B8 /* ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; sourceTree = ""; }; + B70C6CBF2C487B6296E36E4818045F76 /* IQKeyboardToolbarManager+Toolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Toolbar.swift"; path = "IQKeyboardToolbarManager/Classes/Toolbar/IQKeyboardToolbarManager+Toolbar.swift"; sourceTree = ""; }; + B8476A96BE982F855EDE7EECC0AC906F /* MAConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAConfig.h; path = MAMapKit.framework/Headers/MAConfig.h; sourceTree = ""; }; + BBAB966289F13CCDA2FAD0652410E843 /* ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; sourceTree = ""; }; + BC22E9169FFEB3DDF58C844A9E7BC4DB /* IQKeyboardReturnManager-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardReturnManager-Info.plist"; sourceTree = ""; }; + BD07E0C05CA7DC462A51F4F90DD5AEE7 /* IQKeyboardToolbarPlaceholderConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarPlaceholderConfiguration.swift; path = IQKeyboardToolbar/Classes/Placeholder/IQKeyboardToolbarPlaceholderConfiguration.swift; sourceTree = ""; }; + BD88BA8FC4CDC4CDF011EE41273240C1 /* MAHeatMapTileOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapTileOverlay.h; path = MAMapKit.framework/Headers/MAHeatMapTileOverlay.h; sourceTree = ""; }; + C0A04393C6482B43D12F30B07E04748A /* IQKeyboardToolbarManager-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbarManager-prefix.pch"; sourceTree = ""; }; + C0BCD3AF604048516EAC8913C6A01273 /* MAMapCustomStyleOptions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapCustomStyleOptions.h; path = MAMapKit.framework/Headers/MAMapCustomStyleOptions.h; sourceTree = ""; }; + C1D32FAB7ECAEED292D25CAE95327CF0 /* IQKeyboardToolbarManager+Action.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardToolbarManager+Action.swift"; path = "IQKeyboardToolbarManager/Classes/Toolbar/IQKeyboardToolbarManager+Action.swift"; sourceTree = ""; }; + C22127072FC804B46594EFEEA2162330 /* IQKeyboardCore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardCore.debug.xcconfig; sourceTree = ""; }; + C286CE80B5550AF484AF054CFE65DE2C /* MATerrainOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATerrainOverlayRenderer.h; path = MAMapKit.framework/Headers/MATerrainOverlayRenderer.h; sourceTree = ""; }; + C2A0B423670E836CA2EA43C41CB19811 /* WechatOpenSDK-XCFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "WechatOpenSDK-XCFramework.release.xcconfig"; sourceTree = ""; }; + C2AAAB1B6731410C9D9EB1C5A6AC99DF /* IQKeyboardNotification.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardNotification.modulemap; sourceTree = ""; }; + C2C181E4F940F09E297591DA565280F7 /* UIScrollView+IQKeyboardManagerExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIScrollView+IQKeyboardManagerExtension.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIScrollView+IQKeyboardManagerExtension.swift"; sourceTree = ""; }; + C5AD54145A409C1D7C94875810471BF1 /* IQKeyboardManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardManager.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager.swift; sourceTree = ""; }; + C6E5D9D64B6AABE6937DCEA19B46DD79 /* MAMultiPoint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPoint.h; path = MAMapKit.framework/Headers/MAMultiPoint.h; sourceTree = ""; }; + C73BB9F448E56B49D4F5FE5D9987B78F /* UMAPM.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; name = UMAPM.xcframework; path = UMAPM_2.0.7/UMAPM.xcframework; sourceTree = ""; }; + C7F16FCE59EA776D68BCA96044AB643B /* MAAnimatedAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnimatedAnnotation.h; path = MAMapKit.framework/Headers/MAAnimatedAnnotation.h; sourceTree = ""; }; + C800E6213B65C17D9D650EFBA167370D /* IQKeyboardCore-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "IQKeyboardCore-dummy.m"; sourceTree = ""; }; + C8BC74EE1659FD64F176CD4BE256AF84 /* IQKeyboardManager+Position.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Position.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Position.swift"; sourceTree = ""; }; + C8D6630F56DE8A616BF4AF6A3E8FB586 /* MAMultiPointOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPointOverlayRenderer.h; path = MAMapKit.framework/Headers/MAMultiPointOverlayRenderer.h; sourceTree = ""; }; + CBD245733975A997CDE429A351AB1C6F /* JCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JCore.release.xcconfig; sourceTree = ""; }; + CCBC3902C2DD89F6B74BFE08F7A9DC48 /* MAGeometry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGeometry.h; path = MAMapKit.framework/Headers/MAGeometry.h; sourceTree = ""; }; + CD21C2E29DEBDED503E1CC5C84490B9D /* IQKeyboardToolbar-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardToolbar-Info.plist"; sourceTree = ""; }; CD25C568A7D214824F22DD1F8C8255BB /* Pods-suixinkanTests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-suixinkanTests-Info.plist"; sourceTree = ""; }; - CD831F6743DBA4A24C9265372979449E /* AMapLocationCommonObj.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationCommonObj.h; path = AMapLocationKit.framework/Headers/AMapLocationCommonObj.h; sourceTree = ""; }; - CDB04A2BDB7E068229CAF7A81165DD65 /* UIView+IQKeyboardExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardExtension.swift"; path = "IQKeyboardToolbar/Classes/IQKeyboardExtension/UIView+IQKeyboardExtension.swift"; sourceTree = ""; }; - CE41AE378E9210FE5D862A988433348E /* IQTextInputViewInfoModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputViewInfoModel.swift; path = IQKeyboardReturnManager/Classes/IQTextInputViewInfoModel.swift; sourceTree = ""; }; - CF87FBE2D4B19937F3E9A942696ECB5A /* MAMVTTileOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMVTTileOverlay.h; path = MAMapKit.framework/Headers/MAMVTTileOverlay.h; sourceTree = ""; }; - D1086E217E4FD8CD9A1999C4CC605222 /* MAMultiPointOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPointOverlay.h; path = MAMapKit.framework/Headers/MAMultiPointOverlay.h; sourceTree = ""; }; + CD4FE136E9A99BAE0FA8EBFC4AC80FB4 /* MAOfflineProvince.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineProvince.h; path = MAMapKit.framework/Headers/MAOfflineProvince.h; sourceTree = ""; }; + CE4AE66CE966DE231E272316E63E53EC /* MAParticleOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAParticleOverlay.h; path = MAMapKit.framework/Headers/MAParticleOverlay.h; sourceTree = ""; }; + CED54F92E588775BEA7B38CECABD7702 /* JPush.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JPush.debug.xcconfig; sourceTree = ""; }; + CFC4986043F2FE7F33785D4D46CA5E4C /* IQKeyboardNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardNotification-Info.plist"; sourceTree = ""; }; + CFDC64AA2A98DF6AB638AEDFE148C722 /* UIView+IQKeyboardManagerExtensionObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardManagerExtensionObjc.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIView+IQKeyboardManagerExtensionObjc.swift"; sourceTree = ""; }; + D054D25DFF58C86E7DD00309158A9533 /* IQRootControllerConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQRootControllerConfiguration.swift; path = IQKeyboardManagerSwift/IQKeyboardManager/Configuration/IQRootControllerConfiguration.swift; sourceTree = ""; }; + D195EE12A7242B6960BDA464D00CF39D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardNotification/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; D1D336475B683610A3803B2BDF0B662D /* Pods-suixinkan-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-suixinkan-resources.sh"; sourceTree = ""; }; - D2B0169030016DBD87F970A973A138AD /* IQKeyboardCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardCore.release.xcconfig; sourceTree = ""; }; - D376C98F66AE428B2165D3BFCA6CBB0A /* AMapSearchKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchKit.h; path = AMapSearchKit.framework/Headers/AMapSearchKit.h; sourceTree = ""; }; - D4ADD25EEB716A656CC0DBEDCC9790D4 /* IQKeyboardConstants.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardConstants.swift; path = IQKeyboardCore/Classes/Constants/IQKeyboardConstants.swift; sourceTree = ""; }; - D6B6259CDECD85D674B168D3AF7C0101 /* IQKeyboardToolbarManager-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbarManager-umbrella.h"; sourceTree = ""; }; - D702515773E3DF4969443386C85C55CD /* MATraceLocation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MATraceLocation.h; path = MAMapKit.framework/Headers/MATraceLocation.h; sourceTree = ""; }; - D717049D0CC527FBADC7B8BFC423D331 /* IQTextView-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQTextView-Info.plist"; sourceTree = ""; }; - D8ABCFBB8BDD11CFBF49406BF0165A41 /* IQKeyboardAppearanceManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardAppearanceManager+Internal.swift"; path = "IQKeyboardManagerSwift/Appearance/IQKeyboardAppearanceManager+Internal.swift"; sourceTree = ""; }; - D8ED740F9377F944E3895021F134AC68 /* IQBarButtonItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQBarButtonItem.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQBarButtonItem.swift; sourceTree = ""; }; - DA27C00D82366242724F675C7E3A6BFD /* IQKeyboardToolbar-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardToolbar-Info.plist"; sourceTree = ""; }; - DA598BC1826B04340DCAC8EF685201E7 /* MAUserLocationRepresentation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAUserLocationRepresentation.h; path = MAMapKit.framework/Headers/MAUserLocationRepresentation.h; sourceTree = ""; }; - DA603DEC8F9F9774A51A7EF0A9BB62EF /* jpush-ios-6.1.0.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = "jpush-ios-6.1.0.xcframework"; sourceTree = ""; }; - DB5660BB9799DC420CD4238B38ED357F /* UIView+IQKeyboardManagerExtensionObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardManagerExtensionObjc.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIView+IQKeyboardManagerExtensionObjc.swift"; sourceTree = ""; }; - DD52E2C9D26643C4510332244B319F71 /* JPush.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JPush.debug.xcconfig; sourceTree = ""; }; - DD68AF4711DE3DCD592D096BC6577207 /* IQBarButtonItemConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQBarButtonItemConfiguration.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQBarButtonItemConfiguration.swift; sourceTree = ""; }; - DDABFE3773641DCA1393690ED61D8407 /* IQTextInputViewNotification-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQTextInputViewNotification-prefix.pch"; sourceTree = ""; }; - DFDC309A50F01E88696489F1677C3AA7 /* MAMultiPolyline.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiPolyline.h; path = MAMapKit.framework/Headers/MAMultiPolyline.h; sourceTree = ""; }; - DFE51D2405E1E217F50AA3BA1213B3AD /* UMDevice.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMDevice.release.xcconfig; sourceTree = ""; }; - E0F761FE0B098205EE12A869B3BB104B /* MAMapKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapKit.h; path = MAMapKit.framework/Headers/MAMapKit.h; sourceTree = ""; }; - E1B42881A884188A8DF9EAE068A6DC08 /* AMapFoundationVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapFoundationVersion.h; path = AMapFoundationKit.framework/Headers/AMapFoundationVersion.h; sourceTree = ""; }; - E23A19CFE92D16E0C6DF4232CAE6BE95 /* IQKeyboardManager+ActiveConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+ActiveConfiguration.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+ActiveConfiguration.swift"; sourceTree = ""; }; - E26D520CBDC504839CC1C6D42B0B0B80 /* IQKeyboardToolbarManager-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardToolbarManager-prefix.pch"; sourceTree = ""; }; - E3AC9204F4307F3CEE2EA7B4755F2BA3 /* UIView+Responders.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Responders.swift"; path = "IQKeyboardToolbarManager/Classes/UIKitExtensions/UIView+Responders.swift"; sourceTree = ""; }; + D20C43E50A3476871B7384379068F972 /* UMCommon.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; name = UMCommon.xcframework; path = UMCommon_7.5.11/UMCommon.xcframework; sourceTree = ""; }; + D2442DAFEEABF11200E680955456504F /* AMapSearchAPI.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchAPI.h; path = AMapSearchKit.framework/Headers/AMapSearchAPI.h; sourceTree = ""; }; + D2E3FD31E91683FDC0B22290FE74B7E2 /* ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist"; sourceTree = ""; }; + D30ADEE09F82DF19A1888B002A47FC21 /* IQKeyboardExtended.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardExtended.swift; path = IQKeyboardCore/Classes/IQKeyboardExtended.swift; sourceTree = ""; }; + D38BDB89CF929982D596C8C7390190C0 /* IQKeyboardReturnManager+UITextViewDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardReturnManager+UITextViewDelegate.swift"; path = "IQKeyboardReturnManager/Classes/Delegates/IQKeyboardReturnManager+UITextViewDelegate.swift"; sourceTree = ""; }; + D4441EC6FD7E6501CD6A029CC5547EB7 /* UMDevice.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMDevice.release.xcconfig; sourceTree = ""; }; + D4F22BBAC26D59FA533BC3E2D6249904 /* IQKeyboardCore-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardCore-umbrella.h"; sourceTree = ""; }; + D716492F07DEB42B388856692B6E843A /* AMapLocation-NO-IDFA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "AMapLocation-NO-IDFA.release.xcconfig"; sourceTree = ""; }; + D7ACFC49738FF4F612D385219B5A5498 /* UMCommon-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "UMCommon-xcframeworks.sh"; sourceTree = ""; }; + E0AC776726C388E12EFB4BFD36A72AB6 /* IQKeyboardCore-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardCore-prefix.pch"; sourceTree = ""; }; + E1B75F1D0D65299E5DC583CECA54FDAA /* UIView+ParentObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+ParentObjc.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UIView+ParentObjc.swift"; sourceTree = ""; }; + E2C3388662FA183F12DC5F47940D57DC /* IQKeyboardToolbarConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardToolbarConfiguration.swift; path = IQKeyboardToolbarManager/Classes/Configuration/IQKeyboardToolbarConfiguration.swift; sourceTree = ""; }; + E3532585B460CC985A9C1C9DAF3AEB1E /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQTextInputViewNotification/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; + E3AB3CAD98805C12A0303E5EEF02BA39 /* UIView+IQKeyboardExtensionObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardExtensionObjc.swift"; path = "IQKeyboardToolbar/Classes/IQKeyboardExtension/UIView+IQKeyboardExtensionObjc.swift"; sourceTree = ""; }; E3B33A56AD414D84948526129E9D584C /* Pods-suixinkan.simulatordebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-suixinkan.simulatordebug.xcconfig"; sourceTree = ""; }; - E58F90C5C01D15A1D8477A2F76C55479 /* IQKeyboardToolbar.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbar.release.xcconfig; sourceTree = ""; }; - E5AEDD7F9FD976DFFF047A8BF9EEC6CC /* AMapGeoFenceError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapGeoFenceError.h; path = AMapLocationKit.framework/Headers/AMapGeoFenceError.h; sourceTree = ""; }; - E5F0A37891F1A7765B99C903153C0945 /* UIView+Hierarchy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Hierarchy.swift"; path = "IQKeyboardCore/Classes/UIKitExtensions/UIView+Hierarchy.swift"; sourceTree = ""; }; - E64981F07E6AF8250D37F4D1295891B8 /* UMCommon.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMCommon.debug.xcconfig; sourceTree = ""; }; - E6B0E1AAA5225E113179D3AC9F989DF5 /* MAHeatMapTileOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAHeatMapTileOverlay.h; path = MAMapKit.framework/Headers/MAHeatMapTileOverlay.h; sourceTree = ""; }; - E78E48748C5DEEFFFD6E4469DA5EA2C1 /* AMapLocationVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationVersion.h; path = AMapLocationKit.framework/Headers/AMapLocationVersion.h; sourceTree = ""; }; - E7FD69C0D8168D323ADC0A6EFD7FC1DD /* UIScrollView+IQKeyboardManagerExtensionObjc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIScrollView+IQKeyboardManagerExtensionObjc.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManagerExtension/UIScrollView+IQKeyboardManagerExtensionObjc.swift"; sourceTree = ""; }; - E8064F1ACE496CC1AE128FFDF32AF3E2 /* MAArc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAArc.h; path = MAMapKit.framework/Headers/MAArc.h; sourceTree = ""; }; - E97A7F595151E2AD4F30897F4B748EA9 /* MAMapSnapshot.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapSnapshot.h; path = MAMapKit.framework/Headers/MAMapSnapshot.h; sourceTree = ""; }; - EA5ECDD2101FE053DF1B8A46BB43772C /* MALineDrawType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MALineDrawType.h; path = MAMapKit.framework/Headers/MALineDrawType.h; sourceTree = ""; }; - EAD4712612A5077FB71A6D13B7C6AB79 /* MAOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOverlayRenderer.h; path = MAMapKit.framework/Headers/MAOverlayRenderer.h; sourceTree = ""; }; - EBA5A2153A7B70835913DD6D1524E81E /* MACustomCalloutView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MACustomCalloutView.h; path = MAMapKit.framework/Headers/MACustomCalloutView.h; sourceTree = ""; }; - ED1ED4E7D70A14D1BD220D30119286E2 /* MAParticleOverlayOptions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAParticleOverlayOptions.h; path = MAMapKit.framework/Headers/MAParticleOverlayOptions.h; sourceTree = ""; }; + E4F6A8D9BA6DC9E9C42A77BC2E7F0AF3 /* AMap.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "wrapper.plug-in"; name = AMap.bundle; path = MAMapKit.framework/AMap.bundle; sourceTree = ""; }; + E539D0B30D08031698030A03892FF590 /* MAPolygonRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPolygonRenderer.h; path = MAMapKit.framework/Headers/MAPolygonRenderer.h; sourceTree = ""; }; + E790BD090A1CD4A9A8D93AA43D92A380 /* AMapLocationVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationVersion.h; path = AMapLocationKit.framework/Headers/AMapLocationVersion.h; sourceTree = ""; }; + E8B9584100C63E03D75F12EF28FE46D8 /* IQKeyboardInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardInfo.swift; path = IQKeyboardNotification/Classes/IQKeyboardInfo.swift; sourceTree = ""; }; + E8E9C7FCBB1628F0AF444C2DB616C938 /* MAGroundOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAGroundOverlay.h; path = MAMapKit.framework/Headers/MAGroundOverlay.h; sourceTree = ""; }; + E8FD6F60EF688C5AC4A8B023D6D4196A /* JPush.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JPush.release.xcconfig; sourceTree = ""; }; + E924602982CB402C3DE49FAE6B4E86D7 /* IQBarButtonItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQBarButtonItem.swift; path = IQKeyboardToolbar/Classes/IQBarButtonItem/IQBarButtonItem.swift; sourceTree = ""; }; + EA6FFAAA8D1615D51313B82AE95D7A0F /* IQKeyboardManager+ToolbarManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+ToolbarManager.swift"; path = "IQKeyboardManagerSwift/IQKeyboardToolbarManager/IQKeyboardManager+ToolbarManager.swift"; sourceTree = ""; }; + EACBD6A19E0393FBFB741D6F1B5363BA /* jpush-ios-6.1.0.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = "jpush-ios-6.1.0.xcframework"; sourceTree = ""; }; ED291EE097723C1A6325544C2500E844 /* Pods-suixinkan-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-suixinkan-dummy.m"; sourceTree = ""; }; - EF17C02FB5EDE9DC941DACEB1BF37A67 /* MAOfflineItemNationWide.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineItemNationWide.h; path = MAMapKit.framework/Headers/MAOfflineItemNationWide.h; sourceTree = ""; }; - EF54B42FE0B021F5D3CDD98608D65DC8 /* ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; sourceTree = ""; }; - F0E323C689432F05D4DCE1478FE98A38 /* MAOfflineMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOfflineMap.h; path = MAMapKit.framework/Headers/MAOfflineMap.h; sourceTree = ""; }; - F152C09480DA43D313458EDBFD5135BF /* AMapURLSearch.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapURLSearch.h; path = AMapFoundationKit.framework/Headers/AMapURLSearch.h; sourceTree = ""; }; - F1EAE16DD95B4D774A7F33C84C92A987 /* MAOverlayPathRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAOverlayPathRenderer.h; path = MAMapKit.framework/Headers/MAOverlayPathRenderer.h; sourceTree = ""; }; - F235A21AFE7ECC646787D9C9313A8BC3 /* UMAPM-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "UMAPM-xcframeworks.sh"; sourceTree = ""; }; - F283224B76C1D6B83702001679439919 /* UMAPM.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UMAPM.release.xcconfig; sourceTree = ""; }; - F3B8F6CD0697840F54110DE73B4B45D2 /* IQKeyboardNotification-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "IQKeyboardNotification-Info.plist"; sourceTree = ""; }; - F4484DFD00A30223AFF26316F14A2723 /* AMapSearchVersion.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchVersion.h; path = AMapSearchKit.framework/Headers/AMapSearchVersion.h; sourceTree = ""; }; - F46DE7CDE3412F4C9963058278E9A341 /* jcore-noidfa-ios-5.4.2.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; path = "jcore-noidfa-ios-5.4.2.xcframework"; sourceTree = ""; }; - F567609174F5904AE6D76ECD374854A6 /* IQKeyboardNotification-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardNotification-prefix.pch"; sourceTree = ""; }; - F7237538405836409CB43509E3388D83 /* MAMapAccessibilityIdentifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMapAccessibilityIdentifier.h; path = MAMapKit.framework/Headers/MAMapAccessibilityIdentifier.h; sourceTree = ""; }; - F743267069A8E822C12FD23476C2E60E /* UMDevice.xcframework */ = {isa = PBXFileReference; includeInIndex = 1; name = UMDevice.xcframework; path = UMDevice_3.6.0/UMDevice.xcframework; sourceTree = ""; }; + EDC68D4FCB048FBF2A45CC21B1638F80 /* VolcEngineRTC.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = VolcEngineRTC.debug.xcconfig; sourceTree = ""; }; + EFB63127C0E518CF38404A5A50137D63 /* AMapSearchError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapSearchError.h; path = AMapSearchKit.framework/Headers/AMapSearchError.h; sourceTree = ""; }; + F0DAEBB9CD1A3D230D46015714723231 /* IQTextView+Placeholderable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQTextView+Placeholderable.swift"; path = "IQTextView/Classes/IQTextView+Placeholderable.swift"; sourceTree = ""; }; + F1F98B961492E58401AF64822AA86791 /* IQTextView.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextView.release.xcconfig; sourceTree = ""; }; + F38BAFEE9D73F8D4DC3463EC036ABE11 /* MAPathShowRange.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAPathShowRange.h; path = MAMapKit.framework/Headers/MAPathShowRange.h; sourceTree = ""; }; + F3DCEB6C2B197ABE227932FEA2419037 /* UIViewController+ParentContainer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIViewController+ParentContainer.swift"; path = "IQKeyboardManagerSwift/IQKeyboardManager/UIKitExtensions/UIViewController+ParentContainer.swift"; sourceTree = ""; }; + F3E9C7798DF3A5EBBDEAF4FCD0515ECA /* IQTextView.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQTextView.modulemap; sourceTree = ""; }; + F4023F00A614A00A57225A27D115BDB9 /* AMapLocationManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapLocationManager.h; path = AMapLocationKit.framework/Headers/AMapLocationManager.h; sourceTree = ""; }; + F4D876671EB044681F90C28875230D85 /* UIView+IQKeyboardExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+IQKeyboardExtension.swift"; path = "IQKeyboardToolbar/Classes/IQKeyboardExtension/UIView+IQKeyboardExtension.swift"; sourceTree = ""; }; + F4F1AACDDF2D1C20591B33DD8E2A5C38 /* IQKeyboardManager+Appearance_Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Appearance_Deprecated.swift"; path = "IQKeyboardManagerSwift/Appearance/IQKeyboardManager+Appearance_Deprecated.swift"; sourceTree = ""; }; + F59F91AFD79784903BF8352CDFAF43B9 /* IQTextInputViewInfoModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextInputViewInfoModel.swift; path = IQKeyboardReturnManager/Classes/IQTextInputViewInfoModel.swift; sourceTree = ""; }; + F7E22135559ACE352548CFD9ABB79BCA /* MAParticleOverlayOptions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAParticleOverlayOptions.h; path = MAMapKit.framework/Headers/MAParticleOverlayOptions.h; sourceTree = ""; }; + F7EED4BF1095985650837ABEA0C99E74 /* AMapFoundationKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AMapFoundationKit.h; path = AMapFoundationKit.framework/Headers/AMapFoundationKit.h; sourceTree = ""; }; F956E149F5B195BB7833F97FC6211AE8 /* IQTextInputViewNotification-IQTextInputViewNotification */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "IQTextInputViewNotification-IQTextInputViewNotification"; path = IQTextInputViewNotification.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - F9CB2239F63422E991F6FEF9D9A32967 /* IQKeyboardNotification.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardNotification.debug.xcconfig; sourceTree = ""; }; - FA43AA432E51DD3E160CB45F75EDD874 /* JCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = JCore.release.xcconfig; sourceTree = ""; }; + F97FC488C52F8C83E3213105C4228613 /* IQKeyboardReturnManager-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardReturnManager-umbrella.h"; sourceTree = ""; }; FA727BF5D9541C98C22C9ECC911576E2 /* IQKeyboardToolbarManager */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardToolbarManager; path = IQKeyboardToolbarManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FAE352943F84CF1F87B4462638AE8F18 /* MAConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAConfig.h; path = MAMapKit.framework/Headers/MAConfig.h; sourceTree = ""; }; - FBCA526A0BEFD238489E9050C4B47CB7 /* MAMVTTileOverlayRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMVTTileOverlayRenderer.h; path = MAMapKit.framework/Headers/MAMVTTileOverlayRenderer.h; sourceTree = ""; }; + FA8405454F857A83074F7A861FD13878 /* IQKeyboardReturnManager.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardReturnManager.debug.xcconfig; sourceTree = ""; }; + FB3211C8AD4603F8397DE7ED0479BDAD /* MAAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAAnnotation.h; path = MAMapKit.framework/Headers/MAAnnotation.h; sourceTree = ""; }; FBEC2A4D669A5B0C6DF262C7C1A4E8A2 /* Pods-suixinkan-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-suixinkan-Info.plist"; sourceTree = ""; }; - FC4A4ED3AA953F5ADE3FA7EC8F671377 /* IQKeyboardManager+Appearance_Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "IQKeyboardManager+Appearance_Deprecated.swift"; path = "IQKeyboardManagerSwift/Appearance/IQKeyboardManager+Appearance_Deprecated.swift"; sourceTree = ""; }; - FC4CD6A2AB7E8F21DDF47AE3878B13B4 /* IQTextView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQTextView.debug.xcconfig; sourceTree = ""; }; FC7F0CF2EA5DF59C59D9995890DA5C47 /* IQKeyboardCore */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardCore; path = IQKeyboardCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FDF709D73DE1142AE1CF86A66274B9FC /* WechatOpenSDK-XCFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "WechatOpenSDK-XCFramework.debug.xcconfig"; sourceTree = ""; }; - FE9187432460BB6FE0DF674937D7E42E /* MAParticleOverlay.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAParticleOverlay.h; path = MAMapKit.framework/Headers/MAParticleOverlay.h; sourceTree = ""; }; + FD5AD0CFBB7A9E4F5B2A53DBC856B6E8 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IQKeyboardCore/Assets/PrivacyInfo.xcprivacy; sourceTree = ""; }; + FE55B3A42666347457710420CE151AA6 /* IQKeyboardToolbar.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardToolbar.modulemap; sourceTree = ""; }; FEF9AC89E9C4BD37AC0AB78B535D1CFC /* IQKeyboardNotification */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardNotification; path = IQKeyboardNotification.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FF151EDD3DF75406929ACA6D262AA65C /* MAMultiTexturePolylineRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MAMultiTexturePolylineRenderer.h; path = MAMapKit.framework/Headers/MAMultiTexturePolylineRenderer.h; sourceTree = ""; }; + FF1A51684BE9AD249695A507E8AE84BF /* IQKeyboardManagerSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardManagerSwift.release.xcconfig; sourceTree = ""; }; + FF3A7D5C821762023E797F50C2927440 /* VolcEngineRTC-xcframeworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "VolcEngineRTC-xcframeworks.sh"; sourceTree = ""; }; + FF5A7F51FAADA1E1B5FC260E1B632D6C /* IQKeyboardToolbar.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbar.debug.xcconfig; sourceTree = ""; }; + FFC2E336F5D035028DAA138A1A5C4F2E /* IQKeyboardToolbarManager.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardToolbarManager.debug.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 0B63EA4E1D3EA61D0E4AC4DE8422C4E8 /* Frameworks */ = { + 1168AB246AD776F63DD112F4BF1254B9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 46769B00A3AF04C4F9AE2D87955658B9 /* Combine.framework in Frameworks */, + 22BA2DB8232BB7DCF5B220D2C101A3B2 /* Foundation.framework in Frameworks */, + 139ACE54AA202BAD419CC5FB30BF5830 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1AB23A258F502AF32AD2AF5C8087AA1C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -887,13 +920,34 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7A8C5A659560BF9E0CC487398B4E27CF /* Frameworks */ = { + 5E06627920B40924E21BA6A8C70B3619 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 894C85B6B68DC29E241159AD71D06391 /* Combine.framework in Frameworks */, - 1BE160B878A28F5FA898999E0805FCCE /* Foundation.framework in Frameworks */, - A199EBA4C308040DBF6D668F277AD380 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6F65B215F9B42F7EC03DEB24F6871DFB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 028B34F60037C63915906C0ED6B79E64 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7D2E82DB5847681794F83B68E6CA40A5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8117EC3866EDF249CA8CE1376526A3DB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 11257CC87FF4D3453F57F94F9C131841 /* Foundation.framework in Frameworks */, + 9C41BFFC33B98E3B4C0D604606517086 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -905,89 +959,76 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 902E85A742A01B8059EFA5B89DA66F7F /* Frameworks */ = { + 920BB55EA03141F9FEC988CF5499655C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 859DB2F7AED6E742BD5491C50234DA05 /* Combine.framework in Frameworks */, + 93086CDECC1CF6172D5307CD731DDB69 /* Foundation.framework in Frameworks */, + 53AA6596E89D66A0DE2B630DC0C06F3B /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 981D9774F54AB0E1C321D57321305E99 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - A6D81DF4CB996A5BEAA5DD9D77D0C0F3 /* Frameworks */ = { + A5B5101DC57939771E53F12E05DCEB38 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - B7AB75E5D475777E4C3BAD9B643ED838 /* Frameworks */ = { + B1C16E3CDD005904731374173E50A59E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A7559B934F8DCF87C3FE2BA4F5C4C95A /* Combine.framework in Frameworks */, + 9DF4CAF5CDCEBF860D1E04475EBB8504 /* Foundation.framework in Frameworks */, + 64FCAFDF9302AC4563973F3E65DDDA01 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B6BB62FFBD45C60D8F1FE570CC1DE3E0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - BE4F345025D2187B63FA2ED8E7233AED /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8A4E21670B754CB36D5C537DDFF746B9 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C5CF3AB4E319774E8EF43C96BE7E9D20 /* Frameworks */ = { + BDBD60A29BE8E581EB5EDCF60600BE9F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - D7A42CDC1C43250CB900E1FB74D8B092 /* Frameworks */ = { + C627275D6CBFEDB1B39AD4E3C7A62115 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - DCCD854A95878812F357EA2EBB20D31A /* Frameworks */ = { + C7391ABA2E8405F598E3AD115908ECC1 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 380C9A16512596163FFB339B98F75C16 /* Combine.framework in Frameworks */, - B532634861D24EDC85FABA261FDD0E35 /* Foundation.framework in Frameworks */, - 6F28DC7E3DFE272A55834DCAA3BC46E3 /* UIKit.framework in Frameworks */, + BABC1D696349718315EE287F779F7974 /* Foundation.framework in Frameworks */, + DA18C09E871D9EE49EF5AAAC18B0324E /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - EB4C499E90100393A2F36CAA19DA0329 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EC2013DAC79463EF21C09D001A46CB40 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 549A919387FE08829094B5E6352603DF /* Combine.framework in Frameworks */, - 25EE6824CF8528BDE7A1F21B97A2936B /* Foundation.framework in Frameworks */, - D9C7F5D217BC3710874B9A0D70666A01 /* UIKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EC4276E1E0D899ACABDF5030E302B8C5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 48218E2CD382EF08D195E251C7DFC3DE /* Foundation.framework in Frameworks */, - E2A7F3B197F20459F0941DCBF911D1D9 /* UIKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F36C7EF959F38C314D7D9C07F20214F9 /* Frameworks */ = { + D5423F9C2E19B190FF95082DAF712AF0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 249F48C24B2BF91AD52E41216BE2CC7A /* Foundation.framework in Frameworks */, + 8D20DCD225FDA85F616413E20B0A15E6 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1000,80 +1041,9 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - FA5B37F87B05E58E873C97C8F4121D4E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 124BCB4411C266F74471632FEE411FDC /* Foundation.framework in Frameworks */, - 04BD4928C99B51A317B39CF5C0C3F780 /* UIKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FC3987C09F835C384373CDD2FFD65186 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6426396B8E7B8854481D895B59EE2033 /* Foundation.framework in Frameworks */, - 0E0C92029C63C476812AB8A5E69F1A0E /* UIKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 00BDB8452B08527967D9BF4BCE67160E /* Resign */ = { - isa = PBXGroup; - children = ( - 8B684CF1599F22DF5238BEF46E8CD746 /* IQKeyboardManager+Resign.swift */, - 778FA22D4BEBBF59A58346CBF997FEA5 /* IQKeyboardManager+Resign_Deprecated.swift */, - A12612B1AED7EE8CCD44571B43987BBB /* IQKeyboardResignHandler.swift */, - 930508646A6ED3948BD91D3EC83E0968 /* IQKeyboardResignHandler+Internal.swift */, - 4C0003B8890568226024C1462834BA44 /* UIView+Resign.swift */, - 4E1C0398739C8BEB724C448EE1DB0F6E /* UIView+ResignObjc.swift */, - ); - name = Resign; - sourceTree = ""; - }; - 033D0A6A59C1A74DDD7D6980C1AB24B9 /* Support Files */ = { - isa = PBXGroup; - children = ( - 25A6DA65604634AA8B5F0DDCEEA348ED /* IQKeyboardReturnManager.modulemap */, - AE62D9B077B5FC3AD4F95C8A43FB4558 /* IQKeyboardReturnManager-dummy.m */, - 9AE61E9DC82B9FDCC6C66EA02C64CED7 /* IQKeyboardReturnManager-Info.plist */, - A6E0D731B6EAD62024190BA78D40D864 /* IQKeyboardReturnManager-prefix.pch */, - 527952C17AC8880F69799F25BAE08B43 /* IQKeyboardReturnManager-umbrella.h */, - 533B31BFC1F29651016A4CED40C41C45 /* IQKeyboardReturnManager.debug.xcconfig */, - A8E60BFFD4A191EDF1872BE7E0FAE073 /* IQKeyboardReturnManager.release.xcconfig */, - A1654FBEF2ACF2D1C0F1AE8EFAB0EF17 /* ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist */, - ); - name = "Support Files"; - path = "../Target Support Files/IQKeyboardReturnManager"; - sourceTree = ""; - }; - 033FC93B9EFE1CBEB43E1356F4387404 /* Support Files */ = { - isa = PBXGroup; - children = ( - 1290A656163D4189D4E745D4075B5FB9 /* IQTextInputViewNotification.modulemap */, - 7824F2A9F1A4882E8AC01FC525F509DA /* IQTextInputViewNotification-dummy.m */, - 2EA10FEDDCB666E266D7A6F366B18E70 /* IQTextInputViewNotification-Info.plist */, - DDABFE3773641DCA1393690ED61D8407 /* IQTextInputViewNotification-prefix.pch */, - ADB26D0335D3238C4C3CACC81077B951 /* IQTextInputViewNotification-umbrella.h */, - A5009A8DB6C64B30425E121DEC607B95 /* IQTextInputViewNotification.debug.xcconfig */, - 2161AA772A6755F4D5D60BD723919D3B /* IQTextInputViewNotification.release.xcconfig */, - AA518C79CF22771172370F62AF98D0ED /* ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist */, - ); - name = "Support Files"; - path = "../Target Support Files/IQTextInputViewNotification"; - sourceTree = ""; - }; - 03B91A177B2A7F65139A6D55296AAD68 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 3702B2DB8DB9F3674E7A72C7A38ED093 /* UMAPM.xcframework */, - ); - name = Frameworks; - sourceTree = ""; - }; 03C5C200A0787E300053CFA8F53CA094 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -1082,264 +1052,245 @@ name = Frameworks; sourceTree = ""; }; - 046B5F60AC34784A569BD49FA2092799 /* Resources */ = { + 04FDA7EB08893E90978EDA86E4F15024 /* IQKeyboardToolbar */ = { isa = PBXGroup; children = ( - 6E0BA3B04A92A056CAB8754E064C13C3 /* AMap.bundle */, + 83BE88F4AA11B51C3BC925D36E15C55B /* Core */, + 4D8D15BE86C6631EEBC53382A88B7043 /* Placeholderable */, + BC94656FB03B59B20DFF04A8C9C1C170 /* Resources */, + A4B90924C44E6B3D0B3AF91BE647EB2B /* Support Files */, + ); + name = IQKeyboardToolbar; + path = IQKeyboardToolbar; + sourceTree = ""; + }; + 1384110D481A014E1D91A25E7C544B95 /* Resources */ = { + isa = PBXGroup; + children = ( + 4CDA0B7868683A656CA1A57A373E2844 /* PrivacyInfo.xcprivacy */, ); name = Resources; sourceTree = ""; }; - 061787039B0BB942ED49998307180813 /* IQKeyboardToolbarManager */ = { + 1B38AC023F8FAD91C320BC949EB5D4BF /* Resources */ = { isa = PBXGroup; children = ( - B476FC7E116754954EC384BBE70ECF92 /* Array+Sort.swift */, - 9D8517105921669A50D907EA797E1636 /* IQDeepResponderContainerView.swift */, - 0B4EA2289D2B8316CE956FF2268D0114 /* IQKeyboardToolbarConfiguration.swift */, - 6AEC002400E17D448789C96C9A991A76 /* IQKeyboardToolbarConstants.swift */, - 346216373F9BE3698F9AEFCF076F23D2 /* IQKeyboardToolbarManager.swift */, - 7876059E50A29A0D55B20586DAFF3B7D /* IQKeyboardToolbarManager+Action.swift */, - 0FDC889F8FBF31BC6E149B59F01A74FC /* IQKeyboardToolbarManager+Debug.swift */, - 31D405B850F4246DA579A22B97251360 /* IQKeyboardToolbarManager+Deprecated.swift */, - 6753350B51E82A0FE23F430A0B57E601 /* IQKeyboardToolbarManager+Internal.swift */, - 73B4C7AD499AF7BCC14C3DC4248A326F /* IQKeyboardToolbarManager+Toolbar.swift */, - E3AC9204F4307F3CEE2EA7B4755F2BA3 /* UIView+Responders.swift */, - 3412D26E7AC83AF43C7017AB142B719D /* UIView+RespondersObjc.swift */, - BFCD941C9B7FCA2B37453EE02C274D7B /* Resources */, - 9F84599051C12EB2D8199BE4B9D266DA /* Support Files */, + E3532585B460CC985A9C1C9DAF3AEB1E /* PrivacyInfo.xcprivacy */, ); - name = IQKeyboardToolbarManager; - path = IQKeyboardToolbarManager; + name = Resources; sourceTree = ""; }; - 19A82AAA72ABA08948565E51B5A6FAFF /* IQKeyboardToolbarManager */ = { + 1CD1084BC0401D493658F56C10364EAF /* UMCommon */ = { isa = PBXGroup; children = ( - 992554533A232CEC66E7397532159E20 /* IQKeyboardManager+ToolbarManager.swift */, - 06A9F6948FD1CA41F3ACF9F3966A3888 /* IQKeyboardManager+ToolbarManagerDeprecated.swift */, + A222616F5C1CD6715F1F6E7461B83C43 /* Frameworks */, + 512BB483EC5CCE9E048394226E889566 /* Support Files */, + ); + name = UMCommon; + path = UMCommon; + sourceTree = ""; + }; + 23EE4A08AC63F1F7C781697CCFE9866B /* IQKeyboardToolbarManager */ = { + isa = PBXGroup; + children = ( + EA6FFAAA8D1615D51313B82AE95D7A0F /* IQKeyboardManager+ToolbarManager.swift */, + 73BC53E8C93DDB8078EB3832DF5645C3 /* IQKeyboardManager+ToolbarManagerDeprecated.swift */, ); name = IQKeyboardToolbarManager; sourceTree = ""; }; - 1A19E6EA7CBD3082142C640567987EEF /* Frameworks */ = { + 24A25D5D6B13853B408AF50746501B89 /* RealXBase */ = { isa = PBXGroup; children = ( - F743267069A8E822C12FD23476C2E60E /* UMDevice.xcframework */, + A1098BCB6F71B70A6EB9C68038D5392C /* Frameworks */, ); - name = Frameworks; + name = RealXBase; sourceTree = ""; }; - 1BC2084ADA79C87C7F4A950A3D56FBA9 /* Frameworks */ = { + 25F14707FC4FA354EEEDE4E0F5910477 /* IQTextView */ = { isa = PBXGroup; children = ( - DA603DEC8F9F9774A51A7EF0A9BB62EF /* jpush-ios-6.1.0.xcframework */, + 2432EF98C1780CB63645C2E5DFBC4FE9 /* IQTextView.swift */, + F0DAEBB9CD1A3D230D46015714723231 /* IQTextView+Placeholderable.swift */, + 2E788BFB93B8906F10376811DA4DCCC0 /* Resources */, + F3FC9C7122817D805F5B407370ED6502 /* Support Files */, ); - name = Frameworks; + name = IQTextView; + path = IQTextView; sourceTree = ""; }; - 23803FF45F499BC02ACD274D0BFAD8A3 /* AMapFoundation-NO-IDFA */ = { + 26A86FB29D5950F8AFD06DFAC9E4A33D /* Resources */ = { isa = PBXGroup; children = ( - 17275D4CF9F4D11ECE700DA0F9EFF0F8 /* AMapFoundationConst.h */, - 8EEE1F5B32FF5F35E4F7CC0F55C1B41F /* AMapFoundationKit.h */, - E1B42881A884188A8DF9EAE068A6DC08 /* AMapFoundationVersion.h */, - 70AF23D692EBDAA8E2E52376A065A97C /* AMapServices.h */, - F152C09480DA43D313458EDBFD5135BF /* AMapURLSearch.h */, - A1D1E63604F87F83BA8BFDF2B0C7720E /* AMapURLSearchConfig.h */, - 36FF598C0D9764E4AE87E840237BA75B /* AMapURLSearchType.h */, - 68C6374ADCD5FD0BC332791ABBCF4F8C /* AMapUtility.h */, - 4C36C86C10746A523F335B07252AB15B /* Frameworks */, - 5D535959721623B27BFBFCBD8C205228 /* Support Files */, + D195EE12A7242B6960BDA464D00CF39D /* PrivacyInfo.xcprivacy */, ); - name = "AMapFoundation-NO-IDFA"; - path = "AMapFoundation-NO-IDFA"; + name = Resources; sourceTree = ""; }; - 2769E7F9A97E798E66B995219246DE7C /* WechatOpenSDK-XCFramework */ = { + 2E788BFB93B8906F10376811DA4DCCC0 /* Resources */ = { isa = PBXGroup; children = ( - 6B922FE864036FD7498A87F5024F2058 /* Frameworks */, - F8464A5C3EF711FD122774272378CF6E /* Support Files */, + 2924FA1CCC272E301C4519279F9D672F /* PrivacyInfo.xcprivacy */, ); - name = "WechatOpenSDK-XCFramework"; - path = "WechatOpenSDK-XCFramework"; + name = Resources; sourceTree = ""; }; - 2A351BF15AB623714B51C163D98C32F2 /* JCore */ = { + 33C949C4C2EBFCEE69AF566B1C7A06BA /* AMap3DMap-NO-IDFA */ = { isa = PBXGroup; children = ( - D44D87B1FCB6B5D7887C6F110AE17293 /* Frameworks */, - 4ABB20388FB9EDFBC2110B905014059F /* Support Files */, - ); - name = JCore; - path = JCore; - sourceTree = ""; - }; - 30D785C6AB9C62FE21F5E25D6CF89F9E /* Core */ = { - isa = PBXGroup; - children = ( - D8ED740F9377F944E3895021F134AC68 /* IQBarButtonItem.swift */, - DD68AF4711DE3DCD592D096BC6577207 /* IQBarButtonItemConfiguration.swift */, - 34893074C574951651CAE0489239E848 /* IQInvocation.swift */, - 0AA33750C13A35FA4DFFEA7D3E1D6F71 /* IQKeyboardToolbar.swift */, - 4BEEC8D5C43F1F1BA28301F6F1167C87 /* IQKeyboardToolbarPlaceholderConfiguration.swift */, - 3583620D179FA09F78F1B6A29B53FD58 /* IQTitleBarButtonItem.swift */, - CDB04A2BDB7E068229CAF7A81165DD65 /* UIView+IQKeyboardExtension.swift */, - 7ED417277D89101687DEA83AAF66F65C /* UIView+IQKeyboardExtensionDeprecated.swift */, - AC0FF26EF54F0D2CCEEC60FB7E97B123 /* UIView+IQKeyboardExtensionObjc.swift */, - ); - name = Core; - sourceTree = ""; - }; - 3279BEDED0C91F18EADFB032DE492746 /* Support Files */ = { - isa = PBXGroup; - children = ( - B5A0A97D73FD94FDE81627BCEE94F1C4 /* IQKeyboardCore.modulemap */, - 24AB5750A05B063EA0DA3264D3001A19 /* IQKeyboardCore-dummy.m */, - 505941D186BD82B6E02B787E89B1C356 /* IQKeyboardCore-Info.plist */, - 53B577B7CE9C0F08BED5686A89801EE4 /* IQKeyboardCore-prefix.pch */, - 8B634D0C8582340A26DF881074996135 /* IQKeyboardCore-umbrella.h */, - 65E1594E46F076BA8A8528BF7CD2E5DB /* IQKeyboardCore.debug.xcconfig */, - D2B0169030016DBD87F970A973A138AD /* IQKeyboardCore.release.xcconfig */, - EF54B42FE0B021F5D3CDD98608D65DC8 /* ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist */, - ); - name = "Support Files"; - path = "../Target Support Files/IQKeyboardCore"; - sourceTree = ""; - }; - 3639459FE754ED7E623ABF3E8B9CEBD2 /* Placeholderable */ = { - isa = PBXGroup; - children = ( - BD5EDDC96EA8A526C228C3ABF1B82399 /* IQPlaceholderable.swift */, - ); - name = Placeholderable; - sourceTree = ""; - }; - 3A2168E47847B8483D459C9DE12A756D /* Support Files */ = { - isa = PBXGroup; - children = ( - C582DCBB25F9FD804B0DD31A72557820 /* IQKeyboardToolbar.modulemap */, - A528053628879455AB95D1D237A78AED /* IQKeyboardToolbar-dummy.m */, - DA27C00D82366242724F675C7E3A6BFD /* IQKeyboardToolbar-Info.plist */, - 1C5A9BF8CC34F207CD736C514BE4E7A9 /* IQKeyboardToolbar-prefix.pch */, - C93B314BF63192FFFEA853AD9BA8066A /* IQKeyboardToolbar-umbrella.h */, - 11B38E077C1F133396EB0CF305E0EF6B /* IQKeyboardToolbar.debug.xcconfig */, - E58F90C5C01D15A1D8477A2F76C55479 /* IQKeyboardToolbar.release.xcconfig */, - 6AE8EF33DA600DB0EFAC9BBD00770D02 /* ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist */, - ); - name = "Support Files"; - path = "../Target Support Files/IQKeyboardToolbar"; - sourceTree = ""; - }; - 3BFA6C7763308FF08A2BB58AACE9566E /* AMap3DMap-NO-IDFA */ = { - isa = PBXGroup; - children = ( - C615ED8173496D8C147DB28F59F9F67E /* MAAnimatedAnnotation.h */, - A9E48F379ACA8E9BCCAA467CA89ABF4A /* MAAnnotation.h */, - 3C48262702361091FBD5781B0F283DFE /* MAAnnotationMoveAnimation.h */, - 1E836A6EBA8DFB16F89B80B9E240181F /* MAAnnotationView.h */, - E8064F1ACE496CC1AE128FFDF32AF3E2 /* MAArc.h */, - 22FEBEF7276FDE9FC7112A3B40888E0D /* MAArcRenderer.h */, - 7E69BA4197634200C8605805B0C5F57A /* MABaseEngineOverlay.h */, - 3E834D9058B55541C3FD1368754163BD /* MABaseOverlay.h */, - 8BE9B5D6111FAF1BBAD248C3AFE07C26 /* MACircle.h */, - 8608C61CF8BA1D5CA044FF84821D9635 /* MACircleRenderer.h */, - FAE352943F84CF1F87B4462638AE8F18 /* MAConfig.h */, - 61334938998DD56FB7176AA67E7796CE /* MACustomBuildingOverlay.h */, - A55F0EA1CF98666CC54E6179EFEB3FEF /* MACustomBuildingOverlayRenderer.h */, - EBA5A2153A7B70835913DD6D1524E81E /* MACustomCalloutView.h */, - 8C3C1260F5F1828322AF349A37E45410 /* MAGeodesicPolyline.h */, - 606C5CFB2DD86DA601C36633BB6E9227 /* MAGeometry.h */, - 96A7CDFC8C50B2921E48D845688BD449 /* MAGroundOverlay.h */, - 8A4955BD2D6B837C1AFE332DC02F229B /* MAGroundOverlayRenderer.h */, - E6B0E1AAA5225E113179D3AC9F989DF5 /* MAHeatMapTileOverlay.h */, - BDB6452999256D2DF97D65A8AFE1FE44 /* MAHeatMapVectorGridOverlay.h */, - 1EE9BE36A9708049EB256766BA9BA1C7 /* MAHeatMapVectorGridOverlayRenderer.h */, - 569001181B8BE3D065C344C62500F175 /* MAHeatMapVectorOverlay.h */, - 02DA1675D3DF93B18F8927862A7FDA75 /* MAHeatMapVectorOverlayRender.h */, - 59FC7750B336D68DAD91386AFEBB3AEF /* MAIndoorInfo.h */, - EA5ECDD2101FE053DF1B8A46BB43772C /* MALineDrawType.h */, - F7237538405836409CB43509E3388D83 /* MAMapAccessibilityIdentifier.h */, - 1CCD1345A443E0DA94158F36DD898B5D /* MAMapCustomStyleOptions.h */, - E0F761FE0B098205EE12A869B3BB104B /* MAMapKit.h */, - E97A7F595151E2AD4F30897F4B748EA9 /* MAMapSnapshot.h */, - 45B6A705BCE14AB0BB965DAE2E740B34 /* MAMapStatus.h */, - 58653AFE6B358C639F97F8975BAB3FC7 /* MAMapVersion.h */, - 0765EFE771A4A4A2F0F58A914B4E21C2 /* MAMapView.h */, - A887BA5DD84AFB6405BA57323FCE8F0B /* MAMapView+Resource.h */, - 94A40C00F73E0E81F1EC934D99316B7C /* MAMultiColoredPolylineRenderer.h */, - 809AD13D76C4DBC1165D5E2F33B4A13A /* MAMultiPoint.h */, - D1086E217E4FD8CD9A1999C4CC605222 /* MAMultiPointOverlay.h */, - A6EA67538179CD91CD56FFCAD0626066 /* MAMultiPointOverlayRenderer.h */, - DFDC309A50F01E88696489F1677C3AA7 /* MAMultiPolyline.h */, - FF151EDD3DF75406929ACA6D262AA65C /* MAMultiTexturePolylineRenderer.h */, - CF87FBE2D4B19937F3E9A942696ECB5A /* MAMVTTileOverlay.h */, - FBCA526A0BEFD238489E9050C4B47CB7 /* MAMVTTileOverlayRenderer.h */, - 07D967A1100CF811A66390D51EB5A6E2 /* MAOfflineCity.h */, - 7D9F044857F251A31321EF21554EB709 /* MAOfflineItem.h */, - 205EB9340BF8698369EA925117E55975 /* MAOfflineItemCommonCity.h */, - 22A1064CD5D18DA7AED4D67EE50B28CF /* MAOfflineItemMunicipality.h */, - EF17C02FB5EDE9DC941DACEB1BF37A67 /* MAOfflineItemNationWide.h */, - F0E323C689432F05D4DCE1478FE98A38 /* MAOfflineMap.h */, - 713CC318C38869C97FB47759DA618B4B /* MAOfflineMapViewController.h */, - B3AE51D64EA8212082A2215BE56D852C /* MAOfflineProvince.h */, - 01ACB31CCA98A0BA58C407BB759CBD44 /* MAOverlay.h */, - F1EAE16DD95B4D774A7F33C84C92A987 /* MAOverlayPathRenderer.h */, - EAD4712612A5077FB71A6D13B7C6AB79 /* MAOverlayRenderer.h */, - FE9187432460BB6FE0DF674937D7E42E /* MAParticleOverlay.h */, - ED1ED4E7D70A14D1BD220D30119286E2 /* MAParticleOverlayOptions.h */, - 117548D53BE326B446EDB8C9CB64B68E /* MAParticleOverlayRenderer.h */, - 6E17159F496580E082DD42D59F547B39 /* MAPathShowRange.h */, - 5411F5B198CFD957C9CD536AB2D54AA5 /* MAPinAnnotationView.h */, - 582CAD303F8413036F3444028D850F4B /* MAPoiFilter.h */, - B8A46592E83A53CA8AB70662CB8DF906 /* MAPointAnnotation.h */, - 7DFF1E9E404B66479E1C8127D024F8A5 /* MAPolygon.h */, - 9CEDABC4D125BC75920E31F38A35A415 /* MAPolygonRenderer.h */, - 0A3628E425118DE571E2E1BE39F07123 /* MAPolyline.h */, - 2C0D83D64DA05F98461682B1107B1B4E /* MAPolylineRenderer.h */, - 21DDA7D033A7C2EC6807E087D05B8114 /* MARouteOverlay.h */, - 9E358C28D730461F823AA142E176EB0C /* MARouteOverlayModel.h */, - 86051726F35A59F1AD195C5B74BCB853 /* MAShape.h */, - 2E92D7304A8A78DAEF9943AB04A94116 /* MATerrainOverlay.h */, - 607850C8AE036A90433104E7F0697F47 /* MATerrainOverlayRenderer.h */, - 50F5A25E8047CF0286E9929854002827 /* MATileOverlay.h */, - 2C9513A9951DA3DCAB3F59B6DF22F7DE /* MATileOverlayRenderer.h */, - B8442EDA82E520DD01BEACF61F58E60E /* MATouchPoi.h */, - D702515773E3DF4969443386C85C55CD /* MATraceLocation.h */, - 4FEC114D3F1C5AE65CD441BD62650BB8 /* MATraceManager.h */, - CBE00B7180E351F1E2A6A92CC529B41F /* MAUserLocation.h */, - DA598BC1826B04340DCAC8EF685201E7 /* MAUserLocationRepresentation.h */, - EC0B71710DB35FB187FC61098A2EB88E /* Frameworks */, - 046B5F60AC34784A569BD49FA2092799 /* Resources */, - 56A3C18F21113D96E70BB6C6C8C070FC /* Support Files */, + C7F16FCE59EA776D68BCA96044AB643B /* MAAnimatedAnnotation.h */, + FB3211C8AD4603F8397DE7ED0479BDAD /* MAAnnotation.h */, + 43E338487B2FD0168DB6C36843190F0E /* MAAnnotationMoveAnimation.h */, + 78E5C4BC9F421F0030A47836705FE8C7 /* MAAnnotationView.h */, + AE545D7C7BC8717AD1293E91D09033F0 /* MAArc.h */, + 86B6AC948C427FB67A9A40BF124DA621 /* MAArcRenderer.h */, + 2EC7A621AB8CB362644A06190DB1224A /* MABaseEngineOverlay.h */, + 5881F9C9310C4D9AFCE6C492C453F4E7 /* MABaseOverlay.h */, + 7067197E3E18A6472D83E1BF20A2DF39 /* MACircle.h */, + 659D0CF1C22A308AA4BBC12C690EFF76 /* MACircleRenderer.h */, + B8476A96BE982F855EDE7EECC0AC906F /* MAConfig.h */, + 3EE1C67A22E73C71C54EF9A0E5E98061 /* MACustomBuildingOverlay.h */, + 74C0A97F8A621324A3DABEF21272551D /* MACustomBuildingOverlayRenderer.h */, + 7055CF7462CB8E3DDB9CB84914F0D047 /* MACustomCalloutView.h */, + 6899E9B61D97F7A88D1AE73011313A21 /* MAGeodesicPolyline.h */, + CCBC3902C2DD89F6B74BFE08F7A9DC48 /* MAGeometry.h */, + E8E9C7FCBB1628F0AF444C2DB616C938 /* MAGroundOverlay.h */, + 233D93E73EE1D7FDB94D7B4E60B2F3E8 /* MAGroundOverlayRenderer.h */, + BD88BA8FC4CDC4CDF011EE41273240C1 /* MAHeatMapTileOverlay.h */, + 7E638915ECBDA2C39BDCFBACBDC0E28C /* MAHeatMapVectorGridOverlay.h */, + 47B29EC516D4DA9C641873A4E761DC16 /* MAHeatMapVectorGridOverlayRenderer.h */, + AEFD6F12ED3038D1F73D5ECBCA0A3CBF /* MAHeatMapVectorOverlay.h */, + 40CABFE86EA5475F61478E0125A87C7B /* MAHeatMapVectorOverlayRender.h */, + 0911AE053F5B9AE721FE34FCF6FF62F3 /* MAIndoorInfo.h */, + 72F8FB18750917203BE32320D47C16AB /* MALineDrawType.h */, + 24DA51F3F8BD4C7A91DADAC0C0F62284 /* MAMapAccessibilityIdentifier.h */, + C0BCD3AF604048516EAC8913C6A01273 /* MAMapCustomStyleOptions.h */, + 140C24CF94B74B365353785AAD7781FE /* MAMapKit.h */, + 684810A159CC0F5F54EC89B87AC327C8 /* MAMapSnapshot.h */, + 57412EC3570F1A67F503074046DFE7F5 /* MAMapStatus.h */, + 00D14718B29FD331A2247C81252659BE /* MAMapVersion.h */, + 80B97563DD9EE42FB83F21CD7ECA8893 /* MAMapView.h */, + 707DA09A7E71877897FA79B5D0851453 /* MAMapView+Resource.h */, + 989E962A812F16459AFDEE6C7D323409 /* MAMultiColoredPolylineRenderer.h */, + C6E5D9D64B6AABE6937DCEA19B46DD79 /* MAMultiPoint.h */, + 22707E06938D36978342F7E04FBA3E33 /* MAMultiPointOverlay.h */, + C8D6630F56DE8A616BF4AF6A3E8FB586 /* MAMultiPointOverlayRenderer.h */, + 92531E37878C3A0E7B0535022EED3DFD /* MAMultiPolyline.h */, + 562049081AA7BA85836F65F0154A41E8 /* MAMultiTexturePolylineRenderer.h */, + 0E768B108DBA5CC9149342EFAC582F86 /* MAMVTTileOverlay.h */, + 0EBDD9D77C00C1B6B42EF06289ED81E6 /* MAMVTTileOverlayRenderer.h */, + B46217D14293E54C73A85F1BD3301FE8 /* MAOfflineCity.h */, + 90CEB809A08ADDFF65DE3E2CE6210120 /* MAOfflineItem.h */, + 721D4CFBC2A333A24E9AFFB201CFE629 /* MAOfflineItemCommonCity.h */, + 0016DB9B9376D3CEDD92C0E35129967E /* MAOfflineItemMunicipality.h */, + 9DE3CDAB45445DD7086D7CDC6F864A8D /* MAOfflineItemNationWide.h */, + 6B197BD93E8C7BDB71A2A0DDB792C0AE /* MAOfflineMap.h */, + B2CF147BDD9EF2098912F69A7BFF89DD /* MAOfflineMapViewController.h */, + CD4FE136E9A99BAE0FA8EBFC4AC80FB4 /* MAOfflineProvince.h */, + A8573CC4CF72940E255AF095FEA84D0E /* MAOverlay.h */, + 327DFA2871C3DF1F35DF6522BE6D856C /* MAOverlayPathRenderer.h */, + 643D01EDC860F2BAF98169C2F246AC5C /* MAOverlayRenderer.h */, + CE4AE66CE966DE231E272316E63E53EC /* MAParticleOverlay.h */, + F7E22135559ACE352548CFD9ABB79BCA /* MAParticleOverlayOptions.h */, + 3588749BFDB1A89C82B482E9E8C96622 /* MAParticleOverlayRenderer.h */, + F38BAFEE9D73F8D4DC3463EC036ABE11 /* MAPathShowRange.h */, + 7F9148481791CA6ACA5381910B5FD141 /* MAPinAnnotationView.h */, + 196A9E4648F826867018FBE76BE4A27B /* MAPoiFilter.h */, + 6B653B098FA73A44AE03CCB910AE8FBA /* MAPointAnnotation.h */, + 30B0F6201C301BB01F37EE64F61B9983 /* MAPolygon.h */, + E539D0B30D08031698030A03892FF590 /* MAPolygonRenderer.h */, + 5882792FE746E1E359A5AD3DB4483351 /* MAPolyline.h */, + 38EBFCECEDF6B0177C19F36F20D9615F /* MAPolylineRenderer.h */, + 6E3056FA5A7491EB6B9168F4DCB89CF8 /* MARouteOverlay.h */, + 6243BFD239C17E85134CCB10FE9FAAC0 /* MARouteOverlayModel.h */, + 2A1AAD1937CC0190BBCE194ABF7D67AF /* MAShape.h */, + 0F117F7702A857584C6E59BA2AEDDB42 /* MATerrainOverlay.h */, + C286CE80B5550AF484AF054CFE65DE2C /* MATerrainOverlayRenderer.h */, + 69916FBCA731F366F9F2550E789E9D24 /* MATileOverlay.h */, + 2A0D3A9B9B1F461CCBB987BF6A148FF6 /* MATileOverlayRenderer.h */, + 61E7B525F895021509512D66E237C998 /* MATouchPoi.h */, + 5596FE4C18E829ADBEECC5ACDF02EB31 /* MATraceLocation.h */, + 9614779050BB3EBD1097F039DEADD27B /* MATraceManager.h */, + 24B3915A78364E56EEE3E8AF146F6C8D /* MAUserLocation.h */, + 932F8EAA35C1D5F87D138C4006A1815F /* MAUserLocationRepresentation.h */, + 4E773E245980E1ADEEBCABB098C04341 /* Frameworks */, + CFF64AB64E21524BF6A3019033D79E16 /* Resources */, + A2F6C398C06E89855411D63D0058B318 /* Support Files */, ); name = "AMap3DMap-NO-IDFA"; path = "AMap3DMap-NO-IDFA"; sourceTree = ""; }; - 3D18EA5122DA11E42DE9B7B0E71E3BE4 /* IQKeyboardCore */ = { + 39B81D6F9310BF4E5AEB58CD0AC74A1A /* AMapSearch-NO-IDFA */ = { isa = PBXGroup; children = ( - D4ADD25EEB716A656CC0DBEDCC9790D4 /* IQKeyboardConstants.swift */, - CA76A2A5EC61CC8B474C1A4551226332 /* IQKeyboardExtended.swift */, - 7E0A31927D7E41BFDD984506DC0F5E99 /* IQTextInputView.swift */, - E5F0A37891F1A7765B99C903153C0945 /* UIView+Hierarchy.swift */, - E42F6AA6B0BF64809371E39FF768BC7B /* Resources */, - 3279BEDED0C91F18EADFB032DE492746 /* Support Files */, + 1AC5BFA4C48724D90AA9C4DAB900E68B /* AMapCommonObj.h */, + 7035E4745377EBEB3C787811A19BCC0E /* AMapNearbySearchManager.h */, + 0CF2374471C2CEEC69E3FE0C9071A9D1 /* AMapNearbyUploadInfo.h */, + D2442DAFEEABF11200E680955456504F /* AMapSearchAPI.h */, + EFB63127C0E518CF38404A5A50137D63 /* AMapSearchError.h */, + 316ECFAE87C43CE3088F25F6FC8EF85F /* AMapSearchKit.h */, + 1677B1509CB109DB8CF29FB1D829AB16 /* AMapSearchObj.h */, + 91EDAEAA8F13DC15EFC4DADC6261AD21 /* AMapSearchObjV1.h */, + 9FE8BDE8B3028D4046E3ADFF6D71C2A4 /* AMapSearchVersion.h */, + 9BEA03AC0C1F5ACA6FF8438E65F34DA8 /* Frameworks */, + F448F353060513B50DC243E33071B811 /* Support Files */, ); - name = IQKeyboardCore; - path = IQKeyboardCore; + name = "AMapSearch-NO-IDFA"; + path = "AMapSearch-NO-IDFA"; sourceTree = ""; }; - 4ABB20388FB9EDFBC2110B905014059F /* Support Files */ = { + 3B1DACEA4B3325B4D89017569A1A2DCA /* IQKeyboardNotification */ = { isa = PBXGroup; children = ( - 6AE1DF2DC452D2788B6E2B8392A48BF1 /* JCore-xcframeworks.sh */, - 9F44C0F5A31C9EFE79B6821581FC6A90 /* JCore.debug.xcconfig */, - FA43AA432E51DD3E160CB45F75EDD874 /* JCore.release.xcconfig */, + E8B9584100C63E03D75F12EF28FE46D8 /* IQKeyboardInfo.swift */, + 209A273DFA6CB48721E810D588DFD907 /* IQKeyboardNotification.swift */, + 26A86FB29D5950F8AFD06DFAC9E4A33D /* Resources */, + EC4A02C8266D539615F8281A0713BA97 /* Support Files */, + ); + name = IQKeyboardNotification; + path = IQKeyboardNotification; + sourceTree = ""; + }; + 3B7BDC01C4C090C1F173641FAEC38477 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C73BB9F448E56B49D4F5FE5D9987B78F /* UMAPM.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4481CD82F037CAA82956AE0E2E47296E /* IQKeyboardManagerSwift */ = { + isa = PBXGroup; + children = ( + E114BC63459388CB2BFA23BF31BC1C71 /* Appearance */, + 74F707122E3E56EC209B54F1E9DB8024 /* Core */, + 23EE4A08AC63F1F7C781697CCFE9866B /* IQKeyboardToolbarManager */, + 6470B48A24923618B41FFB02D5BB253D /* Resign */, + AE79D9ABAE2FCE9F97081CF644AFBD3A /* Resources */, + 4DBE268BEA100724C87C063F3F82428B /* Support Files */, + ); + name = IQKeyboardManagerSwift; + path = IQKeyboardManagerSwift; + sourceTree = ""; + }; + 44BBB4BB04DA5469FD443584AABA8779 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5629E0F117BEA473144E2420C84A1A0D /* AMapFoundationKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 46D541F82C815DFC6AAB662C924A819D /* Support Files */ = { + isa = PBXGroup; + children = ( + 655D6F4504BA9F7B8E38F5DF66CEDA16 /* UMDevice-xcframeworks.sh */, + B184A8220FD8F49AFB9FA1C67C8F4085 /* UMDevice.debug.xcconfig */, + D4441EC6FD7E6501CD6A029CC5547EB7 /* UMDevice.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/JCore"; + path = "../Target Support Files/UMDevice"; sourceTree = ""; }; 4AEBC9A0614C37290E19500398FB7CD9 /* Pods-suixinkan */ = { @@ -1361,73 +1312,75 @@ path = "Target Support Files/Pods-suixinkan"; sourceTree = ""; }; - 4C0F533B7756B11ECC262D9FFAF51282 /* UMAPM */ = { + 4D8D15BE86C6631EEBC53382A88B7043 /* Placeholderable */ = { isa = PBXGroup; children = ( - 03B91A177B2A7F65139A6D55296AAD68 /* Frameworks */, - C46A5FACF107BDA2938FF9CD084FFDA3 /* Support Files */, + 265515AE6516C3B325D5961DCA814A4A /* IQPlaceholderable.swift */, ); - name = UMAPM; - path = UMAPM; + name = Placeholderable; sourceTree = ""; }; - 4C36C86C10746A523F335B07252AB15B /* Frameworks */ = { + 4DBE268BEA100724C87C063F3F82428B /* Support Files */ = { isa = PBXGroup; children = ( - 50EEC35FAFA65B05F310CBA561C28927 /* AMapFoundationKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 4E8E1335F09602994B3CF0038FDF0547 /* Resources */ = { - isa = PBXGroup; - children = ( - 9517DFB02CF19FA4C175500597CC473D /* PrivacyInfo.xcprivacy */, - ); - name = Resources; - sourceTree = ""; - }; - 515F2E1A8214FBE2EDBA85B04C9F6A62 /* Support Files */ = { - isa = PBXGroup; - children = ( - 2C2A760C8FC191090821FFA8F92D1BA6 /* IQKeyboardManagerSwift.modulemap */, - 72047D59C9D0EA03C1447E76203105F5 /* IQKeyboardManagerSwift-dummy.m */, - 51E60014F4AFF046CCAEFB326E631B53 /* IQKeyboardManagerSwift-Info.plist */, - B79499F18F5215A6EF9F0698F1427102 /* IQKeyboardManagerSwift-prefix.pch */, - 4D43C0E4C0ABC428E9D5A5AE717B658E /* IQKeyboardManagerSwift-umbrella.h */, - 47A354AE76F39CD50DF8DE8D5F744498 /* IQKeyboardManagerSwift.debug.xcconfig */, - BDDEE926B156A69E8B915347853ECEC5 /* IQKeyboardManagerSwift.release.xcconfig */, - 0DE500824E8236FB34E7FC4EDF80F03E /* ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist */, + 95839D8D8B2F23293EBF04B5730EA40E /* IQKeyboardManagerSwift.modulemap */, + 7F68AAFC87ADF8F019EE78C7BC767213 /* IQKeyboardManagerSwift-dummy.m */, + 8B6BEA1893E1C03156815824B5025A47 /* IQKeyboardManagerSwift-Info.plist */, + 5D0EF49E78A574D04EBCC72388BC9337 /* IQKeyboardManagerSwift-prefix.pch */, + 1E8C6E85CBE09A894E15473B2ACFF25F /* IQKeyboardManagerSwift-umbrella.h */, + 9931FEC2838C55EB9415330553D7C98B /* IQKeyboardManagerSwift.debug.xcconfig */, + FF1A51684BE9AD249695A507E8AE84BF /* IQKeyboardManagerSwift.release.xcconfig */, + 66BB860BB0ACF1B74DF2E0C0EC1BFF82 /* ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist */, ); name = "Support Files"; path = "../Target Support Files/IQKeyboardManagerSwift"; sourceTree = ""; }; - 520CDF7916D7BB0DFCBC420F6DB50D65 /* Pods */ = { + 4E773E245980E1ADEEBCABB098C04341 /* Frameworks */ = { isa = PBXGroup; children = ( - 3BFA6C7763308FF08A2BB58AACE9566E /* AMap3DMap-NO-IDFA */, - 23803FF45F499BC02ACD274D0BFAD8A3 /* AMapFoundation-NO-IDFA */, - 732F454E93A867365204D496FC6DF594 /* AMapLocation-NO-IDFA */, - 60F7E1FF3DDFF744C607AE341E94AB06 /* AMapSearch-NO-IDFA */, - 3D18EA5122DA11E42DE9B7B0E71E3BE4 /* IQKeyboardCore */, - 602E5681C7D3C9F2F8F9C479CBF09336 /* IQKeyboardManagerSwift */, - EB8B5B05F9AEE6EF38E78653B5A1AB95 /* IQKeyboardNotification */, - AB638B82CB2671C730E5541D1EF6C548 /* IQKeyboardReturnManager */, - 8B7D83B1AAA915E59ABF028B30082FE4 /* IQKeyboardToolbar */, - 061787039B0BB942ED49998307180813 /* IQKeyboardToolbarManager */, - CC0A28B4F081AD9BFEA173D4C3BAF653 /* IQTextInputViewNotification */, - 554E29F7253AB34E1FD096B6960ACD1F /* IQTextView */, - 2A351BF15AB623714B51C163D98C32F2 /* JCore */, - B7DD817AF7478DD1DAF2BF4F87698BAE /* JPush */, - 4C0F533B7756B11ECC262D9FFAF51282 /* UMAPM */, - 589E6061BECBD4714048A400F55721D1 /* UMCommon */, - AD3949A7EC8E24D927D4905755B04D6D /* UMDevice */, - 2769E7F9A97E798E66B995219246DE7C /* WechatOpenSDK-XCFramework */, + 3FBF7D60272DE7F04F608847182770D1 /* MAMapKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4E8E73B0D95B9DF2DC613CF17FF94B61 /* Pods */ = { + isa = PBXGroup; + children = ( + 33C949C4C2EBFCEE69AF566B1C7A06BA /* AMap3DMap-NO-IDFA */, + 94AF0C1BF0637DE33C600A905B325AB0 /* AMapFoundation-NO-IDFA */, + A5195BD59A9DB6B60F1C27DC83714934 /* AMapLocation-NO-IDFA */, + 39B81D6F9310BF4E5AEB58CD0AC74A1A /* AMapSearch-NO-IDFA */, + B1078AE2E0BB31006606E09592168E39 /* IQKeyboardCore */, + 4481CD82F037CAA82956AE0E2E47296E /* IQKeyboardManagerSwift */, + 3B1DACEA4B3325B4D89017569A1A2DCA /* IQKeyboardNotification */, + E28CA03D952064FA8670CE57935D6253 /* IQKeyboardReturnManager */, + 04FDA7EB08893E90978EDA86E4F15024 /* IQKeyboardToolbar */, + E6CEF6838EE3006B0B001A0232541FC0 /* IQKeyboardToolbarManager */, + F5FCBF2314B4EB54739C2EF1B8A759B2 /* IQTextInputViewNotification */, + 25F14707FC4FA354EEEDE4E0F5910477 /* IQTextView */, + A0E6B48D23FB3AD594F90D1F242CF9AF /* JCore */, + 74FD86EEC758F5FA311C5373BEB086C0 /* JPush */, + CF4C1B7D1FAE518ABBF0AEF896CA488C /* UMAPM */, + 1CD1084BC0401D493658F56C10364EAF /* UMCommon */, + C5E0B71C1457F39AFA957A7F262C41C2 /* UMDevice */, + 559C377468C97D04B3B5D5CE96F4B224 /* VolcEngineRTC */, + B54B9468033BE23DAF5556C34EDE63F8 /* WechatOpenSDK-XCFramework */, ); name = Pods; sourceTree = ""; }; + 512BB483EC5CCE9E048394226E889566 /* Support Files */ = { + isa = PBXGroup; + children = ( + D7ACFC49738FF4F612D385219B5A5498 /* UMCommon-xcframeworks.sh */, + 0C5373D6FEC052390EF0155BC139DA74 /* UMCommon.debug.xcconfig */, + 83448C8FCF4765056F1A35E450B655E6 /* UMCommon.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/UMCommon"; + sourceTree = ""; + }; 5537570973B02316996F087DD3C28666 /* Pods-suixinkanTests */ = { isa = PBXGroup; children = ( @@ -1445,146 +1398,101 @@ path = "Target Support Files/Pods-suixinkanTests"; sourceTree = ""; }; - 554E29F7253AB34E1FD096B6960ACD1F /* IQTextView */ = { + 559C377468C97D04B3B5D5CE96F4B224 /* VolcEngineRTC */ = { isa = PBXGroup; children = ( - 097E3C45E430629A425D0B19A2A6E19C /* IQTextView.swift */, - 603C9655C429A8AFD3A2ABB90354F0D3 /* IQTextView+Placeholderable.swift */, - 9B0F3E052867A07902A6A2420D5485CE /* Resources */, - E53E71F1F1B8EDB0D00DCF8007422754 /* Support Files */, + 5BC5D4592AAAE4E3A19157C7AB191343 /* Core */, + 24A25D5D6B13853B408AF50746501B89 /* RealXBase */, + FE36BBF38DDAF33E23DD5465F236060F /* RTCFFmpeg */, + BD899D6BCB72FF24A2657897234D0E11 /* Support Files */, ); - name = IQTextView; - path = IQTextView; + name = VolcEngineRTC; + path = VolcEngineRTC; sourceTree = ""; }; - 56A3C18F21113D96E70BB6C6C8C070FC /* Support Files */ = { + 5B3C0813D128A45E751A0AC71DA3C895 /* Frameworks */ = { isa = PBXGroup; children = ( - C7C310CD68DF209957D60358329E9D5B /* AMap3DMap-NO-IDFA.debug.xcconfig */, - 649233ED6CEAD11508C3FEC87609ADF7 /* AMap3DMap-NO-IDFA.release.xcconfig */, + 391A9DEE79A34E4C8E57A0B9707F02BA /* jcore-noidfa-ios-5.4.2.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5BC5D4592AAAE4E3A19157C7AB191343 /* Core */ = { + isa = PBXGroup; + children = ( + B3031E0D8DC315A2A4B0FA287EC402DC /* Frameworks */, + ); + name = Core; + sourceTree = ""; + }; + 6470B48A24923618B41FFB02D5BB253D /* Resign */ = { + isa = PBXGroup; + children = ( + 69234E4D1FF97AA77BC3546B03B96407 /* IQKeyboardManager+Resign.swift */, + 10A4A0EAA84E9607D6E867137638C0B7 /* IQKeyboardManager+Resign_Deprecated.swift */, + 6FA0B342A73D28669E2FA554F3636EDD /* IQKeyboardResignHandler.swift */, + 236F47C2E0820E91686A2967CD6F760F /* IQKeyboardResignHandler+Internal.swift */, + A389B2EDC5D1D81EF043A12391638BC1 /* UIView+Resign.swift */, + 672521CE7AABAB88CAC5DA46DE3917EE /* UIView+ResignObjc.swift */, + ); + name = Resign; + sourceTree = ""; + }; + 71246DF8BFC3526B5A8702F8FE003278 /* Support Files */ = { + isa = PBXGroup; + children = ( + 0D48DDB2B1DA7335575EE4951A7C50B5 /* WechatOpenSDK-XCFramework-xcframeworks.sh */, + A3ADF11FAEAC8F80DA91E2D23F4F5C48 /* WechatOpenSDK-XCFramework.debug.xcconfig */, + C2A0B423670E836CA2EA43C41CB19811 /* WechatOpenSDK-XCFramework.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/AMap3DMap-NO-IDFA"; + path = "../Target Support Files/WechatOpenSDK-XCFramework"; sourceTree = ""; }; - 589E6061BECBD4714048A400F55721D1 /* UMCommon */ = { + 71C7E423D3DEDE0819495B345A994FE5 /* Support Files */ = { isa = PBXGroup; children = ( - ACC27663C7D4373253B19FC29790ED5A /* Frameworks */, - 6A53867946ADBB60562D9EF2FFE2AAA7 /* Support Files */, - ); - name = UMCommon; - path = UMCommon; - sourceTree = ""; - }; - 59B51CCB97227B7CE340DCEBED7AA228 /* Resources */ = { - isa = PBXGroup; - children = ( - BC217F78CA99FD3D41A3303B824C278D /* PrivacyInfo.xcprivacy */, - ); - name = Resources; - sourceTree = ""; - }; - 5CCC928438331C779735013E7CEC4C1E /* Appearance */ = { - isa = PBXGroup; - children = ( - 095CB762599A53A99A9ACC8DBC8C0591 /* IQKeyboardAppearanceConfiguration.swift */, - 73F4A4C2EB0A4E49EC7BFE3DACD2CCD5 /* IQKeyboardAppearanceManager.swift */, - D8ABCFBB8BDD11CFBF49406BF0165A41 /* IQKeyboardAppearanceManager+Internal.swift */, - 407749166D56AC58042E7F89FDD486AD /* IQKeyboardManager+Appearance.swift */, - FC4A4ED3AA953F5ADE3FA7EC8F671377 /* IQKeyboardManager+Appearance_Deprecated.swift */, - ); - name = Appearance; - sourceTree = ""; - }; - 5D535959721623B27BFBFCBD8C205228 /* Support Files */ = { - isa = PBXGroup; - children = ( - 1D1E7E265254C8003D8A5F7C75B7B539 /* AMapFoundation-NO-IDFA.debug.xcconfig */, - 357507030049F8711B5F2560C8BE96B0 /* AMapFoundation-NO-IDFA.release.xcconfig */, + 99E675068425C5A9A5145CD79E3BCA08 /* AMapFoundation-NO-IDFA.debug.xcconfig */, + 9B64B38CCC51FEC6E0F64ABFCE0D6BFF /* AMapFoundation-NO-IDFA.release.xcconfig */, ); name = "Support Files"; path = "../Target Support Files/AMapFoundation-NO-IDFA"; sourceTree = ""; }; - 602E5681C7D3C9F2F8F9C479CBF09336 /* IQKeyboardManagerSwift */ = { + 74F707122E3E56EC209B54F1E9DB8024 /* Core */ = { isa = PBXGroup; children = ( - 5CCC928438331C779735013E7CEC4C1E /* Appearance */, - 8B01AA97E6DC3D5A0DE5696F64B7A21D /* Core */, - 19A82AAA72ABA08948565E51B5A6FAFF /* IQKeyboardToolbarManager */, - 00BDB8452B08527967D9BF4BCE67160E /* Resign */, - BD856CC8714F0E23D04C54D8E567B534 /* Resources */, - 515F2E1A8214FBE2EDBA85B04C9F6A62 /* Support Files */, + 5DD839E94220ED93D5D56D7325ACB4AF /* IQActiveConfiguration.swift */, + C5AD54145A409C1D7C94875810471BF1 /* IQKeyboardManager.swift */, + 6638AB504D084AEDF76BD13D6B411686 /* IQKeyboardManager+ActiveConfiguration.swift */, + 4C97F1279DE48FCF5536191CB5FDC744 /* IQKeyboardManager+Debug.swift */, + 7E9328F77C695432E06E224ECFC6F118 /* IQKeyboardManager+Deprecated.swift */, + 32A64F71DA55AE99B5E87755F8EB43D9 /* IQKeyboardManager+Internal.swift */, + C8BC74EE1659FD64F176CD4BE256AF84 /* IQKeyboardManager+Position.swift */, + D054D25DFF58C86E7DD00309158A9533 /* IQRootControllerConfiguration.swift */, + 10C3C8E54ECDED1E0C05111FCCEBE7BD /* IQScrollViewConfiguration.swift */, + 6B2DC97D0BB8EBFBE037BB8888E5152A /* UICollectionView+IndexPaths.swift */, + C2C181E4F940F09E297591DA565280F7 /* UIScrollView+IQKeyboardManagerExtension.swift */, + 19730C7CF0F446CA5D115BD82BD2903E /* UIScrollView+IQKeyboardManagerExtensionObjc.swift */, + 22DE40CC56B3E094BCE71F0843177D6C /* UITableView+IndexPaths.swift */, + 301B8B14D78023F3DD043BCBFC93130A /* UIView+IQKeyboardManagerExtension.swift */, + CFDC64AA2A98DF6AB638AEDFE148C722 /* UIView+IQKeyboardManagerExtensionObjc.swift */, + A3B92976C10CBB84DC9EF347BDFC60CF /* UIView+Parent.swift */, + E1B75F1D0D65299E5DC583CECA54FDAA /* UIView+ParentObjc.swift */, + F3DCEB6C2B197ABE227932FEA2419037 /* UIViewController+ParentContainer.swift */, ); - name = IQKeyboardManagerSwift; - path = IQKeyboardManagerSwift; + name = Core; sourceTree = ""; }; - 60F7E1FF3DDFF744C607AE341E94AB06 /* AMapSearch-NO-IDFA */ = { + 74FD86EEC758F5FA311C5373BEB086C0 /* JPush */ = { isa = PBXGroup; children = ( - 50E0F97385361B4BF66AEF8C2A910F32 /* AMapCommonObj.h */, - 10A7112588A375D793E11F0EB0414C81 /* AMapNearbySearchManager.h */, - 7BE8D3F5CFB6098660E108950BB18879 /* AMapNearbyUploadInfo.h */, - 5F800AC82DC0EBE287853A0A0FB4F5DF /* AMapSearchAPI.h */, - AAF4093F21688BF793E97C7EC0C3C48D /* AMapSearchError.h */, - D376C98F66AE428B2165D3BFCA6CBB0A /* AMapSearchKit.h */, - 6EFF2F85A43C79FF157025B650597669 /* AMapSearchObj.h */, - 2CEB1C0CC7AB3CE014A9DE0963476264 /* AMapSearchObjV1.h */, - F4484DFD00A30223AFF26316F14A2723 /* AMapSearchVersion.h */, - 8EC70130CB3BEBE4354C699B81C8B53B /* Frameworks */, - 6681DC5D6F3E43859A692790D12D2FB4 /* Support Files */, + 8CF7280B91CC791C8414A4F10087597B /* Frameworks */, + B86E9C7076669987F4E23893F9B76308 /* Support Files */, ); - name = "AMapSearch-NO-IDFA"; - path = "AMapSearch-NO-IDFA"; - sourceTree = ""; - }; - 6681DC5D6F3E43859A692790D12D2FB4 /* Support Files */ = { - isa = PBXGroup; - children = ( - 30B02A6B0D6954EF43EFA3789887E608 /* AMapSearch-NO-IDFA.debug.xcconfig */, - 3AAAF0891AEED7CA4AF20AE95070E340 /* AMapSearch-NO-IDFA.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/AMapSearch-NO-IDFA"; - sourceTree = ""; - }; - 6A53867946ADBB60562D9EF2FFE2AAA7 /* Support Files */ = { - isa = PBXGroup; - children = ( - A5CAB9A0AF5C7D79C41E91058465C241 /* UMCommon-xcframeworks.sh */, - E64981F07E6AF8250D37F4D1295891B8 /* UMCommon.debug.xcconfig */, - 3F8A7B40939E68E709158AA51CF7B536 /* UMCommon.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/UMCommon"; - sourceTree = ""; - }; - 6B922FE864036FD7498A87F5024F2058 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 4BA1B67A9D955479AE8767AECFC1C544 /* WechatOpenSDK.xcframework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 732F454E93A867365204D496FC6DF594 /* AMapLocation-NO-IDFA */ = { - isa = PBXGroup; - children = ( - E5AEDD7F9FD976DFFF047A8BF9EEC6CC /* AMapGeoFenceError.h */, - 95A231D1CAE57B03E3B3AAE66310ABC0 /* AMapGeoFenceManager.h */, - 33005A729F5C775737278F40CCD77F9B /* AMapGeoFenceRegionObj.h */, - CD831F6743DBA4A24C9265372979449E /* AMapLocationCommonObj.h */, - 98A819F75A0DF55BD766887A9A43232E /* AMapLocationKit.h */, - 8CC78E637C86F7BC30C4C3A669049F79 /* AMapLocationManager.h */, - C73A65DB570592414ACDAAF9091E3EEF /* AMapLocationRegionObj.h */, - E78E48748C5DEEFFFD6E4469DA5EA2C1 /* AMapLocationVersion.h */, - EFC04CD4102AE37AED7A86B65EF1E60B /* Frameworks */, - 8C2BE863706DEF05145526386F0B68C5 /* Support Files */, - ); - name = "AMapLocation-NO-IDFA"; - path = "AMapLocation-NO-IDFA"; + name = JPush; + path = JPush; sourceTree = ""; }; 7693C00AD1B9CA6AD0EFB3FCC3C6CAEC /* iOS */ = { @@ -1597,129 +1505,138 @@ name = iOS; sourceTree = ""; }; - 77C012E3A227F889C3968E3ECD2C2F62 /* Support Files */ = { + 830D7654D3140A352D11F1AF914053BA /* Support Files */ = { isa = PBXGroup; children = ( - 36978964993FE13960686DDDD546D75B /* UMDevice-xcframeworks.sh */, - A3CDCD8BAD4E220D8D74F8D8D6DE8034 /* UMDevice.debug.xcconfig */, - DFE51D2405E1E217F50AA3BA1213B3AD /* UMDevice.release.xcconfig */, + 3F86ED90539606ECEE24AB70887270E4 /* IQKeyboardCore.modulemap */, + C800E6213B65C17D9D650EFBA167370D /* IQKeyboardCore-dummy.m */, + 29CA1DFA0D80C1F474279442203CFED1 /* IQKeyboardCore-Info.plist */, + E0AC776726C388E12EFB4BFD36A72AB6 /* IQKeyboardCore-prefix.pch */, + D4F22BBAC26D59FA533BC3E2D6249904 /* IQKeyboardCore-umbrella.h */, + C22127072FC804B46594EFEEA2162330 /* IQKeyboardCore.debug.xcconfig */, + 7CE0E04517BD2363A893C1E85B4B248F /* IQKeyboardCore.release.xcconfig */, + AED971CC449F4593B117886F944152E7 /* ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist */, ); name = "Support Files"; - path = "../Target Support Files/UMDevice"; + path = "../Target Support Files/IQKeyboardCore"; sourceTree = ""; }; - 7C4781364ADF28BE6A5FD0B6A4417EFD /* Resources */ = { + 83BE88F4AA11B51C3BC925D36E15C55B /* Core */ = { isa = PBXGroup; children = ( - A372E26A2A397D202C662C0FD912FCA2 /* PrivacyInfo.xcprivacy */, - ); - name = Resources; - sourceTree = ""; - }; - 81644849A152D1E3F1A626F9045C756E /* Support Files */ = { - isa = PBXGroup; - children = ( - 69121CFF53D9CEC42CE44CF34F36F7B5 /* IQKeyboardNotification.modulemap */, - 7F8DC7287225EB89CFFDCA5DD231B629 /* IQKeyboardNotification-dummy.m */, - F3B8F6CD0697840F54110DE73B4B45D2 /* IQKeyboardNotification-Info.plist */, - F567609174F5904AE6D76ECD374854A6 /* IQKeyboardNotification-prefix.pch */, - 9A9A9140CB6ADD033768BB60CEA72E7A /* IQKeyboardNotification-umbrella.h */, - F9CB2239F63422E991F6FEF9D9A32967 /* IQKeyboardNotification.debug.xcconfig */, - 401C0B5E9F8F1552898BFACFDEB8C41D /* IQKeyboardNotification.release.xcconfig */, - A23F97293C46916466F957A9639D75E3 /* ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist */, - ); - name = "Support Files"; - path = "../Target Support Files/IQKeyboardNotification"; - sourceTree = ""; - }; - 8B01AA97E6DC3D5A0DE5696F64B7A21D /* Core */ = { - isa = PBXGroup; - children = ( - C4C246899B9ADD76C47413CFC1900669 /* IQActiveConfiguration.swift */, - 6759C2C05A896EEF5A902F54ED815458 /* IQKeyboardManager.swift */, - E23A19CFE92D16E0C6DF4232CAE6BE95 /* IQKeyboardManager+ActiveConfiguration.swift */, - C5DD064141FD6D9585DDBFF2FE5EF228 /* IQKeyboardManager+Debug.swift */, - B50BF2C383279DDB7880AF4C978116E2 /* IQKeyboardManager+Deprecated.swift */, - 532F94C9C97C09FF016A3ABB96B2DB11 /* IQKeyboardManager+Internal.swift */, - 736B201311554090BB7665BFF33F0B0D /* IQKeyboardManager+Position.swift */, - 60631CBB35BA793CAA9E46A8F1CD243C /* IQRootControllerConfiguration.swift */, - 9EE58245D58F26549A7A8CCB434AC52E /* IQScrollViewConfiguration.swift */, - 4F613BCF49ACE20A304727CA4EDA7E47 /* UICollectionView+IndexPaths.swift */, - BF84270BA52DE4FAC1678E99D700AA50 /* UIScrollView+IQKeyboardManagerExtension.swift */, - E7FD69C0D8168D323ADC0A6EFD7FC1DD /* UIScrollView+IQKeyboardManagerExtensionObjc.swift */, - 244D954871A873D3E39E3064D852B516 /* UITableView+IndexPaths.swift */, - 6388414814252F565A677CD3D17EC014 /* UIView+IQKeyboardManagerExtension.swift */, - DB5660BB9799DC420CD4238B38ED357F /* UIView+IQKeyboardManagerExtensionObjc.swift */, - 70E7C93840EABBEDEEF083F6B142029D /* UIView+Parent.swift */, - 87CC2842EDD9352F470FE692A9B91AA5 /* UIView+ParentObjc.swift */, - 4AF4AEB75D89FF3F06FDE6A004EA9A23 /* UIViewController+ParentContainer.swift */, + E924602982CB402C3DE49FAE6B4E86D7 /* IQBarButtonItem.swift */, + 9FFCB3910600ECA6002BB878B30BA591 /* IQBarButtonItemConfiguration.swift */, + 14791DBACC3C3EBD8BF5D28B23927645 /* IQInvocation.swift */, + 679D26F54B1AA81CAB8B96B96A4E1340 /* IQKeyboardToolbar.swift */, + BD07E0C05CA7DC462A51F4F90DD5AEE7 /* IQKeyboardToolbarPlaceholderConfiguration.swift */, + 939F8DEAB2123EC89A5DD098E96E191A /* IQTitleBarButtonItem.swift */, + F4D876671EB044681F90C28875230D85 /* UIView+IQKeyboardExtension.swift */, + 8F30991F76663516B678C382E5C3778C /* UIView+IQKeyboardExtensionDeprecated.swift */, + E3AB3CAD98805C12A0303E5EEF02BA39 /* UIView+IQKeyboardExtensionObjc.swift */, ); name = Core; sourceTree = ""; }; - 8B7D83B1AAA915E59ABF028B30082FE4 /* IQKeyboardToolbar */ = { + 855B3C2F89D8129E75F0872911CC0C5B /* Resources */ = { isa = PBXGroup; children = ( - 30D785C6AB9C62FE21F5E25D6CF89F9E /* Core */, - 3639459FE754ED7E623ABF3E8B9CEBD2 /* Placeholderable */, - CA3FB6538134EDC52E8EF41795943258 /* Resources */, - 3A2168E47847B8483D459C9DE12A756D /* Support Files */, - ); - name = IQKeyboardToolbar; - path = IQKeyboardToolbar; - sourceTree = ""; - }; - 8C2BE863706DEF05145526386F0B68C5 /* Support Files */ = { - isa = PBXGroup; - children = ( - 930E9B1B194A403F3F0A4F95FAF2427A /* AMapLocation-NO-IDFA.debug.xcconfig */, - 3F2BA6FF47C66D4951D519C0085C948B /* AMapLocation-NO-IDFA.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/AMapLocation-NO-IDFA"; - sourceTree = ""; - }; - 8EC70130CB3BEBE4354C699B81C8B53B /* Frameworks */ = { - isa = PBXGroup; - children = ( - B72C4055DD0AAE857AE24AA1B22D707A /* AMapSearchKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9B0F3E052867A07902A6A2420D5485CE /* Resources */ = { - isa = PBXGroup; - children = ( - 4294DBAFDD1C869AB58195872ECBD63C /* PrivacyInfo.xcprivacy */, + 9F8AD8BB0EBEEF249761A914B37CAD8C /* PrivacyInfo.xcprivacy */, ); name = Resources; sourceTree = ""; }; - 9F84599051C12EB2D8199BE4B9D266DA /* Support Files */ = { + 87D55BB763384F632F7A4ECA33DF2B1E /* Support Files */ = { isa = PBXGroup; children = ( - 6D59C7309AD33EDAE93D4959CC364A32 /* IQKeyboardToolbarManager.modulemap */, - C026F448EE161E5AA295F2DD8C00F78B /* IQKeyboardToolbarManager-dummy.m */, - 23AC67D8FE201A5D8B41262606782630 /* IQKeyboardToolbarManager-Info.plist */, - E26D520CBDC504839CC1C6D42B0B0B80 /* IQKeyboardToolbarManager-prefix.pch */, - D6B6259CDECD85D674B168D3AF7C0101 /* IQKeyboardToolbarManager-umbrella.h */, - 1FADC993D884553299A227B2F37F270B /* IQKeyboardToolbarManager.debug.xcconfig */, - 10CADA6646C9AF13C983D13EAF7F5378 /* IQKeyboardToolbarManager.release.xcconfig */, - CC2DA460622CB6B30A4B3F6B866725B8 /* ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist */, + 871C4D1834D14518E50DD97F10BCD43C /* IQKeyboardReturnManager.modulemap */, + 7F2AB1871CDCA81B98E67F2845433559 /* IQKeyboardReturnManager-dummy.m */, + BC22E9169FFEB3DDF58C844A9E7BC4DB /* IQKeyboardReturnManager-Info.plist */, + 58DC8D42E44C8F1B5737553B617A916E /* IQKeyboardReturnManager-prefix.pch */, + F97FC488C52F8C83E3213105C4228613 /* IQKeyboardReturnManager-umbrella.h */, + FA8405454F857A83074F7A861FD13878 /* IQKeyboardReturnManager.debug.xcconfig */, + 3743F40B27DFFA0C0530479FFB587691 /* IQKeyboardReturnManager.release.xcconfig */, + A83A792738DA83E2D1119087D2778E1F /* ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist */, ); name = "Support Files"; - path = "../Target Support Files/IQKeyboardToolbarManager"; + path = "../Target Support Files/IQKeyboardReturnManager"; sourceTree = ""; }; - A3BF0EF84B6B77093E25EB0B13F497FD /* Support Files */ = { + 8CF7280B91CC791C8414A4F10087597B /* Frameworks */ = { isa = PBXGroup; children = ( - 85547E7B6FFBB52AB98F82AEB49717FA /* JPush-xcframeworks.sh */, - DD52E2C9D26643C4510332244B319F71 /* JPush.debug.xcconfig */, - 1FB7DE577ECCA1457268EA70E8DB4DAC /* JPush.release.xcconfig */, + EACBD6A19E0393FBFB741D6F1B5363BA /* jpush-ios-6.1.0.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 90386ACFD30E43003B8F5C88423152A8 /* Frameworks */ = { + isa = PBXGroup; + children = ( + AC6E594A0FD896EA5CDA3E6F190C0AB7 /* RTCFFmpeg.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 94AF0C1BF0637DE33C600A905B325AB0 /* AMapFoundation-NO-IDFA */ = { + isa = PBXGroup; + children = ( + B209820123663AF8D99EFF6912BF9F79 /* AMapFoundationConst.h */, + F7EED4BF1095985650837ABEA0C99E74 /* AMapFoundationKit.h */, + 6FC842F5579AC5F9E36B02804980FBA5 /* AMapFoundationVersion.h */, + 836E8DA0AB39B894F56601BB518502FC /* AMapServices.h */, + 22536953ABA1BC0ED1B53F47CB71E415 /* AMapURLSearch.h */, + 5AF4FC451B12D40C36F4824295CF94E1 /* AMapURLSearchConfig.h */, + 8075CD247EEBD97388B72593387ED07E /* AMapURLSearchType.h */, + 3F4B4471F801A901C847415B11010539 /* AMapUtility.h */, + 44BBB4BB04DA5469FD443584AABA8779 /* Frameworks */, + 71C7E423D3DEDE0819495B345A994FE5 /* Support Files */, + ); + name = "AMapFoundation-NO-IDFA"; + path = "AMapFoundation-NO-IDFA"; + sourceTree = ""; + }; + 9BEA03AC0C1F5ACA6FF8438E65F34DA8 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1B199C4901242D30CD71A18A8E1D0008 /* AMapSearchKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A0E6B48D23FB3AD594F90D1F242CF9AF /* JCore */ = { + isa = PBXGroup; + children = ( + 5B3C0813D128A45E751A0AC71DA3C895 /* Frameworks */, + C6D9FE6F6DAC38FFBF24F266B48502BC /* Support Files */, + ); + name = JCore; + path = JCore; + sourceTree = ""; + }; + A1098BCB6F71B70A6EB9C68038D5392C /* Frameworks */ = { + isa = PBXGroup; + children = ( + A32A4C33E27F87863FB11AC3C9A09E0C /* RealXBase.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A222616F5C1CD6715F1F6E7461B83C43 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D20C43E50A3476871B7384379068F972 /* UMCommon.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A2F6C398C06E89855411D63D0058B318 /* Support Files */ = { + isa = PBXGroup; + children = ( + 51367A9A6774AE911676FEE589F4D4E9 /* AMap3DMap-NO-IDFA.debug.xcconfig */, + 0AF4E684DF6CEBFE9C445B44A8ECFFF0 /* AMap3DMap-NO-IDFA.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/JPush"; + path = "../Target Support Files/AMap3DMap-NO-IDFA"; sourceTree = ""; }; A44383B435488DA9FDC1DB25CBBBCBA6 /* Products */ = { @@ -1747,93 +1664,169 @@ name = Products; sourceTree = ""; }; - AB638B82CB2671C730E5541D1EF6C548 /* IQKeyboardReturnManager */ = { + A4B90924C44E6B3D0B3AF91BE647EB2B /* Support Files */ = { isa = PBXGroup; children = ( - 629DD1DA2A6BB7211D4AA2CDC4ADE1BE /* IQKeyboardReturnManager.swift */, - 0141CCE940C38D3566A83D1108E6A304 /* IQKeyboardReturnManager+UITextFieldDelegate.swift */, - 484D6C3AFBCC01928BBCFE110C2A2F2C /* IQKeyboardReturnManager+UITextViewDelegate.swift */, - CE41AE378E9210FE5D862A988433348E /* IQTextInputViewInfoModel.swift */, - 4E8E1335F09602994B3CF0038FDF0547 /* Resources */, - 033D0A6A59C1A74DDD7D6980C1AB24B9 /* Support Files */, + FE55B3A42666347457710420CE151AA6 /* IQKeyboardToolbar.modulemap */, + 9960FCCCFFE8F876FCDE0065C4FD6629 /* IQKeyboardToolbar-dummy.m */, + CD21C2E29DEBDED503E1CC5C84490B9D /* IQKeyboardToolbar-Info.plist */, + 3AF86EA711AAF037D15AB7371496C2A1 /* IQKeyboardToolbar-prefix.pch */, + B15A89F8DECA647A9464E7868B3D9832 /* IQKeyboardToolbar-umbrella.h */, + FF5A7F51FAADA1E1B5FC260E1B632D6C /* IQKeyboardToolbar.debug.xcconfig */, + 37ED2C21C1E1ACCC106AA7C2D98CD280 /* IQKeyboardToolbar.release.xcconfig */, + BBAB966289F13CCDA2FAD0652410E843 /* ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist */, ); - name = IQKeyboardReturnManager; - path = IQKeyboardReturnManager; + name = "Support Files"; + path = "../Target Support Files/IQKeyboardToolbar"; sourceTree = ""; }; - ACC27663C7D4373253B19FC29790ED5A /* Frameworks */ = { + A5195BD59A9DB6B60F1C27DC83714934 /* AMapLocation-NO-IDFA */ = { isa = PBXGroup; children = ( - C416DF9C2C6D3B85FB383E91C18664DE /* UMCommon.xcframework */, + 8CE213F570E6C96F86CBD8CBE081B8C9 /* AMapGeoFenceError.h */, + 985288E47AE20118163007C6AFBB4174 /* AMapGeoFenceManager.h */, + 608C4908E4BB55A6CB186C5C994459F5 /* AMapGeoFenceRegionObj.h */, + 05D5CE10D09B57E622283C0E3F584D8B /* AMapLocationCommonObj.h */, + 3DDF6B961018C08613D8A0D837046BF1 /* AMapLocationKit.h */, + F4023F00A614A00A57225A27D115BDB9 /* AMapLocationManager.h */, + 6B07A961A98509C930FDC98A9FA8544E /* AMapLocationRegionObj.h */, + E790BD090A1CD4A9A8D93AA43D92A380 /* AMapLocationVersion.h */, + B4861D8415FEA633B96102F595307A07 /* Frameworks */, + F1767B680BB1D7FFC620A6C4726A04D3 /* Support Files */, + ); + name = "AMapLocation-NO-IDFA"; + path = "AMapLocation-NO-IDFA"; + sourceTree = ""; + }; + A541D3DD8ADA33E48C211C7FADBAAF6D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9BDAC44E74D5AEA1FE9EF5B66759D030 /* UMDevice.xcframework */, ); name = Frameworks; sourceTree = ""; }; - AD3949A7EC8E24D927D4905755B04D6D /* UMDevice */ = { + AE79D9ABAE2FCE9F97081CF644AFBD3A /* Resources */ = { isa = PBXGroup; children = ( - 1A19E6EA7CBD3082142C640567987EEF /* Frameworks */, - 77C012E3A227F889C3968E3ECD2C2F62 /* Support Files */, + 5DA99C08528E3C22E42D003865FEC09D /* PrivacyInfo.xcprivacy */, + ); + name = Resources; + sourceTree = ""; + }; + B1078AE2E0BB31006606E09592168E39 /* IQKeyboardCore */ = { + isa = PBXGroup; + children = ( + 1432B7B9FB7E007C7E5FD5F9AB24198B /* IQKeyboardConstants.swift */, + D30ADEE09F82DF19A1888B002A47FC21 /* IQKeyboardExtended.swift */, + 81662341279CC66CC14E37D7694CCCC3 /* IQTextInputView.swift */, + 059A2CB5D47914844323E42412B05E5D /* UIView+Hierarchy.swift */, + B9B40197A9DC47177BAC36F8984211A1 /* Resources */, + 830D7654D3140A352D11F1AF914053BA /* Support Files */, + ); + name = IQKeyboardCore; + path = IQKeyboardCore; + sourceTree = ""; + }; + B3031E0D8DC315A2A4B0FA287EC402DC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4CA5E02432572BEC3D63E70BDFA76230 /* VolcEngineRTC.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + B4861D8415FEA633B96102F595307A07 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 470A92D6F1D61939BF38409D63A4DD65 /* AMapLocationKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + B54B9468033BE23DAF5556C34EDE63F8 /* WechatOpenSDK-XCFramework */ = { + isa = PBXGroup; + children = ( + EB111FD711B6F0742A7A0D70F151E8A8 /* Frameworks */, + 71246DF8BFC3526B5A8702F8FE003278 /* Support Files */, + ); + name = "WechatOpenSDK-XCFramework"; + path = "WechatOpenSDK-XCFramework"; + sourceTree = ""; + }; + B86E9C7076669987F4E23893F9B76308 /* Support Files */ = { + isa = PBXGroup; + children = ( + 227609D6C20B15E2AF59CD06C201BD05 /* JPush-xcframeworks.sh */, + CED54F92E588775BEA7B38CECABD7702 /* JPush.debug.xcconfig */, + E8FD6F60EF688C5AC4A8B023D6D4196A /* JPush.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/JPush"; + sourceTree = ""; + }; + B9B40197A9DC47177BAC36F8984211A1 /* Resources */ = { + isa = PBXGroup; + children = ( + FD5AD0CFBB7A9E4F5B2A53DBC856B6E8 /* PrivacyInfo.xcprivacy */, + ); + name = Resources; + sourceTree = ""; + }; + BC94656FB03B59B20DFF04A8C9C1C170 /* Resources */ = { + isa = PBXGroup; + children = ( + 46743810A3D4B51DE28F0DE3BB6D5497 /* PrivacyInfo.xcprivacy */, + ); + name = Resources; + sourceTree = ""; + }; + BD899D6BCB72FF24A2657897234D0E11 /* Support Files */ = { + isa = PBXGroup; + children = ( + FF3A7D5C821762023E797F50C2927440 /* VolcEngineRTC-xcframeworks.sh */, + EDC68D4FCB048FBF2A45CC21B1638F80 /* VolcEngineRTC.debug.xcconfig */, + A07699BB79F9619E4B3CE5048F213790 /* VolcEngineRTC.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/VolcEngineRTC"; + sourceTree = ""; + }; + C5E0B71C1457F39AFA957A7F262C41C2 /* UMDevice */ = { + isa = PBXGroup; + children = ( + A541D3DD8ADA33E48C211C7FADBAAF6D /* Frameworks */, + 46D541F82C815DFC6AAB662C924A819D /* Support Files */, ); name = UMDevice; path = UMDevice; sourceTree = ""; }; - B7DD817AF7478DD1DAF2BF4F87698BAE /* JPush */ = { + C6D9FE6F6DAC38FFBF24F266B48502BC /* Support Files */ = { isa = PBXGroup; children = ( - 1BC2084ADA79C87C7F4A950A3D56FBA9 /* Frameworks */, - A3BF0EF84B6B77093E25EB0B13F497FD /* Support Files */, - ); - name = JPush; - path = JPush; - sourceTree = ""; - }; - BD856CC8714F0E23D04C54D8E567B534 /* Resources */ = { - isa = PBXGroup; - children = ( - 5EAF6B62A82569F4767893AB4F1DEEF4 /* PrivacyInfo.xcprivacy */, - ); - name = Resources; - sourceTree = ""; - }; - BFCD941C9B7FCA2B37453EE02C274D7B /* Resources */ = { - isa = PBXGroup; - children = ( - A3B399BF12010721D7606DE2C51AC0EF /* PrivacyInfo.xcprivacy */, - ); - name = Resources; - sourceTree = ""; - }; - C46A5FACF107BDA2938FF9CD084FFDA3 /* Support Files */ = { - isa = PBXGroup; - children = ( - F235A21AFE7ECC646787D9C9313A8BC3 /* UMAPM-xcframeworks.sh */, - 56E9537047D72ABA1C9695C95A4AF843 /* UMAPM.debug.xcconfig */, - F283224B76C1D6B83702001679439919 /* UMAPM.release.xcconfig */, + 798B5EDBEA0B0097A890F0F469E84E2E /* JCore-xcframeworks.sh */, + 7FC0495E836EAA9DCCF5B24BA4F96574 /* JCore.debug.xcconfig */, + CBD245733975A997CDE429A351AB1C6F /* JCore.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/UMAPM"; + path = "../Target Support Files/JCore"; sourceTree = ""; }; - CA3FB6538134EDC52E8EF41795943258 /* Resources */ = { + CEDC043287CB6140214EA52A2C5D9B87 /* Support Files */ = { isa = PBXGroup; children = ( - 7AF35518DCE4701B077F7D5E23122BAD /* PrivacyInfo.xcprivacy */, + 2AC0DACFAE7037AC2FF368ED2AA7CAF4 /* IQTextInputViewNotification.modulemap */, + 302E2D627665AA33DFD324A6B9C22B43 /* IQTextInputViewNotification-dummy.m */, + 08B0092D87E9E61E28986DB591565BCF /* IQTextInputViewNotification-Info.plist */, + 949006AE50DFEC2AAC1413FF868AA779 /* IQTextInputViewNotification-prefix.pch */, + B19FAB17A68CCCA197D7890BED3BC1D2 /* IQTextInputViewNotification-umbrella.h */, + 69373ECBF83F317CAA7C02D3B536BA78 /* IQTextInputViewNotification.debug.xcconfig */, + 10F845770A3EF5F5562CC88EA7BE4644 /* IQTextInputViewNotification.release.xcconfig */, + A1836F952905D07E23AC756B411BE696 /* ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist */, ); - name = Resources; - sourceTree = ""; - }; - CC0A28B4F081AD9BFEA173D4C3BAF653 /* IQTextInputViewNotification */ = { - isa = PBXGroup; - children = ( - 8E593660B088EDD170E5B1B7CBEA3509 /* IQTextInputViewInfo.swift */, - 97671A95678EAE5829CEE22F5A4ED288 /* IQTextInputViewNotification.swift */, - 59B51CCB97227B7CE340DCEBED7AA228 /* Resources */, - 033FC93B9EFE1CBEB43E1356F4387404 /* Support Files */, - ); - name = IQTextInputViewNotification; - path = IQTextInputViewNotification; + name = "Support Files"; + path = "../Target Support Files/IQTextInputViewNotification"; sourceTree = ""; }; CF1408CF629C7361332E53B88F7BD30C = { @@ -1841,18 +1834,44 @@ children = ( 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, 03C5C200A0787E300053CFA8F53CA094 /* Frameworks */, - 520CDF7916D7BB0DFCBC420F6DB50D65 /* Pods */, + 4E8E73B0D95B9DF2DC613CF17FF94B61 /* Pods */, A44383B435488DA9FDC1DB25CBBBCBA6 /* Products */, D7A8BE48E94D86687C7CC4946F493431 /* Targets Support Files */, ); sourceTree = ""; }; - D44D87B1FCB6B5D7887C6F110AE17293 /* Frameworks */ = { + CF4C1B7D1FAE518ABBF0AEF896CA488C /* UMAPM */ = { isa = PBXGroup; children = ( - F46DE7CDE3412F4C9963058278E9A341 /* jcore-noidfa-ios-5.4.2.xcframework */, + 3B7BDC01C4C090C1F173641FAEC38477 /* Frameworks */, + DA6E739585D53CDAC3E14A02FFAF5D6E /* Support Files */, ); - name = Frameworks; + name = UMAPM; + path = UMAPM; + sourceTree = ""; + }; + CFAC363D714B0D8B5FF2CE47FBF3407C /* Support Files */ = { + isa = PBXGroup; + children = ( + 7148DF765E0E3BDB3E1DA0BD4CDF9FAE /* IQKeyboardToolbarManager.modulemap */, + 6BB647CC374FB13666973FCF51E8A4AC /* IQKeyboardToolbarManager-dummy.m */, + 1A3D978D914830388E3B2A7C1EC1B497 /* IQKeyboardToolbarManager-Info.plist */, + C0A04393C6482B43D12F30B07E04748A /* IQKeyboardToolbarManager-prefix.pch */, + 4BD5CE09F44FA76C300BAFE993574AC6 /* IQKeyboardToolbarManager-umbrella.h */, + FFC2E336F5D035028DAA138A1A5C4F2E /* IQKeyboardToolbarManager.debug.xcconfig */, + 5B91072D08BB3F63162262295825C5FF /* IQKeyboardToolbarManager.release.xcconfig */, + A4F538840D1231E9EE9946590DC1D919 /* ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist */, + ); + name = "Support Files"; + path = "../Target Support Files/IQKeyboardToolbarManager"; + sourceTree = ""; + }; + CFF64AB64E21524BF6A3019033D79E16 /* Resources */ = { + isa = PBXGroup; + children = ( + E4F6A8D9BA6DC9E9C42A77BC2E7F0AF3 /* AMap.bundle */, + ); + name = Resources; sourceTree = ""; }; D7A8BE48E94D86687C7CC4946F493431 /* Targets Support Files */ = { @@ -1864,85 +1883,153 @@ name = "Targets Support Files"; sourceTree = ""; }; - E42F6AA6B0BF64809371E39FF768BC7B /* Resources */ = { + DA6E739585D53CDAC3E14A02FFAF5D6E /* Support Files */ = { isa = PBXGroup; children = ( - 2A2F83D6955E3DA7E55E81A83CDD1633 /* PrivacyInfo.xcprivacy */, + 8D7C63D6DD7621AF727A8980247D8D0B /* UMAPM-xcframeworks.sh */, + 4E1E716A01DDF5D7844AD4F6DD359924 /* UMAPM.debug.xcconfig */, + 006784975D34D4F2841543B05EC4A195 /* UMAPM.release.xcconfig */, ); - name = Resources; + name = "Support Files"; + path = "../Target Support Files/UMAPM"; sourceTree = ""; }; - E53E71F1F1B8EDB0D00DCF8007422754 /* Support Files */ = { + E114BC63459388CB2BFA23BF31BC1C71 /* Appearance */ = { isa = PBXGroup; children = ( - 3E8FC0168ED476CD46810E7F95C0D5DD /* IQTextView.modulemap */, - 9FC5970D36251A1390A17CF7571EF768 /* IQTextView-dummy.m */, - D717049D0CC527FBADC7B8BFC423D331 /* IQTextView-Info.plist */, - 4250F6D1B4A49520719CF69AA9DB7171 /* IQTextView-prefix.pch */, - 35890C70D80685FA114966E7CFFC00A1 /* IQTextView-umbrella.h */, - FC4CD6A2AB7E8F21DDF47AE3878B13B4 /* IQTextView.debug.xcconfig */, - 3BAA32FB751F6BB0FD65930595456ACA /* IQTextView.release.xcconfig */, - 0EFFE26759757EA17C439FCF5BC7A432 /* ResourceBundle-IQTextView-IQTextView-Info.plist */, + 18C05366BC9A77BCD2D3B2E774D2B722 /* IQKeyboardAppearanceConfiguration.swift */, + 025FF22A5001E60904C397A76E0C09B4 /* IQKeyboardAppearanceManager.swift */, + 10CB1E0D11EC51CC988C1E27607C73A7 /* IQKeyboardAppearanceManager+Internal.swift */, + 3CB214999237C638FFC3DB3AE121DAD5 /* IQKeyboardManager+Appearance.swift */, + F4F1AACDDF2D1C20591B33DD8E2A5C38 /* IQKeyboardManager+Appearance_Deprecated.swift */, + ); + name = Appearance; + sourceTree = ""; + }; + E28CA03D952064FA8670CE57935D6253 /* IQKeyboardReturnManager */ = { + isa = PBXGroup; + children = ( + 32933D0AEA1AF3988E2782401F17B221 /* IQKeyboardReturnManager.swift */, + 6ECF9275B52B7B8B05B01B6D2E53EC02 /* IQKeyboardReturnManager+UITextFieldDelegate.swift */, + D38BDB89CF929982D596C8C7390190C0 /* IQKeyboardReturnManager+UITextViewDelegate.swift */, + F59F91AFD79784903BF8352CDFAF43B9 /* IQTextInputViewInfoModel.swift */, + 855B3C2F89D8129E75F0872911CC0C5B /* Resources */, + 87D55BB763384F632F7A4ECA33DF2B1E /* Support Files */, + ); + name = IQKeyboardReturnManager; + path = IQKeyboardReturnManager; + sourceTree = ""; + }; + E6CEF6838EE3006B0B001A0232541FC0 /* IQKeyboardToolbarManager */ = { + isa = PBXGroup; + children = ( + 40D0A74BB726A2A8248C9847466D9CC1 /* Array+Sort.swift */, + 4CBFDC425AA2C8AD908DA6ABC7D368DD /* IQDeepResponderContainerView.swift */, + E2C3388662FA183F12DC5F47940D57DC /* IQKeyboardToolbarConfiguration.swift */, + 5DB63DD174AA36A665DF6EFDF91B9E37 /* IQKeyboardToolbarConstants.swift */, + AF2D49F00775A27DDCDF1AE909125185 /* IQKeyboardToolbarManager.swift */, + C1D32FAB7ECAEED292D25CAE95327CF0 /* IQKeyboardToolbarManager+Action.swift */, + 0A018EB4FFC926E5323B07BD2E9A0617 /* IQKeyboardToolbarManager+Debug.swift */, + 0BDEFEECE64EE79440F94BD4C6F34682 /* IQKeyboardToolbarManager+Deprecated.swift */, + 9F977EDAA0F36643B21D81D866F00325 /* IQKeyboardToolbarManager+Internal.swift */, + B70C6CBF2C487B6296E36E4818045F76 /* IQKeyboardToolbarManager+Toolbar.swift */, + 257BCE628592783EF9A5E519CCA2AC16 /* UIView+Responders.swift */, + 3642570B5038C4A4B1B4F2D100D8D750 /* UIView+RespondersObjc.swift */, + 1384110D481A014E1D91A25E7C544B95 /* Resources */, + CFAC363D714B0D8B5FF2CE47FBF3407C /* Support Files */, + ); + name = IQKeyboardToolbarManager; + path = IQKeyboardToolbarManager; + sourceTree = ""; + }; + EB111FD711B6F0742A7A0D70F151E8A8 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 260D101C410C813A89F178DA344A0C68 /* WechatOpenSDK.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; + EC4A02C8266D539615F8281A0713BA97 /* Support Files */ = { + isa = PBXGroup; + children = ( + C2AAAB1B6731410C9D9EB1C5A6AC99DF /* IQKeyboardNotification.modulemap */, + 5A1D98DED6CFD3022E8FC075FA491615 /* IQKeyboardNotification-dummy.m */, + CFC4986043F2FE7F33785D4D46CA5E4C /* IQKeyboardNotification-Info.plist */, + 6359B1281832A0C2267C0D4A90CE1416 /* IQKeyboardNotification-prefix.pch */, + A96477B12A2B08512DEF851076308BFC /* IQKeyboardNotification-umbrella.h */, + 2D2C9E82DF51CA26E12725621714E090 /* IQKeyboardNotification.debug.xcconfig */, + 948A9344898DCC2785FDDAD0699D6C1E /* IQKeyboardNotification.release.xcconfig */, + D2E3FD31E91683FDC0B22290FE74B7E2 /* ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist */, + ); + name = "Support Files"; + path = "../Target Support Files/IQKeyboardNotification"; + sourceTree = ""; + }; + F1767B680BB1D7FFC620A6C4726A04D3 /* Support Files */ = { + isa = PBXGroup; + children = ( + 20C3CD12D4046B6427964786B1D7F200 /* AMapLocation-NO-IDFA.debug.xcconfig */, + D716492F07DEB42B388856692B6E843A /* AMapLocation-NO-IDFA.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/AMapLocation-NO-IDFA"; + sourceTree = ""; + }; + F3FC9C7122817D805F5B407370ED6502 /* Support Files */ = { + isa = PBXGroup; + children = ( + F3E9C7798DF3A5EBBDEAF4FCD0515ECA /* IQTextView.modulemap */, + 7F9BF1DD8D3901D2CB56396040F28392 /* IQTextView-dummy.m */, + 869DEE3EDA8F46435177FF98ED73A2B3 /* IQTextView-Info.plist */, + 7B4F4930A148CCA0AFF2A6240DF36B28 /* IQTextView-prefix.pch */, + 0D5ABBC99F3391C6F9A634D663E75422 /* IQTextView-umbrella.h */, + 84308DE86AAB2CCBAA19904F494B555E /* IQTextView.debug.xcconfig */, + F1F98B961492E58401AF64822AA86791 /* IQTextView.release.xcconfig */, + 434E0C6C570DC80ADDE76B4EA8DDFB61 /* ResourceBundle-IQTextView-IQTextView-Info.plist */, ); name = "Support Files"; path = "../Target Support Files/IQTextView"; sourceTree = ""; }; - EB8B5B05F9AEE6EF38E78653B5A1AB95 /* IQKeyboardNotification */ = { + F448F353060513B50DC243E33071B811 /* Support Files */ = { isa = PBXGroup; children = ( - 6CD275A609F620EB41456FBE469BDA8C /* IQKeyboardInfo.swift */, - 9DED2FF966D82D4283903008C1587F98 /* IQKeyboardNotification.swift */, - 7C4781364ADF28BE6A5FD0B6A4417EFD /* Resources */, - 81644849A152D1E3F1A626F9045C756E /* Support Files */, - ); - name = IQKeyboardNotification; - path = IQKeyboardNotification; - sourceTree = ""; - }; - EC0B71710DB35FB187FC61098A2EB88E /* Frameworks */ = { - isa = PBXGroup; - children = ( - 54062D69C3F5F955058687496BC9B5C1 /* MAMapKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - EFC04CD4102AE37AED7A86B65EF1E60B /* Frameworks */ = { - isa = PBXGroup; - children = ( - 77A5D875250BB2847A6580EEC009BA4F /* AMapLocationKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - F8464A5C3EF711FD122774272378CF6E /* Support Files */ = { - isa = PBXGroup; - children = ( - 6E9F7234A3BF2BFA0BC19D0319D62938 /* WechatOpenSDK-XCFramework-xcframeworks.sh */, - FDF709D73DE1142AE1CF86A66274B9FC /* WechatOpenSDK-XCFramework.debug.xcconfig */, - 8D6DCAE6D0330A20D29082667233E33C /* WechatOpenSDK-XCFramework.release.xcconfig */, + A900C19FDD423A63EDB4890241E20444 /* AMapSearch-NO-IDFA.debug.xcconfig */, + 48303C21DF2C6D474BE4A0AADEE9E16C /* AMapSearch-NO-IDFA.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/WechatOpenSDK-XCFramework"; + path = "../Target Support Files/AMapSearch-NO-IDFA"; + sourceTree = ""; + }; + F5FCBF2314B4EB54739C2EF1B8A759B2 /* IQTextInputViewNotification */ = { + isa = PBXGroup; + children = ( + 1E3A1BD1F31324B93B3AD539F716E8F8 /* IQTextInputViewInfo.swift */, + 65C4C42FF3915092153F921CC192177D /* IQTextInputViewNotification.swift */, + 1B38AC023F8FAD91C320BC949EB5D4BF /* Resources */, + CEDC043287CB6140214EA52A2C5D9B87 /* Support Files */, + ); + name = IQTextInputViewNotification; + path = IQTextInputViewNotification; + sourceTree = ""; + }; + FE36BBF38DDAF33E23DD5465F236060F /* RTCFFmpeg */ = { + isa = PBXGroup; + children = ( + 90386ACFD30E43003B8F5C88423152A8 /* Frameworks */, + ); + name = RTCFFmpeg; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 05D78C584C2B8A3C76EF585B10467D34 /* Headers */ = { + 1E6E2CA34B371C55DF220BDFD3000AF2 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - BF16B86E6246A1BAC62B945FC5B91D4B /* IQKeyboardReturnManager-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0CB5CF52B65F48F49ECDBD41DDEB761B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - F830A4A9A9CBAA1D538F5B503D27E85E /* IQTextView-umbrella.h in Headers */, + D85E7E38F35C5D58550C5D8E44705B20 /* IQKeyboardReturnManager-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1954,27 +2041,11 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4331D75657E8348B798DB10DB702B73E /* Headers */ = { + 2EA7C5163B6EFABCF51CFE191B9505C0 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 7BF320447891FB83F74C8BC147F74898 /* IQTextInputViewNotification-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4BC391D43E41534AA430750EB6B1A7F3 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D1F3500436232D12E46F637F12E3799D /* IQKeyboardToolbarManager-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4F50052A170BD3C433BCDC9871047347 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 0C924236B7292794AE10E4BBFABC8448 /* IQKeyboardToolbar-umbrella.h in Headers */, + B84FE0B28193A77BA1C0147CB12496DA /* IQTextInputViewNotification-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1986,11 +2057,19 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7680254C28B426011095084CBB09EA2A /* Headers */ = { + 7276EB2E5AA40AC97805906DEA7CD7FD /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 794E0A6AE50125209FEB21F836F814A8 /* IQKeyboardNotification-umbrella.h in Headers */, + 8F90006048BC08268AA81256349A0735 /* IQKeyboardNotification-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 94751B9471D29004E7DE4CCD38EEE5F2 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + F20AF39343CE3A9EE766946E551AF9E0 /* IQKeyboardToolbarManager-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2002,11 +2081,27 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - DD075277F3BC8ABF62494D69FCB6F6BE /* Headers */ = { + E7505021B0E826CB2951EA1B17806239 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 753647E6489F2973A95CC4802972B4D5 /* Pods-suixinkan-umbrella.h in Headers */, + 4C95F01EA9E552C45BBFF21C67D96571 /* IQTextView-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F1A788CB175CEB46CC2D355801709508 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 7627D9AB0E166EFB41F915C6335FAB38 /* IQKeyboardToolbar-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F66D9C38D882B817B63F6C16ACEF16B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B091DC2D97D18146714D417F8493EE2 /* Pods-suixinkan-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2015,19 +2110,19 @@ /* Begin PBXNativeTarget section */ 020993F16DA5986DACE118349EBCE9E5 /* IQKeyboardToolbarManager */ = { isa = PBXNativeTarget; - buildConfigurationList = BCB9D19D2F10472241947B3E83FFA193 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager" */; + buildConfigurationList = 909E3FC7201534B950D3B53E3A6E76C6 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager" */; buildPhases = ( - 4BC391D43E41534AA430750EB6B1A7F3 /* Headers */, - 7F8A34EF840A89732F331227732CE6A3 /* Sources */, - EC2013DAC79463EF21C09D001A46CB40 /* Frameworks */, - AFB9D90B0819926ED1C202A31C2A8FB9 /* Resources */, + 94751B9471D29004E7DE4CCD38EEE5F2 /* Headers */, + 16FB8B1524EE90D9270AC5FCD1D8560D /* Sources */, + B1C16E3CDD005904731374173E50A59E /* Frameworks */, + 44A091017D212907E98A049763DC7AC9 /* Resources */, ); buildRules = ( ); dependencies = ( - 257C046139A332001B37EC1DC9581A88 /* PBXTargetDependency */, - 423901BB0BC7656034EFDA6B76B2414C /* PBXTargetDependency */, - 40B551A587D49784793075111A2B43DA /* PBXTargetDependency */, + 40E019D5F164716D9B37FF8FD2E3CAC0 /* PBXTargetDependency */, + 4F986259884CF9231BAD66B79A8367CA /* PBXTargetDependency */, + C850F73D0CD4FF748E4E30860AAFB932 /* PBXTargetDependency */, ); name = IQKeyboardToolbarManager; productName = IQKeyboardToolbarManager; @@ -2036,18 +2131,18 @@ }; 0981F89DB5DA3FFCFFEBDE1F56287054 /* IQKeyboardReturnManager */ = { isa = PBXNativeTarget; - buildConfigurationList = DBA22BA64605C2BEE511FFFAC16EEBF9 /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager" */; + buildConfigurationList = CA8B8095420E4C741A74C6526E47B837 /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager" */; buildPhases = ( - 05D78C584C2B8A3C76EF585B10467D34 /* Headers */, - 2AAF5011D324DFA6F8DF4F369E9112D7 /* Sources */, - EC4276E1E0D899ACABDF5030E302B8C5 /* Frameworks */, - F864370B46A2030CD2D29BB63BF9964C /* Resources */, + 1E6E2CA34B371C55DF220BDFD3000AF2 /* Headers */, + 1F6ADB788CA64307098F2D30CE014BDC /* Sources */, + 8117EC3866EDF249CA8CE1376526A3DB /* Frameworks */, + EA9C42E6F04A4AD059D55FFEC56C5A79 /* Resources */, ); buildRules = ( ); dependencies = ( - D8E393A29EF660C4A48ACF8426C25D32 /* PBXTargetDependency */, - 4A686003582098B259DDA20E5FC9D323 /* PBXTargetDependency */, + 2EAF3D32B47629317952DB929164BAB2 /* PBXTargetDependency */, + F99C25A65D58FB66226D4571D404B903 /* PBXTargetDependency */, ); name = IQKeyboardReturnManager; productName = IQKeyboardReturnManager; @@ -2056,18 +2151,18 @@ }; 12890DE3ABBC2CA295E108358D85EE69 /* IQTextView */ = { isa = PBXNativeTarget; - buildConfigurationList = 24187E637FC68EF68B8A7A6028C0073F /* Build configuration list for PBXNativeTarget "IQTextView" */; + buildConfigurationList = 9BBC50C6E9EFEF51C68190E6CCBD8E98 /* Build configuration list for PBXNativeTarget "IQTextView" */; buildPhases = ( - 0CB5CF52B65F48F49ECDBD41DDEB761B /* Headers */, - 645C6BEE5C5F8EA94CA1B8A824E0A223 /* Sources */, - FC3987C09F835C384373CDD2FFD65186 /* Frameworks */, - 0EFFDC53F19C2A4DEDEE2103D0643E93 /* Resources */, + E7505021B0E826CB2951EA1B17806239 /* Headers */, + 7C5B5B7060E55C22BBA5A2C7540066B8 /* Sources */, + C7391ABA2E8405F598E3AD115908ECC1 /* Frameworks */, + 318B6D1BB40994CE8CFA616C671A7AFD /* Resources */, ); buildRules = ( ); dependencies = ( - 57354DDB8E699721C452977695B263FD /* PBXTargetDependency */, - C6B684446AAB0C7A81EF869A2830679A /* PBXTargetDependency */, + C206BE584D88B37ECDC3054891961C63 /* PBXTargetDependency */, + 706EF92721F065D187D2BB79F574C847 /* PBXTargetDependency */, ); name = IQTextView; productName = IQTextView; @@ -2076,34 +2171,35 @@ }; 1DE17B7C77CD95CB67DF1197965B76AB /* Pods-suixinkan */ = { isa = PBXNativeTarget; - buildConfigurationList = 875BEC2BC17CFCC0F5056A3B395DA258 /* Build configuration list for PBXNativeTarget "Pods-suixinkan" */; + buildConfigurationList = 9A49A90044DDEEF3E6FCA42DE3192D0E /* Build configuration list for PBXNativeTarget "Pods-suixinkan" */; buildPhases = ( - DD075277F3BC8ABF62494D69FCB6F6BE /* Headers */, - 34C275CAECED9D6901747FC1405E6B98 /* Sources */, - BE4F345025D2187B63FA2ED8E7233AED /* Frameworks */, - 1E3389B13F3713DABCD48373D5D98914 /* Resources */, + F66D9C38D882B817B63F6C16ACEF16B3 /* Headers */, + 450A4DC21C0978C791026911634DB62D /* Sources */, + 6F65B215F9B42F7EC03DEB24F6871DFB /* Frameworks */, + EE67AA31D2D3A2BE153A3FCC903369FA /* Resources */, ); buildRules = ( ); dependencies = ( - 559B5DC039C8981EEE9696C323082915 /* PBXTargetDependency */, - 93501992D2687169C9D64ECF593AAFB5 /* PBXTargetDependency */, - 91835F72D032F3FBDE03F331CD1BE842 /* PBXTargetDependency */, - 7E7528850A1FDD26B1FE2E8099A38A91 /* PBXTargetDependency */, - 04FCE446D622C5939DA314959342DC88 /* PBXTargetDependency */, - BC8F860A2D02AB8F29AA5B639971E84A /* PBXTargetDependency */, - 78F427895C6768AC1AB392721DAE9200 /* PBXTargetDependency */, - D75775B1CDD4D1DBFD4D66F94CD5CF03 /* PBXTargetDependency */, - 5FE0DAE0602EB758297B19F4328BC38D /* PBXTargetDependency */, - D9FB833B6E0D570E62522324BCDCB420 /* PBXTargetDependency */, - 87C4B1E7F9C8681284EF020BA2CE7232 /* PBXTargetDependency */, - 9878FADAAA880FFB5292FEA6B7285FF5 /* PBXTargetDependency */, - 82D472A757E3AE733E285863E4FF7C29 /* PBXTargetDependency */, - EBDABB0A79F03526A3A3A7726153BCC6 /* PBXTargetDependency */, - B4ED9F2608DCFF0DE645E679F965467F /* PBXTargetDependency */, - 43D53F6BFEB39F4503F44F84FBEC23F7 /* PBXTargetDependency */, - EEB39FDC8A236AB428E4BA853F5A9139 /* PBXTargetDependency */, - EBF5E69FEE7E49D4E80788A055AE67C5 /* PBXTargetDependency */, + B6E8DB3BD84A7E9508C6CF96915F005B /* PBXTargetDependency */, + 66DF1AD9D3E97349A96E5F5C90757C68 /* PBXTargetDependency */, + 204FD388CFB176C0766F60CB1CAEBA86 /* PBXTargetDependency */, + 0E01BAE168991620CF6F48B3D188BA53 /* PBXTargetDependency */, + 4BDB84F42661A88DB4AE7F506CD672F4 /* PBXTargetDependency */, + 9E9BD81B51490D7C334A5A60FE1111D0 /* PBXTargetDependency */, + 52A718AAC261E51A6EE91D1E3D571C27 /* PBXTargetDependency */, + 57C5226AB4AFFE43C654081EC80A85B8 /* PBXTargetDependency */, + 041E2CC6DFE2A6B560D8CFA2B4D906B8 /* PBXTargetDependency */, + 20F0375C486E250BB5232F4758D576A4 /* PBXTargetDependency */, + A3132469DDB9CC498C41B9FCD5ED3A2A /* PBXTargetDependency */, + 337C96201808509507CA774D119D9AD8 /* PBXTargetDependency */, + 75C7A3492D85446BC94DFAD73EF4FF03 /* PBXTargetDependency */, + 11F9B04ED25D4D44F2064FBB7DE683D6 /* PBXTargetDependency */, + D712A40A6F15B03849EDADE61B68DB39 /* PBXTargetDependency */, + 5C5D15AAD292B83C1872ABD6D6AC563D /* PBXTargetDependency */, + AE5B9CB6019FDEFD3C68ECD10629DCD0 /* PBXTargetDependency */, + C642A9DA4392C05C201A535CDBA4D0B7 /* PBXTargetDependency */, + 27FAD84781762A448335ECCCDDC9E42E /* PBXTargetDependency */, ); name = "Pods-suixinkan"; productName = Pods_suixinkan; @@ -2112,18 +2208,18 @@ }; 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */ = { isa = PBXNativeTarget; - buildConfigurationList = 2B3292CB0DE7D6CE46A077AA7A98827F /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification" */; + buildConfigurationList = 6F2F8E9223CA64429D3DA4A35BBF385E /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification" */; buildPhases = ( - 4331D75657E8348B798DB10DB702B73E /* Headers */, - 425CEB81B0796AC6015FF81B68024078 /* Sources */, - 7A8C5A659560BF9E0CC487398B4E27CF /* Frameworks */, - 6485D775A89B9D841B3B0E53490A947D /* Resources */, + 2EA7C5163B6EFABCF51CFE191B9505C0 /* Headers */, + B229D9E15F75A5D7AB8DDE0C39302879 /* Sources */, + 1168AB246AD776F63DD112F4BF1254B9 /* Frameworks */, + 387F246A1485E8339A81D080337D433D /* Resources */, ); buildRules = ( ); dependencies = ( - D1BAD58FB1961F1DB3B113E93A03AF29 /* PBXTargetDependency */, - 0289564FC881345A79BD1B6531FF3219 /* PBXTargetDependency */, + 0D0ACD494A09D4697A9F058A054B15B9 /* PBXTargetDependency */, + D86848614F0E20BC8CF8ED6E512BD7A0 /* PBXTargetDependency */, ); name = IQTextInputViewNotification; productName = IQTextInputViewNotification; @@ -2132,11 +2228,11 @@ }; 2B8FF445A5162845FAB9EC00FC92B694 /* IQKeyboardNotification-IQKeyboardNotification */ = { isa = PBXNativeTarget; - buildConfigurationList = 63DAAE1B3C844547AB6B4E9490D7C979 /* Build configuration list for PBXNativeTarget "IQKeyboardNotification-IQKeyboardNotification" */; + buildConfigurationList = E6679707463E9734F1AA92E686D468A3 /* Build configuration list for PBXNativeTarget "IQKeyboardNotification-IQKeyboardNotification" */; buildPhases = ( - 64C9A2B5DDBB99DEAF940C9FE46F858F /* Sources */, - C5CF3AB4E319774E8EF43C96BE7E9D20 /* Frameworks */, - 59908003F5EB4C560351C9F4057F6FDF /* Resources */, + 137EC40D310D4704B880AD14CE694EEC /* Sources */, + 7D2E82DB5847681794F83B68E6CA40A5 /* Frameworks */, + 6E5BFB4FCBA146BA6D109E9A1D9669A6 /* Resources */, ); buildRules = ( ); @@ -2149,11 +2245,11 @@ }; 4502C7427440BEB17A50C0BF6E638A85 /* IQTextInputViewNotification-IQTextInputViewNotification */ = { isa = PBXNativeTarget; - buildConfigurationList = F823D0D17289E29C0912BA8CB04F4429 /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification-IQTextInputViewNotification" */; + buildConfigurationList = A69E6688B29DDB5B863FC738C3DC943C /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification-IQTextInputViewNotification" */; buildPhases = ( - DED4AD5DD92DDDC160258A036A443D26 /* Sources */, - 0B63EA4E1D3EA61D0E4AC4DE8422C4E8 /* Frameworks */, - B4564AE26629C32AD6A5634EBBF6062D /* Resources */, + 1C059343D1ECF3932E37BC8394B7FE01 /* Sources */, + 981D9774F54AB0E1C321D57321305E99 /* Frameworks */, + 9A6507B4E9026411FBA0D8BE5E84438F /* Resources */, ); buildRules = ( ); @@ -2176,7 +2272,7 @@ buildRules = ( ); dependencies = ( - 36CDBF917A60EEFE38DD2F7C79B0B9B4 /* PBXTargetDependency */, + E0A5F7B02F9BC271A1362F5B57FB045F /* PBXTargetDependency */, ); name = "Pods-suixinkanTests"; productName = Pods_suixinkanTests; @@ -2185,11 +2281,11 @@ }; 7C5613175BBC4BF67E36DB4FBEBC01D0 /* IQKeyboardToolbarManager-IQKeyboardToolbarManager */ = { isa = PBXNativeTarget; - buildConfigurationList = EC63F6687A4C84131E235AAD4D9D25AC /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager-IQKeyboardToolbarManager" */; + buildConfigurationList = FB14A79E9663C6618BBD2C76C46813E0 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager-IQKeyboardToolbarManager" */; buildPhases = ( - 630C2621E6B31FD05FB8AC311E0B4A07 /* Sources */, - F36C7EF959F38C314D7D9C07F20214F9 /* Frameworks */, - 60539C5AB084616CA15632C0F8EDB3D5 /* Resources */, + 99AB743E6CD0E3D59DC85D1D3EB09F58 /* Sources */, + B6BB62FFBD45C60D8F1FE570CC1DE3E0 /* Frameworks */, + 4FFFE3948D9FFAB79CAAF0F200D0E6E5 /* Resources */, ); buildRules = ( ); @@ -2202,11 +2298,11 @@ }; 88810798DA63A2F6611B0970EA276DEC /* IQKeyboardReturnManager-IQKeyboardReturnManager */ = { isa = PBXNativeTarget; - buildConfigurationList = E83D8F80B1FA8720A2E4132EFD404E69 /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager-IQKeyboardReturnManager" */; + buildConfigurationList = 735C3EDC6E7EC2865AEDDDA1F2D19E8C /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager-IQKeyboardReturnManager" */; buildPhases = ( - 7BD0F092F53B46BD1CB6DE279ABBEC11 /* Sources */, - D7A42CDC1C43250CB900E1FB74D8B092 /* Frameworks */, - 8B575E871296BDF9E39B3A8DE6B08BFE /* Resources */, + 307995AFC08F0822D092E5D5758B3973 /* Sources */, + BDBD60A29BE8E581EB5EDCF60600BE9F /* Frameworks */, + D131BD6782772FFA2ECC8F582F04D18F /* Resources */, ); buildRules = ( ); @@ -2219,11 +2315,11 @@ }; 982A68D37F5DCBC1FC1FDC0BB2F0EB8E /* IQKeyboardManagerSwift-IQKeyboardManagerSwift */ = { isa = PBXNativeTarget; - buildConfigurationList = 9F2F12FF04A1DC0E7F0AF5684CA34C93 /* Build configuration list for PBXNativeTarget "IQKeyboardManagerSwift-IQKeyboardManagerSwift" */; + buildConfigurationList = 3403F131765FEBB242F76306FC5D0BB7 /* Build configuration list for PBXNativeTarget "IQKeyboardManagerSwift-IQKeyboardManagerSwift" */; buildPhases = ( - 2F0C79D724BB39D93125904136A41EA4 /* Sources */, - A6D81DF4CB996A5BEAA5DD9D77D0C0F3 /* Frameworks */, - C25114EED101FACEF0B204F6B67C34B8 /* Resources */, + 65F425CC367616BA8B92F0995F6C3106 /* Sources */, + C627275D6CBFEDB1B39AD4E3C7A62115 /* Frameworks */, + 5248776DEC427F90EDE5D5DA9CD00872 /* Resources */, ); buildRules = ( ); @@ -2236,17 +2332,17 @@ }; A26E6FD851C20D652B2755C1464A9990 /* IQKeyboardNotification */ = { isa = PBXNativeTarget; - buildConfigurationList = A4028273DF78599D569A697F515473BC /* Build configuration list for PBXNativeTarget "IQKeyboardNotification" */; + buildConfigurationList = 4E0C012C8888905B35911F70B1AC5AEF /* Build configuration list for PBXNativeTarget "IQKeyboardNotification" */; buildPhases = ( - 7680254C28B426011095084CBB09EA2A /* Headers */, - AD657BBD076081C4A57DB51B94542EF2 /* Sources */, - DCCD854A95878812F357EA2EBB20D31A /* Frameworks */, - 0E8A55941FBC56DFC2E1C8A1A076B7BA /* Resources */, + 7276EB2E5AA40AC97805906DEA7CD7FD /* Headers */, + 49A9263C40EAD1BD3295493C86F21618 /* Sources */, + 920BB55EA03141F9FEC988CF5499655C /* Frameworks */, + 889236CE0180F0C43842F1E2F4794D5F /* Resources */, ); buildRules = ( ); dependencies = ( - D510D6FDF9862C3FCAAAAA313D2BC549 /* PBXTargetDependency */, + B5C3DC4EC4CE4420FBA9801FCD1E6270 /* PBXTargetDependency */, ); name = IQKeyboardNotification; productName = IQKeyboardNotification; @@ -2255,11 +2351,11 @@ }; A6602BCAA6F4F932A586C41D0B7E019C /* IQTextView-IQTextView */ = { isa = PBXNativeTarget; - buildConfigurationList = 6988CE622F6ED709924CC52474D5D523 /* Build configuration list for PBXNativeTarget "IQTextView-IQTextView" */; + buildConfigurationList = E809C3838042546E636F2DB053A09E2B /* Build configuration list for PBXNativeTarget "IQTextView-IQTextView" */; buildPhases = ( - B9D284BA0BB1236DC3A6EA6CAA96F4BE /* Sources */, - B7AB75E5D475777E4C3BAD9B643ED838 /* Frameworks */, - 4AF9AACCDFC05B073702ED7FB0DD5D7B /* Resources */, + 56E30DE3D6A933A5BE21E6BC28F1394B /* Sources */, + A5B5101DC57939771E53F12E05DCEB38 /* Frameworks */, + 113A64BB798FD7C080C95BA6FD1541FC /* Resources */, ); buildRules = ( ); @@ -2272,11 +2368,11 @@ }; B247F77A0CD5E19C8187A9BA1EB58C09 /* IQKeyboardToolbar-IQKeyboardToolbar */ = { isa = PBXNativeTarget; - buildConfigurationList = 7B7782119E69124DD3565965BD15A882 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar-IQKeyboardToolbar" */; + buildConfigurationList = 77FFA3C6B014C764A235677BDA74421B /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar-IQKeyboardToolbar" */; buildPhases = ( - F20137CEA44AB166235CB3761C2E57F3 /* Sources */, - 902E85A742A01B8059EFA5B89DA66F7F /* Frameworks */, - A9820E377B74EAB51B6FF79FB1861197 /* Resources */, + 277D68DBEEA89C258D279027D7E243CE /* Sources */, + 1AB23A258F502AF32AD2AF5C8087AA1C /* Frameworks */, + 49110040D7B8222D83854A3154E78544 /* Resources */, ); buildRules = ( ); @@ -2299,12 +2395,12 @@ buildRules = ( ); dependencies = ( - A18D468817B057A7642DD6597AD5D57D /* PBXTargetDependency */, - 13CE0F457F6753EE32E8FB88BF7DD7F8 /* PBXTargetDependency */, - B0B1F438A4FD9457C082686C151CF10E /* PBXTargetDependency */, - 7A1E9DA85ECA063CAF07B94CC789DFC7 /* PBXTargetDependency */, - 2CCAC78656F98DEE5167C9844BA79CC7 /* PBXTargetDependency */, - C84A9864ABE031E2E302ADDB0E0BB052 /* PBXTargetDependency */, + D92D635FFCBAC07B10A2EF03F063A27A /* PBXTargetDependency */, + DB6A9F07CDE331CEF3799CE3A6CCF5F8 /* PBXTargetDependency */, + 6B3DC3EE73395FEEFA2D07353D24DBA9 /* PBXTargetDependency */, + FD08A4809C49D9071F6F4165742F73B5 /* PBXTargetDependency */, + FA7383946254CE1ED576095763780D1A /* PBXTargetDependency */, + 573E8B431E8BF8D16944F13F1C0DE9F5 /* PBXTargetDependency */, ); name = IQKeyboardManagerSwift; productName = IQKeyboardManagerSwift; @@ -2313,11 +2409,11 @@ }; EEE261386011CDF271BE289F73FF5959 /* IQKeyboardCore-IQKeyboardCore */ = { isa = PBXNativeTarget; - buildConfigurationList = 86208BF7557334C34C88E861EF42FB46 /* Build configuration list for PBXNativeTarget "IQKeyboardCore-IQKeyboardCore" */; + buildConfigurationList = 743BAE4B6D3212011B29C6FBCEF3F1CA /* Build configuration list for PBXNativeTarget "IQKeyboardCore-IQKeyboardCore" */; buildPhases = ( - 3AA94ED8AD41859B1F4CD14E8883BFEE /* Sources */, - EB4C499E90100393A2F36CAA19DA0329 /* Frameworks */, - CF075F936468EEC91F6597F94C2E9804 /* Resources */, + 6CBB0768541BAD89B84BFE14F9BA7373 /* Sources */, + 5E06627920B40924E21BA6A8C70B3619 /* Frameworks */, + F2BA76ACE865986489BBD73AB7A351FF /* Resources */, ); buildRules = ( ); @@ -2330,18 +2426,18 @@ }; F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */ = { isa = PBXNativeTarget; - buildConfigurationList = 9326D899006F80FE158FC378373C8595 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar" */; + buildConfigurationList = 42FF906DA5AB7C83C901286B2DEBB04E /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar" */; buildPhases = ( - 4F50052A170BD3C433BCDC9871047347 /* Headers */, - D0D52338359DD125AC23F4CD8D4E0026 /* Sources */, - FA5B37F87B05E58E873C97C8F4121D4E /* Frameworks */, - 80DF7293498270D65E9E60379E94D96E /* Resources */, + F1A788CB175CEB46CC2D355801709508 /* Headers */, + 37E96FED9DF757F885D6E1BBA237DA39 /* Sources */, + D5423F9C2E19B190FF95082DAF712AF0 /* Frameworks */, + 225822ECE15A96248D69E6F46CE56B3E /* Resources */, ); buildRules = ( ); dependencies = ( - 87027F7C2B24D7389E5ED0D1D7EB0FF3 /* PBXTargetDependency */, - E769300308672AE66F4679E79ABF421C /* PBXTargetDependency */, + 5375AE20C152FDE6AB69C04F0F29046F /* PBXTargetDependency */, + 66142B6A1CD90BF9F7AB3C00AC03D81A /* PBXTargetDependency */, ); name = IQKeyboardToolbar; productName = IQKeyboardToolbar; @@ -2360,7 +2456,7 @@ buildRules = ( ); dependencies = ( - 0A265E976551A0CE5B038DD60F48405F /* PBXTargetDependency */, + BC53EB257EF96B5B530977BB7E71E8CD /* PBXTargetDependency */, ); name = IQKeyboardCore; productName = IQKeyboardCore; @@ -2418,40 +2514,58 @@ F1E09035B7675D89EC69B16728E2833E /* UMAPM */, 09FABB7D06BB8D3958515FB15B4E7971 /* UMCommon */, CEB9AD2C3CFC208BFBE1F22F5EC3E1FC /* UMDevice */, + 40080C576D6EAF0D191988D3C110FE86 /* VolcEngineRTC */, 7F18C31A804695333763EEC303E265D7 /* WechatOpenSDK-XCFramework */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 0E8A55941FBC56DFC2E1C8A1A076B7BA /* Resources */ = { + 113A64BB798FD7C080C95BA6FD1541FC /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D7EDC1DE3A00099ECB44310E7C420B22 /* IQKeyboardNotification-IQKeyboardNotification in Resources */, + B66067B98F220793BA6B7E1FD8A500DD /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 0EFFDC53F19C2A4DEDEE2103D0643E93 /* Resources */ = { + 225822ECE15A96248D69E6F46CE56B3E /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - A601EBA1BC3752EF7B49222A1C5F0D70 /* IQTextView-IQTextView in Resources */, + D1A61DF48588AFBD1986A22CCFDA8FE6 /* IQKeyboardToolbar-IQKeyboardToolbar in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 1E3389B13F3713DABCD48373D5D98914 /* Resources */ = { + 318B6D1BB40994CE8CFA616C671A7AFD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9E2042CD11A31A6D96D06D20B7B44AE3 /* IQTextView-IQTextView in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 4AF9AACCDFC05B073702ED7FB0DD5D7B /* Resources */ = { + 387F246A1485E8339A81D080337D433D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9759B8BA30F41528B8D6C6D796D758BD /* PrivacyInfo.xcprivacy in Resources */, + AB800C9B59994C4897A2C4B4BB18A1A4 /* IQTextInputViewNotification-IQTextInputViewNotification in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 44A091017D212907E98A049763DC7AC9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C8F299839031777070C30485AD203821 /* IQKeyboardToolbarManager-IQKeyboardToolbarManager in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 49110040D7B8222D83854A3154E78544 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A8A225030C70D6832CF21149B56820A /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2463,43 +2577,35 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 59908003F5EB4C560351C9F4057F6FDF /* Resources */ = { + 4FFFE3948D9FFAB79CAAF0F200D0E6E5 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - B8402636FDBC65B4E50D293F80616D6B /* PrivacyInfo.xcprivacy in Resources */, + 9973B64437A151340E5531BEE1D96EDA /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 60539C5AB084616CA15632C0F8EDB3D5 /* Resources */ = { + 5248776DEC427F90EDE5D5DA9CD00872 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 73E5FDFB080961A009BDB44B202BFB57 /* PrivacyInfo.xcprivacy in Resources */, + 464100C3AAC75B5CA14AE36040292817 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 6485D775A89B9D841B3B0E53490A947D /* Resources */ = { + 6E5BFB4FCBA146BA6D109E9A1D9669A6 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - E20D69402A8EB87733D99631B63512F5 /* IQTextInputViewNotification-IQTextInputViewNotification in Resources */, + 24EE27EE96C2BB5CF8F92DC351D9DCC3 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 80DF7293498270D65E9E60379E94D96E /* Resources */ = { + 889236CE0180F0C43842F1E2F4794D5F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - C5CB4120589DF8072F87D78E2BAE7BB0 /* IQKeyboardToolbar-IQKeyboardToolbar in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8B575E871296BDF9E39B3A8DE6B08BFE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 791C3A33D30AC700243D4685CAB59EA7 /* PrivacyInfo.xcprivacy in Resources */, + 96655B828BFC55F28DAC17E9E404CFEC /* IQKeyboardNotification-IQKeyboardNotification in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2510,51 +2616,42 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - A9820E377B74EAB51B6FF79FB1861197 /* Resources */ = { + 9A6507B4E9026411FBA0D8BE5E84438F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2C730EA2EAA103C35CBEFAB503879980 /* PrivacyInfo.xcprivacy in Resources */, + EB3D7CFBFECE122987E4BB05A670BD77 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - AFB9D90B0819926ED1C202A31C2A8FB9 /* Resources */ = { + D131BD6782772FFA2ECC8F582F04D18F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - CD02AEC4AE908A557E2DDEADFB5E75EA /* IQKeyboardToolbarManager-IQKeyboardToolbarManager in Resources */, + 2334750B311385DD4A7F9114AA555605 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - B4564AE26629C32AD6A5634EBBF6062D /* Resources */ = { + EA9C42E6F04A4AD059D55FFEC56C5A79 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1EDF6B321C32F18C59FF1A110F1A7542 /* PrivacyInfo.xcprivacy in Resources */, + EE8C318C9FE25194E1CC517C668E8C26 /* IQKeyboardReturnManager-IQKeyboardReturnManager in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - C25114EED101FACEF0B204F6B67C34B8 /* Resources */ = { + EE67AA31D2D3A2BE153A3FCC903369FA /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7CCA3371017E9A9E03A8BEB175DB8414 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - CF075F936468EEC91F6597F94C2E9804 /* Resources */ = { + F2BA76ACE865986489BBD73AB7A351FF /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6C96447A8AE98F4D3BDF939F7266C57F /* PrivacyInfo.xcprivacy in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F864370B46A2030CD2D29BB63BF9964C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 20AA7AC737EFD9101D0CA80E389B88ED /* IQKeyboardReturnManager-IQKeyboardReturnManager in Resources */, + F72093BE3E74BB70AAE01BAC0915A6F5 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2586,23 +2683,6 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/WechatOpenSDK-XCFramework/WechatOpenSDK-XCFramework-xcframeworks.sh\"\n"; showEnvVarsInLog = 0; }; - 22BE81B1621BDC2850C4141134417CBC /* [CP] Copy XCFrameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/UMDevice/UMDevice-xcframeworks-input-files.xcfilelist", - ); - name = "[CP] Copy XCFrameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/UMDevice/UMDevice-xcframeworks-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/UMDevice/UMDevice-xcframeworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 329295F5A096E0819713CBB5799FA87B /* [CP] Copy XCFrameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -2620,7 +2700,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/JPush/JPush-xcframeworks.sh\"\n"; showEnvVarsInLog = 0; }; - 49D5D275B9638EA1DE91DD3E23193CB6 /* [CP] Copy XCFrameworks */ = { + 687BC05C1C9FCCA798AEC343D76C61BA /* [CP] Copy XCFrameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -2671,71 +2751,147 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/UMAPM/UMAPM-xcframeworks.sh\"\n"; showEnvVarsInLog = 0; }; + ECDA6B91060A6384A59E2057D1742B26 /* [CP] Copy XCFrameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-input-files.xcfilelist", + ); + name = "[CP] Copy XCFrameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + EF59C84659DB739B12DAAEEB8A35993A /* [CP] Copy XCFrameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/UMDevice/UMDevice-xcframeworks-input-files.xcfilelist", + ); + name = "[CP] Copy XCFrameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/UMDevice/UMDevice-xcframeworks-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/UMDevice/UMDevice-xcframeworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 2AAF5011D324DFA6F8DF4F369E9112D7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4514FAA3C174519C3DB0A39CCE329F2B /* IQKeyboardReturnManager.swift in Sources */, - 85ED9426CDED97B9C5F563C4BBCE506D /* IQKeyboardReturnManager+UITextFieldDelegate.swift in Sources */, - AC2BDAA5ABD21D76EAAF213256C8B8E9 /* IQKeyboardReturnManager+UITextViewDelegate.swift in Sources */, - 7D7049ABBC602DFAA8118688EDE0C5F9 /* IQKeyboardReturnManager-dummy.m in Sources */, - 9DF018FD9B2DA31BB1FF9830ED380650 /* IQTextInputViewInfoModel.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2F0C79D724BB39D93125904136A41EA4 /* Sources */ = { + 137EC40D310D4704B880AD14CE694EEC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 34C275CAECED9D6901747FC1405E6B98 /* Sources */ = { + 16FB8B1524EE90D9270AC5FCD1D8560D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - EBD56E9E283017BD6BAE73D17BB996BA /* Pods-suixinkan-dummy.m in Sources */, + 16EC398493578D82A603A74BBEDF61DE /* Array+Sort.swift in Sources */, + 7973C48AD6DC2FBEBF2D2CDD685AF8CF /* IQDeepResponderContainerView.swift in Sources */, + 84ADFCB3B5116D452F2283B2C93A6544 /* IQKeyboardToolbarConfiguration.swift in Sources */, + 023968E1994C2A76DED24E2225272452 /* IQKeyboardToolbarConstants.swift in Sources */, + 1EEBBF88610B1114E92B5B2C3CB0CD3A /* IQKeyboardToolbarManager.swift in Sources */, + A1F33D56C9A16A4A364BBC2BC6190FC8 /* IQKeyboardToolbarManager+Action.swift in Sources */, + EDBC65971BDA677118EA352344E2A651 /* IQKeyboardToolbarManager+Debug.swift in Sources */, + A4F94A48BC77E0309D075DDE904D6F98 /* IQKeyboardToolbarManager+Deprecated.swift in Sources */, + 31FA5537FB0621C5A8A4AFE359CB4096 /* IQKeyboardToolbarManager+Internal.swift in Sources */, + 79392C6B2D1DDCB948DA3383908E91EF /* IQKeyboardToolbarManager+Toolbar.swift in Sources */, + 1914F573E861800FD3E11C47F385F514 /* IQKeyboardToolbarManager-dummy.m in Sources */, + 0D09F2E4090347B87C0D1233FA5DA053 /* UIView+Responders.swift in Sources */, + FBB34EDA47D49D765C84087E6684097D /* UIView+RespondersObjc.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 3AA94ED8AD41859B1F4CD14E8883BFEE /* Sources */ = { + 1C059343D1ECF3932E37BC8394B7FE01 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 425CEB81B0796AC6015FF81B68024078 /* Sources */ = { + 1F6ADB788CA64307098F2D30CE014BDC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 50B903F6549D7A6DDA2DF594829F24C0 /* IQTextInputViewInfo.swift in Sources */, - F83AB9BDBF91C11FCF608D35D84E7F78 /* IQTextInputViewNotification.swift in Sources */, - 9701D7F75D716DA6CF8F1D3693ADCFCD /* IQTextInputViewNotification-dummy.m in Sources */, + 6FC415C672CEECF110E3AE9293F370FB /* IQKeyboardReturnManager.swift in Sources */, + C8E0B1AB7F74F72DDCBB1B9854DC4621 /* IQKeyboardReturnManager+UITextFieldDelegate.swift in Sources */, + 25F07A0332F0686B4D52E0430ACA4050 /* IQKeyboardReturnManager+UITextViewDelegate.swift in Sources */, + 54CE02B6FF7C86515599D09F5AE97AC2 /* IQKeyboardReturnManager-dummy.m in Sources */, + 105766C76A96ECCBD2CC894D747781C7 /* IQTextInputViewInfoModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 630C2621E6B31FD05FB8AC311E0B4A07 /* Sources */ = { + 277D68DBEEA89C258D279027D7E243CE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 645C6BEE5C5F8EA94CA1B8A824E0A223 /* Sources */ = { + 307995AFC08F0822D092E5D5758B3973 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 789681091CE951D7A2AFAEDDB746D97E /* IQTextView.swift in Sources */, - D9FD33E409638FCAD07C69B35A06ADC2 /* IQTextView+Placeholderable.swift in Sources */, - 85773133CDEE15E726293BDB7E7B2CF0 /* IQTextView-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 64C9A2B5DDBB99DEAF940C9FE46F858F /* Sources */ = { + 37E96FED9DF757F885D6E1BBA237DA39 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CB8B874662D19B8230CFBED0583C8879 /* IQBarButtonItem.swift in Sources */, + E8CD2C2FF3756F1E72ABA275868B8AC5 /* IQBarButtonItemConfiguration.swift in Sources */, + 3A6CF818BB50747C26A1C574B6ADCFF5 /* IQInvocation.swift in Sources */, + 263FE1F43F1D8E1B46C6313B5641FE3B /* IQKeyboardToolbar.swift in Sources */, + 494B35A30767517DDF2768CE032A36F3 /* IQKeyboardToolbar-dummy.m in Sources */, + BEF7421741D27DC0377B21A20DA375B0 /* IQKeyboardToolbarPlaceholderConfiguration.swift in Sources */, + 4F78DB926808F54F15EAE5150D08CD7F /* IQPlaceholderable.swift in Sources */, + 1C2C67EA4C7B2B68FC4589BDCCD3B533 /* IQTitleBarButtonItem.swift in Sources */, + D7D00E5346E5508D9D53EC7481B5D506 /* UIView+IQKeyboardExtension.swift in Sources */, + 7AD979D5CC2083E382D296DE8B0A644D /* UIView+IQKeyboardExtensionDeprecated.swift in Sources */, + B1FD1C28976551248F427CC7E76FABDC /* UIView+IQKeyboardExtensionObjc.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 450A4DC21C0978C791026911634DB62D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB877946AF70E70BA6EC7FDAEB227012 /* Pods-suixinkan-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 49A9263C40EAD1BD3295493C86F21618 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB6CC3B98AFFD293CAE8AD23B0FC9AAE /* IQKeyboardInfo.swift in Sources */, + F00FA86A7B52D89294324E2F04BAC22A /* IQKeyboardNotification.swift in Sources */, + 83EEFF802E4CAF422F9C3BA57EE92721 /* IQKeyboardNotification-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 56E30DE3D6A933A5BE21E6BC28F1394B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65F425CC367616BA8B92F0995F6C3106 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -2750,30 +2906,27 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7BD0F092F53B46BD1CB6DE279ABBEC11 /* Sources */ = { + 6CBB0768541BAD89B84BFE14F9BA7373 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 7F8A34EF840A89732F331227732CE6A3 /* Sources */ = { + 7C5B5B7060E55C22BBA5A2C7540066B8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8032C9E476F728B6BE252AADD5A46F48 /* IQTextView.swift in Sources */, + 8D536472BDF9BC28A40B2A6FD1CEEBA5 /* IQTextView+Placeholderable.swift in Sources */, + 67E64022C5EA54D4143D421708FB4552 /* IQTextView-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99AB743E6CD0E3D59DC85D1D3EB09F58 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7FD5748EB56A4E3BF6D2ED701B2D213D /* Array+Sort.swift in Sources */, - DB99760495689B430C2E2398C481C2FF /* IQDeepResponderContainerView.swift in Sources */, - 7DA65932A24360D599F10035119EA5E2 /* IQKeyboardToolbarConfiguration.swift in Sources */, - 31EF2638094D4B4F5927495A2B7D798B /* IQKeyboardToolbarConstants.swift in Sources */, - A8D34B7B91FA733D2AED15AB04B892BD /* IQKeyboardToolbarManager.swift in Sources */, - E758379D510D62830AFF306D4630B954 /* IQKeyboardToolbarManager+Action.swift in Sources */, - 1369B279D519A23EADFE21DC37795BF7 /* IQKeyboardToolbarManager+Debug.swift in Sources */, - 152B0D3FD8A2881CB69B710D55974FB9 /* IQKeyboardToolbarManager+Deprecated.swift in Sources */, - 339BEA53AF28A59C4663E40B91D9B370 /* IQKeyboardToolbarManager+Internal.swift in Sources */, - 0A44FCC4CCED0CBED8CC3FED0B036F21 /* IQKeyboardToolbarManager+Toolbar.swift in Sources */, - 7140EFC50C715BE19C49D09F4E8B001E /* IQKeyboardToolbarManager-dummy.m in Sources */, - C60607D4D2571A1535BECED712926730 /* UIView+Responders.swift in Sources */, - 812AC92889B2ADB26628EC2A23707B05 /* UIView+RespondersObjc.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2828,328 +2981,330 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - AD657BBD076081C4A57DB51B94542EF2 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E262B2578F75C70185C656E333DF925F /* IQKeyboardInfo.swift in Sources */, - FEA09EA9224F5FE424E0B9FA2AE5B02F /* IQKeyboardNotification.swift in Sources */, - 3EAF4037851BF1BBAB5916DB7F601763 /* IQKeyboardNotification-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B9D284BA0BB1236DC3A6EA6CAA96F4BE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D0D52338359DD125AC23F4CD8D4E0026 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1262CF3C963C0DA764124961D439B49F /* IQBarButtonItem.swift in Sources */, - 876991BF59C2E072FCCAA538D58EE3E9 /* IQBarButtonItemConfiguration.swift in Sources */, - 20302EF7FDF8788C2A52BEC837617E24 /* IQInvocation.swift in Sources */, - 2F0C1DF6BCC18175DF00FA36A403917E /* IQKeyboardToolbar.swift in Sources */, - F91DE04D9AFE6368A31CF627F06D1C05 /* IQKeyboardToolbar-dummy.m in Sources */, - 7FDC7630F10411A4DEB79549E69F5F5F /* IQKeyboardToolbarPlaceholderConfiguration.swift in Sources */, - 126F042D4B2F340DE3138253C1BD9C99 /* IQPlaceholderable.swift in Sources */, - BFC5DD1D47E9627393B920979F569A69 /* IQTitleBarButtonItem.swift in Sources */, - E8A74201D2F78C69C857A500D88D7F5D /* UIView+IQKeyboardExtension.swift in Sources */, - AACCF3AA32BE2187677FD50706AD7476 /* UIView+IQKeyboardExtensionDeprecated.swift in Sources */, - 0B711521C37380AB3ED0C13EF0FAF9A6 /* UIView+IQKeyboardExtensionObjc.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DED4AD5DD92DDDC160258A036A443D26 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F20137CEA44AB166235CB3761C2E57F3 /* Sources */ = { + B229D9E15F75A5D7AB8DDE0C39302879 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 87DBE1CA85B65864BA2BD8EE27B64F74 /* IQTextInputViewInfo.swift in Sources */, + EC1FAF704B6CCC979D6B0CA2078879AE /* IQTextInputViewNotification.swift in Sources */, + 1AF7EC23421E175ACC93A42C105CEA49 /* IQTextInputViewNotification-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 0289564FC881345A79BD1B6531FF3219 /* PBXTargetDependency */ = { + 041E2CC6DFE2A6B560D8CFA2B4D906B8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = "IQTextInputViewNotification-IQTextInputViewNotification"; - target = 4502C7427440BEB17A50C0BF6E638A85 /* IQTextInputViewNotification-IQTextInputViewNotification */; - targetProxy = 5F9AD0BD2225542820663819BA76D223 /* PBXContainerItemProxy */; + name = IQKeyboardToolbar; + target = F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */; + targetProxy = 32A57258A4AAEEF1E6305E7B310D0005 /* PBXContainerItemProxy */; }; - 04FCE446D622C5939DA314959342DC88 /* PBXTargetDependency */ = { + 05A1AEC02A423CBCC2DFC09F9D4FFB74 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "AMapFoundation-NO-IDFA"; + target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; + targetProxy = EE602595474CE7E67736CFB324228CB5 /* PBXContainerItemProxy */; + }; + 0D0ACD494A09D4697A9F058A054B15B9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = IQKeyboardCore; target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; - targetProxy = D14881F3DD881DBB4CFEFFA8095A0E8F /* PBXContainerItemProxy */; + targetProxy = 1129C0F5CD23D293033E4EAA5D1BD4C0 /* PBXContainerItemProxy */; }; - 0A265E976551A0CE5B038DD60F48405F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQKeyboardCore-IQKeyboardCore"; - target = EEE261386011CDF271BE289F73FF5959 /* IQKeyboardCore-IQKeyboardCore */; - targetProxy = A9B14D84173A1A00F4C4BA2CE94FCA5E /* PBXContainerItemProxy */; - }; - 13CE0F457F6753EE32E8FB88BF7DD7F8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardNotification; - target = A26E6FD851C20D652B2755C1464A9990 /* IQKeyboardNotification */; - targetProxy = C1A38D27A9A8F1A9E472CCC307883FD0 /* PBXContainerItemProxy */; - }; - 1B8EC6C3953225A69E2312C224DD5150 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = JCore; - target = D504B99928659EA67A1C3A9E981EB8FF /* JCore */; - targetProxy = 77340A1E87646633F9EA52E66E57B674 /* PBXContainerItemProxy */; - }; - 257C046139A332001B37EC1DC9581A88 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardToolbar; - target = F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */; - targetProxy = 3A4000632C423DFB42EDDDE2ED54B0AE /* PBXContainerItemProxy */; - }; - 2CCAC78656F98DEE5167C9844BA79CC7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQTextInputViewNotification; - target = 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */; - targetProxy = F9FB1958F0A6F81C94A74B5EF9C0350D /* PBXContainerItemProxy */; - }; - 36CDBF917A60EEFE38DD2F7C79B0B9B4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "Pods-suixinkan"; - target = 1DE17B7C77CD95CB67DF1197965B76AB /* Pods-suixinkan */; - targetProxy = 9F0C8DA2DAAB44671B01D41E79934E46 /* PBXContainerItemProxy */; - }; - 40B551A587D49784793075111A2B43DA /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQTextInputViewNotification; - target = 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */; - targetProxy = 1E28E961A0B3C66B143F0D83DEAE38D8 /* PBXContainerItemProxy */; - }; - 423901BB0BC7656034EFDA6B76B2414C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQKeyboardToolbarManager-IQKeyboardToolbarManager"; - target = 7C5613175BBC4BF67E36DB4FBEBC01D0 /* IQKeyboardToolbarManager-IQKeyboardToolbarManager */; - targetProxy = 4F8E9DD83779B38B70DC679422847A4C /* PBXContainerItemProxy */; - }; - 43B6F441EC86468D6C229FFE788CFF86 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "AMapFoundation-NO-IDFA"; - target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; - targetProxy = A68FC33FBFEBF6E0FC9A3004CD375308 /* PBXContainerItemProxy */; - }; - 43D53F6BFEB39F4503F44F84FBEC23F7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = UMCommon; - target = 09FABB7D06BB8D3958515FB15B4E7971 /* UMCommon */; - targetProxy = 869CC868A322E78A78D6BBABA14E7C8C /* PBXContainerItemProxy */; - }; - 4A686003582098B259DDA20E5FC9D323 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQKeyboardReturnManager-IQKeyboardReturnManager"; - target = 88810798DA63A2F6611B0970EA276DEC /* IQKeyboardReturnManager-IQKeyboardReturnManager */; - targetProxy = 1F093A748267B19E1B59DF90F454A7BC /* PBXContainerItemProxy */; - }; - 4D7527C0D0F449074058BC407459B048 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "AMapFoundation-NO-IDFA"; - target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; - targetProxy = 713D4F0ABEA99574CA78A6A200B6E9F3 /* PBXContainerItemProxy */; - }; - 559B5DC039C8981EEE9696C323082915 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "AMap3DMap-NO-IDFA"; - target = B44FB02BD2D3FEAD1F36808AD405A543 /* AMap3DMap-NO-IDFA */; - targetProxy = FA244E0E1C3D5E471F57BE915A6F2E14 /* PBXContainerItemProxy */; - }; - 57354DDB8E699721C452977695B263FD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardToolbar; - target = F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */; - targetProxy = 9A3A247AD57EFF42E6B410B78E061CF8 /* PBXContainerItemProxy */; - }; - 5FE0DAE0602EB758297B19F4328BC38D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardToolbar; - target = F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */; - targetProxy = 147ED37FE72D28DAFEC90706C048C6EA /* PBXContainerItemProxy */; - }; - 65ACB98E7ACF99994DC0973B228171CD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = UMDevice; - target = CEB9AD2C3CFC208BFBE1F22F5EC3E1FC /* UMDevice */; - targetProxy = 4907ED9E73DED3B716A419CFFDDD78CF /* PBXContainerItemProxy */; - }; - 73511E9AA76ADF17F178F12B12FB430A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = UMCommon; - target = 09FABB7D06BB8D3958515FB15B4E7971 /* UMCommon */; - targetProxy = 62652A6D5809456307591E683A677266 /* PBXContainerItemProxy */; - }; - 78F427895C6768AC1AB392721DAE9200 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardNotification; - target = A26E6FD851C20D652B2755C1464A9990 /* IQKeyboardNotification */; - targetProxy = F094983E31D5376CF92A3C4ED2F97C3F /* PBXContainerItemProxy */; - }; - 7A1E9DA85ECA063CAF07B94CC789DFC7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardToolbarManager; - target = 020993F16DA5986DACE118349EBCE9E5 /* IQKeyboardToolbarManager */; - targetProxy = 08160729EBF68D12D8DEF8050CD42989 /* PBXContainerItemProxy */; - }; - 7E7528850A1FDD26B1FE2E8099A38A91 /* PBXTargetDependency */ = { + 0E01BAE168991620CF6F48B3D188BA53 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "AMapSearch-NO-IDFA"; target = 4F1379598302C9160590B3650C10E1A5 /* AMapSearch-NO-IDFA */; - targetProxy = EFBECFEAB6CF3583EF396FC63DA3AAB3 /* PBXContainerItemProxy */; + targetProxy = 104963582BC50C41EF70065E5258EB55 /* PBXContainerItemProxy */; }; - 82D472A757E3AE733E285863E4FF7C29 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = JCore; - target = D504B99928659EA67A1C3A9E981EB8FF /* JCore */; - targetProxy = F608B4EA9716A1DF6EB5F14E89C57644 /* PBXContainerItemProxy */; - }; - 87027F7C2B24D7389E5ED0D1D7EB0FF3 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardCore; - target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; - targetProxy = 718E32BB22D5761863712D50A719B13E /* PBXContainerItemProxy */; - }; - 87C4B1E7F9C8681284EF020BA2CE7232 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQTextInputViewNotification; - target = 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */; - targetProxy = A2FC1D93AA2AE0116D85F839E3630642 /* PBXContainerItemProxy */; - }; - 91835F72D032F3FBDE03F331CD1BE842 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "AMapLocation-NO-IDFA"; - target = 4BD4E22D3419D68A85BDD6119CB37C6C /* AMapLocation-NO-IDFA */; - targetProxy = 37EA5367B185E8D73C585D76CFA12A67 /* PBXContainerItemProxy */; - }; - 93501992D2687169C9D64ECF593AAFB5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "AMapFoundation-NO-IDFA"; - target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; - targetProxy = D07BB67961D258DFD6D4770BB99DE59A /* PBXContainerItemProxy */; - }; - 9878FADAAA880FFB5292FEA6B7285FF5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQTextView; - target = 12890DE3ABBC2CA295E108358D85EE69 /* IQTextView */; - targetProxy = C6AC669F30329ABDA94DBB8071DD78C3 /* PBXContainerItemProxy */; - }; - A18D468817B057A7642DD6597AD5D57D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQKeyboardManagerSwift-IQKeyboardManagerSwift"; - target = 982A68D37F5DCBC1FC1FDC0BB2F0EB8E /* IQKeyboardManagerSwift-IQKeyboardManagerSwift */; - targetProxy = AD834305DA2DE95480DD793BAACDD5CB /* PBXContainerItemProxy */; - }; - B0B1F438A4FD9457C082686C151CF10E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardReturnManager; - target = 0981F89DB5DA3FFCFFEBDE1F56287054 /* IQKeyboardReturnManager */; - targetProxy = C5A9E170B59A24C216A060F404429E41 /* PBXContainerItemProxy */; - }; - B4ED9F2608DCFF0DE645E679F965467F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = UMAPM; - target = F1E09035B7675D89EC69B16728E2833E /* UMAPM */; - targetProxy = 08C0B54B9FA330846FEB6A183A5D6742 /* PBXContainerItemProxy */; - }; - BC8F860A2D02AB8F29AA5B639971E84A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardManagerSwift; - target = B490E7485944099E16C9CBD79119D1D4 /* IQKeyboardManagerSwift */; - targetProxy = 3C509F104E60FE2C27E0B3C891C979DA /* PBXContainerItemProxy */; - }; - C6B684446AAB0C7A81EF869A2830679A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQTextView-IQTextView"; - target = A6602BCAA6F4F932A586C41D0B7E019C /* IQTextView-IQTextView */; - targetProxy = 8412429FAD3C39A715015569D46CB6CF /* PBXContainerItemProxy */; - }; - C84A9864ABE031E2E302ADDB0E0BB052 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQTextView; - target = 12890DE3ABBC2CA295E108358D85EE69 /* IQTextView */; - targetProxy = 198F2A9B122C5AFDA9BA2CAD713C9CDF /* PBXContainerItemProxy */; - }; - D1BAD58FB1961F1DB3B113E93A03AF29 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardCore; - target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; - targetProxy = 4CB9062557A28267D22F4E20A2927AD4 /* PBXContainerItemProxy */; - }; - D4853B8A651ECA6D156A2EF893BAA13A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "AMapFoundation-NO-IDFA"; - target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; - targetProxy = 47CF81B26EE0AE51709688B148A7662A /* PBXContainerItemProxy */; - }; - D510D6FDF9862C3FCAAAAA313D2BC549 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQKeyboardNotification-IQKeyboardNotification"; - target = 2B8FF445A5162845FAB9EC00FC92B694 /* IQKeyboardNotification-IQKeyboardNotification */; - targetProxy = C02B574389C3B5B10F5BF8E806AD24A3 /* PBXContainerItemProxy */; - }; - D75775B1CDD4D1DBFD4D66F94CD5CF03 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardReturnManager; - target = 0981F89DB5DA3FFCFFEBDE1F56287054 /* IQKeyboardReturnManager */; - targetProxy = 5B8957EC1CB8F95A847120AD59DDEFAB /* PBXContainerItemProxy */; - }; - D8E393A29EF660C4A48ACF8426C25D32 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardCore; - target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; - targetProxy = 43375E8A7E5DEE972D5A3A7CC55C741F /* PBXContainerItemProxy */; - }; - D9FB833B6E0D570E62522324BCDCB420 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = IQKeyboardToolbarManager; - target = 020993F16DA5986DACE118349EBCE9E5 /* IQKeyboardToolbarManager */; - targetProxy = 2D17082BDAA079066A9B2943E85BE982 /* PBXContainerItemProxy */; - }; - E769300308672AE66F4679E79ABF421C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "IQKeyboardToolbar-IQKeyboardToolbar"; - target = B247F77A0CD5E19C8187A9BA1EB58C09 /* IQKeyboardToolbar-IQKeyboardToolbar */; - targetProxy = CF667262D25773528EC51D3D7DA7FCB9 /* PBXContainerItemProxy */; - }; - EBDABB0A79F03526A3A3A7726153BCC6 /* PBXTargetDependency */ = { + 11F9B04ED25D4D44F2064FBB7DE683D6 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = JPush; target = 5FB6AB0A09E7A2F2BE11AD6BAEFD9AED /* JPush */; - targetProxy = 133C2EC85A61CDF06B89A71B3F3FB832 /* PBXContainerItemProxy */; + targetProxy = E072D63C2E1B1FE4AD77BB97B7B340C2 /* PBXContainerItemProxy */; }; - EBF5E69FEE7E49D4E80788A055AE67C5 /* PBXTargetDependency */ = { + 13504B3EA0645BC1C860440A351676E5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = JCore; + target = D504B99928659EA67A1C3A9E981EB8FF /* JCore */; + targetProxy = 1E572DA8CD240673FDA5DB3905A149D4 /* PBXContainerItemProxy */; + }; + 204FD388CFB176C0766F60CB1CAEBA86 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "AMapLocation-NO-IDFA"; + target = 4BD4E22D3419D68A85BDD6119CB37C6C /* AMapLocation-NO-IDFA */; + targetProxy = D3AA7945DC9B9DA743437AFFE1EA88F2 /* PBXContainerItemProxy */; + }; + 20F0375C486E250BB5232F4758D576A4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardToolbarManager; + target = 020993F16DA5986DACE118349EBCE9E5 /* IQKeyboardToolbarManager */; + targetProxy = BDBF652935F74D29067118B5FCCE9CC5 /* PBXContainerItemProxy */; + }; + 27FAD84781762A448335ECCCDDC9E42E /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "WechatOpenSDK-XCFramework"; target = 7F18C31A804695333763EEC303E265D7 /* WechatOpenSDK-XCFramework */; - targetProxy = 168E86429E4140AB7AE450B6F636B64E /* PBXContainerItemProxy */; + targetProxy = 7A77A5B3886021A7107293AFFA6952B0 /* PBXContainerItemProxy */; }; - EEB39FDC8A236AB428E4BA853F5A9139 /* PBXTargetDependency */ = { + 2EAF3D32B47629317952DB929164BAB2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardCore; + target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; + targetProxy = 67F7A60D7720446A869535A96F3545C0 /* PBXContainerItemProxy */; + }; + 337C96201808509507CA774D119D9AD8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQTextView; + target = 12890DE3ABBC2CA295E108358D85EE69 /* IQTextView */; + targetProxy = ED17866C6B82B5FD1FFDB8382E1E23FF /* PBXContainerItemProxy */; + }; + 40E019D5F164716D9B37FF8FD2E3CAC0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardToolbar; + target = F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */; + targetProxy = 793C2D3C9FEB330D539F7F26A32E632C /* PBXContainerItemProxy */; + }; + 4BDB84F42661A88DB4AE7F506CD672F4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardCore; + target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; + targetProxy = 01D18C0819E8839BA684925E4171A531 /* PBXContainerItemProxy */; + }; + 4F6360FC32BA6CA3C9D8A7A764A273B9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = UMDevice; target = CEB9AD2C3CFC208BFBE1F22F5EC3E1FC /* UMDevice */; - targetProxy = F9D06F8A081789EC565FDAA1773A6650 /* PBXContainerItemProxy */; + targetProxy = BEE3E2E0449835ECC392F9790745E3EA /* PBXContainerItemProxy */; + }; + 4F986259884CF9231BAD66B79A8367CA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQKeyboardToolbarManager-IQKeyboardToolbarManager"; + target = 7C5613175BBC4BF67E36DB4FBEBC01D0 /* IQKeyboardToolbarManager-IQKeyboardToolbarManager */; + targetProxy = A5DEF6E6B93482A0654D2EBF62442688 /* PBXContainerItemProxy */; + }; + 52A718AAC261E51A6EE91D1E3D571C27 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardNotification; + target = A26E6FD851C20D652B2755C1464A9990 /* IQKeyboardNotification */; + targetProxy = 6A637EE80FDCC14586BC4A2357809349 /* PBXContainerItemProxy */; + }; + 5375AE20C152FDE6AB69C04F0F29046F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardCore; + target = F9A1BF709B7BA4C24A83664EB1E1C7D4 /* IQKeyboardCore */; + targetProxy = DA172C18A690AAECA4B5A3D4C12D56AA /* PBXContainerItemProxy */; + }; + 573E8B431E8BF8D16944F13F1C0DE9F5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQTextView; + target = 12890DE3ABBC2CA295E108358D85EE69 /* IQTextView */; + targetProxy = 072D6CAC4C4199F09765E95E9CADD3E7 /* PBXContainerItemProxy */; + }; + 57C5226AB4AFFE43C654081EC80A85B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardReturnManager; + target = 0981F89DB5DA3FFCFFEBDE1F56287054 /* IQKeyboardReturnManager */; + targetProxy = 52E917FAA10BBBE17F522043CCD589A1 /* PBXContainerItemProxy */; + }; + 5C5D15AAD292B83C1872ABD6D6AC563D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = UMCommon; + target = 09FABB7D06BB8D3958515FB15B4E7971 /* UMCommon */; + targetProxy = 94FC7A64B621994C5E02C3C7B1C50D97 /* PBXContainerItemProxy */; + }; + 66142B6A1CD90BF9F7AB3C00AC03D81A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQKeyboardToolbar-IQKeyboardToolbar"; + target = B247F77A0CD5E19C8187A9BA1EB58C09 /* IQKeyboardToolbar-IQKeyboardToolbar */; + targetProxy = 85E234DCBE75440A7CD79BF12FF11C72 /* PBXContainerItemProxy */; + }; + 66DF1AD9D3E97349A96E5F5C90757C68 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "AMapFoundation-NO-IDFA"; + target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; + targetProxy = 89FB9D8FBE659E0556840B05F9146FEB /* PBXContainerItemProxy */; + }; + 6B3DC3EE73395FEEFA2D07353D24DBA9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardReturnManager; + target = 0981F89DB5DA3FFCFFEBDE1F56287054 /* IQKeyboardReturnManager */; + targetProxy = F595694C90F4FF142AD0682F79BC0066 /* PBXContainerItemProxy */; + }; + 706EF92721F065D187D2BB79F574C847 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQTextView-IQTextView"; + target = A6602BCAA6F4F932A586C41D0B7E019C /* IQTextView-IQTextView */; + targetProxy = 0C9E79873973D9E950237E695A8EE7FE /* PBXContainerItemProxy */; + }; + 75C7A3492D85446BC94DFAD73EF4FF03 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = JCore; + target = D504B99928659EA67A1C3A9E981EB8FF /* JCore */; + targetProxy = E3D22E58F959CB9DF7B79C4E5D8175A2 /* PBXContainerItemProxy */; + }; + 7A9D23AB68ABBF5DE686EF168016478D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = UMCommon; + target = 09FABB7D06BB8D3958515FB15B4E7971 /* UMCommon */; + targetProxy = E8EB0BAF47F22FD1C2A551B4318E2AE4 /* PBXContainerItemProxy */; + }; + 7B659A53BDE555DBF687F9AF5C5363FC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "AMapFoundation-NO-IDFA"; + target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; + targetProxy = 7E134C5A3ECB28A0092D93FDADCD88F6 /* PBXContainerItemProxy */; + }; + 9E9BD81B51490D7C334A5A60FE1111D0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardManagerSwift; + target = B490E7485944099E16C9CBD79119D1D4 /* IQKeyboardManagerSwift */; + targetProxy = 3F0020DA13C4BE480F10A0524490A4AB /* PBXContainerItemProxy */; + }; + A29280CF0ECF52479D7F88904ED009B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "AMapFoundation-NO-IDFA"; + target = 9B182CB4E1716E9070813D3C59736001 /* AMapFoundation-NO-IDFA */; + targetProxy = B639DB1BCA73C9D02E5BE0CC18E69C5B /* PBXContainerItemProxy */; + }; + A3132469DDB9CC498C41B9FCD5ED3A2A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQTextInputViewNotification; + target = 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */; + targetProxy = F7356744E89632201B581A2D5BCAF069 /* PBXContainerItemProxy */; + }; + AE5B9CB6019FDEFD3C68ECD10629DCD0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = UMDevice; + target = CEB9AD2C3CFC208BFBE1F22F5EC3E1FC /* UMDevice */; + targetProxy = 36117BA18D436FE6D0DE6B596B931149 /* PBXContainerItemProxy */; + }; + B5C3DC4EC4CE4420FBA9801FCD1E6270 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQKeyboardNotification-IQKeyboardNotification"; + target = 2B8FF445A5162845FAB9EC00FC92B694 /* IQKeyboardNotification-IQKeyboardNotification */; + targetProxy = 725E75FD278AFD2F4826D8DDEAF4AC8F /* PBXContainerItemProxy */; + }; + B6E8DB3BD84A7E9508C6CF96915F005B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "AMap3DMap-NO-IDFA"; + target = B44FB02BD2D3FEAD1F36808AD405A543 /* AMap3DMap-NO-IDFA */; + targetProxy = BD6AFA6FE9B294C3A16AB8960B43D384 /* PBXContainerItemProxy */; + }; + BC53EB257EF96B5B530977BB7E71E8CD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQKeyboardCore-IQKeyboardCore"; + target = EEE261386011CDF271BE289F73FF5959 /* IQKeyboardCore-IQKeyboardCore */; + targetProxy = 405A63C2CBD0544A9007623125E06AE7 /* PBXContainerItemProxy */; + }; + C206BE584D88B37ECDC3054891961C63 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardToolbar; + target = F4FE17428FD0E607723A44F17231B7A1 /* IQKeyboardToolbar */; + targetProxy = 0D8FE846DDF88044667D938580E2F373 /* PBXContainerItemProxy */; + }; + C642A9DA4392C05C201A535CDBA4D0B7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = VolcEngineRTC; + target = 40080C576D6EAF0D191988D3C110FE86 /* VolcEngineRTC */; + targetProxy = 0354D23C2A3B715A81EBF375A2C6111C /* PBXContainerItemProxy */; + }; + C850F73D0CD4FF748E4E30860AAFB932 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQTextInputViewNotification; + target = 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */; + targetProxy = 39DF2F1B454E7B7793443C38199EB0B7 /* PBXContainerItemProxy */; + }; + D712A40A6F15B03849EDADE61B68DB39 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = UMAPM; + target = F1E09035B7675D89EC69B16728E2833E /* UMAPM */; + targetProxy = 807C83A3A6EE16C45CED3C72029B8BE5 /* PBXContainerItemProxy */; + }; + D86848614F0E20BC8CF8ED6E512BD7A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQTextInputViewNotification-IQTextInputViewNotification"; + target = 4502C7427440BEB17A50C0BF6E638A85 /* IQTextInputViewNotification-IQTextInputViewNotification */; + targetProxy = 7FC3B94B59881CDB0C5AF28A2366839D /* PBXContainerItemProxy */; + }; + D92D635FFCBAC07B10A2EF03F063A27A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQKeyboardManagerSwift-IQKeyboardManagerSwift"; + target = 982A68D37F5DCBC1FC1FDC0BB2F0EB8E /* IQKeyboardManagerSwift-IQKeyboardManagerSwift */; + targetProxy = C6430EDA286E309851C27140590779BF /* PBXContainerItemProxy */; + }; + DB6A9F07CDE331CEF3799CE3A6CCF5F8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardNotification; + target = A26E6FD851C20D652B2755C1464A9990 /* IQKeyboardNotification */; + targetProxy = 088FCAC994901FDB36023E93E94300FE /* PBXContainerItemProxy */; + }; + E0A5F7B02F9BC271A1362F5B57FB045F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Pods-suixinkan"; + target = 1DE17B7C77CD95CB67DF1197965B76AB /* Pods-suixinkan */; + targetProxy = A76A974111C4DF28BDEE9331043B5B15 /* PBXContainerItemProxy */; + }; + F99C25A65D58FB66226D4571D404B903 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "IQKeyboardReturnManager-IQKeyboardReturnManager"; + target = 88810798DA63A2F6611B0970EA276DEC /* IQKeyboardReturnManager-IQKeyboardReturnManager */; + targetProxy = 2E42166B1ED5EC0E474E973A4D28B957 /* PBXContainerItemProxy */; + }; + FA7383946254CE1ED576095763780D1A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQTextInputViewNotification; + target = 283C1F2EA88CD4413165801A6748A48E /* IQTextInputViewNotification */; + targetProxy = EE0C384FA001B636E43753E78E9CD110 /* PBXContainerItemProxy */; + }; + FD08A4809C49D9071F6F4165742F73B5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = IQKeyboardToolbarManager; + target = 020993F16DA5986DACE118349EBCE9E5 /* IQKeyboardToolbarManager */; + targetProxy = 79E52737FC3E90BFC787B43531CB0935 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 006ECEB934E36E2BAC3C338BB61530B2 /* Debug */ = { + 00880EDC05269801C446ED8C41643AEE /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F9CB2239F63422E991F6FEF9D9A32967 /* IQKeyboardNotification.debug.xcconfig */; + baseConfigurationReference = 69373ECBF83F317CAA7C02D3B536BA78 /* IQTextInputViewNotification.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextInputViewNotification"; + IBSC_MODULE = IQTextInputViewNotification; + INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQTextInputViewNotification; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = SimulatorDebug; + }; + 0128796E1FAE80CFE8E84E81CBB57B04 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9931FEC2838C55EB9415330553D7C98B /* IQKeyboardManagerSwift.debug.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardManagerSwift"; + IBSC_MODULE = IQKeyboardManagerSwift; + INFOPLIST_FILE = "Target Support Files/IQKeyboardManagerSwift/ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardManagerSwift; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Debug; + }; + 01566EB080B5D3116D54A00F7BBFC796 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 948A9344898DCC2785FDDAD0699D6C1E /* IQKeyboardNotification.release.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -3180,31 +3335,15 @@ SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; - }; - 00E826101F8ECF726DC994CEF0D6722C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = D2B0169030016DBD87F970A973A138AD /* IQKeyboardCore.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardCore"; - IBSC_MODULE = IQKeyboardCore; - INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardCore; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; name = Release; }; 046607F7F70BF6ADBE3CC5FB84191FB7 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 930E9B1B194A403F3F0A4F95FAF2427A /* AMapLocation-NO-IDFA.debug.xcconfig */; + baseConfigurationReference = 20C3CD12D4046B6427964786B1D7F200 /* AMapLocation-NO-IDFA.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -3219,103 +3358,60 @@ }; name = SimulatorDebug; }; - 099143098447CA7F8B58F10A500B8F4A /* Debug */ = { + 080BBC6931C827C0F4E5E44F8547C0C3 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 533B31BFC1F29651016A4CED40C41C45 /* IQKeyboardReturnManager.debug.xcconfig */; + baseConfigurationReference = 5B91072D08BB3F63162262295825C5FF /* IQKeyboardToolbarManager.release.xcconfig */; buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardReturnManager; - PRODUCT_NAME = IQKeyboardReturnManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 09C31970175B907E646C8274BAB9E057 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 11B38E077C1F133396EB0CF305E0EF6B /* IQKeyboardToolbar.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardToolbar; - PRODUCT_NAME = IQKeyboardToolbar; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 0C48E272FEFCEBBFB916BC49AD53DB8B /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 47A354AE76F39CD50DF8DE8D5F744498 /* IQKeyboardManagerSwift.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardManagerSwift"; - IBSC_MODULE = IQKeyboardManagerSwift; - INFOPLIST_FILE = "Target Support Files/IQKeyboardManagerSwift/ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbarManager"; + IBSC_MODULE = IQKeyboardToolbarManager; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardManagerSwift; + PRODUCT_NAME = IQKeyboardToolbarManager; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; }; - name = SimulatorDebug; + name = Release; + }; + 08613EB11B5EFEB7B2ED6252F22D824B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 10F845770A3EF5F5562CC88EA7BE4644 /* IQTextInputViewNotification.release.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextInputViewNotification"; + IBSC_MODULE = IQTextInputViewNotification; + INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQTextInputViewNotification; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Release; + }; + 0B27BEAA7FF522CAE968C9E460146386 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B184A8220FD8F49AFB9FA1C67C8F4085 /* UMDevice.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; }; 0CBBD15A4F485A23067401CA54BAB2A2 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 47A354AE76F39CD50DF8DE8D5F744498 /* IQKeyboardManagerSwift.debug.xcconfig */; + baseConfigurationReference = 9931FEC2838C55EB9415330553D7C98B /* IQKeyboardManagerSwift.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -3351,6 +3447,41 @@ }; name = SimulatorDebug; }; + 0E2DB34C8255944824CBA5C7C163AC2B /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FFC2E336F5D035028DAA138A1A5C4F2E /* IQKeyboardToolbarManager.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbarManager"; + IBSC_MODULE = IQKeyboardToolbarManager; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardToolbarManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = SimulatorDebug; + }; + 1162EE88C2B4989F77488A101084A430 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3743F40B27DFFA0C0530479FFB587691 /* IQKeyboardReturnManager.release.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardReturnManager"; + IBSC_MODULE = IQKeyboardReturnManager; + INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardReturnManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Release; + }; 1256C974196FF130605BCB900B8E4CF2 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = A60612F837C72E04C6FBB22DF596D0FD /* Pods-suixinkanTests.release.xcconfig */; @@ -3391,7 +3522,120 @@ }; name = Release; }; - 15E5D635811DE4DDEF79E7C0D7C02EE5 /* Release */ = { + 1548EA2F2CBEC9CE28DC21F855105996 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 67DC68595F07F473A69296FC2DD4E016 /* Pods-suixinkan.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + INFOPLIST_FILE = "Target Support Files/Pods-suixinkan/Pods-suixinkan-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-suixinkan/Pods-suixinkan.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 19F92A39CD5E1730023173E7FB07EAB7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7FC0495E836EAA9DCCF5B24BA4F96574 /* JCore.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1FE8B9B19BDB828D1D6E2BAB12520D85 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D716492F07DEB42B388856692B6E843A /* AMapLocation-NO-IDFA.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2129046C72E3699C1A5CB89DEA1D79A5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 10F845770A3EF5F5562CC88EA7BE4644 /* IQTextInputViewNotification.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification.modulemap"; + PRODUCT_MODULE_NAME = IQTextInputViewNotification; + PRODUCT_NAME = IQTextInputViewNotification; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 239EC0DD9DE95C2A8CA208AE47184167 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 9C16EBBD1A736D37F674242425B27F20 /* Pods-suixinkan.release.xcconfig */; buildSettings = { @@ -3431,9 +3675,9 @@ }; name = Release; }; - 19F92A39CD5E1730023173E7FB07EAB7 /* Debug */ = { + 26A29A509262176CC4B40AD784E0062E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9F44C0F5A31C9EFE79B6821581FC6A90 /* JCore.debug.xcconfig */; + baseConfigurationReference = 0C5373D6FEC052390EF0155BC139DA74 /* UMCommon.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -3448,97 +3692,47 @@ }; name = Debug; }; - 1B03E27940D9DB99696B499239061A26 /* Release */ = { + 2AA75EE79F5096D732F5C8740CDAC26E /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E58F90C5C01D15A1D8477A2F76C55479 /* IQKeyboardToolbar.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbar"; - IBSC_MODULE = IQKeyboardToolbar; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardToolbar; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 1EE3CBE979432D435B81CBAA8BACEBBF /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3F8A7B40939E68E709158AA51CF7B536 /* UMCommon.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 1FE8B9B19BDB828D1D6E2BAB12520D85 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3F2BA6FF47C66D4951D519C0085C948B /* AMapLocation-NO-IDFA.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 2251E044D8EF017D45F9D3DEBBE7E37A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A5009A8DB6C64B30425E121DEC607B95 /* IQTextInputViewNotification.debug.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextInputViewNotification"; - IBSC_MODULE = IQTextInputViewNotification; - INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQTextInputViewNotification; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 2A9DF9EAE34E515C55D0F836B17B0CC9 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 65E1594E46F076BA8A8528BF7CD2E5DB /* IQKeyboardCore.debug.xcconfig */; + baseConfigurationReference = FFC2E336F5D035028DAA138A1A5C4F2E /* IQKeyboardToolbarManager.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardCore"; - IBSC_MODULE = IQKeyboardCore; - INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardCore; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardToolbarManager; + PRODUCT_NAME = IQKeyboardToolbarManager; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = SimulatorDebug; }; 2C54CBB64D554D5B12FCC966401A3CD5 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 65E1594E46F076BA8A8528BF7CD2E5DB /* IQKeyboardCore.debug.xcconfig */; + baseConfigurationReference = C22127072FC804B46594EFEEA2162330 /* IQKeyboardCore.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -3675,98 +3869,9 @@ }; name = Release; }; - 33570970A5E44A907921BFC5D3CDFC52 /* SimulatorDebug */ = { + 3226B13A536555E89D2D07085D304F4F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 56E9537047D72ABA1C9695C95A4AF843 /* UMAPM.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = SimulatorDebug; - }; - 35BB84CEDBA5C1476D858453DE3FC701 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1D1E7E265254C8003D8A5F7C75B7B539 /* AMapFoundation-NO-IDFA.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 374BDDC1B25527BE81775EB8627C15CD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A8E60BFFD4A191EDF1872BE7E0FAE073 /* IQKeyboardReturnManager.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardReturnManager"; - IBSC_MODULE = IQKeyboardReturnManager; - INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardReturnManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 3D69CA0B1695293FBA0009EA7E34F1F5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A5009A8DB6C64B30425E121DEC607B95 /* IQTextInputViewNotification.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification.modulemap"; - PRODUCT_MODULE_NAME = IQTextInputViewNotification; - PRODUCT_NAME = IQTextInputViewNotification; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 3DE59E452D8974494117DF1C303917B3 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E58F90C5C01D15A1D8477A2F76C55479 /* IQKeyboardToolbar.release.xcconfig */; + baseConfigurationReference = 37ED2C21C1E1ACCC106AA7C2D98CD280 /* IQKeyboardToolbar.release.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -3803,9 +3908,9 @@ }; name = Release; }; - 427A15AAEF63818FAA1CAC6300810564 /* SimulatorDebug */ = { + 33570970A5E44A907921BFC5D3CDFC52 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9F44C0F5A31C9EFE79B6821581FC6A90 /* JCore.debug.xcconfig */; + baseConfigurationReference = 4E1E716A01DDF5D7844AD4F6DD359924 /* UMAPM.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -3820,82 +3925,9 @@ }; name = SimulatorDebug; }; - 45B43439F28EA2D1004B2EE36A4E63DC /* Release */ = { + 35923A58C1D039604461FB7ED7C9D300 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D2B0169030016DBD87F970A973A138AD /* IQKeyboardCore.release.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardCore/IQKeyboardCore-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/IQKeyboardCore-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardCore/IQKeyboardCore.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardCore; - PRODUCT_NAME = IQKeyboardCore; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 46F98087C8D84310CDE4A60C95BB50E4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 10CADA6646C9AF13C983D13EAF7F5378 /* IQKeyboardToolbarManager.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbarManager"; - IBSC_MODULE = IQKeyboardToolbarManager; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardToolbarManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 4A63680095D13AFE8AADC2DD651ED1DF /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E64981F07E6AF8250D37F4D1295891B8 /* UMCommon.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 51A5AA0D4A6EA7B3DEE27239C671F20C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BDDEE926B156A69E8B915347853ECEC5 /* IQKeyboardManagerSwift.release.xcconfig */; + baseConfigurationReference = FF1A51684BE9AD249695A507E8AE84BF /* IQKeyboardManagerSwift.release.xcconfig */; buildSettings = { CODE_SIGNING_ALLOWED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardManagerSwift"; @@ -3910,119 +3942,11 @@ }; name = Release; }; - 5462C869E62F6E27C1B8B088F9859726 /* SimulatorDebug */ = { + 3632907CCAEFC18F7310607AEFFF8593 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 533B31BFC1F29651016A4CED40C41C45 /* IQKeyboardReturnManager.debug.xcconfig */; + baseConfigurationReference = 2D2C9E82DF51CA26E12725621714E090 /* IQKeyboardNotification.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardReturnManager"; - IBSC_MODULE = IQKeyboardReturnManager; - INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardReturnManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = SimulatorDebug; - }; - 54E5F780F370BCDEBF4A70F5FA2DE9FF /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F283224B76C1D6B83702001679439919 /* UMAPM.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 57F30DED93690F3F73FC85C798F6920A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FA43AA432E51DD3E160CB45F75EDD874 /* JCore.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 586B0D9EBD67B3D385760CD014900637 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3BAA32FB751F6BB0FD65930595456ACA /* IQTextView.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextView"; - IBSC_MODULE = IQTextView; - INFOPLIST_FILE = "Target Support Files/IQTextView/ResourceBundle-IQTextView-IQTextView-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQTextView; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 5D2D3B802F1C540631553C6626C51D77 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 11B38E077C1F133396EB0CF305E0EF6B /* IQKeyboardToolbar.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardToolbar; - PRODUCT_NAME = IQKeyboardToolbar; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = SimulatorDebug; - }; - 5D65C20480CD1638A64822CF819348BB /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F9CB2239F63422E991F6FEF9D9A32967 /* IQKeyboardNotification.debug.xcconfig */; - buildSettings = { CODE_SIGNING_ALLOWED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardNotification"; IBSC_MODULE = IQKeyboardNotification; @@ -4034,231 +3958,11 @@ TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; }; - name = Debug; - }; - 5EBEDA379F0CDF486B8F287C13BFE013 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1FB7DE577ECCA1457268EA70E8DB4DAC /* JPush.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 5FAC6598990735686A996D7E70DF3EA8 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A8E60BFFD4A191EDF1872BE7E0FAE073 /* IQKeyboardReturnManager.release.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardReturnManager; - PRODUCT_NAME = IQKeyboardReturnManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 610FF798BB5843B0008389B878CF0E3E /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 2161AA772A6755F4D5D60BD723919D3B /* IQTextInputViewNotification.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextInputViewNotification"; - IBSC_MODULE = IQTextInputViewNotification; - INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQTextInputViewNotification; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 614855485F99BBA9DA1E29197646AA99 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BDDEE926B156A69E8B915347853ECEC5 /* IQKeyboardManagerSwift.release.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardManagerSwift; - PRODUCT_NAME = IQKeyboardManagerSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 66B8ED63760B2E1782BC65C56BB81A23 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 533B31BFC1F29651016A4CED40C41C45 /* IQKeyboardReturnManager.debug.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardReturnManager"; - IBSC_MODULE = IQKeyboardReturnManager; - INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardReturnManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 68894A46ED94B1B55EDBC8E5B7F16A4A /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FC4CD6A2AB7E8F21DDF47AE3878B13B4 /* IQTextView.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQTextView/IQTextView-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQTextView/IQTextView-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQTextView/IQTextView.modulemap"; - PRODUCT_MODULE_NAME = IQTextView; - PRODUCT_NAME = IQTextView; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; name = SimulatorDebug; }; - 6A12D2FD2E860D435F801E231808847B /* Release */ = { + 3809015D1911D42EADEE1B4CC8FA42C9 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 401C0B5E9F8F1552898BFACFDEB8C41D /* IQKeyboardNotification.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardNotification"; - IBSC_MODULE = IQKeyboardNotification; - INFOPLIST_FILE = "Target Support Files/IQKeyboardNotification/ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardNotification; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 6B39FC5F68684EDE8E1156AEFCE888C6 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E64981F07E6AF8250D37F4D1295891B8 /* UMCommon.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = SimulatorDebug; - }; - 6FD6B6F43063FD5FCCE14F70DA9A5B69 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DFE51D2405E1E217F50AA3BA1213B3AD /* UMDevice.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 72A219A8FC63CFB344DBE3451FA1313D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 10CADA6646C9AF13C983D13EAF7F5378 /* IQKeyboardToolbarManager.release.xcconfig */; + baseConfigurationReference = FFC2E336F5D035028DAA138A1A5C4F2E /* IQKeyboardToolbarManager.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -4289,68 +3993,15 @@ SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; - }; - 7A2AE90C14DDF3F5EA98F38A54A09F39 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 11B38E077C1F133396EB0CF305E0EF6B /* IQKeyboardToolbar.debug.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbar"; - IBSC_MODULE = IQKeyboardToolbar; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardToolbar; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; name = Debug; }; - 7AB411313E0E948C032AC6FACEC06029 /* Debug */ = { + 39B94A7458BBA2A3F1E43B8E67C71532 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1FADC993D884553299A227B2F37F270B /* IQKeyboardToolbarManager.debug.xcconfig */; + baseConfigurationReference = F1F98B961492E58401AF64822AA86791 /* IQTextView.release.xcconfig */; buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbarManager"; - IBSC_MODULE = IQKeyboardToolbarManager; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardToolbarManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 7CCF3C55E3884B7D6BAA7A7B5A200CE1 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DD52E2C9D26643C4510332244B319F71 /* JPush.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = SimulatorDebug; - }; - 80ECF48F68A3A075A2A0D8B392C30F84 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FC4CD6A2AB7E8F21DDF47AE3878B13B4 /* IQTextView.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGNING_ALLOWED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextView"; IBSC_MODULE = IQTextView; @@ -4362,64 +4013,9 @@ TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; }; - name = SimulatorDebug; + name = Release; }; - 8114091CF46E116D123C7DFC8F3175BF /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 533B31BFC1F29651016A4CED40C41C45 /* IQKeyboardReturnManager.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardReturnManager; - PRODUCT_NAME = IQKeyboardReturnManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = SimulatorDebug; - }; - 87F708D71356EA1183EF5535D5FA83FE /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 65E1594E46F076BA8A8528BF7CD2E5DB /* IQKeyboardCore.debug.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardCore"; - IBSC_MODULE = IQKeyboardCore; - INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardCore; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 89A05ED16BE7F147E0B2C1D88345B7B6 /* SimulatorDebug */ = { + 3B3B37F221BCE09B66833AA9B02EA981 /* SimulatorDebug */ = { isa = XCBuildConfiguration; baseConfigurationReference = E3B33A56AD414D84948526129E9D584C /* Pods-suixinkan.simulatordebug.xcconfig */; buildSettings = { @@ -4458,66 +4054,10 @@ }; name = SimulatorDebug; }; - 93211965B43F0CB2B08107959A929B0F /* SimulatorDebug */ = { + 3B4750357F3A04F91A015E6BFB7F9837 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1FADC993D884553299A227B2F37F270B /* IQKeyboardToolbarManager.debug.xcconfig */; + baseConfigurationReference = 948A9344898DCC2785FDDAD0699D6C1E /* IQKeyboardNotification.release.xcconfig */; buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardToolbarManager; - PRODUCT_NAME = IQKeyboardToolbarManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = SimulatorDebug; - }; - 93DF1B4C8EA7BE813A9B7A8CC33CC6F6 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C7C310CD68DF209957D60358329E9D5B /* AMap3DMap-NO-IDFA.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = SimulatorDebug; - }; - 946384BF19448D77AF04CB5114DBCF14 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F9CB2239F63422E991F6FEF9D9A32967 /* IQKeyboardNotification.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGNING_ALLOWED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardNotification"; IBSC_MODULE = IQKeyboardNotification; @@ -4529,18 +4069,112 @@ TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; }; + name = Release; + }; + 3F012ECECF9942D6D26FEF28931A9054 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF5A7F51FAADA1E1B5FC260E1B632D6C /* IQKeyboardToolbar.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardToolbar; + PRODUCT_NAME = IQKeyboardToolbar; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; name = SimulatorDebug; }; - 975FEEA40A8C8BD46300095E53BD15EE /* Debug */ = { + 427A15AAEF63818FAA1CAC6300810564 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 47A354AE76F39CD50DF8DE8D5F744498 /* IQKeyboardManagerSwift.debug.xcconfig */; + baseConfigurationReference = 7FC0495E836EAA9DCCF5B24BA4F96574 /* JCore.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + 45B43439F28EA2D1004B2EE36A4E63DC /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7CE0E04517BD2363A893C1E85B4B248F /* IQKeyboardCore.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardCore/IQKeyboardCore-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/IQKeyboardCore-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardCore/IQKeyboardCore.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardCore; + PRODUCT_NAME = IQKeyboardCore; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 47DD8A67554FA0CFEF75EB443BA908E8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C22127072FC804B46594EFEEA2162330 /* IQKeyboardCore.debug.xcconfig */; buildSettings = { CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardManagerSwift"; - IBSC_MODULE = IQKeyboardManagerSwift; - INFOPLIST_FILE = "Target Support Files/IQKeyboardManagerSwift/ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardCore"; + IBSC_MODULE = IQKeyboardCore; + INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardManagerSwift; + PRODUCT_NAME = IQKeyboardCore; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; @@ -4548,98 +4182,249 @@ }; name = Debug; }; - 988225462B092B5D7926A95A1A21B24D /* SimulatorDebug */ = { + 4A68D42D85F2983A8CBA83B44C45A5E1 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FDF709D73DE1142AE1CF86A66274B9FC /* WechatOpenSDK-XCFramework.debug.xcconfig */; + baseConfigurationReference = FA8405454F857A83074F7A861FD13878 /* IQKeyboardReturnManager.debug.xcconfig */; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_ENABLE_OBJC_WEAK = NO; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = SimulatorDebug; - }; - 993C8EF2D62C050B1B18AE2E75654CEB /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 357507030049F8711B5F2560C8BE96B0 /* AMapFoundation-NO-IDFA.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - A05DB17AED4D51BD93C7666E23ABD90D /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 30B02A6B0D6954EF43EFA3789887E608 /* AMapSearch-NO-IDFA.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = SimulatorDebug; - }; - A093432E64AA520BF0DA955291A9475D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3AAAF0891AEED7CA4AF20AE95070E340 /* AMapSearch-NO-IDFA.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - AC920FCB33A41A7879A8121BC9971074 /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A5009A8DB6C64B30425E121DEC607B95 /* IQTextInputViewNotification.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextInputViewNotification"; - IBSC_MODULE = IQTextInputViewNotification; - INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardReturnManager"; + IBSC_MODULE = IQKeyboardReturnManager; + INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQTextInputViewNotification; + PRODUCT_NAME = IQKeyboardReturnManager; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; }; + name = Debug; + }; + 51C86BFF64DA5BE9F5C09D7EB4537156 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F1F98B961492E58401AF64822AA86791 /* IQTextView.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQTextView/IQTextView-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQTextView/IQTextView-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQTextView/IQTextView.modulemap"; + PRODUCT_MODULE_NAME = IQTextView; + PRODUCT_NAME = IQTextView; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 525FBC7B3A1F92004D696A96314B1688 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF5A7F51FAADA1E1B5FC260E1B632D6C /* IQKeyboardToolbar.debug.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbar"; + IBSC_MODULE = IQKeyboardToolbar; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardToolbar; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Debug; + }; + 52D243A8CBB51EAA0D78B04925AA39A4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EDC68D4FCB048FBF2A45CC21B1638F80 /* VolcEngineRTC.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_OBJC_WEAK = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 54E5F780F370BCDEBF4A70F5FA2DE9FF /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 006784975D34D4F2841543B05EC4A195 /* UMAPM.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 57F30DED93690F3F73FC85C798F6920A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CBD245733975A997CDE429A351AB1C6F /* JCore.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 598E3828E2FACEEFF930BA2BC880BBEE /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA8405454F857A83074F7A861FD13878 /* IQKeyboardReturnManager.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardReturnManager; + PRODUCT_NAME = IQKeyboardReturnManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; name = SimulatorDebug; }; - AD0AB773E05696871E507C0BA3F182CB /* Debug */ = { + 5EBEDA379F0CDF486B8F287C13BFE013 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FC4CD6A2AB7E8F21DDF47AE3878B13B4 /* IQTextView.debug.xcconfig */; + baseConfigurationReference = E8FD6F60EF688C5AC4A8B023D6D4196A /* JPush.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 614855485F99BBA9DA1E29197646AA99 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF1A51684BE9AD249695A507E8AE84BF /* IQKeyboardManagerSwift.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardManagerSwift; + PRODUCT_NAME = IQKeyboardManagerSwift; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 61FC45D8AF3A48089D539804BB74FDC6 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9B64B38CCC51FEC6E0F64ABFCE0D6BFF /* AMapFoundation-NO-IDFA.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 65BED541222A9C5AB802EC59453C0FF2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 84308DE86AAB2CCBAA19904F494B555E /* IQTextView.debug.xcconfig */; buildSettings = { CODE_SIGNING_ALLOWED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextView"; @@ -4654,26 +4439,65 @@ }; name = Debug; }; - AF0A1E4E43090E7D99AEE73C05A36AC4 /* Debug */ = { + 674EC62E70F9A09829AD9B38B3E57581 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 930E9B1B194A403F3F0A4F95FAF2427A /* AMapLocation-NO-IDFA.debug.xcconfig */; + baseConfigurationReference = FF5A7F51FAADA1E1B5FC260E1B632D6C /* IQKeyboardToolbar.debug.xcconfig */; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", + "@loader_path/Frameworks", ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbar/IQKeyboardToolbar.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardToolbar; + PRODUCT_NAME = IQKeyboardToolbar; SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Debug; }; - B0C58F24582EC0647BB0D8EC658E7C3B /* Release */ = { + 6B56EAC318C09E4BBF9E34AC89BEDCC1 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 401C0B5E9F8F1552898BFACFDEB8C41D /* IQKeyboardNotification.release.xcconfig */; + baseConfigurationReference = FA8405454F857A83074F7A861FD13878 /* IQKeyboardReturnManager.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardReturnManager"; + IBSC_MODULE = IQKeyboardReturnManager; + INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/ResourceBundle-IQKeyboardReturnManager-IQKeyboardReturnManager-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardReturnManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = SimulatorDebug; + }; + 6C8D478A408C8091D5776CF9B83B7EAA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2D2C9E82DF51CA26E12725621714E090 /* IQKeyboardNotification.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -4704,12 +4528,446 @@ SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; + name = Debug; + }; + 704EF8B93B8BDAD0A59561D55C7976E2 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EDC68D4FCB048FBF2A45CC21B1638F80 /* VolcEngineRTC.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_OBJC_WEAK = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + 72D9B0E972F8A19A3FBAD2059C39C4D7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7CE0E04517BD2363A893C1E85B4B248F /* IQKeyboardCore.release.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardCore"; + IBSC_MODULE = IQKeyboardCore; + INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardCore; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; name = Release; }; + 75199AD2E2B123A0604ECE956585D169 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 84308DE86AAB2CCBAA19904F494B555E /* IQTextView.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQTextView/IQTextView-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQTextView/IQTextView-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQTextView/IQTextView.modulemap"; + PRODUCT_MODULE_NAME = IQTextView; + PRODUCT_NAME = IQTextView; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = SimulatorDebug; + }; + 7CCF3C55E3884B7D6BAA7A7B5A200CE1 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CED54F92E588775BEA7B38CECABD7702 /* JPush.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + 7D73F4B8E7AFDB1FDC79F3FD901DA850 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9931FEC2838C55EB9415330553D7C98B /* IQKeyboardManagerSwift.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardManagerSwift"; + IBSC_MODULE = IQKeyboardManagerSwift; + INFOPLIST_FILE = "Target Support Files/IQKeyboardManagerSwift/ResourceBundle-IQKeyboardManagerSwift-IQKeyboardManagerSwift-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardManagerSwift; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = SimulatorDebug; + }; + 80433F2CA55A715C9B9804750BEFD39D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 84308DE86AAB2CCBAA19904F494B555E /* IQTextView.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQTextView/IQTextView-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQTextView/IQTextView-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQTextView/IQTextView.modulemap"; + PRODUCT_MODULE_NAME = IQTextView; + PRODUCT_NAME = IQTextView; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 831BD8993867792A3BB79CFA691C2047 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D4441EC6FD7E6501CD6A029CC5547EB7 /* UMDevice.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 835213B0CD4B72C47ADC8B6CD0D341D5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA8405454F857A83074F7A861FD13878 /* IQKeyboardReturnManager.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardReturnManager; + PRODUCT_NAME = IQKeyboardReturnManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 8B4FAD23565D3E04F3B3281EBD5357D1 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B184A8220FD8F49AFB9FA1C67C8F4085 /* UMDevice.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + 8C216CCE60522B2E9813D34CCD890C2D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 99E675068425C5A9A5145CD79E3BCA08 /* AMapFoundation-NO-IDFA.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 91FC7178B53A17E4EDFBAFD2FCF69126 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 83448C8FCF4765056F1A35E450B655E6 /* UMCommon.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 92982B7A6C682CF5DCAFBEC4827314F8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 69373ECBF83F317CAA7C02D3B536BA78 /* IQTextInputViewNotification.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification.modulemap"; + PRODUCT_MODULE_NAME = IQTextInputViewNotification; + PRODUCT_NAME = IQTextInputViewNotification; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 93DF1B4C8EA7BE813A9B7A8CC33CC6F6 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 51367A9A6774AE911676FEE589F4D4E9 /* AMap3DMap-NO-IDFA.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + 988225462B092B5D7926A95A1A21B24D /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A3ADF11FAEAC8F80DA91E2D23F4F5C48 /* WechatOpenSDK-XCFramework.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_OBJC_WEAK = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + 9C3E3AE1E1B56155996EDBFCB40C72DC /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 69373ECBF83F317CAA7C02D3B536BA78 /* IQTextInputViewNotification.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification.modulemap"; + PRODUCT_MODULE_NAME = IQTextInputViewNotification; + PRODUCT_NAME = IQTextInputViewNotification; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = SimulatorDebug; + }; + A05DB17AED4D51BD93C7666E23ABD90D /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A900C19FDD423A63EDB4890241E20444 /* AMapSearch-NO-IDFA.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + A093432E64AA520BF0DA955291A9475D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 48303C21DF2C6D474BE4A0AADEE9E16C /* AMapSearch-NO-IDFA.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + AF0A1E4E43090E7D99AEE73C05A36AC4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 20C3CD12D4046B6427964786B1D7F200 /* AMapLocation-NO-IDFA.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B04DD2E1E6CC154979A493AC1223363A /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C22127072FC804B46594EFEEA2162330 /* IQKeyboardCore.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardCore"; + IBSC_MODULE = IQKeyboardCore; + INFOPLIST_FILE = "Target Support Files/IQKeyboardCore/ResourceBundle-IQKeyboardCore-IQKeyboardCore-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardCore; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = SimulatorDebug; + }; B52FE32909A379BCBB8A0A31C91FC490 /* SimulatorDebug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 0AFBD211AC6EFEB81A9519313236FABF /* Pods-suixinkanTests.simulatordebug.xcconfig */; @@ -4750,9 +5008,26 @@ }; name = SimulatorDebug; }; + B959E24DFDF96888F01F178AAA9D4401 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FFC2E336F5D035028DAA138A1A5C4F2E /* IQKeyboardToolbarManager.debug.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbarManager"; + IBSC_MODULE = IQKeyboardToolbarManager; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardToolbarManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Debug; + }; BAC71FA334650D78F8E815FFDA1DB086 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8D6DCAE6D0330A20D29082667233E33C /* WechatOpenSDK-XCFramework.release.xcconfig */; + baseConfigurationReference = C2A0B423670E836CA2EA43C41CB19811 /* WechatOpenSDK-XCFramework.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -4769,104 +5044,9 @@ }; name = Release; }; - BC62923F49BA0AC24F803CF4CE8FA864 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FC4CD6A2AB7E8F21DDF47AE3878B13B4 /* IQTextView.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQTextView/IQTextView-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQTextView/IQTextView-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQTextView/IQTextView.modulemap"; - PRODUCT_MODULE_NAME = IQTextView; - PRODUCT_NAME = IQTextView; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - BD10A3EFC96C5630E8B5AEC4C641679F /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1FADC993D884553299A227B2F37F270B /* IQKeyboardToolbarManager.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbarManager"; - IBSC_MODULE = IQKeyboardToolbarManager; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/ResourceBundle-IQKeyboardToolbarManager-IQKeyboardToolbarManager-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardToolbarManager; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = SimulatorDebug; - }; - BF65BDF3CFEB40B655601B9C7CFE2F9E /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 67DC68595F07F473A69296FC2DD4E016 /* Pods-suixinkan.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - INFOPLIST_FILE = "Target Support Files/Pods-suixinkan/Pods-suixinkan-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-suixinkan/Pods-suixinkan.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; C0864040DF7B74E1F31D9D1107560BAF /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DD52E2C9D26643C4510332244B319F71 /* JPush.debug.xcconfig */; + baseConfigurationReference = CED54F92E588775BEA7B38CECABD7702 /* JPush.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -4883,7 +5063,7 @@ }; C0A3367DEECA243FFB6381711E119612 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FDF709D73DE1142AE1CF86A66274B9FC /* WechatOpenSDK-XCFramework.debug.xcconfig */; + baseConfigurationReference = A3ADF11FAEAC8F80DA91E2D23F4F5C48 /* WechatOpenSDK-XCFramework.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -4899,47 +5079,9 @@ }; name = Debug; }; - C85614EF79473B47C339BE432AEF69EF /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A5009A8DB6C64B30425E121DEC607B95 /* IQTextInputViewNotification.debug.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification.modulemap"; - PRODUCT_MODULE_NAME = IQTextInputViewNotification; - PRODUCT_NAME = IQTextInputViewNotification; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = SimulatorDebug; - }; C9F495D594D104438C53E96A18D74E5E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 47A354AE76F39CD50DF8DE8D5F744498 /* IQKeyboardManagerSwift.debug.xcconfig */; + baseConfigurationReference = 9931FEC2838C55EB9415330553D7C98B /* IQKeyboardManagerSwift.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -4977,7 +5119,7 @@ }; D15D7E129385054A649F014F167DD205 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C7C310CD68DF209957D60358329E9D5B /* AMap3DMap-NO-IDFA.debug.xcconfig */; + baseConfigurationReference = 51367A9A6774AE911676FEE589F4D4E9 /* AMap3DMap-NO-IDFA.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -4992,12 +5134,13 @@ }; name = Debug; }; - D17A5F9FE4EE86C216ACE61D6FB58CE7 /* SimulatorDebug */ = { + D25BF0870C13B46E92683CB09CA3E8E1 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1D1E7E265254C8003D8A5F7C75B7B539 /* AMapFoundation-NO-IDFA.debug.xcconfig */; + baseConfigurationReference = A07699BB79F9619E4B3CE5048F213790 /* VolcEngineRTC.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_OBJC_WEAK = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -5006,30 +5149,51 @@ ); SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; }; - name = SimulatorDebug; + name = Release; }; - D768CD154ED12F7BE1D6BB9E873A6911 /* SimulatorDebug */ = { + D570FF355C47048E4CEF4D94773CAA74 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 11B38E077C1F133396EB0CF305E0EF6B /* IQKeyboardToolbar.debug.xcconfig */; + baseConfigurationReference = 2D2C9E82DF51CA26E12725621714E090 /* IQKeyboardNotification.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGNING_ALLOWED = NO; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbar"; - IBSC_MODULE = IQKeyboardToolbar; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardNotification/IQKeyboardNotification-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardNotification/IQKeyboardNotification-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - PRODUCT_NAME = IQKeyboardToolbar; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardNotification/IQKeyboardNotification.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardNotification; + PRODUCT_NAME = IQKeyboardNotification; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = SimulatorDebug; }; D8C82D4A0DB38BA42139C9D3619C3B6C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 56E9537047D72ABA1C9695C95A4AF843 /* UMAPM.debug.xcconfig */; + baseConfigurationReference = 4E1E716A01DDF5D7844AD4F6DD359924 /* UMAPM.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -5044,26 +5208,26 @@ }; name = Debug; }; - DDB0B8C1800EF25E633E9EF05D74FD72 /* SimulatorDebug */ = { + DBE26A3A19E49FBBF92C2614580D42E0 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A3CDCD8BAD4E220D8D74F8D8D6DE8034 /* UMDevice.debug.xcconfig */; + baseConfigurationReference = 2D2C9E82DF51CA26E12725621714E090 /* IQKeyboardNotification.debug.xcconfig */; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardNotification"; + IBSC_MODULE = IQKeyboardNotification; + INFOPLIST_FILE = "Target Support Files/IQKeyboardNotification/ResourceBundle-IQKeyboardNotification-IQKeyboardNotification-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + PRODUCT_NAME = IQKeyboardNotification; SDKROOT = iphoneos; + SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; }; - name = SimulatorDebug; + name = Debug; }; E10C1F80C3E9A1D246A4D102C7806348 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 649233ED6CEAD11508C3FEC87609ADF7 /* AMap3DMap-NO-IDFA.release.xcconfig */; + baseConfigurationReference = 0AF4E684DF6CEBFE9C445B44A8ECFFF0 /* AMap3DMap-NO-IDFA.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -5079,6 +5243,79 @@ }; name = Release; }; + E10CEEB1C1490644FA02CF1F52B38D15 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 37ED2C21C1E1ACCC106AA7C2D98CD280 /* IQKeyboardToolbar.release.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbar"; + IBSC_MODULE = IQKeyboardToolbar; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + PRODUCT_NAME = IQKeyboardToolbar; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Release; + }; + E14DC8D4EF06AD110D901EA1905F83E9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5B91072D08BB3F63162262295825C5FF /* IQKeyboardToolbarManager.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = NO; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-prefix.pch"; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardToolbarManager; + PRODUCT_NAME = IQKeyboardToolbarManager; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_INSTALL_OBJC_HEADER = YES; + SWIFT_VERSION = 5.9; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + E352FDAA39A5427F13D2750ADB1D0B86 /* SimulatorDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 99E675068425C5A9A5145CD79E3BCA08 /* AMapFoundation-NO-IDFA.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; E756D4F85371E4C3B99D3BEC6CD5207F /* SimulatorDebug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -5145,103 +5382,45 @@ }; name = SimulatorDebug; }; - E91CE575290BC3A080E4391DC0E93244 /* Debug */ = { + E8252A303DE806530C9337DFC9C81084 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A3CDCD8BAD4E220D8D74F8D8D6DE8034 /* UMDevice.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ENABLE_USER_SCRIPT_SANDBOXING = NO; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - EAB3DCC5A63DFB2910DB5131BA8617AB /* SimulatorDebug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F9CB2239F63422E991F6FEF9D9A32967 /* IQKeyboardNotification.debug.xcconfig */; + baseConfigurationReference = FF5A7F51FAADA1E1B5FC260E1B632D6C /* IQKeyboardToolbar.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardNotification/IQKeyboardNotification-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardNotification/IQKeyboardNotification-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQKeyboardToolbar"; + IBSC_MODULE = IQKeyboardToolbar; + INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbar/ResourceBundle-IQKeyboardToolbar-IQKeyboardToolbar-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardNotification/IQKeyboardNotification.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardNotification; - PRODUCT_NAME = IQKeyboardNotification; + PRODUCT_NAME = IQKeyboardToolbar; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + WRAPPER_EXTENSION = bundle; }; name = SimulatorDebug; }; - ECFE8EE882A8E0E8F1F88A2CED71761D /* Release */ = { + EA8DCB40DF90E640476FFD1ECAE29C32 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3BAA32FB751F6BB0FD65930595456ACA /* IQTextView.release.xcconfig */; + baseConfigurationReference = 84308DE86AAB2CCBAA19904F494B555E /* IQTextView.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQTextView/IQTextView-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQTextView/IQTextView-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextView"; + IBSC_MODULE = IQTextView; + INFOPLIST_FILE = "Target Support Files/IQTextView/ResourceBundle-IQTextView-IQTextView-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/IQTextView/IQTextView.modulemap"; - PRODUCT_MODULE_NAME = IQTextView; PRODUCT_NAME = IQTextView; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + WRAPPER_EXTENSION = bundle; }; - name = Release; + name = SimulatorDebug; }; ED20D572033C5607EC8FF9D4C2B16843 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 65E1594E46F076BA8A8528BF7CD2E5DB /* IQKeyboardCore.debug.xcconfig */; + baseConfigurationReference = C22127072FC804B46594EFEEA2162330 /* IQKeyboardCore.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -5279,7 +5458,7 @@ }; F0545B6F999FF16FA19AA34E787CC0D6 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 30B02A6B0D6954EF43EFA3789887E608 /* AMapSearch-NO-IDFA.debug.xcconfig */; + baseConfigurationReference = A900C19FDD423A63EDB4890241E20444 /* AMapSearch-NO-IDFA.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -5294,9 +5473,9 @@ }; name = Debug; }; - F0E1E72ABB5DF0FF9232765B8F59FAE6 /* Debug */ = { + F4A26ADA800ACEBFCFDC225CA809EB4C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1FADC993D884553299A227B2F37F270B /* IQKeyboardToolbarManager.debug.xcconfig */; + baseConfigurationReference = 3743F40B27DFFA0C0530479FFB587691 /* IQKeyboardReturnManager.release.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -5308,9 +5487,9 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-prefix.pch"; + GCC_PREFIX_HEADER = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-prefix.pch"; GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager-Info.plist"; + INFOPLIST_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -5318,19 +5497,20 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MODULEMAP_FILE = "Target Support Files/IQKeyboardToolbarManager/IQKeyboardToolbarManager.modulemap"; - PRODUCT_MODULE_NAME = IQKeyboardToolbarManager; - PRODUCT_NAME = IQKeyboardToolbarManager; + MODULEMAP_FILE = "Target Support Files/IQKeyboardReturnManager/IQKeyboardReturnManager.modulemap"; + PRODUCT_MODULE_NAME = IQKeyboardReturnManager; + PRODUCT_NAME = IQKeyboardReturnManager; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; F4FF6A0D1970CA9705974E3CB2134802 /* Debug */ = { isa = XCBuildConfiguration; @@ -5398,68 +5578,43 @@ }; name = Debug; }; - FF360B7D4473A88DC4CD81C9815F7F75 /* Release */ = { + F640C5B4011BA70DB05F6FCB692AA170 /* SimulatorDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2161AA772A6755F4D5D60BD723919D3B /* IQTextInputViewNotification.release.xcconfig */; + baseConfigurationReference = 0C5373D6FEC052390EF0155BC139DA74 /* UMCommon.debug.xcconfig */; buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = NO; - GCC_PREFIX_HEADER = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-prefix.pch"; - GENERATE_INFOPLIST_FILE = NO; - INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ENABLE_USER_SCRIPT_SANDBOXING = NO; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", - "@loader_path/Frameworks", ); - MODULEMAP_FILE = "Target Support Files/IQTextInputViewNotification/IQTextInputViewNotification.modulemap"; - PRODUCT_MODULE_NAME = IQTextInputViewNotification; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = SimulatorDebug; + }; + F9F629D371199F6FD4180A160B119827 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 69373ECBF83F317CAA7C02D3B536BA78 /* IQTextInputViewNotification.debug.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/IQTextInputViewNotification"; + IBSC_MODULE = IQTextInputViewNotification; + INFOPLIST_FILE = "Target Support Files/IQTextInputViewNotification/ResourceBundle-IQTextInputViewNotification-IQTextInputViewNotification-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; PRODUCT_NAME = IQTextInputViewNotification; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 5.9; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + WRAPPER_EXTENSION = bundle; }; - name = Release; + name = Debug; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 16042111B26CDDA811DEA06D014F8608 /* Build configuration list for PBXAggregateTarget "UMCommon" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4A63680095D13AFE8AADC2DD651ED1DF /* Debug */, - 1EE3CBE979432D435B81CBAA8BACEBBF /* Release */, - 6B39FC5F68684EDE8E1156AEFCE888C6 /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 24187E637FC68EF68B8A7A6028C0073F /* Build configuration list for PBXNativeTarget "IQTextView" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BC62923F49BA0AC24F803CF4CE8FA864 /* Debug */, - ECFE8EE882A8E0E8F1F88A2CED71761D /* Release */, - 68894A46ED94B1B55EDBC8E5B7F16A4A /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 2502DBFD94504E58AACFE09B0E8730C7 /* Build configuration list for PBXAggregateTarget "JCore" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -5470,12 +5625,32 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2B3292CB0DE7D6CE46A077AA7A98827F /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification" */ = { + 2F6FDA2B7AE29776104CCA1C5E80F704 /* Build configuration list for PBXAggregateTarget "AMapFoundation-NO-IDFA" */ = { isa = XCConfigurationList; buildConfigurations = ( - 3D69CA0B1695293FBA0009EA7E34F1F5 /* Debug */, - FF360B7D4473A88DC4CD81C9815F7F75 /* Release */, - C85614EF79473B47C339BE432AEF69EF /* SimulatorDebug */, + 8C216CCE60522B2E9813D34CCD890C2D /* Debug */, + 61FC45D8AF3A48089D539804BB74FDC6 /* Release */, + E352FDAA39A5427F13D2750ADB1D0B86 /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3359FFF96FDC1E39EBC821362A8761CD /* Build configuration list for PBXAggregateTarget "UMDevice" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0B27BEAA7FF522CAE968C9E460146386 /* Debug */, + 831BD8993867792A3BB79CFA691C2047 /* Release */, + 8B4FAD23565D3E04F3B3281EBD5357D1 /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3403F131765FEBB242F76306FC5D0BB7 /* Build configuration list for PBXNativeTarget "IQKeyboardManagerSwift-IQKeyboardManagerSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0128796E1FAE80CFE8E84E81CBB57B04 /* Debug */, + 35923A58C1D039604461FB7ED7C9D300 /* Release */, + 7D73F4B8E7AFDB1FDC79F3FD901DA850 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5490,6 +5665,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 3CBF9BFF072845753899694FE4E10ADD /* Build configuration list for PBXAggregateTarget "UMCommon" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 26A29A509262176CC4B40AD784E0062E /* Debug */, + 91FC7178B53A17E4EDFBAFD2FCF69126 /* Release */, + F640C5B4011BA70DB05F6FCB692AA170 /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 42640293F3A3C60B57F8E8CB6A88B983 /* Build configuration list for PBXAggregateTarget "JPush" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -5510,6 +5695,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 42FF906DA5AB7C83C901286B2DEBB04E /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 674EC62E70F9A09829AD9B38B3E57581 /* Debug */, + 3226B13A536555E89D2D07085D304F4F /* Release */, + 3F012ECECF9942D6D26FEF28931A9054 /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -5520,22 +5715,52 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 63DAAE1B3C844547AB6B4E9490D7C979 /* Build configuration list for PBXNativeTarget "IQKeyboardNotification-IQKeyboardNotification" */ = { + 4E0C012C8888905B35911F70B1AC5AEF /* Build configuration list for PBXNativeTarget "IQKeyboardNotification" */ = { isa = XCConfigurationList; buildConfigurations = ( - 5D65C20480CD1638A64822CF819348BB /* Debug */, - 6A12D2FD2E860D435F801E231808847B /* Release */, - 946384BF19448D77AF04CB5114DBCF14 /* SimulatorDebug */, + 6C8D478A408C8091D5776CF9B83B7EAA /* Debug */, + 01566EB080B5D3116D54A00F7BBFC796 /* Release */, + D570FF355C47048E4CEF4D94773CAA74 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 6988CE622F6ED709924CC52474D5D523 /* Build configuration list for PBXNativeTarget "IQTextView-IQTextView" */ = { + 6F2F8E9223CA64429D3DA4A35BBF385E /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification" */ = { isa = XCConfigurationList; buildConfigurations = ( - AD0AB773E05696871E507C0BA3F182CB /* Debug */, - 586B0D9EBD67B3D385760CD014900637 /* Release */, - 80ECF48F68A3A075A2A0D8B392C30F84 /* SimulatorDebug */, + 92982B7A6C682CF5DCAFBEC4827314F8 /* Debug */, + 2129046C72E3699C1A5CB89DEA1D79A5 /* Release */, + 9C3E3AE1E1B56155996EDBFCB40C72DC /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 735C3EDC6E7EC2865AEDDDA1F2D19E8C /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager-IQKeyboardReturnManager" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4A68D42D85F2983A8CBA83B44C45A5E1 /* Debug */, + 1162EE88C2B4989F77488A101084A430 /* Release */, + 6B56EAC318C09E4BBF9E34AC89BEDCC1 /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 743BAE4B6D3212011B29C6FBCEF3F1CA /* Build configuration list for PBXNativeTarget "IQKeyboardCore-IQKeyboardCore" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 47DD8A67554FA0CFEF75EB443BA908E8 /* Debug */, + 72D9B0E972F8A19A3FBAD2059C39C4D7 /* Release */, + B04DD2E1E6CC154979A493AC1223363A /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 77FFA3C6B014C764A235677BDA74421B /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar-IQKeyboardToolbar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 525FBC7B3A1F92004D696A96314B1688 /* Debug */, + E10CEEB1C1490644FA02CF1F52B38D15 /* Release */, + E8252A303DE806530C9337DFC9C81084 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5550,42 +5775,12 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 7B7782119E69124DD3565965BD15A882 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar-IQKeyboardToolbar" */ = { + 909E3FC7201534B950D3B53E3A6E76C6 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager" */ = { isa = XCConfigurationList; buildConfigurations = ( - 7A2AE90C14DDF3F5EA98F38A54A09F39 /* Debug */, - 1B03E27940D9DB99696B499239061A26 /* Release */, - D768CD154ED12F7BE1D6BB9E873A6911 /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 86208BF7557334C34C88E861EF42FB46 /* Build configuration list for PBXNativeTarget "IQKeyboardCore-IQKeyboardCore" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 87F708D71356EA1183EF5535D5FA83FE /* Debug */, - 00E826101F8ECF726DC994CEF0D6722C /* Release */, - 2A9DF9EAE34E515C55D0F836B17B0CC9 /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 875BEC2BC17CFCC0F5056A3B395DA258 /* Build configuration list for PBXNativeTarget "Pods-suixinkan" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BF65BDF3CFEB40B655601B9C7CFE2F9E /* Debug */, - 15E5D635811DE4DDEF79E7C0D7C02EE5 /* Release */, - 89A05ED16BE7F147E0B2C1D88345B7B6 /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9326D899006F80FE158FC378373C8595 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbar" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 09C31970175B907E646C8274BAB9E057 /* Debug */, - 3DE59E452D8974494117DF1C303917B3 /* Release */, - 5D2D3B802F1C540631553C6626C51D77 /* SimulatorDebug */, + 3809015D1911D42EADEE1B4CC8FA42C9 /* Debug */, + E14DC8D4EF06AD110D901EA1905F83E9 /* Release */, + 2AA75EE79F5096D732F5C8740CDAC26E /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5600,22 +5795,32 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9F2F12FF04A1DC0E7F0AF5684CA34C93 /* Build configuration list for PBXNativeTarget "IQKeyboardManagerSwift-IQKeyboardManagerSwift" */ = { + 9A49A90044DDEEF3E6FCA42DE3192D0E /* Build configuration list for PBXNativeTarget "Pods-suixinkan" */ = { isa = XCConfigurationList; buildConfigurations = ( - 975FEEA40A8C8BD46300095E53BD15EE /* Debug */, - 51A5AA0D4A6EA7B3DEE27239C671F20C /* Release */, - 0C48E272FEFCEBBFB916BC49AD53DB8B /* SimulatorDebug */, + 1548EA2F2CBEC9CE28DC21F855105996 /* Debug */, + 239EC0DD9DE95C2A8CA208AE47184167 /* Release */, + 3B3B37F221BCE09B66833AA9B02EA981 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - A4028273DF78599D569A697F515473BC /* Build configuration list for PBXNativeTarget "IQKeyboardNotification" */ = { + 9BBC50C6E9EFEF51C68190E6CCBD8E98 /* Build configuration list for PBXNativeTarget "IQTextView" */ = { isa = XCConfigurationList; buildConfigurations = ( - 006ECEB934E36E2BAC3C338BB61530B2 /* Debug */, - B0C58F24582EC0647BB0D8EC658E7C3B /* Release */, - EAB3DCC5A63DFB2910DB5131BA8617AB /* SimulatorDebug */, + 80433F2CA55A715C9B9804750BEFD39D /* Debug */, + 51C86BFF64DA5BE9F5C09D7EB4537156 /* Release */, + 75199AD2E2B123A0604ECE956585D169 /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A69E6688B29DDB5B863FC738C3DC943C /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification-IQTextInputViewNotification" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9F629D371199F6FD4180A160B119827 /* Debug */, + 08613EB11B5EFEB7B2ED6252F22D824B /* Release */, + 00880EDC05269801C446ED8C41643AEE /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5630,22 +5835,12 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - B02BDB8270BB7783F0A9C8763864097B /* Build configuration list for PBXAggregateTarget "UMDevice" */ = { + B8512451BF5D7A50FA5BBF381F5C922B /* Build configuration list for PBXAggregateTarget "VolcEngineRTC" */ = { isa = XCConfigurationList; buildConfigurations = ( - E91CE575290BC3A080E4391DC0E93244 /* Debug */, - 6FD6B6F43063FD5FCCE14F70DA9A5B69 /* Release */, - DDB0B8C1800EF25E633E9EF05D74FD72 /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BCB9D19D2F10472241947B3E83FFA193 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F0E1E72ABB5DF0FF9232765B8F59FAE6 /* Debug */, - 72A219A8FC63CFB344DBE3451FA1313D /* Release */, - 93211965B43F0CB2B08107959A929B0F /* SimulatorDebug */, + 52D243A8CBB51EAA0D78B04925AA39A4 /* Debug */, + D25BF0870C13B46E92683CB09CA3E8E1 /* Release */, + 704EF8B93B8BDAD0A59561D55C7976E2 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5660,12 +5855,12 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DBA22BA64605C2BEE511FFFAC16EEBF9 /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager" */ = { + CA8B8095420E4C741A74C6526E47B837 /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager" */ = { isa = XCConfigurationList; buildConfigurations = ( - 099143098447CA7F8B58F10A500B8F4A /* Debug */, - 5FAC6598990735686A996D7E70DF3EA8 /* Release */, - 8114091CF46E116D123C7DFC8F3175BF /* SimulatorDebug */, + 835213B0CD4B72C47ADC8B6CD0D341D5 /* Debug */, + F4A26ADA800ACEBFCFDC225CA809EB4C /* Release */, + 598E3828E2FACEEFF930BA2BC880BBEE /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5680,42 +5875,22 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E3CD454E946A968A8CC1F29529A26395 /* Build configuration list for PBXAggregateTarget "AMapFoundation-NO-IDFA" */ = { + E6679707463E9734F1AA92E686D468A3 /* Build configuration list for PBXNativeTarget "IQKeyboardNotification-IQKeyboardNotification" */ = { isa = XCConfigurationList; buildConfigurations = ( - 35BB84CEDBA5C1476D858453DE3FC701 /* Debug */, - 993C8EF2D62C050B1B18AE2E75654CEB /* Release */, - D17A5F9FE4EE86C216ACE61D6FB58CE7 /* SimulatorDebug */, + DBE26A3A19E49FBBF92C2614580D42E0 /* Debug */, + 3B4750357F3A04F91A015E6BFB7F9837 /* Release */, + 3632907CCAEFC18F7310607AEFFF8593 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E83D8F80B1FA8720A2E4132EFD404E69 /* Build configuration list for PBXNativeTarget "IQKeyboardReturnManager-IQKeyboardReturnManager" */ = { + E809C3838042546E636F2DB053A09E2B /* Build configuration list for PBXNativeTarget "IQTextView-IQTextView" */ = { isa = XCConfigurationList; buildConfigurations = ( - 66B8ED63760B2E1782BC65C56BB81A23 /* Debug */, - 374BDDC1B25527BE81775EB8627C15CD /* Release */, - 5462C869E62F6E27C1B8B088F9859726 /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EC63F6687A4C84131E235AAD4D9D25AC /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager-IQKeyboardToolbarManager" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7AB411313E0E948C032AC6FACEC06029 /* Debug */, - 46F98087C8D84310CDE4A60C95BB50E4 /* Release */, - BD10A3EFC96C5630E8B5AEC4C641679F /* SimulatorDebug */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F823D0D17289E29C0912BA8CB04F4429 /* Build configuration list for PBXNativeTarget "IQTextInputViewNotification-IQTextInputViewNotification" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2251E044D8EF017D45F9D3DEBBE7E37A /* Debug */, - 610FF798BB5843B0008389B878CF0E3E /* Release */, - AC920FCB33A41A7879A8121BC9971074 /* SimulatorDebug */, + 65BED541222A9C5AB802EC59453C0FF2 /* Debug */, + 39B94A7458BBA2A3F1E43B8E67C71532 /* Release */, + EA8DCB40DF90E640476FFD1ECAE29C32 /* SimulatorDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -5730,6 +5905,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FB14A79E9663C6618BBD2C76C46813E0 /* Build configuration list for PBXNativeTarget "IQKeyboardToolbarManager-IQKeyboardToolbarManager" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B959E24DFDF96888F01F178AAA9D4401 /* Debug */, + 080BBC6931C827C0F4E5E44F8547C0C3 /* Release */, + 0E2DB34C8255944824CBA5C7C163AC2B /* SimulatorDebug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.markdown b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.markdown index 29d95ee..3a0e4c1 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.markdown +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.markdown @@ -242,6 +242,10 @@ Copyright 2011 - 2021 umeng.com. All rights reserved. Copyright 2011 - 2021 umeng.com. All rights reserved. +## VolcEngineRTC + +Bytedance copyright + ## WechatOpenSDK-XCFramework Copyright 2020 tencent.com. All rights reserved. diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.plist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.plist index 64c102e..ce7b4b6 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.plist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-acknowledgements.plist @@ -355,6 +355,16 @@ SOFTWARE. Type PSGroupSpecifier + + FooterText + Bytedance copyright + License + Copyright + Title + VolcEngineRTC + Type + PSGroupSpecifier + FooterText Copyright 2020 tencent.com. All rights reserved. diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-input-files.xcfilelist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-input-files.xcfilelist index d1e0b2b..cbf841d 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-input-files.xcfilelist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-input-files.xcfilelist @@ -6,4 +6,7 @@ ${BUILT_PRODUCTS_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework ${BUILT_PRODUCTS_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework ${BUILT_PRODUCTS_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework ${BUILT_PRODUCTS_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework -${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework \ No newline at end of file +${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework/VolcEngineRTC +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework/RTCFFmpeg +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework/RealXBase \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-output-files.xcfilelist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-output-files.xcfilelist index 438c080..7f02aab 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-output-files.xcfilelist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Debug-output-files.xcfilelist @@ -5,4 +5,7 @@ ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardReturnManager.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardToolbar.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardToolbarManager.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextInputViewNotification.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextView.framework \ No newline at end of file +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextView.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VolcEngineRTC.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RTCFFmpeg.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealXBase.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-input-files.xcfilelist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-input-files.xcfilelist index d1e0b2b..cbf841d 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-input-files.xcfilelist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-input-files.xcfilelist @@ -6,4 +6,7 @@ ${BUILT_PRODUCTS_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework ${BUILT_PRODUCTS_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework ${BUILT_PRODUCTS_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework ${BUILT_PRODUCTS_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework -${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework \ No newline at end of file +${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework/VolcEngineRTC +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework/RTCFFmpeg +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework/RealXBase \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-output-files.xcfilelist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-output-files.xcfilelist index 438c080..7f02aab 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-output-files.xcfilelist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-Release-output-files.xcfilelist @@ -5,4 +5,7 @@ ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardReturnManager.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardToolbar.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardToolbarManager.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextInputViewNotification.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextView.framework \ No newline at end of file +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextView.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VolcEngineRTC.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RTCFFmpeg.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealXBase.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-input-files.xcfilelist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-input-files.xcfilelist index d1e0b2b..cbf841d 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-input-files.xcfilelist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-input-files.xcfilelist @@ -6,4 +6,7 @@ ${BUILT_PRODUCTS_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework ${BUILT_PRODUCTS_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework ${BUILT_PRODUCTS_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework ${BUILT_PRODUCTS_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework -${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework \ No newline at end of file +${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework/VolcEngineRTC +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework/RTCFFmpeg +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework/RealXBase \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-output-files.xcfilelist b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-output-files.xcfilelist index 438c080..7f02aab 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-output-files.xcfilelist +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks-SimulatorDebug-output-files.xcfilelist @@ -5,4 +5,7 @@ ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardReturnManager.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardToolbar.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardToolbarManager.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextInputViewNotification.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextView.framework \ No newline at end of file +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQTextView.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VolcEngineRTC.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RTCFFmpeg.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealXBase.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks.sh b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks.sh index d6f878e..382c898 100755 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks.sh +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan-frameworks.sh @@ -184,6 +184,9 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework" install_framework "${BUILT_PRODUCTS_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework" install_framework "${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework" fi if [[ "$CONFIGURATION" == "Release" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/IQKeyboardCore/IQKeyboardCore.framework" @@ -194,6 +197,9 @@ if [[ "$CONFIGURATION" == "Release" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework" install_framework "${BUILT_PRODUCTS_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework" install_framework "${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework" fi if [[ "$CONFIGURATION" == "SimulatorDebug" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/IQKeyboardCore/IQKeyboardCore.framework" @@ -204,6 +210,9 @@ if [[ "$CONFIGURATION" == "SimulatorDebug" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework" install_framework "${BUILT_PRODUCTS_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework" install_framework "${BUILT_PRODUCTS_DIR}/IQTextView/IQTextView.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework" + install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework" fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then wait diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.debug.xcconfig b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.debug.xcconfig index a501f0d..8bd758d 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.debug.xcconfig +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.debug.xcconfig @@ -3,13 +3,13 @@ ARCHS = $(ARCHS_STANDARD) CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO ENABLE_USER_SCRIPT_SANDBOXING = NO EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/VolcEngineRTC" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore/IQKeyboardCore.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification/IQKeyboardNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView/IQTextView.framework/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush" "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift -OTHER_LDFLAGS = $(inherited) -ObjC -l"JCore" -l"JPush" -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "AMapFoundationKit" -framework "AMapLocationKit" -framework "AMapSearchKit" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "MAMapKit" -framework "OpenGLES" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "UMAPM" -framework "UMCommon" -framework "UMDevice" -framework "WebKit" -framework "WechatOpenSDK" -weak_framework "Network" -weak_framework "UserNotifications" -OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/AMap3DMap-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapFoundation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapLocation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapSearch-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "-F${PODS_CONFIGURATION_BUILD_DIR}/JCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/JPush" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMAPM" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMCommon" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMDevice" "-F${PODS_CONFIGURATION_BUILD_DIR}/WechatOpenSDK-XCFramework" +OTHER_LDFLAGS = $(inherited) -ObjC -l"JCore" -l"JPush" -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "AMapFoundationKit" -framework "AMapLocationKit" -framework "AMapSearchKit" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "MAMapKit" -framework "OpenGLES" -framework "QuartzCore" -framework "RTCFFmpeg" -framework "RealXBase" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "UMAPM" -framework "UMCommon" -framework "UMDevice" -framework "VolcEngineRTC" -framework "WebKit" -framework "WechatOpenSDK" -weak_framework "Network" -weak_framework "UserNotifications" +OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/AMap3DMap-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapFoundation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapLocation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapSearch-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "-F${PODS_CONFIGURATION_BUILD_DIR}/JCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/JPush" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMAPM" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMCommon" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMDevice" "-F${PODS_CONFIGURATION_BUILD_DIR}/VolcEngineRTC" "-F${PODS_CONFIGURATION_BUILD_DIR}/WechatOpenSDK-XCFramework" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.release.xcconfig b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.release.xcconfig index a501f0d..8bd758d 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.release.xcconfig +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.release.xcconfig @@ -3,13 +3,13 @@ ARCHS = $(ARCHS_STANDARD) CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO ENABLE_USER_SCRIPT_SANDBOXING = NO EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/VolcEngineRTC" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore/IQKeyboardCore.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification/IQKeyboardNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView/IQTextView.framework/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush" "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift -OTHER_LDFLAGS = $(inherited) -ObjC -l"JCore" -l"JPush" -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "AMapFoundationKit" -framework "AMapLocationKit" -framework "AMapSearchKit" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "MAMapKit" -framework "OpenGLES" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "UMAPM" -framework "UMCommon" -framework "UMDevice" -framework "WebKit" -framework "WechatOpenSDK" -weak_framework "Network" -weak_framework "UserNotifications" -OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/AMap3DMap-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapFoundation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapLocation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapSearch-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "-F${PODS_CONFIGURATION_BUILD_DIR}/JCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/JPush" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMAPM" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMCommon" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMDevice" "-F${PODS_CONFIGURATION_BUILD_DIR}/WechatOpenSDK-XCFramework" +OTHER_LDFLAGS = $(inherited) -ObjC -l"JCore" -l"JPush" -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "AMapFoundationKit" -framework "AMapLocationKit" -framework "AMapSearchKit" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "MAMapKit" -framework "OpenGLES" -framework "QuartzCore" -framework "RTCFFmpeg" -framework "RealXBase" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "UMAPM" -framework "UMCommon" -framework "UMDevice" -framework "VolcEngineRTC" -framework "WebKit" -framework "WechatOpenSDK" -weak_framework "Network" -weak_framework "UserNotifications" +OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/AMap3DMap-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapFoundation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapLocation-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/AMapSearch-NO-IDFA" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "-F${PODS_CONFIGURATION_BUILD_DIR}/JCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/JPush" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMAPM" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMCommon" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMDevice" "-F${PODS_CONFIGURATION_BUILD_DIR}/VolcEngineRTC" "-F${PODS_CONFIGURATION_BUILD_DIR}/WechatOpenSDK-XCFramework" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.simulatordebug.xcconfig b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.simulatordebug.xcconfig index 28236a8..2f32434 100644 --- a/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.simulatordebug.xcconfig +++ b/Pods/Target Support Files/Pods-suixinkan/Pods-suixinkan.simulatordebug.xcconfig @@ -1,13 +1,13 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO ENABLE_USER_SCRIPT_SANDBOXING = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/VolcEngineRTC" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore/IQKeyboardCore.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification/IQKeyboardNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView/IQTextView.framework/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush" "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift -OTHER_LDFLAGS = $(inherited) -ObjC -l"JCore" -l"JPush" -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "UMAPM" -framework "UMCommon" -framework "UMDevice" -framework "WebKit" -framework "WechatOpenSDK" -weak_framework "Network" -weak_framework "UserNotifications" -OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "-F${PODS_CONFIGURATION_BUILD_DIR}/JCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/JPush" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMAPM" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMCommon" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMDevice" "-F${PODS_CONFIGURATION_BUILD_DIR}/WechatOpenSDK-XCFramework" +OTHER_LDFLAGS = $(inherited) -ObjC -l"JCore" -l"JPush" -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "RTCFFmpeg" -framework "RealXBase" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "UMAPM" -framework "UMCommon" -framework "UMDevice" -framework "VolcEngineRTC" -framework "WebKit" -framework "WechatOpenSDK" -weak_framework "Network" -weak_framework "UserNotifications" +OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "-F${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "-F${PODS_CONFIGURATION_BUILD_DIR}/JCore" "-F${PODS_CONFIGURATION_BUILD_DIR}/JPush" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMAPM" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMCommon" "-F${PODS_CONFIGURATION_BUILD_DIR}/UMDevice" "-F${PODS_CONFIGURATION_BUILD_DIR}/VolcEngineRTC" "-F${PODS_CONFIGURATION_BUILD_DIR}/WechatOpenSDK-XCFramework" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.debug.xcconfig b/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.debug.xcconfig index 44ef691..5cdd3c8 100644 --- a/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.debug.xcconfig +++ b/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.debug.xcconfig @@ -2,10 +2,10 @@ ARCHS = $(ARCHS_STANDARD) CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO ENABLE_USER_SCRIPT_SANDBOXING = NO EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/VolcEngineRTC" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore/IQKeyboardCore.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification/IQKeyboardNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView/IQTextView.framework/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush/Headers" -OTHER_LDFLAGS = $(inherited) -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "OpenGLES" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "WebKit" -weak_framework "Network" -weak_framework "UserNotifications" +OTHER_LDFLAGS = $(inherited) -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "OpenGLES" -framework "QuartzCore" -framework "RTCFFmpeg" -framework "RealXBase" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "VolcEngineRTC" -framework "WebKit" -weak_framework "Network" -weak_framework "UserNotifications" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. diff --git a/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.release.xcconfig b/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.release.xcconfig index 44ef691..5cdd3c8 100644 --- a/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.release.xcconfig +++ b/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.release.xcconfig @@ -2,10 +2,10 @@ ARCHS = $(ARCHS_STANDARD) CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO ENABLE_USER_SCRIPT_SANDBOXING = NO EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/AMap3DMap-NO-IDFA" "${PODS_ROOT}/AMapFoundation-NO-IDFA" "${PODS_ROOT}/AMapLocation-NO-IDFA" "${PODS_ROOT}/AMapSearch-NO-IDFA" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/VolcEngineRTC" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore/IQKeyboardCore.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification/IQKeyboardNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView/IQTextView.framework/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush/Headers" -OTHER_LDFLAGS = $(inherited) -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "OpenGLES" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "WebKit" -weak_framework "Network" -weak_framework "UserNotifications" +OTHER_LDFLAGS = $(inherited) -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "CoreText" -framework "ExternalAccessory" -framework "Foundation" -framework "GLKit" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "OpenGLES" -framework "QuartzCore" -framework "RTCFFmpeg" -framework "RealXBase" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "VolcEngineRTC" -framework "WebKit" -weak_framework "Network" -weak_framework "UserNotifications" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. diff --git a/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.simulatordebug.xcconfig b/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.simulatordebug.xcconfig index 6d816be..d1cf259 100644 --- a/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.simulatordebug.xcconfig +++ b/Pods/Target Support Files/Pods-suixinkanTests/Pods-suixinkanTests.simulatordebug.xcconfig @@ -2,10 +2,10 @@ ARCHS = $(ARCHS_STANDARD) CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO ENABLE_USER_SCRIPT_SANDBOXING = NO EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView" "${PODS_ROOT}/JCore" "${PODS_ROOT}/JPush" "${PODS_ROOT}/UMAPM/UMAPM_2.0.7" "${PODS_ROOT}/UMCommon/UMCommon_7.5.11" "${PODS_ROOT}/UMDevice/UMDevice_3.6.0" "${PODS_ROOT}/VolcEngineRTC" "${PODS_ROOT}/WechatOpenSDK-XCFramework" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMAPM" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMCommon" "${PODS_XCFRAMEWORKS_BUILD_DIR}/UMDevice" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" "${PODS_XCFRAMEWORKS_BUILD_DIR}/WechatOpenSDK-XCFramework" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardCore/IQKeyboardCore.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardNotification/IQKeyboardNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardReturnManager/IQKeyboardReturnManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbar/IQKeyboardToolbar.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardToolbarManager/IQKeyboardToolbarManager.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextInputViewNotification/IQTextInputViewNotification.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/IQTextView/IQTextView.framework/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JCore/Headers" "${PODS_XCFRAMEWORKS_BUILD_DIR}/JPush/Headers" -OTHER_LDFLAGS = $(inherited) -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "WebKit" -weak_framework "Network" -weak_framework "UserNotifications" +OTHER_LDFLAGS = $(inherited) -l"c++" -l"resolv" -l"sqlite3" -l"sqlite3.0" -l"z" -framework "CFNetwork" -framework "Combine" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "IQKeyboardCore" -framework "IQKeyboardManagerSwift" -framework "IQKeyboardNotification" -framework "IQKeyboardReturnManager" -framework "IQKeyboardToolbar" -framework "IQKeyboardToolbarManager" -framework "IQTextInputViewNotification" -framework "IQTextView" -framework "RTCFFmpeg" -framework "RealXBase" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "VolcEngineRTC" -framework "WebKit" -weak_framework "Network" -weak_framework "UserNotifications" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. diff --git a/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-input-files.xcfilelist b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-input-files.xcfilelist new file mode 100644 index 0000000..3e51548 --- /dev/null +++ b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-input-files.xcfilelist @@ -0,0 +1,4 @@ +${PODS_ROOT}/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks.sh +${PODS_ROOT}/VolcEngineRTC/VolcEngineRTC.xcframework +${PODS_ROOT}/VolcEngineRTC/RTCFFmpeg.xcframework +${PODS_ROOT}/VolcEngineRTC/RealXBase.xcframework \ No newline at end of file diff --git a/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-output-files.xcfilelist b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-output-files.xcfilelist new file mode 100644 index 0000000..08f1aba --- /dev/null +++ b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks-output-files.xcfilelist @@ -0,0 +1,3 @@ +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core/VolcEngineRTC.framework +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg/RTCFFmpeg.framework +${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase/RealXBase.framework \ No newline at end of file diff --git a/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks.sh b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks.sh new file mode 100755 index 0000000..108786d --- /dev/null +++ b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC-xcframeworks.sh @@ -0,0 +1,146 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +function on_error { + echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" +} +trap 'on_error $LINENO' ERR + + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + + +variant_for_slice() +{ + case "$1" in + "VolcEngineRTC.xcframework/ios-arm64") + echo "" + ;; + "VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator") + echo "simulator" + ;; + "RTCFFmpeg.xcframework/ios-arm64") + echo "" + ;; + "RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator") + echo "simulator" + ;; + "RealXBase.xcframework/ios-arm64") + echo "" + ;; + "RealXBase.xcframework/ios-arm64_x86_64-simulator") + echo "simulator" + ;; + esac +} + +archs_for_slice() +{ + case "$1" in + "VolcEngineRTC.xcframework/ios-arm64") + echo "arm64" + ;; + "VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator") + echo "arm64 x86_64" + ;; + "RTCFFmpeg.xcframework/ios-arm64") + echo "arm64" + ;; + "RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator") + echo "arm64 x86_64" + ;; + "RealXBase.xcframework/ios-arm64") + echo "arm64" + ;; + "RealXBase.xcframework/ios-arm64_x86_64-simulator") + echo "arm64 x86_64" + ;; + esac +} + +copy_dir() +{ + local source="$1" + local destination="$2" + + # Use filter instead of exclude so missing patterns don't throw errors. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" \"${source}*\" \"${destination}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "${source}"/* "${destination}" +} + +SELECT_SLICE_RETVAL="" + +select_slice() { + local xcframework_name="$1" + xcframework_name="${xcframework_name##*/}" + local paths=("${@:2}") + # Locate the correct slice of the .xcframework for the current architectures + local target_path="" + + # Split archs on space so we can find a slice that has all the needed archs + local target_archs=$(echo $ARCHS | tr " " "\n") + + local target_variant="" + if [[ "$PLATFORM_NAME" == *"simulator" ]]; then + target_variant="simulator" + fi + if [[ ! -z ${EFFECTIVE_PLATFORM_NAME+x} && "$EFFECTIVE_PLATFORM_NAME" == *"maccatalyst" ]]; then + target_variant="maccatalyst" + fi + for i in ${!paths[@]}; do + local matched_all_archs="1" + local slice_archs="$(archs_for_slice "${xcframework_name}/${paths[$i]}")" + local slice_variant="$(variant_for_slice "${xcframework_name}/${paths[$i]}")" + for target_arch in $target_archs; do + if ! [[ "${slice_variant}" == "$target_variant" ]]; then + matched_all_archs="0" + break + fi + + if ! echo "${slice_archs}" | tr " " "\n" | grep -F -q -x "$target_arch"; then + matched_all_archs="0" + break + fi + done + + if [[ "$matched_all_archs" == "1" ]]; then + # Found a matching slice + echo "Selected xcframework slice ${paths[$i]}" + SELECT_SLICE_RETVAL=${paths[$i]} + break + fi + done +} + +install_xcframework() { + local basepath="$1" + local name="$2" + local package_type="$3" + local paths=("${@:4}") + + # Locate the correct slice of the .xcframework for the current architectures + select_slice "${basepath}" "${paths[@]}" + local target_path="$SELECT_SLICE_RETVAL" + if [[ -z "$target_path" ]]; then + echo "warning: [CP] $(basename ${basepath}): Unable to find matching slice in '${paths[@]}' for the current build architectures ($ARCHS) and platform (${EFFECTIVE_PLATFORM_NAME-${PLATFORM_NAME}})." + return + fi + local source="$basepath/$target_path" + + local destination="${PODS_XCFRAMEWORKS_BUILD_DIR}/${name}" + + if [ ! -d "$destination" ]; then + mkdir -p "$destination" + fi + + copy_dir "$source/" "$destination" + echo "Copied $source to $destination" +} + +install_xcframework "${PODS_ROOT}/VolcEngineRTC/VolcEngineRTC.xcframework" "VolcEngineRTC/Core" "framework" "ios-arm64" "ios-arm64_x86_64-simulator" +install_xcframework "${PODS_ROOT}/VolcEngineRTC/RTCFFmpeg.xcframework" "VolcEngineRTC/RTCFFmpeg" "framework" "ios-arm64" "ios-arm64_x86_64-simulator" +install_xcframework "${PODS_ROOT}/VolcEngineRTC/RealXBase.xcframework" "VolcEngineRTC/RealXBase" "framework" "ios-arm64" "ios-arm64_x86_64-simulator" diff --git a/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC.debug.xcconfig b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC.debug.xcconfig new file mode 100644 index 0000000..669d927 --- /dev/null +++ b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC.debug.xcconfig @@ -0,0 +1,13 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/VolcEngineRTC +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/VolcEngineRTC" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/VolcEngineRTC +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC.release.xcconfig b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC.release.xcconfig new file mode 100644 index 0000000..669d927 --- /dev/null +++ b/Pods/Target Support Files/VolcEngineRTC/VolcEngineRTC.release.xcconfig @@ -0,0 +1,13 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/VolcEngineRTC +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/VolcEngineRTC" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RTCFFmpeg" "${PODS_XCFRAMEWORKS_BUILD_DIR}/VolcEngineRTC/RealXBase" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/VolcEngineRTC +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/Info.plist b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/Info.plist new file mode 100644 index 0000000..7697468 --- /dev/null +++ b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/Info.plist @@ -0,0 +1,40 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + RTCFFmpeg.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64 + LibraryPath + RTCFFmpeg.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64/RTCFFmpeg.framework/Info.plist b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64/RTCFFmpeg.framework/Info.plist new file mode 100644 index 0000000..2343a93 --- /dev/null +++ b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64/RTCFFmpeg.framework/Info.plist @@ -0,0 +1,47 @@ + + + + + BuildMachineOSBuild + 20F71 + CFBundleDevelopmentRegion + English + CFBundleExecutable + RTCFFmpeg + CFBundleIdentifier + com.bytedance.RTCFFmpeg + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + 1.0.0 + CFBundleName + RTCFFmpeg + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 18E182 + DTPlatformName + iphonesimulator + DTPlatformVersion + 14.5 + DTSDKBuild + 18E182 + MinimumOSVersion + 9.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64/RTCFFmpeg.framework/RTCFFmpeg b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64/RTCFFmpeg.framework/RTCFFmpeg new file mode 100755 index 0000000..fc841ae Binary files /dev/null and b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64/RTCFFmpeg.framework/RTCFFmpeg differ diff --git a/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator/RTCFFmpeg.framework/Info.plist b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator/RTCFFmpeg.framework/Info.plist new file mode 100644 index 0000000..2343a93 --- /dev/null +++ b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator/RTCFFmpeg.framework/Info.plist @@ -0,0 +1,47 @@ + + + + + BuildMachineOSBuild + 20F71 + CFBundleDevelopmentRegion + English + CFBundleExecutable + RTCFFmpeg + CFBundleIdentifier + com.bytedance.RTCFFmpeg + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + 1.0.0 + CFBundleName + RTCFFmpeg + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 18E182 + DTPlatformName + iphonesimulator + DTPlatformVersion + 14.5 + DTSDKBuild + 18E182 + MinimumOSVersion + 9.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator/RTCFFmpeg.framework/RTCFFmpeg b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator/RTCFFmpeg.framework/RTCFFmpeg new file mode 100755 index 0000000..2d0c1a3 Binary files /dev/null and b/Pods/VolcEngineRTC/RTCFFmpeg.xcframework/ios-arm64_x86_64-simulator/RTCFFmpeg.framework/RTCFFmpeg differ diff --git a/Pods/VolcEngineRTC/RealXBase.xcframework/Info.plist b/Pods/VolcEngineRTC/RealXBase.xcframework/Info.plist new file mode 100644 index 0000000..bf9eb6d --- /dev/null +++ b/Pods/VolcEngineRTC/RealXBase.xcframework/Info.plist @@ -0,0 +1,40 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64 + LibraryPath + RealXBase.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + RealXBase.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64/RealXBase.framework/Info.plist b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64/RealXBase.framework/Info.plist new file mode 100644 index 0000000..2b2aec8 --- /dev/null +++ b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64/RealXBase.framework/Info.plist @@ -0,0 +1,51 @@ + + + + + BuildMachineOSBuild + 22H730 + CFBundleDevelopmentRegion + en + CFBundleExecutable + RealXBase + CFBundleIdentifier + com.bytedance.realx.RealXBase + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + RealXBase + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 20B71 + DTPlatformName + iphonesimulator + DTPlatformVersion + 16.1 + DTSDKBuild + 20B71 + DTSDKName + iphonesimulator16.1 + DTXcode + 1410 + DTXcodeBuild + 14B47b + MinimumOSVersion + 11.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64/RealXBase.framework/RealXBase b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64/RealXBase.framework/RealXBase new file mode 100755 index 0000000..b2bb12a Binary files /dev/null and b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64/RealXBase.framework/RealXBase differ diff --git a/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64_x86_64-simulator/RealXBase.framework/Info.plist b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64_x86_64-simulator/RealXBase.framework/Info.plist new file mode 100644 index 0000000..2b2aec8 --- /dev/null +++ b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64_x86_64-simulator/RealXBase.framework/Info.plist @@ -0,0 +1,51 @@ + + + + + BuildMachineOSBuild + 22H730 + CFBundleDevelopmentRegion + en + CFBundleExecutable + RealXBase + CFBundleIdentifier + com.bytedance.realx.RealXBase + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + RealXBase + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 20B71 + DTPlatformName + iphonesimulator + DTPlatformVersion + 16.1 + DTSDKBuild + 20B71 + DTSDKName + iphonesimulator16.1 + DTXcode + 1410 + DTXcodeBuild + 14B47b + MinimumOSVersion + 11.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64_x86_64-simulator/RealXBase.framework/RealXBase b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64_x86_64-simulator/RealXBase.framework/RealXBase new file mode 100755 index 0000000..e3bb91c Binary files /dev/null and b/Pods/VolcEngineRTC/RealXBase.xcframework/ios-arm64_x86_64-simulator/RealXBase.framework/RealXBase differ diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/Info.plist b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/Info.plist new file mode 100644 index 0000000..606bd08 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/Info.plist @@ -0,0 +1,40 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + VolcEngineRTC.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64 + LibraryPath + VolcEngineRTC.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/VolcEngineRTC.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/VolcEngineRTC.h new file mode 100644 index 0000000..5c97a58 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/VolcEngineRTC.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Advance API + */ + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine.h new file mode 100644 index 0000000..e24d327 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine.h @@ -0,0 +1,3219 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface Lite + */ + +#pragma once + +#include "bytertc_room.h" +#include "bytertc_game_room.h" +#include "rtc/bytertc_video_device_manager.h" +#include "rtc/bytertc_audio_frame.h" +#include "rtc/bytertc_audio_mixing_manager.h" +#include "rtc/bytertc_audio_effect_player.h" +#include "rtc/bytertc_media_player.h" +#include "rtc/bytertc_video_processor_interface.h" +#include "rtc/bytertc_camera_control_interface.h" +#include "bytertc_engine_event_handler.h" +#include "rtc/bytertc_sing_scoring_interface.h" +#include "rtc/bytertc_ktv_manager_interface.h" +#include "rtc/bytertc_wtn_stream_interface.h" + +namespace bytertc { + +/** + * + * @type api + * @brief 引擎 API + * @list + */ + +class IRTCEngine { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTCEngine() { + } + /** + * + * @valid since 3.58.1 + * @type api + * @brief 设置是否将录音信号静音(不改变本端硬件)。 + * @param mute 是否静音音频采集。
+ * - True:静音(关闭麦克风) + * - False:(默认)开启麦克风 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 该方法用于设置是否使用静音数据替换设备采集到的音频数据进行推流,不影响 SDK 音频流的采集发布状态。对于 Windows 平台,如有需要你也可以选择静音整个系统的音频采集,具体参看 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 方法说明。 + * - 静音后通过 setCaptureVolume{@link #IRTCEngine#setCaptureVolume} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 音频管理 + */ + + virtual int muteAudioCapture(bool mute) = 0; + /** + * + * @valid since 3.60. + * @type api + * @brief 静音/取消静音屏幕共享时采集的音频。
+ * 调用此方法后,SDK 将发送静音数据来代替真实的屏幕音频数据,不影响本端音频设备的采集状态和 SDK 音频流的采集发布状态。 + * @param mute 是否静音屏幕音频。
+ * - True:静音。远端用户听不到来自你屏幕共享的声音。 + * - False:(默认)取消静音。恢复发送屏幕共享的音频。 + * @return + * - 0:调用成功。 + * - < 0:调用失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 静音后通过 setCaptureVolume{@link #IRTCEngine#setCaptureVolume} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 屏幕共享 + */ + + virtual int muteScreenAudioCapture(bool mute) = 0; + + /** + * + * @type api + * @brief 调节麦克风音频采集音量。
+ * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。 + * @param volume 采集的音量值和原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
+ * 为保证更好的通话质量,建议将 volume 值设为 [0, 100]。
+ * - 0:静音 + * - 100:原始音量 + * - 400:原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 在开启音频采集前后,你都可以使用此接口设定采集音量。 + * @list 音频管理 + */ + + virtual int setCaptureVolume(int volume) = 0; + /** + * + * @type api + * @valid Available since 3.60. + * @brief 调节屏幕共享时采集的音频音量。
+ * 只改变音频数据的音量信息,不影响麦克风采集的音量,也不会改变本端音频设备本身的音量。 + * @param volume 采集音量与原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
+ * 为保证更好的通话质量,建议将 volume 值设为 [0, 100]。
+ * - 0: 静音 + * - 100: 原始音量 + * - 400: 原始音量的 4 倍(自带溢出保护) + * + * @return + * + 0: 调用成功。
+ * + < 0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 在开启屏幕音频采集前后,你都可以使用此接口设定采集音量。 + * @list 屏幕共享 + */ + + virtual int setScreenCaptureVolume(int volume) = 0; + /** + * + * @type api + * @brief 调节本地播放的所有远端用户音频混音后的音量,混音内容包括远端人声、音乐、音效等。
+ * 播放音频前或播放音频时,你都可以使用此接口设定播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
+ * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。
+ * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。
+ * - 0: 静音 + * - 100: 原始音量 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,当该方法与 setRemoteAudioPlaybackVolume{@link #IRTCEngine#setRemoteAudioPlaybackVolume} 或 setRemoteRoomAudioPlaybackVolume{@link #IRTCRoom#setRemoteRoomAudioPlaybackVolume} 共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + + virtual int setPlaybackVolume(const int volume) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启/关闭耳返功能 + * @param mode 是否开启耳返功能,参看 EarMonitorMode{@link #EarMonitorMode} + * @return + * - 0:调用成功。 + * - < 0:调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + + virtual int setEarMonitorMode(EarMonitorMode mode) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. + * @type api + * @brief 开启/关闭耳返功能,并控制是否对耳返音频应用本地音频处理。 + * @param mode 是否开启耳返功能,参看 EarMonitorMode{@link #EarMonitorMode}。默认关闭。 + * @param filter 是否对耳返音频应用本地音频处理,参看 EarMonitorAudioFilter{@link #EarMonitorAudioFilter}。默认不经过音频处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + + virtual int setEarMonitorMode(EarMonitorMode mode, int filter) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置耳返的音量 + * @param volume 耳返的音量相对原始音量的比值,取值范围:[0,100],单位:% + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 设置耳返音量前,你必须先调用 setEarMonitorMode{@link #IRTCEngine#setEarMonitorMode} 打开耳返功能。 + * @list 高级功能 + */ + + virtual int setEarMonitorVolume(const int volume) = 0; + /** + * + * @hidden(macOS,Windows,Linux,Android) + * @type api + * @brief 设置蓝牙模式 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 仅在媒体场景下生效。 + * @list 高级功能 + */ + + virtual int setBluetoothMode(BluetoothMode mode) = 0; + /** + * + * @type api + * @brief 开启内部音频采集。默认为关闭状态。
+ * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
+ * 调用该方法开启后,本地用户会收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 的回调。
+ * 非隐身用户进房后调用该方法,房间中的其他用户会收到 onUserStartAudioCapture{@link #IRTCEngineEventHandler#onUserStartAudioCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 若未取得当前设备的麦克风权限,调用该方法后会触发 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 回调,对应的错误码为 `MediaDeviceError.kMediaDeviceErrorDeviceNoPermission = 1`。 + * - 调用 stopAudioCapture{@link #IRTCEngine#stopAudioCapture} 可以关闭音频采集设备,否则,SDK 只会在销毁引擎的时候自动关闭设备。 + * - 由于不同硬件设备初始化响应时间不同,频繁调用 stopAudioCapture{@link #IRTCEngine#stopAudioCapture} 和本接口闭麦/开麦可能出现短暂无声问题,建议使用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 实现临时闭麦和重新开麦。 + * - 创建引擎后,无论是否发布音频数据,你都可以调用该方法开启音频采集,并且调用后方可发布音频。 + * - 对于 Windows SDK,如果需要从自定义音频采集切换为内部音频采集,你必须先停止发布流,调用 setAudioSourceType{@link #IRTCEngine#setAudioSourceType} 关闭自定义采集,再调用此方法手动开启内部采集。 + * @list 音频管理 + */ + + virtual int startAudioCapture() = 0; + /** + * + * @type api + * @brief 立即关闭内部音频采集。默认为关闭状态。
+ * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
+ * 调用该方法,本地用户会收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 的回调。
+ * 非隐身用户进房后调用该方法后,房间中的其他用户会收到 onUserStopAudioCapture{@link #IRTCEngineEventHandler#onUserStopAudioCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 可以开启音频采集设备。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部音频采集才会停止。 + * @list 音频管理 + */ + + virtual int stopAudioCapture() = 0; + + /** + * + * @hidden(macOS,Windows,Linux) + * @valid since 3.60. + * @type api + * @brief 设置音频场景类型。
+ * 选择音频场景后,SDK 会自动根据场景切换对应的音量模式(通话音量/媒体音量)和该场景下的最佳音频配置。
+ * @param scenario 音频场景类型,参看 AudioScenarioType{@link #AudioScenarioType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 此接口必须在加入 RTC 房间前调用。 + * - 通话音量更适合通话、会议等对信息准确度更高的场景。通话音量会激活系统硬件信号处理,使通话声音更清晰。同时,音量无法降低到 0。 + * - 媒体音量更适合娱乐场景,因其声音的表现力会更强。媒体音量下,最低音量可以为 0。 + * @list Audio Management + */ + + virtual int setAudioScenario(AudioScenarioType scenario) = 0; + + /** + * + * @hidden(Linux) + * @type api + * @brief 设置变声特效类型 + * @param voice_changer 变声特效类型,参看 VoiceChangerType{@link #VoiceChangerType}。 + * @return 方法调用结果:
+ * - 0:成功; + * - !0:失败。 + * @note + * - 如需使用该功能,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 与 setVoiceReverbType{@link #IRTCEngine#setVoiceReverbType} 互斥,后设置的特效会覆盖先设置的特效。 + * - 在 Windows 端使用此功能前,必须额外接入 [音频技术](https: + * @list 音频处理 + */ + + virtual int setVoiceChangerType(VoiceChangerType voice_changer) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置混响特效类型 + * @param voice_reverb 混响特效类型,参看 VoiceReverbType{@link #VoiceReverbType}。 + * @return 方法调用结果:
+ * - 0:成功; + * - !0:失败。 + * @note + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 只在包含美声特效能力的 SDK 中有效。 + * - 与 setVoiceChangerType{@link #IRTCEngine#setVoiceChangerType} 互斥,后设置的特效会覆盖先设置的特效。 + * @list 音频处理 + */ + + virtual int setVoiceReverbType(VoiceReverbType voice_reverb) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置本地采集语音的均衡效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param config 语音均衡效果,参看 VoiceEqualizationConfig{@link #VoiceEqualizationConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 根据奈奎斯特采样率,音频采样率必须大于等于设置的中心频率的两倍,否则,设置不生效。 + * @list 音频处理 + */ + + virtual int setLocalVoiceEqualization(VoiceEqualizationConfig config) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置本地采集音频的混响效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param param 混响效果,参看 VoiceReverbConfig{@link #VoiceReverbConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 调用 enableLocalVoiceReverb{@link #IRTCEngine#enableLocalVoiceReverb} 开启混响效果。 + * @list 音频处理 + */ + + virtual int setLocalVoiceReverbParam(VoiceReverbConfig param) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启本地音效混响效果 + * @param enable 是否开启 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 调用 setLocalVoiceReverbParam{@link #IRTCEngine#setLocalVoiceReverbParam} 设置混响效果。 + * @list 音频处理 + */ + + virtual int enableLocalVoiceReverb(bool enable) = 0; + /** + * + * @type api + * @brief 设置音质档位。
+ * 当所选的 RoomProfileType{@link #RoomProfileType} 中的音频参数无法满足你的场景需求时,调用本接口切换的音质档位。 + * @param audio_profile 音质档位,参看 AudioProfileType{@link #AudioProfileType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该方法在进房前后均可调用; + * - 支持通话过程中动态切换音质档位。 + * @list 音频管理 + */ + + virtual int setAudioProfile(AudioProfileType audio_profile) = 0; + /** + * + * @valid since 3.52 + * @type api + * @brief 支持根据业务场景,设置通话中的音频降噪模式。 + * @param ans_mode 降噪模式。具体参见 AnsMode{@link #AnsMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该接口进房前后均可调用,可重复调用,仅最后一次调用生效。 + * - 降噪算法包含传统降噪和 AI 降噪。传统降噪主要是抑制平稳噪声,比如空调声、风扇声等。而 AI 降噪主要是抑制非平稳噪声,比如键盘敲击声、桌椅碰撞声等。 + * - 只有以下 RoomProfileType{@link #RoomProfileType} 场景时,调用本接口可以开启 AI 降噪。其余场景的 AI 降噪不会生效。 + * - 游戏语音模式:kRoomProfileTypeGame + * - 高音质游戏模式:kRoomProfileTypeGameHD + * - 云游戏模式:kRoomProfileTypeCloudGame + * - 1 vs 1 音视频通话:kRoomProfileTypeChat + * - 多端同步播放音视频:kRoomProfileTypeLwTogether + * - 云端会议中的个人设备:kRoomProfileTypeMeeting + * - 课堂互动模式:kRoomProfileTypeClassroom + * - 云端会议中的会议室终端:kRoomProfileTypeMeetingRoom + * @list 高级功能 + */ + + virtual int setAnsMode(AnsMode ans_mode) = 0; + /** + * + * @valid since 3.51 + * @type api + * @brief 打开/关闭 AAGC(Analog Automatic Gain Control)模拟自动增益控制功能。
+ * 开启该功能后,SDK 会自动调节麦克风的采集音量,确保音量稳定。 + * @param enable 是否打开 AAGC 功能:
+ * - true: 打开 AAGC 功能。 + * - false: 关闭 AAGC 功能。 + * @return + * - 0: 调用成功。 + * - -1: 调用失败。 + * @note + * 该方法在进房前后均可调用。如果你需要在进房前使用 AAGC 功能,请联系技术支持获得私有参数,传入对应 RoomProfileType{@link #RoomProfileType} 。
+ * 要想在进房后开启 AAGC 功能,你需要把 RoomProfileType{@link #RoomProfileType} 设置为 `kRoomProfileTypeMeeting` 、`kRoomProfileTypeMeetingRoom` 或 `kRoomProfileTypeClassroom` 。
+ * AAGC 功能生效后,不建议再调用 setAudioCaptureDeviceVolume{@link #IAudioDeviceManager#setAudioCaptureDeviceVolume} 来调节设备麦克风的采集音量。 + * @list 音频管理 + */ + + virtual int enableAGC(bool enable) = 0; + /** + * + * @type api + * @brief 切换音频采集方式 + * @param type 音频数据源,详见 AudioSourceType{@link #AudioSourceType}。
+ * 默认使用内部音频采集。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
+ * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法由内部采集切换至自定义采集,SDK 会自动关闭内部采集。然后,调用 pushExternalAudioFrame{@link #IRTCEngine#pushExternalAudioFrame} 推送自定义采集的音频数据到 RTC SDK 用于传输。 + * - 如果你调用此方法由自定义采集切换至内部采集,你必须再调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 手动开启内部采集。 + * @list 自定义流处理 + */ + + virtual int setAudioSourceType (AudioSourceType type) = 0; + /** + * + * @type api + * @brief 切换音频渲染方式 + * @param type 音频输出类型,详见 AudioRenderType{@link #AudioRenderType}
+ * 默认使用内部音频渲染。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
+ * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法切换至自定义渲染,调用 pullExternalAudioFrame{@link #IRTCEngine#pullExternalAudioFrame} 获取音频数据。 + * @list 自定义流处理 + */ + + virtual int setAudioRenderType (AudioRenderType type) = 0; + /** + * + * @type api + * @brief 推送自定义采集的音频数据到 RTC SDK。 + * @param audio_frame 10 ms 对应的音频数据。详见 IAudioFrame{@link #IAudioFrame}。
+ * - 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
+ * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 推送自定义采集的音频数据前,必须先调用 setAudioSourceType{@link #IRTCEngine#setAudioSourceType} 开启自定义采集。 + * - 你必须每 10 ms 推送一次数据。 + * @list 自定义流处理 + */ + + virtual int pushExternalAudioFrame(IAudioFrame* audio_frame) = 0; + /** + * + * @region 自定义音频采集渲染 + * @brief 拉取下行音频数据用于自定义音频渲染。
+ * 调用该方法后,SDK 会主动拉取待播放的音频数据,包括远端已解码和混音后的音频数据,用于外部播放。 + * @param audio_frame 获取的 10 ms 内的音频数据。详见 IAudioFrame{@link #IAudioFrame}。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 获取音频数据用于自定义渲染前,必须先调用 setAudioRenderType{@link #IRTCEngine#setAudioRenderType} 开启自定义渲染。 + * - 由于 RTC SDK 的帧长为 10 毫秒,你应当每隔 10 毫秒拉取一次音频数据。确保音频采样点数(sample)x 拉取频率等于 audio_frame 的采样率 (sampleRate)。如设置采样率为 48000 时,每 10 毫秒调用本接口拉取数据,每次应拉取 480 个采样点。 + * - 该函数运行在用户调用线程内,是一个同步函数。 + * @list 自定义流处理 + * @order 9 + */ + + virtual int pullExternalAudioFrame(IAudioFrame* audio_frame) = 0; + /** + * + * @hidden(Linux) + * @type api + * @region 自定义音频回声消除参考信号 + * @brief 向 SDK 发送由自定义处理后的 PCM 音频数据,作为回声消除的参考信号 + * @param audio_frame 10 ms 对应的音频数据。详见 IAudioFrame{@link #IAudioFrame}。 + * @return 方法调用结果
+ * + 0:方法调用成功
+ * + <-1:方法调用失败
+ * + <-302:警告,配置下发了无效的aec场景
+ * + <-303:警告,配置下发了错误的aec类型
+ * @note 你必须每 10 ms 推送一次数据。 + * @list 自定义流处理 + */ + + virtual int pushReferenceAudioPCMData(IAudioFrame* audio_frame) = 0; + /** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 推送opus编码音频数据到 RTC SDK,RTC SDK纯转发。 + * @param audio_stream 对应的opus音频数据。详见 EncodedAudioFrameData{@link #EncodedAudioFrameData}。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 推送音频数据前,必须先调用 enableAudioEncoding{@link #IRTCEngine#enableAudioEncoding} 关闭音频编码。 + * @list 自定义流处理 + */ + + virtual int pushExternalEncodedAudioFrame(const EncodedAudioFrameData& audio_stream) = 0; + /** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频编码功能。 + * @param enable 是否使用sdk音频编码功能。 + * true: 打开音频编码(默认) + * false: 关闭音频编码直接转推。 + * @note + * - 在pushExternalEncodedAudioFrame{@link #IRTCEngine#pushExternalEncodedAudioFrame}之前调用。 + * @list 自定义流处理 + */ + + virtual void enableAudioEncoding(bool enable) = 0; + /** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频解码功能。 + * @param enable 是否使用sdk音频解码功能。 + * true: 打开音频解码功能(默认) + * false: 关闭音频解码功能直接转推。 + * @note + * - 在registerRemoteEncodedAudioFrameObserver 之前调用。 + * @list 自定义流处理 + */ + + virtual void enableAudioDecoding(bool enable) = 0; + /** + * + * @type api + * @hidden for internal use only + * @brief 注册远端音频帧监测器。
+ * 调用该方法后,SDK 每监测到一帧远端音频帧时,都会将音频帧信息通过 OnRemoteEncodedAudioFrame{@link #IRemoteEncodedAudioFrameObserver#OnRemoteEncodedAudioFrame} 回调给用户 + * @param observer 远端音频帧监测器,参看 IRemoteEncodedAudioFrameObserver{@link #IRemoteEncodedAudioFrameObserver} + * @note + * - 该方法建议在进房前调用。 + * - 将参数设置为 nullptr 则取消注册。 + * - 调用前,必须先调用 enableAudioDecoding{@link #IRTCEngine#enableAudioDecoding} 关闭音频解码功能。 + * @list 自定义流处理 + */ + + virtual void registerRemoteEncodedAudioFrameObserver(IRemoteEncodedAudioFrameObserver* observer) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即开启内部视频采集。默认为关闭状态。
+ * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
+ * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
+ * 本地用户在非隐身状态下调用该方法后,房间中的其他用户会收到 onUserStartVideoCapture{@link #IRTCEngineEventHandler#onUserStartVideoCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 stopVideoCapture{@link #IRTCEngine#stopVideoCapture} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。 + * - 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。 + * - 如果需要从自定义视频采集切换为内部视频采集,你必须先关闭自定义采集,再调用此方法手动开启内部采集。 + * @list 视频管理 + */ + + virtual int startVideoCapture() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即关闭内部视频采集。默认为关闭状态。
+ * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
+ * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
+ * 非隐身用户进房后调用该方法,房间中的其他用户会收到 onUserStopVideoCapture{@link #IRTCEngineEventHandler#onUserStopVideoCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 可以开启内部视频采集。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + * @list 视频管理 + */ + + virtual int stopVideoCapture() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
+ * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数,包括模式、分辨率、帧率。 + * @param video_capture_config 视频采集参数。参看: VideoCaptureConfig{@link #VideoCaptureConfig}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 前调用本接口。 + * - 建议同一设备上的不同引擎使用相同的视频采集参数。 + * - 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + * @list 视频管理 + */ + + virtual int setVideoCaptureConfig(const VideoCaptureConfig& video_capture_config) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本端采集的视频帧的旋转角度。
+ * 当摄像头倒置或者倾斜安装时,可调用本接口进行调整。 + * @param rotation 相机朝向角度,默认为 `VIDEO_ROTATION_0(0)`,无旋转角度。详见 VideoRotation{@link #VideoRotation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口也将对自定义采集视频画面生效,在原有的旋转角度基础上叠加本次设置。 + * - 对于 Windows SDK,视频贴纸特效或通过 enableVirtualBackground{@link #IVideoEffect#enableVirtualBackground} 增加的虚拟背景,也会跟随本接口的设置进行旋转。 + * @list 视频处理 + */ + + virtual int setVideoCaptureRotation(VideoRotation rotation) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端设置期望发布的最大分辨率视频流参数,包括分辨率、帧率、码率、网络不佳时的回退策略等(包含摄像头和屏幕的编码配置)。 + * @param encoder_config 期望发布的最大分辨率视频流参数。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。 + * @return 方法调用结果: + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 本接口仅设置一路视频流参数。默认状态下只有单流,如需开启多路小流请使用:setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode}。 + * - 调用该方法前,SDK 默认仅发布一路视频流,分辨率为 640px × 360px @15fps,编码偏好为帧率优先。 + * - 使用自定义采集时,必须调用该方法设置编码参数,以保证远端收到画面的完整性。 + * @list 视频管理 + */ + + virtual int setVideoEncoderConfig(const VideoEncoderConfig& encoder_config) = 0; + + /** + * + * @valid since 3.60. + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端进行大小流(simulcast)设置。 + * @param mode 详见 VideoSimulcastMode{@link #VideoSimulcastMode}。默认为只发送单流。你应在进房前调用修改本参数。 + * @param stream_config 小流参数。分辨率按照从小到大顺序,且每路流参数分辨率需小于大流 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 设置参数。否则可能会设置失败。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @param num 自定义小流路数。与 stream_config 指向的数组长度一致。最大值为 3。 + * @return 方法调用结果:
+ * - 0:成功 + * - !0:失败 + * @note + * - 调用本方法前,SDK 默认仅发布一条分辨率为 640px × 360px @15fps 的视频流。 + * - 本方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + + virtual int setLocalSimulcastMode(VideoSimulcastMode mode, const VideoEncoderConfig* stream_config, int num) = 0; + + /** + * + * @valid since 3.60. + * @type api + * @brief 发布端开启大小流(simulcast)功能。 + * @param mode 详见 VideoSimulcastMode{@link #VideoSimulcastMode}。默认为只发送单流。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @return 方法调用结果:
+ * - 0:成功 + * - !0:失败 + * @note + * - 你应在进房前调用本接口。 + * - 调用该方法前,SDK 默认仅发布一条分辨率为 640px × 360px,帧率为 15fps 的视频流。 + * - 如需自定义小流参数请查看它的重载方法 setLocalSimulcastMode(VideoSimulcastMode mode, const VideoEncoderConfig* stream_config, int num)。 + * - 该方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + + virtual int setLocalSimulcastMode(VideoSimulcastMode mode) = 0; + + /** + * + * @hidden for internal use only on Windows and Android + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端设置全景视频,包括分辨率、高清视野和低清背景分辨率、Tile 大小,以及其他常规编码参数。 + * @param encoder_config 期望发布的最大分辨率视频流参数。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。
+ * 支持 8K 和 4K 两种分辨率的全景视频。 + * @param parameters 全景视频的编码参数,JSON 字符串格式
+ * - 8K: HD: 7680x3840, LD: 2560x1280, Tile: 640x640 + * - 4K: HD: 3840x1920, LD: 1280x640, Tile: 320x320 + * {
+ * ```rtc.fov_config":{ + * "mode":0, + * "hd_width":3840, + * "hd_height":1920, + * "ld_width":1280, + * "ld_height":640, + * "tile_width":320, + * "tile_height":320, + * "framerate":30, + * "max_kbps":40000} + * }``` + * @return 方法调用结果:
+ * - 0:成功 + * - !0:失败 + * @note + * - 发布全景视频前,绑定自定义采集器,必须调用该方法设置编码参数。支持的视频格式包括 YUV 或者 Texture 纹理。 + * - 通过 onFrame{@link #IVideoSink#onFrame} ,接收端获取到视频帧和解码需要的信息,传给自定义渲染器进行渲染。 + * @list 视频管理 + */ + + virtual int setVideoEncoderConfig(const VideoEncoderConfig& encoder_config, const char* parameters) = 0; + /** + * + * @hidden(Linux, macOS) + * @valid since 3.58 + * @type api + * @hiddensdk(audiosdk) + * @brief 开启自定义采集视频帧的 Alpha 通道编码功能。
+ * 适用于需要分离推流端视频主体与背景,且在拉流端可自定义渲染背景的场景。 + + * @param alpha_layout 分离后的 Alpha 通道相对于 RGB 通道信息的排列位置。当前仅支持 `AlphaLayout.kAlphaLayoutTop`,即置于 RGB 通道信息上方。 + * @return 方法调用结果:
+ * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该接口仅作用于自定义采集的、并且使用 RGBA 色彩模型的视频帧,包括: + * - Windows:VideoPixelFormat.kVideoPixelFormatRGBA; + * - Android:VideoPixelFormat.TEXTURE_2D、VideoPixelFormat.TEXTURE_OES、VideoPixelFormat.RGBA; + * - iOS:ByteRTCVideoPixelFormat.ByteRTCVideoPixelFormatCVPixelBuffer。 + * - 该接口须在发布视频流之前调用。 + * - 调用本接口开启 Alpha 通道编码后,你需调用 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 把自定义采集的视频帧推送至 RTC SDK。若推送了不支持的视频帧格式,则调用 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 时会返回错误码 ReturnStatus.kReturnStatusParameterErr。 + * @list 视频管理 + */ + + virtual int enableAlphaChannelVideoEncode(AlphaLayout alpha_layout) = 0; + /** + * + * @valid since 3.58 + * @hidden(Linux, macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭外部采集视频帧的 Alpha 通道编码功能。 + + * @return 方法调用结果:
+ * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 该接口须在停止发布视频流之后调用。 + * @list 视频管理 + */ + + virtual int disableAlphaChannelVideoEncode() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地视频渲染时使用的视图,并设置渲染模式。 + + * @param canvas 视图信息和渲染模式,参看:VideoCanvas{@link #VideoCanvas} + * @return + * - 0:成功。 + * - -2: 参数错误。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 你应在加入房间前,绑定本地视图。退出房间后,此设置仍然有效。 + * - 如果需要解除绑定,你可以调用本方法传入空视图。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 视频管理 + */ + + virtual int setLocalVideoCanvas(const VideoCanvas& canvas) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 修改本地视频渲染模式和背景色。 + + * @param render_mode 渲染模式,参看 RenderMode{@link #RenderMode} + * @param background_color 背景颜色,参看 VideoCanvas{@link #VideoCanvas}.background_color + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 你可以在本地视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + + virtual int updateLocalVideoCanvas(const enum RenderMode render_mode, const uint32_t background_color) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置渲染指定视频流 `stream_key` 时,使用的视图和渲染模式。
+ * 如果需要解除某个用户的绑定视图,你可以把 `canvas` 设置为空。 + * @param stream_id 流标识 + * @param canvas 视图信息和渲染模式,参看:VideoCanvas{@link #VideoCanvas} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本地用户离开房间时,会解除调用此 API 建立的绑定关系;远端用户离开房间则不会影响。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 视频管理 + */ + + virtual int setRemoteVideoCanvas(const char* stream_id, const VideoCanvas& canvas) = 0; + /** + * + * @deprecated since 3.56, and will be deleted in 3.62. + * @type api + * @hiddensdk(audiosdk) + * @brief 修改远端视频帧的渲染设置,包括渲染模式和背景颜色。 + * @param stream_id 流标识 + * @param render_mode 渲染模式,参看 RenderMode{@link #RenderMode}。 + * @param background_color 背景颜色,参看 VideoCanvas{@link #VideoCanvas}.background_color + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 你可以在远端视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + + virtual int updateRemoteStreamVideoCanvas(const char* stream_id, const enum RenderMode render_mode, const uint32_t background_color) = 0; + /** + * + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用 SDK 内部渲染时,修改远端视频帧的渲染设置,包括渲染模式、背景颜色和旋转角度。 + * @param stream_id 流标识 + * @param remote_video_render_config 视频帧渲染设置。具体参看 RemoteVideoRenderConfig{@link #RemoteVideoRenderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 setRemoteVideoCanvas{@link #IRTCEngine#setRemoteVideoCanvas} 设置了远端视频渲染模式后,你可以调用此接口更新渲染模式、背景颜色、旋转角度的设置。 + * - 该接口可以在远端视频渲染过程中调用,调用结果会实时生效。 + * @list 视频管理 + */ + + virtual int updateRemoteStreamVideoCanvas(const char* stream_id, const RemoteVideoRenderConfig& remote_video_render_config) = 0; + /** + * + * @deprecated since 3.60, use setLocalVideoSink(IVideoSink* video_sink, LocalVideoSinkConfig& config) instead. + * @type api + * @hiddensdk(audiosdk) + * @brief 将本地视频流与自定义渲染器绑定。 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param required_format video_sink 适用的视频帧编码格式,参看 PixelFormat{@link #PixelFormat} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 如果需要解除绑定,必须将 video_sink 设置为 null。退房时将清除绑定状态。 + * - 一般在收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * - 本方法获取的是前处理后的视频帧。 + * @list 自定义流处理 + */ + + BYTERTC_DEPRECATED virtual int setLocalVideoSink(IVideoSink* video_sink, IVideoSink::PixelFormat required_format) = 0; + + /** + * + * @valid since 3.60. + * @type api + * @hiddensdk(audiosdk) + * @brief 将本地视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param config 本地视频帧回调配置,参看 LocalVideoSinkConfig{@link #LocalVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 video_sink 设置为 null。 + * - 一般在收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * @list 自定义流处理 + */ + + virtual int setLocalVideoSink(IVideoSink* video_sink, LocalVideoSinkConfig& config) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @deprecated since 3.57, use setRemoteVideoSink{@link #IRTCEngine#setRemoteVideoSink} instead. + * @region 自定义视频采集渲染 + * @brief 将远端视频流与自定义渲染器绑定。 + * @param stream_id 流标识 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param required_format video_sink 适用的视频帧编码格式,参看 PixelFormat{@link #PixelFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调获取到远端流信息之后,再调用该方法。 + * - 如果需要解除绑定,必须将 video_sink 设置为 null。退房时将清除绑定状态。 + * - 本方法获取的是后处理后的视频帧。 + * @list 自定义流处理 + */ + + BYTERTC_DEPRECATED virtual int setRemoteVideoSink(const char* stream_id, IVideoSink* video_sink, IVideoSink::PixelFormat required_format) = 0; + + /** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @region 自定义视频帧回调 + * @brief 将远端视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param stream_id 流标识 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param config 远端视频帧回调配置,参看 RemoteVideoSinkConfig{@link #RemoteVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调获取到远端流信息之后,再调用该方法。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 video_sink 设置为 null。 + * @list 自定义流处理 + * @order 3 + */ + + + virtual int setRemoteVideoSink(const char* stream_id, IVideoSink* video_sink, RemoteVideoSinkConfig& config) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 切换视频内部采集时使用的前置/后置摄像头
+ * 调用此接口后,在本地会触发 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 回调。 + * @param camera_id 参看 CameraID {@link #CameraID}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 默认使用前置摄像头。 + * - 如果你正在使用相机进行视频采集,切换操作当即生效;如果相机未启动,后续开启内部采集时,会打开设定的摄像头。 + * - 如果本地有多个摄像头且想选择特定工作摄像头可通过 IVideoDeviceManager{@link #IVideoDeviceManager} 来控制。 + * @list 视频管理 + */ + + virtual int switchCamera(CameraID camera_id) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,更新采集区域。仅用于采集源为显示器屏幕时。 + * @param region_rect 采集区域。参见 Rectangle{@link #Rectangle}
+ * 此参数描述了调用此接口后的采集区域,和 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 中 `source_info` 设定区域的相对关系。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 5 + */ + + virtual int updateScreenCaptureRegion(const Rectangle& region_rect) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 采集屏幕视频流,用于共享。屏幕视频流包括:应用窗口中显示的内容,或虚拟屏幕中显示的内容。
+ * 其中,虚拟屏幕中显示的内容仅在 Windows 平台上支持。 + * @param source_info 待共享的屏幕源,参看 ScreenCaptureSourceInfo{@link #ScreenCaptureSourceInfo}。
+ * 你可以调用 getScreenCaptureSourceList{@link #IRTCEngine#getScreenCaptureSourceList} 获得所有可以共享的屏幕源。 + * @param capture_params 共享参数。参看 ScreenCaptureParameters{@link #ScreenCaptureParameters}。 + * @return + * - 0: 成功 + * - -1: 失败 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 onVideoDeviceWarning{@link #IRTCEngineEventHandler#onVideoDeviceWarning} 回调。 + * - 调用此方法仅开启屏幕流视频采集,不会发布采集到的视频。发布屏幕流视频需要调用 publishStreamVideo{@link #IRTCRoom#publishStreamVideo}。 + * - 调用 stopScreenVideoCapture{@link #IRTCEngine#stopScreenVideoCapture} 关闭屏幕视频源采集。 + * - 本地用户通过 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调获取屏幕采集状态,包括开始、暂停、恢复、错误等。 + * - 调用成功后,本端会收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调。 + * - 调用此接口前,你可以调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 设置屏幕视频流的采集帧率和编码分辨率。 + * - 在收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调后通过调用 setLocalVideoCanvas{@link #IRTCEngine#setLocalVideoCanvas} 或 setLocalVideoSink{@link #IRTCEngine#setLocalVideoSink} 函数设置本地屏幕共享视图。 + * - 可以调用 setLocalVideoSink{@link #IRTCEngine#setLocalVideoSink} 将本地视频流与自定义渲染器绑定,通过回调 onFrame{@link #IVideoSink#onFrame} 获取采集成功的本地视频帧。 + * - 对于 Windows SDK,再开启采集屏幕视频流后,你可以调用 updateScreenCaptureHighlightConfig{@link #IRTCEngine#updateScreenCaptureHighlightConfig} 更新边框高亮设置,调用 updateScreenCaptureMouseCursor{@link #IRTCEngine#updateScreenCaptureMouseCursor} 更新对鼠标的处理设置,调用 updateScreenCaptureFilterConfig{@link #IRTCEngine#updateScreenCaptureFilterConfig} 设置需要过滤的窗口。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 1 + */ + + virtual int startScreenVideoCapture(const ScreenCaptureSourceInfo& source_info, const ScreenCaptureParameters& capture_params) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 停止屏幕视频流采集。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 onVideoDeviceWarning{@link #IRTCEngineEventHandler#onVideoDeviceWarning} 回调。 + * - 要开启屏幕视频流采集,调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture}。 + * - 调用后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。 + * - 调用此接口不影响屏幕视频流发布。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 6 + */ + + virtual int stopScreenVideoCapture() = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,更新边框高亮设置。默认展示边框。 + * @param highlight_config 边框高亮设置。参见 HighlightConfig{@link #HighlightConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 2 + */ + + virtual int updateScreenCaptureHighlightConfig(const HighlightConfig& highlight_config) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,更新对鼠标的处理设置。默认采集鼠标。 + * @param capture_mouse_cursor 参看 MouseCursorCaptureState{@link #MouseCursorCaptureState} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 3 + */ + + virtual int updateScreenCaptureMouseCursor(MouseCursorCaptureState capture_mouse_cursor) = 0; + /** + * + * @hidden(Linux,iOS,Android) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,设置需要过滤的窗口。 + * @param filter_config 窗口过滤设置,参看 ScreenFilterConfig{@link #ScreenFilterConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 本函数在屏幕源类别是屏幕而非应用窗体时才起作用。详见:ScreenCaptureSourceType{@link #ScreenCaptureSourceType}。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 4 + */ + + virtual int updateScreenCaptureFilterConfig(const ScreenFilterConfig& filter_config) = 0; + + /** + * + * @hidden(Android,iOS) + * @brief 获取共享对象列表。 + * @return 共享对象列表,包括应用窗口和屏幕。详见 IScreenCaptureSourceList{@link #IScreenCaptureSourceList}。用户选择后,可调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 进行共享。 + * @note + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。采用 Wayland 协议,调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 时,系统会通过弹窗供用户选择共享对象。 + * - 使用完之后需要调用 release{@link #IScreenCaptureSourceList#release} 接口释放。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 0 + */ + + virtual IScreenCaptureSourceList* getScreenCaptureSourceList() = 0; + + /** + * + * @hidden(Android,iOS) + * @brief 获取共享对象缩略图 + * @region 屏幕共享 + * @param type 屏幕采集对象的类型。详见 ScreenCaptureSourceType{@link #ScreenCaptureSourceType}。 + * @param source_id 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList{@link #IRTCEngine#getScreenCaptureSourceList} 枚举共享对象列表中获取。详见 view_t{@link #view_t}。 + * @param max_width 最大宽度。保持采集对象本身的宽高比不变,将缩略图缩放到指定范围内的最大宽高。如果给出的尺寸与共享对象比例不同,得到的缩略图会有黑边。 + * @param max_height 最大高度。参见 max_width 的说明。 + * @return 共享对象缩略图,详见 IVideoFrame{@link #IVideoFrame}。 + * @note + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 9 + */ + + virtual IVideoFrame* getThumbnail( + ScreenCaptureSourceType type, view_t source_id, int max_width, int max_height) = 0; + /** + * + * @hidden(Android,iOS) + * @region 屏幕共享 + * @brief 获取应用窗体所属应用的图标。 + * @param source_id 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList{@link #IRTCEngine#getScreenCaptureSourceList} 枚举共享对象列表中获取。 + * @param max_width 最大宽度。返回的图标将是宽高相等的,输入宽高不等时,取二者较小值。宽高范围为 [32,256],超出该范围将返回 nullptr,默认输出 100 x 100 的图像。 + * @param max_height 最大高度。参见 max_width 的说明。 + * @return 详见 IVideoFrame{@link #IVideoFrame}。当屏幕共享对象为应用窗体,且有图标时有效,否则返回 nullptr。 + * @note + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 10 + */ + + virtual IVideoFrame* getWindowAppIcon(view_t source_id, int max_width = 100, int max_height = 100) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置向 SDK 输入的视频源,包括屏幕流
+ * 默认使用内部采集。内部采集指:使用 RTC SDK 内置的视频采集机制进行视频采集。 + + * @param type 视频输入源类型,参看 VideoSourceType{@link #VideoSourceType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法进房前后均可调用。 + * - 当你已调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部采集后,再调用此方法切换至自定义采集时,SDK 会自动关闭内部采集。 + * - 当你调用此方法开启自定义采集后,想要切换至内部采集,你必须先调用此方法关闭自定义采集,然后调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 手动开启内部采集。 + * - 当你需要向 SDK 推送自定义编码后的视频帧,你需调用该方法将视频源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + + virtual int setVideoSourceType(VideoSourceType type) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送外部视频帧。 + * @param frame 设置视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 支持格式:I420, NV12, RGBA, BGRA, ARGB。不支持 RGB24。 + * - 该函数运行在用户调用线程内。 + * - 推送外部视频帧前,必须调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 开启外部视频源采集。 + * @list 自定义流处理 + */ + + virtual int pushExternalVideoFrame(const VideoFrameData& frame) = 0; + + /** + * + * @hidden(Windows,Linux,macOS) + * @type api + * @brief 设置音频播放设备。默认使用通过 setDefaultAudioRoute{@link #IRTCEngine#setDefaultAudioRoute} 设置的默认音频路由。
+ * 音频播放设备发生变化时,会收到 onAudioRouteChanged{@link #IRTCEngineEventHandler#onAudioRouteChanged} 回调。 + * @param device 音频播放设备。参看 AudioRoute{@link #AudioRoute}。仅支持听筒或者扬声器。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 对于绝大多数音频场景,推荐使用 setDefaultAudioRoute{@link #IRTCEngine#setDefaultAudioRoute} 设置默认音频路由,并借助 RTC SDK 的音频路由自动切换逻辑即可完成。切换逻辑参见[移动端设置音频路由](https: + * - 本接口在 Android 端仅支持在通话模式下使用;在 iOS 端支持在通话模式和媒体模式下使用,但切换的目标路由仅支持内置扬声器。 + * @list 音频管理 + */ + + virtual int setAudioRoute(AudioRoute route) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @brief 将默认的音频播放设备设置为听筒或扬声器。 + * @param route 音频播放设备。参看 AudioRoute{@link #AudioRoute} + * @return 方法调用结果
+ * - 0: 方法调用成功。立即生效。当所有音频外设移除后,音频路由将被切换到默认设备。 + * - < 0: 方法调用失败。指定除扬声器和听筒以外的设备将会失败。 + * @note 对于音频路由切换逻辑,参见[移动端设置音频路由](https: + * @list 音频管理 + */ + + virtual int setDefaultAudioRoute(AudioRoute route) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @brief 获取当前音频播放设备
+ * 音频播放设备发生变化时,会收到 onAudioRouteChanged{@link #IRTCEngineEventHandler#onAudioRouteChanged} 回调。 + * @return device 当前音频播放设备。参看 AudioRoute{@link #AudioRoute} + * @note + * - 1. 该接口仅适用于移动设备。 + * - 2. 通话前和通话中都可以调用该方法。 + * @list 音频管理 + */ + + virtual AudioRoute getAudioRoute() = 0; + /** + * + * @type api + * @brief 创建 RTC 房间实例。
+ * 调用此方法仅返回一个 RTC 房间实例,你仍需调用 joinRoom{@link #IRTCRoom#joinRoom} 才能真正地创建/加入房间。
+ * 多次调用此方法以创建多个 IRTCRoom{@link #IRTCRoom} 实例。分别调用各 IRTCRoom 实例中的 joinRoom{@link #IRTCRoom#joinRoom} 方法,同时加入多个房间。
+ * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTCRoom{@link #IRTCRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 room_id 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 IRTCRoom 实例,再调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。 + * - 请勿使用同样的 room_id 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * - 如果你需要在多个房间发布音视频流,无须创建多房间,直接调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 开始跨房间转发媒体流。 + * @list 房间管理 + */ + + virtual IRTCRoom* createRTCRoom(const char* room_id) = 0; + + /** + * + * @type api + * @brief 创建游戏语音房间实例。
+ * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom{@link #IGameRoom#joinRoom} 才能真正地创建/加入游戏房间。
+ * 多次调用此方法以创建多个 IGameRoom{@link #IGameRoom} 实例。分别调用各 IGameRoom 实例中的 joinRoom{@link #IGameRoom#joinRoom} 方法,同时加入多个房间。
+ * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @param room_config 游戏语音房间配置。参看 GameRoomConfig{@link #GameRoomConfig}。 + * @return 创建的 IGameRoom{@link #IGameRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 room_id 格式错误或当前场景是否是游戏场景。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 IGameRoom 实例,再调用 joinRoom{@link #IGameRoom#joinRoom} 加入房间。 + * - 请勿使用同样的 room_id 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + + virtual IGameRoom* createGameRoom(const char* room_id, const GameRoomConfig& room_config) = 0; + /** + * + * @type api + * @brief 创建 RTS 房间实例。
+ * 调用此方法仅返回一个 RTS 房间实例,你仍需调用 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 才能真正地创建/加入房间。
+ * 多次调用此方法以创建多个 IRTSRoom{@link #IRTSRoom} 实例。分别调用各 IRTSRoom 实例中的 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 方法,同时加入多个房间。
+ * 多房间模式下,用户可以同时收发各房间的消息。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTSRoom{@link #IRTSRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 room_id 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 IRTSRoom 实例,再调用 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。 + * - 请勿使用同样的 room_id 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + + virtual IRTSRoom* createRTSRoom(const char* room_id) = 0; + /** + * + * @type api + * @brief 设置发布的音视频流的回退选项。
+ * 你可以调用该接口设置网络不佳或设备性能不足时从大流起进行降级处理,以保证通话质量。 + * @param option 本地发布的音视频流回退选项,参看 PublishFallbackOption{@link #PublishFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅在调用 setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode} 开启了发送多路视频流的情况下生效。 + * - 该方法必须在进房前设置,进房后设置或更改设置无效。 + * - 调用该方法后,如因性能或网络不佳产生发布性能回退或恢复,本端会提前收到 onPerformanceAlarms{@link #IRTCEngineEventHandler#onPerformanceAlarms} 回调发出的告警,以便采集设备配合调整。 + * - 设置回退后,本地发布的音视频流发生回退或从回退中恢复后,远端会收到 onSimulcastSubscribeFallback{@link #IRTCEngineEventHandler#onSimulcastSubscribeFallback} 回调,通知该情况。 + * - 你可以调用客户端 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + + virtual int setPublishFallbackOption(PublishFallbackOption option) = 0; + /** + * + * @type api + * @brief 设置订阅的音视频流的回退选项。
+ * 你可调用该接口设置网络不佳或设备性能不足时允许订阅流进行降级或只订阅音频流,以保证通话流畅。 + * @param option 订阅的音视频流回退选项,参看 SubscribeFallbackOption{@link #SubscribeFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 你必须在进房前设置,进房后设置或更改设置无效。 + * - 设置回退选项后,订阅的音视频流发生回退或从回退中恢复时,会收到 onSimulcastSubscribeFallback{@link #IRTCEngineEventHandler#onSimulcastSubscribeFallback} 和 onRemoteVideoSizeChanged{@link #IRTCEngineEventHandler#onRemoteVideoSizeChanged} 回调通知。 + * - 你可以调用 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + + virtual int setSubscribeFallbackOption(SubscribeFallbackOption option) = 0; + /** + * + * @type api + * @brief 设置用户优先级。 + * @param room_id 房间 ID + * @param user_id 远端用户的 ID + * @param priority 远端用户的需求优先级,详见枚举类型 RemoteUserPriority{@link #RemoteUserPriority} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 1. 该方法与 setSubscribeFallbackOption{@link #IRTCEngine#setSubscribeFallbackOption} 搭配使用。 + * - 2. 如果开启了订阅流回退选项,弱网或性能不足时会优先保证收到的高优先级用户的流的质量。 + * - 3. 该方法在进房前后都可以使用,可以修改远端用户的优先级。 + * @list 网络管理 + */ + + virtual int setRemoteUserPriority(const char* room_id, const char* user_id, RemoteUserPriority priority) = 0; + /** + * + * @type api + * @brief 设置业务标识参数
+ * 可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。 + * @param business_id
+ * 用户设置的自己的 businessId 值
+ * businessId 只是一个标签,颗粒度需要用户自定义。 + * @return + * - 0: 成功。 + * - -2: 输入非法,合法字符包括所有小写字母、大写字母和数字,除此外还包括四个独立字符,分别是:英文句号,短横线,下划线和 @ 。 + * @note + * - 需要在调用 joinRoom{@link #IRTCRoom#joinRoom} 之前调用,joinRoom{@link #IRTCRoom#joinRoom} 之后调用该方法无效。 + * @list 引擎管理 + */ + + virtual int setBusinessId(const char* business_id) = 0; + /** + * + * @hidden(Windows,macOS,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置采集视频的旋转模式。默认以 App 方向为旋转参考系。
+ * 接收端渲染视频时,将按照和发送端相同的方式进行旋转。 + * @param rotation_mode 视频旋转参考系为 App 方向或重力方向,参看 VideoRotationMode{@link #VideoRotationMode} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 旋转仅对内部视频采集生效,不适用于外部视频源和屏幕源。 + * - 调用该接口时已开启视频采集,将立即生效;调用该接口时未开启视频采集,则将在采集开启后生效。 + * - 更多信息请参考[视频采集方向](https: + * @list Engine Management + */ + + virtual int setVideoRotationMode(VideoRotationMode rotation_mode) = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 为采集到的视频流开启镜像 + * @param mirror_type 镜像类型,参看 MirrorType{@link #MirrorType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 切换视频源不影响镜像设置。 + * - 屏幕视频流始终不受镜像设置影响。 + * - 使用外部渲染器时,`mirrorType` 支持设置为 `0`(无镜像)和 `3`(本地预览和编码传输镜像),不支持设置为 `1`(本地预览镜像)。 + * - 该接口调用前,各视频源的初始状态如下: + * + * + * + * + *
前置摄像头后置摄像头自定义采集视频源 桌面端摄像头
移动端本地预览镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 /
桌面端// 本地预览不镜像,编码传输不镜像 本地预览镜像,编码传输不镜像
+ * @list 视频处理 + */ + + virtual int setLocalVideoMirrorType(MirrorType mirror_type) = 0; + /** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用内部渲染时,为远端流开启镜像。 + * @param stream_id 流标识 + * @param mirror_type 远端流的镜像类型,参看 RemoteMirrorType{@link #RemoteMirrorType}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败,参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list 视频处理 + */ + + virtual int setRemoteVideoMirrorType(const char* stream_id, RemoteMirrorType mirror_type) = 0; + /** + * + * @type api + * @brief 获取视频特效接口。 + * @return 视频特效接口,参看 IVideoEffect{@link #IVideoEffect}。 + * @list 视频处理 + */ + + virtual IVideoEffect* getVideoEffectInterface() = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 开启/关闭基础美颜。 + * @param enable 基础美颜开关
+ * - true: 开启基础美颜 + * - false: 关闭基础美颜(默认) + * @return + * - 0: 调用成功。 + * - –1001: RTC SDK 版本不支持此功能。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 本方法不能与高级视频特效接口共用。如已购买高级视频特效,建议参看[集成指南](https: + * - 使用此功能需要集成特效 SDK,建议使用特效 SDK v4.4.2+ 版本。更多信息参看 [Native 端基础美颜](https: + * - 调用 setBeautyIntensity{@link #IRTCEngine#setBeautyIntensity} 设置基础美颜强度。若在调用本方法前没有设置美颜强度,则使用默认强度。各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * - 本方法仅适用于视频源,不适用于屏幕源。 + * @list 视频处理 + */ + + virtual int enableEffectBeauty(bool enable) = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 调整基础美颜强度。 + * @param beauty_mode 基础美颜模式,参看 EffectBeautyMode{@link #EffectBeautyMode}。 + * @param intensity 美颜强度,取值范围为 [0,1]。强度为 0 表示关闭。
+ * 各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * @return + * - 0: 调用成功。 + * - –2: `intensity` 范围超限。 + * - –1001: RTC SDK 版本不支持此功能。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 若在调用 enableEffectBeauty{@link #IRTCEngine#enableEffectBeauty} 前设置美颜强度,则对应美颜功能的强度初始值会根据设置更新。 + * - 销毁引擎后,美颜功能强度恢复默认值。 + * @list 视频处理 + */ + + virtual int setBeautyIntensity(EffectBeautyMode beauty_mode, float intensity) = 0; + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置远端视频超分模式。 + * @param stream_id 流标识 + * @param mode 超分模式,参看 VideoSuperResolutionMode{@link #VideoSuperResolutionMode}。 + * @return + * - 0: kReturnStatusSuccess,SDK 调用成功,并不代表超分模式实际状态,需要根据回调 onRemoteVideoSuperResolutionModeChanged{@link #IRTCEngineEventHandler#onRemoteVideoSuperResolutionModeChanged} 判断实际状态。 + * - -1: kReturnStatusNativeInvalid,native library 未加载。 + * - -2: kReturnStatusParameterErr,参数非法,指针为空或字符串为空。 + * - -9: kReturnStatusScreenNotSupport,不支持对屏幕流开启超分。 + * @note + * - 该方法须进房后调用。 + * - 远端用户视频流的原始分辨率不能超过 640 × 360 px。 + * - 支持对一路远端流开启超分,不支持对多路流开启超分。 + * @list 视频处理 + */ + + virtual int setRemoteVideoSuperResolution(const char* stream_id, VideoSuperResolutionMode mode) = 0; + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置视频降噪模式。 + * @param mode 视频降噪模式,启用后能够增强视频画质,但同时会增加性能负载。参看 VideoDenoiseMode{@link #VideoDenoiseMode}。 + * @return + * - 0: API 调用成功。 用户可以根据回调函数 onVideoDenoiseModeChanged{@link #IRTCEngineEventHandler#onVideoDenoiseModeChanged} 判断视频降噪是否开启。 + * - < 0:API 调用失败。 + * @list 视频处理 + */ + + virtual int setVideoDenoiser(VideoDenoiseMode mode) = 0; + /** + * + * @hidden(Windows, Linux, macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 在自定义视频前处理及编码前,设置 RTC 链路中的视频帧朝向,默认为 Adaptive 模式。
+ * 移动端开启视频特效贴纸,或使用自定义视频前处理时,建议固定视频帧朝向为 Portrait 模式。单流转推场景下,建议根据业务需要固定视频帧朝向为 Portrait 或 Landscape 模式。不同模式的具体显示效果参看[视频帧朝向](https: + * @param orientation 视频帧朝向,参看 VideoOrientation{@link #VideoOrientation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 视频帧朝向设置仅适用于内部采集视频源。对于自定义采集视频源,设置视频帧朝向可能会导致错误,例如宽高对调。屏幕源不支持设置视频帧朝向。 + * - 编码分辨率的更新与视频帧处理是异步操作,进房后切换视频帧朝向可能导致画面出现短暂的裁切异常,因此建议在进房前设置视频帧朝向,且不在进房后进行切换。 + * @list 自定义流处理 + */ + + virtual int setVideoOrientation(VideoOrientation orientation) = 0; + /** + * + * @hidden(macOS, Windows,Linux) + * @type api + * @brief 获取相机控制接口 + * @return 相机控制接口指针,参看 ICameraControl{@link #ICameraControl} + * @list 视频管理 + */ + + virtual ICameraControl* getCameraControl() = 0; + /** + * + * @type api + * @brief 设置传输时使用内置加密的方式。 + * @param encrypt_type 内置加密算法,详见 EncryptType{@link #EncryptType} + * @param key 加密密钥,长度限制为 36 位,超出部分将会被截断 + * @param key_size 参数 key 的长度 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 使用传输时内置加密时,使用此方法;如果需要使用传输时自定义加密,参看 onEncryptData{@link #IEncryptHandler#onEncryptData}。 内置加密和自定义加密互斥,根据最后一个调用的方法确定传输是加密的方案。 + * - 该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。 + * @list 通话加密 + */ + + virtual int setEncryptInfo(EncryptType encrypt_type, const char* key, int key_size) = 0; + /** + * + * @type api + * @brief 设置自定义加密和解密方式。 + * @param handler 自定义加密 handler,需要实现 handler 的加密和解密方法。参看 IEncryptHandler{@link #IEncryptHandler}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法与 setEncryptInfo{@link #IRTCEngine#setEncryptInfo} 为互斥关系,只能选择自定义加密方式或者默认加密方式。最终生效的加密方式取决于最后一个调用的方法。 + * - 该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。 + * - 无论加密或者解密,其对原始数据的长度修改,需要控制在 180% 之间,即如果输入数据为 100 字节,则处理完成后的数据必须不超过 180 字节,如果加密或解密结果超出该长度限制,则该音视频帧可能会被丢弃。 + * - 数据加密/解密为串行执行,因而视实现方式不同,可能会影响到最终渲染效率。是否使用该方法,需要由使用方谨慎评估。 + * @list 通话加密 + */ + + virtual int setCustomizeEncryptHandler(IEncryptHandler* handler) = 0; + /** + * + * @type api + * @brief 设置并开启指定的音频数据帧回调 + * @param method 音频回调方法,参看 AudioFrameCallbackMethod{@link #AudioFrameCallbackMethod}。
+ * 当音频回调方法设置为 `kRecord`、`kPlayback`、`kMixed`、`kRecordScreen`、`kCaptureMixed`时,你需要在参数 `format` 中指定准确的采样率和声道,暂不支持设置为自动。
+ * 当音频回调方法设置为 `kRemoteUser`时,将 `format` 中的各个字段设置为默认值。 + * @param format 音频参数格式,参看 AudioFormat{@link #AudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 开启音频回调并调用 registerAudioFrameObserver{@link #IRTCEngine#registerAudioFrameObserver} 后,IAudioFrameObserver{@link #IAudioFrameObserver} 会收到对应的音频回调。两者调用顺序没有限制且相互独立。 + * @list 自定义流处理 + */ + + virtual int enableAudioFrameCallback(AudioFrameCallbackMethod method, AudioFormat format) = 0; + /** + * + * @type api + * @brief 关闭音频回调 + * @param method 音频回调方法,参看 AudioFrameCallbackMethod{@link #AudioFrameCallbackMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该方法需要在调用 enableAudioFrameCallback{@link #IRTCEngine#enableAudioFrameCallback} 之后调用。 + * @list 自定义流处理 + */ + + virtual int disableAudioFrameCallback(AudioFrameCallbackMethod method) = 0; + /** + * + * @type api + * @brief 注册音频数据回调观察者。 + * @param observer 音频数据观察者,参看 IAudioFrameObserver{@link #IAudioFrameObserver}。如果传入 null,则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 注册音频数据回调观察者并调用 enableAudioFrameCallback{@link #IRTCEngine#enableAudioFrameCallback} 后,IAudioFrameObserver{@link #IAudioFrameObserver} 会收到对应的音频回调。对回调中收到的音频数据进行处理,不会影响 RTC 的编码发送或渲染。 + * @list 自定义流处理 + */ + + virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0; + /** + * + * @type api + * @brief 注册自定义音频处理器。
+ * 注册完成后,你可以调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},对本地采集到的音频进行处理,RTC SDK 将对处理后的音频进行编码和发送。也可以对接收到的远端音频进行自定义处理,RTC SDK 将对处理后的音频进行渲染。 + * @param processor 自定义音频处理器,详见 IAudioFrameProcessor{@link #IAudioFrameProcessor}。
+ * SDK 只持有 processor 的弱引用,你应保证其生命周期。需要取消注册时,设置此参数为 nullptr。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 重复调用此接口时,仅最后一次调用生效。 + * - 更多相关信息,详见[音频自定义处理](https: + * @list 自定义流处理 + */ + + virtual int registerAudioProcessor(IAudioFrameProcessor* processor) = 0; + /** + * + * @type api + * @brief 设置并开启指定的音频帧回调,进行自定义处理。 + * @param method 音频帧类型,参看 AudioProcessorMethod{@link #AudioProcessorMethod}。可多次调用此接口,处理不同类型的音频帧。
+ * 选择不同类型的音频帧将收到对应的回调:
+ * - 选择本地采集的音频时,会收到 onProcessRecordAudioFrame{@link #IAudioFrameProcessor#onProcessRecordAudioFrame}。 + * - 选择远端音频流的混音音频时,会收到 onProcessPlayBackAudioFrame{@link #IAudioFrameProcessor#onProcessPlayBackAudioFrame}。 + * - 选择远端音频流时,会收到 onProcessRemoteUserAudioFrame{@link #IAudioFrameProcessor#onProcessRemoteUserAudioFrame}。 + * - 选择屏幕共享音频流时,会收到 onProcessScreenAudioFrame{@link #IAudioFrameProcessor#onProcessScreenAudioFrame}。(Linux 不适用) + * @param format 设定自定义处理时获取的音频帧格式,参看 AudioFormat{@link #AudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 在调用此接口前,你需要调用 registerAudioProcessor{@link #IRTCEngine#registerAudioProcessor} 注册自定义音频处理器。 + * - 要关闭音频自定义处理,调用 disableAudioProcessor{@link #IRTCEngine#disableAudioProcessor}。 + * @list 自定义流处理 + */ + + virtual int enableAudioProcessor(AudioProcessorMethod method, AudioFormat format) = 0; + /** + * + * @type api + * @brief 关闭自定义音频处理。 + * @param method 音频帧类型,参看 AudioProcessorMethod{@link #AudioProcessorMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 自定义流处理 + */ + + virtual int disableAudioProcessor(AudioProcessorMethod method) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置自定义视频前处理器。
+ * 使用这个视频前处理器,你可以调用 processVideoFrame{@link #IVideoProcessor#processVideoFrame} 对 RTC SDK 采集得到的视频帧进行前处理,并将处理后的视频帧用于 RTC 音视频通信。 + * @param processor 自定义视频处理器,详见 IVideoProcessor{@link #IVideoProcessor}。如果传入 null,则不对 RTC SDK 采集得到的视频帧进行前处理。
+ * SDK 只持有 processor 的弱引用,你应保证其生命周期。 + * @param config 自定义视频前处理器适用的设置,详见 VideoPreprocessorConfig{@link #VideoPreprocessorConfig}。
+ * 当前,`config` 中的 `required_pixel_format` 仅支持:`kVideoPixelFormatI420` 和 `kVideoPixelFormatUnknown`:
+ * - 设置为 `kVideoPixelFormatUnknown` 时,RTC SDK 给出供 processor 处理的视频帧格式即采集的格式。 + * 你可以通过 VideoBufferType{@link #VideoBufferType} 和 VideoPixelFormat{@link #VideoPixelFormat} 获取实际采集的视频帧格式和像素类型。
+ * - 设置为 `kVideoPixelFormatI420` 时,RTC SDK 会将采集得到的视频帧转变为对应的格式,供前处理使用。 + * - 设置为其他值时,此方法调用失败。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 对于 Windows 平台,经前处理返回的视频帧格式仅支持 `kVideoPixelFormatI420` + * - 对于 Windows 平台,将 `config` 中的 required_pixel_format 设置为 `kVideoPixelFormatI420`,可以通过避免格式转换带来一些性能优化。 + * - 重复调用此接口时,仅最后一次调用生效。效果不会叠加。 + * @list 自定义流处理 + */ + + virtual int registerLocalVideoProcessor(IVideoProcessor* processor, VideoPreprocessorConfig config) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地摄像头数码变焦参数,包括缩放倍数,移动步长。 + * @param type 数码变焦参数类型,缩放系数或移动步长。参看 ZoomConfigType{@link #ZoomConfigType}。必填。 + * @param size 缩放系数或移动步长,保留到小数点后三位。默认值为 0。必填。
+ * 选择不同 `type` 时有不同的取值范围。当计算后的结果超过缩放和移动边界时,取临界值。
+ * - `kZoomConfigTypeFocusOffset`:缩放系数增量,范围为 [0, 7]。例如,设置为 0.5 时,如果调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 选择 Zoom in,则缩放系数增加 0.5。缩放系数范围 [1,8],默认为 `1`,原始大小。 + * - `kZoomConfigTypeMoveOffset`:移动百分比,范围为 [0, 0.5],默认为 0,不移动。如果调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 选择的是左右移动,则移动距离为 size x 原始视频宽度;如果选择的是上下移动,则移动距离为 size x 原始视频高度。例如,视频帧边长为 1080 px,设置为 0.5 时,实际移动距离为 0.5 x 1080 px = 540 px。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 每次调用本接口只能设置一种参数。如果缩放系数和移动步长都需要设置,分别调用本接口传入相应参数。 + * - 由于移动步长的默认值为 `0` ,在调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 或 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl} 进行数码变焦操作前,应先调用本接口。 + * @list 视频处理 + */ + + virtual int setVideoDigitalZoomConfig(ZoomConfigType type, float size) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 控制本地摄像头数码变焦,缩放或移动一次。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ZoomDirectionType{@link #ZoomDirectionType}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig{@link #IRTCEngine#setVideoDigitalZoomConfig} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 如果你希望实现持续数码变焦操作,调用 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl}。 + * - 移动端可对摄像头进行光学变焦控制,参看 `setCameraZoomRatio`。 + * @list 视频处理 + */ + + virtual int setVideoDigitalZoomControl(ZoomDirectionType direction) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 开启本地摄像头持续数码变焦,缩放或移动。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ZoomDirectionType{@link #ZoomDirectionType}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig{@link #IRTCEngine#setVideoDigitalZoomConfig} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值并停止操作。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 你也可以调用 stopVideoDigitalZoomControl{@link #IRTCEngine#stopVideoDigitalZoomControl} 手动停止控制。 + * - 如果你希望实现单次数码变焦操作,调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl}。 + * - 移动端可对摄像头进行光学变焦控制,参看 `setCameraZoomRatio`。 + * @list 视频处理 + */ + + virtual int startVideoDigitalZoomControl(ZoomDirectionType direction) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地摄像头持续数码变焦。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 关于开始数码变焦,参看 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl}。 + * @list 视频处理 + */ + + virtual int stopVideoDigitalZoomControl() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 通过视频帧发送 SEI 数据。
+ * 在视频通话场景下,SEI 数据会随视频帧发送;在语音通话场景下,SDK 会自动生成一路 16px × 16px 的黑帧视频流用来发送 SEI 数据。 + + * 语音通话场景下,该值需设为 `kStreamIndexMain`,否则 SEI 数据会被丢弃从而无法送达远端。 + * @param message SEI 消息。 + * @param length SEI 消息长度,建议每帧 SEI 数据总长度不超过 4 KB。 + * @param repeat_count 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
+ * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeat_count+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 SEICountPerFrame{@link #SEICountPerFrame}。 + * @return + * - >= 0: 将被添加到视频帧中的 SEI 的数量。 + * - < 0: 发送失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率。在语音通话场景下,黑帧帧率为 15 fps。 + * - 从程序的启动到结束,建议用同一种发送模式。 + * - 语音通话场景中,仅支持在内部采集模式下调用该接口发送 SEI 数据。 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据;语音通话场景下,若调用此接口后 1min 内未有 SEI 数据发送,则 SDK 会自动取消发布视频黑帧。 + * - 消息发送成功后,远端会收到 onSEIMessageReceived{@link #IRTCEngineEventHandler#onSEIMessageReceived} 回调。 + * - 语音通话切换至视频通话时,会停止使用黑帧发送 SEI 数据,自动转为用采集到的正常视频帧发送 SEI 数据。 + * @list 消息 + */ + + virtual int sendSEIMessage(const uint8_t* message, int length, int repeat_count, SEICountPerFrame mode) = 0; + /** + * + * @type api + * @list 消息 + * @brief 以 Key-Value 格式通过视频帧发送 SEI 数据。 + * 调用此接口前,必须在调用 setLiveMode{@link #IRTCRoom#setLiveMode} 时将房间模式设置为 `kRoomLiveModeSoloHost` 开启单人直播模式。 + * @param json_string JSON 格式的键值对,例如 `{"key1":"value1","key2":"value2"}`: + * - 如果某个 Key 对应的 Value 为空(例如 `""` 或 `null`),则会从 SEI 字典中删除该 Key。 + * - 所有 Key-Value 合并后的总 SEI 数据大小不能超过 10KB。 + * @param count 连续发送该 SEI 数据的次数。 + * - 当 `is_key_frame_only` 为 true 时,代表伴随 `count` 个关键帧(I 帧)发送。 + * - 当 `is_key_frame_only` 为 false 时,代表伴随 `count` 个视频帧发送。 + * @param is_key_frame_only 是否只随关键帧(I 帧)发送: + * - true:只在关键帧发送。 + * - false:所有帧都会发送。 + * @param allow_overwrite 设置该 Key 写入后,后续请求是否允许覆盖它: + * - true:后续请求可覆盖该 Key 的 Value,且 `count` 也会更新为新值; + * - false:后续请求会忽略该 Key 的新值,保持原样。对于已存在的 Key,是否允许本次覆盖取决于该 Key 已保存的覆盖策略。 + * @return + * - 0: 调用成功。 + * - < 0: 发送失败。 + * - -1: 视频模块未启用。 + * - -2: 参数错误(JSON 为空或 count <= 0)。 + * - -3: JSON 格式错误。 + * - -4: SEI 数据总大小超过限制。 + */ + + virtual int sendLivePushSEIMessage(std::string json_string, int count, bool is_key_frame_only, bool allow_overwrite) = 0; + /** + * + * @hidden for internal use only + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief WTN 流视频帧发送 SEI 数据。 + * @param channel_id SEI 消息传输通道,取值范围 [0 - 255]。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message SEI 消息。 + * @param length SEI 消息长度,建议每帧 SEI 数据总长度不超过 4 KB。 + * @param repeat_count 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
+ * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeat_count+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 SEICountPerFrame{@link #SEICountPerFrame}。 + * @return + * - < 0:说明调用失败 + * - = 0:说明当前发送队列已满,无法发送 + * - > 0: 说明调用成功,该数值为已经发送 SEI 的数量 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率。 + * - 从程序的启动到结束,建议用同一种发送模式。 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据。 + * - 消息发送成功后,远端会收到 onPublicStreamSEIMessageReceivedWithChannel 回调。 + * - 调用失败时,本地及远端都不会收到回调。 + * @list 消息 + */ + + virtual int sendPublicStreamSEIMessage(int channel_id, const uint8_t* message, int length, + int repeat_count, SEICountPerFrame mode) = 0; + /** + * + * @type api + * @brief 创建视频设备管理实例 + * @return 视频设备管理实例,详见 IVideoDeviceManager{@link #IVideoDeviceManager} + * @list 视频管理 + */ + + virtual IVideoDeviceManager* getVideoDeviceManager() = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @brief 设备音频管理接口创建 + * @return 音频设备管理接口,详见 IAudioDeviceManager{@link #IAudioDeviceManager} + * @list 音频管理 + */ + + virtual IAudioDeviceManager* getAudioDeviceManager() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 录制通话过程中的音视频数据到本地的文件中。 + * @param type 流属性,指定录制主流还是屏幕流,参看 StreamIndex{@link #StreamIndex} + * @param config 本地录制参数配置,参看 RecordingConfig{@link #RecordingConfig} + * @param recording_type 本地录制的媒体类型,参看 RecordingType{@link #RecordingType}
+ * 注意:屏幕流仅支持录制视频(kRecordingTypeVideoOnl);主流支持录制所有类型。 + * @return + * - 0: 正常 + * - -1: 参数设置异常 + * - -2: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 该方法需在进房后调用。 + * - 调用该方法后,你会收到 onRecordingStateUpdate{@link #IRTCEngineEventHandler#onRecordingStateUpdate} 回调。 + * - 如果录制正常,系统每秒钟会通过 onRecordingProgressUpdate{@link #IRTCEngineEventHandler#onRecordingProgressUpdate} 回调通知录制进度。 + * @list 高级功能 + */ + + virtual int startFileRecording(RecordingConfig config, RecordingType recording_type) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地录制 + * @param type 流属性,指定停止主流或者屏幕流录制,参看 StreamIndex{@link #StreamIndex} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 startFileRecording{@link #IRTCEngine#startFileRecording} 开启本地录制后,你必须调用该方法停止录制。 + * - 调用该方法后,你会收到 onRecordingStateUpdate{@link #IRTCEngineEventHandler#onRecordingStateUpdate} 回调提示录制结果。 + * @list 高级功能 + */ + + virtual int stopFileRecording() = 0; + /** + * + * @type api + * @brief 开始音频录制,并生成录音文件保存到本地。 + * @param config 参看 AudioRecordingConfig{@link #AudioRecordingConfig} + * @return + * - 0: 正常 + * - -2: 参数设置异常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 调用该方法后,会立即启动录制任务并创建录音文件。 + * - 录制包含各种音频效果。但不包含背景音乐。 + * - 录制本地麦克风的音频时,请确保已调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 接口打开麦克风采集。 + * - 调用 stopAudioRecording{@link #IRTCEngine#stopAudioRecording} 关闭录制。 + * - 加入房间前后均可调用。在进房前调用该方法,退房之后,录制任务不会自动停止,需调用 stopAudioRecording{@link #IRTCEngine#stopAudioRecording} 关闭录制。在进房后调用该方法,退房之后,录制任务会自动被停止。如果加入了多个房间,录制的文件中会包含各个房间的音频。 + * - 调用该方法后,你会收到 onAudioRecordingStateUpdate{@link #IRTCEngineEventHandler#onAudioRecordingStateUpdate} 回调。 + * @list 高级功能 + */ + + virtual int startAudioRecording(AudioRecordingConfig& config) = 0; + /** + * + * @type api + * @brief 停止音频文件录制 + * @return + * - 0: 正常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note 调用 startAudioRecording{@link #IRTCEngine#startAudioRecording} 开启本地录制。 + * @list 高级功能 + */ + + virtual int stopAudioRecording() = 0; + /** + * + * @type api + * @brief 启用匹配外置声卡的音频处理模式 + * @param enable
+ * - true: 开启 + * - false: 不开启(默认) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 当采用外接声卡进行音频采集时,建议开启此模式,以获得更好的音质。 + * - 开启此模式时,仅支持耳机播放。如果需要使用扬声器或者外置音箱播放,关闭此模式。 + * @list 音频管理 + */ + + virtual int enableExternalSoundCard(bool enable) = 0; + /** + * + * @type api + * @brief 设置运行时的参数 + * @param json_string json 序列化之后的字符串 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该接口需在 joinRoom{@link #IRTCRoom#joinRoom} 和 startAudioCapture{@link #IRTCEngine#startAudioCapture} 之前调用。 + * @list 引擎管理 + */ + + virtual int setRuntimeParameters(const char * json_string) = 0; + /** + * + * @type api + * @brief 将用户反馈的问题上报到 RTC。 + * @param type 预设问题列表,参看 ProblemFeedbackOption{@link #ProblemFeedbackOption} + * @param info 预设问题以外的其他问题的具体描述,房间信息。 参看 ProblemFeedbackInfo{@link #ProblemFeedbackInfo} + * @return + * - 0: 成功。 + * - -3: 失败。 + * @note + * - 你可以在 [RTC 控制台](https: + * - 如果用户上报时在房间内,那么问题会定位到用户当前所在的一个或多个房间;如果用户上报时不在房间内,那么问题会定位到引擎此前退出的房间。 + * @list 引擎管理 + */ + + virtual int feedback(uint64_t type, const ProblemFeedbackInfo* info) = 0; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音效播放器实例。 + * @return 音效播放器。详见 IAudioEffectPlayer{@link #IAudioEffectPlayer}。 + * @list 混音 + */ + + virtual IAudioEffectPlayer* getAudioEffectPlayer() = 0; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音乐播放器实例。 + * @param player_id 音乐播放器实例 id。取值范围为 `[0, 3]`。最多同时存在 4 个实例,超出取值范围时返回 nullptr。 + * @return 音乐播放器实例,详见 IMediaPlayer{@link #IMediaPlayer} + * @list 混音 + */ + + virtual IMediaPlayer* getMediaPlayer(int player_id) = 0; + /** + * + * @type api + * @brief 登陆 RTS 服务器。
+ * 必须先登录,才能调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 和 sendServerMessage{@link #IRTCEngine#sendServerMessage} 发送房间外点对点消息和向应用服务器发送消息
+ * 在调用本接口登录后,如果想要登出,需要调用 logout{@link #IRTCEngine#logout}。 + * @param token 用户登录必须携带的 Token,用于鉴权验证。
+ * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,`roomId` 置空,Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。 + * @param uid
+ * 用户 ID
+ * 用户 ID 在 appid 的维度下是唯一的。 + * @return + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note 本地用户调用此方法登录后,会收到 onLoginResult{@link #IRTCEngineEventHandler#onLoginResult} 回调通知登录结果,远端用户不会收到通知。 + * @list 消息 + */ + + virtual int login(const char* token, const char* uid) = 0; + /** + * + * @type api + * @brief 登出 RTS 服务器。
+ * 调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口登出前,必须先调用 login{@link #IRTCEngine#login} 登录。 + * - 本地用户调用此方法登出后,会收到 onLogout{@link #IRTCEngineEventHandler#onLogout} 回调通知结果,远端用户不会收到通知。 + * @list 消息 + */ + + virtual int logout() = 0; + /** + * + * @type api + * @brief 更新用户用于登录的 Token
+ * Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
+ * 调用 login{@link #IRTCEngine#login} 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 onLoginResult{@link #IRTCEngineEventHandler#onLoginResult} 回调通知,错误码为 kLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。 + * @param token
+ * 更新的动态密钥 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果 Token 无效导致登录失败,则调用此方法更新 Token 后,SDK 会自动重新登录,而用户不需要自己调用 login{@link #IRTCEngine#login} 方法。 + * - Token 过期时,如果已经成功登录,则不会受到影响。Token 过期的错误会在下一次使用过期 Token 登录时,或因本地网络状况不佳导致断网重新登录时通知给用户。 + * @list 消息 + */ + + virtual int updateLoginToken(const char* token) = 0; + /** + * + * @type api + * @brief 设置应用服务器参数
+ * 客户端调用 sendServerMessage{@link #IRTCEngine#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTCEngine#sendServerBinaryMessage} 发送消息给应用服务器之前,必须设置有效签名和应用服务器地址。 + * @param signature 动态签名,应用服务器可使用该签名验证消息来源。
+ * 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。
+ * 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 + * @param url 应用服务器的地址 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 用户必须调用 login{@link #IRTCEngine#login} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 onServerParamsSetResult{@link #IRTCEngineEventHandler#onServerParamsSetResult} 返回相应结果。 + * @list 消息 + */ + + virtual int setServerParams(const char* signature, const char* url) = 0; + /** + * + * @type api + * @brief 查询对端用户或本端用户的登录状态 + * @param peer_user_id
+ * 需要查询的用户 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 必须调用 login{@link #IRTCEngine#login} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 onGetPeerOnlineStatus{@link #IRTCEngineEventHandler#onGetPeerOnlineStatus} 回调通知查询结果。 + * - 在发送房间外消息之前,用户可以通过本接口了解对端用户是否登录,从而决定是否发送消息。也可以通过本接口查询自己的登录状态。 + * @list 消息 + */ + + virtual int getPeerOnlineStatus(const char* peer_user_id) = 0; + /** + * + * @type api + * @brief 给房间外指定的用户发送文本消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param message 发送的文本消息内容。消息不超过 64 KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外文本消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录。 + * - 用户调用本接口发送文本信息后,会收到一次 onUserMessageSendResultOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageSendResultOutsideRoom} 回调,得知消息是否成功发送。 + * - 若文本消息发送成功,则 uid 所指定的用户会通过 onUserMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageReceivedOutsideRoom} 回调收到该消息。 + * @list 消息 + */ + + virtual int64_t sendUserMessageOutsideRoom(const char* uid, const char* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; + /** + * + * @type api + * @brief 给房间外指定的用户发送二进制消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param length 二进制字符串的长度 + * @param message 发送的二进制消息内容。消息不超过 64 KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外二进制消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录。 + * - 用户调用本接口发送二进制消息后,会收到一次 onUserMessageSendResultOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageSendResultOutsideRoom} 回调,通知消息是否发送成功。 + * - 若二进制消息发送成功,则 uid 所指定的用户会通过 onUserBinaryMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserBinaryMessageReceivedOutsideRoom} 回调收到该条消息。 + * @list 消息 + */ + + virtual int64_t sendUserBinaryMessageOutsideRoom(const char* uid, int length, const uint8_t* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; + /** + * + * @type api + * @brief 客户端给应用服务器发送文本消息(P2Server)。 + * @param message 发送的文本消息内容。消息不超过 64 KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送文本消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录,随后调用 setServerParams{@link #IRTCEngine#setServerParams} 设置应用服务器。 + * - 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTCEngineEventHandler#onServerMessageSendResult} 回调,通知消息发送方是否发送成功。 + * - 若文本消息发送成功,则之前调用 setServerParams{@link #IRTCEngine#setServerParams} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + + virtual int64_t sendServerMessage(const char* message) = 0; + /** + * + * @type api + * @brief 客户端给应用服务器发送二进制消息(P2Server)。 + * @param length 二进制字符串的长度 + * @param message 发送的二进制消息内容。消息不超过 64KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送二进制消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录,随后调用 setServerParams{@link #IRTCEngine#setServerParams} 设置应用服务器。 + * - 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTCEngineEventHandler#onServerMessageSendResult} 回调,通知消息发送方发送成功或失败。 + * - 若二进制消息发送成功,则之前调用 setServerParams{@link #IRTCEngine#setServerParams} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + + virtual int64_t sendServerBinaryMessage(int length, const uint8_t* message) = 0; + /** + * + * @type api + * @brief 开启通话前网络探测 + * @param is_test_uplink 是否探测上行带宽 + * @param expected_uplink_bitrate 期望上行带宽,单位:kbps
范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @param is_test_downlink 是否探测下行带宽 + * @param expected_downlink_biterate 期望下行带宽,单位:kbps
范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 成功调用本接口后,会在 3s 内收到一次 onNetworkDetectionResult{@link #IRTCEngineEventHandler#onNetworkDetectionResult} 回调,此后每 2s 会收到一次该回调,通知探测结果; + * - 若探测停止,则会收到一次 onNetworkDetectionStopped{@link #IRTCEngineEventHandler#onNetworkDetectionStopped} 通知探测停止。 + * @list 网络管理 + */ + + virtual int startNetworkDetection(bool is_test_uplink, int expected_uplink_bitrate, bool is_test_downlink, int expected_downlink_biterate) = 0; + /** + * + * @type api + * @brief 停止通话前网络探测 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口后,会收到一次 onNetworkDetectionStopped{@link #IRTCEngineEventHandler#onNetworkDetectionStopped} 回调通知探测停止。 + * @list 网络管理 + */ + + virtual int stopNetworkDetection() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 在屏幕共享时,设置屏幕音频的采集方式(内部采集/自定义采集) + * @param source_type 屏幕音频输入源类型, 参看 AudioSourceType{@link #AudioSourceType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 默认采集方式是 RTC SDK 内部采集。 + * - 如果设定为内部采集,你必须再调用 startScreenAudioCapture{@link #IRTCEngine#startScreenAudioCapture} 开始采集。 + * - 如果设定为自定义采集,你必须再调用 pushScreenAudioFrame{@link #IRTCEngine#pushScreenAudioFrame} 将自定义采集到的屏幕音频帧推送到 RTC SDK。 + * - 无论是内部采集还是自定义采集,你都必须调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。 + * @list 屏幕共享 + * @order 11 + */ + + virtual int setScreenAudioSourceType(AudioSourceType source_type) = 0; + + /** + * + * @hidden(iOS,Android,Linux) + * @type api + * @brief 在屏幕共享时,设置屏幕音频流的声道数 + * @param channel 声道数,参看 AudioChannel{@link #AudioChannel} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 屏幕共享 + */ + + virtual int setScreenAudioChannel(AudioChannel channel) = 0; + /** + * + * @hidden(Android,iOS,macOS,Windows) + * @deprecated on Windows since 3.59, use `startScreenAudioCapture` with the "device_id" parameter as a replacement. + * @type api + * @brief 在屏幕共享时,开始使用 RTC SDK 内部采集方式,采集屏幕音频 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本接口仅对内部采集生效,RTC SDK 默认使用内部采集模块采集屏幕音频。对于 Windows SDK,若已调用 setScreenAudioSourceType{@link #IRTCEngine#setScreenAudioSourceType} 将音频输入源设置为 `kAudioSourceTypeExternal` 自定义采集,需先切换为 `kAudioSourceTypeInternal` 内部采集,否则该接口调用无效,并将触发 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调。 + * - 采集后,你还需要调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。 + * - 要关闭屏幕音频内部采集,调用 stopScreenAudioCapture{@link #IRTCEngine#stopScreenAudioCapture}。 + * @list 屏幕共享 + */ + + virtual int startScreenAudioCapture() = 0; + /** + * + * @hidden(Linux,Android,iOS) + * @valid since 3.59 + * @type api + * @brief 使用 RTC SDK 内部采集方式,采集桌面端系统声音,用于屏幕共享。
+ * 该接口会采集桌面端系统声卡的音频数据,采集到的音频会混入本地音频流中。 + * @param device_id
+ * - 对于 Windows 平台,该参数用于设置采集本地指定音频进程的音频。例如可将该参数设为某应用程序可执行文件的文件名(如 QQMusic.exe),此时 SDK 只会采集该应用程序的音频。传入 nullptr 或置空时即代表采集整个系统除本进程之外的所有应用程序的音频。当前,应用程序仅支持 QQ 音乐、网易云音乐和酷狗音乐,采集其他进程可能会导致未知行为。 + * - 对于 macOS 平台,该参数表示虚拟设备 ID。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本接口仅对内部采集生效,RTC SDK 默认使用内部采集模块采集屏幕音频。若已调用 setScreenAudioSourceType{@link #IRTCEngine#setScreenAudioSourceType} 将音频输入源设置为 `kAudioSourceTypeExternal` 自定义采集,需先切换为 `kAudioSourceTypeInternal` 内部采集,否则该接口调用无效,并将触发 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调。 + * - 采集后,你还需要调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。 + * - 要关闭屏幕音频内部采集,调用 stopScreenAudioCapture{@link #IRTCEngine#stopScreenAudioCapture}。 + * @list 屏幕共享 + */ + + virtual int startScreenAudioCapture(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @brief 在屏幕共享时,停止使用 RTC SDK 内部采集方式,采集屏幕音频。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调。 + * - 本接口仅对内部采集生效。如果为外部采集模式,调用本接口失败。你需要在外部采集器中实现停止采集的逻辑。 + * - 要开始屏幕音频内部采集,调用 startScreenAudioCapture{@link #IRTCEngine#startScreenAudioCapture}。 + * @list 屏幕共享 + */ + + virtual int stopScreenAudioCapture() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 使用自定义采集方式,采集屏幕共享时的屏幕音频时,将音频帧推送至 RTC SDK 处进行编码等处理。 + * @param frame 音频数据帧,参见 IAudioFrame{@link #IAudioFrame}
+ * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 samples × frame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
+ * - 0: 设置成功。 + * - < 0: 设置失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 调用此接口推送屏幕共享时的自定义采集的音频数据前,必须调用 setScreenAudioSourceType{@link #IRTCEngine#setScreenAudioSourceType} 开启屏幕音频自定义采集。 + * - 你应每隔 10 毫秒,调用一次此方法推送一次自定义采集的音频帧。一次推送的音频帧中应包含 frame.sample_rate / 100 个音频采样点。比如,假如采样率为 48000Hz,则每次应该推送 480 个采样点。 + * - 调用此接口将自定义采集的音频帧推送到 RTC SDK 后,你必须调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。在调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 前,推送到 RTC SDK 的音频帧信息会丢失。 + * @list 屏幕共享 + * @order 14 + */ + + virtual int pushScreenAudioFrame(IAudioFrame* frame) = 0; + /** + * + * @type api + * @hidden internal use only + * @brief 在听众端,设置订阅的所有远端音频流精准对齐后播放。 + * @param stream_id 流标识 + * 一般选择主唱的音频流。
+ * 你必须在收到 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio},确认此音频流已发布后,调用此 API。 + * @param mode 是否对齐,默认不对齐。参看 AudioAlignmentMode{@link #AudioAlignmentMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 你必须在实时合唱场景下使用此功能。在加入房间时,所有人应设置 RoomProfileType{@link #RoomProfileType} 为 `kRoomProfileTypeChorus`。 + * - 订阅的所有远端流必须通过 startAudioMixing 开启了背景音乐混音,并将 AudioMixingConfig 中的 `sync_progress_to_record_frame` 设置为 `true`。 + * - 如果订阅的某个音频流延迟过大,可能无法实现精准对齐。 + * - 合唱的参与者不应调用此 API,因为调用此 API 会增加延迟。如果希望从听众变为合唱参与者,应关闭对齐功能。 + * @list 在线 KTV + */ + + virtual int setAudioAlignmentProperty(const char* stream_id, AudioAlignmentMode mode) = 0; + /** + * + * @hidden(macOS,Windows,Android,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 Extension 配置项 + * @param group_id App 和 Extension 应该归属于同一个 App Group,此处需要传入 Group Id + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该函数必须在 sharedEngineWithAppId 函数之后立即调用。如果不调用或者调用时机比较晚,本地用户会收到 onMediaDeviceStateChanged 的回调。
+ * - 参数 device_state 值为 ByteRTCMediaDeviceStateStopped,device_error 值为 `ByteRTCMediaDeviceErrorNotFindGroupId` + * @list 屏幕共享 + */ + + virtual int setExtensionConfig(const char* group_id) = 0; + /** + * + * @hidden(macOS,Windows,Android,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 发送屏幕共享 Extension 程序消息 + * @param message 发送给 Extension 程序的消息内容 + * @param size 消息内容大小 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该函数必须在 startScreenCapture 函数之后调用 + * @list 屏幕共享 + */ + + virtual int sendScreenCaptureExtensionMessage(const char* message, size_t size) = 0; + /** + * + * @hidden(macOS,Windows,Android,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 开启本地屏幕共享数据采集 + * @param type 屏幕共享数据采集类型 + * @param bundle_id 传入 Broadcast Upload Extension 的 Bundle Id,用于在设置中优先展示 Extension + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 当从 iOS 控制中心异常启动 Extension 时可以不用调用本函数
+ * 本地用户会收到 onMediaDeviceStateChanged 的回调。
+ * 参数 device_state 值为 ByteRTCMediaDeviceStateStarted,device_error 值为 ByteRTCMediaDeviceErrorOK + * @list 屏幕共享 + */ + + virtual int startScreenCapture(ScreenMediaType type, const char* bundle_id) = 0; + /** + * + * @hidden(macOS,Windows,iOS,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过传入的 Type 和 Context 开启屏幕音视频内部采集。 + * @param type 指定的屏幕媒体采集类型,参看 ScreenMediaType{@link #ScreenMediaType} + * @param context Android 平台传入 Intent 对象,由业务方申请系统录屏权限后获得。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 采集后,你还需要调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 或 publishStreamVideo{@link #IRTCRoom#publishStreamVideo} 将采集到的屏幕音视频推送到远端。 + * - 开启屏幕音视频内部采集,Android 专用接口。 + * @list 屏幕共享 + */ + + virtual int startScreenCapture(ScreenMediaType type, void* context) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地屏幕共享数据采集 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 屏幕共享 + */ + + virtual int stopScreenCapture() = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @region 转推直播 + * @brief 推送客户端合流外部视频帧。
+ * @param uid
+ * 外部视频帧对应的合流布局中的uid + * @param frame
+ * 用于合流的外部视频帧 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + virtual int pushClientMixedStreamExternalVideoFrame(const char* uid, const VideoFrameData& frame) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief 设置转推直播观察者。 + * @param observer + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + + virtual int setClientMixedStreamObserver(IClientMixedStreamObserver* observer) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief 客户端合流转推 CDN。 + * @param task_id 任务 ID。 + * @param config 合流转推 CDN 任务配置。 + * @param extra_config + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list Pushing Streams to CDN + */ + + virtual int startClientMixedStream(const char* task_id, IMixedStreamConfig* config, ClientMixedStreamConfig extra_config) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief + * @param task_id + * @param config + * @param extra_config + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + + virtual int updateClientMixedStream(const char* task_id, IMixedStreamConfig* config, ClientMixedStreamConfig extra_config) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief + * @param task_id + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + + virtual int stopClientMixedStream(const char* task_id) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该接口替代了 `startPushMixedStreamToCDN` 和 `startPushPublicStream` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 指定房间中的媒体流,合成后一路流发布到 CDN 或发布一路 WTN 流。 + * @param task_id 转推直播任务 ID,长度不超过 127 字节。 当 IMixedStreamConfig{@link #IMixedStreamConfig} 中的 `PushTargetType = 0` 时, 用于标识转推直播任务。你可以在同一房间内发起多个转推直播任务,并用不同的 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 + * 当 `PushTargetType = 1` 时,设置无效,传空即可。 + * @param push_target_config 推流目标配置参数,比如设置推流地址、WTN 流 ID。参看 MixedStreamPushTargetConfig{@link #MixedStreamPushTargetConfig}。 + * @param config 合流转推配置参数,比如设置合流的图片、视频视图布局和音频属性。参看 IMixedStreamConfig{@link #IMixedStreamConfig}。 + * @return + * - 0: 成功。你可以通过 onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent} 回调获取启动结果和推流过程中的事件。 + * - !0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 在[控制台](https: + * - 调用 stopPushMixedStream{@link #IRTCEngine#stopPushMixedStream} 可以停止转推任务。 + * - 调用 updatePushMixedStream{@link #IRTCEngine#updatePushMixedStream} 可以更新部分任务参数。 + * @list CDN 推流 + */ + + virtual int startPushMixedStream(const char* task_id, MixedStreamPushTargetConfig push_target_config, IMixedStreamConfig* config) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该接口替代了 `updatePushMixedStreamToCDN` 和 `updatePublicStreamParam` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 更新由 startPushMixedStream{@link #IRTCEngine#startPushMixedStream} 启动的任务参数,会收到 onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent} 回调。 + * @param task_id 转推直播任务 ID。指定想要更新参数设置的转推直播任务。仅当 IMixedStreamConfig{@link #IMixedStreamConfig} 中的 `PushTargetType = 0` 时有效。 + * @param push_target_config 推流目标配置参数,比如设置推流地址、WTN 流 ID。参看 MixedStreamPushTargetConfig{@link #MixedStreamPushTargetConfig}。 + * @param config 转推直播配置参数,参看 IMixedStreamConfig{@link #IMixedStreamConfig}。除特殊说明外,均支持过程中更新。
+ * 调用时,结构体中没有传入值的属性,会被更新为默认值。 + * @return + * - 0: 成功。 + * - !0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + */ + + virtual int updatePushMixedStream(const char* task_id, MixedStreamPushTargetConfig push_target_config, IMixedStreamConfig* config) = 0; + /** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN` 方法来停止合流转推任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @hidden(Linux) + * @hiddensdk(audiosdk) + * @brief 停止由 startPushMixedStream{@link #IRTCEngine#startPushMixedStream} 启动的任务。 + * @param task_id 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 + * @param target_type 参看 MixedStreamPushTargetType{@link #MixedStreamPushTargetType}。 + * @return + * - 0: 成功 + * - !0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + */ + + virtual int stopPushMixedStream(const char* task_id, MixedStreamPushTargetType target_type) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自版本 3.60 起,该接口取代了 `startPushSingleStreamToCDN` 方法。如果您已升级到版本 3.60 或更高版本,且仍在使用此方法,请迁移到该接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 将房间内某一路音视频流,推送到指定的 RTC 房间或 CDN 地址。此过程不涉及编解码。 + * @param task_id 任务 ID。
+ * 你可以发起多个单流转推任务,并用不同的任务 ID 加以区分。当你需要发起多个单流转推任务时,应使用多个 ID;当你仅需发起一个单流转推任务时,建议使用空字符串。 + * @param param 单流转推配置参数。详见 PushSingleStreamParam{@link #PushSingleStreamParam}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 在调用该接口前,你需要在[控制台](https: + * - 调用该方法后,关于启动结果和推流过程中的错误,会收到 onSingleStreamEvent{@link #IRTCEngineEventHandler#onSingleStreamEvent} 回调。 + * - 在[控制台](https: + * - 调用 stopPushSingleStream{@link #IRTCEngine#stopPushSingleStream} 停止任务。 + * - 由于本功能不进行编解码,所以推到 RTMP 的视频流会根据推流端的分辨率、编码方式、关闭摄像头等变化而变化。 + * @list CDN 推流 + */ + + virtual int startPushSingleStream(const char* task_id, PushSingleStreamParam& param) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN` 方法来停止单流转推直播任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止由 startPushSingleStream{@link #IRTCEngine#startPushSingleStream} 启动的单流转推任务。 + * @param task_id 任务 ID。可以指定想要停止的单流转推任务。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + */ + + virtual int stopPushSingleStream(const char* task_id) = 0; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 开启缓存同步功能。开启后,会缓存收到的实时音视频数据,并对齐不同数据中的时间戳完成同步。此功能会影响音视频数据消费的实时性。 + * @param config 参看 ChorusCacheSyncConfig{@link #ChorusCacheSyncConfig}。 + * @param observer 事件和数据观察者,参看 IChorusCacheSyncObserver{@link #IChorusCacheSyncObserver}。 + * @return 查看 ReturnStatus{@link #ReturnStatus}。 + * @note 要关闭缓存同步功能,调用 stopChorusCacheSync{@link #IRTCEngine#stopChorusCacheSync}。 + * @list Pushing Streams to CDN + */ + + virtual int startChorusCacheSync(ChorusCacheSyncConfig * config, IChorusCacheSyncObserver* observer) = 0; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭缓存同步功能。 + * @return 查看 ReturnStatus{@link #ReturnStatus}。 + * @list Pushing Streams to CDN + */ + + virtual int stopChorusCacheSync() = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 更新屏幕采集数据类型 + * @param type 屏幕采集数据类型 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该函数必须在 startScreenCapture 函数之后调用。本地用户会收到 onMediaDeviceStateChanged 的回调。
+ * 参数 device_state 值为 ByteRTCMediaDeviceStateStarted 或 ByteRTCMediaDeviceStateStopped,device_error 值为 ByteRTCMediaDeviceErrorOK。 + * @list 屏幕共享 + */ + + virtual int updateScreenCapture(ScreenMediaType type) = 0; + + /** + * + * @type api + * @brief 启用音频信息提示。开启提示后,你会收到 onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport},onRemoteAudioPropertiesReport{@link #IRTCEngineEventHandler#onRemoteAudioPropertiesReport} 和 onActiveSpeaker{@link #IRTCEngineEventHandler#onActiveSpeaker}。 + * @param config 详见 AudioPropertiesConfig{@link #AudioPropertiesConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enableAudioPropertiesReport(const AudioPropertiesConfig& config) = 0; + + /** + * + * @type api + * @hidden 3.60 for internal use only + * @brief Enable audio voice detection. After that, you will receive onAudioVADStateUpdate{@link #IRTCEngineEventHandler#onAudioVADStateUpdate}. + * @param interval 回调间隔,单位毫秒。
+ * + `<= 0`: 关闭人声识别能力回调。 + * + `[100, 3000]`: 开启人声识别能力回调,并将信息提示间隔设置为此值。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enableAudioVADReport(int interval) = 0; + /** + * + * @hidden 3.60 for internal use only + * @type api + * @brief Enable audio music detection. After that, you will receive onAudioAEDStateUpdate{@link #IRTCEngineEventHandler#onAudioAEDStateUpdate}. + * @param interval 回调间隔,单位毫秒。
+ * + `<= 0`: 关闭回调。 + * + `[100, 3000]`: 开启回调并将信息提示间隔设置为此值。推荐设置为 2000。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enableAudioAEDReport(int interval) = 0; + + /** + * + * @type api + * @brief 调节本端播放收到的远端流时的音量。你必须在进房后进行设置。流的发布状态改变不影响设置生效。 + * @param stream_id 流标识 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
+ * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内:
+ * - 当该方法与 setRemoteRoomAudioPlaybackVolume{@link #IRTCRoom#setRemoteRoomAudioPlaybackVolume} 共同使用时,本地收听用户 A 的音量为后调用的方法设置的音量; + * - 当该方法与 setPlaybackVolume{@link #IRTCEngine#setPlaybackVolume} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * - 当你调用该方法设置远端流音量后,如果远端退房,接口设置失效。 + * @list 音频管理 + */ + + virtual int setRemoteAudioPlaybackVolume(const char* stream_id, int volume) = 0; + /** + * + * @type api + * @brief 开启/关闭音量均衡功能。
+ * 开启音量均衡功能后,人声的响度会调整为 -16lufs。如果已调用 setAudioMixingLoudness 传入了混音音乐的原始响度,此音乐播放时,响度会调整为 -20lufs。(Linux 不支持) + * @param enable 是否开启音量均衡功能:
+ * - true: 是 + * - false: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该接口须在调用 start{@link #IAudioEffectPlayer#start} 开始播放音频文件之前调用。 + * @list 音频管理 + */ + + virtual int enableVocalInstrumentBalance(bool enable) = 0; + /** + * + * @type api + * @brief 打开/关闭音量闪避功能,适用于在 RTC 通话过程中会同时播放短视频或音乐的场景,如“一起看”等。
+ * 开启该功能后,当检测到远端人声时,RTC 本地的媒体播放音量会自动减弱,从而保证远端人声的清晰可辨;当远端人声消失时,RTC 的本地媒体音量会恢复到闪避前的音量水平。 + * @param enable 是否开启音量闪避:
+ * - true: 是 + * - false: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enablePlaybackDucking(bool enable) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册本地视频帧监测器。
+ * 无论使用内部采集还是自定义采集,调用该方法后,SDK 每监测到一帧本地视频帧时,都会将视频帧信息通过 onLocalEncodedVideoFrame{@link #ILocalEncodedVideoFrameObserver#onLocalEncodedVideoFrame} 回调给用户 + * @param observer 本地视频帧监测器,参看 ILocalEncodedVideoFrameObserver{@link #ILocalEncodedVideoFrameObserver}。将参数设置为 nullptr 则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该方法可在进房前后的任意时间调用,在进房前调用可保证尽可能早地监测视频帧并触发回调 + * @list 自定义流处理 + */ + + virtual int registerLocalEncodedVideoFrameObserver(ILocalEncodedVideoFrameObserver* observer) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册远端编码后视频数据回调。
+ * 完成注册后,当 SDK 监测到远端编码后视频帧时,会触发 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame} 回调 + * @param observer 远端编码后视频数据监测器,参看 IRemoteEncodedVideoFrameObserver{@link #IRemoteEncodedVideoFrameObserver} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 更多自定义解码功能说明参看 [自定义视频编解码](https: + * - 该方法适用于手动订阅,并且进房前后均可调用,建议在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + + virtual int registerRemoteEncodedVideoFrameObserver(IRemoteEncodedVideoFrameObserver* observer) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册自定义编码帧推送事件回调 + * @param encoder_handler 自定义编码帧回调类,参看 IExternalVideoEncoderEventHandler{@link #IExternalVideoEncoderEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法需在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + + virtual int setExternalVideoEncoderEventHandler(IExternalVideoEncoderEventHandler* encoder_handler) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送自定义编码后的视频流 + + * @param video_index 对应的编码流下标,从 0 开始,如果调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 设置了多路流,此处数量须与之保持一致 + * @param video_stream 编码流视频帧信息,参看 IEncodedVideoFrame{@link #IEncodedVideoFrame}。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 目前仅支持推送 H264 和 ByteVC1 格式的视频帧,且视频流协议格式须为 Annex B 格式。 + * - 该函数运行在用户调用线程内 + * - 推送自定义编码视频帧前,必须调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 将视频输入源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + + virtual int pushExternalEncodedVideoFrame(int video_index, IEncodedVideoFrame* video_stream) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之前,设置远端视频数据解码方式 + * @param stream_id 远端流 ID,指定对哪一路视频流进行解码方式设置 + * @param config 视频解码方式,参看 VideoDecoderConfig{@link #VideoDecoderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 当你想要对远端流进行自定义解码时,你需要先调用 registerRemoteEncodedVideoFrameObserver{@link #IRTCEngine#registerRemoteEncodedVideoFrameObserver} 注册远端视频流监测器,然后再调用该接口将解码方式设置为自定义解码。监测到的视频数据会通过 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame} 回调出来。 + * - 自 3.56 起,要用于自动订阅场景下,你可以设置 `key` 中的 `RoomId` 和 `UserId` 为 `nullptr`,此时,通过此接口设置的解码方式根据 `key` 中的 `StreamIndex` 值,适用于所有的远端主流或屏幕流的解码方式。 + * @list 自定义流处理 + */ + + virtual int setVideoDecoderConfig(const char* stream_id, VideoDecoderConfig config) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之后,向远端请求关键帧 + * @param stream_id 远端流 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅适用于手动订阅模式,并且在成功订阅远端流之后使用。 + * - 该方法适用于调用 setVideoDecoderConfig{@link #IRTCEngine#setVideoDecoderConfig} 开启自定义解码功能后,并且自定义解码失败的情况下使用 + * @list 音视频传输 + */ + + virtual int requestRemoteVideoKeyFrame(const char* stream_id) = 0; + /** + * + * @type api + * @brief 发送音频流同步信息。将消息通过音频流发送到远端,并实现与音频流同步,该接口调用成功后,远端用户会收到 onStreamSyncInfoReceived{@link #IRTCEngineEventHandler#onStreamSyncInfoReceived} 回调。 + * @param data 消息内容。 + * @param length 消息长度。取值范围是 [1,255] 字节,建议小于 16 字节,否则可能占用较大带宽。 + * @param config 媒体流信息同步的相关配置,详见 StreamSyncInfoConfig{@link #StreamSyncInfoConfig} 。 + * @return + * - >=0: 消息发送成功。返回成功发送的次数。 + * - -1: 消息发送失败。消息长度大于 255 字节。 + * - -2: 消息发送失败。传入的消息内容为空。 + * - -3: 消息发送失败。通过屏幕流进行消息同步时,此屏幕流还未发布。 + * - -4: 消息发送失败。通过用麦克风或自定义设备采集到的音频流进行消息同步时,此音频流还未发布,详见错误码 ErrorCode{@link #ErrorCode}。 + * @note + * - 调用本接口的频率建议不超过 50 次每秒。 + * - 在 `kRoomProfileTypeInteractivePodcast` 房间模式下,此消息一定会送达。在其他房间模式下,如果本地用户未说话,此消息不一定会送达。 + * @list 消息 + */ + + virtual int sendStreamSyncInfo(const uint8_t* data, int32_t length, const StreamSyncInfoConfig& config) = 0; + /** + * + * @type api + * @brief 开启本地语音变调功能,多用于 K 歌场景。
+ * 使用该方法,你可以对本地语音的音调进行升调或降调等调整。 + * @param pitch 相对于语音原始音调的升高/降低值,取值范围[-12,12],默认值为 0,即不做调整。
+ * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。
+ * 超出取值范围则设置失败,并且会触发 onWarning{@link #IRTCEngineEventHandler#onWarning} 回调,提示 WarningCode{@link #WarningCode} 错误码为 `WARNING_CODE_SET_SCREEN_STREAM_INVALID_VOICE_PITCH` 设置语音音调不合法 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频处理 + */ + + virtual int setLocalVoicePitch(int pitch) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在指定视频流上添加水印。 + * @param image_path 水印图片路径,仅支持本地文件绝对路径,长度限制为 512 字节。
+ * 水印图片为 PNG 或 JPG 格式。 + * @param config 水印参数,参看 RTCWatermarkConfig{@link #RTCWatermarkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 clearVideoWatermark{@link #IRTCEngine#clearVideoWatermark} 移除指定视频流的水印。 + * - 同一路流只能设置一个水印,新设置的水印会代替上一次的设置。你可以多次调用本方法来设置不同流的水印。 + * - 若开启本地预览镜像,或开启本地预览和编码传输镜像,则远端水印均不镜像;在开启本地预览水印时,本端水印会镜像。 + * - 开启大小流后,水印对大小流均生效,且针对小流进行等比例缩小。 + * @list 视频处理 + */ + + virtual int setVideoWatermark(const char* image_path, RTCWatermarkConfig config) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 移除指定视频流的水印。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 视频处理 + */ + + virtual int clearVideoWatermark() = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 截取本地视频画面 + * @param callback 本地截图的回调。参看 ISnapshotResultCallback{@link #ISnapshotResultCallback}。 + * @return 本地截图任务的编号,从 `1` 开始递增。 + * @note + * - 对截取的画面,包含本地视频处理的全部效果,包含旋转,镜像,美颜等。 + * - 不管采用 SDK 内部采集,还是自定义采集,都可以进行截图。 + * @list 高级功能 + */ + + virtual long takeLocalSnapshot(ISnapshotResultCallback* callback) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 截取远端视频画面 + * @param stream_id 流标识 + * @param callback 参看 ISnapshotResultCallback{@link #ISnapshotResultCallback}。 + * @return 远端截图任务的编号,从 `1` 开始递增。 + * @list 高级功能 + */ + + virtual long takeRemoteSnapshot(const char* stream_id, ISnapshotResultCallback* callback) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. + * @type api + * @brief 截取远端的视频流画面,生成 JPG 文件,并保存到本地指定路径。
+ * 调用该方法后,SDK 会触发回调 onRemoteSnapshotTakenToFile{@link #IRTCEngineEventHandler#onRemoteSnapshotTakenToFile} 报告截图是否成功,以及截取的图片信息。 + * @param stream_id 待截取的远端视频流 ID。 + * @param file_path 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。以 Windows 为例:`C:\\Users\\YourName\\Pictures\\snapshot.jpg`。 + * @return 远端截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + + virtual long takeRemoteSnapshotToFile(const char* stream_id, const char* file_path) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. + * @type api + * @brief 截取本地视频流画面,生成 JPG 文件,并保存到本地指定路径。
+ * 调用该方法后,SDK 会触发回调 onLocalSnapshotTakenToFile{@link #IRTCEngineEventHandler#onLocalSnapshotTakenToFile} 报告截图是否成功,以及截取的图片信息。 + * @param file_path 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。以 Windows 为例:`C:\\Users\\YourName\\Pictures\\snapshot.jpg`。 + * @return 远端截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + + virtual long takeLocalSnapshotToFile(const char* file_path) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 摄像头处于关闭状态时,使用静态图片填充本地推送的视频流。
+ * 调用 `stopVideoCapture` 接口时,会开始推静态图片。若要停止发送图片,可传入空字符串或启用内部摄像头采集。
+ * 可重复调用该接口来更新图片。 + * @param file_path 设置静态图片的路径。
+ * 支持本地文件绝对路径,不支持网络链接,长度限制为 512 字节。
+ * 静态图片支持类型为 JPEG/JPG、PNG、BMP。
+ * 若图片宽高比与设置的编码宽高比不一致,图片会按编码高宽等比缩放,并裁剪长边。推流帧率与码率与设置的编码参数一致。 + * @return + * - 0: 成功。 + * - -2: 失败。确保传入的 file_path 为有效路径。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 该接口只适用于 SDK 内部摄像头采集,不适用于自定义视频采集。 + * - 本地预览无法看到静态图片。 + * - 进入房间前后均可调用此方法。在多房间场景中,静态图片仅在发布的房间中生效。 + * - 针对该静态图片,滤镜和镜像效果不生效,水印效果生效。 + * - 只有主流能设置静态图片,屏幕流不支持设置。 + * - 开启大小流后,静态图片对大小流均生效,且针对小流进行等比例缩小。 + * @list 音视频传输 + */ + + virtual int setDummyCaptureImagePath(const char* file_path) = 0; + /** + * + * @type api + * @brief 开启云代理 + * @param configuration 云代理服务器信息列表。参看 CloudProxyConfiguration{@link #CloudProxyConfiguration}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 在加入房间前调用此接口 + * - 在开启云代理后,进行通话前网络探测 + * - 开启云代理后,并成功连接云代理服务器后,会收到 onCloudProxyConnected{@link #IRTCEngineEventHandler#onCloudProxyConnected}。 + * - 要关闭云代理,调用 stopCloudProxy{@link #IRTCEngine#stopCloudProxy}。 + * @list 通话加密 + */ + + virtual int startCloudProxy(const CloudProxyConfiguration& configuration) = 0; + /** + * + * @type api + * @brief 关闭云代理 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 要开启云代理,调用 startCloudProxy{@link #IRTCEngine#startCloudProxy}。 + * @list 通话加密 + */ + + virtual int stopCloudProxy() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启音视频回路测试。
+ * 在进房前,用户可调用该接口对音视频通话全链路进行检测,包括对音视频设备以及用户上下行网络的检测,从而帮助用户判断是否可以正常发布和接收音视频流。
+ * 开始检测后,SDK 会录制你的声音或视频。如果你在设置的延时范围内收到了回放,则视为音视频回路测试正常。 + * @param echo_test_config 回路测试参数设置,参看 EchoTestConfig{@link #EchoTestConfig}。 + * @param play_delay_time 音视频延迟播放的时间间隔,用于指定在开始检测多长时间后期望收到回放。取值范围为 [2,10],单位为秒,默认为 2 秒。 + * @return 方法调用结果:
+ * - 0:成功 + * - -2:失败,参数异常 + * - -4:失败,用户已进房 + * - -6:失败,当前用户已经在检测中 + * - -7:失败,音视频均不检查 + * - -8:失败,已经存在相同 roomId 的房间 + * @note + * - 调用该方法开始音视频回路检测后,你可以调用 stopEchoTest{@link #IRTCEngine#stopEchoTest} 立即结束测试,也可等待测试 60s 后自动结束,以更换设备进行下一次测试,或进房。 + * - 在该方法之前调用的所有跟设备控制、流控制相关的方法均在开始检测时失效,在结束检测后恢复生效。 + * - 在调用 startEchoTest{@link #IRTCEngine#startEchoTest} 和 stopEchoTest{@link #IRTCEngine#stopEchoTest} 之间调用的所有跟设备采集、流控制、进房相关的方法均不生效,并会收到 onWarning{@link #IRTCEngineEventHandler#onWarning} 回调,提示警告码为 `kWarningCodeInEchoTestMode`。 + * - 音视频回路检测的结果会通过 onEchoTestResult{@link #IRTCEngineEventHandler#onEchoTestResult} 回调通知。 + * @list 网络管理 + */ + + virtual int startEchoTest(EchoTestConfig echo_test_config, unsigned int play_delay_time) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 停止音视频回路测试。
+ * 调用 startEchoTest{@link #IRTCEngine#startEchoTest} 开启音视频回路检测后,你必须调用该方法停止检测。 + * @return 方法调用结果:
+ * - 0:成功。 + * - -3:失败,未开启回路检测。 + * @note 音视频回路检测结束后,所有对系统设备及音视频流的控制均会恢复到开始检测前的状态。 + * @list 网络管理 + */ + + virtual int stopEchoTest() = 0; + /** + * + * @hidden + * @type api + * @brief 创建 K 歌评分管理接口。 + * @return K 歌评分管理接口,详见 ISingScoringManager{@link #ISingScoringManager#ISingScoringManager}。 + * @note 如需使用 K 歌评分功能,即调用该方法以及 `ISingScoringManager` 类下全部方法,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * @list 在线 KTV + */ + + virtual ISingScoringManager* getSingScoringManager() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 通过 NTP 协议,获取网络时间。 + * @return 网络时间。参看 NetworkTimeInfo{@link #NetworkTimeInfo}。 + * @note + * 第一次调用此接口会启动网络时间同步功能,并返回 `0`。同步完成后,会收到 onNetworkTimeSynchronized{@link #IRTCEngineEventHandler#onNetworkTimeSynchronized},此后,再次调用此 API,即可获取准确的网络时间。 + * @list 网络管理 + */ + + virtual NetworkTimeInfo getNetworkTimeInfo() = 0; + /** + * + * @hidden currently not available + * @type api + * @brief 创建 KTV 管理接口。 + * @return KTV 管理接口,参看 IKTVManager{@link #IKTVManager}。 + * @list 在线 KTV + */ + + virtual IKTVManager* getKTVManager() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启通话前回声检测 + * @param test_audio_file_path 用于回声检测的音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。
+ * 音频文件不为静音文件,推荐时长为 10 ~ 20 秒。 + * @return 方法调用结果:
+ * - 0: 成功。 + * - -1:失败。上一次检测未结束,请先调用 stopHardwareEchoDetection{@link #IRTCEngine#stopHardwareEchoDetection} 停止检测 后重新调用本接口。 + * - -2:失败。路径不合法或音频文件格式不支持。 + * @note + * - 只有当 RoomProfileType{@link #RoomProfileType} 为 `kRoomProfileTypeMeeting` 和 `kRoomProfileTypeMeetingRoom` 时支持开启本功能。 + * - 开启检测前,你需要向用户获取音频设备的使用权限。 + * - 开启检测前,请确保音频设备没有被静音,采集和播放音量正常。 + * - 调用本接口后监听 onHardwareEchoDetectionResult{@link #IRTCEngineEventHandler#onHardwareEchoDetectionResult} 获取检测结果。 + * - 检测期间,进程将独占音频设备,无法使用其他音频设备测试接口 startEchoTest{@link #IRTCEngine#startEchoTest}。 + * - 调用 stopHardwareEchoDetection{@link #IRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * @list 音频管理 + */ + + virtual int startHardwareEchoDetection(const char* test_audio_file_path) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 停止通话前回声检测 + * @return 方法调用结果:
+ * - 0: 成功。 + * - -1:失败。 + * @note + * - 关于开启通话前回声检测,参看 startHardwareEchoDetection{@link #IRTCEngine#startHardwareEchoDetection} 。 + * - 建议在收到 onHardwareEchoDetectionResult{@link #IRTCEngineEventHandler#onHardwareEchoDetectionResult} 通知的检测结果后,调用本接口停止检测。 + * - 在用户进入房间前结束回声检测,释放对音频设备的占用,以免影响正常通话。 + * @list 音频管理 + */ + + virtual int stopHardwareEchoDetection() = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 启用蜂窝网络辅助增强,改善通话质量。 + * @param config 参看 MediaTypeEnhancementConfig{@link #MediaTypeEnhancementConfig}。 + * @return 方法调用结果:
+ * - 0: 成功。 + * - -1:失败,内部错误。 + * - -2: 失败,输入参数错误。 + * @note 此功能默认不开启。 + * @list Audio Management + */ + + virtual int setCellularEnhancement(const MediaTypeEnhancementConfig& config) = 0; + /** + * + * @type api + * @brief 设置本地代理。 + * @param configurations 本地代理配置参数。参看 LocalProxyConfiguration{@link #LocalProxyConfiguration}。
+ * 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。
+ * 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 + * @param configuration_num 本地代理配置参数的数量。 + * @note + * - 该方法需要在进房前调用。 + * - 调用该方法设置本地代理后,SDK 会触发 onLocalProxyStateChanged{@link #IRTCEngineEventHandler#onLocalProxyStateChanged} ,返回代理连接的状态。 + * @list 通话加密 + */ + + virtual int setLocalProxy(const LocalProxyConfiguration* configurations, int configuration_num) = 0; + /** + * + * @hidden(Android,iOS) + * @valid since 3.57 + * @type api + * @brief 设置视频暗光增强模式。
+ * 对于光线不足、照明不均匀或背光等场景下推荐开启,可有效改善画面质量。 + * @param mode 默认不开启。参看 VideoEnhancementMode{@link #VideoEnhancementMode}。 + * @return + * - 0: API 调用成功。会立即生效,但需要等待下载和检测完成后才能看到增强后的效果。 + * - < 0: API 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 开启后会影响设备性能,应根据实际需求和设备性能决定是否开启。 + * - 对 RTC SDK 内部采集的视频和自定义采集的视频都生效。 + * @list 视频处理 + */ + + virtual int setLowLightAdjusted(VideoEnhancementMode mode) = 0; + + /** + * + * @valid since 3.60 + * @type api + * @brief 获取 WTN 流对象。
+ * 你可以通过此方法获取 WTN 流对象,以实现自定义的视频渲染和处理。
+ * 调用此方法后,可以通过调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream} 或 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 订阅指定的 WTN 流。
+ * 如需发布 WTN 流,调用 startPushMixedStream{@link #IRTCEngine#startPushMixedStream}。 + * @return WTN 流对象。参看 IWTNStream{@link #IWTNStream}。 + * @list WTN + */ + + virtual IWTNStream* getWTNStream() = 0; + + /** + * + * @type api + * @brief 创建 IRTCEngine 实例。
+ * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
+ * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param event_handler SDK 回调给应用层的 Handler,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} + * @return + * - IRTCEngine:创建成功。返回一个可用的 IRTCEngine{@link #IRTCEngine} 实例 + * - Null:app_id 或者 event_handler 为空, event_handler 为空。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API IRTCEngine* createRTCEngine(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + /** + * + * @hidden internal use only + * @type api + * @brief 创建多实例引擎对象
+ * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
+ * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新创建的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param handler SDK 回调给应用层的 Handler,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} + * @return + * - RTCEngine:创建成功。返回一个可用的 IRTCEngine{@link #IRTCEngine} 实例 + * - Null:.so 文件加载失败,创建失败。 + * @note 你应注意保持 handler 的生命周期必须大于 IRTCEngine{@link #IRTCEngine} 的生命周期,即 handler 必须在调用 destroyRTCEngine{@link #IRTCEngine#destroyRTCEngine} 之后销毁。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API IRTCEngine* createRTCEngineMulti(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + /** + * + * @type api + * @brief 销毁由 createRTCEngine{@link #IRTCEngine#createRTCEngine} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 IRTCEngine{@link #IRTCEngine} 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 IRTCEngine{@link #IRTCEngine} 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 IRTCEngine{@link #IRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互。 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API void destroyRTCEngine(); + /** + * + * @hidden internal use only + * @type api + * @brief 销毁由 createRTCEngineMulti{@link #IRTCEngine#createRTCEngineMulti} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 IRTCEngine{@link #IRTCEngine} 实例相关的业务场景全部结束后,才调用此方法 + * - 该方法在调用之后,会销毁所有和此 IRTCEngine{@link #IRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API void destroyRTCEngineMulti(IRTCEngine* instance_multi); + /** + * + * @type api + * @brief 获取当前 SDK 版本信息。 + * @return 当前 SDK 版本信息。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API const char* getSDKVersion(); + /** + * + * @type api + * @brief 配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。 + * @param log_config 本地日志参数,参看 LogConfig{@link #LogConfig}。 + * @return + * - 0:成功。 + * - –1:失败,本方法必须在创建引擎前调用。 + * - –2:失败,参数填写错误。 + * @note 本方法必须在调用 createRTCEngine{@link #IRTCEngine#createRTCEngine} 之前调用。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API int setLogConfig(const LogConfig& log_config); +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine_event_handler.h new file mode 100644 index 0000000..a80a1d3 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine_event_handler.h @@ -0,0 +1,1292 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Event Handler Lite +*/ + +#pragma once + +#include "rtc/bytertc_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @hidden + * @brief 该接口为预留接口,还未实现。 + */ + +class IVideoSource; +/** + * + * @type keytype + * @hidden + * @brief 该接口为预留接口,还未实现。 + */ + +class IAudioSource; +/** + * + * @type callback + * @brief 音视频引擎事件回调接口
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +class IRTCEngineEventHandler { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRTCEngineEventHandler() { + } + /** + * + * @type callback + * @brief 发生警告回调。
+ * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。
+ * 你可能需要干预。 + * @param warn 警告标识码,详见:WarningCode{@link #WarningCode} + * @list 引擎管理 + */ + + virtual void onWarning(int warn) { + (void)warn; + } + /** + * + * @type callback + * @brief 发生错误回调。
+ * SDK 运行时出现了网络或媒体相关的错误,且无法自动恢复时触发此回调。 + * @param err 错误标识码,参看 ErrorCode{@link #ErrorCode} + * @list 引擎管理 + */ + + virtual void onError(int err) { + (void)err; + } + /** + * + * @hidden internal use only + * @valid since 3.57 + * @type callback + * @brief 当内部线程发生 block 时,将收到此回调。 + * @param msg block 线程的线程名和 block 检测次数。参看 DeadLockMsg{#DeadLockMsg}。 + * @list Engine Management + */ + + virtual void onDeadLockError(const DeadLockMsg& msg) { + (void)msg; + } + /** + * + * @valid since 3.52 + * @type callback + * @brief 当访问插件失败时,收到此回调。
+ * RTC SDK 将一些功能封装成插件。当使用这些功能时,如果插件不存在,功能将无法使用。 + * @param extension_name 插件名字 + * @param msg 失败说明 + * @list 高级功能 + */ + + virtual void onExtensionAccessError(const char* extension_name, const char* msg) { + + } + /** + * + * @type callback + * @deprecated since 3.54, use onMediaPlayerPlayingProgress{@link #IMediaPlayerEventHandler#onMediaPlayerPlayingProgress} instead. + * @brief 混音音频文件播放进度回调 + * @param mix_id 混音 ID + * @param progress 当前混音音频文件播放进度,单位毫秒 + * @note 调用 setAudioMixingProgressInterval 将时间间隔设为大于 0 的值后,或调用 startAudioMixing 将 AudioMixingConfig 中的时间间隔设为大于 0 的值后,SDK 会按照设置的时间间隔回调该事件。 + * @list 混音 + */ + + virtual void onAudioMixingPlayingProgress(int mix_id, int64_t progress) { + } + /** + * + * @type callback + * @brief 上报日志时回调该事件。 + * @param log_type
+ * 事件类型。目前类型固定为 "live_webrtc_monitor_log"。 + * @param log_content
+ * 端监控日志内容。 + * @list 引擎管理 + */ + + virtual void onLogReport(const char* log_type, const char* log_content) { + (void)log_type; + (void)log_content; + } + /** + * + * @hidden(macOS,Windows,Linux) + * @type callback + * @brief 音频播放设备变化时回调该事件。 + * @param device 变化后的音频播放设备,参看 AudioRoute{@link #AudioRoute}。 + * @list 音频管理 + */ + + virtual void onAudioRouteChanged(AudioRoute route) { + (void)route; + }; + /** + * + * @type callback + * @brief SDK 与信令服务器连接状态改变回调。连接状态改变时触发。 + * @param state 当前 SDK 与信令服务器的连接状态,详见 ConnectionState{@link #ConnectionState}。 + * @note 更多信息参见 [连接状态提示](https: + * @list 网络管理 + */ + + virtual void onConnectionStateChanged(bytertc::ConnectionState state) { + } + /** + * + * @type callback + * @brief SDK 当前网络连接类型改变回调。当 SDK 的当前网络连接类型发生改变时回调该事件。 + * @param type
+ * SDK 当前的网络连接类型,详见:NetworkType{@link #NetworkType} 。 + * @list 网络管理 + */ + + virtual void onNetworkTypeChanged(bytertc::NetworkType type) { + } + /** + * + * @type callback + * @brief 音视频流因网络环境变化等原因发生回退,或从回退中恢复时,触发该回调。 + * @param stream_id 流 ID + * @param stream_info 流信息, 参看 StreamInfo{@link #StreamInfo}。 + * @param event 音视频流发生变化的信息。参看 RemoteStreamSwitch{@link #RemoteStreamSwitch}。 + * @list 网络管理 + */ + + virtual void onSimulcastSubscribeFallback(const char* stream_id, const StreamInfo& stream_info, const bytertc::RemoteStreamSwitch& event) { + (void)stream_id; + (void)stream_info; + (void)event; + } + /** + * + * @type callback + * @brief 本地未通过 setPublishFallbackOption{@link #IRTCEngine#setPublishFallbackOption} 开启发布性能回退,检测到设备性能不足时,收到此回调。
+ * 本地通过 setPublishFallbackOption{@link #IRTCEngine#setPublishFallbackOption} 开启发布性能回退,因设备性能/网络原因,造成发布性能回退/恢复时,收到此回调。 + * @param stream_id 流 ID + * @param stream_info 流信息,参看 StreamInfo{@link #StreamInfo} + * @param mode 指示本地是否开启发布性能回退功能。参看 PerformanceAlarmMode{@link #PerformanceAlarmMode}
+ * - 当发布端未开启发布性能回退时,mode 值为 kPerformanceAlarmModeNormal。 + * - 当发布端开启发布性能回退时,mode 值为 kPerformanceAlarmModeSimulcast。 + * @param room_id 房间 ID
+ * - 未开启发布性能回退时,room_id 为空。 + * - 开启发布性能回退时,room_id 是告警影响的房间 ID。 + * @param reason 告警原因,参看 PerformanceAlarmReason{@link #PerformanceAlarmReason} + * @param data 性能回退相关数据,详见 SourceWantedData{@link #SourceWantedData}。 + * @list 网络管理 + */ + + virtual void onPerformanceAlarms(const char* stream_id, const StreamInfo& stream_info, bytertc::PerformanceAlarmMode mode, + bytertc::PerformanceAlarmReason reason, const bytertc::SourceWantedData& data) { + (void)stream_id; + (void)stream_info; + (void)mode; + (void)reason; + (void)data; + } + /** + * + * @type callback + * @brief 音频设备状态回调。提示音频采集、音频播放等设备的状态。 + * @param device_id 设备 ID。 + * @param device_type 设备类型,详见 RTCAudioDeviceType{@link #RTCAudioDeviceType} + * @param device_state 设备状态,详见 MediaDeviceState{@link #MediaDeviceState} + * @param device_error 设备错误类型,详见 MediaDeviceError{@link #MediaDeviceError} + * @list 音频管理 + */ + + virtual void onAudioDeviceStateChanged(const char* device_id, bytertc::RTCAudioDeviceType device_type, + bytertc::MediaDeviceState device_state, bytertc::MediaDeviceError device_error) { + (void)device_id; + (void)device_type; + (void)device_state; + (void)device_error; + } + /** + * + * @type callback + * @brief 视频设备状态回调。提示摄像头视频采集、屏幕视频采集等设备的状态。 + * @param device_id 设备 ID。采集屏幕共享流时,设备 ID 为固定字符串 `screen_capture_video` + * @param device_type 设备类型,详见 RTCVideoDeviceType{@link #RTCVideoDeviceType} + * @param device_state 设备状态,详见 MediaDeviceState{@link #MediaDeviceState} + * @param device_error 设备错误类型,详见 MediaDeviceError{@link #MediaDeviceError} + * @list 视频管理 + */ + + virtual void onVideoDeviceStateChanged(const char* device_id, bytertc::RTCVideoDeviceType device_type, + bytertc::MediaDeviceState device_state, bytertc::MediaDeviceError device_error) { + (void)device_id; + (void)device_type; + (void)device_state; + (void)device_error; + } + /** + * + * @type callback + * @brief 音频设备警告回调。音频设备包括音频采集设备和音频渲染设备。 + * @param device_id 设备 ID + * @param device_type 详见 RTCAudioDeviceType{@link #RTCAudioDeviceType} + * @param device_warning 详见 MediaDeviceWarning{@link #MediaDeviceWarning} + * @list 音频管理 + */ + + virtual void onAudioDeviceWarning(const char* device_id, bytertc::RTCAudioDeviceType device_type, + bytertc::MediaDeviceWarning device_warning) { + (void)device_id; + (void)device_type; + (void)device_warning; + } + /** + * + * @type callback + * @brief 视频设备警告回调,包括视频采集设备等。 + * @param device_id 设备 ID + * @param device_type 详见 RTCVideoDeviceType{@link #RTCVideoDeviceType} + * @param device_warning 详见 MediaDeviceWarning{@link #MediaDeviceWarning} + * @list 视频管理 + */ + + virtual void onVideoDeviceWarning(const char* device_id, bytertc::RTCVideoDeviceType device_type, + bytertc::MediaDeviceWarning device_warning) { + (void)device_id; + (void)device_type; + (void)device_warning; + } + /** + * + * @type callback + * @brief 周期性(2s)发出回调,报告当前 CPU 与内存的相关信息。 + * @param stats 包含当前 CPU 与内存相关信息的结构体。详见 SysStats{@link #SysStats}。 + * @list 引擎管理 + */ + + virtual void onSysStats(const bytertc::SysStats& stats) { + } + /** + * + * @type callback + * @brief 获取本地录制状态回调。
+ * 该回调由 startFileRecording{@link #IRTCEngine#startFileRecording} 或 stopFileRecording{@link #IRTCEngine#stopFileRecording} 触发。 + * @param video_source 预留参数 + * @param state 录制状态,参看 RecordingState{@link #RecordingState} + * @param error_code 录制错误码,参看 RecordingErrorCode{@link #RecordingErrorCode} + * @param info 录制文件的详细信息,参看 RecordingInfo{@link #RecordingInfo} + * @list 高级功能 + */ + + virtual void onRecordingStateUpdate( + IVideoSource* video_source, RecordingState state, RecordingErrorCode error_code, RecordingInfo info) { + } + /** + * + * @type callback + * @brief 本地录制进度回调。
+ * 该回调由 startFileRecording{@link #IRTCEngine#startFileRecording} 触发,录制状态正常时,系统每秒钟都会通过该回调提示录制进度。 + * @param video_source 预留参数。 + * @param process 录制进度,参看 RecordingProgress{@link #RecordingProgress} + * @param info 录制文件的详细信息,参看 RecordingInfo{@link #RecordingInfo} + * @list 高级功能 + */ + + virtual void onRecordingProgressUpdate(IVideoSource* video_source, RecordingProgress process, RecordingInfo info) { + } + /** + * + * @type callback + * @brief 调用 startAudioRecording{@link #IRTCEngine#startAudioRecording} 或 stopAudioRecording{@link #IRTCEngine#stopAudioRecording} 改变音频文件录制状态时,收到此回调。 + * @param state 录制状态,参看 AudioRecordingState{@link #AudioRecordingState} + * @param error_code 录制错误码,参看 AudioRecordingErrorCode{@link #AudioRecordingErrorCode} + * @list 高级功能 + */ + + virtual void onAudioRecordingStateUpdate(AudioRecordingState state, AudioRecordingErrorCode error_code) { + } + /** + * + * @type callback + * @brief 登录结果回调 + * @param uid
+ * 登录用户 ID + * @param error_code
+ * 登录结果
+ * 详见 LoginErrorCode{@link #LoginErrorCode}。 + * @param elapsed
+ * 从调用 login{@link #IRTCEngine#login} 接口开始到返回结果所用时长
+ * 单位为 ms。 + * @note 调用 login{@link #IRTCEngine#login} 后,会收到此回调。 + * @list 消息 + */ + + virtual void onLoginResult(const char* uid, int error_code, int elapsed) { + (void)uid; + (void)error_code; + (void)elapsed; + } + /** + * + * @type callback + * @brief 登出结果回调 + * @param reason 用户登出的原因,参看 LogoutReason{@link #LogoutReason} + * @note 在以下两种情况下会收到此回调:调用 logout{@link #IRTCEngine#logout} 接口主动退出;或其他用户以相同 UserId 进行 `login` 导致本地用户被动登出。 + * @list 消息 + */ + + virtual void onLogout(LogoutReason reason) { + } + /** + * + * @type callback + * @brief 设置应用服务器参数的返回结果 + * @param error
+ * 设置结果
+ * - 返回 200,设置成功 + * - 返回其他,设置失败,详见 UserMessageSendResult{@link #UserMessageSendResult} + * @note 调用 setServerParams{@link #IRTCEngine#setServerParams} 后,会收到此回调。 + * @list 消息 + */ + + virtual void onServerParamsSetResult(int error) { + (void)error; + } + /** + * + * @type callback + * @brief 查询对端或本端用户登录状态的返回结果 + * @param peer_user_id
+ * 需要查询的用户 ID + * @param status
+ * 查询的用户登录状态
+ * 详见 UserOnlineStatus{@link #UserOnlineStatus}. + * @note 必须先调用 getPeerOnlineStatus{@link #IRTCEngine#getPeerOnlineStatus},才能收到此回调。 + * @list 消息 + */ + + virtual void onGetPeerOnlineStatus(const char* peer_user_id, int status) { + (void)peer_user_id; + (void)status; + } + /** + * + * @type callback + * @brief > 该接口将于 3.64 版本废弃,请使用 onUserMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageReceivedOutsideRoom-2} 代替。 + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 发来的文本消息时,会收到此回调。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + + virtual void onUserMessageReceivedOutsideRoom(const char* uid, const char* message) { + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserBinaryMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserBinaryMessageReceivedOutsideRoom-2} 代替。 + * @brief 收到房间外用户调用 sendUserBinaryMessageOutsideRoom{@link #IRTCEngine#sendUserBinaryMessageOutsideRoom} 发来的二进制消息时,会收到此回调 + * @param uid 消息发送者 ID。 + * @param size 收到的二进制消息长度。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceivedOutsideRoom(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + /** + * + * @type callback + * @brief 给房间外指定的用户发送消息的结果回调。
+ * 当调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 或 sendUserBinaryMessageOutsideRoom{@link #IRTCEngine#sendUserBinaryMessageOutsideRoom} 发送消息后,会收到此回调。 + * @param msgid 本条消息的 ID。
+ * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果。详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @list 消息 + */ + + virtual void onUserMessageSendResultOutsideRoom(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + /** + * + * @type callback + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 发来的文本消息时,会收到此回调。 + * @param msgid 收到的文本消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息的内容。 + * @list 消息 + */ + + virtual void onUserMessageReceivedOutsideRoom(int64_t msgid, const char* uid, const char* message) { + (void)msgid; + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief 当收到来自房间外用户通过 sendUserBinaryMessageOutsideRoom{@link #IRTCEngine#sendUserBinaryMessageOutsideRoom} 发送的二进制消息时,触发此回调。 + * @param msgid 本条消息的 ID。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @param size 二进制消息的长度,单位为字节。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceivedOutsideRoom(int64_t msgid, const char* uid, const uint8_t* message, int size) { + (void)msgid; + (void)uid; + (void)message; + (void)size; + } + /** + * + * @type callback + * @brief 给应用服务器发送消息的回调。 + * @param msgid 本条消息的 ID。
+ * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @param msg 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。消息不超过 64 KB。 + * @note 本回调为异步回调。当调用 sendServerMessage{@link #IRTCEngine#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTCEngine#sendServerBinaryMessage} 接口发送消息后,会收到此回调。 + * @list 消息 + */ + + virtual void onServerMessageSendResult(int64_t msgid, int error, const bytertc::ServerACKMsg& msg) { + (void)msgid; + (void)error; + (void)msg; + } + /** + * + * @type callback + * @brief 收到通过调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 发送带有 SEI 消息的视频帧时,收到此回调。 + * @param stream_id 收到 SEI 消息的视频流 ID + * @param stream_info 包含 SEI 发送者的用户名,所在的房间名和媒体流, 参看 StreamInfo{@link #StreamInfo} + * @param message 收到的 SEI 消息内容 + * @param length 收到的 SEI 消息长度 + * @list 网络管理 + */ + + virtual void onSEIMessageReceived(const char* stream_id, const StreamInfo& stream_info, const uint8_t* message, int length){ + (void)stream_id; + (void)stream_info; + (void)message; + (void)length; + } + /** + * + * @type callback + * @brief 黑帧视频流发布状态回调。
+ * 在语音通话场景下,本地用户调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 通过黑帧视频流发送 SEI 数据时,流的发送状态会通过该回调通知远端用户。
+ * 你可以通过此回调判断携带 SEI 数据的视频帧为黑帧,从而不对该视频帧进行渲染。 + * @param stream_id 收到 SEI 消息的视频流 ID + * @param stream_info 包含 SEI 发送者的用户名,所在的房间名和媒体流, 参看 StreamInfo{@link #StreamInfo} + * @param type 黑帧视频流状态,参看 SEIStreamEventType{@link #SEIStreamEventType} + * @list 消息 + */ + + virtual void onSEIStreamUpdate(const char* stream_id, const StreamInfo& stream_info, SEIStreamEventType type) { + (void)stream_id; + (void)stream_info; + (void)type; + } + + /** + * + * @hidden for internal use only + * @type callback + * @region 音频管理 + * @brief 音乐场景检测结果回调。
+ * 调用 enableAudioAEDReport{@link #IRTCEngine#enableAudioAEDReport} 后,根据设置的interval值,本地会周期性地收到此回调
+ * @param state 音乐场景检测结果,参看 AudioAEDType{@link #AudioAEDType}。 + * @list 音频管理 + */ + + virtual void onAudioAEDStateUpdate(const AudioAEDType state) { + (void)state; + } + + /** + * + * @type callback + * @brief 远端用户进房后,本地调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport},根据设置的 interval 值,本地会周期性地收到此回调,了解订阅的远端用户的瞬时音频信息。
+ * 远端用户的音频包括使用 RTC SDK 内部机制/自定义机制采集的麦克风音频和屏幕音频。 + * @param audio_properties_infos 远端音频信息,其中包含音频流属性、房间 ID、用户 ID ,详见 RemoteAudioPropertiesInfo{@link #RemoteAudioPropertiesInfo}。 + * @param audio_properties_info_number 数组长度 + * @param total_remote_volume 所有订阅的远端流混音后的音量,范围是 [0,255]。
+ * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @list 音频管理 + */ + + virtual void onRemoteAudioPropertiesReport(const RemoteAudioPropertiesInfo* audio_properties_infos, int audio_properties_info_number, int total_remote_volume) { + (void)audio_properties_infos; + (void)audio_properties_info_number; + (void)total_remote_volume; + } + /** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport} 后,根据设置的 interval 值,你会周期性地收到此回调,了解本地音频的瞬时相关信息。
+ * 本地音频包括使用 RTC SDK 内部机制采集的麦克风音频,屏幕音频和本地混音音频信息。 + * @param audio_properties_infos 本地音频信息,详见 LocalAudioPropertiesInfo{@link #LocalAudioPropertiesInfo}。本地音量可通过 setAudioCaptureDeviceVolume{@link #IAudioDeviceManager#setAudioCaptureDeviceVolume} 设置。 + * @param audio_properties_info_number 数组长度 + * @list 音频管理 + */ + + virtual void onLocalAudioPropertiesReport(const LocalAudioPropertiesInfo * audio_properties_infos, int audio_properties_info_number) { + (void)audio_properties_infos; + (void)audio_properties_info_number; + } + /** + * + * @hidden for internal use only + * @type callback + * @brief 音量调节前的音量大小 + * @list Audio Management + */ + + virtual void onRemoteAudioPropertiesReportEx(const RemoteAudioPropertiesInfo* audio_properties_infos, int audio_properties_info_number) { + (void)audio_properties_infos; + (void)audio_properties_info_number; + } + + /** + * + * @hidden for internal use only + * @type callback + * @region 音频管理 + * @brief 人声检测结果回调。
+ * 调用 enableAudioVADReport{@link #IRTCEngine#enableAudioVADReport} 后,根据设置的interval值,本地会周期性地收到此回调
+ * @param state 人声检测结果,参看 AudioVADType{@link #AudioVADType}。 + * @list 音频管理 + */ + + virtual void onAudioVADStateUpdate(AudioVADType state) { + (void)state; + } + /** + * + * @type callback + * @brief 回调音频设备测试时的播放音量 + * @param volume 音频设备测试播放音量。取值范围:[0,255] + * @note 调用 startAudioPlaybackDeviceTest{@link #IAudioDeviceManager#startAudioPlaybackDeviceTest} 或 startAudioDeviceRecordTest{@link #IAudioDeviceManager#startAudioDeviceRecordTest},开始播放音频文件或录音时,将开启该回调。本回调为周期性回调,回调周期由上述接口的 `interval` 参数指定。 + * @list 音频管理 + */ + + virtual void onAudioPlaybackDeviceTestVolume(int volume) { + (void)volume; + } + /** + * + * @hidden(Android,iOS) + * @type callback + * @brief 音频设备音量改变回调。当通过系统设置,改变音频设备音量或静音状态时,触发本回调。本回调无需手动开启。 + * @param device_type 设备类型,包括麦克风和扬声器,参阅 RTCAudioDeviceType{@link #RTCAudioDeviceType}。 + * @param volume 音量值,[0, 255]。当 volume 变为 0 时,muted 会变为 True。注意:在 Windows 端,当麦克风 volume 变为 0 时,muted 值不变。 + * @param muted 是否禁音状态。扬声器被设置为禁音时,muted 为 True,但 volume 保持不变。 + * @list 音频管理 + */ + + virtual void onAudioDeviceVolumeChanged(bytertc::RTCAudioDeviceType device_type, int volume, bool muted) { + (void)device_type; + (void)volume; + (void)muted; + } + /** + * + * @type callback + * @brief 本地音频流的状态发生改变时,收到此回调。 + * @param audio_source 本地音频流对象,详见:IAudioSource{@link #IAudioSource} + * @param state 本地音频流的状态,详见: LocalAudioStreamState{@link #LocalAudioStreamState} + * @param error 本地音频状态改变时的错误码,详见:LocalAudioStreamError{@link #LocalAudioStreamError} + * @list 音频管理 + */ + + virtual void onLocalAudioStateChanged(IAudioSource* audio_source, LocalAudioStreamState state, LocalAudioStreamError error) { + (void)audio_source; + (void)state; + (void)error; + } + /** + * + * @type callback + * @brief 房间内的用户调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 开启音频采集时,房间内其他用户会收到此回调。 + * @param stream_id 开启音频采集的远端用户发布的流 ID + * @param stream_info 开启音频采集的远端流信息,详见 StreamInfo{@link #StreamInfo} + * @list 音频管理 + */ + + virtual void onUserStartAudioCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 房间内的用户调用 stopAudioCapture{@link #IRTCEngine#stopAudioCapture} 关闭音频采集时,房间内其他用户会收到此回调。 + * @param stream_id 关闭音频采集的远端用户发布的流 ID + * @param stream_info 关闭音频采集的远端流信息,详见 StreamInfo{@link #StreamInfo} + * @list 音频管理 + */ + + virtual void onUserStopAudioCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport} 后,根据设置的 `config.interval`,你会周期性地收到此回调,获取房间内的最活跃用户信息。 + * @param room_id 房间 ID + * @param uid 最活跃用户(ActiveSpeaker)的用户 ID + * @list 音频管理 + */ + + virtual void onActiveSpeaker(const char* room_id, const char* uid) { + (void)room_id; + (void)uid; + } + /** + * + * @type callback + * @brief 音频流同步信息回调。可以通过此回调,在远端用户调用 sendStreamSyncInfo{@link #IRTCEngine#sendStreamSyncInfo} 发送音频流同步消息后,收到远端发送的音频流同步信息。 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息,详见 StreamInfo{@link #StreamInfo}。 + * @param stream_type 媒体流类型,详见 SyncInfoStreamType{@link #SyncInfoStreamType} 。 + * @param data 消息内容。 + * @param length 消息长度。 + * @list 音频管理 + */ + + virtual void onStreamSyncInfoReceived(const char* stream_id, const StreamInfo& stream_info, SyncInfoStreamType stream_type, + const uint8_t* data, int32_t length) { + (void)stream_id; + (void)stream_info; + (void)stream_type; + (void)data; + (void)length; + } + /** + * + * @type callback + * @brief 通话前网络探测结果。
+ * 成功调用 startNetworkDetection{@link #IRTCEngine#startNetworkDetection} 接口开始探测后,会在 3s 内首次收到该回调,之后每 2s 收到一次该回调。 + * @param type 探测网络类型为上行/下行 + * @param quality 探测网络的质量,参看 NetworkQuality{@link #NetworkQuality}。 + * @param rtt 探测网络的 RTT,单位:ms + * @param lost_rate 探测网络的丢包率 + * @param bitrate 探测网络的带宽,单位:kbps + * @param jitter 探测网络的抖动,单位:ms + * @list 网络管理 + */ + + virtual void onNetworkDetectionResult(NetworkDetectionLinkType type, NetworkQuality quality, int rtt, double lost_rate, + int bitrate, int jitter){ + (void)type; + (void)quality; + (void)rtt; + (void)lost_rate; + (void)bitrate; + (void)jitter; + } + /** + * + * @type callback + * @brief 通话前网络探测结束
+ * 以下情况将停止探测并收到一次本回调:
+ * 1. 当调用 stopNetworkDetection{@link #IRTCEngine#stopNetworkDetection} 接口停止探测后,会收到一次该回调;
+ * 2. 当收到远端/本端音频首帧后,停止探测;
+ * 3. 当探测超过 3 分钟后,停止探测;
+ * 4. 当探测链路断开一定时间之后,停止探测。 + * @param reason
+ * 停止探测的原因类型,参考 NetworkDetectionStopReason{@link #NetworkDetectionStopReason} + * @list 网络管理 + */ + + virtual void onNetworkDetectionStopped(NetworkDetectionStopReason reason){ + (void)reason; + } + /** + * + * @type callback + * @brief 房间内的可见用户调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部视频采集时,房间内其他用户会收到此回调。 + * @param stream_id 视频流 ID + * @param stream_info 视频流信息,详见 StreamInfo{@link #StreamInfo}。 + * @list 视频管理 + */ + + virtual void onUserStartVideoCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 房间内的可见用户调用 stopVideoCapture{@link #IRTCEngine#stopVideoCapture} 关闭内部视频采集时,房间内其他用户会收到此回调。
+ * 若发布视频数据前未开启采集,房间内所有可见用户会收到此回调。 + * @param stream_id 视频流 ID + * @param stream_info 视频流信息,详见 StreamInfo{@link #StreamInfo}。 + * @list 视频管理 + */ + + virtual void onUserStopVideoCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 本地视频大小或旋转信息发生改变时,收到此回调。 + * @param video_source 预留参数。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @list 音视频传输 + */ + + virtual void onLocalVideoSizeChanged(IVideoSource* video_source, const VideoFrameInfo& info) { + (void)video_source; + (void)info; + } + /** + * + * @type callback + * @brief 远端视频大小或旋转信息发生改变时,房间内订阅此视频流的用户会收到此回调。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @list 音视频传输 + */ + + virtual void onRemoteVideoSizeChanged(const char* stream_id, const StreamInfo& stream_info, const VideoFrameInfo& info) { + (void)stream_id; + (void)stream_info; + (void)info; + } + /** + * + * @type callback + * @brief RTC SDK 在本地完成第一帧视频帧或屏幕视频帧采集时,收到此回调。 + * @param video_source 视频源对象。参看 IVideoSource{@link #IVideoSource}。 + * @param info 视频信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @note 对于采集到的本地视频帧,你可以调用 setLocalVideoCanvas{@link #IRTCEngine#setLocalVideoCanvas} 或 setLocalVideoSink{@link #IRTCEngine#setLocalVideoSink} 在本地渲染。 + * @list 音视频传输 + */ + + virtual void onFirstLocalVideoFrameCaptured(IVideoSource* video_source, const VideoFrameInfo& info) { + (void)video_source; + (void)info; + } + /** + * + * @type callback + * @brief 订阅端接收并解码远端音频流首帧时,收到此回调。包含以下情况:
+ * 1. 发布端发布音频,包含首次发布和取消后再次发布。取消发布还包括发布端主动退房后或掉线。
+ * 2. 发布端关闭音频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
+ * 3. 发布端发布音频后,订阅端取消订阅音频后,又再次订阅音频。 + * @param stream_id 远端音频流 ID。 + * @param stream_info 远端音频流信息,参看 StreamInfo{@link #StreamInfo}。 + * @note + * - 用户刚收到房间内每一路音频流时,都会收到该回调。 + * - 摄像头流、屏幕流,内部采集、外部源、自动订阅和手动订阅的音频流,都符合上述策略。 + * @list 音视频传输 + */ + + virtual void onFirstRemoteAudioFrame(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 用户订阅来自远端的音频流状态发生改变时,会收到此回调,了解当前的远端音频流状态。 + * @param stream_id 远端音频流 ID。 + * @param stream_info 远端音频流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param state 远端音频流状态,参看 RemoteAudioState{@link #RemoteAudioState} + * @param reason 远端音频流状态改变的原因,参看 RemoteAudioStateChangeReason{@link #RemoteAudioStateChangeReason} + * @list 音视频传输 + */ + + virtual void onRemoteAudioStateChanged( + const char* stream_id, const StreamInfo& stream_info, RemoteAudioState state, RemoteAudioStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + /** + * + * @type callback + * @brief 本地视频流的状态发生改变时,收到该事件。 + * @param video_source 本地视频流对象。参看 IVideoSource{@link #IVideoSource}。 + * @param state 本地视频流状态,参看 LocalVideoStreamState{@link #LocalVideoStreamState} + * @param error 本地视频状态改变时的错误码,参看 LocalVideoStreamError{@link #LocalVideoStreamError} + * @list 视频管理 + */ + + virtual void onLocalVideoStateChanged(IVideoSource* video_source, LocalVideoStreamState state, LocalVideoStreamError error) { + (void)video_source; + (void)state; + (void)error; + } + /** + * + * @type callback + * @brief 远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息,包括房间 ID、用户 ID、流属性,等。参看 StreamInfo{@link #StreamInfo}。 + * @param state 远端视频流状态,参看 RemoteVideoState{@link #RemoteVideoState}。 + * @param reason 远端视频流状态改变的原因,参看 RemoteVideoStateChangeReason{@link #RemoteVideoStateChangeReason}。 + * @note 本回调仅适用于主流,不适用于屏幕流。 + * @list 音视频传输 + */ + + virtual void onRemoteVideoStateChanged( + const char* stream_id, const StreamInfo& stream_info, RemoteVideoState state, RemoteVideoStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type callback + * @brief 远端视频流的超分状态发生改变时,房间内订阅此流的用户会收到该回调。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息,包括房间 ID、用户 ID、流属性,等。参看 StreamInfo{@link #StreamInfo}。 + * @param mode 超分模式,参看 VideoSuperResolutionMode{@link #VideoSuperResolutionMode}。 + * @param reason 超分模式改变原因,参看 VideoSuperResolutionModeChangedReason{@link #VideoSuperResolutionModeChangedReason}。 + * @list 视频处理 + */ + + virtual void onRemoteVideoSuperResolutionModeChanged( + const char* stream_id, const StreamInfo& stream_info, VideoSuperResolutionMode mode, VideoSuperResolutionModeChangedReason reason) { + (void)stream_id; + (void)stream_info; + (void)mode; + (void)reason; + } + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type callback + * @brief 降噪模式状态变更回调。当降噪模式的运行状态发生改变,SDK 会触发该回调,提示用户降噪模式改变后的运行状态及状态发生改变的原因。 + * @param mode 视频降噪模式,参看 VideoDenoiseMode{@link #VideoDenoiseMode}。 + * @param reason 视频降噪模式改变的原因,参看 VideoDenoiseModeChangedReason{@link #VideoDenoiseModeChangedReason}。 + * @list 视频处理 + */ + + virtual void onVideoDenoiseModeChanged(VideoDenoiseMode mode, VideoDenoiseModeChangedReason reason) { + (void)mode; + (void)reason; + } + /** + * + * @type callback + * @brief 本地音频首帧发送状态发生改变时,收到此回调。 + * @param stream_id 音频发布用户所在的房间 ID + * @param stream_info 音频流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 本地用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧发送状态,详见 FirstFrameSendState{@link #FirstFrameSendState} + * @list 音视频传输 + */ + + virtual void onAudioFrameSendStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFrameSendState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief 本地视频首帧发送状态发生改变时,收到此回调。 + * @param stream_id 流 ID。 + * @param stream_info 视频流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 本地用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧发送状态,详见 FirstFrameSendState{@link #FirstFrameSendState} + * @list 音视频传输 + */ + + virtual void onVideoFrameSendStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFrameSendState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief SDK 内部渲染成功远端视频流首帧后,收到此回调。包含以下情况:
+ * 1. 发布端首次发布视频
+ * 2. 在 1 条件下,发布端取消发布视频后,再次发布视频
+ * 3. 在 1 条件下,发布端关闭视频采集后,再次打开采集(或使用外部源时,停止推流后再次推流)
+ * 4. 在 1 条件下,订阅端取消订阅视频后,再次订阅视频(调用接口包括 subscribeAllStreamsVideo{@link #IRTCRoom#subscribeallstreamsVideo},pauseAllSubscribedStreamVideo{@link #IRTCRoom#pauseAllSubscribedStreamVideo}/resumeAllSubscribedStreamVideo{@link #IRTCRoom#resumeAllSubscribedStreamVideo}) + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @note 仅在采用内部渲染时,符合上述策略。 + * @list 音视频传输 + */ + + virtual void onFirstRemoteVideoFrameRendered(const char* stream_id, const StreamInfo& stream_info, const VideoFrameInfo& info) { + (void)stream_id; + (void)stream_info; + (void)info; + } + /** + * + * @type callback + * @brief 订阅端接收并解码远端视频流首帧时,收到此回调。包含以下情况:
+ * 1. 发布端发布视频,包含首次发布和取消后再次发布。取消发布还包括发布端主动退房后或掉线。
+ * 2. 发布端关闭视频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
+ * 3. 发布端发布视频后,订阅端取消订阅视频后,又再次订阅视频。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @note + * - 用户刚收到房间内订阅的每一路视频流时,都会收到该回调。 + * - 摄像头流、屏幕流,内部采集、外部源,自动订阅和手动订阅的视频流,都符合上述策略。 + * @list 音视频传输 + */ + + virtual void onFirstRemoteVideoFrameDecoded(const char* stream_id, const StreamInfo& stream_info, const VideoFrameInfo& info) { + (void)stream_id; + (void)stream_info; + (void)info; + } + /** + * + * @type callback + * @brief 音频首帧播放状态发生改变时,收到此回调。 + * @param stream_id 音频首帧播放状态发生改变的流 ID + * @param stream_info 音频首帧播放状态发生改变的流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 远端用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧播放状态,详见 FirstFramePlayState{@link #FirstFramePlayState} + * @list 音视频传输 + */ + + virtual void onAudioFramePlayStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFramePlayState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief 远端视频流的首帧播放状态改变时,收到此回调。 + * @param stream_id 视频首帧播放状态发生改变的流 ID + * @param stream_info 视频首帧播放状态发生改变的流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 远端用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧播放状态,详见 FirstFramePlayState{@link #FirstFramePlayState} + * @list 音视频传输 + */ + + virtual void onVideoFramePlayStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFramePlayState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief 发布音频流时,采集到第一帧音频帧,收到该回调。 + * @param audio_source 音频源,详见 IAudioSource{@link #IAudioSource}。 + * @note 如果发布音频流时,未开启本地音频采集,SDK 会推送静音帧,也会收到此回调。 + * @list 音视频传输 + */ + + virtual void onFirstLocalAudioFrame(IAudioSource* audio_source) { + (void)audio_source; + } + /** + * + * @deprecated since 3.60, use onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent} instead. + * @type callback + * @hidden(Linux) + * @brief WTN 流发布结果回调。
+ * 调用 startPushMixedStream 接口发布 WTN 流后,启动结果通过此回调方法通知用户。 + * @param room_id WTN 流的发布房间的 ID + * @param public_streamid WTN 流 ID + * @param error_code WTN 流发布结果状态码。详见 PublicStreamErrorCode{@link #PublicStreamErrorCode} + * @list 音视频传输 + * @order 24 + */ + + virtual void onPushPublicStreamResult(const char* room_id, const char* public_streamid, PublicStreamErrorCode error_code) { + (void)room_id; + (void)public_streamid; + (void)error_code; + } + + /** + * + * @type callback + * @brief 调用 startCloudProxy{@link #IRTCEngine#startCloudProxy} 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。 + * @param interval 从开启云代理到连接成功经过的时间,单位为 ms + * @list 通话加密 + */ + + virtual void onCloudProxyConnected(int interval) { + (void)interval; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 关于音视频回路测试结果的回调。 + * @param result 测试结果,参看 EchoTestResult{@link #EchoTestResult} + * @note 该回调触发的时机包括:
+ * - 检测过程中采集设备发生错误时; + * - 检测成功后; + * - 非设备原因导致检测过程中未接收到音/视频回放,停止检测后。 + * @list 网络管理 + */ + + virtual void onEchoTestResult(EchoTestResult result) { + (void)result; + }; + /** + * + * @hidden for internal use only + * @type callback + * @brief 音频 dump 状态改变回调 + * @param status 音频 dump 状态,参见 AudioDumpStatus{@link #AudioDumpStatus} + * @note 本回调用于内部排查音质相关异常问题,开发者无需关注。 + * @list Network Processing + */ + + virtual void onAudioDumpStateChanged(AudioDumpStatus status) { + (void)status; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 首次调用 getNetworkTimeInfo{@link #IRTCEngine#getNetworkTimeInfo} 后,SDK 内部启动网络时间同步,同步完成时会触发此回调。 + * @list 网络管理 + */ + + virtual void onNetworkTimeSynchronized() { + } + /** + * + * @hidden internal use only + * @type callback + * @brief license 过期提醒。在剩余天数低于 30 天时,收到此回调。 + * @param days license 剩余有效天数 + * @list Network Processing + */ + + virtual void onLicenseWillExpire(int days) { + (void)days; + } + /** + * + * @type callback + * @brief AIGC(AI 音视频互动方案)使用 License 计费的场景下,当 License 配额用尽时,会收到该回调。收到该回调时,AIGC 服务会中止,请及时续费,并且建议离开房间、销毁 SDK。 + * @param message 回调消息 + * @list 高级功能 + */ + + virtual void onLicenseQuotaExceeded(const char* message) { + (void)message; + } + /** + * + * @hidden + * @type callback + * @brief 外部采集时,调用 setOriginalScreenVideoInfo设置屏幕或窗口大小改变前的分辨率后,若屏幕采集模式为智能模式,你将收到此回调,根据 RTC 智能决策合适的帧率和分辨率积(宽*高)重新采集。 + * @param frame_update_info RTC 智能决策后合适的帧率和分辨率积(宽*高)。参看 FrameUpdateInfo{@link #FrameUpdateInfo}。 + * @list 屏幕共享 + */ + + virtual void onExternalScreenFrameUpdate(FrameUpdateInfo frame_update_info) { + (void)frame_update_info; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 通话前回声检测结果回调。 + * @param hardware_echo_detection_result 参见 HardwareEchoDetectionResult{@link #HardwareEchoDetectionResult} + * @note + * - 通话前调用 startHardwareEchoDetection{@link #IRTCEngine#startHardwareEchoDetection} 后,将触发本回调返回检测结果。 + * - 建议在收到检测结果后,调用 stopHardwareEchoDetection{@link #IRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * - 如果 SDK 在通话中检测到回声,将通过 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调 `kMediaDeviceWarningDetectLeakEcho`。 + * @list 音频管理 + */ + + virtual void onHardwareEchoDetectionResult(HardwareEchoDetectionResult hardware_echo_detection_result) { + (void)hardware_echo_detection_result; + } + /** + * + * @type callback + * @brief 本地代理状态发生改变回调。调用 setLocalProxy{@link #IRTCEngine#setLocalProxy} 设置本地代理后,SDK 会触发此回调,返回代理连接的状态。 + * @param local_proxy_type 本地代理类型。参看 LocalProxyType{@link #LocalProxyType}。 + * @param local_proxy_state 本地代理状态。参看 LocalProxyState{@link #LocalProxyState}。 + * @param local_proxy_error 本地代理错误。参看 LocalProxyError{@link #LocalProxyError}。 + * @list 通话加密 + */ + + virtual void onLocalProxyStateChanged(LocalProxyType local_proxy_type, LocalProxyState local_proxy_state, LocalProxyError local_proxy_error) { + (void)local_proxy_type; + (void)local_proxy_state; + (void)local_proxy_error; + } + /** + * + * @hidden internal use only + * @type callback + * @brief 当特效设置失败时,收到此回调。 + * @param error 特效错误类型。参看 EffectErrorType{@link #EffectErrorType}。 + * @param msg 错误信息。 + * @list Encryption + */ + + virtual void onEffectError(EffectErrorType error, const char* msg) { + (void)error; + (void)msg; + } + /** + * + * @hidden for internal use only + * @type callback + * @brief SDK 远端视频渲染发生错误时收到此回调 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param error 渲染错误类型。参看 RenderError{@link #RenderError}。 + * @param message 错误信息。 + * @note 本回调暂时仅内部使用,开发者无需关注。 + * @list 视频管理 + */ + + virtual void onRemoteRenderError(const char* stream_id, const StreamInfo& stream_info, RenderError error, const char* message) { + (void)stream_id; + (void)stream_info; + (void)error; + (void)message; + } + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该回调替代了 `onStreamMixingEvent` 和 `onPushPublicStreamResult` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此回调。 + * @type callback + * @brief 合流转推 CDN / WTN 流状态回调 + * @param info 任务详情,参看 MixedStreamTaskInfo{@link #MixedStreamTaskInfo}。 + * @param event 任务事件,参看 MixedStreamTaskEvent{@link #MixedStreamTaskEvent}。 + * @param error_code 任务错误码,参看 MixedStreamTaskErrorCode{@link #MixedStreamTaskErrorCode} + * @list CDN 推流 + */ + + virtual void onMixedStreamEvent(MixedStreamTaskInfo info, MixedStreamTaskEvent event, MixedStreamTaskErrorCode error_code) { + (void)info; + (void)event; + (void)error_code; + } + /** + * + * @valid since 3.60. + * @type callback + * @hidden(Linux) + * @brief 单流转推 CDN 状态回调 + * @param task_id 任务 ID + * @param event 任务状态, 参看 SingleStreamTaskEvent{@link #SingleStreamTaskEvent} + * @param error_code 错误码,参看 SingleStreamTaskErrorCode{@link #SingleStreamTaskErrorCode} + * @list CDN 推流 + */ + + virtual void onSingleStreamEvent(const char *task_id, SingleStreamTaskEvent event, SingleStreamTaskErrorCode error_code) { + (void)task_id; + (void)event; + (void)error_code; + } + /** + * + * @hidden internal use only + * @valid since 3.60. + * @type callback + * @brief 试验性接口回调 + * @param param 回调内容(JSON string) + * @list 引擎管理 + */ + + virtual void onExperimentalCallback(const char* param) { + (void)param; + } + + /** + * + * @valid since 3.60. + * @hidden(Linux) + * @type callback + * @brief 调用 takeLocalSnapshotToFile{@link #IRTCEngine#takeLocalSnapshotToFile} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param video_source 被截图的视频流,参看 IVideoSource{@link #IVideoSource}。 + * @param file_path 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param error_code 截图错误码。请参看 SnapshotErrorCode{@link #SnapshotErrorCode}。 + * @param task_id 截图任务的编号,和 takeLocalSnapshotToFile{@link #IRTCEngine#takeLocalSnapshotToFile} 的返回值一致。 + * @list 高级功能 + */ + + virtual void onLocalSnapshotTakenToFile(IVideoSource* video_source, const char* file_path, int width, int height, SnapshotErrorCode error_code, long task_id) { + (void)video_source; + (void)file_path; + (void)width; + (void)height; + (void)error_code; + (void)task_id; + } + + /** + * + * @type callback + * @hidden(Linux) + * @valid since 3.60. + * @brief 调用 takeRemoteSnapshotToFile{@link #IRTCEngine#takeRemoteSnapshotToFile} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param stream_id 被截图的视频流 ID。 + * @param stream_info 被截图的视频流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param file_path 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param error_code 截图错误码。请参看 SnapshotErrorCode{@link #SnapshotErrorCode}。 + * @param task_id 截图任务的编号,和 takeRemoteSnapshotToFile{@link #IRTCEngine#takeRemoteSnapshotToFile} 的返回值一致。 + * @list 高级功能 + */ + + virtual void onRemoteSnapshotTakenToFile(const char* stream_id, const StreamInfo& stream_info, const char* file_path, int width, int height, SnapshotErrorCode error_code, long task_id) { + (void)stream_id; + (void)stream_info; + (void)file_path; + (void)width; + (void)height; + (void)error_code; + (void)task_id; + } + +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine_ex.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine_ex.h new file mode 100644 index 0000000..3d78b82 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_engine_ex.h @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface Lite + */ + +#pragma once + +#include "bytertc_engine.h" +#include "rtc/bytertc_defines.h" +#include "rtc/bytertc_video_defines_ex.h" +#include "bytertc_engine_event_handler.h" + +namespace bytertc { + +/** + * + * @hidden + */ +class IRTCRoomEx; +/** + * + * @hidden + */ +class IVideoSource; +/** + * + * @hidden + */ +class IPublisher; +/** + * + * @type api + * @brief IRTCEngineEx class + */ +class IRTCEngineEx : public IRTCEngine { +public: + /** + * + * @type api + * @brief 创建 IRTCRoomEx{@link #IRTCRoomEx} 实例。
+ * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom{@link #IRTCRoom#joinRoom} 才能真正地创建/加入房间。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTCRoomEx{@link #IRTCRoomEx} 房间实例。 + * @note 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + */ + virtual IRTCRoomEx* createRTCRoomEx(const char* room_id) = 0; + /** + * + * @type api + * @brief 设置视频源的相关配置。 + * @param stream_index 源对应的流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param config 参看 VideoSourceConfig{@link #VideoSourceConfig}。 + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setVideoSource(StreamIndex stream_index, const VideoSourceConfig& config) = 0; + /** + * + * @type api + * @brief 推送外部视频帧。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param frame 设置视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @return 方法调用结果:
+ * + 0:成功;
+ * + <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * + 支持格式:I420, NV12, RGBA, BGRA, ARGB
+ * + 该函数运行在用户调用线程内
+ * + 推送外部视频帧前,必须调用 setVideoSource{@link #IRTCEngineEx#setVideoSource} 开启外部视频源采集。 + */ + virtual int pushExternalVideoFrame(StreamIndex stream_index, const VideoFrameData& frame) = 0; + /** + * + * @type api + * @brief 设置流的优先级。
+ * 在网络条件有限的情况下,优先保障高优先级视频流的清晰度和流畅度,优先保障高优先级流的音频流畅度和音质。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param priority 参看 StreamPriority{@link #StreamPriority}。 + */ + virtual int setLocalStreamPriority(StreamIndex stream_index, StreamPriority priority) = 0; + /** + * + * @type api + * @brief 立即开启内部视频采集。默认为关闭状态。
+ * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
+ * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
+ * 本地用户在非隐身状态下调用该方法后,房间中的其他用户会收到 onUserStartVideoCapture{@link #IRTCEngineEventHandler#onUserStartVideoCapture} 的回调。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param device_id 设备 ID + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 调用 stopVideoCapture{@link #IRTCEngineEx#stopVideoCapture} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。
+ * + 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。
+ * + 如果需要从自定义视频采集切换为内部视频采集,你必须先关闭自定义采集,再调用此方法手动开启内部采集。 + */ + virtual int startVideoCapture(StreamIndex stream_index, const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 立即关闭内部视频采集。默认为关闭状态。
+ * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
+ * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
+ * 非隐身用户进房后调用该方法,房间中的其他用户会收到 onUserStopVideoCapture{@link #IRTCEngineEventHandler#onUserStopVideoCapture} 的回调。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 可以开启内部视频采集。
+ * + 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + */ + virtual int stopVideoCapture(StreamIndex stream_index) = 0; + /** + * + * @type api + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
+ * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数,包括模式、分辨率、帧率。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param video_capture_config 视频采集参数。参看: VideoCaptureConfig{@link #VideoCaptureConfig}。 + * @return + * + 0: 成功;
+ * + < 0: 失败; + * @note + * + 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture{@link #IRTCEngineEx#startVideoCapture} 前调用本接口。
+ * + 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + */ + virtual int setVideoCaptureConfig(StreamIndex stream_index, const VideoCaptureConfig& video_capture_config) = 0; + + /** + * + * @type api + * @brief 设置音频源的整体音量。 + * @param stream_index 音频源对应的流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
+ * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。
+ * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setAudioSourceVolume(StreamIndex stream_index, int volume) = 0; + /** + * + * @type api + * @brief 设置音频源的内容。单个音频源的内容可以包含一个或多个原始音频来源。 + * @param stream_index 音频源对应的流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param config 内容构成。参看 AudioContentTypeConfig{@link #AudioContentTypeConfig}。 + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setAudioContentType(StreamIndex stream_index, const AudioContentTypeConfig& config) = 0; + /** + * + * @type api + * @brief 设置音频流的编码配置。 + * @param stream_index 音频流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param config 编码设置。参看 AudioEncodeConfig{@link #AudioEncodeConfig}。 + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setAudioEncodeConfig(StreamIndex stream_index, const AudioEncodeConfig& config) = 0; + + + /** + * + * @type api + * @brief 设置多路流编码配置,在开启simulcast功能下可同时设置4路分辨率的流 + * @param stream_index 视频频流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param solutions 编码设置。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。 + * @param solution_num 需要传入的solutions数组大小。 + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setVideoEncoderConfig(StreamIndex stream_index, const VideoEncoderConfig* solutions, + int solution_num) = 0; + + /** + * + * @type api + * @brief 创建 IRTCEngineEx 实例。
+ * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
+ * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param event_handler SDK 回调给应用层的 Callback 对象,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} 。 + * @return IRTCEngineEx:创建成功。返回一个可用的 IRTCEngineEx{@link #IRTCEngineEx} 实例 + */ + static BYTERTC_STATIC_API IRTCEngineEx* createRTCEngineEx(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + + /** +* +* @type api +* @brief 创建 IRTCEngineEx 实例。
+* 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
+* 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新的引擎实例。 +* @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} +* @param event_handler SDK 回调给应用层的 Callback 对象,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} 。 +* @return IRTCEngineEx:创建成功。返回一个可用的 IRTCEngineEx{@link #IRTCEngineEx} 实例 +*/ + static BYTERTC_STATIC_API IRTCEngineEx* createRTCEngineExMulti(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + + /** + * + * @type api + * @brief 销毁由 IRTCEngineEx 实例,并释放所有相关资源。 + * @note + * + 请确保和需要销毁的 IRTCEngineEx 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 IRTCEngineEx 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 IRTCEngineEx 实例相关的内存,并且停止与媒体服务器的任何交互。
+ * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ + static BYTERTC_STATIC_API void destroyRTCEngineEx(); + + /** + * + * @hidden internal use only + * @type apx + * @brief 销毁由 createRTCEngineExMulti{@link #IRTCEngine#createRTCEngineExMulti} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 IRTCEngineEx{@link #IRTCEngineEx} 实例相关的业务场景全部结束后,才调此方法 + * - 该方法在调用之后,会销毁所有和此 IRTCEngineEx{@link #IRTCEngineEx} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * @list 引擎管理 + */ + static BYTERTC_STATIC_API void destroyRTCEngineExMulti(IRTCEngineEx* instance_multi); +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_game_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_game_room.h new file mode 100644 index 0000000..95c9a6b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_game_room.h @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2024 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_video_effect_interface.h" +#include "rtc/bytertc_defines.h" +#include "bytertc_room_event_handler.h" +#include "rtc/bytertc_range_audio_interface.h" +#include "rtc/bytertc_spatial_audio_interface.h" +#include "rtc/bytertc_panoramic_video_interface.h" +namespace bytertc { +/** + * + * @type api + * @brief 游戏房间接口 + */ + +class IGameRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IGameRoom() { + } + /** + * + * @type api + * @brief 退出并销毁调用 createGameRoom{@link #IRTCEngine#createGameRoom} 所创建的游戏房间实例。 + * @list 房间管理 + */ + + virtual void destroy() = 0; + /** + * + * @type api + * @brief 加入游戏房间。
+ * 调用 createGameRoom{@link #IRTCEngine#createGameRoom} 创建房间实例后,调用此方法加入房间,同房间内其他用户进行音频通话。 + * @param token 动态密钥,用于对登录用户进行鉴权验证。
+ * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在您的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
+ * - 使用不同 App ID 的 App 是不能互通的。 + * - 请务必保证生成 Token 使用的 App ID 和创建引擎时使用的 App ID 相同,否则会导致加入房间失败。 + * @param user_info 用户信息,参看 UserInfo{@link #UserInfo}。 + * @return + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + * - 如果本端用户为可见用户,房间内其他用户收到 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 回调通知。 + * - -1:room_id/user_info.uid 包含了无效的参数。 + * - -2:已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #IGameRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调告知。 + * @note + * - 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 onConnectionStateChanged{@link #IRTCEngineEventHandler#onConnectionStateChanged} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知。 + * @list 房间管理 + */ + + virtual int joinRoom(const char* token, const UserInfo& user_info) = 0; + /** + * + * @type api + * @brief 离开游戏房间。
+ * 调用此方法结束通话过程,并释放所有通话相关的资源。 + * @return + * - 0: 调用成功。如果用户是房间内可见用户,远端用户收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调通知。 + * - < 0: 调用失败,参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 + * - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知。你必须在收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调后,再销毁房间或引擎,或调用 joinRoom{@link #IGameRoom#joinRoom} 再次加入房间。 + * @list 房间管理 + */ + + virtual int leaveRoom() = 0; + /** + * + * @type api + * @brief 更新游戏房间 Token。
+ * 收到 onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire},onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire},或 onSubscribePrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
+ * 如果 Token 无效,你会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged},错误码是 `-1010`。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note 请勿同时调用 updateToken{@link #IGameRoom#updateToken} 和 joinRoom{@link #IGameRoom#joinRoom} 方法更新 Token。若因 Token 过期或无效导致加入房间失败或已被移出房间,你应该在获取新的有效 Token 后调用 joinRoom{@link #IGameRoom#joinRoom} 重新加入房间。 + * @list 房间管理 + */ + + virtual int updateToken(const char* token) = 0; + /** + * + * @type api + * @brief 通过设置 IGameRoom{@link #IGameRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param room_event_handler 参见 IRTCRoomEventHandler{@link #IRTCRoomEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + virtual int setRTCRoomEventHandler(IRTCRoomEventHandler* room_event_handler) = 0; + /** + * + * @type api + * @brief 获取游戏房间范围语音接口实例。 + * @return 方法调用结果:
+ * - IRangeAudio:成功,返回一个 IRangeAudio{@link #IRangeAudio} 实例。 + * - nullptr:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + + virtual IRangeAudio* getRangeAudio() = 0; + /** + * + * @type api + * @brief 开始讲话或者停止讲话时调用,调用该接口启动或停止音频采集。同房间其他用户会收到 + * 回调 OnAudioDeviceStateChanged{@link #IRTCEngineEventHandler#OnAudioDeviceStateChanged} + * @param [in] enable + * true 表示开启采集 + * false 表示关闭采集,默认设置 + * @return + * 0: 表示参数检查通过,不代表打开麦克风会成功,比如房间不存在 + * -2: 传入的room_id为空导致失败 + * @note 不可与 EnableAudioSend{@link #IGameRoom#EnableAudioSend} 同时调用。 + * @list 音频管理 + */ + + virtual int enableMicrophone(bool enable) = 0; + /** + * + * @type api + * @brief 开启或关闭扬声器。 + * @param enable 是否开启扬声器:
+ * - true:开启扬声器,订阅所有远端用户的音频流。 + * - false:默认设置。关闭扬声器,取消订阅所有远端用户的音频流。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败。没有加入房间。 + * @list 音频管理 + */ + + virtual int enableSpeakerphone(bool enable) = 0; + /** + * + * @type api + * @brief 开始或停止发送音频流。调用此接口不影响音频采集。同房间其他用户会收到相应的回调。 + * @param enable 是否发送音频流:
+ * - true:发送音频流。 + * - false:默认设置。停止发送音频流(不会关闭麦克风)。 + * @return + * 0: 表示参数检查通过,不代表打开麦克风会成功,比如房间不存在 + * -2: 传入的room_id为空导致失败 + * @note 不可与 EnableMicrophone{@link #IGameRoom#EnableMicrophone} 同时调用。 + * @list 音频管理 + */ + + virtual int enableAudioSend(bool enable) = 0; + /** + * + * @type api + * @brief 是否接收某个特定用户的音频流。关闭声音接收不会影响扬声器或其他音频输出设备的状态。 + * @param user_id 用户 ID,最大长度为128字节的非空字符串。支持的字符集范围为:
+ * 1. 26个大写字母 A ~ Z
+ * 2. 26个小写字母 a ~ z
+ * 3. 10个数字 0 ~ 9
+ * 4. 下划线"_", at符"@", 减号"-" + * @param enable 是否接收指定用户的音频流:
+ * - true:接收该用户的音频流。即允许该用户的音频数据被传递到本地设备并播放。 + * - false:默认设置,不接收该用户的音频流,即不播放该用户的声音。但不会关闭扬声器,扬声器仍可用于其他音频输出。 + * @return + * - 0:接口调用成功。 + * - -2:传入的用户 ID 为空字符串。 + * @list 音频管理 + */ + + virtual int enableAudioReceive(const char* user_id, bool enable) = 0; + /** + * + * @type api + * @brief 调节某个房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
+ * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
+ * - 该方法与 setRemoteAudioPlaybackVolume{@link #IRTCEngine#setRemoteAudioPlaybackVolume} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume{@link #IRTCEngine#setPlaybackVolume} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + + virtual int setRemoteRoomAudioPlaybackVolume(int volume) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room.h new file mode 100644 index 0000000..eb7283a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room.h @@ -0,0 +1,649 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_video_effect_interface.h" +#include "rtc/bytertc_defines.h" +#include "bytertc_room_event_handler.h" +#include "bytertc_rts_room.h" +#include "rtc/bytertc_range_audio_interface.h" +#include "rtc/bytertc_spatial_audio_interface.h" +#include "rtc/bytertc_panoramic_video_interface.h" +namespace bytertc { +/** + * + * @type api + * @brief 房间接口 + */ + +class IRTCRoom : public IRTSRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTCRoom() { + } + /** + * + * @type api + * @brief 退出并销毁调用 createRTCRoom{@link #IRTCEngine#createRTCRoom} 所创建的 RTC 房间实例。 + * @list 房间管理 + */ + + virtual void destroy() = 0; + /** + * + * @type api + * @brief 设置用户可见性。未调用该接口前,本地用户默认对他人可见。
+ * 默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,最多 30 人可同时上麦。更多信息参看[用户和媒体流上限](https: + * @param enable 设置用户是否对房间内其他用户可见:
+ * - true: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - false: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * 设置用户可见性,会收到设置成功/失败回调 onUserVisibilityChanged{@link #IRTCRoomEventHandler#onUserVisibilityChanged}。(v3.54 新增) + * - 在加入房间前设置用户可见性,若设置的可见性与默认值不同,将在加入房间时触发本回调。 + * - 在加入房间后设置用户可见性,若可见性前后不同,会触发本回调。 + * - 断网重连后,若可见性发生改变,会触发本回调。 + * @note + * - 在加入房间前后,用户均可调用此方法设置用户可见性。 + * - 在房间内,调用此方法成功切换用户可见性后,房间内其他用户会收到相应的回调。 + * - 从可见换至不可见时,房间内其他用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave}。 + * - 从不可见切换至可见时,房间内其他用户会收到 onUserJoined{@link #IRTSRoomEventHandler#onUserJoined}。 + * - 若调用该方法将可见性设为 `false`,此时尝试发布流会收到 `kWarningCodePublishStreamForbidden` 警告。 + * @list 房间管理 + */ + + virtual int setUserVisibility(bool enable) = 0; + /** + * + * @type api + * @brief 通过设置 IRTCRoom{@link #IRTCRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param room_event_handler 参见 IRTCRoomEventHandler{@link #IRTCRoomEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + virtual int setRTCRoomEventHandler(IRTCRoomEventHandler* room_event_handler) = 0; + /** + * + * @type api + * @brief 加入 RTC 房间。
+ * 调用 createRTCRoom{@link #IRTCEngine#createRTCRoom} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。
+ * > 用户(包括后端机器人)成功进入 RTC 房间后便开始计费。即使房间内只有 1 个用户,也会计算音频计费时长。具体计费说明,请参见[音视频通话计费](69871)。 + * @param token 动态密钥,用于对登录用户进行鉴权验证。
+ * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在您的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
+ * - 使用不同 App ID 的 App 是不能互通的。 + * - 请务必保证生成 Token 使用的 App ID 和创建引擎时使用的 App ID 相同,否则会导致加入房间失败。 + * @param user_info 用户信息,参看 UserInfo{@link #UserInfo}。 + * @param user_visibility 用户可见性。建议在进房时将用户可见性都设置为 `false`,并在用户需要发送音视频流时再通过 setUserVisibility{@link #IRTCRoom#setUserVisibility} 设置为 `true`。从而避免因房间内用户达到数量上限所导致的进房失败。默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,其中最多 30 人可同时上麦,更多信息参看[用户和媒体流上限](https: + * @param config 房间参数配置,设置房间模式以及是否自动发布或订阅流。具体配置模式参看 RTCRoomConfig{@link #RTCRoomConfig}。 + * @return + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + * - 本端收到本地流发布状态通知 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调。 + * - 本端收到流订阅状态通知 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。 + * - 本端收到房间内已发布流的通知 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * - 如果本端用户为可见用户,房间内其他用户收到 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 回调通知。 + * - -1:room_id / user_info.uid 包含了无效的参数。 + * - -2:已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #IRTSRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调告知。 + * @note + * - 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 onConnectionStateChanged{@link #IRTCEngineEventHandler#onConnectionStateChanged} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知。 + * @list 房间管理 + */ + + virtual int joinRoom(const char* token, const UserInfo& user_info, bool user_visibility, const RTCRoomConfig& config) = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @region 房间管理 + * @brief 发布/取消发布视频流。 + * @param publish 是否发布视频流。
+ * - `true`: 发布。 + * - `false`: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom{@link #IRTCRoom#joinRoom} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头视频流。 + * - 如果你需要发布麦克风采集到的音频流,调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms}。 + * - 调用此方法后,房间中的所有远端用户会收到 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调通知,订阅了视频流的远端用户会收到 onFirstRemoteVideoFrameDecoded{@link #IRTCEngineEventHandler#onFirstRemoteVideoFrameDecoded} 回调。 + * @list 音视频传输 + */ + + virtual int publishStreamVideo(bool publish) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这些方法,请迁移到此接口。 + * @region 房间管理 + * @brief 发布/取消发布音频流。 + * @param publish 是否发布音频流。
+ * - `true`: 发布。 + * - `false`: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom{@link #IRTCRoom#joinRoom} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布音频流。 + * - 如果你需要发布摄像头采集到的视频流,调用 publishStreamVideo{@link #IRTCRoom#publishStreamVideo}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms}。 + * - 调用此方法后,房间中的所有远端用户会收到 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调通知,其中成功收到了音频流的远端用户会收到 onFirstRemoteAudioFrame{@link #IRTCEngineEventHandler#onFirstRemoteAudioFrame} 回调。 + * @list 音视频传输 + * @order 0 + */ + + virtual int publishStreamAudio(bool publish) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream`、`unsubscribeStream`、`subscribeScreen` 和 `unsubscribeScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端视频流。 + * @param stream_id 目标远端视频流 ID。 + * @param subscribe 是否订阅该视频流。
+ * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端视频流(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调获取当前房间里的远端摄像头流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged} 回调通知,具体异常原因参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 3 + */ + + virtual int subscribeStreamVideo(const char *stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream`, `unsubscribeStream`, `subscribeScreen` 和 `unsubscribeScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端音频流。 + * @param stream_id 目标远端音频流 ID。 + * @param subscribe 是否订阅该音频流。
+ * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调获取当前房间里的远端麦克风流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调通知,具体异常原因参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @list 音视频传输 + */ + + virtual int subscribeStreamAudio(const char *stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. + * @brief 设置期望订阅的远端视频流类型。比如大流、中流、小流等。 + * @param stream_id 目标要订阅的远端视频流 ID。 + * @param stream_type 远端视频流类型,参看 SimulcastStreamType{@link #SimulcastStreamType}。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 该方法仅在发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode} 开启了发送多路视频流的情况下生效。 + * - 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。该方法可在进房后调用。 + * @list 视频管理 + * @order 1 + */ + + virtual int setRemoteSimulcastStreamType(const char* stream_id, SimulcastStreamType stream_type) = 0; + + /** + * + * @type api + * @list 视频管理 + * @brief 设置期望订阅的远端视频流的参数。 + * @param stream_id 期望配置订阅参数的远端视频流 ID。 + * @param remote_video_config 期望配置的远端视频流参数,参看 RemoteVideoConfig{@link #RemoteVideoConfig}。 + * @return 方法调用结果:
+ * + 0:成功;
+ * + !0:失败。 + * @note + * + 若使用 342 及以前版本的 SDK,调用该方法前请联系技术支持人员开启按需订阅功能。
+ * + 该方法需在进房后调用。 + * + 该方法仅在发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode} 开启了发送多路视频流的情况下生效,此时订阅端将收到来自发布端与期望设置的参数最相近的一路流;否则订阅端只会收到一路参数为分辨率 640px × 360px、帧率 15fps 的视频流。
+ * + 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。
+ * + SDK 会根据发布端和所有订阅端的设置灵活调整视频流的参数,具体调整策略详见[推送多路流](https: + */ + + virtual int setRemoteVideoConfig(const char *stream_id, const RemoteVideoConfig &remote_video_config) = 0; + /** + * + * @type api + * @valid Available since 3.60 + * @brief 设置当前推流的流附加信息。 + * @param extra_info 流附加信息。长度不超过1024的字符串。 + * @return 方法调用结果:
+ * + 0:成功;
+ * + !0:失败。 + * @note + * + 可通过此函数设置当前推流的流附加信息。流附加信息是流 ID 的附加信息标识,不同于流 ID 在推流过程中不可修改,流附加信息可以在对应流 ID 的推流中途修改。开发者可根据流附加信息来实现流 ID 相关的可变内容的同步。 + * + 该方法在进房前后均可调用 + * + 相同房间内的其他用户会通过 onRoomStreamExtraInfoUpdate{@link #IRTCRoomEventHandler#onRoomStreamExtraInfoUpdate} 回调函数获得通知。 + * @list 音视频传输 + */ + + virtual int setStreamExtraInfo(const char* extra_info) = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内所有远端视频流(通过摄像头采集的)。 + * @param subscribe 是否订阅所有远端视频流。
+ * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置:subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio}。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用单流订阅接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 通知方法调用结果,包含异常原因。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 取消订阅或本端用户退房。 + * @list 音视频传输 + */ + + virtual int subscribeAllStreamsVideo(bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @region 房间管理 + * @brief 订阅/取消订阅房间内所有远端音频流(通过麦克风采集的)。 + * @param subscribe 是否订阅所有远端音频流。
+ * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return 方法调用结果:
+ * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置:subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio}。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用单流订阅接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 通知方法调用结果,包含异常原因。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 取消订阅或本端用户退房。 + * @list 音视频传输 + * + */ + + virtual int subscribeAllStreamsAudio(bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `pauseAllSubscribedStreamAudio` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送。 + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #IRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + + virtual int pauseAllSubscribedStreamVideo() = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `pauseAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #IRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + + virtual int pauseAllSubscribedStreamAudio() = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送。 + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + + virtual int resumeAllSubscribedStreamVideo() = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送。 + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + + virtual int resumeAllSubscribedStreamAudio() = 0; + /** + * + * @hidden for internal use only. + */ + + virtual int enableSubscribeLocalStream(bool enable) = 0; + /** + * + * @type api + * @brief 设置发流端音画同步。
+ * 当同一用户同时使用两个通话设备分别采集发送音频和视频时,有可能会因两个设备所处的网络环境不一致而导致发布的流不同步,此时你可以在视频发送端调用该接口,SDK 会根据音频流的时间戳自动校准视频流,以保证接收端听到音频和看到视频在时间上的同步性。 + * @param audio_user_id 音频发送端的用户 ID,将该参数设为空则可解除当前音视频的同步关系。 + * @return + * - 0: 调用成功。调用该接口后音画同步状态发生改变时,你会收到 onAVSyncStateChange{@link #IRTCRoomEventHandler#onAVSyncStateChange} 回调。 + * - < 0 : 调用失败。你也可以通过监听 onAVSyncEvent{@link #IRTCRoomEventHandler#onAVSyncEvent} 获取错误详情。同一 RTC 房间内允许存在多个音视频同步关系,但需注意单个音频源不支持与多个视频源同时同步。 + * @note + * - 该方法在进房前后均可调用。 + * - 进行音画同步的音频发布用户 ID 和视频发布用户 ID 须在同一个 RTC 房间内。 + * - 如需更换同步音频源,再次调用该接口传入新的 `audio_user_id` 即可;如需更换同步视频源,需先解除当前的同步关系,后在新视频源端开启同步。 + * @list 音视频传输 + */ + + virtual int setMultiDeviceAVSync(const char* audio_user_id) = 0; + + /** + * + * @hidden for internal use only. + */ + + virtual int setCustomUserRole(const char* role) = 0; + /** + * + * @type api + * @brief 开始跨房间转发媒体流。
+ * 在调用 joinRoom{@link #IRTCRoom#joinRoom} 后调用本接口,实现向多个房间转发媒体流,适用于跨房间连麦等场景。 + * @param configuration 跨房间媒体流转发指定房间的信息。参看 ForwardStreamConfiguration{@link #ForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged} 回调。 + * - 调用本方法后,你可以通过监听 onForwardStreamEvent{@link #IRTCRoomEventHandler#onForwardStreamEvent} 回调来获取各个目标房间在转发媒体流过程中的相关事件。 + * - 开始转发后,目标房间中的用户将接收到本地用户进房 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 和发流 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * - 调用本方法后,可以调用 updateForwardStreamToRooms{@link #IRTCRoom#updateForwardStreamToRooms} 更新目标房间信息,例如,增加或减少目标房间等。 + * - 调用本方法后,可以调用 stopForwardStreamToRooms{@link #IRTCRoom#stopForwardStreamToRooms} 停止向所有房间转发媒体流。 + * - 调用本方法后,可以调用 pauseForwardStreamToAllRooms{@link #IRTCRoom#pauseForwardStreamToAllRooms} 暂停向所有房间转发媒体流。 + * @list 音视频传输 + */ + + virtual int startForwardStreamToRooms(const ForwardStreamConfiguration& configuration) = 0; + /** + * + * @type api + * @brief 更新跨房间媒体流转发信息。
+ * 通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 发起媒体流转发后,可调用本方法增加或者减少目标房间,或更新房间密钥。
+ * 调用本方法增加或删减房间后,将在本端触发 onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged} 回调,包含发生了变动的目标房间中媒体流转发状态。 + * @param configuration 跨房间媒体流转发目标房间信息。参看 ForwardStreamConfiguration{@link #ForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * 增加或删减目标房间后,新增目标房间中的用户将接收到本地用户进房 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 和发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * @list 音视频传输 + */ + + virtual int updateForwardStreamToRooms(const ForwardStreamConfiguration& configuration) = 0; + /** + * + * @type api + * @brief 停止跨房间媒体流转发。
+ * 通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 发起媒体流转发后,可调用本方法停止向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged} 回调。 + * - 调用本方法后,原目标房间中的用户将接收到本地用户停止发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调和退房 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 的回调。 + * - 如果需要停止向指定的房间转发媒体流,请调用 updateForwardStreamToRooms{@link #IRTCRoom#updateForwardStreamToRooms} 更新房间信息。 + * - 如果需要暂停转发,请调用 pauseForwardStreamToAllRooms{@link #IRTCRoom#pauseForwardStreamToAllRooms},并在之后随时调用 resumeForwardStreamToAllRooms{@link #IRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @list 音视频传输 + */ + + virtual int stopForwardStreamToRooms() = 0; + /** + * + * @type api + * @brief 暂停跨房间媒体流转发。
+ * 通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 发起媒体流转发后,可调用本方法暂停向所有目标房间转发媒体流。
+ * 调用本方法暂停向所有目标房间转发后,你可以随时调用 resumeForwardStreamToAllRooms{@link #IRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 调用本方法后,目标房间中的用户将接收到本地用户停止发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调和退房 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 的回调。 + * @list 音视频传输 + */ + + virtual int pauseForwardStreamToAllRooms() = 0; + /** + * + * @type api + * @brief 恢复跨房间媒体流转发。
+ * 调用 pauseForwardStreamToAllRooms{@link #IRTCRoom#pauseForwardStreamToAllRooms} 暂停转发之后,调用本方法恢复向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * 目标房间中的用户将接收到本地用户进房 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 和发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * @list 音视频传输 + */ + + virtual int resumeForwardStreamToAllRooms() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 获取范围语音接口实例。 + * @return 方法调用结果:
+ * - IRangeAudio:成功,返回一个 IRangeAudio{@link #IRangeAudio} 实例。 + * - nullptr:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + + virtual IRangeAudio* getRangeAudio() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 获取空间音频接口实例。 + * @return 方法调用结果:
+ * - ISpatialAudio:成功,返回一个 ISpatialAudio{@link #ISpatialAudio} 实例。 + * - nullptr:失败,当前 SDK 不支持空间音频功能。 + * @note + * - 首次调用该方法须在创建房间后、加入房间前。空间音频相关 API 和调用时序详见[空间音频](https: + * - 只有在使用支持真双声道播放的设备时,才能开启空间音频效果; + * - 机型性能不足可能会导致音频卡顿,使用低端机时,不建议开启空间音频效果; + * - SDK 最多支持 30 个用户同时开启空间音频功能。 + * @list 高级功能 + */ + + virtual ISpatialAudio* getSpatialAudio() = 0; + /** + * + * @type api + * @brief 调节某个房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
+ * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
+ * - 该方法与 setRemoteAudioPlaybackVolume{@link #IRTCEngine#setRemoteAudioPlaybackVolume} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume{@link #IRTCEngine#setPlaybackVolume} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + + virtual int setRemoteRoomAudioPlaybackVolume(int volume) = 0; + /** + * + * @hidden for internal use only on Windows and Android + * @type api + * @brief 接收端调用本接口获取全景视频接口引擎。 + * @return 方法调用结果:
+ * - IPanoramicVideo:成功,返回一个 IPanoramicVideo{@link #IPanoramicVideo} 实例。 + * - null:失败,当前 SDK 不支持全景视频功能。 + * @note + * - 接收端的调用时序为 createRTCEngine{@link #IRTCEngine#createRTCEngine} > createRTCRoom{@link #IRTCEngine#createRTCRoom} > 本接口 > joinRoom{@link #IRTCRoom#joinRoom}。 + * - 获取 IPanoramicVideo 实例后,再调用 updateQuaternionf{@link #IPanoramicVideo#updateQuaternionf} 更新头位姿四元数。 + * - 你需要使用外部渲染器对接收到的全景视频进行渲染,参见 setRemoteVideoSink{@link #IRTCEngine#setRemoteVideoSink}。 + * @list 视频管理 + */ + + virtual IPanoramicVideo* getPanoramicVideo() = 0; + /** + * + * @valid since 3.52. + * @type api + * @brief 设置本端发布流在音频选路中的优先级。 + * @param audio_selection_priority 本端发布流在音频选路中的优先级,默认正常参与音频选路。参见 AudioSelectionPriority{@link #AudioSelectionPriority}。 + * @note + * - 在控制台上为本 appId 开启音频选路后,调用本接口才会生效。进房前后调用均可生效。更多信息参见[音频选路](https: + * - 如果本端用户同时加入不同房间,使用本接口进行的设置相互独立。 + * @list 音频管理 + */ + + virtual int setAudioSelectionConfig(AudioSelectionPriority audio_selection_priority) = 0; + /** + * + * @valid since 3.52. + * @type api + * @brief 设置/更新房间附加信息,可用于标识房间状态或属性,或灵活实现各种业务逻辑。 + * @param key 房间附加信息键值,长度小于 10 字节。
+ * 同一房间内最多可存在 5 个 key,超出则会从第一个 key 起进行替换。 + * @param value 房间附加信息内容,长度小于 128 字节。 + * @return + * - 0: 方法调用成功,返回本次调用的任务编号; + * - <0: 方法调用失败,具体原因详见 SetRoomExtraInfoResult{@link #SetRoomExtraInfoResult}。 + * @note + * - 在设置房间附加信息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。 + * - 调用该方法后,会收到一次 onSetRoomExtraInfoResult{@link #IRTCRoomEventHandler#onSetRoomExtraInfoResult} 回调,提示设置结果。 + * - 调用该方法成功设置附加信息后,同一房间内的其他用户会收到关于该信息的回调 onRoomExtraInfoUpdate{@link #IRTCRoomEventHandler#onRoomExtraInfoUpdate}。 + * - 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + + virtual int64_t setRoomExtraInfo(const char*key,const char*value) = 0; + /** + * + * @valid since 3.52 + * @type api + * @brief 识别或翻译房间内所有用户的语音,形成字幕。
+ * 调用该方法时,可以在 SubtitleMode{@link #SubtitleMode} 中选择语音识别或翻译模式。如果选择识别模式,语音识别文本会通过 onSubtitleMessageReceived{@link #IRTCRoomEventHandler#onSubtitleMessageReceived} 事件回调给你;
+ * 如果选择翻译模式,你会同时收到两个 onSubtitleMessageReceived{@link #IRTCRoomEventHandler#onSubtitleMessageReceived} 回调,分别包含字幕原文及字幕译文。
+ * 调用该方法后,用户会收到 onSubtitleStateChanged{@link #IRTCRoomEventHandler#onSubtitleStateChanged} 回调,通知字幕是否开启。 + * @param subtitle_config 字幕配置信息。参看 SubtitleConfig{@link #SubtitleConfig}。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @note + * - 使用字幕功能前,你需要在 [RTC 控制台](https: + * - 如果你需要使用流式语音识别模式,你应在 [豆包语音控制台](https: + * - 如果你需要使用实时语音翻译模式,你应开通机器翻译服务,参考 [开通服务](https: + * - 此方法需要在进房后调用。 + * - 如需指定源语言,你需要在调用 `joinRoom` 接口进房时,通过 extraInfo 参数传入格式为`"语种英文名": "语种代号"` JSON 字符串,例如设置源语言为英文时,传入 `"source_language": "en"`。如未指定源语言,SDK 会将系统语种设定为源语言。如果你的系统语种不是中文、英文和日文,此时 SDK 会自动将中文设为源语言。 + * - 识别模式下,你可以传入 [RTC 控制台](https: + * - 翻译模式下,你需要传入机器翻译规定的语种英文名和语种代号。翻译模式下支持的语言及对应的代号参看[翻译模式语言支持](https: + * @list 字幕翻译服务 + */ + + virtual int startSubtitle(const SubtitleConfig& subtitle_config) = 0; + /** + * + * @valid since 3.52 + * @type api + * @brief 关闭字幕。
+ * 调用该方法后,用户会收到 onSubtitleStateChanged{@link #IRTCRoomEventHandler#onSubtitleStateChanged} 回调,通知字幕是否关闭。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @list 字幕翻译服务 + */ + + virtual int stopSubtitle() = 0; + /** + * + * @valid since 3.53 + * @type api + * @brief 获取房间 ID。 + * @return 房间 ID。 + * @list 房间管理 + */ + + virtual const char* getRoomId() = 0; + + /** + * + * @type api + * @valid since 3.60. + * @brief 获取通话 ID。
+ * 该方法需要在加入房间后调用。当创建一个房间开启音视频通话后,系统会为该房间生成一个对应的通话 ID,标识此房间的通话。 + * @return 通话 ID。 + * @list 房间管理 + */ + + virtual const char* getCallId() = 0; + + /** + * + * @valid since 3.60. + * @type api + * @brief 设置房间直播模式。
+ * 该方法需要在加入房间后调用。 + * @param live_mode 直播模式。参看 RoomLiveMode{@link #RoomLiveMode} 。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @list 房间管理 + */ + + virtual int setLiveMode(RoomLiveMode live_mode) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room_event_handler.h new file mode 100644 index 0000000..1833721 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room_event_handler.h @@ -0,0 +1,582 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Event Handler Interface +*/ + +#pragma once + +#include "rtc/bytertc_defines.h" +#include "bytertc_rts_room_event_handler.h" + +namespace bytertc { +/** + * + * @type callback + * @brief RTS房间事件回调接口
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +class IRTCRoomEventHandler : public IRTSRoomEventHandler { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRTCRoomEventHandler() { + } + /** + * + * @hidden + * @type callback + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
+ * - 0: 加入房间成功。 + * - 1: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * - 2: 离开房间。 + * @param reason 房间状态发生变化的原因。参见 RoomStateChangeReason{@link #RoomStateChangeReason}。 + * @list 房间管理 + */ + + virtual void onRoomStateChangedWithReason( + const char* room_id, const char* uid, RoomState state, RoomStateChangeReason reason) { + (void)room_id; + (void)uid; + (void)state; + (void)reason; + } + /** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调取代 `onStreamStateChanged` 回调,用于报告视频发布状态改变。如果您已升级 SDK 至版本 3.60 或以上,仍在使用 `onStreamStateChanged` 回调,请迁移至该回调。 + * @region 房间管理 + * @brief 视频发布状态改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 发布状态码,参看 PublishState{@link #PublishState}。 + * @param reason 本地视频流发布状态改变的具体原因,参看 PublishStateChangeReason{@link #PublishStateChangeReason}。 + * @note 除了本地视频流发布状态改变时触发,本端用户进房时也会收到本回调。 + * @list 音视频传输 + */ + + virtual void onVideoPublishStateChanged( + const char* stream_id, const StreamInfo& stream_info, PublishState state, PublishStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. + * @region 房间管理 + * @brief 音频发布状态改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 发布状态码,参看 PublishState{@link #PublishState}。 + * @param reason 本地音频流发布状态改变的具体原因,参看 PublishStateChangeReason{@link #PublishStateChangeReason}。 + * @note 除了状态改变时触发,本端用户进房时也会收到本回调。 + * @list 音视频传输 + */ + + virtual void onAudioPublishStateChanged( + const char* stream_id, const StreamInfo& stream_info, PublishState state, PublishStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onStreamStateChanged` 和 `onStreamSubscribed` 方法,用于报告视频流订阅状态的改变。如果您已升级到 SDK 版本 3.60 或以上,仍在使用这两个方法,请迁移到该回调。 + * @region 房间管理 + * @brief 视频订阅状态发生改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 订阅状态码,参看 SubscribeState{@link #SubscribeState}。 + * @param reason 视频流订阅状态改变的具体原因,参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo} 后会收到该通知。 + * @list 音视频传输 + */ + + virtual void onVideoSubscribeStateChanged( + const char* stream_id, const StreamInfo& stream_info, SubscribeState state, SubscribeStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. + * @region 房间管理 + * @brief 音频订阅状态发生改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 订阅状态码,参看 SubscribeState{@link #SubscribeState}。 + * @param reason 音频订阅状态改变的具体原因,参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 后会收到该通知。 + * @list 音视频传输 + */ + + virtual void onAudioSubscribeStateChanged( + const char* stream_id, const StreamInfo& stream_info, SubscribeState state, SubscribeStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @hidden + * @deprecated since 3.41 and will be deleted in 3.51, use onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} and onStreamStateChanged instead. + * @type callback + * @brief SDK 发生警告回调。
+ * SDK 内部遇到可恢复错误时,在尝试自动恢复的同时,会通过此回调通知用户。此回调事件仅用作通知。 + * @param warn 警告码,参看 WarningCode{@link #WarningCode}。 + * @list 房间管理 + */ + + BYTERTC_DEPRECATED virtual void onRoomWarning(int warn) { + (void)warn; + } + /** + * + * @type callback + * @brief 当 SDK 检测到 Token 的进房权限将在 30 秒内过期时,触发该回调。 + * 收到该回调后,你需调用 updateToken{@link #IRTSRoom#updateToken} 更新 Token 进房权限。 + * @note 若未能及时更新 Token 进房权限导致其过期而失效:
+ * - 用户此时尝试进房会收到 回调,提示错误码为 `-1000` Token 过期; + * - 用户已在房间内则会被移出房间,本地用户会收到 回调,提示错误码为 `-1009` Token 过期,同时远端用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调,提示原因为 `2` Token 进房权限过期。 + * @list 引擎管理 + */ + + virtual void onTokenWillExpire() { + + } + /** + * + * @type callback + * @brief Token 发布权限过期前 30 秒将触发该回调。
+ * 收到该回调后,你需调用 updateToken{@link #IRTSRoom#updateToken} 更新 Token 发布权限。 + * @note Token 发布权限过期后: + * - 已发布流或尝试发布流时,本端会收到 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调,提示`kPublishStateChangeReasonNoPublishPermission`,没有发布权限。 + * - 发布中的流将停止发布。远端用户会收到 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调,提示该流已停止发布。 + * @list 引擎管理 + */ + + virtual void onPublishPrivilegeTokenWillExpire() { + + } + /** + * + * @type callback + * @brief Token 订阅权限过期前 30 秒将触发该回调。
+ * 收到该回调后,你需调用 updateToken{@link #IRTSRoom#updateToken} 更新 Token 订阅权限有效期。 + * @note 若收到该回调后未及时更新 Token,Token 订阅权限过期后,尝试新订阅流会失败,已订阅的流会取消订阅,并且会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调,提示`kSubscribeStateChangeReasonNoSubscribePermission`,没有订阅权限。 + * @list 引擎管理 + */ + + virtual void onSubscribePrivilegeTokenWillExpire() { + + } + /** + * + * @type callback + * @brief 房间内通话统计信息回调。
+ * 用户进房开始通话后,每 2s 收到一次本回调。 + * @param stats 当前 RtcEngine 统计数据,详见 RtcRoomStats{@link #RtcRoomStats} + * @list 房间管理 + */ + + virtual void onRoomStats(const RtcRoomStats& stats) { + (void)stats; + } + /** + * + * @hidden for internal use only + * @type callback + * @brief 房间事件回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间事件状态。详见 RoomEvent{@link #RoomEvent}。 + * @param info 房间封禁时,包含封禁时间。详见 RoomEventInfo{@link #RoomEventInfo}。 + * @list 房间管理 + */ + + virtual void onRoomEvent(const char* room_id, const char* uid, RoomEvent state, const RoomEventInfo& info) { + (void)room_id; + (void)uid; + (void)state; + (void)info; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 本地流数据统计以及网络质量回调。
+ * 本地用户发布流成功后,SDK 会周期性(2s)地通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
+ * 统计信息通过 LocalStreamStats{@link #LocalStreamStats} 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param stats 当前 RtcEngine 统计数据,详见 LocalStreamStats{@link #LocalStreamStats}。 + * @list 音视频传输 + */ + + virtual void onLocalStreamStats(const char* stream_id, const bytertc::StreamInfo& stream_info, const LocalStreamStats& stats) { + (void)stream_id; + (void)stream_info; + (void)stats; + } + /** + * + * @type callback + * @brief 本地订阅的远端音/视频流数据统计以及网络质量回调。
+ * 本地用户订阅流成功后,SDK 会周期性(2s)地通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param stats 当前 RtcEngine 统计数据,详见 RemoteStreamStats{@link #RemoteStreamStats} + * @list 音视频传输 + */ + + virtual void onRemoteStreamStats(const char* stream_id, const bytertc::StreamInfo& stream_info, const RemoteStreamStats& stats) { + (void)stream_id; + (void)stream_info; + (void)stats; + } + /** + * + * @type callback + * @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
+ * 1. 远端用户调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
+ * 2. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
+ * 3. 房间内隐身远端用户调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法切换至可见时,房间内其他用户将收到该事件。
+ * 4. 新进房用户会收到进房前已在房内的可见用户的进房回调通知。 + * @param user_info 用户信息,详见 UserInfo{@link #UserInfo} + * @list 房间管理 + */ + + virtual void onUserJoined(const UserInfo& user_info) { + (void)user_info; + } + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in 3.51, use onUserUnpublishStream and onUserUnpublishScreen instead. + * @type callback + * @brief 房间内的远端用户停止发布音视频流时,本地用户会收到此回调。 + * @param stream 流的属性。参看 MediaStreamInfo{@link #MediaStreamInfo} 。 + * @param reason 远端流移除的原因。参看 StreamRemoveReason{@link #StreamRemoveReason} 。 + * @list 房间管理 + */ + + BYTERTC_DEPRECATED virtual void onStreamRemove(const MediaStreamInfo& stream, StreamRemoveReason reason) { + (void)stream; + } + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in 3.51, use onUserPublishStream and onUserPublishScreen instead. + * @type callback + * @brief 房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调。包括移除后又重新发布的流。 + * @param stream 流属性,参看 MediaStreamInfo{@link #MediaStreamInfo} 。 + * @list 房间管理 + */ + + BYTERTC_DEPRECATED virtual void onStreamAdd(const MediaStreamInfo& stream) { + (void)stream; + } + + /** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onUserPublishStream` 、`onUserUnpublishStream` 、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法。如果您已升级到 SDK 版本 3.60 或以上,且仍在使用这些方法,请迁移到该回调。 + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布视频流的回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param is_publish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamVideo{@link #IRTCRoom#publishStreamVideo} 成功发布采集的视频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo} 订阅此流。 + * @list 音视频传输 + */ + + virtual void onUserPublishStreamVideo(const char* stream_id, const StreamInfo& stream_info, bool is_publish){ + (void)stream_id; + (void)stream_info; + (void)is_publish; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onUserPublishStream`、`onUserUnpublishStream`、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用这些方法,请迁移至该回调。 + * @brief 房间内远端用户发布或取消发布音频流的回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param is_publish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 成功发布音频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 订阅此流。 + * @list 音视频传输 + * @order 2 + */ + + virtual void onUserPublishStreamAudio(const char* stream_id, const StreamInfo& stream_info, bool is_publish){ + (void)stream_id; + (void)stream_info; + (void)is_publish; + } + + /** + * + * @hidden for internal use only + * @type callback + * @brief 当发布流成功的时候回调该事件。 + * @param user_id 发布流的用户 ID。 + * @param is_screen 该流是否为屏幕流。
+ * - Ture: 屏幕流。 + * - False: 非屏幕流。 + * @list 音视频传输 + */ + + virtual void onStreamPublishSuccess(const char* user_id, bool is_screen) { + (void)is_screen; + } + + /** + * + * @hidden for internal use only + */ + + virtual void onRoomModeChanged(RtcRoomMode mode) { + (void)mode; + } + + /** + * + * @hidden for internal use only + * @brief callback when the maximum screen share fps is changed + * @param fps maximum screen share fps + */ + + virtual void onMaximumScreenShareFpsUpdated(int fps) { + (void)fps; + } + + /** + * + * @hidden for internal use only + * @brief 最大屏幕共享帧率改变时的回调 + * @param screen_pixels 为了保持帧率而推荐的最大视频宽度×高度的值。 + */ + + virtual void onMaximumScreenSharePixelsUpdated(int screen_pixels) { + (void)screen_pixels; + } + /** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。 + * @param uid 被禁用/解禁的视频流用户 ID + * @param banned 视频流发送状态
+ * - true: 视频流发送被禁用 + * - false: 视频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁视频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音视频传输 + */ + + virtual void onVideoStreamBanned(const char* uid, bool banned) { + (void)uid; + (void)banned; + } + /** + * + * @type callback + * @brief 发布端调用 setMultiDeviceAVSync{@link #IRTCRoom#setMultiDeviceAVSync} 后音视频同步状态发生改变时,会收到此回调。 + * @param state 音视频同步状态,参看 AVSyncState{@link #AVSyncState}。 + * @list 音视频传输 + */ + + virtual void onAVSyncStateChange(AVSyncState state) { + (void)state; + } + /** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户音频流的发送时,触发此回调。 + * @param uid 被禁用/解禁的音频流用户 ID + * @param banned 音频流发送状态
+ * - true: 音频流发送被禁用 + * - false: 音频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁音频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 在控制台开启音频选路后,只有被封禁/解禁用户会收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音频管理 + */ + + virtual void onAudioStreamBanned(const char* uid, bool banned) { + (void)uid; + (void)banned; + } + /** + * + * @type callback + * @brief 跨房间媒体流转发状态和错误回调 + * @param infos 跨房间媒体流转发目标房间信息数组,详见 ForwardStreamStateInfo{@link #ForwardStreamStateInfo} + * @param info_count 数组长度,代表目标房间数 + * @list 音视频传输 + */ + + virtual void onForwardStreamStateChanged(ForwardStreamStateInfo* infos, int info_count) { + } + /** + * + * @type callback + * @brief 跨房间媒体流转发事件回调 + * @param infos 跨房间媒体流转发目标房间事件数组,详见 ForwardStreamEventInfo{@link #ForwardStreamEventInfo} + * @param info_count 数组长度,代表目标房间数 + * @list 音视频传输 + */ + + virtual void onForwardStreamEvent(ForwardStreamEventInfo* infos, int info_count) { + } + /** + * + * @type callback + * @brief 加入房间并发布或订阅流后, 以每 2 秒一次的频率,报告本地用户和已订阅的远端用户的上下行网络质量信息。 + * @param local_quality 本端网络质量,详见 NetworkQualityStats{@link #NetworkQualityStats}。 + * @param remote_qualities 已订阅用户的网络质量,详见 NetworkQualityStats{@link #NetworkQualityStats}。 + * @param remote_quality_num `remoteQualities` 数组长度 + * @note 更多通话中的监测接口,详见[通话中质量监测](https: + * @list 音视频传输 + */ + + virtual void onNetworkQuality(const NetworkQualityStats& local_quality, const NetworkQualityStats* remote_qualities, int remote_quality_num) { + } + /** + * + * @valid since 3.52. + * @type callback + * @brief 调用 setRoomExtraInfo{@link #IRTCRoom#setRoomExtraInfo} 设置房间附加信息结果的回调。 + * @param task_id 调用 setRoomExtraInfo 的任务编号。 + * @param result 设置房间附加信息的结果,详见 SetRoomExtraInfoResult{@link #SetRoomExtraInfoResult} + * @list 房间管理 + */ + + virtual void onSetRoomExtraInfoResult(int64_t task_id, SetRoomExtraInfoResult result) { + (void)task_id; + (void)result; + } + /** + * + * @valid since 3.52. + * @type callback + * @brief 接收同一房间内,其他用户调用 setRoomExtraInfo{@link #IRTCRoom#setRoomExtraInfo} 设置的房间附加信息的回调。 + * @param key 房间附加信息的键值 + * @param value 房间附加信息的内容 + * @param last_update_user_id 最后更新本条信息的用户 ID。 + * @param last_update_time_ms 最后更新本条信息的 Unix 时间,单位:毫秒。 + * @note 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + + virtual void onRoomExtraInfoUpdate(const char*key, const char* value, const char* last_update_user_id, int64_t last_update_time_ms) { + (void)key; + (void)value; + (void)last_update_user_id; + (void)last_update_time_ms; + } + /** + * + * @valid since 3.60. + * @type callback + * @brief 接收同一房间内,其他用户调用 setStreamExtraInfo{@link #IRTCRoom#setStreamExtraInfo} 设置的流附加信息的回调。 + * @param stream_id 流 ID + * @param stream_info 流信息,详见 StreamInfo{@link #StreamInfo} + * @param extra_info 流附加信息的内容 + * @note 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + + virtual void onRoomStreamExtraInfoUpdate(const char* stream_id, const StreamInfo& stream_info, const char* extra_info) { + (void)stream_id; + (void)stream_info; + (void)extra_info; + } + /** + * + * @valid since 3.54 + * @type callback + * @brief 用户调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 设置用户可见性的回调。 + * @param current_user_visibility 当前用户的可见性。
+ * - true: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - false: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @param error_code 设置用户可见性错误码,参看 UserVisibilityChangeError{@link #UserVisibilityChangeError}。 + * @list 房间管理 + */ + + virtual void onUserVisibilityChanged(bool current_user_visibility, UserVisibilityChangeError error_code) { + (void)current_user_visibility; + (void)error_code; + } + /** + * + * @type callback + * @brief 字幕状态发生改变回调。
+ * 当用户调用 startSubtitle{@link #IRTCRoom#startSubtitle} 和 stopSubtitle{@link #IRTCRoom#stopSubtitle} 使字幕状态发生改变或出现错误时,触发该回调。 + * @param state 字幕状态。参看 SubtitleState{@link #SubtitleState}。 + * @param error_code 字幕任务错误码。参看 SubtitleErrorCode{@link #SubtitleErrorCode}。 + * @param error_message 与第三方服务有关的错误信息。 + * @list 字幕翻译服务 + */ + + virtual void onSubtitleStateChanged(SubtitleState state, SubtitleErrorCode error_code, const char* error_message) { + } + /** + * + * @type callback + * @brief 字幕相关内容回调。
+ * 当用户调用 startSubtitle{@link #IRTCRoom#startSubtitle} 后会收到此回调,通知字幕的相关信息。 + * @param subtitles 字幕消息内容。参看 SubtitleMessage{@link #SubtitleMessage}。 + * @param cnt 字幕消息个数。 + * @list 字幕翻译服务 + */ + + virtual void onSubtitleMessageReceived(const SubtitleMessage* subtitles, int cnt) { + } + + /** + * + * @type callback + * @valid since 3.60. + * @brief 发布端调用 setMultiDeviceAVSync{@link #IRTCRoom#setMultiDeviceAVSync} 后音视频同步状态发生错误时,会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param event 音视频同步状态错误,参看 AVSyncEvent{@link #AVSyncEvent}。 + * @list 音视频传输 + */ + + virtual void onAVSyncEvent(const char* room_id, const char* uid, AVSyncEvent event) { + } +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room_ex.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room_ex.h new file mode 100644 index 0000000..fee9556 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_room_ex.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface Lite + */ + +#pragma once + +#include "bytertc_room.h" + +namespace bytertc { + +class IRTCRoomEventHandlerEx; +/** + * + * @type api + * @brief IRTCRoomEx Class + */ +class IRTCRoomEx : public IRTCRoom { +public: + /** + * + * @type api + * @region 房间管理 + * @brief 在当前所在房间内发布媒体流 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 MediaStreamType{@link #MediaStreamType} + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 如果你已经在用户进房时通过调用 joinRoom{@link #IRTCRoom#joinRoom} 成功选择了自动发布,则无需再调用本接口。
+ * + 调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头音视频流。
+ * + 如果你需要向多个房间发布流,调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms}。
+ * + 调用此方法后,房间中的所有远端用户会收到 onUserPublishStream{@link #IRTCRoomEventHandler#onUserPublishStream} 回调通知,其中成功收到了音频流的远端用户会收到 onFirstRemoteAudioFrame{@link #IRTCEngineEventHandler#onFirstRemoteAudioFrame} 回调,订阅了视频流的远端用户会收到 onFirstRemoteVideoFrameDecoded{@link #IRTCEngineEventHandler#onFirstRemoteVideoFrameDecoded} 回调。
+ * + 调用 unpublishStream{@link #IRTCRoom#unpublishStream} 取消发布。 + */ + virtual int publishStream(StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 停止将本地摄像头/麦克风采集的媒体流发布到当前所在房间中 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param type 媒体流类型,用于指定停止发布音频/视频,参看 MediaStreamType{@link #MediaStreamType} + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 调用 publishStream{@link #IRTCRoomEx#publishStream} 手动发布摄像头音视频流后,你需调用此接口停止发布。
+ * + 调用此方法停止发布音视频流后,房间中的其他用户将会收到 onUserUnpublishStream{@link #IRTCRoomEventHandler#onUserUnpublishStream} 回调通知。 + */ + virtual int unpublishStream(StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 订阅房间内指定的媒体流,或更新对指定媒体流的订阅选项 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param user_id 指定订阅的远端发布音视频流的用户 ID。 + * @param type 媒体流类型,用于指定订阅音频/视频。参看 MediaStreamType{@link #MediaStreamType}。 + * @return 方法调用结果:
+ * + 0:成功;
+ * + <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * + 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。
+ * + 你必须先通过 onUserPublishStream{@link #IRTCRoomEventHandler#onUserPublishStream} 回调获取当前房间里的远端摄像头音视频流信息,然后调用本方法按需订阅。
+ * + 调用该方法后,你会收到 onStreamSubscribed{@link #IRTCRoomEventHandler#onStreamSubscribed} 通知方法调用结果。
+ * + 成功订阅远端用户的媒体流后,订阅关系将持续到调用 unsubscribeStream{@link #IRTCRoom#unsubscribeStream} 取消订阅或本端用户退房。
+ * + 关于其他调用异常,你会收到 onStreamStateChanged{@link #IRTCRoomEventHandler#onStreamStateChanged} 回调通知,具体异常原因参看 ErrorCode{@link #ErrorCode}。 + */ + virtual int subscribeStream(const char *user_id, StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 取消订阅房间内指定的媒体流。
+ * 该方法对自动订阅和手动订阅模式均适用。 + * @param user_id 指定取消订阅的远端发布音视频流的用户 ID。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param type 媒体流类型,用于指定取消订阅音频/视频。参看 MediaStreamType{@link #MediaStreamType}。 + * @return 方法调用结果:
+ * + 0:成功;
+ * + <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * + 调用该方法后,你会收到 onStreamSubscribed{@link #IRTCRoomEventHandler#onStreamSubscribed} 通知方法调用结果。
+ * + 关于其他调用异常,你会收到 onStreamStateChanged{@link #IRTCRoomEventHandler#onStreamStateChanged} 回调通知,具体失败原因参看 ErrorCode{@link #ErrorCode}。 + */ + virtual int unsubscribeStream(const char *user_id, StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 通过设置 IRTCRoomEx{@link #IRTCRoomEx} 对象的事件句柄,监听此对象对应的回调事件。 + * @param room_event_handler 参见 IRTCRoomEventHandlerEx{@link #IRTCRoomEventHandlerEx} + * @return + * + 0: 调用成功。
+ * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + + /** + * + * @type api + * @region 视频管理 + * @brief 设置期望订阅的远端视频流的参数。 + * @param userId 期望配置订阅参数的远端视频流发布用户的 ID。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param remoteVideoConfig 期望配置的远端视频流参数,参看 ByteRTCRemoteVideoConfig{@link #ByteRTCRemoteVideoConfig}。 + * @return 方法调用结果:
+ * + 0:成功;
+ * + !0:失败。 + * @note + * + 若使用 342 及以前版本的 SDK,调用该方法前请联系技术支持人员开启按需订阅功能。
+ * + 该方法仅在发布端调用 setLocalSimulcastMode:{@link #IRTCEngine#setLocalSimulcastMode:} 开启了发送多路视频流的情况下生效,此时订阅端将收到来自发布端与期望设置的参数最相近的一路流;否则订阅端只会收到一路参数为分辨率 640px × 360px、帧率 15fps 的视频流。
+ * + 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。
+ * + 该方法需在进房后调用,若想进房前设置,你需调用 joinRoom:userInfo:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:roomConfig:},并对 `roomConfig` 中的 `remoteVideoConfig` 进行设置。
+ * + SDK 会根据发布端和所有订阅端的设置灵活调整视频流的参数,具体调整策略详见[推送多路流](https: + */ + +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_rts_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_rts_room.h new file mode 100644 index 0000000..ef6a8f8 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_rts_room.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_rts_defines.h" +#include "rtc/bytertc_media_defines.h" +#include "bytertc_rts_room_event_handler.h" + +namespace bytertc { + +/** + * + * @type api + * @brief RTS 房间接口 + */ + +class IRTSRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoom() { + } + + /** + * + * @type api + * @list 房间管理 + * @brief 退出并销毁调用 createRTSRoom{@link #IRTCEngine#createRTSRoom} 所创建的 RTS 房间实例。 + */ + + virtual void destroy() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 离开 RTC 或 RTS 房间。
+ * 用户调用此方法离开房间,结束通话过程,释放所有通话相关的资源。
+ * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
+ * + 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调通知。
+ * + 可见的用户离开房间后,房间内其他用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调通知。
+ * + 如果调用此方法后立即销毁引擎,SDK 将无法触发 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调。
+ * + 调用 joinRoom{@link #IRTCRoom#joinRoom} 或 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 方法加入房间后,必须调用此方法离开房间,否则无法进入下一个房间。无论当前是否在房间内,都可以调用此方法。重复调用此方法没有负面影响。
+ */ + + virtual int leaveRoom() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 设置 IRTSRoom{@link #IRTSRoom} 对象的事件句柄。 + * 通过设置事件句柄可以监听此 IRTSRoom{@link #IRTSRoom} 对象对应的房间的回调事件。 + * @param room_event_handler 回调处理器,详见 IRTSRoomEventHandler{@link #IRTSRoomEventHandler} + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + virtual int setRTSRoomEventHandler(IRTSRoomEventHandler* room_event_handler) = 0; + + /** + * + * @type api + * @list 消息 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param message 用户发送的广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * + 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。
+ * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。 + * + 同一房间内的其他用户会收到 onRoomMessageReceived{@link #IRTSRoomEventHandler#onRoomMessageReceived} 回调。 + */ + + virtual int64_t sendRoomMessage(const char* message) = 0; + /** + * + * @type api + * @list 消息 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param size 发送的二进制消息长度 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * + 在发送房间内二进制消息前,必须先调用 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。
+ * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。
+ * + 同一房间内的其他用户会收到 onRoomBinaryMessageReceived{@link #IRTSRoomEventHandler#onRoomBinaryMessageReceived} 回调。 + */ + + virtual int64_t sendRoomBinaryMessage(int size, const uint8_t* message) = 0; + /** + * + * @type api + * @list 房间管理 + * @brief 创建/加入 RTS 房间。
+ * 同一房间内的用户间可以相互通话。
+ * 进房后重复调用无效,用户必须调用 `leaveRoom` 退出当前房间后,才能加入下一个房间。 + * @param token 用户登录必须携带的 Token,用于鉴权验证。
+ * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,roomId 置为空字符串(即 roomId:""),Token 有效期及生成方式参看[使用 Token 完成鉴权](https: + * @param user_info 用户信息,参看 UserInfo{@link #UserInfo}。 + * @return + * + 0: 成功
+ * + -1:token / user_info 包含了无效的参数。
+ * + -2:已经在房间内。 + * @note
+ * + 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 OnError{@link #IRTCEngineEventHandler#OnError} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。
+ * + 本地用户调用此方法加入房间成功后,会收到回调通知。
+ * + 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,此时 SDK 将会自动重连。重连成功后,本地会收到 回调通知。如果加入房间的用户可见,远端用户会收到 onUserJoined{@link #IRTSRoomEventHandler#onUserJoined}。 + */ + + virtual int joinRTSRoom(const char* token, const UserInfo& user_info) = 0; + /** + * + * @type api + * @brief 更新 Token。
+ * 收到 onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire},onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire}, 或 onSubscribePrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
+ * 如果 Token 无效,你会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged},错误码是 `-1010`。 + * @return 方法调用结果:
+ * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 3.50(不含)以前的版本中,Token 中的发布和订阅权限为保留参数,无实际控制权限;3.50 及以后版本开放 Token 发布订阅控制权限,如需通过 Token 控制连麦权限,请联系技术支持团队开通白名单后支持。 + * - 请勿同时调用 updateToken{@link #IRTSRoom#updateToken} 和 joinRoom{@link #IRTCRoom#joinRoom} 方法更新 Token。若因 Token 过期或无效导致加入房间失败或已被移出房间,你应该在获取新的有效 Token 后调用 joinRoom{@link #IRTCRoom#joinRoom} 重新加入房间。 + * @list 房间管理 + */ + + virtual int updateToken(const char* token) = 0; + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点文本消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内文本消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 或 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。 + * - 调用该函数后会收到一次 onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} 回调,通知消息发送方发送成功或失败; + * - 若文本消息发送成功,则 uid 所指定的用户会收到 onUserMessageReceived{@link #IRTSRoomEventHandler#onUserMessageReceived} 回调。 + * @list 消息 + */ + + virtual int64_t sendUserMessage(const char* uid, const char* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点二进制消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param length 二进制字符串的长度。 + * @param message 二进制消息的内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 或 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。 + * - 调用该函数后会收到一次 onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则 uid 所指定的用户会收到 onUserBinaryMessageReceived{@link #IRTSRoomEventHandler#onUserBinaryMessageReceived} 回调。 + * @list 消息 + */ + + virtual int64_t sendUserBinaryMessage(const char* uid, int length, const uint8_t* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_rts_room_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_rts_room_event_handler.h new file mode 100644 index 0000000..7e9c70d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/bytertc_rts_room_event_handler.h @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Event Handler Interface +*/ + +#pragma once + +#include "rtc/bytertc_defines.h" + +namespace bytertc { +/** + * + * @type callback + * @brief 实时信令事件回调接口 + */ + +class IRTSRoomEventHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoomEventHandler() {} + + /** + * + * @type callback + * @region 房间管理 + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
+ * + 0: 加入房间成功。
+ * + !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ErrorCode{@link #ErrorCode} 及 WarningCode{@link #WarningCode}。 + * @param extra_info 额外信息,如 `{"elapsed":1187,"join_type":0}`。 + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。 + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom{@link #IRTCRoom#joinRoom} 到加入房间成功所经历的时间间隔,单位为 ms。 + * @list 房间管理 + */ + + virtual void onRoomStateChanged(const char* room_id, const char* uid, + int state, const char* extra_info) { + (void)room_id; + (void)state; + (void)extra_info; + } + + /** + * + * @type callback + * @brief 离开房间回调。
+ * 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并在释放所有与通话相关的音频资源后,通过此回调通知用户离开房间成功。
+ * @param stats 保留参数,目前为空。 + * @note
+ * + 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #IRTSRoom#destroy} 销毁房间实例方法销毁 RTS 引擎,则将无法收到此回调事件。
+ * + 离开房间后,如果 App 需要使用系统音频设备,则建议收到此回调后再初始化音频设备,否则可能由于 SDK 占用音频设备而导致初始化失败。
+ * @list 房间管理 + */ + + virtual void onLeaveRoom(const RtcRoomStats& stats) { + (void)stats; + } + + /** + * + * @type callback + * @region 房间管理 + * @brief 远端用户加入房间的回调。 + * @param user_info 用户信息,详见 UserInfo{@link #UserInfo} + * @list 房间管理 + */ + + virtual void onUserJoined(const UserInfo& user_info) { + (void)user_info; + } + + /** + * + * @type callback + * @brief 远端用户离开房间时,本地用户会收到此事件 + * @param uid 离开房间的远端用户 ID。
+ * @param reason 用户离开房间的原因。参看 UserOfflineReason{@link #UserOfflineReason}。 + * @list 房间管理 + */ + + virtual void onUserLeave(const char* uid, UserOfflineReason reason) { + (void)uid; + (void)reason; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内广播消息的回调。 + * @param uid 消息发送者 ID。 + * @param message 收到的消息内容。 + * @note 同一房间内其他用户调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 发送广播消息时会收到该回调。 + * @list 消息 + */ + + virtual void onRoomMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内二进制广播消息的回调。 + * @param uid 消息发送者 ID。 + * @param size
+ * 收到的二进制消息长度 + * @param message 收到的二进制消息内容。 + * @note 同一房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送二进制广播消息时会收到该回调。 + * @list 消息 + */ + + virtual void onRoomBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 当调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 函数发送消息后,回调此条消息的发送结果(反馈)。 + * @param msgid 消息的 ID。 + * @param error 消息发送结果。详见 RoomMessageSendResult{@link #RoomMessageSendResult}。 + * @list 消息 + */ + + virtual void onRoomMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserMessageReceived{@link #IRTSRoomEventHandler#onUserMessageReceived-2} 代替。 + * @brief 收到来自房间中其他用户通过 sendUserMessage{@link #IRTSRoom#sendUserMessage} 发来的点对点文本消息时,会收到此回调。 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @note + * 你必须先调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 方法,才能收到该回调。 + * @list 消息 + */ + + virtual void onUserMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage{@link #IRTSRoom#sendUserBinaryMessage} 发来的点对点二进制消息时,会收到此回调。
+ * > 该接口将于 3.64 被 onUserBinaryMessageReceived{@link #IRTSRoomEventHandler#onUserBinaryMessageReceived-2} 代替。 + * @param uid 消息发送者 ID。 + * @param size 收到的消息长度。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param msgid 消息的 ID。 + * @param error 文本或二进制消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult} + * @note + * 你必须先调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 或 sendUserBinaryMessage{@link #IRTSRoom#sendUserBinaryMessage} 接口,才能收到此回调。 + * @list 消息 + */ + + virtual void onUserMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + + /** + * + * @type callback + * @brief 接收到房间内广播消息的回调。
+ * 同一房间内其他用户调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 发送广播消息时会收到该回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者的 ID。 + * @param message 收到的消息内容。 + * @list 消息 + */ + + virtual void onRoomMessageReceived(int64_t msgid, const char* uid, const char* message) { + (void)msgid; + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。
+ * 房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送广播二进制消息时,收到此回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的二进制消息内容。 + * @param size 收到的二进制消息长度。 + * @note 同一房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送二进制广播消息时会收到该回调。 + * @list 消息 + */ + + virtual void onRoomBinaryMessageReceived(int64_t msgid, const char* uid, const uint8_t* message, int size) { + (void)msgid; + (void)uid; + (void)message; + (void)size; + } + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage{@link #IRTSRoom#sendUserMessage} 发来的点对点文本消息时,会收到此回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @note + * 你必须先调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 方法,才能收到该回调。 + * @list 消息 + */ + + virtual void onUserMessageReceived(int64_t msgid, const char* uid, const char* message) { + (void)msgid; + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage{@link #IRTSRoom#sendUserBinaryMessage} 发来的点对点二进制消息时,会收到此回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @param size 消息长度。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceived(int64_t msgid, const char* uid, const uint8_t* message, int size) { + (void)msgid; + (void)uid; + (void)message; + (void)size; + } +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts.h new file mode 100644 index 0000000..8b0d88a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts.h @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface + */ + +#pragma once + +#include +#include +#include +#include +#include "rtc/bytertc_rts_defines.h" +#include "byterts_event_handler.h" +#include "byterts_room.h" + +namespace byterts { + +class IRTSRoomEventHandler; +/** + * + * @type api + * @brief 引擎API + * IRtcEngine用IRTSEventHandler 注册接口类方法向应用程序发送回调通知 + */ + +class IRTS { +public: + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTS() { + } + + /** + * + * @type api + * @region 引擎管理 + * @brief 设置业务标识参数
+ * 可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。 + * @param business_id
+ * 用户设置的自己的 businessId 值 + * businessId 只是一个标签,颗粒度需要用户自定义。 + * @return
+ * + 0: 成功
+ * + < 0: 失败,具体原因参照 BusinessCheckCode{@link #BusinessCheckCode} 。
+ * + -6001: 用户已经在房间中。
+ * + -6002: 输入非法,合法字符包括所有小写字母、大写字母和数字,除此外还包括四个独立字符,分别是:英文句号,短横线,下划线和 @ 。 + * @note
+ * + 需要在进房之前调用,进房之后调用该方法无效。 + */ + + virtual int setBusinessId(const char* business_id) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 登录 RTS 服务器。 + * 必须先登录,才能发送点对点消息和向应用服务器发送消息
+ * 在调用本接口登录后,如果想要登出,需要调用 logout{@link #IRTS#logout}。
+ * @param [in]token 用户登录必须携带的 Token,用于鉴权验证。 + * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,`roomId` 置空,Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。 + * @param uid
+ * 用户 ID
+ * 用户 ID 在 appid 的维度下是唯一的。 + * @return
+ * + `0`:成功
+ * + `-1`:失败。无效参数
+ * + `-2`:无效调用。用户已经登录。成功登录后再次调用本接口将收到此返回值
+ * @note 本地用户调用此方法登录后,会收到 onLoginResult{@link #IRTSEventHandler#onLoginResult} 回调通知登录结果,远端用户不会收到通知。 + */ + + virtual int login(const char* token, const char* uid) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。 + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
+ * + 调用本接口登出前,必须先调用 login{@link #IRTS#login} 登录。
+ * + 本地用户调用此方法登出后,会收到 onLogout{@link #IRTSEventHandler#onLogout} 回调通知结果,远端用户不会收到通知。 + */ + + virtual int logout() = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 更新用户用于登录的 Token
+ * Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
+ * 调用 login{@link #IRTS#login} 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 onLoginResult{@link #IRTSEventHandler#onLoginResult} 回调通知,错误码为 kLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。 + * @param token
+ * 更新的动态密钥 + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
+ * + 如果 Token 无效导致登录失败,则调用此方法更新 Token 后,SDK 会自动重新登录,而用户不需要自己调用 login{@link #IRTS#login} 方法。
+ * + Token 过期时,如果已经成功登录,则不会受到影响。Token 过期的错误会在下一次使用过期 Token 登录时,或因本地网络状况不佳导致断网重新登录时通知给用户。 + */ + + virtual int updateLoginToken(const char* token) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 设置应用服务器参数
+ * 客户端调用 sendServerMessage{@link #IRTS#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTS#sendServerBinaryMessage} 发送消息给业务服务器之前,必须设置有效签名和业务服务器地址。 + * @param signature 动态签名,应用服务器可使用该签名验证消息来源。
+ * 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。
+ * 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 + * @param url 应用服务器的地址 + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
+ * + 用户必须调用 login{@link #IRTS#login} 登录后,才能调用本接口。
+ * + 调用本接口后,SDK 会使用 onServerParamsSetResult{@link #IRTSEventHandler#onServerParamsSetResult} 返回相应结果。 + */ + + virtual int setServerParams(const char* signature, const char* url) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 查询对端用户或本端用户的登录状态 + * @param peer_user_id
+ * 需要查询的用户 ID + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
+ * + 必须调用 login{@link #IRTS#login} 登录后,才能调用本接口。
+ * + 调用本接口后,SDK 会使用 onGetPeerOnlineStatus{@link #IRTSEventHandler#onGetPeerOnlineStatus} 回调通知查询结果。
+ * + 在发送房间外消息之前,用户可以通过本接口了解对端用户是否登录,从而决定是否发送消息。也可以通过本接口查询自己的登录状态。 + */ + + virtual int getPeerOnlineStatus(const char* peer_user_id) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 给房间外指定的用户发送文本消息(P2P) + * @param uid
+ * 消息接收用户的 ID + * @param message
+ * 发送的文本消息内容
+ * 消息不超过 62KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return
+ * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
+ * + -1:发送失败,RtcEngine 实例未创建
+ * + -2:发送失败,uid 为空 + * @note
+ * + 在发送点对点文本消息,必须先调用 login{@link #IRTS#login} 完成登录。
+ * + 用户调用本接口发送文本信息后,会收到一次 onMessageSendResult{@link #IRTSEventHandler#onMessageSendResult} 回调,得知消息是否成功发送。
+ * + 若文本消息发送成功,则 uid 所指定的用户会通过 onMessageReceived{@link #IRTSEventHandler#onMessageReceived} 回调收到该消息。 + */ + + virtual int64_t sendMessage(const char* uid, const char* message, bytertc::MessageConfig config) = 0; + /** + * + * @type api + * @region 实时消息通信 + * @brief 给房间外指定的用户发送二进制消息(P2P) + * @param uid
+ * 消息接收用户的 ID + * @param length
+ * 二进制字符串的长度 + * @param message
+ * 发送的二进制消息内容
+ * 消息不超过 64KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return
+ * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
+ * + -1:发送失败,RtcEngine 实例未创建
+ * + -2:发送失败,uid 为空 + * @note
+ * + 在发送点对点二进制消息前,必须先调用 login{@link #IRTS#login} 完成登录。
+ * + 用户调用本接口发送二进制消息后,会收到一次 onMessageSendResult{@link #IRTSEventHandler#onMessageSendResult} 回调,通知消息是否发送成功。
+ * + 若二进制消息发送成功,则 uid 所指定的用户会通过 onBinaryMessageReceived{@link #IRTSEventHandler#onBinaryMessageReceived} 回调收到该条消息。 + */ + + virtual int64_t sendBinaryMessage(const char* uid, int length, const uint8_t* message, bytertc::MessageConfig config) = 0; + /** + * + * @type api + * @region 实时消息通信 + * @brief 客户端给应用服务器发送文本消息(P2Server) + * @param message
+ * 发送的文本消息内容
+ * 消息不超过 62KB。 + * @return
+ * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
+ * + -1:发送失败,RtcEngine 实例未创建 + * @note
+ * + 在向业务服务器发送文本消息前,必须先调用 login{@link #IRTS#login} 完成登录,随后调用 setServerParams{@link #IRTS#setServerParams} 设置业务服务器。
+ * + 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTSEventHandler#onServerMessageSendResult} 回调,通知消息发送方是否发送成功。
+ * + 若文本消息发送成功,则之前调用 setServerParams{@link #IRTS#setServerParams} 设置的业务服务器会收到该条消息。 + */ + + virtual int64_t sendServerMessage(const char* message) = 0; + /** + * + * @type api + * @region 实时消息通信 + * @brief 客户端给应用服务器发送二进制消息(P2Server) + * @param length
+ * 二进制字符串的长度 + * @param message
+ * 发送的二进制消息内容
+ * 消息不超过 64KB。 + * @return
+ * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
+ * + -1:发送失败,RtcEngine 实例未创建 + * @note
+ * + 在向业务服务器发送二进制消息前,必须先调用 login{@link #IRTS#login} 完成登录,随后调用 setServerParams{@link #IRTS#setServerParams} 设置业务服务器。
+ * + 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTSEventHandler#onServerMessageSendResult} 回调,通知消息发送方发送成功或失败。
+ * + 若二进制消息发送成功,则之前调用 setServerParams{@link #IRTS#setServerParams} 设置的业务服务器会收到该条消息。 + */ + + virtual int64_t sendServerBinaryMessage(int length, const uint8_t* message) = 0; + + /** + * + * @type api + * @region 房间管理 + * @brief 创建房间实例。 + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom{@link #IRTCRoom#joinRoom} 才能真正地创建/加入房间。 + * 多次调用此方法以创建多个 IRTSRoom{@link #IRTSRoom} 实例。分别调用各 IRTSRoom 实例中的 joinRoom{@link #IRTCRoom#joinRoom} 方法,同时加入多个房间。 + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTSRoom{@link #IRTSRoom} 房间实例。 + * @note
+ * + 如果需要加入的房间已存在,你仍需先调用本方法来获取 IRTSRoom 实例,再调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。 + * + 多房间模式下,创建多个房间实例需要使用不同的 room_id,否则会导致创建房间失败。 + */ + + virtual IRTSRoom* createRoom(const char* room_id) = 0; + + /** + * + * @type api + * @region 引擎管理 + * @brief 设置运行时的参数 + * @param json_string json 序列化之后的字符串 + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + */ + + virtual int setRuntimeParameters(const char * json_string) = 0; + + /** + * + * @hidden(macOS, Windows, Linux) + * @type api + * @brief 启用蜂窝网络辅助增强,改善通话质量。 + * @param enhance 是否开启。默认不开启。 + * @return 方法调用结果:
+ * + 0: 成功。
+ * + -1:失败,内部错误。
+ */ + + virtual int setCellularEnhancement(bool enhance) = 0; + + /** + * + * @type api + * @region 代理 + * @brief 设置本地代理 + * @param configurations 本地代理配置参数。参看 LocalProxyConfiguration{@link #LocalProxyConfiguration}。
+ * 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。
+ * 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 + * @param configuration_num 本地代理配置参数的数量。 + * @note 要设置本地代理,调用 setLocalProxy{@link #IRTS#setLocalProxy}。 + */ + + virtual int setLocalProxy( + const bytertc::LocalProxyConfiguration* configurations, + int configuration_num) = 0; + + /** + * + * @type api + * @region 引擎管理 + * @brief 创建 RTCEngine 实例。
+ * 如果当前线程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
+ * 如果当前线程中已创建了引擎实例,再次调用此方法时,会创建另一个独立的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param event_handler SDK 回调给应用层的 Callback 对象,详见 IRTSEventHandler{@link #IRTSEventHandler} 。 + * @return
+ * + IRTS:创建成功。返回一个可用的 IRTS{@link #IRTS} 实例
+ * + Null:创建失败。 + * @note
+ * + 如果你在同一个线程中创建了多个引擎实例,这些实例必须分别调用 destroyRTS{@link #destroyRTS} 销毁。 + * + 在 Linux 平台上创建引擎实例的数量取决于系统的硬件性能。 + */ + + static BYTERTC_STATIC_API IRTS* createRTS(const bytertc::EngineConfig& config, IRTSEventHandler* event_handler); + + /** + * + * @type api + * @region 引擎管理 + * @brief 销毁由 createRTS{@link #createRTS} 创建的 RTCEngine 实例,并释放所有相关资源。 + * @param engine createRTS{@link #createRTS} 时,返回的实例。 + * @note
+ * + 请确保和需要销毁的 IRTS{@link #IRTS} 实例相关的业务场景全部结束后,才调用此方法。
+ * + 该方法在调用之后,会销毁所有和此 IRTS{@link #IRTS} 实例相关的内存,并且停止与媒体服务器的任何交互。
+ * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ + + static BYTERTC_STATIC_API void destroyRTS(); + + /** + * + * @type api + * @region 引擎管理 + * @brief 获取当前 SDK 版本信息。 + * @return 当前 SDK 版本信息。 + */ + + static BYTERTC_STATIC_API const char* getSDKVersion(); + + /** + * + * @type api + * @region 引擎管理 + * @brief 配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。 + * @param log_config 本地日志参数,参看 LogConfig{@link #LogConfig}。 + * @return
+ * + 0:成功。 + * + –1:失败,本方法必须在创建引擎前调用。 + * + –2:失败,参数填写错误。 + * @note 本方法必须在调用 createRTS{@link #createRTS} 之前调用。 + */ + + static BYTERTC_STATIC_API int setLogConfig(const bytertc::LogConfig& log_config); +}; +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_event_handler.h new file mode 100644 index 0000000..f121d32 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_event_handler.h @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Event Handler Lite +*/ + +#pragma once + +#include "rtc/bytertc_rts_defines.h" + +namespace byterts { +/** + * + * @type callback + * @brief 实时信令事件回调接口 + */ + +class IRTSEventHandler { +public: + + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRTSEventHandler() { + } + + /** + * + * @type callback + * @region 警告码 + * @brief 当内部发生警告事件时触发该回调 + * @param warn + * 警告标识码,详见:WarningCode{@link #WarningCode} + */ + + virtual void onWarning(int warn) { + (void)warn; + } + + /** + * + * @type callback + * @region 错误码 + * @brief 当 SDK 内部发生不可逆转错误时触发该回调。 + * @param err 错误标识码,参看 ErrorCode{@link #ErrorCode} + */ + + virtual void onError(int err) { + (void)err; + } + + /** + * + * @valid since 3.52 + * @type callback + * @brief 当访问插件失败时,收到此回调。 + * RTC SDK 将一些功能封装成插件。当使用这些功能时,如果插件不存在,功能将无法使用。 + * @param extension_name 插件名字 + * @param msg 失败说明 + */ + + void onExtensionAccessError(const char* extension_name, const char* msg) { + (void)extension_name; + (void)msg; + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief 端监控日志回调。当产生一个端监控事件时触发该回调。 + * @param log_type
+ * 事件类型。目前类型固定为 "live_webrtc_monitor_log"。 + * @param log_content
+ * 端监控日志内容。 + */ + + virtual void onLogReport(const char* log_type, const char* log_content) { + (void)log_type; + (void)log_content; + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief SDK 与信令服务器连接状态改变回调。连接状态改变时触发。 + * @param state 当前 SDK 与信令服务器的连接状态,详见 ConnectionState{@link #ConnectionState}。 + * @note 更多信息参见 [连接状态提示](https: + */ + + virtual void onConnectionStateChanged(bytertc::ConnectionState state) { + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief SDK 当前网络连接类型改变回调。当 SDK 的当前网络连接类型发生改变时回调该事件。 + * @param type
+ * SDK 当前的网络连接类型,详见:NetworkType{@link #NetworkType} 。 + */ + + virtual void onNetworkTypeChanged(bytertc::NetworkType type) { + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief 周期性(2s)地发出回调,报告当前cpu与memory使用率 + * @param stats 返回包含当前系统状态信息的结构体,详见 SysStats{@link #SysStats} + */ + + virtual void onSysStats(const bytertc::SysStats& stats) { + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief 创建房间失败回调。 + * @param room_id 房间 ID。 + * @param error_code 创建房间错误码,具体原因参看 ErrorCode{@link #ErrorCode}。 + */ + + virtual void onCreateRoomStateChanged(const char* room_id, int error_code) { + (void)room_id; + (void)error_code; + } + + /** + * + * @type callback + * @deprecated 在3.52及之后废弃,将在3.57删除,使用 onLocalProxyStateChanged{@link #IRTSEventHandler#onLocalProxyStateChanged} 替换 + * @region 代理回调 + * @brief HTTP 代理连接状态改变时,收到该回调。 + * @param state 当前 HTTP 代理连接状态,详见 HttpProxyState{@link #HttpProxyState} + */ + + virtual void onHttpProxyState(int state) { + } + + /** + * + * @type callback + * @deprecated 在3.52及之后废弃,将在3.57删除,使用 onLocalProxyStateChanged{@link #IRTSEventHandler#onLocalProxyStateChanged} 替换 + * @region 代理回调 + * @brief HTTPS 代理连接状态改变时,收到该回调。 + * @param state 当前 HTTPS 代理连接状态,详见 HttpProxyState{@link #HttpProxyState} + */ + + virtual void onHttpsProxyState(int state) { + } + + /** + * + * @type callback + * @deprecated 在3.52及之后废弃,将在3.57删除,使用 onLocalProxyStateChanged{@link #IRTSEventHandler#onLocalProxyStateChanged} 替换 + * @region 代理回调 + * @brief Socks5 代理状态改变时,收到该回调。 + * @param state SOCKS5 代理连接状态,详见 Socks5ProxyState{@link #Socks5ProxyState} + * @param cmd 代理连接的每一步操作命令 + * @param proxy_address 代理地址信息 + * @param local_address 当前连接使用的本地地址 + * @param remote_address 远端的连接地址 + */ + + virtual void onSocks5ProxyState(int state, + const char* cmd, + const char* proxy_address, + const char* local_address, + const char* remote_address) { + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 登录结果回调 + * @param uid
+ * 登录用户 ID + * @param error_code
+ * 登录结果
+ * 详见 LoginErrorCode{@link #LoginErrorCode}。 + * @param elapsed
+ * 从调用 login{@link #IRTS#login} 接口开始到返回结果所用时长
+ * 单位为 ms。 + * @note 调用 login{@link #IRTS#login} 后,会收到此回调。 + */ + + virtual void onLoginResult(const char* uid, int error_code, int elapsed) { + (void)uid; + (void)error_code; + (void)elapsed; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 登出结果回调 + * @param reason 用户登出的原因,参看 LogoutReason{@link #LogoutReason} + * @note 在以下两种情况下会收到此回调:调用 logout{@link #IRTS#logout} 接口主动退出;或其他用户以相同 UserId 进行 `login` 导致本地用户被动登出。 + */ + + virtual void onLogout(bytertc::LogoutReason reason) { + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 设置应用服务器参数的返回结果 + * @param error
+ * 设置结果
+ * + 返回 200,设置成功
+ * + 返回其他,设置失败 + * @note 调用 setServerParams{@link #IRTS#setServerParams} 后,会收到此回调。 + */ + + virtual void onServerParamsSetResult(int error) { + (void)error; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 查询对端或本端用户登录状态的返回结果 + * @param peer_user_id 需要查询的用户 ID。 + * @param status 查询的用户登录状态。详见 UserOnlineStatus{@link #UserOnlineStatus}。 + * @note 必须先调用 getPeerOnlineStatus{@link #IRTS#getPeerOnlineStatus},才能收到此回调。 + */ + + virtual void onGetPeerOnlineStatus(const char* peer_user_id, int status) { + (void)peer_user_id; + (void)status; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 收到房间外用户调用 sendMessage{@link #IRTS#sendMessage} 发来的文本消息时,会收到此回调 + * @param uid 消息发送者 ID。 + * @param message
+ * 收到的文本消息内容 + */ + + virtual void onMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 收到房间外用户调用 sendBinaryMessage{@link #IRTS#sendBinaryMessage} 发来的二进制消息时,会收到此回调。 + * @param uid 消息发送者 ID。 + * @param size 二进制消息长度。 + * @param message 收到的二进制消息内容。 + */ + + virtual void onBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 给房间外指定的用户发送消息的回调。 + * @param msgid 消息的 ID。
+ * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果。详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @note 当调用 sendMessage{@link #IRTS#sendMessage} 或 sendBinaryMessage{@link #IRTS#sendBinaryMessage} 发送消息后,会收到此回调。 + */ + + virtual void onMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 给应用服务器发送消息的回调 + * @param msgid 本条消息的 ID
+ * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @param message 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。 + * @note 当调用 sendServerMessage{@link #IRTS#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTS#sendServerBinaryMessage} 发送消息后,会收到此回调。 + */ + + virtual void onServerMessageSendResult(int64_t msgid, int error, const bytertc::ServerACKMsg& msg) { + (void)msgid; + (void)error; + (void)msg; + } + + /** + * + * @type callback + * @brief 调用 StartCloudProxy{@link #IRtcEngineLite#StartCloudProxy} 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。 + * @param interval 从开启云代理到连接成功经过的时间,单位为 ms + */ + + virtual void onCloudProxyConnected(int interval) { + (void)interval; + } + + /** + * + * @type callback + * @brief 调用 setLocalProxy{@link #IRTS#setLocalProxy} 设置本地代理,SDK对代理连接的状态 + * 回调此接口。 + * @param local_proxy_type 本地代理类型:sock5 或 httptunnel + * @param local_proxy_state 本地代理状态。参看 LocalProxyState{@link #LocalProxyState}。
+ * @param local_proxy_error 本地代理错误。参看 LocalProxyError{@link #LocalProxyError}。
+ */ + + virtual void onLocalProxyStateChanged(bytertc::LocalProxyType local_proxy_type, bytertc::LocalProxyState local_proxy_state, bytertc::LocalProxyError local_proxy_error) { + (void)local_proxy_type; + (void)local_proxy_state; + (void)local_proxy_error; + } +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_room.h new file mode 100644 index 0000000..5c8952e --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_room.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_rts_defines.h" +#include "byterts_room_event_handler.h" + +namespace byterts { + +/** + * + * @type api + * @brief 房间接口 + */ + +class IRTSRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoom() { + } + + /** + * + * @type api + * @list 房间管理 + * @brief 退出并销毁调用 createRoom{@link #IRTS#createRoom} 所创建的房间实例。 + */ + + virtual void destroy() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 创建/加入 RTS 房间:房间不存在时即创建房间;房间存在时,未加入房间的用户可加入这个房间。
+ * 同一房间内的用户间可以相互通话。
+ * 进房后重复调用无效,用户必须调用 `leaveRoom` 退出当前房间后,才能加入下一个房间。 + * @return
+ * + 0: 成功
+ * + -1:room_id / user_info.uid 包含了无效的参数。
+ * + -2:已经在房间内。 + * @note
+ * + 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 OnError{@link #IRTCAudioEventHandler#OnError} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。
+ * + 本地用户调用此方法加入房间成功后,会收到 回调通知。
+ * + 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,此时 SDK 将会自动重连。重连成功后,本地会收到 回调通知。如果加入房间的用户可见,远端用户会收到 onUserJoined{@link #IRTSRoomEventHandler#onUserJoined}。 + */ + + virtual int joinRoom() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 离开 RTS 房间。
+ * 用户调用此方法离开房间,结束通话过程,释放所有通话相关的资源。
+ * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
+ * + 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调通知。
+ * + 可见的用户离开房间后,房间内其他用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调通知。
+ * + 如果调用此方法后立即销毁引擎,SDK 将无法触发 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调。
+ * + 调用 joinRoom{@link #IRTCRoom#joinRoom} 方法加入房间后,必须调用此方法离开房间,否则无法进入下一个房间。无论当前是否在房间内,都可以调用此方法。重复调用此方法没有负面影响。
+ */ + + virtual int leaveRoom() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 设置 IRTSRoom{@link #IRTSRoom} 对象的事件句柄。 + * 通过设置事件句柄可以监听此 IRTSRoom{@link #IRTSRoom} 对象对应的房间的回调事件。 + * @param room_event_handler 回调处理器,详见 IRTSRoomEventHandler{@link #IRTSRoomEventHandler} + * @return
+ * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + virtual int setRTSRoomEventHandler(IRTSRoomEventHandler* room_event_handler) = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param message 用户发送的广播消息,消息不超过 62KB。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note
+ * + 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。
+ * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。
+ * + 同一房间内的其他用户会收到 onRoomMessageReceived{@link #IRTSRoomEventHandler#onRoomMessageReceived} 回调。 + */ + + virtual int64_t sendRoomMessage(const char* message) = 0; + /** + * + * @type api + * @list 消息 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param size 发送的二进制消息长度 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * + 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。
+ * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。
+ * + 同一房间内的其他用户会收到 onRoomBinaryMessageReceived{@link #IRTSRoomEventHandler#onRoomBinaryMessageReceived} 回调。 + */ + + virtual int64_t sendRoomBinaryMessage(int size, const uint8_t* message) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_room_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_room_event_handler.h new file mode 100644 index 0000000..dcf9351 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/byterts_room_event_handler.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Event Handler Interface +*/ + +#pragma once + +namespace byterts { +/** + * + * @type callback + * @brief 实时信令事件回调接口 + */ + +class IRTSRoomEventHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoomEventHandler() {} + + /** + * + * @type callback + * @region 房间管理 + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
+ * + 0: 加入房间成功。
+ * + !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ErrorCode{@link #ErrorCode} 及 WarningCode{@link #WarningCode}。 + * @param extra_info 额外信息,如 `{"elapsed":1187,"join_type":0}`。 + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。 + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom{@link #IRTCRoom#joinRoom} 到加入房间成功所经历的时间间隔,单位为 ms。 + */ + + virtual void onRoomStateChanged(const char* room_id, const char* uid, + int state, const char* extra_info) { + (void)room_id; + (void)state; + (void)extra_info; + } + + /** + * + * @type callback + * @region 房间管理 + * @brief 离开房间回调。
+ * 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并在释放所有与通话相关的音频资源后,通过此回调通知用户离开房间成功。
+ * @note
+ * + 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #IRTSRoom#destroy} 销毁房间实例方法销毁 RTS 引擎,则将无法收到此回调事件。
+ * + 离开房间后,如果 App 需要使用系统音频设备,则建议收到此回调后再初始化音频设备,否则可能由于 SDK 占用音频设备而导致初始化失败。
+ */ + + virtual void onLeaveRoom() { + } + + /** + * + * @deprecated since 3.41 and will be deleted in 3.51, user instead. + * @type callback + * @region 房间管理 + * @brief SDK 发生警告回调。
+ * SDK内部遇到可恢复错误时,在尝试自动恢复的同时,会通过此回调通知用户。此回调事件仅用作通知。
+ * @param warn 警告码,参看 WarningCode{@link #WarningCode}。
+ */ + + virtual void onRoomWarning(int warn) { + (void)warn; + } + + /** + * + * @deprecated since 3.41 and will be deleted in 3.51. + * @type callback + * @region 房间管理 + * @brief SDK 发生错误回调。
+ * SDK 内部遇到不可恢复错误时,会通过此回调通知 App,需要 App 根据错误码进行操作或提示用户。
+ * @param err 错误码,参看 ErrorCode{@link #ErrorCode}。
+ */ + + virtual void onRoomError(int err) { + (void)err; + } + + /** + * + * @type callback + * @region 房间管理 + * @brief 远端用户加入房间的回调。 + * @param uid 加入房间的用户 ID
+ * @param elapsed 此参数无意义 + */ + + virtual void onUserJoined(const char* uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** + * + * @type callback + * @brief 远端用户离开房间时,本地用户会收到此事件 + * @param uid 离开房间的远端用户 ID。 + * @param reason 用户离开房间的原因。参看 UserOfflineReason{@link #UserOfflineReason}。 + */ + + virtual void onUserLeave(const char* uid, bytertc::UserOfflineReason reason) { + (void)uid; + (void)reason; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内广播消息的回调。
+ * 当房间内的其他用户调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 时,你会收到此回调。 + * @param uid 发送该消息的用户的 ID。 + * @param message 收到的消息内容。 + */ + + virtual void onRoomMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内二进制广播消息的回调。
+ * 同一房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送二进制广播消息时会收到该回调。 + * @param uid 发送该消息的用户的 ID。 + * @param size 收到的二进制消息长度。 + * @param message 收到的二进制消息内容。 + */ + + virtual void onRoomBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 当调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 函数发送消息后,回调此条消息的发送结果(反馈)。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果。详见 RoomMessageSendResult{@link #RoomMessageSendResult}。 + */ + + virtual void onRoomMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_advance.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_advance.h new file mode 100644 index 0000000..0c81547 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_advance.h @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Advance API +*/ + +#pragma once + +#include "../bytertc_engine.h" + +#include +#ifdef __ANDROID__ +#include "jni.h" +#endif + + +#ifdef __GNUC__ +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +namespace bytertc { +/** + * + * @hidden for internal use only + * @brief 设置应用的状态 + * @param engine
+ * 要通知的引擎 + * @param app_state 应用状态字符串 + */ + +BYTERTC_API void setAppState(void* engine, const char* app_state); +/** + * + * @hidden(iOS,macOS,Windows,Linux) for internal use only + * @type api + * @brief 用于设置 Android 的 ApplicationContext 给 Engine 使用,
+ * 如果 Android 使用纯 C++接口,则该方法必须在引擎创建前设置 + * @param j_egl_context
+ * 传入 Java 的 android.content.Context 类型的 EGLContext + * @list 引擎管理 + */ + +BYTERTC_API void setApplicationContext(void* j_application_context); +BYTERTC_API int setLogConfig(const LogConfig& log_config); + +/** + * + * @region 视频管理 + * @type keytype + * @brief 硬件加速设备类型 + */ + +enum HWDeviceType { + /** + * + * @brief 未知的设备类型 + */ + + kHWDeviceTypeNone, + + /** + * + * @brief direct3d 11 视频加速设备 + */ + + kHWDeviceTypeD3D11, + + /** + * + * @brief cuda 硬件加速设备 + * @note cuda 是 nvidia 平台下硬件加速设备 + */ + + kHWDeviceTypeCuda, + + /** + * + * @brief intel 平台下 qsv 加速设备 + */ + + kHWDeviceTypeQsv, + + /** + * + * @brief windows 平台 dx 硬件加速设备 + */ + + kHWDeviceTypeDxva2, + + /** + * + * @brief Android 平台下硬件加速设备 mediacodec + */ + + kHWDeviceTypeMediaCodec, + + /** + * + * @brief IOS、MACOS 平台下硬件加速设备 VideoToolbox + */ + + kHWDeviceTypeVideoToolbox, + /** + * + * @brief android、linux 平台下硬件加速设备 egl context + */ + + kHWDeviceTypeEglContext, + + /** + * + * @brief linux、windows 平台下硬件加速设备 va context + */ + + kHWDeviceTypeVaapi, +}; + +/** + * + * @hidden(macOS, Linux, iOS, Android) + * @type keytype + * @brief 硬编码设备 context + */ + +enum HWDeviceContextKey { + /** + * + * @brief cuda context + */ + + kHWDeviceContextKeyCudaContext, + /** + * + * @brief derict3D11 设备 + */ + + kHWDeviceContextKeyD3D11Device, + /** + * + * @brief derict3D11 设备 context + */ + + kHWDeviceContextKeyD3D11DeviceContext, + /** + * + * @brief egl 设备 context + */ + + kHWDeviceContextKeyEglContext, + /** + * + * @brief vadisplay 设备 context + */ + + kHWDeviceContextKeyVADisplay, +}; + +/** + * + * @hidden(macOS, Linux, iOS, Android) + * @type keytype + * @brief 硬件加速设备 context + */ + +class IHWDeviceContext { +public: + virtual ~IHWDeviceContext() = default; + /** + * + * @brief 获取硬件加速设备 context 类型 + * @return 硬件加速设备类型,详见 HWDeviceType{@link #HWDeviceType} + */ + + virtual HWDeviceType deviceType() const = 0; + /** + * + * @brief 设置属性 + * @param key 硬件加速设备 context 类型,详见 HWDeviceContextKey{@link #HWDeviceContextKey} + * @param value 指向硬件加速设备 context 地址的指针 + */ + + virtual void setProperty(HWDeviceContextKey key, void* value) = 0; + /** + * + * @brief 获取属性 + * @param key 硬件加速设备 context 类型,详见 HWDeviceContextKey{@link #HWDeviceContextKey} + * @return 返回硬件加速设备 context 地址的指针 + */ + + virtual void* getProperty(HWDeviceContextKey key) = 0; + /** + * + * @brief 内部 context 是否由该实例拥有 + * @return + * - true: 硬件设备 context 被实例对象拥有 + * - false: 硬件设备上 context 文不被实例对象拥有 + */ + + virtual bool ownContext() const = 0; + /** + * + * @brief 设置 context 是否被实例对象拥有 + * @param own_context
+ * - true: context 被实例对象拥有 + * - false: context 不被实例对象拥有 + */ + + virtual void setOwnContext(bool own_context) = 0; + /** + * + * @brief 转移硬件设备 context, + * @return 指向硬件设备 context 的指针 + */ + + virtual IHWDeviceContext* moveContext() = 0; + /** + * + * @brief 释放实例对象 + */ + + virtual void release() = 0; +}; + +/** + * + * @hidden for internal use only + * @brief 创建一个具有指定设备类型的硬件设备上下文 + */ + + +BYTERTC_API IHWDeviceContext* createHwDeviceContext(HWDeviceType device_type); + +/** + * + * @hidden for internal use only + * @brief 设置视频源的设备上下文信息 + * @param engine
+ * 要设置的引擎,详见 IRTCEngine{@link #IRTCEngine} + * @param hw_context
+ * 设置视频帧,详见:IHWDeviceContext{@link #IHWDeviceContext} + * @note 用于硬件编码传入 GPU 内存时使用 + */ + +BYTERTC_API void setVideoSourceHWDeviceContext(void* engine, IHWDeviceContext* hw_context); + +/** + * + * @hidden for internal use only + * @type callback + * @brief 本地音频帧监测器 + * @list 自定义流处理 + */ + +class ILocalEncodedAudioFrameObserver { +public: + virtual ~ILocalEncodedAudioFrameObserver() { + } + /** + * + * @type callback + * @brief 调用 RegisterLocalEncodedAudioFrameObserver 后,SDK 收到本地音频帧信息时,回调该事件 + * @param audio_source 本地音频源类型,详见 IAudioSource{@link #IAudioSource} + * @param audio_stream 本地音频帧信息,参看 IEncodedAudioFrame + * @list 自定义流处理 + */ + + virtual void onLocalEncodedAudioFrame(IAudioSource* audio_source, const EncodedAudioFrameData& audio_stream) = 0; +}; +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_defines.h new file mode 100644 index 0000000..1a35cd8 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_defines.h @@ -0,0 +1,2275 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Defines + */ + +#pragma once + +#include "bytertc_media_defines.h" +#include +#include + +#define SPECTRUM_SIZE 257 + +namespace bytertc { +/** + * + * @type keytype + * @brief 音频采样率,单位为 Hz。 + */ + +enum AudioSampleRate { + /** + * + * @brief 默认设置。48000Hz。 + */ + + kAudioSampleRateAuto = -1, + /** + * + * @brief 8000Hz + */ + + kAudioSampleRate8000 = 8000, + /** + * + * @brief 11025Hz + */ + + kAudioSampleRate11025 = 11025, + /** + * + * @brief 16000Hz + */ + + kAudioSampleRate16000 = 16000, + /** + * + * @brief 22050Hz + */ + + kAudioSampleRate22050 = 22050, + /** + * + * @brief 24000Hz + */ + + kAudioSampleRate24000 = 24000, + /** + * + * @brief 32000Hz + */ + + kAudioSampleRate32000 = 32000, + /** + * + * @brief 44100Hz + */ + + kAudioSampleRate44100 = 44100, + /** + * + * @brief 48000Hz + */ + + kAudioSampleRate48000 = 48000 +}; +/** + * + * @type keytype + * @brief 音频声道。 + */ + +enum AudioChannel { + /** + * + * @brief 默认设置。 + */ + + kAudioChannelAuto = -1, + /** + * + * @brief 单声道 + */ + + kAudioChannelMono = 1, + /** + * + * @brief 双声道 + */ + + kAudioChannelStereo = 2 +}; + +/** + * + * @type keytype + * @brief 音频格式 + */ + +struct AudioFormat { + /** + * + * @brief 音频采样率,详见 AudioSampleRate{@link #AudioSampleRate} + */ + + AudioSampleRate sample_rate = kAudioSampleRateAuto; + /** + * + * @brief 音频声道,详见 AudioChannel{@link #AudioChannel} + */ + + AudioChannel channel = kAudioChannelAuto; + /** + * + * @brief 单次回调的音频帧中包含的采样点数。默认值为 `0`,此时,采样点数取最小值。
+ * 最小值为回调间隔是 0.01s 时的值,即 `sampleRate * channel * 0.01s`。
+ * 最大值是 `2048`。超出取值范围时,采样点数取默认值。
+ * 该参数仅在设置读写回调时生效,调用 enableAudioFrameCallback{@link #IRTCEngine#enableAudioFrameCallback} 开启只读模式回调时设置该参数不生效。 + */ + + int samples_per_call = 0; +}; +/** + * + * @type keytype + * @brief 返回给音频处理器的音频类型。 + */ + +enum AudioProcessorMethod{ + /** + * + * @brief 本地采集的音频。 + */ + + kAudioProcessorMethodRecord = 0, + /** + * + * @brief 远端音频流的混音音频。 + */ + + kAudioProcessorMethodPlayback = 1, + /** + * + * @brief 各个远端音频流。 + */ + + kAudioProcessorMethodRemoteUser = 2, + /** + * + * @hidden(Windows,Linux,macOS) + * @brief 软件耳返音频。 + */ + + kAudioProcessorMethodEarMonitor = 3, + /** + * + * @hidden(Linux) + * @brief 屏幕共享音频。 + */ + + kAudioProcessorMethodScreen = 4, +}; +/** + * + * @type keytype + * @brief 音频设备类型 + */ + +enum RTCAudioDeviceType { + /** + * + * @brief 未知设备类型 + */ + + kRTCAudioDeviceTypeUnknown = -1, + /** + * + * @brief 音频渲染设备 + */ + + kRTCAudioDeviceTypeRenderDevice = 0, + /** + * + * @brief 音频采集设备 + */ + + kRTCAudioDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流音频设备 + */ + + kRTCAudioDeviceTypeScreenCaptureDevice = 2, +}; + +/** + * + * @type keytype + * @brief 音频播放设备 + */ + +enum AudioRoute { + /** + * + * @brief 默认设备 + */ + + kAudioRouteDefault = -1, + /** + * + * @brief 有线耳机 + */ + + kAudioRouteHeadset = 1, + /** + * + * @brief 听筒 + */ + + kAudioRouteEarpiece = 2, + /** + * + * @brief 扬声器 + */ + + kAudioRouteSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + kAudioRouteHeadsetBluetooth = 4, + /** + * + * @brief USB 设备 + */ + + kAudioRouteHeadsetUSB = 5 +}; + +/** + * + * @type keytype + * @brief 音频播放设备 + */ + +enum AudioPlaybackDevice { + /** + * + * @brief 有线耳机 + */ + + kAudioPlaybackDeviceHeadset = 1, + /** + * + * @brief 听筒 + */ + + kAudioPlaybackDeviceEarpiece = 2, + /** + * + * @brief 扬声器 + */ + + kAudioPlaybackDeviceSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + kAudioPlaybackDeviceHeadsetBluetooth = 4, + /** + * + * @brief USB 设备 + */ + + kAudioPlaybackDeviceHeadsetUSB = 5 +}; + +/** + * + * @type keytype + * @brief 音频场景类型。
+ * 选择音频场景后,SDK 会根据操作系统和开麦、闭麦状态,应用通话音量或媒体音量。参看[通话音量与媒体音量](https: + * 你可以调用 `setAudioScenario` 设置音频场景。
+ * 如果以下音频场景类型无法满足你的业务需要,请联系技术支持人员。 + */ + +enum AudioScenarioType { + /** + * + * @brief 默认场景,适用大部分场景。 + */ + + kAudioScenarioTypeDefault = 0, + /** + * + * @brief 聊天室场景。通话清晰度较高,适用于会议,聊天室场景。 + */ + + kAudioScenarioTypeChatRoom = 1, + /** + * + * @brief 高音质场景。适用于音乐为主的场景,如 KTV,音乐聊天室等。 + */ + + kAudioScenarioTypeGameStreaming = 2, + /** + * + * @brief 合唱场景。延迟较低。 + */ + + kAudioScenarioTypeChorus = 3, + /** + * + * @brief 教育场景。适用于以人声教学内容为主的高音质场景。 + */ + + kAudioScenarioTypeEducation = 4, + /** + * + * @brief AI 对话场景。适用于真人与 AI 智能体互动的场景。使用此场景时,还需在通过 `createRTCEngine` 创建引擎时,通过 parameters 字段传入私有参数 `"rtc.fg_config":"aigc_media_360=true"`。 + */ + + kAudioScenarioTypeAiClient = 5, + +}; + +/** + * + * @type keytype + * @brief 变声特效类型。如需更多类型,联系技术支持。 + */ + +enum VoiceChangerType { + /** + * + * @brief 原声,不含特效 + */ + + kVoiceChangerTypeOriginal = 0, + /** + * + * @brief 巨人 + */ + + kVoiceChangerTypeGiant = 1, + /** + * + * @brief 花栗鼠 + */ + + kVoiceChangerTypeChipmunk = 2, + /** + * + * @brief 小黄人 + */ + + kVoiceChangerTypeMinionst = 3, + /** + * + * @brief 颤音 + */ + + kVoiceChangerTypeVibrato = 4, + /** + * + * @brief 机器人 + */ + + kVoiceChangerTypeRobot = 5, +}; + +/** + * + * @type keytype + * @brief 混响特效类型 + */ + +enum VoiceReverbType { + /** + * + * @brief 原声,不含特效 + */ + + kVoiceReverbTypeOriginal = 0, + /** + * + * @brief 回声 + */ + + kVoiceReverbTypeEcho = 1, + /** + * + * @brief 演唱会 + */ + + kVoiceReverbTypeConcert = 2, + /** + * + * @brief 空灵 + */ + + kVoiceReverbTypeEthereal = 3, + /** + * + * @brief KTV + */ + + kVoiceReverbTypeKTV = 4, + /** + * + * @brief 录音棚 + */ + + kVoiceReverbTypeStudio = 5, + /** + * + * @brief 虚拟立体声 + */ + + kVoiceReverbTypeVirtualStereo = 6, + /** + * + * @brief 空旷 + */ + + kVoiceReverbTypeSpacious = 7, + /** + * + * @brief 3D 人声 + */ + + kVoiceReverbType3D = 8, + /** + * + * @hidden for internal use only + * @brief 流行 + */ + + kVoiceReverbTypePop = 9, + /** + * + * @hidden for internal use only + * @brief 蹦迪 + */ + + kVoiceReverbTypeDisco = 10, + /** + * + * @hidden for internal use only + * @brief 老唱片 + */ + + kVoiceReverbTypeOldRecord = 11, + /** + * + * @hidden for internal use only + * @brief 和声 + */ + + kVoiceReverbTypeHarmony = 12, + /** + * + * @hidden for internal use only + * @brief 摇滚 + */ + + kVoiceReverbTypeRock = 13, + /** + * + * @hidden for internal use only + * @brief 蓝调 + */ + + kVoiceReverbTypeBlues = 14, + /** + * + * @hidden for internal use only + * @brief 爵士 + */ + + kVoiceReverbTypeJazz = 15, + /** + * + * @hidden for internal use only + * @brief 电子 + */ + + kVoiceReverbTypeElectronic = 16, + /** + * + * @hidden for internal use only + * @brief 黑胶 + */ + + kVoiceReverbTypeVinyl = 17, + /** + * + * @hidden for internal use only + * @brief 密室 + */ + + kVoiceReverbTypeChamber = 18, + /** + * + * @hidden for internal use only + * @brief 增强原声 + */ + + kVoiceReverbTypeEnhanceOriginal = 19, + /** + * + * @hidden for internal use only + * @brief 浴室 + */ + + kVoiceReverbTypeBathroom = 20, + /** + * + * @hidden for internal use only + * @brief 自然 + */ + + kVoiceReverbTypeNatural = 21, + + /** + * + * @hidden for internal use only + * @brief 楼道 + */ + + kVoiceReverbTypeHallway = 22, +}; +/** + * + * @type keytype + * @brief 音频均衡效果。 + */ + +enum VoiceEqualizationBandFrequency { + /** + * + * @brief 中心频率为 31Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency31 = 0, + /** + * + * @brief 中心频率为 62Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency62 = 1, + /** + * + * @brief 中心频率为 125Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency125 = 2, + /** + * + * @brief 中心频率为 250Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency250 = 3, + /** + * + * @brief 中心频率为 500Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency500 = 4, + /** + * + * @brief 中心频率为 1kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency1k = 5, + /** + * + * @brief 中心频率为 2kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency2k = 6, + /** + * + * @brief 中心频率为 4kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency4k = 7, + /** + * + * @brief 中心频率为 8kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency8k = 8, + /** + * + * @brief 中心频率为 16kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency16k = 9, +}; +/** + * + * @type keytype + * @brief 语音均衡效果。 + */ + +struct VoiceEqualizationConfig { + /** + * + * @brief 频带。参看 VoiceEqualizationBandFrequency{@link #VoiceEqualizationBandFrequency}。 + */ + + VoiceEqualizationBandFrequency frequency; + /** + * + * @brief 频带增益(dB)。取值范围是 `[-15, 15]`。 + */ + + int gain; +}; +/** + * + * @type keytype + * @brief 音频混响效果。 + */ + +struct VoiceReverbConfig { + /** + * + * @brief 混响模拟的房间大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。房间越大,混响越强。 + */ + + float room_size = 50.0f; + /** + * + * @brief 混响的拖尾长度,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + + float decay_time = 50.0f; + /** + * + * @brief 混响的衰减阻尼大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + + float damping = 50.0f; + /** + * + * @brief 早期反射信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + + float wet_gain = 0.0f; + /** + * + * @brief 原始信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + + float dry_gain = 0.0f; + /** + * + * @brief 早期反射信号的延迟。取值范围 `[0.0, 200.0]`,单位为 ms。默认值为 `0.0f`。 + */ + + float pre_delay = 0.0f; +}; + +/** + * + * @type keytype + * @brief 音频流来源的用户 ID 及对应的音量。 + */ + +struct AudioVolumeInfo { + /** + * + * @brief 线性音量,取值范围是:[0, 255],与原始音量呈线性关系,数值越大,音量越大。
+ * 无声为 25 以下(绝对无声为 0,25 以下可视为无声),低音量为 25~76,中音量为 76~204,高音量为 204 以上。 + */ + + int linear_volume; + /** + * + * @brief 非线性音量,取值范围是:[–127, 0],单位 dB。此音量范围是将原始音量进行对数转化,在中低音量时分辨更为灵敏,适用于 Active Speaker(房间内最活跃用户)的识别。
+ * 高音量为 0~–20 dB,中音量为 –20~–40dB,低音量为 –40~–60dB,若低于 –60 dB,则为无声。 + */ + + int nonlinear_volume; + /** + * + * @brief 音频流来源的用户 ID + */ + + const char* uid; +}; + +/** + * + * @type keytype + * @brief 音频混音文件播放状态。 + */ + +enum AudioMixingState { + /** + * + * @brief 混音已加载 + */ + + kAudioMixingStatePreloaded = 0, + /** + * + * @brief 混音正在播放 + */ + + kAudioMixingStatePlaying, + /** + * + * @brief 混音暂停 + */ + + kAudioMixingStatePaused, + /** + * + * @brief 混音停止 + */ + + kAudioMixingStateStopped, + /** + * + * @brief 混音播放失败 + */ + + kAudioMixingStateFailed, + /** + * + * @brief 混音播放结束 + */ + + kAudioMixingStateFinished, + /** + * + * @brief 准备 PCM 混音 + */ + + kAudioMixingStatePCMEnabled, + /** + * + * @brief PCM 混音播放结束 + */ + + kAudioMixingStatePCMDisabled, +}; +/** + * + * @type keytype + * @brief 混音错误码。 + */ + +enum AudioMixingError { + /** + * + * @brief 正常 + */ + + kAudioMixingErrorOk = 0, + /** + * + * @brief 预加载失败。找不到混音文件或者文件长度超出 20s + */ + + kAudioMixingErrorPreloadFailed, + /** + * + * @brief 混音开启失败。找不到混音文件或者混音文件打开失败 + */ + + kAudioMixingErrorStartFailed, + /** + * + * @brief 混音 ID 异常 + */ + + kAudioMixingErrorIdNotFound, + /** + * + * @brief 设置混音文件的播放位置出错 + */ + + kAudioMixingErrorSetPositionFailed, + /** + * + * @brief 音量参数不合法,仅支持设置的音量值为[0, 400] + */ + + kAudioMixingErrorInValidVolume, + /** + * + * @brief 播放的文件与预加载的文件不一致。请先使用 unloadAudioMixing 卸载此前的文件。 + */ + + kAudioMixingErrorLoadConflict, + /** + * + * @brief 不支持此混音类型。 + */ + + kAudioMixingErrorIdTypeNotMatch, + /** + * + * @brief 设置混音文件的音调不合法 + */ + + kAudioMixingErrorInValidPitch, + /** + * + * @brief 设置混音文件的音轨不合法 + */ + + kAudioMixingErrorInValidAudioTrack, + /** + * + * @brief 混音文件正在启动中 + */ + + kAudioMixingErrorIsStarting, + /** + * + * @brief 设置混音文件的播放速度不合法 + */ + + kAudioMixingErrorInValidPlaybackSpeed, + /** + * + * @deprecated since 3.25 and will be deleted in 3.51 + * @brief 混音错误码,失败,已废弃 + */ + + kAudioMixingErrorCanNotOpen = 701, +}; +/** + * + * @type keytype + * @brief 播放状态。 + */ + +enum PlayerState { + /** + * + * @brief 播放未启动 + */ + + kPlayerStateIdle = 0, + /** + * + * @brief 已加载 + */ + + kPlayerStatePreloaded, + /** + * + * @brief 已打开 + */ + + kPlayerStateOpened, + /** + * + * @brief 正在播放 + */ + + kPlayerStatePlaying, + /** + * + * @brief 播放已暂停 + */ + + kPlayerStatePaused, + /** + * + * @brief 播放已被主动停止 + */ + + kPlayerStateStopped, + /** + * + * @brief 播放失败 + */ + + kPlayerStateFailed, + /** + * + * @brief 播放自然结束 + */ + + kPlayerStateFinished, + /** + * + * @brief 循环播放结束 + */ + + kPlayerStateLoopFinished, +}; + +/** + * + * @type keytype + * @brief 播放事件 + */ + +enum PlayerEvent { + /** + * + * @brief 开始切换音轨
+ * 开始调用 `selectAudioTrack`{@link #IMediaPlayer#selectAudioTrack} 时,返回此状态。 + */ + + kPlayerEventSelectAudioTrackBegin, + /** + * + * @brief 切换音轨成功
+ * 调用 `selectAudioTrack`{@link #IMediaPlayer#selectAudioTrack} 成功后,播放器切换到指定音轨播放,返回此状态。 + */ + + kPlayerEventSelectAudioTrackCompleted, + /** + * + * @brief 切换音轨失败
+ * 调用 `selectAudioTrack`{@link #IMediaPlayer#selectAudioTrack} 失败后,播放器无法切换到指定音轨,继续之前的音轨播放过程,返回此状态。 + */ + + kPlayerEventSelectAudioTrackFailed, + /** + * + * @brief 试图移动播放位置
+ * 开始调用 `setPosition`{@link #IMediaPlayer#setPosition} 时,返回此状态。 + */ + + kPlayerEventSeekBegin, + /** + * + * @brief 移动播放位置成功
+ * 调用 `setPosition`{@link #IMediaPlayer#setPosition} 成功后,返回此状态。 + */ + + kPlayerEventSeekCompleted, + /** + * + * @brief 移动播放位置失败
+ * 调用 `setPosition`{@link #IMediaPlayer#setPosition} 失败时,返回此状态。 + */ + + kPlayerEventSeekFailed, +}; + +/** + * + * @type keytype + * @brief 播放错误码。 + */ + +enum PlayerError { + /** + * + * @brief 正常 + */ + + kPlayerErrorOK = 0, + /** + * + * @brief 不支持此类型 + */ + + kPlayerErrorFormatNotSupport, + /** + * + * @brief 无效的播放路径 + */ + + kPlayerErrorInvalidPath, + /** + * + * @brief 未满足前序接口调用的要求。请查看具体接口文档。 + */ + + kPlayerErrorInvalidState, + /** + * + * @brief 设置播放位置出错。 + */ + + kPlayerErrorInvalidPosition, + /** + * + * @brief 音量参数不合法。 + */ + + kPlayerErrorInvalidVolume, + /** + * + * @brief 音调参数设置不合法。 + */ + + kPlayerErrorInvalidPitch, + /** + * + * @brief 音轨参数设置不合法。 + */ + + kPlayerErrorInvalidAudioTrackIndex, + /** + * + * @brief 播放速度参数设置不合法 + */ + + kPlayerErrorInvalidPlaybackSpeed, + /** + * + * @brief 音效 ID 异常。还未加载或播放文件,就调用其他 API。 + */ + + kPlayerErrorInvalidEffectId, + /** + * + * @brief 资源正在播放中 + */ + + kPlayerErrorCurrentlyPlaying, +}; + +/** + * + * @type keytype + * @brief 是否开启耳返功能。 + */ + +enum EarMonitorMode { + /** + * + * @brief 关闭 + */ + + kEarMonitorModeOff = 0, + /** + * + * @brief 开启 + */ + + kEarMonitorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 耳返音频是否经过本地音频处理。 + */ + +enum EarMonitorAudioFilter { + /** + * + * @brief 无音频处理。 + */ + + kEarMonitorAudioFilterNone = 0x1, + /** + * + * @brief 经本地音频处理后的音频,包括 3A、变声、混响等 SDK 提供处理能力以及自定义音频处理。 + */ + + kEarMonitorAudioFilterReuseAudioProcessing = 0x8000 +}; + +/** + * + * @hidden currently not available + * @type keytype + * @region 音频管理 + * @brief 音频编码类型 + */ + +enum AudioCodecType { + /** + * + * @brief 未知编码类型 + */ + + kAudioCodecTypeNone = 0, + /** + * + * @brief Opus 编码类型 + */ + + kAudioCodecTypeOpus, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAAC, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACLC = 2, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACHEv1, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACHEv2, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACLCadts, +}; +/** + * + * @type keytype + * @brief 音频输入格式 + */ + +enum class AudioFormatType { + /** + * + * @brief PCM_S16 + */ + + kRawPCMs16 = 0, + /** + * + * @brief PCM_S32 + */ + + kRawPCMs32 = 1, +}; + +/** + * + * @type keytype + * @brief 蓝牙模式, 仅能在媒体模式下被设置 + */ + +enum BluetoothMode { + /** + * + * @brief 自动选择模式 + */ + + kBluetoothModeAuto = 0, + /** + * + * @brief 使用 A2DP 模式 + */ + + kBluetoothModeA2DP, + /** + * + * @brief HFP 模式 + */ + + kBluetoothModeHFP +}; + +/** + * + * @type keytype + * @brief 音频输入源类型 + */ + +enum AudioSourceType { + /** + * + * @brief 自定义采集音频源 + */ + + kAudioSourceTypeExternal = 0, + /** + * + * @brief RTC SDK 内部采集音频源 + */ + + kAudioSourceTypeInternal, +}; + +/** + * + * @type keytype + * @brief 音频输出类型 + */ + +enum AudioRenderType { + /** + * + * @brief 自定义渲染 + */ + + kAudioRenderTypeExternal = 0, + /** + * + * @brief RTC SDK 内部渲染 + */ + + kAudioRenderTypeInternal, +}; + +/** + * + * @type keytype + * @brief 混音播放类型 + */ + +enum AudioMixingType { + /** + * + * @brief 仅本地播放 + */ + + kAudioMixingTypePlayout, + /** + * + * @brief 仅远端播放 + */ + + kAudioMixingTypePublish, + /** + * + * @brief 本地和远端同时播放 + */ + + kAudioMixingTypePlayoutAndPublish +}; + +/** + * + * @type keytype + * @brief 混音播放声道类型 + */ + +enum AudioMixingDualMonoMode{ + /** + * + * @brief 和音频文件一致 + */ + + kAudioMixingDualMonoModeAuto, + /** + * + * @brief 只能听到音频文件中左声道的音频 + */ + + kAudioMixingDualMonoModeL, + /** + * + * @brief 只能听到音频文件中右声道的音频 + */ + + kAudioMixingDualMonoModeR, + /** + * + * @brief 能同时听到音频文件中左右声道的音频 + */ + + kAudioMixingDualMonoModeMix +}; +/** + * + * @type keytype + * @brief 混音配置 + */ + +struct AudioEffectPlayerConfig { + /** + * + * @brief 混音播放类型,详见 AudioMixingType{@link #AudioMixingType} + */ + + AudioMixingType type = kAudioMixingTypePlayoutAndPublish; + /** + * + * @brief 混音播放次数
+ * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + + int play_count = 1; + /** + * + * @brief 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + */ + + int pitch = 0; + /** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + + int start_pos = 0; +}; +/** + * + * @type keytype + * @brief 混音配置 + */ + +struct MediaPlayerConfig { + /** + * + * @brief 混音播放次数
+ * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + + int play_count = 1; + /** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + + int start_pos = 0; + /** + * + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress{@link #IMediaPlayerEventHandler#onMediaPlayerPlayingProgress} 的间隔。单位毫秒。
+ * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + */ + + int64_t callback_on_progress_interval = 0; + /** + * + * @brief 在采集音频数据时,附带本地混音文件播放进度的时间戳。启用此功能会提升远端人声和音频文件混音播放时的同步效果。
+ * - 仅在单个音频文件混音时使用有效。 + * - `true` 时开启此功能,`false` 时关闭此功能,默认为关闭。 + */ + + bool sync_progress_to_record_frame = false; + /** + * + * @brief 是否自动播放。如果不自动播放,调用 start{@link #IMediaPlayer#start} 播放音乐文件。 + */ + + bool auto_play = true; + /** + * + * @brief 混音播放类型,详见 AudioMixingType{@link #AudioMixingType} + */ + + AudioMixingType type = kAudioMixingTypePlayoutAndPublish; +}; + +/** + * + * @type keytype + * @brief 音量回调模式。 + */ + +enum AudioReportMode { + /** + * + * @brief 默认始终开启音量回调。 + */ + + kAudioReportModeNormal, + /** + * + * @brief 可见用户进房并停止推流后,关闭音量回调。 + */ + + kAudioReportModeDisconnect, + /** + * + * @brief 可见用户进房并停止推流后,开启音量回调,回调值重置为 0。 + */ + + kAudioReportModeReset, +}; + +/** + * + * @type keytype + * @brief onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport} 中包含的音频信息的范围。 + */ + +enum AudioPropertiesMode { + /** + * + * @brief 仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + + kAudioPropertiesModeMicrophone, + /** + * + * @brief 包含以下信息:
+ * - 本地麦克风采集的音频数据和本地屏幕音频采集数据; + * - 本地混音的音频数据。 + */ + + kAudioPropertiesModeAudioMixing +}; + +/** + * + * @type keytype + * @brief 音频属性信息提示的相关配置。 + */ + +struct AudioPropertiesConfig { + /** + * + * @brief 信息提示间隔,单位:ms
+ * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + + int interval = 0; + + /** + * + * @brief 是否开启音频频谱检测。 + */ + + bool enable_spectrum = false; + + /** + * + * @brief 是否开启人声检测 (VAD)。 + */ + + bool enable_vad = false; + + /** + * + * @brief 音量回调配置模式。详见 AudioReportMode{@link #AudioReportMode}。 + */ + + AudioReportMode local_main_report_mode = kAudioReportModeNormal; + + /** + * + * @brief 适用于音频属性信息提示的平滑系数。取值范围是 `(0.0, 1.0]`。
+ * 默认值为 `1.0`,不开启平滑效果;值越小,提示音量平滑效果越明显。如果要开启平滑效果,可以设置为 `0.3`。 + */ + + float smooth = 1.0f; + + /** + * + * @brief onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport} 中包含音频数据的范围。参看 AudioPropertiesMode{@link #AudioPropertiesMode}。
+ * 默认仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + + AudioPropertiesMode audio_report_mode = kAudioPropertiesModeMicrophone; + /** + * + * @brief 是否回调本地用户的人声基频。 + */ + + bool enable_voice_pitch = false; +}; +/** + * + * @type keytype + * @brief 音频属性信息 + */ + +struct AudioPropertiesInfo { + /** + * + * @brief 线性音量,与原始音量呈线性关系,数值越大,音量越大。取值范围是:[0,255]。
+ * - [0, 25]:近似无声 + * - [26, 75]:低音量 + * - [76, 204]:中音量 + * - [205, 255]:高音量 + */ + + int linear_volume = 0; + /** + * + * @brief 非线性音量。由原始音量的对数值转化而来,因此在中低音量时更灵敏,可以用作 Active Speaker(房间内最活跃用户)的识别。取值范围是:[-127,0],单位 dB。
+ * - [-127, -60]:无声 + * - [-59, -40]:低音量 + * - [-39, -20]:中音量 + * - [-19, 0]:高音量 + */ + + int nonlinear_volume = 0; + /** + * + * @brief 频谱数组。默认长度为 257。 + */ + + float spectrum[SPECTRUM_SIZE] = {0}; + /** + * + * @brief 人声检测(VAD)结果
+ * - 1: 检测到人声。 + * - 0: 未检测到人声。 + * - -1: 未开启 VAD。 + */ + + int vad = -1; + + /** + * + * @brief 本地用户的人声基频,单位为赫兹。
+ * 同时满足以下两个条件时,返回的值为本地用户的人声基频:
+ * - 调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport},并设置参数 enable_voice_pitch 的值为 `true`。 + * - 本地采集的音频中包含本地用户的人声。 + * 其他情况下返回 `0`。 + */ + + double voice_pitch = 0; +}; + +/** + * + * @type keytype + * @brief 远端音频属性信息 + */ + +struct RemoteAudioPropertiesInfo { + /** + * + * @type keytype + * @brief 流 ID + */ + + const char* stream_id; + /** + * + * @brief 流信息。参看 StreamInfo{@link #StreamInfo} + */ + + StreamInfo stream_info; + /** + * + * @type keytype + * @brief 音频属性信息,详见 AudioPropertiesInfo{@link #AudioPropertiesInfo} + */ + + AudioPropertiesInfo audio_properties_info; +}; + +/** + * + * @type keytype + * @brief 本地音频属性信息 + */ + +struct LocalAudioPropertiesInfo { + /** + * + * @type keytype + * @brief 音频源 + */ + + IAudioSource* audio_source; + /** + * + * @type keytype + * @brief 音频属性信息,详见 AudioPropertiesInfo{@link #AudioPropertiesInfo} + */ + + AudioPropertiesInfo audio_properties_info; +}; + +/** + * + * @type keytype + * @brief 音质档位 + */ + +enum AudioProfileType { + /** + * + * @brief 默认音质
+ * 服务器下发或客户端已设置的 RoomProfileType{@link #RoomProfileType} 的音质配置 + */ + + kAudioProfileTypeDefault = 0, + /** + * + * @brief 流畅
+ * 单声道,采样率为 16 kHz,编码码率为 32 Kbps。
+ * 流畅优先、低功耗、低流量消耗,适用于大部分游戏场景,如小队语音、组队语音、国战语音等。 + */ + + kAudioProfileTypeFluent = 1, + /** + * + * @brief 单声道标准音质。
+ * 采样率为 24 kHz,编码码率为 48 Kbps。
+ * 适用于对音质有一定要求的场景,同时延时、功耗和流量消耗相对适中,适合教育场景和狼人杀等游戏。 + */ + + kAudioProfileTypeStandard = 2, + /** + * + * @brief 双声道音乐音质
+ * 采样率为 48 kHz,编码码率为 128 kbps。
+ * 超高音质,同时延时、功耗和流量消耗相对较大,适用于连麦 PK 等音乐场景。
+ * 游戏场景不建议使用。 + */ + + kAudioProfileTypeHD = 3, + /** + * + * @brief 双声道标准音质。采样率为 48 KHz,编码码率最大值为 80 Kbps + */ + + kAudioProfileTypeStandardStereo = 4, + /** + * + * @brief 单声道音乐音质。采样率为 48 kHz,编码码率最大值为 64 Kbps + */ + + kAudioProfileTypeHDMono = 5, +}; + +/** + * + * @type keytype + * @brief 降噪模式。降噪算法受调用 joinRoom{@link #IRTCRoom#joinRoom} 时设置的房间模式影响。 + */ + +enum AnsMode { + /** + * + * @brief 禁用音频降噪。 + */ + + kAnsModeDisable = 0, + /** + * + * @brief 适用于微弱降噪。 + */ + + kAnsModeLow = 1, + /** + * + * @brief 适用于抑制中度平稳噪音,如空调声、风扇声。 + */ + + kAnsModeMedium = 2, + /** + * + * @brief 适用于抑制嘈杂非平稳噪音,如键盘声、敲击声、碰撞声、动物叫声。 + */ + + kAnsModeHigh = 3, + /** + * + * @brief 启用音频降噪能力。具体的降噪算法由 RTC 决定。 + */ + + kAnsModeAutomatic = 4, +}; + +/** + * + * @type keytype + * @brief 本地用户在房间内的位置坐标,需自行建立空间直角坐标系 + */ + +struct Position { + /** + * + * @brief x 坐标 + */ + + float x; + /** + * + * @brief y 坐标 + */ + + float y; + /** + * + * @brief z 坐标 + */ + + float z; + /** + * + * @hidden constructor/destructor + */ + + bool isEqual(const Position& pos) const { + return (fabs(x - pos.x) < 1e-2) && + (fabs(y - pos.y) < 1e-2) && + (fabs(z - pos.z) < 1e-2); + } +}; + +/** + * + * @type keytype + * @brief 方向朝向信息 + */ + +struct Orientation { + /** + * + * @brief x 坐标 + */ + + float x; + /** + * + * @brief y 坐标 + */ + + float y; + /** + * + * @brief z 坐标 + */ + + float z; + /** + * + * @hidden constructor/destructor + */ + + bool isEqual(const Orientation& orientation) const { + return x == orientation.x && y == orientation.y && z == orientation.z; + } +}; + +/** + * + * @type keytype + * @brief 三维朝向信息,三个向量需要两两垂直。参看 Orientation{@link #Orientation}。 + */ + +struct HumanOrientation { + /** + * + * @brief 正前方朝向,默认值为 {1,0,0},即正前方朝向 x 轴正方向 + */ + + Orientation forward = { 1, 0, 0 }; + /** + * + * @brief 正右方朝向,默认值为 {0,1,0},即右手朝向 y 轴正方向 + */ + + Orientation right = { 0, 1, 0 }; + /** + * + * @brief 正上方朝向,默认值为 {0,0,1},即头顶朝向 z 轴正方向 + */ + + Orientation up = { 0, 0, 1 }; + /** + * + * @hidden constructor/destructor + */ + + bool isEqual(const HumanOrientation& human_orientation) const { + return forward.isEqual(human_orientation.forward) && right.isEqual(human_orientation.right) && up.isEqual(human_orientation.up); + } +}; + +/** + * + * @type keytype + * @brief 音频音量是否可设置 + */ + +enum AudioAbilityType { + /** + * + * @brief 未知 + */ + + kAudioAbilityTypeUnknown = -1, + /** + * + * @brief 音量可设置 + */ + + kAudioAbilityTypeAble = 0, + /** + * + * @brief 音量不可设置 + */ + + kAudioAbilityTypeUnable = 1, +}; +/** + * + * @type keytype + * @brief 远端音频流精准对齐模式 + */ + +enum AudioAlignmentMode { + /** + * + * @brief 不对齐 + */ + + kAudioAlignmentModeOff, + /** + * + * @brief 远端音频流都对齐伴奏进度同步播放 + */ + + kAudioAlignmentModeAudioMixing, +}; + +/** + * + * @type keytype + * @brief 音频设备信息 + */ + +struct AudioDeviceInfo { + /** + * + * @brief 设备 ID + */ + + char device_id[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备全称,包含设备类型与设备名称。例如 "扬声器 (XYZ Audio Adapter)" + */ + + char device_name[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备名称,不含设备类型。例如 "XYZ Audio Adapter" + */ + + char device_short_name[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备所连接的声卡 ID,便于选择使用同一声卡的扬声器和麦克风。 + */ + + char device_container_id[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备的厂商 ID + */ + + int64_t device_vid; + /** + * + * @brief 设备的产品编码 + */ + + int64_t device_pid; + /** + * + * @brief 设备的传输方式 + */ + + DeviceTransportType transport_type; + /** + * + * @brief 是否支持设置音量 + */ + + AudioAbilityType volume_settable; + /** + * + * @brief 是否系统默认设备 + */ + + bool is_system_default; + /** + * + * @hidden constructor/destructor + */ + + AudioDeviceInfo() { + memset(device_id, 0, MAX_DEVICE_ID_LENGTH); + memset(device_name, 0, MAX_DEVICE_ID_LENGTH); + memset(device_short_name, 0, MAX_DEVICE_ID_LENGTH); + memset(device_container_id, 0, MAX_DEVICE_ID_LENGTH); + this->device_vid = 0; + this->device_pid = 0; + this->transport_type = DeviceTransportType::kDeviceTransportTypeUnknown; + this->volume_settable = AudioAbilityType::kAudioAbilityTypeUnknown; + this->is_system_default = false; + } + /** + * + * @hidden constructor/destructor + */ + + AudioDeviceInfo& operator=(const AudioDeviceInfo& src) { + if (this != &src) { + strncpy(device_id, src.device_id, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_name, src.device_name, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_short_name, src.device_short_name, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_container_id, src.device_container_id, MAX_DEVICE_ID_LENGTH - 1); + device_id[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_name[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_short_name[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_container_id[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_vid = src.device_vid; + device_pid = src.device_pid; + transport_type = src.transport_type; + volume_settable = src.volume_settable; + is_system_default = src.is_system_default; + } + + return *this; + } +}; +/** + * + * @type keytype + * @brief 标准音高数据 + */ + +struct StandardPitchInfo { + /** + * + * @brief 开始时间,单位 ms。 + */ + + int start_time; + /** + * + * @brief 持续时间,单位 ms。 + */ + + int duration; + /** + * + * @brief 音高。 + */ + + int pitch; +}; +/** + * + * @type keytype + * @hidden + * @brief K 歌打分维度。 + */ + +enum MulDimSingScoringMode { + /** + * + * @brief 按照音高进行评分。 + */ + + kMulDimSingScoringModeNote = 0 +}; +/** + * + * @type keytype + * @hidden + * @brief K 歌评分配置。 + */ + +struct SingScoringConfig { + /** + * + * @brief 音频采样率。仅支持 44100 Hz、48000 Hz。 + */ + + AudioSampleRate sample_rate; + /** + * + * @brief 打分维度,详见 MulDimSingScoringMode{@link #MulDimSingScoringMode}。 + */ + + MulDimSingScoringMode mode; + /** + * + * @brief 歌词文件路径。打分功能仅支持 KRC 歌词文件。 + */ + + const char* lyrics_filepath; + /** + * + * @brief 歌曲 midi 文件路径。 + */ + + const char* midi_filepath; +}; +/** + * + * @type keytype + * @hidden + * @brief 实时评分信息。 + */ + +struct SingScoringRealtimeInfo { + /** + * + * @brief 当前播放进度。 + */ + + int current_position; + /** + * + * @brief 演唱者的音高。 + */ + + int user_pitch; + /** + * + * @brief 标准音高。 + */ + + int standard_pitch; + /** + * + * @brief 歌词分句索引。 + */ + + int sentence_index; + /** + * + * @brief 上一句歌词的评分。 + */ + + int sentence_score; + /** + * + * @brief 当前演唱的累计分数。 + */ + + int total_score; + /** + * + * @brief 当前演唱的平均分数。 + */ + + int average_score; +}; +/** + * + * @type keytype + * @brief 音频文件录制内容来源。 + */ + +enum AudioFrameSource { + /** + * + * @brief 本地麦克风采集的音频数据。 + */ + + kAudioFrameSourceMic = 0, + /** + * + * @brief 远端所有用户混音后的数据 + */ + + kAudioFrameSourcePlayback = 1, + /** + * + * @brief 本地麦克风和所有远端用户音频流的混音后的数据 + */ + + kAudioFrameSourceMixed = 2, +}; +/** + * + * @type keytype + * @brief 音频质量。 + */ + +enum AudioQuality { + /** + * + * @brief 低音质 + */ + + kAudioQualityLow = 0, + /** + * + * @brief 中音质 + */ + + kAudioQualityMedium = 1, + /** + * + * @brief 高音质 + */ + + kAudioQualityHigh = 2, + /** + * + * @brief 超高音质 + */ + + kAudioQualityUltraHigh = 3, +}; +/** + * + * @type keytype + * @brief 录音配置 + */ + +struct AudioRecordingConfig { + /** + * + * @hidden constructor/destructor + */ + + AudioRecordingConfig() { + absolute_file_name = nullptr; + frame_source = kAudioFrameSourceMixed; + sample_rate = kAudioSampleRateAuto; + channel = kAudioChannelAuto; + quality = kAudioQualityMedium; + } + /** + * + * @brief 录制文件路径。一个有读写权限的绝对路径,包含文件名和文件后缀。
+ * 录制文件的格式仅支持 .aac 和 .wav。 + */ + + const char* absolute_file_name; + /** + * + * @brief 录音内容来源,参看 AudioFrameSource{@link #AudioFrameSource}。
+ * 默认为 kAudioFrameSourceMixed = 2。 + */ + + AudioFrameSource frame_source; + /** + * + * @brief 录音采样率。参看 AudioSampleRate{@link #AudioSampleRate}。 + */ + + AudioSampleRate sample_rate; + /** + * + * @brief 录音音频声道。参看 AudioChannel{@link #AudioChannel}。
+ * 如果录制时设置的音频声道数与采集时的音频声道数不同:
+ * - 如果采集的声道数为 1,录制的声道数为 2,那么,录制的音频为经过单声道数据拷贝后的双声道数据,而不是立体声。 + * - 如果采集的声道数为 2,录制的声道数为 1,那么,录制的音频为经过双声道数据混合后的单声道数据。 + */ + + AudioChannel channel; + /** + * + * @brief 录音音质。仅在录制文件格式为 .aac 时可以设置。参看 AudioQuality{@link #AudioQuality}。
+ * 采样率为 32kHz 时,不同音质录制文件(时长为 10min)的大小分别是:
+ * - 低音质:1.2MB; + * - 【默认】中音质:2MB; + * - 高音质:3.75MB; + * - 超高音质:7.5MB。 + */ + + AudioQuality quality; +}; +/** + * + * @type keytype + * @brief 录音配置 + */ + +enum AudioRecordingState { + /** + * + * @brief 录制异常 + */ + + kAudioRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + kAudioRecordingStateProcessing = 1, + /** + * + * @brief 已结束录制,并且录制文件保存成功。 + */ + + kAudioRecordingStateSuccess = 2, +}; +/** + * + * @type errorcode + * @brief 音频文件录制的错误码 + */ + +enum AudioRecordingErrorCode { + /** + * + * @brief 录制正常 + */ + + kAudioRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + kAudioRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 没有进入房间 + */ + + kAudioRecordingErrorCodeNotInRoom = -2, + /** + * + * @brief 录制已经开始 + */ + + kAudioRecordingErrorCodeAlreadyStarted = -3, + /** + * + * @brief 录制还未开始 + */ + + kAudioRecordingErrorCodeNotStarted = -4, + /** + * + * @brief 录制失败。文件格式不支持。 + */ + + kAudioRecordingErrorCodeNotSupport = -5, + /** + * + * @brief 其他异常 + */ + + kAudioRecordingErrorCodeOther = -6, +}; +/** + * + * @hidden(macOS, Windows, Linux) + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +struct AudioEnhancementConfig { + /** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_signaling = false; + /** + * + * @brief 对音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_audio = false; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_device_manager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_device_manager.h new file mode 100644 index 0000000..7922bc3 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_device_manager.h @@ -0,0 +1,521 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Device Manager +*/ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @deprecated since 3.42 and will be deleted in 3.51, use IAudioDeviceCollection{@link #IAudioDeviceCollection} and IVideoDeviceCollection{@link #IVideoDeviceCollection} instead. + * @type api + * @brief 音视频设备相关的信息 + * @list 引擎管理 + */ + +class IDeviceCollection { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IDeviceCollection() { + } + /** + * + * @type api + * @brief 获取当前系统内音视频设备数量 + * @return 音视频设备数量 + * @list 引擎管理 + */ + + virtual int getCount() = 0; + /** + * + * @type api + * @brief 获取音频设备信息,可根据索引号、设备名称、设备 ID 获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IAudioDeviceCollection#getCount} 返回值。 + * @param device_name 设备名称 + * @param device_id 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, char device_name[MAX_DEVICE_ID_LENGTH], char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 释放当前 IAudioDeviceCollection{@link #IAudioDeviceCollection} 对象占用的资源。 + * @note 不需要返回音视频设备相关信息列表时应该调用本方法释放相关资源。 + * @list 引擎管理 + */ + + virtual void release() = 0; +/** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IDeviceCollection() { + } +}; +/** + * + * @hidden(Android,iOS) + * @type api + * @brief 音频设备相关的信息 + * @list 引擎管理 + */ + +class IAudioDeviceCollection : public IDeviceCollection { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IAudioDeviceCollection() {}; + /** + * + * @type api + * @brief 获取当前系统内音频设备数量 + * @return 音频设备数量 + * @list 引擎管理 + */ + + virtual int getCount() override {return 0;}; + /** + * + * @type api + * @brief 根据索引号,获取设备信息 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IAudioDeviceCollection#getCount} 返回值。 + * @param device_name 设备名称 + * @param device_id 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, char device_name[MAX_DEVICE_ID_LENGTH], char device_id[MAX_DEVICE_ID_LENGTH]) override {return 0;}; + /** + * + * @type api + * @brief 释放当前 IAudioDeviceCollection{@link #IAudioDeviceCollection} 对象占用的资源。 + * @note 不需要返回音频设备相关信息列表时应该调用本方法释放相关资源。 + * @list 引擎管理 + */ + + virtual void release()override {}; + /** + * + * @type api + * @brief 获取音频设备信息,可根据索引号、设备信息(ID、设备的产品编码等)获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IAudioDeviceCollection#getCount} 返回值。 + * @param audio_device_info 设备信息,详见 AudioDeviceInfo{@link #AudioDeviceInfo} + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, AudioDeviceInfo* audio_device_info) = 0; +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioDeviceCollection() {}; +}; +/** + * + * @hidden(Android,iOS) + * @type api + * @brief 音频设备管理类 + * @list 引擎管理 + */ + +class IAudioDeviceManager { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IAudioDeviceManager() { + } + /** + * + * @type api + * @brief 获取当前系统内音频播放设备列表。如果后续设备有变更,你会收到 `onAudioMediaDeviceStateChanged` 回调通知,然后需要重新调用本接口以获得新的设备列表。 + * @return 包含系统中所有音频播放设备的列表,参看 IAudioDeviceCollection{@link #IAudioDeviceCollection}。
+ * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 监听到 `kMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 音频管理 + */ + + virtual IAudioDeviceCollection* enumerateAudioPlaybackDevices() = 0; + /** + * + * @type api + * @brief 获取当前系统内音频采集设备列表。如果后续设备有变更,你需要重新调用本接口以获得新的设备列表。 + * @return 一个包含系统中所有音频采集设备列表的对象,详见 IAudioDeviceCollection{@link #IAudioDeviceCollection}。
+ * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 监听到 `kMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note + * - 你可以在收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual IAudioDeviceCollection* enumerateAudioCaptureDevices() = 0; + /** + * + * @type api + * @brief 设置音频播放路由是否跟随系统。 + * @param followed
+ * - true: 跟随。此时,调用 setAudioPlaybackDevice{@link #IAudioDeviceManager#setAudioPlaybackDevice} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioPlaybackDevice{@link #IAudioDeviceManager#setAudioPlaybackDevice} 进行设置。 + * @list 音频管理 + */ + + virtual void followSystemPlaybackDevice(bool followed) = 0; + /** + * + * @type api + * @brief 设置音频采集路由是否跟随系统。 + * @param followed
+ * - true: 跟随。此时,调用 setAudioCaptureDevice{@link #IAudioDeviceManager#setAudioCaptureDevice} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioCaptureDevice{@link #IAudioDeviceManager#setAudioCaptureDevice} 进行设置。 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual void followSystemCaptureDevice(bool followed) = 0; + /** + * + * @type api + * @brief 设置音频播放设备。 + * @param device_id 音频播放设备 ID,可通过 enumerateAudioPlaybackDevices{@link #IAudioDeviceManager#enumerateAudioPlaybackDevices}
+ * 获取。 + * @return + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 当你调用 followSystemPlaybackDevice{@link #IAudioDeviceManager#followSystemPlaybackDevice} 设置音频播放设备跟随系统后,将无法调用此接口设置音频播放设备。 + * @list 音频管理 + */ + + virtual int setAudioPlaybackDevice(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 设置音频采集设备。 + * @param device_id 音频采集设备 ID,可通过 enumerateAudioCaptureDevices{@link #IAudioDeviceManager#enumerateAudioCaptureDevices} 获取。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 当你调用 followSystemCaptureDevice{@link #IAudioDeviceManager#followSystemCaptureDevice} 设置音频采集设备跟随系统后,将无法调用此接口设置音频采集设备。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int setAudioCaptureDevice(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 设置当前音频播放设备音量 + * @param volume 音频播放设备音量,取值范围为 [0,255], 超出此范围设置无效。
+ * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int setAudioPlaybackDeviceVolume(unsigned int volume) = 0; + /** + * + * @type api + * @brief 获取当前音频播放设备音量 + * @param volume 音频播放设备音量,范围应在 [0,255] 内。
+ * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int getAudioPlaybackDeviceVolume(unsigned int* volume) = 0; + /** + * + * @type api + * @brief 设置当前音频采集设备音量 + * @param volume 音频采集设备音量,取值范围为 [0,255], 超出此范围设置无效。
+ * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
+ * - 0:方法调用成功。将影响 onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport} 回调的音量信息。 + * - < 0:方法调用失败。 + * @note + * + 对于已静音设备,音量设置会在调用 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 取消静音后生效。 + * + 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int setAudioCaptureDeviceVolume(unsigned int volume) = 0; + /** + * + * @type api + * @brief 获取当前音频采集设备音量 + * @param volume 音频采集设备音量,范围应在 [0,255] 内。
+ * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int getAudioCaptureDeviceVolume(unsigned int* volume) = 0; + /** + * + * @type api + * @brief 设置当前音频播放设备静音状态,默认为非静音。 + * @param mute
+ * - true:静音 + * - false:非静音 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int setAudioPlaybackDeviceMute(bool mute) = 0; + /** + * + * @type api + * @brief 获取当前音频播放设备是否静音的信息。 + * @param mute
+ * - true:静音 + * - false:非静音 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int getAudioPlaybackDeviceMute(bool* mute) = 0; + /** + * + * @type api + * @brief 设置当前音频采集设备静音状态,默认为非静音。 + * @param mute
+ * - true:静音 + * - false:非静音 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法用于静音整个系统的音频采集。你也可以仅对麦克风采集到的音频信号做静音处理,而不影响媒体播放器的音乐声音,具体参看 muteAudioCapture{@link #IRTCEngine#muteAudioCapture} 方法说明。 + * - 设该方法为 `true` 静音后仍可通过 setAudioCaptureDeviceVolume{@link #IAudioDeviceManager#setAudioCaptureDeviceVolume} 调整采集音量,调整后的音量会在取消静音后生效。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int setAudioCaptureDeviceMute(bool mute) = 0; + /** + * + * @type api + * @brief 获取当前音频采集设备是否静音的信息。 + * @param mute
+ * - true:静音 + * - false:非静音 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int getAudioCaptureDeviceMute(bool* mute) = 0; + /** + * + * @type api + * @brief 获取当前音频播放设备 ID。 + * @param device_id 音频播放设备 ID + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int getAudioPlaybackDevice(char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 获取当前音频采集设备 ID。 + * @param device_id 音频采集设备 ID,使用方负责按 MAX_DEVICE_ID_LENGTH 大小,分配与释放内存 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int getAudioCaptureDevice(char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 尝试初始化音频播放设备,可检测出设备不存在、权限被拒绝/禁用等异常问题。 + * @param device_id 设备索引号 + * @return 设备状态错误码
+ * - 0: 设备检测结果正常 + * - -1: 接口状态不正确,例如在正常启动采集后再调用该接口进行检测 + * - -2: 采集设备无麦克风权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note 1. 该接口需在进房前调用;
+ * 2. 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * @list 音频管理 + */ + + virtual int initAudioPlaybackDeviceForTest(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 尝试初始化音频采集设备,可检测设备不存在、权限被拒绝/禁用等异常问题。 + * @param device_id 设备索引 + * @return 设备状态错误码
+ * - 0: 设备检测结果正常 + * - -1: 接口状态不正确,例如在正常启动采集后再调用该接口进行检测 + * - -2: 采集设备无麦克风权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note + * - 该接口需在进房前调用;
+ * - 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int initAudioCaptureDeviceForTest(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 启动音频播放设备检测。测试启动后,循环播放指定的音频文件,同时将通过 `onAudioPlaybackDeviceTestVolume` 回调播放时的音量信息。 + * @param test_audio_file_path 指定播放设备检测的音频文件网络地址。支持的格式包括 mp3,aac,m4a,3gp 和 wav。 + * @param indication_interval 设置 `onAudioPlaybackDeviceTestVolume` 音量回调的时间间隔,推荐设置为 200 毫秒或以上。单位为毫秒。最小值为 10 毫秒。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法可在进房前和进房后调用,不可与其它音频设备测试功能同时应用。 + * - 调用 stopAudioPlaybackDeviceTest{@link #IAudioDeviceManager#stopAudioPlaybackDeviceTest} 可以停止测试。 + * @list 音频管理 + */ + + virtual int startAudioPlaybackDeviceTest(const char* test_audio_file_path, int indication_interval) = 0; + /** + * + * @type api + * @brief 停止音频播放测试。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 调用 startAudioPlaybackDeviceTest{@link #IAudioDeviceManager#startAudioPlaybackDeviceTest} 后,调用本方法停止测试。 + * @list 音频管理 + */ + + virtual int stopAudioPlaybackDeviceTest() = 0; + /** + * + * @hidden(iOS, Linux) + * @type api + * @brief 开始音频采集设备和音频播放设备测试。 + * @param indication_interval 测试中会收到 `onLocalAudioPropertiesReport` 回调,本参数指定了该周期回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法在进房前后均可调用。且不可与其它音频设备测试功能同时应用。 + * - 调用本接口 30 s 后,采集自动停止,并开始播放采集到的声音。录音播放完毕后,设备测试流程自动结束。你也可以在 30 s 内调用 stopAudioDeviceRecordAndPlayTest{@link #IAudioDeviceManager#stopAudioDeviceRecordAndPlayTest} 来停止采集并开始播放此前采集到的声音。 + * - 调用 stopAudioDevicePlayTest{@link #IAudioDeviceManager#stopAudioDevicePlayTest} 可以停止音频设备采集和播放测试。 + * - 你不应在测试过程中,调用 `enableAudioPropertiesReport` 注册音量提示回调。 + * - 该方法仅在本地进行音频设备测试,不涉及网络连接。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int startAudioDeviceRecordTest(int indication_interval) = 0; + /** + * + * @hidden(iOS, Linux) + * @type api + * @brief 停止采集本地音频,并开始播放采集到的声音。录音播放完毕后,设备测试流程结束。
+ * 调用 startAudioDeviceRecordTest{@link #IAudioDeviceManager#startAudioDeviceRecordTest} 30 s 内调用本接口来停止采集并开始播放此前采集到的声音。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 调用本接口开始播放录音后,可以在播放过程中调用 stopAudioDevicePlayTest{@link #IAudioDeviceManager#stopAudioDevicePlayTest} 停止播放。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int stopAudioDeviceRecordAndPlayTest() = 0; + /** + * + * @hidden(iOS, Linux) + * @type api + * @brief 停止由调用 startAudioDeviceRecordTest{@link #IAudioDeviceManager#startAudioDeviceRecordTest} 开始的音频播放设备测试。
+ * 在音频播放设备测试自动结束前,可调用本接口停止音频采集与播放测试。 + * @return 方法调用结果
+ * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int stopAudioDevicePlayTest() = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioDeviceManager() { + } +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_effect_player.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_effect_player.h new file mode 100644 index 0000000..b914a5e --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_effect_player.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Effect Player +*/ +#pragma once + +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @type callback + * @brief IAudioEffectPlayer{@link #IAudioEffectPlayer} 对应的回调句柄。你必须调用 setEventHandler{@link #IAudioEffectPlayer#setEventHandler} 完成设置后,才能收到对应回调。 + * @list 混音 + */ + +class IAudioEffectPlayerEventHandler { +public: + virtual ~IAudioEffectPlayerEventHandler() {} + /** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param effect_id IAudioEffectPlayer{@link #IAudioEffectPlayer} 的 ID。通过 getAudioEffectPlayer{@link #IRTCEngine#getAudioEffectPlayer} 设置。 + * @param state 混音状态。参考 PlayerState{@link #PlayerState}。 + * @param error 错误码。参考 PlayerError{@link #PlayerError}。 + * @list 混音 + */ + + virtual void onAudioEffectPlayerStateChanged(int effect_id, PlayerState state, PlayerError error) = 0; +}; +/** + * + * @valid since 3.53 + * @type api + * @brief 音效播放器
+ * 调用 setEventHandler{@link #IAudioEffectPlayer#setEventHandler} 设置回调句柄以获取相关回调。 + * @list 混音 + */ + +class IAudioEffectPlayer { +public: + IAudioEffectPlayer(){} + virtual ~IAudioEffectPlayer() {} + /** + * + * @type api + * @brief 开始播放音效文件。
+ * 可以通过传入不同的 ID 和 filepath 多次调用本方法,以实现同时播放多个音效文件,实现音效叠加。 + * @param effect_id 音效 ID。用于标识音效,请保证音效 ID 唯一性。
+ * 如果使用相同的 ID 重复调用本方法后,上一个音效会停止,下一个音效开始,并收到 onAudioEffectPlayerStateChanged{@link #IAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged}。 + * @param file_path 音效文件路径。
+ * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
+ * 推荐的音效文件采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
+ * 不同平台支持的本地音效文件格式:
+ * + * + * + * + * + *
mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYYYY
iOS/macOSYYYYYY
WindowsYYYYYYYY
+ * 不同平台支持的在线音效文件格式:
+ * + * + * + * + * + *
mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYY
iOS/macOSYYYY
WindowsYYYYYYY
+ * @param config 音效配置,详见 AudioEffectPlayerConfig{@link #AudioEffectPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果已经通过 preload{@link #IAudioEffectPlayer#preload} 将文件加载至内存,确保此处的 ID 与 preload{@link #IAudioEffectPlayer#preload} 设置的 ID 相同。 + * - 开始播放音效文件后,可以调用 stop{@link #IAudioEffectPlayer#stop} 方法停止播放音效文件。 + * @list 混音 + */ + + virtual int start(int effect_id, const char* file_path, const AudioEffectPlayerConfig& config) = 0; + /** + * + * @type api + * @brief 停止播放音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以调用本方法停止播放音效文件。 + * - 调用本方法停止播放音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + + virtual int stop(int effect_id) = 0; + /** + * + * @type api + * @brief 停止播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以调用本方法停止播放所有音效文件。 + * - 调用本方法停止播放所有音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + + virtual int stopAll() = 0; + /** + * + * @type api + * @brief 预加载指定音乐文件到内存中,以避免频繁播放同一文件时的重复加载,减少 CPU 占用。 + * @param effect_id 音效 ID。用于标识音效,请保证音效 ID 唯一性。
+ * 如果使用相同的 ID 重复调用本方法,后一次会覆盖前一次。
+ * 如果先调用 start{@link #IAudioEffectPlayer#start},再使用相同的 ID 调用本方法 ,会收到回调 onAudioEffectPlayerStateChanged{@link #IAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged} ,通知前一个音效停止,然后加载下一个音效。
+ * 调用本方法预加载 A.mp3 后,如果需要使用相同的 ID 调用 start{@link #IAudioEffectPlayer#start} 播放 B.mp3,请先调用 unload{@link #IAudioEffectPlayer#unload} 卸载 A.mp3 ,否则会报错 AUDIO_MIXING_ERROR_LOAD_CONFLICT。 + * @param file_path 音效文件路径。支持本地文件的 URI。
+ * 预加载的文件长度不得超过 20s。
+ * 不同平台支持的音效文件格式和 start{@link #IAudioEffectPlayer#start} 一致。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本方法只是预加载指定音效文件,只有调用 start{@link #IAudioEffectPlayer#start} 方法才开始播放指定音效文件。 + * - 调用本方法预加载的指定音效文件可以通过 unload{@link #IAudioEffectPlayer#unload} 卸载。 + * @list 混音 + */ + + virtual int preload(int effect_id, const char* file_path) = 0; + /** + * + * @type api + * @brief 卸载指定音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 或 preload{@link #IAudioEffectPlayer#preload} 后调用此接口。 + * @list 混音 + */ + + virtual int unload(int effect_id) = 0; + /** + * + * @type api + * @brief 卸载所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 混音 + */ + + virtual int unloadAll() = 0; + /** + * + * @type api + * @brief 暂停播放音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以通过调用本方法暂停播放音效文件。 + * - 调用本方法暂停播放音效文件后,可调用 resume{@link #IAudioEffectPlayer#resume} 方法恢复播放。 + * @list 混音 + */ + + virtual int pause(int effect_id) = 0; + /** + * + * @type api + * @brief 暂停播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以通过调用本方法暂停播放所有音效文件。 + * - 调用本方法暂停播放所有音效文件后,可调用 resumeAll{@link #IAudioEffectPlayer#resumeAll} 方法恢复所有播放。 + * @list 混音 + */ + + virtual int pauseAll() = 0; + /** + * + * @type api + * @brief 恢复播放音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 调用 pause{@link #IAudioEffectPlayer#pause} 方法暂停播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + + virtual int resume(int effect_id) = 0; + /** + * + * @type api + * @brief 恢复播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 调用 pauseAll{@link #IAudioEffectPlayer#pauseAll} 方法暂停所有正在播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + + virtual int resumeAll() = 0; + /** + * + * @type api + * @brief 设置音效文件的起始播放位置。 + * @param effect_id 音效 ID + * @param pos 音效文件起始播放位置,单位为毫秒。
+ * 你可以通过 getDuration{@link #IAudioEffectPlayer#getDuration} 获取音效文件总时长,pos 的值应小于音效文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int setPosition(int effect_id, int pos) = 0; + /** + * + * @type api + * @brief 获取音效文件播放进度。 + * @param effect_id 音效 ID + * @return + * - >0: 成功, 音效文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int getPosition(int effect_id) = 0; + /** + * + * @type api + * @brief 调节指定音效的音量大小,包括音效文件和 PCM 音频。 + * @param effect_id 音效 ID + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int setVolume(int effect_id, int volume) = 0; + /** + * + * @type api + * @brief 设置所有音效的音量大小,包括音效文件和 PCM 音效。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该接口的优先级低于 setVolume{@link #IAudioEffectPlayer#setVolume},即通过 setVolume{@link #IAudioEffectPlayer#setVolume} 单独设置了音量的音效 ID,不受该接口设置的影响。 + * @list 混音 + */ + + virtual int setVolumeAll(int volume) = 0; + /** + * + * @type api + * @brief 获取当前音量。 + * @param effect_id 音效 ID + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int getVolume(int effect_id) = 0; + /** + * + * @type api + * @brief 获取音效文件时长。 + * @param effect_id 音效 ID + * @return + * - >0: 成功, 音效文件时长,单位为毫秒。 + * - < 0: 失败 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int getDuration(int effect_id) = 0; + /** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 IAudioEffectPlayerEventHandler{@link #IAudioEffectPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + + virtual int setEventHandler(IAudioEffectPlayerEventHandler* handler) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_frame.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_frame.h new file mode 100644 index 0000000..7da1a8b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_frame.h @@ -0,0 +1,528 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC audio Frame + */ + +#pragma once + +#include +#include +#include +#include "bytertc_audio_defines.h" + +namespace bytertc { + +/** + * + * @type keytype + * @region 音频管理 + * @brief 音频帧类型 + */ + +enum AudioFrameType { + /** + * + * @brief PCM 16bit + */ + + kAudioFrameTypePCM16 = 0 +}; + +/** + * + * @type keytype + * @region 音频管理 + * @brief 音频帧构建类 + */ + +typedef struct AudioFrameBuilder { + /** + * + * @brief 音频采样率 + */ + + AudioSampleRate sample_rate; + + /** + * + * @brief 音频通道数 + */ + + AudioChannel channel; + + /** + * + * @brief 音频帧时间戳,单位:微秒 + * @note 此时间戳不是 Linux 时间戳,只是 SDK 内部时间戳,仅保证帧之间时间戳的相对关系。 + */ + + int64_t timestamp_us = 0; + + /** + * + * @brief 音频帧数据 + */ + + uint8_t* data; + + /** + * + * @brief 音频帧数据大小 + */ + + int64_t data_size = 0; + + /** + * + * @brief 是否深拷贝 + */ + + bool deep_copy = true; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据 + */ + + uint8_t* extra_info = nullptr; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据大小 + */ + + int64_t extra_info_size = 0; +} AudioFrameBuilder; +/** + * + * @type keytype + * @brief 音频帧 + */ + +class IAudioFrame { +public: + /** + * + * @type api + * @brief 获取音频帧时间戳。 + * @return 音频帧时间戳,单位:微秒 + * @list Screen Sharing + */ + + virtual int64_t timestampUs() const = 0; + /** + * + * @type api + * @brief 获取音频采样率。参看 AudioSampleRate{@link #AudioSampleRate} + * @return 音频采样率,单位:Hz + * @list 音频管理 + */ + + virtual AudioSampleRate sampleRate() const = 0; + /** + * + * @type api + * @brief 获取音频通道数。参看 AudioChannel{@link #AudioChannel} + * @return 音频通道数 + * @note 双声道的情况下,左右声道的音频帧数据以 LRLRLR 形式排布。 + * @list 音频管理 + */ + + virtual AudioChannel channel() const = 0; + /** + * + * @type api + * @brief 获取音频帧内存块地址 + * @return 音频帧内存块地址 + * @list 音频管理 + */ + + virtual uint8_t* data() const = 0; + /** + * + * @type api + * @brief 获取音频帧数据大小 + * @return 音频帧数据大小,单位:字节。 + * @list 音频管理 + */ + + virtual int dataSize() const = 0; + /** + * + * @type api + * @brief 获取音频帧类型 + * @return 音频帧类型,目前只支持 PCM,详见 AudioFrameType{@link #AudioFrameType} + * @list 音频管理 + */ + + virtual AudioFrameType frameType() const = 0; + /** + * + * @type api + * @hidden for internal use only + * @brief 获取音频帧额外信息内存块地址 + * @return 音频帧额外信息内存块地址 + * @list 音频管理 + */ + + virtual uint8_t* extraInfo() const = 0; + /** + * + * @type api + * @hidden for internal use only + * @brief 获取音频帧额外信息大小 + * @return 音频帧数据额外信息大小,单位:字节。 + * @list 音频管理 + */ + + virtual int extraInfoSize() const = 0; + /** + * + * @type api + * @brief 释放音频帧 + * @list 音频管理 + */ + + virtual void release() = 0; + /** + * + * @type api + * @brief 获取音频静音标志 + * @return 是否静音数据
+ * - true: 是 + * - false: 否 + * @list 音频管理 + */ + + virtual bool isMutedData() const = 0; + /** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioFrame() = default; +}; +/** + * + * @type api + * @brief 创建 IAudioFrame + * @param builder 音频帧构建实例,参看 AudioFrameBuilder{@link #AudioFrameBuilder} + * @return 详见 IAudioFrame{@link #IAudioFrame} + * @list 音频管理 + */ + +BYTERTC_API IAudioFrame* buildAudioFrame(const AudioFrameBuilder& builder); + +/** + * + * @type keytype + * @brief 音频回调方法 + */ + +enum class AudioFrameCallbackMethod{ + /** + * + * @brief 本地麦克风录制的音频数据回调 + */ + + kRecord, + /** + * + * @brief 订阅的远端所有用户混音后的音频数据回调 + */ + + kPlayback, + /** + * + * @brief 本地麦克风录制和订阅的远端所有用户混音后的音频数据回调 + */ + + kMixed, + /** + * + * @brief 订阅的远端每个用户混音前的音频数据回调 + */ + + kRemoteUser, + /** + * + * @brief 本地屏幕录制的音频数据回调 + */ + + kRecordScreen, + /** + * + * @brief 本地麦克风录制和本地 `MediaPlayer`, `EffectPlayer` 播放的音频混音后的音频数据回调 + */ + + kCaptureMixed, +}; +/** + * + * @type callback + * @brief 音频数据回调观察者
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。
+ * 本接口类中的回调周期均为 20 ms。 + * @list 自定义流处理 + */ + +class IAudioFrameObserver { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioFrameObserver() { + } + /** + * + * @hidden for internal use only + * @valid since 3.50 + */ + + virtual void onRecordAudioFrameOriginal(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回麦克风录制的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onRecordAudioFrame(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回订阅的所有远端用户混音后的音频数据。 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onPlaybackAudioFrame(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回远端单个用户的音频数据 + * @param stream_id 远端流 ID。 + * @param stream_info 远端流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param audio_frame 音频数据, 参看 IAudioFrame{@link #IAudioFrame}。 + * @note 此回调在播放线程调用。不要在此回调中做任何耗时的事情,否则可能会影响整个音频播放链路。 + * @list 自定义流处理 + */ + + virtual void onRemoteUserAudioFrame(const char* stream_id, const StreamInfo& stream_info, const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回本地麦克风录制和订阅的所有远端用户混音后的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onMixedAudioFrame(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回本地屏幕录制的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onRecordScreenAudioFrame(const IAudioFrame& audio_frame) { + } + /** + * + * @type callback + * @brief 返回本地麦克风录制的音频数据,本地 `MediaPlayer` / `EffectPlayer` 播放音频文件混音后的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onCaptureMixedAudioFrame(const IAudioFrame& audio_frame) = 0; + +}; +/** + * + * @type callback + * @brief 自定义音频处理器。
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Custom Stream Processing + */ + +class IAudioFrameProcessor{ +public: + /** + * + * @type callback + * @brief 回调本地采集的音频帧地址,供自定义音频处理。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame} + * @note + * - 完成自定义音频处理后,SDK 会对处理后的音频帧进行编码,并传输到远端。 + * - 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并在参数中选择本地采集的音频时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + + virtual int onProcessRecordAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 回调远端音频混音的音频帧地址,供自定义音频处理。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame} + * @note 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并在参数中选择远端音频流的混音音频时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + + virtual int onProcessPlayBackAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 回调单个远端用户的音频帧地址,供自定义音频处理。 + * @param stream_id 远端流 ID。 + * @param stream_info 远端流信息, 参看 StreamInfo{@link #StreamInfo}。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame} + * @note 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并在参数中选择各个远端音频流时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + + virtual int onProcessRemoteUserAudioFrame(const char* stream_id, const StreamInfo& stream_info, IAudioFrame& audio_frame) = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @valid since 3.50 + * @type callback + * @brief 软件耳返音频数据的回调。你可根据此回调自定义处理音频。
+ * 耳返音频中包含通过调用 `setVoiceReverbType` 和 `setVoiceChangerType` 设置的音频特效。 + * @param audio_frame 音频帧地址。参看 IAudioFrame{@link #IAudioFrame}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 此数据处理只影响软件耳返音频数据。 + * - 要启用此回调,必须调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并选择耳返音频,每 10 ms 收到此回调。 + * @list Custom Stream Processing + */ + + virtual int onProcessEarMonitorAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 屏幕共享的音频帧地址回调。你可根据此回调自定义处理音频。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame}。 + * @note 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},把返回给音频处理器的音频类型设置为屏幕共享音频后,每 10 ms 收到此回调。 + * @list 屏幕共享 + */ + + virtual int onProcessScreenAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioFrameProcessor() { + } +}; +/** + * + * @type keytype + * @hidden for internal use only + * @region 音频管理 + * @brief 音频帧构建类 + */ + +typedef struct EncodedAudioFrameData { + /** + * + * @brief 音频编码类型 + */ + + AudioCodecType codec_type = kAudioCodecTypeNone; + /** + * + * @brief 音频数据 + */ + + uint8_t* data = nullptr; + /** + * + * @brief 音频数据大小 + */ + + int size = 0; + /** + * + * @brief 音频时间戳,单位:微秒 + */ + + int64_t timestamp_us = 0; + /** + * + * @brief 音频采样率 + */ + + int sample_rate = 0; + /** + * + * @brief 音频通道数 + */ + + int channel_num = 0; + /** + * + * @brief 音频帧大小,单位:毫秒 + */ + + int frame_size_ms = 0; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据 + */ + + uint8_t* extra_info = nullptr; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据大小 + */ + + int extra_info_size = 0; +} EncodedAudioFrameData; + +/** + * + * @type callback + * @hidden for internal use only + * @brief 远端音频帧监测器 + * @list 自定义流处理 + */ + +class IRemoteEncodedAudioFrameObserver { +public: + virtual ~IRemoteEncodedAudioFrameObserver () { + } + /** + * + * @type callback + * @hidden for internal use only + * @brief 调用 RegisterRemoteEncodedAudioFrameObserver 后,SDK 收到远端音频帧信息时,回调该事件 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息,参看 StreamInfo{@link #StreamInfo} + * @param audio_stream 远端音频帧信息,参看 EncodedAudioFrameData{@link #EncodedAudioFrameData} + * @list 自定义流处理 + */ + + virtual void onRemoteEncodedAudioFrame(const char* stream_id, + const StreamInfo& stream_info, const EncodedAudioFrameData& audio_stream) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_mixing_manager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_mixing_manager.h new file mode 100644 index 0000000..e443668 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_mixing_manager.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Mixing Manager +*/ + +#pragma once + +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @hidden(Linux) + * @type callback + * @brief 本地音频文件混音的音频帧观察者。
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 自定义流处理 + */ + +class IAudioFileFrameObserver { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IAudioFileFrameObserver(){} + /** + * + * @type callback + * @brief 当本地音频文件混音时,回调播放的音频帧。 + * @param mix_id 混音 ID。 + * @param audio_frame 参看 IAudioFrame{@link #IAudioFrame}。 + * @list 自定义流处理 + */ + + virtual void onAudioFileFrame(int mix_id, const IAudioFrame& audio_frame) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_camera_control_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_camera_control_interface.h new file mode 100644 index 0000000..a4ca364 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_camera_control_interface.h @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. +*/ + +#pragma once + +#include + +namespace bytertc { +/** + * + * @type keytype + * @brief 相机补光灯状态 + */ + +enum TorchState{ + + /** + * + * @brief 相机补光灯关闭 + */ + + kTorchStateOff=0, + /** + * + * @brief 相机补光灯打开 + */ + + kTorchStateOn=1, +}; +/** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @brief 相机控制接口 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能使用这个接口。 + */ + +class ICameraControl { +public: + virtual ~ICameraControl() = default; + /** + * + * @type api + * @brief 设置当前使用的摄像头(前置/后置)的变焦倍数 + * @param zoom_val 变焦倍数。取值范围是 [1, <最大变焦倍数>]。
+ * 最大变焦倍数可以通过调用 getCameraZoomMaxRatio{@link #ICameraControl#getCameraZoomMaxRatio} 获取。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置摄像头变焦倍数。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraZoomRatio(float zoom_val) = 0; + /** + * + * @type api + * @brief 获取当前使用的摄像头(前置/后置)的最大变焦倍数 + * @return 最大变焦倍数 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头最大变焦倍数。 + */ + + virtual float getCameraZoomMaxRatio() = 0; + /** + * + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持变焦(数码/光学变焦)。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头变焦能力。 + */ + + virtual bool isCameraZoomSupported() = 0; + /** + * + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持闪光灯。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测闪光能力。 + */ + + virtual bool isCameraTorchSupported() = 0; + /** + * + * @type api + * @brief 打开/关闭当前使用的摄像头(前置/后置)的闪光灯 + * @param torch_state 打开/关闭。参看 TorchState{@link #TorchState}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置闪光灯。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraTorch(TorchState torch_state) = 0; + /** + * + * @type api + * @brief 检查当前使用的摄像头是否支持对焦点设置 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检查对焦点设置能力。 + */ + + virtual bool isCameraFocusPositionSupported() = 0; + /** + * + * @type api + * @brief 设置当前使用的摄像头的对焦点 + * @param x 对焦点水平方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最左边,1 为最右边。 + * @param y 对焦点垂直方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最上边,1 为最下边。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置对焦点。 + * - 对焦点设置为画布中央(即[0.5, 0.5]) 时,恢复系统默认值。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraFocusPosition(float x, float y) = 0; + /** + * + * @type api + * @brief 检查当前使用的摄像头是否支持曝光点设置 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检查曝光点设置能力。 + */ + + virtual bool isCameraExposurePositionSupported() = 0; + /** + * + * @type api + * @brief 设置当前使用的摄像头的曝光点 + * @param x 曝光点水平方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最左边,1 为最右边。 + * @param y 曝光点垂直方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最上边,1 为最下边。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置曝光点。 + * - 曝光点设置为画布中央(即[0.5, 0.5]) 时,恢复系统默认值。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraExposurePosition(float x, float y) = 0; + /** + * + * @type api + * @brief Sets the exposure point of the currently used camera. + * @param val 曝光补偿值,取值范围[-1, 1],0 为系统默认值(没有曝光补偿)。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置曝光补偿。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraExposureCompensation(float val) = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @valid since 353 + * @type api + * @brief 启用或禁用内部采集时人脸自动曝光模式。此模式会改善强逆光下,脸部过暗的问题;但也会导致 ROI 以外区域过亮/过暗的问题。 + * @param enable 是否启用。iOS默认开启,Android默认关闭。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note + * - 对 Android,你必须在调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部采集前,调用此接口方可生效。 + * - 对 iOS,在采集前或采集中调用此接口均可生效。 + * @list 视频管理 + */ + + virtual int enableCameraAutoExposureFaceMode(bool enable) = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @valid since 353 + * @type api + * @brief 设置内部采集适用动态帧率时,帧率的最小值。 + * @param framerate 最小值。单位为 fps。默认值是 7。
+ * 动态帧率的最大帧率是通过 setVideoCaptureConfig{@link #IRTCEngine#setVideoCaptureConfig} 设置的帧率值。当传入参数大于最大帧率时,使用固定帧率模式,帧率为最大帧率;当传入参数小于最大帧率时,使用动态帧率。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note + * - 你必须在调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部采集前,调用此接口方可生效。 + * - 如果由于性能降级、静态适配等原因导致采集最大帧率变化时,已设置的最小帧率值会与新的采集最大帧率值重新比较。比较结果变化可能导致固定/动态帧率模式切换。 + * - 对 Android,默认开启动态帧率模式 + * - 对 iOS,默认使用固定帧率模式 + * @list 视频管理 + */ + + virtual int setCameraAdaptiveMinimumFrameRate(int framerate) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_defines.h new file mode 100644 index 0000000..6779d62 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_defines.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Defines + */ + +#pragma once + +#include "bytertc_rts_defines.h" +#include "bytertc_media_defines.h" +#include "bytertc_audio_defines.h" +#include "bytertc_video_defines.h" +#include "bytertc_transcoder_define.h" diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_internal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_internal.h new file mode 100644 index 0000000..1cef74b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_internal.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Internal API +*/ + +#pragma once + +#include "bytertc_defines.h" +#include +#include + +namespace bytertc { + +/** + * @brief 设置 ByteRTC SDK 默认开启使用QUIC获取配置 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableQuicGetAccess(); + +/** + * @brief 设置 ByteRTC SDK 默认开启使用KCP获取配置 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableKcpGetAccess(); + +/** + * @brief 设置 ByteRTC SDK 默认开启通话前网络探测 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableNetworkDetect(); + +/** + * @brief 设置 ByteRTC SDK 默认开启使用KCP消息通道 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableKcpDataChannel(); + +struct VideoStreamDescription { + unsigned int width; + unsigned int height; + unsigned int frame_rate; + unsigned int max_kbps; +}; + +enum class PixelFormat { + kDefault = 0, + kI420 = 1, + kRGBA = 2, + kTexture = 3, +}; + +enum class NetworkFamily { + kNetworkFamilyNone = 0, + kNetworkFamilyIPv4 = 1, + kNetworkFamilyIPv6 = 2, + kNetworkFamilyBoth = 3, +}; + +enum StreamFlag { + kStreamFlagNone = 0, + kStreamFlagNormal = 1 << 0, + kStreamFlagDocShare = 1 << 1, + kStreamFlagMCU = 1 << 2, + kStreamFlagMeetTogether = 1 << 3, + + kStreamFlagIntelligentStream = 1 << 6, +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_defines.h new file mode 100644 index 0000000..5f162fa --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_defines.h @@ -0,0 +1,586 @@ +#pragma once + +#include + +namespace bytertc { + +/** + * + * @type keytype + * @brief 歌曲过滤方式。 + */ + +enum MusicFilterType { + /** + * + * @brief 不过滤。 + */ + + kMusicFilterTypeNone = 0, + /** + * + * @brief 过滤没有歌词的歌曲。 + */ + + kMusicFilterTypeWithoutLyric = 1 << 0, + /** + * + * @brief 过滤不支持打分的歌曲。 + */ + + kMusicFilterTypeUnsupportedScore = 1 << 1, + /** + * + * @brief 过滤不支持伴唱切换的歌曲。 + */ + + kMusicFilterTypeUnsupportedAccopmay = 1 << 2, + /** + * + * @brief 过滤没有高潮片段的歌曲。 + */ + + kMusicFilterTypeUnsupportedClimx = 1 << 3, +}; + +/** + * + * @type keytype + * @brief 原唱伴唱类型。 + */ + +enum class AudioTrackType { + /** + * + * @brief 播放原唱。 + */ + + kOriginal = 1, + /** + * + * @brief 播放伴唱。 + */ + + kAccompy = 2 +}; + +/** + * + * @type keytype + * @brief 音乐播放类型。 + */ + +enum class AudioPlayType { + /** + * + * @brief 仅本地播放。 + */ + + kLocal, + /** + * + * @brief 仅远端播放。 + */ + + kRemote, + /** + * + * @brief 本地、远端同时播放。 + */ + + kLocalAndRemote +}; + +/** + * + * @type keytype + * @brief 音乐播放状态。 + */ + +enum class PlayState { + /** + * + * @brief 播放中。 + */ + + kPlaying = 1, + /** + * + * @brief 暂停中。 + */ + + kPaused = 2, + /** + * + * @brief 已停止。 + */ + + kStoped = 3, + /** + * + * @brief 播放失败。 + */ + + kFailed = 4, + /** + * + * @brief 播放结束。 + */ + + kFinished = 5, +}; + +/** + * + * @type keytype + * @brief 歌词格式类型。 + */ + +enum class LyricStatus { + /** + * + * @brief 无歌词。 + */ + + kNone = 0, + /** + * + * @brief KRC 歌词。 + */ + + kKRC = 1, + /** + * + * @brief LRC 歌词。 + */ + + kLRC = 2, + /** + * + * @brief KRC 歌词和 LRC 歌词均有。 + */ + + kKRCAndLRC = 3 +}; + +/** + * + * @type keytype + * @brief 歌词文件类型。 + */ + +enum class DownloadLyricType { + /** + * + * @brief KRC 歌词文件。 + */ + + kKRC, + /** + * + * @brief LRC 歌词文件。 + */ + + kLRC +}; + + + +/** + * + * @type keytype + * @brief 歌曲数据。 + */ + +struct MusicInfo +{ + /** + * + * @brief 音乐 ID。 + */ + + const char* music_id; + /** + * + * @brief 音乐名称。 + */ + + const char* music_name; + /** + * + * @brief 歌手。 + */ + + const char* singer; + /** + * + * @brief 版权商 ID。 + */ + + const char* vendor_id; + /** + * + * @brief 版权商名称。 + */ + + const char* vendor_name; + /** + * + * @brief 最新更新时间戳,单位为毫秒。 + */ + + int64_t update_timestamp; + /** + * + * @brief 封面地址。 + */ + + const char* poster_url; + /** + * + * @brief 歌词格式类型,参看 LyricStatus{@link #LyricStatus}。 + */ + + LyricStatus lyric_status; + /** + * + * @brief 歌曲长度,单位为毫秒。 + */ + + int duration; + /** + * + * @brief 歌曲是否支持打分。 + */ + + bool enable_score; + /** + * + * @brief 歌曲高潮片段开始时间,单位为毫秒。 + */ + + int climax_start_time; + /** + * + * @brief 歌曲高潮片段停止时间,单位为毫秒。 + */ + + int climax_stop_time; + +}; + +/** + * + * @type keytype + * @brief 热榜歌曲数据。 + */ + +struct HotMusicInfo { + /** + * + * @brief 热榜名称。 + */ + + const char* hot_name; + /** + * + * @brief 歌曲数据,参看 MusicInfo{@link #MusicInfo}。 + */ + + MusicInfo* musics; + /** + * + * @brief 歌曲列表的数量。 + */ + + int music_count; +}; + +/** + * + * @type keytype + * @brief 下载文件类型。 + */ + +enum DownloadFileType { + /** + * + * @brief 音频文件。 + */ + + kDownloadFileTypeMusic = 1, + /** + * + * @brief KRC 歌词文件。 + */ + + kDownloadFileTypeKRC = 2, + /** + * + * @brief LRC 歌词文件。 + */ + + kDownloadFileTypeLRC = 3, + /** + * + * @brief MIDI 文件。 + */ + + kDownloadFileTypeMIDI = 4 + +} ; + +/** + * + * @type keytype + * @brief 歌曲下载信息。 + */ + +struct DownloadResult { + /** + * + * @brief 文件存放路径。 + */ + + const char* local_file_path; + /** + * + * @brief 音乐 ID。 + */ + + const char* music_id; + /** + * + * @brief 下载文件类型,参看 DownloadFileType{@link #DownloadFileType}。 + */ + + DownloadFileType type; +}; + + +/** + * + * @type errorcode + * @brief KTV 错误码。 + */ + +enum KTVErrorCode { + /** + * + * @brief 成功。 + */ + + kKTVErrorCodeOK = 0, + /** + * + * @brief AppID 异常。 + */ + + kKTVErrorCodeAppidInValid = -3000, + /** + * + * @brief 非法参数,传入的参数不正确。 + */ + + kKTVErrorCodeParasInValid = -3001, + /** + * + * @brief 获取歌曲资源失败。 + */ + + kKTVErrorCodeGetMusicFailed = -3002, + /** + * + * @brief 获取歌词失败。 + */ + + kKTVErrorCodeGetLyricFailed = -3003, + /** + * + * @brief 歌曲下架。 + */ + + kKTVErrorCodeMusicTakedown = -3004, + /** + * + * @brief 歌曲文件下载失败。 + */ + + kKTVErrorCodeMusicDownload = -3005, + /** + * + * @brief MIDI 文件下载失败。 + */ + + kKTVErrorCodeMidiDownloadFailed = -3006, + /** + * + * @brief 系统繁忙。 + */ + + kKTVErrorCodeSystemBusy = -3007, + /** + * + * @brief 网络异常。 + */ + + kKTVErrorCodeNetwork = -3008, + /** + * + * @brief KTV 功能未加入房间。 + */ + + kKTVErrorCodeNotJoinRoom = -3009, + /** + * + * @brief 解析数据失败。 + */ + + kKTVErrorCodeParseData = -3010, + /** + * + * @hidden + * @deprecated 从 353 开始。 + * @brief 下载失败。 + */ + + kKTVErrorCodeDownload = -3011, + /** + * + * @brief 已在下载中。 + */ + + kKTVErrorCodeDownloading = -3012, + /** + * + * @brief 内部错误,联系技术支持人员。 + */ + + kKTVErrorCodeInternalDomain = -3013, + /** + * + * @brief 下载失败,磁盘空间不足。清除缓存后重试。 + */ + + kKTVErrorCodeInsufficientDiskSpace = -3014, + /** + * + * @brief 下载失败,音乐文件解密失败,联系技术支持人员。 + */ + + kKTVErrorCodeMusicDecryptionFailed = -3015, + /** + * + * @brief 下载失败,音乐文件重命名失败,请重试。 + */ + + kKTVErrorCodeFileRenameFailed = -3016, + /** + * + * @brief 下载失败,下载超时,请重试。 + */ + + kKTVErrorCodeDownloadTimeOut = -3017, + /** + * + * @brief 清除缓存失败,可能原因是文件被占用或者系统异常,请重试。 + */ + + kKTVErrorCodeClearCacheFailed = -3018, + /** + * + * @brief 取消下载。 + */ + + kKTVErrorCodeDownloadCanceled = -3019 +}; + +/** + * + * @type keytype + * @brief KTV 播放器错误码。 + */ + +enum KTVPlayerErrorCode { + /** + * + * @brief 成功。 + */ + + kKTVPlayerErrorCodeOK = 0, + /** + * + * @brief 播放错误,请下载后播放。 + */ + + kKTVPlayerErrorCodeFileNotExist = -3020, + /** + * + * @brief 播放错误,请确认文件播放格式。 + */ + + kKTVPlayerErrorCodeFileError = -3021, + /** + * + * @brief 播放错误,未进入房间。 + */ + + kKTVPlayerErrorCodeNotJoinRoom = -3022, + /** + * + * @brief 参数错误。 + */ + + kKTVPlayerErrorCodeParam = -3023, + /** + * + * @brief 播放失败,找不到文件或文件打开失败。 + */ + + kKTVPlayerErrorCodeStartError = -3024, + /** + * + * @brief 混音 ID 异常。 + */ + + kKTVPlayerErrorCodeMixIdError = -3025, + /** + * + * @brief 设置播放位置出错。 + */ + + kKTVPlayerErrorCodePositionError = -3026, + /** + * + * @brief 音量参数不合法,可设置的取值范围为 [0,400]。 + */ + + kKTVPlayerErrorCodeAudioVolumeError = -3027, + /** + * + * @brief 不支持此混音类型。 + */ + + kKTVPlayerErrorCodeTypeError = -3028, + /** + * + * @brief 音调文件不合法。 + */ + + kKTVPlayerErrorCodePitchError = -3029, + /** + * + * @brief 音轨不合法。 + */ + + kKTVPlayerErrorCodeAudioTrackError = -3030, + /** + * + * @brief 混音启动中。 + */ + + kKTVPlayerErrorCodeStartingError = -3031 +}; + + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_manager_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_manager_interface.h new file mode 100644 index 0000000..053a139 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_manager_interface.h @@ -0,0 +1,483 @@ +#pragma once + +#include "bytertc_ktv_defines.h" +namespace bytertc { +/** + * + * @type callback + * @brief KTV 事件回调接口。
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 在线 KTV + */ + +class IKTVManagerEventHandler { + +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVManagerEventHandler() { + } + /** + * + * @type callback + * @brief 歌曲列表回调。 + * @param music_infos 歌曲数据数组,参看 MusicInfo{@link #MusicInfo}。 + * @param music_count 当前查询的数据条目数。 + * @param total_musics_size 数据条目总数。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onMusicListResult(MusicInfo* music_infos, int music_count, int total_musics_size, KTVErrorCode error_code) { + (void)music_infos; + (void)music_count; + (void)total_musics_size; + (void)error_code; + } + /** + * + * @type callback + * @brief 搜索歌曲结果回调。 + * @param music_infos 歌曲数据数组,参看 MusicInfo{@link #MusicInfo}。 + * @param music_count 当前查询的数据条目数。 + * @param total_musics_size 数据条目总数。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onSearchMusicResult(MusicInfo* music_infos, int music_count, int total_musics_size, KTVErrorCode error_code) { + (void)music_infos; + (void)music_count; + (void)total_musics_size; + (void)error_code; + } + /** + * + * @type callback + * @brief 热榜歌曲结果回调。 + * @param hot_infos 热榜歌曲数据数组,参看 HotMusicInfo{@link #HotMusicInfo}。 + * @param hot_count 当前查询的热榜歌曲数据条目数。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onHotMusicResult(HotMusicInfo* hot_infos, int hot_count, KTVErrorCode error_code) { + (void)hot_infos; + (void)hot_count; + (void)error_code; + } + /** + * + * @type callback + * @brief 歌曲详细信息回调。 + * @param music_info 歌曲数据,参看 MusicInfo{@link #MusicInfo}。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。
+ * @list 在线 KTV + */ + + virtual void onMusicDetailResult(MusicInfo* music_info, KTVErrorCode error_code) { + (void)music_info; + (void)error_code; + } + /** + * + * @type callback + * @brief 下载成功回调。 + * @param download_id 下载任务 ID。 + * @param download_info 下载信息,参看 DownloadResult{@link #DownloadResult}。 + * @list 在线 KTV + */ + + virtual void onDownloadSuccess(int download_id, DownloadResult* download_info) { + (void)download_id; + (void)download_info; + } + /** + * + * @type callback + * @brief 下载失败回调。 + * @param download_id 下载任务 ID。 + * @param error_code 错误码,参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onDownloadFailed(int download_id, KTVErrorCode error_code) { + (void)download_id; + (void)error_code; + } + /** + * + * @type callback + * @brief 歌曲文件下载进度回调。 + * @param download_id 下载任务 ID。 + * @param download_percentage 下载进度百分比,取值范围 [0,100]。 + * @list 在线 KTV + */ + + virtual void onDownloadMusicProgress(int download_id, int download_percentage) { + (void)download_id; + (void)download_percentage; + } + /** + * + * @type callback + * @brief 清理文件缓存结果回调。 + * @param error_code 错误码,非 0 为失败,参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list Online Karaoke + */ + + virtual void onClearCacheResult(KTVErrorCode error_code) { + (void)error_code; + } +}; +/** + * + * @type callback + * @brief KTV 播放器回调接口。
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Online Karaoke + */ + +class IKTVPlayerEventHandler { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVPlayerEventHandler() { + } + /** + * + * @type callback + * @brief 音乐播放进度回调。 + * @param music_id 音乐 ID。 + * @param progress 音乐播放进度,单位为毫秒。 + * @list 在线 KTV + */ + + virtual void onPlayProgress(const char *music_id, int64_t progress) { + (void)music_id; + (void)progress; + } + /** + * + * @type callback + * @brief 音乐播放状态改变回调。 + * @param music_id 音乐 ID。 + * @param play_state 音乐播放状态,参看 PlayState{@link #PlayState}。 + * @param error_code 错误码,参看 KTVPlayerErrorCode{@link #KTVPlayerErrorCode}。 + * @note + * 此回调被触发的时机汇总如下:
+ * - 调用 playMusic{@link #IKTVPlayer#playMusic} 成功后,会触发 playState 值为 PlayStatePlaying 的回调;否则会触发 playState 值为 PlayStateFailed 的回调。 + * - 使用相同的音乐 ID 重复调用 playMusic{@link #IKTVPlayer#playMusic} 后,后一次播放会覆盖前一次,且会触发 playState 值为 PlayStatePlaying 的回调,表示后一次音乐播放已开始。 + * - 调用 pauseMusic{@link #IKTVPlayer#pauseMusic} 方法暂停播放成功后,会触发 playState 值为 PlayStatePaused 的回调;否则触发 playState 值为 PlayStateFailed 的回调。 + * - 调用 resumeMusic{@link #IKTVPlayer#resumeMusic} 方法恢复播放成功后,会触发 playState 值为 PlayStatePlaying 的回调;否则触发 playState 值为 PlayStateFailed 的回调。 + * - 调用 stopMusic{@link #IKTVPlayer#stopMusic} 方法停止播放成功后,会触发 playState 值为 PlayStateStoped 的回调;否则触发 playState 值为 PlayStateFailed 的回调。 + * - 音乐播放结束会触发 playState 值为 PlayStateFinished 的回调。 + * @list 在线 KTV + */ + + virtual void onPlayStateChanged(const char* music_id, PlayState play_state, bytertc::KTVPlayerErrorCode error_code) { + (void)music_id; + (void)play_state; + (void)error_code; + } +}; +/** + * + * @type api + * @brief KTV 播放器接口。 + * @list Online Karaoke + */ + +class IKTVPlayer { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVPlayer() = default; + /** + * + * @type api + * @brief 设置 KTV 播放器进度及状态回调接口。 + * @param handler KTV 播放器回调类,参看 IKTVPlayerEventHandler{@link #IKTVPlayerEventHandler}。 + * @list 在线 KTV + */ + + virtual void setPlayerEventHandler(IKTVPlayerEventHandler *handler) = 0; + /** + * + * @type api + * @brief 播放歌曲。 + * @param music_id 音乐 ID。
+ * 若同一 music_id 的歌曲正在播放,再次调用接口会从开始位置重新播放。若 music_id 对应的音频文件不存在会触发报错。 + * @param track_type 原唱伴唱类型,参看 AudioTrackType{@link #AudioTrackType}。 + * @param play_type 音乐播放类型。参看 AudioPlayType{@link #AudioPlayType}。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * - 若音乐文件不存在,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3020,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void playMusic(const char* music_id, AudioTrackType track_type, AudioPlayType play_type) = 0; + /** + * + * @type api + * @brief 暂停播放歌曲。 + * @param music_id 音乐 ID。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void pauseMusic(const char *music_id) = 0; + /** + * + * @type api + * @brief 继续播放歌曲。 + * @param music_id 音乐 ID。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void resumeMusic(const char *music_id) = 0; + /** + * + * @type api + * @brief 停止播放歌曲。 + * @param music_id 音乐 ID。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void stopMusic(const char *music_id) = 0; + /** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param music_id 音乐 ID。 + * @param position 音乐起始位置,单位为毫秒,取值小于音乐文件总时长。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void seekMusic(const char *music_id, int position) = 0; + /** + * + * @type api + * @brief 设置歌曲播放音量,只能在开始播放后进行设置。 + * @param music_id 音乐 ID。 + * @param volume 歌曲播放音量,调节范围:[0,400]。
+ * - 0:静音。 + * - 100:原始音量。 + * - 400: 原始音量的 4 倍(自带溢出保护)。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的音量大于 400,则按最大值 400 进行调整;若设置的音量小于 0,则按最小值 0 进行调整。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void setMusicVolume(const char *music_id, int volume) = 0; + /** + * + * @type api + * @brief 切换歌曲原唱伴唱。 + * @param music_id 音乐 ID。 + * @note 调用本接口时音乐必须处于播放中状态。 + * @list 在线 KTV + */ + + virtual void switchAudioTrackType(const char *music_id) = 0; + /** + * + * @type api + * @brief 对播放中的音乐设置升降调信息。 + * @param music_id 音乐 ID。 + * @param pitch 相对于音乐文件原始音调的升高/降低值,取值范围 [-12,12],默认值为 0,即不做调整。
+ * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的 pitch 大于 12,则按最大值 12 进行调整;若设置的 pitch 小于 –12,则按最小值 –12 进行调整。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void setMusicPitch(const char* music_id, int pitch) = 0; + +}; +/** + * + * @type api + * @brief KTV 管理接口。 + * @list Online Karaoke + */ + +class IKTVManager { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVManager() = default; + /** + * + * @type api + * @brief 设置歌曲文件最大占用的本地缓存。 + * @param max_cache_size_mb 本地缓存,单位 MB。
+ * 设置值小于等于 0 时,使用默认值 1024 MB。 + * @list 在线 KTV + */ + + virtual void setMaxCacheSize(int max_cache_size_mb) = 0; + /** + * + * @type api + * @brief 设置 KTV 回调接口。 + * @param ktv_manager_event_handler KTV 回调类,参看 IKTVManagerEventHandler{@link #IKTVManagerEventHandler}。 + * @list 在线 KTV + */ + + virtual void setKTVManagerEventHandler(IKTVManagerEventHandler *ktv_manager_event_handler) = 0; + /** + * + * @type api + * @brief 获取歌曲列表。 + * @param page_num 页码,默认从 1 开始。 + * @param page_size 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filters 歌曲过滤方式,参看 MusicFilterType{@link #MusicFilterType}。 + * @note 调用接口后,你会收到 onMusicListResult{@link #IKTVManagerEventHandler#onMusicListResult} 回调歌曲列表。 + * @list 在线 KTV + */ + + virtual void getMusicList(int page_num, int page_size, int filters) = 0; + /** + * + * @type api + * @brief 根据关键词搜索歌曲。 + * @param key_word 关键词,字符串长度最大为 20 个字符。 + * @param page_num 页码,默认从 1 开始。 + * @param page_size 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filters 歌曲过滤方式,参看 MusicFilterType{@link #MusicFilterType}。 + * @note 调用接口后,你会收到 onSearchMusicResult{@link #IKTVManagerEventHandler#onSearchMusicResult} 回调歌曲列表。 + * @list 在线 KTV + */ + + virtual void searchMusic(const char* key_word, int page_num, int page_size, int filters) = 0; + /** + * + * @type api + * @brief 指定歌曲榜单,并获取其歌曲列表。 + * @param custom_hotlist_id 榜单 ID。
+ * 默认榜单 ID 有:`ContentCenter` 和 `Project`,分别是火山内容中心热歌榜和项目热歌榜。如果你需要其他榜单,请联系技术支持人员。 + * @param id_num 榜单 ID 的个数。 + * @param filters 歌曲过滤方式,参看 MusicFilterType{@link #MusicFilterType}。 + * @note 调用接口后,你会收到 onHotMusicResult{@link #IKTVManagerEventHandler#onHotMusicResult} 回调歌曲列表。 + * @list 在线 KTV + */ + + virtual void getHotMusic(const char** custom_hotlist_id, int id_num, int filters) = 0; + /** + * + * @type api + * @brief 获取音乐详细信息。 + * @param music_id 音乐 ID。 + * @note 调用接口后,你会收到 onMusicDetailResult{@link #IKTVManagerEventHandler#onMusicDetailResult} 回调。 + * @list 在线 KTV + */ + + virtual void getMusicDetail(const char* music_id) = 0; + /** + * + * @type api + * @brief 下载音乐。 + * @param music_id 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若音乐下载成功,你会收到 onDownloadSuccess{@link #IKTVManagerEventHandler#onDownloadSuccess} 回调。 + * - 若音乐下载失败,你会收到 onDownloadFailed{@link #IKTVManagerEventHandler#onDownloadFailed} 回调。 + * - 音乐下载进度更新时,你会收到 onDownloadMusicProgress{@link #IKTVManagerEventHandler#onDownloadMusicProgress} 回调。 + * @list 在线 KTV + */ + + virtual int downloadMusic(const char* music_id) = 0; + /** + * + * @type api + * @brief 下载歌词。 + * @param music_id 音乐 ID。 + * @param type 歌词文件类型,参看 DownloadLyricType{@link #DownloadLyricType}。 + * @return 下载任务 ID。 + * @note + * - 若歌词下载成功,你会收到 onDownloadSuccess{@link #IKTVManagerEventHandler#onDownloadSuccess} 回调。 + * - 若歌词下载失败,你会收到 onDownloadFailed{@link #IKTVManagerEventHandler#onDownloadFailed} 回调。 + * @list 在线 KTV + */ + + virtual int downloadLyric(const char* music_id, DownloadLyricType type) = 0; + /** + * + * @type api + * @brief 下载 MIDI 文件。 + * @param music_id 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若文件下载成功,你会收到 onDownloadSuccess{@link #IKTVManagerEventHandler#onDownloadSuccess} 回调。 + * - 若文件下载失败,你会收到 onDownloadFailed{@link #IKTVManagerEventHandler#onDownloadFailed} 回调。 + * @list 在线 KTV + */ + + virtual int downloadMidi(const char* music_id) = 0; + /** + * + * @type api + * @brief 取消下载任务。 + * @param download_id 下载任务 ID。 + * @list 在线 KTV + */ + + virtual void cancelDownload(int download_id) = 0; + /** + * + * @type api + * @brief 清除当前音乐缓存文件,包括音乐音频和歌词。 + * @list 在线 KTV + */ + + virtual void clearCache() = 0; + /** + * + * @type api + * @brief 获取 KTV 播放器。 + * @return KTV 播放器接口,参看 IKTVPlayer{@link #IKTVPlayer}。 + * @list 在线 KTV + */ + + virtual IKTVPlayer *getKTVPlayer() = 0; + +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_defines.h new file mode 100644 index 0000000..f5979c0 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_defines.h @@ -0,0 +1,5285 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Stream Defines + */ + +#pragma once + +#include +#include + +#include "bytertc_rts_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 方法调用结果。 + */ + +enum ReturnStatus { + /** + * + * @brief 成功。 + */ + + kReturnStatusSuccess = 0, + /** + * + * @brief 失败。 + */ + + kReturnStatusFailure = -1, + /** + * + * @brief 参数错误。 + */ + + kReturnStatusParameterErr = -2, + /** + * + * @brief 接口状态错误。 + */ + + kReturnStatusWrongState = -3, + /** + * + * @brief 失败,用户已在房间内。 + */ + + kReturnStatusHasInRoom = -4, + /** + * + * @brief 失败,用户已登录。 + */ + + kReturnStatusHasInLogin = -5, + /** + * + * @brief 失败,用户已经在进行通话回路测试中。 + */ + + kReturnStatusHasInEchoTest = -6, + /** + * + * @brief 失败,音视频均未采集。 + */ + + kReturnStatusNeitherVideoNorAudio = -7, + /** + * + * @brief 失败,该 roomId 已被使用。 + */ + + kReturnStatusRoomIdInUse = -8, + /** + * + * @brief 失败,屏幕流不支持。 + */ + + kReturnStatusScreenNotSupport = -9, + /** + * + * @brief 失败,不支持该操作。 + */ + + kReturnStatusNotSupport = -10, + /** + * + * @brief 失败,资源已占用。 + */ + + kReturnStatusResourceOverflow = -11, + /** + * + * @brief 失败,不支持视频接口调用。 + */ + + kReturnStatusVideoNotSupport = -12, + /** + * + * @brief 游戏场景不支持调用该接口,会与游戏房间模块的 enableMicrophone{@link #IGameRoom#enableMicrophone} 接口互相冲突 + */ + + kReturnStatusGameSceneNotSupport = -13, + /** + * + * @brief 失败,没有音频帧。 + */ + + kReturnStatusAudioNoFrame = -101, + /** + * + * @brief 失败,未实现。 + */ + + kReturnStatusAudioNotImplemented = -102, + /** + * + * @brief 失败,采集设备无麦克风权限,尝试初始化设备失败。 + */ + + kReturnStatusAudioNoPermission = -103, + /** + * + * @brief 失败,设备不存在。当前没有设备或设备被移除时返回该值。 + */ + + kReturnStatusAudioDeviceNotExists = -104, + /** + * + * @brief 失败,设备音频格式不支持。 + */ + + kReturnStatusAudioDeviceFormatNotSupport = -105, + /** + * + * @brief 失败,系统无可用设备。 + */ + + kReturnStatusAudioDeviceNoDevice = -106, + /** + * + * @brief 失败,当前设备不可用,需更换设备。 + */ + + kReturnStatusAudioDeviceCannotUse = -107, + /** + * + * @brief 系统错误,设备初始化失败。 + */ + + kReturnStatusAudioDeviceInitFailed = -108, + /** + * + * @brief 系统错误,设备开启失败。 + */ + + kReturnStatusAudioDeviceStartFailed = -109, + /** + * + * @brief 指定的音频进程不存在,采集失败。 + */ + + kReturnStatusAudioDeviceProcessNotExist = -110, + /** + * + * @brief 不支持指定进程采集音频 + */ + + kReturnStatusAudioDeviceSpecifyingProcessUnsupport = -111, + /** + * + * @brief 失败,无效对象。 + */ + + kReturnStatusNativeInvalid = -201, + /** + * + * @brief 警告。推送视频帧到 RTC SDK 时,相邻视频帧的时间戳差异应当和推帧操作的间隔相同。如果不同,会收到此警告。 + */ + + kReturnStatusVideoTimeStampWarning = -202, + /** + * + * @brief 告警,配置下发了无效的aec场景。 + */ + + kReturnStatusAecSceneWarning = -302, + /** + * + * @brief 警告,配置下发了错误的aec类型。 + */ + + kReturnStatusAecTypeWarning = -303, +}; + +/** + * + * @type keytype + * @brief 房间内远端流被移除的原因。 + */ + +enum StreamRemoveReason { + /** + * + * @brief 远端用户停止发布流。 + */ + + kStreamRemoveReasonUnpublish = 0, + /** + * + * @brief 远端用户发布流失败。 + */ + + kStreamRemoveReasonPublishFailed = 1, + /** + * + * @brief 媒体服务器 10s 没收到客户端的媒体数据。 + */ + + kStreamRemoveReasonKeepLiveFailed = 2, + /** + * + * @brief 远端用户断网。 + */ + + kStreamRemoveReasonClientDisconnected = 3, + /** + * + * @brief 远端用户重新发布流。 + */ + + kStreamRemoveReasonRepublish = 4, + /** + * + * @brief 其他原因。 + */ + + kStreamRemoveReasonOther = 5, + /** + * + * @brief 远端用户 Token 发布权限过期。 + */ + + kStreamRemoveReasonPrivilegeTokenExpired = 6, + /** + * + * @brief 远端用户流被踢。 + */ + + kStreamRemoveReasonStreamKickedByOther = 7, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 用户角色。 + */ + +enum UserRoleType { + /** + * + * @brief 主播角色。该角色用户可在房间内发布和订阅音视频流,房间中的其他用户可以感知到该用户的存在。 + */ + + kUserRoleTypeBroadcaster = 1, + /** + * + * @brief 隐身用户角色。此角色用户只可在房间内订阅音视频流,房间中的其他用户无法感知到该用户的存在。 + */ + + kUserRoleTypeSilentAudience = 2, +}; + +/** + * + * @type keytype + * @brief 用户可见性状态改变错误码。 + */ + +enum UserVisibilityChangeError { + /** + * + * @brief 成功。 + */ + + kUserVisibilityChangeErrorOk = 0, + /** + * + * @brief 未知错误。 + */ + + kUserVisibilityChangeErrorUnknown = 1, + /** + * + * @brief 房间内可见用户达到上限。 + */ + + kUserVisibilityChangeErrorTooManyVisibleUser = 2, +}; + +/** + * + * @type keytype + * @brief 数据消息来源 + */ + +enum DataMessageSourceType { + /** + * + * @brief 通过客户端或服务端的插入的自定义消息。 + */ + + kDataMessageSourceTypeDefault = 0, + /** + * + * @brief 系统数据,包含音量指示信息。 + */ + + kDataMessageSourceTypeSystem, +}; + +/** + * + * @type keytype + * @brief SEI 发送模式。 + */ + +enum SEICountPerFrame { + /** + * + * @brief 单发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,SEI 数据会按顺序跟随连续的视频帧逐帧发送,单个视频帧最多只有一个 SEI 数据。 + * 例如,假设在某一帧间隔内需要发送 3 个 SEI 数据,那么第 1 个 SEI 会在当前帧发送,第 2 个 SEI 会在下一帧发送,第 3 个 SEI 会在再下一帧发送。 + */ + + kSEICountPerFrameSingle = 0, + /** + * + * @brief 多发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,这些 SEI 数据会全部在下一个视频帧上发送。这种模式可以降低发送延迟,但单个视频帧会携带多个 SEI 数据。 + * 例如,假设在某一帧间隔内有 3 个 SEI 数据需要发送,这 3 个 SEI 数据将全部在下一个视频帧上发送。 + */ + + kSEICountPerFrameMulti, +}; + +/** + * + * @type keytype + * @brief 上行/下行网络质量 + */ + +struct NetworkQualityStats { + /** + * + * @brief 用户 ID + */ + + const char* uid; + /** + * + * @brief 本端的上行/下行的丢包率,范围 [0.0,1.0]
+ * 当 `uid` 为本地用户时,代表发布流的上行丢包率。
+ * 当 `uid` 为远端用户时,代表接收所有订阅流的下行丢包率。 + */ + + double fraction_lost; + /** + * + * @brief 当 `uid` 为本地用户时有效,客户端到服务端的往返延时(RTT),单位:ms + */ + + int rtt; + /** + * + * @brief 本端的音视频 RTP 包 2 秒内的平均传输速率,单位:bps
+ * 当 `uid` 为本地用户时,代表发送速率。
+ * 当 `uid` 为远端用户时,代表所有订阅流的接收速率。 + */ + + int total_bandwidth; + /** + * + * @brief 上行网络质量评分,详见 NetworkQuality{@link #NetworkQuality}。 + */ + + NetworkQuality tx_quality; + /** + * + * @brief 下行网络质量评分,详见 NetworkQuality{@link #NetworkQuality}。 + */ + + NetworkQuality rx_quality; + /** + * + * @hidden constructor/destructor + */ + + NetworkQualityStats() : uid(""), fraction_lost(0.), rtt(0), total_bandwidth(0), + tx_quality(kNetworkQualityUnknown), rx_quality(kNetworkQualityUnknown) { + } +}; + +/** + * + * @type keytype + * @brief 房间模式
+ * 根据所需场景,选择合适的房间模式,应用不同的音视频算法、视频参数和网络配置
+ * 调用 `setAudioProfile` 改变音频参数配置 + */ + +enum RoomProfileType : int { + /** + * + * @brief 默认场景,通用模式
+ * 与 `kRoomProfileTypeMeeting = 16` 配置相同。
+ * 你可以联系技术支持更换默认配置参数。 + */ + + kRoomProfileTypeCommunication = 0, + /** + * + * @brief 游戏语音模式,低功耗、低流量消耗。
+ * 低端机在此模式下运行时,进行了额外的性能优化:
+ * - 部分低端机型配置编码帧长 40/60 + * - 部分低端机型关闭软件 3A 音频处理 + * 增强对 iOS 其他屏幕录制进行的兼容性,避免音频录制被 RTC 打断。 + */ + + kRoomProfileTypeGame = 2, + /** + * + * @brief 云游戏模式。
+ * 如果你的游戏场景需要低延迟的配置,使用此设置。
+ * 此设置下,弱网抗性较差。 + */ + + kRoomProfileTypeCloudGame = 3, + /** + * + * @brief 云渲染模式。超低延时配置。
+ * 如果你的应用并非游戏但又对延时要求较高时,选用此模式
+ * 该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。 + */ + + kRoomProfileTypeLowLatency = 4, + /** + * + * @brief 适用于 3 人及以上纯语音通话。
+ * 通话中,闭麦时是媒体模式,上麦后切换为通话模式。 + */ + + kRoomProfileTypeChatRoom = 6, + /** + * + * @brief 适用于单主播和观众进行音视频互动的直播。通话模式,上下麦不会有模式切换,避免音量突变现象 + */ + + kRoomProfileTypeInteractivePodcast = 10, + /** + * + * @brief 适合在线实时合唱场景,高音质,超低延迟。使用本配置前请联系技术支持进行协助完成其他配置。 + */ + + kRoomProfileTypeChorus = 12, + /** + * + * @brief 适用于 1 vs 1 游戏串流,支持公网或局域网。 + */ + + kRoomProfileTypeGameStreaming = 14, + /** + * + * @brief 适用于云端会议中的个人设备 + */ + + kRoomProfileTypeMeeting = 16, + /** + * + * @brief 适用于云端会议中的会议室终端设备,例如 Rooms,投屏盒子等。 + */ + + kRoomProfileTypeMeetingRoom = 17, + /** + * + * @brief 适用于课堂互动,房间内所有成员都可以进行音视频互动
+ * 当你的场景中需要同时互动的成员超过 10 人时使用此模式 + */ + + kRoomProfileTypeClassroom = 18, + /** + * + * @brief 注重流畅性,缺省码率相对低。适用于通话。 + */ + + kRoomProfileTypeCall = 19, + /** + * + * @brief 直播模式。更注重画质,视频缺省码率相对高。适用于直播互动。 + */ + + kRoomProfileTypeLive = 20, +}; +/** + * + * @type keytype + * @brief 直播模式。 + */ + +enum RoomLiveMode : int { + /** + * + * @brief 多人直播、连麦直播等模式。 + */ + + kRoomLiveModeCoHost = 1, + /** + * + * @brief 单人直播。 + */ + + kRoomLiveModeSoloHost = 2, +}; + +/** + * + * @type keytype + * @brief 多房间参数配置 + */ + +struct AudioRoomConfig { + /** + * + * @brief 房间模式,参看 RoomProfileType{@link #RoomProfileType},默认为 `kRoomProfileTypeCommunication`,进房后不可更改。 + */ + + RoomProfileType room_profile_type = kRoomProfileTypeCommunication; + /** + * + * @brief 是否自动订阅音频流,默认为自动订阅。 + */ + + bool is_auto_subscribe_audio = true; + /** + * + * @brief 是否自动发布音频流,默认为自动发布。
+ * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + + bool is_auto_publish_audio = true; +}; + +/** + * + * @type keytype + * @brief 媒体设备类型 + */ + +enum MediaDeviceType { + /** + * + * @brief 未知设备 + */ + + kMediaDeviceTypeAudioUnknown = -1, + /** + * + * @brief 音频渲染设备 + */ + + kMediaDeviceTypeAudioRenderDevice = 0, + /** + * + * @brief 音频采集设备 + */ + + kMediaDeviceTypeAudioCaptureDevice = 1, + /** + * + * @hidden currently not available + * @brief 视频渲染设备类型,该类型暂无使用 + */ + + kMediaDeviceTypeVideoRenderDevice = 2, + /** + * + * @brief 视频采集设备 + */ + + kMediaDeviceTypeVideoCaptureDevice = 3, + /** + * + * @brief 屏幕流视频设备 + */ + + kMediaDeviceTypeScreenVideoCaptureDevice = 4, + /** + * + * @brief 屏幕流音频设备 + */ + + kMediaDeviceTypeScreenAudioCaptureDevice = 5, +}; + +/** + * + * @type keytype + * @brief 媒体设备状态。 + */ + +enum MediaDeviceState { + /** + * + * @brief 设备已开启 + */ + + kMediaDeviceStateStarted = 1, + /** + * + * @brief 设备已停止 + */ + + kMediaDeviceStateStopped = 2, + /** + * + * @brief 设备运行时错误
+ * 例如,当媒体设备的预期行为是正常采集,但没有收到采集数据时,将回调该状态。 + */ + + kMediaDeviceStateRuntimeError = 3, + /** + * + * @brief 设备已暂停。包括:
+ * - 采集过程中,目标应用窗体最小化到任务栏。 + * - 开启采集或采集过程中,目标应用窗体被隐藏。 + * - 采集过程中,目标应用窗体正在被拉伸。 + * - 采集过程中,目标应用窗体正在被拖动。 + */ + + kMediaDeviceStatePaused = 4, + /** + * + * @brief 设备已恢复 + */ + + kMediaDeviceStateResumed = 5, + /** + * + * @brief 设备已插入
+ * 你可以调用获取设备接口更新设备列表。 + */ + + kMediaDeviceStateAdded = 10, + /** + * + * @brief 设备被移除
+ * 你可以调用获取设备接口更新设备列表。 + */ + + kMediaDeviceStateRemoved = 11, + /** + * + * @brief 用户合盖打断了视频通话。如果系统未休眠或关机,将在开盖后自动恢复视频通话。 + */ + + kMediaDeviceStateInterruptionBegan = 12, + /** + * + * @brief 视频通话已从合盖打断中恢复 + */ + + kMediaDeviceStateInterruptionEnded = 13, + /** + * + * @brief 设备成为系统默认 + */ + + kMediaDeviceStateBecomeSystemDefault = 14, + /** + * + * @brief 设备不再是系统默认 + */ + + kMediaDeviceStateResignSystemDefault = 15, + + /** + * + * @brief 获取设备列表超时后,收到设备列表通知。
+ * 再次调用获取设备接口更新设备列表。 + */ + + kMediaDeviceStateListUpdated = 16, +}; + +/** + * + * @type keytype + * @brief 媒体设备错误类型 + */ + +enum MediaDeviceError { + /** + * + * @brief 媒体设备正常 + */ + + kMediaDeviceErrorOK = 0, + /** + * + * @brief 没有权限启动媒体设备 + */ + + kMediaDeviceErrorDeviceNoPermission = 1, + /** + * + * @brief 媒体设备已经在使用中 + */ + + kMediaDeviceErrorDeviceBusy = 2, + /** + * + * @brief 媒体设备错误 + */ + + kMediaDeviceErrorDeviceFailure = 3, + /** + * + * @brief 未找到指定的媒体设备 + */ + + kMediaDeviceErrorDeviceNotFound = 4, + /** + * + * @brief 媒体设备被移除。
+ * 对象为采集屏幕流时,表明窗体被关闭或显示器被移除。 + */ + + kMediaDeviceErrorDeviceDisconnected = 5, + /** + * + * @brief 设备没有数据回调 + */ + + kMediaDeviceErrorDeviceNoCallback = 6, + /** + * + * @brief 设备采样率不支持 + */ + + kMediaDeviceErrorDeviceUNSupportFormat = 7, + /** + * + * @hidden(Android,macOS,Windows,Linux) + * @brief ios 屏幕采集没有 group id 参数 + */ + + kMediaDeviceErrorDeviceNotFindGroupId = 8, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:使用 camera 过程中被送到后台 + */ + + kMediaDeviceErrorDeviceNotAvailableInBackground = 9, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:被其他客户端打断,比如一个正在使用 capture session 的 app + */ + + kMediaDeviceErrorDeviceVideoInUseByAnotherClient = 10, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:使用 Slide Over,、Split View 或者 PIP 时被中断,比如台前调度,画中画 + */ + + kMediaDeviceErrorDeviceNotAvailableWithMultipleForegroundApps = 11, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:系统压力,比如过热 + */ + + kMediaDeviceErrorDeviceNotAvailableDueToSystemPressure = 12, + /** + * + * @hidden(Android, iOS, Linux) + * @brief 系统服务错误或长时间不响应,建议重启音频服务进程或重启设备。 + */ + + kMediaDeviceErrorAudioServerNeedRestart = 13, +}; + +/** + * + * @type keytype + * @brief 媒体设备警告 + */ + +enum MediaDeviceWarning { + /** + * + * @brief 无警告 + */ + + kMediaDeviceWarningOK = 0, + /** + * + * @brief 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。 + */ + + kMediaDeviceWarningOperationDenied = 1, + /** + * + * @brief 采集静音。 + */ + + kMediaDeviceWarningCaptureSilence = 2, + /** + * + * @hidden(iOS,macOS,Windows,Linux) + * @brief Android 特有的静音,系统层面的静音上报 + */ + + kMediaDeviceWarningAndroidSysSilence = 3, + /** + * + * @hidden(iOS,macOS,Windows,Linux) + * @brief Android 特有的静音消失 + */ + + kMediaDeviceWarningAndroidSysSilenceDisappear = 4, + + /** + * + * @hidden for internal use only + * @brief 音量过大,超过设备采集范围。建议降低麦克风音量或者降低声源音量。 + */ + + kMediaDeviceWarningDetectClipping = 10, + /** + * + * @brief 通话中出现回声现象。
+ * 当 RoomProfileType{@link #RoomProfileType} 为 `kRoomProfileTypeMeeting` 和
+ * `kRoomProfileTypeMeetingRoom`,且 AEC 关闭时,SDK 自动启动回声检测,如果检测到回声问题,将通过
+ * `onAudioDeviceWarning` 返回本枚举值。 + */ + + kMediaDeviceWarningDetectLeakEcho = 11, + /** + * + * @hidden for internal use only + * @brief 低信噪比 + */ + + kMediaDeviceWarningDetectLowSNR = 12, + /** + * + * @hidden for internal use only + * @brief 采集插零现象 + */ + + kMediaDeviceWarningDetectInsertSilence = 13, + /** + * + * @hidden for internal use only + * @brief 设备采集静音(算法层) + */ + + kMediaDeviceWarningCaptureDetectSilence = 14, + /** + * + * @hidden for internal use only + * @brief 设备采集静音消失 + */ + + kMediaDeviceWarningCaptureDetectSilenceDisappear = 15, + /** + * + * @hidden(Linux) + * @brief 啸叫。
+ * 触发该回调的情况如下:
+ * - 不支持啸叫抑制的房间模式下,检测到啸叫; + * - 支持啸叫抑制的房间模式下,检测到未被抑制的啸叫。仅 kRoomProfileTypeCommunication、kRoomProfileTypeMeeting、kRoomProfileTypeMeetingRoom 三种房间模式支持啸叫抑制。 建议提醒用户检查客户端的距离或将麦克风和扬声器调至静音。 + */ + + kMediaDeviceWarningCaptureDetectHowling = 16, + + /** + * + * @hidden for internal use only + * @brief 检测到突发脉冲噪声 + */ + + kMediaDeviceWarningSuddenImpluseDetected = 17, + + /** + * + * @hidden for internal use only + * @brief 检测到方波声音 + */ + + kMediaDeviceWarningSquareWavSoundDetected = 18, + + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, 该 scenario 下不支持设置 + */ + + kMediaDeviceWarningSetAudioRouteInvalidScenario = 20, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, routing device 不存在 (Android) + */ + + kMediaDeviceWarningSetAudioRouteNotExists = 21, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, 系统高优先级路由占用 (IOS) + */ + + kMediaDeviceWarningSetAudioRouteFailedByPriority = 22, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief 当前非通话模式 kAudioScenarioTypeCommunication,不支持设置音频路由 + */ + + kMediaDeviceWarningSetAudioRouteNotVoipMode = 23, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, 设备没有启动 + */ + + kMediaDeviceWarningSetAudioRouteDeviceNotStart = 24, + /** + * + * @hidden(macOS,Windows,Linux,Android) + * @brief setBluetoothMode 结果回调, 当前场景不会立即生效 + */ + + kMediaDeviceWarningSetBluetoothModeScenarioUnsupport = 25, + /** + * + * @hidden(macOS,Windows,Linux,Android) + * @brief setBluetoothMode 结果回调, 当前不支持设置蓝牙模式 + */ + + kMediaDeviceWarningSetBluetoothModeUnsupport = 26, + /** + * + * @hidden currently not available + * @brief 使用无声的采集设备 + */ + + kMediaDeviceWarningRecordingUseSilentDevice = 27, + /** + * + * @hidden(Linux) + * @brief 使用无声的播放设备 + */ + + kMediaDeviceWarningPlayoutUseSilentDevice = 28, + /** + * + * @hidden(macOS,Linux,Android,iOS) + * @brief 不支持排除本进程采集,当前采集全部进程音频 + */ + + kMediaDeviceWarningRecordingAllProcess = 29, + /** + * + * @hidden(macOS,Linux,Android,iOS) + * @brief 全部进程采集开启失败 + */ + + kMediaDeviceWarningRecordingAllProcessFailed = 30, +}; + +/** + * + * @type keytype + * @brief 订阅媒体流状态 + */ + +enum StreamSubscribeState { + /** + * + * @brief 订阅/取消订阅流成功 + */ + + kStreamSubscribeStateSuccess, + /** + * + * @brief 订阅/取消订阅流失败,本地用户未在房间中 + */ + + kStreamSubscribeStateFailedNotInRoom, + /** + * + * @brief 订阅/取消订阅流失败,房间内未找到指定的音视频流 + */ + + kStreamSubscribeStateFailedStreamNotFound, + /** + * + * @brief 超过订阅流数上限 + */ + + kStreamSubscribeStateFailedOverLimit, +}; + +/** + * + * @type keytype + * @brief 发布状态 + */ + +enum PublishState { + /** + * + * @brief 发布成功 + */ + + kPublishStatePublished, + /** + * + * @brief 发布失败 + */ + + kPublishStateUnpublished, +}; + +/** + * + * @type keytype + * @brief 订阅状态 + */ + +enum SubscribeState { + /** + * + * @brief 订阅成功 + */ + + kSubscribeStateSubscribed, + /** + * + * @brief 订阅失败 + */ + + kSubscribeStateUnsubscribed, +}; + +/** + * + * @type keytype + * @brief 发布状态变化原因 + */ + +enum PublishStateChangeReason { + /** + * + * @brief 用户调用发布 + */ + + kPublishStateChangeReasonPublish, + /** + * + * @brief 用户取消发布 + */ + + kPublishStateChangeReasonUnpublish, + /** + * + * @brief 发布 token 没有权限 + */ + + kPublishStateChangeReasonNoPublishPermission, + /** + * + * @brief 发布流总数超过上限 + */ + + kPublishStateChangeReasonOverStreamPublishLimit, + /** + * + * @brief 将一路流发布到多个房间时,其中一个房间取消发布失败。 + */ + + kPublishStateChangeReasonMultiRoomUnpublishFailed, + /** + * + * @brief 服务器错误导致发布失败 + */ + + kPublishStateChangeReasonPublishStreamFailed, + /** + * + * @brief 观众尝试发布操作 + */ + + kPublishStateChangeReasonPublishStreamForbidden, + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布。 + */ + + kPublishStateChangeReasonUserInPublish, + /** + * + * @brief 其他用户发布了相同 streamid 的流,导致本端发布的流被踢掉。 + */ + + kPublishStateChangeReasonStreamPublishByOther, + /** + * + * @brief 流 ID 校验失败。 + */ + + kPublishStateChangeReasonStreamIdInvalid +}; + +/** + * + * @type keytype + * @brief 订阅状态变化原因 + */ + +enum SubscribeStateChangeReason { + /** + * + * @brief 本端调用订阅 + */ + + kSubscribeStateChangeReasonSubscribe, + /** + * + * @brief 本端取消订阅 + */ + + kSubscribeStateChangeReasonUnsubscribe, + /** + * + * @brief 远端发布流 + */ + + kSubscribeStateChangeReasonRemotePublish, + /** + * + * @brief 远端取消发布流 + */ + + kSubscribeStateChangeReasonRemoteUnpublish, + /** + * + * @brief 由于服务器错误导致订阅失败。SDK 会自动重试订阅 + */ + + kSubscribeStateChangeReasonStreamFailed5xx, + /** + * + * @brief 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + kSubscribeStateChangeReasonStreamFailed404, + /** + * + * @brief 当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + kSubscribeStateChangeReasonOverStreamSubscribeLimit, + /** + * + * @brief 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + kSubscribeStateChangeReasonNoSubscribePermission +}; + +/** + * + * @hidden + * @deprecated since 3.26 and will be deleted in 3.51, use RoomConfig in joinRoom{@link #IRTCRoom#joinRoom} instead. + * @type keytype + * @brief 订阅模式选项。 + */ + +enum SubscribeMode { + /** + * + * @brief 自动订阅模式。SDK 会自动为你订阅房间中的每一路流。 + */ + + kSubscribeModeAuto = 0, + /** + * + * @brief 手动订阅模式。SDK 不会自动订阅房间内的音视频流,你应根据根据需要手动订阅其他用户发布的音视频流。 + */ + + kSubscribeModeManual = 1 +}; + +/** + * + * @type keytype + * @brief 远端用户优先级,在性能不足需要回退时,会优先回退优先级低的用户的音视频流 + */ + +enum RemoteUserPriority { + /** + * + * @brief 用户优先级为低(默认值) + */ + + kRemoteUserPriorityLow = 0, + /** + * + * @brief 用户优先级为正常 + */ + + kRemoteUserPriorityMedium = 100, + /** + * + * @brief 用户优先级为高 + */ + + kRemoteUserPriorityHigh = 200, +}; +/** + * + * @type keytype + * @brief 发布端音视频流回退选项 + */ + +enum PublishFallbackOption { + /** + * + * @brief 上行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + kPublishFallbackOptionDisabled = 0, + /** + * + * @brief 上行网络不佳或设备性能不足时,发布的视频流会从大流到小流依次降级,直到与当前网络性能匹配,具体降级规则参看[性能回退](https: + */ + + kPublishFallbackOptionSimulcast = 1, +}; +/** + * + * @type keytype + * @brief 订阅端音视频流回退选项。 + */ + +enum SubscribeFallbackOption { + /** + * + * @brief 下行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + kSubscribeFallbackOptionDisable = 0, + /** + * + * @brief 下行网络不佳或设备性能不足时,对视频流做降级处理,具体降级规则参看[音视频流回退](70137)。
+ * 该设置仅对发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setlocalsimulcastmode-2} 开启发送多路流功能的情况生效。 + */ + + kSubscribeFallbackOptionVideoStreamLow = 1, + /** + * + * @brief 下行网络不佳或设备性能不足时,先对视频流做回退处理。当网络状况不满足接收弱流时,则自动取消接收视频,仅接收音频。
+ * 该设置仅对发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setlocalsimulcastmode-2} 开启发送多路流功能的情况生效。 + */ + + kSubscribeFallbackOptionAudioOnly = 2, +}; + +/** + * + * @type keytype + * @brief 远端订阅流发生回退或恢复的原因 + */ + +enum FallbackOrRecoverReason { + /** + * + * @brief 其他原因,非带宽和性能原因引起的回退或恢复。默认值 + */ + + kFallbackOrRecoverReasonUnknown = -1, + /** + * + * @brief 由带宽不足导致的订阅端音视频流回退。 + */ + + kFallbackOrRecoverReasonSubscribeFallbackByBandwidth = 0, + /** + * + * @brief 由性能不足导致的订阅端音视频流回退。 + */ + + kFallbackOrRecoverReasonSubscribeFallbackByPerformance = 1, + /** + * + * @brief 由带宽恢复导致的订阅端音视频流恢复。 + */ + + kFallbackOrRecoverReasonSubscribeRecoverByBandwidth = 2, + /** + * + * @brief 由性能恢复导致的订阅端音视频流恢复。 + */ + + kFallbackOrRecoverReasonSubscribeRecoverByPerformance = 3, + /** + * + * @brief 由带宽不足导致的发布端音视频流回退。 + */ + + kFallbackOrRecoverReasonPublishFallbackByBandwidth = 4, + /** + * + * @brief 由性能不足导致的发布端音视频流回退。 + */ + + kFallbackOrRecoverReasonPublishFallbackByPerformance = 5, + /** + * + * @brief 由带宽恢复导致的发布端音视频流恢复。 + */ + + kFallbackOrRecoverReasonPublishRecoverByBandwidth = 6, + /** + * + * @brief 由性能恢复导致的发布端音视频流恢复。 + */ + + kFallbackOrRecoverReasonPublishRecoverByPerformance = 7, +}; + +/** + * + * @type keytype + * @brief 性能相关告警的原因 + */ + +enum PerformanceAlarmReason { + /** + * + * @brief 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。 + */ + + kPerformanceAlarmReasonBandwidthFallbacked = 0, + /** + * + * @brief 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。 + */ + + kPerformanceAlarmReasonBandwidthResumed = 1, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足;
+ * 如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。 + */ + + kPerformanceAlarmReasonPerformanceFallbacked = 2, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复;
+ * 如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。 + */ + + kPerformanceAlarmReasonPerformanceResumed = 3, +}; + +/** + * + * @type keytype + * @brief 是否开启发布性能回退 + */ + +enum PerformanceAlarmMode { + /** + * + * @brief 未开启发布性能回退 + */ + + kPerformanceAlarmModeNormal = 0, + /** + * + * @brief 已开启发布性能回退 + */ + + kPerformanceAlarmModeSimulcast = 1, +}; + +/** + * + * @type keytype + * @brief 房间状态码。 + */ + +enum RoomState { + /** + * + * @brief 加入房间成功 + */ + + kRoomStateJoinSuccess = 0, + /** + * + * @brief 加入房间失败 + */ + + kRoomStateJoinFailed = 1, + /** + * + * @brief 离开房间 + */ + + kRoomStateLeft = 2, +}; + +/** + * + * @type keytype + * @brief 房间状态变化原因。 + */ + +enum RoomStateChangeReason { + /** + * + * @brief 首次进房成功。 + */ + + kRoomStateChangeReasonJoinRoom = 0, + /** + * + * @brief 重新进房,比如断网重连。 + */ + + kRoomStateChangeReasonReconnect = 1, + /** + * + * @brief 离开房间。 + */ + + kRoomStateChangeReasonLeaveRoom = 2, + + /** + * + * @brief 进房失败。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 当你调用初次加入房间或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + kRoomStateChangeReasonJoinRoomFailed = -2001, + + /** + * + * @brief Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 调用 joinRoom{@link #IRTCRoom#joinRoom} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken{@link #IRTSRoom#updateToken} 方法更新 Token。 + */ + + kRoomStateChangeReasonInvalidToken = -1000, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken` 传入的 Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 房间被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonUserForbidden = -1026, + + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonKickedOut = -1006, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonRoomDismiss = -1011, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonDuplicateLogin = -1004, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 进房时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + kRoomStateChangeReasonWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonServerLicenseExpired = -1017, + + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseNotMatchWithCache = -1024, + /** + * + * @hidden internal use only + * @brief license 计费方法没有加载成功。可能是因为 license 相关插件未正确集成。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseFunctionNotFound = -1027, + /** + * + * @brief 服务端异常状态导致退出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + kRoomStateChangeReasonStateAbnormalServerStatus = -1084, + /** + * + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + kRoomStateChangeReasonUnknown = -1001 +}; +/** + * + * @type keytype + * @brief 房间事件码。 + */ + +enum RoomEvent { + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `onUserJoined` 和 `onUserLeave` 回调,并通过广播提示房间内所有用户。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomEventUserNotifyStop = -2013, + + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + kRoomEventForbidden = -2012, + + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + kRoomEventRetryOnServerError = -2014 +}; + +/** + * + * @type keytype + * @brief 房间事件信息 + */ + +struct RoomEventInfo { + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + int64_t forbidden_time = 0; +}; + +/** + * + * @type errorcode + * @brief 回调错误码。 + */ + +enum ErrorCode { + /** + * + * @brief Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 调用 joinRoom{@link #IRTCRoom#joinRoom} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken{@link #IRTSRoom#updateToken} 方法更新 Token。 + */ + + kErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + kErrorCodeJoinRoom = -1001, + /** + * + * @brief 没有发布音视频流权限。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。
+ * 用户在所在房间中发布音视频流失败,失败原因为用户没有发布流的权限。 + */ + + kErrorCodeNoPublishPermission = -1002, + /** + * + * @brief 没有订阅音视频流权限。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
+ * 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + kErrorCodeNoSubscribePermission = -1003, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeDuplicateLogin = -1004, + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeKickedOut = -1006, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomErrorTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken` 传入的 Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomErrorUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeRoomDismiss = -1011, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 进房时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + kErrorCodeJoinRoomWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeRoomAlreadyExist = -1013, + /** + * + * @brief 加入多个房间时使用了不同的 uid。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 同一个引擎实例中,用户需使用同一个 uid 加入不同的房间。 + */ + + kErrorCodeUserIDDifferent = -1014, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomServerLicenseExpired = -1017, + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseNotMatchWithCache = -1024, + /** + * + * @brief 房间被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomUserForbidden = -1026, + /** + * + * @hidden internal use only + * @brief license 计费方法没有加载成功。可能是因为 license 相关插件未正确集成。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseFunctionNotFound = -1027, + /** + * + * @brief 订阅音视频流失败,订阅音视频流总数超过上限。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
+ * 游戏场景下,为了保证音视频通话的性能和质量,服务器会限制用户订阅的音视频流总数。当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + kErrorCodeOverStreamSubscribeLimit = -1070, + /** + * + * @brief 发布流失败,发布流总数超过上限。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调。
+ * RTC 系统会限制单个房间内发布的总流数,总流数包括视频流、音频流和屏幕流。如果房间内发布流数已达上限时,本地用户再向房间中发布流时会失败,同时会收到此错误通知。 + */ + + kErrorCodeOverStreamPublishLimit = -1080, + /** + * + * @deprecated since 3.52, use kErrorCodeOverStreamPublishLimit(-1080)instead + * @brief 发布视频流总数超过上限。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * RTC 系统会限制单个房间内发布的视频流数。如果房间内发布视频流数已达上限时,本地用户再向房间中发布视频流时会失败,同时会收到此错误通知。 + */ + + kErrorCodeOverVideoPublishLimit = -1082, + /** + * + * @deprecated since 3.60, use kAVSyncEventInvalidUidRepeated carried by onAVSyncEvent{@link #IRTCRoomEventHandler#onAVSyncEvent} instead. + * @brief 音视频同步失败。通过 onStreamStateChanged 回调。
+ * 当前音频源已与其他视频源关联同步关系。
+ * 单个音频源不支持与多个视频源同时同步。 + */ + + kErrorCodeInvalidAudioSyncUidRepeated = -1083, + /** + * + * @brief 服务端异常状态导致退出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + kErrorCodeAbnormalServerStatus = -1084, + /** + * + * @hidden for internal use only + * @brief 在一路流推多房间的场景下,在至少有两个房间在发布同一路流时,其中一个房间取消发布失败,此时需要业务方重试或者由业务方通知用户重试取消发布。 + */ + + kErrorCodeMultiRoomUnpublishFailed = -1085, + /** + * + * @hidden for internal use only + * @brief 指定服务区域时传入错误参数。 + */ + + kErrorCodeWrongAreaCode = -1086, + /** + * + * @hidden for internal use only + */ + + kErrorCodeInternalDeadLockNotify = -1111, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
+ * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅起通知作用。 + */ + +enum WarningCode { + + + /** + * + * @brief 进房失败。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 当你调用初次加入房间或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + kWarningCodeJoinRoomFailed = -2001, + /** + * + * @brief 发布音视频流失败。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调。
+ * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + kWarningCodePublishStreamFailed = -2002, + /** + * + * @brief 订阅音视频流失败。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
+ * 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + kWarningCodeSubscribeStreamFailed404 = -2003, + /** + * + * @brief 订阅音视频流失败。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
+ * 当你订阅所在房间中的音视频流时,由于服务器错误导致订阅失败。SDK 会自动重试订阅。 + */ + + kWarningCodeSubscribeStreamFailed5xx = -2004, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误。 + */ + + kWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + kWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 当调用 `setUserVisibility` 将自身可见性设置为 false 后,再尝试发布流会触发此警告。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。
+ */ + + kWarningCodePublishStreamForbidden = -2009, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + kWarningCodeSendCustomMessage = -2011, + + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `onUserJoined` 和 `onUserLeave` 回调,并通过广播提示房间内所有用户。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kWarningCodeUserNotifyStop = -2013, + + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布 WTN 流。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。 + */ + + kWarningCodeUserInPublish = -2014, + + /** + * + * @brief 当前正在进行回路测试,该接口调用无效 + */ + + kWarningCodeInEchoTestMode = -2017, + + /** + * + * @brief 摄像头权限异常,当前应用没有获取摄像头权限。 + */ + + kWarningCodeNoCameraPermission = -5001, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceNoPermission 代替。
+ * 麦克风权限异常,当前应用没有获取麦克风权限。 + */ + + kWarningCodeNoMicrophonePermission = -5002, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceFailure 代替。
+ * 音频采集设备启动失败,当前设备可能被其他应用占用。 + */ + + kWarningCodeRecodingDeviceStartFailed = -5003, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceFailure 代替。
+ * 音频播放设备启动失败警告,可能由于系统资源不足,或参数错误。 + */ + + kWarningCodePlayoutDeviceStartFailed = -5004, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceNotFound 代替。
+ * 无可用音频采集设备,请插入可用的音频采集设备。 + */ + + kWarningCodeNoRecordingDevice = -5005, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceNotFound 代替。
+ * 无可用音频播放设备,请插入可用的音频播放设备。 + */ + + kWarningCodeNoPlayoutDevice = -5006, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceWarning{@link #MediaDeviceWarning}.kMediaDeviceWarningCaptureSilence 代替。
+ * 当前音频设备没有采集到有效的声音数据,请检查更换音频采集设备。 + */ + + kWarningCodeRecordingSilence = -5007, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceWarning{@link #MediaDeviceWarning}.kMediaDeviceWarningOperationDenied 代替。
+ * 媒体设备误操作警告。
+ * 使用自定义采集时,不可调用内部采集开关,调用时将触发此警告。 + */ + + kWarningCodeMediaDeviceOperationDenied = -5008, + + /** + * + * @brief 你需要在 publishStreamAudio 之前调用 `setScreenAudioSourceType` 设置屏幕音频采集类型。 + */ + + kWarningCodeSetScreenAudioSourceTypeFailed = -5009, + + /** + * + * @brief 不支持在 publishStreamAudio 之后, 通过 `setScreenAudioStreamIndex` 设置屏幕共享时的音频采集方式。 + */ + + kWarningCodeSetScreenAudioStreamIndexFailed = -5010, + /** + * + * @brief 设置语音音高不合法 + */ + + kWarningCodeInvalidVoicePitch = -5011, + /** + * + * @brief 设置音频格式不合法 + */ + + kWarningCodeInvalidAudioFormat = -5012, + /** + * + * @brief 外部音频源新旧接口混用 + */ + + kWarningCodeInvalidCallForExtAudio = -5013, + /** + * + * @brief 非法的远端流索引 + */ + + kWarningCodeInvalidRemoteStreamKey = -5014, + /** + * + * @brief 指定的内部渲染画布句柄无效。
+ * 当你调用 setLocalVideoCanvas{@link #IRTCEngine#setLocalVideoCanvas} 时指定了无效的画布句柄,触发此回调。 + */ + + kWarningCodeInvalidCanvasHandle = -6001, + /** + * + * @brief 鉴权文件失效,当检查鉴权文件状态时,本地文件与远端文件不一致会触发警告。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kWarningLicenseFileExpired = -7001, + + /** + * + * @brief [音频技术](https: + */ + + kWarningInvaildSamiAppkeyORToken = -7002, + + /** + * + * @brief [音频技术](https: + */ + + kWarningInvaildSamiResourcePath = -7003, + + /** + * + * @brief [音频技术](https: + */ + + kWarningLoadSamiLibraryFailed = -7004, + + /** + * + * @brief [音频技术](https: + */ + + kWarningInvaildSamiEffectType = -7005, +}; + +/** + * + * @type keytype + * @brief 本地音频流状态。 + */ + +enum LocalAudioStreamState { + /** + * + * @brief 本地音频默认初始状态。
+ * 麦克风停止工作时回调该状态,对应错误码 kLocalAudioStreamErrorOk + */ + + kLocalAudioStreamStateStopped = 0, + + /** + * + * @brief 本地音频录制设备启动成功。
+ * 采集到音频首帧时回调该状态,对应错误码 kLocalAudioStreamErrorOk + */ + + kLocalAudioStreamStateRecording, + + /** + * + * @brief 本地音频首帧编码成功。
+ * 音频首帧编码成功时回调该状态,对应错误码 kLocalAudioStreamErrorOk + */ + + kLocalAudioStreamStateEncoding, + + /** + * + * @brief 本地音频启动失败,在以下时机回调该状态:
+ * - 本地录音设备启动失败,对应错误码 kLocalAudioStreamErrorRecordFailure + * - 检测到没有录音设备权限,对应错误码 kLocalAudioStreamErrorDeviceNoPermission + * - 音频编码失败,对应错误码 kLocalAudioStreamErrorEncodeFailure + */ + + kLocalAudioStreamStateFailed, + + /** + * + * @brief 本地音频静音成功后回调该状态。
+ * 调用 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 成功后回调,对应错误码 LocalAudioStreamError{@link #LocalAudioStreamError} 中的 kLocalAudioStreamErrorOk 。 + */ + + kLocalAudioStreamStateMute, + + /** + * + * @brief 本地音频解除静音成功后回调该状态。
+ * 调用 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 成功后回调,对应错误码 LocalAudioStreamError{@link #LocalAudioStreamError} 中的 kLocalAudioStreamErrorOk 。 + */ + + kLocalAudioStreamStateUnmute +}; + +/** + * + * @type keytype + * @brief 本地音频流状态改变时的错误码。 + */ + +enum LocalAudioStreamError { + /** + * + * @brief 本地音频状态正常 + */ + + kLocalAudioStreamErrorOk = 0, + /** + * + * @brief 本地音频出错原因未知 + */ + + kLocalAudioStreamErrorFailure, + /** + * + * @brief 没有权限启动本地音频录制设备 + */ + + kLocalAudioStreamErrorDeviceNoPermission, + /** + * + * @hidden currently not available + * @brief 本地音频录制设备已经在使用中 + * @note 该错误码暂未使用 + */ + + kLocalAudioStreamErrorDeviceBusy, + /** + * + * @brief 本地音频录制失败,建议你检查录制设备是否正常工作 + */ + + kLocalAudioStreamErrorRecordFailure, + /** + * + * @brief 本地音频编码失败 + */ + + kLocalAudioStreamErrorEncodeFailure, + /** + * + * @brief 没有可用的音频录制设备 + */ + + kLocalAudioStreamErrorNoRecordingDevice +}; + +/** + * + * @type keytype + * @brief 本地视频流状态 + */ + +enum LocalVideoStreamState { + /** + * + * @brief 本地视频采集停止状态 + */ + + kLocalVideoStreamStateStopped = 0, + /** + * + * @brief 本地视频采集设备启动成功 + */ + + kLocalVideoStreamStateRecording, + /** + * + * @brief 本地视频采集后,首帧编码成功 + */ + + kLocalVideoStreamStateEncoding, + /** + * + * @brief 本地视频采集设备启动失败 + */ + + kLocalVideoStreamStateFailed, +}; + +/** + * + * @type errorcode + * @brief 本地视频状态改变时的错误码 + */ + +enum LocalVideoStreamError { + /** + * + * @brief 状态正常 + */ + + kLocalVideoStreamErrorOk = 0, + /** + * + * @brief 本地视频流发布失败 + */ + + kLocalVideoStreamErrorFailure, + /** + * + * @brief 没有权限启动本地视频采集设备 + */ + + kLocalVideoStreamErrorDeviceNoPermission, + /** + * + * @brief 本地视频采集设备已被占用 + */ + + kLocalVideoStreamErrorDeviceBusy, + /** + * + * @brief 本地视频采集设备不存在 + */ + + kLocalVideoStreamErrorDeviceNotFound, + /** + * + * @brief 本地视频采集失败,建议检查采集设备是否正常工作 + */ + + kLocalVideoStreamErrorCaptureFailure, + /** + * + * @brief 本地视频编码失败 + */ + + kLocalVideoStreamErrorEncodeFailure, + /** + * + * @brief 通话过程中本地视频采集设备被其他程序抢占,导致设备连接中断 + */ + + kLocalVideoStreamErrorDeviceDisconnected +}; + +/** + * + * @type keytype + * @brief 远端音频流状态。 + */ + +enum RemoteAudioState { + /** + * + * @brief 不接收远端音频流。 + */ + + kRemoteAudioStateStopped = 0, + /** + * + * @brief 开始接收远端音频流首包。 + */ + + kRemoteAudioStateStarting, + /** + * + * @brief 远端音频流正在解码,正常播放。 + */ + + kRemoteAudioStateDecoding, + /** + * + * @brief 远端音频流卡顿。 + */ + + kRemoteAudioStateFrozen, + /** + * + * @hidden currently not available + * @brief 远端音频流播放失败 + * @note 该错误码暂未使用 + */ + + kRemoteAudioStateFailed, +}; + +/** + * + * @type keytype + * @brief 接收远端音频流状态改变的原因。 + */ + +enum RemoteAudioStateChangeReason { + /** + * + * @brief 内部原因 + */ + + kRemoteAudioStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + kRemoteAudioStateChangeReasonNetworkCongestion, + /** + * + * @brief 网络恢复正常 + */ + + kRemoteAudioStateChangeReasonNetworkRecovery, + /** + * + * @brief 本地用户停止接收远端音频流 + */ + + kRemoteAudioStateChangeReasonLocalMuted, + /** + * + * @brief 本地用户恢复接收远端音频流 + */ + + kRemoteAudioStateChangeReasonLocalUnmuted, + /** + * + * @brief 远端用户停止发送音频流 + */ + + kRemoteAudioStateChangeReasonRemoteMuted, + /** + * + * @brief 远端用户恢复发送音频流 + */ + + kRemoteAudioStateChangeReasonRemoteUnmuted, + /** + * + * @brief 远端用户离开房间 + */ + + kRemoteAudioStateChangeReasonRemoteOffline, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态。状态改变时,会收到 `onRemoteVideoStateChanged` 回调 + */ + +enum RemoteVideoState { + /** + * + * @brief 远端视频流默认初始状态,视频尚未开始播放。 + */ + + kRemoteVideoStateStopped = 0, + /** + * + * @brief 本地用户已接收远端视频流首包。 + */ + + kRemoteVideoStateStarting, + /** + * + * @brief 远端视频流正在解码,正常播放。 + */ + + kRemoteVideoStateDecoding, + /** + * + * @brief 远端视频流卡顿,可能有网络等原因。 + */ + + kRemoteVideoStateFrozen, + /** + * + * @brief 远端视频流播放失败。 + */ + + kRemoteVideoStateFailed, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态改变的原因 + */ + +enum RemoteVideoStateChangeReason { + /** + * + * @brief 内部原因 + */ + + kRemoteVideoStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + kRemoteVideoStateChangeReasonNetworkCongestion, + /** + * + * @brief 网络恢复正常 + */ + + kRemoteVideoStateChangeReasonNetworkRecovery, + /** + * + * @brief 本地用户停止接收远端视频流或本地用户禁用视频模块 + */ + + kRemoteVideoStateChangeReasonLocalMuted, + /** + * + * @brief 本地用户恢复接收远端视频流或本地用户启用视频模块 + */ + + kRemoteVideoStateChangeReasonLocalUnmuted, + /** + * + * @brief 远端用户停止发送视频流或远端用户禁用视频模块 + */ + + kRemoteVideoStateChangeReasonRemoteMuted, + /** + * + * @brief 远端用户恢复发送视频流或远端用户启用视频模块 + */ + + kRemoteVideoStateChangeReasonRemoteUnmuted, + /** + * + * @brief 远端用户离开房间。 + */ + + kRemoteVideoStateChangeReasonRemoteOffline, +}; + +/** + * + * @type keytype + * @brief 黑帧视频流状态 + */ + +enum SEIStreamEventType { + /** + * + * @brief 远端用户发布黑帧视频流。
+ * 纯语音通话场景下,远端用户调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 发送 SEI 数据时,SDK 会自动发布一路黑帧视频流,并触发该回调。 + */ + + kSEIStreamEventTypeStreamAdd = 0, + /** + * + * @brief 远端黑帧视频流移除。该回调的触发时机包括:
+ * - 远端用户开启摄像头采集,由语音通话切换至视频通话,黑帧视频流停止发布; + * - 远端用户调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 后 1min 内未有 SEI 数据发送,黑帧视频流停止发布; + * - 远端用户调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 切换至自定义视频采集时,黑帧视频流停止发布。 + */ + + kSEIStreamEventTypeStreamRemove, +}; + +/** + * + * @type keytype + * @brief 性能回退相关数据 + */ + +struct SourceWantedData { + /** + * + * @brief 如果未开启发送性能回退,此值表示推荐的视频输入宽度;
+ * 如果开启了发送性能回退,此值表示当前推流的最大宽度。 + */ + + int width; + /** + * + * @brief 如果未开启发送性能回退,此值表示推荐的视频输入高度;
+ * 如果开启了发送性能回退,此值表示当前推流的最大高度。 + */ + + int height; + /** + * + * @brief 如果未开启发送性能回退,此值表示推荐的视频输入帧率,单位 fps;
+ * 如果开启了发送性能回退,此值表示当前推流的最大帧率,单位 fps。 + */ + + int frame_rate; +}; +/** + * + * @type keytype + * @brief 用户信息 + */ + +struct UserInfo { + /** + * + * @brief 用户 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + */ + + const char* uid = nullptr; + /** + * + * @brief 用户的额外信息,最大长度为 200 字节。会在 `onUserJoined` 中回调给远端用户。 + */ + + const char* extra_info = nullptr; +}; + +/** + * + * @type keytype + * @brief 通话相关的统计信息 + */ + +struct RtcRoomStats { + /** + * + * @brief 当前应用的上行丢包率,取值范围为 [0, 1] + */ + + float tx_lostrate; + /** + * + * @brief 当前应用的下行丢包率,取值范围为 [0, 1] + */ + + float rx_lostrate; + /** + * + * @brief 客户端到服务端数据传输的往返时延(单位 ms) + */ + + int rtt; + /** + * + * @brief 本地用户在本次通话中的参与时长,单位为 s + */ + + unsigned int duration; + /** + * + * @brief 本地用户的总发送字节数 (bytes),累计值 + */ + + unsigned int tx_bytes; + /** + * + * @brief 本地用户的总接收字节数 (bytes),累计值 + */ + + unsigned int rx_bytes; + /** + * + * @brief 发送码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short tx_kbitrate; + /** + * + * @brief 接收码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short rx_kbitrate; + /** + * + * @brief 音频接收码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short rx_audio_kbitrate; + /** + * + * @brief 音频包的发送码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short tx_audio_kbitrate; + /** + * + * @brief 视频接收码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short rx_video_kbitrate; + /** + * + * @brief 视频发送码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short tx_video_kbitrate; + /** + * + * @brief 屏幕接收码率,获取该数据时的瞬时值,单位为 Kbps + */ + + unsigned short rx_screen_kbitrate; + /** + * + * @brief 屏幕发送码率,获取该数据时的瞬时值,单位为 Kbps + */ + + unsigned short tx_screen_kbitrate; + /** + * + * @brief 当前房间内的可见用户人数 + */ + + unsigned int user_count; + /** + * + * @brief 当前应用的 CPU 使用率 (%) + */ + + double cpu_app_usage; + /** + * + * @hidden currently not available + * @brief 当前系统的 CPU 使用率 (%) + */ + + double cpu_total_usage; + /** + * + * @hidden currently not available + * @brief 系统上行网络抖动(ms) + */ + + int tx_jitter; + /** + * + * @hidden currently not available + * @brief 系统下行网络抖动(ms) + */ + + int rx_jitter; + /** + * + * @brief 蜂窝路径发送的码率 (kbps),为获取该数据时的瞬时值 + */ + + unsigned short tx_cellular_kbitrate; + /** + * + * @brief 蜂窝路径接收码率 (kbps),为获取该数据时的瞬时值 + */ + + unsigned short rx_cellular_kbitrate; +}; + +/** + * + * @type keytype + * @brief 视频的编码类型 + */ + +enum VideoCodecType { + /** + * + * @brief 未知类型 + */ + + kVideoCodecTypeUnknown = 0, + /** + * + * @brief 标准 H264 编码格式 + */ + + kVideoCodecTypeH264 = 1, + /** + * + * @brief ByteVC1 编码格式 + */ + + kVideoCodecTypeByteVC1 = 2, +}; + + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分模式。 + */ + +enum VideoSuperResolutionMode { + /** + * + * @brief 关闭超分。 + */ + + kVideoSuperResolutionModeOff = 0, + /** + * + * @brief 开启超分。 + */ + + kVideoSuperResolutionModeOn = 1, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 视频降噪模式。 + */ + +enum VideoDenoiseMode { + /** + * + * @brief 视频降噪关闭。 + */ + + kVideoDenoiseModeOff = 0, + /** + * + * @brief 视频降噪开启,由 ByteRTC 后台配置视频降噪算法。 + */ + + kVideoDenoiseModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 本地音频流统计信息,统计周期为 2s 。
+ * 本地用户发布音频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
+ * 通知用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +struct LocalAudioStats { + /** + * + * @brief 音频丢包率。此次统计周期内的音频上行丢包率,取值范围为 [0, 1]。 + */ + + float audio_loss_rate; + /** + * + * @brief 发送码率。此次统计周期内的音频发送码率,单位为 kbps 。 + */ + + int send_kbitrate; + /** + * + * @brief 采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。 + */ + + int record_sample_rate; + /** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。
+ * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + + int stats_interval; + /** + * + * @brief 往返时延。单位为 ms 。 + */ + + int rtt; + /** + * + * @brief 音频声道数。 + */ + + int num_channels; + /** + * + * @brief 音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。 + */ + + int sent_sample_rate; + /** + * + * @brief 音频上行网络抖动,单位为 ms 。 + */ + + int jitter; + /** + * + * @brief 音频设备采集播放时延,单位为 ms 。 + */ + + int audio_device_loop_delay; + /** + * + * @brief 音频编码帧率。 + */ + + double encode_frame_rate; +}; + +/** + * + * @type keytype + * @brief 远端音频流统计信息,统计周期为 2s。
+ * 本地用户订阅远端音频流成功后,SDK 会周期性地通过 `onRemoteStreamStats` 通知本地用户订阅的音频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +struct RemoteAudioStats { + /** + * + * @brief 音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。 + */ + + float audio_loss_rate; + /** + * + * @brief 接收码率。统计周期内的音频接收码率,单位为 kbps 。 + */ + + int received_kbitrate; + /** + * + * @brief 音频卡顿次数。统计周期内的卡顿次数。 + */ + + int stall_count; + /** + * + * @brief 音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。 + */ + + int stall_duration; + /** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + + long e2e_delay; + /** + * + * @brief 播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。 + */ + + int playout_sample_rate; + /** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。 + */ + + int stats_interval; + /** + * + * @brief 客户端到服务端数据传输的往返时延,单位为 ms。 + */ + + int rtt; + /** + * + * @brief 发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。 + */ + + int total_rtt; + /** + * + * @brief 远端用户发送的音频流质量。远端用户发送的音频流质量。值含义参考 NetworkQuality{@link #NetworkQuality}。 + */ + + int quality; + /** + * + * @brief 因引入 jitter buffer 机制导致的延时。单位为 ms 。 + */ + + int jitter_buffer_delay; + /** + * + * @brief 音频声道数。 + */ + + int num_channels; + /** + * + * @brief 音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。 + */ + + int received_sample_rate; + /** + * + * @brief 远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。 + */ + + int frozen_rate; + /** + * + * @brief 音频丢包补偿(PLC) 样点总个数。 + */ + + int concealed_samples; + /** + * + * @brief 音频丢包补偿(PLC) 累计次数。 + */ + + int concealment_event; + /** + * + * @brief 音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。 + */ + + int dec_sample_rate; + /** + * + * @brief 此次订阅中,对远端音频流进行解码的累计耗时。单位为 s。 + */ + + int dec_duration; + /** + * + * @brief 音频下行网络抖动,单位为 ms 。 + */ + + int jitter; + /** + * + * @brief 音频解码帧率。 + */ + + double decode_frame_rate; +}; + +/** + * + * @type keytype + * @brief 本地视频流统计信息,统计周期为 2s 。
+ * 本地用户发布视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
+ * 通知用户发布的视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +struct LocalVideoStats { + /** + * + * @brief 发送码率。此次统计周期内实际发送的分辨率最大的视频流的发送码率,单位为 Kbps + */ + + int sent_kbitrate; + /** + * + * @brief 采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。 + */ + + int input_frame_rate; + /** + * + * @brief 发送帧率。此次统计周期内实际发送的分辨率最大的视频流的视频发送帧率,单位为 fps 。 + */ + + int sent_frame_rate; + /** + * + * @brief 编码器输出帧率。当前编码器在此次统计周期内实际发送的分辨率最大的视频流的输出帧率,单位为 fps 。 + */ + + int encoder_output_frame_rate; + /** + * + * @brief 本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。 + */ + + int renderer_output_frame_rate; + /** + * + * @brief 统计间隔,单位为 ms 。
+ * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + + int stats_interval; + /** + * + * @brief 视频丢包率。此次统计周期内的视频上行丢包率,取值范围为 [0, 1] 。 + */ + + float video_loss_rate; + /** + * + * @brief 往返时延,单位为 ms 。 + */ + + int rtt; + /** + * + * @brief 视频编码码率。此次统计周期内的实际发送的分辨率最大的视频流视频编码码率,单位为 Kbps 。 + */ + + int encoded_bitrate; + /** + * + * @brief 实际发送的分辨率最大的视频流的视频编码宽度,单位为 px 。 + */ + + int encoded_frame_width; + /** + * + * @brief 实际发送的分辨率最大的视频流的视频编码高度,单位为 px 。 + */ + + int encoded_frame_height; + /** + * + * @brief 此次统计周期内实际发送的分辨率最大的视频流的发送的视频帧总数。 + */ + + int encoded_frame_count; + /** + * + * @brief 视频的编码类型,具体参考 VideoCodecType{@link #VideoCodecType} 。 + */ + + VideoCodecType codec_type; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 视频上行网络抖动,单位为 ms 。 + */ + + int jitter; + /** + * + * @hidden(Windows, Linux, macOS) for internal use + * @brief 视频降噪模式。具体参看 VideoDenoiseMode{@link #VideoDenoiseMode} 。 + */ + + VideoDenoiseMode video_denoise_mode; + /** + * + * @brief 视频编码平均耗时,单位 ms。 + */ + + int codec_elapse_per_frame; + +}; + +/** + * + * @type keytype + * @brief 远端视频流统计信息,统计周期为 2s 。
+ * 本地用户订阅远端视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
+ * 通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +struct RemoteVideoStats { + /** + * + * @brief 视频宽度 + */ + + int width; + /** + * + * @brief 视频高度 + */ + + int height; + /** + * + * @brief 视频丢包率。统计周期内的视频下行丢包率,取值范围: [0, 1] 。 + */ + + float video_loss_rate; + /** + * + * @brief 接收码率。统计周期内的视频接收码率,单位为 kbps 。 + */ + + int received_kbitrate; + /** + * + * @brief 解码器输出帧率。统计周期内的视频解码器输出帧率,单位 fps 。 + */ + + int decoder_output_frame_rate; + /** + * + * @brief 渲染帧率。统计周期内的视频渲染帧率,单位 fps 。 + */ + + int renderer_output_frame_rate; + /** + * + * @brief 卡顿次数。统计周期内的卡顿次数。 + */ + + int stall_count; + /** + * + * @brief 卡顿时长。统计周期内的视频卡顿总时长。单位 ms 。 + */ + + int stall_duration; + /** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + + long e2e_delay; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 统计间隔,此次统计周期的间隔,单位为 ms 。
+ * 此字段用于设置回调的统计周期,目前设置为 2s 。 + */ + + int stats_interval; + /** + * + * @brief 往返时延,单位为 ms 。 + */ + + int rtt; + /** + * + * @brief 远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。 + */ + + int frozen_rate; + /** + * + * @brief 视频的编码类型,具体参考 VideoCodecType{@link #VideoCodecType} 。 + */ + + VideoCodecType codec_type; + /** + * + * @brief 对应多种分辨率的流的下标。 + */ + + int video_index; + /** + * + * @brief 视频下行网络抖动,单位为 ms。 + */ + + int jitter; + /** + * + * @hidden(Windows, Linux, macOS) for internal use + * @brief 远端视频超分模式,参看 VideoSuperResolutionMode{@link #VideoSuperResolutionMode}。 + */ + + VideoSuperResolutionMode super_resolution_mode; + /** + * + * @brief 视频解码平均耗时,单位 ms。 + */ + + int codec_elapse_per_frame; + /** + * + * @brief 用户体验级别的端到端延时。从发送端开始采集到接收端渲染完成的延时,单位为 ms 。 + */ + + int cap_to_render_delay; + /** + * + * @brief 音画同步差异,单位为 ms 。 + */ + + int av_sync_diff_ms; +}; + +/** + * + * @type keytype + * @brief 本地音/视频流统计信息以及网络状况,统计周期为 2s 。
+ * 本地用户发布音/视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
+ * 通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +struct LocalStreamStats { + /** + * + * @brief 本地设备发送音频流的统计信息,详见 LocalAudioStats{@link #LocalAudioStats} + */ + + LocalAudioStats audio_stats; + /** + * + * @brief 本地设备发送视频流的统计信息,详见 LocalVideoStats{@link #LocalVideoStats} + */ + + LocalVideoStats video_stats; + /** + * + * @brief 所属用户的媒体流上行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality local_tx_quality; + /** + * + * @brief 所属用户的媒体流下行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality local_rx_quality; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; +}; + +/** + * + * @type keytype + * @brief 用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
+ * 订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
+ * 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +struct RemoteStreamStats { + /** + * + * @brief 用户 ID 。音/视频来源的远端用户 ID 。 + */ + + const char* uid; + /** + * + * @brief 远端音频流的统计信息,详见 RemoteAudioStats{@link #RemoteAudioStats} + */ + + RemoteAudioStats audio_stats; + /** + * + * @brief 远端视频流的统计信息,详见 RemoteVideoStats{@link #RemoteVideoStats} + */ + + RemoteVideoStats video_stats; + /** + * + * @brief 所属用户的媒体流上行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality remote_tx_quality; + /** + * + * @brief 所属用户的媒体流下行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality remote_rx_quality; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈问题类型 + */ + +enum ProblemFeedbackOption : uint64_t { + /** + * + * @brief 没有问题 + */ + + kProblemFeedbackOptionNone = 0, + /** + * + * @brief 其他问题 + */ + + kProblemFeedbackOptionOtherMessage = (1ULL << 0), + /** + * + * @brief 连接失败 + */ + + kProblemFeedbackOptionDisconnected = (1ULL << 1), + /** + * + * @brief 耳返延迟大 + */ + + kProblemFeedbackOptionEarBackDelay = (1ULL << 2), + + /** + * + * @brief 本端有杂音 + */ + + kProblemFeedbackOptionLocalNoise = (1ULL << 10), + /** + * + * @brief 本端声音卡顿 + */ + + kProblemFeedbackOptionLocalAudioLagging = (1ULL << 11), + /** + * + * @brief 本端无声音 + */ + + kProblemFeedbackOptionLocalNoAudio = (1ULL << 12), + /** + * + * @brief 本端声音大/小 + */ + + kProblemFeedbackOptionLocalAudioStrength = (1ULL << 13), + /** + * + * @brief 本端有回声 + */ + + kProblemFeedbackOptionLocalEcho = (1ULL << 14), + /** + * + * @brief 本端视频模糊 + */ + + kProblemFeedbackOptionLocalVideoFuzzy = (1ULL << 24), + /** + * + * @brief 本端音视频不同步 + */ + + kProblemFeedbackOptionLocalNotSync = (1ULL << 25), + /** + * + * @brief 本端视频卡顿 + */ + + kProblemFeedbackOptionLocalVideoLagging = (1ULL << 26), + /** + * + * @brief 本端无画面 + */ + + kProblemFeedbackOptionLocalNoVideo = (1ULL << 27), + + /** + * + * @brief 远端有杂音 + */ + + kProblemFeedbackOptionRemoteNoise = (1ULL << 37), + /** + * + * @brief 远端声音卡顿 + */ + + kProblemFeedbackOptionRemoteAudioLagging = (1ULL << 38), + /** + * + * @brief 远端无声音 + */ + + kProblemFeedbackOptionRemoteNoAudio = (1ULL << 39), + /** + * + * @brief 远端声音大/小 + */ + + kProblemFeedbackOptionRemoteAudioStrength = (1ULL << 40), + /** + * + * @brief 远端有回声 + */ + + kProblemFeedbackOptionRemoteEcho = (1ULL << 41), + + /** + * + * @brief 远端视频模糊 + */ + + kProblemFeedbackOptionRemoteVideoFuzzy = (1ULL << 51), + /** + * + * @brief 远端音视频不同步 + */ + + kProblemFeedbackOptionRemoteNotSync = (1ULL << 52), + /** + * + * @brief 远端视频卡顿 + */ + + kProblemFeedbackOptionRemoteVideoLagging = (1ULL << 53), + /** + * + * @brief 远端无画面 + */ + + kProblemFeedbackOptionRemoteNoVideo = (1ULL << 54), +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈的房间信息 + */ + +struct ProblemFeedbackRoomInfo { + /** + * + * @brief 房间 ID。 + */ + + const char* room_id = nullptr; + + /** + * + * @brief 本地用户 ID。 + */ + + const char* user_id = nullptr; +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈的信息 + */ + +struct ProblemFeedbackInfo { + /** + * + * @brief 预设问题以外的其他问题的具体描述。 + */ + + const char* problem_desc = nullptr; + + /** + * + * @type keytype + * @brief 音视频质量反馈的房间信息。查看 ProblemFeedbackRoomInfo{@link #ProblemFeedbackRoomInfo}。 + */ + + ProblemFeedbackRoomInfo* room_info = nullptr; + /** + * + * @type keytype + * @brief `FeedbackRoomInfo` 的数组长度。 + */ + + int room_info_count = 0; +}; + +/** + * + * @type keytype + * @brief 自定义加密类型 + */ + +enum EncryptType { + /** + * + * @brief 不使用加密。默认值。 + */ + + kEncryptTypeNone = 0, + /** + * + * @brief AES-128-CBC 加密算法 + */ + + kEncryptTypeAES128CBC = 1, + /** + * + * @brief AES-256-CBC 加密算法 + */ + + kEncryptTypeAES256CBC = 2, + /** + * + * @brief AES-128-ECB 加密算法 + */ + + kEncryptTypeAES128ECB = 3, + /** + * + * @brief AES-256-ECB 加密算法 + */ + + kEncryptTypeAES256ECB = 4 +}; +/** + * + * @type callback + * @brief 加密/解密处理函数
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 通话加密 + */ + +class IEncryptHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IEncryptHandler() { + } + /** + * + * @type api + * @brief 自定义加密。
+ * 使用设定的自定义加密方式,对编码后传输前的音视频帧数据进行加密。
+ * 暂不支持对原始音视频帧进行加密。 + * @param data 原始音视频帧数据 + * @param length 原始音视频帧数据的长度 + * @param buf 可供写入的加密后数据缓冲区 + * @param buf_len 可供写入的加密后数据缓冲区大小 + * @return 加密后的数据
+ * - ≥ 0:加密后实际写入缓冲区的数据大小 + * - 0:丢弃该帧 + * @note + * - 使用此接口进行自定义加密前,你必须先设置自定义加密方式,参看 `setCustomizeEncryptHandler`。 + * - 使用 onDecryptData{@link #IEncryptHandler#onDecryptData} 对已加密的音视频帧数据进行解密。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + + virtual unsigned int onEncryptData( + const unsigned char* data, unsigned int length, unsigned char* buf, unsigned int buf_len) = 0; + /** + * + * @type api + * @brief 自定义解密。
+ * 对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 onEncryptData{@link #IEncryptHandler#onEncryptData}。 + * @param data 原始音视频帧数据 + * @param length 原始音视频帧数据的长度 + * @param buf 可供写入的加密后数据缓冲区 + * @param buf_len 可供写入的加密后数据缓冲区大小 + * @return 加密后的数据
+ * - ≥ 0:加密后实际写入缓冲区的数据大小 + * - 0:丢弃该帧 + * @note + * - 使用此接口进行解密前,你必须先设定解密方式,参看 `setCustomizeEncryptHandler`。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + + virtual unsigned int onDecryptData( + const unsigned char* data, unsigned int length, unsigned char* buf, unsigned int buf_len) = 0; +}; + +/** + * + * @type keytype + * @region 房间管理 + * @brief 用户信息 + */ + +struct RtcUser { + /** + * + * @brief 用户 id + */ + + const char* user_id; + /** + * + * @brief 元数据 + */ + + const char* meta_data; +}; + +/** + * + * @type keytype + * @region 房间管理 + * @brief 首帧发送状态 + */ + +enum FirstFrameSendState { + /** + * + * @brief 发送中 + */ + + kFirstFrameSendStateSending = 0, + /** + * + * @brief 发送成功 + */ + + kFirstFrameSendStateSent = 1, + /** + * + * @brief 发送失败 + */ + + kFirstFrameSendStateEnd = 2, +}; + +/** + * + * @type keytype + * @region 房间管理 + * @brief 首帧播放状态 + */ + +enum FirstFramePlayState { + /** + * + * @brief 播放中 + */ + + kFirstFramePlayStatePlaying = 0, + /** + * + * @brief 播放成功 + */ + + kFirstFramePlayStatePlayed = 1, + /** + * + * @brief 播放失败 + */ + + kFirstFramePlayStateEnd = 2, +}; + +/** + * + * @type keytype + * @brief 音视频流的发送/播放状态 + */ + +enum MuteState { + /** + * + * @brief 发送 + */ + + kMuteStateOff = 0, + /** + * + * @brief 停止发送 + */ + + kMuteStateOn = 1, +}; + +/** + * + * @type keytype + * @brief 预留字段。 + */ + +enum StreamIndex { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
+ * - 由摄像头/麦克风通过内部采集机制,采集到的视频/音频; + * - 通过自定义采集,采集到的视频/音频。 + */ + + kStreamIndexMain = 0, + /** + * + * @hidden for internal use only + * @brief 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。 + */ + + kStreamIndexScreen = 1, + /** + * + * @hidden for internal use only + */ + + kStreamIndex3rd, + /** + * + * @hidden for internal use only + */ + + kStreamIndex4th, + /** + * + * @hidden for internal use only + */ + + kStreamIndex5th, + /** + * + * @hidden for internal use only + */ + + kStreamIndex6th, + /** + * + * @hidden for internal use only + */ + + kStreamIndex7th, + /** + * + * @hidden for internal use only + */ + + kStreamIndexMax, +}; + +/** + * + * @valid since 3.56 + * @type keytype + * @brief 流聚合策略 + */ + +enum AggregationOption { + /** + * + * @brief 流聚合向下取值 (默认策略) + */ + + kAggregationOptionMin = 0, + /** + * + * @brief 流聚合向上取值 + */ + + kAggregationOptionMax = 1, + /** + * + * @brief 流聚合按比例取值,比例相同时,向下取值 + */ + + kAggregationOptionMajority = 2, + +}; + +/** + * + * @type keytype + * @brief 远端流信息 + */ + +struct RemoteStreamKey { + /** + * + * @brief 媒体流所在房间的房间 ID。
+ * 如果此媒体流是通过 `startForwardStreamToRooms` 转发到你所在房间的媒体流时,你应将房间 ID 设置为你所在的房间 ID。 + */ + + const char* room_id; + /** + * + * @brief 用户 ID + */ + + const char* user_id; + /** + * + * @brief 预留字段。 + */ + + StreamIndex stream_index; +}; + +/** + * + * @type keytype + * @brief 截图错误码 + */ + +enum SnapshotErrorCode { + /** + * + * @brief 截图成功。 + */ + + kSnapshotErrorCodeOk = 0, + /** + * + * @brief 截图错误。生成图片数据失败或 RGBA 编码失败。 + */ + + kSnapshotErrorCodeCreateFail = -1, + /** + * + * @brief 截图错误。流无效。 + */ + + kSnapshotErrorCodeStreamInvalid = -2, + /** + * + * @brief 截图错误。截图超时,超时时间 1 秒。 + */ + + kSnapshotErrorCodeTimeout = -3, + /** + * + * @brief 截图错误。图片保存失败。 + */ + + kSnapshotErrorCodeFileSaveError = -4 +}; +/** + * + * @type keytype + * @brief 本地录制文件的存储格式 + */ + +enum RecordingFileType { + /** + * + * @brief aac 格式文件 + */ + + kRecordingFileTypeAAC = 0, + /** + * + * @brief mp4 格式文件 + */ + + kRecordingFileTypeMP4 = 1, +}; + +/** + * + * @type keytype + * @brief 本地录制的状态 + */ + +enum RecordingState { + /** + * + * @brief 录制异常 + */ + + kRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + kRecordingStateProcessing = 1, + /** + * + * @brief 录制文件保存成功。正常调用 stopFileRecording 后触发。此外,若录制中途编码分辨率发生变更,SDK 会自动结束当前文件保存并触发此状态码,随后开启新一轮录制,直到调用停止录制。 + */ + + kRecordingStateSuccess = 2, +}; + +/** + * + * @type keytype + * @brief 本地录制的错误码 + */ + +enum RecordingErrorCode { + /** + * + * @brief 录制正常 + */ + + kRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + kRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 当前版本 SDK 不支持本地录制功能,请联系技术支持人员 + */ + + kRecordingErrorCodeNotSupport = -2, + /** + * + * @brief 其他异常 + */ + + kRecordingErrorCodeOther = -3, +}; + +/** + * + * @type keytype + * @brief 本地录制进度 + */ + +struct RecordingProgress { + /** + * + * @brief 当前文件的累计录制时长,单位:毫秒 + */ + + unsigned long long duration; + /** + * + * @brief 当前录制文件的大小,单位:byte + */ + + unsigned long long file_size; +}; + +/** + * + * @type keytype + * @brief 本地录制的详细信息 + */ + +struct RecordingInfo { + /** + * + * @brief 录制文件的绝对路径,包含文件名和文件后缀 + */ + + const char* file_path; + /** + * + * @brief 录制文件的视频编码类型,参看 VideoCodecType{@link #VideoCodecType} + */ + + VideoCodecType video_codec_type; + /** + * + * @brief 录制视频的宽,单位:像素。纯音频录制请忽略该字段 + */ + + int width; + /** + * + * @brief 录制视频的高,单位:像素。纯音频录制请忽略该字段 + */ + + int height; +}; + +/** + * + * @type keytype + * @brief 本地录制参数配置 + */ + +struct RecordingConfig { + /** + * + * @brief 录制文件保存的绝对路径,需精确到文件夹,文件名由 RTC 自动生成。你需要确保对该路径具有读写权限。 + */ + + const char* dir_path; + /** + * + * @brief 录制存储文件格式,参看 RecordingFileType{@link #RecordingFileType} + */ + + RecordingFileType file_type; +}; + +/** + * + * @type keytype + * @brief 定义 linux 用户的用户功能 + */ + +enum UserWorkerType { + /** + * + * @brief 正常用户,没有任何特殊属性 + */ + + kUserWorkerTypeNormal = 0, + /** + * + * @brief 用户支持 SIP 流,信令只下发 SIP 流 + */ + + kUserWorkerTypeSupportSip = (1 << 0), + /** + * + * @brief 用户支持屏幕流的 bytevc1 到 H264 转码 + */ + + kUserWorkerTypeByteVc1Transcoder = (1 << 1), + /** + * + * @brief 用户需要信令服务器下发全量的用户列表和回调函数 + */ + + kUserWorkerTypeNeedUserListAndCb = (1 << 2), + /** + * + * @brief 用户需要在房间进入多人模式时获取房间内所有流的相关回调 + */ + + kUserWorkerTypeNeedStreamCallBack = (1 << 3), + /** + * + * @brief 用户选择设置不支持音频选路功能 + */ + + kUserWorkerTypeAudioSelectionExemption = (1 << 4), +}; + +/** + * + * @type keytype + * @brief 音视频同步状态 + */ + +enum AVSyncState { + /** + * + * @brief 音视频开始同步 + */ + + kAVSyncStateAVStreamSyncBegin = 0, + /** + * + * @brief 音视频同步过程中音频移除,但不影响当前的同步关系 + */ + + kAVSyncStateAudioStreamRemove, + /** + * + * @brief 音视频同步过程中视频移除,但不影响当前的同步关系 + */ + + kAVSyncStateVdieoStreamRemove, + /** + * + * @hidden for internal use only + * @brief 订阅端设置同步 + */ + + kAVSyncStateSetAVSyncStreamId, +}; + +/** + * + * @hidden + * @deprecated + * @type keytype + */ + +enum RtcRoomMode { + kRtcRoomNormalMode = 0, + kRtcRoomAudioSelectionMode = 1, +}; + +/** + * + * @type keytype + * @brief 媒体流信息同步的流类型 + */ + +enum SyncInfoStreamType { + /** + * + * @brief 音频流 + */ + + kSyncInfoStreamTypeAudio = 0 +}; + +/** + * + * @type keytype + * @brief 流属性。 + */ + +struct StreamInfo { + /** + * + * @brief 流 ID 。 + */ + + const char* stream_id; + /** + * + * @brief 房间 ID。 + */ + + const char* room_id; + /** + * + * @brief 发布此流的用户 ID 。 + */ + + const char* user_id; + /** + * + * @hidden for internal use only + * @brief 该流的标识 ID,用户内唯一。 + */ + + int stream_index; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; +}; + +/** + * + * @type keytype + * @brief 媒体流信息同步的相关配置 + */ + +struct StreamSyncInfoConfig { + /** + * + * @brief 消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。 + */ + + int repeat_count; + /** + * + * @brief 媒体流信息同步的流类型,见 SyncInfoStreamType{@link #SyncInfoStreamType} + */ + + SyncInfoStreamType stream_type; +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发的目标房间的相关信息 + */ + +struct ForwardStreamInfo { + /** + * + * @brief 使用转发目标房间 roomID 和 UserID 生成 Token。
+ * 测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。
+ * 如果 Token 无效,转发失败。 + */ + + const char* token; + /** + * + * @brief 跨间转发媒体流过程中目标房间 ID + */ + + const char* room_id; +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发的目标房间的相关信息 + */ + +struct ForwardStreamConfiguration { + /** + * + * @brief 目标房间信息,数组中的每个元素包含一个房间的信息。 + */ + + ForwardStreamInfo* forward_stream_dests = nullptr; + /** + * + * @brief 目标房间数量。媒体流同时转发的目标房间数量建议小于等于 4 个。 + */ + + int dest_count = 0; +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发状态 + */ + +enum ForwardStreamState { + /** + * + * @brief 空闲状态
+ * - 成功调用 `stopForwardStreamToRooms` 后,所有目标房间为空闲状态。 + * - 成功调用 `updateForwardStreamToRooms` 减少目标房间后,本次减少的目标房间为空闲状态。 + */ + + kForwardStreamStateIdle = 0, + /** + * + * @brief 开始转发
+ * - 调用 `startForwardStreamToRooms` 成功向所有房间开始转发媒体流后,返回此状态。 + * - 调用 `updateForwardStreamToRooms` 后,成功向新增目标房间开始转发媒体流后,返回此状态。 + */ + + kForwardStreamStateSuccess = 1, + /** + * + * @brief 转发失败,失败详情参考 ForwardStreamError{@link #ForwardStreamError}
+ * 调用 `startForwardStreamToRooms` 或 `updateForwardStreamToRooms` 后,如遇转发失败,返回此状态。 + */ + + kForwardStreamStateFailure = 2, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发过程中抛出的错误码 + */ + +enum ForwardStreamError { + /** + * + * @brief 正常 + */ + + kForwardStreamErrorOK = 0, + /** + * + * @brief 参数异常 + */ + + kForwardStreamErrorInvalidArgument = 1201, + /** + * + * @brief token 错误 + */ + + kForwardStreamErrorInvalidToken = 1202, + /** + * + * @brief 服务端异常 + */ + + kForwardStreamErrorResponse = 1203, + /** + * + * @brief 目标房间有相同 user id 的用户加入,转发中断 + */ + + kForwardStreamErrorRemoteKicked = 1204, + /** + * + * @brief 服务端不支持转发功能 + */ + + kForwardStreamErrorNotSupport = 1205, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发事件 + */ + +enum ForwardStreamEvent { + /** + * + * @brief 本端与服务器网络连接断开,暂停转发。 + */ + + kForwardStreamEventDisconnected = 0, + /** + * + * @brief 本端与服务器网络连接恢复,转发服务连接成功。 + */ + + kForwardStreamEventConnected = 1, + /** + * + * @brief 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。 + */ + + kForwardStreamEventInterrupt = 2, + /** + * + * @brief 目标房间已更新,由 `updateForwardStreamToRooms` 触发。 + */ + + kForwardStreamEventDstRoomUpdated = 3, + /** + * + * @brief API 调用时序错误。例如,在调用 `startForwardStreamToRooms` 之前调用 `updateForwardStreamToRooms` 。 + */ + + kForwardStreamEventUnExpectAPICall = 4, +}; + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间的状态和错误信息 + */ + +struct ForwardStreamStateInfo { + /** + * + * @brief 跨间转发媒体流过程中目标房间 ID + */ + + const char* room_id; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间的状态,参看 ForwardStreamState{@link #ForwardStreamState} + */ + + ForwardStreamState state; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ForwardStreamError{@link #ForwardStreamError} + */ + + ForwardStreamError error; +}; + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间发生的事件 + */ + +struct ForwardStreamEventInfo { + /** + * + * @brief 跨房间转发媒体流过程中的发生该事件的目标房间 ID
+ * 空字符串代表所有目标房间 + */ + + const char* room_id; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间发生的事件,参看 ForwardStreamEvent{@link #ForwardStreamEvent} + */ + + ForwardStreamEvent event; +}; + +/** + * + * @type keytype + * @brief 水印图片相对视频流的位置和大小。 + */ + +struct ByteWatermark { + /** + * + * @hidden currently not available + */ + + const char* url = nullptr; + /** + * + * @brief 水印图片相对视频流左上角的横向偏移与视频流宽度的比值,取值范围为 [0,1)。 + */ + + float x; + /** + * + * @brief 水印图片相对视频流左上角的纵向偏移与视频流高度的比值,取值范围为 [0,1)。 + */ + + float y; + /** + * + * @brief 水印图片宽度与视频流宽度的比值,取值范围 [0,1)。 + */ + + float width; + /** + * + * @brief 水印图片高度与视频流高度的比值,取值范围为 [0,1)。 + */ + + float height; +}; + +/** + * + * @type keytype + * @brief 水印参数 + */ + +struct RTCWatermarkConfig { + /** + * + * @type keytype + * @brief 水印是否在视频预览中可见,默认可见。 + */ + + bool visible_in_preview = true; + /** + * + * @type keytype + * @brief 横屏时的水印位置和大小,参看 ByteWatermark{@link #ByteWatermark}。 + */ + + ByteWatermark position_in_landscape_mode; + /** + * + * @type keytype + * @brief 视频编码的方向模式为竖屏时的水印位置和大小,参看 ByteWatermark{@link #ByteWatermark}。 + */ + + ByteWatermark position_in_portrait_mode; +}; + +/** + * + * @type keytype + * @brief 设备的传输方式 + */ + +enum DeviceTransportType { + /** + * + * @brief 未知类型 + */ + + kDeviceTransportTypeUnknown = 0, + /** + * + * @brief 系统内置 + */ + + kDeviceTransportTypeBuiltIn = 1, + /** + * + * @brief 未知模式蓝牙 + */ + + kDeviceTransportTypeBlueToothUnknownMode = 2, + /** + * + * @brief 免提模式蓝牙 + */ + + kDeviceTransportTypeBlueToothHandsFreeMode = 3, + /** + * + * @brief 立体声模式蓝牙 + */ + + kDeviceTransportTypeBlueToothStereoMode = 4, + /** + * + * @brief 显示器/电视机音频设备 + */ + + kDeviceTransportTypeDisplayAudio = 5, + /** + * + * @brief 虚拟设备 + */ + + kDeviceTransportTypeVirtual = 6, + /** + * + * @brief USB 设备 + */ + + kDeviceTransportTypeUSB = 7, + /** + * + * @brief PCI 设备 + */ + + kDeviceTransportTypePCI = 8, + /** + * + * @brief AirPlay 设备 + */ + + kDeviceTransportTypeAirPlay = 9, + /** + * + * @brief 连续互通相机 + */ + + kDeviceTransportTypeContinuityCamera = 100, +}; + +/** + * + * @type keytype + * @brief 音视频回路测试结果 + */ + +enum class EchoTestResult { + /** + * + * @brief 接收到采集的音视频的回放,通话回路检测成功 + */ + + kTestSuccess = 0, + /** + * + * @brief 测试超过 60s 仍未完成,已自动停止 + */ + + kTestTimeout, + /** + * + * @brief 上一次测试结束和下一次测试开始之间的时间间隔少于 5s + */ + + kTestIntervalShort, + /** + * + * @brief 音频采集异常 + */ + + kAudioDeviceError, + /** + * + * @brief 视频采集异常 + */ + + kVideoDeviceError, + /** + * + * @brief 音频接收异常 + */ + + kAudioReceiveError, + /** + * + * @brief 视频接收异常 + */ + + kVideoReceiveError, + /** + * + * @brief 内部错误,不可恢复 + */ + + kInternalError +}; + +/** + * + * @type keytype + * @brief 音视频回路测试参数 + */ + +struct EchoTestConfig { + /** + * + * @brief 用于渲染接收到的视频的视图 + */ + + void* view; + /** + * + * @brief 是否检测音频。检测设备为系统默认音频设备。
+ * - true:是 + * - 若使用 SDK 内部采集,此时设备麦克风会自动开启,并在 audioPropertiesReportInterval 值大于 0 时触发 `onLocalAudioPropertiesReport` 回调,你可以根据该回调判断麦克风的工作状态 + * - 若使用自定义采集,此时你需调用 pushExternalAudioFrame{@link #IRTCEngine#pushExternalAudioFrame} 将采集到的音频推送给 SDK + * - false:否 + */ + + bool enable_audio; + /** + * + * @brief 是否检测视频。PC 端默认检测列表中第一个视频设备。
+ * - true:是 + * - 若使用 SDK 内部采集,此时设备摄像头会自动开启 + * - 若使用自定义采集,此时你需调用 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 将采集到的视频推送给 SDK + * - false:否 + * @note 视频的发布参数固定为:分辨率 640px × 360px,帧率 15fps。 + */ + + bool enable_video; + /** + * + * @brief 音量信息提示间隔,单位:ms,默认为 100ms
+ * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + + int audio_properties_report_interval; + /** + * + * @brief 进行音视频通话回路测试的用户 ID + */ + + const char* uid; + /** + * + * @brief 测试用户加入的房间 ID。 + */ + + const char* room_id; + /** + * + * @brief 对用户进房时进行鉴权验证的动态密钥,用于保证音视频通话回路测试的安全性。 + */ + + const char* token; +}; + +/** + * + * @type keytype + * @brief 音频 dump 状态。 + */ + +enum AudioDumpStatus { + /** + * + * @brief 音频 dump 启动失败 + */ + + kAudioDumpStatusStartFailure = 0, + /** + * + * @brief 音频 dump 启动成功 + */ + + kAudioDumpStatusStartSuccess = 1, + /** + * + * @brief 音频 dump 停止失败 + */ + + kAudioDumpStatusStopFailure = 2, + /** + * + * @brief 音频 dump 停止成功 + */ + + kAudioDumpStatusStopSuccess = 3, + /** + * + * @brief 音频 dump 运行失败 + */ + + kAudioDumpStatusRunningFailure = 4, + /** + * + * @brief 音频 dump 运行成功 + */ + + kAudioDumpStatusRunningSuccess = 5, +}; + +/** + * + * @type errorcode + * @brief 开始探测的返回值
+ * `startNetworkDetection` 返回对象类型 + */ + +enum NetworkDetectionStartReturn { + /** + * + * @brief 成功开启网络探测。 + */ + + kNetworkDetectionStartReturnSuccess = 0, + /** + * + * @brief 开始探测失败。参数错误,上下行探测均为 `false`,或期望带宽超过了范围 [100,10000] + */ + + kNetworkDetectionStartReturnParamErr = 1, + /** + * + * @brief 开始探测失败。失败原因为,本地已经开始推拉流 + */ + + kNetworkDetectionStartReturnStreaming = 2, + /** + * + * @brief 已经开始探测,无需重复开启 + */ + + kNetworkDetectionStartReturnStarted = 3, + /** + * + * @brief 不支持该功能 + */ + + kNetworkDetectionStartReturnNotSupport = 4, +}; + +/** + * + * @type keytype + * @brief 通话前探测的停止原因
+ * `onNetworkDetectionStopped` 回调的参数类型 + */ + +enum NetworkDetectionStopReason { + /** + * + * @brief 用户主动停止 + */ + + kNetworkDetectionStopReasonUser, + /** + * + * @brief 探测超过三分钟 + */ + + kNetworkDetectionStopReasonTimeout, + /** + * + * @brief 探测网络连接断开。
当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。 + */ + + kNetworkDetectionStopReasonConnectionLost, + /** + * + * @brief 本地开始推拉流,停止探测 + */ + + kNetworkDetectionStopReasonStreaming, + /** + * + * @brief 网络探测失败,内部异常 + */ + + kNetworkDetectionStopReasonInnerErr, +}; + +/** + * + * @type keytype + * @brief 通话前探测链接的类型。
+ * `onNetworkDetectionResult` 回调的参数类型 + */ + +enum NetworkDetectionLinkType { + /** + * + * @brief 上行网络探测 + */ + + kNetworkDetectionLinkTypeUp = 0, + /** + * + * @brief 下行网络探测 + */ + + kNetworkDetectionLinkTypeDown, +}; + +/** + * + * @type keytype + * @brief 网络时间信息 + */ + +struct NetworkTimeInfo { + /** + * + * @brief 网络时间,单位:ms + */ + + int64_t timestamp; + /** + * + * @hidden constructor/destructor + */ + + explicit NetworkTimeInfo(int64_t ts): timestamp(ts) { + } +}; + +/** + * + * @type keytype + * @brief 通话前回声检测结果 + */ + +enum HardwareEchoDetectionResult{ + /** + * + * @brief 主动调用 `stopHardwareEchoDetection` 结束流程时,未有回声检测结果。 + */ + + kHardwareEchoDetectionResultCanceled = 0, + /** + * + * @brief 未检测出结果。建议重试,如果仍然失败请联系技术支持协助排查。 + */ + + kHardwareEchoDetectionResultUnknown = 1, + /** + * + * @brief 无回声 + */ + + kHardwareEchoDetectionResultNormal = 2, + /** + * + * @brief 有回声。可通过 UI 建议用户使用耳机设备入会。 + */ + + kHardwareEchoDetectionResultPoor = 3, +}; + +/** + * + * @type keytype + * @brief 音频选路优先级设置 + */ + +enum AudioSelectionPriority { + /** + * + * @brief 正常,参加音频选路 + */ + + kAudioSelectionPriorityNormal = 0, + /** + * + * @brief 高优先级,跳过音频选路 + */ + + kAudioSelectionPriorityHigh = 1 +}; + +/** + * + * @type keytype + * @brief 设置房间附加消息结果。 + */ + +enum SetRoomExtraInfoResult { + /** + * + * @brief 设置房间附加信息成功 + */ + + kSetRoomExtraInfoResultSuccess = 0, + /** + * + * @brief 设置失败,尚未加入房间 + */ + + kSetRoomExtraInfoResultErrorNotJoinRoom = -1, + /** + * + * @brief 设置失败,key 指针为空 + */ + + kSetRoomExtraInfoResultErrorKeyIsNull = -2, + /** + * + * @brief 设置失败,value 指针为空 + */ + + kSetRoomExtraInfoResultErrorValueIsNull = -3, + /** + * + * @brief 设置失败,未知错误 + */ + + kSetRoomExtraInfoResultResultUnknow = -99, + /** + * + * @brief 设置失败,key 长度为 0 + */ + + kSetRoomExtraInfoResultErrorKeyIsEmpty = -400, + /** + * + * @brief 调用 `setRoomExtraInfo` 过于频繁,建议不超过 10 次/秒。 + */ + + kSetRoomExtraInfoResultErrorTooOften = -406, + /** + * + * @brief 设置失败,用户已调用 `setUserVisibility` 将自身设为隐身状态。 + */ + + kSetRoomExtraInfoResultErrorSilentUser = -412, + /** + * + * @brief 设置失败,Key 长度超过 10 字节 + */ + + kSetRoomExtraInfoResultErrorKeyTooLong = -413, + /** + * + * @brief 设置失败,value 长度超过 128 字节 + */ + + kSetRoomExtraInfoResultErrorValueTooLong = -414, + /** + * + * @brief 设置失败,服务器错误 + */ + + kSetRoomExtraInfoResultErrorServer = -500 +}; +/** + * + * @type keytype + * @brief 字幕任务状态。 + */ + +enum SubtitleState { + /** + * + * @brief 开启字幕。 + */ + + kSubtitleStateStarted, + /** + * + * @brief 关闭字幕。 + */ + + kSubtitleStateStoped, + /** + * + * @brief 字幕任务出现错误。 + */ + + kSubtitleStateError +}; +/** + * + * @type keytype + * @brief 字幕模式。 + */ + +enum SubtitleMode { + /** + * + * @brief 识别模式。在此模式下,房间内用户语音会被转为文字。 + */ + + kSubtitleModeRecognition = 0, + /** + * + * @brief 翻译模式。在此模式下,房间内用户语音会先被转为文字,再被翻译为目标语言。 + */ + + kSubtitleModeTranslation +}; +/** + * + * @type errorcode + * @brief 字幕任务错误码。 + */ + +enum SubtitleErrorCode { + /** + * + * @brief 客户端无法识别云端媒体处理发送的错误码。请联系技术支持。 + */ + + kSubtitleErrorCodeUnknow = -1, + /** + * + * @brief 字幕已开启。 + */ + + kSubtitleErrorCodeSuccess, + /** + * + * @brief 云端媒体处理内部出现错误,请联系技术支持。 + */ + + kSubtitleErrorCodePostProcessError, + /** + * + * @brief 第三方服务连接失败,请联系技术支持。 + */ + + kSubtitleErrorCodeASRConnectionError, + /** + * + * @brief 第三方服务内部出现错误,请联系技术支持。 + */ + + kSubtitleErrorCodeASRServiceError, + /** + * + * @brief 未进房导致调用`startSubtitle`失败。请加入房间后再调用此方法。 + */ + + kSubtitleErrorCodeBeforeJoinRoom, + /** + * + * @brief 重复调用 `startSubtitle`。 + */ + + kSubtitleErrorCodeAlreadyOn, + /** + * + * @brief 用户选择的目标语言目前暂不支持。 + */ + + kSubtitleErrorCodeUnsupportedLanguage, + /** + * + * @brief 云端媒体处理超时未响应,请联系技术支持。 + */ + + kSubtitleErrorCodePostProcessTimeout +}; +/** + * + * @type keytype + * @brief 字幕配置信息。 + */ + +struct SubtitleConfig { + /** + * + * @brief 字幕模式。可以根据需要选择识别和翻译两种模式。开启识别模式,会将识别后的用户语音转化成文字;开启翻译模式,会在语音识别后进行翻译。参看 SubtitleMode{@link #SubtitleMode}。 + */ + + SubtitleMode mode = kSubtitleModeRecognition; + /** + * + * @brief 目标翻译语言。可点击 [语言支持](https: + */ + + const char* target_language = ""; +}; +/** + * + * @type keytype + * @brief 字幕具体内容。 + */ + +struct SubtitleMessage { + /** + * + * @brief 说话者的用户 ID。 + */ + + const char* user_id; + /** + * + * @brief 字幕文本, 采用 UTF-8 编码。 + */ + + const char* text; + /** + * + * @brief 字幕语种,根据字幕模式为原文或译文对应的语种。 + */ + + const char* language; + /** + * + * @brief 字幕模式,参看 SubtitleMode{@link #SubtitleMode}。 + */ + + SubtitleMode mode; + /** + * + * @brief 字幕文本序列号,同一发言人的完整发言和不完整发言会按递增顺序单独分别编号。 + */ + + int sequence; + /** + * + * @brief 语音识别出的文本是否为一段完整的一句话。 True 代表是, False 代表不是。 + */ + + bool definite; +}; +/** + * + * @type keytype + * @hidden internal use only + * @brief 特效错误类型。 + */ + +enum EffectErrorType { + /** + * + * @hidden 仅用于会议 + * @brief 虚拟背景设置错误。 + */ + + kEffectErrorVirtualBackgroundFailure = 1, + /** + * + * @hidden 仅用于会议 + * @brief 特效独立进程崩溃。 + */ + + kEffectErrorChildProcTerminate, +}; + +/** + * + * @type render error code + * @hidden for internal use only + * @brief 渲染错误码。 + */ + +enum RenderError { + /** + * + * @brief 渲染正常 + */ + + kRenderErrorOk = 0, + /** + * + * @brief Android 外部直显时使用了内部 surface + */ + + kRenderErrorUsingInternalSurface = -1, + /** + * + * @brief 设置 Android 外部直显时使用软解 + */ + + kRenderErrorUsingSoftwareDecoder = -2, + +}; + +/** + * + * @type keytype + * @brief 线程 block 信息,包含 block_session_id, 线程等待链,是否卡住了 rtc 主线程 + * @hidden internal use only + */ + +struct DeadLockMsg { + const char* block_session_id; + const char* blocking_paths; + bool is_critical; +}; + + +/** + * + * @type keytype + * @brief AVSync 事件类型 + */ + +enum AVSyncEvent { + /** + * + * @brief 音视频同步失败。
+ * 当前音频源已与其他视频源关联同步关系。
+ * 单个音频源不支持与多个视频源同时同步。 + */ + + kAVSyncEventInvalidUidRepeated +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人声检测结果 + */ + +enum AudioVADType { + /** + * + * @brief 未检测到人声 + */ + + kAudioVADTypeNoSpeech = 0, + + /** + * + * @brief 检测到人声。 + */ + + kAudioVADTypeSpeech = 1, +}; +/** + * + * @hidden for internal use only + * @type keytype + * @brief 音乐场景检测结果 + */ + +enum AudioAEDType { + /** + * + * @brief 未检测到音乐场景 + */ + + kAudioAEDTypeNoMusic = 0, + /** + * + * @brief 检测到音乐场景。 + */ + + kAudioAEDTypeMusic = 1, +}; + +class IVideoSource { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoSource() { + } +}; + +class IAudioSource { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioSource() { + } +}; + + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_player.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_player.h new file mode 100644 index 0000000..2e85f04 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_player.h @@ -0,0 +1,588 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Effect Player +*/ +#pragma once + +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @type callback + * @brief 本地音频文件混音的音频帧观察者。 + * @list 自定义流处理 + */ + +class IMediaPlayerAudioFrameObserver { +public: + /** + * + * @type callback + * @brief 当本地音频文件混音时,回调播放的音频帧。 + * @param player_id 播放器 ID + * @param frame 参看 IAudioFrame{@link #IAudioFrame}。 + * @list 混音 + */ + + virtual void onFrame(int player_id, const IAudioFrame& frame) = 0; + /** + * + * @hidden constructor/destructor + */ + + virtual ~IMediaPlayerAudioFrameObserver() { + } +}; +/** + * + * @type keytype + * @brief 自定义音频源模式 + */ + +enum MediaPlayerCustomSourceMode{ + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceModePush = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceModePull, +}; + +/** + * + * @type keytype + * @brief 音频数据的起始读取位置。 + */ + +enum MediaPlayerCustomSourceSeekWhence{ + /** + * + * @brief 从音频数据的头开始读取,读取的实际偏移量为参数 offset 的值。 + */ + + kMediaPlayerCustomSourceSeekWhenceSet = 0, + /** + * + * @brief 从音频数据的某一位置开始读取,读取的实际偏移量为音频数据当前的读取位置位置加上参数 offset 的值。 + */ + + kMediaPlayerCustomSourceSeekWhenceCur = 1, + /** + * + * @brief 从音频数据的尾开始读取,读取的实际数据偏移量为用户传入的音频数据大小加上参数 offset 的值。 + */ + + kMediaPlayerCustomSourceSeekWhenceEnd = 2, + /** + * + * @brief 返回音频数据的大小。 + */ + + kMediaPlayerCustomSourceSeekWhenceSize = 3, +}; +/** + * + * @type keytype + * @brief 自定义音频流类型 + */ + +enum MediaPlayerCustomSourceStreamType{ + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceStreamTypeRaw = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceStreamTypeEncoded, +}; +/** + * + * @type callback + * @brief 内存播放数据源回调 + * @list 自定义流处理 + */ + +class IMediaPlayerCustomSourceProvider { +public: + /** + * + * @valid since 3.53 + * @type callback + * @brief 调用 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口播放用户传入的内存音频数据时,会触发此回调,用户需要写入音频数据。 + * @param buffer 内存地址。在该地址中写入音频数据,写入音频数据的大小不超过 bufferSize 中填入的数值。支持的音频数据格式有: mp3,aac,m4a,3gp,wav。 + * @param buffer_size 音频数据大小,单位为字节。如果你想停止播放内存音频数据,可在 bufferSize 中填入小于或等于 0 的数,此时 SDK 会停止调用此接口。 + * @return 返回实际读取的音频数据大小。 + * @note 若 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口调用失败,请在 buffer 和 bufferSize 两个参数中填入 0。 此时 SDK 会停止调用此接口。 + * @list 混音 + */ + + virtual int onReadData(uint8_t *buffer, int buffer_size) = 0; + /** + * + * @valid since 3.53 + * @type callback + * @brief 根据设置好的内存音频数据的读取位置和读取偏移量对音频数据进行偏移,以便 SDK 读取和分析音频数据。
+ * 在调用 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口传入内存音频数据,或者调用 setPosition{@link #IMediaPlayer#setPosition} 设置了音频数据的起始播放位置后,SDK 会对音频数据进行读取和分析,此时会触发该回调,你需要根据参数中设置的起始读取位置和偏移量进行操作。 + * @param offset 音频数据读取偏移量,单位为字节,取值可正可负。 + * @param whence 音频数据的起始读取位置。参看 MediaPlayerCustomSourceSeekWhence{@link #MediaPlayerCustomSourceSeekWhence} + * @return + * 定位成功,返回偏移后的位置信息,或返回音频数据的大小。
+ * 定位失败,返回 -1。 + * @list 混音 + */ + + virtual int64_t onSeek(int64_t offset, MediaPlayerCustomSourceSeekWhence whence) = 0; + + virtual ~IMediaPlayerCustomSourceProvider() {} +}; +/** + * + * @type keytype + * @brief 音频源 + */ + +struct MediaPlayerCustomSource { + /** + * + * @hidden reserved for later use + */ + + IMediaPlayerCustomSourceProvider* provider = nullptr; + /** + * + * @type keytype + * @brief 数据源模式,详见 MediaPlayerCustomSourceMode{@link #MediaPlayerCustomSourceMode}。 + */ + + MediaPlayerCustomSourceMode mode = kMediaPlayerCustomSourceModePush; + /** + * + * @type keytype + * @brief 数据源类型,详见 MediaPlayerCustomSourceStreamType{@link #MediaPlayerCustomSourceStreamType} + */ + + MediaPlayerCustomSourceStreamType type = kMediaPlayerCustomSourceStreamTypeRaw; +}; +/** + * + * @type callback + * @brief IMediaPlayer{@link #IMediaPlayer} 对应的回调句柄。你必须调用 setEventHandler{@link #IMediaPlayer#setEventHandler} 完成设置后,才能收到对应回调。 + * @list Audio Mixing + */ + +class IMediaPlayerEventHandler { +public: + virtual ~IMediaPlayerEventHandler() {} + /** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param player_id IMediaPlayer{@link #IMediaPlayer} 的 ID。通过 getMediaPlayer{@link #IRTCEngine#getMediaPlayer} 设置。 + * @param state 混音状态。参考 PlayerState{@link #PlayerState}。 + * @param error 错误码。参考 PlayerError{@link #PlayerError}。 + * @list 混音 + */ + + virtual void onMediaPlayerStateChanged(int player_id, PlayerState state, PlayerError error) = 0; + /** + * + * @type callback + * @brief 播放进度周期性回调。回调周期通过 setProgressInterval{@link #IMediaPlayer#setProgressInterval} 设置。 + * @param player_id IMediaPlayer{@link #IMediaPlayer} 的 ID。通过 getMediaPlayer{@link #IRTCEngine#getMediaPlayer} 设置。 + * @param progress 进度。单位 ms。 + * @list 混音 + */ + + virtual void onMediaPlayerPlayingProgress(int player_id, int64_t progress) = 0; + /** + * + * @valid since 3.59 + * @type callback + * @brief 播放事件回调。调用 selectAudioTrack{@link #IMediaPlayer#selectAudioTrack} 和 setPosition{@link #IMediaPlayer#setPosition} 后,会触发此回调。 + * @param player_id IMediaPlayer{@link #IMediaPlayer} 的 ID。通过 getMediaPlayer{@link #IRTCEngine#getMediaPlayer} 设置。 + * @param event 播放器事件。参看 PlayerEvent{@link #PlayerEvent}。 + * @param message 事件描述信息,可能为空。 + * @list 混音 + */ + + virtual void onMediaPlayerEvent(int player_id, PlayerEvent event, const char* message) = 0; +}; +/** + * + * @valid since 3.53 + * @type api + * @brief 音乐播放器
+ * 调用 setEventHandler{@link #IMediaPlayer#setEventHandler} 设置回调句柄以获取相关回调。 + * @list Audio Mixing + */ + +class IMediaPlayer { +public: + IMediaPlayer(){} + virtual ~IMediaPlayer() {} + /** + * + * @type api + * @brief 打开音乐文件。
+ * 一个播放器实例仅能够同时打开一个音乐文件。如果需要同时打开多个音乐文件,请创建多个音乐播放器实例。
+ * 要播放 PCM 格式的音频数据,参看 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource}。`openWithCustomSource` 和此 API 互斥。 + * @param file_path 音乐文件路径。
+ * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
+ * 推荐的采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
+ * 不同平台支持的本地文件格式:
+ * + * + * + * + * + *
mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYYYY
iOS/macOSYYYYYY
WindowsYYYYYYYY
+ * 不同平台支持的在线文件格式:
+ * + * + * + * + * + *
mp3mp4aacm4a3gpwavoggtswma
AndroidYYYYY
iOS/macOSYYYY
WindowsYYYYYYY
+ * @param config 详见 MediaPlayerConfig{@link #MediaPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 混音 + */ + + virtual int open(const char* file_path, const MediaPlayerConfig& config) = 0; + /** + * + * @type api + * @brief 播放音乐。你仅需要在调用 open{@link #IMediaPlayer#open},且未开启自动播放时,调用此方法。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 要播放 PCM 格式的音频数据,参看 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource}。`openWithCustomSource` 和此 API 互斥。 + * - 调用本方法播放音频文件后,可调用 stop{@link #IMediaPlayer#stop} 方法暂停播放。 + * @list 混音 + */ + + virtual int start() = 0; + /** + * + * @type api + * @brief 启动音频裸数据混音。
+ * 要播放音乐文件,参看 open{@link #IMediaPlayer#open}。`open` 与此 API 互斥。 + * @param source 数据源,详见 MediaPlayerCustomSource{@link #MediaPlayerCustomSource} + * @param config 详见 MediaPlayerConfig{@link #MediaPlayerConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法启动后,再调用 pushExternalAudioFrame{@link #IMediaPlayer#pushExternalAudioFrame} 推送音频数据,才会开始混音。 + * - 如要结束 PCM 音频数据混音,调用 stop{@link #IMediaPlayer#stop}。 + * @list 混音 + */ + + virtual int openWithCustomSource(const MediaPlayerCustomSource& source, const MediaPlayerConfig& config) = 0; + /** + * + * @type api + * @brief 调用 open{@link #IMediaPlayer#open}, start{@link #IMediaPlayer#start}, 或 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 开始播放后,可以调用本方法停止。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 混音 + */ + + virtual int stop() = 0; + /** + * + * @type api + * @brief 调用 open{@link #IMediaPlayer#open},或 start{@link #IMediaPlayer#start} 开始播放音频文件后,调用本方法暂停播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法暂停播放后,可调用 resume{@link #IMediaPlayer#resume} 恢复播放。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int pause() = 0; + /** + * + * @type api + * @brief 调用 pause{@link #IMediaPlayer#pause} 暂停音频播放后,调用本方法恢复播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int resume() = 0; + /** + * + * @type api + * @brief 调节指定混音的音量大小,包括音乐文件混音和 PCM 混音。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @param type 详见 AudioMixingType{@link #AudioMixingType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * @list 混音 + */ + + virtual int setVolume(int volume, AudioMixingType type) = 0; + /** + * + * @type api + * @brief 获取当前音量 + * @param type 详见 AudioMixingType{@link #AudioMixingType}。 + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在音频播放进行状态时,调用此方法。包括音乐文件混音和 PCM 混音。 + * @list 混音 + */ + + virtual int getVolume(AudioMixingType type) = 0; + /** + * + * @type api + * @brief 获取音乐文件时长。 + * @return + * - >0: 成功, 音乐文件时长,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getTotalDuration() = 0; + /** + * + * @type api + * @brief 获取混音音乐文件的实际播放时长,单位为毫秒。 + * @return + * - >0: 实际播放时长。 + * - < 0: 失败。 + * @note + * - 实际播放时长指的是歌曲不受停止、跳转、倍速、卡顿影响的播放时长。例如,若歌曲正常播放到 1:30 时停止播放 30s 或跳转进度到 2:00, 随后继续正常播放 2 分钟,则实际播放时长为 3 分 30 秒。 + * - 仅在音频播放进行状态,且 setProgressInterval{@link #IMediaPlayer#setProgressInterval} 设置间隔大于 `0` 时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getPlaybackDuration() = 0; + /** + * + * @type api + * @brief 获取音乐文件播放进度。 + * @return + * - >0: 成功, 音乐文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getPosition() = 0; + /** + * + * @valid since 3.59 + * @type api + * @brief 获取播放器状态 + * @return 播放器当前状态,参看 PlayerState{@link #PlayerState}。 + * @note 仅在音频实例创建后,调用此方法。 + * @list 混音 + */ + + virtual PlayerState getState() = 0; + /** + * + * @type api + * @brief 开启变调功能,多用于 K 歌场景。 + * @param pitch 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音乐文件混音,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setAudioPitch(int pitch) = 0; + /** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param position 音乐文件起始播放位置,单位为毫秒。
+ * 你可以通过 getTotalDuration{@link #IMediaPlayer#getTotalDuration} 获取音乐文件总时长,position 的值应小于音乐文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 调用本接口后,会收到 onMediaPlayerEvent{@link #IMediaPlayerEventHandler#onMediaPlayerEvent} 回调。 + * @list 混音 + */ + + virtual int setPosition(int position) = 0; + /** + * + * @type api + * @brief 设置当前音乐文件的声道模式 + * @param mode 声道模式。默认的声道模式和源文件一致,详见 AudioMixingDualMonoMode{@link #AudioMixingDualMonoMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setAudioDualMonoMode(AudioMixingDualMonoMode mode) = 0; + /** + * + * @type api + * @brief 获取当前音乐文件的音轨数 + * @return + >= 0:成功,返回当前音乐文件的音轨数 + * - < 0:方法调用失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getAudioTrackCount() = 0; + /** + * + * @type api + * @brief 指定当前音乐文件的播放音轨 + * @param index 指定的播放音轨,从 0 开始,取值范围为 `[0, getAudioTrackCount()-1]`。
+ * 设置的参数值需要小于 getAudioTrackCount{@link #IMediaPlayer#getAudioTrackCount} 的返回值 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * - 调用本接口后,会收到 onMediaPlayerEvent{@link #IMediaPlayerEventHandler#onMediaPlayerEvent} 回调。 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * @list 混音 + */ + + virtual int selectAudioTrack(int index) = 0; + /** + * + * @type api + * @brief 设置播放速度 + * @param speed 播放速度与原始文件速度的比例,单位:%,取值范围为 `[50,200]`,默认值为 100。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件可用,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setPlaybackSpeed(int speed) = 0; + /** + * + * @type api + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress{@link #IMediaPlayerEventHandler#onMediaPlayerPlayingProgress} 的间隔。 + * @param interval 时间间隔,单位毫秒。
+ * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setProgressInterval(int64_t interval) = 0; + /** + * + * @type api + * @brief 如果你需要使用 enableVocalInstrumentBalance{@link #IRTCEngine#enableVocalInstrumentBalance} 对音频文件/PCM 音频数据设置音量均衡,你必须通过此接口传入其原始响度。 + * @param loudness 原始响度,单位:lufs,取值范围为 `[-70.0, 0.0]`。
+ * 当设置的值小于 -70.0lufs 时,则默认调整为 -70.0lufs,大于 0.0lufs 时,则不对该响度做音量均衡处理。默认值为 1.0lufs,即不做处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件和音频裸数据播放都可用。 + * @list 混音 + */ + + virtual int setLoudness(float loudness) = 0; + /** + * + * @type api + * @brief 注册回调句柄以在本地音乐文件混音时,收到相关回调。 + * @param observer 参看 IMediaPlayerAudioFrameObserver{@link #IMediaPlayerAudioFrameObserver}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int registerAudioFrameObserver(IMediaPlayerAudioFrameObserver* observer) = 0; + /** + * + * @type api + * @brief 推送用于混音的 PCM 音频帧数据 + * @param audio_frame 音频帧,详见 IAudioFrame{@link #IAudioFrame}。
+ * - 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return + * - 0: 成功 + * - < 0: 失败 + * @note + * - 调用该方法前,须通过 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 启动外部音频流混音。 + * - 使用参考建议:首次推送数据,请在应用侧先缓存一定数据(如 200 毫秒),然后一次性推送过去;此后的推送操作定时 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + * - 如果要暂停播放,暂停推送即可。 + * @list 混音 + */ + + virtual int pushExternalAudioFrame(IAudioFrame* audio_frame) = 0; + /** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 IMediaPlayerEventHandler{@link #IMediaPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + + virtual int setEventHandler(IMediaPlayerEventHandler* handler) = 0; + }; + + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_panoramic_video_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_panoramic_video_interface.h new file mode 100644 index 0000000..dfc8a26 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_panoramic_video_interface.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief panoramic video interface + */ + +#pragma once + +namespace bytertc { +/** + * + * @hidden for internal use only on Windows and Android + * @type keytype + * @brief 四元数表示的头部位姿信息
+ * q = xi + yj + zk + w,i^2 = j^2 = k^2 = −1 + */ + +typedef struct Quaternionf { + /** + * + * @brief x 坐标 + */ + + float x; + /** + * + * @brief y 坐标 + */ + + float y; + /** + * + * @brief z 坐标 + */ + + float z; + /** + * + * @brief 旋转角 + */ + + float w; +} Quaternionf; + +/** + * + * @hidden (Windows, Android) internal use only + * @type api + * @brief 全景视频接口实例 + */ + +class IPanoramicVideo { +public: + /** + * + * @type api + * @brief 更新接收者的头位姿四元数。RTC 将根据头位姿下发相应的 Tile 视频。 + * @param info 参考 Quaternionf{@link #Quaternionf}。 + */ + + virtual int updateQuaternionf(const Quaternionf& info) = 0; + + virtual ~IPanoramicVideo() = default; +}; +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_range_audio_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_range_audio_interface.h new file mode 100644 index 0000000..169500e --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_range_audio_interface.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief range audio interface + */ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 本地用户能收听到、且具有衰减效果的音频接收范围 + */ + +struct ReceiveRange { + /** + * + * @brief 能够接收语音、并且具有衰减效果的最小距离值,该值须 ≥ 0,但 ≤ max。
+ * 小于该值的范围内没有范围语音效果,即收听到的音频音量相同。 + */ + + int min; + /** + * + * @brief 能够收听语音的最大距离值,该值须 > 0 且 ≥ min。
+ * 当收听者和声源距离处于 [min, max) 之间时,收听到的音量根据距离呈衰减效果。
+ * 超出该值范围的音频将无法收听到。 + */ + + int max; +}; + +/** + * + * @type keytype + * @brief 空间音频音量随距离衰减模式 + */ + +enum AttenuationType { + /** + * + * @brief 不随距离衰减 + */ + + kAttenuationTypeNone = 0, + /** + * + * @brief 线性衰减,音量随距离增大而线性减小 + */ + + kAttenuationTypeLinear = 1, + /** + * + * @brief 指数型衰减,音量随距离增大进行指数衰减 + */ + + kAttenuationTypeExponential = 2, +}; +/** + * + * @hidden(Linux) + * @type api + * @brief 范围语音接口实例 + * @list + */ + +class IRangeAudio { +public: + /** + * + * @type api + * @brief 开启/关闭范围语音功能。
+ * 范围语音是指,在同一 RTC 房间中设定的音频接收距离范围内,本地用户收听到的远端用户音频音量会随着远端用户的靠近/远离而放大/衰减;若远端用户在房间内的位置超出设定范围,则本地用户无法接收其音频。音频接收范围设置参看 updateReceiveRange{@link #IRangeAudio#updateReceiveRange}。 + * @param enable 是否开启范围语音功能:
+ * - true: 开启 + * - false: 关闭(默认) + * @note 该方法进房前后都可调用,为保证进房后范围语音效果的平滑切换,你需在该方法前先调用 updatePosition{@link #IRangeAudio#updatePosition} 设置自身位置坐标,然后开启该方法收听范围语音效果。 + * @list 高级功能 + */ + + virtual void enableRangeAudio(bool enable) = 0; + /** + * + * @type api + * @brief 更新本地用户的音频收听范围。 + * @param range 音频收听范围,参看 ReceiveRange{@link #ReceiveRange}。 + * @return 方法调用结果:
+ * - 0:成功; + * - !0: 失败。 + * @list 高级功能 + */ + + virtual int updateReceiveRange(const ReceiveRange &range) = 0; + /** + * + * @type api + * @brief 更新本地用户在房间内空间直角坐标系中的位置坐标。 + * @param pos 三维坐标的值,默认为 [0, 0, 0],参看 Position{@link #Position} + * @return 方法调用结果:
+ * - 0:成功; + * - !0:失败。 + * @note + * - 调用该接口更新坐标后,你需调用 enableRangeAudio{@link #IRangeAudio#enableRangeAudio} 开启范围语音功能以收听范围语音效果。 + * @list 高级功能 + */ + + virtual int updatePosition(const Position &pos) = 0; + /** + * + * @type api + * @brief 设置范围语音的音量衰减模式。 + * @param type 音量衰减模式。默认为线性衰减。详见 AttenuationType{@link #AttenuationType}。 + * @param coefficient 指数衰减模式下的音量衰减系数,默认值为 1。范围 [0.1,100],推荐设置为 `50`。数值越大,音量的衰减速度越快。 + * @return 调用是否成功
+ * - `0`:调用成功 + * - `-1`:调用失败。原因为在调用 enableRangeAudio{@link #IRangeAudio#enableRangeAudio} 开启范围语音前或进房前调用本接口 + * @note 音量衰减范围通过 updateReceiveRange{@link #IRangeAudio#updateReceiveRange} 进行设置。 + * @list 高级功能 + */ + + virtual int setAttenuationModel(AttenuationType type, float coefficient) = 0; + /** + * + * @type api + * @brief 添加标签组,用于标记相互之间通话不衰减的用户组。
+ * 在同一个 RTC 房间中,如果多个用户的标签组之间有交集,那么,他们之间互相通话时,通话不衰减。
+ * 比如,用户身处多个队伍,队伍成员间通话不衰减。那么,可以为每个队伍绑定专属标签,每个用户的标签组包含用户所属各个队伍的标签。 + * @param flags 标签组 + * @param len 列表长度 + * @list 高级功能 + */ + + virtual void setNoAttenuationFlags(const char** flags, int len) = 0; + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRangeAudio() {} +}; +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_rts_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_rts_defines.h new file mode 100644 index 0000000..745263d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_rts_defines.h @@ -0,0 +1,1281 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Common Defines + */ + +#pragma once + +#ifdef WIN32 +#define BYTERTC_API extern "C" __declspec(dllexport) +#elif defined(__APPLE__) +#include +#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) +#define BYTERTC_API __attribute__((__visibility__("default"))) extern "C" +#else +#define BYTERTC_API __attribute__((__visibility__("default"))) +#endif +#else +#define BYTERTC_API __attribute__((__visibility__("default"))) +#endif + +#ifdef __GNUC__ +# define GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) +#else +# define GCC_VERSION_AT_LEAST(x,y) 0 +#endif + +#if GCC_VERSION_AT_LEAST(3,1) +# define BYTERTC_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define BYTERTC_DEPRECATED __declspec(deprecated) +#else +# define BYTERTC_DEPRECATED +#endif + +#ifdef WIN32 +#define BYTERTC_STATIC_API __declspec(dllexport) +#elif defined(__APPLE__) +#include +#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) +#define BYTERTC_STATIC_API __attribute__((__visibility__("default"))) +#else +#define BYTERTC_STATIC_API __attribute__((__visibility__("default"))) +#endif +#else +#define BYTERTC_STATIC_API __attribute__((__visibility__("default"))) +#endif + +#include +#include + +namespace bytertc { + + +/** + * + * @hidden currently not available + */ + +enum RtsReturnStatus { + + kRtsReturnStatusSuccess = 0, + + kRtsReturnStatusFailure = -1, + + kRtsReturnStatusParameterErr = -2, + + kRtsReturnStatusWrongState = -3, + + kRtsReturnStatusHasInRoom = -4, + + kRtsReturnStatusHasInLogin = -5, + + kRtsReturnStatusRoomIdInUse = -8, + +}; + +/** + * + * @type keytype + * @brief 用户离开房间的原因。 + */ + +enum UserOfflineReason { + /** + * + * @brief 远端用户调用 `leaveRoom` 方法退出房间。 + */ + + kUserOfflineReasonQuit = 0, + /** + * + * @brief 远端用户因网络等原因掉线。 + */ + + kUserOfflineReasonDropped = 1, + /** + * + * @brief 远端用户切换至隐身状态。 + */ + + kUserOfflineReasonSwitchToInvisible = 2, + /** + * + * @brief 远端用户被踢出房间。
+ * 因调用踢出用户的 OpenAPI,远端用户被踢出房间。 + */ + + kUserOfflineReasonKickedByAdmin = 3, +}; + +/** + * + * @type keytype + * @brief 用户加入房间的类型。 + */ + +enum JoinRoomType { + /** + * + * @brief 首次加入房间。用户手动调用 `joinRoom` 加入房间。 + */ + + kJoinRoomTypeFirst = 0, + /** + * + * @brief 重新加入房间。用户网络较差,失去与服务器的连接,进行重连时收到加入成功。 + */ + + kJoinRoomTypeReconnected = 1, +}; + +/** + * + * @type keytype + * @brief 用户登录的类型 + */ + +enum LoginType { + /** + * + * @brief 首次登录。用户手动调用 `login`,收到登录成功。 + */ + + kLoginTypeFirst = 0, + /** + * + * @brief 重连。用户网络较差,失去与服务器的连接,SDK 自动重连登录成功。 + */ + + kLoginTypeReconnected = 1, +}; + +/** + * + * @type errorcode + * @brief 登录结果
+ * 调用 `login` 登录的结果,会通过 `onLoginResult` 回调通知用户。 + */ + +enum LoginErrorCode { + /** + * + * @brief 调用 `login` 方法登录成功 + */ + + kLoginErrorCodeSuccess = 0, + /** + * + * @brief 调用 `login` 方法时使用的 Token 无效或过期失效,需要用户重新获取 Token。 + */ + + kLoginErrorCodeInvalidToken = -1000, + /** + * + * @brief 登录错误
+ * 调用 `login` 方法时发生未知错误导致登录失败,需要重新登录。 + */ + + kLoginErrorCodeLoginFailed = -1001, + /** + * + * @brief 调用 `login` 方法时传入的用户 ID 有问题。 + */ + + kLoginErrorCodeInvalidUserId = -1002, + /** + * + * @brief 调用 `login` 登录时服务端出错。 + */ + + kLoginErrorCodeServerError = -1003, + /** + * + * @brief 当前为受限模式,禁止 `login` 登录。 + */ + + kLoginErrorCodeLimitedMode = -1004, +}; + +/** + * + * @type keytype + * @brief 用户登出的原因 + */ + +enum LogoutReason { + /** + * + * @brief 用户主动退出
+ * 用户调用 `logout` 接口登出,或者销毁引擎登出。 + */ + + kLogoutReasonLogout = 0, + /** + * + * @brief 用户被动退出
+ * 另一个用户以相同 UserId 进行了 `login`,导致本端用户被踢出。 + */ + + kLogoutReasonDuplicateLogin = 1, +}; + +/** + * + * @type keytype + * @brief 用户在线状态。 + */ + +enum UserOnlineStatus { + /** + * + * @brief 对端用户离线
+ * 对端用户已调用 `logout`,或者没有调用 `login` 进行登录。 + */ + + kUserOnlineStatusOffline = 0, + /** + * + * @brief 对端用户在线
+ * 对端用户调用 `login` 登录,并且连接状态正常。 + */ + + kUserOnlineStatusOnline = 1, + /** + * + * @brief 无法获取对端用户在线状态
+ * 发生级联错误、对端用户在线状态异常时返回。 + */ + + kUserOnlineStatusUnreachable = 2, +}; + +/** + * + * @type keytype + * @brief 服务端消息发送结果回调内容 + */ + +struct ServerACKMsg { + /** + * + * @brief 回调消息长度 + */ + + int length; + /** + * + * @brief 回调消息内容 + */ + + char* ack_msg; +}; + +/** + * + * @type keytype + * @brief 消息类型 + */ + +enum MessageConfig { + /** + * + * @brief 低延时可靠有序消息 + */ + + kMessageConfigReliableOrdered = 0, + /** + * + * @brief 超低延时有序消息 + */ + + kMessageConfigUnreliableOrdered = 1, + /** + * + * @brief 超低延时无序消息 + */ + + kMessageConfigUnreliableUnordered = 2 +}; + +/** + * + * @type errorcode + * @brief 发送消息结果,成功或失败,及失败原因 + */ + +enum UserMessageSendResult { + /** + * + * @brief 发送消息成功。 + */ + + kUserMessageSendResultSuccess = 0, + /** + * + * @brief 消息发送失败。发送超时。 + */ + + kUserMessageSendResultTimeout = 1, + /** + * + * @brief 消息发送失败。连接断开,消息未发出。 + */ + + kUserMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 消息发送失败。找不到接收方。 + */ + + kUserMessageSendResultNoReceiver = 3, + /** + * + * @brief 消息发送失败。远端用户没有登录或进房。 + */ + + kUserMessageSendResultNoRelayPath = 4, + /** + * + * @brief 消息发送失败。超过 QPS 限制。 + */ + + kUserMessageSendResultExceedQPS = 5, + /** + * + * @brief 消息发送失败。应用服务器未收到客户端发送的消息。
+ * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + kUserMessageSendResultE2BSSendFailed = 17, + /** + * + * @brief 消息发送失败。应用服务器接收到了客户端发送的消息,但响应失败。
+ * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + kUserMessageSendResultE2BSReturnFailed = 18, + /** + * + * @brief 消息发送失败。消息发送方没有加入房间。 + */ + + kUserMessageSendResultNotJoin = 100, + /** + * + * @brief 消息发送失败。连接未完成初始化。 + */ + + kUserMessageSendResultInit = 101, + /** + * + * @brief 消息发送失败。没有可用的数据传输通道连接。 + */ + + kUserMessageSendResultNoConnection = 102, + /** + * + * @brief 消息发送失败。消息超过最大长度。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + kUserMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 消息发送失败。接收方用户 ID 为空。 + */ + + kUserMessageSendResultEmptyUser = 104, + /** + * + * @brief 消息发送失败。房间外或应用服务器消息发送方没有登录。 + */ + + kUserMessageSendResultNotLogin = 105, + /** + * + * @brief 消息发送失败。发送消息给业务方服务器之前没有设置参数。 + */ + + kUserMessageSendResultServerParamsNotSet = 106, + /** + * + * @brief 消息发送失败。未知错误。 + */ + + kUserMessageSendResultUnknown = 1000, +}; + +/** + * + * @type keytype + * @brief 房间内广播消息发送结果 + */ + +enum RoomMessageSendResult { + /** + * + * @brief 消息发送成功 + */ + + kRoomMessageSendResultSuccess = 200, + /** + * + * @brief 发送超时,没有发送 + */ + + kRoomMessageSendResultTimeout = 1, + /** + * + * @brief 通道断开,没有发送 + */ + + kRoomMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 超过 QPS 限制 + */ + + kRoomMessageSendResultExceedQPS = 5, + /** + * + * @brief 失败,发送方未加入房间 + */ + + kRoomMessageSendResultNotJoin = 100, + /** + * + * @brief 失败,没有可用的数据传输通道连接 + */ + + kRoomMessageSendResultNoConnection = 102, + /** + * + * @brief 失败。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + kRoomMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 失败,未知错误 + */ + + kRoomMessageSendResultUnknown = 1000, +}; + +/** + * + * @type keytype + * @brief SDK 与信令服务器连接状态。 + */ + +enum ConnectionState { + /** + * + * @brief 连接断开超过 12s,此时 SDK 会尝试自动重连。 + */ + + kConnectionStateDisconnected = 1, + /** + * + * @brief 首次请求建立连接,正在连接中。 + */ + + kConnectionStateConnecting = 2, + /** + * + * @brief 首次连接成功。 + */ + + kConnectionStateConnected = 3, + /** + * + * @brief 涵盖了以下情况:
+ * - 首次连接时,10 秒连接不成功; + * - 连接成功后,断连 10 秒。自动重连中。 + */ + + kConnectionStateReconnecting = 4, + /** + * + * @brief 连接断开后,重连成功。 + */ + + kConnectionStateReconnected = 5, + /** + * + * @brief 处于 `kConnectionStateDisconnected` 状态超过 10 秒,且期间重连未成功。SDK 仍将继续尝试重连。 + */ + + kConnectionStateLost = 6, + /** + * + * @brief 连接失败,服务端状态异常。SDK 不会自动重连,请重新进房,或联系技术支持。 + */ + + kConnectionStateFailed = 7, +}; + +/** + * + * @type keytype + * @brief 媒体流网络质量。 + */ + +enum NetworkQuality { + /** + * + * @brief 网络质量未知。 + */ + + kNetworkQualityUnknown = 0, + /** + * + * @brief 网络质量极好。 + */ + + kNetworkQualityExcellent, + /** + * + * @brief 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。 + */ + + kNetworkQualityGood, + /** + * + * @brief 主观感受有瑕疵但不影响沟通。 + */ + + kNetworkQualityPoor, + /** + * + * @brief 勉强能沟通但不顺畅。 + */ + + kNetworkQualityBad, + /** + * + * @brief 网络质量非常差,基本不能沟通。 + */ + + kNetworkQualityVbad, + /** + * + * @brief 网络连接断开,无法通话。网络可能由于 12s 内无应答、开启飞行模式、拔掉网线等原因断开。
+ * 更多网络状态信息参见 [连接状态提示](https: + */ + + kNetworkQualityDown, +}; + +/** + * + * @type keytype + * @brief SDK 网络连接类型。 + */ + +enum NetworkType { + /** + * + * @brief 网络连接类型未知。 + */ + + kNetworkTypeUnknown = -1, + /** + * + * @brief 网络连接已断开。 + */ + + kNetworkTypeDisconnected = 0, + /** + * + * @brief 网络连接类型为 LAN 。 + */ + + kNetworkTypeLAN = 1, + /** + * + * @brief 网络连接类型为 Wi-Fi(包含热点)。 + */ + + kNetworkTypeWIFI = 2, + /** + * + * @brief 网络连接类型为 2G 移动网络。 + */ + + kNetworkTypeMobile2G = 3, + /** + * + * @brief 网络连接类型为 3G 移动网络。 + */ + + kNetworkTypeMobile3G = 4, + /** + * + * @brief 网络连接类型为 4G 移动网络。 + */ + + kNetworkTypeMobile4G = 5, + /** + * + * @brief 网络连接类型为 5G 移动网络。 + */ + + kNetworkTypeMobile5G = 6, +}; + +/** + * + * @type errorcode + * @brief 回调错误码。 + */ + +enum RtsErrorCode { + /** + * + * @brief Token 无效。
+ * 进房时使用的 Token 无效或过期失效。需要用户重新获取 Token,并调用 `updateToken` 方法更新 Token。 + */ + + kRtsErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。
+ * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + kRtsErrorCodeJoinRoom = -1001, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间 + */ + + kRtsErrorCodeDuplicateLogin = -1004, + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间 + */ + + kRtsErrorCodeKickedOut = -1006, + /** + * + * @brief 当调用 `createRTCRoom` ,如果 roomid 非法,会返回 null,并抛出该 error + */ + + kRtsRoomErrorCodeRoomIdIllegal = -1007, + /** + * + * @brief Token 过期。调用 `joinRoom` 使用新的 Token 重新加入房间。 + */ + + kRtsRoomErrorTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken` 传入的 Token 无效 + */ + + kRtsRoomErrorUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。 + */ + + kRtsErrorCodeRoomDismiss = -1011, + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了 + */ + + kRtsErrorCodeRoomAlreadyExist = -1013, + /** + * + * @brief 同一个引擎实例在进入多个房间时设置的用户名必须相同 + */ + + kRtsErrorCodeUserIDDifferent = -1014, + /** + * + * @brief 服务端异常状态导致退出房间。
+ * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + kRtsErrorCodeAbnormalServerStatus = -1084, + /** + * + * @hidden for internal use only + */ + + kRtsErrorCodeInternalDeadLockNotify = -1111, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
+ * 进房时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + kRtsErrorCodeJoinRoomWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @brief 加入RTS房间错误。当前为受限模式。 + */ + + kRtsErrorCodeJoinRoomLimitedMode = -1013, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
+ * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅起通知作用。 + */ + +enum RtsWarningCode { + /** + * + * @brief 进房失败。
+ * 当你调用初次加入房间或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + kRtsWarningCodeJoinRoomFailed = -2001, + /** + * + * @brief 发布音视频流失败。
+ * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + kRtsWarningCodePublishStreamFailed = -2002, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误。 + */ + + kRtsWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + kRtsWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + kRtsWarningCodeSendCustomMessage = -2011, + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `onUserJoined` 和 `onUserLeave` 回调,并通过广播提示房间内所有用户。 + */ + + kRtsWarningCodeUserNotifyStop = -2013, + + + /** + * + * @brief 新生成的房间已经替换了同样 roomId 的旧房间 + */ + + kRtsWarningCodeOldRoomBeenReplaced = -2016 +}; + +/** + * + * @hidden + * @deprecated since 3.50 + * @type keytype + * @brief 事务检查码
+ * 用户调用 `setBusinessId` 方法设置业务标识参数的返回错误码。 + */ + +enum BusinessCheckCode { + /** + * + * @brief 用户已经在房间中。
+ * 业务标识需要在加入房间之前设置,加入后设置无效。 + */ + + kBusinessCheckCodeAlreadyInRoom = -6001, + + /** + * + * @brief 输入参数非法。
+ * 用户传入的业务标识参数非法,参数合法性参考 `setBusinessId` 方法的参数说明。 + */ + + kBusinessCheckCodeInputInvalidate = -6002, +}; + +/** + * + * @type keytype + * @brief App 使用的 CPU 和内存信息。
+ * 该信息由 SDK 周期性(2s)通过 `onSysStats` 回调通知给用户。 + */ + +struct SysStats { + /** + * + * @brief 当前系统 CPU 核数。 + */ + + unsigned int cpu_cores; + /** + * + * @brief 当前应用的 CPU 使用率,取值范围为 [0, 1]。 + */ + + double cpu_app_usage; + /** + * + * @hidden currently not available + * @brief 当前系统的 cpu 使用率,取值范围为 [0, 1]。 + */ + + double cpu_total_usage; + /** + * + * @brief 当前应用的内存使用量(单位 MB)。 + */ + + double memory_usage; + /** + * + * @brief 全量内存(单位 MB)。 + */ + + unsigned long long full_memory; + /** + * + * @brief 系统已使用内存(单位 MB)。 + */ + + unsigned long long total_memory_usage; + /** + * + * @brief 空闲可分配内存(单位 MB)。 + */ + + unsigned long long free_memory; + /** + * + * @brief 当前应用的内存使用率(单位 %)。 + */ + + double memory_ratio; + /** + * + * @brief 系统内存使用率(单位 %)。 + */ + + double total_memory_ratio; +}; + +/** + * + * @type keytype + * @brief HTTP/HTTPS 代理状态 + */ + +enum HttpProxyState { + /** + * + * @brief HTTP/HTTPS 初始化状态 + */ + + kHttpProxyStateInit, + /** + * + * @brief HTTP/HTTPS 连接成功 + */ + + kHttpProxyStateConnected, + /** + * + * @brief HTTP/HTTPS 连接失败 + */ + + kHttpProxyStateError +}; + +/** + * + * @type keytype + * @brief SOCKS5 代理连接状态 + */ + +enum Socks5ProxyState { + /** + * + * @brief SOCKS5 连接初始化 + */ + + kSocks5Init, + /** + * + * @brief SOCKS5 连接成功 + */ + + kSocks5Connected, + /** + * + * @brief SOCKS5 连接错误 + */ + + kSocks5Error, + /** + * + * @brief TCP 连接失败 + */ + + kSocks5TcpConnectFail, + /** + * + * @brief TCP 连接关闭 + */ + + kSocks5TcpClose, + /** + * + * @brief SOCKS 协议 TCP 协商阶段失败 + */ + + kSocks5ProtocolTcpFail, + /** + * + * @brief UDP 连接失败 + */ + + kSocks5ProtocolUdpFail, + /** + * + * @brief 授权失败 + */ + + kSocks5AuthFail, + /** + * + * @brief 未知状态 + */ + + kSocks5Unknown +}; + +/** + * + * @type keytype + * @brief 云代理信息 + */ + +struct CloudProxyInfo { + /** + * + * @type keytype + * @brief 云代理服务器 IP + */ + + const char* cloud_proxy_ip; + /** + * + * @type keytype + * @brief 云代理服务器端口 + */ + + int cloud_proxy_port; +}; + +/** + * + * @type keytype + * @brief 云代理相关信息 + */ + +struct CloudProxyConfiguration { + /** + * + * @brief 云代理信息。 + */ + + CloudProxyInfo* cloud_proxies = nullptr; + /** + * + * @brief 云代理数量。 + */ + + int cloud_proxy_count = 0; +}; + +/** + * + * @type keytype + * @brief ID 最大长度 + */ + +const unsigned int MAX_DEVICE_ID_LENGTH = 512; + +/** + * + * @type keytype + * @brief 本地代理的类型。 + */ + +enum LocalProxyType { + /** + * + * @brief Socks5 代理。选用此代理服务器,需满足 Socks5 协议标准文档的要求。 + */ + + kLocalProxyTypeSocks5 = 1, + /** + * + * @brief Http 隧道代理。 + */ + + kLocalProxyTypeHttpTunnel = 2 +}; + +/** + * + * @type keytype + * @brief 本地代理配置详细信息。 + */ + +struct LocalProxyConfiguration { + /** + * + * @brief 本地代理类型,参看 LocalProxyType{@link #LocalProxyType}。 + */ + + LocalProxyType local_proxy_type; + /** + * + * @type keytype + * @brief 本地代理服务器 IP。 + */ + + const char* local_proxy_ip; + /** + * + * @type keytype + * @brief 本地代理服务器端口。 + */ + + int local_proxy_port; + /** + * + * @type keytype + * @brief 本地代理用户名。 + */ + + const char* local_proxy_username; + /** + * + * @type keytype + * @brief 本地代理密码。 + */ + + const char* local_proxy_password; +}; + +/** + * + * @type keytype + * @brief 本地代理连接状态。 + */ + +enum LocalProxyState { + /** + * + * @brief TCP 代理服务器连接成功。 + */ + + kLocalProxyStateInited = 0, + + /** + * + * @brief 本地代理连接成功。 + */ + + kLocalProxyStateConnected = 1, + + /** + * + * @brief 本地代理连接出现错误。 + */ + + kLocalProxyStateError = 2, +}; + +/** + * + * @type keytype + * @brief 本地代理错误。 + */ + +enum LocalProxyError { + /** + * + * @brief 本地代理服务器无错误。 + */ + + kLocalProxyErrorOK = 0, + + /** + * + * @brief 代理服务器回复的版本号不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5VersionError = 1, + + /** + * + * @brief 代理服务器回复的格式错误不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5FormatError = 2, + + /** + * + * @brief 代理服务器回复的字段值不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5InvalidValue = 3, + + /** + * + * @brief 未提供代理服务器的用户名及密码,导致 Socks5 代理连接失败。请重新调用 `setLocalProxy`,在设置本地代理时填入用户名和密码。 + */ + + kLocalProxyErrorSocks5UserPassNotGiven = 4, + + /** + * + * @brief TCP 关闭,导致 Socks5 代理连接失败。请检查网络或者代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5TcpClosed = 5, + + /** + * + * @brief Http 隧道代理错误。请检查 Http 隧道代理服务器或者网络是否存在异常。 + */ + + kLocalProxyErrorHttpTunnelFailed = 6, +}; + +/** + * + * @type keytype + * @brief 本地日志输出等级。 + */ + +enum class LocalLogLevel { + /** + * + * @brief 信息级别。 + */ + + kInfo = 0, + /** + * + * @brief (默认值)警告级别。 + */ + + kWarning = 1, + /** + * + * @brief 错误级别。 + */ + + kError = 2, + /** + * + * @brief 关闭日志。 + */ + + kNone = 3 +}; + +/** + * + * @type keytype + * @brief 本地日志参数。 + */ + +struct LogConfig { + /** + * + * @brief 日志存储路径,必填。 + */ + + const char* log_path = nullptr; + /** + * + * @brief 日志等级,参看 LocalLogLevel{@link #LocalLogLevel},默认为警告级别,选填。 + */ + + LocalLogLevel log_level = LocalLogLevel::kWarning; + + /** + * + * @brief 日志文件最大占用的总空间,单位为 MB,选填。取值范围为 1~100 MB,默认值为 10 MB。
+ * 若 `log_file_size` < 1,取 1 MB。若 `log_file_size` > 100,取 100 MB。
+ * 其中,单个日志文件最大为 2 MB:
+ *
  • 若 1 ≤ log_file_size ≤ 2,则会生成一个日志文件。
  • 若 log_file_size > 2,假设 log_file_size/2 的整数部分为 N,则前 N 个文件,每个文件会写满 2 MB,第 N+1 个文件大小不超过 log_file_size mod 2,否则会删除最老的文件,以此类推。
+ */ + + uint32_t log_file_size = 10; + + /** + * + * @brief 日志文件名前缀,选填。该字符串必须符合正则表达式:[a-zA-Z0-9_@\-\.]{1,128}。
+ * 最终的日志文件名为`前缀 + "_" + 文件创建时间 + "_rtclog".log`,如 `logPrefix_2023-05-25_172324_rtclog.log`。 + */ + + const char* log_filename_prefix = nullptr; +}; + +/** + * + * @type keytype + * @brief 创建引擎参数 + */ + +struct EngineConfig { + /** + * + * @brief 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 + */ + + const char* app_id = nullptr; + + /** + * + * @brief 如需使用请联系技术支持人员。 + */ + + const char* parameters = nullptr; + + /** + * + * @brief 自定义插件动态库加载目录,目前仅 Android 平台支持。 + */ + + const char* native_load_path = nullptr; + + /** + * + * @brief 用于存储 Android 应用程序的上下文(Application Context),仅 Android 平台支持。 + */ + + void* j_application_context = nullptr; + /** + * + * @brief 选填,是否为游戏场景。默认值为 `false`。 + */ + + bool is_game_scene = false; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_sing_scoring_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_sing_scoring_interface.h new file mode 100644 index 0000000..56fb9ad --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_sing_scoring_interface.h @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC SAMI SDK +*/ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @type callback + * @brief K 歌评分事件回调类。
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +class ISingScoringEventHandler { +public: + /** + * + * @type callback + * @brief 实时评分信息回调。调用 startSingScoring{@link #ISingScoringManager#startSingScoring} 后,会收到该回调。 + * @param info 实时评分信息。 + * @list 在线 KTV + */ + + virtual void onCurrentScoringInfo( + const SingScoringRealtimeInfo& info) = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~ISingScoringEventHandler() { + } +}; +/** + * + * @hidden(Linux) + * @type api + * @brief 标准音高数据数组。 + * @list Online Karaoke + */ + +class IStandardPitchCollection { +public: + /** + * + * @type api + * @brief 获取歌词句子总数 + * @list 在线 KTV + */ + + virtual int getCount() = 0; + /** + * + * @type api + * @brief 获取每句歌词的标准音高信息 + * @param index 歌词句子数,取值范围为 0 到调用 getCount{@link #IStandardPitchCollection#getCount} 获取到的句子总数减 1。 + * @return 标准音高数据,参看 StandardPitchInfo{@link #StandardPitchInfo}。 + * @list 在线 KTV + */ + + virtual StandardPitchInfo getStandardPitchInfo(int index) = 0; + /** + * + * @type api + * @brief 销毁 IStandardPitchCollection 类,释放资源 + * @list 在线 KTV + */ + + virtual void release() = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IStandardPitchCollection() { + } +}; +/** + * + * @hidden(Linux) + * @type api + * @brief K 歌评分管理接口。 + * @list Online Karaoke + */ + +class ISingScoringManager { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + ISingScoringManager() { + } + /** + * + * @type api + * @brief 初始化 K 歌评分。 + * @param sing_scoring_appkey K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param sing_scoring_token K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param handler K 歌评分事件回调类,详见 ISingScoringEventHandler{@link #ISingScoringEventHandler}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note 输入正确的鉴权信息才可以使用 K 歌评分相关的功能,鉴权方式为离线鉴权,根据包名(bundleID)绑定 Appkey 及 Token,K 歌评分密钥请联系技术支持人员申请。 + * @list 在线 KTV + */ + + virtual int initSingScoring( + const char* sing_scoring_appkey, + const char* sing_scoring_token, + ISingScoringEventHandler* handler) = 0; + /** + * + * @type api + * @brief 设置 K 歌评分参数。 + * @param config K 歌评分的各项参数,详见 SingScoringConfig{@link #SingScoringConfig}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @list 在线 KTV + */ + + virtual int setSingScoringConfig( + const SingScoringConfig& config) = 0; + /** + * + * @type api + * @brief 获取标准音高数据。 + * @param midi_filepath 歌曲 midi 文件路径。 + * @return IStandardPitchCollection{@link #IStandardPitchCollection} 标准音高数据数组。 + * @note 请保证此接口传入的 midi 文件路径与 setSingScoringConfig{@link #ISingScoringManager#setSingScoringConfig} 接口中传入的路径一致。 + * @list 在线 KTV + */ + + virtual IStandardPitchCollection* getStandardPitchInfoCollection(const char* midi_filepath) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开始 K 歌评分。 + * @param position 开始评分时,音乐的播放进度,单位:ms。 + * @param scoring_info_interval 实时回调的时间间隔,单位:ms;默认 50 ms。最低间隔为 20 ms。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note + * - 在调用 initSingScoring{@link #ISingScoringManager#initSingScoring} 初始化 K 歌评分功能后调用该接口。 + * - 调用该接口后,将会根据设置的回调时间间隔,收到评分结果 onCurrentScoringInfo{@link #ISingScoringEventHandler#onCurrentScoringInfo} 回调。 + * - 如果使用 `IMediaPlayer` 播放伴奏,请在收到 onMediaPlayerStateChanged{@link #IMediaPlayerEventHandler#onMediaPlayerStateChanged} 回调且播放状态为 kPlayerStatePlaying{@link #PlayerState#kPlayerStatePlaying} 后,调用此接口。 + * @list 在线 KTV + */ + + virtual int startSingScoring(int position, + int scoring_info_interval) = 0; + /** + * + * @type api + * @brief 停止 K 歌评分。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 在线 KTV + */ + + virtual int stopSingScoring() = 0; + /** + * + * @type api + * @brief 获取上一句的演唱评分。调用 startSingScoring{@link #ISingScoringManager#startSingScoring} 开始评分后可以调用该接口。 + * @return + * - <0:获取评分失败。 + * - >=0:上一句歌词的演唱评分。 + * @list 在线 KTV + */ + + virtual int getLastSentenceScore() = 0; + /** + * + * @type api + * @brief 获取当前演唱总分。调用 startSingScoring{@link #ISingScoringManager#startSingScoring} 开始评分后可以调用该接口。 + * @return + * - <0:获取总分失败。 + * - >=0:当前演唱总分。 + * @list 在线 KTV + */ + + virtual int getTotalScore() = 0; + /** + * + * @type api + * @brief 获取当前演唱歌曲的平均分。 + * @return + * - <0:获取平均分失败。 + * - >=0:当前演唱平均分。 + * @list 在线 KTV + */ + + virtual int getAverageScore() = 0; + /** + * + * @hidden constructor/destructor + */ + + virtual ~ISingScoringManager() { + } +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_spatial_audio_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_spatial_audio_interface.h new file mode 100644 index 0000000..12c9565 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_spatial_audio_interface.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief spatial audio interface + */ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 用户在空间音频坐标系里的位置信息。 + */ + +struct PositionInfo { + /** + * + * @brief 用户在空间音频坐标系里的位置,需自行建立空间直角坐标系。参看 Position{@link #Position} + */ + + Position position; + /** + * + * @brief 用户在空间音频坐标系里的三维朝向信息。三个向量需要两两垂直。参看 HumanOrientation{@link #HumanOrientation}。 + */ + + HumanOrientation orientation; +}; +/** + * + * @hidden(Linux) + * @type api + * @brief 空间音频接口实例 + * @list + */ + +class ISpatialAudio { +public: + /** + * + * @type api + * @brief 开启/关闭空间音频功能。 + * @param enable 是否开启空间音频功能:
+ * - true:开启 + * - false:关闭(默认) + * @note 该方法仅开启空间音频功能,你须调用 updateSelfPosition{@link #ISpatialAudio#updateSelfPosition} 设置自身位置坐标后方可收听空间音频效果。空间音频相关 API 和调用时序详见[空间音频](https.www.volcengine.com/docs/6348/93903)。 + * @list 高级功能 + */ + + virtual void enableSpatialAudio(bool enable) = 0; + /** + * + * @type api + * @brief 关闭本地用户朝向对本地用户发声效果的影响。
+ * 调用此接口后,房间内的其他用户收听本地发声时,声源都在收听者正面。 + * @note + * - 调用本接口关闭朝向功能后,在当前的空间音频实例的生命周期内无法再次开启。 + * - 调用此接口不影响本地用户收听朝向的音频效果。要改变本地用户收听朝向,参看 updateSelfPosition{@link #ISpatialAudio#updateSelfPosition} 和 updateRemotePosition{@link #ISpatialAudio#updateRemotePosition} 。 + * @list 高级功能 + */ + + virtual void disableRemoteOrientation() = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 设置本地用户在自建空间直角坐标系中的收听坐标和收听朝向,以实现本地用户预期的空间音频收听效果。 + * @param position_info 空间音频位置信息。参看 PositionInfo{@link #PositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验本地用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * - 该方法需在进房后调用。 + * - 调用该接口更新坐标前,你需调用 enableSpatialAudio{@link #ISpatialAudio#enableSpatialAudio} 开启空间音频功能。空间音频相关 API 和调用时序详见[空间音频](https: + * - 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 高级功能 + */ + + virtual int updateSelfPosition(const PositionInfo& position_info) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 设置房间内某一远端用户在本地用户自建的空间音频坐标系中的发声位置和发声朝向,以实现本地用户预期的空间音频收听效果。 + * @param uid 用户 ID + * @param position_info 远端用户的空间音频位置信息。参看 PositionInfo{@link #PositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验远端用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * - 该方法需在创建房间后调用。 + * - 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 高级功能 + */ + + virtual int updateRemotePosition(const char* uid, const PositionInfo& position_info) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition{@link #ISpatialAudio#updateRemotePosition} 为某一远端用户设置的空间音频效果。 + * @param uid 远端用户 ID。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + + virtual int removeRemotePosition(const char* uid) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition{@link #ISpatialAudio#updateRemotePosition} 为所有远端用户设置的空间音频效果。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + + virtual int removeAllRemotePosition() = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~ISpatialAudio() = default; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_transcoder_define.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_transcoder_define.h new file mode 100644 index 0000000..2db9b29 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_transcoder_define.h @@ -0,0 +1,1990 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + */ + +#pragma once +#include "bytertc_video_frame.h" +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 转推任务事件 + */ + +enum MixedStreamTaskEvent { + /** + * + * @hidden for internal use only + */ + + kMixedStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + kMixedStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + kMixedStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务更新成功。 + */ + + kMixedStreamTaskEventUpdateSuccess = 3, + /** + * + * @brief 任务更新失败。 + */ + + kMixedStreamTaskEventUpdateFailed = 4, + /** + * + * @brief 任务停止。 + */ + + kMixedStreamTaskEventStopSuccess = 5, + /** + * + * @brief 结束任务失败。 + */ + + kMixedStreamTaskEventStopFailed = 6, + /** + * + * @brief Warning 事件 + */ + + kMixedStreamTaskEventWarning = 7, +}; + + +/** + * + * @type errorcode + * @brief 单流转推直播事件 + */ + +enum SingleStreamTaskEvent { + /** + * + * @hidden for internal use only + */ + + kSingleStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + kSingleStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + kSingleStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务停止。 + */ + + kSingleStreamTaskEventStopSuccess = 3, + /** + * + * @brief 结束任务失败。 + */ + + kSingleStreamTaskEventStopFailed = 4, + /** + * + * @brief Warning 事件 + */ + + kSingleStreamTaskEventWarning = 5, +}; + +/** + * + * @type errorcode + * @brief 合流和 WTN 流任务错误码 + */ + +enum MixedStreamTaskErrorCode { + /** + * + * @brief 推流成功。 + */ + + kMixedStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + kMixedStreamTaskErrorCodeBase= 1090, + /** + * + * @brief 任务处理超时,请检查网络状态并重试。 + */ + + kMixedStreamTaskErrorCodeTimeout = 1091, + /** + * + * @brief 服务端检测到错误的推流参数。 + */ + + kMixedStreamTaskErrorCodeInvalidParamByServer = 1092, + /** + * + * @brief 对流的订阅超时 + */ + + kMixedStreamTaskErrorCodeSubTimeoutByServer = 1093, + /** + * + * @brief 合流服务端内部错误。 + */ + + kMixedStreamTaskErrorCodeInvalidStateByServer = 1094, + /** + * + * @brief 合流服务端推 CDN 失败。 + */ + + kMixedStreamTaskErrorCodeAuthenticationByCDN = 1095, + /** + * + * @brief 服务端未知错误。 + */ + + kMixedStreamTaskErrorCodeUnKnownByServer = 1096, + /** + * + * @brief 服务端接收信令超时,请检查网络状态并重试。 + */ + + kMixedStreamTaskErrorCodeSignalRequestTimeout = 1097, + /** + * + * @brief 图片合流失败。 + */ + + kMixedStreamTaskErrorCodeMixImageFailed = 1098, + /** + * + * @hidden internal use only + * @brief 缓存未同步。 + */ + + kMixedStreamTaskErrorCodeStreamSyncWorse = 1099, + /** + * + * @brief 发布 WTN 流失败 + */ + + kMixedStreamTaskErrorCodePushWTNFailed = 1195, + /** + * + * @hidden for internal use only + */ + + kMixedStreamTaskErrorCodeMax = 1199, +}; + +/** + * + * @type errorcode + * @brief 单流转推任务错误码 + */ + +enum SingleStreamTaskErrorCode { + /** + * + * @brief 推流成功。 + */ + + kSingleStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + kSingleStreamTaskErrorCodeBase= 1090, + /** + * + * @brief 服务端未知错误。 + */ + + kSingleStreamTaskErrorCodeUnKnownByServer = 1091, + /** + * + * @brief 任务处理超时,请检查网络状态并重试。 + */ + + kSingleStreamTaskErrorCodeSignalRequestTimeout = 1092, + /** + * + * @brief 服务端检测任务参数不合法 + */ + + kSingleStreamTaskErrorCodeInvalidParamByServer = 1093, + /** + * + * @brief 转推任务在目标房间的用户ID被踢出目标房间 + */ + + kSingleStreamTaskErrorRemoteKicked = 1094, + /** + * + * @brief 转推任务加入目标房间失败 + */ + + kSingleStreamTaskErrorCodeJoinDestRoomFailed = 1095, + /** + * + * @brief 转推任务在源房间拉流超时 + */ + + kSingleStreamTaskErrorCodeReceiveSrcStreamTimeout = 1096, + /** + * + * @brief 音视频编码转推任务不支持 + */ + + kSingleStreamTaskErrorCodeNotSurportCodec = 1097, + /** + * + * @brief 推CDN失败 + */ + + kSingleStreamTaskErrorCodePushToCDN = 1098, + /** + * + * @brief 超过单流转推的任务数限制(单主播可同时转推任务数不超过20) + */ + + kSingleStreamTaskErrorCodeCountOverLimit = 1099, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 合流类型。 + */ + +enum MixedStreamType { + /** + * + * @brief 服务端合流 + */ + + kMixedStreamTypeByServer = 0, + /** + * + * @brief 端云一体合流。SDK 智能决策在客户端或服务端完成合流。
+ * 使用前,请联系技术支持同学开通,否则不生效。 + */ + + kMixedStreamTypeByClient = 1, +}; + +/** + * + * @type keytype + * @brief 合流推送目标类型,指定混流后的媒体流推送到 CDN 还是 WTN。 + */ + +enum MixedStreamPushTargetType { + /** + * + * @brief 推送到 CDN + */ + + kMixedStreamPushTargetTypeToCDN = 0, + /** + * + * @brief 推送到 WTN + */ + + kMixedStreamPushTargetTypeToWTN = 1, +}; + +/** + * + * @type keytype + * @brief AAC 编码规格。 + */ + +enum MixedStreamAudioProfile { + /** + * + * @brief AAC-LC 规格,默认值。 + */ + + kMixedStreamAudioProfileLC = 0, + /** + * + * @brief HE-AAC v1 规格。 + */ + + kMixedStreamAudioProfileHEv1 = 1, + /** + * + * @brief HE-AAC v2 规格。 + */ + + kMixedStreamAudioProfileHEv2 = 2, +}; + +/** + * + * @hidden + * @brief 遗漏的音符 + */ + +enum MixedStreamSyncStrategy { + /** + * + * @brief 不使用同步策略 + */ + + kMixedStreamSyncStrategyNoSync = 0, + /** + * + * @brief 使用音频精准同步策略 + */ + + kMixedStreamSyncStrategyAudioPreciseSync = 1, + /** + * + * @brief 使用单通模式同步策略 + */ + + kMixedStreamSyncStrategySimplexModeSync = 2, +}; + +/** + * + * @type keytype + * @brief 音频编码格式。 + */ + +enum MixedStreamAudioCodecType { + /** + * + * @brief AAC 格式。 + */ + + kMixedStreamAudioCodecTypeAAC = 0, +}; + +/** + * + * @type keytype + * @brief 服务端合流转推 SEI 内容。 + */ + +enum MixedStreamSEIContentMode { + /** + * + * @brief 视频流中包含全部的 SEI 信息。默认设置。 + */ + + kMixedStreamSEIContentModeDefault = 0, + /** + * + * @brief 随非关键帧传输的 SEI 数据中仅包含音量信息。
+ * 当设置 `MixedStreamControlConfig.enable_volume_indication` 为 True 时,此参数设置生效。 + */ + + kMixedStreamSEIContentModeEnableVolumeIndication = 1, +}; + +/** + * + * @type keytype + * @brief 视频编码格式。 + */ + +enum MixedStreamVideoCodecType { + /** + * + * @brief H.264 格式,默认值。 + */ + + kMixedStreamVideoCodecTypeH264 = 0, + /** + * + * @brief ByteVC1 格式。 + */ + + kMixedStreamVideoCodecTypeByteVC1 = 1, +}; + +/** + * + * @type keytype + * @brief 图片或视频流的缩放模式。 + */ + +enum MixedStreamRenderMode { + /** + * + * @brief 视窗填满优先,默认值。
+ * 视频尺寸等比缩放,直至视窗被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。 + */ + + kMixedStreamRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
+ * 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 + */ + + kMixedStreamRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
+ * 视频尺寸非等比例缩放,把窗口充满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + kMixedStreamRenderModeAdaptive = 3, +}; + +/** + * + * @type keytype + * @brief 合流输出媒体类型。 + */ + +enum MixedStreamMediaType { + /** + * + * @brief 包含音频和视频 + */ + + kMixedStreamMediaTypeAudioAndVideo = 0, + /** + * + * @brief 只包含音频 + */ + + kMixedStreamMediaTypeAudioOnly = 1, + /** + * + * @hidden currently not available + * @brief 只包含视频 + */ + + kMixedStreamMediaTypeVideoOnly = 2, +}; + +/** + * + * @type keytype + * @brief 合流布局区域类型,视频区或水印图片区。 + */ + +enum MixedStreamLayoutRegionType { + /** + * + * @brief 视频。 + */ + + kMixedStreamLayoutRegionTypeVideoStream = 0, + /** + * + * @brief 水印图片。 + */ + + kMixedStreamLayoutRegionTypeImage = 1, +}; + +/** + * + * @type keytype + * @hidden for internal use only on Windows + * @brief 客户端合流回调视频格式。
+ * 设置为系统不支持的格式时,自动回调系统默认格式。 + */ + +enum MixedStreamClientMixVideoFormat { + /** + * + * @brief YUV I420。Android、Windows 默认回调格式。支持系统:Android、Windows。 + */ + + kMixedStreamClientMixVideoFormatI420 = 0, + /** + * + * @brief OpenGL GL_TEXTURE_2D 格式纹理。支持系统:安卓。 + */ + + kMixedStreamClientMixVideoFormatTexture2D = 1, + /** + * + * @brief CVPixelBuffer BGRA。iOS 默认回调格式。支持系统: iOS。 + */ + + kMixedStreamClientMixVideoFormatCVPixelBufferBGRA = 2, + /** + * + * @brief YUV NV12。macOS 默认回调格式。支持系统: macOS。 + */ + + kMixedStreamClientMixVideoFormatNV12 = 3, + /** + * + * @brief D3D11Texture2D, BGRA。支持系统: windows。 + */ + + kMixedStreamClientMixVideoFormatD3D11Texture2D = 4, +}; +/** + * + * @type keytype + * @brief 服务端合流转推发起模式。 + */ + +enum MixedStreamPushMode { + /** + * + * @brief 无用户发布媒体流时,发起合流任务无效。默认设置。
+ * 当有用户发布媒体流时,才能发起合流任务。 + */ + + kMixedStreamPushModeOnStream = 0, + /** + * + * @brief 无用户发布媒体流时,可以使用占位图发起合流任务。
+ * 占位图设置参看 alternate_image_url{@link #MixedStreamLayoutRegionConfig-alternate_image_url} 和 alternate_image_fill_mode{@link #MixedStreamLayoutRegionConfig-alternate_image_fill_mode} + */ + + kMixedStreamPushModeOnStartRequest = 1, +}; +/** + * + * @type keytype + * @brief 服务端合流占位图填充模式。 + */ + +enum MixedStreamAlternateImageFillMode { + /** + * + * @brief 占位图跟随用户原始视频帧相同的比例缩放。默认设置。 + */ + + kMixedStreamAlternateImageFillModeFit = 0, + /** + * + * @brief 占位图不跟随用户原始视频帧相同的比例缩放,保持图片原有比例。 + */ + + kMixedStreamAlternateImageFillModeFill = 1, +}; +/** + * + * @type keytype + * @brief 预留字段。 + */ + +enum MixedStreamVideoType { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
+ * - 由摄像头/麦克风通过内部采集机制,采集到的流 + * - 通过自定义采集,采集到的流。 + */ + + kMixedStreamVideoTypeMain = 0, + /** + * + * @hidden for internal use only + * @brief 屏幕流。 + */ + + kMixedStreamVideoTypeScreen = 1, +}; + +/** + * + * @type keytype + * @brief WTN 流任务详情
+ * + */ + +typedef struct MixedStreamTaskInfo { + /** + * + * @brief 任务 ID
+ * 对于 WTN 流任务,该值代表 WTN 流 ID。你可以通过该 ID,指定需要订阅的 WTN 流。 + */ + + const char* task_id; + /** + * + * @brief 任务类型,合流转推 CDN 还是 WTN 流。 + */ + + MixedStreamPushTargetType push_target_type; +} MixedStreamInfo; + +/** + * + * @type keytype + * @brief 音频合流参数。
+ * 值不合法或未设置时,自动使用默认值。 + */ + +typedef struct MixedStreamAudioConfig { + /** + * + * @brief 音频采样率,单位 Hz。可取 32000 Hz、44100 Hz、48000 Hz,默认值为 48000 Hz。建议设置。 + */ + + int32_t sample_rate = 48000; + /** + * + * @brief 音频声道数。可取 1(单声道)、2(双声道),默认值为 2。建议设置。 + */ + + int32_t channels = 2; + /** + * + * @brief 音频码率,单位 Kbps。可取范围 [32, 192],默认值为 64 Kbps。建议设置。 + */ + + int32_t bitrate = 64; + /** + * + * @brief AAC 编码规格,参看 MixedStreamAudioProfile{@link #MixedStreamAudioProfile}。默认值为 `0` 代表 AAC-LC。 + */ + + MixedStreamAudioProfile audio_profile = MixedStreamAudioProfile::kMixedStreamAudioProfileLC; + /** + * + * @brief 音频编码格式,参看 MixedStreamAudioCodecType{@link #MixedStreamAudioCodecType}。当前只有一个值为 `0`,代表 AAC。
+ * WTN 流任务不支持设置本参数。 + */ + + MixedStreamAudioCodecType audio_codec = MixedStreamAudioCodecType::kMixedStreamAudioCodecTypeAAC; +} MixedStreamAudioConfig; + +#define MIXED_STREAM_VIDEO_DEFAULT_WIDTH 360 +#define MIXED_STREAM_DEFAULT_VIDEO_HEIGHT 640 +/** + * + * @type keytype + * @brief 视频合流配置参数。
+ * 值不合法或未设置时,自动使用默认值。 + */ + +typedef struct MixedStreamVideoConfig { + /** + * + * @brief 合流视频宽度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 360 px。建议设置。
+ * 设置值为非偶数时,自动向上取偶数。 + */ + + int32_t width = MIXED_STREAM_VIDEO_DEFAULT_WIDTH; + /** + * + * @brief 合流视频高度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 640 px。建议设置。
+ * 设置值为非偶数时,自动向上取偶数。 + */ + + int32_t height = MIXED_STREAM_DEFAULT_VIDEO_HEIGHT; + /** + * + * @brief 合流视频帧率。单位为 FPS,取值范围为 [1,60],默认值为 15 FPS。建议设置。 + */ + + int32_t fps = 15; + /** + * + * @brief 视频 I 帧时间间隔。单位为秒,取值范围为 [1, 5],默认值为 2 秒。建议设置。
+ * WTN 流任务不支持设置本参数。
+ * 本参数不支持过程中更新。 + */ + + int32_t gop = 2; + /** + * + * @brief 合流视频码率。单位为 Kbps,取值范围为 [1,10000],默认值为 `500`。建议设置。 + */ + + int32_t bitrate = 500; + /** + * + * @brief 视频编码格式,参看 MixedStreamVideoCodecType{@link #MixedStreamVideoCodecType}。默认值为 `0`。建议设置。
+ * WTN 流的视频编码格式只能为设置为 `0`,H264。
+ * 本参数不支持过程中更新。 + */ + + MixedStreamVideoCodecType video_codec = MixedStreamVideoCodecType::kMixedStreamVideoCodecTypeH264; + /** + * + * @brief 是否在服务端合流转推中开启 B 帧。
+ * - true: 是 + * - false: 否 + */ + + bool enable_bframe = false; +} MixedStreamVideoConfig; + +/** + * + * @hidden for internal use only on Windows + * @type keytype + * @brief 客户端合流参数。 + */ + +typedef struct ClientMixedStreamConfig { + /** + * + * @brief 客户端合流是否使用混音,默认为 true。 + */ + + bool use_audio_mixer = true; + /** + * + * @brief 客户端合流回调视频格式,参看 MixedStreamClientMixVideoFormat{@link #MixedStreamClientMixVideoFormat}。 + */ + + MixedStreamClientMixVideoFormat video_format; +} ClientMixedStreamConfig; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 转推直播单通同步参数。 + */ + +typedef struct MixedStreamSyncControlConfig { + /** + * + * @brief 在进行同步处理时,缓存音视频流的最大长度。单位为毫秒。默认值为 2000。 + * @note 参与转推直播的这些媒体流延迟越高,应该将此值设置的越大。但此值越大,因缓存媒体流造成的内存占用也会更大。推荐值为 `2000`。 + */ + + int32_t max_cache_time_ms = 2000; + /** + * + * @brief 是否在转推直播时,启用单通模式。默认为 false,不启用。
+ * 启用单通模式时,RTC SDK 会对指定的多个用户的媒体流进行同步处理,再合流后推送到 CDN,但基准流所属用户不会播放来自其他用户的媒体流。你需要设定以下参数。
+ * 非单通模式时,RTC SDK 不会对媒体流进行同步处理,只是简单合流后推送到 CDN。以下参数设定无效。 + */ + + MixedStreamSyncStrategy sync_strategy = MixedStreamSyncStrategy::kMixedStreamSyncStrategyNoSync; + /** + * + * @brief 在进行同步处理时,基准流所属用户的 ID。默认为空。 + */ + + const char* base_user_id = nullptr; + /** + * + * @brief 是否通过 RTC SDK 进行转推直播。默认为 True。
+ * 如果选择 `False`,你会通过 onCacheSyncVideoFrames{@link #IClientMixedStreamObserver#onCacheSyncVideoFrames} 收到同步的帧,你可以使用此视频帧,自行实现合流转推。 + */ + + bool video_need_sdk_mix = true; +} MixedStreamSyncControlConfig; + +/** + * + * @type keytype + * @brief 图片合流水印图片分辨率。 + */ + +typedef struct MixedStreamLayoutRegionImageWaterMarkConfig { + /** + * + * @brief 原始图片的宽度,单位为 px。 + */ + + int image_width = 0; + /** + * + * @brief 原始图片的高度,单位为 px。 + */ + + int image_height = 0; +} MixedStreamLayoutRegionImageWaterMarkConfig; + +/** + * + * @type keytype + * @brief 推流 CDN 的空间音频参数。 + */ + +typedef struct MixedStreamSpatialAudioConfig { + /** + * + * @brief 是否开启推流 CDN 时的空间音频效果。 + * @note 当你启用此效果时,你需要设定推流中各个 MixedStreamLayoutRegionConfig{@link #MixedStreamLayoutRegionConfig} 的 `spatial_position` 值,实现空间音频效果。 + */ + + bool enable_spatial_render; + /** + * + * @brief 听众的空间位置。参看 Position{@link #Position}。
+ * 听众指收听来自 CDN 的音频流的用户。
+ * WTN 流任务不支持设置本参数。 + */ + + Position audience_spatial_position; + /** + * + * @brief 听众的空间朝向。参看 HumanOrientation{@link #HumanOrientation}。
+ * 听众指收听来自 CDN 的音频流的用户。 + */ + + HumanOrientation audience_spatial_orientation; +} MixedStreamSpatialAudioConfig; + +/** + * + * @type keytype + * @brief 服务端合流控制参数 + */ + +typedef struct MixedStreamControlConfig { + /** + * + * @valid since 3.56 + * @brief 是否开启单独发送声音提示 SEI 的功能:
+ * - true:开启; + * - false:(默认)关闭。 + * 开启后,你可以通过 `MixedStreamControlConfig.sei_content_mode` 控制 SEI 的内容是否只携带声音信息。 + */ + + bool enable_volume_indication = false; + /** + * + * @valid since 3.56 + * @brief 声音提示间隔,单位为秒,取值范围为 [0.3,+∞),默认值为 2。
+ * 此值仅取整百毫秒。若传入两位及以上小数,则四舍五入取第一位小数的值。例如,若传入 0.36,则取 0.4。 + */ + + float volume_indication_interval = 2.0f; + /** + * + * @valid since 3.56 + * @brief 有效音量大小,取值范围为 [0, 255],默认值为 0。
+ * 超出取值范围则自动调整为默认值,即 0。 + */ + + int talk_volume = 0; + /** + * + * @valid since 3.56 + * @brief 声音信息 SEI 是否包含音量值:
+ * - true:是。 + * - false:(默认)否。 + */ + + bool is_add_volume_value = false; + /** + * + * @valid since 3.56 + * @brief 设置 SEI 内容。参看 MixedStreamSEIContentMode{@link #MixedStreamSEIContentMode}。
+ * 默认值为 `0`,视频流中包含全部的 SEI 信息 + */ + + MixedStreamSEIContentMode sei_content_mode = kMixedStreamSEIContentModeDefault; + /** + * + * @valid since 3.56 + * @brief SEI 信息的 payload type。
+ * 默认值为 `100`,只支持设置 `5` 和 `100`。
+ * 在转推直播的过程中,该参数不支持变更。 + */ + + int sei_payload_type = 100; + /** + * + * @valid since 3.56 + * @brief SEI 信息的 payload UUID。 + * @note PayloadType 为 `5` 时,必须填写 PayloadUUID,否则会收到错误回调,错误码为 1091。
+ * PayloadType 不是 `5` 时,不需要填写 PayloadUUID,如果填写会被后端忽略。
+ * 该参数长度需为 32 位,否则会收到错误码为 1091 的回调。
+ * 该参数每个字符的范围需为 [0, 9] [a, f] [A, F]
+ * 该参数不应带有`-`字符,如系统自动生成的 UUID 中带有`-`,则应删去。
+ * 在转推直播的过程中,该参数不支持变更。 + */ + + const char* sei_payload_uuid = nullptr; + /** + * + * @valid since 3.57 + * @brief 设置合流推到 CDN 时输出的媒体流类型。参看 MixedStreamMediaType{@link #MixedStreamMediaType}。
+ * 默认输出音视频流。支持输出纯音频流,但暂不支持输出纯视频流。 + */ + + MixedStreamMediaType media_type = MixedStreamMediaType::kMixedStreamMediaTypeAudioAndVideo; + /** + * + * @valid since 3.57 + * @brief 设置是否在没有用户发布流的情况下发起转推直播,默认不允许。具体参看 MixedStreamPushMode{@link #MixedStreamPushMode}。
+ * 该参数在发起合流任务后的转推直播过程中不支持动态变更。 + */ + + MixedStreamPushMode push_stream_mode = MixedStreamPushMode::kMixedStreamPushModeOnStream; +} MixedStreamControlConfig; + +/** + * + * @type keytype + * @brief WTN 流的布局模式 + */ + +enum StreamLayoutMode { + /** + * + * @brief 自动布局 + */ + + kStreamLayoutModeAuto = 0, + /** + * + * @brief 自定义 + */ + + kStreamLayoutModeCustom = 2 +}; +/** + * + * @type keytype + * @brief WTN 流的补帧模式 + */ + +enum InterpolationMode { + /** + * + * @type keytype + * @brief 补最后一帧 + */ + + kInterpolationModeLastFrameFill = 0, + /** + * + * @type keytype + * @brief 补背景图片 + */ + + kInterpolationModeBackgroundImageFill = 1 +}; +/** + * + * @type keytype + * @brief WTN 流视频裁剪配置 + */ + +typedef struct SourceCrop { + /** + * + * @brief 裁剪后得到的视频帧左上角横坐标相对于裁剪前整体画面的归一化比例,取值范围[0.0, 1.0)。
+ * 默认值为 0.0 + */ + + float location_x = 0.0; + /** + * + * @brief 裁剪后得到的视频帧左上角纵坐标相对于裁剪前整体画面的归一化比例,取值范围[0.0, 1.0)
+ * 默认值为 0.0 + */ + + float location_y = 0.0; + /** + * + * @brief 裁剪后得到的视频帧宽度相对于裁剪前整体画面的归一化比例,取值范围(0.0, 1.0]
+ * 默认值为 1.0 + */ + + float width_proportion = 1.0; + /** + * + * @brief 裁剪后得到的视频帧高度相对于裁剪前整体画面的归一化比例,取值范围(0.0, 1.0]
+ * 默认值为 1.0 + */ + + float height_proportion = 1.0; +} SourceCrop; +/** + * + * @type keytype + * @brief 单个图片或视频流在合流中的布局信息。
+ * 开启合流功能后,在多路图片或视频流合流时,你可以设置其中一路流在合流中的预设布局信息。 + */ + +typedef struct MixedStreamLayoutRegionConfig { + /** + * + * @brief 合流用户的 ID。建议设置。 + */ + + const char* user_id = nullptr; + /** + * + * @brief 图片或视频流所在房间的房间 ID。建议设置。
+ * 如果此图片或视频流是通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 转发到用户所在房间的媒体流时,你应将房间 ID 设置为用户所在的房间 ID。 + */ + + const char* room_id = nullptr; + /** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 X 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的横向位移。
+ * 取值范围为 [0, 整体画布宽度)。默认值为 0。 + */ + + int location_x = 0; + /** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 Y 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的纵向位移。
+ * 取值范围为 [0, 整体画布高度)。默认值为 0。 + */ + + int location_y = 0; + /** + * + * @brief 单个用户画面的宽度。取值范围为 [0, 整体画布宽度],默认值为 360。 + */ + + int width = MIXED_STREAM_VIDEO_DEFAULT_WIDTH; + /** + * + * @brief 单个用户画面的高度。取值范围为 [0, 整体画布高度],默认值为 640。 + */ + + int height = MIXED_STREAM_DEFAULT_VIDEO_HEIGHT; + /** + * + * @brief 透明度,可选范围为 (0.0, 1.0],0.0 为全透明。默认值为 1.0。 + */ + + float alpha = 1.0f; + /** + * + * @brief 圆角半径相对画布宽度的比例。默认值为 `0.0`。
+ * 做范围判定时,首先根据画布的宽高,将 `width`,`height`,和 `corner_radius` 分别转换为像素值:`width_px`,`height_px`,和 `corner_radius_px`。然后判定是否满足 `corner_radius_px < min(width_px/2, height_px/2)`:若满足,则设置成功;若不满足,则将 `corner_radius_px` 设定为 `min(width_px/2, height_px/2)`,然后将 `corner_radius` 设定为 `corner_radius_px` 相对画布宽度的比例值。
+ * WTN 流任务不支持设置本参数。 + */ + + float corner_radius = 0; + + /** + * + * @brief 用户视频布局在画布中的层级。取值范围为 [0 - 100],0 为底层,值越大越上层。默认值为 0。 + */ + + int32_t z_order = 0; + /** + * + * @brief 是否为本地用户:
+ * - true:是 + * - false:(默认值)否 + * WTN 流任务不支持设置本参数。 + */ + + bool is_local_user = false; + /** + * + * @brief 预留字段。 + */ + + MixedStreamVideoType stream_type = MixedStreamVideoType::kMixedStreamVideoTypeMain; + /** + * + * @brief 合流内容控制。默认值为 `kMediaTypeAudioAndVideo`,参看 MixedStreamMediaType{@link #MixedStreamMediaType}。 + */ + + MixedStreamMediaType media_type = MixedStreamMediaType::kMixedStreamMediaTypeAudioAndVideo; + /** + * + * @brief 图片或视频流的缩放模式,参看 MixedStreamRenderMode{@link #MixedStreamRenderMode}。默认值为 `1`,视窗填满优先。建议设置。 + */ + + MixedStreamRenderMode render_mode = MixedStreamRenderMode::kMixedStreamRenderModeHidden; + /** + * + * @brief 合流布局区域类型,视频区或水印图片区。参看 MixedStreamLayoutRegionType{@link #MixedStreamLayoutRegionType}。默认值为 `0`,视频。
+ * WTN 流任务不支持设置本参数。 + */ + + MixedStreamLayoutRegionType region_content_type = MixedStreamLayoutRegionType:: kMixedStreamLayoutRegionTypeVideoStream; + /** + * + * @brief 水印图 RGBA 数据。当 `region_content_type` 为图片类型时需要设置。
+ * - `kMixedStreamLayoutRegionTypeImage = 1` 时,传入图片 RGBA 数据。 + * - `kMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + + uint8_t* image_water_mark = nullptr; + /** + * + * @type keytype + * @brief 水印图参数。当 `region_content_type` 为图片类型时需要设置。
+ * - `kMixedStreamLayoutRegionTypeImage = 1` 时,传入图片参数,参看 MixedStreamLayoutRegionImageWaterMarkConfig{@link #MixedStreamLayoutRegionImageWaterMarkConfig}。 + * - `kMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + + MixedStreamLayoutRegionImageWaterMarkConfig image_water_mark_param; + /** + * + * @valid since 3.57 + * @brief 设置占位图的填充模式。
+ * 该参数用来控制当用户停止发布视频流,画面恢复为占位图后,此时占位图的填充模式。默认值为 `kMixedStreamAlternateImageFillModeFit`,占位图跟随用户原始视频帧相同的比例缩放。
+ * 参看 MixedStreamAlternateImageFillMode{@link #MixedStreamAlternateImageFillMode}。
+ * WTN 流任务不支持设置本参数。 + */ + + MixedStreamAlternateImageFillMode alternate_image_fill_mode = kMixedStreamAlternateImageFillModeFit; + /** + * + * @valid since 3.57 + * @brief 设置占位图的 URL,长度小于 1024 字符. + */ + + const char* alternate_image_url = nullptr; + /** + * + * @type keytype + * @brief 空间位置。参看 Position{@link #Position}。
+ * WTN 流任务不支持设置本参数。 + */ + + Position spatial_position; + /** + * + * @type keytype + * @brief 是否开启空间音频效果。默认值为 true。
+ * WTN 流任务不支持设置本参数。 + */ + + bool apply_spatial_audio = true; + /** + * + * @brief 支持对每一路参与WTN 流的视频进行裁剪,参看 SourceCrop{@link #SourceCrop}
+ * 合流转推任务不支持。 + */ + + SourceCrop source_crop; +} MixedStreamLayoutRegionConfig; +/** + * + * @type keytype + * @brief 数据帧类型 + */ + +enum DataFrameType { + /** + * + * @brief SEI 视频帧 + */ + + kDataFrameTypeSei = 0, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 合流房间状态 + */ + +enum TranscoderRoomStatus { + /** + * @brief join room status + */ + kRoomStatusJoinRoom, + /** + * @brief leave room status + */ + kRoomStatusLeaveRoom, + /** + * @brief room status was offline + */ + kRoomStatusOffline, + /** + * @brief room status was online + */ + kRoomStatusOnline, +}; + +/** + * @hidden for internal use only + */ +typedef size_t status_t; +/** + * + * @hidden for internal use only + */ + +class IVideoFrame; +/** + * + * @hidden for internal use only + */ + +class IAudioFrame; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 数据帧 + */ + +typedef struct IDataFrame { + /** + * + * @brief 数据帧类型,参看 DataFrameType{@link #DataFrameType} + */ + + DataFrameType frame_type = kDataFrameTypeSei; + /** + * + * @brief 数据帧数据 + */ + + uint8_t* u8_data = nullptr; + /** + * + * @brief 数据帧数据大小 + */ + + uint32_t u32_data_size = 0; + /** + * + * @brief 数据帧时间戳,单位:微秒 + */ + + uint64_t u64_ts_us = 0; +} IDataFrame; + +/** + * + * @type keytype + * @brief 合流/WTN 流的转推目标参数。 + * 如无特别说明,参数可适用于 WTN 流和合流转推任务。 + * 如无特别说明,参数可用于启动和更新任务。 + */ + +typedef struct MixedStreamPushTargetConfig { + /** + * + * @type keytype + * @brief WTN 流 ID。合流任务不支持设置本参数。 + */ + + const char* push_wtn_stream_id = nullptr; + /** + * + * @type api + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + + const char* push_cdn_url = nullptr; + /** + * + * @type keytype + * @brief 推流任务类型。 + */ + + MixedStreamPushTargetType push_target_type = kMixedStreamPushTargetTypeToCDN; +} MixedStreamPushTargetConfig; + +/** + * + * @type keytype + * @brief 合流转推配置参数。 + * 如无特别说明,参数可适用于WTN 流和合流转推任务。 + * 如无特别说明,参数可用于启动和更新任务。 + */ + +class IMixedStreamConfig { +public: + /** + * + * @type api + * @brief 构建合流任务参数 + * @return 合流任务参数 + */ + + static BYTERTC_STATIC_API IMixedStreamConfig* createMixedStreamConfig(); + /** + * + * @type api + * @brief 获取发起合流任务用户所在的房间 ID。 + * @return 合流房间 ID + */ + + virtual const char* getRoomID() = 0; + /** + * + * @type api + * @brief 设置合流房间 ID + * @param room_id 发起合流的用户所在的房间 ID + * @note + * 本参数不支持过程中更新。 + */ + + virtual void setRoomID(const char* room_id) = 0; + /** + * + * @type api + * @brief 获取发起合流任务的用户 ID。 + * @return 用户 ID。 + */ + + virtual const char* getUserID() = 0; + /** + * + * @type api + * @brief 设置发起合流任务的用户 ID。`room_id` 和 `user_id` 长度相加不得超过 126 字节。建议设置。
+ * 本参数不支持过程中更新。 + * @param user_id 推流用户 ID。 + */ + + virtual void setUserID(const char* user_id) = 0; + /** + * + * @type api + * @brief 获取合流音频参数。 + * @return 合流音频参数内容,参看 MixedStreamAudioConfig{@link #MixedStreamAudioConfig}。 + */ + + virtual MixedStreamAudioConfig getAudioConfig() = 0; + /** + * + * @type api + * @brief 设置音频参数。建议设置。 + * @param MixedStreamAudioConfig 音频参数,参看 MixedStreamAudioConfig{@link #MixedStreamAudioConfig}。 + * @note + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + + virtual void setAudioConfig(const MixedStreamAudioConfig&) = 0; + /** + * + * @type api + * @brief 获取视频转码参数。 + * @return 视频转码参数内容,参看 MixedStreamVideoConfig{@link #MixedStreamVideoConfig}。 + */ + + virtual MixedStreamVideoConfig getVideoConfig() = 0; + /** + * + * @type api + * @brief 设置视频参数。建议设置。 + * @param MixedStreamVideoConfig 视频参数,参看 MixedStreamVideoConfig{@link #MixedStreamVideoConfig}。 + */ + + virtual void setVideoConfig(const MixedStreamVideoConfig&) = 0; + /** + * + * @hidden(Windows,macOS,Linux) + * @type api + * @brief 获取转推 CDN 时的空间音频参数。 + * @return 参看 MixedStreamSpatialAudioConfig{@link #MixedStreamSpatialAudioConfig}。 + */ + + virtual MixedStreamSpatialAudioConfig getSpatialAudioConfig() = 0; + /** + * + * @hidden(Windows,macOS,Linux) + * @type api + * @brief 设定转推 CDN 时的空间音频效果。参看 MixedStreamSpatialAudioConfig{@link #MixedStreamSpatialAudioConfig}。 + */ + + virtual void setSpatialAudioConfig(const MixedStreamSpatialAudioConfig&) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 获取动态扩展自定义参数 + * @return 动态扩展自定义参数 + */ + + virtual const char* getAdvancedConfig() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置动态扩展自定义参数 + * @param advanced_config 动态扩展自定义参数 + */ + + virtual void setAdvancedConfig(const char* advanced_config) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 获取业务透传鉴权信息 + * @return 业务透传鉴权信息 + */ + + virtual const char* getAuthInfo() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置业务透传鉴权信息 + * @param auth_info 业务透传鉴权信息 + */ + + virtual void setAuthInfo(const char* auth_info) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 获取转推直播同步参数。 + * @return 转推直播同步参数,参看 MixedStreamSyncControlConfig{@link #MixedStreamSyncControlConfig}。 + */ + + virtual MixedStreamSyncControlConfig getSyncControlConfig() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置转推直播同步参数。参看 MixedStreamSyncControlConfig{@link #MixedStreamSyncControlConfig}。 + */ + + virtual void setSyncControlConfig(MixedStreamSyncControlConfig&) = 0; + /** + * + * @type api + * @brief 获取服务端合流控制参数。参看 MixedStreamControlConfig{@link #MixedStreamControlConfig}。 + */ + + virtual MixedStreamControlConfig getControlConfig() = 0; + /** + * + * @type api + * @brief 设置服务端合流控制参数。参看 MixedStreamControlConfig{@link #MixedStreamControlConfig}。 + * @param config 参看 MixedStreamControlConfig{@link #MixedStreamControlConfig}. + */ + + virtual void setControlConfig(MixedStreamControlConfig& config) = 0; + /** + * + * @type api + * @brief 获取用户配置的额外信息。 + * @return 用户配置的额外信息。 + */ + + virtual const char* getUserConfigExtraInfo() = 0; + /** + * + * @type api + * @brief 设置用户配置的额外信息。 + * @param user_ext_info 用户配置的额外信息。 + * @note + * WTN 流任务不支持设置本参数。 + */ + + virtual void setUserConfigExtraInfo(const char* user_ext_info) = 0; + /** + * + * @type api + * @brief 获取 WTN 流的布局模式。 + * @return StreamLayoutMode{@link #StreamLayoutMode} 信息。 + */ + + virtual StreamLayoutMode getStreamLayoutMode() = 0; + /** + * + * @type api + * @brief 设置 WTN 流的布局模式。 + * @param mode 布局模式。参看 StreamLayoutMode{@link #StreamLayoutMode}。 + */ + + virtual void setStreamLayoutMode(StreamLayoutMode mode) = 0; + /** + * + * @type api + * @brief 获取 WTN 流的补帧模式。 + * @return InterpolationMode{@link #InterpolationMode} 信息。 + */ + + virtual InterpolationMode getInterpolationMode() = 0; + /** + * + * @type api + * @brief 设置 WTN 流的补帧模式。 + * @param mode 补帧模式。参看 InterpolationMode{@link #InterpolationMode}。 + */ + + virtual void setInterpolationMode(InterpolationMode mode) = 0; + + /** + * + * @type api + * @brief 获取 WTN 流 ID。 + * @return WTN 流 ID。 + */ + + virtual const char* getPushWTNStreamID() = 0; + /** + * + * @type api + * @brief 设置 WTN 流 ID。 + * @param stream_id WTN 流 ID。 + */ + + virtual void setPushWTNStreamID(const char* stream_id) = 0; + /** + * + * @type api + * @brief 获取任务类型。 + * @return MixedStreamPushTargetType{@link #MixedStreamPushTargetType} + */ + + virtual MixedStreamPushTargetType getPushTargetType() = 0; + /** + * + * @type api + * @brief 设置推流目标。 + * @param type 参看 MixedStreamPushTargetType{@link #MixedStreamPushTargetType}。 + */ + + virtual void setPushTargetType(MixedStreamPushTargetType type) = 0; + + /** + * + * @type api + * @brief 获取背景颜色。 + * @return 背景颜色,用十六进制颜色码(HEX)表示。例如,#FFFFFF 表示纯白,#000000 表示纯黑。默认值为 #000000。建议设置。 + */ + + virtual const char* getBackgroundColor() = 0; + /** + * + * @type api + * @brief 设置背景颜色。 + * @param background_color 背景颜色,用十六进制颜色码(HEX)表示。例如,#FFFFFF 表示纯白,#000000 表示纯黑。默认值为 #000000。建议设置。 + */ + + virtual void setBackgroundColor(const char* background_color) = 0; + /** + * + * @type api + * @brief 获取背景图片的地址。 + * @return 背景图片的地址。 + */ + + virtual const char* getBackgroundImageURL() = 0; + /** + * + * @type api + * @brief 设置合流后整体画布的背景图片。 + * @param background_image_url 图片的 URL,长度最大为 1023 bytes。
+ * 必须是 http 开头,支持的图片格式包括:JPG, JPEG, PNG。如果背景图片的宽高和整体屏幕的宽高不一致,背景图片会缩放到铺满屏幕。 + */ + + virtual void setBackgroundImageURL(const char* background_image_url) = 0; + /** + * + * @type api + * @brief 获取合流视窗布局信息。 + * @param index 视窗对应下标。 + * @return 合流视窗布局信息,参看 MixedStreamLayoutRegionConfig{@link #MixedStreamLayoutRegionConfig}。 + */ + + virtual MixedStreamLayoutRegionConfig getLayoutByIndex(int32_t index) = 0; + /** + * + * @type api + * @brief 获取合流参数中视窗的数量 + * @return 合流参数中视窗的数量 + */ + + virtual int32_t getLayoutRegionsSize() = 0; + /** + * + * @type api + * @brief 设置视频流合流整体布局信息。 + * @param regions 用户布局信息列表。为 MixedStreamLayoutRegionConfig{@link #MixedStreamLayoutRegionConfig} 数据类型的数组。每一个该类型对象为一路单独的视频流的布局信息。
+ * 值不合法或未设置时,自动使用默认值。建议设置。 + * @param regions_size 合流视窗数量。建议设置。 + */ + + virtual void setLayoutConfig(MixedStreamLayoutRegionConfig regions[], int32_t regions_size) = 0; + virtual ~IMixedStreamConfig() = default; +}; + +/** + * + * @type keytype + * @brief 单流转推配置目标房间信息 + */ + +typedef struct DestInfo { + /** + * + * @brief 跨房间转发媒体流过程中目标房间 ID + */ + + const char* room_id; + /** + * + * @brief 转发目标房间中自定义用户ID + */ + + const char* user_id; +} DestInfo; + +/** + * + * @type keytype + * @brief 单流转推类型,指定将媒体流转推到 CDN 还是 RTC 房间。 + */ + +enum SingleStreamPushType { + /** + * + * @brief 转推到 CDN + */ + + kPushToCDN = 1, + /** + * + * @brief 转推到 RTC 房间 + */ + + kPushToRTC = 2 +}; + +/** + * + * @type keytype + * @brief 单流转推直播配置参数。 + */ + +typedef struct PushSingleStreamParam { + /** + * + * @brief 媒体流所在的房间 ID + */ + + const char* room_id; + /** + * + * @brief 媒体流所属的用户 ID + */ + + const char* user_id; + /** + * + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * 本参数不支持过程中更新。 + */ + + const char* uri; + /** + * + * @brief 预留字段。 + */ + + bool is_screen_stream; + /** + * + * @brief 转推目标房间数组,默认值为nullptr + */ + + DestInfo* dest_info = nullptr; + /** + * + * @brief 转推目标房间数量,`dest_info` 的数组长度,
+ * 默认值为0,取值范围[0, 8] + */ + + int32_t dest_info_size = 0; + /** + * + * @brief 单流转推类型,指定将媒体流转推到 CDN 还是 RTC 房间,默认值为转推到 CDN。 + */ + + SingleStreamPushType push_type = kPushToCDN; +}PushSingleStreamParam; + +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步模式。 +*/ + +enum ChorusCacheSyncMode { + /** + * + * @brief 合唱场景下,主唱应采用此模式,以发送带时间戳信息的媒体数据。 + */ + + kChorusCacheSyncModeProducer= 0, + /** + * + * @brief 合唱场景下,副唱应采用此模式。
+ * 此模式下,副唱收到来自主唱的带时间戳的媒体数据。副唱发送的媒体数据中带有来自主唱的时间戳。 + */ + + kChorusCacheSyncModeRetransmitter= 1, + /** + * + * @brief 合唱场景下,听众应采用此模式。
+ * 此模式下,听众收到来自主唱的时间戳,并据此对齐来自主唱和副唱的媒体数据,以获得良好的合唱播放效果。 + */ + + kChorusCacheSyncModeConsumer = 2 +}; +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步事件。 +*/ + +enum ChorusCacheSyncEvent { + /** + * + * @brief 成功 + */ + + kChorusCacheSyncEventStartSuccess = 0, + /** + * + * @brief 失败。 + */ + + kChorusCacheSyncEventStartFailed = 1, +}; +/** +* +* @hidden internal use only +* @type errorcode +* @brief 缓存同步错误码。 +*/ + +enum ChorusCacheSyncError { + /** + * + * @brief 成功。 + */ + + kChorusCacheSyncErrorOK = 0, + /** + * + * @brief 失败。推送至 CDN 时,应进行以下设置:
+ * - `IMixedStreamConfig.MixedStreamSyncControlConfig.enable_sync = true`; + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.base_user_id = {uid of producer}`。 + */ + + kChorusCacheSyncErrorWrongState = 1, + /** + * + * @brief 缓存同步功能已启动,不需要重复开启。 + */ + + kChorusCacheSyncErrorAlreadyRunning = 2 +}; +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步配置。 +*/ + +struct ChorusCacheSyncConfig { + /** + * + * @brief 最大媒体缓存时长(ms)。
+ * 取值范围是 `[500, 2500]`,默认值是 `2000`。
+ * 值越大,同步效果越好,但会造成占用内存较大。如果参与缓存同步的各路媒体流之间的时间差超过此值,会造成丢帧。 + */ + + int32_t max_cache_time_ms = 2000; + /** + * + * @brief 收到 onSyncedVideoFrames{@link #IChorusCacheSyncObserver#onSyncedVideoFrames} 的频率。
+ * 默认值是 `15`。此值通常应小于等于原始视频帧率;如果大于原始视频帧率,可能会收到重复帧。 + */ + + int32_t video_fps = 15; + /** + * + * @brief 模式。参看 ChorusCacheSyncMode{@link #ChorusCacheSyncMode}. 默认值是 `retransmitter`。 + */ + + ChorusCacheSyncMode mode = kChorusCacheSyncModeRetransmitter; +}; + +/** + * + * @type callback + * @hidden for internal use only on Windows + * @brief 合流推流 Observer
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ + +class IClientMixedStreamObserver { +public: + /** + * + * @hidden for internal use only on Windows + * @type callback + * @brief 转推直播状态回调 + * @param info 参看 MixedStreamTaskInfo{@link #MixedStreamTaskInfo} + * @param type 转推直播类型,参看 MixedStreamType{@link #MixedStreamType} + * @param event 转推直播任务状态,参看 MixedStreamTaskEvent{@link #MixedStreamTaskEvent} + * @param error_code 转推直播错误码,参看 MixedStreamTaskErrorCode{@link #MixedStreamTaskErrorCode}。 + */ + + virtual void onClientMixedStreamEvent(MixedStreamTaskInfo info, MixedStreamType type, MixedStreamTaskEvent event, MixedStreamTaskErrorCode error_code) = 0; + /** + * + * @hidden for internal use only on Windows + * @type callback + * @region CDN 推流 + * @brief 客户端合流音频首帧回调 + * @param task_id 任务 ID + */ + + virtual void onMixedFirstAudioFrame(const char* task_id) = 0; + /** + * + * @hidden for internal use only on Windows + * @type callback + * @region CDN 推流 + * @brief 客户端合流视频首帧回调 + * @param task_id 任务 ID + */ + + virtual void onMixedFirstVideoFrame(const char* task_id) = 0; + /** + * + * @type callback + * @hidden for internal use only on Windows + * @region CDN 推流 + * @brief 合流视频回调,运行在视频回调线程 + * @param task_id 合流任务 ID + * @param video_frame 视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @note 收到该回调的周期与视频的帧间隔一致。 + */ + + virtual void onMixedVideoFrame(const char* task_id, IVideoFrame* video_frame) = 0; + + /** + * + * @type callback + * @hidden for internal use only on Windows + * @region CDN 推流 + * @brief 合流音频回调,运行在音频回调线程 + * @param task_id 转推直播任务 ID + * @param audio_frame 音频帧,参看 IAudioFrame{@link #IAudioFrame}。 + * @note 收到该回调的周期为每 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + */ + + virtual void onMixedAudioFrame(const char* task_id, IAudioFrame* audio_frame) = 0; + + /** + * + * @type callback + * @hidden for internal use only on Windows + * @region CDN 推流 + * @brief 视频 SEI 帧回调,运行在视频回调线程 + * @param task_id 转推直播任务 ID + * @param data_frame SEI 数据 + */ + + virtual void onMixedDataFrame(const char* task_id, IDataFrame* data_frame) = 0; + + /** + * + * @hidden for internal use only + * @type callback + * @region CDN 推流 + * @brief 同步视频帧回调。 + * @param task_id 转推直播任务 ID。 + * @param uids 同步视频帧对应的 uid 数组。 + * @param video_frames 同步视频帧数组,与 uids 对应。 + * @param data_frame SEI 数据。 + * @param count 数组的长度。 + */ + + virtual void onCacheSyncVideoFrames(const char* task_id, const char* uids[], IVideoFrame* video_frames[], + IDataFrame* data_frame[], int count) = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IClientMixedStreamObserver() = default; +}; + +/** + * + * @hidden internal use only + * @type callback + * @brief 缓存同步 Observer + */ + +class IChorusCacheSyncObserver { +public: + /** + * @hidden constructor/destructor + */ + virtual ~IChorusCacheSyncObserver() { + } + /** + * + * @type callback + * @brief 调用 startChorusCacheSync{@link #IRTCEngine#startChorusCacheSync},并设置为 `consumer` 的用户会通过此回调获取经缓存同步后的视频帧。获取频率通过启动同步时的 `fps` 进行设置。 + * @param count `uids` 和 `videoFrames` 的数组长度 + * @param uids 参与合唱缓存同步的 `producer` 和 `retransmitter` 的列表,不包括参与但未发送媒体数据的用户。 + * @param video_frames 对应 `uids` 的视频帧。参看 IVideoFrame{@link #IVideoFrame}。 + */ + + virtual void onSyncedVideoFrames(int count, const char* uids[], bytertc::IVideoFrame* video_frames[]) = 0; + /** + * + * @type callback + * @brief 参与合唱缓存同步的 `producer` 和 `retransmitter` 发生变化时,收到此回调。 + * @param count 当前的 `uids` 的长度 + * @param uids 当前的参与者列表 + * @note 有以下情况可能造成参与者发生变化:
+ * - 用户主动调用 startChorusCacheSync{@link #IRTCEngine#startChorusCacheSync} 或 stopChorusCacheSync{@link #IRTCEngine#stopChorusCacheSync}; + * - 原本参与缓存同步的用户发生异常退出。 + */ + + virtual void onSyncedUsersChanged(int count, const char* uids[]) = 0; + /** + * + * @type callback + * @brief 缓存同步事件回调 + * @param event 事件,参看 ChorusCacheSyncEvent{@link #ChorusCacheSyncEvent}。 + * @param error 错误码,参看 ChorusCacheSyncError{@link #ChorusCacheSyncError}。 + */ + + virtual void onSyncEvent(ChorusCacheSyncEvent event, ChorusCacheSyncError error) = 0; +}; +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines.h new file mode 100644 index 0000000..25f0cc7 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines.h @@ -0,0 +1,2648 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Defines + */ + +#pragma once + +#include "bytertc_rts_defines.h" +#include "bytertc_video_frame.h" + +namespace bytertc { + +/** + * + * @type keytype + * @brief 订阅大小流偏好 + */ + +enum SimulcastStreamType { + /** + * + * @brief 弱流,最小分辨率的流。 + */ + + kSimulcastStreamTypeWeak = 0, + /** + * + * @brief 小流 + */ + + kSimulcastStreamTypeLow, + /** + * + * @brief 中流 + */ + + kSimulcastStreamTypeMid, + /** + * + * @brief 大流 + */ + + kSimulcastStreamTypeHigh +}; + +/** + * + * @type keytype + * @brief 发布大小流模式 + */ + +enum VideoSimulcastMode { + /** + * + * @brief 单流模式。始终只有 1 路分辨率的流。 + */ + + kVideoSimulcastModeOnlyOne = 0, + /** + * + * @brief 按需订阅模式。发送端会根据订阅端的状态,按需发布。无订阅偏好设置默认发送 2 路。 + */ + + kVideoSimulcastModeOnDemand, + /** + * + * @brief 订阅弱流。发送端始终按照设置的参数发布所有大小流。默认发送 2 路。 + */ + + kVideoSimulcastModeAlwaysSimulcast, +}; + + +/** + * + * @type keytype + * @brief 渲染模式 + */ + +enum RenderMode { + /** + * + * @brief 视窗填满优先,默认值。
+ * 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
+ * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + */ + + kRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
+ * 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。
+ * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 + */ + + kRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
+ * 视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + kRenderModeFill = 3, +}; + +/** + * + * @type keytype + * @brief 订阅媒体的类型 + */ + +enum SubscribeMediaType { + /** + * + * @brief 既不订阅音频,也不订阅视频 + */ + + kRTCSubscribeMediaTypeNone = 0, + /** + * + * @brief 只订阅音频,不订阅视频 + */ + + kRTCSubscribeMediaTypeAudioOnly, + /** + * + * @brief 只订阅视频,不订阅音频 + */ + + kRTCSubscribeMediaTypeVideoOnly, + /** + * + * @brief 同时订阅音频和视频 + */ + + kRTCSubscribeMediaTypeVideoAndAudio +}; + +/** + * + * @type keytype + * @brief 暂停/恢复接收远端的媒体流类型。 + */ + +enum PauseResumeControlMediaType { + /** + * + * @brief 只控制音频,不影响视频 + */ + + kRTCPauseResumeControlMediaTypeAudio = 0, + /** + * + * @brief 只控制视频,不影响音频 + */ + + kRTCPauseResumeControlMediaTypeVideo = 1, + /** + * + * @brief 同时控制音频和视频 + */ + + kRTCPauseResumeControlMediaTypeVideoAndAudio = 2 +}; + +/** + * + * @type keytype + * @brief 时域分层定义 + */ + +enum SVCLayer { + /** + * + * @brief 不指定分层(默认值) + */ + + kSVCLayerDefault = 0, + /** + * + * @brief T0 层 + */ + + kSVCLayerBase = 1, + /** + * + * @brief T0+T1 层 + */ + + kSVCLayerMain = 2, + /** + * + * @brief T0+T1+T2 层 + */ + + kSVCLayerHigh = 3, +}; + +/** + * + * @type keytype + * @brief 流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。 + */ + +struct RemoteStreamSwitch { + /** + * + * @brief 订阅的音视频流的发布者的用户 ID。 + */ + + const char* uid; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 流切换前本地用户订阅的视频流的分辨率对应的索引。 + */ + + int before_video_index; + /** + * + * @brief 流切换后本地用户订阅的视频流的分辨率对应的索引。 + */ + + int after_video_index; + /** + * + * @brief 流切换前是否有视频流。 + */ + + bool before_enable; + /** + * + * @brief 流切换后是否有视频流。 + */ + + bool after_enable; + /** + * + * @brief 触发流回退的原因,详见类型 FallbackOrRecoverReason{@link #FallbackOrRecoverReason} 。 + */ + + FallbackOrRecoverReason reason; +}; + +/** + * + * @type keytype + * @brief 背景模式 + */ + +enum BackgroundMode { + /** + * + * @brief 无 + */ + + kBackgroundModeNone = 0, + /** + * + * @brief 虚化 + */ + + kBackgroundModeBlur = 1, + /** + * + * @brief 背景 1 + */ + + kBackgroundModeA = 2, + /** + * + * @brief 背景 2 + */ + + kBackgroundModeB = 3, +}; + +/** + * + * @type keytype + * @brief 分割模型 + */ + +enum DivideMode { + /** + * + * @brief 自研 + */ + + kDivideModeNone = 0, + /** + * + * @brief effect + */ + + kDivideModeEffect = 1, +}; + +/** + * + * @type keytype + * @brief 流属性。 + */ + +struct MediaStreamInfo { + /** + * + * @brief 发布此流的用户 ID 。 + */ + + const char* user_id; + /** + * + * @hidden for internal use only + * @brief 该流的标识 ID,用户内唯一。 + */ + + StreamIndex stream_index; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 此流是否包括视频流。 + */ + + bool has_video; + /** + * + * @brief 流是否包括音频流。 + */ + + bool has_audio; + /** + * + * @brief 视频流的属性。
+ * 当远端用户调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。 + */ + + VideoSolutionDescription* profiles; + /** + * + * @brief 不同配置流的个数。
+ * 当远端用户调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法发布多个配置的视频流时,此处会包含该用户发布的视频流的数目。 + */ + + int profile_count; + + /** + * + * @brief 最大视频流的属性。
+ * 当远端用户开启带通道划分的大小流时,回调最大视频流属性信息。用户可以使用新的订阅方式,订阅任意不超过该分辨率的流。
+ * 最终接收到的流,会受房间内其他用户的订阅行为的影响,综合确定一个最接近用户请求的分辨率的流。 + */ + + VideoSolutionDescription max_profile; +}; + +/** + * + * @type keytype + * @brief 视频订阅配置信息 + */ + +struct SubscribeVideoConfig { + /** + * + * @brief 订阅的视频流分辨率下标。
+ * 当远端用户通过调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
+ * 默认值为 0,即订阅第一路流。
+ * 如果不想更改之前的设置,可以输入 -1。 + */ + + int video_index = 0; + /** + * + * @brief 远端用户优先级,参看 RemoteUserPriority{@link #RemoteUserPriority},默认值为 0。 + */ + + int priority = 0; + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeVideoConfig() : video_index(0), priority(0) { + } + /** + * + * @hidden constructor/destructor + */ + + bool operator==(const SubscribeVideoConfig& config) const { + bool result = video_index == config.video_index && priority == config.priority; + return result; + } + /** + * + * @hidden constructor/destructor + */ + + bool operator!=(const SubscribeVideoConfig& config) const { + bool result = (*this == config); + return !result; + } +}; + +/** + * + * @type keytype + * @brief 手动订阅流的配置信息。 + */ + +struct SubscribeConfig { + /** + * + * @brief 预留字段。 + */ + + bool is_screen = false; + /** + * + * @brief 是否订阅视频。 + */ + + bool sub_video; + /** + * + * @brief 是否订阅音频。 + */ + + bool sub_audio; + /** + * + * @brief 订阅的视频流分辨率下标。
+ * 用户可以通过调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法在一路流中发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。 + */ + + int video_index; + /** + * + * @brief 远端用户的需求优先级,参看 RemoteUserPriority{@link #RemoteUserPriority},默认值为 0 。
+ * 当开启了订阅流回退选项功能(详见 setSubscribeFallbackOption{@link #IRTCEngine#setSubscribeFallbackOption} 方法),弱网或性能不足时会优先保证收到的高优先级用户的流的质量。 + */ + + int priority = 0; + /** + * + * @brief 远端用户的时域分层,参看 SVCLayer{@link #SVCLayer},默认值为 0 。
+ * 仅码流支持 SVC 特性时可以生效。 + */ + + int svc_layer = 0; + /** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0,设为大于 0 的值时开始生效。
+ * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
+ * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + + int framerate = 0; + /** + * + * @brief 用户通过指定 UI 对应的最合适的流的宽度,单位:px + */ + + int sub_width = 0; + /** + * + * @brief 用户通过指定 UI 对应的最合适的流的高度,单位:px + */ + + int sub_height = 0; + /** + * + * @hidden for internal use only + */ + + int sub_video_index = -1; + +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig() : is_screen(false), sub_video(true), sub_audio(true), video_index(0), priority(0) { + } + + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig(bool is_screen, bool subvideo, bool subaudio, int videoindex) + : is_screen(is_screen), sub_video(subvideo), sub_audio(subaudio), video_index(videoindex) { + } + + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig(bool is_screen, bool subvideo, bool subaudio, int videoindex, int priority) + : is_screen(is_screen), + sub_video(subvideo), + sub_audio(subaudio), + video_index(videoindex), + priority(priority) { + } + + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig(bool is_screen, bool subvideo, bool subaudio, int videoindex, + int priority,int svc_layer,int width,int height) + : is_screen(is_screen), + sub_video(subvideo), + sub_audio(subaudio), + video_index(videoindex), + priority(priority), + svc_layer(svc_layer), + sub_width(width), + sub_height(height) { + } + /** + * + * @hidden constructor/destructor + */ + + bool operator==(const SubscribeConfig& config) const { + + bool common_result = is_screen == config.is_screen && sub_video == config.sub_video + && sub_audio == config.sub_audio && priority == config.priority + && svc_layer == config.svc_layer && framerate == config.framerate; + bool result; + if(sub_width * sub_height > 0 && config.sub_width * config.sub_height > 0) { + result = common_result && sub_width == config.sub_width && sub_height == config.sub_height ; + } else if((sub_width * sub_height == 0) && (config.sub_width * config.sub_height == 0) ) { + result = common_result && video_index == config.video_index; + } else { + result = false; + } + return result; + } + /** + * + * @hidden constructor/destructor + */ + + bool operator!=(const SubscribeConfig& config) const { + bool result = (*this == config); + return !result; + } +}; + +/** + * + * @type keytype + * @brief 远端视频类型
+ * 目前 C++ sdk 只支持 kVideoStreamTypeHigh 类型 + */ + +enum VideoStreamType { + /** + * + * @brief 高分辨率视频流 + */ + + kVideoStreamTypeHigh = 0, + /** + * + * @brief 低分辨率视频 + */ + + kVideoStreamTypeLow = 1, +}; + +/** + * + * @type keytype + * @brief 渲染目标类型 + */ + +enum RenderTargetType { + /** + * + * @brief 指定渲染目标类型为 SurfaceView/TextureView (Android), UIView(iOS), NSView(macOS), HWND (Windows) + */ + + kRenderTargetTypeView = 0, + /** + * + * @brief 仅在 Android 平台生效,指定渲染目标类型为 Surface + */ + + kRenderTargetTypeSurface = 1, +}; + +/** + * + * @type keytype + * @brief 视频帧渲染设置。 + */ + +struct VideoCanvas { + /** + * + * @brief 本地视图句柄 + */ + + void* view = NULL; + /** + * + * @brief 视频渲染模式,参看 RenderMode{@link #RenderMode} + */ + + int render_mode = kRenderModeHidden; + /** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + + uint32_t background_color = 0; + /** + * + * @brief 渲染目标的类型。参看 RenderTargetType{@link #RenderTargetType}。 + */ + + RenderTargetType render_target_type = kRenderTargetTypeView; + /** + * + * @brief 视频帧旋转角度。参看 VideoRotation{@link #VideoRotation}。默认为 0 度,即不做旋转处理。
+ * 该设置仅对远端视频有效,对本地视频设置不生效。 + */ + + VideoRotation render_rotation = kVideoRotation0; + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + VideoCanvas() : view(NULL), render_mode(kRenderModeHidden), background_color(0), render_target_type(kRenderTargetTypeView) { + } + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + VideoCanvas(void* v, int m, uint32_t c) : view(v), render_mode(m), background_color(c) { + } +}; + +/** + * + * @type keytype + * @brief 远端视频帧渲染设置 + */ + +struct RemoteVideoRenderConfig { + /** + * + * @brief 渲染模式:
+ * - 1(`RENDER_MODE_HIDDEN`)视窗填满优先,默认值。视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + * - 2(`RENDER_MODE_FIT`)视频帧内容全部显示优先。视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将填充 `backgroundColor`。缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 + * - 3(`RENDER_MODE_FILL`)视频帧自适应画布。视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + RenderMode render_mode = kRenderModeHidden; + /** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + + uint32_t background_color = 0; + + /** + * + * @brief 用户自定义画面旋转。可选值 0, 90, 180, 270, 默认值是 0。其中 0 代表保持原始画面,90, 180, 270 代表顺时针旋转原始 canvas 相应角度。 + */ + + VideoRotation render_rotation = kVideoRotation0; +}; + +/** + * + * @type api + * @brief Windows 窗口 id, Windows 平台下传 Windows 窗口句柄 + */ + +typedef void* view_t; + +/** + * + * @type keytype + * @brief 矩形区域,用于指定屏幕区域。 + */ + +struct Rectangle { + /** + * + * @brief 矩形区域左上角的 x 坐标。 + */ + + int x = 0; + /** + * + * @brief 矩形区域左上角的 y 坐标。 + */ + + int y = 0; + /** + * + * @brief 矩形宽度。 + */ + + int width = 0; + /** + * + * @brief 矩形高度。 + */ + + int height = 0; +}; + +/** + * + * @type keytype + * @brief 屏幕共享时的边框高亮设置。 + */ + +struct HighlightConfig { + /** + * + * @brief 是否显示高亮边框,默认显示。 + */ + + bool enable_highlight = true; + /** + * + * @brief 边框的颜色, 颜色格式为十六进制 ARGB: 0xAARRGGB。 + */ + + uint32_t border_color = 0xFF29CCA3; + /** + * + * @brief 边框的宽度,单位:像素。 + */ + + int border_width = 4; +}; + +/** + * + * @type keytype + * @brief 抓取屏幕时排除指定窗口,默认不排除任何窗体。 + */ + +struct ScreenFilterConfig { + /** + * + * @brief 抓取屏幕时排除窗口列表。这个参数仅在抓取屏幕时生效。 + */ + + view_t* excluded_window_list = nullptr; + /** + * + * @brief 排除窗口的数量。 + */ + + int excluded_window_num = 0; +}; + +/** + * + * @type keytype + * @region 屏幕共享 + * @brief 内部采集屏幕视频流时,是否采集鼠标信息。 + */ + +enum MouseCursorCaptureState { + /** + * + * @brief 采集鼠标信息。 + */ + + kMouseCursorCaptureStateOn, + /** + * + * @brief 不采集鼠标信息。 + */ + + kMouseCursorCaptureStateOff, +}; + +/** + * + * @type keytype + * @brief 屏幕共享参数 + */ + +struct ScreenParameters { + /** + * + * @brief 编码帧率,单位为 fps + */ + + int frame_rate = 15; + /** + * + * @brief 屏幕采集编码码率, `-1` 为自动码率, SDK 会根据宽高信息选择合适的码率,单位 kbps + */ + + int kbitrate = -1; + /** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `min_kbitrate`。
+ * 默认值为 `0`。
+ * 范围:[0, kbitrate),当 `kbitrate` < `min_kbitrate` 时,为适配码率模式。
+ * 以下情况,设置本参数无效:
+ * - 当 `kbitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `kbitrate` < `0` 时,适配码率模式。 + */ + + int min_kbitrate = 0; +}; + +/** + * + * @type keytype + * @region 屏幕共享 + * @brief 内部采集屏幕视频流的内容类型。 + */ + +enum ContentHint { + /** + * + * @brief 细节内容。当共享文档、图片时,建议使用该内容类型。默认值。 + */ + + kContentHintDetails = 0, + /** + * + * @brief 动画内容。当共享视频、游戏时,建议使用该内容类型。 + */ + + kContentHintMotion, +}; + +/** + * + * @type keytype + * @brief 屏幕共享内部采集参数 + */ + +struct ScreenCaptureParameters { + /** + * + * @brief 采集区域,参看 Rectangle{@link #Rectangle}。 + */ + + Rectangle region_rect; + /** + * + * @brief 是否采集鼠标状态,参看 MouseCursorCaptureState{@link #MouseCursorCaptureState}。 + */ + + MouseCursorCaptureState capture_mouse_cursor = MouseCursorCaptureState::kMouseCursorCaptureStateOn; + /** + * + * @brief 屏幕过滤设置,填写不需要采集的窗口 ID,参看 ScreenFilterConfig{@link #ScreenFilterConfig}。 + */ + + ScreenFilterConfig filter_config; + /** + * + * @brief 采集区域的边框高亮设置,参看 HighlightConfig{@link #HighlightConfig}。 + */ + + HighlightConfig highlight_config; +}; + +/** + * + * @type keytype + * @brief 屏幕共享的编码参数配置。 + */ + +struct DesktopCaptureParameters { + /** + * + * @brief 屏幕采集编码最大宽度,单位 px。 + */ + + int max_width = 1920; + /** + * + * @brief 屏幕采集编码最大高度,单位 px。 + */ + + int max_height = 1080; + /** + * + * @brief 屏幕采集编码帧率, 单位 fps。 + */ + + int frame_rate = 15; + /** + * + * @brief 屏幕采集编码码率, -1 为自动码率, SDK 会根据宽高信息选择合适的码率,单位 kbps + */ + + int bitrate = -1; + /** + * + * @brief 最小编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
+ * 最小编码码率必须小于或等于最大编码,否则不对视频流进行编码发送。 + */ + + int min_bitrate = 0; + /** + * + * @brief 是否捕获鼠标光标。 + */ + + bool capture_mouse_cursor = true; + /** + * + * @brief 抓取屏幕时排除窗口列表。这个参数仅在抓取屏幕时生效。 + */ + + view_t* excluded_window_list = nullptr; + /** + * + * @brief 抓取屏幕时排除的窗口数量。 + */ + + int excluded_window_num = 0; + /** + * + * @brief 高亮边框的配置。 + */ + + HighlightConfig highlight_config; +}; + +/** + * + * @type keytype + * @brief 自定义视频渲染器 + */ + +class IVideoSink { +public: + /** + * + * @type keytype + * @brief 视频帧编码格式 + */ + + enum PixelFormat { + /** + * + * @brief YUV I420 格式 + */ + + kI420 = VideoPixelFormat::kVideoPixelFormatI420, + /** + * + * @brief RGBA 格式, 字节序为 R8 G8 B8 A8 + */ + + kRGBA = VideoPixelFormat::kVideoPixelFormatRGBA, + /** + * + * @brief 原始视频帧格式 + */ + + kOriginal = VideoPixelFormat::kVideoPixelFormatUnknown, + }; + /** + * + * @type callback + * @brief 视频帧回调 + * @param video_frame 视频帧结构类,参看 IVideoFrame{@link #IVideoFrame} + * @return 返回值暂未使用 + * @list + */ + + virtual bool onFrame(IVideoFrame* video_frame) = 0; + /** + * + * @type callback + * @brief 获取外部渲染耗时。 + * @note 获取外部渲染耗时进行上报。开发者需要自己计算平均渲染耗时。 + * @list 房间管理 + */ + + virtual int getRenderElapse() = 0; + /** + * + * @type callback + * @brief 释放渲染器。 + * @note 通知开发者渲染器即将被废弃。收到该返回通知后即可释放资源。 + * @list Room Management + */ + + virtual void release() { + } + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoSink() = default; + + /** + * + * @hidden sink id + * @brief sink id + */ + + virtual void* uniqueId() const { return (void *)this; } +}; + +/** + * + * @type keytype + * @brief 本地视频帧回调位置。 + */ + +enum LocalVideoSinkPosition { + /** + * + * @brief 采集后。 + */ + + kLocalVideoSinkPositionAfterCapture, + /** + * + * @brief (默认值)前处理后。 + */ + + kLocalVideoSinkPositionAfterPreProcess +}; + +/** + * + * @type keytype + * @brief 是否将视频帧自动转正。 + */ + +enum VideoApplyRotation { + /** + * + * @brief (默认值)不旋转。 + */ + + kVideoApplyRotationDefault = -1, + /** + * + * @brief 自动转正视频,即根据视频帧的旋转角信息将视频帧旋转到 0 度。 + */ + + kVideoApplyRotation0 = 0, +}; + +/** + * + * @type keytype + * @brief 是否将视频帧镜像。 + */ + +enum VideoSinkMirrorType { + /** + * + * @brief 开启镜像。 + */ + + kVideoSinkMirrorTypeON = 1, + /** + * + * @brief (默认值)不开启镜像。 + */ + + kVideoSinkMirrorTypeOFF = 2, +}; + +/** + * + * @type keytype + * @brief 本地视频帧回调配置。 + */ + +struct LocalVideoSinkConfig { + /** + * + * @brief 本地视频帧回调位置,参看 LocalVideoSinkPosition{@link #LocalVideoSinkPosition},默认回调前处理后的视频帧。 + */ + + LocalVideoSinkPosition position = kLocalVideoSinkPositionAfterPreProcess; + /** + * + * @brief 本地视频帧回调格式,参看 VideoPixelFormat{@link #VideoPixelFormat},默认值为 0。 + */ + + VideoPixelFormat pixel_format = kVideoPixelFormatUnknown; +}; + +/** + * + * @type keytype + * @brief 远端视频帧回调位置。 + */ + +enum RemoteVideoSinkPosition { + /** + * + * @hidden not available + * @brief 解码后。 + */ + + kRemoteVideoSinkPositionAfterDecoder, + /** + * + * @brief (默认值)后处理后。 + */ + + kRemoteVideoSinkPositionAfterPostProcess +}; + +/** + * + * @type keytype + * @brief 远端视频帧回调配置。 + */ + +struct RemoteVideoSinkConfig { + /** + * + * @brief 远端视频帧回调位置,参看 RemoteVideoSinkPosition{@link #RemoteVideoSinkPosition},默认回调后处理后的视频帧。 + */ + + RemoteVideoSinkPosition position = kRemoteVideoSinkPositionAfterPostProcess; + /** + * + * @brief 远端视频帧回调格式,参看 VideoPixelFormat{@link #VideoPixelFormat},默认值为 0。 + */ + + VideoPixelFormat pixel_format = kVideoPixelFormatUnknown; + /** + * + * @brief 是否将视频帧自动转正,参看 VideoApplyRotation{@link #VideoApplyRotation},默认为不旋转。 + */ + + VideoApplyRotation apply_rotation = kVideoApplyRotationDefault; + /** + * + * @brief 是否将视频帧镜像。参看 VideoSinkMirrorType{@link #VideoSinkMirrorType},默认为不镜像。
+ * 本设置与 setRemoteVideoMirrorType{@link #IRTCEngine#setRemoteVideoMirrorType} (适用于内部渲染)相互独立。 + */ + + VideoSinkMirrorType mirror_type = kVideoSinkMirrorTypeOFF; +}; + +/** + * + * @hidden + * @type keytype + * @deprecated since 3.29 and will be deleted in 3.51, use MirrorType{@link #MirrorType} instead. + * @brief 是否开启镜像模式 + */ + +enum MirrorMode { + /** + * + * @brief 不开启 + */ + + kMirrorModeOff = 0, + /** + * + * @brief 开启 + */ + + kMirrorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 镜像类型 + */ + +enum MirrorType : int { + /** + * + * @brief 本地预览和编码传输时均无镜像效果 + */ + + kMirrorTypeNone = 0, + /** + * + * @brief 本地预览时有镜像效果,编码传输时无镜像效果 + */ + + kMirrorTypeRender = 1, + /** + * + * @brief 本地预览时无镜像效果,仅编码传输时有镜像效果 + */ + + kMirrorTypeEncoder = 2, + /** + * + * @brief 本地预览和编码传输时均有镜像效果 + */ + + kMirrorTypeRenderAndEncoder = 3, +}; + + +/** + * + * @type keytype + * @brief 远端流的镜像类型。 + */ + +enum RemoteMirrorType { + /** + * + * @brief (默认值)远端视频渲染无镜像效果。 + */ + + kRemoteMirrorTypeNone = 0, + /** + * + * @brief 远端视频渲染有镜像效果。 + */ + + kRemoteMirrorTypeRender = 1, +}; + +/** + * + * @type keytype + * @brief 弱光适应类型 + */ + +enum VideoEnhancementMode { + /** + * + * @brief 关闭弱光适应 + */ + + kVideoEnhancementModeDisabled = 0, + /** + * + * @brief 开启弱光适应 + */ + + kVideoEnhancementModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 视频输入源类型 + */ + +enum VideoSourceType { + /** + * + * @brief 自定义采集视频源 + */ + + kVideoSourceTypeExternal = 0, + /** + * + * @brief 内部采集视频源 + */ + + kVideoSourceTypeInternal = 1, + /** + * + * @brief 自定义编码视频源。
+ * 你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流 + */ + + kVideoSourceTypeEncodedWithAutoSimulcast = 2, + /** + * + * @brief 自定义编码视频源。
+ * SDK 不会自动生成多路流,你需要自行生成并推送多路流 + */ + + kVideoSourceTypeEncodedWithoutAutoSimulcast = 3, +}; + +/** + * + * @type keytype + * @brief Alpha 通道相对于 RGB 通道数据的排列位置。 + */ + +enum AlphaLayout { + /** + * + * @brief Alpha 数据置于 RGB 数据上方。 + */ + + kAlphaLayoutTop = 0, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据下方。 + */ + + kAlphaLayoutBottom = 1, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据左方。 + */ + + kAlphaLayoutLeft = 2, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据右方。 + */ + + kAlphaLayoutRight = 3, +}; + +/** + * + * @type keytype + * @brief 数码变焦参数类型 + */ + +enum ZoomConfigType { + /** + * + * @brief 设置缩放系数 + */ + + kZoomConfigTypeFocusOffset = 0, + /** + * + * @brief 设置移动步长 + */ + + kZoomConfigTypeMoveOffset, +}; + +/** + * + * @type keytype + * @brief 数码变焦操作类型 + */ + +enum ZoomDirectionType { + /** + * + * @brief 相机向左移动 + */ + + kZoomDirectionTypeMoveLeft = 0, + /** + * + * @brief 相机向右移动 + */ + + kZoomDirectionTypeMoveRight, + /** + * + * @brief 相机向上移动 + */ + + kZoomDirectionTypeMoveUp, + /** + * + * @brief 相机向下移动 + */ + + kZoomDirectionTypeMoveDown, + /** + * + * @brief 相机缩小焦距 + */ + + kZoomDirectionTypeZoomOut, + /** + * + * @brief 相机放大焦距 + */ + + kZoomDirectionTypeZoomIn, + /** + * + * @brief 恢复到原始画面 + */ + + kZoomDirectionTypeReset, +}; + +/** + * + * @type keytype + * @brief 视频帧信息 + */ + +struct VideoFrameInfo { + /** + * + * @brief 宽(像素) + */ + + int width = 0; + /** + * + * @brief 高(像素) + */ + + int height = 0; + /** + * + * @brief 视频帧顺时针旋转角度。参看 VideoRotation{@link #VideoRotation}。 + */ + + VideoRotation rotation = VideoRotation::kVideoRotation0; +}; + +/** +* +* @type keytype +* @brief 自定义视频前处理(Video Processor)的作用范围,包括仅预览、仅编码和同时预览与编码。 +*/ + +enum ProcessorActionDomain { + /** + * + * @brief 处理后的视频帧同时用于本地预览和推流编码。 + */ + + kProcessorActionDomainPreviewAndEncode = 0, + /** + * + * @brief 处理后的视频帧仅用于本地预览。 + */ + + kProcessorActionDomainPreview = 1, + /** + * + * @brief 处理后的视频帧仅用于推流编码。 + */ + + kProcessorActionDomainEncode = 2 +}; +/** + * + * @type keytype + * @brief 视频前处理配置参数。 + */ + +struct VideoPreprocessorConfig { + /** + * + * @brief 视频帧像素格式,参看 VideoPixelFormat{@link #VideoPixelFormat}
+ * 当前仅支持 `kVideoPixelFormatI420` 和 `kVideoPixelFormatUnknown` 格式。 + */ + + VideoPixelFormat required_pixel_format = kVideoPixelFormatUnknown; + /** + * + * @brief 自定义视频前处理的作用范围,参看 ProcessorActionDomain{@link #ProcessorActionDomain}。 + */ + + ProcessorActionDomain action_domain = kProcessorActionDomainPreviewAndEncode; +}; + +/** + * + * @type keytype + * @brief 自定义编码流信息 + */ + +struct VideoRateInfo { + /** + * + * @brief 帧率,单位 fps + */ + + int fps = 0; + /** + * + * @brief 码率,单位 kbps + */ + + int bitrate_kbps = 0; + /** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `min_bitrate_kbps`。
+ * 默认值为 `0`。
+ * 范围:[0, bitrate_kbps),当 `bitrate_kbps` < `min_bitrate_kbps` 时,为适配码率模式。
+ * 以下情况,设置本参数无效:
+ * - 当 `bitrate_kbps` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `bitrate_kbps` < `0` 时,适配码率模式。 + */ + + int min_bitrate_kbps = 0; +}; + +/** + * + * @type keytype + * @brief 视频解码方式 + */ + +enum VideoDecoderConfig { + /** + * + * @brief 开启 SDK 内部解码,只回调解码后的数据。回调为 onFrame{@link #IVideoSink#onFrame}。 + */ + + kVideoDecoderConfigRaw, + /** + * + * @brief 开启自定义解码,只回调解码前数据。回调为 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame}。 + */ + + kVideoDecoderConfigEncode, + /** + * + * @brief 开启 SDK 内部解码,同时回调解码前和解码后的数据。回调为 onFrame{@link #IVideoSink#onFrame} 和 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame}。 + */ + + kVideoDecoderConfigBoth, +}; + +/** + * + * @type keytype + * @brief 视频采集配置参数。 + */ + +struct VideoCaptureConfig { + /** + * + * @type keytype + * @brief 视频采集模式 + */ + + enum CapturePreference { + /** + * + * @brief (默认)自动设置采集参数。
+ * SDK 在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。 + */ + + kAuto = 0, + /** + * + * @brief 手动设置采集参数,包括采集分辨率、帧率。 + */ + + kManual = 1, + /** + * + * @brief 采集参数与编码参数一致,即在 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 中设置的参数。 + */ + + kAutoPerformance = 2, + }; + /** + * + * @brief 视频采集模式,参看 CapturePreference{@link #CapturePreference}. + */ + + CapturePreference capture_preference = CapturePreference::kAuto; + + /** + * + * @brief 视频采集分辨率的宽度,单位:px。 + */ + + int width = 0; + /** + * + * @brief 视频采集分辨率的高度,单位:px。 + */ + + int height = 0; + /** + * + * @brief 视频采集帧率,单位:fps。 + */ + + int frame_rate = 0; +}; + +/** + * + * @type keytype + * @brief 本地录制的媒体类型 + */ + +enum RecordingType { + /** + * + * @brief 只录制音频 + */ + + kRecordingTypeAudioOnly = 0, + /** + * + * @brief 只录制视频 + */ + + kRecordingTypeVideoOnly = 1, + /** + * + * @brief 同时录制音频和视频 + */ + + kRecordingTypeVideoAndAudio = 2, +}; + +/** + * + * @type keytype + * @brief 当前视频设备类型 + */ + +enum RTCVideoDeviceType { + /** + * + * @brief 未知设备类型 + */ + + kRTCVideoDeviceTypeUnknown = -1, + /** + * + * @brief 视频渲染设备类型 + */ + + kRTCVideoDeviceTypeRenderDevice = 0, + /** + * + * @brief 视频采集设备类型 + */ + + kRTCVideoDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流视频设备 + */ + + kRTCVideoDeviceTypeScreenCaptureDevice = 2, +}; + +/** + * + * @deprecated since 3.60, see onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent}. + * @type errorcode + * @brief WTN 流状态码 + */ + +enum PublicStreamErrorCode { + /** + * + * @brief 发布或订阅成功。 + */ + + kPublicStreamErrorCodeOK = 0, + /** + * + * @brief 订阅失败,发布端未开始发布流。 + */ + + kPublicStreamErrorCodePullNoPushStream = 1300, +}; + +/** + * + * @type keytype + * @brief 视频旋转模式 + */ + +enum VideoRotationMode { + /** + * + * @brief 跟随 App 界面方向 + */ + + kVideoRotationModeFollowApp = 0, + /** + * + * @brief 跟随设备重力方向 + */ + + kVideoRotationModeFollowGSensor = 1, +}; + +/** + * + * @type keytype + * @brief 媒体流类型 + */ + +enum MediaStreamType { + /** + * + * @brief 只控制音频 + */ + + kMediaStreamTypeAudio = 1 << 0, + /** + * + * @brief 只控制视频 + */ + + kMediaStreamTypeVideo = 1 << 1, + /** + * + * @brief 同时控制音频和视频 + */ + + kMediaStreamTypeBoth = kMediaStreamTypeAudio | kMediaStreamTypeVideo +}; +/** + * + * @type keytype + * @brief 占发布端原始帧率的比例 + */ + +enum FrameRateRatio { + /** + * + * @brief 100% + */ + + kFrameRateRatioOriginal = 0, + /** + * + * @brief 50% + */ + + kFrameRateRatioHalf = 1, + /** + * + * @brief 25% + */ + + kFrameRateRatioQuarter = 2, +}; +/** + * + * @type keytype + * @brief 远端视频帧信息 + */ + +struct RemoteVideoConfig { + /** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0 即满帧订阅,设为大于 0 的值时开始生效。
+ * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
+ * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + + int framerate = 0; + /** + * + * @brief 视频宽度,单位:px + */ + + int resolution_width = 0; + /** + * + * @brief 视频高度,单位:px + */ + + int resolution_height = 0; +}; + +/** + * + * @type keytype + * @brief 游戏房间类型 + */ + +enum GameRoomType { + /** + * + * @brief 小队房间。 + */ + + kGameRoomTypeTeam = 0, + /** + * + * @brief 世界房间。 + */ + + kGameRoomTypeWorld = 1 +}; + +/** + * + * @type keytype + * @brief 游戏场景类型 + */ + +enum GameSceneType { + /** + * + * @brief 普通场景。
+ * 同一个小队房间的队友,仅支持在同一个世界房间内通话。 + */ + + kGameSceneTypeNormal = 0, + /** + * + * @brief 主题公园场景。
+ * 同一个小队房间的队友,支持跨世界房间通话。 + */ + + kGameSceneTypeThemePark = 1 +}; + +/** + * + * @type keytype + * @brief 游戏房间配置。房间是 RTC 通话的抽象概念。在同一个房间中的用户可以进行音视频通话。 + */ + +struct GameRoomConfig { + /** + * + * @type keytype + * @brief 游戏房间类型。参看 GameRoomType{@link #GameRoomType},默认为 `kGameRoomTypeTeam`(小队房间),进房后不可更改。 + */ + + GameRoomType game_room_type = GameRoomType::kGameRoomTypeTeam; + /** + * + * @type keytype + * @brief 游戏场景类型。参看 GameSceneType{@link #GameSceneType},默认为 `kGameSceneTypeNormal`(普通场景),进房后不可更改。 + */ + + GameSceneType game_scene_type = GameSceneType::kGameSceneTypeNormal; +}; + +/** + * + * @type keytype + * @brief 房间参数配置。房间是 RTC 通话的抽象概念。在同一个房间中的用户可以进行音视频通话。 + */ + +struct RTCRoomConfig { + /** + * + * @brief 房间模式,参看 RoomProfileType{@link #RoomProfileType},默认为 `kRoomProfileTypeCommunication`,进房后不可更改。 + */ + + RoomProfileType room_profile_type = kRoomProfileTypeCommunication; + /** + * + * @brief 直播模式,参看 RoomLiveMode{@link #RoomLiveMode},默认为 `kRoomLiveModeCoHost`,进房后可通过 setLiveMode{@link #IRTCRoom#setLiveMode} 设置。 + * @note 只有当`room_profile_type`为`kRoomProfileTypeLive`时,`live_mode`的值才有效。 + */ + + RoomLiveMode live_mode = kRoomLiveModeCoHost; + /** + * + * @brief 流 ID。为进房发布的流设置流 ID,可设置为空字符串。若为空,SDK 自动生成 stream_id。 + */ + + const char* stream_id = nullptr; + /** + * + * @brief 是否自动发布音频流,默认为自动发布。 + * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + + bool is_auto_publish_audio = true; + /** + * + * @brief 是否自动发布视频流,默认为自动发布。
+ * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + + bool is_auto_publish_video = true; + + /** + * + * @brief 是否自动订阅音频流,默认为自动订阅。 + */ + + bool is_auto_subscribe_audio = true; + /** + * + * @brief 是否自动订阅视频流,默认为自动订阅。 + */ + + bool is_auto_subscribe_video = true; +}; + +/** + * + * @type keytype + * @brief 屏幕采集的媒体类型 + */ + +enum ScreenMediaType { + /** + * + * @brief 仅采集视频 + */ + + kScreenMediaTypeVideoOnly = 0, + /** + * + * @brief 仅采集音频 + */ + + kScreenMediaTypeAudioOnly = 1, + /** + * + * @brief 同时采集音频和视频 + */ + + kScreenMediaTypeVideoAndAudio = 2, +}; + +/** + * + * @type keytype + * @brief 基础美颜模式。 + */ + +enum EffectBeautyMode { + /** + * + * @brief 美白。 + */ + + kEffectBeautyModeWhite = 0, + /** + * + * @brief 磨皮。 + */ + + kEffectBeautyModeSmooth = 1, + /** + * + * @brief 锐化。 + */ + + kEffectBeautyModeSharpen = 2, + /** + * + * @valid since 3.55 + * @brief 清晰,需集成 v4.4.2+ 版本的特效 SDK。 + */ + + kEffectBeautyModeClear = 3, +}; + +/** + * + * @type keytype + * @brief 视频设备朝向类型 + */ + +enum VideoDeviceFacing { + /** + * + * @brief 前置摄像头 + */ + + kVideoDeviceFacingFront = 0, + /** + * + * @brief 后置摄像头 + */ + + kVideoDeviceFacingBack = 1, + /** + * + * @brief 未知类型 + */ + + kVideoDeviceFacingUnknown = 2, +}; + +/** + * + * @type keytype + * @brief 视频设备信息 + */ + +struct VideoDeviceInfo { + /** + * + * @brief 设备 ID + */ + + char device_id[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备名称 + */ + + char device_name[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备的厂商 ID + */ + + int64_t device_vid; + /** + * + * @brief 设备的产品编码 + */ + + int64_t device_pid; + /** + * + * @brief 设备的传输方式 + */ + + DeviceTransportType transport_type; + /** + * + * @brief 视频设备朝向类型 + */ + + VideoDeviceFacing device_facing; + /** + * + * @hidden constructor/destructor + */ + + VideoDeviceInfo() { + memset(device_id, 0, MAX_DEVICE_ID_LENGTH); + memset(device_name, 0, MAX_DEVICE_ID_LENGTH); + this->device_vid = 0; + this->device_pid = 0; + this->transport_type = DeviceTransportType::kDeviceTransportTypeUnknown; + this->device_facing = VideoDeviceFacing::kVideoDeviceFacingFront; + }; + /** + * + * @hidden constructor/destructor + */ + + VideoDeviceInfo& operator=(const VideoDeviceInfo& src) { + if (this != &src) { + strncpy(device_id, src.device_id, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_name, src.device_name, MAX_DEVICE_ID_LENGTH - 1); + device_id[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_name[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_vid = src.device_vid; + device_pid = src.device_pid; + transport_type = src.transport_type; + device_facing = src.device_facing; + } + + return *this; + } +}; + +/** + * + * @type keytype + * @brief 视频帧朝向 + */ + +enum VideoOrientation { + /** + * + * @brief (默认)使用相机输出的原始视频帧的角度,不对视频帧进行额外旋转。 + */ + + kVideoOrientationAdaptive = 0, + /** + * + * @brief 固定为竖屏,将相机采集到的视频帧转换为竖屏,在整个 RTC 链路中传递竖屏帧。 + */ + + kVideoOrientationPortrait = 1, + /** + * + * @brief 固定为横屏,将相机采集到的视频帧转换为横屏,在整个 RTC 链路中传递横屏帧。 + */ + + kVideoOrientationLandscape = 2 +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分状态改变原因。 + */ + +enum VideoSuperResolutionModeChangedReason { + /** + * + * @brief 调用 setRemoteVideoSuperResolution{@link #IRTCEngine#setRemoteVideoSuperResolution} 成功关闭超分。 + */ + + kVideoSuperResolutionModeChangedReasonAPIOff = 0, + /** + * + * @brief 调用 setRemoteVideoSuperResolution{@link #IRTCEngine#setRemoteVideoSuperResolution} 成功开启超分。 + */ + + kVideoSuperResolutionModeChangedReasonAPIOn = 1, + /** + * + * @brief 开启超分失败,远端视频流的原始视频分辨率超过 640 × 360 px。 + */ + + kVideoSuperResolutionModeChangedReasonResolutionExceed = 2, + /** + * + * @brief 开启超分失败,已对一路远端流开启超分。 + */ + + kVideoSuperResolutionModeChangedReasonOverUse = 3, + /** + * + * @brief 设备不支持使用超分辨率。 + */ + + kVideoSuperResolutionModeChangedReasonDeviceNotSupport = 4, + /** + * + * @brief 当前设备性能存在风险,已动态关闭超分。 + */ + + kVideoSuperResolutionModeChangedReasonDynamicClose = 5, + /** + * + * @brief 超分因其他原因关闭。 + */ + + kVideoSuperResolutionModeChangedReasonOtherSettingDisabled = 6, + /** + * + * @brief 超分因其他原因开启。 + */ + + kVideoSuperResolutionModeChangedReasonOtherSettingEnabled = 7, + /** + * + * @brief SDK 没有编译超分组件。 + */ + + kVideoSuperResolutionModeChangedReasonNoComponent = 8, + /** + * + * @brief 远端流不存在。房间 ID 或用户 ID 无效,或对方没有发布流。 + */ + + kVideoSuperResolutionModeChangedReasonStreamNotExist = 9, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 视频降噪模式状态改变原因。 + */ + +enum VideoDenoiseModeChangedReason { + /** + * + * @brief 未知原因导致视频降噪状态改变。 + */ + + kVideoDenoiseModeChangedReasonNull = -1, + /** + * + * @brief 通过调用 setVideoDenoiser{@link #IRTCEngine#setVideoDenoiser} 成功关闭视频降噪。 + */ + + kVideoDenoiseModeChangedReasonApiOff = 0, + /** + * + * @brief 通过调用 setVideoDenoiser{@link #IRTCEngine#setVideoDenoiser} 成功开启视频降噪。 + */ + + kVideoDenoiseModeChangedReasonApiOn = 1, + /** + * + * @brief 后台未配置视频降噪,视频降噪开启失败,请联系技术人员解决。 + */ + + kVideoDenoiseModeChangedReasonConfigDisabled = 2, + /** + * + * @brief 后台配置开启了视频降噪。 + */ + + kVideoDenoiseModeChangedReasonConfigEnabled = 3, + /** + * + * @brief 由于内部发生了异常,视频降噪关闭。 + */ + + kVideoDenoiseModeChangedReasonInternalException = 4, + /** + * + * @brief 当前设备性能过载,已动态关闭视频降噪。 + */ + + kVideoDenoiseModeChangedReasonDynamicClose = 5, + /** + * + * @brief 当前设备性能裕量充足,已动态开启视频降噪。 + */ + + kVideoDenoiseModeChangedReasonDynamicOpen = 6, + /** + * + * @brief + * 分辨率导致视频降噪状态发生改变。分辨率过高会导致性能消耗过大,从而导致视频降噪关闭。若希望继续使用视频降噪,可选择降低分辨率。 + */ + + kVideoDenoiseModeChangedReasonResolution = 7, +}; + +/** + * + * @type keytype + * @brief 屏幕采集对象的类型 + */ + +enum ScreenCaptureSourceType { + /** + * + * @brief 类型未知 + */ + + kScreenCaptureSourceTypeUnknown, + + /** + * + * @brief 应用程序的窗口 + */ + + kScreenCaptureSourceTypeWindow, + + /** + * + * @brief 桌面 + */ + + kScreenCaptureSourceTypeScreen +}; + +/** + * + * @type keytype + * @brief 屏幕共享对象的详细信息 + */ + +struct ScreenCaptureSourceInfo { + /** + * + * @brief 屏幕共享对象的类型,参看 ScreenCaptureSourceType{@link #ScreenCaptureSourceType} + */ + + ScreenCaptureSourceType type = kScreenCaptureSourceTypeUnknown; + + /** + * + * @brief 屏幕共享对象的 ID + */ + + view_t source_id = nullptr; + /** + * + * @brief 屏幕共享对象的名称
+ * 调用 release{@link #IScreenCaptureSourceList#release} 时将被释放,请及时转为 string 对象保存 + */ + + const char* source_name = nullptr; + /** + * + * @brief 共享的应用窗体所属应用的名称
+ * 当共享对象为应用窗体时有效
+ * 调用 release{@link #IScreenCaptureSourceList#release} 时将被释放,请及时转为 string 对象保存 + */ + + const char* application = nullptr; + /** + * + * @brief 共享的应用窗体所属应用进程的 pid
+ * 当共享对象为应用窗体时有效 + */ + + int pid = 0; + /** + * + * @brief 共享的屏幕是否为主屏。
+ * 当共享对象为屏幕时有效 + */ + + bool primary_monitor = false; + /** + * + * @brief 屏幕共享对象的坐标。详见 Rectangle{@link #Rectangle}。
+ * 仅在采集源为显示器屏幕时有效。
+ * - 对于多屏幕的场景,不同平台的坐标系原点不同: + * - 对于 Windows 平台,屏幕坐标以主屏左上角为原点 (0, 0),向右向下扩展。 + * — 对于 Linux 平台,屏幕坐标以 **恰好包住所有显示器的矩形区域的左上角** 为原点 (0, 0),向右向下扩展。
+ * - 对于不同平台,窗口区域不同: + * - 对于 Windows 和 macOS 平台,窗口区域包含系统标题栏。 + * - 对于 Linux 平台,窗口区域不包含系统标题栏。 + */ + + Rectangle region_rect; +}; +/** + * + * @type api + * @brief 屏幕共享对象信息列表
+ * 共享对象相关数据将在调用 release{@link #IScreenCaptureSourceList#release} 后被释放。 + * @list 屏幕共享 + */ + +class IScreenCaptureSourceList { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IScreenCaptureSourceList() { + } + /** + * + * @type api + * @brief 获取列表长度 + * @return 可共享对象数量 + * @list 屏幕共享 + */ + + virtual int32_t getCount() = 0; + /** + * + * @type api + * @brief 根据索引号,获取屏幕共享列表中的元素 + * @param index 列表索引号 + * @return 屏幕源类型信息,详见 ScreenCaptureSourceInfo{@link #ScreenCaptureSourceInfo}。 + * @list 屏幕共享 + */ + + virtual ScreenCaptureSourceInfo getSourceInfo(int32_t index) = 0; + /** + * + * @type api + * @brief IScreenCaptureSourceList{@link #IScreenCaptureSourceList} 使用结束后,调用本接口删除对象,清空和释放内存。 + * @list 屏幕共享 + */ + + virtual void release() = 0; +}; +/** + * + * @type callback + * @brief 自定义编码帧回调类
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Screen Sharing + */ + +class IExternalVideoEncoderEventHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IExternalVideoEncoderEventHandler(){} + /** + * + * @type callback + * @brief 提示自定义编码帧可以开始推送的回调。
+ * 收到该回调后,你即可调用 pushExternalEncodedVideoFrame{@link #IRTCEngine#pushExternalEncodedVideoFrame} 向 SDK 推送自定义编码视频帧 + * @param stream_id 编码流 ID + * @param stream_info 编码流信息,参看 StreamInfo{@link #StreamInfo} + * @list 自定义流处理 + */ + + virtual void onStart(const char* stream_id, const StreamInfo& stream_info) = 0; + /** + * + * @type callback + * @brief 当收到该回调时,你需停止向 SDK 推送自定义编码视频帧 + * @param stream_id 编码流 ID + * @param stream_info 编码流信息,参看 StreamInfo{@link #StreamInfo} + * @list 自定义流处理 + */ + + virtual void onStop(const char* stream_id, const StreamInfo& stream_info) = 0; + /** + * + * @type callback + * @brief 当自定义编码流的帧率或码率发生变化时,触发该回调 + * @param stream_id 远端编码流 ID + * @param stream_info 远端编码流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_index 对应编码流的下标 + * @param info 变化后的编码流信息,参看 VideoRateInfo{@link #VideoRateInfo} + * @list 自定义流处理 + */ + + virtual void onRateUpdate(const char* stream_id, const StreamInfo& stream_info, int32_t video_index, VideoRateInfo info) = 0; + /** + * + * @type callback + * @brief 提示流发布端需重新生成关键帧的回调 + * @param stream_id 远端编码流 ID + * @param stream_info 远端编码流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_index 对应编码流的下标 + * @list 自定义流处理 + */ + + virtual void onRequestKeyFrame(const char* stream_id, const StreamInfo& stream_info, int32_t video_index) = 0; + /** + * + * @valid since 3.56 + * @type callback + * @brief 作为自定义编码视频流的发送端,你会在视频流可发送状态发生变化时,收到此回调。
+ * 你可以根据此回调的提示,仅对可发送的视频流进行编码,以降低本端视频编码性能消耗。此回调会根据多个因素综合判断触发,包括:本端设备性能和本端网络性能,以及按需订阅场景下,远端用户是否订阅。 + * @param stream_id 远端编码流 ID + * @param stream_info 远端编码流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_index 对应编码流的下标 + * @param active 该路流可发送状态 + * @note 要收到此回调,必须调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 设置视频源是自定义编码,且通过 setExternalVideoEncoderEventHandler{@link #IRTCEngine#setExternalVideoEncoderEventHandler} 设置了回调句柄。 + * @list 自定义流处理 + */ + + virtual void onActiveVideoLayer(const char* stream_id, const StreamInfo& stream_info, int32_t video_index, bool active) = 0; +}; +/** + * + * @type callback + * @brief 本地视频帧监测器
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 自定义流处理 + */ + +class ILocalEncodedVideoFrameObserver { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~ILocalEncodedVideoFrameObserver() { + } + /** + * + * @type callback + * @brief 调用 registerLocalEncodedVideoFrameObserver{@link #IRTCEngine#registerLocalEncodedVideoFrameObserver} 后,SDK 每次使用内部采集,采集到一帧视频帧,或收到一帧外部视频帧时,都会回调该事件。 + * @param video_source 预留参数。 + * @param video_stream 本地视频帧信息,参看 IEncodedVideoFrame{@link #IEncodedVideoFrame} + * @list 自定义流处理 + */ + + virtual void onLocalEncodedVideoFrame(IVideoSource *video_source, const IEncodedVideoFrame& video_stream) = 0; +}; +/** + * + * @type callback + * @brief 远端编码后视频数据监测器
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频管理 + */ + +class IRemoteEncodedVideoFrameObserver { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRemoteEncodedVideoFrameObserver() { + } + /** + * + * @type callback + * @brief 调用 registerRemoteEncodedVideoFrameObserver{@link #IRTCEngine#registerRemoteEncodedVideoFrameObserver} 后,SDK 监测到远端编码后视频数据时,触发该回调 + * @param stream_id 收到的远端流 ID + * @param stream_info 收到的远端流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_stream 收到的远端视频帧信息,参看 IEncodedVideoFrame{@link #IEncodedVideoFrame} + * @list 自定义流处理 + */ + + virtual void onRemoteEncodedVideoFrame(const char* stream_id, const StreamInfo& stream_info, const IEncodedVideoFrame& video_stream) = 0; +}; + +/** + * + * @type keytype + * @brief 视频帧中包含的 metadata 信息 + */ + +struct VideoMetadataBuffer { + /** + * + * @brief 接收或者发送的 metadata + */ + + char* data; + /** + * + * @brief 接收或者发送的 metadata 数据大小,不能超过 1024 + */ + + int size; + /** + * + * @brief 包含 metadata 视频帧的时间戳,单位微秒 + */ + + int64_t timestamp_us; +}; + +/** + * + * @hidden(Linux) + * @type callback + * @brief 截图的回调。
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Video Management + */ + +class ISnapshotResultCallback { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~ISnapshotResultCallback() = default; + /** + * + * @type callback + * @brief 调用 takeLocalSnapshot{@link #IRTCEngine#takeLocalSnapshot} 截取视频画面时,收到此回调。 + * @param task_id 本地截图任务的编号。和 takeLocalSnapshot{@link #IRTCEngine#takeLocalSnapshot} 的返回值一致。 + * @param video_source 截图的视频源,参看IVideoSource{@link #IVideoSource}。 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param error_code 截图错误码:
+ * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + + virtual void onTakeLocalSnapshotResult(long task_id, IVideoSource* video_source, IVideoFrame* image, int error_code) = 0; + /** + * + * @type callback + * @brief 调用 takeRemoteSnapshot{@link #IRTCEngine#takeRemoteSnapshot} 截取视频画面时,收到此回调。 + * @param task_id 远端截图任务的编号。和 takeRemoteSnapshot{@link #IRTCEngine#takeRemoteSnapshot} 的返回值一致。 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param error_code 截图错误码:
+ * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + + virtual void onTakeRemoteSnapshotResult(long task_id, const char* stream_id, const StreamInfo& stream_info, IVideoFrame* image, int error_code) = 0; +}; +/** + * + * @hidden(macOS, Windows, Linux) + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +struct MediaTypeEnhancementConfig { + /** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_signaling = false; + /** + * + * @brief 对屏幕共享以外的其他音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_audio = false; + /** + * + * @brief 对屏幕共享音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_screen_audio = false; + /** + * + * @brief 对屏幕共享视频以外的其他视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_video = false; + /** + * + * @brief 对屏幕共享视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_screen_video = false; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines_ex.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines_ex.h new file mode 100644 index 0000000..3d7e0b0 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines_ex.h @@ -0,0 +1,183 @@ + + + +#pragma once +namespace bytertc { +/** + * + * @type keytype + * @brief 视频内容类型 + */ + +enum VideoContentCategory { + /** + * + * @brief 相机采集的内容 + */ + + kVideoContentCategoryCamera = 0, + /** + * + * @brief 屏幕共享的内容 + */ + + kVideoContentCategoryScreen = 1, +}; +/** + * + * @type keytype + * @brief 视频源设置 + */ + +struct VideoSourceConfig { + /** + * + * @brief 视频源类型。参看 VideoSourceType{@link #VideoSourceType}。默认是 `kVideoSourceTypeExternal`。 + */ + + VideoSourceType source_type = kVideoSourceTypeExternal; + /** + * + * @brief 参看 VideoContentCategory{@link #VideoContentCategory}。默认是 `kVideoContentCategoryCamera`。 + */ + /** + * + * @brief Refer to VideoContentCategory{@link #VideoContentCategory}. It defaults to `kVideoContentCategoryCamera`. + */ + VideoContentCategory content_category = kVideoContentCategoryCamera; +}; +/** + * + * @type keytype + * @brief 音频源包含的内容 + */ + +struct AudioContentTypeConfig { + /** + * + * @brief 包含麦克风采集的音频 + */ + + bool has_mic = true; + /** + * + * @brief 包含屏幕音频 + */ + + bool has_screen_audio = false; + /** + * + * @brief 包含媒体播放器的音频 + */ + + bool has_media_player = false; +}; +/** + * + * @type keytype + * @brief 音频编码设置。 + */ + +struct AudioEncodeConfig { + /** + * + * @brief 编码器类型。
+ * + 0:OPUS
+ * + 1:NICO
+ * + -1:配置下发的配置 + */ + + int codec_type = -1; + /** + * + * @brief 编码模式
+ * + 0:语音
+ * + 1:音乐
+ * + -1:根据 `channel_num` 不同,使用对应的编码模式。声道数为 `1` 时,编码模式是语音;声道数为 `2` 时,编码模式是音乐。 + */ + int enc_mode = -1; + /** + * + * @brief 声道数。取值范围是:`{1, 2}`。默认值是 `-1`,配置下发的配置。 + */ + int channel_num = -1; + /** + * + * @brief 码率。取值范围:`[6K, 510K]`。 + */ + int enc_bitrate = -1; + /** + * + * @brief 是否启用非连续传输功能(DTX)。非连续传输功能能够在安静的场景下降低码率。
+ * + 0:关闭
+ * + 1:打开
+ * + -1:配置下发的配置 + */ + int use_dtx = -1; + /** + * + * @brief 带内前向纠错功能。能够提供一定的抗丢包能力。
+ * + 0:关闭
+ * + 1:打开
+ * + -1:配置下发的配置 + */ + int use_inbandfec = -1; + /** + * + * @brief 采样率。取值范围是 `[16K, 48K]`。
+ * 修改此参数会触发编码器重启。 + */ + int sample_rate = -1; + /** + * + * @brief 编码帧长。取值范围:`{10, 20, 40, 60, 120}`。 + */ + int packet_size = -1; +}; +/** + * + * @type keytype + * @brief 媒体流的优先级 + */ +enum StreamPriority { + /** + * + * @brief 低优先级 + */ + kStreamPriorityLow = 0, + /** + * + * @brief 中优先级 + */ + kStreamPriorityNormal = 1, + /** + * + * @brief 高优先级 + */ + kStreamPriorityHigh = 2, +}; + +/** + * + * @type keytype + * @brief + */ +struct StreamKey { + /** + * + * @brief 房间 ID + */ + const char* room_id; + /** + * + * @brief 用户 ID + */ + const char* user_id; + /** + * + * @brief 流索引。参看 StreamIndex{@link #StreamIndex}。 + */ + StreamIndex stream_index; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_device_manager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_device_manager.h new file mode 100644 index 0000000..08cae2a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_device_manager.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Device Manager +*/ + +#pragma once + +#include "bytertc_audio_device_manager.h" +#include "bytertc_video_defines.h" + +namespace bytertc { +/** + * + * @type api + * @brief 视频设备相关的信息 + * @list 引擎管理 + */ + +class IVideoDeviceCollection : public IDeviceCollection { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IVideoDeviceCollection() {}; + /** + * + * @type api + * @brief 获取当前系统内视频设备数量 + * @return 视频设备数量 + * @list 引擎管理 + */ + + virtual int getCount() override {return 0;}; + /** + * + * @type api + * @brief 获取视频设备信息,可根据索引号、设备名称、设备 ID 获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IVideoDeviceCollection#getCount} 返回值。 + * @param device_name 设备名称 + * @param device_id 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, char device_name[MAX_DEVICE_ID_LENGTH], char device_id[MAX_DEVICE_ID_LENGTH]) override {return 0;}; + /** + * + * @type api + * @brief 释放当前 IVideoDeviceCollection{@link #IVideoDeviceCollection} 对象占用的资源。 + * @note 不需要返回视频设备相关信息列表时应该调用本方法释放相关资源。 + * @list 引擎管理 + */ + + virtual void release()override {}; + /** + * + * @type api + * @brief 获取视频设备信息,可根据索引号、设备信息(ID、设备的产品编码等)。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IVideoDeviceCollection#getCount} 返回值。 + * @param video_device_info 设备信息 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, VideoDeviceInfo* video_device_info) = 0; +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoDeviceCollection() {}; +}; +/** + * + * @type api + * @brief 主要用于枚举、设置视频采集设备 + * @list 视频管理 + */ + +class IVideoDeviceManager { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IVideoDeviceManager() { + } + /** + * + * @type api + * @brief 获取当前系统内视频采集设备列表。 + * @return 包含系统中所有视频采集设备的列表,参看 IVideoDeviceCollection{@link #IVideoDeviceCollection}。
+ * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 监听到 `kMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 视频管理 + */ + + virtual IVideoDeviceCollection* enumerateVideoCaptureDevices() = 0; + /** + * + * @type api + * @brief 设置当前视频采集设备 + * @param device_id 视频设备 ID,可以通过 enumerateVideoCaptureDevices{@link #IVideoDeviceManager#enumerateVideoCaptureDevices} 获取 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + + virtual int setVideoCaptureDevice(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 获取当前 SDK 正在使用的视频采集设备信息 + * @param device_id 视频设备 ID。此参数同时是入参和出参。 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + + virtual int getVideoCaptureDevice(char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoDeviceManager() { + } +}; + + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_effect_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_effect_interface.h new file mode 100644 index 0000000..06ec3b1 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_effect_interface.h @@ -0,0 +1,655 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Effect Interface +*/ + +#pragma once + +#include +#include "bytertc_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 虚拟背景类型。 + */ + +enum VirtualBackgroundSourceType { + /** + * + * @brief 使用纯色背景替换视频原有背景。 + */ + + kVirtualBackgroundSourceTypeColor = 0, + /** + * + * @brief 使用自定义图片替换视频原有背景。 + */ + + kVirtualBackgroundSourceTypeImage = 1, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人像属性检测参数 + */ + +struct VideoEffectExpressionDetectConfig { + /** + * + * @brief 是否开启年龄检测。 + */ + + bool detect_age = false; + /** + * + * @brief 是否开启性别检测。 + */ + + bool detect_gender = false; + /** + * + * @brief 是否开启表情检测。 + */ + + bool detect_emotion = false; + /** + * + * @brief 是否开启吸引力检测。 + */ + + bool detect_attractiveness = false; + /** + * + * @brief 是否开启开心程度检测。 + */ + + bool detect_happiness = false; +}; + +/** + * + * @type keytype + * @brief 虚拟背景对象。 + */ + +struct VirtualBackgroundSource { + /** + * + * @brief 虚拟背景类型,详见 VirtualBackgroundSourceType{@link #VirtualBackgroundSourceType} 。 + */ + + VirtualBackgroundSourceType source_type = kVirtualBackgroundSourceTypeColor; + /** + * + * @brief 纯色背景使用的颜色。
+ * 格式为 0xAARRGGBB 。 + */ + + uint32_t source_color = 0xFFFFFFFF; + /** + * + * @brief 自定义背景图片的绝对路径。
+ * - 支持的格式为 jpg、jpeg、png。 + * - 图片分辨率超过 1080P 时,图片会被等比缩放至和视频一致。 + * - 图片和视频宽高比一致时,图片会被直接缩放至和视频一致。 + * - 图片和视频长宽比不一致时,为保证图片内容不变形,图片按短边缩放至与视频帧一致,使图片填满视频帧,对多出的高或宽进行剪裁。 + * - 自定义图片带有局部透明效果时,透明部分由黑色代替。 + */ + + const char* source_path = nullptr; +}; +/** + * + * @type keytype + * @brief 人脸检测结果 + */ + +struct FaceDetectResult { + /** + * + * @brief 人脸信息存储上限,最多可存储 10 个人脸信息 + */ + + static const int max_face_num = 10; + /** + * + * @brief 人脸检测结果
+ * - 0:检测成功 + * - !0:检测失败。详见[错误码](https: + */ + + int detect_result = 0; + /** + * + * @brief 检测到的人脸的数量 + */ + + int face_count = 0; + /** + * + * @brief 识别到人脸的矩形框。数组的长度和检测到的人脸数量一致。参看 Rectangle{@link #Rectangle}。 + */ + + Rectangle rect[max_face_num]; + /** + * + * @brief 原始图片宽度(px) + */ + + int image_width = 0; + /** + * + * @brief 原始图片高度(px) + */ + + int image_height = 0; + /** + * + * @brief 进行人脸识别的视频帧的时间戳。 + */ + + int64_t frame_timestamp_us = 0; +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人像属性检测信息 + */ + +struct ExpressionDetectInfo { + /** + * + * @brief 预测年龄,取值范围 (0, 100)。 + */ + + float age = 0; + /** + * + * @brief 预测为男性的概率,取值范围 (0.0, 1.0)。 + */ + + float boy_prob = 0; + /** + * + * @brief 预测的吸引力分数,取值范围 (0, 100)。 + */ + + float attractive = 0; + /** + * + * @brief 预测的微笑程度,取值范围 (0, 100)。 + */ + + float happy_score = 0; + /** + * + * @brief 预测的伤心程度,取值范围 (0, 100)。 + */ + + float sad_score = 0; + /** + * + * @brief 预测的生气程度,取值范围 (0, 100)。 + */ + + float angry_score = 0; + /** + * + * @brief 预测的吃惊程度,取值范围 (0, 100)。 + */ + + float surprise_score = 0; + /** + * + * @brief 预测的情绪激动程度,取值范围 (0, 100)。 + */ + + float arousal = 0; + /** + * + * @brief 预测的情绪正负程度,取值范围 (-100, 100)。 + */ + + float valence = 0; +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人像属性检测结果 + */ + +struct ExpressionDetectResult { + /** + * + * @brief 人脸信息存储上限,最多可存储 10 个人脸信息 + */ + + static const int max_face_num = 10; + /** + * + * @brief 特征识别结果
+ * - 0:识别成功 + * - !0:识别失败 + */ + + int detect_result = 0; + /** + * + * @brief 识别到的人脸数量。 + */ + + int face_count = 0; + /** + * + * @brief 特征识别信息。数组的长度和检测到的人脸数量一致。参看 ExpressionDetectInfo{@link #ExpressionDetectInfo}。 + */ + + ExpressionDetectInfo detect_info[max_face_num]; +}; +/** + * + * @type callback + * @brief 人脸检测结果回调观察者
+ * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频处理 + */ + +class IFaceDetectionObserver { +public: + /** + * + * @type callback + * @brief 特效 SDK 进行人脸检测结果的回调。
+ * 调用 enableFaceDetection{@link #IVideoEffect#enableFaceDetection} 注册了 IFaceDetectionObserver{@link #IFaceDetectionObserver},并使用 RTC SDK 中包含的特效 SDK 进行视频特效处理时,你会收到此回调。 + * @param result 人脸检测结果, 参看 FaceDetectResult{@link #FaceDetectResult}。 + * @list 视频管理 + */ + + virtual void onFaceDetectResult(const FaceDetectResult& result) = 0; + /** + * + * @hidden for internal use only + * @type callback + * @brief 特效 SDK 进行人像属性检测结果的回调。
+ * 调用 registerFaceDetectionObserver注册了 IFaceDetectionObserver{@link #IFaceDetectionObserver},并调用 setVideoEffectExpressionDetect{@link #IVideoEffect#setVideoEffectExpressionDetect} 开启人像属性检测后,你会收到此回调。 + * @param result 人像属性检测结果, 参看 ExpressionDetectResult{@link #ExpressionDetectResult}。 + * @list 视频处理 + */ + + virtual void onExpressionDetectResult(const ExpressionDetectResult& result) = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IFaceDetectionObserver() { + } +}; +/** + * + * @type api + * @brief 高级视频特效,参看[集成指南](https: + * @list 视频处理 + */ + +class IVideoEffect { +public: + virtual ~IVideoEffect() = default; + /** + * + * @type api + * @brief 检查视频特效证书,设置算法模型路径,并初始化特效模块。 + * @param license_file_path 证书文件的绝对路径,用于鉴权。 + * @param algo_model_dir 算法模型绝对路径,即存放特效 SDK 所有算法模型的目录。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 鉴权时,会检查 CV 服务端时间和本地设备的时间差异。你必须保证本地系统时间和实际时间一致。 + * @list 视频处理 + */ + + virtual int initCVResource(const char* license_file_path, const char* algo_model_dir) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置视频特效算法模型地址,并初始化特效模块。 + * @param finder ResourceFinder 地址 + * @param deleter ResourceDeleter 地址 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + + virtual int setAlgoModelResourceFinder(uintptr_t finder, uintptr_t deleter) = 0; + /** + * + * @hidden(iOS, Android) + * @type api + * @brief 从特效 SDK 获取授权消息,用于获取在线许可证。 + * @param ppmsg 授权消息字符串地址 + * @param len 授权消息字符串的长度 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 使用视频特效的功能前,你必须获取特效 SDK 的在线许可证。 + * - 通过此接口获取授权消息后,你必须参考 [在线授权说明](https: + * - 获取授权消息后,调用 freeAuthMessage{@link #IVideoEffect#freeAuthMessage} 释放内存。 + * @list 视频处理 + */ + + virtual int getAuthMessage(char ** ppmsg, int * len) = 0; + /** + * + * @hidden(iOS,Android) + * @type api + * @brief 使用完授权消息字符串后,释放内存。 + * @param pmsg getAuthMessage 返回的授权消息字符串。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int freeAuthMessage(char * pmsg) = 0; + + /** + * + * @hidden for internal use only + * @region 视频处理 + * @brief 返回视频特效句柄。私有接口 + */ + + virtual void* getEffectHandle() = 0; + /** + * + * @type api + * @brief 开启高级美颜、滤镜等视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource{@link #IVideoEffect#initCVResource} 进行初始化。 + * - 调用该方法后,特效不直接生效,你还需调用 setEffectNodes{@link #IVideoEffect#setEffectNodes} 设置视频特效素材包或调用 setColorFilter{@link #IVideoEffect#setColorFilter} 设置滤镜。 + * - 调用 disableVideoEffect{@link #IVideoEffect#disableVideoEffect} 关闭视频特效。 + * @list 视频处理 + */ + + virtual int enableVideoEffect() = 0; + /** + * + * @type api + * @brief 关闭视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect} 开启视频特效。 + * @list 视频处理 + */ + + virtual int disableVideoEffect() = 0; + /** + * + * @type api + * @brief 设置视频特效素材包。 + * @param effect_node_paths 特效素材包绝对路径数组。
+ * 要取消当前视频特效,将此参数设置为 null。 + * @param node_num 特效素材包个数。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + + virtual int setEffectNodes(const char** effect_node_paths, int node_num) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 叠加视频特效素材包。 + * @param effect_node_paths 特效素材包绝对路径数组。 + * @param node_num 特效素材包个数。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 该接口会在 setEffectNodes{@link #IVideoEffect#setEffectNodes} 设置的特效基础上叠加特效。 + * @list Video Processing + */ + + virtual int appendEffectNodes(const char** effect_node_paths, int node_num) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 移除指定的视频特效资源。 + * @param effect_node_paths 特效素材包绝对路径数组。 + * @param node_num 特效素材包个数。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 移除 setEffectNodes{@link #IVideoEffect#SetEffectNodes} 或 appendEffectNodes{@link #IVideoEffect#appendEffectNodes} 设置的视频特效资源。 + * @list Video Processing + */ + + virtual int removeEffectNodes(const char** effect_node_paths, int node_num) = 0; + /** + * + * @type api + * @brief 设置特效强度。 + * @param effect_node_path 特效素材包绝对路径,参考[素材包结构说明](https: + * @param node_key 需要设置的素材 key 名称,参考[素材 key 对应说明](https: + * @param node_value 特效强度值,取值范围 [0,1],超出范围时设置无效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int updateEffectNode(const char* effect_node_path, const char* node_key, float node_value) = 0; + /** + * + * @type api + * @brief 设置颜色滤镜。 + * @param res_path 滤镜资源包绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 setColorFilterIntensity{@link #IVideoEffect#setColorFilterIntensity} 设置已启用颜色滤镜的强度。设置强度为 0 时即关闭颜色滤镜。 + * @list 视频处理 + */ + + virtual int setColorFilter(const char* res_path) = 0; + /** + * + * @type api + * @brief 设置已启用颜色滤镜的强度。 + * @param intensity 滤镜强度。取值范围 [0,1],超出范围时设置无效。
+ * 当设置滤镜强度为 0 时即关闭颜色滤镜。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int setColorFilterIntensity(float intensity) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 私有接口,设置视频特效素材包。 + * @param sticker_path 特效素材包绝对路径。
+ * 要取消当前视频特效,将此参数设置为 null。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list Video Processing + */ + + virtual int applyStickerEffect(const char* sticker_path) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置 Effect SDK 特效素材包。 + * @param effect_path 特效素材包绝对路径。传入空字符串或 null 时清空当前特效。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。 + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + + virtual int setEffect(const char* effect_path) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 重置当前贴纸特效。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。 + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + + virtual int resetSticker() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 将摄像头采集画面中的人像背景替换为指定图片或纯色背景。 + * @param background_sticker_path 背景贴纸特效素材绝对路径。 + * @param source 背景贴纸对象,参看 VirtualBackgroundSource{@link #VirtualBackgroundSource}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource{@link #IVideoEffect#initCVResource} 进行初始化。 + * - 调用 disableVirtualBackground{@link #IVideoEffect#disableVirtualBackground} 关闭虚拟背景。 + * @list 视频处理 + */ + + virtual int enableVirtualBackground(const char* background_sticker_path, const VirtualBackgroundSource& source) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 关闭虚拟背景。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVirtualBackground{@link #IVideoEffect#enableVirtualBackground} 开启虚拟背景后,可以调用此接口关闭虚拟背景。 + * @list 视频处理 + */ + + virtual int disableVirtualBackground() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 开启人像属性检测。 + * @param expression_detection_config 人像属性检测参数,参看 VideoEffectExpressionDetectConfig{@link #VideoEffectExpressionDetectConfig}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + + virtual int setVideoEffectExpressionDetect(const VideoEffectExpressionDetectConfig& expression_detection_config) = 0; + /** + * + * @type api + * @brief 开启人脸识别功能,并设置人脸检测结果回调观察者。
+ * 回调此观察者后,你会周期性收到 onFaceDetectResult{@link #IFaceDetectionObserver#onFaceDetectResult} 回调。 + * @param observer 人脸检测结果回调观察者,参看 IFaceDetectionObserver{@link #IFaceDetectionObserver}。 + * @param interval_ms 两次回调之间的最小时间间隔,必须大于 0,单位为毫秒。实际收到回调的时间间隔大于 interval_ms,小于 interval_ms+视频采集帧间隔。 + * @param face_model_path 人脸检测算法模型文件路径,一般为 ttfacemodel 文件夹中 tt_face_vXXX.model 文件的绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - -1004: 初始化中,初始化完成后启动此功能。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int enableFaceDetection(IFaceDetectionObserver* observer, unsigned int interval_ms, const char* face_model_path) = 0; + /** + * + * @type api + * @brief 关闭人脸识别功能。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int disableFaceDetection() = 0; + +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_frame.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_frame.h new file mode 100644 index 0000000..5eee164 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_frame.h @@ -0,0 +1,1372 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Frame + */ + +#pragma once + +#include +#include +#include +#include +#include "bytertc_media_defines.h" +#ifdef BYTERTC_ANDROID +#include +#endif + +namespace bytertc { + +/** + * + * @type keytype + * @brief 编码帧类型 + */ + +enum VideoPictureType { + /** + * + * @brief 未知类型 + */ + + kVideoPictureTypeUnknown = 0, + /** + * + * @brief I 帧,关键帧,编解码不需要参考其他视频帧 + */ + + kVideoPictureTypeI, + /** + * + * @brief P 帧,向前参考帧,编解码需要参考前一帧视频帧 + */ + + kVideoPictureTypeP, + /** + * + * @brief B 帧,前后参考帧,编解码需要参考前后两帧视频帧 + */ + + kVideoPictureTypeB +}; + +/** + * + * @type keytype + * @brief 视频帧旋转信息 + */ + +enum VideoRotation { + /** + * + * @brief 不旋转 + */ + + kVideoRotation0 = 0, + /** + * + * @brief 顺时针旋转 90 度 + */ + + kVideoRotation90 = 90, + /** + * + * @brief 顺时针旋转 180 度 + */ + + kVideoRotation180 = 180, + /** + * + * @brief 顺时针旋转 270 度 + */ + + kVideoRotation270 = 270 +}; + +/** + * + * @type keytype + * @brief 视频帧缩放模式,默认值为 FitWithCropping。 + */ + +enum VideoStreamScaleMode { + /** + * + * @brief 自动模式 + */ + + kVideoStreamScaleModeAuto = 0, + /** + * + * @brief 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。 + */ + + kVideoStreamScaleModeStretch = 1, + /** + * + * @brief 视窗填满优先。
+ * 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
+ * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + */ + + kVideoStreamScaleModeFitWithCropping = 2, + /** + * + * @brief 视频帧内容全部显示优先。
+ * 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。
+ * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 + */ + + kVideoStreamScaleModeFitWithFilling = 3, +}; + + +/** + * + * @type keytype + * @brief 视频编码模式 + */ + +enum VideoCodecMode { + /** + * + * @brief 自动选择 + */ + + kVideoCodecModeAuto = 0, + /** + * + * @brief 硬编码 + */ + + kVideoCodecModeHardware, + /** + * + * @brief 软编码 + */ + + kVideoCodecModeSoftware, +}; + +/** + * + * @type keytype + * @brief 编码策略偏好。 + */ + +enum VideoEncodePreference { + /** + * + * @brief 无偏好。不降低帧率和分辨率。 + */ + + kVideoEncodePreferenceDisabled = 0, + /** + * + * @brief 优先保障帧率。适用于动态画面。 + */ + + kVideoEncodePreferenceFramerate, + /** + * + * @brief 清晰模式,优先保障分辨率。适用于静态画面。 + */ + + kVideoEncodePreferenceQuality, + /** + * + * @brief 平衡帧率与分辨率。 + * 对于屏幕流来说是开启自动模式智能模式,将根据屏幕内容智能决策选择流畅模式或清晰模式。 + */ + + kVideoEncodePreferenceAuto, +}; + + +/** + * + * @type keytype + * @brief 摄像头。 + */ + +enum CameraID { + /** + * + * @brief 移动端前置摄像头,PC 端内置摄像头 + */ + + kCameraIDFront = 0, + /** + * + * @brief 移动端后置摄像头,PC 端无定义 + */ + + kCameraIDBack = 1, + /** + * + * @hidden currently not available + * @brief 外接摄像头 + */ + + kCameraIDExternal = 2, + /** + * + * @brief 无效值 + */ + + kCameraIDInvalid = 3 +}; + + +#define SEND_KBPS_AUTO_CALCULATE -1 +#define SEND_KBPS_DISABLE_VIDEO_SEND 0 + +/** + * + * @deprecated since 3.36 along with setVideoEncoderConfig(StreamIndex index, const VideoSolution* solutions, int solution_num) = 0; + * @type keytype + * @brief 视频流参数 + */ + +struct VideoSolution { + /** + * + * @brief 视频宽度,单位:像素 + */ + + int width; + /** + * + * @brief 视频高度,单位:像素 + */ + + int height; + /** + * + * @brief 视频帧率 + */ + + int fps; + /** + * + * @brief 最大发送编码码率(kbps),建议使用默认的自动码率。
  • -1: 自动码率
  • 0: 不开启上限
  • >0: 填写预估码率
  • + */ + + int max_send_kbps = SEND_KBPS_AUTO_CALCULATE; + int min_send_kbps = 0; + /** + * + * @brief 视频编码质量策略,参看 VideoEncodePreference{@link #VideoEncodePreference} + */ + + VideoEncodePreference encode_preference = VideoEncodePreference::kVideoEncodePreferenceFramerate; +}; + +/** + * + * @hidden for internal use only on Windows and Android + * @type keytype + * @brief 视野范围(Fov)内的视频帧信息
    + * Tile 是 全景视频的基本单位。
    + * 视野范围内的视频又分为高清视野和低清背景,均包含了多个 Tile。
    + * 视频帧信息为发送端使用 `setVideoEncoderConfig(const VideoEncoderConfig& encoderConfig, const char* parameters)` 接口进行设置。 + */ + +struct FovVideoTileInfo { + /** + * + * @brief 高清视野宽度 + */ + + uint32_t hd_width = 0; + /** + * + * @brief 高清视野高度 + */ + + uint32_t hd_height = 0; + /** + * + * @brief 低清背景宽度 + */ + + uint32_t ld_width = 0; + /** + * + * @brief 低清背景高度 + */ + + uint32_t ld_height = 0; + /** + * + * @brief Tile 宽度 + */ + + uint32_t tile_width = 0; + /** + * + * @brief Tile 高度 + */ + + uint32_t tile_height = 0; + /** + * + * @brief 高清视野中的 Tile 行数 + */ + + uint32_t hd_row = 0; + /** + * + * @brief 高清视野中的 Tile 列数 + */ + + uint32_t hd_column = 0; + /** + * + * @brief 低清背景中的 Tile 行数 + */ + + uint32_t ld_row = 0; + /** + * + * @brief 低清背景中的 Tile 列数 + */ + + uint32_t ld_column = 0; + /** + * + * @brief 视野范围中的 Tile 行数 + */ + + uint32_t dest_row = 0; + /** + * + * @brief 视野范围中的 Tile 列数 + */ + + uint32_t dest_column = 0; + /** + * + * @brief Tile 位置映射表 + */ + + uint8_t* tile_map = nullptr; + /** + * + * @brief Tile 数量 + */ + + uint32_t tile_size = 0; +}; +/** + * + * @hidden constructor/destructor + * @valid since 3.60. + * @param width 视频宽度 + * @param height 视频高度 + * @type keytype + * @brief 视频像素 + */ + +struct VideoDimensions { + int width; + int height; +}; + +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_120x120 = {120, 120}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_160x120 = {160, 120}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_180x180 = {180, 180}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_240x180 = {240, 180}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_320x180 = {320, 180}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_240x240 = {240, 240}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_320x240 = {320, 240}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_424x240 = {424, 240}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_360x360 = {360, 360}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_480x360 = {480, 360}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_640x360 = {640, 360}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_480x480 = {480, 480}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_640x480 = {640, 480}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_840x480 = {840, 480}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_960x540 = {960, 540}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_960x720 = {960, 720}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_1280x720 = {1280, 720}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_1920x1080 = {1920, 1080}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_2540x1440 = {2540, 1440}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_3840x2160 = {3840, 2160}; + + +/** + * + * @type keytype + * @brief 推荐的视频帧率 + * @hidden constructor/destructor + */ + +enum FrameRateFps { + kFrameRateFps1 = 1, + kFrameRateFps7 = 7, + kFrameRateFps10 = 10, + kFrameRateFps15 = 15, + kFrameRateFps24 = 24, + kFrameRateFps30 = 30, + kFrameRateFps60 = 60, +}; +/** + * + * @type keytype + * @brief 视频编码配置。参考 [设置视频发布参数](https: + */ + +struct VideoEncoderConfig { + /** + * + * @brief 视频宽度,单位:像素 + */ + + int width; + /** + * + * @brief 视频高度,单位:像素 + */ + + int height; + /** + * + * @brief 视频帧率,单位:fps + */ + + int frame_rate; + /** + * + * @brief 最大编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
    + * 内部采集模式下默认值为 -1,即适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率。
    + * 设为 0 则不对视频流进行编码发送。 + */ + + int max_bitrate = SEND_KBPS_AUTO_CALCULATE; + /** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `minBitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, maxBitrate),当 `maxBitrate` < `minBitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `maxBitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `maxBitrate` < `0` 时,适配码率模式。 + */ + + int min_bitrate = 0; + /** + * + * @brief 关键帧间隔,单位:毫秒,默认值为 `0` + */ + + int32_t key_frame_interval_ms = 0; + /** + * + * @brief 编码策略偏好,默认为帧率优先。参看 VideoEncodePreference{@link #VideoEncodePreference}。 + */ + + VideoEncodePreference encoder_preference = VideoEncodePreference::kVideoEncodePreferenceFramerate; +}; + +/** + * + * @hidden + * @deprecated since 3.36 along with onUserUnPublishStream and onUserUnPublishScreen, and will be deleted in 3.51. + * @type keytype + * @brief 视频属性 + */ + +struct VideoSolutionDescription { + /** + * + * @brief 宽(像素)
    + * 默认值为 `1920`
    + * 为 `0` 时,保持源的宽。 + */ + + int width; + /** + * + * @brief 高(像素)
    + * 默认值为 `1080`
    + * 为 `0` 时,保持源的高。 + */ + + int height; + /** + * + * @brief 视频帧率(fps),默认为 15 fps + */ + + int fps; + /** + * + * @brief 最大发送速率(千比特每秒)。
    + * 默认为 `-1`,适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率 + */ + + int max_send_kbps; + int min_send_kbps; + /** + * + * @brief 缩放模式。参看 VideoStreamScaleMode{@link #VideoStreamScaleMode} + */ + + VideoStreamScaleMode scale_mode = VideoStreamScaleMode::kVideoStreamScaleModeAuto; + /** + * + * @brief 视频的编码类型。参看 VideoCodecType{@link #VideoCodecType} + */ + + VideoCodecType codec_name = VideoCodecType::kVideoCodecTypeUnknown; + /** + * + * @brief 视频的编码模式。参看 VideoCodecMode{@link #VideoCodecMode} + */ + + VideoCodecMode codec_mode = VideoCodecMode::kVideoCodecModeAuto; + /** + * + * @brief 视频编码质量偏好策略。参看 VideoEncodePreference{@link #VideoEncodePreference} + */ + + VideoEncodePreference encode_preference = VideoEncodePreference::kVideoEncodePreferenceFramerate; + /** + * + * @brief 关键帧间隔,单位:毫秒,默认值为 `0` + */ + + int32_t key_frame_interval_ms = 0; + /** + * + * @hidden constructor/destructor + */ + + bool operator==(const VideoSolutionDescription& config) const { + bool result = width == config.width && height == config.height && fps == config.fps + && max_send_kbps == config.max_send_kbps && min_send_kbps == config.min_send_kbps + && scale_mode == config.scale_mode && codec_name == config.codec_name + && codec_mode == config.codec_mode && encode_preference == config.encode_preference; + return result; + } + /** + * + * @hidden constructor/destructor + */ + + bool operator!=(const VideoSolutionDescription& config) const { + bool result = (*this == config); + return !result; + } +}; + + +/** + * + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @region 视频管理 + */ + +typedef VideoSolutionDescription VideoProfile; + +/** + * + * @type keytype + * @brief 视频帧像素格式 + */ + +enum VideoPixelFormat { + /** + * + * @brief 未知格式 + */ + + kVideoPixelFormatUnknown = 0, + /** + * + * @brief YUV I420 格式 + */ + + kVideoPixelFormatI420 = 1, + /** + * + * @brief YUV NV12 格式 + */ + + kVideoPixelFormatNV12 = 2, + /** + * + * @brief YUV NV21 格式 + */ + + kVideoPixelFormatNV21 = 3, + /** + * + * @brief RGB 24bit 格式, + */ + + kVideoPixelFormatRGB24 = 4, + /** + * + * @brief RGBA 编码格式 + */ + + kVideoPixelFormatRGBA = 5, + /** + * + * @brief ARGB 编码格式 + */ + + kVideoPixelFormatARGB = 6, + /** + * + * @brief BGRA 编码格式 + */ + + kVideoPixelFormatBGRA = 7, + + + /** + * + * @hidden for internal use only + * @brief 像素格式结束标志。新加的格式数值应该小于kVideoPixelFormatEndMark。 + */ + + kVideoPixelFormatEndMark = 0xFF, + + /** + * + * @brief Texture2D 格式 + */ + + kVideoPixelFormatTexture2D = 0x0DE1, + /** + * + * @brief TextureOES 格式 + */ + + kVideoPixelFormatTextureOES = 0x8D65, +}; + +/** + * + * @type keytype + * @brief 视频帧内容类型 + */ + +enum VideoContentType { + /** + * + * @brief 普通视频 + */ + + kVideoContentTypeNormalFrame = 0, + /** + * + * @brief 黑帧 + */ + + kVideoContentTypeBlackFrame = 1, +}; + + +/** + * + * @type keytype + * @brief 视频缓冲区类型 + */ + +enum VideoBufferType { + /** + * + * @brief 原始内存数据 + */ + + kVideoBufferTypeRawMemory = 0, + /** + * + * @hidden(Windows, Android, Linux) + * @brief CVPixelBufferRef 类型 + */ + + kVideoBufferTypeCVPixelBuffer = 1, + /** + * + * @brief OpenGL 纹理数据类型 + */ + + kVideoBufferTypeGLTexture = 2, + /** + * + * @brief cuda 数据类型 + */ + + kVideoBufferTypeCuda = 3, + /** + * + * @brief direct3d11 纹理 + */ + + kVideoBufferTypeD3D11 = 4, + /** + * + * @brief vaapi 数据格式 + */ + + kVideoBufferTypeVAAPI = 5, + /** + * + * @hidden(Windows) + * @brief nvidia jetson dma 数据格式 + */ + + kVideoBufferTypeNvidiaJetsonDma =6, +}; + +/** + * + * @type keytype + * @brief 自定义内存释放器 + */ + +struct ManagedMemory { + /** + * + * @brief 内存数据地址 + */ + + uint8_t* data = nullptr; + /** + * + * @brief 内存空间的大小 + */ + + int size = 0; + /** + * + * @brief 用户自定义数据 + */ + + void* user_opaque = nullptr; + /** + * + * @brief 自定义内存释放方法指针,如果指针不为空,方法会被调用,用来释放内存空间。
    + * 函数传入的参数分别是本结构体内 data、size、user_opaque 3 个字段。 + */ + + int (*memory_deleter)(uint8_t* data, int size, void* user_opaque) = nullptr; +}; + +/** + * + * @type keytype + * @region 视频管理 + * @brief 视频帧数据 + */ + +typedef struct VideoFrameData { + /** + * + * @brief 视频帧缓冲区类型,默认为原始内存,详见 VideoBufferType{@link #VideoBufferType}。必填。 + */ + + VideoBufferType buffer_type = kVideoBufferTypeRawMemory; + /** + * + * @brief 视频帧像素格式,详见 VideoPixelFormat{@link #VideoPixelFormat}。当 `buffer_type` 为 `kVideoFrameTypeGLTexture` 必填。 + */ + + VideoPixelFormat pixel_format = kVideoPixelFormatUnknown; + + /** + * + * @brief 视频帧内容类型,参看 VideoContentType{@link #VideoContentType} + */ + + VideoContentType content_type = kVideoContentTypeNormalFrame; + /** + * + * @brief 视频帧平面个数。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 时,必填。 + */ + + int number_of_planes = 0; + /** + * + * @brief 视频帧平面数组。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 时,必填。 + */ + + uint8_t* plane_data[4] = { nullptr }; + /** + * + * @brief stride 数组。stride 指视频帧平面相邻两行图像数据之间的内存长度(单位字节)。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 时,必填。 + */ + + int plane_stride[4] = { 0 }; + /** + * + * @brief SEI 数据 + */ + + uint8_t* sei_data = nullptr; + /** + * + * @brief SEI 数据大小 + */ + + int sei_data_size = 0; + /** + * + * @brief 视频帧感兴趣区域数据 + */ + + uint8_t* roi_data = nullptr; + /** + * + * @brief 视频帧感兴趣区域数据长度 + */ + + int roi_data_size = 0; + /** + * + * @brief 视频帧宽度。必填。 + */ + + int width = 0; + /** + * + * @brief 视频帧高度。必填。 + */ + + int height = 0; + /** + * + * @brief 视频旋转角度,参看 VideoRotation{@link #VideoRotation}。
    + */ + + VideoRotation rotation = kVideoRotation0; + /** + * + * @brief 视频帧时间戳,单位:微秒。必填。 + */ + + int64_t timestamp_us = 0; + /** + * + * @brief 硬件加速缓冲区指针 + */ + + void* hw_buffer = nullptr; + /** + * + * @brief 硬件加速上下文对象句柄 + */ + + void* hw_context = nullptr; + /** + * + * @brief 纹理矩阵(仅针对纹理类型的 frame 生效) + */ + + float texture_matrix[16] = { 0 }; + /** + * + * @brief 纹理 ID(仅针对纹理类型的 frame 生效)。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 或 `kVideoFrameTypeGLTexture` 必填。 + */ + + uint32_t texture_id = 0; + +} VideoFrameData; + +/** + * + * @type keytype + * @brief 视频帧接口 + */ + +class IVideoFrame { +public: + /** + * + * @brief 获取视频帧缓冲区类型,参看 VideoBufferType{@link #VideoBufferType}。 + */ + + virtual VideoBufferType bufferType() = 0; + /** + * + * @brief 获取视频帧像素格式,参看 VideoPixelFormat{@link #VideoPixelFormat}。 + */ + + virtual VideoPixelFormat pixelFormat() = 0; + /** + * + * @brief 获取视频帧内容类型,参看 VideoContentType{@link #VideoContentType}。 + */ + + virtual VideoContentType contentType() = 0; + + /** + * + * @brief 获取视频帧时间戳,单位:微秒 + */ + + virtual int64_t timestampUs() = 0; + /** + * + * @brief 获取视频帧宽度 + */ + + virtual int width() = 0; + /** + * + * @brief 获取视频帧高度 + */ + + virtual int height() = 0; + /** + * + * @brief 获取视频帧旋转角度,参看 VideoRotation{@link #VideoRotation} + */ + + virtual VideoRotation rotation() = 0; + /** + * + * @brief 获取视频帧平面数量 + */ + + virtual int numberOfPlanes() = 0; + /** + * + * @brief 获取视频帧平面 + * @param plane_index plane 索引 + */ + + virtual uint8_t* planeData(int plane_index) = 0; + /** + * + * @brief 获取视频帧平面相邻两行图像数据之间的内存长度(单位字节) + * @param plane_index plane 索引 + */ + + virtual int planeStride(int plane_index) = 0; + /** + * + * @brief 获取 SEI 数据指针 + * @param size SEI 数据字节数 + */ + + virtual uint8_t* seiData(int& size) = 0; + /** + * + * @brief 获取硬件缓冲区指针 + */ + + virtual void* hwBuffer() = 0; + /** + * + * @brief 获取硬件加速上下文对象句柄 + */ + + virtual void* hwContext() = 0; + /** + * + * @brief 获取纹理矩阵(仅针对纹理类型的 frame 生效) + * @param matrix 纹理矩阵 + */ + + virtual void textureMatrix(float matrix[16]) = 0; + /** + * + * @brief 获取纹理 ID(仅针对纹理类型的 frame 生效) + */ + + virtual uint32_t textureId() = 0; + /** + * + * @brief 视频帧引用计数加一 + * @note 视频帧消费者希望对视频帧进行异步处理时(例如切换线程进行渲染),需要调用此接口增加引用计数。异步处理结束则需要调用 `releaseRef` 使引用计数减1 + */ + + virtual void addRef() = 0; + /** + * + * @brief 视频帧引用计数减一 + * @note 视频帧引用计数减为 0 时,视频帧对象会被释放。视频帧对象释放后,不应该继续使用视频帧。 + */ + + virtual long releaseRef() = 0; + /** + * + * @brief 获取视频帧的摄像头位置信息,参看 CameraID{@link #CameraID} + */ + + virtual CameraID cameraId() = 0; + /** + * + * @hidden for internal use only on Windows and Android + * @type api + * @brief 获取全景视频的 Tile 信息 + * @return FoV(可视范围)随本端的头位姿实时更新获取到的视频帧,包括高清视野和低清背景。参见 FovVideoTileInfo{@link #FovVideoTileInfo}。 + * @list + */ + + virtual FovVideoTileInfo fovTileInfo() = 0; +/** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoFrame() = default; +}; + + + + + + + + + + + + + + + + + + + + + +/** + * + * @type keytype + * @region 视频管理 + * @brief 视频帧参数 + */ + +typedef struct EncodedVideoFrameBuilder { + /** + * + * @brief 视频帧编码格式,参看 VideoCodecType{@link #VideoCodecType} + */ + + VideoCodecType codec_type = kVideoCodecTypeUnknown; + /** + * + * @brief 视频帧编码类型,参看 VideoPictureType{@link #VideoPictureType} + */ + + VideoPictureType picture_type = kVideoPictureTypeUnknown; + /** + * + * @brief 视频帧旋转角度,参看 VideoRotation{@link #VideoRotation} + */ + + VideoRotation rotation = kVideoRotation0; + /** + * + * @brief 视频帧数据指针 + * @note IEncodedVideoFrame 会获取数据的所有权 + */ + + uint8_t* data = nullptr; + /** + * + * @brief 视频帧数据大小 + */ + + int size = 0; + /** + * + * @brief 视频帧宽度,单位:px + */ + + int width = 0; + /** + * + * @brief 视频帧高度,单位:px + */ + + int height = 0; + /** + * + * @brief 视频采集时间戳,单位:微秒 + */ + + int64_t timestamp_us = 0; + /** + * + * @brief 视频编码时间戳,单位:微秒 + */ + + int64_t timestamp_dts_us = 0; + /** + * + * @brief 用户定义的视频帧释放回调函数指针,如果指针不为空,方法会被调用用来释放内存空间 + */ + + int (*memory_deleter)(uint8_t* data, int size, void* user_opaque) = nullptr; +} EncodedVideoFrameBuilder; +/** + * + * @type keytype + * @brief 视频帧信息 + */ + +class IEncodedVideoFrame { +public: + /** + * + * @type api + * @brief 获取视频编码类型 + * @return 视频编码类型,参看 VideoCodecType{@link #VideoCodecType} + * @list Video Management + */ + + virtual VideoCodecType codecType() const = 0; + /** + * + * @type api + * @brief 获取视频采集时间戳 + * @return 视频采集时间戳,单位:微秒 + * @list Video Management + */ + + virtual int64_t timestampUs() const = 0; + /** + * + * @type api + * @brief 获取视频编码时间戳 + * @return 视频编码时间戳,单位:微秒 + * @list Video Management + */ + + virtual int64_t timestampDtsUs() const = 0; + /** + * + * @type api + * @brief 获取视频帧宽度 + * @return 视频帧宽度,单位:px + * @list Video Management + */ + + virtual int width() const = 0; + /** + * + * @type api + * @brief 获取视频帧高度 + * @return 视频帧高度,单位:px + * @list Video Management + */ + + virtual int height() const = 0; + /** + * + * @type api + * @brief 获取视频编码帧类型 + * @return 视频编码帧类型,参看 VideoPictureType{@link #VideoPictureType} + * @list Video Management + */ + + virtual VideoPictureType pictureType() const = 0; + /** + * + * @type api + * @brief 获取视频帧旋转角度 + * @return 视频帧旋转角度,参看 VideoRotation{@link #VideoRotation} + * @list Video Management + */ + + virtual VideoRotation rotation() const = 0; + /** + * + * @type api + * @brief 获取视频帧数据指针地址 + * @return 视频帧数据指针地址 + * @list Video Management + */ + + virtual uint8_t* data() const = 0; + /** + * + * @type api + * @brief 获取视频帧数据大小 + * @return 视频帧数据大小 + * @list Video Management + */ + + virtual int dataSize() const = 0; + /** + * + * @type api + * @brief 浅拷贝视频帧并返回指针 + * @list Video Management + */ + + virtual IEncodedVideoFrame* shallowCopy() const = 0; + /** + * + * @type api + * @brief 释放视频帧 + * @list Video Management + */ + + virtual void release() = 0; + /** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IEncodedVideoFrame() = default; +}; +/** + * + * @type api + * @brief 创建 IEncodedVideoFrame + * @param builder 编码后的视频帧构建实例,参看 EncodedVideoFrameBuilder{@link #EncodedVideoFrameBuilder} + * @return IEncodedVideoFrame{@link #IEncodedVideoFrame} 实例 + * @list 视频管理 + */ + +BYTERTC_API IEncodedVideoFrame* buildEncodedVideoFrame(const EncodedVideoFrameBuilder& builder); + + +/** + * + * @hidden(Linux,Android,iOS) + * @type keytype + * @brief RTC 智能决策后得到的帧率和分辨率积(宽*高)。 + */ + +struct FrameUpdateInfo { + /** + * + * @brief 分辨率积(宽*高)。 + */ + + int pixel; + /** + * + * @brief 帧率。 + */ + + int framerate; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_processor_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_processor_interface.h new file mode 100644 index 0000000..9ad98ce --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_processor_interface.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Processor Interface +*/ + +#pragma once + +#include "bytertc_video_frame.h" + +namespace bytertc { +/** + * + * @type api + * @brief 视频处理接口类 + * @list 视频处理 + */ + +class IVideoProcessor +{ +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IVideoProcessor() = default; + /** + * + * @type api + * @brief 获取 RTC SDK 采集得到的视频帧,根据 registerLocalVideoProcessor{@link #IRTCEngine#registerLocalVideoProcessor} 设置的视频前处理器,进行视频前处理,最终将处理后的视频帧给到 RTC SDK 用于编码传输。 + * @param src_frame RTC SDK 采集得到的视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @return 经过视频前处理后的视频帧,返回给 RTC SDK 供编码和传输,参看 IVideoFrame{@link #IVideoFrame}。 + * @note + * - 在进行视频前处理前,你需要调用 registerLocalVideoProcessor{@link #IRTCEngine#registerLocalVideoProcessor} 设置视频前处理器。 + * - 如果需要取消视频前处理,可以将视频前处理器设置为 nullptr。 + * - 应用层实现 `processVideoFrame` 接口时,可以直接修改 `src_frame` 的缓冲区,调用 `addRef` 方法将 `src_frame` 引用计数加一,然后将修改后的 `src_frame` 返回, 也可以创建一个新的视频帧并返回。 + * - 对于 `processVideoFrame` 返回的视频帧,在 SDK 层消费完成后,SDK 内部总是调用这个视频帧的 releaseRef 方法。 + * @list 自定义流处理 + */ + + virtual IVideoFrame* processVideoFrame(IVideoFrame* src_frame) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_wtn_stream_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_wtn_stream_interface.h new file mode 100644 index 0000000..5d3b57d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/bytertc_wtn_stream_interface.h @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Processor Interface +*/ + +#pragma once + +#include "bytertc_video_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief WTN 媒体流状态 + */ + +enum WTNSubscribeState { + /** + * + * @brief 订阅 WTN 媒体流 + */ + + kWTNSubscribeStateSubscribed, + /** + * + * @brief 取消订阅 WTN 媒体流 + */ + + kWTNSubscribeStateUnsubscribed +}; +/** + * + * @type keytype + * @brief WTN 媒体流订阅状态改变的原因 + */ + +enum WTNSubscribeStateChangeReason { + /** + * + * @brief 订阅 WTN 媒体流成功 + */ + + kWTNSubscribeStateChangeReasonSubscribe = 0, + /** + * + * @brief 其他原因订阅失败 + */ + + kWTNSubscribeStateChangeReasonUnsubscribe = 1300, + /** + * + * @brief 订阅失败,拉流时远端未发布 + */ + + kWTNSubscribeStateChangeReasonRemoteUnpublish = 1301, + /** + * + * @brief 订阅失败,超出单端订阅上限。一个引擎实例最多拉 5 路流。 + */ + + kWTNSubscribeStateChangeReasonOverClientSubscribeStreamLimit = 1310, + /** + * + * @brief 订阅失败。超出单流订阅人数上限。该限制由 RTC 服务端决定。 + */ + + kWTNSubscribeStateChangeReasonOverStreamSubscribeUserLimit = 1311, + /** + * + * @brief 订阅失败。超出单流订阅请求 QPS 上限。该限制由 RTC 服务端决定。 + */ + + kWTNSubscribeStateChangeReasonOverStreamSubscribeRequestLimit = 1312 +}; + +/** + * + * @type callback + * @brief WTN 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ + +class IWTNStreamEventHandler { +public: + /** + * @hidden Constructor/Destructor + * @brief Destructor + */ + virtual ~IWTNStreamEventHandler() { + } + /** + * + * @type callback + * @valid since 3.60. + * @brief 通话中本地设备接收订阅的远端 WTN 视频流的流 ID 以及远端 WTN 视频流统计信息。 + * @param stream_id WTN 流 ID + * @param stats 远端 WTN 视频流的统计信息,详见 RemoteVideoStats{@link #RemoteVideoStats}。 + * @list WTN + * @order 0 + */ + + virtual void onWTNRemoteVideoStats(const char* stream_id, RemoteVideoStats stats) { + (void)stream_id; + (void)stats; + } + /** + * + * @type callback + * @valid since 3.60. + * @brief 通话中本地设备接收订阅的远端 WTN 音频流的流 ID 以及远端 WTN 音频流统计信息。 + * @param stream_id WTN 流 ID + * @param stats 远端 WTN 音频流的统计信息,详见 RemoteAudioStats{@link #RemoteAudioStats} + * @list WTN + * @order 1 + */ + + virtual void onWTNRemoteAudioStats(const char* stream_id, RemoteAudioStats stats) { + (void)stream_id; + (void)stats; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onPlayPublicStreamResult` 方法中的 WTN 视频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 视频流订阅状态变化回调
    + * 通过 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream} 订阅 WTN 视频流后,可以通过本回调获取订阅结果。 + * @param stream_id WTN 视频流的 ID + * @param state_code 视频流状态码,参看 WTNSubscribeState{@link #WTNSubscribeState}。 + * @param reason 订阅状态发生变化的原因,参看 WTNSubscribeStateChangeReason{@link #WTNSubscribeStateChangeReason}。 + * @list WTN + * @order 2 + */ + + virtual void onWTNVideoSubscribeStateChanged(const char* stream_id, WTNSubscribeState state_code, WTNSubscribeStateChangeReason reason) { + (void)stream_id; + (void)state_code; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onPlayPublicStreamResult` 中的 WTN 音频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 音频流订阅状态变化回调
    + * 通过 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 订阅 WTN 音频流后,可以通过本回调获取订阅结果。 + * @param stream_id WTN 音频流的 ID + * @param state_code 音频流状态码,参看 WTNSubscribeState{@link #WTNSubscribeState}。 + * @param reason 订阅状态发生变化的原因,参看 WTNSubscribeStateChangeReason{@link #WTNSubscribeStateChangeReason}。 + * @list WTN + * @order 2 + */ + + virtual void onWTNAudioSubscribeStateChanged(const char* stream_id, WTNSubscribeState state_code, WTNSubscribeStateChangeReason reason) { + (void)stream_id; + (void)state_code; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onFirstPublicStreamAudioFrame`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 流的首帧音频解码成功
    + * 关于订阅 WTN 音频流,详见 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}。 + * @param stream_id WTN 流 ID + * @list WTN + * @order 3 + */ + + virtual void onWTNFirstRemoteAudioFrame(const char* stream_id) { + (void)stream_id; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onFirstPublicStreamVideoFrameDecoded`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 流的首帧视频解码成功
    + * 关于 订阅 WTN 流,详见 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}。 + * @param stream_id WTN 流 ID + * @param info 视频帧信息。详见 VideoFrameInfo{@link #VideoFrameInfo}。 + * @list WTN + * @order 4 + */ + + virtual void onWTNFirstRemoteVideoFrameDecoded(const char* stream_id, const VideoFrameInfo& info) { + (void)stream_id; + (void)info; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替换了 `onPublicStreamSEIMessageReceived` 来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief 回调 WTN 流中包含的 SEI 信息。
    + * 调用 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}/subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}接口拉 WTN 音频流/视频流后,通过此回调收到 WTN 流中的 SEI 消息。 + * @param stream_id WTN 流 ID。 + * @param channel_id SEI 的消息传输通道,取值范围 `[0 - 255]`。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message 收到的 SEI 消息内容。
    + * 通过调用客户端 `sendSEIMessage` 插入的 SEI 信息。
    + * 当 WTN 流中的多路视频流均包含有 SEI 信息:SEI 不互相冲突时,将通过多次回调分别发送;SEI 在同一帧有冲突时,则只有一条流中的 SEI 信息被透传并融合到 WTN 流中。 + * @param length SEI 信息的长度。 + * @note 通过 Open API 插入的自定义信息,应通过回调 onWTNDataMessageReceived{@link #IWTNStreamEventHandler#onWTNDataMessageReceived} 获取。 + * @list WTN + * @order 5 + */ + + virtual void onWTNSEIMessageReceived(const char* stream_id, int channel_id, const uint8_t* message, int length) { + (void)stream_id; + (void)channel_id; + (void)message; + (void)length; + } + + /** + * + * @type callback + * @valid since 3.60. + * @brief 回调 WTN 流中包含的数据信息。
    + * 通过 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}/subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream} 订阅 WTN 流后,通过监听本回调获取 WTN 流中的数据消息,包括调用 Open API 发送的 SEI 消息和音量回调。 + * @param stream_id WTN 流 ID + * @param message 收到的数据消息内容,如下:
    + * - 调用 WTN 流 OpenAPI 发送的自定义消息。 + * - 媒体流音量变化,需要通过 WTN 流 OpenAPI 开启回调。JSON 格式说明如下:
    + * {
    + * "Type" : "VolumeIndication", + * "VolumeInfos" : [ + * {
    + * "RoomId":"1000001", + * "UserId":"1000001", + * "StreamType":0, + * "LinearVolume":1 + * }
    + * @param message_length 消息的长度 + * @param source_type 数据消息来源,参看 DataMessageSourceType{@link #DataMessageSourceType}。 + * @note 通过调用客户端 API 插入的 SEI 信息,应通过回调 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 获取。 + * @list WTN + * @order 6 + */ + + virtual void onWTNDataMessageReceived(const char* stream_id, + const uint8_t* message, + int message_length, + DataMessageSourceType source_type) { + (void)stream_id; + (void)message; + (void)message_length; + (void)source_type; + } +}; + +/** + * + * @type api + * @region WTN + * @brief WTN 流处理 + */ + +class IWTNStream +{ +public: + /** + * @hidden constructor/destructor + */ + virtual ~IWTNStream() = default; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream` 和 `stopPlayPublicStream` 方法来订阅/取消订阅指定 WTN 视频流,如果你使用了这两个方法,请迁移至此接口。 + * @brief 订阅/取消订阅指定 WTN 视频流
    + * 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 视频流。 + * @param stream_id WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 + * @param subscribe 是否订阅 WTN 流
    + * - true:订阅 + * - false:取消订阅 + * @return + * - 0: 成功。同时将收到 onWTNVideoSubscribeStateChanged{@link #IWTNStreamEventHandler#onWTNVideoSubscribeStateChanged} 回调。 + * - !0: 失败。当参数不合法或参数为空,调用失败。 + * @note + * - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}/subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 + * - 在调用本接口之前,建议先绑定渲染视图。 + * - 调用 setWTNRemoteVideoCanvas{@link #IWTNStream#setWTNRemoteVideoCanvas} 绑定内部渲染视图 + * - 调用 setWTNRemoteVideoSink{@link #IWTNStream#setWTNRemoteVideoSink} 绑定自定义渲染视图 + * - 调用本接口后,可以通过 onWTNFirstRemoteVideoFrameDecoded{@link #IWTNStreamEventHandler#onWTNFirstRemoteVideoFrameDecoded} 回调 WTN 视频流的首帧解码情况。 + * - 调用本接口后,可以通过 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 回调 WTN 流中包含的 SEI 信息。 + * @list WTN + * @order 0 + */ + + virtual int subscribeWTNVideoStream(const char* stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream` 和 `stopPlayPublicStream` 方法来订阅/取消订阅指定 WTN 音频流,如果你使用了这两个方法,请迁移至此接口。 + * @brief 订阅/取消订阅指定 WTN 音频流
    + * 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 音频流。 + * @param stream_id WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 + * @param subscribe 是否订阅 WTN 流
    + * - true:订阅 + * - false:取消订阅 + * @return + * - 0: 成功。同时将收到 onWTNAudioSubscribeStateChanged{@link #IWTNStreamEventHandler#onWTNAudioSubscribeStateChanged} 回调。 + * - !0: 失败。当参数不合法或参数为空,调用失败。 + * @note + * - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}/subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 取消订阅WTN 流,避免订阅的 WTN 流数量超限。 + * - 在调用本接口之前,建议先绑定渲染视图。 + * - 调用 setWTNRemoteVideoCanvas{@link #IWTNStream#setWTNRemoteVideoCanvas} 绑定内部渲染视图 + * - 调用 setWTNRemoteVideoSink{@link #IWTNStream#setWTNRemoteVideoSink} 绑定自定义渲染视图 + * - 调用本接口后,可以通过 onWTNFirstRemoteAudioFrame{@link #IWTNStreamEventHandler#onWTNFirstRemoteAudioFrame} 回调 WTN 音频流的音频首帧解码情况。 + * - 调用本接口后,可以通过 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 回调 WTN 流中包含的 SEI 信息。 + * @list WTN + * @order 1 + */ + + virtual int subscribeWTNAudioStream(const char* stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoCanvas` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定内部渲染视图 + * @param stream_id WTN 流 ID + * @param canvas 内部渲染视图,如果需要解除视频的绑定视图,把 `videoCanvas` 设置为空。详见 VideoCanvas{@link #VideoCanvas}。 + * @return + * - 0:成功 + * - !0:失败 + * @list WTN + * @order 2 + */ + + virtual int setWTNRemoteVideoCanvas(const char* stream_id, const VideoCanvas& canvas) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoSink` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定自定义渲染器。详见[自定义视频渲染](https: + * @param stream_id WTN 流 ID + * @param video_sink 自定义视频渲染器,自定义视频渲染器,需要释放渲染器资源时,将 `videoSink` 设置为 `null`。参看 IVideoSink{@link #IVideoSink} + * @param config 远端视频帧回调配置,参看 RemoteVideoSinkConfig{@link #RemoteVideoSinkConfig} + * @return + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @list WTN + * @order 3 + */ + + virtual int setWTNRemoteVideoSink(const char* stream_id, IVideoSink* video_sink, RemoteVideoSinkConfig& config) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamAudioPlaybackVolume` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 调节 WTN 流的音频播放音量。 + * @param stream_id WTN 流 ID + * @param volume 音频播放音量值和原始音量值的比值,该比值的范围是 `[0, 400]`,单位为 %,且自带溢出保护。为保证更好的音频质量,建议设定在 `[0, 100]` 之间,其中 100 为系统默认值。 + * @return + * - 0: 成功调用。 + * - -2: 参数错误。 + * @list WTN + * @order 4 + */ + + virtual int setWTNRemoteAudioPlaybackVolume(const char* stream_id, int volume) = 0; + /** + * + * @type api + * @valid since 3.60. + * @brief 设置 WTN 流回调接口 + * @param handler WTN 回调类,参看 IWTNStreamEventHandler{@link #IWTNStreamEventHandler}。 + * @list WTN + * @order 5 + */ + + virtual int setWTNStreamEventHandler(IWTNStreamEventHandler* handler) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/meeting_advance.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/meeting_advance.h new file mode 100644 index 0000000..59f2c90 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/native/rtc/meeting_advance.h @@ -0,0 +1,239 @@ +#pragma once + +#include "bytertc_defines.h" + +namespace bytertc { +class IRTCRoom; +class IRTCEngine; +class IAmazingEffect; + +/** + * @type keytype + * @brief 5.18版本后,飞书会议弱网提示专用,设置订阅视频基线数据用于计算网络等级 + */ +struct SubscribeVideoBaseline { + /** + * @brief 网络等级判定为优秀的视频宽/高中小值的基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_good_video_pixel_baseline = -1; + /** + * @brief 网络等级判定为优秀的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_good_video_fps_baseline = -1; + /** + * @brief 网络等级判定为差视频宽/高中小值的基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_bad_video_pixel_baseline = -1; + /** + * @brief 网络等级判定为差的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_bad_video_fps_baseline = -1; + /** + * @brief 业务可以接受的最小分辨率宽度,-1表示业务忽略此参数 + */ + int32_t acceptable_min_video_resolution_width = -1; + /** + * @brief 业务可以接受的最小分辨率高度,-1表示业务忽略此参数 + */ + int32_t acceptable_min_video_resolution_height = -1; + /** + * @brief 流的优先级,-1表示业务忽略此参数 + */ + int32_t stream_priority = -1; +}; + +enum SpecialStreamType { + kSpecialStreamTypeDocShare = 1, + kSpecialStreamTypeMCU, + kSpecialStreamTypeMeetTogether, + kSpecialStreamTypeIntelligentStream, +}; + +enum ExternalReportType{ + kExternalReportTypeApi = 0, + kExternalReportTypeApiCallback = 1, +}; +} + +namespace bytertc { + /** + * + * @hidden + * @brief 推流到子频道channelName + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [const char*] channelName 子频道 + */ + BYTERTC_API int setPublishChannel(IRTCRoom* room, const char* channelName); + /** + * + * @hidden + * @brief 订阅子频道数组里的所有流 + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [const SubChannelsInfo*] channelsInfo 子频道数组 + * @param [int] channelsNum 子频道数组大小 + * @param [bool] enableVolumeRescale 是否开启音频抑制功能 + */ + BYTERTC_API int setSubscribeChannels(IRTCRoom* room, const char* channels[], int channelsNum, bool enable_rescale); + /** + * + * @hidden + * @brief 设置是否开启音频抑制 + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [bool] enable 是否抑制 + */ + BYTERTC_API int enableRescaleAudioVolume(IRTCRoom* room, bool enable); + /** + * + * @hidden + * @deprecated since 3.58 and will be deleted in 3.60 + * @brief 设置发布的特殊流类型 + * > 支持会前设置 + * @param [IRTCRoom*] room 目标room + * @param [int] type 流类型 + */ + BYTERTC_API int setPublishSpecialStream(IRTCRoom* room, int type); + /** + * + * @hidden + * @brief 设置发布的特殊流类型 + * > 支持会前设置 + * @param [IRTCRoom*] room 目标room + * @param [int] type 流类型 + */ + BYTERTC_API int setPublishSpecialStreamWithStreamIndex(IRTCRoom* room, StreamIndex streamIndex, int type); + /** + * + * @hidden + * @brief 设置订阅的特殊流类型 + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [int[]] types 流类型集合 + * @param [int] count 流类型集合大小 + */ + BYTERTC_API int setSubscribeSpecialStream(IRTCRoom* room, int types[], int count); + /** + * + * @brief 获取上行带宽状态 + * @param [IRTCRoom*] room 目标room + */ + BYTERTC_API int getUplinkNetworkBandwidthEstimationStatus(IRTCRoom* room); + /** + * + * @brief 获取下行带宽状态 + * @param [IRTCRoom*] room 目标room + */ + BYTERTC_API int getDownlinkNetworkBandwidthEstimationStatus(IRTCRoom* room); + + /** + * + * @hidden + * @brief 视频发布端设置推送多路流时各路流的参数,包括分辨率、帧率、码率、缩放模式、网络不佳时的回退策略等。 + * @param channel_solutions 通道内的最大分辨率 + * @param solution_num 通道数 + * @param channel_main_solutions 主通道 兼容旧版本 + * @return 0 成功 !0失败 + */ + BYTERTC_API int setVideoEncoderConfig(IRTCEngine* ivideo, const VideoEncoderConfig* channel_solutions, + int solution_num, const VideoEncoderConfig* channel_main_solutions); + + /** + * + * @hidden + * @brief 设置屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ + BYTERTC_API int setScreenVideoConfigs(IRTCEngine* ivideo); + + /** + * + * @hidden + * @brief 清空屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ + BYTERTC_API int resetScreenVideoConfigs(IRTCEngine* ivideo); + + /** + * + * @brief 更新自动订阅选项 + *@param [IRTCRoom*] room 目标room + *@param [SubscribeMode] sub_mode_audio 音频自动订阅模式 + *@param [SubscribeMode] sub_mode_video 视频自动订阅模式 + */ + BYTERTC_API int enableAutoSubscribe(IRTCRoom* room, SubscribeMode sub_mode_audio, SubscribeMode sub_mode_video); + + /** + * + * @brief 检查音视频流是否取消发布成功 + *@param [IRTCRoom*] room 目标room + *@param [int] type 需要检查的流类型 + */ + BYTERTC_API bool isStreamUnpublished(IRTCRoom* room, MediaStreamType stream_type); + + /** + * + * @brief 设置弱网降级的基线数据 + *@param [RTCRoom] room 目标room + *@param [String] userId 订阅用户名 + *@param [boolean] isScreen 是否屏幕流 + *@param [InternalSubscribeVideoBaseline] videoBaseline 订阅基线设置 + */ + BYTERTC_API void setSubscribeBaselineData(IRTCRoom* rtc_room, const char* uid, bool is_screen, + const SubscribeVideoBaseline& video_baseline); + + /** + * + * @hidden + * @brief 获取用于实时crash分子数据信息 + * @param [char*] params carsh参数信息的json形式的字符数组 + * @param [int] size 用于存储params信息的数组大小 + */ + BYTERTC_API int getSessionLaunchParams(char* params, int size); + + /** + * + * @hidden + * @brief 获取视频特效接口IAmazingEffect + *@param [RTCEngine] ivideo 目标RTCVideo + */ + BYTERTC_API IAmazingEffect* getAmazingEffectInterface(IRTCEngine* ivideo); + /** + * + * @hidden + * @brief 获取EffectSDK版本,用于初始化platformsdk + */ + BYTERTC_API void getEffectVersion(char* version, int size); + + /** + * + * @brief 设置外部 Surface + * @return 无返回值 + */ + BYTERTC_API void setExternalSurface(IRTCEngine* ivideo, const char* room_id, const char* user_id, StreamIndex index, void* surface); + + /** + * + * @hidden + * @brief 写外部日志到RTC日志文件 + */ + BYTERTC_API void writeLog(const char* file_name, int line_num, const char* api_name, const char* level, + const char* format, ...); + + /** + * + * @hidden + * @brief 上报外部接口调用到trace平台 + */ + BYTERTC_API void reportApiCall(IRTCEngine* ivideo, ExternalReportType report_type, const char* api_name, + const char* msg); + + /** + * + * @hidden + * @brief 会议场景开启多分辨率 + */ + BYTERTC_API int enableSimulcastMode(IRTCEngine* ivideo, bool enabled); + + } diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCEngine.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCEngine.h new file mode 100644 index 0000000..63030fd --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCEngine.h @@ -0,0 +1,4450 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC +*/ +#import +#import "rtc/ByteRTCDefines.h" +#import "rtc/ByteRTCHttpClientProtocol.h" +#import "rtc/ByteRTCAudioEffectPlayer.h" +#import "rtc/ByteRTCMediaPlayer.h" +#import "rtc/ByteRTCSingScoringManager.h" +#import "rtc/ByteRTCWTNStream.h" +@class ByteRTCEngine; +@class ByteRTCRoom; +@class ByteRTCGameRoom; +@class ByteRTCRTSRoom; +@class ByteRTCKTVManager; +/** + * + * @type api + */ + +@protocol ByteRTCHttpClientProtocol; + +#pragma mark - ByteRTCEngineDelegate +/** + * + * @type callback + * @brief ByteRTCEngineDelegate 协议包含了 SDK 提供的回调方法,SDK 通过代理向应用程序上报一些运行时事件
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCEngineDelegate +@optional +#pragma mark - Core Delegate Methods + +/** + * + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。 + * @param engine ByteRTCEngine 对象。 + * @param code 警告代码,参看 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onWarning:(ByteRTCWarningCode)code; +/** + * + * @type callback + * @brief 发生错误回调。
    + * SDK 运行时出现了网络或媒体相关的错误,且无法自动恢复时触发此回调。
    + * 你可能需要干预。 + * @param engine ByteRTCEngine 对象。 + * @param errorCode 错误代码,参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onError:(ByteRTCErrorCode)errorCode; +/** + * + * @hidden internal use only + * @valid since 3.57 + * @type callback + * @brief 当内部线程发生 block 时,将收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param deadlockMsg block 线程的线程名和 block 检测次数。参看 ByteRTCDeadLockMsg{#ByteRTCDeadLockMsg} + * @list Engine Management + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onDeadLockError:(ByteRTCDeadLockMsg *_Nonnull)deadlockMsg; +/** + * + * @valid since 3.52 + * @type callback + * @brief 当访问插件失败时,收到此回调。
    + * RTC SDK 将一些功能封装成插件。当使用这些功能时,如果插件不存在,功能将无法使用。 + * @param engine `ByteRTCEngine` 实例 + * @param extensionName 插件名字 + * @param msg 失败说明 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onExtensionAccessError:(NSString * _Nonnull)extensionName msg:(NSString * _Nonnull)msg; +/** + * + * @type callback + * @brief SDK 与信令服务器连接状态改变回调。连接状态改变时触发。 + * @param engine ByteRTCEngine 对象 + * @param state 当前 SDK 与信令服务器的连接状态,详见 ByteRTCConnectionState{@link #ByteRTCConnectionState}。 + * @note 更多信息参见 [连接状态提示](https: + * @list 网络管理 + */ + +- (void) rtcEngine:(ByteRTCEngine * _Nonnull)engine onConnectionStateChanged:(ByteRTCConnectionState) state; +/** + * + * @type callback + * @brief SDK 当前网络连接类型改变回调。 + * @param engine ByteRTCEngine 对象 + * @param type SDK 当前的网络连接类型,详见 ByteRTCNetworkType{@link #ByteRTCNetworkType} + * @list 网络管理 + */ + +- (void) rtcEngine:(ByteRTCEngine * _Nonnull)engine onNetworkTypeChanged:(ByteRTCNetworkType) type; +/** + * + * @type callback + * @brief 房间内的可见用户调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 开启音频采集时,房间内其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 开启音频采集的远端流 ID + * @param info 开启音频采集的远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStartAudioCapture:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 房间内的可见用户调用 stopAudioCapture{@link #ByteRTCEngine#stopAudioCapture} 关闭音频采集时,房间内其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 流 ID。 + * @param info 关闭音频采集的远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStopAudioCapture:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 订阅端接收并解码远端音频流首帧时,收到此回调。包含以下情况:
    + * 1. 发布端发布音频,包含首次发布和取消后再次发布。
    + * 2. 发布端关闭音频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
    + * 3. 发布端发布音频后,订阅端取消订阅音频后,又再次订阅音频。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @note + * - 用户刚收到房间内每一路音频流时,都会收到该回调。 + * - 摄像头流、屏幕流,内部采集、外部源、自动订阅和手动订阅的音频流,都符合上述策略。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstRemoteAudioFrame:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; + /** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:} 后,根据设置的 interval 值,你会周期性地收到此回调,了解本地音频的瞬时相关信息。
    + * 本地音频包括使用 RTC SDK 内部机制采集的麦克风音频,屏幕音频和本地混音音频信息。 + * @param engine ByteRTCEngine 对象 + * @param audioPropertiesInfos 本地音频信息,详见 ByteRTCLocalAudioPropertiesInfo{@link #ByteRTCLocalAudioPropertiesInfo} 。在 macOS 端,本地音量可通过 `setAudioCaptureDeviceVolume:` 设置。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLocalAudioPropertiesReport:(NSArray * _Nonnull)audioPropertiesInfos; + +/** + * + * @type callback + * @hidden 3.60 for internal use only + * @region 音频管理 + * @brief 人声检测结果回调。
    + * 调用 enableAudioVADReport 后,根据设置的interval值,本地会周期性地收到此回调
    + * @param state 人声检测结果,参看 ByteRTCAudioVADType{@link #ByteRTCAudioVADType}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioVADStateUpdate:(ByteRTCAudioVADType)state; +/** + * + * @hidden for internal use only + * @type callback + * @region 音频管理 + * @brief 音乐场景检测结果回调。
    + * 调用 enableAudioAEDReport 后,根据设置的interval值,本地会周期性地收到此回调
    + * @param state 音乐场景检测结果,参看 ByteRTCAudioAEDType{@link #ByteRTCAudioAEDType}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioAEDStateUpdate:(ByteRTCAudioAEDType)state; + /** + * + * @hidden(iOS) + * @type callback + * @brief 回调音频设备测试时的播放音量 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine}。 + * @param volume 音频设备测试播放音量。取值范围:[0,255] + * @note 调用 startAudioPlaybackDeviceTest:interval:{@link #ByteRTCAudioDeviceManager#startAudioPlaybackDeviceTest:interval:} 或 startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest:},开始播放音频文件或录音时,将开启该回调。本回调为周期性回调,回调周期由上述接口的 `interval` 参数指定。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioPlaybackDeviceTestVolume:(int)volume; + /** + * + * @hidden(iOS) + * @type callback + * @brief 音频设备音量改变回调。当通过系统设置,改变音频设备音量或静音状态时,触发本回调。本回调无需手动开启。 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine} + * @param deviceType 设备类型,包括麦克风和扬声器,参阅 ByteRTCAudioDeviceType{@link #ByteRTCAudioDeviceType}。 + * @param volume 音量值,[0, 255]。当 volume 变为 0 时,muted 会转为 True。 + * @param muted 是否禁音状态。扬声器被设置为禁音时,muted 为 True,但 volume 保持不变。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioDeviceVolumeChanged:(ByteRTCAudioDeviceType)deviceType volume:(int)volume muted:(bool)muted; + /** + * + * @type callback + * @brief 远端用户进房后,本地调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:} ,根据设置的 interval 值,本地会周期性地收到此回调,了解订阅的远端用户的瞬时音频信息。
    + * 远端用户的音频包括使用 RTC SDK 内部机制/自定义机制采集的麦克风音频和屏幕音频。 + * @param engine ByteRTCEngine 对象 + * @param audioPropertiesInfos 远端音频信息,其中包含音频流属性、房间 ID、用户 ID ,详见 ByteRTCRemoteAudioPropertiesInfo{@link #ByteRTCRemoteAudioPropertiesInfo}。 + * @param totalRemoteVolume 所有订阅的远端流混音后的音量,范围是 [0,255]。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onRemoteAudioPropertiesReport:(NSArray * _Nonnull)audioPropertiesInfos totalRemoteVolume:(NSInteger)totalRemoteVolume; +/** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:}  后,根据设置的 `config.interval`,你会周期性地收到此回调,获取房间内的最活跃用户信息。 + * @param engine `ByteRTCEngine` 实例 + * @param roomId 房间 ID + * @param uid 最活跃用户(ActiveSpeaker)的用户 ID + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onActiveSpeaker:(NSString * _Nonnull)roomId uid:(NSString *_Nonnull)uid; +/** + * + * @hidden for internal use only + * @type callback + * @brief 房间内用户暂停/恢复发送视频流时,房间内其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param roomId 房间 ID + * @param uid 暂停/恢复发送视频流的用户 ID。 + * @param muteState 视频流的发送状态。参看 ByteRTCMuteState{@link #ByteRTCMuteState}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onRemoteAudioPropertiesReportEx:(NSArray * _Nonnull)audioPropertiesInfos; + +#pragma mark - Core Video Delegate Methods + +/** + * + * @type callback + * @brief 房间内的可见用户调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部视频采集时,房间中其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 视频流 ID + * @param info 视频流信息,详见 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStartVideoCapture:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 房间内的可见用户调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部视频采集时,房间内其他用户会收到此回调。
    + * 若发布视频数据前未开启采集,房间内所有可见用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 视频流 ID + * @param info 视频流信息,详见 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStopVideoCapture:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstLocalVideoFrameCaptured:(ByteRTCVideoSource* _Nullable)videoSource withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onFirstLocalVideoFrameCaptured:withFrameInfo:)); +/** + * + * @type callback + * @brief SDK 内部渲染成功远端视频流首帧后,收到此回调。包含以下情况:
    + * 1. 发布端首次发布视频
    + * 2. 在 1 条件下,发布端取消发布视频后,再次发布视频
    + * 3. 在 1 条件下,发布端关闭视频采集后,再次打开采集(或使用外部源时,停止推流后再次推流)
    + * 4. 在 1 条件下,订阅端取消订阅视频后,再次订阅视频(调用接口包括 subscribeAllStreamsVideo:{@link #ByteRTCRoom-subscribeAllStreamsVideo}pauseAllSubscribedStreamVideo:{@link #ByteRTCRoom-pauseAllSubscribedStreamVideo}/resumeAllSubscribedStreamVideo:{@link #ByteRTCRoom-resumeAllSubscribedStreamVideo}) + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @note 仅在采用内部渲染时,符合上述策略。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstRemoteVideoFrameRendered:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onFirstRemoteVideoFrameRendered:info:withFrameInfo:)); +/** + * + * @type callback + * @brief 订阅端接收并解码远端视频流首帧后,收到此回调。包含以下情况:
    + * 1. 发布端发布视频,包含首次发布和取消后再次发布。
    + * 2. 发布端关闭视频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
    + * 3. 发布端发布视频后,订阅端取消订阅视频后,又再次订阅视频。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @note + * - 对于主流,进入房间后,仅在发布端第一次发布的时候,订阅端会收到该回调,此后不受重新发布的影响,只要不重新加入房间,就不会再收到该回调。 + * - 对于屏幕流,用户每次重新发布屏幕视频流在订阅端都会重新触发一次该回调。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstRemoteVideoFrameDecoded:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:)); + +/** + * + * @type callback + * @brief 远端视频大小或旋转信息发生改变时,房间内订阅此视频流的用户会收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteVideoSizeChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onRemoteVideoSizeChanged:info:withFrameInfo:)); +/** + * + * @type callback + * @brief 本地视频大小或旋转信息发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalVideoSizeChanged:(ByteRTCVideoSource* _Nullable)videoSource withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onLocalVideoSizeChanged:withFrameInfo:)); +/** + * + * @type callback + * @brief 音频设备状态回调。提示音频采集、音频播放等设备的状态。 + * @param engine ByteRTCEngine 实例 + * @param deviceID 设备 ID + * @param deviceType 设备类型,参看 ByteRTCAudioDeviceType{@link #ByteRTCAudioDeviceType}。 + * @param deviceState 设备状态,参看 ByteRTCMediaDeviceState{@link #ByteRTCMediaDeviceState}。 + * @param deviceError 设备错误类型,参看 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioDeviceStateChanged:(NSString*_Nonnull)deviceID + device_type:(ByteRTCAudioDeviceType)deviceType + device_state:(ByteRTCMediaDeviceState)deviceState + device_error:(ByteRTCMediaDeviceError)deviceError; +/** + * + * @type callback + * @brief 视频设备状态发生改变回调。当设备的视频状态发生改变时,SDK 会触发该回调,提示摄像头视频采集、屏幕视频采集等设备的状态。 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine}。 + * @param deviceID 设备 ID + * @param deviceType 设备类型,参看 ByteRTCVideoDeviceType{@link #ByteRTCVideoDeviceType}。 + * @param deviceState 设备状态,参看 ByteRTCMediaDeviceState{@link #ByteRTCMediaDeviceState}。 + * @param deviceError 设备错误类型,参看 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onVideoDeviceStateChanged:(NSString*_Nonnull)deviceID + device_type:(ByteRTCVideoDeviceType)deviceType + device_state:(ByteRTCMediaDeviceState)deviceState + device_error:(ByteRTCMediaDeviceError)deviceError; +/** + * + * @type callback + * @brief 音频设备警告回调。音频设备包括音频采集设备和音频渲染设备。 + * @param engine ByteRTCEngine 对象 + * @param deviceId 设备 ID + * @param deviceType 参看 ByteRTCAudioDeviceType{@link #ByteRTCAudioDeviceType} + * @param deviceWarning 参看 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning} + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioDeviceWarning:(NSString*_Nonnull)deviceId + deviceType:(ByteRTCAudioDeviceType)deviceType + deviceWarning:(ByteRTCMediaDeviceWarning)deviceWarning; +/** + * + * @type callback + * @brief 视频设备警告回调。视频设备包括视频采集设备。 + * @param engine ByteRTCEngine 对象 + * @param deviceId 设备 ID + * @param deviceType 参看 ByteRTCVideoDeviceType{@link #ByteRTCVideoDeviceType} + * @param deviceWarning 参看 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning} + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onVideoDeviceWarning:(NSString*_Nonnull)deviceId + deviceType:(ByteRTCVideoDeviceType)deviceType + deviceWarning:(ByteRTCMediaDeviceWarning)deviceWarning; +/** + * + * @type callback + * @brief 本地音频首帧发送状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 流 ID + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 本地用户信息,详见 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧发送状态,详见 ByteRTCFirstFrameSendState{@link #ByteRTCFirstFrameSendState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onAudioFrameSendStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state; +/** + * + * @type callback + * @brief 视频首帧发送状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 视频流 ID + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 本地用户信息,详见 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧发送状态,详见 ByteRTCFirstFrameSendState{@link #ByteRTCFirstFrameSendState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onVideoFrameSendStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state; +/** + * + * @type callback + * @brief 音频首帧播放状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象。 + * @param streamId 音频流 ID + * @param info 音频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 音频流来源的用户信息,参看 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧播放状态,参看 ByteRTCFirstFramePlayState{@link #ByteRTCFirstFramePlayState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onAudioFramePlayStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state; +/** + * + * @type callback + * @brief 远端视频流的首帧播放状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象。 + * @param streamId 视频流 ID + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 视频流来源的用户信息,参看 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧播放状态,参看 ByteRTCFirstFramePlayState{@link #ByteRTCFirstFramePlayState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onVideoFramePlayStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state; +#pragma mark - Media Stream Delegate Methods + +/** + * + * @type callback + * @brief 发布音频流时,采集到第一帧音频帧,收到该回调。 + * @param engine ByteRTCEngine 对象 + * @param audioSource 预留参数 + * @note 如果发布音频流时,未开启本地音频采集,SDK 会推送静音帧,也会收到此回调。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstLocalAudioFrame:(ByteRTCAudioSource* _Nullable)audioSource; +#pragma mark - Media Device Delegate Methods +/** + * + * @hidden(macOS) + * @type callback + * @brief 音频播放路由变化时,收到该回调。 + * @param engine `ByteRTCEngine` 实例 + * @param device 新的音频播放路由,详见 ByteRTCAudioRoute{@link #ByteRTCAudioRoute} + * @note 插拔音频外设,或调用 setAudioRoute:{@link #ByteRTCEngine#setAudioRoute:} 都可能触发音频路由切换,详见[移动端设置音频路由](https: + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onAudioRouteChanged:(ByteRTCAudioRoute)device; +#pragma mark custom message Delegate Methods + +/** + * + * @type callback + * @brief 收到通过调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 发送带有 SEI 消息的视频帧时,收到此回调。 + * @param engine 当前 ByteRTCEngine 实例。 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param message 收到的 SEI 消息内容 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSEIMessageReceived:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info andMessage:(NSData* _Nonnull)message; +/** + * + * @type callback + * @brief 黑帧视频流发布状态回调。
    + * 在语音通话场景下,本地用户调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 通过黑帧视频流发送 SEI 数据时,流的发送状态会通过该回调通知远端用户。
    + * 你可以通过此回调判断携带 SEI 数据的视频帧为黑帧,从而不对该视频帧进行渲染。 + * @param engine 当前 ByteRTCEngine 实例。 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param eventType 黑帧视频流状态,参看 ByteRTCSEIStreamEventType{@link #ByteRTCSEIStreamEventType} + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSEIStreamUpdate:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info eventType:(ByteRTCSEIStreamEventType)eventType; +/** + * + * @type callback + * @brief 音频流同步信息回调。可以通过此回调,在远端用户调用 sendStreamSyncInfo:config:{@link #ByteRTCEngine#sendStreamSyncInfo:config:} 发送音频流同步消息后,收到远端发送的音频流同步信息。 + * @param engine 当前 ByteRTCEngine 实例。 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param streamType 媒体流类型,详见 ByteRTCSyncInfoStreamType{@link #ByteRTCSyncInfoStreamType} 。 + * @param data 消息内容。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onStreamSyncInfoReceived:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info streamType:(ByteRTCSyncInfoStreamType)streamType data:(NSData* _Nonnull)data; +#pragma mark - Statistics Delegate Methods + +/** + * + * @type callback + * @brief 报告当前设备 cpu 与 memory 使用率,每 2s 触发一次。 + * @param engine ByteRTCEngine 对象 + * @param stats cpu 和 memory 使用率信息,详见 ByteRTCSysStats{@link #ByteRTCSysStats} 数据类型 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSysStats:(const ByteRTCSysStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:onSysStats:)); +/** + * + * @type callback + * @brief 本地音频流的状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param audioSource 预留参数 + * @param state 本地音频设备的当前状态,详见 ByteRTCLocalAudioStreamState{@link #ByteRTCLocalAudioStreamState} + * @param error 本地音频流状态改变时的错误码,详见 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalAudioStateChanged:(ByteRTCAudioSource* _Nullable)audioSource + state:(ByteRTCLocalAudioStreamState)state + error:(ByteRTCLocalAudioStreamError)error; +/** + * + * @type callback + * @brief 订阅的远端音频流状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 远端音频流的当前状态,详见 ByteRTCRemoteAudioState{@link #ByteRTCRemoteAudioState} + * @param reason 远端音频流状态改变的原因,详见 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteAudioStateChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCRemoteAudioState)state + reason:(ByteRTCRemoteAudioStateChangeReason)reason; +/** + * + * @type callback + * @brief 本地视频流的状态发生改变时,收到该事件。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param state 本地视频流的当前状态,参看 ByteRTCLocalVideoStreamState{@link #ByteRTCLocalVideoStreamState} + * @param error 本地视频状态改变时的错误码,参看 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalVideoStateChanged:(ByteRTCVideoSource* _Nullable)videoSource + withStreamState:(ByteRTCLocalVideoStreamState)state + withStreamError:(ByteRTCLocalVideoStreamError)error NS_SWIFT_NAME(rtcEngine(_:onLocalVideoStateChanged:withStreamState:withStreamError:)); +/** + * + * @type callback + * @brief 远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 远端视频流的当前状态,参看 ByteRTCRemoteVideoState{@link #ByteRTCRemoteVideoState} + * @param reason 远端视频流状态改变的原因,参看 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} + * @note 本回调仅适用于主流,不适用于屏幕流。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteVideoStateChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + withVideoState:(ByteRTCRemoteVideoState)state + withVideoStateReason:(ByteRTCRemoteVideoStateChangeReason)reason NS_SWIFT_NAME(rtcEngine(_:onRemoteVideoStateChanged:info:withVideoState:withVideoStateReason:)); +/** + * + * @hidden not available on iOS + * @valid since 3.54 + * @type callback + * @brief 远端视频流的超分状态发生改变时,房间内订阅此流的用户会收到该回调。 + * @param engine `ByteRTCEngine` 实例 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param mode 超分模式,参看 ByteRTCVideoSuperResolutionMode{@link #ByteRTCVideoSuperResolutionMode}。 + * @param reason 超分模式改变原因,参看 ByteRTCVideoSuperResolutionModeChangedReason{@link #ByteRTCVideoSuperResolutionModeChangedReason}。 + * @list 视频处理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteVideoSuperResolutionModeChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + withMode:(ByteRTCVideoSuperResolutionMode)mode + withReason:(ByteRTCVideoSuperResolutionModeChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:onRemoteVideoSuperResolutionModeChanged:info:withMode:withReason:)); +/** + * + * @valid since 3.54 + * @hidden not available on iOS + * @type callback + * @brief 降噪模式状态变更回调。当降噪模式的运行状态发生改变,SDK 会触发该回调,提示用户降噪模式改变后的运行状态及状态发生改变的原因。 + * @param engine `ByteRTCEngine` 实例 + * @param mode 视频降噪模式,参看 ByteRTCVideoDenoiseMode{@link #ByteRTCVideoDenoiseMode}。 + * @param reason 视频降噪模式改变的原因,参看 ByteRTCVideoDenoiseModeChangedReason{@link #ByteRTCVideoDenoiseModeChangedReason}。 + * @list 视频处理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine + onVideoDenoiseModeChanged:(ByteRTCVideoDenoiseMode)mode + withReason:(ByteRTCVideoDenoiseModeChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:onVideoDenoiseModeChanged:withReason:)); + +#pragma mark - Rtm +/** + * + * @type callback + * @brief 登录结果回调 + * @param engine ByteRTCEngine 对象 + * @param uid
    + * 登录用户 ID + * @param errorCode
    + * 登录结果
    + * 详见 ByteRTCLoginErrorCode{@link #ByteRTCLoginErrorCode}。 + * @param elapsed
    + * 从调用 login:uid:{@link #ByteRTCEngine#login:uid:} 接口开始到返回结果所用时长。
    + * 单位为 ms。 + * @note 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLoginResult:(NSString * _Nonnull)uid errorCode:(ByteRTCLoginErrorCode)errorCode elapsed:(NSInteger)elapsed; +/** + * + * @type callback + * @brief 登出结果回调 + * @param engine ByteRTCEngine 对象 + * @param reason 用户登出的原因,参看 ByteRTCLogoutReason{@link #ByteRTCLogoutReason} + * @note 在以下两种情况下会收到此回调:调用 logout{@link #ByteRTCEngine#logout} 接口主动退出;或其他用户以相同 UserId 进行 `login` 导致本地用户被动登出。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLogout:(ByteRTCLogoutReason)reason; +/** + * + * @type callback + * @brief 设置应用服务器参数的返回结果 + * @param engine ByteRTCEngine 对象 + * @param errorCode
    + * 设置结果
    + * - 返回 200,设置成功 + * - 返回其他,设置失败,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @note 调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onServerParamsSetResult:(NSInteger)errorCode; +/** + * + * @type callback + * @brief 查询对端或本端用户登录状态的返回结果 + * @param engine ByteRTCEngine 对象 + * @param peerUserId
    + * 需要查询的用户 ID + * @param status
    + * 查询的用户登录状态
    + * 详见 ByteRTCUserOnlineStatus{@link #ByteRTCUserOnlineStatus}. + * @note 必须先调用 getPeerOnlineStatus:{@link #ByteRTCEngin e#getPeerOnlineStatus:},才能收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onGetPeerOnlineStatus:(NSString * _Nonnull)peerUserId status:(ByteRTCUserOnlineStatus)status; +/** + * + * @type callback + * @brief > 该接口将于 3.64 rtcEngine:onUserMessageReceivedOutsideRoom:uid:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageReceivedOutsideRoom:uid:message:} 代替。 + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 发来的文本消息时,会收到此回调 + * @param engine ByteRTCEngine 对象。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message; +/** + * + * @type callback + * @brief > 该接口将于 3.64 rtcEngine:onUserBinaryMessageReceivedOutsideRoom:uid:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserBinaryMessageReceivedOutsideRoom:uid:message:} 代替。 + * @brief 收到房间外用户调用 sendUserBinaryMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserBinaryMessageOutsideRoom:message:config:} 发来的二进制消息时,会收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param uid 消息发送者 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserBinaryMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message; +/** + * + * @type callback + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 发来的文本消息时,会收到此回调 + * @param engine ByteRTCEngine 对象。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserMessageReceivedOutsideRoom:(NSInteger)msgid uid:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message; +/** + * + * @type callback + * @brief 收到房间外用户调用 sendUserBinaryMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserBinaryMessageOutsideRoom:message:config:} 发来的二进制消息时,会收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserBinaryMessageReceivedOutsideRoom:(NSInteger)msgid uid:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message; +/** + * + * @type callback + * @brief 给房间外指定的用户发送消息的回调 + * @param engine ByteRTCEngine 对象 + * @param msgid
    + * 本条消息的 ID
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error
    + * 消息发送结果
    + * 详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult}。 + * @note 当调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 或 sendUserBinaryMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserBinaryMessageOutsideRoom:message:config:} 发送消息后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserMessageSendResultOutsideRoom:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; +/** + * + * @type callback + * @brief 给应用服务器发送消息的回调。 + * @param engine ByteRTCEngine 对象。 + * @param msgid 本条消息的 ID。
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果。详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult}。 + * @param message 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。消息不超过 64 KB。 + * @note 本回调为异步回调。当调用 sendServerMessage:{@link #ByteRTCEngin e#sendServerMessage:} 或 sendServerBinaryMessage:{@link #ByteEngin e#sendServerBinaryMessage:} 接口发送消息后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onServerMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error message:(NSData * _Nonnull)message; +#pragma mark - Network Probe Methods +/** + * + * @type callback + * @brief 通话前网络探测结果的回调。
    + * 成功调用 startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth:{@link #ByteRTCEngine#startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth:} 接口开始探测后,会在 3s 内首次收到该回调,之后每 2s 收到一次该回调。 + * @param engine ByteRTCEngine 对象 + * @param type 探测网络类型为上行/下行 + * @param quality 探测网络的质量,参看 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality}。 + * @param rtt 探测网络的 RTT,单位:ms + * @param lostRate 探测网络的丢包率 + * @param bitrate 探测网络的带宽,单位:kbps + * @param jitter 探测网络的抖动,单位:ms + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onNetworkDetectionResult:(ByteRTCNetworkDetectionLinkType)type quality:(ByteRTCNetworkQuality)quality rtt:(int)rtt lostRate:(double)lostRate bitrate:(int)bitrate jitter:(int)jitter; +/** + * + * @type callback + * @brief 通话前网络探测结束
    + * 以下情况将停止探测并收到一次本回调:
    + * 1. 当调用 stopNetworkDetection{@link #ByteRTCEngine#stopNetworkDetection} 接口停止探测后,会收到一次该回调;
    + * 2. 当收到远端/本端音频首帧后,停止探测;
    + * 3. 当探测超过 3 分钟后,停止探测;
    + * 4. 当探测链路断开一定时间之后,停止探测。 + * @param engine ByteRTCEngine 对象 + * @param errorCode
    + * 停止探测的原因类型,参考 ByteRTCNetworkDetectionStopReason{@link #ByteRTCNetworkDetectionStopReason} + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onNetworkDetectionStopped:(ByteRTCNetworkDetectionStopReason)errorCode; +#pragma mark - Log Delegate Methods + +/** + * + * @deprecated since 3.45 and will be deleted in 3.51. + * @type callback + * @brief SDK 内部日志回调。
    + * SDK 内部运行时,会把日志回调给业务方,方便排查问题。 + * @param engine ByteRTCEngine 对象。 + * @param dict 日志内容。 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine log:(NSDictionary* _Nonnull)dict; +#pragma mark Audio Mix Delegate Methods + +/** + * + * @type callback + * @brief 混音音频文件播放进度回调 + * @param engine 当前 RTC SDK 对象 + * @param mixId 混音 ID + * @param progress 当前混音音频文件播放进度,单位毫秒 + * @note 调用 start:filePath:config: 将 ByteRTCAudioEffectPlayerConfig 中的时间间隔设为大于 0 的值后,SDK 会按照设置的时间间隔回调该事件。 + * @list 混音 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioMixingPlayingProgress:(NSInteger)mixId progress:(int64_t) progress; +#pragma mark Performance Delegate Methods + +/** + * + * @type callback + * @brief 本地未通过 setPublishFallbackOption:{@link #ByteRTCEngine#setPublishFallbackOption:} 开启发布性能回退,检测到设备性能不足时,收到此回调。
    + * 本地通过 setPublishFallbackOption:{@link #ByteRTCEngine#setPublishFallbackOption:} 开启发布性能回退,因设备性能/网络原因,造成发布性能回退/恢复时,收到此回调。 + * @param engine `ByteRTCEngine` 实例 + * @param streamId 流 ID + * @param info 流信息, 参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param mode 指示本地是否开启发布回退功能。参看 ByteRTCPerformanceAlarmMode{@link #ByteRTCPerformanceAlarmMode}
    + * - 当发布端未开启发布性能回退时,mode 值为 ByteRTCPerformanceAlarmModeNormal。 + * - 当发布端开启发布性能回退时,mode 值为 ByteRTCPerformanceAlarmModeSimulcast。 + * @param reason 告警原因,参看 ByteRTCPerformanceAlarmReason{@link #ByteRTCPerformanceAlarmReason} + * @param data 性能回退相关数据,详见 ByteRTCSourceWantedData{@link #ByteRTCSourceWantedData}。 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onPerformanceAlarms:(NSString* _Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + mode:(ByteRTCPerformanceAlarmMode)mode + reason:(ByteRTCPerformanceAlarmReason)reason + sourceWantedData:(ByteRTCSourceWantedData *_Nonnull)data; +/** + * + * @type callback + * @brief 音视频流因网络环境变化等原因发生回退,或从回退中恢复时,触发该回调。 + * @param engine 当前 ByteRTCEngine 实例 + * @param streamId 流 ID + * @param info 流信息, 参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param event 流切换信息。详见 ByteRTCRemoteStreamSwitchEvent{@link #ByteRTCRemoteStreamSwitchEvent}。 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onSimulcastSubscribeFallback:(NSString* _Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info event:(ByteRTCRemoteStreamSwitchEvent *_Nonnull)event; + +#if BYTERTC_TARGET_MAC +/** + * + * @hidden + * @type callback + * @brief 外部采集时,调用 setOriginalScreenVideoInfo:withOriginalCaptureHeight: 设置屏幕或窗口大小改变前的分辨率后,若屏幕采集模式为智能模式,你将收到此回调,根据 RTC 智能决策合适的帧率和分辨率积(宽*高)重新采集。 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine} + * @param frameUpdateInfo RTC 智能决策后合适的帧率和分辨率积(宽*高)。参看 ByteRTCFrameUpdateInfo{@link #ByteRTCFrameUpdateInfo}。 + * @list Network Processing + */ + +- (void)rtcEngine: (ByteRTCEngine* _Nonnull)engine onExternalScreenFrameUpdate: (ByteRTCFrameUpdateInfo* _Nullable)frameUpdateInfo; +#endif +#pragma mark FileRecording related callback +/** + * + * @type callback + * @brief 获取本地录制状态回调。
    + * 该回调由 startFileRecording:type:{@link #ByteRTCEngine#startFileRecording:type:} 或 stopFileRecording:{@link #ByteRTCEngine#stopFileRecording:} 触发。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param state 录制状态,参看 ByteRTCRecordingState{@link #ByteRTCRecordingState} + * @param errorCode 录制错误码,参看 ByteRTCRecordingErrorCode{@link #ByteRTCRecordingErrorCode} + * @param recordingInfo 录制文件的详细信息,参看 ByteRTCRecordingInfo{@link #ByteRTCRecordingInfo} + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine onRecordingStateUpdate:(ByteRTCVideoSource* _Nullable)videoSource + state:(ByteRTCRecordingState)state + error_code:(ByteRTCRecordingErrorCode)errorCode + recording_info:(ByteRTCRecordingInfo* _Nonnull)recordingInfo; + +/** + * + * @type callback + * @brief 本地录制进度回调。
    + * 该回调由 startFileRecording:type:{@link #ByteRTCEngine#startFileRecording:type:} 触发,录制状态正常时,系统每秒钟都会通过该回调提示录制进度。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param process 录制进度,参看 ByteRTCRecordingProgress{@link #ByteRTCRecordingProgress} + * @param recordingInfo 录制文件的详细信息,参看 ByteRTCRecordingInfo{@link #ByteRTCRecordingInfo} + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine onRecordingProgressUpdate:(ByteRTCVideoSource* _Nullable)videoSource + process:(ByteRTCRecordingProgress* _Nonnull)process + recording_info:(ByteRTCRecordingInfo* _Nonnull)recordingInfo; +/** + * + * @type callback + * @brief 调用 startAudioRecording:{@link #ByteRTCEngine#startAudioRecording:} 或者 stopAudioRecording{@link #ByteRTCEngine#stopAudioRecording} 改变音频文件录制状态时,收到此回调。 + * @param engine `ByteRTCEngine` 实例 + * @param state 录制状态,参看 ByteRTCAudioRecordingState{@link #ByteRTCAudioRecordingState} + * @param errorCode 录制错误码,参看 ByteRTCAudioRecordingErrorCode{@link #ByteRTCAudioRecordingErrorCode} + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine + onAudioRecordingStateUpdate:(ByteRTCAudioRecordingState)state + error_code:(ByteRTCAudioRecordingErrorCode)errorCode; +/** + * + * @deprecated since 3.60, use rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:} instead. + * @type callback + * @brief WTN 流发布结果回调。
    + * 调用 startPushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#startPushMixedStream:withPushTargetConfig:withMixedConfig:}
    + * 接口或直接在服务端启动推 WTN 流功能后,你会通过此回调收到启动结果和推流过程中的错误。 + * @param engine engine 实例 + * @param roomId 发布 WTN 流的房间 ID + * @param streamId WTN 流 ID。 + * @param errorCode WTN 流发布结果状态码。 详见 ByteRTCPublicStreamErrorCode{@link #ByteRTCPublicStreamErrorCode}。 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onPushPublicStreamResult:(NSString *_Nonnull)roomId + publicStreamId:(NSString *_Nonnull)streamId + errorCode:(ByteRTCPublicStreamErrorCode)errorCode; +/** + * + * @type callback + * @brief 调用 startCloudProxy:{@link #ByteRTCEngine#startCloudProxy:} 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。 + * @param engine `ByteRTCEngine` 实例 + * @param interval 从开启云代理到连接成功经过的时间,单位为 ms + * @list 通话加密 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onCloudProxyConnected:(NSInteger)interval; +/** + * + * @type callback + * @brief 关于音视频回路测试结果的回调。 + * @param engine `ByteRTCEngine` 实例 + * @param result 测试结果,参看 ByteRTCEchoTestResult{@link #ByteRTCEchoTestResult}。 + * @note 该回调触发的时机包括:
    + * - 检测过程中采集设备发生错误时; + * - 检测成功后; + * - 非设备原因导致检测过程中未接收到音/视频回放,停止检测后。 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onEchoTestResult:(ByteRTCEchoTestResult)result NS_SWIFT_NAME(rtcEngine(_:onEchoTestResult:)); +/** + * + * @hidden for internal use only + * @type callback + * @brief 音频 dump 状态回调。 + * @param engine `ByteRTCEngine` 实例 + * @param status 音频 dump 状态,参看 ByteRTCAudioDumpStatus{@link #ByteRTCAudioDumpStatus}。 + * @note 本回调用于内部排查音质相关异常问题,开发者无需关注。 + * @list Network Processing + */ + +- (void)rtcEngine: (ByteRTCEngine* _Nonnull)engine onAudioDumpStateChanged: (ByteRTCAudioDumpStatus)status; +/** + * + * @type callback + * @brief 首次调用 getNetworkTimeInfo{@link #ByteRTCEngine#getNetworkTimeInfo} 后,SDK 内部启动网络时间同步,同步完成时会触发此回调。 + * @param engine ByteRTCEngine{@link #ByteRTCEngine} 对象 + * @list 网络管理 + */ + +- (void)rtcEngineOnNetworkTimeSynchronized:(ByteRTCEngine *_Nonnull)engine; +/** + * + * @hidden internal use only + * @type callback + * @brief license 过期时间提醒 + * @param engine ByteRTCEngine{@link #ByteRTCEngine} 对象 + * @param days 过期时间天数 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLicenseWillExpire:(NSInteger)days; +/** + * + * @type callback + * @brief AIGC(AI 音视频互动方案)使用 License 计费的场景下,当 License 配额用尽时,会收到该回调。收到该回调时,AIGC 服务会中止,请及时续费,并且建议离开房间、销毁 SDK。 + * @param engine ByteRTCEngine{@link #ByteRTCEngine} 对象 + * @param message 回调消息 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLicenseQuotaExceeded:(NSString *_Nullable)message; +/** + * + * @type callback + * @brief 通话前回声检测结果回调。 + * @param engine `ByteRTCEngine` 实例 + * @param result 参见 ByteRTCHardwareEchoDetectionResult{@link #ByteRTCHardwareEchoDetectionResult}。 + * @note + * - 通话前调用 startHardwareEchoDetection:{@link #ByteRTCEngine#startHardwareEchoDetection:} 后,将触发本回调返回检测结果。 + * - 建议在收到检测结果后,调用 stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * - 如果 SDK 在通话中检测到回声,将通过 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调 `ByteRTCMediaDeviceWarningDetectLeakEcho`。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onHardwareEchoDetectionResult:(ByteRTCHardwareEchoDetectionResult)result NS_SWIFT_NAME(rtcEngine(_:onHardwareEchoDetectionResult:)); +/** + * + * @type callback + * @brief 本地代理状态发生改变回调。调用 setLocalProxy:{@link #ByteRTCEngin e#setLocalProxy:} 设置本地代理后,SDK 会触发此回调,返回代理连接的状态。 + * @param engine `ByteRTCEngine` 实例 + * @param type 本地代理类型。参看 ByteRTCLocalProxyType{@link #ByteRTCLocalProxyType} 。 + * @param state 本地代理状态。参看 ByteRTCLocalProxyState{@link #ByteRTCLocalProxyState}。 + * @param error 本地代理错误。参看 ByteRTCLocalProxyError{@link #ByteRTCLocalProxyError}。 + * @list 通话加密 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLocalProxyStateChanged:(ByteRTCLocalProxyType)type withProxyState:(ByteRTCLocalProxyState)state withProxyError:(ByteRTCLocalProxyError)error; +/** + * + * @hidden internal use only + * @type callback + * @brief 当特效设置失败时,收到此回调。 + * @param engine `ByteRTCEngine` 实例 + * @param error 特效错误类型。参看 ByteRTCEffectErrorType{@link #ByteRTCEffectErrorType}。 + * @param msg 错误信息。 + * @list Encryption + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onEffectError:(ByteRTCEffectErrorType)error msg:(NSString * _Nonnull)msg; +#pragma mark - CDN/WTN +/** + * + * @valid since 3.60. 自 3.60 起,该回调替代了 `onStreamMixingEvent:taskId:error:mixType:` 和 `rtcEngine:onPushPublicStreamResult:publicStreamId:errorCode:` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此回调。 + * @hidden(Linux) + * @type callback + * @brief 合流转推 CDN / WTN 流状态回调 + * @param engine ByteRTCEngine 对象。 + * @param event 任务事件,参看 ByteRTCMixedStreamTaskEvent{@link #ByteRTCMixedStreamTaskEvent}。 + * @param info 任务详情,参看 ByteRTCMixedStreamTaskInfo{@link #ByteRTCMixedStreamTaskInfo}。 + * @param errorCode 任务错误码,参看 ByteRTCMixedStreamTaskErrorCode{@link #ByteRTCMixedStreamTaskErrorCode}。 + * @list CDN 推流 + * @order 0 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onMixedStreamEvent:(ByteRTCMixedStreamTaskEvent)event withMixedStreamInfo:(ByteRTCMixedStreamTaskInfo*)info withErrorCode:(ByteRTCMixedStreamTaskErrorCode)errorCode; + /** + * + * @valid since 3.60. + * @type callback + * @brief 单流转推 CDN 状态回调。 + * @param engine ByteRTCEngine 对象。 + * @param event 任务状态, 参看 ByteRTCSingleStreamTaskEvent{@link #ByteRTCSingleStreamTaskEvent}。 + * @param taskId 任务 ID。 + * @param errorCode 错误码,参看 ByteRTCSingleStreamTaskErrorCode{@link #ByteRTCSingleStreamTaskErrorCode}。 + * @list CDN 推流 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSingleStreamEvent:(ByteRTCSingleStreamTaskEvent)event withTaskId:(NSString*)taskId withErrorCode:(ByteRTCSingleStreamTaskErrorCode)errorCode; +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流音频首帧回调 + * @param taskId 任务 ID + * @list CDN 推流 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onEffectError:(ByteRTCEffectErrorType)error msg:(NSString * _Nonnull)msg; +/** + * + * @type callback + * @valid since 3.60. + * @brief 调用 takeRemoteSnapshotToFile:filePath:{@link #ByteRTCEngine#takeRemoteSnapshotToFile:filePath:} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param engine ByteRTCEngine 对象。 + * @param streamId 被截图的视频流 ID。 + * @param info 视频流信息,参考 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param filePath 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param errorCode 截图错误码。参看 ByteRTCSnapshotErrorCode{@link #ByteRTCSnapshotErrorCode}。 + * @param taskId 截图任务的编号,和 takeRemoteSnapshotToFile:filePath:{@link #ByteRTCEngine#takeRemoteSnapshotToFile:filePath:} 的返回值一致。 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteSnapshotTakenToFile:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info filePath:(NSString * _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errorCode:(ByteRTCSnapshotErrorCode)errorCode taskId:(NSInteger)taskId; +/** + * + * @type callback + * @valid since 3.60. + * @brief 调用 takeLocalSnapshotToFile:{@link #ByteRTCEngine#takeLocalSnapshotToFile:} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param engine ByteRTCEngine 对象。 + * @param videoSource 预留参数 + * @param filePath 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param errorCode 截图错误码。参看 ByteRTCSnapshotErrorCode{@link #ByteRTCSnapshotErrorCode}。 + * @param taskId 截图任务的编号,和 takeLocalSnapshotToFile:{@link #ByteRTCEngine#takeLocalSnapshotToFile:} 的返回值一致。 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalSnapshotTakenToFile:(ByteRTCVideoSource* _Nullable)videoSource filePath:(NSString * _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errorCode:(ByteRTCSnapshotErrorCode)errorCode taskId:(NSInteger)taskId; + +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流视频首帧回调 + * @param taskId 任务 ID + * @list CDN 推流 + */ + + - (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine onClientMixedFirstVideoFrame:(NSString *)taskId; +/** + * + * @hidden internal use only + * @valid since 3.60. + * @type callback + * @brief 试验性接口回调 + * @param param 回调内容(JSON string) + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onExperimentalCallback:(NSString * _Nonnull) param; +@end +#pragma mark - RTCEngine +/** + * + * @type api + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEngine : NSObject +/** + * + * @type callback + */ + +@property (nonatomic, weak) id _Nullable delegate; +/** + * @hidden + * @deprecated + */ + +@property (nonatomic, weak) id _Nullable monitorDelegate + __deprecated_msg("Will be removed in new version"); + + +/** + * + * @type api + * @brief 创建引擎对象。
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 + * @param config 创建引擎参数配置,详见 ByteRTCEngineConfig{@link #ByteRTCEngineConfig} + * @param delegate SDK 回调给应用层的 delegate,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} + * @return 可用的 ByteRTCEngine{@link #ByteRTCEngine} 实例 + * @list 引擎管理 + */ + ++ (ByteRTCEngine * _Nullable) createRTCEngine:(ByteRTCEngineConfig * _Nonnull) config + delegate:(id _Nullable)delegate; +/** + * + * @hidden internal use only + * @type api + * @brief 创建多实例引擎对象
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新创建的引擎实例。 + * @param config 创建引擎参数配置,详见 ByteRTCEngineConfig{@link #ByteRTCEngineConfig} + * @param delegate SDK 回调给应用层的 delegate,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} + * @return + * - RTCVideo:创建成功。返回一个可用的 ByteRTCEngine{@link #ByteRTCEngine} 实例 + * - Null:.so 文件加载失败,创建失败。 + * @note 你应注意保持 handler 的生命周期必须大于 ByteRTCEngine 的生命周期,即 handler 必须在调用 destroyRTCEngine{@link #ByteRTCEngine#destroyRTCEngine} 之后销毁。 + */ + ++ (ByteRTCEngine * _Nullable) createRTCEngineMulti:(ByteRTCEngineConfig * _Nonnull)config + delegate:(id _Nullable)delegate; +/** + * + * @type api + * @brief 销毁由 createRTCEngine:delegate:{@link #ByteRTCEngine#createRTCEngine:delegate:} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的业务场景全部结束后,才调用此方法 + * - 该方法在调用之后,会销毁所有和此 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * - 可以通过 Objective-C 的 ARC 机制,在 dealloc 时自动触发销毁逻辑 + * @list 引擎管理 + */ + ++ (void)destroyRTCEngine NS_SWIFT_NAME(destroyRTCEngine()); +/** + * + * @hidden internal use only + * @type api + * @brief 销毁由 createRTCEngineMulti:delegate:{@link #ByteRTCEngine#createRTCEngineMulti:delegate:} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的业务场景全部结束后,才调用此方法 + * - 该方法在调用之后,会销毁所有和此 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * - 可以通过 Objective-C 的 ARC 机制,在 dealloc 时自动触发销毁逻辑 + * @list 引擎管理 + */ + ++ (void)destroyRTCEngineMulti:(ByteRTCEngine*)engine; +/** + * + * @type api + * @brief 获取 SDK 当前的版本号。 + * @return SDK 当前的版本号。 + * @list 引擎管理 + */ + ++ (NSString * _Nonnull)getSDKVersion; +/** + * + * @type api + * @brief 配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。 + * @param logConfig 本地日志参数,参看 ByteRTCLogConfig{@link #ByteRTCLogConfig}。 + * @return + * - 0:成功。 + * - –1:失败,本方法必须在创建引擎前调用。 + * - –2:失败,参数填写错误。 + * @note 本方法必须在调用 createRTCEngine:delegate:{@link #ByteRTCEngine#createRTCEngine:delegate:} 之前调用。 + * @list 引擎管理 + */ + ++ (int) setLogConfig:(ByteRTCLogConfig *_Nonnull) logConfig; + +#pragma mark Core Audio Methods + +/** + * + * @type api + * @brief 切换音频采集方式 + * @param type 音频数据源,详见 ByteRTCAudioSourceType{@link #ByteRTCAudioSourceType}。
    + * 默认使用内部音频采集。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
    + * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法由内部采集切换至自定义采集,SDK 会自动关闭内部采集。然后,调用 pushExternalAudioFrame:{@link #ByteRTCEngine#pushExternalAudioFrame:} 推送自定义采集的音频数据到 RTC SDK 用于传输。 + * - 如果你调用此方法由自定义采集切换至内部采集,你必须再调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 手动开启内部采集。 + * @list 自定义流处理 + */ + +- (int)setAudioSourceType:(ByteRTCAudioSourceType) type; +/** + * + * @type api + * @brief 切换音频渲染方式 + * @param type 音频输出类型,详见 ByteRTCAudioRenderType{@link #ByteRTCAudioRenderType}
    + * 默认使用内部音频渲染。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
    + * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法切换至自定义渲染,调用 pullExternalAudioFrame:{@link #ByteRTCEngine#pullExternalAudioFrame:} 获取音频数据。 + * @list 自定义流处理 + */ + +- (int)setAudioRenderType:(ByteRTCAudioRenderType) type; +/** + * + * @type api + * @brief 开启内部音频采集。默认为关闭状态。
    + * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
    + * 调用该方法开启后,本地用户会收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStartAudioCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartAudioCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 若未取得当前设备的麦克风权限,调用该方法后会触发 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 回调,对应的错误码为 `ByteRTCMediaDeviceError.ByteRTCMediaDeviceErrorDeviceNoPermission = 1`。 + * - 调用 stopAudioCapture{@link #ByteRTCEngine#stopAudioCapture} 可以关闭音频采集设备,否则,SDK 只会在销毁引擎的时候自动关闭设备。 + * - 由于不同硬件设备初始化响应时间不同,频繁调用 stopAudioCapture{@link #ByteRTCEngine#stopAudioCapture} 和本接口闭麦/开麦可能出现短暂无声问题,建议使用 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:} 实现临时闭麦和重新开麦。 + * - 创建引擎后,无论是否发布音频数据,你都可以调用该方法开启音频采集,并且调用后方可发布音频。 + * - 如果需要从自定义音频采集切换为内部音频采集,你必须先停止发布流,调用 setAudioSourceType:{@link #ByteRTCEngine#setAudioSourceType:} 关闭自定义采集,再调用此方法手动开启内部采集。 + * @list 音频管理 + */ + +- (int)startAudioCapture; + /** + * + * @type api + * @brief 关闭内部音频采集。默认为关闭状态。
    + * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
    + * 调用该方法,本地用户会收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopAudioCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStopAudioCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 可以开启音频采集设备。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部音频采集才会停止。 + * @list 音频管理 + */ + +- (int)stopAudioCapture; +/** + * + * @hidden(macOS) + * @valid since 3.60. + * @type api + * @brief 设置音频场景类型。
    + * 选择音频场景后,SDK 会自动根据场景切换对应的音量模式(通话音量/媒体音量)和该场景下的最佳音频配置。
    + * @param audioScenario 音频场景类型,参看 ByteRTCAudioScenarioType{@link #ByteRTCAudioScenarioType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 此接口必须在加入 RTC 房间前调用。 + * - 通话音量更适合通话、会议等对信息准确度更高的场景。通话音量会激活系统硬件信号处理,使通话声音更清晰。同时,音量无法降低到 0。 + * - 媒体音量更适合娱乐场景,因其声音的表现力会更强。媒体音量下,最低音量可以为 0。 + * @list 音频管理 + */ + +- (int)setAudioScenario:(ByteRTCAudioScenarioType)audioScenario; +/** + * + * @type api + * @brief 设置音质档位。
    + * 当所选的 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 中的音频参数无法满足你的场景需求时,调用本接口切换的音质档位。 + * @param audioProfile 音质档位,参看 ByteRTCAudioProfileType{@link #ByteRTCAudioProfileType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法在进房前后均可调用; + * - 支持通话过程中动态切换音质档位。 + * @list 音频管理 + */ + +- (int)setAudioProfile:(ByteRTCAudioProfileType)audioProfile; +/** + * + * @valid since 3.52 + * @type api + * @brief 支持根据业务场景,设置通话中的音频降噪模式。 + * @param ansMode 降噪模式。具体参见 ByteRTCAnsMode{@link #ByteRTCAnsMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该接口进房前后均可调用,可重复调用,仅最后一次调用生效。 + * - 降噪算法包含传统降噪和 AI 降噪。传统降噪主要是抑制平稳噪声,比如空调声、风扇声等。而 AI 降噪主要是抑制非平稳噪声,比如键盘敲击声、桌椅碰撞声等。 + * - 只有以下 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 场景时,调用本接口可以开启 AI 降噪。其余场景的 AI 降噪不会生效。 + * - 游戏语音模式: `ByteRTCRoomProfileGame` + * - 高音质游戏模式: `ByteRTCRoomProfileGameHD` + * - 云游戏模式: `ByteRTCRoomProfileCloudGame` + * - 1 vs 1 音视频通话: `ByteRTCRoomProfileChat` + * - 多端同步播放音视频:`ByteRTCRoomProfileLwTogether` + * - 云端会议中的个人设备:`ByteRTCRoomProfileMeeting` + * - 课堂互动模式:`ByteRTCRoomProfileClassroom` + * - 云端会议中的会议室终端:`ByteRTCRoomProfileMeetingRoom` + * @list 高级功能 + */ + +- (int)setAnsMode:(ByteRTCAnsMode)ansMode; + +#if BYTERTC_TARGET_MAC +/** + * + * @hidden(iOS) + * @valid since 3.51 + * @type api + * @brief 打开/关闭 AGC(Analog Automatic Gain Control)模拟自动增益控制功能。
    + * 开启该功能后,SDK 会自动调节麦克风的采集音量,确保音量稳定。 + * @param enable 是否打开 AGC 功能:
    + * - true: 打开 AGC 功能。 + * - false: 关闭 AGC 功能。 + * @return + * - 0: 调用成功。 + * - -1: 调用失败。 + * @note + * 该方法在进房前后均可调用。如果你需要在进房前使用 AGC 功能,请联系技术支持获得私有参数,传入对应 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 。
    + * 要想在进房后开启 AGC 功能,你需要把 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 设为 `ByteRTCRoomProfileMeeting`、`ByteRTCRoomProfileMeetingRoom` 或`ByteRTCRoomProfileClassroom` 。
    + * AGC 功能生效后,不建议再调用 `setAudioCaptureDeviceVolume:` 来调节设备麦克风的采集音量。 + * @list 音频管理 + */ + +- (int)enableAGC:(BOOL)enable; +#endif +/** + * + * @valid since 3.32 + * @type api + * @brief 设置变声特效类型 + * @param voiceChanger 变声特效类型,参看 ByteRTCVoiceChangerType{@link #ByteRTCVoiceChangerType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 如需使用该功能,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 与 setVoiceReverbType:{@link #ByteRTCEngine#setVoiceReverbType:} 互斥,后设置的特效会覆盖先设置的特效。 + * @list 音频处理 + */ + +- (int)setVoiceChangerType:(ByteRTCVoiceChangerType)voiceChanger; +/** + * + * @valid since 3.32 + * @type api + * @brief 设置混响特效类型 + * @param voiceReverb 混响特效类型,参看 ByteRTCVoiceReverbType{@link #ByteRTCVoiceReverbType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 与 setVoiceChangerType:{@link #ByteRTCEngine#setVoiceChangerType:} 互斥,后设置的特效会覆盖先设置的特效。 + * @list 音频处理 + */ + +- (int)setVoiceReverbType:(ByteRTCVoiceReverbType)voiceReverb; +/** + * + * @type api + * @brief 设置本地采集语音的均衡效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param config 语音均衡效果,参看 ByteRTCVoiceEqualizationConfig{@link #ByteRTCVoiceEqualizationConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 根据奈奎斯特采样率,音频采样率必须大于等于设置的中心频率的两倍,否则,设置不生效。 + * @list 音频处理 + */ + +-(int)setLocalVoiceEqualization:(ByteRTCVoiceEqualizationConfig* _Nonnull)config; +/** + * + * @type api + * @brief 设置本地采集音频的混响效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param param 混响效果,参看 ByteRTCVoiceReverbConfig{@link #ByteRTCVoiceReverbConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 调用 enableLocalVoiceReverb:{@link #ByteRTCEngine#enableLocalVoiceReverb:} 开启混响效果。 + * @list 音频处理 + */ + + -(int)setLocalVoiceReverbParam:(ByteRTCVoiceReverbConfig* _Nonnull)param; +/** + * + * @type api + * @brief 开启本地音效混响效果 + * @param enable 是否开启 + * @return + * - 0: 成功。 + * - < 0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 调用 setLocalVoiceReverbParam:{@link #ByteRTCEngine#setLocalVoiceReverbParam:} 设置混响效果。 + * @list 音频处理 + */ + +-(int)enableLocalVoiceReverb:(bool)enable; +/** + * + * @valid since 3.58.1 + * @type api + * @brief 设置是否将采集到的音频信号静音,而不改变本端硬件采集状态。 + * @param mute 是否静音音频采集。
    + * - True:静音(关闭麦克风) + * - False:(默认)开启麦克风 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 该方法用于设置是否使用静音数据替换设备采集到的音频数据进行推流,不影响 SDK 音频流的采集发布状态。对于 macOS 平台,如有需要你也可以选择静音整个系统的音频采集,具体参看 setAudioCaptureDeviceMute:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceMute:} 方法说明。 + * - 静音后通过 setCaptureVolume:{@link #ByteRTCEngine#setCaptureVolume:} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 音频管理 + */ + +- (int)muteAudioCapture: (bool)mute; +/** + * + * @valid since 3.60. + * @type api + * @brief 静音/取消静音屏幕共享时采集的音频。
    + * 调用此方法后,SDK 将发送静音数据来代替真实的屏幕音频数据,不影响本端音频设备的采集状态和 SDK 音频流的采集发布状态。 + * @param mute 是否静音屏幕音频。
    + * - True:静音。远端用户听不到来自你屏幕共享的声音。 + * - False:(默认)取消静音。恢复发送屏幕共享的音频。 + * @return + * - 0:调用成功。 + * - < 0:调用失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 该方法用于设置是否使用静音数据替换设备采集到的音频数据进行推流,不影响 SDK 音频流的采集发布状态。对于 macOS 平台,如有需要你也可以选择静音整个系统的音频采集,具体参看 setAudioCaptureDeviceMute:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceMute:} 方法说明。 + * - 静音后通过 setCaptureVolume:{@link #ByteRTCEngine#setCaptureVolume:} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 音频管理 + */ + +- (int)muteScreenAudioCapture: (bool)mute; +/** + * + * @type api + * @brief 调节音频采集音量 + * @param volume 采集的音量值和原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0:静音 + * - 100:原始音量 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 在开启音频采集前后,你都可以使用此接口设定采集音量。 + * @list 音频管理 + */ + +- (int)setCaptureVolume: (int)volume; +/** + * + * @type api + * @brief 调节屏幕共享时采集的音频音量。
    + * 只改变音频数据的音量信息,不影响麦克风采集的音量,也不会改变本端音频设备本身的音量。 + * @param volume 采集的音量值和原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0, 100]。
    + * + 0:静音 + * + 100:原始音量 + * + 400:最大可为原始音量的 4 倍(自带溢出保护) + * @return + * + 0: 调用成功。
    + * + <0:调用失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 在开启屏幕音频采集前后,你都可以使用此接口设定采集音量。 + * @list 音频管理 + */ + +- (int)setScreenCaptureVolume:(int)volume; +/** + * + * @type api + * @brief 调节本地播放的所有远端用户音频混音后的音量,混音内容包括远端人声、音乐、音效等。
    + * 播放音频前或播放音频时,你都可以使用此接口设定播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,当该方法与 setRemoteAudioPlaybackVolume:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume:} 或 setRemoteRoomAudioPlaybackVolume:{@link #ByteRTCRoom#setRemoteRoomAudioPlaybackVolume:} 共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + +- (int)setPlaybackVolume:(NSInteger)volume; +/** + * + * @type api + * @brief 启用音频信息提示。启用后,你可以收到 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:},rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:},和 rtcEngine:onActiveSpeaker:uid:{@link #ByteRTCEngineDelegate#rtcEngine:onActiveSpeaker:uid:}。 + * @param config 详见 ByteRTCAudioPropertiesConfig{@link #ByteRTCAudioPropertiesConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + +- (int)enableAudioPropertiesReport:(ByteRTCAudioPropertiesConfig* _Nonnull)config; + +/** + * + * @type api + * @hidden 3.60 for internal use only + * @region 音频管理 + * @brief 启用音频人声识别能力。开启提示后,你会收到 rtcEngine:onAudioVADStateUpdate。 + * @param interval 回调间隔,单位毫秒。
    + * + `<= 0`: 关闭人声识别能力回调。 + * + `[100, 3000]`: 开启人声识别能力回调,并将信息提示间隔设置为此值。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list 音频管理 + */ + +- (int)enableAudioVADReport:(NSInteger)interval; +/** + * + * @hidden 3.60 for internal use only + * @type api + * @region 音频管理 + * @brief 启用AED检测。启用后,你可以收到 rtcEngine:onAudioAEDStateUpdate。 + * @param interval 回调间隔,单位毫秒。
    + * + `<= 0`: 关闭回调。 + * + `[100, 3000]`: 开启回调,并将回调间隔设置为该值。推荐设置为 2000。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0:调用成功。 + * + <0:调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list 音频管理 + */ + +- (int)enableAudioAEDReport:(NSInteger)interval; + +/** + * + * @type api + * @brief 调节本端播放收到的远端流时的音量。你必须在进房后进行设置。流的发布状态改变不影响设置生效。 + * @param streamId 远端流 ID。 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内:
    + * - 当该方法与 setRemoteRoomAudioPlaybackVolume:{@link #ByteRTCRoom#setRemoteRoomAudioPlaybackVolume:} 共同使用时,本地收听用户 A 的音量为后调用的方法设置的音量; + * - 当该方法与 setPlaybackVolume:{@link #ByteRTCEngine#setPlaybackVolume:} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * - 当你调用该方法设置远端流音量后,如果远端退房,接口设置失效。 + * @list 音频管理 + */ + +- (int)setRemoteAudioPlaybackVolume:(NSString* _Nonnull)streamId volume:(int)volume; +/** + * + * @type api + * @brief 开启/关闭耳返功能。 + * @param mode 是否开启耳返功能,参看 ByteRTCEarMonitorMode{@link #ByteRTCEarMonitorMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 使用耳返必须佩戴耳机。为保证低延时耳返最佳体验,建议佩戴有线耳机。 + * - 对于 iOS,仅支持软件耳返功能。 + * - 对于 macOS,耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + +- (int)setEarMonitorMode:(ByteRTCEarMonitorMode)mode; +/** + * + * @type api + * @valid since 3.60. + * @brief 开启/关闭耳返功能,并控制是否对耳返音频应用本地音频处理。 + * @param mode 是否开启耳返功能,参看 ByteRTCEarMonitorMode{@link #ByteRTCEarMonitorMode}。默认关闭。 + * @param filter 是否对耳返音频应用本地音频处理,参看 ByteRTCEarMonitorAudioFilter{@link #ByteRTCEarMonitorAudioFilter}。默认不经过音频处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 使用耳返功能必须佩戴耳机。为保证低延时耳返最佳体验,建议佩戴有线耳机。 + * - 对于 iOS,仅支持软件耳返功能。 + * - 对于 macOS,耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + +- (int)setEarMonitorMode:(ByteRTCEarMonitorMode)mode filter:(int)filter; +/** + * + * @type api + * @brief 设置耳返的音量。 + * @param volume 耳返的音量,取值范围:[0,100],单位:% + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 设置耳返音量前,你必须先调用 setEarMonitorMode:{@link #ByteRTCEngine#setEarMonitorMode:} 打开耳返功能。 + * @list 高级功能 + */ + +- (int)setEarMonitorVolume:(NSInteger)volume; +/** + * + * @hidden(macOS) + * @type api + * @brief 在纯媒体音频场景下,切换 iOS 设备与耳机之间的蓝牙传输协议。 + * @param mode 蓝牙传输协议。详见 ByteRTCBluetoothMode{@link #ByteRTCBluetoothMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 以下场景你会收到 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调:1)当前不支持设置 HFP;2)非纯媒体音频场景,建议在调用此接口前调用 setAudioScenario:{@link #ByteRTCEngine#setAudioScenario:} 设置纯媒体音频场景。 + * @list 音频管理 + */ + +- (int)setBluetoothMode:(ByteRTCBluetoothMode) mode; +/** + * + * @type api + * @brief 开启本地语音变调功能,多用于 K 歌场景。
    + * 使用该方法,你可以对本地语音的音调进行升调或降调等调整。 + * @param pitch 相对于语音原始音调的升高/降低值,取值范围[-12,12],默认值为 0,即不做调整。
    + * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。
    + * 超出取值范围则设置失败,并且会触发 rtcEngine:onWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onWarning:} 回调,提示 ByteRTCWarningCode{@link #ByteRTCWarningCode} 错误码为 `WARNING_CODE_SET_SCREEN_STREAM_INVALID_VOICE_PITCH` 设置语音音调不合法 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 音频处理 + */ + +- (int)setLocalVoicePitch:(NSInteger)pitch; +/** + * + * @type api + * @brief 开启/关闭音量均衡功能。
    + * 开启音量均衡功能后,人声的响度会调整为 -16lufs。如果已调用 setAudioMixingLoudness:loudness: 传入了混音音乐的原始响度,此音乐播放时,响度会调整为 -20lufs。 + * @param enable 是否开启音量均衡功能:
    + * - YES: 是 + * - NO: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该接口须在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 开始播放音频文件之前调用。 + * @list 音频管理 + */ + +- (int)enableVocalInstrumentBalance:(BOOL)enable; +/** + * + * @type api + * @brief 打开/关闭音量闪避功能,适用于在 RTC 通话过程中会同时播放短视频或音乐的场景,如“一起看”等。
    + * 开启该功能后,当检测到远端人声时,RTC 本地的媒体播放音量会自动减弱,从而保证远端人声的清晰可辨;当远端人声消失时,RTC 的本地媒体音量会恢复到闪避前的音量水平。 + * @param enable 是否开启音量闪避:
    + * - YES: 是 + * - NO: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + +- (int)enablePlaybackDucking:(BOOL)enable; +#pragma mark Core Video Methods + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @deprecated since 3.57, use setLocalVideoSink:withLocalRenderConfig:{@link #ByteRTCEngine#setLocalVideoSink:withLocalRenderConfig:} instead. + * @region 自定义视频采集渲染 + * @brief 将本地视频流与自定义渲染器绑定。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} + * @param requiredFormat videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 如果需要解除绑定,必须将 videoSink 设置为 null。退房时将清除绑定状态。 + * - 一般在收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * - 本方法获取的是前处理后的视频帧。 + */ + +- (int)setLocalVideoSink:(id _Nullable)videoSink + withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat NS_SWIFT_NAME(setLocalVideoSink(withSink:withPixelFormat:)) + __deprecated_msg("Will be removed in new version"); + +/** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 将本地视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate}。 + * @param config 本地视频帧回调配置,参看 ByteRTCLocalVideoSinkConfig{@link #ByteRTCLocalVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 videoSink 设置为 null。 + * - 一般在收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * @list 自定义流处理 + */ + +- (int)setLocalVideoSink:(id _Nullable)videoSink + withLocalRenderConfig:(ByteRTCLocalVideoSinkConfig*)config NS_SWIFT_NAME(setLocalVideoSink(withSink:withLocalRenderConfig:)); +/** + * + * @type api + * @hiddensdk(audiosdk) + * @deprecated since 3.57, use setRemoteVideoSink:withSink:withRemoteRenderConfig:{@link #ByteRTCEngine#setRemoteVideoSink:withSink:withRemoteRenderConfig:} instead. + * @region 自定义视频采集渲染 + * @brief 将远端视频流与自定义渲染器绑定。 + * @param streamId 远端流 ID。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} + * @param requiredFormat videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调获取到远端流信息之后,再调用该方法。 + * - 如果需要解除绑定,必须将 videoSink 设置为 null。退房时将清除绑定状态。 + * - 本方法获取的是后处理后的视频帧。 + */ + +- (int)setRemoteVideoSink:(NSString* _Nonnull)streamId + withSink:(id _Nullable)videoSink + withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat NS_SWIFT_NAME(setRemoteVideoSink(_:withSink:withPixelFormat:)) + __deprecated_msg("Will be removed in new version"); + +/** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 将远端视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param streamId 远端流 ID。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate}。 + * @param config 远端视频帧回调配置,参看 ByteRTCRemoteVideoSinkConfig{@link #ByteRTCRemoteVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调获取到远端流信息之后,再调用该方法。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 videoSink 设置为 null。 + * @list 自定义流处理 + */ + +- (int)setRemoteVideoSink:(NSString* _Nonnull)streamId + withSink:(id _Nullable)videoSink + withRemoteRenderConfig:(ByteRTCRemoteVideoSinkConfig*)config NS_SWIFT_NAME(setRemoteVideoSink(_:withSink:withRemoteRenderConfig:)); + +/** + * + * @hidden(macOS) for internal use + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置远端视频超分模式。 + * @param streamId 远端流 ID。 + * @param mode 超分模式,参看 ByteRTCVideoSuperResolutionMode{@link #ByteRTCVideoSuperResolutionMode}。 + * @return + * - 0: ByteRTCReturnStatusSuccess,SDK 调用成功,并不代表超分模式实际状态,需要根据回调 rtcEngine:onRemoteVideoSuperResolutionModeChanged:info:withMode:withReason:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteVideoSuperResolutionModeChanged:info:withMode:withReason:} 判断实际状态。 + * - -1: ByteRTCReturnStatusNativeInValid,native library 未加载。 + * - -2: ByteRTCReturnStatusParameterErr,参数非法,指针为空或字符串为空。 + * - -9: ByteRTCReturnStatusScreenNotSupport,不支持对屏幕流开启超分。 + * 其他错误码参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 如需使用该功能,需集成超分插件 ByteRTCVideoSRExtension.xcframework 及依赖库 bmf_mods_shared.xcframework,详情参看[按需集成插件](https: + * - 该方法须进房后调用。 + * - 远端用户视频流的原始分辨率不能超过 640 × 360 px。 + * - 支持对一路远端流开启超分,不支持对多路流开启超分。 + * @list 视频处理 + */ + +- (int)setRemoteVideoSuperResolution:(NSString* _Nonnull)streamId + withMode:(ByteRTCVideoSuperResolutionMode)mode; +/** + * + * @hidden not available on iOS + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置视频降噪模式。 + * @param mode 视频降噪模式。参看 ByteRTCVideoDenoiseMode{@link #ByteRTCVideoDenoiseMode}。 + * @return + * - 0: API 调用成功。(不适用于 iOS)用户可以根据回调函数 rtcEngine:onVideoDenoiseModeChanged:withReason:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDenoiseModeChanged:withReason:} 判断视频降噪是否开启。 + * - < 0: API 调用失败。 + * @note 如需使用该功能,需集成降噪插件 ByteRTCVideoDenoiseExtension.xcframework 及依赖库 bmf_mods_shared.xcframework,详情参看[按需集成插件](https: + * @list 视频处理 + */ + +- (int)setVideoDenoiser:(ByteRTCVideoDenoiseMode)mode; +/** + * + * @hidden(iOS) + * @valid since 3.57 + * @type api + * @brief 设置视频暗光增强模式。
    + * 对于光线不足、照明不均匀或背光等场景下推荐开启,可有效改善画面质量。 + * @param mode 默认不开启。参看 ByteRTCVideoEnhancementMode{@link #ByteRTCVideoEnhancementMode}。 + * @return + * - 0: API 调用成功。会立即生效,但需要等待下载和检测完成后才能看到增强后的效果。 + * - < 0: API 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 开启后会影响设备性能,应根据实际需求和设备性能决定是否开启。 + * - 对 RTC SDK 内部采集的视频和自定义采集的视频都生效。 + * @list 视频处理 + */ + +- (int)setLowLightAdjusted:(ByteRTCVideoEnhancementMode)mode; + + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本端采集的视频帧的旋转角度。
    + * 当摄像头倒置或者倾斜安装时,可调用本接口进行调整。对于手机等普通设备,可调用 setVideoRotationMode:{@link #ByteRTCEngine#setVideoRotationMode:} 实现旋转。 + * @param rotation 相机朝向角度,默认为 `ByteRTCVideoRotation0`,无旋转角度。详见 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 对于内部采集的视频画面,如果已调用 setVideoRotationMode:{@link #ByteRTCEngine#setVideoRotationMode:} 设置了旋转方向,会在此基础上叠加旋转角度。 + * - 调用本接口也将对自定义采集视频画面生效,在原有的旋转角度基础上叠加本次设置。 + * - 视频贴纸特效或通过 enableVirtualBackground{@link #ByteRTCVideoEffect#enableVirtualBackground:withSource:} 增加的虚拟背景,也会跟随本接口的设置进行旋转。 + * - 本地渲染视频和发送到远端的视频都会相应旋转,但不会应用到单流转推中。如果希望在单流转推的视频中应用旋转,调用 setVideoOrientation:{@link #ByteRTCEngine#setVideoOrientation:}。 + * @list 视频管理 + */ + +- (int)setVideoCaptureRotation:(ByteRTCVideoRotation)rotation; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端设置期望发布的最大分辨率视频流参数,包括分辨率、帧率、码率、网络不佳时的回退策略等(包含摄像头和屏幕的编码配置)。
    + * @param encoderConfig 期望发布的最大分辨率视频流参数。参看 ByteRTCVideoEncoderConfig{@link #ByteRTCVideoEncoderConfig}。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 自 V3.61 版本,本接口仅设置一路视频流参数。默认状态下只有单流,如需开启多路小流请使用:setLocalSimulcastMode:config:{@link #ByteRTCEngine#setLocalSimulcastMode:config:}。 + * - 调用该方法前,SDK 默认仅发布一路视频流,分辨率为 640px × 360px @15fps,编码偏好为帧率优先。 + * - 使用自定义采集时,必须调用该方法设置编码参数,以保证远端收到画面的完整性。 + * - 该方法设置的参数会同时作用于摄像头采集的视频流和屏幕共享流。在 iOS 端进行屏幕共享时,如果你调用了该方法设置屏幕共享视频流的编码参数,则需要重新启动屏幕采集,否则设置不生效。 + * @list 视频管理 + */ + +- (int)setVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig; + +/** + * + * @hidden currently not available + * @brief iOS 和 Mac 不支持 Fov,对齐其他端预留接口。 + */ + +- (int)setVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig withParameters:(NSDictionary * _Nullable) parameters; + + /** + * + * @valid since 3.60. + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端开启大小流(simulcast)功能。 + * @param mode 详见 ByteRTCVideoSimulcastMode{@link #ByteRTCVideoSimulcastMode}。默认为只发送单流。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 你应在进房前调用本接口。 + * - 调用该方法前,SDK 默认仅发布一条分辨率为 640px × 360px,帧率为 15fps 的视频流。 + * - 如需自定义小流参数请查看它的重载方法 (int)setVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig withParameters:(NSDictionary * _Nullable) parameters。 + * - 该方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + +- (int)setLocalSimulcastMode:(ByteRTCVideoSimulcastMode)mode ; + +/** + * + * @valid since 3.60. + * @type api + * @brief 发布端进行大小流(simulcast)设置。 + * @param mode 详见 ByteRTCVideoSimulcastMode{@link #ByteRTCVideoSimulcastMode}。默认为只发送单流。你应在进房前调用修改本参数。 + * @param streamConfig 小流参数。最多可设置 3 路。分辨率按照从小到大顺序,且每路流参数分辨率需小于大流 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 设置参数。否则可能会设置失败。参看 ByteRTCVideoEncoderConfig{@link #ByteRTCVideoEncoderConfig}。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 调用本方法前,SDK 默认仅发布一条分辨率为 640px × 360px @15fps 的视频流。 + * - 本方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + +- (int)setLocalSimulcastMode:(ByteRTCVideoSimulcastMode)mode config:(NSArray * _Nullable)streamConfig; + +/** + * + * @hidden(macOS) + * @valid since 3.58 + * @type api + * @brief 开启自定义采集视频帧的 Alpha 通道编码功能。
    + * 适用于需要分离推流端视频主体与背景,且在拉流端可自定义渲染背景的场景。 + * @param alphaLayout 分离后的 Alpha 通道相对于 RGB 通道信息的排列位置。当前仅支持 ByteRTCAlphaLayout.ByteRTCAlphaLayoutTop,即置于 RGB 通道信息上方。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该接口仅作用于自定义采集的 ByteRTCVideoPixelFormat.ByteRTCVideoPixelFormatCVPixelBuffer 格式视频帧。 + * - 该接口须在发布视频流之前调用。 + * - 调用本接口开启 Alpha 通道编码后,你需调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 把自定义采集的视频帧推送至 RTC SDK。若推送了不支持的视频帧格式,则调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 时会返回错误码 ByteRTCReturnStatus.ByteRTCReturnStatusParameterErr。 + * @list 视频管理 + */ + +-(int)enableAlphaChannelVideoEncode:(ByteRTCAlphaLayout)alphaLayout; +/** + * + * @hidden(macOS) + * @valid since 3.58 + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭外部采集视频帧的 Alpha 通道编码功能。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 该接口须在停止发布视频流之后调用。 + * @list 视频管理 + */ + +-(int)disableAlphaChannelVideoEncode; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
    + * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数包括模式、分辨率、帧率。 + * @param captureConfig 视频采集参数。参看: ByteRTCVideoCaptureConfig{@link #ByteRTCVideoCaptureConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 前调用本接口。 + * - 建议同一设备上的不同引擎使用相同的视频采集参数。 + * - 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + * @list 视频管理 + */ + +- (int)setVideoCaptureConfig:(ByteRTCVideoCaptureConfig * _Nullable)captureConfig; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地视频渲染时使用的视图,并设置渲染模式。 + * @param canvas 视图信息和渲染模式,参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas} + * @return + * - 0:成功。 + * - -2: 参数错误。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 你应在加入房间前,绑定本地视图。退出房间后,此设置仍然有效。 + * - 如果需要解除绑定,你可以调用本方法传入空视图。 + * @list 视频管理 + */ + +- (int)setLocalVideoCanvas:(ByteRTCVideoCanvas * _Nullable)canvas NS_SWIFT_NAME(setLocalVideoCanvas(withCanvas:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 修改本地视频渲染模式和背景色。 + * @param renderMode 渲染模式。参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + * @param backgroundColor 背景颜色。参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas}.backgroundColor + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 你可以在本地视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + +- (int)updateLocalVideoCanvas:(ByteRTCRenderMode)renderMode + withBackgroundColor:(NSUInteger)backgroundColor NS_SWIFT_NAME(updateLocalVideoCanvas(withBackgroundColor:)); +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 渲染来自指定远端用户 uid 的视频流时,设置使用的视图和渲染模式。
    + * 如果需要解除视频的绑定视图,把 `canvas.view` 设置为空。(`canvas` 中其他参数不能为空。) + * @param streamId 远端流 ID。 + * @param canvas 视图信息和渲染模式,参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas}。3.56 版本起支持通过 `renderRotation` 设置远端视频渲染的旋转角度。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 本地用户离开房间时,会解除调用此 API 建立的绑定关系;远端用户离开房间则不会影响。 + * @list 视频管理 + */ + +- (int)setRemoteVideoCanvas:(NSString* _Nonnull)streamId + withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas NS_SWIFT_NAME(setRemoteVideoCanvas(_:withCanvas:)); + +/** + * + * @deprecated since 3.56, and will be deleted in 3.62. Use updateRemoteStreamVideoCanvas:withRemoteVideoRenderConfig:{@link #ByteRTCEngine#updateRemoteStreamVideoCanvas:withRemoteVideoRenderConfig:} instead. + * @type api + * @hiddensdk(audiosdk) + * @brief 修改远端视频帧的渲染设置,包括渲染模式和背景颜色。 + * @param streamId 远端流 ID。 + * @param renderMode 渲染模式,参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + * @param backgroundColor 背景颜色,参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas}.backgroundColor + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 你可以在远端视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + +- (int)updateRemoteStreamVideoCanvas:(NSString* _Nonnull)streamId + withRenderMode:(ByteRTCRenderMode)renderMode + withBackgroundColor:(NSUInteger)backgroundColor NS_SWIFT_NAME(updateRemoteStreamVideoCanvas(_:withRenderMode:withBackgroundColor:)); + +/** + * + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用 SDK 内部渲染时,修改远端视频帧的渲染设置,包括渲染模式、背景颜色和旋转角度。 + * @param streamId 远端流 ID。 + * @param remoteVideoRenderConfig 视频帧渲染设置。具体参看 ByteRTCRemoteVideoRenderConfig{@link #ByteRTCRemoteVideoRenderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 setRemoteVideoCanvas:withCanvas:{@link #ByteRTCEngine#setRemoteVideoCanvas:withCanvas:} 设置了远端视频渲染模式后,你可以调用此接口更新渲染模式、背景颜色、旋转角度的设置。 + * - 该接口可以在远端视频渲染过程中调用,调用结果会实时生效。 + * @list 视频管理 + */ + +- (int)updateRemoteStreamVideoCanvas:(NSString* _Nonnull)streamId + withRemoteVideoRenderConfig:(ByteRTCRemoteVideoRenderConfig * _Nonnull)remoteVideoRenderConfig + NS_SWIFT_NAME(updateRemoteStreamVideoCanvas(_:withRemoteVideoRenderConfig:)); + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即开启内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStartVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartVideoCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。 + * - 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。 + * - 如果需要从自定义视频采集切换为内部视频采集,你必须先停止发布流,关闭自定义采集,再调用此方法手动开启内部采集。 + * - 内部视频采集使用的摄像头由 switchCamera:{@link #ByteRTCEngine#switchCamera:} 接口指定。(macOS 不支持) + * - 自 v3.37.0 升级版本,你需要在应用中向用户申请摄像头权限后才能开始采集。 + * @list 视频管理 + */ + +- (int)startVideoCapture NS_SWIFT_NAME(startVideoCapture()); + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即关闭内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStopVideoCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 可以开启内部视频采集。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + * @list 视频管理 + */ + +- (int)stopVideoCapture NS_SWIFT_NAME(stopVideoCapture()); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 为采集到的视频流开启镜像 + * @param mirrorType 镜像类型,参看 ByteRTCMirrorType{@link #ByteRTCMirrorType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 切换视频源不影响镜像设置。 + * - 屏幕视频流始终不受镜像设置影响。 + * - 使用外部渲染器时,`mirrorType` 支持设置为 `0`(无镜像)和 `3`(本地预览和编码传输镜像),不支持设置为 `1`(本地预览镜像)。 + * - 该接口调用前,各视频源的初始状态如下: + * + * + * + * + *
    前置摄像头后置摄像头自定义采集视频源 桌面端摄像头
    移动端本地预览镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 /
    桌面端// 本地预览不镜像,编码传输不镜像 本地预览镜像,编码传输不镜像
    + * @list 视频处理 + */ + +- (int)setLocalVideoMirrorType:(ByteRTCMirrorType) mirrorType; + +/** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用内部渲染时,为远端流开启镜像。 + * @param streamId 远端流 ID。 + * @param mirrorType 远端流的镜像类型,参看 ByteRTCRemoteMirrorType{@link #ByteRTCRemoteMirrorType}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list 视频处理 + */ + +- (int)setRemoteVideoMirrorType:(NSString* _Nonnull)streamId withMirrorType:(ByteRTCRemoteMirrorType)mirrorType; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置采集视频的旋转模式。默认以 App 方向为旋转参考系。
    + * 接收端渲染视频时,将按照和发送端相同的方式进行旋转。 + * @param rotationMode 视频旋转参考系为 App 方向或重力方向,参看 ByteRTCVideoRotationMode{@link #ByteRTCVideoRotationMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 旋转仅对内部视频采集生效,不适用于外部视频源和屏幕源。 + * - 调用该接口时已开启视频采集,将立即生效;调用该接口时未开启视频采集,则将在采集开启后生效。 + * - 更多信息请参考[视频采集方向](https: + * @list 视频管理 + */ + +- (int)setVideoRotationMode:(ByteRTCVideoRotationMode) rotationMode; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 在自定义视频前处理及编码前,设置 RTC 链路中的视频帧朝向,默认为 Adaptive 模式。
    + * 移动端开启视频特效贴纸,或使用自定义视频前处理时,建议固定视频帧朝向为 Portrait 模式。单流转推场景下,建议根据业务需要固定视频帧朝向为 Portrait 或 Landscape 模式。不同模式的具体显示效果参看[视频帧朝向](https: + * @param orientation 视频帧朝向,参看 ByteRTCVideoOrientation{@link #ByteRTCVideoOrientation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 视频帧朝向设置仅适用于内部采集视频源。对于自定义采集视频源,设置视频帧朝向可能会导致错误,例如宽高对调。屏幕源不支持设置视频帧朝向。 + * - 编码分辨率的更新与视频帧处理是异步操作,进房后切换视频帧朝向可能导致画面出现短暂的裁切异常,因此建议在进房前设置视频帧朝向,且不在进房后进行切换。 + * @list 视频处理 + */ + +- (int)setVideoOrientation:(ByteRTCVideoOrientation) orientation; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 切换视频内部采集时使用的前置/后置摄像头
    + * 调用此接口后,在本地会触发 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 回调。 + * @param cameraId 摄像头类型,参看 ByteRTCCameraID{@link #ByteRTCCameraID}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 默认使用前置摄像头。 + * - 如果你正在使用相机进行视频采集,切换操作当即生效;如果相机未启动,后续开启内部采集时,会打开设定的摄像头。 + * @list 视频管理 + */ + +- (int)switchCamera:(ByteRTCCameraID) cameraId; +/** + * + * @type api + * @brief 获取视频特效接口。 + * @return 视频特效接口,参看 ByteRTCVideoEffect{@link #ByteRTCVideoEffect}。 + * @list 视频处理 + */ + +- (ByteRTCVideoEffect* _Null_unspecified)getVideoEffectInterface NS_SWIFT_NAME(getVideoEffectInterface()); +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 开启/关闭基础美颜。 + * @param enable 基础美颜开关
    + * - YES: 开启基础美颜 + * - NO: 关闭基础美颜(默认) + * @return + * - 0: 调用成功。 + * - –1001: RTC SDK 版本不支持此功能。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 本方法不能与高级视频特效接口共用。如已购买高级视频特效,建议参看[集成指南](https: + * - 使用此功能需要集成特效 SDK,建议使用特效 SDK v4.4.2+ 版本。更多信息参看 [Native 端基础美颜](https: + * - 调用 setBeautyIntensity:withIntensity:{@link #ByteRTCEngine#setBeautyIntensity:withIntensity:} 设置基础美颜强度。若在调用本方法前没有设置美颜强度,则使用默认强度。各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * - 本方法仅适用于视频源,不适用于屏幕源。 + * @list 视频处理 + */ + +- (int) enableEffectBeauty:(BOOL)enable; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 调整基础美颜强度。 + * @param beautyMode 基础美颜模式,参看 ByteRTCEffectBeautyMode{@link #ByteRTCEffectBeautyMode}。 + * @param intensity 美颜强度,取值范围为 [0,1]。强度为 0 表示关闭。
    + * 各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * @return + * - 0: 调用成功。 + * - –2: `intensity` 范围超限。 + * - –1001: RTC SDK 版本不支持此功能。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 若在调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect} 前设置美颜强度,则对应美颜功能的强度初始值会根据设置更新。 + * - 销毁引擎后,美颜功能强度恢复默认值。 + * @list 视频处理 + */ + +- (int) setBeautyIntensity:(ByteRTCEffectBeautyMode) beautyMode + withIntensity:(float)intensity; + +#pragma mark - ICameraControl +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头(前置/后置)的变焦倍数 + * @param zoomRatio 变焦倍数。取值范围是 [1, <最大变焦倍数>]。
    + * 最大变焦倍数可以通过调用 getCameraZoomMaxRatio{@link #ByteRTCEngine#getCameraZoomMaxRatio} 获取。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置摄像头变焦倍数。 + * - 设置结果在调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后失效。 + * - 你可以调用 setVideoDigitalZoomConfig:size:{@link #ByteRTCEngine#setVideoDigitalZoomConfig:size:} 设置数码变焦参数,调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 进行数码变焦。 + * @list 视频管理 + */ + +- (int) setCameraZoomRatio: (float) zoomRatio; +/** + * + * @hidden(macOS) + * @type api + * @brief 获取当前使用的摄像头(前置/后置)的最大变焦倍数 + * @return 最大变焦倍数 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头最大变焦倍数。 + * @list 视频管理 + */ + +- (float) getCameraZoomMaxRatio; +/** + * + * @hidden(macOS) + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持变焦(数码/光学变焦)。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头变焦能力。 + * @list 视频管理 + */ + +- (bool) isCameraZoomSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持闪光灯。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测闪光能力。 + * @list 视频管理 + */ + +- (bool) isCameraTorchSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 打开/关闭当前使用的摄像头(前置/后置)的闪光灯 + * @param torchState 打开/关闭。参看 ByteRTCTorchState{@link #ByteRTCTorchState}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置闪光灯。 + * - 设置结果在调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后失效。 + * @list 视频管理 + */ + +- (int) setCameraTorch: (ByteRTCTorchState)torchState; +/** + * + * @hidden(macOS) + * @type api + * @brief 检查当前使用的摄像头是否支持手动对焦。 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集,才能检查摄像头是否支持手动对焦。 + * @list 视频管理 + */ + +- (bool)isCameraFocusPositionSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头的对焦点。 + * @param position 对焦点坐标。以本地预览画布的左上为坐标原点,`position`的`x`字段为对焦点水平方向归一化坐标,`y`字段为对焦点垂直方向归一化坐标,取值范围为 [0, 1]。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置对焦点。 + * - 对焦点设置为画布中央(即`x`和`y`均取 0.5)时,恢复系统默认值。 + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后,设置的对焦点失效。 + * @list 视频管理 + */ + +- (int)setCameraFocusPosition:(CGPoint)position; +/** + * + * @hidden(macOS) + * @type api + * @brief 检查当前使用的摄像头是否支持手动设置曝光点。 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检查曝光点设置能力。 + * @list 视频管理 + */ + +- (bool)isCameraExposurePositionSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头的曝光点。 + * @param position 曝光点坐标。以本地预览画布的左上为坐标原点,`position`的`x`字段为曝光点水平方向归一化坐标,`y`字段为曝光点垂直方向归一化坐标,取值范围为 [0, 1]。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置曝光点。 + * - 曝光点设置为画布中央(即`x`和`y`均取 0.5)时,恢复系统默认值。 + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后,设置的曝光点失效。 + * @list 视频管理 + */ + +- (int)setCameraExposurePosition:(CGPoint)position; +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头的曝光补偿。 + * @param val 曝光补偿值,取值范围 [-1, 1],0 为系统默认值(没有曝光补偿)。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置曝光补偿。 + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后,设置的曝光补偿失效。 + * @list 视频管理 + */ + +- (int)setCameraExposureCompensation:(float)val; +/** + * + * @hidden(macOS) + * @valid since 353 + * @type api + * @brief 启用或禁用内部采集时人脸自动曝光模式。此模式会改善强逆光下,脸部过暗的问题;但也会导致 ROI 以外区域过亮/过暗的问题。 + * @param enable 是否启用。iOS默认开启,Android默认关闭。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note 在采集前或采集中调用此接口均可生效。 + * @list 视频管理 + */ + +- (int)enableCameraAutoExposureFaceMode:(bool)enable; +/** + * + * @hidden(macOS) + * @valid since 353 + * @type api + * @brief 设置内部采集适用动态帧率时,帧率的最小值。 + * @param framerate 最小值。单位为 fps。默认值是 7。
    + * 动态帧率的最大帧率是通过 setVideoCaptureConfig:{@link #ByteRTCEngine#setVideoCaptureConfig:} 设置的帧率值。当传入参数大于最大帧率时,使用固定帧率模式,帧率为最大帧率;当传入参数小于最大帧率时,使用动态帧率。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note + * - 你必须在调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部采集前,调用此接口方可生效。 + * - 如果由于性能降级、静态适配等原因导致采集最大帧率变化时,已设置的最小帧率值会与新的采集最大帧率值重新比较。比较结果变化可能导致固定/动态帧率模式切换。 + * - 对 Android,默认开启动态帧率模式 + * - 对 iOS,默认使用固定帧率模式 + * @list 视频管理 + */ + +- (int)setCameraAdaptiveMinimumFrameRate:(int)framerate; + +#pragma mark - MediaMetadataData InnerVideoSource +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 通过视频帧发送 SEI 数据。
    + * 在视频通话场景下,SEI 数据会随视频帧发送;在语音通话场景下,SDK 会自动生成一路 16px × 16px 的黑帧视频流用来发送 SEI 数据。 + * @param message SEI 消息,建议每帧 SEI 数据总长度不超过 4 KB。 + * @param repeatCount 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
    + * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeatCount+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 ByteRTCSEICountPerFrame{@link #ByteRTCSEICountPerFrame}。 + * @return + * - >= 0: 将被添加到视频帧中的 SEI 的数量。 + * - < 0: 发送失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率。在语音通话场景下,黑帧帧率为 15 fps。 + * - 从程序的启动到结束,建议用同一种发送模式。 + * - 语音通话场景中,仅支持在内部采集模式下调用该接口发送 SEI 数据。 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据;语音通话场景下,若调用此接口后 1min 内未有 SEI 数据发送,则 SDK 会自动取消发布视频黑帧。 + * - 消息发送成功后,远端会收到 rtcEngine:onSEIMessageReceived:info:andMessage:{@link #ByteRTCEngineDelegate#rtcEngine:onSEIMessageReceived:info:andMessage:} 回调。 + * - 语音通话切换至视频通话时,会停止使用黑帧发送 SEI 数据,自动转为用采集到的正常视频帧发送 SEI 数据。 + * @list 消息 + */ + +- (int)sendSEIMessage: (NSData* _Nonnull)message andRepeatCount:(int)repeatCount andCountPerFrame:(ByteRTCSEICountPerFrame) mode; +/** + * + * @type api + * @list 消息 + * @brief 以 Key-Value 格式通过视频帧发送 SEI 数据。 + * 调用此接口前,必须在调用 setLiveMode:{@link #ByteRTCRoom#setLiveMode:} 时将房间模式设置为 `kRoomLiveModeSoloHost` 开启单人直播模式。 + * @param jsonString JSON 格式的键值对,例如 `{"key1":"value1","key2":"value2"}`: + * - 如果某个 Key 对应的 Value 为空(例如 `""` 或 `null`),则会从 SEI 字典中删除该 Key; + * - 所有 Key-Value 合并后的总 SEI 数据大小不能超过 10KB。 + * @param count 连续发送该 SEI 数据的次数。 + * - 当 `isKeyFrameOnly` 为 YES 时,代表伴随 `count` 个关键帧(I 帧)发送; + * - 当 `isKeyFrameOnly` 为 NO 时,代表伴随 `count` 个视频帧发送。 + * @param isKeyFrameOnly 是否只随关键帧(I 帧)发送: + * - YES:只在关键帧发送; + * - NO:所有帧都会发送。 + * @param allowOverwrite 设置该 Key 写入后,后续请求是否允许覆盖它: + * - true:后续请求可覆盖该 Key 的 Value,且 `count` 也会更新为新值; + * - false:后续请求会忽略该 Key 的新值,保持原样。对于已存在的 Key,是否允许本次覆盖取决于该 Key 已保存的覆盖策略。 + * @return + * - 0: 调用成功。 + * - < 0: 发送失败。 + * - -1: 视频模块未启用。 + * - -2: 参数错误(JSON 为空或 count <= 0)。 + * - -3: JSON 格式错误。 + * - -4: SEI 数据总大小超过限制。 + */ + +- (int)sendLivePushSEIMessage:(NSString *_Nonnull)jsonString + count:(NSInteger)count + isKeyFrameOnly:(BOOL)isKeyFrameOnly + allowOverwrite:(BOOL)allowOverwrite; +/** + * + * @hidden for internal use only + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief WTN 流视频帧发送 SEI 数据。 + * @param channelId SEI 的消息传输通道,取值范围 [0 - 255]。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message SEI 消息。 + * @param repeatCount 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
    + * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeat_count+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 ByteRTCSEICountPerFrame{@link #ByteRTCSEICountPerFrame}。 + * @return + * - < 0:说明调用失败 + * - = 0:说明当前发送队列已满,无法发送 + * - > 0: 说明调用成功,该数值为已经发送 SEI 的数量 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据 + * - 消息发送成功后,远端会收到 rtcEngine:onPublicStreamSEIMessageReceivedWithChannel:andChannelId:andMessage:回调。 + * - 调用失败时,本地及远端都不会收到回调。 + * @list 消息 + */ + +- (int)sendPublicStreamSEIMessage: (int)channelId andMessage:(NSData* _Nonnull)message andRepeatCount:(int)repeatCount andCountPerFrame:(ByteRTCSEICountPerFrame)mode; +#pragma mark - VideoFrameObserver InnerVideoSource +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地摄像头数码变焦参数,包括缩放倍数,移动步长。 + * @param type 数码变焦参数类型,缩放系数或移动步长。参看 ByteRTCZoomConfigType{@link #ByteRTCZoomConfigType}。必填。 + * @param size 缩放系数或移动步长,保留到小数点后三位。默认值为 0。必填。
    + * 选择不同 `type` 时有不同的取值范围。当计算后的结果超过缩放和移动边界时,取临界值。
    + * - `ByteRTCZoomConfigTypeFocusOffset`:缩放系数增量,范围为 [0, 7]。例如,设置为 0.5 时,如果调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 选择 Zoom in,则缩放系数增加 0.5。缩放系数范围 [1,8],默认为 `1`,原始大小。 + * - `ByteRTCZoomConfigTypeMoveOffset`:移动百分比,范围为 [0, 0.5],默认为 0,不移动。如果调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 选择的是左右移动,则移动距离为 size x 原始视频宽度;如果选择的是上下移动,则移动距离为 size x 原始视频高度。例如,视频帧边长为 1080 px,设置为 0.5 时,实际移动距离为 0.5 x 1080 px = 540 px。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 每次调用本接口只能设置一种参数。如果缩放系数和移动步长都需要设置,分别调用本接口传入相应参数。 + * - 由于移动步长的默认值为 `0` ,在调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 或 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:} 进行数码变焦操作前,应先调用本接口。 + * @list 视频处理 + */ + +- (int)setVideoDigitalZoomConfig:(ByteRTCZoomConfigType)type size:(float)size; +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 控制本地摄像头数码变焦,缩放或移动一次。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ByteRTCZoomDirectionType{@link #ByteRTCZoomDirectionType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig:size:{@link #ByteRTCEngine#setVideoDigitalZoomConfig:size:} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 如果你希望实现持续数码变焦操作,调用 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:}。 + * - 移动端可对摄像头进行光学变焦控制,参看 `setCameraZoomRatio:`. + * @list 视频处理 + */ + +- (int)setVideoDigitalZoomControl:(ByteRTCZoomDirectionType) direction; +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 开启本地摄像头持续数码变焦,缩放或移动。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ByteRTCZoomDirectionType{@link #ByteRTCZoomDirectionType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig:size:{@link #ByteRTCEngine#setVideoDigitalZoomConfig:size:} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值并停止操作。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 你也可以调用 stopVideoDigitalZoomControl{@link #ByteRTCEngine#stopVideoDigitalZoomControl} 手动停止控制。 + * - 如果你希望实现单次数码变焦操作,调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:}。 + * - 如果你希望实现单次数码变焦操作,调用 `setVideoDigitalZoomControl:`。 + * @list 视频处理 + */ + +- (int)startVideoDigitalZoomControl:(ByteRTCZoomDirectionType)direction; +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地摄像头持续数码变焦。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 关于开始数码变焦,参看 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:}。 + * @list 视频处理 + */ + +- (int)stopVideoDigitalZoomControl; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置自定义视频前处理器。
    + * 使用这个视频前处理器,你能够调用 processVideoFrame:{@link #ByteRTCVideoProcessorDelegate#processVideoFrame:} 对 RTC SDK 采集得到的视频帧进行前处理,并将处理后的视频帧用于 RTC 音视频通信。 + * @param processor 自定义视频处理器,详见 ByteRTCVideoProcessorDelegate{@link #ByteRTCVideoProcessorDelegate}。如果传入 null,则不对 RTC SDK 采集得到的视频帧进行前处理。
    + * SDK 只持有 processor 的弱引用,你应保证其生命周期。
    + * 在设计 `processor` 时,应从 ByteRTCVideoFrame{@link #ByteRTCVideoFrame} 的 `textureBuf` 字段获取视频帧数据;
    + * 处理后返回的视频帧数据格式应为 ByteRTCVideoPixelFormat{@link #ByteRTCVideoPixelFormat} 中的 `ByteRTCVideoPixelFormatCVPixelBuffer`,且必须存放在返回帧数据的 `textureBuf` 字段中。 + * @param config 自定义视频前处理器适用的设置,详见 ByteRTCVideoPreprocessorConfig{@link #ByteRTCVideoPreprocessorConfig}。
    + * 当前,`config` 中的 `required_pixel_format` 仅支持:`ByteRTCVideoPixelFormatI420` 和 `ByteRTCVideoPixelFormatUnknown`:
    + * - 设置为 `Unknown` 时,RTC SDK 给出供 processor 处理的视频帧格式即采集的格式。 + * - 设置为 `ByteRTCVideoPixelFormatI420` 时,RTC SDK 会将采集得到的视频转变为对应的格式,供前处理使用。 + * - 设置为其他值时,此方法调用失败。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 重复调用此接口时,仅最后一次调用生效。效果不会叠加。 + * - 对于 iOS 平台,将 ByteRTCVideoPreprocessorConfig{@link #ByteRTCVideoPreprocessorConfig} 中的 requiredPixelFormat 设置为 `kVideoPixelFormatUnknown`,可以通过避免格式转换带来一些性能优化。 + * @list 自定义流处理 + */ + +- (int)registerLocalVideoProcessor:(_Nullable id) processor + withConfig:(ByteRTCVideoPreprocessorConfig* _Nullable)config NS_SWIFT_NAME(registerLocalVideoProcessor(_:withConfig:)); +#pragma mark - LocalEncodedVideoFrameObserver +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册本地视频帧监测器。
    + * 无论使用内部采集还是自定义采集,调用该方法后,SDK 每监测到一帧本地视频帧时,都会将视频帧信息通过 onLocalEncodedVideoFrame:Frame:{@link #ByteRTCLocalEncodedVideoFrameObserver#onLocalEncodedVideoFrame:Frame:} 回调给用户 + * @param frameObserver 本地视频帧监测器,参看 ByteRTCLocalEncodedVideoFrameObserver{@link #ByteRTCLocalEncodedVideoFrameObserver}。将参数设置为 nullptr 则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该方法可在进房前后任意时间调用,在进房前调用可保证尽可能早地监测视频帧并触发回调 + * @list 自定义流处理 + */ + +- (int)registerLocalEncodedVideoFrameObserver:(_Nullable id) frameObserver NS_SWIFT_NAME(registerLocalEncodedVideoFrameObserver(_:)); +#pragma mark Audio Routing Controller +/** + * + * @hidden(macOS) + * @type api + * @brief 强制切换当前的音频播放路由。默认使用 setDefaultAudioRoute:{@link #ByteRTCEngine#setDefaultAudioRoute:} 中设置的音频路由。
    + * 音频播放路由发生变化时,会收到 rtcEngine:onAudioRouteChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioRouteChanged:} 回调。 + * @param audioRoute 音频播放路由,参见 ByteRTCAudioRoute{@link #ByteRTCAudioRoute}。仅支持扬声器和默认路由设备。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 对于绝大多数音频场景,推荐使用 setDefaultAudioRoute:{@link #ByteRTCEngine#setDefaultAudioRoute:} 设置默认音频路由,并借助 RTC SDK 的音频路由自动切换逻辑即可完成。切换逻辑参见[移动端设置音频路由](https: + * - 本接口支持在通话模式和媒体模式下使用,切换的目标路由仅支持内置扬声器。 + * - 不同音频场景中,音频路由和发布订阅状态到音量类型的映射关系详见 ByteRTCAudioScenarioType{@link #ByteRTCAudioScenarioType} 。 + * @list 音频管理 + */ + +- (int)setAudioRoute:(ByteRTCAudioRoute)audioRoute; +/** + * + * @hidden(macOS) + * @type api + * @brief 获取当前使用的音频播放路由。 + * @return 详见 ByteRTCAudioRoute{@link #ByteRTCAudioRoute} + * @note 要设置音频路由,详见 setAudioRoute:{@link #ByteRTCEngine#setAudioRoute:},仅适用于移动端。 + * @list 音频管理 + */ + +- (ByteRTCAudioRoute)getAudioRoute; +/** + * + * @type api + * @brief 启用匹配外置声卡的音频处理模式 + * @param enable
    + * - true: 开启 + * - false: 不开启(默认) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 当采用外接声卡进行音频采集时,建议开启此模式,以获得更好的音质。 + * - 开启此模式时,仅支持耳机播放。如果需要使用扬声器或者外置音箱播放,关闭此模式。 + * @list 音频管理 + */ + +- (int)enableExternalSoundCard:(bool)enable; + /** + * + * @hidden(macOS) + * @type api + * @brief 将默认的音频播放设备设置为听筒或扬声器。 + * @param audioRoute 音频播放设备。参看 ByteRTCAudioRoute{@link #ByteRTCAudioRoute}。仅支持听筒或扬声器。 + * @return + * - 0: 方法调用成功。 + * - < 0: 方法调用失败。 + * @note 对于音频路由切换逻辑,参见[移动端设置音频路由](https: + * @list 音频管理 + */ + +- (int)setDefaultAudioRoute:(ByteRTCAudioRoute)audioRoute; +#pragma mark WTN/CDN +/** + * + * @hiddensdk(audiosdk) + * @hidden for internal use only + * @type api + */ + +- (int)pushClientMixedStreamExternalVideoFrame:(NSString * _Nonnull)uid withFrame:(ByteRTCVideoFrameData * _Nonnull)frame; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @region 转推 CDN/WTN + * @brief 设置客户端合流的观察者 + * @param observer 客户端转推直播观察者。详见 ByteRTCClientMixedStreamDelegate{@link #ByteRTCClientMixedStreamDelegate}。
    + * 通过注册 observer 接收转推直播相关的回调。 + * @return 方法调用结果。
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list CDN 推流 + */ + +- (int)setClientMixedStreamObserver:(_Nullable id)observer; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @list CDN 推流 + */ + +- (int)startClientMixedStream:(NSString * _Nonnull)taskId withMixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config + withExtraConfig:(ByteRTCClientMixedStreamConfig*)extraConfig; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @list CDN 推流 + */ + +- (int)updateClientMixedStream:(NSString * _Nonnull)taskId withMixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config withExtraConfig:(ByteRTCClientMixedStreamConfig*)extraConfig; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @list CDN 推流 + */ + +- (int)stopClientMixedStream:(NSString*)taskId; +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `startPushMixedStreamToCDN:mixedConfig:observer:` 和 `startPushPublicStream:withLayout:` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 指定房间中的媒体流,合成后一路流发布到 CDN 或发布一路 WTN 流。 + * @param taskId 转推直播任务 ID,长度不超过 127 字节。 当 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig} 中的 `PushTargetType = 0` 时, 用于标识转推直播任务。你可以在同一房间内发起多个转推直播任务,并用不同的 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 + * 当 `PushTargetType = 1` 时,设置无效,传空即可。 + * @param pushTargetConfig 推流目标配置参数,比如设置推流地址、WTN流 ID。参看 ByteRTCMixedStreamPushTargetConfig{@link #ByteRTCMixedStreamPushTargetConfig}。 + * @param config 合流转推配置参数,比如设置合流的图片、视频视图布局和音频属性。参看 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}。 + * @return + * - 0: 成功。你可以通过 rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:} 回调获取启动结果和推流过程中的事件。 + * - !0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在[控制台](https: + * - 调用 stopPushMixedStream:withPushTargetType:{@link #ByteRTCEngine#stopPushMixedStream:withPushTargetType:} 停止转推直播。 + * - 调用 updatePushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#updatePushMixedStream:withPushTargetConfig:withMixedConfig:} 可以更新部分任务参数。 + * @list CDN 推流 + * @order 0 + */ + +- (int)startPushMixedStream:(NSString * _Nonnull)taskId withPushTargetConfig:(ByteRTCMixedStreamPushTargetConfig*)pushTargetConfig withMixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config; +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `updatePushMixedStreamToCDN:mixedConfig:` 和 `updatePublicStreamParam:withLayout:` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 更新推 CDN/WTN 流转推参数,会收到 rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:} 回调。
    + * 使用 startPushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#startPushMixedStream:withPushTargetConfig:withMixedConfig:} 启用转推直播功能后,使用此方法更新功能配置参数。 + * @param taskId 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 + * @param pushTargetConfig 推流目标配置参数,比如设置推流地址、WTN流 ID。参看 ByteRTCMixedStreamPushTargetConfig{@link #ByteRTCMixedStreamPushTargetConfig}。 + * @param config 转推直播配置参数,参看 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}。除特殊说明外,均支持过程中更新。
    + * 调用时,结构体中没有传入值的属性,会被更新为默认值。 + * @return + * - 0: 成功。 + * - !0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + * @order 4 + */ + +- (int)updatePushMixedStream:(NSString *_Nonnull)taskId withPushTargetConfig:(ByteRTCMixedStreamPushTargetConfig*)pushTargetConfig withMixedConfig:(ByteRTCMixedStreamConfig *_Nonnull)config; + +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN:` 方法来停止合流转推任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止 WTN 流或合流转推 CDN 任务。 + * @param taskId 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 + * @param pushTargetType 参看 ByteRTCMixedStreamPushTargetType{@link #ByteRTCMixedStreamPushTargetType}。 + * @return + * + 0: 成功 + * + !0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 关于启动合流转推直播或 WTN 流,参看 startPushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#startPushMixedStream:withPushTargetConfig:withMixedConfig:}。 + * @list CDN 推流 + * @order 3 + */ + +- (int)stopPushMixedStream:(NSString *_Nonnull)taskId withPushTargetType:(ByteRTCMixedStreamPushTargetType)pushTargetType; +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `startPushSingleStreamToCDN` 来启动单流转推任务。 + * @hiddensdk(audiosdk) + * @brief 将房间内某一路音视频流,推送到指定的 RTC 房间或 CDN 地址。此过程不涉及编解码。 + * @param taskId 任务 ID。
    + * 你可以发起多个转推任务,并用不同的任务 ID 加以区分。当你需要发起多个转推任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 + * @param singleStream 单流转推配置参数。详见 ByteRTCPushSingleStreamParam{@link #ByteRTCPushSingleStreamParam}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在调用该接口前,你需要在[控制台](https: + * - 调用该方法后,关于启动结果和推流过程中的错误,会收到 rtcEngine:onSingleStreamEvent:withTaskId:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onSingleStreamEvent:withTaskId:withErrorCode:} 回调。 + * - 调用 stopPushSingleStream:{@link #ByteRTCEngine#stopPushSingleStream:} 停止任务。 + * - 由于本功能不进行编解码,所以推到 RTMP 的视频流会根据推流端的分辨率、编码方式、关闭摄像头等变化而变化。 + * @list CDN 推流 + */ + +- (int)startPushSingleStream:(NSString *_Nonnull)taskId singleStream:(ByteRTCPushSingleStreamParam *_Nonnull)singleStream; +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN:` 方法来停止单流转推直播任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN:` 来停止单流转推任务。 + * @brief 停止由 startPushSingleStream:singleStream:{@link #ByteRTCEngine#startPushSingleStream:singleStream:} 启动的单流转推任务。 + * @param taskId 任务 ID。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + +- (int)stopPushSingleStream:(NSString *_Nonnull)taskId; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 开启缓存同步功能。开启后,会缓存收到的实时音视频数据,并对齐不同数据中的时间戳完成同步。此功能会影响音视频数据消费的实时性。 + * @param config 参看 ByteRTCChorusCacheSyncConfig{@link #ByteRTCChorusCacheSyncConfig}。 + * @param observer 事件和数据观察者,参看 ByteRTCChorusCacheSyncObserver{@link #ByteRTCChorusCacheSyncObserver}。 + * @return 查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 要关闭缓存同步功能,调用 stopChorusCacheSync{@link #ByteRTCEngine#stopChorusCacheSync}。 + * @list Pushing Streams to CDN + */ + +- (int)startChorusCacheSync:(ByteRTCChorusCacheSyncConfig* _Nullable)config observer:(id _Nullable)observer; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭缓存同步功能。 + * @return 查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @list Pushing Streams to CDN + */ + +-(int)stopChorusCacheSync; + +#pragma mark public streaming +/** + * + * @type api + * @brief 获取 WTN 流对象。 + * @return WTN 流对象,参看 ByteRTCWTNStream{@link #ByteRTCWTNStream}。 + * @list WTN + */ + +- (ByteRTCWTNStream *_Nullable)getWTNStream; + +#pragma mark External Video Data + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送外部视频帧。 + * @param frame 该视频帧包含待 SDK 编码的视频数据,参考 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 推送外部视频帧前,必须调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 开启外部视频源采集。
    + * 支持格式:raw NV12 + * @list 自定义流处理 + */ + +- (int)pushExternalVideoFrame:(ByteRTCVideoFrameData * _Nonnull)frame; + +#pragma mark External Audio Data +/** + * + * @type api + * @brief 设置并开启指定的音频数据帧回调 + * @param method 音频回调方法,参看 ByteRTCAudioFrameCallbackMethod{@link #ByteRTCAudioFrameCallbackMethod}。
    + * 当音频回调方法设置为 `0`、`1`、`2`、`5`时,你需要在参数 `format` 中指定准确的采样率和声道,暂不支持设置为自动。
    + * 当音频回调方法设置为 `3` 时,将 `format` 中的各个字段设置为默认值。 + * @param format 音频参数格式,参看 ByteRTCAudioFormat{@link #ByteRTCAudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 开启音频回调并调用 registerAudioFrameObserver:{@link #ByteRTCMediaPlayer#registerAudioFrameObserver:} 后,ByteRTCAudioFrameObserver{@link #ByteRTCAudioFrameObserver} 会收到对应的音频回调。两者调用顺序没有限制且相互独立。 + * @list 自定义流处理 + */ + +- (int)enableAudioFrameCallback:(ByteRTCAudioFrameCallbackMethod) method format:(ByteRTCAudioFormat* _Nullable)format; +/** + * + * @type api + * @brief 关闭音频回调 + * @param method 音频回调方法,参看 ByteRTCAudioFrameCallbackMethod{@link #ByteRTCAudioFrameCallbackMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该方法需要在调用 enableAudioFrameCallback:format:{@link #ByteRTCEngine#enableAudioFrameCallback:format:} 之后调用。 + * @list 自定义流处理 + */ + +- (int)disableAudioFrameCallback:(ByteRTCAudioFrameCallbackMethod) method; +/** + * + * @type api + * @brief 注册音频数据回调观察者。 + * @param audioFrameObserver 音频数据观察者,参看 ByteRTCAudioFrameObserver{@link #ByteRTCAudioFrameObserver}。如果传入 null,则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 注册音频数据回调观察者并调用 enableAudioFrameCallback:format:{@link #ByteRTCEngine#enableAudioFrameCallback:format:} 后,ByteRTCAudioFrameObserver{@link #ByteRTCAudioFrameObserver} 会收到对应的音频回调。对回调中收到的音频数据进行处理,不会影响 RTC 的编码发送或渲染。 + * @list 自定义流处理 + */ + +- (int)registerAudioFrameObserver:(_Nullable id) audioFrameObserver NS_SWIFT_NAME(registerAudioFrameObserver(_:)); +/** + * + * @type api + * @brief 注册自定义音频处理器。
    + * 注册完成后,你可以调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},对本地采集到的音频进行处理,RTC SDK 将对处理后的音频进行编码和发送。也可以对接收到的远端音频进行自定义处理,RTC SDK 将对处理后的音频进行渲染。 + * @param processor 自定义音频处理器,详见 ByteRTCAudioFrameProcessor{@link #ByteRTCAudioFrameProcessor}。
    + * SDK 只持有 processor 的弱引用,你应保证其生命周期。需要取消注册时,设置此参数为 nullptr。
    + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 重复调用此接口时,仅最后一次调用生效。 + * - 更多相关信息,详见[音频自定义处理](https: + * @list 自定义流处理 + */ + +- (int)registerAudioProcessor:(_Nullable id)processor; +/** + * + * @type api + * @brief 设置并开启指定的音频帧回调,进行自定义处理。 + * @param method 音频帧类型,参看 ByteRTCAudioFrameMethod{@link #ByteRTCAudioFrameMethod}。可多次调用此接口,处理不同类型的音频帧。
    + * 选择不同类型的音频帧将收到对应的回调:
    + * - 选择本地采集的音频时,会收到 onProcessRecordAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessRecordAudioFrame:}。 + * - 选择远端音频流的混音音频时,会收到 onProcessPlayBackAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessPlayBackAudioFrame:}。 + * - 选择远端音频流时,会收到 onProcessRemoteUserAudioFrame:info:audioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessRemoteUserAudioFrame:info:audioFrame:}。 + * - 选择软件耳返音频时,会收到 onProcessEarMonitorAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessEarMonitorAudioFrame:}。(仅适用于 iOS 平台) + * - 选择屏幕共享音频流时,会收到 onProcessScreenAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessScreenAudioFrame:}。 + * @param format 设定自定义处理时获取的音频帧格式,参看 ByteRTCAudioFormat{@link #ByteRTCAudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在调用此接口前,你需要调用 registerAudioProcessor:{@link #ByteRTCEngine#registerAudioProcessor:} 注册自定义音频处理器。 + * - 要关闭音频自定义处理,调用 disableAudioProcessor:{@link #ByteRTCEngine#disableAudioProcessor:}。 + * @list 自定义流处理 + */ + +- (int)enableAudioProcessor:(ByteRTCAudioFrameMethod)method + audioFormat:(ByteRTCAudioFormat *_Nullable)format; +/** + * + * @type api + * @brief 关闭自定义音频处理。 + * @param method 音频帧类型,参看 ByteRTCAudioFrameMethod{@link #ByteRTCAudioFrameMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 自定义流处理 + */ + +- (int)disableAudioProcessor:(ByteRTCAudioFrameMethod)method; +/** + * + * @type api + * @brief 推送自定义采集的音频数据到 RTC SDK。 + * @param audioFrame 音频数据帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}
    + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 推送外部音频数据前,必须先调用 setAudioSourceType:{@link #ByteRTCEngine#setAudioSourceType:} 开启自定义采集。 + * - 你必须每隔 10 毫秒推送一次外部采集的音频数据。单次推送的 samples (音频采样点个数)应该为 audioFrame.sampleRate / 100。比如设置采样率为 48000 时, 每次应该推送 480 个采样点。 + * @list 自定义流处理 + */ + +- (int)pushExternalAudioFrame:(ByteRTCAudioFrame * _Nonnull) audioFrame; +/** + * + * @type api + * @brief 拉取下行音频数据用于自定义音频渲染。
    + * 调用该方法后,SDK 会主动拉取待播放的音频数据,包括远端已解码和混音后的音频数据,用于外部播放。 + * @param audioFrame 音频数据帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @return 方法调用结果
    + * - 0: 设置成功 + * - < 0: 设置失败 + * @note + * - 拉取外部音频数据前,必须先调用 setAudioRenderType:{@link #ByteRTCEngine#setAudioRenderType:} 开启自定义渲染。 + * - 由于 RTC SDK 的帧长为 10 毫秒,你应当每隔 10 毫秒拉取一次音频数据。确保音频采样点数(sample)x 拉取频率等于 audioFrame 的采样率 (sampleRate)。如设置采样率为 48000 时,每 10 毫秒调用本接口拉取数据,每次应拉取 480 个采样点。 + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * @list 自定义流处理 + */ + +- (int)pullExternalAudioFrame:(ByteRTCAudioFrame * _Nonnull) audioFrame; +/** + * + * @type api + * @brief 向 SDK 发送由自定义处理后的 PCM 音频数据,作为回声消除的参考信号 + * @param audioFrame 音频数据帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @return 方法调用结果
    + * + 0:方法调用成功
    + * + <-1:方法调用失败
    + * + <-302:警告,配置下发了无效的aec场景
    + * + <-303:警告,配置下发了错误的aec类型
    + * @note
    + * + 推送自定义回声消除参考信号前,必须先调用 setAudioRenderType{@link #ByteRTCEngine#setAudioRenderType} 开启自定义渲染。
    + * + 由于 RTC SDK 的帧长为 10 毫秒,你应当每隔 10 毫秒发送一次音频数据。确保音频采样点数(sample)x 发送频率等于 audioFrame 的采样率 (sampleRate)。如设置采样率为 48000 时,每 10 毫秒调用本接口发送数据,每次应发送 480 个采样点。
    + * + 音频采样格式为 S16。音频缓冲区内的数据格式为 PCM 数据,其容量大小为 audioFrame.samples × audioFrame.channel × 2。
    + * @list 自定义流处理 + */ + +- (int)pushReferenceAudioPCMData:(ByteRTCAudioFrame * _Nonnull) audioFrame; +/** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 推送opus编码音频数据到 RTC SDK,RTC SDK纯转发。 + * @param audio_stream 对应的opus音频数据。详见 EncodedAudioFrameData{@link #EncodedAudioFrameData}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 推送音频数据前,必须先调用 enableAudioEncoding{@link #ByteRTCEngine#enableAudioEncoding} 关闭音频编码。 + * @list 自定义流处理 + */ + +- (int)pushExternalEncodedAudioFrame:(ByteRTCEncodedAudioFrameData * _Nonnull)audioFrame; +/** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频编码功能。 + * @param enable 是否使用sdk音频编码功能。 + * true: 打开音频编码(默认) + * false: 关闭音频编码直接转推。 + * @note + * - 在pushExternalEncodedAudioFrame{@link #ByteRTCEngine#pushExternalEncodedAudioFrame}之前调用。 + * @list 自定义流处理 + */ + +- (void)enableAudioEncoding:(bool)enable; +/** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频解码功能。 + * @param enable 是否使用sdk音频解码功能。 + * true: 打开音频解码功能(默认) + * false: 关闭音频解码功能直接转推。 + * @note + * - 在registerRemoteEncodedAudioFrameObserver之前调用。 + * @list 自定义流处理 + */ + +- (void)enableAudioDecoding:(bool)enable; +/** + * + * @type api + * @hidden for internal use only + * @brief 注册远端音频帧监测器。
    + * 调用该方法后,SDK 每监测到一帧远端音频帧时,都会将音频帧信息通过 onRemoteEncodedAudioFrame:info:audioFrame: 回调给用户 + * @param observer 远端音频帧监测器,参看 IRemoteEncodedAudioFrameObserver。 + * @note + * - 该方法建议在进房前调用。 + * - 将参数设置为 nullptr 则取消注册。 + * - 调用前,必须先调用 enableAudioDecoding{@link #ByteRTCEngine#enableAudioDecoding} 关闭音频解码功能。 + * @list 自定义流处理 + */ + +- (void)registerRemoteEncodedAudioFrameObserver:(_Nullable id)observer; +/** + * + * @type api + * @brief 设置业务标识参数
    + * 可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。 + * @param businessId
    + * 用户设置的自己的 businessId 值
    + * businessId 只是一个标签,颗粒度需要用户自定义。 + * @return + * - 0: 成功。 + * - -2: 输入非法,合法字符包括所有小写字母、大写字母和数字,除此外还包括四个独立字符分别是:英文句号,短横线,下划线和 @ 。 + * @note + * - 需要在调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 进房之前调用,进房之后调用该方法无效。 + * @list 引擎管理 + */ + +- (int)setBusinessId:(NSString* _Nullable)businessId; +/** + * + * @type api + * @brief 通话结束,将用户反馈的问题上报到 RTC。 + * @param types 预设问题列表,参看 ByteRTCProblemFeedbackOption{@link #ByteRTCProblemFeedbackOption} + * @param info 预设问题以外的其他问题的具体描述,房间信息。参看 ByteRTCProblemFeedbackInfo{@link #ByteRTCProblemFeedbackInfo} + * @return + * - 0: 成功。 + * - -3: 失败。 + * @note + * - 你可以在 [RTC 控制台](https: + * - 如果用户上报时在房间内,那么问题会定位到用户当前所在的一个或多个房间;如果用户上报时不在房间内,那么问题会定位到引擎此前退出的房间。 + * @list 引擎管理 + */ + +- (int)feedback:(ByteRTCProblemFeedbackOption)types info:(ByteRTCProblemFeedbackInfo* _Nullable)info; +/** + * + * @valid since 353 + * @type api + * @brief 获取 C++ 层 [IRTCEngine 句柄](https: + * @return + * - >0:方法调用成功, 返回 C++ 层 `IRTCEngine` 的地址。 + * - NULL:方法调用失败 + * @note 在一些场景下,获取 C++ 层 `IRTCEngine`,并通过其完成操作,相较于通过 OC 封装层完成有显著更高的执行效率。典型的场景有:视频/音频帧自定义处理,音视频通话加密等。 + * @list 引擎管理 + */ + +- (void * _Nullable) getNativeHandle; + +#pragma mark Fallback Related +/** + * + * @type api + * @brief 设置发布的音视频流的回退选项。
    + * 你可以调用该接口设置网络不佳或设备性能不足时从大流起进行降级处理,以保证通话质量。 + * @param option 本地发布的音视频流回退选项,参看 ByteRTCPublishFallbackOption{@link #ByteRTCPublishFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅在调用 setLocalSimulcastMode:{@link #ByteRTCEngine#setlocalsimulcastmode:} 开启了发送多路视频流的情况下生效。 + * - 该方法必须在进房前设置,进房后设置或更改设置无效。 + * - 调用该方法后,如因性能或网络不佳产生发布性能回退或恢复,本端会提前收到 rtcEngine:onPerformanceAlarms:info:mode:reason:sourceWantedData:{@link #ByteRTCEngineDelegate#rtcEngine:onPerformanceAlarms:info:mode:reason:sourceWantedData:} 回调发出的告警,以便采集设备配合调整。 + * - 设置回退后,本地发布的音视频流发生回退或从回退中恢复时,远端会收到 rtcEngine:onSimulcastSubscribeFallback:info:event:{@link #ByteRTCEngineDelegate#rtcEngine:onSimulcastSubscribeFallback:info:event:} 回调,通知该情况。 + * - 你可以调用客户端 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + +- (int)setPublishFallbackOption:(ByteRTCPublishFallbackOption)option; +/** + * + * @type api + * @brief 设置订阅的音视频流的回退选项。
    + * 你可调用该接口设置网络不佳或设备性能不足时允许订阅流进行降级或只订阅音频流,以保证通话流畅。 + * @param option 订阅的音视频流回退选项,参看 ByteRTCSubscribeFallbackOption{@link #ByteRTCSubscribeFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 你必须在进房前设置,进房后设置或更改设置无效。 + * - 设置回退选项后,订阅的音视频流发生回退或从回退中恢复时,会收到 rtcEngine:onSimulcastSubscribeFallback:info:event:{@link #ByteRTCEngineDelegate#rtcEngine:onSimulcastSubscribeFallback:info:event:} 和 rtcEngine:onRemoteVideoSizeChanged:info:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteVideoSizeChanged:info:withFrameInfo:} 回调通知。 + * - 你可以调用 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + +- (int)setSubscribeFallbackOption:(ByteRTCSubscribeFallbackOption)option; +/** + * + * @type api + * @brief 设置用户优先级。 + * @param priority 远端用户的优先级, 详见枚举类型 ByteRTCRemoteUserPriority{@link #ByteRTCRemoteUserPriority} + * @param roomId 房间 ID + * @param uid 远端用户的 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该方法与 setSubscribeFallbackOption:{@link #ByteRTCEngine#setSubscribeFallbackOption:} 搭配使用。 + * - 如果开启了订阅流回退选项,弱网或性能不足时会优先保证收到的高优先级用户的流的质量。 + * - 该方法在进房前后都可以使用,可以修改远端用户的优先级。 + * @list 网络管理 + */ + +- (int)setRemoteUserPriority:(ByteRTCRemoteUserPriority)priority + InRoomId:(NSString *_Nonnull)roomId + uid:(NSString *_Nonnull)uid NS_SWIFT_NAME(setRemoteUserPriority(_:InRoomId:uid:)); +#pragma mark AES Related +/** + * + * @type api + * @brief 设置传输时使用内置加密的方式。 + * @param encrypt_type 内置加密算法,详见 ByteRTCEncryptType{@link #ByteRTCEncryptType} + * @param key 加密密钥,长度限制为 36 位,超出部分将会被截断 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 使用传输时内置加密时,使用此方法;如果需要使用传输时自定义加密,参看 onEncryptData:{@link #ByteRTCEncryptHandler#onEncryptData:}。 + * 内置加密和自定义加密互斥,根据最后一个调用的方法确定传输加密的方案。
    + * - 该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。 + * @list 通话加密 + */ + +- (int)setEncryptInfo:(ByteRTCEncryptType)encrypt_type key:(NSString * _Nonnull)key; +/** + * + * @type api + * @brief 设置自定义加密和解密方式。 + * @param handler 自定义加密 handler,需要实现里面的加密和解密方法。参看 ByteRTCEncryptHandler{@link #ByteRTCEncryptHandler}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法与 setEncryptInfo:key:{@link #ByteRTCEngine#setEncryptInfo:key:} 为互斥关系,即按照调用顺序,最后一个调用的方法为最终生效的版本。 + * - 该方法必须在调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 之前调用,可重复调用,以最后调用的参数作为生效参数。 + * - 无论加密或者解密,其对原始数据的长度修改,需要控制在 180% 之间,即如果输入数据为 100 字节,则处理完成后的数据必须不超过 180 字节,如果加密或解密结果超出该长度限制,则该音视频帧可能会被丢弃。 + * - 数据加密/解密为串行执行,因而视实现方式不同,可能会影响到最终渲染效率,是否使用该方法,需要由使用方谨慎评估。 + * @list 通话加密 + */ + +- (int)setCustomizeEncryptHandler:(id _Nullable)handler NS_SWIFT_NAME(setCustomizeEncryptHandler(_:)); + +#pragma mark - Extention Methods +/** + * + * @type api + * @brief 创建 RTC 房间实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 ByteRTCRoom{@link #ByteRTCRoom} 实例。分别调用各 ByteRTCRoom 实例中的 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 ByteRTCRoom{@link #ByteRTCRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 roomId 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 ByteRTCRoom 实例,再调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * - 如果你需要在多个房间发布音视频流,无须创建多房间,直接调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 开始跨房间转发媒体流。 + * @list 房间管理 + */ + +- ( ByteRTCRoom * _Nullable)createRTCRoom:(NSString * _Nonnull)roomId; + +/** + * + * @type api + * @brief 创建游戏房间实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 ByteRTCGameRoom{@link #ByteRTCGameRoom} 实例。分别调用各 GameRTCRoom 实例中的 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @param roomConfig 房间配置,参看 GameRoomConfig{@link #GameRoomConfig}。 + * @return 创建的 ByteRTCGameRoom{@link #ByteRTCGameRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 roomId 格式错误或当前场景是否是游戏场景。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 GameRTCRoom 实例,再调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 加入房间。 + * - 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + +- (ByteRTCGameRoom * _Nullable)createGameRoom:(NSString * _Nonnull)roomId roomConfig:(GameRoomConfig * _Nonnull)roomConfig; +/** + * + * @type api + * @brief 创建 RTS 房间实例。
    + * 调用此方法仅返回一个RTS房间实例,你仍需调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 ByteRTCRoom{@link #ByteRTCRoom} 实例。分别调用各 ByteRTCRTSRoom 实例中的 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时收发各房间的消息。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 ByteRTCRoom{@link #ByteRTCRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 roomId 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 ByteRTCRTSRoom 实例,再调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。 + * - 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + +- ( ByteRTCRTSRoom * _Nullable)createRTSRoom:(NSString * _Nonnull)roomId; + +#pragma mark - ScreenCapture +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 Extension 配置项。你必须在使用屏幕内部采集功能前,设置使用的 Extension。 + * @param groupId 你的应用和 Extension 应该归属于同一个 App Group,此处需要传入 Group Id。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 必须在调用 createRTCEngine:delegate:{@link #ByteRTCEngine#createRTCEngine:delegate:} 之后立即调用此方法。在引擎实例的生命周期中,此方法只需要调用一次。 + * @list 屏幕共享 + */ + +- (int)setExtensionConfig:(NSString *_Nullable)groupId; + +/** + * + * @type api + * @brief 设置运行时的参数 + * @param parameters 保留参数 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该接口需在 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 和 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 之前调用。 + * @list 引擎管理 + */ + +- (int)setRuntimeParameters:(NSDictionary * _Nullable)parameters; +#if BYTERTC_TARGET_MAC +/** + * + * @hidden(iOS) + * @type api + * @brief 获取共享对象(应用窗口和桌面)列表。 + * @return 共享对象(应用窗口和桌面)列表。参看 ByteRTCScreenCaptureSourceInfo{@link #ByteRTCScreenCaptureSourceInfo}。
    + * 枚举值可作为调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启屏幕共享时的输入参数。 + * @note 仅桌面端可用。 + * @list 屏幕共享 + */ + +- (NSArray *_Nonnull)getScreenCaptureSourceList; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 采集屏幕视频流,用于共享。屏幕视频流包括:屏幕上显示的内容,或应用窗口中显示的内容。 + * @param sourceInfo 待共享的屏幕源,参看 ByteRTCScreenCaptureSourceInfo{@link #ByteRTCScreenCaptureSourceInfo}。
    + * 你可以调用 getScreenCaptureSourceList{@link #ByteRTCEngine#getScreenCaptureSourceList} 获得所有可以共享的屏幕源。 + * @param captureParameters 共享参数。参看 ByteRTCScreenCaptureParam{@link #ByteRTCScreenCaptureParam}。 + * @return + * - 0: 成功 + * - -1: 失败 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 调用此方法仅开启屏幕流视频采集,不会发布采集到的视频。发布屏幕流视频需要调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:}。 + * - 调用 stopScreenVideoCapture{@link #ByteRTCEngine#stopScreenVideoCapture} 关闭屏幕视频源采集。 + * - 本地用户通过 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调获取屏幕采集状态,包括开始、暂停、恢复、错误等。 + * - 调用成功后,本端会收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调。 + * - 调用此接口前,你可以调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 设置屏幕视频流的采集帧率和编码分辨率。 + * - 在收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调后,通过调用 setLocalVideoCanvas:{@link #ByteRTCEngine#setLocalVideoCanvas:} 或 setLocalVideoSink:withPixelFormat:{@link #ByteRTCEngine#setLocalVideoSink:withPixelFormat:} 函数设置本地屏幕共享视图。 + * - 再开启采集屏幕视频流后,你可以调用 updateScreenCaptureHighlightConfig:{@link #ByteRTCEngine#updateScreenCaptureHighlightConfig:} 更新边框高亮设置,调用 updateScreenCaptureMouseCursor:{@link #ByteRTCEngine#updateScreenCaptureMouseCursor:} 更新对鼠标的处理设置,PC 端还可以调用 updateScreenCaptureFilterConfig:{@link #ByteRTCEngine#updateScreenCaptureFilterConfig:} 设置需要过滤的窗口。 + * @list 屏幕共享 + */ + +- (int)startScreenVideoCapture:(ByteRTCScreenCaptureSourceInfo *_Nonnull)sourceInfo captureParameters:(ByteRTCScreenCaptureParam *_Nonnull)captureParameters NS_SWIFT_NAME(startScreenVideoCapture(_:captureParameters:)); +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 停止屏幕视频流采集。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 要开启屏幕视频流采集,调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:}。 + * - 调用后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。 + * - 调用此接口不影响屏幕视频流发布。 + * @list 屏幕共享 + */ + +- (int)stopScreenVideoCapture; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 内部屏幕流采集时,更新采集区域。 + * @param regionRect 采集区域相对 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 中设定区域的值。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用此接口前,必须先通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureRegion:(CGRect)regionRect; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 内部屏幕流采集时,更新边框高亮设置。默认展示边框。 + * @param config 边框高亮设置。参见 ByteRTCHighlightConfig{@link #ByteRTCHighlightConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureHighlightConfig:(ByteRTCHighlightConfig *_Nonnull)config NS_SWIFT_NAME(updateScreenCaptureHighlightConfig(_:)); +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 内部屏幕流采集时,更新对鼠标的处理设置。默认采集鼠标。 + * @param mouseCursorCaptureState 参看 ByteRTCMouseCursorCaptureState{@link #ByteRTCMouseCursorCaptureState}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureMouseCursor:(ByteRTCMouseCursorCaptureState)mouseCursorCaptureState; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,设置需要过滤的窗口。 + * @param excludedWindowList 过滤掉的窗口列表。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * - 本函数在屏幕源类别是屏幕而非应用窗体时才起作用。详见:ByteRTCScreenCaptureSourceType{@link #ByteRTCScreenCaptureSourceType}。 + * - 调用本接口排除指定窗口时,共享视频的帧率无法达到 30fps。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureFilterConfig:(NSArray * _Nullable) excludedWindowList; +/** + * + * @hidden(iOS) + * @type api + * @brief 获取屏幕采集对象缩略图 + * @param sourceType 屏幕采集对象的类型。详见 ByteRTCScreenCaptureSourceType{@link #ByteRTCScreenCaptureSourceType}。 + * @param sourceId 屏幕分享时,共享对象的 ID。可通过 getScreenCaptureSourceList{@link #ByteRTCEngine#getScreenCaptureSourceList} 返回的`ByteRTCScreenCaptureSourceInfo`共享对象列表中获取。 + * @param maxWidth 最大宽度。保持采集对象本身的宽高比不变,将缩略图缩放到指定范围内的最大宽高。如果给出的尺寸与共享对象比例不同,得到的缩略图会有黑边。 + * @param maxHeight 最大高度。参见 maxWidth 的说明。 + * @return 屏幕采集对象缩略图。缩略图由屏幕共享对象等比缩放而来。缩略图的大小小于等于此接口设定的尺寸。 + * @list 屏幕共享 + */ + +- (ByteRTCImage *_Nonnull)getThumbnail:(ByteRTCScreenCaptureSourceType)sourceType sourceId:(intptr_t)sourceId maxWidth:(int)maxWidth maxHeight:(int)maxHeight; +/** + * + * @hidden(iOS) + * @brief 获取应用窗体所属应用的图标。 + * @region 屏幕共享 + * @param sourceId 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList{@link #ByteRTCEngine#getScreenCaptureSourceList} 返回的`ByteRTCScreenCaptureSourceInfo`共享对象列表中获取。 + * @param width 最大宽度。返回的图标将是宽高相等的,输入的宽高不等时,取二者较小值。宽高范围为 [32,256],超出该范围将返回 `nullptr`,默认输出 100 x 100 的图像。 + * @param height 最大高度。参见 `width` 的说明。 + * @return 应用图标。当屏幕共享对象为应用窗体时有效,否则返回 `nullptr`。 + * @list 屏幕共享 + */ + +- (ByteRTCImage *_Nonnull)getWindowAppIcon:(intptr_t)sourceId width:(int)width height:(int)height; +#endif +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 使用 RTC SDK 内部采集模块开始采集屏幕音频流和(或)视频流。 + * @param type 媒体类型,参看 ByteRTCScreenMediaType{@link #ByteRTCScreenMediaType}。 + * @param bundleId 绑定 Extension 的 Bundle ID,绑定后应用中共享屏幕的选择列表中只展示你的 Extension 可供选择。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 或 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 当从 iOS 控制中心发起屏幕采集时无需调用本方法。 + * - 采集后,你还需要调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:} 和/或 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:} 发布采集到的屏幕音视频。 + * - 开启屏幕音频/视频采集成功后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 和 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 回调。 + * @list 屏幕共享 + */ + +- (int)startScreenCapture:(ByteRTCScreenMediaType) type bundleId:(NSString *_Nullable)bundleId; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 更新内部屏幕采集时采集的媒体类型。 + * @param type 媒体类型,参看 ByteRTCScreenMediaType{@link #ByteRTCScreenMediaType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 你需在开启屏幕视频流采集后调用该方法。 + * - 本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 或 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 回调。 + * @list 屏幕共享 + */ + +- (int)updateScreenCapture:(ByteRTCScreenMediaType) type; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 在屏幕共享时,停止使用 RTC SDK 内部采集方式采集屏幕音视频。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 或 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 当从 iOS 控制中心发起屏幕采集时无需调用本方法。 + * - 本方法只会停止本地屏幕采集,并不会影响屏幕流的发布状态。 + * - 本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 和 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 的回调。 + * @list 屏幕共享 + */ + +- (int)stopScreenCapture; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 向屏幕共享 Extension 发送自定义消息 + * @param messsage 发送给 Extension 的消息内容 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在 startScreenCapture:bundleId:{@link #ByteRTCEngine#startScreenCapture:bundleId:} 后调用该方法。 + * - 通过 onReceiveMessageFromApp:{@link #ByteRtcScreenCapturerExtDelegate#onReceiveMessageFromApp:} 回调发送的消息。 + * @list 屏幕共享 + */ + +- (int)sendScreenCaptureExtensionMessage:(NSData *_Nonnull) messsage; +/** + * + * @hidden(iOS) + * @type api + * @brief 创建音频设备管理实例 + * @return ByteRTCAudioDeviceManager{@link #ByteRTCAudioDeviceManager} + * @list 音频管理 + */ + +- (ByteRTCAudioDeviceManager *_Null_unspecified)getAudioDeviceManager; +/** + * + * @hidden(iOS) + * @type api + * @brief 创建视频设备管理实例 + * @return 视频设备管理实例,详见 ByteRTCVideoDeviceManager{@link #ByteRTCVideoDeviceManager} + * @list 视频管理 + */ + +- (ByteRTCVideoDeviceManager * _Null_unspecified)getVideoDeviceManager NS_SWIFT_NAME(getVideoDeviceManager()); + +#pragma mark - FileRecording +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 该方法将通话过程中的音视频数据录制到本地的文件中。 + * @param recordingConfig 本地录制参数配置,参看 ByteRTCRecordingConfig{@link #ByteRTCRecordingConfig} + * @param recordingType 本地录制的媒体类型,参看 ByteRTCRecordingType{@link #ByteRTCRecordingType}
    + * 注意:屏幕流仅支持录制视频(ByteRTCRecordingTypeVideoOnly);主流支持录制所有类型。 + * @return + * - 0: 正常 + * - -1: 参数设置异常 + * - -2: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 该方法需在进房后调用。 + * - 调用该方法后,你会收到 rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:{@link #ByteRTCEngineDelegate#rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:} 回调。 + * - 如果录制正常,系统每秒钟会通过 rtcEngine:onRecordingProgressUpdate:process:recording_info:{@link #ByteRTCEngineDelegate#rtcEngine:onRecordingProgressUpdate:process:recording_info:} 回调通知录制进度。 + * @list 高级功能 + */ + +- (int)startFileRecording: (ByteRTCRecordingConfig* _Nonnull)recordingConfig type:(ByteRTCRecordingType)recordingType NS_SWIFT_NAME(startFileRecording(withRecordingConfig:type:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地录制 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 startFileRecording:type:{@link #ByteRTCEngine#startFileRecording:type:} 开启本地录制后,你必须调用该方法停止录制。 + * - 调用该方法后,你会收到 rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:{@link #ByteRTCEngineDelegate#rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:} 回调提示录制结果。 + * @list 高级功能 + */ + +- (int)stopFileRecording; +/** + * + * @type api + * @brief 开始音频录制,并生成录音文件保存到本地。 + * @param recordingConfig 参看 ByteRTCAudioRecordingConfig{@link #ByteRTCAudioRecordingConfig} + * @return + * - 0: 正常 + * - -2: 参数设置异常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 调用该方法后,会立即启动录制任务并创建录音文件。 + * - 录制包含各种音频效果。但不包含背景音乐。 + * - 录制本地麦克风的音频时,请确保已调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 接口打开麦克风采集。 + * - 调用 stopAudioRecording{@link #ByteRTCEngine#stopAudioRecording} 关闭录制。 + * - 加入房间前后均可调用。在进房前调用该方法,退房之后,录制任务不会自动停止,需调用 stopAudioRecording{@link #ByteRTCEngine#stopAudioRecording} 关闭录制。在进房后调用该方法,退房之后,录制任务会自动被停止。如果加入了多个房间,录制的文件中会包含各个房间的音频。 + * - 调用该方法后,你会收到 rtcEngine:onAudioRecordingStateUpdate:error_code:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioRecordingStateUpdate:error_code:} 回调。 + * @list 高级功能 + */ + +- (int)startAudioRecording:(ByteRTCAudioRecordingConfig* _Nonnull) recordingConfig; +/** + * + * @type api + * @brief 停止音频文件录制 + * @return + * - 0: 正常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note 调用 startAudioRecording:{@link #ByteRTCEngine#startAudioRecording:} 开启本地录制。 + * @list 高级功能 + */ + +- (int)stopAudioRecording; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音效播放器实例。 + * @return 音效播放器。详见 ByteRTCAudioEffectPlayer{@link #ByteRTCAudioEffectPlayer}。 + * @list 混音 + */ + +- (ByteRTCAudioEffectPlayer *_Nullable)getAudioEffectPlayer; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音乐播放器实例。 + * @param playerId 音乐播放器实例 id。取值范围为 `[0, 3]`。最多同时存在 4 个实例,超出取值范围时返回 nullptr。 + * @return 音乐播放器实例,详见 ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} + * @list 混音 + */ + +- (ByteRTCMediaPlayer *_Nullable)getMediaPlayer:(int)playerId; + +#pragma mark - Rtm +/** + * + * @type api + * @brief 登陆 RTS 服务器。
    + * 必须先登录,才能调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 和 sendServerMessage:{@link #ByteRTCEngine#sendServerMessage:} 发送房间外点对点消息和向应用服务器发送消息
    + * 在调用本接口登录后,如果想要登出,需要调用 logout{@link #ByteRTCEngine#logout} + * @param token 用户登录必须携带的 Token,用于鉴权验证。
    + * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,`roomId` 置空,Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。 + * @param uid 用户 ID,在 appid 的维度下是唯一的。 + * @return + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 本地用户调用此方法登录后,会收到 rtcEngine:onLoginResult:errorCode:elapsed:{@link #ByteRTCEngineDelegate#rtcEngine:onLoginResult:errorCode:elapsed:} 回调通知登录结果,远端用户不会收到通知。 + * @list 消息 + */ + +- (int)login:(NSString * _Nonnull)token uid:(NSString * _Nonnull)uid; +/** + * + * @type api + * @brief 登出 RTS 服务器。
    + * 调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口登出前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录 + * - 本地用户调用此方法登出后,会收到 rtcEngine:onLogout:{@link #ByteRTCEngineDelegate#rtcEngine:onLogout:} 回调通知结果,远端用户不会收到通知。 + * @list 消息 + */ + +- (int)logout; +/** + * + * @type api + * @brief 更新用户用于登录的 Token
    + * Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
    + * 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 rtcEngine:onLoginResult:errorCode:elapsed:{@link #ByteRTCEngineDelegate#rtcEngine:onLoginResult:errorCode:elapsed:} 回调通知,错误码为 ByteRTCLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。 + * @param token
    + * 更新的动态密钥 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果 Token 无效导致登录失败,则调用此方法更新 Token 后,SDK 会自动重新登录,而用户不需要自己调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法。 + * - Token 过期时,如果已经成功登录,则不会受到影响。Token 过期的错误会在下一次使用过期 Token 登录时,或因本地网络状况不佳导致断网重新登录时通知给用户。 + * @list 消息 + */ + +- (int)updateLoginToken:(NSString * _Nonnull)token; +/** + * + * @type api + * @brief 设置应用服务器参数
    + * 客户端调用 sendServerMessage:{@link #ByteRTCEngine#sendServerMessage:} 或 sendServerBinaryMessage:{@link #ByteRTCEngine#sendServerBinaryMessage:} 发送消息给应用服务器之前,必须设置有效签名和应用服务器地址。 + * @param signature 动态签名,应用服务器可使用该签名验证消息来源。
    + * 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。
    + * 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 + * @param url 应用服务器的地址 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 用户必须调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 rtcEngine:onServerParamsSetResult:{@link #ByteRTCEngineDelegate#rtcEngine:onServerParamsSetResult:} 返回相应结果。 + * @list 消息 + */ + +- (int)setServerParams:(NSString * _Nonnull)signature url:(NSString * _Nonnull)url; +/** + * + * @type api + * @brief 查询对端用户或本端用户的登录状态 + * @param peerUserId
    + * 需要查询的用户 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 必须调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 rtcEngine:onGetPeerOnlineStatus:status:{@link #ByteRTCEngineDelegate#rtcEngine:onGetPeerOnlineStatus:status:} 回调通知查询结果。 + * - 在发送房间外消息之前,用户可以通过本接口了解对端用户是否登录,从而决定是否发送消息。也可以通过本接口查询自己的登录状态。 + * @list 消息 + */ + +- (int)getPeerOnlineStatus:(NSString * _Nonnull)peerUserId; +/** + * + * @type api + * @brief 给房间外指定的用户发送文本消息(P2P)。 + * @param userId 消息接收用户的 ID + * @param messageStr 发送的文本消息内容。消息不超过 64 KB。 + * @param config 消息类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外文本消息前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录。 + * - 用户调用本接口发送文本信息后,会收到一次 rtcEngine:onUserMessageSendResultOutsideRoom:error:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageSendResultOutsideRoom:error:} 回调,得知消息是否成功发送; + * - 若文本消息发送成功,则 userId 所指定的用户会通过 rtcEngine:onUserMessageReceivedOutsideRoom:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageReceivedOutsideRoom:message:} 回调收到该消息。 + * @list 消息 + */ + +- (NSInteger)sendUserMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSString * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; +/** + * + * @type api + * @brief 给房间外指定的用户发送二进制消息(P2P)。 + * @param userId 消息接收用户的 ID + * @param messageStr 发送的二进制消息内容。消息不超过 64KB。 + * @param config 消息类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外二进制消息前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录。 + * - 用户调用本接口发送二进制消息后,会收到一次 rtcEngine:onUserMessageSendResultOutsideRoom:error:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageSendResultOutsideRoom:error:} 回调,通知消息是否发送成功; + * - 若二进制消息发送成功,则 userId 所指定的用户会通过 rtcEngine:onUserBinaryMessageReceivedOutsideRoom:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserBinaryMessageReceivedOutsideRoom:message:} 回调收到该条消息。 + * @list 消息 + */ + +- (NSInteger)sendUserBinaryMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSData * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; +/** + * + * @type api + * @brief 客户端给应用服务器发送文本消息(P2Server)。 + * @param messageStr 发送的文本消息内容。消息不超过 64 KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送文本消息前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录,随后调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置应用服务器。 + * - 调用本接口后,会收到一次 rtcEngine:onServerMessageSendResult:error:message:{@link #ByteRTCEngineDelegate#rtcEngine:onServerMessageSendResult:error:message:} 回调,通知消息发送方是否发送成功。 + * - 若文本消息发送成功,则之前调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + +- (NSInteger)sendServerMessage:(NSString * _Nonnull)messageStr; +/** + * + * @type api + * @brief 客户端给应用服务器发送二进制消息(P2Server)。 + * @param messageStr 发送的二进制消息内容。消息不超过 64KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送二进制消息前,先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录,随后调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置应用服务器。 + * - 调用本接口后,会收到一次 rtcEngine:onServerMessageSendResult:error:message:{@link #ByteRTCEngineDelegate#rtcEngine:onServerMessageSendResult:error:message:} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则之前调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + +- (NSInteger)sendServerBinaryMessage:(NSData * _Nonnull)messageStr; +/** + * + * @type api + * @brief 开始通话前网络探测 + * @param isTestUplink 是否探测上行带宽 + * @param expectedUplinkBitrate 期望上行带宽,单位:kbps
    范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @param isTestDownlink 是否探测下行带宽 + * @param expectedDownlinkBitrate 期望下行带宽,单位:kbps
    范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 成功调用本接口后,会在 3s 内收到一次 rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter:{@link #ByteRTCEngineDelegate#rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter:} 回调,此后每 2s 会收到一次该回调,通知探测结果; + * - 若探测停止,则会收到一次 rtcEngine:onNetworkDetectionStopped:{@link #ByteRTCEngineDelegate#rtcEngine:onNetworkDetectionStopped:} 通知探测停止。 + * @list 网络管理 + */ + +- (int)startNetworkDetection:(bool)isTestUplink uplinkBandwidth:(int)expectedUplinkBitrate downlink:(bool)isTestDownlink downlinkBandwidth:(int)expectedDownlinkBitrate; +/** + * + * @type api + * @brief 停止通话前网络探测 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * 调用本接口后,会收到一次 rtcEngine:onNetworkDetectionStopped:{@link #ByteRTCEngineDelegate#rtcEngine:onNetworkDetectionStopped:} 通知探测停止。 + * @list 网络管理 + */ + +- (int)stopNetworkDetection; +#pragma mark ScreenAudio +/** + * + * @type api + * @brief 在屏幕共享时,设置屏幕音频的采集方式(内部采集/自定义采集) + * @param sourceType 屏幕音频输入源类型, 参看 ByteRTCAudioSourceType{@link #ByteRTCAudioSourceType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 默认采集方式是 RTC SDK 内部采集。 + * - 如果设定为内部采集,你必须重新开始采集。 + * - 如果设定为自定义采集,你必须再调用 pushScreenAudioFrame:{@link #ByteRTCEngine#pushScreenAudioFrame:} 将自定义采集到的屏幕音频帧推送到 RTC SDK。 + * - 无论是内部采集还是自定义采集,你都必须调用 publishScreenAudio: 将采集到的屏幕音频发布给远端。 + * @list 屏幕共享 + * @order 6 + */ + +- (int)setScreenAudioSourceType:(ByteRTCAudioSourceType)sourceType; + +/** + * + * @type api + * @brief 使用自定义采集方式,采集屏幕共享时的屏幕音频时,将音频帧推送至 RTC SDK 处进行编码等处理。 + * @param audioFrame 音频数据帧,参见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}
    + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 samples × frame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
    + * - 0: 设置成功。 + * - < 0: 设置失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 调用此接口推送屏幕共享时的自定义采集的音频数据前,必须调用 setScreenAudioSourceType:{@link #ByteRTCEngine#setScreenAudioSourceType:} 开启屏幕音频自定义采集。 + * - 你应每隔 10 毫秒,调用一次此方法推送一次自定义采集的音频帧。一次推送的音频帧中应包含 frame.sample_rate / 100 个音频采样点。比如,假如采样率为 48000Hz,则每次应该推送 480 个采样点。 + * - 调用此接口将自定义采集的音频帧推送到 RTC SDK 后,你必须调用 publishScreenAudio: 将采集到的屏幕音频推送到远端。在调用 publishScreenAudio: 前,推送到 RTC SDK 的音频帧信息会丢失。 + * @list 屏幕共享 + * @order 9 + */ + +- (int) pushScreenAudioFrame:(ByteRTCAudioFrame* _Nonnull)audioFrame; + +#if BYTERTC_TARGET_MAC +/** + * + * @hidden(iOS) + * @type api + * @brief 在屏幕共享时,开始使用 RTC SDK 内部采集方式,采集屏幕音频 + * @param deviceId 虚拟设备 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 本接口仅对内部采集生效,RTC SDK 默认使用内部采集模块采集屏幕音频。若已调用 setScreenAudioSourceType:{@link #ByteRTCEngine#setScreenAudioSourceType:} 将音频输入源设置为 `ByteRTCAudioSourceTypeExternal` 自定义采集,需先切换为 `ByteRTCAudioSourceTypeInternal` 内部采集,否则该接口调用无效,并将触发 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 采集后,你还需要调用 publishScreenAudio: 将采集到的屏幕音频推送到远端。 + * - 要关闭屏幕音频内部采集,调用 stopScreenAudioCapture{@link #ByteRTCEngine#stopScreenAudioCapture}。 + * @list 屏幕共享 + */ + +- (int)startScreenAudioCapture:(NSString *_Nonnull)deviceId; +/** + * + * @hidden(iOS) + * @type api + * @brief 在屏幕共享时,停止使用 RTC SDK 内部采集方式,采集屏幕音频。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 要开始屏幕音频内部采集,调用 startScreenAudioCapture:{@link #ByteRTCEngine#startScreenAudioCapture:}。 + * @list 屏幕共享 + */ + +- (int)stopScreenAudioCapture; +/** + * + * @hidden(iOS) + * @type api + * @brief 在屏幕共享时,设置屏幕音频流的声道数 + * @param channel 声道数,参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 当你调用 setScreenAudioStreamIndex: 并设置屏幕音频流和麦克风音频流混流时,此接口不生效,音频通道数由 setAudioProfile:{@link #ByteRTCEngine#setAudioProfile:} 控制。 + * @list 屏幕共享 + */ + +- (int)setScreenAudioChannel:(ByteRTCAudioChannel) channel; + +#endif + +#pragma mark EncodedVideo +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置向 SDK 输入的视频源,包括屏幕流
    + * 默认使用内部采集。内部采集指:使用 RTC SDK 内置的视频采集机制进行视频采集。 + * @param type 视频输入源类型,参看 ByteRTCVideoSourceType{@link #ByteRTCVideoSourceType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法进房前后均可调用。 + * - 当你已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部采集后,再调用此方法切换至自定义采集时,SDK 会自动关闭内部采集。 + * - 当你调用此方法开启自定义采集后,想要切换至内部采集,你必须先调用此方法关闭自定义采集,然后调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 手动开启内部采集。 + * - 当你需要向 SDK 推送自定义编码后的视频帧,你需调用该方法将视频源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + +- (int)setVideoSourceType:(ByteRTCVideoSourceType)type NS_SWIFT_NAME(setVideoSourceType(_:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册自定义编码帧推送事件回调 + * @param handler 自定义编码帧回调类,参看 ByteRTCExternalVideoEncoderEventHandler{@link #ByteRTCExternalVideoEncoderEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法需在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + +- (int)setExternalVideoEncoderEventHandler:(id _Nullable)handler; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送自定义编码后的视频流 + * @param videoIndex 对应的编码流下标,从 0 开始,如果调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 设置了多路流,此处数量须与之保持一致 + * @param videoFrame 编码流视频帧信息,参看 ByteRTCEncodedVideoFrame{@link #ByteRTCEncodedVideoFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 目前仅支持推送 H264 和 ByteVC1 格式的视频帧,且视频流协议格式须为 Annex B 格式。 + * - 该函数运行在用户调用线程内 + * - 推送自定义编码视频帧前,必须调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 将视频输入源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + +- (int)pushExternalEncodedVideoFrame: (NSInteger)videoIndex + withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame NS_SWIFT_NAME(pushExternalEncodedVideoFrame(withVideoIndex:withEncodedVideoFrame:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之前,设置远端视频数据解码方式 + * @param streamId 远端流 ID。 + * @param config 视频解码方式,参看 ByteRTCVideoDecoderConfig{@link #ByteRTCVideoDecoderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 当你想要对远端流进行自定义解码时,你需要先调用 registerRemoteEncodedVideoFrameObserver:{@link #ByteRTCEngine#registerRemoteEncodedVideoFrameObserver:} 注册远端视频流监测器,然后再调用该接口将解码方式设置为自定义解码。监测到的视频数据会通过 onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:{@link #ByteRTCRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:} 回调出来。 + * - 自 3.56 起,要用于自动订阅场景下,你可以设置 `streamId` 为特定值(若有对应逻辑),此时,通过此接口设置的解码方式根据 `streamId` 的相关逻辑,适用于所有的远端主流或屏幕流的解码方式。 + * @list 自定义流处理 + */ + +- (int)setVideoDecoderConfig:(NSString* _Nonnull)streamId + withVideoDecoderConfig:(ByteRTCVideoDecoderConfig)config NS_SWIFT_NAME(setVideoDecoderConfig(_:withVideoDecoderConfig:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之后,向远端请求关键帧 + * @param streamId 远端流 ID。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅适用于手动订阅模式,并且在成功订阅远端流之后使用。 + * - 该方法适用于调用 setVideoDecoderConfig:withVideoDecoderConfig:{@link #ByteRTCEngine#setVideoDecoderConfig:withVideoDecoderConfig:} 开启自定义解码功能后,并且自定义解码失败的情况下使用 + * @list 音视频传输 + */ + +- (int)requestRemoteVideoKeyFrame:(NSString* _Nonnull)streamId; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册远端编码后视频数据回调。
    + * 完成注册后,当 SDK 监测到远端编码后视频帧时,会触发 onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:{@link #ByteRTCRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:} 回调 + * @param observer 远端编码后视频数据监测器,参看 ByteRTCRemoteEncodedVideoFrameObserver{@link #ByteRTCRemoteEncodedVideoFrameObserver} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 更多自定义解码功能说明参看 [自定义视频编解码](https: + * - 该方法适用于手动订阅,并且进房前后均可调用,建议在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + +- (int)registerRemoteEncodedVideoFrameObserver:(id _Nullable)observer NS_SWIFT_NAME(registerRemoteEncodedVideoFrameObserver(_:)); +#pragma mark StreamSyncInfo +/** + * + * @type api + * @brief 发送音频流同步信息。将消息通过音频流发送到远端,并实现与音频流同步,该接口调用成功后,远端用户会收到 rtcEngine:onStreamSyncInfoReceived:info:streamType:data:{@link #ByteRTCEngineDelegate#rtcEngine:onStreamSyncInfoReceived:info:streamType:data:} 回调。 + * @param data 消息内容。 + * @param config 媒体流信息同步的相关配置,详见 ByteRTCStreamSyncInfoConfig{@link #ByteRTCStreamSyncInfoConfig} 。 + * @return + * - >=0: 消息发送成功。返回成功发送的次数。 + * - -1: 消息发送失败。消息长度大于 255 字节。 + * - -2: 消息发送失败。传入的消息内容为空。 + * - -3: 消息发送失败。通过屏幕流进行消息同步时,此屏幕流还未发布。 + * - -4: 消息发送失败。通过用麦克风或自定义设备采集到的音频流进行消息同步时,此音频流还未发布,详见错误码 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @note + * - 调用本接口的频率建议不超过 50 次每秒。 + * - 在 `ByteRTCRoomProfileInteractivePodcast` 房间模式下,此消息一定会送达。在其他房间模式下,如果本地用户未说话,此消息不一定会送达。 + * @list 消息 + */ + +- (int)sendStreamSyncInfo:(NSData* _Nonnull)data config:(ByteRTCStreamSyncInfoConfig * _Nonnull)config; +/** + * + * @type api + * @brief 开启音视频回路测试。
    + * 在进房前,用户可调用该接口对音视频通话全链路进行检测,包括对音视频设备以及用户上下行网络的检测,从而帮助用户判断是否可以正常发布和接收音视频流。
    + * 开始检测后,SDK 会录制你的声音或视频。如果你在设置的延时范围内收到了回放,则视为音视频回路测试正常。 + * @param echoConfig 回路测试参数设置,参看 ByteRTCEchoTestConfig{@link #ByteRTCEchoTestConfig}。 + * @param delayTime 音视频延迟播放的时间间隔,用于指定在开始检测多长时间后期望收到回放。取值范围为 [2,10],单位为秒,默认为 2 秒。 + * @return 方法调用结果:
    + * - 0:成功 + * - -2:失败,参数异常 + * - -4:失败,用户已进房 + * - -6:失败,当前用户已经在检测中 + * - -7:失败,音视频均不检查 + * - -8:失败,已经存在相同 roomId 的房间 + * @note + * - 调用该方法开始音视频回路检测后,你可以调用 stopEchoTest{@link #ByteRTCEngine#stopEchoTest} 立即结束测试,也可等待测试 60s 后自动结束,以更换设备进行下一次测试,或进房。 + * - 在该方法之前调用的所有跟设备控制、流控制相关的方法均在开始检测时失效,在结束检测后恢复生效。 + * - 在调用 startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay:} 和 stopEchoTest{@link #ByteRTCEngine#stopEchoTest} 之间调用的所有跟设备采集、流控制、进房相关的方法均不生效,并会收到 rtcEngine:onWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onWarning:} 回调,提示警告码为 `ByteRTCWarningCodeInEchoTestMode`。 + * - 音视频回路检测的结果会通过 rtcEngine:onEchoTestResult:{@link #ByteRTCEngineDelegate#rtcEngine:onEchoTestResult:} 回调通知。 + * @list 网络管理 + */ + +- (int)startEchoTest:(ByteRTCEchoTestConfig *_Nullable)echoConfig playDelay:(NSInteger)delayTime; +/** + * + * @type api + * @brief 停止音视频回路测试。
    + * 调用 startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay:} 开启音视频回路检测后,你必须调用该方法停止检测。 + * @return 方法调用结果:
    + * - 0:成功 + * - -3:失败,未开启回路检测。 + * @note 音视频回路检测结束后,所有对系统设备及音视频流的控制均会恢复到开始检测前的状态。 + * @list 网络管理 + */ + +- (int)stopEchoTest; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在指定视频流上添加水印。 + * @param imagePath 水印图片路径,仅支持本地文件绝对路径,长度限制为 512 字节。
    + * 水印图片为 PNG 或 JPG 格式。 + * @param rtcWatermarkConfig 水印参数,参看 ByteRTCVideoWatermarkConfig{@link #ByteRTCVideoWatermarkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - iOS 端,屏幕共享时,不支持调用该接口设置水印。 + * - 调用 clearVideoWatermark{@link #ByteRTCEngine#clearVideoWatermark} 移除指定视频流的水印。 + * - 同一视频流只能设置一个水印,新设置的水印会替换上一次的设置。你可以多次调用本方法来设置不同视频流的水印。 + * - 进入房间前后均可调用此方法。 + * - 若开启本地预览镜像,或开启本地预览和编码传输镜像,则远端水印均不镜像;在开启本地预览水印时,本端水印会镜像。 + * - 开启大小流后,水印对大小流均生效,且针对小流进行等比例缩小。 + * @list 视频处理 + */ + +- (int)setVideoWatermark: (NSString * _Nullable)imagePath + withRtcWatermarkConfig:(ByteRTCVideoWatermarkConfig* _Nonnull)rtcWatermarkConfig; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 移除指定视频流的水印。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 视频处理 + */ + +- (int)clearVideoWatermark; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 截取本地视频画面 + * @param callback 本地截图的回调。参看 ByteRTCVideoSnapshotCallbackDelegate{@link #ByteRTCVideoSnapshotCallbackDelegate}。 + * @return 本地截图任务的编号,从 `1` 开始递增。 + * @note + * - 对截取的画面,包含本地视频处理的全部效果,包含旋转,镜像,美颜等。 + * - 不管采用 SDK 内部采集,还是自定义采集,都可以进行截图。 + * @list 高级功能 + */ + +- (NSInteger)takeLocalSnapshot:(id _Nullable)callback; +/** + * + * @type api + * @valid since 3.60. + * @brief 截取本地的视频流画面,生成 JPG 文件,并保存到本地指定路径。
    + * 调用该方法后,SDK 会触发回调 rtcEngine:onLocalSnapshotTakenToFile:filePath:width:height:errorCode:taskId:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalSnapshotTakenToFile:filePath:width:height:errorCode:taskId:} 报告截图是否成功,以及截取的图片信息。 + * @param filePath 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。示例:`/Users/YourName/Pictures/snapshot.jpg`。 + * @return 本地截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + +- (NSInteger)takeLocalSnapshotToFile:(NSString * _Nonnull)filePath; +/** + * + * @type api + * @brief 截取远端视频画面,并保存到本地指定路径。 + * @param streamId 截图的视频流对应的 ID。 + * @param callback 参看 ByteRTCVideoSnapshotCallbackDelegate{@link #ByteRTCVideoSnapshotCallbackDelegate}。 + * @return 远端截图任务的编号,从 `1` 开始递增。 + * @list 高级功能 + */ + +- (NSInteger)takeRemoteSnapshot:(NSString* _Nonnull)streamId callback:(id _Nullable)callback; + +/** + * + * @type api + * @valid since 3.60. + * @brief 截取远端的视频流画面,生成 JPG 文件,并保存到本地指定路径。
    + * 调用该方法后,SDK 会触发回调 rtcEngine:onRemoteSnapshotTakenToFile:info:filePath:width:height:errorCode:taskId:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteSnapshotTakenToFile:info:filePath:width:height:errorCode:taskId:} 报告截图是否成功,以及截取的图片信息。 + * @param streamId 待截取的远端视频流 ID。 + * @param filePath 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。示例:`/Users/YourName/Pictures/snapshot.jpg`。 + * @return 远端截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + +- (NSInteger)takeRemoteSnapshotToFile:(NSString* _Nonnull)streamId filePath:(NSString * _Nonnull)filePath; + +/** + * + * @type api + * @brief 开启云代理 + * @param cloudProxiesInfo 云代理服务器信息列表。参看 ByteRTCCloudProxyInfo{@link #ByteRTCCloudProxyInfo}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在加入房间前调用此接口 + * - 在开启云代理后,进行通话前网络探测 + * - 开启云代理后,并成功连接云代理服务器后,会收到 rtcEngine:onCloudProxyConnected:{@link #ByteRTCEngineDelegate#rtcEngine:onCloudProxyConnected:}。 + * - 要关闭云代理,调用 stopCloudProxy{@link #ByteRTCEngine#stopCloudProxy}。 + * @list 通话加密 + */ + +- (int)startCloudProxy:(NSArray * _Nullable)cloudProxiesInfo; +/** + * + * @type api + * @brief 关闭云代理 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 要开启云代理,调用 startCloudProxy:{@link #ByteRTCEngine#startCloudProxy:} + * @list 通话加密 + */ + +- (int)stopCloudProxy; +/** + * + * @type api + * @hidden + * @brief 创建 K 歌评分管理接口。 + * @return K 歌评分管理接口,详见 ByteRTCSingScoringManager{@link #ByteRTCSingScoringManager}。 + * @note 如需使用 K 歌评分功能,即调用该方法以及 `ByteRTCSingScoringManager` 类下全部方法,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * @list 在线 KTV + */ + +- (ByteRTCSingScoringManager *_Nullable)getSingScoringManager; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 摄像头处于关闭状态时,使用静态图片填充本地推送的视频流。
    + * 调用 `stopVideoCapture` 接口时,会开始推静态图片。若要停止发送图片,可传入空字符串或启用内部摄像头采集。
    + * 可重复调用该接口来更新图片。 + * @param filePath 设置静态图片的路径。
    + * 支持本地文件绝对路径,不支持网络链接,长度限制为 512 字节。
    + * 静态图片支持类型为 JPEG/JPG、PNG、BMP。
    + * 若图片宽高比与设置的编码宽高比不一致,图片会被等比缩放,黑边填充空白区域。推流帧率与码率与设置的编码参数一致。 + * @return + * - 0: 成功。 + * - -2: 失败。确保传入的 filePath 为有效路径。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 该接口只适用于 SDK 内部摄像头采集,不适用于自定义视频采集。 + * - 本地预览无法看到静态图片。 + * - 进入房间前后均可调用此方法。在多房间场景中,静态图片仅在发布的房间中生效。 + * - 针对该静态图片,滤镜和镜像效果不生效,水印效果生效。 + * - 只有主流能设置静态图片,屏幕流不支持设置。 + * - 开启大小流后,静态图片对大小流均生效,且针对小流进行等比例缩小。 + * @list 音视频传输 + */ + +- (int)setDummyCaptureImagePath:(NSString * _Nonnull)filePath; +/** + * + * @type api + * @brief 通过 NTP 协议,获取网络时间。 + * @return 网络时间。参看 ByteRTCNetworkTimeInfo{@link #ByteRTCNetworkTimeInfo}。 + * @note + * 第一次调用此接口会启动网络时间同步功能,并返回 `0`。同步完成后,会收到 rtcEngineOnNetworkTimeSynchronized:{@link #ByteRTCEngineDelegate#rtcEngineOnNetworkTimeSynchronized:},此后,再次调用此 API,即可获取准确的网络时间。 + * @list 网络管理 + */ + +- (ByteRTCNetworkTimeInfo *_Nonnull)getNetworkTimeInfo; +/** + * + * @type api + * @hidden internal use only + * @brief 在听众端,设置订阅的所有远端音频流精准对齐后播放。 + * @param streamId 作为对齐基准的远端音频流对应的id。
    + * 一般选择主唱的音频流。
    + * 你必须在收到 rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:},确认此音频流已发布后,调用此 API。 + * @param mode 是否对齐,默认不对齐。参看 ByteRTCAudioAlignmentMode{@link #ByteRTCAudioAlignmentMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 你必须在实时合唱场景下使用此功能。在加入房间时,所有人应设置 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 为 `ByteRTCRoomProfileChorus`。 + * - 订阅的所有远端流必须通过 startAudioMixing:filePath:config: 开启了背景音乐混音,并将 ByteRTCAudioMixingConfig 中的 `syncProgressToRecordFrame` 设置为 `true`。 + * - 如果订阅的某个音频流延迟过大,可能无法实现精准对齐。 + * - 合唱的参与者不应调用此 API,因为调用此 API 会增加延迟。如果希望从听众变为合唱参与者,应关闭对齐功能。 + * @list 在线 KTV + */ + +- (int)setAudioAlignmentProperty:(NSString* _Nonnull)streamId + withMode:(ByteRTCAudioAlignmentMode)mode; + +#pragma mark - KTV +/** + * + * @hidden + * @type api + * @brief 创建 KTV 管理接口。 + * @return KTV 管理接口,参看 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @list 在线 KTV + */ + +- (ByteRTCKTVManager * _Nullable)getKTVManager; +/** + * + * @type api + * @brief 开启通话前回声检测 + * @param testAudioFilePath 用于回声检测的音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。
    + * 音频文件不为静音文件,推荐时长为 10 ~ 20 秒。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败。上一次检测未结束,请先调用 stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} 停止检测 后重新调用本接口。 + * - -2:失败。路径不合法或音频文件格式不支持。 + * @note + * - 只有当 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 为 `ByteRTCRoomProfileMeeting` 和 `ByteRTCRoomProfileMeetingRoom` 时支持开启本功能。 + * - 开启检测前,你需要向用户获取音频设备的使用权限。 + * - 开启检测前,请确保音频设备没有被静音,采集和播放音量正常。 + * - 调用本接口后监听 rtcEngine:onHardwareEchoDetectionResult:{@link #ByteRTCEngineDelegate#rtcEngine:onHardwareEchoDetectionResult:} 获取检测结果。 + * - 检测期间,进程将独占音频设备,无法使用其他音频设备测试接口 startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay:}。 + * - 调用 stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * @list 音频管理 + */ + +- (int)startHardwareEchoDetection:(NSString * _Nonnull)testAudioFilePath; +/** + * + * @type api + * @brief 停止通话前回声检测 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败。 + * @note + * - 关于开启通话前回声检测,参看 startHardwareEchoDetection:{@link #ByteRTCEngine#startHardwareEchoDetection:} 。 + * - 建议在收到 rtcEngine:onHardwareEchoDetectionResult:{@link #ByteRTCEngineDelegate#rtcEngine:onHardwareEchoDetectionResult:} 通知的检测结果后,调用本接口停止检测。 + * - 在用户进入房间前结束回声检测,释放对音频设备的占用,以免影响正常通话。 + * @list 音频管理 + */ + +- (int)stopHardwareEchoDetection; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 启用蜂窝网络辅助增强,改善通话质量。 + * @param config 参看 ByteRTCMediaTypeEnhancementConfig{@link #ByteRTCMediaTypeEnhancementConfig}。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败,内部错误。 + * - -2: 失败,输入参数错误。 + * @note 此功能默认不开启。 + * @list 网络管理 + */ + +- (int)setCellularEnhancement:(ByteRTCMediaTypeEnhancementConfig * _Nonnull)config; + /** + * + * @type api + * @brief 设置本地代理。 + * @param configurations 本地代理配置参数。参看 ByteRTCLocalProxyInfo{@link #ByteRTCLocalProxyInfo}。
    + * 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。
    + * 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 + * @note + * - 该方法需要在进房前调用。 + * - 调用该方法设置本地代理后,SDK 会触发 rtcEngine:onLocalProxyStateChanged:withProxyState:withProxyError:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalProxyStateChanged:withProxyState:withProxyError:} ,返回代理连接的状态。 + * @list 通话加密 + */ + +- (int)setLocalProxy:(NSArray * _Nonnull)configurations; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCEngineEx.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCEngineEx.h new file mode 100644 index 0000000..913c340 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCEngineEx.h @@ -0,0 +1,336 @@ +#import "ByteRTCEngine.h" +#import "rtc/ByteRTCVideoDefinesEx.h" + +@class ByteRTCEngineEx; +@class ByteRTCRoomEx; + +/** + * + * @type callback + * @brief ByteRTCEngineDelegateEx Class
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ +@protocol ByteRTCEngineDelegateEx +@optional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@end +/** + * + * @type api + * @brief ByteRTCEngineEx class + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCEngineEx : ByteRTCEngine +/** +* +* @type api +* @brief 创建 ByteRTCEngineEx 实例。
    +* 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    +* 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 +* @param appId 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 +* @param delegate SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} 。 +* @param delegateEx SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegateEx{@link #ByteRTCEngineDelegateEx} 。 +* @param parameters 私有参数。如需使用请联系技术支持人员。 +* @return ByteRTCVideoEx:创建成功。返回一个可用的 ByteRTCEngineEx{@link #ByteRTCEngineEx} 实例 +*/ ++ (ByteRTCEngineEx* _Nullable)createRTCEngineEx:(ByteRTCEngineConfig * _Nonnull) config + delegate:(id _Nullable)delegate; + +/** +* +* @type api +* @brief 创建 ByteRTCEngineEx 实例。
    +* 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    +* 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新创建的引擎实例。 +* @param appId 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 +* @param delegate SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} 。 +* @param delegateEx SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegateEx{@link #ByteRTCEngineDelegateEx} 。 +* @param parameters 私有参数。如需使用请联系技术支持人员。 +* @return ByteRTCVideoEx:创建成功。返回一个可用的 ByteRTCEngineEx{@link #ByteRTCEngineEx} 实例 +*/ ++ (ByteRTCEngine* _Nullable)createRTCEngineExMulti:(ByteRTCEngineConfig* _Nonnull)config + delegate:(id _Nullable)delegate; + +/** + * + * @type api + * @brief 销毁由 ByteRTCEngineEx 实例,并释放所有相关资源。 + * @note + * + 请确保和需要销毁的 ByteRTCEngineEx 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 ByteRTCEngineEx 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 ByteRTCEngineEx 实例相关的内存,并且停止与媒体服务器的任何交互。
    + * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ ++ (void)destroyRTCEngineEx NS_SWIFT_NAME(destroyRTCVideoEx()); + + +/** + * + * @type api + * @brief 销毁由createRTCEngineExMulti:delegate:parameters::delegateEx:parameters{@link #ByteRTCEngineEx#createRTCEngineExMulti:delegate:parameters:delegateEx:parameters} ByteRTCEngineEx 实例,并释放所有相关资源。 + * @note + * + 请确保和需要销毁的 ByteRTCEngineEx 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 ByteRTCEngineEx 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 ByteRTCEngineEx 实例相关的内存,并且停止与媒体服务器的任何交互。
    + * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ ++ (void)destroyRTCEngineExMulti:(ByteRTCEngineEx*)engine; +/** + * + * @type api + * @brief 设置回调句柄。 + * @param delegateEx 参看 ByteRTCEngineDelegateEx{@link #ByteRTCEngineDelegateEx}。 + */ +- (void)setDelegateEx:(id _Nullable)delegateEx; +/** + * + * @type api + * @brief 创建 ByteRTCRoomEx{@link #ByteRTCRoomEx} 实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 才能真正地创建/加入房间。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 ByteRTCRoomEx{@link #ByteRTCRoomEx} 房间实例。 + * @note 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + */ +- (ByteRTCRoomEx* _Nullable)createRTCRoomEx:(NSString* _Nonnull)roomId; +/** + * + * @type api + * @brief 设置视频源的相关配置。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param config 参看 ByteRTCVideoSourceConfig{@link #ByteRTCVideoSourceConfig}。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + */ +- (int)setVideoSource:(ByteRTCStreamIndex)streamIndex videoSourceConfig:(ByteRTCVideoSourceConfig* _Nonnull)config; +/** + * + * @type api + * @region 自定义流处理 + * @brief 推送外部视频帧。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param frame 该视频帧包含待 SDK 编码的视频数据,参考 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 推送外部视频帧前,必须调用 setVideoSource:videoSourceConfig:{@link #ByteRTCEngineEx#setVideoSource:videoSourceConfig:} 开启外部视频源采集。 + */ +- (int)pushExternalVideoFrame:(ByteRTCStreamIndex)streamIndex videoFrame:(ByteRTCVideoFrameData* _Nonnull)frame; +/** + * + * @type api + * @brief 设置流的优先级。
    + * 在网络条件有限的情况下,优先保障高优先级视频流的清晰度和流畅度,优先保障高优先级流的音频流畅度和音质。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param priority 参看 ByteRTCStreamPriority{@link #ByteRTCStreamPriority}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setLocalStreamPriority:(ByteRTCStreamIndex)streamIndex priority:(ByteRTCStreamPriority)priority; +/** + * + * @type api + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
    + * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数,包括模式、分辨率、帧率。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param captureConfig 视频采集参数。参看: ByteRTCVideoCaptureConfig{@link #ByteRTCVideoCaptureConfig}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture:deviceId:{@link #ByteRTCEngineEx#startVideoCapture:deviceId:} 前调用本接口。
    + * + 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + */ +- (int)setVideoCaptureConfig:(ByteRTCStreamIndex)streamIndex + captureConfig:(ByteRTCVideoCaptureConfig* _Nullable)captureConfig; + +#if BYTERTC_TARGET_MAC +/** + * + * @type api + * @brief 立即开启内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 本地用户在非隐身状态下调用该方法后,房间中的其他用户会收到 rtcEngine:onUserStartVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartVideoCapture:info:} 的回调。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param deviceId 设备 ID + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 调用 stopVideoCapture:{@link #ByteRTCEngineEx#stopVideoCapture:} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。
    + * + 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。
    + * + 如果需要从自定义视频采集切换为内部视频采集,你必须先关闭自定义采集,再调用此方法手动开启内部采集。 + */ +- (int)startVideoCapture:(ByteRTCStreamIndex)streamIndex deviceId:(NSString* _Nonnull)deviceId; +#endif +/** + * + * @type api + * @brief 立即关闭内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStopVideoCapture:info:} 的回调。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 调用 startVideoCapture:deviceId{@link #ByteRTCEngineEx#startVideoCapture:deviceId:} 可以开启内部视频采集。
    + * + 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + */ +- (int)stopVideoCapture:(ByteRTCStreamIndex)streamIndex; + +/** + * + * @type api + * @brief 设置音频源的整体音量。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return + * + 0: 调用成功。
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setAudioSourceVolume:(ByteRTCStreamIndex)streamIndex volume:(int)volume; +/** + * + * @type api + * @brief 设置音频源的内容。单个音频源的内容可以包含一个或多个原始音频来源。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param config 内容构成。参看 ByteRTCAudioContentTypeConfig{@link #ByteRTCAudioContentTypeConfig}。 + * @return + * + 0: 调用成功。
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setAudioContentType:(ByteRTCStreamIndex)streamIndex config:(ByteRTCAudioContentTypeConfig* _Nonnull)config; +/** + * + * @type api + * @brief 设置音频流的编码配置。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param config 编码设置。参看 ByteRTCAudioEncodeConfig{@link #ByteRTCAudioEncodeConfig}。 + * @return + * + 0: 调用成功。
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setAudioEncodeConfig:(ByteRTCStreamIndex)streamIndex config:(ByteRTCAudioEncodeConfig* _Nonnull)config; + +/** +* +* @type api +* @brief 设置多路流编码配置,在开启simulcast功能下可同时设置4路分辨率的流 +* @param stream_index 视频流的索引。参看 StreamIndex{@link #StreamIndex}。 +* @param solutions 编码设置。参看 ByteRTCVideoEncoderConfig{@link #ByteRTCVideoEncoderConfig}。 +* @param solution_num 需要传入的solutions数组大小。 +* @return +* + 0: 调用成功。
    +* + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 +*/ +- (int)setVideoEncoderConfig:(ByteRTCStreamIndex)streamIndex config:(NSArray * _Nullable)videoSolutions; + +@end + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCGameRoom.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCGameRoom.h new file mode 100644 index 0000000..85f575c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCGameRoom.h @@ -0,0 +1,908 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room +*/ + +#import +#import "rtc/ByteRTCDefines.h" +#import "rtc/ByteRTCRangeAudio.h" + +@class ByteRTCGameRoom; +/** + * + * @type callback + * @brief 游戏房间事件回调接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCGameRoomDelegate +@optional + /** + * + * @hidden + * @type callback + * @brief 游戏房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - 1: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * - 2: 离开房间。 + * @param reason 房间状态发生变化的原因。参看 ByteRTCRoomStateChangeReason{@link #ByteRTCRoomStateChangeReason}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomStateChangedWithReason:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(ByteRTCRoomState)state + reason:(ByteRTCRoomStateChangeReason)reason; + + /** + * + * @type callback + * @brief 游戏房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 额外信息,如 `{"elapsed":1187,"join_type":0}`。
    + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。
    + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 到加入房间成功所经历的时间间隔,单位为 ms。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; + +/** + * + * @type callback + * @brief 音频流状态改变回调,发生流相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 流状态码,参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 附加信息,默认为空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onStreamStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; +/** + * + * @type callback + * @brief 离开游戏房间成功回调。
    + * 用户调用 leaveRoom{@link #ByteRTCGameRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并释放所有通话相关的音视频资源。SDK 完成所有的资源释放后通过此回调通知用户。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param stats 保留参数,目前为空。 + * @note + * - 用户调用 leaveRoom{@link #ByteRTCGameRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #ByteRTCGameRoom#destroy} 销毁房间实例方法销毁 RTC 引擎,则将无法收到此回调事件。 + * - 离开游戏房间结束通话后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用了导致 App 初始化音视频设备失败。 + * @list 房间管理 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onLeaveRoom:(ByteRTCRoomStats *_Nonnull)stats; + + /** + * + * @deprecated since 3.41 and will be deleted in later version, use rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:} and rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} instead. + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param warningCode 警告码,详见枚举类型 ByteRTCWarningCode{@link #ByteRTCWarningCode} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomWarning:(ByteRTCWarningCode)warningCode __deprecated_msg("Will be removed in new version"); +/** + * + * @type callback + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生改变时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param state 音视频同步状态,参看 ByteRTCAVSyncState{@link #ByteRTCAVSyncState}。 + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onAVSyncStateChange:(ByteRTCAVSyncState)state; +/** + * + * @type callback + * @region 房间管理 + * @brief 视频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 视频流 ID。 + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本端视频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onVideoPublishStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @brief 音频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 音频流 ID。 + * @param info 音频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本端音频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onAudioPublishStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @region 房间管理 + * @brief 屏幕流视频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 屏幕流视频发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenVideoPublishStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + + +/** + * + * @type callback + * @region 房间管理 + * @brief 屏幕流音频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 屏幕流音频发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenAudioPublishStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @brief 视频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 视频流 ID。 + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 视频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onVideoSubscribeStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @brief 音频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 音频流 ID. + * @param info 音频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 音频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onAudioSubscribeStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @brief 屏幕流视频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 屏幕流视频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenVideoSubscribeStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @brief 屏幕流音频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 屏幕流音频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenAudioSubscribeStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @region 多房间 + * @brief 房间内通话统计信息回调。
    + * 用户进房开始通话后,每 2s 收到一次本回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param stats 当前 ByteRTCGameRoom 统计数据,详见:ByteRTCRoomStats{@link #ByteRTCRoomStats}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomStats:(ByteRTCRoomStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRoomStats:)); +/** + * + * @hidden 仅内部使用 + * @type callback + * @region 多房间 + * @valid since 3.60. + * @brief 房间事件回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间事件状态。详见 ByteRTCRoomEvent{@link #ByteRTCRoomEvent}。 + * @param info 房间封禁时,包含封禁时间。详见 ByteRTCRoomEventInfo{@link #ByteRTCRoomEventInfo}。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomEvent:(NSString *_Nonnull)roomId uid:(NSString *_Nonnull)uid state:(ByteRTCRoomEvent)state info:(ByteRTCRoomEventInfo *_Nonnull)info; +/** + * + * @type callback + * @brief 本地流数据统计以及网络质量回调。
    + * 本地用户发布流成功后,SDK 会周期性(2s)地通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
    + * 统计信息通过 ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param stats 当前房间本地流数据统计。详见:ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onLocalStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info stats:(ByteRTCLocalStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onLocalStreamStats:)); +/** + * + * @type callback + * @brief 本地订阅的远端音/视频流数据统计以及网络质量回调。
    + * 本地用户订阅流成功后,SDK 会周期性(2s)地通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param stats 当前房间本地流数据统计。 详见:ByteRTCRemoteStreamStats{@link #ByteRTCRemoteStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRemoteStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info stats:(ByteRTCRemoteStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRemoteStreamStats:)); +/** + * + * @type callback + * @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
    + * 1. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
    + * 2. 新进房用户会收到进房前已在房内的可见用户的进房回调通知。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type callback + * @brief 远端用户离开游戏房间,或切至不可见时,本地用户会收到此事件 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param uid 离开房间,或切至不可见的远端用户 ID。 + * @param reason 用户离开房间的原因:
    + * - 0: 远端用户调用 leaveRoom{@link #ByteRTCGameRoom#leaveRoom} 主动退出房间。 + * - 1: 远端用户因 Token 过期或网络原因等掉线。详细信息请参看[连接状态提示](https: + * - 3: 服务端调用 OpenAPI 将远端用户踢出房间。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason; +/** + * + * @type callback + * @brief 当 SDK 检测到 Token 的进房权限将在 30 秒内过期时,触发该回调。 + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 更新 Token 进房权限。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @list 引擎管理 + */ + +- (void)onTokenWillExpire:(ByteRTCGameRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 发布权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 更新 Token 发布权限。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @note Token 发布权限过期后: + * - 已发布流或尝试发布流时,本端会收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}、rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:}、rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:} 回调,提示`kPublishStateChangeReasonNoPublishPermission`,没有发布权限。 + * - 发布中的流将停止发布。远端用户会收到 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}、rtcRoom:onUserPublishScreenVideo:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenVideo:uid:isPublish:} 或 rtcRoom:onUserPublishScreenAudio:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenAudio:uid:isPublish:} 回调,提示该流已停止发布。 + * @list 引擎管理 + * @order 3 + */ + +- (void)onPublishPrivilegeTokenWillExpire:( ByteRTCGameRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 订阅权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 更新 Token 订阅权限有效期。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @note 若收到该回调后未及时更新 Token,Token 订阅权限过期后,尝试新订阅流会失败,已订阅的流会取消订阅,并且会收到 rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} 回调,提示错误码为 `-1003` 没有订阅权限。 + * @list 引擎管理 + */ + +- (void)onSubscribePrivilegeTokenWillExpire:( ByteRTCGameRoom *_Nonnull)rtcRoom; + /** + * + * @deprecated since 3.36 and will be deleted in later version, use rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}, rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}, rtcRoom:onUserPublishScreenVideo:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenVideo:uid:isPublish:}, and rtcRoom:onUserPublishScreenAudio:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenAudio:uid:isPublish:} instead. + * @type callback + * @brief 以下情况会触发此回调:
    + * - 房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调通知。 + * - 房间内的用户原音视频流被移出后,又重新发布音视频流时,房间内的其他用户会收到此回调通知。 + * - 用户刚加入房间时,会收到此回调,包含房间中所有已发布的流。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param stream 流属性,参看 ByteRTCStream{@link #ByteRTCStream} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onStreamAdd:(id _Nonnull)stream __deprecated_msg("Will be removed in new version"); + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in later version, use rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}, rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}, rtcRoom:onUserPublishScreenVideo:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenVideo:uid:isPublish:}, and rtcRoom:onUserPublishScreenAudio:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenAudio:uid:isPublish:} instead. + * @type callback + * @brief 房间内的远端用户停止发布音视频流时,本地用户会收到此回调通知。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 远端流来源的用户 ID 。 + * @param stream 流的属性,参看 ByteRTCStream{@link #ByteRTCStream}。 + * @param reason 远端流移除的原因,参看 ByteRTCStreamRemoveReason{@link #ByteRTCStreamRemoveReason} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onStreamRemove:(NSString *_Nonnull)uid + stream:(id _Nonnull)stream + reason:(ByteRTCStreamRemoveReason)reason + __deprecated_msg("Will be removed in new version"); + +/** + * + * @hidden for internal use only + * @type callback + * @region 多房间 + * @brief 当发布流成功的时候回调该事件 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param userId 用户 ID + * @param isScreen 该流是否是屏幕流
    + * + */ + + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onStreamPublishSuccess:(NSString *_Nonnull)userId isScreen:(BOOL)isScreen; + +/** + * + * @type callback + * @valid since 3.60. + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生错误时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param userId 用户 ID。 + * @param eventCode 音视频同步状态错误,参看 ByteRTCAVSyncEvent{@link #ByteRTCAVSyncEvent}。 + * @list 音视频传输 + * @order 1 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onAVSyncEvent:(NSString *_Nonnull)roomId userId:(NSString *_Nonnull)userId eventCode:(ByteRTCAVSyncEvent)eventCode; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布视频流的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishStreamVideo:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端音频流发布回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishStreamAudio:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端屏幕共享的视频流的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 远端流发布用户的用户 ID。 + * @param isPublish 为 true 代表已发布,为 false 代表已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishScreenVideo:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端屏幕共享的音频流的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 远端流发布用户的用户 ID。 + * @param isPublish 为 true 代表已发布,为 false 代表已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishScreenAudio:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid isPublish:(BOOL)isPublish; + /** + * + * @type callback + * @brief 广播文本消息回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户发来的点对点文本消息时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户发来的点对点二进制消息时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserMessageSendResult:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; + /** + * + * @type callback + * @brief 向房间内群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCRoomMessageSendResult{@link #ByteRTCRoomMessageSendResult} + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(NSInteger)msgid error:(ByteRTCRoomMessageSendResult)error; +/** + * + * @valid since 3.52. + * @type callback + * @brief 发送附加信息结果回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param taskId 本次调用的任务编号。 + * @param result 房间附加信息设置结果,详见 ByteRTCSetRoomExtraInfoResult{@link #ByteRTCSetRoomExtraInfoResult} + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onSetRoomExtraInfoResult:(NSInteger)taskId result:(ByteRTCSetRoomExtraInfoResult)result; +/** + * + * @valid since 3.52. + * @type callback + * @brief 接收到房间附加信息的回调。
    + * 另外用户加入房间成功后会收到这个房间全量附加信息 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param key 附加信息的键值 + * @param value 附加信息的内容 + * @param lastUpdateUserId 最后更新这条附加信息的用户编号 + * @param lastUpdateTimeMs 最后更新这条附加信息的 Unix 时间,时间精度是毫秒 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomExtraInfoUpdate:(NSString *_Nonnull)key value:(NSString *_Nonnull)value lastUpdateUserId:(NSString *_Nonnull)lastUpdateUserId lastUpdateTimeMs:(NSInteger)lastUpdateTimeMs; +/** + * + * @valid since 3.54 + * @type callback + * @brief 设置用户可见性的回调。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param currentUserVisibility 当前用户的可见性。
    + * - YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @param errorCode 设置用户可见性错误码,参看 ByteRTCUserVisibilityChangeError{@link #ByteRTCUserVisibilityChangeError}。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserVisibilityChanged:(BOOL)currentUserVisibility errorCode:(ByteRTCUserVisibilityChangeError)errorCode; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param uid 被禁用/解禁的视频流用户 ID + * @param banned 视频流发送状态
    + * - true: 视频流发送被禁用 + * - false: 视频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁视频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onVideoStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户音频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param uid 被禁用/解禁的音频流用户 ID + * @param banned 音频流发送状态
    + * - true: 音频流发送被禁用 + * - false: 音频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁音频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 在控制台开启音频选路后,只有被封禁/解禁用户会收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音频管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onAudioStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; + +#pragma mark ForwardStream related callback + /** + * + * @type callback + * @brief 跨房间媒体流转发状态和错误回调 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param infos 跨房间媒体流转发目标房间信息数组,详见 ByteRTCForwardStreamStateInfo{@link #ByteRTCForwardStreamStateInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onForwardStreamStateChanged:(NSArray * _Nonnull)infos; + /** + * + * @type callback + * @brief 跨房间媒体流转发事件回调 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param infos 跨房间媒体流转发目标房间事件数组,详见 ByteRTCForwardStreamEventInfo{@link #ByteRTCForwardStreamEventInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCGameRoom * _Nonnull)rtcRoom onForwardStreamEvent:(NSArray * _Nonnull)infos; +/** + * + * @type callback + * @brief 加入房间并发布或订阅流后, 以每 2 秒一次的频率,报告本地用户和已订阅的远端用户的上下行网络质量信息。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param localQuality 本端网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @param remoteQualities 已订阅用户的网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @note 更多通话中的监测接口,详见[通话中质量监测](https: + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom * _Nonnull)rtcRoom onNetworkQuality:(ByteRTCNetworkQualityStats *_Nonnull)localQuality remoteQualities:(NSArray *_Nonnull)remoteQualities; +/** + * + * @type callback + * @brief 字幕状态发生改变回调。
    + * 当用户调用 startSubtitle:{@link #ByteRTCRoom#startSubtitle:} 和 stopSubtitle{@link #ByteRTCRoom#stopSubtitle} 使字幕状态发生改变或出现错误时,触发该回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param state 字幕状态。参看 ByteRTCSubtitleState{@link #ByteRTCSubtitleState}。 + * @param errorCode 字幕任务错误码。参看 ByteRTCSubtitleErrorCode{@link #ByteRTCSubtitleErrorCode}。 + * @param errorMessage 第三方服务出现的错误。当因第三方服务出现错误,导致字幕状态改变时,用户可通过此参数获取具体的错误信息。如果不是因为第三方服务导致字幕状态改变,该字段为空。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onSubtitleStateChanged:(ByteRTCSubtitleState)state + errorCode:(ByteRTCSubtitleErrorCode)errorCode + errorMessage:(NSString *_Nonnull)errorMessage; +/** + * + * @type callback + * @brief 字幕相关内容回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param subtitles 字幕消息内容。参看 ByteRTCSubtitleMessage{@link #ByteRTCSubtitleMessage}。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onSubtitleMessageReceived:(NSArray * _Nonnull)subtitles; +@end +/** + * + * @type api + * @list 房间管理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCGameRoom : NSObject +/** + * + * @type callback + * @list 房间管理 + */ + +@property(nonatomic, weak) id _Nullable delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 退出并销毁调用 createGameRoom:roomConfig:{@link #ByteRTCEngine#createGameRoom:roomConfig:} 所创建的房间实例。 + * @list 房间管理 + */ + +- (void)destroy; +/** + * + * @type api + * @brief 通过设置 ByteRTCGameRoom{@link #ByteRTCGameRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRoomDelegate{@link #ByteRTCRoomDelegate}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + +- (int)setRTCGameRoomDelegate:(id _Nullable)roomDelegate; +/** + * + * @type api + * @brief 加入游戏房间。
    + * 调用 createGameRoom:roomConfig:{@link #ByteRTCEngine#createGameRoom:roomConfig:} 创建房间后,调用此方法加入房间,同房间内其他用户进行音频通话。 + * @param token 动态密钥,用于对登录用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在您的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * - 使用不同 App ID 的 App 是不能互通的。 + * - 请务必保证生成 Token 使用的 App ID 和创建引擎时使用的 App ID 相同,否则会导致加入房间失败。 + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @return + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + * - 如果本端用户为可见用户,房间内其他用户收到 rtcRoom:onUserJoined:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserJoined:} 回调通知。 + * - -1:roomId / userInfo.uid 包含了无效的参数。 + * - -2:已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom:{@link #ByteRTCGameRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调告知。 + * @note + * - 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,错误类型详见 ByteRTCErrorCode{@link #ByteRTCErrorCode} 中的 ByteRTCErrorCodeDuplicateLogin。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged:} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。 + * @list 房间管理 + */ + +- (int)joinRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type api + * @brief 离开游戏房间。
    + * 调用此方法结束通话过程,并释放所有通话相关的资源。 + * @return + * - 0: 调用成功。如果用户是房间内可见用户,触发以下回调: + * - 远端用户收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserLeave:reason:} 回调通知。 + * - 正在发布的流会被取消发布。远端用户收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}、rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:} 和/或 rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:} 回调通知。 + * - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 + * - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,必须调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 再次加入房间。 + * @list 房间管理 + */ + +- (int)leaveRoom NS_SWIFT_NAME(leaveRoom()); +/** + * + * @type api + * @brief 更新游戏房间 Token。
    + * 收到 onTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onTokenWillExpire:},onPublishPrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onPublishPrivilegeTokenWillExpire:},或 onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onSubscribePrivilegeTokenWillExpire:} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
    + * 如果 Token 无效,你会收到 rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:} ,错误码是 `-1010`。 + * @return + * - 0:成功; + * - !0:失败。 + * @note 请勿同时调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 和 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 重新加入房间。 + * @list 房间管理 + */ + +- (int)updateToken:(NSString *_Nullable)token; +/** + * + * @type api + * @brief 获取游戏房间的范围语音接口实例。 + * @return 方法调用结果:
    + * - ByteRTCRangeAudio:成功,返回一个 ByteRTCRangeAudio{@link #ByteRTCRangeAudio} 实例。 + * - NULL:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + +- (ByteRTCRangeAudio *_Nullable)getRangeAudio; +/** + * + * @type api + * @brief 加入游戏房间后,调用该接口开启或关闭麦克风。同游戏房间其他用户会收到回调 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:}。 + * @param enable 是否开启麦克风:
    + * - true:开启麦克风,采集并发布音频流。 + * - false:默认设置。关闭麦克风,停止采集和发布音频流。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败。没有加入房间。 + * @note 不可与 enableAudioSend:{@link #ByteRTCGameRoom#enableAudioSend:} 同时调用。 + * @list 音频管理 + */ + +- (int)enableMicrophone:(BOOL)enable; +/** + * + * @type api + * @brief 加入游戏房间后,开启或关闭扬声器。 + * @param enable 是否开启扬声器:
    + * - true:开启扬声器。 + * - false:默认设置。关闭扬声器。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败。没有加入房间。 + * @list 音频管理 + */ + +- (int)enableSpeakerphone:(BOOL)enable; +/** + * + * @type api + * @brief 开始或停止发送音频流。调用此接口不影响音频采集。同游戏房间其他用户会收到相应的回调。 + * @param enable 是否发送音频流:
    + * - true:发布音频流。 + * - false:默认设置。停止发布音频流(不会关闭麦克风),即静音。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败,未加入房间。 + * @note 不可与 enableMicrophone:{@link #ByteRTCGameRoom#enableMicrophone:} 同时调用。 + * @list 音频管理 + */ + +- (int)enableAudioSend:(BOOL)enable; +/** + * + * @type api + * @brief 是否订阅指定用户的音频流。 + * @param userId 用户 ID,最大长度为128字节的非空字符串。支持的字符集范围为:
    + * 1. 26个大写字母 A ~ Z
    + * 2. 26个小写字母 a ~ z
    + * 3. 10个数字 0 ~ 9
    + * 4. 下划线"_", at符"@", 减号"-" + * @param enable 是否订阅音频流:
    + * true:订阅指定用户的音频流。 + * false:默认设置。不订阅指定用户的音频流。 + * @return + * - 0:接口调用成功 + * - -2:传入的用户 ID 为空字符串。 + * @list 音频管理 + */ + +- (int)enableAudioReceive:(NSString* _Nullable)userId enable:(BOOL)enable; +/** + * + * @type api + * @brief 调节某个游戏房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
    + * - 该方法与 setRemoteAudioPlaybackVolume:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume:} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume:{@link #ByteRTCEngine#setPlaybackVolume:} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + +- (int)setRemoteRoomAudioPlaybackVolume:(NSInteger)volume; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRTSRoom.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRTSRoom.h new file mode 100644 index 0000000..61bba94 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRTSRoom.h @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCRTSRoom +*/ + +#import +#import "rtc/ByteRTCRtsDefines.h" +#import "rtc/ByteRTCDefines.h" + +@class ByteRTCRTSRoom; + +/** + * + * @type callback + * @brief RTS 房间事件回调接口 + */ + +@protocol ByteRTCRTSRoomDelegate +@optional + + /** + * + * @type callback + * @list 房间管理 + * @brief RTS 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtsRoom RTS 房间实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * + 0: 加入房间成功。
    + * + !0: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * @param extraInfo 额外信息,如 `{"elapsed":1187,"join_type":0}`。
    + * - `join_type` 表示加入房间的类型,`0`为首次进房,`1`为重连进房。
    + * - `elapsed` 表示加入房间耗时,即本地用户从调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 到加入 RTS 房间成功所经历的时间间隔,单位为 ms。 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomStateChanged:(NSString * _Nonnull)roomId + withUid:(nonnull NSString *)uid state:(NSInteger)state + extraInfo:(nonnull NSString *)extraInfo; + +/** + * + * @type callback + * @list 房间管理 + * @brief 离开 RTS 房间成功回调。
    + * 用户调用 leaveRoom{@link #ByteRTCRTSRoom#leaveRoom} 方法后,SDK 会停止房间内消息的收发,并在释放所有相关资源后,通过此回调通知用户离开房间成功。
    + * @param rtsRoom RTSRoom 对象。
    + * @param stats 保留参数,目前为空。 + * @note + * + 用户调用 leaveRoom{@link #ByteRTCRTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #ByteRTCRTSRoom#destroy} 销毁房间实例,则将无法收到此回调事件。
    + * + 离开房间结束通话后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用了导致 App 初始化音视频设备失败。
    + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onLeaveRoom:(ByteRTCRoomStats *_Nonnull)stats; + +/** + * + * @type callback + * @list 房间管理 + * @brief 远端用户首次进房,或断网后重新连入房间时,房间内其他用户将收到该事件。 + * @param rtsRoom ByteRTCRTSRoom 对象。
    + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type callback + * @brief 远端用户离开 RTS 房间时,本地用户会收到此事件。 + * @param rtsRoom ByteRTCRTSRoom 对象。
    + * @param uid 离开房间的远端用户 ID 。
    + * @param reason 用户离开房间的原因,参看 ByteRTCUserOfflineReason{@link #ByteRTCUserOfflineReason}。 + * @list 房间管理 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onUserLeave:(NSString * _Nonnull)uid + reason:(ByteRTCUserOfflineReason)reason; + +#pragma mark - Message Delegate Methods + /** + * + * @type callback + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRTSRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtsRoom ByteRTCRTSRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomMessageReceived:(NSString * _Nonnull)uid + message:(NSString * _Nonnull)message; + /** + * + * @type callback + * @brief 收到房间中调用 sendRoomBinaryMessage:{@link #ByteRTCRTSRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtsRoom ByteRTCRTSRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomBinaryMessageReceived:(NSString * _Nonnull)uid + message:(NSData * _Nonnull)message; + /** + * + * @type callback + * @brief 向房间内所有用户群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 + * @param rtsRoom ByteRTCRTSRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCRoomMessageSendResult{@link #ByteRTCRoomMessageSendResult} + * @note
    + * + 你应调用 sendRoomMessage:{@link #ByteRTCRTSRoom#sendRoomMessage:} 向房间内群发文本消息
    + * + 你应调用 sendRoomBinaryMessage:{@link #ByteRTCRTSRoom#sendRoomBinaryMessage:} 向房间内群发二进制消息 + * @list 消息 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomMessageSendResult:(NSInteger)msgid + error:(ByteRTCRoomMessageSendResult)error; + + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; +/** + * + * @type callback + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRTSRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onRoomMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage:{@link #ByteRTCRTSRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onRoomBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号. + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param rtsRoom ByteRTCRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @note + * - 你应调用 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 向房间内单个用户发送文本消息 + * - 你应调用 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 向房间内单个用户发送二进制消息 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserMessageSendResult:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; + + +@end + +/** + * + * @type api + * @brief RTS房间 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRTSRoom : NSObject +/** + * + * @type callback + */ + +@property(nonatomic, weak) id _Nullable delegateRts; + +/** + * + * @type api + * @list 房间管理 + * @brief 退出并销毁调用 createRTSRoom:{@link #ByteRTCEngine#createRTSRoom:} 所创建的 RTS 房间实例。 + */ + +- (void)destroy; + +/** + * + * @type api + * @list 房间管理 + * @brief 通过设置 ByteRTCRTSRoomDelegate{@link #ByteRTCRTSRoomDelegate}代理,可以监听此 `ByteRTCRTSRoom` 对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRTSRoomDelegate{@link #ByteRTCRTSRoomDelegate}。 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + */ + +- (int)setRTCRoomDelegateRts:(id _Nullable)roomDelegate; + + +/** + * + * @type api + * @brief 离开房间。
    + * 用户调用此方法离开房间,结束实时消息通信,释放所有通信相关的资源。 + * @return 方法调用结果。
    + * + 0: 方法调用成功
    + * + < 0: 方法调用失败
    + * @note
    + * + 可见的用户离开房间后,房间内其他用户会收到 rtsRoom:onUserLeave:reason:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserLeave:reason:} 回调通知;
    + * + 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtsRoom:OnLeaveRoom:{@link #ByteRTCRTSRoomDelegate#rtsRoom:OnLeaveRoom:} 回调通知。
    + * + 如果调用此方法后立即销毁引擎,SDK 将无法触发 rtsRoom:OnLeaveRoom:{@link #ByteRTCRTSRoomDelegate#rtsRoom:OnLeaveRoom:} 回调。 + * @list 房间管理 + */ + +- (int)leaveRoom; + +#pragma mark - Message Methods + + /** + * + * @type api + * @brief 给房间内的所有其他用户发送文本消息。 + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note
    + * + 在发送房间内文本消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。
    + * + 调用该函数后会收到一次 rtsRoom:onRoomMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败;
    + * + 若文本消息发送成功,则房间内远端用户会收到 rtsRoom:onRoomMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendRoomMessage:(NSString * _Nonnull)message; + /** + * + * @type api + * @brief 给房间内的所有其他用户发送二进制消息。 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note
    + * + 在房间内广播二进制消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。
    + * + 调用该函数后会收到一次 rtsRoom:onRoomMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败;
    + * + 若二进制消息发送成功,则房间内所有用户会收到 rtsRoom:onRoomBinaryMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomBinaryMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendRoomBinaryMessage:(NSData * _Nonnull)message; + +/** + * + * @type api + * @brief 更新 Token。
    + * 收到 onTokenWillExpire:{@link #ByteRTCRoomDelegate#onTokenWillExpire:},onPublishPrivilegeTokenWillExpire:{@link #ByteRTCRoomDelegate#onPublishPrivilegeTokenWillExpire:},或 onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCRoomDelegate#onSubscribePrivilegeTokenWillExpire:} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
    + * 如果 Token 无效,你会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:},错误码是 `-1010`。 + * @return + * - 0:成功; + * - !0:失败。 + * @note 请勿同时调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 和 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 重新加入房间。 + * @list 房间管理 + */ + +- (int)updateToken:(NSString *_Nullable)token; + + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点文本消息(P2P)。 + * @param userId 消息接收用户的 ID + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config
    + * 消息发送的可靠/有序类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig} + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内文本消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。 + * - 调用该函数后会收到一次 rtsRoom:onUserMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageSendResult:error:} 回调,通知消息发送方发送成功或失败。 + * - 若文本消息发送成功,则 uid 所指定的用户会收到 rtsRoom:onUserMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendUserMessage:(NSString *_Nonnull)userId message:(NSString *_Nonnull)message config:(ByteRTCMessageConfig)config; + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点二进制消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param message 发送的二进制消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config
    + * 消息发送的可靠/有序类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内二进制消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。 + * - 调用该函数后会收到一次 rtsRoom:onUserMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageSendResult:error:} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则 uid 所指定的用户会收到 rtsRoom:onUserBinaryMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserBinaryMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendUserBinaryMessage:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message config:(ByteRTCMessageConfig)config; +/** + * + * @type api + * @brief 加入 RTS 房间。
    + * 调用 createRTSRoom:{@link #ByteRTCEngine#createRTSRoom:} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。 + * @param token 动态密钥,用于对进房用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * 使用不同 AppID 的 App 是不能互通的。
    + * 请务必保证生成 Token 使用的 AppID 和创建引擎时使用的 AppID 相同,否则会导致加入房间失败。 + * @param userInfo 用户信息。参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @return 方法调用结果。
    + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + * - -1: 参数无效 + * - -2: 已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调告知。 + * @note + * - 同一个 AppID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后加入房间的用户会将先加入房间的用户踢出房间,并且先加入房间的用户会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,错误类型为重复登录 ByteRTCErrorCodeDuplicateLogin。 + * - 本地用户调用此方法加入房间成功后,会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。若本地用户同时为可见用户,加入房间时远端用户会收到 rtsRoom:onUserJoined:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserJoined:} 回调通知。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged:} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:}。 + * @list 房间管理 + */ + +- (int)joinRTSRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRoom.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRoom.h new file mode 100644 index 0000000..a529389 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRoom.h @@ -0,0 +1,1367 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room +*/ + +#import +#import "ByteRTCRTSRoom.h" +#import "rtc/ByteRTCRangeAudio.h" +#import "rtc/ByteRTCSpatialAudio.h" + +@class ByteRTCRoom; +/** + * + * @type callback + * @brief 房间事件回调接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCRoomDelegate +@optional + /** + * + * @hidden + * @type callback + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCAudioRoom 实例 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - 1: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * - 2: 离开房间。 + * @param reason 房间状态发生变化的原因。参看 ByteRTCRoomStateChangeReason{@link #ByteRTCRoomStateChangeReason}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStateChangedWithReason:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(ByteRTCRoomState)state + reason:(ByteRTCRoomStateChangeReason)reason; + + /** + * + * @type callback + * @region 多房间 + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCAudioRoom 实例 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 额外信息,如 `{"elapsed":1187,"join_type":0}`。
    + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。
    + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 到加入房间成功所经历的时间间隔,单位为 ms。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; + +/** + * + * @deprecated since 3.60, refer to [Upgrade Guide](https: + * @type callback + * @brief 流状态改变回调,发生流相关的警告或错误时会收到此回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 流状态码,参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 附加信息,目前为空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onStreamStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; +/** + * + * @type callback + * @region 多房间 + * @brief 离开房间成功回调。
    + * 用户调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并释放所有通话相关的音视频资源。SDK 完成所有的资源释放后通过此回调通知用户。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param stats 保留参数,目前为空。 + * @note + * - 用户调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #ByteRTCRoom#destroy} 销毁房间实例或 destroyRTCEngine{@link #ByteRTCEngine#destroyRTCEngine} 方法销毁 RTC 引擎,则将无法收到此回调事件。 + * - 离开房间结束通话后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用了导致 App 初始化音视频设备失败。 + * @list 房间管理 + * @order 2 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onLeaveRoom:(ByteRTCRoomStats *_Nonnull)stats; + + /** + * + * @hidden + * @deprecated since 3.41 and will be deleted in 3.51, use rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} and rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} instead. + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param warningCode 警告码,详见枚举类型 ByteRTCWarningCode{@link #ByteRTCWarningCode} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomWarning:(ByteRTCWarningCode)warningCode __deprecated_msg("Will be removed in new version"); +/** + * + * @type callback + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生改变时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param state 音视频同步状态,参看 ByteRTCAVSyncState{@link #ByteRTCAVSyncState}。 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAVSyncStateChange:(ByteRTCAVSyncState)state; +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 方法中的本地视频发布状态变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用该方法,请迁移至该回调。 + * @brief 本地视频流发布状态改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本地视频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onVideoPublishStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 方法中的本地音频流发布状态变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用该方法,请迁移至该回调。 + * @brief 本地音频流发布状态改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本地音频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAudioPublishStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 和 `rtcRoom:onStreamSubscribed:userId:subscribeConfig:` 方法中的视频流订阅状态发生变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用这两个方法,请迁移至该回调。 + * @brief 视频流订阅状态发生改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 视频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 后会收到该通知。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onVideoSubscribeStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 和 `rtcRoom:onStreamSubscribed:userId:subscribeConfig:` 方法中的音频流订阅状态发生变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用这两个方法,请迁移至该回调。 + * @brief 音频流订阅状态发生改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 音频流订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 后会收到该通知。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAudioSubscribeStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @region 多房间 + * @brief 房间内通话统计信息回调。
    + * 用户进房开始通话后,每 2s 收到一次本回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param stats 当前 ByteRTCRoom 统计数据,详见:ByteRTCRoomStats{@link #ByteRTCRoomStats} + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomStats:(ByteRTCRoomStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRoomStats:)); +/** + * + * @hidden + * @type callback + * @region 多房间 + * @valid since 3.60. + * @brief 房间事件回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间事件状态。详见 ByteRTCRoomEvent{@link #ByteRTCRoomEvent}。 + * @param info 房间封禁时,包含封禁时间。详见 ByteRTCRoomEventInfo{@link #ByteRTCRoomEventInfo}。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomEvent:(NSString *_Nonnull)roomId uid:(NSString *_Nonnull)uid state:(ByteRTCRoomEvent)state info:(ByteRTCRoomEventInfo *_Nonnull)info; +/** + * + * @type callback + * @brief 本地流数据统计以及网络质量回调。
    + * 本地用户发布流成功后,SDK 会周期性(2s)地通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
    + * 统计信息通过 ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param stats 当前房间本地流数据统计。详见:ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onLocalStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +stats:(ByteRTCLocalStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onLocalStreamStats:)); +/** + * + * @type callback + * @brief 本地订阅的远端音/视频流数据统计以及网络质量回调。
    + * 本地用户订阅流成功后,SDK 会周期性(2s)地通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param stats 当前房间本地流数据统计。 详见:ByteRTCRemoteStreamStats{@link #ByteRTCRemoteStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRemoteStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +stats:(ByteRTCRemoteStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRemoteStreamStats:)); +/** + * + * @type callback + * @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
    + * 1. 远端用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
    + * 2. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
    + * 3. 房间内隐身远端用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法切换至可见时,房间内其他用户将收到该事件。
    + * 4. 新进房用户会收到进房前已在房内的可见用户的进房回调通知。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type callback + * @brief 远端用户离开 RTC 房间,或切至不可见时,本地用户会收到此事件 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param uid 离开房间,或切至不可见的远端用户 ID。 + * @param reason 用户离开房间的原因:
    + * - 0: 远端用户调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 主动退出房间。 + * - 1: 远端用户因 Token 过期或网络原因等掉线。详细信息请参看[连接状态提示](https: + * - 2: 远端用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 切换至不可见状态。 + * - 3: 服务端调用 OpenAPI 将远端用户踢出房间。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason; +/** + * + * @type callback + * @brief 当 SDK 检测到 Token 的进房权限将在 30 秒内过期时,触发该回调。 + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 更新 Token 进房权限。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @list 引擎管理 + */ + +- (void)onTokenWillExpire:( ByteRTCRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 发布权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 更新 Token 发布权限。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @note Token 发布权限过期后: + * - 已发布流或尝试发布流时,本端会收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}回调,提示`kPublishStateChangeReasonNoPublishPermission`,没有发布权限。 + * - 发布中的流将停止发布。远端用户会收到 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调,提示该流已停止发布。 + * @list 引擎管理 + * @order 3 + */ + +- (void)onPublishPrivilegeTokenWillExpire:( ByteRTCRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 订阅权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 更新 Token 订阅权限有效期。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @note 若收到该回调后未及时更新 Token,Token 订阅权限过期后,尝试新订阅流会失败,已订阅的流会取消订阅,并且会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 回调,提示错误码为 `-1003` 没有订阅权限。 + * @list 引擎管理 + */ + +- (void)onSubscribePrivilegeTokenWillExpire:( ByteRTCRoom *_Nonnull)rtcRoom; + /** + * + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}instead. + * @type callback + * @brief 以下情况会触发此回调:
    + * - 房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调通知。 + * - 房间内的用户原音视频流被移出后,又重新发布音视频流时,房间内的其他用户会收到此回调通知。 + * - 用户刚加入房间时,会收到此回调,包含房间中所有已发布的流。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param stream 流属性,参看 ByteRTCStream{@link #ByteRTCStream} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onStreamAdd:(id _Nonnull)stream __deprecated_msg("Will be removed in new version"); + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onUserUnpublishStream:type:reason: instead. + * @type callback + * @brief 房间内的远端用户停止发布音视频流时,本地用户会收到此回调通知。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 远端流来源的用户 ID 。 + * @param stream 流的属性,参看 ByteRTCStream{@link #ByteRTCStream}。 + * @param reason 远端流移除的原因,参看 ByteRTCStreamRemoveReason{@link #ByteRTCStreamRemoveReason} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onStreamRemove:(NSString *_Nonnull)uid + stream:(id _Nonnull)stream + reason:(ByteRTCStreamRemoveReason)reason + __deprecated_msg("Will be removed in new version"); + +/** + * + * @hidden for internal use only + * @type callback + * @region 多房间 + * @brief 当发布流成功的时候回调该事件 + * @param rtcRoom ByteRTCRoom 对象。 + * @param userId 用户 ID + * @param isScreen 该流是否是屏幕流
    + * + */ + + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onStreamPublishSuccess:(NSString *_Nonnull)userId isScreen:(BOOL)isScreen; + +/** + * + * @type callback + * @valid since 3.60. + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生错误时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param roomId 房间 ID。 + * @param userId 用户 ID。 + * @param eventCode 音视频同步状态错误,参看 ByteRTCAVSyncEvent{@link #ByteRTCAVSyncEvent}。 + * @list 音视频传输 + * @order 1 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAVSyncEvent:(NSString *_Nonnull)roomId userId:(NSString *_Nonnull)userId eventCode:(ByteRTCAVSyncEvent)eventCode; + +/** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onUserPublishStream`、`onUserUnpublishStream`、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法。如果您已升级到 SDK 版本 3.60 或以上,且仍在使用这些方法,请迁移到该回调。 + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布视频流的回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:} 成功发布采集的视频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 订阅此流。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCRoom* _Nonnull)rtcRoom onUserPublishStreamVideo:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onUserPublishStream`、`onUserUnpublishStream`、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法。如果您已升级到 SDK 版本 3.60 或以上,且仍在使用这些方法,请迁移到该回调。 + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布音频流的回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:} 成功发布音频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 订阅此流。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCRoom* _Nonnull)rtcRoom onUserPublishStreamAudio:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info isPublish:(BOOL)isPublish; + + /** + * + * @type callback + * @brief > 该接口将于 3.64 onRoomMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageReceived:uid:message:} 代替。 + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief > 该接口将于 3.64 onRoomBinaryMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomBinaryMessageReceived:uid:message:} 代替。 + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage:{@link #ByteRTCRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onUserMessageReceived:uid:message:} 代替。 + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserBinaryMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onUserBinaryMessageReceived:uid:message:} 代替。 + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage:{@link #ByteRTCRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号. + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @note + * - 你应调用 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 向房间内单个用户发送文本消息 + * - 你应调用 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 向房间内单个用户发送二进制消息 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserMessageSendResult:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; + /** + * + * @type callback + * @brief 调用 sendRoomMessage:{@link #ByteRTCRoom#sendRoomMessage:} 或 sendRoomBinaryMessage:{@link #ByteRTCRoom#sendRoomBinaryMessage:} 向房间内群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCRoomMessageSendResult{@link #ByteRTCRoomMessageSendResult} + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(NSInteger)msgid error:(ByteRTCRoomMessageSendResult)error; +/** + * + * @valid since 3.52. + * @type callback + * @brief 调用 setRoomExtraInfo:value:{@link #ByteRTCRoom#setRoomExtraInfo:value:} 结果回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param taskId 本次调用的任务编号。 + * @param result 设置房间附加信息结果,详见 ByteRTCSetRoomExtraInfoResult{@link #ByteRTCSetRoomExtraInfoResult} + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onSetRoomExtraInfoResult:(NSInteger)taskId result:(ByteRTCSetRoomExtraInfoResult)result; +/** + * + * @valid since 3.52. + * @type callback + * @brief 接收到房间附加信息的回调。
    + * 房间内其他用户调用 setRoomExtraInfo:value:{@link #ByteRTCRoom#setRoomExtraInfo:value:} 设置房间附加信息,收到此回调。
    + * 另外用户加入房间成功后会收到这个房间全量附加信息 + * @param rtcRoom ByteRTCRoom 对象。 + * @param key 附加信息的键值 + * @param value 附加信息的内容 + * @param lastUpdateUserId 最后更新这条附加信息的用户编号 + * @param lastUpdateTimeMs 最后更新这条附加信息的 Unix 时间,时间精度是毫秒 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomExtraInfoUpdate:(NSString *_Nonnull)key value:(NSString *_Nonnull)value lastUpdateUserId:(NSString *_Nonnull)lastUpdateUserId lastUpdateTimeMs:(NSInteger)lastUpdateTimeMs; + +/** + * + * @valid since 3.54 + * @type callback + * @brief 接收同一房间内,其他用户调用 setStreamExtraInfo:{@link #ByteRTCRoom#setStreamExtraInfo:} 设置的流附加信息的回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param streamId 流附加信息的流 ID + * @param streamInfo 流附加信息的流信息 + * @param extraInfo 流附加信息 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomStreamExtraInfoUpdate:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo *_Nonnull)streamInfo extraInfo:(NSString *_Nonnull)extraInfo; + +/** + * + * @valid since 3.54 + * @type callback + * @brief 用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 设置用户可见性的回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param currentUserVisibility 当前用户的可见性。
    + * - YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @param errorCode 设置用户可见性错误码,参看 ByteRTCUserVisibilityChangeError{@link #ByteRTCUserVisibilityChangeError}。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserVisibilityChanged:(BOOL)currentUserVisibility errorCode:(ByteRTCUserVisibilityChangeError)errorCode; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param uid 被禁用/解禁的视频流用户 ID + * @param banned 视频流发送状态
    + * - true: 视频流发送被禁用 + * - false: 视频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁视频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onVideoStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户音频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param uid 被禁用/解禁的音频流用户 ID + * @param banned 音频流发送状态
    + * - true: 音频流发送被禁用 + * - false: 音频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁音频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 在控制台开启音频选路后,只有被封禁/解禁用户会收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音频管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAudioStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; + +#pragma mark ForwardStream related callback + /** + * + * @type callback + * @brief 跨房间媒体流转发状态和错误回调 + * @param rtcRoom ByteRTCRoom 对象 + * @param infos 跨房间媒体流转发目标房间信息数组,详见 ByteRTCForwardStreamStateInfo{@link #ByteRTCForwardStreamStateInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onForwardStreamStateChanged:(NSArray * _Nonnull)infos; + /** + * + * @type callback + * @brief 跨房间媒体流转发事件回调 + * @param rtcRoom ByteRTCRoom 对象 + * @param infos 跨房间媒体流转发目标房间事件数组,详见 ByteRTCForwardStreamEventInfo{@link #ByteRTCForwardStreamEventInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom * _Nonnull)rtcRoom onForwardStreamEvent:(NSArray * _Nonnull)infos; +/** + * + * @type callback + * @brief 加入房间并发布或订阅流后, 以每 2 秒一次的频率,报告本地用户和已订阅的远端用户的上下行网络质量信息。 + * @param rtcRoom ByteRTCRoom 对象 + * @param localQuality 本端网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @param remoteQualities 已订阅用户的网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @note 更多通话中的监测接口,详见[通话中质量监测](https: + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onNetworkQuality:(ByteRTCNetworkQualityStats *_Nonnull)localQuality remoteQualities:(NSArray *_Nonnull)remoteQualities; +/** + * + * @type callback + * @brief 字幕状态发生改变回调。
    + * 当用户调用 startSubtitle:{@link #ByteRTCRoom#startSubtitle:} 和 stopSubtitle{@link #ByteRTCRoom#stopSubtitle} 使字幕状态发生改变或出现错误时,触发该回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param state 字幕状态。参看 ByteRTCSubtitleState{@link #ByteRTCSubtitleState}。 + * @param errorCode 字幕任务错误码。参看 ByteRTCSubtitleErrorCode{@link #ByteRTCSubtitleErrorCode}。 + * @param errorMessage 第三方服务出现的错误。当因第三方服务出现错误,导致字幕状态改变时,用户可通过此参数获取具体的错误信息。如果不是因为第三方服务导致字幕状态改变,该字段为空。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onSubtitleStateChanged:(ByteRTCSubtitleState)state + errorCode:(ByteRTCSubtitleErrorCode)errorCode + errorMessage:(NSString *_Nonnull)errorMessage; +/** + * + * @type callback + * @brief 字幕相关内容回调。
    + * 当用户调用 startSubtitle:{@link #ByteRTCRoom#startSubtitle:} 后会收到此回调,通知字幕的相关信息。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param subtitles 字幕消息内容。参看 ByteRTCSubtitleMessage{@link #ByteRTCSubtitleMessage}。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onSubtitleMessageReceived:(NSArray * _Nonnull)subtitles; +@end +/** + * + * @type api + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoom : ByteRTCRTSRoom +/** + * + * @type callback + */ + +@property(nonatomic, weak) id _Nullable delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 退出并销毁调用 createRTCRoom:{@link #ByteRTCEngine#createRTCRoom:} 所创建的房间实例。 + * @list 房间管理 + */ + +- (void)destroy; +/** + * + * @valid since 3.53 + * @type api + * @brief 获取房间 ID。 + * @return 房间 ID。 + * @list 房间管理 + */ + +- (NSString *_Nonnull)getRoomId; +/** + * + * @type api + * @brief 通过设置 ByteRTCRoom{@link #ByteRTCRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRoomDelegate{@link #ByteRTCRoomDelegate}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + +- (int)setRTCRoomDelegate:(id _Nullable)roomDelegate; +/** + * + * @type api + * @brief 加入 RTC 房间。
    + * 调用 createRTCRoom:{@link #ByteRTCEngine#createRTCRoom:} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。
    + * > 用户(包括后端机器人)成功进入 RTC 房间后便开始计费。即使房间内只有 1 个用户,也会计算音频计费时长。具体计费说明,请参见[音视频通话计费](69871)。 + * @param token 动态密钥,用于对进房用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * 使用不同 AppID 的 App 是不能互通的。
    + * 请务必保证生成 Token 使用的 AppID 和创建引擎时使用的 AppID 相同,否则会导致加入房间失败。 + * @param userInfo 用户信息。参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @param userVisibility 用户可见性。建议在进房时将用户可见性都设置为 `false`,并在用户需要发送音视频流时再通过 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 设置为 `true`。从而避免因房间内用户达到数量上限所导致的进房失败。默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,其中最多 30 人可同时上麦,更多信息参看[用户和媒体流上限](https: + * @param roomConfig 房间参数配置,设置房间模式以及是否自动发布或订阅流。具体配置模式参看 ByteRTCRoomConfig{@link #ByteRTCRoomConfig}。 + * @return 方法调用结果。
    + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + * - 本端收到本地流发布状态通知 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}。 + * - 本端收到流订阅状态通知 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。 + * - 本端收到房间内已发布流的通知 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}。 + * - 如果本端用户为可见用户,房间内其他用户收到 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 回调通知。 + * - -1: 参数无效 + * - -2: 已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调告知。 + * @note + * - 同一个 AppID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后加入房间的用户会将先加入房间的用户踢出房间,并且先加入房间的用户会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,错误类型为重复登录 ByteRTCErrorCodeDuplicateLogin。 + * - 本地用户调用此方法加入房间成功后,会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。若本地用户同时为可见用户,加入房间时远端用户会收到 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 回调通知。 + * - 房间内不可见用户的容量远远大于可见用户,而且用户默认可见,因此对于不参与互动的用户,你需要调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 更改为不可见用户。从而避免因房间内用户达到数量上限所导致的进房失败。默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,其中最多 30 人可同时上麦,更多信息参看[用户和媒体流上限](https: + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged:} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:}。 + * @list 房间管理 + */ + +- (int)joinRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo userVisibility:(BOOL)userVisibility roomConfig:(ByteRTCRoomConfig *_Nonnull)roomConfig NS_SWIFT_NAME(joinRoom(_:userInfo:userVisibility:roomConfig:)); +/** + * + * @type api + * @brief 设置用户可见性。未调用该接口前,本地用户默认对他人可见。
    + * 默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,最多 30 人可同时上麦。更多信息参看[用户和媒体流上限](https: + * @param enable 设置用户是否对房间内其他用户可见:
    + * - YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * 设置用户可见性,会收到设置成功/失败回调 rtcRoom:onUserVisibilityChanged:errorCode:{@link #ByteRTCRoomDelegate#rtcRoom:onUserVisibilityChanged:errorCode:}。(v3.54 新增) + * - 在加入房间前设置用户可见性,若设置的可见性与默认值不同,将在加入房间时触发本回调。
    + * - 在加入房间后设置用户可见性,若可见性前后不同,会触发本回调。
    + * - 在断网重连后,若可见性发生改变,会触发本回调。
    + * @note + * - 在加入房间前后,用户均可调用此方法设置用户可见性。 + * - 在房间内,调用此方法成功切换用户可见性后,房间内其他用户会收到相应的回调。 + * - 从可见换至不可见时,房间内其他用户会收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:}。 + * - 从不可见切换至可见时,房间内其他用户会收到 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:}。 + * - 若调用该方法将可见性设为 `false`,此时尝试发布流会收到 `ByteRTCWarningCodeSubscribeStreamForbiden` 警告。 + * @list 房间管理 + */ + +- (int)setUserVisibility:(BOOL)enable; +/** + * + * @type api + * @brief 设置发流端音画同步。
    + * 当同一用户同时使用两个通话设备分别采集发送音频和视频时,有可能会因两个设备所处的网络环境不一致而导致发布的流不同步,此时你可以在视频发送端调用该接口,SDK 会根据音频流的时间戳自动校准视频流,以保证接收端听到音频和看到视频在时间上的同步性。 + * @param audioUserId 音频发送端的用户 ID,将该参数设为空则可解除当前音视频的同步关系。 + * @return + * - 0: 调用成功。调用该接口后音画同步状态发生改变时,你会收到 rtcRoom:onAVSyncStateChange:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncStateChange:} 回调。 + * - < 0 : 调用失败。监听 rtcRoom:onAVSyncEvent:userId:eventCode:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncEvent:userId:eventCode:} 获取错误详情。同一 RTC 房间内允许存在多个音视频同步关系,但需注意单个音频源不支持与多个视频源同时同步。 + * @note + * - 该方法在进房前后均可调用。 + * - 进行音画同步的音频发布用户 ID 和视频发布用户 ID 须在同一个 RTC 房间内。 + * - 如需更换同步音频源,再次调用该接口传入新的 `audioUserId` 即可;如需更换同步视频源,需先解除当前的同步关系,后在新视频源端开启同步。 + * @list 音视频传输 + */ + +- (int)setMultiDeviceAVSync:(NSString* _Nullable) audioUserId; +/** + * + * @type api + * @brief 离开 RTC 房间。
    + * 调用此方法结束通话过程,并释放所有通话相关的资源。 + * @return + * - 0: 调用成功。如果用户是房间内可见用户,触发以下回调: + * - 远端用户收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 回调通知。 + * - 正在发布的流会被取消发布。远端用户收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调通知。 + * - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 + * - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。你必须在收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调后,再销毁房间或引擎,或调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 再次加入房间。 + * - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 将自身设为可见的用户离开房间后,房间内其他用户会收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 回调通知。 + * @list 房间管理 + */ + +- (int)leaveRoom NS_SWIFT_NAME(leaveRoom()); + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这些方法,请迁移到此接口。 + * @brief 发布/取消发布视频流。 + * @param publish 是否发布视频流。
    + * - true: 发布。 + * - false: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头视频流。 + * - 如果你需要发布麦克风采集到的音频流,调用 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:}。 + * - 调用此方法后,房间中的所有远端用户会收到 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调通知,订阅了视频流的远端用户会收到 rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:} 回调。 + * @list 音视频传输 + */ + +- (int)publishStreamVideo:(BOOL)publish; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这些方法,请迁移到此接口。 + * @brief 发布/取消发布音频流。 + * @param publish 指定是否发布音频流。
    + * - true: 发布。 + * - false: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布音频流。 + * - 如果你需要发布摄像头采集到的视频流,调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:}。 + * - 调用此方法后,房间中的所有远端用户会收到 rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调通知,其中成功收到了音频流的远端用户会收到 rtcEngine:onFirstRemoteAudioFrame:info:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteAudioFrame:info:} 回调。 + * @list 音视频传输 + * @order 0 + */ + +- (int)publishStreamAudio:(BOOL)publish; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream` 和 `unsubscribeStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端视频流。 + * @param streamId 目标远端视频流 ID。 + * @param subscribe 指定是否订阅该视频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调获取当前房间里的远端摄像头流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用本方法取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:} 回调通知,具体异常原因参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 3 + */ + +- (int)subscribeStreamVideo:(NSString *_Nonnull)streamId subscribe:(BOOL)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream` 和 `unsubscribeStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端音频流。 + * @param streamId 目标远端音频流 ID。 + * @param subscribe 指定是否订阅该音频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调获取当前房间里的远端麦克风流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 回调通知,具体异常原因参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 3 + */ + +- (int)subscribeStreamAudio:(NSString *_Nonnull)streamId subscribe:(BOOL)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内所有远端视频流(通过摄像头采集的)。 + * @param subscribe 是否订阅所有远端视频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return + * 0: 方法调用成功
    + * !0: 方法调用失败 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功调用本接口后,订阅关系将持续到调用 subscribeAllStreamsVideo:{@link #ByteRTCRoom#subscribeAllStreamsVideo:} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,具体异常原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @list 音视频传输 + */ + +- (int)subscribeAllStreamsVideo:(BOOL)subscribe; + + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅或取消订阅所有远端音频流(通过麦克风采集的)。 + * @param subscribe 是否订阅所有远端音频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,具体异常原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @list 音视频传输 + */ + +- (int)subscribeAllStreamsAudio:(BOOL)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #ByteRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + +- (int)pauseAllSubscribedStreamVideo; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `pauseAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #ByteRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + +- (int)pauseAllSubscribedStreamAudio; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + +- (int)resumeAllSubscribedStreamVideo; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + +- (int)resumeAllSubscribedStreamAudio; + + /** + * + * @type api + * @brief 给房间内的所有其他用户群发文本消息。 + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内文本消息前,必须先调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 调用该函数后会收到一次 rtcRoom:onRoomMessageSendResult:error:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败; + * - 若文本消息发送成功,则房间内所有远端用户会收到 rtcRoom:onRoomMessageReceived:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (NSInteger)sendRoomMessage:(NSString *_Nonnull)message NS_SWIFT_NAME(sendRoomMessage(_:)); + /** + * + * @type api + * @brief 给房间内的所有其他用户群发二进制消息。 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在房间内广播二进制消息前,必须先调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 调用该函数后会收到一次 rtcRoom:onRoomMessageSendResult:error:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则房间内所有用户会收到 rtcRoom:onRoomBinaryMessageReceived:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomBinaryMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (NSInteger)sendRoomBinaryMessage:(NSData * _Nonnull)message NS_SWIFT_NAME(sendRoomBinaryMessage(_:)); + +#pragma mark ForwardStream + /** + * + * @type api + * @brief 开始跨房间转发媒体流。
    + * 在调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 后调用本接口,实现向多个房间转发媒体流,适用于跨房间连麦等场景。 + * @param configurations 跨房间媒体流转发指定房间的信息。参看 ByteRTCForwardStreamConfiguration{@link #ByteRTCForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 rtcRoom:onForwardStreamStateChanged:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamStateChanged:} 回调。 + * - 调用本方法后,你可以通过监听 rtcRoom:onForwardStreamEvent:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamEvent:} 回调来获取各个目标房间在转发媒体流过程中的相关事件。 + * - 开始转发后,目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 和发流 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调。 + * - 调用本方法后,可以调用 updateForwardStreamToRooms:{@link #ByteRTCRoom#updateForwardStreamToRooms:} 更新目标房间信息,例如,增加或减少目标房间等。 + * - 调用本方法后,可以调用 stopForwardStreamToRooms{@link #ByteRTCRoom#stopForwardStreamToRooms} 停止向所有房间转发媒体流。 + * - 调用本方法后,可以调用 pauseForwardStreamToAllRooms{@link #ByteRTCRoom#pauseForwardStreamToAllRooms} 暂停向所有房间转发媒体流。 + * @list 音视频传输 + */ + +- (int)startForwardStreamToRooms:(NSArray * _Nullable)configurations NS_SWIFT_NAME(startForwardStreamToRooms(_:)); + /** + * + * @type api + * @brief 更新跨房间媒体流转发信息。
    + * 通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 发起媒体流转发后,可调用本方法增加或者减少目标房间,或更新房间密钥。
    + * 调用本方法增加或删减房间后,将在本端触发 rtcRoom:onForwardStreamStateChanged:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamStateChanged:} 回调,包含发生了变动的目标房间中媒体流转发状态。 + * @param configurations 跨房间媒体流转发目标房间信息。参看 ByteRTCForwardStreamConfiguration{@link #ByteRTCForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * 增加或删减目标房间后,新增目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 和发布 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调。 + * @list 音视频传输 + */ + +- (int)updateForwardStreamToRooms:(NSArray * _Nullable)configurations NS_SWIFT_NAME(updateForwardStreamToRooms(_:)); +/** + * + * @type api + * @brief 停止跨房间媒体流转发。
    + * 通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 发起媒体流转发后,可调用本方法停止向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 rtcRoom:onForwardStreamStateChanged:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamStateChanged:} 回调。 + * - 调用本方法后,原目标房间中的用户将接收到本地用户停止发布 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调和退房 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 的回调。 + * - 如果需要更改目标房间,请调用 updateForwardStreamToRooms:{@link #ByteRTCRoom#updateForwardStreamToRooms:} 更新房间信息。 + * - 如果需要暂停转发,请调用 pauseForwardStreamToAllRooms{@link #ByteRTCRoom#pauseForwardStreamToAllRooms},并在之后随时调用 resumeForwardStreamToAllRooms{@link #ByteRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @list 音视频传输 + */ + +- (int)stopForwardStreamToRooms; +/** + * + * @type api + * @brief 暂停跨房间媒体流转发。
    + * 通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 发起媒体流转发后,可调用本方法暂停向所有目标房间转发媒体流。
    + * 调用本方法暂停向所有目标房间转发后,你可以随时调用 resumeForwardStreamToAllRooms{@link #ByteRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 调用本方法后,目标房间中的用户将接收到本地用户停止发布 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调和退房 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 的回调。 + * @list 音视频传输 + * @order 13 + */ + +- (int)pauseForwardStreamToAllRooms; +/** + * + * @type api + * @brief 恢复跨房间媒体流转发。
    + * 调用 pauseForwardStreamToAllRooms{@link #ByteRTCRoom#pauseForwardStreamToAllRooms} 暂停转发之后,调用本方法恢复向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * 目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 和发布 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 的回调。 + * @list 音视频传输 + */ + +- (int)resumeForwardStreamToAllRooms; +/** + * + * @type api + * @brief 获取范围语音接口实例。 + * @return 方法调用结果:
    + * - ByteRTCRangeAudio:成功,返回一个 ByteRTCRangeAudio{@link #ByteRTCRangeAudio} 实例。 + * - NULL:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + +- (ByteRTCRangeAudio *_Nullable)getRangeAudio; +/** + * + * @type api + * @brief 获取空间音频接口实例。 + * @return 方法调用结果:
    + * - ByteRTCSpatialAudio:成功,返回一个 ByteRTCSpatialAudio{@link #ByteRTCSpatialAudio} 实例。 + * - NULL:失败,当前 SDK 不支持空间音频功能。 + * @note + * - 首次调用该方法须在创建房间后、加入房间前。 空间音频相关 API 和调用时序详见[空间音频](https: + * - 只有在使用支持真双声道播放的设备时,才能开启空间音频效果; + * - 机型性能不足可能会导致音频卡顿,使用低端机时,不建议开启空间音频效果; + * - SDK 最多支持 30 个用户同时开启空间音频功能。 + * @list 高级功能 + */ + +- (ByteRTCSpatialAudio *_Nullable)getSpatialAudio; +/** + * + * @type api + * @brief 调节某个房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
    + * - 该方法与 setRemoteAudioPlaybackVolume:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume:} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume:{@link #ByteRTCEngine#setPlaybackVolume:} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + +- (int)setRemoteRoomAudioPlaybackVolume:(NSInteger)volume; +/** + * + * @valid since 3.52. + * @type api + * @brief 设置本端发布流在音频选路中的优先级。 + * @param audioSelectionPriority 本端发布流在音频选路中的优先级,默认正常参与音频选路。参见 ByteRTCAudioSelectionPriority{@link #ByteRTCAudioSelectionPriority}。 + * @note + * 在控制台上为本 appId 开启音频选路后,调用本接口才会生效。进房前后调用均可生效。更多信息参见[音频选路](https: + * 如果本端用户同时加入不同房间,使用本接口进行的设置相互独立。 + * @list 音频管理 + */ + +- (int)setAudioSelectionConfig:(ByteRTCAudioSelectionPriority)audioSelectionPriority; +/** + * + * @valid since 3.52. + * @type api + * @brief 设置/更新房间附加信息,可用于标识房间状态或属性,或灵活实现各种业务逻辑。 + * @param key 房间附加信息键值,长度小于 10 字节。
    + * 同一房间内最多可存在 5 个 key,超出则会从第一个 key 起进行替换。 + * @param value 房间附加信息内容,长度小于 128 字节。 + * @return + * - 0: 方法调用成功,返回本次调用的任务编号; + * - <0: 方法调用失败,具体原因详见 ByteRTCSetRoomExtraInfoResult{@link #ByteRTCSetRoomExtraInfoResult}。 + * @note + * - 在设置房间附加信息前,必须先调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 调用该方法后,会收到一次 rtcRoom:onSetRoomExtraInfoResult:result:{@link #ByteRTCRoomDelegate#rtcRoom:onSetRoomExtraInfoResult:result:} 回调,提示设置结果。 + * - 调用该方法成功设置附加信息后,同一房间内的其他用户会收到关于该信息的回调 rtcRoom:onRoomExtraInfoUpdate:value:lastUpdateUserId:lastUpdateTimeMs:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomExtraInfoUpdate:value:lastUpdateUserId:lastUpdateTimeMs:}。 + * - 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + +- (NSInteger)setRoomExtraInfo:(NSString *_Nonnull)key value:(NSString *_Nonnull)value; + +/** + * + * @type api + * @region 流管理 + * @brief 设置当前推流的流附加信息。 + * @param extra_info 流附加信息。长度不超过1024的字符串。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + !0:失败。 + * @note + * + 可通过此函数设置当前推流的流附加信息。流附加信息是流 ID 的附加信息标识,不同于流 ID 在推流过程中不可修改,流附加信息可以在对应流 ID 的推流中途修改。开发者可根据流附加信息来实现流 ID 相关的可变内容的同步。 + * + 该方法在进房前后均可调用 + * + 相同房间内的其他用户会通过 [onRoomStreamExtraInfoUpdate] 回调函数获得通知。 + * @list 音视频传输 + */ + +- (NSInteger)setStreamExtraInfo:(NSString *_Nonnull)extra_info; + +/** + * + * @valid since 3.52 + * @type api + * @brief 识别或翻译房间内所有用户的语音,形成字幕。
    + * 调用该方法时,可以在 ByteRTCSubtitleMode{@link #ByteRTCSubtitleMode} 中选择语音识别或翻译模式。如果选择识别模式,语音识别文本会通过 rtcRoom:onSubtitleMessageReceived:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleMessageReceived:} 事件回调给你;
    + * 如果选择翻译模式,你会同时收到两个 rtcRoom:onSubtitleMessageReceived:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleMessageReceived:} 回调,分别包含字幕原文及字幕译文。
    + * 调用该方法后,用户会收到 rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:} 回调,通知字幕是否开启。 + * @param subtitleConfig 字幕配置信息。参看 ByteRTCSubtitleConfig{@link #ByteRTCSubtitleConfig}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 使用字幕功能前,你需要在 [RTC 控制台](https: + * - 如果你需要使用流式语音识别模式,你应在 [豆包语音控制台](https: + * - 如果你需要使用实时语音翻译模式,你应开通机器翻译服务,参考 [开通服务](https: + * - 如需指定源语言,你需要在调用 `joinRoom` 接口进房时,通过 extraInfo 参数传入格式为`"语种英文名": "语种代号"` JSON 字符串,例如设置源语言为英文时,传入 `"source_language": "en"`。如未指定源语言,SDK 会将系统语种设定为源语言。如果你的系统语种不是中文、英文和日文,此时 SDK 会自动将中文设为源语言。 + * - 识别模式下,你可以传入 [RTC 控制台](https: + * - 翻译模式下,你需要传入机器翻译规定的语种英文名和语种代号。翻译模式下支持的语言及对应的代号参看[翻译模式语言支持](https: + * @list 字幕翻译服务 + */ + +- (int)startSubtitle:(ByteRTCSubtitleConfig *_Nonnull)subtitleConfig; +/** + * + * @valid since 3.52 + * @type api + * @brief 关闭字幕。
    + * 调用该方法后,用户会收到 rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:} 回调,通知字幕是否关闭。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @list 字幕翻译服务 + */ + +- (int)stopSubtitle; + +/** + * + * @type api + * @valid since 3.60. + * @brief 设置期望订阅的远端视频流类型。 + * @param streamId 目标要订阅的远端视频流 ID。 + * @param streamType 远端视频流类型,参看 ByteRTCVideoSimulcastStreamType{@link #ByteRTCVideoSimulcastStreamType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。 + * @note + * - 该方法仅在发布端调用 setVideoEncoderConfig:withParameters:{@link #ByteRTCEngine#setVideoEncoderConfig:withParameters:} 开启了发送多路视频流的情况下生效。 + * - 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。该方法可在进房后调用。 + * @list 视频管理 + * @order 1 + */ + +- (int)setRemoteSimulcastStreamType:(NSString * _Nonnull) streamId streamType:(ByteRTCVideoSimulcastStreamType)streamType; + +/** + * + * @type api + * @brief 设置期望订阅的远端视频流的参数。 + * @param streamId 期望配置订阅参数的远端视频流 ID。 + * @param remoteVideoConfig 期望配置的远端视频流参数,参看 ByteRTCRemoteVideoConfig{@link #ByteRTCRemoteVideoConfig}。 + * @return 方法调用结果:
    + * + 0:成功。
    + * + !0:失败。 + * @note + * + 若使用 342 及以前版本的 SDK,调用该方法前请联系技术支持人员开启按需订阅功能。
    + * + 该方法仅在发布端调用 setLocalSimulcastMode:{@link #ByteRTCEngine#setLocalSimulcastMode:} 开启了发送多路视频流的情况下生效,此时订阅端将收到来自发布端与期望设置的参数最相近的一路流;否则订阅端只会收到一路参数为分辨率 640px × 360px、帧率 15fps 的视频流。
    + * + 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。
    + * + 该方法需在进房后调用。
    + * + SDK 会根据发布端和所有订阅端的设置灵活调整视频流的参数,具体调整策略详见[推送多路流](https: + * @list 视频管理 + */ + +- (int)setRemoteVideoConfig:(NSString * _Nonnull) streamId remoteVideoConfig:(ByteRTCRemoteVideoConfig *_Nonnull) remoteVideoConfig; + + +/** + * + * @type api + * @valid since 3.60. + * @brief 获取通话 ID。
    + * 该方法需要在加入房间后调用。当创建一个房间开启音视频通话后,系统会为该房间生成一个对应的通话 ID,标识此房间的通话。 + * @return 通话 ID。 + * @list 房间管理 + */ + +- (NSString * _Nonnull)getCallId; + +/** + * + * @type api + * @valid since 3.60. + * @brief 设置直播房间的场景类型。 + * @param mode 直播房间场景类型,参看 ByteRTCRoomLiveMode{@link #ByteRTCRoomLiveMode}。 + * @return + * - 0: 成功。 + * - <0: 失败。 + * @list 房间管理 + */ + +- (int)setLiveMode:(ByteRTCRoomLiveMode)mode; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRoomEx.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRoomEx.h new file mode 100644 index 0000000..b05ad1c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/ByteRTCRoomEx.h @@ -0,0 +1,134 @@ +#import "ByteRTCRoom.h" +#import "rtc/ByteRTCVideoDefinesEx.h" + +@class ByteRTCRoomEx; + +/** + * + * @type callback + * @brief ByteRTCRoomDelegateEx Class
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ +@protocol ByteRTCRoomDelegateEx +@optional + +/** + * + * @type callback + * @region 房间管理 + * @brief 关于订阅媒体流状态改变的回调 + * @param rtcRoom ByteRTCRoom 对象 + * @param state 订阅媒体流状态,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState} + * @param userId 流发布用户的用户 ID + * @param streamIndex 流属性,用于指定订阅主流/屏幕流,参看 ByteRTCStreamIndex{@link#ByteRTCStreamIndex} + * @param info 流的属性,参看 ByteRTCSubscribeConfig{@link #ByteRTCSubscribeConfig} + * @note 本地用户收到该回调的时机包括:
    + * + 调用 subscribeStream:streamIndex:mediaStreamType:{@link #ByteRTCRoomEx#subscribeStream:streamIndex:mediaStreamType:} 或 unsubscribeStream:streamIndex:mediaStreamType:{@link #ByteRTCRoomEx#unsubscribeStream:streamIndex:mediaStreamType:} 订阅/取消订阅指定远端摄像头音视频流后;
    + * + 调用 subscribeScreen:mediaStreamType:{@link #ByteRTCRoom#subscribeScreen:mediaStreamType:} 或 unsubscribeScreen:mediaStreamType:{@link #ByteRTCRoom#unsubscribeScreen:mediaStreamType:} 订阅/取消订阅指定远端屏幕共享流后。 + */ +- (void)rtcRoom:(ByteRTCRoom* _Nonnull)rtcRoom + onStreamSubscribed:(ByteRTCSubscribeState)state + userId:(NSString* _Nonnull)userId + streamIndex:(ByteRTCStreamIndex)streamIndex + subscribeConfig:(ByteRTCSubscribeConfig* _Nonnull)info; +@end + +/** + * + * @type api + * @brief IRTCRoomEx Class + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomEx : ByteRTCRoom +/** + * + * @hidden + */ +@property(nonatomic, weak) id _Nullable delegateEx; +/** + * + * @type api + * @region 房间管理 + * @brief 在当前所在房间内发布媒体流 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * + 如果你已经在用户进房时通过调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 成功选择了自动发布,则无需再调用本接口。
    + * + 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头音视频流。
    + * + 如果你需要向多个房间发布流,调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:}。
    + * + 调用此方法后,房间中的所有远端用户会收到 rtcRoom:onUserPublishStream:isScreen:mediaStreamType:{@link #ByteRTCRoomDelegateEx#rtcRoom:onUserPublishStream:isScreen:mediaStreamType:} 回调通知,其中成功收到了音频流的远端用户会收到 rtcEngine:onFirstRemoteAudioFrame:info:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteAudioFrame:info:} 回调,订阅了视频流的远端用户会收到 rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:{@link #ByteRTCRoomDelegate#rtcEngine:info:onFirstRemoteVideoFrameDecoded:withFrameInfo:info:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:{@link #ByteRTCRoomDelegate#rtcEngine:info:onFirstRemoteVideoFrameDecoded:withFrameInfo:info:withFrameInfo:} 回调。
    + * + 调用 unpublishStream:mediaStreamType:{@link #ByteRTCRoomEx#unpublishStream:mediaStreamType:} 取消发布。 + */ +- (int)publishStream:(ByteRTCStreamIndex)streamIndex mediaStreamType:(ByteRTCMediaStreamType)type; +/** + * + * @type api + * @region 房间管理 + * @brief 停止将本地摄像头/麦克风采集的媒体流发布到当前所在房间中 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * + 调用 publishStream:mediaStreamType:{@link #ByteRTCRoomEx#publishStream:mediaStreamType:} 手动发布摄像头音视频流后,你需调用此接口停止发布。
    + * + 调用此方法停止发布音视频流后,房间中的其他用户将会收到 rtcRoom:onUserUnpublishStream:type:reason: 回调通知。 + */ +- (int)unpublishStream:(ByteRTCStreamIndex)streamIndex mediaStreamType:(ByteRTCMediaStreamType)type; +/** + * + * @type api + * @region 房间管理 + * @brief 订阅房间内指定的媒体流,或更新对指定媒体流的订阅选项 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param userId 指定订阅的远端发布音视频流的用户 ID。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。
    + * + 你必须先通过 rtcRoom:onUserPublishStream:isScreen:mediaStreamType:{@link #ByteRTCRoomDelegateEx#rtcRoom:onUserPublishStream:isScreen:mediaStreamType:} 回调获取当前房间里的远端摄像头音视频流信息,然后调用本方法按需订阅。
    + * + 调用该方法后,你会收到 rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:{@link #ByteRTCRoomDelegateEx#rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:} 通知方法调用结果。
    + * + 成功订阅远端用户的媒体流后,订阅关系将持续到调用 unsubscribeStream:streamIndex:mediaStreamType:{@link #ByteRTCRoomEx#unsubscribeStream:streamIndex:mediaStreamType:} 取消订阅或本端用户退房。
    + * + 关于其他调用异常,你会收到 rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} 回调通知,具体异常原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + */ +- (int)subscribeStream:(NSString* _Nonnull)userId + streamIndex:(ByteRTCStreamIndex)streamIndex + mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType; +/** + * + * @type api + * @region 房间管理 + * @brief 取消订阅房间内指定的媒体流。
    + * 该方法对自动订阅和手动订阅模式均适用。 + * @param userId 指定订阅的远端发布音视频流的用户 ID。 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param mediaStreamType 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 调用该方法后,你会收到 rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:{@link #ByteRTCRoomDelegateEx#rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:} 通知方法调用结果。
    + * + 关于其他调用异常,你会收到 rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} 回调通知,具体失败原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + */ +- (int)unsubscribeStream:(NSString* _Nonnull)userId + streamIndex:(ByteRTCStreamIndex)streamIndex + mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType; +/** + * + * @type api + * @region 房间管理 + * @brief 通过设置 ByteRTCRoomEx{@link #ByteRTCRoomEx} 对象的事件句柄,监听此对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRoomDelegateEx{@link #ByteRTCRoomDelegateEx} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + */ +- (int)setRTCRoomDelegateEx:(id _Nullable)roomDelegate; + + + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioDefines.h new file mode 100644 index 0000000..fca8b2b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioDefines.h @@ -0,0 +1,3049 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Audio Defines +*/ + +#import "ByteRTCMediaDefines.h" + +#pragma mark - ByteRTCAudioSource +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioSource : NSObject + +@end + +/** + * + * @hidden(macOS) + * @type keytype + * @brief 音频场景类型。
    + * 选择音频场景后,SDK 会自动根据客户端音频采集播放设备和状态,适用通话音量/媒体音量。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioScenarioType) { + /** + * + * @brief 默认场景,适用大部分场景。 + */ + + ByteRTCAudioScenarioTypeDefault = 0, + /** + * + * @brief 聊天室场景。通话清晰度较高,适用于会议,聊天室场景。 + */ + + ByteRTCAudioScenarioTypeChatRoom = 1, + /** + * + * @brief 游戏语音场景。 + */ + + ByteRTCAudioScenarioTypeGameStreaming = 2, + /** + * + * @brief 合唱场景。延迟较低。 + */ + + ByteRTCAudioScenarioTypeChorus = 3, + /** + * + * @brief 教育场景。适用于以人声教学内容为主的高音质场景。 + */ + + ByteRTCAudioScenarioTypeEducation = 4, + /** + * + * @brief AI 对话场景。适用于真人与 AI 智能体互动的场景。使用此场景时,还需在通过 `createRTCEngine` 创建引擎时,通过 `parameters` 字段传入私有参数 `"rtc.fg_config":"aigc_media_360=true"`。 + */ + + ByteRTCAudioScenarioTypeAiClient = 5, +}; + +/** + * + * @type keytype + * @brief 变声特效类型。如需更多类型,联系技术支持。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVoiceChangerType) { + /** + * + * @brief 原声,不含特效 + */ + + ByteRTCVoiceChangerOriginal = 0, + /** + * + * @brief 巨人 + */ + + ByteRTCVoiceChangerGiant = 1, + /** + * + * @brief 花栗鼠 + */ + + ByteRTCVoiceChangerChipmunk = 2, + /** + * + * @brief 小黄人 + */ + + ByteRTCVoiceChangerMinionst = 3, + /** + * + * @brief 颤音 + */ + + ByteRTCVoiceChangerVibrato = 4, + /** + * + * @brief 机器人 + */ + + ByteRTCVoiceChangerRobot = 5, +}; + +/** + * + * @type keytype + * @brief 混响特效类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVoiceReverbType) { + /** + * + * @brief 原声,不含特效 + */ + + ByteRTCVoiceReverbOriginal = 0, + /** + * + * @brief 回声 + */ + + ByteRTCVoiceReverbEcho = 1, + /** + * + * @brief 演唱会 + */ + + ByteRTCVoiceReverbConcert = 2, + /** + * + * @brief 空灵 + */ + + ByteRTCVoiceReverbEthereal = 3, + /** + * + * @brief KTV + */ + + ByteRTCVoiceReverbKTV = 4, + /** + * + * @brief 录音棚 + */ + + ByteRTCVoiceReverbStudio = 5, + /** + * + * @brief 虚拟立体声 + */ + + ByteRTCVoiceReverbVirtualStereo = 6, + /** + * + * @brief 空旷 + */ + + ByteRTCVoiceReverbSpacious = 7, + /** + * + * @brief 3D 人声 + */ + + ByteRTCVoiceReverb3D = 8, + /** + * + * @hidden internal use + * @brief 流行 + */ + + ByteRTCVoiceReverbPop = 9, + /** + * + * @hidden internal use + * @brief 蹦迪 + */ + + ByteRTCVoiceReverbDisco = 10, + /** + * + * @hidden internal use + * @brief 老唱片 + */ + + ByteRTCVoiceReverbOldRecord = 11, + /** + * + * @hidden internal use + * @brief 和声 + */ + + ByteRTCVoiceReverbHarmony = 12, + /** + * + * @hidden internal use + * @brief 摇滚 + */ + + ByteRTCVoiceReverbRock = 13, + /** + * + * @hidden internal use + * @brief 蓝调 + */ + + ByteRTCVoiceReverbBlues = 14, + /** + * + * @hidden internal use + * @brief 爵士 + */ + + ByteRTCVoiceReverbJazz = 15, + /** + * + * @hidden internal use + * @brief 电子 + */ + + ByteRTCVoiceReverbElectronic = 16, + /** + * + * @hidden internal use + * @brief 黑胶 + */ + + ByteRTCVoiceReverbVinyl = 17, + /** + * + * @hidden internal use + * @brief 密室 + */ + + ByteRTCVoiceReverbChamber = 18, + + /** + * + * @hidden internal use + * @brief 增强原声 + */ + + ByteRTCVoiceReverbEnhanceOriginal = 19, + + /** + * + * @hidden internal use + * @brief 浴室 + */ + + ByteRTCVoiceReverbBathroom = 20, + + /** + * + * @hidden internal use + * @brief 自然 + */ + + ByteRTCVoiceReverbNatural = 21, + + /** + * + * @hidden internal use + * @brief 楼道 + */ + + ByteRTCVoiceReverbHallway = 22, +}; +/** + * + * @type keytype + * @brief 音频均衡效果。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCBandFrequency) { + /** + * + * @brief 中心频率为 31Hz 的频带。 + */ + + ByteRTCBandFrequency31 = 0, + /** + * + * @brief 中心频率为 62Hz 的频带。 + */ + + ByteRTCBandFrequency62 = 1, + /** + * + * @brief 中心频率为 125Hz 的频带。 + */ + + ByteRTCBandFrequency125 = 2, + /** + * + * @brief 中心频率为 250Hz 的频带。 + */ + + ByteRTCBandFrequency250 = 3, + /** + * + * @brief 中心频率为 500Hz 的频带。 + */ + + ByteRTCBandFrequency500 = 4, + /** + * + * @brief 中心频率为 1kHz 的频带。 + */ + + ByteRTCBandFrequency1k = 5, + /** + * + * @brief 中心频率为 2kHz 的频带。 + */ + + ByteRTCBandFrequency2k = 6, + /** + * + * @brief 中心频率为 4kHz 的频带。 + */ + + ByteRTCBandFrequency4k = 7, + /** + * + * @brief 中心频率为 8kHz 的频带。 + */ + + ByteRTCBandFrequency8k = 8, + /** + * + * @brief 中心频率为 16kHz 的频带。 + */ + + ByteRTCBandFrequency16k = 9, +}; +/** + * + * @type keytype + * @brief 语音均衡效果。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVoiceEqualizationConfig : NSObject +/** + * + * @brief 频带。参看 ByteRTCBandFrequency{@link #ByteRTCBandFrequency}。 + */ + +@property(assign, nonatomic) ByteRTCBandFrequency frequency; +/** + * + * @brief 频带增益(dB)。取值范围是 `[-15, 15]`。 + */ + +@property(assign, nonatomic) int gain; +@end + +/** + * + * @type keytype + * @brief 音频混响效果。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVoiceReverbConfig : NSObject +/** + * + * @brief 混响模拟的房间大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。房间越大,混响越强。 + */ + +@property(assign, nonatomic) float roomSize; +/** + * + * @brief 混响的拖尾长度,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + +@property(assign, nonatomic) float decayTime; +/** + * + * @brief 混响的衰减阻尼大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + +@property(assign, nonatomic) float damping; +/** + * + * @brief 早期反射信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + +@property(assign, nonatomic) float wetGain; +/** + * + * @brief 原始信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + +@property(assign, nonatomic) float dryGain; +/** + * + * @brief 早期反射信号的延迟。取值范围 `[0.0, 200.0]`,单位为 ms。默认值为 `0.0f`。 + */ + +@property(assign, nonatomic) float preDelay; +@end + +/** + * + * @type keytype + * @brief 音质档位 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioProfileType) { + /** + * + * @brief 默认音质
    + * 服务器下发或客户端已设置的 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 的音质配置 + */ + + ByteRTCAudioProfileDefault = 0, + /** + * + * @brief 流畅
    + * 单声道,采样率为 16 kHz,编码码率为 32 Kbps。
    + * 流畅优先、低功耗、低流量消耗,适用于大部分游戏场景,如小队语音、组队语音、国战语音等。 + */ + + ByteRTCAudioProfileFluent = 1, + /** + * + * @brief 单声道标准音质。
    + * 采样率为 24 kHz,编码码率为 48 Kbps。
    + * 适用于对音质有一定要求的场景,同时延时、功耗和流量消耗相对适中,适合教育场景和狼人杀等游戏。 + */ + + ByteRTCAudioProfileStandard = 2, + /** + * + * @brief 双声道音乐音质
    + * 采样率为 48 kHz,编码码率为 128 kbps。
    + * 超高音质,同时延时、功耗和流量消耗相对较大,适用于连麦 PK 等音乐场景。
    + * 游戏场景不建议使用。 + */ + + ByteRTCAudioProfileHD = 3, + /** + * + * @brief 双声道标准音质。采样率为 48 KHz,编码码率最大值为 80 Kbps + */ + + ByteRTCAudioProfileStandardStereo = 4, + /** + * + * @brief 单声道音乐音质。采样率为 48 kHz,编码码率最大值为 64 Kbps + */ + + ByteRTCAudioProfileHDMono = 5, +}; + +/** + * + * @type keytype + * @brief 降噪模式。降噪算法受调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 时设置的房间模式影响。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAnsMode) { + /** + * + * @brief 关闭所有音频降噪能力。 + */ + + ByteRTCAnsModeDisable = 0, + /** + * + * @brief 适用于微弱降噪。 + */ + + ByteRTCAnsModeLow = 1, + /** + * + * @brief 适用于抑制中度平稳噪声,如空调声和风扇声。 + */ + + ByteRTCAnsModeMedium = 2, + /** + * + * @brief 适用于抑制嘈杂非平稳噪声,如键盘声、敲击声、碰撞声、动物叫声。 + */ + + ByteRTCAnsModeHigh = 3, + /** + * + * @brief 启用音频降噪能力。具体的降噪算法由 RTC 智能决策。 + */ + + ByteRTCAnsModeAutomatic = 4, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 语音通话模式,在小队语音里用这个接口设置自己的发送模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRangeAudioMode) { + /** + * + * @brief 默认模式 + */ + + ByteRTCRangeAudioModeUndefined = 0, + /** + * + * @brief 小队模式 + */ + + ByteRTCRangeAudioModeTeam = 1, + /** + * + * @brief 世界模式 + */ + + ByteRTCRangeAudioModeWorld = 2, +}; + +/** + * + * @type keytype + * @brief 当前音频设备类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioDeviceType) { + /** + * + * @brief 未知音频设备 + */ + + ByteRTCAudioDeviceTypeUnknown = -1, + /** + * + * @brief 音频渲染设备 + */ + + ByteRTCAudioDeviceTypeRenderDevice = 0, + /** + * + * @brief 音频采集设备 + */ + + ByteRTCAudioDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流音频设备 + */ + + ByteRTCAudioDeviceTypeScreenCaptureDevice = 2 +}; +/** + * + * @type keytype + * @brief 音频采样率,单位为 Hz。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioSampleRate) { + /** + * + * @brief 默认设置。48000Hz。 + */ + + ByteRTCAudioSampleRateAuto = -1, + /** + * + * @brief 8000Hz + */ + + ByteRTCAudioSampleRate8000 = 8000, + /** + * + * @brief 11025Hz + */ + + ByteRTCAudioSampleRate11025 = 11025, + /** + * + * @brief 16000Hz + */ + + ByteRTCAudioSampleRate16000 = 16000, + /** + * + * @brief 22050Hz + */ + + ByteRTCAudioSampleRate22050 = 22050, + /** + * + * @brief 24000Hz + */ + + ByteRTCAudioSampleRate24000 = 24000, + /** + * + * @brief 32000Hz + */ + + ByteRTCAudioSampleRate32000 = 32000, + /** + * + * @brief 44100Hz + */ + + ByteRTCAudioSampleRate44100 = 44100, + /** + * + * @brief 48000Hz + */ + + ByteRTCAudioSampleRate48000 = 48000 +}; +/** + * + * @type keytype + * @brief 音频声道。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioChannel) { + /** + * + * @brief 默认设置。默认值为 `2`。 + */ + + ByteRTCAudioChannelAuto = -1, + /** + * + * @brief 单声道 + */ + + ByteRTCAudioChannelMono = 1, + /** + * + * @brief 双声道 + */ + + ByteRTCAudioChannelStereo = 2, +}; +/** + * + * @type keytype + * @brief 音频编码类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioCodecType) { + /** + * + * @brief 未知编码类型 + */ + + ByteRTCAudioCodecTypeNone = 0, + /** + * + * @brief Opus 编码类型 + */ + + ByteRTCAudioCodecTypeOpus, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAAC, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACLC = 2, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACHEv1, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACHEv2, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACLCadts, +}; + +/** + * + * @deprecated since 3.52, use ByteRTCMixedStreamAudioCodecType{@link #ByteRTCMixedStreamAudioCodecType} instead. + * @type keytype + * @brief 音频编码类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCTranscodingAudioCodec) { + /** + * + * @type keytype + * @brief AAC 格式。 + */ + + ByteRTCTranscodingAudioCodecAAC = 0, +}; + +/** + * + * @type keytype + * @brief 音频编码类型。(新) + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamAudioCodecType) { + /** + * + * @type keytype + * @brief AAC 格式。 + */ + + ByteRTCMixedStreamAudioCodecTypeAAC = 0, +}; + +/** + * + * @type keytype + * @brief AAC 编码规格。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamAudioProfile) { + /** + * + * @brief AAC-LC 规格,默认值。 + */ + + ByteRTCMixedStreamAudioProfileLC = 0, + /** + * + * @brief HE-AAC v1 规格。 + */ + + ByteRTCMixedStreamAudioProfileHEv1 = 1, + /** + * + * @brief HE-AAC v2 规格。 + */ + + ByteRTCMixedStreamAudioProfileHEv2 = 2, +}; + +/** + * + * @deprecated since 3.52, use ByteRTCMixedStreamAudioProfile{@link #ByteRTCMixedStreamAudioProfile} instead. + * @type keytype + * @brief AAC 编码规格。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAACProfile) { + /** + * + * @brief AAC-LC 规格,默认值。 + */ + + ByteRTCAACProfileLC = 0, + /** + * + * @brief HE-AAC v1 规格。 + */ + + ByteRTCAACProfileHEv1 = 1, + /** + * + * @brief HE-AAC v2 规格。 + */ + + ByteRTCAACProfileHEv2 = 2, +}; +/** + * + * @type keytype + * @brief 音频播放路由 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRoute) { + /** + * + * @brief 通过 `setDefaultAudioRoute:` 设置的音频路由 + */ + + ByteRTCAudioRouteDefault = -1, + /** + * + * @brief 有线耳机 + */ + + ByteRTCAudioRouteHeadset = 1, + /** + * + * @brief 听筒。设备自带的,一般用于通话的播放硬件。 + */ + + ByteRTCAudioRouteEarpiece = 2, + /** + * + * @brief 扬声器。设备自带的,一般用于免提播放的硬件。 + */ + + ByteRTCAudioRouteSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + ByteRTCAudioRouteHeadsetBluetooth = 4, + /** + * + * hidden(macOS) + * @brief USB 设备或通过 Lightning 转接器连接的 3.5mm 耳机
    + * 其中,仅在客户端为 iOS 16 及以上版本时可识别出 3.5mm 耳机 + */ + + ByteRTCAudioRouteHeadsetUSB = 5, +}; + +/** + * + * @type keytype + * @brief 音频播放设备
    + * 音频设备变化时 SDK 通过 `rtcEngine:onAudioPlaybackDeviceChanged:` 回调当前音频播放设备。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioPlaybackDevice) { + /** + * + * @brief 有线耳机 + */ + + ByteRTCAudioPlaybackDeviceHeadset = 1, + /** + * + * @brief 听筒 + */ + + ByteRTCAudioPlaybackDeviceEarpiece = 2, + /** + * + * @brief 扬声器 + */ + + ByteRTCAudioPlaybackDeviceSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + ByteRTCAudioPlaybackDeviceHeadsetBluetooth = 4, + /** + * + * @brief USB 设备 + */ + + ByteRTCAudioPlaybackDeviceHeadsetUSB = 5, +}; + + +/** + * + * @type keytype + * @brief 混音播放类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingType) { + /** + * + * @brief 仅本地播放 + */ + + ByteRTCAudioMixingTypePlayout = 0, + /** + * + * @brief 仅远端播放 + */ + + ByteRTCAudioMixingTypePublish = 1, + /** + * + * @brief 本地和远端同时播放 + */ + + ByteRTCAudioMixingTypePlayoutAndPublish = 2 +}; + +/** + * + * @type keytype + * @brief 混音播放声道类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingDualMonoMode) { + /** + * + * @brief 和音频文件一致 + */ + + ByteRTCAudioMixingDualMonoModeAuto = 0, + /** + * + * @brief 只能听到音频文件中左声道的音频 + */ + + ByteRTCAudioMixingDualMonoModeL = 1, + /** + * + * @brief 只能听到音频文件中右声道的音频 + */ + + ByteRTCAudioMixingDualMonoModeR = 2, + /** + * + * @brief 能同时听到音频文件中左右声道的音频 + */ + + ByteRTCAudioMixingDualMonoModeMix = 3 +}; + +/** + * + * @type keytype + * @brief 音频混音文件播放状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingState) { + /** + * + * @brief 混音已加载 + */ + + ByteRTCAudioMixingStatePreloaded = 0, + /** + * + * @brief 混音正在播放 + */ + + ByteRTCAudioMixingStatePlaying, + /** + * + * @brief 混音暂停 + */ + + ByteRTCAudioMixingStatePaused, + /** + * + * @brief 混音停止 + */ + + ByteRTCAudioMixingStateStopped, + /** + * + * @brief 混音播放失败 + */ + + ByteRTCAudioMixingStateFailed, + /** + * + * @brief 混音播放结束 + */ + + ByteRTCAudioMixingStateFinished, + /** + * + * @brief 准备 PCM 混音 + */ + + ByteRTCAudioMixingStatePCMEnabled, + /** + * + * @brief PCM 混音播放结束 + */ + + ByteRTCAudioMixingStatePCMDisabled, +}; +/** + * + * @type keytype + * @brief 混音错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingError) { + /** + * + * @brief 正常 + */ + + ByteRTCAudioMixingErrorOk = 0, + /** + * + * @brief 预加载失败,找不到混音文件或者文件长度超出 20s + */ + + ByteRTCAudioMixingErrorPreloadFailed, + /** + * + * @brief 混音开启失败,找不到混音文件或者混音文件打开失败 + */ + + ByteRTCAudioMixingErrorStartFailed, + /** + * + * @brief 混音 ID 异常 + */ + + ByteRTCAudioMixingErrorIdNotFound, + /** + * + * @brief 设置混音文件的播放位置出错 + */ + + ByteRTCAudioMixingErrorSetPositionFailed, + /** + * + * @brief 音量参数不合法,仅支持设置的音量值为[0, 400] + */ + + ByteRTCAudioMixingErrorInValidVolume, + /** + * + * @brief 播放的文件与预加载的文件不一致。请先使用 unloadAudioMixing: 卸载此前的文件。 + */ + + ByteRTCAudioMixingErrorLoadConflict, + /** + * + * @brief 不支持此混音类型。 + */ + + ByteRTCAudioMixingErrorIdTypeNotMatch, + /** + * + * @brief 设置混音文件的音调不合法 + */ + + ByteRTCAudioMixingErrorInValidPitch, + /** + * + * @brief 设置混音文件的音轨不合法 + */ + + ByteRTCAudioMixingErrorInValidAudioTrack, + /** + * + * @brief 混音文件正在启动中 + */ + + ByteRTCAudioMixingErrorIsStarting, + /** + * + * @brief 设置混音文件的播放速度不合法 + */ + + ByteRTCAudioMixingErrorInValidPlaybackSpeed, +}; +/** + * + * @type keytype + * @brief 自定义音频源模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaPlayerCustomSourceMode) { + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceModePush = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceModePull, +}; +/** + * + * @type keytype + * @brief 自定义音频流类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaPlayerCustomSourceStreamType) { + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceStreamTypeRaw = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceStreamTypeEncoded, +}; +/** + * + * @type keytype + * @brief 音频数据的起始读取位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaPlayerCustomSourceSeekWhence) { + /** + * + * @brief 从音频数据的头开始读取,读取后的位置为参数 offset 的值。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceSet = 0, + /** + * + * @brief 从音频数据的某一位置开始读取,读取后的位置为音频数据当前的读取位置加上参数 offset 的值。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceCur = 1, + /** + * + * @brief 从音频数据的尾开始读取,读取后的位置为用户传入的音频数据大小加上参数 offset 的值。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceEnd = 2, + /** + * + * @brief 返回音频数据的大小。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceSize = 3, +}; +/** + * + * @type keytype + * @brief 播放状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayerState) { + /** + * + * @brief 播放未启动 + */ + + ByteRTCPlayerStateIdle = 0, + /** + * + * @brief 已加载 + */ + + ByteRTCPlayerStatePreloaded, + /** + * + * @brief 已打开 + */ + + ByteRTCPlayerStateOpened, + /** + * + * @brief 正在播放 + */ + + ByteRTCPlayerStatePlaying, + /** + * + * @brief 播放已暂停 + */ + + ByteRTCPlayerStatePaused, + /** + * + * @brief 播放已被主动停止 + */ + + ByteRTCPlayerStateStopped, + /** + * + * @brief 播放失败 + */ + + ByteRTCPlayerStateFailed, + /** + * + * @brief 播放自然结束 + */ + + ByteRTCPlayerStateFinished, + /** + * + * @brief 循环播放已结束 + */ + + ByteRTCPlayerStateLoopFinished, +}; + +/** + * + * @type keytype + * @brief 播放事件 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayerEvent) { + + /** + * + * @brief 开始切换音轨
    + * 开始调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 时,返回此状态。 + */ + + ByteRTCPlayerEventSelectAudioTrackBegin, + /** + * + * @brief 切换音轨成功
    + * 调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 成功后,播放器切换到指定音轨播放,返回此状态。 + */ + + ByteRTCPlayerEventSelectAudioTrackCompleted, + /** + * + * @brief 切换音轨失败
    + * 调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 失败后,播放器无法切换到指定音轨,继续之前的音轨播放过程,返回此状态。 + */ + + ByteRTCPlayerEventSelectAudioTrackFailed, + /** + * + * @brief 试图移动播放位置
    + * 开始调用 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 时,返回此状态。 + */ + + ByteRTCPlayerEventSeekBegin, + /** + * + * @brief 移动播放位置成功
    + * 调用 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 成功后,返回此状态。 + */ + + ByteRTCPlayerEventSeekCompleted, + /** + * + * @brief 移动播放位置失败
    + * 调用 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 失败时,返回此状态。 + */ + + ByteRTCPlayerEventSeekFailed, +}; + +/** + * + * @type keytype + * @brief 播放错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayerError) { + /** + * + * @brief 正常 + */ + + ByteRTCPlayerErrorOK = 0, + /** + * + * @brief 不支持此类型 + */ + + ByteRTCPlayerErrorFormatNotSupport, + /** + * + * @brief 无效的播放路径 + */ + + ByteRTCPlayerErrorInvalidPath, + /** + * + * @brief 未满足前序接口调用的要求。请查看具体接口文档。 + */ + + ByteRTCPlayerErrorInvalidState, + /** + * + * @brief 设置播放位置出错。 + */ + + ByteRTCPlayerErrorInvalidPosition, + /** + * + * @brief 音量参数不合法。 + */ + + ByteRTCPlayerErrorInvalidVolume, + /** + * + * @brief 音调参数设置不合法。 + */ + + ByteRTCPlayerErrorInvalidPitch, + /** + * + * @brief 音轨参数设置不合法。 + */ + + ByteRTCPlayerErrorInvalidAudioTrackIndex, + /** + * + * @brief 播放速度参数设置不合法 + */ + + ByteRTCPlayerErrorInvalidPlaybackSpeed, + /** + * + * @brief 音效 ID 异常。还未加载或播放文件,就调用其他 API。 + */ + + ByteRTCPlayerErrorInvalidEffectId, + /** + * + * @brief 资源正在播放中 + */ + + ByteRTCPlayerErrorCurrentlyPlaying, +}; + +/** + * + * @type keytype + * @brief 音频输入源类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioSourceType) { + /** + * + * @brief 自定义采集音频源 + */ + + ByteRTCAudioSourceTypeExternal = 0, + /** + * + * @brief RTC SDK 内部采集音频源 + */ + + ByteRTCAudioSourceTypeInternal, +}; + +/** + * + * @type keytype + * @brief 音频输出源类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRenderType) { + /** + * + * @brief 自定义渲染音频 + */ + + ByteRTCAudioRenderTypeExternal = 0, + /** + * + * @brief RTC SDK 内部渲染音频 + */ + + ByteRTCAudioRenderTypeInternal, +}; + +/** + * + * @type keytype + * @brief 是否开启耳返功能。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEarMonitorMode) { + /** + * + * @brief 关闭。 + */ + + ByteRTCEarMonitorModeOff = 0, + /** + * + * @brief 开启。 + */ + + ByteRTCEarMonitorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 耳返音频是否经过本地音频处理。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEarMonitorAudioFilter) { + /** + * + * @brief 无音频处理。 + */ + + ByteRTCEarMonitorAudioFilterNone = 0x0001, + /** + * + * @brief 经本地音频处理后的音频,包括 3A、变声、混响等 SDK 提供处理能力以及自定义音频处理。 + */ + + ByteRTCEarMonitorAudioFilterReuseAudioProcessing = 0x8000, +}; + +/** + * + * @type keytype + * @brief 音频回调方法 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioFrameCallbackMethod) { + /** + * + * @brief 本地麦克风录制的音频数据回调 + */ + + ByteRTCAudioFrameCallbackRecord = 0, + /** + * + * @brief 订阅的远端所有用户混音后的音频数据回调 + */ + + ByteRTCAudioFrameCallbackPlayback = 1, + /** + * + * @brief 本地麦克风录制和订阅的远端所有用户混音后的音频数据回调 + */ + + ByteRTCAudioFrameCallbackMixed = 2, + /** + * + * @brief 订阅的远端每个用户混音前的音频数据回调 + */ + + ByteRTCAudioFrameCallbackRemoteUser = 3, + /** + * + * @brief 本地麦克风录制和本地 `MediaPlayer`, `EffectPlayer` 播放的音频混音后的音频数据回调 + */ + + ByteRTCAudioFrameCallbackCaptureMixed = 5 +}; +/** + * + * @type keytype + * @brief 返回给音频处理器的音频类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioFrameMethod) { + /** + * + * @brief 本地采集的音频。 + */ + + ByteRTCAudioFrameProcessorRecord = 0, + /** + * + * @brief 远端音频流的混音音频。 + */ + + ByteRTCAudioFrameProcessorPlayback = 1, + /** + * + * @brief 各个远端音频流。 + */ + + ByteRTCAudioFrameProcessorRemoteUser = 2, + /** + * + * @hidden(macOS) + * @brief 软件耳返音频。 + */ + + ByteRTCAudioFrameProcessorEarMonitor = 3, + /** + * + * @brief 屏幕共享音频。 + */ + + ByteRTCAudioFrameProcessorScreen = 4, +}; + +/** + * + * @type keytype + * @brief 音量回调模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioReportMode) { + /** + * + * @brief 默认始终开启音量回调。 + */ + + ByteRTCAudioReportModeNormal = 0, + /** + * + * @brief 可见用户进房并停止推流后,关闭音量回调。 + */ + + ByteRTCAudioReportModeDisconnect = 1, + /** + * + * @brief 可见用户进房并停止推流后,开启音量回调,回调值重置为 0。 + */ + + ByteRTCAudioReportModeReset = 2, +}; + +/** + * + * @type keytype + * @brief rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 中包含的音频信息的范围。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioPropertiesMode) { + /** + * + * @brief 仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + + ByteRTCAudioPropertiesModeMicrohone = 0, + /** + * + * @brief 包含以下信息:
    + * - 本地麦克风采集的音频数据和本地屏幕音频采集数据; + * - 本地混音的音频数据。 + */ + + ByteRTCAudioPropertiesModeAudioMixing = 1 +}; + +/** + * + * @type keytype + * @brief 音频流来源的用户 ID, 及对应的音量。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioVolumeInfo : NSObject +/** + * + * @brief 音频流来源的用户 ID + */ + +@property(copy, nonatomic) NSString * _Nonnull uid; +/** + * + * @brief 线性音量,取值范围为:[0,255] + */ + +@property(assign, nonatomic) NSUInteger linearVolume; +/** + * + * @brief 非线性音量,取值范围为:[-127,0] + */ + +@property(assign, nonatomic) NSUInteger nonlinearVolume; +@end + +/** + * + * @type keytype + * @brief 音频参数格式 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioFormat : NSObject +/** + * + * @brief 音频采样率,详见 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate} + */ + +@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate; +/** + * + * @brief 音频声道,详见 ByteRTCAudioChannel{@link #ByteRTCAudioChannel} + */ + +@property(nonatomic, assign) ByteRTCAudioChannel channel; +/** + * + * @brief 单次回调的音频帧中包含的采样点数。默认值为 `0`,此时,采样点数取最小值。
    + * 最小值为回调间隔是 0.01s 时的值,即 `sampleRate * channel * 0.01s`。
    + * 最大值是 `2048`。超出取值范围时,采样点数取默认值。
    + * 该参数仅在设置读写回调时生效,调用 enableAudioFrameCallback:format:{@link #ByteRTCEngine#enableAudioFrameCallback:format:} 开启只读模式回调时设置该参数不生效。 + */ + +@property(nonatomic, assign) int samplesPerCall; +@end + +/** + * + * @type keytype + * @brief PCM 音频帧 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioFrame : NSObject +/** + * + * @brief PCM 数据 + */ + +@property(strong, nonatomic) NSData * _Nonnull buffer; +/** + * + * @brief 采样点个数 + */ + +@property(assign, nonatomic) int samples; +/** + * + * @brief 音频声道,参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel}。
    + * 双声道的情况下,左右声道的音频帧数据以 LRLRLR 形式排布。 + */ + +@property(assign, nonatomic) ByteRTCAudioChannel channel; +/** + * + * @brief 采样率,参看 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate}。 + */ + +@property(assign, nonatomic) ByteRTCAudioSampleRate sampleRate; +/** + * + * @hidden for internal use only + * @brief 额外信息数据 + */ + +@property(strong, nonatomic) NSData * extraInfo; +@end +/** + * + * @type callback + * @brief 音频数据回调观察者
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。
    + * 本接口类中的回调周期均为 20 ms。 + * @list + */ + +@protocol ByteRTCAudioFrameObserver +/** + * + * @type callback + * @brief 返回麦克风录制的音频数据 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回订阅的所有远端用户混音后的音频数据。 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onPlaybackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回远端单个用户的音频数据 + * @param streamId 远端流对应的唯一标识 + * @param info 远端流详细信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param audioFrame 音频数据,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @note 此回调在播放线程调用。不要在此回调中做任何耗时的事情,否则可能会影响整个音频播放链路。 + * @list 自定义流处理 + */ + +- (void)onRemoteUserAudioFrame:(NSString * _Nonnull)streamId + info:(ByteRTCStreamInfo * _Nonnull)info + audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回本地麦克风录制和订阅的所有远端用户混音后的音频数据 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回本地麦克风录制的音频数据,本地 `MediaPlayer` / `EffectPlayer` 播放音频文件混音后的音频数据 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onCaptureMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +@end +/** + * + * @type callback + * @brief 自定义音频处理器
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Custom Stream Processing + */ + +@protocol ByteRTCAudioFrameProcessor +/** + * + * @type callback + * @brief 回调本地采集的音频帧地址,供自定义音频处理。 + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 完成自定义音频处理后,SDK 会对处理后的音频帧进行编码,并传输到远端。此音频处理不会影响软件耳返音频数据。 + * - 要启用此回调,必须调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并在参数中选择本地采集的音频,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 回调远端音频混音的音频帧地址,供自定义音频处理。 + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @note 调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并在参数中选择远端音频流的混音音频时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessPlayBackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 回调单个远端用户的音频帧地址,供自定义音频处理。 + * @param streamId 音频流对应的唯一标识 + * @param info 音频流详细信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @note 调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并在参数中选择各个远端音频流时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessRemoteUserAudioFrame:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo * _Nonnull)info audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @hidden(macOS) + * @valid since 3.50 + * @type callback + * @brief 软件耳返音频数据的回调。你可根据此回调自定义处理音频。
    + * 软件耳返音频中包含通过调用 `setVoiceReverbType:` 和 `setVoiceChangerType:` 设置的音频特效。 + * @param audioFrame 音频帧地址。参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 此数据处理只影响软件耳返音频数据。 + * - 要启用此回调,必须调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并选择耳返音频。每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessEarMonitorAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 回调屏幕共享的音频帧地址,供自定义音频处理。 + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @note 调用 `enableAudioProcessor:`,把返回给音频处理器的音频类型设置为屏幕共享音频后,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessScreenAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +@end + +/** + * + * @type keytype + * @hidden for internal use only + * @region 音频管理 + * @brief 音频帧构建类 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEncodedAudioFrameData : NSObject +/** + * + * @hidden for internal use only + * @brief 音频编码类型,参看 ByteRTCAudioCodecType{@link #ByteRTCAudioCodecType}。 + */ + +@property(assign, nonatomic) ByteRTCAudioCodecType codecType; +/** + * + * @hidden for internal use only + * @brief 数据 + */ + +@property(strong, nonatomic) NSData * _Nonnull buffer; +/** + * + * @hidden for internal use only + * @brief 音频声道,参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel}。
    + * 双声道的情况下,左右声道的音频帧数据以 LRLRLR 形式排布。 + */ + +@property(assign, nonatomic) ByteRTCAudioChannel channel; +/** + * + * @hidden for internal use only + * @brief 采样率,参看 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate}。 + */ + +@property(assign, nonatomic) ByteRTCAudioSampleRate sampleRate; +/** + * + * @hidden for internal use only + * @brief 数据大小 + */ + +@property(assign, nonatomic) int size; +/** + * + * @hidden for internal use only + * @brief 时间戳,单位为微秒。 + */ + +@property(assign, nonatomic) long timestampUs; +/** + * + * @hidden for internal use only + * @brief 音频帧时长,单位为毫秒。 + */ + +@property(assign, nonatomic) int frameSizeMs; +/** + * + * @hidden for internal use only + * @brief 额外信息数据 + */ + +@property(strong, nonatomic) NSData * extraInfo; +@end +/** + * + * @type callback + * @hidden for internal use only + * @brief 远端音频帧监测器 + * @list 自定义流处理 + */ + +@protocol ByteRTCRemoteEncodedAudioFrameObserver +/** + * + * @type callback + * @hidden for internal use only + * @brief 调用 registerRemoteEncodedAudioFrameObserver:{@link #ByteRTCEngine#registerRemoteEncodedAudioFrameObserver:} 后,SDK 收到远端音频帧信息时,回调该事件 + * @param streamId 收到的远端音频流对应的唯一标识 + * @param info 收到的远端音频流的详细信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param audioFrame 远端音频帧信息,参看 ByteRTCEncodedAudioFrameData{@link #ByteRTCEncodedAudioFrameData} + * @list 自定义流处理 + */ + +- (void)onRemoteEncodedAudioFrame:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo * _Nonnull)info audioFrame:(ByteRTCEncodedAudioFrameData * _Nonnull)audioFrame; +@end + + + +#pragma mark - AudioDeviceManager +/** + * + * @hidden(iOS) + * @type api + * @brief 音频设备管理类 + * @list Custom Stream Processing + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioDeviceManager : NSObject +/** + * + * @type api + * @brief 获取当前系统内音频播放设备列表。 + * @return 所有音频播放设备的列表,参看 ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 监听到 `ByteRTCMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 了解设备变更后,重新调用本接口以获得新的设备列表。
    + * @list 音频管理 + */ + +- (ByteRTCDeviceCollection * _Nonnull)enumerateAudioPlaybackDevices; +/** + * + * @type api + * @brief 获取音频采集设备列表。 + * @return 音频采集设备列表。详见 ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 监听到 `ByteRTCMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 音频管理 + */ + +- (ByteRTCDeviceCollection * _Nonnull)enumerateAudioCaptureDevices; +/** + * + * @type api + * @brief 设置音频采集路由是否跟随系统。 + * @param followed
    + * - true: 跟随。此时,调用 setAudioCaptureDevice:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDevice:} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioCaptureDevice:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDevice:} 进行设置。 + * @list 音频管理 + */ + +- (void)followSystemCaptureDevice:(BOOL)followed; +/** + * + * @type api + * @brief 设置音频播放路由是否跟随系统。 + * @param followed
    + * - true: 跟随。此时,调用 setAudioPlaybackDevice:{@link #ByteRTCAudioDeviceManager#setAudioPlaybackDevice:} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioPlaybackDevice:{@link #ByteRTCAudioDeviceManager#setAudioPlaybackDevice:} 进行设置。 + * @list 音频管理 + */ + +- (void)followSystemPlaybackDevice:(BOOL)followed; +/** + * + * @type api + * @brief 设置音频播放设备。 + * @param deviceID 音频播放设备 ID,可通过 enumerateAudioPlaybackDevices{@link #ByteRTCAudioDeviceManager#enumerateAudioPlaybackDevices} 获取。 + * @return + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 当你调用 followSystemPlaybackDevice:{@link #ByteRTCAudioDeviceManager#followSystemPlaybackDevice:} 设置音频播放设备跟随系统后,将无法调用此接口设置音频播放设备。 + * @list 音频管理 + */ + +- (int)setAudioPlaybackDevice:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 获取当前音频播放设备。 + * @param deviceID 设备 ID + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int)getAudioPlaybackDevice:(NSString * _Nonnull * _Nonnull) deviceID; +/** + * + * @type api + * @brief 设置音频采集设备。 + * @param deviceID 音频采集设备 ID。你可调用 enumerateAudioCaptureDevices{@link #ByteRTCAudioDeviceManager#EnumerateAudioCaptureDevices} 获取可用设备列表。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 当你调用 followSystemCaptureDevice:{@link #ByteRTCAudioDeviceManager#followSystemCaptureDevice:} 设置音频采集设备跟随系统后,将无法调用此接口设置音频采集设备。 + * @list 音频管理 + */ + +- (int)setAudioCaptureDevice:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 获取当前音频采集设备。 + * @param deviceID 音频采集设备 ID。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int)getAudioCaptureDevice:(NSString *_Nonnull * _Nonnull) deviceID; +/** + * + * @type api + * @brief 设置当前音频采集设备静音状态,默认为非静音。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法用于静音整个系统的音频采集。你也可以仅对麦克风采集到的音频信号做静音处理,而不影响媒体播放器的音乐声音,具体参看 muteAudioCapture:{@link #ByteRTCEngine#muteAudioCapture:} 方法说明。 + * - 设该方法为 `true` 静音后仍可通过 setAudioCaptureDeviceVolume:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceVolume:} 调整采集音量,调整后的音量会在取消静音后生效。 + * @list 音频管理 + */ + +- (int) setAudioCaptureDeviceMute:(bool)mute; +/** + * + * @type api + * @brief 获取当前音频采集设备是否静音的信息。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioCaptureDeviceMute:(bool * _Nonnull)mute; +/** + * + * @type api + * @brief 设置当前音频播放设备静音状态,默认为非静音。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) setAudioPlaybackDeviceMute:(bool)mute; +/** + * + * @type api + * @brief 获取当前音频播放设备是否静音的信息。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioPlaybackDeviceMute:(bool * _Nonnull)mute; +/** + * + * @type api + * @brief 设置当前音频采集设备音量 + * @param volume 音频采集设备音量,取值范围为 [0,255]。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功。将影响 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 回调的音量信息。 + * - < 0:方法调用失败 + * @note 调用 setAudioCaptureDeviceMute:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceMute:} 设为 `true` 静音采集设备后的音量调节会在取消静音后生效。 + * @list 音频管理 + */ + +- (int) setAudioCaptureDeviceVolume:(unsigned int)volume; +/** + * + * @type api + * @brief 获取当前音频采集设备音量 + * @param volume 音频采集设备音量,取值范围是 [0,255]
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioCaptureDeviceVolume:(unsigned int * _Nonnull)volume; +/** + * + * @type api + * @brief 设置当前音频播放设备音量 + * @param volume 音频播放设备音量,取值范围为 [0,255]
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) setAudioPlaybackDeviceVolume:(unsigned int)volume; +/** + * + * @type api + * @brief 获取当前音频播放设备音量 + * @param volume 音频播放设备音量,取值范围是 [0,255]
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioPlaybackDeviceVolume:(unsigned int * _Nonnull)volume; +/** + * + * @type api + * @brief 启动音频播放设备测试。
    + * 该方法测试播放设备是否能正常工作。SDK 播放指定的音频文件,测试者如果能听到声音,说明播放设备能正常工作。 + * @param testAudioFilePath 音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。 + * @param interval 音频设备播放测试音量回调的间隔 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法必须在进房前调用,且不可与其它音频设备测试功能同时应用。 + * - 调用 stopAudioPlaybackDeviceTest{@link #ByteRTCAudioDeviceManager#stopAudioPlaybackDeviceTest} 停止测试。 + * @list 音频管理 + */ + +- (int)startAudioPlaybackDeviceTest:(NSString *_Nonnull)testAudioFilePath interval:(int)interval; +/** + * + * @type api + * @brief 停止音频播放设备测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 调用 startAudioPlaybackDeviceTest:interval:{@link #ByteRTCAudioDeviceManager#startAudioPlaybackDeviceTest:interval:} 后,需调用本方法停止测试。 + * @list 音频管理 + */ + +- (int)stopAudioPlaybackDeviceTest; +/** + * + * @hidden(iOS) + * @type api + * @brief 开始音频采集设备和音频播放设备测试。 + * @param interval 测试中会收到 `rtcEngine:onLocalAudioPropertiesReport:` 回调,本参数指定了该周期回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法在进房前后均可调用。且不可与其它音频设备测试功能同时应用。 + * - 调用本接口 30 s 后,采集自动停止,并开始播放采集到的声音。录音播放完毕后,设备测试流程自动结束。你也可以在 30 s 内调用 stopAudioDeviceRecordAndPlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDeviceRecordAndPlayTest} 来停止采集并开始播放此前采集到的声音。 + * - 调用 stopAudioDevicePlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDevicePlayTest} 可以停止音频设备采集和播放测试。 + * - 你不应在测试过程中,调用 `enableAudioPropertiesReport:` 注册音量提示回调。 + * - 该方法仅在本地进行音频设备测试,不涉及网络连接。 + * @list 音频管理 + */ + +- (int)startAudioDeviceRecordTest:(int)interval; +/** + * + * @hidden(iOS) + * @type api + * @brief 停止采集本地音频,并开始播放采集到的声音。录音播放完毕后,设备测试流程结束。
    + * 调用 startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest:} 30s 内调用本接口来停止采集并开始播放此前采集到的声音。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法依赖 rtc 引擎,只有通过成员方法 getAudioDeviceManager{@link #ByteRTCEngine#getAudioDeviceManager} 创建的 ByteRTCAudioDeviceManager,该方法才是有效的 + * - 调用本接口开始播放录音后,可以在播放过程中调用 stopAudioDevicePlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDevicePlayTest} 停止播放。 + * @list 音频管理 + */ + +- (int)stopAudioDeviceRecordAndPlayTest; +/** + * + * @hidden(iOS) + * @type api + * @brief 停止由调用 startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest:} 开始的音频播放设备测试。
    + * 在音频播放设备测试自动结束前,可调用本接口停止音频采集与播放测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法依赖 rtc 引擎,只有通过成员方法 getAudioDeviceManager{@link #ByteRTCEngine#getAudioDeviceManager} 创建的 ByteRTCAudioDeviceManager,该方法才是有效的 + * @list 音频管理 + */ + +- (int)stopAudioDevicePlayTest; +/** + * + * @type api + * @brief 尝试初始化音频播放设备,以检测设备不存在、权限被拒绝/禁用等异常问题。 + * @param deviceID 设备索引号 + * @return 设备状态错误码
    + * - 0: 设备检测结果正常 + * - -1: 接口调用失败 + * - -2: 设备无权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note + * - 该接口需在进房前调用; + * - 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * @list 音频管理 + */ + +- (int)initAudioPlaybackDeviceForTest:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 尝试初始化音频采集设备,以检测设备不存在、权限被拒绝/禁用等异常问题。 + * @param deviceID 设备索引号 + * @return 设备状态错误码
    + * - 0: 设备检测结果正常 + * - -1: 接口调用失败 + * - -2: 设备无权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note + * - 该接口需在进房前调用; + * - 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * @list 音频管理 + */ + +- (int)initAudioCaptureDeviceForTest:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 启动音频采集设备测试。
    + * 该方法测试音频采集设备是否能正常工作。启动测试后,会收到 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 回调上报的音量信息。 + * @param indicationInterval 获取回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。小于 10 毫秒行为未定义。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 该方法必须在进房前调用,且不可与其它音频设备测试功能同时应用。 + * - 你需调用 stopAudioRecordingDeviceTest{@link #ByteRTCAudioDeviceManager#stopAudioRecordingDeviceTest} 停止测试。 + * @list 音频管理 + */ + +- (int)startAudioRecordingDeviceTest:(unsigned int)indicationInterval; +/** + * + * @type api + * @brief 停止音频采集设备测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 调用 startAudioRecordingDeviceTest:{@link #ByteRTCAudioDeviceManager#startAudioRecordingDeviceTest:} 后,需调用本方法停止测试。 + * @list 音频管理 + */ + +- (int)stopAudioRecordingDeviceTest; +/** + * + * @type api + * @brief 开始音频设备回路测试。
    + * 该方法测试音频采集设备和音频播放设备是否能正常工作。一旦测试开始,音频采集设备会采集本地声音并通过音频播放设备播放出来,同时会收到 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:}。 + * @param indicationInterval 收到回调的时间间隔,单位为 ms。建议设置到大于 200 ms。最小不得少于 10 ms。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 该方法必须在进房前调用。且不可与其它音频设备测试功能同时应用。 + * - 你需调用 stopAudioDeviceLoopbackTest{@link #ByteRTCAudioDeviceManager#stopAudioDeviceLoopbackTest} 停止测试。 + * - 该方法仅在本地进行音频设备测试,不涉及网络连接。 + * @list 音频管理 + */ + +- (int)startAudioDeviceLoopbackTest:(unsigned int)indicationInterval; +/** + * + * @type api + * @brief 停止音频设备回路测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 调用 startAudioDeviceLoopbackTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceLoopbackTest:} 后,需调用本方法停止测试。 + * @list 音频管理 + */ + +- (int)stopAudioDeviceLoopbackTest; +@end +/** + * + * @type keytype + * @brief 混音配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEffectPlayerConfig : NSObject +/** + * + * @type keytype + * @brief 混音播放类型,详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType} + */ + +@property(assign, nonatomic) ByteRTCAudioMixingType type; +/** + * + * @brief 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + */ + +@property(assign, nonatomic) NSInteger pitch; +/** + * + * @brief 混音播放次数
    + * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + +@property(assign, nonatomic) NSInteger playCount; +/** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + +@property(assign, nonatomic) NSInteger startPos; +@end +/** + * + * @type keytype + * @brief 混音配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaPlayerConfig : NSObject +/** + * + * @brief 混音播放类型,详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType} + */ + +@property(assign, nonatomic) ByteRTCAudioMixingType type; +/** + * + * @brief 混音播放次数
    + * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + +@property(assign, nonatomic) NSInteger playCount; +/** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + +@property(assign, nonatomic) NSInteger startPos; +/** + * + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress:progress:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerPlayingProgress:progress:} 的间隔。单位毫秒。
    + * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + */ + +@property(assign, nonatomic) NSInteger callbackOnProgressInterval; +/** + * + * @brief 在采集音频数据时,附带本地混音文件播放进度的时间戳。启用此功能会提升远端人声和音频文件混音播放时的同步效果。
    + * - 仅在单个音频文件混音时使用有效。 + * - `true` 时开启此功能,`false` 时关闭此功能,默认为关闭。 + */ + +@property(assign, nonatomic) BOOL syncProgressToRecordFrame; +/** +* +* @brief 是否自动播放。如果不自动播放,调用 start{@link #ByteRTCMediaPlayer#start} 播放音乐文件。默认为 True。 +*/ + +@property(assign, nonatomic) BOOL autoPlay; +@end +/** + * + * @type callback + * @brief 内存播放数据源回调 + * @list Audio Management + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCMediaPlayerCustomSourceProvider +/** + * + * @valid since 3.53 + * @type callback + * @brief 调用 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 接口播放用户传入的内存音频数据时,会触发此回调,用户需要写入音频数据。 + * @param buffer 内存地址。在该地址中写入音频数据,写入音频数据的大小不超过 bufferSize 中填入的数值。支持的音频数据格式有: mp3,aac,m4a,3gp,wav。 + * @param bufferSize 音频数据大小,单位为字节。如果你想停止播放内存音频数据,可在 bufferSize 中填入小于或等于 0 的数,此时 SDK 会停止调用此接口。 + * @return 返回实际读取的音频数据大小。 + * @note 若 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 接口调用失败,请在 buffer 和 bufferSize 两个参数中填入 0。 此时 SDK 会停止调用此接口。 + * @list 混音 + */ + +-(int)onReadData:(uint8_t*_Nonnull) buffer bufferSize:(int)bufferSize; +/** + * + * @valid since 3.53 + * @type callback + * @brief 根据设置好的内存音频数据的读取位置和读取偏移量对音频数据进行偏移,以便 SDK 读取和分析音频数据。
    + * 在调用 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 接口传入内存音频数据,或者调用 setPosition:position:{@link #ByteRTCAudioEffectPlayer#setPosition:position:} 设置了音频数据的起始播放位置后,SDK 会对音频数据进行读取和分析,此时会触发该回调,你需要根据参数中设置的起始读取位置和偏移量进行操作。 + * @param offset 音频数据读取偏移量,单位为字节,取值可正可负。 + * @param whence 音频数据的起始读取位置。参看 ByteRTCMediaPlayerCustomSourceSeekWhence{@link #ByteRTCMediaPlayerCustomSourceSeekWhence} + * @return + * 定位成功,返回偏移后的位置信息,或返回音频数据的大小。
    + * 定位失败,返回 -1。 + * @list 混音 + */ + +-(int64_t)onSeek:(int64_t)offset whence:(ByteRTCMediaPlayerCustomSourceSeekWhence)whence; +@end +/** + * + * @type keytype + * @brief 音频源 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaPlayerCustomSource : NSObject +/** + * + * @type keytype + * @brief 仅使用内存播放时,传入对应的 ByteRTCMediaPlayerCustomSourceProvider{@link #ByteRTCMediaPlayerCustomSourceProvider} 实例。 + */ + +@property(weak, nonatomic) id _Nullable provider; +/** + * + * @type keytype + * @brief 数据源模式,详见 ByteRTCMediaPlayerCustomSourceMode{@link #ByteRTCMediaPlayerCustomSourceMode}。默认为 `push`。 + */ + +@property(assign, nonatomic) ByteRTCMediaPlayerCustomSourceMode mode; +/** + * + * @type keytype + * @brief 数据源类型,详见 ByteRTCMediaPlayerCustomSourceStreamType{@link #ByteRTCMediaPlayerCustomSourceStreamType}。默认为 `raw`。 + */ + +@property(assign, nonatomic) ByteRTCMediaPlayerCustomSourceStreamType type; + +@end +/** + * + * @type keytype + * @brief 音频属性信息提示的相关配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioPropertiesConfig : NSObject +/** + * + * @brief 信息提示间隔,单位:ms
    + * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + +@property(assign, nonatomic) NSInteger interval; +/** + * + * @brief 是否开启音频频谱检测。 + */ + +@property(assign, nonatomic) BOOL enableSpectrum; +/** + * + * @brief 是否开启人声检测 (VAD)。 + */ + +@property(assign, nonatomic) BOOL enableVad; +/** + * + * @brief 音量回调模式。详见 ByteRTCAudioReportMode{@link #ByteRTCAudioReportMode}。 + */ + +@property(assign, nonatomic) ByteRTCAudioReportMode localMainReportMode; +/** + * + * @brief 适用于音频属性信息提示的平滑系数。取值范围是 `(0.0, 1.0]`。
    + * 默认值为 `1.0`,不开启平滑效果;值越小,提示音量平滑效果越明显。如果要开启平滑效果,可以设置为 `0.3`。 + */ + +@property(nonatomic, assign) float smooth; + +/** + * + * @brief rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 中包含音频数据的范围。参看 ByteRTCAudioPropertiesMode{@link #ByteRTCAudioPropertiesMode}。
    + * 默认仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + +@property(assign, nonatomic) ByteRTCAudioPropertiesMode audioReportMode; + +/** + * + * @brief 是否回调本地用户的人声基频。 + */ + +@property(assign, nonatomic) BOOL enableVoicePitch; +@end + +/** + * + * @type keytype + * @brief 音频属性信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioPropertiesInfo : NSObject +/** + * + * @brief 线性音量,与原始音量呈线性关系,数值越大,音量越大。取值范围是:[0,255]。
    + * - [0, 25]:近似无声 + * - [26, 75]:低音量 + * - [76, 204]:中音量 + * - [205, 255]:高音量 + */ + +@property(assign, nonatomic) NSInteger linearVolume; +/** + * + * @brief 非线性音量。由原始音量的对数值转化而来,因此在中低音量时更灵敏,可以用作 Active Speaker(房间内最活跃用户)的识别。取值范围是:[-127,0],单位 dB。
    + * - [-127, -60]:无声 + * - [-59, -40]:低音量 + * - [-39, -20]:中音量 + * - [-19, 0]:高音量 + */ + +@property(assign, nonatomic) NSInteger nonlinearVolume; +/** + * + * @brief 人声检测(VAD)结果
    + * - 1: 检测到人声。 + * - 0: 未检测到人声。 + * - -1: 未开启 VAD。 + */ + +@property(assign, nonatomic) NSInteger vad; +/** + * + * @brief 频谱数组。默认长度为 257。 + */ + +@property(copy, nonatomic) NSArray * _Nonnull spectrum; +/** + * + * @brief 本地用户的人声基频,单位为赫兹。
    + * 同时满足以下两个条件时,返回的值为本地用户的人声基频:
    + * - 调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:},并设置参数 enableVoicePitch 的值为 `true`。 + * - 本地采集的音频中包含本地用户的人声。 + * 其他情况下返回 `0`。 + */ + +@property(assign, nonatomic) NSInteger voicePitch; +@end + +/** + * + * @type keytype + * @brief 本地音频属性信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalAudioPropertiesInfo : NSObject + +/** + * + * @type keytype + * @hidden + * @brief 音频源。预留参数。 + */ + +@property(assign, nonatomic) ByteRTCAudioSource* _Nullable audioSource; +/** + * + * @type keytype + * @brief 音频属性信息,详见 ByteRTCAudioPropertiesInfo{@link #ByteRTCAudioPropertiesInfo} + */ + +@property(strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo; +@end + +/** + * + * @type keytype + * @brief 远端音频属性信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteAudioPropertiesInfo : NSObject +/** + * + * @type keytype + * @brief 远端流的唯一标识 + */ + +@property(nonatomic) NSString *_Nonnull streamId; + +/** + * + * @type keytype + * @brief 远端流详细信息,详见 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + */ + +@property(strong, nonatomic) ByteRTCStreamInfo *_Nonnull streamInfo; + +/** + * + * @type keytype + * @brief 音频属性信息,详见 ByteRTCAudioPropertiesInfo{@link #ByteRTCAudioPropertiesInfo} + */ + +@property(strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo; +@end + +/** + * + * @type keytype + * @brief 本地用户在房间内的位置坐标,需自行建立空间直角坐标系 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCPosition : NSObject +/** + * + * @brief x 坐标 + */ + +@property(nonatomic, assign) float x; +/** + * + * @brief y 坐标 + */ + +@property(nonatomic, assign) float y; +/** + * + * @brief z 坐标 + */ + +@property(nonatomic, assign) float z; +@end + +/** + * + * @type keytype + * @brief 方向朝向信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCOrientation : NSObject +/** + * + * @brief x 坐标 + */ + +@property(nonatomic, assign) float x; +/** + * + * @brief y 坐标 + */ + +@property(nonatomic, assign) float y; +/** + * + * @brief z 坐标 + */ + +@property(nonatomic, assign) float z; +@end + +/** + * + * @type keytype + * @brief 三维朝向信息,三个向量需要两两垂直。参看 ByteRTCOrientation{@link #ByteRTCOrientation}。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCHumanOrientation : NSObject +/** + * + * @brief 正前方朝向,默认值为 {1,0,0},即正前方朝向 x 轴正方向 + */ + +@property(nonatomic, strong) ByteRTCOrientation* _Nonnull forward; +/** + * + * @brief 正右方朝向,默认值为 {0,1,0},即右手朝向 y 轴正方向 + */ + +@property(nonatomic, strong) ByteRTCOrientation* _Nonnull right; +/** + * + * @brief 正上方朝向,默认值为 {0,0,1},即头顶朝向 z 轴正方向 + */ + +@property(nonatomic, strong) ByteRTCOrientation* _Nonnull up; +@end + +/** + * + * @type keytype + * @brief K 歌打分维度。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMulDimSingScoringMode) { + /** + * + * @brief 按照音高进行评分。 + */ + + ByteRTCMulDimSingScoringModeNote = 0 +}; +/** + * + * @type keytype + * @brief 远端音频流精准对齐模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioAlignmentMode) { + /** + * + * @brief 不对齐 + */ + + ByteRTCAudioAlignmentModeOff = 0, + /** + * + * @brief 远端音频流都对齐伴奏进度同步播放 + */ + + ByteRTCAudioAlignmentModeAudioMixing = 1, +}; + +/** + * + * @type keytype + * @hidden + * @brief 实时评分信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSingScoringRealtimeInfo : NSObject + /** + * + * @brief 当前的播放进度。 + */ + +@property(nonatomic, assign) int currentPosition; + /** + * + * @brief 演唱者的音高。 + */ + +@property(nonatomic, assign) int userPitch; + /** + * + * @brief 标准音高。 + */ + +@property(nonatomic, assign) int standardPitch; + /** + * + * @brief 歌词分句索引。 + */ + +@property(nonatomic, assign) int sentenceIndex; + /** + * + * @brief 上一句歌词的评分。 + */ + +@property(nonatomic, assign) int sentenceScore; + /** + * + * @brief 当前演唱的累计分数。 + */ + +@property(nonatomic, assign) int totalScore; + /** + * + * @brief 当前演唱的平均分数。 + */ + +@property(nonatomic, assign) int averageScore; +@end + +/** + * + * @type keytype + * @brief 标准音高数据组。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCStandardPitchInfo : NSObject + /** + * + * @brief 开始时间,单位 ms。 + */ + +@property(nonatomic, assign) int startTime; + /** + * + * @brief 持续时间,单位 ms。 + */ + +@property(nonatomic, assign) int duration; + /** + * + * @brief 音高。 + */ + +@property(nonatomic, assign) int pitch; +@end + +/** + * + * @type keytype + * @hidden + * @brief K 歌评分配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSingScoringConfig : NSObject + /** + * + * @brief 打分维度,详见 ByteRTCMulDimSingScoringMode{@link #ByteRTCMulDimSingScoringMode}。 + */ + +@property(nonatomic, assign) ByteRTCMulDimSingScoringMode mode; + /** + * + * @brief 音频采样率。仅支持 44100 Hz、48000 Hz。 + */ + +@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate; + /** + * + * @brief 歌词文件路径。打分功能仅支持 KRC 歌词文件。 + */ + +@property(nonatomic, copy) NSString *_Nonnull lyricsFilepath; + /** + * + * @brief 歌曲 midi 文件路径。 + */ + +@property(nonatomic, copy) NSString *_Nonnull midiFilepath; +@end + +/** + * + * @type keytype + * @brief 音频文件录制内容来源。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioFrameSource) { + /** + * + * @brief 本地麦克风采集的音频数据。 + */ + + ByteRTCAudioFrameSourceTypeMic = 0, + /** + * + * @brief 远端所有用户混音后的数据 + */ + + ByteRTCAudioFrameSourceTypePlayback = 1, + /** + * + * @brief 本地麦克风和所有远端用户音频流的混音后的数据 + */ + + ByteRTCAudioFrameSourceTypeMixed = 2, +}; +/** + * + * @type keytype + * @brief 音频质量 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioQuality) { + /** + * + * @brief 低音质 + */ + + ByteRTCAudioQualityLow = 0, + /** + * + * @brief 中音质 + */ + + ByteRTCAudioQualityMedium = 1, + /** + * + * @brief 高音质 + */ + + ByteRTCAudioQualityHigh = 2, + /** + * + * @brief 超高音质 + */ + + ByteRTCAudioQualityUltraHigh = 3, +}; +/** + * + * @type keytype + * @brief 音频录制配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioRecordingConfig : NSObject +/** + * + * @brief 录制文件路径。一个有读写权限的绝对路径,包含文件名和文件后缀。 + * @note 录制文件的格式仅支持 .aac 和 .wav。 + */ + +@property(nonatomic, copy) NSString* _Nonnull absoluteFileName; +/** + * + * @brief 录音内容来源,参看 ByteRTCAudioFrameSource{@link #ByteRTCAudioFrameSource}。
    + * 默认为 ByteRTCAudioFrameSourceTypeMixed = 2。 + */ + +@property(nonatomic, assign) ByteRTCAudioFrameSource frameSource; +/** + * + * @brief 录音采样率。参看 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate}。 + */ + +@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate; +/** + * + * @brief 录音音频声道。参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel}。
    + * 如果录制时设置的音频声道数与采集时的音频声道数不同:
    + * - 如果采集的声道数为 1,录制的声道数为 2,那么,录制的音频为经过单声道数据拷贝后的双声道数据,而不是立体声。 + * - 如果采集的声道数为 2,录制的声道数为 1,那么,录制的音频为经过双声道数据混合后的单声道数据。 + */ + +@property(nonatomic, assign) ByteRTCAudioChannel channel; +/** + * + * @brief 录音音质。仅在录制文件格式为 .aac 时可以设置。参看 ByteRTCAudioQuality{@link #ByteRTCAudioQuality}。
    + * 采样率为 32kHz 时,不同音质录制文件(时长为 10min)的大小分别是:
    + * - 低音质:1.2MB; + * - 【默认】中音质:2MB; + * - 高音质:3.75MB; + * - 超高音质:7.5MB。 + */ + +@property(nonatomic, assign) ByteRTCAudioQuality quality; +@end + +/** + * + * @type keytype + * @brief 录音配置 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRecordingState) { + /** + * + * @brief 录制异常 + */ + + ByteRTCAudioRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + ByteRTCAudioRecordingStateProcessing = 1, + /** + * + * @brief 已结束录制,并且录制文件保存成功。 + */ + + ByteRTCAudioRecordingStateSuccess = 2, +}; +/** + * + * @type errorcode + * @brief 音频文件录制的错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRecordingErrorCode) { + /** + * + * @brief 录制正常 + */ + + ByteRTCAudioRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + ByteRTCAudioRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 没有进入房间 + */ + + ByteRTCAudioRecordingErrorNotInRoom = -2, + /** + * + * @brief 录制已经开始 + */ + + ByteRTCAudioRecordingAlreadyStarted = -3, + /** + * + * @brief 录制还未开始 + */ + + ByteRTCAudioRecordingNotStarted = -4, + /** + * + * @brief 录制失败。文件格式不支持。 + */ + + ByteRTCAudioRecordingErrorCodeNotSupport = -5, + /** + * + * @brief 其他异常 + */ + + ByteRTCAudioRecordingErrorCodeOther = -6, +}; +/** + * + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEnhancementConfig: NSObject +/** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceSignaling; +/** + * + * @brief 对音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceAudio; +@end +/** + * + * @type keytype + * @brief 用户在空间音频坐标系里的位置信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCPositionInfo : NSObject +/** + * + * @brief 用户在空间音频坐标系里的位置,需自行建立空间直角坐标系。参看 ByteRTCPosition{@link #ByteRTCPosition}。 + */ + +@property(strong, nonatomic) ByteRTCPosition *_Nonnull position; +/** + * + * @brief 用户在空间音频坐标系里的三维朝向信息。三个向量需要两两垂直。参看 ByteRTCHumanOrientation{@link #ByteRTCHumanOrientation}。 + */ + +@property(strong, nonatomic) ByteRTCHumanOrientation *_Nonnull orientation; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioEffectPlayer.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioEffectPlayer.h new file mode 100644 index 0000000..1f03982 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioEffectPlayer.h @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCAudioEffectPlayer +*/ + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type callback + * @brief ByteRTCAudioEffectPlayer{@link #ByteRTCAudioEffectPlayer} 对应的回调句柄。你必须调用 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:} 完成设置后,才能收到对应回调。 + * @list + */ + +@protocol ByteRTCAudioEffectPlayerEventHandler +/** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param effectId ByteRTCAudioEffectPlayer{@link #ByteRTCAudioEffectPlayer} 的 ID。通过 getAudioEffectPlayer{@link #ByteRTCEngine#getAudioEffectPlayer} 设置。 + * @param state 混音状态。参考 ByteRTCPlayerState{@link #ByteRTCPlayerState}。 + * @param error 错误码。参考 ByteRTCPlayerError{@link #ByteRTCPlayerError}。 + * @list 混音 + */ + +-(void)onAudioEffectPlayerStateChanged:(int)effectId state:(ByteRTCPlayerState)state error:(ByteRTCPlayerError)error; + +@end +/** + * + * @valid since 3.53 + * @type api + * @brief 音效播放器。
    + * 注意:
    + * - 调用 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:} 设置回调句柄以获取相关回调。 + * - 使用混音功能时,你必须通过 [setActive:withOptions:error:](https: + * @list 混音 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEffectPlayer :NSObject +/** + * + * @type api + * @brief 开始播放音效文件。
    + * 可以通过传入不同的 ID 和 filepath 多次调用本方法,以实现同时播放多个音效文件,实现音效叠加。 + * @param effectId 音效 ID。用于标识音效,请保证音效 ID 唯一性。
    + * 如果使用相同的 ID 重复调用本方法后,上一个音效会停止,下一个音效开始,并收到 onAudioEffectPlayerStateChanged:state:error:{@link #ByteRTCAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged:state:error:}。 + * @param filePath 音效文件路径。
    + * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
    + * 推荐的音效文件采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
    + * 不同平台支持的本地音效文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYYYY
    iOS/macOSYYYYYY
    WindowsYYYYYYYY
    + * 不同平台支持的在线音效文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYY
    iOS/macOSYYYY
    WindowsYYYYYYY
    + * @param config 音效配置,详见 ByteRTCAudioEffectPlayerConfig{@link #ByteRTCAudioEffectPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果已经通过 preload:filePath:{@link #ByteRTCAudioEffectPlayer#preload:filePath:} 将文件加载至内存,确保此处的 ID 与 `preload` 设置的 ID 相同。 + * - 开始播放音效文件后,可以调用 stop:{@link #ByteRTCAudioEffectPlayer#stop:} 方法停止播放音效文件。 + * @list 混音 + */ + +-(int)start:(int)effectId filePath:(NSString * _Nullable)filePath config:(ByteRTCAudioEffectPlayerConfig * _Nullable)config; +/** + * + * @type api + * @brief 停止播放音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以调用本方法停止播放音效文件。 + * - 调用本方法停止播放音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + +-(int)stop:(int)effectId; +/** + * + * @type api + * @brief 停止播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以调用本方法停止播放所有音效文件。 + * - 调用本方法停止播放所有音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + +-(int)stopAll; +/** + * + * @type api + * @brief 预加载指定音乐文件到内存中,以避免频繁播放同一文件时的重复加载,减少 CPU 占用。 + * @param effectId 音效 ID。用于标识音效,请保证音效 ID 唯一性。
    + * 如果使用相同的 ID 重复调用本方法,后一次会覆盖前一次。
    + * 如果先调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:},再使用相同的 ID 调用本方法 ,会收到回调 onAudioEffectPlayerStateChanged:state:error:{@link #ByteRTCAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged:state:error:},通知前一个音效停止,然后加载下一个音效。
    + * 调用本方法预加载 A.mp3 后,如果需要使用相同的 ID 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 播放 B.mp3,请先调用 unload:{@link #ByteRTCAudioEffectPlayer#unload:} 卸载 A.mp3 ,否则会报错 AUDIO_MIXING_ERROR_LOAD_CONFLICT。 + * @param filePath 音效文件路径。支持本地文件的 URI、或本地文件的绝对路径。
    + * 预加载的文件长度不得超过 20s。
    + * 不同平台支持的音效文件格式和 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 一致。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 本方法只是预加载指定音效文件,只有调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法才开始播放指定音效文件。 + * - 调用本方法预加载的指定音效文件可以通过 unload:{@link #ByteRTCAudioEffectPlayer#unload:} 卸载。 + * @list 混音 + */ + +-(int)preload:(int)effectId filePath:(NSString * _Nullable)filePath; +/** + * + * @type api + * @brief 卸载指定音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用本方法卸载该文件后,关于当前的混音状态,如果设置了 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:},会收到回调 `onAudioEffectPlayerStateChanged`。 + * @list 混音 + */ + +-(int)unload:(int)effectId; +/** + * + * @type api + * @brief 卸载所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用本方法卸载该文件后,关于当前的混音状态,如果设置了 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:},会收到回调 `onAudioEffectPlayerStateChanged`。 + * @list 混音 + */ + +-(int)unloadAll; +/** + * + * @type api + * @brief 暂停播放音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以通过调用本方法暂停播放音效文件。 + * - 调用本方法暂停播放音效文件后,可调用 resume:{@link #ByteRTCAudioEffectPlayer#resume:} 方法恢复播放。 + * @list 混音 + */ + +-(int)pause:(int)effectId; +/** + * + * @type api + * @brief 暂停播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以通过调用本方法暂停播放所有音效文件。 + * - 调用本方法暂停播放所有音效文件后,可调用 resumeAll{@link #ByteRTCAudioEffectPlayer#resumeAll} 方法恢复所有播放。 + * @list 混音 + */ + +-(int)pauseAll; +/** + * + * @type api + * @brief 恢复播放音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用 pause:{@link #ByteRTCAudioEffectPlayer#pause:} 方法暂停播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + +-(int)resume:(int)effectId; +/** + * + * @type api + * @brief 恢复播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用 pauseAll{@link #ByteRTCAudioEffectPlayer#pauseAll} 方法暂停所有正在播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + +-(int)resumeAll; +/** + * + * @type api + * @brief 设置音效文件的起始播放位置。 + * @param effectId 音效 ID + * @param position 音效文件起始播放位置,单位为毫秒。
    + * 你可以通过 getDuration:{@link #ByteRTCAudioEffectPlayer#getDuration:} 获取音效文件总时长,position 的值应小于音效文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)setPosition:(int)effectId position:(int)position; +/** + * + * @type api + * @brief 获取音效文件播放进度。 + * @param effectId 音效 ID + * @return + * - >0: 成功, 音效文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)getPosition:(int)effectId; +/** + * + * @type api + * @brief 调节指定音效的音量大小,包括音效文件和 PCM 音频。 + * @param effectId 音效 ID + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)setVolume:(int)effectId volume:(int)volume; +/** + * + * @type api + * @brief 设置所有音效的音量大小,包括音效文件和 PCM 音效。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该接口的优先级低于 setVolume:volume:{@link #ByteRTCAudioEffectPlayer#setVolume:volume:},即通过 `setVolume` 单独设置了音量的音效 ID,不受该接口设置的影响。 + * @list 混音 + */ + +-(int)setVolumeAll:(int)volume; +/** + * + * @type api + * @brief 获取当前音量。 + * @param effectId 音效 ID + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)getVolume:(int)effectId; +/** + * + * @type api + * @brief 获取音效文件时长。 + * @param effectId 音效 ID + * @return + * - >0: 成功, 音效文件时长,单位为毫秒。 + * - < 0: 失败 + * @note 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)getDuration:(int)effectId; +/** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 ByteRTCAudioEffectPlayerEventHandler{@link #ByteRTCAudioEffectPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + +-(int)setEventHandler:(_Nullable id)handler; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCDefines.h new file mode 100644 index 0000000..cfc997f --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCDefines.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC RTC Defines +*/ + +#import "ByteRTCRtsDefines.h" +#import "ByteRTCMediaDefines.h" +#import "ByteRTCAudioDefines.h" +#import "ByteRTCVideoDefines.h" diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCHttpClientProtocol.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCHttpClientProtocol.h new file mode 100644 index 0000000..e2ed273 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCHttpClientProtocol.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC HTTP Client Protocol +*/ + +#import +/** + * + * @hidden for internal use only + * @type api + * @list 引擎管理 + */ + +@protocol ByteRTCHttpClientProtocol + +@required +/** + * + * @type api + * @brief 需要实现的 HTTP 异步 GET 接口。 + * @param url GET 请求地址。 + * @param timeout 超时时间。 + * @param callback GET 请求结果回调函数。 + * @list 引擎管理 + */ + +- (void)getAsync:(NSString * _Nonnull)url timeoutMillisecond:(int)timeout + withCallback:(void(^ _Nullable)(int code, NSString* _Nullable data))callback; +/** + * + * @type api + * @brief 需要实现的 HTTP 异步 POST 接口。 + * @param url POST 请求地址。 + * @param content POST 请求的内容。 + * @param timeout 超时时间。 + * @param callback POST 请求结果回调函数。 + * @list 引擎管理 + */ + +- (void)postAsync:(NSString * _Nonnull)url content:(NSString * _Nullable)content timeoutMillisecond:(int)timeout + withCallback:(void(^ _Nullable)(int code, NSString* _Nullable data))callback; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVDefines.h new file mode 100644 index 0000000..c31fa97 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVDefines.h @@ -0,0 +1,573 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCRtsDefines +*/ + +#import "ByteRTCRtsDefines.h" + +/** + * + * @type keytype + * @brief 歌曲过滤方式。 + */ + +typedef NS_OPTIONS(NSUInteger, ByteRTCMusicFilterType) { + /** + * + * @brief 不过滤。 + */ + + ByteRTCMusicFilterTypeNone = 0, + /** + * + * @brief 过滤没有歌词的歌曲。 + */ + + ByteRTCMusicFilterTypeWithoutLyric = 1 << 0, + /** + * + * @brief 过滤不支持打分的歌曲。 + */ + + ByteRTCMusicFilterTypeUnsupportedScore = 1 << 1, + /** + * + * @brief 过滤不支持伴唱切换的歌曲。 + */ + + ByteRTCMusicFilterTypeUnsupportedAccopmay = 1 << 2, + /** + * + * @brief 过滤没有高潮片段的歌曲。 + */ + + ByteRTCMusicFilterTypeUnsupportedClimx = 1 << 3, +}; + +/** + * + * @type keytype + * @brief 音乐播放状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayState) { + /** + * + * @brief 播放中。 + */ + + ByteRTCPlayStatePlaying = 1, + /** + * + * @brief 暂停中。 + */ + + ByteRTCPlayStatePaused = 2, + /** + * + * @brief 已停止。 + */ + + ByteRTCPlayStateStoped = 3, + /** + * + * @brief 播放失败。 + */ + + ByteRTCPlayStateFailed = 4, + /** + * + * @brief 播放结束。 + */ + + ByteRTCPlayStateFinished = 5, +}; + +/** + * + * @type keytype + * @brief 原唱伴唱类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioTrackType) { + /** + * + * @brief 播放原唱。 + */ + + ByteRTCAudioTrackTypeOriginal = 1, + /** + * + * @brief 播放伴唱。 + */ + + ByteRTCAudioTrackTypeAccompy = 2, +}; + +/** + * + * @type keytype + * @brief 音乐播放类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioPlayType) { + /** + * + * @brief 仅本地播放。 + */ + + ByteRTCAudioPlayTypeLocal = 0, + /** + * + * @brief 仅远端播放。 + */ + + ByteRTCAudioPlayTypeRemote = 1, + /** + * + * @brief 本地、远端同时播放。 + */ + + ByteRTCAudioPlayTypeLocalAndRemote = 2, +}; + +/** + * + * @type keytype + * @brief 歌词格式类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLyricStatus) { + /** + * + * @brief 无歌词。 + */ + + ByteRTCLyricStatusNone = 0, + /** + * + * @brief KRC 歌词。 + */ + + ByteRTCLyricStatusKRC = 1, + /** + * + * @brief LRC 歌词。 + */ + + ByteRTCLyricStatusLRC = 2, + /** + * + * @brief KRC 歌词和 LRC 歌词均有。 + */ + + ByteRTCLyricStatusKRCAndLRC = 3, +}; + +/** + * + * @type keytype + * @brief 下载文件类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCDownloadFileType) { + /** + * + * @brief 音频文件。 + */ + + ByteRTCDownloadFileTypeMusic = 1, + /** + * + * @brief KRC 歌词文件。 + */ + + ByteRTCDownloadFileTypeKRC = 2, + /** + * + * @brief LRC 歌词文件。 + */ + + ByteRTCDownloadFileTypeLRC = 3, + /** + * + * @brief MIDI 文件。 + */ + + ByteRTCDownloadFileTypeMIDI = 4, +}; + +/** + * + * @type keytype + * @brief 歌词文件类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCDownloadLyricType) { + /** + * + * @brief KRC 歌词文件。 + */ + + ByteRTCDownloadLyricTypeKRC = 0, + /** + * + * @brief LRC 歌词文件。 + */ + + ByteRTCDownloadLyricTypeLRC = 1, +}; + +/** + * + * @type errorcode + * @brief KTV 错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCKTVErrorCode) { + /** + * + * @brief 成功。 + */ + + ByteRTCKTVErrorCodeOK = 0, + /** + * + * @brief AppID 异常。 + */ + + ByteRTCKTVErrorCodeAppidInValid = -3000, + /** + * + * @brief 非法参数,传入的参数不正确。 + */ + + ByteRTCKTVErrorCodeParasInValid = -3001, + /** + * + * @brief 获取歌曲资源失败。 + */ + + ByteRTCKTVErrorCodeGetMusicFailed = -3002, + /** + * + * @brief 获取歌词失败。 + */ + + ByteRTCKTVErrorCodeGetLyricFailed = -3003, + /** + * + * @brief 歌曲下架。 + */ + + ByteRTCKTVErrorCodeMusicTakedown = -3004, + /** + * + * @brief 歌曲文件下载失败。 + */ + + ByteRTCKTVErrorCodeMusicDownload = -3005, + /** + * + * @brief MIDI 文件下载失败。 + */ + + ByteRTCKTVErrorCodeMidiDownloadFailed = -3006, + /** + * + * @brief 系统繁忙。 + */ + + ByteRTCKTVErrorCodeSystemBusy = -3007, + /** + * + * @brief 网络异常。 + */ + + ByteRTCKTVErrorCodeNetwork = -3008, + /** + * + * @brief KTV 功能未加入房间。 + */ + + ByteRTCKTVErrorCodeNotJoinRoom = -3009, + /** + * + * @brief 解析数据失败。 + */ + + ByteRTCKTVErrorCodeParseData = -3010, + /** + * + * @hidden + * @deprecated 从 353 开始 + * @brief 下载失败。 + */ + + ByteRTCKTVErrorCodeDownload = -3011, + /** + * + * @brief 已在下载中。 + */ + + ByteRTCKTVErrorCodeDownloading = -3012, + /** + * + * @brief 内部错误,联系技术支持人员。 + */ + + ByteRTCKTVErrorCodeInternal = -3013, + /** + * + * @brief 下载失败,磁盘空间不足。清除缓存后重试。 + */ + + ByteRTCKTVErrorCodeInsufficientDiskSpace = -3014, + /** + * + * @brief 下载失败,音乐文件解密失败,联系技术支持人员。 + */ + + ByteRTCKTVErrorCodeMusicDecryptionFailed = -3015, + /** + * + * @brief 下载失败,音乐文件重命名失败,请重试。 + */ + + ByteRTCKTVErrorCodeFileRenameFailed = -3016, + /** + * + * @brief 下载失败,下载超时,请重试。 + */ + + ByteRTCKTVErrorCodeDownloadTimeOut = -3017, + /** + * + * @brief 清除缓存失败,可能原因是文件被占用或者系统异常,请重试。 + */ + + ByteRTCKTVErrorCodeClearCacheFailed = -3018, + /** + * + * @brief 取消下载。 + */ + + ByteRTCKTVErrorCodeDownloadCanceled = -3019 +}; + +/** + * + * @type errorcode + * @brief KTV 播放器错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCKTVPlayerErrorCode) { + /** + * + * @brief 成功。 + */ + + ByteRTCKTVPlayerErrorCodeOK = 0, + /** + * + * @brief 播放错误,请下载后播放。 + */ + + ByteRTCKTVPlayerErrorCodeFileNotExist = -3020, + /** + * + * @brief 播放错误,请确认文件播放格式。 + */ + + ByteRTCKTVPlayerErrorCodeFileError = -3021, + /** + * + * @brief 播放错误,未进入房间。 + */ + + ByteRTCKTVPlayerErrorCodeNotJoinRoom = -3022, + /** + * + * @brief 参数错误。 + */ + + ByteRTCKTVPlayerErrorCodeParam = -3023, + /** + * + * @brief 播放失败,找不到文件或文件打开失败。 + */ + + ByteRTCKTVPlayerErrorCodeStartError = -3024, + /** + * + * @brief 混音 ID 异常。 + */ + + ByteRTCKTVPlayerErrorCodeMixIdError = -3025, + /** + * + * @brief 设置播放位置出错。 + */ + + ByteRTCKTVPlayerErrorCodePositionError = -3026, + /** + * + * @brief 音量参数不合法,可设置的取值范围为 [0,400]。 + */ + + ByteRTCKTVPlayerErrorCodeAudioVolumeError = -3027, + /** + * + * @brief 不支持此混音类型。 + */ + + ByteRTCKTVPlayerErrorCodeTypeError = -3028, + /** + * + * @brief 音调文件不合法。 + */ + + ByteRTCKTVPlayerErrorCodePitchError = -3029, + /** + * + * @brief 音轨不合法。 + */ + + ByteRTCKTVPlayerErrorCodeAudioTrackError = -3030, + /** + * + * @brief 混音启动中。 + */ + + ByteRTCKTVPlayerErrorCodeStartingError = -3031, +}; + +/** + * + * @type keytype + * @brief 歌曲数据。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMusicInfo : NSObject +/** + * + * @brief 音乐 ID。 + */ + +@property (nonatomic, copy) NSString * _Nonnull musicId; +/** + * + * @brief 音乐名称。 + */ + +@property (nonatomic, copy) NSString * _Nonnull musicName; +/** + * + * @brief 歌手。 + */ + +@property (nonatomic, copy) NSString * _Nonnull singer; +/** + * + * @brief 版权商 ID。 + */ + +@property (nonatomic, copy) NSString * _Nonnull vendorId; +/** + * + * @brief 版权商名称。 + */ + +@property (nonatomic, copy) NSString * _Nonnull vendorName; +/** + * + * @brief 最新更新时间戳,单位为毫秒。 + */ + +@property (nonatomic, assign) int64_t updateTimestamp; +/** + * + * @brief 封面地址。 + */ + +@property (nonatomic, copy) NSString * _Nonnull posterUrl; +/** + * + * @brief 歌词格式类型,参看 ByteRTCLyricStatus{@link #ByteRTCLyricStatus}。 + */ + +@property (nonatomic, assign) ByteRTCLyricStatus lyricStatus; +/** + * + * @brief 歌曲长度,单位为毫秒。 + */ + +@property (nonatomic, assign) int duration; +/** + * + * @brief 歌曲是否支持打分。 + */ + +@property (nonatomic, assign) BOOL enableScore; +/** + * + * @brief 歌曲高潮片段开始时间,单位为毫秒。 + */ + +@property (nonatomic, assign) int climaxStartTime; +/** + * + * @brief 歌曲高潮片段停止时间,单位为毫秒。 + */ + +@property (nonatomic, assign) int climaxEndTime; +@end + +/** + * + * @type keytype + * @brief 热榜歌曲数据。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCHotMusicInfo : NSObject +/** + * + * @brief 热榜名称。 + */ + +@property (nonatomic, copy) NSString * _Nullable hotName; +/** + * + * @brief 歌曲数据,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + */ + +@property (nonatomic, copy) NSArray * _Nullable musics; +@end + +/** + * + * @type keytype + * @brief 歌曲下载信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCDownloadResult : NSObject +/** + * + * @brief 音乐 ID。 + */ + +@property (nonatomic, copy) NSString * _Nonnull musicId; +/** + * + * @brief 下载文件类型,参看 ByteRTCDownloadFileType{@link #ByteRTCDownloadFileType}。 + */ + +@property (nonatomic, assign) ByteRTCDownloadFileType fileType; +/** + * + * @brief 文件存放路径。 + */ + +@property (nonatomic, copy) NSString * _Nullable filePath; + +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManager.h new file mode 100644 index 0000000..46c8005 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManager.h @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVManager +*/ + +#import +#import "ByteRTCKTVDefines.h" +@class ByteRTCKTVManager; +@class ByteRTCKTVPlayer; + +NS_ASSUME_NONNULL_BEGIN +/** + * + * @type callback + * @brief KTV 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCKTVManagerDelegate +@optional +/** + * + * @type callback + * @brief 歌曲列表回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param musics 歌曲数据数组,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + * @param totalSize 数据条目总数。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onMusicListResult:(NSArray * _Nullable)musics totalSize:(int)totalSize errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 搜索歌曲结果回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param musics 歌曲数据数组,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + * @param totalSize 数据条目总数。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onSearchMusicResult:(NSArray * _Nullable)musics totalSize:(int)totalSize errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 热榜歌曲结果回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param hotMusicInfos 热榜歌曲数据数组,参看 ByteRTCHotMusicInfo{@link #ByteRTCHotMusicInfo}。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onHotMusicResult:(NSArray * _Nullable)hotMusicInfos errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 歌曲详细信息回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param music 歌曲数据,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onMusicDetailResult:(ByteRTCMusicInfo * _Nullable)music errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 下载成功回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param downloadId 下载任务 ID。 + * @param result 下载信息,参看 ByteRTCDownloadResult{@link #ByteRTCDownloadResult}。 + * @list 在线 KTV + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onDownloadSuccess:(int)downloadId downloadResult:(ByteRTCDownloadResult *)result; +/** + * + * @type callback + * @brief 下载失败回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param downloadId 下载任务 ID。 + * @param errorCode 错误码,参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list Online Karaoke + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onDownloadFailed:(int)downloadId errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 歌曲文件下载进度回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param downloadId 下载任务 ID。 + * @param downloadPercentage 下载进度百分比,取值范围 [0,100]。 + * @list 在线 KTV + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onDownloadMusicProgress:(int)downloadId progress:(int)downloadPercentage; +/** + * + * @type callback + * @brief 清理文件缓存结果回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param errorCode 错误码,非 0 为失败,参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list Online Karaoke + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onClearCacheResult:(ByteRTCKTVErrorCode)errorCode; +@end +/** + * + * @type api + * @brief KTV 管理接口。 + * @list Online Karaoke + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCKTVManager : NSObject + +@property(nonatomic, weak) id delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 获取歌曲列表。 + * @param pageNumber 页码,默认从 1 开始。 + * @param pageSize 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filterType 歌曲过滤方式,参看 ByteRTCMusicFilterType{@link #ByteRTCMusicFilterType}。多个过滤方式可以按位或组合。 + * @note 调用接口后,你会收到 ktvManager:onMusicListResult:totalSize:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onMusicListResult:totalSize:errorCode:} 回调歌曲列表。 + * @list 在线 KTV + */ + +- (void)getMusicList:(int)pageNumber pageSize:(int)pageSize filterType:(ByteRTCMusicFilterType)filterType; +/** + * + * @type api + * @brief 根据关键词搜索歌曲。 + * @param keyWord 关键词,字符串长度最大为 20 个字符。 + * @param pageNumber 页码,默认从 1 开始。 + * @param pageSize 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filterType 歌曲过滤方式,参看 ByteRTCMusicFilterType{@link #ByteRTCMusicFilterType}。多个过滤方式可以按位或组合。 + * @note 调用接口后,你会收到 ktvManager:onSearchMusicResult:totalSize:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onSearchMusicResult:totalSize:errorCode:} 回调歌曲列表。 + * @list 在线 KTV + */ + +- (void)searchMusic:(NSString * _Nonnull)keyWord pageNumber:(int)pageNumber pageSize:(int)pageSize filterType:(ByteRTCMusicFilterType)filterType; +/** + * + * @type api + * @brief 指定歌曲榜单,并获取其歌曲列表。 + * @param customHotlistId 榜单 ID 列表。
    + * 默认榜单 ID 有:`ContentCenter` 和 `Project`,分别是火山内容中心热歌榜和项目热歌榜。如果你需要其他榜单,请联系技术支持人员。 + * @param filterType 歌曲过滤方式,参看 ByteRTCMusicFilterType{@link #ByteRTCMusicFilterType}。多个过滤方式可以按位或组合。 + * @note 调用接口后,你会收到 ktvManager:onHotMusicResult:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onHotMusicResult:errorCode:} 回调歌曲列表。 + * @list 在线 KTV + */ + +- (void)getHotMusic:(NSArray *_Nullable)customHotlistId filterType:(ByteRTCMusicFilterType)filterType; +/** + * + * @type api + * @brief 获取音乐详细信息。 + * @param musicId 音乐 ID。 + * @note 调用接口后,你会收到 ktvManager:onMusicDetailResult:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onMusicDetailResult:errorCode:} 回调。 + * @list 在线 KTV + */ + +- (void)getMusicDetail:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 下载音乐。 + * @param musicId 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若音乐下载成功,你会收到 ktvManager:onDownloadSuccess:downloadResult:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadSuccess:downloadResult:} 回调。 + * - 若音乐下载失败,你会收到 ktvManager:onDownloadFailed:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadFailed:errorCode:} 回调。 + * - 音乐下载进度更新时,你会收到 ktvManager:onDownloadMusicProgress:progress:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadMusicProgress:progress:} 回调。 + * @list 在线 KTV + */ + +- (int)downloadMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 下载歌词。 + * @param musicId 音乐 ID。 + * @param lyricType 歌词文件类型,参看 ByteRTCDownloadLyricType{@link #ByteRTCDownloadLyricType}。 + * @return 下载任务 ID。 + * @note + * - 若歌词下载成功,你会收到 ktvManager:onDownloadSuccess:downloadResult:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadSuccess:downloadResult:} 回调。 + * - 若歌词下载失败,你会收到 ktvManager:onDownloadFailed:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadFailed:errorCode:} 回调。 + * @list 在线 KTV + */ + +- (int)downloadLyric:(NSString * _Nonnull)musicId lyricType:(ByteRTCDownloadLyricType)lyricType; +/** + * + * @type api + * @brief 下载 MIDI 文件。 + * @param musicId 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若文件下载成功,你会收到 ktvManager:onDownloadSuccess:downloadResult:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadSuccess:downloadResult:} 回调。 + * - 若文件下载失败,你会收到 ktvManager:onDownloadFailed:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadFailed:errorCode:} 回调。 + * @list 在线 KTV + */ + +- (int)downloadMidi:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 取消下载任务。 + * @param downloadId 下载任务 ID。 + * @list 在线 KTV + */ + +- (void)cancelDownload:(int)downloadId; +/** + * + * @type api + * @brief 清除当前音乐缓存文件,包括音乐音频和歌词。 + * @list 在线 KTV + */ + +- (void)clearCache; +/** + * + * @type api + * @brief 设置歌曲文件最大占用的本地缓存。 + * @param maxCacheSizeMB 本地缓存,单位 MB。
    + * 设置值小于等于 0 时,使用默认值 1024 MB。 + * @list 在线 KTV + */ + +- (void)setMaxCacheSize:(int)maxCacheSizeMB; +/** + * + * @type api + * @brief 获取 KTV 播放器。 + * @return KTV 播放器接口,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 + * @list 在线 KTV + */ + +- (ByteRTCKTVPlayer * _Nullable)getKTVPlayer; + + +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManagerInternal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManagerInternal.h new file mode 100644 index 0000000..930ece1 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManagerInternal.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVManager +*/ + +@interface ByteRTCKTVManager () + +- (instancetype)initWithKTVManager:(bytertc::IKTVManager *)ktvManager; + +- (void)destroyResourceInternal; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayer.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayer.h new file mode 100644 index 0000000..abc500c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayer.h @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVPlayer +*/ + +#import +#import "ByteRTCKTVDefines.h" +@class ByteRTCKTVPlayer; + +NS_ASSUME_NONNULL_BEGIN +/** + * + * @type callback + * @brief KTV 播放器回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCKTVPlayerDelegate +/** + * + * @type callback + * @brief 音乐播放进度回调。 + * @param ktvPlayer 当前 ktvPlayer 对象,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 + * @param musicId 音乐 ID。 + * @param progress 音乐播放进度,单位为毫秒。 + * @list 在线 KTV + */ + +- (void)ktvPlayer:(ByteRTCKTVPlayer *)ktvPlayer onPlayProgress:(NSString *)musicId progress:(int64_t)progress; +/** + * + * @type callback + * @brief 音乐播放状态改变回调。 + * @param ktvPlayer 当前 ktvPlayer 对象,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 + * @param musicId 音乐 ID。 + * @param state 音乐播放状态,参看 ByteRTCPlayState{@link #ByteRTCPlayState}。 + * @param error 错误码,参看 ByteRTCKTVPlayerErrorCode{@link #ByteRTCKTVPlayerErrorCode}。 + * @note + * 此回调被触发的时机汇总如下:
    + * - 调用 playMusic:audioTrackType:audioPlayType:{@link #ByteRTCKTVPlayer#playMusic:audioTrackType:audioPlayType:} 成功后,会触发 playState 值为 ByteRTCPlayStatePlaying 的回调;否则会触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 使用相同的音乐 ID 重复调用 playMusic:audioTrackType:audioPlayType:{@link #ByteRTCKTVPlayer#playMusic:audioTrackType:audioPlayType:} 后,后一次播放会覆盖前一次,且会触发 playState 值为 ByteRTCPlayStatePlaying 的回调,表示后一次音乐播放已开始。 + * - 调用 pauseMusic:{@link #ByteRTCKTVPlayer#pauseMusic:} 方法暂停播放成功后,会触发 playState 值为 ByteRTCPlayStatePaused 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 调用 resumeMusic:{@link #ByteRTCKTVPlayer#resumeMusic:} 方法恢复播放成功后,会触发 playState 值为 ByteRTCPlayStatePlaying 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 调用 stopMusic:{@link #ByteRTCKTVPlayer#stopMusic:} 方法停止播放成功后,会触发 playState 值为 ByteRTCPlayStateStoped 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 音乐播放结束会触发 playState 值为 ByteRTCPlayStateFinished 的回调。 + * @list Online Karaoke + */ + +- (void)ktvPlayer:(ByteRTCKTVPlayer *)ktvPlayer onPlayStateChanged:(NSString *)musicId state:(ByteRTCPlayState)state error:(ByteRTCKTVPlayerErrorCode)error; +@end +/** + * + * @type api + * @brief KTV 播放器接口。 + * @list Online Karaoke + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCKTVPlayer : NSObject + +@property(nonatomic, weak) id delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 播放歌曲。 + * @param musicId 音乐 ID。
    + * 若同一 musicId 的歌曲正在播放,再次调用接口会从开始位置重新播放。若 musicId 对应的音频文件不存在会触发报错。 + * @param trackType 原唱伴唱类型,参看 ByteRTCAudioTrackType{@link #ByteRTCAudioTrackType}。 + * @param playType 音乐播放类型。参看 ByteRTCAudioPlayType{@link #ByteRTCAudioPlayType}。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * - 若音乐文件不存在,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3020,playState 为 4。 + * @list 在线 KTV + */ + +- (void)playMusic:(NSString * _Nonnull)musicId audioTrackType:(ByteRTCAudioTrackType)trackType audioPlayType:(ByteRTCAudioPlayType)playType; +/** + * + * @type api + * @brief 暂停播放歌曲。 + * @param musicId 音乐 ID。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)pauseMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 继续播放歌曲。 + * @param musicId 音乐 ID。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)resumeMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 停止播放歌曲。 + * @param musicId 音乐 ID。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)stopMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param musicId 音乐 ID。 + * @param position 音乐起始位置,单位为毫秒,取值小于音乐文件总时长。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)seekMusic:(NSString * _Nonnull)musicId position:(int)position; +/** + * + * @type api + * @brief 设置歌曲播放音量,只能在开始播放后进行设置。 + * @param musicId 音乐 ID。 + * @param volume 歌曲播放音量,调节范围:[0,400]。
    + * - 0:静音。 + * - 100:原始音量。 + * - 400: 原始音量的 4 倍(自带溢出保护)。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的音量大于 400,则按最大值 400 进行调整;若设置的音量小于 0,则按最小值 0 进行调整。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)setMusicVolume:(NSString * _Nonnull)musicId volume:(int)volume; +/** + * + * @type api + * @brief 切换歌曲原唱伴唱。 + * @param musicId 音乐 ID。 + * @note 调用本接口时音乐必须处于播放中状态。 + * @list 在线 KTV + */ + +- (void)switchAudioTrackType:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 对播放中的音乐设置升降调信息。 + * @param musicId 音乐 ID。 + * @param pitch 相对于音乐文件原始音调的升高/降低值,取值范围 [-12,12],默认值为 0,即不做调整。
    + * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的 pitch 大于 12,则按最大值 12 进行调整;若设置的 pitch 小于 –12,则按最小值 –12 进行调整。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)setMusicPitch:(NSString * _Nonnull)musicId pitch:(int)pitch; + +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayerInternal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayerInternal.h new file mode 100644 index 0000000..f7a2e5a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayerInternal.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVPlayer +*/ + +@interface ByteRTCKTVPlayer () + +- (instancetype)initWithKTVPlayer:(bytertc::IKTVPlayer *)ktvPlayer; + +- (void)destroyResourceInternal; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaDefines.h new file mode 100644 index 0000000..2d213fc --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaDefines.h @@ -0,0 +1,4989 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Common Defines +*/ + +#import "ByteRTCRtsDefines.h" +/** + * + * @type keytype + * @brief 方法调用结果。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCReturnStatus) { + /** + * + * @brief 成功。 + */ + + ByteRTCReturnStatusSuccess = 0, + /** + * + * @brief 失败。 + */ + + ByteRTCReturnStatusFailure = -1, + /** + * + * @brief 参数错误。 + */ + + ByteRTCReturnStatusParameterErr = -2, + /** + * + * @brief 接口状态错误。 + */ + + ByteRTCReturnStatusWrongState = -3, + /** + * + * @brief 失败,用户已在房间内。 + */ + + ByteRTCReturnStatusHasInRoom = -4, + /** + * + * @brief 失败,用户已登录。 + */ + + ByteRTCReturnStatusHasInLogin = -5, + /** + * + * @brief 失败,用户已经在进行通话回路测试中。 + */ + + ByteRTCReturnStatusHasInEchoTest = -6, + /** + * + * @brief 失败,音视频均未采集。 + */ + + ByteRTCReturnStatusNeitherVideoNorAudio = -7, + /** + * + * @brief 失败,该 roomId 已被使用。 + */ + + ByteRTCReturnStatusRoomIdInUse = -8, + /** + * + * @brief 失败,屏幕流不支持。 + */ + + ByteRTCReturnStatusScreenNotSupport = -9, + /** + * + * @brief 失败,不支持该操作。 + */ + + ByteRTCReturnStatusNotSupport = -10, + /** + * + * @brief 失败,资源已占用。 + */ + + ByteRTCReturnStatusResourceOverflow = -11, + /** + * + * @brief 失败,没有音频帧。 + */ + + ByteRTCReturnStatusAudioNoFrame = -101, + /** + * + * @brief 失败,未实现。 + */ + + ByteRTCReturnStatusAudioNotImplemented = -102, + /** + * + * @brief 失败,采集设备无麦克风权限,尝试初始化设备失败。 + */ + + ByteRTCReturnStatusAudioNoPermission = -103, + /** + * + * @brief 失败,设备不存在。当前没有设备或设备被移除时返回该值。 + */ + + ByteRTCReturnStatusAudioDeviceNotExists = -104, + /** + * + * @brief 失败,设备音频格式不支持。 + */ + + ByteRTCReturnStatusAudioDeviceFormatNotSupport = -105, + /** + * + * @brief 失败,系统无可用设备。 + */ + + ByteRTCReturnStatusAudioDeviceNoDevice = -106, + /** + * + * @brief 失败,当前设备不可用,需更换设备。 + */ + + ByteRTCReturnStatusAudioDeviceCannotUse = -107, + /** + * + * @brief 系统错误,设备初始化失败。 + */ + + ByteRTCReturnStatusAudioDeviceInitFailed = -108, + /** + * + * @brief 系统错误,设备开启失败。 + */ + + ByteRTCReturnStatusAudioDeviceStartFailed = -109, + /** + * + * @hidden(iOS) + * @brief 暂不支持指定音频进程采集,采集失败。 + */ + + ByteRTCReturnStatusAudioDeviceProcessNotExist = -110, + /** + * + * @brief 失败。底层未初始化,engine 无效。 + */ + + ByteRTCReturnStatusNativeInValid = -201, +}; + +/** + * + * @type keytype + * @brief 房间内远端流移除原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCStreamRemoveReason) { + /** + * + * @brief 远端用户停止发布流。 + */ + + ByteRTCStreamRemoveReasonUnpublish = 0, + /** + * + * @brief 远端用户发布流失败。 + */ + + ByteRTCStreamRemoveReasonPublishFailed = 1, + /** + * + * @brief 媒体服务器 10s 没收到客户端的媒体数据。 + */ + + ByteRTCStreamRemoveReasonKeepLiveFailed = 2, + /** + * + * @brief 远端用户断网。 + */ + + ByteRTCStreamRemoveReasonClientDisconnected = 3, + /** + * + * @brief 远端用户重新发布流。 + */ + + ByteRTCStreamRemoveReasonRepublish = 4, + /** + * + * @brief 其他原因。 + */ + + ByteRTCStreamRemoveReasonOther = 5, + /** + * + * @brief 远端用户 Token 发布权限过期。 + */ + + ByteRTCStreamRemoveReasonPublishPrivilegeExpired = 6, +}; + +/** + * + * @type keytype + * @brief 房间模式
    + * 根据所需场景,选择合适的房间模式,应用不同的音视频算法、视频参数和网络配置
    + * 调用 `setAudioProfile` 改变音频参数配置 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomProfile) { + /** + * + * @brief 默认场景,通用模式
    + * 与 `ByteRTCRoomProfileMeeting = 16` 配置相同。
    + * 你可以联系技术支持更换默认配置参数。 + */ + + ByteRTCRoomProfileCommunication = 0, + /** + * + * @brief 游戏语音模式,低功耗、低流量消耗。
    + * 低端机在此模式下运行时,进行了额外的性能优化:
    + * - 部分低端机型配置编码帧长 40/60 + * - 部分低端机型关闭软件 3A 音频处理 + * 增强对 iOS 其他屏幕录制进行的兼容性,避免音频录制被 RTC 打断。 + */ + + ByteRTCRoomProfileGame = 2, + /** + * + * @brief 云游戏模式。
    + * 如果你的游戏场景需要低延迟的配置,使用此设置。
    + * 此设置下,弱网抗性较差。 + */ + + ByteRTCRoomProfileCloudGame = 3, + /** + * + * @brief 云渲染模式。超低延时配置。
    + * 如果你的应用并非游戏但又对延时要求较高时,选用此模式
    + * 该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。 + */ + + ByteRTCRoomProfileLowLatency = 4, + /** + * + * @brief 适用于 3 人及以上纯语音通话。
    + * 通话中,闭麦时是媒体模式,上麦后切换为通话模式。 + */ + + ByteRTCRoomProfileChatRoom = 6, + /** + * + * @brief 适用于单主播和观众进行音视频互动的直播。通话模式,上下麦不会有模式切换,避免音量突变现象 + */ + + ByteRTCRoomProfileInteractivePodcast = 10, + /** + * + * @brief 适合在线实时合唱场景,高音质,超低延迟。使用本配置前请联系技术支持进行协助完成其他配置。 + */ + + ByteRTCRoomProfileChorus = 12, + /** + * + * @brief 适用于 1 vs 1 游戏串流,支持公网或局域网。 + */ + + ByteRTCRoomProfileGameStreaming = 14, + /** + * + * @brief 适用于云端会议中的个人设备 + */ + + ByteRTCRoomProfileMeeting = 16, + /** + * + * @brief 适用于云端会议中的会议室终端设备,例如 Rooms,投屏盒子等。 + */ + + ByteRTCRoomProfileMeetingRoom = 17, + /** + * + * @brief 适用于课堂互动,房间内所有成员都可以进行音视频互动
    + * 当你的场景中需要同时互动的成员超过 10 人时使用此模式 + */ + + ByteRTCRoomProfileClassroom = 18, + /** + * + * @brief 注重流畅性,缺省码率相对低。适用于通话。 + */ + + ByteRTCRoomProfileCall = 19, + /** + * + * @brief 更注重画质,视频缺省码率相对高。适用于直播互动。 + */ + + ByteRTCRoomProfileLive = 20, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 用户角色。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCUserRoleType) { + /** + * + * @brief 主播角色。该角色用户可在房间内发布和订阅音视频流,房间中的其他用户可以感知到该用户的存在。 + */ + + ByteRTCUserRoleTypeBroadcaster = 1, + /** + * + * @brief 隐身用户角色。此角色用户只可在房间内订阅音视频流,房间中的其他用户无法感知到该用户的存在。 + */ + + ByteRTCUserRoleTypeSilentAudience = 2, +}; + + +typedef NS_ENUM(NSInteger, ByteRTCRoomLiveMode) { + /** + * + * @brief 多人直播、连麦直播等模式。 + */ + + ByteRTCRoomLiveModeCoHost = 1, + /** + * + * @brief 单人直播。 + */ + + ByteRTCRoomLiveModeSoloHost = 2, +}; + +/** + * + * @type keytype + * @brief 用户可见性状态改变错误码。 + */ + + typedef NS_ENUM(NSInteger, ByteRTCUserVisibilityChangeError) { + /** + * + * @brief 成功。 + */ + + ByteRTCUserVisibilityChangeErrorOk = 0, + /** + * + * @brief 未知错误。 + */ + + ByteRTCUserVisibilityChangeErrorUnknown = 1, + /** + * + * @brief 房间内可见用户达到上限。 + */ + + ByteRTCUserVisibilityChangeErrorTooManyVisibleUser = 2, +}; + +/** + * + * @type keytype + * @brief 数据消息来源 + */ + +typedef NS_ENUM(NSInteger, ByteRTCDataMessageSourceType) { + /** + * + * @brief 通过客户端或服务端的插入的自定义消息。 + */ + + ByteRTCDataMessageSourceTypeDefault = 0, + /** + * + * @brief 系统数据,包含音量指示信息。 + */ + + ByteRTCDataMessageSourceTypeSystem = 1, +}; + +/** + * + * @type keytype + * @brief SEI 发送模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSEICountPerFrame) { + /** + * + * @brief 单发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,SEI 数据会按顺序跟随连续的视频帧逐帧发送,单个视频帧最多只有一个 SEI 数据。 + * 例如,假设在某一帧间隔内需要发送 3 个 SEI 数据,那么第 1 个 SEI 会在当前帧发送,第 2 个 SEI 会在下一帧发送,第 3 个 SEI 会在再下一帧发送。 + */ + + ByteRTCSEICountPerFrameSingle = 0, + /** + * + * @brief 多发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,这些 SEI 数据会全部在下一个视频帧上发送,可降低发送延迟,但一个视频帧会携带多个 SEI 数据。 + * 例如,假设在某一帧间隔内有 3 个 SEI 数据需要发送,这 3 个 SEI 数据将全部在下一个视频帧上发送。 + */ + + ByteRTCSEICountPerFrameMulti = 1, +}; + +/** + * + * @type keytype + * @brief 房间状态码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomState) { + /** + * + * @brief 加入房间成功 + */ + + ByteRTCRoomStateJoinSuccess = 0, + /** + * + * @brief 加入房间失败 + */ + + ByteRTCRoomStateJoinFailed = 1, + /** + * + * @brief 离开房间 + */ + + ByteRTCRoomStateLeft = 2, +}; + +/** + * + * @type keytype + * @brief 房间状态变化原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomStateChangeReason) { + /** + * + * @brief 首次进房成功。 + */ + + ByteRTCRoomStateChangeReasonJoinRoom = 0, + /** + * + * @brief 重新进房,比如断网重连。 + */ + + ByteRTCRoomStateChangeReasonReconnect = 1, + /** + * + * @brief 离开房间。 + */ + + ByteRTCRoomStateChangeReasonLeaveRoom = 2, + + /** + * + * @brief 进房失败。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 初次进房或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + ByteRTCRoomStateChangeReasonJoinRoomFailed = -2001, + + /** + * + * @brief Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 方法更新 Token。 + */ + + ByteRTCRoomStateChangeReasonInvalidToken = -1000, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken:` 传入的 Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 房间被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonUserForbidden = -1026, + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonKickedOut = -1006, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonRoomDismiss = -1011, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonDuplicateLogin = -1004, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 `joinRoom:userInfo:roomConfig:` 方法时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + ByteRTCRoomStateChangeReasonWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonServerLicenseExpired = -1017, + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseNotMatchWithCache = -1024, + /** + * + * @hidden internal use only + * @brief license 计费方法没有加载成功。可能是因为 license 相关插件未正确集成。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseFunctionNotFound = -1027, + /** + * + * @brief 服务端异常状态导致退出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + ByteRTCRoomStateChangeReasonStateAbnormalServerStatus = -1084, + /** + * + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + ByteRTCRoomStateChangeReasonUnknown = -1001 +}; + +/** + * + * @type keytype + * @brief 房间事件码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomEvent) { + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `rtcRoom:onUserJoined:` 和 `rtcEngine:onUserLeave:reason:` 回调,并通过广播提示房间内所有用户。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomEventUserNotifyStop = -2013, + + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + ByteRTCRoomEventForbidden = -2012 +}; + +/** + * + * @type keytype + * @brief 房间事件信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomEventInfo : NSObject + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + @property(assign, nonatomic) NSInteger forbiddenTime; +@end + +/** + * + * @type errorcode + * @brief 回调错误码。
    + * SDK 内部遇到不可恢复的错误时,会通过 `rtcEngine:onError:` 回调通知用户。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCErrorCode) { + /** + * + * @brief Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 方法更新 Token。 + */ + + ByteRTCErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + ByteRTCErrorCodeJoinRoom = -1001, + /** + * + * @brief 没有发布音视频流权限。通过以下回调通知:rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}。
    + * 用户在所在房间中发布音视频流失败,失败原因为用户没有发布流的权限。 + */ + + ByteRTCErrorCodeNoPublishPermission = -1002, + /** + * + * @brief 没有订阅音视频流权限。通过以下回调通知:rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + ByteRTCErrorCodeNoSubscribePermission = -1003, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeDuplicateLogin = -1004, + + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeKickedOut = -1006, + + /** + * + * @brief 当调用 `createRtcRoom:` ,如果 roomId 非法,会返回 null,并抛出该错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeRoomIdIllegal = -1007, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken:` 传入的 Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeUpdateTokenWithInvalidToken = -1010, + + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeRoomDismiss = -1011, + + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 `joinRoom:userInfo:roomConfig:` 方法时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + ByteRTCJoinRoomWithoutLicenseAuthenticateSDK = -1012, + + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomAlreadyExist = -1013, + + /** + * + * @brief 加入多个房间时使用了不同的 uid。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 同一个引擎实例中,用户需使用同一个 uid 加入不同的房间。 + */ + + ByteRTCUserIDDifferent = -1014, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomServerLicenseExpired = -1017, + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseNotMatchWithCache = -1024, + /** + * + * @brief 房间被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomUserForbidden = -1026, + /** + * + * @brief 订阅音视频流失败,订阅音视频流总数超过上限。通过以下回调通知: rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 游戏场景下,为了保证音视频通话的性能和质量,服务器会限制用户订阅的音视频流总数。当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + ByteRTCErrorCodeOverStreamSubscribeLimit = -1070, + /** + * + * @brief 发布流失败,发布流总数超过上限。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调。
    + * RTC 系统会限制单个房间内发布的总流数,总流数包括视频流、音频流和屏幕流。如果房间内发布流数已达上限时,本地用户再向房间中发布流时会失败,同时会收到此错误通知。 + */ + + ByteRTCErrorCodeOverStreamPublishLimit = -1080, + /** + * + * @deprecated since 3.52, use ByteRTCErrorCodeOverStreamPublishLimit-1080)instead + * @brief 发布视频流总数超过上限。
    + * RTC 系统会限制单个房间内发布的视频流数。如果房间内发布视频流数已达上限时,本地用户再向房间中发布视频流时会失败,同时会收到此错误通知。 + */ + + ByteRTCErrorCodeOverVideoPublishLimit = -1082, + /** + * + * @deprecated since 3.60, use ByteRTCAVSyncEventInvalidUidRepeated = 0 carried by rtcRoom:onAVSyncEvent:userId:eventCode:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncEvent:userId:eventCode:} instead. + * @brief 音视频同步失败。
    + * 当前音频源已与其他视频源关联同步关系。
    + * 单个音频源不支持与多个视频源同时同步。
    + * 通过 rtcRoom:onStreamStateChanged:withUid:state:extraInfo: 回调。 + */ + + ByteRTCErrorCodInvalidAudioSyncUidRepeated = -1083, + /** + * + * @brief 服务端异常状态导致退出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + ByteRTCErrorCodeAbnormalServerStatus = -1084, + /** + * + * @hidden for internal use only + * @brief 在一路流推多房间的场景下,在至少有两个房间在发布同一路流时,其中一个房间取消发布失败,此时需要业务方重试或者由业务方通知用户重试取消发布。 + */ + + ByteRTCErrorCodeMultiRoomUnpublishFailed = -1085, + /** + * + * @hidden for internal use only + * @brief 指定服务区域时传入错误参数。 + */ + + ByteRTCErrorCodeWrongAreaCode = -1086, + /** + * + * @hidden for internal use only + * @brief notify deadlock + */ + + ByteRTCErrorCodeDeadLockNotify = -1111, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
    + * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅作通知。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCWarningCode) { + /** + * + * @brief 发布音视频流失败。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调。
    + * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + ByteRTCWarningCodePublishStreamFailed = -2002, + /** + * + * @brief 订阅音视频流失败。通过以下回调通知: rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + ByteRTCWarningCodeSubscribeStreamFailed404 = -2003, + /** + * + * @brief 订阅音视频流失败。通过以下回调通知: rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 当你订阅所在房间中的音视频流时,由于服务器错误导致订阅失败。SDK 会自动重试订阅。 + */ + + ByteRTCWarningCodeSubscribeStreamFailed5xx = -2004, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误,当前代码中未使用。 + */ + + ByteRTCWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + ByteRTCWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 当调用 `setUserVisibility:` 将自身可见性设置为 false 后,再尝试发布流会触发此警告。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调。 + */ + + ByteRTCWarningCodePublishStreamForbidden = -2009, + /** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @brief 自动订阅模式未关闭时,尝试开启手动订阅模式会触发此警告。
    + * 你需在进房前关闭自动订阅模式,再调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:}/subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 方法手动订阅音视频流。 + */ + + ByteRTCWarningCodeSubscribeStreamForbiden = -2010, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + ByteRTCWarningCodeSendCustomMessage = -2011, + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `rtcEngine:onUserJoined:elapsed:` 和 `rtcEngine:onUserLeave:reason:` 回调,并通过广播提示房间内所有用户。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCWarningCodeCodeUserNotifyStop = -2013, + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布 WTN 流。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调,提示`kPublishStateChangeReasonNoPublishPermission` 回调。 + */ + + ByteRTCWarningCodeUserInPublish = -2014, + /** + * + * @deprecated since 3.45 and will be deleted in 3.51. + * @brief 同样 roomid 的房间已经存在了 + */ + + ByteRTCWarningCodeRoomAlreadyExist = -2015, + + /** + * + * @brief 当前正在进行回路测试,该接口调用无效 + */ + + ByteRTCWarningCodeInEchoTestMode = -2017, + /** + * + * @brief 摄像头权限异常,当前应用没有获取摄像头权限 + */ + + ByteRTCWarningCodeNoCameraPermission = -5001, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNoPermission 代替。
    + * 麦克风权限异常,当前应用没有获取麦克风权限。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNoPermission instead. + */ + + ByteRTCWarningCodeNoMicrophonePermission = -5002, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure 代替。
    + * 音频采集设备启动失败。
    + * 启动音频采集设备失败,当前设备可能被其他应用占用。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure instead. + */ + + ByteRTCWarningCodeAudioDeviceManagerRecordingStartFail = -5003, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure 代替.
    + * 音频播放设备启动失败警告。
    + * 可能由于系统资源不足,或参数错误。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure instead. + */ + + ByteRTCWarningCodeAudioDeviceManagerPlayoutStartFail = -5004, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound 代替。
    + * 无可用音频采集设备。
    + * 启动音频采集设备失败,请插入可用的音频采集设备。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound instead. + */ + + ByteRTCWarningCodeNoRecordingDevice = -5005, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound 代替。
    + * 无可用音频播放设备。
    + * 启动音频播放设备失败,请插入可用的音频播放设备。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound instead. + */ + + ByteRTCWarningCodeNoPlayoutDevice = -5006, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningCaptureSilence 代替。
    + * 当前音频设备没有采集到有效的声音数据,请检查更换音频采集设备。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningCaptureSilence instead. + */ + + ByteRTCWarningCodeRecordingSilence = -5007, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningOperationDenied 代替。
    + * 媒体设备误操作警告。
    + * 使用自定义采集时,不可调用内部采集开关,调用时触发此警告。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningOperationDenied instead. + */ + + ByteRTCWarningCodeMediaDeviceOperationDennied = -5008, + /** + * + * @brief 不支持在 publishScreenAudio: 之后,通过 `setScreenAudioSourceType` 设置屏幕音频采集类型 + */ + + ByteRTCWarningSetScreenAudioSourceTypeFailed = -5009, + + /** + * + * @brief 不支持在 publishScreenAudio: 之后,通过 `setScreenAudioStreamIndex` 设置屏幕音频混流类型 + */ + + ByteRTCWarningSetScreenAudioStreamIndexFailed = -5010, + /** + * + * @brief 设置语音音高不合法 + */ + + ByteRTCWarningInvalidVoicePitch = -5011, + /** + * + * @brief 外部音频源新旧接口混用 + */ + + ByteRTCWarningInvalidCallForExtAudio = -5013, + /** + * + * @brief 指定的内部渲染画布句柄无效。
    + * 当你调用 setLocalVideoCanvas:{@link #ByteRTCEngine#setLocalVideoCanvas:} 或 setRemoteVideoCanvas:withCanvas:{@link #ByteRTCEngine#setRemoteVideoCanvas:withCanvas:} 时指定了无效的画布句柄,触发此回调。 + */ + + ByteRTCWarningCodeInvalidCanvasHandle = -6001, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeInvaildSamiAppkeyORToken = -7002, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeInvaildSamiResourcePath = -7003, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeLoadSamiLibraryFailed = -7004, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeInvaildSamiEffectType = -7005 +}; + +/** + * + * @type keytype + * @brief 发布状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPublishState) { + /** + * + * @brief 发布成功 + */ + + ByteRTCPublishStatePublish = 0, + /** + * + * @brief 发布失败 + */ + + ByteRTCPublishStateUnpublish = 1 +}; + +/** + * + * @type keytype + * @brief 订阅状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubscribeState) { + /** + * + * @brief 订阅成功 + */ + + ByteRTCSubscribeStateSubscribe = 0, + /** + * + * @brief 订阅失败 + */ + + ByteRTCSubscribeStateUnsubscribe = 1 +}; + +/** + * + * @type keytype + * @brief 发布状态变化原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPublishStateChangeReason) { + /** + * + * @brief 用户调用发布 + */ + + ByteRTCPublishStateChangeReasonPublish = 0, + /** + * + * @brief 用户取消发布 + */ + + ByteRTCPublishStateChangeReasonUnpublish = 1, + /** + * + * @brief 发布 token 没有权限 + */ + + ByteRTCPublishStateChangeReasonNoPublishPermission = 2, + /** + * + * @brief 发布流总数超过上限 + */ + + ByteRTCPublishStateChangeReasonOverStreamPublishLimit = 3, + /** + * + * @brief 在一路流推多房间的场景下,在至少有两个房间在发布同一路流时,其中一个房间取消发布失败 + */ + + ByteRTCPublishStateChangeReasonMultiRoomUnpublishFailed = 4, + /** + * + * @brief 服务器错误导致发布失败 + */ + + ByteRTCPublishStateChangeReasonPublishStreamFailed = 5, + /** + * + * @brief 观众尝试发布操作 + */ + + ByteRTCPublishStateChangeReasonPublishStreamForbidden = 6, + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布。 + */ + + ByteRTCPublishStateChangeReasonUserInPublish = 7, + /** + * + * @brief 其他用户发布了相同streamid的流,导致本端发布的流被踢掉 + */ + + ByteRTCPublishStateChangeReasonStreamPublishByOther = 8, + /** + * + * @brief 流 ID 无效 + */ + + ByteRTCPublishStateChangeReasonStreamIdInvalid = 9 +}; + +/** + * + * @type keytype + * @brief 订阅状态变化原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubscribeStateChangeReason) { + /** + * + * @brief 本端调用订阅 + */ + + ByteRTCSubscribeStateChangeReasonSubscribe = 0, + /** + * + * @brief 本端取消订阅 + */ + + ByteRTCSubscribeStateChangeReasonUnsubscribe = 1, + /** + * + * @brief 远端发布流 + */ + + ByteRTCSubscribeStateChangeReasonRemotePublish = 2, + /** + * + * @brief 远端取消发布流 + */ + + ByteRTCSubscribeStateChangeReasonRemoteUnpublish = 3, + /** + * + * @brief 由于服务器错误导致订阅失败。SDK 会自动重试订阅 + */ + + ByteRTCSubscribeStateChangeReasonStreamFailed5xx = 4, + /** + * + * @brief 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + ByteRTCSubscribeStateChangeReasonStreamFailed404 = 5, + /** + * + * @brief 当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + ByteRTCSubscribeStateChangeReasonOverStreamSubscribeLimit = 6, + /** + * + * @brief 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + ByteRTCSubscribeStateChangeReasonNoSubscribePermission = 7 +}; + +/** + * + * @type keytype + * @brief 性能相关告警的原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmReason) { + /** + * + * @brief 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。 + */ + + ByteRTCPerformanceAlarmReasonBandwidthFallback = 0, + /** + * + * @brief 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。 + */ + + ByteRTCPerformanceAlarmReasonBandwidthResumed = 1, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足;
    + * 如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。 + */ + + ByteRTCPerformanceAlarmReasonFallback = 2, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复;
    + * 如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。 + */ + + ByteRTCPerformanceAlarmReasonResumed = 3, +}; + +/** + * + * @type keytype + * @brief 性能回退的模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmMode) { + /** + * + * @brief 未开启发布性能回退 + */ + + ByteRTCPerformanceAlarmModeNormal = 0, + /** + * + * @brief 已开启发布性能回退 + */ + + ByteRTCPerformanceAlarmModeSimulcast = 1, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 设置引擎工作模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMode) { + /** + * + * @brief 通用模式,该模式下只能进行普通会议模式的语音通话,开启自动发布订阅。 + */ + + ByteRTCModeGeneral = 0, + /** + * + * @brief 游戏语音模式,该模式下关闭自动发布订阅,会按照游戏业务的策略进行主动发布订阅语音。 + */ + + ByteRTCModeLocalAudio = 1, +}; +/** + * + * @type keytype + * @brief 发布端音视频流回退选项 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCPublishFallbackOption) { + /** + * + * @brief 上行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + ByteRTCPublishFallbackOptionDisabled = 0, + /** + * + * @brief 上行网络不佳或设备性能不足时,发布的视频流会从大流到小流依次降级,直到与当前网络性能匹配,具体降级规则参看[性能回退](https: + */ + + ByteRTCPublishFallbackOptionSimulcast = 1, +}; + +/** + * + * @hidden + * @deprecated since 3.26 and will be deleted in 3.51, use RoomConfig in joinRoom API instead. + * @type keytype + * @brief 订阅模式选项。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSubscribeMode) { + /** + * + * @brief 自动订阅模式。SDK 会自动为你订阅房间中的每一路流。 + */ + + ByteRTCSubscribeModeAuto = 0, + /** + * + * @brief 手动订阅模式。SDK 不自动订阅房间内的音视频流。你应根据需要调用 `subscribeStream` 方法手动订阅其他用户发布的音视频流。 + */ + + ByteRTCSubscribeModeManual = 1 +}; +/** + * + * @type keytype + * @brief 订阅端音视频流回退选项。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSubscribeFallbackOption) { + /** + * + * @brief 下行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + ByteRTCSubscribeFallbackOptionDisabled = 0, + /** + * + * @brief 下行网络不佳或设备性能不足时,对视频流做降级处理,具体降级规则参看[音视频流回退](https: + * 该设置仅对发布端调用 `enableSimulcastMode:` 开启发送多路流功能的情况生效。 + */ + + ByteRTCSubscribeFallbackOptionVideoStreamLow = 1, + /** + * + * @brief 下行网络不佳或设备性能不足时,先对视频流做回退处理。当网络状况不满足接收弱流时,则自动取消接收视频,仅接收音频。
    + * 该设置仅对发布端调用 `enableSimulcastMode:` 开启发送多路流功能的情况生效。 + */ + + ByteRTCSubscribeFallbackOptionAudioOnly = 2, +}; + +/** + * + * @type keytype + * @brief 远端用户优先级。在性能不足需要回退时,会先回退优先级低的用户的音视频流 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRemoteUserPriority) { + /** + * + * @brief 用户优先级为低,默认值 + */ + + ByteRTCRemoteUserPriorityLow = 0, + /** + * + * @brief 用户优先级为正常 + */ + + ByteRTCRemoteUserPriorityMedium = 100, + /** + * + * @brief 用户优先级为高 + */ + + ByteRTCRemoteUserPriorityHigh = 200, +}; + +/** + * + * @type keytype + * @brief 本地用户订阅的远端流触发回退策略的原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCFallbackOrRecoverReason) { + /** + * + * @brief 其他原因,非带宽和性能原因引起的回退或恢复。默认值 + */ + + ByteRTCFallbackOrRecoverReasonUnknown = -1, + /** + * + * @brief 由带宽不足导致的订阅端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeFallbackByBandwidth = 0, + /** + * + * @brief 由性能不足导致的订阅端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeFallbackByPerformance = 1, + /** + * + * @brief 由带宽恢复导致的订阅端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeRecoverByBandwidth = 2, + /** + * + * @brief 由性能恢复导致的订阅端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeRecoverByPerformance = 3, + /** + * + * @brief 由带宽不足导致的发布端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonPublishFallbackByBandwidth = 4, + /** + * + * @brief 由性能不足导致的发布端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonPublishFallbackByPerformance = 5, + /** + * + * @brief 由带宽恢复导致的发布端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonPublishRecoverByBandwidth = 6, + /** + * + * @brief 由性能恢复导致的发布端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonPublishRecoverByPerformance = 7, +}; + +/** + * + * @type keytype + * @brief 本地音频流状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamState) { + /** + * + * @brief 本地音频默认初始状态。
    + * 麦克风停止工作时回调该状态,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorOk + */ + + ByteRTCLocalAudioStreamStateStopped = 0, + /** + * + * @brief 本地音频录制设备启动成功。
    + * 采集到音频首帧时回调该状态,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorOk + */ + + ByteRTCLocalAudioStreamStateRecording = 1, + /** + * + * @brief 本地音频首帧编码成功。
    + * 音频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorOk + */ + + ByteRTCLocalAudioStreamStateEncoding = 2, + /** + * + * @brief 本地音频启动失败,在以下时机回调该状态:
    + * - 本地录音设备启动失败,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorRecordFailure + * - 检测到没有录音设备权限,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorDeviceNoPermission + * - 音频编码失败,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamError + */ + + ByteRTCLocalAudioStreamStateFailed = 3, +}; + +/** + * + * @type keytype + * @brief 本地音频流状态改变时的错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamError) { + /** + * + * @brief 本地音频状态正常 + */ + + ByteRTCLocalAudioStreamErrorOk = 0, + /** + * + * @brief 本地音频出错原因未知 + */ + + ByteRTCLocalAudioStreamErrorFailure = 1, + /** + * + * @brief 没有权限启动本地音频录制设备 + */ + + ByteRTCLocalAudioStreamErrorDeviceNoPermission = 2, + /** + * + * @hidden currently not available + * @brief 本地音频录制设备已经在使用中 + * @note 该错误码暂未使用 + */ + + ByteRTCLocalAudioStreamErrorDeviceBusy = 3, + /** + * + * @brief 本地音频录制失败,建议你检查录制设备是否正常工作 + */ + + ByteRTCLocalAudioStreamErrorRecordFailure = 4, + /** + * + * @brief 本地音频编码失败 + */ + + ByteRTCLocalAudioStreamErrorEncodeFailure = 5, + /** + * + * @brief 没有可用的音频录制设备 + */ + + ByteRTCLocalAudioStreamErrorNoRecordingDevice = 6 +}; + +/** + * + * @type keytype + * @brief 本地视频流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamState) { + /** + * + * @brief 本地视频默认初始状态
    + * 摄像头停止工作时回调该状态,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorOk + */ + + ByteRTCLocalVideoStreamStateStopped = 0, + /** + * + * @brief 本地视频录制设备启动成功
    + * 采集到视频首帧时回调该状态,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorOk + */ + + ByteRTCLocalVideoStreamStateRecording = 1, + /** + * + * @brief 本地视频首帧编码成功
    + * 本地视频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorOk + */ + + ByteRTCLocalVideoStreamStateEncoding = 2, + /** + * + * @brief 本地视频启动失败, 在以下时机回调该状态:
    + * - 本地采集设备启动失败,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorCaptureFailure + * - 检测到没有摄像头权限,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorDeviceNoPermission + * - 视频编码失败,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorEncodeFailure + */ + + ByteRTCLocalVideoStreamStateFailed = 3, +}; + +/** + * + * @type keytype + * @brief 本地视频状态改变时的错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamError) { + /** + * + * @brief 本地视频状态正常(本地视频状态改变正常时默认返回值) + */ + + ByteRTCLocalVideoStreamErrorOk = 0, + /** + * + * @brief 本地视频流发布失败 + */ + + ByteRTCLocalVideoStreamErrorFailure = 1, + /** + * + * @brief 没有权限启动本地视频采集设备 + */ + + ByteRTCLocalVideoStreamErrorDeviceNoPermission = 2, + /** + * + * @brief 本地视频采集设备已被占用 + */ + + ByteRTCLocalVideoStreamErrorDeviceBusy = 3, + /** + * + * @brief 本地视频采集设备不存在或已移除 + */ + + ByteRTCLocalVideoStreamErrorDeviceNotFound = 4, + /** + * + * @brief 本地视频采集失败,建议检查采集设备是否正常工作 + */ + + ByteRTCLocalVideoStreamErrorCaptureFailure = 5, + /** + * + * @brief 本地视频编码失败 + */ + + ByteRTCLocalVideoStreamErrorEncodeFailure = 6, + /** + * + * @brief 通话过程中本地视频采集设备被其他程序抢占,导致设备连接中断 + */ + + ByteRTCLocalVideoStreamErrorDeviceDisconnected = 7, +}; + +/** + * + * @type keytype + * @brief 用户订阅的远端音频流状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioState) { + /** + * + * @brief 远端音频流默认初始状态,在以下时机回调该状态:
    + * - 本地用户停止接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonLocalMuted` + * - 远端用户停止发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonRemoteMuted` + * - 远端用户离开房间,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonRemoteOffline` + */ + + ByteRTCRemoteAudioStateStopped = 0, + /** + * + * @brief 开始接收远端音频流首包。 + */ + + ByteRTCRemoteAudioStateStarting = 1, + /** + * + * @brief 远端音频流正在解码,正常播放,在以下时机回调该状态:
    + * - 成功解码远端音频首帧,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonLocalUnmuted` + * - 网络由阻塞恢复正常,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonNetworkRecovery` + * - 本地用户恢复接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonLocalUnmuted` + * - 远端用户恢复发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted` + */ + + ByteRTCRemoteAudioStateDecoding = 2, + /** + * + * @brief 远端音频流卡顿。 + */ + + ByteRTCRemoteAudioStateFrozen = 3, + /** + * + * @hidden currently not available + * @brief 远端音频流播放失败 + * @note 该错误码暂未使用 + */ + + ByteRTCRemoteAudioStateFailed = 4, +}; + +/** + * + * @type keytype + * @brief 接收远端音频流状态改变的原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioStateChangeReason) { + /** + * + * @brief 内部原因 + */ + + ByteRTCRemoteAudioStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + ByteRTCRemoteAudioStateChangeReasonNetworkCongestion = 1, + /** + * + * @brief 网络恢复正常 + */ + + ByteRTCRemoteAudioStateChangeReasonNetworkRecovery = 2, + /** + * + * @brief 本地用户停止接收远端音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonLocalMuted = 3, + /** + * + * @brief 本地用户恢复接收远端音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonLocalUnmuted = 4, + /** + * + * @brief 远端用户停止发送音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonRemoteMuted = 5, + /** + * + * @brief 远端用户恢复发送音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted = 6, + /** + * + * @brief 远端用户离开房间 + */ + + ByteRTCRemoteAudioStateChangeReasonRemoteOffline = 7, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoState) { + /** + * + * @brief 远端视频流默认初始状态, 在以下时机回调该状态:
    + * - 本地用户停止接收远端视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalMuted + * - 远端用户停止发送视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonRemoteMuted + * - 远端用户离开房间,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonRemoteOffline + */ + + ByteRTCRemoteVideoStateStopped = 0, + /** + * + * @brief 本地用户已接收远端视频首包
    + * 收到远端视频首包时回调该状态,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + */ + + ByteRTCRemoteVideoStateStarting = 1, + /** + * + * @brief 远端视频流正在解码,正常播放, 在以下时机回调该状态:
    + * - 成功解码远端视频首帧,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + * - 网络由阻塞恢复正常,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonNetworkRecovery + * - 本地用户恢复接收远端视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + * - 远端用户恢复发送视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted + */ + + ByteRTCRemoteVideoStateDecoding = 2, + /** + * + * @brief 远端视频流卡顿
    + * 网络阻塞、丢包率等原因造成视频卡顿流时会回报该状态,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonNetworkCongestion + */ + + ByteRTCRemoteVideoStateFrozen = 3, + /** + * + * @brief 远端视频流播放失败
    + * 如果内部处理远端视频流失败,则会回调该方法, 对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonInternal + */ + + ByteRTCRemoteVideoStateFailed = 4, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态改变的原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoStateChangeReason) { + /** + * + * @brief 内部原因 + */ + + ByteRTCRemoteVideoStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + ByteRTCRemoteVideoStateChangeReasonNetworkCongestion = 1, + /** + * + * @brief 网络恢复正常 + */ + + ByteRTCRemoteVideoStateChangeReasonNetworkRecovery = 2, + /** + * + * @brief 本地用户停止接收远端视频流或本地用户禁用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonLocalMuted = 3, + /** + * + * @brief 本地用户恢复接收远端视频流或本地用户启用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonLocalUnmuted = 4, + /** + * + * @brief 远端用户停止发送视频流或远端用户禁用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonRemoteMuted = 5, + /** + * + * @brief 远端用户恢复发送视频流或远端用户启用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted = 6, + /** + * + * @brief 远端用户离开房间 + */ + + ByteRTCRemoteVideoStateChangeReasonRemoteOffline = 7, +}; + +/** + * + * @type keytype + * @brief 当前媒体设备类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceType) { + /** + * + * @brief 未知音频设备 + */ + + ByteRTCMediaDeviceTypeAudioUnknown = -1, + /** + * + * @brief 音频渲染设备类型 + */ + + ByteRTCMediaDeviceTypeAudioRenderDevice = 0, + /** + * + * @brief 音频采集设备类型 + */ + + ByteRTCMediaDeviceTypeAudioCaptureDevice = 1, + /** + * + *@hidden currently not available + * @brief 视频渲染设备类型,该类型暂无使用 + */ + + ByteRTCMediaDeviceTypeVideoRenderDevice = 2, + /** + * + * @brief 视频采集设备类型 + */ + + ByteRTCMediaDeviceTypeVideoCaptureDevice = 3, + /** + * + * @brief 屏幕流视频设备 + */ + + ByteRTCMediaDeviceTypeScreenVideoCaptureDevice = 4, + /** + * + * @brief 屏幕流音频设备 + */ + + ByteRTCMediaDeviceTypeScreenAudioCaptureDevice = 5 +}; + +/** + * + * @type keytype + * @brief 媒体设备状态
    + * 通过 `rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:` 或 `rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:` 回调设备状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceState) { + /** + * + * @brief 设备已开启 + */ + + ByteRTCMediaDeviceStateStarted = 1, + /** + * + * @brief 设备已停止 + */ + + ByteRTCMediaDeviceStateStopped = 2, + /** + * + * @brief 设备运行时错误
    + * 例如,当媒体设备的预期行为是正常采集,但没有收到采集数据时,将回调该状态。 + */ + + ByteRTCMediaDeviceStateRuntimeError = 3, + /** + * + * @brief 设备已插入
    + * 你可以调用获取设备接口更新设备列表。 + */ + + ByteRTCMediaDeviceStateAdded = 10, + /** + * + * @brief 设备被移除
    + * 你可以调用获取设备接口更新设备列表。 + */ + + ByteRTCMediaDeviceStateRemoved = 11, + /** + * + * @brief 系统通话,锁屏或第三方应用打断了音视频通话。将在通话结束或第三方应用结束占用后自动恢复。 + */ + + ByteRTCMediaDeviceStateInterruptionBegan = 12, + /** + * + * @brief 音视频通话已从系统电话或第三方应用打断中恢复 + */ + + ByteRTCMediaDeviceStateInterruptionEnded = 13, + /** + * + * @hidden(iOS) + * @brief 获取设备列表超时后,收到设备列表通知。
    + * 再次调用获取设备接口更新设备列表。 + */ + + ByteRTCMediaDeviceListUpdated = 16, + +}; + +/** + * + * @type keytype + * @brief 媒体设备错误类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceError) { + /** + * + * @brief 媒体设备正常 + */ + + ByteRTCMediaDeviceErrorOK = 0, + /** + * + * @brief 没有权限启动媒体设备 + */ + + ByteRTCMediaDeviceErrorDeviceNoPermission = 1, + /** + * + * @brief 媒体设备已经在使用中 + */ + + ByteRTCMediaDeviceErrorDeviceBusy = 2, + /** + * + * @brief 媒体设备错误 + */ + + ByteRTCMediaDeviceErrorDeviceFailure = 3, + /** + * + * @brief 未找到指定的媒体设备 + */ + + ByteRTCMediaDeviceErrorDeviceNotFound = 4, + /** + * + * @brief 媒体设备被移除 + */ + + ByteRTCMediaDeviceErrorDeviceDisconnected = 5, + /** + * + * @brief 无采集数据。当媒体设备的预期行为是正常采集,但没有收到采集数据时,将收到该错误。 + */ + + ByteRTCMediaDeviceErrorDeviceNoCallback = 6, + /** + * + * @brief 设备采样率不支持 + */ + + ByteRTCMediaDeviceErrorUNSupportFormat = 7, + /** + * + * @hidden(macOS) + * @brief iOS 屏幕采集没有 group Id 参数 + */ + + ByteRTCMediaDeviceErrorNotFindGroupId = 8, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:因用户使用系统相机,应用切换到后台运行,导致采集中断。 + */ + + ByteRTCMediaDeviceErrorNotAvailableInBackground = 9, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:可能由于其他应用占用系统相机,导致视频设备暂时不可用,从而造成采集中断。 + */ + + ByteRTCMediaDeviceErrorVideoInUseByAnotherClient = 10, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:当前应用处于侧拉、分屏或者画中画模式时,导致采集中断。 + */ + + ByteRTCMediaDeviceErrorNotAvailableWithMultipleForegroundApps = 11, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:由于系统性能不足导致中断,比如设备过热。 + */ + + ByteRTCMediaDeviceErrorNotAvailableDueToSystemPressure = 12, + /** + * + * @hidden(iOS) + * @brief 系统服务错误或长时间不响应,建议重启音频服务进程或重启设备。 + */ + + ByteRTCMediaDeviceErrorAudioServerNeedRestart = 13, +}; + +/** + * + * @type keytype + * @brief 媒体设备警告 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceWarning) { + /** + * + * @brief 无警告 + */ + + ByteRTCMediaDeviceWarningOK = 0, + /** + * + * @brief 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。 + */ + + ByteRTCMediaDeviceWarningOperationDenied = 1, + /** + * + * @brief 采集到的数据为静音帧。 + */ + + ByteRTCMediaDeviceWarningCaptureSilence = 2, + + /** + * + * @hidden for internal use only + * @brief 音量过大,超过设备采集范围。建议降低麦克风音量或者降低声源音量。 + */ + + ByteRTCMediaDeviceWarningDetectClipping = 10, + /** + * + * @brief 通话中出现回声现象。
    + * 当 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 为 `ByteRTCRoomProfileMeeting` 和 `ByteRTCRoomProfileMeetingRoom` ,且 AEC 关闭时,SDK 自动启动回声检测,如果检测到回声问题,将通过 `rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:` 返回本枚举值。 + */ + + ByteRTCMediaDeviceWarningDetectLeakEcho = 11, + /** + * + * @hidden for internal use only + * @brief 低信噪比 + */ + + ByteRTCMediaDeviceWarningDetectLowSNR = 12, + /** + * + * @hidden for internal use only + * @brief 采集插零现象 + */ + + ByteRTCMediaDeviceWarningDetectInsertSilence = 13, + /** + * + * @hidden for internal use only + * @brief 设备采集静音 + */ + + ByteRTCMediaDeviceWarningCaptureDetectSilence = 14, + /** + * + * @hidden for internal use only + * @brief 设备采集静音消失 + */ + + ByteRTCMediaDeviceWarningCaptureDetectSilenceDisappear = 15, + /** + * + * @brief 啸叫。触发该回调的情况如下:1)不支持啸叫抑制的房间模式下,检测到啸叫;2)支持啸叫抑制的房间模式下,检测到未被抑制的啸叫。
    + * 仅 ByteRTCRoomProfileCommunication、ByteRTCRoomProfileMeeting、ByteRTCRoomProfileMeetingRoom 三种房间模式支持啸叫抑制。
    + * 建议提醒用户检查客户端的距离或将麦克风和扬声器调至静音。 + */ + + ByteRTCMediaDeviceWarningCaptureDetectHowling = 16, + /** + * + * @hidden(macOS) + * @brief 当前 AudioScenario 不支持更改音频路由,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteInvalidScenario = 20, + /** + * + * @hidden(macOS) + * @brief 音频设备不存在,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteNotExists = 21, + /** + * + * @hidden(macOS) + * @brief 音频路由被系统或其他应用占用,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteFailedByPriority = 22, + /** + * + * @hidden(macOS) + * @brief 当前非通话模式 ByteRTCAudioScenarioCommunication,不支持设置音频路由 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteNotVoipMode = 23, + /** + * + * @hidden(macOS) + * @brief 音频设备未启动,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteDeviceNotStart = 24, + /** + * + * @hidden(macOS) + * @brief 非纯媒体音频场景,此时不支持切换蓝牙传输协议。待切换至纯媒体音频场景后生效。 + */ + + ByteRTCMediaDeviceWarningSetBluetoothModeScenarioUnsupport = 25, + /** + * + * @hidden(macOS) + * @brief 当前不支持设置 HFP。 + */ + + ByteRTCMediaDeviceWarningSetBluetoothModeUnsupport = 26 +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈问题类型 + */ + +typedef NS_OPTIONS(uint64_t, ByteRTCProblemFeedbackOption) { + /** + * + * @brief 没有问题 + */ + + ByteRTCProblemFeedbackOptionNone = 0, + /** + * + * @brief 其他问题 + */ + + ByteRTCProblemFeedbackOptionOtherMessage = (1ULL << 0), + /** + * + * @brief 连接失败 + */ + + ByteRTCProblemFeedbackOptionDisconnected = (1ULL << 1), + /** + * + * @brief 耳返延迟大 + */ + + ByteRTCProblemFeedbackOptionEarBackDelay = (1ULL << 2), + /** + * + * @brief 本端有杂音 + */ + + ByteRTCProblemFeedbackOptionLocalNoise = (1ULL << 10), + /** + * + * @brief 本端声音卡顿 + */ + + ByteRTCProblemFeedbackOptionLocalAudioLagging = (1ULL << 11), + /** + * + * @brief 本端无声音 + */ + + ByteRTCProblemFeedbackOptionLocalNoAudio = (1ULL << 12), + /** + * + * @brief 本端声音大/小 + */ + + ByteRTCProblemFeedbackOptionLocalAudioStrength = (1ULL << 13), + /** + * + * @brief 本端有回声 + */ + + ByteRTCProblemFeedbackOptionLocalEcho = (1ULL << 14), + /** + * + * @brief 本端视频模糊 + */ + + ByteRTCProblemFeedbackOptionLocalVideoFuzzy = (1ULL << 24), + /** + * + * @brief 本端音视频不同步 + */ + + ByteRTCProblemFeedbackOptionLocalNotSync = (1ULL << 25), + /** + * + * @brief 本端视频卡顿 + */ + + ByteRTCProblemFeedbackOptionLocalVideoLagging = (1ULL << 26), + /** + * + * @brief 本端无画面 + */ + + ByteRTCProblemFeedbackOptionLocalNoVideo = (1ULL << 27), + /** + * + * @brief 远端有杂音 + */ + + ByteRTCProblemFeedbackOptionRemoteNoise = (1ULL << 37), + /** + * + * @brief 远端声音卡顿 + */ + + ByteRTCProblemFeedbackOptionRemoteAudioLagging = (1ULL << 38), + /** + * + * @brief 远端无声音 + */ + + ByteRTCProblemFeedbackOptionRemoteNoAudio = (1ULL << 39), + /** + * + * @brief 远端声音大/小 + */ + + ByteRTCProblemFeedbackOptionRemoteAudioStrength = (1ULL << 40), + /** + * + * @brief 远端有回声 + */ + + ByteRTCProblemFeedbackOptionRemoteEcho = (1ULL << 41), + /** + * + * @brief 远端视频模糊 + */ + + ByteRTCProblemFeedbackOptionRemoteVideoFuzzy = (1ULL << 51), + /** + * + * @brief 远端音视频不同步 + */ + + ByteRTCProblemFeedbackOptionRemoteNotSync = (1ULL << 52), + /** + * + * @brief 远端视频卡顿 + */ + + ByteRTCProblemFeedbackOptionRemoteVideoLagging = (1ULL << 53), + /** + * + * @brief 远端无画面 + */ + + ByteRTCProblemFeedbackOptionRemoteNoVideo = (1ULL << 54) +}; + +/** + * + * @type keytype + * @brief 通话质量反馈房间信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCProblemFeedbackRoomInfo: NSObject + /** + * + * @brief 通话质量反馈的房间 ID + */ + + @property(nonatomic, copy) NSString * _Nonnull roomId; + + /** + * + * @brief 通话质量反馈的用户 ID + */ + + @property(nonatomic, copy) NSString * _Nonnull userId; +@end + +/** + * + * @type keytype + * @brief 通话质量反馈信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCProblemFeedbackInfo: NSObject + /** + * + * @brief 通话质量反馈的文字描述 + */ + + @property(nonatomic, copy) NSString * _Nonnull problemDesc; + + /** + * + * @brief 通话质量反馈的房间信息。参看 ByteRTCProblemFeedbackRoomInfo{@link #ByteRTCProblemFeedbackRoomInfo}。 + */ + + @property(nonatomic, strong) NSArray * _Nullable roomInfo; + +@end + +/** + * + * @type keytype + * @brief 首帧发送状态 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCFirstFrameSendState) { + /** + * + * @brief 发送中 + */ + + ByteRTCFirstFrameSendStateSending = 0, + /** + * + * @brief 发送成功 + */ + + ByteRTCFirstFrameSendStateSent = 1, + /** + * + * @brief 发送失败 + */ + + ByteRTCFirstFrameSendStateEnd = 2, +}; + +/** + * + * @type keytype + * @brief 首帧播放状态 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCFirstFramePlayState) { + /** + * + * @brief 播放中 + */ + + ByteRTCFirstFramePlayStatePlaying = 0, + /** + * + * @brief 播放成功 + */ + + ByteRTCFirstFramePlayStatePlay = 1, + /** + * + * @brief 播放失败 + */ + + ByteRTCFirstFramePlayStateEnd = 2, +}; + +/** + * + * @type keytype + * @brief 自定义加密类型 + */ + +typedef NS_OPTIONS(NSUInteger, ByteRTCEncryptType) { + /** + * + * @brief 不使用内置加密。默认值。 + */ + + ByteRTCEncryptTypeCustomize = 0, + /** + * + * @brief AES-128-CBC 加密算法 + */ + + ByteRTCEncryptTypeAES128CBC = 1, + /** + * + * @brief AES-256-CBC 加密算法 + */ + + ByteRTCEncryptTypeAES256CBC = 2, + /** + * + * @brief AES-128-ECB 加密算法 + */ + + ByteRTCEncryptTypeAES128ECB = 3, + /** + * + * @brief AES-256-ECB 加密算法 + */ + + ByteRTCEncryptTypeAES256ECB = 4 +}; + +/** + * + * @type keytype + * @brief 视频编码类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoCodecType) { + /** + * + * @brief 未知类型 + */ + + ByteRTCVideoCodecTypeUnknown = 0, + /** + * + * @brief 标准 H264 编码格式 + */ + + ByteRTCVideoCodecTypeH264 = 1, + /** + * + * @brief ByteVC1 编码器 + */ + + ByteRTCVideoCodecTypeByteVC1 = 2, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSuperResolutionMode) { + /** + * + * @brief 关闭超分。 + */ + + ByteRTCVideoSuperResolutionModeOff = 0, + /** + * + * @brief 开启超分。 + */ + + ByteRTCVideoSuperResolutionModeOn = 1, +}; + +/** + * + * @hidden(macOS) for internal use + * @type keytype + * @brief 视频降噪模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDenoiseMode) { + /** + * + * @brief 视频降噪关闭。 + */ + + ByteRTCVideoDenoiseModeOff = 0, + /** + * + * @brief 视频降噪开启,由 ByteRTC 后台配置视频降噪算法。 + */ + + ByteRTCVideoDenoiseModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 音视频流的发送/播放状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMuteState) { + /** + * + * @brief 发送 + */ + + ByteRTCMuteStateOff = 0, + /** + * + * @brief 停止发送 + */ + + ByteRTCMuteStateOn = 1, +}; + +/** + * + * @type keytype + * @brief 黑帧视频流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSEIStreamEventType) { + /** + * + * @brief 远端用户发布黑帧视频流。
    + * 纯语音通话场景下,远端用户调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 发送 SEI 数据时,SDK 会自动发布一路黑帧视频流,并触发该回调。 + */ + + ByteRTCSEIStreamEventTypeStreamAdd = 0, + /** + * + * @brief 远端黑帧视频流移除。该回调的触发时机包括:
    + * - 远端用户开启摄像头采集,由语音通话切换至视频通话,黑帧视频流停止发布; + * - 远端用户调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 后 1min 内未有 SEI 数据发送,黑帧视频流停止发布; + * - 远端用户调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 切换至自定义视频采集时,黑帧视频流停止发布。 + */ + + ByteRTCSEIStreamEventTypeStreamRemove = 1, +}; + +/** + * + * @type keytype + * @brief 预留字段。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCStreamIndex) { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
    + * - 由摄像头/麦克风通过内部采集机制,采集到的视频/音频; + * - 通过自定义采集,采集到的视频/音频。 + */ + + ByteRTCStreamIndexMain = 0, + /** + * + * @hidden for internal use only + * @brief 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。 + */ + + ByteRTCStreamIndexScreen = 1, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex3rd, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex4th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex5th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex6th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex7th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndexMax, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人声检测结果 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioVADType) { + /** + * + * @brief 未检测到人声 + */ + + ByteRTCAudioVADTypeNoSpeech = 0, + /** + * + * @brief 检测到人声。 + */ + + ByteRTCAudioVADTypeSpeech = 1, +}; + +/** + * + * @valid since 3.56 + * @type keytype + * @brief 流聚合策略 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAggregationOption) { + /** + * + * @brief 流聚合向下取值 (默认策略) + */ + + ByteRTCAggregationOptionMin = 0, + /** + * + * @brief 流聚合向上取值 + */ + + ByteRTCAggregationOptionMax = 1, + /** + * + * @brief 流聚合按比例取值,比例相同时,向下取值 + */ + + ByteRTCAggregationOptionMajority = 2 +}; + +/** + * + * @type keytype + * @brief 媒体流信息同步的流类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSyncInfoStreamType) { + /** + * + * @brief 音频流 + */ + + ByteRTCSyncInfoStreamTypeAudio = 0 +}; + +/** + * + * @type keytype + * @brief 颜色空间 + */ + +typedef NS_ENUM(NSInteger, ByteRTCColorSpace) { + /** + * + * @brief 未知的颜色空间,默认使用 kColorSpaceYCbCrBT601LimitedRange 颜色空间 + */ + + ByteRTCColorSpaceUnknown = 0, + /** + * + * @brief BT.601 数字编码标准,颜色空间[16-235] + */ + + ByteRTCColorSpaceYCbCrBT601LimitedRange = 1, + /** + * + * @brief BT.601 数字编码标准,颜色空间[0-255] + */ + + ByteRTCColorSpaceYCbCrBT601FullRange = 2, + /** + * + * @brief BT.7091 数字编码标准,颜色空间[16-235] + */ + + ByteRTCColorSpaceYCbCrBT709LimitedRange = 3, + /** + * + * @brief BT.7091 数字编码标准,颜色空间[0-255] + */ + + ByteRTCColorSpaceYCbCrBT709FullRange = 4 +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCForwardStreamState) { + /** + * + * @brief 空闲状态
    + * - 成功调用 `stopForwardStreamToRooms` 后,所有目标房间为空闲状态。 + * - 成功调用 `updateForwardStreamToRooms` 减少目标房间后,本次减少的目标房间为空闲状态。 + */ + + ByteRTCForwardStreamStateIdle = 0, + /** + * + * @brief 开始转发
    + * - 调用 `startForwardStreamToRooms` 成功向所有房间开始转发媒体流后,返回此状态。 + * - 调用 `updateForwardStreamToRooms` 后,成功向新增目标房间开始转发媒体流后,返回此状态。 + */ + + ByteRTCForwardStreamStateSuccess = 1, + /** + * + * @brief 转发失败,失败详情参考 ByteRTCForwardStreamError{@link #ByteRTCForwardStreamError}
    + * 调用 `startForwardStreamToRooms` 或 `updateForwardStreamToRooms` 后,如遇转发失败,返回此状态。 + */ + + ByteRTCForwardStreamStateFailure = 2, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发过程中抛出的错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCForwardStreamError) { + /** + * + * @brief 正常 + */ + + ByteRTCForwardStreamErrorOK = 0, + /** + * + * @brief 参数异常 + */ + + ByteRTCForwardStreamErrorInvalidArgument = 1201, + /** + * + * @brief Token 错误 + */ + + ByteRTCForwardStreamErrorInvalidToken = 1202, + /** + * + * @brief 服务端异常 + */ + + ByteRTCForwardStreamErrorResponse = 1203, + /** + * + * @brief 目标房间有相同 user id 的用户加入,转发中断 + */ + + ByteRTCForwardStreamErrorRemoteKicked = 1204, + /** + * + * @brief 服务端不支持转发功能 + */ + + ByteRTCForwardStreamErrorNotSupport = 1205, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发事件 + */ + +typedef NS_ENUM(NSInteger, ByteRTCForwardStreamEvent) { + /** + * + * @brief 本端与服务器网络连接断开,暂停转发。 + */ + + ByteRTCForwardStreamEventDisconnected = 0, + /** + * + * @brief 本端与服务器网络连接恢复,转发服务连接成功。 + */ + + ByteRTCForwardStreamEventConnected = 1, + /** + * + * @brief 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。 + */ + + ByteRTCForwardStreamEventInterrupt = 2, + /** + * + * @brief 目标房间已更新,由 `updateForwardStreamToRooms` 触发。 + */ + + ByteRTCForwardStreamEventDstRoomUpdated = 3, + /** + * + * @brief API 调用时序错误。例如,在调用 `startForwardStreamToRooms` 之前调用 `updateForwardStreamToRooms` 。 + */ + + ByteRTCForwardStreamEventUnExpectAPICall = 4, +}; + +/** + * + * @type keytype + * @brief 本地录制的状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingState) { + /** + * + * @brief 录制异常 + */ + + ByteRTCRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + ByteRTCRecordingStateProcessing = 1, + /** + * + * @brief 录制文件保存成功。调用 stopFileRecording 结束录制之后会收到该状态码。或者在 stopFileRecording 之前编码分辨率发生了变化同样会回调该状态码,且 SDK内部会自动重启录制产生新的录制文件直到调用 stopFileRecording + */ + + ByteRTCRecordingStateSuccess = 2, +}; + +/** + * + * @type keytype + * @brief 本地录制错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingErrorCode) { + /** + * + * @brief 录制正常 + */ + + ByteRTCRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + ByteRTCRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 当前版本 SDK 不支持本地录制功能,请联系技术支持人员 + */ + + ByteRTCRecordingErrorCodeNotSupport = -2, + /** + * + * @brief 其他异常 + */ + + ByteRTCRecordingErrorCodeOther = -3, +}; + +/** + * + * @type keytype + * @brief 本地录制文件的存储格式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingFileType) { + /** + * + * @brief aac 格式文件 + */ + + ByteRTCRecordingFileTypeAAC = 0, + /** + * + * @brief mp4 格式文件 + */ + + ByteRTCRecordingFileTypeMP4 = 1, +}; + +/** + * + * @type keytype + * @brief 音视频同步状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAVSyncState) { + /** + * + * @brief 音视频开始同步 + */ + + ByteRTCAVSyncStateAVStreamSyncBegin = 0, + /** + * + * @brief 音视频同步过程中音频移除,但不影响当前的同步关系 + */ + + ByteRTCAVSyncStateAudioStreamRemove = 1, + /** + * + * @brief 音视频同步过程中视频移除,但不影响当前的同步关系 + */ + + ByteRTCAVSyncStateVideoStreamRemove = 2, + /** + * + * @hidden for internal use only + * @brief 订阅端设置同步 + */ + + ByteRTCAVSyncStateSetAVSyncStreamId = 3, +}; + +/** + * + * @type keytype + * @brief AVSync 事件类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAVSyncEvent) { + /** + * + * @brief 音视频同步失败。
    + * 当前音频源已与其他视频源关联同步关系。
    + * 单个音频源不支持与多个视频源同时同步。 + */ + + ByteRTCAVSyncEventInvalidUidRepeated = 0, +}; +/** + * + * @type keytype + * @brief 音视频回路测试结果 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEchoTestResult) { + /** + * + * @brief 接收到采集的音视频的回放,通话回路检测成功 + */ + + ByteRTCEchoTestResultSuccess = 0, + /** + * + * @brief 测试超过 60s 仍未完成,已自动停止 + */ + + ByteRTCEchoTestResultTimeout = 1, + /** + * + * @brief 上一次测试结束和下一次测试开始之间的时间间隔少于 5s + */ + + ByteRTCEchoTestResultIntervalShort = 2, + /** + * + * @brief 音频采集异常 + */ + + ByteRTCEchoTestResultAudioDeviceError = 3, + /** + * + * @brief 视频采集异常 + */ + + ByteRTCEchoTestResultVideoDeviceError = 4, + /** + * + * @brief 音频接收异常 + */ + + ByteRTCEchoTestResultAudioReceiveError = 5, + /** + * + * @brief 视频接收异常 + */ + + ByteRTCEchoTestResultVideoReceiveError = 6, + /** + * + * @brief 内部错误,不可恢复 + */ + + ByteRTCEchoTestResultInternalError = 7 +}; + +/** + * + * @deprecated since 3.60, see rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:}. + * @type errorcode + * @brief WTN 流状态码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPublicStreamErrorCode) { + /** + * + * @brief 发布或订阅成功。 + */ + + ByteRTCPublicStreamErrorCodeSuccess = 0, + /** + * + * @brief WTN 流的参数异常,请修改参数后重试。 + */ + + ByteRTCPublicStreamErrorCodePushParamError = 1191, + /** + * + * @brief 服务端状态异常,将自动重试。 + */ + + ByteRTCPublicStreamErrorCodePushStatusError = 1192, + /** + * + * @brief 内部错误,不可恢复,请重试。 + */ + + ByteRTCPublicStreamErrorCodePushInternalError = 1193, + /** + * + * @brief 发布失败,将自动重试,请关注重试结果。 + */ + + ByteRTCPublicStreamErrorCodePushError = 1195, + /** + * + * @brief 发布失败,10 s 后会重试,重试 3 次后自动停止。 + */ + + ByteRTCPublicStreamErrorCodePushTimeOut = 1196, + /** + * + * @brief 订阅失败,发布端未开始发布流。 + */ + + ByteRTCPublicStreamErrorCodePullNoPushStream = 1300, +}; +/** + * + * @type keytype + * @brief 蓝牙传输协议。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCBluetoothMode) { + /** + * + * @brief 默认采用 auto 模式,具体如下:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    场景 HFP A2DP
    纯通话场景 蓝牙设备支持 HFP 蓝牙设备不支持 HFP
    纯媒体场景 使用蓝牙设备采集播放音频 使用 iOS 设备采集音频,蓝牙设备播放音频
    + */ + + ByteRTCBluetoothModeAuto = 0, + + /** + * + * @brief 高级音频分配配置文件(A2DP)。立体声、高音质。采用 iOS 设备进行音频采集,蓝牙设备进行播放。 + */ + + ByteRTCBluetoothModeA2DP = 1, + + /** + * + * @brief 免提配置文件(HFP)。单声道、普通音质。音频采集和播放设备都使用蓝牙设备。 + */ + + ByteRTCBluetoothModeHFP = 2 +}; +/** + * + * @type keytype + * @brief 音视频回路测试参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEchoTestConfig : NSObject +/** + * + * @brief 用于渲染接收到的视频的视图 + */ + +@property(strong, nonatomic) ByteRTCView* _Nullable view; +/** + * + * @brief 测试用户加入的房间 ID。 + */ + +@property(copy, nonatomic) NSString *_Nonnull roomId; +/** + * + * @brief 进行音视频通话回路测试的用户 ID + */ + +@property(copy, nonatomic) NSString *_Nonnull userId; +/** + * + * @brief 对用户进房时进行鉴权验证的动态密钥,用于保证音视频通话回路测试的安全性。 + */ + +@property(copy, nonatomic) NSString *_Nonnull token; +/** + * + * @brief 是否检测音频。检测设备为系统默认音频设备。
    + * - true:是 + * - 若使用 SDK 内部采集,此时设备麦克风会自动开启,并在 audioReportInterval 值大于 0 时触发 `onLocalAudioPropertiesReport` 回调,你可以根据该回调判断麦克风的工作状态 + * - 若使用自定义采集,此时你需调用 pushExternalAudioFrame:{@link #ByteRTCEngine#pushExternalAudioFrame:} 将采集到的音频推送给 SDK + * - false:否 + */ + +@property(assign, nonatomic) BOOL enableAudio; +/** + * + * @brief 是否检测视频。PC 端默认检测列表中第一个视频设备。
    + * - true:是 + * - 若使用 SDK 内部采集,此时设备摄像头会自动开启 + * - 若使用自定义采集,此时你需调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 将采集到的视频推送给 SDK + * - false:否 + * 视频的发布参数固定为:分辨率 640px × 360px,帧率 15fps。 + */ + +@property(assign, nonatomic) BOOL enableVideo; +/** + * + * @brief 音量信息提示间隔,单位:ms,默认为 100ms
    + * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + +@property(assign, nonatomic) NSInteger audioReportInterval; +@end + +/** + * + * @type keytype + * @brief 用户信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCUserInfo : NSObject +/** + * + * @brief 用户 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + */ + +@property(copy, nonatomic) NSString *_Nonnull userId; +/** + * + * @brief 用户需要透传的额外的信息,字符长度限制为 200 字节。会在 `rtcRoom:onUserJoined:` 中回调给远端用户。 + */ + +@property(copy, nonatomic) NSString *_Nonnull extraInfo; +@end + +/** + * + * @type keytype + * @brief 房间通话统计数据,统计周期为 2s 。
    + * 用户进房成功后,SDK 会周期性地通过 `onRoomStats` 回调通知用户当前房间内的汇总统计信息。此数据结构即为回调给用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomStats : NSObject +/** +* + * @brief 本地用户在本次通话中的参与时长,单位为 s + */ + +@property(assign, nonatomic) NSInteger duration; +/** + * + * @brief 本地用户的总发送字节数 (bytes),累计值 + */ + +@property(assign, nonatomic) NSInteger txBytes; +/** + * + * @brief 本地用户的总接收字节数 (bytes),累计值 + */ + +@property(assign, nonatomic) NSInteger rxBytes; +/** + * + * @brief 发送码率(kbps),获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger txKbitrate; +/** + * + * @brief 接收码率(kbps),获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxKbitrate; +/** + * + * @brief 本地用户的音频发送码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger txAudioKBitrate; +/** + * + * @brief 本地用户的音频接收码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxAudioKBitrate; +/** + * + * @brief 本地用户的视频发送码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger txVideoKBitrate; +/** + * + * @brief 本地用户的视频接收码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxVideoKBitrate; +/** + * + * @brief 屏幕发送码率,获取该数据时的瞬时值,单位为 Kbps + */ + +@property(assign, nonatomic) NSInteger txScreenKBitrate; +/** + * + * @brief 屏幕接收码率,获取该数据时的瞬时值,单位为 Kbps + */ + +@property(assign, nonatomic) NSInteger rxScreenKBitrate; +/** + * + * @brief 当前房间内的可见用户人数,包括本地用户自身 + */ + +@property(assign, nonatomic) NSInteger userCount; +/** + * + * @brief App 现在的下行丢包率 + */ + +@property(assign, nonatomic) float rxLostrate; +/** + * + * @brief App 现在的上行丢包率 + */ + +@property(assign, nonatomic) float txLostrate; +/** + * + * @brief 客户端到服务端的往返时延 + */ + +@property(assign, nonatomic) NSInteger rtt; + + + + + + + + + + + + + + + + + + + + + + + +/** + * + * @hidden currently not available + * @brief 系统上行网络抖动(ms) + */ + +@property(assign, nonatomic) NSInteger txJitter; +/** + * + * @hidden currently not available + * @brief 系统下行网络抖动(ms) + */ + +@property(assign, nonatomic) NSInteger rxJitter; +/** + * + * @brief 蜂窝路径发送的码率 (kbps),为获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger txCellularKBitrate; +/** + * + * @brief 蜂窝路径接收码率 (kbps),为获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxCellularKBitrate; +@end + +/** + * + * @type keytype + * @brief 本地视频流统计信息,统计周期为 2s 。
    + * 本地用户发布视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的视频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalVideoStats : NSObject +/** + * + * @brief 发送码率。此次统计周期内实际发送的分辨率最大的视频流的发送码率,单位为 Kbps + */ + +@property(assign, nonatomic) float sentKBitrate; +/** + * + * @brief 采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger inputFrameRate; +/** + * + * @brief 发送帧率。此次统计周期内实际发送的分辨率最大的视频流的视频发送帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger sentFrameRate; +/** + * + * @brief 编码器输出帧率。当前编码器在此次统计周期内实际发送的分辨率最大的视频流的输出帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger encoderOutputFrameRate; +/** + * + * @brief 本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger rendererOutputFrameRate; +/** + * + * @brief 统计间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 视频丢包率。统计周期内的视频上行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float videoLossRate; +/** + * + * @brief 往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 视频编码码率。此次统计周期内的实际发送的分辨率最大的视频流视频编码码率,单位为 Kbps 。 + */ + +@property(assign, nonatomic) NSInteger encodedBitrate; +/** + * + * @brief 实际发送的分辨率最大的视频流的视频编码宽度,单位为 px 。 + */ + +@property(assign, nonatomic) NSInteger encodedFrameWidth; +/** + * + * @brief 实际发送的分辨率最大的视频流的视频编码高度,单位为 px 。 + */ + +@property(assign, nonatomic) NSInteger encodedFrameHeight; +/** + * + * @brief 此次统计周期内实际发送的分辨率最大的视频流的发送的视频帧总数。 + */ + +@property(assign, nonatomic) NSInteger encodedFrameCount; +/** + * + * @brief 编码类型。参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} 类型。 + */ + +@property(nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief 预留字段。 + */ + +@property(assign, nonatomic) BOOL isScreen; +/** + * + * @brief 视频上行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @hidden(macOS) + * @brief 视频降噪模式。具体参看 ByteRTCVideoDenoiseMode{@link #ByteRTCVideoDenoiseMode} 。 + */ + +@property(assign, nonatomic) ByteRTCVideoDenoiseMode videoDenoiseMode; +@end + +/** + * + * @type keytype + * @brief 远端视频流统计信息,统计周期为 2s 。
    + * 本地用户订阅远端视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoStats : NSObject +/** + * + * @brief 远端视频宽度。 + */ + +@property(assign, nonatomic) NSInteger width; +/** + * + * @brief 远端视频高度。 + */ + +@property(assign, nonatomic) NSInteger height; +/** + * + * @brief 远端视频丢包率。统计周期内的视频下行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float videoLossRate; +/** + * + * @brief 接收码率。统计周期内的视频接收码率,单位为 kbps 。 + */ + +@property(assign, nonatomic) float receivedKBitrate; +/** + * + * @brief 远端视频接收帧率。 + */ + +@property(assign, nonatomic) NSInteger receivedFrameRate; +/** + * + * @brief 远端视频解码输出帧率。 + */ + +@property(assign, nonatomic) NSInteger decoderOutputFrameRate; +/** + * + * @brief 远端视频渲染输出帧率。 + */ + +@property(assign, nonatomic) NSInteger renderOutputFrameRate; +/** + * + * @brief 远端视频卡顿次数。 + */ + +@property(assign, nonatomic) NSInteger stallCount; +/** + * + * @brief 远端视频卡顿时长,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger stallDuration; +/** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger e2eDelay; +/** + * + * @brief 预留字段。 + */ + +@property(assign, nonatomic) BOOL isScreen; +/** + * + * @brief 统计间隔,此次统计周期的间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,目前设置为 2s 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。 + */ + +@property(assign, nonatomic) NSInteger frozenRate; +/** + * + * @brief 编码类型。参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} 类型。 + */ + +@property(nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief SDK 订阅的远端视频流的分辨率下标。 + */ + +@property(assign, nonatomic) NSInteger videoIndex; +/** + * + * @brief 视频下行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @hidden for internal use only + * @brief 远端视频超分模式,参看 ByteRTCVideoSuperResolutionMode{@link #ByteRTCVideoSuperResolutionMode}。 + */ + +@property(assign, nonatomic) ByteRTCVideoSuperResolutionMode superResolutionMode; +/** + * + * @brief 用户体验级别的端到端延时。从发送端开始采集到接收端渲染完成的延时,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger capToRenderDelay; +/** + * + * @brief 音画同步差异,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger avSyncDiffMs; +/** + * + * @brief 视频解码平均耗时,单位 ms。 + */ + +@property(assign, nonatomic) NSInteger codecElapsePerFrame; +@end + +/** + * + * @type keytype + * @brief 本地音频流统计信息,统计周期为 2s 。
    + * 本地用户发布音频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalAudioStats : NSObject +/** + * + * @brief 音频丢包率。此次统计周期内的音频上行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float audioLossRate; +/** + * + * @brief 发送的码率。此次统计周期内的音频发送码率,单位为 kbps 。 + */ + +@property(assign, nonatomic) float sentKBitrate; +/** + * + * @brief 采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger recordSampleRate; +/** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 音频声道数。 + */ + +@property(assign, nonatomic) NSInteger numChannels; +/** + * + * @brief 音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger sentSampleRate; +/** + * + * @brief 音频上行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @brief 音频设备的采集和播放延时,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger audioDeviceLoopDelay; +/** + * + * @brief 音频编码帧率。 + */ + +@property(assign, nonatomic) double encodeFrameRate; +@end + +/** + * + * @type keytype + * @brief 远端音频流统计信息,统计周期为 2s 。
    + * 本地用户订阅远端音频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的音频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteAudioStats : NSObject +/** + * + * @brief 音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float audioLossRate; +/** + * + * @brief 接收码率。统计周期内的音频接收码率,单位为 kbps 。 + */ + +@property(assign, nonatomic) float receivedKBitrate; +/** + * + * @brief 音频卡顿次数。统计周期内的卡顿次数。 + */ + +@property(assign, nonatomic) NSInteger stallCount; +/** + * + * @brief 音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger stallDuration; +/** + * + * @brief 播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger playoutSampleRate; +/** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger e2eDelay; +/** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 客户端到服务端数据传输的往返时延,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger totalRtt; +/** + * + * @brief 远端用户发送的音频流质量。值含义参考 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} 。 + */ + +@property(assign, nonatomic) NSInteger quality; +/** + * + * @brief 因引入 jitter buffer 机制导致的延时。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger jitterBufferDelay; +/** + * + * @brief 音频声道数。 + */ + +@property(assign, nonatomic) NSInteger numChannels; +/** + * + * @brief 音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger receivedSampleRate; +/** + * + * @brief 远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。 + */ + +@property(assign, nonatomic) NSInteger frozenRate; +/** + * + * @brief 音频 PLC 样点总个数。 + */ + +@property(assign, nonatomic) NSInteger concealedSamples; +/** + * + * @brief 音频丢包补偿(PLC) 累计次数。 + */ + +@property(assign, nonatomic) NSInteger concealmentEvent; +/** + * + * @brief 音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger decSampleRate; +/** + * + * @brief 此次订阅中,对远端音频流进行解码的累计耗时。单位为 s。 + */ + +@property(assign, nonatomic) NSInteger decDuration; +/** + * + * @brief 视频下行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @brief 音频解码帧率。 + */ + +@property(assign, nonatomic) double decodeFrameRate; +@end + +/** + * + * @type keytype + * @brief 本地音/视频流统计信息以及网络状况,统计周期为 2s 。
    + * 本地用户发布音/视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalStreamStats : NSObject +/** + * + * @brief 本地设备发送音频流的统计信息,详见 ByteRTCLocalAudioStats{@link #ByteRTCLocalAudioStats} + */ + +@property(strong, nonatomic) ByteRTCLocalAudioStats *_Nonnull audioStats; +/** + * + * @brief 本地设备发送视频流的统计信息,详见 ByteRTCLocalVideoStats{@link #ByteRTCLocalVideoStats} + */ + +@property(strong, nonatomic) ByteRTCLocalVideoStats *_Nonnull videoStats; +/** + * + * @brief 所属用户的媒体流上行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality txQuality; +/** + * + * @brief 所属用户的媒体流下行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +@end + +/** + * + * @type keytype + * @brief 用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
    + * 订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteStreamStats : NSObject +/** + * + * @brief 用户 ID 。音频来源的用户 ID 。 + */ + +@property(copy, nonatomic) NSString *_Nonnull uid; +/** + * + * @brief 远端音频流的统计信息,详见 ByteRTCRemoteAudioStats{@link #ByteRTCRemoteAudioStats} + */ + +@property(strong, nonatomic) ByteRTCRemoteAudioStats *_Nonnull audioStats; +/** + * + * @brief 远端视频流的统计信息,详见 ByteRTCRemoteVideoStats{@link #ByteRTCRemoteVideoStats} + */ + +@property(strong, nonatomic) ByteRTCRemoteVideoStats *_Nonnull videoStats; +/** + * + * @brief 所属用户的媒体流上行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality txQuality; +/** + * + * @brief 所属用户的媒体流下行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +@end + +/** + * + * @type keytype + * @brief 用户信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCUser : NSObject +/** + * + * @brief 用户 ID + */ + +@property(nonatomic, copy, nullable) NSString *userId; +/** + * + * @brief 元信息 + */ + +@property(nonatomic, copy, nullable) NSString *metaData; +@end + +/** + * + * @type keytype + * @brief 用户信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteStreamKey : NSObject +/** + * + * @brief 用户 ID + */ + +@property(nonatomic, copy, nullable) NSString *userId; +/** + * + * @brief 房间 ID + */ + +@property(nonatomic, copy, nullable) NSString *roomId; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) ByteRTCStreamIndex streamIndex; +@end + +#pragma mark - EncryptHandler +/** + * + * @type callback + * @brief 自定义加密接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 通话加密 + */ + +@protocol ByteRTCEncryptHandler + +@required +/** + * + * @type api + * @brief 自定义加密。
    + * 使用设定的自定义加密方式,对编码后传输前的音视频帧数据进行加密。
    + * 暂不支持对原始音视频帧进行加密。 + * @param rawData 原始音视频帧数据 + * @return 加密后的数据
    + * - 非空,表示加密后的数据 + * - 为空,表示数据被丢弃 + * @note + * - 使用此接口进行自定义加密前,你必须先设置自定义加密方式,参看 `setCustomizeEncryptHandler:`。 + * - 使用 onDecryptData:{@link #ByteRTCEncryptHandler#onDecryptData:} 对已加密的音视频帧数据进行解密。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + +- (NSData * _Nonnull) onEncryptData:(NSData * _Nonnull)rawData; + +@required +/** + * + * @type api + * @brief 自定义解密。
    + * 对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 onEncryptData:{@link #ByteRTCEncryptHandler#onEncryptData:}。 + * @param rawData 收到的已加密的音视频帧数据 + * @return 解密后的数据
    + * - 非空,表示解密后的数据 + * - 为空,表示丢弃该帧 + * @note + * - 使用此接口进行解密前,你必须先设定解密方式,参看 `setCustomizeEncryptHandler:`。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + +- (NSData * _Nonnull) onDecryptData:(NSData * _Nonnull)rawData; +@end + +#pragma mark - FileRecording + +/** + * + * @type keytype + * @brief 本地录制参数配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRecordingConfig : NSObject +/** + * + * @brief 录制文件保存的绝对路径,需精确到文件夹,文件名由 RTC 自动生成。你需要确保对该路径具有读写权限。 + */ + +@property(strong, nonatomic) NSString* _Nullable dirPath; +/** + * + * @brief 录制存储文件格式,参看 ByteRTCRecordingFileType{@link #ByteRTCRecordingFileType} + */ + +@property(assign, nonatomic) ByteRTCRecordingFileType recordingFileType; +@end + +/** + * + * @type keytype + * @brief 本地录制进度 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRecordingProgress : NSObject +/** + * + * @brief 当前文件的累计录制时长,单位:毫秒 + */ + +@property(assign, nonatomic) unsigned long long duration; +/** + * + * @brief 当前录制文件的大小,单位:byte + */ + +@property(assign, nonatomic) unsigned long long fileSize; +@end + +/** + * + * @type keytype + * @brief 本地录制的详细信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRecordingInfo : NSObject +/** + * + * @brief 录制文件的绝对路径,包含文件名和文件后缀 + */ + +@property(strong, nonatomic) NSString* _Nullable filePath; +/** + * + * @brief 录制文件的视频编码类型,参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} + */ + +@property(assign, nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief 录制视频的宽,单位:像素。纯音频录制请忽略该字段 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 录制视频的高,单位:像素。纯音频录制请忽略该字段 + */ + +@property(nonatomic, assign) NSInteger height; +@end + +/** + * + * @type keytype + * @brief 媒体流信息同步的相关配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCStreamSyncInfoConfig : NSObject + +/** + * + * @brief 消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。 + */ + +@property(assign, nonatomic) int repeatCount; +/** + * + * @brief 媒体流信息同步的流类型,见 ByteRTCSyncInfoStreamType{@link #ByteRTCSyncInfoStreamType} 。 + */ + +@property(assign, nonatomic) ByteRTCSyncInfoStreamType streamType; +@end + +/** + * + * @type keytype + * @brief 媒体流跨房间转发的目标房间的相关信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCForwardStreamConfiguration: NSObject + /** + * + * @brief 跨房间转发媒体流过程中目标房间 ID + */ + +@property(strong, nonatomic) NSString* _Nullable roomId; + /** + * + * @brief 使用转发目标房间 RoomID 和 UserID 生成 Token。
    + * 测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。
    + * 如果 Token 无效,转发失败。 + */ + +@property(strong, nonatomic) NSString* _Nullable token; +@end + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间的状态和错误信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCForwardStreamStateInfo: NSObject + /** + * + * @brief 跨房间转发媒体流过程中目标房间 ID
    + * 空字符串代表所有目标房间 + */ + +@property(strong, nonatomic) NSString* _Nullable roomId; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间的状态,参看 ByteRTCForwardStreamState{@link #ByteRTCForwardStreamState} + */ + +@property(assign, nonatomic) ByteRTCForwardStreamState state; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ByteRTCForwardStreamError{@link #ByteRTCForwardStreamError} + */ + +@property(assign, nonatomic) ByteRTCForwardStreamError error; +@end + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间发生的事件 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCForwardStreamEventInfo: NSObject + /** + * + * @brief 跨房间转发媒体流过程中的发生该事件的目标房间 ID
    + * 空字符串代表所有目标房间 + */ + +@property(strong, nonatomic) NSString* _Nullable roomId; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间发生的事件,参看 ByteRTCForwardStreamEvent{@link #ByteRTCForwardStreamEvent} + */ + +@property(assign, nonatomic) ByteRTCForwardStreamEvent event; +@end + +/** + * + * @type keytype + * @brief 上行/下行网络质量 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCNetworkQualityStats: NSObject +/** + * + * @brief 用户 ID + */ + +@property(strong, nonatomic) NSString* _Nonnull uid; +/** + * + * @brief 本端的上行/下行的丢包率,范围 [0.0,1.0]
    + * 当 `uid` 为本地用户时,代表发布流的上行丢包率。
    + * 当 `uid` 为远端用户时,代表接收所有订阅流的下行丢包率。 + */ + +@property(assign, nonatomic) double lossRatio; +/** + * + * @brief 当 `uid` 为本地用户时有效,客户端到服务端的往返延时(RTT),单位:ms + */ + +@property(assign, nonatomic) int rtt; +/** + * + * @brief 本端的音视频 RTP 包 2 秒内的平均传输速率,单位:bps
    + * 当 `uid` 为本地用户时,代表发送速率。
    + * 当 `uid` 为远端用户时,代表所有订阅流的接收速率。 + */ + +@property(assign, nonatomic) int totalBandwidth; +/** + * + * @brief 上行网络质量评分,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality}。 + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality txQuality; +/** + * + * @brief 下行网络质量评分,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality}。 + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality; +@end + +/** + * + * @type keytype + * @brief 网络时间信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCNetworkTimeInfo: NSObject +/** + * + * @brief 网络时间,单位:ms + */ + +@property(assign, nonatomic) int64_t timestamp; +@end + +#pragma mark - ByteRTCDeviceCollection +/** + * + * @hidden(iOS) + * @type api + * @brief 音视频设备相关的信息 + * @list Encryption + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCDeviceCollection : NSObject +/** + * + * @type api + * @brief 获取当前音视频设备数量 + * @return 音视频设备数量 + * @list 引擎管理 + */ + +- (int)getCount; +/** + * + * @type api + * @brief 获取音频设备信息,可根据索引号、设备名称、设备 ID 获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #ByteRTCDeviceCollection#getCount} 返回值。 + * @param deviceName 设备名称 + * @param deviceID 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + +- (int)getDevice:(int)index DeviceName:(NSString * _Nonnull * _Nonnull)deviceName DeviceID:(NSString * _Nonnull * _Nonnull) deviceID; +@end + +/** + * + * @type keytype + * @brief 音频 dump 状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioDumpStatus){ + /** + * + * @brief 音频 dump 启动失败 + */ + + ByteRTCAudioDumpStartFailure = 0, + /** + * + * @brief 音频 dump 启动成功 + */ + + ByteRTCAudioDumpStartSuccess = 1, + /** + * + * @brief 音频 dump 停止失败 + */ + + ByteRTCAudioDumpStopFailure = 2, + /** + * + * @brief 音频 dump 停止成功 + */ + + ByteRTCAudioDumpStopSuccess = 3, + /** + * + * @brief 音频 dump 运行失败 + */ + + ByteRTCAudioDumpRunningFailure = 4, + /** + * + * @brief 音频 dump 运行成功 + */ + + ByteRTCAudioDumpRunningSuccess = 5, +}; + + +/** + * + * @type keytype + * @brief 通话前探测的停止原因
    + * `rtcEngine:onNetworkDetectionStopped:` 回调的参数类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionStopReason) { + /** + * + * @brief 用户主动停止。 + */ + + ByteRTCNetworkDetectionStopReasonUser = 0, + /** + * + * @brief 探测超过三分钟。 + */ + + ByteRTCNetworkDetectionStopReasonTimeout = 1, + /** + * + * @brief 探测网络连接断开。
    + * 当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。 + */ + + ByteRTCNetworkDetectionStopReasonConnectionLost = 2, + /** + * + * @brief 本地开始推拉流,停止探测。 + */ + + ByteRTCNetworkDetectionStopReasonStreaming = 3, + /** + * + * @brief 网络探测失败,内部异常 + */ + + ByteRTCNetworkDetectionStopReasonInnerErr = 4, +}; + +/** + * + * @type errorcode + * @brief 开始探测的返回值
    + * `startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth:` 返回对象类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCNetworkDetectionStartReturn) { + /** + * + * @brief 成功开始探测。 + */ + + ByteRTCNetworkDetectionStartReturnSuccess = 0, + /** + * + * @brief 开始探测失败。参数错误,上下行探测均为 `false`,或期望带宽超过了范围 [100,10000] + */ + + ByteRTCNetworkDetectionStartReturnParamErr = 1, + /** + * + * @brief 开始探测失败。失败原因为,本地已经开始推拉流 + */ + + ByteRTCNetworkDetectionStartReturnStreaming = 2, + /** + * + * @brief 已经开始探测,无需重复开启 + */ + + ByteRTCNetworkDetectionStartReturnStarted = 3, + /** + * + * @brief 不支持该功能 + */ + + ByteRTCNNetworkDetectionStartReturnNotSupport = 4, +}; + +/** + * + * @type keytype + * @brief 通话前探测链接的类型
    + * `rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter:` 回调的参数类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionLinkType) { + /** + * + * @brief 上行网络探测。 + */ + + ByteRTCNetworkDetectionLinkTypeUp = 0, + /** + * + * @brief 下行网络探测。 + */ + + ByteRTCNetworkDetectionLinkTypeDown = 1, +}; + +/** + * + * @type keytype + * @brief 通话前回声检测结果 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCHardwareEchoDetectionResult) { + /** + * + * @brief 主动调用 `stopHardwareEchoDetection` 结束流程时,未有回声检测结果。 + */ + + ByteRTCHardwareEchoDetectionCanceled = 0, + /** + * + * @brief 未检测出结果。建议重试,如果仍然失败请联系技术支持协助排查。 + */ + + ByteRTCHardwareEchoDetectionUnknown = 1, + /** + * + * @brief 无回声 + */ + + ByteRTCHardwareEchoDetectionNormal = 2, + /** + * + * @brief 有回声。可通过 UI 建议用户使用耳机设备入会。 + */ + + ByteRTCHardwareEchoDetectionPoor = 3, +}; + +/** + * + * @type keytype + * @brief 音频选路优先级设置 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCAudioSelectionPriority) { + /** + * + * @brief 正常,参加音频选路 + */ + + ByteRTCAudioSelectionPriorityNormal = 0, + /** + * + * @brief 高优先级,跳过音频选路 + */ + + ByteRTCAudioSelectionPriorityHigh = 1 +}; + +/** + * + * @type keytype + * @brief 设置房间附加消息结果。 + */ + +typedef NS_ENUM(NSInteger,ByteRTCSetRoomExtraInfoResult) { + /** + * + * @brief 设置房间附加信息成功 + */ + + ByteRTCSetRoomExtraInfoResultSuccess = 0, + /** + * + * @brief 设置失败,尚未加入房间 + */ + + ByteRTCSetRoomExtraInfoResultNotJoinRoom = -1, + /** + * + * @brief 设置失败,key 指针为空 + */ + + ByteRTCSetRoomExtraInfoResultKeyIsNull = -2, + /** + * + * @brief 设置失败,value 指针为空 + */ + + ByteRTCSetRoomExtraInfoResultValueIsNull = -3, + /** + * + * @brief 设置失败,未知错误 + */ + + ByteRTCSetRoomExtraInfoResultUnknow = -99, + /** + * + * @brief 设置失败,key 长度为 0 + */ + + ByteRTCSetRoomExtraInfoResultKeyIsEmpty = -400, + /** + * + * @brief 调用 `setRoomExtraInfo` 过于频繁,建议不超过 10 次/秒。 + */ + + ByteRTCSetRoomExtraInfoResultTooOften = -406, + /** + * + * @brief 设置失败,用户已调用 `setUserVisibility` 将自身设为隐身状态。 + */ + + ByteRTCSetRoomExtraInfoResultSilentUser = -412, + /** + * + * @brief 设置失败,Key 长度超过 10 字节 + */ + + ByteRTCSetRoomExtraInfoResultKeyTooLong = -413, + /** + * + * @brief 设置失败,value 长度超过 128 字节 + */ + + ByteRTCSetRoomExtraInfoResultValueTooLong = -414, + /** + * + * @brief 设置失败,服务器错误 + */ + + ByteRTCSetRoomExtraInfoResultServerError = -500 +}; +/** + * + * @type keytype + * @hidden internal use only + * @brief 特效错误类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEffectErrorType) { + /** + * + * @hidden 仅用于会议 + * @brief 虚拟背景设置错误。 + */ + + ByteRTCEffectErrorVirtualBackgroundFailure = 1, + /** + * + * @hidden 仅用于会议 + * @brief 特效独立进程崩溃。 + */ + + ByteRTCEffectErrorChildProcTerminate = 2 +}; + +#pragma mark - ByteRTCSubtitle +/** + * + * @type keytype + * @brief 字幕任务状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubtitleState) { + /** + * + * @brief 开启字幕。 + */ + + ByteRTCSubtitleStateStarted = 0, + /** + * + * @brief 关闭字幕。 + */ + + ByteRTCSubtitleStateStoped = 1, + /** + * + * @brief 字幕任务出现错误。 + */ + + ByteRTCSubtitleStateError = 2 +}; +/** + * + * @type keytype + * @brief 字幕模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubtitleMode) { + /** + * + * @brief 识别模式。在此模式下,房间内用户语音会被转为文字。 + */ + + ByteRTCSubtitleModeRecognition = 0, + /** + * + * @brief 翻译模式。在此模式下,房间内用户语音会先被转为文字,再被翻译为目标语言。 + */ + + ByteRTCSubtitleModeTranslation = 1 +}; +/** + * + * @type errorcode + * @brief 字幕任务错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubtitleErrorCode) { + /** + * + * @brief 客户端无法识别云端媒体处理发送的错误码。 + */ + + ByteRTCSubtitleErrorCodeUnknow = -1, + /** + * + * @brief 字幕已开启。 + */ + + ByteRTCSubtitleErrorCodeSuccess = 0, + /** + * + * @brief 云端媒体处理内部出现错误,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodePostProcessError = 1, + /** + * + * @brief 第三方服务连接失败,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodeASRConnectionError = 2, + /** + * + * @brief 第三方服务内部出现错误,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodeASRServiceError = 3, + /** + * + * @brief 未进房导致调用`startSubtitle`失败。请加入房间后再调用此方法。 + */ + + ByteRTCSubtitleErrorCodeBeforeJoinRoom = 4, + /** + * + * @brief 字幕已开启,无需重复调用 `startSubtitle`。 + */ + + ByteRTCSubtitleErrorCodeAlreadyOn = 5, + /** + * + * @brief 用户选择的目标语言目前暂不支持。 + */ + + ByteRTCSubtitleErrorCodeUnsupportedLanguage = 6, + /** + * + * @brief 云端媒体处理超时未响应,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodePostProcessTimeout = 7 +}; +/** + * + * @type keytype + * @brief 字幕配置信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubtitleConfig : NSObject +/** + * + * @brief 字幕模式。可以根据需要选择识别和翻译两种模式。开启识别模式,会将识别后的用户语音转化成文字;开启翻译模式,会在语音识别后进行翻译。参看 ByteRTCSubtitleMode{@link #ByteRTCSubtitleMode}。 + */ + +@property(assign, nonatomic) ByteRTCSubtitleMode mode; +/** + * + * @brief 目标翻译语言。可点击 [语言支持](https: + */ + +@property(copy, nonatomic) NSString *_Nonnull targetLanguage; +@end +/** + * + * @type keytype + * @brief 字幕具体内容。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubtitleMessage : NSObject +/** + * + * @brief 说话者的用户 ID。 + */ + +@property(copy, nonatomic) NSString *_Nonnull userId; +/** + * + * @brief 语音识别或翻译后的文本, 采用 UTF-8 编码。 + */ + +@property(copy, nonatomic) NSString *_Nonnull text; +/** + * + * @brief 字幕语种,根据字幕模式为原文或译文对应的语种。 + */ + +@property(copy, nonatomic) NSString *_Nonnull language; +/** + * + * @brief 字幕模式,参看 ByteRTCSubtitleMode{@link #ByteRTCSubtitleMode}。 + */ + +@property(assign, nonatomic) NSInteger mode; +/** + * + * @brief 语音识别或翻译后形成的文本的序列号,同一发言人的完整发言和不完整发言会按递增顺序单独分别编号。 + */ + +@property(assign, nonatomic) NSInteger sequence; +/** + * + * @brief 语音识别出的文本是否为一段完整的一句话。 True 代表是, False 代表不是。 + */ + +@property(assign, nonatomic) BOOL definite; +@end + +/** + * + * @hidden + * @type keytype + * @brief 死锁时的相关报错 + * @hidden internal use only + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCDeadLockMsg : NSObject +/** + * + * @brief session_id + */ + +@property (nonatomic, strong) NSString* _Nonnull blockSessionId; +/** + * + * @brief 死锁线程等待链 + */ + +@property (nonatomic, strong) NSString* _Nonnull blockingPaths; +/** + * + * @brief 是否卡住 rtc 主线程 + */ + +@property(nonatomic) BOOL isCritical ; +@end + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 字幕模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioAEDType) { + /** + * + * @brief 未检测到音乐场景 + */ + + ByteRTCAudioAEDTypeNoMusic = 0, + /** + * + * @brief 检测到音乐场景。 + */ + + ByteRTCAudioAEDTypeMusic = 1 +}; + + +/** + * + * @type keytype + * @brief 游戏房间类型 + */ + +typedef NS_ENUM(NSInteger, GameRoomType) { + /** + * + * @brief 小队房间 + */ + + GameRoomTypeTeam = 0, + /** + * + * @brief 世界房间 + */ + + GameRoomTypeWorld = 1, +}; + +/** + * + * @type keytype + * @brief 流信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCStreamInfo : NSObject +/** + * + * @brief 流 ID + */ + +@property(nonatomic) NSString * _Nonnull streamId; +/** + * + * @brief 用户 ID + */ + +@property(nonatomic) NSString * _Nonnull userId; +/** + * + * @brief 房间 ID + */ + +@property(nonatomic) NSString * _Nonnull roomId; +/** + * + * @brief 流索引 + */ + +@property(nonatomic, assign) NSInteger streamIndex; +/** + * + * @brief 预留字段。 + */ + +@property(assign, nonatomic) BOOL isScreen; +@end + + +/** + * + * @type keytype + * @brief 游戏场景类型 + */ + +typedef NS_ENUM(NSInteger, GameSceneType) { + /** + * + * @brief 普通场景。
    + * 同一个小队房间的队友,仅支持在同一个世界房间内通话。 + */ + + GameSceneTypeNormal = 0, + /** + * + * @brief 主题公园场景。
    + * 同一个小队房间的队友,支持跨世界房间通话。 + */ + + GameSceneTypeThemePark = 1, +}; + +/** + * + * @type keytype + * @brief 创建游戏房间参数 + */ + +BYTERTC_APPLE_EXPORT @interface GameRoomConfig: NSObject +/** + * + * @type keytype + * @brief 游戏房间类型,参看 GameRoomType{@link #GameRoomType},默认为 `GAME_RTC_ROOM_TYPE_TEAM`(小队房间),进房后不可更改。 + */ + +@property(assign, nonatomic) GameRoomType gameRoomType; +/** + * + * @type keytype + * @brief 游戏场景类型,参看 GameSceneType{@link #GameSceneType},默认为 `GAME_SCENE_TYPE_NORMAL`(普通场景),进房后不可更改。 + */ + +@property(assign, nonatomic) GameSceneType gameSceneType; +@end + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaPlayer.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaPlayer.h new file mode 100644 index 0000000..f4bfbe8 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaPlayer.h @@ -0,0 +1,431 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCMediaPlayer +*/ + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type callback + * @brief 本地音频文件混音的音频帧观察者。 + * @list + */ + +@protocol ByteRTCMediaPlayerAudioFrameObserver +/** + * + * @type callback + * @brief 当本地音频文件混音时,回调播放的音频帧。 + * @param playerId 播放器 ID + * @param audioFrame 参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @list 混音 + */ + +- (void)onFrame:(int)playerId audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; + +@end +/** + * + * @type callback + * @brief ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 对应的回调句柄。你必须调用 setEventHandler:{@link #ByteRTCMediaPlayer#setEventHandler:} 完成设置后,才能收到对应回调。 + * @list Audio Mixing + */ + +@protocol ByteRTCMediaPlayerEventHandler +/** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param playerId ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 的 ID。通过 getMediaPlayer:{@link #ByteRTCEngine#getMediaPlayer:} 设置。 + * @param state 混音状态。参考 ByteRTCPlayerState{@link #ByteRTCPlayerState}。 + * @param error 错误码。参考 ByteRTCPlayerError{@link #ByteRTCPlayerError}。 + * @list 混音 + */ + +-(void)onMediaPlayerStateChanged:(int)playerId state:(ByteRTCPlayerState)state error:(ByteRTCPlayerError)error; +/** + * + * @type callback + * @brief 播放进度周期性回调。回调周期通过 setProgressInterval:{@link #ByteRTCMediaPlayer#setProgressInterval:} 设置。 + * @param playerId ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 的 ID。通过 getMediaPlayer:{@link #ByteRTCEngine#getMediaPlayer:} 设置。 + * @param progress 进度。单位 ms。 + * @list 混音 + */ + +-(void)onMediaPlayerPlayingProgress:(int)playerId progress:(int64_t)progress; +/** + * + * @valid since 3.59 + * @type callback + * @brief 播放事件回调。调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 和 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 后,会触发此回调。 + * @param playerId ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 的 ID。通过 getMediaPlayer:{@link #ByteRTCEngine#getMediaPlayer:} 设置。 + * @param event 播放器事件。参看 ByteRTCPlayerEvent{@link #ByteRTCPlayerEvent}。 + * @param message 事件描述信息,可能为空。 + * @list 混音 + */ + +-(void)onMediaPlayerEvent:(int)playerId event:(ByteRTCPlayerEvent)event message:(NSString*_Nullable)message; + +@end +/** + * + * @valid since 3.53 + * @type api + * @brief 音乐播放器
    + * 调用 setEventHandler:{@link #ByteRTCMediaPlayer#setEventHandler:} 设置回调句柄以获取相关回调。 + * @list Audio Mixing + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaPlayer :NSObject +/** + * + * @type api + * @brief 打开音乐文件。
    + * 一个播放器实例仅能够同时打开一个音乐文件。如果需要同时打开多个音乐文件,请创建多个音乐播放器实例。
    + * 要播放 PCM 格式的音频数据,参看 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:}。`openWithCustomSource` 和此 API 互斥。 + * @param filePath 音乐文件路径。
    + * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
    + * 推荐的采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
    + * 不同平台支持的本地文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYYYY
    iOS/macOSYYYYYY
    WindowsYYYYYYYY
    + * 不同平台支持的在线文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYY
    iOS/macOSYYYY
    WindowsYYYYYYY
    + * @param config 详见 ByteRTCMediaPlayerConfig{@link #ByteRTCMediaPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 混音 + */ + +- (int)open:(NSString *_Nullable)filePath config:(ByteRTCMediaPlayerConfig *_Nullable)config; +/** + * + * @type api + * @brief 播放音乐。你仅需要在调用 open:config:{@link #ByteRTCMediaPlayer#open:config:},且未开启自动播放时,调用此方法。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 要播放 PCM 格式的音频数据,参看 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:}。`openWithCustomSource` 和此 API 互斥。 + * - 调用本方法播放音频文件后,可调用 stop{@link #ByteRTCMediaPlayer#stop} 方法暂停播放。 + * @list 混音 + */ + +- (int)start; +/** + * + * @type api + * @brief 启动音频裸数据混音。
    + * 要播放音乐文件,参看 open:config:{@link #ByteRTCMediaPlayer#open:config:}。`open` 与此 API 互斥。 + * @param source 数据源,详见 ByteRTCMediaPlayerCustomSource{@link #ByteRTCMediaPlayerCustomSource} + * @param config 详见 ByteRTCMediaPlayerConfig{@link #ByteRTCMediaPlayerConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法启动后,再调用 pushExternalAudioFrame:{@link #ByteRTCEngine#pushExternalAudioFrame:} 推送音频数据,才会开始混音。 + * - 如要结束 PCM 音频数据混音,调用 stop{@link #ByteRTCMediaPlayer#stop}。 + * @list 混音 + */ + +- (int)openWithCustomSource:(ByteRTCMediaPlayerCustomSource *_Nullable)source config:(ByteRTCMediaPlayerConfig *_Nullable)config; +/** + * + * @type api + * @brief 调用 open:config:{@link #ByteRTCMediaPlayer#open:config:}, start{@link #ByteRTCMediaPlayer#start}, 或 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 开始播放后,可以调用本方法停止。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 混音 + */ + +- (int)stop; +/** + * + * @type api + * @brief 调用 open:config:{@link #ByteRTCMediaPlayer#open:config:},或 start{@link #ByteRTCMediaPlayer#start} 开始播放音频文件后,调用本方法暂停播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法暂停播放后,可调用 resume{@link #ByteRTCMediaPlayer#resume} 恢复播放。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)pause; +/** + * + * @type api + * @brief 调用 pause{@link #ByteRTCMediaPlayer#pause} 暂停音频播放后,调用本方法恢复播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)resume; +/** + * + * @type api + * @brief 调节指定混音的音量大小,包括音乐文件混音和 PCM 混音。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @param type 详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * @list 混音 + */ + +- (int)setVolume:(int)volume type:(ByteRTCAudioMixingType)type; +/** + * + * @type api + * @brief 获取当前音量 + * @param type 详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType}。 + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在音频播放进行状态时,调用此方法。包括音乐文件混音和 PCM 混音。 + * @list 混音 + */ + +- (int)getVolume:(ByteRTCAudioMixingType)type; +/** + * + * @type api + * @brief 获取音乐文件时长。 + * @return + * - >0: 成功, 音乐文件时长,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getTotalDuration; +/** + * + * @type api + * @brief 获取混音音乐文件的实际播放时长,单位为毫秒。 + * @return + * - >0: 实际播放时长。 + * - < 0: 失败。 + * @note + * - 实际播放时长指的是歌曲不受停止、跳转、倍速、卡顿影响的播放时长。例如,若歌曲正常播放到 1:30 时停止播放 30s 或跳转进度到 2:00, 随后继续正常播放 2 分钟,则实际播放时长为 3 分 30 秒。 + * - 仅在音频播放进行状态,且 setProgressInterval:{@link #ByteRTCMediaPlayer#setProgressInterval:} 设置间隔大于 `0` 时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getPlaybackDuration; +/** + * + * @type api + * @brief 获取音乐文件播放进度。 + * @return + * - >0: 成功, 音乐文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getPosition; +/** + * + * @valid since 3.59 + * @type api + * @brief 获取播放器状态 + * @return 播放器当前状态,参看 ByteRTCPlayerState{@link #ByteRTCPlayerState}。 + * @note 仅在音频实例创建后,调用此方法。 + * @list 混音 + */ + +- (ByteRTCPlayerState)getState; +/** + * + * @type api + * @brief 开启变调功能,多用于 K 歌场景。 + * @param pitch 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音乐文件混音,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setAudioPitch:(int)pitch; +/** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param position 音乐文件起始播放位置,单位为毫秒。
    + * 你可以通过 getTotalDuration{@link #ByteRTCMediaPlayer#getTotalDuration} 获取音乐文件总时长,position 的值应小于音乐文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 调用本接口后,会收到 onMediaPlayerEvent:event:message:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerEvent:event:message:} 回调。 + * @list 混音 + */ + +- (int)setPosition:(int)position; +/** + * + * @type api + * @brief 设置当前音乐文件的声道模式 + * @param mode 声道模式。默认的声道模式和源文件一致,详见 ByteRTCAudioMixingDualMonoMode{@link #ByteRTCAudioMixingDualMonoMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setAudioDualMonoMode:(ByteRTCAudioMixingDualMonoMode)mode; +/** + * + * @type api + * @brief 获取当前音乐文件的音轨数 + * @return + >= 0:成功,返回当前音乐文件的音轨数 + * - < 0:方法调用失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getAudioTrackCount; +/** + * + * @type api + * @brief 指定当前音乐文件的播放音轨 + * @param index 指定的播放音轨,从 0 开始,取值范围为 `[0, getAudioTrackCount()-1]`。
    + * 设置的参数值需要小于 getAudioTrackCount{@link #ByteRTCMediaPlayer#getAudioTrackCount} 的返回值 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * - 调用本接口后,会收到 onMediaPlayerEvent:event:message:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerEvent:event:message:} 回调。 + * @list 混音 + */ + +- (int)selectAudioTrack:(int)index; +/** + * + * @type api + * @brief 设置播放速度 + * @param speed 播放速度与原始文件速度的比例,单位:%,取值范围为 `[50,200]`,默认值为 100。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件可用,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setPlaybackSpeed:(int)speed; +/** + * + * @type api + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress:progress:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerPlayingProgress:progress:} 的间隔。 + * @param interval 时间间隔,单位毫秒。
    + * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setProgressInterval:(int64_t)interval; +/** + * + * @type api + * @brief 如果你需要使用 enableVocalInstrumentBalance:{@link #ByteRTCEngine#enableVocalInstrumentBalance:} 对音频文件/PCM 音频数据设置音量均衡,你必须通过此接口传入其原始响度。 + * @param loudness 原始响度,单位:lufs,取值范围为 `[-70.0, 0.0]`。
    + * 当设置的值小于 -70.0lufs 时,则默认调整为 -70.0lufs,大于 0.0lufs 时,则不对该响度做音量均衡处理。默认值为 1.0lufs,即不做处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件和音频裸数据播放都可用。 + * @list 混音 + */ + +- (int)setLoudness:(float)loudness; +/** + * + * @type api + * @brief 注册回调句柄以在本地音乐文件混音时,收到相关回调。 + * @param observer 参看 ByteRTCMediaPlayerAudioFrameObserver{@link #ByteRTCMediaPlayerAudioFrameObserver}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)registerAudioFrameObserver:(_Nullable id)observer; +/** + * + * @type api + * @brief 推送用于混音的 PCM 音频帧数据 + * @param audioFrame 音频帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。
    + * - 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return + * - 0: 成功 + * - < 0: 失败 + * @note + * - 调用该方法前,须通过 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 启动外部音频流混音。 + * - 使用参考建议:首次推送数据,请在应用侧先缓存一定数据(如 200 毫秒),然后一次性推送过去;此后的推送操作定时 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + * - 如果要暂停播放,暂停推送即可。 + * @list 混音 + */ + +- (int)pushExternalAudioFrame:(ByteRTCAudioFrame *_Nullable)audioFrame; +/** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 ByteRTCMediaPlayerEventHandler{@link #ByteRTCMediaPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + +- (int)setEventHandler:(_Nullable id)handler; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRangeAudio.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRangeAudio.h new file mode 100644 index 0000000..b06e87c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRangeAudio.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief range audio interface + */ + +#pragma once + +#import +#import "ByteRTCAudioDefines.h" + +/** + * + * @type keytype + * @brief 空间音频音量随距离衰减模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAttenuationType) { + /** + * + * @brief 不随距离衰减 + */ + + ByteRTCAttenuationTypeNone = 0, + /** + * + * @brief 线性衰减,音量随距离增大而线性减小 + */ + + ByteRTCAttenuationTypeLinear = 1, + /** + * + * @brief 指数型衰减,音量随距离增大进行指数衰减 + */ + + ByteRTCAttenuationTypeExponential = 2 +}; + +/** + * + * @type keytype + * @brief 本地用户能收听到、且具有衰减效果的音频接收范围 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCReceiveRange : NSObject +/** + * + * @brief 能够接收语音、并且具有衰减效果的最小距离值,该值须 ≥ 0,但 ≤ max。
    + * 小于该值的范围内没有范围语音效果,即收听到的音频音量相同。 + */ + +@property(nonatomic, assign) int min; +/** + * + * @brief 能够收听语音的最大距离值,该值须 > 0 且 ≥ min。
    + * 当收听者和声源距离处于 [min, max) 之间时,收听到的音量根据距离呈衰减效果。
    + * 超出该值范围的音频将无法收听到。 + */ + +@property(nonatomic, assign) int max; +@end +/** + * + * @type api + * @brief 范围语音接口实例 + * @list + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRangeAudio :NSObject +/** + * + * @type api + * @brief 开启/关闭范围语音功能。
    + * 范围语音是指,在同一 RTC 房间中设定的音频接收距离范围内,本地用户收听到的远端用户音频音量会随着远端用户的靠近/远离而放大/衰减;若远端用户在房间内的位置超出设定范围,则本地用户无法接收其音频。音频接收范围设置参看 updateReceiveRange:{@link #ByteRTCRangeAudio#updateReceiveRange:}。 + * @param enable 是否开启范围语音功能:
    + * - YES: 开启 + * - NO: 关闭(默认) + * @note 该方法进房前后都可调用,为保证进房后范围语音效果的平滑切换,你需在该方法前先调用 updatePosition:{@link #ByteRTCRangeAudio#updatePosition:} 设置自身位置坐标,然后开启该方法收听范围语音效果。 + * @list 高级功能 + */ + +- (void)enableRangeAudio:(BOOL)enable; +/** + * + * @type api + * @brief 更新本地用户的音频收听范围。 + * @param range 音频收听范围,参看 ByteRTCReceiveRange{@link #ByteRTCReceiveRange}。 + * @return 方法调用结果:
    + * - 0:成功; + * - !0: 失败。 + * @list 高级功能 + */ + +- (int)updateReceiveRange:(ByteRTCReceiveRange* _Nonnull) range; +/** + * + * @type api + * @brief 更新本地用户在房间内空间直角坐标系中的位置坐标。 + * @param pos 三维坐标的值,默认为 [0, 0, 0],参看 ByteRTCPosition{@link #ByteRTCPosition}. + * @return 方法调用结果:
    + * - 0:成功; + * - !0:失败。 + * @note 调用该接口更新坐标后,你需调用 enableRangeAudio:{@link #ByteRTCRangeAudio#enableRangeAudio:} 开启范围语音功能以收听范围语音效果。 + * @list 高级功能 + */ + +- (int)updatePosition:(ByteRTCPosition* _Nonnull) pos; +/** + * + * @type api + * @brief 设置范围语音的音量衰减模式。 + * @param type 音量衰减模式。默认为线性衰减。详见 ByteRTCAttenuationType{@link #ByteRTCAttenuationType}。 + * @param coefficient 指数衰减模式下的音量衰减系数,默认值为 1。范围 [0.1,100],推荐设置为 `50`。数值越大,音量的衰减速度越快。 + * @return 调用是否成功
    + * - `0`:调用成功 + * - `-1`:调用失败。原因为在调用 enableRangeAudio:{@link #ByteRTCRangeAudio#enableRangeAudio:} 开启范围语音前或进房前调用本接口 + * @note 音量衰减范围通过 updateReceiveRange:{@link #ByteRTCRangeAudio#updateReceiveRange:} 进行设置。 + * @list 高级功能 + */ + +- (int)setAttenuationModel:(ByteRTCAttenuationType) type coefficient:(float)coefficient; +/** + * + * @type api + * @brief 添加标签组,用于标记相互之间通话不衰减的用户组。
    + * 在同一个 RTC 房间中,如果多个用户的标签组之间有交集,那么,他们之间互相通话时,通话不衰减。
    + * 比如,用户身处多个队伍,队伍成员间通话不衰减。那么,可以为每个队伍绑定专属标签,每个用户的标签组包含用户所属各个队伍的标签。 + * @param flags 标签组。 + * @list 高级功能 + */ + +- (void) setNoAttenuationFlags:(NSArray *_Nonnull)flags; + +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRtsDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRtsDefines.h new file mode 100644 index 0000000..e950d2b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRtsDefines.h @@ -0,0 +1,1183 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Common Defines +*/ + +#import +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR +#import +typedef UIView ByteRTCView; +typedef UIImage ByteRTCImage; +#elif TARGET_OS_MAC +#import +typedef NSView ByteRTCView; +typedef NSImage ByteRTCImage; +#endif + +#ifdef __APPLE__ +#define _BYTERTC_PLATFORM_APPLE 1 +#include +#if TARGET_OS_IPHONE +#define _BYTERTC_PLATFORM_MAC 0 +#define _BYTERTC_PLATFORM_IOS 1 +#elif TARGET_IPHONE_SIMULATOR +#define _BYTERTC_PLATFORM_MAC 0 +#define _BYTERTC_PLATFORM_IOS 1 +#elif TARGET_OS_MAC +#define _BYTERTC_PLATFORM_MAC 1 +#define _BYTERTC_PLATFORM_IOS 0 +#else +#error "Unknown Apple platform" +#endif +#endif + +#define BYTERTC_TARGET_MAC (_BYTERTC_PLATFORM_MAC == 1) +#define BYTERTC_TARGET_IOS (_BYTERTC_PLATFORM_IOS == 1) + +#define BYTERTC_APPLE_EXPORT __attribute__((visibility("default"))) + + +/** + * + * @type keytype + * @hidden currently not available + */ + +typedef NS_ENUM(NSInteger, ByteRTSReturnStatus) { + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusSuccess = 0, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusFailure = -1, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusParameterErr = -2, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusWrongState = -3, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusHasInRoom = -4, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusHasInLogin = -5, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusRoomIdInUse = -8, +}; + + +/** + * + * @type keytype + * @brief 远端用户离开房间的原因。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCUserOfflineReason) { + /** + * + * @brief 远端用户调用 `leaveRoom` 方法主动退出房间。 + */ + + ByteRTCUserOfflineReasonQuit = 0, + /** + * + * @brief 远端用户因网络等原因掉线。 + */ + + ByteRTCUserOfflineReasonDropped = 1, + /** + * + * @brief 远端用户切换至隐身状态。 + */ + + ByteRTCUserOfflineReasonSwitchToInvisible = 2, + /** + * + * @brief 远端用户被踢出房间。
    + * 因调用踢出用户的 OpenAPI,远端用户被踢出房间。 + */ + + ByteRTCUserOfflineReasonKickedByAdmin = 3, +}; + +/** + * + * @type keytype + * @brief SDK 与信令服务器连接状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCConnectionState) { + /** + * + * @brief 连接断开超过 12s,此时 SDK 会尝试自动重连。 + */ + + ByteRTCConnectionStateDisconnected = 1, + /** + * + * @brief 首次请求建立连接,正在连接中。 + */ + + ByteRTCConnectionStateConnecting = 2, + /** + * + * @brief 首次连接成功。 + */ + + ByteRTCConnectionStateConnected = 3, + /** + * + * @brief 涵盖了以下情况:
    + * - 首次连接时,10 秒连接不成功; + * - 连接成功后,断连 10 秒。自动重连中。 + */ + + ByteRTCConnectionStateReconnecting = 4, + /** + * + * @brief 连接断开后,重连成功。 + */ + + ByteRTCConnectionStateReconnected = 5, + /** + * + * @brief 处于 `ByteRTCConnectionStateDisconnected` 状态超过 10 秒,且期间重连未成功。SDK 仍将继续尝试重连。 + */ + + ByteRTCConnectionStateLost = 6, + /** + * + * @brief 连接失败,服务端状态异常。SDK 不会自动重连,请重新进房,或联系技术支持。 + */ + + ByteRTCConnectionStateFailed = 7, +}; + +/** + * + * @type keytype + * @brief SDK 网络连接类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCNetworkType) { + /** + * + * @brief 网络连接类型未知。 + */ + + ByteRTCNetworkTypeUnknown = -1, + /** + * + * @brief 网络连接已断开。 + */ + + ByteRTCNetworkTypeDisconnected = 0, + /** + * + * @brief 网络连接类型为 LAN 。 + */ + + ByteRTCNetworkTypeLAN = 1, + /** + * + * @brief 网络连接类型为 Wi-Fi(包含热点)。 + */ + + ByteRTCNetworkTypeWIFI = 2, + /** + * + * @brief 网络连接类型为 2G 移动网络。 + */ + + ByteRTCNetworkTypeMobile2G = 3, + /** + * + * @brief 网络连接类型为 3G 移动网络。 + */ + + ByteRTCNetworkTypeMobile3G = 4, + /** + * + * @brief 网络连接类型为 4G 移动网络。 + */ + + ByteRTCNetworkTypeMobile4G = 5, + /** + * + * @brief 网络连接类型为 5G 移动网络。 + */ + + ByteRTCNetworkTypeMobile5G = 6, +}; + +/** + * + * @type keytype + * @brief 媒体流网络质量。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCNetworkQuality) { + /** + * + * @brief 网络质量未知。 + */ + + ByteRTCNetworkQualityUnknown = 0, + /** + * + * @brief 网络质量极好。 + */ + + ByteRTCNetworkQualityExcellent = 1, + /** + * + * @brief 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。 + */ + + ByteRTCNetworkQualityGood = 2, + /** + * + * @brief 主观感受有瑕疵但不影响沟通。 + */ + + ByteRTCNetworkQualityPoor = 3, + /** + * + * @brief 勉强能沟通但不顺畅。 + */ + + ByteRTCNetworkQualityBad = 4, + /** + * + * @brief 网络质量非常差,基本不能沟通。 + */ + + ByteRTCNetworkQualityVeryBad = 5, + /** + * + * @brief 网络连接断开,无法通话。网络可能由于 12s 内无应答、开启飞行模式、拔掉网线等原因断开。
    + * 更多网络状态信息参见 [连接状态提示](https: + */ + + ByteRTCNetworkQualityDown = 6, +}; + +/** + * + * @type errorcode + * @brief 回调错误码。
    + * SDK 内部遇到不可恢复的错误时,会通过 `rtcEngine:onError:` 回调通知用户。 + */ + +typedef NS_ENUM(NSInteger, ByteRTSErrorCode) { + /** + * + * @brief Token 无效。
    + * 进房时使用的 Token 无效或过期失效。需要用户重新获取 Token,并调用
    + * `updateToken:` 方法更新 Token。 + */ + + ByteRTSErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + ByteRTSErrorCodeJoinRoom = -1001, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间 + */ + + ByteRTSErrorCodeDuplicateLogin = -1004, + + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间 + */ + + ByteRTSErrorCodeKickedOut = -1006, + + /** + * + * @brief 当调用 `createRtcRoom:` ,如果 roomId 非法,会返回 null,并抛出该错误 + */ + + ByteRTSErrorCodeRoomIdIllegal = -1007, + + /** + * + * @brief Token 过期。调用 `joinRoomByKey:roomId:userInfo:rtcRoomConfig:` 使用新的 Token 重新加入房间。 + */ + + ByteRTSErrorCodeTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken:` 传入的 Token 无效 + */ + + ByteRTSErrorCodeUpdateTokenWithInvalidToken = -1010, + + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。 + */ + + ByteRTSErrorCodeRoomDismiss = -1011, + + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了 + */ + + ByteRTSErrorRoomAlreadyExist = -1013, + + /** + * + * @brief 加入多个房间时使用了不同的 uid。
    + * 同一个引擎实例中,用户需使用同一个 uid 加入不同的房间。 + */ + + ByteRTSErrorUserIDDifferent = -1014, + + /** + * + * @brief 服务端异常状态导致退出房间。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + ByteRTSErrorCodeAbnormalServerStatus = -1084, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
    + * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅作通知。 + */ + +typedef NS_ENUM(NSInteger, ByteRTSWarningCode) { + /** + * + * @brief 进房失败。
    + * 初次进房或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + ByteRTSWarningCodeJoinRoomFailed = -2001, + /** + * + * @brief 发布音视频流失败。
    + * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + ByteRTSWarningCodePublishStreamFailed = -2002, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误,当前代码中未使用。 + */ + + ByteRTSWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + ByteRTSWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + ByteRTSWarningCodeSendCustomMessage = -2011, + /** + * + * @hidden + * @deprecated since 3.46 and will be deleted in 3.52. + * @brief 同样 roomid 的房间已经存在了 + */ + + ByteRTSWarningCodeRoomAlreadyExist = -2015, + + /** + * + * @brief 新生成的房间已经替换了同样 roomId 的旧房间 + */ + + ByteRTSWarningCodeOldRoomBeenReplaced = -2016 +}; + +/** + * + * @type keytype + * @brief 日志级别。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLogLevel) { + /** + * + * @brief 打印 trace 级别及以上级别信息。 + */ + + ByteRTCLogLevelTrace, + /** + * + * @brief 打印 debug 级别及以上级别信息。 + */ + + ByteRTCLogLevelDebug, + /** + * + * @brief 打印 info 级别及以上级别信息。 + */ + + ByteRTCLogLevelInfo, + /** + * + * @brief 打印 warning 级别及以上级别信息。 + */ + + ByteRTCLogLevelWarning, + /** + * + * @brief 打印 error 级别信息。 + */ + + ByteRTCLogLevelError, +}; + +/** + * + * @type errorcode + * @brief 登录结果
    + * 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录的结果,会通过 rtcEngine:onLoginResult:errorCode:elapsed:{@link #ByteRTCEngineDelegate#rtcEngine:onLoginResult:errorCode:elapsed:} 回调通知用户。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLoginErrorCode) { + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法登录成功。 + */ + + ByteRTCLoginErrorCodeSuccess = 0, + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法时使用的 Token 无效或过期失效。需要用户重新获取 Token。 + */ + + ByteRTCLoginErrorCodeInvalidToken = -1000, + /** + * + * @brief 登录错误
    + * 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法时发生未知错误导致登录失败。需要用户重新登录。 + */ + + ByteRTCLoginErrorCodeLoginFailed = -1001, + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法时传入的用户 ID 有问题。 + */ + + ByteRTCLoginErrorCodeInvalidUserId = -1002, + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录时服务器错误。 + */ + + ByteRTCLoginErrorCodeServerError = -1003, +}; + +/** + * + * @type keytype + * @brief 用户登出的原因 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLogoutReason) { + /** + * + * @brief 用户主动退出
    + * 用户调用 `logout` 接口登出,或者销毁引擎登出。 + */ + + ByteRTCLogoutReasonLogout = 0, + /** + * + * @brief 用户被动退出
    + * 另一个用户以相同 UserId 进行了 `login`,导致本端用户被踢出。 + */ + + ByteRTCLogoutReasonDuplicateLogin = 1, +}; + +/** + * + * @type keytype + * @brief 发送消息的可靠有序类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMessageConfig) { + /** + * + * @brief 低延时可靠有序消息 + */ + + ByteRTCMessageConfigReliableOrdered = 0, + /** + * + * @brief 超低延时有序消息 + */ + + ByteRTCMessageConfigUnreliableOrdered = 1, + /** + * + * @brief 超低延时无序消息 + */ + + ByteRTCMessageConfigUnreliableUnordered = 2, +}; + +/** + * + * @type errorcode + * @brief 发送消息结果,成功或失败,及失败原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCUserMessageSendResult) { + /** + * + * @brief 发送消息成功。 + */ + + ByteRTCUserMessageSendResultSuccess = 0, + /** + * + * @brief 消息发送失败。发送超时。 + */ + + ByteRTCUserMessageSendResultTimeout = 1, + /** + * + * @brief 消息发送失败。连接断开,消息未发出。 + */ + + ByteRTCUserMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 消息发送失败。找不到接收方。 + */ + + ByteRTCUserMessageSendResultNoReceiver = 3, + /** + * + * @brief 消息发送失败。远端用户没有登录或进房。 + */ + + ByteRTCUserMessageSendResultNoRelayPath = 4, + /** + * + * @brief 消息发送失败。超过 QPS 限制。 + */ + + ByteRTCUserMessageSendResultExceedQPS = 5, + /** + * + * @brief 消息发送失败。应用服务器未收到客户端发送的消息。
    + * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + ByteRTCUserMessageSendResultE2BSSendFailed = 17, + /** + * + * @brief 消息发送失败。应用服务器接收到了客户端发送的消息,但响应失败。
    + * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + ByteRTCUserMessageSendResultE2BSReturnFailed = 18, + /** + * + * @brief 消息发送失败。消息发送方没有加入房间。 + */ + + ByteRTCUserMessageSendResultNotJoin = 100, + /** + * + * @brief 消息发送失败。连接未完成初始化。 + */ + + ByteRTCUserMessageSendResultInit = 101, + /** + * + * @brief 消息发送失败。没有可用的数据传输通道连接。 + */ + + ByteRTCUserMessageSendResultNoConnection = 102, + /** + * + * @brief 消息发送失败。消息超过最大长度。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + ByteRTCUserMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 消息发送失败。接收方用户 ID 为空。 + */ + + ByteRTCUserMessageSendResultEmptyUser = 104, + /** + * + * @brief 消息发送失败。房间外或应用服务器消息发送方没有登录。 + */ + + ByteRTCUserMessageSendResultNotLogin = 105, + /** + * + * @brief 消息发送失败。发送消息给业务方服务器之前没有设置参数。 + */ + + ByteRTCUserMessageSendResultServerParamsNotSet = 106, + /** + * + * @brief 失败,未知错误。 + */ + + ByteRTCUserMessageSendResultUnknown = 1000, +}; + +/** + * + * @type keytype + * @brief 用户在线状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCUserOnlineStatus) { + /** + * + * @brief 对端用户离线
    + * 对端用户已经调用 `logout`,或者没有调用 login:uid:{@link #ByteRTCEngine#login:uid:} 进行登录 + */ + + ByteRTCUserOnlineStatusOffline = 0, + /** + * + * @brief 对端用户在线
    + * 对端用户调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录,并且连接状态正常 + */ + + ByteRTCUserOnlineStatusOnline = 1, + /** + * + * @brief 无法获取对端用户在线状态
    + * 发生级联错误、对端用户在线状态异常时返回 + */ + + ByteRTCUserOnlineStatusUnreachable = 2, +}; + +/** + * + * @type errorcode + * @brief 房间内广播消息发送结果 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomMessageSendResult) { + /** + * + * @brief 消息发送成功 + */ + + ByteRTCRoomMessageSendResultSuccess = 200, + /** + * + * @brief 发送超时,没有发送 + */ + + ByteRTCRoomMessageSendResultTimeout = 1, + /** + * + * @brief 通道断开,没有发送 + */ + + ByteRTCRoomMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 超过 QPS 限制 + */ + + ByteRTCRoomMessageSendResultExceedQPS = 5, + /** + * + * @brief 失败,发送方未加入房间 + */ + + ByteRTCRoomMessageSendResultNotJoin = 100, + /** + * + * @brief 失败,连接未完成初始化。 + */ + + ByteRTCRoomMessageSendResultInit = 101, + /** + * + * @brief 失败,没有可用的连接。 + */ + + ByteRTCRoomMessageSendResultNoConnection = 102, + /** + * + * @brief 消息超过最大长度。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + ByteRTCRoomMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 失败,未知错误。 + */ + + ByteRTCRoomMessageSendResultUnknown = 1000, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief SDK 的服务器环境。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEnv) { + /** + * + * @brief 线上环境。 + */ + + ByteRTCEnvProduct = 0, + /** + * + * @brief BOE 环境。 + */ + + ByteRTCEnvBOE = 1, + /** + * + * @brief 测试环境。 + */ + + ByteRTCEnvTest = 2, +}; + +/** + * + * @type keytype + * @brief 本地日志输出等级。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalLogLevel) { + /** + * + * @brief 信息级别。 + */ + + ByteRTCLocalLogLevelInfo = 0, + /** + * + * @brief (默认值)警告级别。 + */ + + ByteRTCLocalLogLevelWarning = 1, + /** + * + * @brief 错误级别。 + */ + + ByteRTCLocalLogLevelError = 2, + /** + * + * @brief 关闭日志。 + */ + + ByteRTCLocalLogLevelNone = 3 +}; + +/** + * + * @type keytype + * @brief App 使用的 cpu 和 memory 信息
    + * 信息由 SDK 周期性(2s)地通过 `reportSysStats` 回调事件通知给用户。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSysStats : NSObject +/** + * + * @brief 当前系统 cpu 核数 + */ + +@property(assign, nonatomic) unsigned int cpuCores; +/** + * + * @brief 当前应用的 CPU 使用率,取值范围为 [0, 1]。 + */ + +@property(assign, nonatomic) double cpuAppUsage; +/** + * + * @hidden currently not available + * @brief 当前系统的 CPU 使用率,取值范围为 [0, 1]。 + */ + +@property(assign, nonatomic) double cpuTotalUsage; +/** + * + * @brief 当前 App 的内存使用(单位 MB) + */ + +@property(assign, nonatomic) double memoryUsage; +/** + * + * @brief 全量内存(单位 MB) + */ + +@property(assign, nonatomic) unsigned long long fullMemory; +/** + * + * @brief 系统已使用内存(单位 MB) + */ + +@property(assign, nonatomic) unsigned long long totalMemoryUsage; +/** + * + * @brief 空闲可分配内存(单位 MB) + */ + +@property(assign, nonatomic) unsigned long long freeMemory; +/** + * + * @brief 当前应用的内存使用率(单位 %) + */ + +@property(assign, nonatomic) double memoryRatio; +/** + * + * @brief 系统内存使用率(单位 %) + */ + +@property(assign, nonatomic) double totalMemoryRatio; +@end + +/** + * + * @type keytype + * @brief 本地日志参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLogConfig : NSObject +/** + * + * @brief 日志存储路径,必填。 + */ + +@property(copy, nonatomic) NSString *_Nonnull logPath; + +/** + * + * @brief 日志等级,参看 ByteRTCLocalLogLevel{@link #ByteRTCLocalLogLevel},默认为警告级别,选填。 + */ + +@property(assign, nonatomic) ByteRTCLocalLogLevel logLevel; + +/** + * + * @brief 日志文件最大占用的总空间,单位为 MB,选填。取值范围为 1~100 MB,默认值为 10 MB。
    + * 若 `logFileSize` < 1,取 1 MB。若 `logFileSize` > 100,取 100 MB。
    + * 其中,单个日志文件最大为 2 MB:
    + *
    • 若 1 ≤ logFileSize ≤ 2,则会生成一个日志文件。
    • 若 logFileSize > 2,假设 logFileSize/2 的整数部分为 N,则前 N 个文件,每个文件会写满 2 MB,第 N+1 个文件大小不超过 logFileSize mod 2,否则会删除最老的文件,以此类推。
    + */ + +@property(assign, nonatomic) int logFileSize; + +/** + * + * @brief 日志文件名前缀,选填。该字符串必须符合正则表达式:[a-zA-Z0-9_@\-\.]{1,128}。
    + * 最终的日志文件名为`前缀 + "_" + 文件创建时间 + "_rtclog".log`,如 `logPrefix_2023-05-25_172324_rtclog.log`。 + */ + +@property(copy, nonatomic) NSString *_Nonnull logFilenamePrefix; +@end + +/** + * + * @hidden for internal use only + * @type callback + * @brief 非业务相关的监控事件回调 + */ + +@protocol ByteRTCMonitorDelegate +@optional +/** + * + * @type callback + * @brief 埋点日志回调 + * @param data
    + * 具体的埋点内容 + * @param type
    + * 埋点的类型 + */ + +- (void)onMonitorLog:(NSDictionary * _Nullable)data withType:(NSString * _Nullable)type; + +/** + * + * @type api + * @brief 是否进行控制台输出 + * @return + * 返回是否进行控制台输出
    + * - YES 输出所有的日志到控制台 + * - NO 不输出任何控制台信息 + */ + +- (BOOL)isConsole; + +/** + * + * @type callback + * @brief 输出更多的调试信息。 + * @param level 日志等级,参看 ByteRTCLogLevel{@link #ByteRTCLogLevel}。 + * @param filename 日志文件名称。 + * @param tag 日志标签。 + * @param line 行数 + * @param funcName 函数名称 + * @param format 格式 + */ + +- (void)onVerboseLogWithLevel:(ByteRTCLogLevel)level + filename:(NSString * _Nonnull)filename + tag:(NSString * _Nonnull)tag + line:(int)line + functionName:(NSString * _Nonnull)funcName + format:(NSString * _Nonnull)format; +@end + +/** + * + * @type keytype + * @brief 云代理信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCCloudProxyInfo: NSObject +/** + * + * @type keytype + * @brief 云代理服务器 IP + */ + +@property(strong, nonatomic) NSString* _Nonnull cloudProxyIp; +/** + * + * @type keytype + * @brief 云代理服务器端口 + */ + +@property(assign, nonatomic) int cloudProxyPort; +@end + +/** + * + * @type keytype + * @brief 本地代理的类型。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalProxyType) { + /** + * + * @brief Socks5 代理。选用此代理服务器,需满足 Socks5 协议标准文档的要求。 + */ + + ByteRTCLocalProxyTypeSocks5 = 1, + /** + * + * @brief Http 隧道代理。 + */ + + ByteRTCLocalProxyTypeHttpTunnel = 2, +}; + +/** + * + * @type keytype + * @brief 本地代理配置详细信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalProxyInfo : NSObject +/** + * + * @brief 本地代理的类型,参看 ByteRTCLocalProxyType{@link #ByteRTCLocalProxyType}。 + */ + +@property(assign, nonatomic) ByteRTCLocalProxyType localProxyType; +/** + * + * @type keytype + * @brief 本地代理服务器 IP。 + */ + +@property(copy, nonatomic) NSString * _Nullable localProxyIp; +/** + * + * @type keytype + * @brief 本地代理服务器端口。 + */ + +@property(assign, nonatomic) int localProxyPort; + /** + * + * @type keytype + * @brief 本地代理用户名。 + */ + +@property(copy, nonatomic) NSString * _Nullable localProxyUsername; + /** + * + * @brief 本地代理密码。 + */ + +@property(copy, nonatomic) NSString * _Nullable localProxyPassword; +@end + +/** + * + * @type keytype + * @brief 本地代理连接状态。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalProxyState) { + /** + * + * @brief TCP 代理服务器连接成功。 + */ + + ByteRTCLocalProxyStateInited = 0, + + /** + * + * @brief 本地代理连接成功。 + */ + + ByteRTCLocalProxyStateConnected = 1, + + /** + * + * @brief 本地代理连接出现错误。 + */ + + ByteRTCLocalProxyStateError = 2, +}; + +/** + * + * @type keytype + * @brief 本地代理错误。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalProxyError) { + /** + * + * @brief 本地代理服务器无错误。 + */ + + ByteRTCLocalProxyErrorOK = 0, + + /** + * + * @brief 代理服务器回复的版本号不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5VersionError = 1, + + /** + * + * @brief 代理服务器回复的格式错误不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5FormatError = 2, + + /** + * + * @brief 代理服务器回复的字段值不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5InvalidValue = 3, + + /** + * + * @brief 未提供代理服务器的用户名及密码,导致 Socks5 代理连接失败。请重新调用 `setLocalProxy`,在设置本地代理时填入用户名和密码。 + */ + + ByteRTCLocalProxyErrorSocks5UserPassNotGiven = 4, + + /** + * + * @brief TCP 关闭,导致 Socks5 代理连接失败。请检查网络或者代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5TcpClosed = 5, + + /** + * + * @brief Http 隧道代理错误。请检查 Http 隧道代理服务器或者网络是否存在异常。 + */ + + ByteRTCLocalProxyErrorHttpTunnelFailed = 6, +}; + +/** + * + * @type keytype + * @brief 创建引擎参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEngineConfig: NSObject +/** + * + * @brief 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 + */ + +@property(copy, nonatomic) NSString* _Nonnull appID; + +/** + * + * @brief 是否是游戏场景。 + */ + +@property(assign, nonatomic) BOOL isGameScene; + +/** + * + * @brief 私有参数。如需使用请联系技术支持人员。 + */ + +@property(copy, nonatomic) NSDictionary* _Nullable parameters; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCScreenCapturerExt.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCScreenCapturerExt.h new file mode 100644 index 0000000..548c8c0 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCScreenCapturerExt.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. +*/ + +#pragma once + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN +#define BYTE_RTC_EXPORT __attribute__((visibility("default"))) +/** + * + * @type callback + * @brief 屏幕采集相关扩展协议,仅适用于 SDK 内部采集。
    + * 用户创建 extension 后生成的 SampleHandler 需继承此协议以实现屏幕共享相关能力。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +BYTE_RTC_EXPORT @protocol ByteRtcScreenCapturerExtDelegate +/** + * + * @type api + * @brief 通知 Broadcast Upload Extension 停止采集屏幕并退出。 + * @note iOS 端调用 stopScreenCapture{@link #ByteRTCEngine#stopScreenCapture},或 macOS 端调用 stopScreenVideoCapture{@link #ByteRTCEngine#stopScreenVideoCapture},会触发该方法通知 extension 端的 SDK 停止屏幕采集。 + * @list 视频管理 + */ + +- (void)onQuitFromApp; +/** + * + * @type api + * @brief Socket 收到 App 侧发来的信息时,触发该回调 + * @param message App 侧发送的消息 + * @list 视频管理 + */ + +- (void)onReceiveMessageFromApp:(NSData *)message; +/** + * + * @type api + * @brief Socket 连接断开时触发此回调 + * @list 视频管理 + */ + +- (void)onSocketDisconnect; +/** + * + * @type api + * @brief Socket 连接成功时触发此回调 + * @list 视频管理 + */ + +- (void)onSocketConnect; +/** + * + * @type api + * @brief 检测到 App 正在进行音视频通话时触发此回调。 + * @list 视频管理 + */ + +- (void)onNotifyAppRunning; +@end + +/** + * + * @type keytype + * @brief 屏幕采集相关扩展实例,仅适用于 SDK 内部采集。
    + * 用户创建 extension 后生成的 SampleHandler 需通过此实例实现屏幕共享相关能力。 + */ + +BYTE_RTC_EXPORT @interface ByteRtcScreenCapturerExt : NSObject +/** + * + * @type keytype + * @brief 只读变量,用于获取 ByteRtcScreenCapturerExt 实例。 + */ + +@property (readonly, class) ByteRtcScreenCapturerExt *shared; +/** + * + * @type keytype + * @brief ByteRtcScreenCapturerExt 实例的回调代理。 + */ + +@property (nonatomic, weak, nullable) NSObject *delegate; +/** + * + * @type api + * @brief 开始屏幕采集
    + * Extension 启动后,系统将自动调用该方法开启屏幕采集。 + * @param delegate 回调代理,参看 ByteRtcScreenCapturerExtDelegate{@link #ByteRtcScreenCapturerExtDelegate} + * @param groupId App groups 中配置的 group ID + * @list 视频管理 + */ + +- (void)startWithDelegate:(NSObject *)delegate groupId:(NSString *)groupId; +/** + * + * @type api + * @brief 结束屏幕采集
    + * Extension 关闭后,系统将自动调用该方法停止屏幕采集。 + * @list 视频管理 + */ + +- (void)stop; +/** + * + * @type api + * @brief 推送 Extension 采集的数据 + * @param sampleBuffer 采集到的数据 + * @param sampleBufferType 数据类型 + * @list 视频管理 + */ + +- (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType API_AVAILABLE(ios(10)); +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSingScoringManager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSingScoringManager.h new file mode 100644 index 0000000..28d841d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSingScoringManager.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCAudioMixingManager +*/ + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type callback + * @brief K 歌评分事件回调类。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCSingScoringDelegate +@required +/** + * + * @type callback + * @brief 实时评分信息回调。调用 startSingScoring:scoringInfoInterval:{@link #ByteRTCSingScoringManager#startSingScoring:scoringInfoInterval:} 后,会收到该回调。 + * @param info 实时评分信息。详见 ByteRTCSingScoringRealtimeInfo{@link #ByteRTCSingScoringRealtimeInfo}。 + * @list 在线 KTV + */ + +- (void)onCurrentScoringInfo:(ByteRTCSingScoringRealtimeInfo * _Nullable)info; +@end +/** + * + * @type api + * @brief K 歌评分管理接口。 + * @list Online Karaoke + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSingScoringManager :NSObject +/** + * + * @type api + * @brief 初始化 K 歌评分。 + * @param singScoringAppkey K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param singScoringToken K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param delegate K 歌评分事件回调类,详见 ByteRTCSingScoringDelegate{@link #ByteRTCSingScoringDelegate}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note 输入正确的鉴权信息才可以使用 K 歌评分相关的功能,鉴权方式为离线鉴权,根据包名(bundleID)绑定 Appkey 及 Token,K 歌评分密钥请联系技术支持人员申请。 + * @list 在线 KTV + */ + +-(int)initSingScoring:(NSString * _Nullable)singScoringAppkey + singScoringToken:(NSString * _Nullable)singScoringToken + delegate:(id _Nullable)delegate; +/** + * + * @type api + * @brief 设置 K 歌评分参数。 + * @param config K 歌评分的各项参数,详见 ByteRTCSingScoringConfig{@link #ByteRTCSingScoringConfig}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @list 在线 KTV + */ + +-(int)setSingScoringConfig:(ByteRTCSingScoringConfig * _Nullable)config; +/** + * + * @type api + * @brief 获取标准音高数据。 + * @param midiFilepath 歌曲 midi 文件路径。 + * @return ByteRTCStandardPitchInfo{@link #ByteRTCStandardPitchInfo} 标准音高数据数组。 + * @note + * - 请保证此接口传入的 midi 文件路径与 setSingScoringConfig:{@link #ByteRTCSingScoringManager#setSingScoringConfig:} 接口中传入的路径一致。 + * @list 在线 KTV + */ + +-(NSArray * _Nullable)getStandardPitchInfo:(NSString* _Nullable)midiFilepath; +/** + * + * @type api + * @brief 开始 K 歌评分。 + * @param position 开始评分时,音乐的播放进度,单位:ms。 + * @param scoringInfoInterval 实时回调的时间间隔,单位:ms;默认 50 ms。最低间隔为 20 ms。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note + * - 在调用 initSingScoring:singScoringToken:delegate:{@link #ByteRTCSingScoringManager#initSingScoring:singScoringToken:delegate:} 初始化 K 歌评分功能后调用该接口。 + * - 调用该接口后,将会根据设置的回调时间间隔,收到评分结果 onCurrentScoringInfo:{@link #ByteRTCSingScoringDelegate#onCurrentScoringInfo:} 回调。 + * - 如果使用 `ByteRTCMediaPlayer` 播放伴奏,请在收到 onMediaPlayerStateChanged:state:error:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerStateChanged:state:error:} 回调且播放状态为 ByteRTCPlayerStatePlaying 后,调用此接口。 + * @list 在线 KTV + */ + +-(int)startSingScoring:(int)position + scoringInfoInterval:(int)scoringInfoInterval; +/** + * + * @type api + * @brief 停止 K 歌评分。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 在线 KTV + */ + +-(int)stopSingScoring; +/** + * + * @type api + * @brief 获取上一句的演唱评分。调用 startSingScoring:scoringInfoInterval:{@link #ByteRTCSingScoringManager#startSingScoring:scoringInfoInterval:} 开始评分后可以调用该接口。 + * @return + * - <0:获取评分失败。 + * - >=0:上一句歌词的演唱评分。 + * @list 在线 KTV + */ + +-(int)getLastSentenceScore; +/** + * + * @type api + * @brief 获取当前演唱总分。调用 startSingScoring:scoringInfoInterval:{@link #ByteRTCSingScoringManager#startSingScoring:scoringInfoInterval:} 开始评分后可以调用该接口。 + * @return + * - <0:获取总分失败。 + * - >=0:当前演唱总分。 + * @list 在线 KTV + */ + + -(int)getTotalScore; + /** + * + * @type api + * @brief 获取当前演唱歌曲的平均分。 + * @return + * - <0:获取平均分失败。 + * - >=0:当前演唱平均分。 + * @list 在线 KTV + */ + +-(int)getAverageScore; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSpatialAudio.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSpatialAudio.h new file mode 100644 index 0000000..94cf1cb --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSpatialAudio.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief spatial audio interface + */ + +#pragma once + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type api + * @brief 空间音频接口实例 + * @list + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSpatialAudio : NSObject +/** + * + * @type api + * @brief 开启/关闭空间音频功能。 + * @param enable 是否开启空间音频功能:
    + * - YES:开启 + * - NO:关闭(默认) + * @note 该方法仅开启空间音频功能,你须调用 updateSelfPosition:{@link #ByteRTCSpatialAudio#updateSelfPosition:} 设置自身位置坐标后方可收听空间音频效果。空间音频相关 API 和调用时序详见[空间音频](https: + * @list 音频处理 + */ + +- (void)enableSpatialAudio:(BOOL)enable; +/** + * + * @type api + * @brief 关闭本地用户朝向对本地用户发声效果的影响。
    + * 调用此接口后,房间内的其他用户收听本地发声时,声源都在收听者正面。 + * @note + * - 调用本接口关闭朝向功能后,在当前的空间音频实例的生命周期内无法再次开启。 + * - 调用此接口不影响本地用户收听朝向的音频效果。要改变本地用户收听朝向,参看 updateSelfPosition:{@link #ByteRTCSpatialAudio#updateSelfPosition:} 和 updateRemotePosition:positionInfo:{@link #ByteRTCSpatialAudio#updateRemotePosition:positionInfo:}。 + * @list 高级功能 + */ + +-(void)disableRemoteOrientation; +/** + * + * @valid since 3.52 + * @type api + * @brief 设置本地用户在自建空间直角坐标系中的收听坐标和收听朝向,以实现本地用户预期的空间音频收听效果。 + * @param positionInfo 空间音频位置信息。参看 ByteRTCPositionInfo{@link #ByteRTCPositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验本地用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * - 该方法需在进房后调用。 + * - 调用该接口更新坐标前,你需调用 enableSpatialAudio:{@link #ByteRTCSpatialAudio#enableSpatialAudio:} 开启空间音频功能。空间音频相关 API 和调用时序详见[空间音频](https: + * - 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 高级功能 + */ + +-(int)updateSelfPosition:(ByteRTCPositionInfo* _Nonnull)positionInfo; +/** + * + * @valid since 3.52 + * @type api + * @brief 设置房间内某一远端用户在本地用户自建的空间音频坐标系中的发声位置和发声朝向,以实现本地用户预期的空间音频收听效果。 + * @param uid 用户 ID + * @param positionInfo 远端用户的空间音频位置信息。参看 ByteRTCPositionInfo{@link #ByteRTCPositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验远端用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * 该方法需在创建房间后调用。
    + * 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 音频管理 + */ + +-(int)updateRemotePosition:(NSString * _Nonnull)uid + positionInfo:(ByteRTCPositionInfo* _Nonnull)positionInfo; +/** + * + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition:positionInfo:{@link #ByteRTCSpatialAudio#updateRemotePosition:positionInfo:} 为某一远端用户设置的空间音频效果。 + * @param uid 远端用户 ID。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + +-(int)removeRemotePosition:(NSString * _Nonnull)uid; +/** + * + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition:positionInfo:{@link #ByteRTCSpatialAudio#updateRemotePosition:positionInfo:} 为所有远端用户设置的空间音频效果。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + +-(int)removeAllRemotePosition; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefines.h new file mode 100644 index 0000000..967a779 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefines.h @@ -0,0 +1,5660 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Video Defines +*/ + +#import "ByteRTCAudioDefines.h" +#import "ByteRTCMediaDefines.h" + +#pragma mark - ByteRTCVideoSource +/** + * + * @type keytype + * @hidden + * @brief 视频源。预留参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoSource : NSObject + +@end + +/** + * + * @type keytype + * @brief 图片或视频流的缩放模式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRenderMode) { + /** + * + * @brief 视窗填满优先,默认值。
    + * 视频尺寸等比缩放,直至视窗被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。 + */ + + ByteRTCRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 + */ + + ByteRTCRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
    + * 视频尺寸非等比例缩放,把窗口充满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + ByteRTCRenderModeFill = 3, +}; + +/** + * + * @type keytype + * @brief 视频流类型
    + * 目前 C++ SDK 只支持 ByteRTCVideoStreamTypeHigh 类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoStreamType) { + /** + * + * @brief 高分辨率视频流 + */ + + ByteRTCVideoStreamTypeHigh = 0, + /** + * + * @brief 低分辨率视频 + */ + + ByteRTCVideoStreamTypeLow = 1, +}; + +/** + * + * @type keytype + * @brief 设置本地视频属性的返回状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoStreamState) { + /** + * + * @brief 设置本地视频属性成功 + */ + + ByteRTCVideoStreamStateSuccess = 0, + /** + * + * @brief 本地视频属性参数不合法 + */ + + ByteRTCVideoStreamStateInvalid = -2, +}; + +/** + * + * @type keytype + * @brief 视频输出方向模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoOutputOrientationMode) { + /** + * + * @brief 自适应布局 + */ + + ByteRTCVideoOutputOrientationModeAdaptative = 0, + /** + * + * @brief 横屏布局 + */ + + ByteRTCVideoOutputOrientationModeFixedLandscape = 1, + /** + * + * @brief 竖屏布局 + */ + + ByteRTCVideoOutputOrientationModeFixedPortrait = 2, +}; + +/** + * + * @type keytype + * @brief 视频帧朝向 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCVideoOrientation) { + /** + * + * @brief (默认)使用相机输出的原始视频帧的角度,不对视频帧进行额外旋转。 + */ + + ByteRTCVideoOrientationAdaptive = 0, + /** + * + * @brief 固定为竖屏,将相机采集到的视频帧转换为竖屏,在整个 RTC 链路中传递竖屏帧。 + */ + + ByteRTCVideoOrientationPortrait = 1, + /** + * + * @brief 固定为横屏,将相机采集到的视频帧转换为横屏,在整个 RTC 链路中传递横屏帧。 + */ + + ByteRTCVideoOrientationLandscape = 2 +}; + +/** + * + * @hidden + * @type keytype + * @deprecated since 3.29 and will be deleted in 3.51, use ByteRTCMirrorType{@link #ByteRTCMirrorType} instead. + * @brief 是否开启镜像模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMirrorMode) { + /** + * + * @brief 不开启 + */ + + ByteRTCMirrorModeOff = 0, + /** + * + * @brief 开启 + */ + + ByteRTCMirrorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 镜像类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMirrorType) { + /** + * + * @brief 本地预览和编码传输时均无镜像效果 + */ + + ByteRTCMirrorTypeNone = 0, + /** + * + * @brief 本地预览时有镜像效果,编码传输时无镜像效果 + */ + + ByteRTCMirrorTypeRender = 1, + /** + * + * @brief 本地预览时无镜像效果,仅编码传输时有镜像效果 + */ + + ByteRTCMirrorTypeEncoder = 2, + /** + * + * @brief 本地预览和编码传输时均有镜像效果 + */ + + ByteRTCMirrorTypeRenderAndEncoder = 3, +}; + +/** + * + * @type keytype + * @brief 远端流的镜像类型。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRemoteMirrorType) { + /** + * + * @brief (默认值)远端视频渲染无镜像效果。 + */ + + ByteRTCRemoteMirrorTypeNone = 0, + /** + * + * @brief 远端视频渲染有镜像效果。 + */ + + ByteRTCRemoteMirrorTypeRender = 1, +}; + +/** + * + * @type keytype + * @brief 截图错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSnapshotErrorCode) { + /** + * + * @brief 截图成功。 + */ + + ByteRTCSnapshotErrorCodeOk = 0, + /** + * + * @brief 截图错误。生成图片数据失败或 RGBA 编码失败。 + */ + + ByteRTCSnapshotErrorCodeCreateFail = -1, + /** + * + * @brief 截图错误。流无效。 + */ + + ByteRTCSnapshotErrorCodeStreamInvalid = -2, + /** + * + * @brief 截图错误。截图超时,超时时间 1 秒。 + */ + + ByteRTCSnapshotErrorCodeTimeout = -3, + /** + * + * @brief 截图错误。图片保存失败。 + */ + + ByteRTCSnapshotErrorCodeFileSaveError = -4 +}; +/** + * + * @type keytype + * @brief 基础美颜模式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCEffectBeautyMode) { + /** + * + * @brief 美白。 + */ + + ByteRTCEffectBeautyModeWhite = 0, + /** + * + * @brief 磨皮。 + */ + + ByteRTCEffectBeautyModeSmooth = 1, + /** + * + * @brief 锐化。 + */ + + ByteRTCEffectBeautyModeSharpen = 2, + /** + * + * @valid since 3.55 + * @brief 清晰,需集成 v4.4.2+ 版本的特效 SDK。 + */ + + ByteRTCEffectBeautyModeClear = 3, +}; + +/** + * + * @type keytype + * @brief 视频帧旋转信息 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoRotation) { + /** + * + * @brief 不旋转 + */ + + ByteRTCVideoRotation0 = 0, + /** + * + * @brief 顺时针旋转 90 度 + */ + + ByteRTCVideoRotation90 = 90, + /** + * + * @brief 顺时针旋转 180 度 + */ + + ByteRTCVideoRotation180 = 180, + /** + * + * @brief 顺时针旋转 270 度 + */ + + ByteRTCVideoRotation270 = 270, +}; + +/** + * + * @type keytype + * @brief 发布大小流模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSimulcastMode) { + /** + * + * @brief 单流模式。始终只有 1 路分辨率的流。 + */ + + ByteRTCVideoSimulcastModeOnlyOne = 0, + /** + * + * @brief 按需订阅模式。发送端会根据订阅端的状态,按需发布。无订阅偏好设置默认发送 2 路。 + */ + + ByteRTCVideoSimulcastModeOnDemand, + /** + * + * @brief 订阅弱流。发送端始终按照设置的参数发布所有大小流。默认发送 2 路。 + */ + + ByteRTCVideoSimulcastModeAlwaysSimulcast, +}; + + +/** + * + * @type keytype + * @brief 订阅大小流偏好 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSimulcastStreamType) { + /** + * + * @brief 弱流,最小分辨率的流。 + */ + + ByteRTCVideoSimulcastStreamTypeWeak = 0, + /** + * + * @brief 小流 + */ + + ByteRTCVideoSimulcastStreamTypeLow, + /** + * + * @brief 中流 + */ + + ByteRTCVideoSimulcastStreamTypeMid, + /** + * + * @brief 大流 + */ + + ByteRTCVideoSimulcastStreamTypeHigh, +}; + +/** + * + * @type keytype + * @brief 自定义视频前处理(Video Processor)的作用范围,包括仅预览、仅编码和同时预览与编码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCProcessorActionDomain) { + /** + * + * @brief 处理后的视频帧同时用于本地预览和推流编码。 + */ + + ByteRTCProcessorActionDomainPreviewAndEncode = 0, + /** + * + * @brief 处理后的视频帧仅用于本地预览。 + */ + + ByteRTCProcessorActionDomainPreview = 1, + /** + * + * @brief 处理后的视频帧仅用于推流编码。 + */ + + ByteRTCProcessorActionDomainEncode = 2 +}; + +/** + * + * @type keytype + * @brief 视频帧像素格式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoPixelFormat) { + /** + * + * @brief 未知格式 + */ + + ByteRTCVideoPixelFormatUnknown = 0, + /** + * + * @brief YUV I420 格式 + */ + + ByteRTCVideoPixelFormatI420 = 1, + /** + * + * @brief YUV NV12 格式 + */ + + ByteRTCVideoPixelFormatNV12 = 2, + /** + * + * @brief YUV NV21 格式 + */ + + ByteRTCVideoPixelFormatNV21 = 3, + /** + * + * @brief RGB 24bit 格式, + */ + + ByteRTCVideoPixelFormatRGB24 = 4, + /** + * + * @brief RGBA 编码格式 + */ + + ByteRTCVideoPixelFormatRGBA = 5, + /** + * + * @brief ARGB 编码格式 + */ + + ByteRTCVideoPixelFormatARGB = 6, + /** + * + * @brief BGRA 编码格式 + */ + + ByteRTCVideoPixelFormatBGRA = 7, + + + /** + * + * @brief 像素格式结束标志。新加的格式数值应该小于ByteRTCVideoPixelFormatEndMark。 + */ + + ByteRTCVideoPixelFormatEndMark = 0xFF, + + /** + * + * @brief Texture2D 格式 + */ + + ByteRTCVideoPixelFormatTexture2D = 0x0DE1, + /** + * + * @brief TextureOES 格式 + */ + + ByteRTCVideoPixelFormatTextureOES = 0x8D65, +}; +/** + * + * @type keytype + * @brief 视频帧缓冲区类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoBufferType) { + /** + * + * @brief 原始内存数据 + */ + + ByteRTCVideoBufferTypeRawMemory = 0, + /** + * + * @brief CVPixelBufferRef 类型 + */ + + ByteRTCVideoBufferTypeCVPixelBuffer = 1, + /** + * + * @brief OpenGL 纹理数据类型 + */ + + ByteRTCVideoBufferTypeGLTexture = 2, + /** + * + * @brief cuda 数据类型 + */ + + ByteRTCVideoBufferTypeCuda = 3, + /** + * + * @brief direct3d11 纹理 + */ + + ByteRTCVideoBufferTypeD3D11 = 4, + /** + * + * @brief vaapi 数据格式 + */ + + ByteRTCVideoBufferTypeVAAPI = 5, + /** + * + * @hidden(Windows) + * @brief nvidia jetson dma 数据格式 + */ + + ByteRTCVideoBufferTypeNvidiaJetsonDma =6, +}; +/** + * + * @type keytype + * @brief 视频内容类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoContentType) { + /** + * + * @brief 普通视频 + */ + + ByteRTCVideoContentTypeNormalFrame = 0, + /** + * + * @brief 黑帧视频 + */ + + ByteRTCVideoContentTypeBlackFrame = 1, +}; + +/** + * + * @type keytype + * @brief 视频帧缩放模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoStreamScaleMode) { + /** + * + * @brief 自动缩放模式,默认设置为 ByteRTCVideoStreamScaleModeFitWithCropping。 + */ + + ByteRTCVideoStreamScaleModeAuto = 0, + /** + * + * @brief 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。 + */ + + ByteRTCVideoStreamScaleModeStretch = 1, + /** + * + * @brief 视窗填满优先。
    + * 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + */ + + ByteRTCVideoStreamScaleModeFitWithCropping = 2, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。保持纵横比来缩放图像,填充短边 + */ + + ByteRTCVideoStreamScaleModeFitWithFilling = 3, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 视频编码模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoCodecMode) { + /** + * + * @brief 自动选择 + */ + + ByteRTCVideoCodecModeAuto = 0, + /** + * + * @brief 硬编码 + */ + + ByteRTCVideoCodecModeHardware = 1, + /** + * + * @brief 软编码 + */ + + ByteRTCVideoCodecModeSoftware = 2 +}; + +/** + * + * @type keytype + * @brief 编码帧类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoPictureType) { + /** + * + * @brief 未知类型 + */ + + ByteRTCVideoPictureTypeUnknown = 0, + /** + * + * @brief I 帧,关键帧,编解码不需要参考其他视频帧 + */ + + ByteRTCVideoPictureTypeI = 1, + /** + * + * @brief P 帧,向前参考帧,编解码需要参考前一帧视频帧 + */ + + ByteRTCVideoPictureTypeP = 2, + /** + * + * @brief B 帧,前后参考帧,编解码需要参考前后两帧视频帧 + */ + + ByteRTCVideoPictureTypeB = 3, +}; + +/** + * + * @type keytype + * @brief 编码策略偏好。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoEncoderPreference) { + /** + * + * @brief 无偏好。不降低帧率和分辨率。 + */ + + ByteRTCVideoEncoderPreferenceDisabled = 0, + /** + * + * @brief 优先保障帧率。适用于动态画面。 + */ + + ByteRTCVideoEncoderPreferenceMaintainFramerate = 1, + /** + * + * @brief 清晰模式,优先保障分辨率。适用于静态画面。 + */ + + ByteRTCVideoEncoderPreferenceMaintainQuality = 2, + /** + * + * @brief 平衡帧率与分辨率。 + * 对于屏幕流来说是无偏好。不降低帧率和分辨率。 + */ + + ByteRTCVideoEncoderPreferenceAuto = 3, +}; + + +/** + * + * @hidden + * @deprecated since 3.32 and will be deleted in 3.51, use ByteRTCVirtualBackgroundSourceType{@link #ByteRTCVirtualBackgroundSourceType} instead. + * @type keytype + * @brief 背景模式设置。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCBackgroundMode) { + /** + * + * @brief 无 + */ + + ByteRTCBackgroundModeNone = 0, + /** + * + * @brief 虚化 + */ + + ByteRTCBackgroundModeBlur = 1, + /** + * + * @brief 背景 1 + */ + + ByteRTCBackgroundModeA = 2, + /** + * + * @brief 背景 2 + */ + + ByteRTCBackgroundModeB = 3, +}; + +/** + * + * @hidden + * @deprecated since 3.32 and will be deleted in 3.51. + * @type keytype + * @brief 分割模型设置。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCDivideModel) { + /** + * + * @brief 自研 + */ + + ByteRTCDivideModelDefault = 0, + /** + * + * @brief effect 分割模型 + */ + + ByteRTCDivideModelEffect = 1, +}; + +/** + * + * @type keytype + * @brief 数据类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCDataFrameType) { + /** + * + * @brief SEI 数据 + */ + + ByteRTCDataFrameTypeSei = 0, + /** + * + * @brief 人脸识别数据 + */ + + ByteRTCDataFrameTypeRoi = 1, + /** + * + * @brief 其他数据帧类型 + */ + + ByteRTCDataFrameTypeOther = 2, +}; + +/** + * + * @type keytype + * @brief 视频采集模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoCapturePreference) { + /** + * + * @brief (默认)自动设置采集参数。
    + * SDK 在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。 + */ + + ByteRTCVideoCapturePreferenceAuto = 0, + /** + * + * @brief 手动设置采集参数,包括采集分辨率、帧率。 + */ + + ByteRTCVideoCapturePreferenceMannal = 1, + /** + * + * @brief 采集参数与编码参数一致 + */ + + ByteRTCVideoCapturePreferenceAutoPerformance = 2, +}; + +/** + * + * @type keytype + * @brief 视频帧类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoFrameType) { + /** + * + * @brief 视频帧类型:内存数据 + */ + + ByteRTCVideoFrameTypeRawMemory = 0, + /** + * + * @brief 视频帧类型:CVPixelBuffer + */ + + ByteRTCVideoFrameTypePixelBuffer, +}; + + +/** + * + * @type keytype + * @brief 本地视频帧回调位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalVideoSinkPosition) { + /** + * + * @brief 采集后。 + */ + + ByteRTCLocalVideoSinkPositionAfterCapture = 0, + /** + * + * @brief (默认值)前处理后。 + */ + + ByteRTCLocalVideoSinkPositionAfterPreprocess = 1 +}; + +/** + * + * @type keytype + * @brief 远端视频帧回调位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoSinkPosition) { + /** + * + * @hidden not available + * @brief 解码后。 + */ + + ByteRTCRemoteVideoSinkPositionAfterDecoder = 0, + /** + * + * @brief (默认值)后处理后。 + */ + + ByteRTCRemoteVideoSinkPositionAfterPostprocess = 1 +}; + +/** + * + * @type keytype + * @brief 视频帧编码格式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSinkPixelFormat) { + /** + * + * @brief 原始视频帧格式 + */ + + ByteRTCVideoSinkPixelFormatOriginal = 0, + /** + * + * @brief YUV I420 格式 + */ + + ByteRTCVideoSinkPixelFormatI420 = 1, + /** + * + * @brief YUV NV12 格式 + */ + + ByteRTCVideoSinkPixelFormatNV12 = 2, + /** + * + * @brief RGBA 格式, 字节序为 R8 G8 B8 A8 + */ + + ByteRTCVideoSinkPixelFormatRGBA = 5, + /** + * + * @brief BGRA 格式 + */ + + ByteRTCVideoSinkPixelFormatBGRA = 7 +}; + +/** + * + * @type keytype + * @brief 是否将视频帧自动转正。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoApplyRotation) { + /** + * + * @brief (默认值)不旋转。 + */ + + ByteRTCVideoApplyRotationDefault = -1, + /** + * + * @brief 自动转正视频,即根据视频帧的旋转角信息将视频帧旋转到 0 度。 + */ + + ByteRTCVideoApplyRotation0 = 0 +}; + +/** + * + * @type keytype + * @brief 是否将视频帧镜像。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSinkMirrorType) { + /** + * + * @brief 开启镜像。 + */ + + ByteRTCVideoSinkMirrorTypeOn = 1, + /** + * + * @brief (默认值)不开启镜像。 + */ + + ByteRTCVideoSinkMirrorTypeOff = 2, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分状态改变原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSuperResolutionModeChangedReason) { + /** + * + * @brief 调用 setRemoteVideoSuperResolution:withMode:{@link #ByteRTCEngine#setRemoteVideoSuperResolution:withMode:} 成功关闭超分。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonAPIOff = 0, + /** + * + * @brief 调用 setRemoteVideoSuperResolution:withMode:{@link #ByteRTCEngine#setRemoteVideoSuperResolution:withMode:} 成功开启超分。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonAPIOn = 1, + /** + * + * @brief 开启超分失败,远端视频流的原始视频分辨率超过 640 × 360 px。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonResolutionExceed = 2, + /** + * + * @brief 开启超分失败,已对一路远端流开启超分。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonOverUse = 3, + /** + * + * @brief 设备不支持使用超分辨率。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonDeviceNotSupport = 4, + /** + * + * @brief 当前设备性能存在风险,已动态关闭 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonDynamicClose = 5, + /** + * + * @brief 超分因其他原因关闭。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonOtherSettingDisabled = 6, + /** + * + * @brief 超分因其他原因开启。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonOtherSettingEnabled = 7, + /** + * + * @brief SDK 没有编译超分组件。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonNoComponent = 8, + /** + * + * @brief 远端流不存在。房间 ID 或用户 ID 无效,或对方没有发布流。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonStreamNotExist = 9, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 视频降噪模式状态改变原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDenoiseModeChangedReason) { + /** + * + * @brief 未知原因导致视频降噪状态改变。 + */ + + ByteRTCVideoDenoiseModeChangedReasonNull = -1, + /** + * + * @brief 通过调用 setVideoDenoiser:{@link #ByteRTCEngine#setVideoDenoiser:} 成功关闭视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonApiOff = 0, + /** + * + * @brief 通过调用 setVideoDenoiser:{@link #ByteRTCEngine#setVideoDenoiser:} 成功开启视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonApiOn = 1, + /** + * + * @brief 后台未配置视频降噪,视频降噪开启失败,请联系技术人员解决。 + */ + + ByteRTCVideoDenoiseModeChangedReasonConfigDisabled = 2, + /** + * + * @brief 后台配置开启了视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonConfigEnabled = 3, + /** + * + * @brief 由于内部发生了异常,视频降噪关闭。 + */ + + ByteRTCVideoDenoiseModeChangedReasonInternalException = 4, + /** + * + * @brief 当前设备性能过载,已动态关闭视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonDynamicClose = 5, + /** + * + * @brief 当前设备性能裕量充足,已动态开启视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonDynamicOpen = 6, + /** + * + * @brief 分辨率导致视频降噪状态发生改变。分辨率过高会导致性能消耗过大,从而导致视频降噪关闭。如若希望继续使用视频降噪,可选择降低分辨率。 + */ + + ByteRTCVideoDenoiseModeChangedReasonResolution = 7, +}; +#pragma mark CDN/WTN ENUM +/** + * + * @type keytype + * @brief 转推任务事件 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamTaskEvent) { + /** + * + * @hidden for internal use only + */ + + ByteRTCMixedStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + ByteRTCMixedStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + ByteRTCMixedStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务更新成功。 + */ + + ByteRTCMixedStreamTaskEventUpdateSuccess = 3, + /** + * + * @brief 任务更新失败。 + */ + + ByteRTCMixedStreamTaskEventUpdateFailed = 4, + /** + * + * @brief 任务停止。 + */ + + ByteRTCMixedStreamTaskEventStopSuccess = 5, + /** + * + * @brief 结束任务失败。 + */ + + ByteRTCMixedStreamTaskEventStopFailed = 6, + /** + * + * @brief Warning 事件 + */ + + ByteRTCMixedStreamTaskEventWarning = 7, +}; +/** + * + * @hidden for internal use only + * @type keytype + * @brief 合流方式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamType) { + /** + * + * @brief 通过服务端合流 + */ + + ByteRTCMixedStreamByServer = 0, + /** + * + * @brief 端云一体合流。SDK 智能决策在客户端或服务端完成合流。
    + * 使用前,请联系技术支持同学开通,否则不生效。 + */ + + ByteRTCMixedStreamByClient = 1, +}; +/** + * + * @type keytype + * @brief 任务类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamPushTargetType) { + /** + * + * @brief 推到 CDN + */ + + ByteRTCMixedStreamPushTargetTypeToCDN = 0, + /** + * + * @brief WTN 流 + */ + + ByteRTCMixedStreamPushTargetTypeToWTN = 1, +}; +/** + * + * @type keytype + * @brief WTN 流的补帧模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCInterpolationMode) { + /** + * + * @type keytype + * @brief 补最后一帧 + */ + + ByteRTCInterpolationModeLastFrameFill = 0, + /** + * + * @type keytype + * @brief 补背景图片 + */ + + ByteRTCInterpolationModeBackgroundImageFill = 1, +}; +/** + * + * @type keytype + * @brief WTN 流的布局模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCStreamLayoutMode) { + /** + * + * @brief 自动布局 + */ + + ByteRTCStreamLayoutModeAuto = 0, + /** + * + * @brief 自定义 + */ + + ByteRTCStreamLayoutModeCustom = 2, +}; +/** + * + * @hidden for internal use only + * @type keytype + * @brief 客户端合流回调视频格式。
    + * 设置为系统不支持的格式时,自动回调系统默认格式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamClientMixVideoFormat) { + /** + * + * @brief YUV I420。Android、Windows 默认回调格式。支持系统:Android、Windows。 + */ + + ByteRTCMixedStreamClientMixVideoFormatI420 = 0, + /** + * + * @brief OpenGL GL_TEXTURE_2D 格式纹理。支持系统:安卓。 + */ + + ByteRTCMixedStreamClientMixVideoFormatTexture2D = 1, + /** + * + * @brief CVPixelBuffer BGRA。iOS 默认回调格式。支持系统: iOS。 + */ + + ByteRTCMixedStreamClientMixVideoFormatCVPixelBufferBGRA = 2, + /** + * + * @brief YUV NV12。macOS 默认回调格式。支持系统: macOS。 + */ + + ByteRTCMixedStreamClientMixVideoFormatNV12 = 3, +}; + +/** + * + * @type keytype + * @brief 视频编码格式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamVideoCodecType) { + /** + * + * @brief H.264 格式,默认值。 + */ + + ByteRTCMixedStreamVideoCodecTypeH264 = 0, + /** + * + * @brief ByteVC1 格式。 + */ + + ByteRTCMixedStreamVideoCodecTypeByteVC1 = 1, +}; +/** + * + * @type keytype + * @brief 合流输出媒体类型。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamMediaType) { + /** + * + * @brief 包含音频和视频 + */ + + ByteRTCMixedStreamMediaTypeAudioAndVideo = 0, + /** + * + * @brief 只包含音频 + */ + + ByteRTCMixedStreamMediaTypeAudioOnly = 1, + /** + * + * @hidden currently not available + * @brief 只包含视频 + */ + + ByteRTCMixedStreamMediaTypeVideoOnly = 2, +}; +/** + * + * @type keytype + * @brief 图片或视频流的缩放模式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamRenderMode) { + /** + * + * @brief 视窗填满优先,默认值。
    + * 视频尺寸等比缩放,直至视窗被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。 + */ + + ByteRTCMixedStreamRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 + */ + + ByteRTCMixedStreamRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
    + * 视频尺寸非等比例缩放,把窗口充满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + ByteRTCMixedStreamRenderModeAdaptive = 3, +}; +/** + * + * @type keytype + * @brief 合流布局区域类型,视频区或水印图片区。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamLayoutRegionType) { + + /** + * + * @brief 视频。 + */ + + ByteRTCMixedStreamLayoutRegionTypeVideoStream = 0, + + /** + * + * @brief 水印图片。 + */ + + ByteRTCMixedStreamLayoutRegionTypeImage = 1, +}; + +/** + * + * @hidden internal use only + * @type keytype + * @brief 合流同步策略 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamSyncStrategy) { + /** + * + * @brief 不使用同步策略 + */ + + ByteRTCMixedStreamSyncStrategyNoSync = 0, + /** + * + * @brief 使用音频精准同步策略 + */ + + ByteRTCMixedStreamSyncStrategyAudioPreciseSync = 1, + /** + * + * @brief 使用单通模式同步策略 + */ + + ByteRTCMixedStreamSyncStrategySimplexModeSync = 2, +}; + +/** + * + * @type keytype + * @brief 预留字段。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamVideoType) { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
    + * - 由摄像头/麦克风通过内部采集机制,采集到的流 + * - 通过自定义采集,采集到的流。 + */ + + ByteRTCMixedStreamVideoTypeMain = 0, + + /** + * + * @hidden for internal use only + * @brief 屏幕流。 + */ + + ByteRTCMixedStreamVideoTypeScreen = 1, +}; + +/** + * + * @type keytype + * @brief 服务端合流转推 SEI 内容。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamSEIContentMode) { + /** + * + * @brief 视频流中包含全部的 SEI 信息。默认设置。 + */ + + ByteRTCMixedStreamSEIContentModeDefault = 0, + /** + * + * @brief 随非关键帧传输的 SEI 数据中仅包含音量信息。
    + * 当设置 `ByteRTCMixedStreamControlConfig.enableVolumeIndication` 为 True 时,此参数设置生效。 + */ + + ByteRTCMixedStreamSEIContentModeEnableVolumeIndication = 1, +}; + +/** + * + * @type keytype + * @brief 服务端合流转推发起模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamPushMode) { + /** + * + * @brief 无用户发布媒体流时,发起合流任务无效。默认设置。 + * 当有用户发布媒体流时,才能发起合流任务。 + */ + + ByteRTCMixedStreamPushModeOnStream = 0, + /** + * + * @brief 无用户发布媒体流时,可以使用占位图发起合流任务。
    + * 占位图设置参看 alternateImageUrl{@link #ByteRTCMixedStreamLayoutRegionConfig#alternateImageUrl} 和 alternateImageFillMode{@link #ByteRTCMixedStreamLayoutRegionConfig#alternateImageFillMode} + */ + + ByteRTCMixedStreamPushModeOnStartRequest = 1, +}; +/** + * + * @type keytype + * @brief 服务端合流占位图填充模式。
    + * 该参数用来控制当用户停止发布视频流,画面恢复为占位图后,此时占位图的填充模式。默认值为 `ByteRTCMixedStreamAlternateImageFillModeFit`,占位图跟随用户原始视频帧相同的比例缩放。
    + * 参看 ByteRTCMixedStreamAlternateImageFillMode{@link #ByteRTCMixedStreamAlternateImageFillMode}。
    + * WTN 流任务不支持设置本参数。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamAlternateImageFillMode) { + /** + * + * @brief 占位图跟随用户原始视频帧相同的比例缩放。默认设置。 + */ + + ByteRTCMixedStreamAlternateImageFillModeFit = 0, + /** + * + * @brief 占位图不跟随用户原始视频帧相同的比例缩放,保持图片原有比例。 + */ + + ByteRTCMixedStreamAlternateImageFillModeFill = 1, +}; +/** + * + * @type errorcode + * @brief 单流转推直播事件 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSingleStreamTaskEvent) { + /** + * + * @hidden for internal use only + */ + + ByteRTCSingleStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + ByteRTCSingleStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + ByteRTCSingleStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务停止。 + */ + + ByteRTCSingleStreamTaskEventStopSuccess = 3, + /** + * + * @brief 结束任务失败。 + */ + + ByteRTCSingleStreamTaskEventStopFailed= 4, + /** + * + * @brief Warning 事件 + */ + + ByteRTCSingleStreamTaskEventWarning = 5, +}; + +/** + * + * @type errorcode + * @brief 单流转推直播错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSingleStreamTaskErrorCode) { + /** + * + * @brief 推流成功。 + */ + + ByteRTCSingleStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + ByteRTCSingleStreamTaskErrorCodeBase = 1090, + /** + * + * @brief 服务端合流错误 + */ + + ByteRTCSingleStreamTaskErrorCodeUnknownByServer = 1091, + /** + * + * @brief 任务处理超时,请检查网络状态并重试。 + */ + + ByteRTCSingleStreamTaskErrorCodeSignalRequestTimeout = 1092, + /** + * + * @brief 服务端检测任务参数不合法 + */ + + ByteRTCSingleStreamTaskErrorCodeInvalidParamByServer = 1093, + /** + * + * @brief 转推任务在目标房间的用户ID被踢出目标房间 + */ + + ByteRTCSingleStreamTaskErrorCodeRemoteKicked = 1094, + /** + * + * @brief 转推任务加入目标房间失败 + */ + + ByteRTCSingleStreamTaskErrorCodeJoinDestRoomFailed = 1095, + /** + * + * @brief 转推任务在源房间拉流超时 + */ + + ByteRTCSingleStreamTaskErrorCodeReceiveSrcStreamTimeout = 1096, + /** + * + * @brief 音视频编码转推任务不支持 + */ + + ByteRTCSingleStreamTaskErrorCodeNotSurportCodec = 1097, + /** + * + * @brief 转推到CDN失败 + */ + + ByteRTCSingleStreamTaskErrorCodePushToCDN = 1098, + /** + * + * @brief 超过单流转推的任务数限制(单主播可同时转推任务数不超过20) + */ + + ByteRTCSingleStreamTaskErrorCodeTaskCountOverLimit = 1099, +}; +/** + * + * @type keytype + * @brief 订阅媒体的类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubscribeMediaType) { + /** + * + * @brief 既不订阅音频,也不订阅视频 + */ + + ByteRTCSubscribeMediaTypeNone = 0, + /** + * + * @brief 只订阅音频,不订阅视频 + */ + + ByteRTCSubscribeMediaTypeAudioOnly = 1, + /** + * + * @brief 只订阅视频,不订阅音频 + */ + + ByteRTCSubscribeMediaTypeVideoOnly = 2, + /** + * + * @brief 同时订阅音频和视频 + */ + + ByteRTCSubscribeMediaTypeAudioAndVideo = 3, +}; + +/** + * + * @type keytype + * @brief 暂停/恢复接收远端的媒体流类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPauseResumControlMediaType) { + /** + * + * @brief 只控制音频,不影响视频 + */ + + ByteRTCControlMediaTypeAudio = 0, + /** + * + * @brief 只控制视频,不影响音频 + */ + + ByteRtcControlMediaTypeVideo = 1, + /** + * + * @brief 同时控制音频和视频 + */ + + ByteRtcControlMediaTypeAudioAndVideo = 2, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 视频输入类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaInputType) { + /** + * + * @brief 自定义采集。
    + * 设置完成后方可直接向 SDK 推送视频帧。 + */ + + ByteRTCMediaInputTypeExternal = 0, + /** + * + * @brief 内部 SDK 采集。
    + * 此设置仅切换至内部采集,你需继续调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部采集。 + */ + + ByteRTCMediaInputTypeInternal = 1 +}; + +/** + * + * @type keytype + * @brief 视频输入源类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSourceType) { + /** + * + * @brief 自定义采集视频源 + */ + + ByteRTCVideoSourceTypeExternal = 0, + /** + * + * @brief 内部采集视频源 + */ + + ByteRTCVideoSourceTypeInternal = 1, + /** + * + * @brief 自定义编码视频源。
    + * 你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流 + */ + + ByteRTCVideoSourceTypeEncodedAutoSimulcast = 2, + /** + * + * @brief 自定义编码视频源。
    + * SDK 不会自动生成多路流,你需要自行生成并推送多路流 + */ + + ByteRTCVideoSourceTypeEncodedManualSimulcast = 3 +}; + +/** + * + * @type keytype + * @brief Alpha 通道相对于 RGB 通道数据的排列位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAlphaLayout) { + /** + * + * @brief Alpha 数据置于 RGB 数据上方。 + */ + + ByteRTCAlphaLayoutTop = 0, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据下方。 + */ + + ByteRTCAlphaLayoutBottom = 1, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据左方。 + */ + + ByteRTCAlphaLayoutLeft = 2, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据右方。 + */ + + ByteRTCAlphaLayoutRight = 3, +}; + +/** + * + * @type keytype + * @brief 数码变焦参数类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCZoomConfigType) { + /** + * + * @brief 设置缩放系数 + */ + + ByteRTCZoomConfigTypeFocusOffset = 0, + /** + * + * @brief 设置移动步长 + */ + + ByteRTCZoomConfigTypeMoveOffset = 1 +}; + +/** + * + * @type keytype + * @brief 数字变焦操作类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCZoomDirectionType) { + /** + * + * @brief 相机向左移动 + */ + + ByteRTCZoomDirectionTypeMoveLeft = 0, + /** + * + * @brief 相机向右移动 + */ + + ByteRTCZoomDirectionTypeMoveRight = 1, + /** + * + * @brief 相机向上移动 + */ + + ByteRTCZoomDirectionTypeMoveUp = 2, + /** + * + * @brief 相机向下移动 + */ + + ByteRTCZoomDirectionTypeMoveDown = 3, + /** + * + * @brief 相机缩小焦距 + */ + + ByteRTCZoomDirectionTypeZoomOut = 4, + /** + * + * @brief 相机放大焦距 + */ + + ByteRTCZoomDirectionTypeZoomIn = 5, + /** + * + * @brief 恢复到原始画面 + */ + + ByteRTCZoomDirectionTypeReset = 6 +}; + +/** + * + * @type keytype + * @brief 视频解码方式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDecoderConfig) { + /** + * + * @brief 开启 SDK 内部解码,只回调解码后的数据。回调为 renderPixelBuffer:rotation:contentType:extendedData:{@link #ByteRTCVideoSinkDelegate#renderPixelBuffer:rotation:contentType:extendedData:} + */ + + ByteRTCVideoDecoderConfigRaw = 0, + /** + * + * @brief 开启自定义解码,只回调解码前数据。回调为 onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:{@link #ByteRTCRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:}。 + */ + + ByteRTCVideoDecoderConfigEncode = 1, + /** + * + * @brief 开启 SDK 内部解码,同时回调解码前和解码后的数据 + */ + + ByteRTCVideoDecoderConfigBoth = 2 +}; + +/** + * + * @type keytype + * @brief 虚拟背景类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVirtualBackgroundSourceType){ + /** + * + * @brief 使用纯色背景替换视频原有背景。 + */ + + ByteRTCVirtualBackgroundSourceTypeColor = 0, + /** + * + * @brief 使用自定义图片替换视频原有背景。 + */ + + ByteRTCVirtualBackgroundSourceTypeImage = 1 +}; + +/** + * + * @type keytype + * @brief 摄像头类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCCameraID) { + /** + * + * @brief 前置摄像头 + */ + + ByteRTCCameraIDFront = 0, + /** + * + * @brief 后置摄像头 + */ + + ByteRTCCameraIDBack = 1, + /** + * + * @hidden currently not available + * @brief 外接摄像头 + */ + + ByteRTCCameraIDExternal = 2, + /** + * + * @brief 无效值 + */ + + ByteRTCCameraIDInvalid = 3, +}; + +/** + * + * @type errorcode + * @brief 合流和 WTN 流任务错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamTaskErrorCode) { + /** + * + * @brief 推流成功。 + */ + + ByteRTCMixedStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + ByteRTCMixedStreamTaskErrorCodeBase = 1090, + /** + * + * @brief 任务处理超时,请检查网络状态并重试 + */ + + ByteRTCMixedStreamTaskErrorCodeTimeOut = 1091, + /** + * + * @brief 服务端检测到错误的推流参数 + */ + + ByteRTCMixedStreamTaskErrorCodeInvalidParamByServer = 1092, + /** + * + * @brief 对流的订阅超时 + */ + + ByteRTCMixedStreamTaskErrorCodeSubTimeoutByServer = 1093, + /** + * + * @brief 合流服务端内部错误。 + */ + + ByteRTCMixedStreamTaskErrorCodeInvalidStateByServer = 1094, + /** + * + * @brief 合流服务端推 CDN 失败。 + */ + + ByteRTCMixedStreamTaskErrorCodeAuthenticationByCDN = 1095, + /** + * + * @brief 服务端未知错误。 + */ + + ByteRTCMixedStreamTaskErrorCodeUnKnownErrorByServer = 1096, + /** + * + * @brief 服务端接收信令超时,请检查网络状态并重试。 + */ + + ByteRTCMixedStreamTaskErrorCodeSignalRequestTimeout = 1097, + /** + * + * @brief 图片合流失败。 + */ + + ByteRTCMixedStreamTaskErrorCodeMixImageFailed = 1098, + /** + * + * @hidden currently not available + * @brief 缓存未同步。 + */ + + ByteRTCMixedStreamTaskErrorCodeStreamSyncWorse = 1099, + /** + * + * @brief 发布 WTN 流失败 + */ + + ByteRTCMixedStreamTaskErrorCodePushWTNFailed = 1195, + /** + * + * @hidden for internal use only + */ + + ByteRTCMixedStreamTaskErrorCodeMax = 1199, +}; +/** + * + * @type keytype + * @brief 本地录制的媒体类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingType) { + /** + * + * @brief 只录制音频 + */ + + ByteRTCRecordingTypeAudioOnly = 0, + /** + * + * @brief 只录制视频 + */ + + ByteRTCRecordingTypeVideoOnly = 1, + /** + * + * @brief 同时录制音频和视频 + */ + + ByteRTCRecordingTypeVideoAndAudio = 2, +}; + +/** + * + * @type keytype + * @brief 屏幕采集媒体类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCScreenMediaType) { + /** + * + * @brief 只采集视频数据 + */ + + ByteRTCScreenMediaTypeVideoOnly = 0, + /** + * + * @brief 只采集音频数据 + */ + + ByteRTCScreenMediaTypeAudioOnly = 1, + /** + * + * @brief 音视频数据都采集 + */ + + ByteRTCScreenMediaTypeVideoAndAudio = 2 +}; + +/** + * + * @type keytype + * @brief 屏幕采集对象的类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCScreenCaptureSourceType) { + /** + * + * @brief 类型未知 + */ + + ByteRTCScreenCaptureSourceTypeUnknown = 0, + /** + * + * @brief 应用程序的窗口 + */ + + ByteRTCScreenCaptureSourceTypeWindow = 1, + /** + * + * @brief 桌面 + */ + + ByteRTCScreenCaptureSourceTypeScreen = 2 +}; +/** + * + * @type keytype + * @region 屏幕共享 + * @brief 内部采集屏幕视频流时,是否采集鼠标信息。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMouseCursorCaptureState) { + /** + * + * @brief 采集鼠标信息。 + */ + + ByteRTCMouseCursorCaptureStateOn, + /** + * + * @brief 不采集鼠标信息。 + */ + + ByteRTCMouseCursorCaptureStateOff, +}; +/** + * + * @type keytype + * @brief 屏幕共享时的边框高亮设置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCHighlightConfig: NSObject +/** + * + * @brief 是否显示高亮边框,默认显示。 + */ + +@property (assign, nonatomic) BOOL enableHighlight; +/** + * + * @brief 边框的颜色, 颜色格式为十六进制 ARGB: 0xAARRGGB。 + */ + +@property (assign, nonatomic) uint32_t borderColor; +/** + * + * @brief 边框的宽度,单位:像素。 + */ + +@property (assign, nonatomic) int borderWidth; +@end + +/** + * + * @type keytype + * @brief 相机补光灯状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCTorchState) { + /** + * + * @brief 相机补光灯关闭 + */ + + ByteRTCTorchStateOff = 0, + /** + * + * @brief 相机补光灯打开 + */ + + ByteRTCTorchStateOn = 1, +}; + +/** + * + * @type keytype + * @brief 当前视频设备类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDeviceType) { + /** + * + * @brief 未知视频设备 + */ + + ByteRTCVideoDeviceTypeUnknown = -1, + /** + * + * @brief 视频渲染设备类型 + */ + + ByteRTCVideoDeviceTypeRenderDevice = 0, + /** + * + * @brief 视频采集设备类型 + */ + + ByteRTCVideoDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流视频设备 + */ + + ByteRTCVideoDeviceTypeScreenCaptureDevice = 2 +}; + +/** + * + * @type keytype + * @brief 媒体流类型 + */ + +typedef NS_OPTIONS(NSUInteger, ByteRTCMediaStreamType) { + /** + * + * @brief 只控制音频 + */ + + ByteRTCMediaStreamTypeAudio = (1 << 0), + /** + * + * @brief 只控制视频 + */ + + ByteRTCMediaStreamTypeVideo = (1 << 1), + /** + * + * @brief 同时控制音频和视频 + */ + + ByteRTCMediaStreamTypeBoth = ByteRTCMediaStreamTypeAudio | ByteRTCMediaStreamTypeVideo, +}; + +/** + * + * @type keytype + * @brief 占发布端原始帧率的比例 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCFrameRateRatio) { + /** + * + * @brief 100% + */ + + ByteRTCFrameRateRatioOrigin = 0, + /** + * + * @brief 50% + */ + + ByteRTCFrameRateRatioHalf = 1, + /** + * + * @brief 25% + */ + + ByteRTCFrameRateRatioQuater = 2, +}; + +/** + * + * @type keytype + * @brief 视频旋转模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCVideoRotationMode) { + /** + * + * @brief App 方向 + */ + + ByteRTCVideoRotationModeFollowApp = 0, + /** + * + * @brief 重力方向 + */ + + ByteRTCVideoRotationModeFollowGSensor = 1, +}; + +/** + * + * @type keytype + * @brief 弱光适应类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCVideoEnhancementMode) { + /** + * + * @brief 关闭弱光适应 + */ + + ByteRTCVideoEnhancementModeDisabled = 0, + + /** + * + * @brief 开启弱光适应 + */ + + ByteRTCVideoEnhancementModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 人像属性检测参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCExpressionDetectConfig : NSObject +/** + * + * @brief 是否开启年龄检测。 + */ + +@property (assign, nonatomic) BOOL enableAgeDetect; +/** + * + * @brief 是否开启性别检测。 + */ + +@property (assign, nonatomic) BOOL enableGenderDetect; +/** + * + * @brief 是否开启表情检测。 + */ + +@property (assign, nonatomic) BOOL enableEmotionDetect; +/** + * + * @brief 是否开启吸引力检测。 + */ + +@property (assign, nonatomic) BOOL enableAttractivenessDetect; +/** + * + * @brief 是否开启开心程度检测。 + */ + +@property (assign, nonatomic) BOOL enableHappinessDetect; +@end + +/** + * + * @type keytype + * @brief 人像属性检测信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCExpressionDetectInfo : NSObject +/** +* +* @brief 预测年龄,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float age; +/** +* +* @brief 预测为男性的概率,取值范围 (0.0, 1.0)。 +*/ + +@property (assign, nonatomic) float boyProb; +/** +* +* @brief 预测的吸引力分数,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float attractive; +/** +* +* @brief 预测的微笑程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float happyScore; +/** +* +* @brief 预测的伤心程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float sadScore; +/** +* +* @brief 预测的生气程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float angryScore; +/** +* +* @brief 预测的吃惊程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float surpriseScore; +/** +* +* @brief 预测的情绪激动程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float arousal; +/** +* +* @brief 预测的情绪正负程度,取值范围 (-100, 100)。 +*/ + +@property (assign, nonatomic) float valence; +@end + +/** + * + * @type keytype + * @brief 人像属性检测结果 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCExpressionDetectResult : NSObject +/** + * + * @brief 特征识别结果
    + * - 0:识别成功 + * - !0:识别失败 + */ + +@property (assign, nonatomic) int detectResult; +/** + * + * @brief 识别到的人脸数量。 + */ + +@property (assign, nonatomic) int faceCount; + +/** + * + * @brief 特征识别信息。数组的长度和检测到的人脸数量一致。参看 ByteRTCExpressionDetectInfo{@link #ByteRTCExpressionDetectInfo}。 + */ + +@property (nonatomic, copy) NSArray * _Nonnull detectInfo; + +@end + +/** + * + * @type keytype + * @brief 矩形区域,用于指定屏幕区域。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRectangle : NSObject +/** + * + * @brief 矩形区域左上角的 x 坐标。 + */ + +@property(assign, nonatomic) int x; +/** + * + * @brief 矩形区域左上角的 y 坐标。 + */ + +@property(assign, nonatomic) int y; +/** + * + * @brief 矩形宽度,单位:px。 + */ + +@property(assign, nonatomic) int width; +/** + * + * @brief 矩形高度,单位:px。 + */ + +@property(assign, nonatomic) int height; +@end +/** + * + * @type keytype + * @brief 人脸检测结果 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCFaceDetectionResult : NSObject +/** + * + * @brief 人脸检测结果
    + * - 0:检测成功 + * - !0:检测失败。详见[错误码](https: + */ + +@property(assign, nonatomic) int detectResult; +/** + * + * @brief 原始图片宽度(px) + */ + +@property(assign, nonatomic) int imageWidth; +/** + * + * @brief 原始图片高度(px) + */ + +@property(assign, nonatomic) int imageHeight; +/** + * + * @brief 识别到人脸的矩形框。数组的长度和检测到的人脸数量一致。参看 ByteRTCRectangle{@link #ByteRTCRectangle}。 + */ + +@property(nonatomic, copy) NSArray * _Nullable faces; +/** + * + * @brief 进行人脸识别的视频帧的时间戳。 + */ + +@property(assign, nonatomic) CMTime frameTimestamp; + +@end +/** + * + * @type keytype + * @brief 视频帧渲染设置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoCanvas : NSObject +/** + * + * @brief 本地视图句柄 + */ + +@property(strong, nonatomic) ByteRTCView* _Nullable view; +/** + * + * @brief 渲染模式,参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + */ + +@property(assign, nonatomic) ByteRTCRenderMode renderMode; +/** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`,格式为 BGR。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + +@property(assign, nonatomic) NSInteger backgroundColor; +/** + * + * @brief 视频帧旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。默认为 0 度,即不做旋转处理。
    + * 该设置仅对远端视频有效,对本地视频设置不生效。 + */ + +@property(assign, nonatomic) ByteRTCVideoRotation renderRotation; +@end + +/** + * + * @type keytype + * @brief 远端视频帧渲染设置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoRenderConfig : NSObject +/** + * + * @brief 渲染模式,参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + */ + +@property(assign, nonatomic) ByteRTCRenderMode renderMode; +/** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`,格式为 BGR。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + +@property(assign, nonatomic) NSInteger backgroundColor; +/** + * + * @brief 视频帧旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。默认为 0 度,即不做旋转处理。 + */ + +@property(assign, nonatomic) ByteRTCVideoRotation renderRotation; +@end + + +/** + * + * @type keytype + * @brief 视频帧附加的数据,视频解码后获得的附加数据 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCFrameExtendedData : NSObject +/** + * + * @brief 数据类型,详见 ByteRTCDataFrameType{@link #ByteRTCDataFrameType}。 + */ + +@property(assign, nonatomic) ByteRTCDataFrameType frameType; +/** + * + * @brief 附加数据 + */ + +@property(strong, nonatomic) NSData * _Nullable extendedData; +/** + * + * @brief 附加数据长度 + */ + +@property(assign, nonatomic) NSInteger extendedDataLen; +@end + +NS_ASSUME_NONNULL_BEGIN + +/** + * + * @type keytype + * @brief 视频流参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoSolution: NSObject +/** + * + * @brief 视频分辨率 + */ + +@property(nonatomic, assign) CGSize videoSize; +/** + * + * @brief 视频预设帧率 + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 最高编码码率(千比特每秒)。建议使用 `-1`,SDK 会自动根据分辨率和帧率适配合适的码率。 + */ + +@property(nonatomic, assign) NSInteger maxKbps; +/** + * + * @brief 最低编码码率(千比特每秒) + */ + +@property(nonatomic, assign) NSInteger minKbps; +/** + * + * @brief 视频编码质量策略,参见 ByteRTCVideoEncoderPreference{@link #ByteRTCVideoEncoderPreference} + */ + +@property(nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference; +@end + +/** + * + * @type keytype + * @brief 视频采集参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoCaptureConfig: NSObject +/** + * + * @brief 视频采集模式,参看 ByteRTCVideoCapturePreference{@link #ByteRTCVideoCapturePreference} + */ + +@property(nonatomic, assign) ByteRTCVideoCapturePreference preference; + +/** + * + * @brief 视频采集分辨率 + */ + +@property(nonatomic, assign) CGSize videoSize; +/** + * + * @brief 视频采集帧率,单位:fps。 + */ + +@property(nonatomic, assign) NSInteger frameRate; +@end + +/** + * + * @type keytype + * @brief 流属性。 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCStream +/** + * + * @brief 发布此流的用户 ID。 + */ + +@property(nonatomic, copy, readonly) NSString * userId; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign, readonly) BOOL isScreen; +/** + * + * @brief 此流是否包括视频流。 + */ + +@property(nonatomic, assign, readonly) BOOL hasVideo; +/** + * + * @brief 流是否包括音频流。 + */ + +@property(nonatomic, assign, readonly) BOOL hasAudio; +/** + * + * @brief 视频流的分辨率信息。
    + * 当远端用户调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。
    + * 参看 ByteRTCVideoSolution{@link #ByteRTCVideoSolution}。 + */ + +@property(nonatomic, copy, readonly) NSArray * videoStreamDescriptions; +/** + * + * @brief 视频流最大分辨率,在开启多分辨率发布订阅时,回调发布端能支持的最大发布分辨率。 + */ + +@property(nonatomic, retain, readonly) ByteRTCVideoSolution *maxVideoStreamDescription; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) ByteRTCStreamIndex streamIndex; +@end + +/** + * + * @type keytype + * @brief 订阅流的参数配置。用户手动订阅一路音视频流所使用的订阅配置参数。
    + * 用户关闭自动订阅功能,使用手动订阅模式时,通过调用 `subscribeStream` 方法订阅音视频流,调用时传入的参数即为此数据类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubscribeConfig: NSObject +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +/** + * + * @brief 是否订阅视频。
    + * 用户通过设置此参数,选择是否订阅远端流中的视频。 YES 为订阅视频,NO 为不订阅视频,默认值为 YES 。 + */ + +@property(nonatomic, assign) BOOL subscribeVideo; +/** + * + * @brief 是否订阅音频。
    + * 用户通过设置此参数,选择是否订阅远端流中的音频。YES 为订阅音频,NO 为不订阅音频,默认值为 YES 。 + */ + +@property(nonatomic, assign) BOOL subscribeAudio; +/** + * + * @brief 订阅的视频流分辨率下标。
    + * 用户可以通过调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 方法发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。 + */ + +@property(nonatomic, assign) NSInteger videoIndex; +/** + * + * @brief 订阅的视频流时域分层,默认值为 0。 + */ + +@property(nonatomic, assign) NSInteger svcLayer; +/** + * + * @brief 订阅的宽度信息,单位:px,默认值为 0。 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 订阅的高度信息,单位:px, 默认值为 0。 + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @hidden for internal use only + */ + +@property(nonatomic, assign) NSInteger subVideoIndex; +/** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0,设为大于 0 的值时开始生效。
    + * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
    + * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + +@property (nonatomic, assign) NSInteger framerate; + + +@end + +NS_ASSUME_NONNULL_END + +/** + * + * @type keytype + * @brief 视频帧数据 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoFrameData : NSObject +/** + * + * @brief 视频帧缓冲区类型,参考 ByteRTCVideoBufferType {@link #ByteRTCVideoBufferType}。必填。 + */ + +@property ByteRTCVideoBufferType bufferType; + +/** + * + * @brief 视频帧像素格式,参考 ByteRTCVideoPixelFormat {@link #ByteRTCVideoPixelFormat}。当 `bufferType` 为 `ByteRTCVideoBufferTypeGLTexture` 时必填。 + */ + +@property ByteRTCVideoPixelFormat pixelFormat; +/** + * + * @brief 视频内容类型,参看 ByteRTCVideoContentType{@link #ByteRTCVideoContentType} + */ + +@property ByteRTCVideoContentType contentType; +/** + * + * @brief 当前帧的时间戳。必填。 + */ + +@property CMTime timestamp; +/** + * + * @brief 视频帧宽度。必填。 + */ + +@property int width; +/** + * + * @brief 视频帧高度。必填。 + */ + +@property int height; +/** + * + * @brief `CVPixelBufferRef` 类型的数据,当 `format` 为 `kPixelFormatCVPixelBuffer` 时,必填。 + */ + +@property CVPixelBufferRef _Nullable cvpixelbuffer; +/** + * + * @brief 视频帧旋转角度,参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。 + */ + +@property ByteRTCVideoRotation rotation; +/** + * + * @brief 视频帧的摄像头位置信息,参考 ByteRTCCameraID{@link #ByteRTCCameraID} + */ + +@property ByteRTCCameraID cameraId; +/** + * + * @brief SEI 数据 + */ + +@property NSData * _Nullable seiData; + +/** + * + * @brief 视频帧感兴趣区域数据 + */ + +@property NSData * _Nullable roiData; + +/** + * + * @brief 视频帧平面数。当 `bufferType` 为 `ByteRTCVideoBufferTypeRawMemory` 时必填。 + */ + +@property int numberOfPlanes; + +/** + * + * @brief 视频帧平面数组。当 `bufferType` 为 `ByteRTCVideoBufferTypeRawMemory` 时必填。 + */ + +@property void ** _Nullable planeDataArray; + +/** + * + * @brief stride 数组。stride 指视频帧平面相邻两行图像数据之间的内存长度(单位字节)。当 `bufferType` 为 `ByteRTCVideoBufferTypeRawMemory` 时必填。 + */ + +@property int * _Nullable planeStrideArray; +@end + +/** + * + * @type keytype + * @brief 视频帧接口 + */ + + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoFrame +@required +/** + * + * @brief 获取视频帧缓冲区类型,参考 ByteRTCVideoBufferType {@link #ByteRTCVideoBufferType} + */ + +@property(readonly) ByteRTCVideoBufferType bufferType; + +/** + * + * @brief 获取视频帧像素格式,参考 ByteRTCVideoPixelFormat {@link #ByteRTCVideoPixelFormat} + */ + +@property(readonly) ByteRTCVideoPixelFormat pixelFormat; +/** + * + * @brief 获取视频帧内容类型,参看 ByteRTCVideoContentType{@link #ByteRTCVideoContentType} + */ + +@property(readonly) ByteRTCVideoContentType contentType; +/** + * + * @brief 获取时间戳 + */ + +@property(readonly) CMTime timestamp; +/** + * + * @brief 获取视频帧宽度 + */ + +@property(readonly) int width; +/** + * + * @brief 获取视频帧高度 + */ + +@property(readonly) int height; +/** + * + * @brief 获取 `CVPixelBufferRef` 类型的数据,当 format 为 `kPixelFormatCVPixelBuffer` 时有效 + */ + +@property(readonly) CVPixelBufferRef _Nullable cvpixelbuffer; +/** + * + * @brief 获取视频帧旋转角度 + */ + +@property(readonly) ByteRTCVideoRotation rotation; +/** + * + * @brief 获取视频帧的摄像头位置,参考 ByteRTCCameraID{@link #ByteRTCCameraID} + */ + +@property(readonly) ByteRTCCameraID cameraId; +/** + * + * @brief 获取 SEI 数据 + */ + +@property(readonly) NSData * _Nullable seiData; + +/** + * + * @brief 获取视频帧平面数量 + */ + +@property (readonly) int numberOfPlanes; + +/** + * + * @brief 获取视频帧平面数组 + */ + +@property (readonly) void ** _Nullable planeDataArray; + +/** + * + * @brief 获取 stride 数组。 stride 指视频帧平面相邻两行图像数据之间的内存长度(单位字节) + */ + +@property (readonly) int * _Nullable planeStrideArray; +/** + * + * @brief 视频帧引用计数加一 + * @note 视频帧消费者希望对视频帧进行异步处理时(例如切换线程进行渲染),需要调用此接口增加引用计数。异步处理结束则需要调用 `releaseRef` 使引用计数减1 + */ + +- (void)addRef; +/** + * + * @brief 视频帧引用计数减一。 + * @note 视频帧引用计数减为 0 时,视频帧对象会被释放。视频帧对象释放后,不应该继续使用视频帧。 + */ + +- (long)releaseRef; +@end + +/** + * + * @type keytype + * @brief 视频帧信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEncodedVideoFrame : NSObject +/** + * + * @brief 视频编码类型。参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} + */ + +@property(assign, nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief 视频帧编码类型。参看 ByteRTCVideoPictureType{@link #ByteRTCVideoPictureType} + */ + +@property(assign, nonatomic) ByteRTCVideoPictureType pictureType; +/** + * + * @brief 视频采集时间戳,单位:微秒 + */ + +@property(assign, nonatomic) SInt64 timestampUs; +/** + * + * @brief 视频编码时间戳,单位:微秒 + */ + +@property(assign, nonatomic) SInt64 timestampDtsUs; +/** + * + * @brief 视频帧宽,单位:px + */ + +@property(assign, nonatomic) int width; +/** + * + * @brief 视频帧高,单位:px + */ + +@property(assign, nonatomic) int height; +/** + * + * @brief 视频帧旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation} + */ + +@property(nonatomic, assign) ByteRTCVideoRotation rotation; +/** + * + * @brief 视频帧数据指针地址 + */ + +@property(strong, nonatomic) NSData * _Nonnull data; + +@end + +#pragma mark CDN/WTN object +/** + * + * @type keytype + * @brief 转推任务详情 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamTaskInfo : NSObject +/** + * + * @type keytype + * @brief 任务 ID + * 对于 WTN 流任务,该值代表 WTN 流 ID。你可以通过该 ID,指定需要订阅的 WTN 流。 + */ + +@property(nonatomic, copy) NSString * _Nonnull taskId; +/** + * + * @type keytype + * @brief 任务类型,合流转推 CDN 还是 WTN 流。 + */ + +@property(nonatomic, assign) ByteRTCMixedStreamPushTargetType pushTargetType; +@end +/** + * + * @type keytype + * @brief WTN 流裁剪信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSourceCropInfo : NSObject +/** + * + * @brief 裁剪后得到的视频帧左上角横坐标相对于裁剪前整体画面的比例,取值范围[0.0, 1.0) + */ + +@property(assign, nonatomic) CGFloat locationX; +/** + * + * @brief 裁剪后得到的视频帧左上角纵坐标相对于裁剪前整体画面的比例,取值范围[0.0, 1.0) + */ + +@property(assign, nonatomic) CGFloat locationY; +/** + * + * @brief 裁剪后得到的视频帧宽度相对于裁剪前整体画面的比例,取值范围(0.0, 1.0] + */ + +@property(assign, nonatomic) CGFloat widthProportion; +/** + * + * @brief 裁剪后得到的视频帧高度相对于裁剪前整体画面的比例,取值范围(0.0, 1.0] + */ + +@property(assign, nonatomic) CGFloat heightProportion; +@end +/** + * + * @type keytype + * @brief 图片合流水印图片分辨率。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig : NSObject +/** + * + * @brief 原始图片的宽度,单位为 px。 + */ + +@property (assign, nonatomic) NSInteger imageWidth; +/** + * + * @brief 原始图片的高度,单位为 px。 + */ + +@property (assign, nonatomic) NSInteger imageHeight; +@end + +/** + * + * @type keytype + * @brief 单个图片或视频流在合流中的布局信息。
    + * 开启合流功能后,在多路图片或视频流合流时,你可以设置其中一路流在合流中的预设布局信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamLayoutRegionConfig : NSObject +/** + * + * @brief 视频流发布用户的用户 ID 。建议设置。 + */ + +@property(copy, nonatomic) NSString * _Nonnull userID; +/** + * + * @brief 图片或视频流所在房间的房间 ID。建议设置。
    + * 如果此图片或视频流是通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 转发到你所在房间的媒体流时,你应将房间 ID 设置为你所在的房间 ID。 + */ + +@property(copy, nonatomic) NSString * _Nonnull roomID; +/** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 X 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的横向位移。
    + * 取值范围为 [0, 整体画布宽度)。默认值为 0。 + */ + +@property(assign, nonatomic) NSInteger locationX; +/** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 Y 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的纵向位移。
    + * 取值范围为 [0, 整体画布高度)。默认值为 0。 + */ + +@property(assign, nonatomic) NSInteger locationY; +/** + * + * @brief 单个用户画面的宽度。取值范围为 [0, 整体画布宽度],默认值为 360。 + */ + +@property(assign, nonatomic) NSInteger width; +/** + * + * @brief 单个用户画面的高度。取值范围为 [0, 整体画布高度],默认值为 640。 + */ + +@property(assign, nonatomic) NSInteger height; +/** + * + * @brief 用户视频布局在画布中的层级。取值范围为 [0 - 100],0 为底层,值越大越上层。默认值为 0。建议设置。 + */ + +@property(assign, nonatomic) NSInteger zOrder; +/** + * + * @brief 是否为本地用户 + */ + +@property(assign, nonatomic) BOOL isLocalUser; +/** + * + * @brief 流类型,默认为主流。参看 ByteRTCMixedStreamVideoType{@link #ByteRTCMixedStreamVideoType}。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamVideoType streamType; +/** + * + * @brief 透明度,可选范围为 (0.0, 1.0],0.0 为全透明。默认值为 1.0。 + */ + +@property(assign, nonatomic) CGFloat alpha; +/** + * + * @brief 圆角半径相对画布宽度的比例。默认值为 `0.0`。
    + * 做范围判定时,首先根据画布的宽高,将 `width`,`height`,和 `cornerRadius` 分别转换为像素值:`width_px`,`height_px`,和 `cornerRadius_px`。然后判定是否满足 `cornerRadius_px < min(width_px/2, height_px/2)`:若满足,则设置成功;若不满足,则将 `cornerRadius_px` 设定为 `min(width_px/2, height_px/2)`,然后将 `cornerRadius` 设定为 `cornerRadius_px` 相对画布宽度的比例值。 + * WTN 流任务不支持设置本参数。 + */ + +@property(assign, nonatomic) CGFloat cornerRadius; +/** + * + * @brief 合流内容控制。默认值为 `ByteRTCTranscoderContentControlTypeHasAudioAndVideo`,参看 ByteRTCMixedStreamMediaType{@link #ByteRTCMixedStreamMediaType} 。 + */ + +@property (assign, nonatomic) ByteRTCMixedStreamMediaType mediaType; +/** + * + * @brief 图片或视频流的缩放模式,参看 ByteRTCMixedStreamRenderMode{@link #ByteRTCMixedStreamRenderMode}。默认值为 1。建议设置。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamRenderMode renderMode; +/** + * + * @brief 合流布局区域类型。参看 ByteRTCMixedStreamLayoutRegionType{@link #ByteRTCMixedStreamLayoutRegionType}。建议设置。 + */ + +@property (assign, nonatomic) ByteRTCMixedStreamLayoutRegionType regionContentType; +/** + * + * @brief 水印图 RGBA 数据。当 `regionContentType` 为图片类型时需要设置。
    + * - `ByteRTCMixedStreamLayoutRegionTypeImage = 1` 时,传入图片 RGBA 数据。 + * - `ByteRTCMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + +@property (strong, nonatomic) NSData * _Nullable imageWaterMark; +/** + * + * @brief 水印图参数。当 `regionContentType` 为图片类型时需要设置。
    + * - `ByteRTCMixedStreamLayoutRegionTypeImage = 1` 时,传入图片参数,参看 ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig{@link #ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig}。 + * - `ByteRTCMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + +@property (strong, nonatomic) ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig * _Nullable imageWaterMarkConfig; +/** + * + * @brief 空间位置。参看 ByteRTCPosition{@link #ByteRTCPosition}。 + */ + +@property (strong, nonatomic) ByteRTCPosition * _Nullable spatialPosition; +/** + * + * @brief 设置某用户是否应用空间音频效果:
    + * - Yes:启用(默认值) + * - No:禁用 + */ + +@property(assign, nonatomic) BOOL applySpatialAudio; +/** + * + * @valid since 3.57 + * @brief 设置占位图的填充模式。
    + * 该参数用来控制当用户停止发布视频流,画面恢复为占位图后,此时占位图的填充模式。参看 ByteRTCMixedStreamAlternateImageFillMode{@link #ByteRTCMixedStreamAlternateImageFillMode}。 + */ + +@property (assign, nonatomic)ByteRTCMixedStreamAlternateImageFillMode alternateImageFillMode; +/** + * + * @valid since 3.57 + * @brief 设置占位图的 URL,长度小于 1024 字符. + */ + +@property(copy, nonatomic)NSString * alternateImageUrl; +/** + * + * @valid since 3.57 + * @brief WTN 流裁剪区域。参看 ByteRTCSourceCropInfo{@link #ByteRTCSourceCropInfo}。 + */ + +@property(strong, nonatomic) ByteRTCSourceCropInfo * _Nonnull sourceCrop; +@end + +/** + * + * @type keytype + * @brief 视频转码配置参数。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamVideoConfig : NSObject +/** + * + * @brief 视频编码格式,参看 ByteRTCMixedStreamVideoCodecType{@link #ByteRTCMixedStreamVideoCodecType}。默认值为 `0`。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamVideoCodecType videoCodec; +/** + * + * @brief 合流视频宽度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 640 px。建议设置。
    + * 设置值为非偶数时,自动向上取偶数。 + */ + +@property(assign, nonatomic) NSInteger width; +/** + * + * @brief 合流视频高度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 360 px。建议设置。
    + * 设置值为非偶数时,自动向上取偶数。 + */ + +@property(assign, nonatomic) NSInteger height; +/** + * + * @brief 合流视频帧率。单位为 FPS,取值范围为 [1,60],默认值为 15 FPS。建议设置。 + */ + +@property(assign, nonatomic) NSInteger fps; +/** + * + * @brief 视频 I 帧时间间隔。单位为秒,取值范围为 [1, 5],默认值为 2 秒。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(assign, nonatomic) NSInteger gop; +/** + * + * @brief 合流视频码率。单位为 Kbps,取值范围为 [1,10000],默认值为自适应模式。建议设置。 + */ + +@property(assign, nonatomic) NSInteger bitrate; +/** + * + * @brief 是否在合流中开启 B 帧,仅服务端合流支持. + */ + +@property(assign, nonatomic) BOOL enableBFrame; +@end + +/** + * + * @type keytype + * @brief 音频转码配置参数。
    + * 值不合法或未设置时,自动使用默认值。
    + * 本参数不支持过程中更新。
    + * WTN 流任务不支持设置本参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamAudioConfig : NSObject +/** + * + * @brief 音频编码格式。建议设置。 + * @param codec 音频编码格式,参看 ByteRTCMixedStreamAudioCodecType{@link #ByteRTCMixedStreamAudioCodecType}。默认值为 `0`。建议设置。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamAudioCodecType audioCodec; +/** + * + * @brief 音频采样率,单位 Hz。可取 32000 Hz、44100 Hz、48000 Hz,默认值为 48000 Hz。建议设置。 + */ + +@property(assign, nonatomic) NSInteger sampleRate; +/** + * + * @brief 音频声道数。可取 1(单声道)、2(双声道),默认值为 2。建议设置。 + */ + +@property(assign, nonatomic) NSInteger channels; +/** + * + * @brief 音频码率,单位 Kbps。可取范围 [32, 192],默认值为 64 Kbps。建议设置。 + */ + +@property(assign, nonatomic) NSInteger bitrate; +/** + * + * @brief AAC 编码规格,参看 ByteRTCMixedStreamAudioProfile{@link #ByteRTCMixedStreamAudioProfile}。默认值为 `0`。建议设置。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamAudioProfile audioProfile; +@end + +/** + * + * @type keytype + * @brief 推流 CDN 的空间音频参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamSpatialAudioConfig : NSObject +/** + * + * @brief 是否开启推流 CDN 时的空间音频效果。
    + * 当你启用此效果时,你需要设定推流中各个 ByteRTCMixedStreamLayoutRegionConfig{@link #ByteRTCMixedStreamLayoutRegionConfig} 的 `spatialPosition` 值,实现空间音频效果。 + */ + +@property(assign, nonatomic) BOOL enableSpatialRender; +/** + * + * @brief 听众的空间位置。参看 ByteRTCPosition{@link #ByteRTCPosition}。
    + * 听众指收听来自 CDN 的音频流的用户。
    + * WTN 流任务不支持设置本参数。 + */ + +@property (strong, nonatomic) ByteRTCPosition * _Nullable audienceSpatialPosition; +/** + * + * @brief 听众的空间朝向。参看 ByteRTCHumanOrientation{@link #ByteRTCHumanOrientation}。
    + * 听众指收听来自 CDN 的音频流的用户。 + */ + +@property(strong, nonatomic) ByteRTCHumanOrientation * _Nullable audienceSpatialOrientation; + +@end + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 客户端合流参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCClientMixedStreamConfig : NSObject +/** + * + * @brief 客户端合流是否使用混音,默认为 true。 + */ + +@property(assign, nonatomic) BOOL useAudioMixer; +/** + * + * @brief 客户端合流回调视频格式,参看 ByteRTCMixedStreamClientMixVideoFormat{@link #ByteRTCMixedStreamClientMixVideoFormat}。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamClientMixVideoFormat videoFormat; +@end + +/** + * + * @hidden internal use only + * @valid since 3.52 + * @type keytype + * @brief 转推直播单通同步参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamSyncControlConfig : NSObject +/** + * + * @brief 同步策略 + */ + +@property(assign, nonatomic)ByteRTCMixedStreamSyncStrategy syncStrategy; +/** + * + * @brief 在进行同步处理时,基准流所属用户的 ID。默认为空。 + */ + +@property(copy, nonatomic) NSString * _Nullable baseUserID; +/** + * + * @brief 在进行同步处理时,缓存音视频流的最大长度。单位为毫秒。默认值为 2000。
    + * 参与转推直播的这些媒体流延迟越高,应该将此值设置的越大。但此值越大,因缓存媒体流造成的内存占用也会更大。推荐值为 `2000`。 + */ + +@property(assign, nonatomic) NSInteger maxCacheTimeMs; +/** + * + * @brief 是否通过 RTC SDK 进行转推直播。默认为 True。
    + * 如果选择 `False`,你会通过 onCacheSyncVideo:withDataFrame:withUids:taskId:{@link #ByteRTCClientMixedStreamDelegate#onCacheSyncVideo:withDataFrame:withUids:taskId:} 收到同步的帧,你可以使用此视频帧,自行实现合流转推。 + */ + +@property(assign, nonatomic) BOOL videoNeedSdkMix; +@end + +/** + * + * @type keytype + * @brief 服务端合流控制参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamControlConfig : NSObject +/** + * + * @valid since 3.56 + * @brief 是否开启单独发送声音提示 SEI 的功能:
    + * - True:开启; + * - False:关闭。(默认值) + * 开启后,你可以通过 `ByteRTCMixedStreamControlConfig.seiContentMode` 控制 SEI 的内容是否只携带声音信息。 + */ + +@property(assign, nonatomic) BOOL enableVolumeIndication; +/** + * + * @valid since 3.56 + * @brief 声音提示间隔,单位为秒,取值范围为 [0.3,+∞),默认值为 2。
    + * 此值仅取整百毫秒。若传入两位及以上小数,则四舍五入取第一位小数的值。例如,若传入 0.36,则取 0.4。 + */ + +@property(assign, nonatomic) CGFloat volumeIndicationInterval; +/** + * + * @valid since 3.56 + * @brief 有效音量大小,取值范围为 [0, 255],默认值为 0。
    + * 超出取值范围则自动调整为默认值,即 0。 + */ + +@property(assign, nonatomic) NSInteger talkVolume; +/** + * + * @valid since 3.56 + * @brief 声音信息 SEI 是否包含音量值:
    + * - True:是; + * - False:否,默认值。 + */ + +@property(assign, nonatomic) BOOL isAddVolumeValue; +/** + * + * @valid since 3.56 + * @brief 设置 SEI 内容。参看 ByteRTCMixedStreamSEIContentMode{@link #ByteRTCMixedStreamSEIContentMode}。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamSEIContentMode seiContentMode; +/** + * + * @valid since 3.56 + * @brief SEI 信息的 payload type。
    + * 默认值为 `100`,只支持设置 `5` 和 `100`。
    + * 在转推直播的过程中,该参数不支持变更。 + */ + +@property(assign, nonatomic) NSInteger seiPayloadType; +/** + * + * @valid since 3.56 + * @brief SEI 信息的 payload UUID。 + * @note PayloadType 为 `5` 时,必须填写 PayloadUUID,否则会收到错误回调,错误码为 1091。
    + * PayloadType 不是 `5` 时,不需要填写 PayloadUUID,如果填写会被后端忽略。
    + * 该参数长度需为 32 位,否则会收到错误码为 1091 的回调。
    + * 该参数每个字符的范围需为 [0, 9] [a, f] [A, F]
    + * 该参数不应带有`-`字符,如系统自动生成的 UUID 中带有`-`,则应删去。
    + * 在转推直播的过程中,该参数不支持变更。 + */ + +@property(copy, nonatomic) NSString *seiPayloadUUID; +/** + * + * @valid since 3.57 + * @brief 设置合流推到 CDN 时输出的媒体流类型。参看 ByteRTCMixedStreamMediaType{@link #ByteRTCMixedStreamMediaType}。
    + * 默认输出音视频流。支持输出纯音频流,但暂不支持输出纯视频流。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamMediaType mediaType; +/** + * + * @valid since 3.57 + * @brief 设置是否在没有用户发布流的情况下发起转推直播。具体参看 ByteRTCMixedStreamPushMode{@link #ByteRTCMixedStreamPushMode}。
    + * 该参数在发起合流任务后的转推直播过程中不支持动态变更。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamPushMode pushStreamMode; +@end + +/** + * + * @type keytype + * @brief 合流转推配置参数。
    + * 如无特别说明,参数可适用于 WTN 流和合流转推任务。
    + * 如无特别说明,参数可用于启动和更新任务。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamPushTargetConfig : NSObject +/** + * + * @type api + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * 本参数不支持过程中更新。 + * WTN 流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString * _Nullable pushCDNURL; +/** + * + * @type keytype + * @brief WTN 流 ID。 + * 合流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString * _Nullable pushWTNStreamID; +/** + * + * @type keytype + * @brief 推流任务类型。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamPushTargetType pushTargetType; +@end +/** + * + * @type keytype + * @brief 合流转推配置参数。 + * 如无特别说明,参数可适用于 WTN 流和合流转推任务。 + * 如无特别说明,参数可用于启动和更新任务。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamConfig : NSObject +/** + * + * @brief 合流背景颜色,用十六进制颜色码(HEX)表示。例如,#FFFFFF 表示纯白,#000000 表示纯黑。默认值为 #000000。建议设置。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +@property(copy, nonatomic) NSString *_Nonnull backgroundColor; +/** + * + * @brief 用户布局信息列表。每条流的具体布局参看 ByteRTCMixedStreamLayoutRegionConfig{@link #ByteRTCMixedStreamLayoutRegionConfig}。建议设置。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +@property(copy, nonatomic) NSArray * _Nonnull regions; + + +/** + * + * @brief 视频转码参数。详见 ByteRTCMixedStreamVideoConfig{@link #ByteRTCMixedStreamVideoConfig} 数据类型。建议设置。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamVideoConfig * _Nonnull videoConfig; +/** + * + * @brief 音频合流参数,参看 ByteRTCMixedStreamAudioConfig{@link #ByteRTCMixedStreamAudioConfig}。建议设置。
    + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamAudioConfig * _Nonnull audioConfig; +/** + * + * @hidden for internal use only + * @brief 转推同步配置。详见 ByteRTCMixedStreamSyncControlConfig{@link #ByteRTCMixedStreamSyncControlConfig} 。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamSyncControlConfig * _Nullable syncControlConfig; +/** + * + * @hidden(macOS) + * @brief 转推 CDN 空间音频配置。详见 ByteRTCMixedStreamSpatialAudioConfig{@link #ByteRTCMixedStreamSpatialAudioConfig} 。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamSpatialAudioConfig * _Nonnull spatialAudioConfig; +/** + * + * @brief 服务端合流控制参数。详见 ByteRTCMixedStreamControlConfig{@link #ByteRTCMixedStreamControlConfig} 。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamControlConfig * _Nonnull controlConfig; +/** + * + * @hidden for internal use only + * @brief 动态扩展自定义参数。 + */ + +@property(strong, nonatomic) NSMutableDictionary * _Nullable advancedConfig; +/** + * + * @hidden for internal use only + * @brief 业务透传鉴权信息 + */ + +@property(strong, nonatomic) NSMutableDictionary * _Nullable authInfo; + +/** + * + * @hidden for internal use only + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString * _Nullable pushURL; +/** + * + * @brief 推流房间 ID。`roomID` 和 `userID` 长度相加不得超过 126 字节。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(copy, nonatomic) NSString * _Nonnull roomID; +/** + * + * @brief 推流用户 ID。`roomID` 和 `userID` 长度相加不得超过 126 字节。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(copy, nonatomic) NSString * _Nonnull userID; +/** + * + * @brief 用户配置的额外数据。
    + * WTN 流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString *_Nonnull userConfigExtraInfo; +/** + * + * @valid since 3.57 + * @brief 设置合流后整体画布的背景图片 URL,长度最大为 1023 bytes。
    + * 必须是http开头,支持的图片格式包括:JPG, JPEG, PNG。如果背景图片的宽高和整体屏幕的宽高不一致,背景图片会缩放到铺满屏幕。 + */ + +@property(copy, nonatomic) NSString *_Nonnull backgroundImageURL; +/** + * + * @brief WTN 流布局模式。参看 ByteRTCStreamLayoutMode{@link #ByteRTCStreamLayoutMode}。可选:
    + * - `auto`: 自动布局。默认值 + * - `custom`: 自定义布局。 + */ + +@property(assign, nonatomic)ByteRTCStreamLayoutMode layoutMode; +/** + * + * @brief WTN 流的补帧模式。参看 ByteRTCInterpolationMode{@link #ByteRTCInterpolationMode}。可选: + */ + +@property(assign, nonatomic) ByteRTCInterpolationMode interpolationMode; + +/** + * + * @brief 任务类型。参看 ByteRTCMixedStreamPushTargetType{@link #ByteRTCMixedStreamPushTargetType}。可选: + */ + +@property(assign, nonatomic) ByteRTCMixedStreamPushTargetType pushTargetType; +/** + * + * @brief 获取默认转推直播配置参数。 + * @return 转推直播配置参数,参看 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}。 + */ +/**s + * + * @brief Gets the default configurations for pushing streams to CDN. + * @return Configurations for pushing streams to CDN. See ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}. + */ ++ (instancetype _Nonnull)defaultMixedStreamConfig; +@end + +/** + * + * @type keytype + * @brief 单流转推配置目标房间信息 + */ + +BYTERTC_APPLE_EXPORT @interface DestInfo: NSObject + /** + * + * @brief 目标房间ID + */ + + @property(nonatomic, copy) NSString * _Nonnull roomId; + + /** + * + * @brief 目标房间中的用户ID + */ + + @property(nonatomic, copy) NSString * _Nonnull userId; +@end + +/** + * + * @type keytype + * @brief 单流转推类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSingleStreamPushType) { + /** + * + * @brief 单流转推到CDN + */ + + ByteRTCSingleStreamPushToCDN = 1, + /** + * + * @brief 单流转推到RTC房间 + */ + + ByteRTCSingleStreamPushToRTC = 2 +}; + +/** + * + * @type keytype + * @brief 单流转推直播配置参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCPushSingleStreamParam : NSObject +/** + * + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + */ + +@property(copy, nonatomic) NSString * _Nullable url; +/** + * + * @brief 媒体流所在的房间 ID + */ + +@property(copy, nonatomic) NSString * _Nonnull roomId; +/** + * + * @brief 媒体流所属的用户 ID + */ + +@property(copy, nonatomic) NSString * _Nullable userId; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +/** + * + * @brief 跨房间转发的目标房间信息数组,默认值为 nil。
    + * 当需要将媒体流从当前房间转发到其他房间时,可在此数组中指定多个目标房间信息。 + */ + +@property(nonatomic, strong) NSArray * _Nullable destInfo; +/** + * + * @brief 单流转推类型,指定将媒体流转推到 CDN 还是 RTC 房间,默认值为转推到 CDN。 + */ + +@property(assign, nonatomic) ByteRTCSingleStreamPushType pushType; +@end + +/** + * + * @type keytype + * @brief 视频订阅配置信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubscribeVideoConfig : NSObject +/** + * + * @brief 订阅的视频流分辨率下标。
    + * 当远端用户通过调用 setLocalSimulcastMode:{@link #ByteRTCEngine#setlocalsimulcastmode:} 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
    + * 默认值为 0,即订阅第一路流。
    + * 如果不想更改之前的设置,可以输入 -1。 + */ + +@property(assign, nonatomic) NSInteger videoIndex; +/** + * + * @brief 远端用户优先级,参看 ByteRTCRemoteUserPriority{@link #ByteRTCRemoteUserPriority},默认值为 0。 + */ + +@property(assign, nonatomic) NSInteger priority; +@end + +/** + * + * @type keytype + * @brief 性能回退相关数据 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSourceWantedData : NSObject +/** + * + * @brief 推荐视频输入宽 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 推荐视频输入高 + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 推荐视频输入帧率 + */ + +@property(nonatomic, assign) NSInteger frameRate; +@end + +/** + * + * @type keytype + * @brief 流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteStreamSwitchEvent : NSObject +/** + * + * @brief 订阅的音视频流的发布者的用户 ID。 + */ + +@property(nonatomic, copy) NSString * _Nonnull uid; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +/** + * + * @brief 流切换前订阅视频流的分辨率对应的索引 + */ + +@property(nonatomic, assign) NSInteger beforeVideoIndex; +/** + * + * @brief 流切换后订阅视频流的分辨率对应的索引 + */ + +@property(nonatomic, assign) NSInteger afterVideoIndex; +/** + * + * @brief 流切换前是否有视频流 + */ + +@property(nonatomic, assign) BOOL beforeVideoEnabled; +/** + * + * @brief 流切换后是否有视频流 + */ + +@property(nonatomic, assign) BOOL afterVideoEnabled; +/** + * + * @brief 流切换原因,详见 ByteRTCFallbackOrRecoverReason{@link #ByteRTCFallbackOrRecoverReason}。 + */ + +@property(nonatomic, assign) ByteRTCFallbackOrRecoverReason reason; +@end +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51, use ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} instead. + * @type callback + * @brief 自定义的视频渲染 + * @list + */ + +DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate") +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoSinkProtocol +@required +/** + * + * @type callback + * @brief 初始化渲染器 + * @return + * - YES: 自定义的渲染器初始化完成 + * - NO: 自定义的渲染器初始化失败,不继续往下运行 + * @note 初始化渲染器的时候会回调这个方法 + * @list + */ + +- (BOOL)shouldInitialize DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate");; +/** + * + * @type callback + * @brief 启动渲染器 + * @note 在开启渲染功能的时候会回调这个方法 + * @list + */ + +- (void)shouldStart DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 停止渲染器 + * @note 在停止渲染功能的时候会回调这个方法 + * @list + */ + +- (void)shouldStop DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 释放渲染器 + * @note 渲染器即将被废弃的时候会回调这个方法 + * @list + */ + +- (void)shouldDispose DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 获取 PixelFormat 格式 + * @return Buffer 类型,{@link #ByteRTCVideoSinkPixelFormat} + * @note 通过该方法的返回值,告知 SDK PixelFormat 的格式 + * @list + */ + +- (ByteRTCVideoPixelFormat)pixelFormat DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 输出视频的 PixelBuffer + * @param pixelBuffer 视频的 PixelBuffer + * @param rotation 视频旋转角度,{@link #ByteRTCVideoRotation} + * @param cameraId 视频的相机 Id, {@link #ByteRTCCameraID} + * @param extendedData 视频帧附加的数据,视频解码后获得的附加数据 + * @note 通过该方法获取视频的 PixelBuffer + * @list + */ + +- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer + rotation:(ByteRTCVideoRotation)rotation + cameraId:(ByteRTCCameraID) cameraId + extendedData:(NSData * _Nullable)extendedData DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); + +/** + * + * @hidden constructor/destructor + */ + +- (int)getRenderElapse; +@end + +/** + * + * @type keytype + * @brief 自定义视频渲染器 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoSinkDelegate +@optional +/** + * + * @deprecated since 3.54, use onFrame: instead + * @type api + * @brief 输出视频的 PixelBuffer + * @param pixelBuffer 视频的 PixelBuffer + * @param rotation 视频旋转角度,参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation} + * @param contentType 视频内部类型 参看 ByteRTCVideoContentType{@link #ByteRTCVideoContentType} + * @param extendedData 视频解码后获得的附加数据 + * @list + */ + +- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer + rotation:(ByteRTCVideoRotation)rotation + contentType:(ByteRTCVideoContentType)contentType + extendedData:(NSData * _Nullable)extendedData; +/** + * + * @hidden for internal use only + */ + +- (int)getRenderElapse; + +@required +/** + * + * @type api + * @brief 输出视频的 PixelBuffer + * @param videoFrame 视频帧 + * @list + */ + +- (void)onFrame:(id _Nonnull)videoFrame; + +@end +/** + * + * @hidden for internal use only + * @type callback + * @brief 外部渲染数据的消费接口 + * @list + */ + +@protocol ByteRTCVideoFrameConsumerObserver +/** + * + * @brief 输出 yuv420 数据 + * @param ocFrame 数据 Buffer + * @param width 视频宽度 + * @param rotation 视频旋转角度 + * @param timestamp 时间戳 + */ + +- (void)consumeYUV420Buffer:(CVPixelBufferRef _Nullable)ocFrame + width:(NSInteger)width rotation:(NSInteger)rotation timestamp:(long)timestamp; +/** + * + * @brief 输出 RGBA 数据 + * @param ocFrame 数据 Buffer + * @param width 视频宽度 + * @param rotation 视频旋转角度 + * @param timestamp 时间戳 + */ + +- (void)consumeRGBABuffer:(CVPixelBufferRef _Nullable)ocFrame width:(NSInteger)width + rotation:(NSInteger)rotation timestamp:(long)timestamp; +@end +/** + * + * @type keytype + * @brief 本地视频帧回调配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalVideoSinkConfig : NSObject +/** + * + * @brief 本地视频帧回调位置,参看 ByteRTCLocalVideoSinkPosition{@link #ByteRTCLocalVideoSinkPosition},默认回调前处理后的视频帧。 + */ + +@property(nonatomic, assign) ByteRTCLocalVideoSinkPosition position; +/** + * + * @brief 本地视频帧回调格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat},默认值为 0。 + */ + +@property(nonatomic, assign) ByteRTCVideoSinkPixelFormat requiredPixelFormat; + +@end + +/** + * + * @type keytype + * @brief 远端视频帧回调配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoSinkConfig : NSObject +/** + * + * @brief 远端视频帧回调位置,参看 ByteRTCLocalVideoSinkPosition{@link #ByteRTCLocalVideoSinkPosition},默认回调后处理后的视频帧。 + */ + +@property(nonatomic, assign) ByteRTCRemoteVideoSinkPosition position; +/** + * + * @brief 远端视频帧回调格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat},默认值为 0。 + */ + +@property(nonatomic, assign) ByteRTCVideoSinkPixelFormat requiredPixelFormat; +/** + * + * @brief 是否将视频帧自动转正,参看 ByteRTCVideoApplyRotation{@link #ByteRTCVideoApplyRotation},默认为不旋转。 + */ + +@property(nonatomic, assign) ByteRTCVideoApplyRotation applyRotation; +/** + * + * @brief 是否将视频帧镜像。参看 ByteRTCVideoSinkMirrorType{@link #ByteRTCVideoSinkMirrorType},默认为不镜像。
    + * 本设置与 setRemoteVideoMirrorType:withMirrorType:{@link #ByteRTCEngine#setRemoteVideoMirrorType:withMirrorType:} (适用于内部渲染)相互独立。 + */ + +@property(nonatomic, assign) ByteRTCVideoSinkMirrorType mirrorType; + +@end + +/** + * + * @type keytype + * @brief 视频处理配置参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoPreprocessorConfig : NSObject +/** + * + * @brief 视频帧的像素格式,参看 ByteRTCVideoPixelFormat{@link #ByteRTCVideoPixelFormat}。
    + * 当前仅支持 `ByteRTCVideoPixelFormatI420` 和 `ByteRTCVideoPixelFormatUnknown` 格式。 + */ + +@property(nonatomic, assign) ByteRTCVideoPixelFormat requiredPixelFormat; +/** + * + * @brief 自定义视频前处理的作用范围,参看 ByteRTCProcessorActionDomain{@link #ByteRTCProcessorActionDomain}。 + * @param actionDomain 自定义视频前处理的作用范围。 + */ + +@property(nonatomic, assign) ByteRTCProcessorActionDomain actionDomain; + +@end +/** + * + * @type callback + * @brief 视频处理回调接口类
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频处理 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoProcessorDelegate +/** + * + * @type api + * @brief 获取 RTC SDK 采集得到的视频帧,根据 registerLocalVideoProcessor:withConfig:{@link #ByteRTCEngine#registerLocalVideoProcessor:withConfig:} 设置的视频前处理器,进行视频前处理,最终将处理后的视频帧给到 RTC SDK 用于编码传输。 + * @param srcFrame RTC SDK 采集得到的视频帧,参考: ByteRTCVideoFrame{@link #ByteRTCVideoFrame} + * @return 经过视频前处理后的视频帧,返回给 RTC SDK 供编码和传输,参考: ByteRTCVideoFrame{@link #ByteRTCVideoFrame} + * @note + * - 如果需要取消视频前处理,可以将视频前处理器设置为 nullptr。 + * - 应用层实现 `processVideoFrame` 接口时,可以直接修改 `src_frame` 的缓冲区,调用 `addRef` 方法将 `src_frame` 引用计数加一,然后将修改后的 `src_frame` 返回, 也可以创建一个新的视频帧并返回。 + * - 对于 `processVideoFrame` 返回的视频帧,在 SDK 层消费完成后,SDK 内部总是调用这个视频帧的 releaseRef 方法。 + * @list 自定义流处理 + */ + +- (id _Nullable)processVideoFrame:(id _Nonnull)srcFrame; + +@end +/** + * + * @hidden(iOS) + * @type keytype + * @brief 屏幕采集设置参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCScreenCaptureParam : NSObject +/** + * + * @brief 视频最大宽度,单位:像素。 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 视频最大高度,单位:像素。 + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 屏幕采集帧率,单位:fps + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 发送屏幕采集码率,单位 kbps + */ + +@property(nonatomic, assign) NSInteger bitrate; +/** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `minBitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, bitrate),当 `bitrate` < `minBitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `bitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `bitrate` < `0` 时,适配码率模式。 + */ + +@property(nonatomic, assign) NSInteger minBitrate; +/** + * + * @brief 采集区域 + */ + +@property(nonatomic, assign) CGRect regionRect; +/** + * + * @brief 是否采集鼠标 + */ + +@property(nonatomic, assign) ByteRTCMouseCursorCaptureState mouseCursorCaptureState; +/** + * + * @brief 屏幕过滤设置 + */ + +@property (strong, nonatomic) NSArray * _Nullable excludedWindowList; +/** + * + * @brief 采集区域的边框高亮设置,参看 ByteRTCHighlightConfig{@link #ByteRTCHighlightConfig}。 + */ + +@property (strong, nonatomic) ByteRTCHighlightConfig * _Nonnull highlightConfig; +@end +/** + * + * @type keytype + * @brief 屏幕采集对象的具体信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCScreenCaptureSourceInfo : NSObject +/** + * + * @brief 屏幕分享时,共享对象的类型,参看 ByteRTCScreenCaptureSourceType{@link #ByteRTCScreenCaptureSourceType} + */ + +@property (assign, nonatomic) ByteRTCScreenCaptureSourceType sourceType; +/** + * + * @brief 屏幕分享时,共享对象的 ID。 + */ + +@property (assign, nonatomic) intptr_t sourceId; +/** + * + * @brief 屏幕分享时共享对象的名称。 + */ + +@property (copy, nonatomic) NSString * _Nullable sourceName; +/** + * + * @brief 共享的应用窗体所属应用的名称
    + * 当共享对象为应用窗体时有效 + */ + +@property (copy, nonatomic) NSString * _Nullable application; +/** + * + * @brief 共享的应用窗体所属应用进程的 pid
    + * 当共享对象为应用窗体时有效 + */ + +@property (assign, nonatomic) int pid; +/** + * + * @brief 共享的屏幕是否为主屏。
    + * 当共享对象为屏幕时有效 + */ + +@property (assign, nonatomic) BOOL primaryMonitor; +/** + * + * @brief 屏幕共享对象的坐标。多显示器的场景下,屏幕坐标系统以主屏左上角为原点 (0, 0),向右向下扩展。 + */ + +@property (assign, nonatomic) CGRect regionRect; + +@end + +/** + * + * @type keytype + * @region 视频管理 + * @brief 屏幕采集设置参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCScreenParam : NSObject +/** + * + * @brief 编码帧率,单位为 fps + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 编码码率,小于 0 时 SDK 会根据高宽自适应码率, 单位 kbps + */ + +@property(nonatomic, assign) NSInteger bitrate; +@end + +/** + * + * @type keytype + * @brief 虚拟背景对象。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVirtualBackgroundSource: NSObject +/** + * + * @brief 虚拟背景类型,详见 ByteRTCVirtualBackgroundSourceType{@link #ByteRTCVirtualBackgroundSourceType} 。 + */ + +@property(nonatomic, assign) ByteRTCVirtualBackgroundSourceType sourceType; +/** + * + * @brief 纯色背景使用的颜色。
    + * 格式为 0xAARRGGBB 。 + */ + +@property int sourceColor; +/** + * + * @brief 自定义背景图片的绝对路径。
    + * - 支持的格式为 jpg、jpeg、png。 + * - 图片分辨率超过 1080P 时,图片会被等比缩放至和视频一致。 + * - 图片和视频宽高比一致时,图片会被直接缩放至和视频一致。 + * - 图片和视频长宽比不一致时,为保证图片内容不变形,图片按短边缩放至与视频帧一致,使图片填满视频帧,对多出的高或宽进行剪裁。 + * - 自定义图片带有局部透明效果时,透明部分由黑色代替。 + */ + +@property(nonatomic) NSString* _Nullable sourcePath; +@end +/** + * + * @type callback + * @brief 本地视频帧监测器
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 自定义流处理 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCLocalEncodedVideoFrameObserver + @optional +/** + * + * @type callback + * @brief 调用 registerLocalEncodedVideoFrameObserver:{@link #ByteRTCEngine#registerLocalEncodedVideoFrameObserver:} 后,SDK 每次使用内部采集,采集到一帧视频帧,或收到一帧外部视频帧时,都会回调该事件。 + * @param videoSource 预留参数 + * @param frame 本地视频帧信息,参看 ByteRTCEncodedVideoFrame{@link #ByteRTCEncodedVideoFrame} + * @list 自定义流处理 + */ + +- (void)onLocalEncodedVideoFrame:(ByteRTCVideoSource* _Nullable)videoSource + Frame:(ByteRTCEncodedVideoFrame * _Null_unspecified)frame; +@end + +#pragma mark - ByteRTCEngineExternalVideoEncoderEventHandler +/** + * + * @type callback + * @brief 自定义编码帧回调类 + * @note 回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Custom Stream Processing + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCExternalVideoEncoderEventHandler +@required +/** + * + * @type callback + * @brief 提示自定义编码帧可以开始推送的回调。
    + * 收到该回调后,你即可调用 pushExternalEncodedVideoFrame:withEncodedVideoFrame:{@link #ByteRTCEngine#pushExternalEncodedVideoFrame:withEncodedVideoFrame:} 向 SDK 推送自定义编码视频帧 + * @param streamId 自定义编码流 ID + * @param info 自定义编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @list 自定义流处理 + */ + +- (void)onStart:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info; +@required +/** + * + * @type callback + * @brief 当收到该回调时,你需停止向 SDK 推送自定义编码视频帧 + * @param streamId 自定义编码流 ID + * @param info 自定义编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @list 自定义流处理 + */ + +- (void)onStop:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info; +@required +/** + * + * @type callback + * @brief 当自定义编码流的帧率或码率发生变化时,触发该回调 + * @param streamId 远端编码流 ID + * @param info 远端编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoIndex 对应编码流的下标 + * @param fps 变化后的帧率,单位:fps + * @param bitRateKps 变化后的码率,单位:kbps + * @list 自定义流处理 + */ + +- (void)onRateUpdate:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withVideoIndex:(NSInteger)videoIndex + withFps:(NSInteger)fps + withBitRate:(NSInteger)bitRateKps; +@required +/** + * + * @type callback + * @brief 提示流发布端需重新生成关键帧的回调 + * @param streamId 远端编码流 ID + * @param info 远端编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoIndex 对应编码流的下标 + * @list 自定义流处理 + */ + +- (void)onRequestKeyFrame:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withVideoIndex:(NSInteger)videoIndex; +@required +/** + * + * @valid since 3.56 + * @type callback + * @brief 作为自定义编码视频流的发送端,你会在视频流可发送状态发生变化时,收到此回调。
    + * 你可以根据此回调的提示,仅对可发送的视频流进行编码,以降低本端视频编码性能消耗。此回调会根据多个因素综合判断触发,包括:本端设备性能和本端网络性能,以及按需订阅场景下,远端用户是否订阅。 + * @param streamId 自定义编码流 ID + * @param info 自定义编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoIndex 对应编码流的下标 + * @param active 该路流可发送状态 + * @note 要收到此回调,必须调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 设置视频源是自定义编码,且通过 setExternalVideoEncoderEventHandler:{@link #ByteRTCEngine#setExternalVideoEncoderEventHandler:} 设置了回调句柄。 + * @list 自定义流处理 + */ + +- (void)onActiveVideoLayer:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withVideoIndex:(NSInteger)videoIndex + withActive:(BOOL)active; +@end + +#pragma mark - ByteRTCEngineRemoteEncodedVideoFrameObserver +/** + * + * @type callback + * @brief 远端编码后视频数据监测器 + * @note 回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频管理 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCRemoteEncodedVideoFrameObserver +@required +/** + * + * @type callback + * @brief 调用 registerRemoteEncodedVideoFrameObserver:{@link #ByteRTCEngine#registerRemoteEncodedVideoFrameObserver:} 后,SDK 监测到远端编码后视频数据时,触发该回调 + * @param streamId 收到的远端流 ID + * @param info 收到的远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoFrame 收到的远端视频帧信息,参看 ByteRTCEncodedVideoFrame{@link #ByteRTCEncodedVideoFrame} + * @list 自定义流处理 + */ + +- (void)onRemoteEncodedVideoFrame:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame; +@end + +/** + * + * @type keytype + * @brief 视频帧基础信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoFrameInfo : NSObject +/** + * + * @brief 视频帧的宽度(像素) + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 视频帧的高度(像素) + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 视频帧顺时针旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。 + */ + +@property(nonatomic, assign) ByteRTCVideoRotation rotation; +@end + +#pragma mark - ByteRTCPushMixedStreamToCDNObserver +/** + * + * @hidden for internal use only + * @type callback + * @brief 转推直播观察者。(Valid from 352.1)
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list CDN 推流 + */ + +@protocol ByteRTCClientMixedStreamDelegate +/** + * + * @hidden for internal use only + */ + +@optional +- (void)onClientMixedStreamEvent:(ByteRTCMixedStreamTaskEvent)event withTaskInfo:(ByteRTCMixedStreamTaskInfo*)info withMixedType:(ByteRTCMixedStreamType)type withErrorCode:(ByteRTCMixedStreamTaskErrorCode)errorCode; +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流音频首帧回调 + * @param taskID 任务 ID + * @list CDN 推流 + */ + +- (void)onMixedFirstAudioFrame:(NSString *)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流视频首帧回调 + * @param taskID 任务 ID + * @list CDN 推流 + */ + + - (void)onMixedFirstVideoFrame:(NSString *)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 端云一体合流音频 PCM 回调 + * @param audioFrame PCM 编码的合流音频数据帧,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @param timeStamp 时间戳,单位毫秒。 + * @param taskId 转推直播任务 ID。 + * @note 收到该回调的周期为每 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + * @list CDN 推流 + */ + +- (void)onMixedAudioFrame:(ByteRTCAudioFrame *_Nonnull)audioFrame withTimestamp:(int64_t)timeStamp withTaskId:(NSString *_Nonnull)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 端云一体合流视频 YUV 回调 + * @param videoFrame YUV 合流视频数据帧,参看 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @param taskId 转推直播任务 ID。 + * @note 收到该回调的周期取决于视频的帧率。 + * @list CDN 推流 + */ + +- (void)onMixedVideoFrame:(id_Nonnull)videoFrame withTaskId:(NSString *_Nonnull)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 端云一体合流视频 SEI 数据 + * @param dataFrame SEI 数据,详见 ByteRTCFrameExtendedData {@link #ByteRTCFrameExtendedData}。 + * @param taskId 转推直播任务 ID。 + * @list CDN 推流 + */ + +- (void)onMixedDataFrame:(ByteRTCFrameExtendedData *_Nonnull)dataFrame withTaskId:(NSString *_Nonnull)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 同步视频帧回调。 + * @param videoFrame 同步视频帧数组,与 uids 对应。 + * @param dataFrame SEI 数据。 + * @param uids 同步视频帧对应的 uid 数组。 + * @param task_id 转推直播任务 ID。 + * @list CDN 推流 + */ + +- (void)onCacheSyncVideo:(NSArray> *_Nonnull)videoFrames withDataFrame:(NSArray *_Nonnull)dataFrames + withUids:(NSArray*_Nonnull)uids taskId:(NSString *_Nonnull)taskId; +@end +/** + * + * @type callback + * @brief 人脸检测结果回调观察者
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频处理 + */ + +@protocol ByteRTCFaceDetectionObserver +/** + * + * @type callback + * @brief 特效 SDK 进行人脸检测结果的回调。
    + * 调用 enableFaceDetection:withInterval:withModelPath:{@link #ByteRTCVideoEffect#enableFaceDetection:withInterval:withModelPath:} 注册了 ByteRTCFaceDetectionObserver{@link #ByteRTCFaceDetectionObserver} ,并使用 RTC SDK 中包含的特效 SDK 进行视频特效处理时,你会收到此回调。 + * @param result 人脸检测结果, 参看 ByteRTCFaceDetectionResult{@link #ByteRTCFaceDetectionResult}。 + * @list 视频管理 + */ + +- (void)onFaceDetectResult:(ByteRTCFaceDetectionResult * _Nonnull)result; +/** + * + * @hidden for intrnal use only + * @type callback + * @brief 特效 SDK 进行人像属性检测结果的回调。
    + * 调用 registerFaceDetectionObserver:withInterval: 注册了 ByteRTCFaceDetectionObserver{@link #ByteRTCFaceDetectionObserver},并调用 setVideoEffectExpressionDetect:{@link #ByteRTCVideoEffect#setVideoEffectExpressionDetect:} 开启人像属性检测后,你会收到此回调。 + * @param result 人像属性检测结果, 参看 ByteRTCExpressionDetectResult{@link #ByteRTCExpressionDetectResult}。 + * @list 视频处理 + */ + +- (void)onExpressionDetectResult:(ByteRTCExpressionDetectResult * _Nonnull)result; +@end + +#pragma mark - ByteRTCEngineMediaMetadataObserver +/** + * + * @hidden + * @deprecated since 3.26 and will be deleted in 3.51, use sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} instead. + * @type callback + * @brief 使用内部源视频采集时,配置和获取附加数据接口 + * @list Video Processing + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCMediaMetadataObserver +@required +/** + * + * @type callback + * @brief 当 SDK 准备发送一个视频帧时,会回调该接口,以确定是否需要在该视频帧中添加 metadata + * @param timestamp 待添加 metadata 视频帧的时间戳,单位微秒 + * @return 待发送的数据,大小不能超过 1024bytes + * @note + * - 返回 null 代表不需要添加 metadata + * - 回调中不能做长时间逻辑处理,以免影响视频卡顿 + * @list 自定义流处理 + */ + +- (NSData *_Nullable)videoFrameMediaMetaDataAtTime:(NSTimeInterval)timestamp; + +@optional +/** + * + * @type callback + * @brief 当 SDK 收到的视频帧包含 medatada 时,会回调该接口 + * @param uid 当前帧所属的用户 ID + * @param extendedData metadata + * @param timestamp 包含 metadata 视频帧的时间戳,单位为微秒 + * @note 回调中不能做长时间逻辑处理,以免影响视频卡顿 + * @list 自定义流处理 + */ + +- (void)receiveVideoFrameFromUID:(NSString * _Nonnull)uid + withExtendedData:(NSData* _Nullable)extendedData atTimestamp:(NSTimeInterval)timestamp; +@end +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension120x120; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension160x120; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension180x180; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension240x180; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension320x180; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension240x240; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension320x240; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension424x240; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension360x360; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension480x360; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension640x360; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension480x480; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension640x480; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension840x480; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension960x540; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension960x720; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension1280x720; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension1920x1080; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension2540x1440; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension3840x2160; +/** + * + * @type keytype + * @brief 视频编码配置。参考 [设置视频发布参数](https: + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoEncoderConfig: NSObject +/** + * + * @brief 视频宽度,单位:px + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 视频高度,单位:px + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 视频帧率,单位:fps + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 最大编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
    + * 设为 -1 即适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率。
    + * 设为 0 则不对视频流进行编码发送。
    + * 344 及以上版本,内部采集时默认值为 -1,344 以前版本无默认值,需手动设置。 + */ + +@property(nonatomic, assign) NSInteger maxBitrate; +/** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `minBitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, maxBitrate),当 `maxBitrate` < `minBitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `maxBitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `maxBitrate` < `0` 时,适配码率模式。 + */ + +@property(nonatomic, assign) NSInteger minBitrate; +/** + * + * @brief 关键帧间隔,单位:毫秒,默认值为 `0` + */ + +@property(nonatomic, assign) NSInteger keyFrameIntervalMS; +/** + * + * @brief 编码策略偏好,默认为帧率优先。参看 ByteRTCVideoEncoderPreference{@link #ByteRTCVideoEncoderPreference}。 + */ + +@property(nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference; +@end + +/** + * + * @type keytype + * @brief 远端视频帧信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoConfig : NSObject +/** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0 即满帧订阅,设为大于 0 的值时开始生效。
    + * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
    + * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + +@property (nonatomic, assign) int framerate; +/** + * + * @brief 视频宽度,单位:px + */ + +@property(nonatomic, assign) int width; +/** + * + * @brief 视频高度,单位:px + */ + +@property(nonatomic, assign) int height; +@end +/** + * + * @type keytype + * @brief 房间参数配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomConfig : NSObject +/** + * + * @brief 房间模式,参看 ByteRTCRoomProfile{@link #ByteRTCRoomProfile},默认为普通音视频通话模式,进房后不可更改。 + */ + +@property(nonatomic) ByteRTCRoomProfile profile; + +/** + * + * @brief 直播模式,参看 ByteRTCRoomLiveMode{@link #ByteRTCRoomLiveMode},默认为 `ByteRTCRoomLiveModeCoHost`,进房后可通过 setLiveMode:{@link #ByteRTCRoom#setLiveMode:} 设置。 + * @note 只有当`room_profile_type`为`ByteRTCRoomProfileTypeLive`时,`live_mode`的值才有效。 + */ + +@property(nonatomic) ByteRTCRoomLiveMode liveMode; + +/** + * + * @brief 流 ID,默认为空。 + */ + +@property(nonatomic) NSString * streamId; + /** + * + * @brief 是否自动发布音频流,默认为自动发布。 + * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + +@property(assign, nonatomic) BOOL isPublishAudio; + /** + * + * @brief 是否自动发布视频流,默认为自动发布。
    + * + 若调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + +@property(assign, nonatomic) BOOL isPublishVideo; +/** + * + * @brief 是否自动订阅音频流,默认为自动订阅。 + */ + +@property(assign, nonatomic) BOOL isAutoSubscribeAudio; +/** + * + * @brief 是否自动订阅主视频流,默认为自动订阅。 + */ + +@property(assign, nonatomic) BOOL isAutoSubscribeVideo; +@end + +/** + * + * @type keytype + * @brief 水印图片相对视频流的位置和大小。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoByteWatermark: NSObject +/** + * + * @brief 水印图片相对视频流左上角的横向偏移与视频流宽度的比值,取值范围为 [0,1)。 + */ + +@property(assign, nonatomic) float x; +/** + * + * @brief 水印图片相对视频流左上角的纵向偏移与视频流高度的比值,取值范围为 [0,1)。 + */ + +@property(assign, nonatomic) float y; +/** + * + * @brief 水印图片宽度与视频流宽度的比值,取值范围 [0,1)。 + */ + +@property(assign, nonatomic) float width; +/** + * + * @brief 水印图片高度与视频流高度的比值,取值范围为 [0,1)。 + */ + +@property(assign, nonatomic) float height; +@end + +/** + * + * @type keytype + * @brief 水印参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoWatermarkConfig: NSObject +/** + * + * @brief 水印是否在视频预览中可见,默认可见。 + */ + +@property(nonatomic, assign) BOOL visibleInPreview; +/** + * + * @brief 横屏时的水印位置和大小,参看 ByteRTCVideoByteWatermark{@link #ByteRTCVideoByteWatermark}。 + */ + +@property(strong, nonatomic) ByteRTCVideoByteWatermark * _Nonnull positionInLandscapeMode; +/** + * + * @brief 竖屏时的水印位置和大小,参看 ByteRTCVideoByteWatermark{@link #ByteRTCVideoByteWatermark}。 + */ + +@property(strong, nonatomic) ByteRTCVideoByteWatermark * _Nonnull positionInPortraitMode; +@end +/** + * + * @hidden(iOS) + * @type api + * @brief 主要用于枚举、设置视频采集设备 + * @list 视频管理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoDeviceManager : NSObject +/** + * + * @type api + * @brief 获取视频采集设备列表。 + * @return 包含系统中所有视频采集设备的列表,参看 ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 监听到 `ByteRTCMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 视频管理 + */ + +- (ByteRTCDeviceCollection * _Nonnull)enumerateVideoCaptureDevices; +/** + * + * @type api + * @brief 获取当前 SDK 正在使用的视频采集设备信息 + * @param deviceID 视频设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + +- (int)getVideoCaptureDevice:(NSString * _Nonnull * _Nonnull) deviceID; +/** + * + * @type api + * @brief 设置当前视频采集设备 + * @param deviceID 视频设备 ID。调用 enumerateVideoCaptureDevices{@link #ByteRTCVideoDeviceManager#enumerateVideoCaptureDevices} 获取全量视频设备。 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + +- (int)setVideoCaptureDevice:(NSString* _Nonnull)deviceID; +@end +/** + * + * @type callback + * @brief 截取视频画面回调类
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Video Management + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoSnapshotCallbackDelegate +@required +/** + * + * @type callback + * @brief 调用 takeLocalSnapshot:{@link #ByteRTCEngine#takeLocalSnapshot:} 截取视频画面时,收到此回调。 + * @param taskId 本地截图任务的编号。和 takeLocalSnapshot:{@link #ByteRTCEngine#takeLocalSnapshot:} 的返回值一致。 + * @param videoSource 预留参数 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param errorCode 截图错误码:
    + * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + +- (void)onTakeLocalSnapshotResult:(NSInteger) taskId + videoSource:(ByteRTCVideoSource * _Nullable)videoSource + image:(ByteRTCImage * _Nullable)image + errorCode:(NSInteger)errorCode; +/** + * + * @type callback + * @brief 调用 takeRemoteSnapshot:callback:{@link #ByteRTCEngine#takeRemoteSnapshot:callback:} 截取视频画面时,收到此回调。 + * @param taskId 远端截图任务的编号。和 takeRemoteSnapshot:callback:{@link #ByteRTCEngine#takeRemoteSnapshot:callback:} 的返回值一致。 + * @param streamId 远端视频流的 ID。 + * @param info 远端视频流的属性,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param errorCode 截图错误码:
    + * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + +- (void)onTakeRemoteSnapshotResult:(NSInteger)taskId + streamId:(NSString*)streamId + info:(ByteRTCStreamInfo * _Nonnull)info + image:(ByteRTCImage * _Nullable)image + errorCode:(NSInteger)errorCode; +@end +/** + * + * @type api + * @brief 高级视频特效,参看[集成指南](https: + * @list 视频处理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoEffect : NSObject +/** + * + * @hidden for internal use only + * @type api + * @brief 设置视频特效算法模型地址,并初始化特效模块。 + * @param finder ResourceFinder 地址 + * @param deleter ResourceDeleter 地址 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + +- (int) setAlgoModelResourceFinder:(void*_Nonnull)finder deleter:(void*_Nonnull)deteter; + +/** + * + * @type api + * @brief 从特效 SDK 获取授权消息,用于获取在线许可证。 + * @param ppmsg 授权消息字符串地址 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 使用视频特效的功能前,你必须获取特效 SDK 的在线许可证。 + * - 通过此接口获取授权消息后,参考 [在线授权说明](https: + * @list 视频处理 + */ + +- (int)getAuthMessage:(NSString *_Nullable*_Nullable)ppmsg; +/** + * + * @type api + * @brief 检查视频特效证书,设置算法模型路径,并初始化特效模块。 + * @param licenseFile 证书文件的绝对路径,用于鉴权。 + * @param algoModelDir 算法模型绝对路径,即存放特效 SDK 所有算法模型的目录。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 鉴权时,会检查 CV 服务端时间和本地设备的时间差异。你必须保证本地系统时间和实际时间一致。 + * @list 视频处理 + */ + +- (int) initCVResource:(NSString* _Nonnull)licenseFile + withAlgoModelDir: (NSString* _Nonnull)algoModelDir; +/** + * + * @type api + * @brief 开启高级美颜、滤镜等视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource:withAlgoModelDir:{@link #ByteRTCVideoEffect#initCVResource:withAlgoModelDir:} 进行初始化。 + * - 调用该方法后,特效不直接生效,你还需调用 setEffectNodes:{@link #ByteRTCVideoEffect#setEffectNodes:} 设置视频特效素材包或调用 setColorFilter:{@link #ByteRTCVideoEffect#setColorFilter:} 设置滤镜。 + * - 调用 disableVideoEffect{@link #ByteRTCVideoEffect#disableVideoEffect} 关闭视频特效。 + * @list 视频处理 + */ + +- (int) enableVideoEffect; +/** + * + * @type api + * @brief 关闭视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect} 开启视频特效。 + * @list 视频处理 + */ + +- (int) disableVideoEffect; +/** + * + * @hidden for internal use only + * @type api + * @brief 返回视频特效句柄。私有接口。 + * @list 视频处理 + */ + +- (void* _Nullable)getVideoEffectHandle; +/** + * + * @hidden for internal use only + * @type api + * @brief 私有接口
    + * 设置视频特效素材包 + * @param stickerPath 特效素材包绝对路径。
    + * 要取消当前视频特效,将此参数设置为 null。 + * @return + * - 0: 调用成功。 + * - 1000: 未集成特效 SDK。 + * - 1001: 特效 SDK 不支持该功能。 + * - < 0: 调用失败。具体错误码,参看 [错误码表](https: + * @note 在调用这个方法之前,你须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) applyStickerEffect:(NSString* _Nullable)stickerPath; +/** + * + * @hidden for internal use only + * @type api + * @brief 设置视频特效素材包。 + * @param effectPath 特效素材包绝对路径。 + * @return + * - 0: 调用成功。 + * - 1000: 未集成特效 SDK。 + * - 1001: 特效 SDK 不支持该功能。 + * - < 0: 调用失败。 + * @note 在调用这个方法之前,你须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) setEffect:(NSString* _Nullable)effectPath; +/** + * + * @hidden for internal use only + * @type api + * @brief 重置贴纸特效。 + * @return + * - 0: 调用成功。 + * - 1000: 未集成特效 SDK。 + * - 1001: 特效 SDK 不支持该功能。 + * - < 0: 调用失败。 + * @note 在调用这个方法之前,你须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) resetSticker; +/** + * + * @type api + * @brief 设置视频特效素材包。 + * @param effectNodes 特效素材包绝对路径数组。
    + * 要取消当前视频特效,将此参数设置为 null。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) setEffectNodes:(NSArray*_Nonnull)effectNodes; +/** + * + * @hidden for internal use only + * @type api + * @brief 叠加视频特效素材包。 + * @param effectNodes 特效素材包路径数组。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 该接口会在 setEffectNodes:{@link #ByteRTCVideoEffect#setEffectNodes:} 设置的特效基础上叠加特效。 + * @list Video Processing + */ + +- (int) appendEffectNodes:(NSArray*_Nonnull)effectNodes; +/** + * + * @hidden for internal use only + * @type api + * @brief 移除指定的视频特效资源。 + * @param effectNodes 特效素材包路径数组。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 移除 setEffectNodes:{@link #ByteRTCVideoEffect#setEffectNodes:} 或 appendEffectNodes:{@link #ByteRTCVideoEffect#appendEffectNodes:} 设置的视频特效资源。 + * @list Video Processing + */ + +- (int) removeEffectNodes:(NSArray*_Nonnull)effectNodes; +/** + * + * @type api + * @brief 设置特效强度。 + * @param node 特效素材包绝对路径,参考[素材包结构说明](https: + * @param key 需要设置的素材 key 名称,参考[素材 key 对应说明](https: + * @param value 特效强度值,取值范围 [0,1],超出范围时设置无效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) updateEffectNode:(NSString* _Nonnull)node + key:(NSString* _Nonnull)key value:(float) value; +/** + * + * @type api + * @brief 设置颜色滤镜。 + * @param filterRes 滤镜资源包绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 setColorFilterIntensity:{@link #ByteRTCVideoEffect#setColorFilterIntensity:} 设置已启用颜色滤镜的强度。设置强度为 0 时即关闭颜色滤镜。 + * @list 视频处理 + */ + +- (int) setColorFilter:(NSString* _Nonnull)filterRes; +/** + * + * @type api + * @brief 设置已启用颜色滤镜的强度。 + * @param intensity 滤镜强度。取值范围 [0,1],超出范围时设置无效。
    + * 当设置滤镜强度为 0 时即关闭颜色滤镜。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) setColorFilterIntensity:(float) intensity; +/** + * + * @type api + * @brief 将摄像头采集画面中的人像背景替换为指定图片或纯色背景。 + * @param backgroundStickerPath 背景贴纸特效素材绝对路径。 + * @param source 背景贴纸对象,参看 ByteRTCVirtualBackgroundSource{@link #ByteRTCVirtualBackgroundSource}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource:withAlgoModelDir:{@link #ByteRTCVideoEffect#initCVResource:withAlgoModelDir:} 进行初始化。 + * - 调用 disableVirtualBackground{@link #ByteRTCVideoEffect#disableVirtualBackground} 关闭虚拟背景。 + * @list 视频处理 + */ + +- (int) enableVirtualBackground:(NSString* _Nonnull)backgroundStickerPath + withSource:(ByteRTCVirtualBackgroundSource* _Nonnull)source; +/** + * + * @type api + * @brief 关闭虚拟背景。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVirtualBackground:withSource:{@link #ByteRTCVideoEffect#enableVirtualBackground:withSource:} 开启虚拟背景后,可以调用此接口关闭虚拟背景。 + * @list 视频处理 + */ + +- (int) disableVirtualBackground; +/** + * + * @hidden for internal use only + * @type api + * @brief 开启人像属性检测。 + * @param config 人像属性检测参数,参看 ByteRTCExpressionDetectConfig{@link #ByteRTCExpressionDetectConfig}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + +- (int) setVideoEffectExpressionDetect:(ByteRTCExpressionDetectConfig* _Nonnull)config; +/** + * + * @type api + * @brief 开启人脸识别功能,并设置人脸检测结果回调观察者。
    + * 回调此观察者后,你会周期性收到 onFaceDetectResult:{@link #ByteRTCFaceDetectionObserver#onFaceDetectResult:} 回调。 + * @param observer 人脸检测结果回调观察者,参看 ByteRTCFaceDetectionObserver{@link #ByteRTCFaceDetectionObserver}。 + * @param interval 两次回调之间的最小时间间隔,必须大于 0,单位为毫秒。实际收到回调的时间间隔大于 interval,小于 interval+视频采集帧间隔。 + * @param path 人脸检测算法模型文件路径,一般为 ttfacemodel 文件夹中 tt_face_vXXX.model 文件的绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - -1004: 初始化中,初始化完成后启动此功能。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) enableFaceDetection:(_Nullable id) observer + withInterval:(NSUInteger)interval + withModelPath:(NSString* _Nonnull)path; +/** + * + * @type api + * @brief 关闭人脸识别功能。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) disableFaceDetection; +@end + + +/** + * + * @type keytype + * @brief RTC 智能决策后得到的帧率和分辨率积(宽*高)。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCFrameUpdateInfo : NSObject +/** + * + * @brief 分辨率积(宽*高)。 + */ + +@property(assign, nonatomic) int pixel; +/** + * + * @brief 帧率。 + */ + +@property(assign, nonatomic) int framerate; +@end +/** + * + * @hidden(macOS) + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaTypeEnhancementConfig: NSObject +/** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceSignaling; +/** + * + * @brief 对屏幕共享以外的其他音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceAudio; +/** + * + * @brief 对屏幕共享视频以外的其他视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceVideo; +/** + * + * @brief 对屏幕共享音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceScreenAudio; +/** + * + * @brief 对屏幕共享视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceScreenVideo; +@end + +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步模式。 +*/ + +typedef NS_ENUM(NSUInteger, ByteRTCChorusCacheSyncMode) { + /** + * + * @brief 合唱场景下,主唱应采用此模式,以发送带时间戳信息的媒体数据。 + */ + + ByteRTCChorusCacheSyncModeProducer= 0, + /** + * + * @brief 合唱场景下,副唱应采用此模式。
    + * 此模式下,副唱收到来自主唱的带时间戳的媒体数据。副唱发送的媒体数据中带有来自主唱的时间戳。 + */ + + ByteRTCChorusCacheSyncModeRetransmitter= 1, + /** + * + * @brief 合唱场景下,听众应采用此模式。
    + * 此模式下,听众收到来自主唱的时间戳,并据此对齐来自主唱和副唱的媒体数据,以获得良好的合唱播放效果。 + */ + + ByteRTCChorusCacheSyncModeConsumer = 2 +}; + +/** + * + * @type keytype + * @hidden for internal use + * @brief 合唱缓存同步事件。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCChorusCacheSyncEvent) { + /** + * + * @brief 成功。 + */ + + ByteRTCChorusCacheSyncEventStartSuccess = 0, + /** + * + * @brief 失败。 + */ + + ByteRTCChorusCacheSyncEventStartFailed = 1, +}; + +/** + * + * @hidden for internal use only + * @type errorcode + * @brief 缓存同步错误码。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCChorusCacheSyncError) { + /** + * + * @brief 成功。 + */ + + ByteRTCChorusCacheSyncErrorOK = 0, + /** + * + * @brief 失败。推送至 CDN 时,应进行以下设置:
    + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.enable_sync = true`; + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.base_user_id = {uid of producer}`。 + */ + + ByteRTCChorusCacheSyncErrorWrongState = 1, + /** + * + * @brief 缓存同步功能已启动,不需要重复开启。 + */ + + ByteRTCChorusCacheSyncErrorAlreadyRunning = 2 +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 缓存同步配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCChorusCacheSyncConfig: NSObject +/** + * + * @brief 最大媒体缓存时长(ms)。
    + * 取值范围是 `[500, 2500]`,默认值是 `2000`。
    + * 值越大,同步效果越好,但会造成占用内存较大。如果参与缓存同步的各路媒体流之间的时间差超过此值,会造成丢帧。 + */ + +@property(assign, nonatomic) int maxCacheTimeMs; +/** + * + * @brief 模式。参看 ByteRTCChorusCacheSyncMode{@link #ByteRTCChorusCacheSyncMode}. 默认值是 `retransmitter`。 + */ + +@property (assign, nonatomic) ByteRTCChorusCacheSyncMode mode; +/** + * + * @brief 收到 onSyncedVideoFrames:withUids:{@link #ByteRTCChorusCacheSyncObserver#onSyncedVideoFrames:withUids:} 的频率。
    + * 默认值是 `15`。此值通常应小于等于原始视频帧率;如果大于原始视频帧率,可能会收到重复帧。 + */ + +@property(assign, nonatomic) int videoFps; +@end +/** + * + * @hidden for internal use only + * @type callback + * @brief 缓存同步 Observer + * @list Video Processing + */ + +@protocol ByteRTCChorusCacheSyncObserver +/** + * + * @type callback + * @brief 调用 startChorusCacheSync:observer:{@link #ByteRTCEngine#startChorusCacheSync:observer:},并设置为 `consumer` 的用户会通过此回调获取经缓存同步后的视频帧。获取频率通过启动同步时的 `fps` 进行设置。 + * @param videoFrames 对应 `uids` 的视频帧。参看 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @param uids 参与合唱缓存同步的 `producer` 和 `retransmitter` 的列表,不包括参与但未发送媒体数据的用户。 + * @list Video Processing + */ + +- (void)onSyncedVideoFrames:(NSArray>*)videoFrames withUids:(NSArray*)uids; +/** + * + * @type callback + * @brief 参与合唱缓存同步的 `producer` 和 `retransmitter` 发生变化时,收到此回调。 + * @param uids 当前的参与者列表 + * @note 有以下情况可能造成参与者发生变化:
    + * - 用户主动调用 startChorusCacheSync:observer:{@link #ByteRTCEngine#startChorusCacheSync:observer:} 或 stopChorusCacheSync{@link #ByteRTCEngine#stopChorusCacheSync}; + * - 原本参与缓存同步的用户发生异常退出。 + * @list Video Processing + */ + +- (void)onSyncedUsersChanged:(NSArray*)uids; +/** + * + * @type callback + * @brief 缓存同步事件回调 + * @param event 事件,参看 ByteRTCChorusCacheSyncEvent{@link #ByteRTCChorusCacheSyncEvent}。 + * @param error 错误码,参看 ByteRTCChorusCacheSyncError{@link #ByteRTCChorusCacheSyncError}。 + * @list Video Processing + */ + +- (void)onSyncEvent:(ByteRTCChorusCacheSyncEvent)event withError:(ByteRTCChorusCacheSyncError)error; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefinesEx.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefinesEx.h new file mode 100644 index 0000000..6e81f64 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefinesEx.h @@ -0,0 +1,167 @@ +#import "ByteRTCDefines.h" +/** + * + * @type keytype + * @brief 视频内容类型 + */ +typedef NS_ENUM(NSUInteger, ByteRTCVideoContentCategory) { + /** + * + * @brief 相机采集的内容 + */ + ByteRTCVideoContentCategoryCamera = 0, + /** + * + * @brief 屏幕共享的内容 + */ + ByteRTCVideoContentCategoryScreen = 1, +}; + +/** + * + * @type keytype + * @brief 视频源设置 + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoSourceConfig : NSObject +/** + * + * @brief 视频源类型。参看 ByteRTCVideoSourceType{@link #ByteRTCVideoSourceType}。默认是 `kVideoSourceTypeExternal`。 + */ +@property (assign, nonatomic) ByteRTCVideoSourceType sourceType; +/** + * + * @brief 参看 ByteRTCVideoContentCategory{@link #ByteRTCVideoContentCategory}。默认是 `kVideoContentCategoryCamera`。 + */ +@property (assign, nonatomic) ByteRTCVideoContentCategory contentCategory; +@end + + +/** + * + * @type keytype + * @brief 媒体流的优先级 + */ +typedef NS_ENUM(NSUInteger, ByteRTCStreamPriority) { + /** + * + * @brief 低优先级 + */ + ByteRTCStreamPriorityLow = 0, + /** + * + * @brief 中优先级 + */ + ByteRTCStreamPriorityNormal = 1, + /** + * + * @brief 高优先级 + */ + ByteRTCStreamPriorityHigh = 2, +}; + +/** + * + * @type keytype + * @brief 音频源包含的内容 + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioContentTypeConfig : NSObject +/** + * + * @brief 包含麦克风采集的音频 + */ +@property(assign, nonatomic) BOOL hasMic; +/** + * + * @brief 包含屏幕音频 + */ +@property(assign, nonatomic) BOOL hasScreenAudio; +/** + * + * @brief 包含媒体播放器的音频 + */ +@property(assign, nonatomic) BOOL hasMediaPlayer; +@end + +/** + * + * @type keytype + * @brief 音频编码设置。 + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEncodeConfig : NSObject +/** + * + * @brief 编码器类型。
    + * + 0:OPUS
    + * + 1:NICO
    + * + -1:配置下发的配置 + */ +@property(nonatomic, assign) NSInteger codecType; +/** + * + * @brief 编码模式
    + * + 0:语音
    + * + 1:音乐
    + * + -1:根据 `channel_num` 不同,使用对应的编码模式。声道数为 `1` 时,编码模式是语音;声道数为 `2` 时,编码模式是音乐。 + */ +@property(nonatomic, assign) NSInteger encMode; +/** + * + * @brief 声道数。取值范围是:`{1, 2}`。默认值是 `-1`,配置下发的配置。 + */ +@property(nonatomic, assign) NSInteger channelNum; +/** + * + * @brief 码率。取值范围:`[6K, 510K]`。 + */ +@property(nonatomic, assign) NSInteger encBitrate; +/** + * + * @brief 是否启用非连续传输功能(DTX)。非连续传输功能能够在安静的场景下降低码率。
    + * + 0:关闭
    + * + 1:打开
    + * + -1:配置下发的配置 + */ +@property(nonatomic, assign) NSInteger useDtx; +/** + * + * @brief 带内前向纠错功能。能够提供一定的抗丢包能力。
    + * + 0:关闭
    + * + 1:打开
    + * + -1:配置下发的配置 + */ +@property(nonatomic, assign) NSInteger useInbandfec; +/** + * + * @brief 采样率。取值范围是 `[16K, 48K]`。
    + * 修改此参数会触发编码器重启。 + */ +@property(nonatomic, assign) NSInteger sampleRate; +/** + * + * @brief 编码帧长。取值范围:`{10, 20, 40, 60, 120}`。 + */ +@property(nonatomic, assign) NSInteger packetSize; +@end + +/** + * + * @type keytype + * @brief + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCStreamKey : NSObject +/** + * + * @brief 用户 ID + */ +@property(nonatomic, copy, nullable) NSString *userId; +/** + * + * @brief 房间 ID + */ +@property(nonatomic, copy, nullable) NSString *roomId; +/** + * + * @brief 流属性,包括主流、屏幕流。参看 [StreamIndex](70083#StreamIndex-2) + */ +@property(nonatomic, assign) ByteRTCStreamIndex streamIndex; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCWTNStream.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCWTNStream.h new file mode 100644 index 0000000..9e8dd22 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCWTNStream.h @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCWTNStream +*/ + +#import +#import "ByteRTCVideoDefines.h" +/** + * + * @type keytype + * @brief WTN 媒体流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCWTNSubscribeState) { + /** + * + * @brief 订阅 WTN 媒体流 + */ + + ByteRTCWTNSubscribeStateSubscribe = 0, + /** + * + * @brief 取消订阅 WTN 媒体流 + */ + + ByteRTCWTNSubscribeStateUnsubscribe = 1 +}; +/** + * + * @type keytype + * @brief WTN 媒体流订阅状态改变的原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCWTNSubscribeStateChangeReason) { + /** + * + * @brief 订阅 WTN 媒体流成功 + */ + + ByteRTCWTNSubscribeStateChangeReasonSubscribe = 0, + /** + * + * @brief 其他原因订阅失败 + */ + + ByteRTCWTNSubscribeStateChangeReasonUnsubscribe = 1300, + /** + * + * @brief 订阅失败,拉流时远端未发布 + */ + + ByteRTCWTNSubscribeStateChangeReasonRemotePublish = 1301, + /** + * + * @brief 订阅失败,超出单端订阅上限。一个引擎实例最多拉 5 路流。 + */ + + ByteRTCWTNSubscribeStateChangeReasonOverClientSubscribeStreamLimit = 1310, + /** + * + * @brief 订阅失败。超出单流订阅人数上限。该限制由 RTC 服务端决定。 + */ + + ByteRTCWTNSubscribeStateChangeReasonOverStreamSubscribeUserLimit = 1311, + /** + * + * @brief 订阅失败。超出单流订阅请求 QPS 上限。该限制由 RTC 服务端决定。 + */ + + ByteRTCWTNSubscribeStateChangeReasonOverStreamSubscribeRequestLimit = 1312 +}; + + +/** + * + * @type callback + * @brief WTN 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCWTNStreamDelegate +/** +* +* @type callback +* @valid since 3.60. +* @brief 通话中本地设备接收订阅的远端 WTN 视频流的流 ID 以及远端 WTN 视频流统计信息。 +* @param streamId WTN 流 ID +* @param videoStats 远端 WTN 视频流的统计信息,详见 ByteRTCRemoteVideoStats{@link #ByteRTCRemoteVideoStats}。 +* @list WTN +* @order 0 +*/ + +- (void)onWTNRemoteVideoStats:(NSString* _Nonnull)streamId + videoStats:(const ByteRTCRemoteVideoStats* _Nonnull)videoStats; +/** +* +* @type callback +* @valid since 3.60. +* @brief 通话中本地设备接收订阅的远端 WTN 音频流的流 ID 以及远端 WTN 音频流统计信息。 +* @param streamId WTN 流 ID +* @param audioStats 远端 WTN 音频流的统计信息,详见 ByteRTCRemoteAudioStats{@link #ByteRTCRemoteAudioStats}。 +* @list WTN +* @order 1 +*/ + +- (void)onWTNRemoteAudioStats:(NSString* _Nonnull)streamId + audioStats:(const ByteRTCRemoteAudioStats* _Nonnull)audioStats; + +/** +* +* @type callback +* @valid since 3.60. 自 3.60 起,该回调替代了 `rtcEngine:onPlayPublicStreamResult:errorCode:` 方法中的 WTN 视频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 +* @brief WTN 视频流订阅状态变化回调
    +* 通过 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:} 订阅 WTN 视频流后,可以通过本回调获取订阅结果。 +* @param streamId WTN 视频流的 ID +* @param state 视频流状态码,参看 ByteRTCWTNSubscribeState{@link #ByteRTCWTNSubscribeState}。 +* @param reason 订阅状态发生变化的原因,参看 ByteRTCWTNSubscribeStateChangeReason{@link #ByteRTCWTNSubscribeStateChangeReason}。 +* @list WTN +* @order 2 +*/ + + +- (void)onWTNVideoSubscribeStateChanged:(NSString *_Nonnull)streamId + state:(ByteRTCWTNSubscribeState)state reason:(ByteRTCWTNSubscribeStateChangeReason)reason; +/** +* +* @type callback +* @valid since 3.60. 自 3.60 起,该回调替代了 `rtcEngine:onPlayPublicStreamResult:errorCode:` 方法中的 WTN 音频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 +* @brief WTN 音频流订阅状态变化回调
    +* 通过 subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:} 订阅 WTN 音频流后,可以通过本回调获取订阅结果。 +* @param streamId WTN 音频流的 ID +* @param state 音频流状态码,参看 ByteRTCWTNSubscribeState{@link #ByteRTCWTNSubscribeState}。 +* @param reason 订阅状态发生变化的原因,参看 ByteRTCWTNSubscribeStateChangeReason{@link #ByteRTCWTNSubscribeStateChangeReason}。 +* @list WTN +* @order 2 +*/ + +- (void)onWTNAudioSubscribeStateChanged:(NSString *_Nonnull)streamId + state:(ByteRTCWTNSubscribeState)state reason:(ByteRTCWTNSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 流的首帧视频解码成功
    + * 关于 订阅 WTN 流,详见 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:}。 + * @param streamId WTN 流 ID + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list WTN + * @order 4 + */ + +- (void)onWTNFirstRemoteVideoFrameDecoded:(NSString * _Nonnull)streamId withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(onWTNFirstRemoteVideoFrameDecoded(streamId:withFrameInfo:)); + +/** +* +* @type callback +* @valid since 3.60. 自 3.60 起,该回调替代了 `rtcEngine:onFirstPublicStreamAudioFrame:`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 +* @brief WTN 流的首帧音频解码成功
    +* 关于订阅 WTN 音频流,详见 subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:}。 +* @param streamId WTN 流 ID +* @list WTN +* @order 3 +*/ + +- (void)onWTNFirstRemoteAudioFrame:(NSString * _Nonnull)streamId; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替换了 `rtcEngine:onPublicStreamSEIMessageReceived:andMessage:andSourceType:` 来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief 回调 WTN 流中包含的 SEI 信息。
    + * subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:}/subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:} 接口启动拉 WTN 音频/视频流功能后,通过此回调收到 WTN 流中的 SEI 消息。 + * @param streamId WTN 流 ID。 + * @param channelId SEI 消息通道 ID,取值范围 [0 - 255]。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message 收到的 SEI 消息内容。
    + * 通过调用客户端 `sendPublicStreamSEIMessage` 插入的 SEI 信息。 + * 当 WTN 流中的多路视频流均包含有 SEI 信息:SEI 不互相冲突时,将通过多次回调分别发送;SEI 在同一帧有冲突时,则只有一条流中的 SEI 信息被透传并融合到 WTN 流中。 + * @note 通过 Open API 插入的自定义信息,应通过回调 onWTNDataMessageReceived:andMessage:andSourceType:{@link #ByteRTCWTNStreamDelegate#onWTNDataMessageReceived:andMessage:andSourceType:} 获取。 + * @list WTN + * @order 5 + */ + +- (void)onWTNSEIMessageReceived:(NSString* _Nonnull)streamId andChannelId:(int)channelId andMessage:(NSData* _Nonnull)message; + +/** + * + * @type callback + * @valid since 3.60. + * @brief 回调 WTN 流中包含的数据信息。
    + * 通过 subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:}/subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:} 订阅 WTN 流后,可以通过本回调获取 WTN 流中的数据消息,包括调用 Open API 发送的 SEI 消息和音量回调。 + * @param streamId WTN 流 ID + * @param message 收到的数据消息内容,如下:
    + * - 调用 WTN 流 OpenAPI 发送的自定义消息。 + * - 媒体流音量变化,需要通过 WTN 流 OpenAPI 开启回调。JSON 格式说明如下: + * {
    + * "Type" : "VolumeIndication", + * "VolumeInfos" : [ + * {
    + * "RoomId":"1000001", + * "UserId":"1000001", + * "StreamType":0, + * "LinearVolume":1 + * }
    + * @param sourceType 数据消息来源,参看 ByteRTCDataMessageSourceType{@link #ByteRTCDataMessageSourceType}。 + * @note 通过调用客户端 API 插入的 SEI 信息,应通过回调 onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage:} 获取。 + * @list WTN + */ + +- (void)onWTNDataMessageReceived:(NSString* _Nonnull)streamId andMessage:(NSData* _Nonnull)message andSourceType:(ByteRTCDataMessageSourceType)sourceType; + +@end + +/** + * + * @type api + * @region WTN + * @brief WTN 流处理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCWTNStream :NSObject +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream:` 和 `stopPlayPublicStream:` 方法来订阅/取消订阅指定 WTN 视频流,如果你使用了这两个方法,请迁移至此接口。 + * @brief 订阅/取消订阅指定 WTN 视频流
    + * 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 视频流。 + * @param streamId WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 + * @param subscribe 是否订阅 WTN 流
    + * - true:订阅 + * - false:取消订阅 + * @return + * - 0: 成功。同时将收到 + onWTNAudioSubscribeStateChanged:state:reason:{@link #ByteRTCWTNStreamDelegate#onWTNAudioSubscribeStateChanged:state:reason:} 回调。 + * - !0: 失败。当参数不合法或参数为空,调用失败。 + * @note + * - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:}/subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 + * - 在调用本接口之前,建议先绑定渲染视图。 + * - 调用 setWTNRemoteVideoCanvas:withCanvas:{@link #ByteRTCWTNStream#setWTNRemoteVideoCanvas:withCanvas:} 绑定内部渲染视图 + * - 调用 setWTNRemoteVideoSink:withSink:withConfig:{@link #ByteRTCWTNStream#setWTNRemoteVideoSink:withSink:withConfig:} 绑定自定义渲染视图 + * - 调用本接口后,可以通过 onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:{@link #ByteRTCWTNStreamDelegate#onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:} 回调 WTN 视频流的首帧解码情况 + * - 调用本接口后,可以通过 onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage:} 回调 WTN 流中包含的 SEI 信息。 + * @list WTN + * @order 0 + */ + +- (int)subscribeWTNVideoStream:(NSString * _Nonnull)streamId subscribe:(bool)subscribe; + +/** +* +* @type api +* @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream:` 和 `stopPlayPublicStream:` 方法来订阅/取消订阅指定 WTN 音频流,如果你使用了这两个方法,请迁移至此接口。 +* @brief 订阅/取消订阅指定 WTN 音频流
    +* 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 音频流。 +* @param streamId WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 +* @param subscribe 是否订阅 WTN 流
    +* - true:订阅 +* - false:取消订阅 +* @return +* - 0: 成功。同时将收到 onWTNVideoSubscribeStateChanged:state:reason:{@link #ByteRTCWTNStreamDelegate#onWTNVideoSubscribeStateChanged:state:reason:} 回调。 +* - !0: 失败。当参数不合法或参数为空,调用失败。 +* @note +* - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:}/subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 +* - 在调用本接口之前,建议先绑定渲染视图。 +* - 调用 setWTNRemoteVideoCanvas:withCanvas:{@link #ByteRTCWTNStream#setWTNRemoteVideoCanvas:withCanvas:} 绑定内部渲染视图 +* - 调用 setWTNRemoteVideoSink:withSink:withConfig:{@link #ByteRTCWTNStream#setWTNRemoteVideoSink:withSink:withConfig:} 绑定自定义渲染视图 +* - 调用本接口后,可以通过 onWTNFirstRemoteAudioFrame:{@link #ByteRTCWTNStreamDelegate#onWTNFirstRemoteAudioFrame:} 回调 WTN 音频流首帧解码情况。 +* - 调用本接口后,可以通过 onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage:} 回调 WTN 流中包含的 SEI 信息。 +* @list WTN +* @order 1 +*/ + +- (int)subscribeWTNAudioStream:(NSString * _Nonnull)streamId subscribe:(bool)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoCanvas:withCanvas:` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定内部渲染视图 + * @param streamId WTN 流 ID + * @param canvas 内部渲染视图,如果需要解除视频的绑定视图,把 videoCanvas 设置为空。详见 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas} + * @return + * - 0:成功 + * - !0:失败 + * @list WTN + * @order 2 + */ + +- (int)setWTNRemoteVideoCanvas:(NSString *_Nonnull)streamId + withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas NS_SWIFT_NAME(setWTNRemoteVideoCanvas(_:withCanvas:)); + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoSink:withSink:withPixelFormat:` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定自定义渲染器。详见[自定义视频渲染](https: + * @param streamId WTN 流 ID + * @param videoSink 自定义视频渲染器,需要释放渲染器资源时,将 videoSink 设置为 `null`。参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} + * @param config 远端视频帧回调配置,参看 ByteRTCRemoteVideoSinkConfig{@link #ByteRTCRemoteVideoSinkConfig} + * @return + * - 0: 成功 + * - <0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @list WTN + * @order 3 + */ + +- (int)setWTNRemoteVideoSink:(NSString *_Nonnull)streamId + withSink:(id _Nullable)videoSink + withConfig:(ByteRTCRemoteVideoSinkConfig*)config NS_SWIFT_NAME(setWTNRemoteVideoSink(_:withSink:withConfig:)); + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamAudioPlaybackVolume:volume:` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 调节 WTN 流的音频播放音量。 + * @param streamId WTN 流 ID + * @param volume 音频播放音量值和原始音量值的比值,该比值的范围是 `[0, 400]`,单位为 %,且自带溢出保护。为保证更好的音频质量,建议设定在 `[0, 100]` 之间,其中 100 为系统默认值。 + * @return + * - 0: 成功调用。 + * - -2: 参数错误。 + * @list WTN + * @order 4 + */ + +- (int)setWTNRemoteAudioPlaybackVolume:(NSString *_Nonnull)streamId volume:(NSInteger)volume; +/** +* +* @type api +* @valid since 3.60. +* @brief 设置 WTN 流回调接口 +* @param delegate WTN 回调类,参看 ByteRTCWTNStreamDelegate{@link #ByteRTCWTNStreamDelegate}。 +* @list WTN +* @order 5 +*/ + +- (void)setWTNStreamDelegate:(_Nullable id)delegate; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTSRoomInternal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTSRoomInternal.h new file mode 100644 index 0000000..320bfc1 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTSRoomInternal.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Internal API +*/ + +@interface RTSRoom () + +/** + * + * @type api + * @hidden 仅内部使用接口 + */ + +- (instancetype _Nonnull)initWithRtsRoom:(byterts::IRTSRoom *_Nonnull)rtsRoom roomId:(NSString *_Nonnull)roomId; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/MeetingAdvance.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/MeetingAdvance.h new file mode 100644 index 0000000..3c5ce89 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Headers/objc/rtc/MeetingAdvance.h @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Internal API +*/ + +#import +#import "ByteRTCDefines.h" +@class ByteRTCRoom; +@class ByteRTCEngine; +@class ByteRTCVideoEncoderConfig; +@class ByteRTCAmazingEffect; + +#define BYTERTC_APPLE_EXPORT __attribute__((visibility("default"))) + +/** + * @type keytype + * @brief 5.18版本后,飞书会议弱网提示专用,设置订阅视频基线数据用于计算网络等级 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubscribeVideoBaseline: NSObject +/** + * @brief 网络等级判定为优秀的视频分辨率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableGoodVideoPixelBaseline; +/** + * @brief 网络等级判定为优秀的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableGoodVideoFpsBaseline; +/** + * @brief 网络等级判定为差的视频分辨率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableBadVideoPixelBaseline; +/** + * @brief 网络等级判定为差的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableBadVideoFpsBaseline; +/** + * @brief 业务可以接受的最小分辨率宽度,-1表示业务忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableMinVideoResolutionWidth; +/** + * @brief 业务可以接受的最小分辨率宽度,-1表示业务忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableMinVideoResolutionHeight; +/** + * @brief 流的优先级,-1表示业务忽略此参数 + */ +@property (nonatomic, assign) NSInteger streamPriority; + +@end + +BYTERTC_APPLE_EXPORT @interface MeetingAdvance : NSObject + +/** + * + * @hidden + * @brief 推流到子频道channelName + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [NSString *_Nonnull] channelName 子频道 + */ ++ (int) setPublishChannel:(ByteRTCRoom *_Nonnull)room + channelName:(NSString *_Nonnull)channelName; +/** + * + * @hidden + * @brief 订阅子频道数组里的所有流 + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [NSArray * _Nonnull] channelsInfo 子频道数组 + * @param [bool] enableVolumeRescale 是否开启音频抑制功能 + */ ++ (int) setSubscribeChannels:(ByteRTCRoom *_Nonnull)room + channelsInfo:(NSArray * _Nonnull)channelsInfo + enableVolumeRescale:(bool)enableVolumeRescale; +/** + * + * @hidden + * @brief 设置是否开启音频抑制 + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [bool] enableVolumeRescale 是否抑制 + */ ++ (int) enableRescaleAudioVolume:(ByteRTCRoom *_Nonnull)room + enableVolumeRescale:(bool)enableVolumeRescale; +/** + * + * @hidden + * @brief 设置发布的特殊流类型 + * > 支持会前设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [int] type 流类型 + */ ++ (int) setPublishSpecialStream:(ByteRTCRoom *_Nonnull)room + type:(int)type; +/** + * + * @hidden + * @brief 设置订阅的特殊流类型 + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [NSArray * _Nonnull] types 流类型集合 + */ ++ (int) setSubscribeSpecialStream:(ByteRTCRoom *_Nonnull)room + types:(NSArray * _Nonnull)types; + +/** + * + * @hidden +* @brief 判断本地音视频流是否取消发布成功状态 +* > 支持会中设置 +* @param [ByteRTCRoom *_Nonnull] room 目标room +* @param [ByteRTCMediaStreamType] type 需要检查的流类型 +* @return +* true: 关闭状态; +* false: 开启状态; +*/ ++ (bool)isStreamUnpublished:(ByteRTCRoom *_Nonnull)room type:(ByteRTCMediaStreamType)type; + +/** + * + * @hidden +* @brief 设置视频编码参数 +* > 该方法用于编码参数设置 +* @return +* 0: 成功; +* != 0: 失败; +*/ ++ (int) setVideoEncoderConfig:(ByteRTCEngine*_Nonnull)video channelSolutions:(NSArray * _Nonnull) channelSolutions + mainSolutions:(NSArray * _Nonnull) channelMainSolutions; + + ++ (int) enableSimulcastMode:(ByteRTCEngine*_Nonnull)video enable:(BOOL) enabled; +/** + * + * @hidden +* @brief 更新自动订阅选项 +* > 支持会中设置 +*@param [ByteRTCRoom *_Nonnull] room 目标room +*@param [ByteRTCSubscribeMode] audioMode 音频自动订阅模式 +*@param [ByteRTCSubscribeMode] videoMode 视频自动订阅模式 +*/ ++ (int) enableAutoSubscribe:(ByteRTCRoom *_Nonnull)room audioSubMode:(ByteRTCSubscribeMode)audioMode videoMode:(ByteRTCSubscribeMode)videoMode; + +/** + * + * @hidden +* @brief 订阅基线设置 +* > 支持订阅流前设置 +* @param [ByteRTCRoom *_Nonnull] room 目标room +* @param [NSString *_Nonnull] userId 订阅用户名 +* @param [BOOL] isScreen 是否屏幕流 +* @param [ByteRTCSubscribeVideoBaseline* _Nullable] videoBaseline 订阅基线设置 +*/ ++ (void) setSubscribeBaselineData:(ByteRTCRoom *_Nonnull)room userId:(NSString *_Nonnull)userId isScreen:(BOOL)isScreen videoBaseline:(ByteRTCSubscribeVideoBaseline* _Nullable)videoBaseline; + +/** + * + * @hidden +* @brief 获取用于实时crash分子数据信息 +* @return +* [NSString * _Nonnull]: 返回json格式的信息 +*/ ++ (NSString * _Nonnull) getSessionLaunchParams; +/** + * + * @brief 获取视频特效接口ByteRTCAmazingEffect +* @param [ByteRTCEngine *_Nonnull] ivideo 目标ByteRTCVideo +*/ ++ (ByteRTCAmazingEffect* _Null_unspecified) getAmazingEffectInterface:(ByteRTCEngine *_Nonnull)video; + +/** + * + * @hidden + * @brief 设置屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ ++ (int)setScreenVideoConfigs:(ByteRTCEngine * _Nonnull)video; + +/** + * + * @hidden + * @brief 清空屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ ++ (int)resetScreenVideoConfigs:(ByteRTCEngine * _Nonnull)video; + +/** + * + * @brief 获取上行带宽状态 + * @param [ByteRTCRoom*] room 目标room + */ ++ (int)getUplinkNetworkBandwidthEstimationStatus:(ByteRTCRoom *_Nonnull)room; + +/** + * + * @brief 获取下行带宽状态 + * @param [ByteRTCRoom*] room 目标room + */ ++ (int)getDownlinkNetworkBandwidthEstimationStatus:(ByteRTCRoom *_Nonnull)room; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Info.plist b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Info.plist new file mode 100644 index 0000000..4d70a16 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Info.plist @@ -0,0 +1,51 @@ + + + + + BuildMachineOSBuild + 22H730 + CFBundleDevelopmentRegion + en + CFBundleExecutable + VolcEngineRTC + CFBundleIdentifier + VolcEngineRTC + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + VolcEngineRTC + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.60.107 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 20B71 + DTPlatformName + iphonesimulator + DTPlatformVersion + 16.1 + DTSDKBuild + 20B71 + DTSDKName + iphonesimulator16.1 + DTXcode + 1410 + DTXcodeBuild + 14B47b + MinimumOSVersion + 11.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Modules/module.modulemap b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Modules/module.modulemap new file mode 100644 index 0000000..f648c27 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module VolcEngineRTC { + umbrella header "VolcEngineRTC.h" + + export * + module * { export * } +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/PrivacyInfo.xcprivacy b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..76757b6 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/PrivacyInfo.xcprivacy @@ -0,0 +1,39 @@ + + + + + NSPrivacyTracking + + NSPrivacyCollectedDataTypes + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + + \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/VolcEngineRTC b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/VolcEngineRTC new file mode 100755 index 0000000..41877fd Binary files /dev/null and b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64/VolcEngineRTC.framework/VolcEngineRTC differ diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/VolcEngineRTC.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/VolcEngineRTC.h new file mode 100644 index 0000000..5c97a58 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/VolcEngineRTC.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Advance API + */ + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine.h new file mode 100644 index 0000000..e24d327 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine.h @@ -0,0 +1,3219 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface Lite + */ + +#pragma once + +#include "bytertc_room.h" +#include "bytertc_game_room.h" +#include "rtc/bytertc_video_device_manager.h" +#include "rtc/bytertc_audio_frame.h" +#include "rtc/bytertc_audio_mixing_manager.h" +#include "rtc/bytertc_audio_effect_player.h" +#include "rtc/bytertc_media_player.h" +#include "rtc/bytertc_video_processor_interface.h" +#include "rtc/bytertc_camera_control_interface.h" +#include "bytertc_engine_event_handler.h" +#include "rtc/bytertc_sing_scoring_interface.h" +#include "rtc/bytertc_ktv_manager_interface.h" +#include "rtc/bytertc_wtn_stream_interface.h" + +namespace bytertc { + +/** + * + * @type api + * @brief 引擎 API + * @list + */ + +class IRTCEngine { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTCEngine() { + } + /** + * + * @valid since 3.58.1 + * @type api + * @brief 设置是否将录音信号静音(不改变本端硬件)。 + * @param mute 是否静音音频采集。
    + * - True:静音(关闭麦克风) + * - False:(默认)开启麦克风 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 该方法用于设置是否使用静音数据替换设备采集到的音频数据进行推流,不影响 SDK 音频流的采集发布状态。对于 Windows 平台,如有需要你也可以选择静音整个系统的音频采集,具体参看 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 方法说明。 + * - 静音后通过 setCaptureVolume{@link #IRTCEngine#setCaptureVolume} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 音频管理 + */ + + virtual int muteAudioCapture(bool mute) = 0; + /** + * + * @valid since 3.60. + * @type api + * @brief 静音/取消静音屏幕共享时采集的音频。
    + * 调用此方法后,SDK 将发送静音数据来代替真实的屏幕音频数据,不影响本端音频设备的采集状态和 SDK 音频流的采集发布状态。 + * @param mute 是否静音屏幕音频。
    + * - True:静音。远端用户听不到来自你屏幕共享的声音。 + * - False:(默认)取消静音。恢复发送屏幕共享的音频。 + * @return + * - 0:调用成功。 + * - < 0:调用失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 静音后通过 setCaptureVolume{@link #IRTCEngine#setCaptureVolume} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 屏幕共享 + */ + + virtual int muteScreenAudioCapture(bool mute) = 0; + + /** + * + * @type api + * @brief 调节麦克风音频采集音量。
    + * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。 + * @param volume 采集的音量值和原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0, 100]。
    + * - 0:静音 + * - 100:原始音量 + * - 400:原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 在开启音频采集前后,你都可以使用此接口设定采集音量。 + * @list 音频管理 + */ + + virtual int setCaptureVolume(int volume) = 0; + /** + * + * @type api + * @valid Available since 3.60. + * @brief 调节屏幕共享时采集的音频音量。
    + * 只改变音频数据的音量信息,不影响麦克风采集的音量,也不会改变本端音频设备本身的音量。 + * @param volume 采集音量与原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0, 100]。
    + * - 0: 静音 + * - 100: 原始音量 + * - 400: 原始音量的 4 倍(自带溢出保护) + * + * @return + * + 0: 调用成功。
    + * + < 0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 在开启屏幕音频采集前后,你都可以使用此接口设定采集音量。 + * @list 屏幕共享 + */ + + virtual int setScreenCaptureVolume(int volume) = 0; + /** + * + * @type api + * @brief 调节本地播放的所有远端用户音频混音后的音量,混音内容包括远端人声、音乐、音效等。
    + * 播放音频前或播放音频时,你都可以使用此接口设定播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,当该方法与 setRemoteAudioPlaybackVolume{@link #IRTCEngine#setRemoteAudioPlaybackVolume} 或 setRemoteRoomAudioPlaybackVolume{@link #IRTCRoom#setRemoteRoomAudioPlaybackVolume} 共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + + virtual int setPlaybackVolume(const int volume) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启/关闭耳返功能 + * @param mode 是否开启耳返功能,参看 EarMonitorMode{@link #EarMonitorMode} + * @return + * - 0:调用成功。 + * - < 0:调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + + virtual int setEarMonitorMode(EarMonitorMode mode) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. + * @type api + * @brief 开启/关闭耳返功能,并控制是否对耳返音频应用本地音频处理。 + * @param mode 是否开启耳返功能,参看 EarMonitorMode{@link #EarMonitorMode}。默认关闭。 + * @param filter 是否对耳返音频应用本地音频处理,参看 EarMonitorAudioFilter{@link #EarMonitorAudioFilter}。默认不经过音频处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + + virtual int setEarMonitorMode(EarMonitorMode mode, int filter) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置耳返的音量 + * @param volume 耳返的音量相对原始音量的比值,取值范围:[0,100],单位:% + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 设置耳返音量前,你必须先调用 setEarMonitorMode{@link #IRTCEngine#setEarMonitorMode} 打开耳返功能。 + * @list 高级功能 + */ + + virtual int setEarMonitorVolume(const int volume) = 0; + /** + * + * @hidden(macOS,Windows,Linux,Android) + * @type api + * @brief 设置蓝牙模式 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 仅在媒体场景下生效。 + * @list 高级功能 + */ + + virtual int setBluetoothMode(BluetoothMode mode) = 0; + /** + * + * @type api + * @brief 开启内部音频采集。默认为关闭状态。
    + * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
    + * 调用该方法开启后,本地用户会收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 onUserStartAudioCapture{@link #IRTCEngineEventHandler#onUserStartAudioCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 若未取得当前设备的麦克风权限,调用该方法后会触发 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 回调,对应的错误码为 `MediaDeviceError.kMediaDeviceErrorDeviceNoPermission = 1`。 + * - 调用 stopAudioCapture{@link #IRTCEngine#stopAudioCapture} 可以关闭音频采集设备,否则,SDK 只会在销毁引擎的时候自动关闭设备。 + * - 由于不同硬件设备初始化响应时间不同,频繁调用 stopAudioCapture{@link #IRTCEngine#stopAudioCapture} 和本接口闭麦/开麦可能出现短暂无声问题,建议使用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 实现临时闭麦和重新开麦。 + * - 创建引擎后,无论是否发布音频数据,你都可以调用该方法开启音频采集,并且调用后方可发布音频。 + * - 对于 Windows SDK,如果需要从自定义音频采集切换为内部音频采集,你必须先停止发布流,调用 setAudioSourceType{@link #IRTCEngine#setAudioSourceType} 关闭自定义采集,再调用此方法手动开启内部采集。 + * @list 音频管理 + */ + + virtual int startAudioCapture() = 0; + /** + * + * @type api + * @brief 立即关闭内部音频采集。默认为关闭状态。
    + * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
    + * 调用该方法,本地用户会收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 的回调。
    + * 非隐身用户进房后调用该方法后,房间中的其他用户会收到 onUserStopAudioCapture{@link #IRTCEngineEventHandler#onUserStopAudioCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 可以开启音频采集设备。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部音频采集才会停止。 + * @list 音频管理 + */ + + virtual int stopAudioCapture() = 0; + + /** + * + * @hidden(macOS,Windows,Linux) + * @valid since 3.60. + * @type api + * @brief 设置音频场景类型。
    + * 选择音频场景后,SDK 会自动根据场景切换对应的音量模式(通话音量/媒体音量)和该场景下的最佳音频配置。
    + * @param scenario 音频场景类型,参看 AudioScenarioType{@link #AudioScenarioType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 此接口必须在加入 RTC 房间前调用。 + * - 通话音量更适合通话、会议等对信息准确度更高的场景。通话音量会激活系统硬件信号处理,使通话声音更清晰。同时,音量无法降低到 0。 + * - 媒体音量更适合娱乐场景,因其声音的表现力会更强。媒体音量下,最低音量可以为 0。 + * @list Audio Management + */ + + virtual int setAudioScenario(AudioScenarioType scenario) = 0; + + /** + * + * @hidden(Linux) + * @type api + * @brief 设置变声特效类型 + * @param voice_changer 变声特效类型,参看 VoiceChangerType{@link #VoiceChangerType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - !0:失败。 + * @note + * - 如需使用该功能,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 与 setVoiceReverbType{@link #IRTCEngine#setVoiceReverbType} 互斥,后设置的特效会覆盖先设置的特效。 + * - 在 Windows 端使用此功能前,必须额外接入 [音频技术](https: + * @list 音频处理 + */ + + virtual int setVoiceChangerType(VoiceChangerType voice_changer) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置混响特效类型 + * @param voice_reverb 混响特效类型,参看 VoiceReverbType{@link #VoiceReverbType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - !0:失败。 + * @note + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 只在包含美声特效能力的 SDK 中有效。 + * - 与 setVoiceChangerType{@link #IRTCEngine#setVoiceChangerType} 互斥,后设置的特效会覆盖先设置的特效。 + * @list 音频处理 + */ + + virtual int setVoiceReverbType(VoiceReverbType voice_reverb) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置本地采集语音的均衡效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param config 语音均衡效果,参看 VoiceEqualizationConfig{@link #VoiceEqualizationConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 根据奈奎斯特采样率,音频采样率必须大于等于设置的中心频率的两倍,否则,设置不生效。 + * @list 音频处理 + */ + + virtual int setLocalVoiceEqualization(VoiceEqualizationConfig config) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 设置本地采集音频的混响效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param param 混响效果,参看 VoiceReverbConfig{@link #VoiceReverbConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 调用 enableLocalVoiceReverb{@link #IRTCEngine#enableLocalVoiceReverb} 开启混响效果。 + * @list 音频处理 + */ + + virtual int setLocalVoiceReverbParam(VoiceReverbConfig param) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启本地音效混响效果 + * @param enable 是否开启 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 调用 setLocalVoiceReverbParam{@link #IRTCEngine#setLocalVoiceReverbParam} 设置混响效果。 + * @list 音频处理 + */ + + virtual int enableLocalVoiceReverb(bool enable) = 0; + /** + * + * @type api + * @brief 设置音质档位。
    + * 当所选的 RoomProfileType{@link #RoomProfileType} 中的音频参数无法满足你的场景需求时,调用本接口切换的音质档位。 + * @param audio_profile 音质档位,参看 AudioProfileType{@link #AudioProfileType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该方法在进房前后均可调用; + * - 支持通话过程中动态切换音质档位。 + * @list 音频管理 + */ + + virtual int setAudioProfile(AudioProfileType audio_profile) = 0; + /** + * + * @valid since 3.52 + * @type api + * @brief 支持根据业务场景,设置通话中的音频降噪模式。 + * @param ans_mode 降噪模式。具体参见 AnsMode{@link #AnsMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该接口进房前后均可调用,可重复调用,仅最后一次调用生效。 + * - 降噪算法包含传统降噪和 AI 降噪。传统降噪主要是抑制平稳噪声,比如空调声、风扇声等。而 AI 降噪主要是抑制非平稳噪声,比如键盘敲击声、桌椅碰撞声等。 + * - 只有以下 RoomProfileType{@link #RoomProfileType} 场景时,调用本接口可以开启 AI 降噪。其余场景的 AI 降噪不会生效。 + * - 游戏语音模式:kRoomProfileTypeGame + * - 高音质游戏模式:kRoomProfileTypeGameHD + * - 云游戏模式:kRoomProfileTypeCloudGame + * - 1 vs 1 音视频通话:kRoomProfileTypeChat + * - 多端同步播放音视频:kRoomProfileTypeLwTogether + * - 云端会议中的个人设备:kRoomProfileTypeMeeting + * - 课堂互动模式:kRoomProfileTypeClassroom + * - 云端会议中的会议室终端:kRoomProfileTypeMeetingRoom + * @list 高级功能 + */ + + virtual int setAnsMode(AnsMode ans_mode) = 0; + /** + * + * @valid since 3.51 + * @type api + * @brief 打开/关闭 AAGC(Analog Automatic Gain Control)模拟自动增益控制功能。
    + * 开启该功能后,SDK 会自动调节麦克风的采集音量,确保音量稳定。 + * @param enable 是否打开 AAGC 功能:
    + * - true: 打开 AAGC 功能。 + * - false: 关闭 AAGC 功能。 + * @return + * - 0: 调用成功。 + * - -1: 调用失败。 + * @note + * 该方法在进房前后均可调用。如果你需要在进房前使用 AAGC 功能,请联系技术支持获得私有参数,传入对应 RoomProfileType{@link #RoomProfileType} 。
    + * 要想在进房后开启 AAGC 功能,你需要把 RoomProfileType{@link #RoomProfileType} 设置为 `kRoomProfileTypeMeeting` 、`kRoomProfileTypeMeetingRoom` 或 `kRoomProfileTypeClassroom` 。
    + * AAGC 功能生效后,不建议再调用 setAudioCaptureDeviceVolume{@link #IAudioDeviceManager#setAudioCaptureDeviceVolume} 来调节设备麦克风的采集音量。 + * @list 音频管理 + */ + + virtual int enableAGC(bool enable) = 0; + /** + * + * @type api + * @brief 切换音频采集方式 + * @param type 音频数据源,详见 AudioSourceType{@link #AudioSourceType}。
    + * 默认使用内部音频采集。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
    + * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法由内部采集切换至自定义采集,SDK 会自动关闭内部采集。然后,调用 pushExternalAudioFrame{@link #IRTCEngine#pushExternalAudioFrame} 推送自定义采集的音频数据到 RTC SDK 用于传输。 + * - 如果你调用此方法由自定义采集切换至内部采集,你必须再调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 手动开启内部采集。 + * @list 自定义流处理 + */ + + virtual int setAudioSourceType (AudioSourceType type) = 0; + /** + * + * @type api + * @brief 切换音频渲染方式 + * @param type 音频输出类型,详见 AudioRenderType{@link #AudioRenderType}
    + * 默认使用内部音频渲染。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
    + * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法切换至自定义渲染,调用 pullExternalAudioFrame{@link #IRTCEngine#pullExternalAudioFrame} 获取音频数据。 + * @list 自定义流处理 + */ + + virtual int setAudioRenderType (AudioRenderType type) = 0; + /** + * + * @type api + * @brief 推送自定义采集的音频数据到 RTC SDK。 + * @param audio_frame 10 ms 对应的音频数据。详见 IAudioFrame{@link #IAudioFrame}。
    + * - 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 推送自定义采集的音频数据前,必须先调用 setAudioSourceType{@link #IRTCEngine#setAudioSourceType} 开启自定义采集。 + * - 你必须每 10 ms 推送一次数据。 + * @list 自定义流处理 + */ + + virtual int pushExternalAudioFrame(IAudioFrame* audio_frame) = 0; + /** + * + * @region 自定义音频采集渲染 + * @brief 拉取下行音频数据用于自定义音频渲染。
    + * 调用该方法后,SDK 会主动拉取待播放的音频数据,包括远端已解码和混音后的音频数据,用于外部播放。 + * @param audio_frame 获取的 10 ms 内的音频数据。详见 IAudioFrame{@link #IAudioFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 获取音频数据用于自定义渲染前,必须先调用 setAudioRenderType{@link #IRTCEngine#setAudioRenderType} 开启自定义渲染。 + * - 由于 RTC SDK 的帧长为 10 毫秒,你应当每隔 10 毫秒拉取一次音频数据。确保音频采样点数(sample)x 拉取频率等于 audio_frame 的采样率 (sampleRate)。如设置采样率为 48000 时,每 10 毫秒调用本接口拉取数据,每次应拉取 480 个采样点。 + * - 该函数运行在用户调用线程内,是一个同步函数。 + * @list 自定义流处理 + * @order 9 + */ + + virtual int pullExternalAudioFrame(IAudioFrame* audio_frame) = 0; + /** + * + * @hidden(Linux) + * @type api + * @region 自定义音频回声消除参考信号 + * @brief 向 SDK 发送由自定义处理后的 PCM 音频数据,作为回声消除的参考信号 + * @param audio_frame 10 ms 对应的音频数据。详见 IAudioFrame{@link #IAudioFrame}。 + * @return 方法调用结果
    + * + 0:方法调用成功
    + * + <-1:方法调用失败
    + * + <-302:警告,配置下发了无效的aec场景
    + * + <-303:警告,配置下发了错误的aec类型
    + * @note 你必须每 10 ms 推送一次数据。 + * @list 自定义流处理 + */ + + virtual int pushReferenceAudioPCMData(IAudioFrame* audio_frame) = 0; + /** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 推送opus编码音频数据到 RTC SDK,RTC SDK纯转发。 + * @param audio_stream 对应的opus音频数据。详见 EncodedAudioFrameData{@link #EncodedAudioFrameData}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 推送音频数据前,必须先调用 enableAudioEncoding{@link #IRTCEngine#enableAudioEncoding} 关闭音频编码。 + * @list 自定义流处理 + */ + + virtual int pushExternalEncodedAudioFrame(const EncodedAudioFrameData& audio_stream) = 0; + /** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频编码功能。 + * @param enable 是否使用sdk音频编码功能。 + * true: 打开音频编码(默认) + * false: 关闭音频编码直接转推。 + * @note + * - 在pushExternalEncodedAudioFrame{@link #IRTCEngine#pushExternalEncodedAudioFrame}之前调用。 + * @list 自定义流处理 + */ + + virtual void enableAudioEncoding(bool enable) = 0; + /** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频解码功能。 + * @param enable 是否使用sdk音频解码功能。 + * true: 打开音频解码功能(默认) + * false: 关闭音频解码功能直接转推。 + * @note + * - 在registerRemoteEncodedAudioFrameObserver 之前调用。 + * @list 自定义流处理 + */ + + virtual void enableAudioDecoding(bool enable) = 0; + /** + * + * @type api + * @hidden for internal use only + * @brief 注册远端音频帧监测器。
    + * 调用该方法后,SDK 每监测到一帧远端音频帧时,都会将音频帧信息通过 OnRemoteEncodedAudioFrame{@link #IRemoteEncodedAudioFrameObserver#OnRemoteEncodedAudioFrame} 回调给用户 + * @param observer 远端音频帧监测器,参看 IRemoteEncodedAudioFrameObserver{@link #IRemoteEncodedAudioFrameObserver} + * @note + * - 该方法建议在进房前调用。 + * - 将参数设置为 nullptr 则取消注册。 + * - 调用前,必须先调用 enableAudioDecoding{@link #IRTCEngine#enableAudioDecoding} 关闭音频解码功能。 + * @list 自定义流处理 + */ + + virtual void registerRemoteEncodedAudioFrameObserver(IRemoteEncodedAudioFrameObserver* observer) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即开启内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
    + * 本地用户在非隐身状态下调用该方法后,房间中的其他用户会收到 onUserStartVideoCapture{@link #IRTCEngineEventHandler#onUserStartVideoCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 stopVideoCapture{@link #IRTCEngine#stopVideoCapture} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。 + * - 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。 + * - 如果需要从自定义视频采集切换为内部视频采集,你必须先关闭自定义采集,再调用此方法手动开启内部采集。 + * @list 视频管理 + */ + + virtual int startVideoCapture() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即关闭内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 onUserStopVideoCapture{@link #IRTCEngineEventHandler#onUserStopVideoCapture} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 可以开启内部视频采集。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + * @list 视频管理 + */ + + virtual int stopVideoCapture() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
    + * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数,包括模式、分辨率、帧率。 + * @param video_capture_config 视频采集参数。参看: VideoCaptureConfig{@link #VideoCaptureConfig}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 前调用本接口。 + * - 建议同一设备上的不同引擎使用相同的视频采集参数。 + * - 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + * @list 视频管理 + */ + + virtual int setVideoCaptureConfig(const VideoCaptureConfig& video_capture_config) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本端采集的视频帧的旋转角度。
    + * 当摄像头倒置或者倾斜安装时,可调用本接口进行调整。 + * @param rotation 相机朝向角度,默认为 `VIDEO_ROTATION_0(0)`,无旋转角度。详见 VideoRotation{@link #VideoRotation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口也将对自定义采集视频画面生效,在原有的旋转角度基础上叠加本次设置。 + * - 对于 Windows SDK,视频贴纸特效或通过 enableVirtualBackground{@link #IVideoEffect#enableVirtualBackground} 增加的虚拟背景,也会跟随本接口的设置进行旋转。 + * @list 视频处理 + */ + + virtual int setVideoCaptureRotation(VideoRotation rotation) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端设置期望发布的最大分辨率视频流参数,包括分辨率、帧率、码率、网络不佳时的回退策略等(包含摄像头和屏幕的编码配置)。 + * @param encoder_config 期望发布的最大分辨率视频流参数。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。 + * @return 方法调用结果: + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 本接口仅设置一路视频流参数。默认状态下只有单流,如需开启多路小流请使用:setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode}。 + * - 调用该方法前,SDK 默认仅发布一路视频流,分辨率为 640px × 360px @15fps,编码偏好为帧率优先。 + * - 使用自定义采集时,必须调用该方法设置编码参数,以保证远端收到画面的完整性。 + * @list 视频管理 + */ + + virtual int setVideoEncoderConfig(const VideoEncoderConfig& encoder_config) = 0; + + /** + * + * @valid since 3.60. + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端进行大小流(simulcast)设置。 + * @param mode 详见 VideoSimulcastMode{@link #VideoSimulcastMode}。默认为只发送单流。你应在进房前调用修改本参数。 + * @param stream_config 小流参数。分辨率按照从小到大顺序,且每路流参数分辨率需小于大流 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 设置参数。否则可能会设置失败。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @param num 自定义小流路数。与 stream_config 指向的数组长度一致。最大值为 3。 + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 调用本方法前,SDK 默认仅发布一条分辨率为 640px × 360px @15fps 的视频流。 + * - 本方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + + virtual int setLocalSimulcastMode(VideoSimulcastMode mode, const VideoEncoderConfig* stream_config, int num) = 0; + + /** + * + * @valid since 3.60. + * @type api + * @brief 发布端开启大小流(simulcast)功能。 + * @param mode 详见 VideoSimulcastMode{@link #VideoSimulcastMode}。默认为只发送单流。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 你应在进房前调用本接口。 + * - 调用该方法前,SDK 默认仅发布一条分辨率为 640px × 360px,帧率为 15fps 的视频流。 + * - 如需自定义小流参数请查看它的重载方法 setLocalSimulcastMode(VideoSimulcastMode mode, const VideoEncoderConfig* stream_config, int num)。 + * - 该方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + + virtual int setLocalSimulcastMode(VideoSimulcastMode mode) = 0; + + /** + * + * @hidden for internal use only on Windows and Android + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端设置全景视频,包括分辨率、高清视野和低清背景分辨率、Tile 大小,以及其他常规编码参数。 + * @param encoder_config 期望发布的最大分辨率视频流参数。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。
    + * 支持 8K 和 4K 两种分辨率的全景视频。 + * @param parameters 全景视频的编码参数,JSON 字符串格式
    + * - 8K: HD: 7680x3840, LD: 2560x1280, Tile: 640x640 + * - 4K: HD: 3840x1920, LD: 1280x640, Tile: 320x320 + * {
    + * ```rtc.fov_config":{ + * "mode":0, + * "hd_width":3840, + * "hd_height":1920, + * "ld_width":1280, + * "ld_height":640, + * "tile_width":320, + * "tile_height":320, + * "framerate":30, + * "max_kbps":40000} + * }``` + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 发布全景视频前,绑定自定义采集器,必须调用该方法设置编码参数。支持的视频格式包括 YUV 或者 Texture 纹理。 + * - 通过 onFrame{@link #IVideoSink#onFrame} ,接收端获取到视频帧和解码需要的信息,传给自定义渲染器进行渲染。 + * @list 视频管理 + */ + + virtual int setVideoEncoderConfig(const VideoEncoderConfig& encoder_config, const char* parameters) = 0; + /** + * + * @hidden(Linux, macOS) + * @valid since 3.58 + * @type api + * @hiddensdk(audiosdk) + * @brief 开启自定义采集视频帧的 Alpha 通道编码功能。
    + * 适用于需要分离推流端视频主体与背景,且在拉流端可自定义渲染背景的场景。 + + * @param alpha_layout 分离后的 Alpha 通道相对于 RGB 通道信息的排列位置。当前仅支持 `AlphaLayout.kAlphaLayoutTop`,即置于 RGB 通道信息上方。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该接口仅作用于自定义采集的、并且使用 RGBA 色彩模型的视频帧,包括: + * - Windows:VideoPixelFormat.kVideoPixelFormatRGBA; + * - Android:VideoPixelFormat.TEXTURE_2D、VideoPixelFormat.TEXTURE_OES、VideoPixelFormat.RGBA; + * - iOS:ByteRTCVideoPixelFormat.ByteRTCVideoPixelFormatCVPixelBuffer。 + * - 该接口须在发布视频流之前调用。 + * - 调用本接口开启 Alpha 通道编码后,你需调用 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 把自定义采集的视频帧推送至 RTC SDK。若推送了不支持的视频帧格式,则调用 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 时会返回错误码 ReturnStatus.kReturnStatusParameterErr。 + * @list 视频管理 + */ + + virtual int enableAlphaChannelVideoEncode(AlphaLayout alpha_layout) = 0; + /** + * + * @valid since 3.58 + * @hidden(Linux, macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭外部采集视频帧的 Alpha 通道编码功能。 + + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 该接口须在停止发布视频流之后调用。 + * @list 视频管理 + */ + + virtual int disableAlphaChannelVideoEncode() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地视频渲染时使用的视图,并设置渲染模式。 + + * @param canvas 视图信息和渲染模式,参看:VideoCanvas{@link #VideoCanvas} + * @return + * - 0:成功。 + * - -2: 参数错误。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 你应在加入房间前,绑定本地视图。退出房间后,此设置仍然有效。 + * - 如果需要解除绑定,你可以调用本方法传入空视图。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 视频管理 + */ + + virtual int setLocalVideoCanvas(const VideoCanvas& canvas) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 修改本地视频渲染模式和背景色。 + + * @param render_mode 渲染模式,参看 RenderMode{@link #RenderMode} + * @param background_color 背景颜色,参看 VideoCanvas{@link #VideoCanvas}.background_color + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 你可以在本地视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + + virtual int updateLocalVideoCanvas(const enum RenderMode render_mode, const uint32_t background_color) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置渲染指定视频流 `stream_key` 时,使用的视图和渲染模式。
    + * 如果需要解除某个用户的绑定视图,你可以把 `canvas` 设置为空。 + * @param stream_id 流标识 + * @param canvas 视图信息和渲染模式,参看:VideoCanvas{@link #VideoCanvas} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本地用户离开房间时,会解除调用此 API 建立的绑定关系;远端用户离开房间则不会影响。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 视频管理 + */ + + virtual int setRemoteVideoCanvas(const char* stream_id, const VideoCanvas& canvas) = 0; + /** + * + * @deprecated since 3.56, and will be deleted in 3.62. + * @type api + * @hiddensdk(audiosdk) + * @brief 修改远端视频帧的渲染设置,包括渲染模式和背景颜色。 + * @param stream_id 流标识 + * @param render_mode 渲染模式,参看 RenderMode{@link #RenderMode}。 + * @param background_color 背景颜色,参看 VideoCanvas{@link #VideoCanvas}.background_color + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 你可以在远端视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + + virtual int updateRemoteStreamVideoCanvas(const char* stream_id, const enum RenderMode render_mode, const uint32_t background_color) = 0; + /** + * + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用 SDK 内部渲染时,修改远端视频帧的渲染设置,包括渲染模式、背景颜色和旋转角度。 + * @param stream_id 流标识 + * @param remote_video_render_config 视频帧渲染设置。具体参看 RemoteVideoRenderConfig{@link #RemoteVideoRenderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 setRemoteVideoCanvas{@link #IRTCEngine#setRemoteVideoCanvas} 设置了远端视频渲染模式后,你可以调用此接口更新渲染模式、背景颜色、旋转角度的设置。 + * - 该接口可以在远端视频渲染过程中调用,调用结果会实时生效。 + * @list 视频管理 + */ + + virtual int updateRemoteStreamVideoCanvas(const char* stream_id, const RemoteVideoRenderConfig& remote_video_render_config) = 0; + /** + * + * @deprecated since 3.60, use setLocalVideoSink(IVideoSink* video_sink, LocalVideoSinkConfig& config) instead. + * @type api + * @hiddensdk(audiosdk) + * @brief 将本地视频流与自定义渲染器绑定。 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param required_format video_sink 适用的视频帧编码格式,参看 PixelFormat{@link #PixelFormat} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 如果需要解除绑定,必须将 video_sink 设置为 null。退房时将清除绑定状态。 + * - 一般在收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * - 本方法获取的是前处理后的视频帧。 + * @list 自定义流处理 + */ + + BYTERTC_DEPRECATED virtual int setLocalVideoSink(IVideoSink* video_sink, IVideoSink::PixelFormat required_format) = 0; + + /** + * + * @valid since 3.60. + * @type api + * @hiddensdk(audiosdk) + * @brief 将本地视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param config 本地视频帧回调配置,参看 LocalVideoSinkConfig{@link #LocalVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 video_sink 设置为 null。 + * - 一般在收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * @list 自定义流处理 + */ + + virtual int setLocalVideoSink(IVideoSink* video_sink, LocalVideoSinkConfig& config) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @deprecated since 3.57, use setRemoteVideoSink{@link #IRTCEngine#setRemoteVideoSink} instead. + * @region 自定义视频采集渲染 + * @brief 将远端视频流与自定义渲染器绑定。 + * @param stream_id 流标识 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param required_format video_sink 适用的视频帧编码格式,参看 PixelFormat{@link #PixelFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调获取到远端流信息之后,再调用该方法。 + * - 如果需要解除绑定,必须将 video_sink 设置为 null。退房时将清除绑定状态。 + * - 本方法获取的是后处理后的视频帧。 + * @list 自定义流处理 + */ + + BYTERTC_DEPRECATED virtual int setRemoteVideoSink(const char* stream_id, IVideoSink* video_sink, IVideoSink::PixelFormat required_format) = 0; + + /** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @region 自定义视频帧回调 + * @brief 将远端视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param stream_id 流标识 + * @param video_sink 自定义视频渲染器,参看 IVideoSink{@link #IVideoSink}。 + * @param config 远端视频帧回调配置,参看 RemoteVideoSinkConfig{@link #RemoteVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调获取到远端流信息之后,再调用该方法。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 video_sink 设置为 null。 + * @list 自定义流处理 + * @order 3 + */ + + + virtual int setRemoteVideoSink(const char* stream_id, IVideoSink* video_sink, RemoteVideoSinkConfig& config) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 切换视频内部采集时使用的前置/后置摄像头
    + * 调用此接口后,在本地会触发 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 回调。 + * @param camera_id 参看 CameraID {@link #CameraID}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 默认使用前置摄像头。 + * - 如果你正在使用相机进行视频采集,切换操作当即生效;如果相机未启动,后续开启内部采集时,会打开设定的摄像头。 + * - 如果本地有多个摄像头且想选择特定工作摄像头可通过 IVideoDeviceManager{@link #IVideoDeviceManager} 来控制。 + * @list 视频管理 + */ + + virtual int switchCamera(CameraID camera_id) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,更新采集区域。仅用于采集源为显示器屏幕时。 + * @param region_rect 采集区域。参见 Rectangle{@link #Rectangle}
    + * 此参数描述了调用此接口后的采集区域,和 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 中 `source_info` 设定区域的相对关系。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 5 + */ + + virtual int updateScreenCaptureRegion(const Rectangle& region_rect) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 采集屏幕视频流,用于共享。屏幕视频流包括:应用窗口中显示的内容,或虚拟屏幕中显示的内容。
    + * 其中,虚拟屏幕中显示的内容仅在 Windows 平台上支持。 + * @param source_info 待共享的屏幕源,参看 ScreenCaptureSourceInfo{@link #ScreenCaptureSourceInfo}。
    + * 你可以调用 getScreenCaptureSourceList{@link #IRTCEngine#getScreenCaptureSourceList} 获得所有可以共享的屏幕源。 + * @param capture_params 共享参数。参看 ScreenCaptureParameters{@link #ScreenCaptureParameters}。 + * @return + * - 0: 成功 + * - -1: 失败 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 onVideoDeviceWarning{@link #IRTCEngineEventHandler#onVideoDeviceWarning} 回调。 + * - 调用此方法仅开启屏幕流视频采集,不会发布采集到的视频。发布屏幕流视频需要调用 publishStreamVideo{@link #IRTCRoom#publishStreamVideo}。 + * - 调用 stopScreenVideoCapture{@link #IRTCEngine#stopScreenVideoCapture} 关闭屏幕视频源采集。 + * - 本地用户通过 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调获取屏幕采集状态,包括开始、暂停、恢复、错误等。 + * - 调用成功后,本端会收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调。 + * - 调用此接口前,你可以调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 设置屏幕视频流的采集帧率和编码分辨率。 + * - 在收到 onFirstLocalVideoFrameCaptured{@link #IRTCEngineEventHandler#onFirstLocalVideoFrameCaptured} 回调后通过调用 setLocalVideoCanvas{@link #IRTCEngine#setLocalVideoCanvas} 或 setLocalVideoSink{@link #IRTCEngine#setLocalVideoSink} 函数设置本地屏幕共享视图。 + * - 可以调用 setLocalVideoSink{@link #IRTCEngine#setLocalVideoSink} 将本地视频流与自定义渲染器绑定,通过回调 onFrame{@link #IVideoSink#onFrame} 获取采集成功的本地视频帧。 + * - 对于 Windows SDK,再开启采集屏幕视频流后,你可以调用 updateScreenCaptureHighlightConfig{@link #IRTCEngine#updateScreenCaptureHighlightConfig} 更新边框高亮设置,调用 updateScreenCaptureMouseCursor{@link #IRTCEngine#updateScreenCaptureMouseCursor} 更新对鼠标的处理设置,调用 updateScreenCaptureFilterConfig{@link #IRTCEngine#updateScreenCaptureFilterConfig} 设置需要过滤的窗口。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 1 + */ + + virtual int startScreenVideoCapture(const ScreenCaptureSourceInfo& source_info, const ScreenCaptureParameters& capture_params) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 停止屏幕视频流采集。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 onVideoDeviceWarning{@link #IRTCEngineEventHandler#onVideoDeviceWarning} 回调。 + * - 要开启屏幕视频流采集,调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture}。 + * - 调用后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。 + * - 调用此接口不影响屏幕视频流发布。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 6 + */ + + virtual int stopScreenVideoCapture() = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,更新边框高亮设置。默认展示边框。 + * @param highlight_config 边框高亮设置。参见 HighlightConfig{@link #HighlightConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 2 + */ + + virtual int updateScreenCaptureHighlightConfig(const HighlightConfig& highlight_config) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,更新对鼠标的处理设置。默认采集鼠标。 + * @param capture_mouse_cursor 参看 MouseCursorCaptureState{@link #MouseCursorCaptureState} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 3 + */ + + virtual int updateScreenCaptureMouseCursor(MouseCursorCaptureState capture_mouse_cursor) = 0; + /** + * + * @hidden(Linux,iOS,Android) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,设置需要过滤的窗口。 + * @param filter_config 窗口过滤设置,参看 ScreenFilterConfig{@link #ScreenFilterConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 开启了内部屏幕流采集。 + * - 本函数在屏幕源类别是屏幕而非应用窗体时才起作用。详见:ScreenCaptureSourceType{@link #ScreenCaptureSourceType}。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 4 + */ + + virtual int updateScreenCaptureFilterConfig(const ScreenFilterConfig& filter_config) = 0; + + /** + * + * @hidden(Android,iOS) + * @brief 获取共享对象列表。 + * @return 共享对象列表,包括应用窗口和屏幕。详见 IScreenCaptureSourceList{@link #IScreenCaptureSourceList}。用户选择后,可调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 进行共享。 + * @note + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。采用 Wayland 协议,调用 startScreenVideoCapture{@link #IRTCEngine#startScreenVideoCapture} 时,系统会通过弹窗供用户选择共享对象。 + * - 使用完之后需要调用 release{@link #IScreenCaptureSourceList#release} 接口释放。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 0 + */ + + virtual IScreenCaptureSourceList* getScreenCaptureSourceList() = 0; + + /** + * + * @hidden(Android,iOS) + * @brief 获取共享对象缩略图 + * @region 屏幕共享 + * @param type 屏幕采集对象的类型。详见 ScreenCaptureSourceType{@link #ScreenCaptureSourceType}。 + * @param source_id 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList{@link #IRTCEngine#getScreenCaptureSourceList} 枚举共享对象列表中获取。详见 view_t{@link #view_t}。 + * @param max_width 最大宽度。保持采集对象本身的宽高比不变,将缩略图缩放到指定范围内的最大宽高。如果给出的尺寸与共享对象比例不同,得到的缩略图会有黑边。 + * @param max_height 最大高度。参见 max_width 的说明。 + * @return 共享对象缩略图,详见 IVideoFrame{@link #IVideoFrame}。 + * @note + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 9 + */ + + virtual IVideoFrame* getThumbnail( + ScreenCaptureSourceType type, view_t source_id, int max_width, int max_height) = 0; + /** + * + * @hidden(Android,iOS) + * @region 屏幕共享 + * @brief 获取应用窗体所属应用的图标。 + * @param source_id 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList{@link #IRTCEngine#getScreenCaptureSourceList} 枚举共享对象列表中获取。 + * @param max_width 最大宽度。返回的图标将是宽高相等的,输入宽高不等时,取二者较小值。宽高范围为 [32,256],超出该范围将返回 nullptr,默认输出 100 x 100 的图像。 + * @param max_height 最大高度。参见 max_width 的说明。 + * @return 详见 IVideoFrame{@link #IVideoFrame}。当屏幕共享对象为应用窗体,且有图标时有效,否则返回 nullptr。 + * @note + * - 对 Linux 系统,采用 X11 协议时可用;采用 Wayland 协议时不可用。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 屏幕共享 + * @order 10 + */ + + virtual IVideoFrame* getWindowAppIcon(view_t source_id, int max_width = 100, int max_height = 100) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置向 SDK 输入的视频源,包括屏幕流
    + * 默认使用内部采集。内部采集指:使用 RTC SDK 内置的视频采集机制进行视频采集。 + + * @param type 视频输入源类型,参看 VideoSourceType{@link #VideoSourceType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法进房前后均可调用。 + * - 当你已调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部采集后,再调用此方法切换至自定义采集时,SDK 会自动关闭内部采集。 + * - 当你调用此方法开启自定义采集后,想要切换至内部采集,你必须先调用此方法关闭自定义采集,然后调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 手动开启内部采集。 + * - 当你需要向 SDK 推送自定义编码后的视频帧,你需调用该方法将视频源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + + virtual int setVideoSourceType(VideoSourceType type) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送外部视频帧。 + * @param frame 设置视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 支持格式:I420, NV12, RGBA, BGRA, ARGB。不支持 RGB24。 + * - 该函数运行在用户调用线程内。 + * - 推送外部视频帧前,必须调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 开启外部视频源采集。 + * @list 自定义流处理 + */ + + virtual int pushExternalVideoFrame(const VideoFrameData& frame) = 0; + + /** + * + * @hidden(Windows,Linux,macOS) + * @type api + * @brief 设置音频播放设备。默认使用通过 setDefaultAudioRoute{@link #IRTCEngine#setDefaultAudioRoute} 设置的默认音频路由。
    + * 音频播放设备发生变化时,会收到 onAudioRouteChanged{@link #IRTCEngineEventHandler#onAudioRouteChanged} 回调。 + * @param device 音频播放设备。参看 AudioRoute{@link #AudioRoute}。仅支持听筒或者扬声器。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 对于绝大多数音频场景,推荐使用 setDefaultAudioRoute{@link #IRTCEngine#setDefaultAudioRoute} 设置默认音频路由,并借助 RTC SDK 的音频路由自动切换逻辑即可完成。切换逻辑参见[移动端设置音频路由](https: + * - 本接口在 Android 端仅支持在通话模式下使用;在 iOS 端支持在通话模式和媒体模式下使用,但切换的目标路由仅支持内置扬声器。 + * @list 音频管理 + */ + + virtual int setAudioRoute(AudioRoute route) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @brief 将默认的音频播放设备设置为听筒或扬声器。 + * @param route 音频播放设备。参看 AudioRoute{@link #AudioRoute} + * @return 方法调用结果
    + * - 0: 方法调用成功。立即生效。当所有音频外设移除后,音频路由将被切换到默认设备。 + * - < 0: 方法调用失败。指定除扬声器和听筒以外的设备将会失败。 + * @note 对于音频路由切换逻辑,参见[移动端设置音频路由](https: + * @list 音频管理 + */ + + virtual int setDefaultAudioRoute(AudioRoute route) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @brief 获取当前音频播放设备
    + * 音频播放设备发生变化时,会收到 onAudioRouteChanged{@link #IRTCEngineEventHandler#onAudioRouteChanged} 回调。 + * @return device 当前音频播放设备。参看 AudioRoute{@link #AudioRoute} + * @note + * - 1. 该接口仅适用于移动设备。 + * - 2. 通话前和通话中都可以调用该方法。 + * @list 音频管理 + */ + + virtual AudioRoute getAudioRoute() = 0; + /** + * + * @type api + * @brief 创建 RTC 房间实例。
    + * 调用此方法仅返回一个 RTC 房间实例,你仍需调用 joinRoom{@link #IRTCRoom#joinRoom} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 IRTCRoom{@link #IRTCRoom} 实例。分别调用各 IRTCRoom 实例中的 joinRoom{@link #IRTCRoom#joinRoom} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTCRoom{@link #IRTCRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 room_id 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 IRTCRoom 实例,再调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。 + * - 请勿使用同样的 room_id 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * - 如果你需要在多个房间发布音视频流,无须创建多房间,直接调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 开始跨房间转发媒体流。 + * @list 房间管理 + */ + + virtual IRTCRoom* createRTCRoom(const char* room_id) = 0; + + /** + * + * @type api + * @brief 创建游戏语音房间实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom{@link #IGameRoom#joinRoom} 才能真正地创建/加入游戏房间。
    + * 多次调用此方法以创建多个 IGameRoom{@link #IGameRoom} 实例。分别调用各 IGameRoom 实例中的 joinRoom{@link #IGameRoom#joinRoom} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @param room_config 游戏语音房间配置。参看 GameRoomConfig{@link #GameRoomConfig}。 + * @return 创建的 IGameRoom{@link #IGameRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 room_id 格式错误或当前场景是否是游戏场景。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 IGameRoom 实例,再调用 joinRoom{@link #IGameRoom#joinRoom} 加入房间。 + * - 请勿使用同样的 room_id 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + + virtual IGameRoom* createGameRoom(const char* room_id, const GameRoomConfig& room_config) = 0; + /** + * + * @type api + * @brief 创建 RTS 房间实例。
    + * 调用此方法仅返回一个 RTS 房间实例,你仍需调用 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 IRTSRoom{@link #IRTSRoom} 实例。分别调用各 IRTSRoom 实例中的 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时收发各房间的消息。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTSRoom{@link #IRTSRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 room_id 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 IRTSRoom 实例,再调用 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。 + * - 请勿使用同样的 room_id 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + + virtual IRTSRoom* createRTSRoom(const char* room_id) = 0; + /** + * + * @type api + * @brief 设置发布的音视频流的回退选项。
    + * 你可以调用该接口设置网络不佳或设备性能不足时从大流起进行降级处理,以保证通话质量。 + * @param option 本地发布的音视频流回退选项,参看 PublishFallbackOption{@link #PublishFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅在调用 setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode} 开启了发送多路视频流的情况下生效。 + * - 该方法必须在进房前设置,进房后设置或更改设置无效。 + * - 调用该方法后,如因性能或网络不佳产生发布性能回退或恢复,本端会提前收到 onPerformanceAlarms{@link #IRTCEngineEventHandler#onPerformanceAlarms} 回调发出的告警,以便采集设备配合调整。 + * - 设置回退后,本地发布的音视频流发生回退或从回退中恢复后,远端会收到 onSimulcastSubscribeFallback{@link #IRTCEngineEventHandler#onSimulcastSubscribeFallback} 回调,通知该情况。 + * - 你可以调用客户端 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + + virtual int setPublishFallbackOption(PublishFallbackOption option) = 0; + /** + * + * @type api + * @brief 设置订阅的音视频流的回退选项。
    + * 你可调用该接口设置网络不佳或设备性能不足时允许订阅流进行降级或只订阅音频流,以保证通话流畅。 + * @param option 订阅的音视频流回退选项,参看 SubscribeFallbackOption{@link #SubscribeFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 你必须在进房前设置,进房后设置或更改设置无效。 + * - 设置回退选项后,订阅的音视频流发生回退或从回退中恢复时,会收到 onSimulcastSubscribeFallback{@link #IRTCEngineEventHandler#onSimulcastSubscribeFallback} 和 onRemoteVideoSizeChanged{@link #IRTCEngineEventHandler#onRemoteVideoSizeChanged} 回调通知。 + * - 你可以调用 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + + virtual int setSubscribeFallbackOption(SubscribeFallbackOption option) = 0; + /** + * + * @type api + * @brief 设置用户优先级。 + * @param room_id 房间 ID + * @param user_id 远端用户的 ID + * @param priority 远端用户的需求优先级,详见枚举类型 RemoteUserPriority{@link #RemoteUserPriority} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 1. 该方法与 setSubscribeFallbackOption{@link #IRTCEngine#setSubscribeFallbackOption} 搭配使用。 + * - 2. 如果开启了订阅流回退选项,弱网或性能不足时会优先保证收到的高优先级用户的流的质量。 + * - 3. 该方法在进房前后都可以使用,可以修改远端用户的优先级。 + * @list 网络管理 + */ + + virtual int setRemoteUserPriority(const char* room_id, const char* user_id, RemoteUserPriority priority) = 0; + /** + * + * @type api + * @brief 设置业务标识参数
    + * 可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。 + * @param business_id
    + * 用户设置的自己的 businessId 值
    + * businessId 只是一个标签,颗粒度需要用户自定义。 + * @return + * - 0: 成功。 + * - -2: 输入非法,合法字符包括所有小写字母、大写字母和数字,除此外还包括四个独立字符,分别是:英文句号,短横线,下划线和 @ 。 + * @note + * - 需要在调用 joinRoom{@link #IRTCRoom#joinRoom} 之前调用,joinRoom{@link #IRTCRoom#joinRoom} 之后调用该方法无效。 + * @list 引擎管理 + */ + + virtual int setBusinessId(const char* business_id) = 0; + /** + * + * @hidden(Windows,macOS,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置采集视频的旋转模式。默认以 App 方向为旋转参考系。
    + * 接收端渲染视频时,将按照和发送端相同的方式进行旋转。 + * @param rotation_mode 视频旋转参考系为 App 方向或重力方向,参看 VideoRotationMode{@link #VideoRotationMode} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 旋转仅对内部视频采集生效,不适用于外部视频源和屏幕源。 + * - 调用该接口时已开启视频采集,将立即生效;调用该接口时未开启视频采集,则将在采集开启后生效。 + * - 更多信息请参考[视频采集方向](https: + * @list Engine Management + */ + + virtual int setVideoRotationMode(VideoRotationMode rotation_mode) = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 为采集到的视频流开启镜像 + * @param mirror_type 镜像类型,参看 MirrorType{@link #MirrorType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 切换视频源不影响镜像设置。 + * - 屏幕视频流始终不受镜像设置影响。 + * - 使用外部渲染器时,`mirrorType` 支持设置为 `0`(无镜像)和 `3`(本地预览和编码传输镜像),不支持设置为 `1`(本地预览镜像)。 + * - 该接口调用前,各视频源的初始状态如下: + * + * + * + * + *
    前置摄像头后置摄像头自定义采集视频源 桌面端摄像头
    移动端本地预览镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 /
    桌面端// 本地预览不镜像,编码传输不镜像 本地预览镜像,编码传输不镜像
    + * @list 视频处理 + */ + + virtual int setLocalVideoMirrorType(MirrorType mirror_type) = 0; + /** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用内部渲染时,为远端流开启镜像。 + * @param stream_id 流标识 + * @param mirror_type 远端流的镜像类型,参看 RemoteMirrorType{@link #RemoteMirrorType}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败,参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list 视频处理 + */ + + virtual int setRemoteVideoMirrorType(const char* stream_id, RemoteMirrorType mirror_type) = 0; + /** + * + * @type api + * @brief 获取视频特效接口。 + * @return 视频特效接口,参看 IVideoEffect{@link #IVideoEffect}。 + * @list 视频处理 + */ + + virtual IVideoEffect* getVideoEffectInterface() = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 开启/关闭基础美颜。 + * @param enable 基础美颜开关
    + * - true: 开启基础美颜 + * - false: 关闭基础美颜(默认) + * @return + * - 0: 调用成功。 + * - –1001: RTC SDK 版本不支持此功能。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 本方法不能与高级视频特效接口共用。如已购买高级视频特效,建议参看[集成指南](https: + * - 使用此功能需要集成特效 SDK,建议使用特效 SDK v4.4.2+ 版本。更多信息参看 [Native 端基础美颜](https: + * - 调用 setBeautyIntensity{@link #IRTCEngine#setBeautyIntensity} 设置基础美颜强度。若在调用本方法前没有设置美颜强度,则使用默认强度。各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * - 本方法仅适用于视频源,不适用于屏幕源。 + * @list 视频处理 + */ + + virtual int enableEffectBeauty(bool enable) = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 调整基础美颜强度。 + * @param beauty_mode 基础美颜模式,参看 EffectBeautyMode{@link #EffectBeautyMode}。 + * @param intensity 美颜强度,取值范围为 [0,1]。强度为 0 表示关闭。
    + * 各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * @return + * - 0: 调用成功。 + * - –2: `intensity` 范围超限。 + * - –1001: RTC SDK 版本不支持此功能。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 若在调用 enableEffectBeauty{@link #IRTCEngine#enableEffectBeauty} 前设置美颜强度,则对应美颜功能的强度初始值会根据设置更新。 + * - 销毁引擎后,美颜功能强度恢复默认值。 + * @list 视频处理 + */ + + virtual int setBeautyIntensity(EffectBeautyMode beauty_mode, float intensity) = 0; + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置远端视频超分模式。 + * @param stream_id 流标识 + * @param mode 超分模式,参看 VideoSuperResolutionMode{@link #VideoSuperResolutionMode}。 + * @return + * - 0: kReturnStatusSuccess,SDK 调用成功,并不代表超分模式实际状态,需要根据回调 onRemoteVideoSuperResolutionModeChanged{@link #IRTCEngineEventHandler#onRemoteVideoSuperResolutionModeChanged} 判断实际状态。 + * - -1: kReturnStatusNativeInvalid,native library 未加载。 + * - -2: kReturnStatusParameterErr,参数非法,指针为空或字符串为空。 + * - -9: kReturnStatusScreenNotSupport,不支持对屏幕流开启超分。 + * @note + * - 该方法须进房后调用。 + * - 远端用户视频流的原始分辨率不能超过 640 × 360 px。 + * - 支持对一路远端流开启超分,不支持对多路流开启超分。 + * @list 视频处理 + */ + + virtual int setRemoteVideoSuperResolution(const char* stream_id, VideoSuperResolutionMode mode) = 0; + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置视频降噪模式。 + * @param mode 视频降噪模式,启用后能够增强视频画质,但同时会增加性能负载。参看 VideoDenoiseMode{@link #VideoDenoiseMode}。 + * @return + * - 0: API 调用成功。 用户可以根据回调函数 onVideoDenoiseModeChanged{@link #IRTCEngineEventHandler#onVideoDenoiseModeChanged} 判断视频降噪是否开启。 + * - < 0:API 调用失败。 + * @list 视频处理 + */ + + virtual int setVideoDenoiser(VideoDenoiseMode mode) = 0; + /** + * + * @hidden(Windows, Linux, macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 在自定义视频前处理及编码前,设置 RTC 链路中的视频帧朝向,默认为 Adaptive 模式。
    + * 移动端开启视频特效贴纸,或使用自定义视频前处理时,建议固定视频帧朝向为 Portrait 模式。单流转推场景下,建议根据业务需要固定视频帧朝向为 Portrait 或 Landscape 模式。不同模式的具体显示效果参看[视频帧朝向](https: + * @param orientation 视频帧朝向,参看 VideoOrientation{@link #VideoOrientation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 视频帧朝向设置仅适用于内部采集视频源。对于自定义采集视频源,设置视频帧朝向可能会导致错误,例如宽高对调。屏幕源不支持设置视频帧朝向。 + * - 编码分辨率的更新与视频帧处理是异步操作,进房后切换视频帧朝向可能导致画面出现短暂的裁切异常,因此建议在进房前设置视频帧朝向,且不在进房后进行切换。 + * @list 自定义流处理 + */ + + virtual int setVideoOrientation(VideoOrientation orientation) = 0; + /** + * + * @hidden(macOS, Windows,Linux) + * @type api + * @brief 获取相机控制接口 + * @return 相机控制接口指针,参看 ICameraControl{@link #ICameraControl} + * @list 视频管理 + */ + + virtual ICameraControl* getCameraControl() = 0; + /** + * + * @type api + * @brief 设置传输时使用内置加密的方式。 + * @param encrypt_type 内置加密算法,详见 EncryptType{@link #EncryptType} + * @param key 加密密钥,长度限制为 36 位,超出部分将会被截断 + * @param key_size 参数 key 的长度 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 使用传输时内置加密时,使用此方法;如果需要使用传输时自定义加密,参看 onEncryptData{@link #IEncryptHandler#onEncryptData}。 内置加密和自定义加密互斥,根据最后一个调用的方法确定传输是加密的方案。 + * - 该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。 + * @list 通话加密 + */ + + virtual int setEncryptInfo(EncryptType encrypt_type, const char* key, int key_size) = 0; + /** + * + * @type api + * @brief 设置自定义加密和解密方式。 + * @param handler 自定义加密 handler,需要实现 handler 的加密和解密方法。参看 IEncryptHandler{@link #IEncryptHandler}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法与 setEncryptInfo{@link #IRTCEngine#setEncryptInfo} 为互斥关系,只能选择自定义加密方式或者默认加密方式。最终生效的加密方式取决于最后一个调用的方法。 + * - 该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。 + * - 无论加密或者解密,其对原始数据的长度修改,需要控制在 180% 之间,即如果输入数据为 100 字节,则处理完成后的数据必须不超过 180 字节,如果加密或解密结果超出该长度限制,则该音视频帧可能会被丢弃。 + * - 数据加密/解密为串行执行,因而视实现方式不同,可能会影响到最终渲染效率。是否使用该方法,需要由使用方谨慎评估。 + * @list 通话加密 + */ + + virtual int setCustomizeEncryptHandler(IEncryptHandler* handler) = 0; + /** + * + * @type api + * @brief 设置并开启指定的音频数据帧回调 + * @param method 音频回调方法,参看 AudioFrameCallbackMethod{@link #AudioFrameCallbackMethod}。
    + * 当音频回调方法设置为 `kRecord`、`kPlayback`、`kMixed`、`kRecordScreen`、`kCaptureMixed`时,你需要在参数 `format` 中指定准确的采样率和声道,暂不支持设置为自动。
    + * 当音频回调方法设置为 `kRemoteUser`时,将 `format` 中的各个字段设置为默认值。 + * @param format 音频参数格式,参看 AudioFormat{@link #AudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 开启音频回调并调用 registerAudioFrameObserver{@link #IRTCEngine#registerAudioFrameObserver} 后,IAudioFrameObserver{@link #IAudioFrameObserver} 会收到对应的音频回调。两者调用顺序没有限制且相互独立。 + * @list 自定义流处理 + */ + + virtual int enableAudioFrameCallback(AudioFrameCallbackMethod method, AudioFormat format) = 0; + /** + * + * @type api + * @brief 关闭音频回调 + * @param method 音频回调方法,参看 AudioFrameCallbackMethod{@link #AudioFrameCallbackMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该方法需要在调用 enableAudioFrameCallback{@link #IRTCEngine#enableAudioFrameCallback} 之后调用。 + * @list 自定义流处理 + */ + + virtual int disableAudioFrameCallback(AudioFrameCallbackMethod method) = 0; + /** + * + * @type api + * @brief 注册音频数据回调观察者。 + * @param observer 音频数据观察者,参看 IAudioFrameObserver{@link #IAudioFrameObserver}。如果传入 null,则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 注册音频数据回调观察者并调用 enableAudioFrameCallback{@link #IRTCEngine#enableAudioFrameCallback} 后,IAudioFrameObserver{@link #IAudioFrameObserver} 会收到对应的音频回调。对回调中收到的音频数据进行处理,不会影响 RTC 的编码发送或渲染。 + * @list 自定义流处理 + */ + + virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0; + /** + * + * @type api + * @brief 注册自定义音频处理器。
    + * 注册完成后,你可以调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},对本地采集到的音频进行处理,RTC SDK 将对处理后的音频进行编码和发送。也可以对接收到的远端音频进行自定义处理,RTC SDK 将对处理后的音频进行渲染。 + * @param processor 自定义音频处理器,详见 IAudioFrameProcessor{@link #IAudioFrameProcessor}。
    + * SDK 只持有 processor 的弱引用,你应保证其生命周期。需要取消注册时,设置此参数为 nullptr。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 重复调用此接口时,仅最后一次调用生效。 + * - 更多相关信息,详见[音频自定义处理](https: + * @list 自定义流处理 + */ + + virtual int registerAudioProcessor(IAudioFrameProcessor* processor) = 0; + /** + * + * @type api + * @brief 设置并开启指定的音频帧回调,进行自定义处理。 + * @param method 音频帧类型,参看 AudioProcessorMethod{@link #AudioProcessorMethod}。可多次调用此接口,处理不同类型的音频帧。
    + * 选择不同类型的音频帧将收到对应的回调:
    + * - 选择本地采集的音频时,会收到 onProcessRecordAudioFrame{@link #IAudioFrameProcessor#onProcessRecordAudioFrame}。 + * - 选择远端音频流的混音音频时,会收到 onProcessPlayBackAudioFrame{@link #IAudioFrameProcessor#onProcessPlayBackAudioFrame}。 + * - 选择远端音频流时,会收到 onProcessRemoteUserAudioFrame{@link #IAudioFrameProcessor#onProcessRemoteUserAudioFrame}。 + * - 选择屏幕共享音频流时,会收到 onProcessScreenAudioFrame{@link #IAudioFrameProcessor#onProcessScreenAudioFrame}。(Linux 不适用) + * @param format 设定自定义处理时获取的音频帧格式,参看 AudioFormat{@link #AudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 在调用此接口前,你需要调用 registerAudioProcessor{@link #IRTCEngine#registerAudioProcessor} 注册自定义音频处理器。 + * - 要关闭音频自定义处理,调用 disableAudioProcessor{@link #IRTCEngine#disableAudioProcessor}。 + * @list 自定义流处理 + */ + + virtual int enableAudioProcessor(AudioProcessorMethod method, AudioFormat format) = 0; + /** + * + * @type api + * @brief 关闭自定义音频处理。 + * @param method 音频帧类型,参看 AudioProcessorMethod{@link #AudioProcessorMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 自定义流处理 + */ + + virtual int disableAudioProcessor(AudioProcessorMethod method) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置自定义视频前处理器。
    + * 使用这个视频前处理器,你可以调用 processVideoFrame{@link #IVideoProcessor#processVideoFrame} 对 RTC SDK 采集得到的视频帧进行前处理,并将处理后的视频帧用于 RTC 音视频通信。 + * @param processor 自定义视频处理器,详见 IVideoProcessor{@link #IVideoProcessor}。如果传入 null,则不对 RTC SDK 采集得到的视频帧进行前处理。
    + * SDK 只持有 processor 的弱引用,你应保证其生命周期。 + * @param config 自定义视频前处理器适用的设置,详见 VideoPreprocessorConfig{@link #VideoPreprocessorConfig}。
    + * 当前,`config` 中的 `required_pixel_format` 仅支持:`kVideoPixelFormatI420` 和 `kVideoPixelFormatUnknown`:
    + * - 设置为 `kVideoPixelFormatUnknown` 时,RTC SDK 给出供 processor 处理的视频帧格式即采集的格式。 + * 你可以通过 VideoBufferType{@link #VideoBufferType} 和 VideoPixelFormat{@link #VideoPixelFormat} 获取实际采集的视频帧格式和像素类型。
    + * - 设置为 `kVideoPixelFormatI420` 时,RTC SDK 会将采集得到的视频帧转变为对应的格式,供前处理使用。 + * - 设置为其他值时,此方法调用失败。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 对于 Windows 平台,经前处理返回的视频帧格式仅支持 `kVideoPixelFormatI420` + * - 对于 Windows 平台,将 `config` 中的 required_pixel_format 设置为 `kVideoPixelFormatI420`,可以通过避免格式转换带来一些性能优化。 + * - 重复调用此接口时,仅最后一次调用生效。效果不会叠加。 + * @list 自定义流处理 + */ + + virtual int registerLocalVideoProcessor(IVideoProcessor* processor, VideoPreprocessorConfig config) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地摄像头数码变焦参数,包括缩放倍数,移动步长。 + * @param type 数码变焦参数类型,缩放系数或移动步长。参看 ZoomConfigType{@link #ZoomConfigType}。必填。 + * @param size 缩放系数或移动步长,保留到小数点后三位。默认值为 0。必填。
    + * 选择不同 `type` 时有不同的取值范围。当计算后的结果超过缩放和移动边界时,取临界值。
    + * - `kZoomConfigTypeFocusOffset`:缩放系数增量,范围为 [0, 7]。例如,设置为 0.5 时,如果调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 选择 Zoom in,则缩放系数增加 0.5。缩放系数范围 [1,8],默认为 `1`,原始大小。 + * - `kZoomConfigTypeMoveOffset`:移动百分比,范围为 [0, 0.5],默认为 0,不移动。如果调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 选择的是左右移动,则移动距离为 size x 原始视频宽度;如果选择的是上下移动,则移动距离为 size x 原始视频高度。例如,视频帧边长为 1080 px,设置为 0.5 时,实际移动距离为 0.5 x 1080 px = 540 px。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 每次调用本接口只能设置一种参数。如果缩放系数和移动步长都需要设置,分别调用本接口传入相应参数。 + * - 由于移动步长的默认值为 `0` ,在调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 或 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl} 进行数码变焦操作前,应先调用本接口。 + * @list 视频处理 + */ + + virtual int setVideoDigitalZoomConfig(ZoomConfigType type, float size) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 控制本地摄像头数码变焦,缩放或移动一次。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ZoomDirectionType{@link #ZoomDirectionType}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig{@link #IRTCEngine#setVideoDigitalZoomConfig} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 如果你希望实现持续数码变焦操作,调用 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl}。 + * - 移动端可对摄像头进行光学变焦控制,参看 `setCameraZoomRatio`。 + * @list 视频处理 + */ + + virtual int setVideoDigitalZoomControl(ZoomDirectionType direction) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 开启本地摄像头持续数码变焦,缩放或移动。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ZoomDirectionType{@link #ZoomDirectionType}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig{@link #IRTCEngine#setVideoDigitalZoomConfig} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值并停止操作。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 你也可以调用 stopVideoDigitalZoomControl{@link #IRTCEngine#stopVideoDigitalZoomControl} 手动停止控制。 + * - 如果你希望实现单次数码变焦操作,调用 setVideoDigitalZoomControl{@link #IRTCEngine#setVideoDigitalZoomControl}。 + * - 移动端可对摄像头进行光学变焦控制,参看 `setCameraZoomRatio`。 + * @list 视频处理 + */ + + virtual int startVideoDigitalZoomControl(ZoomDirectionType direction) = 0; + /** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地摄像头持续数码变焦。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 关于开始数码变焦,参看 startVideoDigitalZoomControl{@link #IRTCEngine#startVideoDigitalZoomControl}。 + * @list 视频处理 + */ + + virtual int stopVideoDigitalZoomControl() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 通过视频帧发送 SEI 数据。
    + * 在视频通话场景下,SEI 数据会随视频帧发送;在语音通话场景下,SDK 会自动生成一路 16px × 16px 的黑帧视频流用来发送 SEI 数据。 + + * 语音通话场景下,该值需设为 `kStreamIndexMain`,否则 SEI 数据会被丢弃从而无法送达远端。 + * @param message SEI 消息。 + * @param length SEI 消息长度,建议每帧 SEI 数据总长度不超过 4 KB。 + * @param repeat_count 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
    + * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeat_count+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 SEICountPerFrame{@link #SEICountPerFrame}。 + * @return + * - >= 0: 将被添加到视频帧中的 SEI 的数量。 + * - < 0: 发送失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率。在语音通话场景下,黑帧帧率为 15 fps。 + * - 从程序的启动到结束,建议用同一种发送模式。 + * - 语音通话场景中,仅支持在内部采集模式下调用该接口发送 SEI 数据。 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据;语音通话场景下,若调用此接口后 1min 内未有 SEI 数据发送,则 SDK 会自动取消发布视频黑帧。 + * - 消息发送成功后,远端会收到 onSEIMessageReceived{@link #IRTCEngineEventHandler#onSEIMessageReceived} 回调。 + * - 语音通话切换至视频通话时,会停止使用黑帧发送 SEI 数据,自动转为用采集到的正常视频帧发送 SEI 数据。 + * @list 消息 + */ + + virtual int sendSEIMessage(const uint8_t* message, int length, int repeat_count, SEICountPerFrame mode) = 0; + /** + * + * @type api + * @list 消息 + * @brief 以 Key-Value 格式通过视频帧发送 SEI 数据。 + * 调用此接口前,必须在调用 setLiveMode{@link #IRTCRoom#setLiveMode} 时将房间模式设置为 `kRoomLiveModeSoloHost` 开启单人直播模式。 + * @param json_string JSON 格式的键值对,例如 `{"key1":"value1","key2":"value2"}`: + * - 如果某个 Key 对应的 Value 为空(例如 `""` 或 `null`),则会从 SEI 字典中删除该 Key。 + * - 所有 Key-Value 合并后的总 SEI 数据大小不能超过 10KB。 + * @param count 连续发送该 SEI 数据的次数。 + * - 当 `is_key_frame_only` 为 true 时,代表伴随 `count` 个关键帧(I 帧)发送。 + * - 当 `is_key_frame_only` 为 false 时,代表伴随 `count` 个视频帧发送。 + * @param is_key_frame_only 是否只随关键帧(I 帧)发送: + * - true:只在关键帧发送。 + * - false:所有帧都会发送。 + * @param allow_overwrite 设置该 Key 写入后,后续请求是否允许覆盖它: + * - true:后续请求可覆盖该 Key 的 Value,且 `count` 也会更新为新值; + * - false:后续请求会忽略该 Key 的新值,保持原样。对于已存在的 Key,是否允许本次覆盖取决于该 Key 已保存的覆盖策略。 + * @return + * - 0: 调用成功。 + * - < 0: 发送失败。 + * - -1: 视频模块未启用。 + * - -2: 参数错误(JSON 为空或 count <= 0)。 + * - -3: JSON 格式错误。 + * - -4: SEI 数据总大小超过限制。 + */ + + virtual int sendLivePushSEIMessage(std::string json_string, int count, bool is_key_frame_only, bool allow_overwrite) = 0; + /** + * + * @hidden for internal use only + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief WTN 流视频帧发送 SEI 数据。 + * @param channel_id SEI 消息传输通道,取值范围 [0 - 255]。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message SEI 消息。 + * @param length SEI 消息长度,建议每帧 SEI 数据总长度不超过 4 KB。 + * @param repeat_count 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
    + * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeat_count+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 SEICountPerFrame{@link #SEICountPerFrame}。 + * @return + * - < 0:说明调用失败 + * - = 0:说明当前发送队列已满,无法发送 + * - > 0: 说明调用成功,该数值为已经发送 SEI 的数量 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率。 + * - 从程序的启动到结束,建议用同一种发送模式。 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据。 + * - 消息发送成功后,远端会收到 onPublicStreamSEIMessageReceivedWithChannel 回调。 + * - 调用失败时,本地及远端都不会收到回调。 + * @list 消息 + */ + + virtual int sendPublicStreamSEIMessage(int channel_id, const uint8_t* message, int length, + int repeat_count, SEICountPerFrame mode) = 0; + /** + * + * @type api + * @brief 创建视频设备管理实例 + * @return 视频设备管理实例,详见 IVideoDeviceManager{@link #IVideoDeviceManager} + * @list 视频管理 + */ + + virtual IVideoDeviceManager* getVideoDeviceManager() = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @brief 设备音频管理接口创建 + * @return 音频设备管理接口,详见 IAudioDeviceManager{@link #IAudioDeviceManager} + * @list 音频管理 + */ + + virtual IAudioDeviceManager* getAudioDeviceManager() = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 录制通话过程中的音视频数据到本地的文件中。 + * @param type 流属性,指定录制主流还是屏幕流,参看 StreamIndex{@link #StreamIndex} + * @param config 本地录制参数配置,参看 RecordingConfig{@link #RecordingConfig} + * @param recording_type 本地录制的媒体类型,参看 RecordingType{@link #RecordingType}
    + * 注意:屏幕流仅支持录制视频(kRecordingTypeVideoOnl);主流支持录制所有类型。 + * @return + * - 0: 正常 + * - -1: 参数设置异常 + * - -2: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 该方法需在进房后调用。 + * - 调用该方法后,你会收到 onRecordingStateUpdate{@link #IRTCEngineEventHandler#onRecordingStateUpdate} 回调。 + * - 如果录制正常,系统每秒钟会通过 onRecordingProgressUpdate{@link #IRTCEngineEventHandler#onRecordingProgressUpdate} 回调通知录制进度。 + * @list 高级功能 + */ + + virtual int startFileRecording(RecordingConfig config, RecordingType recording_type) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地录制 + * @param type 流属性,指定停止主流或者屏幕流录制,参看 StreamIndex{@link #StreamIndex} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 startFileRecording{@link #IRTCEngine#startFileRecording} 开启本地录制后,你必须调用该方法停止录制。 + * - 调用该方法后,你会收到 onRecordingStateUpdate{@link #IRTCEngineEventHandler#onRecordingStateUpdate} 回调提示录制结果。 + * @list 高级功能 + */ + + virtual int stopFileRecording() = 0; + /** + * + * @type api + * @brief 开始音频录制,并生成录音文件保存到本地。 + * @param config 参看 AudioRecordingConfig{@link #AudioRecordingConfig} + * @return + * - 0: 正常 + * - -2: 参数设置异常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 调用该方法后,会立即启动录制任务并创建录音文件。 + * - 录制包含各种音频效果。但不包含背景音乐。 + * - 录制本地麦克风的音频时,请确保已调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 接口打开麦克风采集。 + * - 调用 stopAudioRecording{@link #IRTCEngine#stopAudioRecording} 关闭录制。 + * - 加入房间前后均可调用。在进房前调用该方法,退房之后,录制任务不会自动停止,需调用 stopAudioRecording{@link #IRTCEngine#stopAudioRecording} 关闭录制。在进房后调用该方法,退房之后,录制任务会自动被停止。如果加入了多个房间,录制的文件中会包含各个房间的音频。 + * - 调用该方法后,你会收到 onAudioRecordingStateUpdate{@link #IRTCEngineEventHandler#onAudioRecordingStateUpdate} 回调。 + * @list 高级功能 + */ + + virtual int startAudioRecording(AudioRecordingConfig& config) = 0; + /** + * + * @type api + * @brief 停止音频文件录制 + * @return + * - 0: 正常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note 调用 startAudioRecording{@link #IRTCEngine#startAudioRecording} 开启本地录制。 + * @list 高级功能 + */ + + virtual int stopAudioRecording() = 0; + /** + * + * @type api + * @brief 启用匹配外置声卡的音频处理模式 + * @param enable
    + * - true: 开启 + * - false: 不开启(默认) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 当采用外接声卡进行音频采集时,建议开启此模式,以获得更好的音质。 + * - 开启此模式时,仅支持耳机播放。如果需要使用扬声器或者外置音箱播放,关闭此模式。 + * @list 音频管理 + */ + + virtual int enableExternalSoundCard(bool enable) = 0; + /** + * + * @type api + * @brief 设置运行时的参数 + * @param json_string json 序列化之后的字符串 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该接口需在 joinRoom{@link #IRTCRoom#joinRoom} 和 startAudioCapture{@link #IRTCEngine#startAudioCapture} 之前调用。 + * @list 引擎管理 + */ + + virtual int setRuntimeParameters(const char * json_string) = 0; + /** + * + * @type api + * @brief 将用户反馈的问题上报到 RTC。 + * @param type 预设问题列表,参看 ProblemFeedbackOption{@link #ProblemFeedbackOption} + * @param info 预设问题以外的其他问题的具体描述,房间信息。 参看 ProblemFeedbackInfo{@link #ProblemFeedbackInfo} + * @return + * - 0: 成功。 + * - -3: 失败。 + * @note + * - 你可以在 [RTC 控制台](https: + * - 如果用户上报时在房间内,那么问题会定位到用户当前所在的一个或多个房间;如果用户上报时不在房间内,那么问题会定位到引擎此前退出的房间。 + * @list 引擎管理 + */ + + virtual int feedback(uint64_t type, const ProblemFeedbackInfo* info) = 0; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音效播放器实例。 + * @return 音效播放器。详见 IAudioEffectPlayer{@link #IAudioEffectPlayer}。 + * @list 混音 + */ + + virtual IAudioEffectPlayer* getAudioEffectPlayer() = 0; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音乐播放器实例。 + * @param player_id 音乐播放器实例 id。取值范围为 `[0, 3]`。最多同时存在 4 个实例,超出取值范围时返回 nullptr。 + * @return 音乐播放器实例,详见 IMediaPlayer{@link #IMediaPlayer} + * @list 混音 + */ + + virtual IMediaPlayer* getMediaPlayer(int player_id) = 0; + /** + * + * @type api + * @brief 登陆 RTS 服务器。
    + * 必须先登录,才能调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 和 sendServerMessage{@link #IRTCEngine#sendServerMessage} 发送房间外点对点消息和向应用服务器发送消息
    + * 在调用本接口登录后,如果想要登出,需要调用 logout{@link #IRTCEngine#logout}。 + * @param token 用户登录必须携带的 Token,用于鉴权验证。
    + * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,`roomId` 置空,Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。 + * @param uid
    + * 用户 ID
    + * 用户 ID 在 appid 的维度下是唯一的。 + * @return + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note 本地用户调用此方法登录后,会收到 onLoginResult{@link #IRTCEngineEventHandler#onLoginResult} 回调通知登录结果,远端用户不会收到通知。 + * @list 消息 + */ + + virtual int login(const char* token, const char* uid) = 0; + /** + * + * @type api + * @brief 登出 RTS 服务器。
    + * 调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口登出前,必须先调用 login{@link #IRTCEngine#login} 登录。 + * - 本地用户调用此方法登出后,会收到 onLogout{@link #IRTCEngineEventHandler#onLogout} 回调通知结果,远端用户不会收到通知。 + * @list 消息 + */ + + virtual int logout() = 0; + /** + * + * @type api + * @brief 更新用户用于登录的 Token
    + * Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
    + * 调用 login{@link #IRTCEngine#login} 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 onLoginResult{@link #IRTCEngineEventHandler#onLoginResult} 回调通知,错误码为 kLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。 + * @param token
    + * 更新的动态密钥 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果 Token 无效导致登录失败,则调用此方法更新 Token 后,SDK 会自动重新登录,而用户不需要自己调用 login{@link #IRTCEngine#login} 方法。 + * - Token 过期时,如果已经成功登录,则不会受到影响。Token 过期的错误会在下一次使用过期 Token 登录时,或因本地网络状况不佳导致断网重新登录时通知给用户。 + * @list 消息 + */ + + virtual int updateLoginToken(const char* token) = 0; + /** + * + * @type api + * @brief 设置应用服务器参数
    + * 客户端调用 sendServerMessage{@link #IRTCEngine#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTCEngine#sendServerBinaryMessage} 发送消息给应用服务器之前,必须设置有效签名和应用服务器地址。 + * @param signature 动态签名,应用服务器可使用该签名验证消息来源。
    + * 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。
    + * 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 + * @param url 应用服务器的地址 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 用户必须调用 login{@link #IRTCEngine#login} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 onServerParamsSetResult{@link #IRTCEngineEventHandler#onServerParamsSetResult} 返回相应结果。 + * @list 消息 + */ + + virtual int setServerParams(const char* signature, const char* url) = 0; + /** + * + * @type api + * @brief 查询对端用户或本端用户的登录状态 + * @param peer_user_id
    + * 需要查询的用户 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 必须调用 login{@link #IRTCEngine#login} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 onGetPeerOnlineStatus{@link #IRTCEngineEventHandler#onGetPeerOnlineStatus} 回调通知查询结果。 + * - 在发送房间外消息之前,用户可以通过本接口了解对端用户是否登录,从而决定是否发送消息。也可以通过本接口查询自己的登录状态。 + * @list 消息 + */ + + virtual int getPeerOnlineStatus(const char* peer_user_id) = 0; + /** + * + * @type api + * @brief 给房间外指定的用户发送文本消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param message 发送的文本消息内容。消息不超过 64 KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外文本消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录。 + * - 用户调用本接口发送文本信息后,会收到一次 onUserMessageSendResultOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageSendResultOutsideRoom} 回调,得知消息是否成功发送。 + * - 若文本消息发送成功,则 uid 所指定的用户会通过 onUserMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageReceivedOutsideRoom} 回调收到该消息。 + * @list 消息 + */ + + virtual int64_t sendUserMessageOutsideRoom(const char* uid, const char* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; + /** + * + * @type api + * @brief 给房间外指定的用户发送二进制消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param length 二进制字符串的长度 + * @param message 发送的二进制消息内容。消息不超过 64 KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外二进制消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录。 + * - 用户调用本接口发送二进制消息后,会收到一次 onUserMessageSendResultOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageSendResultOutsideRoom} 回调,通知消息是否发送成功。 + * - 若二进制消息发送成功,则 uid 所指定的用户会通过 onUserBinaryMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserBinaryMessageReceivedOutsideRoom} 回调收到该条消息。 + * @list 消息 + */ + + virtual int64_t sendUserBinaryMessageOutsideRoom(const char* uid, int length, const uint8_t* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; + /** + * + * @type api + * @brief 客户端给应用服务器发送文本消息(P2Server)。 + * @param message 发送的文本消息内容。消息不超过 64 KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送文本消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录,随后调用 setServerParams{@link #IRTCEngine#setServerParams} 设置应用服务器。 + * - 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTCEngineEventHandler#onServerMessageSendResult} 回调,通知消息发送方是否发送成功。 + * - 若文本消息发送成功,则之前调用 setServerParams{@link #IRTCEngine#setServerParams} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + + virtual int64_t sendServerMessage(const char* message) = 0; + /** + * + * @type api + * @brief 客户端给应用服务器发送二进制消息(P2Server)。 + * @param length 二进制字符串的长度 + * @param message 发送的二进制消息内容。消息不超过 64KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送二进制消息前,必须先调用 login{@link #IRTCEngine#login} 完成登录,随后调用 setServerParams{@link #IRTCEngine#setServerParams} 设置应用服务器。 + * - 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTCEngineEventHandler#onServerMessageSendResult} 回调,通知消息发送方发送成功或失败。 + * - 若二进制消息发送成功,则之前调用 setServerParams{@link #IRTCEngine#setServerParams} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + + virtual int64_t sendServerBinaryMessage(int length, const uint8_t* message) = 0; + /** + * + * @type api + * @brief 开启通话前网络探测 + * @param is_test_uplink 是否探测上行带宽 + * @param expected_uplink_bitrate 期望上行带宽,单位:kbps
    范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @param is_test_downlink 是否探测下行带宽 + * @param expected_downlink_biterate 期望下行带宽,单位:kbps
    范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 成功调用本接口后,会在 3s 内收到一次 onNetworkDetectionResult{@link #IRTCEngineEventHandler#onNetworkDetectionResult} 回调,此后每 2s 会收到一次该回调,通知探测结果; + * - 若探测停止,则会收到一次 onNetworkDetectionStopped{@link #IRTCEngineEventHandler#onNetworkDetectionStopped} 通知探测停止。 + * @list 网络管理 + */ + + virtual int startNetworkDetection(bool is_test_uplink, int expected_uplink_bitrate, bool is_test_downlink, int expected_downlink_biterate) = 0; + /** + * + * @type api + * @brief 停止通话前网络探测 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口后,会收到一次 onNetworkDetectionStopped{@link #IRTCEngineEventHandler#onNetworkDetectionStopped} 回调通知探测停止。 + * @list 网络管理 + */ + + virtual int stopNetworkDetection() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 在屏幕共享时,设置屏幕音频的采集方式(内部采集/自定义采集) + * @param source_type 屏幕音频输入源类型, 参看 AudioSourceType{@link #AudioSourceType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 默认采集方式是 RTC SDK 内部采集。 + * - 如果设定为内部采集,你必须再调用 startScreenAudioCapture{@link #IRTCEngine#startScreenAudioCapture} 开始采集。 + * - 如果设定为自定义采集,你必须再调用 pushScreenAudioFrame{@link #IRTCEngine#pushScreenAudioFrame} 将自定义采集到的屏幕音频帧推送到 RTC SDK。 + * - 无论是内部采集还是自定义采集,你都必须调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。 + * @list 屏幕共享 + * @order 11 + */ + + virtual int setScreenAudioSourceType(AudioSourceType source_type) = 0; + + /** + * + * @hidden(iOS,Android,Linux) + * @type api + * @brief 在屏幕共享时,设置屏幕音频流的声道数 + * @param channel 声道数,参看 AudioChannel{@link #AudioChannel} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 屏幕共享 + */ + + virtual int setScreenAudioChannel(AudioChannel channel) = 0; + /** + * + * @hidden(Android,iOS,macOS,Windows) + * @deprecated on Windows since 3.59, use `startScreenAudioCapture` with the "device_id" parameter as a replacement. + * @type api + * @brief 在屏幕共享时,开始使用 RTC SDK 内部采集方式,采集屏幕音频 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本接口仅对内部采集生效,RTC SDK 默认使用内部采集模块采集屏幕音频。对于 Windows SDK,若已调用 setScreenAudioSourceType{@link #IRTCEngine#setScreenAudioSourceType} 将音频输入源设置为 `kAudioSourceTypeExternal` 自定义采集,需先切换为 `kAudioSourceTypeInternal` 内部采集,否则该接口调用无效,并将触发 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调。 + * - 采集后,你还需要调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。 + * - 要关闭屏幕音频内部采集,调用 stopScreenAudioCapture{@link #IRTCEngine#stopScreenAudioCapture}。 + * @list 屏幕共享 + */ + + virtual int startScreenAudioCapture() = 0; + /** + * + * @hidden(Linux,Android,iOS) + * @valid since 3.59 + * @type api + * @brief 使用 RTC SDK 内部采集方式,采集桌面端系统声音,用于屏幕共享。
    + * 该接口会采集桌面端系统声卡的音频数据,采集到的音频会混入本地音频流中。 + * @param device_id
    + * - 对于 Windows 平台,该参数用于设置采集本地指定音频进程的音频。例如可将该参数设为某应用程序可执行文件的文件名(如 QQMusic.exe),此时 SDK 只会采集该应用程序的音频。传入 nullptr 或置空时即代表采集整个系统除本进程之外的所有应用程序的音频。当前,应用程序仅支持 QQ 音乐、网易云音乐和酷狗音乐,采集其他进程可能会导致未知行为。 + * - 对于 macOS 平台,该参数表示虚拟设备 ID。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本接口仅对内部采集生效,RTC SDK 默认使用内部采集模块采集屏幕音频。若已调用 setScreenAudioSourceType{@link #IRTCEngine#setScreenAudioSourceType} 将音频输入源设置为 `kAudioSourceTypeExternal` 自定义采集,需先切换为 `kAudioSourceTypeInternal` 内部采集,否则该接口调用无效,并将触发 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调。 + * - 采集后,你还需要调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。 + * - 要关闭屏幕音频内部采集,调用 stopScreenAudioCapture{@link #IRTCEngine#stopScreenAudioCapture}。 + * @list 屏幕共享 + */ + + virtual int startScreenAudioCapture(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @hidden(Android,iOS) + * @type api + * @brief 在屏幕共享时,停止使用 RTC SDK 内部采集方式,采集屏幕音频。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调。 + * - 本接口仅对内部采集生效。如果为外部采集模式,调用本接口失败。你需要在外部采集器中实现停止采集的逻辑。 + * - 要开始屏幕音频内部采集,调用 startScreenAudioCapture{@link #IRTCEngine#startScreenAudioCapture}。 + * @list 屏幕共享 + */ + + virtual int stopScreenAudioCapture() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 使用自定义采集方式,采集屏幕共享时的屏幕音频时,将音频帧推送至 RTC SDK 处进行编码等处理。 + * @param frame 音频数据帧,参见 IAudioFrame{@link #IAudioFrame}
    + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 samples × frame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
    + * - 0: 设置成功。 + * - < 0: 设置失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 调用此接口推送屏幕共享时的自定义采集的音频数据前,必须调用 setScreenAudioSourceType{@link #IRTCEngine#setScreenAudioSourceType} 开启屏幕音频自定义采集。 + * - 你应每隔 10 毫秒,调用一次此方法推送一次自定义采集的音频帧。一次推送的音频帧中应包含 frame.sample_rate / 100 个音频采样点。比如,假如采样率为 48000Hz,则每次应该推送 480 个采样点。 + * - 调用此接口将自定义采集的音频帧推送到 RTC SDK 后,你必须调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 将采集到的屏幕音频推送到远端。在调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 前,推送到 RTC SDK 的音频帧信息会丢失。 + * @list 屏幕共享 + * @order 14 + */ + + virtual int pushScreenAudioFrame(IAudioFrame* frame) = 0; + /** + * + * @type api + * @hidden internal use only + * @brief 在听众端,设置订阅的所有远端音频流精准对齐后播放。 + * @param stream_id 流标识 + * 一般选择主唱的音频流。
    + * 你必须在收到 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio},确认此音频流已发布后,调用此 API。 + * @param mode 是否对齐,默认不对齐。参看 AudioAlignmentMode{@link #AudioAlignmentMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 你必须在实时合唱场景下使用此功能。在加入房间时,所有人应设置 RoomProfileType{@link #RoomProfileType} 为 `kRoomProfileTypeChorus`。 + * - 订阅的所有远端流必须通过 startAudioMixing 开启了背景音乐混音,并将 AudioMixingConfig 中的 `sync_progress_to_record_frame` 设置为 `true`。 + * - 如果订阅的某个音频流延迟过大,可能无法实现精准对齐。 + * - 合唱的参与者不应调用此 API,因为调用此 API 会增加延迟。如果希望从听众变为合唱参与者,应关闭对齐功能。 + * @list 在线 KTV + */ + + virtual int setAudioAlignmentProperty(const char* stream_id, AudioAlignmentMode mode) = 0; + /** + * + * @hidden(macOS,Windows,Android,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 Extension 配置项 + * @param group_id App 和 Extension 应该归属于同一个 App Group,此处需要传入 Group Id + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该函数必须在 sharedEngineWithAppId 函数之后立即调用。如果不调用或者调用时机比较晚,本地用户会收到 onMediaDeviceStateChanged 的回调。
    + * - 参数 device_state 值为 ByteRTCMediaDeviceStateStopped,device_error 值为 `ByteRTCMediaDeviceErrorNotFindGroupId` + * @list 屏幕共享 + */ + + virtual int setExtensionConfig(const char* group_id) = 0; + /** + * + * @hidden(macOS,Windows,Android,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 发送屏幕共享 Extension 程序消息 + * @param message 发送给 Extension 程序的消息内容 + * @param size 消息内容大小 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该函数必须在 startScreenCapture 函数之后调用 + * @list 屏幕共享 + */ + + virtual int sendScreenCaptureExtensionMessage(const char* message, size_t size) = 0; + /** + * + * @hidden(macOS,Windows,Android,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 开启本地屏幕共享数据采集 + * @param type 屏幕共享数据采集类型 + * @param bundle_id 传入 Broadcast Upload Extension 的 Bundle Id,用于在设置中优先展示 Extension + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 当从 iOS 控制中心异常启动 Extension 时可以不用调用本函数
    + * 本地用户会收到 onMediaDeviceStateChanged 的回调。
    + * 参数 device_state 值为 ByteRTCMediaDeviceStateStarted,device_error 值为 ByteRTCMediaDeviceErrorOK + * @list 屏幕共享 + */ + + virtual int startScreenCapture(ScreenMediaType type, const char* bundle_id) = 0; + /** + * + * @hidden(macOS,Windows,iOS,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过传入的 Type 和 Context 开启屏幕音视频内部采集。 + * @param type 指定的屏幕媒体采集类型,参看 ScreenMediaType{@link #ScreenMediaType} + * @param context Android 平台传入 Intent 对象,由业务方申请系统录屏权限后获得。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 采集后,你还需要调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 或 publishStreamVideo{@link #IRTCRoom#publishStreamVideo} 将采集到的屏幕音视频推送到远端。 + * - 开启屏幕音视频内部采集,Android 专用接口。 + * @list 屏幕共享 + */ + + virtual int startScreenCapture(ScreenMediaType type, void* context) = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地屏幕共享数据采集 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 屏幕共享 + */ + + virtual int stopScreenCapture() = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @region 转推直播 + * @brief 推送客户端合流外部视频帧。
    + * @param uid
    + * 外部视频帧对应的合流布局中的uid + * @param frame
    + * 用于合流的外部视频帧 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + virtual int pushClientMixedStreamExternalVideoFrame(const char* uid, const VideoFrameData& frame) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief 设置转推直播观察者。 + * @param observer + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + + virtual int setClientMixedStreamObserver(IClientMixedStreamObserver* observer) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief 客户端合流转推 CDN。 + * @param task_id 任务 ID。 + * @param config 合流转推 CDN 任务配置。 + * @param extra_config + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list Pushing Streams to CDN + */ + + virtual int startClientMixedStream(const char* task_id, IMixedStreamConfig* config, ClientMixedStreamConfig extra_config) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief + * @param task_id + * @param config + * @param extra_config + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + + virtual int updateClientMixedStream(const char* task_id, IMixedStreamConfig* config, ClientMixedStreamConfig extra_config) = 0; + /** + * + * @hidden for internal use only on Windows + * @type api + * @hiddensdk(audiosdk) + * @brief + * @param task_id + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + + virtual int stopClientMixedStream(const char* task_id) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该接口替代了 `startPushMixedStreamToCDN` 和 `startPushPublicStream` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 指定房间中的媒体流,合成后一路流发布到 CDN 或发布一路 WTN 流。 + * @param task_id 转推直播任务 ID,长度不超过 127 字节。 当 IMixedStreamConfig{@link #IMixedStreamConfig} 中的 `PushTargetType = 0` 时, 用于标识转推直播任务。你可以在同一房间内发起多个转推直播任务,并用不同的 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 + * 当 `PushTargetType = 1` 时,设置无效,传空即可。 + * @param push_target_config 推流目标配置参数,比如设置推流地址、WTN 流 ID。参看 MixedStreamPushTargetConfig{@link #MixedStreamPushTargetConfig}。 + * @param config 合流转推配置参数,比如设置合流的图片、视频视图布局和音频属性。参看 IMixedStreamConfig{@link #IMixedStreamConfig}。 + * @return + * - 0: 成功。你可以通过 onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent} 回调获取启动结果和推流过程中的事件。 + * - !0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 在[控制台](https: + * - 调用 stopPushMixedStream{@link #IRTCEngine#stopPushMixedStream} 可以停止转推任务。 + * - 调用 updatePushMixedStream{@link #IRTCEngine#updatePushMixedStream} 可以更新部分任务参数。 + * @list CDN 推流 + */ + + virtual int startPushMixedStream(const char* task_id, MixedStreamPushTargetConfig push_target_config, IMixedStreamConfig* config) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该接口替代了 `updatePushMixedStreamToCDN` 和 `updatePublicStreamParam` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 更新由 startPushMixedStream{@link #IRTCEngine#startPushMixedStream} 启动的任务参数,会收到 onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent} 回调。 + * @param task_id 转推直播任务 ID。指定想要更新参数设置的转推直播任务。仅当 IMixedStreamConfig{@link #IMixedStreamConfig} 中的 `PushTargetType = 0` 时有效。 + * @param push_target_config 推流目标配置参数,比如设置推流地址、WTN 流 ID。参看 MixedStreamPushTargetConfig{@link #MixedStreamPushTargetConfig}。 + * @param config 转推直播配置参数,参看 IMixedStreamConfig{@link #IMixedStreamConfig}。除特殊说明外,均支持过程中更新。
    + * 调用时,结构体中没有传入值的属性,会被更新为默认值。 + * @return + * - 0: 成功。 + * - !0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + */ + + virtual int updatePushMixedStream(const char* task_id, MixedStreamPushTargetConfig push_target_config, IMixedStreamConfig* config) = 0; + /** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN` 方法来停止合流转推任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @hidden(Linux) + * @hiddensdk(audiosdk) + * @brief 停止由 startPushMixedStream{@link #IRTCEngine#startPushMixedStream} 启动的任务。 + * @param task_id 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 + * @param target_type 参看 MixedStreamPushTargetType{@link #MixedStreamPushTargetType}。 + * @return + * - 0: 成功 + * - !0: 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + */ + + virtual int stopPushMixedStream(const char* task_id, MixedStreamPushTargetType target_type) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自版本 3.60 起,该接口取代了 `startPushSingleStreamToCDN` 方法。如果您已升级到版本 3.60 或更高版本,且仍在使用此方法,请迁移到该接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 将房间内某一路音视频流,推送到指定的 RTC 房间或 CDN 地址。此过程不涉及编解码。 + * @param task_id 任务 ID。
    + * 你可以发起多个单流转推任务,并用不同的任务 ID 加以区分。当你需要发起多个单流转推任务时,应使用多个 ID;当你仅需发起一个单流转推任务时,建议使用空字符串。 + * @param param 单流转推配置参数。详见 PushSingleStreamParam{@link #PushSingleStreamParam}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 在调用该接口前,你需要在[控制台](https: + * - 调用该方法后,关于启动结果和推流过程中的错误,会收到 onSingleStreamEvent{@link #IRTCEngineEventHandler#onSingleStreamEvent} 回调。 + * - 在[控制台](https: + * - 调用 stopPushSingleStream{@link #IRTCEngine#stopPushSingleStream} 停止任务。 + * - 由于本功能不进行编解码,所以推到 RTMP 的视频流会根据推流端的分辨率、编码方式、关闭摄像头等变化而变化。 + * @list CDN 推流 + */ + + virtual int startPushSingleStream(const char* task_id, PushSingleStreamParam& param) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN` 方法来停止单流转推直播任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止由 startPushSingleStream{@link #IRTCEngine#startPushSingleStream} 启动的单流转推任务。 + * @param task_id 任务 ID。可以指定想要停止的单流转推任务。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + */ + + virtual int stopPushSingleStream(const char* task_id) = 0; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 开启缓存同步功能。开启后,会缓存收到的实时音视频数据,并对齐不同数据中的时间戳完成同步。此功能会影响音视频数据消费的实时性。 + * @param config 参看 ChorusCacheSyncConfig{@link #ChorusCacheSyncConfig}。 + * @param observer 事件和数据观察者,参看 IChorusCacheSyncObserver{@link #IChorusCacheSyncObserver}。 + * @return 查看 ReturnStatus{@link #ReturnStatus}。 + * @note 要关闭缓存同步功能,调用 stopChorusCacheSync{@link #IRTCEngine#stopChorusCacheSync}。 + * @list Pushing Streams to CDN + */ + + virtual int startChorusCacheSync(ChorusCacheSyncConfig * config, IChorusCacheSyncObserver* observer) = 0; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭缓存同步功能。 + * @return 查看 ReturnStatus{@link #ReturnStatus}。 + * @list Pushing Streams to CDN + */ + + virtual int stopChorusCacheSync() = 0; + /** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 更新屏幕采集数据类型 + * @param type 屏幕采集数据类型 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该函数必须在 startScreenCapture 函数之后调用。本地用户会收到 onMediaDeviceStateChanged 的回调。
    + * 参数 device_state 值为 ByteRTCMediaDeviceStateStarted 或 ByteRTCMediaDeviceStateStopped,device_error 值为 ByteRTCMediaDeviceErrorOK。 + * @list 屏幕共享 + */ + + virtual int updateScreenCapture(ScreenMediaType type) = 0; + + /** + * + * @type api + * @brief 启用音频信息提示。开启提示后,你会收到 onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport},onRemoteAudioPropertiesReport{@link #IRTCEngineEventHandler#onRemoteAudioPropertiesReport} 和 onActiveSpeaker{@link #IRTCEngineEventHandler#onActiveSpeaker}。 + * @param config 详见 AudioPropertiesConfig{@link #AudioPropertiesConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enableAudioPropertiesReport(const AudioPropertiesConfig& config) = 0; + + /** + * + * @type api + * @hidden 3.60 for internal use only + * @brief Enable audio voice detection. After that, you will receive onAudioVADStateUpdate{@link #IRTCEngineEventHandler#onAudioVADStateUpdate}. + * @param interval 回调间隔,单位毫秒。
    + * + `<= 0`: 关闭人声识别能力回调。 + * + `[100, 3000]`: 开启人声识别能力回调,并将信息提示间隔设置为此值。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enableAudioVADReport(int interval) = 0; + /** + * + * @hidden 3.60 for internal use only + * @type api + * @brief Enable audio music detection. After that, you will receive onAudioAEDStateUpdate{@link #IRTCEngineEventHandler#onAudioAEDStateUpdate}. + * @param interval 回调间隔,单位毫秒。
    + * + `<= 0`: 关闭回调。 + * + `[100, 3000]`: 开启回调并将信息提示间隔设置为此值。推荐设置为 2000。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enableAudioAEDReport(int interval) = 0; + + /** + * + * @type api + * @brief 调节本端播放收到的远端流时的音量。你必须在进房后进行设置。流的发布状态改变不影响设置生效。 + * @param stream_id 流标识 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内:
    + * - 当该方法与 setRemoteRoomAudioPlaybackVolume{@link #IRTCRoom#setRemoteRoomAudioPlaybackVolume} 共同使用时,本地收听用户 A 的音量为后调用的方法设置的音量; + * - 当该方法与 setPlaybackVolume{@link #IRTCEngine#setPlaybackVolume} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * - 当你调用该方法设置远端流音量后,如果远端退房,接口设置失效。 + * @list 音频管理 + */ + + virtual int setRemoteAudioPlaybackVolume(const char* stream_id, int volume) = 0; + /** + * + * @type api + * @brief 开启/关闭音量均衡功能。
    + * 开启音量均衡功能后,人声的响度会调整为 -16lufs。如果已调用 setAudioMixingLoudness 传入了混音音乐的原始响度,此音乐播放时,响度会调整为 -20lufs。(Linux 不支持) + * @param enable 是否开启音量均衡功能:
    + * - true: 是 + * - false: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该接口须在调用 start{@link #IAudioEffectPlayer#start} 开始播放音频文件之前调用。 + * @list 音频管理 + */ + + virtual int enableVocalInstrumentBalance(bool enable) = 0; + /** + * + * @type api + * @brief 打开/关闭音量闪避功能,适用于在 RTC 通话过程中会同时播放短视频或音乐的场景,如“一起看”等。
    + * 开启该功能后,当检测到远端人声时,RTC 本地的媒体播放音量会自动减弱,从而保证远端人声的清晰可辨;当远端人声消失时,RTC 的本地媒体音量会恢复到闪避前的音量水平。 + * @param enable 是否开启音量闪避:
    + * - true: 是 + * - false: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + + virtual int enablePlaybackDucking(bool enable) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册本地视频帧监测器。
    + * 无论使用内部采集还是自定义采集,调用该方法后,SDK 每监测到一帧本地视频帧时,都会将视频帧信息通过 onLocalEncodedVideoFrame{@link #ILocalEncodedVideoFrameObserver#onLocalEncodedVideoFrame} 回调给用户 + * @param observer 本地视频帧监测器,参看 ILocalEncodedVideoFrameObserver{@link #ILocalEncodedVideoFrameObserver}。将参数设置为 nullptr 则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该方法可在进房前后的任意时间调用,在进房前调用可保证尽可能早地监测视频帧并触发回调 + * @list 自定义流处理 + */ + + virtual int registerLocalEncodedVideoFrameObserver(ILocalEncodedVideoFrameObserver* observer) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册远端编码后视频数据回调。
    + * 完成注册后,当 SDK 监测到远端编码后视频帧时,会触发 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame} 回调 + * @param observer 远端编码后视频数据监测器,参看 IRemoteEncodedVideoFrameObserver{@link #IRemoteEncodedVideoFrameObserver} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 更多自定义解码功能说明参看 [自定义视频编解码](https: + * - 该方法适用于手动订阅,并且进房前后均可调用,建议在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + + virtual int registerRemoteEncodedVideoFrameObserver(IRemoteEncodedVideoFrameObserver* observer) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册自定义编码帧推送事件回调 + * @param encoder_handler 自定义编码帧回调类,参看 IExternalVideoEncoderEventHandler{@link #IExternalVideoEncoderEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法需在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + + virtual int setExternalVideoEncoderEventHandler(IExternalVideoEncoderEventHandler* encoder_handler) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送自定义编码后的视频流 + + * @param video_index 对应的编码流下标,从 0 开始,如果调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 设置了多路流,此处数量须与之保持一致 + * @param video_stream 编码流视频帧信息,参看 IEncodedVideoFrame{@link #IEncodedVideoFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 目前仅支持推送 H264 和 ByteVC1 格式的视频帧,且视频流协议格式须为 Annex B 格式。 + * - 该函数运行在用户调用线程内 + * - 推送自定义编码视频帧前,必须调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 将视频输入源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + + virtual int pushExternalEncodedVideoFrame(int video_index, IEncodedVideoFrame* video_stream) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之前,设置远端视频数据解码方式 + * @param stream_id 远端流 ID,指定对哪一路视频流进行解码方式设置 + * @param config 视频解码方式,参看 VideoDecoderConfig{@link #VideoDecoderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 当你想要对远端流进行自定义解码时,你需要先调用 registerRemoteEncodedVideoFrameObserver{@link #IRTCEngine#registerRemoteEncodedVideoFrameObserver} 注册远端视频流监测器,然后再调用该接口将解码方式设置为自定义解码。监测到的视频数据会通过 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame} 回调出来。 + * - 自 3.56 起,要用于自动订阅场景下,你可以设置 `key` 中的 `RoomId` 和 `UserId` 为 `nullptr`,此时,通过此接口设置的解码方式根据 `key` 中的 `StreamIndex` 值,适用于所有的远端主流或屏幕流的解码方式。 + * @list 自定义流处理 + */ + + virtual int setVideoDecoderConfig(const char* stream_id, VideoDecoderConfig config) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之后,向远端请求关键帧 + * @param stream_id 远端流 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅适用于手动订阅模式,并且在成功订阅远端流之后使用。 + * - 该方法适用于调用 setVideoDecoderConfig{@link #IRTCEngine#setVideoDecoderConfig} 开启自定义解码功能后,并且自定义解码失败的情况下使用 + * @list 音视频传输 + */ + + virtual int requestRemoteVideoKeyFrame(const char* stream_id) = 0; + /** + * + * @type api + * @brief 发送音频流同步信息。将消息通过音频流发送到远端,并实现与音频流同步,该接口调用成功后,远端用户会收到 onStreamSyncInfoReceived{@link #IRTCEngineEventHandler#onStreamSyncInfoReceived} 回调。 + * @param data 消息内容。 + * @param length 消息长度。取值范围是 [1,255] 字节,建议小于 16 字节,否则可能占用较大带宽。 + * @param config 媒体流信息同步的相关配置,详见 StreamSyncInfoConfig{@link #StreamSyncInfoConfig} 。 + * @return + * - >=0: 消息发送成功。返回成功发送的次数。 + * - -1: 消息发送失败。消息长度大于 255 字节。 + * - -2: 消息发送失败。传入的消息内容为空。 + * - -3: 消息发送失败。通过屏幕流进行消息同步时,此屏幕流还未发布。 + * - -4: 消息发送失败。通过用麦克风或自定义设备采集到的音频流进行消息同步时,此音频流还未发布,详见错误码 ErrorCode{@link #ErrorCode}。 + * @note + * - 调用本接口的频率建议不超过 50 次每秒。 + * - 在 `kRoomProfileTypeInteractivePodcast` 房间模式下,此消息一定会送达。在其他房间模式下,如果本地用户未说话,此消息不一定会送达。 + * @list 消息 + */ + + virtual int sendStreamSyncInfo(const uint8_t* data, int32_t length, const StreamSyncInfoConfig& config) = 0; + /** + * + * @type api + * @brief 开启本地语音变调功能,多用于 K 歌场景。
    + * 使用该方法,你可以对本地语音的音调进行升调或降调等调整。 + * @param pitch 相对于语音原始音调的升高/降低值,取值范围[-12,12],默认值为 0,即不做调整。
    + * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。
    + * 超出取值范围则设置失败,并且会触发 onWarning{@link #IRTCEngineEventHandler#onWarning} 回调,提示 WarningCode{@link #WarningCode} 错误码为 `WARNING_CODE_SET_SCREEN_STREAM_INVALID_VOICE_PITCH` 设置语音音调不合法 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 音频处理 + */ + + virtual int setLocalVoicePitch(int pitch) = 0; + + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在指定视频流上添加水印。 + * @param image_path 水印图片路径,仅支持本地文件绝对路径,长度限制为 512 字节。
    + * 水印图片为 PNG 或 JPG 格式。 + * @param config 水印参数,参看 RTCWatermarkConfig{@link #RTCWatermarkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 clearVideoWatermark{@link #IRTCEngine#clearVideoWatermark} 移除指定视频流的水印。 + * - 同一路流只能设置一个水印,新设置的水印会代替上一次的设置。你可以多次调用本方法来设置不同流的水印。 + * - 若开启本地预览镜像,或开启本地预览和编码传输镜像,则远端水印均不镜像;在开启本地预览水印时,本端水印会镜像。 + * - 开启大小流后,水印对大小流均生效,且针对小流进行等比例缩小。 + * @list 视频处理 + */ + + virtual int setVideoWatermark(const char* image_path, RTCWatermarkConfig config) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 移除指定视频流的水印。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 视频处理 + */ + + virtual int clearVideoWatermark() = 0; + /** + * + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 截取本地视频画面 + * @param callback 本地截图的回调。参看 ISnapshotResultCallback{@link #ISnapshotResultCallback}。 + * @return 本地截图任务的编号,从 `1` 开始递增。 + * @note + * - 对截取的画面,包含本地视频处理的全部效果,包含旋转,镜像,美颜等。 + * - 不管采用 SDK 内部采集,还是自定义采集,都可以进行截图。 + * @list 高级功能 + */ + + virtual long takeLocalSnapshot(ISnapshotResultCallback* callback) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 截取远端视频画面 + * @param stream_id 流标识 + * @param callback 参看 ISnapshotResultCallback{@link #ISnapshotResultCallback}。 + * @return 远端截图任务的编号,从 `1` 开始递增。 + * @list 高级功能 + */ + + virtual long takeRemoteSnapshot(const char* stream_id, ISnapshotResultCallback* callback) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. + * @type api + * @brief 截取远端的视频流画面,生成 JPG 文件,并保存到本地指定路径。
    + * 调用该方法后,SDK 会触发回调 onRemoteSnapshotTakenToFile{@link #IRTCEngineEventHandler#onRemoteSnapshotTakenToFile} 报告截图是否成功,以及截取的图片信息。 + * @param stream_id 待截取的远端视频流 ID。 + * @param file_path 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。以 Windows 为例:`C:\\Users\\YourName\\Pictures\\snapshot.jpg`。 + * @return 远端截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + + virtual long takeRemoteSnapshotToFile(const char* stream_id, const char* file_path) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.60. + * @type api + * @brief 截取本地视频流画面,生成 JPG 文件,并保存到本地指定路径。
    + * 调用该方法后,SDK 会触发回调 onLocalSnapshotTakenToFile{@link #IRTCEngineEventHandler#onLocalSnapshotTakenToFile} 报告截图是否成功,以及截取的图片信息。 + * @param file_path 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。以 Windows 为例:`C:\\Users\\YourName\\Pictures\\snapshot.jpg`。 + * @return 远端截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + + virtual long takeLocalSnapshotToFile(const char* file_path) = 0; + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 摄像头处于关闭状态时,使用静态图片填充本地推送的视频流。
    + * 调用 `stopVideoCapture` 接口时,会开始推静态图片。若要停止发送图片,可传入空字符串或启用内部摄像头采集。
    + * 可重复调用该接口来更新图片。 + * @param file_path 设置静态图片的路径。
    + * 支持本地文件绝对路径,不支持网络链接,长度限制为 512 字节。
    + * 静态图片支持类型为 JPEG/JPG、PNG、BMP。
    + * 若图片宽高比与设置的编码宽高比不一致,图片会按编码高宽等比缩放,并裁剪长边。推流帧率与码率与设置的编码参数一致。 + * @return + * - 0: 成功。 + * - -2: 失败。确保传入的 file_path 为有效路径。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 该接口只适用于 SDK 内部摄像头采集,不适用于自定义视频采集。 + * - 本地预览无法看到静态图片。 + * - 进入房间前后均可调用此方法。在多房间场景中,静态图片仅在发布的房间中生效。 + * - 针对该静态图片,滤镜和镜像效果不生效,水印效果生效。 + * - 只有主流能设置静态图片,屏幕流不支持设置。 + * - 开启大小流后,静态图片对大小流均生效,且针对小流进行等比例缩小。 + * @list 音视频传输 + */ + + virtual int setDummyCaptureImagePath(const char* file_path) = 0; + /** + * + * @type api + * @brief 开启云代理 + * @param configuration 云代理服务器信息列表。参看 CloudProxyConfiguration{@link #CloudProxyConfiguration}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 在加入房间前调用此接口 + * - 在开启云代理后,进行通话前网络探测 + * - 开启云代理后,并成功连接云代理服务器后,会收到 onCloudProxyConnected{@link #IRTCEngineEventHandler#onCloudProxyConnected}。 + * - 要关闭云代理,调用 stopCloudProxy{@link #IRTCEngine#stopCloudProxy}。 + * @list 通话加密 + */ + + virtual int startCloudProxy(const CloudProxyConfiguration& configuration) = 0; + /** + * + * @type api + * @brief 关闭云代理 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 要开启云代理,调用 startCloudProxy{@link #IRTCEngine#startCloudProxy}。 + * @list 通话加密 + */ + + virtual int stopCloudProxy() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启音视频回路测试。
    + * 在进房前,用户可调用该接口对音视频通话全链路进行检测,包括对音视频设备以及用户上下行网络的检测,从而帮助用户判断是否可以正常发布和接收音视频流。
    + * 开始检测后,SDK 会录制你的声音或视频。如果你在设置的延时范围内收到了回放,则视为音视频回路测试正常。 + * @param echo_test_config 回路测试参数设置,参看 EchoTestConfig{@link #EchoTestConfig}。 + * @param play_delay_time 音视频延迟播放的时间间隔,用于指定在开始检测多长时间后期望收到回放。取值范围为 [2,10],单位为秒,默认为 2 秒。 + * @return 方法调用结果:
    + * - 0:成功 + * - -2:失败,参数异常 + * - -4:失败,用户已进房 + * - -6:失败,当前用户已经在检测中 + * - -7:失败,音视频均不检查 + * - -8:失败,已经存在相同 roomId 的房间 + * @note + * - 调用该方法开始音视频回路检测后,你可以调用 stopEchoTest{@link #IRTCEngine#stopEchoTest} 立即结束测试,也可等待测试 60s 后自动结束,以更换设备进行下一次测试,或进房。 + * - 在该方法之前调用的所有跟设备控制、流控制相关的方法均在开始检测时失效,在结束检测后恢复生效。 + * - 在调用 startEchoTest{@link #IRTCEngine#startEchoTest} 和 stopEchoTest{@link #IRTCEngine#stopEchoTest} 之间调用的所有跟设备采集、流控制、进房相关的方法均不生效,并会收到 onWarning{@link #IRTCEngineEventHandler#onWarning} 回调,提示警告码为 `kWarningCodeInEchoTestMode`。 + * - 音视频回路检测的结果会通过 onEchoTestResult{@link #IRTCEngineEventHandler#onEchoTestResult} 回调通知。 + * @list 网络管理 + */ + + virtual int startEchoTest(EchoTestConfig echo_test_config, unsigned int play_delay_time) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 停止音视频回路测试。
    + * 调用 startEchoTest{@link #IRTCEngine#startEchoTest} 开启音视频回路检测后,你必须调用该方法停止检测。 + * @return 方法调用结果:
    + * - 0:成功。 + * - -3:失败,未开启回路检测。 + * @note 音视频回路检测结束后,所有对系统设备及音视频流的控制均会恢复到开始检测前的状态。 + * @list 网络管理 + */ + + virtual int stopEchoTest() = 0; + /** + * + * @hidden + * @type api + * @brief 创建 K 歌评分管理接口。 + * @return K 歌评分管理接口,详见 ISingScoringManager{@link #ISingScoringManager#ISingScoringManager}。 + * @note 如需使用 K 歌评分功能,即调用该方法以及 `ISingScoringManager` 类下全部方法,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * @list 在线 KTV + */ + + virtual ISingScoringManager* getSingScoringManager() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 通过 NTP 协议,获取网络时间。 + * @return 网络时间。参看 NetworkTimeInfo{@link #NetworkTimeInfo}。 + * @note + * 第一次调用此接口会启动网络时间同步功能,并返回 `0`。同步完成后,会收到 onNetworkTimeSynchronized{@link #IRTCEngineEventHandler#onNetworkTimeSynchronized},此后,再次调用此 API,即可获取准确的网络时间。 + * @list 网络管理 + */ + + virtual NetworkTimeInfo getNetworkTimeInfo() = 0; + /** + * + * @hidden currently not available + * @type api + * @brief 创建 KTV 管理接口。 + * @return KTV 管理接口,参看 IKTVManager{@link #IKTVManager}。 + * @list 在线 KTV + */ + + virtual IKTVManager* getKTVManager() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开启通话前回声检测 + * @param test_audio_file_path 用于回声检测的音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。
    + * 音频文件不为静音文件,推荐时长为 10 ~ 20 秒。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败。上一次检测未结束,请先调用 stopHardwareEchoDetection{@link #IRTCEngine#stopHardwareEchoDetection} 停止检测 后重新调用本接口。 + * - -2:失败。路径不合法或音频文件格式不支持。 + * @note + * - 只有当 RoomProfileType{@link #RoomProfileType} 为 `kRoomProfileTypeMeeting` 和 `kRoomProfileTypeMeetingRoom` 时支持开启本功能。 + * - 开启检测前,你需要向用户获取音频设备的使用权限。 + * - 开启检测前,请确保音频设备没有被静音,采集和播放音量正常。 + * - 调用本接口后监听 onHardwareEchoDetectionResult{@link #IRTCEngineEventHandler#onHardwareEchoDetectionResult} 获取检测结果。 + * - 检测期间,进程将独占音频设备,无法使用其他音频设备测试接口 startEchoTest{@link #IRTCEngine#startEchoTest}。 + * - 调用 stopHardwareEchoDetection{@link #IRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * @list 音频管理 + */ + + virtual int startHardwareEchoDetection(const char* test_audio_file_path) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 停止通话前回声检测 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败。 + * @note + * - 关于开启通话前回声检测,参看 startHardwareEchoDetection{@link #IRTCEngine#startHardwareEchoDetection} 。 + * - 建议在收到 onHardwareEchoDetectionResult{@link #IRTCEngineEventHandler#onHardwareEchoDetectionResult} 通知的检测结果后,调用本接口停止检测。 + * - 在用户进入房间前结束回声检测,释放对音频设备的占用,以免影响正常通话。 + * @list 音频管理 + */ + + virtual int stopHardwareEchoDetection() = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 启用蜂窝网络辅助增强,改善通话质量。 + * @param config 参看 MediaTypeEnhancementConfig{@link #MediaTypeEnhancementConfig}。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败,内部错误。 + * - -2: 失败,输入参数错误。 + * @note 此功能默认不开启。 + * @list Audio Management + */ + + virtual int setCellularEnhancement(const MediaTypeEnhancementConfig& config) = 0; + /** + * + * @type api + * @brief 设置本地代理。 + * @param configurations 本地代理配置参数。参看 LocalProxyConfiguration{@link #LocalProxyConfiguration}。
    + * 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。
    + * 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 + * @param configuration_num 本地代理配置参数的数量。 + * @note + * - 该方法需要在进房前调用。 + * - 调用该方法设置本地代理后,SDK 会触发 onLocalProxyStateChanged{@link #IRTCEngineEventHandler#onLocalProxyStateChanged} ,返回代理连接的状态。 + * @list 通话加密 + */ + + virtual int setLocalProxy(const LocalProxyConfiguration* configurations, int configuration_num) = 0; + /** + * + * @hidden(Android,iOS) + * @valid since 3.57 + * @type api + * @brief 设置视频暗光增强模式。
    + * 对于光线不足、照明不均匀或背光等场景下推荐开启,可有效改善画面质量。 + * @param mode 默认不开启。参看 VideoEnhancementMode{@link #VideoEnhancementMode}。 + * @return + * - 0: API 调用成功。会立即生效,但需要等待下载和检测完成后才能看到增强后的效果。 + * - < 0: API 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 开启后会影响设备性能,应根据实际需求和设备性能决定是否开启。 + * - 对 RTC SDK 内部采集的视频和自定义采集的视频都生效。 + * @list 视频处理 + */ + + virtual int setLowLightAdjusted(VideoEnhancementMode mode) = 0; + + /** + * + * @valid since 3.60 + * @type api + * @brief 获取 WTN 流对象。
    + * 你可以通过此方法获取 WTN 流对象,以实现自定义的视频渲染和处理。
    + * 调用此方法后,可以通过调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream} 或 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 订阅指定的 WTN 流。
    + * 如需发布 WTN 流,调用 startPushMixedStream{@link #IRTCEngine#startPushMixedStream}。 + * @return WTN 流对象。参看 IWTNStream{@link #IWTNStream}。 + * @list WTN + */ + + virtual IWTNStream* getWTNStream() = 0; + + /** + * + * @type api + * @brief 创建 IRTCEngine 实例。
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param event_handler SDK 回调给应用层的 Handler,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} + * @return + * - IRTCEngine:创建成功。返回一个可用的 IRTCEngine{@link #IRTCEngine} 实例 + * - Null:app_id 或者 event_handler 为空, event_handler 为空。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API IRTCEngine* createRTCEngine(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + /** + * + * @hidden internal use only + * @type api + * @brief 创建多实例引擎对象
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新创建的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param handler SDK 回调给应用层的 Handler,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} + * @return + * - RTCEngine:创建成功。返回一个可用的 IRTCEngine{@link #IRTCEngine} 实例 + * - Null:.so 文件加载失败,创建失败。 + * @note 你应注意保持 handler 的生命周期必须大于 IRTCEngine{@link #IRTCEngine} 的生命周期,即 handler 必须在调用 destroyRTCEngine{@link #IRTCEngine#destroyRTCEngine} 之后销毁。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API IRTCEngine* createRTCEngineMulti(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + /** + * + * @type api + * @brief 销毁由 createRTCEngine{@link #IRTCEngine#createRTCEngine} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 IRTCEngine{@link #IRTCEngine} 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 IRTCEngine{@link #IRTCEngine} 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 IRTCEngine{@link #IRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互。 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API void destroyRTCEngine(); + /** + * + * @hidden internal use only + * @type api + * @brief 销毁由 createRTCEngineMulti{@link #IRTCEngine#createRTCEngineMulti} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 IRTCEngine{@link #IRTCEngine} 实例相关的业务场景全部结束后,才调用此方法 + * - 该方法在调用之后,会销毁所有和此 IRTCEngine{@link #IRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API void destroyRTCEngineMulti(IRTCEngine* instance_multi); + /** + * + * @type api + * @brief 获取当前 SDK 版本信息。 + * @return 当前 SDK 版本信息。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API const char* getSDKVersion(); + /** + * + * @type api + * @brief 配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。 + * @param log_config 本地日志参数,参看 LogConfig{@link #LogConfig}。 + * @return + * - 0:成功。 + * - –1:失败,本方法必须在创建引擎前调用。 + * - –2:失败,参数填写错误。 + * @note 本方法必须在调用 createRTCEngine{@link #IRTCEngine#createRTCEngine} 之前调用。 + * @list 引擎管理 + */ + + static BYTERTC_STATIC_API int setLogConfig(const LogConfig& log_config); +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine_event_handler.h new file mode 100644 index 0000000..a80a1d3 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine_event_handler.h @@ -0,0 +1,1292 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Event Handler Lite +*/ + +#pragma once + +#include "rtc/bytertc_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @hidden + * @brief 该接口为预留接口,还未实现。 + */ + +class IVideoSource; +/** + * + * @type keytype + * @hidden + * @brief 该接口为预留接口,还未实现。 + */ + +class IAudioSource; +/** + * + * @type callback + * @brief 音视频引擎事件回调接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +class IRTCEngineEventHandler { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRTCEngineEventHandler() { + } + /** + * + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。
    + * 你可能需要干预。 + * @param warn 警告标识码,详见:WarningCode{@link #WarningCode} + * @list 引擎管理 + */ + + virtual void onWarning(int warn) { + (void)warn; + } + /** + * + * @type callback + * @brief 发生错误回调。
    + * SDK 运行时出现了网络或媒体相关的错误,且无法自动恢复时触发此回调。 + * @param err 错误标识码,参看 ErrorCode{@link #ErrorCode} + * @list 引擎管理 + */ + + virtual void onError(int err) { + (void)err; + } + /** + * + * @hidden internal use only + * @valid since 3.57 + * @type callback + * @brief 当内部线程发生 block 时,将收到此回调。 + * @param msg block 线程的线程名和 block 检测次数。参看 DeadLockMsg{#DeadLockMsg}。 + * @list Engine Management + */ + + virtual void onDeadLockError(const DeadLockMsg& msg) { + (void)msg; + } + /** + * + * @valid since 3.52 + * @type callback + * @brief 当访问插件失败时,收到此回调。
    + * RTC SDK 将一些功能封装成插件。当使用这些功能时,如果插件不存在,功能将无法使用。 + * @param extension_name 插件名字 + * @param msg 失败说明 + * @list 高级功能 + */ + + virtual void onExtensionAccessError(const char* extension_name, const char* msg) { + + } + /** + * + * @type callback + * @deprecated since 3.54, use onMediaPlayerPlayingProgress{@link #IMediaPlayerEventHandler#onMediaPlayerPlayingProgress} instead. + * @brief 混音音频文件播放进度回调 + * @param mix_id 混音 ID + * @param progress 当前混音音频文件播放进度,单位毫秒 + * @note 调用 setAudioMixingProgressInterval 将时间间隔设为大于 0 的值后,或调用 startAudioMixing 将 AudioMixingConfig 中的时间间隔设为大于 0 的值后,SDK 会按照设置的时间间隔回调该事件。 + * @list 混音 + */ + + virtual void onAudioMixingPlayingProgress(int mix_id, int64_t progress) { + } + /** + * + * @type callback + * @brief 上报日志时回调该事件。 + * @param log_type
    + * 事件类型。目前类型固定为 "live_webrtc_monitor_log"。 + * @param log_content
    + * 端监控日志内容。 + * @list 引擎管理 + */ + + virtual void onLogReport(const char* log_type, const char* log_content) { + (void)log_type; + (void)log_content; + } + /** + * + * @hidden(macOS,Windows,Linux) + * @type callback + * @brief 音频播放设备变化时回调该事件。 + * @param device 变化后的音频播放设备,参看 AudioRoute{@link #AudioRoute}。 + * @list 音频管理 + */ + + virtual void onAudioRouteChanged(AudioRoute route) { + (void)route; + }; + /** + * + * @type callback + * @brief SDK 与信令服务器连接状态改变回调。连接状态改变时触发。 + * @param state 当前 SDK 与信令服务器的连接状态,详见 ConnectionState{@link #ConnectionState}。 + * @note 更多信息参见 [连接状态提示](https: + * @list 网络管理 + */ + + virtual void onConnectionStateChanged(bytertc::ConnectionState state) { + } + /** + * + * @type callback + * @brief SDK 当前网络连接类型改变回调。当 SDK 的当前网络连接类型发生改变时回调该事件。 + * @param type
    + * SDK 当前的网络连接类型,详见:NetworkType{@link #NetworkType} 。 + * @list 网络管理 + */ + + virtual void onNetworkTypeChanged(bytertc::NetworkType type) { + } + /** + * + * @type callback + * @brief 音视频流因网络环境变化等原因发生回退,或从回退中恢复时,触发该回调。 + * @param stream_id 流 ID + * @param stream_info 流信息, 参看 StreamInfo{@link #StreamInfo}。 + * @param event 音视频流发生变化的信息。参看 RemoteStreamSwitch{@link #RemoteStreamSwitch}。 + * @list 网络管理 + */ + + virtual void onSimulcastSubscribeFallback(const char* stream_id, const StreamInfo& stream_info, const bytertc::RemoteStreamSwitch& event) { + (void)stream_id; + (void)stream_info; + (void)event; + } + /** + * + * @type callback + * @brief 本地未通过 setPublishFallbackOption{@link #IRTCEngine#setPublishFallbackOption} 开启发布性能回退,检测到设备性能不足时,收到此回调。
    + * 本地通过 setPublishFallbackOption{@link #IRTCEngine#setPublishFallbackOption} 开启发布性能回退,因设备性能/网络原因,造成发布性能回退/恢复时,收到此回调。 + * @param stream_id 流 ID + * @param stream_info 流信息,参看 StreamInfo{@link #StreamInfo} + * @param mode 指示本地是否开启发布性能回退功能。参看 PerformanceAlarmMode{@link #PerformanceAlarmMode}
    + * - 当发布端未开启发布性能回退时,mode 值为 kPerformanceAlarmModeNormal。 + * - 当发布端开启发布性能回退时,mode 值为 kPerformanceAlarmModeSimulcast。 + * @param room_id 房间 ID
    + * - 未开启发布性能回退时,room_id 为空。 + * - 开启发布性能回退时,room_id 是告警影响的房间 ID。 + * @param reason 告警原因,参看 PerformanceAlarmReason{@link #PerformanceAlarmReason} + * @param data 性能回退相关数据,详见 SourceWantedData{@link #SourceWantedData}。 + * @list 网络管理 + */ + + virtual void onPerformanceAlarms(const char* stream_id, const StreamInfo& stream_info, bytertc::PerformanceAlarmMode mode, + bytertc::PerformanceAlarmReason reason, const bytertc::SourceWantedData& data) { + (void)stream_id; + (void)stream_info; + (void)mode; + (void)reason; + (void)data; + } + /** + * + * @type callback + * @brief 音频设备状态回调。提示音频采集、音频播放等设备的状态。 + * @param device_id 设备 ID。 + * @param device_type 设备类型,详见 RTCAudioDeviceType{@link #RTCAudioDeviceType} + * @param device_state 设备状态,详见 MediaDeviceState{@link #MediaDeviceState} + * @param device_error 设备错误类型,详见 MediaDeviceError{@link #MediaDeviceError} + * @list 音频管理 + */ + + virtual void onAudioDeviceStateChanged(const char* device_id, bytertc::RTCAudioDeviceType device_type, + bytertc::MediaDeviceState device_state, bytertc::MediaDeviceError device_error) { + (void)device_id; + (void)device_type; + (void)device_state; + (void)device_error; + } + /** + * + * @type callback + * @brief 视频设备状态回调。提示摄像头视频采集、屏幕视频采集等设备的状态。 + * @param device_id 设备 ID。采集屏幕共享流时,设备 ID 为固定字符串 `screen_capture_video` + * @param device_type 设备类型,详见 RTCVideoDeviceType{@link #RTCVideoDeviceType} + * @param device_state 设备状态,详见 MediaDeviceState{@link #MediaDeviceState} + * @param device_error 设备错误类型,详见 MediaDeviceError{@link #MediaDeviceError} + * @list 视频管理 + */ + + virtual void onVideoDeviceStateChanged(const char* device_id, bytertc::RTCVideoDeviceType device_type, + bytertc::MediaDeviceState device_state, bytertc::MediaDeviceError device_error) { + (void)device_id; + (void)device_type; + (void)device_state; + (void)device_error; + } + /** + * + * @type callback + * @brief 音频设备警告回调。音频设备包括音频采集设备和音频渲染设备。 + * @param device_id 设备 ID + * @param device_type 详见 RTCAudioDeviceType{@link #RTCAudioDeviceType} + * @param device_warning 详见 MediaDeviceWarning{@link #MediaDeviceWarning} + * @list 音频管理 + */ + + virtual void onAudioDeviceWarning(const char* device_id, bytertc::RTCAudioDeviceType device_type, + bytertc::MediaDeviceWarning device_warning) { + (void)device_id; + (void)device_type; + (void)device_warning; + } + /** + * + * @type callback + * @brief 视频设备警告回调,包括视频采集设备等。 + * @param device_id 设备 ID + * @param device_type 详见 RTCVideoDeviceType{@link #RTCVideoDeviceType} + * @param device_warning 详见 MediaDeviceWarning{@link #MediaDeviceWarning} + * @list 视频管理 + */ + + virtual void onVideoDeviceWarning(const char* device_id, bytertc::RTCVideoDeviceType device_type, + bytertc::MediaDeviceWarning device_warning) { + (void)device_id; + (void)device_type; + (void)device_warning; + } + /** + * + * @type callback + * @brief 周期性(2s)发出回调,报告当前 CPU 与内存的相关信息。 + * @param stats 包含当前 CPU 与内存相关信息的结构体。详见 SysStats{@link #SysStats}。 + * @list 引擎管理 + */ + + virtual void onSysStats(const bytertc::SysStats& stats) { + } + /** + * + * @type callback + * @brief 获取本地录制状态回调。
    + * 该回调由 startFileRecording{@link #IRTCEngine#startFileRecording} 或 stopFileRecording{@link #IRTCEngine#stopFileRecording} 触发。 + * @param video_source 预留参数 + * @param state 录制状态,参看 RecordingState{@link #RecordingState} + * @param error_code 录制错误码,参看 RecordingErrorCode{@link #RecordingErrorCode} + * @param info 录制文件的详细信息,参看 RecordingInfo{@link #RecordingInfo} + * @list 高级功能 + */ + + virtual void onRecordingStateUpdate( + IVideoSource* video_source, RecordingState state, RecordingErrorCode error_code, RecordingInfo info) { + } + /** + * + * @type callback + * @brief 本地录制进度回调。
    + * 该回调由 startFileRecording{@link #IRTCEngine#startFileRecording} 触发,录制状态正常时,系统每秒钟都会通过该回调提示录制进度。 + * @param video_source 预留参数。 + * @param process 录制进度,参看 RecordingProgress{@link #RecordingProgress} + * @param info 录制文件的详细信息,参看 RecordingInfo{@link #RecordingInfo} + * @list 高级功能 + */ + + virtual void onRecordingProgressUpdate(IVideoSource* video_source, RecordingProgress process, RecordingInfo info) { + } + /** + * + * @type callback + * @brief 调用 startAudioRecording{@link #IRTCEngine#startAudioRecording} 或 stopAudioRecording{@link #IRTCEngine#stopAudioRecording} 改变音频文件录制状态时,收到此回调。 + * @param state 录制状态,参看 AudioRecordingState{@link #AudioRecordingState} + * @param error_code 录制错误码,参看 AudioRecordingErrorCode{@link #AudioRecordingErrorCode} + * @list 高级功能 + */ + + virtual void onAudioRecordingStateUpdate(AudioRecordingState state, AudioRecordingErrorCode error_code) { + } + /** + * + * @type callback + * @brief 登录结果回调 + * @param uid
    + * 登录用户 ID + * @param error_code
    + * 登录结果
    + * 详见 LoginErrorCode{@link #LoginErrorCode}。 + * @param elapsed
    + * 从调用 login{@link #IRTCEngine#login} 接口开始到返回结果所用时长
    + * 单位为 ms。 + * @note 调用 login{@link #IRTCEngine#login} 后,会收到此回调。 + * @list 消息 + */ + + virtual void onLoginResult(const char* uid, int error_code, int elapsed) { + (void)uid; + (void)error_code; + (void)elapsed; + } + /** + * + * @type callback + * @brief 登出结果回调 + * @param reason 用户登出的原因,参看 LogoutReason{@link #LogoutReason} + * @note 在以下两种情况下会收到此回调:调用 logout{@link #IRTCEngine#logout} 接口主动退出;或其他用户以相同 UserId 进行 `login` 导致本地用户被动登出。 + * @list 消息 + */ + + virtual void onLogout(LogoutReason reason) { + } + /** + * + * @type callback + * @brief 设置应用服务器参数的返回结果 + * @param error
    + * 设置结果
    + * - 返回 200,设置成功 + * - 返回其他,设置失败,详见 UserMessageSendResult{@link #UserMessageSendResult} + * @note 调用 setServerParams{@link #IRTCEngine#setServerParams} 后,会收到此回调。 + * @list 消息 + */ + + virtual void onServerParamsSetResult(int error) { + (void)error; + } + /** + * + * @type callback + * @brief 查询对端或本端用户登录状态的返回结果 + * @param peer_user_id
    + * 需要查询的用户 ID + * @param status
    + * 查询的用户登录状态
    + * 详见 UserOnlineStatus{@link #UserOnlineStatus}. + * @note 必须先调用 getPeerOnlineStatus{@link #IRTCEngine#getPeerOnlineStatus},才能收到此回调。 + * @list 消息 + */ + + virtual void onGetPeerOnlineStatus(const char* peer_user_id, int status) { + (void)peer_user_id; + (void)status; + } + /** + * + * @type callback + * @brief > 该接口将于 3.64 版本废弃,请使用 onUserMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserMessageReceivedOutsideRoom-2} 代替。 + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 发来的文本消息时,会收到此回调。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + + virtual void onUserMessageReceivedOutsideRoom(const char* uid, const char* message) { + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserBinaryMessageReceivedOutsideRoom{@link #IRTCEngineEventHandler#onUserBinaryMessageReceivedOutsideRoom-2} 代替。 + * @brief 收到房间外用户调用 sendUserBinaryMessageOutsideRoom{@link #IRTCEngine#sendUserBinaryMessageOutsideRoom} 发来的二进制消息时,会收到此回调 + * @param uid 消息发送者 ID。 + * @param size 收到的二进制消息长度。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceivedOutsideRoom(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + /** + * + * @type callback + * @brief 给房间外指定的用户发送消息的结果回调。
    + * 当调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 或 sendUserBinaryMessageOutsideRoom{@link #IRTCEngine#sendUserBinaryMessageOutsideRoom} 发送消息后,会收到此回调。 + * @param msgid 本条消息的 ID。
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果。详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @list 消息 + */ + + virtual void onUserMessageSendResultOutsideRoom(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + /** + * + * @type callback + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom{@link #IRTCEngine#sendUserMessageOutsideRoom} 发来的文本消息时,会收到此回调。 + * @param msgid 收到的文本消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息的内容。 + * @list 消息 + */ + + virtual void onUserMessageReceivedOutsideRoom(int64_t msgid, const char* uid, const char* message) { + (void)msgid; + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief 当收到来自房间外用户通过 sendUserBinaryMessageOutsideRoom{@link #IRTCEngine#sendUserBinaryMessageOutsideRoom} 发送的二进制消息时,触发此回调。 + * @param msgid 本条消息的 ID。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @param size 二进制消息的长度,单位为字节。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceivedOutsideRoom(int64_t msgid, const char* uid, const uint8_t* message, int size) { + (void)msgid; + (void)uid; + (void)message; + (void)size; + } + /** + * + * @type callback + * @brief 给应用服务器发送消息的回调。 + * @param msgid 本条消息的 ID。
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @param msg 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。消息不超过 64 KB。 + * @note 本回调为异步回调。当调用 sendServerMessage{@link #IRTCEngine#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTCEngine#sendServerBinaryMessage} 接口发送消息后,会收到此回调。 + * @list 消息 + */ + + virtual void onServerMessageSendResult(int64_t msgid, int error, const bytertc::ServerACKMsg& msg) { + (void)msgid; + (void)error; + (void)msg; + } + /** + * + * @type callback + * @brief 收到通过调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 发送带有 SEI 消息的视频帧时,收到此回调。 + * @param stream_id 收到 SEI 消息的视频流 ID + * @param stream_info 包含 SEI 发送者的用户名,所在的房间名和媒体流, 参看 StreamInfo{@link #StreamInfo} + * @param message 收到的 SEI 消息内容 + * @param length 收到的 SEI 消息长度 + * @list 网络管理 + */ + + virtual void onSEIMessageReceived(const char* stream_id, const StreamInfo& stream_info, const uint8_t* message, int length){ + (void)stream_id; + (void)stream_info; + (void)message; + (void)length; + } + /** + * + * @type callback + * @brief 黑帧视频流发布状态回调。
    + * 在语音通话场景下,本地用户调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 通过黑帧视频流发送 SEI 数据时,流的发送状态会通过该回调通知远端用户。
    + * 你可以通过此回调判断携带 SEI 数据的视频帧为黑帧,从而不对该视频帧进行渲染。 + * @param stream_id 收到 SEI 消息的视频流 ID + * @param stream_info 包含 SEI 发送者的用户名,所在的房间名和媒体流, 参看 StreamInfo{@link #StreamInfo} + * @param type 黑帧视频流状态,参看 SEIStreamEventType{@link #SEIStreamEventType} + * @list 消息 + */ + + virtual void onSEIStreamUpdate(const char* stream_id, const StreamInfo& stream_info, SEIStreamEventType type) { + (void)stream_id; + (void)stream_info; + (void)type; + } + + /** + * + * @hidden for internal use only + * @type callback + * @region 音频管理 + * @brief 音乐场景检测结果回调。
    + * 调用 enableAudioAEDReport{@link #IRTCEngine#enableAudioAEDReport} 后,根据设置的interval值,本地会周期性地收到此回调
    + * @param state 音乐场景检测结果,参看 AudioAEDType{@link #AudioAEDType}。 + * @list 音频管理 + */ + + virtual void onAudioAEDStateUpdate(const AudioAEDType state) { + (void)state; + } + + /** + * + * @type callback + * @brief 远端用户进房后,本地调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport},根据设置的 interval 值,本地会周期性地收到此回调,了解订阅的远端用户的瞬时音频信息。
    + * 远端用户的音频包括使用 RTC SDK 内部机制/自定义机制采集的麦克风音频和屏幕音频。 + * @param audio_properties_infos 远端音频信息,其中包含音频流属性、房间 ID、用户 ID ,详见 RemoteAudioPropertiesInfo{@link #RemoteAudioPropertiesInfo}。 + * @param audio_properties_info_number 数组长度 + * @param total_remote_volume 所有订阅的远端流混音后的音量,范围是 [0,255]。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @list 音频管理 + */ + + virtual void onRemoteAudioPropertiesReport(const RemoteAudioPropertiesInfo* audio_properties_infos, int audio_properties_info_number, int total_remote_volume) { + (void)audio_properties_infos; + (void)audio_properties_info_number; + (void)total_remote_volume; + } + /** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport} 后,根据设置的 interval 值,你会周期性地收到此回调,了解本地音频的瞬时相关信息。
    + * 本地音频包括使用 RTC SDK 内部机制采集的麦克风音频,屏幕音频和本地混音音频信息。 + * @param audio_properties_infos 本地音频信息,详见 LocalAudioPropertiesInfo{@link #LocalAudioPropertiesInfo}。本地音量可通过 setAudioCaptureDeviceVolume{@link #IAudioDeviceManager#setAudioCaptureDeviceVolume} 设置。 + * @param audio_properties_info_number 数组长度 + * @list 音频管理 + */ + + virtual void onLocalAudioPropertiesReport(const LocalAudioPropertiesInfo * audio_properties_infos, int audio_properties_info_number) { + (void)audio_properties_infos; + (void)audio_properties_info_number; + } + /** + * + * @hidden for internal use only + * @type callback + * @brief 音量调节前的音量大小 + * @list Audio Management + */ + + virtual void onRemoteAudioPropertiesReportEx(const RemoteAudioPropertiesInfo* audio_properties_infos, int audio_properties_info_number) { + (void)audio_properties_infos; + (void)audio_properties_info_number; + } + + /** + * + * @hidden for internal use only + * @type callback + * @region 音频管理 + * @brief 人声检测结果回调。
    + * 调用 enableAudioVADReport{@link #IRTCEngine#enableAudioVADReport} 后,根据设置的interval值,本地会周期性地收到此回调
    + * @param state 人声检测结果,参看 AudioVADType{@link #AudioVADType}。 + * @list 音频管理 + */ + + virtual void onAudioVADStateUpdate(AudioVADType state) { + (void)state; + } + /** + * + * @type callback + * @brief 回调音频设备测试时的播放音量 + * @param volume 音频设备测试播放音量。取值范围:[0,255] + * @note 调用 startAudioPlaybackDeviceTest{@link #IAudioDeviceManager#startAudioPlaybackDeviceTest} 或 startAudioDeviceRecordTest{@link #IAudioDeviceManager#startAudioDeviceRecordTest},开始播放音频文件或录音时,将开启该回调。本回调为周期性回调,回调周期由上述接口的 `interval` 参数指定。 + * @list 音频管理 + */ + + virtual void onAudioPlaybackDeviceTestVolume(int volume) { + (void)volume; + } + /** + * + * @hidden(Android,iOS) + * @type callback + * @brief 音频设备音量改变回调。当通过系统设置,改变音频设备音量或静音状态时,触发本回调。本回调无需手动开启。 + * @param device_type 设备类型,包括麦克风和扬声器,参阅 RTCAudioDeviceType{@link #RTCAudioDeviceType}。 + * @param volume 音量值,[0, 255]。当 volume 变为 0 时,muted 会变为 True。注意:在 Windows 端,当麦克风 volume 变为 0 时,muted 值不变。 + * @param muted 是否禁音状态。扬声器被设置为禁音时,muted 为 True,但 volume 保持不变。 + * @list 音频管理 + */ + + virtual void onAudioDeviceVolumeChanged(bytertc::RTCAudioDeviceType device_type, int volume, bool muted) { + (void)device_type; + (void)volume; + (void)muted; + } + /** + * + * @type callback + * @brief 本地音频流的状态发生改变时,收到此回调。 + * @param audio_source 本地音频流对象,详见:IAudioSource{@link #IAudioSource} + * @param state 本地音频流的状态,详见: LocalAudioStreamState{@link #LocalAudioStreamState} + * @param error 本地音频状态改变时的错误码,详见:LocalAudioStreamError{@link #LocalAudioStreamError} + * @list 音频管理 + */ + + virtual void onLocalAudioStateChanged(IAudioSource* audio_source, LocalAudioStreamState state, LocalAudioStreamError error) { + (void)audio_source; + (void)state; + (void)error; + } + /** + * + * @type callback + * @brief 房间内的用户调用 startAudioCapture{@link #IRTCEngine#startAudioCapture} 开启音频采集时,房间内其他用户会收到此回调。 + * @param stream_id 开启音频采集的远端用户发布的流 ID + * @param stream_info 开启音频采集的远端流信息,详见 StreamInfo{@link #StreamInfo} + * @list 音频管理 + */ + + virtual void onUserStartAudioCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 房间内的用户调用 stopAudioCapture{@link #IRTCEngine#stopAudioCapture} 关闭音频采集时,房间内其他用户会收到此回调。 + * @param stream_id 关闭音频采集的远端用户发布的流 ID + * @param stream_info 关闭音频采集的远端流信息,详见 StreamInfo{@link #StreamInfo} + * @list 音频管理 + */ + + virtual void onUserStopAudioCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport} 后,根据设置的 `config.interval`,你会周期性地收到此回调,获取房间内的最活跃用户信息。 + * @param room_id 房间 ID + * @param uid 最活跃用户(ActiveSpeaker)的用户 ID + * @list 音频管理 + */ + + virtual void onActiveSpeaker(const char* room_id, const char* uid) { + (void)room_id; + (void)uid; + } + /** + * + * @type callback + * @brief 音频流同步信息回调。可以通过此回调,在远端用户调用 sendStreamSyncInfo{@link #IRTCEngine#sendStreamSyncInfo} 发送音频流同步消息后,收到远端发送的音频流同步信息。 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息,详见 StreamInfo{@link #StreamInfo}。 + * @param stream_type 媒体流类型,详见 SyncInfoStreamType{@link #SyncInfoStreamType} 。 + * @param data 消息内容。 + * @param length 消息长度。 + * @list 音频管理 + */ + + virtual void onStreamSyncInfoReceived(const char* stream_id, const StreamInfo& stream_info, SyncInfoStreamType stream_type, + const uint8_t* data, int32_t length) { + (void)stream_id; + (void)stream_info; + (void)stream_type; + (void)data; + (void)length; + } + /** + * + * @type callback + * @brief 通话前网络探测结果。
    + * 成功调用 startNetworkDetection{@link #IRTCEngine#startNetworkDetection} 接口开始探测后,会在 3s 内首次收到该回调,之后每 2s 收到一次该回调。 + * @param type 探测网络类型为上行/下行 + * @param quality 探测网络的质量,参看 NetworkQuality{@link #NetworkQuality}。 + * @param rtt 探测网络的 RTT,单位:ms + * @param lost_rate 探测网络的丢包率 + * @param bitrate 探测网络的带宽,单位:kbps + * @param jitter 探测网络的抖动,单位:ms + * @list 网络管理 + */ + + virtual void onNetworkDetectionResult(NetworkDetectionLinkType type, NetworkQuality quality, int rtt, double lost_rate, + int bitrate, int jitter){ + (void)type; + (void)quality; + (void)rtt; + (void)lost_rate; + (void)bitrate; + (void)jitter; + } + /** + * + * @type callback + * @brief 通话前网络探测结束
    + * 以下情况将停止探测并收到一次本回调:
    + * 1. 当调用 stopNetworkDetection{@link #IRTCEngine#stopNetworkDetection} 接口停止探测后,会收到一次该回调;
    + * 2. 当收到远端/本端音频首帧后,停止探测;
    + * 3. 当探测超过 3 分钟后,停止探测;
    + * 4. 当探测链路断开一定时间之后,停止探测。 + * @param reason
    + * 停止探测的原因类型,参考 NetworkDetectionStopReason{@link #NetworkDetectionStopReason} + * @list 网络管理 + */ + + virtual void onNetworkDetectionStopped(NetworkDetectionStopReason reason){ + (void)reason; + } + /** + * + * @type callback + * @brief 房间内的可见用户调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部视频采集时,房间内其他用户会收到此回调。 + * @param stream_id 视频流 ID + * @param stream_info 视频流信息,详见 StreamInfo{@link #StreamInfo}。 + * @list 视频管理 + */ + + virtual void onUserStartVideoCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 房间内的可见用户调用 stopVideoCapture{@link #IRTCEngine#stopVideoCapture} 关闭内部视频采集时,房间内其他用户会收到此回调。
    + * 若发布视频数据前未开启采集,房间内所有可见用户会收到此回调。 + * @param stream_id 视频流 ID + * @param stream_info 视频流信息,详见 StreamInfo{@link #StreamInfo}。 + * @list 视频管理 + */ + + virtual void onUserStopVideoCapture(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 本地视频大小或旋转信息发生改变时,收到此回调。 + * @param video_source 预留参数。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @list 音视频传输 + */ + + virtual void onLocalVideoSizeChanged(IVideoSource* video_source, const VideoFrameInfo& info) { + (void)video_source; + (void)info; + } + /** + * + * @type callback + * @brief 远端视频大小或旋转信息发生改变时,房间内订阅此视频流的用户会收到此回调。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @list 音视频传输 + */ + + virtual void onRemoteVideoSizeChanged(const char* stream_id, const StreamInfo& stream_info, const VideoFrameInfo& info) { + (void)stream_id; + (void)stream_info; + (void)info; + } + /** + * + * @type callback + * @brief RTC SDK 在本地完成第一帧视频帧或屏幕视频帧采集时,收到此回调。 + * @param video_source 视频源对象。参看 IVideoSource{@link #IVideoSource}。 + * @param info 视频信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @note 对于采集到的本地视频帧,你可以调用 setLocalVideoCanvas{@link #IRTCEngine#setLocalVideoCanvas} 或 setLocalVideoSink{@link #IRTCEngine#setLocalVideoSink} 在本地渲染。 + * @list 音视频传输 + */ + + virtual void onFirstLocalVideoFrameCaptured(IVideoSource* video_source, const VideoFrameInfo& info) { + (void)video_source; + (void)info; + } + /** + * + * @type callback + * @brief 订阅端接收并解码远端音频流首帧时,收到此回调。包含以下情况:
    + * 1. 发布端发布音频,包含首次发布和取消后再次发布。取消发布还包括发布端主动退房后或掉线。
    + * 2. 发布端关闭音频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
    + * 3. 发布端发布音频后,订阅端取消订阅音频后,又再次订阅音频。 + * @param stream_id 远端音频流 ID。 + * @param stream_info 远端音频流信息,参看 StreamInfo{@link #StreamInfo}。 + * @note + * - 用户刚收到房间内每一路音频流时,都会收到该回调。 + * - 摄像头流、屏幕流,内部采集、外部源、自动订阅和手动订阅的音频流,都符合上述策略。 + * @list 音视频传输 + */ + + virtual void onFirstRemoteAudioFrame(const char* stream_id, const StreamInfo& stream_info) { + (void)stream_id; + (void)stream_info; + } + /** + * + * @type callback + * @brief 用户订阅来自远端的音频流状态发生改变时,会收到此回调,了解当前的远端音频流状态。 + * @param stream_id 远端音频流 ID。 + * @param stream_info 远端音频流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param state 远端音频流状态,参看 RemoteAudioState{@link #RemoteAudioState} + * @param reason 远端音频流状态改变的原因,参看 RemoteAudioStateChangeReason{@link #RemoteAudioStateChangeReason} + * @list 音视频传输 + */ + + virtual void onRemoteAudioStateChanged( + const char* stream_id, const StreamInfo& stream_info, RemoteAudioState state, RemoteAudioStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + /** + * + * @type callback + * @brief 本地视频流的状态发生改变时,收到该事件。 + * @param video_source 本地视频流对象。参看 IVideoSource{@link #IVideoSource}。 + * @param state 本地视频流状态,参看 LocalVideoStreamState{@link #LocalVideoStreamState} + * @param error 本地视频状态改变时的错误码,参看 LocalVideoStreamError{@link #LocalVideoStreamError} + * @list 视频管理 + */ + + virtual void onLocalVideoStateChanged(IVideoSource* video_source, LocalVideoStreamState state, LocalVideoStreamError error) { + (void)video_source; + (void)state; + (void)error; + } + /** + * + * @type callback + * @brief 远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息,包括房间 ID、用户 ID、流属性,等。参看 StreamInfo{@link #StreamInfo}。 + * @param state 远端视频流状态,参看 RemoteVideoState{@link #RemoteVideoState}。 + * @param reason 远端视频流状态改变的原因,参看 RemoteVideoStateChangeReason{@link #RemoteVideoStateChangeReason}。 + * @note 本回调仅适用于主流,不适用于屏幕流。 + * @list 音视频传输 + */ + + virtual void onRemoteVideoStateChanged( + const char* stream_id, const StreamInfo& stream_info, RemoteVideoState state, RemoteVideoStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type callback + * @brief 远端视频流的超分状态发生改变时,房间内订阅此流的用户会收到该回调。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息,包括房间 ID、用户 ID、流属性,等。参看 StreamInfo{@link #StreamInfo}。 + * @param mode 超分模式,参看 VideoSuperResolutionMode{@link #VideoSuperResolutionMode}。 + * @param reason 超分模式改变原因,参看 VideoSuperResolutionModeChangedReason{@link #VideoSuperResolutionModeChangedReason}。 + * @list 视频处理 + */ + + virtual void onRemoteVideoSuperResolutionModeChanged( + const char* stream_id, const StreamInfo& stream_info, VideoSuperResolutionMode mode, VideoSuperResolutionModeChangedReason reason) { + (void)stream_id; + (void)stream_info; + (void)mode; + (void)reason; + } + /** + * + * @hidden for internal use only + * @valid since 3.54 + * @type callback + * @brief 降噪模式状态变更回调。当降噪模式的运行状态发生改变,SDK 会触发该回调,提示用户降噪模式改变后的运行状态及状态发生改变的原因。 + * @param mode 视频降噪模式,参看 VideoDenoiseMode{@link #VideoDenoiseMode}。 + * @param reason 视频降噪模式改变的原因,参看 VideoDenoiseModeChangedReason{@link #VideoDenoiseModeChangedReason}。 + * @list 视频处理 + */ + + virtual void onVideoDenoiseModeChanged(VideoDenoiseMode mode, VideoDenoiseModeChangedReason reason) { + (void)mode; + (void)reason; + } + /** + * + * @type callback + * @brief 本地音频首帧发送状态发生改变时,收到此回调。 + * @param stream_id 音频发布用户所在的房间 ID + * @param stream_info 音频流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 本地用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧发送状态,详见 FirstFrameSendState{@link #FirstFrameSendState} + * @list 音视频传输 + */ + + virtual void onAudioFrameSendStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFrameSendState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief 本地视频首帧发送状态发生改变时,收到此回调。 + * @param stream_id 流 ID。 + * @param stream_info 视频流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 本地用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧发送状态,详见 FirstFrameSendState{@link #FirstFrameSendState} + * @list 音视频传输 + */ + + virtual void onVideoFrameSendStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFrameSendState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief SDK 内部渲染成功远端视频流首帧后,收到此回调。包含以下情况:
    + * 1. 发布端首次发布视频
    + * 2. 在 1 条件下,发布端取消发布视频后,再次发布视频
    + * 3. 在 1 条件下,发布端关闭视频采集后,再次打开采集(或使用外部源时,停止推流后再次推流)
    + * 4. 在 1 条件下,订阅端取消订阅视频后,再次订阅视频(调用接口包括 subscribeAllStreamsVideo{@link #IRTCRoom#subscribeallstreamsVideo},pauseAllSubscribedStreamVideo{@link #IRTCRoom#pauseAllSubscribedStreamVideo}/resumeAllSubscribedStreamVideo{@link #IRTCRoom#resumeAllSubscribedStreamVideo}) + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @note 仅在采用内部渲染时,符合上述策略。 + * @list 音视频传输 + */ + + virtual void onFirstRemoteVideoFrameRendered(const char* stream_id, const StreamInfo& stream_info, const VideoFrameInfo& info) { + (void)stream_id; + (void)stream_info; + (void)info; + } + /** + * + * @type callback + * @brief 订阅端接收并解码远端视频流首帧时,收到此回调。包含以下情况:
    + * 1. 发布端发布视频,包含首次发布和取消后再次发布。取消发布还包括发布端主动退房后或掉线。
    + * 2. 发布端关闭视频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
    + * 3. 发布端发布视频后,订阅端取消订阅视频后,又再次订阅视频。 + * @param stream_id 远端视频流 ID。 + * @param stream_info 远端视频流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param info 视频帧信息。参看 VideoFrameInfo{@link #VideoFrameInfo}。 + * @note + * - 用户刚收到房间内订阅的每一路视频流时,都会收到该回调。 + * - 摄像头流、屏幕流,内部采集、外部源,自动订阅和手动订阅的视频流,都符合上述策略。 + * @list 音视频传输 + */ + + virtual void onFirstRemoteVideoFrameDecoded(const char* stream_id, const StreamInfo& stream_info, const VideoFrameInfo& info) { + (void)stream_id; + (void)stream_info; + (void)info; + } + /** + * + * @type callback + * @brief 音频首帧播放状态发生改变时,收到此回调。 + * @param stream_id 音频首帧播放状态发生改变的流 ID + * @param stream_info 音频首帧播放状态发生改变的流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 远端用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧播放状态,详见 FirstFramePlayState{@link #FirstFramePlayState} + * @list 音视频传输 + */ + + virtual void onAudioFramePlayStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFramePlayState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief 远端视频流的首帧播放状态改变时,收到此回调。 + * @param stream_id 视频首帧播放状态发生改变的流 ID + * @param stream_info 视频首帧播放状态发生改变的流信息,详见 StreamInfo{@link #StreamInfo} + * @param user 远端用户信息,详见 RtcUser{@link #RtcUser} + * @param state 首帧播放状态,详见 FirstFramePlayState{@link #FirstFramePlayState} + * @list 音视频传输 + */ + + virtual void onVideoFramePlayStateChanged(const char* stream_id, const StreamInfo& stream_info, const RtcUser& user, FirstFramePlayState state) { + (void)stream_id; + (void)stream_info; + (void)user; + (void)state; + } + /** + * + * @type callback + * @brief 发布音频流时,采集到第一帧音频帧,收到该回调。 + * @param audio_source 音频源,详见 IAudioSource{@link #IAudioSource}。 + * @note 如果发布音频流时,未开启本地音频采集,SDK 会推送静音帧,也会收到此回调。 + * @list 音视频传输 + */ + + virtual void onFirstLocalAudioFrame(IAudioSource* audio_source) { + (void)audio_source; + } + /** + * + * @deprecated since 3.60, use onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent} instead. + * @type callback + * @hidden(Linux) + * @brief WTN 流发布结果回调。
    + * 调用 startPushMixedStream 接口发布 WTN 流后,启动结果通过此回调方法通知用户。 + * @param room_id WTN 流的发布房间的 ID + * @param public_streamid WTN 流 ID + * @param error_code WTN 流发布结果状态码。详见 PublicStreamErrorCode{@link #PublicStreamErrorCode} + * @list 音视频传输 + * @order 24 + */ + + virtual void onPushPublicStreamResult(const char* room_id, const char* public_streamid, PublicStreamErrorCode error_code) { + (void)room_id; + (void)public_streamid; + (void)error_code; + } + + /** + * + * @type callback + * @brief 调用 startCloudProxy{@link #IRTCEngine#startCloudProxy} 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。 + * @param interval 从开启云代理到连接成功经过的时间,单位为 ms + * @list 通话加密 + */ + + virtual void onCloudProxyConnected(int interval) { + (void)interval; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 关于音视频回路测试结果的回调。 + * @param result 测试结果,参看 EchoTestResult{@link #EchoTestResult} + * @note 该回调触发的时机包括:
    + * - 检测过程中采集设备发生错误时; + * - 检测成功后; + * - 非设备原因导致检测过程中未接收到音/视频回放,停止检测后。 + * @list 网络管理 + */ + + virtual void onEchoTestResult(EchoTestResult result) { + (void)result; + }; + /** + * + * @hidden for internal use only + * @type callback + * @brief 音频 dump 状态改变回调 + * @param status 音频 dump 状态,参见 AudioDumpStatus{@link #AudioDumpStatus} + * @note 本回调用于内部排查音质相关异常问题,开发者无需关注。 + * @list Network Processing + */ + + virtual void onAudioDumpStateChanged(AudioDumpStatus status) { + (void)status; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 首次调用 getNetworkTimeInfo{@link #IRTCEngine#getNetworkTimeInfo} 后,SDK 内部启动网络时间同步,同步完成时会触发此回调。 + * @list 网络管理 + */ + + virtual void onNetworkTimeSynchronized() { + } + /** + * + * @hidden internal use only + * @type callback + * @brief license 过期提醒。在剩余天数低于 30 天时,收到此回调。 + * @param days license 剩余有效天数 + * @list Network Processing + */ + + virtual void onLicenseWillExpire(int days) { + (void)days; + } + /** + * + * @type callback + * @brief AIGC(AI 音视频互动方案)使用 License 计费的场景下,当 License 配额用尽时,会收到该回调。收到该回调时,AIGC 服务会中止,请及时续费,并且建议离开房间、销毁 SDK。 + * @param message 回调消息 + * @list 高级功能 + */ + + virtual void onLicenseQuotaExceeded(const char* message) { + (void)message; + } + /** + * + * @hidden + * @type callback + * @brief 外部采集时,调用 setOriginalScreenVideoInfo设置屏幕或窗口大小改变前的分辨率后,若屏幕采集模式为智能模式,你将收到此回调,根据 RTC 智能决策合适的帧率和分辨率积(宽*高)重新采集。 + * @param frame_update_info RTC 智能决策后合适的帧率和分辨率积(宽*高)。参看 FrameUpdateInfo{@link #FrameUpdateInfo}。 + * @list 屏幕共享 + */ + + virtual void onExternalScreenFrameUpdate(FrameUpdateInfo frame_update_info) { + (void)frame_update_info; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 通话前回声检测结果回调。 + * @param hardware_echo_detection_result 参见 HardwareEchoDetectionResult{@link #HardwareEchoDetectionResult} + * @note + * - 通话前调用 startHardwareEchoDetection{@link #IRTCEngine#startHardwareEchoDetection} 后,将触发本回调返回检测结果。 + * - 建议在收到检测结果后,调用 stopHardwareEchoDetection{@link #IRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * - 如果 SDK 在通话中检测到回声,将通过 onAudioDeviceWarning{@link #IRTCEngineEventHandler#onAudioDeviceWarning} 回调 `kMediaDeviceWarningDetectLeakEcho`。 + * @list 音频管理 + */ + + virtual void onHardwareEchoDetectionResult(HardwareEchoDetectionResult hardware_echo_detection_result) { + (void)hardware_echo_detection_result; + } + /** + * + * @type callback + * @brief 本地代理状态发生改变回调。调用 setLocalProxy{@link #IRTCEngine#setLocalProxy} 设置本地代理后,SDK 会触发此回调,返回代理连接的状态。 + * @param local_proxy_type 本地代理类型。参看 LocalProxyType{@link #LocalProxyType}。 + * @param local_proxy_state 本地代理状态。参看 LocalProxyState{@link #LocalProxyState}。 + * @param local_proxy_error 本地代理错误。参看 LocalProxyError{@link #LocalProxyError}。 + * @list 通话加密 + */ + + virtual void onLocalProxyStateChanged(LocalProxyType local_proxy_type, LocalProxyState local_proxy_state, LocalProxyError local_proxy_error) { + (void)local_proxy_type; + (void)local_proxy_state; + (void)local_proxy_error; + } + /** + * + * @hidden internal use only + * @type callback + * @brief 当特效设置失败时,收到此回调。 + * @param error 特效错误类型。参看 EffectErrorType{@link #EffectErrorType}。 + * @param msg 错误信息。 + * @list Encryption + */ + + virtual void onEffectError(EffectErrorType error, const char* msg) { + (void)error; + (void)msg; + } + /** + * + * @hidden for internal use only + * @type callback + * @brief SDK 远端视频渲染发生错误时收到此回调 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息。参看 StreamInfo{@link #StreamInfo}。 + * @param error 渲染错误类型。参看 RenderError{@link #RenderError}。 + * @param message 错误信息。 + * @note 本回调暂时仅内部使用,开发者无需关注。 + * @list 视频管理 + */ + + virtual void onRemoteRenderError(const char* stream_id, const StreamInfo& stream_info, RenderError error, const char* message) { + (void)stream_id; + (void)stream_info; + (void)error; + (void)message; + } + /** + * + * @hidden(Linux) + * @valid since 3.60. 自 3.60 起,该回调替代了 `onStreamMixingEvent` 和 `onPushPublicStreamResult` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此回调。 + * @type callback + * @brief 合流转推 CDN / WTN 流状态回调 + * @param info 任务详情,参看 MixedStreamTaskInfo{@link #MixedStreamTaskInfo}。 + * @param event 任务事件,参看 MixedStreamTaskEvent{@link #MixedStreamTaskEvent}。 + * @param error_code 任务错误码,参看 MixedStreamTaskErrorCode{@link #MixedStreamTaskErrorCode} + * @list CDN 推流 + */ + + virtual void onMixedStreamEvent(MixedStreamTaskInfo info, MixedStreamTaskEvent event, MixedStreamTaskErrorCode error_code) { + (void)info; + (void)event; + (void)error_code; + } + /** + * + * @valid since 3.60. + * @type callback + * @hidden(Linux) + * @brief 单流转推 CDN 状态回调 + * @param task_id 任务 ID + * @param event 任务状态, 参看 SingleStreamTaskEvent{@link #SingleStreamTaskEvent} + * @param error_code 错误码,参看 SingleStreamTaskErrorCode{@link #SingleStreamTaskErrorCode} + * @list CDN 推流 + */ + + virtual void onSingleStreamEvent(const char *task_id, SingleStreamTaskEvent event, SingleStreamTaskErrorCode error_code) { + (void)task_id; + (void)event; + (void)error_code; + } + /** + * + * @hidden internal use only + * @valid since 3.60. + * @type callback + * @brief 试验性接口回调 + * @param param 回调内容(JSON string) + * @list 引擎管理 + */ + + virtual void onExperimentalCallback(const char* param) { + (void)param; + } + + /** + * + * @valid since 3.60. + * @hidden(Linux) + * @type callback + * @brief 调用 takeLocalSnapshotToFile{@link #IRTCEngine#takeLocalSnapshotToFile} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param video_source 被截图的视频流,参看 IVideoSource{@link #IVideoSource}。 + * @param file_path 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param error_code 截图错误码。请参看 SnapshotErrorCode{@link #SnapshotErrorCode}。 + * @param task_id 截图任务的编号,和 takeLocalSnapshotToFile{@link #IRTCEngine#takeLocalSnapshotToFile} 的返回值一致。 + * @list 高级功能 + */ + + virtual void onLocalSnapshotTakenToFile(IVideoSource* video_source, const char* file_path, int width, int height, SnapshotErrorCode error_code, long task_id) { + (void)video_source; + (void)file_path; + (void)width; + (void)height; + (void)error_code; + (void)task_id; + } + + /** + * + * @type callback + * @hidden(Linux) + * @valid since 3.60. + * @brief 调用 takeRemoteSnapshotToFile{@link #IRTCEngine#takeRemoteSnapshotToFile} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param stream_id 被截图的视频流 ID。 + * @param stream_info 被截图的视频流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param file_path 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param error_code 截图错误码。请参看 SnapshotErrorCode{@link #SnapshotErrorCode}。 + * @param task_id 截图任务的编号,和 takeRemoteSnapshotToFile{@link #IRTCEngine#takeRemoteSnapshotToFile} 的返回值一致。 + * @list 高级功能 + */ + + virtual void onRemoteSnapshotTakenToFile(const char* stream_id, const StreamInfo& stream_info, const char* file_path, int width, int height, SnapshotErrorCode error_code, long task_id) { + (void)stream_id; + (void)stream_info; + (void)file_path; + (void)width; + (void)height; + (void)error_code; + (void)task_id; + } + +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine_ex.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine_ex.h new file mode 100644 index 0000000..3d78b82 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_engine_ex.h @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface Lite + */ + +#pragma once + +#include "bytertc_engine.h" +#include "rtc/bytertc_defines.h" +#include "rtc/bytertc_video_defines_ex.h" +#include "bytertc_engine_event_handler.h" + +namespace bytertc { + +/** + * + * @hidden + */ +class IRTCRoomEx; +/** + * + * @hidden + */ +class IVideoSource; +/** + * + * @hidden + */ +class IPublisher; +/** + * + * @type api + * @brief IRTCEngineEx class + */ +class IRTCEngineEx : public IRTCEngine { +public: + /** + * + * @type api + * @brief 创建 IRTCRoomEx{@link #IRTCRoomEx} 实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom{@link #IRTCRoom#joinRoom} 才能真正地创建/加入房间。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTCRoomEx{@link #IRTCRoomEx} 房间实例。 + * @note 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + */ + virtual IRTCRoomEx* createRTCRoomEx(const char* room_id) = 0; + /** + * + * @type api + * @brief 设置视频源的相关配置。 + * @param stream_index 源对应的流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param config 参看 VideoSourceConfig{@link #VideoSourceConfig}。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setVideoSource(StreamIndex stream_index, const VideoSourceConfig& config) = 0; + /** + * + * @type api + * @brief 推送外部视频帧。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param frame 设置视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * + 支持格式:I420, NV12, RGBA, BGRA, ARGB
    + * + 该函数运行在用户调用线程内
    + * + 推送外部视频帧前,必须调用 setVideoSource{@link #IRTCEngineEx#setVideoSource} 开启外部视频源采集。 + */ + virtual int pushExternalVideoFrame(StreamIndex stream_index, const VideoFrameData& frame) = 0; + /** + * + * @type api + * @brief 设置流的优先级。
    + * 在网络条件有限的情况下,优先保障高优先级视频流的清晰度和流畅度,优先保障高优先级流的音频流畅度和音质。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param priority 参看 StreamPriority{@link #StreamPriority}。 + */ + virtual int setLocalStreamPriority(StreamIndex stream_index, StreamPriority priority) = 0; + /** + * + * @type api + * @brief 立即开启内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
    + * 本地用户在非隐身状态下调用该方法后,房间中的其他用户会收到 onUserStartVideoCapture{@link #IRTCEngineEventHandler#onUserStartVideoCapture} 的回调。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param device_id 设备 ID + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 调用 stopVideoCapture{@link #IRTCEngineEx#stopVideoCapture} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。
    + * + 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。
    + * + 如果需要从自定义视频采集切换为内部视频采集,你必须先关闭自定义采集,再调用此方法手动开启内部采集。 + */ + virtual int startVideoCapture(StreamIndex stream_index, const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 立即关闭内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 onUserStopVideoCapture{@link #IRTCEngineEventHandler#onUserStopVideoCapture} 的回调。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 可以开启内部视频采集。
    + * + 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + */ + virtual int stopVideoCapture(StreamIndex stream_index) = 0; + /** + * + * @type api + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
    + * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数,包括模式、分辨率、帧率。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param video_capture_config 视频采集参数。参看: VideoCaptureConfig{@link #VideoCaptureConfig}。 + * @return + * + 0: 成功;
    + * + < 0: 失败; + * @note + * + 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture{@link #IRTCEngineEx#startVideoCapture} 前调用本接口。
    + * + 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + */ + virtual int setVideoCaptureConfig(StreamIndex stream_index, const VideoCaptureConfig& video_capture_config) = 0; + + /** + * + * @type api + * @brief 设置音频源的整体音量。 + * @param stream_index 音频源对应的流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setAudioSourceVolume(StreamIndex stream_index, int volume) = 0; + /** + * + * @type api + * @brief 设置音频源的内容。单个音频源的内容可以包含一个或多个原始音频来源。 + * @param stream_index 音频源对应的流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param config 内容构成。参看 AudioContentTypeConfig{@link #AudioContentTypeConfig}。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setAudioContentType(StreamIndex stream_index, const AudioContentTypeConfig& config) = 0; + /** + * + * @type api + * @brief 设置音频流的编码配置。 + * @param stream_index 音频流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param config 编码设置。参看 AudioEncodeConfig{@link #AudioEncodeConfig}。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setAudioEncodeConfig(StreamIndex stream_index, const AudioEncodeConfig& config) = 0; + + + /** + * + * @type api + * @brief 设置多路流编码配置,在开启simulcast功能下可同时设置4路分辨率的流 + * @param stream_index 视频频流的索引。参看 StreamIndex{@link #StreamIndex}。 + * @param solutions 编码设置。参看 VideoEncoderConfig{@link #VideoEncoderConfig}。 + * @param solution_num 需要传入的solutions数组大小。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + virtual int setVideoEncoderConfig(StreamIndex stream_index, const VideoEncoderConfig* solutions, + int solution_num) = 0; + + /** + * + * @type api + * @brief 创建 IRTCEngineEx 实例。
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param event_handler SDK 回调给应用层的 Callback 对象,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} 。 + * @return IRTCEngineEx:创建成功。返回一个可用的 IRTCEngineEx{@link #IRTCEngineEx} 实例 + */ + static BYTERTC_STATIC_API IRTCEngineEx* createRTCEngineEx(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + + /** +* +* @type api +* @brief 创建 IRTCEngineEx 实例。
    +* 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    +* 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新的引擎实例。 +* @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} +* @param event_handler SDK 回调给应用层的 Callback 对象,详见 IRTCEngineEventHandler{@link #IRTCEngineEventHandler} 。 +* @return IRTCEngineEx:创建成功。返回一个可用的 IRTCEngineEx{@link #IRTCEngineEx} 实例 +*/ + static BYTERTC_STATIC_API IRTCEngineEx* createRTCEngineExMulti(const EngineConfig& config, IRTCEngineEventHandler* event_handler); + + /** + * + * @type api + * @brief 销毁由 IRTCEngineEx 实例,并释放所有相关资源。 + * @note + * + 请确保和需要销毁的 IRTCEngineEx 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 IRTCEngineEx 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 IRTCEngineEx 实例相关的内存,并且停止与媒体服务器的任何交互。
    + * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ + static BYTERTC_STATIC_API void destroyRTCEngineEx(); + + /** + * + * @hidden internal use only + * @type apx + * @brief 销毁由 createRTCEngineExMulti{@link #IRTCEngine#createRTCEngineExMulti} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 IRTCEngineEx{@link #IRTCEngineEx} 实例相关的业务场景全部结束后,才调此方法 + * - 该方法在调用之后,会销毁所有和此 IRTCEngineEx{@link #IRTCEngineEx} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * @list 引擎管理 + */ + static BYTERTC_STATIC_API void destroyRTCEngineExMulti(IRTCEngineEx* instance_multi); +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_game_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_game_room.h new file mode 100644 index 0000000..95c9a6b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_game_room.h @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2024 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_video_effect_interface.h" +#include "rtc/bytertc_defines.h" +#include "bytertc_room_event_handler.h" +#include "rtc/bytertc_range_audio_interface.h" +#include "rtc/bytertc_spatial_audio_interface.h" +#include "rtc/bytertc_panoramic_video_interface.h" +namespace bytertc { +/** + * + * @type api + * @brief 游戏房间接口 + */ + +class IGameRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IGameRoom() { + } + /** + * + * @type api + * @brief 退出并销毁调用 createGameRoom{@link #IRTCEngine#createGameRoom} 所创建的游戏房间实例。 + * @list 房间管理 + */ + + virtual void destroy() = 0; + /** + * + * @type api + * @brief 加入游戏房间。
    + * 调用 createGameRoom{@link #IRTCEngine#createGameRoom} 创建房间实例后,调用此方法加入房间,同房间内其他用户进行音频通话。 + * @param token 动态密钥,用于对登录用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在您的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * - 使用不同 App ID 的 App 是不能互通的。 + * - 请务必保证生成 Token 使用的 App ID 和创建引擎时使用的 App ID 相同,否则会导致加入房间失败。 + * @param user_info 用户信息,参看 UserInfo{@link #UserInfo}。 + * @return + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + * - 如果本端用户为可见用户,房间内其他用户收到 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 回调通知。 + * - -1:room_id/user_info.uid 包含了无效的参数。 + * - -2:已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #IGameRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调告知。 + * @note + * - 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 onConnectionStateChanged{@link #IRTCEngineEventHandler#onConnectionStateChanged} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知。 + * @list 房间管理 + */ + + virtual int joinRoom(const char* token, const UserInfo& user_info) = 0; + /** + * + * @type api + * @brief 离开游戏房间。
    + * 调用此方法结束通话过程,并释放所有通话相关的资源。 + * @return + * - 0: 调用成功。如果用户是房间内可见用户,远端用户收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调通知。 + * - < 0: 调用失败,参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 + * - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知。你必须在收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调后,再销毁房间或引擎,或调用 joinRoom{@link #IGameRoom#joinRoom} 再次加入房间。 + * @list 房间管理 + */ + + virtual int leaveRoom() = 0; + /** + * + * @type api + * @brief 更新游戏房间 Token。
    + * 收到 onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire},onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire},或 onSubscribePrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
    + * 如果 Token 无效,你会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged},错误码是 `-1010`。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note 请勿同时调用 updateToken{@link #IGameRoom#updateToken} 和 joinRoom{@link #IGameRoom#joinRoom} 方法更新 Token。若因 Token 过期或无效导致加入房间失败或已被移出房间,你应该在获取新的有效 Token 后调用 joinRoom{@link #IGameRoom#joinRoom} 重新加入房间。 + * @list 房间管理 + */ + + virtual int updateToken(const char* token) = 0; + /** + * + * @type api + * @brief 通过设置 IGameRoom{@link #IGameRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param room_event_handler 参见 IRTCRoomEventHandler{@link #IRTCRoomEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + virtual int setRTCRoomEventHandler(IRTCRoomEventHandler* room_event_handler) = 0; + /** + * + * @type api + * @brief 获取游戏房间范围语音接口实例。 + * @return 方法调用结果:
    + * - IRangeAudio:成功,返回一个 IRangeAudio{@link #IRangeAudio} 实例。 + * - nullptr:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + + virtual IRangeAudio* getRangeAudio() = 0; + /** + * + * @type api + * @brief 开始讲话或者停止讲话时调用,调用该接口启动或停止音频采集。同房间其他用户会收到 + * 回调 OnAudioDeviceStateChanged{@link #IRTCEngineEventHandler#OnAudioDeviceStateChanged} + * @param [in] enable + * true 表示开启采集 + * false 表示关闭采集,默认设置 + * @return + * 0: 表示参数检查通过,不代表打开麦克风会成功,比如房间不存在 + * -2: 传入的room_id为空导致失败 + * @note 不可与 EnableAudioSend{@link #IGameRoom#EnableAudioSend} 同时调用。 + * @list 音频管理 + */ + + virtual int enableMicrophone(bool enable) = 0; + /** + * + * @type api + * @brief 开启或关闭扬声器。 + * @param enable 是否开启扬声器:
    + * - true:开启扬声器,订阅所有远端用户的音频流。 + * - false:默认设置。关闭扬声器,取消订阅所有远端用户的音频流。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败。没有加入房间。 + * @list 音频管理 + */ + + virtual int enableSpeakerphone(bool enable) = 0; + /** + * + * @type api + * @brief 开始或停止发送音频流。调用此接口不影响音频采集。同房间其他用户会收到相应的回调。 + * @param enable 是否发送音频流:
    + * - true:发送音频流。 + * - false:默认设置。停止发送音频流(不会关闭麦克风)。 + * @return + * 0: 表示参数检查通过,不代表打开麦克风会成功,比如房间不存在 + * -2: 传入的room_id为空导致失败 + * @note 不可与 EnableMicrophone{@link #IGameRoom#EnableMicrophone} 同时调用。 + * @list 音频管理 + */ + + virtual int enableAudioSend(bool enable) = 0; + /** + * + * @type api + * @brief 是否接收某个特定用户的音频流。关闭声音接收不会影响扬声器或其他音频输出设备的状态。 + * @param user_id 用户 ID,最大长度为128字节的非空字符串。支持的字符集范围为:
    + * 1. 26个大写字母 A ~ Z
    + * 2. 26个小写字母 a ~ z
    + * 3. 10个数字 0 ~ 9
    + * 4. 下划线"_", at符"@", 减号"-" + * @param enable 是否接收指定用户的音频流:
    + * - true:接收该用户的音频流。即允许该用户的音频数据被传递到本地设备并播放。 + * - false:默认设置,不接收该用户的音频流,即不播放该用户的声音。但不会关闭扬声器,扬声器仍可用于其他音频输出。 + * @return + * - 0:接口调用成功。 + * - -2:传入的用户 ID 为空字符串。 + * @list 音频管理 + */ + + virtual int enableAudioReceive(const char* user_id, bool enable) = 0; + /** + * + * @type api + * @brief 调节某个房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
    + * - 该方法与 setRemoteAudioPlaybackVolume{@link #IRTCEngine#setRemoteAudioPlaybackVolume} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume{@link #IRTCEngine#setPlaybackVolume} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + + virtual int setRemoteRoomAudioPlaybackVolume(int volume) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room.h new file mode 100644 index 0000000..eb7283a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room.h @@ -0,0 +1,649 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_video_effect_interface.h" +#include "rtc/bytertc_defines.h" +#include "bytertc_room_event_handler.h" +#include "bytertc_rts_room.h" +#include "rtc/bytertc_range_audio_interface.h" +#include "rtc/bytertc_spatial_audio_interface.h" +#include "rtc/bytertc_panoramic_video_interface.h" +namespace bytertc { +/** + * + * @type api + * @brief 房间接口 + */ + +class IRTCRoom : public IRTSRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTCRoom() { + } + /** + * + * @type api + * @brief 退出并销毁调用 createRTCRoom{@link #IRTCEngine#createRTCRoom} 所创建的 RTC 房间实例。 + * @list 房间管理 + */ + + virtual void destroy() = 0; + /** + * + * @type api + * @brief 设置用户可见性。未调用该接口前,本地用户默认对他人可见。
    + * 默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,最多 30 人可同时上麦。更多信息参看[用户和媒体流上限](https: + * @param enable 设置用户是否对房间内其他用户可见:
    + * - true: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - false: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * 设置用户可见性,会收到设置成功/失败回调 onUserVisibilityChanged{@link #IRTCRoomEventHandler#onUserVisibilityChanged}。(v3.54 新增) + * - 在加入房间前设置用户可见性,若设置的可见性与默认值不同,将在加入房间时触发本回调。 + * - 在加入房间后设置用户可见性,若可见性前后不同,会触发本回调。 + * - 断网重连后,若可见性发生改变,会触发本回调。 + * @note + * - 在加入房间前后,用户均可调用此方法设置用户可见性。 + * - 在房间内,调用此方法成功切换用户可见性后,房间内其他用户会收到相应的回调。 + * - 从可见换至不可见时,房间内其他用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave}。 + * - 从不可见切换至可见时,房间内其他用户会收到 onUserJoined{@link #IRTSRoomEventHandler#onUserJoined}。 + * - 若调用该方法将可见性设为 `false`,此时尝试发布流会收到 `kWarningCodePublishStreamForbidden` 警告。 + * @list 房间管理 + */ + + virtual int setUserVisibility(bool enable) = 0; + /** + * + * @type api + * @brief 通过设置 IRTCRoom{@link #IRTCRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param room_event_handler 参见 IRTCRoomEventHandler{@link #IRTCRoomEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + virtual int setRTCRoomEventHandler(IRTCRoomEventHandler* room_event_handler) = 0; + /** + * + * @type api + * @brief 加入 RTC 房间。
    + * 调用 createRTCRoom{@link #IRTCEngine#createRTCRoom} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。
    + * > 用户(包括后端机器人)成功进入 RTC 房间后便开始计费。即使房间内只有 1 个用户,也会计算音频计费时长。具体计费说明,请参见[音视频通话计费](69871)。 + * @param token 动态密钥,用于对登录用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在您的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * - 使用不同 App ID 的 App 是不能互通的。 + * - 请务必保证生成 Token 使用的 App ID 和创建引擎时使用的 App ID 相同,否则会导致加入房间失败。 + * @param user_info 用户信息,参看 UserInfo{@link #UserInfo}。 + * @param user_visibility 用户可见性。建议在进房时将用户可见性都设置为 `false`,并在用户需要发送音视频流时再通过 setUserVisibility{@link #IRTCRoom#setUserVisibility} 设置为 `true`。从而避免因房间内用户达到数量上限所导致的进房失败。默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,其中最多 30 人可同时上麦,更多信息参看[用户和媒体流上限](https: + * @param config 房间参数配置,设置房间模式以及是否自动发布或订阅流。具体配置模式参看 RTCRoomConfig{@link #RTCRoomConfig}。 + * @return + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + * - 本端收到本地流发布状态通知 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调。 + * - 本端收到流订阅状态通知 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。 + * - 本端收到房间内已发布流的通知 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * - 如果本端用户为可见用户,房间内其他用户收到 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 回调通知。 + * - -1:room_id / user_info.uid 包含了无效的参数。 + * - -2:已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #IRTSRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调告知。 + * @note + * - 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 onConnectionStateChanged{@link #IRTCEngineEventHandler#onConnectionStateChanged} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调通知。 + * @list 房间管理 + */ + + virtual int joinRoom(const char* token, const UserInfo& user_info, bool user_visibility, const RTCRoomConfig& config) = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @region 房间管理 + * @brief 发布/取消发布视频流。 + * @param publish 是否发布视频流。
    + * - `true`: 发布。 + * - `false`: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom{@link #IRTCRoom#joinRoom} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头视频流。 + * - 如果你需要发布麦克风采集到的音频流,调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms}。 + * - 调用此方法后,房间中的所有远端用户会收到 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调通知,订阅了视频流的远端用户会收到 onFirstRemoteVideoFrameDecoded{@link #IRTCEngineEventHandler#onFirstRemoteVideoFrameDecoded} 回调。 + * @list 音视频传输 + */ + + virtual int publishStreamVideo(bool publish) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这些方法,请迁移到此接口。 + * @region 房间管理 + * @brief 发布/取消发布音频流。 + * @param publish 是否发布音频流。
    + * - `true`: 发布。 + * - `false`: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom{@link #IRTCRoom#joinRoom} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布音频流。 + * - 如果你需要发布摄像头采集到的视频流,调用 publishStreamVideo{@link #IRTCRoom#publishStreamVideo}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms}。 + * - 调用此方法后,房间中的所有远端用户会收到 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调通知,其中成功收到了音频流的远端用户会收到 onFirstRemoteAudioFrame{@link #IRTCEngineEventHandler#onFirstRemoteAudioFrame} 回调。 + * @list 音视频传输 + * @order 0 + */ + + virtual int publishStreamAudio(bool publish) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream`、`unsubscribeStream`、`subscribeScreen` 和 `unsubscribeScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端视频流。 + * @param stream_id 目标远端视频流 ID。 + * @param subscribe 是否订阅该视频流。
    + * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端视频流(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} 回调获取当前房间里的远端摄像头流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged} 回调通知,具体异常原因参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 3 + */ + + virtual int subscribeStreamVideo(const char *stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream`, `unsubscribeStream`, `subscribeScreen` 和 `unsubscribeScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端音频流。 + * @param stream_id 目标远端音频流 ID。 + * @param subscribe 是否订阅该音频流。
    + * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调获取当前房间里的远端麦克风流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调通知,具体异常原因参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @list 音视频传输 + */ + + virtual int subscribeStreamAudio(const char *stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. + * @brief 设置期望订阅的远端视频流类型。比如大流、中流、小流等。 + * @param stream_id 目标要订阅的远端视频流 ID。 + * @param stream_type 远端视频流类型,参看 SimulcastStreamType{@link #SimulcastStreamType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 该方法仅在发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode} 开启了发送多路视频流的情况下生效。 + * - 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。该方法可在进房后调用。 + * @list 视频管理 + * @order 1 + */ + + virtual int setRemoteSimulcastStreamType(const char* stream_id, SimulcastStreamType stream_type) = 0; + + /** + * + * @type api + * @list 视频管理 + * @brief 设置期望订阅的远端视频流的参数。 + * @param stream_id 期望配置订阅参数的远端视频流 ID。 + * @param remote_video_config 期望配置的远端视频流参数,参看 RemoteVideoConfig{@link #RemoteVideoConfig}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + !0:失败。 + * @note + * + 若使用 342 及以前版本的 SDK,调用该方法前请联系技术支持人员开启按需订阅功能。
    + * + 该方法需在进房后调用。 + * + 该方法仅在发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setLocalSimulcastMode} 开启了发送多路视频流的情况下生效,此时订阅端将收到来自发布端与期望设置的参数最相近的一路流;否则订阅端只会收到一路参数为分辨率 640px × 360px、帧率 15fps 的视频流。
    + * + 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。
    + * + SDK 会根据发布端和所有订阅端的设置灵活调整视频流的参数,具体调整策略详见[推送多路流](https: + */ + + virtual int setRemoteVideoConfig(const char *stream_id, const RemoteVideoConfig &remote_video_config) = 0; + /** + * + * @type api + * @valid Available since 3.60 + * @brief 设置当前推流的流附加信息。 + * @param extra_info 流附加信息。长度不超过1024的字符串。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + !0:失败。 + * @note + * + 可通过此函数设置当前推流的流附加信息。流附加信息是流 ID 的附加信息标识,不同于流 ID 在推流过程中不可修改,流附加信息可以在对应流 ID 的推流中途修改。开发者可根据流附加信息来实现流 ID 相关的可变内容的同步。 + * + 该方法在进房前后均可调用 + * + 相同房间内的其他用户会通过 onRoomStreamExtraInfoUpdate{@link #IRTCRoomEventHandler#onRoomStreamExtraInfoUpdate} 回调函数获得通知。 + * @list 音视频传输 + */ + + virtual int setStreamExtraInfo(const char* extra_info) = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内所有远端视频流(通过摄像头采集的)。 + * @param subscribe 是否订阅所有远端视频流。
    + * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置:subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio}。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用单流订阅接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 通知方法调用结果,包含异常原因。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 取消订阅或本端用户退房。 + * @list 音视频传输 + */ + + virtual int subscribeAllStreamsVideo(bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @region 房间管理 + * @brief 订阅/取消订阅房间内所有远端音频流(通过麦克风采集的)。 + * @param subscribe 是否订阅所有远端音频流。
    + * - `true`: 订阅。 + * - `false`: 取消订阅。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置:subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio}。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用单流订阅接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 通知方法调用结果,包含异常原因。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo}、subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 取消订阅或本端用户退房。 + * @list 音视频传输 + * + */ + + virtual int subscribeAllStreamsAudio(bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `pauseAllSubscribedStreamAudio` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送。 + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #IRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + + virtual int pauseAllSubscribedStreamVideo() = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `pauseAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #IRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + + virtual int pauseAllSubscribedStreamAudio() = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送。 + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + + virtual int resumeAllSubscribedStreamVideo() = 0; + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送。 + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + + virtual int resumeAllSubscribedStreamAudio() = 0; + /** + * + * @hidden for internal use only. + */ + + virtual int enableSubscribeLocalStream(bool enable) = 0; + /** + * + * @type api + * @brief 设置发流端音画同步。
    + * 当同一用户同时使用两个通话设备分别采集发送音频和视频时,有可能会因两个设备所处的网络环境不一致而导致发布的流不同步,此时你可以在视频发送端调用该接口,SDK 会根据音频流的时间戳自动校准视频流,以保证接收端听到音频和看到视频在时间上的同步性。 + * @param audio_user_id 音频发送端的用户 ID,将该参数设为空则可解除当前音视频的同步关系。 + * @return + * - 0: 调用成功。调用该接口后音画同步状态发生改变时,你会收到 onAVSyncStateChange{@link #IRTCRoomEventHandler#onAVSyncStateChange} 回调。 + * - < 0 : 调用失败。你也可以通过监听 onAVSyncEvent{@link #IRTCRoomEventHandler#onAVSyncEvent} 获取错误详情。同一 RTC 房间内允许存在多个音视频同步关系,但需注意单个音频源不支持与多个视频源同时同步。 + * @note + * - 该方法在进房前后均可调用。 + * - 进行音画同步的音频发布用户 ID 和视频发布用户 ID 须在同一个 RTC 房间内。 + * - 如需更换同步音频源,再次调用该接口传入新的 `audio_user_id` 即可;如需更换同步视频源,需先解除当前的同步关系,后在新视频源端开启同步。 + * @list 音视频传输 + */ + + virtual int setMultiDeviceAVSync(const char* audio_user_id) = 0; + + /** + * + * @hidden for internal use only. + */ + + virtual int setCustomUserRole(const char* role) = 0; + /** + * + * @type api + * @brief 开始跨房间转发媒体流。
    + * 在调用 joinRoom{@link #IRTCRoom#joinRoom} 后调用本接口,实现向多个房间转发媒体流,适用于跨房间连麦等场景。 + * @param configuration 跨房间媒体流转发指定房间的信息。参看 ForwardStreamConfiguration{@link #ForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged} 回调。 + * - 调用本方法后,你可以通过监听 onForwardStreamEvent{@link #IRTCRoomEventHandler#onForwardStreamEvent} 回调来获取各个目标房间在转发媒体流过程中的相关事件。 + * - 开始转发后,目标房间中的用户将接收到本地用户进房 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 和发流 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * - 调用本方法后,可以调用 updateForwardStreamToRooms{@link #IRTCRoom#updateForwardStreamToRooms} 更新目标房间信息,例如,增加或减少目标房间等。 + * - 调用本方法后,可以调用 stopForwardStreamToRooms{@link #IRTCRoom#stopForwardStreamToRooms} 停止向所有房间转发媒体流。 + * - 调用本方法后,可以调用 pauseForwardStreamToAllRooms{@link #IRTCRoom#pauseForwardStreamToAllRooms} 暂停向所有房间转发媒体流。 + * @list 音视频传输 + */ + + virtual int startForwardStreamToRooms(const ForwardStreamConfiguration& configuration) = 0; + /** + * + * @type api + * @brief 更新跨房间媒体流转发信息。
    + * 通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 发起媒体流转发后,可调用本方法增加或者减少目标房间,或更新房间密钥。
    + * 调用本方法增加或删减房间后,将在本端触发 onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged} 回调,包含发生了变动的目标房间中媒体流转发状态。 + * @param configuration 跨房间媒体流转发目标房间信息。参看 ForwardStreamConfiguration{@link #ForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * 增加或删减目标房间后,新增目标房间中的用户将接收到本地用户进房 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 和发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * @list 音视频传输 + */ + + virtual int updateForwardStreamToRooms(const ForwardStreamConfiguration& configuration) = 0; + /** + * + * @type api + * @brief 停止跨房间媒体流转发。
    + * 通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 发起媒体流转发后,可调用本方法停止向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged} 回调。 + * - 调用本方法后,原目标房间中的用户将接收到本地用户停止发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调和退房 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 的回调。 + * - 如果需要停止向指定的房间转发媒体流,请调用 updateForwardStreamToRooms{@link #IRTCRoom#updateForwardStreamToRooms} 更新房间信息。 + * - 如果需要暂停转发,请调用 pauseForwardStreamToAllRooms{@link #IRTCRoom#pauseForwardStreamToAllRooms},并在之后随时调用 resumeForwardStreamToAllRooms{@link #IRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @list 音视频传输 + */ + + virtual int stopForwardStreamToRooms() = 0; + /** + * + * @type api + * @brief 暂停跨房间媒体流转发。
    + * 通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 发起媒体流转发后,可调用本方法暂停向所有目标房间转发媒体流。
    + * 调用本方法暂停向所有目标房间转发后,你可以随时调用 resumeForwardStreamToAllRooms{@link #IRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note 调用本方法后,目标房间中的用户将接收到本地用户停止发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调和退房 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 的回调。 + * @list 音视频传输 + */ + + virtual int pauseForwardStreamToAllRooms() = 0; + /** + * + * @type api + * @brief 恢复跨房间媒体流转发。
    + * 调用 pauseForwardStreamToAllRooms{@link #IRTCRoom#pauseForwardStreamToAllRooms} 暂停转发之后,调用本方法恢复向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 + * @note + * 目标房间中的用户将接收到本地用户进房 onUserJoined{@link #IRTCRoomEventHandler#onUserJoined} 和发布 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调。 + * @list 音视频传输 + */ + + virtual int resumeForwardStreamToAllRooms() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 获取范围语音接口实例。 + * @return 方法调用结果:
    + * - IRangeAudio:成功,返回一个 IRangeAudio{@link #IRangeAudio} 实例。 + * - nullptr:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + + virtual IRangeAudio* getRangeAudio() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 获取空间音频接口实例。 + * @return 方法调用结果:
    + * - ISpatialAudio:成功,返回一个 ISpatialAudio{@link #ISpatialAudio} 实例。 + * - nullptr:失败,当前 SDK 不支持空间音频功能。 + * @note + * - 首次调用该方法须在创建房间后、加入房间前。空间音频相关 API 和调用时序详见[空间音频](https: + * - 只有在使用支持真双声道播放的设备时,才能开启空间音频效果; + * - 机型性能不足可能会导致音频卡顿,使用低端机时,不建议开启空间音频效果; + * - SDK 最多支持 30 个用户同时开启空间音频功能。 + * @list 高级功能 + */ + + virtual ISpatialAudio* getSpatialAudio() = 0; + /** + * + * @type api + * @brief 调节某个房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
    + * - 该方法与 setRemoteAudioPlaybackVolume{@link #IRTCEngine#setRemoteAudioPlaybackVolume} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume{@link #IRTCEngine#setPlaybackVolume} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + + virtual int setRemoteRoomAudioPlaybackVolume(int volume) = 0; + /** + * + * @hidden for internal use only on Windows and Android + * @type api + * @brief 接收端调用本接口获取全景视频接口引擎。 + * @return 方法调用结果:
    + * - IPanoramicVideo:成功,返回一个 IPanoramicVideo{@link #IPanoramicVideo} 实例。 + * - null:失败,当前 SDK 不支持全景视频功能。 + * @note + * - 接收端的调用时序为 createRTCEngine{@link #IRTCEngine#createRTCEngine} > createRTCRoom{@link #IRTCEngine#createRTCRoom} > 本接口 > joinRoom{@link #IRTCRoom#joinRoom}。 + * - 获取 IPanoramicVideo 实例后,再调用 updateQuaternionf{@link #IPanoramicVideo#updateQuaternionf} 更新头位姿四元数。 + * - 你需要使用外部渲染器对接收到的全景视频进行渲染,参见 setRemoteVideoSink{@link #IRTCEngine#setRemoteVideoSink}。 + * @list 视频管理 + */ + + virtual IPanoramicVideo* getPanoramicVideo() = 0; + /** + * + * @valid since 3.52. + * @type api + * @brief 设置本端发布流在音频选路中的优先级。 + * @param audio_selection_priority 本端发布流在音频选路中的优先级,默认正常参与音频选路。参见 AudioSelectionPriority{@link #AudioSelectionPriority}。 + * @note + * - 在控制台上为本 appId 开启音频选路后,调用本接口才会生效。进房前后调用均可生效。更多信息参见[音频选路](https: + * - 如果本端用户同时加入不同房间,使用本接口进行的设置相互独立。 + * @list 音频管理 + */ + + virtual int setAudioSelectionConfig(AudioSelectionPriority audio_selection_priority) = 0; + /** + * + * @valid since 3.52. + * @type api + * @brief 设置/更新房间附加信息,可用于标识房间状态或属性,或灵活实现各种业务逻辑。 + * @param key 房间附加信息键值,长度小于 10 字节。
    + * 同一房间内最多可存在 5 个 key,超出则会从第一个 key 起进行替换。 + * @param value 房间附加信息内容,长度小于 128 字节。 + * @return + * - 0: 方法调用成功,返回本次调用的任务编号; + * - <0: 方法调用失败,具体原因详见 SetRoomExtraInfoResult{@link #SetRoomExtraInfoResult}。 + * @note + * - 在设置房间附加信息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。 + * - 调用该方法后,会收到一次 onSetRoomExtraInfoResult{@link #IRTCRoomEventHandler#onSetRoomExtraInfoResult} 回调,提示设置结果。 + * - 调用该方法成功设置附加信息后,同一房间内的其他用户会收到关于该信息的回调 onRoomExtraInfoUpdate{@link #IRTCRoomEventHandler#onRoomExtraInfoUpdate}。 + * - 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + + virtual int64_t setRoomExtraInfo(const char*key,const char*value) = 0; + /** + * + * @valid since 3.52 + * @type api + * @brief 识别或翻译房间内所有用户的语音,形成字幕。
    + * 调用该方法时,可以在 SubtitleMode{@link #SubtitleMode} 中选择语音识别或翻译模式。如果选择识别模式,语音识别文本会通过 onSubtitleMessageReceived{@link #IRTCRoomEventHandler#onSubtitleMessageReceived} 事件回调给你;
    + * 如果选择翻译模式,你会同时收到两个 onSubtitleMessageReceived{@link #IRTCRoomEventHandler#onSubtitleMessageReceived} 回调,分别包含字幕原文及字幕译文。
    + * 调用该方法后,用户会收到 onSubtitleStateChanged{@link #IRTCRoomEventHandler#onSubtitleStateChanged} 回调,通知字幕是否开启。 + * @param subtitle_config 字幕配置信息。参看 SubtitleConfig{@link #SubtitleConfig}。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @note + * - 使用字幕功能前,你需要在 [RTC 控制台](https: + * - 如果你需要使用流式语音识别模式,你应在 [豆包语音控制台](https: + * - 如果你需要使用实时语音翻译模式,你应开通机器翻译服务,参考 [开通服务](https: + * - 此方法需要在进房后调用。 + * - 如需指定源语言,你需要在调用 `joinRoom` 接口进房时,通过 extraInfo 参数传入格式为`"语种英文名": "语种代号"` JSON 字符串,例如设置源语言为英文时,传入 `"source_language": "en"`。如未指定源语言,SDK 会将系统语种设定为源语言。如果你的系统语种不是中文、英文和日文,此时 SDK 会自动将中文设为源语言。 + * - 识别模式下,你可以传入 [RTC 控制台](https: + * - 翻译模式下,你需要传入机器翻译规定的语种英文名和语种代号。翻译模式下支持的语言及对应的代号参看[翻译模式语言支持](https: + * @list 字幕翻译服务 + */ + + virtual int startSubtitle(const SubtitleConfig& subtitle_config) = 0; + /** + * + * @valid since 3.52 + * @type api + * @brief 关闭字幕。
    + * 调用该方法后,用户会收到 onSubtitleStateChanged{@link #IRTCRoomEventHandler#onSubtitleStateChanged} 回调,通知字幕是否关闭。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @list 字幕翻译服务 + */ + + virtual int stopSubtitle() = 0; + /** + * + * @valid since 3.53 + * @type api + * @brief 获取房间 ID。 + * @return 房间 ID。 + * @list 房间管理 + */ + + virtual const char* getRoomId() = 0; + + /** + * + * @type api + * @valid since 3.60. + * @brief 获取通话 ID。
    + * 该方法需要在加入房间后调用。当创建一个房间开启音视频通话后,系统会为该房间生成一个对应的通话 ID,标识此房间的通话。 + * @return 通话 ID。 + * @list 房间管理 + */ + + virtual const char* getCallId() = 0; + + /** + * + * @valid since 3.60. + * @type api + * @brief 设置房间直播模式。
    + * 该方法需要在加入房间后调用。 + * @param live_mode 直播模式。参看 RoomLiveMode{@link #RoomLiveMode} 。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @list 房间管理 + */ + + virtual int setLiveMode(RoomLiveMode live_mode) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room_event_handler.h new file mode 100644 index 0000000..1833721 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room_event_handler.h @@ -0,0 +1,582 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Event Handler Interface +*/ + +#pragma once + +#include "rtc/bytertc_defines.h" +#include "bytertc_rts_room_event_handler.h" + +namespace bytertc { +/** + * + * @type callback + * @brief RTS房间事件回调接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +class IRTCRoomEventHandler : public IRTSRoomEventHandler { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRTCRoomEventHandler() { + } + /** + * + * @hidden + * @type callback + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - 1: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * - 2: 离开房间。 + * @param reason 房间状态发生变化的原因。参见 RoomStateChangeReason{@link #RoomStateChangeReason}。 + * @list 房间管理 + */ + + virtual void onRoomStateChangedWithReason( + const char* room_id, const char* uid, RoomState state, RoomStateChangeReason reason) { + (void)room_id; + (void)uid; + (void)state; + (void)reason; + } + /** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调取代 `onStreamStateChanged` 回调,用于报告视频发布状态改变。如果您已升级 SDK 至版本 3.60 或以上,仍在使用 `onStreamStateChanged` 回调,请迁移至该回调。 + * @region 房间管理 + * @brief 视频发布状态改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 发布状态码,参看 PublishState{@link #PublishState}。 + * @param reason 本地视频流发布状态改变的具体原因,参看 PublishStateChangeReason{@link #PublishStateChangeReason}。 + * @note 除了本地视频流发布状态改变时触发,本端用户进房时也会收到本回调。 + * @list 音视频传输 + */ + + virtual void onVideoPublishStateChanged( + const char* stream_id, const StreamInfo& stream_info, PublishState state, PublishStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. + * @region 房间管理 + * @brief 音频发布状态改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 发布状态码,参看 PublishState{@link #PublishState}。 + * @param reason 本地音频流发布状态改变的具体原因,参看 PublishStateChangeReason{@link #PublishStateChangeReason}。 + * @note 除了状态改变时触发,本端用户进房时也会收到本回调。 + * @list 音视频传输 + */ + + virtual void onAudioPublishStateChanged( + const char* stream_id, const StreamInfo& stream_info, PublishState state, PublishStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onStreamStateChanged` 和 `onStreamSubscribed` 方法,用于报告视频流订阅状态的改变。如果您已升级到 SDK 版本 3.60 或以上,仍在使用这两个方法,请迁移到该回调。 + * @region 房间管理 + * @brief 视频订阅状态发生改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 订阅状态码,参看 SubscribeState{@link #SubscribeState}。 + * @param reason 视频流订阅状态改变的具体原因,参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo} 后会收到该通知。 + * @list 音视频传输 + */ + + virtual void onVideoSubscribeStateChanged( + const char* stream_id, const StreamInfo& stream_info, SubscribeState state, SubscribeStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. + * @region 房间管理 + * @brief 音频订阅状态发生改变回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param state 订阅状态码,参看 SubscribeState{@link #SubscribeState}。 + * @param reason 音频订阅状态改变的具体原因,参看 SubscribeStateChangeReason{@link #SubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 后会收到该通知。 + * @list 音视频传输 + */ + + virtual void onAudioSubscribeStateChanged( + const char* stream_id, const StreamInfo& stream_info, SubscribeState state, SubscribeStateChangeReason reason) { + (void)stream_id; + (void)stream_info; + (void)state; + (void)reason; + } + + /** + * + * @hidden + * @deprecated since 3.41 and will be deleted in 3.51, use onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} and onStreamStateChanged instead. + * @type callback + * @brief SDK 发生警告回调。
    + * SDK 内部遇到可恢复错误时,在尝试自动恢复的同时,会通过此回调通知用户。此回调事件仅用作通知。 + * @param warn 警告码,参看 WarningCode{@link #WarningCode}。 + * @list 房间管理 + */ + + BYTERTC_DEPRECATED virtual void onRoomWarning(int warn) { + (void)warn; + } + /** + * + * @type callback + * @brief 当 SDK 检测到 Token 的进房权限将在 30 秒内过期时,触发该回调。 + * 收到该回调后,你需调用 updateToken{@link #IRTSRoom#updateToken} 更新 Token 进房权限。 + * @note 若未能及时更新 Token 进房权限导致其过期而失效:
    + * - 用户此时尝试进房会收到 回调,提示错误码为 `-1000` Token 过期; + * - 用户已在房间内则会被移出房间,本地用户会收到 回调,提示错误码为 `-1009` Token 过期,同时远端用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调,提示原因为 `2` Token 进房权限过期。 + * @list 引擎管理 + */ + + virtual void onTokenWillExpire() { + + } + /** + * + * @type callback + * @brief Token 发布权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken{@link #IRTSRoom#updateToken} 更新 Token 发布权限。 + * @note Token 发布权限过期后: + * - 已发布流或尝试发布流时,本端会收到 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调,提示`kPublishStateChangeReasonNoPublishPermission`,没有发布权限。 + * - 发布中的流将停止发布。远端用户会收到 onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}、onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio} 回调,提示该流已停止发布。 + * @list 引擎管理 + */ + + virtual void onPublishPrivilegeTokenWillExpire() { + + } + /** + * + * @type callback + * @brief Token 订阅权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken{@link #IRTSRoom#updateToken} 更新 Token 订阅权限有效期。 + * @note 若收到该回调后未及时更新 Token,Token 订阅权限过期后,尝试新订阅流会失败,已订阅的流会取消订阅,并且会收到 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调,提示`kSubscribeStateChangeReasonNoSubscribePermission`,没有订阅权限。 + * @list 引擎管理 + */ + + virtual void onSubscribePrivilegeTokenWillExpire() { + + } + /** + * + * @type callback + * @brief 房间内通话统计信息回调。
    + * 用户进房开始通话后,每 2s 收到一次本回调。 + * @param stats 当前 RtcEngine 统计数据,详见 RtcRoomStats{@link #RtcRoomStats} + * @list 房间管理 + */ + + virtual void onRoomStats(const RtcRoomStats& stats) { + (void)stats; + } + /** + * + * @hidden for internal use only + * @type callback + * @brief 房间事件回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间事件状态。详见 RoomEvent{@link #RoomEvent}。 + * @param info 房间封禁时,包含封禁时间。详见 RoomEventInfo{@link #RoomEventInfo}。 + * @list 房间管理 + */ + + virtual void onRoomEvent(const char* room_id, const char* uid, RoomEvent state, const RoomEventInfo& info) { + (void)room_id; + (void)uid; + (void)state; + (void)info; + } + /** + * + * @hidden(Linux) + * @type callback + * @brief 本地流数据统计以及网络质量回调。
    + * 本地用户发布流成功后,SDK 会周期性(2s)地通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
    + * 统计信息通过 LocalStreamStats{@link #LocalStreamStats} 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param stats 当前 RtcEngine 统计数据,详见 LocalStreamStats{@link #LocalStreamStats}。 + * @list 音视频传输 + */ + + virtual void onLocalStreamStats(const char* stream_id, const bytertc::StreamInfo& stream_info, const LocalStreamStats& stats) { + (void)stream_id; + (void)stream_info; + (void)stats; + } + /** + * + * @type callback + * @brief 本地订阅的远端音/视频流数据统计以及网络质量回调。
    + * 本地用户订阅流成功后,SDK 会周期性(2s)地通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param stats 当前 RtcEngine 统计数据,详见 RemoteStreamStats{@link #RemoteStreamStats} + * @list 音视频传输 + */ + + virtual void onRemoteStreamStats(const char* stream_id, const bytertc::StreamInfo& stream_info, const RemoteStreamStats& stats) { + (void)stream_id; + (void)stream_info; + (void)stats; + } + /** + * + * @type callback + * @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
    + * 1. 远端用户调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
    + * 2. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
    + * 3. 房间内隐身远端用户调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法切换至可见时,房间内其他用户将收到该事件。
    + * 4. 新进房用户会收到进房前已在房内的可见用户的进房回调通知。 + * @param user_info 用户信息,详见 UserInfo{@link #UserInfo} + * @list 房间管理 + */ + + virtual void onUserJoined(const UserInfo& user_info) { + (void)user_info; + } + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in 3.51, use onUserUnpublishStream and onUserUnpublishScreen instead. + * @type callback + * @brief 房间内的远端用户停止发布音视频流时,本地用户会收到此回调。 + * @param stream 流的属性。参看 MediaStreamInfo{@link #MediaStreamInfo} 。 + * @param reason 远端流移除的原因。参看 StreamRemoveReason{@link #StreamRemoveReason} 。 + * @list 房间管理 + */ + + BYTERTC_DEPRECATED virtual void onStreamRemove(const MediaStreamInfo& stream, StreamRemoveReason reason) { + (void)stream; + } + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in 3.51, use onUserPublishStream and onUserPublishScreen instead. + * @type callback + * @brief 房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调。包括移除后又重新发布的流。 + * @param stream 流属性,参看 MediaStreamInfo{@link #MediaStreamInfo} 。 + * @list 房间管理 + */ + + BYTERTC_DEPRECATED virtual void onStreamAdd(const MediaStreamInfo& stream) { + (void)stream; + } + + /** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onUserPublishStream` 、`onUserUnpublishStream` 、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法。如果您已升级到 SDK 版本 3.60 或以上,且仍在使用这些方法,请迁移到该回调。 + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布视频流的回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param is_publish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamVideo{@link #IRTCRoom#publishStreamVideo} 成功发布采集的视频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamVideo{@link #IRTCRoom#subscribeStreamVideo} 订阅此流。 + * @list 音视频传输 + */ + + virtual void onUserPublishStreamVideo(const char* stream_id, const StreamInfo& stream_info, bool is_publish){ + (void)stream_id; + (void)stream_info; + (void)is_publish; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onUserPublishStream`、`onUserUnpublishStream`、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用这些方法,请迁移至该回调。 + * @brief 房间内远端用户发布或取消发布音频流的回调。 + * @param stream_id 流 ID。 + * @param stream_info 流信息。 + * @param is_publish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamAudio{@link #IRTCRoom#publishStreamAudio} 成功发布音频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamAudio{@link #IRTCRoom#subscribeStreamAudio} 订阅此流。 + * @list 音视频传输 + * @order 2 + */ + + virtual void onUserPublishStreamAudio(const char* stream_id, const StreamInfo& stream_info, bool is_publish){ + (void)stream_id; + (void)stream_info; + (void)is_publish; + } + + /** + * + * @hidden for internal use only + * @type callback + * @brief 当发布流成功的时候回调该事件。 + * @param user_id 发布流的用户 ID。 + * @param is_screen 该流是否为屏幕流。
    + * - Ture: 屏幕流。 + * - False: 非屏幕流。 + * @list 音视频传输 + */ + + virtual void onStreamPublishSuccess(const char* user_id, bool is_screen) { + (void)is_screen; + } + + /** + * + * @hidden for internal use only + */ + + virtual void onRoomModeChanged(RtcRoomMode mode) { + (void)mode; + } + + /** + * + * @hidden for internal use only + * @brief callback when the maximum screen share fps is changed + * @param fps maximum screen share fps + */ + + virtual void onMaximumScreenShareFpsUpdated(int fps) { + (void)fps; + } + + /** + * + * @hidden for internal use only + * @brief 最大屏幕共享帧率改变时的回调 + * @param screen_pixels 为了保持帧率而推荐的最大视频宽度×高度的值。 + */ + + virtual void onMaximumScreenSharePixelsUpdated(int screen_pixels) { + (void)screen_pixels; + } + /** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。 + * @param uid 被禁用/解禁的视频流用户 ID + * @param banned 视频流发送状态
    + * - true: 视频流发送被禁用 + * - false: 视频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁视频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音视频传输 + */ + + virtual void onVideoStreamBanned(const char* uid, bool banned) { + (void)uid; + (void)banned; + } + /** + * + * @type callback + * @brief 发布端调用 setMultiDeviceAVSync{@link #IRTCRoom#setMultiDeviceAVSync} 后音视频同步状态发生改变时,会收到此回调。 + * @param state 音视频同步状态,参看 AVSyncState{@link #AVSyncState}。 + * @list 音视频传输 + */ + + virtual void onAVSyncStateChange(AVSyncState state) { + (void)state; + } + /** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户音频流的发送时,触发此回调。 + * @param uid 被禁用/解禁的音频流用户 ID + * @param banned 音频流发送状态
    + * - true: 音频流发送被禁用 + * - false: 音频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁音频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 在控制台开启音频选路后,只有被封禁/解禁用户会收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音频管理 + */ + + virtual void onAudioStreamBanned(const char* uid, bool banned) { + (void)uid; + (void)banned; + } + /** + * + * @type callback + * @brief 跨房间媒体流转发状态和错误回调 + * @param infos 跨房间媒体流转发目标房间信息数组,详见 ForwardStreamStateInfo{@link #ForwardStreamStateInfo} + * @param info_count 数组长度,代表目标房间数 + * @list 音视频传输 + */ + + virtual void onForwardStreamStateChanged(ForwardStreamStateInfo* infos, int info_count) { + } + /** + * + * @type callback + * @brief 跨房间媒体流转发事件回调 + * @param infos 跨房间媒体流转发目标房间事件数组,详见 ForwardStreamEventInfo{@link #ForwardStreamEventInfo} + * @param info_count 数组长度,代表目标房间数 + * @list 音视频传输 + */ + + virtual void onForwardStreamEvent(ForwardStreamEventInfo* infos, int info_count) { + } + /** + * + * @type callback + * @brief 加入房间并发布或订阅流后, 以每 2 秒一次的频率,报告本地用户和已订阅的远端用户的上下行网络质量信息。 + * @param local_quality 本端网络质量,详见 NetworkQualityStats{@link #NetworkQualityStats}。 + * @param remote_qualities 已订阅用户的网络质量,详见 NetworkQualityStats{@link #NetworkQualityStats}。 + * @param remote_quality_num `remoteQualities` 数组长度 + * @note 更多通话中的监测接口,详见[通话中质量监测](https: + * @list 音视频传输 + */ + + virtual void onNetworkQuality(const NetworkQualityStats& local_quality, const NetworkQualityStats* remote_qualities, int remote_quality_num) { + } + /** + * + * @valid since 3.52. + * @type callback + * @brief 调用 setRoomExtraInfo{@link #IRTCRoom#setRoomExtraInfo} 设置房间附加信息结果的回调。 + * @param task_id 调用 setRoomExtraInfo 的任务编号。 + * @param result 设置房间附加信息的结果,详见 SetRoomExtraInfoResult{@link #SetRoomExtraInfoResult} + * @list 房间管理 + */ + + virtual void onSetRoomExtraInfoResult(int64_t task_id, SetRoomExtraInfoResult result) { + (void)task_id; + (void)result; + } + /** + * + * @valid since 3.52. + * @type callback + * @brief 接收同一房间内,其他用户调用 setRoomExtraInfo{@link #IRTCRoom#setRoomExtraInfo} 设置的房间附加信息的回调。 + * @param key 房间附加信息的键值 + * @param value 房间附加信息的内容 + * @param last_update_user_id 最后更新本条信息的用户 ID。 + * @param last_update_time_ms 最后更新本条信息的 Unix 时间,单位:毫秒。 + * @note 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + + virtual void onRoomExtraInfoUpdate(const char*key, const char* value, const char* last_update_user_id, int64_t last_update_time_ms) { + (void)key; + (void)value; + (void)last_update_user_id; + (void)last_update_time_ms; + } + /** + * + * @valid since 3.60. + * @type callback + * @brief 接收同一房间内,其他用户调用 setStreamExtraInfo{@link #IRTCRoom#setStreamExtraInfo} 设置的流附加信息的回调。 + * @param stream_id 流 ID + * @param stream_info 流信息,详见 StreamInfo{@link #StreamInfo} + * @param extra_info 流附加信息的内容 + * @note 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + + virtual void onRoomStreamExtraInfoUpdate(const char* stream_id, const StreamInfo& stream_info, const char* extra_info) { + (void)stream_id; + (void)stream_info; + (void)extra_info; + } + /** + * + * @valid since 3.54 + * @type callback + * @brief 用户调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 设置用户可见性的回调。 + * @param current_user_visibility 当前用户的可见性。
    + * - true: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - false: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @param error_code 设置用户可见性错误码,参看 UserVisibilityChangeError{@link #UserVisibilityChangeError}。 + * @list 房间管理 + */ + + virtual void onUserVisibilityChanged(bool current_user_visibility, UserVisibilityChangeError error_code) { + (void)current_user_visibility; + (void)error_code; + } + /** + * + * @type callback + * @brief 字幕状态发生改变回调。
    + * 当用户调用 startSubtitle{@link #IRTCRoom#startSubtitle} 和 stopSubtitle{@link #IRTCRoom#stopSubtitle} 使字幕状态发生改变或出现错误时,触发该回调。 + * @param state 字幕状态。参看 SubtitleState{@link #SubtitleState}。 + * @param error_code 字幕任务错误码。参看 SubtitleErrorCode{@link #SubtitleErrorCode}。 + * @param error_message 与第三方服务有关的错误信息。 + * @list 字幕翻译服务 + */ + + virtual void onSubtitleStateChanged(SubtitleState state, SubtitleErrorCode error_code, const char* error_message) { + } + /** + * + * @type callback + * @brief 字幕相关内容回调。
    + * 当用户调用 startSubtitle{@link #IRTCRoom#startSubtitle} 后会收到此回调,通知字幕的相关信息。 + * @param subtitles 字幕消息内容。参看 SubtitleMessage{@link #SubtitleMessage}。 + * @param cnt 字幕消息个数。 + * @list 字幕翻译服务 + */ + + virtual void onSubtitleMessageReceived(const SubtitleMessage* subtitles, int cnt) { + } + + /** + * + * @type callback + * @valid since 3.60. + * @brief 发布端调用 setMultiDeviceAVSync{@link #IRTCRoom#setMultiDeviceAVSync} 后音视频同步状态发生错误时,会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param event 音视频同步状态错误,参看 AVSyncEvent{@link #AVSyncEvent}。 + * @list 音视频传输 + */ + + virtual void onAVSyncEvent(const char* room_id, const char* uid, AVSyncEvent event) { + } +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room_ex.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room_ex.h new file mode 100644 index 0000000..fee9556 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_room_ex.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface Lite + */ + +#pragma once + +#include "bytertc_room.h" + +namespace bytertc { + +class IRTCRoomEventHandlerEx; +/** + * + * @type api + * @brief IRTCRoomEx Class + */ +class IRTCRoomEx : public IRTCRoom { +public: + /** + * + * @type api + * @region 房间管理 + * @brief 在当前所在房间内发布媒体流 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 MediaStreamType{@link #MediaStreamType} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 如果你已经在用户进房时通过调用 joinRoom{@link #IRTCRoom#joinRoom} 成功选择了自动发布,则无需再调用本接口。
    + * + 调用 setUserVisibility{@link #IRTCRoom#setUserVisibility} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头音视频流。
    + * + 如果你需要向多个房间发布流,调用 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms}。
    + * + 调用此方法后,房间中的所有远端用户会收到 onUserPublishStream{@link #IRTCRoomEventHandler#onUserPublishStream} 回调通知,其中成功收到了音频流的远端用户会收到 onFirstRemoteAudioFrame{@link #IRTCEngineEventHandler#onFirstRemoteAudioFrame} 回调,订阅了视频流的远端用户会收到 onFirstRemoteVideoFrameDecoded{@link #IRTCEngineEventHandler#onFirstRemoteVideoFrameDecoded} 回调。
    + * + 调用 unpublishStream{@link #IRTCRoom#unpublishStream} 取消发布。 + */ + virtual int publishStream(StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 停止将本地摄像头/麦克风采集的媒体流发布到当前所在房间中 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param type 媒体流类型,用于指定停止发布音频/视频,参看 MediaStreamType{@link #MediaStreamType} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * + 调用 publishStream{@link #IRTCRoomEx#publishStream} 手动发布摄像头音视频流后,你需调用此接口停止发布。
    + * + 调用此方法停止发布音视频流后,房间中的其他用户将会收到 onUserUnpublishStream{@link #IRTCRoomEventHandler#onUserUnpublishStream} 回调通知。 + */ + virtual int unpublishStream(StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 订阅房间内指定的媒体流,或更新对指定媒体流的订阅选项 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param user_id 指定订阅的远端发布音视频流的用户 ID。 + * @param type 媒体流类型,用于指定订阅音频/视频。参看 MediaStreamType{@link #MediaStreamType}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * + 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。
    + * + 你必须先通过 onUserPublishStream{@link #IRTCRoomEventHandler#onUserPublishStream} 回调获取当前房间里的远端摄像头音视频流信息,然后调用本方法按需订阅。
    + * + 调用该方法后,你会收到 onStreamSubscribed{@link #IRTCRoomEventHandler#onStreamSubscribed} 通知方法调用结果。
    + * + 成功订阅远端用户的媒体流后,订阅关系将持续到调用 unsubscribeStream{@link #IRTCRoom#unsubscribeStream} 取消订阅或本端用户退房。
    + * + 关于其他调用异常,你会收到 onStreamStateChanged{@link #IRTCRoomEventHandler#onStreamStateChanged} 回调通知,具体异常原因参看 ErrorCode{@link #ErrorCode}。 + */ + virtual int subscribeStream(const char *user_id, StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 取消订阅房间内指定的媒体流。
    + * 该方法对自动订阅和手动订阅模式均适用。 + * @param user_id 指定取消订阅的远端发布音视频流的用户 ID。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param type 媒体流类型,用于指定取消订阅音频/视频。参看 MediaStreamType{@link #MediaStreamType}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * + 调用该方法后,你会收到 onStreamSubscribed{@link #IRTCRoomEventHandler#onStreamSubscribed} 通知方法调用结果。
    + * + 关于其他调用异常,你会收到 onStreamStateChanged{@link #IRTCRoomEventHandler#onStreamStateChanged} 回调通知,具体失败原因参看 ErrorCode{@link #ErrorCode}。 + */ + virtual int unsubscribeStream(const char *user_id, StreamIndex stream_index, MediaStreamType type) = 0; + /** + * + * @type api + * @region 房间管理 + * @brief 通过设置 IRTCRoomEx{@link #IRTCRoomEx} 对象的事件句柄,监听此对象对应的回调事件。 + * @param room_event_handler 参见 IRTCRoomEventHandlerEx{@link #IRTCRoomEventHandlerEx} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + + /** + * + * @type api + * @region 视频管理 + * @brief 设置期望订阅的远端视频流的参数。 + * @param userId 期望配置订阅参数的远端视频流发布用户的 ID。 + * @param stream_index 流索引,参看 StreamIndex{@link #StreamIndex}。 + * @param remoteVideoConfig 期望配置的远端视频流参数,参看 ByteRTCRemoteVideoConfig{@link #ByteRTCRemoteVideoConfig}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + !0:失败。 + * @note + * + 若使用 342 及以前版本的 SDK,调用该方法前请联系技术支持人员开启按需订阅功能。
    + * + 该方法仅在发布端调用 setLocalSimulcastMode:{@link #IRTCEngine#setLocalSimulcastMode:} 开启了发送多路视频流的情况下生效,此时订阅端将收到来自发布端与期望设置的参数最相近的一路流;否则订阅端只会收到一路参数为分辨率 640px × 360px、帧率 15fps 的视频流。
    + * + 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。
    + * + 该方法需在进房后调用,若想进房前设置,你需调用 joinRoom:userInfo:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:roomConfig:},并对 `roomConfig` 中的 `remoteVideoConfig` 进行设置。
    + * + SDK 会根据发布端和所有订阅端的设置灵活调整视频流的参数,具体调整策略详见[推送多路流](https: + */ + +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_rts_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_rts_room.h new file mode 100644 index 0000000..ef6a8f8 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_rts_room.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_rts_defines.h" +#include "rtc/bytertc_media_defines.h" +#include "bytertc_rts_room_event_handler.h" + +namespace bytertc { + +/** + * + * @type api + * @brief RTS 房间接口 + */ + +class IRTSRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoom() { + } + + /** + * + * @type api + * @list 房间管理 + * @brief 退出并销毁调用 createRTSRoom{@link #IRTCEngine#createRTSRoom} 所创建的 RTS 房间实例。 + */ + + virtual void destroy() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 离开 RTC 或 RTS 房间。
    + * 用户调用此方法离开房间,结束通话过程,释放所有通话相关的资源。
    + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
    + * + 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调通知。
    + * + 可见的用户离开房间后,房间内其他用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调通知。
    + * + 如果调用此方法后立即销毁引擎,SDK 将无法触发 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调。
    + * + 调用 joinRoom{@link #IRTCRoom#joinRoom} 或 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 方法加入房间后,必须调用此方法离开房间,否则无法进入下一个房间。无论当前是否在房间内,都可以调用此方法。重复调用此方法没有负面影响。
    + */ + + virtual int leaveRoom() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 设置 IRTSRoom{@link #IRTSRoom} 对象的事件句柄。 + * 通过设置事件句柄可以监听此 IRTSRoom{@link #IRTSRoom} 对象对应的房间的回调事件。 + * @param room_event_handler 回调处理器,详见 IRTSRoomEventHandler{@link #IRTSRoomEventHandler} + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + virtual int setRTSRoomEventHandler(IRTSRoomEventHandler* room_event_handler) = 0; + + /** + * + * @type api + * @list 消息 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param message 用户发送的广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * + 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。
    + * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。 + * + 同一房间内的其他用户会收到 onRoomMessageReceived{@link #IRTSRoomEventHandler#onRoomMessageReceived} 回调。 + */ + + virtual int64_t sendRoomMessage(const char* message) = 0; + /** + * + * @type api + * @list 消息 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param size 发送的二进制消息长度 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * + 在发送房间内二进制消息前,必须先调用 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。
    + * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。
    + * + 同一房间内的其他用户会收到 onRoomBinaryMessageReceived{@link #IRTSRoomEventHandler#onRoomBinaryMessageReceived} 回调。 + */ + + virtual int64_t sendRoomBinaryMessage(int size, const uint8_t* message) = 0; + /** + * + * @type api + * @list 房间管理 + * @brief 创建/加入 RTS 房间。
    + * 同一房间内的用户间可以相互通话。
    + * 进房后重复调用无效,用户必须调用 `leaveRoom` 退出当前房间后,才能加入下一个房间。 + * @param token 用户登录必须携带的 Token,用于鉴权验证。
    + * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,roomId 置为空字符串(即 roomId:""),Token 有效期及生成方式参看[使用 Token 完成鉴权](https: + * @param user_info 用户信息,参看 UserInfo{@link #UserInfo}。 + * @return + * + 0: 成功
    + * + -1:token / user_info 包含了无效的参数。
    + * + -2:已经在房间内。 + * @note
    + * + 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 OnError{@link #IRTCEngineEventHandler#OnError} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。
    + * + 本地用户调用此方法加入房间成功后,会收到回调通知。
    + * + 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,此时 SDK 将会自动重连。重连成功后,本地会收到 回调通知。如果加入房间的用户可见,远端用户会收到 onUserJoined{@link #IRTSRoomEventHandler#onUserJoined}。 + */ + + virtual int joinRTSRoom(const char* token, const UserInfo& user_info) = 0; + /** + * + * @type api + * @brief 更新 Token。
    + * 收到 onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire},onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire}, 或 onSubscribePrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
    + * 如果 Token 无效,你会收到 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged},错误码是 `-1010`。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @note + * - 3.50(不含)以前的版本中,Token 中的发布和订阅权限为保留参数,无实际控制权限;3.50 及以后版本开放 Token 发布订阅控制权限,如需通过 Token 控制连麦权限,请联系技术支持团队开通白名单后支持。 + * - 请勿同时调用 updateToken{@link #IRTSRoom#updateToken} 和 joinRoom{@link #IRTCRoom#joinRoom} 方法更新 Token。若因 Token 过期或无效导致加入房间失败或已被移出房间,你应该在获取新的有效 Token 后调用 joinRoom{@link #IRTCRoom#joinRoom} 重新加入房间。 + * @list 房间管理 + */ + + virtual int updateToken(const char* token) = 0; + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点文本消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内文本消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 或 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。 + * - 调用该函数后会收到一次 onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} 回调,通知消息发送方发送成功或失败; + * - 若文本消息发送成功,则 uid 所指定的用户会收到 onUserMessageReceived{@link #IRTSRoomEventHandler#onUserMessageReceived} 回调。 + * @list 消息 + */ + + virtual int64_t sendUserMessage(const char* uid, const char* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点二进制消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param length 二进制字符串的长度。 + * @param message 二进制消息的内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 或 joinRTSRoom{@link #IRTSRoom#joinRTSRoom} 加入房间。 + * - 调用该函数后会收到一次 onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则 uid 所指定的用户会收到 onUserBinaryMessageReceived{@link #IRTSRoomEventHandler#onUserBinaryMessageReceived} 回调。 + * @list 消息 + */ + + virtual int64_t sendUserBinaryMessage(const char* uid, int length, const uint8_t* message, MessageConfig config = kMessageConfigReliableOrdered) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_rts_room_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_rts_room_event_handler.h new file mode 100644 index 0000000..7e9c70d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/bytertc_rts_room_event_handler.h @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Event Handler Interface +*/ + +#pragma once + +#include "rtc/bytertc_defines.h" + +namespace bytertc { +/** + * + * @type callback + * @brief 实时信令事件回调接口 + */ + +class IRTSRoomEventHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoomEventHandler() {} + + /** + * + * @type callback + * @region 房间管理 + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * + 0: 加入房间成功。
    + * + !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ErrorCode{@link #ErrorCode} 及 WarningCode{@link #WarningCode}。 + * @param extra_info 额外信息,如 `{"elapsed":1187,"join_type":0}`。 + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。 + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom{@link #IRTCRoom#joinRoom} 到加入房间成功所经历的时间间隔,单位为 ms。 + * @list 房间管理 + */ + + virtual void onRoomStateChanged(const char* room_id, const char* uid, + int state, const char* extra_info) { + (void)room_id; + (void)state; + (void)extra_info; + } + + /** + * + * @type callback + * @brief 离开房间回调。
    + * 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并在释放所有与通话相关的音频资源后,通过此回调通知用户离开房间成功。
    + * @param stats 保留参数,目前为空。 + * @note
    + * + 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #IRTSRoom#destroy} 销毁房间实例方法销毁 RTS 引擎,则将无法收到此回调事件。
    + * + 离开房间后,如果 App 需要使用系统音频设备,则建议收到此回调后再初始化音频设备,否则可能由于 SDK 占用音频设备而导致初始化失败。
    + * @list 房间管理 + */ + + virtual void onLeaveRoom(const RtcRoomStats& stats) { + (void)stats; + } + + /** + * + * @type callback + * @region 房间管理 + * @brief 远端用户加入房间的回调。 + * @param user_info 用户信息,详见 UserInfo{@link #UserInfo} + * @list 房间管理 + */ + + virtual void onUserJoined(const UserInfo& user_info) { + (void)user_info; + } + + /** + * + * @type callback + * @brief 远端用户离开房间时,本地用户会收到此事件 + * @param uid 离开房间的远端用户 ID。
    + * @param reason 用户离开房间的原因。参看 UserOfflineReason{@link #UserOfflineReason}。 + * @list 房间管理 + */ + + virtual void onUserLeave(const char* uid, UserOfflineReason reason) { + (void)uid; + (void)reason; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内广播消息的回调。 + * @param uid 消息发送者 ID。 + * @param message 收到的消息内容。 + * @note 同一房间内其他用户调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 发送广播消息时会收到该回调。 + * @list 消息 + */ + + virtual void onRoomMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内二进制广播消息的回调。 + * @param uid 消息发送者 ID。 + * @param size
    + * 收到的二进制消息长度 + * @param message 收到的二进制消息内容。 + * @note 同一房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送二进制广播消息时会收到该回调。 + * @list 消息 + */ + + virtual void onRoomBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 当调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 函数发送消息后,回调此条消息的发送结果(反馈)。 + * @param msgid 消息的 ID。 + * @param error 消息发送结果。详见 RoomMessageSendResult{@link #RoomMessageSendResult}。 + * @list 消息 + */ + + virtual void onRoomMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserMessageReceived{@link #IRTSRoomEventHandler#onUserMessageReceived-2} 代替。 + * @brief 收到来自房间中其他用户通过 sendUserMessage{@link #IRTSRoom#sendUserMessage} 发来的点对点文本消息时,会收到此回调。 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @note + * 你必须先调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 方法,才能收到该回调。 + * @list 消息 + */ + + virtual void onUserMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage{@link #IRTSRoom#sendUserBinaryMessage} 发来的点对点二进制消息时,会收到此回调。
    + * > 该接口将于 3.64 被 onUserBinaryMessageReceived{@link #IRTSRoomEventHandler#onUserBinaryMessageReceived-2} 代替。 + * @param uid 消息发送者 ID。 + * @param size 收到的消息长度。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param msgid 消息的 ID。 + * @param error 文本或二进制消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult} + * @note + * 你必须先调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 或 sendUserBinaryMessage{@link #IRTSRoom#sendUserBinaryMessage} 接口,才能收到此回调。 + * @list 消息 + */ + + virtual void onUserMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + + /** + * + * @type callback + * @brief 接收到房间内广播消息的回调。
    + * 同一房间内其他用户调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 发送广播消息时会收到该回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者的 ID。 + * @param message 收到的消息内容。 + * @list 消息 + */ + + virtual void onRoomMessageReceived(int64_t msgid, const char* uid, const char* message) { + (void)msgid; + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送广播二进制消息时,收到此回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的二进制消息内容。 + * @param size 收到的二进制消息长度。 + * @note 同一房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送二进制广播消息时会收到该回调。 + * @list 消息 + */ + + virtual void onRoomBinaryMessageReceived(int64_t msgid, const char* uid, const uint8_t* message, int size) { + (void)msgid; + (void)uid; + (void)message; + (void)size; + } + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage{@link #IRTSRoom#sendUserMessage} 发来的点对点文本消息时,会收到此回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @note + * 你必须先调用 sendUserMessage{@link #IRTSRoom#sendUserMessage} 方法,才能收到该回调。 + * @list 消息 + */ + + virtual void onUserMessageReceived(int64_t msgid, const char* uid, const char* message) { + (void)msgid; + (void)uid; + (void)message; + } + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage{@link #IRTSRoom#sendUserBinaryMessage} 发来的点对点二进制消息时,会收到此回调。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @param size 消息长度。 + * @list 消息 + */ + + virtual void onUserBinaryMessageReceived(int64_t msgid, const char* uid, const uint8_t* message, int size) { + (void)msgid; + (void)uid; + (void)message; + (void)size; + } +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts.h new file mode 100644 index 0000000..8b0d88a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts.h @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Interface + */ + +#pragma once + +#include +#include +#include +#include +#include "rtc/bytertc_rts_defines.h" +#include "byterts_event_handler.h" +#include "byterts_room.h" + +namespace byterts { + +class IRTSRoomEventHandler; +/** + * + * @type api + * @brief 引擎API + * IRtcEngine用IRTSEventHandler 注册接口类方法向应用程序发送回调通知 + */ + +class IRTS { +public: + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTS() { + } + + /** + * + * @type api + * @region 引擎管理 + * @brief 设置业务标识参数
    + * 可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。 + * @param business_id
    + * 用户设置的自己的 businessId 值 + * businessId 只是一个标签,颗粒度需要用户自定义。 + * @return
    + * + 0: 成功
    + * + < 0: 失败,具体原因参照 BusinessCheckCode{@link #BusinessCheckCode} 。
    + * + -6001: 用户已经在房间中。
    + * + -6002: 输入非法,合法字符包括所有小写字母、大写字母和数字,除此外还包括四个独立字符,分别是:英文句号,短横线,下划线和 @ 。 + * @note
    + * + 需要在进房之前调用,进房之后调用该方法无效。 + */ + + virtual int setBusinessId(const char* business_id) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 登录 RTS 服务器。 + * 必须先登录,才能发送点对点消息和向应用服务器发送消息
    + * 在调用本接口登录后,如果想要登出,需要调用 logout{@link #IRTS#logout}。
    + * @param [in]token 用户登录必须携带的 Token,用于鉴权验证。 + * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,`roomId` 置空,Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。 + * @param uid
    + * 用户 ID
    + * 用户 ID 在 appid 的维度下是唯一的。 + * @return
    + * + `0`:成功
    + * + `-1`:失败。无效参数
    + * + `-2`:无效调用。用户已经登录。成功登录后再次调用本接口将收到此返回值
    + * @note 本地用户调用此方法登录后,会收到 onLoginResult{@link #IRTSEventHandler#onLoginResult} 回调通知登录结果,远端用户不会收到通知。 + */ + + virtual int login(const char* token, const char* uid) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
    + * + 调用本接口登出前,必须先调用 login{@link #IRTS#login} 登录。
    + * + 本地用户调用此方法登出后,会收到 onLogout{@link #IRTSEventHandler#onLogout} 回调通知结果,远端用户不会收到通知。 + */ + + virtual int logout() = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 更新用户用于登录的 Token
    + * Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
    + * 调用 login{@link #IRTS#login} 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 onLoginResult{@link #IRTSEventHandler#onLoginResult} 回调通知,错误码为 kLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。 + * @param token
    + * 更新的动态密钥 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
    + * + 如果 Token 无效导致登录失败,则调用此方法更新 Token 后,SDK 会自动重新登录,而用户不需要自己调用 login{@link #IRTS#login} 方法。
    + * + Token 过期时,如果已经成功登录,则不会受到影响。Token 过期的错误会在下一次使用过期 Token 登录时,或因本地网络状况不佳导致断网重新登录时通知给用户。 + */ + + virtual int updateLoginToken(const char* token) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 设置应用服务器参数
    + * 客户端调用 sendServerMessage{@link #IRTS#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTS#sendServerBinaryMessage} 发送消息给业务服务器之前,必须设置有效签名和业务服务器地址。 + * @param signature 动态签名,应用服务器可使用该签名验证消息来源。
    + * 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。
    + * 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 + * @param url 应用服务器的地址 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
    + * + 用户必须调用 login{@link #IRTS#login} 登录后,才能调用本接口。
    + * + 调用本接口后,SDK 会使用 onServerParamsSetResult{@link #IRTSEventHandler#onServerParamsSetResult} 返回相应结果。 + */ + + virtual int setServerParams(const char* signature, const char* url) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 查询对端用户或本端用户的登录状态 + * @param peer_user_id
    + * 需要查询的用户 ID + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
    + * + 必须调用 login{@link #IRTS#login} 登录后,才能调用本接口。
    + * + 调用本接口后,SDK 会使用 onGetPeerOnlineStatus{@link #IRTSEventHandler#onGetPeerOnlineStatus} 回调通知查询结果。
    + * + 在发送房间外消息之前,用户可以通过本接口了解对端用户是否登录,从而决定是否发送消息。也可以通过本接口查询自己的登录状态。 + */ + + virtual int getPeerOnlineStatus(const char* peer_user_id) = 0; + + /** + * + * @type api + * @region 实时消息通信 + * @brief 给房间外指定的用户发送文本消息(P2P) + * @param uid
    + * 消息接收用户的 ID + * @param message
    + * 发送的文本消息内容
    + * 消息不超过 62KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return
    + * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
    + * + -1:发送失败,RtcEngine 实例未创建
    + * + -2:发送失败,uid 为空 + * @note
    + * + 在发送点对点文本消息,必须先调用 login{@link #IRTS#login} 完成登录。
    + * + 用户调用本接口发送文本信息后,会收到一次 onMessageSendResult{@link #IRTSEventHandler#onMessageSendResult} 回调,得知消息是否成功发送。
    + * + 若文本消息发送成功,则 uid 所指定的用户会通过 onMessageReceived{@link #IRTSEventHandler#onMessageReceived} 回调收到该消息。 + */ + + virtual int64_t sendMessage(const char* uid, const char* message, bytertc::MessageConfig config) = 0; + /** + * + * @type api + * @region 实时消息通信 + * @brief 给房间外指定的用户发送二进制消息(P2P) + * @param uid
    + * 消息接收用户的 ID + * @param length
    + * 二进制字符串的长度 + * @param message
    + * 发送的二进制消息内容
    + * 消息不超过 64KB。 + * @param config 消息类型,参看 MessageConfig{@link #MessageConfig}。 + * @return
    + * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
    + * + -1:发送失败,RtcEngine 实例未创建
    + * + -2:发送失败,uid 为空 + * @note
    + * + 在发送点对点二进制消息前,必须先调用 login{@link #IRTS#login} 完成登录。
    + * + 用户调用本接口发送二进制消息后,会收到一次 onMessageSendResult{@link #IRTSEventHandler#onMessageSendResult} 回调,通知消息是否发送成功。
    + * + 若二进制消息发送成功,则 uid 所指定的用户会通过 onBinaryMessageReceived{@link #IRTSEventHandler#onBinaryMessageReceived} 回调收到该条消息。 + */ + + virtual int64_t sendBinaryMessage(const char* uid, int length, const uint8_t* message, bytertc::MessageConfig config) = 0; + /** + * + * @type api + * @region 实时消息通信 + * @brief 客户端给应用服务器发送文本消息(P2Server) + * @param message
    + * 发送的文本消息内容
    + * 消息不超过 62KB。 + * @return
    + * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
    + * + -1:发送失败,RtcEngine 实例未创建 + * @note
    + * + 在向业务服务器发送文本消息前,必须先调用 login{@link #IRTS#login} 完成登录,随后调用 setServerParams{@link #IRTS#setServerParams} 设置业务服务器。
    + * + 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTSEventHandler#onServerMessageSendResult} 回调,通知消息发送方是否发送成功。
    + * + 若文本消息发送成功,则之前调用 setServerParams{@link #IRTS#setServerParams} 设置的业务服务器会收到该条消息。 + */ + + virtual int64_t sendServerMessage(const char* message) = 0; + /** + * + * @type api + * @region 实时消息通信 + * @brief 客户端给应用服务器发送二进制消息(P2Server) + * @param length
    + * 二进制字符串的长度 + * @param message
    + * 发送的二进制消息内容
    + * 消息不超过 64KB。 + * @return
    + * + >0:发送成功,返回这次发送消息的编号,从 1 开始递增
    + * + -1:发送失败,RtcEngine 实例未创建 + * @note
    + * + 在向业务服务器发送二进制消息前,必须先调用 login{@link #IRTS#login} 完成登录,随后调用 setServerParams{@link #IRTS#setServerParams} 设置业务服务器。
    + * + 调用本接口后,会收到一次 onServerMessageSendResult{@link #IRTSEventHandler#onServerMessageSendResult} 回调,通知消息发送方发送成功或失败。
    + * + 若二进制消息发送成功,则之前调用 setServerParams{@link #IRTS#setServerParams} 设置的业务服务器会收到该条消息。 + */ + + virtual int64_t sendServerBinaryMessage(int length, const uint8_t* message) = 0; + + /** + * + * @type api + * @region 房间管理 + * @brief 创建房间实例。 + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom{@link #IRTCRoom#joinRoom} 才能真正地创建/加入房间。 + * 多次调用此方法以创建多个 IRTSRoom{@link #IRTSRoom} 实例。分别调用各 IRTSRoom 实例中的 joinRoom{@link #IRTCRoom#joinRoom} 方法,同时加入多个房间。 + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param room_id 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 IRTSRoom{@link #IRTSRoom} 房间实例。 + * @note
    + * + 如果需要加入的房间已存在,你仍需先调用本方法来获取 IRTSRoom 实例,再调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。 + * + 多房间模式下,创建多个房间实例需要使用不同的 room_id,否则会导致创建房间失败。 + */ + + virtual IRTSRoom* createRoom(const char* room_id) = 0; + + /** + * + * @type api + * @region 引擎管理 + * @brief 设置运行时的参数 + * @param json_string json 序列化之后的字符串 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + */ + + virtual int setRuntimeParameters(const char * json_string) = 0; + + /** + * + * @hidden(macOS, Windows, Linux) + * @type api + * @brief 启用蜂窝网络辅助增强,改善通话质量。 + * @param enhance 是否开启。默认不开启。 + * @return 方法调用结果:
    + * + 0: 成功。
    + * + -1:失败,内部错误。
    + */ + + virtual int setCellularEnhancement(bool enhance) = 0; + + /** + * + * @type api + * @region 代理 + * @brief 设置本地代理 + * @param configurations 本地代理配置参数。参看 LocalProxyConfiguration{@link #LocalProxyConfiguration}。
    + * 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。
    + * 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 + * @param configuration_num 本地代理配置参数的数量。 + * @note 要设置本地代理,调用 setLocalProxy{@link #IRTS#setLocalProxy}。 + */ + + virtual int setLocalProxy( + const bytertc::LocalProxyConfiguration* configurations, + int configuration_num) = 0; + + /** + * + * @type api + * @region 引擎管理 + * @brief 创建 RTCEngine 实例。
    + * 如果当前线程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前线程中已创建了引擎实例,再次调用此方法时,会创建另一个独立的引擎实例。 + * @param config 创建引擎参数配置,详见 EngineConfig{@link #EngineConfig} + * @param event_handler SDK 回调给应用层的 Callback 对象,详见 IRTSEventHandler{@link #IRTSEventHandler} 。 + * @return
    + * + IRTS:创建成功。返回一个可用的 IRTS{@link #IRTS} 实例
    + * + Null:创建失败。 + * @note
    + * + 如果你在同一个线程中创建了多个引擎实例,这些实例必须分别调用 destroyRTS{@link #destroyRTS} 销毁。 + * + 在 Linux 平台上创建引擎实例的数量取决于系统的硬件性能。 + */ + + static BYTERTC_STATIC_API IRTS* createRTS(const bytertc::EngineConfig& config, IRTSEventHandler* event_handler); + + /** + * + * @type api + * @region 引擎管理 + * @brief 销毁由 createRTS{@link #createRTS} 创建的 RTCEngine 实例,并释放所有相关资源。 + * @param engine createRTS{@link #createRTS} 时,返回的实例。 + * @note
    + * + 请确保和需要销毁的 IRTS{@link #IRTS} 实例相关的业务场景全部结束后,才调用此方法。
    + * + 该方法在调用之后,会销毁所有和此 IRTS{@link #IRTS} 实例相关的内存,并且停止与媒体服务器的任何交互。
    + * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ + + static BYTERTC_STATIC_API void destroyRTS(); + + /** + * + * @type api + * @region 引擎管理 + * @brief 获取当前 SDK 版本信息。 + * @return 当前 SDK 版本信息。 + */ + + static BYTERTC_STATIC_API const char* getSDKVersion(); + + /** + * + * @type api + * @region 引擎管理 + * @brief 配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。 + * @param log_config 本地日志参数,参看 LogConfig{@link #LogConfig}。 + * @return
    + * + 0:成功。 + * + –1:失败,本方法必须在创建引擎前调用。 + * + –2:失败,参数填写错误。 + * @note 本方法必须在调用 createRTS{@link #createRTS} 之前调用。 + */ + + static BYTERTC_STATIC_API int setLogConfig(const bytertc::LogConfig& log_config); +}; +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_event_handler.h new file mode 100644 index 0000000..f121d32 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_event_handler.h @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Event Handler Lite +*/ + +#pragma once + +#include "rtc/bytertc_rts_defines.h" + +namespace byterts { +/** + * + * @type callback + * @brief 实时信令事件回调接口 + */ + +class IRTSEventHandler { +public: + + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRTSEventHandler() { + } + + /** + * + * @type callback + * @region 警告码 + * @brief 当内部发生警告事件时触发该回调 + * @param warn + * 警告标识码,详见:WarningCode{@link #WarningCode} + */ + + virtual void onWarning(int warn) { + (void)warn; + } + + /** + * + * @type callback + * @region 错误码 + * @brief 当 SDK 内部发生不可逆转错误时触发该回调。 + * @param err 错误标识码,参看 ErrorCode{@link #ErrorCode} + */ + + virtual void onError(int err) { + (void)err; + } + + /** + * + * @valid since 3.52 + * @type callback + * @brief 当访问插件失败时,收到此回调。 + * RTC SDK 将一些功能封装成插件。当使用这些功能时,如果插件不存在,功能将无法使用。 + * @param extension_name 插件名字 + * @param msg 失败说明 + */ + + void onExtensionAccessError(const char* extension_name, const char* msg) { + (void)extension_name; + (void)msg; + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief 端监控日志回调。当产生一个端监控事件时触发该回调。 + * @param log_type
    + * 事件类型。目前类型固定为 "live_webrtc_monitor_log"。 + * @param log_content
    + * 端监控日志内容。 + */ + + virtual void onLogReport(const char* log_type, const char* log_content) { + (void)log_type; + (void)log_content; + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief SDK 与信令服务器连接状态改变回调。连接状态改变时触发。 + * @param state 当前 SDK 与信令服务器的连接状态,详见 ConnectionState{@link #ConnectionState}。 + * @note 更多信息参见 [连接状态提示](https: + */ + + virtual void onConnectionStateChanged(bytertc::ConnectionState state) { + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief SDK 当前网络连接类型改变回调。当 SDK 的当前网络连接类型发生改变时回调该事件。 + * @param type
    + * SDK 当前的网络连接类型,详见:NetworkType{@link #NetworkType} 。 + */ + + virtual void onNetworkTypeChanged(bytertc::NetworkType type) { + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief 周期性(2s)地发出回调,报告当前cpu与memory使用率 + * @param stats 返回包含当前系统状态信息的结构体,详见 SysStats{@link #SysStats} + */ + + virtual void onSysStats(const bytertc::SysStats& stats) { + } + + /** + * + * @type callback + * @region 引擎管理 + * @brief 创建房间失败回调。 + * @param room_id 房间 ID。 + * @param error_code 创建房间错误码,具体原因参看 ErrorCode{@link #ErrorCode}。 + */ + + virtual void onCreateRoomStateChanged(const char* room_id, int error_code) { + (void)room_id; + (void)error_code; + } + + /** + * + * @type callback + * @deprecated 在3.52及之后废弃,将在3.57删除,使用 onLocalProxyStateChanged{@link #IRTSEventHandler#onLocalProxyStateChanged} 替换 + * @region 代理回调 + * @brief HTTP 代理连接状态改变时,收到该回调。 + * @param state 当前 HTTP 代理连接状态,详见 HttpProxyState{@link #HttpProxyState} + */ + + virtual void onHttpProxyState(int state) { + } + + /** + * + * @type callback + * @deprecated 在3.52及之后废弃,将在3.57删除,使用 onLocalProxyStateChanged{@link #IRTSEventHandler#onLocalProxyStateChanged} 替换 + * @region 代理回调 + * @brief HTTPS 代理连接状态改变时,收到该回调。 + * @param state 当前 HTTPS 代理连接状态,详见 HttpProxyState{@link #HttpProxyState} + */ + + virtual void onHttpsProxyState(int state) { + } + + /** + * + * @type callback + * @deprecated 在3.52及之后废弃,将在3.57删除,使用 onLocalProxyStateChanged{@link #IRTSEventHandler#onLocalProxyStateChanged} 替换 + * @region 代理回调 + * @brief Socks5 代理状态改变时,收到该回调。 + * @param state SOCKS5 代理连接状态,详见 Socks5ProxyState{@link #Socks5ProxyState} + * @param cmd 代理连接的每一步操作命令 + * @param proxy_address 代理地址信息 + * @param local_address 当前连接使用的本地地址 + * @param remote_address 远端的连接地址 + */ + + virtual void onSocks5ProxyState(int state, + const char* cmd, + const char* proxy_address, + const char* local_address, + const char* remote_address) { + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 登录结果回调 + * @param uid
    + * 登录用户 ID + * @param error_code
    + * 登录结果
    + * 详见 LoginErrorCode{@link #LoginErrorCode}。 + * @param elapsed
    + * 从调用 login{@link #IRTS#login} 接口开始到返回结果所用时长
    + * 单位为 ms。 + * @note 调用 login{@link #IRTS#login} 后,会收到此回调。 + */ + + virtual void onLoginResult(const char* uid, int error_code, int elapsed) { + (void)uid; + (void)error_code; + (void)elapsed; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 登出结果回调 + * @param reason 用户登出的原因,参看 LogoutReason{@link #LogoutReason} + * @note 在以下两种情况下会收到此回调:调用 logout{@link #IRTS#logout} 接口主动退出;或其他用户以相同 UserId 进行 `login` 导致本地用户被动登出。 + */ + + virtual void onLogout(bytertc::LogoutReason reason) { + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 设置应用服务器参数的返回结果 + * @param error
    + * 设置结果
    + * + 返回 200,设置成功
    + * + 返回其他,设置失败 + * @note 调用 setServerParams{@link #IRTS#setServerParams} 后,会收到此回调。 + */ + + virtual void onServerParamsSetResult(int error) { + (void)error; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 查询对端或本端用户登录状态的返回结果 + * @param peer_user_id 需要查询的用户 ID。 + * @param status 查询的用户登录状态。详见 UserOnlineStatus{@link #UserOnlineStatus}。 + * @note 必须先调用 getPeerOnlineStatus{@link #IRTS#getPeerOnlineStatus},才能收到此回调。 + */ + + virtual void onGetPeerOnlineStatus(const char* peer_user_id, int status) { + (void)peer_user_id; + (void)status; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 收到房间外用户调用 sendMessage{@link #IRTS#sendMessage} 发来的文本消息时,会收到此回调 + * @param uid 消息发送者 ID。 + * @param message
    + * 收到的文本消息内容 + */ + + virtual void onMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 收到房间外用户调用 sendBinaryMessage{@link #IRTS#sendBinaryMessage} 发来的二进制消息时,会收到此回调。 + * @param uid 消息发送者 ID。 + * @param size 二进制消息长度。 + * @param message 收到的二进制消息内容。 + */ + + virtual void onBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + /** + * + * @type callback + * @region 实时消息通信 + * @brief 给房间外指定的用户发送消息的回调。 + * @param msgid 消息的 ID。
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果。详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @note 当调用 sendMessage{@link #IRTS#sendMessage} 或 sendBinaryMessage{@link #IRTS#sendBinaryMessage} 发送消息后,会收到此回调。 + */ + + virtual void onMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 给应用服务器发送消息的回调 + * @param msgid 本条消息的 ID
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult}。 + * @param message 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。 + * @note 当调用 sendServerMessage{@link #IRTS#sendServerMessage} 或 sendServerBinaryMessage{@link #IRTS#sendServerBinaryMessage} 发送消息后,会收到此回调。 + */ + + virtual void onServerMessageSendResult(int64_t msgid, int error, const bytertc::ServerACKMsg& msg) { + (void)msgid; + (void)error; + (void)msg; + } + + /** + * + * @type callback + * @brief 调用 StartCloudProxy{@link #IRtcEngineLite#StartCloudProxy} 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。 + * @param interval 从开启云代理到连接成功经过的时间,单位为 ms + */ + + virtual void onCloudProxyConnected(int interval) { + (void)interval; + } + + /** + * + * @type callback + * @brief 调用 setLocalProxy{@link #IRTS#setLocalProxy} 设置本地代理,SDK对代理连接的状态 + * 回调此接口。 + * @param local_proxy_type 本地代理类型:sock5 或 httptunnel + * @param local_proxy_state 本地代理状态。参看 LocalProxyState{@link #LocalProxyState}。
    + * @param local_proxy_error 本地代理错误。参看 LocalProxyError{@link #LocalProxyError}。
    + */ + + virtual void onLocalProxyStateChanged(bytertc::LocalProxyType local_proxy_type, bytertc::LocalProxyState local_proxy_state, bytertc::LocalProxyError local_proxy_error) { + (void)local_proxy_type; + (void)local_proxy_state; + (void)local_proxy_error; + } +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_room.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_room.h new file mode 100644 index 0000000..5c8952e --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_room.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Interface + */ + +#pragma once + +#include "rtc/bytertc_rts_defines.h" +#include "byterts_room_event_handler.h" + +namespace byterts { + +/** + * + * @type api + * @brief 房间接口 + */ + +class IRTSRoom { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoom() { + } + + /** + * + * @type api + * @list 房间管理 + * @brief 退出并销毁调用 createRoom{@link #IRTS#createRoom} 所创建的房间实例。 + */ + + virtual void destroy() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 创建/加入 RTS 房间:房间不存在时即创建房间;房间存在时,未加入房间的用户可加入这个房间。
    + * 同一房间内的用户间可以相互通话。
    + * 进房后重复调用无效,用户必须调用 `leaveRoom` 退出当前房间后,才能加入下一个房间。 + * @return
    + * + 0: 成功
    + * + -1:room_id / user_info.uid 包含了无效的参数。
    + * + -2:已经在房间内。 + * @note
    + * + 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 OnError{@link #IRTCAudioEventHandler#OnError} 回调通知,错误类型详见 ErrorCode{@link #ErrorCode} 中的 kErrorCodeDuplicateLogin。
    + * + 本地用户调用此方法加入房间成功后,会收到 回调通知。
    + * + 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,此时 SDK 将会自动重连。重连成功后,本地会收到 回调通知。如果加入房间的用户可见,远端用户会收到 onUserJoined{@link #IRTSRoomEventHandler#onUserJoined}。 + */ + + virtual int joinRoom() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 离开 RTS 房间。
    + * 用户调用此方法离开房间,结束通话过程,释放所有通话相关的资源。
    + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note
    + * + 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调通知。
    + * + 可见的用户离开房间后,房间内其他用户会收到 onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} 回调通知。
    + * + 如果调用此方法后立即销毁引擎,SDK 将无法触发 onLeaveRoom{@link #IRTSRoomEventHandler#onLeaveRoom} 回调。
    + * + 调用 joinRoom{@link #IRTCRoom#joinRoom} 方法加入房间后,必须调用此方法离开房间,否则无法进入下一个房间。无论当前是否在房间内,都可以调用此方法。重复调用此方法没有负面影响。
    + */ + + virtual int leaveRoom() = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 设置 IRTSRoom{@link #IRTSRoom} 对象的事件句柄。 + * 通过设置事件句柄可以监听此 IRTSRoom{@link #IRTSRoom} 对象对应的房间的回调事件。 + * @param room_event_handler 回调处理器,详见 IRTSRoomEventHandler{@link #IRTSRoomEventHandler} + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + */ + + virtual int setRTSRoomEventHandler(IRTSRoomEventHandler* room_event_handler) = 0; + + /** + * + * @type api + * @list 房间管理 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param message 用户发送的广播消息,消息不超过 62KB。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note
    + * + 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。
    + * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。
    + * + 同一房间内的其他用户会收到 onRoomMessageReceived{@link #IRTSRoomEventHandler#onRoomMessageReceived} 回调。 + */ + + virtual int64_t sendRoomMessage(const char* message) = 0; + /** + * + * @type api + * @list 消息 + * @brief 给房间内的所有其他用户发送广播消息。 + * @param size 发送的二进制消息长度 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * + 在发送房间内二进制消息前,必须先调用 joinRoom{@link #IRTCRoom#joinRoom} 加入房间。
    + * + 调用该函数后,会收到一次 onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} 回调。
    + * + 同一房间内的其他用户会收到 onRoomBinaryMessageReceived{@link #IRTSRoomEventHandler#onRoomBinaryMessageReceived} 回调。 + */ + + virtual int64_t sendRoomBinaryMessage(int size, const uint8_t* message) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_room_event_handler.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_room_event_handler.h new file mode 100644 index 0000000..dcf9351 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/byterts_room_event_handler.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Event Handler Interface +*/ + +#pragma once + +namespace byterts { +/** + * + * @type callback + * @brief 实时信令事件回调接口 + */ + +class IRTSRoomEventHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRTSRoomEventHandler() {} + + /** + * + * @type callback + * @region 房间管理 + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param room_id 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * + 0: 加入房间成功。
    + * + !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ErrorCode{@link #ErrorCode} 及 WarningCode{@link #WarningCode}。 + * @param extra_info 额外信息,如 `{"elapsed":1187,"join_type":0}`。 + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。 + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom{@link #IRTCRoom#joinRoom} 到加入房间成功所经历的时间间隔,单位为 ms。 + */ + + virtual void onRoomStateChanged(const char* room_id, const char* uid, + int state, const char* extra_info) { + (void)room_id; + (void)state; + (void)extra_info; + } + + /** + * + * @type callback + * @region 房间管理 + * @brief 离开房间回调。
    + * 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并在释放所有与通话相关的音频资源后,通过此回调通知用户离开房间成功。
    + * @note
    + * + 用户调用 leaveRoom{@link #IRTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #IRTSRoom#destroy} 销毁房间实例方法销毁 RTS 引擎,则将无法收到此回调事件。
    + * + 离开房间后,如果 App 需要使用系统音频设备,则建议收到此回调后再初始化音频设备,否则可能由于 SDK 占用音频设备而导致初始化失败。
    + */ + + virtual void onLeaveRoom() { + } + + /** + * + * @deprecated since 3.41 and will be deleted in 3.51, user instead. + * @type callback + * @region 房间管理 + * @brief SDK 发生警告回调。
    + * SDK内部遇到可恢复错误时,在尝试自动恢复的同时,会通过此回调通知用户。此回调事件仅用作通知。
    + * @param warn 警告码,参看 WarningCode{@link #WarningCode}。
    + */ + + virtual void onRoomWarning(int warn) { + (void)warn; + } + + /** + * + * @deprecated since 3.41 and will be deleted in 3.51. + * @type callback + * @region 房间管理 + * @brief SDK 发生错误回调。
    + * SDK 内部遇到不可恢复错误时,会通过此回调通知 App,需要 App 根据错误码进行操作或提示用户。
    + * @param err 错误码,参看 ErrorCode{@link #ErrorCode}。
    + */ + + virtual void onRoomError(int err) { + (void)err; + } + + /** + * + * @type callback + * @region 房间管理 + * @brief 远端用户加入房间的回调。 + * @param uid 加入房间的用户 ID
    + * @param elapsed 此参数无意义 + */ + + virtual void onUserJoined(const char* uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** + * + * @type callback + * @brief 远端用户离开房间时,本地用户会收到此事件 + * @param uid 离开房间的远端用户 ID。 + * @param reason 用户离开房间的原因。参看 UserOfflineReason{@link #UserOfflineReason}。 + */ + + virtual void onUserLeave(const char* uid, bytertc::UserOfflineReason reason) { + (void)uid; + (void)reason; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内广播消息的回调。
    + * 当房间内的其他用户调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 时,你会收到此回调。 + * @param uid 发送该消息的用户的 ID。 + * @param message 收到的消息内容。 + */ + + virtual void onRoomMessageReceived(const char* uid, const char* message) { + (void)uid; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 接收到房间内二进制广播消息的回调。
    + * 同一房间内其他用户调用 sendRoomBinaryMessage{@link #IRTSRoom#sendRoomBinaryMessage} 发送二进制广播消息时会收到该回调。 + * @param uid 发送该消息的用户的 ID。 + * @param size 收到的二进制消息长度。 + * @param message 收到的二进制消息内容。 + */ + + virtual void onRoomBinaryMessageReceived(const char* uid, int size, const uint8_t* message) { + (void)uid; + (void)size; + (void)message; + } + + /** + * + * @type callback + * @region 实时消息通信 + * @brief 当调用 sendRoomMessage{@link #IRTSRoom#sendRoomMessage} 函数发送消息后,回调此条消息的发送结果(反馈)。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果。详见 RoomMessageSendResult{@link #RoomMessageSendResult}。 + */ + + virtual void onRoomMessageSendResult(int64_t msgid, int error) { + (void)msgid; + (void)error; + } +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_advance.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_advance.h new file mode 100644 index 0000000..0c81547 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_advance.h @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Advance API +*/ + +#pragma once + +#include "../bytertc_engine.h" + +#include +#ifdef __ANDROID__ +#include "jni.h" +#endif + + +#ifdef __GNUC__ +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +namespace bytertc { +/** + * + * @hidden for internal use only + * @brief 设置应用的状态 + * @param engine
    + * 要通知的引擎 + * @param app_state 应用状态字符串 + */ + +BYTERTC_API void setAppState(void* engine, const char* app_state); +/** + * + * @hidden(iOS,macOS,Windows,Linux) for internal use only + * @type api + * @brief 用于设置 Android 的 ApplicationContext 给 Engine 使用,
    + * 如果 Android 使用纯 C++接口,则该方法必须在引擎创建前设置 + * @param j_egl_context
    + * 传入 Java 的 android.content.Context 类型的 EGLContext + * @list 引擎管理 + */ + +BYTERTC_API void setApplicationContext(void* j_application_context); +BYTERTC_API int setLogConfig(const LogConfig& log_config); + +/** + * + * @region 视频管理 + * @type keytype + * @brief 硬件加速设备类型 + */ + +enum HWDeviceType { + /** + * + * @brief 未知的设备类型 + */ + + kHWDeviceTypeNone, + + /** + * + * @brief direct3d 11 视频加速设备 + */ + + kHWDeviceTypeD3D11, + + /** + * + * @brief cuda 硬件加速设备 + * @note cuda 是 nvidia 平台下硬件加速设备 + */ + + kHWDeviceTypeCuda, + + /** + * + * @brief intel 平台下 qsv 加速设备 + */ + + kHWDeviceTypeQsv, + + /** + * + * @brief windows 平台 dx 硬件加速设备 + */ + + kHWDeviceTypeDxva2, + + /** + * + * @brief Android 平台下硬件加速设备 mediacodec + */ + + kHWDeviceTypeMediaCodec, + + /** + * + * @brief IOS、MACOS 平台下硬件加速设备 VideoToolbox + */ + + kHWDeviceTypeVideoToolbox, + /** + * + * @brief android、linux 平台下硬件加速设备 egl context + */ + + kHWDeviceTypeEglContext, + + /** + * + * @brief linux、windows 平台下硬件加速设备 va context + */ + + kHWDeviceTypeVaapi, +}; + +/** + * + * @hidden(macOS, Linux, iOS, Android) + * @type keytype + * @brief 硬编码设备 context + */ + +enum HWDeviceContextKey { + /** + * + * @brief cuda context + */ + + kHWDeviceContextKeyCudaContext, + /** + * + * @brief derict3D11 设备 + */ + + kHWDeviceContextKeyD3D11Device, + /** + * + * @brief derict3D11 设备 context + */ + + kHWDeviceContextKeyD3D11DeviceContext, + /** + * + * @brief egl 设备 context + */ + + kHWDeviceContextKeyEglContext, + /** + * + * @brief vadisplay 设备 context + */ + + kHWDeviceContextKeyVADisplay, +}; + +/** + * + * @hidden(macOS, Linux, iOS, Android) + * @type keytype + * @brief 硬件加速设备 context + */ + +class IHWDeviceContext { +public: + virtual ~IHWDeviceContext() = default; + /** + * + * @brief 获取硬件加速设备 context 类型 + * @return 硬件加速设备类型,详见 HWDeviceType{@link #HWDeviceType} + */ + + virtual HWDeviceType deviceType() const = 0; + /** + * + * @brief 设置属性 + * @param key 硬件加速设备 context 类型,详见 HWDeviceContextKey{@link #HWDeviceContextKey} + * @param value 指向硬件加速设备 context 地址的指针 + */ + + virtual void setProperty(HWDeviceContextKey key, void* value) = 0; + /** + * + * @brief 获取属性 + * @param key 硬件加速设备 context 类型,详见 HWDeviceContextKey{@link #HWDeviceContextKey} + * @return 返回硬件加速设备 context 地址的指针 + */ + + virtual void* getProperty(HWDeviceContextKey key) = 0; + /** + * + * @brief 内部 context 是否由该实例拥有 + * @return + * - true: 硬件设备 context 被实例对象拥有 + * - false: 硬件设备上 context 文不被实例对象拥有 + */ + + virtual bool ownContext() const = 0; + /** + * + * @brief 设置 context 是否被实例对象拥有 + * @param own_context
    + * - true: context 被实例对象拥有 + * - false: context 不被实例对象拥有 + */ + + virtual void setOwnContext(bool own_context) = 0; + /** + * + * @brief 转移硬件设备 context, + * @return 指向硬件设备 context 的指针 + */ + + virtual IHWDeviceContext* moveContext() = 0; + /** + * + * @brief 释放实例对象 + */ + + virtual void release() = 0; +}; + +/** + * + * @hidden for internal use only + * @brief 创建一个具有指定设备类型的硬件设备上下文 + */ + + +BYTERTC_API IHWDeviceContext* createHwDeviceContext(HWDeviceType device_type); + +/** + * + * @hidden for internal use only + * @brief 设置视频源的设备上下文信息 + * @param engine
    + * 要设置的引擎,详见 IRTCEngine{@link #IRTCEngine} + * @param hw_context
    + * 设置视频帧,详见:IHWDeviceContext{@link #IHWDeviceContext} + * @note 用于硬件编码传入 GPU 内存时使用 + */ + +BYTERTC_API void setVideoSourceHWDeviceContext(void* engine, IHWDeviceContext* hw_context); + +/** + * + * @hidden for internal use only + * @type callback + * @brief 本地音频帧监测器 + * @list 自定义流处理 + */ + +class ILocalEncodedAudioFrameObserver { +public: + virtual ~ILocalEncodedAudioFrameObserver() { + } + /** + * + * @type callback + * @brief 调用 RegisterLocalEncodedAudioFrameObserver 后,SDK 收到本地音频帧信息时,回调该事件 + * @param audio_source 本地音频源类型,详见 IAudioSource{@link #IAudioSource} + * @param audio_stream 本地音频帧信息,参看 IEncodedAudioFrame + * @list 自定义流处理 + */ + + virtual void onLocalEncodedAudioFrame(IAudioSource* audio_source, const EncodedAudioFrameData& audio_stream) = 0; +}; +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_defines.h new file mode 100644 index 0000000..1a35cd8 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_defines.h @@ -0,0 +1,2275 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Defines + */ + +#pragma once + +#include "bytertc_media_defines.h" +#include +#include + +#define SPECTRUM_SIZE 257 + +namespace bytertc { +/** + * + * @type keytype + * @brief 音频采样率,单位为 Hz。 + */ + +enum AudioSampleRate { + /** + * + * @brief 默认设置。48000Hz。 + */ + + kAudioSampleRateAuto = -1, + /** + * + * @brief 8000Hz + */ + + kAudioSampleRate8000 = 8000, + /** + * + * @brief 11025Hz + */ + + kAudioSampleRate11025 = 11025, + /** + * + * @brief 16000Hz + */ + + kAudioSampleRate16000 = 16000, + /** + * + * @brief 22050Hz + */ + + kAudioSampleRate22050 = 22050, + /** + * + * @brief 24000Hz + */ + + kAudioSampleRate24000 = 24000, + /** + * + * @brief 32000Hz + */ + + kAudioSampleRate32000 = 32000, + /** + * + * @brief 44100Hz + */ + + kAudioSampleRate44100 = 44100, + /** + * + * @brief 48000Hz + */ + + kAudioSampleRate48000 = 48000 +}; +/** + * + * @type keytype + * @brief 音频声道。 + */ + +enum AudioChannel { + /** + * + * @brief 默认设置。 + */ + + kAudioChannelAuto = -1, + /** + * + * @brief 单声道 + */ + + kAudioChannelMono = 1, + /** + * + * @brief 双声道 + */ + + kAudioChannelStereo = 2 +}; + +/** + * + * @type keytype + * @brief 音频格式 + */ + +struct AudioFormat { + /** + * + * @brief 音频采样率,详见 AudioSampleRate{@link #AudioSampleRate} + */ + + AudioSampleRate sample_rate = kAudioSampleRateAuto; + /** + * + * @brief 音频声道,详见 AudioChannel{@link #AudioChannel} + */ + + AudioChannel channel = kAudioChannelAuto; + /** + * + * @brief 单次回调的音频帧中包含的采样点数。默认值为 `0`,此时,采样点数取最小值。
    + * 最小值为回调间隔是 0.01s 时的值,即 `sampleRate * channel * 0.01s`。
    + * 最大值是 `2048`。超出取值范围时,采样点数取默认值。
    + * 该参数仅在设置读写回调时生效,调用 enableAudioFrameCallback{@link #IRTCEngine#enableAudioFrameCallback} 开启只读模式回调时设置该参数不生效。 + */ + + int samples_per_call = 0; +}; +/** + * + * @type keytype + * @brief 返回给音频处理器的音频类型。 + */ + +enum AudioProcessorMethod{ + /** + * + * @brief 本地采集的音频。 + */ + + kAudioProcessorMethodRecord = 0, + /** + * + * @brief 远端音频流的混音音频。 + */ + + kAudioProcessorMethodPlayback = 1, + /** + * + * @brief 各个远端音频流。 + */ + + kAudioProcessorMethodRemoteUser = 2, + /** + * + * @hidden(Windows,Linux,macOS) + * @brief 软件耳返音频。 + */ + + kAudioProcessorMethodEarMonitor = 3, + /** + * + * @hidden(Linux) + * @brief 屏幕共享音频。 + */ + + kAudioProcessorMethodScreen = 4, +}; +/** + * + * @type keytype + * @brief 音频设备类型 + */ + +enum RTCAudioDeviceType { + /** + * + * @brief 未知设备类型 + */ + + kRTCAudioDeviceTypeUnknown = -1, + /** + * + * @brief 音频渲染设备 + */ + + kRTCAudioDeviceTypeRenderDevice = 0, + /** + * + * @brief 音频采集设备 + */ + + kRTCAudioDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流音频设备 + */ + + kRTCAudioDeviceTypeScreenCaptureDevice = 2, +}; + +/** + * + * @type keytype + * @brief 音频播放设备 + */ + +enum AudioRoute { + /** + * + * @brief 默认设备 + */ + + kAudioRouteDefault = -1, + /** + * + * @brief 有线耳机 + */ + + kAudioRouteHeadset = 1, + /** + * + * @brief 听筒 + */ + + kAudioRouteEarpiece = 2, + /** + * + * @brief 扬声器 + */ + + kAudioRouteSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + kAudioRouteHeadsetBluetooth = 4, + /** + * + * @brief USB 设备 + */ + + kAudioRouteHeadsetUSB = 5 +}; + +/** + * + * @type keytype + * @brief 音频播放设备 + */ + +enum AudioPlaybackDevice { + /** + * + * @brief 有线耳机 + */ + + kAudioPlaybackDeviceHeadset = 1, + /** + * + * @brief 听筒 + */ + + kAudioPlaybackDeviceEarpiece = 2, + /** + * + * @brief 扬声器 + */ + + kAudioPlaybackDeviceSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + kAudioPlaybackDeviceHeadsetBluetooth = 4, + /** + * + * @brief USB 设备 + */ + + kAudioPlaybackDeviceHeadsetUSB = 5 +}; + +/** + * + * @type keytype + * @brief 音频场景类型。
    + * 选择音频场景后,SDK 会根据操作系统和开麦、闭麦状态,应用通话音量或媒体音量。参看[通话音量与媒体音量](https: + * 你可以调用 `setAudioScenario` 设置音频场景。
    + * 如果以下音频场景类型无法满足你的业务需要,请联系技术支持人员。 + */ + +enum AudioScenarioType { + /** + * + * @brief 默认场景,适用大部分场景。 + */ + + kAudioScenarioTypeDefault = 0, + /** + * + * @brief 聊天室场景。通话清晰度较高,适用于会议,聊天室场景。 + */ + + kAudioScenarioTypeChatRoom = 1, + /** + * + * @brief 高音质场景。适用于音乐为主的场景,如 KTV,音乐聊天室等。 + */ + + kAudioScenarioTypeGameStreaming = 2, + /** + * + * @brief 合唱场景。延迟较低。 + */ + + kAudioScenarioTypeChorus = 3, + /** + * + * @brief 教育场景。适用于以人声教学内容为主的高音质场景。 + */ + + kAudioScenarioTypeEducation = 4, + /** + * + * @brief AI 对话场景。适用于真人与 AI 智能体互动的场景。使用此场景时,还需在通过 `createRTCEngine` 创建引擎时,通过 parameters 字段传入私有参数 `"rtc.fg_config":"aigc_media_360=true"`。 + */ + + kAudioScenarioTypeAiClient = 5, + +}; + +/** + * + * @type keytype + * @brief 变声特效类型。如需更多类型,联系技术支持。 + */ + +enum VoiceChangerType { + /** + * + * @brief 原声,不含特效 + */ + + kVoiceChangerTypeOriginal = 0, + /** + * + * @brief 巨人 + */ + + kVoiceChangerTypeGiant = 1, + /** + * + * @brief 花栗鼠 + */ + + kVoiceChangerTypeChipmunk = 2, + /** + * + * @brief 小黄人 + */ + + kVoiceChangerTypeMinionst = 3, + /** + * + * @brief 颤音 + */ + + kVoiceChangerTypeVibrato = 4, + /** + * + * @brief 机器人 + */ + + kVoiceChangerTypeRobot = 5, +}; + +/** + * + * @type keytype + * @brief 混响特效类型 + */ + +enum VoiceReverbType { + /** + * + * @brief 原声,不含特效 + */ + + kVoiceReverbTypeOriginal = 0, + /** + * + * @brief 回声 + */ + + kVoiceReverbTypeEcho = 1, + /** + * + * @brief 演唱会 + */ + + kVoiceReverbTypeConcert = 2, + /** + * + * @brief 空灵 + */ + + kVoiceReverbTypeEthereal = 3, + /** + * + * @brief KTV + */ + + kVoiceReverbTypeKTV = 4, + /** + * + * @brief 录音棚 + */ + + kVoiceReverbTypeStudio = 5, + /** + * + * @brief 虚拟立体声 + */ + + kVoiceReverbTypeVirtualStereo = 6, + /** + * + * @brief 空旷 + */ + + kVoiceReverbTypeSpacious = 7, + /** + * + * @brief 3D 人声 + */ + + kVoiceReverbType3D = 8, + /** + * + * @hidden for internal use only + * @brief 流行 + */ + + kVoiceReverbTypePop = 9, + /** + * + * @hidden for internal use only + * @brief 蹦迪 + */ + + kVoiceReverbTypeDisco = 10, + /** + * + * @hidden for internal use only + * @brief 老唱片 + */ + + kVoiceReverbTypeOldRecord = 11, + /** + * + * @hidden for internal use only + * @brief 和声 + */ + + kVoiceReverbTypeHarmony = 12, + /** + * + * @hidden for internal use only + * @brief 摇滚 + */ + + kVoiceReverbTypeRock = 13, + /** + * + * @hidden for internal use only + * @brief 蓝调 + */ + + kVoiceReverbTypeBlues = 14, + /** + * + * @hidden for internal use only + * @brief 爵士 + */ + + kVoiceReverbTypeJazz = 15, + /** + * + * @hidden for internal use only + * @brief 电子 + */ + + kVoiceReverbTypeElectronic = 16, + /** + * + * @hidden for internal use only + * @brief 黑胶 + */ + + kVoiceReverbTypeVinyl = 17, + /** + * + * @hidden for internal use only + * @brief 密室 + */ + + kVoiceReverbTypeChamber = 18, + /** + * + * @hidden for internal use only + * @brief 增强原声 + */ + + kVoiceReverbTypeEnhanceOriginal = 19, + /** + * + * @hidden for internal use only + * @brief 浴室 + */ + + kVoiceReverbTypeBathroom = 20, + /** + * + * @hidden for internal use only + * @brief 自然 + */ + + kVoiceReverbTypeNatural = 21, + + /** + * + * @hidden for internal use only + * @brief 楼道 + */ + + kVoiceReverbTypeHallway = 22, +}; +/** + * + * @type keytype + * @brief 音频均衡效果。 + */ + +enum VoiceEqualizationBandFrequency { + /** + * + * @brief 中心频率为 31Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency31 = 0, + /** + * + * @brief 中心频率为 62Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency62 = 1, + /** + * + * @brief 中心频率为 125Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency125 = 2, + /** + * + * @brief 中心频率为 250Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency250 = 3, + /** + * + * @brief 中心频率为 500Hz 的频带。 + */ + + kVoiceEqualizationBandFrequency500 = 4, + /** + * + * @brief 中心频率为 1kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency1k = 5, + /** + * + * @brief 中心频率为 2kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency2k = 6, + /** + * + * @brief 中心频率为 4kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency4k = 7, + /** + * + * @brief 中心频率为 8kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency8k = 8, + /** + * + * @brief 中心频率为 16kHz 的频带。 + */ + + kVoiceEqualizationBandFrequency16k = 9, +}; +/** + * + * @type keytype + * @brief 语音均衡效果。 + */ + +struct VoiceEqualizationConfig { + /** + * + * @brief 频带。参看 VoiceEqualizationBandFrequency{@link #VoiceEqualizationBandFrequency}。 + */ + + VoiceEqualizationBandFrequency frequency; + /** + * + * @brief 频带增益(dB)。取值范围是 `[-15, 15]`。 + */ + + int gain; +}; +/** + * + * @type keytype + * @brief 音频混响效果。 + */ + +struct VoiceReverbConfig { + /** + * + * @brief 混响模拟的房间大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。房间越大,混响越强。 + */ + + float room_size = 50.0f; + /** + * + * @brief 混响的拖尾长度,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + + float decay_time = 50.0f; + /** + * + * @brief 混响的衰减阻尼大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + + float damping = 50.0f; + /** + * + * @brief 早期反射信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + + float wet_gain = 0.0f; + /** + * + * @brief 原始信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + + float dry_gain = 0.0f; + /** + * + * @brief 早期反射信号的延迟。取值范围 `[0.0, 200.0]`,单位为 ms。默认值为 `0.0f`。 + */ + + float pre_delay = 0.0f; +}; + +/** + * + * @type keytype + * @brief 音频流来源的用户 ID 及对应的音量。 + */ + +struct AudioVolumeInfo { + /** + * + * @brief 线性音量,取值范围是:[0, 255],与原始音量呈线性关系,数值越大,音量越大。
    + * 无声为 25 以下(绝对无声为 0,25 以下可视为无声),低音量为 25~76,中音量为 76~204,高音量为 204 以上。 + */ + + int linear_volume; + /** + * + * @brief 非线性音量,取值范围是:[–127, 0],单位 dB。此音量范围是将原始音量进行对数转化,在中低音量时分辨更为灵敏,适用于 Active Speaker(房间内最活跃用户)的识别。
    + * 高音量为 0~–20 dB,中音量为 –20~–40dB,低音量为 –40~–60dB,若低于 –60 dB,则为无声。 + */ + + int nonlinear_volume; + /** + * + * @brief 音频流来源的用户 ID + */ + + const char* uid; +}; + +/** + * + * @type keytype + * @brief 音频混音文件播放状态。 + */ + +enum AudioMixingState { + /** + * + * @brief 混音已加载 + */ + + kAudioMixingStatePreloaded = 0, + /** + * + * @brief 混音正在播放 + */ + + kAudioMixingStatePlaying, + /** + * + * @brief 混音暂停 + */ + + kAudioMixingStatePaused, + /** + * + * @brief 混音停止 + */ + + kAudioMixingStateStopped, + /** + * + * @brief 混音播放失败 + */ + + kAudioMixingStateFailed, + /** + * + * @brief 混音播放结束 + */ + + kAudioMixingStateFinished, + /** + * + * @brief 准备 PCM 混音 + */ + + kAudioMixingStatePCMEnabled, + /** + * + * @brief PCM 混音播放结束 + */ + + kAudioMixingStatePCMDisabled, +}; +/** + * + * @type keytype + * @brief 混音错误码。 + */ + +enum AudioMixingError { + /** + * + * @brief 正常 + */ + + kAudioMixingErrorOk = 0, + /** + * + * @brief 预加载失败。找不到混音文件或者文件长度超出 20s + */ + + kAudioMixingErrorPreloadFailed, + /** + * + * @brief 混音开启失败。找不到混音文件或者混音文件打开失败 + */ + + kAudioMixingErrorStartFailed, + /** + * + * @brief 混音 ID 异常 + */ + + kAudioMixingErrorIdNotFound, + /** + * + * @brief 设置混音文件的播放位置出错 + */ + + kAudioMixingErrorSetPositionFailed, + /** + * + * @brief 音量参数不合法,仅支持设置的音量值为[0, 400] + */ + + kAudioMixingErrorInValidVolume, + /** + * + * @brief 播放的文件与预加载的文件不一致。请先使用 unloadAudioMixing 卸载此前的文件。 + */ + + kAudioMixingErrorLoadConflict, + /** + * + * @brief 不支持此混音类型。 + */ + + kAudioMixingErrorIdTypeNotMatch, + /** + * + * @brief 设置混音文件的音调不合法 + */ + + kAudioMixingErrorInValidPitch, + /** + * + * @brief 设置混音文件的音轨不合法 + */ + + kAudioMixingErrorInValidAudioTrack, + /** + * + * @brief 混音文件正在启动中 + */ + + kAudioMixingErrorIsStarting, + /** + * + * @brief 设置混音文件的播放速度不合法 + */ + + kAudioMixingErrorInValidPlaybackSpeed, + /** + * + * @deprecated since 3.25 and will be deleted in 3.51 + * @brief 混音错误码,失败,已废弃 + */ + + kAudioMixingErrorCanNotOpen = 701, +}; +/** + * + * @type keytype + * @brief 播放状态。 + */ + +enum PlayerState { + /** + * + * @brief 播放未启动 + */ + + kPlayerStateIdle = 0, + /** + * + * @brief 已加载 + */ + + kPlayerStatePreloaded, + /** + * + * @brief 已打开 + */ + + kPlayerStateOpened, + /** + * + * @brief 正在播放 + */ + + kPlayerStatePlaying, + /** + * + * @brief 播放已暂停 + */ + + kPlayerStatePaused, + /** + * + * @brief 播放已被主动停止 + */ + + kPlayerStateStopped, + /** + * + * @brief 播放失败 + */ + + kPlayerStateFailed, + /** + * + * @brief 播放自然结束 + */ + + kPlayerStateFinished, + /** + * + * @brief 循环播放结束 + */ + + kPlayerStateLoopFinished, +}; + +/** + * + * @type keytype + * @brief 播放事件 + */ + +enum PlayerEvent { + /** + * + * @brief 开始切换音轨
    + * 开始调用 `selectAudioTrack`{@link #IMediaPlayer#selectAudioTrack} 时,返回此状态。 + */ + + kPlayerEventSelectAudioTrackBegin, + /** + * + * @brief 切换音轨成功
    + * 调用 `selectAudioTrack`{@link #IMediaPlayer#selectAudioTrack} 成功后,播放器切换到指定音轨播放,返回此状态。 + */ + + kPlayerEventSelectAudioTrackCompleted, + /** + * + * @brief 切换音轨失败
    + * 调用 `selectAudioTrack`{@link #IMediaPlayer#selectAudioTrack} 失败后,播放器无法切换到指定音轨,继续之前的音轨播放过程,返回此状态。 + */ + + kPlayerEventSelectAudioTrackFailed, + /** + * + * @brief 试图移动播放位置
    + * 开始调用 `setPosition`{@link #IMediaPlayer#setPosition} 时,返回此状态。 + */ + + kPlayerEventSeekBegin, + /** + * + * @brief 移动播放位置成功
    + * 调用 `setPosition`{@link #IMediaPlayer#setPosition} 成功后,返回此状态。 + */ + + kPlayerEventSeekCompleted, + /** + * + * @brief 移动播放位置失败
    + * 调用 `setPosition`{@link #IMediaPlayer#setPosition} 失败时,返回此状态。 + */ + + kPlayerEventSeekFailed, +}; + +/** + * + * @type keytype + * @brief 播放错误码。 + */ + +enum PlayerError { + /** + * + * @brief 正常 + */ + + kPlayerErrorOK = 0, + /** + * + * @brief 不支持此类型 + */ + + kPlayerErrorFormatNotSupport, + /** + * + * @brief 无效的播放路径 + */ + + kPlayerErrorInvalidPath, + /** + * + * @brief 未满足前序接口调用的要求。请查看具体接口文档。 + */ + + kPlayerErrorInvalidState, + /** + * + * @brief 设置播放位置出错。 + */ + + kPlayerErrorInvalidPosition, + /** + * + * @brief 音量参数不合法。 + */ + + kPlayerErrorInvalidVolume, + /** + * + * @brief 音调参数设置不合法。 + */ + + kPlayerErrorInvalidPitch, + /** + * + * @brief 音轨参数设置不合法。 + */ + + kPlayerErrorInvalidAudioTrackIndex, + /** + * + * @brief 播放速度参数设置不合法 + */ + + kPlayerErrorInvalidPlaybackSpeed, + /** + * + * @brief 音效 ID 异常。还未加载或播放文件,就调用其他 API。 + */ + + kPlayerErrorInvalidEffectId, + /** + * + * @brief 资源正在播放中 + */ + + kPlayerErrorCurrentlyPlaying, +}; + +/** + * + * @type keytype + * @brief 是否开启耳返功能。 + */ + +enum EarMonitorMode { + /** + * + * @brief 关闭 + */ + + kEarMonitorModeOff = 0, + /** + * + * @brief 开启 + */ + + kEarMonitorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 耳返音频是否经过本地音频处理。 + */ + +enum EarMonitorAudioFilter { + /** + * + * @brief 无音频处理。 + */ + + kEarMonitorAudioFilterNone = 0x1, + /** + * + * @brief 经本地音频处理后的音频,包括 3A、变声、混响等 SDK 提供处理能力以及自定义音频处理。 + */ + + kEarMonitorAudioFilterReuseAudioProcessing = 0x8000 +}; + +/** + * + * @hidden currently not available + * @type keytype + * @region 音频管理 + * @brief 音频编码类型 + */ + +enum AudioCodecType { + /** + * + * @brief 未知编码类型 + */ + + kAudioCodecTypeNone = 0, + /** + * + * @brief Opus 编码类型 + */ + + kAudioCodecTypeOpus, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAAC, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACLC = 2, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACHEv1, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACHEv2, + /** + * + * @hidden currently not available + */ + + kAudioCodecTypeAACLCadts, +}; +/** + * + * @type keytype + * @brief 音频输入格式 + */ + +enum class AudioFormatType { + /** + * + * @brief PCM_S16 + */ + + kRawPCMs16 = 0, + /** + * + * @brief PCM_S32 + */ + + kRawPCMs32 = 1, +}; + +/** + * + * @type keytype + * @brief 蓝牙模式, 仅能在媒体模式下被设置 + */ + +enum BluetoothMode { + /** + * + * @brief 自动选择模式 + */ + + kBluetoothModeAuto = 0, + /** + * + * @brief 使用 A2DP 模式 + */ + + kBluetoothModeA2DP, + /** + * + * @brief HFP 模式 + */ + + kBluetoothModeHFP +}; + +/** + * + * @type keytype + * @brief 音频输入源类型 + */ + +enum AudioSourceType { + /** + * + * @brief 自定义采集音频源 + */ + + kAudioSourceTypeExternal = 0, + /** + * + * @brief RTC SDK 内部采集音频源 + */ + + kAudioSourceTypeInternal, +}; + +/** + * + * @type keytype + * @brief 音频输出类型 + */ + +enum AudioRenderType { + /** + * + * @brief 自定义渲染 + */ + + kAudioRenderTypeExternal = 0, + /** + * + * @brief RTC SDK 内部渲染 + */ + + kAudioRenderTypeInternal, +}; + +/** + * + * @type keytype + * @brief 混音播放类型 + */ + +enum AudioMixingType { + /** + * + * @brief 仅本地播放 + */ + + kAudioMixingTypePlayout, + /** + * + * @brief 仅远端播放 + */ + + kAudioMixingTypePublish, + /** + * + * @brief 本地和远端同时播放 + */ + + kAudioMixingTypePlayoutAndPublish +}; + +/** + * + * @type keytype + * @brief 混音播放声道类型 + */ + +enum AudioMixingDualMonoMode{ + /** + * + * @brief 和音频文件一致 + */ + + kAudioMixingDualMonoModeAuto, + /** + * + * @brief 只能听到音频文件中左声道的音频 + */ + + kAudioMixingDualMonoModeL, + /** + * + * @brief 只能听到音频文件中右声道的音频 + */ + + kAudioMixingDualMonoModeR, + /** + * + * @brief 能同时听到音频文件中左右声道的音频 + */ + + kAudioMixingDualMonoModeMix +}; +/** + * + * @type keytype + * @brief 混音配置 + */ + +struct AudioEffectPlayerConfig { + /** + * + * @brief 混音播放类型,详见 AudioMixingType{@link #AudioMixingType} + */ + + AudioMixingType type = kAudioMixingTypePlayoutAndPublish; + /** + * + * @brief 混音播放次数
    + * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + + int play_count = 1; + /** + * + * @brief 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + */ + + int pitch = 0; + /** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + + int start_pos = 0; +}; +/** + * + * @type keytype + * @brief 混音配置 + */ + +struct MediaPlayerConfig { + /** + * + * @brief 混音播放次数
    + * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + + int play_count = 1; + /** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + + int start_pos = 0; + /** + * + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress{@link #IMediaPlayerEventHandler#onMediaPlayerPlayingProgress} 的间隔。单位毫秒。
    + * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + */ + + int64_t callback_on_progress_interval = 0; + /** + * + * @brief 在采集音频数据时,附带本地混音文件播放进度的时间戳。启用此功能会提升远端人声和音频文件混音播放时的同步效果。
    + * - 仅在单个音频文件混音时使用有效。 + * - `true` 时开启此功能,`false` 时关闭此功能,默认为关闭。 + */ + + bool sync_progress_to_record_frame = false; + /** + * + * @brief 是否自动播放。如果不自动播放,调用 start{@link #IMediaPlayer#start} 播放音乐文件。 + */ + + bool auto_play = true; + /** + * + * @brief 混音播放类型,详见 AudioMixingType{@link #AudioMixingType} + */ + + AudioMixingType type = kAudioMixingTypePlayoutAndPublish; +}; + +/** + * + * @type keytype + * @brief 音量回调模式。 + */ + +enum AudioReportMode { + /** + * + * @brief 默认始终开启音量回调。 + */ + + kAudioReportModeNormal, + /** + * + * @brief 可见用户进房并停止推流后,关闭音量回调。 + */ + + kAudioReportModeDisconnect, + /** + * + * @brief 可见用户进房并停止推流后,开启音量回调,回调值重置为 0。 + */ + + kAudioReportModeReset, +}; + +/** + * + * @type keytype + * @brief onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport} 中包含的音频信息的范围。 + */ + +enum AudioPropertiesMode { + /** + * + * @brief 仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + + kAudioPropertiesModeMicrophone, + /** + * + * @brief 包含以下信息:
    + * - 本地麦克风采集的音频数据和本地屏幕音频采集数据; + * - 本地混音的音频数据。 + */ + + kAudioPropertiesModeAudioMixing +}; + +/** + * + * @type keytype + * @brief 音频属性信息提示的相关配置。 + */ + +struct AudioPropertiesConfig { + /** + * + * @brief 信息提示间隔,单位:ms
    + * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + + int interval = 0; + + /** + * + * @brief 是否开启音频频谱检测。 + */ + + bool enable_spectrum = false; + + /** + * + * @brief 是否开启人声检测 (VAD)。 + */ + + bool enable_vad = false; + + /** + * + * @brief 音量回调配置模式。详见 AudioReportMode{@link #AudioReportMode}。 + */ + + AudioReportMode local_main_report_mode = kAudioReportModeNormal; + + /** + * + * @brief 适用于音频属性信息提示的平滑系数。取值范围是 `(0.0, 1.0]`。
    + * 默认值为 `1.0`,不开启平滑效果;值越小,提示音量平滑效果越明显。如果要开启平滑效果,可以设置为 `0.3`。 + */ + + float smooth = 1.0f; + + /** + * + * @brief onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport} 中包含音频数据的范围。参看 AudioPropertiesMode{@link #AudioPropertiesMode}。
    + * 默认仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + + AudioPropertiesMode audio_report_mode = kAudioPropertiesModeMicrophone; + /** + * + * @brief 是否回调本地用户的人声基频。 + */ + + bool enable_voice_pitch = false; +}; +/** + * + * @type keytype + * @brief 音频属性信息 + */ + +struct AudioPropertiesInfo { + /** + * + * @brief 线性音量,与原始音量呈线性关系,数值越大,音量越大。取值范围是:[0,255]。
    + * - [0, 25]:近似无声 + * - [26, 75]:低音量 + * - [76, 204]:中音量 + * - [205, 255]:高音量 + */ + + int linear_volume = 0; + /** + * + * @brief 非线性音量。由原始音量的对数值转化而来,因此在中低音量时更灵敏,可以用作 Active Speaker(房间内最活跃用户)的识别。取值范围是:[-127,0],单位 dB。
    + * - [-127, -60]:无声 + * - [-59, -40]:低音量 + * - [-39, -20]:中音量 + * - [-19, 0]:高音量 + */ + + int nonlinear_volume = 0; + /** + * + * @brief 频谱数组。默认长度为 257。 + */ + + float spectrum[SPECTRUM_SIZE] = {0}; + /** + * + * @brief 人声检测(VAD)结果
    + * - 1: 检测到人声。 + * - 0: 未检测到人声。 + * - -1: 未开启 VAD。 + */ + + int vad = -1; + + /** + * + * @brief 本地用户的人声基频,单位为赫兹。
    + * 同时满足以下两个条件时,返回的值为本地用户的人声基频:
    + * - 调用 enableAudioPropertiesReport{@link #IRTCEngine#enableAudioPropertiesReport},并设置参数 enable_voice_pitch 的值为 `true`。 + * - 本地采集的音频中包含本地用户的人声。 + * 其他情况下返回 `0`。 + */ + + double voice_pitch = 0; +}; + +/** + * + * @type keytype + * @brief 远端音频属性信息 + */ + +struct RemoteAudioPropertiesInfo { + /** + * + * @type keytype + * @brief 流 ID + */ + + const char* stream_id; + /** + * + * @brief 流信息。参看 StreamInfo{@link #StreamInfo} + */ + + StreamInfo stream_info; + /** + * + * @type keytype + * @brief 音频属性信息,详见 AudioPropertiesInfo{@link #AudioPropertiesInfo} + */ + + AudioPropertiesInfo audio_properties_info; +}; + +/** + * + * @type keytype + * @brief 本地音频属性信息 + */ + +struct LocalAudioPropertiesInfo { + /** + * + * @type keytype + * @brief 音频源 + */ + + IAudioSource* audio_source; + /** + * + * @type keytype + * @brief 音频属性信息,详见 AudioPropertiesInfo{@link #AudioPropertiesInfo} + */ + + AudioPropertiesInfo audio_properties_info; +}; + +/** + * + * @type keytype + * @brief 音质档位 + */ + +enum AudioProfileType { + /** + * + * @brief 默认音质
    + * 服务器下发或客户端已设置的 RoomProfileType{@link #RoomProfileType} 的音质配置 + */ + + kAudioProfileTypeDefault = 0, + /** + * + * @brief 流畅
    + * 单声道,采样率为 16 kHz,编码码率为 32 Kbps。
    + * 流畅优先、低功耗、低流量消耗,适用于大部分游戏场景,如小队语音、组队语音、国战语音等。 + */ + + kAudioProfileTypeFluent = 1, + /** + * + * @brief 单声道标准音质。
    + * 采样率为 24 kHz,编码码率为 48 Kbps。
    + * 适用于对音质有一定要求的场景,同时延时、功耗和流量消耗相对适中,适合教育场景和狼人杀等游戏。 + */ + + kAudioProfileTypeStandard = 2, + /** + * + * @brief 双声道音乐音质
    + * 采样率为 48 kHz,编码码率为 128 kbps。
    + * 超高音质,同时延时、功耗和流量消耗相对较大,适用于连麦 PK 等音乐场景。
    + * 游戏场景不建议使用。 + */ + + kAudioProfileTypeHD = 3, + /** + * + * @brief 双声道标准音质。采样率为 48 KHz,编码码率最大值为 80 Kbps + */ + + kAudioProfileTypeStandardStereo = 4, + /** + * + * @brief 单声道音乐音质。采样率为 48 kHz,编码码率最大值为 64 Kbps + */ + + kAudioProfileTypeHDMono = 5, +}; + +/** + * + * @type keytype + * @brief 降噪模式。降噪算法受调用 joinRoom{@link #IRTCRoom#joinRoom} 时设置的房间模式影响。 + */ + +enum AnsMode { + /** + * + * @brief 禁用音频降噪。 + */ + + kAnsModeDisable = 0, + /** + * + * @brief 适用于微弱降噪。 + */ + + kAnsModeLow = 1, + /** + * + * @brief 适用于抑制中度平稳噪音,如空调声、风扇声。 + */ + + kAnsModeMedium = 2, + /** + * + * @brief 适用于抑制嘈杂非平稳噪音,如键盘声、敲击声、碰撞声、动物叫声。 + */ + + kAnsModeHigh = 3, + /** + * + * @brief 启用音频降噪能力。具体的降噪算法由 RTC 决定。 + */ + + kAnsModeAutomatic = 4, +}; + +/** + * + * @type keytype + * @brief 本地用户在房间内的位置坐标,需自行建立空间直角坐标系 + */ + +struct Position { + /** + * + * @brief x 坐标 + */ + + float x; + /** + * + * @brief y 坐标 + */ + + float y; + /** + * + * @brief z 坐标 + */ + + float z; + /** + * + * @hidden constructor/destructor + */ + + bool isEqual(const Position& pos) const { + return (fabs(x - pos.x) < 1e-2) && + (fabs(y - pos.y) < 1e-2) && + (fabs(z - pos.z) < 1e-2); + } +}; + +/** + * + * @type keytype + * @brief 方向朝向信息 + */ + +struct Orientation { + /** + * + * @brief x 坐标 + */ + + float x; + /** + * + * @brief y 坐标 + */ + + float y; + /** + * + * @brief z 坐标 + */ + + float z; + /** + * + * @hidden constructor/destructor + */ + + bool isEqual(const Orientation& orientation) const { + return x == orientation.x && y == orientation.y && z == orientation.z; + } +}; + +/** + * + * @type keytype + * @brief 三维朝向信息,三个向量需要两两垂直。参看 Orientation{@link #Orientation}。 + */ + +struct HumanOrientation { + /** + * + * @brief 正前方朝向,默认值为 {1,0,0},即正前方朝向 x 轴正方向 + */ + + Orientation forward = { 1, 0, 0 }; + /** + * + * @brief 正右方朝向,默认值为 {0,1,0},即右手朝向 y 轴正方向 + */ + + Orientation right = { 0, 1, 0 }; + /** + * + * @brief 正上方朝向,默认值为 {0,0,1},即头顶朝向 z 轴正方向 + */ + + Orientation up = { 0, 0, 1 }; + /** + * + * @hidden constructor/destructor + */ + + bool isEqual(const HumanOrientation& human_orientation) const { + return forward.isEqual(human_orientation.forward) && right.isEqual(human_orientation.right) && up.isEqual(human_orientation.up); + } +}; + +/** + * + * @type keytype + * @brief 音频音量是否可设置 + */ + +enum AudioAbilityType { + /** + * + * @brief 未知 + */ + + kAudioAbilityTypeUnknown = -1, + /** + * + * @brief 音量可设置 + */ + + kAudioAbilityTypeAble = 0, + /** + * + * @brief 音量不可设置 + */ + + kAudioAbilityTypeUnable = 1, +}; +/** + * + * @type keytype + * @brief 远端音频流精准对齐模式 + */ + +enum AudioAlignmentMode { + /** + * + * @brief 不对齐 + */ + + kAudioAlignmentModeOff, + /** + * + * @brief 远端音频流都对齐伴奏进度同步播放 + */ + + kAudioAlignmentModeAudioMixing, +}; + +/** + * + * @type keytype + * @brief 音频设备信息 + */ + +struct AudioDeviceInfo { + /** + * + * @brief 设备 ID + */ + + char device_id[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备全称,包含设备类型与设备名称。例如 "扬声器 (XYZ Audio Adapter)" + */ + + char device_name[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备名称,不含设备类型。例如 "XYZ Audio Adapter" + */ + + char device_short_name[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备所连接的声卡 ID,便于选择使用同一声卡的扬声器和麦克风。 + */ + + char device_container_id[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备的厂商 ID + */ + + int64_t device_vid; + /** + * + * @brief 设备的产品编码 + */ + + int64_t device_pid; + /** + * + * @brief 设备的传输方式 + */ + + DeviceTransportType transport_type; + /** + * + * @brief 是否支持设置音量 + */ + + AudioAbilityType volume_settable; + /** + * + * @brief 是否系统默认设备 + */ + + bool is_system_default; + /** + * + * @hidden constructor/destructor + */ + + AudioDeviceInfo() { + memset(device_id, 0, MAX_DEVICE_ID_LENGTH); + memset(device_name, 0, MAX_DEVICE_ID_LENGTH); + memset(device_short_name, 0, MAX_DEVICE_ID_LENGTH); + memset(device_container_id, 0, MAX_DEVICE_ID_LENGTH); + this->device_vid = 0; + this->device_pid = 0; + this->transport_type = DeviceTransportType::kDeviceTransportTypeUnknown; + this->volume_settable = AudioAbilityType::kAudioAbilityTypeUnknown; + this->is_system_default = false; + } + /** + * + * @hidden constructor/destructor + */ + + AudioDeviceInfo& operator=(const AudioDeviceInfo& src) { + if (this != &src) { + strncpy(device_id, src.device_id, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_name, src.device_name, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_short_name, src.device_short_name, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_container_id, src.device_container_id, MAX_DEVICE_ID_LENGTH - 1); + device_id[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_name[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_short_name[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_container_id[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_vid = src.device_vid; + device_pid = src.device_pid; + transport_type = src.transport_type; + volume_settable = src.volume_settable; + is_system_default = src.is_system_default; + } + + return *this; + } +}; +/** + * + * @type keytype + * @brief 标准音高数据 + */ + +struct StandardPitchInfo { + /** + * + * @brief 开始时间,单位 ms。 + */ + + int start_time; + /** + * + * @brief 持续时间,单位 ms。 + */ + + int duration; + /** + * + * @brief 音高。 + */ + + int pitch; +}; +/** + * + * @type keytype + * @hidden + * @brief K 歌打分维度。 + */ + +enum MulDimSingScoringMode { + /** + * + * @brief 按照音高进行评分。 + */ + + kMulDimSingScoringModeNote = 0 +}; +/** + * + * @type keytype + * @hidden + * @brief K 歌评分配置。 + */ + +struct SingScoringConfig { + /** + * + * @brief 音频采样率。仅支持 44100 Hz、48000 Hz。 + */ + + AudioSampleRate sample_rate; + /** + * + * @brief 打分维度,详见 MulDimSingScoringMode{@link #MulDimSingScoringMode}。 + */ + + MulDimSingScoringMode mode; + /** + * + * @brief 歌词文件路径。打分功能仅支持 KRC 歌词文件。 + */ + + const char* lyrics_filepath; + /** + * + * @brief 歌曲 midi 文件路径。 + */ + + const char* midi_filepath; +}; +/** + * + * @type keytype + * @hidden + * @brief 实时评分信息。 + */ + +struct SingScoringRealtimeInfo { + /** + * + * @brief 当前播放进度。 + */ + + int current_position; + /** + * + * @brief 演唱者的音高。 + */ + + int user_pitch; + /** + * + * @brief 标准音高。 + */ + + int standard_pitch; + /** + * + * @brief 歌词分句索引。 + */ + + int sentence_index; + /** + * + * @brief 上一句歌词的评分。 + */ + + int sentence_score; + /** + * + * @brief 当前演唱的累计分数。 + */ + + int total_score; + /** + * + * @brief 当前演唱的平均分数。 + */ + + int average_score; +}; +/** + * + * @type keytype + * @brief 音频文件录制内容来源。 + */ + +enum AudioFrameSource { + /** + * + * @brief 本地麦克风采集的音频数据。 + */ + + kAudioFrameSourceMic = 0, + /** + * + * @brief 远端所有用户混音后的数据 + */ + + kAudioFrameSourcePlayback = 1, + /** + * + * @brief 本地麦克风和所有远端用户音频流的混音后的数据 + */ + + kAudioFrameSourceMixed = 2, +}; +/** + * + * @type keytype + * @brief 音频质量。 + */ + +enum AudioQuality { + /** + * + * @brief 低音质 + */ + + kAudioQualityLow = 0, + /** + * + * @brief 中音质 + */ + + kAudioQualityMedium = 1, + /** + * + * @brief 高音质 + */ + + kAudioQualityHigh = 2, + /** + * + * @brief 超高音质 + */ + + kAudioQualityUltraHigh = 3, +}; +/** + * + * @type keytype + * @brief 录音配置 + */ + +struct AudioRecordingConfig { + /** + * + * @hidden constructor/destructor + */ + + AudioRecordingConfig() { + absolute_file_name = nullptr; + frame_source = kAudioFrameSourceMixed; + sample_rate = kAudioSampleRateAuto; + channel = kAudioChannelAuto; + quality = kAudioQualityMedium; + } + /** + * + * @brief 录制文件路径。一个有读写权限的绝对路径,包含文件名和文件后缀。
    + * 录制文件的格式仅支持 .aac 和 .wav。 + */ + + const char* absolute_file_name; + /** + * + * @brief 录音内容来源,参看 AudioFrameSource{@link #AudioFrameSource}。
    + * 默认为 kAudioFrameSourceMixed = 2。 + */ + + AudioFrameSource frame_source; + /** + * + * @brief 录音采样率。参看 AudioSampleRate{@link #AudioSampleRate}。 + */ + + AudioSampleRate sample_rate; + /** + * + * @brief 录音音频声道。参看 AudioChannel{@link #AudioChannel}。
    + * 如果录制时设置的音频声道数与采集时的音频声道数不同:
    + * - 如果采集的声道数为 1,录制的声道数为 2,那么,录制的音频为经过单声道数据拷贝后的双声道数据,而不是立体声。 + * - 如果采集的声道数为 2,录制的声道数为 1,那么,录制的音频为经过双声道数据混合后的单声道数据。 + */ + + AudioChannel channel; + /** + * + * @brief 录音音质。仅在录制文件格式为 .aac 时可以设置。参看 AudioQuality{@link #AudioQuality}。
    + * 采样率为 32kHz 时,不同音质录制文件(时长为 10min)的大小分别是:
    + * - 低音质:1.2MB; + * - 【默认】中音质:2MB; + * - 高音质:3.75MB; + * - 超高音质:7.5MB。 + */ + + AudioQuality quality; +}; +/** + * + * @type keytype + * @brief 录音配置 + */ + +enum AudioRecordingState { + /** + * + * @brief 录制异常 + */ + + kAudioRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + kAudioRecordingStateProcessing = 1, + /** + * + * @brief 已结束录制,并且录制文件保存成功。 + */ + + kAudioRecordingStateSuccess = 2, +}; +/** + * + * @type errorcode + * @brief 音频文件录制的错误码 + */ + +enum AudioRecordingErrorCode { + /** + * + * @brief 录制正常 + */ + + kAudioRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + kAudioRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 没有进入房间 + */ + + kAudioRecordingErrorCodeNotInRoom = -2, + /** + * + * @brief 录制已经开始 + */ + + kAudioRecordingErrorCodeAlreadyStarted = -3, + /** + * + * @brief 录制还未开始 + */ + + kAudioRecordingErrorCodeNotStarted = -4, + /** + * + * @brief 录制失败。文件格式不支持。 + */ + + kAudioRecordingErrorCodeNotSupport = -5, + /** + * + * @brief 其他异常 + */ + + kAudioRecordingErrorCodeOther = -6, +}; +/** + * + * @hidden(macOS, Windows, Linux) + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +struct AudioEnhancementConfig { + /** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_signaling = false; + /** + * + * @brief 对音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_audio = false; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_device_manager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_device_manager.h new file mode 100644 index 0000000..7922bc3 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_device_manager.h @@ -0,0 +1,521 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Device Manager +*/ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @deprecated since 3.42 and will be deleted in 3.51, use IAudioDeviceCollection{@link #IAudioDeviceCollection} and IVideoDeviceCollection{@link #IVideoDeviceCollection} instead. + * @type api + * @brief 音视频设备相关的信息 + * @list 引擎管理 + */ + +class IDeviceCollection { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IDeviceCollection() { + } + /** + * + * @type api + * @brief 获取当前系统内音视频设备数量 + * @return 音视频设备数量 + * @list 引擎管理 + */ + + virtual int getCount() = 0; + /** + * + * @type api + * @brief 获取音频设备信息,可根据索引号、设备名称、设备 ID 获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IAudioDeviceCollection#getCount} 返回值。 + * @param device_name 设备名称 + * @param device_id 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, char device_name[MAX_DEVICE_ID_LENGTH], char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 释放当前 IAudioDeviceCollection{@link #IAudioDeviceCollection} 对象占用的资源。 + * @note 不需要返回音视频设备相关信息列表时应该调用本方法释放相关资源。 + * @list 引擎管理 + */ + + virtual void release() = 0; +/** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IDeviceCollection() { + } +}; +/** + * + * @hidden(Android,iOS) + * @type api + * @brief 音频设备相关的信息 + * @list 引擎管理 + */ + +class IAudioDeviceCollection : public IDeviceCollection { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IAudioDeviceCollection() {}; + /** + * + * @type api + * @brief 获取当前系统内音频设备数量 + * @return 音频设备数量 + * @list 引擎管理 + */ + + virtual int getCount() override {return 0;}; + /** + * + * @type api + * @brief 根据索引号,获取设备信息 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IAudioDeviceCollection#getCount} 返回值。 + * @param device_name 设备名称 + * @param device_id 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, char device_name[MAX_DEVICE_ID_LENGTH], char device_id[MAX_DEVICE_ID_LENGTH]) override {return 0;}; + /** + * + * @type api + * @brief 释放当前 IAudioDeviceCollection{@link #IAudioDeviceCollection} 对象占用的资源。 + * @note 不需要返回音频设备相关信息列表时应该调用本方法释放相关资源。 + * @list 引擎管理 + */ + + virtual void release()override {}; + /** + * + * @type api + * @brief 获取音频设备信息,可根据索引号、设备信息(ID、设备的产品编码等)获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IAudioDeviceCollection#getCount} 返回值。 + * @param audio_device_info 设备信息,详见 AudioDeviceInfo{@link #AudioDeviceInfo} + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, AudioDeviceInfo* audio_device_info) = 0; +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioDeviceCollection() {}; +}; +/** + * + * @hidden(Android,iOS) + * @type api + * @brief 音频设备管理类 + * @list 引擎管理 + */ + +class IAudioDeviceManager { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IAudioDeviceManager() { + } + /** + * + * @type api + * @brief 获取当前系统内音频播放设备列表。如果后续设备有变更,你会收到 `onAudioMediaDeviceStateChanged` 回调通知,然后需要重新调用本接口以获得新的设备列表。 + * @return 包含系统中所有音频播放设备的列表,参看 IAudioDeviceCollection{@link #IAudioDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 监听到 `kMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 音频管理 + */ + + virtual IAudioDeviceCollection* enumerateAudioPlaybackDevices() = 0; + /** + * + * @type api + * @brief 获取当前系统内音频采集设备列表。如果后续设备有变更,你需要重新调用本接口以获得新的设备列表。 + * @return 一个包含系统中所有音频采集设备列表的对象,详见 IAudioDeviceCollection{@link #IAudioDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 监听到 `kMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note + * - 你可以在收到 onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual IAudioDeviceCollection* enumerateAudioCaptureDevices() = 0; + /** + * + * @type api + * @brief 设置音频播放路由是否跟随系统。 + * @param followed
    + * - true: 跟随。此时,调用 setAudioPlaybackDevice{@link #IAudioDeviceManager#setAudioPlaybackDevice} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioPlaybackDevice{@link #IAudioDeviceManager#setAudioPlaybackDevice} 进行设置。 + * @list 音频管理 + */ + + virtual void followSystemPlaybackDevice(bool followed) = 0; + /** + * + * @type api + * @brief 设置音频采集路由是否跟随系统。 + * @param followed
    + * - true: 跟随。此时,调用 setAudioCaptureDevice{@link #IAudioDeviceManager#setAudioCaptureDevice} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioCaptureDevice{@link #IAudioDeviceManager#setAudioCaptureDevice} 进行设置。 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual void followSystemCaptureDevice(bool followed) = 0; + /** + * + * @type api + * @brief 设置音频播放设备。 + * @param device_id 音频播放设备 ID,可通过 enumerateAudioPlaybackDevices{@link #IAudioDeviceManager#enumerateAudioPlaybackDevices}
    + * 获取。 + * @return + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 当你调用 followSystemPlaybackDevice{@link #IAudioDeviceManager#followSystemPlaybackDevice} 设置音频播放设备跟随系统后,将无法调用此接口设置音频播放设备。 + * @list 音频管理 + */ + + virtual int setAudioPlaybackDevice(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 设置音频采集设备。 + * @param device_id 音频采集设备 ID,可通过 enumerateAudioCaptureDevices{@link #IAudioDeviceManager#enumerateAudioCaptureDevices} 获取。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 当你调用 followSystemCaptureDevice{@link #IAudioDeviceManager#followSystemCaptureDevice} 设置音频采集设备跟随系统后,将无法调用此接口设置音频采集设备。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int setAudioCaptureDevice(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 设置当前音频播放设备音量 + * @param volume 音频播放设备音量,取值范围为 [0,255], 超出此范围设置无效。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int setAudioPlaybackDeviceVolume(unsigned int volume) = 0; + /** + * + * @type api + * @brief 获取当前音频播放设备音量 + * @param volume 音频播放设备音量,范围应在 [0,255] 内。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int getAudioPlaybackDeviceVolume(unsigned int* volume) = 0; + /** + * + * @type api + * @brief 设置当前音频采集设备音量 + * @param volume 音频采集设备音量,取值范围为 [0,255], 超出此范围设置无效。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功。将影响 onLocalAudioPropertiesReport{@link #IRTCEngineEventHandler#onLocalAudioPropertiesReport} 回调的音量信息。 + * - < 0:方法调用失败。 + * @note + * + 对于已静音设备,音量设置会在调用 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 取消静音后生效。 + * + 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int setAudioCaptureDeviceVolume(unsigned int volume) = 0; + /** + * + * @type api + * @brief 获取当前音频采集设备音量 + * @param volume 音频采集设备音量,范围应在 [0,255] 内。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int getAudioCaptureDeviceVolume(unsigned int* volume) = 0; + /** + * + * @type api + * @brief 设置当前音频播放设备静音状态,默认为非静音。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int setAudioPlaybackDeviceMute(bool mute) = 0; + /** + * + * @type api + * @brief 获取当前音频播放设备是否静音的信息。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int getAudioPlaybackDeviceMute(bool* mute) = 0; + /** + * + * @type api + * @brief 设置当前音频采集设备静音状态,默认为非静音。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法用于静音整个系统的音频采集。你也可以仅对麦克风采集到的音频信号做静音处理,而不影响媒体播放器的音乐声音,具体参看 muteAudioCapture{@link #IRTCEngine#muteAudioCapture} 方法说明。 + * - 设该方法为 `true` 静音后仍可通过 setAudioCaptureDeviceVolume{@link #IAudioDeviceManager#setAudioCaptureDeviceVolume} 调整采集音量,调整后的音量会在取消静音后生效。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int setAudioCaptureDeviceMute(bool mute) = 0; + /** + * + * @type api + * @brief 获取当前音频采集设备是否静音的信息。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int getAudioCaptureDeviceMute(bool* mute) = 0; + /** + * + * @type api + * @brief 获取当前音频播放设备 ID。 + * @param device_id 音频播放设备 ID + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int getAudioPlaybackDevice(char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 获取当前音频采集设备 ID。 + * @param device_id 音频采集设备 ID,使用方负责按 MAX_DEVICE_ID_LENGTH 大小,分配与释放内存 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int getAudioCaptureDevice(char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 尝试初始化音频播放设备,可检测出设备不存在、权限被拒绝/禁用等异常问题。 + * @param device_id 设备索引号 + * @return 设备状态错误码
    + * - 0: 设备检测结果正常 + * - -1: 接口状态不正确,例如在正常启动采集后再调用该接口进行检测 + * - -2: 采集设备无麦克风权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note 1. 该接口需在进房前调用;
    + * 2. 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * @list 音频管理 + */ + + virtual int initAudioPlaybackDeviceForTest(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 尝试初始化音频采集设备,可检测设备不存在、权限被拒绝/禁用等异常问题。 + * @param device_id 设备索引 + * @return 设备状态错误码
    + * - 0: 设备检测结果正常 + * - -1: 接口状态不正确,例如在正常启动采集后再调用该接口进行检测 + * - -2: 采集设备无麦克风权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note + * - 该接口需在进房前调用;
    + * - 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int initAudioCaptureDeviceForTest(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 启动音频播放设备检测。测试启动后,循环播放指定的音频文件,同时将通过 `onAudioPlaybackDeviceTestVolume` 回调播放时的音量信息。 + * @param test_audio_file_path 指定播放设备检测的音频文件网络地址。支持的格式包括 mp3,aac,m4a,3gp 和 wav。 + * @param indication_interval 设置 `onAudioPlaybackDeviceTestVolume` 音量回调的时间间隔,推荐设置为 200 毫秒或以上。单位为毫秒。最小值为 10 毫秒。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法可在进房前和进房后调用,不可与其它音频设备测试功能同时应用。 + * - 调用 stopAudioPlaybackDeviceTest{@link #IAudioDeviceManager#stopAudioPlaybackDeviceTest} 可以停止测试。 + * @list 音频管理 + */ + + virtual int startAudioPlaybackDeviceTest(const char* test_audio_file_path, int indication_interval) = 0; + /** + * + * @type api + * @brief 停止音频播放测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 调用 startAudioPlaybackDeviceTest{@link #IAudioDeviceManager#startAudioPlaybackDeviceTest} 后,调用本方法停止测试。 + * @list 音频管理 + */ + + virtual int stopAudioPlaybackDeviceTest() = 0; + /** + * + * @hidden(iOS, Linux) + * @type api + * @brief 开始音频采集设备和音频播放设备测试。 + * @param indication_interval 测试中会收到 `onLocalAudioPropertiesReport` 回调,本参数指定了该周期回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法在进房前后均可调用。且不可与其它音频设备测试功能同时应用。 + * - 调用本接口 30 s 后,采集自动停止,并开始播放采集到的声音。录音播放完毕后,设备测试流程自动结束。你也可以在 30 s 内调用 stopAudioDeviceRecordAndPlayTest{@link #IAudioDeviceManager#stopAudioDeviceRecordAndPlayTest} 来停止采集并开始播放此前采集到的声音。 + * - 调用 stopAudioDevicePlayTest{@link #IAudioDeviceManager#stopAudioDevicePlayTest} 可以停止音频设备采集和播放测试。 + * - 你不应在测试过程中,调用 `enableAudioPropertiesReport` 注册音量提示回调。 + * - 该方法仅在本地进行音频设备测试,不涉及网络连接。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int startAudioDeviceRecordTest(int indication_interval) = 0; + /** + * + * @hidden(iOS, Linux) + * @type api + * @brief 停止采集本地音频,并开始播放采集到的声音。录音播放完毕后,设备测试流程结束。
    + * 调用 startAudioDeviceRecordTest{@link #IAudioDeviceManager#startAudioDeviceRecordTest} 30 s 内调用本接口来停止采集并开始播放此前采集到的声音。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 调用本接口开始播放录音后,可以在播放过程中调用 stopAudioDevicePlayTest{@link #IAudioDeviceManager#stopAudioDevicePlayTest} 停止播放。 + * - 对 Linux SDK:仅在 Client 版本有,在 Server 版本上没有。 + * @list 音频管理 + */ + + virtual int stopAudioDeviceRecordAndPlayTest() = 0; + /** + * + * @hidden(iOS, Linux) + * @type api + * @brief 停止由调用 startAudioDeviceRecordTest{@link #IAudioDeviceManager#startAudioDeviceRecordTest} 开始的音频播放设备测试。
    + * 在音频播放设备测试自动结束前,可调用本接口停止音频采集与播放测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + + virtual int stopAudioDevicePlayTest() = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioDeviceManager() { + } +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_effect_player.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_effect_player.h new file mode 100644 index 0000000..b914a5e --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_effect_player.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Effect Player +*/ +#pragma once + +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @type callback + * @brief IAudioEffectPlayer{@link #IAudioEffectPlayer} 对应的回调句柄。你必须调用 setEventHandler{@link #IAudioEffectPlayer#setEventHandler} 完成设置后,才能收到对应回调。 + * @list 混音 + */ + +class IAudioEffectPlayerEventHandler { +public: + virtual ~IAudioEffectPlayerEventHandler() {} + /** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param effect_id IAudioEffectPlayer{@link #IAudioEffectPlayer} 的 ID。通过 getAudioEffectPlayer{@link #IRTCEngine#getAudioEffectPlayer} 设置。 + * @param state 混音状态。参考 PlayerState{@link #PlayerState}。 + * @param error 错误码。参考 PlayerError{@link #PlayerError}。 + * @list 混音 + */ + + virtual void onAudioEffectPlayerStateChanged(int effect_id, PlayerState state, PlayerError error) = 0; +}; +/** + * + * @valid since 3.53 + * @type api + * @brief 音效播放器
    + * 调用 setEventHandler{@link #IAudioEffectPlayer#setEventHandler} 设置回调句柄以获取相关回调。 + * @list 混音 + */ + +class IAudioEffectPlayer { +public: + IAudioEffectPlayer(){} + virtual ~IAudioEffectPlayer() {} + /** + * + * @type api + * @brief 开始播放音效文件。
    + * 可以通过传入不同的 ID 和 filepath 多次调用本方法,以实现同时播放多个音效文件,实现音效叠加。 + * @param effect_id 音效 ID。用于标识音效,请保证音效 ID 唯一性。
    + * 如果使用相同的 ID 重复调用本方法后,上一个音效会停止,下一个音效开始,并收到 onAudioEffectPlayerStateChanged{@link #IAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged}。 + * @param file_path 音效文件路径。
    + * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
    + * 推荐的音效文件采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
    + * 不同平台支持的本地音效文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYYYY
    iOS/macOSYYYYYY
    WindowsYYYYYYYY
    + * 不同平台支持的在线音效文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYY
    iOS/macOSYYYY
    WindowsYYYYYYY
    + * @param config 音效配置,详见 AudioEffectPlayerConfig{@link #AudioEffectPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果已经通过 preload{@link #IAudioEffectPlayer#preload} 将文件加载至内存,确保此处的 ID 与 preload{@link #IAudioEffectPlayer#preload} 设置的 ID 相同。 + * - 开始播放音效文件后,可以调用 stop{@link #IAudioEffectPlayer#stop} 方法停止播放音效文件。 + * @list 混音 + */ + + virtual int start(int effect_id, const char* file_path, const AudioEffectPlayerConfig& config) = 0; + /** + * + * @type api + * @brief 停止播放音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以调用本方法停止播放音效文件。 + * - 调用本方法停止播放音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + + virtual int stop(int effect_id) = 0; + /** + * + * @type api + * @brief 停止播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以调用本方法停止播放所有音效文件。 + * - 调用本方法停止播放所有音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + + virtual int stopAll() = 0; + /** + * + * @type api + * @brief 预加载指定音乐文件到内存中,以避免频繁播放同一文件时的重复加载,减少 CPU 占用。 + * @param effect_id 音效 ID。用于标识音效,请保证音效 ID 唯一性。
    + * 如果使用相同的 ID 重复调用本方法,后一次会覆盖前一次。
    + * 如果先调用 start{@link #IAudioEffectPlayer#start},再使用相同的 ID 调用本方法 ,会收到回调 onAudioEffectPlayerStateChanged{@link #IAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged} ,通知前一个音效停止,然后加载下一个音效。
    + * 调用本方法预加载 A.mp3 后,如果需要使用相同的 ID 调用 start{@link #IAudioEffectPlayer#start} 播放 B.mp3,请先调用 unload{@link #IAudioEffectPlayer#unload} 卸载 A.mp3 ,否则会报错 AUDIO_MIXING_ERROR_LOAD_CONFLICT。 + * @param file_path 音效文件路径。支持本地文件的 URI。
    + * 预加载的文件长度不得超过 20s。
    + * 不同平台支持的音效文件格式和 start{@link #IAudioEffectPlayer#start} 一致。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 本方法只是预加载指定音效文件,只有调用 start{@link #IAudioEffectPlayer#start} 方法才开始播放指定音效文件。 + * - 调用本方法预加载的指定音效文件可以通过 unload{@link #IAudioEffectPlayer#unload} 卸载。 + * @list 混音 + */ + + virtual int preload(int effect_id, const char* file_path) = 0; + /** + * + * @type api + * @brief 卸载指定音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 或 preload{@link #IAudioEffectPlayer#preload} 后调用此接口。 + * @list 混音 + */ + + virtual int unload(int effect_id) = 0; + /** + * + * @type api + * @brief 卸载所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 混音 + */ + + virtual int unloadAll() = 0; + /** + * + * @type api + * @brief 暂停播放音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以通过调用本方法暂停播放音效文件。 + * - 调用本方法暂停播放音效文件后,可调用 resume{@link #IAudioEffectPlayer#resume} 方法恢复播放。 + * @list 混音 + */ + + virtual int pause(int effect_id) = 0; + /** + * + * @type api + * @brief 暂停播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用 start{@link #IAudioEffectPlayer#start} 方法开始播放音效文件后,可以通过调用本方法暂停播放所有音效文件。 + * - 调用本方法暂停播放所有音效文件后,可调用 resumeAll{@link #IAudioEffectPlayer#resumeAll} 方法恢复所有播放。 + * @list 混音 + */ + + virtual int pauseAll() = 0; + /** + * + * @type api + * @brief 恢复播放音效文件。 + * @param effect_id 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 调用 pause{@link #IAudioEffectPlayer#pause} 方法暂停播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + + virtual int resume(int effect_id) = 0; + /** + * + * @type api + * @brief 恢复播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 调用 pauseAll{@link #IAudioEffectPlayer#pauseAll} 方法暂停所有正在播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + + virtual int resumeAll() = 0; + /** + * + * @type api + * @brief 设置音效文件的起始播放位置。 + * @param effect_id 音效 ID + * @param pos 音效文件起始播放位置,单位为毫秒。
    + * 你可以通过 getDuration{@link #IAudioEffectPlayer#getDuration} 获取音效文件总时长,pos 的值应小于音效文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int setPosition(int effect_id, int pos) = 0; + /** + * + * @type api + * @brief 获取音效文件播放进度。 + * @param effect_id 音效 ID + * @return + * - >0: 成功, 音效文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int getPosition(int effect_id) = 0; + /** + * + * @type api + * @brief 调节指定音效的音量大小,包括音效文件和 PCM 音频。 + * @param effect_id 音效 ID + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int setVolume(int effect_id, int volume) = 0; + /** + * + * @type api + * @brief 设置所有音效的音量大小,包括音效文件和 PCM 音效。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 该接口的优先级低于 setVolume{@link #IAudioEffectPlayer#setVolume},即通过 setVolume{@link #IAudioEffectPlayer#setVolume} 单独设置了音量的音效 ID,不受该接口设置的影响。 + * @list 混音 + */ + + virtual int setVolumeAll(int volume) = 0; + /** + * + * @type api + * @brief 获取当前音量。 + * @param effect_id 音效 ID + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int getVolume(int effect_id) = 0; + /** + * + * @type api + * @brief 获取音效文件时长。 + * @param effect_id 音效 ID + * @return + * - >0: 成功, 音效文件时长,单位为毫秒。 + * - < 0: 失败 + * @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。 + * @list 混音 + */ + + virtual int getDuration(int effect_id) = 0; + /** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 IAudioEffectPlayerEventHandler{@link #IAudioEffectPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + + virtual int setEventHandler(IAudioEffectPlayerEventHandler* handler) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_frame.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_frame.h new file mode 100644 index 0000000..7da1a8b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_frame.h @@ -0,0 +1,528 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC audio Frame + */ + +#pragma once + +#include +#include +#include +#include "bytertc_audio_defines.h" + +namespace bytertc { + +/** + * + * @type keytype + * @region 音频管理 + * @brief 音频帧类型 + */ + +enum AudioFrameType { + /** + * + * @brief PCM 16bit + */ + + kAudioFrameTypePCM16 = 0 +}; + +/** + * + * @type keytype + * @region 音频管理 + * @brief 音频帧构建类 + */ + +typedef struct AudioFrameBuilder { + /** + * + * @brief 音频采样率 + */ + + AudioSampleRate sample_rate; + + /** + * + * @brief 音频通道数 + */ + + AudioChannel channel; + + /** + * + * @brief 音频帧时间戳,单位:微秒 + * @note 此时间戳不是 Linux 时间戳,只是 SDK 内部时间戳,仅保证帧之间时间戳的相对关系。 + */ + + int64_t timestamp_us = 0; + + /** + * + * @brief 音频帧数据 + */ + + uint8_t* data; + + /** + * + * @brief 音频帧数据大小 + */ + + int64_t data_size = 0; + + /** + * + * @brief 是否深拷贝 + */ + + bool deep_copy = true; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据 + */ + + uint8_t* extra_info = nullptr; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据大小 + */ + + int64_t extra_info_size = 0; +} AudioFrameBuilder; +/** + * + * @type keytype + * @brief 音频帧 + */ + +class IAudioFrame { +public: + /** + * + * @type api + * @brief 获取音频帧时间戳。 + * @return 音频帧时间戳,单位:微秒 + * @list Screen Sharing + */ + + virtual int64_t timestampUs() const = 0; + /** + * + * @type api + * @brief 获取音频采样率。参看 AudioSampleRate{@link #AudioSampleRate} + * @return 音频采样率,单位:Hz + * @list 音频管理 + */ + + virtual AudioSampleRate sampleRate() const = 0; + /** + * + * @type api + * @brief 获取音频通道数。参看 AudioChannel{@link #AudioChannel} + * @return 音频通道数 + * @note 双声道的情况下,左右声道的音频帧数据以 LRLRLR 形式排布。 + * @list 音频管理 + */ + + virtual AudioChannel channel() const = 0; + /** + * + * @type api + * @brief 获取音频帧内存块地址 + * @return 音频帧内存块地址 + * @list 音频管理 + */ + + virtual uint8_t* data() const = 0; + /** + * + * @type api + * @brief 获取音频帧数据大小 + * @return 音频帧数据大小,单位:字节。 + * @list 音频管理 + */ + + virtual int dataSize() const = 0; + /** + * + * @type api + * @brief 获取音频帧类型 + * @return 音频帧类型,目前只支持 PCM,详见 AudioFrameType{@link #AudioFrameType} + * @list 音频管理 + */ + + virtual AudioFrameType frameType() const = 0; + /** + * + * @type api + * @hidden for internal use only + * @brief 获取音频帧额外信息内存块地址 + * @return 音频帧额外信息内存块地址 + * @list 音频管理 + */ + + virtual uint8_t* extraInfo() const = 0; + /** + * + * @type api + * @hidden for internal use only + * @brief 获取音频帧额外信息大小 + * @return 音频帧数据额外信息大小,单位:字节。 + * @list 音频管理 + */ + + virtual int extraInfoSize() const = 0; + /** + * + * @type api + * @brief 释放音频帧 + * @list 音频管理 + */ + + virtual void release() = 0; + /** + * + * @type api + * @brief 获取音频静音标志 + * @return 是否静音数据
    + * - true: 是 + * - false: 否 + * @list 音频管理 + */ + + virtual bool isMutedData() const = 0; + /** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioFrame() = default; +}; +/** + * + * @type api + * @brief 创建 IAudioFrame + * @param builder 音频帧构建实例,参看 AudioFrameBuilder{@link #AudioFrameBuilder} + * @return 详见 IAudioFrame{@link #IAudioFrame} + * @list 音频管理 + */ + +BYTERTC_API IAudioFrame* buildAudioFrame(const AudioFrameBuilder& builder); + +/** + * + * @type keytype + * @brief 音频回调方法 + */ + +enum class AudioFrameCallbackMethod{ + /** + * + * @brief 本地麦克风录制的音频数据回调 + */ + + kRecord, + /** + * + * @brief 订阅的远端所有用户混音后的音频数据回调 + */ + + kPlayback, + /** + * + * @brief 本地麦克风录制和订阅的远端所有用户混音后的音频数据回调 + */ + + kMixed, + /** + * + * @brief 订阅的远端每个用户混音前的音频数据回调 + */ + + kRemoteUser, + /** + * + * @brief 本地屏幕录制的音频数据回调 + */ + + kRecordScreen, + /** + * + * @brief 本地麦克风录制和本地 `MediaPlayer`, `EffectPlayer` 播放的音频混音后的音频数据回调 + */ + + kCaptureMixed, +}; +/** + * + * @type callback + * @brief 音频数据回调观察者
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。
    + * 本接口类中的回调周期均为 20 ms。 + * @list 自定义流处理 + */ + +class IAudioFrameObserver { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioFrameObserver() { + } + /** + * + * @hidden for internal use only + * @valid since 3.50 + */ + + virtual void onRecordAudioFrameOriginal(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回麦克风录制的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onRecordAudioFrame(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回订阅的所有远端用户混音后的音频数据。 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onPlaybackAudioFrame(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回远端单个用户的音频数据 + * @param stream_id 远端流 ID。 + * @param stream_info 远端流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param audio_frame 音频数据, 参看 IAudioFrame{@link #IAudioFrame}。 + * @note 此回调在播放线程调用。不要在此回调中做任何耗时的事情,否则可能会影响整个音频播放链路。 + * @list 自定义流处理 + */ + + virtual void onRemoteUserAudioFrame(const char* stream_id, const StreamInfo& stream_info, const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回本地麦克风录制和订阅的所有远端用户混音后的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onMixedAudioFrame(const IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 返回本地屏幕录制的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onRecordScreenAudioFrame(const IAudioFrame& audio_frame) { + } + /** + * + * @type callback + * @brief 返回本地麦克风录制的音频数据,本地 `MediaPlayer` / `EffectPlayer` 播放音频文件混音后的音频数据 + * @param audio_frame 音频数据, 详见:IAudioFrame{@link #IAudioFrame} + * @list 自定义流处理 + */ + + virtual void onCaptureMixedAudioFrame(const IAudioFrame& audio_frame) = 0; + +}; +/** + * + * @type callback + * @brief 自定义音频处理器。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Custom Stream Processing + */ + +class IAudioFrameProcessor{ +public: + /** + * + * @type callback + * @brief 回调本地采集的音频帧地址,供自定义音频处理。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame} + * @note + * - 完成自定义音频处理后,SDK 会对处理后的音频帧进行编码,并传输到远端。 + * - 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并在参数中选择本地采集的音频时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + + virtual int onProcessRecordAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 回调远端音频混音的音频帧地址,供自定义音频处理。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame} + * @note 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并在参数中选择远端音频流的混音音频时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + + virtual int onProcessPlayBackAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 回调单个远端用户的音频帧地址,供自定义音频处理。 + * @param stream_id 远端流 ID。 + * @param stream_info 远端流信息, 参看 StreamInfo{@link #StreamInfo}。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame} + * @note 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并在参数中选择各个远端音频流时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + + virtual int onProcessRemoteUserAudioFrame(const char* stream_id, const StreamInfo& stream_info, IAudioFrame& audio_frame) = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @valid since 3.50 + * @type callback + * @brief 软件耳返音频数据的回调。你可根据此回调自定义处理音频。
    + * 耳返音频中包含通过调用 `setVoiceReverbType` 和 `setVoiceChangerType` 设置的音频特效。 + * @param audio_frame 音频帧地址。参看 IAudioFrame{@link #IAudioFrame}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 此数据处理只影响软件耳返音频数据。 + * - 要启用此回调,必须调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},并选择耳返音频,每 10 ms 收到此回调。 + * @list Custom Stream Processing + */ + + virtual int onProcessEarMonitorAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @type callback + * @brief 屏幕共享的音频帧地址回调。你可根据此回调自定义处理音频。 + * @param audio_frame 音频帧地址,参看 IAudioFrame{@link #IAudioFrame}。 + * @note 调用 enableAudioProcessor{@link #IRTCEngine#enableAudioProcessor},把返回给音频处理器的音频类型设置为屏幕共享音频后,每 10 ms 收到此回调。 + * @list 屏幕共享 + */ + + virtual int onProcessScreenAudioFrame(IAudioFrame& audio_frame) = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioFrameProcessor() { + } +}; +/** + * + * @type keytype + * @hidden for internal use only + * @region 音频管理 + * @brief 音频帧构建类 + */ + +typedef struct EncodedAudioFrameData { + /** + * + * @brief 音频编码类型 + */ + + AudioCodecType codec_type = kAudioCodecTypeNone; + /** + * + * @brief 音频数据 + */ + + uint8_t* data = nullptr; + /** + * + * @brief 音频数据大小 + */ + + int size = 0; + /** + * + * @brief 音频时间戳,单位:微秒 + */ + + int64_t timestamp_us = 0; + /** + * + * @brief 音频采样率 + */ + + int sample_rate = 0; + /** + * + * @brief 音频通道数 + */ + + int channel_num = 0; + /** + * + * @brief 音频帧大小,单位:毫秒 + */ + + int frame_size_ms = 0; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据 + */ + + uint8_t* extra_info = nullptr; + /** + * + * @hidden for internal use only + * @brief 音频帧额外信息数据大小 + */ + + int extra_info_size = 0; +} EncodedAudioFrameData; + +/** + * + * @type callback + * @hidden for internal use only + * @brief 远端音频帧监测器 + * @list 自定义流处理 + */ + +class IRemoteEncodedAudioFrameObserver { +public: + virtual ~IRemoteEncodedAudioFrameObserver () { + } + /** + * + * @type callback + * @hidden for internal use only + * @brief 调用 RegisterRemoteEncodedAudioFrameObserver 后,SDK 收到远端音频帧信息时,回调该事件 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息,参看 StreamInfo{@link #StreamInfo} + * @param audio_stream 远端音频帧信息,参看 EncodedAudioFrameData{@link #EncodedAudioFrameData} + * @list 自定义流处理 + */ + + virtual void onRemoteEncodedAudioFrame(const char* stream_id, + const StreamInfo& stream_info, const EncodedAudioFrameData& audio_stream) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_mixing_manager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_mixing_manager.h new file mode 100644 index 0000000..e443668 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_audio_mixing_manager.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Mixing Manager +*/ + +#pragma once + +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @hidden(Linux) + * @type callback + * @brief 本地音频文件混音的音频帧观察者。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 自定义流处理 + */ + +class IAudioFileFrameObserver { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IAudioFileFrameObserver(){} + /** + * + * @type callback + * @brief 当本地音频文件混音时,回调播放的音频帧。 + * @param mix_id 混音 ID。 + * @param audio_frame 参看 IAudioFrame{@link #IAudioFrame}。 + * @list 自定义流处理 + */ + + virtual void onAudioFileFrame(int mix_id, const IAudioFrame& audio_frame) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_camera_control_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_camera_control_interface.h new file mode 100644 index 0000000..a4ca364 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_camera_control_interface.h @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. +*/ + +#pragma once + +#include + +namespace bytertc { +/** + * + * @type keytype + * @brief 相机补光灯状态 + */ + +enum TorchState{ + + /** + * + * @brief 相机补光灯关闭 + */ + + kTorchStateOff=0, + /** + * + * @brief 相机补光灯打开 + */ + + kTorchStateOn=1, +}; +/** + * + * @hidden(macOS,Windows,Linux) + * @type api + * @brief 相机控制接口 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能使用这个接口。 + */ + +class ICameraControl { +public: + virtual ~ICameraControl() = default; + /** + * + * @type api + * @brief 设置当前使用的摄像头(前置/后置)的变焦倍数 + * @param zoom_val 变焦倍数。取值范围是 [1, <最大变焦倍数>]。
    + * 最大变焦倍数可以通过调用 getCameraZoomMaxRatio{@link #ICameraControl#getCameraZoomMaxRatio} 获取。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置摄像头变焦倍数。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraZoomRatio(float zoom_val) = 0; + /** + * + * @type api + * @brief 获取当前使用的摄像头(前置/后置)的最大变焦倍数 + * @return 最大变焦倍数 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头最大变焦倍数。 + */ + + virtual float getCameraZoomMaxRatio() = 0; + /** + * + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持变焦(数码/光学变焦)。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头变焦能力。 + */ + + virtual bool isCameraZoomSupported() = 0; + /** + * + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持闪光灯。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测闪光能力。 + */ + + virtual bool isCameraTorchSupported() = 0; + /** + * + * @type api + * @brief 打开/关闭当前使用的摄像头(前置/后置)的闪光灯 + * @param torch_state 打开/关闭。参看 TorchState{@link #TorchState}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置闪光灯。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraTorch(TorchState torch_state) = 0; + /** + * + * @type api + * @brief 检查当前使用的摄像头是否支持对焦点设置 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检查对焦点设置能力。 + */ + + virtual bool isCameraFocusPositionSupported() = 0; + /** + * + * @type api + * @brief 设置当前使用的摄像头的对焦点 + * @param x 对焦点水平方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最左边,1 为最右边。 + * @param y 对焦点垂直方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最上边,1 为最下边。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置对焦点。 + * - 对焦点设置为画布中央(即[0.5, 0.5]) 时,恢复系统默认值。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraFocusPosition(float x, float y) = 0; + /** + * + * @type api + * @brief 检查当前使用的摄像头是否支持曝光点设置 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检查曝光点设置能力。 + */ + + virtual bool isCameraExposurePositionSupported() = 0; + /** + * + * @type api + * @brief 设置当前使用的摄像头的曝光点 + * @param x 曝光点水平方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最左边,1 为最右边。 + * @param y 曝光点垂直方向归一化坐标。以本地预览画布的左上为原点。取值范围为[0, 1],0 为最上边,1 为最下边。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置曝光点。 + * - 曝光点设置为画布中央(即[0.5, 0.5]) 时,恢复系统默认值。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraExposurePosition(float x, float y) = 0; + /** + * + * @type api + * @brief Sets the exposure point of the currently used camera. + * @param val 曝光补偿值,取值范围[-1, 1],0 为系统默认值(没有曝光补偿)。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 必须已调用 StartVideoCapture{@link #IRTCEngine#StartVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置曝光补偿。 + * - 设置结果在调用 StopVideoCapture{@link #IRTCEngine#StopVideoCapture} 关闭内部采集后失效。 + */ + + virtual int setCameraExposureCompensation(float val) = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @valid since 353 + * @type api + * @brief 启用或禁用内部采集时人脸自动曝光模式。此模式会改善强逆光下,脸部过暗的问题;但也会导致 ROI 以外区域过亮/过暗的问题。 + * @param enable 是否启用。iOS默认开启,Android默认关闭。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note + * - 对 Android,你必须在调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部采集前,调用此接口方可生效。 + * - 对 iOS,在采集前或采集中调用此接口均可生效。 + * @list 视频管理 + */ + + virtual int enableCameraAutoExposureFaceMode(bool enable) = 0; + /** + * + * @hidden(macOS, Windows, Linux) + * @valid since 353 + * @type api + * @brief 设置内部采集适用动态帧率时,帧率的最小值。 + * @param framerate 最小值。单位为 fps。默认值是 7。
    + * 动态帧率的最大帧率是通过 setVideoCaptureConfig{@link #IRTCEngine#setVideoCaptureConfig} 设置的帧率值。当传入参数大于最大帧率时,使用固定帧率模式,帧率为最大帧率;当传入参数小于最大帧率时,使用动态帧率。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note + * - 你必须在调用 startVideoCapture{@link #IRTCEngine#startVideoCapture} 开启内部采集前,调用此接口方可生效。 + * - 如果由于性能降级、静态适配等原因导致采集最大帧率变化时,已设置的最小帧率值会与新的采集最大帧率值重新比较。比较结果变化可能导致固定/动态帧率模式切换。 + * - 对 Android,默认开启动态帧率模式 + * - 对 iOS,默认使用固定帧率模式 + * @list 视频管理 + */ + + virtual int setCameraAdaptiveMinimumFrameRate(int framerate) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_defines.h new file mode 100644 index 0000000..6779d62 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_defines.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Defines + */ + +#pragma once + +#include "bytertc_rts_defines.h" +#include "bytertc_media_defines.h" +#include "bytertc_audio_defines.h" +#include "bytertc_video_defines.h" +#include "bytertc_transcoder_define.h" diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_internal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_internal.h new file mode 100644 index 0000000..1cef74b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_internal.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Internal API +*/ + +#pragma once + +#include "bytertc_defines.h" +#include +#include + +namespace bytertc { + +/** + * @brief 设置 ByteRTC SDK 默认开启使用QUIC获取配置 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableQuicGetAccess(); + +/** + * @brief 设置 ByteRTC SDK 默认开启使用KCP获取配置 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableKcpGetAccess(); + +/** + * @brief 设置 ByteRTC SDK 默认开启通话前网络探测 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableNetworkDetect(); + +/** + * @brief 设置 ByteRTC SDK 默认开启使用KCP消息通道 + * @notes 一般在linux端SDK使用 + */ +BYTERTC_API void setDefaultEnableKcpDataChannel(); + +struct VideoStreamDescription { + unsigned int width; + unsigned int height; + unsigned int frame_rate; + unsigned int max_kbps; +}; + +enum class PixelFormat { + kDefault = 0, + kI420 = 1, + kRGBA = 2, + kTexture = 3, +}; + +enum class NetworkFamily { + kNetworkFamilyNone = 0, + kNetworkFamilyIPv4 = 1, + kNetworkFamilyIPv6 = 2, + kNetworkFamilyBoth = 3, +}; + +enum StreamFlag { + kStreamFlagNone = 0, + kStreamFlagNormal = 1 << 0, + kStreamFlagDocShare = 1 << 1, + kStreamFlagMCU = 1 << 2, + kStreamFlagMeetTogether = 1 << 3, + + kStreamFlagIntelligentStream = 1 << 6, +}; + +} + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_defines.h new file mode 100644 index 0000000..5f162fa --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_defines.h @@ -0,0 +1,586 @@ +#pragma once + +#include + +namespace bytertc { + +/** + * + * @type keytype + * @brief 歌曲过滤方式。 + */ + +enum MusicFilterType { + /** + * + * @brief 不过滤。 + */ + + kMusicFilterTypeNone = 0, + /** + * + * @brief 过滤没有歌词的歌曲。 + */ + + kMusicFilterTypeWithoutLyric = 1 << 0, + /** + * + * @brief 过滤不支持打分的歌曲。 + */ + + kMusicFilterTypeUnsupportedScore = 1 << 1, + /** + * + * @brief 过滤不支持伴唱切换的歌曲。 + */ + + kMusicFilterTypeUnsupportedAccopmay = 1 << 2, + /** + * + * @brief 过滤没有高潮片段的歌曲。 + */ + + kMusicFilterTypeUnsupportedClimx = 1 << 3, +}; + +/** + * + * @type keytype + * @brief 原唱伴唱类型。 + */ + +enum class AudioTrackType { + /** + * + * @brief 播放原唱。 + */ + + kOriginal = 1, + /** + * + * @brief 播放伴唱。 + */ + + kAccompy = 2 +}; + +/** + * + * @type keytype + * @brief 音乐播放类型。 + */ + +enum class AudioPlayType { + /** + * + * @brief 仅本地播放。 + */ + + kLocal, + /** + * + * @brief 仅远端播放。 + */ + + kRemote, + /** + * + * @brief 本地、远端同时播放。 + */ + + kLocalAndRemote +}; + +/** + * + * @type keytype + * @brief 音乐播放状态。 + */ + +enum class PlayState { + /** + * + * @brief 播放中。 + */ + + kPlaying = 1, + /** + * + * @brief 暂停中。 + */ + + kPaused = 2, + /** + * + * @brief 已停止。 + */ + + kStoped = 3, + /** + * + * @brief 播放失败。 + */ + + kFailed = 4, + /** + * + * @brief 播放结束。 + */ + + kFinished = 5, +}; + +/** + * + * @type keytype + * @brief 歌词格式类型。 + */ + +enum class LyricStatus { + /** + * + * @brief 无歌词。 + */ + + kNone = 0, + /** + * + * @brief KRC 歌词。 + */ + + kKRC = 1, + /** + * + * @brief LRC 歌词。 + */ + + kLRC = 2, + /** + * + * @brief KRC 歌词和 LRC 歌词均有。 + */ + + kKRCAndLRC = 3 +}; + +/** + * + * @type keytype + * @brief 歌词文件类型。 + */ + +enum class DownloadLyricType { + /** + * + * @brief KRC 歌词文件。 + */ + + kKRC, + /** + * + * @brief LRC 歌词文件。 + */ + + kLRC +}; + + + +/** + * + * @type keytype + * @brief 歌曲数据。 + */ + +struct MusicInfo +{ + /** + * + * @brief 音乐 ID。 + */ + + const char* music_id; + /** + * + * @brief 音乐名称。 + */ + + const char* music_name; + /** + * + * @brief 歌手。 + */ + + const char* singer; + /** + * + * @brief 版权商 ID。 + */ + + const char* vendor_id; + /** + * + * @brief 版权商名称。 + */ + + const char* vendor_name; + /** + * + * @brief 最新更新时间戳,单位为毫秒。 + */ + + int64_t update_timestamp; + /** + * + * @brief 封面地址。 + */ + + const char* poster_url; + /** + * + * @brief 歌词格式类型,参看 LyricStatus{@link #LyricStatus}。 + */ + + LyricStatus lyric_status; + /** + * + * @brief 歌曲长度,单位为毫秒。 + */ + + int duration; + /** + * + * @brief 歌曲是否支持打分。 + */ + + bool enable_score; + /** + * + * @brief 歌曲高潮片段开始时间,单位为毫秒。 + */ + + int climax_start_time; + /** + * + * @brief 歌曲高潮片段停止时间,单位为毫秒。 + */ + + int climax_stop_time; + +}; + +/** + * + * @type keytype + * @brief 热榜歌曲数据。 + */ + +struct HotMusicInfo { + /** + * + * @brief 热榜名称。 + */ + + const char* hot_name; + /** + * + * @brief 歌曲数据,参看 MusicInfo{@link #MusicInfo}。 + */ + + MusicInfo* musics; + /** + * + * @brief 歌曲列表的数量。 + */ + + int music_count; +}; + +/** + * + * @type keytype + * @brief 下载文件类型。 + */ + +enum DownloadFileType { + /** + * + * @brief 音频文件。 + */ + + kDownloadFileTypeMusic = 1, + /** + * + * @brief KRC 歌词文件。 + */ + + kDownloadFileTypeKRC = 2, + /** + * + * @brief LRC 歌词文件。 + */ + + kDownloadFileTypeLRC = 3, + /** + * + * @brief MIDI 文件。 + */ + + kDownloadFileTypeMIDI = 4 + +} ; + +/** + * + * @type keytype + * @brief 歌曲下载信息。 + */ + +struct DownloadResult { + /** + * + * @brief 文件存放路径。 + */ + + const char* local_file_path; + /** + * + * @brief 音乐 ID。 + */ + + const char* music_id; + /** + * + * @brief 下载文件类型,参看 DownloadFileType{@link #DownloadFileType}。 + */ + + DownloadFileType type; +}; + + +/** + * + * @type errorcode + * @brief KTV 错误码。 + */ + +enum KTVErrorCode { + /** + * + * @brief 成功。 + */ + + kKTVErrorCodeOK = 0, + /** + * + * @brief AppID 异常。 + */ + + kKTVErrorCodeAppidInValid = -3000, + /** + * + * @brief 非法参数,传入的参数不正确。 + */ + + kKTVErrorCodeParasInValid = -3001, + /** + * + * @brief 获取歌曲资源失败。 + */ + + kKTVErrorCodeGetMusicFailed = -3002, + /** + * + * @brief 获取歌词失败。 + */ + + kKTVErrorCodeGetLyricFailed = -3003, + /** + * + * @brief 歌曲下架。 + */ + + kKTVErrorCodeMusicTakedown = -3004, + /** + * + * @brief 歌曲文件下载失败。 + */ + + kKTVErrorCodeMusicDownload = -3005, + /** + * + * @brief MIDI 文件下载失败。 + */ + + kKTVErrorCodeMidiDownloadFailed = -3006, + /** + * + * @brief 系统繁忙。 + */ + + kKTVErrorCodeSystemBusy = -3007, + /** + * + * @brief 网络异常。 + */ + + kKTVErrorCodeNetwork = -3008, + /** + * + * @brief KTV 功能未加入房间。 + */ + + kKTVErrorCodeNotJoinRoom = -3009, + /** + * + * @brief 解析数据失败。 + */ + + kKTVErrorCodeParseData = -3010, + /** + * + * @hidden + * @deprecated 从 353 开始。 + * @brief 下载失败。 + */ + + kKTVErrorCodeDownload = -3011, + /** + * + * @brief 已在下载中。 + */ + + kKTVErrorCodeDownloading = -3012, + /** + * + * @brief 内部错误,联系技术支持人员。 + */ + + kKTVErrorCodeInternalDomain = -3013, + /** + * + * @brief 下载失败,磁盘空间不足。清除缓存后重试。 + */ + + kKTVErrorCodeInsufficientDiskSpace = -3014, + /** + * + * @brief 下载失败,音乐文件解密失败,联系技术支持人员。 + */ + + kKTVErrorCodeMusicDecryptionFailed = -3015, + /** + * + * @brief 下载失败,音乐文件重命名失败,请重试。 + */ + + kKTVErrorCodeFileRenameFailed = -3016, + /** + * + * @brief 下载失败,下载超时,请重试。 + */ + + kKTVErrorCodeDownloadTimeOut = -3017, + /** + * + * @brief 清除缓存失败,可能原因是文件被占用或者系统异常,请重试。 + */ + + kKTVErrorCodeClearCacheFailed = -3018, + /** + * + * @brief 取消下载。 + */ + + kKTVErrorCodeDownloadCanceled = -3019 +}; + +/** + * + * @type keytype + * @brief KTV 播放器错误码。 + */ + +enum KTVPlayerErrorCode { + /** + * + * @brief 成功。 + */ + + kKTVPlayerErrorCodeOK = 0, + /** + * + * @brief 播放错误,请下载后播放。 + */ + + kKTVPlayerErrorCodeFileNotExist = -3020, + /** + * + * @brief 播放错误,请确认文件播放格式。 + */ + + kKTVPlayerErrorCodeFileError = -3021, + /** + * + * @brief 播放错误,未进入房间。 + */ + + kKTVPlayerErrorCodeNotJoinRoom = -3022, + /** + * + * @brief 参数错误。 + */ + + kKTVPlayerErrorCodeParam = -3023, + /** + * + * @brief 播放失败,找不到文件或文件打开失败。 + */ + + kKTVPlayerErrorCodeStartError = -3024, + /** + * + * @brief 混音 ID 异常。 + */ + + kKTVPlayerErrorCodeMixIdError = -3025, + /** + * + * @brief 设置播放位置出错。 + */ + + kKTVPlayerErrorCodePositionError = -3026, + /** + * + * @brief 音量参数不合法,可设置的取值范围为 [0,400]。 + */ + + kKTVPlayerErrorCodeAudioVolumeError = -3027, + /** + * + * @brief 不支持此混音类型。 + */ + + kKTVPlayerErrorCodeTypeError = -3028, + /** + * + * @brief 音调文件不合法。 + */ + + kKTVPlayerErrorCodePitchError = -3029, + /** + * + * @brief 音轨不合法。 + */ + + kKTVPlayerErrorCodeAudioTrackError = -3030, + /** + * + * @brief 混音启动中。 + */ + + kKTVPlayerErrorCodeStartingError = -3031 +}; + + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_manager_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_manager_interface.h new file mode 100644 index 0000000..053a139 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_ktv_manager_interface.h @@ -0,0 +1,483 @@ +#pragma once + +#include "bytertc_ktv_defines.h" +namespace bytertc { +/** + * + * @type callback + * @brief KTV 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 在线 KTV + */ + +class IKTVManagerEventHandler { + +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVManagerEventHandler() { + } + /** + * + * @type callback + * @brief 歌曲列表回调。 + * @param music_infos 歌曲数据数组,参看 MusicInfo{@link #MusicInfo}。 + * @param music_count 当前查询的数据条目数。 + * @param total_musics_size 数据条目总数。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onMusicListResult(MusicInfo* music_infos, int music_count, int total_musics_size, KTVErrorCode error_code) { + (void)music_infos; + (void)music_count; + (void)total_musics_size; + (void)error_code; + } + /** + * + * @type callback + * @brief 搜索歌曲结果回调。 + * @param music_infos 歌曲数据数组,参看 MusicInfo{@link #MusicInfo}。 + * @param music_count 当前查询的数据条目数。 + * @param total_musics_size 数据条目总数。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onSearchMusicResult(MusicInfo* music_infos, int music_count, int total_musics_size, KTVErrorCode error_code) { + (void)music_infos; + (void)music_count; + (void)total_musics_size; + (void)error_code; + } + /** + * + * @type callback + * @brief 热榜歌曲结果回调。 + * @param hot_infos 热榜歌曲数据数组,参看 HotMusicInfo{@link #HotMusicInfo}。 + * @param hot_count 当前查询的热榜歌曲数据条目数。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onHotMusicResult(HotMusicInfo* hot_infos, int hot_count, KTVErrorCode error_code) { + (void)hot_infos; + (void)hot_count; + (void)error_code; + } + /** + * + * @type callback + * @brief 歌曲详细信息回调。 + * @param music_info 歌曲数据,参看 MusicInfo{@link #MusicInfo}。 + * @param error_code 错误码,成功时返回 0,其余值参看 KTVErrorCode{@link #KTVErrorCode}。
    + * @list 在线 KTV + */ + + virtual void onMusicDetailResult(MusicInfo* music_info, KTVErrorCode error_code) { + (void)music_info; + (void)error_code; + } + /** + * + * @type callback + * @brief 下载成功回调。 + * @param download_id 下载任务 ID。 + * @param download_info 下载信息,参看 DownloadResult{@link #DownloadResult}。 + * @list 在线 KTV + */ + + virtual void onDownloadSuccess(int download_id, DownloadResult* download_info) { + (void)download_id; + (void)download_info; + } + /** + * + * @type callback + * @brief 下载失败回调。 + * @param download_id 下载任务 ID。 + * @param error_code 错误码,参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list 在线 KTV + */ + + virtual void onDownloadFailed(int download_id, KTVErrorCode error_code) { + (void)download_id; + (void)error_code; + } + /** + * + * @type callback + * @brief 歌曲文件下载进度回调。 + * @param download_id 下载任务 ID。 + * @param download_percentage 下载进度百分比,取值范围 [0,100]。 + * @list 在线 KTV + */ + + virtual void onDownloadMusicProgress(int download_id, int download_percentage) { + (void)download_id; + (void)download_percentage; + } + /** + * + * @type callback + * @brief 清理文件缓存结果回调。 + * @param error_code 错误码,非 0 为失败,参看 KTVErrorCode{@link #KTVErrorCode}。 + * @list Online Karaoke + */ + + virtual void onClearCacheResult(KTVErrorCode error_code) { + (void)error_code; + } +}; +/** + * + * @type callback + * @brief KTV 播放器回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Online Karaoke + */ + +class IKTVPlayerEventHandler { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVPlayerEventHandler() { + } + /** + * + * @type callback + * @brief 音乐播放进度回调。 + * @param music_id 音乐 ID。 + * @param progress 音乐播放进度,单位为毫秒。 + * @list 在线 KTV + */ + + virtual void onPlayProgress(const char *music_id, int64_t progress) { + (void)music_id; + (void)progress; + } + /** + * + * @type callback + * @brief 音乐播放状态改变回调。 + * @param music_id 音乐 ID。 + * @param play_state 音乐播放状态,参看 PlayState{@link #PlayState}。 + * @param error_code 错误码,参看 KTVPlayerErrorCode{@link #KTVPlayerErrorCode}。 + * @note + * 此回调被触发的时机汇总如下:
    + * - 调用 playMusic{@link #IKTVPlayer#playMusic} 成功后,会触发 playState 值为 PlayStatePlaying 的回调;否则会触发 playState 值为 PlayStateFailed 的回调。 + * - 使用相同的音乐 ID 重复调用 playMusic{@link #IKTVPlayer#playMusic} 后,后一次播放会覆盖前一次,且会触发 playState 值为 PlayStatePlaying 的回调,表示后一次音乐播放已开始。 + * - 调用 pauseMusic{@link #IKTVPlayer#pauseMusic} 方法暂停播放成功后,会触发 playState 值为 PlayStatePaused 的回调;否则触发 playState 值为 PlayStateFailed 的回调。 + * - 调用 resumeMusic{@link #IKTVPlayer#resumeMusic} 方法恢复播放成功后,会触发 playState 值为 PlayStatePlaying 的回调;否则触发 playState 值为 PlayStateFailed 的回调。 + * - 调用 stopMusic{@link #IKTVPlayer#stopMusic} 方法停止播放成功后,会触发 playState 值为 PlayStateStoped 的回调;否则触发 playState 值为 PlayStateFailed 的回调。 + * - 音乐播放结束会触发 playState 值为 PlayStateFinished 的回调。 + * @list 在线 KTV + */ + + virtual void onPlayStateChanged(const char* music_id, PlayState play_state, bytertc::KTVPlayerErrorCode error_code) { + (void)music_id; + (void)play_state; + (void)error_code; + } +}; +/** + * + * @type api + * @brief KTV 播放器接口。 + * @list Online Karaoke + */ + +class IKTVPlayer { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVPlayer() = default; + /** + * + * @type api + * @brief 设置 KTV 播放器进度及状态回调接口。 + * @param handler KTV 播放器回调类,参看 IKTVPlayerEventHandler{@link #IKTVPlayerEventHandler}。 + * @list 在线 KTV + */ + + virtual void setPlayerEventHandler(IKTVPlayerEventHandler *handler) = 0; + /** + * + * @type api + * @brief 播放歌曲。 + * @param music_id 音乐 ID。
    + * 若同一 music_id 的歌曲正在播放,再次调用接口会从开始位置重新播放。若 music_id 对应的音频文件不存在会触发报错。 + * @param track_type 原唱伴唱类型,参看 AudioTrackType{@link #AudioTrackType}。 + * @param play_type 音乐播放类型。参看 AudioPlayType{@link #AudioPlayType}。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * - 若音乐文件不存在,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3020,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void playMusic(const char* music_id, AudioTrackType track_type, AudioPlayType play_type) = 0; + /** + * + * @type api + * @brief 暂停播放歌曲。 + * @param music_id 音乐 ID。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void pauseMusic(const char *music_id) = 0; + /** + * + * @type api + * @brief 继续播放歌曲。 + * @param music_id 音乐 ID。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void resumeMusic(const char *music_id) = 0; + /** + * + * @type api + * @brief 停止播放歌曲。 + * @param music_id 音乐 ID。 + * @note + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void stopMusic(const char *music_id) = 0; + /** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param music_id 音乐 ID。 + * @param position 音乐起始位置,单位为毫秒,取值小于音乐文件总时长。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 调用接口后,你会收到 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void seekMusic(const char *music_id, int position) = 0; + /** + * + * @type api + * @brief 设置歌曲播放音量,只能在开始播放后进行设置。 + * @param music_id 音乐 ID。 + * @param volume 歌曲播放音量,调节范围:[0,400]。
    + * - 0:静音。 + * - 100:原始音量。 + * - 400: 原始音量的 4 倍(自带溢出保护)。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的音量大于 400,则按最大值 400 进行调整;若设置的音量小于 0,则按最小值 0 进行调整。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void setMusicVolume(const char *music_id, int volume) = 0; + /** + * + * @type api + * @brief 切换歌曲原唱伴唱。 + * @param music_id 音乐 ID。 + * @note 调用本接口时音乐必须处于播放中状态。 + * @list 在线 KTV + */ + + virtual void switchAudioTrackType(const char *music_id) = 0; + /** + * + * @type api + * @brief 对播放中的音乐设置升降调信息。 + * @param music_id 音乐 ID。 + * @param pitch 相对于音乐文件原始音调的升高/降低值,取值范围 [-12,12],默认值为 0,即不做调整。
    + * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的 pitch 大于 12,则按最大值 12 进行调整;若设置的 pitch 小于 –12,则按最小值 –12 进行调整。 + * - 若音乐 ID 错误,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3023,play_state 为 4。 + * - 若未进房,会触发 onPlayStateChanged{@link #IKTVPlayerEventHandler#onPlayStateChanged} 回调,error_code 为 –3022,play_state 为 4。 + * @list 在线 KTV + */ + + virtual void setMusicPitch(const char* music_id, int pitch) = 0; + +}; +/** + * + * @type api + * @brief KTV 管理接口。 + * @list Online Karaoke + */ + +class IKTVManager { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IKTVManager() = default; + /** + * + * @type api + * @brief 设置歌曲文件最大占用的本地缓存。 + * @param max_cache_size_mb 本地缓存,单位 MB。
    + * 设置值小于等于 0 时,使用默认值 1024 MB。 + * @list 在线 KTV + */ + + virtual void setMaxCacheSize(int max_cache_size_mb) = 0; + /** + * + * @type api + * @brief 设置 KTV 回调接口。 + * @param ktv_manager_event_handler KTV 回调类,参看 IKTVManagerEventHandler{@link #IKTVManagerEventHandler}。 + * @list 在线 KTV + */ + + virtual void setKTVManagerEventHandler(IKTVManagerEventHandler *ktv_manager_event_handler) = 0; + /** + * + * @type api + * @brief 获取歌曲列表。 + * @param page_num 页码,默认从 1 开始。 + * @param page_size 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filters 歌曲过滤方式,参看 MusicFilterType{@link #MusicFilterType}。 + * @note 调用接口后,你会收到 onMusicListResult{@link #IKTVManagerEventHandler#onMusicListResult} 回调歌曲列表。 + * @list 在线 KTV + */ + + virtual void getMusicList(int page_num, int page_size, int filters) = 0; + /** + * + * @type api + * @brief 根据关键词搜索歌曲。 + * @param key_word 关键词,字符串长度最大为 20 个字符。 + * @param page_num 页码,默认从 1 开始。 + * @param page_size 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filters 歌曲过滤方式,参看 MusicFilterType{@link #MusicFilterType}。 + * @note 调用接口后,你会收到 onSearchMusicResult{@link #IKTVManagerEventHandler#onSearchMusicResult} 回调歌曲列表。 + * @list 在线 KTV + */ + + virtual void searchMusic(const char* key_word, int page_num, int page_size, int filters) = 0; + /** + * + * @type api + * @brief 指定歌曲榜单,并获取其歌曲列表。 + * @param custom_hotlist_id 榜单 ID。
    + * 默认榜单 ID 有:`ContentCenter` 和 `Project`,分别是火山内容中心热歌榜和项目热歌榜。如果你需要其他榜单,请联系技术支持人员。 + * @param id_num 榜单 ID 的个数。 + * @param filters 歌曲过滤方式,参看 MusicFilterType{@link #MusicFilterType}。 + * @note 调用接口后,你会收到 onHotMusicResult{@link #IKTVManagerEventHandler#onHotMusicResult} 回调歌曲列表。 + * @list 在线 KTV + */ + + virtual void getHotMusic(const char** custom_hotlist_id, int id_num, int filters) = 0; + /** + * + * @type api + * @brief 获取音乐详细信息。 + * @param music_id 音乐 ID。 + * @note 调用接口后,你会收到 onMusicDetailResult{@link #IKTVManagerEventHandler#onMusicDetailResult} 回调。 + * @list 在线 KTV + */ + + virtual void getMusicDetail(const char* music_id) = 0; + /** + * + * @type api + * @brief 下载音乐。 + * @param music_id 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若音乐下载成功,你会收到 onDownloadSuccess{@link #IKTVManagerEventHandler#onDownloadSuccess} 回调。 + * - 若音乐下载失败,你会收到 onDownloadFailed{@link #IKTVManagerEventHandler#onDownloadFailed} 回调。 + * - 音乐下载进度更新时,你会收到 onDownloadMusicProgress{@link #IKTVManagerEventHandler#onDownloadMusicProgress} 回调。 + * @list 在线 KTV + */ + + virtual int downloadMusic(const char* music_id) = 0; + /** + * + * @type api + * @brief 下载歌词。 + * @param music_id 音乐 ID。 + * @param type 歌词文件类型,参看 DownloadLyricType{@link #DownloadLyricType}。 + * @return 下载任务 ID。 + * @note + * - 若歌词下载成功,你会收到 onDownloadSuccess{@link #IKTVManagerEventHandler#onDownloadSuccess} 回调。 + * - 若歌词下载失败,你会收到 onDownloadFailed{@link #IKTVManagerEventHandler#onDownloadFailed} 回调。 + * @list 在线 KTV + */ + + virtual int downloadLyric(const char* music_id, DownloadLyricType type) = 0; + /** + * + * @type api + * @brief 下载 MIDI 文件。 + * @param music_id 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若文件下载成功,你会收到 onDownloadSuccess{@link #IKTVManagerEventHandler#onDownloadSuccess} 回调。 + * - 若文件下载失败,你会收到 onDownloadFailed{@link #IKTVManagerEventHandler#onDownloadFailed} 回调。 + * @list 在线 KTV + */ + + virtual int downloadMidi(const char* music_id) = 0; + /** + * + * @type api + * @brief 取消下载任务。 + * @param download_id 下载任务 ID。 + * @list 在线 KTV + */ + + virtual void cancelDownload(int download_id) = 0; + /** + * + * @type api + * @brief 清除当前音乐缓存文件,包括音乐音频和歌词。 + * @list 在线 KTV + */ + + virtual void clearCache() = 0; + /** + * + * @type api + * @brief 获取 KTV 播放器。 + * @return KTV 播放器接口,参看 IKTVPlayer{@link #IKTVPlayer}。 + * @list 在线 KTV + */ + + virtual IKTVPlayer *getKTVPlayer() = 0; + +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_defines.h new file mode 100644 index 0000000..f5979c0 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_defines.h @@ -0,0 +1,5285 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Stream Defines + */ + +#pragma once + +#include +#include + +#include "bytertc_rts_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 方法调用结果。 + */ + +enum ReturnStatus { + /** + * + * @brief 成功。 + */ + + kReturnStatusSuccess = 0, + /** + * + * @brief 失败。 + */ + + kReturnStatusFailure = -1, + /** + * + * @brief 参数错误。 + */ + + kReturnStatusParameterErr = -2, + /** + * + * @brief 接口状态错误。 + */ + + kReturnStatusWrongState = -3, + /** + * + * @brief 失败,用户已在房间内。 + */ + + kReturnStatusHasInRoom = -4, + /** + * + * @brief 失败,用户已登录。 + */ + + kReturnStatusHasInLogin = -5, + /** + * + * @brief 失败,用户已经在进行通话回路测试中。 + */ + + kReturnStatusHasInEchoTest = -6, + /** + * + * @brief 失败,音视频均未采集。 + */ + + kReturnStatusNeitherVideoNorAudio = -7, + /** + * + * @brief 失败,该 roomId 已被使用。 + */ + + kReturnStatusRoomIdInUse = -8, + /** + * + * @brief 失败,屏幕流不支持。 + */ + + kReturnStatusScreenNotSupport = -9, + /** + * + * @brief 失败,不支持该操作。 + */ + + kReturnStatusNotSupport = -10, + /** + * + * @brief 失败,资源已占用。 + */ + + kReturnStatusResourceOverflow = -11, + /** + * + * @brief 失败,不支持视频接口调用。 + */ + + kReturnStatusVideoNotSupport = -12, + /** + * + * @brief 游戏场景不支持调用该接口,会与游戏房间模块的 enableMicrophone{@link #IGameRoom#enableMicrophone} 接口互相冲突 + */ + + kReturnStatusGameSceneNotSupport = -13, + /** + * + * @brief 失败,没有音频帧。 + */ + + kReturnStatusAudioNoFrame = -101, + /** + * + * @brief 失败,未实现。 + */ + + kReturnStatusAudioNotImplemented = -102, + /** + * + * @brief 失败,采集设备无麦克风权限,尝试初始化设备失败。 + */ + + kReturnStatusAudioNoPermission = -103, + /** + * + * @brief 失败,设备不存在。当前没有设备或设备被移除时返回该值。 + */ + + kReturnStatusAudioDeviceNotExists = -104, + /** + * + * @brief 失败,设备音频格式不支持。 + */ + + kReturnStatusAudioDeviceFormatNotSupport = -105, + /** + * + * @brief 失败,系统无可用设备。 + */ + + kReturnStatusAudioDeviceNoDevice = -106, + /** + * + * @brief 失败,当前设备不可用,需更换设备。 + */ + + kReturnStatusAudioDeviceCannotUse = -107, + /** + * + * @brief 系统错误,设备初始化失败。 + */ + + kReturnStatusAudioDeviceInitFailed = -108, + /** + * + * @brief 系统错误,设备开启失败。 + */ + + kReturnStatusAudioDeviceStartFailed = -109, + /** + * + * @brief 指定的音频进程不存在,采集失败。 + */ + + kReturnStatusAudioDeviceProcessNotExist = -110, + /** + * + * @brief 不支持指定进程采集音频 + */ + + kReturnStatusAudioDeviceSpecifyingProcessUnsupport = -111, + /** + * + * @brief 失败,无效对象。 + */ + + kReturnStatusNativeInvalid = -201, + /** + * + * @brief 警告。推送视频帧到 RTC SDK 时,相邻视频帧的时间戳差异应当和推帧操作的间隔相同。如果不同,会收到此警告。 + */ + + kReturnStatusVideoTimeStampWarning = -202, + /** + * + * @brief 告警,配置下发了无效的aec场景。 + */ + + kReturnStatusAecSceneWarning = -302, + /** + * + * @brief 警告,配置下发了错误的aec类型。 + */ + + kReturnStatusAecTypeWarning = -303, +}; + +/** + * + * @type keytype + * @brief 房间内远端流被移除的原因。 + */ + +enum StreamRemoveReason { + /** + * + * @brief 远端用户停止发布流。 + */ + + kStreamRemoveReasonUnpublish = 0, + /** + * + * @brief 远端用户发布流失败。 + */ + + kStreamRemoveReasonPublishFailed = 1, + /** + * + * @brief 媒体服务器 10s 没收到客户端的媒体数据。 + */ + + kStreamRemoveReasonKeepLiveFailed = 2, + /** + * + * @brief 远端用户断网。 + */ + + kStreamRemoveReasonClientDisconnected = 3, + /** + * + * @brief 远端用户重新发布流。 + */ + + kStreamRemoveReasonRepublish = 4, + /** + * + * @brief 其他原因。 + */ + + kStreamRemoveReasonOther = 5, + /** + * + * @brief 远端用户 Token 发布权限过期。 + */ + + kStreamRemoveReasonPrivilegeTokenExpired = 6, + /** + * + * @brief 远端用户流被踢。 + */ + + kStreamRemoveReasonStreamKickedByOther = 7, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 用户角色。 + */ + +enum UserRoleType { + /** + * + * @brief 主播角色。该角色用户可在房间内发布和订阅音视频流,房间中的其他用户可以感知到该用户的存在。 + */ + + kUserRoleTypeBroadcaster = 1, + /** + * + * @brief 隐身用户角色。此角色用户只可在房间内订阅音视频流,房间中的其他用户无法感知到该用户的存在。 + */ + + kUserRoleTypeSilentAudience = 2, +}; + +/** + * + * @type keytype + * @brief 用户可见性状态改变错误码。 + */ + +enum UserVisibilityChangeError { + /** + * + * @brief 成功。 + */ + + kUserVisibilityChangeErrorOk = 0, + /** + * + * @brief 未知错误。 + */ + + kUserVisibilityChangeErrorUnknown = 1, + /** + * + * @brief 房间内可见用户达到上限。 + */ + + kUserVisibilityChangeErrorTooManyVisibleUser = 2, +}; + +/** + * + * @type keytype + * @brief 数据消息来源 + */ + +enum DataMessageSourceType { + /** + * + * @brief 通过客户端或服务端的插入的自定义消息。 + */ + + kDataMessageSourceTypeDefault = 0, + /** + * + * @brief 系统数据,包含音量指示信息。 + */ + + kDataMessageSourceTypeSystem, +}; + +/** + * + * @type keytype + * @brief SEI 发送模式。 + */ + +enum SEICountPerFrame { + /** + * + * @brief 单发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,SEI 数据会按顺序跟随连续的视频帧逐帧发送,单个视频帧最多只有一个 SEI 数据。 + * 例如,假设在某一帧间隔内需要发送 3 个 SEI 数据,那么第 1 个 SEI 会在当前帧发送,第 2 个 SEI 会在下一帧发送,第 3 个 SEI 会在再下一帧发送。 + */ + + kSEICountPerFrameSingle = 0, + /** + * + * @brief 多发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,这些 SEI 数据会全部在下一个视频帧上发送。这种模式可以降低发送延迟,但单个视频帧会携带多个 SEI 数据。 + * 例如,假设在某一帧间隔内有 3 个 SEI 数据需要发送,这 3 个 SEI 数据将全部在下一个视频帧上发送。 + */ + + kSEICountPerFrameMulti, +}; + +/** + * + * @type keytype + * @brief 上行/下行网络质量 + */ + +struct NetworkQualityStats { + /** + * + * @brief 用户 ID + */ + + const char* uid; + /** + * + * @brief 本端的上行/下行的丢包率,范围 [0.0,1.0]
    + * 当 `uid` 为本地用户时,代表发布流的上行丢包率。
    + * 当 `uid` 为远端用户时,代表接收所有订阅流的下行丢包率。 + */ + + double fraction_lost; + /** + * + * @brief 当 `uid` 为本地用户时有效,客户端到服务端的往返延时(RTT),单位:ms + */ + + int rtt; + /** + * + * @brief 本端的音视频 RTP 包 2 秒内的平均传输速率,单位:bps
    + * 当 `uid` 为本地用户时,代表发送速率。
    + * 当 `uid` 为远端用户时,代表所有订阅流的接收速率。 + */ + + int total_bandwidth; + /** + * + * @brief 上行网络质量评分,详见 NetworkQuality{@link #NetworkQuality}。 + */ + + NetworkQuality tx_quality; + /** + * + * @brief 下行网络质量评分,详见 NetworkQuality{@link #NetworkQuality}。 + */ + + NetworkQuality rx_quality; + /** + * + * @hidden constructor/destructor + */ + + NetworkQualityStats() : uid(""), fraction_lost(0.), rtt(0), total_bandwidth(0), + tx_quality(kNetworkQualityUnknown), rx_quality(kNetworkQualityUnknown) { + } +}; + +/** + * + * @type keytype + * @brief 房间模式
    + * 根据所需场景,选择合适的房间模式,应用不同的音视频算法、视频参数和网络配置
    + * 调用 `setAudioProfile` 改变音频参数配置 + */ + +enum RoomProfileType : int { + /** + * + * @brief 默认场景,通用模式
    + * 与 `kRoomProfileTypeMeeting = 16` 配置相同。
    + * 你可以联系技术支持更换默认配置参数。 + */ + + kRoomProfileTypeCommunication = 0, + /** + * + * @brief 游戏语音模式,低功耗、低流量消耗。
    + * 低端机在此模式下运行时,进行了额外的性能优化:
    + * - 部分低端机型配置编码帧长 40/60 + * - 部分低端机型关闭软件 3A 音频处理 + * 增强对 iOS 其他屏幕录制进行的兼容性,避免音频录制被 RTC 打断。 + */ + + kRoomProfileTypeGame = 2, + /** + * + * @brief 云游戏模式。
    + * 如果你的游戏场景需要低延迟的配置,使用此设置。
    + * 此设置下,弱网抗性较差。 + */ + + kRoomProfileTypeCloudGame = 3, + /** + * + * @brief 云渲染模式。超低延时配置。
    + * 如果你的应用并非游戏但又对延时要求较高时,选用此模式
    + * 该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。 + */ + + kRoomProfileTypeLowLatency = 4, + /** + * + * @brief 适用于 3 人及以上纯语音通话。
    + * 通话中,闭麦时是媒体模式,上麦后切换为通话模式。 + */ + + kRoomProfileTypeChatRoom = 6, + /** + * + * @brief 适用于单主播和观众进行音视频互动的直播。通话模式,上下麦不会有模式切换,避免音量突变现象 + */ + + kRoomProfileTypeInteractivePodcast = 10, + /** + * + * @brief 适合在线实时合唱场景,高音质,超低延迟。使用本配置前请联系技术支持进行协助完成其他配置。 + */ + + kRoomProfileTypeChorus = 12, + /** + * + * @brief 适用于 1 vs 1 游戏串流,支持公网或局域网。 + */ + + kRoomProfileTypeGameStreaming = 14, + /** + * + * @brief 适用于云端会议中的个人设备 + */ + + kRoomProfileTypeMeeting = 16, + /** + * + * @brief 适用于云端会议中的会议室终端设备,例如 Rooms,投屏盒子等。 + */ + + kRoomProfileTypeMeetingRoom = 17, + /** + * + * @brief 适用于课堂互动,房间内所有成员都可以进行音视频互动
    + * 当你的场景中需要同时互动的成员超过 10 人时使用此模式 + */ + + kRoomProfileTypeClassroom = 18, + /** + * + * @brief 注重流畅性,缺省码率相对低。适用于通话。 + */ + + kRoomProfileTypeCall = 19, + /** + * + * @brief 直播模式。更注重画质,视频缺省码率相对高。适用于直播互动。 + */ + + kRoomProfileTypeLive = 20, +}; +/** + * + * @type keytype + * @brief 直播模式。 + */ + +enum RoomLiveMode : int { + /** + * + * @brief 多人直播、连麦直播等模式。 + */ + + kRoomLiveModeCoHost = 1, + /** + * + * @brief 单人直播。 + */ + + kRoomLiveModeSoloHost = 2, +}; + +/** + * + * @type keytype + * @brief 多房间参数配置 + */ + +struct AudioRoomConfig { + /** + * + * @brief 房间模式,参看 RoomProfileType{@link #RoomProfileType},默认为 `kRoomProfileTypeCommunication`,进房后不可更改。 + */ + + RoomProfileType room_profile_type = kRoomProfileTypeCommunication; + /** + * + * @brief 是否自动订阅音频流,默认为自动订阅。 + */ + + bool is_auto_subscribe_audio = true; + /** + * + * @brief 是否自动发布音频流,默认为自动发布。
    + * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + + bool is_auto_publish_audio = true; +}; + +/** + * + * @type keytype + * @brief 媒体设备类型 + */ + +enum MediaDeviceType { + /** + * + * @brief 未知设备 + */ + + kMediaDeviceTypeAudioUnknown = -1, + /** + * + * @brief 音频渲染设备 + */ + + kMediaDeviceTypeAudioRenderDevice = 0, + /** + * + * @brief 音频采集设备 + */ + + kMediaDeviceTypeAudioCaptureDevice = 1, + /** + * + * @hidden currently not available + * @brief 视频渲染设备类型,该类型暂无使用 + */ + + kMediaDeviceTypeVideoRenderDevice = 2, + /** + * + * @brief 视频采集设备 + */ + + kMediaDeviceTypeVideoCaptureDevice = 3, + /** + * + * @brief 屏幕流视频设备 + */ + + kMediaDeviceTypeScreenVideoCaptureDevice = 4, + /** + * + * @brief 屏幕流音频设备 + */ + + kMediaDeviceTypeScreenAudioCaptureDevice = 5, +}; + +/** + * + * @type keytype + * @brief 媒体设备状态。 + */ + +enum MediaDeviceState { + /** + * + * @brief 设备已开启 + */ + + kMediaDeviceStateStarted = 1, + /** + * + * @brief 设备已停止 + */ + + kMediaDeviceStateStopped = 2, + /** + * + * @brief 设备运行时错误
    + * 例如,当媒体设备的预期行为是正常采集,但没有收到采集数据时,将回调该状态。 + */ + + kMediaDeviceStateRuntimeError = 3, + /** + * + * @brief 设备已暂停。包括:
    + * - 采集过程中,目标应用窗体最小化到任务栏。 + * - 开启采集或采集过程中,目标应用窗体被隐藏。 + * - 采集过程中,目标应用窗体正在被拉伸。 + * - 采集过程中,目标应用窗体正在被拖动。 + */ + + kMediaDeviceStatePaused = 4, + /** + * + * @brief 设备已恢复 + */ + + kMediaDeviceStateResumed = 5, + /** + * + * @brief 设备已插入
    + * 你可以调用获取设备接口更新设备列表。 + */ + + kMediaDeviceStateAdded = 10, + /** + * + * @brief 设备被移除
    + * 你可以调用获取设备接口更新设备列表。 + */ + + kMediaDeviceStateRemoved = 11, + /** + * + * @brief 用户合盖打断了视频通话。如果系统未休眠或关机,将在开盖后自动恢复视频通话。 + */ + + kMediaDeviceStateInterruptionBegan = 12, + /** + * + * @brief 视频通话已从合盖打断中恢复 + */ + + kMediaDeviceStateInterruptionEnded = 13, + /** + * + * @brief 设备成为系统默认 + */ + + kMediaDeviceStateBecomeSystemDefault = 14, + /** + * + * @brief 设备不再是系统默认 + */ + + kMediaDeviceStateResignSystemDefault = 15, + + /** + * + * @brief 获取设备列表超时后,收到设备列表通知。
    + * 再次调用获取设备接口更新设备列表。 + */ + + kMediaDeviceStateListUpdated = 16, +}; + +/** + * + * @type keytype + * @brief 媒体设备错误类型 + */ + +enum MediaDeviceError { + /** + * + * @brief 媒体设备正常 + */ + + kMediaDeviceErrorOK = 0, + /** + * + * @brief 没有权限启动媒体设备 + */ + + kMediaDeviceErrorDeviceNoPermission = 1, + /** + * + * @brief 媒体设备已经在使用中 + */ + + kMediaDeviceErrorDeviceBusy = 2, + /** + * + * @brief 媒体设备错误 + */ + + kMediaDeviceErrorDeviceFailure = 3, + /** + * + * @brief 未找到指定的媒体设备 + */ + + kMediaDeviceErrorDeviceNotFound = 4, + /** + * + * @brief 媒体设备被移除。
    + * 对象为采集屏幕流时,表明窗体被关闭或显示器被移除。 + */ + + kMediaDeviceErrorDeviceDisconnected = 5, + /** + * + * @brief 设备没有数据回调 + */ + + kMediaDeviceErrorDeviceNoCallback = 6, + /** + * + * @brief 设备采样率不支持 + */ + + kMediaDeviceErrorDeviceUNSupportFormat = 7, + /** + * + * @hidden(Android,macOS,Windows,Linux) + * @brief ios 屏幕采集没有 group id 参数 + */ + + kMediaDeviceErrorDeviceNotFindGroupId = 8, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:使用 camera 过程中被送到后台 + */ + + kMediaDeviceErrorDeviceNotAvailableInBackground = 9, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:被其他客户端打断,比如一个正在使用 capture session 的 app + */ + + kMediaDeviceErrorDeviceVideoInUseByAnotherClient = 10, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:使用 Slide Over,、Split View 或者 PIP 时被中断,比如台前调度,画中画 + */ + + kMediaDeviceErrorDeviceNotAvailableWithMultipleForegroundApps = 11, + /** + * + * @hidden(Android,Windows,Linux) + * @brief 打断类型:系统压力,比如过热 + */ + + kMediaDeviceErrorDeviceNotAvailableDueToSystemPressure = 12, + /** + * + * @hidden(Android, iOS, Linux) + * @brief 系统服务错误或长时间不响应,建议重启音频服务进程或重启设备。 + */ + + kMediaDeviceErrorAudioServerNeedRestart = 13, +}; + +/** + * + * @type keytype + * @brief 媒体设备警告 + */ + +enum MediaDeviceWarning { + /** + * + * @brief 无警告 + */ + + kMediaDeviceWarningOK = 0, + /** + * + * @brief 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。 + */ + + kMediaDeviceWarningOperationDenied = 1, + /** + * + * @brief 采集静音。 + */ + + kMediaDeviceWarningCaptureSilence = 2, + /** + * + * @hidden(iOS,macOS,Windows,Linux) + * @brief Android 特有的静音,系统层面的静音上报 + */ + + kMediaDeviceWarningAndroidSysSilence = 3, + /** + * + * @hidden(iOS,macOS,Windows,Linux) + * @brief Android 特有的静音消失 + */ + + kMediaDeviceWarningAndroidSysSilenceDisappear = 4, + + /** + * + * @hidden for internal use only + * @brief 音量过大,超过设备采集范围。建议降低麦克风音量或者降低声源音量。 + */ + + kMediaDeviceWarningDetectClipping = 10, + /** + * + * @brief 通话中出现回声现象。
    + * 当 RoomProfileType{@link #RoomProfileType} 为 `kRoomProfileTypeMeeting` 和
    + * `kRoomProfileTypeMeetingRoom`,且 AEC 关闭时,SDK 自动启动回声检测,如果检测到回声问题,将通过
    + * `onAudioDeviceWarning` 返回本枚举值。 + */ + + kMediaDeviceWarningDetectLeakEcho = 11, + /** + * + * @hidden for internal use only + * @brief 低信噪比 + */ + + kMediaDeviceWarningDetectLowSNR = 12, + /** + * + * @hidden for internal use only + * @brief 采集插零现象 + */ + + kMediaDeviceWarningDetectInsertSilence = 13, + /** + * + * @hidden for internal use only + * @brief 设备采集静音(算法层) + */ + + kMediaDeviceWarningCaptureDetectSilence = 14, + /** + * + * @hidden for internal use only + * @brief 设备采集静音消失 + */ + + kMediaDeviceWarningCaptureDetectSilenceDisappear = 15, + /** + * + * @hidden(Linux) + * @brief 啸叫。
    + * 触发该回调的情况如下:
    + * - 不支持啸叫抑制的房间模式下,检测到啸叫; + * - 支持啸叫抑制的房间模式下,检测到未被抑制的啸叫。仅 kRoomProfileTypeCommunication、kRoomProfileTypeMeeting、kRoomProfileTypeMeetingRoom 三种房间模式支持啸叫抑制。 建议提醒用户检查客户端的距离或将麦克风和扬声器调至静音。 + */ + + kMediaDeviceWarningCaptureDetectHowling = 16, + + /** + * + * @hidden for internal use only + * @brief 检测到突发脉冲噪声 + */ + + kMediaDeviceWarningSuddenImpluseDetected = 17, + + /** + * + * @hidden for internal use only + * @brief 检测到方波声音 + */ + + kMediaDeviceWarningSquareWavSoundDetected = 18, + + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, 该 scenario 下不支持设置 + */ + + kMediaDeviceWarningSetAudioRouteInvalidScenario = 20, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, routing device 不存在 (Android) + */ + + kMediaDeviceWarningSetAudioRouteNotExists = 21, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, 系统高优先级路由占用 (IOS) + */ + + kMediaDeviceWarningSetAudioRouteFailedByPriority = 22, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief 当前非通话模式 kAudioScenarioTypeCommunication,不支持设置音频路由 + */ + + kMediaDeviceWarningSetAudioRouteNotVoipMode = 23, + /** + * + * @hidden(Windows,macOS,Linux) + * @brief setAudioRoute 结果回调, 设备没有启动 + */ + + kMediaDeviceWarningSetAudioRouteDeviceNotStart = 24, + /** + * + * @hidden(macOS,Windows,Linux,Android) + * @brief setBluetoothMode 结果回调, 当前场景不会立即生效 + */ + + kMediaDeviceWarningSetBluetoothModeScenarioUnsupport = 25, + /** + * + * @hidden(macOS,Windows,Linux,Android) + * @brief setBluetoothMode 结果回调, 当前不支持设置蓝牙模式 + */ + + kMediaDeviceWarningSetBluetoothModeUnsupport = 26, + /** + * + * @hidden currently not available + * @brief 使用无声的采集设备 + */ + + kMediaDeviceWarningRecordingUseSilentDevice = 27, + /** + * + * @hidden(Linux) + * @brief 使用无声的播放设备 + */ + + kMediaDeviceWarningPlayoutUseSilentDevice = 28, + /** + * + * @hidden(macOS,Linux,Android,iOS) + * @brief 不支持排除本进程采集,当前采集全部进程音频 + */ + + kMediaDeviceWarningRecordingAllProcess = 29, + /** + * + * @hidden(macOS,Linux,Android,iOS) + * @brief 全部进程采集开启失败 + */ + + kMediaDeviceWarningRecordingAllProcessFailed = 30, +}; + +/** + * + * @type keytype + * @brief 订阅媒体流状态 + */ + +enum StreamSubscribeState { + /** + * + * @brief 订阅/取消订阅流成功 + */ + + kStreamSubscribeStateSuccess, + /** + * + * @brief 订阅/取消订阅流失败,本地用户未在房间中 + */ + + kStreamSubscribeStateFailedNotInRoom, + /** + * + * @brief 订阅/取消订阅流失败,房间内未找到指定的音视频流 + */ + + kStreamSubscribeStateFailedStreamNotFound, + /** + * + * @brief 超过订阅流数上限 + */ + + kStreamSubscribeStateFailedOverLimit, +}; + +/** + * + * @type keytype + * @brief 发布状态 + */ + +enum PublishState { + /** + * + * @brief 发布成功 + */ + + kPublishStatePublished, + /** + * + * @brief 发布失败 + */ + + kPublishStateUnpublished, +}; + +/** + * + * @type keytype + * @brief 订阅状态 + */ + +enum SubscribeState { + /** + * + * @brief 订阅成功 + */ + + kSubscribeStateSubscribed, + /** + * + * @brief 订阅失败 + */ + + kSubscribeStateUnsubscribed, +}; + +/** + * + * @type keytype + * @brief 发布状态变化原因 + */ + +enum PublishStateChangeReason { + /** + * + * @brief 用户调用发布 + */ + + kPublishStateChangeReasonPublish, + /** + * + * @brief 用户取消发布 + */ + + kPublishStateChangeReasonUnpublish, + /** + * + * @brief 发布 token 没有权限 + */ + + kPublishStateChangeReasonNoPublishPermission, + /** + * + * @brief 发布流总数超过上限 + */ + + kPublishStateChangeReasonOverStreamPublishLimit, + /** + * + * @brief 将一路流发布到多个房间时,其中一个房间取消发布失败。 + */ + + kPublishStateChangeReasonMultiRoomUnpublishFailed, + /** + * + * @brief 服务器错误导致发布失败 + */ + + kPublishStateChangeReasonPublishStreamFailed, + /** + * + * @brief 观众尝试发布操作 + */ + + kPublishStateChangeReasonPublishStreamForbidden, + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布。 + */ + + kPublishStateChangeReasonUserInPublish, + /** + * + * @brief 其他用户发布了相同 streamid 的流,导致本端发布的流被踢掉。 + */ + + kPublishStateChangeReasonStreamPublishByOther, + /** + * + * @brief 流 ID 校验失败。 + */ + + kPublishStateChangeReasonStreamIdInvalid +}; + +/** + * + * @type keytype + * @brief 订阅状态变化原因 + */ + +enum SubscribeStateChangeReason { + /** + * + * @brief 本端调用订阅 + */ + + kSubscribeStateChangeReasonSubscribe, + /** + * + * @brief 本端取消订阅 + */ + + kSubscribeStateChangeReasonUnsubscribe, + /** + * + * @brief 远端发布流 + */ + + kSubscribeStateChangeReasonRemotePublish, + /** + * + * @brief 远端取消发布流 + */ + + kSubscribeStateChangeReasonRemoteUnpublish, + /** + * + * @brief 由于服务器错误导致订阅失败。SDK 会自动重试订阅 + */ + + kSubscribeStateChangeReasonStreamFailed5xx, + /** + * + * @brief 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + kSubscribeStateChangeReasonStreamFailed404, + /** + * + * @brief 当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + kSubscribeStateChangeReasonOverStreamSubscribeLimit, + /** + * + * @brief 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + kSubscribeStateChangeReasonNoSubscribePermission +}; + +/** + * + * @hidden + * @deprecated since 3.26 and will be deleted in 3.51, use RoomConfig in joinRoom{@link #IRTCRoom#joinRoom} instead. + * @type keytype + * @brief 订阅模式选项。 + */ + +enum SubscribeMode { + /** + * + * @brief 自动订阅模式。SDK 会自动为你订阅房间中的每一路流。 + */ + + kSubscribeModeAuto = 0, + /** + * + * @brief 手动订阅模式。SDK 不会自动订阅房间内的音视频流,你应根据根据需要手动订阅其他用户发布的音视频流。 + */ + + kSubscribeModeManual = 1 +}; + +/** + * + * @type keytype + * @brief 远端用户优先级,在性能不足需要回退时,会优先回退优先级低的用户的音视频流 + */ + +enum RemoteUserPriority { + /** + * + * @brief 用户优先级为低(默认值) + */ + + kRemoteUserPriorityLow = 0, + /** + * + * @brief 用户优先级为正常 + */ + + kRemoteUserPriorityMedium = 100, + /** + * + * @brief 用户优先级为高 + */ + + kRemoteUserPriorityHigh = 200, +}; +/** + * + * @type keytype + * @brief 发布端音视频流回退选项 + */ + +enum PublishFallbackOption { + /** + * + * @brief 上行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + kPublishFallbackOptionDisabled = 0, + /** + * + * @brief 上行网络不佳或设备性能不足时,发布的视频流会从大流到小流依次降级,直到与当前网络性能匹配,具体降级规则参看[性能回退](https: + */ + + kPublishFallbackOptionSimulcast = 1, +}; +/** + * + * @type keytype + * @brief 订阅端音视频流回退选项。 + */ + +enum SubscribeFallbackOption { + /** + * + * @brief 下行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + kSubscribeFallbackOptionDisable = 0, + /** + * + * @brief 下行网络不佳或设备性能不足时,对视频流做降级处理,具体降级规则参看[音视频流回退](70137)。
    + * 该设置仅对发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setlocalsimulcastmode-2} 开启发送多路流功能的情况生效。 + */ + + kSubscribeFallbackOptionVideoStreamLow = 1, + /** + * + * @brief 下行网络不佳或设备性能不足时,先对视频流做回退处理。当网络状况不满足接收弱流时,则自动取消接收视频,仅接收音频。
    + * 该设置仅对发布端调用 setLocalSimulcastMode{@link #IRTCEngine#setlocalsimulcastmode-2} 开启发送多路流功能的情况生效。 + */ + + kSubscribeFallbackOptionAudioOnly = 2, +}; + +/** + * + * @type keytype + * @brief 远端订阅流发生回退或恢复的原因 + */ + +enum FallbackOrRecoverReason { + /** + * + * @brief 其他原因,非带宽和性能原因引起的回退或恢复。默认值 + */ + + kFallbackOrRecoverReasonUnknown = -1, + /** + * + * @brief 由带宽不足导致的订阅端音视频流回退。 + */ + + kFallbackOrRecoverReasonSubscribeFallbackByBandwidth = 0, + /** + * + * @brief 由性能不足导致的订阅端音视频流回退。 + */ + + kFallbackOrRecoverReasonSubscribeFallbackByPerformance = 1, + /** + * + * @brief 由带宽恢复导致的订阅端音视频流恢复。 + */ + + kFallbackOrRecoverReasonSubscribeRecoverByBandwidth = 2, + /** + * + * @brief 由性能恢复导致的订阅端音视频流恢复。 + */ + + kFallbackOrRecoverReasonSubscribeRecoverByPerformance = 3, + /** + * + * @brief 由带宽不足导致的发布端音视频流回退。 + */ + + kFallbackOrRecoverReasonPublishFallbackByBandwidth = 4, + /** + * + * @brief 由性能不足导致的发布端音视频流回退。 + */ + + kFallbackOrRecoverReasonPublishFallbackByPerformance = 5, + /** + * + * @brief 由带宽恢复导致的发布端音视频流恢复。 + */ + + kFallbackOrRecoverReasonPublishRecoverByBandwidth = 6, + /** + * + * @brief 由性能恢复导致的发布端音视频流恢复。 + */ + + kFallbackOrRecoverReasonPublishRecoverByPerformance = 7, +}; + +/** + * + * @type keytype + * @brief 性能相关告警的原因 + */ + +enum PerformanceAlarmReason { + /** + * + * @brief 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。 + */ + + kPerformanceAlarmReasonBandwidthFallbacked = 0, + /** + * + * @brief 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。 + */ + + kPerformanceAlarmReasonBandwidthResumed = 1, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足;
    + * 如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。 + */ + + kPerformanceAlarmReasonPerformanceFallbacked = 2, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复;
    + * 如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。 + */ + + kPerformanceAlarmReasonPerformanceResumed = 3, +}; + +/** + * + * @type keytype + * @brief 是否开启发布性能回退 + */ + +enum PerformanceAlarmMode { + /** + * + * @brief 未开启发布性能回退 + */ + + kPerformanceAlarmModeNormal = 0, + /** + * + * @brief 已开启发布性能回退 + */ + + kPerformanceAlarmModeSimulcast = 1, +}; + +/** + * + * @type keytype + * @brief 房间状态码。 + */ + +enum RoomState { + /** + * + * @brief 加入房间成功 + */ + + kRoomStateJoinSuccess = 0, + /** + * + * @brief 加入房间失败 + */ + + kRoomStateJoinFailed = 1, + /** + * + * @brief 离开房间 + */ + + kRoomStateLeft = 2, +}; + +/** + * + * @type keytype + * @brief 房间状态变化原因。 + */ + +enum RoomStateChangeReason { + /** + * + * @brief 首次进房成功。 + */ + + kRoomStateChangeReasonJoinRoom = 0, + /** + * + * @brief 重新进房,比如断网重连。 + */ + + kRoomStateChangeReasonReconnect = 1, + /** + * + * @brief 离开房间。 + */ + + kRoomStateChangeReasonLeaveRoom = 2, + + /** + * + * @brief 进房失败。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 当你调用初次加入房间或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + kRoomStateChangeReasonJoinRoomFailed = -2001, + + /** + * + * @brief Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 调用 joinRoom{@link #IRTCRoom#joinRoom} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken{@link #IRTSRoom#updateToken} 方法更新 Token。 + */ + + kRoomStateChangeReasonInvalidToken = -1000, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken` 传入的 Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 房间被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonUserForbidden = -1026, + + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonKickedOut = -1006, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonRoomDismiss = -1011, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonDuplicateLogin = -1004, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 进房时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + kRoomStateChangeReasonWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonServerLicenseExpired = -1017, + + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseNotMatchWithCache = -1024, + /** + * + * @hidden internal use only + * @brief license 计费方法没有加载成功。可能是因为 license 相关插件未正确集成。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomStateChangeReasonLicenseFunctionNotFound = -1027, + /** + * + * @brief 服务端异常状态导致退出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + kRoomStateChangeReasonStateAbnormalServerStatus = -1084, + /** + * + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + kRoomStateChangeReasonUnknown = -1001 +}; +/** + * + * @type keytype + * @brief 房间事件码。 + */ + +enum RoomEvent { + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `onUserJoined` 和 `onUserLeave` 回调,并通过广播提示房间内所有用户。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomEventUserNotifyStop = -2013, + + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + kRoomEventForbidden = -2012, + + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + kRoomEventRetryOnServerError = -2014 +}; + +/** + * + * @type keytype + * @brief 房间事件信息 + */ + +struct RoomEventInfo { + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + int64_t forbidden_time = 0; +}; + +/** + * + * @type errorcode + * @brief 回调错误码。 + */ + +enum ErrorCode { + /** + * + * @brief Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 调用 joinRoom{@link #IRTCRoom#joinRoom} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken{@link #IRTSRoom#updateToken} 方法更新 Token。 + */ + + kErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + kErrorCodeJoinRoom = -1001, + /** + * + * @brief 没有发布音视频流权限。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。
    + * 用户在所在房间中发布音视频流失败,失败原因为用户没有发布流的权限。 + */ + + kErrorCodeNoPublishPermission = -1002, + /** + * + * @brief 没有订阅音视频流权限。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
    + * 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + kErrorCodeNoSubscribePermission = -1003, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeDuplicateLogin = -1004, + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeKickedOut = -1006, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomErrorTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken` 传入的 Token 无效。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kRoomErrorUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeRoomDismiss = -1011, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 进房时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + kErrorCodeJoinRoomWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeRoomAlreadyExist = -1013, + /** + * + * @brief 加入多个房间时使用了不同的 uid。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 同一个引擎实例中,用户需使用同一个 uid 加入不同的房间。 + */ + + kErrorCodeUserIDDifferent = -1014, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomServerLicenseExpired = -1017, + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseNotMatchWithCache = -1024, + /** + * + * @brief 房间被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomUserForbidden = -1026, + /** + * + * @hidden internal use only + * @brief license 计费方法没有加载成功。可能是因为 license 相关插件未正确集成。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kErrorCodeJoinRoomLicenseFunctionNotFound = -1027, + /** + * + * @brief 订阅音视频流失败,订阅音视频流总数超过上限。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
    + * 游戏场景下,为了保证音视频通话的性能和质量,服务器会限制用户订阅的音视频流总数。当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + kErrorCodeOverStreamSubscribeLimit = -1070, + /** + * + * @brief 发布流失败,发布流总数超过上限。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调。
    + * RTC 系统会限制单个房间内发布的总流数,总流数包括视频流、音频流和屏幕流。如果房间内发布流数已达上限时,本地用户再向房间中发布流时会失败,同时会收到此错误通知。 + */ + + kErrorCodeOverStreamPublishLimit = -1080, + /** + * + * @deprecated since 3.52, use kErrorCodeOverStreamPublishLimit(-1080)instead + * @brief 发布视频流总数超过上限。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * RTC 系统会限制单个房间内发布的视频流数。如果房间内发布视频流数已达上限时,本地用户再向房间中发布视频流时会失败,同时会收到此错误通知。 + */ + + kErrorCodeOverVideoPublishLimit = -1082, + /** + * + * @deprecated since 3.60, use kAVSyncEventInvalidUidRepeated carried by onAVSyncEvent{@link #IRTCRoomEventHandler#onAVSyncEvent} instead. + * @brief 音视频同步失败。通过 onStreamStateChanged 回调。
    + * 当前音频源已与其他视频源关联同步关系。
    + * 单个音频源不支持与多个视频源同时同步。 + */ + + kErrorCodeInvalidAudioSyncUidRepeated = -1083, + /** + * + * @brief 服务端异常状态导致退出房间。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + kErrorCodeAbnormalServerStatus = -1084, + /** + * + * @hidden for internal use only + * @brief 在一路流推多房间的场景下,在至少有两个房间在发布同一路流时,其中一个房间取消发布失败,此时需要业务方重试或者由业务方通知用户重试取消发布。 + */ + + kErrorCodeMultiRoomUnpublishFailed = -1085, + /** + * + * @hidden for internal use only + * @brief 指定服务区域时传入错误参数。 + */ + + kErrorCodeWrongAreaCode = -1086, + /** + * + * @hidden for internal use only + */ + + kErrorCodeInternalDeadLockNotify = -1111, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
    + * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅起通知作用。 + */ + +enum WarningCode { + + + /** + * + * @brief 进房失败。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 当你调用初次加入房间或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + kWarningCodeJoinRoomFailed = -2001, + /** + * + * @brief 发布音视频流失败。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调。
    + * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + kWarningCodePublishStreamFailed = -2002, + /** + * + * @brief 订阅音视频流失败。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
    + * 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + kWarningCodeSubscribeStreamFailed404 = -2003, + /** + * + * @brief 订阅音视频流失败。通过 onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged}、onAudioSubscribeStateChanged{@link #IRTCRoomEventHandler#onAudioSubscribeStateChanged} 回调。
    + * 当你订阅所在房间中的音视频流时,由于服务器错误导致订阅失败。SDK 会自动重试订阅。 + */ + + kWarningCodeSubscribeStreamFailed5xx = -2004, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误。 + */ + + kWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + kWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 当调用 `setUserVisibility` 将自身可见性设置为 false 后,再尝试发布流会触发此警告。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。
    + */ + + kWarningCodePublishStreamForbidden = -2009, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + kWarningCodeSendCustomMessage = -2011, + + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `onUserJoined` 和 `onUserLeave` 回调,并通过广播提示房间内所有用户。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kWarningCodeUserNotifyStop = -2013, + + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布 WTN 流。通过 onVideoPublishStateChanged{@link #IRTCRoomEventHandler#onVideoPublishStateChanged}、onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。 + */ + + kWarningCodeUserInPublish = -2014, + + /** + * + * @brief 当前正在进行回路测试,该接口调用无效 + */ + + kWarningCodeInEchoTestMode = -2017, + + /** + * + * @brief 摄像头权限异常,当前应用没有获取摄像头权限。 + */ + + kWarningCodeNoCameraPermission = -5001, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceNoPermission 代替。
    + * 麦克风权限异常,当前应用没有获取麦克风权限。 + */ + + kWarningCodeNoMicrophonePermission = -5002, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceFailure 代替。
    + * 音频采集设备启动失败,当前设备可能被其他应用占用。 + */ + + kWarningCodeRecodingDeviceStartFailed = -5003, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceFailure 代替。
    + * 音频播放设备启动失败警告,可能由于系统资源不足,或参数错误。 + */ + + kWarningCodePlayoutDeviceStartFailed = -5004, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceNotFound 代替。
    + * 无可用音频采集设备,请插入可用的音频采集设备。 + */ + + kWarningCodeNoRecordingDevice = -5005, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceError{@link #MediaDeviceError}.kMediaDeviceErrorDeviceNotFound 代替。
    + * 无可用音频播放设备,请插入可用的音频播放设备。 + */ + + kWarningCodeNoPlayoutDevice = -5006, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceWarning{@link #MediaDeviceWarning}.kMediaDeviceWarningCaptureSilence 代替。
    + * 当前音频设备没有采集到有效的声音数据,请检查更换音频采集设备。 + */ + + kWarningCodeRecordingSilence = -5007, + /** + * + * @brief 已在 3.33 版本中废弃,使用 MediaDeviceWarning{@link #MediaDeviceWarning}.kMediaDeviceWarningOperationDenied 代替。
    + * 媒体设备误操作警告。
    + * 使用自定义采集时,不可调用内部采集开关,调用时将触发此警告。 + */ + + kWarningCodeMediaDeviceOperationDenied = -5008, + + /** + * + * @brief 你需要在 publishStreamAudio 之前调用 `setScreenAudioSourceType` 设置屏幕音频采集类型。 + */ + + kWarningCodeSetScreenAudioSourceTypeFailed = -5009, + + /** + * + * @brief 不支持在 publishStreamAudio 之后, 通过 `setScreenAudioStreamIndex` 设置屏幕共享时的音频采集方式。 + */ + + kWarningCodeSetScreenAudioStreamIndexFailed = -5010, + /** + * + * @brief 设置语音音高不合法 + */ + + kWarningCodeInvalidVoicePitch = -5011, + /** + * + * @brief 设置音频格式不合法 + */ + + kWarningCodeInvalidAudioFormat = -5012, + /** + * + * @brief 外部音频源新旧接口混用 + */ + + kWarningCodeInvalidCallForExtAudio = -5013, + /** + * + * @brief 非法的远端流索引 + */ + + kWarningCodeInvalidRemoteStreamKey = -5014, + /** + * + * @brief 指定的内部渲染画布句柄无效。
    + * 当你调用 setLocalVideoCanvas{@link #IRTCEngine#setLocalVideoCanvas} 时指定了无效的画布句柄,触发此回调。 + */ + + kWarningCodeInvalidCanvasHandle = -6001, + /** + * + * @brief 鉴权文件失效,当检查鉴权文件状态时,本地文件与远端文件不一致会触发警告。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。 + */ + + kWarningLicenseFileExpired = -7001, + + /** + * + * @brief [音频技术](https: + */ + + kWarningInvaildSamiAppkeyORToken = -7002, + + /** + * + * @brief [音频技术](https: + */ + + kWarningInvaildSamiResourcePath = -7003, + + /** + * + * @brief [音频技术](https: + */ + + kWarningLoadSamiLibraryFailed = -7004, + + /** + * + * @brief [音频技术](https: + */ + + kWarningInvaildSamiEffectType = -7005, +}; + +/** + * + * @type keytype + * @brief 本地音频流状态。 + */ + +enum LocalAudioStreamState { + /** + * + * @brief 本地音频默认初始状态。
    + * 麦克风停止工作时回调该状态,对应错误码 kLocalAudioStreamErrorOk + */ + + kLocalAudioStreamStateStopped = 0, + + /** + * + * @brief 本地音频录制设备启动成功。
    + * 采集到音频首帧时回调该状态,对应错误码 kLocalAudioStreamErrorOk + */ + + kLocalAudioStreamStateRecording, + + /** + * + * @brief 本地音频首帧编码成功。
    + * 音频首帧编码成功时回调该状态,对应错误码 kLocalAudioStreamErrorOk + */ + + kLocalAudioStreamStateEncoding, + + /** + * + * @brief 本地音频启动失败,在以下时机回调该状态:
    + * - 本地录音设备启动失败,对应错误码 kLocalAudioStreamErrorRecordFailure + * - 检测到没有录音设备权限,对应错误码 kLocalAudioStreamErrorDeviceNoPermission + * - 音频编码失败,对应错误码 kLocalAudioStreamErrorEncodeFailure + */ + + kLocalAudioStreamStateFailed, + + /** + * + * @brief 本地音频静音成功后回调该状态。
    + * 调用 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 成功后回调,对应错误码 LocalAudioStreamError{@link #LocalAudioStreamError} 中的 kLocalAudioStreamErrorOk 。 + */ + + kLocalAudioStreamStateMute, + + /** + * + * @brief 本地音频解除静音成功后回调该状态。
    + * 调用 setAudioCaptureDeviceMute{@link #IAudioDeviceManager#setAudioCaptureDeviceMute} 成功后回调,对应错误码 LocalAudioStreamError{@link #LocalAudioStreamError} 中的 kLocalAudioStreamErrorOk 。 + */ + + kLocalAudioStreamStateUnmute +}; + +/** + * + * @type keytype + * @brief 本地音频流状态改变时的错误码。 + */ + +enum LocalAudioStreamError { + /** + * + * @brief 本地音频状态正常 + */ + + kLocalAudioStreamErrorOk = 0, + /** + * + * @brief 本地音频出错原因未知 + */ + + kLocalAudioStreamErrorFailure, + /** + * + * @brief 没有权限启动本地音频录制设备 + */ + + kLocalAudioStreamErrorDeviceNoPermission, + /** + * + * @hidden currently not available + * @brief 本地音频录制设备已经在使用中 + * @note 该错误码暂未使用 + */ + + kLocalAudioStreamErrorDeviceBusy, + /** + * + * @brief 本地音频录制失败,建议你检查录制设备是否正常工作 + */ + + kLocalAudioStreamErrorRecordFailure, + /** + * + * @brief 本地音频编码失败 + */ + + kLocalAudioStreamErrorEncodeFailure, + /** + * + * @brief 没有可用的音频录制设备 + */ + + kLocalAudioStreamErrorNoRecordingDevice +}; + +/** + * + * @type keytype + * @brief 本地视频流状态 + */ + +enum LocalVideoStreamState { + /** + * + * @brief 本地视频采集停止状态 + */ + + kLocalVideoStreamStateStopped = 0, + /** + * + * @brief 本地视频采集设备启动成功 + */ + + kLocalVideoStreamStateRecording, + /** + * + * @brief 本地视频采集后,首帧编码成功 + */ + + kLocalVideoStreamStateEncoding, + /** + * + * @brief 本地视频采集设备启动失败 + */ + + kLocalVideoStreamStateFailed, +}; + +/** + * + * @type errorcode + * @brief 本地视频状态改变时的错误码 + */ + +enum LocalVideoStreamError { + /** + * + * @brief 状态正常 + */ + + kLocalVideoStreamErrorOk = 0, + /** + * + * @brief 本地视频流发布失败 + */ + + kLocalVideoStreamErrorFailure, + /** + * + * @brief 没有权限启动本地视频采集设备 + */ + + kLocalVideoStreamErrorDeviceNoPermission, + /** + * + * @brief 本地视频采集设备已被占用 + */ + + kLocalVideoStreamErrorDeviceBusy, + /** + * + * @brief 本地视频采集设备不存在 + */ + + kLocalVideoStreamErrorDeviceNotFound, + /** + * + * @brief 本地视频采集失败,建议检查采集设备是否正常工作 + */ + + kLocalVideoStreamErrorCaptureFailure, + /** + * + * @brief 本地视频编码失败 + */ + + kLocalVideoStreamErrorEncodeFailure, + /** + * + * @brief 通话过程中本地视频采集设备被其他程序抢占,导致设备连接中断 + */ + + kLocalVideoStreamErrorDeviceDisconnected +}; + +/** + * + * @type keytype + * @brief 远端音频流状态。 + */ + +enum RemoteAudioState { + /** + * + * @brief 不接收远端音频流。 + */ + + kRemoteAudioStateStopped = 0, + /** + * + * @brief 开始接收远端音频流首包。 + */ + + kRemoteAudioStateStarting, + /** + * + * @brief 远端音频流正在解码,正常播放。 + */ + + kRemoteAudioStateDecoding, + /** + * + * @brief 远端音频流卡顿。 + */ + + kRemoteAudioStateFrozen, + /** + * + * @hidden currently not available + * @brief 远端音频流播放失败 + * @note 该错误码暂未使用 + */ + + kRemoteAudioStateFailed, +}; + +/** + * + * @type keytype + * @brief 接收远端音频流状态改变的原因。 + */ + +enum RemoteAudioStateChangeReason { + /** + * + * @brief 内部原因 + */ + + kRemoteAudioStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + kRemoteAudioStateChangeReasonNetworkCongestion, + /** + * + * @brief 网络恢复正常 + */ + + kRemoteAudioStateChangeReasonNetworkRecovery, + /** + * + * @brief 本地用户停止接收远端音频流 + */ + + kRemoteAudioStateChangeReasonLocalMuted, + /** + * + * @brief 本地用户恢复接收远端音频流 + */ + + kRemoteAudioStateChangeReasonLocalUnmuted, + /** + * + * @brief 远端用户停止发送音频流 + */ + + kRemoteAudioStateChangeReasonRemoteMuted, + /** + * + * @brief 远端用户恢复发送音频流 + */ + + kRemoteAudioStateChangeReasonRemoteUnmuted, + /** + * + * @brief 远端用户离开房间 + */ + + kRemoteAudioStateChangeReasonRemoteOffline, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态。状态改变时,会收到 `onRemoteVideoStateChanged` 回调 + */ + +enum RemoteVideoState { + /** + * + * @brief 远端视频流默认初始状态,视频尚未开始播放。 + */ + + kRemoteVideoStateStopped = 0, + /** + * + * @brief 本地用户已接收远端视频流首包。 + */ + + kRemoteVideoStateStarting, + /** + * + * @brief 远端视频流正在解码,正常播放。 + */ + + kRemoteVideoStateDecoding, + /** + * + * @brief 远端视频流卡顿,可能有网络等原因。 + */ + + kRemoteVideoStateFrozen, + /** + * + * @brief 远端视频流播放失败。 + */ + + kRemoteVideoStateFailed, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态改变的原因 + */ + +enum RemoteVideoStateChangeReason { + /** + * + * @brief 内部原因 + */ + + kRemoteVideoStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + kRemoteVideoStateChangeReasonNetworkCongestion, + /** + * + * @brief 网络恢复正常 + */ + + kRemoteVideoStateChangeReasonNetworkRecovery, + /** + * + * @brief 本地用户停止接收远端视频流或本地用户禁用视频模块 + */ + + kRemoteVideoStateChangeReasonLocalMuted, + /** + * + * @brief 本地用户恢复接收远端视频流或本地用户启用视频模块 + */ + + kRemoteVideoStateChangeReasonLocalUnmuted, + /** + * + * @brief 远端用户停止发送视频流或远端用户禁用视频模块 + */ + + kRemoteVideoStateChangeReasonRemoteMuted, + /** + * + * @brief 远端用户恢复发送视频流或远端用户启用视频模块 + */ + + kRemoteVideoStateChangeReasonRemoteUnmuted, + /** + * + * @brief 远端用户离开房间。 + */ + + kRemoteVideoStateChangeReasonRemoteOffline, +}; + +/** + * + * @type keytype + * @brief 黑帧视频流状态 + */ + +enum SEIStreamEventType { + /** + * + * @brief 远端用户发布黑帧视频流。
    + * 纯语音通话场景下,远端用户调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 发送 SEI 数据时,SDK 会自动发布一路黑帧视频流,并触发该回调。 + */ + + kSEIStreamEventTypeStreamAdd = 0, + /** + * + * @brief 远端黑帧视频流移除。该回调的触发时机包括:
    + * - 远端用户开启摄像头采集,由语音通话切换至视频通话,黑帧视频流停止发布; + * - 远端用户调用 sendSEIMessage{@link #IRTCEngine#sendSEIMessage} 后 1min 内未有 SEI 数据发送,黑帧视频流停止发布; + * - 远端用户调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 切换至自定义视频采集时,黑帧视频流停止发布。 + */ + + kSEIStreamEventTypeStreamRemove, +}; + +/** + * + * @type keytype + * @brief 性能回退相关数据 + */ + +struct SourceWantedData { + /** + * + * @brief 如果未开启发送性能回退,此值表示推荐的视频输入宽度;
    + * 如果开启了发送性能回退,此值表示当前推流的最大宽度。 + */ + + int width; + /** + * + * @brief 如果未开启发送性能回退,此值表示推荐的视频输入高度;
    + * 如果开启了发送性能回退,此值表示当前推流的最大高度。 + */ + + int height; + /** + * + * @brief 如果未开启发送性能回退,此值表示推荐的视频输入帧率,单位 fps;
    + * 如果开启了发送性能回退,此值表示当前推流的最大帧率,单位 fps。 + */ + + int frame_rate; +}; +/** + * + * @type keytype + * @brief 用户信息 + */ + +struct UserInfo { + /** + * + * @brief 用户 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + */ + + const char* uid = nullptr; + /** + * + * @brief 用户的额外信息,最大长度为 200 字节。会在 `onUserJoined` 中回调给远端用户。 + */ + + const char* extra_info = nullptr; +}; + +/** + * + * @type keytype + * @brief 通话相关的统计信息 + */ + +struct RtcRoomStats { + /** + * + * @brief 当前应用的上行丢包率,取值范围为 [0, 1] + */ + + float tx_lostrate; + /** + * + * @brief 当前应用的下行丢包率,取值范围为 [0, 1] + */ + + float rx_lostrate; + /** + * + * @brief 客户端到服务端数据传输的往返时延(单位 ms) + */ + + int rtt; + /** + * + * @brief 本地用户在本次通话中的参与时长,单位为 s + */ + + unsigned int duration; + /** + * + * @brief 本地用户的总发送字节数 (bytes),累计值 + */ + + unsigned int tx_bytes; + /** + * + * @brief 本地用户的总接收字节数 (bytes),累计值 + */ + + unsigned int rx_bytes; + /** + * + * @brief 发送码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short tx_kbitrate; + /** + * + * @brief 接收码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short rx_kbitrate; + /** + * + * @brief 音频接收码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short rx_audio_kbitrate; + /** + * + * @brief 音频包的发送码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short tx_audio_kbitrate; + /** + * + * @brief 视频接收码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short rx_video_kbitrate; + /** + * + * @brief 视频发送码率(kbps),获取该数据时的瞬时值 + */ + + unsigned short tx_video_kbitrate; + /** + * + * @brief 屏幕接收码率,获取该数据时的瞬时值,单位为 Kbps + */ + + unsigned short rx_screen_kbitrate; + /** + * + * @brief 屏幕发送码率,获取该数据时的瞬时值,单位为 Kbps + */ + + unsigned short tx_screen_kbitrate; + /** + * + * @brief 当前房间内的可见用户人数 + */ + + unsigned int user_count; + /** + * + * @brief 当前应用的 CPU 使用率 (%) + */ + + double cpu_app_usage; + /** + * + * @hidden currently not available + * @brief 当前系统的 CPU 使用率 (%) + */ + + double cpu_total_usage; + /** + * + * @hidden currently not available + * @brief 系统上行网络抖动(ms) + */ + + int tx_jitter; + /** + * + * @hidden currently not available + * @brief 系统下行网络抖动(ms) + */ + + int rx_jitter; + /** + * + * @brief 蜂窝路径发送的码率 (kbps),为获取该数据时的瞬时值 + */ + + unsigned short tx_cellular_kbitrate; + /** + * + * @brief 蜂窝路径接收码率 (kbps),为获取该数据时的瞬时值 + */ + + unsigned short rx_cellular_kbitrate; +}; + +/** + * + * @type keytype + * @brief 视频的编码类型 + */ + +enum VideoCodecType { + /** + * + * @brief 未知类型 + */ + + kVideoCodecTypeUnknown = 0, + /** + * + * @brief 标准 H264 编码格式 + */ + + kVideoCodecTypeH264 = 1, + /** + * + * @brief ByteVC1 编码格式 + */ + + kVideoCodecTypeByteVC1 = 2, +}; + + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分模式。 + */ + +enum VideoSuperResolutionMode { + /** + * + * @brief 关闭超分。 + */ + + kVideoSuperResolutionModeOff = 0, + /** + * + * @brief 开启超分。 + */ + + kVideoSuperResolutionModeOn = 1, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 视频降噪模式。 + */ + +enum VideoDenoiseMode { + /** + * + * @brief 视频降噪关闭。 + */ + + kVideoDenoiseModeOff = 0, + /** + * + * @brief 视频降噪开启,由 ByteRTC 后台配置视频降噪算法。 + */ + + kVideoDenoiseModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 本地音频流统计信息,统计周期为 2s 。
    + * 本地用户发布音频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +struct LocalAudioStats { + /** + * + * @brief 音频丢包率。此次统计周期内的音频上行丢包率,取值范围为 [0, 1]。 + */ + + float audio_loss_rate; + /** + * + * @brief 发送码率。此次统计周期内的音频发送码率,单位为 kbps 。 + */ + + int send_kbitrate; + /** + * + * @brief 采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。 + */ + + int record_sample_rate; + /** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + + int stats_interval; + /** + * + * @brief 往返时延。单位为 ms 。 + */ + + int rtt; + /** + * + * @brief 音频声道数。 + */ + + int num_channels; + /** + * + * @brief 音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。 + */ + + int sent_sample_rate; + /** + * + * @brief 音频上行网络抖动,单位为 ms 。 + */ + + int jitter; + /** + * + * @brief 音频设备采集播放时延,单位为 ms 。 + */ + + int audio_device_loop_delay; + /** + * + * @brief 音频编码帧率。 + */ + + double encode_frame_rate; +}; + +/** + * + * @type keytype + * @brief 远端音频流统计信息,统计周期为 2s。
    + * 本地用户订阅远端音频流成功后,SDK 会周期性地通过 `onRemoteStreamStats` 通知本地用户订阅的音频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +struct RemoteAudioStats { + /** + * + * @brief 音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。 + */ + + float audio_loss_rate; + /** + * + * @brief 接收码率。统计周期内的音频接收码率,单位为 kbps 。 + */ + + int received_kbitrate; + /** + * + * @brief 音频卡顿次数。统计周期内的卡顿次数。 + */ + + int stall_count; + /** + * + * @brief 音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。 + */ + + int stall_duration; + /** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + + long e2e_delay; + /** + * + * @brief 播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。 + */ + + int playout_sample_rate; + /** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。 + */ + + int stats_interval; + /** + * + * @brief 客户端到服务端数据传输的往返时延,单位为 ms。 + */ + + int rtt; + /** + * + * @brief 发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。 + */ + + int total_rtt; + /** + * + * @brief 远端用户发送的音频流质量。远端用户发送的音频流质量。值含义参考 NetworkQuality{@link #NetworkQuality}。 + */ + + int quality; + /** + * + * @brief 因引入 jitter buffer 机制导致的延时。单位为 ms 。 + */ + + int jitter_buffer_delay; + /** + * + * @brief 音频声道数。 + */ + + int num_channels; + /** + * + * @brief 音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。 + */ + + int received_sample_rate; + /** + * + * @brief 远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。 + */ + + int frozen_rate; + /** + * + * @brief 音频丢包补偿(PLC) 样点总个数。 + */ + + int concealed_samples; + /** + * + * @brief 音频丢包补偿(PLC) 累计次数。 + */ + + int concealment_event; + /** + * + * @brief 音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。 + */ + + int dec_sample_rate; + /** + * + * @brief 此次订阅中,对远端音频流进行解码的累计耗时。单位为 s。 + */ + + int dec_duration; + /** + * + * @brief 音频下行网络抖动,单位为 ms 。 + */ + + int jitter; + /** + * + * @brief 音频解码帧率。 + */ + + double decode_frame_rate; +}; + +/** + * + * @type keytype + * @brief 本地视频流统计信息,统计周期为 2s 。
    + * 本地用户发布视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知用户发布的视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +struct LocalVideoStats { + /** + * + * @brief 发送码率。此次统计周期内实际发送的分辨率最大的视频流的发送码率,单位为 Kbps + */ + + int sent_kbitrate; + /** + * + * @brief 采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。 + */ + + int input_frame_rate; + /** + * + * @brief 发送帧率。此次统计周期内实际发送的分辨率最大的视频流的视频发送帧率,单位为 fps 。 + */ + + int sent_frame_rate; + /** + * + * @brief 编码器输出帧率。当前编码器在此次统计周期内实际发送的分辨率最大的视频流的输出帧率,单位为 fps 。 + */ + + int encoder_output_frame_rate; + /** + * + * @brief 本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。 + */ + + int renderer_output_frame_rate; + /** + * + * @brief 统计间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + + int stats_interval; + /** + * + * @brief 视频丢包率。此次统计周期内的视频上行丢包率,取值范围为 [0, 1] 。 + */ + + float video_loss_rate; + /** + * + * @brief 往返时延,单位为 ms 。 + */ + + int rtt; + /** + * + * @brief 视频编码码率。此次统计周期内的实际发送的分辨率最大的视频流视频编码码率,单位为 Kbps 。 + */ + + int encoded_bitrate; + /** + * + * @brief 实际发送的分辨率最大的视频流的视频编码宽度,单位为 px 。 + */ + + int encoded_frame_width; + /** + * + * @brief 实际发送的分辨率最大的视频流的视频编码高度,单位为 px 。 + */ + + int encoded_frame_height; + /** + * + * @brief 此次统计周期内实际发送的分辨率最大的视频流的发送的视频帧总数。 + */ + + int encoded_frame_count; + /** + * + * @brief 视频的编码类型,具体参考 VideoCodecType{@link #VideoCodecType} 。 + */ + + VideoCodecType codec_type; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 视频上行网络抖动,单位为 ms 。 + */ + + int jitter; + /** + * + * @hidden(Windows, Linux, macOS) for internal use + * @brief 视频降噪模式。具体参看 VideoDenoiseMode{@link #VideoDenoiseMode} 。 + */ + + VideoDenoiseMode video_denoise_mode; + /** + * + * @brief 视频编码平均耗时,单位 ms。 + */ + + int codec_elapse_per_frame; + +}; + +/** + * + * @type keytype + * @brief 远端视频流统计信息,统计周期为 2s 。
    + * 本地用户订阅远端视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +struct RemoteVideoStats { + /** + * + * @brief 视频宽度 + */ + + int width; + /** + * + * @brief 视频高度 + */ + + int height; + /** + * + * @brief 视频丢包率。统计周期内的视频下行丢包率,取值范围: [0, 1] 。 + */ + + float video_loss_rate; + /** + * + * @brief 接收码率。统计周期内的视频接收码率,单位为 kbps 。 + */ + + int received_kbitrate; + /** + * + * @brief 解码器输出帧率。统计周期内的视频解码器输出帧率,单位 fps 。 + */ + + int decoder_output_frame_rate; + /** + * + * @brief 渲染帧率。统计周期内的视频渲染帧率,单位 fps 。 + */ + + int renderer_output_frame_rate; + /** + * + * @brief 卡顿次数。统计周期内的卡顿次数。 + */ + + int stall_count; + /** + * + * @brief 卡顿时长。统计周期内的视频卡顿总时长。单位 ms 。 + */ + + int stall_duration; + /** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + + long e2e_delay; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 统计间隔,此次统计周期的间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,目前设置为 2s 。 + */ + + int stats_interval; + /** + * + * @brief 往返时延,单位为 ms 。 + */ + + int rtt; + /** + * + * @brief 远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。 + */ + + int frozen_rate; + /** + * + * @brief 视频的编码类型,具体参考 VideoCodecType{@link #VideoCodecType} 。 + */ + + VideoCodecType codec_type; + /** + * + * @brief 对应多种分辨率的流的下标。 + */ + + int video_index; + /** + * + * @brief 视频下行网络抖动,单位为 ms。 + */ + + int jitter; + /** + * + * @hidden(Windows, Linux, macOS) for internal use + * @brief 远端视频超分模式,参看 VideoSuperResolutionMode{@link #VideoSuperResolutionMode}。 + */ + + VideoSuperResolutionMode super_resolution_mode; + /** + * + * @brief 视频解码平均耗时,单位 ms。 + */ + + int codec_elapse_per_frame; + /** + * + * @brief 用户体验级别的端到端延时。从发送端开始采集到接收端渲染完成的延时,单位为 ms 。 + */ + + int cap_to_render_delay; + /** + * + * @brief 音画同步差异,单位为 ms 。 + */ + + int av_sync_diff_ms; +}; + +/** + * + * @type keytype + * @brief 本地音/视频流统计信息以及网络状况,统计周期为 2s 。
    + * 本地用户发布音/视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +struct LocalStreamStats { + /** + * + * @brief 本地设备发送音频流的统计信息,详见 LocalAudioStats{@link #LocalAudioStats} + */ + + LocalAudioStats audio_stats; + /** + * + * @brief 本地设备发送视频流的统计信息,详见 LocalVideoStats{@link #LocalVideoStats} + */ + + LocalVideoStats video_stats; + /** + * + * @brief 所属用户的媒体流上行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality local_tx_quality; + /** + * + * @brief 所属用户的媒体流下行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality local_rx_quality; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; +}; + +/** + * + * @type keytype + * @brief 用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
    + * 订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +struct RemoteStreamStats { + /** + * + * @brief 用户 ID 。音/视频来源的远端用户 ID 。 + */ + + const char* uid; + /** + * + * @brief 远端音频流的统计信息,详见 RemoteAudioStats{@link #RemoteAudioStats} + */ + + RemoteAudioStats audio_stats; + /** + * + * @brief 远端视频流的统计信息,详见 RemoteVideoStats{@link #RemoteVideoStats} + */ + + RemoteVideoStats video_stats; + /** + * + * @brief 所属用户的媒体流上行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality remote_tx_quality; + /** + * + * @brief 所属用户的媒体流下行网络质量,详见 NetworkQuality{@link #NetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use onNetworkQuality{@link #IRTCRoomEventHandler#onNetworkQuality} instead. + */ + + NetworkQuality remote_rx_quality; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈问题类型 + */ + +enum ProblemFeedbackOption : uint64_t { + /** + * + * @brief 没有问题 + */ + + kProblemFeedbackOptionNone = 0, + /** + * + * @brief 其他问题 + */ + + kProblemFeedbackOptionOtherMessage = (1ULL << 0), + /** + * + * @brief 连接失败 + */ + + kProblemFeedbackOptionDisconnected = (1ULL << 1), + /** + * + * @brief 耳返延迟大 + */ + + kProblemFeedbackOptionEarBackDelay = (1ULL << 2), + + /** + * + * @brief 本端有杂音 + */ + + kProblemFeedbackOptionLocalNoise = (1ULL << 10), + /** + * + * @brief 本端声音卡顿 + */ + + kProblemFeedbackOptionLocalAudioLagging = (1ULL << 11), + /** + * + * @brief 本端无声音 + */ + + kProblemFeedbackOptionLocalNoAudio = (1ULL << 12), + /** + * + * @brief 本端声音大/小 + */ + + kProblemFeedbackOptionLocalAudioStrength = (1ULL << 13), + /** + * + * @brief 本端有回声 + */ + + kProblemFeedbackOptionLocalEcho = (1ULL << 14), + /** + * + * @brief 本端视频模糊 + */ + + kProblemFeedbackOptionLocalVideoFuzzy = (1ULL << 24), + /** + * + * @brief 本端音视频不同步 + */ + + kProblemFeedbackOptionLocalNotSync = (1ULL << 25), + /** + * + * @brief 本端视频卡顿 + */ + + kProblemFeedbackOptionLocalVideoLagging = (1ULL << 26), + /** + * + * @brief 本端无画面 + */ + + kProblemFeedbackOptionLocalNoVideo = (1ULL << 27), + + /** + * + * @brief 远端有杂音 + */ + + kProblemFeedbackOptionRemoteNoise = (1ULL << 37), + /** + * + * @brief 远端声音卡顿 + */ + + kProblemFeedbackOptionRemoteAudioLagging = (1ULL << 38), + /** + * + * @brief 远端无声音 + */ + + kProblemFeedbackOptionRemoteNoAudio = (1ULL << 39), + /** + * + * @brief 远端声音大/小 + */ + + kProblemFeedbackOptionRemoteAudioStrength = (1ULL << 40), + /** + * + * @brief 远端有回声 + */ + + kProblemFeedbackOptionRemoteEcho = (1ULL << 41), + + /** + * + * @brief 远端视频模糊 + */ + + kProblemFeedbackOptionRemoteVideoFuzzy = (1ULL << 51), + /** + * + * @brief 远端音视频不同步 + */ + + kProblemFeedbackOptionRemoteNotSync = (1ULL << 52), + /** + * + * @brief 远端视频卡顿 + */ + + kProblemFeedbackOptionRemoteVideoLagging = (1ULL << 53), + /** + * + * @brief 远端无画面 + */ + + kProblemFeedbackOptionRemoteNoVideo = (1ULL << 54), +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈的房间信息 + */ + +struct ProblemFeedbackRoomInfo { + /** + * + * @brief 房间 ID。 + */ + + const char* room_id = nullptr; + + /** + * + * @brief 本地用户 ID。 + */ + + const char* user_id = nullptr; +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈的信息 + */ + +struct ProblemFeedbackInfo { + /** + * + * @brief 预设问题以外的其他问题的具体描述。 + */ + + const char* problem_desc = nullptr; + + /** + * + * @type keytype + * @brief 音视频质量反馈的房间信息。查看 ProblemFeedbackRoomInfo{@link #ProblemFeedbackRoomInfo}。 + */ + + ProblemFeedbackRoomInfo* room_info = nullptr; + /** + * + * @type keytype + * @brief `FeedbackRoomInfo` 的数组长度。 + */ + + int room_info_count = 0; +}; + +/** + * + * @type keytype + * @brief 自定义加密类型 + */ + +enum EncryptType { + /** + * + * @brief 不使用加密。默认值。 + */ + + kEncryptTypeNone = 0, + /** + * + * @brief AES-128-CBC 加密算法 + */ + + kEncryptTypeAES128CBC = 1, + /** + * + * @brief AES-256-CBC 加密算法 + */ + + kEncryptTypeAES256CBC = 2, + /** + * + * @brief AES-128-ECB 加密算法 + */ + + kEncryptTypeAES128ECB = 3, + /** + * + * @brief AES-256-ECB 加密算法 + */ + + kEncryptTypeAES256ECB = 4 +}; +/** + * + * @type callback + * @brief 加密/解密处理函数
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 通话加密 + */ + +class IEncryptHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IEncryptHandler() { + } + /** + * + * @type api + * @brief 自定义加密。
    + * 使用设定的自定义加密方式,对编码后传输前的音视频帧数据进行加密。
    + * 暂不支持对原始音视频帧进行加密。 + * @param data 原始音视频帧数据 + * @param length 原始音视频帧数据的长度 + * @param buf 可供写入的加密后数据缓冲区 + * @param buf_len 可供写入的加密后数据缓冲区大小 + * @return 加密后的数据
    + * - ≥ 0:加密后实际写入缓冲区的数据大小 + * - 0:丢弃该帧 + * @note + * - 使用此接口进行自定义加密前,你必须先设置自定义加密方式,参看 `setCustomizeEncryptHandler`。 + * - 使用 onDecryptData{@link #IEncryptHandler#onDecryptData} 对已加密的音视频帧数据进行解密。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + + virtual unsigned int onEncryptData( + const unsigned char* data, unsigned int length, unsigned char* buf, unsigned int buf_len) = 0; + /** + * + * @type api + * @brief 自定义解密。
    + * 对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 onEncryptData{@link #IEncryptHandler#onEncryptData}。 + * @param data 原始音视频帧数据 + * @param length 原始音视频帧数据的长度 + * @param buf 可供写入的加密后数据缓冲区 + * @param buf_len 可供写入的加密后数据缓冲区大小 + * @return 加密后的数据
    + * - ≥ 0:加密后实际写入缓冲区的数据大小 + * - 0:丢弃该帧 + * @note + * - 使用此接口进行解密前,你必须先设定解密方式,参看 `setCustomizeEncryptHandler`。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + + virtual unsigned int onDecryptData( + const unsigned char* data, unsigned int length, unsigned char* buf, unsigned int buf_len) = 0; +}; + +/** + * + * @type keytype + * @region 房间管理 + * @brief 用户信息 + */ + +struct RtcUser { + /** + * + * @brief 用户 id + */ + + const char* user_id; + /** + * + * @brief 元数据 + */ + + const char* meta_data; +}; + +/** + * + * @type keytype + * @region 房间管理 + * @brief 首帧发送状态 + */ + +enum FirstFrameSendState { + /** + * + * @brief 发送中 + */ + + kFirstFrameSendStateSending = 0, + /** + * + * @brief 发送成功 + */ + + kFirstFrameSendStateSent = 1, + /** + * + * @brief 发送失败 + */ + + kFirstFrameSendStateEnd = 2, +}; + +/** + * + * @type keytype + * @region 房间管理 + * @brief 首帧播放状态 + */ + +enum FirstFramePlayState { + /** + * + * @brief 播放中 + */ + + kFirstFramePlayStatePlaying = 0, + /** + * + * @brief 播放成功 + */ + + kFirstFramePlayStatePlayed = 1, + /** + * + * @brief 播放失败 + */ + + kFirstFramePlayStateEnd = 2, +}; + +/** + * + * @type keytype + * @brief 音视频流的发送/播放状态 + */ + +enum MuteState { + /** + * + * @brief 发送 + */ + + kMuteStateOff = 0, + /** + * + * @brief 停止发送 + */ + + kMuteStateOn = 1, +}; + +/** + * + * @type keytype + * @brief 预留字段。 + */ + +enum StreamIndex { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
    + * - 由摄像头/麦克风通过内部采集机制,采集到的视频/音频; + * - 通过自定义采集,采集到的视频/音频。 + */ + + kStreamIndexMain = 0, + /** + * + * @hidden for internal use only + * @brief 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。 + */ + + kStreamIndexScreen = 1, + /** + * + * @hidden for internal use only + */ + + kStreamIndex3rd, + /** + * + * @hidden for internal use only + */ + + kStreamIndex4th, + /** + * + * @hidden for internal use only + */ + + kStreamIndex5th, + /** + * + * @hidden for internal use only + */ + + kStreamIndex6th, + /** + * + * @hidden for internal use only + */ + + kStreamIndex7th, + /** + * + * @hidden for internal use only + */ + + kStreamIndexMax, +}; + +/** + * + * @valid since 3.56 + * @type keytype + * @brief 流聚合策略 + */ + +enum AggregationOption { + /** + * + * @brief 流聚合向下取值 (默认策略) + */ + + kAggregationOptionMin = 0, + /** + * + * @brief 流聚合向上取值 + */ + + kAggregationOptionMax = 1, + /** + * + * @brief 流聚合按比例取值,比例相同时,向下取值 + */ + + kAggregationOptionMajority = 2, + +}; + +/** + * + * @type keytype + * @brief 远端流信息 + */ + +struct RemoteStreamKey { + /** + * + * @brief 媒体流所在房间的房间 ID。
    + * 如果此媒体流是通过 `startForwardStreamToRooms` 转发到你所在房间的媒体流时,你应将房间 ID 设置为你所在的房间 ID。 + */ + + const char* room_id; + /** + * + * @brief 用户 ID + */ + + const char* user_id; + /** + * + * @brief 预留字段。 + */ + + StreamIndex stream_index; +}; + +/** + * + * @type keytype + * @brief 截图错误码 + */ + +enum SnapshotErrorCode { + /** + * + * @brief 截图成功。 + */ + + kSnapshotErrorCodeOk = 0, + /** + * + * @brief 截图错误。生成图片数据失败或 RGBA 编码失败。 + */ + + kSnapshotErrorCodeCreateFail = -1, + /** + * + * @brief 截图错误。流无效。 + */ + + kSnapshotErrorCodeStreamInvalid = -2, + /** + * + * @brief 截图错误。截图超时,超时时间 1 秒。 + */ + + kSnapshotErrorCodeTimeout = -3, + /** + * + * @brief 截图错误。图片保存失败。 + */ + + kSnapshotErrorCodeFileSaveError = -4 +}; +/** + * + * @type keytype + * @brief 本地录制文件的存储格式 + */ + +enum RecordingFileType { + /** + * + * @brief aac 格式文件 + */ + + kRecordingFileTypeAAC = 0, + /** + * + * @brief mp4 格式文件 + */ + + kRecordingFileTypeMP4 = 1, +}; + +/** + * + * @type keytype + * @brief 本地录制的状态 + */ + +enum RecordingState { + /** + * + * @brief 录制异常 + */ + + kRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + kRecordingStateProcessing = 1, + /** + * + * @brief 录制文件保存成功。正常调用 stopFileRecording 后触发。此外,若录制中途编码分辨率发生变更,SDK 会自动结束当前文件保存并触发此状态码,随后开启新一轮录制,直到调用停止录制。 + */ + + kRecordingStateSuccess = 2, +}; + +/** + * + * @type keytype + * @brief 本地录制的错误码 + */ + +enum RecordingErrorCode { + /** + * + * @brief 录制正常 + */ + + kRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + kRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 当前版本 SDK 不支持本地录制功能,请联系技术支持人员 + */ + + kRecordingErrorCodeNotSupport = -2, + /** + * + * @brief 其他异常 + */ + + kRecordingErrorCodeOther = -3, +}; + +/** + * + * @type keytype + * @brief 本地录制进度 + */ + +struct RecordingProgress { + /** + * + * @brief 当前文件的累计录制时长,单位:毫秒 + */ + + unsigned long long duration; + /** + * + * @brief 当前录制文件的大小,单位:byte + */ + + unsigned long long file_size; +}; + +/** + * + * @type keytype + * @brief 本地录制的详细信息 + */ + +struct RecordingInfo { + /** + * + * @brief 录制文件的绝对路径,包含文件名和文件后缀 + */ + + const char* file_path; + /** + * + * @brief 录制文件的视频编码类型,参看 VideoCodecType{@link #VideoCodecType} + */ + + VideoCodecType video_codec_type; + /** + * + * @brief 录制视频的宽,单位:像素。纯音频录制请忽略该字段 + */ + + int width; + /** + * + * @brief 录制视频的高,单位:像素。纯音频录制请忽略该字段 + */ + + int height; +}; + +/** + * + * @type keytype + * @brief 本地录制参数配置 + */ + +struct RecordingConfig { + /** + * + * @brief 录制文件保存的绝对路径,需精确到文件夹,文件名由 RTC 自动生成。你需要确保对该路径具有读写权限。 + */ + + const char* dir_path; + /** + * + * @brief 录制存储文件格式,参看 RecordingFileType{@link #RecordingFileType} + */ + + RecordingFileType file_type; +}; + +/** + * + * @type keytype + * @brief 定义 linux 用户的用户功能 + */ + +enum UserWorkerType { + /** + * + * @brief 正常用户,没有任何特殊属性 + */ + + kUserWorkerTypeNormal = 0, + /** + * + * @brief 用户支持 SIP 流,信令只下发 SIP 流 + */ + + kUserWorkerTypeSupportSip = (1 << 0), + /** + * + * @brief 用户支持屏幕流的 bytevc1 到 H264 转码 + */ + + kUserWorkerTypeByteVc1Transcoder = (1 << 1), + /** + * + * @brief 用户需要信令服务器下发全量的用户列表和回调函数 + */ + + kUserWorkerTypeNeedUserListAndCb = (1 << 2), + /** + * + * @brief 用户需要在房间进入多人模式时获取房间内所有流的相关回调 + */ + + kUserWorkerTypeNeedStreamCallBack = (1 << 3), + /** + * + * @brief 用户选择设置不支持音频选路功能 + */ + + kUserWorkerTypeAudioSelectionExemption = (1 << 4), +}; + +/** + * + * @type keytype + * @brief 音视频同步状态 + */ + +enum AVSyncState { + /** + * + * @brief 音视频开始同步 + */ + + kAVSyncStateAVStreamSyncBegin = 0, + /** + * + * @brief 音视频同步过程中音频移除,但不影响当前的同步关系 + */ + + kAVSyncStateAudioStreamRemove, + /** + * + * @brief 音视频同步过程中视频移除,但不影响当前的同步关系 + */ + + kAVSyncStateVdieoStreamRemove, + /** + * + * @hidden for internal use only + * @brief 订阅端设置同步 + */ + + kAVSyncStateSetAVSyncStreamId, +}; + +/** + * + * @hidden + * @deprecated + * @type keytype + */ + +enum RtcRoomMode { + kRtcRoomNormalMode = 0, + kRtcRoomAudioSelectionMode = 1, +}; + +/** + * + * @type keytype + * @brief 媒体流信息同步的流类型 + */ + +enum SyncInfoStreamType { + /** + * + * @brief 音频流 + */ + + kSyncInfoStreamTypeAudio = 0 +}; + +/** + * + * @type keytype + * @brief 流属性。 + */ + +struct StreamInfo { + /** + * + * @brief 流 ID 。 + */ + + const char* stream_id; + /** + * + * @brief 房间 ID。 + */ + + const char* room_id; + /** + * + * @brief 发布此流的用户 ID 。 + */ + + const char* user_id; + /** + * + * @hidden for internal use only + * @brief 该流的标识 ID,用户内唯一。 + */ + + int stream_index; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; +}; + +/** + * + * @type keytype + * @brief 媒体流信息同步的相关配置 + */ + +struct StreamSyncInfoConfig { + /** + * + * @brief 消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。 + */ + + int repeat_count; + /** + * + * @brief 媒体流信息同步的流类型,见 SyncInfoStreamType{@link #SyncInfoStreamType} + */ + + SyncInfoStreamType stream_type; +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发的目标房间的相关信息 + */ + +struct ForwardStreamInfo { + /** + * + * @brief 使用转发目标房间 roomID 和 UserID 生成 Token。
    + * 测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。
    + * 如果 Token 无效,转发失败。 + */ + + const char* token; + /** + * + * @brief 跨间转发媒体流过程中目标房间 ID + */ + + const char* room_id; +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发的目标房间的相关信息 + */ + +struct ForwardStreamConfiguration { + /** + * + * @brief 目标房间信息,数组中的每个元素包含一个房间的信息。 + */ + + ForwardStreamInfo* forward_stream_dests = nullptr; + /** + * + * @brief 目标房间数量。媒体流同时转发的目标房间数量建议小于等于 4 个。 + */ + + int dest_count = 0; +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发状态 + */ + +enum ForwardStreamState { + /** + * + * @brief 空闲状态
    + * - 成功调用 `stopForwardStreamToRooms` 后,所有目标房间为空闲状态。 + * - 成功调用 `updateForwardStreamToRooms` 减少目标房间后,本次减少的目标房间为空闲状态。 + */ + + kForwardStreamStateIdle = 0, + /** + * + * @brief 开始转发
    + * - 调用 `startForwardStreamToRooms` 成功向所有房间开始转发媒体流后,返回此状态。 + * - 调用 `updateForwardStreamToRooms` 后,成功向新增目标房间开始转发媒体流后,返回此状态。 + */ + + kForwardStreamStateSuccess = 1, + /** + * + * @brief 转发失败,失败详情参考 ForwardStreamError{@link #ForwardStreamError}
    + * 调用 `startForwardStreamToRooms` 或 `updateForwardStreamToRooms` 后,如遇转发失败,返回此状态。 + */ + + kForwardStreamStateFailure = 2, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发过程中抛出的错误码 + */ + +enum ForwardStreamError { + /** + * + * @brief 正常 + */ + + kForwardStreamErrorOK = 0, + /** + * + * @brief 参数异常 + */ + + kForwardStreamErrorInvalidArgument = 1201, + /** + * + * @brief token 错误 + */ + + kForwardStreamErrorInvalidToken = 1202, + /** + * + * @brief 服务端异常 + */ + + kForwardStreamErrorResponse = 1203, + /** + * + * @brief 目标房间有相同 user id 的用户加入,转发中断 + */ + + kForwardStreamErrorRemoteKicked = 1204, + /** + * + * @brief 服务端不支持转发功能 + */ + + kForwardStreamErrorNotSupport = 1205, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发事件 + */ + +enum ForwardStreamEvent { + /** + * + * @brief 本端与服务器网络连接断开,暂停转发。 + */ + + kForwardStreamEventDisconnected = 0, + /** + * + * @brief 本端与服务器网络连接恢复,转发服务连接成功。 + */ + + kForwardStreamEventConnected = 1, + /** + * + * @brief 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。 + */ + + kForwardStreamEventInterrupt = 2, + /** + * + * @brief 目标房间已更新,由 `updateForwardStreamToRooms` 触发。 + */ + + kForwardStreamEventDstRoomUpdated = 3, + /** + * + * @brief API 调用时序错误。例如,在调用 `startForwardStreamToRooms` 之前调用 `updateForwardStreamToRooms` 。 + */ + + kForwardStreamEventUnExpectAPICall = 4, +}; + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间的状态和错误信息 + */ + +struct ForwardStreamStateInfo { + /** + * + * @brief 跨间转发媒体流过程中目标房间 ID + */ + + const char* room_id; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间的状态,参看 ForwardStreamState{@link #ForwardStreamState} + */ + + ForwardStreamState state; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ForwardStreamError{@link #ForwardStreamError} + */ + + ForwardStreamError error; +}; + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间发生的事件 + */ + +struct ForwardStreamEventInfo { + /** + * + * @brief 跨房间转发媒体流过程中的发生该事件的目标房间 ID
    + * 空字符串代表所有目标房间 + */ + + const char* room_id; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间发生的事件,参看 ForwardStreamEvent{@link #ForwardStreamEvent} + */ + + ForwardStreamEvent event; +}; + +/** + * + * @type keytype + * @brief 水印图片相对视频流的位置和大小。 + */ + +struct ByteWatermark { + /** + * + * @hidden currently not available + */ + + const char* url = nullptr; + /** + * + * @brief 水印图片相对视频流左上角的横向偏移与视频流宽度的比值,取值范围为 [0,1)。 + */ + + float x; + /** + * + * @brief 水印图片相对视频流左上角的纵向偏移与视频流高度的比值,取值范围为 [0,1)。 + */ + + float y; + /** + * + * @brief 水印图片宽度与视频流宽度的比值,取值范围 [0,1)。 + */ + + float width; + /** + * + * @brief 水印图片高度与视频流高度的比值,取值范围为 [0,1)。 + */ + + float height; +}; + +/** + * + * @type keytype + * @brief 水印参数 + */ + +struct RTCWatermarkConfig { + /** + * + * @type keytype + * @brief 水印是否在视频预览中可见,默认可见。 + */ + + bool visible_in_preview = true; + /** + * + * @type keytype + * @brief 横屏时的水印位置和大小,参看 ByteWatermark{@link #ByteWatermark}。 + */ + + ByteWatermark position_in_landscape_mode; + /** + * + * @type keytype + * @brief 视频编码的方向模式为竖屏时的水印位置和大小,参看 ByteWatermark{@link #ByteWatermark}。 + */ + + ByteWatermark position_in_portrait_mode; +}; + +/** + * + * @type keytype + * @brief 设备的传输方式 + */ + +enum DeviceTransportType { + /** + * + * @brief 未知类型 + */ + + kDeviceTransportTypeUnknown = 0, + /** + * + * @brief 系统内置 + */ + + kDeviceTransportTypeBuiltIn = 1, + /** + * + * @brief 未知模式蓝牙 + */ + + kDeviceTransportTypeBlueToothUnknownMode = 2, + /** + * + * @brief 免提模式蓝牙 + */ + + kDeviceTransportTypeBlueToothHandsFreeMode = 3, + /** + * + * @brief 立体声模式蓝牙 + */ + + kDeviceTransportTypeBlueToothStereoMode = 4, + /** + * + * @brief 显示器/电视机音频设备 + */ + + kDeviceTransportTypeDisplayAudio = 5, + /** + * + * @brief 虚拟设备 + */ + + kDeviceTransportTypeVirtual = 6, + /** + * + * @brief USB 设备 + */ + + kDeviceTransportTypeUSB = 7, + /** + * + * @brief PCI 设备 + */ + + kDeviceTransportTypePCI = 8, + /** + * + * @brief AirPlay 设备 + */ + + kDeviceTransportTypeAirPlay = 9, + /** + * + * @brief 连续互通相机 + */ + + kDeviceTransportTypeContinuityCamera = 100, +}; + +/** + * + * @type keytype + * @brief 音视频回路测试结果 + */ + +enum class EchoTestResult { + /** + * + * @brief 接收到采集的音视频的回放,通话回路检测成功 + */ + + kTestSuccess = 0, + /** + * + * @brief 测试超过 60s 仍未完成,已自动停止 + */ + + kTestTimeout, + /** + * + * @brief 上一次测试结束和下一次测试开始之间的时间间隔少于 5s + */ + + kTestIntervalShort, + /** + * + * @brief 音频采集异常 + */ + + kAudioDeviceError, + /** + * + * @brief 视频采集异常 + */ + + kVideoDeviceError, + /** + * + * @brief 音频接收异常 + */ + + kAudioReceiveError, + /** + * + * @brief 视频接收异常 + */ + + kVideoReceiveError, + /** + * + * @brief 内部错误,不可恢复 + */ + + kInternalError +}; + +/** + * + * @type keytype + * @brief 音视频回路测试参数 + */ + +struct EchoTestConfig { + /** + * + * @brief 用于渲染接收到的视频的视图 + */ + + void* view; + /** + * + * @brief 是否检测音频。检测设备为系统默认音频设备。
    + * - true:是 + * - 若使用 SDK 内部采集,此时设备麦克风会自动开启,并在 audioPropertiesReportInterval 值大于 0 时触发 `onLocalAudioPropertiesReport` 回调,你可以根据该回调判断麦克风的工作状态 + * - 若使用自定义采集,此时你需调用 pushExternalAudioFrame{@link #IRTCEngine#pushExternalAudioFrame} 将采集到的音频推送给 SDK + * - false:否 + */ + + bool enable_audio; + /** + * + * @brief 是否检测视频。PC 端默认检测列表中第一个视频设备。
    + * - true:是 + * - 若使用 SDK 内部采集,此时设备摄像头会自动开启 + * - 若使用自定义采集,此时你需调用 pushExternalVideoFrame{@link #IRTCEngine#pushExternalVideoFrame} 将采集到的视频推送给 SDK + * - false:否 + * @note 视频的发布参数固定为:分辨率 640px × 360px,帧率 15fps。 + */ + + bool enable_video; + /** + * + * @brief 音量信息提示间隔,单位:ms,默认为 100ms
    + * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + + int audio_properties_report_interval; + /** + * + * @brief 进行音视频通话回路测试的用户 ID + */ + + const char* uid; + /** + * + * @brief 测试用户加入的房间 ID。 + */ + + const char* room_id; + /** + * + * @brief 对用户进房时进行鉴权验证的动态密钥,用于保证音视频通话回路测试的安全性。 + */ + + const char* token; +}; + +/** + * + * @type keytype + * @brief 音频 dump 状态。 + */ + +enum AudioDumpStatus { + /** + * + * @brief 音频 dump 启动失败 + */ + + kAudioDumpStatusStartFailure = 0, + /** + * + * @brief 音频 dump 启动成功 + */ + + kAudioDumpStatusStartSuccess = 1, + /** + * + * @brief 音频 dump 停止失败 + */ + + kAudioDumpStatusStopFailure = 2, + /** + * + * @brief 音频 dump 停止成功 + */ + + kAudioDumpStatusStopSuccess = 3, + /** + * + * @brief 音频 dump 运行失败 + */ + + kAudioDumpStatusRunningFailure = 4, + /** + * + * @brief 音频 dump 运行成功 + */ + + kAudioDumpStatusRunningSuccess = 5, +}; + +/** + * + * @type errorcode + * @brief 开始探测的返回值
    + * `startNetworkDetection` 返回对象类型 + */ + +enum NetworkDetectionStartReturn { + /** + * + * @brief 成功开启网络探测。 + */ + + kNetworkDetectionStartReturnSuccess = 0, + /** + * + * @brief 开始探测失败。参数错误,上下行探测均为 `false`,或期望带宽超过了范围 [100,10000] + */ + + kNetworkDetectionStartReturnParamErr = 1, + /** + * + * @brief 开始探测失败。失败原因为,本地已经开始推拉流 + */ + + kNetworkDetectionStartReturnStreaming = 2, + /** + * + * @brief 已经开始探测,无需重复开启 + */ + + kNetworkDetectionStartReturnStarted = 3, + /** + * + * @brief 不支持该功能 + */ + + kNetworkDetectionStartReturnNotSupport = 4, +}; + +/** + * + * @type keytype + * @brief 通话前探测的停止原因
    + * `onNetworkDetectionStopped` 回调的参数类型 + */ + +enum NetworkDetectionStopReason { + /** + * + * @brief 用户主动停止 + */ + + kNetworkDetectionStopReasonUser, + /** + * + * @brief 探测超过三分钟 + */ + + kNetworkDetectionStopReasonTimeout, + /** + * + * @brief 探测网络连接断开。
    当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。 + */ + + kNetworkDetectionStopReasonConnectionLost, + /** + * + * @brief 本地开始推拉流,停止探测 + */ + + kNetworkDetectionStopReasonStreaming, + /** + * + * @brief 网络探测失败,内部异常 + */ + + kNetworkDetectionStopReasonInnerErr, +}; + +/** + * + * @type keytype + * @brief 通话前探测链接的类型。
    + * `onNetworkDetectionResult` 回调的参数类型 + */ + +enum NetworkDetectionLinkType { + /** + * + * @brief 上行网络探测 + */ + + kNetworkDetectionLinkTypeUp = 0, + /** + * + * @brief 下行网络探测 + */ + + kNetworkDetectionLinkTypeDown, +}; + +/** + * + * @type keytype + * @brief 网络时间信息 + */ + +struct NetworkTimeInfo { + /** + * + * @brief 网络时间,单位:ms + */ + + int64_t timestamp; + /** + * + * @hidden constructor/destructor + */ + + explicit NetworkTimeInfo(int64_t ts): timestamp(ts) { + } +}; + +/** + * + * @type keytype + * @brief 通话前回声检测结果 + */ + +enum HardwareEchoDetectionResult{ + /** + * + * @brief 主动调用 `stopHardwareEchoDetection` 结束流程时,未有回声检测结果。 + */ + + kHardwareEchoDetectionResultCanceled = 0, + /** + * + * @brief 未检测出结果。建议重试,如果仍然失败请联系技术支持协助排查。 + */ + + kHardwareEchoDetectionResultUnknown = 1, + /** + * + * @brief 无回声 + */ + + kHardwareEchoDetectionResultNormal = 2, + /** + * + * @brief 有回声。可通过 UI 建议用户使用耳机设备入会。 + */ + + kHardwareEchoDetectionResultPoor = 3, +}; + +/** + * + * @type keytype + * @brief 音频选路优先级设置 + */ + +enum AudioSelectionPriority { + /** + * + * @brief 正常,参加音频选路 + */ + + kAudioSelectionPriorityNormal = 0, + /** + * + * @brief 高优先级,跳过音频选路 + */ + + kAudioSelectionPriorityHigh = 1 +}; + +/** + * + * @type keytype + * @brief 设置房间附加消息结果。 + */ + +enum SetRoomExtraInfoResult { + /** + * + * @brief 设置房间附加信息成功 + */ + + kSetRoomExtraInfoResultSuccess = 0, + /** + * + * @brief 设置失败,尚未加入房间 + */ + + kSetRoomExtraInfoResultErrorNotJoinRoom = -1, + /** + * + * @brief 设置失败,key 指针为空 + */ + + kSetRoomExtraInfoResultErrorKeyIsNull = -2, + /** + * + * @brief 设置失败,value 指针为空 + */ + + kSetRoomExtraInfoResultErrorValueIsNull = -3, + /** + * + * @brief 设置失败,未知错误 + */ + + kSetRoomExtraInfoResultResultUnknow = -99, + /** + * + * @brief 设置失败,key 长度为 0 + */ + + kSetRoomExtraInfoResultErrorKeyIsEmpty = -400, + /** + * + * @brief 调用 `setRoomExtraInfo` 过于频繁,建议不超过 10 次/秒。 + */ + + kSetRoomExtraInfoResultErrorTooOften = -406, + /** + * + * @brief 设置失败,用户已调用 `setUserVisibility` 将自身设为隐身状态。 + */ + + kSetRoomExtraInfoResultErrorSilentUser = -412, + /** + * + * @brief 设置失败,Key 长度超过 10 字节 + */ + + kSetRoomExtraInfoResultErrorKeyTooLong = -413, + /** + * + * @brief 设置失败,value 长度超过 128 字节 + */ + + kSetRoomExtraInfoResultErrorValueTooLong = -414, + /** + * + * @brief 设置失败,服务器错误 + */ + + kSetRoomExtraInfoResultErrorServer = -500 +}; +/** + * + * @type keytype + * @brief 字幕任务状态。 + */ + +enum SubtitleState { + /** + * + * @brief 开启字幕。 + */ + + kSubtitleStateStarted, + /** + * + * @brief 关闭字幕。 + */ + + kSubtitleStateStoped, + /** + * + * @brief 字幕任务出现错误。 + */ + + kSubtitleStateError +}; +/** + * + * @type keytype + * @brief 字幕模式。 + */ + +enum SubtitleMode { + /** + * + * @brief 识别模式。在此模式下,房间内用户语音会被转为文字。 + */ + + kSubtitleModeRecognition = 0, + /** + * + * @brief 翻译模式。在此模式下,房间内用户语音会先被转为文字,再被翻译为目标语言。 + */ + + kSubtitleModeTranslation +}; +/** + * + * @type errorcode + * @brief 字幕任务错误码。 + */ + +enum SubtitleErrorCode { + /** + * + * @brief 客户端无法识别云端媒体处理发送的错误码。请联系技术支持。 + */ + + kSubtitleErrorCodeUnknow = -1, + /** + * + * @brief 字幕已开启。 + */ + + kSubtitleErrorCodeSuccess, + /** + * + * @brief 云端媒体处理内部出现错误,请联系技术支持。 + */ + + kSubtitleErrorCodePostProcessError, + /** + * + * @brief 第三方服务连接失败,请联系技术支持。 + */ + + kSubtitleErrorCodeASRConnectionError, + /** + * + * @brief 第三方服务内部出现错误,请联系技术支持。 + */ + + kSubtitleErrorCodeASRServiceError, + /** + * + * @brief 未进房导致调用`startSubtitle`失败。请加入房间后再调用此方法。 + */ + + kSubtitleErrorCodeBeforeJoinRoom, + /** + * + * @brief 重复调用 `startSubtitle`。 + */ + + kSubtitleErrorCodeAlreadyOn, + /** + * + * @brief 用户选择的目标语言目前暂不支持。 + */ + + kSubtitleErrorCodeUnsupportedLanguage, + /** + * + * @brief 云端媒体处理超时未响应,请联系技术支持。 + */ + + kSubtitleErrorCodePostProcessTimeout +}; +/** + * + * @type keytype + * @brief 字幕配置信息。 + */ + +struct SubtitleConfig { + /** + * + * @brief 字幕模式。可以根据需要选择识别和翻译两种模式。开启识别模式,会将识别后的用户语音转化成文字;开启翻译模式,会在语音识别后进行翻译。参看 SubtitleMode{@link #SubtitleMode}。 + */ + + SubtitleMode mode = kSubtitleModeRecognition; + /** + * + * @brief 目标翻译语言。可点击 [语言支持](https: + */ + + const char* target_language = ""; +}; +/** + * + * @type keytype + * @brief 字幕具体内容。 + */ + +struct SubtitleMessage { + /** + * + * @brief 说话者的用户 ID。 + */ + + const char* user_id; + /** + * + * @brief 字幕文本, 采用 UTF-8 编码。 + */ + + const char* text; + /** + * + * @brief 字幕语种,根据字幕模式为原文或译文对应的语种。 + */ + + const char* language; + /** + * + * @brief 字幕模式,参看 SubtitleMode{@link #SubtitleMode}。 + */ + + SubtitleMode mode; + /** + * + * @brief 字幕文本序列号,同一发言人的完整发言和不完整发言会按递增顺序单独分别编号。 + */ + + int sequence; + /** + * + * @brief 语音识别出的文本是否为一段完整的一句话。 True 代表是, False 代表不是。 + */ + + bool definite; +}; +/** + * + * @type keytype + * @hidden internal use only + * @brief 特效错误类型。 + */ + +enum EffectErrorType { + /** + * + * @hidden 仅用于会议 + * @brief 虚拟背景设置错误。 + */ + + kEffectErrorVirtualBackgroundFailure = 1, + /** + * + * @hidden 仅用于会议 + * @brief 特效独立进程崩溃。 + */ + + kEffectErrorChildProcTerminate, +}; + +/** + * + * @type render error code + * @hidden for internal use only + * @brief 渲染错误码。 + */ + +enum RenderError { + /** + * + * @brief 渲染正常 + */ + + kRenderErrorOk = 0, + /** + * + * @brief Android 外部直显时使用了内部 surface + */ + + kRenderErrorUsingInternalSurface = -1, + /** + * + * @brief 设置 Android 外部直显时使用软解 + */ + + kRenderErrorUsingSoftwareDecoder = -2, + +}; + +/** + * + * @type keytype + * @brief 线程 block 信息,包含 block_session_id, 线程等待链,是否卡住了 rtc 主线程 + * @hidden internal use only + */ + +struct DeadLockMsg { + const char* block_session_id; + const char* blocking_paths; + bool is_critical; +}; + + +/** + * + * @type keytype + * @brief AVSync 事件类型 + */ + +enum AVSyncEvent { + /** + * + * @brief 音视频同步失败。
    + * 当前音频源已与其他视频源关联同步关系。
    + * 单个音频源不支持与多个视频源同时同步。 + */ + + kAVSyncEventInvalidUidRepeated +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人声检测结果 + */ + +enum AudioVADType { + /** + * + * @brief 未检测到人声 + */ + + kAudioVADTypeNoSpeech = 0, + + /** + * + * @brief 检测到人声。 + */ + + kAudioVADTypeSpeech = 1, +}; +/** + * + * @hidden for internal use only + * @type keytype + * @brief 音乐场景检测结果 + */ + +enum AudioAEDType { + /** + * + * @brief 未检测到音乐场景 + */ + + kAudioAEDTypeNoMusic = 0, + /** + * + * @brief 检测到音乐场景。 + */ + + kAudioAEDTypeMusic = 1, +}; + +class IVideoSource { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoSource() { + } +}; + +class IAudioSource { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IAudioSource() { + } +}; + + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_player.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_player.h new file mode 100644 index 0000000..2e85f04 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_media_player.h @@ -0,0 +1,588 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Audio Effect Player +*/ +#pragma once + +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @type callback + * @brief 本地音频文件混音的音频帧观察者。 + * @list 自定义流处理 + */ + +class IMediaPlayerAudioFrameObserver { +public: + /** + * + * @type callback + * @brief 当本地音频文件混音时,回调播放的音频帧。 + * @param player_id 播放器 ID + * @param frame 参看 IAudioFrame{@link #IAudioFrame}。 + * @list 混音 + */ + + virtual void onFrame(int player_id, const IAudioFrame& frame) = 0; + /** + * + * @hidden constructor/destructor + */ + + virtual ~IMediaPlayerAudioFrameObserver() { + } +}; +/** + * + * @type keytype + * @brief 自定义音频源模式 + */ + +enum MediaPlayerCustomSourceMode{ + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceModePush = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceModePull, +}; + +/** + * + * @type keytype + * @brief 音频数据的起始读取位置。 + */ + +enum MediaPlayerCustomSourceSeekWhence{ + /** + * + * @brief 从音频数据的头开始读取,读取的实际偏移量为参数 offset 的值。 + */ + + kMediaPlayerCustomSourceSeekWhenceSet = 0, + /** + * + * @brief 从音频数据的某一位置开始读取,读取的实际偏移量为音频数据当前的读取位置位置加上参数 offset 的值。 + */ + + kMediaPlayerCustomSourceSeekWhenceCur = 1, + /** + * + * @brief 从音频数据的尾开始读取,读取的实际数据偏移量为用户传入的音频数据大小加上参数 offset 的值。 + */ + + kMediaPlayerCustomSourceSeekWhenceEnd = 2, + /** + * + * @brief 返回音频数据的大小。 + */ + + kMediaPlayerCustomSourceSeekWhenceSize = 3, +}; +/** + * + * @type keytype + * @brief 自定义音频流类型 + */ + +enum MediaPlayerCustomSourceStreamType{ + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceStreamTypeRaw = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + kMediaPlayerCustomSourceStreamTypeEncoded, +}; +/** + * + * @type callback + * @brief 内存播放数据源回调 + * @list 自定义流处理 + */ + +class IMediaPlayerCustomSourceProvider { +public: + /** + * + * @valid since 3.53 + * @type callback + * @brief 调用 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口播放用户传入的内存音频数据时,会触发此回调,用户需要写入音频数据。 + * @param buffer 内存地址。在该地址中写入音频数据,写入音频数据的大小不超过 bufferSize 中填入的数值。支持的音频数据格式有: mp3,aac,m4a,3gp,wav。 + * @param buffer_size 音频数据大小,单位为字节。如果你想停止播放内存音频数据,可在 bufferSize 中填入小于或等于 0 的数,此时 SDK 会停止调用此接口。 + * @return 返回实际读取的音频数据大小。 + * @note 若 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口调用失败,请在 buffer 和 bufferSize 两个参数中填入 0。 此时 SDK 会停止调用此接口。 + * @list 混音 + */ + + virtual int onReadData(uint8_t *buffer, int buffer_size) = 0; + /** + * + * @valid since 3.53 + * @type callback + * @brief 根据设置好的内存音频数据的读取位置和读取偏移量对音频数据进行偏移,以便 SDK 读取和分析音频数据。
    + * 在调用 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口传入内存音频数据,或者调用 setPosition{@link #IMediaPlayer#setPosition} 设置了音频数据的起始播放位置后,SDK 会对音频数据进行读取和分析,此时会触发该回调,你需要根据参数中设置的起始读取位置和偏移量进行操作。 + * @param offset 音频数据读取偏移量,单位为字节,取值可正可负。 + * @param whence 音频数据的起始读取位置。参看 MediaPlayerCustomSourceSeekWhence{@link #MediaPlayerCustomSourceSeekWhence} + * @return + * 定位成功,返回偏移后的位置信息,或返回音频数据的大小。
    + * 定位失败,返回 -1。 + * @list 混音 + */ + + virtual int64_t onSeek(int64_t offset, MediaPlayerCustomSourceSeekWhence whence) = 0; + + virtual ~IMediaPlayerCustomSourceProvider() {} +}; +/** + * + * @type keytype + * @brief 音频源 + */ + +struct MediaPlayerCustomSource { + /** + * + * @hidden reserved for later use + */ + + IMediaPlayerCustomSourceProvider* provider = nullptr; + /** + * + * @type keytype + * @brief 数据源模式,详见 MediaPlayerCustomSourceMode{@link #MediaPlayerCustomSourceMode}。 + */ + + MediaPlayerCustomSourceMode mode = kMediaPlayerCustomSourceModePush; + /** + * + * @type keytype + * @brief 数据源类型,详见 MediaPlayerCustomSourceStreamType{@link #MediaPlayerCustomSourceStreamType} + */ + + MediaPlayerCustomSourceStreamType type = kMediaPlayerCustomSourceStreamTypeRaw; +}; +/** + * + * @type callback + * @brief IMediaPlayer{@link #IMediaPlayer} 对应的回调句柄。你必须调用 setEventHandler{@link #IMediaPlayer#setEventHandler} 完成设置后,才能收到对应回调。 + * @list Audio Mixing + */ + +class IMediaPlayerEventHandler { +public: + virtual ~IMediaPlayerEventHandler() {} + /** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param player_id IMediaPlayer{@link #IMediaPlayer} 的 ID。通过 getMediaPlayer{@link #IRTCEngine#getMediaPlayer} 设置。 + * @param state 混音状态。参考 PlayerState{@link #PlayerState}。 + * @param error 错误码。参考 PlayerError{@link #PlayerError}。 + * @list 混音 + */ + + virtual void onMediaPlayerStateChanged(int player_id, PlayerState state, PlayerError error) = 0; + /** + * + * @type callback + * @brief 播放进度周期性回调。回调周期通过 setProgressInterval{@link #IMediaPlayer#setProgressInterval} 设置。 + * @param player_id IMediaPlayer{@link #IMediaPlayer} 的 ID。通过 getMediaPlayer{@link #IRTCEngine#getMediaPlayer} 设置。 + * @param progress 进度。单位 ms。 + * @list 混音 + */ + + virtual void onMediaPlayerPlayingProgress(int player_id, int64_t progress) = 0; + /** + * + * @valid since 3.59 + * @type callback + * @brief 播放事件回调。调用 selectAudioTrack{@link #IMediaPlayer#selectAudioTrack} 和 setPosition{@link #IMediaPlayer#setPosition} 后,会触发此回调。 + * @param player_id IMediaPlayer{@link #IMediaPlayer} 的 ID。通过 getMediaPlayer{@link #IRTCEngine#getMediaPlayer} 设置。 + * @param event 播放器事件。参看 PlayerEvent{@link #PlayerEvent}。 + * @param message 事件描述信息,可能为空。 + * @list 混音 + */ + + virtual void onMediaPlayerEvent(int player_id, PlayerEvent event, const char* message) = 0; +}; +/** + * + * @valid since 3.53 + * @type api + * @brief 音乐播放器
    + * 调用 setEventHandler{@link #IMediaPlayer#setEventHandler} 设置回调句柄以获取相关回调。 + * @list Audio Mixing + */ + +class IMediaPlayer { +public: + IMediaPlayer(){} + virtual ~IMediaPlayer() {} + /** + * + * @type api + * @brief 打开音乐文件。
    + * 一个播放器实例仅能够同时打开一个音乐文件。如果需要同时打开多个音乐文件,请创建多个音乐播放器实例。
    + * 要播放 PCM 格式的音频数据,参看 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource}。`openWithCustomSource` 和此 API 互斥。 + * @param file_path 音乐文件路径。
    + * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
    + * 推荐的采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
    + * 不同平台支持的本地文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYYYY
    iOS/macOSYYYYYY
    WindowsYYYYYYYY
    + * 不同平台支持的在线文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYY
    iOS/macOSYYYY
    WindowsYYYYYYY
    + * @param config 详见 MediaPlayerConfig{@link #MediaPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 混音 + */ + + virtual int open(const char* file_path, const MediaPlayerConfig& config) = 0; + /** + * + * @type api + * @brief 播放音乐。你仅需要在调用 open{@link #IMediaPlayer#open},且未开启自动播放时,调用此方法。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 要播放 PCM 格式的音频数据,参看 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource}。`openWithCustomSource` 和此 API 互斥。 + * - 调用本方法播放音频文件后,可调用 stop{@link #IMediaPlayer#stop} 方法暂停播放。 + * @list 混音 + */ + + virtual int start() = 0; + /** + * + * @type api + * @brief 启动音频裸数据混音。
    + * 要播放音乐文件,参看 open{@link #IMediaPlayer#open}。`open` 与此 API 互斥。 + * @param source 数据源,详见 MediaPlayerCustomSource{@link #MediaPlayerCustomSource} + * @param config 详见 MediaPlayerConfig{@link #MediaPlayerConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法启动后,再调用 pushExternalAudioFrame{@link #IMediaPlayer#pushExternalAudioFrame} 推送音频数据,才会开始混音。 + * - 如要结束 PCM 音频数据混音,调用 stop{@link #IMediaPlayer#stop}。 + * @list 混音 + */ + + virtual int openWithCustomSource(const MediaPlayerCustomSource& source, const MediaPlayerConfig& config) = 0; + /** + * + * @type api + * @brief 调用 open{@link #IMediaPlayer#open}, start{@link #IMediaPlayer#start}, 或 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 开始播放后,可以调用本方法停止。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @list 混音 + */ + + virtual int stop() = 0; + /** + * + * @type api + * @brief 调用 open{@link #IMediaPlayer#open},或 start{@link #IMediaPlayer#start} 开始播放音频文件后,调用本方法暂停播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法暂停播放后,可调用 resume{@link #IMediaPlayer#resume} 恢复播放。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int pause() = 0; + /** + * + * @type api + * @brief 调用 pause{@link #IMediaPlayer#pause} 暂停音频播放后,调用本方法恢复播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int resume() = 0; + /** + * + * @type api + * @brief 调节指定混音的音量大小,包括音乐文件混音和 PCM 混音。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @param type 详见 AudioMixingType{@link #AudioMixingType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * @list 混音 + */ + + virtual int setVolume(int volume, AudioMixingType type) = 0; + /** + * + * @type api + * @brief 获取当前音量 + * @param type 详见 AudioMixingType{@link #AudioMixingType}。 + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在音频播放进行状态时,调用此方法。包括音乐文件混音和 PCM 混音。 + * @list 混音 + */ + + virtual int getVolume(AudioMixingType type) = 0; + /** + * + * @type api + * @brief 获取音乐文件时长。 + * @return + * - >0: 成功, 音乐文件时长,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getTotalDuration() = 0; + /** + * + * @type api + * @brief 获取混音音乐文件的实际播放时长,单位为毫秒。 + * @return + * - >0: 实际播放时长。 + * - < 0: 失败。 + * @note + * - 实际播放时长指的是歌曲不受停止、跳转、倍速、卡顿影响的播放时长。例如,若歌曲正常播放到 1:30 时停止播放 30s 或跳转进度到 2:00, 随后继续正常播放 2 分钟,则实际播放时长为 3 分 30 秒。 + * - 仅在音频播放进行状态,且 setProgressInterval{@link #IMediaPlayer#setProgressInterval} 设置间隔大于 `0` 时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getPlaybackDuration() = 0; + /** + * + * @type api + * @brief 获取音乐文件播放进度。 + * @return + * - >0: 成功, 音乐文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getPosition() = 0; + /** + * + * @valid since 3.59 + * @type api + * @brief 获取播放器状态 + * @return 播放器当前状态,参看 PlayerState{@link #PlayerState}。 + * @note 仅在音频实例创建后,调用此方法。 + * @list 混音 + */ + + virtual PlayerState getState() = 0; + /** + * + * @type api + * @brief 开启变调功能,多用于 K 歌场景。 + * @param pitch 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音乐文件混音,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setAudioPitch(int pitch) = 0; + /** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param position 音乐文件起始播放位置,单位为毫秒。
    + * 你可以通过 getTotalDuration{@link #IMediaPlayer#getTotalDuration} 获取音乐文件总时长,position 的值应小于音乐文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 调用本接口后,会收到 onMediaPlayerEvent{@link #IMediaPlayerEventHandler#onMediaPlayerEvent} 回调。 + * @list 混音 + */ + + virtual int setPosition(int position) = 0; + /** + * + * @type api + * @brief 设置当前音乐文件的声道模式 + * @param mode 声道模式。默认的声道模式和源文件一致,详见 AudioMixingDualMonoMode{@link #AudioMixingDualMonoMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setAudioDualMonoMode(AudioMixingDualMonoMode mode) = 0; + /** + * + * @type api + * @brief 获取当前音乐文件的音轨数 + * @return + >= 0:成功,返回当前音乐文件的音轨数 + * - < 0:方法调用失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int getAudioTrackCount() = 0; + /** + * + * @type api + * @brief 指定当前音乐文件的播放音轨 + * @param index 指定的播放音轨,从 0 开始,取值范围为 `[0, getAudioTrackCount()-1]`。
    + * 设置的参数值需要小于 getAudioTrackCount{@link #IMediaPlayer#getAudioTrackCount} 的返回值 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * - 调用本接口后,会收到 onMediaPlayerEvent{@link #IMediaPlayerEventHandler#onMediaPlayerEvent} 回调。 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * @list 混音 + */ + + virtual int selectAudioTrack(int index) = 0; + /** + * + * @type api + * @brief 设置播放速度 + * @param speed 播放速度与原始文件速度的比例,单位:%,取值范围为 `[50,200]`,默认值为 100。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件可用,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setPlaybackSpeed(int speed) = 0; + /** + * + * @type api + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress{@link #IMediaPlayerEventHandler#onMediaPlayerPlayingProgress} 的间隔。 + * @param interval 时间间隔,单位毫秒。
    + * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int setProgressInterval(int64_t interval) = 0; + /** + * + * @type api + * @brief 如果你需要使用 enableVocalInstrumentBalance{@link #IRTCEngine#enableVocalInstrumentBalance} 对音频文件/PCM 音频数据设置音量均衡,你必须通过此接口传入其原始响度。 + * @param loudness 原始响度,单位:lufs,取值范围为 `[-70.0, 0.0]`。
    + * 当设置的值小于 -70.0lufs 时,则默认调整为 -70.0lufs,大于 0.0lufs 时,则不对该响度做音量均衡处理。默认值为 1.0lufs,即不做处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件和音频裸数据播放都可用。 + * @list 混音 + */ + + virtual int setLoudness(float loudness) = 0; + /** + * + * @type api + * @brief 注册回调句柄以在本地音乐文件混音时,收到相关回调。 + * @param observer 参看 IMediaPlayerAudioFrameObserver{@link #IMediaPlayerAudioFrameObserver}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + + virtual int registerAudioFrameObserver(IMediaPlayerAudioFrameObserver* observer) = 0; + /** + * + * @type api + * @brief 推送用于混音的 PCM 音频帧数据 + * @param audio_frame 音频帧,详见 IAudioFrame{@link #IAudioFrame}。
    + * - 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return + * - 0: 成功 + * - < 0: 失败 + * @note + * - 调用该方法前,须通过 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 启动外部音频流混音。 + * - 使用参考建议:首次推送数据,请在应用侧先缓存一定数据(如 200 毫秒),然后一次性推送过去;此后的推送操作定时 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + * - 如果要暂停播放,暂停推送即可。 + * @list 混音 + */ + + virtual int pushExternalAudioFrame(IAudioFrame* audio_frame) = 0; + /** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 IMediaPlayerEventHandler{@link #IMediaPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + + virtual int setEventHandler(IMediaPlayerEventHandler* handler) = 0; + }; + + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_panoramic_video_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_panoramic_video_interface.h new file mode 100644 index 0000000..dfc8a26 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_panoramic_video_interface.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief panoramic video interface + */ + +#pragma once + +namespace bytertc { +/** + * + * @hidden for internal use only on Windows and Android + * @type keytype + * @brief 四元数表示的头部位姿信息
    + * q = xi + yj + zk + w,i^2 = j^2 = k^2 = −1 + */ + +typedef struct Quaternionf { + /** + * + * @brief x 坐标 + */ + + float x; + /** + * + * @brief y 坐标 + */ + + float y; + /** + * + * @brief z 坐标 + */ + + float z; + /** + * + * @brief 旋转角 + */ + + float w; +} Quaternionf; + +/** + * + * @hidden (Windows, Android) internal use only + * @type api + * @brief 全景视频接口实例 + */ + +class IPanoramicVideo { +public: + /** + * + * @type api + * @brief 更新接收者的头位姿四元数。RTC 将根据头位姿下发相应的 Tile 视频。 + * @param info 参考 Quaternionf{@link #Quaternionf}。 + */ + + virtual int updateQuaternionf(const Quaternionf& info) = 0; + + virtual ~IPanoramicVideo() = default; +}; +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_range_audio_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_range_audio_interface.h new file mode 100644 index 0000000..169500e --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_range_audio_interface.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief range audio interface + */ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 本地用户能收听到、且具有衰减效果的音频接收范围 + */ + +struct ReceiveRange { + /** + * + * @brief 能够接收语音、并且具有衰减效果的最小距离值,该值须 ≥ 0,但 ≤ max。
    + * 小于该值的范围内没有范围语音效果,即收听到的音频音量相同。 + */ + + int min; + /** + * + * @brief 能够收听语音的最大距离值,该值须 > 0 且 ≥ min。
    + * 当收听者和声源距离处于 [min, max) 之间时,收听到的音量根据距离呈衰减效果。
    + * 超出该值范围的音频将无法收听到。 + */ + + int max; +}; + +/** + * + * @type keytype + * @brief 空间音频音量随距离衰减模式 + */ + +enum AttenuationType { + /** + * + * @brief 不随距离衰减 + */ + + kAttenuationTypeNone = 0, + /** + * + * @brief 线性衰减,音量随距离增大而线性减小 + */ + + kAttenuationTypeLinear = 1, + /** + * + * @brief 指数型衰减,音量随距离增大进行指数衰减 + */ + + kAttenuationTypeExponential = 2, +}; +/** + * + * @hidden(Linux) + * @type api + * @brief 范围语音接口实例 + * @list + */ + +class IRangeAudio { +public: + /** + * + * @type api + * @brief 开启/关闭范围语音功能。
    + * 范围语音是指,在同一 RTC 房间中设定的音频接收距离范围内,本地用户收听到的远端用户音频音量会随着远端用户的靠近/远离而放大/衰减;若远端用户在房间内的位置超出设定范围,则本地用户无法接收其音频。音频接收范围设置参看 updateReceiveRange{@link #IRangeAudio#updateReceiveRange}。 + * @param enable 是否开启范围语音功能:
    + * - true: 开启 + * - false: 关闭(默认) + * @note 该方法进房前后都可调用,为保证进房后范围语音效果的平滑切换,你需在该方法前先调用 updatePosition{@link #IRangeAudio#updatePosition} 设置自身位置坐标,然后开启该方法收听范围语音效果。 + * @list 高级功能 + */ + + virtual void enableRangeAudio(bool enable) = 0; + /** + * + * @type api + * @brief 更新本地用户的音频收听范围。 + * @param range 音频收听范围,参看 ReceiveRange{@link #ReceiveRange}。 + * @return 方法调用结果:
    + * - 0:成功; + * - !0: 失败。 + * @list 高级功能 + */ + + virtual int updateReceiveRange(const ReceiveRange &range) = 0; + /** + * + * @type api + * @brief 更新本地用户在房间内空间直角坐标系中的位置坐标。 + * @param pos 三维坐标的值,默认为 [0, 0, 0],参看 Position{@link #Position} + * @return 方法调用结果:
    + * - 0:成功; + * - !0:失败。 + * @note + * - 调用该接口更新坐标后,你需调用 enableRangeAudio{@link #IRangeAudio#enableRangeAudio} 开启范围语音功能以收听范围语音效果。 + * @list 高级功能 + */ + + virtual int updatePosition(const Position &pos) = 0; + /** + * + * @type api + * @brief 设置范围语音的音量衰减模式。 + * @param type 音量衰减模式。默认为线性衰减。详见 AttenuationType{@link #AttenuationType}。 + * @param coefficient 指数衰减模式下的音量衰减系数,默认值为 1。范围 [0.1,100],推荐设置为 `50`。数值越大,音量的衰减速度越快。 + * @return 调用是否成功
    + * - `0`:调用成功 + * - `-1`:调用失败。原因为在调用 enableRangeAudio{@link #IRangeAudio#enableRangeAudio} 开启范围语音前或进房前调用本接口 + * @note 音量衰减范围通过 updateReceiveRange{@link #IRangeAudio#updateReceiveRange} 进行设置。 + * @list 高级功能 + */ + + virtual int setAttenuationModel(AttenuationType type, float coefficient) = 0; + /** + * + * @type api + * @brief 添加标签组,用于标记相互之间通话不衰减的用户组。
    + * 在同一个 RTC 房间中,如果多个用户的标签组之间有交集,那么,他们之间互相通话时,通话不衰减。
    + * 比如,用户身处多个队伍,队伍成员间通话不衰减。那么,可以为每个队伍绑定专属标签,每个用户的标签组包含用户所属各个队伍的标签。 + * @param flags 标签组 + * @param len 列表长度 + * @list 高级功能 + */ + + virtual void setNoAttenuationFlags(const char** flags, int len) = 0; + /** + * + * @hidden constructor/destructor + */ + + virtual ~IRangeAudio() {} +}; +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_rts_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_rts_defines.h new file mode 100644 index 0000000..745263d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_rts_defines.h @@ -0,0 +1,1281 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Common Defines + */ + +#pragma once + +#ifdef WIN32 +#define BYTERTC_API extern "C" __declspec(dllexport) +#elif defined(__APPLE__) +#include +#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) +#define BYTERTC_API __attribute__((__visibility__("default"))) extern "C" +#else +#define BYTERTC_API __attribute__((__visibility__("default"))) +#endif +#else +#define BYTERTC_API __attribute__((__visibility__("default"))) +#endif + +#ifdef __GNUC__ +# define GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) +#else +# define GCC_VERSION_AT_LEAST(x,y) 0 +#endif + +#if GCC_VERSION_AT_LEAST(3,1) +# define BYTERTC_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define BYTERTC_DEPRECATED __declspec(deprecated) +#else +# define BYTERTC_DEPRECATED +#endif + +#ifdef WIN32 +#define BYTERTC_STATIC_API __declspec(dllexport) +#elif defined(__APPLE__) +#include +#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) +#define BYTERTC_STATIC_API __attribute__((__visibility__("default"))) +#else +#define BYTERTC_STATIC_API __attribute__((__visibility__("default"))) +#endif +#else +#define BYTERTC_STATIC_API __attribute__((__visibility__("default"))) +#endif + +#include +#include + +namespace bytertc { + + +/** + * + * @hidden currently not available + */ + +enum RtsReturnStatus { + + kRtsReturnStatusSuccess = 0, + + kRtsReturnStatusFailure = -1, + + kRtsReturnStatusParameterErr = -2, + + kRtsReturnStatusWrongState = -3, + + kRtsReturnStatusHasInRoom = -4, + + kRtsReturnStatusHasInLogin = -5, + + kRtsReturnStatusRoomIdInUse = -8, + +}; + +/** + * + * @type keytype + * @brief 用户离开房间的原因。 + */ + +enum UserOfflineReason { + /** + * + * @brief 远端用户调用 `leaveRoom` 方法退出房间。 + */ + + kUserOfflineReasonQuit = 0, + /** + * + * @brief 远端用户因网络等原因掉线。 + */ + + kUserOfflineReasonDropped = 1, + /** + * + * @brief 远端用户切换至隐身状态。 + */ + + kUserOfflineReasonSwitchToInvisible = 2, + /** + * + * @brief 远端用户被踢出房间。
    + * 因调用踢出用户的 OpenAPI,远端用户被踢出房间。 + */ + + kUserOfflineReasonKickedByAdmin = 3, +}; + +/** + * + * @type keytype + * @brief 用户加入房间的类型。 + */ + +enum JoinRoomType { + /** + * + * @brief 首次加入房间。用户手动调用 `joinRoom` 加入房间。 + */ + + kJoinRoomTypeFirst = 0, + /** + * + * @brief 重新加入房间。用户网络较差,失去与服务器的连接,进行重连时收到加入成功。 + */ + + kJoinRoomTypeReconnected = 1, +}; + +/** + * + * @type keytype + * @brief 用户登录的类型 + */ + +enum LoginType { + /** + * + * @brief 首次登录。用户手动调用 `login`,收到登录成功。 + */ + + kLoginTypeFirst = 0, + /** + * + * @brief 重连。用户网络较差,失去与服务器的连接,SDK 自动重连登录成功。 + */ + + kLoginTypeReconnected = 1, +}; + +/** + * + * @type errorcode + * @brief 登录结果
    + * 调用 `login` 登录的结果,会通过 `onLoginResult` 回调通知用户。 + */ + +enum LoginErrorCode { + /** + * + * @brief 调用 `login` 方法登录成功 + */ + + kLoginErrorCodeSuccess = 0, + /** + * + * @brief 调用 `login` 方法时使用的 Token 无效或过期失效,需要用户重新获取 Token。 + */ + + kLoginErrorCodeInvalidToken = -1000, + /** + * + * @brief 登录错误
    + * 调用 `login` 方法时发生未知错误导致登录失败,需要重新登录。 + */ + + kLoginErrorCodeLoginFailed = -1001, + /** + * + * @brief 调用 `login` 方法时传入的用户 ID 有问题。 + */ + + kLoginErrorCodeInvalidUserId = -1002, + /** + * + * @brief 调用 `login` 登录时服务端出错。 + */ + + kLoginErrorCodeServerError = -1003, + /** + * + * @brief 当前为受限模式,禁止 `login` 登录。 + */ + + kLoginErrorCodeLimitedMode = -1004, +}; + +/** + * + * @type keytype + * @brief 用户登出的原因 + */ + +enum LogoutReason { + /** + * + * @brief 用户主动退出
    + * 用户调用 `logout` 接口登出,或者销毁引擎登出。 + */ + + kLogoutReasonLogout = 0, + /** + * + * @brief 用户被动退出
    + * 另一个用户以相同 UserId 进行了 `login`,导致本端用户被踢出。 + */ + + kLogoutReasonDuplicateLogin = 1, +}; + +/** + * + * @type keytype + * @brief 用户在线状态。 + */ + +enum UserOnlineStatus { + /** + * + * @brief 对端用户离线
    + * 对端用户已调用 `logout`,或者没有调用 `login` 进行登录。 + */ + + kUserOnlineStatusOffline = 0, + /** + * + * @brief 对端用户在线
    + * 对端用户调用 `login` 登录,并且连接状态正常。 + */ + + kUserOnlineStatusOnline = 1, + /** + * + * @brief 无法获取对端用户在线状态
    + * 发生级联错误、对端用户在线状态异常时返回。 + */ + + kUserOnlineStatusUnreachable = 2, +}; + +/** + * + * @type keytype + * @brief 服务端消息发送结果回调内容 + */ + +struct ServerACKMsg { + /** + * + * @brief 回调消息长度 + */ + + int length; + /** + * + * @brief 回调消息内容 + */ + + char* ack_msg; +}; + +/** + * + * @type keytype + * @brief 消息类型 + */ + +enum MessageConfig { + /** + * + * @brief 低延时可靠有序消息 + */ + + kMessageConfigReliableOrdered = 0, + /** + * + * @brief 超低延时有序消息 + */ + + kMessageConfigUnreliableOrdered = 1, + /** + * + * @brief 超低延时无序消息 + */ + + kMessageConfigUnreliableUnordered = 2 +}; + +/** + * + * @type errorcode + * @brief 发送消息结果,成功或失败,及失败原因 + */ + +enum UserMessageSendResult { + /** + * + * @brief 发送消息成功。 + */ + + kUserMessageSendResultSuccess = 0, + /** + * + * @brief 消息发送失败。发送超时。 + */ + + kUserMessageSendResultTimeout = 1, + /** + * + * @brief 消息发送失败。连接断开,消息未发出。 + */ + + kUserMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 消息发送失败。找不到接收方。 + */ + + kUserMessageSendResultNoReceiver = 3, + /** + * + * @brief 消息发送失败。远端用户没有登录或进房。 + */ + + kUserMessageSendResultNoRelayPath = 4, + /** + * + * @brief 消息发送失败。超过 QPS 限制。 + */ + + kUserMessageSendResultExceedQPS = 5, + /** + * + * @brief 消息发送失败。应用服务器未收到客户端发送的消息。
    + * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + kUserMessageSendResultE2BSSendFailed = 17, + /** + * + * @brief 消息发送失败。应用服务器接收到了客户端发送的消息,但响应失败。
    + * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + kUserMessageSendResultE2BSReturnFailed = 18, + /** + * + * @brief 消息发送失败。消息发送方没有加入房间。 + */ + + kUserMessageSendResultNotJoin = 100, + /** + * + * @brief 消息发送失败。连接未完成初始化。 + */ + + kUserMessageSendResultInit = 101, + /** + * + * @brief 消息发送失败。没有可用的数据传输通道连接。 + */ + + kUserMessageSendResultNoConnection = 102, + /** + * + * @brief 消息发送失败。消息超过最大长度。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + kUserMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 消息发送失败。接收方用户 ID 为空。 + */ + + kUserMessageSendResultEmptyUser = 104, + /** + * + * @brief 消息发送失败。房间外或应用服务器消息发送方没有登录。 + */ + + kUserMessageSendResultNotLogin = 105, + /** + * + * @brief 消息发送失败。发送消息给业务方服务器之前没有设置参数。 + */ + + kUserMessageSendResultServerParamsNotSet = 106, + /** + * + * @brief 消息发送失败。未知错误。 + */ + + kUserMessageSendResultUnknown = 1000, +}; + +/** + * + * @type keytype + * @brief 房间内广播消息发送结果 + */ + +enum RoomMessageSendResult { + /** + * + * @brief 消息发送成功 + */ + + kRoomMessageSendResultSuccess = 200, + /** + * + * @brief 发送超时,没有发送 + */ + + kRoomMessageSendResultTimeout = 1, + /** + * + * @brief 通道断开,没有发送 + */ + + kRoomMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 超过 QPS 限制 + */ + + kRoomMessageSendResultExceedQPS = 5, + /** + * + * @brief 失败,发送方未加入房间 + */ + + kRoomMessageSendResultNotJoin = 100, + /** + * + * @brief 失败,没有可用的数据传输通道连接 + */ + + kRoomMessageSendResultNoConnection = 102, + /** + * + * @brief 失败。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + kRoomMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 失败,未知错误 + */ + + kRoomMessageSendResultUnknown = 1000, +}; + +/** + * + * @type keytype + * @brief SDK 与信令服务器连接状态。 + */ + +enum ConnectionState { + /** + * + * @brief 连接断开超过 12s,此时 SDK 会尝试自动重连。 + */ + + kConnectionStateDisconnected = 1, + /** + * + * @brief 首次请求建立连接,正在连接中。 + */ + + kConnectionStateConnecting = 2, + /** + * + * @brief 首次连接成功。 + */ + + kConnectionStateConnected = 3, + /** + * + * @brief 涵盖了以下情况:
    + * - 首次连接时,10 秒连接不成功; + * - 连接成功后,断连 10 秒。自动重连中。 + */ + + kConnectionStateReconnecting = 4, + /** + * + * @brief 连接断开后,重连成功。 + */ + + kConnectionStateReconnected = 5, + /** + * + * @brief 处于 `kConnectionStateDisconnected` 状态超过 10 秒,且期间重连未成功。SDK 仍将继续尝试重连。 + */ + + kConnectionStateLost = 6, + /** + * + * @brief 连接失败,服务端状态异常。SDK 不会自动重连,请重新进房,或联系技术支持。 + */ + + kConnectionStateFailed = 7, +}; + +/** + * + * @type keytype + * @brief 媒体流网络质量。 + */ + +enum NetworkQuality { + /** + * + * @brief 网络质量未知。 + */ + + kNetworkQualityUnknown = 0, + /** + * + * @brief 网络质量极好。 + */ + + kNetworkQualityExcellent, + /** + * + * @brief 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。 + */ + + kNetworkQualityGood, + /** + * + * @brief 主观感受有瑕疵但不影响沟通。 + */ + + kNetworkQualityPoor, + /** + * + * @brief 勉强能沟通但不顺畅。 + */ + + kNetworkQualityBad, + /** + * + * @brief 网络质量非常差,基本不能沟通。 + */ + + kNetworkQualityVbad, + /** + * + * @brief 网络连接断开,无法通话。网络可能由于 12s 内无应答、开启飞行模式、拔掉网线等原因断开。
    + * 更多网络状态信息参见 [连接状态提示](https: + */ + + kNetworkQualityDown, +}; + +/** + * + * @type keytype + * @brief SDK 网络连接类型。 + */ + +enum NetworkType { + /** + * + * @brief 网络连接类型未知。 + */ + + kNetworkTypeUnknown = -1, + /** + * + * @brief 网络连接已断开。 + */ + + kNetworkTypeDisconnected = 0, + /** + * + * @brief 网络连接类型为 LAN 。 + */ + + kNetworkTypeLAN = 1, + /** + * + * @brief 网络连接类型为 Wi-Fi(包含热点)。 + */ + + kNetworkTypeWIFI = 2, + /** + * + * @brief 网络连接类型为 2G 移动网络。 + */ + + kNetworkTypeMobile2G = 3, + /** + * + * @brief 网络连接类型为 3G 移动网络。 + */ + + kNetworkTypeMobile3G = 4, + /** + * + * @brief 网络连接类型为 4G 移动网络。 + */ + + kNetworkTypeMobile4G = 5, + /** + * + * @brief 网络连接类型为 5G 移动网络。 + */ + + kNetworkTypeMobile5G = 6, +}; + +/** + * + * @type errorcode + * @brief 回调错误码。 + */ + +enum RtsErrorCode { + /** + * + * @brief Token 无效。
    + * 进房时使用的 Token 无效或过期失效。需要用户重新获取 Token,并调用 `updateToken` 方法更新 Token。 + */ + + kRtsErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + kRtsErrorCodeJoinRoom = -1001, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间 + */ + + kRtsErrorCodeDuplicateLogin = -1004, + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间 + */ + + kRtsErrorCodeKickedOut = -1006, + /** + * + * @brief 当调用 `createRTCRoom` ,如果 roomid 非法,会返回 null,并抛出该 error + */ + + kRtsRoomErrorCodeRoomIdIllegal = -1007, + /** + * + * @brief Token 过期。调用 `joinRoom` 使用新的 Token 重新加入房间。 + */ + + kRtsRoomErrorTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken` 传入的 Token 无效 + */ + + kRtsRoomErrorUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。 + */ + + kRtsErrorCodeRoomDismiss = -1011, + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了 + */ + + kRtsErrorCodeRoomAlreadyExist = -1013, + /** + * + * @brief 同一个引擎实例在进入多个房间时设置的用户名必须相同 + */ + + kRtsErrorCodeUserIDDifferent = -1014, + /** + * + * @brief 服务端异常状态导致退出房间。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + kRtsErrorCodeAbnormalServerStatus = -1084, + /** + * + * @hidden for internal use only + */ + + kRtsErrorCodeInternalDeadLockNotify = -1111, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} 回调。
    + * 进房时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + kRtsErrorCodeJoinRoomWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @brief 加入RTS房间错误。当前为受限模式。 + */ + + kRtsErrorCodeJoinRoomLimitedMode = -1013, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
    + * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅起通知作用。 + */ + +enum RtsWarningCode { + /** + * + * @brief 进房失败。
    + * 当你调用初次加入房间或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + kRtsWarningCodeJoinRoomFailed = -2001, + /** + * + * @brief 发布音视频流失败。
    + * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + kRtsWarningCodePublishStreamFailed = -2002, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误。 + */ + + kRtsWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + kRtsWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + kRtsWarningCodeSendCustomMessage = -2011, + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `onUserJoined` 和 `onUserLeave` 回调,并通过广播提示房间内所有用户。 + */ + + kRtsWarningCodeUserNotifyStop = -2013, + + + /** + * + * @brief 新生成的房间已经替换了同样 roomId 的旧房间 + */ + + kRtsWarningCodeOldRoomBeenReplaced = -2016 +}; + +/** + * + * @hidden + * @deprecated since 3.50 + * @type keytype + * @brief 事务检查码
    + * 用户调用 `setBusinessId` 方法设置业务标识参数的返回错误码。 + */ + +enum BusinessCheckCode { + /** + * + * @brief 用户已经在房间中。
    + * 业务标识需要在加入房间之前设置,加入后设置无效。 + */ + + kBusinessCheckCodeAlreadyInRoom = -6001, + + /** + * + * @brief 输入参数非法。
    + * 用户传入的业务标识参数非法,参数合法性参考 `setBusinessId` 方法的参数说明。 + */ + + kBusinessCheckCodeInputInvalidate = -6002, +}; + +/** + * + * @type keytype + * @brief App 使用的 CPU 和内存信息。
    + * 该信息由 SDK 周期性(2s)通过 `onSysStats` 回调通知给用户。 + */ + +struct SysStats { + /** + * + * @brief 当前系统 CPU 核数。 + */ + + unsigned int cpu_cores; + /** + * + * @brief 当前应用的 CPU 使用率,取值范围为 [0, 1]。 + */ + + double cpu_app_usage; + /** + * + * @hidden currently not available + * @brief 当前系统的 cpu 使用率,取值范围为 [0, 1]。 + */ + + double cpu_total_usage; + /** + * + * @brief 当前应用的内存使用量(单位 MB)。 + */ + + double memory_usage; + /** + * + * @brief 全量内存(单位 MB)。 + */ + + unsigned long long full_memory; + /** + * + * @brief 系统已使用内存(单位 MB)。 + */ + + unsigned long long total_memory_usage; + /** + * + * @brief 空闲可分配内存(单位 MB)。 + */ + + unsigned long long free_memory; + /** + * + * @brief 当前应用的内存使用率(单位 %)。 + */ + + double memory_ratio; + /** + * + * @brief 系统内存使用率(单位 %)。 + */ + + double total_memory_ratio; +}; + +/** + * + * @type keytype + * @brief HTTP/HTTPS 代理状态 + */ + +enum HttpProxyState { + /** + * + * @brief HTTP/HTTPS 初始化状态 + */ + + kHttpProxyStateInit, + /** + * + * @brief HTTP/HTTPS 连接成功 + */ + + kHttpProxyStateConnected, + /** + * + * @brief HTTP/HTTPS 连接失败 + */ + + kHttpProxyStateError +}; + +/** + * + * @type keytype + * @brief SOCKS5 代理连接状态 + */ + +enum Socks5ProxyState { + /** + * + * @brief SOCKS5 连接初始化 + */ + + kSocks5Init, + /** + * + * @brief SOCKS5 连接成功 + */ + + kSocks5Connected, + /** + * + * @brief SOCKS5 连接错误 + */ + + kSocks5Error, + /** + * + * @brief TCP 连接失败 + */ + + kSocks5TcpConnectFail, + /** + * + * @brief TCP 连接关闭 + */ + + kSocks5TcpClose, + /** + * + * @brief SOCKS 协议 TCP 协商阶段失败 + */ + + kSocks5ProtocolTcpFail, + /** + * + * @brief UDP 连接失败 + */ + + kSocks5ProtocolUdpFail, + /** + * + * @brief 授权失败 + */ + + kSocks5AuthFail, + /** + * + * @brief 未知状态 + */ + + kSocks5Unknown +}; + +/** + * + * @type keytype + * @brief 云代理信息 + */ + +struct CloudProxyInfo { + /** + * + * @type keytype + * @brief 云代理服务器 IP + */ + + const char* cloud_proxy_ip; + /** + * + * @type keytype + * @brief 云代理服务器端口 + */ + + int cloud_proxy_port; +}; + +/** + * + * @type keytype + * @brief 云代理相关信息 + */ + +struct CloudProxyConfiguration { + /** + * + * @brief 云代理信息。 + */ + + CloudProxyInfo* cloud_proxies = nullptr; + /** + * + * @brief 云代理数量。 + */ + + int cloud_proxy_count = 0; +}; + +/** + * + * @type keytype + * @brief ID 最大长度 + */ + +const unsigned int MAX_DEVICE_ID_LENGTH = 512; + +/** + * + * @type keytype + * @brief 本地代理的类型。 + */ + +enum LocalProxyType { + /** + * + * @brief Socks5 代理。选用此代理服务器,需满足 Socks5 协议标准文档的要求。 + */ + + kLocalProxyTypeSocks5 = 1, + /** + * + * @brief Http 隧道代理。 + */ + + kLocalProxyTypeHttpTunnel = 2 +}; + +/** + * + * @type keytype + * @brief 本地代理配置详细信息。 + */ + +struct LocalProxyConfiguration { + /** + * + * @brief 本地代理类型,参看 LocalProxyType{@link #LocalProxyType}。 + */ + + LocalProxyType local_proxy_type; + /** + * + * @type keytype + * @brief 本地代理服务器 IP。 + */ + + const char* local_proxy_ip; + /** + * + * @type keytype + * @brief 本地代理服务器端口。 + */ + + int local_proxy_port; + /** + * + * @type keytype + * @brief 本地代理用户名。 + */ + + const char* local_proxy_username; + /** + * + * @type keytype + * @brief 本地代理密码。 + */ + + const char* local_proxy_password; +}; + +/** + * + * @type keytype + * @brief 本地代理连接状态。 + */ + +enum LocalProxyState { + /** + * + * @brief TCP 代理服务器连接成功。 + */ + + kLocalProxyStateInited = 0, + + /** + * + * @brief 本地代理连接成功。 + */ + + kLocalProxyStateConnected = 1, + + /** + * + * @brief 本地代理连接出现错误。 + */ + + kLocalProxyStateError = 2, +}; + +/** + * + * @type keytype + * @brief 本地代理错误。 + */ + +enum LocalProxyError { + /** + * + * @brief 本地代理服务器无错误。 + */ + + kLocalProxyErrorOK = 0, + + /** + * + * @brief 代理服务器回复的版本号不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5VersionError = 1, + + /** + * + * @brief 代理服务器回复的格式错误不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5FormatError = 2, + + /** + * + * @brief 代理服务器回复的字段值不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5InvalidValue = 3, + + /** + * + * @brief 未提供代理服务器的用户名及密码,导致 Socks5 代理连接失败。请重新调用 `setLocalProxy`,在设置本地代理时填入用户名和密码。 + */ + + kLocalProxyErrorSocks5UserPassNotGiven = 4, + + /** + * + * @brief TCP 关闭,导致 Socks5 代理连接失败。请检查网络或者代理服务器是否存在异常。 + */ + + kLocalProxyErrorSocks5TcpClosed = 5, + + /** + * + * @brief Http 隧道代理错误。请检查 Http 隧道代理服务器或者网络是否存在异常。 + */ + + kLocalProxyErrorHttpTunnelFailed = 6, +}; + +/** + * + * @type keytype + * @brief 本地日志输出等级。 + */ + +enum class LocalLogLevel { + /** + * + * @brief 信息级别。 + */ + + kInfo = 0, + /** + * + * @brief (默认值)警告级别。 + */ + + kWarning = 1, + /** + * + * @brief 错误级别。 + */ + + kError = 2, + /** + * + * @brief 关闭日志。 + */ + + kNone = 3 +}; + +/** + * + * @type keytype + * @brief 本地日志参数。 + */ + +struct LogConfig { + /** + * + * @brief 日志存储路径,必填。 + */ + + const char* log_path = nullptr; + /** + * + * @brief 日志等级,参看 LocalLogLevel{@link #LocalLogLevel},默认为警告级别,选填。 + */ + + LocalLogLevel log_level = LocalLogLevel::kWarning; + + /** + * + * @brief 日志文件最大占用的总空间,单位为 MB,选填。取值范围为 1~100 MB,默认值为 10 MB。
    + * 若 `log_file_size` < 1,取 1 MB。若 `log_file_size` > 100,取 100 MB。
    + * 其中,单个日志文件最大为 2 MB:
    + *
    • 若 1 ≤ log_file_size ≤ 2,则会生成一个日志文件。
    • 若 log_file_size > 2,假设 log_file_size/2 的整数部分为 N,则前 N 个文件,每个文件会写满 2 MB,第 N+1 个文件大小不超过 log_file_size mod 2,否则会删除最老的文件,以此类推。
    + */ + + uint32_t log_file_size = 10; + + /** + * + * @brief 日志文件名前缀,选填。该字符串必须符合正则表达式:[a-zA-Z0-9_@\-\.]{1,128}。
    + * 最终的日志文件名为`前缀 + "_" + 文件创建时间 + "_rtclog".log`,如 `logPrefix_2023-05-25_172324_rtclog.log`。 + */ + + const char* log_filename_prefix = nullptr; +}; + +/** + * + * @type keytype + * @brief 创建引擎参数 + */ + +struct EngineConfig { + /** + * + * @brief 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 + */ + + const char* app_id = nullptr; + + /** + * + * @brief 如需使用请联系技术支持人员。 + */ + + const char* parameters = nullptr; + + /** + * + * @brief 自定义插件动态库加载目录,目前仅 Android 平台支持。 + */ + + const char* native_load_path = nullptr; + + /** + * + * @brief 用于存储 Android 应用程序的上下文(Application Context),仅 Android 平台支持。 + */ + + void* j_application_context = nullptr; + /** + * + * @brief 选填,是否为游戏场景。默认值为 `false`。 + */ + + bool is_game_scene = false; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_sing_scoring_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_sing_scoring_interface.h new file mode 100644 index 0000000..56fb9ad --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_sing_scoring_interface.h @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC SAMI SDK +*/ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @type callback + * @brief K 歌评分事件回调类。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +class ISingScoringEventHandler { +public: + /** + * + * @type callback + * @brief 实时评分信息回调。调用 startSingScoring{@link #ISingScoringManager#startSingScoring} 后,会收到该回调。 + * @param info 实时评分信息。 + * @list 在线 KTV + */ + + virtual void onCurrentScoringInfo( + const SingScoringRealtimeInfo& info) = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~ISingScoringEventHandler() { + } +}; +/** + * + * @hidden(Linux) + * @type api + * @brief 标准音高数据数组。 + * @list Online Karaoke + */ + +class IStandardPitchCollection { +public: + /** + * + * @type api + * @brief 获取歌词句子总数 + * @list 在线 KTV + */ + + virtual int getCount() = 0; + /** + * + * @type api + * @brief 获取每句歌词的标准音高信息 + * @param index 歌词句子数,取值范围为 0 到调用 getCount{@link #IStandardPitchCollection#getCount} 获取到的句子总数减 1。 + * @return 标准音高数据,参看 StandardPitchInfo{@link #StandardPitchInfo}。 + * @list 在线 KTV + */ + + virtual StandardPitchInfo getStandardPitchInfo(int index) = 0; + /** + * + * @type api + * @brief 销毁 IStandardPitchCollection 类,释放资源 + * @list 在线 KTV + */ + + virtual void release() = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IStandardPitchCollection() { + } +}; +/** + * + * @hidden(Linux) + * @type api + * @brief K 歌评分管理接口。 + * @list Online Karaoke + */ + +class ISingScoringManager { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + ISingScoringManager() { + } + /** + * + * @type api + * @brief 初始化 K 歌评分。 + * @param sing_scoring_appkey K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param sing_scoring_token K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param handler K 歌评分事件回调类,详见 ISingScoringEventHandler{@link #ISingScoringEventHandler}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note 输入正确的鉴权信息才可以使用 K 歌评分相关的功能,鉴权方式为离线鉴权,根据包名(bundleID)绑定 Appkey 及 Token,K 歌评分密钥请联系技术支持人员申请。 + * @list 在线 KTV + */ + + virtual int initSingScoring( + const char* sing_scoring_appkey, + const char* sing_scoring_token, + ISingScoringEventHandler* handler) = 0; + /** + * + * @type api + * @brief 设置 K 歌评分参数。 + * @param config K 歌评分的各项参数,详见 SingScoringConfig{@link #SingScoringConfig}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @list 在线 KTV + */ + + virtual int setSingScoringConfig( + const SingScoringConfig& config) = 0; + /** + * + * @type api + * @brief 获取标准音高数据。 + * @param midi_filepath 歌曲 midi 文件路径。 + * @return IStandardPitchCollection{@link #IStandardPitchCollection} 标准音高数据数组。 + * @note 请保证此接口传入的 midi 文件路径与 setSingScoringConfig{@link #ISingScoringManager#setSingScoringConfig} 接口中传入的路径一致。 + * @list 在线 KTV + */ + + virtual IStandardPitchCollection* getStandardPitchInfoCollection(const char* midi_filepath) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 开始 K 歌评分。 + * @param position 开始评分时,音乐的播放进度,单位:ms。 + * @param scoring_info_interval 实时回调的时间间隔,单位:ms;默认 50 ms。最低间隔为 20 ms。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note + * - 在调用 initSingScoring{@link #ISingScoringManager#initSingScoring} 初始化 K 歌评分功能后调用该接口。 + * - 调用该接口后,将会根据设置的回调时间间隔,收到评分结果 onCurrentScoringInfo{@link #ISingScoringEventHandler#onCurrentScoringInfo} 回调。 + * - 如果使用 `IMediaPlayer` 播放伴奏,请在收到 onMediaPlayerStateChanged{@link #IMediaPlayerEventHandler#onMediaPlayerStateChanged} 回调且播放状态为 kPlayerStatePlaying{@link #PlayerState#kPlayerStatePlaying} 后,调用此接口。 + * @list 在线 KTV + */ + + virtual int startSingScoring(int position, + int scoring_info_interval) = 0; + /** + * + * @type api + * @brief 停止 K 歌评分。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 在线 KTV + */ + + virtual int stopSingScoring() = 0; + /** + * + * @type api + * @brief 获取上一句的演唱评分。调用 startSingScoring{@link #ISingScoringManager#startSingScoring} 开始评分后可以调用该接口。 + * @return + * - <0:获取评分失败。 + * - >=0:上一句歌词的演唱评分。 + * @list 在线 KTV + */ + + virtual int getLastSentenceScore() = 0; + /** + * + * @type api + * @brief 获取当前演唱总分。调用 startSingScoring{@link #ISingScoringManager#startSingScoring} 开始评分后可以调用该接口。 + * @return + * - <0:获取总分失败。 + * - >=0:当前演唱总分。 + * @list 在线 KTV + */ + + virtual int getTotalScore() = 0; + /** + * + * @type api + * @brief 获取当前演唱歌曲的平均分。 + * @return + * - <0:获取平均分失败。 + * - >=0:当前演唱平均分。 + * @list 在线 KTV + */ + + virtual int getAverageScore() = 0; + /** + * + * @hidden constructor/destructor + */ + + virtual ~ISingScoringManager() { + } +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_spatial_audio_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_spatial_audio_interface.h new file mode 100644 index 0000000..12c9565 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_spatial_audio_interface.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief spatial audio interface + */ + +#pragma once + +#include "bytertc_audio_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 用户在空间音频坐标系里的位置信息。 + */ + +struct PositionInfo { + /** + * + * @brief 用户在空间音频坐标系里的位置,需自行建立空间直角坐标系。参看 Position{@link #Position} + */ + + Position position; + /** + * + * @brief 用户在空间音频坐标系里的三维朝向信息。三个向量需要两两垂直。参看 HumanOrientation{@link #HumanOrientation}。 + */ + + HumanOrientation orientation; +}; +/** + * + * @hidden(Linux) + * @type api + * @brief 空间音频接口实例 + * @list + */ + +class ISpatialAudio { +public: + /** + * + * @type api + * @brief 开启/关闭空间音频功能。 + * @param enable 是否开启空间音频功能:
    + * - true:开启 + * - false:关闭(默认) + * @note 该方法仅开启空间音频功能,你须调用 updateSelfPosition{@link #ISpatialAudio#updateSelfPosition} 设置自身位置坐标后方可收听空间音频效果。空间音频相关 API 和调用时序详见[空间音频](https.www.volcengine.com/docs/6348/93903)。 + * @list 高级功能 + */ + + virtual void enableSpatialAudio(bool enable) = 0; + /** + * + * @type api + * @brief 关闭本地用户朝向对本地用户发声效果的影响。
    + * 调用此接口后,房间内的其他用户收听本地发声时,声源都在收听者正面。 + * @note + * - 调用本接口关闭朝向功能后,在当前的空间音频实例的生命周期内无法再次开启。 + * - 调用此接口不影响本地用户收听朝向的音频效果。要改变本地用户收听朝向,参看 updateSelfPosition{@link #ISpatialAudio#updateSelfPosition} 和 updateRemotePosition{@link #ISpatialAudio#updateRemotePosition} 。 + * @list 高级功能 + */ + + virtual void disableRemoteOrientation() = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 设置本地用户在自建空间直角坐标系中的收听坐标和收听朝向,以实现本地用户预期的空间音频收听效果。 + * @param position_info 空间音频位置信息。参看 PositionInfo{@link #PositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验本地用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * - 该方法需在进房后调用。 + * - 调用该接口更新坐标前,你需调用 enableSpatialAudio{@link #ISpatialAudio#enableSpatialAudio} 开启空间音频功能。空间音频相关 API 和调用时序详见[空间音频](https: + * - 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 高级功能 + */ + + virtual int updateSelfPosition(const PositionInfo& position_info) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 设置房间内某一远端用户在本地用户自建的空间音频坐标系中的发声位置和发声朝向,以实现本地用户预期的空间音频收听效果。 + * @param uid 用户 ID + * @param position_info 远端用户的空间音频位置信息。参看 PositionInfo{@link #PositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验远端用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * - 该方法需在创建房间后调用。 + * - 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 高级功能 + */ + + virtual int updateRemotePosition(const char* uid, const PositionInfo& position_info) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition{@link #ISpatialAudio#updateRemotePosition} 为某一远端用户设置的空间音频效果。 + * @param uid 远端用户 ID。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + + virtual int removeRemotePosition(const char* uid) = 0; + /** + * + * @hidden(Linux) + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition{@link #ISpatialAudio#updateRemotePosition} 为所有远端用户设置的空间音频效果。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + + virtual int removeAllRemotePosition() = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~ISpatialAudio() = default; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_transcoder_define.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_transcoder_define.h new file mode 100644 index 0000000..2db9b29 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_transcoder_define.h @@ -0,0 +1,1990 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + */ + +#pragma once +#include "bytertc_video_frame.h" +#include "bytertc_audio_frame.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 转推任务事件 + */ + +enum MixedStreamTaskEvent { + /** + * + * @hidden for internal use only + */ + + kMixedStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + kMixedStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + kMixedStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务更新成功。 + */ + + kMixedStreamTaskEventUpdateSuccess = 3, + /** + * + * @brief 任务更新失败。 + */ + + kMixedStreamTaskEventUpdateFailed = 4, + /** + * + * @brief 任务停止。 + */ + + kMixedStreamTaskEventStopSuccess = 5, + /** + * + * @brief 结束任务失败。 + */ + + kMixedStreamTaskEventStopFailed = 6, + /** + * + * @brief Warning 事件 + */ + + kMixedStreamTaskEventWarning = 7, +}; + + +/** + * + * @type errorcode + * @brief 单流转推直播事件 + */ + +enum SingleStreamTaskEvent { + /** + * + * @hidden for internal use only + */ + + kSingleStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + kSingleStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + kSingleStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务停止。 + */ + + kSingleStreamTaskEventStopSuccess = 3, + /** + * + * @brief 结束任务失败。 + */ + + kSingleStreamTaskEventStopFailed = 4, + /** + * + * @brief Warning 事件 + */ + + kSingleStreamTaskEventWarning = 5, +}; + +/** + * + * @type errorcode + * @brief 合流和 WTN 流任务错误码 + */ + +enum MixedStreamTaskErrorCode { + /** + * + * @brief 推流成功。 + */ + + kMixedStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + kMixedStreamTaskErrorCodeBase= 1090, + /** + * + * @brief 任务处理超时,请检查网络状态并重试。 + */ + + kMixedStreamTaskErrorCodeTimeout = 1091, + /** + * + * @brief 服务端检测到错误的推流参数。 + */ + + kMixedStreamTaskErrorCodeInvalidParamByServer = 1092, + /** + * + * @brief 对流的订阅超时 + */ + + kMixedStreamTaskErrorCodeSubTimeoutByServer = 1093, + /** + * + * @brief 合流服务端内部错误。 + */ + + kMixedStreamTaskErrorCodeInvalidStateByServer = 1094, + /** + * + * @brief 合流服务端推 CDN 失败。 + */ + + kMixedStreamTaskErrorCodeAuthenticationByCDN = 1095, + /** + * + * @brief 服务端未知错误。 + */ + + kMixedStreamTaskErrorCodeUnKnownByServer = 1096, + /** + * + * @brief 服务端接收信令超时,请检查网络状态并重试。 + */ + + kMixedStreamTaskErrorCodeSignalRequestTimeout = 1097, + /** + * + * @brief 图片合流失败。 + */ + + kMixedStreamTaskErrorCodeMixImageFailed = 1098, + /** + * + * @hidden internal use only + * @brief 缓存未同步。 + */ + + kMixedStreamTaskErrorCodeStreamSyncWorse = 1099, + /** + * + * @brief 发布 WTN 流失败 + */ + + kMixedStreamTaskErrorCodePushWTNFailed = 1195, + /** + * + * @hidden for internal use only + */ + + kMixedStreamTaskErrorCodeMax = 1199, +}; + +/** + * + * @type errorcode + * @brief 单流转推任务错误码 + */ + +enum SingleStreamTaskErrorCode { + /** + * + * @brief 推流成功。 + */ + + kSingleStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + kSingleStreamTaskErrorCodeBase= 1090, + /** + * + * @brief 服务端未知错误。 + */ + + kSingleStreamTaskErrorCodeUnKnownByServer = 1091, + /** + * + * @brief 任务处理超时,请检查网络状态并重试。 + */ + + kSingleStreamTaskErrorCodeSignalRequestTimeout = 1092, + /** + * + * @brief 服务端检测任务参数不合法 + */ + + kSingleStreamTaskErrorCodeInvalidParamByServer = 1093, + /** + * + * @brief 转推任务在目标房间的用户ID被踢出目标房间 + */ + + kSingleStreamTaskErrorRemoteKicked = 1094, + /** + * + * @brief 转推任务加入目标房间失败 + */ + + kSingleStreamTaskErrorCodeJoinDestRoomFailed = 1095, + /** + * + * @brief 转推任务在源房间拉流超时 + */ + + kSingleStreamTaskErrorCodeReceiveSrcStreamTimeout = 1096, + /** + * + * @brief 音视频编码转推任务不支持 + */ + + kSingleStreamTaskErrorCodeNotSurportCodec = 1097, + /** + * + * @brief 推CDN失败 + */ + + kSingleStreamTaskErrorCodePushToCDN = 1098, + /** + * + * @brief 超过单流转推的任务数限制(单主播可同时转推任务数不超过20) + */ + + kSingleStreamTaskErrorCodeCountOverLimit = 1099, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 合流类型。 + */ + +enum MixedStreamType { + /** + * + * @brief 服务端合流 + */ + + kMixedStreamTypeByServer = 0, + /** + * + * @brief 端云一体合流。SDK 智能决策在客户端或服务端完成合流。
    + * 使用前,请联系技术支持同学开通,否则不生效。 + */ + + kMixedStreamTypeByClient = 1, +}; + +/** + * + * @type keytype + * @brief 合流推送目标类型,指定混流后的媒体流推送到 CDN 还是 WTN。 + */ + +enum MixedStreamPushTargetType { + /** + * + * @brief 推送到 CDN + */ + + kMixedStreamPushTargetTypeToCDN = 0, + /** + * + * @brief 推送到 WTN + */ + + kMixedStreamPushTargetTypeToWTN = 1, +}; + +/** + * + * @type keytype + * @brief AAC 编码规格。 + */ + +enum MixedStreamAudioProfile { + /** + * + * @brief AAC-LC 规格,默认值。 + */ + + kMixedStreamAudioProfileLC = 0, + /** + * + * @brief HE-AAC v1 规格。 + */ + + kMixedStreamAudioProfileHEv1 = 1, + /** + * + * @brief HE-AAC v2 规格。 + */ + + kMixedStreamAudioProfileHEv2 = 2, +}; + +/** + * + * @hidden + * @brief 遗漏的音符 + */ + +enum MixedStreamSyncStrategy { + /** + * + * @brief 不使用同步策略 + */ + + kMixedStreamSyncStrategyNoSync = 0, + /** + * + * @brief 使用音频精准同步策略 + */ + + kMixedStreamSyncStrategyAudioPreciseSync = 1, + /** + * + * @brief 使用单通模式同步策略 + */ + + kMixedStreamSyncStrategySimplexModeSync = 2, +}; + +/** + * + * @type keytype + * @brief 音频编码格式。 + */ + +enum MixedStreamAudioCodecType { + /** + * + * @brief AAC 格式。 + */ + + kMixedStreamAudioCodecTypeAAC = 0, +}; + +/** + * + * @type keytype + * @brief 服务端合流转推 SEI 内容。 + */ + +enum MixedStreamSEIContentMode { + /** + * + * @brief 视频流中包含全部的 SEI 信息。默认设置。 + */ + + kMixedStreamSEIContentModeDefault = 0, + /** + * + * @brief 随非关键帧传输的 SEI 数据中仅包含音量信息。
    + * 当设置 `MixedStreamControlConfig.enable_volume_indication` 为 True 时,此参数设置生效。 + */ + + kMixedStreamSEIContentModeEnableVolumeIndication = 1, +}; + +/** + * + * @type keytype + * @brief 视频编码格式。 + */ + +enum MixedStreamVideoCodecType { + /** + * + * @brief H.264 格式,默认值。 + */ + + kMixedStreamVideoCodecTypeH264 = 0, + /** + * + * @brief ByteVC1 格式。 + */ + + kMixedStreamVideoCodecTypeByteVC1 = 1, +}; + +/** + * + * @type keytype + * @brief 图片或视频流的缩放模式。 + */ + +enum MixedStreamRenderMode { + /** + * + * @brief 视窗填满优先,默认值。
    + * 视频尺寸等比缩放,直至视窗被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。 + */ + + kMixedStreamRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 + */ + + kMixedStreamRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
    + * 视频尺寸非等比例缩放,把窗口充满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + kMixedStreamRenderModeAdaptive = 3, +}; + +/** + * + * @type keytype + * @brief 合流输出媒体类型。 + */ + +enum MixedStreamMediaType { + /** + * + * @brief 包含音频和视频 + */ + + kMixedStreamMediaTypeAudioAndVideo = 0, + /** + * + * @brief 只包含音频 + */ + + kMixedStreamMediaTypeAudioOnly = 1, + /** + * + * @hidden currently not available + * @brief 只包含视频 + */ + + kMixedStreamMediaTypeVideoOnly = 2, +}; + +/** + * + * @type keytype + * @brief 合流布局区域类型,视频区或水印图片区。 + */ + +enum MixedStreamLayoutRegionType { + /** + * + * @brief 视频。 + */ + + kMixedStreamLayoutRegionTypeVideoStream = 0, + /** + * + * @brief 水印图片。 + */ + + kMixedStreamLayoutRegionTypeImage = 1, +}; + +/** + * + * @type keytype + * @hidden for internal use only on Windows + * @brief 客户端合流回调视频格式。
    + * 设置为系统不支持的格式时,自动回调系统默认格式。 + */ + +enum MixedStreamClientMixVideoFormat { + /** + * + * @brief YUV I420。Android、Windows 默认回调格式。支持系统:Android、Windows。 + */ + + kMixedStreamClientMixVideoFormatI420 = 0, + /** + * + * @brief OpenGL GL_TEXTURE_2D 格式纹理。支持系统:安卓。 + */ + + kMixedStreamClientMixVideoFormatTexture2D = 1, + /** + * + * @brief CVPixelBuffer BGRA。iOS 默认回调格式。支持系统: iOS。 + */ + + kMixedStreamClientMixVideoFormatCVPixelBufferBGRA = 2, + /** + * + * @brief YUV NV12。macOS 默认回调格式。支持系统: macOS。 + */ + + kMixedStreamClientMixVideoFormatNV12 = 3, + /** + * + * @brief D3D11Texture2D, BGRA。支持系统: windows。 + */ + + kMixedStreamClientMixVideoFormatD3D11Texture2D = 4, +}; +/** + * + * @type keytype + * @brief 服务端合流转推发起模式。 + */ + +enum MixedStreamPushMode { + /** + * + * @brief 无用户发布媒体流时,发起合流任务无效。默认设置。
    + * 当有用户发布媒体流时,才能发起合流任务。 + */ + + kMixedStreamPushModeOnStream = 0, + /** + * + * @brief 无用户发布媒体流时,可以使用占位图发起合流任务。
    + * 占位图设置参看 alternate_image_url{@link #MixedStreamLayoutRegionConfig-alternate_image_url} 和 alternate_image_fill_mode{@link #MixedStreamLayoutRegionConfig-alternate_image_fill_mode} + */ + + kMixedStreamPushModeOnStartRequest = 1, +}; +/** + * + * @type keytype + * @brief 服务端合流占位图填充模式。 + */ + +enum MixedStreamAlternateImageFillMode { + /** + * + * @brief 占位图跟随用户原始视频帧相同的比例缩放。默认设置。 + */ + + kMixedStreamAlternateImageFillModeFit = 0, + /** + * + * @brief 占位图不跟随用户原始视频帧相同的比例缩放,保持图片原有比例。 + */ + + kMixedStreamAlternateImageFillModeFill = 1, +}; +/** + * + * @type keytype + * @brief 预留字段。 + */ + +enum MixedStreamVideoType { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
    + * - 由摄像头/麦克风通过内部采集机制,采集到的流 + * - 通过自定义采集,采集到的流。 + */ + + kMixedStreamVideoTypeMain = 0, + /** + * + * @hidden for internal use only + * @brief 屏幕流。 + */ + + kMixedStreamVideoTypeScreen = 1, +}; + +/** + * + * @type keytype + * @brief WTN 流任务详情
    + * + */ + +typedef struct MixedStreamTaskInfo { + /** + * + * @brief 任务 ID
    + * 对于 WTN 流任务,该值代表 WTN 流 ID。你可以通过该 ID,指定需要订阅的 WTN 流。 + */ + + const char* task_id; + /** + * + * @brief 任务类型,合流转推 CDN 还是 WTN 流。 + */ + + MixedStreamPushTargetType push_target_type; +} MixedStreamInfo; + +/** + * + * @type keytype + * @brief 音频合流参数。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +typedef struct MixedStreamAudioConfig { + /** + * + * @brief 音频采样率,单位 Hz。可取 32000 Hz、44100 Hz、48000 Hz,默认值为 48000 Hz。建议设置。 + */ + + int32_t sample_rate = 48000; + /** + * + * @brief 音频声道数。可取 1(单声道)、2(双声道),默认值为 2。建议设置。 + */ + + int32_t channels = 2; + /** + * + * @brief 音频码率,单位 Kbps。可取范围 [32, 192],默认值为 64 Kbps。建议设置。 + */ + + int32_t bitrate = 64; + /** + * + * @brief AAC 编码规格,参看 MixedStreamAudioProfile{@link #MixedStreamAudioProfile}。默认值为 `0` 代表 AAC-LC。 + */ + + MixedStreamAudioProfile audio_profile = MixedStreamAudioProfile::kMixedStreamAudioProfileLC; + /** + * + * @brief 音频编码格式,参看 MixedStreamAudioCodecType{@link #MixedStreamAudioCodecType}。当前只有一个值为 `0`,代表 AAC。
    + * WTN 流任务不支持设置本参数。 + */ + + MixedStreamAudioCodecType audio_codec = MixedStreamAudioCodecType::kMixedStreamAudioCodecTypeAAC; +} MixedStreamAudioConfig; + +#define MIXED_STREAM_VIDEO_DEFAULT_WIDTH 360 +#define MIXED_STREAM_DEFAULT_VIDEO_HEIGHT 640 +/** + * + * @type keytype + * @brief 视频合流配置参数。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +typedef struct MixedStreamVideoConfig { + /** + * + * @brief 合流视频宽度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 360 px。建议设置。
    + * 设置值为非偶数时,自动向上取偶数。 + */ + + int32_t width = MIXED_STREAM_VIDEO_DEFAULT_WIDTH; + /** + * + * @brief 合流视频高度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 640 px。建议设置。
    + * 设置值为非偶数时,自动向上取偶数。 + */ + + int32_t height = MIXED_STREAM_DEFAULT_VIDEO_HEIGHT; + /** + * + * @brief 合流视频帧率。单位为 FPS,取值范围为 [1,60],默认值为 15 FPS。建议设置。 + */ + + int32_t fps = 15; + /** + * + * @brief 视频 I 帧时间间隔。单位为秒,取值范围为 [1, 5],默认值为 2 秒。建议设置。
    + * WTN 流任务不支持设置本参数。
    + * 本参数不支持过程中更新。 + */ + + int32_t gop = 2; + /** + * + * @brief 合流视频码率。单位为 Kbps,取值范围为 [1,10000],默认值为 `500`。建议设置。 + */ + + int32_t bitrate = 500; + /** + * + * @brief 视频编码格式,参看 MixedStreamVideoCodecType{@link #MixedStreamVideoCodecType}。默认值为 `0`。建议设置。
    + * WTN 流的视频编码格式只能为设置为 `0`,H264。
    + * 本参数不支持过程中更新。 + */ + + MixedStreamVideoCodecType video_codec = MixedStreamVideoCodecType::kMixedStreamVideoCodecTypeH264; + /** + * + * @brief 是否在服务端合流转推中开启 B 帧。
    + * - true: 是 + * - false: 否 + */ + + bool enable_bframe = false; +} MixedStreamVideoConfig; + +/** + * + * @hidden for internal use only on Windows + * @type keytype + * @brief 客户端合流参数。 + */ + +typedef struct ClientMixedStreamConfig { + /** + * + * @brief 客户端合流是否使用混音,默认为 true。 + */ + + bool use_audio_mixer = true; + /** + * + * @brief 客户端合流回调视频格式,参看 MixedStreamClientMixVideoFormat{@link #MixedStreamClientMixVideoFormat}。 + */ + + MixedStreamClientMixVideoFormat video_format; +} ClientMixedStreamConfig; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 转推直播单通同步参数。 + */ + +typedef struct MixedStreamSyncControlConfig { + /** + * + * @brief 在进行同步处理时,缓存音视频流的最大长度。单位为毫秒。默认值为 2000。 + * @note 参与转推直播的这些媒体流延迟越高,应该将此值设置的越大。但此值越大,因缓存媒体流造成的内存占用也会更大。推荐值为 `2000`。 + */ + + int32_t max_cache_time_ms = 2000; + /** + * + * @brief 是否在转推直播时,启用单通模式。默认为 false,不启用。
    + * 启用单通模式时,RTC SDK 会对指定的多个用户的媒体流进行同步处理,再合流后推送到 CDN,但基准流所属用户不会播放来自其他用户的媒体流。你需要设定以下参数。
    + * 非单通模式时,RTC SDK 不会对媒体流进行同步处理,只是简单合流后推送到 CDN。以下参数设定无效。 + */ + + MixedStreamSyncStrategy sync_strategy = MixedStreamSyncStrategy::kMixedStreamSyncStrategyNoSync; + /** + * + * @brief 在进行同步处理时,基准流所属用户的 ID。默认为空。 + */ + + const char* base_user_id = nullptr; + /** + * + * @brief 是否通过 RTC SDK 进行转推直播。默认为 True。
    + * 如果选择 `False`,你会通过 onCacheSyncVideoFrames{@link #IClientMixedStreamObserver#onCacheSyncVideoFrames} 收到同步的帧,你可以使用此视频帧,自行实现合流转推。 + */ + + bool video_need_sdk_mix = true; +} MixedStreamSyncControlConfig; + +/** + * + * @type keytype + * @brief 图片合流水印图片分辨率。 + */ + +typedef struct MixedStreamLayoutRegionImageWaterMarkConfig { + /** + * + * @brief 原始图片的宽度,单位为 px。 + */ + + int image_width = 0; + /** + * + * @brief 原始图片的高度,单位为 px。 + */ + + int image_height = 0; +} MixedStreamLayoutRegionImageWaterMarkConfig; + +/** + * + * @type keytype + * @brief 推流 CDN 的空间音频参数。 + */ + +typedef struct MixedStreamSpatialAudioConfig { + /** + * + * @brief 是否开启推流 CDN 时的空间音频效果。 + * @note 当你启用此效果时,你需要设定推流中各个 MixedStreamLayoutRegionConfig{@link #MixedStreamLayoutRegionConfig} 的 `spatial_position` 值,实现空间音频效果。 + */ + + bool enable_spatial_render; + /** + * + * @brief 听众的空间位置。参看 Position{@link #Position}。
    + * 听众指收听来自 CDN 的音频流的用户。
    + * WTN 流任务不支持设置本参数。 + */ + + Position audience_spatial_position; + /** + * + * @brief 听众的空间朝向。参看 HumanOrientation{@link #HumanOrientation}。
    + * 听众指收听来自 CDN 的音频流的用户。 + */ + + HumanOrientation audience_spatial_orientation; +} MixedStreamSpatialAudioConfig; + +/** + * + * @type keytype + * @brief 服务端合流控制参数 + */ + +typedef struct MixedStreamControlConfig { + /** + * + * @valid since 3.56 + * @brief 是否开启单独发送声音提示 SEI 的功能:
    + * - true:开启; + * - false:(默认)关闭。 + * 开启后,你可以通过 `MixedStreamControlConfig.sei_content_mode` 控制 SEI 的内容是否只携带声音信息。 + */ + + bool enable_volume_indication = false; + /** + * + * @valid since 3.56 + * @brief 声音提示间隔,单位为秒,取值范围为 [0.3,+∞),默认值为 2。
    + * 此值仅取整百毫秒。若传入两位及以上小数,则四舍五入取第一位小数的值。例如,若传入 0.36,则取 0.4。 + */ + + float volume_indication_interval = 2.0f; + /** + * + * @valid since 3.56 + * @brief 有效音量大小,取值范围为 [0, 255],默认值为 0。
    + * 超出取值范围则自动调整为默认值,即 0。 + */ + + int talk_volume = 0; + /** + * + * @valid since 3.56 + * @brief 声音信息 SEI 是否包含音量值:
    + * - true:是。 + * - false:(默认)否。 + */ + + bool is_add_volume_value = false; + /** + * + * @valid since 3.56 + * @brief 设置 SEI 内容。参看 MixedStreamSEIContentMode{@link #MixedStreamSEIContentMode}。
    + * 默认值为 `0`,视频流中包含全部的 SEI 信息 + */ + + MixedStreamSEIContentMode sei_content_mode = kMixedStreamSEIContentModeDefault; + /** + * + * @valid since 3.56 + * @brief SEI 信息的 payload type。
    + * 默认值为 `100`,只支持设置 `5` 和 `100`。
    + * 在转推直播的过程中,该参数不支持变更。 + */ + + int sei_payload_type = 100; + /** + * + * @valid since 3.56 + * @brief SEI 信息的 payload UUID。 + * @note PayloadType 为 `5` 时,必须填写 PayloadUUID,否则会收到错误回调,错误码为 1091。
    + * PayloadType 不是 `5` 时,不需要填写 PayloadUUID,如果填写会被后端忽略。
    + * 该参数长度需为 32 位,否则会收到错误码为 1091 的回调。
    + * 该参数每个字符的范围需为 [0, 9] [a, f] [A, F]
    + * 该参数不应带有`-`字符,如系统自动生成的 UUID 中带有`-`,则应删去。
    + * 在转推直播的过程中,该参数不支持变更。 + */ + + const char* sei_payload_uuid = nullptr; + /** + * + * @valid since 3.57 + * @brief 设置合流推到 CDN 时输出的媒体流类型。参看 MixedStreamMediaType{@link #MixedStreamMediaType}。
    + * 默认输出音视频流。支持输出纯音频流,但暂不支持输出纯视频流。 + */ + + MixedStreamMediaType media_type = MixedStreamMediaType::kMixedStreamMediaTypeAudioAndVideo; + /** + * + * @valid since 3.57 + * @brief 设置是否在没有用户发布流的情况下发起转推直播,默认不允许。具体参看 MixedStreamPushMode{@link #MixedStreamPushMode}。
    + * 该参数在发起合流任务后的转推直播过程中不支持动态变更。 + */ + + MixedStreamPushMode push_stream_mode = MixedStreamPushMode::kMixedStreamPushModeOnStream; +} MixedStreamControlConfig; + +/** + * + * @type keytype + * @brief WTN 流的布局模式 + */ + +enum StreamLayoutMode { + /** + * + * @brief 自动布局 + */ + + kStreamLayoutModeAuto = 0, + /** + * + * @brief 自定义 + */ + + kStreamLayoutModeCustom = 2 +}; +/** + * + * @type keytype + * @brief WTN 流的补帧模式 + */ + +enum InterpolationMode { + /** + * + * @type keytype + * @brief 补最后一帧 + */ + + kInterpolationModeLastFrameFill = 0, + /** + * + * @type keytype + * @brief 补背景图片 + */ + + kInterpolationModeBackgroundImageFill = 1 +}; +/** + * + * @type keytype + * @brief WTN 流视频裁剪配置 + */ + +typedef struct SourceCrop { + /** + * + * @brief 裁剪后得到的视频帧左上角横坐标相对于裁剪前整体画面的归一化比例,取值范围[0.0, 1.0)。
    + * 默认值为 0.0 + */ + + float location_x = 0.0; + /** + * + * @brief 裁剪后得到的视频帧左上角纵坐标相对于裁剪前整体画面的归一化比例,取值范围[0.0, 1.0)
    + * 默认值为 0.0 + */ + + float location_y = 0.0; + /** + * + * @brief 裁剪后得到的视频帧宽度相对于裁剪前整体画面的归一化比例,取值范围(0.0, 1.0]
    + * 默认值为 1.0 + */ + + float width_proportion = 1.0; + /** + * + * @brief 裁剪后得到的视频帧高度相对于裁剪前整体画面的归一化比例,取值范围(0.0, 1.0]
    + * 默认值为 1.0 + */ + + float height_proportion = 1.0; +} SourceCrop; +/** + * + * @type keytype + * @brief 单个图片或视频流在合流中的布局信息。
    + * 开启合流功能后,在多路图片或视频流合流时,你可以设置其中一路流在合流中的预设布局信息。 + */ + +typedef struct MixedStreamLayoutRegionConfig { + /** + * + * @brief 合流用户的 ID。建议设置。 + */ + + const char* user_id = nullptr; + /** + * + * @brief 图片或视频流所在房间的房间 ID。建议设置。
    + * 如果此图片或视频流是通过 startForwardStreamToRooms{@link #IRTCRoom#startForwardStreamToRooms} 转发到用户所在房间的媒体流时,你应将房间 ID 设置为用户所在的房间 ID。 + */ + + const char* room_id = nullptr; + /** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 X 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的横向位移。
    + * 取值范围为 [0, 整体画布宽度)。默认值为 0。 + */ + + int location_x = 0; + /** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 Y 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的纵向位移。
    + * 取值范围为 [0, 整体画布高度)。默认值为 0。 + */ + + int location_y = 0; + /** + * + * @brief 单个用户画面的宽度。取值范围为 [0, 整体画布宽度],默认值为 360。 + */ + + int width = MIXED_STREAM_VIDEO_DEFAULT_WIDTH; + /** + * + * @brief 单个用户画面的高度。取值范围为 [0, 整体画布高度],默认值为 640。 + */ + + int height = MIXED_STREAM_DEFAULT_VIDEO_HEIGHT; + /** + * + * @brief 透明度,可选范围为 (0.0, 1.0],0.0 为全透明。默认值为 1.0。 + */ + + float alpha = 1.0f; + /** + * + * @brief 圆角半径相对画布宽度的比例。默认值为 `0.0`。
    + * 做范围判定时,首先根据画布的宽高,将 `width`,`height`,和 `corner_radius` 分别转换为像素值:`width_px`,`height_px`,和 `corner_radius_px`。然后判定是否满足 `corner_radius_px < min(width_px/2, height_px/2)`:若满足,则设置成功;若不满足,则将 `corner_radius_px` 设定为 `min(width_px/2, height_px/2)`,然后将 `corner_radius` 设定为 `corner_radius_px` 相对画布宽度的比例值。
    + * WTN 流任务不支持设置本参数。 + */ + + float corner_radius = 0; + + /** + * + * @brief 用户视频布局在画布中的层级。取值范围为 [0 - 100],0 为底层,值越大越上层。默认值为 0。 + */ + + int32_t z_order = 0; + /** + * + * @brief 是否为本地用户:
    + * - true:是 + * - false:(默认值)否 + * WTN 流任务不支持设置本参数。 + */ + + bool is_local_user = false; + /** + * + * @brief 预留字段。 + */ + + MixedStreamVideoType stream_type = MixedStreamVideoType::kMixedStreamVideoTypeMain; + /** + * + * @brief 合流内容控制。默认值为 `kMediaTypeAudioAndVideo`,参看 MixedStreamMediaType{@link #MixedStreamMediaType}。 + */ + + MixedStreamMediaType media_type = MixedStreamMediaType::kMixedStreamMediaTypeAudioAndVideo; + /** + * + * @brief 图片或视频流的缩放模式,参看 MixedStreamRenderMode{@link #MixedStreamRenderMode}。默认值为 `1`,视窗填满优先。建议设置。 + */ + + MixedStreamRenderMode render_mode = MixedStreamRenderMode::kMixedStreamRenderModeHidden; + /** + * + * @brief 合流布局区域类型,视频区或水印图片区。参看 MixedStreamLayoutRegionType{@link #MixedStreamLayoutRegionType}。默认值为 `0`,视频。
    + * WTN 流任务不支持设置本参数。 + */ + + MixedStreamLayoutRegionType region_content_type = MixedStreamLayoutRegionType:: kMixedStreamLayoutRegionTypeVideoStream; + /** + * + * @brief 水印图 RGBA 数据。当 `region_content_type` 为图片类型时需要设置。
    + * - `kMixedStreamLayoutRegionTypeImage = 1` 时,传入图片 RGBA 数据。 + * - `kMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + + uint8_t* image_water_mark = nullptr; + /** + * + * @type keytype + * @brief 水印图参数。当 `region_content_type` 为图片类型时需要设置。
    + * - `kMixedStreamLayoutRegionTypeImage = 1` 时,传入图片参数,参看 MixedStreamLayoutRegionImageWaterMarkConfig{@link #MixedStreamLayoutRegionImageWaterMarkConfig}。 + * - `kMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + + MixedStreamLayoutRegionImageWaterMarkConfig image_water_mark_param; + /** + * + * @valid since 3.57 + * @brief 设置占位图的填充模式。
    + * 该参数用来控制当用户停止发布视频流,画面恢复为占位图后,此时占位图的填充模式。默认值为 `kMixedStreamAlternateImageFillModeFit`,占位图跟随用户原始视频帧相同的比例缩放。
    + * 参看 MixedStreamAlternateImageFillMode{@link #MixedStreamAlternateImageFillMode}。
    + * WTN 流任务不支持设置本参数。 + */ + + MixedStreamAlternateImageFillMode alternate_image_fill_mode = kMixedStreamAlternateImageFillModeFit; + /** + * + * @valid since 3.57 + * @brief 设置占位图的 URL,长度小于 1024 字符. + */ + + const char* alternate_image_url = nullptr; + /** + * + * @type keytype + * @brief 空间位置。参看 Position{@link #Position}。
    + * WTN 流任务不支持设置本参数。 + */ + + Position spatial_position; + /** + * + * @type keytype + * @brief 是否开启空间音频效果。默认值为 true。
    + * WTN 流任务不支持设置本参数。 + */ + + bool apply_spatial_audio = true; + /** + * + * @brief 支持对每一路参与WTN 流的视频进行裁剪,参看 SourceCrop{@link #SourceCrop}
    + * 合流转推任务不支持。 + */ + + SourceCrop source_crop; +} MixedStreamLayoutRegionConfig; +/** + * + * @type keytype + * @brief 数据帧类型 + */ + +enum DataFrameType { + /** + * + * @brief SEI 视频帧 + */ + + kDataFrameTypeSei = 0, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 合流房间状态 + */ + +enum TranscoderRoomStatus { + /** + * @brief join room status + */ + kRoomStatusJoinRoom, + /** + * @brief leave room status + */ + kRoomStatusLeaveRoom, + /** + * @brief room status was offline + */ + kRoomStatusOffline, + /** + * @brief room status was online + */ + kRoomStatusOnline, +}; + +/** + * @hidden for internal use only + */ +typedef size_t status_t; +/** + * + * @hidden for internal use only + */ + +class IVideoFrame; +/** + * + * @hidden for internal use only + */ + +class IAudioFrame; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 数据帧 + */ + +typedef struct IDataFrame { + /** + * + * @brief 数据帧类型,参看 DataFrameType{@link #DataFrameType} + */ + + DataFrameType frame_type = kDataFrameTypeSei; + /** + * + * @brief 数据帧数据 + */ + + uint8_t* u8_data = nullptr; + /** + * + * @brief 数据帧数据大小 + */ + + uint32_t u32_data_size = 0; + /** + * + * @brief 数据帧时间戳,单位:微秒 + */ + + uint64_t u64_ts_us = 0; +} IDataFrame; + +/** + * + * @type keytype + * @brief 合流/WTN 流的转推目标参数。 + * 如无特别说明,参数可适用于 WTN 流和合流转推任务。 + * 如无特别说明,参数可用于启动和更新任务。 + */ + +typedef struct MixedStreamPushTargetConfig { + /** + * + * @type keytype + * @brief WTN 流 ID。合流任务不支持设置本参数。 + */ + + const char* push_wtn_stream_id = nullptr; + /** + * + * @type api + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + + const char* push_cdn_url = nullptr; + /** + * + * @type keytype + * @brief 推流任务类型。 + */ + + MixedStreamPushTargetType push_target_type = kMixedStreamPushTargetTypeToCDN; +} MixedStreamPushTargetConfig; + +/** + * + * @type keytype + * @brief 合流转推配置参数。 + * 如无特别说明,参数可适用于WTN 流和合流转推任务。 + * 如无特别说明,参数可用于启动和更新任务。 + */ + +class IMixedStreamConfig { +public: + /** + * + * @type api + * @brief 构建合流任务参数 + * @return 合流任务参数 + */ + + static BYTERTC_STATIC_API IMixedStreamConfig* createMixedStreamConfig(); + /** + * + * @type api + * @brief 获取发起合流任务用户所在的房间 ID。 + * @return 合流房间 ID + */ + + virtual const char* getRoomID() = 0; + /** + * + * @type api + * @brief 设置合流房间 ID + * @param room_id 发起合流的用户所在的房间 ID + * @note + * 本参数不支持过程中更新。 + */ + + virtual void setRoomID(const char* room_id) = 0; + /** + * + * @type api + * @brief 获取发起合流任务的用户 ID。 + * @return 用户 ID。 + */ + + virtual const char* getUserID() = 0; + /** + * + * @type api + * @brief 设置发起合流任务的用户 ID。`room_id` 和 `user_id` 长度相加不得超过 126 字节。建议设置。
    + * 本参数不支持过程中更新。 + * @param user_id 推流用户 ID。 + */ + + virtual void setUserID(const char* user_id) = 0; + /** + * + * @type api + * @brief 获取合流音频参数。 + * @return 合流音频参数内容,参看 MixedStreamAudioConfig{@link #MixedStreamAudioConfig}。 + */ + + virtual MixedStreamAudioConfig getAudioConfig() = 0; + /** + * + * @type api + * @brief 设置音频参数。建议设置。 + * @param MixedStreamAudioConfig 音频参数,参看 MixedStreamAudioConfig{@link #MixedStreamAudioConfig}。 + * @note + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + + virtual void setAudioConfig(const MixedStreamAudioConfig&) = 0; + /** + * + * @type api + * @brief 获取视频转码参数。 + * @return 视频转码参数内容,参看 MixedStreamVideoConfig{@link #MixedStreamVideoConfig}。 + */ + + virtual MixedStreamVideoConfig getVideoConfig() = 0; + /** + * + * @type api + * @brief 设置视频参数。建议设置。 + * @param MixedStreamVideoConfig 视频参数,参看 MixedStreamVideoConfig{@link #MixedStreamVideoConfig}。 + */ + + virtual void setVideoConfig(const MixedStreamVideoConfig&) = 0; + /** + * + * @hidden(Windows,macOS,Linux) + * @type api + * @brief 获取转推 CDN 时的空间音频参数。 + * @return 参看 MixedStreamSpatialAudioConfig{@link #MixedStreamSpatialAudioConfig}。 + */ + + virtual MixedStreamSpatialAudioConfig getSpatialAudioConfig() = 0; + /** + * + * @hidden(Windows,macOS,Linux) + * @type api + * @brief 设定转推 CDN 时的空间音频效果。参看 MixedStreamSpatialAudioConfig{@link #MixedStreamSpatialAudioConfig}。 + */ + + virtual void setSpatialAudioConfig(const MixedStreamSpatialAudioConfig&) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 获取动态扩展自定义参数 + * @return 动态扩展自定义参数 + */ + + virtual const char* getAdvancedConfig() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置动态扩展自定义参数 + * @param advanced_config 动态扩展自定义参数 + */ + + virtual void setAdvancedConfig(const char* advanced_config) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 获取业务透传鉴权信息 + * @return 业务透传鉴权信息 + */ + + virtual const char* getAuthInfo() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置业务透传鉴权信息 + * @param auth_info 业务透传鉴权信息 + */ + + virtual void setAuthInfo(const char* auth_info) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 获取转推直播同步参数。 + * @return 转推直播同步参数,参看 MixedStreamSyncControlConfig{@link #MixedStreamSyncControlConfig}。 + */ + + virtual MixedStreamSyncControlConfig getSyncControlConfig() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置转推直播同步参数。参看 MixedStreamSyncControlConfig{@link #MixedStreamSyncControlConfig}。 + */ + + virtual void setSyncControlConfig(MixedStreamSyncControlConfig&) = 0; + /** + * + * @type api + * @brief 获取服务端合流控制参数。参看 MixedStreamControlConfig{@link #MixedStreamControlConfig}。 + */ + + virtual MixedStreamControlConfig getControlConfig() = 0; + /** + * + * @type api + * @brief 设置服务端合流控制参数。参看 MixedStreamControlConfig{@link #MixedStreamControlConfig}。 + * @param config 参看 MixedStreamControlConfig{@link #MixedStreamControlConfig}. + */ + + virtual void setControlConfig(MixedStreamControlConfig& config) = 0; + /** + * + * @type api + * @brief 获取用户配置的额外信息。 + * @return 用户配置的额外信息。 + */ + + virtual const char* getUserConfigExtraInfo() = 0; + /** + * + * @type api + * @brief 设置用户配置的额外信息。 + * @param user_ext_info 用户配置的额外信息。 + * @note + * WTN 流任务不支持设置本参数。 + */ + + virtual void setUserConfigExtraInfo(const char* user_ext_info) = 0; + /** + * + * @type api + * @brief 获取 WTN 流的布局模式。 + * @return StreamLayoutMode{@link #StreamLayoutMode} 信息。 + */ + + virtual StreamLayoutMode getStreamLayoutMode() = 0; + /** + * + * @type api + * @brief 设置 WTN 流的布局模式。 + * @param mode 布局模式。参看 StreamLayoutMode{@link #StreamLayoutMode}。 + */ + + virtual void setStreamLayoutMode(StreamLayoutMode mode) = 0; + /** + * + * @type api + * @brief 获取 WTN 流的补帧模式。 + * @return InterpolationMode{@link #InterpolationMode} 信息。 + */ + + virtual InterpolationMode getInterpolationMode() = 0; + /** + * + * @type api + * @brief 设置 WTN 流的补帧模式。 + * @param mode 补帧模式。参看 InterpolationMode{@link #InterpolationMode}。 + */ + + virtual void setInterpolationMode(InterpolationMode mode) = 0; + + /** + * + * @type api + * @brief 获取 WTN 流 ID。 + * @return WTN 流 ID。 + */ + + virtual const char* getPushWTNStreamID() = 0; + /** + * + * @type api + * @brief 设置 WTN 流 ID。 + * @param stream_id WTN 流 ID。 + */ + + virtual void setPushWTNStreamID(const char* stream_id) = 0; + /** + * + * @type api + * @brief 获取任务类型。 + * @return MixedStreamPushTargetType{@link #MixedStreamPushTargetType} + */ + + virtual MixedStreamPushTargetType getPushTargetType() = 0; + /** + * + * @type api + * @brief 设置推流目标。 + * @param type 参看 MixedStreamPushTargetType{@link #MixedStreamPushTargetType}。 + */ + + virtual void setPushTargetType(MixedStreamPushTargetType type) = 0; + + /** + * + * @type api + * @brief 获取背景颜色。 + * @return 背景颜色,用十六进制颜色码(HEX)表示。例如,#FFFFFF 表示纯白,#000000 表示纯黑。默认值为 #000000。建议设置。 + */ + + virtual const char* getBackgroundColor() = 0; + /** + * + * @type api + * @brief 设置背景颜色。 + * @param background_color 背景颜色,用十六进制颜色码(HEX)表示。例如,#FFFFFF 表示纯白,#000000 表示纯黑。默认值为 #000000。建议设置。 + */ + + virtual void setBackgroundColor(const char* background_color) = 0; + /** + * + * @type api + * @brief 获取背景图片的地址。 + * @return 背景图片的地址。 + */ + + virtual const char* getBackgroundImageURL() = 0; + /** + * + * @type api + * @brief 设置合流后整体画布的背景图片。 + * @param background_image_url 图片的 URL,长度最大为 1023 bytes。
    + * 必须是 http 开头,支持的图片格式包括:JPG, JPEG, PNG。如果背景图片的宽高和整体屏幕的宽高不一致,背景图片会缩放到铺满屏幕。 + */ + + virtual void setBackgroundImageURL(const char* background_image_url) = 0; + /** + * + * @type api + * @brief 获取合流视窗布局信息。 + * @param index 视窗对应下标。 + * @return 合流视窗布局信息,参看 MixedStreamLayoutRegionConfig{@link #MixedStreamLayoutRegionConfig}。 + */ + + virtual MixedStreamLayoutRegionConfig getLayoutByIndex(int32_t index) = 0; + /** + * + * @type api + * @brief 获取合流参数中视窗的数量 + * @return 合流参数中视窗的数量 + */ + + virtual int32_t getLayoutRegionsSize() = 0; + /** + * + * @type api + * @brief 设置视频流合流整体布局信息。 + * @param regions 用户布局信息列表。为 MixedStreamLayoutRegionConfig{@link #MixedStreamLayoutRegionConfig} 数据类型的数组。每一个该类型对象为一路单独的视频流的布局信息。
    + * 值不合法或未设置时,自动使用默认值。建议设置。 + * @param regions_size 合流视窗数量。建议设置。 + */ + + virtual void setLayoutConfig(MixedStreamLayoutRegionConfig regions[], int32_t regions_size) = 0; + virtual ~IMixedStreamConfig() = default; +}; + +/** + * + * @type keytype + * @brief 单流转推配置目标房间信息 + */ + +typedef struct DestInfo { + /** + * + * @brief 跨房间转发媒体流过程中目标房间 ID + */ + + const char* room_id; + /** + * + * @brief 转发目标房间中自定义用户ID + */ + + const char* user_id; +} DestInfo; + +/** + * + * @type keytype + * @brief 单流转推类型,指定将媒体流转推到 CDN 还是 RTC 房间。 + */ + +enum SingleStreamPushType { + /** + * + * @brief 转推到 CDN + */ + + kPushToCDN = 1, + /** + * + * @brief 转推到 RTC 房间 + */ + + kPushToRTC = 2 +}; + +/** + * + * @type keytype + * @brief 单流转推直播配置参数。 + */ + +typedef struct PushSingleStreamParam { + /** + * + * @brief 媒体流所在的房间 ID + */ + + const char* room_id; + /** + * + * @brief 媒体流所属的用户 ID + */ + + const char* user_id; + /** + * + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * 本参数不支持过程中更新。 + */ + + const char* uri; + /** + * + * @brief 预留字段。 + */ + + bool is_screen_stream; + /** + * + * @brief 转推目标房间数组,默认值为nullptr + */ + + DestInfo* dest_info = nullptr; + /** + * + * @brief 转推目标房间数量,`dest_info` 的数组长度,
    + * 默认值为0,取值范围[0, 8] + */ + + int32_t dest_info_size = 0; + /** + * + * @brief 单流转推类型,指定将媒体流转推到 CDN 还是 RTC 房间,默认值为转推到 CDN。 + */ + + SingleStreamPushType push_type = kPushToCDN; +}PushSingleStreamParam; + +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步模式。 +*/ + +enum ChorusCacheSyncMode { + /** + * + * @brief 合唱场景下,主唱应采用此模式,以发送带时间戳信息的媒体数据。 + */ + + kChorusCacheSyncModeProducer= 0, + /** + * + * @brief 合唱场景下,副唱应采用此模式。
    + * 此模式下,副唱收到来自主唱的带时间戳的媒体数据。副唱发送的媒体数据中带有来自主唱的时间戳。 + */ + + kChorusCacheSyncModeRetransmitter= 1, + /** + * + * @brief 合唱场景下,听众应采用此模式。
    + * 此模式下,听众收到来自主唱的时间戳,并据此对齐来自主唱和副唱的媒体数据,以获得良好的合唱播放效果。 + */ + + kChorusCacheSyncModeConsumer = 2 +}; +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步事件。 +*/ + +enum ChorusCacheSyncEvent { + /** + * + * @brief 成功 + */ + + kChorusCacheSyncEventStartSuccess = 0, + /** + * + * @brief 失败。 + */ + + kChorusCacheSyncEventStartFailed = 1, +}; +/** +* +* @hidden internal use only +* @type errorcode +* @brief 缓存同步错误码。 +*/ + +enum ChorusCacheSyncError { + /** + * + * @brief 成功。 + */ + + kChorusCacheSyncErrorOK = 0, + /** + * + * @brief 失败。推送至 CDN 时,应进行以下设置:
    + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.enable_sync = true`; + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.base_user_id = {uid of producer}`。 + */ + + kChorusCacheSyncErrorWrongState = 1, + /** + * + * @brief 缓存同步功能已启动,不需要重复开启。 + */ + + kChorusCacheSyncErrorAlreadyRunning = 2 +}; +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步配置。 +*/ + +struct ChorusCacheSyncConfig { + /** + * + * @brief 最大媒体缓存时长(ms)。
    + * 取值范围是 `[500, 2500]`,默认值是 `2000`。
    + * 值越大,同步效果越好,但会造成占用内存较大。如果参与缓存同步的各路媒体流之间的时间差超过此值,会造成丢帧。 + */ + + int32_t max_cache_time_ms = 2000; + /** + * + * @brief 收到 onSyncedVideoFrames{@link #IChorusCacheSyncObserver#onSyncedVideoFrames} 的频率。
    + * 默认值是 `15`。此值通常应小于等于原始视频帧率;如果大于原始视频帧率,可能会收到重复帧。 + */ + + int32_t video_fps = 15; + /** + * + * @brief 模式。参看 ChorusCacheSyncMode{@link #ChorusCacheSyncMode}. 默认值是 `retransmitter`。 + */ + + ChorusCacheSyncMode mode = kChorusCacheSyncModeRetransmitter; +}; + +/** + * + * @type callback + * @hidden for internal use only on Windows + * @brief 合流推流 Observer
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ + +class IClientMixedStreamObserver { +public: + /** + * + * @hidden for internal use only on Windows + * @type callback + * @brief 转推直播状态回调 + * @param info 参看 MixedStreamTaskInfo{@link #MixedStreamTaskInfo} + * @param type 转推直播类型,参看 MixedStreamType{@link #MixedStreamType} + * @param event 转推直播任务状态,参看 MixedStreamTaskEvent{@link #MixedStreamTaskEvent} + * @param error_code 转推直播错误码,参看 MixedStreamTaskErrorCode{@link #MixedStreamTaskErrorCode}。 + */ + + virtual void onClientMixedStreamEvent(MixedStreamTaskInfo info, MixedStreamType type, MixedStreamTaskEvent event, MixedStreamTaskErrorCode error_code) = 0; + /** + * + * @hidden for internal use only on Windows + * @type callback + * @region CDN 推流 + * @brief 客户端合流音频首帧回调 + * @param task_id 任务 ID + */ + + virtual void onMixedFirstAudioFrame(const char* task_id) = 0; + /** + * + * @hidden for internal use only on Windows + * @type callback + * @region CDN 推流 + * @brief 客户端合流视频首帧回调 + * @param task_id 任务 ID + */ + + virtual void onMixedFirstVideoFrame(const char* task_id) = 0; + /** + * + * @type callback + * @hidden for internal use only on Windows + * @region CDN 推流 + * @brief 合流视频回调,运行在视频回调线程 + * @param task_id 合流任务 ID + * @param video_frame 视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @note 收到该回调的周期与视频的帧间隔一致。 + */ + + virtual void onMixedVideoFrame(const char* task_id, IVideoFrame* video_frame) = 0; + + /** + * + * @type callback + * @hidden for internal use only on Windows + * @region CDN 推流 + * @brief 合流音频回调,运行在音频回调线程 + * @param task_id 转推直播任务 ID + * @param audio_frame 音频帧,参看 IAudioFrame{@link #IAudioFrame}。 + * @note 收到该回调的周期为每 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + */ + + virtual void onMixedAudioFrame(const char* task_id, IAudioFrame* audio_frame) = 0; + + /** + * + * @type callback + * @hidden for internal use only on Windows + * @region CDN 推流 + * @brief 视频 SEI 帧回调,运行在视频回调线程 + * @param task_id 转推直播任务 ID + * @param data_frame SEI 数据 + */ + + virtual void onMixedDataFrame(const char* task_id, IDataFrame* data_frame) = 0; + + /** + * + * @hidden for internal use only + * @type callback + * @region CDN 推流 + * @brief 同步视频帧回调。 + * @param task_id 转推直播任务 ID。 + * @param uids 同步视频帧对应的 uid 数组。 + * @param video_frames 同步视频帧数组,与 uids 对应。 + * @param data_frame SEI 数据。 + * @param count 数组的长度。 + */ + + virtual void onCacheSyncVideoFrames(const char* task_id, const char* uids[], IVideoFrame* video_frames[], + IDataFrame* data_frame[], int count) = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IClientMixedStreamObserver() = default; +}; + +/** + * + * @hidden internal use only + * @type callback + * @brief 缓存同步 Observer + */ + +class IChorusCacheSyncObserver { +public: + /** + * @hidden constructor/destructor + */ + virtual ~IChorusCacheSyncObserver() { + } + /** + * + * @type callback + * @brief 调用 startChorusCacheSync{@link #IRTCEngine#startChorusCacheSync},并设置为 `consumer` 的用户会通过此回调获取经缓存同步后的视频帧。获取频率通过启动同步时的 `fps` 进行设置。 + * @param count `uids` 和 `videoFrames` 的数组长度 + * @param uids 参与合唱缓存同步的 `producer` 和 `retransmitter` 的列表,不包括参与但未发送媒体数据的用户。 + * @param video_frames 对应 `uids` 的视频帧。参看 IVideoFrame{@link #IVideoFrame}。 + */ + + virtual void onSyncedVideoFrames(int count, const char* uids[], bytertc::IVideoFrame* video_frames[]) = 0; + /** + * + * @type callback + * @brief 参与合唱缓存同步的 `producer` 和 `retransmitter` 发生变化时,收到此回调。 + * @param count 当前的 `uids` 的长度 + * @param uids 当前的参与者列表 + * @note 有以下情况可能造成参与者发生变化:
    + * - 用户主动调用 startChorusCacheSync{@link #IRTCEngine#startChorusCacheSync} 或 stopChorusCacheSync{@link #IRTCEngine#stopChorusCacheSync}; + * - 原本参与缓存同步的用户发生异常退出。 + */ + + virtual void onSyncedUsersChanged(int count, const char* uids[]) = 0; + /** + * + * @type callback + * @brief 缓存同步事件回调 + * @param event 事件,参看 ChorusCacheSyncEvent{@link #ChorusCacheSyncEvent}。 + * @param error 错误码,参看 ChorusCacheSyncError{@link #ChorusCacheSyncError}。 + */ + + virtual void onSyncEvent(ChorusCacheSyncEvent event, ChorusCacheSyncError error) = 0; +}; +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines.h new file mode 100644 index 0000000..25f0cc7 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines.h @@ -0,0 +1,2648 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Defines + */ + +#pragma once + +#include "bytertc_rts_defines.h" +#include "bytertc_video_frame.h" + +namespace bytertc { + +/** + * + * @type keytype + * @brief 订阅大小流偏好 + */ + +enum SimulcastStreamType { + /** + * + * @brief 弱流,最小分辨率的流。 + */ + + kSimulcastStreamTypeWeak = 0, + /** + * + * @brief 小流 + */ + + kSimulcastStreamTypeLow, + /** + * + * @brief 中流 + */ + + kSimulcastStreamTypeMid, + /** + * + * @brief 大流 + */ + + kSimulcastStreamTypeHigh +}; + +/** + * + * @type keytype + * @brief 发布大小流模式 + */ + +enum VideoSimulcastMode { + /** + * + * @brief 单流模式。始终只有 1 路分辨率的流。 + */ + + kVideoSimulcastModeOnlyOne = 0, + /** + * + * @brief 按需订阅模式。发送端会根据订阅端的状态,按需发布。无订阅偏好设置默认发送 2 路。 + */ + + kVideoSimulcastModeOnDemand, + /** + * + * @brief 订阅弱流。发送端始终按照设置的参数发布所有大小流。默认发送 2 路。 + */ + + kVideoSimulcastModeAlwaysSimulcast, +}; + + +/** + * + * @type keytype + * @brief 渲染模式 + */ + +enum RenderMode { + /** + * + * @brief 视窗填满优先,默认值。
    + * 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + */ + + kRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 + */ + + kRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
    + * 视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + kRenderModeFill = 3, +}; + +/** + * + * @type keytype + * @brief 订阅媒体的类型 + */ + +enum SubscribeMediaType { + /** + * + * @brief 既不订阅音频,也不订阅视频 + */ + + kRTCSubscribeMediaTypeNone = 0, + /** + * + * @brief 只订阅音频,不订阅视频 + */ + + kRTCSubscribeMediaTypeAudioOnly, + /** + * + * @brief 只订阅视频,不订阅音频 + */ + + kRTCSubscribeMediaTypeVideoOnly, + /** + * + * @brief 同时订阅音频和视频 + */ + + kRTCSubscribeMediaTypeVideoAndAudio +}; + +/** + * + * @type keytype + * @brief 暂停/恢复接收远端的媒体流类型。 + */ + +enum PauseResumeControlMediaType { + /** + * + * @brief 只控制音频,不影响视频 + */ + + kRTCPauseResumeControlMediaTypeAudio = 0, + /** + * + * @brief 只控制视频,不影响音频 + */ + + kRTCPauseResumeControlMediaTypeVideo = 1, + /** + * + * @brief 同时控制音频和视频 + */ + + kRTCPauseResumeControlMediaTypeVideoAndAudio = 2 +}; + +/** + * + * @type keytype + * @brief 时域分层定义 + */ + +enum SVCLayer { + /** + * + * @brief 不指定分层(默认值) + */ + + kSVCLayerDefault = 0, + /** + * + * @brief T0 层 + */ + + kSVCLayerBase = 1, + /** + * + * @brief T0+T1 层 + */ + + kSVCLayerMain = 2, + /** + * + * @brief T0+T1+T2 层 + */ + + kSVCLayerHigh = 3, +}; + +/** + * + * @type keytype + * @brief 流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。 + */ + +struct RemoteStreamSwitch { + /** + * + * @brief 订阅的音视频流的发布者的用户 ID。 + */ + + const char* uid; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 流切换前本地用户订阅的视频流的分辨率对应的索引。 + */ + + int before_video_index; + /** + * + * @brief 流切换后本地用户订阅的视频流的分辨率对应的索引。 + */ + + int after_video_index; + /** + * + * @brief 流切换前是否有视频流。 + */ + + bool before_enable; + /** + * + * @brief 流切换后是否有视频流。 + */ + + bool after_enable; + /** + * + * @brief 触发流回退的原因,详见类型 FallbackOrRecoverReason{@link #FallbackOrRecoverReason} 。 + */ + + FallbackOrRecoverReason reason; +}; + +/** + * + * @type keytype + * @brief 背景模式 + */ + +enum BackgroundMode { + /** + * + * @brief 无 + */ + + kBackgroundModeNone = 0, + /** + * + * @brief 虚化 + */ + + kBackgroundModeBlur = 1, + /** + * + * @brief 背景 1 + */ + + kBackgroundModeA = 2, + /** + * + * @brief 背景 2 + */ + + kBackgroundModeB = 3, +}; + +/** + * + * @type keytype + * @brief 分割模型 + */ + +enum DivideMode { + /** + * + * @brief 自研 + */ + + kDivideModeNone = 0, + /** + * + * @brief effect + */ + + kDivideModeEffect = 1, +}; + +/** + * + * @type keytype + * @brief 流属性。 + */ + +struct MediaStreamInfo { + /** + * + * @brief 发布此流的用户 ID 。 + */ + + const char* user_id; + /** + * + * @hidden for internal use only + * @brief 该流的标识 ID,用户内唯一。 + */ + + StreamIndex stream_index; + /** + * + * @brief 预留字段。 + */ + + bool is_screen; + /** + * + * @brief 此流是否包括视频流。 + */ + + bool has_video; + /** + * + * @brief 流是否包括音频流。 + */ + + bool has_audio; + /** + * + * @brief 视频流的属性。
    + * 当远端用户调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。 + */ + + VideoSolutionDescription* profiles; + /** + * + * @brief 不同配置流的个数。
    + * 当远端用户调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法发布多个配置的视频流时,此处会包含该用户发布的视频流的数目。 + */ + + int profile_count; + + /** + * + * @brief 最大视频流的属性。
    + * 当远端用户开启带通道划分的大小流时,回调最大视频流属性信息。用户可以使用新的订阅方式,订阅任意不超过该分辨率的流。
    + * 最终接收到的流,会受房间内其他用户的订阅行为的影响,综合确定一个最接近用户请求的分辨率的流。 + */ + + VideoSolutionDescription max_profile; +}; + +/** + * + * @type keytype + * @brief 视频订阅配置信息 + */ + +struct SubscribeVideoConfig { + /** + * + * @brief 订阅的视频流分辨率下标。
    + * 当远端用户通过调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
    + * 默认值为 0,即订阅第一路流。
    + * 如果不想更改之前的设置,可以输入 -1。 + */ + + int video_index = 0; + /** + * + * @brief 远端用户优先级,参看 RemoteUserPriority{@link #RemoteUserPriority},默认值为 0。 + */ + + int priority = 0; + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeVideoConfig() : video_index(0), priority(0) { + } + /** + * + * @hidden constructor/destructor + */ + + bool operator==(const SubscribeVideoConfig& config) const { + bool result = video_index == config.video_index && priority == config.priority; + return result; + } + /** + * + * @hidden constructor/destructor + */ + + bool operator!=(const SubscribeVideoConfig& config) const { + bool result = (*this == config); + return !result; + } +}; + +/** + * + * @type keytype + * @brief 手动订阅流的配置信息。 + */ + +struct SubscribeConfig { + /** + * + * @brief 预留字段。 + */ + + bool is_screen = false; + /** + * + * @brief 是否订阅视频。 + */ + + bool sub_video; + /** + * + * @brief 是否订阅音频。 + */ + + bool sub_audio; + /** + * + * @brief 订阅的视频流分辨率下标。
    + * 用户可以通过调用 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 方法在一路流中发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。 + */ + + int video_index; + /** + * + * @brief 远端用户的需求优先级,参看 RemoteUserPriority{@link #RemoteUserPriority},默认值为 0 。
    + * 当开启了订阅流回退选项功能(详见 setSubscribeFallbackOption{@link #IRTCEngine#setSubscribeFallbackOption} 方法),弱网或性能不足时会优先保证收到的高优先级用户的流的质量。 + */ + + int priority = 0; + /** + * + * @brief 远端用户的时域分层,参看 SVCLayer{@link #SVCLayer},默认值为 0 。
    + * 仅码流支持 SVC 特性时可以生效。 + */ + + int svc_layer = 0; + /** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0,设为大于 0 的值时开始生效。
    + * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
    + * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + + int framerate = 0; + /** + * + * @brief 用户通过指定 UI 对应的最合适的流的宽度,单位:px + */ + + int sub_width = 0; + /** + * + * @brief 用户通过指定 UI 对应的最合适的流的高度,单位:px + */ + + int sub_height = 0; + /** + * + * @hidden for internal use only + */ + + int sub_video_index = -1; + +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig() : is_screen(false), sub_video(true), sub_audio(true), video_index(0), priority(0) { + } + + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig(bool is_screen, bool subvideo, bool subaudio, int videoindex) + : is_screen(is_screen), sub_video(subvideo), sub_audio(subaudio), video_index(videoindex) { + } + + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig(bool is_screen, bool subvideo, bool subaudio, int videoindex, int priority) + : is_screen(is_screen), + sub_video(subvideo), + sub_audio(subaudio), + video_index(videoindex), + priority(priority) { + } + + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + SubscribeConfig(bool is_screen, bool subvideo, bool subaudio, int videoindex, + int priority,int svc_layer,int width,int height) + : is_screen(is_screen), + sub_video(subvideo), + sub_audio(subaudio), + video_index(videoindex), + priority(priority), + svc_layer(svc_layer), + sub_width(width), + sub_height(height) { + } + /** + * + * @hidden constructor/destructor + */ + + bool operator==(const SubscribeConfig& config) const { + + bool common_result = is_screen == config.is_screen && sub_video == config.sub_video + && sub_audio == config.sub_audio && priority == config.priority + && svc_layer == config.svc_layer && framerate == config.framerate; + bool result; + if(sub_width * sub_height > 0 && config.sub_width * config.sub_height > 0) { + result = common_result && sub_width == config.sub_width && sub_height == config.sub_height ; + } else if((sub_width * sub_height == 0) && (config.sub_width * config.sub_height == 0) ) { + result = common_result && video_index == config.video_index; + } else { + result = false; + } + return result; + } + /** + * + * @hidden constructor/destructor + */ + + bool operator!=(const SubscribeConfig& config) const { + bool result = (*this == config); + return !result; + } +}; + +/** + * + * @type keytype + * @brief 远端视频类型
    + * 目前 C++ sdk 只支持 kVideoStreamTypeHigh 类型 + */ + +enum VideoStreamType { + /** + * + * @brief 高分辨率视频流 + */ + + kVideoStreamTypeHigh = 0, + /** + * + * @brief 低分辨率视频 + */ + + kVideoStreamTypeLow = 1, +}; + +/** + * + * @type keytype + * @brief 渲染目标类型 + */ + +enum RenderTargetType { + /** + * + * @brief 指定渲染目标类型为 SurfaceView/TextureView (Android), UIView(iOS), NSView(macOS), HWND (Windows) + */ + + kRenderTargetTypeView = 0, + /** + * + * @brief 仅在 Android 平台生效,指定渲染目标类型为 Surface + */ + + kRenderTargetTypeSurface = 1, +}; + +/** + * + * @type keytype + * @brief 视频帧渲染设置。 + */ + +struct VideoCanvas { + /** + * + * @brief 本地视图句柄 + */ + + void* view = NULL; + /** + * + * @brief 视频渲染模式,参看 RenderMode{@link #RenderMode} + */ + + int render_mode = kRenderModeHidden; + /** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + + uint32_t background_color = 0; + /** + * + * @brief 渲染目标的类型。参看 RenderTargetType{@link #RenderTargetType}。 + */ + + RenderTargetType render_target_type = kRenderTargetTypeView; + /** + * + * @brief 视频帧旋转角度。参看 VideoRotation{@link #VideoRotation}。默认为 0 度,即不做旋转处理。
    + * 该设置仅对远端视频有效,对本地视频设置不生效。 + */ + + VideoRotation render_rotation = kVideoRotation0; + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + VideoCanvas() : view(NULL), render_mode(kRenderModeHidden), background_color(0), render_target_type(kRenderTargetTypeView) { + } + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + VideoCanvas(void* v, int m, uint32_t c) : view(v), render_mode(m), background_color(c) { + } +}; + +/** + * + * @type keytype + * @brief 远端视频帧渲染设置 + */ + +struct RemoteVideoRenderConfig { + /** + * + * @brief 渲染模式:
    + * - 1(`RENDER_MODE_HIDDEN`)视窗填满优先,默认值。视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + * - 2(`RENDER_MODE_FIT`)视频帧内容全部显示优先。视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将填充 `backgroundColor`。缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 + * - 3(`RENDER_MODE_FILL`)视频帧自适应画布。视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + RenderMode render_mode = kRenderModeHidden; + /** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + + uint32_t background_color = 0; + + /** + * + * @brief 用户自定义画面旋转。可选值 0, 90, 180, 270, 默认值是 0。其中 0 代表保持原始画面,90, 180, 270 代表顺时针旋转原始 canvas 相应角度。 + */ + + VideoRotation render_rotation = kVideoRotation0; +}; + +/** + * + * @type api + * @brief Windows 窗口 id, Windows 平台下传 Windows 窗口句柄 + */ + +typedef void* view_t; + +/** + * + * @type keytype + * @brief 矩形区域,用于指定屏幕区域。 + */ + +struct Rectangle { + /** + * + * @brief 矩形区域左上角的 x 坐标。 + */ + + int x = 0; + /** + * + * @brief 矩形区域左上角的 y 坐标。 + */ + + int y = 0; + /** + * + * @brief 矩形宽度。 + */ + + int width = 0; + /** + * + * @brief 矩形高度。 + */ + + int height = 0; +}; + +/** + * + * @type keytype + * @brief 屏幕共享时的边框高亮设置。 + */ + +struct HighlightConfig { + /** + * + * @brief 是否显示高亮边框,默认显示。 + */ + + bool enable_highlight = true; + /** + * + * @brief 边框的颜色, 颜色格式为十六进制 ARGB: 0xAARRGGB。 + */ + + uint32_t border_color = 0xFF29CCA3; + /** + * + * @brief 边框的宽度,单位:像素。 + */ + + int border_width = 4; +}; + +/** + * + * @type keytype + * @brief 抓取屏幕时排除指定窗口,默认不排除任何窗体。 + */ + +struct ScreenFilterConfig { + /** + * + * @brief 抓取屏幕时排除窗口列表。这个参数仅在抓取屏幕时生效。 + */ + + view_t* excluded_window_list = nullptr; + /** + * + * @brief 排除窗口的数量。 + */ + + int excluded_window_num = 0; +}; + +/** + * + * @type keytype + * @region 屏幕共享 + * @brief 内部采集屏幕视频流时,是否采集鼠标信息。 + */ + +enum MouseCursorCaptureState { + /** + * + * @brief 采集鼠标信息。 + */ + + kMouseCursorCaptureStateOn, + /** + * + * @brief 不采集鼠标信息。 + */ + + kMouseCursorCaptureStateOff, +}; + +/** + * + * @type keytype + * @brief 屏幕共享参数 + */ + +struct ScreenParameters { + /** + * + * @brief 编码帧率,单位为 fps + */ + + int frame_rate = 15; + /** + * + * @brief 屏幕采集编码码率, `-1` 为自动码率, SDK 会根据宽高信息选择合适的码率,单位 kbps + */ + + int kbitrate = -1; + /** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `min_kbitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, kbitrate),当 `kbitrate` < `min_kbitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `kbitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `kbitrate` < `0` 时,适配码率模式。 + */ + + int min_kbitrate = 0; +}; + +/** + * + * @type keytype + * @region 屏幕共享 + * @brief 内部采集屏幕视频流的内容类型。 + */ + +enum ContentHint { + /** + * + * @brief 细节内容。当共享文档、图片时,建议使用该内容类型。默认值。 + */ + + kContentHintDetails = 0, + /** + * + * @brief 动画内容。当共享视频、游戏时,建议使用该内容类型。 + */ + + kContentHintMotion, +}; + +/** + * + * @type keytype + * @brief 屏幕共享内部采集参数 + */ + +struct ScreenCaptureParameters { + /** + * + * @brief 采集区域,参看 Rectangle{@link #Rectangle}。 + */ + + Rectangle region_rect; + /** + * + * @brief 是否采集鼠标状态,参看 MouseCursorCaptureState{@link #MouseCursorCaptureState}。 + */ + + MouseCursorCaptureState capture_mouse_cursor = MouseCursorCaptureState::kMouseCursorCaptureStateOn; + /** + * + * @brief 屏幕过滤设置,填写不需要采集的窗口 ID,参看 ScreenFilterConfig{@link #ScreenFilterConfig}。 + */ + + ScreenFilterConfig filter_config; + /** + * + * @brief 采集区域的边框高亮设置,参看 HighlightConfig{@link #HighlightConfig}。 + */ + + HighlightConfig highlight_config; +}; + +/** + * + * @type keytype + * @brief 屏幕共享的编码参数配置。 + */ + +struct DesktopCaptureParameters { + /** + * + * @brief 屏幕采集编码最大宽度,单位 px。 + */ + + int max_width = 1920; + /** + * + * @brief 屏幕采集编码最大高度,单位 px。 + */ + + int max_height = 1080; + /** + * + * @brief 屏幕采集编码帧率, 单位 fps。 + */ + + int frame_rate = 15; + /** + * + * @brief 屏幕采集编码码率, -1 为自动码率, SDK 会根据宽高信息选择合适的码率,单位 kbps + */ + + int bitrate = -1; + /** + * + * @brief 最小编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
    + * 最小编码码率必须小于或等于最大编码,否则不对视频流进行编码发送。 + */ + + int min_bitrate = 0; + /** + * + * @brief 是否捕获鼠标光标。 + */ + + bool capture_mouse_cursor = true; + /** + * + * @brief 抓取屏幕时排除窗口列表。这个参数仅在抓取屏幕时生效。 + */ + + view_t* excluded_window_list = nullptr; + /** + * + * @brief 抓取屏幕时排除的窗口数量。 + */ + + int excluded_window_num = 0; + /** + * + * @brief 高亮边框的配置。 + */ + + HighlightConfig highlight_config; +}; + +/** + * + * @type keytype + * @brief 自定义视频渲染器 + */ + +class IVideoSink { +public: + /** + * + * @type keytype + * @brief 视频帧编码格式 + */ + + enum PixelFormat { + /** + * + * @brief YUV I420 格式 + */ + + kI420 = VideoPixelFormat::kVideoPixelFormatI420, + /** + * + * @brief RGBA 格式, 字节序为 R8 G8 B8 A8 + */ + + kRGBA = VideoPixelFormat::kVideoPixelFormatRGBA, + /** + * + * @brief 原始视频帧格式 + */ + + kOriginal = VideoPixelFormat::kVideoPixelFormatUnknown, + }; + /** + * + * @type callback + * @brief 视频帧回调 + * @param video_frame 视频帧结构类,参看 IVideoFrame{@link #IVideoFrame} + * @return 返回值暂未使用 + * @list + */ + + virtual bool onFrame(IVideoFrame* video_frame) = 0; + /** + * + * @type callback + * @brief 获取外部渲染耗时。 + * @note 获取外部渲染耗时进行上报。开发者需要自己计算平均渲染耗时。 + * @list 房间管理 + */ + + virtual int getRenderElapse() = 0; + /** + * + * @type callback + * @brief 释放渲染器。 + * @note 通知开发者渲染器即将被废弃。收到该返回通知后即可释放资源。 + * @list Room Management + */ + + virtual void release() { + } + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoSink() = default; + + /** + * + * @hidden sink id + * @brief sink id + */ + + virtual void* uniqueId() const { return (void *)this; } +}; + +/** + * + * @type keytype + * @brief 本地视频帧回调位置。 + */ + +enum LocalVideoSinkPosition { + /** + * + * @brief 采集后。 + */ + + kLocalVideoSinkPositionAfterCapture, + /** + * + * @brief (默认值)前处理后。 + */ + + kLocalVideoSinkPositionAfterPreProcess +}; + +/** + * + * @type keytype + * @brief 是否将视频帧自动转正。 + */ + +enum VideoApplyRotation { + /** + * + * @brief (默认值)不旋转。 + */ + + kVideoApplyRotationDefault = -1, + /** + * + * @brief 自动转正视频,即根据视频帧的旋转角信息将视频帧旋转到 0 度。 + */ + + kVideoApplyRotation0 = 0, +}; + +/** + * + * @type keytype + * @brief 是否将视频帧镜像。 + */ + +enum VideoSinkMirrorType { + /** + * + * @brief 开启镜像。 + */ + + kVideoSinkMirrorTypeON = 1, + /** + * + * @brief (默认值)不开启镜像。 + */ + + kVideoSinkMirrorTypeOFF = 2, +}; + +/** + * + * @type keytype + * @brief 本地视频帧回调配置。 + */ + +struct LocalVideoSinkConfig { + /** + * + * @brief 本地视频帧回调位置,参看 LocalVideoSinkPosition{@link #LocalVideoSinkPosition},默认回调前处理后的视频帧。 + */ + + LocalVideoSinkPosition position = kLocalVideoSinkPositionAfterPreProcess; + /** + * + * @brief 本地视频帧回调格式,参看 VideoPixelFormat{@link #VideoPixelFormat},默认值为 0。 + */ + + VideoPixelFormat pixel_format = kVideoPixelFormatUnknown; +}; + +/** + * + * @type keytype + * @brief 远端视频帧回调位置。 + */ + +enum RemoteVideoSinkPosition { + /** + * + * @hidden not available + * @brief 解码后。 + */ + + kRemoteVideoSinkPositionAfterDecoder, + /** + * + * @brief (默认值)后处理后。 + */ + + kRemoteVideoSinkPositionAfterPostProcess +}; + +/** + * + * @type keytype + * @brief 远端视频帧回调配置。 + */ + +struct RemoteVideoSinkConfig { + /** + * + * @brief 远端视频帧回调位置,参看 RemoteVideoSinkPosition{@link #RemoteVideoSinkPosition},默认回调后处理后的视频帧。 + */ + + RemoteVideoSinkPosition position = kRemoteVideoSinkPositionAfterPostProcess; + /** + * + * @brief 远端视频帧回调格式,参看 VideoPixelFormat{@link #VideoPixelFormat},默认值为 0。 + */ + + VideoPixelFormat pixel_format = kVideoPixelFormatUnknown; + /** + * + * @brief 是否将视频帧自动转正,参看 VideoApplyRotation{@link #VideoApplyRotation},默认为不旋转。 + */ + + VideoApplyRotation apply_rotation = kVideoApplyRotationDefault; + /** + * + * @brief 是否将视频帧镜像。参看 VideoSinkMirrorType{@link #VideoSinkMirrorType},默认为不镜像。
    + * 本设置与 setRemoteVideoMirrorType{@link #IRTCEngine#setRemoteVideoMirrorType} (适用于内部渲染)相互独立。 + */ + + VideoSinkMirrorType mirror_type = kVideoSinkMirrorTypeOFF; +}; + +/** + * + * @hidden + * @type keytype + * @deprecated since 3.29 and will be deleted in 3.51, use MirrorType{@link #MirrorType} instead. + * @brief 是否开启镜像模式 + */ + +enum MirrorMode { + /** + * + * @brief 不开启 + */ + + kMirrorModeOff = 0, + /** + * + * @brief 开启 + */ + + kMirrorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 镜像类型 + */ + +enum MirrorType : int { + /** + * + * @brief 本地预览和编码传输时均无镜像效果 + */ + + kMirrorTypeNone = 0, + /** + * + * @brief 本地预览时有镜像效果,编码传输时无镜像效果 + */ + + kMirrorTypeRender = 1, + /** + * + * @brief 本地预览时无镜像效果,仅编码传输时有镜像效果 + */ + + kMirrorTypeEncoder = 2, + /** + * + * @brief 本地预览和编码传输时均有镜像效果 + */ + + kMirrorTypeRenderAndEncoder = 3, +}; + + +/** + * + * @type keytype + * @brief 远端流的镜像类型。 + */ + +enum RemoteMirrorType { + /** + * + * @brief (默认值)远端视频渲染无镜像效果。 + */ + + kRemoteMirrorTypeNone = 0, + /** + * + * @brief 远端视频渲染有镜像效果。 + */ + + kRemoteMirrorTypeRender = 1, +}; + +/** + * + * @type keytype + * @brief 弱光适应类型 + */ + +enum VideoEnhancementMode { + /** + * + * @brief 关闭弱光适应 + */ + + kVideoEnhancementModeDisabled = 0, + /** + * + * @brief 开启弱光适应 + */ + + kVideoEnhancementModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 视频输入源类型 + */ + +enum VideoSourceType { + /** + * + * @brief 自定义采集视频源 + */ + + kVideoSourceTypeExternal = 0, + /** + * + * @brief 内部采集视频源 + */ + + kVideoSourceTypeInternal = 1, + /** + * + * @brief 自定义编码视频源。
    + * 你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流 + */ + + kVideoSourceTypeEncodedWithAutoSimulcast = 2, + /** + * + * @brief 自定义编码视频源。
    + * SDK 不会自动生成多路流,你需要自行生成并推送多路流 + */ + + kVideoSourceTypeEncodedWithoutAutoSimulcast = 3, +}; + +/** + * + * @type keytype + * @brief Alpha 通道相对于 RGB 通道数据的排列位置。 + */ + +enum AlphaLayout { + /** + * + * @brief Alpha 数据置于 RGB 数据上方。 + */ + + kAlphaLayoutTop = 0, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据下方。 + */ + + kAlphaLayoutBottom = 1, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据左方。 + */ + + kAlphaLayoutLeft = 2, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据右方。 + */ + + kAlphaLayoutRight = 3, +}; + +/** + * + * @type keytype + * @brief 数码变焦参数类型 + */ + +enum ZoomConfigType { + /** + * + * @brief 设置缩放系数 + */ + + kZoomConfigTypeFocusOffset = 0, + /** + * + * @brief 设置移动步长 + */ + + kZoomConfigTypeMoveOffset, +}; + +/** + * + * @type keytype + * @brief 数码变焦操作类型 + */ + +enum ZoomDirectionType { + /** + * + * @brief 相机向左移动 + */ + + kZoomDirectionTypeMoveLeft = 0, + /** + * + * @brief 相机向右移动 + */ + + kZoomDirectionTypeMoveRight, + /** + * + * @brief 相机向上移动 + */ + + kZoomDirectionTypeMoveUp, + /** + * + * @brief 相机向下移动 + */ + + kZoomDirectionTypeMoveDown, + /** + * + * @brief 相机缩小焦距 + */ + + kZoomDirectionTypeZoomOut, + /** + * + * @brief 相机放大焦距 + */ + + kZoomDirectionTypeZoomIn, + /** + * + * @brief 恢复到原始画面 + */ + + kZoomDirectionTypeReset, +}; + +/** + * + * @type keytype + * @brief 视频帧信息 + */ + +struct VideoFrameInfo { + /** + * + * @brief 宽(像素) + */ + + int width = 0; + /** + * + * @brief 高(像素) + */ + + int height = 0; + /** + * + * @brief 视频帧顺时针旋转角度。参看 VideoRotation{@link #VideoRotation}。 + */ + + VideoRotation rotation = VideoRotation::kVideoRotation0; +}; + +/** +* +* @type keytype +* @brief 自定义视频前处理(Video Processor)的作用范围,包括仅预览、仅编码和同时预览与编码。 +*/ + +enum ProcessorActionDomain { + /** + * + * @brief 处理后的视频帧同时用于本地预览和推流编码。 + */ + + kProcessorActionDomainPreviewAndEncode = 0, + /** + * + * @brief 处理后的视频帧仅用于本地预览。 + */ + + kProcessorActionDomainPreview = 1, + /** + * + * @brief 处理后的视频帧仅用于推流编码。 + */ + + kProcessorActionDomainEncode = 2 +}; +/** + * + * @type keytype + * @brief 视频前处理配置参数。 + */ + +struct VideoPreprocessorConfig { + /** + * + * @brief 视频帧像素格式,参看 VideoPixelFormat{@link #VideoPixelFormat}
    + * 当前仅支持 `kVideoPixelFormatI420` 和 `kVideoPixelFormatUnknown` 格式。 + */ + + VideoPixelFormat required_pixel_format = kVideoPixelFormatUnknown; + /** + * + * @brief 自定义视频前处理的作用范围,参看 ProcessorActionDomain{@link #ProcessorActionDomain}。 + */ + + ProcessorActionDomain action_domain = kProcessorActionDomainPreviewAndEncode; +}; + +/** + * + * @type keytype + * @brief 自定义编码流信息 + */ + +struct VideoRateInfo { + /** + * + * @brief 帧率,单位 fps + */ + + int fps = 0; + /** + * + * @brief 码率,单位 kbps + */ + + int bitrate_kbps = 0; + /** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `min_bitrate_kbps`。
    + * 默认值为 `0`。
    + * 范围:[0, bitrate_kbps),当 `bitrate_kbps` < `min_bitrate_kbps` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `bitrate_kbps` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `bitrate_kbps` < `0` 时,适配码率模式。 + */ + + int min_bitrate_kbps = 0; +}; + +/** + * + * @type keytype + * @brief 视频解码方式 + */ + +enum VideoDecoderConfig { + /** + * + * @brief 开启 SDK 内部解码,只回调解码后的数据。回调为 onFrame{@link #IVideoSink#onFrame}。 + */ + + kVideoDecoderConfigRaw, + /** + * + * @brief 开启自定义解码,只回调解码前数据。回调为 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame}。 + */ + + kVideoDecoderConfigEncode, + /** + * + * @brief 开启 SDK 内部解码,同时回调解码前和解码后的数据。回调为 onFrame{@link #IVideoSink#onFrame} 和 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame}。 + */ + + kVideoDecoderConfigBoth, +}; + +/** + * + * @type keytype + * @brief 视频采集配置参数。 + */ + +struct VideoCaptureConfig { + /** + * + * @type keytype + * @brief 视频采集模式 + */ + + enum CapturePreference { + /** + * + * @brief (默认)自动设置采集参数。
    + * SDK 在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。 + */ + + kAuto = 0, + /** + * + * @brief 手动设置采集参数,包括采集分辨率、帧率。 + */ + + kManual = 1, + /** + * + * @brief 采集参数与编码参数一致,即在 setVideoEncoderConfig{@link #IRTCEngine#setVideoEncoderConfig} 中设置的参数。 + */ + + kAutoPerformance = 2, + }; + /** + * + * @brief 视频采集模式,参看 CapturePreference{@link #CapturePreference}. + */ + + CapturePreference capture_preference = CapturePreference::kAuto; + + /** + * + * @brief 视频采集分辨率的宽度,单位:px。 + */ + + int width = 0; + /** + * + * @brief 视频采集分辨率的高度,单位:px。 + */ + + int height = 0; + /** + * + * @brief 视频采集帧率,单位:fps。 + */ + + int frame_rate = 0; +}; + +/** + * + * @type keytype + * @brief 本地录制的媒体类型 + */ + +enum RecordingType { + /** + * + * @brief 只录制音频 + */ + + kRecordingTypeAudioOnly = 0, + /** + * + * @brief 只录制视频 + */ + + kRecordingTypeVideoOnly = 1, + /** + * + * @brief 同时录制音频和视频 + */ + + kRecordingTypeVideoAndAudio = 2, +}; + +/** + * + * @type keytype + * @brief 当前视频设备类型 + */ + +enum RTCVideoDeviceType { + /** + * + * @brief 未知设备类型 + */ + + kRTCVideoDeviceTypeUnknown = -1, + /** + * + * @brief 视频渲染设备类型 + */ + + kRTCVideoDeviceTypeRenderDevice = 0, + /** + * + * @brief 视频采集设备类型 + */ + + kRTCVideoDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流视频设备 + */ + + kRTCVideoDeviceTypeScreenCaptureDevice = 2, +}; + +/** + * + * @deprecated since 3.60, see onMixedStreamEvent{@link #IRTCEngineEventHandler#onMixedStreamEvent}. + * @type errorcode + * @brief WTN 流状态码 + */ + +enum PublicStreamErrorCode { + /** + * + * @brief 发布或订阅成功。 + */ + + kPublicStreamErrorCodeOK = 0, + /** + * + * @brief 订阅失败,发布端未开始发布流。 + */ + + kPublicStreamErrorCodePullNoPushStream = 1300, +}; + +/** + * + * @type keytype + * @brief 视频旋转模式 + */ + +enum VideoRotationMode { + /** + * + * @brief 跟随 App 界面方向 + */ + + kVideoRotationModeFollowApp = 0, + /** + * + * @brief 跟随设备重力方向 + */ + + kVideoRotationModeFollowGSensor = 1, +}; + +/** + * + * @type keytype + * @brief 媒体流类型 + */ + +enum MediaStreamType { + /** + * + * @brief 只控制音频 + */ + + kMediaStreamTypeAudio = 1 << 0, + /** + * + * @brief 只控制视频 + */ + + kMediaStreamTypeVideo = 1 << 1, + /** + * + * @brief 同时控制音频和视频 + */ + + kMediaStreamTypeBoth = kMediaStreamTypeAudio | kMediaStreamTypeVideo +}; +/** + * + * @type keytype + * @brief 占发布端原始帧率的比例 + */ + +enum FrameRateRatio { + /** + * + * @brief 100% + */ + + kFrameRateRatioOriginal = 0, + /** + * + * @brief 50% + */ + + kFrameRateRatioHalf = 1, + /** + * + * @brief 25% + */ + + kFrameRateRatioQuarter = 2, +}; +/** + * + * @type keytype + * @brief 远端视频帧信息 + */ + +struct RemoteVideoConfig { + /** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0 即满帧订阅,设为大于 0 的值时开始生效。
    + * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
    + * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + + int framerate = 0; + /** + * + * @brief 视频宽度,单位:px + */ + + int resolution_width = 0; + /** + * + * @brief 视频高度,单位:px + */ + + int resolution_height = 0; +}; + +/** + * + * @type keytype + * @brief 游戏房间类型 + */ + +enum GameRoomType { + /** + * + * @brief 小队房间。 + */ + + kGameRoomTypeTeam = 0, + /** + * + * @brief 世界房间。 + */ + + kGameRoomTypeWorld = 1 +}; + +/** + * + * @type keytype + * @brief 游戏场景类型 + */ + +enum GameSceneType { + /** + * + * @brief 普通场景。
    + * 同一个小队房间的队友,仅支持在同一个世界房间内通话。 + */ + + kGameSceneTypeNormal = 0, + /** + * + * @brief 主题公园场景。
    + * 同一个小队房间的队友,支持跨世界房间通话。 + */ + + kGameSceneTypeThemePark = 1 +}; + +/** + * + * @type keytype + * @brief 游戏房间配置。房间是 RTC 通话的抽象概念。在同一个房间中的用户可以进行音视频通话。 + */ + +struct GameRoomConfig { + /** + * + * @type keytype + * @brief 游戏房间类型。参看 GameRoomType{@link #GameRoomType},默认为 `kGameRoomTypeTeam`(小队房间),进房后不可更改。 + */ + + GameRoomType game_room_type = GameRoomType::kGameRoomTypeTeam; + /** + * + * @type keytype + * @brief 游戏场景类型。参看 GameSceneType{@link #GameSceneType},默认为 `kGameSceneTypeNormal`(普通场景),进房后不可更改。 + */ + + GameSceneType game_scene_type = GameSceneType::kGameSceneTypeNormal; +}; + +/** + * + * @type keytype + * @brief 房间参数配置。房间是 RTC 通话的抽象概念。在同一个房间中的用户可以进行音视频通话。 + */ + +struct RTCRoomConfig { + /** + * + * @brief 房间模式,参看 RoomProfileType{@link #RoomProfileType},默认为 `kRoomProfileTypeCommunication`,进房后不可更改。 + */ + + RoomProfileType room_profile_type = kRoomProfileTypeCommunication; + /** + * + * @brief 直播模式,参看 RoomLiveMode{@link #RoomLiveMode},默认为 `kRoomLiveModeCoHost`,进房后可通过 setLiveMode{@link #IRTCRoom#setLiveMode} 设置。 + * @note 只有当`room_profile_type`为`kRoomProfileTypeLive`时,`live_mode`的值才有效。 + */ + + RoomLiveMode live_mode = kRoomLiveModeCoHost; + /** + * + * @brief 流 ID。为进房发布的流设置流 ID,可设置为空字符串。若为空,SDK 自动生成 stream_id。 + */ + + const char* stream_id = nullptr; + /** + * + * @brief 是否自动发布音频流,默认为自动发布。 + * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + + bool is_auto_publish_audio = true; + /** + * + * @brief 是否自动发布视频流,默认为自动发布。
    + * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + + bool is_auto_publish_video = true; + + /** + * + * @brief 是否自动订阅音频流,默认为自动订阅。 + */ + + bool is_auto_subscribe_audio = true; + /** + * + * @brief 是否自动订阅视频流,默认为自动订阅。 + */ + + bool is_auto_subscribe_video = true; +}; + +/** + * + * @type keytype + * @brief 屏幕采集的媒体类型 + */ + +enum ScreenMediaType { + /** + * + * @brief 仅采集视频 + */ + + kScreenMediaTypeVideoOnly = 0, + /** + * + * @brief 仅采集音频 + */ + + kScreenMediaTypeAudioOnly = 1, + /** + * + * @brief 同时采集音频和视频 + */ + + kScreenMediaTypeVideoAndAudio = 2, +}; + +/** + * + * @type keytype + * @brief 基础美颜模式。 + */ + +enum EffectBeautyMode { + /** + * + * @brief 美白。 + */ + + kEffectBeautyModeWhite = 0, + /** + * + * @brief 磨皮。 + */ + + kEffectBeautyModeSmooth = 1, + /** + * + * @brief 锐化。 + */ + + kEffectBeautyModeSharpen = 2, + /** + * + * @valid since 3.55 + * @brief 清晰,需集成 v4.4.2+ 版本的特效 SDK。 + */ + + kEffectBeautyModeClear = 3, +}; + +/** + * + * @type keytype + * @brief 视频设备朝向类型 + */ + +enum VideoDeviceFacing { + /** + * + * @brief 前置摄像头 + */ + + kVideoDeviceFacingFront = 0, + /** + * + * @brief 后置摄像头 + */ + + kVideoDeviceFacingBack = 1, + /** + * + * @brief 未知类型 + */ + + kVideoDeviceFacingUnknown = 2, +}; + +/** + * + * @type keytype + * @brief 视频设备信息 + */ + +struct VideoDeviceInfo { + /** + * + * @brief 设备 ID + */ + + char device_id[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备名称 + */ + + char device_name[MAX_DEVICE_ID_LENGTH]; + /** + * + * @brief 设备的厂商 ID + */ + + int64_t device_vid; + /** + * + * @brief 设备的产品编码 + */ + + int64_t device_pid; + /** + * + * @brief 设备的传输方式 + */ + + DeviceTransportType transport_type; + /** + * + * @brief 视频设备朝向类型 + */ + + VideoDeviceFacing device_facing; + /** + * + * @hidden constructor/destructor + */ + + VideoDeviceInfo() { + memset(device_id, 0, MAX_DEVICE_ID_LENGTH); + memset(device_name, 0, MAX_DEVICE_ID_LENGTH); + this->device_vid = 0; + this->device_pid = 0; + this->transport_type = DeviceTransportType::kDeviceTransportTypeUnknown; + this->device_facing = VideoDeviceFacing::kVideoDeviceFacingFront; + }; + /** + * + * @hidden constructor/destructor + */ + + VideoDeviceInfo& operator=(const VideoDeviceInfo& src) { + if (this != &src) { + strncpy(device_id, src.device_id, MAX_DEVICE_ID_LENGTH - 1); + strncpy(device_name, src.device_name, MAX_DEVICE_ID_LENGTH - 1); + device_id[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_name[MAX_DEVICE_ID_LENGTH - 1] = '\0'; + device_vid = src.device_vid; + device_pid = src.device_pid; + transport_type = src.transport_type; + device_facing = src.device_facing; + } + + return *this; + } +}; + +/** + * + * @type keytype + * @brief 视频帧朝向 + */ + +enum VideoOrientation { + /** + * + * @brief (默认)使用相机输出的原始视频帧的角度,不对视频帧进行额外旋转。 + */ + + kVideoOrientationAdaptive = 0, + /** + * + * @brief 固定为竖屏,将相机采集到的视频帧转换为竖屏,在整个 RTC 链路中传递竖屏帧。 + */ + + kVideoOrientationPortrait = 1, + /** + * + * @brief 固定为横屏,将相机采集到的视频帧转换为横屏,在整个 RTC 链路中传递横屏帧。 + */ + + kVideoOrientationLandscape = 2 +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分状态改变原因。 + */ + +enum VideoSuperResolutionModeChangedReason { + /** + * + * @brief 调用 setRemoteVideoSuperResolution{@link #IRTCEngine#setRemoteVideoSuperResolution} 成功关闭超分。 + */ + + kVideoSuperResolutionModeChangedReasonAPIOff = 0, + /** + * + * @brief 调用 setRemoteVideoSuperResolution{@link #IRTCEngine#setRemoteVideoSuperResolution} 成功开启超分。 + */ + + kVideoSuperResolutionModeChangedReasonAPIOn = 1, + /** + * + * @brief 开启超分失败,远端视频流的原始视频分辨率超过 640 × 360 px。 + */ + + kVideoSuperResolutionModeChangedReasonResolutionExceed = 2, + /** + * + * @brief 开启超分失败,已对一路远端流开启超分。 + */ + + kVideoSuperResolutionModeChangedReasonOverUse = 3, + /** + * + * @brief 设备不支持使用超分辨率。 + */ + + kVideoSuperResolutionModeChangedReasonDeviceNotSupport = 4, + /** + * + * @brief 当前设备性能存在风险,已动态关闭超分。 + */ + + kVideoSuperResolutionModeChangedReasonDynamicClose = 5, + /** + * + * @brief 超分因其他原因关闭。 + */ + + kVideoSuperResolutionModeChangedReasonOtherSettingDisabled = 6, + /** + * + * @brief 超分因其他原因开启。 + */ + + kVideoSuperResolutionModeChangedReasonOtherSettingEnabled = 7, + /** + * + * @brief SDK 没有编译超分组件。 + */ + + kVideoSuperResolutionModeChangedReasonNoComponent = 8, + /** + * + * @brief 远端流不存在。房间 ID 或用户 ID 无效,或对方没有发布流。 + */ + + kVideoSuperResolutionModeChangedReasonStreamNotExist = 9, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 视频降噪模式状态改变原因。 + */ + +enum VideoDenoiseModeChangedReason { + /** + * + * @brief 未知原因导致视频降噪状态改变。 + */ + + kVideoDenoiseModeChangedReasonNull = -1, + /** + * + * @brief 通过调用 setVideoDenoiser{@link #IRTCEngine#setVideoDenoiser} 成功关闭视频降噪。 + */ + + kVideoDenoiseModeChangedReasonApiOff = 0, + /** + * + * @brief 通过调用 setVideoDenoiser{@link #IRTCEngine#setVideoDenoiser} 成功开启视频降噪。 + */ + + kVideoDenoiseModeChangedReasonApiOn = 1, + /** + * + * @brief 后台未配置视频降噪,视频降噪开启失败,请联系技术人员解决。 + */ + + kVideoDenoiseModeChangedReasonConfigDisabled = 2, + /** + * + * @brief 后台配置开启了视频降噪。 + */ + + kVideoDenoiseModeChangedReasonConfigEnabled = 3, + /** + * + * @brief 由于内部发生了异常,视频降噪关闭。 + */ + + kVideoDenoiseModeChangedReasonInternalException = 4, + /** + * + * @brief 当前设备性能过载,已动态关闭视频降噪。 + */ + + kVideoDenoiseModeChangedReasonDynamicClose = 5, + /** + * + * @brief 当前设备性能裕量充足,已动态开启视频降噪。 + */ + + kVideoDenoiseModeChangedReasonDynamicOpen = 6, + /** + * + * @brief + * 分辨率导致视频降噪状态发生改变。分辨率过高会导致性能消耗过大,从而导致视频降噪关闭。若希望继续使用视频降噪,可选择降低分辨率。 + */ + + kVideoDenoiseModeChangedReasonResolution = 7, +}; + +/** + * + * @type keytype + * @brief 屏幕采集对象的类型 + */ + +enum ScreenCaptureSourceType { + /** + * + * @brief 类型未知 + */ + + kScreenCaptureSourceTypeUnknown, + + /** + * + * @brief 应用程序的窗口 + */ + + kScreenCaptureSourceTypeWindow, + + /** + * + * @brief 桌面 + */ + + kScreenCaptureSourceTypeScreen +}; + +/** + * + * @type keytype + * @brief 屏幕共享对象的详细信息 + */ + +struct ScreenCaptureSourceInfo { + /** + * + * @brief 屏幕共享对象的类型,参看 ScreenCaptureSourceType{@link #ScreenCaptureSourceType} + */ + + ScreenCaptureSourceType type = kScreenCaptureSourceTypeUnknown; + + /** + * + * @brief 屏幕共享对象的 ID + */ + + view_t source_id = nullptr; + /** + * + * @brief 屏幕共享对象的名称
    + * 调用 release{@link #IScreenCaptureSourceList#release} 时将被释放,请及时转为 string 对象保存 + */ + + const char* source_name = nullptr; + /** + * + * @brief 共享的应用窗体所属应用的名称
    + * 当共享对象为应用窗体时有效
    + * 调用 release{@link #IScreenCaptureSourceList#release} 时将被释放,请及时转为 string 对象保存 + */ + + const char* application = nullptr; + /** + * + * @brief 共享的应用窗体所属应用进程的 pid
    + * 当共享对象为应用窗体时有效 + */ + + int pid = 0; + /** + * + * @brief 共享的屏幕是否为主屏。
    + * 当共享对象为屏幕时有效 + */ + + bool primary_monitor = false; + /** + * + * @brief 屏幕共享对象的坐标。详见 Rectangle{@link #Rectangle}。
    + * 仅在采集源为显示器屏幕时有效。
    + * - 对于多屏幕的场景,不同平台的坐标系原点不同: + * - 对于 Windows 平台,屏幕坐标以主屏左上角为原点 (0, 0),向右向下扩展。 + * — 对于 Linux 平台,屏幕坐标以 **恰好包住所有显示器的矩形区域的左上角** 为原点 (0, 0),向右向下扩展。
    + * - 对于不同平台,窗口区域不同: + * - 对于 Windows 和 macOS 平台,窗口区域包含系统标题栏。 + * - 对于 Linux 平台,窗口区域不包含系统标题栏。 + */ + + Rectangle region_rect; +}; +/** + * + * @type api + * @brief 屏幕共享对象信息列表
    + * 共享对象相关数据将在调用 release{@link #IScreenCaptureSourceList#release} 后被释放。 + * @list 屏幕共享 + */ + +class IScreenCaptureSourceList { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IScreenCaptureSourceList() { + } + /** + * + * @type api + * @brief 获取列表长度 + * @return 可共享对象数量 + * @list 屏幕共享 + */ + + virtual int32_t getCount() = 0; + /** + * + * @type api + * @brief 根据索引号,获取屏幕共享列表中的元素 + * @param index 列表索引号 + * @return 屏幕源类型信息,详见 ScreenCaptureSourceInfo{@link #ScreenCaptureSourceInfo}。 + * @list 屏幕共享 + */ + + virtual ScreenCaptureSourceInfo getSourceInfo(int32_t index) = 0; + /** + * + * @type api + * @brief IScreenCaptureSourceList{@link #IScreenCaptureSourceList} 使用结束后,调用本接口删除对象,清空和释放内存。 + * @list 屏幕共享 + */ + + virtual void release() = 0; +}; +/** + * + * @type callback + * @brief 自定义编码帧回调类
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Screen Sharing + */ + +class IExternalVideoEncoderEventHandler { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IExternalVideoEncoderEventHandler(){} + /** + * + * @type callback + * @brief 提示自定义编码帧可以开始推送的回调。
    + * 收到该回调后,你即可调用 pushExternalEncodedVideoFrame{@link #IRTCEngine#pushExternalEncodedVideoFrame} 向 SDK 推送自定义编码视频帧 + * @param stream_id 编码流 ID + * @param stream_info 编码流信息,参看 StreamInfo{@link #StreamInfo} + * @list 自定义流处理 + */ + + virtual void onStart(const char* stream_id, const StreamInfo& stream_info) = 0; + /** + * + * @type callback + * @brief 当收到该回调时,你需停止向 SDK 推送自定义编码视频帧 + * @param stream_id 编码流 ID + * @param stream_info 编码流信息,参看 StreamInfo{@link #StreamInfo} + * @list 自定义流处理 + */ + + virtual void onStop(const char* stream_id, const StreamInfo& stream_info) = 0; + /** + * + * @type callback + * @brief 当自定义编码流的帧率或码率发生变化时,触发该回调 + * @param stream_id 远端编码流 ID + * @param stream_info 远端编码流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_index 对应编码流的下标 + * @param info 变化后的编码流信息,参看 VideoRateInfo{@link #VideoRateInfo} + * @list 自定义流处理 + */ + + virtual void onRateUpdate(const char* stream_id, const StreamInfo& stream_info, int32_t video_index, VideoRateInfo info) = 0; + /** + * + * @type callback + * @brief 提示流发布端需重新生成关键帧的回调 + * @param stream_id 远端编码流 ID + * @param stream_info 远端编码流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_index 对应编码流的下标 + * @list 自定义流处理 + */ + + virtual void onRequestKeyFrame(const char* stream_id, const StreamInfo& stream_info, int32_t video_index) = 0; + /** + * + * @valid since 3.56 + * @type callback + * @brief 作为自定义编码视频流的发送端,你会在视频流可发送状态发生变化时,收到此回调。
    + * 你可以根据此回调的提示,仅对可发送的视频流进行编码,以降低本端视频编码性能消耗。此回调会根据多个因素综合判断触发,包括:本端设备性能和本端网络性能,以及按需订阅场景下,远端用户是否订阅。 + * @param stream_id 远端编码流 ID + * @param stream_info 远端编码流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_index 对应编码流的下标 + * @param active 该路流可发送状态 + * @note 要收到此回调,必须调用 setVideoSourceType{@link #IRTCEngine#setVideoSourceType} 设置视频源是自定义编码,且通过 setExternalVideoEncoderEventHandler{@link #IRTCEngine#setExternalVideoEncoderEventHandler} 设置了回调句柄。 + * @list 自定义流处理 + */ + + virtual void onActiveVideoLayer(const char* stream_id, const StreamInfo& stream_info, int32_t video_index, bool active) = 0; +}; +/** + * + * @type callback + * @brief 本地视频帧监测器
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 自定义流处理 + */ + +class ILocalEncodedVideoFrameObserver { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~ILocalEncodedVideoFrameObserver() { + } + /** + * + * @type callback + * @brief 调用 registerLocalEncodedVideoFrameObserver{@link #IRTCEngine#registerLocalEncodedVideoFrameObserver} 后,SDK 每次使用内部采集,采集到一帧视频帧,或收到一帧外部视频帧时,都会回调该事件。 + * @param video_source 预留参数。 + * @param video_stream 本地视频帧信息,参看 IEncodedVideoFrame{@link #IEncodedVideoFrame} + * @list 自定义流处理 + */ + + virtual void onLocalEncodedVideoFrame(IVideoSource *video_source, const IEncodedVideoFrame& video_stream) = 0; +}; +/** + * + * @type callback + * @brief 远端编码后视频数据监测器
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频管理 + */ + +class IRemoteEncodedVideoFrameObserver { +public: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IRemoteEncodedVideoFrameObserver() { + } + /** + * + * @type callback + * @brief 调用 registerRemoteEncodedVideoFrameObserver{@link #IRTCEngine#registerRemoteEncodedVideoFrameObserver} 后,SDK 监测到远端编码后视频数据时,触发该回调 + * @param stream_id 收到的远端流 ID + * @param stream_info 收到的远端流信息,参看 StreamInfo{@link #StreamInfo} + * @param video_stream 收到的远端视频帧信息,参看 IEncodedVideoFrame{@link #IEncodedVideoFrame} + * @list 自定义流处理 + */ + + virtual void onRemoteEncodedVideoFrame(const char* stream_id, const StreamInfo& stream_info, const IEncodedVideoFrame& video_stream) = 0; +}; + +/** + * + * @type keytype + * @brief 视频帧中包含的 metadata 信息 + */ + +struct VideoMetadataBuffer { + /** + * + * @brief 接收或者发送的 metadata + */ + + char* data; + /** + * + * @brief 接收或者发送的 metadata 数据大小,不能超过 1024 + */ + + int size; + /** + * + * @brief 包含 metadata 视频帧的时间戳,单位微秒 + */ + + int64_t timestamp_us; +}; + +/** + * + * @hidden(Linux) + * @type callback + * @brief 截图的回调。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Video Management + */ + +class ISnapshotResultCallback { +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~ISnapshotResultCallback() = default; + /** + * + * @type callback + * @brief 调用 takeLocalSnapshot{@link #IRTCEngine#takeLocalSnapshot} 截取视频画面时,收到此回调。 + * @param task_id 本地截图任务的编号。和 takeLocalSnapshot{@link #IRTCEngine#takeLocalSnapshot} 的返回值一致。 + * @param video_source 截图的视频源,参看IVideoSource{@link #IVideoSource}。 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param error_code 截图错误码:
    + * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + + virtual void onTakeLocalSnapshotResult(long task_id, IVideoSource* video_source, IVideoFrame* image, int error_code) = 0; + /** + * + * @type callback + * @brief 调用 takeRemoteSnapshot{@link #IRTCEngine#takeRemoteSnapshot} 截取视频画面时,收到此回调。 + * @param task_id 远端截图任务的编号。和 takeRemoteSnapshot{@link #IRTCEngine#takeRemoteSnapshot} 的返回值一致。 + * @param stream_id 远端流 ID + * @param stream_info 远端流信息,参看 StreamInfo{@link #StreamInfo}。 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param error_code 截图错误码:
    + * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + + virtual void onTakeRemoteSnapshotResult(long task_id, const char* stream_id, const StreamInfo& stream_info, IVideoFrame* image, int error_code) = 0; +}; +/** + * + * @hidden(macOS, Windows, Linux) + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +struct MediaTypeEnhancementConfig { + /** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_signaling = false; + /** + * + * @brief 对屏幕共享以外的其他音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_audio = false; + /** + * + * @brief 对屏幕共享音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_screen_audio = false; + /** + * + * @brief 对屏幕共享视频以外的其他视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_video = false; + /** + * + * @brief 对屏幕共享视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + + bool enhance_screen_video = false; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines_ex.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines_ex.h new file mode 100644 index 0000000..3d7e0b0 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_defines_ex.h @@ -0,0 +1,183 @@ + + + +#pragma once +namespace bytertc { +/** + * + * @type keytype + * @brief 视频内容类型 + */ + +enum VideoContentCategory { + /** + * + * @brief 相机采集的内容 + */ + + kVideoContentCategoryCamera = 0, + /** + * + * @brief 屏幕共享的内容 + */ + + kVideoContentCategoryScreen = 1, +}; +/** + * + * @type keytype + * @brief 视频源设置 + */ + +struct VideoSourceConfig { + /** + * + * @brief 视频源类型。参看 VideoSourceType{@link #VideoSourceType}。默认是 `kVideoSourceTypeExternal`。 + */ + + VideoSourceType source_type = kVideoSourceTypeExternal; + /** + * + * @brief 参看 VideoContentCategory{@link #VideoContentCategory}。默认是 `kVideoContentCategoryCamera`。 + */ + /** + * + * @brief Refer to VideoContentCategory{@link #VideoContentCategory}. It defaults to `kVideoContentCategoryCamera`. + */ + VideoContentCategory content_category = kVideoContentCategoryCamera; +}; +/** + * + * @type keytype + * @brief 音频源包含的内容 + */ + +struct AudioContentTypeConfig { + /** + * + * @brief 包含麦克风采集的音频 + */ + + bool has_mic = true; + /** + * + * @brief 包含屏幕音频 + */ + + bool has_screen_audio = false; + /** + * + * @brief 包含媒体播放器的音频 + */ + + bool has_media_player = false; +}; +/** + * + * @type keytype + * @brief 音频编码设置。 + */ + +struct AudioEncodeConfig { + /** + * + * @brief 编码器类型。
    + * + 0:OPUS
    + * + 1:NICO
    + * + -1:配置下发的配置 + */ + + int codec_type = -1; + /** + * + * @brief 编码模式
    + * + 0:语音
    + * + 1:音乐
    + * + -1:根据 `channel_num` 不同,使用对应的编码模式。声道数为 `1` 时,编码模式是语音;声道数为 `2` 时,编码模式是音乐。 + */ + int enc_mode = -1; + /** + * + * @brief 声道数。取值范围是:`{1, 2}`。默认值是 `-1`,配置下发的配置。 + */ + int channel_num = -1; + /** + * + * @brief 码率。取值范围:`[6K, 510K]`。 + */ + int enc_bitrate = -1; + /** + * + * @brief 是否启用非连续传输功能(DTX)。非连续传输功能能够在安静的场景下降低码率。
    + * + 0:关闭
    + * + 1:打开
    + * + -1:配置下发的配置 + */ + int use_dtx = -1; + /** + * + * @brief 带内前向纠错功能。能够提供一定的抗丢包能力。
    + * + 0:关闭
    + * + 1:打开
    + * + -1:配置下发的配置 + */ + int use_inbandfec = -1; + /** + * + * @brief 采样率。取值范围是 `[16K, 48K]`。
    + * 修改此参数会触发编码器重启。 + */ + int sample_rate = -1; + /** + * + * @brief 编码帧长。取值范围:`{10, 20, 40, 60, 120}`。 + */ + int packet_size = -1; +}; +/** + * + * @type keytype + * @brief 媒体流的优先级 + */ +enum StreamPriority { + /** + * + * @brief 低优先级 + */ + kStreamPriorityLow = 0, + /** + * + * @brief 中优先级 + */ + kStreamPriorityNormal = 1, + /** + * + * @brief 高优先级 + */ + kStreamPriorityHigh = 2, +}; + +/** + * + * @type keytype + * @brief + */ +struct StreamKey { + /** + * + * @brief 房间 ID + */ + const char* room_id; + /** + * + * @brief 用户 ID + */ + const char* user_id; + /** + * + * @brief 流索引。参看 StreamIndex{@link #StreamIndex}。 + */ + StreamIndex stream_index; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_device_manager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_device_manager.h new file mode 100644 index 0000000..08cae2a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_device_manager.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Device Manager +*/ + +#pragma once + +#include "bytertc_audio_device_manager.h" +#include "bytertc_video_defines.h" + +namespace bytertc { +/** + * + * @type api + * @brief 视频设备相关的信息 + * @list 引擎管理 + */ + +class IVideoDeviceCollection : public IDeviceCollection { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IVideoDeviceCollection() {}; + /** + * + * @type api + * @brief 获取当前系统内视频设备数量 + * @return 视频设备数量 + * @list 引擎管理 + */ + + virtual int getCount() override {return 0;}; + /** + * + * @type api + * @brief 获取视频设备信息,可根据索引号、设备名称、设备 ID 获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IVideoDeviceCollection#getCount} 返回值。 + * @param device_name 设备名称 + * @param device_id 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, char device_name[MAX_DEVICE_ID_LENGTH], char device_id[MAX_DEVICE_ID_LENGTH]) override {return 0;}; + /** + * + * @type api + * @brief 释放当前 IVideoDeviceCollection{@link #IVideoDeviceCollection} 对象占用的资源。 + * @note 不需要返回视频设备相关信息列表时应该调用本方法释放相关资源。 + * @list 引擎管理 + */ + + virtual void release()override {}; + /** + * + * @type api + * @brief 获取视频设备信息,可根据索引号、设备信息(ID、设备的产品编码等)。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #IVideoDeviceCollection#getCount} 返回值。 + * @param video_device_info 设备信息 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + + virtual int getDevice(int index, VideoDeviceInfo* video_device_info) = 0; +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoDeviceCollection() {}; +}; +/** + * + * @type api + * @brief 主要用于枚举、设置视频采集设备 + * @list 视频管理 + */ + +class IVideoDeviceManager { +public: + /** + * + * @hidden constructor/destructor + * @brief 构造函数 + */ + + IVideoDeviceManager() { + } + /** + * + * @type api + * @brief 获取当前系统内视频采集设备列表。 + * @return 包含系统中所有视频采集设备的列表,参看 IVideoDeviceCollection{@link #IVideoDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 监听到 `kMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 视频管理 + */ + + virtual IVideoDeviceCollection* enumerateVideoCaptureDevices() = 0; + /** + * + * @type api + * @brief 设置当前视频采集设备 + * @param device_id 视频设备 ID,可以通过 enumerateVideoCaptureDevices{@link #IVideoDeviceManager#enumerateVideoCaptureDevices} 获取 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + + virtual int setVideoCaptureDevice(const char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * + * @type api + * @brief 获取当前 SDK 正在使用的视频采集设备信息 + * @param device_id 视频设备 ID。此参数同时是入参和出参。 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + + virtual int getVideoCaptureDevice(char device_id[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoDeviceManager() { + } +}; + + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_effect_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_effect_interface.h new file mode 100644 index 0000000..06ec3b1 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_effect_interface.h @@ -0,0 +1,655 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Effect Interface +*/ + +#pragma once + +#include +#include "bytertc_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief 虚拟背景类型。 + */ + +enum VirtualBackgroundSourceType { + /** + * + * @brief 使用纯色背景替换视频原有背景。 + */ + + kVirtualBackgroundSourceTypeColor = 0, + /** + * + * @brief 使用自定义图片替换视频原有背景。 + */ + + kVirtualBackgroundSourceTypeImage = 1, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人像属性检测参数 + */ + +struct VideoEffectExpressionDetectConfig { + /** + * + * @brief 是否开启年龄检测。 + */ + + bool detect_age = false; + /** + * + * @brief 是否开启性别检测。 + */ + + bool detect_gender = false; + /** + * + * @brief 是否开启表情检测。 + */ + + bool detect_emotion = false; + /** + * + * @brief 是否开启吸引力检测。 + */ + + bool detect_attractiveness = false; + /** + * + * @brief 是否开启开心程度检测。 + */ + + bool detect_happiness = false; +}; + +/** + * + * @type keytype + * @brief 虚拟背景对象。 + */ + +struct VirtualBackgroundSource { + /** + * + * @brief 虚拟背景类型,详见 VirtualBackgroundSourceType{@link #VirtualBackgroundSourceType} 。 + */ + + VirtualBackgroundSourceType source_type = kVirtualBackgroundSourceTypeColor; + /** + * + * @brief 纯色背景使用的颜色。
    + * 格式为 0xAARRGGBB 。 + */ + + uint32_t source_color = 0xFFFFFFFF; + /** + * + * @brief 自定义背景图片的绝对路径。
    + * - 支持的格式为 jpg、jpeg、png。 + * - 图片分辨率超过 1080P 时,图片会被等比缩放至和视频一致。 + * - 图片和视频宽高比一致时,图片会被直接缩放至和视频一致。 + * - 图片和视频长宽比不一致时,为保证图片内容不变形,图片按短边缩放至与视频帧一致,使图片填满视频帧,对多出的高或宽进行剪裁。 + * - 自定义图片带有局部透明效果时,透明部分由黑色代替。 + */ + + const char* source_path = nullptr; +}; +/** + * + * @type keytype + * @brief 人脸检测结果 + */ + +struct FaceDetectResult { + /** + * + * @brief 人脸信息存储上限,最多可存储 10 个人脸信息 + */ + + static const int max_face_num = 10; + /** + * + * @brief 人脸检测结果
    + * - 0:检测成功 + * - !0:检测失败。详见[错误码](https: + */ + + int detect_result = 0; + /** + * + * @brief 检测到的人脸的数量 + */ + + int face_count = 0; + /** + * + * @brief 识别到人脸的矩形框。数组的长度和检测到的人脸数量一致。参看 Rectangle{@link #Rectangle}。 + */ + + Rectangle rect[max_face_num]; + /** + * + * @brief 原始图片宽度(px) + */ + + int image_width = 0; + /** + * + * @brief 原始图片高度(px) + */ + + int image_height = 0; + /** + * + * @brief 进行人脸识别的视频帧的时间戳。 + */ + + int64_t frame_timestamp_us = 0; +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人像属性检测信息 + */ + +struct ExpressionDetectInfo { + /** + * + * @brief 预测年龄,取值范围 (0, 100)。 + */ + + float age = 0; + /** + * + * @brief 预测为男性的概率,取值范围 (0.0, 1.0)。 + */ + + float boy_prob = 0; + /** + * + * @brief 预测的吸引力分数,取值范围 (0, 100)。 + */ + + float attractive = 0; + /** + * + * @brief 预测的微笑程度,取值范围 (0, 100)。 + */ + + float happy_score = 0; + /** + * + * @brief 预测的伤心程度,取值范围 (0, 100)。 + */ + + float sad_score = 0; + /** + * + * @brief 预测的生气程度,取值范围 (0, 100)。 + */ + + float angry_score = 0; + /** + * + * @brief 预测的吃惊程度,取值范围 (0, 100)。 + */ + + float surprise_score = 0; + /** + * + * @brief 预测的情绪激动程度,取值范围 (0, 100)。 + */ + + float arousal = 0; + /** + * + * @brief 预测的情绪正负程度,取值范围 (-100, 100)。 + */ + + float valence = 0; +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人像属性检测结果 + */ + +struct ExpressionDetectResult { + /** + * + * @brief 人脸信息存储上限,最多可存储 10 个人脸信息 + */ + + static const int max_face_num = 10; + /** + * + * @brief 特征识别结果
    + * - 0:识别成功 + * - !0:识别失败 + */ + + int detect_result = 0; + /** + * + * @brief 识别到的人脸数量。 + */ + + int face_count = 0; + /** + * + * @brief 特征识别信息。数组的长度和检测到的人脸数量一致。参看 ExpressionDetectInfo{@link #ExpressionDetectInfo}。 + */ + + ExpressionDetectInfo detect_info[max_face_num]; +}; +/** + * + * @type callback + * @brief 人脸检测结果回调观察者
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频处理 + */ + +class IFaceDetectionObserver { +public: + /** + * + * @type callback + * @brief 特效 SDK 进行人脸检测结果的回调。
    + * 调用 enableFaceDetection{@link #IVideoEffect#enableFaceDetection} 注册了 IFaceDetectionObserver{@link #IFaceDetectionObserver},并使用 RTC SDK 中包含的特效 SDK 进行视频特效处理时,你会收到此回调。 + * @param result 人脸检测结果, 参看 FaceDetectResult{@link #FaceDetectResult}。 + * @list 视频管理 + */ + + virtual void onFaceDetectResult(const FaceDetectResult& result) = 0; + /** + * + * @hidden for internal use only + * @type callback + * @brief 特效 SDK 进行人像属性检测结果的回调。
    + * 调用 registerFaceDetectionObserver注册了 IFaceDetectionObserver{@link #IFaceDetectionObserver},并调用 setVideoEffectExpressionDetect{@link #IVideoEffect#setVideoEffectExpressionDetect} 开启人像属性检测后,你会收到此回调。 + * @param result 人像属性检测结果, 参看 ExpressionDetectResult{@link #ExpressionDetectResult}。 + * @list 视频处理 + */ + + virtual void onExpressionDetectResult(const ExpressionDetectResult& result) = 0; + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IFaceDetectionObserver() { + } +}; +/** + * + * @type api + * @brief 高级视频特效,参看[集成指南](https: + * @list 视频处理 + */ + +class IVideoEffect { +public: + virtual ~IVideoEffect() = default; + /** + * + * @type api + * @brief 检查视频特效证书,设置算法模型路径,并初始化特效模块。 + * @param license_file_path 证书文件的绝对路径,用于鉴权。 + * @param algo_model_dir 算法模型绝对路径,即存放特效 SDK 所有算法模型的目录。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 鉴权时,会检查 CV 服务端时间和本地设备的时间差异。你必须保证本地系统时间和实际时间一致。 + * @list 视频处理 + */ + + virtual int initCVResource(const char* license_file_path, const char* algo_model_dir) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置视频特效算法模型地址,并初始化特效模块。 + * @param finder ResourceFinder 地址 + * @param deleter ResourceDeleter 地址 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + + virtual int setAlgoModelResourceFinder(uintptr_t finder, uintptr_t deleter) = 0; + /** + * + * @hidden(iOS, Android) + * @type api + * @brief 从特效 SDK 获取授权消息,用于获取在线许可证。 + * @param ppmsg 授权消息字符串地址 + * @param len 授权消息字符串的长度 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 使用视频特效的功能前,你必须获取特效 SDK 的在线许可证。 + * - 通过此接口获取授权消息后,你必须参考 [在线授权说明](https: + * - 获取授权消息后,调用 freeAuthMessage{@link #IVideoEffect#freeAuthMessage} 释放内存。 + * @list 视频处理 + */ + + virtual int getAuthMessage(char ** ppmsg, int * len) = 0; + /** + * + * @hidden(iOS,Android) + * @type api + * @brief 使用完授权消息字符串后,释放内存。 + * @param pmsg getAuthMessage 返回的授权消息字符串。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int freeAuthMessage(char * pmsg) = 0; + + /** + * + * @hidden for internal use only + * @region 视频处理 + * @brief 返回视频特效句柄。私有接口 + */ + + virtual void* getEffectHandle() = 0; + /** + * + * @type api + * @brief 开启高级美颜、滤镜等视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource{@link #IVideoEffect#initCVResource} 进行初始化。 + * - 调用该方法后,特效不直接生效,你还需调用 setEffectNodes{@link #IVideoEffect#setEffectNodes} 设置视频特效素材包或调用 setColorFilter{@link #IVideoEffect#setColorFilter} 设置滤镜。 + * - 调用 disableVideoEffect{@link #IVideoEffect#disableVideoEffect} 关闭视频特效。 + * @list 视频处理 + */ + + virtual int enableVideoEffect() = 0; + /** + * + * @type api + * @brief 关闭视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect} 开启视频特效。 + * @list 视频处理 + */ + + virtual int disableVideoEffect() = 0; + /** + * + * @type api + * @brief 设置视频特效素材包。 + * @param effect_node_paths 特效素材包绝对路径数组。
    + * 要取消当前视频特效,将此参数设置为 null。 + * @param node_num 特效素材包个数。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + + virtual int setEffectNodes(const char** effect_node_paths, int node_num) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 叠加视频特效素材包。 + * @param effect_node_paths 特效素材包绝对路径数组。 + * @param node_num 特效素材包个数。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 该接口会在 setEffectNodes{@link #IVideoEffect#setEffectNodes} 设置的特效基础上叠加特效。 + * @list Video Processing + */ + + virtual int appendEffectNodes(const char** effect_node_paths, int node_num) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 移除指定的视频特效资源。 + * @param effect_node_paths 特效素材包绝对路径数组。 + * @param node_num 特效素材包个数。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 移除 setEffectNodes{@link #IVideoEffect#SetEffectNodes} 或 appendEffectNodes{@link #IVideoEffect#appendEffectNodes} 设置的视频特效资源。 + * @list Video Processing + */ + + virtual int removeEffectNodes(const char** effect_node_paths, int node_num) = 0; + /** + * + * @type api + * @brief 设置特效强度。 + * @param effect_node_path 特效素材包绝对路径,参考[素材包结构说明](https: + * @param node_key 需要设置的素材 key 名称,参考[素材 key 对应说明](https: + * @param node_value 特效强度值,取值范围 [0,1],超出范围时设置无效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int updateEffectNode(const char* effect_node_path, const char* node_key, float node_value) = 0; + /** + * + * @type api + * @brief 设置颜色滤镜。 + * @param res_path 滤镜资源包绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 setColorFilterIntensity{@link #IVideoEffect#setColorFilterIntensity} 设置已启用颜色滤镜的强度。设置强度为 0 时即关闭颜色滤镜。 + * @list 视频处理 + */ + + virtual int setColorFilter(const char* res_path) = 0; + /** + * + * @type api + * @brief 设置已启用颜色滤镜的强度。 + * @param intensity 滤镜强度。取值范围 [0,1],超出范围时设置无效。
    + * 当设置滤镜强度为 0 时即关闭颜色滤镜。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int setColorFilterIntensity(float intensity) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 私有接口,设置视频特效素材包。 + * @param sticker_path 特效素材包绝对路径。
    + * 要取消当前视频特效,将此参数设置为 null。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list Video Processing + */ + + virtual int applyStickerEffect(const char* sticker_path) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 设置 Effect SDK 特效素材包。 + * @param effect_path 特效素材包绝对路径。传入空字符串或 null 时清空当前特效。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。 + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + + virtual int setEffect(const char* effect_path) = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 重置当前贴纸特效。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。 + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #IVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + + virtual int resetSticker() = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 将摄像头采集画面中的人像背景替换为指定图片或纯色背景。 + * @param background_sticker_path 背景贴纸特效素材绝对路径。 + * @param source 背景贴纸对象,参看 VirtualBackgroundSource{@link #VirtualBackgroundSource}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource{@link #IVideoEffect#initCVResource} 进行初始化。 + * - 调用 disableVirtualBackground{@link #IVideoEffect#disableVirtualBackground} 关闭虚拟背景。 + * @list 视频处理 + */ + + virtual int enableVirtualBackground(const char* background_sticker_path, const VirtualBackgroundSource& source) = 0; + /** + * + * @hidden(Linux) + * @type api + * @brief 关闭虚拟背景。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVirtualBackground{@link #IVideoEffect#enableVirtualBackground} 开启虚拟背景后,可以调用此接口关闭虚拟背景。 + * @list 视频处理 + */ + + virtual int disableVirtualBackground() = 0; + /** + * + * @hidden for internal use only + * @type api + * @brief 开启人像属性检测。 + * @param expression_detection_config 人像属性检测参数,参看 VideoEffectExpressionDetectConfig{@link #VideoEffectExpressionDetectConfig}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + + virtual int setVideoEffectExpressionDetect(const VideoEffectExpressionDetectConfig& expression_detection_config) = 0; + /** + * + * @type api + * @brief 开启人脸识别功能,并设置人脸检测结果回调观察者。
    + * 回调此观察者后,你会周期性收到 onFaceDetectResult{@link #IFaceDetectionObserver#onFaceDetectResult} 回调。 + * @param observer 人脸检测结果回调观察者,参看 IFaceDetectionObserver{@link #IFaceDetectionObserver}。 + * @param interval_ms 两次回调之间的最小时间间隔,必须大于 0,单位为毫秒。实际收到回调的时间间隔大于 interval_ms,小于 interval_ms+视频采集帧间隔。 + * @param face_model_path 人脸检测算法模型文件路径,一般为 ttfacemodel 文件夹中 tt_face_vXXX.model 文件的绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - -1004: 初始化中,初始化完成后启动此功能。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int enableFaceDetection(IFaceDetectionObserver* observer, unsigned int interval_ms, const char* face_model_path) = 0; + /** + * + * @type api + * @brief 关闭人脸识别功能。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + + virtual int disableFaceDetection() = 0; + +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_frame.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_frame.h new file mode 100644 index 0000000..5eee164 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_frame.h @@ -0,0 +1,1372 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Frame + */ + +#pragma once + +#include +#include +#include +#include +#include "bytertc_media_defines.h" +#ifdef BYTERTC_ANDROID +#include +#endif + +namespace bytertc { + +/** + * + * @type keytype + * @brief 编码帧类型 + */ + +enum VideoPictureType { + /** + * + * @brief 未知类型 + */ + + kVideoPictureTypeUnknown = 0, + /** + * + * @brief I 帧,关键帧,编解码不需要参考其他视频帧 + */ + + kVideoPictureTypeI, + /** + * + * @brief P 帧,向前参考帧,编解码需要参考前一帧视频帧 + */ + + kVideoPictureTypeP, + /** + * + * @brief B 帧,前后参考帧,编解码需要参考前后两帧视频帧 + */ + + kVideoPictureTypeB +}; + +/** + * + * @type keytype + * @brief 视频帧旋转信息 + */ + +enum VideoRotation { + /** + * + * @brief 不旋转 + */ + + kVideoRotation0 = 0, + /** + * + * @brief 顺时针旋转 90 度 + */ + + kVideoRotation90 = 90, + /** + * + * @brief 顺时针旋转 180 度 + */ + + kVideoRotation180 = 180, + /** + * + * @brief 顺时针旋转 270 度 + */ + + kVideoRotation270 = 270 +}; + +/** + * + * @type keytype + * @brief 视频帧缩放模式,默认值为 FitWithCropping。 + */ + +enum VideoStreamScaleMode { + /** + * + * @brief 自动模式 + */ + + kVideoStreamScaleModeAuto = 0, + /** + * + * @brief 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。 + */ + + kVideoStreamScaleModeStretch = 1, + /** + * + * @brief 视窗填满优先。
    + * 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + */ + + kVideoStreamScaleModeFitWithCropping = 2, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。 + */ + + kVideoStreamScaleModeFitWithFilling = 3, +}; + + +/** + * + * @type keytype + * @brief 视频编码模式 + */ + +enum VideoCodecMode { + /** + * + * @brief 自动选择 + */ + + kVideoCodecModeAuto = 0, + /** + * + * @brief 硬编码 + */ + + kVideoCodecModeHardware, + /** + * + * @brief 软编码 + */ + + kVideoCodecModeSoftware, +}; + +/** + * + * @type keytype + * @brief 编码策略偏好。 + */ + +enum VideoEncodePreference { + /** + * + * @brief 无偏好。不降低帧率和分辨率。 + */ + + kVideoEncodePreferenceDisabled = 0, + /** + * + * @brief 优先保障帧率。适用于动态画面。 + */ + + kVideoEncodePreferenceFramerate, + /** + * + * @brief 清晰模式,优先保障分辨率。适用于静态画面。 + */ + + kVideoEncodePreferenceQuality, + /** + * + * @brief 平衡帧率与分辨率。 + * 对于屏幕流来说是开启自动模式智能模式,将根据屏幕内容智能决策选择流畅模式或清晰模式。 + */ + + kVideoEncodePreferenceAuto, +}; + + +/** + * + * @type keytype + * @brief 摄像头。 + */ + +enum CameraID { + /** + * + * @brief 移动端前置摄像头,PC 端内置摄像头 + */ + + kCameraIDFront = 0, + /** + * + * @brief 移动端后置摄像头,PC 端无定义 + */ + + kCameraIDBack = 1, + /** + * + * @hidden currently not available + * @brief 外接摄像头 + */ + + kCameraIDExternal = 2, + /** + * + * @brief 无效值 + */ + + kCameraIDInvalid = 3 +}; + + +#define SEND_KBPS_AUTO_CALCULATE -1 +#define SEND_KBPS_DISABLE_VIDEO_SEND 0 + +/** + * + * @deprecated since 3.36 along with setVideoEncoderConfig(StreamIndex index, const VideoSolution* solutions, int solution_num) = 0; + * @type keytype + * @brief 视频流参数 + */ + +struct VideoSolution { + /** + * + * @brief 视频宽度,单位:像素 + */ + + int width; + /** + * + * @brief 视频高度,单位:像素 + */ + + int height; + /** + * + * @brief 视频帧率 + */ + + int fps; + /** + * + * @brief 最大发送编码码率(kbps),建议使用默认的自动码率。
  • -1: 自动码率
  • 0: 不开启上限
  • >0: 填写预估码率
  • + */ + + int max_send_kbps = SEND_KBPS_AUTO_CALCULATE; + int min_send_kbps = 0; + /** + * + * @brief 视频编码质量策略,参看 VideoEncodePreference{@link #VideoEncodePreference} + */ + + VideoEncodePreference encode_preference = VideoEncodePreference::kVideoEncodePreferenceFramerate; +}; + +/** + * + * @hidden for internal use only on Windows and Android + * @type keytype + * @brief 视野范围(Fov)内的视频帧信息
    + * Tile 是 全景视频的基本单位。
    + * 视野范围内的视频又分为高清视野和低清背景,均包含了多个 Tile。
    + * 视频帧信息为发送端使用 `setVideoEncoderConfig(const VideoEncoderConfig& encoderConfig, const char* parameters)` 接口进行设置。 + */ + +struct FovVideoTileInfo { + /** + * + * @brief 高清视野宽度 + */ + + uint32_t hd_width = 0; + /** + * + * @brief 高清视野高度 + */ + + uint32_t hd_height = 0; + /** + * + * @brief 低清背景宽度 + */ + + uint32_t ld_width = 0; + /** + * + * @brief 低清背景高度 + */ + + uint32_t ld_height = 0; + /** + * + * @brief Tile 宽度 + */ + + uint32_t tile_width = 0; + /** + * + * @brief Tile 高度 + */ + + uint32_t tile_height = 0; + /** + * + * @brief 高清视野中的 Tile 行数 + */ + + uint32_t hd_row = 0; + /** + * + * @brief 高清视野中的 Tile 列数 + */ + + uint32_t hd_column = 0; + /** + * + * @brief 低清背景中的 Tile 行数 + */ + + uint32_t ld_row = 0; + /** + * + * @brief 低清背景中的 Tile 列数 + */ + + uint32_t ld_column = 0; + /** + * + * @brief 视野范围中的 Tile 行数 + */ + + uint32_t dest_row = 0; + /** + * + * @brief 视野范围中的 Tile 列数 + */ + + uint32_t dest_column = 0; + /** + * + * @brief Tile 位置映射表 + */ + + uint8_t* tile_map = nullptr; + /** + * + * @brief Tile 数量 + */ + + uint32_t tile_size = 0; +}; +/** + * + * @hidden constructor/destructor + * @valid since 3.60. + * @param width 视频宽度 + * @param height 视频高度 + * @type keytype + * @brief 视频像素 + */ + +struct VideoDimensions { + int width; + int height; +}; + +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_120x120 = {120, 120}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_160x120 = {160, 120}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_180x180 = {180, 180}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_240x180 = {240, 180}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_320x180 = {320, 180}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_240x240 = {240, 240}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_320x240 = {320, 240}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_424x240 = {424, 240}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_360x360 = {360, 360}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_480x360 = {480, 360}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_640x360 = {640, 360}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_480x480 = {480, 480}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_640x480 = {640, 480}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_840x480 = {840, 480}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_960x540 = {960, 540}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_960x720 = {960, 720}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_1280x720 = {1280, 720}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_1920x1080 = {1920, 1080}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_2540x1440 = {2540, 1440}; +/** + * + * @hidden constructor/destructor + */ + +const static VideoDimensions VD_3840x2160 = {3840, 2160}; + + +/** + * + * @type keytype + * @brief 推荐的视频帧率 + * @hidden constructor/destructor + */ + +enum FrameRateFps { + kFrameRateFps1 = 1, + kFrameRateFps7 = 7, + kFrameRateFps10 = 10, + kFrameRateFps15 = 15, + kFrameRateFps24 = 24, + kFrameRateFps30 = 30, + kFrameRateFps60 = 60, +}; +/** + * + * @type keytype + * @brief 视频编码配置。参考 [设置视频发布参数](https: + */ + +struct VideoEncoderConfig { + /** + * + * @brief 视频宽度,单位:像素 + */ + + int width; + /** + * + * @brief 视频高度,单位:像素 + */ + + int height; + /** + * + * @brief 视频帧率,单位:fps + */ + + int frame_rate; + /** + * + * @brief 最大编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
    + * 内部采集模式下默认值为 -1,即适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率。
    + * 设为 0 则不对视频流进行编码发送。 + */ + + int max_bitrate = SEND_KBPS_AUTO_CALCULATE; + /** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `minBitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, maxBitrate),当 `maxBitrate` < `minBitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `maxBitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `maxBitrate` < `0` 时,适配码率模式。 + */ + + int min_bitrate = 0; + /** + * + * @brief 关键帧间隔,单位:毫秒,默认值为 `0` + */ + + int32_t key_frame_interval_ms = 0; + /** + * + * @brief 编码策略偏好,默认为帧率优先。参看 VideoEncodePreference{@link #VideoEncodePreference}。 + */ + + VideoEncodePreference encoder_preference = VideoEncodePreference::kVideoEncodePreferenceFramerate; +}; + +/** + * + * @hidden + * @deprecated since 3.36 along with onUserUnPublishStream and onUserUnPublishScreen, and will be deleted in 3.51. + * @type keytype + * @brief 视频属性 + */ + +struct VideoSolutionDescription { + /** + * + * @brief 宽(像素)
    + * 默认值为 `1920`
    + * 为 `0` 时,保持源的宽。 + */ + + int width; + /** + * + * @brief 高(像素)
    + * 默认值为 `1080`
    + * 为 `0` 时,保持源的高。 + */ + + int height; + /** + * + * @brief 视频帧率(fps),默认为 15 fps + */ + + int fps; + /** + * + * @brief 最大发送速率(千比特每秒)。
    + * 默认为 `-1`,适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率 + */ + + int max_send_kbps; + int min_send_kbps; + /** + * + * @brief 缩放模式。参看 VideoStreamScaleMode{@link #VideoStreamScaleMode} + */ + + VideoStreamScaleMode scale_mode = VideoStreamScaleMode::kVideoStreamScaleModeAuto; + /** + * + * @brief 视频的编码类型。参看 VideoCodecType{@link #VideoCodecType} + */ + + VideoCodecType codec_name = VideoCodecType::kVideoCodecTypeUnknown; + /** + * + * @brief 视频的编码模式。参看 VideoCodecMode{@link #VideoCodecMode} + */ + + VideoCodecMode codec_mode = VideoCodecMode::kVideoCodecModeAuto; + /** + * + * @brief 视频编码质量偏好策略。参看 VideoEncodePreference{@link #VideoEncodePreference} + */ + + VideoEncodePreference encode_preference = VideoEncodePreference::kVideoEncodePreferenceFramerate; + /** + * + * @brief 关键帧间隔,单位:毫秒,默认值为 `0` + */ + + int32_t key_frame_interval_ms = 0; + /** + * + * @hidden constructor/destructor + */ + + bool operator==(const VideoSolutionDescription& config) const { + bool result = width == config.width && height == config.height && fps == config.fps + && max_send_kbps == config.max_send_kbps && min_send_kbps == config.min_send_kbps + && scale_mode == config.scale_mode && codec_name == config.codec_name + && codec_mode == config.codec_mode && encode_preference == config.encode_preference; + return result; + } + /** + * + * @hidden constructor/destructor + */ + + bool operator!=(const VideoSolutionDescription& config) const { + bool result = (*this == config); + return !result; + } +}; + + +/** + * + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @region 视频管理 + */ + +typedef VideoSolutionDescription VideoProfile; + +/** + * + * @type keytype + * @brief 视频帧像素格式 + */ + +enum VideoPixelFormat { + /** + * + * @brief 未知格式 + */ + + kVideoPixelFormatUnknown = 0, + /** + * + * @brief YUV I420 格式 + */ + + kVideoPixelFormatI420 = 1, + /** + * + * @brief YUV NV12 格式 + */ + + kVideoPixelFormatNV12 = 2, + /** + * + * @brief YUV NV21 格式 + */ + + kVideoPixelFormatNV21 = 3, + /** + * + * @brief RGB 24bit 格式, + */ + + kVideoPixelFormatRGB24 = 4, + /** + * + * @brief RGBA 编码格式 + */ + + kVideoPixelFormatRGBA = 5, + /** + * + * @brief ARGB 编码格式 + */ + + kVideoPixelFormatARGB = 6, + /** + * + * @brief BGRA 编码格式 + */ + + kVideoPixelFormatBGRA = 7, + + + /** + * + * @hidden for internal use only + * @brief 像素格式结束标志。新加的格式数值应该小于kVideoPixelFormatEndMark。 + */ + + kVideoPixelFormatEndMark = 0xFF, + + /** + * + * @brief Texture2D 格式 + */ + + kVideoPixelFormatTexture2D = 0x0DE1, + /** + * + * @brief TextureOES 格式 + */ + + kVideoPixelFormatTextureOES = 0x8D65, +}; + +/** + * + * @type keytype + * @brief 视频帧内容类型 + */ + +enum VideoContentType { + /** + * + * @brief 普通视频 + */ + + kVideoContentTypeNormalFrame = 0, + /** + * + * @brief 黑帧 + */ + + kVideoContentTypeBlackFrame = 1, +}; + + +/** + * + * @type keytype + * @brief 视频缓冲区类型 + */ + +enum VideoBufferType { + /** + * + * @brief 原始内存数据 + */ + + kVideoBufferTypeRawMemory = 0, + /** + * + * @hidden(Windows, Android, Linux) + * @brief CVPixelBufferRef 类型 + */ + + kVideoBufferTypeCVPixelBuffer = 1, + /** + * + * @brief OpenGL 纹理数据类型 + */ + + kVideoBufferTypeGLTexture = 2, + /** + * + * @brief cuda 数据类型 + */ + + kVideoBufferTypeCuda = 3, + /** + * + * @brief direct3d11 纹理 + */ + + kVideoBufferTypeD3D11 = 4, + /** + * + * @brief vaapi 数据格式 + */ + + kVideoBufferTypeVAAPI = 5, + /** + * + * @hidden(Windows) + * @brief nvidia jetson dma 数据格式 + */ + + kVideoBufferTypeNvidiaJetsonDma =6, +}; + +/** + * + * @type keytype + * @brief 自定义内存释放器 + */ + +struct ManagedMemory { + /** + * + * @brief 内存数据地址 + */ + + uint8_t* data = nullptr; + /** + * + * @brief 内存空间的大小 + */ + + int size = 0; + /** + * + * @brief 用户自定义数据 + */ + + void* user_opaque = nullptr; + /** + * + * @brief 自定义内存释放方法指针,如果指针不为空,方法会被调用,用来释放内存空间。
    + * 函数传入的参数分别是本结构体内 data、size、user_opaque 3 个字段。 + */ + + int (*memory_deleter)(uint8_t* data, int size, void* user_opaque) = nullptr; +}; + +/** + * + * @type keytype + * @region 视频管理 + * @brief 视频帧数据 + */ + +typedef struct VideoFrameData { + /** + * + * @brief 视频帧缓冲区类型,默认为原始内存,详见 VideoBufferType{@link #VideoBufferType}。必填。 + */ + + VideoBufferType buffer_type = kVideoBufferTypeRawMemory; + /** + * + * @brief 视频帧像素格式,详见 VideoPixelFormat{@link #VideoPixelFormat}。当 `buffer_type` 为 `kVideoFrameTypeGLTexture` 必填。 + */ + + VideoPixelFormat pixel_format = kVideoPixelFormatUnknown; + + /** + * + * @brief 视频帧内容类型,参看 VideoContentType{@link #VideoContentType} + */ + + VideoContentType content_type = kVideoContentTypeNormalFrame; + /** + * + * @brief 视频帧平面个数。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 时,必填。 + */ + + int number_of_planes = 0; + /** + * + * @brief 视频帧平面数组。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 时,必填。 + */ + + uint8_t* plane_data[4] = { nullptr }; + /** + * + * @brief stride 数组。stride 指视频帧平面相邻两行图像数据之间的内存长度(单位字节)。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 时,必填。 + */ + + int plane_stride[4] = { 0 }; + /** + * + * @brief SEI 数据 + */ + + uint8_t* sei_data = nullptr; + /** + * + * @brief SEI 数据大小 + */ + + int sei_data_size = 0; + /** + * + * @brief 视频帧感兴趣区域数据 + */ + + uint8_t* roi_data = nullptr; + /** + * + * @brief 视频帧感兴趣区域数据长度 + */ + + int roi_data_size = 0; + /** + * + * @brief 视频帧宽度。必填。 + */ + + int width = 0; + /** + * + * @brief 视频帧高度。必填。 + */ + + int height = 0; + /** + * + * @brief 视频旋转角度,参看 VideoRotation{@link #VideoRotation}。
    + */ + + VideoRotation rotation = kVideoRotation0; + /** + * + * @brief 视频帧时间戳,单位:微秒。必填。 + */ + + int64_t timestamp_us = 0; + /** + * + * @brief 硬件加速缓冲区指针 + */ + + void* hw_buffer = nullptr; + /** + * + * @brief 硬件加速上下文对象句柄 + */ + + void* hw_context = nullptr; + /** + * + * @brief 纹理矩阵(仅针对纹理类型的 frame 生效) + */ + + float texture_matrix[16] = { 0 }; + /** + * + * @brief 纹理 ID(仅针对纹理类型的 frame 生效)。当 `buffer_type` 为 `kVideoBufferTypeRawMemory` 或 `kVideoFrameTypeGLTexture` 必填。 + */ + + uint32_t texture_id = 0; + +} VideoFrameData; + +/** + * + * @type keytype + * @brief 视频帧接口 + */ + +class IVideoFrame { +public: + /** + * + * @brief 获取视频帧缓冲区类型,参看 VideoBufferType{@link #VideoBufferType}。 + */ + + virtual VideoBufferType bufferType() = 0; + /** + * + * @brief 获取视频帧像素格式,参看 VideoPixelFormat{@link #VideoPixelFormat}。 + */ + + virtual VideoPixelFormat pixelFormat() = 0; + /** + * + * @brief 获取视频帧内容类型,参看 VideoContentType{@link #VideoContentType}。 + */ + + virtual VideoContentType contentType() = 0; + + /** + * + * @brief 获取视频帧时间戳,单位:微秒 + */ + + virtual int64_t timestampUs() = 0; + /** + * + * @brief 获取视频帧宽度 + */ + + virtual int width() = 0; + /** + * + * @brief 获取视频帧高度 + */ + + virtual int height() = 0; + /** + * + * @brief 获取视频帧旋转角度,参看 VideoRotation{@link #VideoRotation} + */ + + virtual VideoRotation rotation() = 0; + /** + * + * @brief 获取视频帧平面数量 + */ + + virtual int numberOfPlanes() = 0; + /** + * + * @brief 获取视频帧平面 + * @param plane_index plane 索引 + */ + + virtual uint8_t* planeData(int plane_index) = 0; + /** + * + * @brief 获取视频帧平面相邻两行图像数据之间的内存长度(单位字节) + * @param plane_index plane 索引 + */ + + virtual int planeStride(int plane_index) = 0; + /** + * + * @brief 获取 SEI 数据指针 + * @param size SEI 数据字节数 + */ + + virtual uint8_t* seiData(int& size) = 0; + /** + * + * @brief 获取硬件缓冲区指针 + */ + + virtual void* hwBuffer() = 0; + /** + * + * @brief 获取硬件加速上下文对象句柄 + */ + + virtual void* hwContext() = 0; + /** + * + * @brief 获取纹理矩阵(仅针对纹理类型的 frame 生效) + * @param matrix 纹理矩阵 + */ + + virtual void textureMatrix(float matrix[16]) = 0; + /** + * + * @brief 获取纹理 ID(仅针对纹理类型的 frame 生效) + */ + + virtual uint32_t textureId() = 0; + /** + * + * @brief 视频帧引用计数加一 + * @note 视频帧消费者希望对视频帧进行异步处理时(例如切换线程进行渲染),需要调用此接口增加引用计数。异步处理结束则需要调用 `releaseRef` 使引用计数减1 + */ + + virtual void addRef() = 0; + /** + * + * @brief 视频帧引用计数减一 + * @note 视频帧引用计数减为 0 时,视频帧对象会被释放。视频帧对象释放后,不应该继续使用视频帧。 + */ + + virtual long releaseRef() = 0; + /** + * + * @brief 获取视频帧的摄像头位置信息,参看 CameraID{@link #CameraID} + */ + + virtual CameraID cameraId() = 0; + /** + * + * @hidden for internal use only on Windows and Android + * @type api + * @brief 获取全景视频的 Tile 信息 + * @return FoV(可视范围)随本端的头位姿实时更新获取到的视频帧,包括高清视野和低清背景。参见 FovVideoTileInfo{@link #FovVideoTileInfo}。 + * @list + */ + + virtual FovVideoTileInfo fovTileInfo() = 0; +/** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IVideoFrame() = default; +}; + + + + + + + + + + + + + + + + + + + + + +/** + * + * @type keytype + * @region 视频管理 + * @brief 视频帧参数 + */ + +typedef struct EncodedVideoFrameBuilder { + /** + * + * @brief 视频帧编码格式,参看 VideoCodecType{@link #VideoCodecType} + */ + + VideoCodecType codec_type = kVideoCodecTypeUnknown; + /** + * + * @brief 视频帧编码类型,参看 VideoPictureType{@link #VideoPictureType} + */ + + VideoPictureType picture_type = kVideoPictureTypeUnknown; + /** + * + * @brief 视频帧旋转角度,参看 VideoRotation{@link #VideoRotation} + */ + + VideoRotation rotation = kVideoRotation0; + /** + * + * @brief 视频帧数据指针 + * @note IEncodedVideoFrame 会获取数据的所有权 + */ + + uint8_t* data = nullptr; + /** + * + * @brief 视频帧数据大小 + */ + + int size = 0; + /** + * + * @brief 视频帧宽度,单位:px + */ + + int width = 0; + /** + * + * @brief 视频帧高度,单位:px + */ + + int height = 0; + /** + * + * @brief 视频采集时间戳,单位:微秒 + */ + + int64_t timestamp_us = 0; + /** + * + * @brief 视频编码时间戳,单位:微秒 + */ + + int64_t timestamp_dts_us = 0; + /** + * + * @brief 用户定义的视频帧释放回调函数指针,如果指针不为空,方法会被调用用来释放内存空间 + */ + + int (*memory_deleter)(uint8_t* data, int size, void* user_opaque) = nullptr; +} EncodedVideoFrameBuilder; +/** + * + * @type keytype + * @brief 视频帧信息 + */ + +class IEncodedVideoFrame { +public: + /** + * + * @type api + * @brief 获取视频编码类型 + * @return 视频编码类型,参看 VideoCodecType{@link #VideoCodecType} + * @list Video Management + */ + + virtual VideoCodecType codecType() const = 0; + /** + * + * @type api + * @brief 获取视频采集时间戳 + * @return 视频采集时间戳,单位:微秒 + * @list Video Management + */ + + virtual int64_t timestampUs() const = 0; + /** + * + * @type api + * @brief 获取视频编码时间戳 + * @return 视频编码时间戳,单位:微秒 + * @list Video Management + */ + + virtual int64_t timestampDtsUs() const = 0; + /** + * + * @type api + * @brief 获取视频帧宽度 + * @return 视频帧宽度,单位:px + * @list Video Management + */ + + virtual int width() const = 0; + /** + * + * @type api + * @brief 获取视频帧高度 + * @return 视频帧高度,单位:px + * @list Video Management + */ + + virtual int height() const = 0; + /** + * + * @type api + * @brief 获取视频编码帧类型 + * @return 视频编码帧类型,参看 VideoPictureType{@link #VideoPictureType} + * @list Video Management + */ + + virtual VideoPictureType pictureType() const = 0; + /** + * + * @type api + * @brief 获取视频帧旋转角度 + * @return 视频帧旋转角度,参看 VideoRotation{@link #VideoRotation} + * @list Video Management + */ + + virtual VideoRotation rotation() const = 0; + /** + * + * @type api + * @brief 获取视频帧数据指针地址 + * @return 视频帧数据指针地址 + * @list Video Management + */ + + virtual uint8_t* data() const = 0; + /** + * + * @type api + * @brief 获取视频帧数据大小 + * @return 视频帧数据大小 + * @list Video Management + */ + + virtual int dataSize() const = 0; + /** + * + * @type api + * @brief 浅拷贝视频帧并返回指针 + * @list Video Management + */ + + virtual IEncodedVideoFrame* shallowCopy() const = 0; + /** + * + * @type api + * @brief 释放视频帧 + * @list Video Management + */ + + virtual void release() = 0; + /** + * + * @hidden constructor/destructor + */ + +protected: + /** + * + * @hidden constructor/destructor + * @brief 析构函数 + */ + + virtual ~IEncodedVideoFrame() = default; +}; +/** + * + * @type api + * @brief 创建 IEncodedVideoFrame + * @param builder 编码后的视频帧构建实例,参看 EncodedVideoFrameBuilder{@link #EncodedVideoFrameBuilder} + * @return IEncodedVideoFrame{@link #IEncodedVideoFrame} 实例 + * @list 视频管理 + */ + +BYTERTC_API IEncodedVideoFrame* buildEncodedVideoFrame(const EncodedVideoFrameBuilder& builder); + + +/** + * + * @hidden(Linux,Android,iOS) + * @type keytype + * @brief RTC 智能决策后得到的帧率和分辨率积(宽*高)。 + */ + +struct FrameUpdateInfo { + /** + * + * @brief 分辨率积(宽*高)。 + */ + + int pixel; + /** + * + * @brief 帧率。 + */ + + int framerate; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_processor_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_processor_interface.h new file mode 100644 index 0000000..9ad98ce --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_video_processor_interface.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Processor Interface +*/ + +#pragma once + +#include "bytertc_video_frame.h" + +namespace bytertc { +/** + * + * @type api + * @brief 视频处理接口类 + * @list 视频处理 + */ + +class IVideoProcessor +{ +public: + /** + * + * @hidden constructor/destructor + */ + + virtual ~IVideoProcessor() = default; + /** + * + * @type api + * @brief 获取 RTC SDK 采集得到的视频帧,根据 registerLocalVideoProcessor{@link #IRTCEngine#registerLocalVideoProcessor} 设置的视频前处理器,进行视频前处理,最终将处理后的视频帧给到 RTC SDK 用于编码传输。 + * @param src_frame RTC SDK 采集得到的视频帧,参看 IVideoFrame{@link #IVideoFrame}。 + * @return 经过视频前处理后的视频帧,返回给 RTC SDK 供编码和传输,参看 IVideoFrame{@link #IVideoFrame}。 + * @note + * - 在进行视频前处理前,你需要调用 registerLocalVideoProcessor{@link #IRTCEngine#registerLocalVideoProcessor} 设置视频前处理器。 + * - 如果需要取消视频前处理,可以将视频前处理器设置为 nullptr。 + * - 应用层实现 `processVideoFrame` 接口时,可以直接修改 `src_frame` 的缓冲区,调用 `addRef` 方法将 `src_frame` 引用计数加一,然后将修改后的 `src_frame` 返回, 也可以创建一个新的视频帧并返回。 + * - 对于 `processVideoFrame` 返回的视频帧,在 SDK 层消费完成后,SDK 内部总是调用这个视频帧的 releaseRef 方法。 + * @list 自定义流处理 + */ + + virtual IVideoFrame* processVideoFrame(IVideoFrame* src_frame) = 0; +}; + +} \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_wtn_stream_interface.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_wtn_stream_interface.h new file mode 100644 index 0000000..5d3b57d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/bytertc_wtn_stream_interface.h @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Video Processor Interface +*/ + +#pragma once + +#include "bytertc_video_defines.h" + +namespace bytertc { +/** + * + * @type keytype + * @brief WTN 媒体流状态 + */ + +enum WTNSubscribeState { + /** + * + * @brief 订阅 WTN 媒体流 + */ + + kWTNSubscribeStateSubscribed, + /** + * + * @brief 取消订阅 WTN 媒体流 + */ + + kWTNSubscribeStateUnsubscribed +}; +/** + * + * @type keytype + * @brief WTN 媒体流订阅状态改变的原因 + */ + +enum WTNSubscribeStateChangeReason { + /** + * + * @brief 订阅 WTN 媒体流成功 + */ + + kWTNSubscribeStateChangeReasonSubscribe = 0, + /** + * + * @brief 其他原因订阅失败 + */ + + kWTNSubscribeStateChangeReasonUnsubscribe = 1300, + /** + * + * @brief 订阅失败,拉流时远端未发布 + */ + + kWTNSubscribeStateChangeReasonRemoteUnpublish = 1301, + /** + * + * @brief 订阅失败,超出单端订阅上限。一个引擎实例最多拉 5 路流。 + */ + + kWTNSubscribeStateChangeReasonOverClientSubscribeStreamLimit = 1310, + /** + * + * @brief 订阅失败。超出单流订阅人数上限。该限制由 RTC 服务端决定。 + */ + + kWTNSubscribeStateChangeReasonOverStreamSubscribeUserLimit = 1311, + /** + * + * @brief 订阅失败。超出单流订阅请求 QPS 上限。该限制由 RTC 服务端决定。 + */ + + kWTNSubscribeStateChangeReasonOverStreamSubscribeRequestLimit = 1312 +}; + +/** + * + * @type callback + * @brief WTN 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ + +class IWTNStreamEventHandler { +public: + /** + * @hidden Constructor/Destructor + * @brief Destructor + */ + virtual ~IWTNStreamEventHandler() { + } + /** + * + * @type callback + * @valid since 3.60. + * @brief 通话中本地设备接收订阅的远端 WTN 视频流的流 ID 以及远端 WTN 视频流统计信息。 + * @param stream_id WTN 流 ID + * @param stats 远端 WTN 视频流的统计信息,详见 RemoteVideoStats{@link #RemoteVideoStats}。 + * @list WTN + * @order 0 + */ + + virtual void onWTNRemoteVideoStats(const char* stream_id, RemoteVideoStats stats) { + (void)stream_id; + (void)stats; + } + /** + * + * @type callback + * @valid since 3.60. + * @brief 通话中本地设备接收订阅的远端 WTN 音频流的流 ID 以及远端 WTN 音频流统计信息。 + * @param stream_id WTN 流 ID + * @param stats 远端 WTN 音频流的统计信息,详见 RemoteAudioStats{@link #RemoteAudioStats} + * @list WTN + * @order 1 + */ + + virtual void onWTNRemoteAudioStats(const char* stream_id, RemoteAudioStats stats) { + (void)stream_id; + (void)stats; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onPlayPublicStreamResult` 方法中的 WTN 视频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 视频流订阅状态变化回调
    + * 通过 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream} 订阅 WTN 视频流后,可以通过本回调获取订阅结果。 + * @param stream_id WTN 视频流的 ID + * @param state_code 视频流状态码,参看 WTNSubscribeState{@link #WTNSubscribeState}。 + * @param reason 订阅状态发生变化的原因,参看 WTNSubscribeStateChangeReason{@link #WTNSubscribeStateChangeReason}。 + * @list WTN + * @order 2 + */ + + virtual void onWTNVideoSubscribeStateChanged(const char* stream_id, WTNSubscribeState state_code, WTNSubscribeStateChangeReason reason) { + (void)stream_id; + (void)state_code; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onPlayPublicStreamResult` 中的 WTN 音频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 音频流订阅状态变化回调
    + * 通过 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 订阅 WTN 音频流后,可以通过本回调获取订阅结果。 + * @param stream_id WTN 音频流的 ID + * @param state_code 音频流状态码,参看 WTNSubscribeState{@link #WTNSubscribeState}。 + * @param reason 订阅状态发生变化的原因,参看 WTNSubscribeStateChangeReason{@link #WTNSubscribeStateChangeReason}。 + * @list WTN + * @order 2 + */ + + virtual void onWTNAudioSubscribeStateChanged(const char* stream_id, WTNSubscribeState state_code, WTNSubscribeStateChangeReason reason) { + (void)stream_id; + (void)state_code; + (void)reason; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onFirstPublicStreamAudioFrame`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 流的首帧音频解码成功
    + * 关于订阅 WTN 音频流,详见 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}。 + * @param stream_id WTN 流 ID + * @list WTN + * @order 3 + */ + + virtual void onWTNFirstRemoteAudioFrame(const char* stream_id) { + (void)stream_id; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onFirstPublicStreamVideoFrameDecoded`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 流的首帧视频解码成功
    + * 关于 订阅 WTN 流,详见 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}。 + * @param stream_id WTN 流 ID + * @param info 视频帧信息。详见 VideoFrameInfo{@link #VideoFrameInfo}。 + * @list WTN + * @order 4 + */ + + virtual void onWTNFirstRemoteVideoFrameDecoded(const char* stream_id, const VideoFrameInfo& info) { + (void)stream_id; + (void)info; + } + + /** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替换了 `onPublicStreamSEIMessageReceived` 来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief 回调 WTN 流中包含的 SEI 信息。
    + * 调用 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}/subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}接口拉 WTN 音频流/视频流后,通过此回调收到 WTN 流中的 SEI 消息。 + * @param stream_id WTN 流 ID。 + * @param channel_id SEI 的消息传输通道,取值范围 `[0 - 255]`。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message 收到的 SEI 消息内容。
    + * 通过调用客户端 `sendSEIMessage` 插入的 SEI 信息。
    + * 当 WTN 流中的多路视频流均包含有 SEI 信息:SEI 不互相冲突时,将通过多次回调分别发送;SEI 在同一帧有冲突时,则只有一条流中的 SEI 信息被透传并融合到 WTN 流中。 + * @param length SEI 信息的长度。 + * @note 通过 Open API 插入的自定义信息,应通过回调 onWTNDataMessageReceived{@link #IWTNStreamEventHandler#onWTNDataMessageReceived} 获取。 + * @list WTN + * @order 5 + */ + + virtual void onWTNSEIMessageReceived(const char* stream_id, int channel_id, const uint8_t* message, int length) { + (void)stream_id; + (void)channel_id; + (void)message; + (void)length; + } + + /** + * + * @type callback + * @valid since 3.60. + * @brief 回调 WTN 流中包含的数据信息。
    + * 通过 subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream}/subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream} 订阅 WTN 流后,通过监听本回调获取 WTN 流中的数据消息,包括调用 Open API 发送的 SEI 消息和音量回调。 + * @param stream_id WTN 流 ID + * @param message 收到的数据消息内容,如下:
    + * - 调用 WTN 流 OpenAPI 发送的自定义消息。 + * - 媒体流音量变化,需要通过 WTN 流 OpenAPI 开启回调。JSON 格式说明如下:
    + * {
    + * "Type" : "VolumeIndication", + * "VolumeInfos" : [ + * {
    + * "RoomId":"1000001", + * "UserId":"1000001", + * "StreamType":0, + * "LinearVolume":1 + * }
    + * @param message_length 消息的长度 + * @param source_type 数据消息来源,参看 DataMessageSourceType{@link #DataMessageSourceType}。 + * @note 通过调用客户端 API 插入的 SEI 信息,应通过回调 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 获取。 + * @list WTN + * @order 6 + */ + + virtual void onWTNDataMessageReceived(const char* stream_id, + const uint8_t* message, + int message_length, + DataMessageSourceType source_type) { + (void)stream_id; + (void)message; + (void)message_length; + (void)source_type; + } +}; + +/** + * + * @type api + * @region WTN + * @brief WTN 流处理 + */ + +class IWTNStream +{ +public: + /** + * @hidden constructor/destructor + */ + virtual ~IWTNStream() = default; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream` 和 `stopPlayPublicStream` 方法来订阅/取消订阅指定 WTN 视频流,如果你使用了这两个方法,请迁移至此接口。 + * @brief 订阅/取消订阅指定 WTN 视频流
    + * 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 视频流。 + * @param stream_id WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 + * @param subscribe 是否订阅 WTN 流
    + * - true:订阅 + * - false:取消订阅 + * @return + * - 0: 成功。同时将收到 onWTNVideoSubscribeStateChanged{@link #IWTNStreamEventHandler#onWTNVideoSubscribeStateChanged} 回调。 + * - !0: 失败。当参数不合法或参数为空,调用失败。 + * @note + * - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}/subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 + * - 在调用本接口之前,建议先绑定渲染视图。 + * - 调用 setWTNRemoteVideoCanvas{@link #IWTNStream#setWTNRemoteVideoCanvas} 绑定内部渲染视图 + * - 调用 setWTNRemoteVideoSink{@link #IWTNStream#setWTNRemoteVideoSink} 绑定自定义渲染视图 + * - 调用本接口后,可以通过 onWTNFirstRemoteVideoFrameDecoded{@link #IWTNStreamEventHandler#onWTNFirstRemoteVideoFrameDecoded} 回调 WTN 视频流的首帧解码情况。 + * - 调用本接口后,可以通过 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 回调 WTN 流中包含的 SEI 信息。 + * @list WTN + * @order 0 + */ + + virtual int subscribeWTNVideoStream(const char* stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream` 和 `stopPlayPublicStream` 方法来订阅/取消订阅指定 WTN 音频流,如果你使用了这两个方法,请迁移至此接口。 + * @brief 订阅/取消订阅指定 WTN 音频流
    + * 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 音频流。 + * @param stream_id WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 + * @param subscribe 是否订阅 WTN 流
    + * - true:订阅 + * - false:取消订阅 + * @return + * - 0: 成功。同时将收到 onWTNAudioSubscribeStateChanged{@link #IWTNStreamEventHandler#onWTNAudioSubscribeStateChanged} 回调。 + * - !0: 失败。当参数不合法或参数为空,调用失败。 + * @note + * - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}/subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 取消订阅WTN 流,避免订阅的 WTN 流数量超限。 + * - 在调用本接口之前,建议先绑定渲染视图。 + * - 调用 setWTNRemoteVideoCanvas{@link #IWTNStream#setWTNRemoteVideoCanvas} 绑定内部渲染视图 + * - 调用 setWTNRemoteVideoSink{@link #IWTNStream#setWTNRemoteVideoSink} 绑定自定义渲染视图 + * - 调用本接口后,可以通过 onWTNFirstRemoteAudioFrame{@link #IWTNStreamEventHandler#onWTNFirstRemoteAudioFrame} 回调 WTN 音频流的音频首帧解码情况。 + * - 调用本接口后,可以通过 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 回调 WTN 流中包含的 SEI 信息。 + * @list WTN + * @order 1 + */ + + virtual int subscribeWTNAudioStream(const char* stream_id, bool subscribe) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoCanvas` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定内部渲染视图 + * @param stream_id WTN 流 ID + * @param canvas 内部渲染视图,如果需要解除视频的绑定视图,把 `videoCanvas` 设置为空。详见 VideoCanvas{@link #VideoCanvas}。 + * @return + * - 0:成功 + * - !0:失败 + * @list WTN + * @order 2 + */ + + virtual int setWTNRemoteVideoCanvas(const char* stream_id, const VideoCanvas& canvas) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoSink` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定自定义渲染器。详见[自定义视频渲染](https: + * @param stream_id WTN 流 ID + * @param video_sink 自定义视频渲染器,自定义视频渲染器,需要释放渲染器资源时,将 `videoSink` 设置为 `null`。参看 IVideoSink{@link #IVideoSink} + * @param config 远端视频帧回调配置,参看 RemoteVideoSinkConfig{@link #RemoteVideoSinkConfig} + * @return + * - 0:成功; + * - <0:失败。具体失败原因参看 ReturnStatus{@link #ReturnStatus}。 + * @list WTN + * @order 3 + */ + + virtual int setWTNRemoteVideoSink(const char* stream_id, IVideoSink* video_sink, RemoteVideoSinkConfig& config) = 0; + + /** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamAudioPlaybackVolume` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 调节 WTN 流的音频播放音量。 + * @param stream_id WTN 流 ID + * @param volume 音频播放音量值和原始音量值的比值,该比值的范围是 `[0, 400]`,单位为 %,且自带溢出保护。为保证更好的音频质量,建议设定在 `[0, 100]` 之间,其中 100 为系统默认值。 + * @return + * - 0: 成功调用。 + * - -2: 参数错误。 + * @list WTN + * @order 4 + */ + + virtual int setWTNRemoteAudioPlaybackVolume(const char* stream_id, int volume) = 0; + /** + * + * @type api + * @valid since 3.60. + * @brief 设置 WTN 流回调接口 + * @param handler WTN 回调类,参看 IWTNStreamEventHandler{@link #IWTNStreamEventHandler}。 + * @list WTN + * @order 5 + */ + + virtual int setWTNStreamEventHandler(IWTNStreamEventHandler* handler) = 0; +}; + +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/meeting_advance.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/meeting_advance.h new file mode 100644 index 0000000..59f2c90 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/native/rtc/meeting_advance.h @@ -0,0 +1,239 @@ +#pragma once + +#include "bytertc_defines.h" + +namespace bytertc { +class IRTCRoom; +class IRTCEngine; +class IAmazingEffect; + +/** + * @type keytype + * @brief 5.18版本后,飞书会议弱网提示专用,设置订阅视频基线数据用于计算网络等级 + */ +struct SubscribeVideoBaseline { + /** + * @brief 网络等级判定为优秀的视频宽/高中小值的基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_good_video_pixel_baseline = -1; + /** + * @brief 网络等级判定为优秀的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_good_video_fps_baseline = -1; + /** + * @brief 网络等级判定为差视频宽/高中小值的基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_bad_video_pixel_baseline = -1; + /** + * @brief 网络等级判定为差的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ + int32_t acceptable_bad_video_fps_baseline = -1; + /** + * @brief 业务可以接受的最小分辨率宽度,-1表示业务忽略此参数 + */ + int32_t acceptable_min_video_resolution_width = -1; + /** + * @brief 业务可以接受的最小分辨率高度,-1表示业务忽略此参数 + */ + int32_t acceptable_min_video_resolution_height = -1; + /** + * @brief 流的优先级,-1表示业务忽略此参数 + */ + int32_t stream_priority = -1; +}; + +enum SpecialStreamType { + kSpecialStreamTypeDocShare = 1, + kSpecialStreamTypeMCU, + kSpecialStreamTypeMeetTogether, + kSpecialStreamTypeIntelligentStream, +}; + +enum ExternalReportType{ + kExternalReportTypeApi = 0, + kExternalReportTypeApiCallback = 1, +}; +} + +namespace bytertc { + /** + * + * @hidden + * @brief 推流到子频道channelName + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [const char*] channelName 子频道 + */ + BYTERTC_API int setPublishChannel(IRTCRoom* room, const char* channelName); + /** + * + * @hidden + * @brief 订阅子频道数组里的所有流 + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [const SubChannelsInfo*] channelsInfo 子频道数组 + * @param [int] channelsNum 子频道数组大小 + * @param [bool] enableVolumeRescale 是否开启音频抑制功能 + */ + BYTERTC_API int setSubscribeChannels(IRTCRoom* room, const char* channels[], int channelsNum, bool enable_rescale); + /** + * + * @hidden + * @brief 设置是否开启音频抑制 + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [bool] enable 是否抑制 + */ + BYTERTC_API int enableRescaleAudioVolume(IRTCRoom* room, bool enable); + /** + * + * @hidden + * @deprecated since 3.58 and will be deleted in 3.60 + * @brief 设置发布的特殊流类型 + * > 支持会前设置 + * @param [IRTCRoom*] room 目标room + * @param [int] type 流类型 + */ + BYTERTC_API int setPublishSpecialStream(IRTCRoom* room, int type); + /** + * + * @hidden + * @brief 设置发布的特殊流类型 + * > 支持会前设置 + * @param [IRTCRoom*] room 目标room + * @param [int] type 流类型 + */ + BYTERTC_API int setPublishSpecialStreamWithStreamIndex(IRTCRoom* room, StreamIndex streamIndex, int type); + /** + * + * @hidden + * @brief 设置订阅的特殊流类型 + * > 支持会前、会中设置 + * @param [IRTCRoom*] room 目标room + * @param [int[]] types 流类型集合 + * @param [int] count 流类型集合大小 + */ + BYTERTC_API int setSubscribeSpecialStream(IRTCRoom* room, int types[], int count); + /** + * + * @brief 获取上行带宽状态 + * @param [IRTCRoom*] room 目标room + */ + BYTERTC_API int getUplinkNetworkBandwidthEstimationStatus(IRTCRoom* room); + /** + * + * @brief 获取下行带宽状态 + * @param [IRTCRoom*] room 目标room + */ + BYTERTC_API int getDownlinkNetworkBandwidthEstimationStatus(IRTCRoom* room); + + /** + * + * @hidden + * @brief 视频发布端设置推送多路流时各路流的参数,包括分辨率、帧率、码率、缩放模式、网络不佳时的回退策略等。 + * @param channel_solutions 通道内的最大分辨率 + * @param solution_num 通道数 + * @param channel_main_solutions 主通道 兼容旧版本 + * @return 0 成功 !0失败 + */ + BYTERTC_API int setVideoEncoderConfig(IRTCEngine* ivideo, const VideoEncoderConfig* channel_solutions, + int solution_num, const VideoEncoderConfig* channel_main_solutions); + + /** + * + * @hidden + * @brief 设置屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ + BYTERTC_API int setScreenVideoConfigs(IRTCEngine* ivideo); + + /** + * + * @hidden + * @brief 清空屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ + BYTERTC_API int resetScreenVideoConfigs(IRTCEngine* ivideo); + + /** + * + * @brief 更新自动订阅选项 + *@param [IRTCRoom*] room 目标room + *@param [SubscribeMode] sub_mode_audio 音频自动订阅模式 + *@param [SubscribeMode] sub_mode_video 视频自动订阅模式 + */ + BYTERTC_API int enableAutoSubscribe(IRTCRoom* room, SubscribeMode sub_mode_audio, SubscribeMode sub_mode_video); + + /** + * + * @brief 检查音视频流是否取消发布成功 + *@param [IRTCRoom*] room 目标room + *@param [int] type 需要检查的流类型 + */ + BYTERTC_API bool isStreamUnpublished(IRTCRoom* room, MediaStreamType stream_type); + + /** + * + * @brief 设置弱网降级的基线数据 + *@param [RTCRoom] room 目标room + *@param [String] userId 订阅用户名 + *@param [boolean] isScreen 是否屏幕流 + *@param [InternalSubscribeVideoBaseline] videoBaseline 订阅基线设置 + */ + BYTERTC_API void setSubscribeBaselineData(IRTCRoom* rtc_room, const char* uid, bool is_screen, + const SubscribeVideoBaseline& video_baseline); + + /** + * + * @hidden + * @brief 获取用于实时crash分子数据信息 + * @param [char*] params carsh参数信息的json形式的字符数组 + * @param [int] size 用于存储params信息的数组大小 + */ + BYTERTC_API int getSessionLaunchParams(char* params, int size); + + /** + * + * @hidden + * @brief 获取视频特效接口IAmazingEffect + *@param [RTCEngine] ivideo 目标RTCVideo + */ + BYTERTC_API IAmazingEffect* getAmazingEffectInterface(IRTCEngine* ivideo); + /** + * + * @hidden + * @brief 获取EffectSDK版本,用于初始化platformsdk + */ + BYTERTC_API void getEffectVersion(char* version, int size); + + /** + * + * @brief 设置外部 Surface + * @return 无返回值 + */ + BYTERTC_API void setExternalSurface(IRTCEngine* ivideo, const char* room_id, const char* user_id, StreamIndex index, void* surface); + + /** + * + * @hidden + * @brief 写外部日志到RTC日志文件 + */ + BYTERTC_API void writeLog(const char* file_name, int line_num, const char* api_name, const char* level, + const char* format, ...); + + /** + * + * @hidden + * @brief 上报外部接口调用到trace平台 + */ + BYTERTC_API void reportApiCall(IRTCEngine* ivideo, ExternalReportType report_type, const char* api_name, + const char* msg); + + /** + * + * @hidden + * @brief 会议场景开启多分辨率 + */ + BYTERTC_API int enableSimulcastMode(IRTCEngine* ivideo, bool enabled); + + } diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCEngine.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCEngine.h new file mode 100644 index 0000000..63030fd --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCEngine.h @@ -0,0 +1,4450 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC +*/ +#import +#import "rtc/ByteRTCDefines.h" +#import "rtc/ByteRTCHttpClientProtocol.h" +#import "rtc/ByteRTCAudioEffectPlayer.h" +#import "rtc/ByteRTCMediaPlayer.h" +#import "rtc/ByteRTCSingScoringManager.h" +#import "rtc/ByteRTCWTNStream.h" +@class ByteRTCEngine; +@class ByteRTCRoom; +@class ByteRTCGameRoom; +@class ByteRTCRTSRoom; +@class ByteRTCKTVManager; +/** + * + * @type api + */ + +@protocol ByteRTCHttpClientProtocol; + +#pragma mark - ByteRTCEngineDelegate +/** + * + * @type callback + * @brief ByteRTCEngineDelegate 协议包含了 SDK 提供的回调方法,SDK 通过代理向应用程序上报一些运行时事件
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCEngineDelegate +@optional +#pragma mark - Core Delegate Methods + +/** + * + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。 + * @param engine ByteRTCEngine 对象。 + * @param code 警告代码,参看 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onWarning:(ByteRTCWarningCode)code; +/** + * + * @type callback + * @brief 发生错误回调。
    + * SDK 运行时出现了网络或媒体相关的错误,且无法自动恢复时触发此回调。
    + * 你可能需要干预。 + * @param engine ByteRTCEngine 对象。 + * @param errorCode 错误代码,参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onError:(ByteRTCErrorCode)errorCode; +/** + * + * @hidden internal use only + * @valid since 3.57 + * @type callback + * @brief 当内部线程发生 block 时,将收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param deadlockMsg block 线程的线程名和 block 检测次数。参看 ByteRTCDeadLockMsg{#ByteRTCDeadLockMsg} + * @list Engine Management + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onDeadLockError:(ByteRTCDeadLockMsg *_Nonnull)deadlockMsg; +/** + * + * @valid since 3.52 + * @type callback + * @brief 当访问插件失败时,收到此回调。
    + * RTC SDK 将一些功能封装成插件。当使用这些功能时,如果插件不存在,功能将无法使用。 + * @param engine `ByteRTCEngine` 实例 + * @param extensionName 插件名字 + * @param msg 失败说明 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onExtensionAccessError:(NSString * _Nonnull)extensionName msg:(NSString * _Nonnull)msg; +/** + * + * @type callback + * @brief SDK 与信令服务器连接状态改变回调。连接状态改变时触发。 + * @param engine ByteRTCEngine 对象 + * @param state 当前 SDK 与信令服务器的连接状态,详见 ByteRTCConnectionState{@link #ByteRTCConnectionState}。 + * @note 更多信息参见 [连接状态提示](https: + * @list 网络管理 + */ + +- (void) rtcEngine:(ByteRTCEngine * _Nonnull)engine onConnectionStateChanged:(ByteRTCConnectionState) state; +/** + * + * @type callback + * @brief SDK 当前网络连接类型改变回调。 + * @param engine ByteRTCEngine 对象 + * @param type SDK 当前的网络连接类型,详见 ByteRTCNetworkType{@link #ByteRTCNetworkType} + * @list 网络管理 + */ + +- (void) rtcEngine:(ByteRTCEngine * _Nonnull)engine onNetworkTypeChanged:(ByteRTCNetworkType) type; +/** + * + * @type callback + * @brief 房间内的可见用户调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 开启音频采集时,房间内其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 开启音频采集的远端流 ID + * @param info 开启音频采集的远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStartAudioCapture:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 房间内的可见用户调用 stopAudioCapture{@link #ByteRTCEngine#stopAudioCapture} 关闭音频采集时,房间内其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 流 ID。 + * @param info 关闭音频采集的远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStopAudioCapture:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 订阅端接收并解码远端音频流首帧时,收到此回调。包含以下情况:
    + * 1. 发布端发布音频,包含首次发布和取消后再次发布。
    + * 2. 发布端关闭音频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
    + * 3. 发布端发布音频后,订阅端取消订阅音频后,又再次订阅音频。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @note + * - 用户刚收到房间内每一路音频流时,都会收到该回调。 + * - 摄像头流、屏幕流,内部采集、外部源、自动订阅和手动订阅的音频流,都符合上述策略。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstRemoteAudioFrame:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; + /** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:} 后,根据设置的 interval 值,你会周期性地收到此回调,了解本地音频的瞬时相关信息。
    + * 本地音频包括使用 RTC SDK 内部机制采集的麦克风音频,屏幕音频和本地混音音频信息。 + * @param engine ByteRTCEngine 对象 + * @param audioPropertiesInfos 本地音频信息,详见 ByteRTCLocalAudioPropertiesInfo{@link #ByteRTCLocalAudioPropertiesInfo} 。在 macOS 端,本地音量可通过 `setAudioCaptureDeviceVolume:` 设置。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLocalAudioPropertiesReport:(NSArray * _Nonnull)audioPropertiesInfos; + +/** + * + * @type callback + * @hidden 3.60 for internal use only + * @region 音频管理 + * @brief 人声检测结果回调。
    + * 调用 enableAudioVADReport 后,根据设置的interval值,本地会周期性地收到此回调
    + * @param state 人声检测结果,参看 ByteRTCAudioVADType{@link #ByteRTCAudioVADType}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioVADStateUpdate:(ByteRTCAudioVADType)state; +/** + * + * @hidden for internal use only + * @type callback + * @region 音频管理 + * @brief 音乐场景检测结果回调。
    + * 调用 enableAudioAEDReport 后,根据设置的interval值,本地会周期性地收到此回调
    + * @param state 音乐场景检测结果,参看 ByteRTCAudioAEDType{@link #ByteRTCAudioAEDType}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioAEDStateUpdate:(ByteRTCAudioAEDType)state; + /** + * + * @hidden(iOS) + * @type callback + * @brief 回调音频设备测试时的播放音量 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine}。 + * @param volume 音频设备测试播放音量。取值范围:[0,255] + * @note 调用 startAudioPlaybackDeviceTest:interval:{@link #ByteRTCAudioDeviceManager#startAudioPlaybackDeviceTest:interval:} 或 startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest:},开始播放音频文件或录音时,将开启该回调。本回调为周期性回调,回调周期由上述接口的 `interval` 参数指定。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioPlaybackDeviceTestVolume:(int)volume; + /** + * + * @hidden(iOS) + * @type callback + * @brief 音频设备音量改变回调。当通过系统设置,改变音频设备音量或静音状态时,触发本回调。本回调无需手动开启。 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine} + * @param deviceType 设备类型,包括麦克风和扬声器,参阅 ByteRTCAudioDeviceType{@link #ByteRTCAudioDeviceType}。 + * @param volume 音量值,[0, 255]。当 volume 变为 0 时,muted 会转为 True。 + * @param muted 是否禁音状态。扬声器被设置为禁音时,muted 为 True,但 volume 保持不变。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioDeviceVolumeChanged:(ByteRTCAudioDeviceType)deviceType volume:(int)volume muted:(bool)muted; + /** + * + * @type callback + * @brief 远端用户进房后,本地调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:} ,根据设置的 interval 值,本地会周期性地收到此回调,了解订阅的远端用户的瞬时音频信息。
    + * 远端用户的音频包括使用 RTC SDK 内部机制/自定义机制采集的麦克风音频和屏幕音频。 + * @param engine ByteRTCEngine 对象 + * @param audioPropertiesInfos 远端音频信息,其中包含音频流属性、房间 ID、用户 ID ,详见 ByteRTCRemoteAudioPropertiesInfo{@link #ByteRTCRemoteAudioPropertiesInfo}。 + * @param totalRemoteVolume 所有订阅的远端流混音后的音量,范围是 [0,255]。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onRemoteAudioPropertiesReport:(NSArray * _Nonnull)audioPropertiesInfos totalRemoteVolume:(NSInteger)totalRemoteVolume; +/** + * + * @type callback + * @brief 调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:}  后,根据设置的 `config.interval`,你会周期性地收到此回调,获取房间内的最活跃用户信息。 + * @param engine `ByteRTCEngine` 实例 + * @param roomId 房间 ID + * @param uid 最活跃用户(ActiveSpeaker)的用户 ID + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onActiveSpeaker:(NSString * _Nonnull)roomId uid:(NSString *_Nonnull)uid; +/** + * + * @hidden for internal use only + * @type callback + * @brief 房间内用户暂停/恢复发送视频流时,房间内其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param roomId 房间 ID + * @param uid 暂停/恢复发送视频流的用户 ID。 + * @param muteState 视频流的发送状态。参看 ByteRTCMuteState{@link #ByteRTCMuteState}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onRemoteAudioPropertiesReportEx:(NSArray * _Nonnull)audioPropertiesInfos; + +#pragma mark - Core Video Delegate Methods + +/** + * + * @type callback + * @brief 房间内的可见用户调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部视频采集时,房间中其他用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 视频流 ID + * @param info 视频流信息,详见 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStartVideoCapture:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 房间内的可见用户调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部视频采集时,房间内其他用户会收到此回调。
    + * 若发布视频数据前未开启采集,房间内所有可见用户会收到此回调。 + * @param engine ByteRTCEngine 实例 + * @param streamId 视频流 ID + * @param info 视频流信息,详见 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserStopVideoCapture:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info; +/** + * + * @type callback + * @brief 第一帧本地采集的视频/屏幕共享画面在本地视图渲染完成时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstLocalVideoFrameCaptured:(ByteRTCVideoSource* _Nullable)videoSource withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onFirstLocalVideoFrameCaptured:withFrameInfo:)); +/** + * + * @type callback + * @brief SDK 内部渲染成功远端视频流首帧后,收到此回调。包含以下情况:
    + * 1. 发布端首次发布视频
    + * 2. 在 1 条件下,发布端取消发布视频后,再次发布视频
    + * 3. 在 1 条件下,发布端关闭视频采集后,再次打开采集(或使用外部源时,停止推流后再次推流)
    + * 4. 在 1 条件下,订阅端取消订阅视频后,再次订阅视频(调用接口包括 subscribeAllStreamsVideo:{@link #ByteRTCRoom-subscribeAllStreamsVideo}pauseAllSubscribedStreamVideo:{@link #ByteRTCRoom-pauseAllSubscribedStreamVideo}/resumeAllSubscribedStreamVideo:{@link #ByteRTCRoom-resumeAllSubscribedStreamVideo}) + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @note 仅在采用内部渲染时,符合上述策略。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstRemoteVideoFrameRendered:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onFirstRemoteVideoFrameRendered:info:withFrameInfo:)); +/** + * + * @type callback + * @brief 订阅端接收并解码远端视频流首帧后,收到此回调。包含以下情况:
    + * 1. 发布端发布视频,包含首次发布和取消后再次发布。
    + * 2. 发布端关闭视频采集后,再次打开采集。使用外部源时,停止推流后再次推流。
    + * 3. 发布端发布视频后,订阅端取消订阅视频后,又再次订阅视频。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @note + * - 对于主流,进入房间后,仅在发布端第一次发布的时候,订阅端会收到该回调,此后不受重新发布的影响,只要不重新加入房间,就不会再收到该回调。 + * - 对于屏幕流,用户每次重新发布屏幕视频流在订阅端都会重新触发一次该回调。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstRemoteVideoFrameDecoded:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:)); + +/** + * + * @type callback + * @brief 远端视频大小或旋转信息发生改变时,房间内订阅此视频流的用户会收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteVideoSizeChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onRemoteVideoSizeChanged:info:withFrameInfo:)); +/** + * + * @type callback + * @brief 本地视频大小或旋转信息发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalVideoSizeChanged:(ByteRTCVideoSource* _Nullable)videoSource withFrameInfo:(ByteRTCVideoFrameInfo *_Nonnull)frameInfo NS_SWIFT_NAME(rtcEngine(_:onLocalVideoSizeChanged:withFrameInfo:)); +/** + * + * @type callback + * @brief 音频设备状态回调。提示音频采集、音频播放等设备的状态。 + * @param engine ByteRTCEngine 实例 + * @param deviceID 设备 ID + * @param deviceType 设备类型,参看 ByteRTCAudioDeviceType{@link #ByteRTCAudioDeviceType}。 + * @param deviceState 设备状态,参看 ByteRTCMediaDeviceState{@link #ByteRTCMediaDeviceState}。 + * @param deviceError 设备错误类型,参看 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioDeviceStateChanged:(NSString*_Nonnull)deviceID + device_type:(ByteRTCAudioDeviceType)deviceType + device_state:(ByteRTCMediaDeviceState)deviceState + device_error:(ByteRTCMediaDeviceError)deviceError; +/** + * + * @type callback + * @brief 视频设备状态发生改变回调。当设备的视频状态发生改变时,SDK 会触发该回调,提示摄像头视频采集、屏幕视频采集等设备的状态。 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine}。 + * @param deviceID 设备 ID + * @param deviceType 设备类型,参看 ByteRTCVideoDeviceType{@link #ByteRTCVideoDeviceType}。 + * @param deviceState 设备状态,参看 ByteRTCMediaDeviceState{@link #ByteRTCMediaDeviceState}。 + * @param deviceError 设备错误类型,参看 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}。 + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onVideoDeviceStateChanged:(NSString*_Nonnull)deviceID + device_type:(ByteRTCVideoDeviceType)deviceType + device_state:(ByteRTCMediaDeviceState)deviceState + device_error:(ByteRTCMediaDeviceError)deviceError; +/** + * + * @type callback + * @brief 音频设备警告回调。音频设备包括音频采集设备和音频渲染设备。 + * @param engine ByteRTCEngine 对象 + * @param deviceId 设备 ID + * @param deviceType 参看 ByteRTCAudioDeviceType{@link #ByteRTCAudioDeviceType} + * @param deviceWarning 参看 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning} + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioDeviceWarning:(NSString*_Nonnull)deviceId + deviceType:(ByteRTCAudioDeviceType)deviceType + deviceWarning:(ByteRTCMediaDeviceWarning)deviceWarning; +/** + * + * @type callback + * @brief 视频设备警告回调。视频设备包括视频采集设备。 + * @param engine ByteRTCEngine 对象 + * @param deviceId 设备 ID + * @param deviceType 参看 ByteRTCVideoDeviceType{@link #ByteRTCVideoDeviceType} + * @param deviceWarning 参看 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning} + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onVideoDeviceWarning:(NSString*_Nonnull)deviceId + deviceType:(ByteRTCVideoDeviceType)deviceType + deviceWarning:(ByteRTCMediaDeviceWarning)deviceWarning; +/** + * + * @type callback + * @brief 本地音频首帧发送状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 流 ID + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 本地用户信息,详见 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧发送状态,详见 ByteRTCFirstFrameSendState{@link #ByteRTCFirstFrameSendState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onAudioFrameSendStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state; +/** + * + * @type callback + * @brief 视频首帧发送状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 视频流 ID + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 本地用户信息,详见 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧发送状态,详见 ByteRTCFirstFrameSendState{@link #ByteRTCFirstFrameSendState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onVideoFrameSendStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFrameSendState)state; +/** + * + * @type callback + * @brief 音频首帧播放状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象。 + * @param streamId 音频流 ID + * @param info 音频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 音频流来源的用户信息,参看 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧播放状态,参看 ByteRTCFirstFramePlayState{@link #ByteRTCFirstFramePlayState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onAudioFramePlayStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state; +/** + * + * @type callback + * @brief 远端视频流的首帧播放状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象。 + * @param streamId 视频流 ID + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param user 视频流来源的用户信息,参看 ByteRTCUser{@link #ByteRTCUser} + * @param state 首帧播放状态,参看 ByteRTCFirstFramePlayState{@link #ByteRTCFirstFramePlayState} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onVideoFramePlayStateChanged:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + rtcUser:(ByteRTCUser *_Nonnull)user state:(ByteRTCFirstFramePlayState)state; +#pragma mark - Media Stream Delegate Methods + +/** + * + * @type callback + * @brief 发布音频流时,采集到第一帧音频帧,收到该回调。 + * @param engine ByteRTCEngine 对象 + * @param audioSource 预留参数 + * @note 如果发布音频流时,未开启本地音频采集,SDK 会推送静音帧,也会收到此回调。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onFirstLocalAudioFrame:(ByteRTCAudioSource* _Nullable)audioSource; +#pragma mark - Media Device Delegate Methods +/** + * + * @hidden(macOS) + * @type callback + * @brief 音频播放路由变化时,收到该回调。 + * @param engine `ByteRTCEngine` 实例 + * @param device 新的音频播放路由,详见 ByteRTCAudioRoute{@link #ByteRTCAudioRoute} + * @note 插拔音频外设,或调用 setAudioRoute:{@link #ByteRTCEngine#setAudioRoute:} 都可能触发音频路由切换,详见[移动端设置音频路由](https: + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onAudioRouteChanged:(ByteRTCAudioRoute)device; +#pragma mark custom message Delegate Methods + +/** + * + * @type callback + * @brief 收到通过调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 发送带有 SEI 消息的视频帧时,收到此回调。 + * @param engine 当前 ByteRTCEngine 实例。 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param message 收到的 SEI 消息内容 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSEIMessageReceived:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info andMessage:(NSData* _Nonnull)message; +/** + * + * @type callback + * @brief 黑帧视频流发布状态回调。
    + * 在语音通话场景下,本地用户调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 通过黑帧视频流发送 SEI 数据时,流的发送状态会通过该回调通知远端用户。
    + * 你可以通过此回调判断携带 SEI 数据的视频帧为黑帧,从而不对该视频帧进行渲染。 + * @param engine 当前 ByteRTCEngine 实例。 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param eventType 黑帧视频流状态,参看 ByteRTCSEIStreamEventType{@link #ByteRTCSEIStreamEventType} + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSEIStreamUpdate:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info eventType:(ByteRTCSEIStreamEventType)eventType; +/** + * + * @type callback + * @brief 音频流同步信息回调。可以通过此回调,在远端用户调用 sendStreamSyncInfo:config:{@link #ByteRTCEngine#sendStreamSyncInfo:config:} 发送音频流同步消息后,收到远端发送的音频流同步信息。 + * @param engine 当前 ByteRTCEngine 实例。 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param streamType 媒体流类型,详见 ByteRTCSyncInfoStreamType{@link #ByteRTCSyncInfoStreamType} 。 + * @param data 消息内容。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onStreamSyncInfoReceived:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info streamType:(ByteRTCSyncInfoStreamType)streamType data:(NSData* _Nonnull)data; +#pragma mark - Statistics Delegate Methods + +/** + * + * @type callback + * @brief 报告当前设备 cpu 与 memory 使用率,每 2s 触发一次。 + * @param engine ByteRTCEngine 对象 + * @param stats cpu 和 memory 使用率信息,详见 ByteRTCSysStats{@link #ByteRTCSysStats} 数据类型 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSysStats:(const ByteRTCSysStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:onSysStats:)); +/** + * + * @type callback + * @brief 本地音频流的状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param audioSource 预留参数 + * @param state 本地音频设备的当前状态,详见 ByteRTCLocalAudioStreamState{@link #ByteRTCLocalAudioStreamState} + * @param error 本地音频流状态改变时的错误码,详见 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalAudioStateChanged:(ByteRTCAudioSource* _Nullable)audioSource + state:(ByteRTCLocalAudioStreamState)state + error:(ByteRTCLocalAudioStreamError)error; +/** + * + * @type callback + * @brief 订阅的远端音频流状态发生改变时,收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 远端音频流的当前状态,详见 ByteRTCRemoteAudioState{@link #ByteRTCRemoteAudioState} + * @param reason 远端音频流状态改变的原因,详见 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteAudioStateChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCRemoteAudioState)state + reason:(ByteRTCRemoteAudioStateChangeReason)reason; +/** + * + * @type callback + * @brief 本地视频流的状态发生改变时,收到该事件。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param state 本地视频流的当前状态,参看 ByteRTCLocalVideoStreamState{@link #ByteRTCLocalVideoStreamState} + * @param error 本地视频状态改变时的错误码,参看 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} + * @list 视频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalVideoStateChanged:(ByteRTCVideoSource* _Nullable)videoSource + withStreamState:(ByteRTCLocalVideoStreamState)state + withStreamError:(ByteRTCLocalVideoStreamError)error NS_SWIFT_NAME(rtcEngine(_:onLocalVideoStateChanged:withStreamState:withStreamError:)); +/** + * + * @type callback + * @brief 远端视频流的状态发生改变时,房间内订阅此流的用户会收到该事件。 + * @param engine ByteRTCEngine 对象 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 远端视频流的当前状态,参看 ByteRTCRemoteVideoState{@link #ByteRTCRemoteVideoState} + * @param reason 远端视频流状态改变的原因,参看 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} + * @note 本回调仅适用于主流,不适用于屏幕流。 + * @list 音视频传输 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteVideoStateChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + withVideoState:(ByteRTCRemoteVideoState)state + withVideoStateReason:(ByteRTCRemoteVideoStateChangeReason)reason NS_SWIFT_NAME(rtcEngine(_:onRemoteVideoStateChanged:info:withVideoState:withVideoStateReason:)); +/** + * + * @hidden not available on iOS + * @valid since 3.54 + * @type callback + * @brief 远端视频流的超分状态发生改变时,房间内订阅此流的用户会收到该回调。 + * @param engine `ByteRTCEngine` 实例 + * @param streamId 远端流 ID。 + * @param info 远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param mode 超分模式,参看 ByteRTCVideoSuperResolutionMode{@link #ByteRTCVideoSuperResolutionMode}。 + * @param reason 超分模式改变原因,参看 ByteRTCVideoSuperResolutionModeChangedReason{@link #ByteRTCVideoSuperResolutionModeChangedReason}。 + * @list 视频处理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteVideoSuperResolutionModeChanged:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info + withMode:(ByteRTCVideoSuperResolutionMode)mode + withReason:(ByteRTCVideoSuperResolutionModeChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:onRemoteVideoSuperResolutionModeChanged:info:withMode:withReason:)); +/** + * + * @valid since 3.54 + * @hidden not available on iOS + * @type callback + * @brief 降噪模式状态变更回调。当降噪模式的运行状态发生改变,SDK 会触发该回调,提示用户降噪模式改变后的运行状态及状态发生改变的原因。 + * @param engine `ByteRTCEngine` 实例 + * @param mode 视频降噪模式,参看 ByteRTCVideoDenoiseMode{@link #ByteRTCVideoDenoiseMode}。 + * @param reason 视频降噪模式改变的原因,参看 ByteRTCVideoDenoiseModeChangedReason{@link #ByteRTCVideoDenoiseModeChangedReason}。 + * @list 视频处理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine + onVideoDenoiseModeChanged:(ByteRTCVideoDenoiseMode)mode + withReason:(ByteRTCVideoDenoiseModeChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:onVideoDenoiseModeChanged:withReason:)); + +#pragma mark - Rtm +/** + * + * @type callback + * @brief 登录结果回调 + * @param engine ByteRTCEngine 对象 + * @param uid
    + * 登录用户 ID + * @param errorCode
    + * 登录结果
    + * 详见 ByteRTCLoginErrorCode{@link #ByteRTCLoginErrorCode}。 + * @param elapsed
    + * 从调用 login:uid:{@link #ByteRTCEngine#login:uid:} 接口开始到返回结果所用时长。
    + * 单位为 ms。 + * @note 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLoginResult:(NSString * _Nonnull)uid errorCode:(ByteRTCLoginErrorCode)errorCode elapsed:(NSInteger)elapsed; +/** + * + * @type callback + * @brief 登出结果回调 + * @param engine ByteRTCEngine 对象 + * @param reason 用户登出的原因,参看 ByteRTCLogoutReason{@link #ByteRTCLogoutReason} + * @note 在以下两种情况下会收到此回调:调用 logout{@link #ByteRTCEngine#logout} 接口主动退出;或其他用户以相同 UserId 进行 `login` 导致本地用户被动登出。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLogout:(ByteRTCLogoutReason)reason; +/** + * + * @type callback + * @brief 设置应用服务器参数的返回结果 + * @param engine ByteRTCEngine 对象 + * @param errorCode
    + * 设置结果
    + * - 返回 200,设置成功 + * - 返回其他,设置失败,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @note 调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onServerParamsSetResult:(NSInteger)errorCode; +/** + * + * @type callback + * @brief 查询对端或本端用户登录状态的返回结果 + * @param engine ByteRTCEngine 对象 + * @param peerUserId
    + * 需要查询的用户 ID + * @param status
    + * 查询的用户登录状态
    + * 详见 ByteRTCUserOnlineStatus{@link #ByteRTCUserOnlineStatus}. + * @note 必须先调用 getPeerOnlineStatus:{@link #ByteRTCEngin e#getPeerOnlineStatus:},才能收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onGetPeerOnlineStatus:(NSString * _Nonnull)peerUserId status:(ByteRTCUserOnlineStatus)status; +/** + * + * @type callback + * @brief > 该接口将于 3.64 rtcEngine:onUserMessageReceivedOutsideRoom:uid:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageReceivedOutsideRoom:uid:message:} 代替。 + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 发来的文本消息时,会收到此回调 + * @param engine ByteRTCEngine 对象。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message; +/** + * + * @type callback + * @brief > 该接口将于 3.64 rtcEngine:onUserBinaryMessageReceivedOutsideRoom:uid:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserBinaryMessageReceivedOutsideRoom:uid:message:} 代替。 + * @brief 收到房间外用户调用 sendUserBinaryMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserBinaryMessageOutsideRoom:message:config:} 发来的二进制消息时,会收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param uid 消息发送者 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserBinaryMessageReceivedOutsideRoom:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message; +/** + * + * @type callback + * @brief 收到房间外用户调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 发来的文本消息时,会收到此回调 + * @param engine ByteRTCEngine 对象。 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserMessageReceivedOutsideRoom:(NSInteger)msgid uid:(NSString * _Nonnull)uid message:(NSString * _Nonnull)message; +/** + * + * @type callback + * @brief 收到房间外用户调用 sendUserBinaryMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserBinaryMessageOutsideRoom:message:config:} 发来的二进制消息时,会收到此回调。 + * @param engine ByteRTCEngine 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserBinaryMessageReceivedOutsideRoom:(NSInteger)msgid uid:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message; +/** + * + * @type callback + * @brief 给房间外指定的用户发送消息的回调 + * @param engine ByteRTCEngine 对象 + * @param msgid
    + * 本条消息的 ID
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error
    + * 消息发送结果
    + * 详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult}。 + * @note 当调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 或 sendUserBinaryMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserBinaryMessageOutsideRoom:message:config:} 发送消息后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onUserMessageSendResultOutsideRoom:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; +/** + * + * @type callback + * @brief 给应用服务器发送消息的回调。 + * @param engine ByteRTCEngine 对象。 + * @param msgid 本条消息的 ID。
    + * 所有的 P2P 和 P2Server 消息共用一个 ID 序列。 + * @param error 消息发送结果。详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult}。 + * @param message 应用服务器收到 HTTP 请求后,在 ACK 中返回的信息。消息不超过 64 KB。 + * @note 本回调为异步回调。当调用 sendServerMessage:{@link #ByteRTCEngin e#sendServerMessage:} 或 sendServerBinaryMessage:{@link #ByteEngin e#sendServerBinaryMessage:} 接口发送消息后,会收到此回调。 + * @list 消息 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onServerMessageSendResult:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error message:(NSData * _Nonnull)message; +#pragma mark - Network Probe Methods +/** + * + * @type callback + * @brief 通话前网络探测结果的回调。
    + * 成功调用 startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth:{@link #ByteRTCEngine#startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth:} 接口开始探测后,会在 3s 内首次收到该回调,之后每 2s 收到一次该回调。 + * @param engine ByteRTCEngine 对象 + * @param type 探测网络类型为上行/下行 + * @param quality 探测网络的质量,参看 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality}。 + * @param rtt 探测网络的 RTT,单位:ms + * @param lostRate 探测网络的丢包率 + * @param bitrate 探测网络的带宽,单位:kbps + * @param jitter 探测网络的抖动,单位:ms + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onNetworkDetectionResult:(ByteRTCNetworkDetectionLinkType)type quality:(ByteRTCNetworkQuality)quality rtt:(int)rtt lostRate:(double)lostRate bitrate:(int)bitrate jitter:(int)jitter; +/** + * + * @type callback + * @brief 通话前网络探测结束
    + * 以下情况将停止探测并收到一次本回调:
    + * 1. 当调用 stopNetworkDetection{@link #ByteRTCEngine#stopNetworkDetection} 接口停止探测后,会收到一次该回调;
    + * 2. 当收到远端/本端音频首帧后,停止探测;
    + * 3. 当探测超过 3 分钟后,停止探测;
    + * 4. 当探测链路断开一定时间之后,停止探测。 + * @param engine ByteRTCEngine 对象 + * @param errorCode
    + * 停止探测的原因类型,参考 ByteRTCNetworkDetectionStopReason{@link #ByteRTCNetworkDetectionStopReason} + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onNetworkDetectionStopped:(ByteRTCNetworkDetectionStopReason)errorCode; +#pragma mark - Log Delegate Methods + +/** + * + * @deprecated since 3.45 and will be deleted in 3.51. + * @type callback + * @brief SDK 内部日志回调。
    + * SDK 内部运行时,会把日志回调给业务方,方便排查问题。 + * @param engine ByteRTCEngine 对象。 + * @param dict 日志内容。 + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine log:(NSDictionary* _Nonnull)dict; +#pragma mark Audio Mix Delegate Methods + +/** + * + * @type callback + * @brief 混音音频文件播放进度回调 + * @param engine 当前 RTC SDK 对象 + * @param mixId 混音 ID + * @param progress 当前混音音频文件播放进度,单位毫秒 + * @note 调用 start:filePath:config: 将 ByteRTCAudioEffectPlayerConfig 中的时间间隔设为大于 0 的值后,SDK 会按照设置的时间间隔回调该事件。 + * @list 混音 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onAudioMixingPlayingProgress:(NSInteger)mixId progress:(int64_t) progress; +#pragma mark Performance Delegate Methods + +/** + * + * @type callback + * @brief 本地未通过 setPublishFallbackOption:{@link #ByteRTCEngine#setPublishFallbackOption:} 开启发布性能回退,检测到设备性能不足时,收到此回调。
    + * 本地通过 setPublishFallbackOption:{@link #ByteRTCEngine#setPublishFallbackOption:} 开启发布性能回退,因设备性能/网络原因,造成发布性能回退/恢复时,收到此回调。 + * @param engine `ByteRTCEngine` 实例 + * @param streamId 流 ID + * @param info 流信息, 参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param mode 指示本地是否开启发布回退功能。参看 ByteRTCPerformanceAlarmMode{@link #ByteRTCPerformanceAlarmMode}
    + * - 当发布端未开启发布性能回退时,mode 值为 ByteRTCPerformanceAlarmModeNormal。 + * - 当发布端开启发布性能回退时,mode 值为 ByteRTCPerformanceAlarmModeSimulcast。 + * @param reason 告警原因,参看 ByteRTCPerformanceAlarmReason{@link #ByteRTCPerformanceAlarmReason} + * @param data 性能回退相关数据,详见 ByteRTCSourceWantedData{@link #ByteRTCSourceWantedData}。 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onPerformanceAlarms:(NSString* _Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + mode:(ByteRTCPerformanceAlarmMode)mode + reason:(ByteRTCPerformanceAlarmReason)reason + sourceWantedData:(ByteRTCSourceWantedData *_Nonnull)data; +/** + * + * @type callback + * @brief 音视频流因网络环境变化等原因发生回退,或从回退中恢复时,触发该回调。 + * @param engine 当前 ByteRTCEngine 实例 + * @param streamId 流 ID + * @param info 流信息, 参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param event 流切换信息。详见 ByteRTCRemoteStreamSwitchEvent{@link #ByteRTCRemoteStreamSwitchEvent}。 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onSimulcastSubscribeFallback:(NSString* _Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info event:(ByteRTCRemoteStreamSwitchEvent *_Nonnull)event; + +#if BYTERTC_TARGET_MAC +/** + * + * @hidden + * @type callback + * @brief 外部采集时,调用 setOriginalScreenVideoInfo:withOriginalCaptureHeight: 设置屏幕或窗口大小改变前的分辨率后,若屏幕采集模式为智能模式,你将收到此回调,根据 RTC 智能决策合适的帧率和分辨率积(宽*高)重新采集。 + * @param engine 参看 ByteRTCEngine{@link #ByteRTCEngine} + * @param frameUpdateInfo RTC 智能决策后合适的帧率和分辨率积(宽*高)。参看 ByteRTCFrameUpdateInfo{@link #ByteRTCFrameUpdateInfo}。 + * @list Network Processing + */ + +- (void)rtcEngine: (ByteRTCEngine* _Nonnull)engine onExternalScreenFrameUpdate: (ByteRTCFrameUpdateInfo* _Nullable)frameUpdateInfo; +#endif +#pragma mark FileRecording related callback +/** + * + * @type callback + * @brief 获取本地录制状态回调。
    + * 该回调由 startFileRecording:type:{@link #ByteRTCEngine#startFileRecording:type:} 或 stopFileRecording:{@link #ByteRTCEngine#stopFileRecording:} 触发。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param state 录制状态,参看 ByteRTCRecordingState{@link #ByteRTCRecordingState} + * @param errorCode 录制错误码,参看 ByteRTCRecordingErrorCode{@link #ByteRTCRecordingErrorCode} + * @param recordingInfo 录制文件的详细信息,参看 ByteRTCRecordingInfo{@link #ByteRTCRecordingInfo} + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine onRecordingStateUpdate:(ByteRTCVideoSource* _Nullable)videoSource + state:(ByteRTCRecordingState)state + error_code:(ByteRTCRecordingErrorCode)errorCode + recording_info:(ByteRTCRecordingInfo* _Nonnull)recordingInfo; + +/** + * + * @type callback + * @brief 本地录制进度回调。
    + * 该回调由 startFileRecording:type:{@link #ByteRTCEngine#startFileRecording:type:} 触发,录制状态正常时,系统每秒钟都会通过该回调提示录制进度。 + * @param engine ByteRTCEngine 对象 + * @param videoSource 预留参数 + * @param process 录制进度,参看 ByteRTCRecordingProgress{@link #ByteRTCRecordingProgress} + * @param recordingInfo 录制文件的详细信息,参看 ByteRTCRecordingInfo{@link #ByteRTCRecordingInfo} + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine onRecordingProgressUpdate:(ByteRTCVideoSource* _Nullable)videoSource + process:(ByteRTCRecordingProgress* _Nonnull)process + recording_info:(ByteRTCRecordingInfo* _Nonnull)recordingInfo; +/** + * + * @type callback + * @brief 调用 startAudioRecording:{@link #ByteRTCEngine#startAudioRecording:} 或者 stopAudioRecording{@link #ByteRTCEngine#stopAudioRecording} 改变音频文件录制状态时,收到此回调。 + * @param engine `ByteRTCEngine` 实例 + * @param state 录制状态,参看 ByteRTCAudioRecordingState{@link #ByteRTCAudioRecordingState} + * @param errorCode 录制错误码,参看 ByteRTCAudioRecordingErrorCode{@link #ByteRTCAudioRecordingErrorCode} + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine + onAudioRecordingStateUpdate:(ByteRTCAudioRecordingState)state + error_code:(ByteRTCAudioRecordingErrorCode)errorCode; +/** + * + * @deprecated since 3.60, use rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:} instead. + * @type callback + * @brief WTN 流发布结果回调。
    + * 调用 startPushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#startPushMixedStream:withPushTargetConfig:withMixedConfig:}
    + * 接口或直接在服务端启动推 WTN 流功能后,你会通过此回调收到启动结果和推流过程中的错误。 + * @param engine engine 实例 + * @param roomId 发布 WTN 流的房间 ID + * @param streamId WTN 流 ID。 + * @param errorCode WTN 流发布结果状态码。 详见 ByteRTCPublicStreamErrorCode{@link #ByteRTCPublicStreamErrorCode}。 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onPushPublicStreamResult:(NSString *_Nonnull)roomId + publicStreamId:(NSString *_Nonnull)streamId + errorCode:(ByteRTCPublicStreamErrorCode)errorCode; +/** + * + * @type callback + * @brief 调用 startCloudProxy:{@link #ByteRTCEngine#startCloudProxy:} 开启云代理,SDK 首次成功连接云代理服务器时,回调此事件。 + * @param engine `ByteRTCEngine` 实例 + * @param interval 从开启云代理到连接成功经过的时间,单位为 ms + * @list 通话加密 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onCloudProxyConnected:(NSInteger)interval; +/** + * + * @type callback + * @brief 关于音视频回路测试结果的回调。 + * @param engine `ByteRTCEngine` 实例 + * @param result 测试结果,参看 ByteRTCEchoTestResult{@link #ByteRTCEchoTestResult}。 + * @note 该回调触发的时机包括:
    + * - 检测过程中采集设备发生错误时; + * - 检测成功后; + * - 非设备原因导致检测过程中未接收到音/视频回放,停止检测后。 + * @list 网络管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onEchoTestResult:(ByteRTCEchoTestResult)result NS_SWIFT_NAME(rtcEngine(_:onEchoTestResult:)); +/** + * + * @hidden for internal use only + * @type callback + * @brief 音频 dump 状态回调。 + * @param engine `ByteRTCEngine` 实例 + * @param status 音频 dump 状态,参看 ByteRTCAudioDumpStatus{@link #ByteRTCAudioDumpStatus}。 + * @note 本回调用于内部排查音质相关异常问题,开发者无需关注。 + * @list Network Processing + */ + +- (void)rtcEngine: (ByteRTCEngine* _Nonnull)engine onAudioDumpStateChanged: (ByteRTCAudioDumpStatus)status; +/** + * + * @type callback + * @brief 首次调用 getNetworkTimeInfo{@link #ByteRTCEngine#getNetworkTimeInfo} 后,SDK 内部启动网络时间同步,同步完成时会触发此回调。 + * @param engine ByteRTCEngine{@link #ByteRTCEngine} 对象 + * @list 网络管理 + */ + +- (void)rtcEngineOnNetworkTimeSynchronized:(ByteRTCEngine *_Nonnull)engine; +/** + * + * @hidden internal use only + * @type callback + * @brief license 过期时间提醒 + * @param engine ByteRTCEngine{@link #ByteRTCEngine} 对象 + * @param days 过期时间天数 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLicenseWillExpire:(NSInteger)days; +/** + * + * @type callback + * @brief AIGC(AI 音视频互动方案)使用 License 计费的场景下,当 License 配额用尽时,会收到该回调。收到该回调时,AIGC 服务会中止,请及时续费,并且建议离开房间、销毁 SDK。 + * @param engine ByteRTCEngine{@link #ByteRTCEngine} 对象 + * @param message 回调消息 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLicenseQuotaExceeded:(NSString *_Nullable)message; +/** + * + * @type callback + * @brief 通话前回声检测结果回调。 + * @param engine `ByteRTCEngine` 实例 + * @param result 参见 ByteRTCHardwareEchoDetectionResult{@link #ByteRTCHardwareEchoDetectionResult}。 + * @note + * - 通话前调用 startHardwareEchoDetection:{@link #ByteRTCEngine#startHardwareEchoDetection:} 后,将触发本回调返回检测结果。 + * - 建议在收到检测结果后,调用 stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * - 如果 SDK 在通话中检测到回声,将通过 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调 `ByteRTCMediaDeviceWarningDetectLeakEcho`。 + * @list 音频管理 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onHardwareEchoDetectionResult:(ByteRTCHardwareEchoDetectionResult)result NS_SWIFT_NAME(rtcEngine(_:onHardwareEchoDetectionResult:)); +/** + * + * @type callback + * @brief 本地代理状态发生改变回调。调用 setLocalProxy:{@link #ByteRTCEngin e#setLocalProxy:} 设置本地代理后,SDK 会触发此回调,返回代理连接的状态。 + * @param engine `ByteRTCEngine` 实例 + * @param type 本地代理类型。参看 ByteRTCLocalProxyType{@link #ByteRTCLocalProxyType} 。 + * @param state 本地代理状态。参看 ByteRTCLocalProxyState{@link #ByteRTCLocalProxyState}。 + * @param error 本地代理错误。参看 ByteRTCLocalProxyError{@link #ByteRTCLocalProxyError}。 + * @list 通话加密 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onLocalProxyStateChanged:(ByteRTCLocalProxyType)type withProxyState:(ByteRTCLocalProxyState)state withProxyError:(ByteRTCLocalProxyError)error; +/** + * + * @hidden internal use only + * @type callback + * @brief 当特效设置失败时,收到此回调。 + * @param engine `ByteRTCEngine` 实例 + * @param error 特效错误类型。参看 ByteRTCEffectErrorType{@link #ByteRTCEffectErrorType}。 + * @param msg 错误信息。 + * @list Encryption + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onEffectError:(ByteRTCEffectErrorType)error msg:(NSString * _Nonnull)msg; +#pragma mark - CDN/WTN +/** + * + * @valid since 3.60. 自 3.60 起,该回调替代了 `onStreamMixingEvent:taskId:error:mixType:` 和 `rtcEngine:onPushPublicStreamResult:publicStreamId:errorCode:` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此回调。 + * @hidden(Linux) + * @type callback + * @brief 合流转推 CDN / WTN 流状态回调 + * @param engine ByteRTCEngine 对象。 + * @param event 任务事件,参看 ByteRTCMixedStreamTaskEvent{@link #ByteRTCMixedStreamTaskEvent}。 + * @param info 任务详情,参看 ByteRTCMixedStreamTaskInfo{@link #ByteRTCMixedStreamTaskInfo}。 + * @param errorCode 任务错误码,参看 ByteRTCMixedStreamTaskErrorCode{@link #ByteRTCMixedStreamTaskErrorCode}。 + * @list CDN 推流 + * @order 0 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onMixedStreamEvent:(ByteRTCMixedStreamTaskEvent)event withMixedStreamInfo:(ByteRTCMixedStreamTaskInfo*)info withErrorCode:(ByteRTCMixedStreamTaskErrorCode)errorCode; + /** + * + * @valid since 3.60. + * @type callback + * @brief 单流转推 CDN 状态回调。 + * @param engine ByteRTCEngine 对象。 + * @param event 任务状态, 参看 ByteRTCSingleStreamTaskEvent{@link #ByteRTCSingleStreamTaskEvent}。 + * @param taskId 任务 ID。 + * @param errorCode 错误码,参看 ByteRTCSingleStreamTaskErrorCode{@link #ByteRTCSingleStreamTaskErrorCode}。 + * @list CDN 推流 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onSingleStreamEvent:(ByteRTCSingleStreamTaskEvent)event withTaskId:(NSString*)taskId withErrorCode:(ByteRTCSingleStreamTaskErrorCode)errorCode; +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流音频首帧回调 + * @param taskId 任务 ID + * @list CDN 推流 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onEffectError:(ByteRTCEffectErrorType)error msg:(NSString * _Nonnull)msg; +/** + * + * @type callback + * @valid since 3.60. + * @brief 调用 takeRemoteSnapshotToFile:filePath:{@link #ByteRTCEngine#takeRemoteSnapshotToFile:filePath:} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param engine ByteRTCEngine 对象。 + * @param streamId 被截图的视频流 ID。 + * @param info 视频流信息,参考 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param filePath 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param errorCode 截图错误码。参看 ByteRTCSnapshotErrorCode{@link #ByteRTCSnapshotErrorCode}。 + * @param taskId 截图任务的编号,和 takeRemoteSnapshotToFile:filePath:{@link #ByteRTCEngine#takeRemoteSnapshotToFile:filePath:} 的返回值一致。 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onRemoteSnapshotTakenToFile:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info filePath:(NSString * _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errorCode:(ByteRTCSnapshotErrorCode)errorCode taskId:(NSInteger)taskId; +/** + * + * @type callback + * @valid since 3.60. + * @brief 调用 takeLocalSnapshotToFile:{@link #ByteRTCEngine#takeLocalSnapshotToFile:} 截取视频画面时,会收到此回调报告截图是否成功,以及截取的图片信息。 + * @param engine ByteRTCEngine 对象。 + * @param videoSource 预留参数 + * @param filePath 截图文件的保存路径。 + * @param width 截图图像的宽度。单位:像素。 + * @param height 截图图像的高度。单位:像素。 + * @param errorCode 截图错误码。参看 ByteRTCSnapshotErrorCode{@link #ByteRTCSnapshotErrorCode}。 + * @param taskId 截图任务的编号,和 takeLocalSnapshotToFile:{@link #ByteRTCEngine#takeLocalSnapshotToFile:} 的返回值一致。 + * @list 高级功能 + */ + +- (void)rtcEngine:(ByteRTCEngine *_Nonnull)engine onLocalSnapshotTakenToFile:(ByteRTCVideoSource* _Nullable)videoSource filePath:(NSString * _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errorCode:(ByteRTCSnapshotErrorCode)errorCode taskId:(NSInteger)taskId; + +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流视频首帧回调 + * @param taskId 任务 ID + * @list CDN 推流 + */ + + - (void)rtcEngine:(ByteRTCEngine* _Nonnull)engine onClientMixedFirstVideoFrame:(NSString *)taskId; +/** + * + * @hidden internal use only + * @valid since 3.60. + * @type callback + * @brief 试验性接口回调 + * @param param 回调内容(JSON string) + * @list 引擎管理 + */ + +- (void)rtcEngine:(ByteRTCEngine * _Nonnull)engine onExperimentalCallback:(NSString * _Nonnull) param; +@end +#pragma mark - RTCEngine +/** + * + * @type api + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEngine : NSObject +/** + * + * @type callback + */ + +@property (nonatomic, weak) id _Nullable delegate; +/** + * @hidden + * @deprecated + */ + +@property (nonatomic, weak) id _Nullable monitorDelegate + __deprecated_msg("Will be removed in new version"); + + +/** + * + * @type api + * @brief 创建引擎对象。
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 + * @param config 创建引擎参数配置,详见 ByteRTCEngineConfig{@link #ByteRTCEngineConfig} + * @param delegate SDK 回调给应用层的 delegate,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} + * @return 可用的 ByteRTCEngine{@link #ByteRTCEngine} 实例 + * @list 引擎管理 + */ + ++ (ByteRTCEngine * _Nullable) createRTCEngine:(ByteRTCEngineConfig * _Nonnull) config + delegate:(id _Nullable)delegate; +/** + * + * @hidden internal use only + * @type api + * @brief 创建多实例引擎对象
    + * 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    + * 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新创建的引擎实例。 + * @param config 创建引擎参数配置,详见 ByteRTCEngineConfig{@link #ByteRTCEngineConfig} + * @param delegate SDK 回调给应用层的 delegate,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} + * @return + * - RTCVideo:创建成功。返回一个可用的 ByteRTCEngine{@link #ByteRTCEngine} 实例 + * - Null:.so 文件加载失败,创建失败。 + * @note 你应注意保持 handler 的生命周期必须大于 ByteRTCEngine 的生命周期,即 handler 必须在调用 destroyRTCEngine{@link #ByteRTCEngine#destroyRTCEngine} 之后销毁。 + */ + ++ (ByteRTCEngine * _Nullable) createRTCEngineMulti:(ByteRTCEngineConfig * _Nonnull)config + delegate:(id _Nullable)delegate; +/** + * + * @type api + * @brief 销毁由 createRTCEngine:delegate:{@link #ByteRTCEngine#createRTCEngine:delegate:} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的业务场景全部结束后,才调用此方法 + * - 该方法在调用之后,会销毁所有和此 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * - 可以通过 Objective-C 的 ARC 机制,在 dealloc 时自动触发销毁逻辑 + * @list 引擎管理 + */ + ++ (void)destroyRTCEngine NS_SWIFT_NAME(destroyRTCEngine()); +/** + * + * @hidden internal use only + * @type api + * @brief 销毁由 createRTCEngineMulti:delegate:{@link #ByteRTCEngine#createRTCEngineMulti:delegate:} 所创建的引擎实例,并释放所有相关资源。 + * @note + * - 请确保和需要销毁的 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的业务场景全部结束后,才调用此方法 + * - 该方法在调用之后,会销毁所有和此 ByteRTCEngine{@link #ByteRTCEngine} 实例相关的内存,并且停止与媒体服务器的任何交互 + * - 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + * - 可以通过 Objective-C 的 ARC 机制,在 dealloc 时自动触发销毁逻辑 + * @list 引擎管理 + */ + ++ (void)destroyRTCEngineMulti:(ByteRTCEngine*)engine; +/** + * + * @type api + * @brief 获取 SDK 当前的版本号。 + * @return SDK 当前的版本号。 + * @list 引擎管理 + */ + ++ (NSString * _Nonnull)getSDKVersion; +/** + * + * @type api + * @brief 配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。 + * @param logConfig 本地日志参数,参看 ByteRTCLogConfig{@link #ByteRTCLogConfig}。 + * @return + * - 0:成功。 + * - –1:失败,本方法必须在创建引擎前调用。 + * - –2:失败,参数填写错误。 + * @note 本方法必须在调用 createRTCEngine:delegate:{@link #ByteRTCEngine#createRTCEngine:delegate:} 之前调用。 + * @list 引擎管理 + */ + ++ (int) setLogConfig:(ByteRTCLogConfig *_Nonnull) logConfig; + +#pragma mark Core Audio Methods + +/** + * + * @type api + * @brief 切换音频采集方式 + * @param type 音频数据源,详见 ByteRTCAudioSourceType{@link #ByteRTCAudioSourceType}。
    + * 默认使用内部音频采集。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
    + * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法由内部采集切换至自定义采集,SDK 会自动关闭内部采集。然后,调用 pushExternalAudioFrame:{@link #ByteRTCEngine#pushExternalAudioFrame:} 推送自定义采集的音频数据到 RTC SDK 用于传输。 + * - 如果你调用此方法由自定义采集切换至内部采集,你必须再调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 手动开启内部采集。 + * @list 自定义流处理 + */ + +- (int)setAudioSourceType:(ByteRTCAudioSourceType) type; +/** + * + * @type api + * @brief 切换音频渲染方式 + * @param type 音频输出类型,详见 ByteRTCAudioRenderType{@link #ByteRTCAudioRenderType}
    + * 默认使用内部音频渲染。音频采集和渲染方式无需对应。 + * @return 方法调用结果:
    + * - =0: 切换成功。 + * - <0:切换失败。 + * @note + * - 进房前后调用此方法均有效。 + * - 如果你调用此方法切换至自定义渲染,调用 pullExternalAudioFrame:{@link #ByteRTCEngine#pullExternalAudioFrame:} 获取音频数据。 + * @list 自定义流处理 + */ + +- (int)setAudioRenderType:(ByteRTCAudioRenderType) type; +/** + * + * @type api + * @brief 开启内部音频采集。默认为关闭状态。
    + * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
    + * 调用该方法开启后,本地用户会收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStartAudioCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartAudioCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 若未取得当前设备的麦克风权限,调用该方法后会触发 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 回调,对应的错误码为 `ByteRTCMediaDeviceError.ByteRTCMediaDeviceErrorDeviceNoPermission = 1`。 + * - 调用 stopAudioCapture{@link #ByteRTCEngine#stopAudioCapture} 可以关闭音频采集设备,否则,SDK 只会在销毁引擎的时候自动关闭设备。 + * - 由于不同硬件设备初始化响应时间不同,频繁调用 stopAudioCapture{@link #ByteRTCEngine#stopAudioCapture} 和本接口闭麦/开麦可能出现短暂无声问题,建议使用 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:} 实现临时闭麦和重新开麦。 + * - 创建引擎后,无论是否发布音频数据,你都可以调用该方法开启音频采集,并且调用后方可发布音频。 + * - 如果需要从自定义音频采集切换为内部音频采集,你必须先停止发布流,调用 setAudioSourceType:{@link #ByteRTCEngine#setAudioSourceType:} 关闭自定义采集,再调用此方法手动开启内部采集。 + * @list 音频管理 + */ + +- (int)startAudioCapture; + /** + * + * @type api + * @brief 关闭内部音频采集。默认为关闭状态。
    + * 内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
    + * 调用该方法,本地用户会收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopAudioCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStopAudioCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 可以开启音频采集设备。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部音频采集才会停止。 + * @list 音频管理 + */ + +- (int)stopAudioCapture; +/** + * + * @hidden(macOS) + * @valid since 3.60. + * @type api + * @brief 设置音频场景类型。
    + * 选择音频场景后,SDK 会自动根据场景切换对应的音量模式(通话音量/媒体音量)和该场景下的最佳音频配置。
    + * @param audioScenario 音频场景类型,参看 ByteRTCAudioScenarioType{@link #ByteRTCAudioScenarioType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 此接口必须在加入 RTC 房间前调用。 + * - 通话音量更适合通话、会议等对信息准确度更高的场景。通话音量会激活系统硬件信号处理,使通话声音更清晰。同时,音量无法降低到 0。 + * - 媒体音量更适合娱乐场景,因其声音的表现力会更强。媒体音量下,最低音量可以为 0。 + * @list 音频管理 + */ + +- (int)setAudioScenario:(ByteRTCAudioScenarioType)audioScenario; +/** + * + * @type api + * @brief 设置音质档位。
    + * 当所选的 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 中的音频参数无法满足你的场景需求时,调用本接口切换的音质档位。 + * @param audioProfile 音质档位,参看 ByteRTCAudioProfileType{@link #ByteRTCAudioProfileType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法在进房前后均可调用; + * - 支持通话过程中动态切换音质档位。 + * @list 音频管理 + */ + +- (int)setAudioProfile:(ByteRTCAudioProfileType)audioProfile; +/** + * + * @valid since 3.52 + * @type api + * @brief 支持根据业务场景,设置通话中的音频降噪模式。 + * @param ansMode 降噪模式。具体参见 ByteRTCAnsMode{@link #ByteRTCAnsMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该接口进房前后均可调用,可重复调用,仅最后一次调用生效。 + * - 降噪算法包含传统降噪和 AI 降噪。传统降噪主要是抑制平稳噪声,比如空调声、风扇声等。而 AI 降噪主要是抑制非平稳噪声,比如键盘敲击声、桌椅碰撞声等。 + * - 只有以下 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 场景时,调用本接口可以开启 AI 降噪。其余场景的 AI 降噪不会生效。 + * - 游戏语音模式: `ByteRTCRoomProfileGame` + * - 高音质游戏模式: `ByteRTCRoomProfileGameHD` + * - 云游戏模式: `ByteRTCRoomProfileCloudGame` + * - 1 vs 1 音视频通话: `ByteRTCRoomProfileChat` + * - 多端同步播放音视频:`ByteRTCRoomProfileLwTogether` + * - 云端会议中的个人设备:`ByteRTCRoomProfileMeeting` + * - 课堂互动模式:`ByteRTCRoomProfileClassroom` + * - 云端会议中的会议室终端:`ByteRTCRoomProfileMeetingRoom` + * @list 高级功能 + */ + +- (int)setAnsMode:(ByteRTCAnsMode)ansMode; + +#if BYTERTC_TARGET_MAC +/** + * + * @hidden(iOS) + * @valid since 3.51 + * @type api + * @brief 打开/关闭 AGC(Analog Automatic Gain Control)模拟自动增益控制功能。
    + * 开启该功能后,SDK 会自动调节麦克风的采集音量,确保音量稳定。 + * @param enable 是否打开 AGC 功能:
    + * - true: 打开 AGC 功能。 + * - false: 关闭 AGC 功能。 + * @return + * - 0: 调用成功。 + * - -1: 调用失败。 + * @note + * 该方法在进房前后均可调用。如果你需要在进房前使用 AGC 功能,请联系技术支持获得私有参数,传入对应 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 。
    + * 要想在进房后开启 AGC 功能,你需要把 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 设为 `ByteRTCRoomProfileMeeting`、`ByteRTCRoomProfileMeetingRoom` 或`ByteRTCRoomProfileClassroom` 。
    + * AGC 功能生效后,不建议再调用 `setAudioCaptureDeviceVolume:` 来调节设备麦克风的采集音量。 + * @list 音频管理 + */ + +- (int)enableAGC:(BOOL)enable; +#endif +/** + * + * @valid since 3.32 + * @type api + * @brief 设置变声特效类型 + * @param voiceChanger 变声特效类型,参看 ByteRTCVoiceChangerType{@link #ByteRTCVoiceChangerType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 如需使用该功能,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 与 setVoiceReverbType:{@link #ByteRTCEngine#setVoiceReverbType:} 互斥,后设置的特效会覆盖先设置的特效。 + * @list 音频处理 + */ + +- (int)setVoiceChangerType:(ByteRTCVoiceChangerType)voiceChanger; +/** + * + * @valid since 3.32 + * @type api + * @brief 设置混响特效类型 + * @param voiceReverb 混响特效类型,参看 ByteRTCVoiceReverbType{@link #ByteRTCVoiceReverbType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 在进房前后都可设置。 + * - 对 RTC SDK 内部采集的音频和自定义采集的音频都生效。 + * - 只对单声道音频生效。 + * - 与 setVoiceChangerType:{@link #ByteRTCEngine#setVoiceChangerType:} 互斥,后设置的特效会覆盖先设置的特效。 + * @list 音频处理 + */ + +- (int)setVoiceReverbType:(ByteRTCVoiceReverbType)voiceReverb; +/** + * + * @type api + * @brief 设置本地采集语音的均衡效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param config 语音均衡效果,参看 ByteRTCVoiceEqualizationConfig{@link #ByteRTCVoiceEqualizationConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 根据奈奎斯特采样率,音频采样率必须大于等于设置的中心频率的两倍,否则,设置不生效。 + * @list 音频处理 + */ + +-(int)setLocalVoiceEqualization:(ByteRTCVoiceEqualizationConfig* _Nonnull)config; +/** + * + * @type api + * @brief 设置本地采集音频的混响效果。包含内部采集和外部采集,但不包含混音音频文件。 + * @param param 混响效果,参看 ByteRTCVoiceReverbConfig{@link #ByteRTCVoiceReverbConfig} + * @return + * - 0: 成功。 + * - < 0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 调用 enableLocalVoiceReverb:{@link #ByteRTCEngine#enableLocalVoiceReverb:} 开启混响效果。 + * @list 音频处理 + */ + + -(int)setLocalVoiceReverbParam:(ByteRTCVoiceReverbConfig* _Nonnull)param; +/** + * + * @type api + * @brief 开启本地音效混响效果 + * @param enable 是否开启 + * @return + * - 0: 成功。 + * - < 0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 调用 setLocalVoiceReverbParam:{@link #ByteRTCEngine#setLocalVoiceReverbParam:} 设置混响效果。 + * @list 音频处理 + */ + +-(int)enableLocalVoiceReverb:(bool)enable; +/** + * + * @valid since 3.58.1 + * @type api + * @brief 设置是否将采集到的音频信号静音,而不改变本端硬件采集状态。 + * @param mute 是否静音音频采集。
    + * - True:静音(关闭麦克风) + * - False:(默认)开启麦克风 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 该方法用于设置是否使用静音数据替换设备采集到的音频数据进行推流,不影响 SDK 音频流的采集发布状态。对于 macOS 平台,如有需要你也可以选择静音整个系统的音频采集,具体参看 setAudioCaptureDeviceMute:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceMute:} 方法说明。 + * - 静音后通过 setCaptureVolume:{@link #ByteRTCEngine#setCaptureVolume:} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 音频管理 + */ + +- (int)muteAudioCapture: (bool)mute; +/** + * + * @valid since 3.60. + * @type api + * @brief 静音/取消静音屏幕共享时采集的音频。
    + * 调用此方法后,SDK 将发送静音数据来代替真实的屏幕音频数据,不影响本端音频设备的采集状态和 SDK 音频流的采集发布状态。 + * @param mute 是否静音屏幕音频。
    + * - True:静音。远端用户听不到来自你屏幕共享的声音。 + * - False:(默认)取消静音。恢复发送屏幕共享的音频。 + * @return + * - 0:调用成功。 + * - < 0:调用失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 该方法用于设置是否使用静音数据替换设备采集到的音频数据进行推流,不影响 SDK 音频流的采集发布状态。对于 macOS 平台,如有需要你也可以选择静音整个系统的音频采集,具体参看 setAudioCaptureDeviceMute:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceMute:} 方法说明。 + * - 静音后通过 setCaptureVolume:{@link #ByteRTCEngine#setCaptureVolume:} 调整音量不会取消静音状态,音量状态会保存至取消静音。 + * - 调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 开启音频采集前后,都可以使用此接口设置采集音量。 + * @list 音频管理 + */ + +- (int)muteScreenAudioCapture: (bool)mute; +/** + * + * @type api + * @brief 调节音频采集音量 + * @param volume 采集的音量值和原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0:静音 + * - 100:原始音量 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 在开启音频采集前后,你都可以使用此接口设定采集音量。 + * @list 音频管理 + */ + +- (int)setCaptureVolume: (int)volume; +/** + * + * @type api + * @brief 调节屏幕共享时采集的音频音量。
    + * 只改变音频数据的音量信息,不影响麦克风采集的音量,也不会改变本端音频设备本身的音量。 + * @param volume 采集的音量值和原始音量的百分比,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0, 100]。
    + * + 0:静音 + * + 100:原始音量 + * + 400:最大可为原始音量的 4 倍(自带溢出保护) + * @return + * + 0: 调用成功。
    + * + <0:调用失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 在开启屏幕音频采集前后,你都可以使用此接口设定采集音量。 + * @list 音频管理 + */ + +- (int)setScreenCaptureVolume:(int)volume; +/** + * + * @type api + * @brief 调节本地播放的所有远端用户音频混音后的音量,混音内容包括远端人声、音乐、音效等。
    + * 播放音频前或播放音频时,你都可以使用此接口设定播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,当该方法与 setRemoteAudioPlaybackVolume:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume:} 或 setRemoteRoomAudioPlaybackVolume:{@link #ByteRTCRoom#setRemoteRoomAudioPlaybackVolume:} 共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + +- (int)setPlaybackVolume:(NSInteger)volume; +/** + * + * @type api + * @brief 启用音频信息提示。启用后,你可以收到 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:},rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:},和 rtcEngine:onActiveSpeaker:uid:{@link #ByteRTCEngineDelegate#rtcEngine:onActiveSpeaker:uid:}。 + * @param config 详见 ByteRTCAudioPropertiesConfig{@link #ByteRTCAudioPropertiesConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + +- (int)enableAudioPropertiesReport:(ByteRTCAudioPropertiesConfig* _Nonnull)config; + +/** + * + * @type api + * @hidden 3.60 for internal use only + * @region 音频管理 + * @brief 启用音频人声识别能力。开启提示后,你会收到 rtcEngine:onAudioVADStateUpdate。 + * @param interval 回调间隔,单位毫秒。
    + * + `<= 0`: 关闭人声识别能力回调。 + * + `[100, 3000]`: 开启人声识别能力回调,并将信息提示间隔设置为此值。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list 音频管理 + */ + +- (int)enableAudioVADReport:(NSInteger)interval; +/** + * + * @hidden 3.60 for internal use only + * @type api + * @region 音频管理 + * @brief 启用AED检测。启用后,你可以收到 rtcEngine:onAudioAEDStateUpdate。 + * @param interval 回调间隔,单位毫秒。
    + * + `<= 0`: 关闭回调。 + * + `[100, 3000]`: 开启回调,并将回调间隔设置为该值。推荐设置为 2000。 + * + 不合法的 interval 值:小于 100 设置为 100,超出 3000 设置为 3000。 + * @return + * + 0:调用成功。 + * + <0:调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list 音频管理 + */ + +- (int)enableAudioAEDReport:(NSInteger)interval; + +/** + * + * @type api + * @brief 调节本端播放收到的远端流时的音量。你必须在进房后进行设置。流的发布状态改变不影响设置生效。 + * @param streamId 远端流 ID。 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内:
    + * - 当该方法与 setRemoteRoomAudioPlaybackVolume:{@link #ByteRTCRoom#setRemoteRoomAudioPlaybackVolume:} 共同使用时,本地收听用户 A 的音量为后调用的方法设置的音量; + * - 当该方法与 setPlaybackVolume:{@link #ByteRTCEngine#setPlaybackVolume:} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * - 当你调用该方法设置远端流音量后,如果远端退房,接口设置失效。 + * @list 音频管理 + */ + +- (int)setRemoteAudioPlaybackVolume:(NSString* _Nonnull)streamId volume:(int)volume; +/** + * + * @type api + * @brief 开启/关闭耳返功能。 + * @param mode 是否开启耳返功能,参看 ByteRTCEarMonitorMode{@link #ByteRTCEarMonitorMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 使用耳返必须佩戴耳机。为保证低延时耳返最佳体验,建议佩戴有线耳机。 + * - 对于 iOS,仅支持软件耳返功能。 + * - 对于 macOS,耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + +- (int)setEarMonitorMode:(ByteRTCEarMonitorMode)mode; +/** + * + * @type api + * @valid since 3.60. + * @brief 开启/关闭耳返功能,并控制是否对耳返音频应用本地音频处理。 + * @param mode 是否开启耳返功能,参看 ByteRTCEarMonitorMode{@link #ByteRTCEarMonitorMode}。默认关闭。 + * @param filter 是否对耳返音频应用本地音频处理,参看 ByteRTCEarMonitorAudioFilter{@link #ByteRTCEarMonitorAudioFilter}。默认不经过音频处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 耳返功能仅适用于由 RTC SDK 内部采集的音频。 + * - 使用耳返功能必须佩戴耳机。为保证低延时耳返最佳体验,建议佩戴有线耳机。 + * - 对于 iOS,仅支持软件耳返功能。 + * - 对于 macOS,耳返功能仅支持设备通过 3.5mm 接口、USB 接口、或蓝牙方式直连耳机时可以使用。对于通过 HDMI 或 USB-C 接口连接显示器转接耳机,或通过连接 OTG 外接声卡再连接的耳机,不支持耳返功能。 + * @list 高级功能 + */ + +- (int)setEarMonitorMode:(ByteRTCEarMonitorMode)mode filter:(int)filter; +/** + * + * @type api + * @brief 设置耳返的音量。 + * @param volume 耳返的音量,取值范围:[0,100],单位:% + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 设置耳返音量前,你必须先调用 setEarMonitorMode:{@link #ByteRTCEngine#setEarMonitorMode:} 打开耳返功能。 + * @list 高级功能 + */ + +- (int)setEarMonitorVolume:(NSInteger)volume; +/** + * + * @hidden(macOS) + * @type api + * @brief 在纯媒体音频场景下,切换 iOS 设备与耳机之间的蓝牙传输协议。 + * @param mode 蓝牙传输协议。详见 ByteRTCBluetoothMode{@link #ByteRTCBluetoothMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 以下场景你会收到 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调:1)当前不支持设置 HFP;2)非纯媒体音频场景,建议在调用此接口前调用 setAudioScenario:{@link #ByteRTCEngine#setAudioScenario:} 设置纯媒体音频场景。 + * @list 音频管理 + */ + +- (int)setBluetoothMode:(ByteRTCBluetoothMode) mode; +/** + * + * @type api + * @brief 开启本地语音变调功能,多用于 K 歌场景。
    + * 使用该方法,你可以对本地语音的音调进行升调或降调等调整。 + * @param pitch 相对于语音原始音调的升高/降低值,取值范围[-12,12],默认值为 0,即不做调整。
    + * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。
    + * 超出取值范围则设置失败,并且会触发 rtcEngine:onWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onWarning:} 回调,提示 ByteRTCWarningCode{@link #ByteRTCWarningCode} 错误码为 `WARNING_CODE_SET_SCREEN_STREAM_INVALID_VOICE_PITCH` 设置语音音调不合法 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 音频处理 + */ + +- (int)setLocalVoicePitch:(NSInteger)pitch; +/** + * + * @type api + * @brief 开启/关闭音量均衡功能。
    + * 开启音量均衡功能后,人声的响度会调整为 -16lufs。如果已调用 setAudioMixingLoudness:loudness: 传入了混音音乐的原始响度,此音乐播放时,响度会调整为 -20lufs。 + * @param enable 是否开启音量均衡功能:
    + * - YES: 是 + * - NO: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该接口须在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 开始播放音频文件之前调用。 + * @list 音频管理 + */ + +- (int)enableVocalInstrumentBalance:(BOOL)enable; +/** + * + * @type api + * @brief 打开/关闭音量闪避功能,适用于在 RTC 通话过程中会同时播放短视频或音乐的场景,如“一起看”等。
    + * 开启该功能后,当检测到远端人声时,RTC 本地的媒体播放音量会自动减弱,从而保证远端人声的清晰可辨;当远端人声消失时,RTC 的本地媒体音量会恢复到闪避前的音量水平。 + * @param enable 是否开启音量闪避:
    + * - YES: 是 + * - NO: 否 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 音频管理 + */ + +- (int)enablePlaybackDucking:(BOOL)enable; +#pragma mark Core Video Methods + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @deprecated since 3.57, use setLocalVideoSink:withLocalRenderConfig:{@link #ByteRTCEngine#setLocalVideoSink:withLocalRenderConfig:} instead. + * @region 自定义视频采集渲染 + * @brief 将本地视频流与自定义渲染器绑定。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} + * @param requiredFormat videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 如果需要解除绑定,必须将 videoSink 设置为 null。退房时将清除绑定状态。 + * - 一般在收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * - 本方法获取的是前处理后的视频帧。 + */ + +- (int)setLocalVideoSink:(id _Nullable)videoSink + withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat NS_SWIFT_NAME(setLocalVideoSink(withSink:withPixelFormat:)) + __deprecated_msg("Will be removed in new version"); + +/** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 将本地视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate}。 + * @param config 本地视频帧回调配置,参看 ByteRTCLocalVideoSinkConfig{@link #ByteRTCLocalVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 videoSink 设置为 null。 + * - 一般在收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调通知完成本地视频首帧采集后,调用此方法为视频流绑定自定义渲染器;然后加入房间。 + * @list 自定义流处理 + */ + +- (int)setLocalVideoSink:(id _Nullable)videoSink + withLocalRenderConfig:(ByteRTCLocalVideoSinkConfig*)config NS_SWIFT_NAME(setLocalVideoSink(withSink:withLocalRenderConfig:)); +/** + * + * @type api + * @hiddensdk(audiosdk) + * @deprecated since 3.57, use setRemoteVideoSink:withSink:withRemoteRenderConfig:{@link #ByteRTCEngine#setRemoteVideoSink:withSink:withRemoteRenderConfig:} instead. + * @region 自定义视频采集渲染 + * @brief 将远端视频流与自定义渲染器绑定。 + * @param streamId 远端流 ID。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} + * @param requiredFormat videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - RTC SDK 默认使用 RTC SDK 自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调获取到远端流信息之后,再调用该方法。 + * - 如果需要解除绑定,必须将 videoSink 设置为 null。退房时将清除绑定状态。 + * - 本方法获取的是后处理后的视频帧。 + */ + +- (int)setRemoteVideoSink:(NSString* _Nonnull)streamId + withSink:(id _Nullable)videoSink + withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat NS_SWIFT_NAME(setRemoteVideoSink(_:withSink:withPixelFormat:)) + __deprecated_msg("Will be removed in new version"); + +/** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 将远端视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。 + * @param streamId 远端流 ID。 + * @param videoSink 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate}。 + * @param config 远端视频帧回调配置,参看 ByteRTCRemoteVideoSinkConfig{@link #ByteRTCRemoteVideoSinkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - RTC SDK 默认使用自带的渲染器(内部渲染器)进行视频渲染。 + * - 该方法进房前后均可以调用。若想在进房前调用,你需要在加入房间前获取远端流信息;若无法预先获取远端流信息,你可以在加入房间并通过 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调获取到远端流信息之后,再调用该方法。 + * - 退房时将清除绑定状态。 + * - 如果需要解除绑定,你必须将 videoSink 设置为 null。 + * @list 自定义流处理 + */ + +- (int)setRemoteVideoSink:(NSString* _Nonnull)streamId + withSink:(id _Nullable)videoSink + withRemoteRenderConfig:(ByteRTCRemoteVideoSinkConfig*)config NS_SWIFT_NAME(setRemoteVideoSink(_:withSink:withRemoteRenderConfig:)); + +/** + * + * @hidden(macOS) for internal use + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置远端视频超分模式。 + * @param streamId 远端流 ID。 + * @param mode 超分模式,参看 ByteRTCVideoSuperResolutionMode{@link #ByteRTCVideoSuperResolutionMode}。 + * @return + * - 0: ByteRTCReturnStatusSuccess,SDK 调用成功,并不代表超分模式实际状态,需要根据回调 rtcEngine:onRemoteVideoSuperResolutionModeChanged:info:withMode:withReason:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteVideoSuperResolutionModeChanged:info:withMode:withReason:} 判断实际状态。 + * - -1: ByteRTCReturnStatusNativeInValid,native library 未加载。 + * - -2: ByteRTCReturnStatusParameterErr,参数非法,指针为空或字符串为空。 + * - -9: ByteRTCReturnStatusScreenNotSupport,不支持对屏幕流开启超分。 + * 其他错误码参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 如需使用该功能,需集成超分插件 ByteRTCVideoSRExtension.xcframework 及依赖库 bmf_mods_shared.xcframework,详情参看[按需集成插件](https: + * - 该方法须进房后调用。 + * - 远端用户视频流的原始分辨率不能超过 640 × 360 px。 + * - 支持对一路远端流开启超分,不支持对多路流开启超分。 + * @list 视频处理 + */ + +- (int)setRemoteVideoSuperResolution:(NSString* _Nonnull)streamId + withMode:(ByteRTCVideoSuperResolutionMode)mode; +/** + * + * @hidden not available on iOS + * @valid since 3.54 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置视频降噪模式。 + * @param mode 视频降噪模式。参看 ByteRTCVideoDenoiseMode{@link #ByteRTCVideoDenoiseMode}。 + * @return + * - 0: API 调用成功。(不适用于 iOS)用户可以根据回调函数 rtcEngine:onVideoDenoiseModeChanged:withReason:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDenoiseModeChanged:withReason:} 判断视频降噪是否开启。 + * - < 0: API 调用失败。 + * @note 如需使用该功能,需集成降噪插件 ByteRTCVideoDenoiseExtension.xcframework 及依赖库 bmf_mods_shared.xcframework,详情参看[按需集成插件](https: + * @list 视频处理 + */ + +- (int)setVideoDenoiser:(ByteRTCVideoDenoiseMode)mode; +/** + * + * @hidden(iOS) + * @valid since 3.57 + * @type api + * @brief 设置视频暗光增强模式。
    + * 对于光线不足、照明不均匀或背光等场景下推荐开启,可有效改善画面质量。 + * @param mode 默认不开启。参看 ByteRTCVideoEnhancementMode{@link #ByteRTCVideoEnhancementMode}。 + * @return + * - 0: API 调用成功。会立即生效,但需要等待下载和检测完成后才能看到增强后的效果。 + * - < 0: API 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 开启后会影响设备性能,应根据实际需求和设备性能决定是否开启。 + * - 对 RTC SDK 内部采集的视频和自定义采集的视频都生效。 + * @list 视频处理 + */ + +- (int)setLowLightAdjusted:(ByteRTCVideoEnhancementMode)mode; + + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本端采集的视频帧的旋转角度。
    + * 当摄像头倒置或者倾斜安装时,可调用本接口进行调整。对于手机等普通设备,可调用 setVideoRotationMode:{@link #ByteRTCEngine#setVideoRotationMode:} 实现旋转。 + * @param rotation 相机朝向角度,默认为 `ByteRTCVideoRotation0`,无旋转角度。详见 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 对于内部采集的视频画面,如果已调用 setVideoRotationMode:{@link #ByteRTCEngine#setVideoRotationMode:} 设置了旋转方向,会在此基础上叠加旋转角度。 + * - 调用本接口也将对自定义采集视频画面生效,在原有的旋转角度基础上叠加本次设置。 + * - 视频贴纸特效或通过 enableVirtualBackground{@link #ByteRTCVideoEffect#enableVirtualBackground:withSource:} 增加的虚拟背景,也会跟随本接口的设置进行旋转。 + * - 本地渲染视频和发送到远端的视频都会相应旋转,但不会应用到单流转推中。如果希望在单流转推的视频中应用旋转,调用 setVideoOrientation:{@link #ByteRTCEngine#setVideoOrientation:}。 + * @list 视频管理 + */ + +- (int)setVideoCaptureRotation:(ByteRTCVideoRotation)rotation; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端设置期望发布的最大分辨率视频流参数,包括分辨率、帧率、码率、网络不佳时的回退策略等(包含摄像头和屏幕的编码配置)。
    + * @param encoderConfig 期望发布的最大分辨率视频流参数。参看 ByteRTCVideoEncoderConfig{@link #ByteRTCVideoEncoderConfig}。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 自 V3.61 版本,本接口仅设置一路视频流参数。默认状态下只有单流,如需开启多路小流请使用:setLocalSimulcastMode:config:{@link #ByteRTCEngine#setLocalSimulcastMode:config:}。 + * - 调用该方法前,SDK 默认仅发布一路视频流,分辨率为 640px × 360px @15fps,编码偏好为帧率优先。 + * - 使用自定义采集时,必须调用该方法设置编码参数,以保证远端收到画面的完整性。 + * - 该方法设置的参数会同时作用于摄像头采集的视频流和屏幕共享流。在 iOS 端进行屏幕共享时,如果你调用了该方法设置屏幕共享视频流的编码参数,则需要重新启动屏幕采集,否则设置不生效。 + * @list 视频管理 + */ + +- (int)setVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig; + +/** + * + * @hidden currently not available + * @brief iOS 和 Mac 不支持 Fov,对齐其他端预留接口。 + */ + +- (int)setVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig withParameters:(NSDictionary * _Nullable) parameters; + + /** + * + * @valid since 3.60. + * @type api + * @hiddensdk(audiosdk) + * @brief 发布端开启大小流(simulcast)功能。 + * @param mode 详见 ByteRTCVideoSimulcastMode{@link #ByteRTCVideoSimulcastMode}。默认为只发送单流。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 你应在进房前调用本接口。 + * - 调用该方法前,SDK 默认仅发布一条分辨率为 640px × 360px,帧率为 15fps 的视频流。 + * - 如需自定义小流参数请查看它的重载方法 (int)setVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig withParameters:(NSDictionary * _Nullable) parameters。 + * - 该方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + +- (int)setLocalSimulcastMode:(ByteRTCVideoSimulcastMode)mode ; + +/** + * + * @valid since 3.60. + * @type api + * @brief 发布端进行大小流(simulcast)设置。 + * @param mode 详见 ByteRTCVideoSimulcastMode{@link #ByteRTCVideoSimulcastMode}。默认为只发送单流。你应在进房前调用修改本参数。 + * @param streamConfig 小流参数。最多可设置 3 路。分辨率按照从小到大顺序,且每路流参数分辨率需小于大流 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 设置参数。否则可能会设置失败。参看 ByteRTCVideoEncoderConfig{@link #ByteRTCVideoEncoderConfig}。 + * 其余模式下,默认小流参数为 160px × 90px, 码率为 50kbps。 + * @return 方法调用结果:
    + * - 0:成功 + * - !0:失败 + * @note + * - 调用本方法前,SDK 默认仅发布一条分辨率为 640px × 360px @15fps 的视频流。 + * - 本方法适用于摄像头采集的视频流。 + * - 更多信息详见[推送多路流](https: + * @list 网络管理 + */ + +- (int)setLocalSimulcastMode:(ByteRTCVideoSimulcastMode)mode config:(NSArray * _Nullable)streamConfig; + +/** + * + * @hidden(macOS) + * @valid since 3.58 + * @type api + * @brief 开启自定义采集视频帧的 Alpha 通道编码功能。
    + * 适用于需要分离推流端视频主体与背景,且在拉流端可自定义渲染背景的场景。 + * @param alphaLayout 分离后的 Alpha 通道相对于 RGB 通道信息的排列位置。当前仅支持 ByteRTCAlphaLayout.ByteRTCAlphaLayoutTop,即置于 RGB 通道信息上方。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该接口仅作用于自定义采集的 ByteRTCVideoPixelFormat.ByteRTCVideoPixelFormatCVPixelBuffer 格式视频帧。 + * - 该接口须在发布视频流之前调用。 + * - 调用本接口开启 Alpha 通道编码后,你需调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 把自定义采集的视频帧推送至 RTC SDK。若推送了不支持的视频帧格式,则调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 时会返回错误码 ByteRTCReturnStatus.ByteRTCReturnStatusParameterErr。 + * @list 视频管理 + */ + +-(int)enableAlphaChannelVideoEncode:(ByteRTCAlphaLayout)alphaLayout; +/** + * + * @hidden(macOS) + * @valid since 3.58 + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭外部采集视频帧的 Alpha 通道编码功能。 + * @return 方法调用结果:
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 该接口须在停止发布视频流之后调用。 + * @list 视频管理 + */ + +-(int)disableAlphaChannelVideoEncode; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
    + * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数包括模式、分辨率、帧率。 + * @param captureConfig 视频采集参数。参看: ByteRTCVideoCaptureConfig{@link #ByteRTCVideoCaptureConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 前调用本接口。 + * - 建议同一设备上的不同引擎使用相同的视频采集参数。 + * - 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + * @list 视频管理 + */ + +- (int)setVideoCaptureConfig:(ByteRTCVideoCaptureConfig * _Nullable)captureConfig; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地视频渲染时使用的视图,并设置渲染模式。 + * @param canvas 视图信息和渲染模式,参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas} + * @return + * - 0:成功。 + * - -2: 参数错误。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 你应在加入房间前,绑定本地视图。退出房间后,此设置仍然有效。 + * - 如果需要解除绑定,你可以调用本方法传入空视图。 + * @list 视频管理 + */ + +- (int)setLocalVideoCanvas:(ByteRTCVideoCanvas * _Nullable)canvas NS_SWIFT_NAME(setLocalVideoCanvas(withCanvas:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 修改本地视频渲染模式和背景色。 + * @param renderMode 渲染模式。参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + * @param backgroundColor 背景颜色。参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas}.backgroundColor + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 你可以在本地视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + +- (int)updateLocalVideoCanvas:(ByteRTCRenderMode)renderMode + withBackgroundColor:(NSUInteger)backgroundColor NS_SWIFT_NAME(updateLocalVideoCanvas(withBackgroundColor:)); +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 渲染来自指定远端用户 uid 的视频流时,设置使用的视图和渲染模式。
    + * 如果需要解除视频的绑定视图,把 `canvas.view` 设置为空。(`canvas` 中其他参数不能为空。) + * @param streamId 远端流 ID。 + * @param canvas 视图信息和渲染模式,参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas}。3.56 版本起支持通过 `renderRotation` 设置远端视频渲染的旋转角度。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 本地用户离开房间时,会解除调用此 API 建立的绑定关系;远端用户离开房间则不会影响。 + * @list 视频管理 + */ + +- (int)setRemoteVideoCanvas:(NSString* _Nonnull)streamId + withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas NS_SWIFT_NAME(setRemoteVideoCanvas(_:withCanvas:)); + +/** + * + * @deprecated since 3.56, and will be deleted in 3.62. Use updateRemoteStreamVideoCanvas:withRemoteVideoRenderConfig:{@link #ByteRTCEngine#updateRemoteStreamVideoCanvas:withRemoteVideoRenderConfig:} instead. + * @type api + * @hiddensdk(audiosdk) + * @brief 修改远端视频帧的渲染设置,包括渲染模式和背景颜色。 + * @param streamId 远端流 ID。 + * @param renderMode 渲染模式,参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + * @param backgroundColor 背景颜色,参看 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas}.backgroundColor + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 你可以在远端视频渲染过程中,调用此接口。调用结果会实时生效。 + * @list 视频管理 + */ + +- (int)updateRemoteStreamVideoCanvas:(NSString* _Nonnull)streamId + withRenderMode:(ByteRTCRenderMode)renderMode + withBackgroundColor:(NSUInteger)backgroundColor NS_SWIFT_NAME(updateRemoteStreamVideoCanvas(_:withRenderMode:withBackgroundColor:)); + +/** + * + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用 SDK 内部渲染时,修改远端视频帧的渲染设置,包括渲染模式、背景颜色和旋转角度。 + * @param streamId 远端流 ID。 + * @param remoteVideoRenderConfig 视频帧渲染设置。具体参看 ByteRTCRemoteVideoRenderConfig{@link #ByteRTCRemoteVideoRenderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 setRemoteVideoCanvas:withCanvas:{@link #ByteRTCEngine#setRemoteVideoCanvas:withCanvas:} 设置了远端视频渲染模式后,你可以调用此接口更新渲染模式、背景颜色、旋转角度的设置。 + * - 该接口可以在远端视频渲染过程中调用,调用结果会实时生效。 + * @list 视频管理 + */ + +- (int)updateRemoteStreamVideoCanvas:(NSString* _Nonnull)streamId + withRemoteVideoRenderConfig:(ByteRTCRemoteVideoRenderConfig * _Nonnull)remoteVideoRenderConfig + NS_SWIFT_NAME(updateRemoteStreamVideoCanvas(_:withRemoteVideoRenderConfig:)); + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即开启内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStartVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartVideoCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。 + * - 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。 + * - 如果需要从自定义视频采集切换为内部视频采集,你必须先停止发布流,关闭自定义采集,再调用此方法手动开启内部采集。 + * - 内部视频采集使用的摄像头由 switchCamera:{@link #ByteRTCEngine#switchCamera:} 接口指定。(macOS 不支持) + * - 自 v3.37.0 升级版本,你需要在应用中向用户申请摄像头权限后才能开始采集。 + * @list 视频管理 + */ + +- (int)startVideoCapture NS_SWIFT_NAME(startVideoCapture()); + /** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 立即关闭内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStopVideoCapture:info:} 的回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 可以开启内部视频采集。 + * - 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + * @list 视频管理 + */ + +- (int)stopVideoCapture NS_SWIFT_NAME(stopVideoCapture()); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 为采集到的视频流开启镜像 + * @param mirrorType 镜像类型,参看 ByteRTCMirrorType{@link #ByteRTCMirrorType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 切换视频源不影响镜像设置。 + * - 屏幕视频流始终不受镜像设置影响。 + * - 使用外部渲染器时,`mirrorType` 支持设置为 `0`(无镜像)和 `3`(本地预览和编码传输镜像),不支持设置为 `1`(本地预览镜像)。 + * - 该接口调用前,各视频源的初始状态如下: + * + * + * + * + *
    前置摄像头后置摄像头自定义采集视频源 桌面端摄像头
    移动端本地预览镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 本地预览不镜像,编码传输不镜像 /
    桌面端// 本地预览不镜像,编码传输不镜像 本地预览镜像,编码传输不镜像
    + * @list 视频处理 + */ + +- (int)setLocalVideoMirrorType:(ByteRTCMirrorType) mirrorType; + +/** + * + * @valid since 3.57 + * @type api + * @hiddensdk(audiosdk) + * @brief 使用内部渲染时,为远端流开启镜像。 + * @param streamId 远端流 ID。 + * @param mirrorType 远端流的镜像类型,参看 ByteRTCRemoteMirrorType{@link #ByteRTCRemoteMirrorType}。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list 视频处理 + */ + +- (int)setRemoteVideoMirrorType:(NSString* _Nonnull)streamId withMirrorType:(ByteRTCRemoteMirrorType)mirrorType; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置采集视频的旋转模式。默认以 App 方向为旋转参考系。
    + * 接收端渲染视频时,将按照和发送端相同的方式进行旋转。 + * @param rotationMode 视频旋转参考系为 App 方向或重力方向,参看 ByteRTCVideoRotationMode{@link #ByteRTCVideoRotationMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 旋转仅对内部视频采集生效,不适用于外部视频源和屏幕源。 + * - 调用该接口时已开启视频采集,将立即生效;调用该接口时未开启视频采集,则将在采集开启后生效。 + * - 更多信息请参考[视频采集方向](https: + * @list 视频管理 + */ + +- (int)setVideoRotationMode:(ByteRTCVideoRotationMode) rotationMode; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 在自定义视频前处理及编码前,设置 RTC 链路中的视频帧朝向,默认为 Adaptive 模式。
    + * 移动端开启视频特效贴纸,或使用自定义视频前处理时,建议固定视频帧朝向为 Portrait 模式。单流转推场景下,建议根据业务需要固定视频帧朝向为 Portrait 或 Landscape 模式。不同模式的具体显示效果参看[视频帧朝向](https: + * @param orientation 视频帧朝向,参看 ByteRTCVideoOrientation{@link #ByteRTCVideoOrientation}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 视频帧朝向设置仅适用于内部采集视频源。对于自定义采集视频源,设置视频帧朝向可能会导致错误,例如宽高对调。屏幕源不支持设置视频帧朝向。 + * - 编码分辨率的更新与视频帧处理是异步操作,进房后切换视频帧朝向可能导致画面出现短暂的裁切异常,因此建议在进房前设置视频帧朝向,且不在进房后进行切换。 + * @list 视频处理 + */ + +- (int)setVideoOrientation:(ByteRTCVideoOrientation) orientation; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 切换视频内部采集时使用的前置/后置摄像头
    + * 调用此接口后,在本地会触发 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 回调。 + * @param cameraId 摄像头类型,参看 ByteRTCCameraID{@link #ByteRTCCameraID}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 默认使用前置摄像头。 + * - 如果你正在使用相机进行视频采集,切换操作当即生效;如果相机未启动,后续开启内部采集时,会打开设定的摄像头。 + * @list 视频管理 + */ + +- (int)switchCamera:(ByteRTCCameraID) cameraId; +/** + * + * @type api + * @brief 获取视频特效接口。 + * @return 视频特效接口,参看 ByteRTCVideoEffect{@link #ByteRTCVideoEffect}。 + * @list 视频处理 + */ + +- (ByteRTCVideoEffect* _Null_unspecified)getVideoEffectInterface NS_SWIFT_NAME(getVideoEffectInterface()); +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 开启/关闭基础美颜。 + * @param enable 基础美颜开关
    + * - YES: 开启基础美颜 + * - NO: 关闭基础美颜(默认) + * @return + * - 0: 调用成功。 + * - –1001: RTC SDK 版本不支持此功能。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 本方法不能与高级视频特效接口共用。如已购买高级视频特效,建议参看[集成指南](https: + * - 使用此功能需要集成特效 SDK,建议使用特效 SDK v4.4.2+ 版本。更多信息参看 [Native 端基础美颜](https: + * - 调用 setBeautyIntensity:withIntensity:{@link #ByteRTCEngine#setBeautyIntensity:withIntensity:} 设置基础美颜强度。若在调用本方法前没有设置美颜强度,则使用默认强度。各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * - 本方法仅适用于视频源,不适用于屏幕源。 + * @list 视频处理 + */ + +- (int) enableEffectBeauty:(BOOL)enable; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 调整基础美颜强度。 + * @param beautyMode 基础美颜模式,参看 ByteRTCEffectBeautyMode{@link #ByteRTCEffectBeautyMode}。 + * @param intensity 美颜强度,取值范围为 [0,1]。强度为 0 表示关闭。
    + * 各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 + * @return + * - 0: 调用成功。 + * - –2: `intensity` 范围超限。 + * - –1001: RTC SDK 版本不支持此功能。 + * - <0: 调用失败,特效 SDK 内部错误,具体错误码请参考[错误码表](https: + * @note + * - 若在调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect} 前设置美颜强度,则对应美颜功能的强度初始值会根据设置更新。 + * - 销毁引擎后,美颜功能强度恢复默认值。 + * @list 视频处理 + */ + +- (int) setBeautyIntensity:(ByteRTCEffectBeautyMode) beautyMode + withIntensity:(float)intensity; + +#pragma mark - ICameraControl +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头(前置/后置)的变焦倍数 + * @param zoomRatio 变焦倍数。取值范围是 [1, <最大变焦倍数>]。
    + * 最大变焦倍数可以通过调用 getCameraZoomMaxRatio{@link #ByteRTCEngine#getCameraZoomMaxRatio} 获取。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置摄像头变焦倍数。 + * - 设置结果在调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后失效。 + * - 你可以调用 setVideoDigitalZoomConfig:size:{@link #ByteRTCEngine#setVideoDigitalZoomConfig:size:} 设置数码变焦参数,调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 进行数码变焦。 + * @list 视频管理 + */ + +- (int) setCameraZoomRatio: (float) zoomRatio; +/** + * + * @hidden(macOS) + * @type api + * @brief 获取当前使用的摄像头(前置/后置)的最大变焦倍数 + * @return 最大变焦倍数 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头最大变焦倍数。 + * @list 视频管理 + */ + +- (float) getCameraZoomMaxRatio; +/** + * + * @hidden(macOS) + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持变焦(数码/光学变焦)。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测摄像头变焦能力。 + * @list 视频管理 + */ + +- (bool) isCameraZoomSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 检测当前使用的摄像头(前置/后置),是否支持闪光灯。 + * @return + * - true: 支持 + * - false: 不支持 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检测闪光能力。 + * @list 视频管理 + */ + +- (bool) isCameraTorchSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 打开/关闭当前使用的摄像头(前置/后置)的闪光灯 + * @param torchState 打开/关闭。参看 ByteRTCTorchState{@link #ByteRTCTorchState}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置闪光灯。 + * - 设置结果在调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后失效。 + * @list 视频管理 + */ + +- (int) setCameraTorch: (ByteRTCTorchState)torchState; +/** + * + * @hidden(macOS) + * @type api + * @brief 检查当前使用的摄像头是否支持手动对焦。 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集,才能检查摄像头是否支持手动对焦。 + * @list 视频管理 + */ + +- (bool)isCameraFocusPositionSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头的对焦点。 + * @param position 对焦点坐标。以本地预览画布的左上为坐标原点,`position`的`x`字段为对焦点水平方向归一化坐标,`y`字段为对焦点垂直方向归一化坐标,取值范围为 [0, 1]。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置对焦点。 + * - 对焦点设置为画布中央(即`x`和`y`均取 0.5)时,恢复系统默认值。 + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后,设置的对焦点失效。 + * @list 视频管理 + */ + +- (int)setCameraFocusPosition:(CGPoint)position; +/** + * + * @hidden(macOS) + * @type api + * @brief 检查当前使用的摄像头是否支持手动设置曝光点。 + * @return + * - true: 支持。 + * - false: 不支持。 + * @note 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能检查曝光点设置能力。 + * @list 视频管理 + */ + +- (bool)isCameraExposurePositionSupported; +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头的曝光点。 + * @param position 曝光点坐标。以本地预览画布的左上为坐标原点,`position`的`x`字段为曝光点水平方向归一化坐标,`y`字段为曝光点垂直方向归一化坐标,取值范围为 [0, 1]。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集,并且使用 SDK 内部渲染时,才能设置曝光点。 + * - 曝光点设置为画布中央(即`x`和`y`均取 0.5)时,恢复系统默认值。 + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后,设置的曝光点失效。 + * @list 视频管理 + */ + +- (int)setCameraExposurePosition:(CGPoint)position; +/** + * + * @hidden(macOS) + * @type api + * @brief 设置当前使用的摄像头的曝光补偿。 + * @param val 曝光补偿值,取值范围 [-1, 1],0 为系统默认值(没有曝光补偿)。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 必须已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置曝光补偿。 + * - 调用 stopVideoCapture{@link #ByteRTCEngine#stopVideoCapture} 关闭内部采集后,设置的曝光补偿失效。 + * @list 视频管理 + */ + +- (int)setCameraExposureCompensation:(float)val; +/** + * + * @hidden(macOS) + * @valid since 353 + * @type api + * @brief 启用或禁用内部采集时人脸自动曝光模式。此模式会改善强逆光下,脸部过暗的问题;但也会导致 ROI 以外区域过亮/过暗的问题。 + * @param enable 是否启用。iOS默认开启,Android默认关闭。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note 在采集前或采集中调用此接口均可生效。 + * @list 视频管理 + */ + +- (int)enableCameraAutoExposureFaceMode:(bool)enable; +/** + * + * @hidden(macOS) + * @valid since 353 + * @type api + * @brief 设置内部采集适用动态帧率时,帧率的最小值。 + * @param framerate 最小值。单位为 fps。默认值是 7。
    + * 动态帧率的最大帧率是通过 setVideoCaptureConfig:{@link #ByteRTCEngine#setVideoCaptureConfig:} 设置的帧率值。当传入参数大于最大帧率时,使用固定帧率模式,帧率为最大帧率;当传入参数小于最大帧率时,使用动态帧率。 + * @return + * - 0: 成功. + * - !0: 失败. + * @note + * - 你必须在调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部采集前,调用此接口方可生效。 + * - 如果由于性能降级、静态适配等原因导致采集最大帧率变化时,已设置的最小帧率值会与新的采集最大帧率值重新比较。比较结果变化可能导致固定/动态帧率模式切换。 + * - 对 Android,默认开启动态帧率模式 + * - 对 iOS,默认使用固定帧率模式 + * @list 视频管理 + */ + +- (int)setCameraAdaptiveMinimumFrameRate:(int)framerate; + +#pragma mark - MediaMetadataData InnerVideoSource +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 通过视频帧发送 SEI 数据。
    + * 在视频通话场景下,SEI 数据会随视频帧发送;在语音通话场景下,SDK 会自动生成一路 16px × 16px 的黑帧视频流用来发送 SEI 数据。 + * @param message SEI 消息,建议每帧 SEI 数据总长度不超过 4 KB。 + * @param repeatCount 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
    + * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeatCount+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 ByteRTCSEICountPerFrame{@link #ByteRTCSEICountPerFrame}。 + * @return + * - >= 0: 将被添加到视频帧中的 SEI 的数量。 + * - < 0: 发送失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率。在语音通话场景下,黑帧帧率为 15 fps。 + * - 从程序的启动到结束,建议用同一种发送模式。 + * - 语音通话场景中,仅支持在内部采集模式下调用该接口发送 SEI 数据。 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据;语音通话场景下,若调用此接口后 1min 内未有 SEI 数据发送,则 SDK 会自动取消发布视频黑帧。 + * - 消息发送成功后,远端会收到 rtcEngine:onSEIMessageReceived:info:andMessage:{@link #ByteRTCEngineDelegate#rtcEngine:onSEIMessageReceived:info:andMessage:} 回调。 + * - 语音通话切换至视频通话时,会停止使用黑帧发送 SEI 数据,自动转为用采集到的正常视频帧发送 SEI 数据。 + * @list 消息 + */ + +- (int)sendSEIMessage: (NSData* _Nonnull)message andRepeatCount:(int)repeatCount andCountPerFrame:(ByteRTCSEICountPerFrame) mode; +/** + * + * @type api + * @list 消息 + * @brief 以 Key-Value 格式通过视频帧发送 SEI 数据。 + * 调用此接口前,必须在调用 setLiveMode:{@link #ByteRTCRoom#setLiveMode:} 时将房间模式设置为 `kRoomLiveModeSoloHost` 开启单人直播模式。 + * @param jsonString JSON 格式的键值对,例如 `{"key1":"value1","key2":"value2"}`: + * - 如果某个 Key 对应的 Value 为空(例如 `""` 或 `null`),则会从 SEI 字典中删除该 Key; + * - 所有 Key-Value 合并后的总 SEI 数据大小不能超过 10KB。 + * @param count 连续发送该 SEI 数据的次数。 + * - 当 `isKeyFrameOnly` 为 YES 时,代表伴随 `count` 个关键帧(I 帧)发送; + * - 当 `isKeyFrameOnly` 为 NO 时,代表伴随 `count` 个视频帧发送。 + * @param isKeyFrameOnly 是否只随关键帧(I 帧)发送: + * - YES:只在关键帧发送; + * - NO:所有帧都会发送。 + * @param allowOverwrite 设置该 Key 写入后,后续请求是否允许覆盖它: + * - true:后续请求可覆盖该 Key 的 Value,且 `count` 也会更新为新值; + * - false:后续请求会忽略该 Key 的新值,保持原样。对于已存在的 Key,是否允许本次覆盖取决于该 Key 已保存的覆盖策略。 + * @return + * - 0: 调用成功。 + * - < 0: 发送失败。 + * - -1: 视频模块未启用。 + * - -2: 参数错误(JSON 为空或 count <= 0)。 + * - -3: JSON 格式错误。 + * - -4: SEI 数据总大小超过限制。 + */ + +- (int)sendLivePushSEIMessage:(NSString *_Nonnull)jsonString + count:(NSInteger)count + isKeyFrameOnly:(BOOL)isKeyFrameOnly + allowOverwrite:(BOOL)allowOverwrite; +/** + * + * @hidden for internal use only + * @valid since 3.56 + * @type api + * @hiddensdk(audiosdk) + * @brief WTN 流视频帧发送 SEI 数据。 + * @param channelId SEI 的消息传输通道,取值范围 [0 - 255]。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message SEI 消息。 + * @param repeatCount 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。
    + * 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 `repeat_count+1` 个视频帧中。 + * @param mode SEI 发送模式,参看 ByteRTCSEICountPerFrame{@link #ByteRTCSEICountPerFrame}。 + * @return + * - < 0:说明调用失败 + * - = 0:说明当前发送队列已满,无法发送 + * - > 0: 说明调用成功,该数值为已经发送 SEI 的数量 + * @note + * - 每秒发送的 SEI 消息数量建议不超过当前的视频帧率 + * - 视频通话场景中,使用自定义采集并通过 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 推送至 SDK 的视频帧,若本身未携带 SEI 数据,也可通过本接口发送 SEI 数据;若原视频帧中已添加了 SEI 数据,则调用此方法不生效。 + * - 视频帧仅携带前后 2s 内收到的 SEI 数据 + * - 消息发送成功后,远端会收到 rtcEngine:onPublicStreamSEIMessageReceivedWithChannel:andChannelId:andMessage:回调。 + * - 调用失败时,本地及远端都不会收到回调。 + * @list 消息 + */ + +- (int)sendPublicStreamSEIMessage: (int)channelId andMessage:(NSData* _Nonnull)message andRepeatCount:(int)repeatCount andCountPerFrame:(ByteRTCSEICountPerFrame)mode; +#pragma mark - VideoFrameObserver InnerVideoSource +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 设置本地摄像头数码变焦参数,包括缩放倍数,移动步长。 + * @param type 数码变焦参数类型,缩放系数或移动步长。参看 ByteRTCZoomConfigType{@link #ByteRTCZoomConfigType}。必填。 + * @param size 缩放系数或移动步长,保留到小数点后三位。默认值为 0。必填。
    + * 选择不同 `type` 时有不同的取值范围。当计算后的结果超过缩放和移动边界时,取临界值。
    + * - `ByteRTCZoomConfigTypeFocusOffset`:缩放系数增量,范围为 [0, 7]。例如,设置为 0.5 时,如果调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 选择 Zoom in,则缩放系数增加 0.5。缩放系数范围 [1,8],默认为 `1`,原始大小。 + * - `ByteRTCZoomConfigTypeMoveOffset`:移动百分比,范围为 [0, 0.5],默认为 0,不移动。如果调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 选择的是左右移动,则移动距离为 size x 原始视频宽度;如果选择的是上下移动,则移动距离为 size x 原始视频高度。例如,视频帧边长为 1080 px,设置为 0.5 时,实际移动距离为 0.5 x 1080 px = 540 px。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 每次调用本接口只能设置一种参数。如果缩放系数和移动步长都需要设置,分别调用本接口传入相应参数。 + * - 由于移动步长的默认值为 `0` ,在调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 或 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:} 进行数码变焦操作前,应先调用本接口。 + * @list 视频处理 + */ + +- (int)setVideoDigitalZoomConfig:(ByteRTCZoomConfigType)type size:(float)size; +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 控制本地摄像头数码变焦,缩放或移动一次。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ByteRTCZoomDirectionType{@link #ByteRTCZoomDirectionType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig:size:{@link #ByteRTCEngine#setVideoDigitalZoomConfig:size:} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 如果你希望实现持续数码变焦操作,调用 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:}。 + * - 移动端可对摄像头进行光学变焦控制,参看 `setCameraZoomRatio:`. + * @list 视频处理 + */ + +- (int)setVideoDigitalZoomControl:(ByteRTCZoomDirectionType) direction; +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 开启本地摄像头持续数码变焦,缩放或移动。设置对本地预览画面和发布到远端的视频都生效。 + * @param direction 数码变焦操作类型,参看 ByteRTCZoomDirectionType{@link #ByteRTCZoomDirectionType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 由于默认步长为 `0`,调用该方法前需通过 setVideoDigitalZoomConfig:size:{@link #ByteRTCEngine#setVideoDigitalZoomConfig:size:} 设置参数。 + * - 调用该方法进行移动前,应先使用本方法或 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:} 进行放大,否则无法移动。 + * - 当数码变焦操作超出范围时,将置为临界值并停止操作。例如,移动到了图片边界、放大到了 8 倍、缩小到原图大小。 + * - 你也可以调用 stopVideoDigitalZoomControl{@link #ByteRTCEngine#stopVideoDigitalZoomControl} 手动停止控制。 + * - 如果你希望实现单次数码变焦操作,调用 setVideoDigitalZoomControl:{@link #ByteRTCEngine#setVideoDigitalZoomControl:}。 + * - 如果你希望实现单次数码变焦操作,调用 `setVideoDigitalZoomControl:`。 + * @list 视频处理 + */ + +- (int)startVideoDigitalZoomControl:(ByteRTCZoomDirectionType)direction; +/** + * + * @valid since 3.51 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地摄像头持续数码变焦。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 关于开始数码变焦,参看 startVideoDigitalZoomControl:{@link #ByteRTCEngine#startVideoDigitalZoomControl:}。 + * @list 视频处理 + */ + +- (int)stopVideoDigitalZoomControl; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置自定义视频前处理器。
    + * 使用这个视频前处理器,你能够调用 processVideoFrame:{@link #ByteRTCVideoProcessorDelegate#processVideoFrame:} 对 RTC SDK 采集得到的视频帧进行前处理,并将处理后的视频帧用于 RTC 音视频通信。 + * @param processor 自定义视频处理器,详见 ByteRTCVideoProcessorDelegate{@link #ByteRTCVideoProcessorDelegate}。如果传入 null,则不对 RTC SDK 采集得到的视频帧进行前处理。
    + * SDK 只持有 processor 的弱引用,你应保证其生命周期。
    + * 在设计 `processor` 时,应从 ByteRTCVideoFrame{@link #ByteRTCVideoFrame} 的 `textureBuf` 字段获取视频帧数据;
    + * 处理后返回的视频帧数据格式应为 ByteRTCVideoPixelFormat{@link #ByteRTCVideoPixelFormat} 中的 `ByteRTCVideoPixelFormatCVPixelBuffer`,且必须存放在返回帧数据的 `textureBuf` 字段中。 + * @param config 自定义视频前处理器适用的设置,详见 ByteRTCVideoPreprocessorConfig{@link #ByteRTCVideoPreprocessorConfig}。
    + * 当前,`config` 中的 `required_pixel_format` 仅支持:`ByteRTCVideoPixelFormatI420` 和 `ByteRTCVideoPixelFormatUnknown`:
    + * - 设置为 `Unknown` 时,RTC SDK 给出供 processor 处理的视频帧格式即采集的格式。 + * - 设置为 `ByteRTCVideoPixelFormatI420` 时,RTC SDK 会将采集得到的视频转变为对应的格式,供前处理使用。 + * - 设置为其他值时,此方法调用失败。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 重复调用此接口时,仅最后一次调用生效。效果不会叠加。 + * - 对于 iOS 平台,将 ByteRTCVideoPreprocessorConfig{@link #ByteRTCVideoPreprocessorConfig} 中的 requiredPixelFormat 设置为 `kVideoPixelFormatUnknown`,可以通过避免格式转换带来一些性能优化。 + * @list 自定义流处理 + */ + +- (int)registerLocalVideoProcessor:(_Nullable id) processor + withConfig:(ByteRTCVideoPreprocessorConfig* _Nullable)config NS_SWIFT_NAME(registerLocalVideoProcessor(_:withConfig:)); +#pragma mark - LocalEncodedVideoFrameObserver +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册本地视频帧监测器。
    + * 无论使用内部采集还是自定义采集,调用该方法后,SDK 每监测到一帧本地视频帧时,都会将视频帧信息通过 onLocalEncodedVideoFrame:Frame:{@link #ByteRTCLocalEncodedVideoFrameObserver#onLocalEncodedVideoFrame:Frame:} 回调给用户 + * @param frameObserver 本地视频帧监测器,参看 ByteRTCLocalEncodedVideoFrameObserver{@link #ByteRTCLocalEncodedVideoFrameObserver}。将参数设置为 nullptr 则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该方法可在进房前后任意时间调用,在进房前调用可保证尽可能早地监测视频帧并触发回调 + * @list 自定义流处理 + */ + +- (int)registerLocalEncodedVideoFrameObserver:(_Nullable id) frameObserver NS_SWIFT_NAME(registerLocalEncodedVideoFrameObserver(_:)); +#pragma mark Audio Routing Controller +/** + * + * @hidden(macOS) + * @type api + * @brief 强制切换当前的音频播放路由。默认使用 setDefaultAudioRoute:{@link #ByteRTCEngine#setDefaultAudioRoute:} 中设置的音频路由。
    + * 音频播放路由发生变化时,会收到 rtcEngine:onAudioRouteChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioRouteChanged:} 回调。 + * @param audioRoute 音频播放路由,参见 ByteRTCAudioRoute{@link #ByteRTCAudioRoute}。仅支持扬声器和默认路由设备。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 对于绝大多数音频场景,推荐使用 setDefaultAudioRoute:{@link #ByteRTCEngine#setDefaultAudioRoute:} 设置默认音频路由,并借助 RTC SDK 的音频路由自动切换逻辑即可完成。切换逻辑参见[移动端设置音频路由](https: + * - 本接口支持在通话模式和媒体模式下使用,切换的目标路由仅支持内置扬声器。 + * - 不同音频场景中,音频路由和发布订阅状态到音量类型的映射关系详见 ByteRTCAudioScenarioType{@link #ByteRTCAudioScenarioType} 。 + * @list 音频管理 + */ + +- (int)setAudioRoute:(ByteRTCAudioRoute)audioRoute; +/** + * + * @hidden(macOS) + * @type api + * @brief 获取当前使用的音频播放路由。 + * @return 详见 ByteRTCAudioRoute{@link #ByteRTCAudioRoute} + * @note 要设置音频路由,详见 setAudioRoute:{@link #ByteRTCEngine#setAudioRoute:},仅适用于移动端。 + * @list 音频管理 + */ + +- (ByteRTCAudioRoute)getAudioRoute; +/** + * + * @type api + * @brief 启用匹配外置声卡的音频处理模式 + * @param enable
    + * - true: 开启 + * - false: 不开启(默认) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 当采用外接声卡进行音频采集时,建议开启此模式,以获得更好的音质。 + * - 开启此模式时,仅支持耳机播放。如果需要使用扬声器或者外置音箱播放,关闭此模式。 + * @list 音频管理 + */ + +- (int)enableExternalSoundCard:(bool)enable; + /** + * + * @hidden(macOS) + * @type api + * @brief 将默认的音频播放设备设置为听筒或扬声器。 + * @param audioRoute 音频播放设备。参看 ByteRTCAudioRoute{@link #ByteRTCAudioRoute}。仅支持听筒或扬声器。 + * @return + * - 0: 方法调用成功。 + * - < 0: 方法调用失败。 + * @note 对于音频路由切换逻辑,参见[移动端设置音频路由](https: + * @list 音频管理 + */ + +- (int)setDefaultAudioRoute:(ByteRTCAudioRoute)audioRoute; +#pragma mark WTN/CDN +/** + * + * @hiddensdk(audiosdk) + * @hidden for internal use only + * @type api + */ + +- (int)pushClientMixedStreamExternalVideoFrame:(NSString * _Nonnull)uid withFrame:(ByteRTCVideoFrameData * _Nonnull)frame; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @region 转推 CDN/WTN + * @brief 设置客户端合流的观察者 + * @param observer 客户端转推直播观察者。详见 ByteRTCClientMixedStreamDelegate{@link #ByteRTCClientMixedStreamDelegate}。
    + * 通过注册 observer 接收转推直播相关的回调。 + * @return 方法调用结果。
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list CDN 推流 + */ + +- (int)setClientMixedStreamObserver:(_Nullable id)observer; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @list CDN 推流 + */ + +- (int)startClientMixedStream:(NSString * _Nonnull)taskId withMixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config + withExtraConfig:(ByteRTCClientMixedStreamConfig*)extraConfig; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @list CDN 推流 + */ + +- (int)updateClientMixedStream:(NSString * _Nonnull)taskId withMixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config withExtraConfig:(ByteRTCClientMixedStreamConfig*)extraConfig; +/** + * + * @hidden for internal use only + * @type api + * @hiddensdk(audiosdk) + * @list CDN 推流 + */ + +- (int)stopClientMixedStream:(NSString*)taskId; +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `startPushMixedStreamToCDN:mixedConfig:observer:` 和 `startPushPublicStream:withLayout:` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 指定房间中的媒体流,合成后一路流发布到 CDN 或发布一路 WTN 流。 + * @param taskId 转推直播任务 ID,长度不超过 127 字节。 当 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig} 中的 `PushTargetType = 0` 时, 用于标识转推直播任务。你可以在同一房间内发起多个转推直播任务,并用不同的 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 + * 当 `PushTargetType = 1` 时,设置无效,传空即可。 + * @param pushTargetConfig 推流目标配置参数,比如设置推流地址、WTN流 ID。参看 ByteRTCMixedStreamPushTargetConfig{@link #ByteRTCMixedStreamPushTargetConfig}。 + * @param config 合流转推配置参数,比如设置合流的图片、视频视图布局和音频属性。参看 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}。 + * @return + * - 0: 成功。你可以通过 rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:} 回调获取启动结果和推流过程中的事件。 + * - !0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在[控制台](https: + * - 调用 stopPushMixedStream:withPushTargetType:{@link #ByteRTCEngine#stopPushMixedStream:withPushTargetType:} 停止转推直播。 + * - 调用 updatePushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#updatePushMixedStream:withPushTargetConfig:withMixedConfig:} 可以更新部分任务参数。 + * @list CDN 推流 + * @order 0 + */ + +- (int)startPushMixedStream:(NSString * _Nonnull)taskId withPushTargetConfig:(ByteRTCMixedStreamPushTargetConfig*)pushTargetConfig withMixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config; +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `updatePushMixedStreamToCDN:mixedConfig:` 和 `updatePublicStreamParam:withLayout:` 方法用于实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这两个方法,请迁移到此接口。 + * @hidden(Linux) + * @type api + * @hiddensdk(audiosdk) + * @brief 更新推 CDN/WTN 流转推参数,会收到 rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:} 回调。
    + * 使用 startPushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#startPushMixedStream:withPushTargetConfig:withMixedConfig:} 启用转推直播功能后,使用此方法更新功能配置参数。 + * @param taskId 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 + * @param pushTargetConfig 推流目标配置参数,比如设置推流地址、WTN流 ID。参看 ByteRTCMixedStreamPushTargetConfig{@link #ByteRTCMixedStreamPushTargetConfig}。 + * @param config 转推直播配置参数,参看 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}。除特殊说明外,均支持过程中更新。
    + * 调用时,结构体中没有传入值的属性,会被更新为默认值。 + * @return + * - 0: 成功。 + * - !0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @list CDN 推流 + * @order 4 + */ + +- (int)updatePushMixedStream:(NSString *_Nonnull)taskId withPushTargetConfig:(ByteRTCMixedStreamPushTargetConfig*)pushTargetConfig withMixedConfig:(ByteRTCMixedStreamConfig *_Nonnull)config; + +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN:` 方法来停止合流转推任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @hiddensdk(audiosdk) + * @brief 停止 WTN 流或合流转推 CDN 任务。 + * @param taskId 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 + * @param pushTargetType 参看 ByteRTCMixedStreamPushTargetType{@link #ByteRTCMixedStreamPushTargetType}。 + * @return + * + 0: 成功 + * + !0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 关于启动合流转推直播或 WTN 流,参看 startPushMixedStream:withPushTargetConfig:withMixedConfig:{@link #ByteRTCEngine#startPushMixedStream:withPushTargetConfig:withMixedConfig:}。 + * @list CDN 推流 + * @order 3 + */ + +- (int)stopPushMixedStream:(NSString *_Nonnull)taskId withPushTargetType:(ByteRTCMixedStreamPushTargetType)pushTargetType; +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `startPushSingleStreamToCDN` 来启动单流转推任务。 + * @hiddensdk(audiosdk) + * @brief 将房间内某一路音视频流,推送到指定的 RTC 房间或 CDN 地址。此过程不涉及编解码。 + * @param taskId 任务 ID。
    + * 你可以发起多个转推任务,并用不同的任务 ID 加以区分。当你需要发起多个转推任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 + * @param singleStream 单流转推配置参数。详见 ByteRTCPushSingleStreamParam{@link #ByteRTCPushSingleStreamParam}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在调用该接口前,你需要在[控制台](https: + * - 调用该方法后,关于启动结果和推流过程中的错误,会收到 rtcEngine:onSingleStreamEvent:withTaskId:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onSingleStreamEvent:withTaskId:withErrorCode:} 回调。 + * - 调用 stopPushSingleStream:{@link #ByteRTCEngine#stopPushSingleStream:} 停止任务。 + * - 由于本功能不进行编解码,所以推到 RTMP 的视频流会根据推流端的分辨率、编码方式、关闭摄像头等变化而变化。 + * @list CDN 推流 + */ + +- (int)startPushSingleStream:(NSString *_Nonnull)taskId singleStream:(ByteRTCPushSingleStreamParam *_Nonnull)singleStream; +/** + * + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN:` 方法来停止单流转推直播任务。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `stopPushStreamToCDN:` 来停止单流转推任务。 + * @brief 停止由 startPushSingleStream:singleStream:{@link #ByteRTCEngine#startPushSingleStream:singleStream:} 启动的单流转推任务。 + * @param taskId 任务 ID。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list CDN 推流 + */ + +- (int)stopPushSingleStream:(NSString *_Nonnull)taskId; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 开启缓存同步功能。开启后,会缓存收到的实时音视频数据,并对齐不同数据中的时间戳完成同步。此功能会影响音视频数据消费的实时性。 + * @param config 参看 ByteRTCChorusCacheSyncConfig{@link #ByteRTCChorusCacheSyncConfig}。 + * @param observer 事件和数据观察者,参看 ByteRTCChorusCacheSyncObserver{@link #ByteRTCChorusCacheSyncObserver}。 + * @return 查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 要关闭缓存同步功能,调用 stopChorusCacheSync{@link #ByteRTCEngine#stopChorusCacheSync}。 + * @list Pushing Streams to CDN + */ + +- (int)startChorusCacheSync:(ByteRTCChorusCacheSyncConfig* _Nullable)config observer:(id _Nullable)observer; + /** + * + * @hidden internal use only + * @type api + * @hiddensdk(audiosdk) + * @brief 关闭缓存同步功能。 + * @return 查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @list Pushing Streams to CDN + */ + +-(int)stopChorusCacheSync; + +#pragma mark public streaming +/** + * + * @type api + * @brief 获取 WTN 流对象。 + * @return WTN 流对象,参看 ByteRTCWTNStream{@link #ByteRTCWTNStream}。 + * @list WTN + */ + +- (ByteRTCWTNStream *_Nullable)getWTNStream; + +#pragma mark External Video Data + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送外部视频帧。 + * @param frame 该视频帧包含待 SDK 编码的视频数据,参考 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 推送外部视频帧前,必须调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 开启外部视频源采集。
    + * 支持格式:raw NV12 + * @list 自定义流处理 + */ + +- (int)pushExternalVideoFrame:(ByteRTCVideoFrameData * _Nonnull)frame; + +#pragma mark External Audio Data +/** + * + * @type api + * @brief 设置并开启指定的音频数据帧回调 + * @param method 音频回调方法,参看 ByteRTCAudioFrameCallbackMethod{@link #ByteRTCAudioFrameCallbackMethod}。
    + * 当音频回调方法设置为 `0`、`1`、`2`、`5`时,你需要在参数 `format` 中指定准确的采样率和声道,暂不支持设置为自动。
    + * 当音频回调方法设置为 `3` 时,将 `format` 中的各个字段设置为默认值。 + * @param format 音频参数格式,参看 ByteRTCAudioFormat{@link #ByteRTCAudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 开启音频回调并调用 registerAudioFrameObserver:{@link #ByteRTCMediaPlayer#registerAudioFrameObserver:} 后,ByteRTCAudioFrameObserver{@link #ByteRTCAudioFrameObserver} 会收到对应的音频回调。两者调用顺序没有限制且相互独立。 + * @list 自定义流处理 + */ + +- (int)enableAudioFrameCallback:(ByteRTCAudioFrameCallbackMethod) method format:(ByteRTCAudioFormat* _Nullable)format; +/** + * + * @type api + * @brief 关闭音频回调 + * @param method 音频回调方法,参看 ByteRTCAudioFrameCallbackMethod{@link #ByteRTCAudioFrameCallbackMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该方法需要在调用 enableAudioFrameCallback:format:{@link #ByteRTCEngine#enableAudioFrameCallback:format:} 之后调用。 + * @list 自定义流处理 + */ + +- (int)disableAudioFrameCallback:(ByteRTCAudioFrameCallbackMethod) method; +/** + * + * @type api + * @brief 注册音频数据回调观察者。 + * @param audioFrameObserver 音频数据观察者,参看 ByteRTCAudioFrameObserver{@link #ByteRTCAudioFrameObserver}。如果传入 null,则取消注册。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 注册音频数据回调观察者并调用 enableAudioFrameCallback:format:{@link #ByteRTCEngine#enableAudioFrameCallback:format:} 后,ByteRTCAudioFrameObserver{@link #ByteRTCAudioFrameObserver} 会收到对应的音频回调。对回调中收到的音频数据进行处理,不会影响 RTC 的编码发送或渲染。 + * @list 自定义流处理 + */ + +- (int)registerAudioFrameObserver:(_Nullable id) audioFrameObserver NS_SWIFT_NAME(registerAudioFrameObserver(_:)); +/** + * + * @type api + * @brief 注册自定义音频处理器。
    + * 注册完成后,你可以调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},对本地采集到的音频进行处理,RTC SDK 将对处理后的音频进行编码和发送。也可以对接收到的远端音频进行自定义处理,RTC SDK 将对处理后的音频进行渲染。 + * @param processor 自定义音频处理器,详见 ByteRTCAudioFrameProcessor{@link #ByteRTCAudioFrameProcessor}。
    + * SDK 只持有 processor 的弱引用,你应保证其生命周期。需要取消注册时,设置此参数为 nullptr。
    + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 重复调用此接口时,仅最后一次调用生效。 + * - 更多相关信息,详见[音频自定义处理](https: + * @list 自定义流处理 + */ + +- (int)registerAudioProcessor:(_Nullable id)processor; +/** + * + * @type api + * @brief 设置并开启指定的音频帧回调,进行自定义处理。 + * @param method 音频帧类型,参看 ByteRTCAudioFrameMethod{@link #ByteRTCAudioFrameMethod}。可多次调用此接口,处理不同类型的音频帧。
    + * 选择不同类型的音频帧将收到对应的回调:
    + * - 选择本地采集的音频时,会收到 onProcessRecordAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessRecordAudioFrame:}。 + * - 选择远端音频流的混音音频时,会收到 onProcessPlayBackAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessPlayBackAudioFrame:}。 + * - 选择远端音频流时,会收到 onProcessRemoteUserAudioFrame:info:audioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessRemoteUserAudioFrame:info:audioFrame:}。 + * - 选择软件耳返音频时,会收到 onProcessEarMonitorAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessEarMonitorAudioFrame:}。(仅适用于 iOS 平台) + * - 选择屏幕共享音频流时,会收到 onProcessScreenAudioFrame:{@link #ByteRTCAudioFrameProcessor#onProcessScreenAudioFrame:}。 + * @param format 设定自定义处理时获取的音频帧格式,参看 ByteRTCAudioFormat{@link #ByteRTCAudioFormat}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在调用此接口前,你需要调用 registerAudioProcessor:{@link #ByteRTCEngine#registerAudioProcessor:} 注册自定义音频处理器。 + * - 要关闭音频自定义处理,调用 disableAudioProcessor:{@link #ByteRTCEngine#disableAudioProcessor:}。 + * @list 自定义流处理 + */ + +- (int)enableAudioProcessor:(ByteRTCAudioFrameMethod)method + audioFormat:(ByteRTCAudioFormat *_Nullable)format; +/** + * + * @type api + * @brief 关闭自定义音频处理。 + * @param method 音频帧类型,参看 ByteRTCAudioFrameMethod{@link #ByteRTCAudioFrameMethod}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 自定义流处理 + */ + +- (int)disableAudioProcessor:(ByteRTCAudioFrameMethod)method; +/** + * + * @type api + * @brief 推送自定义采集的音频数据到 RTC SDK。 + * @param audioFrame 音频数据帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}
    + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
    + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 推送外部音频数据前,必须先调用 setAudioSourceType:{@link #ByteRTCEngine#setAudioSourceType:} 开启自定义采集。 + * - 你必须每隔 10 毫秒推送一次外部采集的音频数据。单次推送的 samples (音频采样点个数)应该为 audioFrame.sampleRate / 100。比如设置采样率为 48000 时, 每次应该推送 480 个采样点。 + * @list 自定义流处理 + */ + +- (int)pushExternalAudioFrame:(ByteRTCAudioFrame * _Nonnull) audioFrame; +/** + * + * @type api + * @brief 拉取下行音频数据用于自定义音频渲染。
    + * 调用该方法后,SDK 会主动拉取待播放的音频数据,包括远端已解码和混音后的音频数据,用于外部播放。 + * @param audioFrame 音频数据帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @return 方法调用结果
    + * - 0: 设置成功 + * - < 0: 设置失败 + * @note + * - 拉取外部音频数据前,必须先调用 setAudioRenderType:{@link #ByteRTCEngine#setAudioRenderType:} 开启自定义渲染。 + * - 由于 RTC SDK 的帧长为 10 毫秒,你应当每隔 10 毫秒拉取一次音频数据。确保音频采样点数(sample)x 拉取频率等于 audioFrame 的采样率 (sampleRate)。如设置采样率为 48000 时,每 10 毫秒调用本接口拉取数据,每次应拉取 480 个采样点。 + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * @list 自定义流处理 + */ + +- (int)pullExternalAudioFrame:(ByteRTCAudioFrame * _Nonnull) audioFrame; +/** + * + * @type api + * @brief 向 SDK 发送由自定义处理后的 PCM 音频数据,作为回声消除的参考信号 + * @param audioFrame 音频数据帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @return 方法调用结果
    + * + 0:方法调用成功
    + * + <-1:方法调用失败
    + * + <-302:警告,配置下发了无效的aec场景
    + * + <-303:警告,配置下发了错误的aec类型
    + * @note
    + * + 推送自定义回声消除参考信号前,必须先调用 setAudioRenderType{@link #ByteRTCEngine#setAudioRenderType} 开启自定义渲染。
    + * + 由于 RTC SDK 的帧长为 10 毫秒,你应当每隔 10 毫秒发送一次音频数据。确保音频采样点数(sample)x 发送频率等于 audioFrame 的采样率 (sampleRate)。如设置采样率为 48000 时,每 10 毫秒调用本接口发送数据,每次应发送 480 个采样点。
    + * + 音频采样格式为 S16。音频缓冲区内的数据格式为 PCM 数据,其容量大小为 audioFrame.samples × audioFrame.channel × 2。
    + * @list 自定义流处理 + */ + +- (int)pushReferenceAudioPCMData:(ByteRTCAudioFrame * _Nonnull) audioFrame; +/** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 推送opus编码音频数据到 RTC SDK,RTC SDK纯转发。 + * @param audio_stream 对应的opus音频数据。详见 EncodedAudioFrameData{@link #EncodedAudioFrameData}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 推送音频数据前,必须先调用 enableAudioEncoding{@link #ByteRTCEngine#enableAudioEncoding} 关闭音频编码。 + * @list 自定义流处理 + */ + +- (int)pushExternalEncodedAudioFrame:(ByteRTCEncodedAudioFrameData * _Nonnull)audioFrame; +/** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频编码功能。 + * @param enable 是否使用sdk音频编码功能。 + * true: 打开音频编码(默认) + * false: 关闭音频编码直接转推。 + * @note + * - 在pushExternalEncodedAudioFrame{@link #ByteRTCEngine#pushExternalEncodedAudioFrame}之前调用。 + * @list 自定义流处理 + */ + +- (void)enableAudioEncoding:(bool)enable; +/** + * + * @hidden for internal use only + * @region 自定义音频采集渲染 + * @brief 是否使用sdk音频解码功能。 + * @param enable 是否使用sdk音频解码功能。 + * true: 打开音频解码功能(默认) + * false: 关闭音频解码功能直接转推。 + * @note + * - 在registerRemoteEncodedAudioFrameObserver之前调用。 + * @list 自定义流处理 + */ + +- (void)enableAudioDecoding:(bool)enable; +/** + * + * @type api + * @hidden for internal use only + * @brief 注册远端音频帧监测器。
    + * 调用该方法后,SDK 每监测到一帧远端音频帧时,都会将音频帧信息通过 onRemoteEncodedAudioFrame:info:audioFrame: 回调给用户 + * @param observer 远端音频帧监测器,参看 IRemoteEncodedAudioFrameObserver。 + * @note + * - 该方法建议在进房前调用。 + * - 将参数设置为 nullptr 则取消注册。 + * - 调用前,必须先调用 enableAudioDecoding{@link #ByteRTCEngine#enableAudioDecoding} 关闭音频解码功能。 + * @list 自定义流处理 + */ + +- (void)registerRemoteEncodedAudioFrameObserver:(_Nullable id)observer; +/** + * + * @type api + * @brief 设置业务标识参数
    + * 可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。 + * @param businessId
    + * 用户设置的自己的 businessId 值
    + * businessId 只是一个标签,颗粒度需要用户自定义。 + * @return + * - 0: 成功。 + * - -2: 输入非法,合法字符包括所有小写字母、大写字母和数字,除此外还包括四个独立字符分别是:英文句号,短横线,下划线和 @ 。 + * @note + * - 需要在调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 进房之前调用,进房之后调用该方法无效。 + * @list 引擎管理 + */ + +- (int)setBusinessId:(NSString* _Nullable)businessId; +/** + * + * @type api + * @brief 通话结束,将用户反馈的问题上报到 RTC。 + * @param types 预设问题列表,参看 ByteRTCProblemFeedbackOption{@link #ByteRTCProblemFeedbackOption} + * @param info 预设问题以外的其他问题的具体描述,房间信息。参看 ByteRTCProblemFeedbackInfo{@link #ByteRTCProblemFeedbackInfo} + * @return + * - 0: 成功。 + * - -3: 失败。 + * @note + * - 你可以在 [RTC 控制台](https: + * - 如果用户上报时在房间内,那么问题会定位到用户当前所在的一个或多个房间;如果用户上报时不在房间内,那么问题会定位到引擎此前退出的房间。 + * @list 引擎管理 + */ + +- (int)feedback:(ByteRTCProblemFeedbackOption)types info:(ByteRTCProblemFeedbackInfo* _Nullable)info; +/** + * + * @valid since 353 + * @type api + * @brief 获取 C++ 层 [IRTCEngine 句柄](https: + * @return + * - >0:方法调用成功, 返回 C++ 层 `IRTCEngine` 的地址。 + * - NULL:方法调用失败 + * @note 在一些场景下,获取 C++ 层 `IRTCEngine`,并通过其完成操作,相较于通过 OC 封装层完成有显著更高的执行效率。典型的场景有:视频/音频帧自定义处理,音视频通话加密等。 + * @list 引擎管理 + */ + +- (void * _Nullable) getNativeHandle; + +#pragma mark Fallback Related +/** + * + * @type api + * @brief 设置发布的音视频流的回退选项。
    + * 你可以调用该接口设置网络不佳或设备性能不足时从大流起进行降级处理,以保证通话质量。 + * @param option 本地发布的音视频流回退选项,参看 ByteRTCPublishFallbackOption{@link #ByteRTCPublishFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅在调用 setLocalSimulcastMode:{@link #ByteRTCEngine#setlocalsimulcastmode:} 开启了发送多路视频流的情况下生效。 + * - 该方法必须在进房前设置,进房后设置或更改设置无效。 + * - 调用该方法后,如因性能或网络不佳产生发布性能回退或恢复,本端会提前收到 rtcEngine:onPerformanceAlarms:info:mode:reason:sourceWantedData:{@link #ByteRTCEngineDelegate#rtcEngine:onPerformanceAlarms:info:mode:reason:sourceWantedData:} 回调发出的告警,以便采集设备配合调整。 + * - 设置回退后,本地发布的音视频流发生回退或从回退中恢复时,远端会收到 rtcEngine:onSimulcastSubscribeFallback:info:event:{@link #ByteRTCEngineDelegate#rtcEngine:onSimulcastSubscribeFallback:info:event:} 回调,通知该情况。 + * - 你可以调用客户端 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + +- (int)setPublishFallbackOption:(ByteRTCPublishFallbackOption)option; +/** + * + * @type api + * @brief 设置订阅的音视频流的回退选项。
    + * 你可调用该接口设置网络不佳或设备性能不足时允许订阅流进行降级或只订阅音频流,以保证通话流畅。 + * @param option 订阅的音视频流回退选项,参看 ByteRTCSubscribeFallbackOption{@link #ByteRTCSubscribeFallbackOption}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 你必须在进房前设置,进房后设置或更改设置无效。 + * - 设置回退选项后,订阅的音视频流发生回退或从回退中恢复时,会收到 rtcEngine:onSimulcastSubscribeFallback:info:event:{@link #ByteRTCEngineDelegate#rtcEngine:onSimulcastSubscribeFallback:info:event:} 和 rtcEngine:onRemoteVideoSizeChanged:info:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteVideoSizeChanged:info:withFrameInfo:} 回调通知。 + * - 你可以调用 API 或者在服务端下发策略设置回退。当使用服务端下发配置实现时,下发配置优先级高于在客户端使用 API 设定的配置。 + * @list 网络管理 + */ + +- (int)setSubscribeFallbackOption:(ByteRTCSubscribeFallbackOption)option; +/** + * + * @type api + * @brief 设置用户优先级。 + * @param priority 远端用户的优先级, 详见枚举类型 ByteRTCRemoteUserPriority{@link #ByteRTCRemoteUserPriority} + * @param roomId 房间 ID + * @param uid 远端用户的 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该方法与 setSubscribeFallbackOption:{@link #ByteRTCEngine#setSubscribeFallbackOption:} 搭配使用。 + * - 如果开启了订阅流回退选项,弱网或性能不足时会优先保证收到的高优先级用户的流的质量。 + * - 该方法在进房前后都可以使用,可以修改远端用户的优先级。 + * @list 网络管理 + */ + +- (int)setRemoteUserPriority:(ByteRTCRemoteUserPriority)priority + InRoomId:(NSString *_Nonnull)roomId + uid:(NSString *_Nonnull)uid NS_SWIFT_NAME(setRemoteUserPriority(_:InRoomId:uid:)); +#pragma mark AES Related +/** + * + * @type api + * @brief 设置传输时使用内置加密的方式。 + * @param encrypt_type 内置加密算法,详见 ByteRTCEncryptType{@link #ByteRTCEncryptType} + * @param key 加密密钥,长度限制为 36 位,超出部分将会被截断 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 使用传输时内置加密时,使用此方法;如果需要使用传输时自定义加密,参看 onEncryptData:{@link #ByteRTCEncryptHandler#onEncryptData:}。 + * 内置加密和自定义加密互斥,根据最后一个调用的方法确定传输加密的方案。
    + * - 该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。 + * @list 通话加密 + */ + +- (int)setEncryptInfo:(ByteRTCEncryptType)encrypt_type key:(NSString * _Nonnull)key; +/** + * + * @type api + * @brief 设置自定义加密和解密方式。 + * @param handler 自定义加密 handler,需要实现里面的加密和解密方法。参看 ByteRTCEncryptHandler{@link #ByteRTCEncryptHandler}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法与 setEncryptInfo:key:{@link #ByteRTCEngine#setEncryptInfo:key:} 为互斥关系,即按照调用顺序,最后一个调用的方法为最终生效的版本。 + * - 该方法必须在调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 之前调用,可重复调用,以最后调用的参数作为生效参数。 + * - 无论加密或者解密,其对原始数据的长度修改,需要控制在 180% 之间,即如果输入数据为 100 字节,则处理完成后的数据必须不超过 180 字节,如果加密或解密结果超出该长度限制,则该音视频帧可能会被丢弃。 + * - 数据加密/解密为串行执行,因而视实现方式不同,可能会影响到最终渲染效率,是否使用该方法,需要由使用方谨慎评估。 + * @list 通话加密 + */ + +- (int)setCustomizeEncryptHandler:(id _Nullable)handler NS_SWIFT_NAME(setCustomizeEncryptHandler(_:)); + +#pragma mark - Extention Methods +/** + * + * @type api + * @brief 创建 RTC 房间实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 ByteRTCRoom{@link #ByteRTCRoom} 实例。分别调用各 ByteRTCRoom 实例中的 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 ByteRTCRoom{@link #ByteRTCRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 roomId 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 ByteRTCRoom 实例,再调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * - 如果你需要在多个房间发布音视频流,无须创建多房间,直接调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 开始跨房间转发媒体流。 + * @list 房间管理 + */ + +- ( ByteRTCRoom * _Nullable)createRTCRoom:(NSString * _Nonnull)roomId; + +/** + * + * @type api + * @brief 创建游戏房间实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 ByteRTCGameRoom{@link #ByteRTCGameRoom} 实例。分别调用各 GameRTCRoom 实例中的 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时订阅各房间的音视频流。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @param roomConfig 房间配置,参看 GameRoomConfig{@link #GameRoomConfig}。 + * @return 创建的 ByteRTCGameRoom{@link #ByteRTCGameRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 roomId 格式错误或当前场景是否是游戏场景。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 GameRTCRoom 实例,再调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 加入房间。 + * - 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + +- (ByteRTCGameRoom * _Nullable)createGameRoom:(NSString * _Nonnull)roomId roomConfig:(GameRoomConfig * _Nonnull)roomConfig; +/** + * + * @type api + * @brief 创建 RTS 房间实例。
    + * 调用此方法仅返回一个RTS房间实例,你仍需调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 才能真正地创建/加入房间。
    + * 多次调用此方法以创建多个 ByteRTCRoom{@link #ByteRTCRoom} 实例。分别调用各 ByteRTCRTSRoom 实例中的 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 方法,同时加入多个房间。
    + * 多房间模式下,用户可以同时收发各房间的消息。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 ByteRTCRoom{@link #ByteRTCRoom} 房间实例。 + * 返回 NULL 时,请确认指定房间是否已经存在或 roomId 格式错误。 + * @note + * - 如果需要加入的房间已存在,你仍需先调用本方法来获取 ByteRTCRTSRoom 实例,再调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。 + * - 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + * @list 房间管理 + */ + +- ( ByteRTCRTSRoom * _Nullable)createRTSRoom:(NSString * _Nonnull)roomId; + +#pragma mark - ScreenCapture +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 设置 Extension 配置项。你必须在使用屏幕内部采集功能前,设置使用的 Extension。 + * @param groupId 你的应用和 Extension 应该归属于同一个 App Group,此处需要传入 Group Id。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 必须在调用 createRTCEngine:delegate:{@link #ByteRTCEngine#createRTCEngine:delegate:} 之后立即调用此方法。在引擎实例的生命周期中,此方法只需要调用一次。 + * @list 屏幕共享 + */ + +- (int)setExtensionConfig:(NSString *_Nullable)groupId; + +/** + * + * @type api + * @brief 设置运行时的参数 + * @param parameters 保留参数 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该接口需在 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 和 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 之前调用。 + * @list 引擎管理 + */ + +- (int)setRuntimeParameters:(NSDictionary * _Nullable)parameters; +#if BYTERTC_TARGET_MAC +/** + * + * @hidden(iOS) + * @type api + * @brief 获取共享对象(应用窗口和桌面)列表。 + * @return 共享对象(应用窗口和桌面)列表。参看 ByteRTCScreenCaptureSourceInfo{@link #ByteRTCScreenCaptureSourceInfo}。
    + * 枚举值可作为调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启屏幕共享时的输入参数。 + * @note 仅桌面端可用。 + * @list 屏幕共享 + */ + +- (NSArray *_Nonnull)getScreenCaptureSourceList; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 采集屏幕视频流,用于共享。屏幕视频流包括:屏幕上显示的内容,或应用窗口中显示的内容。 + * @param sourceInfo 待共享的屏幕源,参看 ByteRTCScreenCaptureSourceInfo{@link #ByteRTCScreenCaptureSourceInfo}。
    + * 你可以调用 getScreenCaptureSourceList{@link #ByteRTCEngine#getScreenCaptureSourceList} 获得所有可以共享的屏幕源。 + * @param captureParameters 共享参数。参看 ByteRTCScreenCaptureParam{@link #ByteRTCScreenCaptureParam}。 + * @return + * - 0: 成功 + * - -1: 失败 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 调用此方法仅开启屏幕流视频采集,不会发布采集到的视频。发布屏幕流视频需要调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:}。 + * - 调用 stopScreenVideoCapture{@link #ByteRTCEngine#stopScreenVideoCapture} 关闭屏幕视频源采集。 + * - 本地用户通过 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调获取屏幕采集状态,包括开始、暂停、恢复、错误等。 + * - 调用成功后,本端会收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调。 + * - 调用此接口前,你可以调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 设置屏幕视频流的采集帧率和编码分辨率。 + * - 在收到 rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstLocalVideoFrameCaptured:withFrameInfo:} 回调后,通过调用 setLocalVideoCanvas:{@link #ByteRTCEngine#setLocalVideoCanvas:} 或 setLocalVideoSink:withPixelFormat:{@link #ByteRTCEngine#setLocalVideoSink:withPixelFormat:} 函数设置本地屏幕共享视图。 + * - 再开启采集屏幕视频流后,你可以调用 updateScreenCaptureHighlightConfig:{@link #ByteRTCEngine#updateScreenCaptureHighlightConfig:} 更新边框高亮设置,调用 updateScreenCaptureMouseCursor:{@link #ByteRTCEngine#updateScreenCaptureMouseCursor:} 更新对鼠标的处理设置,PC 端还可以调用 updateScreenCaptureFilterConfig:{@link #ByteRTCEngine#updateScreenCaptureFilterConfig:} 设置需要过滤的窗口。 + * @list 屏幕共享 + */ + +- (int)startScreenVideoCapture:(ByteRTCScreenCaptureSourceInfo *_Nonnull)sourceInfo captureParameters:(ByteRTCScreenCaptureParam *_Nonnull)captureParameters NS_SWIFT_NAME(startScreenVideoCapture(_:captureParameters:)); +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 停止屏幕视频流采集。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 要开启屏幕视频流采集,调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:}。 + * - 调用后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。 + * - 调用此接口不影响屏幕视频流发布。 + * @list 屏幕共享 + */ + +- (int)stopScreenVideoCapture; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 内部屏幕流采集时,更新采集区域。 + * @param regionRect 采集区域相对 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 中设定区域的值。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用此接口前,必须先通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureRegion:(CGRect)regionRect; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 内部屏幕流采集时,更新边框高亮设置。默认展示边框。 + * @param config 边框高亮设置。参见 ByteRTCHighlightConfig{@link #ByteRTCHighlightConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureHighlightConfig:(ByteRTCHighlightConfig *_Nonnull)config NS_SWIFT_NAME(updateScreenCaptureHighlightConfig(_:)); +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 内部屏幕流采集时,更新对鼠标的处理设置。默认采集鼠标。 + * @param mouseCursorCaptureState 参看 ByteRTCMouseCursorCaptureState{@link #ByteRTCMouseCursorCaptureState}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureMouseCursor:(ByteRTCMouseCursorCaptureState)mouseCursorCaptureState; +/** + * + * @hidden(iOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 通过 RTC SDK 提供的采集模块采集屏幕视频流时,设置需要过滤的窗口。 + * @param excludedWindowList 过滤掉的窗口列表。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters:{@link #ByteRTCEngine#startScreenVideoCapture:captureParameters:} 开启了内部屏幕流采集。 + * - 本函数在屏幕源类别是屏幕而非应用窗体时才起作用。详见:ByteRTCScreenCaptureSourceType{@link #ByteRTCScreenCaptureSourceType}。 + * - 调用本接口排除指定窗口时,共享视频的帧率无法达到 30fps。 + * @list 屏幕共享 + */ + +- (int)updateScreenCaptureFilterConfig:(NSArray * _Nullable) excludedWindowList; +/** + * + * @hidden(iOS) + * @type api + * @brief 获取屏幕采集对象缩略图 + * @param sourceType 屏幕采集对象的类型。详见 ByteRTCScreenCaptureSourceType{@link #ByteRTCScreenCaptureSourceType}。 + * @param sourceId 屏幕分享时,共享对象的 ID。可通过 getScreenCaptureSourceList{@link #ByteRTCEngine#getScreenCaptureSourceList} 返回的`ByteRTCScreenCaptureSourceInfo`共享对象列表中获取。 + * @param maxWidth 最大宽度。保持采集对象本身的宽高比不变,将缩略图缩放到指定范围内的最大宽高。如果给出的尺寸与共享对象比例不同,得到的缩略图会有黑边。 + * @param maxHeight 最大高度。参见 maxWidth 的说明。 + * @return 屏幕采集对象缩略图。缩略图由屏幕共享对象等比缩放而来。缩略图的大小小于等于此接口设定的尺寸。 + * @list 屏幕共享 + */ + +- (ByteRTCImage *_Nonnull)getThumbnail:(ByteRTCScreenCaptureSourceType)sourceType sourceId:(intptr_t)sourceId maxWidth:(int)maxWidth maxHeight:(int)maxHeight; +/** + * + * @hidden(iOS) + * @brief 获取应用窗体所属应用的图标。 + * @region 屏幕共享 + * @param sourceId 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList{@link #ByteRTCEngine#getScreenCaptureSourceList} 返回的`ByteRTCScreenCaptureSourceInfo`共享对象列表中获取。 + * @param width 最大宽度。返回的图标将是宽高相等的,输入的宽高不等时,取二者较小值。宽高范围为 [32,256],超出该范围将返回 `nullptr`,默认输出 100 x 100 的图像。 + * @param height 最大高度。参见 `width` 的说明。 + * @return 应用图标。当屏幕共享对象为应用窗体时有效,否则返回 `nullptr`。 + * @list 屏幕共享 + */ + +- (ByteRTCImage *_Nonnull)getWindowAppIcon:(intptr_t)sourceId width:(int)width height:(int)height; +#endif +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 使用 RTC SDK 内部采集模块开始采集屏幕音频流和(或)视频流。 + * @param type 媒体类型,参看 ByteRTCScreenMediaType{@link #ByteRTCScreenMediaType}。 + * @param bundleId 绑定 Extension 的 Bundle ID,绑定后应用中共享屏幕的选择列表中只展示你的 Extension 可供选择。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 或 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 当从 iOS 控制中心发起屏幕采集时无需调用本方法。 + * - 采集后,你还需要调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:} 和/或 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:} 发布采集到的屏幕音视频。 + * - 开启屏幕音频/视频采集成功后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 和 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 回调。 + * @list 屏幕共享 + */ + +- (int)startScreenCapture:(ByteRTCScreenMediaType) type bundleId:(NSString *_Nullable)bundleId; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 更新内部屏幕采集时采集的媒体类型。 + * @param type 媒体类型,参看 ByteRTCScreenMediaType{@link #ByteRTCScreenMediaType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 你需在开启屏幕视频流采集后调用该方法。 + * - 本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 或 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 回调。 + * @list 屏幕共享 + */ + +- (int)updateScreenCapture:(ByteRTCScreenMediaType) type; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 在屏幕共享时,停止使用 RTC SDK 内部采集方式采集屏幕音视频。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceWarning:deviceType:deviceWarning:} 或 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 当从 iOS 控制中心发起屏幕采集时无需调用本方法。 + * - 本方法只会停止本地屏幕采集,并不会影响屏幕流的发布状态。 + * - 本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 和 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 的回调。 + * @list 屏幕共享 + */ + +- (int)stopScreenCapture; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 向屏幕共享 Extension 发送自定义消息 + * @param messsage 发送给 Extension 的消息内容 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在 startScreenCapture:bundleId:{@link #ByteRTCEngine#startScreenCapture:bundleId:} 后调用该方法。 + * - 通过 onReceiveMessageFromApp:{@link #ByteRtcScreenCapturerExtDelegate#onReceiveMessageFromApp:} 回调发送的消息。 + * @list 屏幕共享 + */ + +- (int)sendScreenCaptureExtensionMessage:(NSData *_Nonnull) messsage; +/** + * + * @hidden(iOS) + * @type api + * @brief 创建音频设备管理实例 + * @return ByteRTCAudioDeviceManager{@link #ByteRTCAudioDeviceManager} + * @list 音频管理 + */ + +- (ByteRTCAudioDeviceManager *_Null_unspecified)getAudioDeviceManager; +/** + * + * @hidden(iOS) + * @type api + * @brief 创建视频设备管理实例 + * @return 视频设备管理实例,详见 ByteRTCVideoDeviceManager{@link #ByteRTCVideoDeviceManager} + * @list 视频管理 + */ + +- (ByteRTCVideoDeviceManager * _Null_unspecified)getVideoDeviceManager NS_SWIFT_NAME(getVideoDeviceManager()); + +#pragma mark - FileRecording +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 该方法将通话过程中的音视频数据录制到本地的文件中。 + * @param recordingConfig 本地录制参数配置,参看 ByteRTCRecordingConfig{@link #ByteRTCRecordingConfig} + * @param recordingType 本地录制的媒体类型,参看 ByteRTCRecordingType{@link #ByteRTCRecordingType}
    + * 注意:屏幕流仅支持录制视频(ByteRTCRecordingTypeVideoOnly);主流支持录制所有类型。 + * @return + * - 0: 正常 + * - -1: 参数设置异常 + * - -2: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 该方法需在进房后调用。 + * - 调用该方法后,你会收到 rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:{@link #ByteRTCEngineDelegate#rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:} 回调。 + * - 如果录制正常,系统每秒钟会通过 rtcEngine:onRecordingProgressUpdate:process:recording_info:{@link #ByteRTCEngineDelegate#rtcEngine:onRecordingProgressUpdate:process:recording_info:} 回调通知录制进度。 + * @list 高级功能 + */ + +- (int)startFileRecording: (ByteRTCRecordingConfig* _Nonnull)recordingConfig type:(ByteRTCRecordingType)recordingType NS_SWIFT_NAME(startFileRecording(withRecordingConfig:type:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 停止本地录制 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 startFileRecording:type:{@link #ByteRTCEngine#startFileRecording:type:} 开启本地录制后,你必须调用该方法停止录制。 + * - 调用该方法后,你会收到 rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:{@link #ByteRTCEngineDelegate#rtcEngine:onRecordingStateUpdate:state:error_code:recording_info:} 回调提示录制结果。 + * @list 高级功能 + */ + +- (int)stopFileRecording; +/** + * + * @type api + * @brief 开始音频录制,并生成录音文件保存到本地。 + * @param recordingConfig 参看 ByteRTCAudioRecordingConfig{@link #ByteRTCAudioRecordingConfig} + * @return + * - 0: 正常 + * - -2: 参数设置异常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note + * - 调用该方法后,会立即启动录制任务并创建录音文件。 + * - 录制包含各种音频效果。但不包含背景音乐。 + * - 录制本地麦克风的音频时,请确保已调用 startAudioCapture{@link #ByteRTCEngine#startAudioCapture} 接口打开麦克风采集。 + * - 调用 stopAudioRecording{@link #ByteRTCEngine#stopAudioRecording} 关闭录制。 + * - 加入房间前后均可调用。在进房前调用该方法,退房之后,录制任务不会自动停止,需调用 stopAudioRecording{@link #ByteRTCEngine#stopAudioRecording} 关闭录制。在进房后调用该方法,退房之后,录制任务会自动被停止。如果加入了多个房间,录制的文件中会包含各个房间的音频。 + * - 调用该方法后,你会收到 rtcEngine:onAudioRecordingStateUpdate:error_code:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioRecordingStateUpdate:error_code:} 回调。 + * @list 高级功能 + */ + +- (int)startAudioRecording:(ByteRTCAudioRecordingConfig* _Nonnull) recordingConfig; +/** + * + * @type api + * @brief 停止音频文件录制 + * @return + * - 0: 正常 + * - -3: 当前版本 SDK 不支持该特性,请联系技术支持人员 + * @note 调用 startAudioRecording:{@link #ByteRTCEngine#startAudioRecording:} 开启本地录制。 + * @list 高级功能 + */ + +- (int)stopAudioRecording; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音效播放器实例。 + * @return 音效播放器。详见 ByteRTCAudioEffectPlayer{@link #ByteRTCAudioEffectPlayer}。 + * @list 混音 + */ + +- (ByteRTCAudioEffectPlayer *_Nullable)getAudioEffectPlayer; + /** + * + * @valid since 3.53 + * @type api + * @brief 创建音乐播放器实例。 + * @param playerId 音乐播放器实例 id。取值范围为 `[0, 3]`。最多同时存在 4 个实例,超出取值范围时返回 nullptr。 + * @return 音乐播放器实例,详见 ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} + * @list 混音 + */ + +- (ByteRTCMediaPlayer *_Nullable)getMediaPlayer:(int)playerId; + +#pragma mark - Rtm +/** + * + * @type api + * @brief 登陆 RTS 服务器。
    + * 必须先登录,才能调用 sendUserMessageOutsideRoom:message:config:{@link #ByteRTCEngine#sendUserMessageOutsideRoom:message:config:} 和 sendServerMessage:{@link #ByteRTCEngine#sendServerMessage:} 发送房间外点对点消息和向应用服务器发送消息
    + * 在调用本接口登录后,如果想要登出,需要调用 logout{@link #ByteRTCEngine#logout} + * @param token 用户登录必须携带的 Token,用于鉴权验证。
    + * 测试时可使用[控制台](https: + * 正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token,`roomId` 置空,Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。 + * @param uid 用户 ID,在 appid 的维度下是唯一的。 + * @return + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 本地用户调用此方法登录后,会收到 rtcEngine:onLoginResult:errorCode:elapsed:{@link #ByteRTCEngineDelegate#rtcEngine:onLoginResult:errorCode:elapsed:} 回调通知登录结果,远端用户不会收到通知。 + * @list 消息 + */ + +- (int)login:(NSString * _Nonnull)token uid:(NSString * _Nonnull)uid; +/** + * + * @type api + * @brief 登出 RTS 服务器。
    + * 调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口登出前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录 + * - 本地用户调用此方法登出后,会收到 rtcEngine:onLogout:{@link #ByteRTCEngineDelegate#rtcEngine:onLogout:} 回调通知结果,远端用户不会收到通知。 + * @list 消息 + */ + +- (int)logout; +/** + * + * @type api + * @brief 更新用户用于登录的 Token
    + * Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
    + * 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 rtcEngine:onLoginResult:errorCode:elapsed:{@link #ByteRTCEngineDelegate#rtcEngine:onLoginResult:errorCode:elapsed:} 回调通知,错误码为 ByteRTCLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。 + * @param token
    + * 更新的动态密钥 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果 Token 无效导致登录失败,则调用此方法更新 Token 后,SDK 会自动重新登录,而用户不需要自己调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法。 + * - Token 过期时,如果已经成功登录,则不会受到影响。Token 过期的错误会在下一次使用过期 Token 登录时,或因本地网络状况不佳导致断网重新登录时通知给用户。 + * @list 消息 + */ + +- (int)updateLoginToken:(NSString * _Nonnull)token; +/** + * + * @type api + * @brief 设置应用服务器参数
    + * 客户端调用 sendServerMessage:{@link #ByteRTCEngine#sendServerMessage:} 或 sendServerBinaryMessage:{@link #ByteRTCEngine#sendServerBinaryMessage:} 发送消息给应用服务器之前,必须设置有效签名和应用服务器地址。 + * @param signature 动态签名,应用服务器可使用该签名验证消息来源。
    + * 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。
    + * 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 + * @param url 应用服务器的地址 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 用户必须调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 rtcEngine:onServerParamsSetResult:{@link #ByteRTCEngineDelegate#rtcEngine:onServerParamsSetResult:} 返回相应结果。 + * @list 消息 + */ + +- (int)setServerParams:(NSString * _Nonnull)signature url:(NSString * _Nonnull)url; +/** + * + * @type api + * @brief 查询对端用户或本端用户的登录状态 + * @param peerUserId
    + * 需要查询的用户 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 必须调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录后,才能调用本接口。 + * - 调用本接口后,SDK 会使用 rtcEngine:onGetPeerOnlineStatus:status:{@link #ByteRTCEngineDelegate#rtcEngine:onGetPeerOnlineStatus:status:} 回调通知查询结果。 + * - 在发送房间外消息之前,用户可以通过本接口了解对端用户是否登录,从而决定是否发送消息。也可以通过本接口查询自己的登录状态。 + * @list 消息 + */ + +- (int)getPeerOnlineStatus:(NSString * _Nonnull)peerUserId; +/** + * + * @type api + * @brief 给房间外指定的用户发送文本消息(P2P)。 + * @param userId 消息接收用户的 ID + * @param messageStr 发送的文本消息内容。消息不超过 64 KB。 + * @param config 消息类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外文本消息前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录。 + * - 用户调用本接口发送文本信息后,会收到一次 rtcEngine:onUserMessageSendResultOutsideRoom:error:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageSendResultOutsideRoom:error:} 回调,得知消息是否成功发送; + * - 若文本消息发送成功,则 userId 所指定的用户会通过 rtcEngine:onUserMessageReceivedOutsideRoom:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageReceivedOutsideRoom:message:} 回调收到该消息。 + * @list 消息 + */ + +- (NSInteger)sendUserMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSString * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; +/** + * + * @type api + * @brief 给房间外指定的用户发送二进制消息(P2P)。 + * @param userId 消息接收用户的 ID + * @param messageStr 发送的二进制消息内容。消息不超过 64KB。 + * @param config 消息类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在发送房间外二进制消息前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录。 + * - 用户调用本接口发送二进制消息后,会收到一次 rtcEngine:onUserMessageSendResultOutsideRoom:error:{@link #ByteRTCEngineDelegate#rtcEngine:onUserMessageSendResultOutsideRoom:error:} 回调,通知消息是否发送成功; + * - 若二进制消息发送成功,则 userId 所指定的用户会通过 rtcEngine:onUserBinaryMessageReceivedOutsideRoom:message:{@link #ByteRTCEngineDelegate#rtcEngine:onUserBinaryMessageReceivedOutsideRoom:message:} 回调收到该条消息。 + * @list 消息 + */ + +- (NSInteger)sendUserBinaryMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSData * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; +/** + * + * @type api + * @brief 客户端给应用服务器发送文本消息(P2Server)。 + * @param messageStr 发送的文本消息内容。消息不超过 64 KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送文本消息前,必须先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录,随后调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置应用服务器。 + * - 调用本接口后,会收到一次 rtcEngine:onServerMessageSendResult:error:message:{@link #ByteRTCEngineDelegate#rtcEngine:onServerMessageSendResult:error:message:} 回调,通知消息发送方是否发送成功。 + * - 若文本消息发送成功,则之前调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + +- (NSInteger)sendServerMessage:(NSString * _Nonnull)messageStr; +/** + * + * @type api + * @brief 客户端给应用服务器发送二进制消息(P2Server)。 + * @param messageStr 发送的二进制消息内容。消息不超过 64KB。 + * @return + * - >0:发送成功,返回这次发送消息的编号,从 1 开始递增。 + * - -1:发送失败。消息为空。 + * @note + * - 调用本接口前,请确保已在 RTC 控制台[启用 RTS 高级功能](https: + * > 若在 SDK 运行期间开启了该功能,则必须重新初始化引擎,配置才能生效。 + * - 在向应用服务器发送二进制消息前,先调用 login:uid:{@link #ByteRTCEngine#login:uid:} 完成登录,随后调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置应用服务器。 + * - 调用本接口后,会收到一次 rtcEngine:onServerMessageSendResult:error:message:{@link #ByteRTCEngineDelegate#rtcEngine:onServerMessageSendResult:error:message:} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则之前调用 setServerParams:url:{@link #ByteRTCEngine#setServerParams:url:} 设置的应用服务器会收到该条消息。 + * @list 消息 + */ + +- (NSInteger)sendServerBinaryMessage:(NSData * _Nonnull)messageStr; +/** + * + * @type api + * @brief 开始通话前网络探测 + * @param isTestUplink 是否探测上行带宽 + * @param expectedUplinkBitrate 期望上行带宽,单位:kbps
    范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @param isTestDownlink 是否探测下行带宽 + * @param expectedDownlinkBitrate 期望下行带宽,单位:kbps
    范围为 {0, [100-10000]},其中, `0` 表示由 SDK 指定最高码率。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 成功调用本接口后,会在 3s 内收到一次 rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter:{@link #ByteRTCEngineDelegate#rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter:} 回调,此后每 2s 会收到一次该回调,通知探测结果; + * - 若探测停止,则会收到一次 rtcEngine:onNetworkDetectionStopped:{@link #ByteRTCEngineDelegate#rtcEngine:onNetworkDetectionStopped:} 通知探测停止。 + * @list 网络管理 + */ + +- (int)startNetworkDetection:(bool)isTestUplink uplinkBandwidth:(int)expectedUplinkBitrate downlink:(bool)isTestDownlink downlinkBandwidth:(int)expectedDownlinkBitrate; +/** + * + * @type api + * @brief 停止通话前网络探测 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * 调用本接口后,会收到一次 rtcEngine:onNetworkDetectionStopped:{@link #ByteRTCEngineDelegate#rtcEngine:onNetworkDetectionStopped:} 通知探测停止。 + * @list 网络管理 + */ + +- (int)stopNetworkDetection; +#pragma mark ScreenAudio +/** + * + * @type api + * @brief 在屏幕共享时,设置屏幕音频的采集方式(内部采集/自定义采集) + * @param sourceType 屏幕音频输入源类型, 参看 ByteRTCAudioSourceType{@link #ByteRTCAudioSourceType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 默认采集方式是 RTC SDK 内部采集。 + * - 如果设定为内部采集,你必须重新开始采集。 + * - 如果设定为自定义采集,你必须再调用 pushScreenAudioFrame:{@link #ByteRTCEngine#pushScreenAudioFrame:} 将自定义采集到的屏幕音频帧推送到 RTC SDK。 + * - 无论是内部采集还是自定义采集,你都必须调用 publishScreenAudio: 将采集到的屏幕音频发布给远端。 + * @list 屏幕共享 + * @order 6 + */ + +- (int)setScreenAudioSourceType:(ByteRTCAudioSourceType)sourceType; + +/** + * + * @type api + * @brief 使用自定义采集方式,采集屏幕共享时的屏幕音频时,将音频帧推送至 RTC SDK 处进行编码等处理。 + * @param audioFrame 音频数据帧,参见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}
    + * - 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 samples × frame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return 方法调用结果
    + * - 0: 设置成功。 + * - < 0: 设置失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 调用此接口推送屏幕共享时的自定义采集的音频数据前,必须调用 setScreenAudioSourceType:{@link #ByteRTCEngine#setScreenAudioSourceType:} 开启屏幕音频自定义采集。 + * - 你应每隔 10 毫秒,调用一次此方法推送一次自定义采集的音频帧。一次推送的音频帧中应包含 frame.sample_rate / 100 个音频采样点。比如,假如采样率为 48000Hz,则每次应该推送 480 个采样点。 + * - 调用此接口将自定义采集的音频帧推送到 RTC SDK 后,你必须调用 publishScreenAudio: 将采集到的屏幕音频推送到远端。在调用 publishScreenAudio: 前,推送到 RTC SDK 的音频帧信息会丢失。 + * @list 屏幕共享 + * @order 9 + */ + +- (int) pushScreenAudioFrame:(ByteRTCAudioFrame* _Nonnull)audioFrame; + +#if BYTERTC_TARGET_MAC +/** + * + * @hidden(iOS) + * @type api + * @brief 在屏幕共享时,开始使用 RTC SDK 内部采集方式,采集屏幕音频 + * @param deviceId 虚拟设备 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 本接口仅对内部采集生效,RTC SDK 默认使用内部采集模块采集屏幕音频。若已调用 setScreenAudioSourceType:{@link #ByteRTCEngine#setScreenAudioSourceType:} 将音频输入源设置为 `ByteRTCAudioSourceTypeExternal` 自定义采集,需先切换为 `ByteRTCAudioSourceTypeInternal` 内部采集,否则该接口调用无效,并将触发 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 采集后,你还需要调用 publishScreenAudio: 将采集到的屏幕音频推送到远端。 + * - 要关闭屏幕音频内部采集,调用 stopScreenAudioCapture{@link #ByteRTCEngine#stopScreenAudioCapture}。 + * @list 屏幕共享 + */ + +- (int)startScreenAudioCapture:(NSString *_Nonnull)deviceId; +/** + * + * @hidden(iOS) + * @type api + * @brief 在屏幕共享时,停止使用 RTC SDK 内部采集方式,采集屏幕音频。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本接口时,采集模式应为内部模式。在外部采集模式下调用无效,并将触发 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:} 回调。 + * - 要开始屏幕音频内部采集,调用 startScreenAudioCapture:{@link #ByteRTCEngine#startScreenAudioCapture:}。 + * @list 屏幕共享 + */ + +- (int)stopScreenAudioCapture; +/** + * + * @hidden(iOS) + * @type api + * @brief 在屏幕共享时,设置屏幕音频流的声道数 + * @param channel 声道数,参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 当你调用 setScreenAudioStreamIndex: 并设置屏幕音频流和麦克风音频流混流时,此接口不生效,音频通道数由 setAudioProfile:{@link #ByteRTCEngine#setAudioProfile:} 控制。 + * @list 屏幕共享 + */ + +- (int)setScreenAudioChannel:(ByteRTCAudioChannel) channel; + +#endif + +#pragma mark EncodedVideo +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 设置向 SDK 输入的视频源,包括屏幕流
    + * 默认使用内部采集。内部采集指:使用 RTC SDK 内置的视频采集机制进行视频采集。 + * @param type 视频输入源类型,参看 ByteRTCVideoSourceType{@link #ByteRTCVideoSourceType} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法进房前后均可调用。 + * - 当你已调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部采集后,再调用此方法切换至自定义采集时,SDK 会自动关闭内部采集。 + * - 当你调用此方法开启自定义采集后,想要切换至内部采集,你必须先调用此方法关闭自定义采集,然后调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 手动开启内部采集。 + * - 当你需要向 SDK 推送自定义编码后的视频帧,你需调用该方法将视频源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + +- (int)setVideoSourceType:(ByteRTCVideoSourceType)type NS_SWIFT_NAME(setVideoSourceType(_:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册自定义编码帧推送事件回调 + * @param handler 自定义编码帧回调类,参看 ByteRTCExternalVideoEncoderEventHandler{@link #ByteRTCExternalVideoEncoderEventHandler} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法需在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + +- (int)setExternalVideoEncoderEventHandler:(id _Nullable)handler; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 推送自定义编码后的视频流 + * @param videoIndex 对应的编码流下标,从 0 开始,如果调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 设置了多路流,此处数量须与之保持一致 + * @param videoFrame 编码流视频帧信息,参看 ByteRTCEncodedVideoFrame{@link #ByteRTCEncodedVideoFrame}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 目前仅支持推送 H264 和 ByteVC1 格式的视频帧,且视频流协议格式须为 Annex B 格式。 + * - 该函数运行在用户调用线程内 + * - 推送自定义编码视频帧前,必须调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 将视频输入源切换至自定义编码视频源。 + * @list 自定义流处理 + */ + +- (int)pushExternalEncodedVideoFrame: (NSInteger)videoIndex + withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame NS_SWIFT_NAME(pushExternalEncodedVideoFrame(withVideoIndex:withEncodedVideoFrame:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之前,设置远端视频数据解码方式 + * @param streamId 远端流 ID。 + * @param config 视频解码方式,参看 ByteRTCVideoDecoderConfig{@link #ByteRTCVideoDecoderConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 当你想要对远端流进行自定义解码时,你需要先调用 registerRemoteEncodedVideoFrameObserver:{@link #ByteRTCEngine#registerRemoteEncodedVideoFrameObserver:} 注册远端视频流监测器,然后再调用该接口将解码方式设置为自定义解码。监测到的视频数据会通过 onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:{@link #ByteRTCRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:} 回调出来。 + * - 自 3.56 起,要用于自动订阅场景下,你可以设置 `streamId` 为特定值(若有对应逻辑),此时,通过此接口设置的解码方式根据 `streamId` 的相关逻辑,适用于所有的远端主流或屏幕流的解码方式。 + * @list 自定义流处理 + */ + +- (int)setVideoDecoderConfig:(NSString* _Nonnull)streamId + withVideoDecoderConfig:(ByteRTCVideoDecoderConfig)config NS_SWIFT_NAME(setVideoDecoderConfig(_:withVideoDecoderConfig:)); + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在订阅远端视频流之后,向远端请求关键帧 + * @param streamId 远端流 ID。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅适用于手动订阅模式,并且在成功订阅远端流之后使用。 + * - 该方法适用于调用 setVideoDecoderConfig:withVideoDecoderConfig:{@link #ByteRTCEngine#setVideoDecoderConfig:withVideoDecoderConfig:} 开启自定义解码功能后,并且自定义解码失败的情况下使用 + * @list 音视频传输 + */ + +- (int)requestRemoteVideoKeyFrame:(NSString* _Nonnull)streamId; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 注册远端编码后视频数据回调。
    + * 完成注册后,当 SDK 监测到远端编码后视频帧时,会触发 onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:{@link #ByteRTCRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:} 回调 + * @param observer 远端编码后视频数据监测器,参看 ByteRTCRemoteEncodedVideoFrameObserver{@link #ByteRTCRemoteEncodedVideoFrameObserver} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 更多自定义解码功能说明参看 [自定义视频编解码](https: + * - 该方法适用于手动订阅,并且进房前后均可调用,建议在进房前调用。 + * - 引擎销毁前需取消注册,调用该方法将参数设置为 nullptr 即可。 + * @list 自定义流处理 + */ + +- (int)registerRemoteEncodedVideoFrameObserver:(id _Nullable)observer NS_SWIFT_NAME(registerRemoteEncodedVideoFrameObserver(_:)); +#pragma mark StreamSyncInfo +/** + * + * @type api + * @brief 发送音频流同步信息。将消息通过音频流发送到远端,并实现与音频流同步,该接口调用成功后,远端用户会收到 rtcEngine:onStreamSyncInfoReceived:info:streamType:data:{@link #ByteRTCEngineDelegate#rtcEngine:onStreamSyncInfoReceived:info:streamType:data:} 回调。 + * @param data 消息内容。 + * @param config 媒体流信息同步的相关配置,详见 ByteRTCStreamSyncInfoConfig{@link #ByteRTCStreamSyncInfoConfig} 。 + * @return + * - >=0: 消息发送成功。返回成功发送的次数。 + * - -1: 消息发送失败。消息长度大于 255 字节。 + * - -2: 消息发送失败。传入的消息内容为空。 + * - -3: 消息发送失败。通过屏幕流进行消息同步时,此屏幕流还未发布。 + * - -4: 消息发送失败。通过用麦克风或自定义设备采集到的音频流进行消息同步时,此音频流还未发布,详见错误码 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @note + * - 调用本接口的频率建议不超过 50 次每秒。 + * - 在 `ByteRTCRoomProfileInteractivePodcast` 房间模式下,此消息一定会送达。在其他房间模式下,如果本地用户未说话,此消息不一定会送达。 + * @list 消息 + */ + +- (int)sendStreamSyncInfo:(NSData* _Nonnull)data config:(ByteRTCStreamSyncInfoConfig * _Nonnull)config; +/** + * + * @type api + * @brief 开启音视频回路测试。
    + * 在进房前,用户可调用该接口对音视频通话全链路进行检测,包括对音视频设备以及用户上下行网络的检测,从而帮助用户判断是否可以正常发布和接收音视频流。
    + * 开始检测后,SDK 会录制你的声音或视频。如果你在设置的延时范围内收到了回放,则视为音视频回路测试正常。 + * @param echoConfig 回路测试参数设置,参看 ByteRTCEchoTestConfig{@link #ByteRTCEchoTestConfig}。 + * @param delayTime 音视频延迟播放的时间间隔,用于指定在开始检测多长时间后期望收到回放。取值范围为 [2,10],单位为秒,默认为 2 秒。 + * @return 方法调用结果:
    + * - 0:成功 + * - -2:失败,参数异常 + * - -4:失败,用户已进房 + * - -6:失败,当前用户已经在检测中 + * - -7:失败,音视频均不检查 + * - -8:失败,已经存在相同 roomId 的房间 + * @note + * - 调用该方法开始音视频回路检测后,你可以调用 stopEchoTest{@link #ByteRTCEngine#stopEchoTest} 立即结束测试,也可等待测试 60s 后自动结束,以更换设备进行下一次测试,或进房。 + * - 在该方法之前调用的所有跟设备控制、流控制相关的方法均在开始检测时失效,在结束检测后恢复生效。 + * - 在调用 startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay:} 和 stopEchoTest{@link #ByteRTCEngine#stopEchoTest} 之间调用的所有跟设备采集、流控制、进房相关的方法均不生效,并会收到 rtcEngine:onWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onWarning:} 回调,提示警告码为 `ByteRTCWarningCodeInEchoTestMode`。 + * - 音视频回路检测的结果会通过 rtcEngine:onEchoTestResult:{@link #ByteRTCEngineDelegate#rtcEngine:onEchoTestResult:} 回调通知。 + * @list 网络管理 + */ + +- (int)startEchoTest:(ByteRTCEchoTestConfig *_Nullable)echoConfig playDelay:(NSInteger)delayTime; +/** + * + * @type api + * @brief 停止音视频回路测试。
    + * 调用 startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay:} 开启音视频回路检测后,你必须调用该方法停止检测。 + * @return 方法调用结果:
    + * - 0:成功 + * - -3:失败,未开启回路检测。 + * @note 音视频回路检测结束后,所有对系统设备及音视频流的控制均会恢复到开始检测前的状态。 + * @list 网络管理 + */ + +- (int)stopEchoTest; +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 在指定视频流上添加水印。 + * @param imagePath 水印图片路径,仅支持本地文件绝对路径,长度限制为 512 字节。
    + * 水印图片为 PNG 或 JPG 格式。 + * @param rtcWatermarkConfig 水印参数,参看 ByteRTCVideoWatermarkConfig{@link #ByteRTCVideoWatermarkConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - iOS 端,屏幕共享时,不支持调用该接口设置水印。 + * - 调用 clearVideoWatermark{@link #ByteRTCEngine#clearVideoWatermark} 移除指定视频流的水印。 + * - 同一视频流只能设置一个水印,新设置的水印会替换上一次的设置。你可以多次调用本方法来设置不同视频流的水印。 + * - 进入房间前后均可调用此方法。 + * - 若开启本地预览镜像,或开启本地预览和编码传输镜像,则远端水印均不镜像;在开启本地预览水印时,本端水印会镜像。 + * - 开启大小流后,水印对大小流均生效,且针对小流进行等比例缩小。 + * @list 视频处理 + */ + +- (int)setVideoWatermark: (NSString * _Nullable)imagePath + withRtcWatermarkConfig:(ByteRTCVideoWatermarkConfig* _Nonnull)rtcWatermarkConfig; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 移除指定视频流的水印。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 视频处理 + */ + +- (int)clearVideoWatermark; + +/** + * + * @type api + * @hiddensdk(audiosdk) + * @brief 截取本地视频画面 + * @param callback 本地截图的回调。参看 ByteRTCVideoSnapshotCallbackDelegate{@link #ByteRTCVideoSnapshotCallbackDelegate}。 + * @return 本地截图任务的编号,从 `1` 开始递增。 + * @note + * - 对截取的画面,包含本地视频处理的全部效果,包含旋转,镜像,美颜等。 + * - 不管采用 SDK 内部采集,还是自定义采集,都可以进行截图。 + * @list 高级功能 + */ + +- (NSInteger)takeLocalSnapshot:(id _Nullable)callback; +/** + * + * @type api + * @valid since 3.60. + * @brief 截取本地的视频流画面,生成 JPG 文件,并保存到本地指定路径。
    + * 调用该方法后,SDK 会触发回调 rtcEngine:onLocalSnapshotTakenToFile:filePath:width:height:errorCode:taskId:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalSnapshotTakenToFile:filePath:width:height:errorCode:taskId:} 报告截图是否成功,以及截取的图片信息。 + * @param filePath 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。示例:`/Users/YourName/Pictures/snapshot.jpg`。 + * @return 本地截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + +- (NSInteger)takeLocalSnapshotToFile:(NSString * _Nonnull)filePath; +/** + * + * @type api + * @brief 截取远端视频画面,并保存到本地指定路径。 + * @param streamId 截图的视频流对应的 ID。 + * @param callback 参看 ByteRTCVideoSnapshotCallbackDelegate{@link #ByteRTCVideoSnapshotCallbackDelegate}。 + * @return 远端截图任务的编号,从 `1` 开始递增。 + * @list 高级功能 + */ + +- (NSInteger)takeRemoteSnapshot:(NSString* _Nonnull)streamId callback:(id _Nullable)callback; + +/** + * + * @type api + * @valid since 3.60. + * @brief 截取远端的视频流画面,生成 JPG 文件,并保存到本地指定路径。
    + * 调用该方法后,SDK 会触发回调 rtcEngine:onRemoteSnapshotTakenToFile:info:filePath:width:height:errorCode:taskId:{@link #ByteRTCEngineDelegate#rtcEngine:onRemoteSnapshotTakenToFile:info:filePath:width:height:errorCode:taskId:} 报告截图是否成功,以及截取的图片信息。 + * @param streamId 待截取的远端视频流 ID。 + * @param filePath 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 `.jpg`,并请确保路径存在且可写。示例:`/Users/YourName/Pictures/snapshot.jpg`。 + * @return 远端截图任务的编号,从 `1` 开始递增。此编号可用于追踪任务状态或进行其他管理操作。 + * @list 高级功能 + */ + +- (NSInteger)takeRemoteSnapshotToFile:(NSString* _Nonnull)streamId filePath:(NSString * _Nonnull)filePath; + +/** + * + * @type api + * @brief 开启云代理 + * @param cloudProxiesInfo 云代理服务器信息列表。参看 ByteRTCCloudProxyInfo{@link #ByteRTCCloudProxyInfo}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在加入房间前调用此接口 + * - 在开启云代理后,进行通话前网络探测 + * - 开启云代理后,并成功连接云代理服务器后,会收到 rtcEngine:onCloudProxyConnected:{@link #ByteRTCEngineDelegate#rtcEngine:onCloudProxyConnected:}。 + * - 要关闭云代理,调用 stopCloudProxy{@link #ByteRTCEngine#stopCloudProxy}。 + * @list 通话加密 + */ + +- (int)startCloudProxy:(NSArray * _Nullable)cloudProxiesInfo; +/** + * + * @type api + * @brief 关闭云代理 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 要开启云代理,调用 startCloudProxy:{@link #ByteRTCEngine#startCloudProxy:} + * @list 通话加密 + */ + +- (int)stopCloudProxy; +/** + * + * @type api + * @hidden + * @brief 创建 K 歌评分管理接口。 + * @return K 歌评分管理接口,详见 ByteRTCSingScoringManager{@link #ByteRTCSingScoringManager}。 + * @note 如需使用 K 歌评分功能,即调用该方法以及 `ByteRTCSingScoringManager` 类下全部方法,需集成 SAMI 动态库,详情参看[按需集成插件](https: + * @list 在线 KTV + */ + +- (ByteRTCSingScoringManager *_Nullable)getSingScoringManager; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 摄像头处于关闭状态时,使用静态图片填充本地推送的视频流。
    + * 调用 `stopVideoCapture` 接口时,会开始推静态图片。若要停止发送图片,可传入空字符串或启用内部摄像头采集。
    + * 可重复调用该接口来更新图片。 + * @param filePath 设置静态图片的路径。
    + * 支持本地文件绝对路径,不支持网络链接,长度限制为 512 字节。
    + * 静态图片支持类型为 JPEG/JPG、PNG、BMP。
    + * 若图片宽高比与设置的编码宽高比不一致,图片会被等比缩放,黑边填充空白区域。推流帧率与码率与设置的编码参数一致。 + * @return + * - 0: 成功。 + * - -2: 失败。确保传入的 filePath 为有效路径。 + * - -12: 本方法不支持在 Audio SDK 中使用。 + * @note + * - 该接口只适用于 SDK 内部摄像头采集,不适用于自定义视频采集。 + * - 本地预览无法看到静态图片。 + * - 进入房间前后均可调用此方法。在多房间场景中,静态图片仅在发布的房间中生效。 + * - 针对该静态图片,滤镜和镜像效果不生效,水印效果生效。 + * - 只有主流能设置静态图片,屏幕流不支持设置。 + * - 开启大小流后,静态图片对大小流均生效,且针对小流进行等比例缩小。 + * @list 音视频传输 + */ + +- (int)setDummyCaptureImagePath:(NSString * _Nonnull)filePath; +/** + * + * @type api + * @brief 通过 NTP 协议,获取网络时间。 + * @return 网络时间。参看 ByteRTCNetworkTimeInfo{@link #ByteRTCNetworkTimeInfo}。 + * @note + * 第一次调用此接口会启动网络时间同步功能,并返回 `0`。同步完成后,会收到 rtcEngineOnNetworkTimeSynchronized:{@link #ByteRTCEngineDelegate#rtcEngineOnNetworkTimeSynchronized:},此后,再次调用此 API,即可获取准确的网络时间。 + * @list 网络管理 + */ + +- (ByteRTCNetworkTimeInfo *_Nonnull)getNetworkTimeInfo; +/** + * + * @type api + * @hidden internal use only + * @brief 在听众端,设置订阅的所有远端音频流精准对齐后播放。 + * @param streamId 作为对齐基准的远端音频流对应的id。
    + * 一般选择主唱的音频流。
    + * 你必须在收到 rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:},确认此音频流已发布后,调用此 API。 + * @param mode 是否对齐,默认不对齐。参看 ByteRTCAudioAlignmentMode{@link #ByteRTCAudioAlignmentMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 你必须在实时合唱场景下使用此功能。在加入房间时,所有人应设置 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 为 `ByteRTCRoomProfileChorus`。 + * - 订阅的所有远端流必须通过 startAudioMixing:filePath:config: 开启了背景音乐混音,并将 ByteRTCAudioMixingConfig 中的 `syncProgressToRecordFrame` 设置为 `true`。 + * - 如果订阅的某个音频流延迟过大,可能无法实现精准对齐。 + * - 合唱的参与者不应调用此 API,因为调用此 API 会增加延迟。如果希望从听众变为合唱参与者,应关闭对齐功能。 + * @list 在线 KTV + */ + +- (int)setAudioAlignmentProperty:(NSString* _Nonnull)streamId + withMode:(ByteRTCAudioAlignmentMode)mode; + +#pragma mark - KTV +/** + * + * @hidden + * @type api + * @brief 创建 KTV 管理接口。 + * @return KTV 管理接口,参看 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @list 在线 KTV + */ + +- (ByteRTCKTVManager * _Nullable)getKTVManager; +/** + * + * @type api + * @brief 开启通话前回声检测 + * @param testAudioFilePath 用于回声检测的音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。
    + * 音频文件不为静音文件,推荐时长为 10 ~ 20 秒。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败。上一次检测未结束,请先调用 stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} 停止检测 后重新调用本接口。 + * - -2:失败。路径不合法或音频文件格式不支持。 + * @note + * - 只有当 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 为 `ByteRTCRoomProfileMeeting` 和 `ByteRTCRoomProfileMeetingRoom` 时支持开启本功能。 + * - 开启检测前,你需要向用户获取音频设备的使用权限。 + * - 开启检测前,请确保音频设备没有被静音,采集和播放音量正常。 + * - 调用本接口后监听 rtcEngine:onHardwareEchoDetectionResult:{@link #ByteRTCEngineDelegate#rtcEngine:onHardwareEchoDetectionResult:} 获取检测结果。 + * - 检测期间,进程将独占音频设备,无法使用其他音频设备测试接口 startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay:}。 + * - 调用 stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} 停止检测,释放对音频设备的占用。 + * @list 音频管理 + */ + +- (int)startHardwareEchoDetection:(NSString * _Nonnull)testAudioFilePath; +/** + * + * @type api + * @brief 停止通话前回声检测 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败。 + * @note + * - 关于开启通话前回声检测,参看 startHardwareEchoDetection:{@link #ByteRTCEngine#startHardwareEchoDetection:} 。 + * - 建议在收到 rtcEngine:onHardwareEchoDetectionResult:{@link #ByteRTCEngineDelegate#rtcEngine:onHardwareEchoDetectionResult:} 通知的检测结果后,调用本接口停止检测。 + * - 在用户进入房间前结束回声检测,释放对音频设备的占用,以免影响正常通话。 + * @list 音频管理 + */ + +- (int)stopHardwareEchoDetection; +/** + * + * @hidden(macOS) + * @type api + * @hiddensdk(audiosdk) + * @brief 启用蜂窝网络辅助增强,改善通话质量。 + * @param config 参看 ByteRTCMediaTypeEnhancementConfig{@link #ByteRTCMediaTypeEnhancementConfig}。 + * @return 方法调用结果:
    + * - 0: 成功。 + * - -1:失败,内部错误。 + * - -2: 失败,输入参数错误。 + * @note 此功能默认不开启。 + * @list 网络管理 + */ + +- (int)setCellularEnhancement:(ByteRTCMediaTypeEnhancementConfig * _Nonnull)config; + /** + * + * @type api + * @brief 设置本地代理。 + * @param configurations 本地代理配置参数。参看 ByteRTCLocalProxyInfo{@link #ByteRTCLocalProxyInfo}。
    + * 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。
    + * 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 + * @note + * - 该方法需要在进房前调用。 + * - 调用该方法设置本地代理后,SDK 会触发 rtcEngine:onLocalProxyStateChanged:withProxyState:withProxyError:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalProxyStateChanged:withProxyState:withProxyError:} ,返回代理连接的状态。 + * @list 通话加密 + */ + +- (int)setLocalProxy:(NSArray * _Nonnull)configurations; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCEngineEx.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCEngineEx.h new file mode 100644 index 0000000..913c340 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCEngineEx.h @@ -0,0 +1,336 @@ +#import "ByteRTCEngine.h" +#import "rtc/ByteRTCVideoDefinesEx.h" + +@class ByteRTCEngineEx; +@class ByteRTCRoomEx; + +/** + * + * @type callback + * @brief ByteRTCEngineDelegateEx Class
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ +@protocol ByteRTCEngineDelegateEx +@optional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@end +/** + * + * @type api + * @brief ByteRTCEngineEx class + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCEngineEx : ByteRTCEngine +/** +* +* @type api +* @brief 创建 ByteRTCEngineEx 实例。
    +* 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    +* 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。 +* @param appId 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 +* @param delegate SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} 。 +* @param delegateEx SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegateEx{@link #ByteRTCEngineDelegateEx} 。 +* @param parameters 私有参数。如需使用请联系技术支持人员。 +* @return ByteRTCVideoEx:创建成功。返回一个可用的 ByteRTCEngineEx{@link #ByteRTCEngineEx} 实例 +*/ ++ (ByteRTCEngineEx* _Nullable)createRTCEngineEx:(ByteRTCEngineConfig * _Nonnull) config + delegate:(id _Nullable)delegate; + +/** +* +* @type api +* @brief 创建 ByteRTCEngineEx 实例。
    +* 如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
    +* 如果当前进程中已创建了引擎实例,再次调用此方法时,会返回新创建的引擎实例。 +* @param appId 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 +* @param delegate SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegate{@link #ByteRTCEngineDelegate} 。 +* @param delegateEx SDK 回调给应用层的 Callback 对象,详见 ByteRTCEngineDelegateEx{@link #ByteRTCEngineDelegateEx} 。 +* @param parameters 私有参数。如需使用请联系技术支持人员。 +* @return ByteRTCVideoEx:创建成功。返回一个可用的 ByteRTCEngineEx{@link #ByteRTCEngineEx} 实例 +*/ ++ (ByteRTCEngine* _Nullable)createRTCEngineExMulti:(ByteRTCEngineConfig* _Nonnull)config + delegate:(id _Nullable)delegate; + +/** + * + * @type api + * @brief 销毁由 ByteRTCEngineEx 实例,并释放所有相关资源。 + * @note + * + 请确保和需要销毁的 ByteRTCEngineEx 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 ByteRTCEngineEx 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 ByteRTCEngineEx 实例相关的内存,并且停止与媒体服务器的任何交互。
    + * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ ++ (void)destroyRTCEngineEx NS_SWIFT_NAME(destroyRTCVideoEx()); + + +/** + * + * @type api + * @brief 销毁由createRTCEngineExMulti:delegate:parameters::delegateEx:parameters{@link #ByteRTCEngineEx#createRTCEngineExMulti:delegate:parameters:delegateEx:parameters} ByteRTCEngineEx 实例,并释放所有相关资源。 + * @note + * + 请确保和需要销毁的 ByteRTCEngineEx 实例相关的业务场景全部结束后,才调用此方法。如果在多线程场景下,调用此接口后,又调用了其他 ByteRTCEngineEx 相关接口,可能导致 SDK 崩溃。该方法在调用之后,会销毁所有和此 ByteRTCEngineEx 实例相关的内存,并且停止与媒体服务器的任何交互。
    + * + 调用本方法会启动 SDK 退出逻辑。引擎线程会保留,直到退出逻辑完成。因此,不要在回调线程中直接调用此 API,会导致死锁。同时此方法是耗时操作,不建议在主线程调用本方法,避免主线程阻塞。 + */ ++ (void)destroyRTCEngineExMulti:(ByteRTCEngineEx*)engine; +/** + * + * @type api + * @brief 设置回调句柄。 + * @param delegateEx 参看 ByteRTCEngineDelegateEx{@link #ByteRTCEngineDelegateEx}。 + */ +- (void)setDelegateEx:(id _Nullable)delegateEx; +/** + * + * @type api + * @brief 创建 ByteRTCRoomEx{@link #ByteRTCRoomEx} 实例。
    + * 调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 才能真正地创建/加入房间。 + * @param roomId 标识通话房间的房间 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + * @return 创建的 ByteRTCRoomEx{@link #ByteRTCRoomEx} 房间实例。 + * @note 请勿使用同样的 roomId 创建多个房间,否则后创建的房间实例会替换先创建的房间实例。 + */ +- (ByteRTCRoomEx* _Nullable)createRTCRoomEx:(NSString* _Nonnull)roomId; +/** + * + * @type api + * @brief 设置视频源的相关配置。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param config 参看 ByteRTCVideoSourceConfig{@link #ByteRTCVideoSourceConfig}。 + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + */ +- (int)setVideoSource:(ByteRTCStreamIndex)streamIndex videoSourceConfig:(ByteRTCVideoSourceConfig* _Nonnull)config; +/** + * + * @type api + * @region 自定义流处理 + * @brief 推送外部视频帧。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param frame 该视频帧包含待 SDK 编码的视频数据,参考 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note 推送外部视频帧前,必须调用 setVideoSource:videoSourceConfig:{@link #ByteRTCEngineEx#setVideoSource:videoSourceConfig:} 开启外部视频源采集。 + */ +- (int)pushExternalVideoFrame:(ByteRTCStreamIndex)streamIndex videoFrame:(ByteRTCVideoFrameData* _Nonnull)frame; +/** + * + * @type api + * @brief 设置流的优先级。
    + * 在网络条件有限的情况下,优先保障高优先级视频流的清晰度和流畅度,优先保障高优先级流的音频流畅度和音质。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param priority 参看 ByteRTCStreamPriority{@link #ByteRTCStreamPriority}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setLocalStreamPriority:(ByteRTCStreamIndex)streamIndex priority:(ByteRTCStreamPriority)priority; +/** + * + * @type api + * @brief 设置 RTC SDK 内部采集时的视频采集参数。
    + * 如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数,包括模式、分辨率、帧率。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param captureConfig 视频采集参数。参看: ByteRTCVideoCaptureConfig{@link #ByteRTCVideoCaptureConfig}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 本接口在引擎创建后可调用,调用后立即生效。建议在调用 startVideoCapture:deviceId:{@link #ByteRTCEngineEx#startVideoCapture:deviceId:} 前调用本接口。
    + * + 如果调用本接口前使用内部模块开始视频采集,采集参数默认为 Auto 模式。 + */ +- (int)setVideoCaptureConfig:(ByteRTCStreamIndex)streamIndex + captureConfig:(ByteRTCVideoCaptureConfig* _Nullable)captureConfig; + +#if BYTERTC_TARGET_MAC +/** + * + * @type api + * @brief 立即开启内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 本地用户在非隐身状态下调用该方法后,房间中的其他用户会收到 rtcEngine:onUserStartVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartVideoCapture:info:} 的回调。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param deviceId 设备 ID + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 调用 stopVideoCapture:{@link #ByteRTCEngineEx#stopVideoCapture:} 可以停止内部视频采集。否则,只有当销毁引擎实例时,内部视频采集才会停止。
    + * + 创建引擎后,无论是否发布视频数据,你都可以调用该方法开启内部视频采集。只有当(内部或外部)视频采集开始以后视频流才会发布。
    + * + 如果需要从自定义视频采集切换为内部视频采集,你必须先关闭自定义采集,再调用此方法手动开启内部采集。 + */ +- (int)startVideoCapture:(ByteRTCStreamIndex)streamIndex deviceId:(NSString* _Nonnull)deviceId; +#endif +/** + * + * @type api + * @brief 立即关闭内部视频采集。默认为关闭状态。
    + * 内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
    + * 调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 的回调。
    + * 非隐身用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopVideoCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStopVideoCapture:info:} 的回调。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 调用 startVideoCapture:deviceId{@link #ByteRTCEngineEx#startVideoCapture:deviceId:} 可以开启内部视频采集。
    + * + 如果不调用本方法停止内部视频采集,则只有当销毁引擎实例时,内部视频采集才会停止。 + */ +- (int)stopVideoCapture:(ByteRTCStreamIndex)streamIndex; + +/** + * + * @type api + * @brief 设置音频源的整体音量。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param volume 音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。
    + * 只改变音频数据的音量信息,不涉及本端硬件的音量调节。
    + * 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 + * @return + * + 0: 调用成功。
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setAudioSourceVolume:(ByteRTCStreamIndex)streamIndex volume:(int)volume; +/** + * + * @type api + * @brief 设置音频源的内容。单个音频源的内容可以包含一个或多个原始音频来源。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param config 内容构成。参看 ByteRTCAudioContentTypeConfig{@link #ByteRTCAudioContentTypeConfig}。 + * @return + * + 0: 调用成功。
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setAudioContentType:(ByteRTCStreamIndex)streamIndex config:(ByteRTCAudioContentTypeConfig* _Nonnull)config; +/** + * + * @type api + * @brief 设置音频流的编码配置。 + * @param streamIndex 源对应的流的索引。参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param config 编码设置。参看 ByteRTCAudioEncodeConfig{@link #ByteRTCAudioEncodeConfig}。 + * @return + * + 0: 调用成功。
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + */ +- (int)setAudioEncodeConfig:(ByteRTCStreamIndex)streamIndex config:(ByteRTCAudioEncodeConfig* _Nonnull)config; + +/** +* +* @type api +* @brief 设置多路流编码配置,在开启simulcast功能下可同时设置4路分辨率的流 +* @param stream_index 视频流的索引。参看 StreamIndex{@link #StreamIndex}。 +* @param solutions 编码设置。参看 ByteRTCVideoEncoderConfig{@link #ByteRTCVideoEncoderConfig}。 +* @param solution_num 需要传入的solutions数组大小。 +* @return +* + 0: 调用成功。
    +* + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 +*/ +- (int)setVideoEncoderConfig:(ByteRTCStreamIndex)streamIndex config:(NSArray * _Nullable)videoSolutions; + +@end + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCGameRoom.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCGameRoom.h new file mode 100644 index 0000000..85f575c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCGameRoom.h @@ -0,0 +1,908 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room +*/ + +#import +#import "rtc/ByteRTCDefines.h" +#import "rtc/ByteRTCRangeAudio.h" + +@class ByteRTCGameRoom; +/** + * + * @type callback + * @brief 游戏房间事件回调接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCGameRoomDelegate +@optional + /** + * + * @hidden + * @type callback + * @brief 游戏房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - 1: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * - 2: 离开房间。 + * @param reason 房间状态发生变化的原因。参看 ByteRTCRoomStateChangeReason{@link #ByteRTCRoomStateChangeReason}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomStateChangedWithReason:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(ByteRTCRoomState)state + reason:(ByteRTCRoomStateChangeReason)reason; + + /** + * + * @type callback + * @brief 游戏房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 额外信息,如 `{"elapsed":1187,"join_type":0}`。
    + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。
    + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 到加入房间成功所经历的时间间隔,单位为 ms。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; + +/** + * + * @type callback + * @brief 音频流状态改变回调,发生流相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 流状态码,参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 附加信息,默认为空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onStreamStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; +/** + * + * @type callback + * @brief 离开游戏房间成功回调。
    + * 用户调用 leaveRoom{@link #ByteRTCGameRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并释放所有通话相关的音视频资源。SDK 完成所有的资源释放后通过此回调通知用户。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param stats 保留参数,目前为空。 + * @note + * - 用户调用 leaveRoom{@link #ByteRTCGameRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #ByteRTCGameRoom#destroy} 销毁房间实例方法销毁 RTC 引擎,则将无法收到此回调事件。 + * - 离开游戏房间结束通话后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用了导致 App 初始化音视频设备失败。 + * @list 房间管理 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onLeaveRoom:(ByteRTCRoomStats *_Nonnull)stats; + + /** + * + * @deprecated since 3.41 and will be deleted in later version, use rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:} and rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} instead. + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param warningCode 警告码,详见枚举类型 ByteRTCWarningCode{@link #ByteRTCWarningCode} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomWarning:(ByteRTCWarningCode)warningCode __deprecated_msg("Will be removed in new version"); +/** + * + * @type callback + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生改变时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param state 音视频同步状态,参看 ByteRTCAVSyncState{@link #ByteRTCAVSyncState}。 + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onAVSyncStateChange:(ByteRTCAVSyncState)state; +/** + * + * @type callback + * @region 房间管理 + * @brief 视频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 视频流 ID。 + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本端视频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onVideoPublishStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @brief 音频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 音频流 ID。 + * @param info 音频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本端音频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onAudioPublishStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @region 房间管理 + * @brief 屏幕流视频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 屏幕流视频发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenVideoPublishStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + + +/** + * + * @type callback + * @region 房间管理 + * @brief 屏幕流音频发布状态改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 屏幕流音频发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenAudioPublishStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @brief 视频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 视频流 ID。 + * @param info 视频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 视频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onVideoSubscribeStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @brief 音频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 音频流 ID. + * @param info 音频流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 音频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onAudioSubscribeStateChanged:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @brief 屏幕流视频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 屏幕流视频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenVideoSubscribeStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @brief 屏幕流音频订阅状态发生改变回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 屏幕流音频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onScreenAudioSubscribeStateChanged:(NSString *_Nonnull)roomId + userId:(nonnull NSString *)uid + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @region 多房间 + * @brief 房间内通话统计信息回调。
    + * 用户进房开始通话后,每 2s 收到一次本回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param stats 当前 ByteRTCGameRoom 统计数据,详见:ByteRTCRoomStats{@link #ByteRTCRoomStats}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomStats:(ByteRTCRoomStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRoomStats:)); +/** + * + * @hidden 仅内部使用 + * @type callback + * @region 多房间 + * @valid since 3.60. + * @brief 房间事件回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间事件状态。详见 ByteRTCRoomEvent{@link #ByteRTCRoomEvent}。 + * @param info 房间封禁时,包含封禁时间。详见 ByteRTCRoomEventInfo{@link #ByteRTCRoomEventInfo}。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRoomEvent:(NSString *_Nonnull)roomId uid:(NSString *_Nonnull)uid state:(ByteRTCRoomEvent)state info:(ByteRTCRoomEventInfo *_Nonnull)info; +/** + * + * @type callback + * @brief 本地流数据统计以及网络质量回调。
    + * 本地用户发布流成功后,SDK 会周期性(2s)地通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
    + * 统计信息通过 ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param stats 当前房间本地流数据统计。详见:ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onLocalStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info stats:(ByteRTCLocalStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onLocalStreamStats:)); +/** + * + * @type callback + * @brief 本地订阅的远端音/视频流数据统计以及网络质量回调。
    + * 本地用户订阅流成功后,SDK 会周期性(2s)地通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param stats 当前房间本地流数据统计。 详见:ByteRTCRemoteStreamStats{@link #ByteRTCRemoteStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onRemoteStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info stats:(ByteRTCRemoteStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRemoteStreamStats:)); +/** + * + * @type callback + * @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
    + * 1. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
    + * 2. 新进房用户会收到进房前已在房内的可见用户的进房回调通知。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type callback + * @brief 远端用户离开游戏房间,或切至不可见时,本地用户会收到此事件 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param uid 离开房间,或切至不可见的远端用户 ID。 + * @param reason 用户离开房间的原因:
    + * - 0: 远端用户调用 leaveRoom{@link #ByteRTCGameRoom#leaveRoom} 主动退出房间。 + * - 1: 远端用户因 Token 过期或网络原因等掉线。详细信息请参看[连接状态提示](https: + * - 3: 服务端调用 OpenAPI 将远端用户踢出房间。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCGameRoom *_Nonnull)rtcRoom onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason; +/** + * + * @type callback + * @brief 当 SDK 检测到 Token 的进房权限将在 30 秒内过期时,触发该回调。 + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 更新 Token 进房权限。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @list 引擎管理 + */ + +- (void)onTokenWillExpire:(ByteRTCGameRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 发布权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 更新 Token 发布权限。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @note Token 发布权限过期后: + * - 已发布流或尝试发布流时,本端会收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}、rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:}、rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:} 回调,提示`kPublishStateChangeReasonNoPublishPermission`,没有发布权限。 + * - 发布中的流将停止发布。远端用户会收到 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}、rtcRoom:onUserPublishScreenVideo:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenVideo:uid:isPublish:} 或 rtcRoom:onUserPublishScreenAudio:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenAudio:uid:isPublish:} 回调,提示该流已停止发布。 + * @list 引擎管理 + * @order 3 + */ + +- (void)onPublishPrivilegeTokenWillExpire:( ByteRTCGameRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 订阅权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 更新 Token 订阅权限有效期。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @note 若收到该回调后未及时更新 Token,Token 订阅权限过期后,尝试新订阅流会失败,已订阅的流会取消订阅,并且会收到 rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} 回调,提示错误码为 `-1003` 没有订阅权限。 + * @list 引擎管理 + */ + +- (void)onSubscribePrivilegeTokenWillExpire:( ByteRTCGameRoom *_Nonnull)rtcRoom; + /** + * + * @deprecated since 3.36 and will be deleted in later version, use rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}, rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}, rtcRoom:onUserPublishScreenVideo:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenVideo:uid:isPublish:}, and rtcRoom:onUserPublishScreenAudio:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenAudio:uid:isPublish:} instead. + * @type callback + * @brief 以下情况会触发此回调:
    + * - 房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调通知。 + * - 房间内的用户原音视频流被移出后,又重新发布音视频流时,房间内的其他用户会收到此回调通知。 + * - 用户刚加入房间时,会收到此回调,包含房间中所有已发布的流。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param stream 流属性,参看 ByteRTCStream{@link #ByteRTCStream} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onStreamAdd:(id _Nonnull)stream __deprecated_msg("Will be removed in new version"); + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in later version, use rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}, rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}, rtcRoom:onUserPublishScreenVideo:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenVideo:uid:isPublish:}, and rtcRoom:onUserPublishScreenAudio:uid:isPublish:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserPublishScreenAudio:uid:isPublish:} instead. + * @type callback + * @brief 房间内的远端用户停止发布音视频流时,本地用户会收到此回调通知。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 远端流来源的用户 ID 。 + * @param stream 流的属性,参看 ByteRTCStream{@link #ByteRTCStream}。 + * @param reason 远端流移除的原因,参看 ByteRTCStreamRemoveReason{@link #ByteRTCStreamRemoveReason} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onStreamRemove:(NSString *_Nonnull)uid + stream:(id _Nonnull)stream + reason:(ByteRTCStreamRemoveReason)reason + __deprecated_msg("Will be removed in new version"); + +/** + * + * @hidden for internal use only + * @type callback + * @region 多房间 + * @brief 当发布流成功的时候回调该事件 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param userId 用户 ID + * @param isScreen 该流是否是屏幕流
    + * + */ + + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onStreamPublishSuccess:(NSString *_Nonnull)userId isScreen:(BOOL)isScreen; + +/** + * + * @type callback + * @valid since 3.60. + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生错误时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param userId 用户 ID。 + * @param eventCode 音视频同步状态错误,参看 ByteRTCAVSyncEvent{@link #ByteRTCAVSyncEvent}。 + * @list 音视频传输 + * @order 1 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onAVSyncEvent:(NSString *_Nonnull)roomId userId:(NSString *_Nonnull)userId eventCode:(ByteRTCAVSyncEvent)eventCode; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布视频流的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishStreamVideo:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端音频流发布回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishStreamAudio:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端屏幕共享的视频流的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 远端流发布用户的用户 ID。 + * @param isPublish 为 true 代表已发布,为 false 代表已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishScreenVideo:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @region 房间管理 + * @brief 房间内远端屏幕共享的音频流的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param roomId 房间 ID。 + * @param uid 远端流发布用户的用户 ID。 + * @param isPublish 为 true 代表已发布,为 false 代表已取消发布。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCGameRoom* _Nonnull)rtcRoom onUserPublishScreenAudio:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid isPublish:(BOOL)isPublish; + /** + * + * @type callback + * @brief 广播文本消息回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户发来的点对点文本消息时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户发来的点对点二进制消息时,会收到此回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserMessageSendResult:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; + /** + * + * @type callback + * @brief 向房间内群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCRoomMessageSendResult{@link #ByteRTCRoomMessageSendResult} + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(NSInteger)msgid error:(ByteRTCRoomMessageSendResult)error; +/** + * + * @valid since 3.52. + * @type callback + * @brief 发送附加信息结果回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param taskId 本次调用的任务编号。 + * @param result 房间附加信息设置结果,详见 ByteRTCSetRoomExtraInfoResult{@link #ByteRTCSetRoomExtraInfoResult} + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onSetRoomExtraInfoResult:(NSInteger)taskId result:(ByteRTCSetRoomExtraInfoResult)result; +/** + * + * @valid since 3.52. + * @type callback + * @brief 接收到房间附加信息的回调。
    + * 另外用户加入房间成功后会收到这个房间全量附加信息 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param key 附加信息的键值 + * @param value 附加信息的内容 + * @param lastUpdateUserId 最后更新这条附加信息的用户编号 + * @param lastUpdateTimeMs 最后更新这条附加信息的 Unix 时间,时间精度是毫秒 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onRoomExtraInfoUpdate:(NSString *_Nonnull)key value:(NSString *_Nonnull)value lastUpdateUserId:(NSString *_Nonnull)lastUpdateUserId lastUpdateTimeMs:(NSInteger)lastUpdateTimeMs; +/** + * + * @valid since 3.54 + * @type callback + * @brief 设置用户可见性的回调。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param currentUserVisibility 当前用户的可见性。
    + * - YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @param errorCode 设置用户可见性错误码,参看 ByteRTCUserVisibilityChangeError{@link #ByteRTCUserVisibilityChangeError}。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onUserVisibilityChanged:(BOOL)currentUserVisibility errorCode:(ByteRTCUserVisibilityChangeError)errorCode; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param uid 被禁用/解禁的视频流用户 ID + * @param banned 视频流发送状态
    + * - true: 视频流发送被禁用 + * - false: 视频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁视频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onVideoStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户音频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCGameRoom` 实例 + * @param uid 被禁用/解禁的音频流用户 ID + * @param banned 音频流发送状态
    + * - true: 音频流发送被禁用 + * - false: 音频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁音频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 在控制台开启音频选路后,只有被封禁/解禁用户会收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音频管理 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onAudioStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; + +#pragma mark ForwardStream related callback + /** + * + * @type callback + * @brief 跨房间媒体流转发状态和错误回调 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param infos 跨房间媒体流转发目标房间信息数组,详见 ByteRTCForwardStreamStateInfo{@link #ByteRTCForwardStreamStateInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onForwardStreamStateChanged:(NSArray * _Nonnull)infos; + /** + * + * @type callback + * @brief 跨房间媒体流转发事件回调 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param infos 跨房间媒体流转发目标房间事件数组,详见 ByteRTCForwardStreamEventInfo{@link #ByteRTCForwardStreamEventInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCGameRoom * _Nonnull)rtcRoom onForwardStreamEvent:(NSArray * _Nonnull)infos; +/** + * + * @type callback + * @brief 加入房间并发布或订阅流后, 以每 2 秒一次的频率,报告本地用户和已订阅的远端用户的上下行网络质量信息。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param localQuality 本端网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @param remoteQualities 已订阅用户的网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @note 更多通话中的监测接口,详见[通话中质量监测](https: + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCGameRoom * _Nonnull)rtcRoom onNetworkQuality:(ByteRTCNetworkQualityStats *_Nonnull)localQuality remoteQualities:(NSArray *_Nonnull)remoteQualities; +/** + * + * @type callback + * @brief 字幕状态发生改变回调。
    + * 当用户调用 startSubtitle:{@link #ByteRTCRoom#startSubtitle:} 和 stopSubtitle{@link #ByteRTCRoom#stopSubtitle} 使字幕状态发生改变或出现错误时,触发该回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param state 字幕状态。参看 ByteRTCSubtitleState{@link #ByteRTCSubtitleState}。 + * @param errorCode 字幕任务错误码。参看 ByteRTCSubtitleErrorCode{@link #ByteRTCSubtitleErrorCode}。 + * @param errorMessage 第三方服务出现的错误。当因第三方服务出现错误,导致字幕状态改变时,用户可通过此参数获取具体的错误信息。如果不是因为第三方服务导致字幕状态改变,该字段为空。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onSubtitleStateChanged:(ByteRTCSubtitleState)state + errorCode:(ByteRTCSubtitleErrorCode)errorCode + errorMessage:(NSString *_Nonnull)errorMessage; +/** + * + * @type callback + * @brief 字幕相关内容回调。 + * @param rtcRoom ByteRTCGameRoom 实例。 + * @param subtitles 字幕消息内容。参看 ByteRTCSubtitleMessage{@link #ByteRTCSubtitleMessage}。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCGameRoom *_Nonnull)rtcRoom onSubtitleMessageReceived:(NSArray * _Nonnull)subtitles; +@end +/** + * + * @type api + * @list 房间管理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCGameRoom : NSObject +/** + * + * @type callback + * @list 房间管理 + */ + +@property(nonatomic, weak) id _Nullable delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 退出并销毁调用 createGameRoom:roomConfig:{@link #ByteRTCEngine#createGameRoom:roomConfig:} 所创建的房间实例。 + * @list 房间管理 + */ + +- (void)destroy; +/** + * + * @type api + * @brief 通过设置 ByteRTCGameRoom{@link #ByteRTCGameRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRoomDelegate{@link #ByteRTCRoomDelegate}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + +- (int)setRTCGameRoomDelegate:(id _Nullable)roomDelegate; +/** + * + * @type api + * @brief 加入游戏房间。
    + * 调用 createGameRoom:roomConfig:{@link #ByteRTCEngine#createGameRoom:roomConfig:} 创建房间后,调用此方法加入房间,同房间内其他用户进行音频通话。 + * @param token 动态密钥,用于对登录用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在您的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * - 使用不同 App ID 的 App 是不能互通的。 + * - 请务必保证生成 Token 使用的 App ID 和创建引擎时使用的 App ID 相同,否则会导致加入房间失败。 + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @return + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + * - 如果本端用户为可见用户,房间内其他用户收到 rtcRoom:onUserJoined:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserJoined:} 回调通知。 + * - -1:roomId / userInfo.uid 包含了无效的参数。 + * - -2:已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom:{@link #ByteRTCGameRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调告知。 + * @note + * - 同一个 App ID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后进房的用户会将先进房的用户踢出房间,并且先进房的用户会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,错误类型详见 ByteRTCErrorCode{@link #ByteRTCErrorCode} 中的 ByteRTCErrorCodeDuplicateLogin。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged:} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。 + * @list 房间管理 + */ + +- (int)joinRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type api + * @brief 离开游戏房间。
    + * 调用此方法结束通话过程,并释放所有通话相关的资源。 + * @return + * - 0: 调用成功。如果用户是房间内可见用户,触发以下回调: + * - 远端用户收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserLeave:reason:} 回调通知。 + * - 正在发布的流会被取消发布。远端用户收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}、rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:} 和/或 rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:} 回调通知。 + * - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 + * - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,必须调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 再次加入房间。 + * @list 房间管理 + */ + +- (int)leaveRoom NS_SWIFT_NAME(leaveRoom()); +/** + * + * @type api + * @brief 更新游戏房间 Token。
    + * 收到 onTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onTokenWillExpire:},onPublishPrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onPublishPrivilegeTokenWillExpire:},或 onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onSubscribePrivilegeTokenWillExpire:} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
    + * 如果 Token 无效,你会收到 rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:} ,错误码是 `-1010`。 + * @return + * - 0:成功; + * - !0:失败。 + * @note 请勿同时调用 updateToken:{@link #ByteRTCGameRoom#updateToken:} 和 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo:} 重新加入房间。 + * @list 房间管理 + */ + +- (int)updateToken:(NSString *_Nullable)token; +/** + * + * @type api + * @brief 获取游戏房间的范围语音接口实例。 + * @return 方法调用结果:
    + * - ByteRTCRangeAudio:成功,返回一个 ByteRTCRangeAudio{@link #ByteRTCRangeAudio} 实例。 + * - NULL:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + +- (ByteRTCRangeAudio *_Nullable)getRangeAudio; +/** + * + * @type api + * @brief 加入游戏房间后,调用该接口开启或关闭麦克风。同游戏房间其他用户会收到回调 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:}。 + * @param enable 是否开启麦克风:
    + * - true:开启麦克风,采集并发布音频流。 + * - false:默认设置。关闭麦克风,停止采集和发布音频流。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败。没有加入房间。 + * @note 不可与 enableAudioSend:{@link #ByteRTCGameRoom#enableAudioSend:} 同时调用。 + * @list 音频管理 + */ + +- (int)enableMicrophone:(BOOL)enable; +/** + * + * @type api + * @brief 加入游戏房间后,开启或关闭扬声器。 + * @param enable 是否开启扬声器:
    + * - true:开启扬声器。 + * - false:默认设置。关闭扬声器。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败。没有加入房间。 + * @list 音频管理 + */ + +- (int)enableSpeakerphone:(BOOL)enable; +/** + * + * @type api + * @brief 开始或停止发送音频流。调用此接口不影响音频采集。同游戏房间其他用户会收到相应的回调。 + * @param enable 是否发送音频流:
    + * - true:发布音频流。 + * - false:默认设置。停止发布音频流(不会关闭麦克风),即静音。 + * @return + * - 0:接口调用成功。 + * - -3:接口调用失败,未加入房间。 + * @note 不可与 enableMicrophone:{@link #ByteRTCGameRoom#enableMicrophone:} 同时调用。 + * @list 音频管理 + */ + +- (int)enableAudioSend:(BOOL)enable; +/** + * + * @type api + * @brief 是否订阅指定用户的音频流。 + * @param userId 用户 ID,最大长度为128字节的非空字符串。支持的字符集范围为:
    + * 1. 26个大写字母 A ~ Z
    + * 2. 26个小写字母 a ~ z
    + * 3. 10个数字 0 ~ 9
    + * 4. 下划线"_", at符"@", 减号"-" + * @param enable 是否订阅音频流:
    + * true:订阅指定用户的音频流。 + * false:默认设置。不订阅指定用户的音频流。 + * @return + * - 0:接口调用成功 + * - -2:传入的用户 ID 为空字符串。 + * @list 音频管理 + */ + +- (int)enableAudioReceive:(NSString* _Nullable)userId enable:(BOOL)enable; +/** + * + * @type api + * @brief 调节某个游戏房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
    + * - 该方法与 setRemoteAudioPlaybackVolume:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume:} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume:{@link #ByteRTCEngine#setPlaybackVolume:} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + +- (int)setRemoteRoomAudioPlaybackVolume:(NSInteger)volume; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRTSRoom.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRTSRoom.h new file mode 100644 index 0000000..61bba94 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRTSRoom.h @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCRTSRoom +*/ + +#import +#import "rtc/ByteRTCRtsDefines.h" +#import "rtc/ByteRTCDefines.h" + +@class ByteRTCRTSRoom; + +/** + * + * @type callback + * @brief RTS 房间事件回调接口 + */ + +@protocol ByteRTCRTSRoomDelegate +@optional + + /** + * + * @type callback + * @list 房间管理 + * @brief RTS 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtsRoom RTS 房间实例。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * + 0: 加入房间成功。
    + * + !0: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * @param extraInfo 额外信息,如 `{"elapsed":1187,"join_type":0}`。
    + * - `join_type` 表示加入房间的类型,`0`为首次进房,`1`为重连进房。
    + * - `elapsed` 表示加入房间耗时,即本地用户从调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 到加入 RTS 房间成功所经历的时间间隔,单位为 ms。 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomStateChanged:(NSString * _Nonnull)roomId + withUid:(nonnull NSString *)uid state:(NSInteger)state + extraInfo:(nonnull NSString *)extraInfo; + +/** + * + * @type callback + * @list 房间管理 + * @brief 离开 RTS 房间成功回调。
    + * 用户调用 leaveRoom{@link #ByteRTCRTSRoom#leaveRoom} 方法后,SDK 会停止房间内消息的收发,并在释放所有相关资源后,通过此回调通知用户离开房间成功。
    + * @param rtsRoom RTSRoom 对象。
    + * @param stats 保留参数,目前为空。 + * @note + * + 用户调用 leaveRoom{@link #ByteRTCRTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #ByteRTCRTSRoom#destroy} 销毁房间实例,则将无法收到此回调事件。
    + * + 离开房间结束通话后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用了导致 App 初始化音视频设备失败。
    + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onLeaveRoom:(ByteRTCRoomStats *_Nonnull)stats; + +/** + * + * @type callback + * @list 房间管理 + * @brief 远端用户首次进房,或断网后重新连入房间时,房间内其他用户将收到该事件。 + * @param rtsRoom ByteRTCRTSRoom 对象。
    + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type callback + * @brief 远端用户离开 RTS 房间时,本地用户会收到此事件。 + * @param rtsRoom ByteRTCRTSRoom 对象。
    + * @param uid 离开房间的远端用户 ID 。
    + * @param reason 用户离开房间的原因,参看 ByteRTCUserOfflineReason{@link #ByteRTCUserOfflineReason}。 + * @list 房间管理 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onUserLeave:(NSString * _Nonnull)uid + reason:(ByteRTCUserOfflineReason)reason; + +#pragma mark - Message Delegate Methods + /** + * + * @type callback + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRTSRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtsRoom ByteRTCRTSRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomMessageReceived:(NSString * _Nonnull)uid + message:(NSString * _Nonnull)message; + /** + * + * @type callback + * @brief 收到房间中调用 sendRoomBinaryMessage:{@link #ByteRTCRTSRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtsRoom ByteRTCRTSRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomBinaryMessageReceived:(NSString * _Nonnull)uid + message:(NSData * _Nonnull)message; + /** + * + * @type callback + * @brief 向房间内所有用户群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 + * @param rtsRoom ByteRTCRTSRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCRoomMessageSendResult{@link #ByteRTCRoomMessageSendResult} + * @note
    + * + 你应调用 sendRoomMessage:{@link #ByteRTCRTSRoom#sendRoomMessage:} 向房间内群发文本消息
    + * + 你应调用 sendRoomBinaryMessage:{@link #ByteRTCRTSRoom#sendRoomBinaryMessage:} 向房间内群发二进制消息 + * @list 消息 + */ + +- (void)rtsRoom:(ByteRTCRTSRoom * _Nonnull)rtsRoom onRoomMessageSendResult:(NSInteger)msgid + error:(ByteRTCRoomMessageSendResult)error; + + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; +/** + * + * @type callback + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRTSRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onRoomMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage:{@link #ByteRTCRTSRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onRoomBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtsRoom ByteRTCRoom 对象 + * @param msgid 消息编号. + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param rtsRoom ByteRTCRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @note + * - 你应调用 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 向房间内单个用户发送文本消息 + * - 你应调用 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 向房间内单个用户发送二进制消息 + * @list 消息 + */ + +- (void)rtsRoom:( ByteRTCRTSRoom *_Nonnull)rtsRoom onUserMessageSendResult:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; + + +@end + +/** + * + * @type api + * @brief RTS房间 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRTSRoom : NSObject +/** + * + * @type callback + */ + +@property(nonatomic, weak) id _Nullable delegateRts; + +/** + * + * @type api + * @list 房间管理 + * @brief 退出并销毁调用 createRTSRoom:{@link #ByteRTCEngine#createRTSRoom:} 所创建的 RTS 房间实例。 + */ + +- (void)destroy; + +/** + * + * @type api + * @list 房间管理 + * @brief 通过设置 ByteRTCRTSRoomDelegate{@link #ByteRTCRTSRoomDelegate}代理,可以监听此 `ByteRTCRTSRoom` 对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRTSRoomDelegate{@link #ByteRTCRTSRoomDelegate}。 + * @return
    + * + 0: 调用成功。 + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + */ + +- (int)setRTCRoomDelegateRts:(id _Nullable)roomDelegate; + + +/** + * + * @type api + * @brief 离开房间。
    + * 用户调用此方法离开房间,结束实时消息通信,释放所有通信相关的资源。 + * @return 方法调用结果。
    + * + 0: 方法调用成功
    + * + < 0: 方法调用失败
    + * @note
    + * + 可见的用户离开房间后,房间内其他用户会收到 rtsRoom:onUserLeave:reason:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserLeave:reason:} 回调通知;
    + * + 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtsRoom:OnLeaveRoom:{@link #ByteRTCRTSRoomDelegate#rtsRoom:OnLeaveRoom:} 回调通知。
    + * + 如果调用此方法后立即销毁引擎,SDK 将无法触发 rtsRoom:OnLeaveRoom:{@link #ByteRTCRTSRoomDelegate#rtsRoom:OnLeaveRoom:} 回调。 + * @list 房间管理 + */ + +- (int)leaveRoom; + +#pragma mark - Message Methods + + /** + * + * @type api + * @brief 给房间内的所有其他用户发送文本消息。 + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note
    + * + 在发送房间内文本消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。
    + * + 调用该函数后会收到一次 rtsRoom:onRoomMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败;
    + * + 若文本消息发送成功,则房间内远端用户会收到 rtsRoom:onRoomMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendRoomMessage:(NSString * _Nonnull)message; + /** + * + * @type api + * @brief 给房间内的所有其他用户发送二进制消息。 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note
    + * + 在房间内广播二进制消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。
    + * + 调用该函数后会收到一次 rtsRoom:onRoomMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败;
    + * + 若二进制消息发送成功,则房间内所有用户会收到 rtsRoom:onRoomBinaryMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomBinaryMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendRoomBinaryMessage:(NSData * _Nonnull)message; + +/** + * + * @type api + * @brief 更新 Token。
    + * 收到 onTokenWillExpire:{@link #ByteRTCRoomDelegate#onTokenWillExpire:},onPublishPrivilegeTokenWillExpire:{@link #ByteRTCRoomDelegate#onPublishPrivilegeTokenWillExpire:},或 onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCRoomDelegate#onSubscribePrivilegeTokenWillExpire:} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 + * @param token 重新获取的有效 Token。
    + * 如果 Token 无效,你会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:},错误码是 `-1010`。 + * @return + * - 0:成功; + * - !0:失败。 + * @note 请勿同时调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 和 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 重新加入房间。 + * @list 房间管理 + */ + +- (int)updateToken:(NSString *_Nullable)token; + + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点文本消息(P2P)。 + * @param userId 消息接收用户的 ID + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config
    + * 消息发送的可靠/有序类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig} + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内文本消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。 + * - 调用该函数后会收到一次 rtsRoom:onUserMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageSendResult:error:} 回调,通知消息发送方发送成功或失败。 + * - 若文本消息发送成功,则 uid 所指定的用户会收到 rtsRoom:onUserMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendUserMessage:(NSString *_Nonnull)userId message:(NSString *_Nonnull)message config:(ByteRTCMessageConfig)config; + /** + * + * @type api + * @brief 给房间内指定的用户发送点对点二进制消息(P2P)。 + * @param uid 消息接收用户的 ID + * @param message 发送的二进制消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @param config
    + * 消息发送的可靠/有序类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内二进制消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo:} 加入房间。 + * - 调用该函数后会收到一次 rtsRoom:onUserMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageSendResult:error:} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则 uid 所指定的用户会收到 rtsRoom:onUserBinaryMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserBinaryMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (int64_t)sendUserBinaryMessage:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message config:(ByteRTCMessageConfig)config; +/** + * + * @type api + * @brief 加入 RTS 房间。
    + * 调用 createRTSRoom:{@link #ByteRTCEngine#createRTSRoom:} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。 + * @param token 动态密钥,用于对进房用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * 使用不同 AppID 的 App 是不能互通的。
    + * 请务必保证生成 Token 使用的 AppID 和创建引擎时使用的 AppID 相同,否则会导致加入房间失败。 + * @param userInfo 用户信息。参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @return 方法调用结果。
    + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + * - -1: 参数无效 + * - -2: 已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调告知。 + * @note + * - 同一个 AppID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后加入房间的用户会将先加入房间的用户踢出房间,并且先加入房间的用户会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,错误类型为重复登录 ByteRTCErrorCodeDuplicateLogin。 + * - 本地用户调用此方法加入房间成功后,会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。若本地用户同时为可见用户,加入房间时远端用户会收到 rtsRoom:onUserJoined:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserJoined:} 回调通知。 + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged:} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo:}。 + * @list 房间管理 + */ + +- (int)joinRTSRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRoom.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRoom.h new file mode 100644 index 0000000..a529389 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRoom.h @@ -0,0 +1,1367 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room +*/ + +#import +#import "ByteRTCRTSRoom.h" +#import "rtc/ByteRTCRangeAudio.h" +#import "rtc/ByteRTCSpatialAudio.h" + +@class ByteRTCRoom; +/** + * + * @type callback + * @brief 房间事件回调接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCRoomDelegate +@optional + /** + * + * @hidden + * @type callback + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCAudioRoom 实例 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - 1: 加入房间失败、异常退房、发生房间相关的警告或错误。 + * - 2: 离开房间。 + * @param reason 房间状态发生变化的原因。参看 ByteRTCRoomStateChangeReason{@link #ByteRTCRoomStateChangeReason}。 + * @list 房间管理 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStateChangedWithReason:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(ByteRTCRoomState)state + reason:(ByteRTCRoomStateChangeReason)reason; + + /** + * + * @type callback + * @region 多房间 + * @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 + * @param rtcRoom ByteRTCAudioRoom 实例 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间状态码。
    + * - 0: 加入房间成功。 + * - !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 额外信息,如 `{"elapsed":1187,"join_type":0}`。
    + * `join_type`表示加入房间的类型,`0`为首次进房,`1`为重连进房。
    + * `elapsed`表示加入房间耗时,即本地用户从调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 到加入房间成功所经历的时间间隔,单位为 ms。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; + +/** + * + * @deprecated since 3.60, refer to [Upgrade Guide](https: + * @type callback + * @brief 流状态改变回调,发生流相关的警告或错误时会收到此回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 流状态码,参看 ByteRTCErrorCode{@link #ByteRTCErrorCode} 及 ByteRTCWarningCode{@link #ByteRTCWarningCode}。 + * @param extraInfo 附加信息,目前为空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onStreamStateChanged:(NSString *_Nonnull)roomId + withUid:(nonnull NSString *)uid + state:(NSInteger)state + extraInfo:(NSString *_Nonnull)extraInfo; +/** + * + * @type callback + * @region 多房间 + * @brief 离开房间成功回调。
    + * 用户调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并释放所有通话相关的音视频资源。SDK 完成所有的资源释放后通过此回调通知用户。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param stats 保留参数,目前为空。 + * @note + * - 用户调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #ByteRTCRoom#destroy} 销毁房间实例或 destroyRTCEngine{@link #ByteRTCEngine#destroyRTCEngine} 方法销毁 RTC 引擎,则将无法收到此回调事件。 + * - 离开房间结束通话后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用了导致 App 初始化音视频设备失败。 + * @list 房间管理 + * @order 2 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onLeaveRoom:(ByteRTCRoomStats *_Nonnull)stats; + + /** + * + * @hidden + * @deprecated since 3.41 and will be deleted in 3.51, use rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} and rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} instead. + * @type callback + * @brief 发生警告回调。
    + * SDK 运行时出现了警告。SDK 通常会自动恢复,警告信息可以忽略。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param warningCode 警告码,详见枚举类型 ByteRTCWarningCode{@link #ByteRTCWarningCode} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomWarning:(ByteRTCWarningCode)warningCode __deprecated_msg("Will be removed in new version"); +/** + * + * @type callback + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生改变时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param state 音视频同步状态,参看 ByteRTCAVSyncState{@link #ByteRTCAVSyncState}。 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAVSyncStateChange:(ByteRTCAVSyncState)state; +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 方法中的本地视频发布状态变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用该方法,请迁移至该回调。 + * @brief 本地视频流发布状态改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本地视频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onVideoPublishStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 方法中的本地音频流发布状态变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用该方法,请迁移至该回调。 + * @brief 本地音频流发布状态改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 发布状态码,参看 ByteRTCPublishState{@link #ByteRTCPublishState}。 + * @param reason 本地音频流发布状态改变的具体原因,参看 ByteRTCPublishStateChangeReason{@link #ByteRTCPublishStateChangeReason}。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAudioPublishStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCPublishState)state + reason:(ByteRTCPublishStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 和 `rtcRoom:onStreamSubscribed:userId:subscribeConfig:` 方法中的视频流订阅状态发生变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用这两个方法,请迁移至该回调。 + * @brief 视频流订阅状态发生改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 视频订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 后会收到该通知。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onVideoSubscribeStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `rtcRoom:onStreamStateChanged:withUid:state:extraInfo:` 和 `rtcRoom:onStreamSubscribed:userId:subscribeConfig:` 方法中的音频流订阅状态发生变更通知功能。如果你已升级至 3.60 及以上版本 SDK,且还在使用这两个方法,请迁移至该回调。 + * @brief 音频流订阅状态发生改变回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param state 订阅状态码,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState}。 + * @param reason 音频流订阅状态改变的具体原因,参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @note 当调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 后会收到该通知。 + * @list 音视频传输 + * @order 0 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAudioSubscribeStateChanged:(NSString *_Nonnull)streamId + info:(ByteRTCStreamInfo* _Nonnull)info + state:(ByteRTCSubscribeState)state + reason:(ByteRTCSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @region 多房间 + * @brief 房间内通话统计信息回调。
    + * 用户进房开始通话后,每 2s 收到一次本回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param stats 当前 ByteRTCRoom 统计数据,详见:ByteRTCRoomStats{@link #ByteRTCRoomStats} + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomStats:(ByteRTCRoomStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRoomStats:)); +/** + * + * @hidden + * @type callback + * @region 多房间 + * @valid since 3.60. + * @brief 房间事件回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param roomId 房间 ID。 + * @param uid 用户 ID。 + * @param state 房间事件状态。详见 ByteRTCRoomEvent{@link #ByteRTCRoomEvent}。 + * @param info 房间封禁时,包含封禁时间。详见 ByteRTCRoomEventInfo{@link #ByteRTCRoomEventInfo}。 + * @list 房间管理 + * @order 0 + */ + +- (void)rtcRoom:(ByteRTCRoom *_Nonnull)rtcRoom onRoomEvent:(NSString *_Nonnull)roomId uid:(NSString *_Nonnull)uid state:(ByteRTCRoomEvent)state info:(ByteRTCRoomEventInfo *_Nonnull)info; +/** + * + * @type callback + * @brief 本地流数据统计以及网络质量回调。
    + * 本地用户发布流成功后,SDK 会周期性(2s)地通过此回调事件通知用户发布的流在此次统计周期内的质量统计信息。
    + * 统计信息通过 ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} 类型的回调参数传递给用户,其中包括发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param stats 当前房间本地流数据统计。详见:ByteRTCLocalStreamStats{@link #ByteRTCLocalStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onLocalStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +stats:(ByteRTCLocalStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onLocalStreamStats:)); +/** + * + * @type callback + * @brief 本地订阅的远端音/视频流数据统计以及网络质量回调。
    + * 本地用户订阅流成功后,SDK 会周期性(2s)地通过此回调事件通知用户订阅的流在此次统计周期内的质量统计信息,包括:发送音视频比特率、发送帧率、编码帧率,网络质量等。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param stats 当前房间本地流数据统计。 详见:ByteRTCRemoteStreamStats{@link #ByteRTCRemoteStreamStats} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRemoteStreamStats:(NSString *_Nonnull)streamId +info:(ByteRTCStreamInfo* _Nonnull)info +stats:(ByteRTCRemoteStreamStats *_Nonnull)stats NS_SWIFT_NAME(rtcRoom(_:onRemoteStreamStats:)); +/** + * + * @type callback + * @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
    + * 1. 远端用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
    + * 2. 远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
    + * 3. 房间内隐身远端用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法切换至可见时,房间内其他用户将收到该事件。
    + * 4. 新进房用户会收到进房前已在房内的可见用户的进房回调通知。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param userInfo 用户信息,参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserJoined:(ByteRTCUserInfo *_Nonnull)userInfo; +/** + * + * @type callback + * @brief 远端用户离开 RTC 房间,或切至不可见时,本地用户会收到此事件 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param uid 离开房间,或切至不可见的远端用户 ID。 + * @param reason 用户离开房间的原因:
    + * - 0: 远端用户调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 主动退出房间。 + * - 1: 远端用户因 Token 过期或网络原因等掉线。详细信息请参看[连接状态提示](https: + * - 2: 远端用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 切换至不可见状态。 + * - 3: 服务端调用 OpenAPI 将远端用户踢出房间。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserLeave:(NSString *_Nonnull)uid reason:(ByteRTCUserOfflineReason)reason; +/** + * + * @type callback + * @brief 当 SDK 检测到 Token 的进房权限将在 30 秒内过期时,触发该回调。 + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 更新 Token 进房权限。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @list 引擎管理 + */ + +- (void)onTokenWillExpire:( ByteRTCRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 发布权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 更新 Token 发布权限。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @note Token 发布权限过期后: + * - 已发布流或尝试发布流时,本端会收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}回调,提示`kPublishStateChangeReasonNoPublishPermission`,没有发布权限。 + * - 发布中的流将停止发布。远端用户会收到 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调,提示该流已停止发布。 + * @list 引擎管理 + * @order 3 + */ + +- (void)onPublishPrivilegeTokenWillExpire:( ByteRTCRoom *_Nonnull)rtcRoom; +/** + * + * @type callback + * @brief Token 订阅权限过期前 30 秒将触发该回调。
    + * 收到该回调后,你需调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 更新 Token 订阅权限有效期。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @note 若收到该回调后未及时更新 Token,Token 订阅权限过期后,尝试新订阅流会失败,已订阅的流会取消订阅,并且会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 回调,提示错误码为 `-1003` 没有订阅权限。 + * @list 引擎管理 + */ + +- (void)onSubscribePrivilegeTokenWillExpire:( ByteRTCRoom *_Nonnull)rtcRoom; + /** + * + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}instead. + * @type callback + * @brief 以下情况会触发此回调:
    + * - 房间内的用户发布新的音视频流时,房间内的其他用户会收到此回调通知。 + * - 房间内的用户原音视频流被移出后,又重新发布音视频流时,房间内的其他用户会收到此回调通知。 + * - 用户刚加入房间时,会收到此回调,包含房间中所有已发布的流。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param stream 流属性,参看 ByteRTCStream{@link #ByteRTCStream} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onStreamAdd:(id _Nonnull)stream __deprecated_msg("Will be removed in new version"); + /** + * + * @hidden + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onUserUnpublishStream:type:reason: instead. + * @type callback + * @brief 房间内的远端用户停止发布音视频流时,本地用户会收到此回调通知。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 远端流来源的用户 ID 。 + * @param stream 流的属性,参看 ByteRTCStream{@link #ByteRTCStream}。 + * @param reason 远端流移除的原因,参看 ByteRTCStreamRemoveReason{@link #ByteRTCStreamRemoveReason} 。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onStreamRemove:(NSString *_Nonnull)uid + stream:(id _Nonnull)stream + reason:(ByteRTCStreamRemoveReason)reason + __deprecated_msg("Will be removed in new version"); + +/** + * + * @hidden for internal use only + * @type callback + * @region 多房间 + * @brief 当发布流成功的时候回调该事件 + * @param rtcRoom ByteRTCRoom 对象。 + * @param userId 用户 ID + * @param isScreen 该流是否是屏幕流
    + * + */ + + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onStreamPublishSuccess:(NSString *_Nonnull)userId isScreen:(BOOL)isScreen; + +/** + * + * @type callback + * @valid since 3.60. + * @brief 发布端调用 setMultiDeviceAVSync:{@link #ByteRTCRoom#setMultiDeviceAVSync:} 后音视频同步状态发生错误时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param roomId 房间 ID。 + * @param userId 用户 ID。 + * @param eventCode 音视频同步状态错误,参看 ByteRTCAVSyncEvent{@link #ByteRTCAVSyncEvent}。 + * @list 音视频传输 + * @order 1 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAVSyncEvent:(NSString *_Nonnull)roomId userId:(NSString *_Nonnull)userId eventCode:(ByteRTCAVSyncEvent)eventCode; + +/** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onUserPublishStream`、`onUserUnpublishStream`、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法。如果您已升级到 SDK 版本 3.60 或以上,且仍在使用这些方法,请迁移到该回调。 + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布视频流的回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:} 成功发布采集的视频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 订阅此流。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCRoom* _Nonnull)rtcRoom onUserPublishStreamVideo:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info isPublish:(BOOL)isPublish; + +/** + * + * @type callback + * @valid since 3.60. 自版本 3.60 起,该回调替换了 `onUserPublishStream`、`onUserUnpublishStream`、`onUserPublishScreen` 和 `onUserUnpublishScreen` 方法。如果您已升级到 SDK 版本 3.60 或以上,且仍在使用这些方法,请迁移到该回调。 + * @region 房间管理 + * @brief 房间内远端用户发布或取消发布音频流的回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param streamId 流 ID。 + * @param info 流信息。 + * @param isPublish 流是否发布。 + * + `true`:已发布。 + * + `false`:已取消发布。 + * @note 当房间内的远端用户调用 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:} 成功发布音频流时,本地用户会收到该回调,此时本地用户可以自行选择是否调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 订阅此流。 + * @list 音视频传输 + * @order 2 + */ + +- (void)rtcRoom:(ByteRTCRoom* _Nonnull)rtcRoom onUserPublishStreamAudio:(NSString* _Nonnull)streamId info:(ByteRTCStreamInfo* _Nonnull)info isPublish:(BOOL)isPublish; + + /** + * + * @type callback + * @brief > 该接口将于 3.64 onRoomMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageReceived:uid:message:} 代替。 + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief > 该接口将于 3.64 onRoomBinaryMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomBinaryMessageReceived:uid:message:} 代替。 + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage:{@link #ByteRTCRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onUserMessageReceived:uid:message:} 代替。 + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief > 该接口将于 3.64 被 onUserBinaryMessageReceived:uid:message:{@link #ByteRTCRoomDelegate#rtcRoom:onUserBinaryMessageReceived:uid:message:} 代替。 + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间中调用 sendRoomMessage:{@link #ByteRTCRoom#sendRoomMessage:} 发送的广播文本消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到房间内广播二进制消息的回调。
    + * 房间内其他用户调用 sendRoomBinaryMessage:{@link #ByteRTCRoom#sendRoomBinaryMessage:} 发送的广播二进制消息时,收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者 ID 。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 发来的点对点文本消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号。 + * @param uid 消息发送者的用户 ID。 + * @param message 收到的文本消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSString *_Nonnull)message; + /** + * + * @type callback + * @brief 收到来自房间中其他用户通过 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 发来的点对点二进制消息时,会收到此回调。 + * @param rtcRoom ByteRTCRoom 对象 + * @param msgid 消息编号. + * @param uid 消息发送者的用户 ID。 + * @param message 收到的二进制消息内容。 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserBinaryMessageReceived:(NSInteger)msgid uid:(NSString *_Nonnull)uid + message:(NSData *_Nonnull)message; + /** + * + * @type callback + * @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCUserMessageSendResult{@link #ByteRTCUserMessageSendResult} + * @note + * - 你应调用 sendUserMessage:message:config:{@link #ByteRTCRTSRoom#sendUserMessage:message:config:} 向房间内单个用户发送文本消息 + * - 你应调用 sendUserBinaryMessage:message:config:{@link #ByteRTCRTSRoom#sendUserBinaryMessage:message:config:} 向房间内单个用户发送二进制消息 + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserMessageSendResult:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; + /** + * + * @type callback + * @brief 调用 sendRoomMessage:{@link #ByteRTCRoom#sendRoomMessage:} 或 sendRoomBinaryMessage:{@link #ByteRTCRoom#sendRoomBinaryMessage:} 向房间内群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param msgid 本条消息的 ID。 + * @param error 消息发送结果,详见 ByteRTCRoomMessageSendResult{@link #ByteRTCRoomMessageSendResult} + * @list 消息 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(NSInteger)msgid error:(ByteRTCRoomMessageSendResult)error; +/** + * + * @valid since 3.52. + * @type callback + * @brief 调用 setRoomExtraInfo:value:{@link #ByteRTCRoom#setRoomExtraInfo:value:} 结果回调。 + * @param rtcRoom ByteRTCRoom 对象。 + * @param taskId 本次调用的任务编号。 + * @param result 设置房间附加信息结果,详见 ByteRTCSetRoomExtraInfoResult{@link #ByteRTCSetRoomExtraInfoResult} + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onSetRoomExtraInfoResult:(NSInteger)taskId result:(ByteRTCSetRoomExtraInfoResult)result; +/** + * + * @valid since 3.52. + * @type callback + * @brief 接收到房间附加信息的回调。
    + * 房间内其他用户调用 setRoomExtraInfo:value:{@link #ByteRTCRoom#setRoomExtraInfo:value:} 设置房间附加信息,收到此回调。
    + * 另外用户加入房间成功后会收到这个房间全量附加信息 + * @param rtcRoom ByteRTCRoom 对象。 + * @param key 附加信息的键值 + * @param value 附加信息的内容 + * @param lastUpdateUserId 最后更新这条附加信息的用户编号 + * @param lastUpdateTimeMs 最后更新这条附加信息的 Unix 时间,时间精度是毫秒 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomExtraInfoUpdate:(NSString *_Nonnull)key value:(NSString *_Nonnull)value lastUpdateUserId:(NSString *_Nonnull)lastUpdateUserId lastUpdateTimeMs:(NSInteger)lastUpdateTimeMs; + +/** + * + * @valid since 3.54 + * @type callback + * @brief 接收同一房间内,其他用户调用 setStreamExtraInfo:{@link #ByteRTCRoom#setStreamExtraInfo:} 设置的流附加信息的回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param streamId 流附加信息的流 ID + * @param streamInfo 流附加信息的流信息 + * @param extraInfo 流附加信息 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomStreamExtraInfoUpdate:(NSString *_Nonnull)streamId info:(ByteRTCStreamInfo *_Nonnull)streamInfo extraInfo:(NSString *_Nonnull)extraInfo; + +/** + * + * @valid since 3.54 + * @type callback + * @brief 用户调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 设置用户可见性的回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param currentUserVisibility 当前用户的可见性。
    + * - YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @param errorCode 设置用户可见性错误码,参看 ByteRTCUserVisibilityChangeError{@link #ByteRTCUserVisibilityChangeError}。 + * @list 房间管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onUserVisibilityChanged:(BOOL)currentUserVisibility errorCode:(ByteRTCUserVisibilityChangeError)errorCode; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户视频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param uid 被禁用/解禁的视频流用户 ID + * @param banned 视频流发送状态
    + * - true: 视频流发送被禁用 + * - false: 视频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁视频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onVideoStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; +/** + * + * @type callback + * @brief 通过调用服务端 BanUserStream/UnbanUserStream 方法禁用/解禁指定房间内指定用户音频流的发送时,触发此回调。 + * @param rtcRoom `ByteRTCRoom` 实例 + * @param uid 被禁用/解禁的音频流用户 ID + * @param banned 音频流发送状态
    + * - true: 音频流发送被禁用 + * - false: 音频流发送被解禁 + * @note + * - 房间内指定用户被禁止/解禁音频流发送时,房间内所有用户都会收到该回调。 + * - 若被封禁用户断网或退房后再进房,则依然是封禁状态,且房间内所有人会再次收到该回调。 + * - 指定用户被封禁后,房间内其他用户退房后再进房,会再次收到该回调。 + * - 在控制台开启音频选路后,只有被封禁/解禁用户会收到该回调。 + * - 同一房间解散后再次创建,房间内状态清空。 + * @list 音频管理 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onAudioStreamBanned:(NSString *_Nonnull)uid isBanned:(BOOL)banned; + +#pragma mark ForwardStream related callback + /** + * + * @type callback + * @brief 跨房间媒体流转发状态和错误回调 + * @param rtcRoom ByteRTCRoom 对象 + * @param infos 跨房间媒体流转发目标房间信息数组,详见 ByteRTCForwardStreamStateInfo{@link #ByteRTCForwardStreamStateInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onForwardStreamStateChanged:(NSArray * _Nonnull)infos; + /** + * + * @type callback + * @brief 跨房间媒体流转发事件回调 + * @param rtcRoom ByteRTCRoom 对象 + * @param infos 跨房间媒体流转发目标房间事件数组,详见 ByteRTCForwardStreamEventInfo{@link #ByteRTCForwardStreamEventInfo} + * @list 音视频传输 + */ + +- (void)rtcRoom:( ByteRTCRoom * _Nonnull)rtcRoom onForwardStreamEvent:(NSArray * _Nonnull)infos; +/** + * + * @type callback + * @brief 加入房间并发布或订阅流后, 以每 2 秒一次的频率,报告本地用户和已订阅的远端用户的上下行网络质量信息。 + * @param rtcRoom ByteRTCRoom 对象 + * @param localQuality 本端网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @param remoteQualities 已订阅用户的网络质量,详见 ByteRTCNetworkQualityStats{@link #ByteRTCNetworkQualityStats}。 + * @note 更多通话中的监测接口,详见[通话中质量监测](https: + * @list 音视频传输 + */ + +- (void)rtcRoom:(ByteRTCRoom * _Nonnull)rtcRoom onNetworkQuality:(ByteRTCNetworkQualityStats *_Nonnull)localQuality remoteQualities:(NSArray *_Nonnull)remoteQualities; +/** + * + * @type callback + * @brief 字幕状态发生改变回调。
    + * 当用户调用 startSubtitle:{@link #ByteRTCRoom#startSubtitle:} 和 stopSubtitle{@link #ByteRTCRoom#stopSubtitle} 使字幕状态发生改变或出现错误时,触发该回调。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param state 字幕状态。参看 ByteRTCSubtitleState{@link #ByteRTCSubtitleState}。 + * @param errorCode 字幕任务错误码。参看 ByteRTCSubtitleErrorCode{@link #ByteRTCSubtitleErrorCode}。 + * @param errorMessage 第三方服务出现的错误。当因第三方服务出现错误,导致字幕状态改变时,用户可通过此参数获取具体的错误信息。如果不是因为第三方服务导致字幕状态改变,该字段为空。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onSubtitleStateChanged:(ByteRTCSubtitleState)state + errorCode:(ByteRTCSubtitleErrorCode)errorCode + errorMessage:(NSString *_Nonnull)errorMessage; +/** + * + * @type callback + * @brief 字幕相关内容回调。
    + * 当用户调用 startSubtitle:{@link #ByteRTCRoom#startSubtitle:} 后会收到此回调,通知字幕的相关信息。 + * @param rtcRoom ByteRTCRoom 实例。 + * @param subtitles 字幕消息内容。参看 ByteRTCSubtitleMessage{@link #ByteRTCSubtitleMessage}。 + * @list 字幕翻译服务 + */ + +- (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onSubtitleMessageReceived:(NSArray * _Nonnull)subtitles; +@end +/** + * + * @type api + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoom : ByteRTCRTSRoom +/** + * + * @type callback + */ + +@property(nonatomic, weak) id _Nullable delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 退出并销毁调用 createRTCRoom:{@link #ByteRTCEngine#createRTCRoom:} 所创建的房间实例。 + * @list 房间管理 + */ + +- (void)destroy; +/** + * + * @valid since 3.53 + * @type api + * @brief 获取房间 ID。 + * @return 房间 ID。 + * @list 房间管理 + */ + +- (NSString *_Nonnull)getRoomId; +/** + * + * @type api + * @brief 通过设置 ByteRTCRoom{@link #ByteRTCRoom} 对象的事件句柄,监听此对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRoomDelegate{@link #ByteRTCRoomDelegate}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 房间管理 + */ + + +- (int)setRTCRoomDelegate:(id _Nullable)roomDelegate; +/** + * + * @type api + * @brief 加入 RTC 房间。
    + * 调用 createRTCRoom:{@link #ByteRTCEngine#createRTCRoom:} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。
    + * > 用户(包括后端机器人)成功进入 RTC 房间后便开始计费。即使房间内只有 1 个用户,也会计算音频计费时长。具体计费说明,请参见[音视频通话计费](69871)。 + * @param token 动态密钥,用于对进房用户进行鉴权验证。
    + * 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。Token 有效期及生成方式参看[使用 Token 完成鉴权](70121)。
    + * 使用不同 AppID 的 App 是不能互通的。
    + * 请务必保证生成 Token 使用的 AppID 和创建引擎时使用的 AppID 相同,否则会导致加入房间失败。 + * @param userInfo 用户信息。参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 + * @param userVisibility 用户可见性。建议在进房时将用户可见性都设置为 `false`,并在用户需要发送音视频流时再通过 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 设置为 `true`。从而避免因房间内用户达到数量上限所导致的进房失败。默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,其中最多 30 人可同时上麦,更多信息参看[用户和媒体流上限](https: + * @param roomConfig 房间参数配置,设置房间模式以及是否自动发布或订阅流。具体配置模式参看 ByteRTCRoomConfig{@link #ByteRTCRoomConfig}。 + * @return 方法调用结果。
    + * - 0: 成功。触发以下回调: + * - 本端收到房间状态通知 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + * - 本端收到本地流发布状态通知 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}。 + * - 本端收到流订阅状态通知 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。 + * - 本端收到房间内已发布流的通知 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:}。 + * - 如果本端用户为可见用户,房间内其他用户收到 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 回调通知。 + * - -1: 参数无效 + * - -2: 已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 + * 调用失败时,具体失败原因会通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调告知。 + * @note + * - 同一个 AppID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后加入房间的用户会将先加入房间的用户踢出房间,并且先加入房间的用户会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,错误类型为重复登录 ByteRTCErrorCodeDuplicateLogin。 + * - 本地用户调用此方法加入房间成功后,会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。若本地用户同时为可见用户,加入房间时远端用户会收到 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 回调通知。 + * - 房间内不可见用户的容量远远大于可见用户,而且用户默认可见,因此对于不参与互动的用户,你需要调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 更改为不可见用户。从而避免因房间内用户达到数量上限所导致的进房失败。默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,其中最多 30 人可同时上麦,更多信息参看[用户和媒体流上限](https: + * - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged:} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:}。 + * @list 房间管理 + */ + +- (int)joinRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo userVisibility:(BOOL)userVisibility roomConfig:(ByteRTCRoomConfig *_Nonnull)roomConfig NS_SWIFT_NAME(joinRoom(_:userInfo:userVisibility:roomConfig:)); +/** + * + * @type api + * @brief 设置用户可见性。未调用该接口前,本地用户默认对他人可见。
    + * 默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,最多 30 人可同时上麦。更多信息参看[用户和媒体流上限](https: + * @param enable 设置用户是否对房间内其他用户可见:
    + * - YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 + * - NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 + * @return + * - 0: 调用成功。 + * - < 0: 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * 设置用户可见性,会收到设置成功/失败回调 rtcRoom:onUserVisibilityChanged:errorCode:{@link #ByteRTCRoomDelegate#rtcRoom:onUserVisibilityChanged:errorCode:}。(v3.54 新增) + * - 在加入房间前设置用户可见性,若设置的可见性与默认值不同,将在加入房间时触发本回调。
    + * - 在加入房间后设置用户可见性,若可见性前后不同,会触发本回调。
    + * - 在断网重连后,若可见性发生改变,会触发本回调。
    + * @note + * - 在加入房间前后,用户均可调用此方法设置用户可见性。 + * - 在房间内,调用此方法成功切换用户可见性后,房间内其他用户会收到相应的回调。 + * - 从可见换至不可见时,房间内其他用户会收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:}。 + * - 从不可见切换至可见时,房间内其他用户会收到 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:}。 + * - 若调用该方法将可见性设为 `false`,此时尝试发布流会收到 `ByteRTCWarningCodeSubscribeStreamForbiden` 警告。 + * @list 房间管理 + */ + +- (int)setUserVisibility:(BOOL)enable; +/** + * + * @type api + * @brief 设置发流端音画同步。
    + * 当同一用户同时使用两个通话设备分别采集发送音频和视频时,有可能会因两个设备所处的网络环境不一致而导致发布的流不同步,此时你可以在视频发送端调用该接口,SDK 会根据音频流的时间戳自动校准视频流,以保证接收端听到音频和看到视频在时间上的同步性。 + * @param audioUserId 音频发送端的用户 ID,将该参数设为空则可解除当前音视频的同步关系。 + * @return + * - 0: 调用成功。调用该接口后音画同步状态发生改变时,你会收到 rtcRoom:onAVSyncStateChange:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncStateChange:} 回调。 + * - < 0 : 调用失败。监听 rtcRoom:onAVSyncEvent:userId:eventCode:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncEvent:userId:eventCode:} 获取错误详情。同一 RTC 房间内允许存在多个音视频同步关系,但需注意单个音频源不支持与多个视频源同时同步。 + * @note + * - 该方法在进房前后均可调用。 + * - 进行音画同步的音频发布用户 ID 和视频发布用户 ID 须在同一个 RTC 房间内。 + * - 如需更换同步音频源,再次调用该接口传入新的 `audioUserId` 即可;如需更换同步视频源,需先解除当前的同步关系,后在新视频源端开启同步。 + * @list 音视频传输 + */ + +- (int)setMultiDeviceAVSync:(NSString* _Nullable) audioUserId; +/** + * + * @type api + * @brief 离开 RTC 房间。
    + * 调用此方法结束通话过程,并释放所有通话相关的资源。 + * @return + * - 0: 调用成功。如果用户是房间内可见用户,触发以下回调: + * - 远端用户收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 回调通知。 + * - 正在发布的流会被取消发布。远端用户收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调通知。 + * - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 + * - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知。你必须在收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调后,再销毁房间或引擎,或调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 再次加入房间。 + * - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 将自身设为可见的用户离开房间后,房间内其他用户会收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 回调通知。 + * @list 房间管理 + */ + +- (int)leaveRoom NS_SWIFT_NAME(leaveRoom()); + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这些方法,请迁移到此接口。 + * @brief 发布/取消发布视频流。 + * @param publish 是否发布视频流。
    + * - true: 发布。 + * - false: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头视频流。 + * - 如果你需要发布麦克风采集到的音频流,调用 publishStreamAudio:{@link #ByteRTCRoom#publishStreamAudio:}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:}。 + * - 调用此方法后,房间中的所有远端用户会收到 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调通知,订阅了视频流的远端用户会收到 rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:} 回调。 + * @list 音视频传输 + */ + +- (int)publishStreamVideo:(BOOL)publish; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `publishStream`、`unpublishStream` 、`publishScreen` 和 `unpublishScreen` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用这些方法,请迁移到此接口。 + * @brief 发布/取消发布音频流。 + * @param publish 指定是否发布音频流。
    + * - true: 发布。 + * - false: 取消发布。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果你已经在用户进房时通过调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 成功选择了自动发布,则无需再调用本接口。 + * - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布音频流。 + * - 如果你需要发布摄像头采集到的视频流,调用 publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo:}。 + * - 如果你需要向多个房间发布流,调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:}。 + * - 调用此方法后,房间中的所有远端用户会收到 rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调通知,其中成功收到了音频流的远端用户会收到 rtcEngine:onFirstRemoteAudioFrame:info:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteAudioFrame:info:} 回调。 + * @list 音视频传输 + * @order 0 + */ + +- (int)publishStreamAudio:(BOOL)publish; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream` 和 `unsubscribeStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端视频流。 + * @param streamId 目标远端视频流 ID。 + * @param subscribe 指定是否订阅该视频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:} 回调获取当前房间里的远端摄像头流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用本方法取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:} 回调通知,具体异常原因参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 3 + */ + +- (int)subscribeStreamVideo:(NSString *_Nonnull)streamId subscribe:(BOOL)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeStream` 和 `unsubscribeStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内指定的远端音频流。 + * @param streamId 目标远端音频流 ID。 + * @param subscribe 指定是否订阅该音频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * - 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。 + * - 你必须先通过 rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调获取当前房间里的远端麦克风流信息,然后调用本方法按需订阅。 + * - 调用该方法后,你会收到 rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 回调通知,具体异常原因参看 ByteRTCSubscribeStateChangeReason{@link #ByteRTCSubscribeStateChangeReason}。 + * @list 音视频传输 + * @order 3 + */ + +- (int)subscribeStreamAudio:(NSString *_Nonnull)streamId subscribe:(BOOL)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅/取消订阅房间内所有远端视频流(通过摄像头采集的)。 + * @param subscribe 是否订阅所有远端视频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return + * 0: 方法调用成功
    + * !0: 方法调用失败 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:} 接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功调用本接口后,订阅关系将持续到调用 subscribeAllStreamsVideo:{@link #ByteRTCRoom#subscribeAllStreamsVideo:} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,具体异常原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @list 音视频传输 + */ + +- (int)subscribeAllStreamsVideo:(BOOL)subscribe; + + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `subscribeAllStreams` 和 `unsubscribeAllStreams` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用这两个方法,请迁移至该接口。 + * @brief 订阅或取消订阅所有远端音频流(通过麦克风采集的)。 + * @param subscribe 是否订阅所有远端音频流。
    + * - true: 订阅。 + * - false: 取消订阅。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 多次调用订阅接口时,将根据末次调用接口和传入的参数,更新订阅配置。 + * - 开启音频选路后,如果房间内的媒体流超过上限,建议通过调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 接口逐一指定需要订阅的媒体流。 + * - 调用该方法后,你会收到 rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:} 通知方法调用结果。 + * - 成功订阅远端用户的媒体流后,订阅关系将持续到调用 subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 取消订阅或本端用户退房。 + * - 关于其他调用异常,你会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调通知,具体异常原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + * @list 音视频传输 + */ + +- (int)subscribeAllStreamsAudio:(BOOL)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #ByteRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + +- (int)pauseAllSubscribedStreamVideo; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `pauseAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 暂停接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅暂停远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * - 若想恢复接收远端流,需调用 resumeAllSubscribedStreamVideo{@link #ByteRTCRoom#resumeAllSubscribedStreamVideo}。 + * - 多房间场景下,仅暂停接收发布在当前所在房间的流。 + * @list 音视频传输 + */ + +- (int)pauseAllSubscribedStreamAudio; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端视频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + +- (int)resumeAllSubscribedStreamVideo; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `resumeAllSubscribedStream` 方法来实现下述功能。如果你已升级至 3.60 及以上版本,且仍在使用该方法,请迁移至该接口。 + * @brief 恢复接收所有远端音频流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 该方法仅恢复远端流的接收,并不影响远端流的采集和发送; + * - 该方法不改变用户的订阅状态以及订阅流的属性。 + * @list 音视频传输 + */ + +- (int)resumeAllSubscribedStreamAudio; + + /** + * + * @type api + * @brief 给房间内的所有其他用户群发文本消息。 + * @param message 发送的文本消息内容。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在发送房间内文本消息前,必须先调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 调用该函数后会收到一次 rtcRoom:onRoomMessageSendResult:error:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败; + * - 若文本消息发送成功,则房间内所有远端用户会收到 rtcRoom:onRoomMessageReceived:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (NSInteger)sendRoomMessage:(NSString *_Nonnull)message NS_SWIFT_NAME(sendRoomMessage(_:)); + /** + * + * @type api + * @brief 给房间内的所有其他用户群发二进制消息。 + * @param message 用户发送的二进制广播消息。默认单次发送的消息内容包大小为 1 KB,如需更大的包传递(最大不可超过 64 KB),需[在控制台启用 RTS 高级功能](https: + * @return 这次发送消息的编号,从 1 开始递增。 + * @note + * - 在房间内广播二进制消息前,必须先调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 调用该函数后会收到一次 rtcRoom:onRoomMessageSendResult:error:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomMessageSendResult:error:} 回调,通知消息发送方发送成功或失败; + * - 若二进制消息发送成功,则房间内所有用户会收到 rtcRoom:onRoomBinaryMessageReceived:message:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomBinaryMessageReceived:message:} 回调。 + * @list 消息 + */ + +- (NSInteger)sendRoomBinaryMessage:(NSData * _Nonnull)message NS_SWIFT_NAME(sendRoomBinaryMessage(_:)); + +#pragma mark ForwardStream + /** + * + * @type api + * @brief 开始跨房间转发媒体流。
    + * 在调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 后调用本接口,实现向多个房间转发媒体流,适用于跨房间连麦等场景。 + * @param configurations 跨房间媒体流转发指定房间的信息。参看 ByteRTCForwardStreamConfiguration{@link #ByteRTCForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 rtcRoom:onForwardStreamStateChanged:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamStateChanged:} 回调。 + * - 调用本方法后,你可以通过监听 rtcRoom:onForwardStreamEvent:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamEvent:} 回调来获取各个目标房间在转发媒体流过程中的相关事件。 + * - 开始转发后,目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 和发流 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调。 + * - 调用本方法后,可以调用 updateForwardStreamToRooms:{@link #ByteRTCRoom#updateForwardStreamToRooms:} 更新目标房间信息,例如,增加或减少目标房间等。 + * - 调用本方法后,可以调用 stopForwardStreamToRooms{@link #ByteRTCRoom#stopForwardStreamToRooms} 停止向所有房间转发媒体流。 + * - 调用本方法后,可以调用 pauseForwardStreamToAllRooms{@link #ByteRTCRoom#pauseForwardStreamToAllRooms} 暂停向所有房间转发媒体流。 + * @list 音视频传输 + */ + +- (int)startForwardStreamToRooms:(NSArray * _Nullable)configurations NS_SWIFT_NAME(startForwardStreamToRooms(_:)); + /** + * + * @type api + * @brief 更新跨房间媒体流转发信息。
    + * 通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 发起媒体流转发后,可调用本方法增加或者减少目标房间,或更新房间密钥。
    + * 调用本方法增加或删减房间后,将在本端触发 rtcRoom:onForwardStreamStateChanged:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamStateChanged:} 回调,包含发生了变动的目标房间中媒体流转发状态。 + * @param configurations 跨房间媒体流转发目标房间信息。参看 ByteRTCForwardStreamConfiguration{@link #ByteRTCForwardStreamConfiguration}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * 增加或删减目标房间后,新增目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 和发布 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调。 + * @list 音视频传输 + */ + +- (int)updateForwardStreamToRooms:(NSArray * _Nullable)configurations NS_SWIFT_NAME(updateForwardStreamToRooms(_:)); +/** + * + * @type api + * @brief 停止跨房间媒体流转发。
    + * 通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 发起媒体流转发后,可调用本方法停止向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 调用本方法后,将在本端触发 rtcRoom:onForwardStreamStateChanged:{@link #ByteRTCRoomDelegate#rtcRoom:onForwardStreamStateChanged:} 回调。 + * - 调用本方法后,原目标房间中的用户将接收到本地用户停止发布 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调和退房 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 的回调。 + * - 如果需要更改目标房间,请调用 updateForwardStreamToRooms:{@link #ByteRTCRoom#updateForwardStreamToRooms:} 更新房间信息。 + * - 如果需要暂停转发,请调用 pauseForwardStreamToAllRooms{@link #ByteRTCRoom#pauseForwardStreamToAllRooms},并在之后随时调用 resumeForwardStreamToAllRooms{@link #ByteRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @list 音视频传输 + */ + +- (int)stopForwardStreamToRooms; +/** + * + * @type api + * @brief 暂停跨房间媒体流转发。
    + * 通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 发起媒体流转发后,可调用本方法暂停向所有目标房间转发媒体流。
    + * 调用本方法暂停向所有目标房间转发后,你可以随时调用 resumeForwardStreamToAllRooms{@link #ByteRTCRoom#resumeForwardStreamToAllRooms} 快速恢复转发。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note 调用本方法后,目标房间中的用户将接收到本地用户停止发布 rtcRoom:onUserPublishStreamVideo:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamVideo:info:isPublish:}、rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish:} 回调和退房 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason:} 的回调。 + * @list 音视频传输 + * @order 13 + */ + +- (int)pauseForwardStreamToAllRooms; +/** + * + * @type api + * @brief 恢复跨房间媒体流转发。
    + * 调用 pauseForwardStreamToAllRooms{@link #ByteRTCRoom#pauseForwardStreamToAllRooms} 暂停转发之后,调用本方法恢复向所有目标房间转发媒体流。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * 目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 和发布 rtcRoom:onUserJoined:{@link #ByteRTCRoomDelegate#rtcRoom:onUserJoined:} 的回调。 + * @list 音视频传输 + */ + +- (int)resumeForwardStreamToAllRooms; +/** + * + * @type api + * @brief 获取范围语音接口实例。 + * @return 方法调用结果:
    + * - ByteRTCRangeAudio:成功,返回一个 ByteRTCRangeAudio{@link #ByteRTCRangeAudio} 实例。 + * - NULL:失败,当前 SDK 不支持范围语音功能。 + * @note 首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见[范围语音](https: + * @list 高级功能 + */ + +- (ByteRTCRangeAudio *_Nullable)getRangeAudio; +/** + * + * @type api + * @brief 获取空间音频接口实例。 + * @return 方法调用结果:
    + * - ByteRTCSpatialAudio:成功,返回一个 ByteRTCSpatialAudio{@link #ByteRTCSpatialAudio} 实例。 + * - NULL:失败,当前 SDK 不支持空间音频功能。 + * @note + * - 首次调用该方法须在创建房间后、加入房间前。 空间音频相关 API 和调用时序详见[空间音频](https: + * - 只有在使用支持真双声道播放的设备时,才能开启空间音频效果; + * - 机型性能不足可能会导致音频卡顿,使用低端机时,不建议开启空间音频效果; + * - SDK 最多支持 30 个用户同时开启空间音频功能。 + * @list 高级功能 + */ + +- (ByteRTCSpatialAudio *_Nullable)getSpatialAudio; +/** + * + * @type api + * @brief 调节某个房间内所有远端用户的音频播放音量。 + * @param volume 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。
    + * - 0: 静音 + * - 100: 原始音量,默认值 + * - 400: 最大可为原始音量的 4 倍(自带溢出保护) + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 假设某远端用户 A 始终在被调节的目标用户范围内,
    + * - 该方法与 setRemoteAudioPlaybackVolume:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume:} 互斥,最新调用的任一方法设置的音量将覆盖此前已设置的音量,效果不叠加; + * - 当该方法与 setPlaybackVolume:{@link #ByteRTCEngine#setPlaybackVolume:} 方法共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。 + * @list 音频管理 + */ + +- (int)setRemoteRoomAudioPlaybackVolume:(NSInteger)volume; +/** + * + * @valid since 3.52. + * @type api + * @brief 设置本端发布流在音频选路中的优先级。 + * @param audioSelectionPriority 本端发布流在音频选路中的优先级,默认正常参与音频选路。参见 ByteRTCAudioSelectionPriority{@link #ByteRTCAudioSelectionPriority}。 + * @note + * 在控制台上为本 appId 开启音频选路后,调用本接口才会生效。进房前后调用均可生效。更多信息参见[音频选路](https: + * 如果本端用户同时加入不同房间,使用本接口进行的设置相互独立。 + * @list 音频管理 + */ + +- (int)setAudioSelectionConfig:(ByteRTCAudioSelectionPriority)audioSelectionPriority; +/** + * + * @valid since 3.52. + * @type api + * @brief 设置/更新房间附加信息,可用于标识房间状态或属性,或灵活实现各种业务逻辑。 + * @param key 房间附加信息键值,长度小于 10 字节。
    + * 同一房间内最多可存在 5 个 key,超出则会从第一个 key 起进行替换。 + * @param value 房间附加信息内容,长度小于 128 字节。 + * @return + * - 0: 方法调用成功,返回本次调用的任务编号; + * - <0: 方法调用失败,具体原因详见 ByteRTCSetRoomExtraInfoResult{@link #ByteRTCSetRoomExtraInfoResult}。 + * @note + * - 在设置房间附加信息前,必须先调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 加入房间。 + * - 调用该方法后,会收到一次 rtcRoom:onSetRoomExtraInfoResult:result:{@link #ByteRTCRoomDelegate#rtcRoom:onSetRoomExtraInfoResult:result:} 回调,提示设置结果。 + * - 调用该方法成功设置附加信息后,同一房间内的其他用户会收到关于该信息的回调 rtcRoom:onRoomExtraInfoUpdate:value:lastUpdateUserId:lastUpdateTimeMs:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomExtraInfoUpdate:value:lastUpdateUserId:lastUpdateTimeMs:}。 + * - 新进房的用户会收到进房前房间内已有的全部附加信息通知。 + * @list 房间管理 + */ + +- (NSInteger)setRoomExtraInfo:(NSString *_Nonnull)key value:(NSString *_Nonnull)value; + +/** + * + * @type api + * @region 流管理 + * @brief 设置当前推流的流附加信息。 + * @param extra_info 流附加信息。长度不超过1024的字符串。 + * @return 方法调用结果:
    + * + 0:成功;
    + * + !0:失败。 + * @note + * + 可通过此函数设置当前推流的流附加信息。流附加信息是流 ID 的附加信息标识,不同于流 ID 在推流过程中不可修改,流附加信息可以在对应流 ID 的推流中途修改。开发者可根据流附加信息来实现流 ID 相关的可变内容的同步。 + * + 该方法在进房前后均可调用 + * + 相同房间内的其他用户会通过 [onRoomStreamExtraInfoUpdate] 回调函数获得通知。 + * @list 音视频传输 + */ + +- (NSInteger)setStreamExtraInfo:(NSString *_Nonnull)extra_info; + +/** + * + * @valid since 3.52 + * @type api + * @brief 识别或翻译房间内所有用户的语音,形成字幕。
    + * 调用该方法时,可以在 ByteRTCSubtitleMode{@link #ByteRTCSubtitleMode} 中选择语音识别或翻译模式。如果选择识别模式,语音识别文本会通过 rtcRoom:onSubtitleMessageReceived:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleMessageReceived:} 事件回调给你;
    + * 如果选择翻译模式,你会同时收到两个 rtcRoom:onSubtitleMessageReceived:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleMessageReceived:} 回调,分别包含字幕原文及字幕译文。
    + * 调用该方法后,用户会收到 rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:} 回调,通知字幕是否开启。 + * @param subtitleConfig 字幕配置信息。参看 ByteRTCSubtitleConfig{@link #ByteRTCSubtitleConfig}。 + * @return + * - 0: 成功。 + * - < 0: 失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 + * @note + * - 使用字幕功能前,你需要在 [RTC 控制台](https: + * - 如果你需要使用流式语音识别模式,你应在 [豆包语音控制台](https: + * - 如果你需要使用实时语音翻译模式,你应开通机器翻译服务,参考 [开通服务](https: + * - 如需指定源语言,你需要在调用 `joinRoom` 接口进房时,通过 extraInfo 参数传入格式为`"语种英文名": "语种代号"` JSON 字符串,例如设置源语言为英文时,传入 `"source_language": "en"`。如未指定源语言,SDK 会将系统语种设定为源语言。如果你的系统语种不是中文、英文和日文,此时 SDK 会自动将中文设为源语言。 + * - 识别模式下,你可以传入 [RTC 控制台](https: + * - 翻译模式下,你需要传入机器翻译规定的语种英文名和语种代号。翻译模式下支持的语言及对应的代号参看[翻译模式语言支持](https: + * @list 字幕翻译服务 + */ + +- (int)startSubtitle:(ByteRTCSubtitleConfig *_Nonnull)subtitleConfig; +/** + * + * @valid since 3.52 + * @type api + * @brief 关闭字幕。
    + * 调用该方法后,用户会收到 rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:{@link #ByteRTCRoomDelegate#rtcRoom:onSubtitleStateChanged:errorCode:errorMessage:} 回调,通知字幕是否关闭。 + * @return + * - 0: 调用成功。 + * - !0: 调用失败。 + * @list 字幕翻译服务 + */ + +- (int)stopSubtitle; + +/** + * + * @type api + * @valid since 3.60. + * @brief 设置期望订阅的远端视频流类型。 + * @param streamId 目标要订阅的远端视频流 ID。 + * @param streamType 远端视频流类型,参看 ByteRTCVideoSimulcastStreamType{@link #ByteRTCVideoSimulcastStreamType}。 + * @return 方法调用结果:
    + * - 0:成功; + * - <0:失败。 + * @note + * - 该方法仅在发布端调用 setVideoEncoderConfig:withParameters:{@link #ByteRTCEngine#setVideoEncoderConfig:withParameters:} 开启了发送多路视频流的情况下生效。 + * - 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。该方法可在进房后调用。 + * @list 视频管理 + * @order 1 + */ + +- (int)setRemoteSimulcastStreamType:(NSString * _Nonnull) streamId streamType:(ByteRTCVideoSimulcastStreamType)streamType; + +/** + * + * @type api + * @brief 设置期望订阅的远端视频流的参数。 + * @param streamId 期望配置订阅参数的远端视频流 ID。 + * @param remoteVideoConfig 期望配置的远端视频流参数,参看 ByteRTCRemoteVideoConfig{@link #ByteRTCRemoteVideoConfig}。 + * @return 方法调用结果:
    + * + 0:成功。
    + * + !0:失败。 + * @note + * + 若使用 342 及以前版本的 SDK,调用该方法前请联系技术支持人员开启按需订阅功能。
    + * + 该方法仅在发布端调用 setLocalSimulcastMode:{@link #ByteRTCEngine#setLocalSimulcastMode:} 开启了发送多路视频流的情况下生效,此时订阅端将收到来自发布端与期望设置的参数最相近的一路流;否则订阅端只会收到一路参数为分辨率 640px × 360px、帧率 15fps 的视频流。
    + * + 若发布端开启了推送多路流功能,但订阅端不对流参数进行设置,则默认接受发送端设置的分辨率最大的一路视频流。
    + * + 该方法需在进房后调用。
    + * + SDK 会根据发布端和所有订阅端的设置灵活调整视频流的参数,具体调整策略详见[推送多路流](https: + * @list 视频管理 + */ + +- (int)setRemoteVideoConfig:(NSString * _Nonnull) streamId remoteVideoConfig:(ByteRTCRemoteVideoConfig *_Nonnull) remoteVideoConfig; + + +/** + * + * @type api + * @valid since 3.60. + * @brief 获取通话 ID。
    + * 该方法需要在加入房间后调用。当创建一个房间开启音视频通话后,系统会为该房间生成一个对应的通话 ID,标识此房间的通话。 + * @return 通话 ID。 + * @list 房间管理 + */ + +- (NSString * _Nonnull)getCallId; + +/** + * + * @type api + * @valid since 3.60. + * @brief 设置直播房间的场景类型。 + * @param mode 直播房间场景类型,参看 ByteRTCRoomLiveMode{@link #ByteRTCRoomLiveMode}。 + * @return + * - 0: 成功。 + * - <0: 失败。 + * @list 房间管理 + */ + +- (int)setLiveMode:(ByteRTCRoomLiveMode)mode; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRoomEx.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRoomEx.h new file mode 100644 index 0000000..b05ad1c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/ByteRTCRoomEx.h @@ -0,0 +1,134 @@ +#import "ByteRTCRoom.h" +#import "rtc/ByteRTCVideoDefinesEx.h" + +@class ByteRTCRoomEx; + +/** + * + * @type callback + * @brief ByteRTCRoomDelegateEx Class
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ +@protocol ByteRTCRoomDelegateEx +@optional + +/** + * + * @type callback + * @region 房间管理 + * @brief 关于订阅媒体流状态改变的回调 + * @param rtcRoom ByteRTCRoom 对象 + * @param state 订阅媒体流状态,参看 ByteRTCSubscribeState{@link #ByteRTCSubscribeState} + * @param userId 流发布用户的用户 ID + * @param streamIndex 流属性,用于指定订阅主流/屏幕流,参看 ByteRTCStreamIndex{@link#ByteRTCStreamIndex} + * @param info 流的属性,参看 ByteRTCSubscribeConfig{@link #ByteRTCSubscribeConfig} + * @note 本地用户收到该回调的时机包括:
    + * + 调用 subscribeStream:streamIndex:mediaStreamType:{@link #ByteRTCRoomEx#subscribeStream:streamIndex:mediaStreamType:} 或 unsubscribeStream:streamIndex:mediaStreamType:{@link #ByteRTCRoomEx#unsubscribeStream:streamIndex:mediaStreamType:} 订阅/取消订阅指定远端摄像头音视频流后;
    + * + 调用 subscribeScreen:mediaStreamType:{@link #ByteRTCRoom#subscribeScreen:mediaStreamType:} 或 unsubscribeScreen:mediaStreamType:{@link #ByteRTCRoom#unsubscribeScreen:mediaStreamType:} 订阅/取消订阅指定远端屏幕共享流后。 + */ +- (void)rtcRoom:(ByteRTCRoom* _Nonnull)rtcRoom + onStreamSubscribed:(ByteRTCSubscribeState)state + userId:(NSString* _Nonnull)userId + streamIndex:(ByteRTCStreamIndex)streamIndex + subscribeConfig:(ByteRTCSubscribeConfig* _Nonnull)info; +@end + +/** + * + * @type api + * @brief IRTCRoomEx Class + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomEx : ByteRTCRoom +/** + * + * @hidden + */ +@property(nonatomic, weak) id _Nullable delegateEx; +/** + * + * @type api + * @region 房间管理 + * @brief 在当前所在房间内发布媒体流 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * + 如果你已经在用户进房时通过调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 成功选择了自动发布,则无需再调用本接口。
    + * + 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 方法将自身设置为不可见后无法调用该方法,需将自身切换至可见后方可调用该方法发布摄像头音视频流。
    + * + 如果你需要向多个房间发布流,调用 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:}。
    + * + 调用此方法后,房间中的所有远端用户会收到 rtcRoom:onUserPublishStream:isScreen:mediaStreamType:{@link #ByteRTCRoomDelegateEx#rtcRoom:onUserPublishStream:isScreen:mediaStreamType:} 回调通知,其中成功收到了音频流的远端用户会收到 rtcEngine:onFirstRemoteAudioFrame:info:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteAudioFrame:info:} 回调,订阅了视频流的远端用户会收到 rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:{@link #ByteRTCRoomDelegate#rtcEngine:info:onFirstRemoteVideoFrameDecoded:withFrameInfo:info:withFrameInfo:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:{@link #ByteRTCRoomDelegate#rtcEngine:info:onFirstRemoteVideoFrameDecoded:withFrameInfo:info:withFrameInfo:} 回调。
    + * + 调用 unpublishStream:mediaStreamType:{@link #ByteRTCRoomEx#unpublishStream:mediaStreamType:} 取消发布。 + */ +- (int)publishStream:(ByteRTCStreamIndex)streamIndex mediaStreamType:(ByteRTCMediaStreamType)type; +/** + * + * @type api + * @region 房间管理 + * @brief 停止将本地摄像头/麦克风采集的媒体流发布到当前所在房间中 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * + 调用 publishStream:mediaStreamType:{@link #ByteRTCRoomEx#publishStream:mediaStreamType:} 手动发布摄像头音视频流后,你需调用此接口停止发布。
    + * + 调用此方法停止发布音视频流后,房间中的其他用户将会收到 rtcRoom:onUserUnpublishStream:type:reason: 回调通知。 + */ +- (int)unpublishStream:(ByteRTCStreamIndex)streamIndex mediaStreamType:(ByteRTCMediaStreamType)type; +/** + * + * @type api + * @region 房间管理 + * @brief 订阅房间内指定的媒体流,或更新对指定媒体流的订阅选项 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param userId 指定订阅的远端发布音视频流的用户 ID。 + * @param type 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 若当前用户在调用本接口时已经订阅该远端用户(手动订阅或自动订阅),则将根据本次传入的参数,更新订阅配置。
    + * + 你必须先通过 rtcRoom:onUserPublishStream:isScreen:mediaStreamType:{@link #ByteRTCRoomDelegateEx#rtcRoom:onUserPublishStream:isScreen:mediaStreamType:} 回调获取当前房间里的远端摄像头音视频流信息,然后调用本方法按需订阅。
    + * + 调用该方法后,你会收到 rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:{@link #ByteRTCRoomDelegateEx#rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:} 通知方法调用结果。
    + * + 成功订阅远端用户的媒体流后,订阅关系将持续到调用 unsubscribeStream:streamIndex:mediaStreamType:{@link #ByteRTCRoomEx#unsubscribeStream:streamIndex:mediaStreamType:} 取消订阅或本端用户退房。
    + * + 关于其他调用异常,你会收到 rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} 回调通知,具体异常原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + */ +- (int)subscribeStream:(NSString* _Nonnull)userId + streamIndex:(ByteRTCStreamIndex)streamIndex + mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType; +/** + * + * @type api + * @region 房间管理 + * @brief 取消订阅房间内指定的媒体流。
    + * 该方法对自动订阅和手动订阅模式均适用。 + * @param userId 指定订阅的远端发布音视频流的用户 ID。 + * @param streamIndex 流索引,参看 ByteRTCStreamIndex{@link #ByteRTCStreamIndex}。 + * @param mediaStreamType 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType{@link #ByteRTCMediaStreamType} + * @return 方法调用结果:
    + * + 0:成功;
    + * + <0:失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @note + * + 调用该方法后,你会收到 rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:{@link #ByteRTCRoomDelegateEx#rtcRoom:onStreamSubscribed:userId:streamIndex:subscribeConfig:} 通知方法调用结果。
    + * + 关于其他调用异常,你会收到 rtcRoom:onStreamStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onStreamStateChanged:withUid:state:extraInfo:} 回调通知,具体失败原因参看 ByteRTCErrorCode{@link #ByteRTCErrorCode}。 + */ +- (int)unsubscribeStream:(NSString* _Nonnull)userId + streamIndex:(ByteRTCStreamIndex)streamIndex + mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType; +/** + * + * @type api + * @region 房间管理 + * @brief 通过设置 ByteRTCRoomEx{@link #ByteRTCRoomEx} 对象的事件句柄,监听此对象对应的回调事件。 + * @param roomDelegate 参见 ByteRTCRoomDelegateEx{@link #ByteRTCRoomDelegateEx} + * @return + * + 0: 调用成功。
    + * + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + */ +- (int)setRTCRoomDelegateEx:(id _Nullable)roomDelegate; + + + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioDefines.h new file mode 100644 index 0000000..fca8b2b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioDefines.h @@ -0,0 +1,3049 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Audio Defines +*/ + +#import "ByteRTCMediaDefines.h" + +#pragma mark - ByteRTCAudioSource +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioSource : NSObject + +@end + +/** + * + * @hidden(macOS) + * @type keytype + * @brief 音频场景类型。
    + * 选择音频场景后,SDK 会自动根据客户端音频采集播放设备和状态,适用通话音量/媒体音量。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioScenarioType) { + /** + * + * @brief 默认场景,适用大部分场景。 + */ + + ByteRTCAudioScenarioTypeDefault = 0, + /** + * + * @brief 聊天室场景。通话清晰度较高,适用于会议,聊天室场景。 + */ + + ByteRTCAudioScenarioTypeChatRoom = 1, + /** + * + * @brief 游戏语音场景。 + */ + + ByteRTCAudioScenarioTypeGameStreaming = 2, + /** + * + * @brief 合唱场景。延迟较低。 + */ + + ByteRTCAudioScenarioTypeChorus = 3, + /** + * + * @brief 教育场景。适用于以人声教学内容为主的高音质场景。 + */ + + ByteRTCAudioScenarioTypeEducation = 4, + /** + * + * @brief AI 对话场景。适用于真人与 AI 智能体互动的场景。使用此场景时,还需在通过 `createRTCEngine` 创建引擎时,通过 `parameters` 字段传入私有参数 `"rtc.fg_config":"aigc_media_360=true"`。 + */ + + ByteRTCAudioScenarioTypeAiClient = 5, +}; + +/** + * + * @type keytype + * @brief 变声特效类型。如需更多类型,联系技术支持。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVoiceChangerType) { + /** + * + * @brief 原声,不含特效 + */ + + ByteRTCVoiceChangerOriginal = 0, + /** + * + * @brief 巨人 + */ + + ByteRTCVoiceChangerGiant = 1, + /** + * + * @brief 花栗鼠 + */ + + ByteRTCVoiceChangerChipmunk = 2, + /** + * + * @brief 小黄人 + */ + + ByteRTCVoiceChangerMinionst = 3, + /** + * + * @brief 颤音 + */ + + ByteRTCVoiceChangerVibrato = 4, + /** + * + * @brief 机器人 + */ + + ByteRTCVoiceChangerRobot = 5, +}; + +/** + * + * @type keytype + * @brief 混响特效类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVoiceReverbType) { + /** + * + * @brief 原声,不含特效 + */ + + ByteRTCVoiceReverbOriginal = 0, + /** + * + * @brief 回声 + */ + + ByteRTCVoiceReverbEcho = 1, + /** + * + * @brief 演唱会 + */ + + ByteRTCVoiceReverbConcert = 2, + /** + * + * @brief 空灵 + */ + + ByteRTCVoiceReverbEthereal = 3, + /** + * + * @brief KTV + */ + + ByteRTCVoiceReverbKTV = 4, + /** + * + * @brief 录音棚 + */ + + ByteRTCVoiceReverbStudio = 5, + /** + * + * @brief 虚拟立体声 + */ + + ByteRTCVoiceReverbVirtualStereo = 6, + /** + * + * @brief 空旷 + */ + + ByteRTCVoiceReverbSpacious = 7, + /** + * + * @brief 3D 人声 + */ + + ByteRTCVoiceReverb3D = 8, + /** + * + * @hidden internal use + * @brief 流行 + */ + + ByteRTCVoiceReverbPop = 9, + /** + * + * @hidden internal use + * @brief 蹦迪 + */ + + ByteRTCVoiceReverbDisco = 10, + /** + * + * @hidden internal use + * @brief 老唱片 + */ + + ByteRTCVoiceReverbOldRecord = 11, + /** + * + * @hidden internal use + * @brief 和声 + */ + + ByteRTCVoiceReverbHarmony = 12, + /** + * + * @hidden internal use + * @brief 摇滚 + */ + + ByteRTCVoiceReverbRock = 13, + /** + * + * @hidden internal use + * @brief 蓝调 + */ + + ByteRTCVoiceReverbBlues = 14, + /** + * + * @hidden internal use + * @brief 爵士 + */ + + ByteRTCVoiceReverbJazz = 15, + /** + * + * @hidden internal use + * @brief 电子 + */ + + ByteRTCVoiceReverbElectronic = 16, + /** + * + * @hidden internal use + * @brief 黑胶 + */ + + ByteRTCVoiceReverbVinyl = 17, + /** + * + * @hidden internal use + * @brief 密室 + */ + + ByteRTCVoiceReverbChamber = 18, + + /** + * + * @hidden internal use + * @brief 增强原声 + */ + + ByteRTCVoiceReverbEnhanceOriginal = 19, + + /** + * + * @hidden internal use + * @brief 浴室 + */ + + ByteRTCVoiceReverbBathroom = 20, + + /** + * + * @hidden internal use + * @brief 自然 + */ + + ByteRTCVoiceReverbNatural = 21, + + /** + * + * @hidden internal use + * @brief 楼道 + */ + + ByteRTCVoiceReverbHallway = 22, +}; +/** + * + * @type keytype + * @brief 音频均衡效果。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCBandFrequency) { + /** + * + * @brief 中心频率为 31Hz 的频带。 + */ + + ByteRTCBandFrequency31 = 0, + /** + * + * @brief 中心频率为 62Hz 的频带。 + */ + + ByteRTCBandFrequency62 = 1, + /** + * + * @brief 中心频率为 125Hz 的频带。 + */ + + ByteRTCBandFrequency125 = 2, + /** + * + * @brief 中心频率为 250Hz 的频带。 + */ + + ByteRTCBandFrequency250 = 3, + /** + * + * @brief 中心频率为 500Hz 的频带。 + */ + + ByteRTCBandFrequency500 = 4, + /** + * + * @brief 中心频率为 1kHz 的频带。 + */ + + ByteRTCBandFrequency1k = 5, + /** + * + * @brief 中心频率为 2kHz 的频带。 + */ + + ByteRTCBandFrequency2k = 6, + /** + * + * @brief 中心频率为 4kHz 的频带。 + */ + + ByteRTCBandFrequency4k = 7, + /** + * + * @brief 中心频率为 8kHz 的频带。 + */ + + ByteRTCBandFrequency8k = 8, + /** + * + * @brief 中心频率为 16kHz 的频带。 + */ + + ByteRTCBandFrequency16k = 9, +}; +/** + * + * @type keytype + * @brief 语音均衡效果。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVoiceEqualizationConfig : NSObject +/** + * + * @brief 频带。参看 ByteRTCBandFrequency{@link #ByteRTCBandFrequency}。 + */ + +@property(assign, nonatomic) ByteRTCBandFrequency frequency; +/** + * + * @brief 频带增益(dB)。取值范围是 `[-15, 15]`。 + */ + +@property(assign, nonatomic) int gain; +@end + +/** + * + * @type keytype + * @brief 音频混响效果。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVoiceReverbConfig : NSObject +/** + * + * @brief 混响模拟的房间大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。房间越大,混响越强。 + */ + +@property(assign, nonatomic) float roomSize; +/** + * + * @brief 混响的拖尾长度,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + +@property(assign, nonatomic) float decayTime; +/** + * + * @brief 混响的衰减阻尼大小,取值范围 `[0.0, 100.0]`。默认值为 `50.0f`。 + */ + +@property(assign, nonatomic) float damping; +/** + * + * @brief 早期反射信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + +@property(assign, nonatomic) float wetGain; +/** + * + * @brief 原始信号强度。取值范围 `[-20.0, 10.0]`,单位为 dB。默认值为 `0.0f`。 + */ + +@property(assign, nonatomic) float dryGain; +/** + * + * @brief 早期反射信号的延迟。取值范围 `[0.0, 200.0]`,单位为 ms。默认值为 `0.0f`。 + */ + +@property(assign, nonatomic) float preDelay; +@end + +/** + * + * @type keytype + * @brief 音质档位 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioProfileType) { + /** + * + * @brief 默认音质
    + * 服务器下发或客户端已设置的 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 的音质配置 + */ + + ByteRTCAudioProfileDefault = 0, + /** + * + * @brief 流畅
    + * 单声道,采样率为 16 kHz,编码码率为 32 Kbps。
    + * 流畅优先、低功耗、低流量消耗,适用于大部分游戏场景,如小队语音、组队语音、国战语音等。 + */ + + ByteRTCAudioProfileFluent = 1, + /** + * + * @brief 单声道标准音质。
    + * 采样率为 24 kHz,编码码率为 48 Kbps。
    + * 适用于对音质有一定要求的场景,同时延时、功耗和流量消耗相对适中,适合教育场景和狼人杀等游戏。 + */ + + ByteRTCAudioProfileStandard = 2, + /** + * + * @brief 双声道音乐音质
    + * 采样率为 48 kHz,编码码率为 128 kbps。
    + * 超高音质,同时延时、功耗和流量消耗相对较大,适用于连麦 PK 等音乐场景。
    + * 游戏场景不建议使用。 + */ + + ByteRTCAudioProfileHD = 3, + /** + * + * @brief 双声道标准音质。采样率为 48 KHz,编码码率最大值为 80 Kbps + */ + + ByteRTCAudioProfileStandardStereo = 4, + /** + * + * @brief 单声道音乐音质。采样率为 48 kHz,编码码率最大值为 64 Kbps + */ + + ByteRTCAudioProfileHDMono = 5, +}; + +/** + * + * @type keytype + * @brief 降噪模式。降噪算法受调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 时设置的房间模式影响。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAnsMode) { + /** + * + * @brief 关闭所有音频降噪能力。 + */ + + ByteRTCAnsModeDisable = 0, + /** + * + * @brief 适用于微弱降噪。 + */ + + ByteRTCAnsModeLow = 1, + /** + * + * @brief 适用于抑制中度平稳噪声,如空调声和风扇声。 + */ + + ByteRTCAnsModeMedium = 2, + /** + * + * @brief 适用于抑制嘈杂非平稳噪声,如键盘声、敲击声、碰撞声、动物叫声。 + */ + + ByteRTCAnsModeHigh = 3, + /** + * + * @brief 启用音频降噪能力。具体的降噪算法由 RTC 智能决策。 + */ + + ByteRTCAnsModeAutomatic = 4, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 语音通话模式,在小队语音里用这个接口设置自己的发送模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRangeAudioMode) { + /** + * + * @brief 默认模式 + */ + + ByteRTCRangeAudioModeUndefined = 0, + /** + * + * @brief 小队模式 + */ + + ByteRTCRangeAudioModeTeam = 1, + /** + * + * @brief 世界模式 + */ + + ByteRTCRangeAudioModeWorld = 2, +}; + +/** + * + * @type keytype + * @brief 当前音频设备类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioDeviceType) { + /** + * + * @brief 未知音频设备 + */ + + ByteRTCAudioDeviceTypeUnknown = -1, + /** + * + * @brief 音频渲染设备 + */ + + ByteRTCAudioDeviceTypeRenderDevice = 0, + /** + * + * @brief 音频采集设备 + */ + + ByteRTCAudioDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流音频设备 + */ + + ByteRTCAudioDeviceTypeScreenCaptureDevice = 2 +}; +/** + * + * @type keytype + * @brief 音频采样率,单位为 Hz。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioSampleRate) { + /** + * + * @brief 默认设置。48000Hz。 + */ + + ByteRTCAudioSampleRateAuto = -1, + /** + * + * @brief 8000Hz + */ + + ByteRTCAudioSampleRate8000 = 8000, + /** + * + * @brief 11025Hz + */ + + ByteRTCAudioSampleRate11025 = 11025, + /** + * + * @brief 16000Hz + */ + + ByteRTCAudioSampleRate16000 = 16000, + /** + * + * @brief 22050Hz + */ + + ByteRTCAudioSampleRate22050 = 22050, + /** + * + * @brief 24000Hz + */ + + ByteRTCAudioSampleRate24000 = 24000, + /** + * + * @brief 32000Hz + */ + + ByteRTCAudioSampleRate32000 = 32000, + /** + * + * @brief 44100Hz + */ + + ByteRTCAudioSampleRate44100 = 44100, + /** + * + * @brief 48000Hz + */ + + ByteRTCAudioSampleRate48000 = 48000 +}; +/** + * + * @type keytype + * @brief 音频声道。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioChannel) { + /** + * + * @brief 默认设置。默认值为 `2`。 + */ + + ByteRTCAudioChannelAuto = -1, + /** + * + * @brief 单声道 + */ + + ByteRTCAudioChannelMono = 1, + /** + * + * @brief 双声道 + */ + + ByteRTCAudioChannelStereo = 2, +}; +/** + * + * @type keytype + * @brief 音频编码类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioCodecType) { + /** + * + * @brief 未知编码类型 + */ + + ByteRTCAudioCodecTypeNone = 0, + /** + * + * @brief Opus 编码类型 + */ + + ByteRTCAudioCodecTypeOpus, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAAC, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACLC = 2, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACHEv1, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACHEv2, + /** + * + * @hidden currently not available + */ + + ByteRTCAudioCodecTypeAACLCadts, +}; + +/** + * + * @deprecated since 3.52, use ByteRTCMixedStreamAudioCodecType{@link #ByteRTCMixedStreamAudioCodecType} instead. + * @type keytype + * @brief 音频编码类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCTranscodingAudioCodec) { + /** + * + * @type keytype + * @brief AAC 格式。 + */ + + ByteRTCTranscodingAudioCodecAAC = 0, +}; + +/** + * + * @type keytype + * @brief 音频编码类型。(新) + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamAudioCodecType) { + /** + * + * @type keytype + * @brief AAC 格式。 + */ + + ByteRTCMixedStreamAudioCodecTypeAAC = 0, +}; + +/** + * + * @type keytype + * @brief AAC 编码规格。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamAudioProfile) { + /** + * + * @brief AAC-LC 规格,默认值。 + */ + + ByteRTCMixedStreamAudioProfileLC = 0, + /** + * + * @brief HE-AAC v1 规格。 + */ + + ByteRTCMixedStreamAudioProfileHEv1 = 1, + /** + * + * @brief HE-AAC v2 规格。 + */ + + ByteRTCMixedStreamAudioProfileHEv2 = 2, +}; + +/** + * + * @deprecated since 3.52, use ByteRTCMixedStreamAudioProfile{@link #ByteRTCMixedStreamAudioProfile} instead. + * @type keytype + * @brief AAC 编码规格。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAACProfile) { + /** + * + * @brief AAC-LC 规格,默认值。 + */ + + ByteRTCAACProfileLC = 0, + /** + * + * @brief HE-AAC v1 规格。 + */ + + ByteRTCAACProfileHEv1 = 1, + /** + * + * @brief HE-AAC v2 规格。 + */ + + ByteRTCAACProfileHEv2 = 2, +}; +/** + * + * @type keytype + * @brief 音频播放路由 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRoute) { + /** + * + * @brief 通过 `setDefaultAudioRoute:` 设置的音频路由 + */ + + ByteRTCAudioRouteDefault = -1, + /** + * + * @brief 有线耳机 + */ + + ByteRTCAudioRouteHeadset = 1, + /** + * + * @brief 听筒。设备自带的,一般用于通话的播放硬件。 + */ + + ByteRTCAudioRouteEarpiece = 2, + /** + * + * @brief 扬声器。设备自带的,一般用于免提播放的硬件。 + */ + + ByteRTCAudioRouteSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + ByteRTCAudioRouteHeadsetBluetooth = 4, + /** + * + * hidden(macOS) + * @brief USB 设备或通过 Lightning 转接器连接的 3.5mm 耳机
    + * 其中,仅在客户端为 iOS 16 及以上版本时可识别出 3.5mm 耳机 + */ + + ByteRTCAudioRouteHeadsetUSB = 5, +}; + +/** + * + * @type keytype + * @brief 音频播放设备
    + * 音频设备变化时 SDK 通过 `rtcEngine:onAudioPlaybackDeviceChanged:` 回调当前音频播放设备。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioPlaybackDevice) { + /** + * + * @brief 有线耳机 + */ + + ByteRTCAudioPlaybackDeviceHeadset = 1, + /** + * + * @brief 听筒 + */ + + ByteRTCAudioPlaybackDeviceEarpiece = 2, + /** + * + * @brief 扬声器 + */ + + ByteRTCAudioPlaybackDeviceSpeakerphone = 3, + /** + * + * @brief 蓝牙耳机 + */ + + ByteRTCAudioPlaybackDeviceHeadsetBluetooth = 4, + /** + * + * @brief USB 设备 + */ + + ByteRTCAudioPlaybackDeviceHeadsetUSB = 5, +}; + + +/** + * + * @type keytype + * @brief 混音播放类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingType) { + /** + * + * @brief 仅本地播放 + */ + + ByteRTCAudioMixingTypePlayout = 0, + /** + * + * @brief 仅远端播放 + */ + + ByteRTCAudioMixingTypePublish = 1, + /** + * + * @brief 本地和远端同时播放 + */ + + ByteRTCAudioMixingTypePlayoutAndPublish = 2 +}; + +/** + * + * @type keytype + * @brief 混音播放声道类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingDualMonoMode) { + /** + * + * @brief 和音频文件一致 + */ + + ByteRTCAudioMixingDualMonoModeAuto = 0, + /** + * + * @brief 只能听到音频文件中左声道的音频 + */ + + ByteRTCAudioMixingDualMonoModeL = 1, + /** + * + * @brief 只能听到音频文件中右声道的音频 + */ + + ByteRTCAudioMixingDualMonoModeR = 2, + /** + * + * @brief 能同时听到音频文件中左右声道的音频 + */ + + ByteRTCAudioMixingDualMonoModeMix = 3 +}; + +/** + * + * @type keytype + * @brief 音频混音文件播放状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingState) { + /** + * + * @brief 混音已加载 + */ + + ByteRTCAudioMixingStatePreloaded = 0, + /** + * + * @brief 混音正在播放 + */ + + ByteRTCAudioMixingStatePlaying, + /** + * + * @brief 混音暂停 + */ + + ByteRTCAudioMixingStatePaused, + /** + * + * @brief 混音停止 + */ + + ByteRTCAudioMixingStateStopped, + /** + * + * @brief 混音播放失败 + */ + + ByteRTCAudioMixingStateFailed, + /** + * + * @brief 混音播放结束 + */ + + ByteRTCAudioMixingStateFinished, + /** + * + * @brief 准备 PCM 混音 + */ + + ByteRTCAudioMixingStatePCMEnabled, + /** + * + * @brief PCM 混音播放结束 + */ + + ByteRTCAudioMixingStatePCMDisabled, +}; +/** + * + * @type keytype + * @brief 混音错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioMixingError) { + /** + * + * @brief 正常 + */ + + ByteRTCAudioMixingErrorOk = 0, + /** + * + * @brief 预加载失败,找不到混音文件或者文件长度超出 20s + */ + + ByteRTCAudioMixingErrorPreloadFailed, + /** + * + * @brief 混音开启失败,找不到混音文件或者混音文件打开失败 + */ + + ByteRTCAudioMixingErrorStartFailed, + /** + * + * @brief 混音 ID 异常 + */ + + ByteRTCAudioMixingErrorIdNotFound, + /** + * + * @brief 设置混音文件的播放位置出错 + */ + + ByteRTCAudioMixingErrorSetPositionFailed, + /** + * + * @brief 音量参数不合法,仅支持设置的音量值为[0, 400] + */ + + ByteRTCAudioMixingErrorInValidVolume, + /** + * + * @brief 播放的文件与预加载的文件不一致。请先使用 unloadAudioMixing: 卸载此前的文件。 + */ + + ByteRTCAudioMixingErrorLoadConflict, + /** + * + * @brief 不支持此混音类型。 + */ + + ByteRTCAudioMixingErrorIdTypeNotMatch, + /** + * + * @brief 设置混音文件的音调不合法 + */ + + ByteRTCAudioMixingErrorInValidPitch, + /** + * + * @brief 设置混音文件的音轨不合法 + */ + + ByteRTCAudioMixingErrorInValidAudioTrack, + /** + * + * @brief 混音文件正在启动中 + */ + + ByteRTCAudioMixingErrorIsStarting, + /** + * + * @brief 设置混音文件的播放速度不合法 + */ + + ByteRTCAudioMixingErrorInValidPlaybackSpeed, +}; +/** + * + * @type keytype + * @brief 自定义音频源模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaPlayerCustomSourceMode) { + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceModePush = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceModePull, +}; +/** + * + * @type keytype + * @brief 自定义音频流类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaPlayerCustomSourceStreamType) { + /** + * + * @brief 当播放来自本地的 PCM 数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceStreamTypeRaw = 0, + /** + * + * @brief 当播放来自内存的音频数据时,使用此选项。 + */ + + ByteRTCMediaPlayerCustomSourceStreamTypeEncoded, +}; +/** + * + * @type keytype + * @brief 音频数据的起始读取位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaPlayerCustomSourceSeekWhence) { + /** + * + * @brief 从音频数据的头开始读取,读取后的位置为参数 offset 的值。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceSet = 0, + /** + * + * @brief 从音频数据的某一位置开始读取,读取后的位置为音频数据当前的读取位置加上参数 offset 的值。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceCur = 1, + /** + * + * @brief 从音频数据的尾开始读取,读取后的位置为用户传入的音频数据大小加上参数 offset 的值。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceEnd = 2, + /** + * + * @brief 返回音频数据的大小。 + */ + + ByteRTCMediaPlayerCustomSourceSeekWhenceSize = 3, +}; +/** + * + * @type keytype + * @brief 播放状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayerState) { + /** + * + * @brief 播放未启动 + */ + + ByteRTCPlayerStateIdle = 0, + /** + * + * @brief 已加载 + */ + + ByteRTCPlayerStatePreloaded, + /** + * + * @brief 已打开 + */ + + ByteRTCPlayerStateOpened, + /** + * + * @brief 正在播放 + */ + + ByteRTCPlayerStatePlaying, + /** + * + * @brief 播放已暂停 + */ + + ByteRTCPlayerStatePaused, + /** + * + * @brief 播放已被主动停止 + */ + + ByteRTCPlayerStateStopped, + /** + * + * @brief 播放失败 + */ + + ByteRTCPlayerStateFailed, + /** + * + * @brief 播放自然结束 + */ + + ByteRTCPlayerStateFinished, + /** + * + * @brief 循环播放已结束 + */ + + ByteRTCPlayerStateLoopFinished, +}; + +/** + * + * @type keytype + * @brief 播放事件 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayerEvent) { + + /** + * + * @brief 开始切换音轨
    + * 开始调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 时,返回此状态。 + */ + + ByteRTCPlayerEventSelectAudioTrackBegin, + /** + * + * @brief 切换音轨成功
    + * 调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 成功后,播放器切换到指定音轨播放,返回此状态。 + */ + + ByteRTCPlayerEventSelectAudioTrackCompleted, + /** + * + * @brief 切换音轨失败
    + * 调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 失败后,播放器无法切换到指定音轨,继续之前的音轨播放过程,返回此状态。 + */ + + ByteRTCPlayerEventSelectAudioTrackFailed, + /** + * + * @brief 试图移动播放位置
    + * 开始调用 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 时,返回此状态。 + */ + + ByteRTCPlayerEventSeekBegin, + /** + * + * @brief 移动播放位置成功
    + * 调用 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 成功后,返回此状态。 + */ + + ByteRTCPlayerEventSeekCompleted, + /** + * + * @brief 移动播放位置失败
    + * 调用 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 失败时,返回此状态。 + */ + + ByteRTCPlayerEventSeekFailed, +}; + +/** + * + * @type keytype + * @brief 播放错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayerError) { + /** + * + * @brief 正常 + */ + + ByteRTCPlayerErrorOK = 0, + /** + * + * @brief 不支持此类型 + */ + + ByteRTCPlayerErrorFormatNotSupport, + /** + * + * @brief 无效的播放路径 + */ + + ByteRTCPlayerErrorInvalidPath, + /** + * + * @brief 未满足前序接口调用的要求。请查看具体接口文档。 + */ + + ByteRTCPlayerErrorInvalidState, + /** + * + * @brief 设置播放位置出错。 + */ + + ByteRTCPlayerErrorInvalidPosition, + /** + * + * @brief 音量参数不合法。 + */ + + ByteRTCPlayerErrorInvalidVolume, + /** + * + * @brief 音调参数设置不合法。 + */ + + ByteRTCPlayerErrorInvalidPitch, + /** + * + * @brief 音轨参数设置不合法。 + */ + + ByteRTCPlayerErrorInvalidAudioTrackIndex, + /** + * + * @brief 播放速度参数设置不合法 + */ + + ByteRTCPlayerErrorInvalidPlaybackSpeed, + /** + * + * @brief 音效 ID 异常。还未加载或播放文件,就调用其他 API。 + */ + + ByteRTCPlayerErrorInvalidEffectId, + /** + * + * @brief 资源正在播放中 + */ + + ByteRTCPlayerErrorCurrentlyPlaying, +}; + +/** + * + * @type keytype + * @brief 音频输入源类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioSourceType) { + /** + * + * @brief 自定义采集音频源 + */ + + ByteRTCAudioSourceTypeExternal = 0, + /** + * + * @brief RTC SDK 内部采集音频源 + */ + + ByteRTCAudioSourceTypeInternal, +}; + +/** + * + * @type keytype + * @brief 音频输出源类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRenderType) { + /** + * + * @brief 自定义渲染音频 + */ + + ByteRTCAudioRenderTypeExternal = 0, + /** + * + * @brief RTC SDK 内部渲染音频 + */ + + ByteRTCAudioRenderTypeInternal, +}; + +/** + * + * @type keytype + * @brief 是否开启耳返功能。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEarMonitorMode) { + /** + * + * @brief 关闭。 + */ + + ByteRTCEarMonitorModeOff = 0, + /** + * + * @brief 开启。 + */ + + ByteRTCEarMonitorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 耳返音频是否经过本地音频处理。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEarMonitorAudioFilter) { + /** + * + * @brief 无音频处理。 + */ + + ByteRTCEarMonitorAudioFilterNone = 0x0001, + /** + * + * @brief 经本地音频处理后的音频,包括 3A、变声、混响等 SDK 提供处理能力以及自定义音频处理。 + */ + + ByteRTCEarMonitorAudioFilterReuseAudioProcessing = 0x8000, +}; + +/** + * + * @type keytype + * @brief 音频回调方法 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioFrameCallbackMethod) { + /** + * + * @brief 本地麦克风录制的音频数据回调 + */ + + ByteRTCAudioFrameCallbackRecord = 0, + /** + * + * @brief 订阅的远端所有用户混音后的音频数据回调 + */ + + ByteRTCAudioFrameCallbackPlayback = 1, + /** + * + * @brief 本地麦克风录制和订阅的远端所有用户混音后的音频数据回调 + */ + + ByteRTCAudioFrameCallbackMixed = 2, + /** + * + * @brief 订阅的远端每个用户混音前的音频数据回调 + */ + + ByteRTCAudioFrameCallbackRemoteUser = 3, + /** + * + * @brief 本地麦克风录制和本地 `MediaPlayer`, `EffectPlayer` 播放的音频混音后的音频数据回调 + */ + + ByteRTCAudioFrameCallbackCaptureMixed = 5 +}; +/** + * + * @type keytype + * @brief 返回给音频处理器的音频类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioFrameMethod) { + /** + * + * @brief 本地采集的音频。 + */ + + ByteRTCAudioFrameProcessorRecord = 0, + /** + * + * @brief 远端音频流的混音音频。 + */ + + ByteRTCAudioFrameProcessorPlayback = 1, + /** + * + * @brief 各个远端音频流。 + */ + + ByteRTCAudioFrameProcessorRemoteUser = 2, + /** + * + * @hidden(macOS) + * @brief 软件耳返音频。 + */ + + ByteRTCAudioFrameProcessorEarMonitor = 3, + /** + * + * @brief 屏幕共享音频。 + */ + + ByteRTCAudioFrameProcessorScreen = 4, +}; + +/** + * + * @type keytype + * @brief 音量回调模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioReportMode) { + /** + * + * @brief 默认始终开启音量回调。 + */ + + ByteRTCAudioReportModeNormal = 0, + /** + * + * @brief 可见用户进房并停止推流后,关闭音量回调。 + */ + + ByteRTCAudioReportModeDisconnect = 1, + /** + * + * @brief 可见用户进房并停止推流后,开启音量回调,回调值重置为 0。 + */ + + ByteRTCAudioReportModeReset = 2, +}; + +/** + * + * @type keytype + * @brief rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 中包含的音频信息的范围。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioPropertiesMode) { + /** + * + * @brief 仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + + ByteRTCAudioPropertiesModeMicrohone = 0, + /** + * + * @brief 包含以下信息:
    + * - 本地麦克风采集的音频数据和本地屏幕音频采集数据; + * - 本地混音的音频数据。 + */ + + ByteRTCAudioPropertiesModeAudioMixing = 1 +}; + +/** + * + * @type keytype + * @brief 音频流来源的用户 ID, 及对应的音量。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioVolumeInfo : NSObject +/** + * + * @brief 音频流来源的用户 ID + */ + +@property(copy, nonatomic) NSString * _Nonnull uid; +/** + * + * @brief 线性音量,取值范围为:[0,255] + */ + +@property(assign, nonatomic) NSUInteger linearVolume; +/** + * + * @brief 非线性音量,取值范围为:[-127,0] + */ + +@property(assign, nonatomic) NSUInteger nonlinearVolume; +@end + +/** + * + * @type keytype + * @brief 音频参数格式 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioFormat : NSObject +/** + * + * @brief 音频采样率,详见 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate} + */ + +@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate; +/** + * + * @brief 音频声道,详见 ByteRTCAudioChannel{@link #ByteRTCAudioChannel} + */ + +@property(nonatomic, assign) ByteRTCAudioChannel channel; +/** + * + * @brief 单次回调的音频帧中包含的采样点数。默认值为 `0`,此时,采样点数取最小值。
    + * 最小值为回调间隔是 0.01s 时的值,即 `sampleRate * channel * 0.01s`。
    + * 最大值是 `2048`。超出取值范围时,采样点数取默认值。
    + * 该参数仅在设置读写回调时生效,调用 enableAudioFrameCallback:format:{@link #ByteRTCEngine#enableAudioFrameCallback:format:} 开启只读模式回调时设置该参数不生效。 + */ + +@property(nonatomic, assign) int samplesPerCall; +@end + +/** + * + * @type keytype + * @brief PCM 音频帧 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioFrame : NSObject +/** + * + * @brief PCM 数据 + */ + +@property(strong, nonatomic) NSData * _Nonnull buffer; +/** + * + * @brief 采样点个数 + */ + +@property(assign, nonatomic) int samples; +/** + * + * @brief 音频声道,参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel}。
    + * 双声道的情况下,左右声道的音频帧数据以 LRLRLR 形式排布。 + */ + +@property(assign, nonatomic) ByteRTCAudioChannel channel; +/** + * + * @brief 采样率,参看 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate}。 + */ + +@property(assign, nonatomic) ByteRTCAudioSampleRate sampleRate; +/** + * + * @hidden for internal use only + * @brief 额外信息数据 + */ + +@property(strong, nonatomic) NSData * extraInfo; +@end +/** + * + * @type callback + * @brief 音频数据回调观察者
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。
    + * 本接口类中的回调周期均为 20 ms。 + * @list + */ + +@protocol ByteRTCAudioFrameObserver +/** + * + * @type callback + * @brief 返回麦克风录制的音频数据 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回订阅的所有远端用户混音后的音频数据。 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onPlaybackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回远端单个用户的音频数据 + * @param streamId 远端流对应的唯一标识 + * @param info 远端流详细信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param audioFrame 音频数据,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @note 此回调在播放线程调用。不要在此回调中做任何耗时的事情,否则可能会影响整个音频播放链路。 + * @list 自定义流处理 + */ + +- (void)onRemoteUserAudioFrame:(NSString * _Nonnull)streamId + info:(ByteRTCStreamInfo * _Nonnull)info + audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回本地麦克风录制和订阅的所有远端用户混音后的音频数据 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 返回本地麦克风录制的音频数据,本地 `MediaPlayer` / `EffectPlayer` 播放音频文件混音后的音频数据 + * @param audioFrame 音频数据, 详见: ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @list 自定义流处理 + */ + +- (void)onCaptureMixedAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +@end +/** + * + * @type callback + * @brief 自定义音频处理器
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Custom Stream Processing + */ + +@protocol ByteRTCAudioFrameProcessor +/** + * + * @type callback + * @brief 回调本地采集的音频帧地址,供自定义音频处理。 + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 完成自定义音频处理后,SDK 会对处理后的音频帧进行编码,并传输到远端。此音频处理不会影响软件耳返音频数据。 + * - 要启用此回调,必须调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并在参数中选择本地采集的音频,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessRecordAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 回调远端音频混音的音频帧地址,供自定义音频处理。 + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @note 调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并在参数中选择远端音频流的混音音频时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessPlayBackAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 回调单个远端用户的音频帧地址,供自定义音频处理。 + * @param streamId 音频流对应的唯一标识 + * @param info 音频流详细信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame} + * @note 调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并在参数中选择各个远端音频流时,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessRemoteUserAudioFrame:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo * _Nonnull)info audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @hidden(macOS) + * @valid since 3.50 + * @type callback + * @brief 软件耳返音频数据的回调。你可根据此回调自定义处理音频。
    + * 软件耳返音频中包含通过调用 `setVoiceReverbType:` 和 `setVoiceChangerType:` 设置的音频特效。 + * @param audioFrame 音频帧地址。参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @note + * - 此数据处理只影响软件耳返音频数据。 + * - 要启用此回调,必须调用 enableAudioProcessor:audioFormat:{@link #ByteRTCEngine#enableAudioProcessor:audioFormat:},并选择耳返音频。每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessEarMonitorAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +/** + * + * @type callback + * @brief 回调屏幕共享的音频帧地址,供自定义音频处理。 + * @param audioFrame 音频帧地址,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @note 调用 `enableAudioProcessor:`,把返回给音频处理器的音频类型设置为屏幕共享音频后,每 10 ms 收到此回调。 + * @list 自定义流处理 + */ + +- (int)onProcessScreenAudioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; +@end + +/** + * + * @type keytype + * @hidden for internal use only + * @region 音频管理 + * @brief 音频帧构建类 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEncodedAudioFrameData : NSObject +/** + * + * @hidden for internal use only + * @brief 音频编码类型,参看 ByteRTCAudioCodecType{@link #ByteRTCAudioCodecType}。 + */ + +@property(assign, nonatomic) ByteRTCAudioCodecType codecType; +/** + * + * @hidden for internal use only + * @brief 数据 + */ + +@property(strong, nonatomic) NSData * _Nonnull buffer; +/** + * + * @hidden for internal use only + * @brief 音频声道,参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel}。
    + * 双声道的情况下,左右声道的音频帧数据以 LRLRLR 形式排布。 + */ + +@property(assign, nonatomic) ByteRTCAudioChannel channel; +/** + * + * @hidden for internal use only + * @brief 采样率,参看 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate}。 + */ + +@property(assign, nonatomic) ByteRTCAudioSampleRate sampleRate; +/** + * + * @hidden for internal use only + * @brief 数据大小 + */ + +@property(assign, nonatomic) int size; +/** + * + * @hidden for internal use only + * @brief 时间戳,单位为微秒。 + */ + +@property(assign, nonatomic) long timestampUs; +/** + * + * @hidden for internal use only + * @brief 音频帧时长,单位为毫秒。 + */ + +@property(assign, nonatomic) int frameSizeMs; +/** + * + * @hidden for internal use only + * @brief 额外信息数据 + */ + +@property(strong, nonatomic) NSData * extraInfo; +@end +/** + * + * @type callback + * @hidden for internal use only + * @brief 远端音频帧监测器 + * @list 自定义流处理 + */ + +@protocol ByteRTCRemoteEncodedAudioFrameObserver +/** + * + * @type callback + * @hidden for internal use only + * @brief 调用 registerRemoteEncodedAudioFrameObserver:{@link #ByteRTCEngine#registerRemoteEncodedAudioFrameObserver:} 后,SDK 收到远端音频帧信息时,回调该事件 + * @param streamId 收到的远端音频流对应的唯一标识 + * @param info 收到的远端音频流的详细信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param audioFrame 远端音频帧信息,参看 ByteRTCEncodedAudioFrameData{@link #ByteRTCEncodedAudioFrameData} + * @list 自定义流处理 + */ + +- (void)onRemoteEncodedAudioFrame:(NSString * _Nonnull)streamId info:(ByteRTCStreamInfo * _Nonnull)info audioFrame:(ByteRTCEncodedAudioFrameData * _Nonnull)audioFrame; +@end + + + +#pragma mark - AudioDeviceManager +/** + * + * @hidden(iOS) + * @type api + * @brief 音频设备管理类 + * @list Custom Stream Processing + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioDeviceManager : NSObject +/** + * + * @type api + * @brief 获取当前系统内音频播放设备列表。 + * @return 所有音频播放设备的列表,参看 ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 监听到 `ByteRTCMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 了解设备变更后,重新调用本接口以获得新的设备列表。
    + * @list 音频管理 + */ + +- (ByteRTCDeviceCollection * _Nonnull)enumerateAudioPlaybackDevices; +/** + * + * @type api + * @brief 获取音频采集设备列表。 + * @return 音频采集设备列表。详见 ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 监听到 `ByteRTCMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 音频管理 + */ + +- (ByteRTCDeviceCollection * _Nonnull)enumerateAudioCaptureDevices; +/** + * + * @type api + * @brief 设置音频采集路由是否跟随系统。 + * @param followed
    + * - true: 跟随。此时,调用 setAudioCaptureDevice:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDevice:} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioCaptureDevice:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDevice:} 进行设置。 + * @list 音频管理 + */ + +- (void)followSystemCaptureDevice:(BOOL)followed; +/** + * + * @type api + * @brief 设置音频播放路由是否跟随系统。 + * @param followed
    + * - true: 跟随。此时,调用 setAudioPlaybackDevice:{@link #ByteRTCAudioDeviceManager#setAudioPlaybackDevice:} 会失败。默认值。 + * - false: 不跟随系统。此时,可以调用 setAudioPlaybackDevice:{@link #ByteRTCAudioDeviceManager#setAudioPlaybackDevice:} 进行设置。 + * @list 音频管理 + */ + +- (void)followSystemPlaybackDevice:(BOOL)followed; +/** + * + * @type api + * @brief 设置音频播放设备。 + * @param deviceID 音频播放设备 ID,可通过 enumerateAudioPlaybackDevices{@link #ByteRTCAudioDeviceManager#enumerateAudioPlaybackDevices} 获取。 + * @return + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 当你调用 followSystemPlaybackDevice:{@link #ByteRTCAudioDeviceManager#followSystemPlaybackDevice:} 设置音频播放设备跟随系统后,将无法调用此接口设置音频播放设备。 + * @list 音频管理 + */ + +- (int)setAudioPlaybackDevice:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 获取当前音频播放设备。 + * @param deviceID 设备 ID + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int)getAudioPlaybackDevice:(NSString * _Nonnull * _Nonnull) deviceID; +/** + * + * @type api + * @brief 设置音频采集设备。 + * @param deviceID 音频采集设备 ID。你可调用 enumerateAudioCaptureDevices{@link #ByteRTCAudioDeviceManager#EnumerateAudioCaptureDevices} 获取可用设备列表。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 当你调用 followSystemCaptureDevice:{@link #ByteRTCAudioDeviceManager#followSystemCaptureDevice:} 设置音频采集设备跟随系统后,将无法调用此接口设置音频采集设备。 + * @list 音频管理 + */ + +- (int)setAudioCaptureDevice:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 获取当前音频采集设备。 + * @param deviceID 音频采集设备 ID。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int)getAudioCaptureDevice:(NSString *_Nonnull * _Nonnull) deviceID; +/** + * + * @type api + * @brief 设置当前音频采集设备静音状态,默认为非静音。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法用于静音整个系统的音频采集。你也可以仅对麦克风采集到的音频信号做静音处理,而不影响媒体播放器的音乐声音,具体参看 muteAudioCapture:{@link #ByteRTCEngine#muteAudioCapture:} 方法说明。 + * - 设该方法为 `true` 静音后仍可通过 setAudioCaptureDeviceVolume:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceVolume:} 调整采集音量,调整后的音量会在取消静音后生效。 + * @list 音频管理 + */ + +- (int) setAudioCaptureDeviceMute:(bool)mute; +/** + * + * @type api + * @brief 获取当前音频采集设备是否静音的信息。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioCaptureDeviceMute:(bool * _Nonnull)mute; +/** + * + * @type api + * @brief 设置当前音频播放设备静音状态,默认为非静音。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) setAudioPlaybackDeviceMute:(bool)mute; +/** + * + * @type api + * @brief 获取当前音频播放设备是否静音的信息。 + * @param mute
    + * - true:静音 + * - false:非静音 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioPlaybackDeviceMute:(bool * _Nonnull)mute; +/** + * + * @type api + * @brief 设置当前音频采集设备音量 + * @param volume 音频采集设备音量,取值范围为 [0,255]。
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功。将影响 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 回调的音量信息。 + * - < 0:方法调用失败 + * @note 调用 setAudioCaptureDeviceMute:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDeviceMute:} 设为 `true` 静音采集设备后的音量调节会在取消静音后生效。 + * @list 音频管理 + */ + +- (int) setAudioCaptureDeviceVolume:(unsigned int)volume; +/** + * + * @type api + * @brief 获取当前音频采集设备音量 + * @param volume 音频采集设备音量,取值范围是 [0,255]
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioCaptureDeviceVolume:(unsigned int * _Nonnull)volume; +/** + * + * @type api + * @brief 设置当前音频播放设备音量 + * @param volume 音频播放设备音量,取值范围为 [0,255]
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) setAudioPlaybackDeviceVolume:(unsigned int)volume; +/** + * + * @type api + * @brief 获取当前音频播放设备音量 + * @param volume 音频播放设备音量,取值范围是 [0,255]
    + * - [0,25] 接近无声; + * - [26,75] 为低音量; + * - [76,204] 为中音量; + * - [205,255] 为高音量。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @list 音频管理 + */ + +- (int) getAudioPlaybackDeviceVolume:(unsigned int * _Nonnull)volume; +/** + * + * @type api + * @brief 启动音频播放设备测试。
    + * 该方法测试播放设备是否能正常工作。SDK 播放指定的音频文件,测试者如果能听到声音,说明播放设备能正常工作。 + * @param testAudioFilePath 音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。 + * @param interval 音频设备播放测试音量回调的间隔 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法必须在进房前调用,且不可与其它音频设备测试功能同时应用。 + * - 调用 stopAudioPlaybackDeviceTest{@link #ByteRTCAudioDeviceManager#stopAudioPlaybackDeviceTest} 停止测试。 + * @list 音频管理 + */ + +- (int)startAudioPlaybackDeviceTest:(NSString *_Nonnull)testAudioFilePath interval:(int)interval; +/** + * + * @type api + * @brief 停止音频播放设备测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note 调用 startAudioPlaybackDeviceTest:interval:{@link #ByteRTCAudioDeviceManager#startAudioPlaybackDeviceTest:interval:} 后,需调用本方法停止测试。 + * @list 音频管理 + */ + +- (int)stopAudioPlaybackDeviceTest; +/** + * + * @hidden(iOS) + * @type api + * @brief 开始音频采集设备和音频播放设备测试。 + * @param interval 测试中会收到 `rtcEngine:onLocalAudioPropertiesReport:` 回调,本参数指定了该周期回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法在进房前后均可调用。且不可与其它音频设备测试功能同时应用。 + * - 调用本接口 30 s 后,采集自动停止,并开始播放采集到的声音。录音播放完毕后,设备测试流程自动结束。你也可以在 30 s 内调用 stopAudioDeviceRecordAndPlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDeviceRecordAndPlayTest} 来停止采集并开始播放此前采集到的声音。 + * - 调用 stopAudioDevicePlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDevicePlayTest} 可以停止音频设备采集和播放测试。 + * - 你不应在测试过程中,调用 `enableAudioPropertiesReport:` 注册音量提示回调。 + * - 该方法仅在本地进行音频设备测试,不涉及网络连接。 + * @list 音频管理 + */ + +- (int)startAudioDeviceRecordTest:(int)interval; +/** + * + * @hidden(iOS) + * @type api + * @brief 停止采集本地音频,并开始播放采集到的声音。录音播放完毕后,设备测试流程结束。
    + * 调用 startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest:} 30s 内调用本接口来停止采集并开始播放此前采集到的声音。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法依赖 rtc 引擎,只有通过成员方法 getAudioDeviceManager{@link #ByteRTCEngine#getAudioDeviceManager} 创建的 ByteRTCAudioDeviceManager,该方法才是有效的 + * - 调用本接口开始播放录音后,可以在播放过程中调用 stopAudioDevicePlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDevicePlayTest} 停止播放。 + * @list 音频管理 + */ + +- (int)stopAudioDeviceRecordAndPlayTest; +/** + * + * @hidden(iOS) + * @type api + * @brief 停止由调用 startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest:} 开始的音频播放设备测试。
    + * 在音频播放设备测试自动结束前,可调用本接口停止音频采集与播放测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法依赖 rtc 引擎,只有通过成员方法 getAudioDeviceManager{@link #ByteRTCEngine#getAudioDeviceManager} 创建的 ByteRTCAudioDeviceManager,该方法才是有效的 + * @list 音频管理 + */ + +- (int)stopAudioDevicePlayTest; +/** + * + * @type api + * @brief 尝试初始化音频播放设备,以检测设备不存在、权限被拒绝/禁用等异常问题。 + * @param deviceID 设备索引号 + * @return 设备状态错误码
    + * - 0: 设备检测结果正常 + * - -1: 接口调用失败 + * - -2: 设备无权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note + * - 该接口需在进房前调用; + * - 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * @list 音频管理 + */ + +- (int)initAudioPlaybackDeviceForTest:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 尝试初始化音频采集设备,以检测设备不存在、权限被拒绝/禁用等异常问题。 + * @param deviceID 设备索引号 + * @return 设备状态错误码
    + * - 0: 设备检测结果正常 + * - -1: 接口调用失败 + * - -2: 设备无权限,尝试初始化设备失败 + * - -3: 设备不存在,当前没有设备或设备被移除时返回 + * - -4: 设备音频格式不支持 + * - -5: 其它原因错误 + * @note + * - 该接口需在进房前调用; + * - 检测成功不代表设备一定可以启动成功,还可能因设备被其他应用进程独占,或 CPU/内存不足等原因导致启动失败。 + * @list 音频管理 + */ + +- (int)initAudioCaptureDeviceForTest:(NSString * _Nonnull)deviceID; +/** + * + * @type api + * @brief 启动音频采集设备测试。
    + * 该方法测试音频采集设备是否能正常工作。启动测试后,会收到 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 回调上报的音量信息。 + * @param indicationInterval 获取回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。小于 10 毫秒行为未定义。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 该方法必须在进房前调用,且不可与其它音频设备测试功能同时应用。 + * - 你需调用 stopAudioRecordingDeviceTest{@link #ByteRTCAudioDeviceManager#stopAudioRecordingDeviceTest} 停止测试。 + * @list 音频管理 + */ + +- (int)startAudioRecordingDeviceTest:(unsigned int)indicationInterval; +/** + * + * @type api + * @brief 停止音频采集设备测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 调用 startAudioRecordingDeviceTest:{@link #ByteRTCAudioDeviceManager#startAudioRecordingDeviceTest:} 后,需调用本方法停止测试。 + * @list 音频管理 + */ + +- (int)stopAudioRecordingDeviceTest; +/** + * + * @type api + * @brief 开始音频设备回路测试。
    + * 该方法测试音频采集设备和音频播放设备是否能正常工作。一旦测试开始,音频采集设备会采集本地声音并通过音频播放设备播放出来,同时会收到 rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:}。 + * @param indicationInterval 收到回调的时间间隔,单位为 ms。建议设置到大于 200 ms。最小不得少于 10 ms。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 该方法必须在进房前调用。且不可与其它音频设备测试功能同时应用。 + * - 你需调用 stopAudioDeviceLoopbackTest{@link #ByteRTCAudioDeviceManager#stopAudioDeviceLoopbackTest} 停止测试。 + * - 该方法仅在本地进行音频设备测试,不涉及网络连接。 + * @list 音频管理 + */ + +- (int)startAudioDeviceLoopbackTest:(unsigned int)indicationInterval; +/** + * + * @type api + * @brief 停止音频设备回路测试。 + * @return 方法调用结果
    + * - 0:方法调用成功 + * - < 0:方法调用失败 + * @note + * - 该方法不依赖 rtc 引擎 + * - 调用 startAudioDeviceLoopbackTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceLoopbackTest:} 后,需调用本方法停止测试。 + * @list 音频管理 + */ + +- (int)stopAudioDeviceLoopbackTest; +@end +/** + * + * @type keytype + * @brief 混音配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEffectPlayerConfig : NSObject +/** + * + * @type keytype + * @brief 混音播放类型,详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType} + */ + +@property(assign, nonatomic) ByteRTCAudioMixingType type; +/** + * + * @brief 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + */ + +@property(assign, nonatomic) NSInteger pitch; +/** + * + * @brief 混音播放次数
    + * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + +@property(assign, nonatomic) NSInteger playCount; +/** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + +@property(assign, nonatomic) NSInteger startPos; +@end +/** + * + * @type keytype + * @brief 混音配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaPlayerConfig : NSObject +/** + * + * @brief 混音播放类型,详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType} + */ + +@property(assign, nonatomic) ByteRTCAudioMixingType type; +/** + * + * @brief 混音播放次数
    + * - play_count <= 0: 无限循环 + * - play_count == 1: 播放一次(默认) + * - play_count > 1: 播放 play_count 次 + */ + +@property(assign, nonatomic) NSInteger playCount; +/** + * + * @brief 混音起始位置。默认值为 0,单位为毫秒。 + */ + +@property(assign, nonatomic) NSInteger startPos; +/** + * + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress:progress:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerPlayingProgress:progress:} 的间隔。单位毫秒。
    + * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + */ + +@property(assign, nonatomic) NSInteger callbackOnProgressInterval; +/** + * + * @brief 在采集音频数据时,附带本地混音文件播放进度的时间戳。启用此功能会提升远端人声和音频文件混音播放时的同步效果。
    + * - 仅在单个音频文件混音时使用有效。 + * - `true` 时开启此功能,`false` 时关闭此功能,默认为关闭。 + */ + +@property(assign, nonatomic) BOOL syncProgressToRecordFrame; +/** +* +* @brief 是否自动播放。如果不自动播放,调用 start{@link #ByteRTCMediaPlayer#start} 播放音乐文件。默认为 True。 +*/ + +@property(assign, nonatomic) BOOL autoPlay; +@end +/** + * + * @type callback + * @brief 内存播放数据源回调 + * @list Audio Management + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCMediaPlayerCustomSourceProvider +/** + * + * @valid since 3.53 + * @type callback + * @brief 调用 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 接口播放用户传入的内存音频数据时,会触发此回调,用户需要写入音频数据。 + * @param buffer 内存地址。在该地址中写入音频数据,写入音频数据的大小不超过 bufferSize 中填入的数值。支持的音频数据格式有: mp3,aac,m4a,3gp,wav。 + * @param bufferSize 音频数据大小,单位为字节。如果你想停止播放内存音频数据,可在 bufferSize 中填入小于或等于 0 的数,此时 SDK 会停止调用此接口。 + * @return 返回实际读取的音频数据大小。 + * @note 若 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 接口调用失败,请在 buffer 和 bufferSize 两个参数中填入 0。 此时 SDK 会停止调用此接口。 + * @list 混音 + */ + +-(int)onReadData:(uint8_t*_Nonnull) buffer bufferSize:(int)bufferSize; +/** + * + * @valid since 3.53 + * @type callback + * @brief 根据设置好的内存音频数据的读取位置和读取偏移量对音频数据进行偏移,以便 SDK 读取和分析音频数据。
    + * 在调用 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 接口传入内存音频数据,或者调用 setPosition:position:{@link #ByteRTCAudioEffectPlayer#setPosition:position:} 设置了音频数据的起始播放位置后,SDK 会对音频数据进行读取和分析,此时会触发该回调,你需要根据参数中设置的起始读取位置和偏移量进行操作。 + * @param offset 音频数据读取偏移量,单位为字节,取值可正可负。 + * @param whence 音频数据的起始读取位置。参看 ByteRTCMediaPlayerCustomSourceSeekWhence{@link #ByteRTCMediaPlayerCustomSourceSeekWhence} + * @return + * 定位成功,返回偏移后的位置信息,或返回音频数据的大小。
    + * 定位失败,返回 -1。 + * @list 混音 + */ + +-(int64_t)onSeek:(int64_t)offset whence:(ByteRTCMediaPlayerCustomSourceSeekWhence)whence; +@end +/** + * + * @type keytype + * @brief 音频源 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaPlayerCustomSource : NSObject +/** + * + * @type keytype + * @brief 仅使用内存播放时,传入对应的 ByteRTCMediaPlayerCustomSourceProvider{@link #ByteRTCMediaPlayerCustomSourceProvider} 实例。 + */ + +@property(weak, nonatomic) id _Nullable provider; +/** + * + * @type keytype + * @brief 数据源模式,详见 ByteRTCMediaPlayerCustomSourceMode{@link #ByteRTCMediaPlayerCustomSourceMode}。默认为 `push`。 + */ + +@property(assign, nonatomic) ByteRTCMediaPlayerCustomSourceMode mode; +/** + * + * @type keytype + * @brief 数据源类型,详见 ByteRTCMediaPlayerCustomSourceStreamType{@link #ByteRTCMediaPlayerCustomSourceStreamType}。默认为 `raw`。 + */ + +@property(assign, nonatomic) ByteRTCMediaPlayerCustomSourceStreamType type; + +@end +/** + * + * @type keytype + * @brief 音频属性信息提示的相关配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioPropertiesConfig : NSObject +/** + * + * @brief 信息提示间隔,单位:ms
    + * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + +@property(assign, nonatomic) NSInteger interval; +/** + * + * @brief 是否开启音频频谱检测。 + */ + +@property(assign, nonatomic) BOOL enableSpectrum; +/** + * + * @brief 是否开启人声检测 (VAD)。 + */ + +@property(assign, nonatomic) BOOL enableVad; +/** + * + * @brief 音量回调模式。详见 ByteRTCAudioReportMode{@link #ByteRTCAudioReportMode}。 + */ + +@property(assign, nonatomic) ByteRTCAudioReportMode localMainReportMode; +/** + * + * @brief 适用于音频属性信息提示的平滑系数。取值范围是 `(0.0, 1.0]`。
    + * 默认值为 `1.0`,不开启平滑效果;值越小,提示音量平滑效果越明显。如果要开启平滑效果,可以设置为 `0.3`。 + */ + +@property(nonatomic, assign) float smooth; + +/** + * + * @brief rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport:} 中包含音频数据的范围。参看 ByteRTCAudioPropertiesMode{@link #ByteRTCAudioPropertiesMode}。
    + * 默认仅包含本地麦克风采集的音频数据和本地屏幕音频采集数据。 + */ + +@property(assign, nonatomic) ByteRTCAudioPropertiesMode audioReportMode; + +/** + * + * @brief 是否回调本地用户的人声基频。 + */ + +@property(assign, nonatomic) BOOL enableVoicePitch; +@end + +/** + * + * @type keytype + * @brief 音频属性信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioPropertiesInfo : NSObject +/** + * + * @brief 线性音量,与原始音量呈线性关系,数值越大,音量越大。取值范围是:[0,255]。
    + * - [0, 25]:近似无声 + * - [26, 75]:低音量 + * - [76, 204]:中音量 + * - [205, 255]:高音量 + */ + +@property(assign, nonatomic) NSInteger linearVolume; +/** + * + * @brief 非线性音量。由原始音量的对数值转化而来,因此在中低音量时更灵敏,可以用作 Active Speaker(房间内最活跃用户)的识别。取值范围是:[-127,0],单位 dB。
    + * - [-127, -60]:无声 + * - [-59, -40]:低音量 + * - [-39, -20]:中音量 + * - [-19, 0]:高音量 + */ + +@property(assign, nonatomic) NSInteger nonlinearVolume; +/** + * + * @brief 人声检测(VAD)结果
    + * - 1: 检测到人声。 + * - 0: 未检测到人声。 + * - -1: 未开启 VAD。 + */ + +@property(assign, nonatomic) NSInteger vad; +/** + * + * @brief 频谱数组。默认长度为 257。 + */ + +@property(copy, nonatomic) NSArray * _Nonnull spectrum; +/** + * + * @brief 本地用户的人声基频,单位为赫兹。
    + * 同时满足以下两个条件时,返回的值为本地用户的人声基频:
    + * - 调用 enableAudioPropertiesReport:{@link #ByteRTCEngine#enableAudioPropertiesReport:},并设置参数 enableVoicePitch 的值为 `true`。 + * - 本地采集的音频中包含本地用户的人声。 + * 其他情况下返回 `0`。 + */ + +@property(assign, nonatomic) NSInteger voicePitch; +@end + +/** + * + * @type keytype + * @brief 本地音频属性信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalAudioPropertiesInfo : NSObject + +/** + * + * @type keytype + * @hidden + * @brief 音频源。预留参数。 + */ + +@property(assign, nonatomic) ByteRTCAudioSource* _Nullable audioSource; +/** + * + * @type keytype + * @brief 音频属性信息,详见 ByteRTCAudioPropertiesInfo{@link #ByteRTCAudioPropertiesInfo} + */ + +@property(strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo; +@end + +/** + * + * @type keytype + * @brief 远端音频属性信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteAudioPropertiesInfo : NSObject +/** + * + * @type keytype + * @brief 远端流的唯一标识 + */ + +@property(nonatomic) NSString *_Nonnull streamId; + +/** + * + * @type keytype + * @brief 远端流详细信息,详见 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + */ + +@property(strong, nonatomic) ByteRTCStreamInfo *_Nonnull streamInfo; + +/** + * + * @type keytype + * @brief 音频属性信息,详见 ByteRTCAudioPropertiesInfo{@link #ByteRTCAudioPropertiesInfo} + */ + +@property(strong, nonatomic) ByteRTCAudioPropertiesInfo *_Nonnull audioPropertiesInfo; +@end + +/** + * + * @type keytype + * @brief 本地用户在房间内的位置坐标,需自行建立空间直角坐标系 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCPosition : NSObject +/** + * + * @brief x 坐标 + */ + +@property(nonatomic, assign) float x; +/** + * + * @brief y 坐标 + */ + +@property(nonatomic, assign) float y; +/** + * + * @brief z 坐标 + */ + +@property(nonatomic, assign) float z; +@end + +/** + * + * @type keytype + * @brief 方向朝向信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCOrientation : NSObject +/** + * + * @brief x 坐标 + */ + +@property(nonatomic, assign) float x; +/** + * + * @brief y 坐标 + */ + +@property(nonatomic, assign) float y; +/** + * + * @brief z 坐标 + */ + +@property(nonatomic, assign) float z; +@end + +/** + * + * @type keytype + * @brief 三维朝向信息,三个向量需要两两垂直。参看 ByteRTCOrientation{@link #ByteRTCOrientation}。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCHumanOrientation : NSObject +/** + * + * @brief 正前方朝向,默认值为 {1,0,0},即正前方朝向 x 轴正方向 + */ + +@property(nonatomic, strong) ByteRTCOrientation* _Nonnull forward; +/** + * + * @brief 正右方朝向,默认值为 {0,1,0},即右手朝向 y 轴正方向 + */ + +@property(nonatomic, strong) ByteRTCOrientation* _Nonnull right; +/** + * + * @brief 正上方朝向,默认值为 {0,0,1},即头顶朝向 z 轴正方向 + */ + +@property(nonatomic, strong) ByteRTCOrientation* _Nonnull up; +@end + +/** + * + * @type keytype + * @brief K 歌打分维度。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMulDimSingScoringMode) { + /** + * + * @brief 按照音高进行评分。 + */ + + ByteRTCMulDimSingScoringModeNote = 0 +}; +/** + * + * @type keytype + * @brief 远端音频流精准对齐模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioAlignmentMode) { + /** + * + * @brief 不对齐 + */ + + ByteRTCAudioAlignmentModeOff = 0, + /** + * + * @brief 远端音频流都对齐伴奏进度同步播放 + */ + + ByteRTCAudioAlignmentModeAudioMixing = 1, +}; + +/** + * + * @type keytype + * @hidden + * @brief 实时评分信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSingScoringRealtimeInfo : NSObject + /** + * + * @brief 当前的播放进度。 + */ + +@property(nonatomic, assign) int currentPosition; + /** + * + * @brief 演唱者的音高。 + */ + +@property(nonatomic, assign) int userPitch; + /** + * + * @brief 标准音高。 + */ + +@property(nonatomic, assign) int standardPitch; + /** + * + * @brief 歌词分句索引。 + */ + +@property(nonatomic, assign) int sentenceIndex; + /** + * + * @brief 上一句歌词的评分。 + */ + +@property(nonatomic, assign) int sentenceScore; + /** + * + * @brief 当前演唱的累计分数。 + */ + +@property(nonatomic, assign) int totalScore; + /** + * + * @brief 当前演唱的平均分数。 + */ + +@property(nonatomic, assign) int averageScore; +@end + +/** + * + * @type keytype + * @brief 标准音高数据组。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCStandardPitchInfo : NSObject + /** + * + * @brief 开始时间,单位 ms。 + */ + +@property(nonatomic, assign) int startTime; + /** + * + * @brief 持续时间,单位 ms。 + */ + +@property(nonatomic, assign) int duration; + /** + * + * @brief 音高。 + */ + +@property(nonatomic, assign) int pitch; +@end + +/** + * + * @type keytype + * @hidden + * @brief K 歌评分配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSingScoringConfig : NSObject + /** + * + * @brief 打分维度,详见 ByteRTCMulDimSingScoringMode{@link #ByteRTCMulDimSingScoringMode}。 + */ + +@property(nonatomic, assign) ByteRTCMulDimSingScoringMode mode; + /** + * + * @brief 音频采样率。仅支持 44100 Hz、48000 Hz。 + */ + +@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate; + /** + * + * @brief 歌词文件路径。打分功能仅支持 KRC 歌词文件。 + */ + +@property(nonatomic, copy) NSString *_Nonnull lyricsFilepath; + /** + * + * @brief 歌曲 midi 文件路径。 + */ + +@property(nonatomic, copy) NSString *_Nonnull midiFilepath; +@end + +/** + * + * @type keytype + * @brief 音频文件录制内容来源。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioFrameSource) { + /** + * + * @brief 本地麦克风采集的音频数据。 + */ + + ByteRTCAudioFrameSourceTypeMic = 0, + /** + * + * @brief 远端所有用户混音后的数据 + */ + + ByteRTCAudioFrameSourceTypePlayback = 1, + /** + * + * @brief 本地麦克风和所有远端用户音频流的混音后的数据 + */ + + ByteRTCAudioFrameSourceTypeMixed = 2, +}; +/** + * + * @type keytype + * @brief 音频质量 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioQuality) { + /** + * + * @brief 低音质 + */ + + ByteRTCAudioQualityLow = 0, + /** + * + * @brief 中音质 + */ + + ByteRTCAudioQualityMedium = 1, + /** + * + * @brief 高音质 + */ + + ByteRTCAudioQualityHigh = 2, + /** + * + * @brief 超高音质 + */ + + ByteRTCAudioQualityUltraHigh = 3, +}; +/** + * + * @type keytype + * @brief 音频录制配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioRecordingConfig : NSObject +/** + * + * @brief 录制文件路径。一个有读写权限的绝对路径,包含文件名和文件后缀。 + * @note 录制文件的格式仅支持 .aac 和 .wav。 + */ + +@property(nonatomic, copy) NSString* _Nonnull absoluteFileName; +/** + * + * @brief 录音内容来源,参看 ByteRTCAudioFrameSource{@link #ByteRTCAudioFrameSource}。
    + * 默认为 ByteRTCAudioFrameSourceTypeMixed = 2。 + */ + +@property(nonatomic, assign) ByteRTCAudioFrameSource frameSource; +/** + * + * @brief 录音采样率。参看 ByteRTCAudioSampleRate{@link #ByteRTCAudioSampleRate}。 + */ + +@property(nonatomic, assign) ByteRTCAudioSampleRate sampleRate; +/** + * + * @brief 录音音频声道。参看 ByteRTCAudioChannel{@link #ByteRTCAudioChannel}。
    + * 如果录制时设置的音频声道数与采集时的音频声道数不同:
    + * - 如果采集的声道数为 1,录制的声道数为 2,那么,录制的音频为经过单声道数据拷贝后的双声道数据,而不是立体声。 + * - 如果采集的声道数为 2,录制的声道数为 1,那么,录制的音频为经过双声道数据混合后的单声道数据。 + */ + +@property(nonatomic, assign) ByteRTCAudioChannel channel; +/** + * + * @brief 录音音质。仅在录制文件格式为 .aac 时可以设置。参看 ByteRTCAudioQuality{@link #ByteRTCAudioQuality}。
    + * 采样率为 32kHz 时,不同音质录制文件(时长为 10min)的大小分别是:
    + * - 低音质:1.2MB; + * - 【默认】中音质:2MB; + * - 高音质:3.75MB; + * - 超高音质:7.5MB。 + */ + +@property(nonatomic, assign) ByteRTCAudioQuality quality; +@end + +/** + * + * @type keytype + * @brief 录音配置 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRecordingState) { + /** + * + * @brief 录制异常 + */ + + ByteRTCAudioRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + ByteRTCAudioRecordingStateProcessing = 1, + /** + * + * @brief 已结束录制,并且录制文件保存成功。 + */ + + ByteRTCAudioRecordingStateSuccess = 2, +}; +/** + * + * @type errorcode + * @brief 音频文件录制的错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioRecordingErrorCode) { + /** + * + * @brief 录制正常 + */ + + ByteRTCAudioRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + ByteRTCAudioRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 没有进入房间 + */ + + ByteRTCAudioRecordingErrorNotInRoom = -2, + /** + * + * @brief 录制已经开始 + */ + + ByteRTCAudioRecordingAlreadyStarted = -3, + /** + * + * @brief 录制还未开始 + */ + + ByteRTCAudioRecordingNotStarted = -4, + /** + * + * @brief 录制失败。文件格式不支持。 + */ + + ByteRTCAudioRecordingErrorCodeNotSupport = -5, + /** + * + * @brief 其他异常 + */ + + ByteRTCAudioRecordingErrorCodeOther = -6, +}; +/** + * + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEnhancementConfig: NSObject +/** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceSignaling; +/** + * + * @brief 对音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceAudio; +@end +/** + * + * @type keytype + * @brief 用户在空间音频坐标系里的位置信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCPositionInfo : NSObject +/** + * + * @brief 用户在空间音频坐标系里的位置,需自行建立空间直角坐标系。参看 ByteRTCPosition{@link #ByteRTCPosition}。 + */ + +@property(strong, nonatomic) ByteRTCPosition *_Nonnull position; +/** + * + * @brief 用户在空间音频坐标系里的三维朝向信息。三个向量需要两两垂直。参看 ByteRTCHumanOrientation{@link #ByteRTCHumanOrientation}。 + */ + +@property(strong, nonatomic) ByteRTCHumanOrientation *_Nonnull orientation; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioEffectPlayer.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioEffectPlayer.h new file mode 100644 index 0000000..1f03982 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCAudioEffectPlayer.h @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCAudioEffectPlayer +*/ + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type callback + * @brief ByteRTCAudioEffectPlayer{@link #ByteRTCAudioEffectPlayer} 对应的回调句柄。你必须调用 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:} 完成设置后,才能收到对应回调。 + * @list + */ + +@protocol ByteRTCAudioEffectPlayerEventHandler +/** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param effectId ByteRTCAudioEffectPlayer{@link #ByteRTCAudioEffectPlayer} 的 ID。通过 getAudioEffectPlayer{@link #ByteRTCEngine#getAudioEffectPlayer} 设置。 + * @param state 混音状态。参考 ByteRTCPlayerState{@link #ByteRTCPlayerState}。 + * @param error 错误码。参考 ByteRTCPlayerError{@link #ByteRTCPlayerError}。 + * @list 混音 + */ + +-(void)onAudioEffectPlayerStateChanged:(int)effectId state:(ByteRTCPlayerState)state error:(ByteRTCPlayerError)error; + +@end +/** + * + * @valid since 3.53 + * @type api + * @brief 音效播放器。
    + * 注意:
    + * - 调用 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:} 设置回调句柄以获取相关回调。 + * - 使用混音功能时,你必须通过 [setActive:withOptions:error:](https: + * @list 混音 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEffectPlayer :NSObject +/** + * + * @type api + * @brief 开始播放音效文件。
    + * 可以通过传入不同的 ID 和 filepath 多次调用本方法,以实现同时播放多个音效文件,实现音效叠加。 + * @param effectId 音效 ID。用于标识音效,请保证音效 ID 唯一性。
    + * 如果使用相同的 ID 重复调用本方法后,上一个音效会停止,下一个音效开始,并收到 onAudioEffectPlayerStateChanged:state:error:{@link #ByteRTCAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged:state:error:}。 + * @param filePath 音效文件路径。
    + * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
    + * 推荐的音效文件采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
    + * 不同平台支持的本地音效文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYYYY
    iOS/macOSYYYYYY
    WindowsYYYYYYYY
    + * 不同平台支持的在线音效文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYY
    iOS/macOSYYYY
    WindowsYYYYYYY
    + * @param config 音效配置,详见 ByteRTCAudioEffectPlayerConfig{@link #ByteRTCAudioEffectPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果已经通过 preload:filePath:{@link #ByteRTCAudioEffectPlayer#preload:filePath:} 将文件加载至内存,确保此处的 ID 与 `preload` 设置的 ID 相同。 + * - 开始播放音效文件后,可以调用 stop:{@link #ByteRTCAudioEffectPlayer#stop:} 方法停止播放音效文件。 + * @list 混音 + */ + +-(int)start:(int)effectId filePath:(NSString * _Nullable)filePath config:(ByteRTCAudioEffectPlayerConfig * _Nullable)config; +/** + * + * @type api + * @brief 停止播放音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以调用本方法停止播放音效文件。 + * - 调用本方法停止播放音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + +-(int)stop:(int)effectId; +/** + * + * @type api + * @brief 停止播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以调用本方法停止播放所有音效文件。 + * - 调用本方法停止播放所有音效文件后,该音效文件会被自动卸载。 + * @list 混音 + */ + +-(int)stopAll; +/** + * + * @type api + * @brief 预加载指定音乐文件到内存中,以避免频繁播放同一文件时的重复加载,减少 CPU 占用。 + * @param effectId 音效 ID。用于标识音效,请保证音效 ID 唯一性。
    + * 如果使用相同的 ID 重复调用本方法,后一次会覆盖前一次。
    + * 如果先调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:},再使用相同的 ID 调用本方法 ,会收到回调 onAudioEffectPlayerStateChanged:state:error:{@link #ByteRTCAudioEffectPlayerEventHandler#onAudioEffectPlayerStateChanged:state:error:},通知前一个音效停止,然后加载下一个音效。
    + * 调用本方法预加载 A.mp3 后,如果需要使用相同的 ID 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 播放 B.mp3,请先调用 unload:{@link #ByteRTCAudioEffectPlayer#unload:} 卸载 A.mp3 ,否则会报错 AUDIO_MIXING_ERROR_LOAD_CONFLICT。 + * @param filePath 音效文件路径。支持本地文件的 URI、或本地文件的绝对路径。
    + * 预加载的文件长度不得超过 20s。
    + * 不同平台支持的音效文件格式和 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 一致。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 本方法只是预加载指定音效文件,只有调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法才开始播放指定音效文件。 + * - 调用本方法预加载的指定音效文件可以通过 unload:{@link #ByteRTCAudioEffectPlayer#unload:} 卸载。 + * @list 混音 + */ + +-(int)preload:(int)effectId filePath:(NSString * _Nullable)filePath; +/** + * + * @type api + * @brief 卸载指定音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用本方法卸载该文件后,关于当前的混音状态,如果设置了 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:},会收到回调 `onAudioEffectPlayerStateChanged`。 + * @list 混音 + */ + +-(int)unload:(int)effectId; +/** + * + * @type api + * @brief 卸载所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用本方法卸载该文件后,关于当前的混音状态,如果设置了 setEventHandler:{@link #ByteRTCAudioEffectPlayer#setEventHandler:},会收到回调 `onAudioEffectPlayerStateChanged`。 + * @list 混音 + */ + +-(int)unloadAll; +/** + * + * @type api + * @brief 暂停播放音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以通过调用本方法暂停播放音效文件。 + * - 调用本方法暂停播放音效文件后,可调用 resume:{@link #ByteRTCAudioEffectPlayer#resume:} 方法恢复播放。 + * @list 混音 + */ + +-(int)pause:(int)effectId; +/** + * + * @type api + * @brief 暂停播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 方法开始播放音效文件后,可以通过调用本方法暂停播放所有音效文件。 + * - 调用本方法暂停播放所有音效文件后,可调用 resumeAll{@link #ByteRTCAudioEffectPlayer#resumeAll} 方法恢复所有播放。 + * @list 混音 + */ + +-(int)pauseAll; +/** + * + * @type api + * @brief 恢复播放音效文件。 + * @param effectId 音效 ID + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用 pause:{@link #ByteRTCAudioEffectPlayer#pause:} 方法暂停播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + +-(int)resume:(int)effectId; +/** + * + * @type api + * @brief 恢复播放所有音效文件。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 调用 pauseAll{@link #ByteRTCAudioEffectPlayer#pauseAll} 方法暂停所有正在播放音效文件后,可以通过调用本方法恢复播放。 + * @list 混音 + */ + +-(int)resumeAll; +/** + * + * @type api + * @brief 设置音效文件的起始播放位置。 + * @param effectId 音效 ID + * @param position 音效文件起始播放位置,单位为毫秒。
    + * 你可以通过 getDuration:{@link #ByteRTCAudioEffectPlayer#getDuration:} 获取音效文件总时长,position 的值应小于音效文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)setPosition:(int)effectId position:(int)position; +/** + * + * @type api + * @brief 获取音效文件播放进度。 + * @param effectId 音效 ID + * @return + * - >0: 成功, 音效文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)getPosition:(int)effectId; +/** + * + * @type api + * @brief 调节指定音效的音量大小,包括音效文件和 PCM 音频。 + * @param effectId 音效 ID + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)setVolume:(int)effectId volume:(int)volume; +/** + * + * @type api + * @brief 设置所有音效的音量大小,包括音效文件和 PCM 音效。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 该接口的优先级低于 setVolume:volume:{@link #ByteRTCAudioEffectPlayer#setVolume:volume:},即通过 `setVolume` 单独设置了音量的音效 ID,不受该接口设置的影响。 + * @list 混音 + */ + +-(int)setVolumeAll:(int)volume; +/** + * + * @type api + * @brief 获取当前音量。 + * @param effectId 音效 ID + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)getVolume:(int)effectId; +/** + * + * @type api + * @brief 获取音效文件时长。 + * @param effectId 音效 ID + * @return + * - >0: 成功, 音效文件时长,单位为毫秒。 + * - < 0: 失败 + * @note 仅在调用 start:filePath:config:{@link #ByteRTCAudioEffectPlayer#start:filePath:config:} 后调用此接口。 + * @list 混音 + */ + +-(int)getDuration:(int)effectId; +/** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 ByteRTCAudioEffectPlayerEventHandler{@link #ByteRTCAudioEffectPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + +-(int)setEventHandler:(_Nullable id)handler; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCDefines.h new file mode 100644 index 0000000..cfc997f --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCDefines.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC RTC Defines +*/ + +#import "ByteRTCRtsDefines.h" +#import "ByteRTCMediaDefines.h" +#import "ByteRTCAudioDefines.h" +#import "ByteRTCVideoDefines.h" diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCHttpClientProtocol.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCHttpClientProtocol.h new file mode 100644 index 0000000..e2ed273 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCHttpClientProtocol.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC HTTP Client Protocol +*/ + +#import +/** + * + * @hidden for internal use only + * @type api + * @list 引擎管理 + */ + +@protocol ByteRTCHttpClientProtocol + +@required +/** + * + * @type api + * @brief 需要实现的 HTTP 异步 GET 接口。 + * @param url GET 请求地址。 + * @param timeout 超时时间。 + * @param callback GET 请求结果回调函数。 + * @list 引擎管理 + */ + +- (void)getAsync:(NSString * _Nonnull)url timeoutMillisecond:(int)timeout + withCallback:(void(^ _Nullable)(int code, NSString* _Nullable data))callback; +/** + * + * @type api + * @brief 需要实现的 HTTP 异步 POST 接口。 + * @param url POST 请求地址。 + * @param content POST 请求的内容。 + * @param timeout 超时时间。 + * @param callback POST 请求结果回调函数。 + * @list 引擎管理 + */ + +- (void)postAsync:(NSString * _Nonnull)url content:(NSString * _Nullable)content timeoutMillisecond:(int)timeout + withCallback:(void(^ _Nullable)(int code, NSString* _Nullable data))callback; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVDefines.h new file mode 100644 index 0000000..c31fa97 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVDefines.h @@ -0,0 +1,573 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCRtsDefines +*/ + +#import "ByteRTCRtsDefines.h" + +/** + * + * @type keytype + * @brief 歌曲过滤方式。 + */ + +typedef NS_OPTIONS(NSUInteger, ByteRTCMusicFilterType) { + /** + * + * @brief 不过滤。 + */ + + ByteRTCMusicFilterTypeNone = 0, + /** + * + * @brief 过滤没有歌词的歌曲。 + */ + + ByteRTCMusicFilterTypeWithoutLyric = 1 << 0, + /** + * + * @brief 过滤不支持打分的歌曲。 + */ + + ByteRTCMusicFilterTypeUnsupportedScore = 1 << 1, + /** + * + * @brief 过滤不支持伴唱切换的歌曲。 + */ + + ByteRTCMusicFilterTypeUnsupportedAccopmay = 1 << 2, + /** + * + * @brief 过滤没有高潮片段的歌曲。 + */ + + ByteRTCMusicFilterTypeUnsupportedClimx = 1 << 3, +}; + +/** + * + * @type keytype + * @brief 音乐播放状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPlayState) { + /** + * + * @brief 播放中。 + */ + + ByteRTCPlayStatePlaying = 1, + /** + * + * @brief 暂停中。 + */ + + ByteRTCPlayStatePaused = 2, + /** + * + * @brief 已停止。 + */ + + ByteRTCPlayStateStoped = 3, + /** + * + * @brief 播放失败。 + */ + + ByteRTCPlayStateFailed = 4, + /** + * + * @brief 播放结束。 + */ + + ByteRTCPlayStateFinished = 5, +}; + +/** + * + * @type keytype + * @brief 原唱伴唱类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioTrackType) { + /** + * + * @brief 播放原唱。 + */ + + ByteRTCAudioTrackTypeOriginal = 1, + /** + * + * @brief 播放伴唱。 + */ + + ByteRTCAudioTrackTypeAccompy = 2, +}; + +/** + * + * @type keytype + * @brief 音乐播放类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioPlayType) { + /** + * + * @brief 仅本地播放。 + */ + + ByteRTCAudioPlayTypeLocal = 0, + /** + * + * @brief 仅远端播放。 + */ + + ByteRTCAudioPlayTypeRemote = 1, + /** + * + * @brief 本地、远端同时播放。 + */ + + ByteRTCAudioPlayTypeLocalAndRemote = 2, +}; + +/** + * + * @type keytype + * @brief 歌词格式类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLyricStatus) { + /** + * + * @brief 无歌词。 + */ + + ByteRTCLyricStatusNone = 0, + /** + * + * @brief KRC 歌词。 + */ + + ByteRTCLyricStatusKRC = 1, + /** + * + * @brief LRC 歌词。 + */ + + ByteRTCLyricStatusLRC = 2, + /** + * + * @brief KRC 歌词和 LRC 歌词均有。 + */ + + ByteRTCLyricStatusKRCAndLRC = 3, +}; + +/** + * + * @type keytype + * @brief 下载文件类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCDownloadFileType) { + /** + * + * @brief 音频文件。 + */ + + ByteRTCDownloadFileTypeMusic = 1, + /** + * + * @brief KRC 歌词文件。 + */ + + ByteRTCDownloadFileTypeKRC = 2, + /** + * + * @brief LRC 歌词文件。 + */ + + ByteRTCDownloadFileTypeLRC = 3, + /** + * + * @brief MIDI 文件。 + */ + + ByteRTCDownloadFileTypeMIDI = 4, +}; + +/** + * + * @type keytype + * @brief 歌词文件类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCDownloadLyricType) { + /** + * + * @brief KRC 歌词文件。 + */ + + ByteRTCDownloadLyricTypeKRC = 0, + /** + * + * @brief LRC 歌词文件。 + */ + + ByteRTCDownloadLyricTypeLRC = 1, +}; + +/** + * + * @type errorcode + * @brief KTV 错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCKTVErrorCode) { + /** + * + * @brief 成功。 + */ + + ByteRTCKTVErrorCodeOK = 0, + /** + * + * @brief AppID 异常。 + */ + + ByteRTCKTVErrorCodeAppidInValid = -3000, + /** + * + * @brief 非法参数,传入的参数不正确。 + */ + + ByteRTCKTVErrorCodeParasInValid = -3001, + /** + * + * @brief 获取歌曲资源失败。 + */ + + ByteRTCKTVErrorCodeGetMusicFailed = -3002, + /** + * + * @brief 获取歌词失败。 + */ + + ByteRTCKTVErrorCodeGetLyricFailed = -3003, + /** + * + * @brief 歌曲下架。 + */ + + ByteRTCKTVErrorCodeMusicTakedown = -3004, + /** + * + * @brief 歌曲文件下载失败。 + */ + + ByteRTCKTVErrorCodeMusicDownload = -3005, + /** + * + * @brief MIDI 文件下载失败。 + */ + + ByteRTCKTVErrorCodeMidiDownloadFailed = -3006, + /** + * + * @brief 系统繁忙。 + */ + + ByteRTCKTVErrorCodeSystemBusy = -3007, + /** + * + * @brief 网络异常。 + */ + + ByteRTCKTVErrorCodeNetwork = -3008, + /** + * + * @brief KTV 功能未加入房间。 + */ + + ByteRTCKTVErrorCodeNotJoinRoom = -3009, + /** + * + * @brief 解析数据失败。 + */ + + ByteRTCKTVErrorCodeParseData = -3010, + /** + * + * @hidden + * @deprecated 从 353 开始 + * @brief 下载失败。 + */ + + ByteRTCKTVErrorCodeDownload = -3011, + /** + * + * @brief 已在下载中。 + */ + + ByteRTCKTVErrorCodeDownloading = -3012, + /** + * + * @brief 内部错误,联系技术支持人员。 + */ + + ByteRTCKTVErrorCodeInternal = -3013, + /** + * + * @brief 下载失败,磁盘空间不足。清除缓存后重试。 + */ + + ByteRTCKTVErrorCodeInsufficientDiskSpace = -3014, + /** + * + * @brief 下载失败,音乐文件解密失败,联系技术支持人员。 + */ + + ByteRTCKTVErrorCodeMusicDecryptionFailed = -3015, + /** + * + * @brief 下载失败,音乐文件重命名失败,请重试。 + */ + + ByteRTCKTVErrorCodeFileRenameFailed = -3016, + /** + * + * @brief 下载失败,下载超时,请重试。 + */ + + ByteRTCKTVErrorCodeDownloadTimeOut = -3017, + /** + * + * @brief 清除缓存失败,可能原因是文件被占用或者系统异常,请重试。 + */ + + ByteRTCKTVErrorCodeClearCacheFailed = -3018, + /** + * + * @brief 取消下载。 + */ + + ByteRTCKTVErrorCodeDownloadCanceled = -3019 +}; + +/** + * + * @type errorcode + * @brief KTV 播放器错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCKTVPlayerErrorCode) { + /** + * + * @brief 成功。 + */ + + ByteRTCKTVPlayerErrorCodeOK = 0, + /** + * + * @brief 播放错误,请下载后播放。 + */ + + ByteRTCKTVPlayerErrorCodeFileNotExist = -3020, + /** + * + * @brief 播放错误,请确认文件播放格式。 + */ + + ByteRTCKTVPlayerErrorCodeFileError = -3021, + /** + * + * @brief 播放错误,未进入房间。 + */ + + ByteRTCKTVPlayerErrorCodeNotJoinRoom = -3022, + /** + * + * @brief 参数错误。 + */ + + ByteRTCKTVPlayerErrorCodeParam = -3023, + /** + * + * @brief 播放失败,找不到文件或文件打开失败。 + */ + + ByteRTCKTVPlayerErrorCodeStartError = -3024, + /** + * + * @brief 混音 ID 异常。 + */ + + ByteRTCKTVPlayerErrorCodeMixIdError = -3025, + /** + * + * @brief 设置播放位置出错。 + */ + + ByteRTCKTVPlayerErrorCodePositionError = -3026, + /** + * + * @brief 音量参数不合法,可设置的取值范围为 [0,400]。 + */ + + ByteRTCKTVPlayerErrorCodeAudioVolumeError = -3027, + /** + * + * @brief 不支持此混音类型。 + */ + + ByteRTCKTVPlayerErrorCodeTypeError = -3028, + /** + * + * @brief 音调文件不合法。 + */ + + ByteRTCKTVPlayerErrorCodePitchError = -3029, + /** + * + * @brief 音轨不合法。 + */ + + ByteRTCKTVPlayerErrorCodeAudioTrackError = -3030, + /** + * + * @brief 混音启动中。 + */ + + ByteRTCKTVPlayerErrorCodeStartingError = -3031, +}; + +/** + * + * @type keytype + * @brief 歌曲数据。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMusicInfo : NSObject +/** + * + * @brief 音乐 ID。 + */ + +@property (nonatomic, copy) NSString * _Nonnull musicId; +/** + * + * @brief 音乐名称。 + */ + +@property (nonatomic, copy) NSString * _Nonnull musicName; +/** + * + * @brief 歌手。 + */ + +@property (nonatomic, copy) NSString * _Nonnull singer; +/** + * + * @brief 版权商 ID。 + */ + +@property (nonatomic, copy) NSString * _Nonnull vendorId; +/** + * + * @brief 版权商名称。 + */ + +@property (nonatomic, copy) NSString * _Nonnull vendorName; +/** + * + * @brief 最新更新时间戳,单位为毫秒。 + */ + +@property (nonatomic, assign) int64_t updateTimestamp; +/** + * + * @brief 封面地址。 + */ + +@property (nonatomic, copy) NSString * _Nonnull posterUrl; +/** + * + * @brief 歌词格式类型,参看 ByteRTCLyricStatus{@link #ByteRTCLyricStatus}。 + */ + +@property (nonatomic, assign) ByteRTCLyricStatus lyricStatus; +/** + * + * @brief 歌曲长度,单位为毫秒。 + */ + +@property (nonatomic, assign) int duration; +/** + * + * @brief 歌曲是否支持打分。 + */ + +@property (nonatomic, assign) BOOL enableScore; +/** + * + * @brief 歌曲高潮片段开始时间,单位为毫秒。 + */ + +@property (nonatomic, assign) int climaxStartTime; +/** + * + * @brief 歌曲高潮片段停止时间,单位为毫秒。 + */ + +@property (nonatomic, assign) int climaxEndTime; +@end + +/** + * + * @type keytype + * @brief 热榜歌曲数据。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCHotMusicInfo : NSObject +/** + * + * @brief 热榜名称。 + */ + +@property (nonatomic, copy) NSString * _Nullable hotName; +/** + * + * @brief 歌曲数据,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + */ + +@property (nonatomic, copy) NSArray * _Nullable musics; +@end + +/** + * + * @type keytype + * @brief 歌曲下载信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCDownloadResult : NSObject +/** + * + * @brief 音乐 ID。 + */ + +@property (nonatomic, copy) NSString * _Nonnull musicId; +/** + * + * @brief 下载文件类型,参看 ByteRTCDownloadFileType{@link #ByteRTCDownloadFileType}。 + */ + +@property (nonatomic, assign) ByteRTCDownloadFileType fileType; +/** + * + * @brief 文件存放路径。 + */ + +@property (nonatomic, copy) NSString * _Nullable filePath; + +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManager.h new file mode 100644 index 0000000..46c8005 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManager.h @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVManager +*/ + +#import +#import "ByteRTCKTVDefines.h" +@class ByteRTCKTVManager; +@class ByteRTCKTVPlayer; + +NS_ASSUME_NONNULL_BEGIN +/** + * + * @type callback + * @brief KTV 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCKTVManagerDelegate +@optional +/** + * + * @type callback + * @brief 歌曲列表回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param musics 歌曲数据数组,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + * @param totalSize 数据条目总数。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onMusicListResult:(NSArray * _Nullable)musics totalSize:(int)totalSize errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 搜索歌曲结果回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param musics 歌曲数据数组,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + * @param totalSize 数据条目总数。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onSearchMusicResult:(NSArray * _Nullable)musics totalSize:(int)totalSize errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 热榜歌曲结果回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param hotMusicInfos 热榜歌曲数据数组,参看 ByteRTCHotMusicInfo{@link #ByteRTCHotMusicInfo}。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onHotMusicResult:(NSArray * _Nullable)hotMusicInfos errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 歌曲详细信息回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param music 歌曲数据,参看 ByteRTCMusicInfo{@link #ByteRTCMusicInfo}。 + * @param errorCode 错误码,成功时返回 0,其余值参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onMusicDetailResult:(ByteRTCMusicInfo * _Nullable)music errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 下载成功回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param downloadId 下载任务 ID。 + * @param result 下载信息,参看 ByteRTCDownloadResult{@link #ByteRTCDownloadResult}。 + * @list 在线 KTV + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onDownloadSuccess:(int)downloadId downloadResult:(ByteRTCDownloadResult *)result; +/** + * + * @type callback + * @brief 下载失败回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param downloadId 下载任务 ID。 + * @param errorCode 错误码,参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list Online Karaoke + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onDownloadFailed:(int)downloadId errorCode:(ByteRTCKTVErrorCode)errorCode; +/** + * + * @type callback + * @brief 歌曲文件下载进度回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param downloadId 下载任务 ID。 + * @param downloadPercentage 下载进度百分比,取值范围 [0,100]。 + * @list 在线 KTV + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onDownloadMusicProgress:(int)downloadId progress:(int)downloadPercentage; +/** + * + * @type callback + * @brief 清理文件缓存结果回调。 + * @param ktvManager 参考 ByteRTCKTVManager{@link #ByteRTCKTVManager}。 + * @param errorCode 错误码,非 0 为失败,参看 ByteRTCKTVErrorCode{@link #ByteRTCKTVErrorCode}。 + * @list Online Karaoke + */ + +- (void)ktvManager:(ByteRTCKTVManager *)ktvManager onClearCacheResult:(ByteRTCKTVErrorCode)errorCode; +@end +/** + * + * @type api + * @brief KTV 管理接口。 + * @list Online Karaoke + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCKTVManager : NSObject + +@property(nonatomic, weak) id delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 获取歌曲列表。 + * @param pageNumber 页码,默认从 1 开始。 + * @param pageSize 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filterType 歌曲过滤方式,参看 ByteRTCMusicFilterType{@link #ByteRTCMusicFilterType}。多个过滤方式可以按位或组合。 + * @note 调用接口后,你会收到 ktvManager:onMusicListResult:totalSize:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onMusicListResult:totalSize:errorCode:} 回调歌曲列表。 + * @list 在线 KTV + */ + +- (void)getMusicList:(int)pageNumber pageSize:(int)pageSize filterType:(ByteRTCMusicFilterType)filterType; +/** + * + * @type api + * @brief 根据关键词搜索歌曲。 + * @param keyWord 关键词,字符串长度最大为 20 个字符。 + * @param pageNumber 页码,默认从 1 开始。 + * @param pageSize 每页显示歌曲的最大数量,取值范围 [1,99]。 + * @param filterType 歌曲过滤方式,参看 ByteRTCMusicFilterType{@link #ByteRTCMusicFilterType}。多个过滤方式可以按位或组合。 + * @note 调用接口后,你会收到 ktvManager:onSearchMusicResult:totalSize:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onSearchMusicResult:totalSize:errorCode:} 回调歌曲列表。 + * @list 在线 KTV + */ + +- (void)searchMusic:(NSString * _Nonnull)keyWord pageNumber:(int)pageNumber pageSize:(int)pageSize filterType:(ByteRTCMusicFilterType)filterType; +/** + * + * @type api + * @brief 指定歌曲榜单,并获取其歌曲列表。 + * @param customHotlistId 榜单 ID 列表。
    + * 默认榜单 ID 有:`ContentCenter` 和 `Project`,分别是火山内容中心热歌榜和项目热歌榜。如果你需要其他榜单,请联系技术支持人员。 + * @param filterType 歌曲过滤方式,参看 ByteRTCMusicFilterType{@link #ByteRTCMusicFilterType}。多个过滤方式可以按位或组合。 + * @note 调用接口后,你会收到 ktvManager:onHotMusicResult:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onHotMusicResult:errorCode:} 回调歌曲列表。 + * @list 在线 KTV + */ + +- (void)getHotMusic:(NSArray *_Nullable)customHotlistId filterType:(ByteRTCMusicFilterType)filterType; +/** + * + * @type api + * @brief 获取音乐详细信息。 + * @param musicId 音乐 ID。 + * @note 调用接口后,你会收到 ktvManager:onMusicDetailResult:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onMusicDetailResult:errorCode:} 回调。 + * @list 在线 KTV + */ + +- (void)getMusicDetail:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 下载音乐。 + * @param musicId 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若音乐下载成功,你会收到 ktvManager:onDownloadSuccess:downloadResult:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadSuccess:downloadResult:} 回调。 + * - 若音乐下载失败,你会收到 ktvManager:onDownloadFailed:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadFailed:errorCode:} 回调。 + * - 音乐下载进度更新时,你会收到 ktvManager:onDownloadMusicProgress:progress:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadMusicProgress:progress:} 回调。 + * @list 在线 KTV + */ + +- (int)downloadMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 下载歌词。 + * @param musicId 音乐 ID。 + * @param lyricType 歌词文件类型,参看 ByteRTCDownloadLyricType{@link #ByteRTCDownloadLyricType}。 + * @return 下载任务 ID。 + * @note + * - 若歌词下载成功,你会收到 ktvManager:onDownloadSuccess:downloadResult:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadSuccess:downloadResult:} 回调。 + * - 若歌词下载失败,你会收到 ktvManager:onDownloadFailed:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadFailed:errorCode:} 回调。 + * @list 在线 KTV + */ + +- (int)downloadLyric:(NSString * _Nonnull)musicId lyricType:(ByteRTCDownloadLyricType)lyricType; +/** + * + * @type api + * @brief 下载 MIDI 文件。 + * @param musicId 音乐 ID。 + * @return 下载任务 ID。 + * @note + * - 若文件下载成功,你会收到 ktvManager:onDownloadSuccess:downloadResult:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadSuccess:downloadResult:} 回调。 + * - 若文件下载失败,你会收到 ktvManager:onDownloadFailed:errorCode:{@link #ByteRTCKTVManagerDelegate#ktvManager:onDownloadFailed:errorCode:} 回调。 + * @list 在线 KTV + */ + +- (int)downloadMidi:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 取消下载任务。 + * @param downloadId 下载任务 ID。 + * @list 在线 KTV + */ + +- (void)cancelDownload:(int)downloadId; +/** + * + * @type api + * @brief 清除当前音乐缓存文件,包括音乐音频和歌词。 + * @list 在线 KTV + */ + +- (void)clearCache; +/** + * + * @type api + * @brief 设置歌曲文件最大占用的本地缓存。 + * @param maxCacheSizeMB 本地缓存,单位 MB。
    + * 设置值小于等于 0 时,使用默认值 1024 MB。 + * @list 在线 KTV + */ + +- (void)setMaxCacheSize:(int)maxCacheSizeMB; +/** + * + * @type api + * @brief 获取 KTV 播放器。 + * @return KTV 播放器接口,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 + * @list 在线 KTV + */ + +- (ByteRTCKTVPlayer * _Nullable)getKTVPlayer; + + +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManagerInternal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManagerInternal.h new file mode 100644 index 0000000..930ece1 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVManagerInternal.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVManager +*/ + +@interface ByteRTCKTVManager () + +- (instancetype)initWithKTVManager:(bytertc::IKTVManager *)ktvManager; + +- (void)destroyResourceInternal; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayer.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayer.h new file mode 100644 index 0000000..abc500c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayer.h @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVPlayer +*/ + +#import +#import "ByteRTCKTVDefines.h" +@class ByteRTCKTVPlayer; + +NS_ASSUME_NONNULL_BEGIN +/** + * + * @type callback + * @brief KTV 播放器回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +@protocol ByteRTCKTVPlayerDelegate +/** + * + * @type callback + * @brief 音乐播放进度回调。 + * @param ktvPlayer 当前 ktvPlayer 对象,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 + * @param musicId 音乐 ID。 + * @param progress 音乐播放进度,单位为毫秒。 + * @list 在线 KTV + */ + +- (void)ktvPlayer:(ByteRTCKTVPlayer *)ktvPlayer onPlayProgress:(NSString *)musicId progress:(int64_t)progress; +/** + * + * @type callback + * @brief 音乐播放状态改变回调。 + * @param ktvPlayer 当前 ktvPlayer 对象,参看 ByteRTCKTVPlayer{@link #ByteRTCKTVPlayer}。 + * @param musicId 音乐 ID。 + * @param state 音乐播放状态,参看 ByteRTCPlayState{@link #ByteRTCPlayState}。 + * @param error 错误码,参看 ByteRTCKTVPlayerErrorCode{@link #ByteRTCKTVPlayerErrorCode}。 + * @note + * 此回调被触发的时机汇总如下:
    + * - 调用 playMusic:audioTrackType:audioPlayType:{@link #ByteRTCKTVPlayer#playMusic:audioTrackType:audioPlayType:} 成功后,会触发 playState 值为 ByteRTCPlayStatePlaying 的回调;否则会触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 使用相同的音乐 ID 重复调用 playMusic:audioTrackType:audioPlayType:{@link #ByteRTCKTVPlayer#playMusic:audioTrackType:audioPlayType:} 后,后一次播放会覆盖前一次,且会触发 playState 值为 ByteRTCPlayStatePlaying 的回调,表示后一次音乐播放已开始。 + * - 调用 pauseMusic:{@link #ByteRTCKTVPlayer#pauseMusic:} 方法暂停播放成功后,会触发 playState 值为 ByteRTCPlayStatePaused 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 调用 resumeMusic:{@link #ByteRTCKTVPlayer#resumeMusic:} 方法恢复播放成功后,会触发 playState 值为 ByteRTCPlayStatePlaying 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 调用 stopMusic:{@link #ByteRTCKTVPlayer#stopMusic:} 方法停止播放成功后,会触发 playState 值为 ByteRTCPlayStateStoped 的回调;否则触发 playState 值为 ByteRTCPlayStateFailed 的回调。 + * - 音乐播放结束会触发 playState 值为 ByteRTCPlayStateFinished 的回调。 + * @list Online Karaoke + */ + +- (void)ktvPlayer:(ByteRTCKTVPlayer *)ktvPlayer onPlayStateChanged:(NSString *)musicId state:(ByteRTCPlayState)state error:(ByteRTCKTVPlayerErrorCode)error; +@end +/** + * + * @type api + * @brief KTV 播放器接口。 + * @list Online Karaoke + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCKTVPlayer : NSObject + +@property(nonatomic, weak) id delegate; + +#pragma mark - Core Methods +/** + * + * @type api + * @brief 播放歌曲。 + * @param musicId 音乐 ID。
    + * 若同一 musicId 的歌曲正在播放,再次调用接口会从开始位置重新播放。若 musicId 对应的音频文件不存在会触发报错。 + * @param trackType 原唱伴唱类型,参看 ByteRTCAudioTrackType{@link #ByteRTCAudioTrackType}。 + * @param playType 音乐播放类型。参看 ByteRTCAudioPlayType{@link #ByteRTCAudioPlayType}。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * - 若音乐文件不存在,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3020,playState 为 4。 + * @list 在线 KTV + */ + +- (void)playMusic:(NSString * _Nonnull)musicId audioTrackType:(ByteRTCAudioTrackType)trackType audioPlayType:(ByteRTCAudioPlayType)playType; +/** + * + * @type api + * @brief 暂停播放歌曲。 + * @param musicId 音乐 ID。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)pauseMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 继续播放歌曲。 + * @param musicId 音乐 ID。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)resumeMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 停止播放歌曲。 + * @param musicId 音乐 ID。 + * @note + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)stopMusic:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param musicId 音乐 ID。 + * @param position 音乐起始位置,单位为毫秒,取值小于音乐文件总时长。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 调用接口后,你会收到 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调歌曲播放状态。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)seekMusic:(NSString * _Nonnull)musicId position:(int)position; +/** + * + * @type api + * @brief 设置歌曲播放音量,只能在开始播放后进行设置。 + * @param musicId 音乐 ID。 + * @param volume 歌曲播放音量,调节范围:[0,400]。
    + * - 0:静音。 + * - 100:原始音量。 + * - 400: 原始音量的 4 倍(自带溢出保护)。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的音量大于 400,则按最大值 400 进行调整;若设置的音量小于 0,则按最小值 0 进行调整。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)setMusicVolume:(NSString * _Nonnull)musicId volume:(int)volume; +/** + * + * @type api + * @brief 切换歌曲原唱伴唱。 + * @param musicId 音乐 ID。 + * @note 调用本接口时音乐必须处于播放中状态。 + * @list 在线 KTV + */ + +- (void)switchAudioTrackType:(NSString * _Nonnull)musicId; +/** + * + * @type api + * @brief 对播放中的音乐设置升降调信息。 + * @param musicId 音乐 ID。 + * @param pitch 相对于音乐文件原始音调的升高/降低值,取值范围 [-12,12],默认值为 0,即不做调整。
    + * 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。 + * @note + * - 调用本接口时音乐必须处于播放中状态。 + * - 若设置的 pitch 大于 12,则按最大值 12 进行调整;若设置的 pitch 小于 –12,则按最小值 –12 进行调整。 + * - 若音乐 ID 错误,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3023,playState 为 4。 + * - 若未进房,会触发 ktvPlayer:onPlayStateChanged:state:error:{@link #ByteRTCKTVPlayerDelegate#ktvPlayer:onPlayStateChanged:state:error:} 回调,errorCode 为 –3022,playState 为 4。 + * @list 在线 KTV + */ + +- (void)setMusicPitch:(NSString * _Nonnull)musicId pitch:(int)pitch; + +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayerInternal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayerInternal.h new file mode 100644 index 0000000..f7a2e5a --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCKTVPlayerInternal.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCKTVPlayer +*/ + +@interface ByteRTCKTVPlayer () + +- (instancetype)initWithKTVPlayer:(bytertc::IKTVPlayer *)ktvPlayer; + +- (void)destroyResourceInternal; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaDefines.h new file mode 100644 index 0000000..2d213fc --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaDefines.h @@ -0,0 +1,4989 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Common Defines +*/ + +#import "ByteRTCRtsDefines.h" +/** + * + * @type keytype + * @brief 方法调用结果。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCReturnStatus) { + /** + * + * @brief 成功。 + */ + + ByteRTCReturnStatusSuccess = 0, + /** + * + * @brief 失败。 + */ + + ByteRTCReturnStatusFailure = -1, + /** + * + * @brief 参数错误。 + */ + + ByteRTCReturnStatusParameterErr = -2, + /** + * + * @brief 接口状态错误。 + */ + + ByteRTCReturnStatusWrongState = -3, + /** + * + * @brief 失败,用户已在房间内。 + */ + + ByteRTCReturnStatusHasInRoom = -4, + /** + * + * @brief 失败,用户已登录。 + */ + + ByteRTCReturnStatusHasInLogin = -5, + /** + * + * @brief 失败,用户已经在进行通话回路测试中。 + */ + + ByteRTCReturnStatusHasInEchoTest = -6, + /** + * + * @brief 失败,音视频均未采集。 + */ + + ByteRTCReturnStatusNeitherVideoNorAudio = -7, + /** + * + * @brief 失败,该 roomId 已被使用。 + */ + + ByteRTCReturnStatusRoomIdInUse = -8, + /** + * + * @brief 失败,屏幕流不支持。 + */ + + ByteRTCReturnStatusScreenNotSupport = -9, + /** + * + * @brief 失败,不支持该操作。 + */ + + ByteRTCReturnStatusNotSupport = -10, + /** + * + * @brief 失败,资源已占用。 + */ + + ByteRTCReturnStatusResourceOverflow = -11, + /** + * + * @brief 失败,没有音频帧。 + */ + + ByteRTCReturnStatusAudioNoFrame = -101, + /** + * + * @brief 失败,未实现。 + */ + + ByteRTCReturnStatusAudioNotImplemented = -102, + /** + * + * @brief 失败,采集设备无麦克风权限,尝试初始化设备失败。 + */ + + ByteRTCReturnStatusAudioNoPermission = -103, + /** + * + * @brief 失败,设备不存在。当前没有设备或设备被移除时返回该值。 + */ + + ByteRTCReturnStatusAudioDeviceNotExists = -104, + /** + * + * @brief 失败,设备音频格式不支持。 + */ + + ByteRTCReturnStatusAudioDeviceFormatNotSupport = -105, + /** + * + * @brief 失败,系统无可用设备。 + */ + + ByteRTCReturnStatusAudioDeviceNoDevice = -106, + /** + * + * @brief 失败,当前设备不可用,需更换设备。 + */ + + ByteRTCReturnStatusAudioDeviceCannotUse = -107, + /** + * + * @brief 系统错误,设备初始化失败。 + */ + + ByteRTCReturnStatusAudioDeviceInitFailed = -108, + /** + * + * @brief 系统错误,设备开启失败。 + */ + + ByteRTCReturnStatusAudioDeviceStartFailed = -109, + /** + * + * @hidden(iOS) + * @brief 暂不支持指定音频进程采集,采集失败。 + */ + + ByteRTCReturnStatusAudioDeviceProcessNotExist = -110, + /** + * + * @brief 失败。底层未初始化,engine 无效。 + */ + + ByteRTCReturnStatusNativeInValid = -201, +}; + +/** + * + * @type keytype + * @brief 房间内远端流移除原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCStreamRemoveReason) { + /** + * + * @brief 远端用户停止发布流。 + */ + + ByteRTCStreamRemoveReasonUnpublish = 0, + /** + * + * @brief 远端用户发布流失败。 + */ + + ByteRTCStreamRemoveReasonPublishFailed = 1, + /** + * + * @brief 媒体服务器 10s 没收到客户端的媒体数据。 + */ + + ByteRTCStreamRemoveReasonKeepLiveFailed = 2, + /** + * + * @brief 远端用户断网。 + */ + + ByteRTCStreamRemoveReasonClientDisconnected = 3, + /** + * + * @brief 远端用户重新发布流。 + */ + + ByteRTCStreamRemoveReasonRepublish = 4, + /** + * + * @brief 其他原因。 + */ + + ByteRTCStreamRemoveReasonOther = 5, + /** + * + * @brief 远端用户 Token 发布权限过期。 + */ + + ByteRTCStreamRemoveReasonPublishPrivilegeExpired = 6, +}; + +/** + * + * @type keytype + * @brief 房间模式
    + * 根据所需场景,选择合适的房间模式,应用不同的音视频算法、视频参数和网络配置
    + * 调用 `setAudioProfile` 改变音频参数配置 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomProfile) { + /** + * + * @brief 默认场景,通用模式
    + * 与 `ByteRTCRoomProfileMeeting = 16` 配置相同。
    + * 你可以联系技术支持更换默认配置参数。 + */ + + ByteRTCRoomProfileCommunication = 0, + /** + * + * @brief 游戏语音模式,低功耗、低流量消耗。
    + * 低端机在此模式下运行时,进行了额外的性能优化:
    + * - 部分低端机型配置编码帧长 40/60 + * - 部分低端机型关闭软件 3A 音频处理 + * 增强对 iOS 其他屏幕录制进行的兼容性,避免音频录制被 RTC 打断。 + */ + + ByteRTCRoomProfileGame = 2, + /** + * + * @brief 云游戏模式。
    + * 如果你的游戏场景需要低延迟的配置,使用此设置。
    + * 此设置下,弱网抗性较差。 + */ + + ByteRTCRoomProfileCloudGame = 3, + /** + * + * @brief 云渲染模式。超低延时配置。
    + * 如果你的应用并非游戏但又对延时要求较高时,选用此模式
    + * 该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。 + */ + + ByteRTCRoomProfileLowLatency = 4, + /** + * + * @brief 适用于 3 人及以上纯语音通话。
    + * 通话中,闭麦时是媒体模式,上麦后切换为通话模式。 + */ + + ByteRTCRoomProfileChatRoom = 6, + /** + * + * @brief 适用于单主播和观众进行音视频互动的直播。通话模式,上下麦不会有模式切换,避免音量突变现象 + */ + + ByteRTCRoomProfileInteractivePodcast = 10, + /** + * + * @brief 适合在线实时合唱场景,高音质,超低延迟。使用本配置前请联系技术支持进行协助完成其他配置。 + */ + + ByteRTCRoomProfileChorus = 12, + /** + * + * @brief 适用于 1 vs 1 游戏串流,支持公网或局域网。 + */ + + ByteRTCRoomProfileGameStreaming = 14, + /** + * + * @brief 适用于云端会议中的个人设备 + */ + + ByteRTCRoomProfileMeeting = 16, + /** + * + * @brief 适用于云端会议中的会议室终端设备,例如 Rooms,投屏盒子等。 + */ + + ByteRTCRoomProfileMeetingRoom = 17, + /** + * + * @brief 适用于课堂互动,房间内所有成员都可以进行音视频互动
    + * 当你的场景中需要同时互动的成员超过 10 人时使用此模式 + */ + + ByteRTCRoomProfileClassroom = 18, + /** + * + * @brief 注重流畅性,缺省码率相对低。适用于通话。 + */ + + ByteRTCRoomProfileCall = 19, + /** + * + * @brief 更注重画质,视频缺省码率相对高。适用于直播互动。 + */ + + ByteRTCRoomProfileLive = 20, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 用户角色。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCUserRoleType) { + /** + * + * @brief 主播角色。该角色用户可在房间内发布和订阅音视频流,房间中的其他用户可以感知到该用户的存在。 + */ + + ByteRTCUserRoleTypeBroadcaster = 1, + /** + * + * @brief 隐身用户角色。此角色用户只可在房间内订阅音视频流,房间中的其他用户无法感知到该用户的存在。 + */ + + ByteRTCUserRoleTypeSilentAudience = 2, +}; + + +typedef NS_ENUM(NSInteger, ByteRTCRoomLiveMode) { + /** + * + * @brief 多人直播、连麦直播等模式。 + */ + + ByteRTCRoomLiveModeCoHost = 1, + /** + * + * @brief 单人直播。 + */ + + ByteRTCRoomLiveModeSoloHost = 2, +}; + +/** + * + * @type keytype + * @brief 用户可见性状态改变错误码。 + */ + + typedef NS_ENUM(NSInteger, ByteRTCUserVisibilityChangeError) { + /** + * + * @brief 成功。 + */ + + ByteRTCUserVisibilityChangeErrorOk = 0, + /** + * + * @brief 未知错误。 + */ + + ByteRTCUserVisibilityChangeErrorUnknown = 1, + /** + * + * @brief 房间内可见用户达到上限。 + */ + + ByteRTCUserVisibilityChangeErrorTooManyVisibleUser = 2, +}; + +/** + * + * @type keytype + * @brief 数据消息来源 + */ + +typedef NS_ENUM(NSInteger, ByteRTCDataMessageSourceType) { + /** + * + * @brief 通过客户端或服务端的插入的自定义消息。 + */ + + ByteRTCDataMessageSourceTypeDefault = 0, + /** + * + * @brief 系统数据,包含音量指示信息。 + */ + + ByteRTCDataMessageSourceTypeSystem = 1, +}; + +/** + * + * @type keytype + * @brief SEI 发送模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSEICountPerFrame) { + /** + * + * @brief 单发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,SEI 数据会按顺序跟随连续的视频帧逐帧发送,单个视频帧最多只有一个 SEI 数据。 + * 例如,假设在某一帧间隔内需要发送 3 个 SEI 数据,那么第 1 个 SEI 会在当前帧发送,第 2 个 SEI 会在下一帧发送,第 3 个 SEI 会在再下一帧发送。 + */ + + ByteRTCSEICountPerFrameSingle = 0, + /** + * + * @brief 多发模式。 + * 在 1 帧间隔内多次发送 SEI 数据时,这些 SEI 数据会全部在下一个视频帧上发送,可降低发送延迟,但一个视频帧会携带多个 SEI 数据。 + * 例如,假设在某一帧间隔内有 3 个 SEI 数据需要发送,这 3 个 SEI 数据将全部在下一个视频帧上发送。 + */ + + ByteRTCSEICountPerFrameMulti = 1, +}; + +/** + * + * @type keytype + * @brief 房间状态码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomState) { + /** + * + * @brief 加入房间成功 + */ + + ByteRTCRoomStateJoinSuccess = 0, + /** + * + * @brief 加入房间失败 + */ + + ByteRTCRoomStateJoinFailed = 1, + /** + * + * @brief 离开房间 + */ + + ByteRTCRoomStateLeft = 2, +}; + +/** + * + * @type keytype + * @brief 房间状态变化原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomStateChangeReason) { + /** + * + * @brief 首次进房成功。 + */ + + ByteRTCRoomStateChangeReasonJoinRoom = 0, + /** + * + * @brief 重新进房,比如断网重连。 + */ + + ByteRTCRoomStateChangeReasonReconnect = 1, + /** + * + * @brief 离开房间。 + */ + + ByteRTCRoomStateChangeReasonLeaveRoom = 2, + + /** + * + * @brief 进房失败。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 初次进房或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + ByteRTCRoomStateChangeReasonJoinRoomFailed = -2001, + + /** + * + * @brief Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 方法更新 Token。 + */ + + ByteRTCRoomStateChangeReasonInvalidToken = -1000, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken:` 传入的 Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonUpdateTokenWithInvalidToken = -1010, + /** + * + * @brief 房间被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonUserForbidden = -1026, + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonKickedOut = -1006, + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonRoomDismiss = -1011, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonDuplicateLogin = -1004, + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 `joinRoom:userInfo:roomConfig:` 方法时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + ByteRTCRoomStateChangeReasonWithoutLicenseAuthenticateSDK = -1012, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonServerLicenseExpired = -1017, + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseNotMatchWithCache = -1024, + /** + * + * @hidden internal use only + * @brief license 计费方法没有加载成功。可能是因为 license 相关插件未正确集成。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomStateChangeReasonLicenseFunctionNotFound = -1027, + /** + * + * @brief 服务端异常状态导致退出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + ByteRTCRoomStateChangeReasonStateAbnormalServerStatus = -1084, + /** + * + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + ByteRTCRoomStateChangeReasonUnknown = -1001 +}; + +/** + * + * @type keytype + * @brief 房间事件码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomEvent) { + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `rtcRoom:onUserJoined:` 和 `rtcEngine:onUserLeave:reason:` 回调,并通过广播提示房间内所有用户。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomEventUserNotifyStop = -2013, + + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + ByteRTCRoomEventForbidden = -2012 +}; + +/** + * + * @type keytype + * @brief 房间事件信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomEventInfo : NSObject + /** + * + * @brief 房间/用户被封禁,通过房间事件通知封禁时间。 + */ + + @property(assign, nonatomic) NSInteger forbiddenTime; +@end + +/** + * + * @type errorcode + * @brief 回调错误码。
    + * SDK 内部遇到不可恢复的错误时,会通过 `rtcEngine:onError:` 回调通知用户。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCErrorCode) { + /** + * + * @brief Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig:} 进房时使用的 Token 参数有误或过期失效。需要重新获取 Token,并调用 updateToken:{@link #ByteRTCRTSRoom#updateToken:} 方法更新 Token。 + */ + + ByteRTCErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + ByteRTCErrorCodeJoinRoom = -1001, + /** + * + * @brief 没有发布音视频流权限。通过以下回调通知:rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:}。
    + * 用户在所在房间中发布音视频流失败,失败原因为用户没有发布流的权限。 + */ + + ByteRTCErrorCodeNoPublishPermission = -1002, + /** + * + * @brief 没有订阅音视频流权限。通过以下回调通知:rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + ByteRTCErrorCodeNoSubscribePermission = -1003, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeDuplicateLogin = -1004, + + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeKickedOut = -1006, + + /** + * + * @brief 当调用 `createRtcRoom:` ,如果 roomId 非法,会返回 null,并抛出该错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeRoomIdIllegal = -1007, + /** + * + * @brief Token 过期。加入房间后 Token 过期时,返回此错误码。需使用新的 Token 重新加入房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken:` 传入的 Token 无效。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeUpdateTokenWithInvalidToken = -1010, + + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeRoomDismiss = -1011, + + /** + * + * @hidden internal use only + * @brief 加入房间错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 调用 `joinRoom:userInfo:roomConfig:` 方法时, LICENSE 计费账号未使用 LICENSE_AUTHENTICATE SDK,加入房间错误。 + */ + + ByteRTCJoinRoomWithoutLicenseAuthenticateSDK = -1012, + + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCRoomAlreadyExist = -1013, + + /** + * + * @brief 加入多个房间时使用了不同的 uid。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * 同一个引擎实例中,用户需使用同一个 uid 加入不同的房间。 + */ + + ByteRTCUserIDDifferent = -1014, + /** + * + * @hidden internal use only + * @brief 服务端 license 过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomServerLicenseExpired = -1017, + /** + * + * @hidden internal use only + * @brief 超过服务端 license 许可的并发量上限,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomExceedsTheUpperLimit = -1018, + /** + * + * @hidden internal use only + * @brief license 参数错误,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseParameterError = -1019, + /** + * + * @hidden internal use only + * @brief license 证书路径错误。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseFilePathError = -1020, + /** + * + * @hidden internal use only + * @brief license 证书不合法。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseIllegal = -1021, + /** + * + * @hidden internal use only + * @brief license 证书已经过期,拒绝进房。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseExpired = -1022, + /** + * + * @hidden internal use only + * @brief license 证书内容不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseInformationNotMatch = -1023, + /** + * + * @hidden internal use only + * @brief license 当前证书与缓存证书不匹配。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomLicenseNotMatchWithCache = -1024, + /** + * + * @brief 房间被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomRoomForbidden = -1025, + /** + * + * @brief 用户被封禁。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCErrorCodeJoinRoomUserForbidden = -1026, + /** + * + * @brief 订阅音视频流失败,订阅音视频流总数超过上限。通过以下回调通知: rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 游戏场景下,为了保证音视频通话的性能和质量,服务器会限制用户订阅的音视频流总数。当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + ByteRTCErrorCodeOverStreamSubscribeLimit = -1070, + /** + * + * @brief 发布流失败,发布流总数超过上限。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调。
    + * RTC 系统会限制单个房间内发布的总流数,总流数包括视频流、音频流和屏幕流。如果房间内发布流数已达上限时,本地用户再向房间中发布流时会失败,同时会收到此错误通知。 + */ + + ByteRTCErrorCodeOverStreamPublishLimit = -1080, + /** + * + * @deprecated since 3.52, use ByteRTCErrorCodeOverStreamPublishLimit-1080)instead + * @brief 发布视频流总数超过上限。
    + * RTC 系统会限制单个房间内发布的视频流数。如果房间内发布视频流数已达上限时,本地用户再向房间中发布视频流时会失败,同时会收到此错误通知。 + */ + + ByteRTCErrorCodeOverVideoPublishLimit = -1082, + /** + * + * @deprecated since 3.60, use ByteRTCAVSyncEventInvalidUidRepeated = 0 carried by rtcRoom:onAVSyncEvent:userId:eventCode:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncEvent:userId:eventCode:} instead. + * @brief 音视频同步失败。
    + * 当前音频源已与其他视频源关联同步关系。
    + * 单个音频源不支持与多个视频源同时同步。
    + * 通过 rtcRoom:onStreamStateChanged:withUid:state:extraInfo: 回调。 + */ + + ByteRTCErrorCodInvalidAudioSyncUidRepeated = -1083, + /** + * + * @brief 服务端异常状态导致退出房间。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + ByteRTCErrorCodeAbnormalServerStatus = -1084, + /** + * + * @hidden for internal use only + * @brief 在一路流推多房间的场景下,在至少有两个房间在发布同一路流时,其中一个房间取消发布失败,此时需要业务方重试或者由业务方通知用户重试取消发布。 + */ + + ByteRTCErrorCodeMultiRoomUnpublishFailed = -1085, + /** + * + * @hidden for internal use only + * @brief 指定服务区域时传入错误参数。 + */ + + ByteRTCErrorCodeWrongAreaCode = -1086, + /** + * + * @hidden for internal use only + * @brief notify deadlock + */ + + ByteRTCErrorCodeDeadLockNotify = -1111, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
    + * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅作通知。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCWarningCode) { + /** + * + * @brief 发布音视频流失败。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调。
    + * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + ByteRTCWarningCodePublishStreamFailed = -2002, + /** + * + * @brief 订阅音视频流失败。通过以下回调通知: rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + ByteRTCWarningCodeSubscribeStreamFailed404 = -2003, + /** + * + * @brief 订阅音视频流失败。通过以下回调通知: rtcRoom:onVideoSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoSubscribeStateChanged:info:state:reason:}、rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason:}。
    + * 当你订阅所在房间中的音视频流时,由于服务器错误导致订阅失败。SDK 会自动重试订阅。 + */ + + ByteRTCWarningCodeSubscribeStreamFailed5xx = -2004, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误,当前代码中未使用。 + */ + + ByteRTCWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + ByteRTCWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 当调用 `setUserVisibility:` 将自身可见性设置为 false 后,再尝试发布流会触发此警告。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调。 + */ + + ByteRTCWarningCodePublishStreamForbidden = -2009, + /** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @brief 自动订阅模式未关闭时,尝试开启手动订阅模式会触发此警告。
    + * 你需在进房前关闭自动订阅模式,再调用 subscribeStreamVideo:subscribe:{@link #ByteRTCRoom#subscribeStreamVideo:subscribe:}/subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe:} 方法手动订阅音视频流。 + */ + + ByteRTCWarningCodeSubscribeStreamForbiden = -2010, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + ByteRTCWarningCodeSendCustomMessage = -2011, + /** + * + * @brief 当房间内人数超过 500 人时,停止向房间内已有用户发送 `rtcEngine:onUserJoined:elapsed:` 和 `rtcEngine:onUserLeave:reason:` 回调,并通过广播提示房间内所有用户。通过 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo:} 回调。 + */ + + ByteRTCWarningCodeCodeUserNotifyStop = -2013, + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布 WTN 流。通过 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason:}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason:} 回调,提示`kPublishStateChangeReasonNoPublishPermission` 回调。 + */ + + ByteRTCWarningCodeUserInPublish = -2014, + /** + * + * @deprecated since 3.45 and will be deleted in 3.51. + * @brief 同样 roomid 的房间已经存在了 + */ + + ByteRTCWarningCodeRoomAlreadyExist = -2015, + + /** + * + * @brief 当前正在进行回路测试,该接口调用无效 + */ + + ByteRTCWarningCodeInEchoTestMode = -2017, + /** + * + * @brief 摄像头权限异常,当前应用没有获取摄像头权限 + */ + + ByteRTCWarningCodeNoCameraPermission = -5001, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNoPermission 代替。
    + * 麦克风权限异常,当前应用没有获取麦克风权限。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNoPermission instead. + */ + + ByteRTCWarningCodeNoMicrophonePermission = -5002, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure 代替。
    + * 音频采集设备启动失败。
    + * 启动音频采集设备失败,当前设备可能被其他应用占用。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure instead. + */ + + ByteRTCWarningCodeAudioDeviceManagerRecordingStartFail = -5003, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure 代替.
    + * 音频播放设备启动失败警告。
    + * 可能由于系统资源不足,或参数错误。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceFailure instead. + */ + + ByteRTCWarningCodeAudioDeviceManagerPlayoutStartFail = -5004, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound 代替。
    + * 无可用音频采集设备。
    + * 启动音频采集设备失败,请插入可用的音频采集设备。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound instead. + */ + + ByteRTCWarningCodeNoRecordingDevice = -5005, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound 代替。
    + * 无可用音频播放设备。
    + * 启动音频播放设备失败,请插入可用的音频播放设备。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceError{@link #ByteRTCMediaDeviceError}.ByteRTCMediaDeviceErrorDeviceNotFound instead. + */ + + ByteRTCWarningCodeNoPlayoutDevice = -5006, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningCaptureSilence 代替。
    + * 当前音频设备没有采集到有效的声音数据,请检查更换音频采集设备。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningCaptureSilence instead. + */ + + ByteRTCWarningCodeRecordingSilence = -5007, + /** + * + * @brief 已在 3.33 版本中废弃,使用 ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningOperationDenied 代替。
    + * 媒体设备误操作警告。
    + * 使用自定义采集时,不可调用内部采集开关,调用时触发此警告。 + * @deprecated since 3.33 and will be deleted in 3.51, use ByteRTCMediaDeviceWarning{@link #ByteRTCMediaDeviceWarning}.ByteRTCMediaDeviceWarningOperationDenied instead. + */ + + ByteRTCWarningCodeMediaDeviceOperationDennied = -5008, + /** + * + * @brief 不支持在 publishScreenAudio: 之后,通过 `setScreenAudioSourceType` 设置屏幕音频采集类型 + */ + + ByteRTCWarningSetScreenAudioSourceTypeFailed = -5009, + + /** + * + * @brief 不支持在 publishScreenAudio: 之后,通过 `setScreenAudioStreamIndex` 设置屏幕音频混流类型 + */ + + ByteRTCWarningSetScreenAudioStreamIndexFailed = -5010, + /** + * + * @brief 设置语音音高不合法 + */ + + ByteRTCWarningInvalidVoicePitch = -5011, + /** + * + * @brief 外部音频源新旧接口混用 + */ + + ByteRTCWarningInvalidCallForExtAudio = -5013, + /** + * + * @brief 指定的内部渲染画布句柄无效。
    + * 当你调用 setLocalVideoCanvas:{@link #ByteRTCEngine#setLocalVideoCanvas:} 或 setRemoteVideoCanvas:withCanvas:{@link #ByteRTCEngine#setRemoteVideoCanvas:withCanvas:} 时指定了无效的画布句柄,触发此回调。 + */ + + ByteRTCWarningCodeInvalidCanvasHandle = -6001, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeInvaildSamiAppkeyORToken = -7002, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeInvaildSamiResourcePath = -7003, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeLoadSamiLibraryFailed = -7004, + + /** + * + * @brief [音频技术](https: + */ + + ByteRTCWarningCodeInvaildSamiEffectType = -7005 +}; + +/** + * + * @type keytype + * @brief 发布状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPublishState) { + /** + * + * @brief 发布成功 + */ + + ByteRTCPublishStatePublish = 0, + /** + * + * @brief 发布失败 + */ + + ByteRTCPublishStateUnpublish = 1 +}; + +/** + * + * @type keytype + * @brief 订阅状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubscribeState) { + /** + * + * @brief 订阅成功 + */ + + ByteRTCSubscribeStateSubscribe = 0, + /** + * + * @brief 订阅失败 + */ + + ByteRTCSubscribeStateUnsubscribe = 1 +}; + +/** + * + * @type keytype + * @brief 发布状态变化原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPublishStateChangeReason) { + /** + * + * @brief 用户调用发布 + */ + + ByteRTCPublishStateChangeReasonPublish = 0, + /** + * + * @brief 用户取消发布 + */ + + ByteRTCPublishStateChangeReasonUnpublish = 1, + /** + * + * @brief 发布 token 没有权限 + */ + + ByteRTCPublishStateChangeReasonNoPublishPermission = 2, + /** + * + * @brief 发布流总数超过上限 + */ + + ByteRTCPublishStateChangeReasonOverStreamPublishLimit = 3, + /** + * + * @brief 在一路流推多房间的场景下,在至少有两个房间在发布同一路流时,其中一个房间取消发布失败 + */ + + ByteRTCPublishStateChangeReasonMultiRoomUnpublishFailed = 4, + /** + * + * @brief 服务器错误导致发布失败 + */ + + ByteRTCPublishStateChangeReasonPublishStreamFailed = 5, + /** + * + * @brief 观众尝试发布操作 + */ + + ByteRTCPublishStateChangeReasonPublishStreamForbidden = 6, + /** + * + * @brief 用户已经在其他房间发布过流,或者用户正在发布。 + */ + + ByteRTCPublishStateChangeReasonUserInPublish = 7, + /** + * + * @brief 其他用户发布了相同streamid的流,导致本端发布的流被踢掉 + */ + + ByteRTCPublishStateChangeReasonStreamPublishByOther = 8, + /** + * + * @brief 流 ID 无效 + */ + + ByteRTCPublishStateChangeReasonStreamIdInvalid = 9 +}; + +/** + * + * @type keytype + * @brief 订阅状态变化原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubscribeStateChangeReason) { + /** + * + * @brief 本端调用订阅 + */ + + ByteRTCSubscribeStateChangeReasonSubscribe = 0, + /** + * + * @brief 本端取消订阅 + */ + + ByteRTCSubscribeStateChangeReasonUnsubscribe = 1, + /** + * + * @brief 远端发布流 + */ + + ByteRTCSubscribeStateChangeReasonRemotePublish = 2, + /** + * + * @brief 远端取消发布流 + */ + + ByteRTCSubscribeStateChangeReasonRemoteUnpublish = 3, + /** + * + * @brief 由于服务器错误导致订阅失败。SDK 会自动重试订阅 + */ + + ByteRTCSubscribeStateChangeReasonStreamFailed5xx = 4, + /** + * + * @brief 当前房间中找不到订阅的音视频流导致订阅失败。SDK 会自动重试订阅,若仍订阅失败则建议你退出重试。 + */ + + ByteRTCSubscribeStateChangeReasonStreamFailed404 = 5, + /** + * + * @brief 当用户订阅的音视频流总数已达上限时,继续订阅更多流时会失败,同时用户会收到此错误通知。 + */ + + ByteRTCSubscribeStateChangeReasonOverStreamSubscribeLimit = 6, + /** + * + * @brief 用户订阅所在房间中的音视频流失败,失败原因为用户没有订阅流的权限。 + */ + + ByteRTCSubscribeStateChangeReasonNoSubscribePermission = 7 +}; + +/** + * + * @type keytype + * @brief 性能相关告警的原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmReason) { + /** + * + * @brief 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。 + */ + + ByteRTCPerformanceAlarmReasonBandwidthFallback = 0, + /** + * + * @brief 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。 + */ + + ByteRTCPerformanceAlarmReasonBandwidthResumed = 1, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足;
    + * 如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。 + */ + + ByteRTCPerformanceAlarmReasonFallback = 2, + /** + * + * @brief 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复;
    + * 如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。 + */ + + ByteRTCPerformanceAlarmReasonResumed = 3, +}; + +/** + * + * @type keytype + * @brief 性能回退的模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPerformanceAlarmMode) { + /** + * + * @brief 未开启发布性能回退 + */ + + ByteRTCPerformanceAlarmModeNormal = 0, + /** + * + * @brief 已开启发布性能回退 + */ + + ByteRTCPerformanceAlarmModeSimulcast = 1, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 设置引擎工作模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMode) { + /** + * + * @brief 通用模式,该模式下只能进行普通会议模式的语音通话,开启自动发布订阅。 + */ + + ByteRTCModeGeneral = 0, + /** + * + * @brief 游戏语音模式,该模式下关闭自动发布订阅,会按照游戏业务的策略进行主动发布订阅语音。 + */ + + ByteRTCModeLocalAudio = 1, +}; +/** + * + * @type keytype + * @brief 发布端音视频流回退选项 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCPublishFallbackOption) { + /** + * + * @brief 上行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + ByteRTCPublishFallbackOptionDisabled = 0, + /** + * + * @brief 上行网络不佳或设备性能不足时,发布的视频流会从大流到小流依次降级,直到与当前网络性能匹配,具体降级规则参看[性能回退](https: + */ + + ByteRTCPublishFallbackOptionSimulcast = 1, +}; + +/** + * + * @hidden + * @deprecated since 3.26 and will be deleted in 3.51, use RoomConfig in joinRoom API instead. + * @type keytype + * @brief 订阅模式选项。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSubscribeMode) { + /** + * + * @brief 自动订阅模式。SDK 会自动为你订阅房间中的每一路流。 + */ + + ByteRTCSubscribeModeAuto = 0, + /** + * + * @brief 手动订阅模式。SDK 不自动订阅房间内的音视频流。你应根据需要调用 `subscribeStream` 方法手动订阅其他用户发布的音视频流。 + */ + + ByteRTCSubscribeModeManual = 1 +}; +/** + * + * @type keytype + * @brief 订阅端音视频流回退选项。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSubscribeFallbackOption) { + /** + * + * @brief 下行网络不佳或设备性能不足时,不对音视频流作回退处理。默认设置。 + */ + + ByteRTCSubscribeFallbackOptionDisabled = 0, + /** + * + * @brief 下行网络不佳或设备性能不足时,对视频流做降级处理,具体降级规则参看[音视频流回退](https: + * 该设置仅对发布端调用 `enableSimulcastMode:` 开启发送多路流功能的情况生效。 + */ + + ByteRTCSubscribeFallbackOptionVideoStreamLow = 1, + /** + * + * @brief 下行网络不佳或设备性能不足时,先对视频流做回退处理。当网络状况不满足接收弱流时,则自动取消接收视频,仅接收音频。
    + * 该设置仅对发布端调用 `enableSimulcastMode:` 开启发送多路流功能的情况生效。 + */ + + ByteRTCSubscribeFallbackOptionAudioOnly = 2, +}; + +/** + * + * @type keytype + * @brief 远端用户优先级。在性能不足需要回退时,会先回退优先级低的用户的音视频流 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRemoteUserPriority) { + /** + * + * @brief 用户优先级为低,默认值 + */ + + ByteRTCRemoteUserPriorityLow = 0, + /** + * + * @brief 用户优先级为正常 + */ + + ByteRTCRemoteUserPriorityMedium = 100, + /** + * + * @brief 用户优先级为高 + */ + + ByteRTCRemoteUserPriorityHigh = 200, +}; + +/** + * + * @type keytype + * @brief 本地用户订阅的远端流触发回退策略的原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCFallbackOrRecoverReason) { + /** + * + * @brief 其他原因,非带宽和性能原因引起的回退或恢复。默认值 + */ + + ByteRTCFallbackOrRecoverReasonUnknown = -1, + /** + * + * @brief 由带宽不足导致的订阅端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeFallbackByBandwidth = 0, + /** + * + * @brief 由性能不足导致的订阅端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeFallbackByPerformance = 1, + /** + * + * @brief 由带宽恢复导致的订阅端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeRecoverByBandwidth = 2, + /** + * + * @brief 由性能恢复导致的订阅端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonSubscribeRecoverByPerformance = 3, + /** + * + * @brief 由带宽不足导致的发布端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonPublishFallbackByBandwidth = 4, + /** + * + * @brief 由性能不足导致的发布端音视频流回退。 + */ + + ByteRTCFallbackOrRecoverReasonPublishFallbackByPerformance = 5, + /** + * + * @brief 由带宽恢复导致的发布端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonPublishRecoverByBandwidth = 6, + /** + * + * @brief 由性能恢复导致的发布端音视频流恢复。 + */ + + ByteRTCFallbackOrRecoverReasonPublishRecoverByPerformance = 7, +}; + +/** + * + * @type keytype + * @brief 本地音频流状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamState) { + /** + * + * @brief 本地音频默认初始状态。
    + * 麦克风停止工作时回调该状态,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorOk + */ + + ByteRTCLocalAudioStreamStateStopped = 0, + /** + * + * @brief 本地音频录制设备启动成功。
    + * 采集到音频首帧时回调该状态,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorOk + */ + + ByteRTCLocalAudioStreamStateRecording = 1, + /** + * + * @brief 本地音频首帧编码成功。
    + * 音频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorOk + */ + + ByteRTCLocalAudioStreamStateEncoding = 2, + /** + * + * @brief 本地音频启动失败,在以下时机回调该状态:
    + * - 本地录音设备启动失败,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorRecordFailure + * - 检测到没有录音设备权限,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamErrorDeviceNoPermission + * - 音频编码失败,对应错误码 ByteRTCLocalAudioStreamError{@link #ByteRTCLocalAudioStreamError} 中的 ByteRTCLocalAudioStreamError + */ + + ByteRTCLocalAudioStreamStateFailed = 3, +}; + +/** + * + * @type keytype + * @brief 本地音频流状态改变时的错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalAudioStreamError) { + /** + * + * @brief 本地音频状态正常 + */ + + ByteRTCLocalAudioStreamErrorOk = 0, + /** + * + * @brief 本地音频出错原因未知 + */ + + ByteRTCLocalAudioStreamErrorFailure = 1, + /** + * + * @brief 没有权限启动本地音频录制设备 + */ + + ByteRTCLocalAudioStreamErrorDeviceNoPermission = 2, + /** + * + * @hidden currently not available + * @brief 本地音频录制设备已经在使用中 + * @note 该错误码暂未使用 + */ + + ByteRTCLocalAudioStreamErrorDeviceBusy = 3, + /** + * + * @brief 本地音频录制失败,建议你检查录制设备是否正常工作 + */ + + ByteRTCLocalAudioStreamErrorRecordFailure = 4, + /** + * + * @brief 本地音频编码失败 + */ + + ByteRTCLocalAudioStreamErrorEncodeFailure = 5, + /** + * + * @brief 没有可用的音频录制设备 + */ + + ByteRTCLocalAudioStreamErrorNoRecordingDevice = 6 +}; + +/** + * + * @type keytype + * @brief 本地视频流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamState) { + /** + * + * @brief 本地视频默认初始状态
    + * 摄像头停止工作时回调该状态,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorOk + */ + + ByteRTCLocalVideoStreamStateStopped = 0, + /** + * + * @brief 本地视频录制设备启动成功
    + * 采集到视频首帧时回调该状态,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorOk + */ + + ByteRTCLocalVideoStreamStateRecording = 1, + /** + * + * @brief 本地视频首帧编码成功
    + * 本地视频首帧编码成功时回调该状态,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorOk + */ + + ByteRTCLocalVideoStreamStateEncoding = 2, + /** + * + * @brief 本地视频启动失败, 在以下时机回调该状态:
    + * - 本地采集设备启动失败,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorCaptureFailure + * - 检测到没有摄像头权限,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorDeviceNoPermission + * - 视频编码失败,对应错误码 ByteRTCLocalVideoStreamError{@link #ByteRTCLocalVideoStreamError} 中的 ByteRTCLocalVideoStreamErrorEncodeFailure + */ + + ByteRTCLocalVideoStreamStateFailed = 3, +}; + +/** + * + * @type keytype + * @brief 本地视频状态改变时的错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalVideoStreamError) { + /** + * + * @brief 本地视频状态正常(本地视频状态改变正常时默认返回值) + */ + + ByteRTCLocalVideoStreamErrorOk = 0, + /** + * + * @brief 本地视频流发布失败 + */ + + ByteRTCLocalVideoStreamErrorFailure = 1, + /** + * + * @brief 没有权限启动本地视频采集设备 + */ + + ByteRTCLocalVideoStreamErrorDeviceNoPermission = 2, + /** + * + * @brief 本地视频采集设备已被占用 + */ + + ByteRTCLocalVideoStreamErrorDeviceBusy = 3, + /** + * + * @brief 本地视频采集设备不存在或已移除 + */ + + ByteRTCLocalVideoStreamErrorDeviceNotFound = 4, + /** + * + * @brief 本地视频采集失败,建议检查采集设备是否正常工作 + */ + + ByteRTCLocalVideoStreamErrorCaptureFailure = 5, + /** + * + * @brief 本地视频编码失败 + */ + + ByteRTCLocalVideoStreamErrorEncodeFailure = 6, + /** + * + * @brief 通话过程中本地视频采集设备被其他程序抢占,导致设备连接中断 + */ + + ByteRTCLocalVideoStreamErrorDeviceDisconnected = 7, +}; + +/** + * + * @type keytype + * @brief 用户订阅的远端音频流状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioState) { + /** + * + * @brief 远端音频流默认初始状态,在以下时机回调该状态:
    + * - 本地用户停止接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonLocalMuted` + * - 远端用户停止发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonRemoteMuted` + * - 远端用户离开房间,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonRemoteOffline` + */ + + ByteRTCRemoteAudioStateStopped = 0, + /** + * + * @brief 开始接收远端音频流首包。 + */ + + ByteRTCRemoteAudioStateStarting = 1, + /** + * + * @brief 远端音频流正在解码,正常播放,在以下时机回调该状态:
    + * - 成功解码远端音频首帧,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonLocalUnmuted` + * - 网络由阻塞恢复正常,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonNetworkRecovery` + * - 本地用户恢复接收远端音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonLocalUnmuted` + * - 远端用户恢复发送音频流,对应原因是 ByteRTCRemoteAudioStateChangeReason{@link #ByteRTCRemoteAudioStateChangeReason} 中的 `ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted` + */ + + ByteRTCRemoteAudioStateDecoding = 2, + /** + * + * @brief 远端音频流卡顿。 + */ + + ByteRTCRemoteAudioStateFrozen = 3, + /** + * + * @hidden currently not available + * @brief 远端音频流播放失败 + * @note 该错误码暂未使用 + */ + + ByteRTCRemoteAudioStateFailed = 4, +}; + +/** + * + * @type keytype + * @brief 接收远端音频流状态改变的原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteAudioStateChangeReason) { + /** + * + * @brief 内部原因 + */ + + ByteRTCRemoteAudioStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + ByteRTCRemoteAudioStateChangeReasonNetworkCongestion = 1, + /** + * + * @brief 网络恢复正常 + */ + + ByteRTCRemoteAudioStateChangeReasonNetworkRecovery = 2, + /** + * + * @brief 本地用户停止接收远端音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonLocalMuted = 3, + /** + * + * @brief 本地用户恢复接收远端音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonLocalUnmuted = 4, + /** + * + * @brief 远端用户停止发送音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonRemoteMuted = 5, + /** + * + * @brief 远端用户恢复发送音频流 + */ + + ByteRTCRemoteAudioStateChangeReasonRemoteUnmuted = 6, + /** + * + * @brief 远端用户离开房间 + */ + + ByteRTCRemoteAudioStateChangeReasonRemoteOffline = 7, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoState) { + /** + * + * @brief 远端视频流默认初始状态, 在以下时机回调该状态:
    + * - 本地用户停止接收远端视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalMuted + * - 远端用户停止发送视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonRemoteMuted + * - 远端用户离开房间,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonRemoteOffline + */ + + ByteRTCRemoteVideoStateStopped = 0, + /** + * + * @brief 本地用户已接收远端视频首包
    + * 收到远端视频首包时回调该状态,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + */ + + ByteRTCRemoteVideoStateStarting = 1, + /** + * + * @brief 远端视频流正在解码,正常播放, 在以下时机回调该状态:
    + * - 成功解码远端视频首帧,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + * - 网络由阻塞恢复正常,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonNetworkRecovery + * - 本地用户恢复接收远端视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonLocalUnmuted + * - 远端用户恢复发送视频流,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted + */ + + ByteRTCRemoteVideoStateDecoding = 2, + /** + * + * @brief 远端视频流卡顿
    + * 网络阻塞、丢包率等原因造成视频卡顿流时会回报该状态,对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonNetworkCongestion + */ + + ByteRTCRemoteVideoStateFrozen = 3, + /** + * + * @brief 远端视频流播放失败
    + * 如果内部处理远端视频流失败,则会回调该方法, 对应错误码 ByteRTCRemoteVideoStateChangeReason{@link #ByteRTCRemoteVideoStateChangeReason} 中的 ByteRTCRemoteVideoStateChangeReasonInternal + */ + + ByteRTCRemoteVideoStateFailed = 4, +}; + +/** + * + * @type keytype + * @brief 远端视频流状态改变的原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoStateChangeReason) { + /** + * + * @brief 内部原因 + */ + + ByteRTCRemoteVideoStateChangeReasonInternal = 0, + /** + * + * @brief 网络阻塞 + */ + + ByteRTCRemoteVideoStateChangeReasonNetworkCongestion = 1, + /** + * + * @brief 网络恢复正常 + */ + + ByteRTCRemoteVideoStateChangeReasonNetworkRecovery = 2, + /** + * + * @brief 本地用户停止接收远端视频流或本地用户禁用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonLocalMuted = 3, + /** + * + * @brief 本地用户恢复接收远端视频流或本地用户启用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonLocalUnmuted = 4, + /** + * + * @brief 远端用户停止发送视频流或远端用户禁用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonRemoteMuted = 5, + /** + * + * @brief 远端用户恢复发送视频流或远端用户启用视频模块 + */ + + ByteRTCRemoteVideoStateChangeReasonRemoteUnmuted = 6, + /** + * + * @brief 远端用户离开房间 + */ + + ByteRTCRemoteVideoStateChangeReasonRemoteOffline = 7, +}; + +/** + * + * @type keytype + * @brief 当前媒体设备类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceType) { + /** + * + * @brief 未知音频设备 + */ + + ByteRTCMediaDeviceTypeAudioUnknown = -1, + /** + * + * @brief 音频渲染设备类型 + */ + + ByteRTCMediaDeviceTypeAudioRenderDevice = 0, + /** + * + * @brief 音频采集设备类型 + */ + + ByteRTCMediaDeviceTypeAudioCaptureDevice = 1, + /** + * + *@hidden currently not available + * @brief 视频渲染设备类型,该类型暂无使用 + */ + + ByteRTCMediaDeviceTypeVideoRenderDevice = 2, + /** + * + * @brief 视频采集设备类型 + */ + + ByteRTCMediaDeviceTypeVideoCaptureDevice = 3, + /** + * + * @brief 屏幕流视频设备 + */ + + ByteRTCMediaDeviceTypeScreenVideoCaptureDevice = 4, + /** + * + * @brief 屏幕流音频设备 + */ + + ByteRTCMediaDeviceTypeScreenAudioCaptureDevice = 5 +}; + +/** + * + * @type keytype + * @brief 媒体设备状态
    + * 通过 `rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:` 或 `rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:` 回调设备状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceState) { + /** + * + * @brief 设备已开启 + */ + + ByteRTCMediaDeviceStateStarted = 1, + /** + * + * @brief 设备已停止 + */ + + ByteRTCMediaDeviceStateStopped = 2, + /** + * + * @brief 设备运行时错误
    + * 例如,当媒体设备的预期行为是正常采集,但没有收到采集数据时,将回调该状态。 + */ + + ByteRTCMediaDeviceStateRuntimeError = 3, + /** + * + * @brief 设备已插入
    + * 你可以调用获取设备接口更新设备列表。 + */ + + ByteRTCMediaDeviceStateAdded = 10, + /** + * + * @brief 设备被移除
    + * 你可以调用获取设备接口更新设备列表。 + */ + + ByteRTCMediaDeviceStateRemoved = 11, + /** + * + * @brief 系统通话,锁屏或第三方应用打断了音视频通话。将在通话结束或第三方应用结束占用后自动恢复。 + */ + + ByteRTCMediaDeviceStateInterruptionBegan = 12, + /** + * + * @brief 音视频通话已从系统电话或第三方应用打断中恢复 + */ + + ByteRTCMediaDeviceStateInterruptionEnded = 13, + /** + * + * @hidden(iOS) + * @brief 获取设备列表超时后,收到设备列表通知。
    + * 再次调用获取设备接口更新设备列表。 + */ + + ByteRTCMediaDeviceListUpdated = 16, + +}; + +/** + * + * @type keytype + * @brief 媒体设备错误类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceError) { + /** + * + * @brief 媒体设备正常 + */ + + ByteRTCMediaDeviceErrorOK = 0, + /** + * + * @brief 没有权限启动媒体设备 + */ + + ByteRTCMediaDeviceErrorDeviceNoPermission = 1, + /** + * + * @brief 媒体设备已经在使用中 + */ + + ByteRTCMediaDeviceErrorDeviceBusy = 2, + /** + * + * @brief 媒体设备错误 + */ + + ByteRTCMediaDeviceErrorDeviceFailure = 3, + /** + * + * @brief 未找到指定的媒体设备 + */ + + ByteRTCMediaDeviceErrorDeviceNotFound = 4, + /** + * + * @brief 媒体设备被移除 + */ + + ByteRTCMediaDeviceErrorDeviceDisconnected = 5, + /** + * + * @brief 无采集数据。当媒体设备的预期行为是正常采集,但没有收到采集数据时,将收到该错误。 + */ + + ByteRTCMediaDeviceErrorDeviceNoCallback = 6, + /** + * + * @brief 设备采样率不支持 + */ + + ByteRTCMediaDeviceErrorUNSupportFormat = 7, + /** + * + * @hidden(macOS) + * @brief iOS 屏幕采集没有 group Id 参数 + */ + + ByteRTCMediaDeviceErrorNotFindGroupId = 8, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:因用户使用系统相机,应用切换到后台运行,导致采集中断。 + */ + + ByteRTCMediaDeviceErrorNotAvailableInBackground = 9, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:可能由于其他应用占用系统相机,导致视频设备暂时不可用,从而造成采集中断。 + */ + + ByteRTCMediaDeviceErrorVideoInUseByAnotherClient = 10, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:当前应用处于侧拉、分屏或者画中画模式时,导致采集中断。 + */ + + ByteRTCMediaDeviceErrorNotAvailableWithMultipleForegroundApps = 11, + /** + * + * @hidden(macOS) + * @brief 视频采集中断:由于系统性能不足导致中断,比如设备过热。 + */ + + ByteRTCMediaDeviceErrorNotAvailableDueToSystemPressure = 12, + /** + * + * @hidden(iOS) + * @brief 系统服务错误或长时间不响应,建议重启音频服务进程或重启设备。 + */ + + ByteRTCMediaDeviceErrorAudioServerNeedRestart = 13, +}; + +/** + * + * @type keytype + * @brief 媒体设备警告 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaDeviceWarning) { + /** + * + * @brief 无警告 + */ + + ByteRTCMediaDeviceWarningOK = 0, + /** + * + * @brief 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。 + */ + + ByteRTCMediaDeviceWarningOperationDenied = 1, + /** + * + * @brief 采集到的数据为静音帧。 + */ + + ByteRTCMediaDeviceWarningCaptureSilence = 2, + + /** + * + * @hidden for internal use only + * @brief 音量过大,超过设备采集范围。建议降低麦克风音量或者降低声源音量。 + */ + + ByteRTCMediaDeviceWarningDetectClipping = 10, + /** + * + * @brief 通话中出现回声现象。
    + * 当 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} 为 `ByteRTCRoomProfileMeeting` 和 `ByteRTCRoomProfileMeetingRoom` ,且 AEC 关闭时,SDK 自动启动回声检测,如果检测到回声问题,将通过 `rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning:` 返回本枚举值。 + */ + + ByteRTCMediaDeviceWarningDetectLeakEcho = 11, + /** + * + * @hidden for internal use only + * @brief 低信噪比 + */ + + ByteRTCMediaDeviceWarningDetectLowSNR = 12, + /** + * + * @hidden for internal use only + * @brief 采集插零现象 + */ + + ByteRTCMediaDeviceWarningDetectInsertSilence = 13, + /** + * + * @hidden for internal use only + * @brief 设备采集静音 + */ + + ByteRTCMediaDeviceWarningCaptureDetectSilence = 14, + /** + * + * @hidden for internal use only + * @brief 设备采集静音消失 + */ + + ByteRTCMediaDeviceWarningCaptureDetectSilenceDisappear = 15, + /** + * + * @brief 啸叫。触发该回调的情况如下:1)不支持啸叫抑制的房间模式下,检测到啸叫;2)支持啸叫抑制的房间模式下,检测到未被抑制的啸叫。
    + * 仅 ByteRTCRoomProfileCommunication、ByteRTCRoomProfileMeeting、ByteRTCRoomProfileMeetingRoom 三种房间模式支持啸叫抑制。
    + * 建议提醒用户检查客户端的距离或将麦克风和扬声器调至静音。 + */ + + ByteRTCMediaDeviceWarningCaptureDetectHowling = 16, + /** + * + * @hidden(macOS) + * @brief 当前 AudioScenario 不支持更改音频路由,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteInvalidScenario = 20, + /** + * + * @hidden(macOS) + * @brief 音频设备不存在,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteNotExists = 21, + /** + * + * @hidden(macOS) + * @brief 音频路由被系统或其他应用占用,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteFailedByPriority = 22, + /** + * + * @hidden(macOS) + * @brief 当前非通话模式 ByteRTCAudioScenarioCommunication,不支持设置音频路由 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteNotVoipMode = 23, + /** + * + * @hidden(macOS) + * @brief 音频设备未启动,设置音频路由失败 + */ + + ByteRTCMediaDeviceWarningSetAudioRouteDeviceNotStart = 24, + /** + * + * @hidden(macOS) + * @brief 非纯媒体音频场景,此时不支持切换蓝牙传输协议。待切换至纯媒体音频场景后生效。 + */ + + ByteRTCMediaDeviceWarningSetBluetoothModeScenarioUnsupport = 25, + /** + * + * @hidden(macOS) + * @brief 当前不支持设置 HFP。 + */ + + ByteRTCMediaDeviceWarningSetBluetoothModeUnsupport = 26 +}; + +/** + * + * @type keytype + * @brief 音视频质量反馈问题类型 + */ + +typedef NS_OPTIONS(uint64_t, ByteRTCProblemFeedbackOption) { + /** + * + * @brief 没有问题 + */ + + ByteRTCProblemFeedbackOptionNone = 0, + /** + * + * @brief 其他问题 + */ + + ByteRTCProblemFeedbackOptionOtherMessage = (1ULL << 0), + /** + * + * @brief 连接失败 + */ + + ByteRTCProblemFeedbackOptionDisconnected = (1ULL << 1), + /** + * + * @brief 耳返延迟大 + */ + + ByteRTCProblemFeedbackOptionEarBackDelay = (1ULL << 2), + /** + * + * @brief 本端有杂音 + */ + + ByteRTCProblemFeedbackOptionLocalNoise = (1ULL << 10), + /** + * + * @brief 本端声音卡顿 + */ + + ByteRTCProblemFeedbackOptionLocalAudioLagging = (1ULL << 11), + /** + * + * @brief 本端无声音 + */ + + ByteRTCProblemFeedbackOptionLocalNoAudio = (1ULL << 12), + /** + * + * @brief 本端声音大/小 + */ + + ByteRTCProblemFeedbackOptionLocalAudioStrength = (1ULL << 13), + /** + * + * @brief 本端有回声 + */ + + ByteRTCProblemFeedbackOptionLocalEcho = (1ULL << 14), + /** + * + * @brief 本端视频模糊 + */ + + ByteRTCProblemFeedbackOptionLocalVideoFuzzy = (1ULL << 24), + /** + * + * @brief 本端音视频不同步 + */ + + ByteRTCProblemFeedbackOptionLocalNotSync = (1ULL << 25), + /** + * + * @brief 本端视频卡顿 + */ + + ByteRTCProblemFeedbackOptionLocalVideoLagging = (1ULL << 26), + /** + * + * @brief 本端无画面 + */ + + ByteRTCProblemFeedbackOptionLocalNoVideo = (1ULL << 27), + /** + * + * @brief 远端有杂音 + */ + + ByteRTCProblemFeedbackOptionRemoteNoise = (1ULL << 37), + /** + * + * @brief 远端声音卡顿 + */ + + ByteRTCProblemFeedbackOptionRemoteAudioLagging = (1ULL << 38), + /** + * + * @brief 远端无声音 + */ + + ByteRTCProblemFeedbackOptionRemoteNoAudio = (1ULL << 39), + /** + * + * @brief 远端声音大/小 + */ + + ByteRTCProblemFeedbackOptionRemoteAudioStrength = (1ULL << 40), + /** + * + * @brief 远端有回声 + */ + + ByteRTCProblemFeedbackOptionRemoteEcho = (1ULL << 41), + /** + * + * @brief 远端视频模糊 + */ + + ByteRTCProblemFeedbackOptionRemoteVideoFuzzy = (1ULL << 51), + /** + * + * @brief 远端音视频不同步 + */ + + ByteRTCProblemFeedbackOptionRemoteNotSync = (1ULL << 52), + /** + * + * @brief 远端视频卡顿 + */ + + ByteRTCProblemFeedbackOptionRemoteVideoLagging = (1ULL << 53), + /** + * + * @brief 远端无画面 + */ + + ByteRTCProblemFeedbackOptionRemoteNoVideo = (1ULL << 54) +}; + +/** + * + * @type keytype + * @brief 通话质量反馈房间信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCProblemFeedbackRoomInfo: NSObject + /** + * + * @brief 通话质量反馈的房间 ID + */ + + @property(nonatomic, copy) NSString * _Nonnull roomId; + + /** + * + * @brief 通话质量反馈的用户 ID + */ + + @property(nonatomic, copy) NSString * _Nonnull userId; +@end + +/** + * + * @type keytype + * @brief 通话质量反馈信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCProblemFeedbackInfo: NSObject + /** + * + * @brief 通话质量反馈的文字描述 + */ + + @property(nonatomic, copy) NSString * _Nonnull problemDesc; + + /** + * + * @brief 通话质量反馈的房间信息。参看 ByteRTCProblemFeedbackRoomInfo{@link #ByteRTCProblemFeedbackRoomInfo}。 + */ + + @property(nonatomic, strong) NSArray * _Nullable roomInfo; + +@end + +/** + * + * @type keytype + * @brief 首帧发送状态 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCFirstFrameSendState) { + /** + * + * @brief 发送中 + */ + + ByteRTCFirstFrameSendStateSending = 0, + /** + * + * @brief 发送成功 + */ + + ByteRTCFirstFrameSendStateSent = 1, + /** + * + * @brief 发送失败 + */ + + ByteRTCFirstFrameSendStateEnd = 2, +}; + +/** + * + * @type keytype + * @brief 首帧播放状态 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCFirstFramePlayState) { + /** + * + * @brief 播放中 + */ + + ByteRTCFirstFramePlayStatePlaying = 0, + /** + * + * @brief 播放成功 + */ + + ByteRTCFirstFramePlayStatePlay = 1, + /** + * + * @brief 播放失败 + */ + + ByteRTCFirstFramePlayStateEnd = 2, +}; + +/** + * + * @type keytype + * @brief 自定义加密类型 + */ + +typedef NS_OPTIONS(NSUInteger, ByteRTCEncryptType) { + /** + * + * @brief 不使用内置加密。默认值。 + */ + + ByteRTCEncryptTypeCustomize = 0, + /** + * + * @brief AES-128-CBC 加密算法 + */ + + ByteRTCEncryptTypeAES128CBC = 1, + /** + * + * @brief AES-256-CBC 加密算法 + */ + + ByteRTCEncryptTypeAES256CBC = 2, + /** + * + * @brief AES-128-ECB 加密算法 + */ + + ByteRTCEncryptTypeAES128ECB = 3, + /** + * + * @brief AES-256-ECB 加密算法 + */ + + ByteRTCEncryptTypeAES256ECB = 4 +}; + +/** + * + * @type keytype + * @brief 视频编码类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoCodecType) { + /** + * + * @brief 未知类型 + */ + + ByteRTCVideoCodecTypeUnknown = 0, + /** + * + * @brief 标准 H264 编码格式 + */ + + ByteRTCVideoCodecTypeH264 = 1, + /** + * + * @brief ByteVC1 编码器 + */ + + ByteRTCVideoCodecTypeByteVC1 = 2, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSuperResolutionMode) { + /** + * + * @brief 关闭超分。 + */ + + ByteRTCVideoSuperResolutionModeOff = 0, + /** + * + * @brief 开启超分。 + */ + + ByteRTCVideoSuperResolutionModeOn = 1, +}; + +/** + * + * @hidden(macOS) for internal use + * @type keytype + * @brief 视频降噪模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDenoiseMode) { + /** + * + * @brief 视频降噪关闭。 + */ + + ByteRTCVideoDenoiseModeOff = 0, + /** + * + * @brief 视频降噪开启,由 ByteRTC 后台配置视频降噪算法。 + */ + + ByteRTCVideoDenoiseModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 音视频流的发送/播放状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMuteState) { + /** + * + * @brief 发送 + */ + + ByteRTCMuteStateOff = 0, + /** + * + * @brief 停止发送 + */ + + ByteRTCMuteStateOn = 1, +}; + +/** + * + * @type keytype + * @brief 黑帧视频流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSEIStreamEventType) { + /** + * + * @brief 远端用户发布黑帧视频流。
    + * 纯语音通话场景下,远端用户调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 发送 SEI 数据时,SDK 会自动发布一路黑帧视频流,并触发该回调。 + */ + + ByteRTCSEIStreamEventTypeStreamAdd = 0, + /** + * + * @brief 远端黑帧视频流移除。该回调的触发时机包括:
    + * - 远端用户开启摄像头采集,由语音通话切换至视频通话,黑帧视频流停止发布; + * - 远端用户调用 sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} 后 1min 内未有 SEI 数据发送,黑帧视频流停止发布; + * - 远端用户调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 切换至自定义视频采集时,黑帧视频流停止发布。 + */ + + ByteRTCSEIStreamEventTypeStreamRemove = 1, +}; + +/** + * + * @type keytype + * @brief 预留字段。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCStreamIndex) { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
    + * - 由摄像头/麦克风通过内部采集机制,采集到的视频/音频; + * - 通过自定义采集,采集到的视频/音频。 + */ + + ByteRTCStreamIndexMain = 0, + /** + * + * @hidden for internal use only + * @brief 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。 + */ + + ByteRTCStreamIndexScreen = 1, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex3rd, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex4th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex5th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex6th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndex7th, + /** + * + * @hidden for internal use only + */ + + ByteRTCStreamIndexMax, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 人声检测结果 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioVADType) { + /** + * + * @brief 未检测到人声 + */ + + ByteRTCAudioVADTypeNoSpeech = 0, + /** + * + * @brief 检测到人声。 + */ + + ByteRTCAudioVADTypeSpeech = 1, +}; + +/** + * + * @valid since 3.56 + * @type keytype + * @brief 流聚合策略 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAggregationOption) { + /** + * + * @brief 流聚合向下取值 (默认策略) + */ + + ByteRTCAggregationOptionMin = 0, + /** + * + * @brief 流聚合向上取值 + */ + + ByteRTCAggregationOptionMax = 1, + /** + * + * @brief 流聚合按比例取值,比例相同时,向下取值 + */ + + ByteRTCAggregationOptionMajority = 2 +}; + +/** + * + * @type keytype + * @brief 媒体流信息同步的流类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSyncInfoStreamType) { + /** + * + * @brief 音频流 + */ + + ByteRTCSyncInfoStreamTypeAudio = 0 +}; + +/** + * + * @type keytype + * @brief 颜色空间 + */ + +typedef NS_ENUM(NSInteger, ByteRTCColorSpace) { + /** + * + * @brief 未知的颜色空间,默认使用 kColorSpaceYCbCrBT601LimitedRange 颜色空间 + */ + + ByteRTCColorSpaceUnknown = 0, + /** + * + * @brief BT.601 数字编码标准,颜色空间[16-235] + */ + + ByteRTCColorSpaceYCbCrBT601LimitedRange = 1, + /** + * + * @brief BT.601 数字编码标准,颜色空间[0-255] + */ + + ByteRTCColorSpaceYCbCrBT601FullRange = 2, + /** + * + * @brief BT.7091 数字编码标准,颜色空间[16-235] + */ + + ByteRTCColorSpaceYCbCrBT709LimitedRange = 3, + /** + * + * @brief BT.7091 数字编码标准,颜色空间[0-255] + */ + + ByteRTCColorSpaceYCbCrBT709FullRange = 4 +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCForwardStreamState) { + /** + * + * @brief 空闲状态
    + * - 成功调用 `stopForwardStreamToRooms` 后,所有目标房间为空闲状态。 + * - 成功调用 `updateForwardStreamToRooms` 减少目标房间后,本次减少的目标房间为空闲状态。 + */ + + ByteRTCForwardStreamStateIdle = 0, + /** + * + * @brief 开始转发
    + * - 调用 `startForwardStreamToRooms` 成功向所有房间开始转发媒体流后,返回此状态。 + * - 调用 `updateForwardStreamToRooms` 后,成功向新增目标房间开始转发媒体流后,返回此状态。 + */ + + ByteRTCForwardStreamStateSuccess = 1, + /** + * + * @brief 转发失败,失败详情参考 ByteRTCForwardStreamError{@link #ByteRTCForwardStreamError}
    + * 调用 `startForwardStreamToRooms` 或 `updateForwardStreamToRooms` 后,如遇转发失败,返回此状态。 + */ + + ByteRTCForwardStreamStateFailure = 2, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发过程中抛出的错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCForwardStreamError) { + /** + * + * @brief 正常 + */ + + ByteRTCForwardStreamErrorOK = 0, + /** + * + * @brief 参数异常 + */ + + ByteRTCForwardStreamErrorInvalidArgument = 1201, + /** + * + * @brief Token 错误 + */ + + ByteRTCForwardStreamErrorInvalidToken = 1202, + /** + * + * @brief 服务端异常 + */ + + ByteRTCForwardStreamErrorResponse = 1203, + /** + * + * @brief 目标房间有相同 user id 的用户加入,转发中断 + */ + + ByteRTCForwardStreamErrorRemoteKicked = 1204, + /** + * + * @brief 服务端不支持转发功能 + */ + + ByteRTCForwardStreamErrorNotSupport = 1205, +}; + +/** + * + * @type keytype + * @brief 媒体流跨房间转发事件 + */ + +typedef NS_ENUM(NSInteger, ByteRTCForwardStreamEvent) { + /** + * + * @brief 本端与服务器网络连接断开,暂停转发。 + */ + + ByteRTCForwardStreamEventDisconnected = 0, + /** + * + * @brief 本端与服务器网络连接恢复,转发服务连接成功。 + */ + + ByteRTCForwardStreamEventConnected = 1, + /** + * + * @brief 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。 + */ + + ByteRTCForwardStreamEventInterrupt = 2, + /** + * + * @brief 目标房间已更新,由 `updateForwardStreamToRooms` 触发。 + */ + + ByteRTCForwardStreamEventDstRoomUpdated = 3, + /** + * + * @brief API 调用时序错误。例如,在调用 `startForwardStreamToRooms` 之前调用 `updateForwardStreamToRooms` 。 + */ + + ByteRTCForwardStreamEventUnExpectAPICall = 4, +}; + +/** + * + * @type keytype + * @brief 本地录制的状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingState) { + /** + * + * @brief 录制异常 + */ + + ByteRTCRecordingStateError = 0, + /** + * + * @brief 录制进行中 + */ + + ByteRTCRecordingStateProcessing = 1, + /** + * + * @brief 录制文件保存成功。调用 stopFileRecording 结束录制之后会收到该状态码。或者在 stopFileRecording 之前编码分辨率发生了变化同样会回调该状态码,且 SDK内部会自动重启录制产生新的录制文件直到调用 stopFileRecording + */ + + ByteRTCRecordingStateSuccess = 2, +}; + +/** + * + * @type keytype + * @brief 本地录制错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingErrorCode) { + /** + * + * @brief 录制正常 + */ + + ByteRTCRecordingErrorCodeOk = 0, + /** + * + * @brief 没有文件写权限 + */ + + ByteRTCRecordingErrorCodeNoPermission = -1, + /** + * + * @brief 当前版本 SDK 不支持本地录制功能,请联系技术支持人员 + */ + + ByteRTCRecordingErrorCodeNotSupport = -2, + /** + * + * @brief 其他异常 + */ + + ByteRTCRecordingErrorCodeOther = -3, +}; + +/** + * + * @type keytype + * @brief 本地录制文件的存储格式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingFileType) { + /** + * + * @brief aac 格式文件 + */ + + ByteRTCRecordingFileTypeAAC = 0, + /** + * + * @brief mp4 格式文件 + */ + + ByteRTCRecordingFileTypeMP4 = 1, +}; + +/** + * + * @type keytype + * @brief 音视频同步状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAVSyncState) { + /** + * + * @brief 音视频开始同步 + */ + + ByteRTCAVSyncStateAVStreamSyncBegin = 0, + /** + * + * @brief 音视频同步过程中音频移除,但不影响当前的同步关系 + */ + + ByteRTCAVSyncStateAudioStreamRemove = 1, + /** + * + * @brief 音视频同步过程中视频移除,但不影响当前的同步关系 + */ + + ByteRTCAVSyncStateVideoStreamRemove = 2, + /** + * + * @hidden for internal use only + * @brief 订阅端设置同步 + */ + + ByteRTCAVSyncStateSetAVSyncStreamId = 3, +}; + +/** + * + * @type keytype + * @brief AVSync 事件类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAVSyncEvent) { + /** + * + * @brief 音视频同步失败。
    + * 当前音频源已与其他视频源关联同步关系。
    + * 单个音频源不支持与多个视频源同时同步。 + */ + + ByteRTCAVSyncEventInvalidUidRepeated = 0, +}; +/** + * + * @type keytype + * @brief 音视频回路测试结果 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEchoTestResult) { + /** + * + * @brief 接收到采集的音视频的回放,通话回路检测成功 + */ + + ByteRTCEchoTestResultSuccess = 0, + /** + * + * @brief 测试超过 60s 仍未完成,已自动停止 + */ + + ByteRTCEchoTestResultTimeout = 1, + /** + * + * @brief 上一次测试结束和下一次测试开始之间的时间间隔少于 5s + */ + + ByteRTCEchoTestResultIntervalShort = 2, + /** + * + * @brief 音频采集异常 + */ + + ByteRTCEchoTestResultAudioDeviceError = 3, + /** + * + * @brief 视频采集异常 + */ + + ByteRTCEchoTestResultVideoDeviceError = 4, + /** + * + * @brief 音频接收异常 + */ + + ByteRTCEchoTestResultAudioReceiveError = 5, + /** + * + * @brief 视频接收异常 + */ + + ByteRTCEchoTestResultVideoReceiveError = 6, + /** + * + * @brief 内部错误,不可恢复 + */ + + ByteRTCEchoTestResultInternalError = 7 +}; + +/** + * + * @deprecated since 3.60, see rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:{@link #ByteRTCEngineDelegate#rtcEngine:onMixedStreamEvent:withMixedStreamInfo:withErrorCode:}. + * @type errorcode + * @brief WTN 流状态码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPublicStreamErrorCode) { + /** + * + * @brief 发布或订阅成功。 + */ + + ByteRTCPublicStreamErrorCodeSuccess = 0, + /** + * + * @brief WTN 流的参数异常,请修改参数后重试。 + */ + + ByteRTCPublicStreamErrorCodePushParamError = 1191, + /** + * + * @brief 服务端状态异常,将自动重试。 + */ + + ByteRTCPublicStreamErrorCodePushStatusError = 1192, + /** + * + * @brief 内部错误,不可恢复,请重试。 + */ + + ByteRTCPublicStreamErrorCodePushInternalError = 1193, + /** + * + * @brief 发布失败,将自动重试,请关注重试结果。 + */ + + ByteRTCPublicStreamErrorCodePushError = 1195, + /** + * + * @brief 发布失败,10 s 后会重试,重试 3 次后自动停止。 + */ + + ByteRTCPublicStreamErrorCodePushTimeOut = 1196, + /** + * + * @brief 订阅失败,发布端未开始发布流。 + */ + + ByteRTCPublicStreamErrorCodePullNoPushStream = 1300, +}; +/** + * + * @type keytype + * @brief 蓝牙传输协议。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCBluetoothMode) { + /** + * + * @brief 默认采用 auto 模式,具体如下:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    场景 HFP A2DP
    纯通话场景 蓝牙设备支持 HFP 蓝牙设备不支持 HFP
    纯媒体场景 使用蓝牙设备采集播放音频 使用 iOS 设备采集音频,蓝牙设备播放音频
    + */ + + ByteRTCBluetoothModeAuto = 0, + + /** + * + * @brief 高级音频分配配置文件(A2DP)。立体声、高音质。采用 iOS 设备进行音频采集,蓝牙设备进行播放。 + */ + + ByteRTCBluetoothModeA2DP = 1, + + /** + * + * @brief 免提配置文件(HFP)。单声道、普通音质。音频采集和播放设备都使用蓝牙设备。 + */ + + ByteRTCBluetoothModeHFP = 2 +}; +/** + * + * @type keytype + * @brief 音视频回路测试参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEchoTestConfig : NSObject +/** + * + * @brief 用于渲染接收到的视频的视图 + */ + +@property(strong, nonatomic) ByteRTCView* _Nullable view; +/** + * + * @brief 测试用户加入的房间 ID。 + */ + +@property(copy, nonatomic) NSString *_Nonnull roomId; +/** + * + * @brief 进行音视频通话回路测试的用户 ID + */ + +@property(copy, nonatomic) NSString *_Nonnull userId; +/** + * + * @brief 对用户进房时进行鉴权验证的动态密钥,用于保证音视频通话回路测试的安全性。 + */ + +@property(copy, nonatomic) NSString *_Nonnull token; +/** + * + * @brief 是否检测音频。检测设备为系统默认音频设备。
    + * - true:是 + * - 若使用 SDK 内部采集,此时设备麦克风会自动开启,并在 audioReportInterval 值大于 0 时触发 `onLocalAudioPropertiesReport` 回调,你可以根据该回调判断麦克风的工作状态 + * - 若使用自定义采集,此时你需调用 pushExternalAudioFrame:{@link #ByteRTCEngine#pushExternalAudioFrame:} 将采集到的音频推送给 SDK + * - false:否 + */ + +@property(assign, nonatomic) BOOL enableAudio; +/** + * + * @brief 是否检测视频。PC 端默认检测列表中第一个视频设备。
    + * - true:是 + * - 若使用 SDK 内部采集,此时设备摄像头会自动开启 + * - 若使用自定义采集,此时你需调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame:} 将采集到的视频推送给 SDK + * - false:否 + * 视频的发布参数固定为:分辨率 640px × 360px,帧率 15fps。 + */ + +@property(assign, nonatomic) BOOL enableVideo; +/** + * + * @brief 音量信息提示间隔,单位:ms,默认为 100ms
    + * - `<= 0`: 关闭信息提示 + * - `(0,100]`: 开启信息提示,不合法的 interval 值,SDK 自动设置为 100ms + * - `> 100`: 开启信息提示,并将信息提示间隔设置为此值 + */ + +@property(assign, nonatomic) NSInteger audioReportInterval; +@end + +/** + * + * @type keytype + * @brief 用户信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCUserInfo : NSObject +/** + * + * @brief 用户 ID。该字符串符合正则表达式:`[a-zA-Z0-9_@\-\.]{1,128}`。 + */ + +@property(copy, nonatomic) NSString *_Nonnull userId; +/** + * + * @brief 用户需要透传的额外的信息,字符长度限制为 200 字节。会在 `rtcRoom:onUserJoined:` 中回调给远端用户。 + */ + +@property(copy, nonatomic) NSString *_Nonnull extraInfo; +@end + +/** + * + * @type keytype + * @brief 房间通话统计数据,统计周期为 2s 。
    + * 用户进房成功后,SDK 会周期性地通过 `onRoomStats` 回调通知用户当前房间内的汇总统计信息。此数据结构即为回调给用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomStats : NSObject +/** +* + * @brief 本地用户在本次通话中的参与时长,单位为 s + */ + +@property(assign, nonatomic) NSInteger duration; +/** + * + * @brief 本地用户的总发送字节数 (bytes),累计值 + */ + +@property(assign, nonatomic) NSInteger txBytes; +/** + * + * @brief 本地用户的总接收字节数 (bytes),累计值 + */ + +@property(assign, nonatomic) NSInteger rxBytes; +/** + * + * @brief 发送码率(kbps),获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger txKbitrate; +/** + * + * @brief 接收码率(kbps),获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxKbitrate; +/** + * + * @brief 本地用户的音频发送码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger txAudioKBitrate; +/** + * + * @brief 本地用户的音频接收码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxAudioKBitrate; +/** + * + * @brief 本地用户的视频发送码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger txVideoKBitrate; +/** + * + * @brief 本地用户的视频接收码率 (kbps),瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxVideoKBitrate; +/** + * + * @brief 屏幕发送码率,获取该数据时的瞬时值,单位为 Kbps + */ + +@property(assign, nonatomic) NSInteger txScreenKBitrate; +/** + * + * @brief 屏幕接收码率,获取该数据时的瞬时值,单位为 Kbps + */ + +@property(assign, nonatomic) NSInteger rxScreenKBitrate; +/** + * + * @brief 当前房间内的可见用户人数,包括本地用户自身 + */ + +@property(assign, nonatomic) NSInteger userCount; +/** + * + * @brief App 现在的下行丢包率 + */ + +@property(assign, nonatomic) float rxLostrate; +/** + * + * @brief App 现在的上行丢包率 + */ + +@property(assign, nonatomic) float txLostrate; +/** + * + * @brief 客户端到服务端的往返时延 + */ + +@property(assign, nonatomic) NSInteger rtt; + + + + + + + + + + + + + + + + + + + + + + + +/** + * + * @hidden currently not available + * @brief 系统上行网络抖动(ms) + */ + +@property(assign, nonatomic) NSInteger txJitter; +/** + * + * @hidden currently not available + * @brief 系统下行网络抖动(ms) + */ + +@property(assign, nonatomic) NSInteger rxJitter; +/** + * + * @brief 蜂窝路径发送的码率 (kbps),为获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger txCellularKBitrate; +/** + * + * @brief 蜂窝路径接收码率 (kbps),为获取该数据时的瞬时值 + */ + +@property(assign, nonatomic) NSInteger rxCellularKBitrate; +@end + +/** + * + * @type keytype + * @brief 本地视频流统计信息,统计周期为 2s 。
    + * 本地用户发布视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的视频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalVideoStats : NSObject +/** + * + * @brief 发送码率。此次统计周期内实际发送的分辨率最大的视频流的发送码率,单位为 Kbps + */ + +@property(assign, nonatomic) float sentKBitrate; +/** + * + * @brief 采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger inputFrameRate; +/** + * + * @brief 发送帧率。此次统计周期内实际发送的分辨率最大的视频流的视频发送帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger sentFrameRate; +/** + * + * @brief 编码器输出帧率。当前编码器在此次统计周期内实际发送的分辨率最大的视频流的输出帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger encoderOutputFrameRate; +/** + * + * @brief 本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。 + */ + +@property(assign, nonatomic) NSInteger rendererOutputFrameRate; +/** + * + * @brief 统计间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 视频丢包率。统计周期内的视频上行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float videoLossRate; +/** + * + * @brief 往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 视频编码码率。此次统计周期内的实际发送的分辨率最大的视频流视频编码码率,单位为 Kbps 。 + */ + +@property(assign, nonatomic) NSInteger encodedBitrate; +/** + * + * @brief 实际发送的分辨率最大的视频流的视频编码宽度,单位为 px 。 + */ + +@property(assign, nonatomic) NSInteger encodedFrameWidth; +/** + * + * @brief 实际发送的分辨率最大的视频流的视频编码高度,单位为 px 。 + */ + +@property(assign, nonatomic) NSInteger encodedFrameHeight; +/** + * + * @brief 此次统计周期内实际发送的分辨率最大的视频流的发送的视频帧总数。 + */ + +@property(assign, nonatomic) NSInteger encodedFrameCount; +/** + * + * @brief 编码类型。参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} 类型。 + */ + +@property(nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief 预留字段。 + */ + +@property(assign, nonatomic) BOOL isScreen; +/** + * + * @brief 视频上行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @hidden(macOS) + * @brief 视频降噪模式。具体参看 ByteRTCVideoDenoiseMode{@link #ByteRTCVideoDenoiseMode} 。 + */ + +@property(assign, nonatomic) ByteRTCVideoDenoiseMode videoDenoiseMode; +@end + +/** + * + * @type keytype + * @brief 远端视频流统计信息,统计周期为 2s 。
    + * 本地用户订阅远端视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoStats : NSObject +/** + * + * @brief 远端视频宽度。 + */ + +@property(assign, nonatomic) NSInteger width; +/** + * + * @brief 远端视频高度。 + */ + +@property(assign, nonatomic) NSInteger height; +/** + * + * @brief 远端视频丢包率。统计周期内的视频下行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float videoLossRate; +/** + * + * @brief 接收码率。统计周期内的视频接收码率,单位为 kbps 。 + */ + +@property(assign, nonatomic) float receivedKBitrate; +/** + * + * @brief 远端视频接收帧率。 + */ + +@property(assign, nonatomic) NSInteger receivedFrameRate; +/** + * + * @brief 远端视频解码输出帧率。 + */ + +@property(assign, nonatomic) NSInteger decoderOutputFrameRate; +/** + * + * @brief 远端视频渲染输出帧率。 + */ + +@property(assign, nonatomic) NSInteger renderOutputFrameRate; +/** + * + * @brief 远端视频卡顿次数。 + */ + +@property(assign, nonatomic) NSInteger stallCount; +/** + * + * @brief 远端视频卡顿时长,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger stallDuration; +/** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger e2eDelay; +/** + * + * @brief 预留字段。 + */ + +@property(assign, nonatomic) BOOL isScreen; +/** + * + * @brief 统计间隔,此次统计周期的间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,目前设置为 2s 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。 + */ + +@property(assign, nonatomic) NSInteger frozenRate; +/** + * + * @brief 编码类型。参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} 类型。 + */ + +@property(nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief SDK 订阅的远端视频流的分辨率下标。 + */ + +@property(assign, nonatomic) NSInteger videoIndex; +/** + * + * @brief 视频下行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @hidden for internal use only + * @brief 远端视频超分模式,参看 ByteRTCVideoSuperResolutionMode{@link #ByteRTCVideoSuperResolutionMode}。 + */ + +@property(assign, nonatomic) ByteRTCVideoSuperResolutionMode superResolutionMode; +/** + * + * @brief 用户体验级别的端到端延时。从发送端开始采集到接收端渲染完成的延时,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger capToRenderDelay; +/** + * + * @brief 音画同步差异,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger avSyncDiffMs; +/** + * + * @brief 视频解码平均耗时,单位 ms。 + */ + +@property(assign, nonatomic) NSInteger codecElapsePerFrame; +@end + +/** + * + * @type keytype + * @brief 本地音频流统计信息,统计周期为 2s 。
    + * 本地用户发布音频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalAudioStats : NSObject +/** + * + * @brief 音频丢包率。此次统计周期内的音频上行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float audioLossRate; +/** + * + * @brief 发送的码率。此次统计周期内的音频发送码率,单位为 kbps 。 + */ + +@property(assign, nonatomic) float sentKBitrate; +/** + * + * @brief 采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger recordSampleRate; +/** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。
    + * 此字段用于设置回调的统计周期,默认设置为 2s 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 音频声道数。 + */ + +@property(assign, nonatomic) NSInteger numChannels; +/** + * + * @brief 音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger sentSampleRate; +/** + * + * @brief 音频上行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @brief 音频设备的采集和播放延时,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger audioDeviceLoopDelay; +/** + * + * @brief 音频编码帧率。 + */ + +@property(assign, nonatomic) double encodeFrameRate; +@end + +/** + * + * @type keytype + * @brief 远端音频流统计信息,统计周期为 2s 。
    + * 本地用户订阅远端音频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的音频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteAudioStats : NSObject +/** + * + * @brief 音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。 + */ + +@property(assign, nonatomic) float audioLossRate; +/** + * + * @brief 接收码率。统计周期内的音频接收码率,单位为 kbps 。 + */ + +@property(assign, nonatomic) float receivedKBitrate; +/** + * + * @brief 音频卡顿次数。统计周期内的卡顿次数。 + */ + +@property(assign, nonatomic) NSInteger stallCount; +/** + * + * @brief 音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger stallDuration; +/** + * + * @brief 播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger playoutSampleRate; +/** + * + * @brief 用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger e2eDelay; +/** + * + * @brief 统计间隔。此次统计周期的间隔,单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger statsInterval; +/** + * + * @brief 客户端到服务端数据传输的往返时延,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger rtt; +/** + * + * @brief 发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger totalRtt; +/** + * + * @brief 远端用户发送的音频流质量。值含义参考 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} 。 + */ + +@property(assign, nonatomic) NSInteger quality; +/** + * + * @brief 因引入 jitter buffer 机制导致的延时。单位为 ms 。 + */ + +@property(assign, nonatomic) NSInteger jitterBufferDelay; +/** + * + * @brief 音频声道数。 + */ + +@property(assign, nonatomic) NSInteger numChannels; +/** + * + * @brief 音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger receivedSampleRate; +/** + * + * @brief 远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。 + */ + +@property(assign, nonatomic) NSInteger frozenRate; +/** + * + * @brief 音频 PLC 样点总个数。 + */ + +@property(assign, nonatomic) NSInteger concealedSamples; +/** + * + * @brief 音频丢包补偿(PLC) 累计次数。 + */ + +@property(assign, nonatomic) NSInteger concealmentEvent; +/** + * + * @brief 音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。 + */ + +@property(assign, nonatomic) NSInteger decSampleRate; +/** + * + * @brief 此次订阅中,对远端音频流进行解码的累计耗时。单位为 s。 + */ + +@property(assign, nonatomic) NSInteger decDuration; +/** + * + * @brief 视频下行网络抖动,单位为 ms。 + */ + +@property(assign, nonatomic) NSInteger jitter; +/** + * + * @brief 音频解码帧率。 + */ + +@property(assign, nonatomic) double decodeFrameRate; +@end + +/** + * + * @type keytype + * @brief 本地音/视频流统计信息以及网络状况,统计周期为 2s 。
    + * 本地用户发布音/视频流成功后,SDK 会周期性地通过 `onLocalStreamStats`
    + * 通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalStreamStats : NSObject +/** + * + * @brief 本地设备发送音频流的统计信息,详见 ByteRTCLocalAudioStats{@link #ByteRTCLocalAudioStats} + */ + +@property(strong, nonatomic) ByteRTCLocalAudioStats *_Nonnull audioStats; +/** + * + * @brief 本地设备发送视频流的统计信息,详见 ByteRTCLocalVideoStats{@link #ByteRTCLocalVideoStats} + */ + +@property(strong, nonatomic) ByteRTCLocalVideoStats *_Nonnull videoStats; +/** + * + * @brief 所属用户的媒体流上行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality txQuality; +/** + * + * @brief 所属用户的媒体流下行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +@end + +/** + * + * @type keytype + * @brief 用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
    + * 订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 `onRemoteStreamStats`
    + * 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteStreamStats : NSObject +/** + * + * @brief 用户 ID 。音频来源的用户 ID 。 + */ + +@property(copy, nonatomic) NSString *_Nonnull uid; +/** + * + * @brief 远端音频流的统计信息,详见 ByteRTCRemoteAudioStats{@link #ByteRTCRemoteAudioStats} + */ + +@property(strong, nonatomic) ByteRTCRemoteAudioStats *_Nonnull audioStats; +/** + * + * @brief 远端视频流的统计信息,详见 ByteRTCRemoteVideoStats{@link #ByteRTCRemoteVideoStats} + */ + +@property(strong, nonatomic) ByteRTCRemoteVideoStats *_Nonnull videoStats; +/** + * + * @brief 所属用户的媒体流上行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality txQuality; +/** + * + * @brief 所属用户的媒体流下行网络质量,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality} + * @deprecated since 3.36 and will be deleted in 3.51, use rtcRoom:onNetworkQuality:remoteQualities:{@link #ByteRTCRoomDelegate#rtcRoom:onNetworkQuality:remoteQualities:} instead + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +@end + +/** + * + * @type keytype + * @brief 用户信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCUser : NSObject +/** + * + * @brief 用户 ID + */ + +@property(nonatomic, copy, nullable) NSString *userId; +/** + * + * @brief 元信息 + */ + +@property(nonatomic, copy, nullable) NSString *metaData; +@end + +/** + * + * @type keytype + * @brief 用户信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteStreamKey : NSObject +/** + * + * @brief 用户 ID + */ + +@property(nonatomic, copy, nullable) NSString *userId; +/** + * + * @brief 房间 ID + */ + +@property(nonatomic, copy, nullable) NSString *roomId; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) ByteRTCStreamIndex streamIndex; +@end + +#pragma mark - EncryptHandler +/** + * + * @type callback + * @brief 自定义加密接口
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 通话加密 + */ + +@protocol ByteRTCEncryptHandler + +@required +/** + * + * @type api + * @brief 自定义加密。
    + * 使用设定的自定义加密方式,对编码后传输前的音视频帧数据进行加密。
    + * 暂不支持对原始音视频帧进行加密。 + * @param rawData 原始音视频帧数据 + * @return 加密后的数据
    + * - 非空,表示加密后的数据 + * - 为空,表示数据被丢弃 + * @note + * - 使用此接口进行自定义加密前,你必须先设置自定义加密方式,参看 `setCustomizeEncryptHandler:`。 + * - 使用 onDecryptData:{@link #ByteRTCEncryptHandler#onDecryptData:} 对已加密的音视频帧数据进行解密。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + +- (NSData * _Nonnull) onEncryptData:(NSData * _Nonnull)rawData; + +@required +/** + * + * @type api + * @brief 自定义解密。
    + * 对自定义加密后的音视频帧数据进行解密。关于自定义加密,参看 onEncryptData:{@link #ByteRTCEncryptHandler#onEncryptData:}。 + * @param rawData 收到的已加密的音视频帧数据 + * @return 解密后的数据
    + * - 非空,表示解密后的数据 + * - 为空,表示丢弃该帧 + * @note + * - 使用此接口进行解密前,你必须先设定解密方式,参看 `setCustomizeEncryptHandler:`。 + * - 返回的数据大小应控制在原始数据的 90% ~ 120% 范围以内,不然将被丢弃。 + * @list 通话加密 + */ + +- (NSData * _Nonnull) onDecryptData:(NSData * _Nonnull)rawData; +@end + +#pragma mark - FileRecording + +/** + * + * @type keytype + * @brief 本地录制参数配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRecordingConfig : NSObject +/** + * + * @brief 录制文件保存的绝对路径,需精确到文件夹,文件名由 RTC 自动生成。你需要确保对该路径具有读写权限。 + */ + +@property(strong, nonatomic) NSString* _Nullable dirPath; +/** + * + * @brief 录制存储文件格式,参看 ByteRTCRecordingFileType{@link #ByteRTCRecordingFileType} + */ + +@property(assign, nonatomic) ByteRTCRecordingFileType recordingFileType; +@end + +/** + * + * @type keytype + * @brief 本地录制进度 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRecordingProgress : NSObject +/** + * + * @brief 当前文件的累计录制时长,单位:毫秒 + */ + +@property(assign, nonatomic) unsigned long long duration; +/** + * + * @brief 当前录制文件的大小,单位:byte + */ + +@property(assign, nonatomic) unsigned long long fileSize; +@end + +/** + * + * @type keytype + * @brief 本地录制的详细信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRecordingInfo : NSObject +/** + * + * @brief 录制文件的绝对路径,包含文件名和文件后缀 + */ + +@property(strong, nonatomic) NSString* _Nullable filePath; +/** + * + * @brief 录制文件的视频编码类型,参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} + */ + +@property(assign, nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief 录制视频的宽,单位:像素。纯音频录制请忽略该字段 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 录制视频的高,单位:像素。纯音频录制请忽略该字段 + */ + +@property(nonatomic, assign) NSInteger height; +@end + +/** + * + * @type keytype + * @brief 媒体流信息同步的相关配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCStreamSyncInfoConfig : NSObject + +/** + * + * @brief 消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。 + */ + +@property(assign, nonatomic) int repeatCount; +/** + * + * @brief 媒体流信息同步的流类型,见 ByteRTCSyncInfoStreamType{@link #ByteRTCSyncInfoStreamType} 。 + */ + +@property(assign, nonatomic) ByteRTCSyncInfoStreamType streamType; +@end + +/** + * + * @type keytype + * @brief 媒体流跨房间转发的目标房间的相关信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCForwardStreamConfiguration: NSObject + /** + * + * @brief 跨房间转发媒体流过程中目标房间 ID + */ + +@property(strong, nonatomic) NSString* _Nullable roomId; + /** + * + * @brief 使用转发目标房间 RoomID 和 UserID 生成 Token。
    + * 测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。
    + * 如果 Token 无效,转发失败。 + */ + +@property(strong, nonatomic) NSString* _Nullable token; +@end + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间的状态和错误信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCForwardStreamStateInfo: NSObject + /** + * + * @brief 跨房间转发媒体流过程中目标房间 ID
    + * 空字符串代表所有目标房间 + */ + +@property(strong, nonatomic) NSString* _Nullable roomId; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间的状态,参看 ByteRTCForwardStreamState{@link #ByteRTCForwardStreamState} + */ + +@property(assign, nonatomic) ByteRTCForwardStreamState state; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ByteRTCForwardStreamError{@link #ByteRTCForwardStreamError} + */ + +@property(assign, nonatomic) ByteRTCForwardStreamError error; +@end + +/** + * + * @type keytype + * @brief 跨房间转发媒体流过程中的不同目标房间发生的事件 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCForwardStreamEventInfo: NSObject + /** + * + * @brief 跨房间转发媒体流过程中的发生该事件的目标房间 ID
    + * 空字符串代表所有目标房间 + */ + +@property(strong, nonatomic) NSString* _Nullable roomId; + /** + * + * @brief 跨房间转发媒体流过程中该目标房间发生的事件,参看 ByteRTCForwardStreamEvent{@link #ByteRTCForwardStreamEvent} + */ + +@property(assign, nonatomic) ByteRTCForwardStreamEvent event; +@end + +/** + * + * @type keytype + * @brief 上行/下行网络质量 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCNetworkQualityStats: NSObject +/** + * + * @brief 用户 ID + */ + +@property(strong, nonatomic) NSString* _Nonnull uid; +/** + * + * @brief 本端的上行/下行的丢包率,范围 [0.0,1.0]
    + * 当 `uid` 为本地用户时,代表发布流的上行丢包率。
    + * 当 `uid` 为远端用户时,代表接收所有订阅流的下行丢包率。 + */ + +@property(assign, nonatomic) double lossRatio; +/** + * + * @brief 当 `uid` 为本地用户时有效,客户端到服务端的往返延时(RTT),单位:ms + */ + +@property(assign, nonatomic) int rtt; +/** + * + * @brief 本端的音视频 RTP 包 2 秒内的平均传输速率,单位:bps
    + * 当 `uid` 为本地用户时,代表发送速率。
    + * 当 `uid` 为远端用户时,代表所有订阅流的接收速率。 + */ + +@property(assign, nonatomic) int totalBandwidth; +/** + * + * @brief 上行网络质量评分,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality}。 + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality txQuality; +/** + * + * @brief 下行网络质量评分,详见 ByteRTCNetworkQuality{@link #ByteRTCNetworkQuality}。 + */ + +@property(assign, nonatomic) ByteRTCNetworkQuality rxQuality; +@end + +/** + * + * @type keytype + * @brief 网络时间信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCNetworkTimeInfo: NSObject +/** + * + * @brief 网络时间,单位:ms + */ + +@property(assign, nonatomic) int64_t timestamp; +@end + +#pragma mark - ByteRTCDeviceCollection +/** + * + * @hidden(iOS) + * @type api + * @brief 音视频设备相关的信息 + * @list Encryption + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCDeviceCollection : NSObject +/** + * + * @type api + * @brief 获取当前音视频设备数量 + * @return 音视频设备数量 + * @list 引擎管理 + */ + +- (int)getCount; +/** + * + * @type api + * @brief 获取音频设备信息,可根据索引号、设备名称、设备 ID 获取。 + * @param index 设备索引号,从 0 开始,注意需小于 getCount{@link #ByteRTCDeviceCollection#getCount} 返回值。 + * @param deviceName 设备名称 + * @param deviceID 设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 引擎管理 + */ + +- (int)getDevice:(int)index DeviceName:(NSString * _Nonnull * _Nonnull)deviceName DeviceID:(NSString * _Nonnull * _Nonnull) deviceID; +@end + +/** + * + * @type keytype + * @brief 音频 dump 状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioDumpStatus){ + /** + * + * @brief 音频 dump 启动失败 + */ + + ByteRTCAudioDumpStartFailure = 0, + /** + * + * @brief 音频 dump 启动成功 + */ + + ByteRTCAudioDumpStartSuccess = 1, + /** + * + * @brief 音频 dump 停止失败 + */ + + ByteRTCAudioDumpStopFailure = 2, + /** + * + * @brief 音频 dump 停止成功 + */ + + ByteRTCAudioDumpStopSuccess = 3, + /** + * + * @brief 音频 dump 运行失败 + */ + + ByteRTCAudioDumpRunningFailure = 4, + /** + * + * @brief 音频 dump 运行成功 + */ + + ByteRTCAudioDumpRunningSuccess = 5, +}; + + +/** + * + * @type keytype + * @brief 通话前探测的停止原因
    + * `rtcEngine:onNetworkDetectionStopped:` 回调的参数类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionStopReason) { + /** + * + * @brief 用户主动停止。 + */ + + ByteRTCNetworkDetectionStopReasonUser = 0, + /** + * + * @brief 探测超过三分钟。 + */ + + ByteRTCNetworkDetectionStopReasonTimeout = 1, + /** + * + * @brief 探测网络连接断开。
    + * 当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。 + */ + + ByteRTCNetworkDetectionStopReasonConnectionLost = 2, + /** + * + * @brief 本地开始推拉流,停止探测。 + */ + + ByteRTCNetworkDetectionStopReasonStreaming = 3, + /** + * + * @brief 网络探测失败,内部异常 + */ + + ByteRTCNetworkDetectionStopReasonInnerErr = 4, +}; + +/** + * + * @type errorcode + * @brief 开始探测的返回值
    + * `startNetworkDetection:uplinkBandwidth:downlink:downlinkBandwidth:` 返回对象类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCNetworkDetectionStartReturn) { + /** + * + * @brief 成功开始探测。 + */ + + ByteRTCNetworkDetectionStartReturnSuccess = 0, + /** + * + * @brief 开始探测失败。参数错误,上下行探测均为 `false`,或期望带宽超过了范围 [100,10000] + */ + + ByteRTCNetworkDetectionStartReturnParamErr = 1, + /** + * + * @brief 开始探测失败。失败原因为,本地已经开始推拉流 + */ + + ByteRTCNetworkDetectionStartReturnStreaming = 2, + /** + * + * @brief 已经开始探测,无需重复开启 + */ + + ByteRTCNetworkDetectionStartReturnStarted = 3, + /** + * + * @brief 不支持该功能 + */ + + ByteRTCNNetworkDetectionStartReturnNotSupport = 4, +}; + +/** + * + * @type keytype + * @brief 通话前探测链接的类型
    + * `rtcEngine:onNetworkDetectionResult:quality:rtt:lostRate:bitrate:jitter:` 回调的参数类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCNetworkDetectionLinkType) { + /** + * + * @brief 上行网络探测。 + */ + + ByteRTCNetworkDetectionLinkTypeUp = 0, + /** + * + * @brief 下行网络探测。 + */ + + ByteRTCNetworkDetectionLinkTypeDown = 1, +}; + +/** + * + * @type keytype + * @brief 通话前回声检测结果 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCHardwareEchoDetectionResult) { + /** + * + * @brief 主动调用 `stopHardwareEchoDetection` 结束流程时,未有回声检测结果。 + */ + + ByteRTCHardwareEchoDetectionCanceled = 0, + /** + * + * @brief 未检测出结果。建议重试,如果仍然失败请联系技术支持协助排查。 + */ + + ByteRTCHardwareEchoDetectionUnknown = 1, + /** + * + * @brief 无回声 + */ + + ByteRTCHardwareEchoDetectionNormal = 2, + /** + * + * @brief 有回声。可通过 UI 建议用户使用耳机设备入会。 + */ + + ByteRTCHardwareEchoDetectionPoor = 3, +}; + +/** + * + * @type keytype + * @brief 音频选路优先级设置 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCAudioSelectionPriority) { + /** + * + * @brief 正常,参加音频选路 + */ + + ByteRTCAudioSelectionPriorityNormal = 0, + /** + * + * @brief 高优先级,跳过音频选路 + */ + + ByteRTCAudioSelectionPriorityHigh = 1 +}; + +/** + * + * @type keytype + * @brief 设置房间附加消息结果。 + */ + +typedef NS_ENUM(NSInteger,ByteRTCSetRoomExtraInfoResult) { + /** + * + * @brief 设置房间附加信息成功 + */ + + ByteRTCSetRoomExtraInfoResultSuccess = 0, + /** + * + * @brief 设置失败,尚未加入房间 + */ + + ByteRTCSetRoomExtraInfoResultNotJoinRoom = -1, + /** + * + * @brief 设置失败,key 指针为空 + */ + + ByteRTCSetRoomExtraInfoResultKeyIsNull = -2, + /** + * + * @brief 设置失败,value 指针为空 + */ + + ByteRTCSetRoomExtraInfoResultValueIsNull = -3, + /** + * + * @brief 设置失败,未知错误 + */ + + ByteRTCSetRoomExtraInfoResultUnknow = -99, + /** + * + * @brief 设置失败,key 长度为 0 + */ + + ByteRTCSetRoomExtraInfoResultKeyIsEmpty = -400, + /** + * + * @brief 调用 `setRoomExtraInfo` 过于频繁,建议不超过 10 次/秒。 + */ + + ByteRTCSetRoomExtraInfoResultTooOften = -406, + /** + * + * @brief 设置失败,用户已调用 `setUserVisibility` 将自身设为隐身状态。 + */ + + ByteRTCSetRoomExtraInfoResultSilentUser = -412, + /** + * + * @brief 设置失败,Key 长度超过 10 字节 + */ + + ByteRTCSetRoomExtraInfoResultKeyTooLong = -413, + /** + * + * @brief 设置失败,value 长度超过 128 字节 + */ + + ByteRTCSetRoomExtraInfoResultValueTooLong = -414, + /** + * + * @brief 设置失败,服务器错误 + */ + + ByteRTCSetRoomExtraInfoResultServerError = -500 +}; +/** + * + * @type keytype + * @hidden internal use only + * @brief 特效错误类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEffectErrorType) { + /** + * + * @hidden 仅用于会议 + * @brief 虚拟背景设置错误。 + */ + + ByteRTCEffectErrorVirtualBackgroundFailure = 1, + /** + * + * @hidden 仅用于会议 + * @brief 特效独立进程崩溃。 + */ + + ByteRTCEffectErrorChildProcTerminate = 2 +}; + +#pragma mark - ByteRTCSubtitle +/** + * + * @type keytype + * @brief 字幕任务状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubtitleState) { + /** + * + * @brief 开启字幕。 + */ + + ByteRTCSubtitleStateStarted = 0, + /** + * + * @brief 关闭字幕。 + */ + + ByteRTCSubtitleStateStoped = 1, + /** + * + * @brief 字幕任务出现错误。 + */ + + ByteRTCSubtitleStateError = 2 +}; +/** + * + * @type keytype + * @brief 字幕模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubtitleMode) { + /** + * + * @brief 识别模式。在此模式下,房间内用户语音会被转为文字。 + */ + + ByteRTCSubtitleModeRecognition = 0, + /** + * + * @brief 翻译模式。在此模式下,房间内用户语音会先被转为文字,再被翻译为目标语言。 + */ + + ByteRTCSubtitleModeTranslation = 1 +}; +/** + * + * @type errorcode + * @brief 字幕任务错误码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubtitleErrorCode) { + /** + * + * @brief 客户端无法识别云端媒体处理发送的错误码。 + */ + + ByteRTCSubtitleErrorCodeUnknow = -1, + /** + * + * @brief 字幕已开启。 + */ + + ByteRTCSubtitleErrorCodeSuccess = 0, + /** + * + * @brief 云端媒体处理内部出现错误,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodePostProcessError = 1, + /** + * + * @brief 第三方服务连接失败,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodeASRConnectionError = 2, + /** + * + * @brief 第三方服务内部出现错误,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodeASRServiceError = 3, + /** + * + * @brief 未进房导致调用`startSubtitle`失败。请加入房间后再调用此方法。 + */ + + ByteRTCSubtitleErrorCodeBeforeJoinRoom = 4, + /** + * + * @brief 字幕已开启,无需重复调用 `startSubtitle`。 + */ + + ByteRTCSubtitleErrorCodeAlreadyOn = 5, + /** + * + * @brief 用户选择的目标语言目前暂不支持。 + */ + + ByteRTCSubtitleErrorCodeUnsupportedLanguage = 6, + /** + * + * @brief 云端媒体处理超时未响应,请联系技术支持。 + */ + + ByteRTCSubtitleErrorCodePostProcessTimeout = 7 +}; +/** + * + * @type keytype + * @brief 字幕配置信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubtitleConfig : NSObject +/** + * + * @brief 字幕模式。可以根据需要选择识别和翻译两种模式。开启识别模式,会将识别后的用户语音转化成文字;开启翻译模式,会在语音识别后进行翻译。参看 ByteRTCSubtitleMode{@link #ByteRTCSubtitleMode}。 + */ + +@property(assign, nonatomic) ByteRTCSubtitleMode mode; +/** + * + * @brief 目标翻译语言。可点击 [语言支持](https: + */ + +@property(copy, nonatomic) NSString *_Nonnull targetLanguage; +@end +/** + * + * @type keytype + * @brief 字幕具体内容。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubtitleMessage : NSObject +/** + * + * @brief 说话者的用户 ID。 + */ + +@property(copy, nonatomic) NSString *_Nonnull userId; +/** + * + * @brief 语音识别或翻译后的文本, 采用 UTF-8 编码。 + */ + +@property(copy, nonatomic) NSString *_Nonnull text; +/** + * + * @brief 字幕语种,根据字幕模式为原文或译文对应的语种。 + */ + +@property(copy, nonatomic) NSString *_Nonnull language; +/** + * + * @brief 字幕模式,参看 ByteRTCSubtitleMode{@link #ByteRTCSubtitleMode}。 + */ + +@property(assign, nonatomic) NSInteger mode; +/** + * + * @brief 语音识别或翻译后形成的文本的序列号,同一发言人的完整发言和不完整发言会按递增顺序单独分别编号。 + */ + +@property(assign, nonatomic) NSInteger sequence; +/** + * + * @brief 语音识别出的文本是否为一段完整的一句话。 True 代表是, False 代表不是。 + */ + +@property(assign, nonatomic) BOOL definite; +@end + +/** + * + * @hidden + * @type keytype + * @brief 死锁时的相关报错 + * @hidden internal use only + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCDeadLockMsg : NSObject +/** + * + * @brief session_id + */ + +@property (nonatomic, strong) NSString* _Nonnull blockSessionId; +/** + * + * @brief 死锁线程等待链 + */ + +@property (nonatomic, strong) NSString* _Nonnull blockingPaths; +/** + * + * @brief 是否卡住 rtc 主线程 + */ + +@property(nonatomic) BOOL isCritical ; +@end + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 字幕模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAudioAEDType) { + /** + * + * @brief 未检测到音乐场景 + */ + + ByteRTCAudioAEDTypeNoMusic = 0, + /** + * + * @brief 检测到音乐场景。 + */ + + ByteRTCAudioAEDTypeMusic = 1 +}; + + +/** + * + * @type keytype + * @brief 游戏房间类型 + */ + +typedef NS_ENUM(NSInteger, GameRoomType) { + /** + * + * @brief 小队房间 + */ + + GameRoomTypeTeam = 0, + /** + * + * @brief 世界房间 + */ + + GameRoomTypeWorld = 1, +}; + +/** + * + * @type keytype + * @brief 流信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCStreamInfo : NSObject +/** + * + * @brief 流 ID + */ + +@property(nonatomic) NSString * _Nonnull streamId; +/** + * + * @brief 用户 ID + */ + +@property(nonatomic) NSString * _Nonnull userId; +/** + * + * @brief 房间 ID + */ + +@property(nonatomic) NSString * _Nonnull roomId; +/** + * + * @brief 流索引 + */ + +@property(nonatomic, assign) NSInteger streamIndex; +/** + * + * @brief 预留字段。 + */ + +@property(assign, nonatomic) BOOL isScreen; +@end + + +/** + * + * @type keytype + * @brief 游戏场景类型 + */ + +typedef NS_ENUM(NSInteger, GameSceneType) { + /** + * + * @brief 普通场景。
    + * 同一个小队房间的队友,仅支持在同一个世界房间内通话。 + */ + + GameSceneTypeNormal = 0, + /** + * + * @brief 主题公园场景。
    + * 同一个小队房间的队友,支持跨世界房间通话。 + */ + + GameSceneTypeThemePark = 1, +}; + +/** + * + * @type keytype + * @brief 创建游戏房间参数 + */ + +BYTERTC_APPLE_EXPORT @interface GameRoomConfig: NSObject +/** + * + * @type keytype + * @brief 游戏房间类型,参看 GameRoomType{@link #GameRoomType},默认为 `GAME_RTC_ROOM_TYPE_TEAM`(小队房间),进房后不可更改。 + */ + +@property(assign, nonatomic) GameRoomType gameRoomType; +/** + * + * @type keytype + * @brief 游戏场景类型,参看 GameSceneType{@link #GameSceneType},默认为 `GAME_SCENE_TYPE_NORMAL`(普通场景),进房后不可更改。 + */ + +@property(assign, nonatomic) GameSceneType gameSceneType; +@end + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaPlayer.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaPlayer.h new file mode 100644 index 0000000..f4bfbe8 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCMediaPlayer.h @@ -0,0 +1,431 @@ +/* + * Copyright (c) 2023 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCMediaPlayer +*/ + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type callback + * @brief 本地音频文件混音的音频帧观察者。 + * @list + */ + +@protocol ByteRTCMediaPlayerAudioFrameObserver +/** + * + * @type callback + * @brief 当本地音频文件混音时,回调播放的音频帧。 + * @param playerId 播放器 ID + * @param audioFrame 参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @list 混音 + */ + +- (void)onFrame:(int)playerId audioFrame:(ByteRTCAudioFrame * _Nonnull)audioFrame; + +@end +/** + * + * @type callback + * @brief ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 对应的回调句柄。你必须调用 setEventHandler:{@link #ByteRTCMediaPlayer#setEventHandler:} 完成设置后,才能收到对应回调。 + * @list Audio Mixing + */ + +@protocol ByteRTCMediaPlayerEventHandler +/** + * + * @type callback + * @brief 播放状态改变时回调。 + * @param playerId ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 的 ID。通过 getMediaPlayer:{@link #ByteRTCEngine#getMediaPlayer:} 设置。 + * @param state 混音状态。参考 ByteRTCPlayerState{@link #ByteRTCPlayerState}。 + * @param error 错误码。参考 ByteRTCPlayerError{@link #ByteRTCPlayerError}。 + * @list 混音 + */ + +-(void)onMediaPlayerStateChanged:(int)playerId state:(ByteRTCPlayerState)state error:(ByteRTCPlayerError)error; +/** + * + * @type callback + * @brief 播放进度周期性回调。回调周期通过 setProgressInterval:{@link #ByteRTCMediaPlayer#setProgressInterval:} 设置。 + * @param playerId ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 的 ID。通过 getMediaPlayer:{@link #ByteRTCEngine#getMediaPlayer:} 设置。 + * @param progress 进度。单位 ms。 + * @list 混音 + */ + +-(void)onMediaPlayerPlayingProgress:(int)playerId progress:(int64_t)progress; +/** + * + * @valid since 3.59 + * @type callback + * @brief 播放事件回调。调用 selectAudioTrack:{@link #ByteRTCMediaPlayer#selectAudioTrack:} 和 setPosition:{@link #ByteRTCMediaPlayer#setPosition:} 后,会触发此回调。 + * @param playerId ByteRTCMediaPlayer{@link #ByteRTCMediaPlayer} 的 ID。通过 getMediaPlayer:{@link #ByteRTCEngine#getMediaPlayer:} 设置。 + * @param event 播放器事件。参看 ByteRTCPlayerEvent{@link #ByteRTCPlayerEvent}。 + * @param message 事件描述信息,可能为空。 + * @list 混音 + */ + +-(void)onMediaPlayerEvent:(int)playerId event:(ByteRTCPlayerEvent)event message:(NSString*_Nullable)message; + +@end +/** + * + * @valid since 3.53 + * @type api + * @brief 音乐播放器
    + * 调用 setEventHandler:{@link #ByteRTCMediaPlayer#setEventHandler:} 设置回调句柄以获取相关回调。 + * @list Audio Mixing + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaPlayer :NSObject +/** + * + * @type api + * @brief 打开音乐文件。
    + * 一个播放器实例仅能够同时打开一个音乐文件。如果需要同时打开多个音乐文件,请创建多个音乐播放器实例。
    + * 要播放 PCM 格式的音频数据,参看 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:}。`openWithCustomSource` 和此 API 互斥。 + * @param filePath 音乐文件路径。
    + * 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。
    + * 推荐的采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。
    + * 不同平台支持的本地文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYYYY
    iOS/macOSYYYYYY
    WindowsYYYYYYYY
    + * 不同平台支持的在线文件格式:
    + * + * + * + * + * + *
    mp3mp4aacm4a3gpwavoggtswma
    AndroidYYYYY
    iOS/macOSYYYY
    WindowsYYYYYYY
    + * @param config 详见 ByteRTCMediaPlayerConfig{@link #ByteRTCMediaPlayerConfig}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 混音 + */ + +- (int)open:(NSString *_Nullable)filePath config:(ByteRTCMediaPlayerConfig *_Nullable)config; +/** + * + * @type api + * @brief 播放音乐。你仅需要在调用 open:config:{@link #ByteRTCMediaPlayer#open:config:},且未开启自动播放时,调用此方法。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 要播放 PCM 格式的音频数据,参看 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:}。`openWithCustomSource` 和此 API 互斥。 + * - 调用本方法播放音频文件后,可调用 stop{@link #ByteRTCMediaPlayer#stop} 方法暂停播放。 + * @list 混音 + */ + +- (int)start; +/** + * + * @type api + * @brief 启动音频裸数据混音。
    + * 要播放音乐文件,参看 open:config:{@link #ByteRTCMediaPlayer#open:config:}。`open` 与此 API 互斥。 + * @param source 数据源,详见 ByteRTCMediaPlayerCustomSource{@link #ByteRTCMediaPlayerCustomSource} + * @param config 详见 ByteRTCMediaPlayerConfig{@link #ByteRTCMediaPlayerConfig} + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法启动后,再调用 pushExternalAudioFrame:{@link #ByteRTCEngine#pushExternalAudioFrame:} 推送音频数据,才会开始混音。 + * - 如要结束 PCM 音频数据混音,调用 stop{@link #ByteRTCMediaPlayer#stop}。 + * @list 混音 + */ + +- (int)openWithCustomSource:(ByteRTCMediaPlayerCustomSource *_Nullable)source config:(ByteRTCMediaPlayerConfig *_Nullable)config; +/** + * + * @type api + * @brief 调用 open:config:{@link #ByteRTCMediaPlayer#open:config:}, start{@link #ByteRTCMediaPlayer#start}, 或 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 开始播放后,可以调用本方法停止。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @list 混音 + */ + +- (int)stop; +/** + * + * @type api + * @brief 调用 open:config:{@link #ByteRTCMediaPlayer#open:config:},或 start{@link #ByteRTCMediaPlayer#start} 开始播放音频文件后,调用本方法暂停播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 调用本方法暂停播放后,可调用 resume{@link #ByteRTCMediaPlayer#resume} 恢复播放。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)pause; +/** + * + * @type api + * @brief 调用 pause{@link #ByteRTCMediaPlayer#pause} 暂停音频播放后,调用本方法恢复播放。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)resume; +/** + * + * @type api + * @brief 调节指定混音的音量大小,包括音乐文件混音和 PCM 混音。 + * @param volume 播放音量相对原音量的比值。单位为 %。范围为 `[0, 400]`,建议范围是 `[0, 100]`。带溢出保护。 + * @param type 详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * @list 混音 + */ + +- (int)setVolume:(int)volume type:(ByteRTCAudioMixingType)type; +/** + * + * @type api + * @brief 获取当前音量 + * @param type 详见 ByteRTCAudioMixingType{@link #ByteRTCAudioMixingType}。 + * @return + * - >0: 成功, 当前音量值。 + * - < 0: 失败 + * @note 仅在音频播放进行状态时,调用此方法。包括音乐文件混音和 PCM 混音。 + * @list 混音 + */ + +- (int)getVolume:(ByteRTCAudioMixingType)type; +/** + * + * @type api + * @brief 获取音乐文件时长。 + * @return + * - >0: 成功, 音乐文件时长,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getTotalDuration; +/** + * + * @type api + * @brief 获取混音音乐文件的实际播放时长,单位为毫秒。 + * @return + * - >0: 实际播放时长。 + * - < 0: 失败。 + * @note + * - 实际播放时长指的是歌曲不受停止、跳转、倍速、卡顿影响的播放时长。例如,若歌曲正常播放到 1:30 时停止播放 30s 或跳转进度到 2:00, 随后继续正常播放 2 分钟,则实际播放时长为 3 分 30 秒。 + * - 仅在音频播放进行状态,且 setProgressInterval:{@link #ByteRTCMediaPlayer#setProgressInterval:} 设置间隔大于 `0` 时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getPlaybackDuration; +/** + * + * @type api + * @brief 获取音乐文件播放进度。 + * @return + * - >0: 成功, 音乐文件播放进度,单位为毫秒。 + * - < 0: 失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getPosition; +/** + * + * @valid since 3.59 + * @type api + * @brief 获取播放器状态 + * @return 播放器当前状态,参看 ByteRTCPlayerState{@link #ByteRTCPlayerState}。 + * @note 仅在音频实例创建后,调用此方法。 + * @list 混音 + */ + +- (ByteRTCPlayerState)getState; +/** + * + * @type api + * @brief 开启变调功能,多用于 K 歌场景。 + * @param pitch 与音乐文件原始音调相比的升高/降低值,取值范围为 `[-12,12]`,默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音乐文件混音,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setAudioPitch:(int)pitch; +/** + * + * @type api + * @brief 设置音乐文件的起始播放位置。 + * @param position 音乐文件起始播放位置,单位为毫秒。
    + * 你可以通过 getTotalDuration{@link #ByteRTCMediaPlayer#getTotalDuration} 获取音乐文件总时长,position 的值应小于音乐文件总时长。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 此接口仅支持音频文件,不支持 PCM 数据。 + * - 在播放在线文件时,调用此接口可能造成播放延迟的现象。 + * - 调用本接口后,会收到 onMediaPlayerEvent:event:message:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerEvent:event:message:} 回调。 + * @list 混音 + */ + +- (int)setPosition:(int)position; +/** + * + * @type api + * @brief 设置当前音乐文件的声道模式 + * @param mode 声道模式。默认的声道模式和源文件一致,详见 ByteRTCAudioMixingDualMonoMode{@link #ByteRTCAudioMixingDualMonoMode}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setAudioDualMonoMode:(ByteRTCAudioMixingDualMonoMode)mode; +/** + * + * @type api + * @brief 获取当前音乐文件的音轨数 + * @return + >= 0:成功,返回当前音乐文件的音轨数 + * - < 0:方法调用失败 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)getAudioTrackCount; +/** + * + * @type api + * @brief 指定当前音乐文件的播放音轨 + * @param index 指定的播放音轨,从 0 开始,取值范围为 `[0, getAudioTrackCount()-1]`。
    + * 设置的参数值需要小于 getAudioTrackCount{@link #ByteRTCMediaPlayer#getAudioTrackCount} 的返回值 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 仅在音频播放进行状态时,调用此方法。 + * - 此方法仅支持音乐文件,不支持 PCM 数据。 + * - 调用本接口后,会收到 onMediaPlayerEvent:event:message:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerEvent:event:message:} 回调。 + * @list 混音 + */ + +- (int)selectAudioTrack:(int)index; +/** + * + * @type api + * @brief 设置播放速度 + * @param speed 播放速度与原始文件速度的比例,单位:%,取值范围为 `[50,200]`,默认值为 100。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件可用,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setPlaybackSpeed:(int)speed; +/** + * + * @type api + * @brief 设置音频文件混音时,收到 onMediaPlayerPlayingProgress:progress:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerPlayingProgress:progress:} 的间隔。 + * @param interval 时间间隔,单位毫秒。
    + * - interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 `52`,实际间隔为 60 ms。 + * - interval <= 0 时,不会触发回调。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)setProgressInterval:(int64_t)interval; +/** + * + * @type api + * @brief 如果你需要使用 enableVocalInstrumentBalance:{@link #ByteRTCEngine#enableVocalInstrumentBalance:} 对音频文件/PCM 音频数据设置音量均衡,你必须通过此接口传入其原始响度。 + * @param loudness 原始响度,单位:lufs,取值范围为 `[-70.0, 0.0]`。
    + * 当设置的值小于 -70.0lufs 时,则默认调整为 -70.0lufs,大于 0.0lufs 时,则不对该响度做音量均衡处理。默认值为 1.0lufs,即不做处理。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 + * - 此方法对音频文件和音频裸数据播放都可用。 + * @list 混音 + */ + +- (int)setLoudness:(float)loudness; +/** + * + * @type api + * @brief 注册回调句柄以在本地音乐文件混音时,收到相关回调。 + * @param observer 参看 ByteRTCMediaPlayerAudioFrameObserver{@link #ByteRTCMediaPlayerAudioFrameObserver}。 + * @return + * - 0: 调用成功。 + * - < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明 + * @note + * 此接口仅支持音频文件,不支持 PCM 数据。 + * @list 混音 + */ + +- (int)registerAudioFrameObserver:(_Nullable id)observer; +/** + * + * @type api + * @brief 推送用于混音的 PCM 音频帧数据 + * @param audioFrame 音频帧,详见 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。
    + * - 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 + * - 必须指定具体的采样率和声道数,不支持设置为自动。 + * @return + * - 0: 成功 + * - < 0: 失败 + * @note + * - 调用该方法前,须通过 openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config:} 启动外部音频流混音。 + * - 使用参考建议:首次推送数据,请在应用侧先缓存一定数据(如 200 毫秒),然后一次性推送过去;此后的推送操作定时 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + * - 如果要暂停播放,暂停推送即可。 + * @list 混音 + */ + +- (int)pushExternalAudioFrame:(ByteRTCAudioFrame *_Nullable)audioFrame; +/** + * + * @type api + * @brief 设置回调句柄。 + * @param handler 参看 ByteRTCMediaPlayerEventHandler{@link #ByteRTCMediaPlayerEventHandler}。 + * @return + * - 0: 成功。 + * - < 0: 失败。 + * @list 混音 + */ + +- (int)setEventHandler:(_Nullable id)handler; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRangeAudio.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRangeAudio.h new file mode 100644 index 0000000..b06e87c --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRangeAudio.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief range audio interface + */ + +#pragma once + +#import +#import "ByteRTCAudioDefines.h" + +/** + * + * @type keytype + * @brief 空间音频音量随距离衰减模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAttenuationType) { + /** + * + * @brief 不随距离衰减 + */ + + ByteRTCAttenuationTypeNone = 0, + /** + * + * @brief 线性衰减,音量随距离增大而线性减小 + */ + + ByteRTCAttenuationTypeLinear = 1, + /** + * + * @brief 指数型衰减,音量随距离增大进行指数衰减 + */ + + ByteRTCAttenuationTypeExponential = 2 +}; + +/** + * + * @type keytype + * @brief 本地用户能收听到、且具有衰减效果的音频接收范围 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCReceiveRange : NSObject +/** + * + * @brief 能够接收语音、并且具有衰减效果的最小距离值,该值须 ≥ 0,但 ≤ max。
    + * 小于该值的范围内没有范围语音效果,即收听到的音频音量相同。 + */ + +@property(nonatomic, assign) int min; +/** + * + * @brief 能够收听语音的最大距离值,该值须 > 0 且 ≥ min。
    + * 当收听者和声源距离处于 [min, max) 之间时,收听到的音量根据距离呈衰减效果。
    + * 超出该值范围的音频将无法收听到。 + */ + +@property(nonatomic, assign) int max; +@end +/** + * + * @type api + * @brief 范围语音接口实例 + * @list + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRangeAudio :NSObject +/** + * + * @type api + * @brief 开启/关闭范围语音功能。
    + * 范围语音是指,在同一 RTC 房间中设定的音频接收距离范围内,本地用户收听到的远端用户音频音量会随着远端用户的靠近/远离而放大/衰减;若远端用户在房间内的位置超出设定范围,则本地用户无法接收其音频。音频接收范围设置参看 updateReceiveRange:{@link #ByteRTCRangeAudio#updateReceiveRange:}。 + * @param enable 是否开启范围语音功能:
    + * - YES: 开启 + * - NO: 关闭(默认) + * @note 该方法进房前后都可调用,为保证进房后范围语音效果的平滑切换,你需在该方法前先调用 updatePosition:{@link #ByteRTCRangeAudio#updatePosition:} 设置自身位置坐标,然后开启该方法收听范围语音效果。 + * @list 高级功能 + */ + +- (void)enableRangeAudio:(BOOL)enable; +/** + * + * @type api + * @brief 更新本地用户的音频收听范围。 + * @param range 音频收听范围,参看 ByteRTCReceiveRange{@link #ByteRTCReceiveRange}。 + * @return 方法调用结果:
    + * - 0:成功; + * - !0: 失败。 + * @list 高级功能 + */ + +- (int)updateReceiveRange:(ByteRTCReceiveRange* _Nonnull) range; +/** + * + * @type api + * @brief 更新本地用户在房间内空间直角坐标系中的位置坐标。 + * @param pos 三维坐标的值,默认为 [0, 0, 0],参看 ByteRTCPosition{@link #ByteRTCPosition}. + * @return 方法调用结果:
    + * - 0:成功; + * - !0:失败。 + * @note 调用该接口更新坐标后,你需调用 enableRangeAudio:{@link #ByteRTCRangeAudio#enableRangeAudio:} 开启范围语音功能以收听范围语音效果。 + * @list 高级功能 + */ + +- (int)updatePosition:(ByteRTCPosition* _Nonnull) pos; +/** + * + * @type api + * @brief 设置范围语音的音量衰减模式。 + * @param type 音量衰减模式。默认为线性衰减。详见 ByteRTCAttenuationType{@link #ByteRTCAttenuationType}。 + * @param coefficient 指数衰减模式下的音量衰减系数,默认值为 1。范围 [0.1,100],推荐设置为 `50`。数值越大,音量的衰减速度越快。 + * @return 调用是否成功
    + * - `0`:调用成功 + * - `-1`:调用失败。原因为在调用 enableRangeAudio:{@link #ByteRTCRangeAudio#enableRangeAudio:} 开启范围语音前或进房前调用本接口 + * @note 音量衰减范围通过 updateReceiveRange:{@link #ByteRTCRangeAudio#updateReceiveRange:} 进行设置。 + * @list 高级功能 + */ + +- (int)setAttenuationModel:(ByteRTCAttenuationType) type coefficient:(float)coefficient; +/** + * + * @type api + * @brief 添加标签组,用于标记相互之间通话不衰减的用户组。
    + * 在同一个 RTC 房间中,如果多个用户的标签组之间有交集,那么,他们之间互相通话时,通话不衰减。
    + * 比如,用户身处多个队伍,队伍成员间通话不衰减。那么,可以为每个队伍绑定专属标签,每个用户的标签组包含用户所属各个队伍的标签。 + * @param flags 标签组。 + * @list 高级功能 + */ + +- (void) setNoAttenuationFlags:(NSArray *_Nonnull)flags; + +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRtsDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRtsDefines.h new file mode 100644 index 0000000..e950d2b --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCRtsDefines.h @@ -0,0 +1,1183 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Common Defines +*/ + +#import +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR +#import +typedef UIView ByteRTCView; +typedef UIImage ByteRTCImage; +#elif TARGET_OS_MAC +#import +typedef NSView ByteRTCView; +typedef NSImage ByteRTCImage; +#endif + +#ifdef __APPLE__ +#define _BYTERTC_PLATFORM_APPLE 1 +#include +#if TARGET_OS_IPHONE +#define _BYTERTC_PLATFORM_MAC 0 +#define _BYTERTC_PLATFORM_IOS 1 +#elif TARGET_IPHONE_SIMULATOR +#define _BYTERTC_PLATFORM_MAC 0 +#define _BYTERTC_PLATFORM_IOS 1 +#elif TARGET_OS_MAC +#define _BYTERTC_PLATFORM_MAC 1 +#define _BYTERTC_PLATFORM_IOS 0 +#else +#error "Unknown Apple platform" +#endif +#endif + +#define BYTERTC_TARGET_MAC (_BYTERTC_PLATFORM_MAC == 1) +#define BYTERTC_TARGET_IOS (_BYTERTC_PLATFORM_IOS == 1) + +#define BYTERTC_APPLE_EXPORT __attribute__((visibility("default"))) + + +/** + * + * @type keytype + * @hidden currently not available + */ + +typedef NS_ENUM(NSInteger, ByteRTSReturnStatus) { + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusSuccess = 0, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusFailure = -1, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusParameterErr = -2, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusWrongState = -3, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusHasInRoom = -4, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusHasInLogin = -5, + /** + * + * @hidden currently not available + */ + + ByteRTSReturnStatusRoomIdInUse = -8, +}; + + +/** + * + * @type keytype + * @brief 远端用户离开房间的原因。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCUserOfflineReason) { + /** + * + * @brief 远端用户调用 `leaveRoom` 方法主动退出房间。 + */ + + ByteRTCUserOfflineReasonQuit = 0, + /** + * + * @brief 远端用户因网络等原因掉线。 + */ + + ByteRTCUserOfflineReasonDropped = 1, + /** + * + * @brief 远端用户切换至隐身状态。 + */ + + ByteRTCUserOfflineReasonSwitchToInvisible = 2, + /** + * + * @brief 远端用户被踢出房间。
    + * 因调用踢出用户的 OpenAPI,远端用户被踢出房间。 + */ + + ByteRTCUserOfflineReasonKickedByAdmin = 3, +}; + +/** + * + * @type keytype + * @brief SDK 与信令服务器连接状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCConnectionState) { + /** + * + * @brief 连接断开超过 12s,此时 SDK 会尝试自动重连。 + */ + + ByteRTCConnectionStateDisconnected = 1, + /** + * + * @brief 首次请求建立连接,正在连接中。 + */ + + ByteRTCConnectionStateConnecting = 2, + /** + * + * @brief 首次连接成功。 + */ + + ByteRTCConnectionStateConnected = 3, + /** + * + * @brief 涵盖了以下情况:
    + * - 首次连接时,10 秒连接不成功; + * - 连接成功后,断连 10 秒。自动重连中。 + */ + + ByteRTCConnectionStateReconnecting = 4, + /** + * + * @brief 连接断开后,重连成功。 + */ + + ByteRTCConnectionStateReconnected = 5, + /** + * + * @brief 处于 `ByteRTCConnectionStateDisconnected` 状态超过 10 秒,且期间重连未成功。SDK 仍将继续尝试重连。 + */ + + ByteRTCConnectionStateLost = 6, + /** + * + * @brief 连接失败,服务端状态异常。SDK 不会自动重连,请重新进房,或联系技术支持。 + */ + + ByteRTCConnectionStateFailed = 7, +}; + +/** + * + * @type keytype + * @brief SDK 网络连接类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCNetworkType) { + /** + * + * @brief 网络连接类型未知。 + */ + + ByteRTCNetworkTypeUnknown = -1, + /** + * + * @brief 网络连接已断开。 + */ + + ByteRTCNetworkTypeDisconnected = 0, + /** + * + * @brief 网络连接类型为 LAN 。 + */ + + ByteRTCNetworkTypeLAN = 1, + /** + * + * @brief 网络连接类型为 Wi-Fi(包含热点)。 + */ + + ByteRTCNetworkTypeWIFI = 2, + /** + * + * @brief 网络连接类型为 2G 移动网络。 + */ + + ByteRTCNetworkTypeMobile2G = 3, + /** + * + * @brief 网络连接类型为 3G 移动网络。 + */ + + ByteRTCNetworkTypeMobile3G = 4, + /** + * + * @brief 网络连接类型为 4G 移动网络。 + */ + + ByteRTCNetworkTypeMobile4G = 5, + /** + * + * @brief 网络连接类型为 5G 移动网络。 + */ + + ByteRTCNetworkTypeMobile5G = 6, +}; + +/** + * + * @type keytype + * @brief 媒体流网络质量。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCNetworkQuality) { + /** + * + * @brief 网络质量未知。 + */ + + ByteRTCNetworkQualityUnknown = 0, + /** + * + * @brief 网络质量极好。 + */ + + ByteRTCNetworkQualityExcellent = 1, + /** + * + * @brief 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。 + */ + + ByteRTCNetworkQualityGood = 2, + /** + * + * @brief 主观感受有瑕疵但不影响沟通。 + */ + + ByteRTCNetworkQualityPoor = 3, + /** + * + * @brief 勉强能沟通但不顺畅。 + */ + + ByteRTCNetworkQualityBad = 4, + /** + * + * @brief 网络质量非常差,基本不能沟通。 + */ + + ByteRTCNetworkQualityVeryBad = 5, + /** + * + * @brief 网络连接断开,无法通话。网络可能由于 12s 内无应答、开启飞行模式、拔掉网线等原因断开。
    + * 更多网络状态信息参见 [连接状态提示](https: + */ + + ByteRTCNetworkQualityDown = 6, +}; + +/** + * + * @type errorcode + * @brief 回调错误码。
    + * SDK 内部遇到不可恢复的错误时,会通过 `rtcEngine:onError:` 回调通知用户。 + */ + +typedef NS_ENUM(NSInteger, ByteRTSErrorCode) { + /** + * + * @brief Token 无效。
    + * 进房时使用的 Token 无效或过期失效。需要用户重新获取 Token,并调用
    + * `updateToken:` 方法更新 Token。 + */ + + ByteRTSErrorCodeInvalidToken = -1000, + /** + * + * @brief 加入房间错误。
    + * 进房时发生未知错误导致加入房间失败。需要用户重新加入房间。 + */ + + ByteRTSErrorCodeJoinRoom = -1001, + /** + * + * @brief 相同用户 ID 的用户加入本房间,当前用户被踢出房间 + */ + + ByteRTSErrorCodeDuplicateLogin = -1004, + + /** + * + * @brief 服务端调用 OpenAPI 将当前用户踢出房间 + */ + + ByteRTSErrorCodeKickedOut = -1006, + + /** + * + * @brief 当调用 `createRtcRoom:` ,如果 roomId 非法,会返回 null,并抛出该错误 + */ + + ByteRTSErrorCodeRoomIdIllegal = -1007, + + /** + * + * @brief Token 过期。调用 `joinRoomByKey:roomId:userInfo:rtcRoomConfig:` 使用新的 Token 重新加入房间。 + */ + + ByteRTSErrorCodeTokenExpired = -1009, + /** + * + * @brief 调用 `updateToken:` 传入的 Token 无效 + */ + + ByteRTSErrorCodeUpdateTokenWithInvalidToken = -1010, + + /** + * + * @brief 服务端调用 OpenAPI 解散房间,所有用户被移出房间。 + */ + + ByteRTSErrorCodeRoomDismiss = -1011, + + /** + * + * @brief 通话回路检测已经存在同样 roomId 的房间了 + */ + + ByteRTSErrorRoomAlreadyExist = -1013, + + /** + * + * @brief 加入多个房间时使用了不同的 uid。
    + * 同一个引擎实例中,用户需使用同一个 uid 加入不同的房间。 + */ + + ByteRTSErrorUserIDDifferent = -1014, + + /** + * + * @brief 服务端异常状态导致退出房间。
    + * SDK 与信令服务器断开,并不再自动重连,可联系技术支持。 + */ + + ByteRTSErrorCodeAbnormalServerStatus = -1084, +}; + +/** + * + * @type errorcode + * @brief 回调警告码。
    + * 警告码说明 SDK 内部遇到问题正在尝试恢复。警告码仅作通知。 + */ + +typedef NS_ENUM(NSInteger, ByteRTSWarningCode) { + /** + * + * @brief 进房失败。
    + * 初次进房或者由于网络状况不佳断网重连时,由于服务器错误导致进房失败。SDK 会自动重试进房。 + */ + + ByteRTSWarningCodeJoinRoomFailed = -2001, + /** + * + * @brief 发布音视频流失败。
    + * 当你在所在房间中发布音视频流时,由于服务器错误导致发布失败。SDK 会自动重试发布。 + */ + + ByteRTSWarningCodePublishStreamFailed = -2002, + /** + * + * @hidden currently not available + * @brief 函数调用顺序错误,当前代码中未使用。 + */ + + ByteRTSWarningCodeInvokeError = -2005, + /** + * + * @hidden for internal use only + * @brief 调度异常,服务器返回的媒体服务器地址不可用。 + */ + + ByteRTSWarningCodeInvalidExpectMediaServerAddress = -2007, + /** + * + * @brief 发送自定义广播消息失败,当前你未在房间中。 + */ + + ByteRTSWarningCodeSendCustomMessage = -2011, + /** + * + * @hidden + * @deprecated since 3.46 and will be deleted in 3.52. + * @brief 同样 roomid 的房间已经存在了 + */ + + ByteRTSWarningCodeRoomAlreadyExist = -2015, + + /** + * + * @brief 新生成的房间已经替换了同样 roomId 的旧房间 + */ + + ByteRTSWarningCodeOldRoomBeenReplaced = -2016 +}; + +/** + * + * @type keytype + * @brief 日志级别。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLogLevel) { + /** + * + * @brief 打印 trace 级别及以上级别信息。 + */ + + ByteRTCLogLevelTrace, + /** + * + * @brief 打印 debug 级别及以上级别信息。 + */ + + ByteRTCLogLevelDebug, + /** + * + * @brief 打印 info 级别及以上级别信息。 + */ + + ByteRTCLogLevelInfo, + /** + * + * @brief 打印 warning 级别及以上级别信息。 + */ + + ByteRTCLogLevelWarning, + /** + * + * @brief 打印 error 级别信息。 + */ + + ByteRTCLogLevelError, +}; + +/** + * + * @type errorcode + * @brief 登录结果
    + * 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录的结果,会通过 rtcEngine:onLoginResult:errorCode:elapsed:{@link #ByteRTCEngineDelegate#rtcEngine:onLoginResult:errorCode:elapsed:} 回调通知用户。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLoginErrorCode) { + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法登录成功。 + */ + + ByteRTCLoginErrorCodeSuccess = 0, + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法时使用的 Token 无效或过期失效。需要用户重新获取 Token。 + */ + + ByteRTCLoginErrorCodeInvalidToken = -1000, + /** + * + * @brief 登录错误
    + * 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法时发生未知错误导致登录失败。需要用户重新登录。 + */ + + ByteRTCLoginErrorCodeLoginFailed = -1001, + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 方法时传入的用户 ID 有问题。 + */ + + ByteRTCLoginErrorCodeInvalidUserId = -1002, + /** + * + * @brief 调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录时服务器错误。 + */ + + ByteRTCLoginErrorCodeServerError = -1003, +}; + +/** + * + * @type keytype + * @brief 用户登出的原因 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLogoutReason) { + /** + * + * @brief 用户主动退出
    + * 用户调用 `logout` 接口登出,或者销毁引擎登出。 + */ + + ByteRTCLogoutReasonLogout = 0, + /** + * + * @brief 用户被动退出
    + * 另一个用户以相同 UserId 进行了 `login`,导致本端用户被踢出。 + */ + + ByteRTCLogoutReasonDuplicateLogin = 1, +}; + +/** + * + * @type keytype + * @brief 发送消息的可靠有序类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMessageConfig) { + /** + * + * @brief 低延时可靠有序消息 + */ + + ByteRTCMessageConfigReliableOrdered = 0, + /** + * + * @brief 超低延时有序消息 + */ + + ByteRTCMessageConfigUnreliableOrdered = 1, + /** + * + * @brief 超低延时无序消息 + */ + + ByteRTCMessageConfigUnreliableUnordered = 2, +}; + +/** + * + * @type errorcode + * @brief 发送消息结果,成功或失败,及失败原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCUserMessageSendResult) { + /** + * + * @brief 发送消息成功。 + */ + + ByteRTCUserMessageSendResultSuccess = 0, + /** + * + * @brief 消息发送失败。发送超时。 + */ + + ByteRTCUserMessageSendResultTimeout = 1, + /** + * + * @brief 消息发送失败。连接断开,消息未发出。 + */ + + ByteRTCUserMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 消息发送失败。找不到接收方。 + */ + + ByteRTCUserMessageSendResultNoReceiver = 3, + /** + * + * @brief 消息发送失败。远端用户没有登录或进房。 + */ + + ByteRTCUserMessageSendResultNoRelayPath = 4, + /** + * + * @brief 消息发送失败。超过 QPS 限制。 + */ + + ByteRTCUserMessageSendResultExceedQPS = 5, + /** + * + * @brief 消息发送失败。应用服务器未收到客户端发送的消息。
    + * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + ByteRTCUserMessageSendResultE2BSSendFailed = 17, + /** + * + * @brief 消息发送失败。应用服务器接收到了客户端发送的消息,但响应失败。
    + * 由 `sendServerMessage`/`sendServerBinaryMessage` 触发,通过 `onServerMessageSendResult` 回调。 + */ + + ByteRTCUserMessageSendResultE2BSReturnFailed = 18, + /** + * + * @brief 消息发送失败。消息发送方没有加入房间。 + */ + + ByteRTCUserMessageSendResultNotJoin = 100, + /** + * + * @brief 消息发送失败。连接未完成初始化。 + */ + + ByteRTCUserMessageSendResultInit = 101, + /** + * + * @brief 消息发送失败。没有可用的数据传输通道连接。 + */ + + ByteRTCUserMessageSendResultNoConnection = 102, + /** + * + * @brief 消息发送失败。消息超过最大长度。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + ByteRTCUserMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 消息发送失败。接收方用户 ID 为空。 + */ + + ByteRTCUserMessageSendResultEmptyUser = 104, + /** + * + * @brief 消息发送失败。房间外或应用服务器消息发送方没有登录。 + */ + + ByteRTCUserMessageSendResultNotLogin = 105, + /** + * + * @brief 消息发送失败。发送消息给业务方服务器之前没有设置参数。 + */ + + ByteRTCUserMessageSendResultServerParamsNotSet = 106, + /** + * + * @brief 失败,未知错误。 + */ + + ByteRTCUserMessageSendResultUnknown = 1000, +}; + +/** + * + * @type keytype + * @brief 用户在线状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCUserOnlineStatus) { + /** + * + * @brief 对端用户离线
    + * 对端用户已经调用 `logout`,或者没有调用 login:uid:{@link #ByteRTCEngine#login:uid:} 进行登录 + */ + + ByteRTCUserOnlineStatusOffline = 0, + /** + * + * @brief 对端用户在线
    + * 对端用户调用 login:uid:{@link #ByteRTCEngine#login:uid:} 登录,并且连接状态正常 + */ + + ByteRTCUserOnlineStatusOnline = 1, + /** + * + * @brief 无法获取对端用户在线状态
    + * 发生级联错误、对端用户在线状态异常时返回 + */ + + ByteRTCUserOnlineStatusUnreachable = 2, +}; + +/** + * + * @type errorcode + * @brief 房间内广播消息发送结果 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRoomMessageSendResult) { + /** + * + * @brief 消息发送成功 + */ + + ByteRTCRoomMessageSendResultSuccess = 200, + /** + * + * @brief 发送超时,没有发送 + */ + + ByteRTCRoomMessageSendResultTimeout = 1, + /** + * + * @brief 通道断开,没有发送 + */ + + ByteRTCRoomMessageSendResultNetworkDisconnected = 2, + /** + * + * @brief 超过 QPS 限制 + */ + + ByteRTCRoomMessageSendResultExceedQPS = 5, + /** + * + * @brief 失败,发送方未加入房间 + */ + + ByteRTCRoomMessageSendResultNotJoin = 100, + /** + * + * @brief 失败,连接未完成初始化。 + */ + + ByteRTCRoomMessageSendResultInit = 101, + /** + * + * @brief 失败,没有可用的连接。 + */ + + ByteRTCRoomMessageSendResultNoConnection = 102, + /** + * + * @brief 消息超过最大长度。默认消息最大长度为 1 KB;若[启用了 RTS 高级功能](https: + */ + + ByteRTCRoomMessageSendResultExceedMaxLength = 103, + /** + * + * @brief 失败,未知错误。 + */ + + ByteRTCRoomMessageSendResultUnknown = 1000, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief SDK 的服务器环境。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCEnv) { + /** + * + * @brief 线上环境。 + */ + + ByteRTCEnvProduct = 0, + /** + * + * @brief BOE 环境。 + */ + + ByteRTCEnvBOE = 1, + /** + * + * @brief 测试环境。 + */ + + ByteRTCEnvTest = 2, +}; + +/** + * + * @type keytype + * @brief 本地日志输出等级。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalLogLevel) { + /** + * + * @brief 信息级别。 + */ + + ByteRTCLocalLogLevelInfo = 0, + /** + * + * @brief (默认值)警告级别。 + */ + + ByteRTCLocalLogLevelWarning = 1, + /** + * + * @brief 错误级别。 + */ + + ByteRTCLocalLogLevelError = 2, + /** + * + * @brief 关闭日志。 + */ + + ByteRTCLocalLogLevelNone = 3 +}; + +/** + * + * @type keytype + * @brief App 使用的 cpu 和 memory 信息
    + * 信息由 SDK 周期性(2s)地通过 `reportSysStats` 回调事件通知给用户。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSysStats : NSObject +/** + * + * @brief 当前系统 cpu 核数 + */ + +@property(assign, nonatomic) unsigned int cpuCores; +/** + * + * @brief 当前应用的 CPU 使用率,取值范围为 [0, 1]。 + */ + +@property(assign, nonatomic) double cpuAppUsage; +/** + * + * @hidden currently not available + * @brief 当前系统的 CPU 使用率,取值范围为 [0, 1]。 + */ + +@property(assign, nonatomic) double cpuTotalUsage; +/** + * + * @brief 当前 App 的内存使用(单位 MB) + */ + +@property(assign, nonatomic) double memoryUsage; +/** + * + * @brief 全量内存(单位 MB) + */ + +@property(assign, nonatomic) unsigned long long fullMemory; +/** + * + * @brief 系统已使用内存(单位 MB) + */ + +@property(assign, nonatomic) unsigned long long totalMemoryUsage; +/** + * + * @brief 空闲可分配内存(单位 MB) + */ + +@property(assign, nonatomic) unsigned long long freeMemory; +/** + * + * @brief 当前应用的内存使用率(单位 %) + */ + +@property(assign, nonatomic) double memoryRatio; +/** + * + * @brief 系统内存使用率(单位 %) + */ + +@property(assign, nonatomic) double totalMemoryRatio; +@end + +/** + * + * @type keytype + * @brief 本地日志参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLogConfig : NSObject +/** + * + * @brief 日志存储路径,必填。 + */ + +@property(copy, nonatomic) NSString *_Nonnull logPath; + +/** + * + * @brief 日志等级,参看 ByteRTCLocalLogLevel{@link #ByteRTCLocalLogLevel},默认为警告级别,选填。 + */ + +@property(assign, nonatomic) ByteRTCLocalLogLevel logLevel; + +/** + * + * @brief 日志文件最大占用的总空间,单位为 MB,选填。取值范围为 1~100 MB,默认值为 10 MB。
    + * 若 `logFileSize` < 1,取 1 MB。若 `logFileSize` > 100,取 100 MB。
    + * 其中,单个日志文件最大为 2 MB:
    + *
    • 若 1 ≤ logFileSize ≤ 2,则会生成一个日志文件。
    • 若 logFileSize > 2,假设 logFileSize/2 的整数部分为 N,则前 N 个文件,每个文件会写满 2 MB,第 N+1 个文件大小不超过 logFileSize mod 2,否则会删除最老的文件,以此类推。
    + */ + +@property(assign, nonatomic) int logFileSize; + +/** + * + * @brief 日志文件名前缀,选填。该字符串必须符合正则表达式:[a-zA-Z0-9_@\-\.]{1,128}。
    + * 最终的日志文件名为`前缀 + "_" + 文件创建时间 + "_rtclog".log`,如 `logPrefix_2023-05-25_172324_rtclog.log`。 + */ + +@property(copy, nonatomic) NSString *_Nonnull logFilenamePrefix; +@end + +/** + * + * @hidden for internal use only + * @type callback + * @brief 非业务相关的监控事件回调 + */ + +@protocol ByteRTCMonitorDelegate +@optional +/** + * + * @type callback + * @brief 埋点日志回调 + * @param data
    + * 具体的埋点内容 + * @param type
    + * 埋点的类型 + */ + +- (void)onMonitorLog:(NSDictionary * _Nullable)data withType:(NSString * _Nullable)type; + +/** + * + * @type api + * @brief 是否进行控制台输出 + * @return + * 返回是否进行控制台输出
    + * - YES 输出所有的日志到控制台 + * - NO 不输出任何控制台信息 + */ + +- (BOOL)isConsole; + +/** + * + * @type callback + * @brief 输出更多的调试信息。 + * @param level 日志等级,参看 ByteRTCLogLevel{@link #ByteRTCLogLevel}。 + * @param filename 日志文件名称。 + * @param tag 日志标签。 + * @param line 行数 + * @param funcName 函数名称 + * @param format 格式 + */ + +- (void)onVerboseLogWithLevel:(ByteRTCLogLevel)level + filename:(NSString * _Nonnull)filename + tag:(NSString * _Nonnull)tag + line:(int)line + functionName:(NSString * _Nonnull)funcName + format:(NSString * _Nonnull)format; +@end + +/** + * + * @type keytype + * @brief 云代理信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCCloudProxyInfo: NSObject +/** + * + * @type keytype + * @brief 云代理服务器 IP + */ + +@property(strong, nonatomic) NSString* _Nonnull cloudProxyIp; +/** + * + * @type keytype + * @brief 云代理服务器端口 + */ + +@property(assign, nonatomic) int cloudProxyPort; +@end + +/** + * + * @type keytype + * @brief 本地代理的类型。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalProxyType) { + /** + * + * @brief Socks5 代理。选用此代理服务器,需满足 Socks5 协议标准文档的要求。 + */ + + ByteRTCLocalProxyTypeSocks5 = 1, + /** + * + * @brief Http 隧道代理。 + */ + + ByteRTCLocalProxyTypeHttpTunnel = 2, +}; + +/** + * + * @type keytype + * @brief 本地代理配置详细信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalProxyInfo : NSObject +/** + * + * @brief 本地代理的类型,参看 ByteRTCLocalProxyType{@link #ByteRTCLocalProxyType}。 + */ + +@property(assign, nonatomic) ByteRTCLocalProxyType localProxyType; +/** + * + * @type keytype + * @brief 本地代理服务器 IP。 + */ + +@property(copy, nonatomic) NSString * _Nullable localProxyIp; +/** + * + * @type keytype + * @brief 本地代理服务器端口。 + */ + +@property(assign, nonatomic) int localProxyPort; + /** + * + * @type keytype + * @brief 本地代理用户名。 + */ + +@property(copy, nonatomic) NSString * _Nullable localProxyUsername; + /** + * + * @brief 本地代理密码。 + */ + +@property(copy, nonatomic) NSString * _Nullable localProxyPassword; +@end + +/** + * + * @type keytype + * @brief 本地代理连接状态。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalProxyState) { + /** + * + * @brief TCP 代理服务器连接成功。 + */ + + ByteRTCLocalProxyStateInited = 0, + + /** + * + * @brief 本地代理连接成功。 + */ + + ByteRTCLocalProxyStateConnected = 1, + + /** + * + * @brief 本地代理连接出现错误。 + */ + + ByteRTCLocalProxyStateError = 2, +}; + +/** + * + * @type keytype + * @brief 本地代理错误。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCLocalProxyError) { + /** + * + * @brief 本地代理服务器无错误。 + */ + + ByteRTCLocalProxyErrorOK = 0, + + /** + * + * @brief 代理服务器回复的版本号不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5VersionError = 1, + + /** + * + * @brief 代理服务器回复的格式错误不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5FormatError = 2, + + /** + * + * @brief 代理服务器回复的字段值不符合 Socks5 协议标准文档的规定,导致 Socks5 代理连接失败。请检查代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5InvalidValue = 3, + + /** + * + * @brief 未提供代理服务器的用户名及密码,导致 Socks5 代理连接失败。请重新调用 `setLocalProxy`,在设置本地代理时填入用户名和密码。 + */ + + ByteRTCLocalProxyErrorSocks5UserPassNotGiven = 4, + + /** + * + * @brief TCP 关闭,导致 Socks5 代理连接失败。请检查网络或者代理服务器是否存在异常。 + */ + + ByteRTCLocalProxyErrorSocks5TcpClosed = 5, + + /** + * + * @brief Http 隧道代理错误。请检查 Http 隧道代理服务器或者网络是否存在异常。 + */ + + ByteRTCLocalProxyErrorHttpTunnelFailed = 6, +}; + +/** + * + * @type keytype + * @brief 创建引擎参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEngineConfig: NSObject +/** + * + * @brief 每个应用的唯一标识符。只有使用相同的 app_id 生成的实例,才能够进行音视频通信。 + */ + +@property(copy, nonatomic) NSString* _Nonnull appID; + +/** + * + * @brief 是否是游戏场景。 + */ + +@property(assign, nonatomic) BOOL isGameScene; + +/** + * + * @brief 私有参数。如需使用请联系技术支持人员。 + */ + +@property(copy, nonatomic) NSDictionary* _Nullable parameters; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCScreenCapturerExt.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCScreenCapturerExt.h new file mode 100644 index 0000000..548c8c0 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCScreenCapturerExt.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. +*/ + +#pragma once + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN +#define BYTE_RTC_EXPORT __attribute__((visibility("default"))) +/** + * + * @type callback + * @brief 屏幕采集相关扩展协议,仅适用于 SDK 内部采集。
    + * 用户创建 extension 后生成的 SampleHandler 需继承此协议以实现屏幕共享相关能力。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +BYTE_RTC_EXPORT @protocol ByteRtcScreenCapturerExtDelegate +/** + * + * @type api + * @brief 通知 Broadcast Upload Extension 停止采集屏幕并退出。 + * @note iOS 端调用 stopScreenCapture{@link #ByteRTCEngine#stopScreenCapture},或 macOS 端调用 stopScreenVideoCapture{@link #ByteRTCEngine#stopScreenVideoCapture},会触发该方法通知 extension 端的 SDK 停止屏幕采集。 + * @list 视频管理 + */ + +- (void)onQuitFromApp; +/** + * + * @type api + * @brief Socket 收到 App 侧发来的信息时,触发该回调 + * @param message App 侧发送的消息 + * @list 视频管理 + */ + +- (void)onReceiveMessageFromApp:(NSData *)message; +/** + * + * @type api + * @brief Socket 连接断开时触发此回调 + * @list 视频管理 + */ + +- (void)onSocketDisconnect; +/** + * + * @type api + * @brief Socket 连接成功时触发此回调 + * @list 视频管理 + */ + +- (void)onSocketConnect; +/** + * + * @type api + * @brief 检测到 App 正在进行音视频通话时触发此回调。 + * @list 视频管理 + */ + +- (void)onNotifyAppRunning; +@end + +/** + * + * @type keytype + * @brief 屏幕采集相关扩展实例,仅适用于 SDK 内部采集。
    + * 用户创建 extension 后生成的 SampleHandler 需通过此实例实现屏幕共享相关能力。 + */ + +BYTE_RTC_EXPORT @interface ByteRtcScreenCapturerExt : NSObject +/** + * + * @type keytype + * @brief 只读变量,用于获取 ByteRtcScreenCapturerExt 实例。 + */ + +@property (readonly, class) ByteRtcScreenCapturerExt *shared; +/** + * + * @type keytype + * @brief ByteRtcScreenCapturerExt 实例的回调代理。 + */ + +@property (nonatomic, weak, nullable) NSObject *delegate; +/** + * + * @type api + * @brief 开始屏幕采集
    + * Extension 启动后,系统将自动调用该方法开启屏幕采集。 + * @param delegate 回调代理,参看 ByteRtcScreenCapturerExtDelegate{@link #ByteRtcScreenCapturerExtDelegate} + * @param groupId App groups 中配置的 group ID + * @list 视频管理 + */ + +- (void)startWithDelegate:(NSObject *)delegate groupId:(NSString *)groupId; +/** + * + * @type api + * @brief 结束屏幕采集
    + * Extension 关闭后,系统将自动调用该方法停止屏幕采集。 + * @list 视频管理 + */ + +- (void)stop; +/** + * + * @type api + * @brief 推送 Extension 采集的数据 + * @param sampleBuffer 采集到的数据 + * @param sampleBufferType 数据类型 + * @list 视频管理 + */ + +- (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType API_AVAILABLE(ios(10)); +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSingScoringManager.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSingScoringManager.h new file mode 100644 index 0000000..28d841d --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSingScoringManager.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCAudioMixingManager +*/ + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type callback + * @brief K 歌评分事件回调类。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCSingScoringDelegate +@required +/** + * + * @type callback + * @brief 实时评分信息回调。调用 startSingScoring:scoringInfoInterval:{@link #ByteRTCSingScoringManager#startSingScoring:scoringInfoInterval:} 后,会收到该回调。 + * @param info 实时评分信息。详见 ByteRTCSingScoringRealtimeInfo{@link #ByteRTCSingScoringRealtimeInfo}。 + * @list 在线 KTV + */ + +- (void)onCurrentScoringInfo:(ByteRTCSingScoringRealtimeInfo * _Nullable)info; +@end +/** + * + * @type api + * @brief K 歌评分管理接口。 + * @list Online Karaoke + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSingScoringManager :NSObject +/** + * + * @type api + * @brief 初始化 K 歌评分。 + * @param singScoringAppkey K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param singScoringToken K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 + * @param delegate K 歌评分事件回调类,详见 ByteRTCSingScoringDelegate{@link #ByteRTCSingScoringDelegate}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note 输入正确的鉴权信息才可以使用 K 歌评分相关的功能,鉴权方式为离线鉴权,根据包名(bundleID)绑定 Appkey 及 Token,K 歌评分密钥请联系技术支持人员申请。 + * @list 在线 KTV + */ + +-(int)initSingScoring:(NSString * _Nullable)singScoringAppkey + singScoringToken:(NSString * _Nullable)singScoringToken + delegate:(id _Nullable)delegate; +/** + * + * @type api + * @brief 设置 K 歌评分参数。 + * @param config K 歌评分的各项参数,详见 ByteRTCSingScoringConfig{@link #ByteRTCSingScoringConfig}。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @list 在线 KTV + */ + +-(int)setSingScoringConfig:(ByteRTCSingScoringConfig * _Nullable)config; +/** + * + * @type api + * @brief 获取标准音高数据。 + * @param midiFilepath 歌曲 midi 文件路径。 + * @return ByteRTCStandardPitchInfo{@link #ByteRTCStandardPitchInfo} 标准音高数据数组。 + * @note + * - 请保证此接口传入的 midi 文件路径与 setSingScoringConfig:{@link #ByteRTCSingScoringManager#setSingScoringConfig:} 接口中传入的路径一致。 + * @list 在线 KTV + */ + +-(NSArray * _Nullable)getStandardPitchInfo:(NSString* _Nullable)midiFilepath; +/** + * + * @type api + * @brief 开始 K 歌评分。 + * @param position 开始评分时,音乐的播放进度,单位:ms。 + * @param scoringInfoInterval 实时回调的时间间隔,单位:ms;默认 50 ms。最低间隔为 20 ms。 + * @return + * - 0:配置成功。 + * - -1:接口调用失败。 + * - -2:未集成 K 歌评分模块。 + * - >0:其他错误,具体参看[错误码表](https: + * @note + * - 在调用 initSingScoring:singScoringToken:delegate:{@link #ByteRTCSingScoringManager#initSingScoring:singScoringToken:delegate:} 初始化 K 歌评分功能后调用该接口。 + * - 调用该接口后,将会根据设置的回调时间间隔,收到评分结果 onCurrentScoringInfo:{@link #ByteRTCSingScoringDelegate#onCurrentScoringInfo:} 回调。 + * - 如果使用 `ByteRTCMediaPlayer` 播放伴奏,请在收到 onMediaPlayerStateChanged:state:error:{@link #ByteRTCMediaPlayerEventHandler#onMediaPlayerStateChanged:state:error:} 回调且播放状态为 ByteRTCPlayerStatePlaying 后,调用此接口。 + * @list 在线 KTV + */ + +-(int)startSingScoring:(int)position + scoringInfoInterval:(int)scoringInfoInterval; +/** + * + * @type api + * @brief 停止 K 歌评分。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 在线 KTV + */ + +-(int)stopSingScoring; +/** + * + * @type api + * @brief 获取上一句的演唱评分。调用 startSingScoring:scoringInfoInterval:{@link #ByteRTCSingScoringManager#startSingScoring:scoringInfoInterval:} 开始评分后可以调用该接口。 + * @return + * - <0:获取评分失败。 + * - >=0:上一句歌词的演唱评分。 + * @list 在线 KTV + */ + +-(int)getLastSentenceScore; +/** + * + * @type api + * @brief 获取当前演唱总分。调用 startSingScoring:scoringInfoInterval:{@link #ByteRTCSingScoringManager#startSingScoring:scoringInfoInterval:} 开始评分后可以调用该接口。 + * @return + * - <0:获取总分失败。 + * - >=0:当前演唱总分。 + * @list 在线 KTV + */ + + -(int)getTotalScore; + /** + * + * @type api + * @brief 获取当前演唱歌曲的平均分。 + * @return + * - <0:获取平均分失败。 + * - >=0:当前演唱平均分。 + * @list 在线 KTV + */ + +-(int)getAverageScore; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSpatialAudio.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSpatialAudio.h new file mode 100644 index 0000000..94cf1cb --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCSpatialAudio.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @company ByteDance.Inc + * @brief spatial audio interface + */ + +#pragma once + +#import +#import "ByteRTCAudioDefines.h" +/** + * + * @type api + * @brief 空间音频接口实例 + * @list + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSpatialAudio : NSObject +/** + * + * @type api + * @brief 开启/关闭空间音频功能。 + * @param enable 是否开启空间音频功能:
    + * - YES:开启 + * - NO:关闭(默认) + * @note 该方法仅开启空间音频功能,你须调用 updateSelfPosition:{@link #ByteRTCSpatialAudio#updateSelfPosition:} 设置自身位置坐标后方可收听空间音频效果。空间音频相关 API 和调用时序详见[空间音频](https: + * @list 音频处理 + */ + +- (void)enableSpatialAudio:(BOOL)enable; +/** + * + * @type api + * @brief 关闭本地用户朝向对本地用户发声效果的影响。
    + * 调用此接口后,房间内的其他用户收听本地发声时,声源都在收听者正面。 + * @note + * - 调用本接口关闭朝向功能后,在当前的空间音频实例的生命周期内无法再次开启。 + * - 调用此接口不影响本地用户收听朝向的音频效果。要改变本地用户收听朝向,参看 updateSelfPosition:{@link #ByteRTCSpatialAudio#updateSelfPosition:} 和 updateRemotePosition:positionInfo:{@link #ByteRTCSpatialAudio#updateRemotePosition:positionInfo:}。 + * @list 高级功能 + */ + +-(void)disableRemoteOrientation; +/** + * + * @valid since 3.52 + * @type api + * @brief 设置本地用户在自建空间直角坐标系中的收听坐标和收听朝向,以实现本地用户预期的空间音频收听效果。 + * @param positionInfo 空间音频位置信息。参看 ByteRTCPositionInfo{@link #ByteRTCPositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验本地用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * - 该方法需在进房后调用。 + * - 调用该接口更新坐标前,你需调用 enableSpatialAudio:{@link #ByteRTCSpatialAudio#enableSpatialAudio:} 开启空间音频功能。空间音频相关 API 和调用时序详见[空间音频](https: + * - 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 高级功能 + */ + +-(int)updateSelfPosition:(ByteRTCPositionInfo* _Nonnull)positionInfo; +/** + * + * @valid since 3.52 + * @type api + * @brief 设置房间内某一远端用户在本地用户自建的空间音频坐标系中的发声位置和发声朝向,以实现本地用户预期的空间音频收听效果。 + * @param uid 用户 ID + * @param positionInfo 远端用户的空间音频位置信息。参看 ByteRTCPositionInfo{@link #ByteRTCPositionInfo}。 + * @return + * - 0:成功。 + * - <0:失败。 + * - -2: 失败,原因是校验远端用户的三维朝向信息时,三个向量没有两两垂直。 + * @note + * 该方法需在创建房间后调用。
    + * 调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。 + * @list 音频管理 + */ + +-(int)updateRemotePosition:(NSString * _Nonnull)uid + positionInfo:(ByteRTCPositionInfo* _Nonnull)positionInfo; +/** + * + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition:positionInfo:{@link #ByteRTCSpatialAudio#updateRemotePosition:positionInfo:} 为某一远端用户设置的空间音频效果。 + * @param uid 远端用户 ID。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + +-(int)removeRemotePosition:(NSString * _Nonnull)uid; +/** + * + * @valid since 3.52 + * @type api + * @brief 移除调用 updateRemotePosition:positionInfo:{@link #ByteRTCSpatialAudio#updateRemotePosition:positionInfo:} 为所有远端用户设置的空间音频效果。 + * @return + * - 0:成功。 + * - <0:失败。 + * @list 高级功能 + */ + +-(int)removeAllRemotePosition; +@end \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefines.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefines.h new file mode 100644 index 0000000..967a779 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefines.h @@ -0,0 +1,5660 @@ +/* + * Copyright (c) 2022 The VolcEngineRTC project authors. All Rights Reserved. + * @brief Objective-C VolcEngineRTC Video Defines +*/ + +#import "ByteRTCAudioDefines.h" +#import "ByteRTCMediaDefines.h" + +#pragma mark - ByteRTCVideoSource +/** + * + * @type keytype + * @hidden + * @brief 视频源。预留参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoSource : NSObject + +@end + +/** + * + * @type keytype + * @brief 图片或视频流的缩放模式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRenderMode) { + /** + * + * @brief 视窗填满优先,默认值。
    + * 视频尺寸等比缩放,直至视窗被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。 + */ + + ByteRTCRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 + */ + + ByteRTCRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
    + * 视频尺寸非等比例缩放,把窗口充满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + ByteRTCRenderModeFill = 3, +}; + +/** + * + * @type keytype + * @brief 视频流类型
    + * 目前 C++ SDK 只支持 ByteRTCVideoStreamTypeHigh 类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoStreamType) { + /** + * + * @brief 高分辨率视频流 + */ + + ByteRTCVideoStreamTypeHigh = 0, + /** + * + * @brief 低分辨率视频 + */ + + ByteRTCVideoStreamTypeLow = 1, +}; + +/** + * + * @type keytype + * @brief 设置本地视频属性的返回状态。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoStreamState) { + /** + * + * @brief 设置本地视频属性成功 + */ + + ByteRTCVideoStreamStateSuccess = 0, + /** + * + * @brief 本地视频属性参数不合法 + */ + + ByteRTCVideoStreamStateInvalid = -2, +}; + +/** + * + * @type keytype + * @brief 视频输出方向模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoOutputOrientationMode) { + /** + * + * @brief 自适应布局 + */ + + ByteRTCVideoOutputOrientationModeAdaptative = 0, + /** + * + * @brief 横屏布局 + */ + + ByteRTCVideoOutputOrientationModeFixedLandscape = 1, + /** + * + * @brief 竖屏布局 + */ + + ByteRTCVideoOutputOrientationModeFixedPortrait = 2, +}; + +/** + * + * @type keytype + * @brief 视频帧朝向 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCVideoOrientation) { + /** + * + * @brief (默认)使用相机输出的原始视频帧的角度,不对视频帧进行额外旋转。 + */ + + ByteRTCVideoOrientationAdaptive = 0, + /** + * + * @brief 固定为竖屏,将相机采集到的视频帧转换为竖屏,在整个 RTC 链路中传递竖屏帧。 + */ + + ByteRTCVideoOrientationPortrait = 1, + /** + * + * @brief 固定为横屏,将相机采集到的视频帧转换为横屏,在整个 RTC 链路中传递横屏帧。 + */ + + ByteRTCVideoOrientationLandscape = 2 +}; + +/** + * + * @hidden + * @type keytype + * @deprecated since 3.29 and will be deleted in 3.51, use ByteRTCMirrorType{@link #ByteRTCMirrorType} instead. + * @brief 是否开启镜像模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMirrorMode) { + /** + * + * @brief 不开启 + */ + + ByteRTCMirrorModeOff = 0, + /** + * + * @brief 开启 + */ + + ByteRTCMirrorModeOn = 1, +}; + +/** + * + * @type keytype + * @brief 镜像类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMirrorType) { + /** + * + * @brief 本地预览和编码传输时均无镜像效果 + */ + + ByteRTCMirrorTypeNone = 0, + /** + * + * @brief 本地预览时有镜像效果,编码传输时无镜像效果 + */ + + ByteRTCMirrorTypeRender = 1, + /** + * + * @brief 本地预览时无镜像效果,仅编码传输时有镜像效果 + */ + + ByteRTCMirrorTypeEncoder = 2, + /** + * + * @brief 本地预览和编码传输时均有镜像效果 + */ + + ByteRTCMirrorTypeRenderAndEncoder = 3, +}; + +/** + * + * @type keytype + * @brief 远端流的镜像类型。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCRemoteMirrorType) { + /** + * + * @brief (默认值)远端视频渲染无镜像效果。 + */ + + ByteRTCRemoteMirrorTypeNone = 0, + /** + * + * @brief 远端视频渲染有镜像效果。 + */ + + ByteRTCRemoteMirrorTypeRender = 1, +}; + +/** + * + * @type keytype + * @brief 截图错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSnapshotErrorCode) { + /** + * + * @brief 截图成功。 + */ + + ByteRTCSnapshotErrorCodeOk = 0, + /** + * + * @brief 截图错误。生成图片数据失败或 RGBA 编码失败。 + */ + + ByteRTCSnapshotErrorCodeCreateFail = -1, + /** + * + * @brief 截图错误。流无效。 + */ + + ByteRTCSnapshotErrorCodeStreamInvalid = -2, + /** + * + * @brief 截图错误。截图超时,超时时间 1 秒。 + */ + + ByteRTCSnapshotErrorCodeTimeout = -3, + /** + * + * @brief 截图错误。图片保存失败。 + */ + + ByteRTCSnapshotErrorCodeFileSaveError = -4 +}; +/** + * + * @type keytype + * @brief 基础美颜模式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCEffectBeautyMode) { + /** + * + * @brief 美白。 + */ + + ByteRTCEffectBeautyModeWhite = 0, + /** + * + * @brief 磨皮。 + */ + + ByteRTCEffectBeautyModeSmooth = 1, + /** + * + * @brief 锐化。 + */ + + ByteRTCEffectBeautyModeSharpen = 2, + /** + * + * @valid since 3.55 + * @brief 清晰,需集成 v4.4.2+ 版本的特效 SDK。 + */ + + ByteRTCEffectBeautyModeClear = 3, +}; + +/** + * + * @type keytype + * @brief 视频帧旋转信息 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoRotation) { + /** + * + * @brief 不旋转 + */ + + ByteRTCVideoRotation0 = 0, + /** + * + * @brief 顺时针旋转 90 度 + */ + + ByteRTCVideoRotation90 = 90, + /** + * + * @brief 顺时针旋转 180 度 + */ + + ByteRTCVideoRotation180 = 180, + /** + * + * @brief 顺时针旋转 270 度 + */ + + ByteRTCVideoRotation270 = 270, +}; + +/** + * + * @type keytype + * @brief 发布大小流模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSimulcastMode) { + /** + * + * @brief 单流模式。始终只有 1 路分辨率的流。 + */ + + ByteRTCVideoSimulcastModeOnlyOne = 0, + /** + * + * @brief 按需订阅模式。发送端会根据订阅端的状态,按需发布。无订阅偏好设置默认发送 2 路。 + */ + + ByteRTCVideoSimulcastModeOnDemand, + /** + * + * @brief 订阅弱流。发送端始终按照设置的参数发布所有大小流。默认发送 2 路。 + */ + + ByteRTCVideoSimulcastModeAlwaysSimulcast, +}; + + +/** + * + * @type keytype + * @brief 订阅大小流偏好 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSimulcastStreamType) { + /** + * + * @brief 弱流,最小分辨率的流。 + */ + + ByteRTCVideoSimulcastStreamTypeWeak = 0, + /** + * + * @brief 小流 + */ + + ByteRTCVideoSimulcastStreamTypeLow, + /** + * + * @brief 中流 + */ + + ByteRTCVideoSimulcastStreamTypeMid, + /** + * + * @brief 大流 + */ + + ByteRTCVideoSimulcastStreamTypeHigh, +}; + +/** + * + * @type keytype + * @brief 自定义视频前处理(Video Processor)的作用范围,包括仅预览、仅编码和同时预览与编码。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCProcessorActionDomain) { + /** + * + * @brief 处理后的视频帧同时用于本地预览和推流编码。 + */ + + ByteRTCProcessorActionDomainPreviewAndEncode = 0, + /** + * + * @brief 处理后的视频帧仅用于本地预览。 + */ + + ByteRTCProcessorActionDomainPreview = 1, + /** + * + * @brief 处理后的视频帧仅用于推流编码。 + */ + + ByteRTCProcessorActionDomainEncode = 2 +}; + +/** + * + * @type keytype + * @brief 视频帧像素格式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoPixelFormat) { + /** + * + * @brief 未知格式 + */ + + ByteRTCVideoPixelFormatUnknown = 0, + /** + * + * @brief YUV I420 格式 + */ + + ByteRTCVideoPixelFormatI420 = 1, + /** + * + * @brief YUV NV12 格式 + */ + + ByteRTCVideoPixelFormatNV12 = 2, + /** + * + * @brief YUV NV21 格式 + */ + + ByteRTCVideoPixelFormatNV21 = 3, + /** + * + * @brief RGB 24bit 格式, + */ + + ByteRTCVideoPixelFormatRGB24 = 4, + /** + * + * @brief RGBA 编码格式 + */ + + ByteRTCVideoPixelFormatRGBA = 5, + /** + * + * @brief ARGB 编码格式 + */ + + ByteRTCVideoPixelFormatARGB = 6, + /** + * + * @brief BGRA 编码格式 + */ + + ByteRTCVideoPixelFormatBGRA = 7, + + + /** + * + * @brief 像素格式结束标志。新加的格式数值应该小于ByteRTCVideoPixelFormatEndMark。 + */ + + ByteRTCVideoPixelFormatEndMark = 0xFF, + + /** + * + * @brief Texture2D 格式 + */ + + ByteRTCVideoPixelFormatTexture2D = 0x0DE1, + /** + * + * @brief TextureOES 格式 + */ + + ByteRTCVideoPixelFormatTextureOES = 0x8D65, +}; +/** + * + * @type keytype + * @brief 视频帧缓冲区类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoBufferType) { + /** + * + * @brief 原始内存数据 + */ + + ByteRTCVideoBufferTypeRawMemory = 0, + /** + * + * @brief CVPixelBufferRef 类型 + */ + + ByteRTCVideoBufferTypeCVPixelBuffer = 1, + /** + * + * @brief OpenGL 纹理数据类型 + */ + + ByteRTCVideoBufferTypeGLTexture = 2, + /** + * + * @brief cuda 数据类型 + */ + + ByteRTCVideoBufferTypeCuda = 3, + /** + * + * @brief direct3d11 纹理 + */ + + ByteRTCVideoBufferTypeD3D11 = 4, + /** + * + * @brief vaapi 数据格式 + */ + + ByteRTCVideoBufferTypeVAAPI = 5, + /** + * + * @hidden(Windows) + * @brief nvidia jetson dma 数据格式 + */ + + ByteRTCVideoBufferTypeNvidiaJetsonDma =6, +}; +/** + * + * @type keytype + * @brief 视频内容类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoContentType) { + /** + * + * @brief 普通视频 + */ + + ByteRTCVideoContentTypeNormalFrame = 0, + /** + * + * @brief 黑帧视频 + */ + + ByteRTCVideoContentTypeBlackFrame = 1, +}; + +/** + * + * @type keytype + * @brief 视频帧缩放模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoStreamScaleMode) { + /** + * + * @brief 自动缩放模式,默认设置为 ByteRTCVideoStreamScaleModeFitWithCropping。 + */ + + ByteRTCVideoStreamScaleModeAuto = 0, + /** + * + * @brief 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。 + */ + + ByteRTCVideoStreamScaleModeStretch = 1, + /** + * + * @brief 视窗填满优先。
    + * 视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。 + */ + + ByteRTCVideoStreamScaleModeFitWithCropping = 2, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。
    + * 缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。保持纵横比来缩放图像,填充短边 + */ + + ByteRTCVideoStreamScaleModeFitWithFilling = 3, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 视频编码模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoCodecMode) { + /** + * + * @brief 自动选择 + */ + + ByteRTCVideoCodecModeAuto = 0, + /** + * + * @brief 硬编码 + */ + + ByteRTCVideoCodecModeHardware = 1, + /** + * + * @brief 软编码 + */ + + ByteRTCVideoCodecModeSoftware = 2 +}; + +/** + * + * @type keytype + * @brief 编码帧类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoPictureType) { + /** + * + * @brief 未知类型 + */ + + ByteRTCVideoPictureTypeUnknown = 0, + /** + * + * @brief I 帧,关键帧,编解码不需要参考其他视频帧 + */ + + ByteRTCVideoPictureTypeI = 1, + /** + * + * @brief P 帧,向前参考帧,编解码需要参考前一帧视频帧 + */ + + ByteRTCVideoPictureTypeP = 2, + /** + * + * @brief B 帧,前后参考帧,编解码需要参考前后两帧视频帧 + */ + + ByteRTCVideoPictureTypeB = 3, +}; + +/** + * + * @type keytype + * @brief 编码策略偏好。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoEncoderPreference) { + /** + * + * @brief 无偏好。不降低帧率和分辨率。 + */ + + ByteRTCVideoEncoderPreferenceDisabled = 0, + /** + * + * @brief 优先保障帧率。适用于动态画面。 + */ + + ByteRTCVideoEncoderPreferenceMaintainFramerate = 1, + /** + * + * @brief 清晰模式,优先保障分辨率。适用于静态画面。 + */ + + ByteRTCVideoEncoderPreferenceMaintainQuality = 2, + /** + * + * @brief 平衡帧率与分辨率。 + * 对于屏幕流来说是无偏好。不降低帧率和分辨率。 + */ + + ByteRTCVideoEncoderPreferenceAuto = 3, +}; + + +/** + * + * @hidden + * @deprecated since 3.32 and will be deleted in 3.51, use ByteRTCVirtualBackgroundSourceType{@link #ByteRTCVirtualBackgroundSourceType} instead. + * @type keytype + * @brief 背景模式设置。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCBackgroundMode) { + /** + * + * @brief 无 + */ + + ByteRTCBackgroundModeNone = 0, + /** + * + * @brief 虚化 + */ + + ByteRTCBackgroundModeBlur = 1, + /** + * + * @brief 背景 1 + */ + + ByteRTCBackgroundModeA = 2, + /** + * + * @brief 背景 2 + */ + + ByteRTCBackgroundModeB = 3, +}; + +/** + * + * @hidden + * @deprecated since 3.32 and will be deleted in 3.51. + * @type keytype + * @brief 分割模型设置。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCDivideModel) { + /** + * + * @brief 自研 + */ + + ByteRTCDivideModelDefault = 0, + /** + * + * @brief effect 分割模型 + */ + + ByteRTCDivideModelEffect = 1, +}; + +/** + * + * @type keytype + * @brief 数据类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCDataFrameType) { + /** + * + * @brief SEI 数据 + */ + + ByteRTCDataFrameTypeSei = 0, + /** + * + * @brief 人脸识别数据 + */ + + ByteRTCDataFrameTypeRoi = 1, + /** + * + * @brief 其他数据帧类型 + */ + + ByteRTCDataFrameTypeOther = 2, +}; + +/** + * + * @type keytype + * @brief 视频采集模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoCapturePreference) { + /** + * + * @brief (默认)自动设置采集参数。
    + * SDK 在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。 + */ + + ByteRTCVideoCapturePreferenceAuto = 0, + /** + * + * @brief 手动设置采集参数,包括采集分辨率、帧率。 + */ + + ByteRTCVideoCapturePreferenceMannal = 1, + /** + * + * @brief 采集参数与编码参数一致 + */ + + ByteRTCVideoCapturePreferenceAutoPerformance = 2, +}; + +/** + * + * @type keytype + * @brief 视频帧类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoFrameType) { + /** + * + * @brief 视频帧类型:内存数据 + */ + + ByteRTCVideoFrameTypeRawMemory = 0, + /** + * + * @brief 视频帧类型:CVPixelBuffer + */ + + ByteRTCVideoFrameTypePixelBuffer, +}; + + +/** + * + * @type keytype + * @brief 本地视频帧回调位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCLocalVideoSinkPosition) { + /** + * + * @brief 采集后。 + */ + + ByteRTCLocalVideoSinkPositionAfterCapture = 0, + /** + * + * @brief (默认值)前处理后。 + */ + + ByteRTCLocalVideoSinkPositionAfterPreprocess = 1 +}; + +/** + * + * @type keytype + * @brief 远端视频帧回调位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRemoteVideoSinkPosition) { + /** + * + * @hidden not available + * @brief 解码后。 + */ + + ByteRTCRemoteVideoSinkPositionAfterDecoder = 0, + /** + * + * @brief (默认值)后处理后。 + */ + + ByteRTCRemoteVideoSinkPositionAfterPostprocess = 1 +}; + +/** + * + * @type keytype + * @brief 视频帧编码格式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSinkPixelFormat) { + /** + * + * @brief 原始视频帧格式 + */ + + ByteRTCVideoSinkPixelFormatOriginal = 0, + /** + * + * @brief YUV I420 格式 + */ + + ByteRTCVideoSinkPixelFormatI420 = 1, + /** + * + * @brief YUV NV12 格式 + */ + + ByteRTCVideoSinkPixelFormatNV12 = 2, + /** + * + * @brief RGBA 格式, 字节序为 R8 G8 B8 A8 + */ + + ByteRTCVideoSinkPixelFormatRGBA = 5, + /** + * + * @brief BGRA 格式 + */ + + ByteRTCVideoSinkPixelFormatBGRA = 7 +}; + +/** + * + * @type keytype + * @brief 是否将视频帧自动转正。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoApplyRotation) { + /** + * + * @brief (默认值)不旋转。 + */ + + ByteRTCVideoApplyRotationDefault = -1, + /** + * + * @brief 自动转正视频,即根据视频帧的旋转角信息将视频帧旋转到 0 度。 + */ + + ByteRTCVideoApplyRotation0 = 0 +}; + +/** + * + * @type keytype + * @brief 是否将视频帧镜像。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSinkMirrorType) { + /** + * + * @brief 开启镜像。 + */ + + ByteRTCVideoSinkMirrorTypeOn = 1, + /** + * + * @brief (默认值)不开启镜像。 + */ + + ByteRTCVideoSinkMirrorTypeOff = 2, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 超分状态改变原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSuperResolutionModeChangedReason) { + /** + * + * @brief 调用 setRemoteVideoSuperResolution:withMode:{@link #ByteRTCEngine#setRemoteVideoSuperResolution:withMode:} 成功关闭超分。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonAPIOff = 0, + /** + * + * @brief 调用 setRemoteVideoSuperResolution:withMode:{@link #ByteRTCEngine#setRemoteVideoSuperResolution:withMode:} 成功开启超分。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonAPIOn = 1, + /** + * + * @brief 开启超分失败,远端视频流的原始视频分辨率超过 640 × 360 px。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonResolutionExceed = 2, + /** + * + * @brief 开启超分失败,已对一路远端流开启超分。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonOverUse = 3, + /** + * + * @brief 设备不支持使用超分辨率。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonDeviceNotSupport = 4, + /** + * + * @brief 当前设备性能存在风险,已动态关闭 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonDynamicClose = 5, + /** + * + * @brief 超分因其他原因关闭。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonOtherSettingDisabled = 6, + /** + * + * @brief 超分因其他原因开启。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonOtherSettingEnabled = 7, + /** + * + * @brief SDK 没有编译超分组件。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonNoComponent = 8, + /** + * + * @brief 远端流不存在。房间 ID 或用户 ID 无效,或对方没有发布流。 + */ + + ByteRTCVideoSuperResolutionModeChangedReasonStreamNotExist = 9, +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 视频降噪模式状态改变原因。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDenoiseModeChangedReason) { + /** + * + * @brief 未知原因导致视频降噪状态改变。 + */ + + ByteRTCVideoDenoiseModeChangedReasonNull = -1, + /** + * + * @brief 通过调用 setVideoDenoiser:{@link #ByteRTCEngine#setVideoDenoiser:} 成功关闭视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonApiOff = 0, + /** + * + * @brief 通过调用 setVideoDenoiser:{@link #ByteRTCEngine#setVideoDenoiser:} 成功开启视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonApiOn = 1, + /** + * + * @brief 后台未配置视频降噪,视频降噪开启失败,请联系技术人员解决。 + */ + + ByteRTCVideoDenoiseModeChangedReasonConfigDisabled = 2, + /** + * + * @brief 后台配置开启了视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonConfigEnabled = 3, + /** + * + * @brief 由于内部发生了异常,视频降噪关闭。 + */ + + ByteRTCVideoDenoiseModeChangedReasonInternalException = 4, + /** + * + * @brief 当前设备性能过载,已动态关闭视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonDynamicClose = 5, + /** + * + * @brief 当前设备性能裕量充足,已动态开启视频降噪。 + */ + + ByteRTCVideoDenoiseModeChangedReasonDynamicOpen = 6, + /** + * + * @brief 分辨率导致视频降噪状态发生改变。分辨率过高会导致性能消耗过大,从而导致视频降噪关闭。如若希望继续使用视频降噪,可选择降低分辨率。 + */ + + ByteRTCVideoDenoiseModeChangedReasonResolution = 7, +}; +#pragma mark CDN/WTN ENUM +/** + * + * @type keytype + * @brief 转推任务事件 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamTaskEvent) { + /** + * + * @hidden for internal use only + */ + + ByteRTCMixedStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + ByteRTCMixedStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + ByteRTCMixedStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务更新成功。 + */ + + ByteRTCMixedStreamTaskEventUpdateSuccess = 3, + /** + * + * @brief 任务更新失败。 + */ + + ByteRTCMixedStreamTaskEventUpdateFailed = 4, + /** + * + * @brief 任务停止。 + */ + + ByteRTCMixedStreamTaskEventStopSuccess = 5, + /** + * + * @brief 结束任务失败。 + */ + + ByteRTCMixedStreamTaskEventStopFailed = 6, + /** + * + * @brief Warning 事件 + */ + + ByteRTCMixedStreamTaskEventWarning = 7, +}; +/** + * + * @hidden for internal use only + * @type keytype + * @brief 合流方式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamType) { + /** + * + * @brief 通过服务端合流 + */ + + ByteRTCMixedStreamByServer = 0, + /** + * + * @brief 端云一体合流。SDK 智能决策在客户端或服务端完成合流。
    + * 使用前,请联系技术支持同学开通,否则不生效。 + */ + + ByteRTCMixedStreamByClient = 1, +}; +/** + * + * @type keytype + * @brief 任务类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamPushTargetType) { + /** + * + * @brief 推到 CDN + */ + + ByteRTCMixedStreamPushTargetTypeToCDN = 0, + /** + * + * @brief WTN 流 + */ + + ByteRTCMixedStreamPushTargetTypeToWTN = 1, +}; +/** + * + * @type keytype + * @brief WTN 流的补帧模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCInterpolationMode) { + /** + * + * @type keytype + * @brief 补最后一帧 + */ + + ByteRTCInterpolationModeLastFrameFill = 0, + /** + * + * @type keytype + * @brief 补背景图片 + */ + + ByteRTCInterpolationModeBackgroundImageFill = 1, +}; +/** + * + * @type keytype + * @brief WTN 流的布局模式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCStreamLayoutMode) { + /** + * + * @brief 自动布局 + */ + + ByteRTCStreamLayoutModeAuto = 0, + /** + * + * @brief 自定义 + */ + + ByteRTCStreamLayoutModeCustom = 2, +}; +/** + * + * @hidden for internal use only + * @type keytype + * @brief 客户端合流回调视频格式。
    + * 设置为系统不支持的格式时,自动回调系统默认格式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamClientMixVideoFormat) { + /** + * + * @brief YUV I420。Android、Windows 默认回调格式。支持系统:Android、Windows。 + */ + + ByteRTCMixedStreamClientMixVideoFormatI420 = 0, + /** + * + * @brief OpenGL GL_TEXTURE_2D 格式纹理。支持系统:安卓。 + */ + + ByteRTCMixedStreamClientMixVideoFormatTexture2D = 1, + /** + * + * @brief CVPixelBuffer BGRA。iOS 默认回调格式。支持系统: iOS。 + */ + + ByteRTCMixedStreamClientMixVideoFormatCVPixelBufferBGRA = 2, + /** + * + * @brief YUV NV12。macOS 默认回调格式。支持系统: macOS。 + */ + + ByteRTCMixedStreamClientMixVideoFormatNV12 = 3, +}; + +/** + * + * @type keytype + * @brief 视频编码格式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamVideoCodecType) { + /** + * + * @brief H.264 格式,默认值。 + */ + + ByteRTCMixedStreamVideoCodecTypeH264 = 0, + /** + * + * @brief ByteVC1 格式。 + */ + + ByteRTCMixedStreamVideoCodecTypeByteVC1 = 1, +}; +/** + * + * @type keytype + * @brief 合流输出媒体类型。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamMediaType) { + /** + * + * @brief 包含音频和视频 + */ + + ByteRTCMixedStreamMediaTypeAudioAndVideo = 0, + /** + * + * @brief 只包含音频 + */ + + ByteRTCMixedStreamMediaTypeAudioOnly = 1, + /** + * + * @hidden currently not available + * @brief 只包含视频 + */ + + ByteRTCMixedStreamMediaTypeVideoOnly = 2, +}; +/** + * + * @type keytype + * @brief 图片或视频流的缩放模式。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamRenderMode) { + /** + * + * @brief 视窗填满优先,默认值。
    + * 视频尺寸等比缩放,直至视窗被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。 + */ + + ByteRTCMixedStreamRenderModeHidden = 1, + /** + * + * @brief 视频帧内容全部显示优先。
    + * 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 + */ + + ByteRTCMixedStreamRenderModeFit = 2, + /** + * + * @brief 视频帧自适应画布。
    + * 视频尺寸非等比例缩放,把窗口充满。在此过程中,视频帧的长宽比例可能会发生变化。 + */ + + ByteRTCMixedStreamRenderModeAdaptive = 3, +}; +/** + * + * @type keytype + * @brief 合流布局区域类型,视频区或水印图片区。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamLayoutRegionType) { + + /** + * + * @brief 视频。 + */ + + ByteRTCMixedStreamLayoutRegionTypeVideoStream = 0, + + /** + * + * @brief 水印图片。 + */ + + ByteRTCMixedStreamLayoutRegionTypeImage = 1, +}; + +/** + * + * @hidden internal use only + * @type keytype + * @brief 合流同步策略 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamSyncStrategy) { + /** + * + * @brief 不使用同步策略 + */ + + ByteRTCMixedStreamSyncStrategyNoSync = 0, + /** + * + * @brief 使用音频精准同步策略 + */ + + ByteRTCMixedStreamSyncStrategyAudioPreciseSync = 1, + /** + * + * @brief 使用单通模式同步策略 + */ + + ByteRTCMixedStreamSyncStrategySimplexModeSync = 2, +}; + +/** + * + * @type keytype + * @brief 预留字段。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMixedStreamVideoType) { + /** + * + * @hidden for internal use only + * @brief 主流。包括:
    + * - 由摄像头/麦克风通过内部采集机制,采集到的流 + * - 通过自定义采集,采集到的流。 + */ + + ByteRTCMixedStreamVideoTypeMain = 0, + + /** + * + * @hidden for internal use only + * @brief 屏幕流。 + */ + + ByteRTCMixedStreamVideoTypeScreen = 1, +}; + +/** + * + * @type keytype + * @brief 服务端合流转推 SEI 内容。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamSEIContentMode) { + /** + * + * @brief 视频流中包含全部的 SEI 信息。默认设置。 + */ + + ByteRTCMixedStreamSEIContentModeDefault = 0, + /** + * + * @brief 随非关键帧传输的 SEI 数据中仅包含音量信息。
    + * 当设置 `ByteRTCMixedStreamControlConfig.enableVolumeIndication` 为 True 时,此参数设置生效。 + */ + + ByteRTCMixedStreamSEIContentModeEnableVolumeIndication = 1, +}; + +/** + * + * @type keytype + * @brief 服务端合流转推发起模式。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamPushMode) { + /** + * + * @brief 无用户发布媒体流时,发起合流任务无效。默认设置。 + * 当有用户发布媒体流时,才能发起合流任务。 + */ + + ByteRTCMixedStreamPushModeOnStream = 0, + /** + * + * @brief 无用户发布媒体流时,可以使用占位图发起合流任务。
    + * 占位图设置参看 alternateImageUrl{@link #ByteRTCMixedStreamLayoutRegionConfig#alternateImageUrl} 和 alternateImageFillMode{@link #ByteRTCMixedStreamLayoutRegionConfig#alternateImageFillMode} + */ + + ByteRTCMixedStreamPushModeOnStartRequest = 1, +}; +/** + * + * @type keytype + * @brief 服务端合流占位图填充模式。
    + * 该参数用来控制当用户停止发布视频流,画面恢复为占位图后,此时占位图的填充模式。默认值为 `ByteRTCMixedStreamAlternateImageFillModeFit`,占位图跟随用户原始视频帧相同的比例缩放。
    + * 参看 ByteRTCMixedStreamAlternateImageFillMode{@link #ByteRTCMixedStreamAlternateImageFillMode}。
    + * WTN 流任务不支持设置本参数。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamAlternateImageFillMode) { + /** + * + * @brief 占位图跟随用户原始视频帧相同的比例缩放。默认设置。 + */ + + ByteRTCMixedStreamAlternateImageFillModeFit = 0, + /** + * + * @brief 占位图不跟随用户原始视频帧相同的比例缩放,保持图片原有比例。 + */ + + ByteRTCMixedStreamAlternateImageFillModeFill = 1, +}; +/** + * + * @type errorcode + * @brief 单流转推直播事件 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSingleStreamTaskEvent) { + /** + * + * @hidden for internal use only + */ + + ByteRTCSingleStreamTaskEventBase = 0, + /** + * + * @brief 任务发起成功。 + */ + + ByteRTCSingleStreamTaskEventStartSuccess = 1, + /** + * + * @brief 任务发起失败。 + */ + + ByteRTCSingleStreamTaskEventStartFailed = 2, + /** + * + * @brief 任务停止。 + */ + + ByteRTCSingleStreamTaskEventStopSuccess = 3, + /** + * + * @brief 结束任务失败。 + */ + + ByteRTCSingleStreamTaskEventStopFailed= 4, + /** + * + * @brief Warning 事件 + */ + + ByteRTCSingleStreamTaskEventWarning = 5, +}; + +/** + * + * @type errorcode + * @brief 单流转推直播错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSingleStreamTaskErrorCode) { + /** + * + * @brief 推流成功。 + */ + + ByteRTCSingleStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + ByteRTCSingleStreamTaskErrorCodeBase = 1090, + /** + * + * @brief 服务端合流错误 + */ + + ByteRTCSingleStreamTaskErrorCodeUnknownByServer = 1091, + /** + * + * @brief 任务处理超时,请检查网络状态并重试。 + */ + + ByteRTCSingleStreamTaskErrorCodeSignalRequestTimeout = 1092, + /** + * + * @brief 服务端检测任务参数不合法 + */ + + ByteRTCSingleStreamTaskErrorCodeInvalidParamByServer = 1093, + /** + * + * @brief 转推任务在目标房间的用户ID被踢出目标房间 + */ + + ByteRTCSingleStreamTaskErrorCodeRemoteKicked = 1094, + /** + * + * @brief 转推任务加入目标房间失败 + */ + + ByteRTCSingleStreamTaskErrorCodeJoinDestRoomFailed = 1095, + /** + * + * @brief 转推任务在源房间拉流超时 + */ + + ByteRTCSingleStreamTaskErrorCodeReceiveSrcStreamTimeout = 1096, + /** + * + * @brief 音视频编码转推任务不支持 + */ + + ByteRTCSingleStreamTaskErrorCodeNotSurportCodec = 1097, + /** + * + * @brief 转推到CDN失败 + */ + + ByteRTCSingleStreamTaskErrorCodePushToCDN = 1098, + /** + * + * @brief 超过单流转推的任务数限制(单主播可同时转推任务数不超过20) + */ + + ByteRTCSingleStreamTaskErrorCodeTaskCountOverLimit = 1099, +}; +/** + * + * @type keytype + * @brief 订阅媒体的类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCSubscribeMediaType) { + /** + * + * @brief 既不订阅音频,也不订阅视频 + */ + + ByteRTCSubscribeMediaTypeNone = 0, + /** + * + * @brief 只订阅音频,不订阅视频 + */ + + ByteRTCSubscribeMediaTypeAudioOnly = 1, + /** + * + * @brief 只订阅视频,不订阅音频 + */ + + ByteRTCSubscribeMediaTypeVideoOnly = 2, + /** + * + * @brief 同时订阅音频和视频 + */ + + ByteRTCSubscribeMediaTypeAudioAndVideo = 3, +}; + +/** + * + * @type keytype + * @brief 暂停/恢复接收远端的媒体流类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCPauseResumControlMediaType) { + /** + * + * @brief 只控制音频,不影响视频 + */ + + ByteRTCControlMediaTypeAudio = 0, + /** + * + * @brief 只控制视频,不影响音频 + */ + + ByteRtcControlMediaTypeVideo = 1, + /** + * + * @brief 同时控制音频和视频 + */ + + ByteRtcControlMediaTypeAudioAndVideo = 2, +}; + +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51. + * @type keytype + * @brief 视频输入类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMediaInputType) { + /** + * + * @brief 自定义采集。
    + * 设置完成后方可直接向 SDK 推送视频帧。 + */ + + ByteRTCMediaInputTypeExternal = 0, + /** + * + * @brief 内部 SDK 采集。
    + * 此设置仅切换至内部采集,你需继续调用 startVideoCapture{@link #ByteRTCEngine#startVideoCapture} 开启内部采集。 + */ + + ByteRTCMediaInputTypeInternal = 1 +}; + +/** + * + * @type keytype + * @brief 视频输入源类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoSourceType) { + /** + * + * @brief 自定义采集视频源 + */ + + ByteRTCVideoSourceTypeExternal = 0, + /** + * + * @brief 内部采集视频源 + */ + + ByteRTCVideoSourceTypeInternal = 1, + /** + * + * @brief 自定义编码视频源。
    + * 你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流 + */ + + ByteRTCVideoSourceTypeEncodedAutoSimulcast = 2, + /** + * + * @brief 自定义编码视频源。
    + * SDK 不会自动生成多路流,你需要自行生成并推送多路流 + */ + + ByteRTCVideoSourceTypeEncodedManualSimulcast = 3 +}; + +/** + * + * @type keytype + * @brief Alpha 通道相对于 RGB 通道数据的排列位置。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCAlphaLayout) { + /** + * + * @brief Alpha 数据置于 RGB 数据上方。 + */ + + ByteRTCAlphaLayoutTop = 0, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据下方。 + */ + + ByteRTCAlphaLayoutBottom = 1, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据左方。 + */ + + ByteRTCAlphaLayoutLeft = 2, + /** + * + * @hidden currently not available + * @brief Alpha 数据置于 RGB 数据右方。 + */ + + ByteRTCAlphaLayoutRight = 3, +}; + +/** + * + * @type keytype + * @brief 数码变焦参数类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCZoomConfigType) { + /** + * + * @brief 设置缩放系数 + */ + + ByteRTCZoomConfigTypeFocusOffset = 0, + /** + * + * @brief 设置移动步长 + */ + + ByteRTCZoomConfigTypeMoveOffset = 1 +}; + +/** + * + * @type keytype + * @brief 数字变焦操作类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCZoomDirectionType) { + /** + * + * @brief 相机向左移动 + */ + + ByteRTCZoomDirectionTypeMoveLeft = 0, + /** + * + * @brief 相机向右移动 + */ + + ByteRTCZoomDirectionTypeMoveRight = 1, + /** + * + * @brief 相机向上移动 + */ + + ByteRTCZoomDirectionTypeMoveUp = 2, + /** + * + * @brief 相机向下移动 + */ + + ByteRTCZoomDirectionTypeMoveDown = 3, + /** + * + * @brief 相机缩小焦距 + */ + + ByteRTCZoomDirectionTypeZoomOut = 4, + /** + * + * @brief 相机放大焦距 + */ + + ByteRTCZoomDirectionTypeZoomIn = 5, + /** + * + * @brief 恢复到原始画面 + */ + + ByteRTCZoomDirectionTypeReset = 6 +}; + +/** + * + * @type keytype + * @brief 视频解码方式 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDecoderConfig) { + /** + * + * @brief 开启 SDK 内部解码,只回调解码后的数据。回调为 renderPixelBuffer:rotation:contentType:extendedData:{@link #ByteRTCVideoSinkDelegate#renderPixelBuffer:rotation:contentType:extendedData:} + */ + + ByteRTCVideoDecoderConfigRaw = 0, + /** + * + * @brief 开启自定义解码,只回调解码前数据。回调为 onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:{@link #ByteRTCRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame:info:withEncodedVideoFrame:}。 + */ + + ByteRTCVideoDecoderConfigEncode = 1, + /** + * + * @brief 开启 SDK 内部解码,同时回调解码前和解码后的数据 + */ + + ByteRTCVideoDecoderConfigBoth = 2 +}; + +/** + * + * @type keytype + * @brief 虚拟背景类型。 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVirtualBackgroundSourceType){ + /** + * + * @brief 使用纯色背景替换视频原有背景。 + */ + + ByteRTCVirtualBackgroundSourceTypeColor = 0, + /** + * + * @brief 使用自定义图片替换视频原有背景。 + */ + + ByteRTCVirtualBackgroundSourceTypeImage = 1 +}; + +/** + * + * @type keytype + * @brief 摄像头类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCCameraID) { + /** + * + * @brief 前置摄像头 + */ + + ByteRTCCameraIDFront = 0, + /** + * + * @brief 后置摄像头 + */ + + ByteRTCCameraIDBack = 1, + /** + * + * @hidden currently not available + * @brief 外接摄像头 + */ + + ByteRTCCameraIDExternal = 2, + /** + * + * @brief 无效值 + */ + + ByteRTCCameraIDInvalid = 3, +}; + +/** + * + * @type errorcode + * @brief 合流和 WTN 流任务错误码 + */ + +typedef NS_ENUM(NSInteger, ByteRTCMixedStreamTaskErrorCode) { + /** + * + * @brief 推流成功。 + */ + + ByteRTCMixedStreamTaskErrorCodeOK = 0, + /** + * + * @hidden currently not available + * @brief 预留错误码,未启用 + */ + + ByteRTCMixedStreamTaskErrorCodeBase = 1090, + /** + * + * @brief 任务处理超时,请检查网络状态并重试 + */ + + ByteRTCMixedStreamTaskErrorCodeTimeOut = 1091, + /** + * + * @brief 服务端检测到错误的推流参数 + */ + + ByteRTCMixedStreamTaskErrorCodeInvalidParamByServer = 1092, + /** + * + * @brief 对流的订阅超时 + */ + + ByteRTCMixedStreamTaskErrorCodeSubTimeoutByServer = 1093, + /** + * + * @brief 合流服务端内部错误。 + */ + + ByteRTCMixedStreamTaskErrorCodeInvalidStateByServer = 1094, + /** + * + * @brief 合流服务端推 CDN 失败。 + */ + + ByteRTCMixedStreamTaskErrorCodeAuthenticationByCDN = 1095, + /** + * + * @brief 服务端未知错误。 + */ + + ByteRTCMixedStreamTaskErrorCodeUnKnownErrorByServer = 1096, + /** + * + * @brief 服务端接收信令超时,请检查网络状态并重试。 + */ + + ByteRTCMixedStreamTaskErrorCodeSignalRequestTimeout = 1097, + /** + * + * @brief 图片合流失败。 + */ + + ByteRTCMixedStreamTaskErrorCodeMixImageFailed = 1098, + /** + * + * @hidden currently not available + * @brief 缓存未同步。 + */ + + ByteRTCMixedStreamTaskErrorCodeStreamSyncWorse = 1099, + /** + * + * @brief 发布 WTN 流失败 + */ + + ByteRTCMixedStreamTaskErrorCodePushWTNFailed = 1195, + /** + * + * @hidden for internal use only + */ + + ByteRTCMixedStreamTaskErrorCodeMax = 1199, +}; +/** + * + * @type keytype + * @brief 本地录制的媒体类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCRecordingType) { + /** + * + * @brief 只录制音频 + */ + + ByteRTCRecordingTypeAudioOnly = 0, + /** + * + * @brief 只录制视频 + */ + + ByteRTCRecordingTypeVideoOnly = 1, + /** + * + * @brief 同时录制音频和视频 + */ + + ByteRTCRecordingTypeVideoAndAudio = 2, +}; + +/** + * + * @type keytype + * @brief 屏幕采集媒体类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCScreenMediaType) { + /** + * + * @brief 只采集视频数据 + */ + + ByteRTCScreenMediaTypeVideoOnly = 0, + /** + * + * @brief 只采集音频数据 + */ + + ByteRTCScreenMediaTypeAudioOnly = 1, + /** + * + * @brief 音视频数据都采集 + */ + + ByteRTCScreenMediaTypeVideoAndAudio = 2 +}; + +/** + * + * @type keytype + * @brief 屏幕采集对象的类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCScreenCaptureSourceType) { + /** + * + * @brief 类型未知 + */ + + ByteRTCScreenCaptureSourceTypeUnknown = 0, + /** + * + * @brief 应用程序的窗口 + */ + + ByteRTCScreenCaptureSourceTypeWindow = 1, + /** + * + * @brief 桌面 + */ + + ByteRTCScreenCaptureSourceTypeScreen = 2 +}; +/** + * + * @type keytype + * @region 屏幕共享 + * @brief 内部采集屏幕视频流时,是否采集鼠标信息。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCMouseCursorCaptureState) { + /** + * + * @brief 采集鼠标信息。 + */ + + ByteRTCMouseCursorCaptureStateOn, + /** + * + * @brief 不采集鼠标信息。 + */ + + ByteRTCMouseCursorCaptureStateOff, +}; +/** + * + * @type keytype + * @brief 屏幕共享时的边框高亮设置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCHighlightConfig: NSObject +/** + * + * @brief 是否显示高亮边框,默认显示。 + */ + +@property (assign, nonatomic) BOOL enableHighlight; +/** + * + * @brief 边框的颜色, 颜色格式为十六进制 ARGB: 0xAARRGGB。 + */ + +@property (assign, nonatomic) uint32_t borderColor; +/** + * + * @brief 边框的宽度,单位:像素。 + */ + +@property (assign, nonatomic) int borderWidth; +@end + +/** + * + * @type keytype + * @brief 相机补光灯状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCTorchState) { + /** + * + * @brief 相机补光灯关闭 + */ + + ByteRTCTorchStateOff = 0, + /** + * + * @brief 相机补光灯打开 + */ + + ByteRTCTorchStateOn = 1, +}; + +/** + * + * @type keytype + * @brief 当前视频设备类型 + */ + +typedef NS_ENUM(NSInteger, ByteRTCVideoDeviceType) { + /** + * + * @brief 未知视频设备 + */ + + ByteRTCVideoDeviceTypeUnknown = -1, + /** + * + * @brief 视频渲染设备类型 + */ + + ByteRTCVideoDeviceTypeRenderDevice = 0, + /** + * + * @brief 视频采集设备类型 + */ + + ByteRTCVideoDeviceTypeCaptureDevice = 1, + /** + * + * @brief 屏幕流视频设备 + */ + + ByteRTCVideoDeviceTypeScreenCaptureDevice = 2 +}; + +/** + * + * @type keytype + * @brief 媒体流类型 + */ + +typedef NS_OPTIONS(NSUInteger, ByteRTCMediaStreamType) { + /** + * + * @brief 只控制音频 + */ + + ByteRTCMediaStreamTypeAudio = (1 << 0), + /** + * + * @brief 只控制视频 + */ + + ByteRTCMediaStreamTypeVideo = (1 << 1), + /** + * + * @brief 同时控制音频和视频 + */ + + ByteRTCMediaStreamTypeBoth = ByteRTCMediaStreamTypeAudio | ByteRTCMediaStreamTypeVideo, +}; + +/** + * + * @type keytype + * @brief 占发布端原始帧率的比例 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCFrameRateRatio) { + /** + * + * @brief 100% + */ + + ByteRTCFrameRateRatioOrigin = 0, + /** + * + * @brief 50% + */ + + ByteRTCFrameRateRatioHalf = 1, + /** + * + * @brief 25% + */ + + ByteRTCFrameRateRatioQuater = 2, +}; + +/** + * + * @type keytype + * @brief 视频旋转模式 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCVideoRotationMode) { + /** + * + * @brief App 方向 + */ + + ByteRTCVideoRotationModeFollowApp = 0, + /** + * + * @brief 重力方向 + */ + + ByteRTCVideoRotationModeFollowGSensor = 1, +}; + +/** + * + * @type keytype + * @brief 弱光适应类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCVideoEnhancementMode) { + /** + * + * @brief 关闭弱光适应 + */ + + ByteRTCVideoEnhancementModeDisabled = 0, + + /** + * + * @brief 开启弱光适应 + */ + + ByteRTCVideoEnhancementModeAuto = 1, +}; + +/** + * + * @type keytype + * @brief 人像属性检测参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCExpressionDetectConfig : NSObject +/** + * + * @brief 是否开启年龄检测。 + */ + +@property (assign, nonatomic) BOOL enableAgeDetect; +/** + * + * @brief 是否开启性别检测。 + */ + +@property (assign, nonatomic) BOOL enableGenderDetect; +/** + * + * @brief 是否开启表情检测。 + */ + +@property (assign, nonatomic) BOOL enableEmotionDetect; +/** + * + * @brief 是否开启吸引力检测。 + */ + +@property (assign, nonatomic) BOOL enableAttractivenessDetect; +/** + * + * @brief 是否开启开心程度检测。 + */ + +@property (assign, nonatomic) BOOL enableHappinessDetect; +@end + +/** + * + * @type keytype + * @brief 人像属性检测信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCExpressionDetectInfo : NSObject +/** +* +* @brief 预测年龄,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float age; +/** +* +* @brief 预测为男性的概率,取值范围 (0.0, 1.0)。 +*/ + +@property (assign, nonatomic) float boyProb; +/** +* +* @brief 预测的吸引力分数,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float attractive; +/** +* +* @brief 预测的微笑程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float happyScore; +/** +* +* @brief 预测的伤心程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float sadScore; +/** +* +* @brief 预测的生气程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float angryScore; +/** +* +* @brief 预测的吃惊程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float surpriseScore; +/** +* +* @brief 预测的情绪激动程度,取值范围 (0, 100)。 +*/ + +@property (assign, nonatomic) float arousal; +/** +* +* @brief 预测的情绪正负程度,取值范围 (-100, 100)。 +*/ + +@property (assign, nonatomic) float valence; +@end + +/** + * + * @type keytype + * @brief 人像属性检测结果 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCExpressionDetectResult : NSObject +/** + * + * @brief 特征识别结果
    + * - 0:识别成功 + * - !0:识别失败 + */ + +@property (assign, nonatomic) int detectResult; +/** + * + * @brief 识别到的人脸数量。 + */ + +@property (assign, nonatomic) int faceCount; + +/** + * + * @brief 特征识别信息。数组的长度和检测到的人脸数量一致。参看 ByteRTCExpressionDetectInfo{@link #ByteRTCExpressionDetectInfo}。 + */ + +@property (nonatomic, copy) NSArray * _Nonnull detectInfo; + +@end + +/** + * + * @type keytype + * @brief 矩形区域,用于指定屏幕区域。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRectangle : NSObject +/** + * + * @brief 矩形区域左上角的 x 坐标。 + */ + +@property(assign, nonatomic) int x; +/** + * + * @brief 矩形区域左上角的 y 坐标。 + */ + +@property(assign, nonatomic) int y; +/** + * + * @brief 矩形宽度,单位:px。 + */ + +@property(assign, nonatomic) int width; +/** + * + * @brief 矩形高度,单位:px。 + */ + +@property(assign, nonatomic) int height; +@end +/** + * + * @type keytype + * @brief 人脸检测结果 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCFaceDetectionResult : NSObject +/** + * + * @brief 人脸检测结果
    + * - 0:检测成功 + * - !0:检测失败。详见[错误码](https: + */ + +@property(assign, nonatomic) int detectResult; +/** + * + * @brief 原始图片宽度(px) + */ + +@property(assign, nonatomic) int imageWidth; +/** + * + * @brief 原始图片高度(px) + */ + +@property(assign, nonatomic) int imageHeight; +/** + * + * @brief 识别到人脸的矩形框。数组的长度和检测到的人脸数量一致。参看 ByteRTCRectangle{@link #ByteRTCRectangle}。 + */ + +@property(nonatomic, copy) NSArray * _Nullable faces; +/** + * + * @brief 进行人脸识别的视频帧的时间戳。 + */ + +@property(assign, nonatomic) CMTime frameTimestamp; + +@end +/** + * + * @type keytype + * @brief 视频帧渲染设置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoCanvas : NSObject +/** + * + * @brief 本地视图句柄 + */ + +@property(strong, nonatomic) ByteRTCView* _Nullable view; +/** + * + * @brief 渲染模式,参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + */ + +@property(assign, nonatomic) ByteRTCRenderMode renderMode; +/** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`,格式为 BGR。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + +@property(assign, nonatomic) NSInteger backgroundColor; +/** + * + * @brief 视频帧旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。默认为 0 度,即不做旋转处理。
    + * 该设置仅对远端视频有效,对本地视频设置不生效。 + */ + +@property(assign, nonatomic) ByteRTCVideoRotation renderRotation; +@end + +/** + * + * @type keytype + * @brief 远端视频帧渲染设置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoRenderConfig : NSObject +/** + * + * @brief 渲染模式,参看 ByteRTCRenderMode{@link #ByteRTCRenderMode} + */ + +@property(assign, nonatomic) ByteRTCRenderMode renderMode; +/** + * + * @brief 用于填充画布空白部分的背景颜色。取值范围是 `[0x00000000, 0xFFFFFFFF]`,格式为 BGR。默认值是 `0x00000000`。其中,透明度设置无效。 + */ + +@property(assign, nonatomic) NSInteger backgroundColor; +/** + * + * @brief 视频帧旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。默认为 0 度,即不做旋转处理。 + */ + +@property(assign, nonatomic) ByteRTCVideoRotation renderRotation; +@end + + +/** + * + * @type keytype + * @brief 视频帧附加的数据,视频解码后获得的附加数据 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCFrameExtendedData : NSObject +/** + * + * @brief 数据类型,详见 ByteRTCDataFrameType{@link #ByteRTCDataFrameType}。 + */ + +@property(assign, nonatomic) ByteRTCDataFrameType frameType; +/** + * + * @brief 附加数据 + */ + +@property(strong, nonatomic) NSData * _Nullable extendedData; +/** + * + * @brief 附加数据长度 + */ + +@property(assign, nonatomic) NSInteger extendedDataLen; +@end + +NS_ASSUME_NONNULL_BEGIN + +/** + * + * @type keytype + * @brief 视频流参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoSolution: NSObject +/** + * + * @brief 视频分辨率 + */ + +@property(nonatomic, assign) CGSize videoSize; +/** + * + * @brief 视频预设帧率 + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 最高编码码率(千比特每秒)。建议使用 `-1`,SDK 会自动根据分辨率和帧率适配合适的码率。 + */ + +@property(nonatomic, assign) NSInteger maxKbps; +/** + * + * @brief 最低编码码率(千比特每秒) + */ + +@property(nonatomic, assign) NSInteger minKbps; +/** + * + * @brief 视频编码质量策略,参见 ByteRTCVideoEncoderPreference{@link #ByteRTCVideoEncoderPreference} + */ + +@property(nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference; +@end + +/** + * + * @type keytype + * @brief 视频采集参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoCaptureConfig: NSObject +/** + * + * @brief 视频采集模式,参看 ByteRTCVideoCapturePreference{@link #ByteRTCVideoCapturePreference} + */ + +@property(nonatomic, assign) ByteRTCVideoCapturePreference preference; + +/** + * + * @brief 视频采集分辨率 + */ + +@property(nonatomic, assign) CGSize videoSize; +/** + * + * @brief 视频采集帧率,单位:fps。 + */ + +@property(nonatomic, assign) NSInteger frameRate; +@end + +/** + * + * @type keytype + * @brief 流属性。 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCStream +/** + * + * @brief 发布此流的用户 ID。 + */ + +@property(nonatomic, copy, readonly) NSString * userId; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign, readonly) BOOL isScreen; +/** + * + * @brief 此流是否包括视频流。 + */ + +@property(nonatomic, assign, readonly) BOOL hasVideo; +/** + * + * @brief 流是否包括音频流。 + */ + +@property(nonatomic, assign, readonly) BOOL hasAudio; +/** + * + * @brief 视频流的分辨率信息。
    + * 当远端用户调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。
    + * 参看 ByteRTCVideoSolution{@link #ByteRTCVideoSolution}。 + */ + +@property(nonatomic, copy, readonly) NSArray * videoStreamDescriptions; +/** + * + * @brief 视频流最大分辨率,在开启多分辨率发布订阅时,回调发布端能支持的最大发布分辨率。 + */ + +@property(nonatomic, retain, readonly) ByteRTCVideoSolution *maxVideoStreamDescription; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) ByteRTCStreamIndex streamIndex; +@end + +/** + * + * @type keytype + * @brief 订阅流的参数配置。用户手动订阅一路音视频流所使用的订阅配置参数。
    + * 用户关闭自动订阅功能,使用手动订阅模式时,通过调用 `subscribeStream` 方法订阅音视频流,调用时传入的参数即为此数据类型。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubscribeConfig: NSObject +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +/** + * + * @brief 是否订阅视频。
    + * 用户通过设置此参数,选择是否订阅远端流中的视频。 YES 为订阅视频,NO 为不订阅视频,默认值为 YES 。 + */ + +@property(nonatomic, assign) BOOL subscribeVideo; +/** + * + * @brief 是否订阅音频。
    + * 用户通过设置此参数,选择是否订阅远端流中的音频。YES 为订阅音频,NO 为不订阅音频,默认值为 YES 。 + */ + +@property(nonatomic, assign) BOOL subscribeAudio; +/** + * + * @brief 订阅的视频流分辨率下标。
    + * 用户可以通过调用 setVideoEncoderConfig:{@link #ByteRTCEngine#setVideoEncoderConfig:} 方法发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。 + */ + +@property(nonatomic, assign) NSInteger videoIndex; +/** + * + * @brief 订阅的视频流时域分层,默认值为 0。 + */ + +@property(nonatomic, assign) NSInteger svcLayer; +/** + * + * @brief 订阅的宽度信息,单位:px,默认值为 0。 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 订阅的高度信息,单位:px, 默认值为 0。 + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @hidden for internal use only + */ + +@property(nonatomic, assign) NSInteger subVideoIndex; +/** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0,设为大于 0 的值时开始生效。
    + * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
    + * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + +@property (nonatomic, assign) NSInteger framerate; + + +@end + +NS_ASSUME_NONNULL_END + +/** + * + * @type keytype + * @brief 视频帧数据 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoFrameData : NSObject +/** + * + * @brief 视频帧缓冲区类型,参考 ByteRTCVideoBufferType {@link #ByteRTCVideoBufferType}。必填。 + */ + +@property ByteRTCVideoBufferType bufferType; + +/** + * + * @brief 视频帧像素格式,参考 ByteRTCVideoPixelFormat {@link #ByteRTCVideoPixelFormat}。当 `bufferType` 为 `ByteRTCVideoBufferTypeGLTexture` 时必填。 + */ + +@property ByteRTCVideoPixelFormat pixelFormat; +/** + * + * @brief 视频内容类型,参看 ByteRTCVideoContentType{@link #ByteRTCVideoContentType} + */ + +@property ByteRTCVideoContentType contentType; +/** + * + * @brief 当前帧的时间戳。必填。 + */ + +@property CMTime timestamp; +/** + * + * @brief 视频帧宽度。必填。 + */ + +@property int width; +/** + * + * @brief 视频帧高度。必填。 + */ + +@property int height; +/** + * + * @brief `CVPixelBufferRef` 类型的数据,当 `format` 为 `kPixelFormatCVPixelBuffer` 时,必填。 + */ + +@property CVPixelBufferRef _Nullable cvpixelbuffer; +/** + * + * @brief 视频帧旋转角度,参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。 + */ + +@property ByteRTCVideoRotation rotation; +/** + * + * @brief 视频帧的摄像头位置信息,参考 ByteRTCCameraID{@link #ByteRTCCameraID} + */ + +@property ByteRTCCameraID cameraId; +/** + * + * @brief SEI 数据 + */ + +@property NSData * _Nullable seiData; + +/** + * + * @brief 视频帧感兴趣区域数据 + */ + +@property NSData * _Nullable roiData; + +/** + * + * @brief 视频帧平面数。当 `bufferType` 为 `ByteRTCVideoBufferTypeRawMemory` 时必填。 + */ + +@property int numberOfPlanes; + +/** + * + * @brief 视频帧平面数组。当 `bufferType` 为 `ByteRTCVideoBufferTypeRawMemory` 时必填。 + */ + +@property void ** _Nullable planeDataArray; + +/** + * + * @brief stride 数组。stride 指视频帧平面相邻两行图像数据之间的内存长度(单位字节)。当 `bufferType` 为 `ByteRTCVideoBufferTypeRawMemory` 时必填。 + */ + +@property int * _Nullable planeStrideArray; +@end + +/** + * + * @type keytype + * @brief 视频帧接口 + */ + + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoFrame +@required +/** + * + * @brief 获取视频帧缓冲区类型,参考 ByteRTCVideoBufferType {@link #ByteRTCVideoBufferType} + */ + +@property(readonly) ByteRTCVideoBufferType bufferType; + +/** + * + * @brief 获取视频帧像素格式,参考 ByteRTCVideoPixelFormat {@link #ByteRTCVideoPixelFormat} + */ + +@property(readonly) ByteRTCVideoPixelFormat pixelFormat; +/** + * + * @brief 获取视频帧内容类型,参看 ByteRTCVideoContentType{@link #ByteRTCVideoContentType} + */ + +@property(readonly) ByteRTCVideoContentType contentType; +/** + * + * @brief 获取时间戳 + */ + +@property(readonly) CMTime timestamp; +/** + * + * @brief 获取视频帧宽度 + */ + +@property(readonly) int width; +/** + * + * @brief 获取视频帧高度 + */ + +@property(readonly) int height; +/** + * + * @brief 获取 `CVPixelBufferRef` 类型的数据,当 format 为 `kPixelFormatCVPixelBuffer` 时有效 + */ + +@property(readonly) CVPixelBufferRef _Nullable cvpixelbuffer; +/** + * + * @brief 获取视频帧旋转角度 + */ + +@property(readonly) ByteRTCVideoRotation rotation; +/** + * + * @brief 获取视频帧的摄像头位置,参考 ByteRTCCameraID{@link #ByteRTCCameraID} + */ + +@property(readonly) ByteRTCCameraID cameraId; +/** + * + * @brief 获取 SEI 数据 + */ + +@property(readonly) NSData * _Nullable seiData; + +/** + * + * @brief 获取视频帧平面数量 + */ + +@property (readonly) int numberOfPlanes; + +/** + * + * @brief 获取视频帧平面数组 + */ + +@property (readonly) void ** _Nullable planeDataArray; + +/** + * + * @brief 获取 stride 数组。 stride 指视频帧平面相邻两行图像数据之间的内存长度(单位字节) + */ + +@property (readonly) int * _Nullable planeStrideArray; +/** + * + * @brief 视频帧引用计数加一 + * @note 视频帧消费者希望对视频帧进行异步处理时(例如切换线程进行渲染),需要调用此接口增加引用计数。异步处理结束则需要调用 `releaseRef` 使引用计数减1 + */ + +- (void)addRef; +/** + * + * @brief 视频帧引用计数减一。 + * @note 视频帧引用计数减为 0 时,视频帧对象会被释放。视频帧对象释放后,不应该继续使用视频帧。 + */ + +- (long)releaseRef; +@end + +/** + * + * @type keytype + * @brief 视频帧信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCEncodedVideoFrame : NSObject +/** + * + * @brief 视频编码类型。参看 ByteRTCVideoCodecType{@link #ByteRTCVideoCodecType} + */ + +@property(assign, nonatomic) ByteRTCVideoCodecType codecType; +/** + * + * @brief 视频帧编码类型。参看 ByteRTCVideoPictureType{@link #ByteRTCVideoPictureType} + */ + +@property(assign, nonatomic) ByteRTCVideoPictureType pictureType; +/** + * + * @brief 视频采集时间戳,单位:微秒 + */ + +@property(assign, nonatomic) SInt64 timestampUs; +/** + * + * @brief 视频编码时间戳,单位:微秒 + */ + +@property(assign, nonatomic) SInt64 timestampDtsUs; +/** + * + * @brief 视频帧宽,单位:px + */ + +@property(assign, nonatomic) int width; +/** + * + * @brief 视频帧高,单位:px + */ + +@property(assign, nonatomic) int height; +/** + * + * @brief 视频帧旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation} + */ + +@property(nonatomic, assign) ByteRTCVideoRotation rotation; +/** + * + * @brief 视频帧数据指针地址 + */ + +@property(strong, nonatomic) NSData * _Nonnull data; + +@end + +#pragma mark CDN/WTN object +/** + * + * @type keytype + * @brief 转推任务详情 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamTaskInfo : NSObject +/** + * + * @type keytype + * @brief 任务 ID + * 对于 WTN 流任务,该值代表 WTN 流 ID。你可以通过该 ID,指定需要订阅的 WTN 流。 + */ + +@property(nonatomic, copy) NSString * _Nonnull taskId; +/** + * + * @type keytype + * @brief 任务类型,合流转推 CDN 还是 WTN 流。 + */ + +@property(nonatomic, assign) ByteRTCMixedStreamPushTargetType pushTargetType; +@end +/** + * + * @type keytype + * @brief WTN 流裁剪信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSourceCropInfo : NSObject +/** + * + * @brief 裁剪后得到的视频帧左上角横坐标相对于裁剪前整体画面的比例,取值范围[0.0, 1.0) + */ + +@property(assign, nonatomic) CGFloat locationX; +/** + * + * @brief 裁剪后得到的视频帧左上角纵坐标相对于裁剪前整体画面的比例,取值范围[0.0, 1.0) + */ + +@property(assign, nonatomic) CGFloat locationY; +/** + * + * @brief 裁剪后得到的视频帧宽度相对于裁剪前整体画面的比例,取值范围(0.0, 1.0] + */ + +@property(assign, nonatomic) CGFloat widthProportion; +/** + * + * @brief 裁剪后得到的视频帧高度相对于裁剪前整体画面的比例,取值范围(0.0, 1.0] + */ + +@property(assign, nonatomic) CGFloat heightProportion; +@end +/** + * + * @type keytype + * @brief 图片合流水印图片分辨率。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig : NSObject +/** + * + * @brief 原始图片的宽度,单位为 px。 + */ + +@property (assign, nonatomic) NSInteger imageWidth; +/** + * + * @brief 原始图片的高度,单位为 px。 + */ + +@property (assign, nonatomic) NSInteger imageHeight; +@end + +/** + * + * @type keytype + * @brief 单个图片或视频流在合流中的布局信息。
    + * 开启合流功能后,在多路图片或视频流合流时,你可以设置其中一路流在合流中的预设布局信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamLayoutRegionConfig : NSObject +/** + * + * @brief 视频流发布用户的用户 ID 。建议设置。 + */ + +@property(copy, nonatomic) NSString * _Nonnull userID; +/** + * + * @brief 图片或视频流所在房间的房间 ID。建议设置。
    + * 如果此图片或视频流是通过 startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms:} 转发到你所在房间的媒体流时,你应将房间 ID 设置为你所在的房间 ID。 + */ + +@property(copy, nonatomic) NSString * _Nonnull roomID; +/** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 X 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的横向位移。
    + * 取值范围为 [0, 整体画布宽度)。默认值为 0。 + */ + +@property(assign, nonatomic) NSInteger locationX; +/** + * + * @brief 单个用户画面左上角在整个画布坐标系中的 Y 坐标(pixel),即以画布左上角为原点,用户画面左上角相对于原点的纵向位移。
    + * 取值范围为 [0, 整体画布高度)。默认值为 0。 + */ + +@property(assign, nonatomic) NSInteger locationY; +/** + * + * @brief 单个用户画面的宽度。取值范围为 [0, 整体画布宽度],默认值为 360。 + */ + +@property(assign, nonatomic) NSInteger width; +/** + * + * @brief 单个用户画面的高度。取值范围为 [0, 整体画布高度],默认值为 640。 + */ + +@property(assign, nonatomic) NSInteger height; +/** + * + * @brief 用户视频布局在画布中的层级。取值范围为 [0 - 100],0 为底层,值越大越上层。默认值为 0。建议设置。 + */ + +@property(assign, nonatomic) NSInteger zOrder; +/** + * + * @brief 是否为本地用户 + */ + +@property(assign, nonatomic) BOOL isLocalUser; +/** + * + * @brief 流类型,默认为主流。参看 ByteRTCMixedStreamVideoType{@link #ByteRTCMixedStreamVideoType}。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamVideoType streamType; +/** + * + * @brief 透明度,可选范围为 (0.0, 1.0],0.0 为全透明。默认值为 1.0。 + */ + +@property(assign, nonatomic) CGFloat alpha; +/** + * + * @brief 圆角半径相对画布宽度的比例。默认值为 `0.0`。
    + * 做范围判定时,首先根据画布的宽高,将 `width`,`height`,和 `cornerRadius` 分别转换为像素值:`width_px`,`height_px`,和 `cornerRadius_px`。然后判定是否满足 `cornerRadius_px < min(width_px/2, height_px/2)`:若满足,则设置成功;若不满足,则将 `cornerRadius_px` 设定为 `min(width_px/2, height_px/2)`,然后将 `cornerRadius` 设定为 `cornerRadius_px` 相对画布宽度的比例值。 + * WTN 流任务不支持设置本参数。 + */ + +@property(assign, nonatomic) CGFloat cornerRadius; +/** + * + * @brief 合流内容控制。默认值为 `ByteRTCTranscoderContentControlTypeHasAudioAndVideo`,参看 ByteRTCMixedStreamMediaType{@link #ByteRTCMixedStreamMediaType} 。 + */ + +@property (assign, nonatomic) ByteRTCMixedStreamMediaType mediaType; +/** + * + * @brief 图片或视频流的缩放模式,参看 ByteRTCMixedStreamRenderMode{@link #ByteRTCMixedStreamRenderMode}。默认值为 1。建议设置。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamRenderMode renderMode; +/** + * + * @brief 合流布局区域类型。参看 ByteRTCMixedStreamLayoutRegionType{@link #ByteRTCMixedStreamLayoutRegionType}。建议设置。 + */ + +@property (assign, nonatomic) ByteRTCMixedStreamLayoutRegionType regionContentType; +/** + * + * @brief 水印图 RGBA 数据。当 `regionContentType` 为图片类型时需要设置。
    + * - `ByteRTCMixedStreamLayoutRegionTypeImage = 1` 时,传入图片 RGBA 数据。 + * - `ByteRTCMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + +@property (strong, nonatomic) NSData * _Nullable imageWaterMark; +/** + * + * @brief 水印图参数。当 `regionContentType` 为图片类型时需要设置。
    + * - `ByteRTCMixedStreamLayoutRegionTypeImage = 1` 时,传入图片参数,参看 ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig{@link #ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig}。 + * - `ByteRTCMixedStreamLayoutRegionTypeVideoStream = 0` 时传入空。 + * WTN 流任务不支持设置本参数。 + */ + +@property (strong, nonatomic) ByteRTCMixedStreamLayoutRegionImageWaterMarkConfig * _Nullable imageWaterMarkConfig; +/** + * + * @brief 空间位置。参看 ByteRTCPosition{@link #ByteRTCPosition}。 + */ + +@property (strong, nonatomic) ByteRTCPosition * _Nullable spatialPosition; +/** + * + * @brief 设置某用户是否应用空间音频效果:
    + * - Yes:启用(默认值) + * - No:禁用 + */ + +@property(assign, nonatomic) BOOL applySpatialAudio; +/** + * + * @valid since 3.57 + * @brief 设置占位图的填充模式。
    + * 该参数用来控制当用户停止发布视频流,画面恢复为占位图后,此时占位图的填充模式。参看 ByteRTCMixedStreamAlternateImageFillMode{@link #ByteRTCMixedStreamAlternateImageFillMode}。 + */ + +@property (assign, nonatomic)ByteRTCMixedStreamAlternateImageFillMode alternateImageFillMode; +/** + * + * @valid since 3.57 + * @brief 设置占位图的 URL,长度小于 1024 字符. + */ + +@property(copy, nonatomic)NSString * alternateImageUrl; +/** + * + * @valid since 3.57 + * @brief WTN 流裁剪区域。参看 ByteRTCSourceCropInfo{@link #ByteRTCSourceCropInfo}。 + */ + +@property(strong, nonatomic) ByteRTCSourceCropInfo * _Nonnull sourceCrop; +@end + +/** + * + * @type keytype + * @brief 视频转码配置参数。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamVideoConfig : NSObject +/** + * + * @brief 视频编码格式,参看 ByteRTCMixedStreamVideoCodecType{@link #ByteRTCMixedStreamVideoCodecType}。默认值为 `0`。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamVideoCodecType videoCodec; +/** + * + * @brief 合流视频宽度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 640 px。建议设置。
    + * 设置值为非偶数时,自动向上取偶数。 + */ + +@property(assign, nonatomic) NSInteger width; +/** + * + * @brief 合流视频高度。单位为 px,范围为 [2, 1920],必须是偶数。默认值为 360 px。建议设置。
    + * 设置值为非偶数时,自动向上取偶数。 + */ + +@property(assign, nonatomic) NSInteger height; +/** + * + * @brief 合流视频帧率。单位为 FPS,取值范围为 [1,60],默认值为 15 FPS。建议设置。 + */ + +@property(assign, nonatomic) NSInteger fps; +/** + * + * @brief 视频 I 帧时间间隔。单位为秒,取值范围为 [1, 5],默认值为 2 秒。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(assign, nonatomic) NSInteger gop; +/** + * + * @brief 合流视频码率。单位为 Kbps,取值范围为 [1,10000],默认值为自适应模式。建议设置。 + */ + +@property(assign, nonatomic) NSInteger bitrate; +/** + * + * @brief 是否在合流中开启 B 帧,仅服务端合流支持. + */ + +@property(assign, nonatomic) BOOL enableBFrame; +@end + +/** + * + * @type keytype + * @brief 音频转码配置参数。
    + * 值不合法或未设置时,自动使用默认值。
    + * 本参数不支持过程中更新。
    + * WTN 流任务不支持设置本参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamAudioConfig : NSObject +/** + * + * @brief 音频编码格式。建议设置。 + * @param codec 音频编码格式,参看 ByteRTCMixedStreamAudioCodecType{@link #ByteRTCMixedStreamAudioCodecType}。默认值为 `0`。建议设置。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamAudioCodecType audioCodec; +/** + * + * @brief 音频采样率,单位 Hz。可取 32000 Hz、44100 Hz、48000 Hz,默认值为 48000 Hz。建议设置。 + */ + +@property(assign, nonatomic) NSInteger sampleRate; +/** + * + * @brief 音频声道数。可取 1(单声道)、2(双声道),默认值为 2。建议设置。 + */ + +@property(assign, nonatomic) NSInteger channels; +/** + * + * @brief 音频码率,单位 Kbps。可取范围 [32, 192],默认值为 64 Kbps。建议设置。 + */ + +@property(assign, nonatomic) NSInteger bitrate; +/** + * + * @brief AAC 编码规格,参看 ByteRTCMixedStreamAudioProfile{@link #ByteRTCMixedStreamAudioProfile}。默认值为 `0`。建议设置。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamAudioProfile audioProfile; +@end + +/** + * + * @type keytype + * @brief 推流 CDN 的空间音频参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamSpatialAudioConfig : NSObject +/** + * + * @brief 是否开启推流 CDN 时的空间音频效果。
    + * 当你启用此效果时,你需要设定推流中各个 ByteRTCMixedStreamLayoutRegionConfig{@link #ByteRTCMixedStreamLayoutRegionConfig} 的 `spatialPosition` 值,实现空间音频效果。 + */ + +@property(assign, nonatomic) BOOL enableSpatialRender; +/** + * + * @brief 听众的空间位置。参看 ByteRTCPosition{@link #ByteRTCPosition}。
    + * 听众指收听来自 CDN 的音频流的用户。
    + * WTN 流任务不支持设置本参数。 + */ + +@property (strong, nonatomic) ByteRTCPosition * _Nullable audienceSpatialPosition; +/** + * + * @brief 听众的空间朝向。参看 ByteRTCHumanOrientation{@link #ByteRTCHumanOrientation}。
    + * 听众指收听来自 CDN 的音频流的用户。 + */ + +@property(strong, nonatomic) ByteRTCHumanOrientation * _Nullable audienceSpatialOrientation; + +@end + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 客户端合流参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCClientMixedStreamConfig : NSObject +/** + * + * @brief 客户端合流是否使用混音,默认为 true。 + */ + +@property(assign, nonatomic) BOOL useAudioMixer; +/** + * + * @brief 客户端合流回调视频格式,参看 ByteRTCMixedStreamClientMixVideoFormat{@link #ByteRTCMixedStreamClientMixVideoFormat}。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamClientMixVideoFormat videoFormat; +@end + +/** + * + * @hidden internal use only + * @valid since 3.52 + * @type keytype + * @brief 转推直播单通同步参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamSyncControlConfig : NSObject +/** + * + * @brief 同步策略 + */ + +@property(assign, nonatomic)ByteRTCMixedStreamSyncStrategy syncStrategy; +/** + * + * @brief 在进行同步处理时,基准流所属用户的 ID。默认为空。 + */ + +@property(copy, nonatomic) NSString * _Nullable baseUserID; +/** + * + * @brief 在进行同步处理时,缓存音视频流的最大长度。单位为毫秒。默认值为 2000。
    + * 参与转推直播的这些媒体流延迟越高,应该将此值设置的越大。但此值越大,因缓存媒体流造成的内存占用也会更大。推荐值为 `2000`。 + */ + +@property(assign, nonatomic) NSInteger maxCacheTimeMs; +/** + * + * @brief 是否通过 RTC SDK 进行转推直播。默认为 True。
    + * 如果选择 `False`,你会通过 onCacheSyncVideo:withDataFrame:withUids:taskId:{@link #ByteRTCClientMixedStreamDelegate#onCacheSyncVideo:withDataFrame:withUids:taskId:} 收到同步的帧,你可以使用此视频帧,自行实现合流转推。 + */ + +@property(assign, nonatomic) BOOL videoNeedSdkMix; +@end + +/** + * + * @type keytype + * @brief 服务端合流控制参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamControlConfig : NSObject +/** + * + * @valid since 3.56 + * @brief 是否开启单独发送声音提示 SEI 的功能:
    + * - True:开启; + * - False:关闭。(默认值) + * 开启后,你可以通过 `ByteRTCMixedStreamControlConfig.seiContentMode` 控制 SEI 的内容是否只携带声音信息。 + */ + +@property(assign, nonatomic) BOOL enableVolumeIndication; +/** + * + * @valid since 3.56 + * @brief 声音提示间隔,单位为秒,取值范围为 [0.3,+∞),默认值为 2。
    + * 此值仅取整百毫秒。若传入两位及以上小数,则四舍五入取第一位小数的值。例如,若传入 0.36,则取 0.4。 + */ + +@property(assign, nonatomic) CGFloat volumeIndicationInterval; +/** + * + * @valid since 3.56 + * @brief 有效音量大小,取值范围为 [0, 255],默认值为 0。
    + * 超出取值范围则自动调整为默认值,即 0。 + */ + +@property(assign, nonatomic) NSInteger talkVolume; +/** + * + * @valid since 3.56 + * @brief 声音信息 SEI 是否包含音量值:
    + * - True:是; + * - False:否,默认值。 + */ + +@property(assign, nonatomic) BOOL isAddVolumeValue; +/** + * + * @valid since 3.56 + * @brief 设置 SEI 内容。参看 ByteRTCMixedStreamSEIContentMode{@link #ByteRTCMixedStreamSEIContentMode}。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamSEIContentMode seiContentMode; +/** + * + * @valid since 3.56 + * @brief SEI 信息的 payload type。
    + * 默认值为 `100`,只支持设置 `5` 和 `100`。
    + * 在转推直播的过程中,该参数不支持变更。 + */ + +@property(assign, nonatomic) NSInteger seiPayloadType; +/** + * + * @valid since 3.56 + * @brief SEI 信息的 payload UUID。 + * @note PayloadType 为 `5` 时,必须填写 PayloadUUID,否则会收到错误回调,错误码为 1091。
    + * PayloadType 不是 `5` 时,不需要填写 PayloadUUID,如果填写会被后端忽略。
    + * 该参数长度需为 32 位,否则会收到错误码为 1091 的回调。
    + * 该参数每个字符的范围需为 [0, 9] [a, f] [A, F]
    + * 该参数不应带有`-`字符,如系统自动生成的 UUID 中带有`-`,则应删去。
    + * 在转推直播的过程中,该参数不支持变更。 + */ + +@property(copy, nonatomic) NSString *seiPayloadUUID; +/** + * + * @valid since 3.57 + * @brief 设置合流推到 CDN 时输出的媒体流类型。参看 ByteRTCMixedStreamMediaType{@link #ByteRTCMixedStreamMediaType}。
    + * 默认输出音视频流。支持输出纯音频流,但暂不支持输出纯视频流。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamMediaType mediaType; +/** + * + * @valid since 3.57 + * @brief 设置是否在没有用户发布流的情况下发起转推直播。具体参看 ByteRTCMixedStreamPushMode{@link #ByteRTCMixedStreamPushMode}。
    + * 该参数在发起合流任务后的转推直播过程中不支持动态变更。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamPushMode pushStreamMode; +@end + +/** + * + * @type keytype + * @brief 合流转推配置参数。
    + * 如无特别说明,参数可适用于 WTN 流和合流转推任务。
    + * 如无特别说明,参数可用于启动和更新任务。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamPushTargetConfig : NSObject +/** + * + * @type api + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * 本参数不支持过程中更新。 + * WTN 流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString * _Nullable pushCDNURL; +/** + * + * @type keytype + * @brief WTN 流 ID。 + * 合流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString * _Nullable pushWTNStreamID; +/** + * + * @type keytype + * @brief 推流任务类型。 + */ + +@property(assign, nonatomic) ByteRTCMixedStreamPushTargetType pushTargetType; +@end +/** + * + * @type keytype + * @brief 合流转推配置参数。 + * 如无特别说明,参数可适用于 WTN 流和合流转推任务。 + * 如无特别说明,参数可用于启动和更新任务。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMixedStreamConfig : NSObject +/** + * + * @brief 合流背景颜色,用十六进制颜色码(HEX)表示。例如,#FFFFFF 表示纯白,#000000 表示纯黑。默认值为 #000000。建议设置。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +@property(copy, nonatomic) NSString *_Nonnull backgroundColor; +/** + * + * @brief 用户布局信息列表。每条流的具体布局参看 ByteRTCMixedStreamLayoutRegionConfig{@link #ByteRTCMixedStreamLayoutRegionConfig}。建议设置。
    + * 值不合法或未设置时,自动使用默认值。 + */ + +@property(copy, nonatomic) NSArray * _Nonnull regions; + + +/** + * + * @brief 视频转码参数。详见 ByteRTCMixedStreamVideoConfig{@link #ByteRTCMixedStreamVideoConfig} 数据类型。建议设置。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamVideoConfig * _Nonnull videoConfig; +/** + * + * @brief 音频合流参数,参看 ByteRTCMixedStreamAudioConfig{@link #ByteRTCMixedStreamAudioConfig}。建议设置。
    + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamAudioConfig * _Nonnull audioConfig; +/** + * + * @hidden for internal use only + * @brief 转推同步配置。详见 ByteRTCMixedStreamSyncControlConfig{@link #ByteRTCMixedStreamSyncControlConfig} 。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamSyncControlConfig * _Nullable syncControlConfig; +/** + * + * @hidden(macOS) + * @brief 转推 CDN 空间音频配置。详见 ByteRTCMixedStreamSpatialAudioConfig{@link #ByteRTCMixedStreamSpatialAudioConfig} 。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamSpatialAudioConfig * _Nonnull spatialAudioConfig; +/** + * + * @brief 服务端合流控制参数。详见 ByteRTCMixedStreamControlConfig{@link #ByteRTCMixedStreamControlConfig} 。 + */ + +@property(strong, nonatomic) ByteRTCMixedStreamControlConfig * _Nonnull controlConfig; +/** + * + * @hidden for internal use only + * @brief 动态扩展自定义参数。 + */ + +@property(strong, nonatomic) NSMutableDictionary * _Nullable advancedConfig; +/** + * + * @hidden for internal use only + * @brief 业务透传鉴权信息 + */ + +@property(strong, nonatomic) NSMutableDictionary * _Nullable authInfo; + +/** + * + * @hidden for internal use only + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + * - 本参数不支持过程中更新。 + * - WTN 流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString * _Nullable pushURL; +/** + * + * @brief 推流房间 ID。`roomID` 和 `userID` 长度相加不得超过 126 字节。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(copy, nonatomic) NSString * _Nonnull roomID; +/** + * + * @brief 推流用户 ID。`roomID` 和 `userID` 长度相加不得超过 126 字节。建议设置。
    + * 本参数不支持过程中更新。 + */ + +@property(copy, nonatomic) NSString * _Nonnull userID; +/** + * + * @brief 用户配置的额外数据。
    + * WTN 流任务不支持设置本参数。 + */ + +@property(copy, nonatomic) NSString *_Nonnull userConfigExtraInfo; +/** + * + * @valid since 3.57 + * @brief 设置合流后整体画布的背景图片 URL,长度最大为 1023 bytes。
    + * 必须是http开头,支持的图片格式包括:JPG, JPEG, PNG。如果背景图片的宽高和整体屏幕的宽高不一致,背景图片会缩放到铺满屏幕。 + */ + +@property(copy, nonatomic) NSString *_Nonnull backgroundImageURL; +/** + * + * @brief WTN 流布局模式。参看 ByteRTCStreamLayoutMode{@link #ByteRTCStreamLayoutMode}。可选:
    + * - `auto`: 自动布局。默认值 + * - `custom`: 自定义布局。 + */ + +@property(assign, nonatomic)ByteRTCStreamLayoutMode layoutMode; +/** + * + * @brief WTN 流的补帧模式。参看 ByteRTCInterpolationMode{@link #ByteRTCInterpolationMode}。可选: + */ + +@property(assign, nonatomic) ByteRTCInterpolationMode interpolationMode; + +/** + * + * @brief 任务类型。参看 ByteRTCMixedStreamPushTargetType{@link #ByteRTCMixedStreamPushTargetType}。可选: + */ + +@property(assign, nonatomic) ByteRTCMixedStreamPushTargetType pushTargetType; +/** + * + * @brief 获取默认转推直播配置参数。 + * @return 转推直播配置参数,参看 ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}。 + */ +/**s + * + * @brief Gets the default configurations for pushing streams to CDN. + * @return Configurations for pushing streams to CDN. See ByteRTCMixedStreamConfig{@link #ByteRTCMixedStreamConfig}. + */ ++ (instancetype _Nonnull)defaultMixedStreamConfig; +@end + +/** + * + * @type keytype + * @brief 单流转推配置目标房间信息 + */ + +BYTERTC_APPLE_EXPORT @interface DestInfo: NSObject + /** + * + * @brief 目标房间ID + */ + + @property(nonatomic, copy) NSString * _Nonnull roomId; + + /** + * + * @brief 目标房间中的用户ID + */ + + @property(nonatomic, copy) NSString * _Nonnull userId; +@end + +/** + * + * @type keytype + * @brief 单流转推类型 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCSingleStreamPushType) { + /** + * + * @brief 单流转推到CDN + */ + + ByteRTCSingleStreamPushToCDN = 1, + /** + * + * @brief 单流转推到RTC房间 + */ + + ByteRTCSingleStreamPushToRTC = 2 +}; + +/** + * + * @type keytype + * @brief 单流转推直播配置参数。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCPushSingleStreamParam : NSObject +/** + * + * @brief 推流 CDN 地址。仅支持 RTMP 协议,Url 必须满足正则 `/^rtmps?:\/\ + */ + +@property(copy, nonatomic) NSString * _Nullable url; +/** + * + * @brief 媒体流所在的房间 ID + */ + +@property(copy, nonatomic) NSString * _Nonnull roomId; +/** + * + * @brief 媒体流所属的用户 ID + */ + +@property(copy, nonatomic) NSString * _Nullable userId; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +/** + * + * @brief 跨房间转发的目标房间信息数组,默认值为 nil。
    + * 当需要将媒体流从当前房间转发到其他房间时,可在此数组中指定多个目标房间信息。 + */ + +@property(nonatomic, strong) NSArray * _Nullable destInfo; +/** + * + * @brief 单流转推类型,指定将媒体流转推到 CDN 还是 RTC 房间,默认值为转推到 CDN。 + */ + +@property(assign, nonatomic) ByteRTCSingleStreamPushType pushType; +@end + +/** + * + * @type keytype + * @brief 视频订阅配置信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubscribeVideoConfig : NSObject +/** + * + * @brief 订阅的视频流分辨率下标。
    + * 当远端用户通过调用 setLocalSimulcastMode:{@link #ByteRTCEngine#setlocalsimulcastmode:} 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
    + * 默认值为 0,即订阅第一路流。
    + * 如果不想更改之前的设置,可以输入 -1。 + */ + +@property(assign, nonatomic) NSInteger videoIndex; +/** + * + * @brief 远端用户优先级,参看 ByteRTCRemoteUserPriority{@link #ByteRTCRemoteUserPriority},默认值为 0。 + */ + +@property(assign, nonatomic) NSInteger priority; +@end + +/** + * + * @type keytype + * @brief 性能回退相关数据 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSourceWantedData : NSObject +/** + * + * @brief 推荐视频输入宽 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 推荐视频输入高 + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 推荐视频输入帧率 + */ + +@property(nonatomic, assign) NSInteger frameRate; +@end + +/** + * + * @type keytype + * @brief 流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteStreamSwitchEvent : NSObject +/** + * + * @brief 订阅的音视频流的发布者的用户 ID。 + */ + +@property(nonatomic, copy) NSString * _Nonnull uid; +/** + * + * @brief 预留字段。 + */ + +@property(nonatomic, assign) BOOL isScreen; +/** + * + * @brief 流切换前订阅视频流的分辨率对应的索引 + */ + +@property(nonatomic, assign) NSInteger beforeVideoIndex; +/** + * + * @brief 流切换后订阅视频流的分辨率对应的索引 + */ + +@property(nonatomic, assign) NSInteger afterVideoIndex; +/** + * + * @brief 流切换前是否有视频流 + */ + +@property(nonatomic, assign) BOOL beforeVideoEnabled; +/** + * + * @brief 流切换后是否有视频流 + */ + +@property(nonatomic, assign) BOOL afterVideoEnabled; +/** + * + * @brief 流切换原因,详见 ByteRTCFallbackOrRecoverReason{@link #ByteRTCFallbackOrRecoverReason}。 + */ + +@property(nonatomic, assign) ByteRTCFallbackOrRecoverReason reason; +@end +/** + * + * @hidden + * @deprecated since 3.45 and will be deleted in 3.51, use ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} instead. + * @type callback + * @brief 自定义的视频渲染 + * @list + */ + +DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate") +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoSinkProtocol +@required +/** + * + * @type callback + * @brief 初始化渲染器 + * @return + * - YES: 自定义的渲染器初始化完成 + * - NO: 自定义的渲染器初始化失败,不继续往下运行 + * @note 初始化渲染器的时候会回调这个方法 + * @list + */ + +- (BOOL)shouldInitialize DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate");; +/** + * + * @type callback + * @brief 启动渲染器 + * @note 在开启渲染功能的时候会回调这个方法 + * @list + */ + +- (void)shouldStart DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 停止渲染器 + * @note 在停止渲染功能的时候会回调这个方法 + * @list + */ + +- (void)shouldStop DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 释放渲染器 + * @note 渲染器即将被废弃的时候会回调这个方法 + * @list + */ + +- (void)shouldDispose DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 获取 PixelFormat 格式 + * @return Buffer 类型,{@link #ByteRTCVideoSinkPixelFormat} + * @note 通过该方法的返回值,告知 SDK PixelFormat 的格式 + * @list + */ + +- (ByteRTCVideoPixelFormat)pixelFormat DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); +/** + * + * @type callback + * @brief 输出视频的 PixelBuffer + * @param pixelBuffer 视频的 PixelBuffer + * @param rotation 视频旋转角度,{@link #ByteRTCVideoRotation} + * @param cameraId 视频的相机 Id, {@link #ByteRTCCameraID} + * @param extendedData 视频帧附加的数据,视频解码后获得的附加数据 + * @note 通过该方法获取视频的 PixelBuffer + * @list + */ + +- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer + rotation:(ByteRTCVideoRotation)rotation + cameraId:(ByteRTCCameraID) cameraId + extendedData:(NSData * _Nullable)extendedData DEPRECATED_MSG_ATTRIBUTE("Please use ByteRTCVideoSinkDelegate"); + +/** + * + * @hidden constructor/destructor + */ + +- (int)getRenderElapse; +@end + +/** + * + * @type keytype + * @brief 自定义视频渲染器 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoSinkDelegate +@optional +/** + * + * @deprecated since 3.54, use onFrame: instead + * @type api + * @brief 输出视频的 PixelBuffer + * @param pixelBuffer 视频的 PixelBuffer + * @param rotation 视频旋转角度,参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation} + * @param contentType 视频内部类型 参看 ByteRTCVideoContentType{@link #ByteRTCVideoContentType} + * @param extendedData 视频解码后获得的附加数据 + * @list + */ + +- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer + rotation:(ByteRTCVideoRotation)rotation + contentType:(ByteRTCVideoContentType)contentType + extendedData:(NSData * _Nullable)extendedData; +/** + * + * @hidden for internal use only + */ + +- (int)getRenderElapse; + +@required +/** + * + * @type api + * @brief 输出视频的 PixelBuffer + * @param videoFrame 视频帧 + * @list + */ + +- (void)onFrame:(id _Nonnull)videoFrame; + +@end +/** + * + * @hidden for internal use only + * @type callback + * @brief 外部渲染数据的消费接口 + * @list + */ + +@protocol ByteRTCVideoFrameConsumerObserver +/** + * + * @brief 输出 yuv420 数据 + * @param ocFrame 数据 Buffer + * @param width 视频宽度 + * @param rotation 视频旋转角度 + * @param timestamp 时间戳 + */ + +- (void)consumeYUV420Buffer:(CVPixelBufferRef _Nullable)ocFrame + width:(NSInteger)width rotation:(NSInteger)rotation timestamp:(long)timestamp; +/** + * + * @brief 输出 RGBA 数据 + * @param ocFrame 数据 Buffer + * @param width 视频宽度 + * @param rotation 视频旋转角度 + * @param timestamp 时间戳 + */ + +- (void)consumeRGBABuffer:(CVPixelBufferRef _Nullable)ocFrame width:(NSInteger)width + rotation:(NSInteger)rotation timestamp:(long)timestamp; +@end +/** + * + * @type keytype + * @brief 本地视频帧回调配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCLocalVideoSinkConfig : NSObject +/** + * + * @brief 本地视频帧回调位置,参看 ByteRTCLocalVideoSinkPosition{@link #ByteRTCLocalVideoSinkPosition},默认回调前处理后的视频帧。 + */ + +@property(nonatomic, assign) ByteRTCLocalVideoSinkPosition position; +/** + * + * @brief 本地视频帧回调格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat},默认值为 0。 + */ + +@property(nonatomic, assign) ByteRTCVideoSinkPixelFormat requiredPixelFormat; + +@end + +/** + * + * @type keytype + * @brief 远端视频帧回调配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoSinkConfig : NSObject +/** + * + * @brief 远端视频帧回调位置,参看 ByteRTCLocalVideoSinkPosition{@link #ByteRTCLocalVideoSinkPosition},默认回调后处理后的视频帧。 + */ + +@property(nonatomic, assign) ByteRTCRemoteVideoSinkPosition position; +/** + * + * @brief 远端视频帧回调格式,参看 ByteRTCVideoSinkPixelFormat{@link #ByteRTCVideoSinkPixelFormat},默认值为 0。 + */ + +@property(nonatomic, assign) ByteRTCVideoSinkPixelFormat requiredPixelFormat; +/** + * + * @brief 是否将视频帧自动转正,参看 ByteRTCVideoApplyRotation{@link #ByteRTCVideoApplyRotation},默认为不旋转。 + */ + +@property(nonatomic, assign) ByteRTCVideoApplyRotation applyRotation; +/** + * + * @brief 是否将视频帧镜像。参看 ByteRTCVideoSinkMirrorType{@link #ByteRTCVideoSinkMirrorType},默认为不镜像。
    + * 本设置与 setRemoteVideoMirrorType:withMirrorType:{@link #ByteRTCEngine#setRemoteVideoMirrorType:withMirrorType:} (适用于内部渲染)相互独立。 + */ + +@property(nonatomic, assign) ByteRTCVideoSinkMirrorType mirrorType; + +@end + +/** + * + * @type keytype + * @brief 视频处理配置参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoPreprocessorConfig : NSObject +/** + * + * @brief 视频帧的像素格式,参看 ByteRTCVideoPixelFormat{@link #ByteRTCVideoPixelFormat}。
    + * 当前仅支持 `ByteRTCVideoPixelFormatI420` 和 `ByteRTCVideoPixelFormatUnknown` 格式。 + */ + +@property(nonatomic, assign) ByteRTCVideoPixelFormat requiredPixelFormat; +/** + * + * @brief 自定义视频前处理的作用范围,参看 ByteRTCProcessorActionDomain{@link #ByteRTCProcessorActionDomain}。 + * @param actionDomain 自定义视频前处理的作用范围。 + */ + +@property(nonatomic, assign) ByteRTCProcessorActionDomain actionDomain; + +@end +/** + * + * @type callback + * @brief 视频处理回调接口类
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频处理 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoProcessorDelegate +/** + * + * @type api + * @brief 获取 RTC SDK 采集得到的视频帧,根据 registerLocalVideoProcessor:withConfig:{@link #ByteRTCEngine#registerLocalVideoProcessor:withConfig:} 设置的视频前处理器,进行视频前处理,最终将处理后的视频帧给到 RTC SDK 用于编码传输。 + * @param srcFrame RTC SDK 采集得到的视频帧,参考: ByteRTCVideoFrame{@link #ByteRTCVideoFrame} + * @return 经过视频前处理后的视频帧,返回给 RTC SDK 供编码和传输,参考: ByteRTCVideoFrame{@link #ByteRTCVideoFrame} + * @note + * - 如果需要取消视频前处理,可以将视频前处理器设置为 nullptr。 + * - 应用层实现 `processVideoFrame` 接口时,可以直接修改 `src_frame` 的缓冲区,调用 `addRef` 方法将 `src_frame` 引用计数加一,然后将修改后的 `src_frame` 返回, 也可以创建一个新的视频帧并返回。 + * - 对于 `processVideoFrame` 返回的视频帧,在 SDK 层消费完成后,SDK 内部总是调用这个视频帧的 releaseRef 方法。 + * @list 自定义流处理 + */ + +- (id _Nullable)processVideoFrame:(id _Nonnull)srcFrame; + +@end +/** + * + * @hidden(iOS) + * @type keytype + * @brief 屏幕采集设置参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCScreenCaptureParam : NSObject +/** + * + * @brief 视频最大宽度,单位:像素。 + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 视频最大高度,单位:像素。 + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 屏幕采集帧率,单位:fps + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 发送屏幕采集码率,单位 kbps + */ + +@property(nonatomic, assign) NSInteger bitrate; +/** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `minBitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, bitrate),当 `bitrate` < `minBitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `bitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `bitrate` < `0` 时,适配码率模式。 + */ + +@property(nonatomic, assign) NSInteger minBitrate; +/** + * + * @brief 采集区域 + */ + +@property(nonatomic, assign) CGRect regionRect; +/** + * + * @brief 是否采集鼠标 + */ + +@property(nonatomic, assign) ByteRTCMouseCursorCaptureState mouseCursorCaptureState; +/** + * + * @brief 屏幕过滤设置 + */ + +@property (strong, nonatomic) NSArray * _Nullable excludedWindowList; +/** + * + * @brief 采集区域的边框高亮设置,参看 ByteRTCHighlightConfig{@link #ByteRTCHighlightConfig}。 + */ + +@property (strong, nonatomic) ByteRTCHighlightConfig * _Nonnull highlightConfig; +@end +/** + * + * @type keytype + * @brief 屏幕采集对象的具体信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCScreenCaptureSourceInfo : NSObject +/** + * + * @brief 屏幕分享时,共享对象的类型,参看 ByteRTCScreenCaptureSourceType{@link #ByteRTCScreenCaptureSourceType} + */ + +@property (assign, nonatomic) ByteRTCScreenCaptureSourceType sourceType; +/** + * + * @brief 屏幕分享时,共享对象的 ID。 + */ + +@property (assign, nonatomic) intptr_t sourceId; +/** + * + * @brief 屏幕分享时共享对象的名称。 + */ + +@property (copy, nonatomic) NSString * _Nullable sourceName; +/** + * + * @brief 共享的应用窗体所属应用的名称
    + * 当共享对象为应用窗体时有效 + */ + +@property (copy, nonatomic) NSString * _Nullable application; +/** + * + * @brief 共享的应用窗体所属应用进程的 pid
    + * 当共享对象为应用窗体时有效 + */ + +@property (assign, nonatomic) int pid; +/** + * + * @brief 共享的屏幕是否为主屏。
    + * 当共享对象为屏幕时有效 + */ + +@property (assign, nonatomic) BOOL primaryMonitor; +/** + * + * @brief 屏幕共享对象的坐标。多显示器的场景下,屏幕坐标系统以主屏左上角为原点 (0, 0),向右向下扩展。 + */ + +@property (assign, nonatomic) CGRect regionRect; + +@end + +/** + * + * @type keytype + * @region 视频管理 + * @brief 屏幕采集设置参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCScreenParam : NSObject +/** + * + * @brief 编码帧率,单位为 fps + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 编码码率,小于 0 时 SDK 会根据高宽自适应码率, 单位 kbps + */ + +@property(nonatomic, assign) NSInteger bitrate; +@end + +/** + * + * @type keytype + * @brief 虚拟背景对象。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVirtualBackgroundSource: NSObject +/** + * + * @brief 虚拟背景类型,详见 ByteRTCVirtualBackgroundSourceType{@link #ByteRTCVirtualBackgroundSourceType} 。 + */ + +@property(nonatomic, assign) ByteRTCVirtualBackgroundSourceType sourceType; +/** + * + * @brief 纯色背景使用的颜色。
    + * 格式为 0xAARRGGBB 。 + */ + +@property int sourceColor; +/** + * + * @brief 自定义背景图片的绝对路径。
    + * - 支持的格式为 jpg、jpeg、png。 + * - 图片分辨率超过 1080P 时,图片会被等比缩放至和视频一致。 + * - 图片和视频宽高比一致时,图片会被直接缩放至和视频一致。 + * - 图片和视频长宽比不一致时,为保证图片内容不变形,图片按短边缩放至与视频帧一致,使图片填满视频帧,对多出的高或宽进行剪裁。 + * - 自定义图片带有局部透明效果时,透明部分由黑色代替。 + */ + +@property(nonatomic) NSString* _Nullable sourcePath; +@end +/** + * + * @type callback + * @brief 本地视频帧监测器
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 自定义流处理 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCLocalEncodedVideoFrameObserver + @optional +/** + * + * @type callback + * @brief 调用 registerLocalEncodedVideoFrameObserver:{@link #ByteRTCEngine#registerLocalEncodedVideoFrameObserver:} 后,SDK 每次使用内部采集,采集到一帧视频帧,或收到一帧外部视频帧时,都会回调该事件。 + * @param videoSource 预留参数 + * @param frame 本地视频帧信息,参看 ByteRTCEncodedVideoFrame{@link #ByteRTCEncodedVideoFrame} + * @list 自定义流处理 + */ + +- (void)onLocalEncodedVideoFrame:(ByteRTCVideoSource* _Nullable)videoSource + Frame:(ByteRTCEncodedVideoFrame * _Null_unspecified)frame; +@end + +#pragma mark - ByteRTCEngineExternalVideoEncoderEventHandler +/** + * + * @type callback + * @brief 自定义编码帧回调类 + * @note 回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Custom Stream Processing + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCExternalVideoEncoderEventHandler +@required +/** + * + * @type callback + * @brief 提示自定义编码帧可以开始推送的回调。
    + * 收到该回调后,你即可调用 pushExternalEncodedVideoFrame:withEncodedVideoFrame:{@link #ByteRTCEngine#pushExternalEncodedVideoFrame:withEncodedVideoFrame:} 向 SDK 推送自定义编码视频帧 + * @param streamId 自定义编码流 ID + * @param info 自定义编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @list 自定义流处理 + */ + +- (void)onStart:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info; +@required +/** + * + * @type callback + * @brief 当收到该回调时,你需停止向 SDK 推送自定义编码视频帧 + * @param streamId 自定义编码流 ID + * @param info 自定义编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @list 自定义流处理 + */ + +- (void)onStop:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info; +@required +/** + * + * @type callback + * @brief 当自定义编码流的帧率或码率发生变化时,触发该回调 + * @param streamId 远端编码流 ID + * @param info 远端编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoIndex 对应编码流的下标 + * @param fps 变化后的帧率,单位:fps + * @param bitRateKps 变化后的码率,单位:kbps + * @list 自定义流处理 + */ + +- (void)onRateUpdate:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withVideoIndex:(NSInteger)videoIndex + withFps:(NSInteger)fps + withBitRate:(NSInteger)bitRateKps; +@required +/** + * + * @type callback + * @brief 提示流发布端需重新生成关键帧的回调 + * @param streamId 远端编码流 ID + * @param info 远端编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoIndex 对应编码流的下标 + * @list 自定义流处理 + */ + +- (void)onRequestKeyFrame:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withVideoIndex:(NSInteger)videoIndex; +@required +/** + * + * @valid since 3.56 + * @type callback + * @brief 作为自定义编码视频流的发送端,你会在视频流可发送状态发生变化时,收到此回调。
    + * 你可以根据此回调的提示,仅对可发送的视频流进行编码,以降低本端视频编码性能消耗。此回调会根据多个因素综合判断触发,包括:本端设备性能和本端网络性能,以及按需订阅场景下,远端用户是否订阅。 + * @param streamId 自定义编码流 ID + * @param info 自定义编码流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoIndex 对应编码流的下标 + * @param active 该路流可发送状态 + * @note 要收到此回调,必须调用 setVideoSourceType:{@link #ByteRTCEngine#setVideoSourceType:} 设置视频源是自定义编码,且通过 setExternalVideoEncoderEventHandler:{@link #ByteRTCEngine#setExternalVideoEncoderEventHandler:} 设置了回调句柄。 + * @list 自定义流处理 + */ + +- (void)onActiveVideoLayer:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withVideoIndex:(NSInteger)videoIndex + withActive:(BOOL)active; +@end + +#pragma mark - ByteRTCEngineRemoteEncodedVideoFrameObserver +/** + * + * @type callback + * @brief 远端编码后视频数据监测器 + * @note 回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频管理 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCRemoteEncodedVideoFrameObserver +@required +/** + * + * @type callback + * @brief 调用 registerRemoteEncodedVideoFrameObserver:{@link #ByteRTCEngine#registerRemoteEncodedVideoFrameObserver:} 后,SDK 监测到远端编码后视频数据时,触发该回调 + * @param streamId 收到的远端流 ID + * @param info 收到的远端流信息,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo} + * @param videoFrame 收到的远端视频帧信息,参看 ByteRTCEncodedVideoFrame{@link #ByteRTCEncodedVideoFrame} + * @list 自定义流处理 + */ + +- (void)onRemoteEncodedVideoFrame:(NSString*)streamId info:(ByteRTCStreamInfo * _Nonnull)info + withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame; +@end + +/** + * + * @type keytype + * @brief 视频帧基础信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoFrameInfo : NSObject +/** + * + * @brief 视频帧的宽度(像素) + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 视频帧的高度(像素) + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 视频帧顺时针旋转角度。参看 ByteRTCVideoRotation{@link #ByteRTCVideoRotation}。 + */ + +@property(nonatomic, assign) ByteRTCVideoRotation rotation; +@end + +#pragma mark - ByteRTCPushMixedStreamToCDNObserver +/** + * + * @hidden for internal use only + * @type callback + * @brief 转推直播观察者。(Valid from 352.1)
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list CDN 推流 + */ + +@protocol ByteRTCClientMixedStreamDelegate +/** + * + * @hidden for internal use only + */ + +@optional +- (void)onClientMixedStreamEvent:(ByteRTCMixedStreamTaskEvent)event withTaskInfo:(ByteRTCMixedStreamTaskInfo*)info withMixedType:(ByteRTCMixedStreamType)type withErrorCode:(ByteRTCMixedStreamTaskErrorCode)errorCode; +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流音频首帧回调 + * @param taskID 任务 ID + * @list CDN 推流 + */ + +- (void)onMixedFirstAudioFrame:(NSString *)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 客户端合流视频首帧回调 + * @param taskID 任务 ID + * @list CDN 推流 + */ + + - (void)onMixedFirstVideoFrame:(NSString *)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 端云一体合流音频 PCM 回调 + * @param audioFrame PCM 编码的合流音频数据帧,参看 ByteRTCAudioFrame{@link #ByteRTCAudioFrame}。 + * @param timeStamp 时间戳,单位毫秒。 + * @param taskId 转推直播任务 ID。 + * @note 收到该回调的周期为每 10 毫秒一次,并且每次的音频数据量为 10 毫秒数据量。 + * @list CDN 推流 + */ + +- (void)onMixedAudioFrame:(ByteRTCAudioFrame *_Nonnull)audioFrame withTimestamp:(int64_t)timeStamp withTaskId:(NSString *_Nonnull)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 端云一体合流视频 YUV 回调 + * @param videoFrame YUV 合流视频数据帧,参看 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @param taskId 转推直播任务 ID。 + * @note 收到该回调的周期取决于视频的帧率。 + * @list CDN 推流 + */ + +- (void)onMixedVideoFrame:(id_Nonnull)videoFrame withTaskId:(NSString *_Nonnull)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 端云一体合流视频 SEI 数据 + * @param dataFrame SEI 数据,详见 ByteRTCFrameExtendedData {@link #ByteRTCFrameExtendedData}。 + * @param taskId 转推直播任务 ID。 + * @list CDN 推流 + */ + +- (void)onMixedDataFrame:(ByteRTCFrameExtendedData *_Nonnull)dataFrame withTaskId:(NSString *_Nonnull)taskId; +/** + * + * @hidden for internal use only + * @type callback + * @brief 同步视频帧回调。 + * @param videoFrame 同步视频帧数组,与 uids 对应。 + * @param dataFrame SEI 数据。 + * @param uids 同步视频帧对应的 uid 数组。 + * @param task_id 转推直播任务 ID。 + * @list CDN 推流 + */ + +- (void)onCacheSyncVideo:(NSArray> *_Nonnull)videoFrames withDataFrame:(NSArray *_Nonnull)dataFrames + withUids:(NSArray*_Nonnull)uids taskId:(NSString *_Nonnull)taskId; +@end +/** + * + * @type callback + * @brief 人脸检测结果回调观察者
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list 视频处理 + */ + +@protocol ByteRTCFaceDetectionObserver +/** + * + * @type callback + * @brief 特效 SDK 进行人脸检测结果的回调。
    + * 调用 enableFaceDetection:withInterval:withModelPath:{@link #ByteRTCVideoEffect#enableFaceDetection:withInterval:withModelPath:} 注册了 ByteRTCFaceDetectionObserver{@link #ByteRTCFaceDetectionObserver} ,并使用 RTC SDK 中包含的特效 SDK 进行视频特效处理时,你会收到此回调。 + * @param result 人脸检测结果, 参看 ByteRTCFaceDetectionResult{@link #ByteRTCFaceDetectionResult}。 + * @list 视频管理 + */ + +- (void)onFaceDetectResult:(ByteRTCFaceDetectionResult * _Nonnull)result; +/** + * + * @hidden for intrnal use only + * @type callback + * @brief 特效 SDK 进行人像属性检测结果的回调。
    + * 调用 registerFaceDetectionObserver:withInterval: 注册了 ByteRTCFaceDetectionObserver{@link #ByteRTCFaceDetectionObserver},并调用 setVideoEffectExpressionDetect:{@link #ByteRTCVideoEffect#setVideoEffectExpressionDetect:} 开启人像属性检测后,你会收到此回调。 + * @param result 人像属性检测结果, 参看 ByteRTCExpressionDetectResult{@link #ByteRTCExpressionDetectResult}。 + * @list 视频处理 + */ + +- (void)onExpressionDetectResult:(ByteRTCExpressionDetectResult * _Nonnull)result; +@end + +#pragma mark - ByteRTCEngineMediaMetadataObserver +/** + * + * @hidden + * @deprecated since 3.26 and will be deleted in 3.51, use sendSEIMessage:andRepeatCount:andCountPerFrame:{@link #ByteRTCEngine#sendSEIMessage:andRepeatCount:andCountPerFrame:} instead. + * @type callback + * @brief 使用内部源视频采集时,配置和获取附加数据接口 + * @list Video Processing + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCMediaMetadataObserver +@required +/** + * + * @type callback + * @brief 当 SDK 准备发送一个视频帧时,会回调该接口,以确定是否需要在该视频帧中添加 metadata + * @param timestamp 待添加 metadata 视频帧的时间戳,单位微秒 + * @return 待发送的数据,大小不能超过 1024bytes + * @note + * - 返回 null 代表不需要添加 metadata + * - 回调中不能做长时间逻辑处理,以免影响视频卡顿 + * @list 自定义流处理 + */ + +- (NSData *_Nullable)videoFrameMediaMetaDataAtTime:(NSTimeInterval)timestamp; + +@optional +/** + * + * @type callback + * @brief 当 SDK 收到的视频帧包含 medatada 时,会回调该接口 + * @param uid 当前帧所属的用户 ID + * @param extendedData metadata + * @param timestamp 包含 metadata 视频帧的时间戳,单位为微秒 + * @note 回调中不能做长时间逻辑处理,以免影响视频卡顿 + * @list 自定义流处理 + */ + +- (void)receiveVideoFrameFromUID:(NSString * _Nonnull)uid + withExtendedData:(NSData* _Nullable)extendedData atTimestamp:(NSTimeInterval)timestamp; +@end +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension120x120; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension160x120; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension180x180; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension240x180; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension320x180; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension240x240; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension320x240; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension424x240; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension360x360; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension480x360; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension640x360; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension480x480; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension640x480; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension840x480; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension960x540; +/** + * + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension960x720; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension1280x720; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension1920x1080; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension2540x1440; +/** + * + * @brief 1920 x 1080 (Depends on the hardware) + * @hidden constructor/destructor + */ + +extern CGSize const ByteRTCVideoDimension3840x2160; +/** + * + * @type keytype + * @brief 视频编码配置。参考 [设置视频发布参数](https: + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoEncoderConfig: NSObject +/** + * + * @brief 视频宽度,单位:px + */ + +@property(nonatomic, assign) NSInteger width; +/** + * + * @brief 视频高度,单位:px + */ + +@property(nonatomic, assign) NSInteger height; +/** + * + * @brief 视频帧率,单位:fps + */ + +@property(nonatomic, assign) NSInteger frameRate; +/** + * + * @brief 最大编码码率,使用 SDK 内部采集时可选设置,自定义采集时必须设置,单位:kbps。
    + * 设为 -1 即适配码率模式,系统将根据输入的分辨率和帧率自动计算适用的码率。
    + * 设为 0 则不对视频流进行编码发送。
    + * 344 及以上版本,内部采集时默认值为 -1,344 以前版本无默认值,需手动设置。 + */ + +@property(nonatomic, assign) NSInteger maxBitrate; +/** + * + * @brief 视频最小编码码率, 单位 kbps。编码码率不会低于 `minBitrate`。
    + * 默认值为 `0`。
    + * 范围:[0, maxBitrate),当 `maxBitrate` < `minBitrate` 时,为适配码率模式。
    + * 以下情况,设置本参数无效:
    + * - 当 `maxBitrate` 为 `0` 时,不对视频流进行编码发送。 + * - 当 `maxBitrate` < `0` 时,适配码率模式。 + */ + +@property(nonatomic, assign) NSInteger minBitrate; +/** + * + * @brief 关键帧间隔,单位:毫秒,默认值为 `0` + */ + +@property(nonatomic, assign) NSInteger keyFrameIntervalMS; +/** + * + * @brief 编码策略偏好,默认为帧率优先。参看 ByteRTCVideoEncoderPreference{@link #ByteRTCVideoEncoderPreference}。 + */ + +@property(nonatomic, assign) ByteRTCVideoEncoderPreference encoderPreference; +@end + +/** + * + * @type keytype + * @brief 远端视频帧信息 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRemoteVideoConfig : NSObject +/** + * + * @brief 期望订阅的最高帧率,单位:fps,默认值为 0 即满帧订阅,设为大于 0 的值时开始生效。
    + * 如果发布端发布帧率 > 订阅端订阅的帧率,下行媒体服务器 SVC 丢帧,订阅端收到通过此接口设置的帧率;如果发布端发布帧率 < 订阅端订阅的帧率,则订阅端只能收到发布的帧率。
    + * 仅码流支持 SVC 分级编码特性时方可生效。 + */ + +@property (nonatomic, assign) int framerate; +/** + * + * @brief 视频宽度,单位:px + */ + +@property(nonatomic, assign) int width; +/** + * + * @brief 视频高度,单位:px + */ + +@property(nonatomic, assign) int height; +@end +/** + * + * @type keytype + * @brief 房间参数配置 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCRoomConfig : NSObject +/** + * + * @brief 房间模式,参看 ByteRTCRoomProfile{@link #ByteRTCRoomProfile},默认为普通音视频通话模式,进房后不可更改。 + */ + +@property(nonatomic) ByteRTCRoomProfile profile; + +/** + * + * @brief 直播模式,参看 ByteRTCRoomLiveMode{@link #ByteRTCRoomLiveMode},默认为 `ByteRTCRoomLiveModeCoHost`,进房后可通过 setLiveMode:{@link #ByteRTCRoom#setLiveMode:} 设置。 + * @note 只有当`room_profile_type`为`ByteRTCRoomProfileTypeLive`时,`live_mode`的值才有效。 + */ + +@property(nonatomic) ByteRTCRoomLiveMode liveMode; + +/** + * + * @brief 流 ID,默认为空。 + */ + +@property(nonatomic) NSString * streamId; + /** + * + * @brief 是否自动发布音频流,默认为自动发布。 + * + 若调用 `setUserVisibility` 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + +@property(assign, nonatomic) BOOL isPublishAudio; + /** + * + * @brief 是否自动发布视频流,默认为自动发布。
    + * + 若调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility:} 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。 + * + 多房间场景下,若已在其中一个房间成功设置了自动发布,其他房间的自动发布设置均不会生效。若每个房间均不做设置,则默认在第一个加入的房间内自动发布流。 + */ + +@property(assign, nonatomic) BOOL isPublishVideo; +/** + * + * @brief 是否自动订阅音频流,默认为自动订阅。 + */ + +@property(assign, nonatomic) BOOL isAutoSubscribeAudio; +/** + * + * @brief 是否自动订阅主视频流,默认为自动订阅。 + */ + +@property(assign, nonatomic) BOOL isAutoSubscribeVideo; +@end + +/** + * + * @type keytype + * @brief 水印图片相对视频流的位置和大小。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoByteWatermark: NSObject +/** + * + * @brief 水印图片相对视频流左上角的横向偏移与视频流宽度的比值,取值范围为 [0,1)。 + */ + +@property(assign, nonatomic) float x; +/** + * + * @brief 水印图片相对视频流左上角的纵向偏移与视频流高度的比值,取值范围为 [0,1)。 + */ + +@property(assign, nonatomic) float y; +/** + * + * @brief 水印图片宽度与视频流宽度的比值,取值范围 [0,1)。 + */ + +@property(assign, nonatomic) float width; +/** + * + * @brief 水印图片高度与视频流高度的比值,取值范围为 [0,1)。 + */ + +@property(assign, nonatomic) float height; +@end + +/** + * + * @type keytype + * @brief 水印参数 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoWatermarkConfig: NSObject +/** + * + * @brief 水印是否在视频预览中可见,默认可见。 + */ + +@property(nonatomic, assign) BOOL visibleInPreview; +/** + * + * @brief 横屏时的水印位置和大小,参看 ByteRTCVideoByteWatermark{@link #ByteRTCVideoByteWatermark}。 + */ + +@property(strong, nonatomic) ByteRTCVideoByteWatermark * _Nonnull positionInLandscapeMode; +/** + * + * @brief 竖屏时的水印位置和大小,参看 ByteRTCVideoByteWatermark{@link #ByteRTCVideoByteWatermark}。 + */ + +@property(strong, nonatomic) ByteRTCVideoByteWatermark * _Nonnull positionInPortraitMode; +@end +/** + * + * @hidden(iOS) + * @type api + * @brief 主要用于枚举、设置视频采集设备 + * @list 视频管理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoDeviceManager : NSObject +/** + * + * @type api + * @brief 获取视频采集设备列表。 + * @return 包含系统中所有视频采集设备的列表,参看 ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}。
    + * 等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 监听到 `ByteRTCMediaDeviceListUpdated` 后,再次调用本接口获取。 + * @note 你可以在收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error:} 了解设备变更后,重新调用本接口以获得新的设备列表。 + * @list 视频管理 + */ + +- (ByteRTCDeviceCollection * _Nonnull)enumerateVideoCaptureDevices; +/** + * + * @type api + * @brief 获取当前 SDK 正在使用的视频采集设备信息 + * @param deviceID 视频设备 ID + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + +- (int)getVideoCaptureDevice:(NSString * _Nonnull * _Nonnull) deviceID; +/** + * + * @type api + * @brief 设置当前视频采集设备 + * @param deviceID 视频设备 ID。调用 enumerateVideoCaptureDevices{@link #ByteRTCVideoDeviceManager#enumerateVideoCaptureDevices} 获取全量视频设备。 + * @return + * - 0:方法调用成功 + * - !0:方法调用失败 + * @list 视频管理 + */ + +- (int)setVideoCaptureDevice:(NSString* _Nonnull)deviceID; +@end +/** + * + * @type callback + * @brief 截取视频画面回调类
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + * @list Video Management + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCVideoSnapshotCallbackDelegate +@required +/** + * + * @type callback + * @brief 调用 takeLocalSnapshot:{@link #ByteRTCEngine#takeLocalSnapshot:} 截取视频画面时,收到此回调。 + * @param taskId 本地截图任务的编号。和 takeLocalSnapshot:{@link #ByteRTCEngine#takeLocalSnapshot:} 的返回值一致。 + * @param videoSource 预留参数 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param errorCode 截图错误码:
    + * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + +- (void)onTakeLocalSnapshotResult:(NSInteger) taskId + videoSource:(ByteRTCVideoSource * _Nullable)videoSource + image:(ByteRTCImage * _Nullable)image + errorCode:(NSInteger)errorCode; +/** + * + * @type callback + * @brief 调用 takeRemoteSnapshot:callback:{@link #ByteRTCEngine#takeRemoteSnapshot:callback:} 截取视频画面时,收到此回调。 + * @param taskId 远端截图任务的编号。和 takeRemoteSnapshot:callback:{@link #ByteRTCEngine#takeRemoteSnapshot:callback:} 的返回值一致。 + * @param streamId 远端视频流的 ID。 + * @param info 远端视频流的属性,参看 ByteRTCStreamInfo{@link #ByteRTCStreamInfo}。 + * @param image 截图。你可以保存为文件,或对其进行二次处理。截图失败时,为空。 + * @param errorCode 截图错误码:
    + * - 0: 成功 + * - -1: 截图错误。生成图片数据失败或 RGBA 编码失败 + * - -2: 截图错误。流无效。 + * - -3: 截图错误。截图超时,超时时间 1 秒。 + * @list 高级功能 + */ + +- (void)onTakeRemoteSnapshotResult:(NSInteger)taskId + streamId:(NSString*)streamId + info:(ByteRTCStreamInfo * _Nonnull)info + image:(ByteRTCImage * _Nullable)image + errorCode:(NSInteger)errorCode; +@end +/** + * + * @type api + * @brief 高级视频特效,参看[集成指南](https: + * @list 视频处理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoEffect : NSObject +/** + * + * @hidden for internal use only + * @type api + * @brief 设置视频特效算法模型地址,并初始化特效模块。 + * @param finder ResourceFinder 地址 + * @param deleter ResourceDeleter 地址 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + +- (int) setAlgoModelResourceFinder:(void*_Nonnull)finder deleter:(void*_Nonnull)deteter; + +/** + * + * @type api + * @brief 从特效 SDK 获取授权消息,用于获取在线许可证。 + * @param ppmsg 授权消息字符串地址 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 使用视频特效的功能前,你必须获取特效 SDK 的在线许可证。 + * - 通过此接口获取授权消息后,参考 [在线授权说明](https: + * @list 视频处理 + */ + +- (int)getAuthMessage:(NSString *_Nullable*_Nullable)ppmsg; +/** + * + * @type api + * @brief 检查视频特效证书,设置算法模型路径,并初始化特效模块。 + * @param licenseFile 证书文件的绝对路径,用于鉴权。 + * @param algoModelDir 算法模型绝对路径,即存放特效 SDK 所有算法模型的目录。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 鉴权时,会检查 CV 服务端时间和本地设备的时间差异。你必须保证本地系统时间和实际时间一致。 + * @list 视频处理 + */ + +- (int) initCVResource:(NSString* _Nonnull)licenseFile + withAlgoModelDir: (NSString* _Nonnull)algoModelDir; +/** + * + * @type api + * @brief 开启高级美颜、滤镜等视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource:withAlgoModelDir:{@link #ByteRTCVideoEffect#initCVResource:withAlgoModelDir:} 进行初始化。 + * - 调用该方法后,特效不直接生效,你还需调用 setEffectNodes:{@link #ByteRTCVideoEffect#setEffectNodes:} 设置视频特效素材包或调用 setColorFilter:{@link #ByteRTCVideoEffect#setColorFilter:} 设置滤镜。 + * - 调用 disableVideoEffect{@link #ByteRTCVideoEffect#disableVideoEffect} 关闭视频特效。 + * @list 视频处理 + */ + +- (int) enableVideoEffect; +/** + * + * @type api + * @brief 关闭视频特效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect} 开启视频特效。 + * @list 视频处理 + */ + +- (int) disableVideoEffect; +/** + * + * @hidden for internal use only + * @type api + * @brief 返回视频特效句柄。私有接口。 + * @list 视频处理 + */ + +- (void* _Nullable)getVideoEffectHandle; +/** + * + * @hidden for internal use only + * @type api + * @brief 私有接口
    + * 设置视频特效素材包 + * @param stickerPath 特效素材包绝对路径。
    + * 要取消当前视频特效,将此参数设置为 null。 + * @return + * - 0: 调用成功。 + * - 1000: 未集成特效 SDK。 + * - 1001: 特效 SDK 不支持该功能。 + * - < 0: 调用失败。具体错误码,参看 [错误码表](https: + * @note 在调用这个方法之前,你须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) applyStickerEffect:(NSString* _Nullable)stickerPath; +/** + * + * @hidden for internal use only + * @type api + * @brief 设置视频特效素材包。 + * @param effectPath 特效素材包绝对路径。 + * @return + * - 0: 调用成功。 + * - 1000: 未集成特效 SDK。 + * - 1001: 特效 SDK 不支持该功能。 + * - < 0: 调用失败。 + * @note 在调用这个方法之前,你须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) setEffect:(NSString* _Nullable)effectPath; +/** + * + * @hidden for internal use only + * @type api + * @brief 重置贴纸特效。 + * @return + * - 0: 调用成功。 + * - 1000: 未集成特效 SDK。 + * - 1001: 特效 SDK 不支持该功能。 + * - < 0: 调用失败。 + * @note 在调用这个方法之前,你须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) resetSticker; +/** + * + * @type api + * @brief 设置视频特效素材包。 + * @param effectNodes 特效素材包绝对路径数组。
    + * 要取消当前视频特效,将此参数设置为 null。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用本方法前,必须先调用 enableVideoEffect{@link #ByteRTCVideoEffect#enableVideoEffect}。 + * @list 视频处理 + */ + +- (int) setEffectNodes:(NSArray*_Nonnull)effectNodes; +/** + * + * @hidden for internal use only + * @type api + * @brief 叠加视频特效素材包。 + * @param effectNodes 特效素材包路径数组。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 该接口会在 setEffectNodes:{@link #ByteRTCVideoEffect#setEffectNodes:} 设置的特效基础上叠加特效。 + * @list Video Processing + */ + +- (int) appendEffectNodes:(NSArray*_Nonnull)effectNodes; +/** + * + * @hidden for internal use only + * @type api + * @brief 移除指定的视频特效资源。 + * @param effectNodes 特效素材包路径数组。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 移除 setEffectNodes:{@link #ByteRTCVideoEffect#setEffectNodes:} 或 appendEffectNodes:{@link #ByteRTCVideoEffect#appendEffectNodes:} 设置的视频特效资源。 + * @list Video Processing + */ + +- (int) removeEffectNodes:(NSArray*_Nonnull)effectNodes; +/** + * + * @type api + * @brief 设置特效强度。 + * @param node 特效素材包绝对路径,参考[素材包结构说明](https: + * @param key 需要设置的素材 key 名称,参考[素材 key 对应说明](https: + * @param value 特效强度值,取值范围 [0,1],超出范围时设置无效。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) updateEffectNode:(NSString* _Nonnull)node + key:(NSString* _Nonnull)key value:(float) value; +/** + * + * @type api + * @brief 设置颜色滤镜。 + * @param filterRes 滤镜资源包绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 setColorFilterIntensity:{@link #ByteRTCVideoEffect#setColorFilterIntensity:} 设置已启用颜色滤镜的强度。设置强度为 0 时即关闭颜色滤镜。 + * @list 视频处理 + */ + +- (int) setColorFilter:(NSString* _Nonnull)filterRes; +/** + * + * @type api + * @brief 设置已启用颜色滤镜的强度。 + * @param intensity 滤镜强度。取值范围 [0,1],超出范围时设置无效。
    + * 当设置滤镜强度为 0 时即关闭颜色滤镜。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) setColorFilterIntensity:(float) intensity; +/** + * + * @type api + * @brief 将摄像头采集画面中的人像背景替换为指定图片或纯色背景。 + * @param backgroundStickerPath 背景贴纸特效素材绝对路径。 + * @param source 背景贴纸对象,参看 ByteRTCVirtualBackgroundSource{@link #ByteRTCVirtualBackgroundSource}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note + * - 调用本方法前,必须先调用 initCVResource:withAlgoModelDir:{@link #ByteRTCVideoEffect#initCVResource:withAlgoModelDir:} 进行初始化。 + * - 调用 disableVirtualBackground{@link #ByteRTCVideoEffect#disableVirtualBackground} 关闭虚拟背景。 + * @list 视频处理 + */ + +- (int) enableVirtualBackground:(NSString* _Nonnull)backgroundStickerPath + withSource:(ByteRTCVirtualBackgroundSource* _Nonnull)source; +/** + * + * @type api + * @brief 关闭虚拟背景。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @note 调用 enableVirtualBackground:withSource:{@link #ByteRTCVideoEffect#enableVirtualBackground:withSource:} 开启虚拟背景后,可以调用此接口关闭虚拟背景。 + * @list 视频处理 + */ + +- (int) disableVirtualBackground; +/** + * + * @hidden for internal use only + * @type api + * @brief 开启人像属性检测。 + * @param config 人像属性检测参数,参看 ByteRTCExpressionDetectConfig{@link #ByteRTCExpressionDetectConfig}。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list Video Processing + */ + +- (int) setVideoEffectExpressionDetect:(ByteRTCExpressionDetectConfig* _Nonnull)config; +/** + * + * @type api + * @brief 开启人脸识别功能,并设置人脸检测结果回调观察者。
    + * 回调此观察者后,你会周期性收到 onFaceDetectResult:{@link #ByteRTCFaceDetectionObserver#onFaceDetectResult:} 回调。 + * @param observer 人脸检测结果回调观察者,参看 ByteRTCFaceDetectionObserver{@link #ByteRTCFaceDetectionObserver}。 + * @param interval 两次回调之间的最小时间间隔,必须大于 0,单位为毫秒。实际收到回调的时间间隔大于 interval,小于 interval+视频采集帧间隔。 + * @param path 人脸检测算法模型文件路径,一般为 ttfacemodel 文件夹中 tt_face_vXXX.model 文件的绝对路径。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - -1004: 初始化中,初始化完成后启动此功能。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) enableFaceDetection:(_Nullable id) observer + withInterval:(NSUInteger)interval + withModelPath:(NSString* _Nonnull)path; +/** + * + * @type api + * @brief 关闭人脸识别功能。 + * @return + * - 0: 调用成功。 + * - –1000: 未集成特效 SDK。 + * - –1001: 特效 SDK 不支持该功能。 + * - –1002: 特效 SDK 版本不兼容。 + * - < 0: 调用失败,错误码对应具体描述参看 [错误码表](https: + * @list 视频处理 + */ + +- (int) disableFaceDetection; +@end + + +/** + * + * @type keytype + * @brief RTC 智能决策后得到的帧率和分辨率积(宽*高)。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCFrameUpdateInfo : NSObject +/** + * + * @brief 分辨率积(宽*高)。 + */ + +@property(assign, nonatomic) int pixel; +/** + * + * @brief 帧率。 + */ + +@property(assign, nonatomic) int framerate; +@end +/** + * + * @hidden(macOS) + * @type keytype + * @brief 蜂窝网络辅助增强应用的媒体模式 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCMediaTypeEnhancementConfig: NSObject +/** + * + * @brief 对信令消息,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceSignaling; +/** + * + * @brief 对屏幕共享以外的其他音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceAudio; +/** + * + * @brief 对屏幕共享视频以外的其他视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceVideo; +/** + * + * @brief 对屏幕共享音频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceScreenAudio; +/** + * + * @brief 对屏幕共享视频,是否启用蜂窝网络辅助增强。默认不启用。 + */ + +@property (assign, nonatomic) BOOL enhanceScreenVideo; +@end + +/** +* +* @hidden internal use only +* @type keytype +* @brief 缓存同步模式。 +*/ + +typedef NS_ENUM(NSUInteger, ByteRTCChorusCacheSyncMode) { + /** + * + * @brief 合唱场景下,主唱应采用此模式,以发送带时间戳信息的媒体数据。 + */ + + ByteRTCChorusCacheSyncModeProducer= 0, + /** + * + * @brief 合唱场景下,副唱应采用此模式。
    + * 此模式下,副唱收到来自主唱的带时间戳的媒体数据。副唱发送的媒体数据中带有来自主唱的时间戳。 + */ + + ByteRTCChorusCacheSyncModeRetransmitter= 1, + /** + * + * @brief 合唱场景下,听众应采用此模式。
    + * 此模式下,听众收到来自主唱的时间戳,并据此对齐来自主唱和副唱的媒体数据,以获得良好的合唱播放效果。 + */ + + ByteRTCChorusCacheSyncModeConsumer = 2 +}; + +/** + * + * @type keytype + * @hidden for internal use + * @brief 合唱缓存同步事件。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCChorusCacheSyncEvent) { + /** + * + * @brief 成功。 + */ + + ByteRTCChorusCacheSyncEventStartSuccess = 0, + /** + * + * @brief 失败。 + */ + + ByteRTCChorusCacheSyncEventStartFailed = 1, +}; + +/** + * + * @hidden for internal use only + * @type errorcode + * @brief 缓存同步错误码。 + */ + +typedef NS_ENUM(NSUInteger, ByteRTCChorusCacheSyncError) { + /** + * + * @brief 成功。 + */ + + ByteRTCChorusCacheSyncErrorOK = 0, + /** + * + * @brief 失败。推送至 CDN 时,应进行以下设置:
    + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.enable_sync = true`; + * - `IMixedStreamConfig.MixedStreamSyncControlConfig.base_user_id = {uid of producer}`。 + */ + + ByteRTCChorusCacheSyncErrorWrongState = 1, + /** + * + * @brief 缓存同步功能已启动,不需要重复开启。 + */ + + ByteRTCChorusCacheSyncErrorAlreadyRunning = 2 +}; + +/** + * + * @hidden for internal use only + * @type keytype + * @brief 缓存同步配置。 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCChorusCacheSyncConfig: NSObject +/** + * + * @brief 最大媒体缓存时长(ms)。
    + * 取值范围是 `[500, 2500]`,默认值是 `2000`。
    + * 值越大,同步效果越好,但会造成占用内存较大。如果参与缓存同步的各路媒体流之间的时间差超过此值,会造成丢帧。 + */ + +@property(assign, nonatomic) int maxCacheTimeMs; +/** + * + * @brief 模式。参看 ByteRTCChorusCacheSyncMode{@link #ByteRTCChorusCacheSyncMode}. 默认值是 `retransmitter`。 + */ + +@property (assign, nonatomic) ByteRTCChorusCacheSyncMode mode; +/** + * + * @brief 收到 onSyncedVideoFrames:withUids:{@link #ByteRTCChorusCacheSyncObserver#onSyncedVideoFrames:withUids:} 的频率。
    + * 默认值是 `15`。此值通常应小于等于原始视频帧率;如果大于原始视频帧率,可能会收到重复帧。 + */ + +@property(assign, nonatomic) int videoFps; +@end +/** + * + * @hidden for internal use only + * @type callback + * @brief 缓存同步 Observer + * @list Video Processing + */ + +@protocol ByteRTCChorusCacheSyncObserver +/** + * + * @type callback + * @brief 调用 startChorusCacheSync:observer:{@link #ByteRTCEngine#startChorusCacheSync:observer:},并设置为 `consumer` 的用户会通过此回调获取经缓存同步后的视频帧。获取频率通过启动同步时的 `fps` 进行设置。 + * @param videoFrames 对应 `uids` 的视频帧。参看 ByteRTCVideoFrame{@link #ByteRTCVideoFrame}。 + * @param uids 参与合唱缓存同步的 `producer` 和 `retransmitter` 的列表,不包括参与但未发送媒体数据的用户。 + * @list Video Processing + */ + +- (void)onSyncedVideoFrames:(NSArray>*)videoFrames withUids:(NSArray*)uids; +/** + * + * @type callback + * @brief 参与合唱缓存同步的 `producer` 和 `retransmitter` 发生变化时,收到此回调。 + * @param uids 当前的参与者列表 + * @note 有以下情况可能造成参与者发生变化:
    + * - 用户主动调用 startChorusCacheSync:observer:{@link #ByteRTCEngine#startChorusCacheSync:observer:} 或 stopChorusCacheSync{@link #ByteRTCEngine#stopChorusCacheSync}; + * - 原本参与缓存同步的用户发生异常退出。 + * @list Video Processing + */ + +- (void)onSyncedUsersChanged:(NSArray*)uids; +/** + * + * @type callback + * @brief 缓存同步事件回调 + * @param event 事件,参看 ByteRTCChorusCacheSyncEvent{@link #ByteRTCChorusCacheSyncEvent}。 + * @param error 错误码,参看 ByteRTCChorusCacheSyncError{@link #ByteRTCChorusCacheSyncError}。 + * @list Video Processing + */ + +- (void)onSyncEvent:(ByteRTCChorusCacheSyncEvent)event withError:(ByteRTCChorusCacheSyncError)error; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefinesEx.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefinesEx.h new file mode 100644 index 0000000..6e81f64 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCVideoDefinesEx.h @@ -0,0 +1,167 @@ +#import "ByteRTCDefines.h" +/** + * + * @type keytype + * @brief 视频内容类型 + */ +typedef NS_ENUM(NSUInteger, ByteRTCVideoContentCategory) { + /** + * + * @brief 相机采集的内容 + */ + ByteRTCVideoContentCategoryCamera = 0, + /** + * + * @brief 屏幕共享的内容 + */ + ByteRTCVideoContentCategoryScreen = 1, +}; + +/** + * + * @type keytype + * @brief 视频源设置 + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCVideoSourceConfig : NSObject +/** + * + * @brief 视频源类型。参看 ByteRTCVideoSourceType{@link #ByteRTCVideoSourceType}。默认是 `kVideoSourceTypeExternal`。 + */ +@property (assign, nonatomic) ByteRTCVideoSourceType sourceType; +/** + * + * @brief 参看 ByteRTCVideoContentCategory{@link #ByteRTCVideoContentCategory}。默认是 `kVideoContentCategoryCamera`。 + */ +@property (assign, nonatomic) ByteRTCVideoContentCategory contentCategory; +@end + + +/** + * + * @type keytype + * @brief 媒体流的优先级 + */ +typedef NS_ENUM(NSUInteger, ByteRTCStreamPriority) { + /** + * + * @brief 低优先级 + */ + ByteRTCStreamPriorityLow = 0, + /** + * + * @brief 中优先级 + */ + ByteRTCStreamPriorityNormal = 1, + /** + * + * @brief 高优先级 + */ + ByteRTCStreamPriorityHigh = 2, +}; + +/** + * + * @type keytype + * @brief 音频源包含的内容 + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioContentTypeConfig : NSObject +/** + * + * @brief 包含麦克风采集的音频 + */ +@property(assign, nonatomic) BOOL hasMic; +/** + * + * @brief 包含屏幕音频 + */ +@property(assign, nonatomic) BOOL hasScreenAudio; +/** + * + * @brief 包含媒体播放器的音频 + */ +@property(assign, nonatomic) BOOL hasMediaPlayer; +@end + +/** + * + * @type keytype + * @brief 音频编码设置。 + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCAudioEncodeConfig : NSObject +/** + * + * @brief 编码器类型。
    + * + 0:OPUS
    + * + 1:NICO
    + * + -1:配置下发的配置 + */ +@property(nonatomic, assign) NSInteger codecType; +/** + * + * @brief 编码模式
    + * + 0:语音
    + * + 1:音乐
    + * + -1:根据 `channel_num` 不同,使用对应的编码模式。声道数为 `1` 时,编码模式是语音;声道数为 `2` 时,编码模式是音乐。 + */ +@property(nonatomic, assign) NSInteger encMode; +/** + * + * @brief 声道数。取值范围是:`{1, 2}`。默认值是 `-1`,配置下发的配置。 + */ +@property(nonatomic, assign) NSInteger channelNum; +/** + * + * @brief 码率。取值范围:`[6K, 510K]`。 + */ +@property(nonatomic, assign) NSInteger encBitrate; +/** + * + * @brief 是否启用非连续传输功能(DTX)。非连续传输功能能够在安静的场景下降低码率。
    + * + 0:关闭
    + * + 1:打开
    + * + -1:配置下发的配置 + */ +@property(nonatomic, assign) NSInteger useDtx; +/** + * + * @brief 带内前向纠错功能。能够提供一定的抗丢包能力。
    + * + 0:关闭
    + * + 1:打开
    + * + -1:配置下发的配置 + */ +@property(nonatomic, assign) NSInteger useInbandfec; +/** + * + * @brief 采样率。取值范围是 `[16K, 48K]`。
    + * 修改此参数会触发编码器重启。 + */ +@property(nonatomic, assign) NSInteger sampleRate; +/** + * + * @brief 编码帧长。取值范围:`{10, 20, 40, 60, 120}`。 + */ +@property(nonatomic, assign) NSInteger packetSize; +@end + +/** + * + * @type keytype + * @brief + */ +BYTERTC_APPLE_EXPORT @interface ByteRTCStreamKey : NSObject +/** + * + * @brief 用户 ID + */ +@property(nonatomic, copy, nullable) NSString *userId; +/** + * + * @brief 房间 ID + */ +@property(nonatomic, copy, nullable) NSString *roomId; +/** + * + * @brief 流属性,包括主流、屏幕流。参看 [StreamIndex](70083#StreamIndex-2) + */ +@property(nonatomic, assign) ByteRTCStreamIndex streamIndex; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCWTNStream.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCWTNStream.h new file mode 100644 index 0000000..9e8dd22 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTCWTNStream.h @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2021 The VolcEngineRTC project authors. All Rights Reserved. + * @brief ByteRTCWTNStream +*/ + +#import +#import "ByteRTCVideoDefines.h" +/** + * + * @type keytype + * @brief WTN 媒体流状态 + */ + +typedef NS_ENUM(NSInteger, ByteRTCWTNSubscribeState) { + /** + * + * @brief 订阅 WTN 媒体流 + */ + + ByteRTCWTNSubscribeStateSubscribe = 0, + /** + * + * @brief 取消订阅 WTN 媒体流 + */ + + ByteRTCWTNSubscribeStateUnsubscribe = 1 +}; +/** + * + * @type keytype + * @brief WTN 媒体流订阅状态改变的原因 + */ + +typedef NS_ENUM(NSInteger, ByteRTCWTNSubscribeStateChangeReason) { + /** + * + * @brief 订阅 WTN 媒体流成功 + */ + + ByteRTCWTNSubscribeStateChangeReasonSubscribe = 0, + /** + * + * @brief 其他原因订阅失败 + */ + + ByteRTCWTNSubscribeStateChangeReasonUnsubscribe = 1300, + /** + * + * @brief 订阅失败,拉流时远端未发布 + */ + + ByteRTCWTNSubscribeStateChangeReasonRemotePublish = 1301, + /** + * + * @brief 订阅失败,超出单端订阅上限。一个引擎实例最多拉 5 路流。 + */ + + ByteRTCWTNSubscribeStateChangeReasonOverClientSubscribeStreamLimit = 1310, + /** + * + * @brief 订阅失败。超出单流订阅人数上限。该限制由 RTC 服务端决定。 + */ + + ByteRTCWTNSubscribeStateChangeReasonOverStreamSubscribeUserLimit = 1311, + /** + * + * @brief 订阅失败。超出单流订阅请求 QPS 上限。该限制由 RTC 服务端决定。 + */ + + ByteRTCWTNSubscribeStateChangeReasonOverStreamSubscribeRequestLimit = 1312 +}; + + +/** + * + * @type callback + * @brief WTN 事件回调接口。
    + * 注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。 + */ + +BYTERTC_APPLE_EXPORT @protocol ByteRTCWTNStreamDelegate +/** +* +* @type callback +* @valid since 3.60. +* @brief 通话中本地设备接收订阅的远端 WTN 视频流的流 ID 以及远端 WTN 视频流统计信息。 +* @param streamId WTN 流 ID +* @param videoStats 远端 WTN 视频流的统计信息,详见 ByteRTCRemoteVideoStats{@link #ByteRTCRemoteVideoStats}。 +* @list WTN +* @order 0 +*/ + +- (void)onWTNRemoteVideoStats:(NSString* _Nonnull)streamId + videoStats:(const ByteRTCRemoteVideoStats* _Nonnull)videoStats; +/** +* +* @type callback +* @valid since 3.60. +* @brief 通话中本地设备接收订阅的远端 WTN 音频流的流 ID 以及远端 WTN 音频流统计信息。 +* @param streamId WTN 流 ID +* @param audioStats 远端 WTN 音频流的统计信息,详见 ByteRTCRemoteAudioStats{@link #ByteRTCRemoteAudioStats}。 +* @list WTN +* @order 1 +*/ + +- (void)onWTNRemoteAudioStats:(NSString* _Nonnull)streamId + audioStats:(const ByteRTCRemoteAudioStats* _Nonnull)audioStats; + +/** +* +* @type callback +* @valid since 3.60. 自 3.60 起,该回调替代了 `rtcEngine:onPlayPublicStreamResult:errorCode:` 方法中的 WTN 视频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 +* @brief WTN 视频流订阅状态变化回调
    +* 通过 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:} 订阅 WTN 视频流后,可以通过本回调获取订阅结果。 +* @param streamId WTN 视频流的 ID +* @param state 视频流状态码,参看 ByteRTCWTNSubscribeState{@link #ByteRTCWTNSubscribeState}。 +* @param reason 订阅状态发生变化的原因,参看 ByteRTCWTNSubscribeStateChangeReason{@link #ByteRTCWTNSubscribeStateChangeReason}。 +* @list WTN +* @order 2 +*/ + + +- (void)onWTNVideoSubscribeStateChanged:(NSString *_Nonnull)streamId + state:(ByteRTCWTNSubscribeState)state reason:(ByteRTCWTNSubscribeStateChangeReason)reason; +/** +* +* @type callback +* @valid since 3.60. 自 3.60 起,该回调替代了 `rtcEngine:onPlayPublicStreamResult:errorCode:` 方法中的 WTN 音频流订阅状态变化通知功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 +* @brief WTN 音频流订阅状态变化回调
    +* 通过 subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:} 订阅 WTN 音频流后,可以通过本回调获取订阅结果。 +* @param streamId WTN 音频流的 ID +* @param state 音频流状态码,参看 ByteRTCWTNSubscribeState{@link #ByteRTCWTNSubscribeState}。 +* @param reason 订阅状态发生变化的原因,参看 ByteRTCWTNSubscribeStateChangeReason{@link #ByteRTCWTNSubscribeStateChangeReason}。 +* @list WTN +* @order 2 +*/ + +- (void)onWTNAudioSubscribeStateChanged:(NSString *_Nonnull)streamId + state:(ByteRTCWTNSubscribeState)state reason:(ByteRTCWTNSubscribeStateChangeReason)reason; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替代了 `onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief WTN 流的首帧视频解码成功
    + * 关于 订阅 WTN 流,详见 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:}。 + * @param streamId WTN 流 ID + * @param frameInfo 视频帧信息,参看 ByteRTCVideoFrameInfo{@link #ByteRTCVideoFrameInfo} + * @list WTN + * @order 4 + */ + +- (void)onWTNFirstRemoteVideoFrameDecoded:(NSString * _Nonnull)streamId withFrameInfo:(ByteRTCVideoFrameInfo * _Nonnull)frameInfo NS_SWIFT_NAME(onWTNFirstRemoteVideoFrameDecoded(streamId:withFrameInfo:)); + +/** +* +* @type callback +* @valid since 3.60. 自 3.60 起,该回调替代了 `rtcEngine:onFirstPublicStreamAudioFrame:`。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 +* @brief WTN 流的首帧音频解码成功
    +* 关于订阅 WTN 音频流,详见 subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:}。 +* @param streamId WTN 流 ID +* @list WTN +* @order 3 +*/ + +- (void)onWTNFirstRemoteAudioFrame:(NSString * _Nonnull)streamId; + +/** + * + * @type callback + * @valid since 3.60. 自 3.60 起,该回调替换了 `rtcEngine:onPublicStreamSEIMessageReceived:andMessage:andSourceType:` 来实现下述功能。如果你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此回调。 + * @brief 回调 WTN 流中包含的 SEI 信息。
    + * subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:}/subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:} 接口启动拉 WTN 音频/视频流功能后,通过此回调收到 WTN 流中的 SEI 消息。 + * @param streamId WTN 流 ID。 + * @param channelId SEI 消息通道 ID,取值范围 [0 - 255]。通过此参数,你可以为不同接受方设置不同的 ChannelID,这样不同接收方可以根据回调中的 ChannelID 选择应关注的 SEI 信息。 + * @param message 收到的 SEI 消息内容。
    + * 通过调用客户端 `sendPublicStreamSEIMessage` 插入的 SEI 信息。 + * 当 WTN 流中的多路视频流均包含有 SEI 信息:SEI 不互相冲突时,将通过多次回调分别发送;SEI 在同一帧有冲突时,则只有一条流中的 SEI 信息被透传并融合到 WTN 流中。 + * @note 通过 Open API 插入的自定义信息,应通过回调 onWTNDataMessageReceived:andMessage:andSourceType:{@link #ByteRTCWTNStreamDelegate#onWTNDataMessageReceived:andMessage:andSourceType:} 获取。 + * @list WTN + * @order 5 + */ + +- (void)onWTNSEIMessageReceived:(NSString* _Nonnull)streamId andChannelId:(int)channelId andMessage:(NSData* _Nonnull)message; + +/** + * + * @type callback + * @valid since 3.60. + * @brief 回调 WTN 流中包含的数据信息。
    + * 通过 subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:}/subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:} 订阅 WTN 流后,可以通过本回调获取 WTN 流中的数据消息,包括调用 Open API 发送的 SEI 消息和音量回调。 + * @param streamId WTN 流 ID + * @param message 收到的数据消息内容,如下:
    + * - 调用 WTN 流 OpenAPI 发送的自定义消息。 + * - 媒体流音量变化,需要通过 WTN 流 OpenAPI 开启回调。JSON 格式说明如下: + * {
    + * "Type" : "VolumeIndication", + * "VolumeInfos" : [ + * {
    + * "RoomId":"1000001", + * "UserId":"1000001", + * "StreamType":0, + * "LinearVolume":1 + * }
    + * @param sourceType 数据消息来源,参看 ByteRTCDataMessageSourceType{@link #ByteRTCDataMessageSourceType}。 + * @note 通过调用客户端 API 插入的 SEI 信息,应通过回调 onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage:} 获取。 + * @list WTN + */ + +- (void)onWTNDataMessageReceived:(NSString* _Nonnull)streamId andMessage:(NSData* _Nonnull)message andSourceType:(ByteRTCDataMessageSourceType)sourceType; + +@end + +/** + * + * @type api + * @region WTN + * @brief WTN 流处理 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCWTNStream :NSObject +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream:` 和 `stopPlayPublicStream:` 方法来订阅/取消订阅指定 WTN 视频流,如果你使用了这两个方法,请迁移至此接口。 + * @brief 订阅/取消订阅指定 WTN 视频流
    + * 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 视频流。 + * @param streamId WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 + * @param subscribe 是否订阅 WTN 流
    + * - true:订阅 + * - false:取消订阅 + * @return + * - 0: 成功。同时将收到 + onWTNAudioSubscribeStateChanged:state:reason:{@link #ByteRTCWTNStreamDelegate#onWTNAudioSubscribeStateChanged:state:reason:} 回调。 + * - !0: 失败。当参数不合法或参数为空,调用失败。 + * @note + * - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:}/subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 + * - 在调用本接口之前,建议先绑定渲染视图。 + * - 调用 setWTNRemoteVideoCanvas:withCanvas:{@link #ByteRTCWTNStream#setWTNRemoteVideoCanvas:withCanvas:} 绑定内部渲染视图 + * - 调用 setWTNRemoteVideoSink:withSink:withConfig:{@link #ByteRTCWTNStream#setWTNRemoteVideoSink:withSink:withConfig:} 绑定自定义渲染视图 + * - 调用本接口后,可以通过 onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:{@link #ByteRTCWTNStreamDelegate#onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:} 回调 WTN 视频流的首帧解码情况 + * - 调用本接口后,可以通过 onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage:} 回调 WTN 流中包含的 SEI 信息。 + * @list WTN + * @order 0 + */ + +- (int)subscribeWTNVideoStream:(NSString * _Nonnull)streamId subscribe:(bool)subscribe; + +/** +* +* @type api +* @valid since 3.60. 自 3.60 起,此接口替代了 `startPlayPublicStream:` 和 `stopPlayPublicStream:` 方法来订阅/取消订阅指定 WTN 音频流,如果你使用了这两个方法,请迁移至此接口。 +* @brief 订阅/取消订阅指定 WTN 音频流
    +* 无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 音频流。 +* @param streamId WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 +* @param subscribe 是否订阅 WTN 流
    +* - true:订阅 +* - false:取消订阅 +* @return +* - 0: 成功。同时将收到 onWTNVideoSubscribeStateChanged:state:reason:{@link #ByteRTCWTNStreamDelegate#onWTNVideoSubscribeStateChanged:state:reason:} 回调。 +* - !0: 失败。当参数不合法或参数为空,调用失败。 +* @note +* - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe:}/subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe:} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 +* - 在调用本接口之前,建议先绑定渲染视图。 +* - 调用 setWTNRemoteVideoCanvas:withCanvas:{@link #ByteRTCWTNStream#setWTNRemoteVideoCanvas:withCanvas:} 绑定内部渲染视图 +* - 调用 setWTNRemoteVideoSink:withSink:withConfig:{@link #ByteRTCWTNStream#setWTNRemoteVideoSink:withSink:withConfig:} 绑定自定义渲染视图 +* - 调用本接口后,可以通过 onWTNFirstRemoteAudioFrame:{@link #ByteRTCWTNStreamDelegate#onWTNFirstRemoteAudioFrame:} 回调 WTN 音频流首帧解码情况。 +* - 调用本接口后,可以通过 onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage:} 回调 WTN 流中包含的 SEI 信息。 +* @list WTN +* @order 1 +*/ + +- (int)subscribeWTNAudioStream:(NSString * _Nonnull)streamId subscribe:(bool)subscribe; + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoCanvas:withCanvas:` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定内部渲染视图 + * @param streamId WTN 流 ID + * @param canvas 内部渲染视图,如果需要解除视频的绑定视图,把 videoCanvas 设置为空。详见 ByteRTCVideoCanvas{@link #ByteRTCVideoCanvas} + * @return + * - 0:成功 + * - !0:失败 + * @list WTN + * @order 2 + */ + +- (int)setWTNRemoteVideoCanvas:(NSString *_Nonnull)streamId + withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas NS_SWIFT_NAME(setWTNRemoteVideoCanvas(_:withCanvas:)); + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamVideoSink:withSink:withPixelFormat:` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 为指定 WTN 流绑定自定义渲染器。详见[自定义视频渲染](https: + * @param streamId WTN 流 ID + * @param videoSink 自定义视频渲染器,需要释放渲染器资源时,将 videoSink 设置为 `null`。参看 ByteRTCVideoSinkDelegate{@link #ByteRTCVideoSinkDelegate} + * @param config 远端视频帧回调配置,参看 ByteRTCRemoteVideoSinkConfig{@link #ByteRTCRemoteVideoSinkConfig} + * @return + * - 0: 成功 + * - <0: 失败。具体失败原因参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus}。 + * @list WTN + * @order 3 + */ + +- (int)setWTNRemoteVideoSink:(NSString *_Nonnull)streamId + withSink:(id _Nullable)videoSink + withConfig:(ByteRTCRemoteVideoSinkConfig*)config NS_SWIFT_NAME(setWTNRemoteVideoSink(_:withSink:withConfig:)); + +/** + * + * @type api + * @valid since 3.60. 自 3.60 起,该接口替代了 `setPublicStreamAudioPlaybackVolume:volume:` 方法来实现下述功能。你已升级至 3.60 及以上版本,并且仍在使用该方法,请迁移到此接口。 + * @brief 调节 WTN 流的音频播放音量。 + * @param streamId WTN 流 ID + * @param volume 音频播放音量值和原始音量值的比值,该比值的范围是 `[0, 400]`,单位为 %,且自带溢出保护。为保证更好的音频质量,建议设定在 `[0, 100]` 之间,其中 100 为系统默认值。 + * @return + * - 0: 成功调用。 + * - -2: 参数错误。 + * @list WTN + * @order 4 + */ + +- (int)setWTNRemoteAudioPlaybackVolume:(NSString *_Nonnull)streamId volume:(NSInteger)volume; +/** +* +* @type api +* @valid since 3.60. +* @brief 设置 WTN 流回调接口 +* @param delegate WTN 回调类,参看 ByteRTCWTNStreamDelegate{@link #ByteRTCWTNStreamDelegate}。 +* @list WTN +* @order 5 +*/ + +- (void)setWTNStreamDelegate:(_Nullable id)delegate; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTSRoomInternal.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTSRoomInternal.h new file mode 100644 index 0000000..320bfc1 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/ByteRTSRoomInternal.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Internal API +*/ + +@interface RTSRoom () + +/** + * + * @type api + * @hidden 仅内部使用接口 + */ + +- (instancetype _Nonnull)initWithRtsRoom:(byterts::IRTSRoom *_Nonnull)rtsRoom roomId:(NSString *_Nonnull)roomId; + +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/MeetingAdvance.h b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/MeetingAdvance.h new file mode 100644 index 0000000..3c5ce89 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Headers/objc/rtc/MeetingAdvance.h @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2020 The VolcEngineRTC project authors. All Rights Reserved. + * @brief VolcEngineRTC Room Internal API +*/ + +#import +#import "ByteRTCDefines.h" +@class ByteRTCRoom; +@class ByteRTCEngine; +@class ByteRTCVideoEncoderConfig; +@class ByteRTCAmazingEffect; + +#define BYTERTC_APPLE_EXPORT __attribute__((visibility("default"))) + +/** + * @type keytype + * @brief 5.18版本后,飞书会议弱网提示专用,设置订阅视频基线数据用于计算网络等级 + */ + +BYTERTC_APPLE_EXPORT @interface ByteRTCSubscribeVideoBaseline: NSObject +/** + * @brief 网络等级判定为优秀的视频分辨率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableGoodVideoPixelBaseline; +/** + * @brief 网络等级判定为优秀的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableGoodVideoFpsBaseline; +/** + * @brief 网络等级判定为差的视频分辨率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableBadVideoPixelBaseline; +/** + * @brief 网络等级判定为差的视频帧率基线,-1表示业务不设置计算时忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableBadVideoFpsBaseline; +/** + * @brief 业务可以接受的最小分辨率宽度,-1表示业务忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableMinVideoResolutionWidth; +/** + * @brief 业务可以接受的最小分辨率宽度,-1表示业务忽略此参数 + */ +@property (nonatomic, assign) NSInteger acceptableMinVideoResolutionHeight; +/** + * @brief 流的优先级,-1表示业务忽略此参数 + */ +@property (nonatomic, assign) NSInteger streamPriority; + +@end + +BYTERTC_APPLE_EXPORT @interface MeetingAdvance : NSObject + +/** + * + * @hidden + * @brief 推流到子频道channelName + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [NSString *_Nonnull] channelName 子频道 + */ ++ (int) setPublishChannel:(ByteRTCRoom *_Nonnull)room + channelName:(NSString *_Nonnull)channelName; +/** + * + * @hidden + * @brief 订阅子频道数组里的所有流 + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [NSArray * _Nonnull] channelsInfo 子频道数组 + * @param [bool] enableVolumeRescale 是否开启音频抑制功能 + */ ++ (int) setSubscribeChannels:(ByteRTCRoom *_Nonnull)room + channelsInfo:(NSArray * _Nonnull)channelsInfo + enableVolumeRescale:(bool)enableVolumeRescale; +/** + * + * @hidden + * @brief 设置是否开启音频抑制 + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [bool] enableVolumeRescale 是否抑制 + */ ++ (int) enableRescaleAudioVolume:(ByteRTCRoom *_Nonnull)room + enableVolumeRescale:(bool)enableVolumeRescale; +/** + * + * @hidden + * @brief 设置发布的特殊流类型 + * > 支持会前设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [int] type 流类型 + */ ++ (int) setPublishSpecialStream:(ByteRTCRoom *_Nonnull)room + type:(int)type; +/** + * + * @hidden + * @brief 设置订阅的特殊流类型 + * > 支持会前、会中设置 + * @param [ByteRTCRoom *_Nonnull] room 目标room + * @param [NSArray * _Nonnull] types 流类型集合 + */ ++ (int) setSubscribeSpecialStream:(ByteRTCRoom *_Nonnull)room + types:(NSArray * _Nonnull)types; + +/** + * + * @hidden +* @brief 判断本地音视频流是否取消发布成功状态 +* > 支持会中设置 +* @param [ByteRTCRoom *_Nonnull] room 目标room +* @param [ByteRTCMediaStreamType] type 需要检查的流类型 +* @return +* true: 关闭状态; +* false: 开启状态; +*/ ++ (bool)isStreamUnpublished:(ByteRTCRoom *_Nonnull)room type:(ByteRTCMediaStreamType)type; + +/** + * + * @hidden +* @brief 设置视频编码参数 +* > 该方法用于编码参数设置 +* @return +* 0: 成功; +* != 0: 失败; +*/ ++ (int) setVideoEncoderConfig:(ByteRTCEngine*_Nonnull)video channelSolutions:(NSArray * _Nonnull) channelSolutions + mainSolutions:(NSArray * _Nonnull) channelMainSolutions; + + ++ (int) enableSimulcastMode:(ByteRTCEngine*_Nonnull)video enable:(BOOL) enabled; +/** + * + * @hidden +* @brief 更新自动订阅选项 +* > 支持会中设置 +*@param [ByteRTCRoom *_Nonnull] room 目标room +*@param [ByteRTCSubscribeMode] audioMode 音频自动订阅模式 +*@param [ByteRTCSubscribeMode] videoMode 视频自动订阅模式 +*/ ++ (int) enableAutoSubscribe:(ByteRTCRoom *_Nonnull)room audioSubMode:(ByteRTCSubscribeMode)audioMode videoMode:(ByteRTCSubscribeMode)videoMode; + +/** + * + * @hidden +* @brief 订阅基线设置 +* > 支持订阅流前设置 +* @param [ByteRTCRoom *_Nonnull] room 目标room +* @param [NSString *_Nonnull] userId 订阅用户名 +* @param [BOOL] isScreen 是否屏幕流 +* @param [ByteRTCSubscribeVideoBaseline* _Nullable] videoBaseline 订阅基线设置 +*/ ++ (void) setSubscribeBaselineData:(ByteRTCRoom *_Nonnull)room userId:(NSString *_Nonnull)userId isScreen:(BOOL)isScreen videoBaseline:(ByteRTCSubscribeVideoBaseline* _Nullable)videoBaseline; + +/** + * + * @hidden +* @brief 获取用于实时crash分子数据信息 +* @return +* [NSString * _Nonnull]: 返回json格式的信息 +*/ ++ (NSString * _Nonnull) getSessionLaunchParams; +/** + * + * @brief 获取视频特效接口ByteRTCAmazingEffect +* @param [ByteRTCEngine *_Nonnull] ivideo 目标ByteRTCVideo +*/ ++ (ByteRTCAmazingEffect* _Null_unspecified) getAmazingEffectInterface:(ByteRTCEngine *_Nonnull)video; + +/** + * + * @hidden + * @brief 设置屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ ++ (int)setScreenVideoConfigs:(ByteRTCEngine * _Nonnull)video; + +/** + * + * @hidden + * @brief 清空屏幕流多分辨率参数 + * @return 0 成功 !0失败 + */ ++ (int)resetScreenVideoConfigs:(ByteRTCEngine * _Nonnull)video; + +/** + * + * @brief 获取上行带宽状态 + * @param [ByteRTCRoom*] room 目标room + */ ++ (int)getUplinkNetworkBandwidthEstimationStatus:(ByteRTCRoom *_Nonnull)room; + +/** + * + * @brief 获取下行带宽状态 + * @param [ByteRTCRoom*] room 目标room + */ ++ (int)getDownlinkNetworkBandwidthEstimationStatus:(ByteRTCRoom *_Nonnull)room; +@end diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Info.plist b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Info.plist new file mode 100644 index 0000000..4d70a16 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Info.plist @@ -0,0 +1,51 @@ + + + + + BuildMachineOSBuild + 22H730 + CFBundleDevelopmentRegion + en + CFBundleExecutable + VolcEngineRTC + CFBundleIdentifier + VolcEngineRTC + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + VolcEngineRTC + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.60.107 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 20B71 + DTPlatformName + iphonesimulator + DTPlatformVersion + 16.1 + DTSDKBuild + 20B71 + DTSDKName + iphonesimulator16.1 + DTXcode + 1410 + DTXcodeBuild + 14B47b + MinimumOSVersion + 11.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Modules/module.modulemap b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Modules/module.modulemap new file mode 100644 index 0000000..f648c27 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module VolcEngineRTC { + umbrella header "VolcEngineRTC.h" + + export * + module * { export * } +} diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/PrivacyInfo.xcprivacy b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..76757b6 --- /dev/null +++ b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/PrivacyInfo.xcprivacy @@ -0,0 +1,39 @@ + + + + + NSPrivacyTracking + + NSPrivacyCollectedDataTypes + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + + \ No newline at end of file diff --git a/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/VolcEngineRTC b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/VolcEngineRTC new file mode 100755 index 0000000..afb3676 Binary files /dev/null and b/Pods/VolcEngineRTC/VolcEngineRTC.xcframework/ios-arm64_x86_64-simulator/VolcEngineRTC.framework/VolcEngineRTC differ diff --git a/artifacts/android-arrival-gate-fix-2026-11-05/zhiflyfollow-9.9.1.20261105_164745-release.apk b/artifacts/android-arrival-gate-fix-2026-11-05/zhiflyfollow-9.9.1.20261105_164745-release.apk new file mode 100644 index 0000000..56b20b6 Binary files /dev/null and b/artifacts/android-arrival-gate-fix-2026-11-05/zhiflyfollow-9.9.1.20261105_164745-release.apk differ diff --git a/artifacts/android-arrival-gate-fix-2026-11-05/给朱工的后端核查说明.txt b/artifacts/android-arrival-gate-fix-2026-11-05/给朱工的后端核查说明.txt new file mode 100644 index 0000000..e7811a2 --- /dev/null +++ b/artifacts/android-arrival-gate-fix-2026-11-05/给朱工的后端核查说明.txt @@ -0,0 +1,30 @@ +朱工您好,2026-11-05 安卓 Release 真机测试有两项后端问题需要继续核查。 + +现场:App 9.9.1.20261105_162119,任务 36,execution_batch=2450。以下时间为北京时间。 + +一、首点到达阶段与开拍门禁不一致 +16:28:44.874,GET shooting 的 state_version=7: +- ui.phase=arrived_pending_start,标题“无人机已到达 是否开始拍摄?” +- flight_control.state=executing,pause_reason=arrival_wait +- is_airborne=null,drone_in_dock=null +- task.status=20,order_flight_task.status=20 +- execute_gate.can_execute=false,code=going_to_spot,primary_action=blocked +- gate.message=“无人机正在前往点位,到达首点后再开始拍摄” + +16:28:51.249,下一份 GET shooting 的 state_version=8: +- ui.phase 仍为 arrived_pending_start +- is_airborne=true,drone_in_dock=outside +- execute_gate.can_execute=true,code=ok,primary_action=start_shoot + +请核查为什么已经确认首点到达并标记 arrival_wait,开拍门禁仍按 going_to_spot 返回。若确实还需补齐遥测或其他开拍条件,请返回对应的准确 code/message,避免已到达页面又提示仍在前往点位。阶段、门禁和飞控变化请保持同一快照内语义一致,递增 state_version 并推送。 +App 侧已修正:已到达阶段不再被关闭/缺失的开拍门禁改成“整个任务不可操作”;仍严格按原门禁禁用开始拍摄,并显示门禁原因,不自动开拍。 + +二、WS 仍没有正式订阅回执 +16:27:53 起的多次连接均是:Opened → ready → received,随后约 12 秒 App 订阅超时。未收到 ack=subscribe,也没有正式任务快照;本次任务一直通过 HTTP 兜底更新。 +- App 发送的是 310 JSON 文本帧,任务 id=36。 +- 服务端确实回复了 data.type=310、ack=received。 +- 正式 ack=subscribe 的接收数量为 0。 + +请核查生产 hyperf-socket 的部署版本、310 后的鉴权与分发链路。按最新合同,成功和失败都应返回 data.type=310、ack=subscribe、order_flight_task_id=36 和 subscribed=true/false;鉴权应有 3 秒硬超时并返回明确失败,不能只有 received。频道登记、Redis 快照读取应在正式订阅回执之后执行。 + +验收:到达首点时 UI 阶段与门禁原因一致;310 后稳定收到正式 subscribe 回执,再收到完整快照,不能再只停留在 ready/received。 diff --git a/artifacts/android-return-unknown-fix-2026-11-05/zhiflyfollow-9.9.1.20261105_170401-release.apk b/artifacts/android-return-unknown-fix-2026-11-05/zhiflyfollow-9.9.1.20261105_170401-release.apk new file mode 100644 index 0000000..aef1d08 Binary files /dev/null and b/artifacts/android-return-unknown-fix-2026-11-05/zhiflyfollow-9.9.1.20261105_170401-release.apk differ diff --git a/artifacts/android-return-unknown-fix-2026-11-05/任务37回巢问题证据.json b/artifacts/android-return-unknown-fix-2026-11-05/任务37回巢问题证据.json new file mode 100644 index 0000000..c16c28f --- /dev/null +++ b/artifacts/android-return-unknown-fix-2026-11-05/任务37回巢问题证据.json @@ -0,0 +1,1002 @@ +[ + { + "captured_at": "11-05 16:45:11.731", + "source": "http", + "task_id": 37, + "execution_batch": 2451, + "state_version": 31, + "backend": { + "order_flight_task": { + "id": 37, + "order_id": 0, + "order_number": "261105175039", + "scenic_id": 175, + "store_id": 60, + "store_user_id": 1902, + "scenic_spot_id": 521, + "air_line_id": 316, + "plane_id": 72, + "airport_sn": "8UUXN4200A04GX", + "wayline_task_id": 2451, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_status": 20, + "wayline_status_label": "拍摄中", + "seq": 2, + "spot_attempt": 2, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-05 16:42:12", + "finished_at": null, + "medias": [] + }, + "task": { + "id": 37, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_task_id": 2451, + "wayline_status": 20, + "wayline_status_label": "拍摄中", + "status": 20, + "status_label": "执行中" + }, + "current_plane": { + "id": 72, + "sn_number": "8UUXN4200A04GX", + "name": "牛首山1号无人机", + "online_status": 1, + "is_receive_order": 2, + "work_status": 2, + "work_status_label": "拍摄中", + "task_type": 2, + "battery_percent": 91, + "battery_label": "电量 91%", + "can_fly": false, + "status_text": "拍摄中 · 电量 91%" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18.1℃", + "raw": 18.1 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "metrics_updated_at": "2026-11-05 16:45:06", + "metrics_stale": false, + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "running", + "message": "任务执行中,请等待结束或返航后再试", + "primary_action": "blocked", + "primary_action_label": "执行中" + }, + "ui": { + "phase": "shooting", + "title": "无人机正在拍摄中", + "message": "请关注现场及实时画面", + "primary_action": "shooting", + "primary_action_label": "拍摄中", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命", + "enabled": true + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务", + "enabled": true + } + ] + }, + "flight_control": { + "state": "executing", + "is_airborne": null, + "pause_reason": null, + "resume_phase": "shooting", + "return_reason": null, + "can_pause": true, + "can_resume": false, + "can_return_home": true, + "pending_command": null, + "dji_task_status": "executing", + "drone_in_dock": "outside", + "execution_batch": 2451, + "evidence": { + "dji_task_status": "executing", + "drone_in_dock": "outside", + "is_airborne": null, + "elevation": 0, + "horizontal_speed": 0, + "vertical_speed": 0, + "drone_sn": "1581F8HHX252N00A00AZ", + "telemetry_source": "drone", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "shoot_complete_returning": false, + "order_flight_task_id": 37, + "state_version": 31, + "state_updated_at": "2026-11-05 16:45:12", + "execution_batch": 2451, + "snapshot_kind": "full" + }, + "local": { + "visible": true, + "loading": true, + "denied": false, + "realtime": false, + "execution_batch": 2451, + "state_version": 31, + "phase": "shooting", + "title": "无人机正在拍摄中", + "message": "请关注现场及实时画面。\n请勿关闭本页或息屏。", + "operation": null, + "unknown_operation": null, + "error": null, + "accepted_start": true, + "accepted_restart": false, + "awaiting_restart_snapshot": false, + "recording_finished": false, + "stop_live": false, + "completion_key": null, + "snapshot_can_start": false, + "snapshot_can_restart": false, + "countdown_state": "hidden", + "telemetry": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18.1℃", + "raw": 18.1 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "telemetry_stale": false, + "using_retained_metrics": false, + "safety": { + "flighttask_pause": { + "snapshot_permitted": true, + "loading": false, + "unknown": false, + "blockers": [] + }, + "flighttask_recovery": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed" + ] + }, + "return_home": { + "snapshot_permitted": true, + "loading": false, + "unknown": false, + "blockers": [] + } + } + } + }, + { + "captured_at": "11-05 16:45:17.953", + "source": "http", + "task_id": 37, + "execution_batch": 2451, + "state_version": 32, + "backend": { + "order_flight_task": { + "id": 37, + "order_id": 0, + "order_number": "261105175039", + "scenic_id": 175, + "store_id": 60, + "store_user_id": 1902, + "scenic_spot_id": 521, + "air_line_id": 316, + "plane_id": 72, + "airport_sn": "8UUXN4200A04GX", + "wayline_task_id": 2451, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_status": 24, + "wayline_status_label": "下载中", + "seq": 2, + "spot_attempt": 2, + "status": 25, + "status_label": "素材上传中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-05 16:42:12", + "finished_at": "2026-11-05 16:45:17", + "medias": [] + }, + "task": { + "id": 37, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_task_id": 2451, + "wayline_status": 24, + "wayline_status_label": "下载中", + "status": 25, + "status_label": "素材上传中" + }, + "current_plane": { + "id": 72, + "sn_number": "8UUXN4200A04GX", + "name": "牛首山1号无人机", + "online_status": 1, + "is_receive_order": 1, + "work_status": 1, + "work_status_label": "空闲", + "task_type": null, + "battery_percent": 91, + "battery_label": "电量 91%", + "can_fly": true, + "status_text": "空闲 · 电量 91%" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18.1℃", + "raw": 18.1 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "metrics_updated_at": "2026-11-05 16:45:06", + "metrics_stale": false, + "execute_gate": { + "can_execute": false, + "code": "task_finished", + "message": "拍摄已结束,素材上传中,请新建任务进行下一次拍摄", + "primary_action": "blocked", + "primary_action_label": "拍摄已结束,素材上传中,请新建任务进行下一次拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "success_forbid", + "message": "拍摄已结束、素材上传中,请新建任务进行下一次拍摄", + "primary_action": "blocked", + "primary_action_label": "不可重新召唤" + }, + "ui": { + "phase": "post_shoot_uploading", + "title": "拍摄已完成", + "message": "无人机正在返航,请留意现场", + "primary_action": "wait_return_home", + "primary_action_label": "返航中", + "commands": [], + "wayline_stage": "shoot_done_returning", + "shoot_complete_returning": true + }, + "flight_control": { + "state": "unknown", + "is_airborne": false, + "pause_reason": null, + "resume_phase": "shooting", + "return_reason": null, + "can_pause": false, + "can_resume": false, + "can_return_home": false, + "pending_command": null, + "dji_task_status": "success", + "drone_in_dock": "inside", + "execution_batch": 2451, + "evidence": { + "dji_task_status": "success", + "drone_in_dock": "inside", + "is_airborne": false, + "elevation": 0, + "horizontal_speed": 0, + "vertical_speed": 0, + "drone_sn": "1581F8HHX252N00A00AZ", + "telemetry_source": "drone", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "shoot_complete_returning": true, + "order_flight_task_id": 37, + "state_version": 32, + "state_updated_at": "2026-11-05 16:45:18", + "execution_batch": 2451, + "snapshot_kind": "full" + }, + "local": { + "visible": true, + "loading": true, + "denied": false, + "realtime": false, + "execution_batch": 2451, + "state_version": 32, + "phase": "unknown", + "title": "状态待确认", + "message": "正在核对设备状态,请稍后刷新。", + "operation": null, + "unknown_operation": null, + "error": null, + "accepted_start": true, + "accepted_restart": false, + "awaiting_restart_snapshot": false, + "recording_finished": false, + "stop_live": false, + "completion_key": null, + "snapshot_can_start": false, + "snapshot_can_restart": false, + "countdown_state": "hidden", + "telemetry": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18.1℃", + "raw": 18.1 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "telemetry_stale": false, + "using_retained_metrics": false, + "safety": { + "flighttask_pause": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + }, + "flighttask_recovery": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + }, + "return_home": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + } + } + } + }, + { + "captured_at": "11-05 16:45:24.518", + "source": "http", + "task_id": 37, + "execution_batch": 2451, + "state_version": 33, + "backend": { + "order_flight_task": { + "id": 37, + "order_id": 0, + "order_number": "261105175039", + "scenic_id": 175, + "store_id": 60, + "store_user_id": 1902, + "scenic_spot_id": 521, + "air_line_id": 316, + "plane_id": 72, + "airport_sn": "8UUXN4200A04GX", + "wayline_task_id": 2451, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_status": 24, + "wayline_status_label": "下载中", + "seq": 2, + "spot_attempt": 2, + "status": 25, + "status_label": "素材上传中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-05 16:42:12", + "finished_at": "2026-11-05 16:45:17", + "medias": [] + }, + "task": { + "id": 37, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_task_id": 2451, + "wayline_status": 24, + "wayline_status_label": "下载中", + "status": 25, + "status_label": "素材上传中" + }, + "current_plane": { + "id": 72, + "sn_number": "8UUXN4200A04GX", + "name": "牛首山1号无人机", + "online_status": 1, + "is_receive_order": 1, + "work_status": 1, + "work_status_label": "空闲", + "task_type": null, + "battery_percent": 91, + "battery_label": "电量 91%", + "can_fly": true, + "status_text": "空闲 · 电量 91%" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18℃", + "raw": 18 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "metrics_updated_at": "2026-11-05 16:45:25", + "metrics_stale": false, + "execute_gate": { + "can_execute": false, + "code": "task_finished", + "message": "拍摄已结束,素材上传中,请新建任务进行下一次拍摄", + "primary_action": "blocked", + "primary_action_label": "拍摄已结束,素材上传中,请新建任务进行下一次拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "success_forbid", + "message": "拍摄已结束、素材上传中,请新建任务进行下一次拍摄", + "primary_action": "blocked", + "primary_action_label": "不可重新召唤" + }, + "ui": { + "phase": "post_shoot_uploading", + "title": "拍摄已完成", + "message": "无人机正在返航,请留意现场", + "primary_action": "wait_return_home", + "primary_action_label": "返航中", + "commands": [], + "wayline_stage": "shoot_done_returning", + "shoot_complete_returning": true + }, + "flight_control": { + "state": "unknown", + "is_airborne": false, + "pause_reason": null, + "resume_phase": "shooting", + "return_reason": null, + "can_pause": false, + "can_resume": false, + "can_return_home": false, + "pending_command": null, + "dji_task_status": "success", + "drone_in_dock": "inside", + "execution_batch": 2451, + "evidence": { + "dji_task_status": "success", + "drone_in_dock": "inside", + "is_airborne": false, + "elevation": 0, + "horizontal_speed": 0, + "vertical_speed": 0, + "drone_sn": "1581F8HHX252N00A00AZ", + "telemetry_source": "drone", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "shoot_complete_returning": true, + "order_flight_task_id": 37, + "state_version": 33, + "state_updated_at": "2026-11-05 16:45:25", + "execution_batch": 2451, + "snapshot_kind": "full" + }, + "local": { + "visible": true, + "loading": true, + "denied": false, + "realtime": false, + "execution_batch": 2451, + "state_version": 33, + "phase": "unknown", + "title": "状态待确认", + "message": "正在核对设备状态,请稍后刷新。", + "operation": null, + "unknown_operation": null, + "error": null, + "accepted_start": true, + "accepted_restart": false, + "awaiting_restart_snapshot": false, + "recording_finished": false, + "stop_live": false, + "completion_key": null, + "snapshot_can_start": false, + "snapshot_can_restart": false, + "countdown_state": "hidden", + "telemetry": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18℃", + "raw": 18 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "telemetry_stale": false, + "using_retained_metrics": false, + "safety": { + "flighttask_pause": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + }, + "flighttask_recovery": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + }, + "return_home": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + } + } + } + }, + { + "captured_at": "11-05 16:45:30.770", + "source": "http", + "task_id": 37, + "execution_batch": 2451, + "state_version": 34, + "backend": { + "order_flight_task": { + "id": 37, + "order_id": 0, + "order_number": "261105175039", + "scenic_id": 175, + "store_id": 60, + "store_user_id": 1902, + "scenic_spot_id": 521, + "air_line_id": 316, + "plane_id": 72, + "airport_sn": "8UUXN4200A04GX", + "wayline_task_id": 2451, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_status": 24, + "wayline_status_label": "下载中", + "seq": 2, + "spot_attempt": 2, + "status": 25, + "status_label": "素材上传中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-05 16:42:12", + "finished_at": "2026-11-05 16:45:17", + "medias": [] + }, + "task": { + "id": 37, + "task_uuid": "045e574a-3bd3-493f-8163-aac645cf5ce3", + "wayline_task_id": 2451, + "wayline_status": 24, + "wayline_status_label": "下载中", + "status": 25, + "status_label": "素材上传中" + }, + "current_plane": { + "id": 72, + "sn_number": "8UUXN4200A04GX", + "name": "牛首山1号无人机", + "online_status": 1, + "is_receive_order": 1, + "work_status": 1, + "work_status_label": "空闲", + "task_type": null, + "battery_percent": 91, + "battery_label": "电量 91%", + "can_fly": true, + "status_text": "空闲 · 电量 91%" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18℃", + "raw": 18 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "metrics_updated_at": "2026-11-05 16:45:25", + "metrics_stale": false, + "execute_gate": { + "can_execute": false, + "code": "task_finished", + "message": "拍摄已结束,素材上传中,请新建任务进行下一次拍摄", + "primary_action": "blocked", + "primary_action_label": "拍摄已结束,素材上传中,请新建任务进行下一次拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "success_forbid", + "message": "拍摄已结束、素材上传中,请新建任务进行下一次拍摄", + "primary_action": "blocked", + "primary_action_label": "不可重新召唤" + }, + "ui": { + "phase": "post_shoot_uploading", + "title": "拍摄已完成", + "message": "无人机正在返航,请留意现场", + "primary_action": "wait_return_home", + "primary_action_label": "返航中", + "commands": [], + "wayline_stage": "shoot_done_returning", + "shoot_complete_returning": true + }, + "flight_control": { + "state": "unknown", + "is_airborne": false, + "pause_reason": null, + "resume_phase": "shooting", + "return_reason": null, + "can_pause": false, + "can_resume": false, + "can_return_home": false, + "pending_command": null, + "dji_task_status": "success", + "drone_in_dock": "inside", + "execution_batch": 2451, + "evidence": { + "dji_task_status": "success", + "drone_in_dock": "inside", + "is_airborne": false, + "elevation": 0, + "horizontal_speed": 0, + "vertical_speed": 0, + "drone_sn": "1581F8HHX252N00A00AZ", + "telemetry_source": "drone", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "shoot_complete_returning": true, + "order_flight_task_id": 37, + "state_version": 34, + "state_updated_at": "2026-11-05 16:45:31", + "execution_batch": 2451, + "snapshot_kind": "full" + }, + "local": { + "visible": true, + "loading": true, + "denied": false, + "realtime": false, + "execution_batch": 2451, + "state_version": 34, + "phase": "unknown", + "title": "状态待确认", + "message": "正在核对设备状态,请稍后刷新。", + "operation": null, + "unknown_operation": null, + "error": null, + "accepted_start": true, + "accepted_restart": false, + "awaiting_restart_snapshot": false, + "recording_finished": false, + "stop_live": false, + "completion_key": null, + "snapshot_can_start": false, + "snapshot_can_restart": false, + "countdown_state": "hidden", + "telemetry": [ + { + "key": "battery", + "label": "电池电量", + "value": "91%", + "raw": 91, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "18℃", + "raw": 18 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "telemetry_stale": false, + "using_retained_metrics": false, + "safety": { + "flighttask_pause": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + }, + "flighttask_recovery": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + }, + "return_home": { + "snapshot_permitted": false, + "loading": false, + "unknown": false, + "blockers": [ + "snapshot_device_or_permission_gate_closed", + "unmatched_backend_pending_command" + ] + } + } + } + } +] \ No newline at end of file diff --git a/artifacts/android-return-unknown-fix-2026-11-05/给朱工的回巢状态核查说明.txt b/artifacts/android-return-unknown-fix-2026-11-05/给朱工的回巢状态核查说明.txt new file mode 100644 index 0000000..40e51da --- /dev/null +++ b/artifacts/android-return-unknown-fix-2026-11-05/给朱工的回巢状态核查说明.txt @@ -0,0 +1,24 @@ +朱工您好,补充 2026-11-05 安卓真机任务 37 的回巢状态问题。以下均为北京时间。 + +任务37,订单261105175039,execution_batch=2451,现场App版本9.9.1.20261105_162119(Release)。 + +16:45:11.731 的 state_version=31: +- task.status=20,order_flight_task.status=20,wayline_status=20,ui.phase=shooting。 +- flight_control.state=executing,drone_in_dock=outside。 + +16:45:17.953 的 state_version=32,及16:45:24.518的v33、16:45:30.770的v34: +- task.status=25,order_flight_task.status=25,wayline_status=24。 +- ui.phase=post_shoot_uploading,title=拍摄已完成。 +- 顶层及UI的shoot_complete_returning=true,wayline_stage=shoot_done_returning。 +- flight_control.state=unknown,drone_in_dock=inside,is_airborne=false,return_reason=null。 +- evidence却显示:dji_task_status=success,probe_ok=true,ever_left_dock=true,ever_airborne=true,drone_in_dock=inside。 +- 三项can_*均false,任务无return_home结果码,本次也没有手动返航。 + +请核查: +1. 同批次已有离巢/起飞和当前在巢证据,为什么flight_control没有返回returned?正常完成为何return_reason为null而非normal_complete? +2. 已在巢内时,UI仍保留“无人机正在返航”与shoot_done_returning,需按当前设备证据更新文案/阶段标记。 +3. 本次HTTP在持续成功读取新版本,不是App停刷。WS仍未见正式subscribe回执,仍请核对生产hyperf-socket的正式回执链路。 + +App侧已处理:明示的unknown控制态不会再被直接当成无效对象而抹掉可信拍摄完成;展示完成和素材处理中,停止本地接收。飞控与重召仍全部禁用,不由App推断returned或normal_complete;失败、取消、手动中断、批次和身份校验保持。 + +附件JSON保存了v31/v32/v33/v34的任务快照及本地诊断,可对照服务端日志排查。 diff --git a/artifacts/drone-dock-ui-2026-11-05/android/capture-checks.log b/artifacts/drone-dock-ui-2026-11-05/android/capture-checks.log new file mode 100644 index 0000000..9798bdb --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/android/capture-checks.log @@ -0,0 +1,66 @@ +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream= +com.zhifly.follow.ui.dronedock.RemoteDroneMediaCaptureScreensTest: +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureConfirmedOrder +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneMediaCaptureScreensTest +INSTRUMENTATION_STATUS: current=1 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureConfirmedOrder +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneMediaCaptureScreensTest +INSTRUMENTATION_STATUS: current=1 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureMaterialsAndDeliveryMethodsFromSameOrder +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneMediaCaptureScreensTest +INSTRUMENTATION_STATUS: current=2 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureMaterialsAndDeliveryMethodsFromSameOrder +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneMediaCaptureScreensTest +INSTRUMENTATION_STATUS: current=2 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream= +com.zhifly.follow.ui.dronedock.RemoteDroneTaskExtraCaptureTest: +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureTravelling +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneTaskExtraCaptureTest +INSTRUMENTATION_STATUS: current=3 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureTravelling +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneTaskExtraCaptureTest +INSTRUMENTATION_STATUS: current=3 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream= +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureFailure +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneTaskExtraCaptureTest +INSTRUMENTATION_STATUS: current=4 +INSTRUMENTATION_STATUS_CODE: 1 +INSTRUMENTATION_STATUS: numtests=4 +INSTRUMENTATION_STATUS: stream=. +INSTRUMENTATION_STATUS: id=AndroidJUnitRunner +INSTRUMENTATION_STATUS: test=captureFailure +INSTRUMENTATION_STATUS: class=com.zhifly.follow.ui.dronedock.RemoteDroneTaskExtraCaptureTest +INSTRUMENTATION_STATUS: current=4 +INSTRUMENTATION_STATUS_CODE: 0 +INSTRUMENTATION_RESULT: stream= + +Time: 7.86 + +OK (4 tests) + + +INSTRUMENTATION_CODE: -1 diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-code.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-code.png new file mode 100644 index 0000000..0c57a1e Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-code.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-completed.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-completed.png new file mode 100644 index 0000000..c7fb203 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-completed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-manifest.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-manifest.png new file mode 100644 index 0000000..68de1f6 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-confirmation-manifest.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-cloud.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-cloud.png new file mode 100644 index 0000000..3a27b29 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-cloud.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-methods.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-methods.png new file mode 100644 index 0000000..31a3e15 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-methods.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-nearby.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-nearby.png new file mode 100644 index 0000000..0ae94a4 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-delivery-nearby.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-material-preview.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-material-preview.png new file mode 100644 index 0000000..97e114c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-material-preview.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-materials.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-materials.png new file mode 100644 index 0000000..f6af4ce Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-materials.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-orders.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-orders.png new file mode 100644 index 0000000..c41649f Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-orders.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-payment-before-selection.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-payment-before-selection.png new file mode 100644 index 0000000..4f1e8f7 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-payment-before-selection.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-payment.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-payment.png new file mode 100644 index 0000000..342f61b Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-payment.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-preparation.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-preparation.png new file mode 100644 index 0000000..8edd6b3 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-preparation.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-receipts.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-receipts.png new file mode 100644 index 0000000..0457622 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-receipts.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-workbench-statistics.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-workbench-statistics.png new file mode 100644 index 0000000..3ba70b2 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-workbench-statistics.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/dock-workbench.png b/artifacts/drone-dock-ui-2026-11-05/android/dock-workbench.png new file mode 100644 index 0000000..91ebd3d Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/dock-workbench.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/manifest.json b/artifacts/drone-dock-ui-2026-11-05/android/manifest.json new file mode 100644 index 0000000..6b9a9f3 --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/android/manifest.json @@ -0,0 +1,272 @@ +{ + "platform": "Android", + "capturedAt": "2026-11-05", + "repository": "/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow", + "commit": "faebb982", + "build": "Debug 9.9.1.20261105_112138; zhifly.bundle.youfun=false", + "device": "独立 Android API 26 AVD CodexProfileSettings; emulator-5560/5680; 1080×1920; 420 dpi", + "source": "正式RemoteDrone* Screen,已包含当前未提交UI改动;使用隔离测试数据,无真实飞控/任务/live/RTC。", + "screenshots": [ + { + "filename": "dock-confirmation-code.png", + "pageKey": "confirmation-code", + "title": "订单确认码", + "state": "等待游客确认", + "note": "等待游客确认", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-confirmation-completed.png", + "pageKey": "confirmation-completed", + "title": "订单交付确认·完成", + "state": "已完成整单确认", + "note": "已完成整单确认", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "dock-confirmation-manifest.png", + "pageKey": "delivery-review", + "title": "整单交付清单", + "state": "待确认交齐", + "note": "待确认交齐", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-delivery-cloud.png", + "pageKey": "delivery-cloud", + "title": "云端上传", + "state": "未选视频", + "note": "未选视频", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "dock-delivery-methods.png", + "pageKey": "delivery-method", + "title": "交付成片·交付方式", + "state": "底部弹层", + "note": "底部弹层", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-delivery-nearby.png", + "pageKey": "delivery-nearby", + "title": "面对面闪传", + "state": "未选视频", + "note": "未选视频", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "dock-material-preview.png", + "pageKey": "material-preview", + "title": "素材预览", + "state": "照片预览", + "note": "照片预览", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-materials.png", + "pageKey": "materials", + "title": "订单素材库", + "state": "首屏", + "note": "首屏", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-orders.png", + "pageKey": "orders", + "title": "我的拍摄订单", + "state": "全部", + "note": "全部", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-payment-before-selection.png", + "pageKey": "payment-unselected", + "title": "收款详情·未选套餐", + "state": "未选择套餐", + "note": "未选择套餐", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-payment.png", + "pageKey": "payment", + "title": "收款详情", + "state": "已生成模拟码,页面滚动位置由现有测试保留", + "note": "已生成模拟码,页面滚动位置由现有测试保留", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-preparation.png", + "pageKey": "preparation", + "title": "拍摄准备", + "state": "可召唤", + "note": "可召唤", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-receipts.png", + "pageKey": "receipts", + "title": "收款记录", + "state": "近7天", + "note": "近7天", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-workbench-statistics.png", + "pageKey": "workbench-stats", + "title": "机巢工作台·今日统计", + "state": "向下滚动", + "note": "向下滚动", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-workbench.png", + "pageKey": "workbench", + "title": "机巢工作台", + "state": "首屏", + "note": "首屏", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-completion-dialog.png", + "pageKey": "task-completion-dialog", + "title": "拍摄完成提示", + "state": "弹窗", + "note": "弹窗", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-paused.png", + "pageKey": "task-paused", + "title": "拍摄任务·手动暂停", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-pending-pause.png", + "pageKey": "task-pending-pause", + "title": "拍摄任务·暂停待确认", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-returned.png", + "pageKey": "task-returned", + "title": "拍摄任务·已返回机巢", + "state": "中断任务失败", + "note": "中断任务失败", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-returning.png", + "pageKey": "task-returning", + "title": "拍摄任务·手动返航", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-starting.png", + "pageKey": "task-starting", + "title": "拍摄任务·起飞准备", + "state": "无人机正在赶来", + "note": "无人机正在赶来", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-failed.png", + "pageKey": "task-failed", + "title": "拍摄任务·失败", + "state": "中断后已返回机巢,可重新召唤", + "note": "中断后已返回机巢,可重新召唤", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "task-going.png", + "pageKey": "task-going", + "title": "拍摄任务·前往点位", + "state": "无人机正在赶来", + "note": "无人机正在赶来", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "task-ready.png", + "pageKey": "task-ready", + "title": "拍摄任务·到点等待", + "state": "倒计时与手动开拍", + "note": "倒计时与手动开拍", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-returning-complete.png", + "pageKey": "task-complete", + "title": "拍摄任务·拍摄已完成", + "state": "正常返航", + "note": "正常返航", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-shooting.png", + "pageKey": "task-shooting", + "title": "拍摄任务·拍摄中", + "state": "黑色区域为Mock接收器,无真实RTC/视频帧", + "note": "黑色区域为Mock接收器,无真实RTC/视频帧", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + } + ], + "validation": "工作台/收款/任务原有17用例通过;素材原有截图类依赖loopback网络与旧文案,截图专用临时类改为Coil内存图片及当前控件选择器后,最终4个补截用例全部通过。所有业务源码保持未改动。" +} \ No newline at end of file diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-completion-dialog.png b/artifacts/drone-dock-ui-2026-11-05/android/task-completion-dialog.png new file mode 100644 index 0000000..24a7172 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-completion-dialog.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-control-paused.png b/artifacts/drone-dock-ui-2026-11-05/android/task-control-paused.png new file mode 100644 index 0000000..fbe6bae Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-control-paused.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-control-pending-pause.png b/artifacts/drone-dock-ui-2026-11-05/android/task-control-pending-pause.png new file mode 100644 index 0000000..90c718d Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-control-pending-pause.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-control-returned.png b/artifacts/drone-dock-ui-2026-11-05/android/task-control-returned.png new file mode 100644 index 0000000..5cb3e11 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-control-returned.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-control-returning.png b/artifacts/drone-dock-ui-2026-11-05/android/task-control-returning.png new file mode 100644 index 0000000..0251edb Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-control-returning.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-control-starting.png b/artifacts/drone-dock-ui-2026-11-05/android/task-control-starting.png new file mode 100644 index 0000000..a359011 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-control-starting.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-failed.png b/artifacts/drone-dock-ui-2026-11-05/android/task-failed.png new file mode 100644 index 0000000..5cb3e11 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-failed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-going.png b/artifacts/drone-dock-ui-2026-11-05/android/task-going.png new file mode 100644 index 0000000..cec0de7 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-going.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-ready.png b/artifacts/drone-dock-ui-2026-11-05/android/task-ready.png new file mode 100644 index 0000000..399c86b Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-ready.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-returning-complete.png b/artifacts/drone-dock-ui-2026-11-05/android/task-returning-complete.png new file mode 100644 index 0000000..ec55f24 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-returning-complete.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/android/task-shooting.png b/artifacts/drone-dock-ui-2026-11-05/android/task-shooting.png new file mode 100644 index 0000000..ff71da4 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/android/task-shooting.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/01-home.png b/artifacts/drone-dock-ui-2026-11-05/comparison/01-home.png new file mode 100644 index 0000000..449bb36 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/01-home.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/02-statistics.png b/artifacts/drone-dock-ui-2026-11-05/comparison/02-statistics.png new file mode 100644 index 0000000..ba2bf66 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/02-statistics.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/03-orders.png b/artifacts/drone-dock-ui-2026-11-05/comparison/03-orders.png new file mode 100644 index 0000000..09809d0 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/03-orders.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/04-payment-empty.png b/artifacts/drone-dock-ui-2026-11-05/comparison/04-payment-empty.png new file mode 100644 index 0000000..34db794 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/04-payment-empty.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/05-payment.png b/artifacts/drone-dock-ui-2026-11-05/comparison/05-payment.png new file mode 100644 index 0000000..14cdda2 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/05-payment.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/06-project-picker.png b/artifacts/drone-dock-ui-2026-11-05/comparison/06-project-picker.png new file mode 100644 index 0000000..fa072d8 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/06-project-picker.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/07-amount-edit.png b/artifacts/drone-dock-ui-2026-11-05/comparison/07-amount-edit.png new file mode 100644 index 0000000..78cbfc2 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/07-amount-edit.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/08-receipts.png b/artifacts/drone-dock-ui-2026-11-05/comparison/08-receipts.png new file mode 100644 index 0000000..9ac5984 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/08-receipts.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/09-preparation.png b/artifacts/drone-dock-ui-2026-11-05/comparison/09-preparation.png new file mode 100644 index 0000000..483507e Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/09-preparation.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/10-task-starting.png b/artifacts/drone-dock-ui-2026-11-05/comparison/10-task-starting.png new file mode 100644 index 0000000..c486e43 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/10-task-starting.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/11-task-going.png b/artifacts/drone-dock-ui-2026-11-05/comparison/11-task-going.png new file mode 100644 index 0000000..8f08b18 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/11-task-going.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/12-task-ready.png b/artifacts/drone-dock-ui-2026-11-05/comparison/12-task-ready.png new file mode 100644 index 0000000..f690d9d Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/12-task-ready.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/13-task-shooting.png b/artifacts/drone-dock-ui-2026-11-05/comparison/13-task-shooting.png new file mode 100644 index 0000000..2c6a835 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/13-task-shooting.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/14-task-paused.png b/artifacts/drone-dock-ui-2026-11-05/comparison/14-task-paused.png new file mode 100644 index 0000000..da60993 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/14-task-paused.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/15-task-returning.png b/artifacts/drone-dock-ui-2026-11-05/comparison/15-task-returning.png new file mode 100644 index 0000000..8f6e05a Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/15-task-returning.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/16-task-returned.png b/artifacts/drone-dock-ui-2026-11-05/comparison/16-task-returned.png new file mode 100644 index 0000000..e7cc000 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/16-task-returned.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/17-task-completed.png b/artifacts/drone-dock-ui-2026-11-05/comparison/17-task-completed.png new file mode 100644 index 0000000..70babd6 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/17-task-completed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/18-task-completion-dialog.png b/artifacts/drone-dock-ui-2026-11-05/comparison/18-task-completion-dialog.png new file mode 100644 index 0000000..96d608f Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/18-task-completion-dialog.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/19-task-failed.png b/artifacts/drone-dock-ui-2026-11-05/comparison/19-task-failed.png new file mode 100644 index 0000000..b1dd3be Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/19-task-failed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/20-task-pending-pause.png b/artifacts/drone-dock-ui-2026-11-05/comparison/20-task-pending-pause.png new file mode 100644 index 0000000..29afa37 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/20-task-pending-pause.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/21-materials.png b/artifacts/drone-dock-ui-2026-11-05/comparison/21-materials.png new file mode 100644 index 0000000..0b16c35 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/21-materials.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/22-material-preview.png b/artifacts/drone-dock-ui-2026-11-05/comparison/22-material-preview.png new file mode 100644 index 0000000..981e866 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/22-material-preview.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/23-delivery-method.png b/artifacts/drone-dock-ui-2026-11-05/comparison/23-delivery-method.png new file mode 100644 index 0000000..4e6b47c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/23-delivery-method.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/24-delivery-cloud.png b/artifacts/drone-dock-ui-2026-11-05/comparison/24-delivery-cloud.png new file mode 100644 index 0000000..722ca2c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/24-delivery-cloud.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/25-delivery-nearby.png b/artifacts/drone-dock-ui-2026-11-05/comparison/25-delivery-nearby.png new file mode 100644 index 0000000..deb8273 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/25-delivery-nearby.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/26-confirmation.png b/artifacts/drone-dock-ui-2026-11-05/comparison/26-confirmation.png new file mode 100644 index 0000000..07f0cbc Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/26-confirmation.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/27-confirmation-code.png b/artifacts/drone-dock-ui-2026-11-05/comparison/27-confirmation-code.png new file mode 100644 index 0000000..ad9a272 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/27-confirmation-code.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/comparison/28-confirmation-completed.png b/artifacts/drone-dock-ui-2026-11-05/comparison/28-confirmation-completed.png new file mode 100644 index 0000000..9089fe8 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/comparison/28-confirmation-completed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/index.html b/artifacts/drone-dock-ui-2026-11-05/index.html new file mode 100644 index 0000000..a34b79f --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/index.html @@ -0,0 +1,532 @@ + + +机巢控制台 · iOS / Android UI 对比 +

    机巢控制台 · iOS / Android

    2026-11-05 · 当前源码正式页面 · 隔离模拟数据

    左列 iOS,中列 Android,右列为推荐基准与理由;窄屏时建议显示在截图下方。点击截图可查看完整原图,两端按等宽展示。

    iOS 使用截图专用副本,仅加入依赖替身和启动入口,正式页面布局原样保留。Android 使用当前正式 Screen 与隔离测试替身。

    任务、设备、游客、图传均为本地模拟来源;两端模拟图传配置及业务数据可能不同,画面状态差异不能代表真实设备行为。二维码为本地测试图形,不对应真实付款或收货。

    推荐仅针对本次可见的布局、文案与操作层级。两端一致时保留各端;缺图或模拟状态不同的组注明待核对。系统导航、键盘与安全区遵循平台习惯。

    01 机巢工作台 三列图

    iOS1206 × 2622
    iOS 机巢工作台

    Android1080 × 1731
    Android 机巢工作台

    首屏

    02 工作台 · 统计区域 三列图

    iOS1206 × 2622
    iOS 工作台 · 统计区域

    Android1080 × 1731
    Android 工作台 · 统计区域

    向下滚动

    03 我的拍摄订单 三列图

    iOS1206 × 2622
    iOS 我的拍摄订单

    Android1080 × 1731
    Android 我的拍摄订单

    全部

    04 套餐收款 · 未选择套餐 三列图

    iOS1206 × 2622
    iOS 套餐收款 · 未选择套餐

    Android1080 × 1731
    Android 套餐收款 · 未选择套餐

    未选择套餐

    05 套餐收款 三列图

    iOS1206 × 2622
    iOS 套餐收款

    Android1080 × 1731
    Android 套餐收款

    已生成模拟码,页面滚动位置由现有测试保留

    06 套餐选择 单端补充 三列图

    iOS1206 × 2622
    iOS 套餐选择

    Android
    本次未提供该状态截图

    07 设置金额 单端补充 三列图

    iOS1206 × 2622
    iOS 设置金额

    Android
    本次未提供该状态截图

    08 收款记录 三列图

    iOS1206 × 2622
    iOS 收款记录

    Android1080 × 1731
    Android 收款记录

    近7天

    09 拍摄准备 三列图

    iOS1206 × 2622
    iOS 拍摄准备

    Android1080 × 1731
    Android 拍摄准备

    可召唤

    10 拍摄任务 · 起飞准备 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 起飞准备

    Android1080 × 1731
    Android 拍摄任务 · 起飞准备

    无人机正在赶来

    11 拍摄任务 · 前往点位 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 前往点位

    Android1080 × 1731
    Android 拍摄任务 · 前往点位

    无人机正在赶来

    12 拍摄任务 · 到达待开拍 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 到达待开拍

    Android1080 × 1731
    Android 拍摄任务 · 到达待开拍

    倒计时与手动开拍

    13 拍摄任务 · 拍摄中 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 拍摄中

    Android1080 × 1731
    Android 拍摄任务 · 拍摄中

    黑色区域为Mock接收器,无真实RTC/视频帧

    14 拍摄任务 · 手动暂停 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 手动暂停

    Android1080 × 1731
    Android 拍摄任务 · 手动暂停

    15 拍摄任务 · 返航中 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 返航中

    Android1080 × 1731
    Android 拍摄任务 · 返航中

    16 拍摄任务 · 已回巢 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 已回巢

    Android1080 × 1731
    Android 拍摄任务 · 已回巢

    中断任务失败

    17 拍摄任务 · 拍摄已完成 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 拍摄已完成

    模拟正常录制结束后返航,与Android完成面板样例保持一致;已关闭完成提示。

    Android1080 × 1731
    Android 拍摄任务 · 拍摄已完成

    正常返航

    18 拍摄任务 · 完成提示 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 完成提示

    Android1080 × 1920
    Android 拍摄任务 · 完成提示

    弹窗

    19 拍摄任务 · 失败 三列图

    iOS1206 × 2622
    iOS 拍摄任务 · 失败

    执行失败,等待设备确认回巢;右侧为中断后已回巢,模拟状态不同。

    Android1080 × 1731
    Android 拍摄任务 · 失败

    中断后已返回机巢,可重新召唤

    20 拍摄任务 · 暂停指令等待 单端补充 三列图

    iOS
    本次未提供该状态截图
    Android1080 × 1731
    Android 拍摄任务 · 暂停指令等待

    21 订单素材库 三列图

    iOS1206 × 2622
    iOS 订单素材库

    Android1080 × 1920
    Android 订单素材库

    首屏

    22 素材预览 三列图

    iOS1206 × 2622
    iOS 素材预览

    Android1080 × 1920
    Android 素材预览

    照片预览

    23 交付方式选择 三列图

    iOS1206 × 2622
    iOS 交付方式选择

    由工作台打开交付方式弹层。

    Android1080 × 1920
    Android 交付方式选择

    由订单素材库打开交付方式弹层。

    24 云端交付 三列图

    iOS1206 × 2622
    iOS 云端交付

    Android1080 × 1920
    Android 云端交付

    未选视频

    25 面对面闪传 三列图

    iOS1206 × 2622
    iOS 面对面闪传

    Android1080 × 1920
    Android 面对面闪传

    未选视频

    26 订单交付确认 三列图

    iOS1206 × 2622
    iOS 订单交付确认

    Android1080 × 1920
    Android 订单交付确认

    待确认交齐

    27 确认收货二维码 三列图

    iOS1206 × 2622
    iOS 确认收货二维码

    Android1080 × 1920
    Android 确认收货二维码

    等待游客确认

    28 订单交付确认 · 已完成 三列图

    iOS1206 × 2622
    iOS 订单交付确认 · 已完成

    Android1080 × 1920
    Android 订单交付确认 · 已完成

    已完成整单确认

    运行环境和截图来源
    {
    +  "ios": {
    +    "platform": "iOS",
    +    "captureDate": "2026-11-05",
    +    "device": "iPhone 18 Pro · iOS 27.2 Simulator",
    +    "resolution": "1206×2622",
    +    "sourceRepository": "/Users/hanqiu/Desktop/suixinkan",
    +    "sourceCopy": "/private/tmp/suixinkan-ui-source-20261105",
    +    "buildConfiguration": "SimulatorDebug",
    +    "sourceNotes": "当前源码含用户已有未提交修改;隔离副本仅增加启动入口与依赖替身,正式页面布局代码保持原样。假数据及本地图片用于UI对照,不表示真实任务或设备。所有设备写操作抛取消,RTC播放器为No-op。",
    +    "screenshots": [
    +      {
    +        "key": "home",
    +        "title": "机巢工作台",
    +        "filename": "workbench.png",
    +        "launchArgument": "--dock-capture=workbench",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "0fa14de668cdcc323d65bf8a7133856bd8143584866c21fa122cf3ae058e05a4"
    +      },
    +      {
    +        "key": "orders",
    +        "title": "我的拍摄订单",
    +        "filename": "orders.png",
    +        "launchArgument": "--dock-capture=orders",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "17f1e5d8d1d92202cc7fc227ed935f0a00822b4d9a418950fbd3cb5942a9a4e9"
    +      },
    +      {
    +        "key": "payment-empty",
    +        "title": "套餐收款·未选套餐",
    +        "filename": "payment-before-selection.png",
    +        "launchArgument": "--dock-capture=payment-before-selection",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "91e70d2eaefce1967b2027e149ea423c07f1befc5a99422980330789f440e27b"
    +      },
    +      {
    +        "key": "payment",
    +        "title": "套餐收款",
    +        "filename": "payment.png",
    +        "launchArgument": "--dock-capture=payment",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "31b23f0f0195efd5154013932d6288c06f8617a9e4a1c6ac9be15fd364a4d4dd"
    +      },
    +      {
    +        "key": "receipts",
    +        "title": "收款记录",
    +        "filename": "receipts.png",
    +        "launchArgument": "--dock-capture=receipts",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "7b9b5426389dad6abf91e6c24b0cc9618e7b86ce9aab692c18149791a7f426d0"
    +      },
    +      {
    +        "key": "preparation",
    +        "title": "拍摄准备",
    +        "filename": "preparation.png",
    +        "launchArgument": "--dock-capture=preparation",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "ff6a5ca80a994396419b389f1f1ab7c9eb97a4f064625107f7cfe278ff5f2e19"
    +      },
    +      {
    +        "key": "task-starting",
    +        "filename": "task-starting.png",
    +        "launchArgument": "--dock-capture=task-starting",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "a02e8fc4d27d43705440893e63e1b30ce4b902ebcf94093ea8ff2ed3f50fa4a8"
    +      },
    +      {
    +        "key": "task-ready",
    +        "filename": "task-ready.png",
    +        "launchArgument": "--dock-capture=task-ready",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "8498671d0a762c6e8b34af1343a28787c86544a04ef10a8a48cfe3166a99182c"
    +      },
    +      {
    +        "key": "task-going",
    +        "filename": "task-going.png",
    +        "launchArgument": "--dock-capture=task-going",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "d129b427094a78a6162441e445a4913e14364479d09cfc684d6456bc72c9a4d8"
    +      },
    +      {
    +        "key": "task-shooting",
    +        "filename": "task-shooting.png",
    +        "launchArgument": "--dock-capture=task-shooting",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "bc16903fd3d9b5a2571d175d35b738ad2838b0ff33e9436a633a25a899726f5a"
    +      },
    +      {
    +        "key": "task-paused",
    +        "filename": "task-paused.png",
    +        "launchArgument": "--dock-capture=task-paused",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "05fba4484ac1b577b1c68caa8ed29a040d824a258746e498e3fa3f424dd23d74"
    +      },
    +      {
    +        "key": "task-returning",
    +        "filename": "task-returning.png",
    +        "launchArgument": "--dock-capture=task-returning",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "d333800b9cb67e9eae4762419ca18fee2b014b1c3e60cf7650fa68bd04944efc"
    +      },
    +      {
    +        "key": "task-returned",
    +        "filename": "task-returned.png",
    +        "launchArgument": "--dock-capture=task-returned",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "26a7a5561156d33bf2bf6c9eb96834acf8c90342e45ff62945ae5ba9b37d37be"
    +      },
    +      {
    +        "key": "task-failed",
    +        "filename": "task-failed.png",
    +        "launchArgument": "--dock-capture=task-failed",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "de1e41ea23627669bcdee70af8d92a2e6208b88a3f45b30af445dee2f644ce1a"
    +      },
    +      {
    +        "key": "task-completion-dialog",
    +        "filename": "task-completion-dialog.png",
    +        "launchArgument": "--dock-capture=task-completion-dialog",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "c927ca4ea1a1ddfc110c2638fe5545ad7906fa63062f093b9aaf3f06df3d4594"
    +      },
    +      {
    +        "key": "materials",
    +        "title": "订单素材库",
    +        "filename": "materials.png",
    +        "launchArgument": "--dock-capture=materials",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "08ba9c88b342b72ab78bb60054b20259fa06255bb0856c123b90100bc82a98a5"
    +      },
    +      {
    +        "key": "confirmation",
    +        "title": "订单交付确认",
    +        "filename": "confirmation-manifest.png",
    +        "launchArgument": "--dock-capture=confirmation-manifest",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "09297899efd9484be09cf0d493e2bb905e9ae90bca2da01c8010060150ae29aa"
    +      },
    +      {
    +        "key": "confirmation-completed",
    +        "title": "订单交付确认·已完成",
    +        "filename": "confirmation-confirmed.png",
    +        "launchArgument": "--dock-capture=confirmation-confirmed",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络",
    +        "sha256": "de9b1192051747ae941f626d56af3a74838a8e6aa9a6afc5c330f01c4e625cd5"
    +      },
    +      {
    +        "key": "delivery-method",
    +        "filename": "delivery-methods.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=delivery-methods",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "61de3cbdbf387f41a4312b5febb1086487f59f16f3096ffd811eed2691a6df24"
    +      },
    +      {
    +        "key": "delivery-cloud",
    +        "filename": "delivery-cloud.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=delivery-cloud",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "adc745ef1bb7f505ec66306d3bb6ba05b9e60ef32b360db94aab5a3902697790"
    +      },
    +      {
    +        "key": "delivery-nearby",
    +        "filename": "delivery-nearby.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=delivery-nearby",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "b25e1f8c1fd0718ef249348e94d4ccc42ed585413ee31ccd41d8673b9af85c99"
    +      },
    +      {
    +        "key": "statistics",
    +        "filename": "workbench-statistics.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=workbench-statistics",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "7c28b3c0453228cc7be14bff30107ca99587e307066e21baee12f5cfacfad776"
    +      },
    +      {
    +        "key": "material-preview",
    +        "filename": "material-preview.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=material-preview",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "6b2a498955c49122f71a5c5fa26280885c7c13e6bb4c9c4c94e6c835b754614b"
    +      },
    +      {
    +        "key": "confirmation-code",
    +        "filename": "confirmation-code.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=confirmation-code",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "df7f1f97c5f5bf8dec7c7f8ecd5ce73b5b2aad4c73d943fa5b508e4a34f58800"
    +      },
    +      {
    +        "key": "project-picker",
    +        "filename": "payment-picker.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=payment-picker",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "74028c8d17eca884ed3998ef55e4bd59bc8b48344e635e9126e163f955b3f8a8"
    +      },
    +      {
    +        "key": "amount-edit",
    +        "filename": "amount-edit.png",
    +        "dimensions": "1206×2622",
    +        "launchArgument": "--dock-capture=amount-edit",
    +        "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样",
    +        "sha256": "57f5cff298d349043b0542e9c6a531c7ff40d0af4e80ddd4f6e3f7d2513e985e"
    +      },
    +      {
    +        "key": "task-completed",
    +        "filename": "task-completed.png",
    +        "dimensions": "1206×2622",
    +        "source": "当前正式UIKit页面,隔离内存服务,由正式界面交互进入",
    +        "sha256": "5b768c64eeeec791c2a76b47e4a5ba94acea363e0a9adb6f63c7db3348be2f66",
    +        "note": "模拟正常录制结束后返航,与Android完成面板样例保持一致;已关闭完成提示。"
    +      }
    +    ],
    +    "notes": [
    +      "图传为No-op播放器且无图传服务,不能用黑区的不可用文案推断真实图传UI一致性。",
    +      "付款/收货码为本地图形,不对应真实业务。",
    +      "封面/素材为本地演示图片,页面布局来自当前正式UIKit控制器。",
    +      "delivery-cloud/delivery-nearby通过正式交付方式sheet进入;其余主体使用同一正式导航控制器。"
    +    ],
    +    "verification": {
    +      "allPngsValid": true,
    +      "screenshots": 27,
    +      "statusBarClockPixels": "所有原图左上时钟区域均完整存在,视图预览缩放不能作为裁切判断依据。"
    +    }
    +  },
    +  "android": {
    +    "platform": "Android",
    +    "capturedAt": "2026-11-05",
    +    "repository": "/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow",
    +    "commit": "faebb982",
    +    "build": "Debug 9.9.1.20261105_112138; zhifly.bundle.youfun=false",
    +    "device": "独立 Android API 26 AVD CodexProfileSettings; emulator-5560/5680; 1080×1920; 420 dpi",
    +    "source": "正式RemoteDrone* Screen,已包含当前未提交UI改动;使用隔离测试数据,无真实飞控/任务/live/RTC。",
    +    "screenshots": [
    +      {
    +        "filename": "dock-confirmation-code.png",
    +        "pageKey": "confirmation-code",
    +        "title": "订单确认码",
    +        "state": "等待游客确认",
    +        "note": "等待游客确认",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-confirmation-completed.png",
    +        "pageKey": "confirmation-completed",
    +        "title": "订单交付确认·完成",
    +        "state": "已完成整单确认",
    +        "note": "已完成整单确认",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-confirmation-manifest.png",
    +        "pageKey": "delivery-review",
    +        "title": "整单交付清单",
    +        "state": "待确认交齐",
    +        "note": "待确认交齐",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-delivery-cloud.png",
    +        "pageKey": "delivery-cloud",
    +        "title": "云端上传",
    +        "state": "未选视频",
    +        "note": "未选视频",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-delivery-methods.png",
    +        "pageKey": "delivery-method",
    +        "title": "交付成片·交付方式",
    +        "state": "底部弹层",
    +        "note": "底部弹层",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-delivery-nearby.png",
    +        "pageKey": "delivery-nearby",
    +        "title": "面对面闪传",
    +        "state": "未选视频",
    +        "note": "未选视频",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-material-preview.png",
    +        "pageKey": "material-preview",
    +        "title": "素材预览",
    +        "state": "照片预览",
    +        "note": "照片预览",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-materials.png",
    +        "pageKey": "materials",
    +        "title": "订单素材库",
    +        "state": "首屏",
    +        "note": "首屏",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "dock-orders.png",
    +        "pageKey": "orders",
    +        "title": "我的拍摄订单",
    +        "state": "全部",
    +        "note": "全部",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-payment-before-selection.png",
    +        "pageKey": "payment-unselected",
    +        "title": "收款详情·未选套餐",
    +        "state": "未选择套餐",
    +        "note": "未选择套餐",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-payment.png",
    +        "pageKey": "payment",
    +        "title": "收款详情",
    +        "state": "已生成模拟码,页面滚动位置由现有测试保留",
    +        "note": "已生成模拟码,页面滚动位置由现有测试保留",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-preparation.png",
    +        "pageKey": "preparation",
    +        "title": "拍摄准备",
    +        "state": "可召唤",
    +        "note": "可召唤",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-receipts.png",
    +        "pageKey": "receipts",
    +        "title": "收款记录",
    +        "state": "近7天",
    +        "note": "近7天",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-workbench-statistics.png",
    +        "pageKey": "workbench-stats",
    +        "title": "机巢工作台·今日统计",
    +        "state": "向下滚动",
    +        "note": "向下滚动",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "dock-workbench.png",
    +        "pageKey": "workbench",
    +        "title": "机巢工作台",
    +        "state": "首屏",
    +        "note": "首屏",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-completion-dialog.png",
    +        "pageKey": "task-completion-dialog",
    +        "title": "拍摄完成提示",
    +        "state": "弹窗",
    +        "note": "弹窗",
    +        "width": 1080,
    +        "height": 1920,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-control-paused.png",
    +        "pageKey": "task-paused",
    +        "title": "拍摄任务·手动暂停",
    +        "state": "",
    +        "note": "",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-control-pending-pause.png",
    +        "pageKey": "task-pending-pause",
    +        "title": "拍摄任务·暂停待确认",
    +        "state": "",
    +        "note": "",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-control-returned.png",
    +        "pageKey": "task-returned",
    +        "title": "拍摄任务·已返回机巢",
    +        "state": "中断任务失败",
    +        "note": "中断任务失败",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-control-returning.png",
    +        "pageKey": "task-returning",
    +        "title": "拍摄任务·手动返航",
    +        "state": "",
    +        "note": "",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-control-starting.png",
    +        "pageKey": "task-starting",
    +        "title": "拍摄任务·起飞准备",
    +        "state": "无人机正在赶来",
    +        "note": "无人机正在赶来",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-failed.png",
    +        "pageKey": "task-failed",
    +        "title": "拍摄任务·失败",
    +        "state": "中断后已返回机巢,可重新召唤",
    +        "note": "中断后已返回机巢,可重新召唤",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "task-going.png",
    +        "pageKey": "task-going",
    +        "title": "拍摄任务·前往点位",
    +        "state": "无人机正在赶来",
    +        "note": "无人机正在赶来",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用"
    +      },
    +      {
    +        "filename": "task-ready.png",
    +        "pageKey": "task-ready",
    +        "title": "拍摄任务·到点等待",
    +        "state": "倒计时与手动开拍",
    +        "note": "倒计时与手动开拍",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-returning-complete.png",
    +        "pageKey": "task-complete",
    +        "title": "拍摄任务·拍摄已完成",
    +        "state": "正常返航",
    +        "note": "正常返航",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      },
    +      {
    +        "filename": "task-shooting.png",
    +        "pageKey": "task-shooting",
    +        "title": "拍摄任务·拍摄中",
    +        "state": "黑色区域为Mock接收器,无真实RTC/视频帧",
    +        "note": "黑色区域为Mock接收器,无真实RTC/视频帧",
    +        "width": 1080,
    +        "height": 1731,
    +        "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身"
    +      }
    +    ],
    +    "validation": "工作台/收款/任务原有17用例通过;素材原有截图类依赖loopback网络与旧文案,截图专用临时类改为Coil内存图片及当前控件选择器后,最终4个补截用例全部通过。所有业务源码保持未改动。"
    +  }
    +}
    \ No newline at end of file diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/amount-edit.png b/artifacts/drone-dock-ui-2026-11-05/ios/amount-edit.png new file mode 100644 index 0000000..69d5f4c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/amount-edit.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-code.png b/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-code.png new file mode 100644 index 0000000..c2c6e33 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-code.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-confirmed.png b/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-confirmed.png new file mode 100644 index 0000000..f036120 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-confirmed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-manifest.png b/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-manifest.png new file mode 100644 index 0000000..dd02464 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/confirmation-manifest.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/delivery-cloud.png b/artifacts/drone-dock-ui-2026-11-05/ios/delivery-cloud.png new file mode 100644 index 0000000..d71c547 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/delivery-cloud.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/delivery-methods.png b/artifacts/drone-dock-ui-2026-11-05/ios/delivery-methods.png new file mode 100644 index 0000000..a144f6c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/delivery-methods.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/delivery-nearby.png b/artifacts/drone-dock-ui-2026-11-05/ios/delivery-nearby.png new file mode 100644 index 0000000..bd422f6 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/delivery-nearby.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/manifest.json b/artifacts/drone-dock-ui-2026-11-05/ios/manifest.json new file mode 100644 index 0000000..a658678 --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/ios/manifest.json @@ -0,0 +1,248 @@ +{ + "platform": "iOS", + "captureDate": "2026-11-05", + "device": "iPhone 18 Pro · iOS 27.2 Simulator", + "resolution": "1206×2622", + "sourceRepository": "/Users/hanqiu/Desktop/suixinkan", + "sourceCopy": "/private/tmp/suixinkan-ui-source-20261105", + "buildConfiguration": "SimulatorDebug", + "sourceNotes": "当前源码含用户已有未提交修改;隔离副本仅增加启动入口与依赖替身,正式页面布局代码保持原样。假数据及本地图片用于UI对照,不表示真实任务或设备。所有设备写操作抛取消,RTC播放器为No-op。", + "screenshots": [ + { + "key": "home", + "title": "机巢工作台", + "filename": "workbench.png", + "launchArgument": "--dock-capture=workbench", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "0fa14de668cdcc323d65bf8a7133856bd8143584866c21fa122cf3ae058e05a4" + }, + { + "key": "orders", + "title": "我的拍摄订单", + "filename": "orders.png", + "launchArgument": "--dock-capture=orders", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "17f1e5d8d1d92202cc7fc227ed935f0a00822b4d9a418950fbd3cb5942a9a4e9" + }, + { + "key": "payment-empty", + "title": "套餐收款·未选套餐", + "filename": "payment-before-selection.png", + "launchArgument": "--dock-capture=payment-before-selection", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "91e70d2eaefce1967b2027e149ea423c07f1befc5a99422980330789f440e27b" + }, + { + "key": "payment", + "title": "套餐收款", + "filename": "payment.png", + "launchArgument": "--dock-capture=payment", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "31b23f0f0195efd5154013932d6288c06f8617a9e4a1c6ac9be15fd364a4d4dd" + }, + { + "key": "receipts", + "title": "收款记录", + "filename": "receipts.png", + "launchArgument": "--dock-capture=receipts", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "7b9b5426389dad6abf91e6c24b0cc9618e7b86ce9aab692c18149791a7f426d0" + }, + { + "key": "preparation", + "title": "拍摄准备", + "filename": "preparation.png", + "launchArgument": "--dock-capture=preparation", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "ff6a5ca80a994396419b389f1f1ab7c9eb97a4f064625107f7cfe278ff5f2e19" + }, + { + "key": "task-starting", + "filename": "task-starting.png", + "launchArgument": "--dock-capture=task-starting", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "a02e8fc4d27d43705440893e63e1b30ce4b902ebcf94093ea8ff2ed3f50fa4a8" + }, + { + "key": "task-ready", + "filename": "task-ready.png", + "launchArgument": "--dock-capture=task-ready", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "8498671d0a762c6e8b34af1343a28787c86544a04ef10a8a48cfe3166a99182c" + }, + { + "key": "task-going", + "filename": "task-going.png", + "launchArgument": "--dock-capture=task-going", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "d129b427094a78a6162441e445a4913e14364479d09cfc684d6456bc72c9a4d8" + }, + { + "key": "task-shooting", + "filename": "task-shooting.png", + "launchArgument": "--dock-capture=task-shooting", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "bc16903fd3d9b5a2571d175d35b738ad2838b0ff33e9436a633a25a899726f5a" + }, + { + "key": "task-paused", + "filename": "task-paused.png", + "launchArgument": "--dock-capture=task-paused", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "05fba4484ac1b577b1c68caa8ed29a040d824a258746e498e3fa3f424dd23d74" + }, + { + "key": "task-returning", + "filename": "task-returning.png", + "launchArgument": "--dock-capture=task-returning", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "d333800b9cb67e9eae4762419ca18fee2b014b1c3e60cf7650fa68bd04944efc" + }, + { + "key": "task-returned", + "filename": "task-returned.png", + "launchArgument": "--dock-capture=task-returned", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "26a7a5561156d33bf2bf6c9eb96834acf8c90342e45ff62945ae5ba9b37d37be" + }, + { + "key": "task-failed", + "filename": "task-failed.png", + "launchArgument": "--dock-capture=task-failed", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "de1e41ea23627669bcdee70af8d92a2e6208b88a3f45b30af445dee2f644ce1a" + }, + { + "key": "task-completion-dialog", + "filename": "task-completion-dialog.png", + "launchArgument": "--dock-capture=task-completion-dialog", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "c927ca4ea1a1ddfc110c2638fe5545ad7906fa63062f093b9aaf3f06df3d4594" + }, + { + "key": "materials", + "title": "订单素材库", + "filename": "materials.png", + "launchArgument": "--dock-capture=materials", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "08ba9c88b342b72ab78bb60054b20259fa06255bb0856c123b90100bc82a98a5" + }, + { + "key": "confirmation", + "title": "订单交付确认", + "filename": "confirmation-manifest.png", + "launchArgument": "--dock-capture=confirmation-manifest", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "09297899efd9484be09cf0d493e2bb905e9ae90bca2da01c8010060150ae29aa" + }, + { + "key": "confirmation-completed", + "title": "订单交付确认·已完成", + "filename": "confirmation-confirmed.png", + "launchArgument": "--dock-capture=confirmation-confirmed", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "de9b1192051747ae941f626d56af3a74838a8e6aa9a6afc5c330f01c4e625cd5" + }, + { + "key": "delivery-method", + "filename": "delivery-methods.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=delivery-methods", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "61de3cbdbf387f41a4312b5febb1086487f59f16f3096ffd811eed2691a6df24" + }, + { + "key": "delivery-cloud", + "filename": "delivery-cloud.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=delivery-cloud", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "adc745ef1bb7f505ec66306d3bb6ba05b9e60ef32b360db94aab5a3902697790" + }, + { + "key": "delivery-nearby", + "filename": "delivery-nearby.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=delivery-nearby", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "b25e1f8c1fd0718ef249348e94d4ccc42ed585413ee31ccd41d8673b9af85c99" + }, + { + "key": "statistics", + "filename": "workbench-statistics.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=workbench-statistics", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "7c28b3c0453228cc7be14bff30107ca99587e307066e21baee12f5cfacfad776" + }, + { + "key": "material-preview", + "filename": "material-preview.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=material-preview", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "6b2a498955c49122f71a5c5fa26280885c7c13e6bb4c9c4c94e6c835b754614b" + }, + { + "key": "confirmation-code", + "filename": "confirmation-code.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=confirmation-code", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "df7f1f97c5f5bf8dec7c7f8ecd5ce73b5b2aad4c73d943fa5b508e4a34f58800" + }, + { + "key": "project-picker", + "filename": "payment-picker.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=payment-picker", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "74028c8d17eca884ed3998ef55e4bd59bc8b48344e635e9126e163f955b3f8a8" + }, + { + "key": "amount-edit", + "filename": "amount-edit.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=amount-edit", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "57f5cff298d349043b0542e9c6a531c7ff40d0af4e80ddd4f6e3f7d2513e985e" + }, + { + "key": "task-completed", + "filename": "task-completed.png", + "dimensions": "1206×2622", + "source": "当前正式UIKit页面,隔离内存服务,由正式界面交互进入", + "sha256": "5b768c64eeeec791c2a76b47e4a5ba94acea363e0a9adb6f63c7db3348be2f66", + "note": "模拟正常录制结束后返航,与Android完成面板样例保持一致;已关闭完成提示。" + } + ], + "notes": [ + "图传为No-op播放器且无图传服务,不能用黑区的不可用文案推断真实图传UI一致性。", + "付款/收货码为本地图形,不对应真实业务。", + "封面/素材为本地演示图片,页面布局来自当前正式UIKit控制器。", + "delivery-cloud/delivery-nearby通过正式交付方式sheet进入;其余主体使用同一正式导航控制器。" + ], + "verification": { + "allPngsValid": true, + "screenshots": 27, + "statusBarClockPixels": "所有原图左上时钟区域均完整存在,视图预览缩放不能作为裁切判断依据。" + } +} \ No newline at end of file diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/material-preview.png b/artifacts/drone-dock-ui-2026-11-05/ios/material-preview.png new file mode 100644 index 0000000..ad4eaca Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/material-preview.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/materials.png b/artifacts/drone-dock-ui-2026-11-05/ios/materials.png new file mode 100644 index 0000000..3a0b182 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/materials.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/orders.png b/artifacts/drone-dock-ui-2026-11-05/ios/orders.png new file mode 100644 index 0000000..0525fa7 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/orders.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/payment-before-selection.png b/artifacts/drone-dock-ui-2026-11-05/ios/payment-before-selection.png new file mode 100644 index 0000000..e2883ed Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/payment-before-selection.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/payment-picker.png b/artifacts/drone-dock-ui-2026-11-05/ios/payment-picker.png new file mode 100644 index 0000000..45fa252 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/payment-picker.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/payment.png b/artifacts/drone-dock-ui-2026-11-05/ios/payment.png new file mode 100644 index 0000000..59d8b67 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/payment.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/preparation.png b/artifacts/drone-dock-ui-2026-11-05/ios/preparation.png new file mode 100644 index 0000000..942186d Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/preparation.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/receipts.png b/artifacts/drone-dock-ui-2026-11-05/ios/receipts.png new file mode 100644 index 0000000..8b66013 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/receipts.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/source.json b/artifacts/drone-dock-ui-2026-11-05/ios/source.json new file mode 100644 index 0000000..30c1b1e --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/ios/source.json @@ -0,0 +1,12 @@ +{ + "sourceHead": "34ee60b8b250499bf5def792f964492f4d0e69d0", + "originalWorktreeChanges": [ + " M suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift", + " M suixinkanTests/DroneDockCommandViewTests.swift", + " M suixinkanTests/DroneDockTaskControlStateViewTests.swift", + "?? artifacts/" + ], + "copiedSourceSha256": { + "suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift": "77aaa2b074cda6497be74a0e9a92cccd0c1b51df4260f50ad9b6faed3a8d4644" + } +} \ No newline at end of file diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-completed.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-completed.png new file mode 100644 index 0000000..61d1b45 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-completed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-completion-dialog.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-completion-dialog.png new file mode 100644 index 0000000..659836c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-completion-dialog.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-failed.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-failed.png new file mode 100644 index 0000000..2a5445c Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-failed.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-going.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-going.png new file mode 100644 index 0000000..c587357 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-going.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-paused.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-paused.png new file mode 100644 index 0000000..460cf8e Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-paused.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-ready.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-ready.png new file mode 100644 index 0000000..086e171 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-ready.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-returned.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-returned.png new file mode 100644 index 0000000..334855e Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-returned.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-returning.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-returning.png new file mode 100644 index 0000000..cdc4345 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-returning.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-shooting.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-shooting.png new file mode 100644 index 0000000..c043ad6 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-shooting.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/task-starting.png b/artifacts/drone-dock-ui-2026-11-05/ios/task-starting.png new file mode 100644 index 0000000..d7eaa14 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/task-starting.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/workbench-statistics.png b/artifacts/drone-dock-ui-2026-11-05/ios/workbench-statistics.png new file mode 100644 index 0000000..94e71d6 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/workbench-statistics.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/ios/workbench.png b/artifacts/drone-dock-ui-2026-11-05/ios/workbench.png new file mode 100644 index 0000000..66cd03a Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/ios/workbench.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/manifest.json b/artifacts/drone-dock-ui-2026-11-05/manifest.json new file mode 100644 index 0000000..a23fe49 --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/manifest.json @@ -0,0 +1,1551 @@ +{ + "title": "机巢控制台 iOS / Android UI 对比", + "capture_date": "2026-11-05", + "source": "当前正式页面 + 隔离模拟数据", + "platforms": { + "ios": { + "platform": "iOS", + "captureDate": "2026-11-05", + "device": "iPhone 18 Pro · iOS 27.2 Simulator", + "resolution": "1206×2622", + "sourceRepository": "/Users/hanqiu/Desktop/suixinkan", + "sourceCopy": "/private/tmp/suixinkan-ui-source-20261105", + "buildConfiguration": "SimulatorDebug", + "sourceNotes": "当前源码含用户已有未提交修改;隔离副本仅增加启动入口与依赖替身,正式页面布局代码保持原样。假数据及本地图片用于UI对照,不表示真实任务或设备。所有设备写操作抛取消,RTC播放器为No-op。", + "screenshots": [ + { + "key": "home", + "title": "机巢工作台", + "filename": "workbench.png", + "launchArgument": "--dock-capture=workbench", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "0fa14de668cdcc323d65bf8a7133856bd8143584866c21fa122cf3ae058e05a4" + }, + { + "key": "orders", + "title": "我的拍摄订单", + "filename": "orders.png", + "launchArgument": "--dock-capture=orders", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "17f1e5d8d1d92202cc7fc227ed935f0a00822b4d9a418950fbd3cb5942a9a4e9" + }, + { + "key": "payment-empty", + "title": "套餐收款·未选套餐", + "filename": "payment-before-selection.png", + "launchArgument": "--dock-capture=payment-before-selection", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "91e70d2eaefce1967b2027e149ea423c07f1befc5a99422980330789f440e27b" + }, + { + "key": "payment", + "title": "套餐收款", + "filename": "payment.png", + "launchArgument": "--dock-capture=payment", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "31b23f0f0195efd5154013932d6288c06f8617a9e4a1c6ac9be15fd364a4d4dd" + }, + { + "key": "receipts", + "title": "收款记录", + "filename": "receipts.png", + "launchArgument": "--dock-capture=receipts", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "7b9b5426389dad6abf91e6c24b0cc9618e7b86ce9aab692c18149791a7f426d0" + }, + { + "key": "preparation", + "title": "拍摄准备", + "filename": "preparation.png", + "launchArgument": "--dock-capture=preparation", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "ff6a5ca80a994396419b389f1f1ab7c9eb97a4f064625107f7cfe278ff5f2e19" + }, + { + "key": "task-starting", + "filename": "task-starting.png", + "launchArgument": "--dock-capture=task-starting", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "a02e8fc4d27d43705440893e63e1b30ce4b902ebcf94093ea8ff2ed3f50fa4a8" + }, + { + "key": "task-ready", + "filename": "task-ready.png", + "launchArgument": "--dock-capture=task-ready", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "8498671d0a762c6e8b34af1343a28787c86544a04ef10a8a48cfe3166a99182c" + }, + { + "key": "task-going", + "filename": "task-going.png", + "launchArgument": "--dock-capture=task-going", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "d129b427094a78a6162441e445a4913e14364479d09cfc684d6456bc72c9a4d8" + }, + { + "key": "task-shooting", + "filename": "task-shooting.png", + "launchArgument": "--dock-capture=task-shooting", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "bc16903fd3d9b5a2571d175d35b738ad2838b0ff33e9436a633a25a899726f5a" + }, + { + "key": "task-paused", + "filename": "task-paused.png", + "launchArgument": "--dock-capture=task-paused", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "05fba4484ac1b577b1c68caa8ed29a040d824a258746e498e3fa3f424dd23d74" + }, + { + "key": "task-returning", + "filename": "task-returning.png", + "launchArgument": "--dock-capture=task-returning", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "d333800b9cb67e9eae4762419ca18fee2b014b1c3e60cf7650fa68bd04944efc" + }, + { + "key": "task-returned", + "filename": "task-returned.png", + "launchArgument": "--dock-capture=task-returned", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "26a7a5561156d33bf2bf6c9eb96834acf8c90342e45ff62945ae5ba9b37d37be" + }, + { + "key": "task-failed", + "filename": "task-failed.png", + "launchArgument": "--dock-capture=task-failed", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "de1e41ea23627669bcdee70af8d92a2e6208b88a3f45b30af445dee2f644ce1a" + }, + { + "key": "task-completion-dialog", + "filename": "task-completion-dialog.png", + "launchArgument": "--dock-capture=task-completion-dialog", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "c927ca4ea1a1ddfc110c2638fe5545ad7906fa63062f093b9aaf3f06df3d4594" + }, + { + "key": "materials", + "title": "订单素材库", + "filename": "materials.png", + "launchArgument": "--dock-capture=materials", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "08ba9c88b342b72ab78bb60054b20259fa06255bb0856c123b90100bc82a98a5" + }, + { + "key": "confirmation", + "title": "订单交付确认", + "filename": "confirmation-manifest.png", + "launchArgument": "--dock-capture=confirmation-manifest", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "09297899efd9484be09cf0d493e2bb905e9ae90bca2da01c8010060150ae29aa" + }, + { + "key": "confirmation-completed", + "title": "订单交付确认·已完成", + "filename": "confirmation-confirmed.png", + "launchArgument": "--dock-capture=confirmation-confirmed", + "dimensions": "1206×2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "de9b1192051747ae941f626d56af3a74838a8e6aa9a6afc5c330f01c4e625cd5" + }, + { + "key": "delivery-method", + "filename": "delivery-methods.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=delivery-methods", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "61de3cbdbf387f41a4312b5febb1086487f59f16f3096ffd811eed2691a6df24" + }, + { + "key": "delivery-cloud", + "filename": "delivery-cloud.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=delivery-cloud", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "adc745ef1bb7f505ec66306d3bb6ba05b9e60ef32b360db94aab5a3902697790" + }, + { + "key": "delivery-nearby", + "filename": "delivery-nearby.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=delivery-nearby", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "b25e1f8c1fd0718ef249348e94d4ccc42ed585413ee31ccd41d8673b9af85c99" + }, + { + "key": "statistics", + "filename": "workbench-statistics.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=workbench-statistics", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "7c28b3c0453228cc7be14bff30107ca99587e307066e21baee12f5cfacfad776" + }, + { + "key": "material-preview", + "filename": "material-preview.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=material-preview", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "6b2a498955c49122f71a5c5fa26280885c7c13e6bb4c9c4c94e6c835b754614b" + }, + { + "key": "confirmation-code", + "filename": "confirmation-code.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=confirmation-code", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "df7f1f97c5f5bf8dec7c7f8ecd5ce73b5b2aad4c73d943fa5b508e4a34f58800" + }, + { + "key": "project-picker", + "filename": "payment-picker.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=payment-picker", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "74028c8d17eca884ed3998ef55e4bd59bc8b48344e635e9126e163f955b3f8a8" + }, + { + "key": "amount-edit", + "filename": "amount-edit.png", + "dimensions": "1206×2622", + "launchArgument": "--dock-capture=amount-edit", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "57f5cff298d349043b0542e9c6a531c7ff40d0af4e80ddd4f6e3f7d2513e985e" + }, + { + "key": "task-completed", + "filename": "task-completed.png", + "dimensions": "1206×2622", + "source": "当前正式UIKit页面,隔离内存服务,由正式界面交互进入", + "sha256": "5b768c64eeeec791c2a76b47e4a5ba94acea363e0a9adb6f63c7db3348be2f66", + "note": "模拟正常录制结束后返航,与Android完成面板样例保持一致;已关闭完成提示。" + } + ], + "notes": [ + "图传为No-op播放器且无图传服务,不能用黑区的不可用文案推断真实图传UI一致性。", + "付款/收货码为本地图形,不对应真实业务。", + "封面/素材为本地演示图片,页面布局来自当前正式UIKit控制器。", + "delivery-cloud/delivery-nearby通过正式交付方式sheet进入;其余主体使用同一正式导航控制器。" + ], + "verification": { + "allPngsValid": true, + "screenshots": 27, + "statusBarClockPixels": "所有原图左上时钟区域均完整存在,视图预览缩放不能作为裁切判断依据。" + } + }, + "android": { + "platform": "Android", + "capturedAt": "2026-11-05", + "repository": "/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow", + "commit": "faebb982", + "build": "Debug 9.9.1.20261105_112138; zhifly.bundle.youfun=false", + "device": "独立 Android API 26 AVD CodexProfileSettings; emulator-5560/5680; 1080×1920; 420 dpi", + "source": "正式RemoteDrone* Screen,已包含当前未提交UI改动;使用隔离测试数据,无真实飞控/任务/live/RTC。", + "screenshots": [ + { + "filename": "dock-confirmation-code.png", + "pageKey": "confirmation-code", + "title": "订单确认码", + "state": "等待游客确认", + "note": "等待游客确认", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-confirmation-completed.png", + "pageKey": "confirmation-completed", + "title": "订单交付确认·完成", + "state": "已完成整单确认", + "note": "已完成整单确认", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "dock-confirmation-manifest.png", + "pageKey": "delivery-review", + "title": "整单交付清单", + "state": "待确认交齐", + "note": "待确认交齐", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-delivery-cloud.png", + "pageKey": "delivery-cloud", + "title": "云端上传", + "state": "未选视频", + "note": "未选视频", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "dock-delivery-methods.png", + "pageKey": "delivery-method", + "title": "交付成片·交付方式", + "state": "底部弹层", + "note": "底部弹层", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-delivery-nearby.png", + "pageKey": "delivery-nearby", + "title": "面对面闪传", + "state": "未选视频", + "note": "未选视频", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "dock-material-preview.png", + "pageKey": "material-preview", + "title": "素材预览", + "state": "照片预览", + "note": "照片预览", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-materials.png", + "pageKey": "materials", + "title": "订单素材库", + "state": "首屏", + "note": "首屏", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用" + }, + { + "filename": "dock-orders.png", + "pageKey": "orders", + "title": "我的拍摄订单", + "state": "全部", + "note": "全部", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-payment-before-selection.png", + "pageKey": "payment-unselected", + "title": "收款详情·未选套餐", + "state": "未选择套餐", + "note": "未选择套餐", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-payment.png", + "pageKey": "payment", + "title": "收款详情", + "state": "已生成模拟码,页面滚动位置由现有测试保留", + "note": "已生成模拟码,页面滚动位置由现有测试保留", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-preparation.png", + "pageKey": "preparation", + "title": "拍摄准备", + "state": "可召唤", + "note": "可召唤", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-receipts.png", + "pageKey": "receipts", + "title": "收款记录", + "state": "近7天", + "note": "近7天", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-workbench-statistics.png", + "pageKey": "workbench-stats", + "title": "机巢工作台·今日统计", + "state": "向下滚动", + "note": "向下滚动", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "dock-workbench.png", + "pageKey": "workbench", + "title": "机巢工作台", + "state": "首屏", + "note": "首屏", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-completion-dialog.png", + "pageKey": "task-completion-dialog", + "title": "拍摄完成提示", + "state": "弹窗", + "note": "弹窗", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-paused.png", + "pageKey": "task-paused", + "title": "拍摄任务·手动暂停", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-pending-pause.png", + "pageKey": "task-pending-pause", + "title": "拍摄任务·暂停待确认", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-returned.png", + "pageKey": "task-returned", + "title": "拍摄任务·已返回机巢", + "state": "中断任务失败", + "note": "中断任务失败", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-returning.png", + "pageKey": "task-returning", + "title": "拍摄任务·手动返航", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-control-starting.png", + "pageKey": "task-starting", + "title": "拍摄任务·起飞准备", + "state": "无人机正在赶来", + "note": "无人机正在赶来", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-failed.png", + "pageKey": "task-failed", + "title": "拍摄任务·失败", + "state": "中断后已返回机巢,可重新召唤", + "note": "中断后已返回机巢,可重新召唤", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "task-going.png", + "pageKey": "task-going", + "title": "拍摄任务·前往点位", + "state": "无人机正在赶来", + "note": "无人机正在赶来", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用" + }, + { + "filename": "task-ready.png", + "pageKey": "task-ready", + "title": "拍摄任务·到点等待", + "state": "倒计时与手动开拍", + "note": "倒计时与手动开拍", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-returning-complete.png", + "pageKey": "task-complete", + "title": "拍摄任务·拍摄已完成", + "state": "正常返航", + "note": "正常返航", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + }, + { + "filename": "task-shooting.png", + "pageKey": "task-shooting", + "title": "拍摄任务·拍摄中", + "state": "黑色区域为Mock接收器,无真实RTC/视频帧", + "note": "黑色区域为Mock接收器,无真实RTC/视频帧", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身" + } + ], + "validation": "工作台/收款/任务原有17用例通过;素材原有截图类依赖loopback网络与旧文案,截图专用临时类改为Coil内存图片及当前控件选择器后,最终4个补截用例全部通过。所有业务源码保持未改动。" + } + }, + "pair_count": 28, + "paired_count": 25, + "ui_review": { + "reviewed_at": "2026-11-05", + "scope": "基于本次截图评审信息层级、文案、状态表达与操作布局;属于设计建议。系统导航、键盘和安全区保留平台习惯,业务许可仍按实际接口状态。", + "baseline_counts": { + "android": 8, + "keep": 11, + "ios": 5, + "insufficient": 4 + } + }, + "pairs": [ + { + "key": "home", + "title": "机巢工作台", + "ios": { + "key": "home", + "title": "机巢工作台", + "filename": "workbench.png", + "launchArgument": "--dock-capture=workbench", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "0fa14de668cdcc323d65bf8a7133856bd8143584866c21fa122cf3ae058e05a4", + "platform": "ios", + "path": "ios/workbench.png" + }, + "android": { + "filename": "dock-workbench.png", + "pageKey": "workbench", + "title": "机巢工作台", + "state": "首屏", + "note": "首屏", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "home", + "platform": "android", + "path": "android/dock-workbench.png", + "dimensions": "1080 × 1731", + "sha256": "d05af7cd6741c6bff9f2b2b5ab8bcbdc9e4efc9b8229dc21fd840a0ddfa8bf87" + }, + "recommendation": { + "key": "home", + "baseline": "android", + "label": "以 Android 为准", + "reason": "收款入口同时呈现二维码图标和“收款码”,比单独图标更容易辨认;设备、订单、素材入口的层级清楚。", + "action": "iOS 补充收款入口文字;空闲标签可保留 iOS 的浅绿底。" + } + }, + { + "key": "statistics", + "title": "工作台 · 统计区域", + "ios": { + "key": "statistics", + "filename": "workbench-statistics.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=workbench-statistics", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "7c28b3c0453228cc7be14bff30107ca99587e307066e21baee12f5cfacfad776", + "platform": "ios", + "path": "ios/workbench-statistics.png", + "title": "工作台 · 统计区域" + }, + "android": { + "filename": "dock-workbench-statistics.png", + "pageKey": "workbench-stats", + "title": "机巢工作台·今日统计", + "state": "向下滚动", + "note": "向下滚动", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "statistics", + "platform": "android", + "path": "android/dock-workbench-statistics.png", + "dimensions": "1080 × 1731", + "sha256": "7e44217ecbaccef20ca0865b10514f3b56d8407ae93edfc3962b8403f24ae812" + }, + "recommendation": { + "key": "statistics", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均为成交订单、成交金额、完成拍摄三列,数字在上、名称在下,结构已一致。", + "action": "统一指标名称、金额精度及数字格式即可。" + } + }, + { + "key": "orders", + "title": "我的拍摄订单", + "ios": { + "key": "orders", + "title": "我的拍摄订单", + "filename": "orders.png", + "launchArgument": "--dock-capture=orders", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "17f1e5d8d1d92202cc7fc227ed935f0a00822b4d9a418950fbd3cb5942a9a4e9", + "platform": "ios", + "path": "ios/orders.png" + }, + "android": { + "filename": "dock-orders.png", + "pageKey": "orders", + "title": "我的拍摄订单", + "state": "全部", + "note": "全部", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "orders", + "platform": "android", + "path": "android/dock-orders.png", + "dimensions": "1080 × 1731", + "sha256": "50710d9338333c54019cd74da54cc86a1373e8621987a697fedcb4c455f4ab0c" + }, + "recommendation": { + "key": "orders", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "橙色“进行中”和绿色“已完成”更易区分订单状态,次数、进度与底部操作也有明确分层。", + "action": "状态样式参考 iOS;剩余次数可借鉴 Android 的整段强调。" + } + }, + { + "key": "payment-empty", + "title": "套餐收款 · 未选择套餐", + "ios": { + "key": "payment-empty", + "title": "套餐收款·未选套餐", + "filename": "payment-before-selection.png", + "launchArgument": "--dock-capture=payment-before-selection", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "91e70d2eaefce1967b2027e149ea423c07f1befc5a99422980330789f440e27b", + "platform": "ios", + "path": "ios/payment-before-selection.png" + }, + "android": { + "filename": "dock-payment-before-selection.png", + "pageKey": "payment-unselected", + "title": "收款详情·未选套餐", + "state": "未选择套餐", + "note": "未选择套餐", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "payment-empty", + "platform": "android", + "path": "android/dock-payment-before-selection.png", + "dimensions": "1080 × 1731", + "sha256": "9de1a8acb1eeb19b4b6bf2e4000ce346cba0c8de6231bc2dcb24c191d36f4bad" + }, + "recommendation": { + "key": "payment-empty", + "baseline": "android", + "label": "以 Android 为准", + "reason": "未选套餐时,灰色的“设置金额”“保存二维码”仍能清楚辨认;iOS 相应禁用文字过浅。", + "action": "保留先选套餐的提示,提高禁用操作文字的可读性。" + } + }, + { + "key": "payment", + "title": "套餐收款", + "ios": { + "key": "payment", + "title": "套餐收款", + "filename": "payment.png", + "launchArgument": "--dock-capture=payment", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "31b23f0f0195efd5154013932d6288c06f8617a9e4a1c6ac9be15fd364a4d4dd", + "platform": "ios", + "path": "ios/payment.png" + }, + "android": { + "filename": "dock-payment.png", + "pageKey": "payment", + "title": "收款详情", + "state": "已生成模拟码,页面滚动位置由现有测试保留", + "note": "已生成模拟码,页面滚动位置由现有测试保留", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "payment", + "platform": "android", + "path": "android/dock-payment.png", + "dimensions": "1080 × 1731", + "sha256": "a168ce40137805539226ba2992c117976969d6b6f2798a794232df80d22940c3" + }, + "recommendation": { + "key": "payment", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端都按套餐、收款金额、付款图、到账核对说明、操作组织,主次关系基本一致。", + "action": "保留到账后核对收款记录的说明,不比较本地付款图的图案。" + } + }, + { + "key": "project-picker", + "title": "套餐选择", + "ios": { + "key": "project-picker", + "filename": "payment-picker.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=payment-picker", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "74028c8d17eca884ed3998ef55e4bd59bc8b48344e635e9126e163f955b3f8a8", + "platform": "ios", + "path": "ios/payment-picker.png", + "title": "套餐选择" + }, + "android": null, + "recommendation": { + "key": "project-picker", + "baseline": "insufficient", + "label": "待补 Android 截图", + "reason": "本次仅有 iOS 套餐选择截图,不能据此判断哪端更好。", + "action": "补齐同一选中状态后,比较套餐名、次数、价格和确认反馈。", + "note": "缺少截图不代表 Android 没有此界面。" + } + }, + { + "key": "amount-edit", + "title": "设置金额", + "ios": { + "key": "amount-edit", + "filename": "amount-edit.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=amount-edit", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "57f5cff298d349043b0542e9c6a531c7ff40d0af4e80ddd4f6e3f7d2513e985e", + "platform": "ios", + "path": "ios/amount-edit.png", + "title": "设置金额" + }, + "android": null, + "recommendation": { + "key": "amount-edit", + "baseline": "insufficient", + "label": "待补 Android 截图", + "reason": "本次仅有 iOS 金额编辑截图,缺少 Android 打开键盘后的对应状态。", + "action": "补图后比较金额输入与确认按钮的位置,键盘保留各平台习惯。" + } + }, + { + "key": "receipts", + "title": "收款记录", + "ios": { + "key": "receipts", + "title": "收款记录", + "filename": "receipts.png", + "launchArgument": "--dock-capture=receipts", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "7b9b5426389dad6abf91e6c24b0cc9618e7b86ce9aab692c18149791a7f426d0", + "platform": "ios", + "path": "ios/receipts.png" + }, + "android": { + "filename": "dock-receipts.png", + "pageKey": "receipts", + "title": "收款记录", + "state": "近7天", + "note": "近7天", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "receipts", + "platform": "android", + "path": "android/dock-receipts.png", + "dimensions": "1080 × 1731", + "sha256": "fae55cf84496668b9a343bf241e0813ff75a411fefeec6fe8eb3454cb0c3f9ef" + }, + "recommendation": { + "key": "receipts", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "汇总与明细分组一致,现金实收、退款、净收顺序相同,净收均用蓝色突出。", + "action": "保留现有核对结构;统一字段与金额格式。" + } + }, + { + "key": "preparation", + "title": "拍摄准备", + "ios": { + "key": "preparation", + "title": "拍摄准备", + "filename": "preparation.png", + "launchArgument": "--dock-capture=preparation", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "ff6a5ca80a994396419b389f1f1ab7c9eb97a4f064625107f7cfe278ff5f2e19", + "platform": "ios", + "path": "ios/preparation.png" + }, + "android": { + "filename": "dock-preparation.png", + "pageKey": "preparation", + "title": "拍摄准备", + "state": "可召唤", + "note": "可召唤", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "preparation", + "platform": "android", + "path": "android/dock-preparation.png", + "dimensions": "1080 × 1731", + "sha256": "a827311990c2e1f3df5a774deb2ea23b2da01800bd4f20f3a235484dd7f6f7bf" + }, + "recommendation": { + "key": "preparation", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "游客与次数、点位、航线、设备状态、确认召唤的顺序一致,选中态同时用底色和勾形标识表达。", + "action": "保留共同流程;Android 可借鉴 iOS 连接成功时的勾形标识。", + "note": "不以设备比例造成的留白或 Debug 模拟入口判断优劣。" + } + }, + { + "key": "task-starting", + "title": "拍摄任务 · 起飞准备", + "ios": { + "key": "task-starting", + "filename": "task-starting.png", + "launchArgument": "--dock-capture=task-starting", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "a02e8fc4d27d43705440893e63e1b30ce4b902ebcf94093ea8ff2ed3f50fa4a8", + "platform": "ios", + "path": "ios/task-starting.png", + "title": "拍摄任务 · 起飞准备" + }, + "android": { + "filename": "task-control-starting.png", + "pageKey": "task-starting", + "title": "拍摄任务·起飞准备", + "state": "无人机正在赶来", + "note": "无人机正在赶来", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-starting", + "platform": "android", + "path": "android/task-control-starting.png", + "dimensions": "1080 × 1731", + "sha256": "169c3de404768658b461ad98771fc751ca1e8421f43685797de3f6380d35f301" + }, + "recommendation": { + "key": "task-starting", + "baseline": "android", + "label": "以 Android 为准", + "reason": "阶段区更精简,突出“无人机正在赶来”;iOS 的中央刷新与导航栏刷新重复。", + "action": "采用 Android 的阶段区布局,刷新保留导航入口,设备读数集中在指标区。", + "note": "设备摘要和图传中的模拟文案不作为业务阶段正确性的证据。" + } + }, + { + "key": "task-going", + "title": "拍摄任务 · 前往点位", + "ios": { + "key": "task-going", + "filename": "task-going.png", + "launchArgument": "--dock-capture=task-going", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "d129b427094a78a6162441e445a4913e14364479d09cfc684d6456bc72c9a4d8", + "platform": "ios", + "path": "ios/task-going.png", + "title": "拍摄任务 · 前往点位" + }, + "android": { + "filename": "task-going.png", + "pageKey": "task-going", + "title": "拍摄任务·前往点位", + "state": "无人机正在赶来", + "note": "无人机正在赶来", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用", + "key": "task-going", + "platform": "android", + "path": "android/task-going.png", + "dimensions": "1080 × 1731", + "sha256": "f211fb90f09915af3def8181eebaf0212c88dc0dec97346e1b564a643bcd88b1" + }, + "recommendation": { + "key": "task-going", + "baseline": "android", + "label": "以 Android 为准", + "reason": "赶来阶段的标题、现场提醒和安全控制更集中,阶段区没有重复的刷新主按钮。", + "action": "参考 Android 精简中央面板;安全按钮始终按当前设备与接口许可展示。" + } + }, + { + "key": "task-ready", + "title": "拍摄任务 · 到达待开拍", + "ios": { + "key": "task-ready", + "filename": "task-ready.png", + "launchArgument": "--dock-capture=task-ready", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "8498671d0a762c6e8b34af1343a28787c86544a04ef10a8a48cfe3166a99182c", + "platform": "ios", + "path": "ios/task-ready.png", + "title": "拍摄任务 · 到达待开拍" + }, + "android": { + "filename": "task-ready.png", + "pageKey": "task-ready", + "title": "拍摄任务·到点等待", + "state": "倒计时与手动开拍", + "note": "倒计时与手动开拍", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-ready", + "platform": "android", + "path": "android/task-ready.png", + "dimensions": "1080 × 1731", + "sha256": "350a8201fe7fed311537ae2de7df75e2b6c23de0b4a9eba27196ce9b6b2b809b" + }, + "recommendation": { + "key": "task-ready", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端都明确展示到达、站位确认、整行开拍按钮与独立安全控制,关键层级已一致。", + "action": "统一确认提醒和倒计时格式;计时本身不禁用已获许可的手动开拍。", + "note": "29 秒与 30 秒属于截图时机差异。" + } + }, + { + "key": "task-shooting", + "title": "拍摄任务 · 拍摄中", + "ios": { + "key": "task-shooting", + "filename": "task-shooting.png", + "launchArgument": "--dock-capture=task-shooting", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "bc16903fd3d9b5a2571d175d35b738ad2838b0ff33e9436a633a25a899726f5a", + "platform": "ios", + "path": "ios/task-shooting.png", + "title": "拍摄任务 · 拍摄中" + }, + "android": { + "filename": "task-shooting.png", + "pageKey": "task-shooting", + "title": "拍摄任务·拍摄中", + "state": "黑色区域为Mock接收器,无真实RTC/视频帧", + "note": "黑色区域为Mock接收器,无真实RTC/视频帧", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-shooting", + "platform": "android", + "path": "android/task-shooting.png", + "dimensions": "1080 × 1731", + "sha256": "1da0a2dd97c7bbb3e89f26751f7148450d6d6ff4abd60050fda636015abc73cd" + }, + "recommendation": { + "key": "task-shooting", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "浅蓝视频图标、两行现场提醒和禁用的整行“拍摄中”基本一致,业务状态与安全操作分区清楚。", + "action": "保留现有面板,统一图标线宽、文字间距与产品文案。", + "note": "模拟图传配置不同,本组不评价图传黑区的状态文案。" + } + }, + { + "key": "task-paused", + "title": "拍摄任务 · 手动暂停", + "ios": { + "key": "task-paused", + "filename": "task-paused.png", + "launchArgument": "--dock-capture=task-paused", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "05fba4484ac1b577b1c68caa8ed29a040d824a258746e498e3fa3f424dd23d74", + "platform": "ios", + "path": "ios/task-paused.png", + "title": "拍摄任务 · 手动暂停" + }, + "android": { + "filename": "task-control-paused.png", + "pageKey": "task-paused", + "title": "拍摄任务·手动暂停", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-paused", + "platform": "android", + "path": "android/task-control-paused.png", + "dimensions": "1080 × 1731", + "sha256": "5d3553c71122c8f0d6210f3cbbd43ac02374038c6ee9e4f8819d6ddaca1ce2c5" + }, + "recommendation": { + "key": "task-paused", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均以橙色暂停说明悬停状态,蓝色“继续任务”为主操作,返航保留独立入口。", + "action": "保持状态说明、继续任务、安全控制的现有层级。" + } + }, + { + "key": "task-returning", + "title": "拍摄任务 · 返航中", + "ios": { + "key": "task-returning", + "filename": "task-returning.png", + "launchArgument": "--dock-capture=task-returning", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "d333800b9cb67e9eae4762419ca18fee2b014b1c3e60cf7650fa68bd04944efc", + "platform": "ios", + "path": "ios/task-returning.png", + "title": "拍摄任务 · 返航中" + }, + "android": { + "filename": "task-control-returning.png", + "pageKey": "task-returning", + "title": "拍摄任务·手动返航", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-returning", + "platform": "android", + "path": "android/task-control-returning.png", + "dimensions": "1080 × 1731", + "sha256": "1bc86127ea23874daf623250be3a4966adfe152dadad1184e5b051fdb2b6f238" + }, + "recommendation": { + "key": "task-returning", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端均说明拍摄中断,用禁用按钮展示中断状态,并避免重复返航。", + "action": "保留中断原因与返航状态分别说明的方式。" + } + }, + { + "key": "task-returned", + "title": "拍摄任务 · 已回巢", + "ios": { + "key": "task-returned", + "filename": "task-returned.png", + "launchArgument": "--dock-capture=task-returned", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "26a7a5561156d33bf2bf6c9eb96834acf8c90342e45ff62945ae5ba9b37d37be", + "platform": "ios", + "path": "ios/task-returned.png", + "title": "拍摄任务 · 已回巢" + }, + "android": { + "filename": "task-control-returned.png", + "pageKey": "task-returned", + "title": "拍摄任务·已返回机巢", + "state": "中断任务失败", + "note": "中断任务失败", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-returned", + "platform": "android", + "path": "android/task-control-returned.png", + "dimensions": "1080 × 1731", + "sha256": "bed9441145b08d589d9f8b7070d2a81863467fcd5889febb1ef2e95a1309bdc4" + }, + "recommendation": { + "key": "task-returned", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "回巢图标与“当前未执行任务”的禁用说明更贴合已回巢状态;Android 此处仍显示“悬停待命”。", + "action": "参考 iOS 的图标与禁用说明,保留明确的“重新召唤无人机”入口。" + } + }, + { + "key": "task-completed", + "title": "拍摄任务 · 拍摄已完成", + "ios": { + "key": "task-completed", + "filename": "task-completed.png", + "dimensions": "1206 × 2622", + "source": "当前正式UIKit页面,隔离内存服务,由正式界面交互进入", + "sha256": "5b768c64eeeec791c2a76b47e4a5ba94acea363e0a9adb6f63c7db3348be2f66", + "note": "模拟正常录制结束后返航,与Android完成面板样例保持一致;已关闭完成提示。", + "platform": "ios", + "path": "ios/task-completed.png", + "title": "拍摄任务 · 拍摄已完成" + }, + "android": { + "filename": "task-returning-complete.png", + "pageKey": "task-complete", + "title": "拍摄任务·拍摄已完成", + "state": "正常返航", + "note": "正常返航", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-completed", + "platform": "android", + "path": "android/task-returning-complete.png", + "dimensions": "1080 × 1731", + "sha256": "e483379d4138249fb9076070502a9eb6bfc63fb5f6a55db83563a01dabab1618" + }, + "recommendation": { + "key": "task-completed", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均以浅绿完成图标、拍摄结束说明和整行“查看素材”构成完成面板,主体表达一致。", + "action": "维持单一素材主入口;返航说明和安全按钮继续取决于设备当前状态。" + } + }, + { + "key": "task-completion-dialog", + "title": "拍摄任务 · 完成提示", + "ios": { + "key": "task-completion-dialog", + "filename": "task-completion-dialog.png", + "launchArgument": "--dock-capture=task-completion-dialog", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "c927ca4ea1a1ddfc110c2638fe5545ad7906fa63062f093b9aaf3f06df3d4594", + "platform": "ios", + "path": "ios/task-completion-dialog.png", + "title": "拍摄任务 · 完成提示" + }, + "android": { + "filename": "task-completion-dialog.png", + "pageKey": "task-completion-dialog", + "title": "拍摄完成提示", + "state": "弹窗", + "note": "弹窗", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-completion-dialog", + "platform": "android", + "path": "android/task-completion-dialog.png", + "dimensions": "1080 × 1920", + "sha256": "2e2408cc9ad79564511725acb4ba9a44b8e7ae92873b2f058d6179e8b9533746" + }, + "recommendation": { + "key": "task-completion-dialog", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端均引导查看上传进度和素材,“稍后再去”为次操作,“去查看”为蓝色主操作。", + "action": "保留现有文案、按钮顺序与主次关系。" + } + }, + { + "key": "task-failed", + "title": "拍摄任务 · 失败", + "ios": { + "key": "task-failed", + "filename": "task-failed.png", + "launchArgument": "--dock-capture=task-failed", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "de1e41ea23627669bcdee70af8d92a2e6208b88a3f45b30af445dee2f644ce1a", + "platform": "ios", + "path": "ios/task-failed.png", + "title": "拍摄任务 · 失败", + "note": "执行失败,等待设备确认回巢;右侧为中断后已回巢,模拟状态不同。" + }, + "android": { + "filename": "task-failed.png", + "pageKey": "task-failed", + "title": "拍摄任务·失败", + "state": "中断后已返回机巢,可重新召唤", + "note": "中断后已返回机巢,可重新召唤", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用", + "key": "task-failed", + "platform": "android", + "path": "android/task-failed.png", + "dimensions": "1080 × 1731", + "sha256": "bed9441145b08d589d9f8b7070d2a81863467fcd5889febb1ef2e95a1309bdc4" + }, + "recommendation": { + "key": "task-failed", + "baseline": "insufficient", + "label": "待同状态截图再定", + "reason": "iOS 为执行失败且尚未确认回巢,Android 为手动中断后已回巢;按钮与颜色对应不同状态,无法直接判优。", + "action": "执行失败可参考 iOS 的红色原因区;手动中断保留橙色提示,补齐同状态后再统一。" + } + }, + { + "key": "task-pending-pause", + "title": "拍摄任务 · 暂停指令等待", + "ios": null, + "android": { + "filename": "task-control-pending-pause.png", + "pageKey": "task-pending-pause", + "title": "拍摄任务·暂停待确认", + "state": "", + "note": "", + "width": 1080, + "height": 1731, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "task-pending-pause", + "platform": "android", + "path": "android/task-control-pending-pause.png", + "dimensions": "1080 × 1731", + "sha256": "691246a5521356035568ae9f6ee14317f12620fb84695f3a089093608b200633" + }, + "recommendation": { + "key": "task-pending-pause", + "baseline": "insufficient", + "label": "待补 iOS 截图", + "reason": "本次只有 Android 暂停指令等待截图,缺少 iOS 同状态证据。", + "action": "可参考仅让暂停按钮等待、中央保留拍摄阶段且返航入口独立的表达。", + "note": "不能据此认定 iOS 未实现该状态。" + } + }, + { + "key": "materials", + "title": "订单素材库", + "ios": { + "key": "materials", + "title": "订单素材库", + "filename": "materials.png", + "launchArgument": "--dock-capture=materials", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "08ba9c88b342b72ab78bb60054b20259fa06255bb0856c123b90100bc82a98a5", + "platform": "ios", + "path": "ios/materials.png" + }, + "android": { + "filename": "dock-materials.png", + "pageKey": "materials", + "title": "订单素材库", + "state": "首屏", + "note": "首屏", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用", + "key": "materials", + "platform": "android", + "path": "android/dock-materials.png", + "dimensions": "1080 × 1920", + "sha256": "43ebe41447e566e82b2e068d98ea9928af8d2a9a4a1923e5d3b77ebe11cb226b" + }, + "recommendation": { + "key": "materials", + "baseline": "android", + "label": "以 Android 为准", + "reason": "视频角标明确区分文件类型,上传状态与可下载提示清楚;禁用下载按钮的文字也更易辨认。", + "action": "iOS 补充类型角标并提高禁用文字对比度;选择圈可保留 iOS 的蓝色描边。" + } + }, + { + "key": "material-preview", + "title": "素材预览", + "ios": { + "key": "material-preview", + "filename": "material-preview.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=material-preview", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "6b2a498955c49122f71a5c5fa26280885c7c13e6bb4c9c4c94e6c835b754614b", + "platform": "ios", + "path": "ios/material-preview.png", + "title": "素材预览" + }, + "android": { + "filename": "dock-material-preview.png", + "pageKey": "material-preview", + "title": "素材预览", + "state": "照片预览", + "note": "照片预览", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用", + "key": "material-preview", + "platform": "android", + "path": "android/dock-material-preview.png", + "dimensions": "1080 × 1920", + "sha256": "f06a4c750f843fb48aa9ab416af35782840bdc0770e1b4d2fdad9bb912715ea4" + }, + "recommendation": { + "key": "material-preview", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均以黑底、完整图片和文件名为核心,内容优先,预览结构已一致。", + "action": "保留完整等比展示与平台导航,不为统一黑边高度裁切图片。", + "note": "图片大小和黑边高度会受屏幕比例影响。" + } + }, + { + "key": "delivery-method", + "title": "交付方式选择", + "ios": { + "key": "delivery-method", + "filename": "delivery-methods.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=delivery-methods", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "61de3cbdbf387f41a4312b5febb1086487f59f16f3096ffd811eed2691a6df24", + "platform": "ios", + "path": "ios/delivery-methods.png", + "title": "交付方式选择", + "note": "由工作台打开交付方式弹层。" + }, + "android": { + "filename": "dock-delivery-methods.png", + "pageKey": "delivery-method", + "title": "交付成片·交付方式", + "state": "底部弹层", + "note": "由订单素材库打开交付方式弹层。", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用", + "key": "delivery-method", + "platform": "android", + "path": "android/dock-delivery-methods.png", + "dimensions": "1080 × 1920", + "sha256": "598b20946ef4ae4f02cf299aaceea60a47fb3e641c2c817580a7052ff84a28a4" + }, + "recommendation": { + "key": "delivery-method", + "baseline": "android", + "label": "以 Android 为准", + "reason": "标题、游客身份和交付方式的层级更清楚,关闭入口位于标题区,底部说明紧接选项。", + "action": "参考 Android 的信息组织,iOS 继续使用原生 sheet 与平台导航。", + "note": "两图来源页不同,不比较弹层背后的页面。" + } + }, + { + "key": "delivery-cloud", + "title": "云端交付", + "ios": { + "key": "delivery-cloud", + "filename": "delivery-cloud.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=delivery-cloud", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "adc745ef1bb7f505ec66306d3bb6ba05b9e60ef32b360db94aab5a3902697790", + "platform": "ios", + "path": "ios/delivery-cloud.png", + "title": "云端交付" + }, + "android": { + "filename": "dock-delivery-cloud.png", + "pageKey": "delivery-cloud", + "title": "云端上传", + "state": "未选视频", + "note": "未选视频", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用", + "key": "delivery-cloud", + "platform": "android", + "path": "android/dock-delivery-cloud.png", + "dimensions": "1080 × 1920", + "sha256": "13a56735bf3e5ad9b4131547b2ecf1c727a77aecc719dd9c0af9255ee810b52a" + }, + "recommendation": { + "key": "delivery-cloud", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "两端任务关联卡基本一致;iOS 在主按钮前补充先选视频、再上传的说明,空态下的下一步更明确。", + "action": "以 iOS 的操作说明为准,保留游客与已关联任务卡;导航遵循各平台习惯。" + } + }, + { + "key": "delivery-nearby", + "title": "面对面闪传", + "ios": { + "key": "delivery-nearby", + "filename": "delivery-nearby.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=delivery-nearby", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "b25e1f8c1fd0718ef249348e94d4ccc42ed585413ee31ccd41d8673b9af85c99", + "platform": "ios", + "path": "ios/delivery-nearby.png", + "title": "面对面闪传" + }, + "android": { + "filename": "dock-delivery-nearby.png", + "pageKey": "delivery-nearby", + "title": "面对面闪传", + "state": "未选视频", + "note": "未选视频", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用", + "key": "delivery-nearby", + "platform": "android", + "path": "android/dock-delivery-nearby.png", + "dimensions": "1080 × 1920", + "sha256": "5e6dd4117d448fef89aa28802defcd85390cb14312bfca1c7b6ee00b60aa646a" + }, + "recommendation": { + "key": "delivery-nearby", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "“尚未选择视频”的封面占位和状态更明确,且直接说明游客扫码后在浏览器接收,发送端与接收端角色更清楚。", + "action": "参考 iOS 的发送卡片和游客接收说明,补充 Android“选择后点击下方生成二维码”的步骤提示。" + } + }, + { + "key": "confirmation", + "title": "订单交付确认", + "ios": { + "key": "confirmation", + "title": "订单交付确认", + "filename": "confirmation-manifest.png", + "launchArgument": "--dock-capture=confirmation-manifest", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "09297899efd9484be09cf0d493e2bb905e9ae90bca2da01c8010060150ae29aa", + "platform": "ios", + "path": "ios/confirmation-manifest.png" + }, + "android": { + "filename": "dock-confirmation-manifest.png", + "pageKey": "delivery-review", + "title": "整单交付清单", + "state": "待确认交齐", + "note": "待确认交齐", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / 图片替身 / Socket及RTC替身", + "key": "confirmation", + "platform": "android", + "path": "android/dock-confirmation-manifest.png", + "dimensions": "1080 × 1920", + "sha256": "60841903d9b190568c73f7deb29646454e0280ae1679ace42b673ebefb94d77f" + }, + "recommendation": { + "key": "confirmation", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "清单下明确解释“单次上传完成,不代表整单已交齐”,有助于工作人员在出确认码前核对整单。", + "action": "保留整单核对说明;“还未交齐,继续交付”可借鉴 Android 的蓝色入口,提高可发现性。", + "note": "视频封面来自不同模拟夹具,不据此判定预览能力。" + } + }, + { + "key": "confirmation-code", + "title": "确认收货二维码", + "ios": { + "key": "confirmation-code", + "filename": "confirmation-code.png", + "dimensions": "1206 × 2622", + "launchArgument": "--dock-capture=confirmation-code", + "source": "隔离内存数据;临时入口调用正式控件动作进入,正式UI布局保持原样", + "sha256": "df7f1f97c5f5bf8dec7c7f8ecd5ce73b5b2aad4c73d943fa5b508e4a34f58800", + "platform": "ios", + "path": "ios/confirmation-code.png", + "title": "确认收货二维码" + }, + "android": { + "filename": "dock-confirmation-code.png", + "pageKey": "confirmation-code", + "title": "订单确认码", + "state": "等待游客确认", + "note": "等待游客确认", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身;无真实业务调用", + "key": "confirmation-code", + "platform": "android", + "path": "android/dock-confirmation-code.png", + "dimensions": "1080 × 1920", + "sha256": "c154f78196841e09ac7f65b5924c1ce555ef4c3fc75696afde4b0ce7c5612096" + }, + "recommendation": { + "key": "confirmation-code", + "baseline": "android", + "label": "以 Android 为准", + "reason": "主标题直接说明“原下单游客使用微信扫一扫”,比泛称游客扫码更能明确现场操作人和扫码入口。", + "action": "主标题参考 Android;保留 iOS“扫描不等于收货”说明及展开成片清单的入口。", + "note": "不比较模拟二维码图案或扫描成功率。" + } + }, + { + "key": "confirmation-completed", + "title": "订单交付确认 · 已完成", + "ios": { + "key": "confirmation-completed", + "title": "订单交付确认·已完成", + "filename": "confirmation-confirmed.png", + "launchArgument": "--dock-capture=confirmation-confirmed", + "dimensions": "1206 × 2622", + "source": "当前正式 UIKit 控制器 + 仅截图用内存数据;无真实业务、飞控或图传网络", + "sha256": "de9b1192051747ae941f626d56af3a74838a8e6aa9a6afc5c330f01c4e625cd5", + "platform": "ios", + "path": "ios/confirmation-confirmed.png" + }, + "android": { + "filename": "dock-confirmation-completed.png", + "pageKey": "confirmation-completed", + "title": "订单交付确认·完成", + "state": "已完成整单确认", + "note": "已完成整单确认", + "width": 1080, + "height": 1920, + "source": "正式当前源码 Screen + 内存 FeatureTransport / Coil内存图片替身 / Socket及RTC替身;无真实业务调用", + "key": "confirmation-completed", + "platform": "android", + "path": "android/dock-confirmation-completed.png", + "dimensions": "1080 × 1920", + "sha256": "ce7133194fcde2d52357c6cbad7ef0c6f15cb13d15611ddb934f526c8f80777e" + }, + "recommendation": { + "key": "confirmation-completed", + "baseline": "android", + "label": "以 Android 为准", + "reason": "浅绿成功条将已确认状态与后续成片清单衔接得更紧凑,便于工作人员快速复核交付内容。", + "action": "成功反馈参考 Android;有真实确认时间时可补充 iOS 的时间字段。" + } + } + ] +} \ No newline at end of file diff --git a/artifacts/drone-dock-ui-2026-11-05/overview.png b/artifacts/drone-dock-ui-2026-11-05/overview.png new file mode 100644 index 0000000..a540987 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/overview.png differ diff --git a/artifacts/drone-dock-ui-2026-11-05/recommendations.json b/artifacts/drone-dock-ui-2026-11-05/recommendations.json new file mode 100644 index 0000000..ffe9196 --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/recommendations.json @@ -0,0 +1,213 @@ +{ + "schema_version": 1, + "reviewed_at": "2026-11-05", + "scope": "基于本次截图评审信息层级、文案、状态表达与操作布局;属于设计建议。系统导航、键盘和安全区保留平台习惯,业务许可仍按实际接口状态。", + "entries": [ + { + "key": "home", + "baseline": "android", + "label": "以 Android 为准", + "reason": "收款入口同时呈现二维码图标和“收款码”,比单独图标更容易辨认;设备、订单、素材入口的层级清楚。", + "action": "iOS 补充收款入口文字;空闲标签可保留 iOS 的浅绿底。" + }, + { + "key": "statistics", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均为成交订单、成交金额、完成拍摄三列,数字在上、名称在下,结构已一致。", + "action": "统一指标名称、金额精度及数字格式即可。" + }, + { + "key": "orders", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "橙色“进行中”和绿色“已完成”更易区分订单状态,次数、进度与底部操作也有明确分层。", + "action": "状态样式参考 iOS;剩余次数可借鉴 Android 的整段强调。" + }, + { + "key": "payment-empty", + "baseline": "android", + "label": "以 Android 为准", + "reason": "未选套餐时,灰色的“设置金额”“保存二维码”仍能清楚辨认;iOS 相应禁用文字过浅。", + "action": "保留先选套餐的提示,提高禁用操作文字的可读性。" + }, + { + "key": "payment", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端都按套餐、收款金额、付款图、到账核对说明、操作组织,主次关系基本一致。", + "action": "保留到账后核对收款记录的说明,不比较本地付款图的图案。" + }, + { + "key": "project-picker", + "baseline": "insufficient", + "label": "待补 Android 截图", + "reason": "本次仅有 iOS 套餐选择截图,不能据此判断哪端更好。", + "action": "补齐同一选中状态后,比较套餐名、次数、价格和确认反馈。", + "note": "缺少截图不代表 Android 没有此界面。" + }, + { + "key": "amount-edit", + "baseline": "insufficient", + "label": "待补 Android 截图", + "reason": "本次仅有 iOS 金额编辑截图,缺少 Android 打开键盘后的对应状态。", + "action": "补图后比较金额输入与确认按钮的位置,键盘保留各平台习惯。" + }, + { + "key": "receipts", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "汇总与明细分组一致,现金实收、退款、净收顺序相同,净收均用蓝色突出。", + "action": "保留现有核对结构;统一字段与金额格式。" + }, + { + "key": "preparation", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "游客与次数、点位、航线、设备状态、确认召唤的顺序一致,选中态同时用底色和勾形标识表达。", + "action": "保留共同流程;Android 可借鉴 iOS 连接成功时的勾形标识。", + "note": "不以设备比例造成的留白或 Debug 模拟入口判断优劣。" + }, + { + "key": "task-starting", + "baseline": "android", + "label": "以 Android 为准", + "reason": "阶段区更精简,突出“无人机正在赶来”;iOS 的中央刷新与导航栏刷新重复。", + "action": "采用 Android 的阶段区布局,刷新保留导航入口,设备读数集中在指标区。", + "note": "设备摘要和图传中的模拟文案不作为业务阶段正确性的证据。" + }, + { + "key": "task-going", + "baseline": "android", + "label": "以 Android 为准", + "reason": "赶来阶段的标题、现场提醒和安全控制更集中,阶段区没有重复的刷新主按钮。", + "action": "参考 Android 精简中央面板;安全按钮始终按当前设备与接口许可展示。" + }, + { + "key": "task-ready", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端都明确展示到达、站位确认、整行开拍按钮与独立安全控制,关键层级已一致。", + "action": "统一确认提醒和倒计时格式;计时本身不禁用已获许可的手动开拍。", + "note": "29 秒与 30 秒属于截图时机差异。" + }, + { + "key": "task-shooting", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "浅蓝视频图标、两行现场提醒和禁用的整行“拍摄中”基本一致,业务状态与安全操作分区清楚。", + "action": "保留现有面板,统一图标线宽、文字间距与产品文案。", + "note": "模拟图传配置不同,本组不评价图传黑区的状态文案。" + }, + { + "key": "task-paused", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均以橙色暂停说明悬停状态,蓝色“继续任务”为主操作,返航保留独立入口。", + "action": "保持状态说明、继续任务、安全控制的现有层级。" + }, + { + "key": "task-returning", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端均说明拍摄中断,用禁用按钮展示中断状态,并避免重复返航。", + "action": "保留中断原因与返航状态分别说明的方式。" + }, + { + "key": "task-returned", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "回巢图标与“当前未执行任务”的禁用说明更贴合已回巢状态;Android 此处仍显示“悬停待命”。", + "action": "参考 iOS 的图标与禁用说明,保留明确的“重新召唤无人机”入口。" + }, + { + "key": "task-completed", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均以浅绿完成图标、拍摄结束说明和整行“查看素材”构成完成面板,主体表达一致。", + "action": "维持单一素材主入口;返航说明和安全按钮继续取决于设备当前状态。" + }, + { + "key": "task-completion-dialog", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "两端均引导查看上传进度和素材,“稍后再去”为次操作,“去查看”为蓝色主操作。", + "action": "保留现有文案、按钮顺序与主次关系。" + }, + { + "key": "task-failed", + "baseline": "insufficient", + "label": "待同状态截图再定", + "reason": "iOS 为执行失败且尚未确认回巢,Android 为手动中断后已回巢;按钮与颜色对应不同状态,无法直接判优。", + "action": "执行失败可参考 iOS 的红色原因区;手动中断保留橙色提示,补齐同状态后再统一。" + }, + { + "key": "task-pending-pause", + "baseline": "insufficient", + "label": "待补 iOS 截图", + "reason": "本次只有 Android 暂停指令等待截图,缺少 iOS 同状态证据。", + "action": "可参考仅让暂停按钮等待、中央保留拍摄阶段且返航入口独立的表达。", + "note": "不能据此认定 iOS 未实现该状态。" + }, + { + "key": "materials", + "baseline": "android", + "label": "以 Android 为准", + "reason": "视频角标明确区分文件类型,上传状态与可下载提示清楚;禁用下载按钮的文字也更易辨认。", + "action": "iOS 补充类型角标并提高禁用文字对比度;选择圈可保留 iOS 的蓝色描边。" + }, + { + "key": "material-preview", + "baseline": "keep", + "label": "两端一致,保留各端", + "reason": "均以黑底、完整图片和文件名为核心,内容优先,预览结构已一致。", + "action": "保留完整等比展示与平台导航,不为统一黑边高度裁切图片。", + "note": "图片大小和黑边高度会受屏幕比例影响。" + }, + { + "key": "delivery-method", + "baseline": "android", + "label": "以 Android 为准", + "reason": "标题、游客身份和交付方式的层级更清楚,关闭入口位于标题区,底部说明紧接选项。", + "action": "参考 Android 的信息组织,iOS 继续使用原生 sheet 与平台导航。", + "note": "两图来源页不同,不比较弹层背后的页面。" + }, + { + "key": "delivery-cloud", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "两端任务关联卡基本一致;iOS 在主按钮前补充先选视频、再上传的说明,空态下的下一步更明确。", + "action": "以 iOS 的操作说明为准,保留游客与已关联任务卡;导航遵循各平台习惯。" + }, + { + "key": "delivery-nearby", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "“尚未选择视频”的封面占位和状态更明确,且直接说明游客扫码后在浏览器接收,发送端与接收端角色更清楚。", + "action": "参考 iOS 的发送卡片和游客接收说明,补充 Android“选择后点击下方生成二维码”的步骤提示。" + }, + { + "key": "confirmation", + "baseline": "ios", + "label": "以 iOS 为准", + "reason": "清单下明确解释“单次上传完成,不代表整单已交齐”,有助于工作人员在出确认码前核对整单。", + "action": "保留整单核对说明;“还未交齐,继续交付”可借鉴 Android 的蓝色入口,提高可发现性。", + "note": "视频封面来自不同模拟夹具,不据此判定预览能力。" + }, + { + "key": "confirmation-code", + "baseline": "android", + "label": "以 Android 为准", + "reason": "主标题直接说明“原下单游客使用微信扫一扫”,比泛称游客扫码更能明确现场操作人和扫码入口。", + "action": "主标题参考 Android;保留 iOS“扫描不等于收货”说明及展开成片清单的入口。", + "note": "不比较模拟二维码图案或扫描成功率。" + }, + { + "key": "confirmation-completed", + "baseline": "android", + "label": "以 Android 为准", + "reason": "浅绿成功条将已确认状态与后续成片清单衔接得更紧凑,便于工作人员快速复核交付内容。", + "action": "成功反馈参考 Android;有真实确认时间时可补充 iOS 的时间字段。" + } + ] +} diff --git a/artifacts/drone-dock-ui-2026-11-05/screenshots.zip b/artifacts/drone-dock-ui-2026-11-05/screenshots.zip new file mode 100644 index 0000000..d54b3c7 Binary files /dev/null and b/artifacts/drone-dock-ui-2026-11-05/screenshots.zip differ diff --git a/artifacts/drone-dock-ui-2026-11-05/tools/generate_gallery.py b/artifacts/drone-dock-ui-2026-11-05/tools/generate_gallery.py new file mode 100644 index 0000000..fc91521 --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/tools/generate_gallery.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 +"""Build an offline review gallery from untouched, locally captured app screenshots.""" +from __future__ import annotations + +import argparse +import html +import json +import pathlib +import hashlib +import struct +import subprocess +import zipfile +from collections import Counter + + +TITLES = { + "home": "机巢工作台", "statistics": "工作台 · 统计区域", "orders": "我的拍摄订单", + "payment-empty": "套餐收款 · 未选择套餐", "payment": "套餐收款", "receipts": "收款记录", + "preparation": "拍摄准备", "task-ready": "拍摄任务 · 到达待开拍", "task-shooting": "拍摄任务 · 拍摄中", + "task-completion-dialog": "拍摄任务 · 完成提示", "task-completed": "拍摄任务 · 拍摄已完成", + "task-paused": "拍摄任务 · 手动暂停", "task-returning": "拍摄任务 · 返航中", + "task-returned": "拍摄任务 · 已回巢", "task-pending-pause": "拍摄任务 · 暂停指令等待", + "task-starting": "拍摄任务 · 起飞准备", "task-failed": "拍摄任务 · 失败", + "task-going": "拍摄任务 · 前往点位", + "materials": "订单素材库", "material-preview": "素材预览", "delivery-method": "交付方式选择", + "delivery-cloud": "云端交付", "delivery-nearby": "面对面闪传", "confirmation": "订单交付确认", + "confirmation-code": "确认收货二维码", "confirmation-completed": "订单交付确认 · 已完成", + "project-picker": "套餐选择", "amount-edit": "设置金额", "live-fullscreen": "图传全屏", +} + +ALIASES = { + "dock-workbench": "home", "dock-workbench-statistics": "statistics", "dock-orders": "orders", + "dock-payment-before-selection": "payment-empty", "dock-payment": "payment", "dock-receipts": "receipts", + "dock-preparation": "preparation", "dock-materials": "materials", "dock-material-preview": "material-preview", + "dock-delivery-methods": "delivery-method", "dock-delivery-cloud": "delivery-cloud", + "dock-delivery-nearby": "delivery-nearby", "dock-confirmation-manifest": "confirmation", + "dock-confirmation-code": "confirmation-code", "task-returning-complete": "task-completed", + "task-control-paused": "task-paused", "task-control-returning": "task-returning", + "task-control-returned": "task-returned", "task-control-pending-pause": "task-pending-pause", + "task-control-starting": "task-starting", +} + +ORDER = ["home", "statistics", "orders", "payment-empty", "payment", "project-picker", "amount-edit", "receipts", "preparation", + "task-starting", "task-going", "task-ready", "task-shooting", "task-paused", "task-returning", "task-returned", "task-completed", + "task-completion-dialog", "task-failed", "task-pending-pause", "materials", "material-preview", "delivery-method", + "delivery-cloud", "delivery-nearby", "confirmation", "confirmation-code", "confirmation-completed", "live-fullscreen"] + + +def read_manifest(root: pathlib.Path, platform: str): + directory = root / platform + path = directory / "manifest.json" + metadata = json.loads(path.read_text()) if path.exists() else {} + if isinstance(metadata, list): + records = metadata + metadata = {} + else: + records = metadata.get("screenshots", metadata.get("screens", metadata.get("pages", []))) + files = {p.name: p for p in directory.glob("*.png")} + result = [] + seen = set() + for record in records: + if isinstance(record, str): + record = {"filename": record} + filename = record.get("filename", record.get("file", record.get("path", ""))) + filename = pathlib.Path(filename).name + if filename not in files: + continue + stem = pathlib.Path(filename).stem + key = record.get("pageKey", record.get("key", record.get("page", stem))) + key = ALIASES.get(key, ALIASES.get(stem, key)) + item = {**record, "filename": filename, "key": key, "platform": platform, + "path": str(files[filename].relative_to(root)), "title": record.get("title", TITLES.get(key, stem))} + result.append(item) + seen.add(filename) + for filename, path in files.items(): + if filename in seen: + continue + key = ALIASES.get(path.stem, path.stem) + result.append({"filename": filename, "key": key, "platform": platform, + "path": str(path.relative_to(root)), "title": TITLES.get(key, path.stem)}) + used_keys = {} + for item in result: + path = root / item["path"] + raw = path.read_bytes() + width, height = struct.unpack(">II", raw[16:24]) + item["dimensions"] = f"{width} × {height}" + item["sha256"] = hashlib.sha256(raw).hexdigest() + if item["key"] == "task-failed" and platform == "ios": + item["note"] = "执行失败,等待设备确认回巢;右侧为中断后已回巢,模拟状态不同。" + if item["key"] == "delivery-method": + item["note"] = "由工作台打开交付方式弹层。" if platform == "ios" else "由订单素材库打开交付方式弹层。" + count = used_keys.get(item["key"], 0) + 1 + used_keys[item["key"]] = count + if count > 1: + item["original_key"] = item["key"] + item["key"] = f'{item["key"]}-extra-{count}' + return metadata, result + + +def pair_records(ios, android): + ios_map = {r["key"]: r for r in ios} + android_map = {r["key"]: r for r in android} + keys = list(dict.fromkeys(ORDER + list(ios_map) + list(android_map))) + return [{"key": k, "title": TITLES.get(k, (ios_map.get(k) or android_map.get(k))["title"]), + "ios": ios_map.get(k), "android": android_map.get(k)} + for k in keys if k in ios_map or k in android_map] + + +def build_html(root: pathlib.Path, pairs, platforms): + escaped = lambda value: html.escape(str(value), quote=True) + navigation = "".join(f'{i:02d} {escaped(p["title"])}' for i, p in enumerate(pairs, 1)) + sections = [] + for i, pair in enumerate(pairs, 1): + columns = [] + for platform, label in [("ios", "iOS"), ("android", "Android")]: + screen = pair[platform] + if screen: + path = escaped(screen["path"]) + title = escaped(pair["title"]) + dimensions = screen.get("dimensions", "") + note = screen.get("note", screen.get("notes", "")) + if isinstance(note, list): + note = ";".join(note) + columns.append(f'
    {label}{escaped(dimensions)}
    ' + f'{label} {title}' + f'

    {escaped(note)}

    ') + else: + columns.append(f'
    {label}
    本次未提供该状态截图
    ') + recommendation = pair["recommendation"] + note = recommendation.get("note", "") + note_html = f'

    {escaped(note)}

    ' if note else '' + columns.append( + f'' + ) + unmatched = '' if pair['ios'] and pair['android'] else '单端补充' + comparison_path = f'comparison/{i:02d}-{pair["key"]}.png' + sections.append(f'

    {i:02d} {escaped(pair["title"])} {unmatched} ' + f'三列图

    {"".join(columns)}
    ') + source = escaped(json.dumps(platforms, ensure_ascii=False, indent=2)) + output = ''' + +机巢控制台 · iOS / Android UI 对比 +

    机巢控制台 · iOS / Android

    2026-11-05 · 当前源码正式页面 · 隔离模拟数据

    左列 iOS,中列 Android,右列为推荐基准与理由;窄屏时建议显示在截图下方。点击截图可查看完整原图,两端按等宽展示。

    iOS 使用截图专用副本,仅加入依赖替身和启动入口,正式页面布局原样保留。Android 使用当前正式 Screen 与隔离测试替身。

    任务、设备、游客、图传均为本地模拟来源;两端模拟图传配置及业务数据可能不同,画面状态差异不能代表真实设备行为。二维码为本地测试图形,不对应真实付款或收货。

    推荐仅针对本次可见的布局、文案与操作层级。两端一致时保留各端;缺图或模拟状态不同的组注明待核对。系统导航、键盘与安全区遵循平台习惯。

    SECTIONS
    运行环境和截图来源
    SOURCE
    ''' + (root / "index.html").write_text(output.replace("NAVIGATION", navigation).replace("SECTIONS", "".join(sections)).replace("SOURCE", source)) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("root", type=pathlib.Path) + parser.add_argument("--render-swift", default=str(pathlib.Path(__file__).with_name("render_gallery.swift"))) + parser.add_argument("--no-render", action="store_true") + args = parser.parse_args() + root = args.root.resolve() + ios_metadata, ios = read_manifest(root, "ios") + android_metadata, android = read_manifest(root, "android") + if not ios or not android: + raise SystemExit(f"Both screenshot sets required: iOS {len(ios)}, Android {len(android)}") + pairs = pair_records(ios, android) + review = json.loads((root / "recommendations.json").read_text()) + recommendations = {entry["key"]: entry for entry in review["entries"]} + expected_keys = {pair["key"] for pair in pairs} + if len(recommendations) != len(review["entries"]) or set(recommendations) != expected_keys: + raise SystemExit("Recommendations must cover every comparison group exactly once") + for pair in pairs: + pair["recommendation"] = recommendations[pair["key"]] + metadata = {"ios": ios_metadata, "android": android_metadata} + manifest = {"title": "机巢控制台 iOS / Android UI 对比", "capture_date": "2026-11-05", "source": "当前正式页面 + 隔离模拟数据", + "platforms": metadata, "pair_count": len(pairs), "paired_count": sum(bool(p["ios"] and p["android"]) for p in pairs), + "ui_review": {"reviewed_at": review["reviewed_at"], "scope": review["scope"], + "baseline_counts": dict(Counter(r["baseline"] for r in recommendations.values()))}, + "pairs": pairs} + (root / "manifest.json").write_text(json.dumps(manifest, ensure_ascii=False, indent=2)) + build_html(root, pairs, metadata) + if not args.no_render: + subprocess.run(["swift", "-module-cache-path", "/private/tmp/drone-gallery-swift-cache", args.render_swift, str(root)], check=True) + archive = root / "screenshots.zip" + with zipfile.ZipFile(archive, "w", zipfile.ZIP_DEFLATED) as target: + for path in sorted(root.rglob("*")): + if path.is_file() and path != archive and path.suffix not in {".log", ".apk", ".pyc"}: + target.write(path, path.relative_to(root)) + print(json.dumps({"pairs": len(pairs), "paired": manifest["paired_count"], "ios": len(ios), "android": len(android), + "html": str(root / "index.html"), "archive_bytes": archive.stat().st_size}, ensure_ascii=False)) + + +if __name__ == "__main__": + main() diff --git a/artifacts/drone-dock-ui-2026-11-05/tools/render_gallery.swift b/artifacts/drone-dock-ui-2026-11-05/tools/render_gallery.swift new file mode 100644 index 0000000..9e6fcde --- /dev/null +++ b/artifacts/drone-dock-ui-2026-11-05/tools/render_gallery.swift @@ -0,0 +1,217 @@ +import AppKit +import Foundation + +/// Renders review derivatives with two untouched screenshots and an independently sized recommendation column. +let root = URL(fileURLWithPath: CommandLine.arguments[1], isDirectory: true) +let manifestData = try Data(contentsOf: root.appendingPathComponent("manifest.json")) +let manifest = try JSONSerialization.jsonObject(with: manifestData) as! [String: Any] +let pairs = manifest["pairs"] as! [[String: Any]] +let output = root.appendingPathComponent("comparison", isDirectory: true) +try FileManager.default.createDirectory(at: output, withIntermediateDirectories: true) + +/// Returns review fields as display text while accepting optional or array-valued notes. +func textValue(_ value: Any?) -> String { + if let string = value as? String { return string.trimmingCharacters(in: .whitespacesAndNewlines) } + if let strings = value as? [String] { return strings.joined(separator: "\n") } + return "" +} + +/// Supplies a readable conclusion if a review object only specifies its baseline. +func recommendationLabel(_ recommendation: [String: Any]) -> String { + let label = textValue(recommendation["label"]) + if !label.isEmpty { return label } + let baseline = textValue(recommendation["baseline"]) + switch baseline.lowercased() { + case "ios": return "以 iOS 为准" + case "android": return "以 Android 为准" + case "both", "mixed", "mix", "hybrid": return "结合两端" + case "keep", "native", "platform": return "保留平台习惯" + case "", "pending": return "待补充建议" + default: return baseline + } +} + +/// Measures wrapped Chinese or Latin paragraphs with the same attributes used during drawing. +func styledText(_ text: String, size: CGFloat, color: NSColor = .black, weight: NSFont.Weight = .regular) -> NSAttributedString { + let paragraph = NSMutableParagraphStyle() + paragraph.lineBreakMode = .byWordWrapping + paragraph.lineSpacing = 4 + return NSAttributedString(string: text, attributes: [ + .font: NSFont.systemFont(ofSize: size, weight: weight), + .foregroundColor: color, + .paragraphStyle: paragraph + ]) +} + +/// Includes a small drawing allowance so the last line never clips at a fractional glyph boundary. +func textHeight(_ text: NSAttributedString, width: CGFloat) -> CGFloat { + let bounds = text.boundingRect(with: NSSize(width: width, height: CGFloat.greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading]) + return ceil(bounds.height) + 6 +} + +/// Draws every wrapped line and returns the consumed vertical space. +@discardableResult +func wrappedLabel(_ text: NSAttributedString, x: CGFloat, y: CGFloat, width: CGFloat) -> CGFloat { + let height = textHeight(text, width: width) + text.draw(with: NSRect(x: x, y: y, width: width, height: height), + options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil) + return height +} + +/// Draws short headings with the same minimum type size as all other review text. +func label(_ text: String, x: CGFloat, y: CGFloat, width: CGFloat, size: CGFloat, + color: NSColor = .black, weight: NSFont.Weight = .regular) { + wrappedLabel(styledText(text, size: size, color: color, weight: weight), x: x, y: y, width: width) +} + +/// Reads source screenshots without writing or transforming their files. +func image(_ record: [String: Any]?) -> NSImage? { + guard let path = record?["path"] as? String else { return nil } + return NSImage(contentsOf: root.appendingPathComponent(path)) +} + +/// Creates a correctly oriented PNG canvas used exclusively for derived comparison images. +func render(width: Int, height: Int, file: URL, draw: () -> Void) throws { + let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: width, pixelsHigh: height, + bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false, + colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)! + let context = NSGraphicsContext(bitmapImageRep: rep)! + NSGraphicsContext.saveGraphicsState() + context.cgContext.translateBy(x: 0, y: CGFloat(height)) + context.cgContext.scaleBy(x: 1, y: -1) + let flipped = NSGraphicsContext(cgContext: context.cgContext, flipped: true) + NSGraphicsContext.current = flipped + flipped.imageInterpolation = .high + NSColor.white.setFill() + NSRect(x: 0, y: 0, width: width, height: height).fill() + draw() + NSGraphicsContext.restoreGraphicsState() + try rep.representation(using: .png, properties: [:])!.write(to: file) +} + +/// Scales each complete source image to its column width without cropping. +func drawImage(_ img: NSImage?, x: CGFloat, y: CGFloat, width: CGFloat, placeholderHeight: CGFloat) { + guard let img else { + NSColor(white: 0.96, alpha: 1).setFill() + NSRect(x: x, y: y, width: width, height: placeholderHeight).fill() + label("本次未截图", x: x + 20, y: y + 50, width: width - 40, size: 20, color: .secondaryLabelColor) + return + } + let height = img.size.height * width / img.size.width + img.draw(in: NSRect(x: x, y: y, width: width, height: height), from: .zero, + operation: .sourceOver, fraction: 1, respectFlipped: true, hints: nil) +} + +/// Describes one measured block in the right-hand review column. +struct ReviewBlock { + let content: NSAttributedString + let trailingSpace: CGFloat +} + +/// Separates the conclusion, rationale, action, and limitations without truncating any field. +func reviewBlocks(_ recommendation: [String: Any]) -> [ReviewBlock] { + var blocks = [ReviewBlock(content: styledText(recommendationLabel(recommendation), size: 25, weight: .semibold), trailingSpace: 28)] + for (key, heading) in [("reason", "理由"), ("action", "建议调整"), ("note", "对照说明")] { + let value = textValue(recommendation[key]) + guard !value.isEmpty else { continue } + blocks.append(ReviewBlock(content: styledText(heading, size: 18, color: .secondaryLabelColor, weight: .medium), trailingSpace: 6)) + blocks.append(ReviewBlock(content: styledText(value, size: key == "note" ? 18 : 20), trailingSpace: 26)) + } + return blocks +} + +let screenshotWidth: CGFloat = 540 +let reviewX: CGFloat = 1180 +let reviewWidth: CGFloat = 320 +let canvasWidth = 1534 + +for (index, pair) in pairs.enumerated() { + let a = image(pair["ios"] as? [String: Any]) + let b = image(pair["android"] as? [String: Any]) + let recommendation = pair["recommendation"] as? [String: Any] ?? [:] + let blocks = reviewBlocks(recommendation) + let reviewHeight = blocks.reduce(CGFloat(0)) { $0 + textHeight($1.content, width: reviewWidth) + $1.trailingSpace } + let imageHeight = max(a.map { $0.size.height * screenshotWidth / $0.size.width } ?? 240, + b.map { $0.size.height * screenshotWidth / $0.size.width } ?? 240) + let contentHeight = max(imageHeight, reviewHeight) + let filename = String(format: "%02d-", index + 1) + (pair["key"] as! String) + ".png" + try render(width: canvasWidth, height: Int(ceil(contentHeight + 190)), file: output.appendingPathComponent(filename)) { + label(pair["title"] as! String, x: 34, y: 20, width: CGFloat(canvasWidth - 68), size: 30, weight: .semibold) + label("iOS", x: 34, y: 76, width: screenshotWidth, size: 25, weight: .medium) + label("Android", x: 606, y: 76, width: screenshotWidth, size: 25, weight: .medium) + label("推荐以哪端为准", x: reviewX, y: 76, width: reviewWidth, size: 24, weight: .medium) + drawImage(a, x: 34, y: 120, width: screenshotWidth, placeholderHeight: 240) + drawImage(b, x: 606, y: 120, width: screenshotWidth, placeholderHeight: 240) + NSColor(white: 0.88, alpha: 1).setFill() + NSRect(x: 1162, y: 120, width: 1, height: contentHeight).fill() + var y: CGFloat = 120 + for block in blocks { + y += wrappedLabel(block.content, x: reviewX, y: y, width: reviewWidth) + block.trailingSpace + } + label("本地模拟 · 2026-11-05 · 完整原图请查看 ios / android 目录", x: 34, y: contentHeight + 144, + width: CGFloat(canvasWidth - 68), size: 18, color: .secondaryLabelColor) + } +} + +/// Stores measured overview geometry so long recommendation labels expand the corresponding row. +struct OverviewCell { + let pair: [String: Any] + let iosImage: NSImage? + let androidImage: NSImage? + let title: NSAttributedString + let recommendation: NSAttributedString + let titleHeight: CGFloat + let recommendationHeight: CGFloat + let imageOffset: CGFloat + let height: CGFloat +} + +let overviewColumns = 3 +let cellWidth: CGFloat = 476 +let cellContentWidth: CGFloat = 450 +let overviewImageWidth: CGFloat = 216 +let cells: [OverviewCell] = pairs.enumerated().map { index, pair in + let a = image(pair["ios"] as? [String: Any]) + let b = image(pair["android"] as? [String: Any]) + let title = styledText(String(format: "%02d ", index + 1) + (pair["title"] as! String), size: 20, weight: .medium) + let recommendation = styledText("建议:" + recommendationLabel(pair["recommendation"] as? [String: Any] ?? [:]), + size: 18, color: .systemBlue, weight: .medium) + let titleHeight = textHeight(title, width: cellContentWidth) + let recommendationHeight = textHeight(recommendation, width: cellContentWidth) + let imageOffset = titleHeight + 6 + recommendationHeight + 8 + 32 + let imageHeight = max(a.map { $0.size.height * overviewImageWidth / $0.size.width } ?? 180, + b.map { $0.size.height * overviewImageWidth / $0.size.width } ?? 180) + return OverviewCell(pair: pair, iosImage: a, androidImage: b, title: title, recommendation: recommendation, + titleHeight: titleHeight, recommendationHeight: recommendationHeight, + imageOffset: imageOffset, height: imageOffset + imageHeight + 64) +} +let rows = Int(ceil(Double(cells.count) / Double(overviewColumns))) +let rowHeights: [CGFloat] = (0..`;POST 使用 `Content-Type: application/json`。门店、账号、景区、订单和任务归属由后端检查,前端不额外提交这些重复定位参数。 + +所有新版 HTTP 路径固定,不含业务 ID。GET 的 task_id、request_id、include_info 等通过 `?` 后的 Query 传递,没有请求体;POST 的 task_id 和其他业务字段全部放 JSON 请求体,不在路径或 Query 中传递。WebSocket 仍按下文 params 对象传参。 + +成功:`code=100000`,`msg`,`data`。HTTP 读取成功 200;动作持久受理且待确认 202;已取得明确结果或幂等重放结果可为 200。**HTTP 成功不等于设备动作 succeeded。** 不增加必须重复携带的 Header 版本字段或 UI 文案字段。 + +业务失败保留非成功整数 code(示例采用 100099),新增稳定 `error_code` 用于分类,`msg` 用于提示。整数编码由后端沿用统一规范;客户端不通过中文提示猜“是否无权限”。 + +HTTP 400 参数错误、401 登录失效、403 任务读取无权限、404 任务不存在、409 动作条件 / 批次冲突、503 临时服务故障,均须返回可解析的上述业务 JSON。动作不可执行只影响该动作,不等于整页禁止读取。 + +### 3.2 身份和版本 + +| 字段 | 定义 | +| --- | --- | +| `task_id` | 始终是订单飞行任务 ID,即原 `order_flight_task.id`;不是航线任务 ID | +| `execution_id` | 每次召唤受理后分配的执行标识,非空不透明字符串;换批次必须换值 | +| `state.version` | 状态模块在整个 task 生命周期递增,换 execution 不归零 | +| `telemetry.version` | 指标模块在整个 task 生命周期独立递增,换 execution 不归零 | +| `operation.version` | 同一个 request_id 的动作结果版本,独立递增 | +| `state.live_version` | 图传来源连接信息变化标识,在 task 内递增;不是凭证续期版本 | + +同一模块版本的内容必须一致;新版本整份替换、同版本忽略、旧版本丢弃。**不能拿 telemetry 的版本大小判断 state 新旧,也不能混比动作 version。** 计数不能因 Redis 清空 / 服务重启归零。 + +新 execution 先发布新 state,再发布其指标。切换时清旧指标、倒计时和图传;不通过 execution 字符串排序判断新旧。未知 execution 的单独指标先丢弃并合并发一次 GET 全量核对,不能让指标包推动业务换批次。 + +### 3.3 state 对象 + +| 字段 | 类型 | 必需 | 说明 | +| --- | --- | --- | --- | +| `version` | int64,正数 | 是 | 状态版本 | +| `stage` | string | 是 | 下节列出的业务阶段 | +| `paused` | bool | 是 | **已确认的手动暂停**;自动到点等待是 false | +| `context` | string 或 null | 是 | 开拍 / 继续用的当前语义控制周期,不是权限集合 | +| `live_version` | int64,非负 | 是 | 两路来源出现、失效、替换或需重新连接时变化 | +| `reason` | string 或 null | 是 | 异常 / 中断原因码,如 MANUAL_RETURN;正常为空 | +| `operations` | array | 是 | 当前执行的未结束动作及近期结果;无记录为 [] | + +不返回重复的 task/OFT/wayline 状态、原始设备证据、素材阶段、权限、倒计时、主副标题、按钮配置。后端内部仍须保存完整设备事实和拍摄结果,按统一函数归一化 stage;字段精简不表示丢掉内部判定依据。 + +### 3.4 stage 与 App 本地状态 + +| stage | App 本地中央状态 | 精确语义 | +| --- | --- | --- | +| `travelling` | 前往拍摄点 | 召唤已受理,含开盖 / 自检 / 起飞准备及前往首点,不宣称已起飞 | +| `ready` | 已到达待开拍 | 本 execution 已到首点,尚未实际开拍 | +| `recording` | 拍摄中 | 已确认实际录制 | +| `returning` | 返航回收中 | 正常 / 中断返航,直到降落、入巢、关盖收尾结束 | +| `returned` | 已完成返航 | **未正常拍完的中断流程**已确认回收结束,仍保留中断结果 | +| `completed` | 拍摄任务已完成 | **正常流程**拍完并回巢、关盖,后端确认本次任务完成 | +| `failed` | 拍摄失败 | 后端明确任务执行失败,且没有待完成飞行/回收;不能用一次按钮拒绝充当任务失败 | +| `cancelled` | 任务已取消 | 明确取消且没有仍待结束的飞行 / 回收过程 | +| `unknown` | 状态待确认 | 当前业务阶段确实无法判断;临时 HTTP / WS 失败不要求把旧已知阶段改 unknown | + +`paused=true` 时,App 在保留 stage 的同时显示第十种本地状态“已暂停”;stage=returning 时可显示“返航已暂停”。仅适用于 travelling/ready/recording/returning。终态 returned/completed/failed/cancelled 不得 paused=true。 + +后端维护暂停前任务方向,继续后恢复对应 stage。手动暂停 ready 后继续仍 ready;暂停返航后继续仍 returning。App 不接收 / 推导 resume_phase。 + +**returned 与 completed 是业务终态,不是原始 inside 信号。** 两者都要求后端确认回收结束;仅在巢、设备空闲、任务失败、计次变化、超时等待都不够。未离巢取消也不能产出 returned。返回 completed 后,后续素材失败不改成 failed。 + +无 execution、仅张工任务已创建但尚未召唤时,GET 返回 `TASK_NOT_STARTED`(409);不新增“待召唤”中央主状态,也不假造 execution。首次召唤从准备页提交,受理后传最新 state 进入任务页。 + +## 4. GET 当前状态与六项指标 + +```text +GET /api/app/airport/v2/tasks/state?task_id=501&include_info=1 +``` + +| 参数 | 位置 | 必填 | 默认 | 说明 | +| --- | --- | --- | --- | --- | +| task_id | Query,正整数 | 是 | — | 已有订单飞行任务 | +| include_info | Query,0/1 | 否 | 0 | 首次需要顶部摘要时为1;无其它业务 Query | + +无 JSON 请求体。不传 live_battery/live_metrics;v2 固定读取服务端维护的数据,不因刷新主动采集设备。 + +返回 JSON: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + }, + "info": { + "order_number": "261106000001", + "spot_name": "示例拍摄点", + "route_name": "示例航线", + "tourist_label": "游客 158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "cover_url": null + } + } +} +``` + +`include_info=0` 时直接省略 info,其他结构不变。info 只放页面需要的顶部摘要和素材页导航所需订单号;封面没有时为 null,不返回演示图片。WS 不重复推 info。 + +### 4.1 telemetry 对象 + +固定六项:`battery/env_temp/wind_speed/rainfall/signal/satellite`。 + +每项只返回 `value`、`observed_at`、`stale`:value 是可直接显示的字符串或 null,observed_at 是真实采集时间(RFC3339 带时区,可 null),stale 是本项过期标记。无原始 raw、单位重复字段、供应商证据和整份物模型。 + +- 首次无读数也要返回六项:value=null、observed_at=null、stale=true;不能补0或阻塞 state 首包。 +- 每项独立判断真实采集时间。约15秒补采、约120秒过期;只保留最近有效值,不因读取接口刷新采集时间。 +- 有有效新采样 / 本项过期 / 恢复时,递增 telemetry.version 并推送;不因此改 state.version、context、倒计时或按钮等待。 +- 新 execution 清空上一执行的指标,不跨设备复用。后端主动维护活跃飞行直到回收结束,不依赖 App 调 GET / live 或是否有订阅。 +- completed/returned 后可停止采新读数;仍有读取 / 订阅时应如实维护过期状态。时间流逝本身不应伪装成新采样。 + +## 5. POST 统一动作 + +```text +POST /api/app/airport/v2/tasks/actions +``` + +### 5.1 入参 + +| 字段 | 类型 | 必填 | 说明 | +| --- | --- | --- | --- | +| task_id | 正整数 | 是 | 已有订单飞行任务 ID,从 JSON 请求体读取 | +| request_id | UUID string | 是 | 本次明确点击的唯一标识,客户端发送前生成 | +| action | string | 是 | summon/start_recording/pause/resume/return_home | +| expected_execution_id | string 或 null | 是 | 必须对应用户操作的当前执行;仅首次召唤可null | +| context | string 或 null | 开拍/继续时带 | 原样使用最新 state.context;暂停/返航/召唤省略 | + +暂停示例: + +```json +{ + "task_id": 501, + "request_id": "11111111-1111-4111-8111-111111111111", + "action": "pause", + "expected_execution_id": "execution-001" +} +``` + +开拍示例: + +```json +{ + "task_id": 501, + "request_id": "22222222-2222-4222-8222-222222222222", + "action": "start_recording", + "expected_execution_id": "execution-001", + "context": "context-ready-001" +} +``` + +继续示例: + +```json +{ + "task_id": 501, + "request_id": "33333333-3333-4333-8333-333333333333", + "action": "resume", + "expected_execution_id": "execution-001", + "context": "context-paused-001" +} +``` + +首次召唤示例: + +```json +{ + "task_id": 501, + "request_id": "77777777-7777-4777-8777-777777777777", + "action": "summon", + "expected_execution_id": null +} +``` + +重召唤仍为 summon,expected_execution_id 填原执行;返航为 return_home,其他结构与暂停相同。App 不提交 plane_id/air_line_id 覆盖任务锁定信息,不通过 tasks/create 重建失败任务。 + +### 5.2 已受理返回 JSON + +HTTP 202: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + }, + "state": { + "version": 19, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + } + ] + } + } +} +``` + +回执中的 state 是**当前完整状态模块**,不附带无关的六项指标和固定摘要。operation 用于明确关联本次请求;state.operations 中出现同一请求时,内容与动作版本必须一致。该 state 可以直接采纳,无须每次 POST 成功固定追加 GET。 + +动作持久受理后应尽快返回pending/HTTP202,不让HTTP一直等待设备动作、返航或关盖。同步已取得确证时可直接返回明确结果;后续设备确认通过state/查询更新。设备确认等待必须有界,超过合理确认期限应转unknown而非假失败;具体期限由朱工结合上游能力登记,App结束持续动画后仍保留原请求的防重和只读核对。 + +本例设备尚未确认手动暂停,所以 stage 仍 ready、paused=false,只有该暂停按钮等待。真实确认后,新 state paused=true、动作 status=succeeded/version=2,再更新中央。 + +### 5.3 operation 最小结构 + +| 字段 | 必需 | 定义 | +| --- | --- | --- | +| request_id | 是 | 唯一动作记录 ID,等于客户端原请求 ID,不另设 command_id/action_id | +| execution_id | 是,可null | 原请求 expected_execution_id;首次 summon 可null | +| new_execution_id | 仅 summon 成功建批次时 | 新执行标识,持久分配后不变 | +| action | 是 | 原动作名 | +| status | 是 | 下表动作进度 | +| version | 是 | 此 request_id 的结果版本,初始1,变化递增 | +| error | 是,可null | 明确拒绝/失败/未知原因 `{code,msg}`,不是中央状态文案 | + +| status | 精确含义 | +| --- | --- | +| pending | 已持久受理,等待派发或设备确认 | +| succeeded | 达到该动作目标,含义见下表 | +| rejected | 明确校验拒绝,保证没有派发该动作 | +| failed | 明确执行失败,不能把超时直接标失败 | +| superseded | 旧意图被新动作替代,不表示旧物理动作从未执行 | +| unknown | 是否生效尚不能确认;可在取得证据后更新为明确结果 | + +动作状态比较只按相同 request_id 的 version。迟到的 pending(version=1) 不能覆盖已收到的 succeeded(version=2)。unknown 不能当失败后自动重发。 + +succeeded/rejected/failed/superseded 是该动作的明确终态,不能因迟到设备回执生成更高version的pending/unknown,也不能复活被取代的旧意图。迟到的真实设备事实仍应核对并更新当前state;这与旧动作恢复有效是两回事。只有pending/unknown可以继续等待确证并收敛到明确结果。 + +| action | succeeded 的含义 | +| --- | --- | +| summon | 新 execution 已建立、航线被设备侧受理调度;不代表已起飞/到达 | +| start_recording | 已确认进入实际录制 | +| pause | 已确认本次手动暂停;首点自动悬停不算 | +| resume | 已确认解除本次手动暂停,恢复原环节;ready 软恢复不能直接开拍 | +| return_home | 已确认进入返航;起飞前支持取消时,也可表示已确认取消起飞。**均不代表正常拍摄完成** | + +return_home 若在起飞前执行:后端按实际能力撤销起飞,确认后 stage=cancelled;不支持则 rejected 并提示,保留原 stage;不能把仍 inside 当已完成返航。具体上游取消能力由朱工确认,不能用假成功替代。 + +### 5.4 召唤回执的身份 + +重召的 operation.execution_id 是旧执行,new_execution_id 是新执行;外层 data.execution_id/state 已属于新执行。客户端按本次 request_id 识别合法换批,不能把重召回执当成旧包。首次召唤相同规则,只是原执行为null。 + +完整例子见附件 14。新 execution 一旦受理,state.stage=travelling(含起飞准备),上页可直接用回执 state 展示“前往拍摄点”,不等待物理起飞才跳转。 + +### 5.5 后端校验、并发与幂等 + +1. 后端必须校验最新设备/任务条件。去掉权限字段只精简回包,不移除服务端校验,也不让 App 根据按钮文案猜操作。 +2. 幂等范围:认证所得门店范围 + task_id + request_id。**先查已有幂等记录,再核 execution/context**;同键同参数回同一动作及当前结果,不再派发;同键异参返回 IDEMPOTENCY_CONFLICT。 +3. 任务可操作期间不删除幂等和动作记录,归档后禁止新控制,建议再保留至少7天查询。重放可返回最新状态,保证同一动作身份和不重复派发,不要求正文逐字不变。 +4. 旧执行请求返回 EXECUTION_CHANGED,不能把上一轮迟到指令作用到新飞行。**不得要求全量 state/telemetry 版本严格相等才接收动作**,指标变化不应误挡暂停/返航。 +5. context 只用于开拍/继续的语义周期;指标、live_version、普通 GET、无关按钮 loading 不轮换。ready→手动暂停→继续 ready 后必须有新的开拍 context;每次新的手动暂停生成新的继续 context。 +6. 暂停/返航受理时应作废与当前意图冲突的旧开拍/恢复上下文;真正出队下发前再次核 context 与是否已被取代。自动/手动开拍也须争用同一有效开拍上下文,避免双发;App 不实现自动开拍调度。 +7. context 缺失/过期或当前不适用时返回 ACTION_CONTEXT_CHANGED/ACTION_NOT_ALLOWED 和当前 state。App 不自动替换 context 重发,也不据 context=null 修改中央阶段。 +8. 对同一真实设备共享串行派发和占用锁,覆盖新旧接口与多个账号。App 可串行 HTTP 提交,但不能等待前一设备结果才允许另一安全动作。 +9. 暂停尚 pending 时允许提交返航,由后端按当前条件处理。返航清理旧暂停意图;迟到旧暂停回执不把页面锁回暂停。返航后新的暂停则保留返航方向,继续仍恢复返航,不简单删除原返航目标。 +10. 动作先持久落记录再对接设备。设备已受理而服务端结果丢失时保留 unknown 并探测;上游无幂等能力时不能宣称物理严格执行一次,也不能盲目补发。 +11. 可信的本次拍摄正常/中断结果由后端保存到收尾结束,分别输出 completed/returned;不能仅凭最后一个 DJI success 决定。 + +同一execution的同一种动作尚pending/unknown时,即使另一个客户端换了request_id,也不得再次派发同动作:返回ACTION_IN_PROGRESS并保留新请求的rejected记录,同时返回当前state供核对。该同动作防重不能变成全局等待锁;例如pause仍待确认时,return_home仍独立评估并可按规则取代旧意图。 + +state.operations 必须保留当前执行所有 pending/unknown 动作,并至少保留最近5条明确结果。召唤动作按 new_execution_id 归入新执行;旧动作历史仍可查询。记录从数组消失不能当成功。 + +### 5.6 拒绝与业务失败 + +单次动作不可执行时不改变中央 stage。设备忙、低电量、状态不符等返回稳定 error_code 和提示;可定位的合法请求保留 rejected 记录。响应 data 尽可能含 operation 和当前 state,若鉴权/参数/任务身份尚不能成立则 data=null。 + +例如客户端发了旧 execution: + +```json +{ + "code": 100099, + "msg": "当前执行已变化,请刷新后重试", + "error_code": "EXECUTION_CHANGED", + "data": null +} +``` + +操作响应的 msg 可以展示,主状态标题仍由 App 本地枚举维护。400/401/403/404/409 等错误不能被网关吞成非 JSON。failed 与 rejected 的来源要记录后端日志,不把数据库错误或设备超时变成假成功。 + +## 6. GET 按 request_id 查询动作 + +```text +GET /api/app/airport/v2/tasks/action-requests?task_id=501&request_id=11111111-1111-4111-8111-111111111111 +``` + +Query 必填 task_id(正整数)和 request_id(原动作 UUID),无请求体;即使丢失整个 POST 回执,也能用发送前已生成的原 request_id 查到。找到时返回 operation 及**同一提交视图下的当前 state**;外层 execution_id 是任务当前执行,operation.execution_id 可以是历史执行。 + +例外:首次summon已经被明确拒绝、尚未建立任何执行时,动作记录仍应可查;data.execution_id=null、state=null,operation.status=rejected。此处允许没有state,不改变GET state对此场景返回TASK_NOT_STARTED的约定,也不能为了查询回包造一个execution。 + +结果尚未知的示例: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + }, + "state": { + "version": 21, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + } + ] + } + } +} +``` + +尚未查到: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "operation": null + } +} +``` + +operation=null 只表示此刻未查到,**不能证明原 POST 永远不会到达**。App 不因此换 request_id 自动补发。短期可约2秒查一次,之后合并到5秒读取兜底/手动核对,不为每个未知动作开启永久并行定时器。 + +操作结果只更新对应等待状态,中央按有效 state 更新。旧执行动作仍可核对,但不能用它覆盖当前执行。所有 pending/unknown/明确结果变化都需递增该 operation.version;当前执行相关变化还需递增 state.version 并推送。 + +## 7. WebSocket v2 + +### 7.1 连接、票据与编号 + +正式 `wss://api.zhifly.cn/wss`,测试 `wss://api-test.zhifly.cn/wss`,与 HTTP 环境一致。票据继续取旧公共 GET `/api/app/socket-token`,无业务入参,沿用 App 登录身份;票据不是登录 token,也不是 RTC token。原响应可含 account_type,任务页只需 socket_token/expire_seconds。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "expire_seconds": 3600, + "account_type": "store_user" + } +} +``` + +必须由朱工登记两个**未占用整数**: + +| 常量 | 含义 | +| --- | --- | +| V2_SUBSCRIBE_TYPE | 新版任务订阅 | +| V2_UNSUBSCRIBE_TYPE | 新版任务退订 | + +**以下订阅 JSON 是模板**:`${V2_SUBSCRIBE_TYPE}` / `${V2_UNSUBSCRIBE_TYPE}` 暂用字符串占位,实际发送时必须替换为分配的 JSON 整数,不允许按字符串发送,也不使用0/310/311等未确认编号代替。分配后后端更新这两处登记值,双方一起固化;不用在每个包再重复 protocol_version。 + +传输连接建立后直接发送一次业务 JSON **文本帧**,新版不依赖 Opened/ready/received 才开始订阅。共享服务仍可为旧连接保留旧欢迎行为,新版忽略无关欢迎帧,不让它延长超时。 + +### 7.2 订阅请求模板 + +```json +{ + "type": "${V2_SUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "request_id": "subscribe-request-example" + } +} +``` + +请求只包含 task_id、票据和订阅关联 request_id,不另订阅指标频道或图传频道。 + +### 7.3 正式成功:一次带齐两个完整模块 + +成功必须已经完成鉴权和频道登记,并能提供完整 state 与 telemetry;没有指标时返回六项未知值,不阻塞 state 首包。data 与 GET state 的动态部分一致,不含 info。 + +```json +{ + "code": 100000, + "event": "airport_v2.subscribed", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + }, + "request_id": "subscribe-request-example" +} +``` + +该帧通过当前连接、订阅请求、任务、执行及模块结构校验后,WS 才就绪,停止常规 HTTP 轮询。按各模块版本采纳;即使 HTTP 已返回更高版本,也不能用此帧回滚,服务端随后补发首包之后的新变化。 + +失败必须明确返回,不返回“成功但无首包”,也不再输出 subscribe_meta/has_snapshot/HTTP seed 业务分支。 + +### 7.4 两类业务推送 + +**类型一:任务状态,event=airport_v2.state。** 中央业务阶段、手动暂停、动作进展、context 和 live_version 在同一条状态里原子更新。以下是正常返航回收中: + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 30, + "stage": "returning", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} +``` + +正常回巢关盖、后端确认任务完成后: + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 31, + "stage": "completed", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} +``` + +若未正常拍完,中断返航收尾结束则输出 returned(不是 completed): + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 32, + "stage": "returned", + "paused": false, + "context": null, + "live_version": 2, + "reason": "MANUAL_RETURN", + "operations": [] + } + } +} +``` + +**类型二:六项指标,event=airport_v2.telemetry。** 每次返回完整六项,不能用指标更新清理按钮等待、改中央状态或重建倒计时。 + +```json +{ + "code": 100000, + "event": "airport_v2.telemetry", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + } +} +``` + +两类均为**完整子对象替换**,不推 patch。状态与指标允许采集时间不同,任何一类不能等待另一类采集成功才发送。任务状态和操作结果不拆成独立第三类;图传来源变化仅改变 state.live_version。 + +### 7.5 协议心跳与错误 + +只有上面两类是业务数据消息;subscribed/heartbeat/error/unsubscribed 是连接协议帧,不是新增业务订阅。 + +后端默认每20秒必须发送一帧应用心跳,携带两类权威最新版本;即使某类业务推送频繁也不省略心跳: + +```json +{ + "code": 100000, + "event": "airport_v2.heartbeat", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state_version": 30, + "telemetry_version": 8 + } +} +``` + +- 两版本与本地一致:没有变化,正常等待,不因“拍摄120秒没变化”额外轮询。 +- 任一版本领先:合并安排一次 GET state 修复;未追上时保持5秒 HTTP 兜底,追上且订阅健康后停常规轮询。 +- 版本落后:不能回滚,记录异常;持续不一致时重建订阅。 +- 正式首包算首次双版本同步;随后60秒没有当前订阅的有效双版本心跳,则HTTP兜底并重连。单独state/telemetry业务帧只证明传输活跃,不能重置这条核对期限,避免“指标一直来、状态一直漏”却永久假健康。网络Ping/Pong也不能替代双版本核对。 +- 旧 subscription_id、旧连接回调、解析错误或不同任务的帧不算有效,不能延长健康期。心跳也不代表设备指标新鲜。 + +正式订阅失败示例: + +```json +{ + "code": 100099, + "event": "airport_v2.error", + "request_id": "subscribe-request-example", + "error_code": "AUTH_TIMEOUT", + "msg": "订阅鉴权暂不可用", + "data": { + "task_id": 501 + } +} +``` + +订阅成功后的错误带 subscription_id;成功前必须回显订阅 request_id,防止旧连接失败回执影响新会话。按 error_code 分类,不匹配中文 hint。 + +### 7.6 首包竞态与恢复 + +1. 后端鉴权、登记、读首包全链路建议总计不超过3秒,Redis/DB/队列各有有界超时。App 首包等待上限建议10秒;收到明确失败立即结束等待。 +2. 先登记频道,再获取当前一致快照。首包发送前缓存连接内后续更新,先发正式首包,再按各模块版本补发更新;同连接发送串行,防止漏掉登记/读取之间的变化。 +3. 空缓存由统一状态服务生成。不能生成则 SNAPSHOT_UNAVAILABLE 并撤销本次订阅,不能长期空等或给半成功ACK。 +4. 新 execution 的 state 先到,随后是其新指标;完整首包的两模块属于同一个执行。旧指标或凭证不能用于新执行。 +5. 发布失败需可靠补投(可采用持久消息/outbox);允许重复,不能悄悄丢。心跳取权威最新版本,不取该连接上次发出的版本。 +6. WS未就绪/失败/断线时,前台默认5秒串行GET(后端建议间隔限制2~30秒),同时按1/2/4/8/16/30秒加轻微抖动重连;每轮重新取票。页面只保留一个状态GET在途。 +7. TASK_READ_FORBIDDEN/TASK_NOT_FOUND 停该任务两路读取;SOCKET_TICKET_EXPIRED 仅换票,不清登录;AUTH_TIMEOUT/TEMPORARILY_UNAVAILABLE/SNAPSHOT_UNAVAILABLE 保留HTTP兜底。 +8. 离页/后台停止读取并尽力退订,不取消后台真实设备任务;回来立即GET并重新订阅。 + +### 7.7 退订模板 + +```json +{ + "type": "${V2_UNSUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "subscription_id": "subscription-example-001" + } +} +``` + +服务端可回 event=airport_v2.unsubscribed,带 subscription_id/task_id;App 离页不等待回执。旧310/311和旧推送流程保持不变,新频道不能向旧订阅者发送新结构。 + +## 8. POST 两路图传参数 + +```text +POST /api/app/airport/v2/tasks/live +``` + +入参: + +```json +{ + "task_id": 501, + "execution_id": "execution-001", + "viewer_id": "66666666-6666-4666-8666-666666666666" +} +``` + +| 字段 | 定义 | +| --- | --- | +| task_id | 已有订单飞行任务正整数 ID,从 JSON 请求体读取 | +| execution_id | 本次观看对应执行,必须与当前有效执行一致 | +| viewer_id | App 本次可见观看会话UUID;补取/续期保持不变,新观看/换执行重新生成 | + +该POST是幂等“确保观看并取当前参数”:同一 viewer_id 不反复创建观看身份、健康房间或重复启动已有设备流。后端仅按需开缺失来源,并对同任务不同观看者去重;重复调用可以返回刷新后的凭证,不要求原样重放过期参数。 + +返回 JSON,首版明确只支持火山 Volc RTC: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "live_version": 2, + "refresh_after": 30, + "sources": { + "airport": { + "available": true, + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_AIRPORT_ROOM", + "user_id": "EXAMPLE_VIEWER_AIRPORT", + "token": "EXAMPLE_RTC_TOKEN", + "expires_in": 2400 + }, + "drone": { + "available": false, + "reason": "DRONE_NOT_READY" + } + } + } +} +``` + +| 出参 | 定义 | +| --- | --- | +| task_id / execution_id / live_version | 必须回显当前来源版本和执行,用于丢弃旧参数 | +| refresh_after | 建议下次补取/续期的秒数。缺一路默认30秒、限制5~60;两路健康时可按最早凭证到期前30秒安排,至少5秒 | +| sources.airport / sources.drone | 固定两路,不再重复返回第三份 play 推荐对象 | +| available | 本次有有效连接参数,不代表手机已收到画面 | +| app_id/room_id/user_id/token | 结构化火山入房参数,只在available=true时必需 | +| expires_in | 回包时剩余有效秒数;App按请求往返时间保守扣减,再用单调时钟续期,不依赖手机墙上时钟 | +| reason | available=false时可选原因码,由App映射“等待来源”等提示 | + +不返回拼接URL、重复raw、设备指标或业务stage。非volc来源暂明确返回UNSUPPORTED_LIVE_PROVIDER,不能伪装当前App已支持其他SDK。 + +### 8.1 live_version 与实际画面 + +- 后端发现来源出现、撤销、换设备或必须重连的房间身份变化:递增live_version,同时递增state.version,随任务状态推送;**不新增第三类业务WS消息**。 +- App发现来源版本变化,在仍可见、当前执行尚未回收结束时合并请求live。两类数据与live回包交错时,以当前execution和已知来源版本为准,旧回包不能恢复旧画面。 +- 纯token续期不改live_version、不改业务state;保持有效room_id/user_id,使用SDK续期,不反复退房入房。 +- 同一viewer的live请求串行,WS变更、定时补参和续期合并到同一请求循环;已有请求在途时只记录需要再查,不并发另开请求。客户端按本地观看/请求代次作废迟到响应,即使live_version相同,旧请求也不能覆盖新请求凭证。纯续期不应提前吊销仍在原有效期内的旧凭证,避免客户端刚换参前掉流。 +- expires_in必须先保守扣除本次请求耗时;已无剩余有效期的参数不可入房。凭证临期需要尽快续取时,不能因为refresh_after“至少5秒”而等过实际过期;最小间隔用于普通补参/失败退避,不能延长旧凭证有效期。过期旧画面不能继续标实时。 +- 后端参数可用、SDK发布、手机实际视频帧是不同层次。只有真实有画面才显示实时标识;无人机有帧后切换,无人机异常则退回仍健康的机巢,两路无画面则等待。 +- 有一路缺参时仍按refresh_after补取,不能只依赖一次WS通知;保留健康房间。HTTP暂时缺某路参数不把仍有帧、凭证有效的健康连接直接关闭。 +- 必须区分“本次暂取不到参数”和“来源已明确撤销/替换”:available=false且reason=SOURCE_REVOKED,或新版本明确替换该路房间身份时,停止该路被撤销/替换的旧连接和凭证,不沿用健康流保留规则;其它健康来源可继续。替换锁定飞机必须使用新execution,同一设备的房间身份变化才仅增加live_version;不能在同execution下静默把画面换成另一架飞机。 +- completed/returned/failed/cancelled、离页、后台或执行身份失效时,停止本机接收,取消补流和续期;迟到live/SDK回调不得重启。初次读到这些已结束状态时不先调用live。 +- 任务failed/cancelled的输出必须与实际没有待回收飞行相符;仍在回收时应输出returning继续观看,不能用“拍摄失败”提前隐藏空中流程。 +- 释放本机RTC不调用设备停流,不影响其他观看者。后端清理失效viewer记录;需要设备级停流时另行定义,不能混入本次客户端退出。 + +后端暂无法可靠感知来源变化时,应反馈并保留限频缺流补取;不能伪造live_version变化。无论是否有WS通知,实际首帧/卡顿判断都由SDK完成。 + +## 9. App 本地展示与按钮规则 + +### 9.1 本地十种业务状态 + +前往拍摄点、已到达待开拍、拍摄中、已暂停、返航回收中、已完成返航、拍摄任务已完成、拍摄失败、任务已取消、状态待确认。 + +本地映射规则:先校验数据,若paused=true且stage为可暂停阶段,显示已暂停并保留原stage;否则按第3.4节映射。返航暂停显示“返航已暂停”,恢复后仍返航。没有“素材处理失败”或“上传中”主状态。 + +加载、网络错误、按钮等待、RTC播放状态和倒计时是独立状态。请求失败有旧数据时保留旧业务阶段;单次动作拒绝只提示,不把整个任务改failed。 + +### 9.2 常规按钮 + +| 当前本地场景 | 主操作 / 安全按钮 | +| --- | --- | +| 前往 / 待开拍 / 拍摄中 | 通常可暂停、返航;ready另有开始拍摄 | +| 已手动暂停 | 暂停按钮改继续任务;非返航暂停通常还可返航 | +| 返航回收中(含暂停返航) | 禁重复返航;返航未暂停可暂停,已暂停则继续任务 | +| 已完成返航 | 主按钮重新召唤恢复可点;暂停、返航不可点 | +| 拍摄任务已完成 | 主按钮查看素材;暂停、返航不可点 | +| 拍摄失败 | 显示原因和重新召唤入口;是否仍有权益、设备是否可用等均由POST校验,不再要求一个“可恢复”权限字段 | +| 任务已取消 | 展示取消结果;不在本稿中新增“取消后必提供重召”的产品约定,也不因取消而假造returned | +| 状态暂未知 / 刷新失败 | 不因一次读取失败整区禁用已有安全操作;后端最终校验,明确账号/任务身份失效则停操作 | + +本表是App固定展示规则,不要求后端返回可操作列表。对应动作正在提交/待确认时仅该按钮loading、防重复;其他安全动作仍可按规则尝试。会改变开拍语义的本地操作正在处理时避免并发开拍;后台变化最终由POST拒绝或确认。 + +### 9.3 倒计时实现边界 + +App按账号+task+execution维护本地“未建立/计时中/已销毁/已归零”记录。正常准备页持有本次新召唤回执,或当前会话已观察到travelling→ready,可认定本次首次可靠到达并创建30秒。直接重入仅看到ready、没有可靠记录时不创建。 + +同执行只创建一次。点击pause/start_recording/return_home前先销毁并记住,不因失败、resume、重复ready或WS重连恢复;离开ready进入其它业务阶段也清理显示。新execution才允许重新建立。无持久记录时不跨重启补造时间;后台保有原记录时实际经过时间继续扣减。 + +这只是现场提示,不保证与设备真实自动开拍剩余秒数精确一致。后端进入recording时立即以其更新UI。点击暂停销毁的是App计时,不是凭客户端计时去取消/创建设备自动开拍计划;后端仍须维护真实设备暂停/恢复语义。 + +### 9.4 完成与重新进入 + +正常完成弹窗按task+execution在当前页面会话去重:当前会话已展示非终态,之后首次确认completed时提示一次,前后台/重复快照不重复弹;重入时首份状态已经completed,则仅展示完成面板,不重复弹窗,也不自动启动RTC或计时。正常结束不等于素材就绪/整单确认。 + +returned仍是中断结果,说明“本次拍摄已中断,无人机已返回机巢”,重新召唤复用订单任务。再调用summon后必须换execution,清旧控制上下文/倒计时/图传。旧执行的指令结果可核对历史,但不能应用到新飞行。 + +## 10. 状态生产与错误分类 + +### 10.1 服务端生产要求 + +- 统一组装state/telemetry供HTTP、动作回执、WS使用;不在不同接口分别拼不同阶段。副本同版本必须内容一致。 +- 关键设备事件及时更新stage/paused;正常与中断收尾严格区分。后台跟踪不能因旧OFT进入25或素材上传而停止v2回巢/关盖核对。 +- state相关字段和当前动作进展变化升state.version;指标独立升telemetry.version;live来源变化升live_version及state.version。无变化GET、Ping/心跳、凭证纯续期不升业务版本。 +- 版本、执行身份、动作幂等和暂停方向必须在进程/缓存重启后恢复。先一致提交状态与版本,再可靠投递推送,不能只有进程内回调。 +- state完成不提前改写订单成功、素材成功、次数等其它模块既有语义。是否允许新任务提交仍由设备占用和订单权益检查;素材上传本身不拦下一次,但尚未回收的设备不能被抢占。 + +### 10.2 最少错误码集合 + +| error_code | 处理范围与行为 | +| --- | --- | +| LOGIN_EXPIRED | 统一登录处理 | +| TASK_READ_FORBIDDEN / TASK_NOT_FOUND | 停当前任务HTTP/WS;不是单次动作拒绝 | +| TASK_NOT_STARTED | 无执行的任务不进入任务页;回准备流程,不创建假阶段 | +| SOCKET_TICKET_EXPIRED | 只换票重连 | +| AUTH_TIMEOUT / SNAPSHOT_UNAVAILABLE / TEMPORARILY_UNAVAILABLE | 可恢复读取/订阅,HTTP兜底 | +| ACTION_NOT_ALLOWED / ACTION_IN_PROGRESS | 对应动作结束等待/提示或沿已有动作核对,保留业务stage | +| EXECUTION_CHANGED / ACTION_CONTEXT_CHANGED | 更新当前状态,等待明确操作;不自动改参数重发 | +| IDEMPOTENCY_CONFLICT | 原request_id被不同参数复用,明确拒绝 | +| DEVICE_COMMAND_FAILED | 明确执行失败,与任务阶段是否失败分开 | +| DEVICE_CONFIRMATION_UNKNOWN | 只读核对,不自动重发 | +| LIVE_NOT_AVAILABLE / UNSUPPORTED_LIVE_PROVIDER | 图传提示,不改变拍摄任务结果 | + +网络超时不映射成DEVICE_COMMAND_FAILED。权限/任务错误的范围必须准确:某条动作不允许,不应停止全部任务读取。异常日志应能按task/execution/request_id串联派发与设备确认,响应不泄漏数据库SQL或服务器堆栈。 + +## 11. 联合验收清单 + +| 场景 | 必须结果 | +| --- | --- | +| 召唤受理但设备尚在巢 | travelling,不误判returned;任务页能及时显示前往 | +| 到首点自动悬停 | ready+paused=false,不出现手动暂停 | +| 可信首次到达/重复到达 | 创建一次本地30秒,重复包/指标变化不重置 | +| 点击暂停/开拍/返航后失败 | 倒计时已销毁,不恢复,不重建30秒 | +| 暂停→继续仍ready | 只有开始拍摄按钮;新的context,旧开拍请求不能误执行 | +| 重入/重启无计时记录 | ready直接显示开始按钮,不补造30秒 | +| 后台有原计时记录 | 按实际经过时间继续;归零不发开拍 | +| 暂停未确认就返航 | 可提交返航,旧暂停迟到不反锁;一按钮等待不全局锁 | +| 返航暂停→继续 | stage保持returning,方向不丢 | +| 正常录制结束开始返航 | 仍returning,不弹完成,不停RTC | +| 已入巢但未关盖 | 仍returning,继续图传 | +| 正常收尾结束 | completed,提示一次并停本机RTC | +| 未拍完中断后收尾结束 | returned,中断结果保留,重新召唤入口可点而非假成功 | +| 起飞前返航/取消能力不足 | 真实取消或明确拒绝,不凭inside判回巢 | +| POST回执丢失/后端进程重启 | 同request_id可查,不自动换键重发,不盲目补派发 | +| 迟到pending与新succeeded | operation.version防回退,state版本防阶段回退 | +| 重召换执行 | 旧动作/倒计时/指标/图传均不能影响新执行 | +| WS首包登记竞争/空缓存 | 最新状态最终可达,完整首包或明确失败,不半成功空等 | +| 指标版本先到、状态后到 | 分模块比较,不因指标版本大丢掉有效状态 | +| 心跳无变化/漏推 | 无变化正常等待;版本领先触发一次合并GET修复 | +| 旧订阅/旧连接迟到 | 不能续当前健康期、不能回滚新数据 | +| 无读数/120秒过期/恢复 | 6项可空首包不阻塞,旧值保留,各项真实时间与版本正确 | +| 直播来源变更/漏通知 | live_version触发取参,缺路限频补取,保留健康流 | +| 纯token续期/参数身份不变 | 不升live_version,不反复入房 | +| 结束与live迟到同时发生 | 结束后不能恢复播放;不停止其他人的设备流 | +| 新旧包并行同任务/设备 | 旧HTTP和310/311原格式正常;新旧频道不串、共享设备占用和防重 | + +## 12. 朱工实施前登记与交付 + +1. 分配并登记V2_SUBSCRIBE_TYPE / V2_UNSUBSCRIBE_TYPE,确认共享/wss入口能独立路由。 +2. 确认正常/中断回收结束可获得“回巢、关盖、收尾完成”的可靠依据;不以计时模拟。确认起飞前return_home的真实取消能力,不支持则明确拒绝。 +3. 确认live_version变化的来源事件和缺流补取方式;纯凭证续期不改来源版本。 +4. service-fly与hyperf-socket按同一合同联调发布;旧协议兼容回归后再安排两端App适配。 +5. 提供各HTTP真实脱敏回包、两个WS编号、首包/两类推送/错误样例,以及当前未支持项;与本文有差异先反馈并同步合同,不悄悄改字段含义。 + +本稿不要求朱工提供设备无法可靠给出的倒计时时间,也不要求接口返回UI或按钮权限。后端负责真实业务事实与执行校验,App负责本地展示与请求恢复。 + +## 附:完整协议示例 + +同目录“拍摄任务页-v2协议示例”提供独立JSON。订阅/退订文件后缀template.json表示待替换整数编号,其余示例可作为结构校验夹具;所有凭证均无效。 + +| 文件 | 内容 | +| --- | --- | +| `01-http-state-ready.json` | 含首次info的GET回包 | +| `02-http-pause-request.json` | 暂停入参 | +| `03-http-pause-accepted.json` | 暂停已受理,设备尚待确认 | +| `04-ws-subscribe.template.json` | 新订阅模板,编号待分配 | +| `05-ws-subscribed.json` | 完整双模块首包 | +| `06-ws-state-returning.json` | 正常或中断返航回收中 | +| `07-ws-state-completed.json` | 正常任务回收完成 | +| `08-ws-state-returned.json` | 中断返航回收完成 | +| `09-ws-telemetry.json` | 完整六项指标 | +| `10-ws-heartbeat.json` | 协议心跳携带双版本 | +| `11-http-live-response.json` | 两路参数,一路待就绪 | +| `12-http-action-unknown.json` | 查到动作结果待确认 | +| `13-http-execution-changed.json` | 旧执行动作拒绝 | +| `14-http-summon-response.json` | 重召时旧/新execution对应关系 | +| `15-ws-unsubscribe.template.json` | 新退订模板,编号待分配 | +| `16-http-first-summon-rejected-query.json` | 首次召唤被拒绝且未建执行时,动作仍可查询 | + +旧《接口重构方案-讨论稿》及其旧示例已过期,实施以本文为准。此前《接口入参与返回JSON详解》仅描述旧客户端,不是v2协议。 + diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06.zip b/artifacts/拍摄任务页-v2接口协议-2026-11-06.zip new file mode 100644 index 0000000..8d15639 Binary files /dev/null and b/artifacts/拍摄任务页-v2接口协议-2026-11-06.zip differ diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/交付说明.md b/artifacts/拍摄任务页-v2接口协议-2026-11-06/交付说明.md new file mode 100644 index 0000000..c2c3190 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/交付说明.md @@ -0,0 +1,9 @@ +# 拍摄任务页 v2 接口交付说明 + +请先阅读《拍摄任务页-v2接口协议-后端实施稿.md》,再看配套16份JSON。 + +业务规则已按2026-11-06讨论整理;本包不含App代码、旧讨论稿或有效凭证。 + +请朱工登记两个未占用的新版WS订阅/退订整数编号,保持旧310/311与旧接口合同不变;订阅模板中的字符串占位必须替换为整数后才能使用。 + +还请确认回巢关盖完成证据、起飞前取消能力和图传来源变更通知。无法支持项先反馈并同步合同,不用模拟值代替真实状态。 diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/01-http-state-ready.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/01-http-state-ready.json new file mode 100644 index 0000000..584dfa5 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/01-http-state-ready.json @@ -0,0 +1,60 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + }, + "info": { + "order_number": "261106000001", + "spot_name": "示例拍摄点", + "route_name": "示例航线", + "tourist_label": "游客 158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "cover_url": null + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/02-http-pause-request.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/02-http-pause-request.json new file mode 100644 index 0000000..c0cdf46 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/02-http-pause-request.json @@ -0,0 +1,5 @@ +{ + "request_id": "11111111-1111-4111-8111-111111111111", + "action": "pause", + "expected_execution_id": "execution-001" +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/03-http-pause-accepted.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/03-http-pause-accepted.json new file mode 100644 index 0000000..44fc007 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/03-http-pause-accepted.json @@ -0,0 +1,34 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + }, + "state": { + "version": 19, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + } + ] + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/04-ws-subscribe.template.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/04-ws-subscribe.template.json new file mode 100644 index 0000000..130fd21 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/04-ws-subscribe.template.json @@ -0,0 +1,8 @@ +{ + "type": "${V2_SUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "request_id": "subscribe-request-example" + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/05-ws-subscribed.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/05-ws-subscribed.json new file mode 100644 index 0000000..48bea89 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/05-ws-subscribed.json @@ -0,0 +1,54 @@ +{ + "code": 100000, + "event": "airport_v2.subscribed", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + }, + "request_id": "subscribe-request-example" +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/06-ws-state-returning.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/06-ws-state-returning.json new file mode 100644 index 0000000..489169e --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/06-ws-state-returning.json @@ -0,0 +1,18 @@ +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 30, + "stage": "returning", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/07-ws-state-completed.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/07-ws-state-completed.json new file mode 100644 index 0000000..206cfb2 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/07-ws-state-completed.json @@ -0,0 +1,18 @@ +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 31, + "stage": "completed", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/08-ws-state-returned.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/08-ws-state-returned.json new file mode 100644 index 0000000..a2dc968 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/08-ws-state-returned.json @@ -0,0 +1,18 @@ +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 32, + "stage": "returned", + "paused": false, + "context": null, + "live_version": 2, + "reason": "MANUAL_RETURN", + "operations": [] + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/09-ws-telemetry.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/09-ws-telemetry.json new file mode 100644 index 0000000..176c6bd --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/09-ws-telemetry.json @@ -0,0 +1,44 @@ +{ + "code": 100000, + "event": "airport_v2.telemetry", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/10-ws-heartbeat.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/10-ws-heartbeat.json new file mode 100644 index 0000000..1b40c7b --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/10-ws-heartbeat.json @@ -0,0 +1,11 @@ +{ + "code": 100000, + "event": "airport_v2.heartbeat", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state_version": 30, + "telemetry_version": 8 + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/11-http-live-response.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/11-http-live-response.json new file mode 100644 index 0000000..ee33b16 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/11-http-live-response.json @@ -0,0 +1,24 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "live_version": 2, + "refresh_after": 30, + "sources": { + "airport": { + "available": true, + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_AIRPORT_ROOM", + "user_id": "EXAMPLE_VIEWER_AIRPORT", + "token": "EXAMPLE_RTC_TOKEN", + "expires_in": 2400 + }, + "drone": { + "available": false, + "reason": "DRONE_NOT_READY" + } + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/12-http-action-unknown.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/12-http-action-unknown.json new file mode 100644 index 0000000..c8cadfb --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/12-http-action-unknown.json @@ -0,0 +1,40 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + }, + "state": { + "version": 21, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + } + ] + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/13-http-execution-changed.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/13-http-execution-changed.json new file mode 100644 index 0000000..5c0c371 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/13-http-execution-changed.json @@ -0,0 +1,6 @@ +{ + "code": 100099, + "msg": "当前执行已变化,请刷新后重试", + "error_code": "EXECUTION_CHANGED", + "data": null +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/14-http-summon-response.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/14-http-summon-response.json new file mode 100644 index 0000000..ef42c65 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/14-http-summon-response.json @@ -0,0 +1,36 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-002", + "operation": { + "request_id": "55555555-5555-4555-8555-555555555555", + "execution_id": "execution-001", + "action": "summon", + "status": "pending", + "version": 1, + "error": null, + "new_execution_id": "execution-002" + }, + "state": { + "version": 33, + "stage": "travelling", + "paused": false, + "context": null, + "live_version": 3, + "reason": null, + "operations": [ + { + "request_id": "55555555-5555-4555-8555-555555555555", + "execution_id": "execution-001", + "action": "summon", + "status": "pending", + "version": 1, + "error": null, + "new_execution_id": "execution-002" + } + ] + } + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/15-ws-unsubscribe.template.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/15-ws-unsubscribe.template.json new file mode 100644 index 0000000..5ab995d --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/15-ws-unsubscribe.template.json @@ -0,0 +1,7 @@ +{ + "type": "${V2_UNSUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "subscription_id": "subscription-example-001" + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/16-http-first-summon-rejected-query.json b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/16-http-first-summon-rejected-query.json new file mode 100644 index 0000000..28aea0b --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/16-http-first-summon-rejected-query.json @@ -0,0 +1,20 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": null, + "operation": { + "request_id": "88888888-8888-4888-8888-888888888888", + "execution_id": null, + "action": "summon", + "status": "rejected", + "version": 1, + "error": { + "code": "ACTION_NOT_ALLOWED", + "msg": "当前没有可用设备,请稍后重试" + } + }, + "state": null + } +} diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/README.md b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/README.md new file mode 100644 index 0000000..5fad7da --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2协议示例/README.md @@ -0,0 +1,7 @@ +# v2 协议样例 + +与《拍摄任务页-v2接口协议-后端实施稿.md》配套。所有数据为虚构、凭证无效,不能用于真实飞控或直播连接。 + +`*.template.json` 中的 type 是未分配编号的字符串占位。实际协议要求 JSON 整数;需朱工登记新编号后替换,不能使用旧310/311。 + +同一任务各示例演示不同业务分支,不能理解为按文件序号依次执行真实动作。HTTP 202/错误状态等传输语义见主文档。 diff --git a/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2接口协议-后端实施稿.md b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2接口协议-后端实施稿.md new file mode 100644 index 0000000..7a95af3 --- /dev/null +++ b/artifacts/拍摄任务页-v2接口协议-2026-11-06/拍摄任务页-v2接口协议-后端实施稿.md @@ -0,0 +1,992 @@ +# 拍摄任务页 v2 接口协议(后端实施稿) + +日期:2026-11-06 · 文档版本:1.0 · 对接:朱工(service-fly / hyperf-socket) + +**用途:按已确认的产品规则新增 v2 接口与 WS 协议,供后端实现。本文不是已上线接口说明。App 暂不改代码,待后端合同与实现确认后再同步改造 iOS / Android。** + +文中 JSON 均为虚构示例,无有效登录或 RTC 凭证;未调用真实设备。新 WS 订阅号、退订号由朱工登记未占用整数后补齐,其余命名与字段按本文实施;无法支持的设备能力需明确反馈,不能用延时或默认值模拟成功。 + +## 1. 已确认的业务范围 + +### 1.1 正常流程与中断流程 + +正常流程: + +**准备页召唤受理 → 前往拍摄点 → 已到达待开拍 → 拍摄中 → 返航回收中 → 拍摄任务已完成。** + +“返航回收中”包含返航、降落、入巢和关盖。只有后端确认正常拍完,且无人机已回巢、机巢盖关闭、回收结束,才输出任务完成。**录制结束、开始返航、仅进入机巢或素材开始上传都不能提前输出完成。** + +未正常拍完的中断流程: + +**当前阶段 → 返航回收中 → 已完成返航。** + +后者仍是本次拍摄中断,不能当作正常拍摄成功;主按钮提供“重新召唤”,是否执行由后端提交时校验。正常流程不会先显示“已完成返航”再显示“拍摄任务已完成”。 + +### 1.2 页面和图传 + +- 主状态文案、图标、按钮标题 / 颜色 / 显示规则在 App 本地维护;后端返回稳定业务状态,不返回 UI 配置。 +- 不返回 `allowed_actions`、`permissions`、`can_*` 或旧门禁集合。按钮多数场景允许尝试,后端执行前校验并明确返回结果。 +- 暂停、继续任务、立即返航不弹二次确认。只在对应按钮 loading,不显示中央“指令已受理”。 +- 自动到点悬停不是手动暂停。返航中手动暂停后继续,仍恢复返航。 +- 页面可见时自动接收图传;正常 / 中断流程都持续到回收结束,分别收到 completed / returned 后停止本机 RTC。离页或后台立即停止本机接收,不取消真实设备任务。 +- 正常任务 completed 后显示“稍后再去 / 去查看”弹窗;前者留在完成页,后者进入当前订单素材库。returned 显示重新召唤,不弹正常完成提示。 +- 任务页不展示素材处理进度或素材失败,也不订阅素材处理状态;后续由订单素材库负责。 + +### 1.3 本地倒计时 + +- 后端不提供倒计时、截止时间或剩余秒数。App 在本次执行首次可靠观察到已到达待开拍时,创建 30 秒倒计时,**只显示**,不负责真实自动开拍。 +- 同一执行的重复 HTTP / WS ready 不重置计时。倒计时归零保持 0,不发送开拍,不请求刷新,也不自行切换拍摄中。 +- 点击暂停、开始拍摄、立即返航时,**先销毁本地倒计时**再提交;即使提交失败也不重建。继续任务后仍待开拍,只显示“开始拍摄”。 +- 重新进入页面 / 重启 App 后没有可靠本地计时记录时,不补造 30 秒;仍 ready 就只显示“开始拍摄”。原记录仍在的普通前后台切换,按实际经过时间继续。 +- 新 execution 可在首次可靠到达时重新建立计时;不跨任务、执行或账号复用。 + +## 2. 新旧隔离与接口清单 + +### 2.1 隔离要求 + +新增前缀统一为 **`/api/app/airport/v2`**。旧 `/airport/shooting`、`shoot`、`start-shoot`、`command`、`live` 原路径、参数、响应和协议语义保留;不迁移旧客户端到 `/v1`,也不根据 App 版本隐式改变旧接口返回值。 + +| 项目 | 旧版 | 新版 | +| --- | --- | --- | +| HTTP | 当前旧路径 | `/api/app/airport/v2/...` | +| WS 地址 | `/wss` | 复用 `/wss` | +| 订阅 / 退订 | 310 / 311,保持旧行为 | **V2_SUBSCRIBE_TYPE / V2_UNSUBSCRIBE_TYPE,待朱工分配** | +| 业务事件 | 原 `app_airport_shooting_updated` | `airport_v2.state`、`airport_v2.telemetry` | +| 快照与缓存 | 原序列化和 key | v2 独立序列化、缓存 key、版本计数和推送频道 | + +**共享的底层事实和执行约束**:真实任务、执行记录、设备占用锁、动作派发 / 防重、次数及素材记录。不能给 v2 复制一套独立设备控制中心。同一任务由旧接口操作后,新投影应看到真实变化;反之亦然,仍各自输出自己的协议。 + +v2 正常完成时间不能通过改写旧 `ui.phase` / 完成回包来实现;应建立独立业务阶段映射。涉及共享底层实现的改动必须回归旧版,不能仅以“新 URL”承诺无影响。最终同时验证旧包、新包读取同一任务,以及跨版本操作同一设备。 + +### 2.2 HTTP 清单 + +| 方法与路径 | 用途 | 设备副作用 | +| --- | --- | --- | +| `GET /api/app/airport/v2/tasks/{task_id}/state` | 首屏、恢复、手动刷新、HTTP 兜底 | 不创建任务、不飞控、不启图传、不主动实时采集 | +| `POST /api/app/airport/v2/tasks/{task_id}/actions` | 召唤、开拍、暂停、继续、返航 | 可能派发真实动作 | +| `GET /api/app/airport/v2/tasks/{task_id}/action-requests/{request_id}` | 无回执或结果未知时查询 | 只读,不重新派发 | +| `POST /api/app/airport/v2/tasks/{task_id}/live` | 获取 / 补齐 / 续期两路连接参数 | 可能按需启动缺失图传,不能重复启动健康来源 | +| `GET /api/app/socket-token` | 复用公共 Socket 票据 | 沿用原接口,不修改旧合同 | + +准备页张工 `tasks/create` 不变,先获得订单飞行任务 ID,再调用 v2 `actions:summon`。失败重召仍复用同一订单任务,创建新的 execution。订单 / 次数 / 素材 / 交付接口不在本次重构范围,v2 不新增 `order_status=25`,也不提前改动既有计次或订单成功语义。 + +## 3. 公共约定与最小数据模型 + +### 3.1 鉴权与外壳 + +HTTP 沿用 `token: `;POST 使用 `Content-Type: application/json`。门店、账号、景区、订单和任务归属由后端检查,前端不额外提交这些重复定位参数。 + +成功:`code=100000`,`msg`,`data`。HTTP 读取成功 200;动作持久受理且待确认 202;已取得明确结果或幂等重放结果可为 200。**HTTP 成功不等于设备动作 succeeded。** 不增加必须重复携带的 Header 版本字段或 UI 文案字段。 + +业务失败保留非成功整数 code(示例采用 100099),新增稳定 `error_code` 用于分类,`msg` 用于提示。整数编码由后端沿用统一规范;客户端不通过中文提示猜“是否无权限”。 + +HTTP 400 参数错误、401 登录失效、403 任务读取无权限、404 任务不存在、409 动作条件 / 批次冲突、503 临时服务故障,均须返回可解析的上述业务 JSON。动作不可执行只影响该动作,不等于整页禁止读取。 + +### 3.2 身份和版本 + +| 字段 | 定义 | +| --- | --- | +| `task_id` | 始终是订单飞行任务 ID,即原 `order_flight_task.id`;不是航线任务 ID | +| `execution_id` | 每次召唤受理后分配的执行标识,非空不透明字符串;换批次必须换值 | +| `state.version` | 状态模块在整个 task 生命周期递增,换 execution 不归零 | +| `telemetry.version` | 指标模块在整个 task 生命周期独立递增,换 execution 不归零 | +| `operation.version` | 同一个 request_id 的动作结果版本,独立递增 | +| `state.live_version` | 图传来源连接信息变化标识,在 task 内递增;不是凭证续期版本 | + +同一模块版本的内容必须一致;新版本整份替换、同版本忽略、旧版本丢弃。**不能拿 telemetry 的版本大小判断 state 新旧,也不能混比动作 version。** 计数不能因 Redis 清空 / 服务重启归零。 + +新 execution 先发布新 state,再发布其指标。切换时清旧指标、倒计时和图传;不通过 execution 字符串排序判断新旧。未知 execution 的单独指标先丢弃并合并发一次 GET 全量核对,不能让指标包推动业务换批次。 + +### 3.3 state 对象 + +| 字段 | 类型 | 必需 | 说明 | +| --- | --- | --- | --- | +| `version` | int64,正数 | 是 | 状态版本 | +| `stage` | string | 是 | 下节列出的业务阶段 | +| `paused` | bool | 是 | **已确认的手动暂停**;自动到点等待是 false | +| `context` | string 或 null | 是 | 开拍 / 继续用的当前语义控制周期,不是权限集合 | +| `live_version` | int64,非负 | 是 | 两路来源出现、失效、替换或需重新连接时变化 | +| `reason` | string 或 null | 是 | 异常 / 中断原因码,如 MANUAL_RETURN;正常为空 | +| `operations` | array | 是 | 当前执行的未结束动作及近期结果;无记录为 [] | + +不返回重复的 task/OFT/wayline 状态、原始设备证据、素材阶段、权限、倒计时、主副标题、按钮配置。后端内部仍须保存完整设备事实和拍摄结果,按统一函数归一化 stage;字段精简不表示丢掉内部判定依据。 + +### 3.4 stage 与 App 本地状态 + +| stage | App 本地中央状态 | 精确语义 | +| --- | --- | --- | +| `travelling` | 前往拍摄点 | 召唤已受理,含开盖 / 自检 / 起飞准备及前往首点,不宣称已起飞 | +| `ready` | 已到达待开拍 | 本 execution 已到首点,尚未实际开拍 | +| `recording` | 拍摄中 | 已确认实际录制 | +| `returning` | 返航回收中 | 正常 / 中断返航,直到降落、入巢、关盖收尾结束 | +| `returned` | 已完成返航 | **未正常拍完的中断流程**已确认回收结束,仍保留中断结果 | +| `completed` | 拍摄任务已完成 | **正常流程**拍完并回巢、关盖,后端确认本次任务完成 | +| `failed` | 拍摄失败 | 后端明确任务执行失败,且没有待完成飞行/回收;不能用一次按钮拒绝充当任务失败 | +| `cancelled` | 任务已取消 | 明确取消且没有仍待结束的飞行 / 回收过程 | +| `unknown` | 状态待确认 | 当前业务阶段确实无法判断;临时 HTTP / WS 失败不要求把旧已知阶段改 unknown | + +`paused=true` 时,App 在保留 stage 的同时显示第十种本地状态“已暂停”;stage=returning 时可显示“返航已暂停”。仅适用于 travelling/ready/recording/returning。终态 returned/completed/failed/cancelled 不得 paused=true。 + +后端维护暂停前任务方向,继续后恢复对应 stage。手动暂停 ready 后继续仍 ready;暂停返航后继续仍 returning。App 不接收 / 推导 resume_phase。 + +**returned 与 completed 是业务终态,不是原始 inside 信号。** 两者都要求后端确认回收结束;仅在巢、设备空闲、任务失败、计次变化、超时等待都不够。未离巢取消也不能产出 returned。返回 completed 后,后续素材失败不改成 failed。 + +无 execution、仅张工任务已创建但尚未召唤时,GET 返回 `TASK_NOT_STARTED`(409);不新增“待召唤”中央主状态,也不假造 execution。首次召唤从准备页提交,受理后传最新 state 进入任务页。 + +## 4. GET 当前状态与六项指标 + +```text +GET /api/app/airport/v2/tasks/501/state?include_info=1 +``` + +| 参数 | 位置 | 必填 | 默认 | 说明 | +| --- | --- | --- | --- | --- | +| task_id | Path | 是 | — | 已有订单飞行任务 | +| include_info | Query,0/1 | 否 | 0 | 首次需要顶部摘要时为1;无其它业务 Query | + +无 JSON 请求体。不传 live_battery/live_metrics;v2 固定读取服务端维护的数据,不因刷新主动采集设备。 + +返回 JSON: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + }, + "info": { + "order_number": "261106000001", + "spot_name": "示例拍摄点", + "route_name": "示例航线", + "tourist_label": "游客 158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "cover_url": null + } + } +} +``` + +`include_info=0` 时直接省略 info,其他结构不变。info 只放页面需要的顶部摘要和素材页导航所需订单号;封面没有时为 null,不返回演示图片。WS 不重复推 info。 + +### 4.1 telemetry 对象 + +固定六项:`battery/env_temp/wind_speed/rainfall/signal/satellite`。 + +每项只返回 `value`、`observed_at`、`stale`:value 是可直接显示的字符串或 null,observed_at 是真实采集时间(RFC3339 带时区,可 null),stale 是本项过期标记。无原始 raw、单位重复字段、供应商证据和整份物模型。 + +- 首次无读数也要返回六项:value=null、observed_at=null、stale=true;不能补0或阻塞 state 首包。 +- 每项独立判断真实采集时间。约15秒补采、约120秒过期;只保留最近有效值,不因读取接口刷新采集时间。 +- 有有效新采样 / 本项过期 / 恢复时,递增 telemetry.version 并推送;不因此改 state.version、context、倒计时或按钮等待。 +- 新 execution 清空上一执行的指标,不跨设备复用。后端主动维护活跃飞行直到回收结束,不依赖 App 调 GET / live 或是否有订阅。 +- completed/returned 后可停止采新读数;仍有读取 / 订阅时应如实维护过期状态。时间流逝本身不应伪装成新采样。 + +## 5. POST 统一动作 + +```text +POST /api/app/airport/v2/tasks/501/actions +``` + +### 5.1 入参 + +| 字段 | 类型 | 必填 | 说明 | +| --- | --- | --- | --- | +| request_id | UUID string | 是 | 本次明确点击的唯一标识,客户端发送前生成 | +| action | string | 是 | summon/start_recording/pause/resume/return_home | +| expected_execution_id | string 或 null | 是 | 必须对应用户操作的当前执行;仅首次召唤可null | +| context | string 或 null | 开拍/继续时带 | 原样使用最新 state.context;暂停/返航/召唤省略 | + +暂停示例: + +```json +{ + "request_id": "11111111-1111-4111-8111-111111111111", + "action": "pause", + "expected_execution_id": "execution-001" +} +``` + +开拍示例: + +```json +{ + "request_id": "22222222-2222-4222-8222-222222222222", + "action": "start_recording", + "expected_execution_id": "execution-001", + "context": "context-ready-001" +} +``` + +继续示例: + +```json +{ + "request_id": "33333333-3333-4333-8333-333333333333", + "action": "resume", + "expected_execution_id": "execution-001", + "context": "context-paused-001" +} +``` + +首次召唤示例: + +```json +{ + "request_id": "77777777-7777-4777-8777-777777777777", + "action": "summon", + "expected_execution_id": null +} +``` + +重召唤仍为 summon,expected_execution_id 填原执行;返航为 return_home,其他结构与暂停相同。App 不提交 plane_id/air_line_id 覆盖任务锁定信息,不通过 tasks/create 重建失败任务。 + +### 5.2 已受理返回 JSON + +HTTP 202: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + }, + "state": { + "version": 19, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + } + ] + } + } +} +``` + +回执中的 state 是**当前完整状态模块**,不附带无关的六项指标和固定摘要。operation 用于明确关联本次请求;state.operations 中出现同一请求时,内容与动作版本必须一致。该 state 可以直接采纳,无须每次 POST 成功固定追加 GET。 + +动作持久受理后应尽快返回pending/HTTP202,不让HTTP一直等待设备动作、返航或关盖。同步已取得确证时可直接返回明确结果;后续设备确认通过state/查询更新。设备确认等待必须有界,超过合理确认期限应转unknown而非假失败;具体期限由朱工结合上游能力登记,App结束持续动画后仍保留原请求的防重和只读核对。 + +本例设备尚未确认手动暂停,所以 stage 仍 ready、paused=false,只有该暂停按钮等待。真实确认后,新 state paused=true、动作 status=succeeded/version=2,再更新中央。 + +### 5.3 operation 最小结构 + +| 字段 | 必需 | 定义 | +| --- | --- | --- | +| request_id | 是 | 唯一动作记录 ID,等于客户端原请求 ID,不另设 command_id/action_id | +| execution_id | 是,可null | 原请求 expected_execution_id;首次 summon 可null | +| new_execution_id | 仅 summon 成功建批次时 | 新执行标识,持久分配后不变 | +| action | 是 | 原动作名 | +| status | 是 | 下表动作进度 | +| version | 是 | 此 request_id 的结果版本,初始1,变化递增 | +| error | 是,可null | 明确拒绝/失败/未知原因 `{code,msg}`,不是中央状态文案 | + +| status | 精确含义 | +| --- | --- | +| pending | 已持久受理,等待派发或设备确认 | +| succeeded | 达到该动作目标,含义见下表 | +| rejected | 明确校验拒绝,保证没有派发该动作 | +| failed | 明确执行失败,不能把超时直接标失败 | +| superseded | 旧意图被新动作替代,不表示旧物理动作从未执行 | +| unknown | 是否生效尚不能确认;可在取得证据后更新为明确结果 | + +动作状态比较只按相同 request_id 的 version。迟到的 pending(version=1) 不能覆盖已收到的 succeeded(version=2)。unknown 不能当失败后自动重发。 + +succeeded/rejected/failed/superseded 是该动作的明确终态,不能因迟到设备回执生成更高version的pending/unknown,也不能复活被取代的旧意图。迟到的真实设备事实仍应核对并更新当前state;这与旧动作恢复有效是两回事。只有pending/unknown可以继续等待确证并收敛到明确结果。 + +| action | succeeded 的含义 | +| --- | --- | +| summon | 新 execution 已建立、航线被设备侧受理调度;不代表已起飞/到达 | +| start_recording | 已确认进入实际录制 | +| pause | 已确认本次手动暂停;首点自动悬停不算 | +| resume | 已确认解除本次手动暂停,恢复原环节;ready 软恢复不能直接开拍 | +| return_home | 已确认进入返航;起飞前支持取消时,也可表示已确认取消起飞。**均不代表正常拍摄完成** | + +return_home 若在起飞前执行:后端按实际能力撤销起飞,确认后 stage=cancelled;不支持则 rejected 并提示,保留原 stage;不能把仍 inside 当已完成返航。具体上游取消能力由朱工确认,不能用假成功替代。 + +### 5.4 召唤回执的身份 + +重召的 operation.execution_id 是旧执行,new_execution_id 是新执行;外层 data.execution_id/state 已属于新执行。客户端按本次 request_id 识别合法换批,不能把重召回执当成旧包。首次召唤相同规则,只是原执行为null。 + +完整例子见附件 14。新 execution 一旦受理,state.stage=travelling(含起飞准备),上页可直接用回执 state 展示“前往拍摄点”,不等待物理起飞才跳转。 + +### 5.5 后端校验、并发与幂等 + +1. 后端必须校验最新设备/任务条件。去掉权限字段只精简回包,不移除服务端校验,也不让 App 根据按钮文案猜操作。 +2. 幂等范围:认证所得门店范围 + task_id + request_id。**先查已有幂等记录,再核 execution/context**;同键同参数回同一动作及当前结果,不再派发;同键异参返回 IDEMPOTENCY_CONFLICT。 +3. 任务可操作期间不删除幂等和动作记录,归档后禁止新控制,建议再保留至少7天查询。重放可返回最新状态,保证同一动作身份和不重复派发,不要求正文逐字不变。 +4. 旧执行请求返回 EXECUTION_CHANGED,不能把上一轮迟到指令作用到新飞行。**不得要求全量 state/telemetry 版本严格相等才接收动作**,指标变化不应误挡暂停/返航。 +5. context 只用于开拍/继续的语义周期;指标、live_version、普通 GET、无关按钮 loading 不轮换。ready→手动暂停→继续 ready 后必须有新的开拍 context;每次新的手动暂停生成新的继续 context。 +6. 暂停/返航受理时应作废与当前意图冲突的旧开拍/恢复上下文;真正出队下发前再次核 context 与是否已被取代。自动/手动开拍也须争用同一有效开拍上下文,避免双发;App 不实现自动开拍调度。 +7. context 缺失/过期或当前不适用时返回 ACTION_CONTEXT_CHANGED/ACTION_NOT_ALLOWED 和当前 state。App 不自动替换 context 重发,也不据 context=null 修改中央阶段。 +8. 对同一真实设备共享串行派发和占用锁,覆盖新旧接口与多个账号。App 可串行 HTTP 提交,但不能等待前一设备结果才允许另一安全动作。 +9. 暂停尚 pending 时允许提交返航,由后端按当前条件处理。返航清理旧暂停意图;迟到旧暂停回执不把页面锁回暂停。返航后新的暂停则保留返航方向,继续仍恢复返航,不简单删除原返航目标。 +10. 动作先持久落记录再对接设备。设备已受理而服务端结果丢失时保留 unknown 并探测;上游无幂等能力时不能宣称物理严格执行一次,也不能盲目补发。 +11. 可信的本次拍摄正常/中断结果由后端保存到收尾结束,分别输出 completed/returned;不能仅凭最后一个 DJI success 决定。 + +同一execution的同一种动作尚pending/unknown时,即使另一个客户端换了request_id,也不得再次派发同动作:返回ACTION_IN_PROGRESS并保留新请求的rejected记录,同时返回当前state供核对。该同动作防重不能变成全局等待锁;例如pause仍待确认时,return_home仍独立评估并可按规则取代旧意图。 + +state.operations 必须保留当前执行所有 pending/unknown 动作,并至少保留最近5条明确结果。召唤动作按 new_execution_id 归入新执行;旧动作历史仍可查询。记录从数组消失不能当成功。 + +### 5.6 拒绝与业务失败 + +单次动作不可执行时不改变中央 stage。设备忙、低电量、状态不符等返回稳定 error_code 和提示;可定位的合法请求保留 rejected 记录。响应 data 尽可能含 operation 和当前 state,若鉴权/参数/任务身份尚不能成立则 data=null。 + +例如客户端发了旧 execution: + +```json +{ + "code": 100099, + "msg": "当前执行已变化,请刷新后重试", + "error_code": "EXECUTION_CHANGED", + "data": null +} +``` + +操作响应的 msg 可以展示,主状态标题仍由 App 本地枚举维护。400/401/403/404/409 等错误不能被网关吞成非 JSON。failed 与 rejected 的来源要记录后端日志,不把数据库错误或设备超时变成假成功。 + +## 6. GET 按 request_id 查询动作 + +```text +GET /api/app/airport/v2/tasks/501/action-requests/11111111-1111-4111-8111-111111111111 +``` + +无请求体;即使丢失整个 POST 回执,也能用发送前已生成的原 request_id 查到。找到时返回 operation 及**同一提交视图下的当前 state**;外层 execution_id 是任务当前执行,operation.execution_id 可以是历史执行。 + +例外:首次summon已经被明确拒绝、尚未建立任何执行时,动作记录仍应可查;data.execution_id=null、state=null,operation.status=rejected。此处允许没有state,不改变GET state对此场景返回TASK_NOT_STARTED的约定,也不能为了查询回包造一个execution。 + +结果尚未知的示例: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + }, + "state": { + "version": 21, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + } + ] + } + } +} +``` + +尚未查到: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "operation": null + } +} +``` + +operation=null 只表示此刻未查到,**不能证明原 POST 永远不会到达**。App 不因此换 request_id 自动补发。短期可约2秒查一次,之后合并到5秒读取兜底/手动核对,不为每个未知动作开启永久并行定时器。 + +操作结果只更新对应等待状态,中央按有效 state 更新。旧执行动作仍可核对,但不能用它覆盖当前执行。所有 pending/unknown/明确结果变化都需递增该 operation.version;当前执行相关变化还需递增 state.version 并推送。 + +## 7. WebSocket v2 + +### 7.1 连接、票据与编号 + +正式 `wss://api.zhifly.cn/wss`,测试 `wss://api-test.zhifly.cn/wss`,与 HTTP 环境一致。票据继续取旧公共 GET `/api/app/socket-token`,无业务入参,沿用 App 登录身份;票据不是登录 token,也不是 RTC token。原响应可含 account_type,任务页只需 socket_token/expire_seconds。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "expire_seconds": 3600, + "account_type": "store_user" + } +} +``` + +必须由朱工登记两个**未占用整数**: + +| 常量 | 含义 | +| --- | --- | +| V2_SUBSCRIBE_TYPE | 新版任务订阅 | +| V2_UNSUBSCRIBE_TYPE | 新版任务退订 | + +**以下订阅 JSON 是模板**:`${V2_SUBSCRIBE_TYPE}` / `${V2_UNSUBSCRIBE_TYPE}` 暂用字符串占位,实际发送时必须替换为分配的 JSON 整数,不允许按字符串发送,也不使用0/310/311等未确认编号代替。分配后后端更新这两处登记值,双方一起固化;不用在每个包再重复 protocol_version。 + +传输连接建立后直接发送一次业务 JSON **文本帧**,新版不依赖 Opened/ready/received 才开始订阅。共享服务仍可为旧连接保留旧欢迎行为,新版忽略无关欢迎帧,不让它延长超时。 + +### 7.2 订阅请求模板 + +```json +{ + "type": "${V2_SUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "request_id": "subscribe-request-example" + } +} +``` + +请求只包含 task_id、票据和订阅关联 request_id,不另订阅指标频道或图传频道。 + +### 7.3 正式成功:一次带齐两个完整模块 + +成功必须已经完成鉴权和频道登记,并能提供完整 state 与 telemetry;没有指标时返回六项未知值,不阻塞 state 首包。data 与 GET state 的动态部分一致,不含 info。 + +```json +{ + "code": 100000, + "event": "airport_v2.subscribed", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + }, + "request_id": "subscribe-request-example" +} +``` + +该帧通过当前连接、订阅请求、任务、执行及模块结构校验后,WS 才就绪,停止常规 HTTP 轮询。按各模块版本采纳;即使 HTTP 已返回更高版本,也不能用此帧回滚,服务端随后补发首包之后的新变化。 + +失败必须明确返回,不返回“成功但无首包”,也不再输出 subscribe_meta/has_snapshot/HTTP seed 业务分支。 + +### 7.4 两类业务推送 + +**类型一:任务状态,event=airport_v2.state。** 中央业务阶段、手动暂停、动作进展、context 和 live_version 在同一条状态里原子更新。以下是正常返航回收中: + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 30, + "stage": "returning", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} +``` + +正常回巢关盖、后端确认任务完成后: + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 31, + "stage": "completed", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} +``` + +若未正常拍完,中断返航收尾结束则输出 returned(不是 completed): + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 32, + "stage": "returned", + "paused": false, + "context": null, + "live_version": 2, + "reason": "MANUAL_RETURN", + "operations": [] + } + } +} +``` + +**类型二:六项指标,event=airport_v2.telemetry。** 每次返回完整六项,不能用指标更新清理按钮等待、改中央状态或重建倒计时。 + +```json +{ + "code": 100000, + "event": "airport_v2.telemetry", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + } +} +``` + +两类均为**完整子对象替换**,不推 patch。状态与指标允许采集时间不同,任何一类不能等待另一类采集成功才发送。任务状态和操作结果不拆成独立第三类;图传来源变化仅改变 state.live_version。 + +### 7.5 协议心跳与错误 + +只有上面两类是业务数据消息;subscribed/heartbeat/error/unsubscribed 是连接协议帧,不是新增业务订阅。 + +后端默认每20秒必须发送一帧应用心跳,携带两类权威最新版本;即使某类业务推送频繁也不省略心跳: + +```json +{ + "code": 100000, + "event": "airport_v2.heartbeat", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state_version": 30, + "telemetry_version": 8 + } +} +``` + +- 两版本与本地一致:没有变化,正常等待,不因“拍摄120秒没变化”额外轮询。 +- 任一版本领先:合并安排一次 GET state 修复;未追上时保持5秒 HTTP 兜底,追上且订阅健康后停常规轮询。 +- 版本落后:不能回滚,记录异常;持续不一致时重建订阅。 +- 正式首包算首次双版本同步;随后60秒没有当前订阅的有效双版本心跳,则HTTP兜底并重连。单独state/telemetry业务帧只证明传输活跃,不能重置这条核对期限,避免“指标一直来、状态一直漏”却永久假健康。网络Ping/Pong也不能替代双版本核对。 +- 旧 subscription_id、旧连接回调、解析错误或不同任务的帧不算有效,不能延长健康期。心跳也不代表设备指标新鲜。 + +正式订阅失败示例: + +```json +{ + "code": 100099, + "event": "airport_v2.error", + "request_id": "subscribe-request-example", + "error_code": "AUTH_TIMEOUT", + "msg": "订阅鉴权暂不可用", + "data": { + "task_id": 501 + } +} +``` + +订阅成功后的错误带 subscription_id;成功前必须回显订阅 request_id,防止旧连接失败回执影响新会话。按 error_code 分类,不匹配中文 hint。 + +### 7.6 首包竞态与恢复 + +1. 后端鉴权、登记、读首包全链路建议总计不超过3秒,Redis/DB/队列各有有界超时。App 首包等待上限建议10秒;收到明确失败立即结束等待。 +2. 先登记频道,再获取当前一致快照。首包发送前缓存连接内后续更新,先发正式首包,再按各模块版本补发更新;同连接发送串行,防止漏掉登记/读取之间的变化。 +3. 空缓存由统一状态服务生成。不能生成则 SNAPSHOT_UNAVAILABLE 并撤销本次订阅,不能长期空等或给半成功ACK。 +4. 新 execution 的 state 先到,随后是其新指标;完整首包的两模块属于同一个执行。旧指标或凭证不能用于新执行。 +5. 发布失败需可靠补投(可采用持久消息/outbox);允许重复,不能悄悄丢。心跳取权威最新版本,不取该连接上次发出的版本。 +6. WS未就绪/失败/断线时,前台默认5秒串行GET(后端建议间隔限制2~30秒),同时按1/2/4/8/16/30秒加轻微抖动重连;每轮重新取票。页面只保留一个状态GET在途。 +7. TASK_READ_FORBIDDEN/TASK_NOT_FOUND 停该任务两路读取;SOCKET_TICKET_EXPIRED 仅换票,不清登录;AUTH_TIMEOUT/TEMPORARILY_UNAVAILABLE/SNAPSHOT_UNAVAILABLE 保留HTTP兜底。 +8. 离页/后台停止读取并尽力退订,不取消后台真实设备任务;回来立即GET并重新订阅。 + +### 7.7 退订模板 + +```json +{ + "type": "${V2_UNSUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "subscription_id": "subscription-example-001" + } +} +``` + +服务端可回 event=airport_v2.unsubscribed,带 subscription_id/task_id;App 离页不等待回执。旧310/311和旧推送流程保持不变,新频道不能向旧订阅者发送新结构。 + +## 8. POST 两路图传参数 + +```text +POST /api/app/airport/v2/tasks/501/live +``` + +入参: + +```json +{ + "execution_id": "execution-001", + "viewer_id": "66666666-6666-4666-8666-666666666666" +} +``` + +| 字段 | 定义 | +| --- | --- | +| execution_id | 本次观看对应执行,必须与当前有效执行一致 | +| viewer_id | App 本次可见观看会话UUID;补取/续期保持不变,新观看/换执行重新生成 | + +该POST是幂等“确保观看并取当前参数”:同一 viewer_id 不反复创建观看身份、健康房间或重复启动已有设备流。后端仅按需开缺失来源,并对同任务不同观看者去重;重复调用可以返回刷新后的凭证,不要求原样重放过期参数。 + +返回 JSON,首版明确只支持火山 Volc RTC: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "live_version": 2, + "refresh_after": 30, + "sources": { + "airport": { + "available": true, + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_AIRPORT_ROOM", + "user_id": "EXAMPLE_VIEWER_AIRPORT", + "token": "EXAMPLE_RTC_TOKEN", + "expires_in": 2400 + }, + "drone": { + "available": false, + "reason": "DRONE_NOT_READY" + } + } + } +} +``` + +| 出参 | 定义 | +| --- | --- | +| task_id / execution_id / live_version | 必须回显当前来源版本和执行,用于丢弃旧参数 | +| refresh_after | 建议下次补取/续期的秒数。缺一路默认30秒、限制5~60;两路健康时可按最早凭证到期前30秒安排,至少5秒 | +| sources.airport / sources.drone | 固定两路,不再重复返回第三份 play 推荐对象 | +| available | 本次有有效连接参数,不代表手机已收到画面 | +| app_id/room_id/user_id/token | 结构化火山入房参数,只在available=true时必需 | +| expires_in | 回包时剩余有效秒数;App按请求往返时间保守扣减,再用单调时钟续期,不依赖手机墙上时钟 | +| reason | available=false时可选原因码,由App映射“等待来源”等提示 | + +不返回拼接URL、重复raw、设备指标或业务stage。非volc来源暂明确返回UNSUPPORTED_LIVE_PROVIDER,不能伪装当前App已支持其他SDK。 + +### 8.1 live_version 与实际画面 + +- 后端发现来源出现、撤销、换设备或必须重连的房间身份变化:递增live_version,同时递增state.version,随任务状态推送;**不新增第三类业务WS消息**。 +- App发现来源版本变化,在仍可见、当前执行尚未回收结束时合并请求live。两类数据与live回包交错时,以当前execution和已知来源版本为准,旧回包不能恢复旧画面。 +- 纯token续期不改live_version、不改业务state;保持有效room_id/user_id,使用SDK续期,不反复退房入房。 +- 同一viewer的live请求串行,WS变更、定时补参和续期合并到同一请求循环;已有请求在途时只记录需要再查,不并发另开请求。客户端按本地观看/请求代次作废迟到响应,即使live_version相同,旧请求也不能覆盖新请求凭证。纯续期不应提前吊销仍在原有效期内的旧凭证,避免客户端刚换参前掉流。 +- expires_in必须先保守扣除本次请求耗时;已无剩余有效期的参数不可入房。凭证临期需要尽快续取时,不能因为refresh_after“至少5秒”而等过实际过期;最小间隔用于普通补参/失败退避,不能延长旧凭证有效期。过期旧画面不能继续标实时。 +- 后端参数可用、SDK发布、手机实际视频帧是不同层次。只有真实有画面才显示实时标识;无人机有帧后切换,无人机异常则退回仍健康的机巢,两路无画面则等待。 +- 有一路缺参时仍按refresh_after补取,不能只依赖一次WS通知;保留健康房间。HTTP暂时缺某路参数不把仍有帧、凭证有效的健康连接直接关闭。 +- 必须区分“本次暂取不到参数”和“来源已明确撤销/替换”:available=false且reason=SOURCE_REVOKED,或新版本明确替换该路房间身份时,停止该路被撤销/替换的旧连接和凭证,不沿用健康流保留规则;其它健康来源可继续。替换锁定飞机必须使用新execution,同一设备的房间身份变化才仅增加live_version;不能在同execution下静默把画面换成另一架飞机。 +- completed/returned/failed/cancelled、离页、后台或执行身份失效时,停止本机接收,取消补流和续期;迟到live/SDK回调不得重启。初次读到这些已结束状态时不先调用live。 +- 任务failed/cancelled的输出必须与实际没有待回收飞行相符;仍在回收时应输出returning继续观看,不能用“拍摄失败”提前隐藏空中流程。 +- 释放本机RTC不调用设备停流,不影响其他观看者。后端清理失效viewer记录;需要设备级停流时另行定义,不能混入本次客户端退出。 + +后端暂无法可靠感知来源变化时,应反馈并保留限频缺流补取;不能伪造live_version变化。无论是否有WS通知,实际首帧/卡顿判断都由SDK完成。 + +## 9. App 本地展示与按钮规则 + +### 9.1 本地十种业务状态 + +前往拍摄点、已到达待开拍、拍摄中、已暂停、返航回收中、已完成返航、拍摄任务已完成、拍摄失败、任务已取消、状态待确认。 + +本地映射规则:先校验数据,若paused=true且stage为可暂停阶段,显示已暂停并保留原stage;否则按第3.4节映射。返航暂停显示“返航已暂停”,恢复后仍返航。没有“素材处理失败”或“上传中”主状态。 + +加载、网络错误、按钮等待、RTC播放状态和倒计时是独立状态。请求失败有旧数据时保留旧业务阶段;单次动作拒绝只提示,不把整个任务改failed。 + +### 9.2 常规按钮 + +| 当前本地场景 | 主操作 / 安全按钮 | +| --- | --- | +| 前往 / 待开拍 / 拍摄中 | 通常可暂停、返航;ready另有开始拍摄 | +| 已手动暂停 | 暂停按钮改继续任务;非返航暂停通常还可返航 | +| 返航回收中(含暂停返航) | 禁重复返航;返航未暂停可暂停,已暂停则继续任务 | +| 已完成返航 | 主按钮重新召唤恢复可点;暂停、返航不可点 | +| 拍摄任务已完成 | 主按钮查看素材;暂停、返航不可点 | +| 拍摄失败 | 显示原因和重新召唤入口;是否仍有权益、设备是否可用等均由POST校验,不再要求一个“可恢复”权限字段 | +| 任务已取消 | 展示取消结果;不在本稿中新增“取消后必提供重召”的产品约定,也不因取消而假造returned | +| 状态暂未知 / 刷新失败 | 不因一次读取失败整区禁用已有安全操作;后端最终校验,明确账号/任务身份失效则停操作 | + +本表是App固定展示规则,不要求后端返回可操作列表。对应动作正在提交/待确认时仅该按钮loading、防重复;其他安全动作仍可按规则尝试。会改变开拍语义的本地操作正在处理时避免并发开拍;后台变化最终由POST拒绝或确认。 + +### 9.3 倒计时实现边界 + +App按账号+task+execution维护本地“未建立/计时中/已销毁/已归零”记录。正常准备页持有本次新召唤回执,或当前会话已观察到travelling→ready,可认定本次首次可靠到达并创建30秒。直接重入仅看到ready、没有可靠记录时不创建。 + +同执行只创建一次。点击pause/start_recording/return_home前先销毁并记住,不因失败、resume、重复ready或WS重连恢复;离开ready进入其它业务阶段也清理显示。新execution才允许重新建立。无持久记录时不跨重启补造时间;后台保有原记录时实际经过时间继续扣减。 + +这只是现场提示,不保证与设备真实自动开拍剩余秒数精确一致。后端进入recording时立即以其更新UI。点击暂停销毁的是App计时,不是凭客户端计时去取消/创建设备自动开拍计划;后端仍须维护真实设备暂停/恢复语义。 + +### 9.4 完成与重新进入 + +正常完成弹窗按task+execution在当前页面会话去重:当前会话已展示非终态,之后首次确认completed时提示一次,前后台/重复快照不重复弹;重入时首份状态已经completed,则仅展示完成面板,不重复弹窗,也不自动启动RTC或计时。正常结束不等于素材就绪/整单确认。 + +returned仍是中断结果,说明“本次拍摄已中断,无人机已返回机巢”,重新召唤复用订单任务。再调用summon后必须换execution,清旧控制上下文/倒计时/图传。旧执行的指令结果可核对历史,但不能应用到新飞行。 + +## 10. 状态生产与错误分类 + +### 10.1 服务端生产要求 + +- 统一组装state/telemetry供HTTP、动作回执、WS使用;不在不同接口分别拼不同阶段。副本同版本必须内容一致。 +- 关键设备事件及时更新stage/paused;正常与中断收尾严格区分。后台跟踪不能因旧OFT进入25或素材上传而停止v2回巢/关盖核对。 +- state相关字段和当前动作进展变化升state.version;指标独立升telemetry.version;live来源变化升live_version及state.version。无变化GET、Ping/心跳、凭证纯续期不升业务版本。 +- 版本、执行身份、动作幂等和暂停方向必须在进程/缓存重启后恢复。先一致提交状态与版本,再可靠投递推送,不能只有进程内回调。 +- state完成不提前改写订单成功、素材成功、次数等其它模块既有语义。是否允许新任务提交仍由设备占用和订单权益检查;素材上传本身不拦下一次,但尚未回收的设备不能被抢占。 + +### 10.2 最少错误码集合 + +| error_code | 处理范围与行为 | +| --- | --- | +| LOGIN_EXPIRED | 统一登录处理 | +| TASK_READ_FORBIDDEN / TASK_NOT_FOUND | 停当前任务HTTP/WS;不是单次动作拒绝 | +| TASK_NOT_STARTED | 无执行的任务不进入任务页;回准备流程,不创建假阶段 | +| SOCKET_TICKET_EXPIRED | 只换票重连 | +| AUTH_TIMEOUT / SNAPSHOT_UNAVAILABLE / TEMPORARILY_UNAVAILABLE | 可恢复读取/订阅,HTTP兜底 | +| ACTION_NOT_ALLOWED / ACTION_IN_PROGRESS | 对应动作结束等待/提示或沿已有动作核对,保留业务stage | +| EXECUTION_CHANGED / ACTION_CONTEXT_CHANGED | 更新当前状态,等待明确操作;不自动改参数重发 | +| IDEMPOTENCY_CONFLICT | 原request_id被不同参数复用,明确拒绝 | +| DEVICE_COMMAND_FAILED | 明确执行失败,与任务阶段是否失败分开 | +| DEVICE_CONFIRMATION_UNKNOWN | 只读核对,不自动重发 | +| LIVE_NOT_AVAILABLE / UNSUPPORTED_LIVE_PROVIDER | 图传提示,不改变拍摄任务结果 | + +网络超时不映射成DEVICE_COMMAND_FAILED。权限/任务错误的范围必须准确:某条动作不允许,不应停止全部任务读取。异常日志应能按task/execution/request_id串联派发与设备确认,响应不泄漏数据库SQL或服务器堆栈。 + +## 11. 联合验收清单 + +| 场景 | 必须结果 | +| --- | --- | +| 召唤受理但设备尚在巢 | travelling,不误判returned;任务页能及时显示前往 | +| 到首点自动悬停 | ready+paused=false,不出现手动暂停 | +| 可信首次到达/重复到达 | 创建一次本地30秒,重复包/指标变化不重置 | +| 点击暂停/开拍/返航后失败 | 倒计时已销毁,不恢复,不重建30秒 | +| 暂停→继续仍ready | 只有开始拍摄按钮;新的context,旧开拍请求不能误执行 | +| 重入/重启无计时记录 | ready直接显示开始按钮,不补造30秒 | +| 后台有原计时记录 | 按实际经过时间继续;归零不发开拍 | +| 暂停未确认就返航 | 可提交返航,旧暂停迟到不反锁;一按钮等待不全局锁 | +| 返航暂停→继续 | stage保持returning,方向不丢 | +| 正常录制结束开始返航 | 仍returning,不弹完成,不停RTC | +| 已入巢但未关盖 | 仍returning,继续图传 | +| 正常收尾结束 | completed,提示一次并停本机RTC | +| 未拍完中断后收尾结束 | returned,中断结果保留,重新召唤入口可点而非假成功 | +| 起飞前返航/取消能力不足 | 真实取消或明确拒绝,不凭inside判回巢 | +| POST回执丢失/后端进程重启 | 同request_id可查,不自动换键重发,不盲目补派发 | +| 迟到pending与新succeeded | operation.version防回退,state版本防阶段回退 | +| 重召换执行 | 旧动作/倒计时/指标/图传均不能影响新执行 | +| WS首包登记竞争/空缓存 | 最新状态最终可达,完整首包或明确失败,不半成功空等 | +| 指标版本先到、状态后到 | 分模块比较,不因指标版本大丢掉有效状态 | +| 心跳无变化/漏推 | 无变化正常等待;版本领先触发一次合并GET修复 | +| 旧订阅/旧连接迟到 | 不能续当前健康期、不能回滚新数据 | +| 无读数/120秒过期/恢复 | 6项可空首包不阻塞,旧值保留,各项真实时间与版本正确 | +| 直播来源变更/漏通知 | live_version触发取参,缺路限频补取,保留健康流 | +| 纯token续期/参数身份不变 | 不升live_version,不反复入房 | +| 结束与live迟到同时发生 | 结束后不能恢复播放;不停止其他人的设备流 | +| 新旧包并行同任务/设备 | 旧HTTP和310/311原格式正常;新旧频道不串、共享设备占用和防重 | + +## 12. 朱工实施前登记与交付 + +1. 分配并登记V2_SUBSCRIBE_TYPE / V2_UNSUBSCRIBE_TYPE,确认共享/wss入口能独立路由。 +2. 确认正常/中断回收结束可获得“回巢、关盖、收尾完成”的可靠依据;不以计时模拟。确认起飞前return_home的真实取消能力,不支持则明确拒绝。 +3. 确认live_version变化的来源事件和缺流补取方式;纯凭证续期不改来源版本。 +4. service-fly与hyperf-socket按同一合同联调发布;旧协议兼容回归后再安排两端App适配。 +5. 提供各HTTP真实脱敏回包、两个WS编号、首包/两类推送/错误样例,以及当前未支持项;与本文有差异先反馈并同步合同,不悄悄改字段含义。 + +本稿不要求朱工提供设备无法可靠给出的倒计时时间,也不要求接口返回UI或按钮权限。后端负责真实业务事实与执行校验,App负责本地展示与请求恢复。 + +## 附:完整协议示例 + +同目录“拍摄任务页-v2协议示例”提供独立JSON。订阅/退订文件后缀template.json表示待替换整数编号,其余示例可作为结构校验夹具;所有凭证均无效。 + +| 文件 | 内容 | +| --- | --- | +| `01-http-state-ready.json` | 含首次info的GET回包 | +| `02-http-pause-request.json` | 暂停入参 | +| `03-http-pause-accepted.json` | 暂停已受理,设备尚待确认 | +| `04-ws-subscribe.template.json` | 新订阅模板,编号待分配 | +| `05-ws-subscribed.json` | 完整双模块首包 | +| `06-ws-state-returning.json` | 正常或中断返航回收中 | +| `07-ws-state-completed.json` | 正常任务回收完成 | +| `08-ws-state-returned.json` | 中断返航回收完成 | +| `09-ws-telemetry.json` | 完整六项指标 | +| `10-ws-heartbeat.json` | 协议心跳携带双版本 | +| `11-http-live-response.json` | 两路参数,一路待就绪 | +| `12-http-action-unknown.json` | 查到动作结果待确认 | +| `13-http-execution-changed.json` | 旧执行动作拒绝 | +| `14-http-summon-response.json` | 重召时旧/新execution对应关系 | +| `15-ws-unsubscribe.template.json` | 新退订模板,编号待分配 | +| `16-http-first-summon-rejected-query.json` | 首次召唤被拒绝且未建执行时,动作仍可查询 | + +旧《接口重构方案-讨论稿》及其旧示例已过期,实施以本文为准。此前《接口入参与返回JSON详解》仅描述旧客户端,不是v2协议。 + diff --git a/docs/9.9.1/README.md b/docs/9.9.1/README.md new file mode 100644 index 0000000..4c34c10 --- /dev/null +++ b/docs/9.9.1/README.md @@ -0,0 +1,60 @@ +# 随心瞰9.9.1 需求评审与流程资料 + +本目录归档2026-10-21至2026-10-22生成的需求评审、状态分类、产品原型对比、流程截图和浏览器实测记录。本次仅增加文档资料,不包含App业务代码变更。 + +## 优先阅读 + +| 文档 | 用途 | +| --- | --- | +| [当前方案基线](review/product-comparison/current-baseline.md) | 最新明确确认的C01–C20、原需求已有规则及仍未确定的事项 | +| [产品原型与当前方案对比](review/product-comparison/随心瞰9.9.1-产品原型与当前方案对比.md) | 双向缺口、差异、新套餐收款页、合并后的10类状态与开发边界 | +| [非支付流程复跑记录](review/product-comparison/非支付流程复跑记录.md) | 连续拍摄到本次素材下载、跨订单占用、异常恢复、42个非支付菜单状态及本轮截图 | +| [收款与工作台记录](review/product-comparison/payment-verified.md) | 套餐选择、改价、二维码、模拟支付与收款异常 | +| [准备与任务记录](review/product-comparison/flight-verified.md) | 点位航线、召唤、任务状态、暂停恢复、返航、结果待确认 | +| [订单与素材记录](review/product-comparison/materials-verified.md) | 订单分类、素材分组与筛选、下载和权限提示;后续补证以非支付复跑为准 | +| [现有收款能力与新增边界](review/product-comparison/payment-existing-vs-new.md) | 旧App可复用能力与套餐收款的真正增量,代码引用已改为项目相对链接 | + +**依据顺序:最新明确确认 → 原需求规则 → 尚未确认的评审建议 → 原型观察。** 原型差异不会自动覆盖已确认规则。“交付成片”事件、主动返航是否二次确认仍保持未定。 + +## 初版评审与状态分类 + +- [完整HTML评审报告](review/review.html):下载或克隆项目后,用浏览器打开,可查看评审正文及12组横向状态图。 +- [独立横向状态原型](review/state-flows.html):用于查看或继续编辑状态示意。 +- [状态分类Word](review/state-document/随心瞰9.9.1状态分类与取值清单.docx)。 +- [状态分类PDF](review/state-document/render-final/随心瞰9.9.1状态分类与取值清单.pdf):最终4页导出。 + +HTML评审、Word、PDF及横向状态图主要保留10月21日的评审阶段内容,尚未重新导出以覆盖10月22日全部确认。对有差异的规则,应优先看上方当前基线和最新流程对比;旧图中涉及的Web状态与候选异常不代表都属于App本版已确认范围。 + +## 横向流程截图 + +12张整图按状态从左到右排列,单独界面见[截图目录](review/screens/)。第03组已是修复后的完整图;第11、12组包含已调整的紧凑任务卡。 + +| 编号 | 流程图 | 界面数 | +| --- | --- | --- | +| 01 | [销售收款与订单建立](review/flows/01-sales.png) | 6 | +| 02 | [正常召唤与拍摄](review/flows/02-shooting.png) | 7 | +| 03 | [暂停、恢复与返航(完整修复版)](review/flows/03-pause-return.png) | 6 | +| 04 | [指令拒绝、任务失败与重试](review/flows/04-failure.png) | 5 | +| 05 | [连接中断与指令结果未知](review/flows/05-network-command.png) | 6 | +| 06 | [拍摄准备的阻断与恢复](review/flows/06-readiness.png) | 6 | +| 07 | [次数结算与订单终态](review/flows/07-quota.png) | 5 | +| 08 | [素材上传、下载与保存](review/flows/08-media.png) | 6 | +| 09 | [收款与交付异常分支](review/flows/09-commerce-exceptions.png) | 5 | +| 10 | [Web配套套餐生命周期](review/flows/10-web.png) | 5 | +| 11 | [任务返回工作台与重新进入](review/flows/11-workbench-resume.png) | 4 | +| 12 | [工作台订单卡片任务状态提示](review/flows/12-workbench-task-states.png) | 7 | + +以上共68张单独界面。它们是评审示意图;实际产品原型截图位于下方实测目录,两者的来源和用途不同。 + +## 实测证据与归档范围 + +- [产品原型初次实测记录与截图](review/product-comparison/evidence/)。 +- [非支付复跑记录与截图](review/product-comparison/nonpayment-rerun/):111份DOM、56张截图,[文件索引](review/product-comparison/nonpayment-rerun/manifest.json)。 +- [横向状态图索引](review/manifest.json)与[当时的校验结果](review/verification.json)。 +- [归档文件校验清单](archive-manifest.json):路径、大小和SHA-256,供核对迁移完整性。 + +保留了文档原有相对目录、截图修复版和相关校验图。字体缓存、旧Word渲染目录及依赖个人电脑路径的浏览器导出脚本未归档。HTML报告和Word的文档生成源分别保留为[build-report.cjs](review/build-report.cjs)与[build_states.py](review/state-document/build_states.py)。 + +原始输入《随心瞰9.9.1.md》及其附件由用户提供,本次归档范围为此前生成的资料,未复制原始下载目录。来源说明保留在基线中;链接到项目源码的引用已相对化。 + +原型标注“交互原型·无真实操作”。普通按钮实走、状态菜单预览与真机未验证事项在记录中分别说明;截图不等于真实支付、真实飞行、系统相册写入或App后台行为已经通过测试。 diff --git a/docs/9.9.1/Release机巢日志与轮询-2026-11-02.md b/docs/9.9.1/Release机巢日志与轮询-2026-11-02.md new file mode 100644 index 0000000..33da168 --- /dev/null +++ b/docs/9.9.1/Release机巢日志与轮询-2026-11-02.md @@ -0,0 +1,76 @@ +# Release 机巢日志与 shooting 轮询 + +更新日期:2026-11-03。当前控制台格式以本页为准,覆盖旧模块标签和诊断信封。文档示例为模拟数据。 + +## 收集日志 + +通过 Xcode 有线或无线 Run/Attach 后,Debug、Release 都会在调试控制台输出完整缩进 JSON;代码没有 `#if DEBUG` 输出限制。按接口路径(例如 `/api/app/airport/shooting` 或 `/wss`)查找即可。长内容一次写入,避免分段标识打断 JSON;多个请求不会在同一段内互相穿插。 + +脱离 Xcode 独立运行时仍写入系统日志,可在 macOS「控制台」选择已连接手机、开始流式传输后查看;为避免系统单条日志长度截断,长内容仍分段,但不附加 session/entry/part。iOS 日志保留时长由系统决定,没有新增 App 内日志文件。 + +2026-11-03 修复:Xcode 输出通道发生 I/O 错误或断管时,当前及后续日志自动回退到系统日志,不再使用可能抛出 `NSFileHandleOperationException` 的旧 `writeData:`。JSON 内容保持原值,系统日志长内容仍分段;重新启动 App 后可重新使用已恢复的 Xcode 输出通道。`SIGPIPE` 仅对写入描述符抑制,不修改全局信号处理。 + +## 当前格式 + +请求发出时先输出 `path` 和 `params`,响应到达时输出对应入参及完整 `response`,例: + +```json +{ + "path": "/api/app/airport/shooting", + "params": { + "id": "501", + "live_battery": "0" + }, + "response": { + "code": 100000, + "data": { "ui": { "phase": "shooting" } }, + "msg": "success" + } +} +``` + +- GET 查询参数与 POST JSON 均转为 JSON 展示。请求同时有 query/body 时,分别放在 `params.query`、`params.body`,避免同名参数覆盖;重复 query 值保留为数组。 +- 保留后端完整 Envelope(含 `code/data/msg/time` 等实际字段),不把正文变成转义 JSON 字符串。业务失败也只打印一次回包。 +- 请求 Header、域名、方法、HTTP 状态、耗时、版本、session/entry/part 及 Request/Response 模块前缀不再输出。页面、心跳、解析、RTC 等事件不进入控制台;系统自带的日志元数据不由 App 控制。 +- 没有后端响应时使用 `response.local_error` 显示本地网络失败、取消或拦截,不能将其当成后端回包。 +- 非 JSON 文本按 JSON 字符串保留,视频/图片只输出字节数等元信息;不会打印文件字节。原有显式关闭正文或脱敏的接口设置继续生效;机巢原始参数/回包仍完整保留。 +- WebSocket 使用真实路径 `/wss`,请求 `params` 为订阅 JSON,响应按当前任务 `id` 关联,`response` 为原始 ack 或完整推送。不会额外打印心跳与重连状态事件。 + +## 本次授权范围 + +用户明确授权“开放 Release 真实操作,Debug 保持拦截”。Release 首页/订单准备入口允许 `tasks/create → shoot`,任务页注入 `start-shoot/command/shoot restart=true` 服务;使用原有门禁、任务校验、防重和返航确认。真实按钮不再显示“本地模拟”。2026-11-03 后续要求 `live` 在进页和可见时回前台自动开启一次,失败可重试;HTTP/WS 状态刷新不重复请求。未知设备操作和不匹配的 HTTP 方法仍被拦截。 + +Debug 网络保护与 RTC 初始化前保护不变。代理不会调用真实创建、飞控或图传;真实设备测试由用户自行打包执行。 + +## shooting 轮询 + +当前任务页优先 WebSocket,下列间隔用于异常时 HTTP 兜底;进页、回前台和手动刷新仍读一次,详见工程根目录 WebSocket 接入文档。 + +- 页面完整出现/可见时回前台立即 GET;随后上次 GET 结束后再等默认 5 秒。 +- 使用后端 `plane_status.poll_hint_ms`,正数限制为 2~30 秒,无效/缺失回退 5 秒。 +- 串行读取同一任务,不并发;手动刷新替换尚未开始的下一次计时。 +- 离页/后台取消,身份变更终止;刷新及普通失败保留旧快照,下周期可恢复。自动刷新失败不反复弹 Toast。 +- 控制流程暂停轮询,受理后的回查完成再恢复。绝不自动重发 `tasks/create/shoot/start-shoot/command`。 +- `live_battery=0`,不启动实时采集;轮询不请求 `live`、不重启播放器。 + +## 验证 + +- 2026-11-03 后续自动图传与崩溃修复:模拟器 79 项通过,包含真实隔离管道断开、EIO/无效描述符、完整 JSON、图传自动启动/后台恢复/离页取消、WebSocket `Opened` 兼容及 Debug 拦截;结果包 `test_sim_2026-11-03T02-11-58-734Z_pid38943_17bdc80a.xcresult`。所有图传服务与播放器均使用替身,无真实设备请求。 +- 对应 Release 真机架构无签名编译通过,日志 `/private/tmp/suixinkan-auto-live-console-fix-release.log`。未安装或运行正式包。 +- 2026-11-03 简洁 JSON 格式:两轮模拟器回归共覆盖 58 项不同测试,全部通过(首轮 47 项,最终 22 项含重复复验)。覆盖三种 HTTP 入口、机巢输出实际格式、WebSocket、长字符串/数组/null、重复 query、原始错误回包、正文开关、鉴权行为及 Debug 禁飞保护。 +- Release 无签名编译通过:`/private/tmp/suixinkan-simple-json-log-release-build.log`。没有安装/运行正式包,没有调用真实飞控或图传。 +- 模拟器结果包:`test_sim_2026-11-03T01-17-43-867Z_pid2672_a96854ad.xcresult`、`test_sim_2026-11-03T01-21-24-006Z_pid2672_3203bda7.xcresult`。 +- 以下为历史格式的验证记录,不代表当前控制台还输出旧标签或诊断信封。 + +- 模块标签更新后:41 项相关模拟器测试通过,覆盖模块归属、每段标签、原值无损重组、三个网络入口、失败/取消以及禁飞保护。Release 无签名编译通过,日志:`/private/tmp/suixinkan-module-log-format-release-build.log`。 +- 其他模块开放 Release 日志后:36 项相关模拟器测试通过,覆盖三种发送入口、完整大响应、错误/取消、登录状态及机巢日志与禁飞保护回归。Release 无签名编译通过,日志:`/private/tmp/suixinkan-global-api-logging-release-build.log`。 +- 取消脱敏后:52 项相关模拟器测试通过,验证原始 Header、RTC/STS 参数、签名 URL、嵌套 JSON、文本错误页、长日志分段和原有飞控保护。Release 无签名编译通过,Debug/Release 离线策略脚本均通过。结果:`test_sim_2026-11-02T08-20-39-894Z_pid2672_0db869c5.xcresult`;构建日志:`/private/tmp/suixinkan-raw-api-logging-release-build.log`。 +- 历史验证(取消脱敏前):全接口日志补齐后,83 项相关模拟器测试通过,覆盖接口范围、完整请求/响应、重复请求、STS/RTC 脱敏、文件摘要、网络客户端、业务 API 和上传/下载回归;Release 无签名编译通过。结果:`test_sim_2026-11-02T08-08-11-112Z_pid2672_6a9a831c.xcresult`;构建日志:`/private/tmp/suixinkan-all-api-logging-release-build.log`。 +- 历史验证(取消脱敏前):模拟器 151 项测试通过,0 失败、0 跳过。覆盖轮询生命周期/并发/旧快照/失败恢复、图传不随轮询开启、日志脱敏及大 JSON 分段、准备页创建/召唤与安全控制防重、Debug 禁飞保护和统一网络客户端。 +- Release `generic/platform=iOS` 无签名构建通过,没有安装或启动 Release App。 +- `scripts/verify-drone-dock-build-policy.swift` 分别按 Debug/Release 编译并运行:验证已知操作 POST 在 Debug 拦截、Release 放行,错误方法/未知操作始终拦截,状态仍关闭实时采集,诊断日志按原值输出。此脚本没有网络传输实现。 +- 代理仅使用隔离网络替身和模拟器,没有执行真实创建、召唤、拍摄、控制或图传。 + +模拟器结果:`/Users/hanqiu/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-11-02T03-58-41-113Z_pid7237_4d1daf27.xcresult`。 + +Release 构建日志:`/private/tmp/suixinkan-release-diagnostics-final-build.log`。 diff --git a/docs/9.9.1/UI更新复核-2026-10-23.md b/docs/9.9.1/UI更新复核-2026-10-23.md new file mode 100644 index 0000000..f82edfe --- /dev/null +++ b/docs/9.9.1/UI更新复核-2026-10-23.md @@ -0,0 +1,136 @@ +# 随心瞰 9.9.1 产品原型 UI 更新复核 + +日期:2026-10-23。原型:[机巢交互体验](https://voicestudio.suixinkan.cn/)。 + +本轮通过内部浏览器实际点击、切换页面和状态预览,目的是为随后 UIKit 页面搭建确定视觉参考、组件和交互边界。未修改 App 业务代码,未连接真实设备、支付、手机相册或上传个人文件。 + +## 1. 本轮结论 + +1. **工作台无人机区和“我的拍摄订单”卡片有明确的视觉更新。** 工作台增加单台/多台无人机卡片,订单列表增加次数进度条、交付及游客确认信息。 +2. **“交付成片”新增了完整的产品演示流程。** 包括方式选择、云端成片上传、整单核对、确认二维码、游客确认/问题反馈、确认记录。这会带来新的页面与业务契约,不只是调整配色和间距。 +3. **拍摄准备、任务控制、素材库的主要结构延续旧版。** 本轮重新检查了对应状态,不把不同状态的文案变化都当成整页改版。 +4. **原型仍保留若干与用户先前确认不同的行为。** UI 搭建时以新版视觉为参考,同时保留原有明确确认,见第 5 节。 + +依据优先级继续采用:[当前方案基线](review/product-comparison/current-baseline.md)中的最新确认 → 原需求 → 本次原型观察。之前讨论的局域网交付仅确认可行性,未因此确认将闪传纳入 9.9.1 实施。 + +## 2. 本轮走查范围和证据边界 + +| 区域 | 实际查看的内容 | +| --- | --- | +| 工作台 | 单台/多台无人机、横向切换、环形电量、未知读数、普通订单与执行中订单卡 | +| 套餐收款 | 初态、套餐弹层、生成码、改价弹层、生成失败/失效/空套餐预览、模拟支付成功、查看订单 | +| 拍摄订单 | 全部/待拍摄/进行中/已完成、空列表、新卡片、未结束任务入口、交付状态入口 | +| 拍摄准备 | 点位/航线切换、连接、占用、无信号、低电量、未知、范围外、无航线、次数用完 | +| 拍摄任务 | 正常召唤/到达/开始/成功,暂停/恢复处理中,返航、失败预览、断流、手机断网、保护返航、指令超时、图传放大 | +| 素材库 | 本次任务点位素材、整单点位筛选、拍摄记录分组、上传/就绪/失败、选择、预览、模拟下载、部分失败、重试、权限提示、离页提示 | +| 新成片交付 | 交付方式、面对面占位、云端选点、演示相册多选、模拟上传、部分失败/仅失败项重试/全部完成、整单核对、确认码、游客确认、反馈弹层、确认记录 | + +普通按钮操作和状态菜单预览均有保存,但两者不能混为真实业务联调。状态预览会修改演示上下文;例如“返航中”预览会展示“拍摄已中断”,不能把它当成正常拍摄成功后的自然返航结果。连续切换预览时还可能保留其他演示数据,应结合截图及操作说明判断。 + +原型中的素材下载、相册保存、支付、上传、游客扫码均为演示。本轮成片上传使用页面明确标注“不读取手机文件”的演示相册,没有上传本机视频;游客反馈只查看弹层,未提交真实消息。 + +截图与 DOM 记录保存在 [本轮证据目录](ui-review-2026-10-23/),见[索引](ui-review-2026-10-23/manifest.json)。DOM 可能包含页面过渡时保留的旧页面;以当时可见截图、导航标题和操作目标判断当前页面,不能按全文搜索结果认定隐藏旧页面仍在展示。截图是当时可见视口,长页面需结合 DOM 查看,不是全部内容长截图。 + +## 3. 能确认的 UI 更新及搭建要点 + +| 页面/区域 | 现在的表现 | UIKit 搭建要点 | 代表证据 | +| --- | --- | --- | --- | +| 工作台顶部 | 景区与工作人员缩成一行,下面集中展示设备 | 上下文行与设备区域分别布局 | [工作台](ui-review-2026-10-23/01-workbench.jpg) | +| 工作台无人机区 | 单台时一张卡;多台时横向滑动、露出下一张卡,有分页点;演示有 01–06 号设备 | 可复用无人机状态卡+横向列表;数量来自数据,不固定六台 | [单台](ui-review-2026-10-23/02-workbench-single-drone.jpg)、[轮播](ui-review-2026-10-23/04-workbench-drone-carousel.jpg) | +| 无人机卡内部 | 标题/状态标签;左侧环形电量,右侧信号/搜星,底部温度/风速/雨量;未知为“—” | 六项读数与有效性统一建模;工作台环形卡与任务页遥测格是两种布局 | [未知](ui-review-2026-10-23/03-workbench-unknown.jpg)、[任务遥测](ui-review-2026-10-23/37-task-arrived.jpg) | +| 我的拍摄订单 | 大圆角白卡,右上状态,订单号/时间,已拍 x/N 和剩余次数,拍摄进度条,底部横排双按钮 | 独立的订单列表卡;首页继续使用紧凑卡,不将大卡直接套到首页 | [全部](ui-review-2026-10-23/13-payment-orders-default.jpg)、[已完成](ui-review-2026-10-23/14-orders-completed.jpg) | +| 订单卡信息区 | 素材状态与游客确认状态分区;可出现“请游客确认”“待游客确认”“查看记录”及已交付数量 | 拍摄履约、素材上传、交付和游客确认分别驱动展示 | [进行中](ui-review-2026-10-23/18-orders-in-progress.jpg)、[确认后记录](ui-review-2026-10-23/26-order-confirmed-receipt.txt) | +| 套餐收款 | 保留大收款卡、套餐选择底部弹层、居中改价弹窗、码状态和成功页 | 可复用项目原有二维码、金额校验和收款信息组件,新增套餐联动界面 | [套餐](ui-review-2026-10-23/06-package-picker.jpg)、[改价](ui-review-2026-10-23/08-payment-amount-sheet.jpg)、[成功](ui-review-2026-10-23/12-payment-success.jpg) | +| 拍摄准备 | 横向点位小卡、纵向航线单选、底部固定连接/范围/召唤区,主要结构沿用旧版 | 点位列表、航线列表和底部许可栏分开刷新;阻断状态不改变整体布局 | [正常](ui-review-2026-10-23/27-preparation-ready.jpg)、[占用](ui-review-2026-10-23/29-preparation-occupied.jpg) | +| 任务页 | 图传、2×3 遥测格、主状态与主按钮、橙色暂停/红色返航;保持原有主要结构 | 图传视图、遥测区、任务状态区、安全控制区拆成可复用视图;独立处理指令处理中/待确认 | [任务](ui-review-2026-10-23/37-task-arrived.jpg)、[暂停](ui-review-2026-10-23/46-task-paused.jpg)、[超时](ui-review-2026-10-23/67-task-command-unconfirmed.jpg) | +| 素材库 | 点位筛选、按记录分组、素材网格、勾选和固定底部下载区沿用旧结构;交付入口使用视频图标 | 整单入口保留点位筛选;本次任务入口可限定当前打卡点;记录标题带交付入口 | [整单](ui-review-2026-10-23/58-materials-mixed-status.jpg)、[本次点位](ui-review-2026-10-23/56-materials-current-point-ready.jpg)、[下载结果](ui-review-2026-10-23/62-materials-download-result.jpg) | + +视觉上采用主蓝、浅灰背景、圆角白卡、浅色状态标签;绿色表示就绪/成功,橙色用于暂停/警示,红色用于返航或失败提示。网页设备外壳会缩放,后续布局按 iPhone 的实际内容宽度和安全区校准,不直接把截图像素当成 UIKit 点数。 + +工作台横向浏览某架无人机是否代表选择该设备执行,原型操作尚不足以证明;准备页未见明确的设备选择步骤。UI 可以先支持多设备展示,执行资源绑定仍以接口契约为准。 + +## 4. 本次新增的成片交付流程 + +### 4.1 交付入口与云端上传 + +```text +订单/素材记录/下载结果区 → 交付成片 + ├─ 面对面闪传 → “流程待确认”占位 + └─ 云端上传 → 选择打卡点 → 演示相册选一个或多个视频 + → 成片上传队列 + ├─ 上传中 + ├─ 部分成功+部分失败 → 仅重试失败视频 + └─ 全部成功 → 继续上传成片/完成 +``` + +- 这是摄影师上传剪辑后的成片,与无人机原素材上传是两条流程。 +- 原型以“上传成功即交付”标记单个作品,可分批上传,不扣拍摄次数。 +- 上传队列显示文件名、时长、大小、上传中/已交付/失败;成功项保持成功,重试只处理失败项。 +- 面对面闪传目前只有入口说明,没有热点连接与游客接收流程。此前只确认方案可行,不据此直接纳入实施。 + +证据:[交付方式](ui-review-2026-10-23/19-delivery-method-sheet.jpg)、[闪传占位](ui-review-2026-10-23/20-delivery-nearby-placeholder.txt)、[选点](ui-review-2026-10-23/21-delivery-cloud-point.jpg)、[演示相册](ui-review-2026-10-23/69-delivery-demo-video-picker.jpg)、[上传](ui-review-2026-10-23/71-delivery-uploading.jpg)、[部分失败](ui-review-2026-10-23/72-delivery-upload-partial-failure.jpg)、[完成](ui-review-2026-10-23/74-delivery-upload-complete.jpg)。 + +### 4.2 整单核对与游客主动确认 + +```text +订单卡“请游客确认” → 商家核对整单清单(跨点位、跨上传批次) + → 勾选“已全部交齐” → 展示订单确认码 + → 演示游客扫码 → 查看整单成片 + ├─ 视频有问题 → 问题反馈,暂不确认收货 + └─ 勾选已收到全部 → 主动确认 → 确认记录 +``` + +- 商家核对页展示作品总数、覆盖点位数、按点位分组的清单;未核对时确认码按钮禁用。 +- 码页可刷新确认状态或稍后返回,明确“扫描不等于收货”。 +- 游客页要求查看清单、勾选后再确认收到;同时提供缺失、无法播放、效果异议、其他问题反馈。 +- 确认记录包含确认人、时间、工作人员、点位与作品范围、确认内容及确认时清单。原型文字说明新增成片不会覆盖原确认清单;本轮未完整复跑“确认后再追加作品”的后续分支。 +- 页面明确当前是本机演示记录,并非真实收货凭据;游客页属于配套网页/游客端边界,不能自动算成商家 App 原生页面。 + +证据:[核对](ui-review-2026-10-23/22-order-delivery-review.jpg)、[确认码](ui-review-2026-10-23/23-order-confirmation-code.jpg)、[游客页](ui-review-2026-10-23/24-visitor-confirmation-demo.jpg)、[反馈](ui-review-2026-10-23/25-delivery-feedback.txt)、[确认记录](ui-review-2026-10-23/26-order-confirmed-receipt.txt)。 + +### 4.3 新增的状态维度 + +| 对象 | 原型现在展示的状态/阶段 | +| --- | --- | +| 交付方式 | 未选、面对面流程待确认、云端上传 | +| 本批成片 | 未选点、未选视频、已选择、上传中、部分成功/失败、重试中、全部成功 | +| 整单交齐核对 | 有已交付作品、尚未勾选交齐、已核对可展示确认码 | +| 游客确认 | 待确认、游客查看中、主动确认成功、问题反馈入口 | +| 确认记录 | 确认时间、人员、范围和作品清单快照 | + +**上传成功、拍摄次数用完、游客确认收货分别表达。** 新原型的交付状态不能改变此前“0 次立即进入已完成”的确认规则。 + +若最终采用云端成片交付及整单确认,需另补成片批次/作品登记、上传结果、整单清单快照、确认会话/状态、游客身份校验和反馈等接口契约。此前[后端接口需求](后端接口需求.md)把交付事件列为暂缓项,不能认为已覆盖这些新增能力。本轮先记录 UI 与范围增量,不擅自改成已确认需求。 + +## 5. 本轮仍观察到的旧差异 + +| 场景 | 本轮原型表现 | 搭建时保留的既有确认 | 证据与限制 | +| --- | --- | --- | --- | +| 支付成功后查看订单 | 默认“全部” | C17:默认“待拍摄” | [13](ui-review-2026-10-23/13-payment-orders-default.jpg) | +| 执行中任务返回 | 弹离开确认,离开后先回准备页 | C02:直接回工作台,原任务继续 | [40](ui-review-2026-10-23/40-task-leave-confirmation.txt)、[41](ui-review-2026-10-23/41-returned-to-preparation.txt) | +| 有余次活跃订单置顶 | 139 订单已拍 2 剩 3、悬停时返回,仍在首页第 3 张 | C03:有余次数的当前任务订单置顶 | [68](ui-review-2026-10-23/68-workbench-active-order-with-quota.jpg);通过预览固定悬停状态后检查 | +| 当前任务按钮与标签 | 按钮仍写“继续查看任务”,未显示右上具体任务阶段 | C04/C05:“查看当前任务”+七种阶段标签,保留首页紧凑卡 | [68](ui-review-2026-10-23/68-workbench-active-order-with-quota.txt)、[43](ui-review-2026-10-23/43-completed-order-active-task.txt) | +| 0 次但仍在返航 | 首页仍保留订单;已完成 Tab 也保留任务入口 | C10/C11:首页立即移除,已完成卡临时保留任务入口 | [42](ui-review-2026-10-23/42-workbench-zero-quota-active.jpg)、[43](ui-review-2026-10-23/43-completed-order-active-task.jpg);0 次来自正常成功,返航由状态预览固定 | +| 失败重试标题 | 仍为“重新召唤无人机” | C09:“重新准备拍摄”,回准备后人工确认 | [50](ui-review-2026-10-23/50-task-failed-ready.txt);此截图继承 0 次而禁用,本轮未用它验证有额度时的重试跳转 | + +另需继续保留:紧急暂停直接提交并等待设备确认;设备、飞行、拍摄结果与素材状态独立;前台下载方案及真实相册写入结果;执行中可切景区后恢复原任务。网页仍无法验证真机后台/锁屏、真实定位、设备回执、文件保存或冷启动。 + +## 6. 后续 UIKit 页面与组件拆分建议 + +以下为搭建建议,尚未修改工程代码。 + +| 模块 | 页面/主要子视图 | +| --- | --- | +| 工作台 | 上下文行、无人机横向列表、环形电量状态卡、首页紧凑订单卡、今日统计 | +| 套餐收款 | 新收款页、套餐单选弹层、改价弹层、码状态视图、成功状态视图;复用原收款信息/记录基础组件 | +| 我的拍摄订单 | 四 Tab、完整订单卡、次数进度条、素材/交付确认摘要、空态 | +| 拍摄准备 | 横向点位卡、纵向航线单选行、底部范围/连接/设备许可及召唤区 | +| 任务控制 | 图传及放大页、六项遥测格、任务主状态、指令处理中/待确认、安全控制、结果弹窗 | +| 素材 | 订单摘要、点位筛选/固定点位、拍摄记录组头、素材格、预览页、选择与下载底栏、批次结果和错误弹窗 | +| 成片交付新增 UI | 方式/选点弹层、系统相册选择入口、上传队列、整单核对、确认码、确认记录;游客确认/反馈网页另定实现归属 | + +建议先搭工作台与两类订单卡,抽出按钮、标签、进度和读数等基础组件;再搭准备页与任务页;随后补收款和素材;新增交付页面单列,按最终确认范围接入。 + +首轮可用明确的展示数据和状态切换进行 UI 验收,保持 UIKit+SnapKit+项目既有 MVVM 风格。设备控制、真实付款、上传、游客确认及局域网传输分别在接口与范围明确后接入,不把原型的模拟按钮或状态菜单带入正式 App。 + +本轮只新增复核文档和截图证据,未提交/推送这些新增资料。 diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-console.log b/docs/9.9.1/api-integration-2026-10-27/airport-home-console.log new file mode 100644 index 0000000..77230ec --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-console.log @@ -0,0 +1,16 @@ +[API][Response] GET https://api-test.zhifly.cn/api/app/airport/home?scenic_id=128&store_id=37 status=200 +{ + "code": 100000, + "data": { + "airports": [], + "orders": [], + "scenic_id": 128, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 14:23:21" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-device-console.log b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-console.log new file mode 100644 index 0000000..966d9e0 --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-console.log @@ -0,0 +1,68 @@ +[API][Response] GET https://api-test.zhifly.cn/api/app/airport/home?scenic_id=128&store_id=37 status=200 +{ + "code" : 100000, + "data" : { + "airports" : [ + { + "id" : 58, + "is_receive_order" : 1, + "metrics" : [ + { + "key" : "battery", + "label" : "电池电量", + "raw" : null, + "value" : "—" + }, + { + "key" : "env_temp", + "label" : "环境温度", + "raw" : null, + "value" : "—" + }, + { + "key" : "wind_speed", + "label" : "风速", + "raw" : null, + "value" : "—" + }, + { + "key" : "rainfall", + "label" : "雨量", + "raw" : null, + "value" : "—" + }, + { + "key" : "signal", + "label" : "信号状态", + "raw" : null, + "value" : "—" + }, + { + "key" : "satellite", + "label" : "搜星状态", + "raw" : null, + "value" : "—" + } + ], + "name" : "江布拉克M4D", + "online_status" : 1, + "scenic_area_id" : 128, + "sn_number" : "8UUXN4300A04NY", + "task_type" : null, + "work_status" : 1, + "work_status_label" : "空闲" + } + ], + "orders" : [ + + ], + "scenic_id" : 128, + "today" : { + "finished_shoot" : 0, + "order_amount" : 0, + "order_count" : 0 + } + }, + "msg" : "success", + "time" : "2026-10-27 14:50:18" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-device-real.png b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-real.png new file mode 100644 index 0000000..cd07d11 Binary files /dev/null and b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-real.png differ diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined-console.log b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined-console.log new file mode 100644 index 0000000..03674ee --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined-console.log @@ -0,0 +1,68 @@ +[API][Response] GET https://api-test.zhifly.cn/api/app/airport/home?scenic_id=128&store_id=37 status=200 +{ + "code" : 100000, + "data" : { + "airports" : [ + { + "id" : 58, + "is_receive_order" : 1, + "metrics" : [ + { + "key" : "battery", + "label" : "电池电量", + "raw" : null, + "value" : "—" + }, + { + "key" : "env_temp", + "label" : "环境温度", + "raw" : null, + "value" : "—" + }, + { + "key" : "wind_speed", + "label" : "风速", + "raw" : null, + "value" : "—" + }, + { + "key" : "rainfall", + "label" : "雨量", + "raw" : null, + "value" : "—" + }, + { + "key" : "signal", + "label" : "信号状态", + "raw" : null, + "value" : "—" + }, + { + "key" : "satellite", + "label" : "搜星状态", + "raw" : null, + "value" : "—" + } + ], + "name" : "江布拉克M4D", + "online_status" : 1, + "scenic_area_id" : 128, + "sn_number" : "8UUXN4300A04NY", + "task_type" : null, + "work_status" : 1, + "work_status_label" : "空闲" + } + ], + "orders" : [ + + ], + "scenic_id" : 128, + "today" : { + "finished_shoot" : 0, + "order_amount" : 0, + "order_count" : 0 + } + }, + "msg" : "success", + "time" : "2026-10-27 14:58:15" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined-response.json b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined-response.json new file mode 100644 index 0000000..c496bcf --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined-response.json @@ -0,0 +1,65 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 58, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "江布拉克M4D", + "online_status": 1, + "scenic_area_id": 128, + "sn_number": "8UUXN4300A04NY", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + } + ], + "orders": [], + "scenic_id": 128, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 14:58:15" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined.png b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined.png new file mode 100644 index 0000000..809ef56 Binary files /dev/null and b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-refined.png differ diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-device-response.json b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-response.json new file mode 100644 index 0000000..d65940a --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-device-response.json @@ -0,0 +1,65 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 58, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "江布拉克M4D", + "online_status": 1, + "scenic_area_id": 128, + "sn_number": "8UUXN4300A04NY", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + } + ], + "orders": [], + "scenic_id": 128, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 14:50:18" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-populated-console.log b/docs/9.9.1/api-integration-2026-10-27/airport-home-populated-console.log new file mode 100644 index 0000000..abca398 --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-populated-console.log @@ -0,0 +1,66 @@ +[API][Response] GET https://api-test.zhifly.cn/api/app/airport/home?scenic_id=128&store_id=37 status=200 +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 58, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "江布拉克M4D", + "online_status": 1, + "scenic_area_id": 128, + "sn_number": "8UUXN4300A04NY", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + } + ], + "orders": [], + "scenic_id": 128, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 14:38:58" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-populated-response.json b/docs/9.9.1/api-integration-2026-10-27/airport-home-populated-response.json new file mode 100644 index 0000000..2f11aa9 --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-populated-response.json @@ -0,0 +1,65 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 58, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "江布拉克M4D", + "online_status": 1, + "scenic_area_id": 128, + "sn_number": "8UUXN4300A04NY", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + } + ], + "orders": [], + "scenic_id": 128, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 14:38:58" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-real.png b/docs/9.9.1/api-integration-2026-10-27/airport-home-real.png new file mode 100644 index 0000000..80c89f4 Binary files /dev/null and b/docs/9.9.1/api-integration-2026-10-27/airport-home-real.png differ diff --git a/docs/9.9.1/api-integration-2026-10-27/airport-home-response.json b/docs/9.9.1/api-integration-2026-10-27/airport-home-response.json new file mode 100644 index 0000000..6385103 --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/airport-home-response.json @@ -0,0 +1,15 @@ +{ + "code": 100000, + "data": { + "airports": [], + "orders": [], + "scenic_id": 128, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 14:13:24" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/home-real-orders-simulator.png b/docs/9.9.1/api-integration-2026-10-27/home-real-orders-simulator.png new file mode 100644 index 0000000..89ce620 Binary files /dev/null and b/docs/9.9.1/api-integration-2026-10-27/home-real-orders-simulator.png differ diff --git a/docs/9.9.1/api-integration-2026-10-27/home-scenic271-latest-response.json b/docs/9.9.1/api-integration-2026-10-27/home-scenic271-latest-response.json new file mode 100644 index 0000000..e7107c4 --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/home-scenic271-latest-response.json @@ -0,0 +1,251 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "河南嵩山", + "online_status": 1, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GF", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "id": 57, + "is_receive_order": 2, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "那拉提M4D", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GC", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "orders": [ + { + "media_status": "none", + "media_status_label": "", + "order_id": 49059, + "order_number": "261023271001", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 132****9413", + "tourist_phone_mask": "132****9413", + "user_id": 141943 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49057, + "order_number": "261022271005", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 183****5710", + "tourist_phone_mask": "183****5710", + "user_id": 141946 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49056, + "order_number": "261022271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 132****9413", + "tourist_phone_mask": "132****9413", + "user_id": 141943 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49054, + "order_number": "261022271003", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 192****1413", + "tourist_phone_mask": "192****1413", + "user_id": 143090 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49053, + "order_number": "261022271002", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 192****1413", + "tourist_phone_mask": "192****1413", + "user_id": 143090 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49052, + "order_number": "261022271001", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 192****1413", + "tourist_phone_mask": "192****1413", + "user_id": 143090 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49051, + "order_number": "261021271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 192****1413", + "tourist_phone_mask": "192****1413", + "user_id": 143090 + }, + { + "media_status": "none", + "media_status_label": "", + "order_id": 49050, + "order_number": "261021271003", + "package_name": "单次航拍 · 含 1 次拍摄", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "progress_text": "已拍摄 0/1 次,剩余 1 次", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄", + "tourist_label": "游客 183****5710", + "tourist_phone_mask": "183****5710", + "user_id": 141946 + } + ], + "scenic_id": 271, + "today": { + "finished_shoot": 0, + "order_amount": 0, + "order_count": 0 + } + }, + "msg": "success", + "time": "2026-10-27 17:40:30" +} diff --git a/docs/9.9.1/api-integration-2026-10-27/verification.json b/docs/9.9.1/api-integration-2026-10-27/verification.json new file mode 100644 index 0000000..ca5f28c --- /dev/null +++ b/docs/9.9.1/api-integration-2026-10-27/verification.json @@ -0,0 +1,73 @@ +{ + "date": "2026-10-27", + "device": "iPhone 11", + "environment": "testing", + "endpoint": "GET /api/app/airport/home", + "scenic_id": 128, + "store_id": 37, + "http_status": 200, + "business_code": 100000, + "response": "airport-home-device-refined-response.json", + "screenshot": "airport-home-device-refined.png", + "tests": { + "related": { + "passed": 40, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-airport-home-tests.xcresult" + }, + "final_ui": { + "passed": 3, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-airport-home-ui-tests-final.xcresult" + }, + "device_cards": { + "passed": 49, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-airport-device-tests.xcresult" + }, + "device_card_visual_regression": { + "passed": 9, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-airport-card-visual-tests.xcresult" + }, + "anonymized_fixtures": { + "passed": 20, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-airport-fixture-tests.xcresult" + } + }, + "verified": [ + "真实接口请求及登录鉴权", + "真实空列表和零统计展示", + "下拉刷新和失败状态", + "旧账号/景区/门店/Token回包隔离", + "正式入口与演示任务隔离", + "按真实设备 ID、名称和工作状态渲染机巢卡片", + "六项读数按 metrics.key 映射,未知值显示 —,真实零值保留", + "未知电量仅展示灰色轨道,合法 raw 数值才绘制进度", + "同 ID 设备刷新清除旧读数与多设备横向分页(真机替身测试)", + "真机实际 home 非空设备响应与最终 App 窗口截图" + ], + "pending": [ + "订单等待后端非空测试数据后再接入", + "finished_shoot 的业务统计口径" + ], + "response_time": "2026-10-27 14:58:15", + "final_build": { + "result": "BUILD SUCCEEDED", + "log": "/private/tmp/suixinkan-airport-device-build-final.log", + "change_after_tests": "仅 DEBUG 截图延后至 Diffable 画面稳定后执行;已重新构建并真机实测截图" + }, + "device_card_visual_review": { + "prototype": "https://voicestudio.suixinkan.cn/", + "verified": [ + "设备状态文字前同色圆点", + "底部三项等宽读数之间的两条竖线", + "搜星采用网页同款 Tabler satellite SVG", + "雨量由普通云改为带雨滴云图标" + ], + "screenshot": "airport-home-device-refined.png" + }, + "source_commit": "40060cd", + "artifacts_location": "真实联调响应、日志和截图仅保留本地,未随代码推送" +} diff --git a/docs/9.9.1/archive-manifest.json b/docs/9.9.1/archive-manifest.json new file mode 100644 index 0000000..6e717e1 --- /dev/null +++ b/docs/9.9.1/archive-manifest.json @@ -0,0 +1,3229 @@ +{ + "format_version": 1, + "archived_on": "2026-10-22", + "source_artifact": "sxk-991-review", + "scope": "Generated review documents, comparisons, screenshots and evidence; no App business code.", + "self_excluded": true, + "file_count": 460, + "total_bytes": 25352400, + "files": [ + { + "path": "README.md", + "bytes": 5229, + "sha256": "8d524ef0980e7bb05bae31d13f94c555264a0cdbd09def50c2d1687ab2b6c0cf" + }, + { + "path": "review/build-report.cjs", + "bytes": 4060, + "sha256": "925d3cf8286955e125873361ec091ff880a4d25e9cbb21cc3692a1c3d8771203", + "source_sha256": "925d3cf8286955e125873361ec091ff880a4d25e9cbb21cc3692a1c3d8771203", + "content_changed_for_archive": false + }, + { + "path": "review/flows/01-sales.png", + "bytes": 592557, + "sha256": "3c580fd25a3b814b0898393a59ec1458f61988a03ef4d294ad6d3349555653d3", + "source_sha256": "3c580fd25a3b814b0898393a59ec1458f61988a03ef4d294ad6d3349555653d3", + "content_changed_for_archive": false + }, + { + "path": "review/flows/02-shooting.png", + "bytes": 549911, + "sha256": "71d87a4c2a6ab6f0faee8da277ea0a194e9cf427d365a546e0656d50a64ffc47", + "source_sha256": "71d87a4c2a6ab6f0faee8da277ea0a194e9cf427d365a546e0656d50a64ffc47", + "content_changed_for_archive": false + }, + { + "path": "review/flows/03-pause-return.png", + "bytes": 578547, + "sha256": "4ab98d95acd9567807ae3f09aa68127055bb3f116f21f33af04a4bdce57398a6", + "source_sha256": "4ab98d95acd9567807ae3f09aa68127055bb3f116f21f33af04a4bdce57398a6", + "content_changed_for_archive": false + }, + { + "path": "review/flows/04-failure.png", + "bytes": 447880, + "sha256": "bcb91364aa35dfd61de0ce7050d21b4cc3419a9cf69d6ebfd44266f2db8890b5", + "source_sha256": "bcb91364aa35dfd61de0ce7050d21b4cc3419a9cf69d6ebfd44266f2db8890b5", + "content_changed_for_archive": false + }, + { + "path": "review/flows/05-network-command.png", + "bytes": 394742, + "sha256": "fe83a58f2d5e817918dcc54a65a265c5ce8cd302854c2891fc14d4e95d659574", + "source_sha256": "fe83a58f2d5e817918dcc54a65a265c5ce8cd302854c2891fc14d4e95d659574", + "content_changed_for_archive": false + }, + { + "path": "review/flows/06-readiness.png", + "bytes": 411747, + "sha256": "577594f69a4e1c8311f61cbe56479d236bd8c02b5f8677a1f11c3ad0985bb044", + "source_sha256": "577594f69a4e1c8311f61cbe56479d236bd8c02b5f8677a1f11c3ad0985bb044", + "content_changed_for_archive": false + }, + { + "path": "review/flows/07-quota.png", + "bytes": 488536, + "sha256": "8aa093016736b4bfe7787648c3bc40759faaa367d7ae94386c90376d851c55aa", + "source_sha256": "8aa093016736b4bfe7787648c3bc40759faaa367d7ae94386c90376d851c55aa", + "content_changed_for_archive": false + }, + { + "path": "review/flows/08-media.png", + "bytes": 560515, + "sha256": "f36d797ae75e4364c40f3e37cabbed2032d165aa1ad845308b5936128025eef5", + "source_sha256": "f36d797ae75e4364c40f3e37cabbed2032d165aa1ad845308b5936128025eef5", + "content_changed_for_archive": false + }, + { + "path": "review/flows/09-commerce-exceptions.png", + "bytes": 468857, + "sha256": "59c1e0b64eb05cb3339e0280b46bacc8f37549e9b9b2a2840272f01d1ed2671b", + "source_sha256": "59c1e0b64eb05cb3339e0280b46bacc8f37549e9b9b2a2840272f01d1ed2671b", + "content_changed_for_archive": false + }, + { + "path": "review/flows/10-web.png", + "bytes": 305074, + "sha256": "129d66ac0f8e9df7febbea01f359bdd07894251ff58cc6e11ea3abefec3ebb17", + "source_sha256": "129d66ac0f8e9df7febbea01f359bdd07894251ff58cc6e11ea3abefec3ebb17", + "content_changed_for_archive": false + }, + { + "path": "review/flows/11-workbench-resume.png", + "bytes": 478163, + "sha256": "5e211061048ff891b0121f8064456d7708dc4f05c948486f5b7f7cf7ad64f78d", + "source_sha256": "5e211061048ff891b0121f8064456d7708dc4f05c948486f5b7f7cf7ad64f78d", + "content_changed_for_archive": false + }, + { + "path": "review/flows/12-workbench-task-states.png", + "bytes": 428352, + "sha256": "79e0385c6d95ffa23f015cc9354bef0a0dcea2196c4a36368fde7ddcfd02f0a4", + "source_sha256": "79e0385c6d95ffa23f015cc9354bef0a0dcea2196c4a36368fde7ddcfd02f0a4", + "content_changed_for_archive": false + }, + { + "path": "review/manifest.json", + "bytes": 28133, + "sha256": "8f5c670468a636f7954dc73f0d49fd0dc480cdf9dbbde66d4ee55552eceec120", + "source_sha256": "8f5c670468a636f7954dc73f0d49fd0dc480cdf9dbbde66d4ee55552eceec120", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/baseline-audit.md", + "bytes": 12683, + "sha256": "c9875123a6f0887b948e61d6750b19d42908282935428136aacd35bb03e2929e", + "source_sha256": "c3c1293d21627d6959c36de695a18ef30189b13075d36e718704154c5240605f", + "content_changed_for_archive": true + }, + { + "path": "review/product-comparison/current-baseline.md", + "bytes": 17824, + "sha256": "391a9364fe52e35085c0bac89ec71fe0fcc4ab8a0c5799971a8f4fdc38d3c254", + "source_sha256": "291839af2e2f57047f9c1b23d9de3a9fe123e9ad18bd677b2fcbf84c0a4ecbd4", + "content_changed_for_archive": true + }, + { + "path": "review/product-comparison/evidence/01-workbench-state-menu.txt", + "bytes": 4396, + "sha256": "2097b0646feee7434237f8f67f3c151a1ebc646bff440b254d2b5118e6a7fdae", + "source_sha256": "2097b0646feee7434237f8f67f3c151a1ebc646bff440b254d2b5118e6a7fdae", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/02-workbench-busy.png", + "bytes": 361714, + "sha256": "9b3b71ee0c04ab4d61b1ff075b2eb046812aa61a1da0d963a8eb7b52137cace1", + "source_sha256": "9b3b71ee0c04ab4d61b1ff075b2eb046812aa61a1da0d963a8eb7b52137cace1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/02-workbench-busy.txt", + "bytes": 6424, + "sha256": "5e1cad719e4e0cf89ca6d56723f7008fc7e8df74f417148fee2918988f547c5a", + "source_sha256": "5e1cad719e4e0cf89ca6d56723f7008fc7e8df74f417148fee2918988f547c5a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/03-workbench-menu.txt", + "bytes": 4396, + "sha256": "a6ec0a2528b4811d5c8ff045f5b7a9079fb35aba35aea302f9913f0b7f4f9b7c", + "source_sha256": "a6ec0a2528b4811d5c8ff045f5b7a9079fb35aba35aea302f9913f0b7f4f9b7c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/03a-refreshed-browser-state.txt", + "bytes": 3123, + "sha256": "29dc00c9c91766393023ed28d853f6ed901bea83021aa0cb6c155da3362498b1", + "source_sha256": "29dc00c9c91766393023ed28d853f6ed901bea83021aa0cb6c155da3362498b1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/04-workbench-disconnected.txt", + "bytes": 3126, + "sha256": "d3f50c3dd6843d14ca68b63bf9ace44dc1a15170a93f9e0208871ed769c22239", + "source_sha256": "d3f50c3dd6843d14ca68b63bf9ace44dc1a15170a93f9e0208871ed769c22239", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight/F01-prepare-current.txt", + "bytes": 3740, + "sha256": "109d8534da5150d8f1a10d33ddf8cb52b59d5b4902d848e7e0808e6c6ebaa334", + "source_sha256": "109d8534da5150d8f1a10d33ddf8cb52b59d5b4902d848e7e0808e6c6ebaa334", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight/F02-summon-after.txt", + "bytes": 2873, + "sha256": "aa59f246479acae2bb73f2ede0558748f65a26d4f81b41c40871ff4aba5f7c44", + "source_sha256": "aa59f246479acae2bb73f2ede0558748f65a26d4f81b41c40871ff4aba5f7c44", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F01-preparation.txt", + "bytes": 3728, + "sha256": "08c784fa3cc6b527ac5da27e18e0650521f3944bf8c923b6facca714969c1910", + "source_sha256": "08c784fa3cc6b527ac5da27e18e0650521f3944bf8c923b6facca714969c1910", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F02-preparation-menu.txt", + "bytes": 4176, + "sha256": "1f1ddc4fff1b23275e78f077b6ec1ba254fc883e951627ce8ccffcc5c4719d28", + "source_sha256": "1f1ddc4fff1b23275e78f077b6ec1ba254fc883e951627ce8ccffcc5c4719d28", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F03-prep-occupied.txt", + "bytes": 3721, + "sha256": "dfacb5972eb46803091dcd04fe369bf84597360d343f0c0002d1147fae82851d", + "source_sha256": "dfacb5972eb46803091dcd04fe369bf84597360d343f0c0002d1147fae82851d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F04-prep-disconnected.txt", + "bytes": 3694, + "sha256": "aa135413cac5d6ee3e21ac2be8dd167714da52d12638946a5b82ec2de4014c2f", + "source_sha256": "aa135413cac5d6ee3e21ac2be8dd167714da52d12638946a5b82ec2de4014c2f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F05-prep-nosignal.txt", + "bytes": 3713, + "sha256": "e77ef6f43b01e7dfb6d59e521e9a742d498aac5f58af92a170837a32531b8bdd", + "source_sha256": "e77ef6f43b01e7dfb6d59e521e9a742d498aac5f58af92a170837a32531b8bdd", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F06-prep-lowbattery.txt", + "bytes": 3724, + "sha256": "35f27df97872e889f6befd334758bfc04020316aad906a1d274dcdc1f9266630", + "source_sha256": "35f27df97872e889f6befd334758bfc04020316aad906a1d274dcdc1f9266630", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F07-prep-unknown.txt", + "bytes": 3703, + "sha256": "1cc0aa3c95a2c6d580ba9fcfdbf85e92eef173fa80ced6d2e541105c94d26fc1", + "source_sha256": "1cc0aa3c95a2c6d580ba9fcfdbf85e92eef173fa80ced6d2e541105c94d26fc1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F08-prep-outofrange.txt", + "bytes": 3718, + "sha256": "e1077e602a95f3b3c56616c78db680d59c0fded2ddc531b20e575d66271af8d4", + "source_sha256": "e1077e602a95f3b3c56616c78db680d59c0fded2ddc531b20e575d66271af8d4", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F09-prep-noroutes.txt", + "bytes": 3313, + "sha256": "f39aeced70c1ff85837aa6101e85bc27c6204f0e8b55cbf567367fa0a4a0e8c1", + "source_sha256": "f39aeced70c1ff85837aa6101e85bc27c6204f0e8b55cbf567367fa0a4a0e8c1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F10-prep-zeroquota.txt", + "bytes": 3319, + "sha256": "02b19264648c101b452616b9029bf22902f340916d6704a384e0bd8cb5370fa5", + "source_sha256": "02b19264648c101b452616b9029bf22902f340916d6704a384e0bd8cb5370fa5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F11-prep-restored.txt", + "bytes": 3728, + "sha256": "514b83b096ea99b0117e46950d9897c7cd339736ad26cd592c8ecc4b62254994", + "source_sha256": "514b83b096ea99b0117e46950d9897c7cd339736ad26cd592c8ecc4b62254994", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F12-prep-switched-point.txt", + "bytes": 3472, + "sha256": "44b4b7e1409d0b013706326ddbd8dda315b05316f4c0717c6121f49b4d101521", + "source_sha256": "44b4b7e1409d0b013706326ddbd8dda315b05316f4c0717c6121f49b4d101521", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F13-prep-return-first-point.txt", + "bytes": 3737, + "sha256": "066083506a9a9193a35b34cf0021c1ad7df82500c9a3170dda79254d9a4dd453", + "source_sha256": "066083506a9a9193a35b34cf0021c1ad7df82500c9a3170dda79254d9a4dd453", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F14-prep-choice-memory.txt", + "bytes": 3472, + "sha256": "f16f193dcea8672cb076d1be439ffe9d3f909ab146ba7dc32eee6cff9294969d", + "source_sha256": "f16f193dcea8672cb076d1be439ffe9d3f909ab146ba7dc32eee6cff9294969d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F15-summon-actual.txt", + "bytes": 2596, + "sha256": "302eb876d08c886db24baf4a36e54c6df2296e3bacb9f2f44bc87ccbd0caf0ca", + "source_sha256": "302eb876d08c886db24baf4a36e54c6df2296e3bacb9f2f44bc87ccbd0caf0ca", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F16-task-menu.txt", + "bytes": 3131, + "sha256": "fb0e88949544ec4b1c95ec5cf6446a2a5aa74239c2faadd5ec7b001eca819c82", + "source_sha256": "fb0e88949544ec4b1c95ec5cf6446a2a5aa74239c2faadd5ec7b001eca819c82", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F17-task-arrived-preview.txt", + "bytes": 2596, + "sha256": "302eb876d08c886db24baf4a36e54c6df2296e3bacb9f2f44bc87ccbd0caf0ca", + "source_sha256": "302eb876d08c886db24baf4a36e54c6df2296e3bacb9f2f44bc87ccbd0caf0ca", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F18-pause-action.txt", + "bytes": 2590, + "sha256": "eebf87120c87d1d36d0cca8de841fb4ef9e79a641ac934e3fcf1707b2eeaf9ed", + "source_sha256": "eebf87120c87d1d36d0cca8de841fb4ef9e79a641ac934e3fcf1707b2eeaf9ed", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F19-resume-action.txt", + "bytes": 2596, + "sha256": "a20cc6506fd0a0075c07f8130130986c1709294db4d02ffecd1dfdca9d821d37", + "source_sha256": "a20cc6506fd0a0075c07f8130130986c1709294db4d02ffecd1dfdca9d821d37", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F20-shoot-action.txt", + "bytes": 2587, + "sha256": "b54ad3c1013afe96875bbbd9fe7d29add9b303843f3387f370351403e4bb3488", + "source_sha256": "b54ad3c1013afe96875bbbd9fe7d29add9b303843f3387f370351403e4bb3488", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F21-shoot-autoprogress.txt", + "bytes": 2816, + "sha256": "a60fc06767a6a6cbd8ceccfc5fadc8904a3e5c03f7b110240fc0abe4a08023bb", + "source_sha256": "a60fc06767a6a6cbd8ceccfc5fadc8904a3e5c03f7b110240fc0abe4a08023bb", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F22-success-still-returning.txt", + "bytes": 2655, + "sha256": "adf05e17b5c083cf44d7a041e9cd5cbd7d9a25515307f10e37fb309c33a38027", + "source_sha256": "adf05e17b5c083cf44d7a041e9cd5cbd7d9a25515307f10e37fb309c33a38027", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F23-complete-preview.txt", + "bytes": 2611, + "sha256": "ca6145a780e10ad7549b7b241898f1eaca5080b9eefd13c86e06a35c25877938", + "source_sha256": "ca6145a780e10ad7549b7b241898f1eaca5080b9eefd13c86e06a35c25877938", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F24-return-workbench-zero.txt", + "bytes": 2830, + "sha256": "a5021a78dbef4eb56cc93e7aea33a75c50034f350d2d812fb437325c2a957a68", + "source_sha256": "a5021a78dbef4eb56cc93e7aea33a75c50034f350d2d812fb437325c2a957a68", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F25-workbench-after-zero.txt", + "bytes": 3497, + "sha256": "1493a2199e6a2b69c443d3b14f576eb94e811f2cec3f8fe91d7fff772d7960b5", + "source_sha256": "1493a2199e6a2b69c443d3b14f576eb94e811f2cec3f8fe91d7fff772d7960b5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F26-home-zero-returning.png", + "bytes": 39775, + "sha256": "50049ee517931b274d91fbe01e3bdda683d1597ebc94ab4799fe0137ac1e3c04", + "source_sha256": "50049ee517931b274d91fbe01e3bdda683d1597ebc94ab4799fe0137ac1e3c04", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F26-home-zero-returning.txt", + "bytes": 2012, + "sha256": "0a84464b51ffba5ee86e7a7c8627fd1111985276b63e65e93a7b14d6a59192a2", + "source_sha256": "0a84464b51ffba5ee86e7a7c8627fd1111985276b63e65e93a7b14d6a59192a2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F27-orders-zero.txt", + "bytes": 6103, + "sha256": "c5b061296989512d3abdfc57799c63763cd9de9dd7c64c9698c6d0d81f595d23", + "source_sha256": "c5b061296989512d3abdfc57799c63763cd9de9dd7c64c9698c6d0d81f595d23", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F28-completed-task-entry.txt", + "bytes": 3813, + "sha256": "046c4cf9df95b067db3a7316fe826e28de4599ebed62dbb2d6dde941b3d9efb8", + "source_sha256": "046c4cf9df95b067db3a7316fe826e28de4599ebed62dbb2d6dde941b3d9efb8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F29-resumed-completed-task.txt", + "bytes": 3216, + "sha256": "39d5120eb25ad69c6631858c4126d5de3001f9886fbe574ab60300d403eccf86", + "source_sha256": "39d5120eb25ad69c6631858c4126d5de3001f9886fbe574ab60300d403eccf86", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F30-menu-result.png", + "bytes": 48518, + "sha256": "b0b5249d0a304746d241beb683a667325f1aac5b635df6face3c98b6afd06865", + "source_sha256": "b0b5249d0a304746d241beb683a667325f1aac5b635df6face3c98b6afd06865", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F30-task-hover.txt", + "bytes": 3972, + "sha256": "744e974e89249f4fcebd43c2f48836d1181d99ea0b38e4a0c6b8926018d49378", + "source_sha256": "744e974e89249f4fcebd43c2f48836d1181d99ea0b38e4a0c6b8926018d49378", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F30-task-returning.txt", + "bytes": 3983, + "sha256": "7a0c5cf2fcdec5b23d2bc8863a6128614a592454bb6588d2aeb51e691f4e5b26", + "source_sha256": "7a0c5cf2fcdec5b23d2bc8863a6128614a592454bb6588d2aeb51e691f4e5b26", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F30-task-shooting.txt", + "bytes": 3969, + "sha256": "ca456021034503948f062ad56c5a9e077c7933ef2fee2750cec5984d3be9dd37", + "source_sha256": "ca456021034503948f062ad56c5a9e077c7933ef2fee2750cec5984d3be9dd37", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F31-task-failed-ready.txt", + "bytes": 4099, + "sha256": "1b6ab7b31e69c34b98455c0551e579264a45d5feead7eb5271532b917c781820", + "source_sha256": "1b6ab7b31e69c34b98455c0551e579264a45d5feead7eb5271532b917c781820", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F31-task-failed-returning.txt", + "bytes": 4070, + "sha256": "479e80be977c49a9f6877e78d208ccd40bf4521da6a9a202c53850dba2586bf5", + "source_sha256": "479e80be977c49a9f6877e78d208ccd40bf4521da6a9a202c53850dba2586bf5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F31-task-feed-lost.txt", + "bytes": 4067, + "sha256": "a9139f60541dfa33ab7a449b447878a846a035f96104fdd3ae66292ad1bb30b0", + "source_sha256": "a9139f60541dfa33ab7a449b447878a846a035f96104fdd3ae66292ad1bb30b0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F32-feed-reconnect.txt", + "bytes": 3198, + "sha256": "dcf9d4ef3d721ad23838abb32f426c556d53575059ec630cee4cbcc6bededa39", + "source_sha256": "dcf9d4ef3d721ad23838abb32f426c556d53575059ec630cee4cbcc6bededa39", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F33-task-command-timeout.txt", + "bytes": 3974, + "sha256": "7e1ca8ca7ae96b3db8064797685da7ae8479f465501aedcc418950a08c3b1a84", + "source_sha256": "7e1ca8ca7ae96b3db8064797685da7ae8479f465501aedcc418950a08c3b1a84", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F33-task-phone-offline.txt", + "bytes": 4156, + "sha256": "32803c15f5c59c76f33013bcff769f064a12e492e5b908131aad809ea6f6a4b3", + "source_sha256": "32803c15f5c59c76f33013bcff769f064a12e492e5b908131aad809ea6f6a4b3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F33-task-protective-return.txt", + "bytes": 4001, + "sha256": "5a0f25ca9aa8308d49e9209721e8d0b72448fce9c31e8c6c7d1acdc909c1ead9", + "source_sha256": "5a0f25ca9aa8308d49e9209721e8d0b72448fce9c31e8c6c7d1acdc909c1ead9", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F34-command-unknown.txt", + "bytes": 3446, + "sha256": "1cb5ce7e94943b23a7e7ab213c5db955b20c8ed2ae1bc0c96ff2d2c427b7289d", + "source_sha256": "1cb5ce7e94943b23a7e7ab213c5db955b20c8ed2ae1bc0c96ff2d2c427b7289d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F35-command-refresh.txt", + "bytes": 3198, + "sha256": "dcf9d4ef3d721ad23838abb32f426c556d53575059ec630cee4cbcc6bededa39", + "source_sha256": "dcf9d4ef3d721ad23838abb32f426c556d53575059ec630cee4cbcc6bededa39", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F36-post-refresh-result.txt", + "bytes": 3450, + "sha256": "5bced75284fc2a58c3f033395c4062392c9e6b2c02aaf23737f876b67b7ee958", + "source_sha256": "5bced75284fc2a58c3f033395c4062392c9e6b2c02aaf23737f876b67b7ee958", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F37-failure-dialog.txt", + "bytes": 3475, + "sha256": "6b429dcf514d6105acebe9cfb230dd9f385be5831ce0a2e6641c249861bd4145", + "source_sha256": "6b429dcf514d6105acebe9cfb230dd9f385be5831ce0a2e6641c249861bd4145", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F38-success-dialog-preview.txt", + "bytes": 3421, + "sha256": "b2ab2be98dbb9127e2cf28405bae3a884fefbc5731dc69a5c2de4d51b890d655", + "source_sha256": "b2ab2be98dbb9127e2cf28405bae3a884fefbc5731dc69a5c2de4d51b890d655", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F39-reset-scenario.txt", + "bytes": 1981, + "sha256": "d3f8942adba3148eb01e455ab327e7d59bfbce1fefe27ad38d9c546f223c0985", + "source_sha256": "d3f8942adba3148eb01e455ab327e7d59bfbce1fefe27ad38d9c546f223c0985", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F40-package-prep.txt", + "bytes": 3740, + "sha256": "f0e797aed9156ed305a3d846f7ffe0365165b98a34fa6b8e3ef9686234acd969", + "source_sha256": "f0e797aed9156ed305a3d846f7ffe0365165b98a34fa6b8e3ef9686234acd969", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F41-package-arrived.txt", + "bytes": 2873, + "sha256": "45c19afd4aa8e419fbd11bd3f139552252b617d7195de38ed1913b4c0662739a", + "source_sha256": "45c19afd4aa8e419fbd11bd3f139552252b617d7195de38ed1913b4c0662739a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F42-failed-ready-nonzero.txt", + "bytes": 3028, + "sha256": "112e4ae3188df65a7cd6d5351b52369e6175632fd0b7c99e09b0ed6f85a24b88", + "source_sha256": "112e4ae3188df65a7cd6d5351b52369e6175632fd0b7c99e09b0ed6f85a24b88", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F43-retry-destination.txt", + "bytes": 3332, + "sha256": "da9d838305912a891576c760a871420c24549459e717261470f76077edfb055a", + "source_sha256": "da9d838305912a891576c760a871420c24549459e717261470f76077edfb055a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F44-summon-immediate.txt", + "bytes": 2873, + "sha256": "3a5f24a9012134001ed267514a73708b99c4f56a7a6e865b80a6a424aa5c0613", + "source_sha256": "3a5f24a9012134001ed267514a73708b99c4f56a7a6e865b80a6a424aa5c0613", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F45-return-confirm.txt", + "bytes": 2977, + "sha256": "58140afa62643ec6fc219ed02b107d958f0d8caa4f60e24d656fc671417af822", + "source_sha256": "58140afa62643ec6fc219ed02b107d958f0d8caa4f60e24d656fc671417af822", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F46-return-preview.txt", + "bytes": 2881, + "sha256": "5607011ad48c748404203c6ae419c7cd2ee997a389a9f0fc2d7fefcc7601dab8", + "source_sha256": "5607011ad48c748404203c6ae419c7cd2ee997a389a9f0fc2d7fefcc7601dab8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F47-return-paused.txt", + "bytes": 2904, + "sha256": "d67a6197170f642dcaee94ee4cc060cd930a48d99e7222e98c374f3c1a0a3d53", + "source_sha256": "d67a6197170f642dcaee94ee4cc060cd930a48d99e7222e98c374f3c1a0a3d53", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F48-return-pause-confirmed.txt", + "bytes": 2867, + "sha256": "59feadfc7601b28b3b5971f8d26bbb811cfc1e49b712cc6be36bd8b3aacf4d25", + "source_sha256": "59feadfc7601b28b3b5971f8d26bbb811cfc1e49b712cc6be36bd8b3aacf4d25", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F49-return-resume-pending.txt", + "bytes": 2948, + "sha256": "a0be56254674132b4fb27a15fea5f26bc9f5cf27d6b3bb40227e0c68413cf176", + "source_sha256": "a0be56254674132b4fb27a15fea5f26bc9f5cf27d6b3bb40227e0c68413cf176", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F50-return-resume-confirmed.txt", + "bytes": 2977, + "sha256": "bd574467815f1a366298d148ecebe631a859780e7e3062ee9e5df014dd252239", + "source_sha256": "bd574467815f1a366298d148ecebe631a859780e7e3062ee9e5df014dd252239", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F51-active-A.txt", + "bytes": 2873, + "sha256": "682b6132a914e42b1d0d3a68602719a9a1e234155a4a567525cd8ff33848286b", + "source_sha256": "682b6132a914e42b1d0d3a68602719a9a1e234155a4a567525cd8ff33848286b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F52-leave-A-confirm.txt", + "bytes": 3092, + "sha256": "628fd034aa2a9f37bda68878d672a7d1a17512bbbb3eba7d9c3c9716f9b95eb2", + "source_sha256": "628fd034aa2a9f37bda68878d672a7d1a17512bbbb3eba7d9c3c9716f9b95eb2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F53-left-A-to-prep.txt", + "bytes": 3329, + "sha256": "0ff6fbe5f308d71e13afe1040636b1c868ba5d0c4b7d1ddf1cde7d191f4baf32", + "source_sha256": "0ff6fbe5f308d71e13afe1040636b1c868ba5d0c4b7d1ddf1cde7d191f4baf32", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F54-home-A-active.txt", + "bytes": 3028, + "sha256": "92d485c3dd16102310943b01d63b4d9405d64ba4e403215905fb31fcaf21f3ad", + "source_sha256": "92d485c3dd16102310943b01d63b4d9405d64ba4e403215905fb31fcaf21f3ad", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F55-reset-for-third.txt", + "bytes": 1981, + "sha256": "ae3d9ab43a2aaf240ff7fc3cfe95b639c6699c0ca6840c2d8128055c73574c00", + "source_sha256": "ae3d9ab43a2aaf240ff7fc3cfe95b639c6699c0ca6840c2d8128055c73574c00", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F56-third-prep.txt", + "bytes": 3734, + "sha256": "f5c8ca49e8506bd3b87cb62a7e0f83e2973d3051e3d5bbbcc02f8bf6d6769c79", + "source_sha256": "f5c8ca49e8506bd3b87cb62a7e0f83e2973d3051e3d5bbbcc02f8bf6d6769c79", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F57-prep-idle-preview.txt", + "bytes": 3734, + "sha256": "f5c8ca49e8506bd3b87cb62a7e0f83e2973d3051e3d5bbbcc02f8bf6d6769c79", + "source_sha256": "f5c8ca49e8506bd3b87cb62a7e0f83e2973d3051e3d5bbbcc02f8bf6d6769c79", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F58-third-arrived.txt", + "bytes": 2867, + "sha256": "efb5f5c3b60998aff24c8aa75ff347788bfea41b102626883a296835e03b8cbc", + "source_sha256": "efb5f5c3b60998aff24c8aa75ff347788bfea41b102626883a296835e03b8cbc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F59-third-leave-confirm.txt", + "bytes": 3086, + "sha256": "b4d0fd130d02d90bd7c5f239042667028756db570de975246591ce71c67d63ce", + "source_sha256": "b4d0fd130d02d90bd7c5f239042667028756db570de975246591ce71c67d63ce", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F60-third-left-prep.txt", + "bytes": 3740, + "sha256": "d4407ac71b00e2be4d7ce99d2620ed89d22e058950494bdbf5d8e4fa807e537e", + "source_sha256": "d4407ac71b00e2be4d7ce99d2620ed89d22e058950494bdbf5d8e4fa807e537e", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F61-home-third-active.png", + "bytes": 39111, + "sha256": "a5cbbfc277f8cae94431d845bd0fada8dc2a2c8b4203e311e2cdcb7b87d3112c", + "source_sha256": "a5cbbfc277f8cae94431d845bd0fada8dc2a2c8b4203e311e2cdcb7b87d3112c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F61-home-third-active.txt", + "bytes": 1990, + "sha256": "b598366f9a97565fb1d4367858b005d3a3ae1e855a02f02c3a062aa55ac566f3", + "source_sha256": "b598366f9a97565fb1d4367858b005d3a3ae1e855a02f02c3a062aa55ac566f3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F62-B-prep-A-active.txt", + "bytes": 3739, + "sha256": "a26dcfb80a57b356b11a2ca7a30305a2bdcb6dae5f32d1b70a73cac6a4ad745a", + "source_sha256": "a26dcfb80a57b356b11a2ca7a30305a2bdcb6dae5f32d1b70a73cac6a4ad745a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/flight2/F63-B-change-route-occupied.txt", + "bytes": 3748, + "sha256": "48880583a9fe65b48f5ffd22f63ef5c4b1cbcb831de08829fc0d2670c3fb83b1", + "source_sha256": "48880583a9fe65b48f5ffd22f63ef5c4b1cbcb831de08829fc0d2670c3fb83b1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/iab/P00-workbench-normal.txt", + "bytes": 1982, + "sha256": "6a9c28cf6d2e38215ecf9f0b91f720fbf19e41a6ed447e8a3f9411612cf0ce43", + "source_sha256": "6a9c28cf6d2e38215ecf9f0b91f720fbf19e41a6ed447e8a3f9411612cf0ce43", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M01-orders-all.txt", + "bytes": 6044, + "sha256": "73672a63f8577e1fc29b8bd6d03317301f3bbf70dc2c48872c04bd04c57050b8", + "source_sha256": "73672a63f8577e1fc29b8bd6d03317301f3bbf70dc2c48872c04bd04c57050b8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M02-orders-pending.txt", + "bytes": 3373, + "sha256": "cf57ec6e975ed1c8f9b3990b63d9898ae867d6b19a9d20fff1c415bf847667cc", + "source_sha256": "cf57ec6e975ed1c8f9b3990b63d9898ae867d6b19a9d20fff1c415bf847667cc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M03-orders-progress.txt", + "bytes": 3694, + "sha256": "07d8544e578ec0cd63651159f36bda64efb5c4ea2827485e2ec03409fea806dd", + "source_sha256": "07d8544e578ec0cd63651159f36bda64efb5c4ea2827485e2ec03409fea806dd", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M04-orders-complete.txt", + "bytes": 3471, + "sha256": "d6216d06eb2df1f0e641517104cb684b0702392292ad9159d591f3a6b5800cf3", + "source_sha256": "d6216d06eb2df1f0e641517104cb684b0702392292ad9159d591f3a6b5800cf3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M05-orders-state-menu.txt", + "bytes": 3794, + "sha256": "47bf0e54c8aa663ac3428878e64e1e3ba2e6a4692f4e313d3f291dc1928fded8", + "source_sha256": "47bf0e54c8aa663ac3428878e64e1e3ba2e6a4692f4e313d3f291dc1928fded8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M06-orders-empty.txt", + "bytes": 1603, + "sha256": "dd98cea6c829a6b0b5fbcc45ebe3dd76840434d434d62e3629e6fe91196d2bea", + "source_sha256": "dd98cea6c829a6b0b5fbcc45ebe3dd76840434d434d62e3629e6fe91196d2bea", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M07-orders-empty-all.txt", + "bytes": 1600, + "sha256": "b43fea21e08152476a23dd73de4e0228907f34d65ab9e4d37227023d9ec40804", + "source_sha256": "b43fea21e08152476a23dd73de4e0228907f34d65ab9e4d37227023d9ec40804", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M08-orders-restored.txt", + "bytes": 6044, + "sha256": "0bbb56fe365528ef64585ffeb2c662c97e085c8f270f4f5f2ed4ec95650a9890", + "source_sha256": "0bbb56fe365528ef64585ffeb2c662c97e085c8f270f4f5f2ed4ec95650a9890", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M09-materials-entry.txt", + "bytes": 6787, + "sha256": "26569764fdb784a93eb584307fbbc5812b66b477ba94e3fec629458c2d06bae6", + "source_sha256": "26569764fdb784a93eb584307fbbc5812b66b477ba94e3fec629458c2d06bae6", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M10-materials-state-menu.txt", + "bytes": 6890, + "sha256": "f1808fb3a343fa776329315ee380e6405edeca9f85f51e7110ca733543ad1ec1", + "source_sha256": "f1808fb3a343fa776329315ee380e6405edeca9f85f51e7110ca733543ad1ec1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M11-uploading.txt", + "bytes": 6343, + "sha256": "d911b82040d1ebe6cf2fa92ac450111b46a370058b06437044b98ba5bab0a1cf", + "source_sha256": "d911b82040d1ebe6cf2fa92ac450111b46a370058b06437044b98ba5bab0a1cf", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M12-upload-failed.txt", + "bytes": 6826, + "sha256": "ddcef4e4f7985bf25c10d02b8a59bd3fb11c06bb5933df2e71d41e62f32dc998", + "source_sha256": "ddcef4e4f7985bf25c10d02b8a59bd3fb11c06bb5933df2e71d41e62f32dc998", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M13-upload-failed-visible.txt", + "bytes": 6562, + "sha256": "428a8eaa5a1af03d970e1fef3f9c81e079310815ebfff74aeecbd870984cfd11", + "source_sha256": "428a8eaa5a1af03d970e1fef3f9c81e079310815ebfff74aeecbd870984cfd11", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M14-upload-retry.txt", + "bytes": 6597, + "sha256": "39cc3adadbcc81e4ea09ddde971acec919958df8d0f94ec0b5d907798ada2db6", + "source_sha256": "39cc3adadbcc81e4ea09ddde971acec919958df8d0f94ec0b5d907798ada2db6", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M15-select-eligible-only.txt", + "bytes": 6615, + "sha256": "d62f86149dabd879791ea54f863ce1263bc46aed648d93d4731ee78f0ca9985b", + "source_sha256": "d62f86149dabd879791ea54f863ce1263bc46aed648d93d4731ee78f0ca9985b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M16-preview.txt", + "bytes": 6208, + "sha256": "58a430a473696cfd642bef2d4da23ba19a78d92f6206bce9be00ac558e311ff3", + "source_sha256": "58a430a473696cfd642bef2d4da23ba19a78d92f6206bce9be00ac558e311ff3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M17-download-normal.txt", + "bytes": 6687, + "sha256": "e7762fae4d089a1ac7c526137bcf807a17be5f5b0ccb1b1d21c1716f1792f60f", + "source_sha256": "e7762fae4d089a1ac7c526137bcf807a17be5f5b0ccb1b1d21c1716f1792f60f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M18-素材上传完成.txt", + "bytes": 6833, + "sha256": "9a05bfce8b98dc301f055391b9edefe7ee5b20dbb2fc32f7ca937d95000eb45f", + "source_sha256": "9a05bfce8b98dc301f055391b9edefe7ee5b20dbb2fc32f7ca937d95000eb45f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M19-未选择素材.txt", + "bytes": 6833, + "sha256": "9a05bfce8b98dc301f055391b9edefe7ee5b20dbb2fc32f7ca937d95000eb45f", + "source_sha256": "9a05bfce8b98dc301f055391b9edefe7ee5b20dbb2fc32f7ca937d95000eb45f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M20-已选择素材.txt", + "bytes": 6842, + "sha256": "17edcab3a656bf24f6769d6472b94023b8bbceadcb5848de07679fb21953505e", + "source_sha256": "17edcab3a656bf24f6769d6472b94023b8bbceadcb5848de07679fb21953505e", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M21-下载中.txt", + "bytes": 7041, + "sha256": "d1ad30c77f4d17fac9b14138fd415e9728aaba2271f789000927ebb00a53f28a", + "source_sha256": "d1ad30c77f4d17fac9b14138fd415e9728aaba2271f789000927ebb00a53f28a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M22-download-back-confirm.txt", + "bytes": 6588, + "sha256": "069827e4738a5882973ce03fc888288238d6f805008bdb659a5d33c80659187b", + "source_sha256": "069827e4738a5882973ce03fc888288238d6f805008bdb659a5d33c80659187b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M23-leave-cancel-continue.txt", + "bytes": 7041, + "sha256": "d1ad30c77f4d17fac9b14138fd415e9728aaba2271f789000927ebb00a53f28a", + "source_sha256": "d1ad30c77f4d17fac9b14138fd415e9728aaba2271f789000927ebb00a53f28a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M24-下载完成.txt", + "bytes": 6971, + "sha256": "e5d998ce2a0826503e89e1bc701d2ff134bd4e7892b3d48a1afb87b798b86714", + "source_sha256": "e5d998ce2a0826503e89e1bc701d2ff134bd4e7892b3d48a1afb87b798b86714", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M25-下载失败.txt", + "bytes": 7056, + "sha256": "4cc2bc2c8e8c98499ab5f0405ffd955666e4d0b0b73c153fa13dbea4bb9f6e6e", + "source_sha256": "4cc2bc2c8e8c98499ab5f0405ffd955666e4d0b0b73c153fa13dbea4bb9f6e6e", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M26-重试中.txt", + "bytes": 7041, + "sha256": "e7881d110a910fd277b8ab463750f3764edb97554ec28aed2e8d403dd721fa90", + "source_sha256": "e7881d110a910fd277b8ab463750f3764edb97554ec28aed2e8d403dd721fa90", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M27-leave-preview.txt", + "bytes": 6588, + "sha256": "918a74ab17725be2e887d4b88053612fb215a671568c67d3ca28eed5a48ef12f", + "source_sha256": "918a74ab17725be2e887d4b88053612fb215a671568c67d3ca28eed5a48ef12f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M28-leave-confirmed.txt", + "bytes": 6050, + "sha256": "8a113e690558f2ad45a349c23de90568eb3515bd4d9d14cfeaff56d48f3ef5e3", + "source_sha256": "8a113e690558f2ad45a349c23de90568eb3515bd4d9d14cfeaff56d48f3ef5e3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M29-materials-reenter.txt", + "bytes": 6837, + "sha256": "ff3a4f5820154aa663f05250ac639e55d3e276c9add830976a9484d6e4b5c44c", + "source_sha256": "ff3a4f5820154aa663f05250ac639e55d3e276c9add830976a9484d6e4b5c44c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M30-photo-permission.txt", + "bytes": 6537, + "sha256": "a0970238d782f20ca1f86ecbbb25784842bccb9b6d1e3ea2eec129d7655f06ef", + "source_sha256": "a0970238d782f20ca1f86ecbbb25784842bccb9b6d1e3ea2eec129d7655f06ef", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M31-photo-settings-return.txt", + "bytes": 6842, + "sha256": "03b9700be3a33513d3baed7bcdfc163c274826dd478ca45cff713e5b8d23132c", + "source_sha256": "03b9700be3a33513d3baed7bcdfc163c274826dd478ca45cff713e5b8d23132c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M32-failure-before-retry.txt", + "bytes": 7056, + "sha256": "2b41f55ed12f1d223988807a8a5e49a075d0bcdede60be83b9a602384193216f", + "source_sha256": "2b41f55ed12f1d223988807a8a5e49a075d0bcdede60be83b9a602384193216f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M33-retry-failed-result.txt", + "bytes": 6971, + "sha256": "4c0bf7204ec6690afcd95fa49117265e2c6f3cf48d3cdde4b7ee21712a6c8323", + "source_sha256": "4c0bf7204ec6690afcd95fa49117265e2c6f3cf48d3cdde4b7ee21712a6c8323", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M34-filter-point.txt", + "bytes": 5692, + "sha256": "95c937aed9caaf7a5832d15064e50992ce9d5beacddc3f4f400671382be5a499", + "source_sha256": "95c937aed9caaf7a5832d15064e50992ce9d5beacddc3f4f400671382be5a499", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M35-filter-select-all.txt", + "bytes": 5711, + "sha256": "d7546a186086277e050eec8bd0c23ba64365af0c51b33055cb9ccc0b39fa2adc", + "source_sha256": "d7546a186086277e050eec8bd0c23ba64365af0c51b33055cb9ccc0b39fa2adc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M36-filter-switch-selection.txt", + "bytes": 6850, + "sha256": "8880c91c3fcae491c2fc39af27e34ca3810a7b56049ca5fe1baf32ae4ce4e979", + "source_sha256": "8880c91c3fcae491c2fc39af27e34ca3810a7b56049ca5fe1baf32ae4ce4e979", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M37-refresh-uploading.txt", + "bytes": 6842, + "sha256": "af1ad9d6d60cd121b3470a5674d3c84682b128ee7a3b9a8785ccb234e13bdd2e", + "source_sha256": "af1ad9d6d60cd121b3470a5674d3c84682b128ee7a3b9a8785ccb234e13bdd2e", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M38-select-one.txt", + "bytes": 6841, + "sha256": "94c4468216bcb5bf1a3dfb8926274626e8b08165f595ac7b419542d66d21b40d", + "source_sha256": "94c4468216bcb5bf1a3dfb8926274626e8b08165f595ac7b419542d66d21b40d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M39-select-toggle-off.txt", + "bytes": 6842, + "sha256": "f6f0e73f22bd3e2ec6659abe3eee7f4ae40b398e60d9fe4e1c8c9fa22926d519", + "source_sha256": "f6f0e73f22bd3e2ec6659abe3eee7f4ae40b398e60d9fe4e1c8c9fa22926d519", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M40-download-failure.png", + "bytes": 40572, + "sha256": "7716c8a3267c342ef8f1962359931e89227e11118d70ca19f754e72e562bba73", + "source_sha256": "7716c8a3267c342ef8f1962359931e89227e11118d70ca19f754e72e562bba73", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M40-final-failure.txt", + "bytes": 7056, + "sha256": "a110878921695c3a100de05e8b243f7bf206c9eb75eca562bea583589c5978f2", + "source_sha256": "a110878921695c3a100de05e8b243f7bf206c9eb75eca562bea583589c5978f2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M41-single-retry.txt", + "bytes": 6971, + "sha256": "c193ec0532f84e6ec3fa4a1957612d2b5953da5173a76f692436da8eb3fc50e6", + "source_sha256": "c193ec0532f84e6ec3fa4a1957612d2b5953da5173a76f692436da8eb3fc50e6", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M42-failure-choose-other.txt", + "bytes": 6870, + "sha256": "34d7c224cbe6a9a7f9596cdd18613baf23495f789a885836e4c2280a7c37ef24", + "source_sha256": "34d7c224cbe6a9a7f9596cdd18613baf23495f789a885836e4c2280a7c37ef24", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M43-permission-cancel.txt", + "bytes": 6842, + "sha256": "fa0e947cc37876d63291e4065d093283bac7e36d25802f9d486edd458200c5ba", + "source_sha256": "fa0e947cc37876d63291e4065d093283bac7e36d25802f9d486edd458200c5ba", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M44-empty-待拍摄.txt", + "bytes": 1612, + "sha256": "9a2118d4afd391180a7c6969a14f97f4432a68457f5579642275ae3ab10a6a86", + "source_sha256": "9a2118d4afd391180a7c6969a14f97f4432a68457f5579642275ae3ab10a6a86", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/materials2/M45-empty-进行中.txt", + "bytes": 1612, + "sha256": "c62ff1180df4b5fba19b90f7c21e718a558c0ff97f9d348aeec66e1847acae74", + "source_sha256": "c62ff1180df4b5fba19b90f7c21e718a558c0ff97f9d348aeec66e1847acae74", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment/PAY01-normal.txt", + "bytes": 2824, + "sha256": "0dd2ea6eaa1e4f4565e5c90f53426f52999cb7a4026310e40cfda2350debd417", + "source_sha256": "0dd2ea6eaa1e4f4565e5c90f53426f52999cb7a4026310e40cfda2350debd417", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P02-package-picker.txt", + "bytes": 3323, + "sha256": "90213a7499699d9548eb7fbbf4426e99f1af8fac5be23ce69b1d27b936bd1f1c", + "source_sha256": "90213a7499699d9548eb7fbbf4426e99f1af8fac5be23ce69b1d27b936bd1f1c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P03-selected-code.txt", + "bytes": 2977, + "sha256": "6b525883c8a58fa25bd428776561259261a90e5c379664464bf59266a68a9c88", + "source_sha256": "6b525883c8a58fa25bd428776561259261a90e5c379664464bf59266a68a9c88", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P04-amount-validation.txt", + "bytes": 3144, + "sha256": "103993bc25ece796fcacaf4533592ee7716d716385e46c64a462eff380aa68c3", + "source_sha256": "103993bc25ece796fcacaf4533592ee7716d716385e46c64a462eff380aa68c3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P05-payment-state-menu.txt", + "bytes": 3543, + "sha256": "d03b899a0999f354fe88ff3a47c4a4efd2e7e136aefdf72e54b94cf802d2b9e4", + "source_sha256": "d03b899a0999f354fe88ff3a47c4a4efd2e7e136aefdf72e54b94cf802d2b9e4", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P06-code-failed.txt", + "bytes": 2921, + "sha256": "faebf11e41c7cd0920cb9c335d79a69c0d40b9c366bd78f0e6870dea28592b2a", + "source_sha256": "faebf11e41c7cd0920cb9c335d79a69c0d40b9c366bd78f0e6870dea28592b2a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P07-code-expired.txt", + "bytes": 2918, + "sha256": "26166dd38b3e0bedbadc835403dbc998b60577c55fb03a43b757b77b8a942713", + "source_sha256": "26166dd38b3e0bedbadc835403dbc998b60577c55fb03a43b757b77b8a942713", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P08-no-packages.txt", + "bytes": 2824, + "sha256": "6fa14689bff80d8d1d38e26c8d8a160bbc6a835f0d1f1ca9602111f9d95f095c", + "source_sha256": "6fa14689bff80d8d1d38e26c8d8a160bbc6a835f0d1f1ca9602111f9d95f095c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P08b-no-packages-picker.txt", + "bytes": 2828, + "sha256": "e97738bbe70908b760ed775043922977f0e317d3f4f97587e6b026d80d7da189", + "source_sha256": "e97738bbe70908b760ed775043922977f0e317d3f4f97587e6b026d80d7da189", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P09-payment-success.txt", + "bytes": 2886, + "sha256": "64f08931ce3e6050f938e652b8c20549719454bcbe66b46cbc32f5e1e5a4c5a6", + "source_sha256": "64f08931ce3e6050f938e652b8c20549719454bcbe66b46cbc32f5e1e5a4c5a6", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P10-payment-orders-default-all.txt", + "bytes": 5724, + "sha256": "6be60e5bde816176aa9611fd93cfb97b564847ef64ec715277a10ac609204bbc", + "source_sha256": "6be60e5bde816176aa9611fd93cfb97b564847ef64ec715277a10ac609204bbc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P11-success.png", + "bytes": 36066, + "sha256": "9087715097bfe99a719129753d89ed5c8434c9574b592f24f0dad5a914bdc414", + "source_sha256": "9087715097bfe99a719129753d89ed5c8434c9574b592f24f0dad5a914bdc414", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P12-continue-payment-reset.txt", + "bytes": 2743, + "sha256": "240ff8098c5b7ad7ac3440ee40981d1f5d9e3f07d7e08bbc77ccb105918ddf30", + "source_sha256": "240ff8098c5b7ad7ac3440ee40981d1f5d9e3f07d7e08bbc77ccb105918ddf30", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P13-payment-records.txt", + "bytes": 1550, + "sha256": "b67d73c8694ee7fb75e2762a8127929cfa54025bc71c1579c0ead3cc2e0c57f1", + "source_sha256": "b67d73c8694ee7fb75e2762a8127929cfa54025bc71c1579c0ead3cc2e0c57f1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P14-refresh-unpaid.txt", + "bytes": 1699, + "sha256": "492a40434d531061e1d54ee3aa3c219a53b676cb38139fcfba1aaf17c8399cf0", + "source_sha256": "492a40434d531061e1d54ee3aa3c219a53b676cb38139fcfba1aaf17c8399cf0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P15-save-qr-simulated.txt", + "bytes": 1699, + "sha256": "8eefcaef02686fe5aeeb605135cfcbadeed96167a8d33b779794475827157c1a", + "source_sha256": "8eefcaef02686fe5aeeb605135cfcbadeed96167a8d33b779794475827157c1a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P16-amount-dialog.txt", + "bytes": 3074, + "sha256": "c85628c1f0ed003330a207d0138539c2009623a8e8c773ab68b51aac67e65bf5", + "source_sha256": "c85628c1f0ed003330a207d0138539c2009623a8e8c773ab68b51aac67e65bf5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P17-adjusted-price-same-quota.txt", + "bytes": 2977, + "sha256": "08ff2ecc51972411ffb6dba2301fcf0cbedc6168f73d8364b4eb23c32b7d7505", + "source_sha256": "08ff2ecc51972411ffb6dba2301fcf0cbedc6168f73d8364b4eb23c32b7d7505", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P18-cancel-change-package.txt", + "bytes": 2977, + "sha256": "f52775e15d0937aa0ab5c24a8e94fea161801afcec70504f4fb3fcdc2bcc6265", + "source_sha256": "f52775e15d0937aa0ab5c24a8e94fea161801afcec70504f4fb3fcdc2bcc6265", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/payment2/P19-confirm-change-package.txt", + "bytes": 2964, + "sha256": "2bedfd3547204d4562e6c9638a135011178cb534d804a0a9c3b3e7873dc3148e", + "source_sha256": "2bedfd3547204d4562e6c9638a135011178cb534d804a0a9c3b3e7873dc3148e", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/无人机占用中.txt", + "bytes": 1984, + "sha256": "a3080369c3a2e312184049d2137158b60d700d683d3670853507e32a16ff1788", + "source_sha256": "a3080369c3a2e312184049d2137158b60d700d683d3670853507e32a16ff1788", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/无人机无信号.txt", + "bytes": 1987, + "sha256": "a14efd17d88953913bd28c8debe2a469a85e8979d66c254c458a0b9d8e89b60a", + "source_sha256": "a14efd17d88953913bd28c8debe2a469a85e8979d66c254c458a0b9d8e89b60a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/暂无拍摄订单.txt", + "bytes": 1286, + "sha256": "820ff8c7c823c73b2a7f1ea47a67aa4be5fe42b6e3c9ad90bc20b6c0bd6c78b7", + "source_sha256": "820ff8c7c823c73b2a7f1ea47a67aa4be5fe42b6e3c9ad90bc20b6c0bd6c78b7", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/机巢未连接.txt", + "bytes": 1971, + "sha256": "57064a95458c36498d79df99db533673a286e9297971910dfcf00aed315ce24d", + "source_sha256": "57064a95458c36498d79df99db533673a286e9297971910dfcf00aed315ce24d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/电量不足.txt", + "bytes": 1984, + "sha256": "5360b18e736830afa61cbe55fa0a124f3980d62bcdd3c5dd3d5779a7c6a8c83d", + "source_sha256": "5360b18e736830afa61cbe55fa0a124f3980d62bcdd3c5dd3d5779a7c6a8c83d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/设备状态未知.txt", + "bytes": 1974, + "sha256": "376335ef6ec59be4f446efff5ab2b9cf02666957b7cf2ad5e505646d4f93495d", + "source_sha256": "376335ef6ec59be4f446efff5ab2b9cf02666957b7cf2ad5e505646d4f93495d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/evidence/workbench2/设备空闲.txt", + "bytes": 1981, + "sha256": "ca6b674002cb7cf8ed36b074176ff3a5ef6c041af8b74ce18da6919d900952d5", + "source_sha256": "ca6b674002cb7cf8ed36b074176ff3a5ef6c041af8b74ce18da6919d900952d5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/flight-verified.md", + "bytes": 11805, + "sha256": "3d41e652a01cd0a0e128c2844412cdc75359bada9baee94b54c5c4bd04f77aa3", + "source_sha256": "3d41e652a01cd0a0e128c2844412cdc75359bada9baee94b54c5c4bd04f77aa3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/materials-verified.md", + "bytes": 12207, + "sha256": "ecf823b2bd16cbc4c20650fd9333b4f42ba14eeb6206aaab8b1d056104551be2", + "source_sha256": "ecf823b2bd16cbc4c20650fd9333b4f42ba14eeb6206aaab8b1d056104551be2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-checklist.md", + "bytes": 6753, + "sha256": "601e079b2630147ffa4b2b582b4a3d042eb5efaa31e6808df30d646cfc4aabd1", + "source_sha256": "601e079b2630147ffa4b2b582b4a3d042eb5efaa31e6808df30d646cfc4aabd1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/01-workbench.png", + "bytes": 52058, + "sha256": "2df96efff3728d396f625fdbc3f4aeffcbc160610113f949ef406bc7dbb4b436", + "source_sha256": "2df96efff3728d396f625fdbc3f4aeffcbc160610113f949ef406bc7dbb4b436", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/01-workbench.txt", + "bytes": 1981, + "sha256": "e782ad58b8b8f4f03647dd8f161ebe5d11bffdaa32e3f1bd2bc59d5f9023c17b", + "source_sha256": "e782ad58b8b8f4f03647dd8f161ebe5d11bffdaa32e3f1bd2bc59d5f9023c17b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/02-preparation-point-route.png", + "bytes": 45672, + "sha256": "50c1e501f305eae840c116f4ec155788296867a77e8b1b86445d075c3ebd4766", + "source_sha256": "50c1e501f305eae840c116f4ec155788296867a77e8b1b86445d075c3ebd4766", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/02-preparation-point-route.txt", + "bytes": 3472, + "sha256": "823650db0308ac93721ddbed2b47ace5836e679038feca232676eeb71379e6b5", + "source_sha256": "823650db0308ac93721ddbed2b47ace5836e679038feca232676eeb71379e6b5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/03-arrived.png", + "bytes": 66437, + "sha256": "fa113ae10507f26cb82d5ca022fb1820f011c96fc0285388b1fdb19e2fd49e78", + "source_sha256": "fa113ae10507f26cb82d5ca022fb1820f011c96fc0285388b1fdb19e2fd49e78", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/03-arrived.txt", + "bytes": 2596, + "sha256": "6369254fb43e94eb4480ae2594acaa32eb7bd9e686dd583efd98a6636cb0eb52", + "source_sha256": "6369254fb43e94eb4480ae2594acaa32eb7bd9e686dd583efd98a6636cb0eb52", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/04-pause-confirmed-observation.txt", + "bytes": 2590, + "sha256": "3ba3945632a8001acaa389af060beaa10a89dc99d9f8609dd0757e018003db98", + "source_sha256": "3ba3945632a8001acaa389af060beaa10a89dc99d9f8609dd0757e018003db98", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/05-paused.png", + "bytes": 65654, + "sha256": "785cc5b2568677a244c30f1778f7ea2c9bc350b6f782c33244e47da6752576c0", + "source_sha256": "785cc5b2568677a244c30f1778f7ea2c9bc350b6f782c33244e47da6752576c0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/05-paused.txt", + "bytes": 2590, + "sha256": "3ba3945632a8001acaa389af060beaa10a89dc99d9f8609dd0757e018003db98", + "source_sha256": "3ba3945632a8001acaa389af060beaa10a89dc99d9f8609dd0757e018003db98", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/06-resumed-arrived.png", + "bytes": 65053, + "sha256": "5be91b4d13c3557e18185c03ffd3b09a33c0c90b209a99a2d1a740ca41464e9a", + "source_sha256": "5be91b4d13c3557e18185c03ffd3b09a33c0c90b209a99a2d1a740ca41464e9a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/06-resumed-arrived.txt", + "bytes": 2596, + "sha256": "f6f35a029f35b8f9e436994e4197e70c1f73a5ecb44a4ad81c835b33bd8798ea", + "source_sha256": "f6f35a029f35b8f9e436994e4197e70c1f73a5ecb44a4ad81c835b33bd8798ea", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/07-shooting.png", + "bytes": 63157, + "sha256": "7e4f20f756afc3a7f049a93412d0de1182a6e1b0cf1b0156326791b41a16b09d", + "source_sha256": "7e4f20f756afc3a7f049a93412d0de1182a6e1b0cf1b0156326791b41a16b09d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/07-shooting.txt", + "bytes": 2587, + "sha256": "2203b4f99b1ecf681342e1ed955032bec4274281ecd6e5f08e3030600315e7b7", + "source_sha256": "2203b4f99b1ecf681342e1ed955032bec4274281ecd6e5f08e3030600315e7b7", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/08-shoot-success-popup.png", + "bytes": 40432, + "sha256": "8406140e2c4194828b7133c9665ccc3f7119a9ec7757fab28185f27098c0bae0", + "source_sha256": "8406140e2c4194828b7133c9665ccc3f7119a9ec7757fab28185f27098c0bae0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/08-shoot-success-popup.txt", + "bytes": 2860, + "sha256": "c1fc8377d278ea7cd8726fbae9ca0e80b3f985eea07847ccc3f81117d4a49add", + "source_sha256": "c1fc8377d278ea7cd8726fbae9ca0e80b3f985eea07847ccc3f81117d4a49add", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/09-completed-returned.png", + "bytes": 62861, + "sha256": "8b362c1be669fd03c91078575194cb9cd53f9868f13e7d3fac7fba26c561625b", + "source_sha256": "8b362c1be669fd03c91078575194cb9cd53f9868f13e7d3fac7fba26c561625b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/09-completed-returned.txt", + "bytes": 2655, + "sha256": "06c45fdedbfb4acaa8404fd2ccb30d3fca947024ffbfd905949e90cd294c96dc", + "source_sha256": "06c45fdedbfb4acaa8404fd2ccb30d3fca947024ffbfd905949e90cd294c96dc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.png", + "bytes": 41043, + "sha256": "115b87ef5bc780e9c37e667ad01c3979751da7bb4c1fdf533370564d1b56fd62", + "source_sha256": "115b87ef5bc780e9c37e667ad01c3979751da7bb4c1fdf533370564d1b56fd62", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.txt", + "bytes": 2494, + "sha256": "776a051083d3cf8cf1b5698d20f2645eef83121f0c99720736a6d89b3d76b91d", + "source_sha256": "776a051083d3cf8cf1b5698d20f2645eef83121f0c99720736a6d89b3d76b91d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.png", + "bytes": 41114, + "sha256": "4754dbb9c4061c13557c8a9f207e5cabb975aa250d4aafb25545701d53d22482", + "source_sha256": "4754dbb9c4061c13557c8a9f207e5cabb975aa250d4aafb25545701d53d22482", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.txt", + "bytes": 2503, + "sha256": "0c236dda7d319a23459a20fc495e65df02f4695abcb7592f930d897756af2dea", + "source_sha256": "0c236dda7d319a23459a20fc495e65df02f4695abcb7592f930d897756af2dea", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/12-material-preview.png", + "bytes": 41724, + "sha256": "bf34848fd3999d1699365174435bdd6e16912ecccc2455af57744660d5f0ea9c", + "source_sha256": "bf34848fd3999d1699365174435bdd6e16912ecccc2455af57744660d5f0ea9c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/12-material-preview.txt", + "bytes": 2425, + "sha256": "dbc6fcef2b3fa174d8145dce8bb5bf543b8165b575dfeb1404ac395bce044859", + "source_sha256": "dbc6fcef2b3fa174d8145dce8bb5bf543b8165b575dfeb1404ac395bce044859", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/13-selected-new-material.txt", + "bytes": 2512, + "sha256": "87fe99e406351ee3cc5c59cb1ba1c9759444a062249e12137af0c2764901bca2", + "source_sha256": "87fe99e406351ee3cc5c59cb1ba1c9759444a062249e12137af0c2764901bca2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/14-new-material-download-completed.png", + "bytes": 45175, + "sha256": "ef8344133355dc18926ab87c812565decdcfb0c177f262a5c6a5874471f75edf", + "source_sha256": "ef8344133355dc18926ab87c812565decdcfb0c177f262a5c6a5874471f75edf", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/14-new-material-download-completed.txt", + "bytes": 2551, + "sha256": "54d606551901dc2d3f9b24fbbd4f6b32fe7a500917fcd99f4c03017d3730511f", + "source_sha256": "54d606551901dc2d3f9b24fbbd4f6b32fe7a500917fcd99f4c03017d3730511f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/15-quota-zero-preparation-blocked.txt", + "bytes": 3453, + "sha256": "b42b6f085ae135aa5647814e425fed2f62693554ecae1c06f7ad380cf9b4ff68", + "source_sha256": "b42b6f085ae135aa5647814e425fed2f62693554ecae1c06f7ad380cf9b4ff68", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.png", + "bytes": 51904, + "sha256": "1cd5ea4e64ee2d174a610c6305c8ae0700357f3150a7357683cefab39c0f8d07", + "source_sha256": "1cd5ea4e64ee2d174a610c6305c8ae0700357f3150a7357683cefab39c0f8d07", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.txt", + "bytes": 3211, + "sha256": "e0bde7d2fec63af6258e3d517d8e6199ee5e1642c17d7a8a065a04acb9d95e31", + "source_sha256": "e0bde7d2fec63af6258e3d517d8e6199ee5e1642c17d7a8a065a04acb9d95e31", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/17-orders-全部.txt", + "bytes": 6078, + "sha256": "11a9a4d6fb218fad6563d0e0d3ad94bab816dfcf24e629b6bbc3245581cc2642", + "source_sha256": "11a9a4d6fb218fad6563d0e0d3ad94bab816dfcf24e629b6bbc3245581cc2642", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/17-orders-已完成.png", + "bytes": 46446, + "sha256": "6cfe431294a9b5a948431ab8dcf914d710cf9eb06c776f719ff4eb04b88325fc", + "source_sha256": "6cfe431294a9b5a948431ab8dcf914d710cf9eb06c776f719ff4eb04b88325fc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/17-orders-已完成.txt", + "bytes": 3779, + "sha256": "e32364adc7fd83f5d2ea63397ea2cfacf11fed863840654a79f832a2e2b8ea5a", + "source_sha256": "e32364adc7fd83f5d2ea63397ea2cfacf11fed863840654a79f832a2e2b8ea5a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/17-orders-待拍摄.txt", + "bytes": 3090, + "sha256": "bc6d20d51835f8bc26f4bd28b51d3e7b4caceb5ffc16f8cf0e43430683ea6a18", + "source_sha256": "bc6d20d51835f8bc26f4bd28b51d3e7b4caceb5ffc16f8cf0e43430683ea6a18", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/17-orders-进行中.txt", + "bytes": 3694, + "sha256": "ff5e7ba7753a075d9034e000e48ba9c8c46ea8bd9b45e15ebce0027cba15beb4", + "source_sha256": "ff5e7ba7753a075d9034e000e48ba9c8c46ea8bd9b45e15ebce0027cba15beb4", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/18-A-order-arrived.png", + "bytes": 67438, + "sha256": "98a4ce9943b8cce7bf4c9820f48e4a836ff818392907f443011ad0a09c8ac8c1", + "source_sha256": "98a4ce9943b8cce7bf4c9820f48e4a836ff818392907f443011ad0a09c8ac8c1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/18-A-order-arrived.txt", + "bytes": 2867, + "sha256": "0fb37b299f2a3a8aa8bcd785d2f91b3c3cd0a07be6a63fbe6f125b002e76437c", + "source_sha256": "0fb37b299f2a3a8aa8bcd785d2f91b3c3cd0a07be6a63fbe6f125b002e76437c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/19-active-return-confirm.png", + "bytes": 42114, + "sha256": "1ddeff0b35928ab880ef9c5037a6201816784cf9f5a1faa8c19b63e655f7fba8", + "source_sha256": "1ddeff0b35928ab880ef9c5037a6201816784cf9f5a1faa8c19b63e655f7fba8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/19-active-return-confirm.txt", + "bytes": 3086, + "sha256": "aade3287c1721937f978faff8d4a4833b486317eb8f656d5a55769ee13c82e97", + "source_sha256": "aade3287c1721937f978faff8d4a4833b486317eb8f656d5a55769ee13c82e97", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/20-return-destination-preparation.txt", + "bytes": 4821, + "sha256": "f70b5f2d158c55975bbd09ecc2ca455436150918bd13bf4661d02150393cff7b", + "source_sha256": "f70b5f2d158c55975bbd09ecc2ca455436150918bd13bf4661d02150393cff7b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/21-home-active-order-position.png", + "bytes": 52747, + "sha256": "2c769d3644f454b4429c3c0d2b71170749c5f123c7cb07b66641f118fa257ff2", + "source_sha256": "2c769d3644f454b4429c3c0d2b71170749c5f123c7cb07b66641f118fa257ff2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/21-home-active-order-position.txt", + "bytes": 4569, + "sha256": "2adb39dd35554115b23aaa2b9b43816d3b565dc2e4d53614c74e68fe0f0e5421", + "source_sha256": "2adb39dd35554115b23aaa2b9b43816d3b565dc2e4d53614c74e68fe0f0e5421", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.png", + "bytes": 45815, + "sha256": "a16fd4d282c0b67c4d03a15e9ca6e10f47d8091afa77eb10cd53857b4e6000b7", + "source_sha256": "a16fd4d282c0b67c4d03a15e9ca6e10f47d8091afa77eb10cd53857b4e6000b7", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.txt", + "bytes": 3748, + "sha256": "4f26ca428433976aff606b2b7ca133c30425d8b92f0b525d93b91954dcad7b3d", + "source_sha256": "4f26ca428433976aff606b2b7ca133c30425d8b92f0b525d93b91954dcad7b3d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.png", + "bytes": 67205, + "sha256": "30fb58edd4aacb78cc186cc25ee9b6c633b93b613761cee930ddf538af0fb732", + "source_sha256": "30fb58edd4aacb78cc186cc25ee9b6c633b93b613761cee930ddf538af0fb732", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.txt", + "bytes": 4514, + "sha256": "90fad54abb3787c2c11493863e5a2719b64b3c78eb0d39e038ca949a9a22405f", + "source_sha256": "90fad54abb3787c2c11493863e5a2719b64b3c78eb0d39e038ca949a9a22405f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/24-proactive-return.txt", + "bytes": 3117, + "sha256": "c325a31f48123280cad17adea2109dacd9ed38ae492d77aa53bd4db46e9f976f", + "source_sha256": "c325a31f48123280cad17adea2109dacd9ed38ae492d77aa53bd4db46e9f976f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/25-returned-without-deduction.png", + "bytes": 66617, + "sha256": "4c13033f6ce50506e73126c677ac77c6489d5393b42f3f81a3ab9f23e1a573e0", + "source_sha256": "4c13033f6ce50506e73126c677ac77c6489d5393b42f3f81a3ab9f23e1a573e0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/25-returned-without-deduction.txt", + "bytes": 3117, + "sha256": "c325a31f48123280cad17adea2109dacd9ed38ae492d77aa53bd4db46e9f976f", + "source_sha256": "c325a31f48123280cad17adea2109dacd9ed38ae492d77aa53bd4db46e9f976f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.png", + "bytes": 47192, + "sha256": "7b6591dffe7b1df1df76cfab5b59ff62bd8963c9083cacc3c65b3bc6c74572bb", + "source_sha256": "7b6591dffe7b1df1df76cfab5b59ff62bd8963c9083cacc3c65b3bc6c74572bb", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.txt", + "bytes": 3060, + "sha256": "e62ee3faf1d8c04901b07eb7eaf2e71f2415f401ad58442bba7014aa80625720", + "source_sha256": "e62ee3faf1d8c04901b07eb7eaf2e71f2415f401ad58442bba7014aa80625720", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/27-phone-sync-pending.png", + "bytes": 43236, + "sha256": "a9ef6e3980743ad24649213e14df2fae65496866390cd465ddf1aa74e9b51b38", + "source_sha256": "a9ef6e3980743ad24649213e14df2fae65496866390cd465ddf1aa74e9b51b38", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/27-phone-sync-pending.txt", + "bytes": 3179, + "sha256": "206d72e3b41268c7ab5da4d5eb019eebea3449efc75a7b0ddf014ffc65bb7996", + "source_sha256": "206d72e3b41268c7ab5da4d5eb019eebea3449efc75a7b0ddf014ffc65bb7996", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.png", + "bytes": 47614, + "sha256": "580ced24c8f3ec400ba9bfb95b69f32e2d4254d12cd9d3dbab9e9af525d98b61", + "source_sha256": "580ced24c8f3ec400ba9bfb95b69f32e2d4254d12cd9d3dbab9e9af525d98b61", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.txt", + "bytes": 3326, + "sha256": "a537d6bb2ae394f77f46d312fb029790491d39a4667aeac76e95f5d16563500a", + "source_sha256": "a537d6bb2ae394f77f46d312fb029790491d39a4667aeac76e95f5d16563500a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/29-start-result-unknown.png", + "bytes": 65403, + "sha256": "8b60dda9348ed113ff6a4f11929b0d24fed475e3653cfe4953132d3c7617a52f", + "source_sha256": "8b60dda9348ed113ff6a4f11929b0d24fed475e3653cfe4953132d3c7617a52f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/29-start-result-unknown.txt", + "bytes": 3106, + "sha256": "2a2424312acd1c90c196b819763bf388a7d41ccd000c5030252cb5cad46dad45", + "source_sha256": "2a2424312acd1c90c196b819763bf388a7d41ccd000c5030252cb5cad46dad45", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/30-sync-original-task.png", + "bytes": 41881, + "sha256": "127bceaf566cea0249a4ecd1f6539880e36611017f14422844453a9739ce2da0", + "source_sha256": "127bceaf566cea0249a4ecd1f6539880e36611017f14422844453a9739ce2da0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/30-sync-original-task.txt", + "bytes": 3024, + "sha256": "8406e7863d5dfdad9076727fcf8a18b762e6835f2e1568c68ef7734986e3f9cc", + "source_sha256": "8406e7863d5dfdad9076727fcf8a18b762e6835f2e1568c68ef7734986e3f9cc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/31-after-sync.txt", + "bytes": 3081, + "sha256": "99e0f068283722bb335820e332e067875d150acd4f236738e6bd8a808f4643c0", + "source_sha256": "99e0f068283722bb335820e332e067875d150acd4f236738e6bd8a808f4643c0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/32-failure-dialog-closed.txt", + "bytes": 2968, + "sha256": "2468e4d3c2bb52005eabb75c6e6a53dc02c7e3e299ea4fc7bb8f65a688f5e559", + "source_sha256": "2468e4d3c2bb52005eabb75c6e6a53dc02c7e3e299ea4fc7bb8f65a688f5e559", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/33-return-paused.png", + "bytes": 63416, + "sha256": "9d496141a82f8722a5ef4dc7f48bd1469ed88d28be8d20ac0b61b025f1607bf4", + "source_sha256": "9d496141a82f8722a5ef4dc7f48bd1469ed88d28be8d20ac0b61b025f1607bf4", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/33-return-paused.txt", + "bytes": 2861, + "sha256": "4aa9c598f3a05f03679e1db961c33d501f8f193a23d7cedcdbfc48c4ebba6010", + "source_sha256": "4aa9c598f3a05f03679e1db961c33d501f8f193a23d7cedcdbfc48c4ebba6010", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/34-return-resume-outcome.png", + "bytes": 64219, + "sha256": "a6a4980f7c97d8528b76cc87bda14c42add1a455971f99225579e23cae5f93af", + "source_sha256": "a6a4980f7c97d8528b76cc87bda14c42add1a455971f99225579e23cae5f93af", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/34-return-resume-outcome.txt", + "bytes": 2971, + "sha256": "a77af9ac65f5d998c3425faf24401b1b3d6a0be55d00e9c8d2f5ac9d90a3bc80", + "source_sha256": "a77af9ac65f5d998c3425faf24401b1b3d6a0be55d00e9c8d2f5ac9d90a3bc80", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.png", + "bytes": 52225, + "sha256": "bf36691bf40d13da69e3aad15d597f37a6c7d221805a7391c567009cd4c54b61", + "source_sha256": "bf36691bf40d13da69e3aad15d597f37a6c7d221805a7391c567009cd4c54b61", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.txt", + "bytes": 6787, + "sha256": "6db0a1a74bb12a23ea39582d0bc7f7b74ef0042984c2e1108ad8463e49e079e7", + "source_sha256": "6db0a1a74bb12a23ea39582d0bc7f7b74ef0042984c2e1108ad8463e49e079e7", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/36-select-only-ready-items.png", + "bytes": 54403, + "sha256": "0fcb31c2f872128db1ff14ffa102a9b4a37e4b447fedd608d11c62d5cdf97233", + "source_sha256": "0fcb31c2f872128db1ff14ffa102a9b4a37e4b447fedd608d11c62d5cdf97233", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/36-select-only-ready-items.txt", + "bytes": 6845, + "sha256": "d47c41965f29aa7fe857e361cf31ec2cba47e71d462ffa1e168f26b91f726c09", + "source_sha256": "d47c41965f29aa7fe857e361cf31ec2cba47e71d462ffa1e168f26b91f726c09", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/37-retry-upload-one.txt", + "bytes": 6829, + "sha256": "a67c448d3503f9f06cd98ee26f047b2d5785f1ce69a660f66a1ea4e7365e26ae", + "source_sha256": "a67c448d3503f9f06cd98ee26f047b2d5785f1ce69a660f66a1ea4e7365e26ae", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/38-select-filtered-point.txt", + "bytes": 5740, + "sha256": "3c86f1f643e97065c278e23103836fad36a2f0f4524d84f709407832b276c036", + "source_sha256": "3c86f1f643e97065c278e23103836fad36a2f0f4524d84f709407832b276c036", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/39-filter-change-clears-selection.txt", + "bytes": 6789, + "sha256": "333fcc7a581a388ce02a8140b98ff99b027d8e0796f44ec012ae0935f8ac7330", + "source_sha256": "333fcc7a581a388ce02a8140b98ff99b027d8e0796f44ec012ae0935f8ac7330", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/40-all-ready-selection.png", + "bytes": 54441, + "sha256": "9fb9259fdcba5e0de478167e1794641f1978dc06b37d9fb52e78b88376988433", + "source_sha256": "9fb9259fdcba5e0de478167e1794641f1978dc06b37d9fb52e78b88376988433", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/40-all-ready-selection.txt", + "bytes": 6901, + "sha256": "be6f4146bbff0db652a7f7557d397704a66dc161f678338f84e58034ddd85b43", + "source_sha256": "be6f4146bbff0db652a7f7557d397704a66dc161f678338f84e58034ddd85b43", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/41-download-leave-confirm.png", + "bytes": 41463, + "sha256": "a156afb7babddaaf89fb8cbb3305a0ea5fd6674c626ac67e30da4a4d19255b93", + "source_sha256": "a156afb7babddaaf89fb8cbb3305a0ea5fd6674c626ac67e30da4a4d19255b93", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/41-download-leave-confirm.txt", + "bytes": 6588, + "sha256": "1139e7356f5d8497b9e7f03faf0f9f6ea4e2f73032d95de4b9b539def1794490", + "source_sha256": "1139e7356f5d8497b9e7f03faf0f9f6ea4e2f73032d95de4b9b539def1794490", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/42-continue-download-completed.png", + "bytes": 52079, + "sha256": "771c384f1d37650d31281f591344fb22140235b2d91b48d336850e60d7f8e59a", + "source_sha256": "771c384f1d37650d31281f591344fb22140235b2d91b48d336850e60d7f8e59a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/42-continue-download-completed.txt", + "bytes": 6971, + "sha256": "b0a0a995a8544bb16759a3a5f1dc7d463ace5091c7f77028b7be67f1c113b4fb", + "source_sha256": "b0a0a995a8544bb16759a3a5f1dc7d463ace5091c7f77028b7be67f1c113b4fb", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/43-retry-only-failed-file.txt", + "bytes": 7041, + "sha256": "e330cc074d294fd1ee547521f3951ea2ad08e85a76406283fdfba829a474def9", + "source_sha256": "e330cc074d294fd1ee547521f3951ea2ad08e85a76406283fdfba829a474def9", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.png", + "bytes": 52092, + "sha256": "47b353ca0b047caee7f372fc8f808cb674e8197b902a570d8a31ab7b2561e8c4", + "source_sha256": "47b353ca0b047caee7f372fc8f808cb674e8197b902a570d8a31ab7b2561e8c4", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.txt", + "bytes": 6971, + "sha256": "466ab7a9e1906a468e712fbff21cfbbea3f98b5b4a8f373a0e344c9400c0e3f6", + "source_sha256": "466ab7a9e1906a468e712fbff21cfbbea3f98b5b4a8f373a0e344c9400c0e3f6", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/45-leave-stop-returns-orders.txt", + "bytes": 7642, + "sha256": "a68ddc57e3694db90b83f12d0b15283fcd1ec90740900823ec81018070f59df8", + "source_sha256": "a68ddc57e3694db90b83f12d0b15283fcd1ec90740900823ec81018070f59df8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.png", + "bytes": 50790, + "sha256": "ab02ebe718c53f7a2dd1a82bb520983277946a5d6c9fa995770ac9b0720deb90", + "source_sha256": "ab02ebe718c53f7a2dd1a82bb520983277946a5d6c9fa995770ac9b0720deb90", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.txt", + "bytes": 6837, + "sha256": "858d3431384926d4aa95391cc895b0b4fe2a0f8e4692ee2606488098c7c62476", + "source_sha256": "858d3431384926d4aa95391cc895b0b4fe2a0f8e4692ee2606488098c7c62476", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/47-permission-settings-simulated-return.txt", + "bytes": 6901, + "sha256": "72e6215848dfe860c8f43e8441c08c345428d23a362300540798bc3423446206", + "source_sha256": "72e6215848dfe860c8f43e8441c08c345428d23a362300540798bc3423446206", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/48-permission-cancel-retains-selection.txt", + "bytes": 6901, + "sha256": "72e6215848dfe860c8f43e8441c08c345428d23a362300540798bc3423446206", + "source_sha256": "72e6215848dfe860c8f43e8441c08c345428d23a362300540798bc3423446206", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/49-initial-mixed-upload-state.txt", + "bytes": 4158, + "sha256": "fc90d94e1f302b7ff89437ed0ad468d593683e0bb7b0555083bb63741aa6ff0f", + "source_sha256": "fc90d94e1f302b7ff89437ed0ad468d593683e0bb7b0555083bb63741aa6ff0f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.png", + "bytes": 43778, + "sha256": "d64ce717027f08c698d91a77cd72aecbad7d43b96c497be51bb8b7fc0e4b8dd0", + "source_sha256": "d64ce717027f08c698d91a77cd72aecbad7d43b96c497be51bb8b7fc0e4b8dd0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.txt", + "bytes": 4196, + "sha256": "3194d94166a1549d4580d40c1c66a023689d4b1195a097b20a0d938b97770e90", + "source_sha256": "3194d94166a1549d4580d40c1c66a023689d4b1195a097b20a0d938b97770e90", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/51-normal-success-final-state.txt", + "bytes": 2920, + "sha256": "bc951c3518a89e697094a16bea4abf2c8e3972fdc658abec126ac017ea315dff", + "source_sha256": "bc951c3518a89e697094a16bea4abf2c8e3972fdc658abec126ac017ea315dff", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.png", + "bytes": 50726, + "sha256": "45e7bf691cecaf2a3531c82e5de4d602f850b9468773c0889dec418f65e971e8", + "source_sha256": "45e7bf691cecaf2a3531c82e5de4d602f850b9468773c0889dec418f65e971e8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.txt", + "bytes": 4603, + "sha256": "e00c89918d56ec3697876a0f574d066d8dee37507ea0bdc69be27c208f74f3b7", + "source_sha256": "e00c89918d56ec3697876a0f574d066d8dee37507ea0bdc69be27c208f74f3b7", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.png", + "bytes": 46628, + "sha256": "228136401b06a9822dc17b086cbd75f6a8cd32ed4ffea8258233383118614347", + "source_sha256": "228136401b06a9822dc17b086cbd75f6a8cd32ed4ffea8258233383118614347", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.txt", + "bytes": 3816, + "sha256": "5e3e7988d967a462f3ea5fee49af425a4c2e40164a0db8b27f234606725943d2", + "source_sha256": "5e3e7988d967a462f3ea5fee49af425a4c2e40164a0db8b27f234606725943d2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.png", + "bytes": 59476, + "sha256": "4295955fc7818f96fed245976beaf1d157090634df623d69c377b13d10231846", + "source_sha256": "4295955fc7818f96fed245976beaf1d157090634df623d69c377b13d10231846", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.txt", + "bytes": 3213, + "sha256": "c98a6324d52f36e235333a26f8501c8b3b0cc281a487d5bc988bc24898e962e0", + "source_sha256": "c98a6324d52f36e235333a26f8501c8b3b0cc281a487d5bc988bc24898e962e0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.png", + "bytes": 65420, + "sha256": "ab3c3bcfa29b3964dadb2cca6c55ce796fa72a53dd8894847cf53559997e5060", + "source_sha256": "ab3c3bcfa29b3964dadb2cca6c55ce796fa72a53dd8894847cf53559997e5060", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.txt", + "bytes": 3195, + "sha256": "9d84fa2f9a8935ba8d1bf7ceab47f5feed5f6fea0e0dba45334adeffceb84202", + "source_sha256": "9d84fa2f9a8935ba8d1bf7ceab47f5feed5f6fea0e0dba45334adeffceb84202", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/56-phone-sync-completed.png", + "bytes": 40870, + "sha256": "c5231d2d229081c0d2c27ed5ec84fee5414b811339267615c51c320973868aa9", + "source_sha256": "c5231d2d229081c0d2c27ed5ec84fee5414b811339267615c51c320973868aa9", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/56-phone-sync-completed.txt", + "bytes": 3418, + "sha256": "854289c669e643057e36cda2a740fcefbe7419cd1c9de6744b6570bc2b8795cf", + "source_sha256": "854289c669e643057e36cda2a740fcefbe7419cd1c9de6744b6570bc2b8795cf", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.png", + "bytes": 64893, + "sha256": "9e97c462b0b158585cfcadea3fd2a95deb5f311504b9634ae3cb71ffb0ed2c0b", + "source_sha256": "9e97c462b0b158585cfcadea3fd2a95deb5f311504b9634ae3cb71ffb0ed2c0b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.txt", + "bytes": 3251, + "sha256": "32d7d2583497b82830d4643eccabe7d555cead49592407ae8d5924143d023cbf", + "source_sha256": "32d7d2583497b82830d4643eccabe7d555cead49592407ae8d5924143d023cbf", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.png", + "bytes": 65409, + "sha256": "1e6ea9ca5cb5c30a67b1e469d8d84209fb0292faeed9403d9570ef3cf17d42f0", + "source_sha256": "1e6ea9ca5cb5c30a67b1e469d8d84209fb0292faeed9403d9570ef3cf17d42f0", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.txt", + "bytes": 3195, + "sha256": "57b2fe3014be67425419bde0e01ac818b292d6f1465a67080945e034d873e87e", + "source_sha256": "57b2fe3014be67425419bde0e01ac818b292d6f1465a67080945e034d873e87e", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/connection-recheck-手机断网.txt", + "bytes": 3341, + "sha256": "f112b03515335e76ed7bcd9a468cf033cd6065f74c49b54c990974f3b26067a9", + "source_sha256": "f112b03515335e76ed7bcd9a468cf033cd6065f74c49b54c990974f3b26067a9", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/connection-recheck-画面断流.txt", + "bytes": 3219, + "sha256": "185da610de68fe4a9a7df6d1a3710eeb0287ff272ad591bdcef6daca04d6f39f", + "source_sha256": "185da610de68fe4a9a7df6d1a3710eeb0287ff272ad591bdcef6daca04d6f39f", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/feed-final-check-画面断流.txt", + "bytes": 3219, + "sha256": "9eb69792884c80da6b61417acb35bd2f1bb04e9fb6de1643785237c1db099c28", + "source_sha256": "9eb69792884c80da6b61417acb35bd2f1bb04e9fb6de1643785237c1db099c28", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/manifest.json", + "bytes": 9198, + "sha256": "afbfa5b05b0ec84b9f510d882da67087b4aac9f23b8771c96f3904c4e9a455bd", + "source_sha256": "afbfa5b05b0ec84b9f510d882da67087b4aac9f23b8771c96f3904c4e9a455bd", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-下载中.png", + "bytes": 51699, + "sha256": "e70096367539f59dc97df3838c5242a9ab9aea23c6402e8abea05b04b3c3e445", + "source_sha256": "e70096367539f59dc97df3838c5242a9ab9aea23c6402e8abea05b04b3c3e445", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-下载中.txt", + "bytes": 7041, + "sha256": "63200883fefda7c319dfafd9814a9bf8fb407cd628ed71d8f345a5d3445f86b5", + "source_sha256": "63200883fefda7c319dfafd9814a9bf8fb407cd628ed71d8f345a5d3445f86b5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-下载失败.png", + "bytes": 51866, + "sha256": "f1d9b0e9d4ecf16e9fbe0a60ca894e33bdb6f3644e7ced4e86b58f58acb82c2c", + "source_sha256": "f1d9b0e9d4ecf16e9fbe0a60ca894e33bdb6f3644e7ced4e86b58f58acb82c2c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-下载失败.txt", + "bytes": 7056, + "sha256": "b0a086effc18dbfaf3cc7d07b1ca5ee04fa792066afd1a653d30759c4e5ef5ab", + "source_sha256": "b0a086effc18dbfaf3cc7d07b1ca5ee04fa792066afd1a653d30759c4e5ef5ab", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-下载完成.txt", + "bytes": 6971, + "sha256": "36231a3195db1c666f70492e96b591fe41cf2b5523994927b7b519703cd6a009", + "source_sha256": "36231a3195db1c666f70492e96b591fe41cf2b5523994927b7b519703cd6a009", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-已选择素材.txt", + "bytes": 6842, + "sha256": "23226d8e92a4efdef3cfb95944a37215c4055843f3449ee3b15d578ae5ead3f2", + "source_sha256": "23226d8e92a4efdef3cfb95944a37215c4055843f3449ee3b15d578ae5ead3f2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-未选择素材.txt", + "bytes": 6833, + "sha256": "ed073e68fbef62a94456250011ad166c064ec0778eddb39c5b7704ffdbf8b406", + "source_sha256": "ed073e68fbef62a94456250011ad166c064ec0778eddb39c5b7704ffdbf8b406", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.png", + "bytes": 44983, + "sha256": "741298e83b600892b84c4ae442629591553cf695b967d4bd5956cd87680b27f7", + "source_sha256": "741298e83b600892b84c4ae442629591553cf695b967d4bd5956cd87680b27f7", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.txt", + "bytes": 6596, + "sha256": "ae12ff60ffb7b00fb7429dd5b6f157a88c57043fb25e5526574fba2733a2cafa", + "source_sha256": "ae12ff60ffb7b00fb7429dd5b6f157a88c57043fb25e5526574fba2733a2cafa", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-离开确认.txt", + "bytes": 6588, + "sha256": "0691a070262b824dfbb071f0b01990f67637d73f7c35941a1ed9d571e8e71358", + "source_sha256": "0691a070262b824dfbb071f0b01990f67637d73f7c35941a1ed9d571e8e71358", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-素材上传中.txt", + "bytes": 6343, + "sha256": "39b4d8d27fb188f200e3d722a15bf07a35c995e99e1b1ab1fc3ab1c30910fb0b", + "source_sha256": "39b4d8d27fb188f200e3d722a15bf07a35c995e99e1b1ab1fc3ab1c30910fb0b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-素材上传失败.txt", + "bytes": 6562, + "sha256": "cd04c2e2899a823ea8221f671771f370a0f82067e900f15af517c85ecce1c689", + "source_sha256": "cd04c2e2899a823ea8221f671771f370a0f82067e900f15af517c85ecce1c689", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-素材上传完成.txt", + "bytes": 6833, + "sha256": "ed073e68fbef62a94456250011ad166c064ec0778eddb39c5b7704ffdbf8b406", + "source_sha256": "ed073e68fbef62a94456250011ad166c064ec0778eddb39c5b7704ffdbf8b406", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/materials-preview-重试中.txt", + "bytes": 7041, + "sha256": "db5f4a65c6b7d32921aad5b3ceae35e7ff5f778efee16e8b340d4f18176f2df2", + "source_sha256": "db5f4a65c6b7d32921aad5b3ceae35e7ff5f778efee16e8b340d4f18176f2df2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.png", + "bytes": 33360, + "sha256": "c8810747c599de04cc33720feddbc00bcbbb4b73fe1ed931bc347bc4dfb8775c", + "source_sha256": "c8810747c599de04cc33720feddbc00bcbbb4b73fe1ed931bc347bc4dfb8775c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.txt", + "bytes": 1591, + "sha256": "be0edff723496c0a1b97e60a5c07452ea5cfad7a003a289ba800c3cc3ab80fea", + "source_sha256": "be0edff723496c0a1b97e60a5c07452ea5cfad7a003a289ba800c3cc3ab80fea", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/orders-preview-正常订单列表.txt", + "bytes": 6044, + "sha256": "b1f451e5cf3f10c67e898ab968490fd1f1906104a44fdceb6e03e0558a190996", + "source_sha256": "b1f451e5cf3f10c67e898ab968490fd1f1906104a44fdceb6e03e0558a190996", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.png", + "bytes": 45531, + "sha256": "255d407824d5192152ae890e95e898bcab83b20bec4585e48821dc2a11542ec4", + "source_sha256": "255d407824d5192152ae890e95e898bcab83b20bec4585e48821dc2a11542ec4", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.txt", + "bytes": 3316, + "sha256": "2dfe1bc8a230b483a297b85b114c3fc30d115d2416c21c4ea97f10ea6e12887c", + "source_sha256": "2dfe1bc8a230b483a297b85b114c3fc30d115d2416c21c4ea97f10ea6e12887c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-拍摄次数用完.txt", + "bytes": 2911, + "sha256": "c81219c446b57bff81cf94fce2fa568a263be9c99ab1f2bca03e3024ffb14a60", + "source_sha256": "c81219c446b57bff81cf94fce2fa568a263be9c99ab1f2bca03e3024ffb14a60", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-无人机占用中.txt", + "bytes": 3321, + "sha256": "78b80129e9b2be52b9d43ed805b0a4e2f2490ce80fc8875aac63cfada51d47ae", + "source_sha256": "78b80129e9b2be52b9d43ed805b0a4e2f2490ce80fc8875aac63cfada51d47ae", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-无人机无信号.txt", + "bytes": 3313, + "sha256": "a5e5c192d61f69c16fde8826c524a80414a75463ef84fc45d844e306e36c945b", + "source_sha256": "a5e5c192d61f69c16fde8826c524a80414a75463ef84fc45d844e306e36c945b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-暂无可用航线.txt", + "bytes": 2911, + "sha256": "d21509ca5e1af18248725bce4f637e5b1b0a904d0cac63a5cfe16c141c629a79", + "source_sha256": "d21509ca5e1af18248725bce4f637e5b1b0a904d0cac63a5cfe16c141c629a79", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-机巢未连接.txt", + "bytes": 3307, + "sha256": "9c88873837c8fa057ffd5240c329b0916cc8f081f272fb92fa3af52ca1315ac1", + "source_sha256": "9c88873837c8fa057ffd5240c329b0916cc8f081f272fb92fa3af52ca1315ac1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-电量不足.txt", + "bytes": 3327, + "sha256": "8927b056089f945e2563c47d40f8871ec3ff1beab307ee591b621b0f45ed519d", + "source_sha256": "8927b056089f945e2563c47d40f8871ec3ff1beab307ee591b621b0f45ed519d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-设备状态未知.txt", + "bytes": 3316, + "sha256": "5f57577f6f23d30bfd69600dda8ffa4a8df23afe57f38a27e880aad993af52f2", + "source_sha256": "5f57577f6f23d30bfd69600dda8ffa4a8df23afe57f38a27e880aad993af52f2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-preview-设备空闲.txt", + "bytes": 3326, + "sha256": "12e41eaf70ac33220717a920082e876b4b30c1198db006dd08cecc3e97e23e89", + "source_sha256": "12e41eaf70ac33220717a920082e876b4b30c1198db006dd08cecc3e97e23e89", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/prepare-reset-恢复正常体验.txt", + "bytes": 3326, + "sha256": "12e41eaf70ac33220717a920082e876b4b30c1198db006dd08cecc3e97e23e89", + "source_sha256": "12e41eaf70ac33220717a920082e876b4b30c1198db006dd08cecc3e97e23e89", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/reset-final-从头体验整个流程.txt", + "bytes": 1981, + "sha256": "41f724be34e127c933824850e19ab6f6317bbab92d3ab96db85359348c1059c1", + "source_sha256": "41f724be34e127c933824850e19ab6f6317bbab92d3ab96db85359348c1059c1", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/reset-从头体验整个流程.txt", + "bytes": 1981, + "sha256": "24eebe4bb5911b40ddf11a44b7597cd6bf807b241b3bd010bfd53c7543860083", + "source_sha256": "24eebe4bb5911b40ddf11a44b7597cd6bf807b241b3bd010bfd53c7543860083", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-体验指令超时.txt", + "bytes": 2867, + "sha256": "c01a814af6c1449606fa97d5f43ebd3366b405af889797697412c54f9c3eb34c", + "source_sha256": "c01a814af6c1449606fa97d5f43ebd3366b405af889797697412c54f9c3eb34c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-保护性返航.png", + "bytes": 65301, + "sha256": "130a7304f0263153ea0d8d40db461b0bd516a225e10ad2958904129c023bcc73", + "source_sha256": "130a7304f0263153ea0d8d40db461b0bd516a225e10ad2958904129c023bcc73", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-保护性返航.txt", + "bytes": 3048, + "sha256": "76c0807fee877903ab38d67d9140273325d24340faad765084183519e7fedd1a", + "source_sha256": "76c0807fee877903ab38d67d9140273325d24340faad765084183519e7fedd1a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.png", + "bytes": 67175, + "sha256": "49028d9c40f1b4c6fb4b6a4f738d697717d3e551e4bf8a3dc46f04b1482dc8df", + "source_sha256": "49028d9c40f1b4c6fb4b6a4f738d697717d3e551e4bf8a3dc46f04b1482dc8df", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.txt", + "bytes": 3168, + "sha256": "f23286d59f22dceadb0587f035712c5281f247dbfc9548dc21a10b1648c281c5", + "source_sha256": "f23286d59f22dceadb0587f035712c5281f247dbfc9548dc21a10b1648c281c5", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.png", + "bytes": 65623, + "sha256": "4a5228b210493e713faff80c0edbdc6ac49d174a8d8eab85f9465f1753c5288a", + "source_sha256": "4a5228b210493e713faff80c0edbdc6ac49d174a8d8eab85f9465f1753c5288a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.txt", + "bytes": 3123, + "sha256": "c68989954607d9a614aed90001ffbb6b2d6b61242eb6c90a60da337cb2816831", + "source_sha256": "c68989954607d9a614aed90001ffbb6b2d6b61242eb6c90a60da337cb2816831", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-已到达.txt", + "bytes": 3022, + "sha256": "62aa1ca700dae3c2647d072938fec8164d8a3d0d5234ca23e5a52ecdbc5f836d", + "source_sha256": "62aa1ca700dae3c2647d072938fec8164d8a3d0d5234ca23e5a52ecdbc5f836d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-悬停.txt", + "bytes": 3016, + "sha256": "0dbbf32eb96e3018af44f97c2a0e8c064880dfbd58695ae2a0e72e3c902a6a33", + "source_sha256": "0dbbf32eb96e3018af44f97c2a0e8c064880dfbd58695ae2a0e72e3c902a6a33", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-手机断网.png", + "bytes": 43324, + "sha256": "5823106a8b8ffd7c1ca92ceafce3822ece9c6c0846c2157616a8adb44c02494a", + "source_sha256": "5823106a8b8ffd7c1ca92ceafce3822ece9c6c0846c2157616a8adb44c02494a", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-手机断网.txt", + "bytes": 3159, + "sha256": "eaede3a07c4cd6ee9aed90c2f3a630cce3ddea4dc8083687019d46acd5c980b8", + "source_sha256": "eaede3a07c4cd6ee9aed90c2f3a630cce3ddea4dc8083687019d46acd5c980b8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.png", + "bytes": 40711, + "sha256": "e49d83facb02a156740824f84649bf7d4af285162132e7d92b21f98944b42815", + "source_sha256": "e49d83facb02a156740824f84649bf7d4af285162132e7d92b21f98944b42815", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.txt", + "bytes": 3135, + "sha256": "cdd5770423606f6a438e4df74f61801b966116fb005358c316d38420fe9e95e2", + "source_sha256": "cdd5770423606f6a438e4df74f61801b966116fb005358c316d38420fe9e95e2", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-拍摄中.txt", + "bytes": 3013, + "sha256": "358029f8fb3be14edf7a4b3a249b9f4d25d4d98dfc12ce997f51387c64900772", + "source_sha256": "358029f8fb3be14edf7a4b3a249b9f4d25d4d98dfc12ce997f51387c64900772", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.png", + "bytes": 63840, + "sha256": "303d667c9104ec75d8e31354c0f6cecd737bc389426fada8bc5e348a8bc92fcc", + "source_sha256": "303d667c9104ec75d8e31354c0f6cecd737bc389426fada8bc5e348a8bc92fcc", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.txt", + "bytes": 2876, + "sha256": "63c7d6138fae68bde956d3dccce701545dbccbf574917aaa9141f2b42d45d8dd", + "source_sha256": "63c7d6138fae68bde956d3dccce701545dbccbf574917aaa9141f2b42d45d8dd", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.png", + "bytes": 41033, + "sha256": "0b849c3b771c85356e48bf420d9b2b4153e284b94758b93d1a60843c15ceabb3", + "source_sha256": "0b849c3b771c85356e48bf420d9b2b4153e284b94758b93d1a60843c15ceabb3", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.txt", + "bytes": 3081, + "sha256": "7086c21cca8e02a4243ebba0ec84ce979e0735b91cce4a0a03179bd823475adb", + "source_sha256": "7086c21cca8e02a4243ebba0ec84ce979e0735b91cce4a0a03179bd823475adb", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-画面断流.png", + "bytes": 47470, + "sha256": "de3988fe41eaa48068feb1a2966985b8b7c7af6313bbc33aea1e0771426ca762", + "source_sha256": "de3988fe41eaa48068feb1a2966985b8b7c7af6313bbc33aea1e0771426ca762", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-画面断流.txt", + "bytes": 3037, + "sha256": "9436d28f84ca9c7522e1dfd49e3f66e85df0d60eb2edd9b1136d3dddf54ea44d", + "source_sha256": "9436d28f84ca9c7522e1dfd49e3f66e85df0d60eb2edd9b1136d3dddf54ea44d", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/task-preview-返航中.txt", + "bytes": 2875, + "sha256": "9db2b56d30bdde4033a687c7448fbb3ea6d58e77240efa0e8b805a553d8a0b71", + "source_sha256": "9db2b56d30bdde4033a687c7448fbb3ea6d58e77240efa0e8b805a553d8a0b71", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-无人机占用中.txt", + "bytes": 1984, + "sha256": "471583dfe1745d92a8f87371d6fdccd20abd0735245eb3e0a0d86f3fd85f5bee", + "source_sha256": "471583dfe1745d92a8f87371d6fdccd20abd0735245eb3e0a0d86f3fd85f5bee", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-无人机无信号.txt", + "bytes": 1987, + "sha256": "afa6ee2df82655aa3e8972b02e64bb4f1daa4a9f919a5b61ebfe46f6698c26c8", + "source_sha256": "afa6ee2df82655aa3e8972b02e64bb4f1daa4a9f919a5b61ebfe46f6698c26c8", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-暂无拍摄订单.txt", + "bytes": 1286, + "sha256": "eececd9042acdae3306ed27edceb2def4ba6f6eed84527975054ec44569cc738", + "source_sha256": "eececd9042acdae3306ed27edceb2def4ba6f6eed84527975054ec44569cc738", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-机巢未连接.txt", + "bytes": 1971, + "sha256": "58c8d473fefd01b715b7f8101c075ac6ee5c055dc2a152de203e5defee9749fa", + "source_sha256": "58c8d473fefd01b715b7f8101c075ac6ee5c055dc2a152de203e5defee9749fa", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-电量不足.txt", + "bytes": 1984, + "sha256": "288b1470829a5fc883ccc93cd4c291f643abbcc09fede8db2a736fb7b3650c54", + "source_sha256": "288b1470829a5fc883ccc93cd4c291f643abbcc09fede8db2a736fb7b3650c54", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-设备状态未知.txt", + "bytes": 1974, + "sha256": "f90cacb40432c06039eb487b3ea4e2e79a1d6e1c1d525a89b63128e33b35b646", + "source_sha256": "f90cacb40432c06039eb487b3ea4e2e79a1d6e1c1d525a89b63128e33b35b646", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-preview-设备空闲.txt", + "bytes": 1981, + "sha256": "ffc4458e7ba6fdad02c1d581950bb518594cad1642c7bb9f7952a92cc4d35410", + "source_sha256": "ffc4458e7ba6fdad02c1d581950bb518594cad1642c7bb9f7952a92cc4d35410", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/workbench-reset-恢复正常体验.txt", + "bytes": 1981, + "sha256": "ffc4458e7ba6fdad02c1d581950bb518594cad1642c7bb9f7952a92cc4d35410", + "source_sha256": "ffc4458e7ba6fdad02c1d581950bb518594cad1642c7bb9f7952a92cc4d35410", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.png", + "bytes": 65790, + "sha256": "def6693109e91a2a83e86e847ddadbdca43b3313fbdce03f292035fd22c431ea", + "source_sha256": "def6693109e91a2a83e86e847ddadbdca43b3313fbdce03f292035fd22c431ea", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.txt", + "bytes": 2876, + "sha256": "aa27ef567e24d6e24d2caa01e7fc40b754e4a0c0e15484c7fd0fdb430ad50d74", + "source_sha256": "aa27ef567e24d6e24d2caa01e7fc40b754e4a0c0e15484c7fd0fdb430ad50d74", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/payment-existing-vs-new.md", + "bytes": 11987, + "sha256": "d5ccd2d1a755b01f96a6af920c6883812012ee4a389163e3ec0764f8b671527b", + "source_sha256": "0b52fb323ebef9eade94006122cdb8013c13658a0fea9618ec25987faa89ecb9", + "content_changed_for_archive": true + }, + { + "path": "review/product-comparison/payment-verified.md", + "bytes": 6999, + "sha256": "db1713c093f19a97709ae373b6a97d470e9e7fffef714038a7fe892c232ebb72", + "source_sha256": "db1713c093f19a97709ae373b6a97d470e9e7fffef714038a7fe892c232ebb72", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/体验进度与已验证差异.md", + "bytes": 770, + "sha256": "49e81ce385a083591404233627193495e2697b6b3dbb69ad5f796a382c41b56c", + "source_sha256": "49e81ce385a083591404233627193495e2697b6b3dbb69ad5f796a382c41b56c", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/待核验状态检查表.md", + "bytes": 16729, + "sha256": "4d1bf0324a01f3a8658f2c521d4b9b2c6963fc347f6d2329b83f5b0be9406f3b", + "source_sha256": "4d1bf0324a01f3a8658f2c521d4b9b2c6963fc347f6d2329b83f5b0be9406f3b", + "content_changed_for_archive": false + }, + { + "path": "review/product-comparison/随心瞰9.9.1-产品原型与当前方案对比.md", + "bytes": 23059, + "sha256": "b8521cb5f58160be33093d8bdc001841374a7be0d7fb0eb374cd38532af9c92d", + "source_sha256": "7a75f97b701672b59b91f9d5f53ba47862a775e3475bbc8ca4857844e936e44b", + "content_changed_for_archive": true + }, + { + "path": "review/product-comparison/非支付流程复跑记录.md", + "bytes": 13662, + "sha256": "51b33af8b59cb4dcdc3379597020e49bb9062883199da1ba6fd8639874581ce7", + "source_sha256": "51b33af8b59cb4dcdc3379597020e49bb9062883199da1ba6fd8639874581ce7", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/03-pause-return-full.png", + "bytes": 578547, + "sha256": "4ab98d95acd9567807ae3f09aa68127055bb3f116f21f33af04a4bdce57398a6", + "source_sha256": "4ab98d95acd9567807ae3f09aa68127055bb3f116f21f33af04a4bdce57398a6", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/checks.json", + "bytes": 3259, + "sha256": "9f74ad0d0e9f02bd824c333a2566389815b6442b06a039b454b2dfeab767cb4f", + "source_sha256": "9f74ad0d0e9f02bd824c333a2566389815b6442b06a039b454b2dfeab767cb4f", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/dock-recovering.png", + "bytes": 168582, + "sha256": "5c075b478bb3f1918a5e807376327b4d415379efdff18e6740cb1da0b8c881b9", + "source_sha256": "5c075b478bb3f1918a5e807376327b4d415379efdff18e6740cb1da0b8c881b9", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/footer.png", + "bytes": 19627, + "sha256": "30cfa55ef5c2aab719fda41f9c3af5a952990f9f188a859638ead3b6f2daad0e", + "source_sha256": "30cfa55ef5c2aab719fda41f9c3af5a952990f9f188a859638ead3b6f2daad0e", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/header.png", + "bytes": 40353, + "sha256": "4e1efc8f33936fcb0c43684d82e011c3e60fbe4127f88ba187ce90950706f735", + "source_sha256": "4e1efc8f33936fcb0c43684d82e011c3e60fbe4127f88ba187ce90950706f735", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/pause-confirmed.png", + "bytes": 143086, + "sha256": "e3ee2bef016014a9bcff175ddbd2f055473e0d446d5118116f36b9eee5896558", + "source_sha256": "e3ee2bef016014a9bcff175ddbd2f055473e0d446d5118116f36b9eee5896558", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/pause-pending.png", + "bytes": 140231, + "sha256": "98cf6b9260ddb5d8b9af48a5490d93232f55b5fad93668e2ec32753275dc4bc3", + "source_sha256": "98cf6b9260ddb5d8b9af48a5490d93232f55b5fad93668e2ec32753275dc4bc3", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/qa-pair-1.png", + "bytes": 201892, + "sha256": "b41813f4638ba443e16331a6e65d47e34cfaa15579ccbdcc014e9ea0e1f556f7", + "source_sha256": "b41813f4638ba443e16331a6e65d47e34cfaa15579ccbdcc014e9ea0e1f556f7", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/qa-pair-2.png", + "bytes": 224579, + "sha256": "40a4871ddb75252d0fce8655ec6e311dc239ca982c39cdbb13b2882fefbb3757", + "source_sha256": "40a4871ddb75252d0fce8655ec6e311dc239ca982c39cdbb13b2882fefbb3757", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/qa-pair-3.png", + "bytes": 314367, + "sha256": "7160f5e1f8b6c8df1a2da785e7a5b58096665dc217f8d513c06d589e208255c5", + "source_sha256": "7160f5e1f8b6c8df1a2da785e7a5b58096665dc217f8d513c06d589e208255c5", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/resume-pending.png", + "bytes": 149491, + "sha256": "aaa258974682281dbc3cbd1f90937f230895d31e720aebf9214f106737dcb0ff", + "source_sha256": "aaa258974682281dbc3cbd1f90937f230895d31e720aebf9214f106737dcb0ff", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/return-active.png", + "bytes": 141310, + "sha256": "fdbd68343146f21be8e5c62e2ae08eca6ef575983df972614c52a8d0a5562de9", + "source_sha256": "fdbd68343146f21be8e5c62e2ae08eca6ef575983df972614c52a8d0a5562de9", + "content_changed_for_archive": false + }, + { + "path": "review/regenerated-03/return-paused.png", + "bytes": 147839, + "sha256": "4a714cf0757ba20da18f265ce4250ad8bfcdfa38a4bec39aa5d11e7ccbfdec21", + "source_sha256": "4a714cf0757ba20da18f265ce4250ad8bfcdfa38a4bec39aa5d11e7ccbfdec21", + "content_changed_for_archive": false + }, + { + "path": "review/report-preview.png", + "bytes": 242108, + "sha256": "c654160457796499e1ff00714923738380cecd737ac484e0cdccab01a01e2569", + "source_sha256": "c654160457796499e1ff00714923738380cecd737ac484e0cdccab01a01e2569", + "content_changed_for_archive": false + }, + { + "path": "review/review-content.html", + "bytes": 19251, + "sha256": "7a25fb41de32ba370a713a59f12052614dcdf47e12d723cbcbdf5a3b9e01670c", + "source_sha256": "96eed52a89a03ae2d8569916f83f4eaecd7aafbad41df4e013abe561e100b0f6", + "content_changed_for_archive": true + }, + { + "path": "review/review.html", + "bytes": 87902, + "sha256": "aedb5a59709e5009b8d58731f9d94c7d4b80cde8c846a7f1faae6e043aedc39b", + "source_sha256": "ce4b7ae6b28b79e9829377e08ca663a84c7d8f5d0c5e4de40d577da8fc3e2d0f", + "content_changed_for_archive": true + }, + { + "path": "review/screens/command-rejected.png", + "bytes": 110739, + "sha256": "e4a61429836be9bbe90ff21833486ac4ff5189981270a79aaa22cc0ad6e26e47", + "source_sha256": "e4a61429836be9bbe90ff21833486ac4ff5189981270a79aaa22cc0ad6e26e47", + "content_changed_for_archive": false + }, + { + "path": "review/screens/dock-recovering.png", + "bytes": 168582, + "sha256": "5c075b478bb3f1918a5e807376327b4d415379efdff18e6740cb1da0b8c881b9", + "source_sha256": "5c075b478bb3f1918a5e807376327b4d415379efdff18e6740cb1da0b8c881b9", + "content_changed_for_archive": false + }, + { + "path": "review/screens/failure-ready.png", + "bytes": 108665, + "sha256": "bb4f33050950ff283ca5626004636a5ed586ed2a4570f452c60182cd4ac088a5", + "source_sha256": "bb4f33050950ff283ca5626004636a5ed586ed2a4570f452c60182cd4ac088a5", + "content_changed_for_archive": false + }, + { + "path": "review/screens/failure-returning.png", + "bytes": 109033, + "sha256": "b212bfe75ef947cce42045fedaabefaae485d5373cba259f1dad2554d053dd95", + "source_sha256": "b212bfe75ef947cce42045fedaabefaae485d5373cba259f1dad2554d053dd95", + "content_changed_for_archive": false + }, + { + "path": "review/screens/flight-arrived.png", + "bytes": 103237, + "sha256": "a065de338eabe7429d9331d787a57fc94888b9fd72cf75ed243b2fd0e33efce7", + "source_sha256": "a065de338eabe7429d9331d787a57fc94888b9fd72cf75ed243b2fd0e33efce7", + "content_changed_for_archive": false + }, + { + "path": "review/screens/flight-outbound.png", + "bytes": 106280, + "sha256": "3f86d231516421395638ac47d491697b952a99f8e384440cd5152551bf94f169", + "source_sha256": "3f86d231516421395638ac47d491697b952a99f8e384440cd5152551bf94f169", + "content_changed_for_archive": false + }, + { + "path": "review/screens/flight-shooting.png", + "bytes": 104199, + "sha256": "5ff6ede574b963db47054b2a13303e92373c2a6463eaf1870db2b1ff243587c5", + "source_sha256": "5ff6ede574b963db47054b2a13303e92373c2a6463eaf1870db2b1ff243587c5", + "content_changed_for_archive": false + }, + { + "path": "review/screens/flight-success.png", + "bytes": 108210, + "sha256": "4a008413739b58fea23c7430e2d561a8c1b01f56594d64f70d34631b8ac24e7e", + "source_sha256": "4a008413739b58fea23c7430e2d561a8c1b01f56594d64f70d34631b8ac24e7e", + "content_changed_for_archive": false + }, + { + "path": "review/screens/media-download-partial.png", + "bytes": 161085, + "sha256": "2be1648639f09372c146cde79dead60933450da0c08528706210eb323acd16ac", + "source_sha256": "2be1648639f09372c146cde79dead60933450da0c08528706210eb323acd16ac", + "content_changed_for_archive": false + }, + { + "path": "review/screens/media-ready.png", + "bytes": 155620, + "sha256": "9f9cd510b296bee6a33b244e8956c123424aa8d17d08f7def0c14099e45445ed", + "source_sha256": "9f9cd510b296bee6a33b244e8956c123424aa8d17d08f7def0c14099e45445ed", + "content_changed_for_archive": false + }, + { + "path": "review/screens/media-saved.png", + "bytes": 155026, + "sha256": "eef215420bb023ae899788ff5d189753de2da705d322da3e8fbcf2caa63cf3cc", + "source_sha256": "eef215420bb023ae899788ff5d189753de2da705d322da3e8fbcf2caa63cf3cc", + "content_changed_for_archive": false + }, + { + "path": "review/screens/media-saving.png", + "bytes": 156964, + "sha256": "96e4a980de273a13eab4679d58cbbc23ae7a35fcdb05c5327c37237c43c151a0", + "source_sha256": "96e4a980de273a13eab4679d58cbbc23ae7a35fcdb05c5327c37237c43c151a0", + "content_changed_for_archive": false + }, + { + "path": "review/screens/media-upload-partial.png", + "bytes": 165050, + "sha256": "095fcb73c46e2bf1076636b2b6582cfa57070073ef087dd963a6a423fc6a5d4b", + "source_sha256": "095fcb73c46e2bf1076636b2b6582cfa57070073ef087dd963a6a423fc6a5d4b", + "content_changed_for_archive": false + }, + { + "path": "review/screens/media-uploading.png", + "bytes": 87325, + "sha256": "3074583767b4fdb896fbaf809edbddf4b1c1818d84e11d16ffe8e778d3e7c06e", + "source_sha256": "3074583767b4fdb896fbaf809edbddf4b1c1818d84e11d16ffe8e778d3e7c06e", + "content_changed_for_archive": false + }, + { + "path": "review/screens/order-refunding.png", + "bytes": 97742, + "sha256": "df60d9fa1b6a6e7186dc825073890b735ea6acbdf78691a9294038cd785864cb", + "source_sha256": "df60d9fa1b6a6e7186dc825073890b735ea6acbdf78691a9294038cd785864cb", + "content_changed_for_archive": false + }, + { + "path": "review/screens/order-transferred.png", + "bytes": 110724, + "sha256": "084a6cd2a80a12c415bff33565d39d968196b3a0b7bf06446418eb880c9e4d6e", + "source_sha256": "084a6cd2a80a12c415bff33565d39d968196b3a0b7bf06446418eb880c9e4d6e", + "content_changed_for_archive": false + }, + { + "path": "review/screens/package-unavailable.png", + "bytes": 131244, + "sha256": "17b7a11df4fbd1b986e0349f097f5fc450bb7efd9bf991ac531fb07cf1496cb5", + "source_sha256": "17b7a11df4fbd1b986e0349f097f5fc450bb7efd9bf991ac531fb07cf1496cb5", + "content_changed_for_archive": false + }, + { + "path": "review/screens/pause-confirmed.png", + "bytes": 143086, + "sha256": "e3ee2bef016014a9bcff175ddbd2f055473e0d446d5118116f36b9eee5896558", + "source_sha256": "e3ee2bef016014a9bcff175ddbd2f055473e0d446d5118116f36b9eee5896558", + "content_changed_for_archive": false + }, + { + "path": "review/screens/pause-pending.png", + "bytes": 140231, + "sha256": "98cf6b9260ddb5d8b9af48a5490d93232f55b5fad93668e2ec32753275dc4bc3", + "source_sha256": "98cf6b9260ddb5d8b9af48a5490d93232f55b5fad93668e2ec32753275dc4bc3", + "content_changed_for_archive": false + }, + { + "path": "review/screens/payment-code-expired.png", + "bytes": 98388, + "sha256": "57f438465b17afb0797085384f40bebfac431fda259ac2c4d48a95b31dd4adce", + "source_sha256": "57f438465b17afb0797085384f40bebfac431fda259ac2c4d48a95b31dd4adce", + "content_changed_for_archive": false + }, + { + "path": "review/screens/payment-code-failed.png", + "bytes": 88699, + "sha256": "869a186845aa1f619703ea3b16c739f5a48b12636d60162ff01ca115681126f2", + "source_sha256": "869a186845aa1f619703ea3b16c739f5a48b12636d60162ff01ca115681126f2", + "content_changed_for_archive": false + }, + { + "path": "review/screens/phone-offline.png", + "bytes": 103390, + "sha256": "2fdf1599d2c98703aa02ab6732b69170203e26cd3ec3eb12be72b1dcb4dad054", + "source_sha256": "2fdf1599d2c98703aa02ab6732b69170203e26cd3ec3eb12be72b1dcb4dad054", + "content_changed_for_archive": false + }, + { + "path": "review/screens/photo-permission-denied.png", + "bytes": 166735, + "sha256": "bdb5217a6ee3a912cfd9ba7e3def7f97153da92d48b6e5d50c1831f3c5574d66", + "source_sha256": "bdb5217a6ee3a912cfd9ba7e3def7f97153da92d48b6e5d50c1831f3c5574d66", + "content_changed_for_archive": false + }, + { + "path": "review/screens/photo-storage-full.png", + "bytes": 169615, + "sha256": "8a03be53870666dd193f99e0b0b9265ce82afced57011524c4611c453c34c59a", + "source_sha256": "8a03be53870666dd193f99e0b0b9265ce82afced57011524c4611c453c34c59a", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-busy.png", + "bytes": 116294, + "sha256": "5be15f0c0a5098dca2fa30fd5c2bbab63a12a3d386b87f2bb29f57400cb41f19", + "source_sha256": "5be15f0c0a5098dca2fa30fd5c2bbab63a12a3d386b87f2bb29f57400cb41f19", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-empty.png", + "bytes": 121432, + "sha256": "bbd6cfaae48f424adb9cdf7dda6c2f5f2ff2f218112d7917d6f23120704000c7", + "source_sha256": "bbd6cfaae48f424adb9cdf7dda6c2f5f2ff2f218112d7917d6f23120704000c7", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-existing.png", + "bytes": 114966, + "sha256": "5652719e5fc76ddfc1d924872c28bbff420ca844ca9e4cebc09f5c77db4e59c6", + "source_sha256": "5652719e5fc76ddfc1d924872c28bbff420ca844ca9e4cebc09f5c77db4e59c6", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-location.png", + "bytes": 117760, + "sha256": "13a6d47f3083be8ca652db72794f50babbde0a063b4416351d56d123c7ddf902", + "source_sha256": "13a6d47f3083be8ca652db72794f50babbde0a063b4416351d56d123c7ddf902", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-no-selection.png", + "bytes": 114184, + "sha256": "3ba9cb631b75af982dc86c74315278591b6088d2791d96d6c727c137c39ad552", + "source_sha256": "3ba9cb631b75af982dc86c74315278591b6088d2791d96d6c727c137c39ad552", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-ready.png", + "bytes": 119559, + "sha256": "fa0236d68f3a2efc64cb3711b4908be66bd119b5f53f7723449356d4fd0626a9", + "source_sha256": "fa0236d68f3a2efc64cb3711b4908be66bd119b5f53f7723449356d4fd0626a9", + "content_changed_for_archive": false + }, + { + "path": "review/screens/prepare-unavailable.png", + "bytes": 116979, + "sha256": "b9dba24327ffab9e480433f7eb1a9e35d62d28bb0816257bf34d3fc4dab99449", + "source_sha256": "b9dba24327ffab9e480433f7eb1a9e35d62d28bb0816257bf34d3fc4dab99449", + "content_changed_for_archive": false + }, + { + "path": "review/screens/protection-return.png", + "bytes": 111274, + "sha256": "61e47723f6ca5d369e2df0f421735633964882513a4838e47bfafa5396c6738e", + "source_sha256": "61e47723f6ca5d369e2df0f421735633964882513a4838e47bfafa5396c6738e", + "content_changed_for_archive": false + }, + { + "path": "review/screens/quota-last.png", + "bytes": 118807, + "sha256": "7acd058303aa604b1e6240ea803156ab0e71592d909b9e9bae7d79cf700b8be3", + "source_sha256": "7acd058303aa604b1e6240ea803156ab0e71592d909b9e9bae7d79cf700b8be3", + "content_changed_for_archive": false + }, + { + "path": "review/screens/quota-settling.png", + "bytes": 111088, + "sha256": "6f6c7a9c61a85932a85d3700933b1e69d1aeb04b9f42f51d6acb924c1d073d0f", + "source_sha256": "6f6c7a9c61a85932a85d3700933b1e69d1aeb04b9f42f51d6acb924c1d073d0f", + "content_changed_for_archive": false + }, + { + "path": "review/screens/quota-zero.png", + "bytes": 102440, + "sha256": "e573e058ec0c6d77e23b1db3ffb81d0e1d284ea3b6e04a5b05aaa129abfa80d0", + "source_sha256": "e573e058ec0c6d77e23b1db3ffb81d0e1d284ea3b6e04a5b05aaa129abfa80d0", + "content_changed_for_archive": false + }, + { + "path": "review/screens/resume-command-unknown.png", + "bytes": 117228, + "sha256": "ee878a115b4391b8ed9ca01a7bdb50c57d658e5a4a0e500d6cb823ef0a66328d", + "source_sha256": "ee878a115b4391b8ed9ca01a7bdb50c57d658e5a4a0e500d6cb823ef0a66328d", + "content_changed_for_archive": false + }, + { + "path": "review/screens/resume-pending.png", + "bytes": 149491, + "sha256": "aaa258974682281dbc3cbd1f90937f230895d31e720aebf9214f106737dcb0ff", + "source_sha256": "aaa258974682281dbc3cbd1f90937f230895d31e720aebf9214f106737dcb0ff", + "content_changed_for_archive": false + }, + { + "path": "review/screens/retry-prepare.png", + "bytes": 125754, + "sha256": "b93ade1daab9950cea4d8ead9bdcae3a718387e6bcacc52e2f80815c5cc2072e", + "source_sha256": "b93ade1daab9950cea4d8ead9bdcae3a718387e6bcacc52e2f80815c5cc2072e", + "content_changed_for_archive": false + }, + { + "path": "review/screens/return-active.png", + "bytes": 141310, + "sha256": "fdbd68343146f21be8e5c62e2ae08eca6ef575983df972614c52a8d0a5562de9", + "source_sha256": "fdbd68343146f21be8e5c62e2ae08eca6ef575983df972614c52a8d0a5562de9", + "content_changed_for_archive": false + }, + { + "path": "review/screens/return-paused.png", + "bytes": 147839, + "sha256": "4a714cf0757ba20da18f265ce4250ad8bfcdfa38a4bec39aa5d11e7ccbfdec21", + "source_sha256": "4a714cf0757ba20da18f265ce4250ad8bfcdfa38a4bec39aa5d11e7ccbfdec21", + "content_changed_for_archive": false + }, + { + "path": "review/screens/sales-assignment.png", + "bytes": 99043, + "sha256": "ca4096a0a3c3f2a46903ca790b17819cf4b8986d843852e4f3db2f66bcae33ee", + "source_sha256": "ca4096a0a3c3f2a46903ca790b17819cf4b8986d843852e4f3db2f66bcae33ee", + "content_changed_for_archive": false + }, + { + "path": "review/screens/sales-confirming.png", + "bytes": 91613, + "sha256": "044a6e31f5c78168e9c063483a0e29027d87605108a345fa503e23a00b6c7bc7", + "source_sha256": "044a6e31f5c78168e9c063483a0e29027d87605108a345fa503e23a00b6c7bc7", + "content_changed_for_archive": false + }, + { + "path": "review/screens/sales-detail.png", + "bytes": 132941, + "sha256": "9b781c290073bf44573cae9dcc641720c16a84d322c99c8b677126d5b4046e52", + "source_sha256": "9b781c290073bf44573cae9dcc641720c16a84d322c99c8b677126d5b4046e52", + "content_changed_for_archive": false + }, + { + "path": "review/screens/sales-order.png", + "bytes": 93336, + "sha256": "55f6c516c135d9535dfc530d3376487a93b7d57e428239f80809b525addf1cf8", + "source_sha256": "55f6c516c135d9535dfc530d3376487a93b7d57e428239f80809b525addf1cf8", + "content_changed_for_archive": false + }, + { + "path": "review/screens/sales-packages.png", + "bytes": 143666, + "sha256": "1997642a2ddee5bf82847e80592439c815873c9753fe78378bc42474087a8f5c", + "source_sha256": "1997642a2ddee5bf82847e80592439c815873c9753fe78378bc42474087a8f5c", + "content_changed_for_archive": false + }, + { + "path": "review/screens/sales-unpaid.png", + "bytes": 90436, + "sha256": "b4ab3e7dca2f65ce8252a3e4fbf316592425159ea89844e2213d61060e6134ef", + "source_sha256": "b4ab3e7dca2f65ce8252a3e4fbf316592425159ea89844e2213d61060e6134ef", + "content_changed_for_archive": false + }, + { + "path": "review/screens/start-command-pending.png", + "bytes": 107883, + "sha256": "4fb8428b183057073b6de77b9f60a1d29079228e253a613f21d167887b674df5", + "source_sha256": "4fb8428b183057073b6de77b9f60a1d29079228e253a613f21d167887b674df5", + "content_changed_for_archive": false + }, + { + "path": "review/screens/start-command-unknown.png", + "bytes": 112766, + "sha256": "449b22d76f897b3d6e3433f2042085142987cc33c35350d35038e8871913c531", + "source_sha256": "449b22d76f897b3d6e3433f2042085142987cc33c35350d35038e8871913c531", + "content_changed_for_archive": false + }, + { + "path": "review/screens/stream-only-lost.png", + "bytes": 103203, + "sha256": "e64a8625272ff02c2f1128a4b74ce673754dce5d666da36b808edb3a93dd3d2a", + "source_sha256": "e64a8625272ff02c2f1128a4b74ce673754dce5d666da36b808edb3a93dd3d2a", + "content_changed_for_archive": false + }, + { + "path": "review/screens/summoning.png", + "bytes": 114366, + "sha256": "fe2371c10405e0de01cd0c2a66e8633382c1c002e38bd5067e900fae267c4e18", + "source_sha256": "fe2371c10405e0de01cd0c2a66e8633382c1c002e38bd5067e900fae267c4e18", + "content_changed_for_archive": false + }, + { + "path": "review/screens/task-after-reenter.png", + "bytes": 144654, + "sha256": "dc7d8ccd707ed7630e2e60018943b483d985b3dd1f7b371da976eff76371afda", + "source_sha256": "dc7d8ccd707ed7630e2e60018943b483d985b3dd1f7b371da976eff76371afda", + "content_changed_for_archive": false + }, + { + "path": "review/screens/task-before-leave.png", + "bytes": 143409, + "sha256": "fd04a501fb9390addb86b82eef8d5ae4a06790bdb7f2ad3773348688f36266ea", + "source_sha256": "fd04a501fb9390addb86b82eef8d5ae4a06790bdb7f2ad3773348688f36266ea", + "content_changed_for_archive": false + }, + { + "path": "review/screens/task-syncing.png", + "bytes": 99166, + "sha256": "56c6832aa10b729a154acb59d8d6813fa5095f5275a67508492ee22b849bc20d", + "source_sha256": "56c6832aa10b729a154acb59d8d6813fa5095f5275a67508492ee22b849bc20d", + "content_changed_for_archive": false + }, + { + "path": "review/screens/web-draft.png", + "bytes": 74195, + "sha256": "460fb99286c39d1579169e5f96e67fe8e30a46a0577b8f5dd5b1aae5ff3f6609", + "source_sha256": "460fb99286c39d1579169e5f96e67fe8e30a46a0577b8f5dd5b1aae5ff3f6609", + "content_changed_for_archive": false + }, + { + "path": "review/screens/web-modified.png", + "bytes": 86107, + "sha256": "6bfa36aace4cc6c1966496537fcd644154c469ca715676279f3e5afd7ad18a33", + "source_sha256": "6bfa36aace4cc6c1966496537fcd644154c469ca715676279f3e5afd7ad18a33", + "content_changed_for_archive": false + }, + { + "path": "review/screens/web-offline.png", + "bytes": 75116, + "sha256": "4cd43d02a7844e4f7924fc1015f3a347b9b8cb7b2b1b3d7f406fb54c8fe5814c", + "source_sha256": "4cd43d02a7844e4f7924fc1015f3a347b9b8cb7b2b1b3d7f406fb54c8fe5814c", + "content_changed_for_archive": false + }, + { + "path": "review/screens/web-published.png", + "bytes": 74002, + "sha256": "c34d69fd3f210c8b8f93e20d9719c84920445fe2958812e35eeaaca07d970ddf", + "source_sha256": "c34d69fd3f210c8b8f93e20d9719c84920445fe2958812e35eeaaca07d970ddf", + "content_changed_for_archive": false + }, + { + "path": "review/screens/web-validation.png", + "bytes": 85239, + "sha256": "63fb48db7184a4df07bdd2759974699207c4400fa02de696ea8a8244ea57a7d2", + "source_sha256": "63fb48db7184a4df07bdd2759974699207c4400fa02de696ea8a8244ea57a7d2", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-home.png", + "bytes": 129227, + "sha256": "9dca6197d4103fcafdda32309c80e61d3ae2a5a24bfd146c6895a36cff826632", + "source_sha256": "9dca6197d4103fcafdda32309c80e61d3ae2a5a24bfd146c6895a36cff826632", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-ongoing-pinned.png", + "bytes": 169450, + "sha256": "ff109b8a5fedc919c72f64562fb808a076193fd1a938d48d0c9c4798cab15223", + "source_sha256": "ff109b8a5fedc919c72f64562fb808a076193fd1a938d48d0c9c4798cab15223", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-arrived.png", + "bytes": 158514, + "sha256": "e540fb87471fd3d61ee659e23e4b07451d17987e8b17de21d39d4a06bbb62711", + "source_sha256": "e540fb87471fd3d61ee659e23e4b07451d17987e8b17de21d39d4a06bbb62711", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-outbound.png", + "bytes": 156149, + "sha256": "f694d0668f7f97064e1580b63f2770ff22d46b58abad47bb4b8190148536f102", + "source_sha256": "f694d0668f7f97064e1580b63f2770ff22d46b58abad47bb4b8190148536f102", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-paused.png", + "bytes": 157378, + "sha256": "bcdef5e7ecd1fe92fc5801bc87067b93138227c3017eda54da55ac6a25994383", + "source_sha256": "bcdef5e7ecd1fe92fc5801bc87067b93138227c3017eda54da55ac6a25994383", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-returning.png", + "bytes": 163548, + "sha256": "19be79d83c7ec0814ba4dc2450ee79bb0362f0d8d0192941dfe2a16306808aaf", + "source_sha256": "19be79d83c7ec0814ba4dc2450ee79bb0362f0d8d0192941dfe2a16306808aaf", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-returnpaused.png", + "bytes": 158673, + "sha256": "a2782da0150b6199c2a31137e21e735b9436dea086a9a3a4bb21ea0546c9327e", + "source_sha256": "a2782da0150b6199c2a31137e21e735b9436dea086a9a3a4bb21ea0546c9327e", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-shooting.png", + "bytes": 153984, + "sha256": "151d98d35db3339c677f613316f27ef16509e707eeff4ef4ea2416cbf7d226f4", + "source_sha256": "151d98d35db3339c677f613316f27ef16509e707eeff4ef4ea2416cbf7d226f4", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-status-unknown.png", + "bytes": 151334, + "sha256": "b73aec04bb0cfe0b6c7dbbd6e7d5306d1a2f59e79e13ef2088de2560679346ed", + "source_sha256": "b73aec04bb0cfe0b6c7dbbd6e7d5306d1a2f59e79e13ef2088de2560679346ed", + "content_changed_for_archive": false + }, + { + "path": "review/screens/workbench-success-returning.png", + "bytes": 167700, + "sha256": "583891555a23e99dafd36059a7fcbae58e761a4b40c25edd80c68a1172516498", + "source_sha256": "583891555a23e99dafd36059a7fcbae58e761a4b40c25edd80c68a1172516498", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/build_states.py", + "bytes": 13026, + "sha256": "65c8f02c7675ccdc7966d0d96f79ea4638c78c7ba515f97b59f0a4248851747b", + "source_sha256": "65c8f02c7675ccdc7966d0d96f79ea4638c78c7ba515f97b59f0a4248851747b", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/render-final/page-1.png", + "bytes": 386356, + "sha256": "2d9b468ac8805b57318bed38d9b37ce3b99db1668732f6e1afe9d66ed97b364d", + "source_sha256": "2d9b468ac8805b57318bed38d9b37ce3b99db1668732f6e1afe9d66ed97b364d", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/render-final/page-2.png", + "bytes": 337794, + "sha256": "c0a44220c2826f25c383cfd19f144e5b58c923bce3b755615ff25e9161f89560", + "source_sha256": "c0a44220c2826f25c383cfd19f144e5b58c923bce3b755615ff25e9161f89560", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/render-final/page-3.png", + "bytes": 344895, + "sha256": "92e13b8853a92450b27a50a4c3946fbdf083a762da595c830c59dbf11cbfa181", + "source_sha256": "92e13b8853a92450b27a50a4c3946fbdf083a762da595c830c59dbf11cbfa181", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/render-final/page-4.png", + "bytes": 372812, + "sha256": "fa5353584af92736d0a6dd96b122916dfc2a6904dea4434231c43d1045bc78bf", + "source_sha256": "fa5353584af92736d0a6dd96b122916dfc2a6904dea4434231c43d1045bc78bf", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/render-final/随心瞰9.9.1状态分类与取值清单.pdf", + "bytes": 352501, + "sha256": "f6aa2b130f9bf1474e7a2a6ca89a2eaf5ca6c5af15d5e476590f5925277ec18c", + "source_sha256": "f6aa2b130f9bf1474e7a2a6ca89a2eaf5ca6c5af15d5e476590f5925277ec18c", + "content_changed_for_archive": false + }, + { + "path": "review/state-document/随心瞰9.9.1状态分类与取值清单.docx", + "bytes": 42033, + "sha256": "7f59aa98242735d7c985c3eb05bda0c1be1689f27d22406da82dd2992967246b", + "source_sha256": "7f59aa98242735d7c985c3eb05bda0c1be1689f27d22406da82dd2992967246b", + "content_changed_for_archive": false + }, + { + "path": "review/state-flows-workbench.html", + "bytes": 57170, + "sha256": "7e2e99c7a66c48468d27f270beda9ffbc7de83b4b712dfee559d1780fe10a20b", + "source_sha256": "3cff1a0ca530c7823c2ea86e2946c92b9adade19e6174373724025e879c1524a", + "content_changed_for_archive": true + }, + { + "path": "review/state-flows.html", + "bytes": 57170, + "sha256": "7e2e99c7a66c48468d27f270beda9ffbc7de83b4b712dfee559d1780fe10a20b", + "source_sha256": "3cff1a0ca530c7823c2ea86e2946c92b9adade19e6174373724025e879c1524a", + "content_changed_for_archive": true + }, + { + "path": "review/verification.json", + "bytes": 1833, + "sha256": "989daf970392178b0e193b78564d02e8d217d5d5a5e4f65c1104e8e289e4b9ce", + "source_sha256": "989daf970392178b0e193b78564d02e8d217d5d5a5e4f65c1104e8e289e4b9ce", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/checks.json", + "bytes": 6853, + "sha256": "4627d5532c3a5c8b1ae265a16fbb3b5ec0ee43e9692d34b258919405370d9b11", + "source_sha256": "4627d5532c3a5c8b1ae265a16fbb3b5ec0ee43e9692d34b258919405370d9b11", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/footer.png", + "bytes": 17463, + "sha256": "1ff0c9847b11cd74bc0e8491f636fc2ccceaffec2aaab0e48989f67e98a963a9", + "source_sha256": "1ff0c9847b11cd74bc0e8491f636fc2ccceaffec2aaab0e48989f67e98a963a9", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/header.png", + "bytes": 56501, + "sha256": "8431551b2adb97f984a296e356129dabdf47f6e0dcfbf897be50e73e14850826", + "source_sha256": "8431551b2adb97f984a296e356129dabdf47f6e0dcfbf897be50e73e14850826", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/task-after-reenter.png", + "bytes": 144654, + "sha256": "dc7d8ccd707ed7630e2e60018943b483d985b3dd1f7b371da976eff76371afda", + "source_sha256": "dc7d8ccd707ed7630e2e60018943b483d985b3dd1f7b371da976eff76371afda", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/task-before-leave.png", + "bytes": 143409, + "sha256": "fd04a501fb9390addb86b82eef8d5ae4a06790bdb7f2ad3773348688f36266ea", + "source_sha256": "fd04a501fb9390addb86b82eef8d5ae4a06790bdb7f2ad3773348688f36266ea", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/workbench-ongoing-pinned.png", + "bytes": 169450, + "sha256": "ff109b8a5fedc919c72f64562fb808a076193fd1a938d48d0c9c4798cab15223", + "source_sha256": "ff109b8a5fedc919c72f64562fb808a076193fd1a938d48d0c9c4798cab15223", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/11-workbench-resume/workbench-success-returning.png", + "bytes": 167700, + "sha256": "583891555a23e99dafd36059a7fcbae58e761a4b40c25edd80c68a1172516498", + "source_sha256": "583891555a23e99dafd36059a7fcbae58e761a4b40c25edd80c68a1172516498", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/checks.json", + "bytes": 11357, + "sha256": "451e68d81eddaded97ad98753a7c9087b429e22ceff48daf9767f0708ff35215", + "source_sha256": "451e68d81eddaded97ad98753a7c9087b429e22ceff48daf9767f0708ff35215", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/footer.png", + "bytes": 17463, + "sha256": "1ff0c9847b11cd74bc0e8491f636fc2ccceaffec2aaab0e48989f67e98a963a9", + "source_sha256": "1ff0c9847b11cd74bc0e8491f636fc2ccceaffec2aaab0e48989f67e98a963a9", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/header.png", + "bytes": 47227, + "sha256": "f172385cab4cca9dd4c96d71657ebde58314ab3587cd83e7e27ed855d2c9bef8", + "source_sha256": "f172385cab4cca9dd4c96d71657ebde58314ab3587cd83e7e27ed855d2c9bef8", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-arrived.png", + "bytes": 158514, + "sha256": "e540fb87471fd3d61ee659e23e4b07451d17987e8b17de21d39d4a06bbb62711", + "source_sha256": "e540fb87471fd3d61ee659e23e4b07451d17987e8b17de21d39d4a06bbb62711", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-outbound.png", + "bytes": 156149, + "sha256": "f694d0668f7f97064e1580b63f2770ff22d46b58abad47bb4b8190148536f102", + "source_sha256": "f694d0668f7f97064e1580b63f2770ff22d46b58abad47bb4b8190148536f102", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-paused.png", + "bytes": 157378, + "sha256": "bcdef5e7ecd1fe92fc5801bc87067b93138227c3017eda54da55ac6a25994383", + "source_sha256": "bcdef5e7ecd1fe92fc5801bc87067b93138227c3017eda54da55ac6a25994383", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-returning.png", + "bytes": 163548, + "sha256": "19be79d83c7ec0814ba4dc2450ee79bb0362f0d8d0192941dfe2a16306808aaf", + "source_sha256": "19be79d83c7ec0814ba4dc2450ee79bb0362f0d8d0192941dfe2a16306808aaf", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-returnpaused.png", + "bytes": 158673, + "sha256": "a2782da0150b6199c2a31137e21e735b9436dea086a9a3a4bb21ea0546c9327e", + "source_sha256": "a2782da0150b6199c2a31137e21e735b9436dea086a9a3a4bb21ea0546c9327e", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-shooting.png", + "bytes": 153984, + "sha256": "151d98d35db3339c677f613316f27ef16509e707eeff4ef4ea2416cbf7d226f4", + "source_sha256": "151d98d35db3339c677f613316f27ef16509e707eeff4ef4ea2416cbf7d226f4", + "content_changed_for_archive": false + }, + { + "path": "review/workbench-return/12-workbench-task-states/workbench-status-unknown.png", + "bytes": 151334, + "sha256": "b73aec04bb0cfe0b6c7dbbd6e7d5306d1a2f59e79e13ef2088de2560679346ed", + "source_sha256": "b73aec04bb0cfe0b6c7dbbd6e7d5306d1a2f59e79e13ef2088de2560679346ed", + "content_changed_for_archive": false + }, + { + "path": "review/使用说明.txt", + "bytes": 360, + "sha256": "3690894a9941701dd47ec2a23dccafe8ba25199497bcb1ca31f3fced7f0f7f84", + "source_sha256": "3690894a9941701dd47ec2a23dccafe8ba25199497bcb1ca31f3fced7f0f7f84", + "content_changed_for_archive": false + } + ] +} diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/README.md b/docs/9.9.1/cloud-film-integration-2026-10-30/README.md new file mode 100644 index 0000000..a1d6104 --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/README.md @@ -0,0 +1,31 @@ +# 云端成片上传联调(2026-10-30) + +测试环境 `api-test.zhifly.cn`,iPhone 17 Pro 模拟器。使用用户指定订单的已有任务 `13`,景区 `271`。视频来自工程资源 `drone_material_demo.mp4`,选择时命名为 `接口联调演示视频.mp4`,大小 93,058 字节。以下为真实 API / OSS 结果,视频是演示素材,不能当作游客真实交付作品。 + +## 调用链路 + +1. 张工 `GET /api/yf-handset-app/photog/multi-plane/orders/detail` 和 `GET /api/yf-handset-app/photog/multi-plane/tasks`:读取订单、选择有效任务并复核权限。 +2. 通用 `GET /api/app/config/get-sts-token?bucket=default`:同一登录 Token,日志不输出临时凭证。 +3. OSS SDK 文件流上传,`Content-Type: video/mp4`,使用 STS 配置的 bucket / endpoint / region。 +4. 再读详情与任务后,调用张工 `POST /api/yf-handset-app/photog/multi-plane/tasks/film`,仅提交 `scenic_id/task_id/file_url/file_name`。 +5. 保存成功后展示回执,并刷新详情与任务;刷新失败仍保留保存成功提示。未调用任务创建、机场操作、实时图传或游客确认接口。 + +## 真实结果 + +| 场景 | 证据 | 结果 | +| --- | --- | --- | +| 中文编码对象路径,16:33:54 | [请求](film-save-encoded-request.json)、[响应](film-save-encoded-response.json) | HTTP 200,业务 `code=0`,获取文件信息失败,RequestId `6AE4567285274E36322D3459` | +| 同一对象直接 HEAD,16:35:33 | [HEAD](encoded-object-head.txt) | HTTP 200,`video/mp4`,93,058 字节;排除本次对象缺失、空文件、MIME 错误 | +| ASCII 对象路径,中文业务名称,16:39:52 | [请求](film-save-ascii-request.json)、[响应](film-save-ascii-response.json) | `code=100000`,`task_id=13`、`film.id=1`,返回封面与大小 | +| 保存后详情,16:39:53 | [脱敏完整摘要](detail-after-redacted.json) | `film_count=1`、`order_status=20`,并未完成游客确认 | +| 保存后任务,16:39:53 | [任务 13 节选](task-after-excerpt.json) | `film` 的 ID、URL、原中文名与保存回执一致 | + +客户端修复只涉及成片上传器:将 `film.<小写扩展名>` 交给既有 UUID 对象键规则,原中文文件名仍提交给 `tasks/film.file_name`。不更换 STS 返回的域名,不给 URL 加签名参数,不改通用上传模块。编码路径失败与 ASCII 路径成功形成对比证据;后端具体解析行为尚未核查,需张工结合 RequestId 定位。 + +首次失败的演示视频仍在 OSS,未删除远程对象;没有覆盖任何原有成片。保存接口成功一次,订单新增一条演示成片。 + +## 自动化验证 + +55 项模拟器测试通过,0 失败:API 7、上传器 10、ViewModel 20、页面 11、完整链路 4、订单/素材/确认入口导航各 1。新增完整链路测试串联正式 APIClient、UploadAPI、FilmUploader、DeliveryAPI、ViewModel,仅网络与 OSS 边界使用隔离替身;覆盖原文件名保留、STS 配置、MIME、四字段保存、读回、保存失败复用 URL 重试及上传后权限变化。 + +测试结果:`test_sim_2026-10-30T08-37-30-269Z_pid29946_3797c2e7.xcresult`。真实成功请求来自后续 App 手动选择视频并上传,不来源于单元测试。 diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/detail-after-redacted.json b/docs/9.9.1/cloud-film-integration-2026-10-30/detail-after-redacted.json new file mode 100644 index 0000000..1de3a2b --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/detail-after-redacted.json @@ -0,0 +1,34 @@ +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 1, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 4, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 1, + "spot": [ + { + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "" + }, + "msg": "success", + "time": "2026-10-30 16:39:53" +} diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/encoded-object-head.txt b/docs/9.9.1/cloud-film-integration-2026-10-30/encoded-object-head.txt new file mode 100644 index 0000000..6bce91f --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/encoded-object-head.txt @@ -0,0 +1,11 @@ +Source: read-only HTTP HEAD against the exact file_url in film-save-encoded-request.json. +The body is the bundled demo video, not a real tourist delivery. + +HTTP/1.1 200 OK +Server: AliyunOSS +Date: Fri, 30 Oct 2026 08:35:33 GMT +Content-Type: video/mp4 +Content-Length: 93058 +x-oss-request-id: 6AE456D50D39F7383544E0B9 +ETag: "CDFAD5B0957C3157BE6ECC4EF93E274F" +Last-Modified: Fri, 30 Oct 2026 08:33:52 GMT diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-ascii-request.json b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-ascii-request.json new file mode 100644 index 0000000..78c54c0 --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-ascii-request.json @@ -0,0 +1,6 @@ +{ + "file_name": "接口联调演示视频.mp4", + "file_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/task/20261030/271/23d8c8a285c946fca620e1fdfd5c52ae_film.mp4", + "scenic_id": 271, + "task_id": 13 +} diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-ascii-response.json b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-ascii-response.json new file mode 100644 index 0000000..10f4f38 --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-ascii-response.json @@ -0,0 +1,19 @@ +{ + "code": 100000, + "data": { + "film": { + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/task/20261030/271/23d8c8a285c946fca620e1fdfd5c52ae_film.jpg", + "created_at": "2026-10-30 16:39:52", + "deleted_at": null, + "file_name": "接口联调演示视频.mp4", + "file_size": 93058, + "file_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/task/20261030/271/23d8c8a285c946fca620e1fdfd5c52ae_film.mp4", + "id": 1, + "task_id": 13, + "updated_at": "2026-10-30 16:39:52" + }, + "task_id": 13 + }, + "msg": "success", + "time": "2026-10-30 16:39:52" +} diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-encoded-request.json b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-encoded-request.json new file mode 100644 index 0000000..e8e80cd --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-encoded-request.json @@ -0,0 +1,6 @@ +{ + "scenic_id": 271, + "task_id": 13, + "file_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/task/20261030/271/cc756dddbfc54e9892b326b94763bf40_%E6%8E%A5%E5%8F%A3%E8%81%94%E8%B0%83%E6%BC%94%E7%A4%BA%E8%A7%86%E9%A2%91.mp4", + "file_name": "接口联调演示视频.mp4" +} diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-encoded-response.json b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-encoded-response.json new file mode 100644 index 0000000..62f383e --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/film-save-encoded-response.json @@ -0,0 +1,6 @@ +{ + "code": 0, + "data": [], + "msg": "获取文件信息失败: RequestId: 6AE4567285274E36322D3459", + "time": "2026-10-30 16:33:54" +} diff --git a/docs/9.9.1/cloud-film-integration-2026-10-30/task-after-excerpt.json b/docs/9.9.1/cloud-film-integration-2026-10-30/task-after-excerpt.json new file mode 100644 index 0000000..2009917 --- /dev/null +++ b/docs/9.9.1/cloud-film-integration-2026-10-30/task-after-excerpt.json @@ -0,0 +1,28 @@ +{ + "source": "真实 tasks 响应节选;仅记录本次交付任务,订单号已脱敏", + "code": 100000, + "msg": "success", + "time": "2026-10-30 16:39:53", + "data": { + "order_number": "TEST-ORDER-001", + "total": 13, + "task": { + "id": 13, + "task_id": 13, + "scenic_spot_id": 412, + "flight_status": 10, + "material_status": 0, + "film": { + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/task/20261030/271/23d8c8a285c946fca620e1fdfd5c52ae_film.jpg", + "created_at": "2026-10-30 16:39:52", + "deleted_at": null, + "file_name": "接口联调演示视频.mp4", + "file_size": 93058, + "file_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/task/20261030/271/23d8c8a285c946fca620e1fdfd5c52ae_film.mp4", + "id": 1, + "task_id": 13, + "updated_at": "2026-10-30 16:39:52" + } + } + } +} diff --git a/docs/9.9.1/delivery-integration-2026-10-29/detail-redacted.json b/docs/9.9.1/delivery-integration-2026-10-29/detail-redacted.json new file mode 100644 index 0000000..a8ead64 --- /dev/null +++ b/docs/9.9.1/delivery-integration-2026-10-29/detail-redacted.json @@ -0,0 +1,34 @@ +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "spot": [ + { + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0001" + }, + "msg": "success", + "time": "2026-10-29 09:57:48" +} diff --git a/docs/9.9.1/delivery-integration-2026-10-29/tasks-redacted.json b/docs/9.9.1/delivery-integration-2026-10-29/tasks-redacted.json new file mode 100644 index 0000000..1eb72f5 --- /dev/null +++ b/docs/9.9.1/delivery-integration-2026-10-29/tasks-redacted.json @@ -0,0 +1,10 @@ +{ + "code": 100000, + "data": { + "list": [], + "order_number": "TEST-ORDER-001", + "total": 0 + }, + "msg": "success", + "time": "2026-10-29 09:57:48" +} diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-completed.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-completed.png new file mode 100644 index 0000000..b1fadd9 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-completed.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-confirmation-code.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-confirmation-code.png new file mode 100644 index 0000000..793287f Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-confirmation-code.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-method.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-method.png new file mode 100644 index 0000000..8901360 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-method.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-order-summary.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-order-summary.png new file mode 100644 index 0000000..db1293d Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-order-summary.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-partial-failure.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-partial-failure.png new file mode 100644 index 0000000..29119a5 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-partial-failure.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-paused.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-paused.png new file mode 100644 index 0000000..bc3ce1d Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-paused.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-point-empty.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-point-empty.png new file mode 100644 index 0000000..5485008 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-point-empty.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-point-prefilled.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-point-prefilled.png new file mode 100644 index 0000000..580974a Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-point-prefilled.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-receipt.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-receipt.png new file mode 100644 index 0000000..9a4b2da Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-receipt.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-review.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-review.png new file mode 100644 index 0000000..59dfa92 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-review.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-uploading.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-uploading.png new file mode 100644 index 0000000..dee7331 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-uploading.png differ diff --git a/docs/9.9.1/delivery-ui-2026-10-23/delivery-video-picker.png b/docs/9.9.1/delivery-ui-2026-10-23/delivery-video-picker.png new file mode 100644 index 0000000..a009e54 Binary files /dev/null and b/docs/9.9.1/delivery-ui-2026-10-23/delivery-video-picker.png differ diff --git a/docs/9.9.1/home-split-integration-2026-10-28/home-real-simulator.jpg b/docs/9.9.1/home-split-integration-2026-10-28/home-real-simulator.jpg new file mode 100644 index 0000000..abe07f8 Binary files /dev/null and b/docs/9.9.1/home-split-integration-2026-10-28/home-real-simulator.jpg differ diff --git a/docs/9.9.1/home-split-integration-2026-10-28/home-response.json b/docs/9.9.1/home-split-integration-2026-10-28/home-response.json new file mode 100644 index 0000000..92dd49d --- /dev/null +++ b/docs/9.9.1/home-split-integration-2026-10-28/home-response.json @@ -0,0 +1,108 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "河南嵩山", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GF", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "id": 57, + "is_receive_order": 2, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "那拉提M4D", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GC", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-28 15:51:40" +} diff --git a/docs/9.9.1/home-split-integration-2026-10-28/home-statistics-real-simulator.jpg b/docs/9.9.1/home-split-integration-2026-10-28/home-statistics-real-simulator.jpg new file mode 100644 index 0000000..12369dd Binary files /dev/null and b/docs/9.9.1/home-split-integration-2026-10-28/home-statistics-real-simulator.jpg differ diff --git a/docs/9.9.1/home-split-integration-2026-10-28/orders-response.json b/docs/9.9.1/home-split-integration-2026-10-28/orders-response.json new file mode 100644 index 0000000..3147049 --- /dev/null +++ b/docs/9.9.1/home-split-integration-2026-10-28/orders-response.json @@ -0,0 +1,50 @@ +{ + "code": 100000, + "data": { + "list": [ + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "132****9413" + }, + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:16:18", + "film_count": 0, + "material_status": 0, + "order_number": "261027271001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "183****5710" + } + ], + "page": 1, + "page_size": 20, + "total": 2 + }, + "msg": "success", + "time": "2026-10-28 15:51:40" +} diff --git a/docs/9.9.1/home-split-integration-2026-10-28/today-stats-response.json b/docs/9.9.1/home-split-integration-2026-10-28/today-stats-response.json new file mode 100644 index 0000000..5d74f61 --- /dev/null +++ b/docs/9.9.1/home-split-integration-2026-10-28/today-stats-response.json @@ -0,0 +1,15 @@ +{ + "code": 100000, + "data": { + "cash_paid": "0.00", + "cash_refund": "0.00", + "completed_count": 0, + "deal_amount": "0.00", + "deal_count": 0, + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + }, + "msg": "success", + "time": "2026-10-28 15:51:40" +} diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/README.md b/docs/9.9.1/live-resummon-mock-2026-10-30/README.md new file mode 100644 index 0000000..82a7eab --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/README.md @@ -0,0 +1,52 @@ +# 实时图传与重新召唤:本地模拟验证 + +日期:2026-10-30。iPhone 17 Pro / iOS 27 模拟器。 + +**用户再次确认当前禁飞。本目录全部接口回执为纯内存 Mock,`network_sent=false`;没有真实调用 `live/shoot`,没有创建真实待飞任务,也没有连接无人机。视频来自随包 `drone_material_demo.mp4`。** + +## 当前实现 + +- `DroneDockLiveAPI`:`GET /api/app/airport/live?id=901`,解析现有文档字段、校验原订单任务身份。文档缺少播放协议及参数,不能据此建立真实图传。 +- 图传区域支持加载、失败、缺参数与本地样片;注入本地文件后始终显示“本地模拟画面 · 未连接无人机”,离页或后台释放播放器;无定时轮询。正式入口不注入图传服务。 +- `DroneDockShootAPI.resummon`:只发送 `{"id":901,"restart":true}`,不创建新任务、不传 `plane_id` 或覆盖航线。 +- 重召唤成功后仅 `GET shooting` 一次,由同任务的新快照更新页面;在途保持旧读数和固定布局。连点防重、拒绝可手动重试,超时/取消/异常回执只允许核对,旧失败快照不会使同一请求重发。正式入口不注入重召唤服务。 +- 原 `DeviceCommandDebugPolicy` 未改动,所有真实 `live/shoot/start-shoot/command` 仍在网络发送前拦截,无运行时放行开关。 + +## 启动方式 + +| 模拟场景 | 启动参数 | +| --- | --- | +| 失败后重新召唤 | `--dock-resummon-mock` | +| 拒绝/超时 | 加 `--dock-resummon-result=business-failure` 或 `timeout` | +| 图传本地视频 | `--dock-live-mock` | +| 缺参数/拒绝/超时 | 加 `--dock-live-result=missing-parameters`、`business-failure` 或 `timeout` | +| 同页验证两个功能 | `--dock-resummon-mock --dock-live-mock` | + +这些参数只选择完全隔离的本地会话,不能解锁真实请求。 + +## 验证结果 + +累计 **168 个不同相关用例已取得通过结果**,涵盖新增 API、ViewModel、UI、现有开拍/控制、固定布局与禁飞保护。首轮 165/168 通过,3 个新 UI 用例误定位到隐藏的普通主按钮;改用失败页 `failureRetry` 后,相关 UI、固定布局和既有交互 **38 项复跑全部通过,0 失败、0 跳过**。最终模拟器构建通过,`git diff --check` 通过。 + +- 首轮结果包:`test_sim_2026-10-30T10-12-51-905Z_pid29946_b56e8f3b.xcresult`。 +- 复跑结果包:`test_sim_2026-10-30T10-15-15-960Z_pid29946_11613c70.xcresult`。 +- 下表 JSON 和缺参数截图导出自复跑用例附件;每份 JSON 都明确标记 `source=local_mock`、`network_sent=false`。 +- 最终手动验证使用两个模拟启动参数:图传显示本地样片;点击失败页重召唤,原任务回查后展示“无人机已到达(模拟)”。未点击真实入口、未向网络转发。 + +| 场景 | 完整模拟回执 | +| --- | --- | +| 同一任务重召唤成功,单次 POST 后查询 | [resummon-success.mock.json](resummon-success.mock.json) | +| 明确拒绝后手动再试 | [resummon-rejected.mock.json](resummon-rejected.mock.json) | +| 超时后只读回查,不重复 POST | [resummon-timeout.mock.json](resummon-timeout.mock.json) | +| 图传已知字段 + 独立本地视频注入 | [live-success.mock.json](live-success.mock.json) | +| 仅文档现有字段,提示缺少播放参数 | [live-missing-parameters.json](live-missing-parameters.json) | +| 图传明确拒绝 | [live-rejected.mock.json](live-rejected.mock.json) | +| 图传超时 | [live-timeout.mock.json](live-timeout.mock.json) | + +| 失败页与本地画面 | 重召唤后同任务状态 | 缺少真实播放参数 | +| --- | --- | --- | +| ![失败页与本地画面](before-resummon-local.jpg) | ![模拟重召唤回查](after-resummon-local.jpg) | ![缺少图传参数](live-missing-parameters.png) | + +## 后端待确认 + +可直接转发工程根目录 [朱工-实时图传与重新召唤接口确认.md](../../../朱工-实时图传与重新召唤接口确认.md)。真实图传播放协议、凭证生命周期,以及重召唤权限、重启和幂等语义仍待补齐。本地验证不替代后端或真实设备验收,禁飞限制继续生效。 diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/after-resummon-local.jpg b/docs/9.9.1/live-resummon-mock-2026-10-30/after-resummon-local.jpg new file mode 100644 index 0000000..4561980 Binary files /dev/null and b/docs/9.9.1/live-resummon-mock-2026-10-30/after-resummon-local.jpg differ diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/before-resummon-local.jpg b/docs/9.9.1/live-resummon-mock-2026-10-30/before-resummon-local.jpg new file mode 100644 index 0000000..042a648 Binary files /dev/null and b/docs/9.9.1/live-resummon-mock-2026-10-30/before-resummon-local.jpg differ diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/live-missing-parameters.json b/docs/9.9.1/live-resummon-mock-2026-10-30/live-missing-parameters.json new file mode 100644 index 0000000..6be92c2 --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/live-missing-parameters.json @@ -0,0 +1,177 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : true, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "start_shoot", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "arrived_pending_start", + "title" : "无人机已到达(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/live", + "query" : "id=901", + "response_body" : { + "code" : 100000, + "data" : { + "airport" : { + + }, + "airport_sn" : "LOCAL-MOCK-DOCK-201", + "drone" : { + + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task_id" : 901, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + } + }, + "msg" : "local mock success" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/live-missing-parameters.png b/docs/9.9.1/live-resummon-mock-2026-10-30/live-missing-parameters.png new file mode 100644 index 0000000..5d8a823 Binary files /dev/null and b/docs/9.9.1/live-resummon-mock-2026-10-30/live-missing-parameters.png differ diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/live-rejected.mock.json b/docs/9.9.1/live-resummon-mock-2026-10-30/live-rejected.mock.json new file mode 100644 index 0000000..d59406e --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/live-rejected.mock.json @@ -0,0 +1,148 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : true, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "start_shoot", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "arrived_pending_start", + "title" : "无人机已到达(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/live", + "query" : "id=901", + "response_body" : { + "code" : 100099, + "data" : { + + }, + "msg" : "本地模拟:图传连接不可用" + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/live", + "query" : "id=901", + "response_body" : { + "code" : 100099, + "data" : { + + }, + "msg" : "本地模拟:图传连接不可用" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/live-success.mock.json b/docs/9.9.1/live-resummon-mock-2026-10-30/live-success.mock.json new file mode 100644 index 0000000..6be92c2 --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/live-success.mock.json @@ -0,0 +1,177 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : true, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "start_shoot", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "arrived_pending_start", + "title" : "无人机已到达(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/live", + "query" : "id=901", + "response_body" : { + "code" : 100000, + "data" : { + "airport" : { + + }, + "airport_sn" : "LOCAL-MOCK-DOCK-201", + "drone" : { + + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task_id" : 901, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + } + }, + "msg" : "local mock success" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/live-timeout.mock.json b/docs/9.9.1/live-resummon-mock-2026-10-30/live-timeout.mock.json new file mode 100644 index 0000000..e26dfde --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/live-timeout.mock.json @@ -0,0 +1,134 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : true, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "start_shoot", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "arrived_pending_start", + "title" : "无人机已到达(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "error" : "未能完成操作。(NSURLErrorDomain错误-1001。)", + "method" : "GET", + "path" : "/api/app/airport/live", + "query" : "id=901" + }, + { + "error" : "未能完成操作。(NSURLErrorDomain错误-1001。)", + "method" : "GET", + "path" : "/api/app/airport/live", + "query" : "id=901" + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-rejected.mock.json b/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-rejected.mock.json new file mode 100644 index 0000000..e9cfc1d --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-rejected.mock.json @@ -0,0 +1,147 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "failed", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "ui" : { + "commands" : [ + + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "failed", + "title" : "本地模拟:航线执行失败,可验证重新召唤流程" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "POST", + "path" : "/api/app/airport/shoot", + "request_body" : { + "id" : 901, + "restart" : true + }, + "response_body" : { + "code" : 100099, + "data" : { + + }, + "msg" : "本地模拟:设备暂不可用,重新召唤被拒绝" + } + }, + { + "http_status" : 200, + "method" : "POST", + "path" : "/api/app/airport/shoot", + "request_body" : { + "id" : 901, + "restart" : true + }, + "response_body" : { + "code" : 100099, + "data" : { + + }, + "msg" : "本地模拟:设备暂不可用,重新召唤被拒绝" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-success.mock.json b/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-success.mock.json new file mode 100644 index 0000000..7a5b55e --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-success.mock.json @@ -0,0 +1,261 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "failed", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "ui" : { + "commands" : [ + + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "failed", + "title" : "本地模拟:航线执行失败,可验证重新召唤流程" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "POST", + "path" : "/api/app/airport/shoot", + "request_body" : { + "id" : 901, + "restart" : true + }, + "response_body" : { + "code" : 100000, + "data" : { + "airport_sn" : "LOCAL-MOCK-DOCK-201", + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_flight_task_id" : 901, + "plane_id" : 201, + "task_uuid" : "LOCAL-MOCK-TASK-UUID-901", + "ui" : { + "message" : "本地模拟召唤成功,没有网络或设备指令。", + "phase" : "arrived_pending_start", + "title" : "无人机已到达(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : true, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "start_shoot", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "arrived_pending_start", + "title" : "无人机已到达(模拟)" + } + }, + "msg" : "local mock success" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-timeout.mock.json b/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-timeout.mock.json new file mode 100644 index 0000000..2a829f0 --- /dev/null +++ b/docs/9.9.1/live-resummon-mock-2026-10-30/resummon-timeout.mock.json @@ -0,0 +1,230 @@ +{ + "command_scenario" : "success", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "failed", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "ui" : { + "commands" : [ + + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "failed", + "title" : "本地模拟:航线执行失败,可验证重新召唤流程" + } + }, + "msg" : "local mock success" + } + }, + { + "error" : "未能完成操作。(NSURLErrorDomain错误-1001。)", + "method" : "POST", + "path" : "/api/app/airport/shoot", + "request_body" : { + "id" : 901, + "restart" : true + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 空闲 · 电量95%", + "work_status" : 1, + "work_status_label" : "空闲" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "ok", + "message" : "本地模拟:允许验证开拍请求", + "primary_action" : "failed", + "primary_action_label" : "开始拍摄" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "result_message" : "本地模拟:航线执行失败,无人机空闲待命。", + "scenic_id" : 128, + "status" : 40, + "status_label" : "任务失败(模拟)", + "wayline_status" : 91, + "wayline_status_label" : "执行失败(模拟)" + }, + "ui" : { + "commands" : [ + + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "failed", + "title" : "本地模拟:航线执行失败,可验证重新召唤流程" + } + }, + "msg" : "local mock success" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/live-rtc-integration-2026-11-02/README.md b/docs/9.9.1/live-rtc-integration-2026-11-02/README.md new file mode 100644 index 0000000..8ea6349 --- /dev/null +++ b/docs/9.9.1/live-rtc-integration-2026-11-02/README.md @@ -0,0 +1,75 @@ +# 火山实时图传客户端接入 + +日期:2026-11-02。 + +依据:朱工更新的 `随心瞰9.9.1-App机巢与素材库接口.md`,来源为用户 Downloads 目录文件。 + +## 实现范围 + +- 接入官方 VolcEngineRTC `3.60.107.1100`(Core、RealXBase、RTCFFmpeg),同时包含真机和 Apple Silicon 模拟器架构。CocoaPods 固定官方 podspec 地址,运行 `pod install` 可重建依赖。 +- 使用原订单飞行任务 ID 请求 `GET /api/app/airport/live?id=...`,不创建任务,不调用 shoot/start-shoot/command。 +- 解析 `playable`、`play.available`、`play.url_type`、`play.url`、`play.expire_ts`。当前仅支持已明确合同的 `volc`;其它供应商显示不支持,不自行重复请求 live 来尝试切换供应商。 +- 火山连接串按 querystring 解析 `app_id`、`room_id`、`user_id`、`token`、可选 `expire_time`。拒绝重复键、非法转义、空参数及过期凭证;Token 百分号只解码一次,保留加号和等号。 +- 以隐藏接收端进房,关闭音视频发布、音频订阅和自动视频订阅,只订阅凭证对应房间的主视频流,不开启手机摄像头或麦克风。 +- 只有首帧渲染回调后显示实时画面。进房错误、订阅失败、20 秒未收到首帧、断线、凭证到期均显示原因;用户手动重新获取,不做接口轮询。 +- 离页、进入后台及切换会话会销毁旧 RTC 房间和播放器,旧事件不能更新新会话。结束本机订阅不代表向设备发送停止推流命令。 +- live 响应正文不写入 API 控制台日志;页面诊断 JSON 中的 url/token 递归脱敏。连接凭证仅保存在内存。 + +## 正式包使用方式 + +1. 用 `suixinkan.xcworkspace` 的 `suixinkan` Scheme 打 Release 包,环境沿用工程原有设置,本次没有切换服务器地址或签名。 +2. 打开“订单素材库”,点击右上角“查看任务”,选择已有任务,再点图传区域的“开启实时图传”。单任务直接进入,多任务弹出选择;空任务列表入口禁用。进入页面本身不调用 live。 +3. 后端返回 `url_type=volc` 且有效参数后开始连接;等待首帧。若返回其它供应商、无流或过期信息,界面显示具体状态。 +4. 回到前台或重新进入页面,需要再次手动开启。刷新任务状态只请求 `shooting&live_battery=0`。 + +已有任务须已在后台锁定设备并满足 live 前置条件。客户端不会通过创建任务或召唤无人机来补齐这些条件。 + +## 禁飞与验证边界 + +用户稍后自行打包测试。本次不启动真实设备图传、不创建真实任务、不发送飞控命令;Debug 网络边界和 RTC 初始化前的拦截均保留。真实任务创建和飞控请求在 Debug、Release 两种构建中都拦截,准备页召唤保持禁用。正式任务入口仍未注入开始拍摄、重新召唤或安全控制服务。 + +朱工提供的阿里云 HLS 测试流与火山 RTC 协议不同,本次 RTC 连接状态由内存替身验证,不把本地视频或 HLS 播放作为真实 RTC 联调成功。真实参数、进房鉴权、远端首帧与设备画面需用户后续联调验证。 + +声网参数仍为参考字段,缺少本项目完整回执;腾讯、SRS 同样未接播放器。这些类型会显示明确提示。 + +## 官方依据 + +- [火山 iOS 接入说明](https://docs.volcengine.com/docs/real-time-communication/ios-swift-audio-video-calls?lang=zh) +- [固定版本 podspec](https://github.com/volcengine/volcengine-specs/blob/master/VolcEngineRTC/3.60.107.1100/VolcEngineRTC.podspec.json) +- SDK 3.60 回调和进房签名以安装版本的官方头文件为准,使用 ByteRTCEngine、ByteRTCRoom 和按 streamId 订阅的视频接口。 + +## 响应结构示例 + +以下仅展示朱工合同中的字段结构,身份和凭证均为占位,不是本次真实请求的响应: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "plane_id": 5, + "airport_sn": "TEST-AIRPORT", + "playable": true, + "unavailable_code": "", + "unavailable_message": "", + "play": { + "available": true, + "role": "drone", + "device_sn": "TEST-DRONE", + "url_type": "volc", + "url": "app_id=TEST_APP&room_id=TEST_ROOM&user_id=TEST_USER&token=REDACTED&expire_time=2000000600", + "expire_ts": 2000000600 + }, + "task": { "id": 501 }, + "metrics": [] + } +} +``` + +## 本地验证 + +- 最终相关测试:151 项通过,0 失败、0 跳过。覆盖连接参数、Token 转义与脱敏、首帧与失败状态、会话作废、手动开启、已有任务入口、准备页、素材页和固定布局。 +- XCTest 结果:`~/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-11-02T02-53-09-123Z_pid7237_36daf30f.xcresult`。 +- 使用不定义 DEBUG 的 Swift 离线程序验证 Release 请求边界:8 种飞控/创建请求组合均阻断;手动 live 请求允许通过;shooting 强制使用缓存电量。程序只构造 URLRequest,不创建网络传输。 +- 最终 Release 真机架构未签名构建通过(`suixinkan` Scheme、`generic/platform=iOS`、`CODE_SIGNING_ALLOWED=NO`)。没有安装或运行 Release App。构建日志:`/private/tmp/suixinkan-rtc-release-final-build.log`。 diff --git a/docs/9.9.1/materials-download-2026-10-30/README.md b/docs/9.9.1/materials-download-2026-10-30/README.md new file mode 100644 index 0000000..d216573 --- /dev/null +++ b/docs/9.9.1/materials-download-2026-10-30/README.md @@ -0,0 +1,33 @@ +# 订单素材库下载与保存相册验证 + +日期:2026-10-30。iPhone 17 Pro 模拟器,SimulatorDebug。 + +## 实现 + +使用张工 `tasks.list[].materials[].file_url` 直接下载,仅选择就绪且地址有效的图片/视频,不包含成片。无需新增业务接口,不调用 `mark-download`。下载文件保存在临时目录,Photos 成功创建资产后计为完成,随后清理临时文件。 + +支持进度、暂停/继续、取消、失败项重试及相册权限设置引导;切入后台暂停,离开页面取消;同一页面已保存项目不重复下载/保存。首次授权弹窗不会被误判为后台暂停。 + +## 模拟器实操 + +本次订单及任务均为内存样例,媒体为工程内置演示素材,不是后端真实订单下载记录。使用正式 URLSession 下载器和 Photos 保存器,通过仅监听 `127.0.0.1` 的本机测试服务提供媒体: + +```text +--dock-materials-mock=ready +--dock-materials-download-local=http://127.0.0.1:18765 + +17:38:15 GET /demo.mp4 HTTP/1.1 200 +17:38:29 GET /demo.jpg HTTP/1.1 200 +``` + +手动选择一段视频和一张图片,点击下载并允许“添加照片和视频”权限。页面显示“已保存 2 项”;模拟器相册资产由图片 6 / 视频 2 变为图片 7 / 视频 3,确认各新增一项。未调用任何飞控、任务创建或业务写入接口。 + +![保存完成](download-saved-simulator.jpg) + +普通 `--dock-materials-mock` 始终使用下载/保存替身,不访问网络和系统相册,结果显示“演示完成”。只有显式且合法的回环地址参数搭配 `ready` 场景才启用本机下载验证;其他地址回退隔离演示。 + +## 自动化验证 + +56 项不同的相关测试通过,0 失败、0 跳过:下载状态 8、素材 ViewModel 22、素材页面 15、模拟入口 5、复用下载服务 6。覆盖成功保存、部分失败只重试失败项、权限拒绝停止批次、暂停/取消竞态、账号范围变化、临时文件清理和模拟隔离。 + +首轮 53 项、补充 3 项模拟入口测试通过;调整下载前身份校验后,素材 ViewModel 22 项另行复跑通过。网络和相册在自动化测试中均隔离,实际 HTTP 与 Photos 写入证据以本节模拟器实操为准。 diff --git a/docs/9.9.1/materials-download-2026-10-30/download-saved-simulator.jpg b/docs/9.9.1/materials-download-2026-10-30/download-saved-simulator.jpg new file mode 100644 index 0000000..a6ccd17 Binary files /dev/null and b/docs/9.9.1/materials-download-2026-10-30/download-saved-simulator.jpg differ diff --git a/docs/9.9.1/materials-integration-2026-10-28/detail-redacted.json b/docs/9.9.1/materials-integration-2026-10-28/detail-redacted.json new file mode 100644 index 0000000..10948af --- /dev/null +++ b/docs/9.9.1/materials-integration-2026-10-28/detail-redacted.json @@ -0,0 +1,34 @@ +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "spot": [ + { + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0001" + }, + "msg": "success", + "time": "2026-10-28 17:57:44" +} diff --git a/docs/9.9.1/materials-integration-2026-10-28/materials-all-real.jpg b/docs/9.9.1/materials-integration-2026-10-28/materials-all-real.jpg new file mode 100644 index 0000000..ba96971 Binary files /dev/null and b/docs/9.9.1/materials-integration-2026-10-28/materials-all-real.jpg differ diff --git a/docs/9.9.1/materials-integration-2026-10-28/tasks-412-redacted.json b/docs/9.9.1/materials-integration-2026-10-28/tasks-412-redacted.json new file mode 100644 index 0000000..730b932 --- /dev/null +++ b/docs/9.9.1/materials-integration-2026-10-28/tasks-412-redacted.json @@ -0,0 +1,10 @@ +{ + "code": 100000, + "data": { + "list": [], + "order_number": "TEST-ORDER-004", + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:57:53" +} diff --git a/docs/9.9.1/materials-integration-2026-10-28/tasks-413-redacted.json b/docs/9.9.1/materials-integration-2026-10-28/tasks-413-redacted.json new file mode 100644 index 0000000..9035f8d --- /dev/null +++ b/docs/9.9.1/materials-integration-2026-10-28/tasks-413-redacted.json @@ -0,0 +1,10 @@ +{ + "code": 100000, + "data": { + "list": [], + "order_number": "TEST-ORDER-004", + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:58:21" +} diff --git a/docs/9.9.1/materials-integration-2026-10-28/tasks-all-redacted.json b/docs/9.9.1/materials-integration-2026-10-28/tasks-all-redacted.json new file mode 100644 index 0000000..dccb08a --- /dev/null +++ b/docs/9.9.1/materials-integration-2026-10-28/tasks-all-redacted.json @@ -0,0 +1,10 @@ +{ + "code": 100000, + "data": { + "list": [], + "order_number": "TEST-ORDER-004", + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:57:44" +} diff --git a/docs/9.9.1/materials-ui-2026-10-23/download-completed.png b/docs/9.9.1/materials-ui-2026-10-23/download-completed.png new file mode 100644 index 0000000..2994ff0 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/download-completed.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/download-partial-failure.png b/docs/9.9.1/materials-ui-2026-10-23/download-partial-failure.png new file mode 100644 index 0000000..b0b84b8 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/download-partial-failure.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/download-paused.png b/docs/9.9.1/materials-ui-2026-10-23/download-paused.png new file mode 100644 index 0000000..7bafd94 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/download-paused.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/download-running.png b/docs/9.9.1/materials-ui-2026-10-23/download-running.png new file mode 100644 index 0000000..0de2b20 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/download-running.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/library-mixed.png b/docs/9.9.1/materials-ui-2026-10-23/library-mixed.png new file mode 100644 index 0000000..8602ee3 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/library-mixed.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/library-selected.png b/docs/9.9.1/materials-ui-2026-10-23/library-selected.png new file mode 100644 index 0000000..df1062c Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/library-selected.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/preview-photo.png b/docs/9.9.1/materials-ui-2026-10-23/preview-photo.png new file mode 100644 index 0000000..b174273 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/preview-photo.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-23/preview-video-unavailable.png b/docs/9.9.1/materials-ui-2026-10-23/preview-video-unavailable.png new file mode 100644 index 0000000..1aee84a Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-23/preview-video-unavailable.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/demo-completed.jpg b/docs/9.9.1/materials-ui-2026-10-29/demo-completed.jpg new file mode 100644 index 0000000..9c46a9f Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/demo-completed.jpg differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/demo-partialFailure.jpg b/docs/9.9.1/materials-ui-2026-10-29/demo-partialFailure.jpg new file mode 100644 index 0000000..6c8a507 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/demo-partialFailure.jpg differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/empty-402.jpg b/docs/9.9.1/materials-ui-2026-10-29/empty-402.jpg new file mode 100644 index 0000000..4964198 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/empty-402.jpg differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/error-402.jpg b/docs/9.9.1/materials-ui-2026-10-29/error-402.jpg new file mode 100644 index 0000000..dc673f4 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/error-402.jpg differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/film-402.png b/docs/9.9.1/materials-ui-2026-10-29/film-402.png new file mode 100644 index 0000000..fe11267 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/film-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/loading-402.png b/docs/9.9.1/materials-ui-2026-10-29/loading-402.png new file mode 100644 index 0000000..2f7e880 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/loading-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/mixed-375.png b/docs/9.9.1/materials-ui-2026-10-29/mixed-375.png new file mode 100644 index 0000000..c6f4218 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/mixed-375.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/mixed-402.png b/docs/9.9.1/materials-ui-2026-10-29/mixed-402.png new file mode 100644 index 0000000..d9488db Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/mixed-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/mixed-runtime.jpg b/docs/9.9.1/materials-ui-2026-10-29/mixed-runtime.jpg new file mode 100644 index 0000000..a6623d4 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/mixed-runtime.jpg differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/ready-402.png b/docs/9.9.1/materials-ui-2026-10-29/ready-402.png new file mode 100644 index 0000000..131f735 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/ready-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/selected-402.png b/docs/9.9.1/materials-ui-2026-10-29/selected-402.png new file mode 100644 index 0000000..d470bdd Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/selected-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/taskFailed-402.png b/docs/9.9.1/materials-ui-2026-10-29/taskFailed-402.png new file mode 100644 index 0000000..d92d1bc Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/taskFailed-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/taskUploading-402.png b/docs/9.9.1/materials-ui-2026-10-29/taskUploading-402.png new file mode 100644 index 0000000..387133b Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/taskUploading-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/uploadFailed-402.png b/docs/9.9.1/materials-ui-2026-10-29/uploadFailed-402.png new file mode 100644 index 0000000..1d5b231 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/uploadFailed-402.png differ diff --git a/docs/9.9.1/materials-ui-2026-10-29/uploading-402.png b/docs/9.9.1/materials-ui-2026-10-29/uploading-402.png new file mode 100644 index 0000000..811c5a3 Binary files /dev/null and b/docs/9.9.1/materials-ui-2026-10-29/uploading-402.png differ diff --git a/docs/9.9.1/order-delivery-sheet-2026-10-30/cloud-delivery.png b/docs/9.9.1/order-delivery-sheet-2026-10-30/cloud-delivery.png new file mode 100644 index 0000000..71a2abd Binary files /dev/null and b/docs/9.9.1/order-delivery-sheet-2026-10-30/cloud-delivery.png differ diff --git a/docs/9.9.1/order-delivery-sheet-2026-10-30/delivery-method.png b/docs/9.9.1/order-delivery-sheet-2026-10-30/delivery-method.png new file mode 100644 index 0000000..8779375 Binary files /dev/null and b/docs/9.9.1/order-delivery-sheet-2026-10-30/delivery-method.png differ diff --git a/docs/9.9.1/order-delivery-sheet-2026-10-30/materials-delivery-method.png b/docs/9.9.1/order-delivery-sheet-2026-10-30/materials-delivery-method.png new file mode 100644 index 0000000..bb0aa80 Binary files /dev/null and b/docs/9.9.1/order-delivery-sheet-2026-10-30/materials-delivery-method.png differ diff --git a/docs/9.9.1/orders-integration-2026-10-28/orders-all-real.jpg b/docs/9.9.1/orders-integration-2026-10-28/orders-all-real.jpg new file mode 100644 index 0000000..a8f6de8 Binary files /dev/null and b/docs/9.9.1/orders-integration-2026-10-28/orders-all-real.jpg differ diff --git a/docs/9.9.1/orders-integration-2026-10-28/orders-all-response.redacted.json b/docs/9.9.1/orders-integration-2026-10-28/orders-all-response.redacted.json new file mode 100644 index 0000000..ee55e7a --- /dev/null +++ b/docs/9.9.1/orders-integration-2026-10-28/orders-all-response.redacted.json @@ -0,0 +1,50 @@ +{ + "code": 100000, + "data": { + "list": [ + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + }, + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:16:18", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-002", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + } + ], + "page": 1, + "page_size": 20, + "total": 2 + }, + "msg": "success", + "time": "2026-10-28 17:24:48" +} diff --git a/docs/9.9.1/orders-integration-2026-10-28/orders-completed-response.redacted.json b/docs/9.9.1/orders-integration-2026-10-28/orders-completed-response.redacted.json new file mode 100644 index 0000000..b4e75cd --- /dev/null +++ b/docs/9.9.1/orders-integration-2026-10-28/orders-completed-response.redacted.json @@ -0,0 +1,11 @@ +{ + "code": 100000, + "data": { + "list": [], + "page": 1, + "page_size": 20, + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:25:28" +} diff --git a/docs/9.9.1/orders-integration-2026-10-28/orders-pending-response.redacted.json b/docs/9.9.1/orders-integration-2026-10-28/orders-pending-response.redacted.json new file mode 100644 index 0000000..83556c6 --- /dev/null +++ b/docs/9.9.1/orders-integration-2026-10-28/orders-pending-response.redacted.json @@ -0,0 +1,50 @@ +{ + "code": 100000, + "data": { + "list": [ + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + }, + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:16:18", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-002", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + } + ], + "page": 1, + "page_size": 20, + "total": 2 + }, + "msg": "success", + "time": "2026-10-28 17:24:59" +} diff --git a/docs/9.9.1/orders-integration-2026-10-28/orders-processing-response.redacted.json b/docs/9.9.1/orders-integration-2026-10-28/orders-processing-response.redacted.json new file mode 100644 index 0000000..3af9781 --- /dev/null +++ b/docs/9.9.1/orders-integration-2026-10-28/orders-processing-response.redacted.json @@ -0,0 +1,11 @@ +{ + "code": 100000, + "data": { + "list": [], + "page": 1, + "page_size": 20, + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:25:15" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/pay-code-mini-program-responses.json b/docs/9.9.1/payment-integration-2026-10-27/pay-code-mini-program-responses.json new file mode 100644 index 0000000..6f94b8e --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/pay-code-mini-program-responses.json @@ -0,0 +1,30 @@ +[ + { + "code": 100000, + "data": { + "pay_url": "https://vipsky.oss-cn-shanghai.aliyuncs.com/mini_qr/f7490a9cf52193cecc5e9f203b427e27.png", + "price": "99.00", + "project_id": 386, + "project_name": "多点位航拍", + "shoot_count": 5, + "store_id": 38, + "store_user_id": 772 + }, + "msg": "success", + "time": "2026-10-27 17:22:00" + }, + { + "code": 100000, + "data": { + "pay_url": "https://vipsky.oss-cn-shanghai.aliyuncs.com/mini_qr/db12ec21153b5c4f6801fd8eab2402c1.png", + "price": "99.00", + "project_id": 386, + "project_name": "多点位航拍", + "shoot_count": 5, + "store_id": 38, + "store_user_id": 772 + }, + "msg": "success", + "time": "2026-10-27 17:22:32" + } +] diff --git a/docs/9.9.1/payment-integration-2026-10-27/pay-code-scenic271-console.log b/docs/9.9.1/payment-integration-2026-10-27/pay-code-scenic271-console.log new file mode 100644 index 0000000..6335af2 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/pay-code-scenic271-console.log @@ -0,0 +1,15 @@ +[API][Response] POST https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/pay-code status=200 +{ + "code" : 100000, + "data" : { + "pay_url" : "https:\/\/api-test.zhifly.cn\/wma\/multi-plane\/pay?project_id=386&price=99.00&store_user_id=772&store_id=38", + "price" : "99.00", + "project_id" : 386, + "project_name" : "多点位航拍", + "shoot_count" : 5, + "store_id" : 38, + "store_user_id" : 772 + }, + "msg" : "success", + "time" : "2026-10-27 15:37:45" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/pay-code-scenic271-response.json b/docs/9.9.1/payment-integration-2026-10-27/pay-code-scenic271-response.json new file mode 100644 index 0000000..8c2ea28 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/pay-code-scenic271-response.json @@ -0,0 +1,14 @@ +{ + "code": 100000, + "data": { + "pay_url": "https://api-test.zhifly.cn/wma/multi-plane/pay?project_id=386&price=99.00&store_user_id=772&store_id=38", + "price": "99.00", + "project_id": 386, + "project_name": "多点位航拍", + "shoot_count": 5, + "store_id": 38, + "store_user_id": 772 + }, + "msg": "success", + "time": "2026-10-27 15:37:45" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/payment-code-real.png b/docs/9.9.1/payment-integration-2026-10-27/payment-code-real.png new file mode 100644 index 0000000..1255da9 Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/payment-code-real.png differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/payment-empty-final.png b/docs/9.9.1/payment-integration-2026-10-27/payment-empty-final.png new file mode 100644 index 0000000..f173f0a Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/payment-empty-final.png differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/payment-empty-real.png b/docs/9.9.1/payment-integration-2026-10-27/payment-empty-real.png new file mode 100644 index 0000000..c4f3d25 Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/payment-empty-real.png differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/payment-mini-program-simulator.png b/docs/9.9.1/payment-integration-2026-10-27/payment-mini-program-simulator.png new file mode 100644 index 0000000..f01cbdf Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/payment-mini-program-simulator.png differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/payment-simulator.jpg b/docs/9.9.1/payment-integration-2026-10-27/payment-simulator.jpg new file mode 100644 index 0000000..1bf496d Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/payment-simulator.jpg differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/projects-console.log b/docs/9.9.1/payment-integration-2026-10-27/projects-console.log new file mode 100644 index 0000000..fcf160f --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/projects-console.log @@ -0,0 +1,9 @@ +[API][Response] GET https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/projects?scenic_id=128 status=200 +{ + "code" : 100000, + "data" : [ + + ], + "msg" : "success", + "time" : "2026-10-27 15:29:31" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/projects-response.json b/docs/9.9.1/payment-integration-2026-10-27/projects-response.json new file mode 100644 index 0000000..21d022a --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/projects-response.json @@ -0,0 +1,6 @@ +{ + "code": 100000, + "data": [], + "msg": "success", + "time": "2026-10-27 15:29:31" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-console.log b/docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-console.log new file mode 100644 index 0000000..ffa05ed --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-console.log @@ -0,0 +1,14 @@ +[API][Response] GET https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/projects?scenic_id=271 status=200 +{ + "code" : 100000, + "data" : [ + { + "id" : 386, + "name" : "多点位航拍", + "price" : "99.00", + "shoot_count" : 5 + } + ], + "msg" : "success", + "time" : "2026-10-27 15:37:44" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-response.json b/docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-response.json new file mode 100644 index 0000000..5e754ca --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-response.json @@ -0,0 +1,13 @@ +{ + "code": 100000, + "data": [ + { + "id": 386, + "name": "多点位航拍", + "price": "99.00", + "shoot_count": 5 + } + ], + "msg": "success", + "time": "2026-10-27 15:37:44" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/receipts-console.log b/docs/9.9.1/payment-integration-2026-10-27/receipts-console.log new file mode 100644 index 0000000..c19f607 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/receipts-console.log @@ -0,0 +1,54 @@ +[API][Response] GET https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?scenic_id=128&page=1 status=200 +{ + "code" : 100000, + "data" : { + "records" : { + "current_page" : 1, + "data" : [ + + ], + "first_page_url" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts?page=1", + "from" : null, + "last_page" : 1, + "last_page_url" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts?page=1", + "links" : [ + { + "active" : false, + "label" : "« Previous", + "page" : null, + "url" : null + }, + { + "active" : true, + "label" : "1", + "page" : 1, + "url" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts?page=1" + }, + { + "active" : false, + "label" : "Next »", + "page" : null, + "url" : null + } + ], + "next_page_url" : null, + "path" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts", + "per_page" : 20, + "prev_page_url" : null, + "to" : null, + "total" : 0 + }, + "summary" : { + "cash_net" : "0.00", + "cash_paid" : "0.00", + "cash_refund" : "0.00", + "count" : 0, + "point_amount" : "0.00", + "points_net" : 0, + "points_paid" : 0, + "points_refund" : 0 + } + }, + "msg" : "success", + "time" : "2026-10-27 15:30:15" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/receipts-empty-real.png b/docs/9.9.1/payment-integration-2026-10-27/receipts-empty-real.png new file mode 100644 index 0000000..c6e8171 Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/receipts-empty-real.png differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/receipts-response.json b/docs/9.9.1/payment-integration-2026-10-27/receipts-response.json new file mode 100644 index 0000000..abb6098 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/receipts-response.json @@ -0,0 +1,51 @@ +{ + "code": 100000, + "data": { + "records": { + "current_page": 1, + "data": [], + "first_page_url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1", + "from": null, + "last_page": 1, + "last_page_url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1", + "links": [ + { + "active": false, + "label": "« Previous", + "page": null, + "url": null + }, + { + "active": true, + "label": "1", + "page": 1, + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1" + }, + { + "active": false, + "label": "Next »", + "page": null, + "url": null + } + ], + "next_page_url": null, + "path": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts", + "per_page": 20, + "prev_page_url": null, + "to": null, + "total": 0 + }, + "summary": { + "cash_net": "0.00", + "cash_paid": "0.00", + "cash_refund": "0.00", + "count": 0, + "point_amount": "0.00", + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + } + }, + "msg": "success", + "time": "2026-10-27 15:30:15" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-console.log b/docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-console.log new file mode 100644 index 0000000..3b1fe7c --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-console.log @@ -0,0 +1,54 @@ +[API][Response] GET https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?scenic_id=271&page=1 status=200 +{ + "code" : 100000, + "data" : { + "records" : { + "current_page" : 1, + "data" : [ + + ], + "first_page_url" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts?page=1", + "from" : null, + "last_page" : 1, + "last_page_url" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts?page=1", + "links" : [ + { + "active" : false, + "label" : "« Previous", + "page" : null, + "url" : null + }, + { + "active" : true, + "label" : "1", + "page" : 1, + "url" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts?page=1" + }, + { + "active" : false, + "label" : "Next »", + "page" : null, + "url" : null + } + ], + "next_page_url" : null, + "path" : "https:\/\/api-test.zhifly.cn\/api\/yf-handset-app\/photog\/multi-plane\/receipts", + "per_page" : 20, + "prev_page_url" : null, + "to" : null, + "total" : 0 + }, + "summary" : { + "cash_net" : "0.00", + "cash_paid" : "0.00", + "cash_refund" : "0.00", + "count" : 0, + "point_amount" : "0.00", + "points_net" : 0, + "points_paid" : 0, + "points_refund" : 0 + } + }, + "msg" : "success", + "time" : "2026-10-27 15:34:27" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-response.json b/docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-response.json new file mode 100644 index 0000000..3a188a6 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-response.json @@ -0,0 +1,51 @@ +{ + "code": 100000, + "data": { + "records": { + "current_page": 1, + "data": [], + "first_page_url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1", + "from": null, + "last_page": 1, + "last_page_url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1", + "links": [ + { + "active": false, + "label": "« Previous", + "page": null, + "url": null + }, + { + "active": true, + "label": "1", + "page": 1, + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1" + }, + { + "active": false, + "label": "Next »", + "page": null, + "url": null + } + ], + "next_page_url": null, + "path": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts", + "per_page": 20, + "prev_page_url": null, + "to": null, + "total": 0 + }, + "summary": { + "cash_net": "0.00", + "cash_paid": "0.00", + "cash_refund": "0.00", + "count": 0, + "point_amount": "0.00", + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + } + }, + "msg": "success", + "time": "2026-10-27 15:34:27" +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/receipts-simulator.jpg b/docs/9.9.1/payment-integration-2026-10-27/receipts-simulator.jpg new file mode 100644 index 0000000..2dcd3e8 Binary files /dev/null and b/docs/9.9.1/payment-integration-2026-10-27/receipts-simulator.jpg differ diff --git a/docs/9.9.1/payment-integration-2026-10-27/three-interface-responses.json b/docs/9.9.1/payment-integration-2026-10-27/three-interface-responses.json new file mode 100644 index 0000000..f74c931 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/three-interface-responses.json @@ -0,0 +1,111 @@ +{ + "environment": "https://api-test.zhifly.cn", + "scenic_id": 271, + "scenic_name": "北大科技园", + "interfaces": [ + { + "method": "GET", + "path": "/api/yf-handset-app/photog/multi-plane/projects", + "request": { + "scenic_id": 271 + }, + "http_status": 200, + "response": { + "code": 100000, + "data": [ + { + "id": 386, + "name": "多点位航拍", + "price": "99.00", + "shoot_count": 5 + } + ], + "msg": "success", + "time": "2026-10-27 15:37:44" + } + }, + { + "method": "POST", + "path": "/api/yf-handset-app/photog/multi-plane/pay-code", + "request": { + "scenic_id": 271, + "project_id": 386 + }, + "http_status": 200, + "response": { + "code": 100000, + "data": { + "pay_url": "https://api-test.zhifly.cn/wma/multi-plane/pay?project_id=386&price=99.00&store_user_id=772&store_id=38", + "price": "99.00", + "project_id": 386, + "project_name": "多点位航拍", + "shoot_count": 5, + "store_id": 38, + "store_user_id": 772 + }, + "msg": "success", + "time": "2026-10-27 15:37:45" + } + }, + { + "method": "GET", + "path": "/api/yf-handset-app/photog/multi-plane/receipts", + "request": { + "scenic_id": 271, + "page": 1 + }, + "http_status": 200, + "response": { + "code": 100000, + "data": { + "records": { + "current_page": 1, + "data": [], + "first_page_url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1", + "from": null, + "last_page": 1, + "last_page_url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1", + "links": [ + { + "active": false, + "label": "« Previous", + "page": null, + "url": null + }, + { + "active": true, + "label": "1", + "page": 1, + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts?page=1" + }, + { + "active": false, + "label": "Next »", + "page": null, + "url": null + } + ], + "next_page_url": null, + "path": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/receipts", + "per_page": 20, + "prev_page_url": null, + "to": null, + "total": 0 + }, + "summary": { + "cash_net": "0.00", + "cash_paid": "0.00", + "cash_refund": "0.00", + "count": 0, + "point_amount": "0.00", + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + } + }, + "msg": "success", + "time": "2026-10-27 15:34:27" + } + } + ] +} diff --git a/docs/9.9.1/payment-integration-2026-10-27/verification.json b/docs/9.9.1/payment-integration-2026-10-27/verification.json new file mode 100644 index 0000000..ae065a4 --- /dev/null +++ b/docs/9.9.1/payment-integration-2026-10-27/verification.json @@ -0,0 +1,110 @@ +{ + "date": "2026-10-27", + "device": "iPhone 11", + "environment": "testing", + "current_scenic_id": 271, + "current_store_id": 38, + "current_scenic_name": "北大科技园", + "requests": { + "projects": { + "response": "projects-scenic271-response.json", + "code": 100000, + "time": "2026-10-27 15:37:44", + "http_status": 200 + }, + "pay-code": { + "response": "pay-code-scenic271-response.json", + "code": 100000, + "time": "2026-10-27 15:37:45", + "http_status": 200 + }, + "receipts": { + "response": "receipts-scenic271-response.json", + "code": 100000, + "time": "2026-10-27 15:34:27", + "http_status": 200 + } + }, + "earlier_scenic128": { + "projects": [], + "receipts_total": 0 + }, + "tests": { + "related": { + "passed": 47, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-dock-payment-tests.xcresult" + }, + "final_ui": { + "passed": 8, + "failed": 0, + "xcresult": "/private/tmp/suixinkan-dock-payment-ui-final.xcresult" + } + }, + "screenshots": [ + "payment-code-real.png", + "receipts-empty-real.png" + ], + "pending": [ + "非空真实收款记录的联调", + "游客实际支付和到账关联(当前为可重复购买链接,无单笔会话契约)", + "收款方名称的数据来源", + "类型25到账语音事件" + ], + "note": "真实接口响应与截图仅本地保留。请求付款链接不创建订单或拍摄任务,未执行付款。", + "qr_decode_verification": { + "tool": "Apple Vision VNDetectBarcodesRequest", + "detected_qr_count": 1, + "matches_server_pay_url": true, + "screenshot": "payment-code-real.png" + }, + "all_responses": "three-interface-responses.json", + "simulator_verification": { + "date": "2026-10-27", + "device": "iPhone 18 Pro", + "runtime": "iOS 27.0", + "scheme": "suixinkan-Simulator", + "configuration": "SimulatorDebug", + "tests": { + "passed": 47, + "failed": 0, + "skipped": 0, + "xcresult": "/Users/hanqiu/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-10-27T07-47-38-057Z_pid11893_efcc5bc6.xcresult" + }, + "live_api": { + "scenic_id": 271, + "project_id": 386, + "projects_code": 100000, + "pay_code_code": 100000, + "receipts_code": 100000, + "price": "99.00", + "shoot_count": 5, + "receipts_total": 0 + }, + "screenshots": [ + "payment-simulator.jpg", + "receipts-simulator.jpg" + ], + "note": "按用户最新要求改用模拟器。真实接口和套餐选择、确认、收款记录跳转已验证,未执行付款。" + }, + "mini_program_code_adaptation": { + "date": "2026-10-27", + "device": "iPhone 18 Pro Simulator", + "runtime": "iOS 27.0", + "tests": { + "related_passed": 54, + "failed": 0, + "final_ui_passed": 15, + "related_xcresult": "/Users/hanqiu/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-10-27T09-18-36-229Z_pid11893_88f50b3f.xcresult", + "final_ui_xcresult": "/Users/hanqiu/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-10-27T09-20-42-957Z_pid11893_a4ad6f52.xcresult" + }, + "real_response_file": "pay-code-mini-program-responses.json", + "screenshot": "payment-mini-program-simulator.png", + "scenic_id": 271, + "project_id": 386, + "price": "99.00", + "shoot_count": 5, + "regeneration_verified": true, + "note": "展示后端小程序码原图;原普通二维码记录仅为旧契约历史。未执行游客扫码、付款或向系统相册写图。" + } +} diff --git a/docs/9.9.1/plane-status-integration-2026-10-29/plane-status-redacted.json b/docs/9.9.1/plane-status-integration-2026-10-29/plane-status-redacted.json new file mode 100644 index 0000000..5cadcd8 --- /dev/null +++ b/docs/9.9.1/plane-status-integration-2026-10-29/plane-status-redacted.json @@ -0,0 +1,70 @@ +{ + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": true, + "id": 58, + "is_receive_order": 1, + "name": "测试设备 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试设备 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试设备 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": true, + "id": 58, + "is_receive_order": 1, + "name": "测试设备 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 11:06:12" +} diff --git a/docs/9.9.1/preparation-integration-2026-10-28/preparation-real-simulator.png b/docs/9.9.1/preparation-integration-2026-10-28/preparation-real-simulator.png new file mode 100644 index 0000000..a203ab6 Binary files /dev/null and b/docs/9.9.1/preparation-integration-2026-10-28/preparation-real-simulator.png differ diff --git a/docs/9.9.1/preparation-integration-2026-10-28/workbench-latest-response.json b/docs/9.9.1/preparation-integration-2026-10-28/workbench-latest-response.json new file mode 100644 index 0000000..db354db --- /dev/null +++ b/docs/9.9.1/preparation-integration-2026-10-28/workbench-latest-response.json @@ -0,0 +1,182 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "河南嵩山", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GF", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "id": 57, + "is_receive_order": 2, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "那拉提M4D", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GC", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "order_number": "261023271001", + "order_progress": { + "order_number": "261023271001", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄" + }, + "recommend_plane": null, + "scenic_id": 271, + "shoot_gate": { + "can_shoot": false, + "code": "dock_offline", + "message": "机巢未连接", + "primary_action": "blocked", + "primary_action_label": "机巢未连接" + }, + "spots": [ + { + "air_lines": [ + { + "air_line_id": 301, + "estimated_fly_time": 279, + "fly_type": 1, + "line_video_duration": 14, + "name": "vue3" + } + ], + "distance_label": "3311.1 km", + "distance_m": 3311086, + "in_range": false, + "name": "测试打卡点", + "scenic_spot_id": 411, + "shot_count": 0, + "shot_status_label": "未拍摄" + }, + { + "air_lines": [ + { + "air_line_id": 302, + "estimated_fly_time": 376, + "fly_type": 1, + "line_video_duration": 25, + "name": "天门寻梦" + } + ], + "distance_label": "3310.7 km", + "distance_m": 3310714, + "in_range": false, + "name": "天门寻梦", + "scenic_spot_id": 412, + "shot_count": 0, + "shot_status_label": "未拍摄" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "estimated_fly_time": 426, + "fly_type": 1, + "line_video_duration": 39, + "name": "天门远山" + } + ], + "distance_label": "3310.7 km", + "distance_m": 3310691, + "in_range": false, + "name": "天门远山", + "scenic_spot_id": 413, + "shot_count": 0, + "shot_status_label": "未拍摄" + } + ], + "tips": "每次拍摄成功后扣减 1 次,未成功不扣次数。" + }, + "msg": "success", + "time": "2026-10-28 14:47:44" +} \ No newline at end of file diff --git a/docs/9.9.1/preparation-integration-2026-10-28/workbench-without-location-response.json b/docs/9.9.1/preparation-integration-2026-10-28/workbench-without-location-response.json new file mode 100644 index 0000000..8e7e3f4 --- /dev/null +++ b/docs/9.9.1/preparation-integration-2026-10-28/workbench-without-location-response.json @@ -0,0 +1,182 @@ +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "河南嵩山", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GF", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "id": 57, + "is_receive_order": 2, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "那拉提M4D", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "8UUXN4200A04GC", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "order_number": "261023271001", + "order_progress": { + "order_number": "261023271001", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄" + }, + "recommend_plane": null, + "scenic_id": 271, + "shoot_gate": { + "can_shoot": false, + "code": "dock_offline", + "message": "机巢未连接", + "primary_action": "blocked", + "primary_action_label": "机巢未连接" + }, + "spots": [ + { + "air_lines": [ + { + "air_line_id": 301, + "estimated_fly_time": 279, + "fly_type": 1, + "line_video_duration": 14, + "name": "vue3" + } + ], + "distance_label": "3311.1 km", + "distance_m": 3311086, + "in_range": false, + "name": "测试打卡点", + "scenic_spot_id": 411, + "shot_count": 0, + "shot_status_label": "未拍摄" + }, + { + "air_lines": [ + { + "air_line_id": 302, + "estimated_fly_time": 376, + "fly_type": 1, + "line_video_duration": 25, + "name": "天门寻梦" + } + ], + "distance_label": "3310.7 km", + "distance_m": 3310714, + "in_range": false, + "name": "天门寻梦", + "scenic_spot_id": 412, + "shot_count": 0, + "shot_status_label": "未拍摄" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "estimated_fly_time": 426, + "fly_type": 1, + "line_video_duration": 39, + "name": "天门远山" + } + ], + "distance_label": "3310.7 km", + "distance_m": 3310691, + "in_range": false, + "name": "天门远山", + "scenic_spot_id": 413, + "shot_count": 0, + "shot_status_label": "未拍摄" + } + ], + "tips": "每次拍摄成功后扣减 1 次,未成功不扣次数。" + }, + "msg": "success", + "time": "2026-10-28 14:06:21" +} \ No newline at end of file diff --git a/docs/9.9.1/project-info-integration-2026-10-28/preparation-project-info-real.jpg b/docs/9.9.1/project-info-integration-2026-10-28/preparation-project-info-real.jpg new file mode 100644 index 0000000..661de89 Binary files /dev/null and b/docs/9.9.1/project-info-integration-2026-10-28/preparation-project-info-real.jpg differ diff --git a/docs/9.9.1/project-info-integration-2026-10-28/project-info-response.json b/docs/9.9.1/project-info-integration-2026-10-28/project-info-response.json new file mode 100644 index 0000000..3d6a23f --- /dev/null +++ b/docs/9.9.1/project-info-integration-2026-10-28/project-info-response.json @@ -0,0 +1,100 @@ +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17762401434725.png", + "id": 318, + "name": "天门寻梦", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776240058674_lgjimv.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道北大科技园花都汇商务中心", + "lat": 32.429597, + "lot": 119.440283, + "scenic_spot_str": "北大科技园" + }, + "sample_piece_ids": [ + 318 + ], + "samples": [ + { + "id": 318, + "name": "天门寻梦" + } + ], + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "air_line_name": "天门远山", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17768529312831.png", + "id": 319, + "name": "天门远山", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776852306874_5jh4xz.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道花都汇商务中心", + "lat": 32.429872, + "lot": 119.440194, + "scenic_spot_str": "天门远山" + }, + "sample_piece_ids": [ + 319 + ], + "samples": [ + { + "id": 319, + "name": "天门远山" + } + ], + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "132****9413" + }, + "msg": "success", + "time": "2026-10-28 16:23:11" +} diff --git a/docs/9.9.1/project-info-integration-2026-10-28/workbench-response.json b/docs/9.9.1/project-info-integration-2026-10-28/workbench-response.json new file mode 100644 index 0000000..795baa7 --- /dev/null +++ b/docs/9.9.1/project-info-integration-2026-10-28/workbench-response.json @@ -0,0 +1,6 @@ +{ + "code": 100099, + "data": [], + "msg": "多点位航拍请使用专用订单接口", + "time": "2026-10-28 16:23:21" +} diff --git a/docs/9.9.1/prototype-audit-2026-10-26/active-order-workbench.png b/docs/9.9.1/prototype-audit-2026-10-26/active-order-workbench.png new file mode 100644 index 0000000..a83b3ff Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/active-order-workbench.png differ diff --git a/docs/9.9.1/prototype-audit-2026-10-26/active-task-back.png b/docs/9.9.1/prototype-audit-2026-10-26/active-task-back.png new file mode 100644 index 0000000..a5a78fd Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/active-task-back.png differ diff --git a/docs/9.9.1/prototype-audit-2026-10-26/active-task-leave-dialog.png b/docs/9.9.1/prototype-audit-2026-10-26/active-task-leave-dialog.png new file mode 100644 index 0000000..1fca1bb Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/active-task-leave-dialog.png differ diff --git a/docs/9.9.1/prototype-audit-2026-10-26/delivery-confirmed.png b/docs/9.9.1/prototype-audit-2026-10-26/delivery-confirmed.png new file mode 100644 index 0000000..bdc1705 Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/delivery-confirmed.png differ diff --git a/docs/9.9.1/prototype-audit-2026-10-26/observations.json b/docs/9.9.1/prototype-audit-2026-10-26/observations.json new file mode 100644 index 0000000..abb9f24 --- /dev/null +++ b/docs/9.9.1/prototype-audit-2026-10-26/observations.json @@ -0,0 +1,379 @@ +{ + "reviewDate": "2026-10-26", + "url": "https://voicestudio.suixinkan.cn/", + "mode": "UI prototype only; no real payments, uploads, device control or visitor messages", + "observations": [ + { + "name": "01-工作台正常", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:24\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 景区空镜库\n\t\t\t\t\t9 heading 机巢工作台, Value: 1\n\t\t\t\t\t\t10 text 机巢工作台\n\t\t\t\t\t11 button 收款码\n\t\t\t\t\t\t12 image\n\t\t\t\t\t\t13 text 收款码\n\t\t\t\t14 text 交互原型 · 无真实操作\n\t\t\t\t15 button 体验本页其他状态\n\t\t\t\t\t16 image\n\t\t\t\t\t17 text 体验其他状态\n\t\t\t\t18 container\n\t\t\t\t\t19 text 嵩山少林景区 · 吴家俊\n\t\t\t\t\t20 container 无人机设备状态\n\t\t\t\t\t\t21 container 左右滑动查看无人机\n\t\t\t\t\t\t\t22 container 01号无人机\n\t\t\t\t\t\t\t\t23 container 01号无人机的六项状态\n\t\t\t\t\t\t\t\t\t24 heading 01号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t25 text 01号无人机\n\t\t\t\t\t\t\t\t\t26 text 空闲\n\t\t\t\t\t\t\t\t\t27 level indicator Description: 电池电量, Value: 95\n\t\t\t\t\t\t\t\t\t28 image\n\t\t\t\t\t\t\t\t\t29 text 信号状态\n\t\t\t\t\t\t\t\t\t30 text 良好\n\t\t\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t\t\t32 text 搜星状态\n\t\t\t\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t\t\t\t34 text 36 颗\n\t\t\t\t\t\t\t\t\t35 container\n\t\t\t\t\t\t\t\t\t\t36 text 19.3 °C\n\t\t\t\t\t\t\t\t\t37 image\n\t\t\t\t\t\t\t\t\t38 text 环境温度\n\t\t\t\t\t\t\t\t\t39 container\n\t\t\t\t\t\t\t\t\t\t40 text 0 m/s\n\t\t\t\t\t\t\t\t\t41 image\n\t\t\t\t\t\t\t\t\t42 text 风速\n\t\t\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t\t\t\t44 image\n\t\t\t\t\t\t\t\t\t45 text 雨量\n\t\t\t\t\t\t\t46 container 02号无人机\n\t\t\t\t\t\t\t\t47 container 02号无人机的六项状态\n\t\t\t\t\t\t\t\t\t48 heading 02号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t49 text 02号无人机\n\t\t\t\t\t\t\t\t\t50 text 占用中\n\t\t\t\t\t\t\t\t\t51 level indicator Description: 电池电量, Value: 72\n\t\t\t\t\t\t\t\t\t52 image\n\t\t\t\t\t\t\t\t\t53 text 信号状态\n\t\t\t\t\t\t\t\t\t54 text 良好\n\t\t\t\t\t\t\t\t\t55 image\n\t\t\t\t\t\t\t\t\t56 text 搜星状态\n\t\t\t\t\t\t\t\t\t57 container\n\t\t\t\t\t\t\t\t\t\t58 text 32 颗\n\t\t\t\t\t\t\t\t\t59 container\n\t\t\t\t\t\t\t\t\t\t60 text 20.1 °C\n\t\t\t\t\t\t\t\t\t61 image\n\t\t\t\t\t\t\t\t\t62 text 环境温度\n\t\t\t\t\t\t\t\t\t63 container\n\t\t\t\t\t\t\t\t\t\t64 text 1.2 m/s\n\t\t\t\t\t\t\t\t\t65 image\n\t\t\t\t\t\t\t\t\t66 text 风速\n\t\t\t\t\t\t\t\t\t67 text 无雨\n\t\t\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t\t\t69 text 雨量\n\t\t\t\t\t\t\t70 container 03号无人机\n\t\t\t\t\t\t\t\t71 container 03号无人机的六项状态\n\t\t\t\t\t\t\t\t\t72 heading 03号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t73 text 03号无人机\n\t\t\t\t\t\t\t\t\t74 text 未连接\n\t\t\t\t\t\t\t\t\t75 container 电池电量未知\n\t\t\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t\t\t77 text 信号状态\n\t\t\t\t\t\t\t\t\t78 text —\n\t\t\t\t\t\t\t\t\t79 image\n\t\t\t\t\t\t\t\t\t80 text 搜星状态\n\t\t\t\t\t\t\t\t\t81 text —\n\t\t\t\t\t\t\t\t\t82 text —\n\t\t\t\t\t\t\t\t\t83 image\n\t\t\t\t\t\t\t\t\t84 text 环境温度\n\t\t\t\t\t\t\t\t\t85 text —\n\t\t\t\t\t\t\t\t\t86 image\n\t\t\t\t\t\t\t\t\t87 text 风速\n\t\t\t\t\t\t\t\t\t88 text —\n\t\t\t\t\t\t\t\t\t89 image\n\t\t\t\t\t\t\t\t\t90 text 雨量\n\t\t\t\t\t\t\t91 container 04号无人机\n\t\t\t\t\t\t\t\t92 container 04号无人机的六项状态\n\t\t\t\t\t\t\t\t\t93 heading 04号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t94 text 04号无人机\n\t\t\t\t\t\t\t\t\t95 text 低电量\n\t\t\t\t\t\t\t\t\t96 level indicator Description: 电池电量, Value: 18\n\t\t\t\t\t\t\t\t\t97 image\n\t\t\t\t\t\t\t\t\t98 text 信号状态\n\t\t\t\t\t\t\t\t\t99 text 良好\n\t\t\t\t\t\t\t\t\t100 image\n\t\t\t\t\t\t\t\t\t101 text 搜星状态\n\t\t\t\t\t\t\t\t\t102 container\n\t\t\t\t\t\t\t\t\t\t103 text 34 颗\n\t\t\t\t\t\t\t\t\t104 container\n\t\t\t\t\t\t\t\t\t\t105 text 19.8 °C\n\t\t\t\t\t\t\t\t\t106 image\n\t\t\t\t\t\t\t\t\t107 text 环境温度\n\t\t\t\t\t\t\t\t\t108 container\n\t\t\t\t\t\t\t\t\t\t109 text 0.6 m/s\n\t\t\t\t\t\t\t\t\t110 image\n\t\t\t\t\t\t\t\t\t111 text 风速\n\t\t\t\t\t\t\t\t\t112 text 无雨\n\t\t\t\t\t\t\t\t\t113 image\n\t\t\t\t\t\t\t\t\t114 text 雨量\n\t\t\t\t\t\t\t115 container 05号无人机\n\t\t\t\t\t\t\t\t116 container 05号无人机的六项状态\n\t\t\t\t\t\t\t\t\t117 heading 05号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t118 text 05号无人机\n\t\t\t\t\t\t\t\t\t119 text 空闲\n\t\t\t\t\t\t\t\t\t120 level indicator Description: 电池电量, Value: 88\n\t\t\t\t\t\t\t\t\t121 image\n\t\t\t\t\t\t\t\t\t122 text 信号状态\n\t\t\t\t\t\t\t\t\t123 text 良好\n\t\t\t\t\t\t\t\t\t124 image\n\t\t\t\t\t\t\t\t\t125 text 搜星状态\n\t\t\t\t\t\t\t\t\t126 container\n\t\t\t\t\t\t\t\t\t\t127 text 35 颗\n\t\t\t\t\t\t\t\t\t128 container\n\t\t\t\t\t\t\t\t\t\t129 text 20.3 °C\n\t\t\t\t\t\t\t\t\t130 image\n\t\t\t\t\t\t\t\t\t131 text 环境温度\n\t\t\t\t\t\t\t\t\t132 container\n\t\t\t\t\t\t\t\t\t\t133 text 0.8 m/s\n\t\t\t\t\t\t\t\t\t134 image\n\t\t\t\t\t\t\t\t\t135 text 风速\n\t\t\t\t\t\t\t\t\t136 text 无雨\n\t\t\t\t\t\t\t\t\t137 image\n\t\t\t\t\t\t\t\t\t138 text 雨量\n\t\t\t\t\t\t\t139 container 06号无人机\n\t\t\t\t\t\t\t\t140 container 06号无人机的六项状态\n\t\t\t\t\t\t\t\t\t141 heading 06号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t142 text 06号无人机\n\t\t\t\t\t\t\t\t\t143 text 无信号\n\t\t\t\t\t\t\t\t\t144 container 电池电量未知\n\t\t\t\t\t\t\t\t\t145 image\n\t\t\t\t\t\t\t\t\t146 text 信号状态\n\t\t\t\t\t\t\t\t\t147 text 无信号\n\t\t\t\t\t\t\t\t\t148 image\n\t\t\t\t\t\t\t\t\t149 text 搜星状态\n\t\t\t\t\t\t\t\t\t150 text —\n\t\t\t\t\t\t\t\t\t151 text —\n\t\t\t\t\t\t\t\t\t152 image\n\t\t\t\t\t\t\t\t\t153 text 环境温度\n\t\t\t\t\t\t\t\t\t154 text —\n\t\t\t\t\t\t\t\t\t155 image\n\t\t\t\t\t\t\t\t\t156 text 风速\n\t\t\t\t\t\t\t\t\t157 text —\n\t\t\t\t\t\t\t\t\t158 image\n\t\t\t\t\t\t\t\t\t159 text 雨量\n\t\t\t\t\t\t160 container 当前无人机\n\t\t\t\t\t\t\t161 button 查看01号无人机\n\t\t\t\t\t\t\t162 button 查看02号无人机\n\t\t\t\t\t\t\t163 button 查看03号无人机\n\t\t\t\t\t\t\t164 button 查看04号无人机\n\t\t\t\t\t\t\t165 button 查看05号无人机\n\t\t\t\t\t\t\t166 button 查看06号无人机\n\t\t\t\t\t167 heading 我的拍摄订单 8, Value: 2\n\t\t\t\t\t\t168 text 我的拍摄订单 8\n\t\t\t\t\t169 button 查看全部\n\t\t\t\t\t\t170 text 查看全部\n\t\t\t\t\t\t171 image\n\t\t\t\t\t172 container\n\t\t\t\t\t\t173 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t174 text 游客 158****8888\n\t\t\t\t\t\t175 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 · 剩余 2 次\n\t\t\t\t\t\t176 button 继续拍摄\n\t\t\t\t\t\t177 image\n\t\t\t\t\t\t178 text 素材 上传中\n\t\t\t\t\t\t179 button 查看素材\n\t\t\t\t\t\t\t180 text 查看素材\n\t\t\t\t\t\t\t181 image\n\t\t\t\t\t182 container\n\t\t\t\t\t\t183 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t184 text 游客 136****2806\n\t\t\t\t\t\t185 text 待拍摄 单次航拍 · 含 1 次拍摄 已拍摄 0 / 1 次 · 剩余 1 次\n\t\t\t\t\t\t186 button 开始拍摄\n\t\t\t\t\t187 container\n\t\t\t\t\t\t188 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t189 text 游客 139****5192\n\t\t\t\t\t\t190 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 · 剩余 3 次\n\t\t\t\t\t\t191 button 继续拍摄\n\t\t\t\t\t\t192 image\n\t\t\t\t\t\t193 text 素材 上传失败\n\t\t\t\t\t\t194 button 查看素材\n\t\t\t\t\t\t\t195 text 查看素材\n\t\t\t\t\t\t\t196 image\n\t\t\t\t\t197 heading 今日数据, Value: 2\n\t\t\t\t\t\t198 text 今日数据\n\t\t\t\t\t199 text 12\n\t\t\t\t\t200 text 成交订单\n\t\t\t\t\t201 text ¥1,896\n\t\t\t\t\t202 text 成交金额\n\t\t\t\t\t203 text 9\n\t\t\t\t\t204 text 完成拍摄\n\t\t\t205 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "02-景区空镜库", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:24\n\t\t\t6 container\n\t\t\t\t206 container\n\t\t\t\t\t207 button 返回机巢工作台\n\t\t\t\t\t\t208 image\n\t\t\t\t\t209 heading 景区素材, Value: 1\n\t\t\t\t\t\t210 text 景区素材\n\t\t\t\t\t211 text 交互原型 · 无真实操作\n\t\t\t\t\t212 button 体验景区素材其他状态\n\t\t\t\t\t\t213 image\n\t\t\t\t\t\t214 text 体验其他状态\n\t\t\t\t\t215 button 筛选航线\n\t\t\t\t\t\t216 text 全部航线\n\t\t\t\t\t\t217 image\n\t\t\t\t\t218 button 筛选时间\n\t\t\t\t\t\t219 text 全部时间\n\t\t\t\t\t\t220 image\n\t\t\t\t221 container\n\t\t\t\t\t222 text 素材保留 90 天,请及时下载\n\t\t\t\t\t223 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t224 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t225 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t226 container\n\t\t\t\t\t\t\t227 text 10-23 17:20\n\t\t\t\t\t\t\t228 text · 5 段素材\n\t\t\t\t\t\t\t229 checkbox Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t230 image\n\t\t\t\t\t\t\t\t231 text 选择本组\n\t\t\t\t\t\t\t232 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t233 image 航线视频片段 1\n\t\t\t\t\t\t\t\t234 text 片段 \n\t\t\t\t\t\t\t\t235 text 01\n\t\t\t\t\t\t\t\t236 container\n\t\t\t\t\t\t\t\t\t237 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t238 checkbox Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t239 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t240 image 航线视频片段 2\n\t\t\t\t\t\t\t\t241 text 片段 \n\t\t\t\t\t\t\t\t242 text 02\n\t\t\t\t\t\t\t\t243 text 00:27\n\t\t\t\t\t\t\t244 checkbox Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t245 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t246 image 航线视频片段 3\n\t\t\t\t\t\t\t\t247 text 片段 \n\t\t\t\t\t\t\t\t248 text 03\n\t\t\t\t\t\t\t\t249 text 00:30\n\t\t\t\t\t\t\t250 checkbox Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t251 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t252 image 航线视频片段 4\n\t\t\t\t\t\t\t\t253 text 片段 \n\t\t\t\t\t\t\t\t254 text 04\n\t\t\t\t\t\t\t\t255 text 00:24\n\t\t\t\t\t\t\t256 checkbox Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t257 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t258 image 航线视频片段 5\n\t\t\t\t\t\t\t\t259 text 片段 \n\t\t\t\t\t\t\t\t260 text 05\n\t\t\t\t\t\t\t\t261 text 00:31\n\t\t\t\t\t\t\t262 checkbox Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t263 container\n\t\t\t\t\t\t\t264 text 10-23 14:30\n\t\t\t\t\t\t\t265 text · 6 段素材\n\t\t\t\t\t\t\t266 checkbox Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t267 image\n\t\t\t\t\t\t\t\t268 text 选择本组\n\t\t\t\t\t\t\t269 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t270 image 航线视频片段 1\n\t\t\t\t\t\t\t\t271 text 片段 \n\t\t\t\t\t\t\t\t272 text 01\n\t\t\t\t\t\t\t\t273 container\n\t\t\t\t\t\t\t\t\t274 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t275 checkbox Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t276 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t277 image 航线视频片段 2\n\t\t\t\t\t\t\t\t278 text 片段 \n\t\t\t\t\t\t\t\t279 text 02\n\t\t\t\t\t\t\t\t280 text 00:27\n\t\t\t\t\t\t\t281 checkbox Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t282 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t283 image 航线视频片段 3\n\t\t\t\t\t\t\t\t284 text 片段 \n\t\t\t\t\t\t\t\t285 text 03\n\t\t\t\t\t\t\t\t286 text 00:30\n\t\t\t\t\t\t\t287 checkbox Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t288 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t289 image 航线视频片段 4\n\t\t\t\t\t\t\t\t290 text 片段 \n\t\t\t\t\t\t\t\t291 text 04\n\t\t\t\t\t\t\t\t292 text 00:24\n\t\t\t\t\t\t\t293 checkbox Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t294 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t295 image 航线视频片段 5\n\t\t\t\t\t\t\t\t296 text 片段 \n\t\t\t\t\t\t\t\t297 text 05\n\t\t\t\t\t\t\t\t298 text 00:31\n\t\t\t\t\t\t\t299 checkbox Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t300 button 展开其余 1 段\n\t\t\t\t\t\t\t\t301 text 展开其余 1 段\n\t\t\t\t\t\t\t\t302 image\n\t\t\t\t\t\t303 container\n\t\t\t\t\t\t\t304 text 10-22 16:10\n\t\t\t\t\t\t\t305 text · 3 段素材\n\t\t\t\t\t\t\t306 checkbox Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t307 image\n\t\t\t\t\t\t\t\t308 text 选择本组\n\t\t\t\t\t\t\t309 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t310 image 航线视频片段 1\n\t\t\t\t\t\t\t\t311 text 片段 \n\t\t\t\t\t\t\t\t312 text 01\n\t\t\t\t\t\t\t\t313 container\n\t\t\t\t\t\t\t\t\t314 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t315 checkbox Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t316 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t317 image 航线视频片段 2\n\t\t\t\t\t\t\t\t318 text 片段 \n\t\t\t\t\t\t\t\t319 text 02\n\t\t\t\t\t\t\t\t320 text 00:27\n\t\t\t\t\t\t\t321 checkbox Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t322 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t323 image 航线视频片段 3\n\t\t\t\t\t\t\t\t324 text 片段 \n\t\t\t\t\t\t\t\t325 text 03\n\t\t\t\t\t\t\t\t326 text 00:30\n\t\t\t\t\t\t\t327 checkbox Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t328 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t329 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t330 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t331 container\n\t\t\t\t\t\t\t332 text 10-23 10:40\n\t\t\t\t\t\t\t333 text · 4 段素材\n\t\t\t\t\t\t\t334 checkbox Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t335 image\n\t\t\t\t\t\t\t\t336 text 选择本组\n\t\t\t\t\t\t\t337 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t338 image 航线视频片段 1\n\t\t\t\t\t\t\t\t339 text 片段 \n\t\t\t\t\t\t\t\t340 text 01\n\t\t\t\t\t\t\t\t341 container\n\t\t\t\t\t\t\t\t\t342 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t343 checkbox Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t344 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t345 image 航线视频片段 2\n\t\t\t\t\t\t\t\t346 text 片段 \n\t\t\t\t\t\t\t\t347 text 02\n\t\t\t\t\t\t\t\t348 text 00:27\n\t\t\t\t\t\t\t349 checkbox Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t350 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t351 image 航线视频片段 3\n\t\t\t\t\t\t\t\t352 text 片段 \n\t\t\t\t\t\t\t\t353 text 03\n\t\t\t\t\t\t\t\t354 text 00:30\n\t\t\t\t\t\t\t355 checkbox Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t356 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t357 image 航线视频片段 4\n\t\t\t\t\t\t\t\t358 text 片段 \n\t\t\t\t\t\t\t\t359 text 04\n\t\t\t\t\t\t\t\t360 text 00:24\n\t\t\t\t\t\t\t361 checkbox Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t362 container\n\t\t\t\t\t\t\t363 text 10-10 15:35\n\t\t\t\t\t\t\t364 text · 5 段素材\n\t\t\t\t\t\t\t365 checkbox Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t366 image\n\t\t\t\t\t\t\t\t367 text 选择本组\n\t\t\t\t\t\t\t368 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t369 image 航线视频片段 1\n\t\t\t\t\t\t\t\t370 text 片段 \n\t\t\t\t\t\t\t\t371 text 01\n\t\t\t\t\t\t\t\t372 container\n\t\t\t\t\t\t\t\t\t373 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t374 checkbox Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t375 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t376 image 航线视频片段 2\n\t\t\t\t\t\t\t\t377 text 片段 \n\t\t\t\t\t\t\t\t378 text 02\n\t\t\t\t\t\t\t\t379 text 00:27\n\t\t\t\t\t\t\t380 checkbox Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t381 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t382 image 航线视频片段 3\n\t\t\t\t\t\t\t\t383 text 片段 \n\t\t\t\t\t\t\t\t384 text 03\n\t\t\t\t\t\t\t\t385 text 00:30\n\t\t\t\t\t\t\t386 checkbox Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t387 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t388 image 航线视频片段 4\n\t\t\t\t\t\t\t\t389 text 片段 \n\t\t\t\t\t\t\t\t390 text 04\n\t\t\t\t\t\t\t\t391 text 00:24\n\t\t\t\t\t\t\t392 checkbox Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t393 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t394 image 航线视频片段 5\n\t\t\t\t\t\t\t\t395 text 片段 \n\t\t\t\t\t\t\t\t396 text 05\n\t\t\t\t\t\t\t\t397 text 00:31\n\t\t\t\t\t\t\t398 checkbox Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t399 text 已显示保留期内的全部演示记录\n\t\t\t\t400 container\n\t\t\t\t\t401 text 已选 0 段\n\t\t\t\t\t402 button (disabled) 下载所选\n\t\t\t205 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "03-空镜航线筛选", + "state": "- button:\n - generic: iPhone\n- generic: 2:24\n- banner:\n - navigation:\n - button:\n - heading [level=1]: 景区素材\n - generic: 交互原型 · 无真实操作\n - button:\n - text: 体验其他状态\n - button:\n - generic: 全部航线\n - button:\n - generic: 全部时间\n- main:\n - generic: 嵩山少林景区 · 吴家俊\n - region:\n - region:\n - region:\n - heading [level=3]: 01号无人机\n - text: 空闲\n - meter:\n - strong: 95%\n - generic: 电池电量\n - generic: 信号状态\n - strong: 良好\n - generic: 搜星状态\n - strong: 36颗\n - strong: 19.3°C\n - text: 环境温度\n - strong: 0m/s\n - text: 风速\n - strong: 无雨\n - text: 雨量\n - region:\n - heading [level=3]: 02号无人机\n - text: 占用中\n - meter:\n - strong: 72%\n - generic: 电池电量\n - generic: 信号状态\n - strong: 良好\n - generic: 搜星状态\n - strong: 32颗\n - strong: 20.1°C\n - text: 环境温度\n - strong: 1.2m/s\n - text: 风速\n - strong: 无雨\n - text: 雨量\n - region:\n - heading [level=3]: 03号无人机\n - text: 未连接\n - generic: 信号状态\n - strong: —\n - generic: 搜星状态\n - strong: —\n - strong: —\n - text: 环境温度\n - strong: —\n - text: 风速\n - strong: —\n - text: 雨量\n - region:\n - heading [level=3]: 04号无人机\n - text: 低电量\n - meter:\n - strong: 18%\n - generic: 电池电量\n - generic: 信号状态\n - strong: 良好\n - generic: 搜星状态\n - strong: 34颗\n - strong: 19.8°C\n - text: 环境温度\n - strong: 0.6m/s\n - text: 风速\n - strong: 无雨\n - text: 雨量\n - region:\n - heading [level=3]: 05号无人机\n - text: 空闲\n - meter:\n - strong: 88%\n - generic: 电池电量\n - generic: 信号状态\n - strong: 良好\n - generic: 搜星状态\n - strong: 35颗\n - strong: 20.3°C\n - text: 环境温度\n - strong: 0.8m/s\n - text: 风速\n - strong: 无雨\n - text: 雨量\n - region:\n - heading [level=3]: 06号无人机\n - text: 无信号\n - generic: 信号状态\n - strong: 无信号\n - generic: 搜星状态\n - strong: —\n - strong: —\n - text: 环境温度\n - strong: —\n - text: 风速\n - strong: —\n - text: 雨量\n - button:\n - button:\n - button:\n - button:\n - button:\n - button:\n - heading [level=2]: 我的拍摄订单 8\n - button:\n - text: 查看全部\n - article:\n - heading [level=2]: 游客158****8888\n - generic: 进行中\n - paragraph: 航拍套餐·含5次拍摄\n - generic: 已拍摄 3/5 次\n - generic: ·剩余 2 次\n - button: 继续拍摄\n - text: 素材上传中\n - button:\n - text: 查看素材\n - article:\n - heading [level=2]: 游客136****2806\n - generic: 待拍摄\n - paragraph: 单次航拍·含1次拍摄\n - generic: 已拍摄 0/1 次\n - generic: ·剩余 1 次\n - button: 开始拍摄\n - article:\n - heading [level=2]: 游客139****5192\n - generic: 进行中\n - paragraph: 航拍套餐·含5次拍摄\n - generic: 已拍摄 2/5 次\n - generic: ·剩余 3 次\n - button: 继续拍摄\n - text: 素材上传失败\n - button:\n - text: 查看素材\n - heading [level=2]: 今日数据\n - paragraph:\n - strong: \"12\"\n - generic: 成交订单\n - paragraph:\n - strong: ¥1,896\n - generic: 成交金额\n - paragraph:\n - strong: \"9\"\n - generic: 完成拍摄\n- main:\n - paragraph: 素材保留 90 天,请及时下载\n - region:\n - heading [level=2]: 共眠岸 → 三皇寨 → 好汉坡\n - article:\n - paragraph:\n - time: 10-23 17:20\n - generic: · 5 段素材\n - button:\n - generic: 选择本组\n - button:\n - generic: 片段 01\n - generic: 00:28 · 4K · 178MB\n - button:\n - button:\n - generic: 片段 02\n - generic: 00:27\n - button:\n - button:\n - generic: 片段 03\n - generic: 00:30\n - button:\n - button:\n - generic: 片段 04\n - generic: 00:24\n - button:\n - button:\n - generic: 片段 05\n - generic: 00:31\n - button:\n - article:\n - paragraph:\n - time: 10-23 14:30\n - generic: · 6 段素材\n - button:\n - generic: 选择本组\n - button:\n - generic: 片段 01\n - generic: 00:28 · 4K · 178MB\n - button:\n - button:\n - generic: 片段 02\n - generic: 00:27\n - button:\n - button:\n - generic: 片段 03\n - generic: 00:30\n - button:\n - button:\n - generic: 片段 04\n - generic: 00:24\n - button:\n - button:\n - generic: 片段 05\n - generic: 00:31\n - button:\n - button:\n - text: 展开其余 1 段\n - article:\n - paragraph:\n - time: 10-22 16:10\n - generic: · 3 段素材\n - button:\n - generic: 选择本组\n - button:\n - generic: 片段 01\n - generic: 00:28 · 4K · 178MB\n - button:\n - button:\n - generic: 片段 02\n - generic: 00:27\n - button:\n - button:\n - generic: 片段 03\n - generic: 00:30\n - button:\n - region:\n - heading [level=2]: 少林寺 → 塔林 → 达摩洞\n - article:\n - paragraph:\n - time: 10-23 10:40\n - generic: · 4 段素材\n - button:\n - generic: 选择本组\n - button:\n - generic: 片段 01\n - generic: 00:28 · 4K · 178MB\n - button:\n - button:\n - generic: 片段 02\n - generic: 00:27\n - button:\n - button:\n - generic: 片段 03\n - generic: 00:30\n - button:\n - button:\n - generic: 片段 04\n - generic: 00:24\n - button:\n - article:\n - paragraph:\n - time: 10-10 15:35\n - generic: · 5 段素材\n - button:\n - generic: 选择本组\n - button:\n - generic: 片段 01\n - generic: 00:28 · 4K · 178MB\n - button:\n - button:\n - generic: 片段 02\n - generic: 00:27\n - button:\n - button:\n - generic: 片段 03\n - generic: 00:30\n - button:\n - button:\n - generic: 片段 04\n - generic: 00:24\n - button:\n - button:\n - generic: 片段 05\n - generic: 00:31\n - button:\n - paragraph: 已显示保留期内的全部演示记录\n- contentinfo:\n - text: 已选\n - strong: \"0\"\n - text: 段\n - button [disabled]: 下载所选\n- dialog \"选择航线\":\n - heading \"选择航线\" [level=2]\n - button \"全部航线\" [active] [pressed]:\n - generic: 全部航线\n - button \"共眠岸 → 三皇寨 → 好汉坡\":\n - generic: 共眠岸 → 三皇寨 → 好汉坡\n - button \"少林寺 → 塔林 → 达摩洞\":\n - generic: 少林寺 → 塔林 → 达摩洞\n - button \"少室山 → 迎客峰\":\n - generic: 少室山 → 迎客峰" + }, + { + "name": "04-空镜航线无数据", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 选择航线, ID: radix-_r_s_\n\t\t2 heading 选择航线, Value: 2, ID: radix-_r_t_\n\t\t\t3 text 选择航线\n\t\t4 checkbox 全部航线, Value: 1\n\t\t\t5 text 全部航线\n\t\t\t6 image\n\t\t7 checkbox 共眠岸 → 三皇寨 → 好汉坡, Value: 0\n\t\t8 checkbox 少林寺 → 塔林 → 达摩洞, Value: 0\n\t\t9 checkbox 少室山 → 迎客峰, Value: 0\n\nThe focused UI element is 9 checkbox 少室山 → 迎客峰, Value: 0" + }, + { + "name": "04-空镜航线筛选结果", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:24\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回机巢工作台\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 景区素材, Value: 1\n\t\t\t\t\t\t11 text 景区素材\n\t\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t\t13 button 体验景区素材其他状态\n\t\t\t\t\t\t14 image\n\t\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t\t16 button 筛选航线\n\t\t\t\t\t\t17 text 少室山 → 迎客峰\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 button 筛选时间\n\t\t\t\t\t\t20 text 全部时间\n\t\t\t\t\t\t21 image\n\t\t\t\t22 container\n\t\t\t\t\t23 text 素材保留 90 天,请及时下载\n\t\t\t\t\t24 image\n\t\t\t\t\t25 heading 没有符合条件的素材, Value: 2\n\t\t\t\t\t\t26 text 没有符合条件的素材\n\t\t\t\t\t27 text 试试其他航线或时间范围\n\t\t\t\t\t28 button 重置筛选\n\t\t\t\t29 container\n\t\t\t\t\t30 text 已选 0 段\n\t\t\t\t\t31 button (disabled) 下载所选\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "05-空镜时间筛选", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 选择时间, ID: radix-_r_s_\n\t\t2 heading 选择时间, Value: 2, ID: radix-_r_t_\n\t\t\t3 text 选择时间\n\t\t4 text 选择起止日期\n\t\t5 checkbox 全部时间, Value: 0\n\t\t6 container 选择开始或结束日期\n\t\t\t7 checkbox 开始日期 10月23日, Value: 1\n\t\t\t\t8 text 开始日期\n\t\t\t\t9 container\n\t\t\t\t\t10 text 10 月 23 日\n\t\t\t11 checkbox 结束日期 10月23日, Value: 0\n\t\t\t\t12 text 结束日期\n\t\t\t\t13 container\n\t\t\t\t\t14 text 10 月 23 日\n\t\t15 container\n\t\t\t16 list 开始月份\n\t\t\t\t17 7月\n\t\t\t\t18 8月\n\t\t\t\t19 9月\n\t\t\t\t20 (selected) 10月\n\t\t\t21 list 开始日期\n\t\t\t\t22 1日\n\t\t\t\t23 2日\n\t\t\t\t24 3日\n\t\t\t\t25 4日\n\t\t\t\t26 5日\n\t\t\t\t27 6日\n\t\t\t\t28 7日\n\t\t\t\t29 8日\n\t\t\t\t30 9日\n\t\t\t\t31 10日\n\t\t\t\t32 11日\n\t\t\t\t33 12日\n\t\t\t\t34 13日\n\t\t\t\t35 14日\n\t\t\t\t36 15日\n\t\t\t\t37 16日\n\t\t\t\t38 17日\n\t\t\t\t39 18日\n\t\t\t\t40 19日\n\t\t\t\t41 20日\n\t\t\t\t42 21日\n\t\t\t\t43 22日\n\t\t\t\t44 (selected) 23日\n\t\t45 text 仅显示保留期内已到来的日期\n\t\t46 button 取消\n\t\t47 button 确定\n\nThe focused UI element is 5 checkbox 全部时间, Value: 0" + }, + { + "name": "06-空镜重置筛选", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:25\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回机巢工作台\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 景区素材, Value: 1\n\t\t\t\t\t\t11 text 景区素材\n\t\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t\t13 button 体验景区素材其他状态\n\t\t\t\t\t\t14 image\n\t\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t\t16 button 筛选航线\n\t\t\t\t\t\t17 text 全部航线\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 button 筛选时间\n\t\t\t\t\t\t20 text 全部时间\n\t\t\t\t\t\t21 image\n\t\t\t\t22 container\n\t\t\t\t\t23 text 素材保留 90 天,请及时下载\n\t\t\t\t\t24 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t25 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t26 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t27 container\n\t\t\t\t\t\t\t28 text 10-23 17:20\n\t\t\t\t\t\t\t29 text · 5 段素材\n\t\t\t\t\t\t\t30 checkbox Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t\t32 text 选择本组\n\t\t\t\t\t\t\t33 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t34 image 航线视频片段 1\n\t\t\t\t\t\t\t\t35 text 片段 \n\t\t\t\t\t\t\t\t36 text 01\n\t\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t\t38 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t39 checkbox Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t40 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t41 image 航线视频片段 2\n\t\t\t\t\t\t\t\t42 text 片段 \n\t\t\t\t\t\t\t\t43 text 02\n\t\t\t\t\t\t\t\t44 text 00:27\n\t\t\t\t\t\t\t45 checkbox Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t46 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t47 image 航线视频片段 3\n\t\t\t\t\t\t\t\t48 text 片段 \n\t\t\t\t\t\t\t\t49 text 03\n\t\t\t\t\t\t\t\t50 text 00:30\n\t\t\t\t\t\t\t51 checkbox Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t52 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t53 image 航线视频片段 4\n\t\t\t\t\t\t\t\t54 text 片段 \n\t\t\t\t\t\t\t\t55 text 04\n\t\t\t\t\t\t\t\t56 text 00:24\n\t\t\t\t\t\t\t57 checkbox Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t58 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t59 image 航线视频片段 5\n\t\t\t\t\t\t\t\t60 text 片段 \n\t\t\t\t\t\t\t\t61 text 05\n\t\t\t\t\t\t\t\t62 text 00:31\n\t\t\t\t\t\t\t63 checkbox Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t64 container\n\t\t\t\t\t\t\t65 text 10-23 14:30\n\t\t\t\t\t\t\t66 text · 6 段素材\n\t\t\t\t\t\t\t67 checkbox Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t\t69 text 选择本组\n\t\t\t\t\t\t\t70 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t71 image 航线视频片段 1\n\t\t\t\t\t\t\t\t72 text 片段 \n\t\t\t\t\t\t\t\t73 text 01\n\t\t\t\t\t\t\t\t74 container\n\t\t\t\t\t\t\t\t\t75 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t76 checkbox Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t77 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t78 image 航线视频片段 2\n\t\t\t\t\t\t\t\t79 text 片段 \n\t\t\t\t\t\t\t\t80 text 02\n\t\t\t\t\t\t\t\t81 text 00:27\n\t\t\t\t\t\t\t82 checkbox Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t83 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t84 image 航线视频片段 3\n\t\t\t\t\t\t\t\t85 text 片段 \n\t\t\t\t\t\t\t\t86 text 03\n\t\t\t\t\t\t\t\t87 text 00:30\n\t\t\t\t\t\t\t88 checkbox Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t89 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t90 image 航线视频片段 4\n\t\t\t\t\t\t\t\t91 text 片段 \n\t\t\t\t\t\t\t\t92 text 04\n\t\t\t\t\t\t\t\t93 text 00:24\n\t\t\t\t\t\t\t94 checkbox Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t95 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t96 image 航线视频片段 5\n\t\t\t\t\t\t\t\t97 text 片段 \n\t\t\t\t\t\t\t\t98 text 05\n\t\t\t\t\t\t\t\t99 text 00:31\n\t\t\t\t\t\t\t100 checkbox Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t101 button 展开其余 1 段\n\t\t\t\t\t\t\t\t102 text 展开其余 1 段\n\t\t\t\t\t\t\t\t103 image\n\t\t\t\t\t\t104 container\n\t\t\t\t\t\t\t105 text 10-22 16:10\n\t\t\t\t\t\t\t106 text · 3 段素材\n\t\t\t\t\t\t\t107 checkbox Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t108 image\n\t\t\t\t\t\t\t\t109 text 选择本组\n\t\t\t\t\t\t\t110 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t111 image 航线视频片段 1\n\t\t\t\t\t\t\t\t112 text 片段 \n\t\t\t\t\t\t\t\t113 text 01\n\t\t\t\t\t\t\t\t114 container\n\t\t\t\t\t\t\t\t\t115 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t116 checkbox Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t117 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t118 image 航线视频片段 2\n\t\t\t\t\t\t\t\t119 text 片段 \n\t\t\t\t\t\t\t\t120 text 02\n\t\t\t\t\t\t\t\t121 text 00:27\n\t\t\t\t\t\t\t122 checkbox Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t123 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t124 image 航线视频片段 3\n\t\t\t\t\t\t\t\t125 text 片段 \n\t\t\t\t\t\t\t\t126 text 03\n\t\t\t\t\t\t\t\t127 text 00:30\n\t\t\t\t\t\t\t128 checkbox Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t129 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t130 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t131 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t132 container\n\t\t\t\t\t\t\t133 text 10-23 10:40\n\t\t\t\t\t\t\t134 text · 4 段素材\n\t\t\t\t\t\t\t135 checkbox Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t136 image\n\t\t\t\t\t\t\t\t137 text 选择本组\n\t\t\t\t\t\t\t138 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t139 image 航线视频片段 1\n\t\t\t\t\t\t\t\t140 text 片段 \n\t\t\t\t\t\t\t\t141 text 01\n\t\t\t\t\t\t\t\t142 container\n\t\t\t\t\t\t\t\t\t143 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t144 checkbox Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t145 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t146 image 航线视频片段 2\n\t\t\t\t\t\t\t\t147 text 片段 \n\t\t\t\t\t\t\t\t148 text 02\n\t\t\t\t\t\t\t\t149 text 00:27\n\t\t\t\t\t\t\t150 checkbox Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t151 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t152 image 航线视频片段 3\n\t\t\t\t\t\t\t\t153 text 片段 \n\t\t\t\t\t\t\t\t154 text 03\n\t\t\t\t\t\t\t\t155 text 00:30\n\t\t\t\t\t\t\t156 checkbox Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t157 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t158 image 航线视频片段 4\n\t\t\t\t\t\t\t\t159 text 片段 \n\t\t\t\t\t\t\t\t160 text 04\n\t\t\t\t\t\t\t\t161 text 00:24\n\t\t\t\t\t\t\t162 checkbox Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t163 container\n\t\t\t\t\t\t\t164 text 10-10 15:35\n\t\t\t\t\t\t\t165 text · 5 段素材\n\t\t\t\t\t\t\t166 checkbox Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t167 image\n\t\t\t\t\t\t\t\t168 text 选择本组\n\t\t\t\t\t\t\t169 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t170 image 航线视频片段 1\n\t\t\t\t\t\t\t\t171 text 片段 \n\t\t\t\t\t\t\t\t172 text 01\n\t\t\t\t\t\t\t\t173 container\n\t\t\t\t\t\t\t\t\t174 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t175 checkbox Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t176 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t177 image 航线视频片段 2\n\t\t\t\t\t\t\t\t178 text 片段 \n\t\t\t\t\t\t\t\t179 text 02\n\t\t\t\t\t\t\t\t180 text 00:27\n\t\t\t\t\t\t\t181 checkbox Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t182 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t183 image 航线视频片段 3\n\t\t\t\t\t\t\t\t184 text 片段 \n\t\t\t\t\t\t\t\t185 text 03\n\t\t\t\t\t\t\t\t186 text 00:30\n\t\t\t\t\t\t\t187 checkbox Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t188 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t189 image 航线视频片段 4\n\t\t\t\t\t\t\t\t190 text 片段 \n\t\t\t\t\t\t\t\t191 text 04\n\t\t\t\t\t\t\t\t192 text 00:24\n\t\t\t\t\t\t\t193 checkbox Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t194 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t195 image 航线视频片段 5\n\t\t\t\t\t\t\t\t196 text 片段 \n\t\t\t\t\t\t\t\t197 text 05\n\t\t\t\t\t\t\t\t198 text 00:31\n\t\t\t\t\t\t\t199 checkbox Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t200 text 已显示保留期内的全部演示记录\n\t\t\t\t201 container\n\t\t\t\t\t202 text 已选 0 段\n\t\t\t\t\t203 button (disabled) 下载所选\n\t\t\t204 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "07-空镜状态菜单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_s_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_t_\n\t\t\t3 text 体验本页状态\n\t\t4 text 仅切换当前页面;正常下载会自动推进。\n\t\t5 button 正常素材列表\n\t\t\t6 text 正常素材列表\n\t\t\t7 image\n\t\t8 button 参考图 · 已选 2 段\n\t\t\t9 text 参考图 · 已选 2 段\n\t\t\t10 image\n\t\t11 button 下载中\n\t\t\t12 text 下载中\n\t\t\t13 image\n\t\t14 button 下载成功\n\t\t\t15 text 下载成功\n\t\t\t16 image\n\t\t17 button 部分下载失败\n\t\t\t18 text 部分下载失败\n\t\t\t19 image\n\t\t20 button 相册权限不足\n\t\t\t21 text 相册权限不足\n\t\t\t22 image\n\t\t23 button 暂无景区素材\n\t\t\t24 text 暂无景区素材\n\t\t\t25 image\n\t\t26 button 筛选无结果\n\t\t\t27 text 筛选无结果\n\t\t\t28 image\n\nThe focused UI element is 5 button 正常素材列表" + }, + { + "name": "08-空镜部分下载失败", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:25\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回机巢工作台\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 景区素材, Value: 1\n\t\t\t\t\t\t11 text 景区素材\n\t\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t\t13 button 体验景区素材其他状态\n\t\t\t\t\t\t14 image\n\t\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t\t16 button 筛选航线\n\t\t\t\t\t\t17 text 全部航线\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 button 筛选时间\n\t\t\t\t\t\t20 text 全部时间\n\t\t\t\t\t\t21 image\n\t\t\t\t22 container\n\t\t\t\t\t23 text 素材保留 90 天,请及时下载\n\t\t\t\t\t24 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t25 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t26 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t27 container\n\t\t\t\t\t\t\t28 text 10-23 17:20\n\t\t\t\t\t\t\t29 text · 5 段素材\n\t\t\t\t\t\t\t30 checkbox (disabled) Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t\t32 text 选择本组\n\t\t\t\t\t\t\t33 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t34 image 航线视频片段 1\n\t\t\t\t\t\t\t\t35 text 片段 \n\t\t\t\t\t\t\t\t36 text 01\n\t\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t\t38 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t39 checkbox (disabled) Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t40 text 已下载\n\t\t\t\t\t\t\t41 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t42 image 航线视频片段 2\n\t\t\t\t\t\t\t\t43 text 片段 \n\t\t\t\t\t\t\t\t44 text 02\n\t\t\t\t\t\t\t\t45 text 00:27\n\t\t\t\t\t\t\t46 checkbox (disabled) Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t47 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t48 image 航线视频片段 3\n\t\t\t\t\t\t\t\t49 text 片段 \n\t\t\t\t\t\t\t\t50 text 03\n\t\t\t\t\t\t\t\t51 text 00:30\n\t\t\t\t\t\t\t52 checkbox (disabled) Description: 取消选择片段3,10-23 17:20, Value: 1\n\t\t\t\t\t\t\t53 text 下载失败\n\t\t\t\t\t\t\t54 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t55 image 航线视频片段 4\n\t\t\t\t\t\t\t\t56 text 片段 \n\t\t\t\t\t\t\t\t57 text 04\n\t\t\t\t\t\t\t\t58 text 00:24\n\t\t\t\t\t\t\t59 checkbox (disabled) Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t60 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t61 image 航线视频片段 5\n\t\t\t\t\t\t\t\t62 text 片段 \n\t\t\t\t\t\t\t\t63 text 05\n\t\t\t\t\t\t\t\t64 text 00:31\n\t\t\t\t\t\t\t65 checkbox (disabled) Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t66 container\n\t\t\t\t\t\t\t67 text 10-23 14:30\n\t\t\t\t\t\t\t68 text · 6 段素材\n\t\t\t\t\t\t\t69 checkbox (disabled) Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t\t\t71 text 选择本组\n\t\t\t\t\t\t\t72 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t73 image 航线视频片段 1\n\t\t\t\t\t\t\t\t74 text 片段 \n\t\t\t\t\t\t\t\t75 text 01\n\t\t\t\t\t\t\t\t76 container\n\t\t\t\t\t\t\t\t\t77 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t78 checkbox (disabled) Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t79 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t80 image 航线视频片段 2\n\t\t\t\t\t\t\t\t81 text 片段 \n\t\t\t\t\t\t\t\t82 text 02\n\t\t\t\t\t\t\t\t83 text 00:27\n\t\t\t\t\t\t\t84 checkbox (disabled) Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t85 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t86 image 航线视频片段 3\n\t\t\t\t\t\t\t\t87 text 片段 \n\t\t\t\t\t\t\t\t88 text 03\n\t\t\t\t\t\t\t\t89 text 00:30\n\t\t\t\t\t\t\t90 checkbox (disabled) Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t91 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t92 image 航线视频片段 4\n\t\t\t\t\t\t\t\t93 text 片段 \n\t\t\t\t\t\t\t\t94 text 04\n\t\t\t\t\t\t\t\t95 text 00:24\n\t\t\t\t\t\t\t96 checkbox (disabled) Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t97 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t98 image 航线视频片段 5\n\t\t\t\t\t\t\t\t99 text 片段 \n\t\t\t\t\t\t\t\t100 text 05\n\t\t\t\t\t\t\t\t101 text 00:31\n\t\t\t\t\t\t\t102 checkbox (disabled) Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t103 button 展开其余 1 段\n\t\t\t\t\t\t\t\t104 text 展开其余 1 段\n\t\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t106 container\n\t\t\t\t\t\t\t107 text 10-22 16:10\n\t\t\t\t\t\t\t108 text · 3 段素材\n\t\t\t\t\t\t\t109 checkbox (disabled) Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t110 image\n\t\t\t\t\t\t\t\t111 text 选择本组\n\t\t\t\t\t\t\t112 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t113 image 航线视频片段 1\n\t\t\t\t\t\t\t\t114 text 片段 \n\t\t\t\t\t\t\t\t115 text 01\n\t\t\t\t\t\t\t\t116 container\n\t\t\t\t\t\t\t\t\t117 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t118 checkbox (disabled) Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t119 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t120 image 航线视频片段 2\n\t\t\t\t\t\t\t\t121 text 片段 \n\t\t\t\t\t\t\t\t122 text 02\n\t\t\t\t\t\t\t\t123 text 00:27\n\t\t\t\t\t\t\t124 checkbox (disabled) Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t125 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t126 image 航线视频片段 3\n\t\t\t\t\t\t\t\t127 text 片段 \n\t\t\t\t\t\t\t\t128 text 03\n\t\t\t\t\t\t\t\t129 text 00:30\n\t\t\t\t\t\t\t130 checkbox (disabled) Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t131 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t132 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t133 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t134 container\n\t\t\t\t\t\t\t135 text 10-23 10:40\n\t\t\t\t\t\t\t136 text · 4 段素材\n\t\t\t\t\t\t\t137 checkbox (disabled) Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t138 image\n\t\t\t\t\t\t\t\t139 text 选择本组\n\t\t\t\t\t\t\t140 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t141 image 航线视频片段 1\n\t\t\t\t\t\t\t\t142 text 片段 \n\t\t\t\t\t\t\t\t143 text 01\n\t\t\t\t\t\t\t\t144 container\n\t\t\t\t\t\t\t\t\t145 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t146 checkbox (disabled) Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t147 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t148 image 航线视频片段 2\n\t\t\t\t\t\t\t\t149 text 片段 \n\t\t\t\t\t\t\t\t150 text 02\n\t\t\t\t\t\t\t\t151 text 00:27\n\t\t\t\t\t\t\t152 checkbox (disabled) Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t153 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t154 image 航线视频片段 3\n\t\t\t\t\t\t\t\t155 text 片段 \n\t\t\t\t\t\t\t\t156 text 03\n\t\t\t\t\t\t\t\t157 text 00:30\n\t\t\t\t\t\t\t158 checkbox (disabled) Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t159 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t160 image 航线视频片段 4\n\t\t\t\t\t\t\t\t161 text 片段 \n\t\t\t\t\t\t\t\t162 text 04\n\t\t\t\t\t\t\t\t163 text 00:24\n\t\t\t\t\t\t\t164 checkbox (disabled) Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t165 container\n\t\t\t\t\t\t\t166 text 10-10 15:35\n\t\t\t\t\t\t\t167 text · 5 段素材\n\t\t\t\t\t\t\t168 checkbox (disabled) Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t169 image\n\t\t\t\t\t\t\t\t170 text 选择本组\n\t\t\t\t\t\t\t171 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t172 image 航线视频片段 1\n\t\t\t\t\t\t\t\t173 text 片段 \n\t\t\t\t\t\t\t\t174 text 01\n\t\t\t\t\t\t\t\t175 container\n\t\t\t\t\t\t\t\t\t176 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t177 checkbox (disabled) Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t178 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t179 image 航线视频片段 2\n\t\t\t\t\t\t\t\t180 text 片段 \n\t\t\t\t\t\t\t\t181 text 02\n\t\t\t\t\t\t\t\t182 text 00:27\n\t\t\t\t\t\t\t183 checkbox (disabled) Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t184 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t185 image 航线视频片段 3\n\t\t\t\t\t\t\t\t186 text 片段 \n\t\t\t\t\t\t\t\t187 text 03\n\t\t\t\t\t\t\t\t188 text 00:30\n\t\t\t\t\t\t\t189 checkbox (disabled) Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t190 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t191 image 航线视频片段 4\n\t\t\t\t\t\t\t\t192 text 片段 \n\t\t\t\t\t\t\t\t193 text 04\n\t\t\t\t\t\t\t\t194 text 00:24\n\t\t\t\t\t\t\t195 checkbox (disabled) Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t196 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t197 image 航线视频片段 5\n\t\t\t\t\t\t\t\t198 text 片段 \n\t\t\t\t\t\t\t\t199 text 05\n\t\t\t\t\t\t\t\t200 text 00:31\n\t\t\t\t\t\t\t201 checkbox (disabled) Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t202 text 已显示保留期内的全部演示记录\n\t\t\t\t203 container\n\t\t\t\t\t204 text 已下载 1 段 · 失败 1 段\n\t\t\t\t\t205 text 演示结果 · 未保存真实文件\n\t\t\t\t\t206 button 继续选择\n\t\t\t\t\t207 button 重试失败(1)\n\t\t\t\t\t\t208 text 重试失败(\n\t\t\t\t\t\t209 text 1\n\t\t\t\t\t\t210 text )\n\t\t\t211 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "09-空镜失败重试", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:25\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回机巢工作台\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 景区素材, Value: 1\n\t\t\t\t\t\t11 text 景区素材\n\t\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t\t13 button 体验景区素材其他状态\n\t\t\t\t\t\t14 image\n\t\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t\t16 button (disabled) 筛选航线\n\t\t\t\t\t\t17 text 全部航线\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 button (disabled) 筛选时间\n\t\t\t\t\t\t20 text 全部时间\n\t\t\t\t\t\t21 image\n\t\t\t\t22 container\n\t\t\t\t\t23 text 素材保留 90 天,请及时下载\n\t\t\t\t\t24 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t25 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t26 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t27 container\n\t\t\t\t\t\t\t28 text 10-23 17:20\n\t\t\t\t\t\t\t29 text · 5 段素材\n\t\t\t\t\t\t\t30 checkbox (disabled) Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t\t32 text 选择本组\n\t\t\t\t\t\t\t33 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t34 image 航线视频片段 1\n\t\t\t\t\t\t\t\t35 text 片段 \n\t\t\t\t\t\t\t\t36 text 01\n\t\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t\t38 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t39 checkbox (disabled) Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t40 text 已下载\n\t\t\t\t\t\t\t41 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t42 image 航线视频片段 2\n\t\t\t\t\t\t\t\t43 text 片段 \n\t\t\t\t\t\t\t\t44 text 02\n\t\t\t\t\t\t\t\t45 text 00:27\n\t\t\t\t\t\t\t46 checkbox (disabled) Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t47 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t48 image 航线视频片段 3\n\t\t\t\t\t\t\t\t49 text 片段 \n\t\t\t\t\t\t\t\t50 text 03\n\t\t\t\t\t\t\t\t51 text 00:30\n\t\t\t\t\t\t\t52 checkbox (disabled) Description: 取消选择片段3,10-23 17:20, Value: 1\n\t\t\t\t\t\t\t54 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t55 image 航线视频片段 4\n\t\t\t\t\t\t\t\t56 text 片段 \n\t\t\t\t\t\t\t\t57 text 04\n\t\t\t\t\t\t\t\t58 text 00:24\n\t\t\t\t\t\t\t59 checkbox (disabled) Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t60 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t61 image 航线视频片段 5\n\t\t\t\t\t\t\t\t62 text 片段 \n\t\t\t\t\t\t\t\t63 text 05\n\t\t\t\t\t\t\t\t64 text 00:31\n\t\t\t\t\t\t\t65 checkbox (disabled) Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t66 container\n\t\t\t\t\t\t\t67 text 10-23 14:30\n\t\t\t\t\t\t\t68 text · 6 段素材\n\t\t\t\t\t\t\t69 checkbox (disabled) Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t\t\t71 text 选择本组\n\t\t\t\t\t\t\t72 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t73 image 航线视频片段 1\n\t\t\t\t\t\t\t\t74 text 片段 \n\t\t\t\t\t\t\t\t75 text 01\n\t\t\t\t\t\t\t\t76 container\n\t\t\t\t\t\t\t\t\t77 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t78 checkbox (disabled) Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t79 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t80 image 航线视频片段 2\n\t\t\t\t\t\t\t\t81 text 片段 \n\t\t\t\t\t\t\t\t82 text 02\n\t\t\t\t\t\t\t\t83 text 00:27\n\t\t\t\t\t\t\t84 checkbox (disabled) Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t85 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t86 image 航线视频片段 3\n\t\t\t\t\t\t\t\t87 text 片段 \n\t\t\t\t\t\t\t\t88 text 03\n\t\t\t\t\t\t\t\t89 text 00:30\n\t\t\t\t\t\t\t90 checkbox (disabled) Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t91 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t92 image 航线视频片段 4\n\t\t\t\t\t\t\t\t93 text 片段 \n\t\t\t\t\t\t\t\t94 text 04\n\t\t\t\t\t\t\t\t95 text 00:24\n\t\t\t\t\t\t\t96 checkbox (disabled) Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t97 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t98 image 航线视频片段 5\n\t\t\t\t\t\t\t\t99 text 片段 \n\t\t\t\t\t\t\t\t100 text 05\n\t\t\t\t\t\t\t\t101 text 00:31\n\t\t\t\t\t\t\t102 checkbox (disabled) Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t103 button 展开其余 1 段\n\t\t\t\t\t\t\t\t104 text 展开其余 1 段\n\t\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t106 container\n\t\t\t\t\t\t\t107 text 10-22 16:10\n\t\t\t\t\t\t\t108 text · 3 段素材\n\t\t\t\t\t\t\t109 checkbox (disabled) Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t110 image\n\t\t\t\t\t\t\t\t111 text 选择本组\n\t\t\t\t\t\t\t112 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t113 image 航线视频片段 1\n\t\t\t\t\t\t\t\t114 text 片段 \n\t\t\t\t\t\t\t\t115 text 01\n\t\t\t\t\t\t\t\t116 container\n\t\t\t\t\t\t\t\t\t117 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t118 checkbox (disabled) Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t119 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t120 image 航线视频片段 2\n\t\t\t\t\t\t\t\t121 text 片段 \n\t\t\t\t\t\t\t\t122 text 02\n\t\t\t\t\t\t\t\t123 text 00:27\n\t\t\t\t\t\t\t124 checkbox (disabled) Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t125 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t126 image 航线视频片段 3\n\t\t\t\t\t\t\t\t127 text 片段 \n\t\t\t\t\t\t\t\t128 text 03\n\t\t\t\t\t\t\t\t129 text 00:30\n\t\t\t\t\t\t\t130 checkbox (disabled) Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t131 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t132 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t133 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t134 container\n\t\t\t\t\t\t\t135 text 10-23 10:40\n\t\t\t\t\t\t\t136 text · 4 段素材\n\t\t\t\t\t\t\t137 checkbox (disabled) Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t138 image\n\t\t\t\t\t\t\t\t139 text 选择本组\n\t\t\t\t\t\t\t140 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t141 image 航线视频片段 1\n\t\t\t\t\t\t\t\t142 text 片段 \n\t\t\t\t\t\t\t\t143 text 01\n\t\t\t\t\t\t\t\t144 container\n\t\t\t\t\t\t\t\t\t145 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t146 checkbox (disabled) Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t147 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t148 image 航线视频片段 2\n\t\t\t\t\t\t\t\t149 text 片段 \n\t\t\t\t\t\t\t\t150 text 02\n\t\t\t\t\t\t\t\t151 text 00:27\n\t\t\t\t\t\t\t152 checkbox (disabled) Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t153 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t154 image 航线视频片段 3\n\t\t\t\t\t\t\t\t155 text 片段 \n\t\t\t\t\t\t\t\t156 text 03\n\t\t\t\t\t\t\t\t157 text 00:30\n\t\t\t\t\t\t\t158 checkbox (disabled) Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t159 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t160 image 航线视频片段 4\n\t\t\t\t\t\t\t\t161 text 片段 \n\t\t\t\t\t\t\t\t162 text 04\n\t\t\t\t\t\t\t\t163 text 00:24\n\t\t\t\t\t\t\t164 checkbox (disabled) Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t165 container\n\t\t\t\t\t\t\t166 text 10-10 15:35\n\t\t\t\t\t\t\t167 text · 5 段素材\n\t\t\t\t\t\t\t168 checkbox (disabled) Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t169 image\n\t\t\t\t\t\t\t\t170 text 选择本组\n\t\t\t\t\t\t\t171 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t172 image 航线视频片段 1\n\t\t\t\t\t\t\t\t173 text 片段 \n\t\t\t\t\t\t\t\t174 text 01\n\t\t\t\t\t\t\t\t175 container\n\t\t\t\t\t\t\t\t\t176 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t177 checkbox (disabled) Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t178 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t179 image 航线视频片段 2\n\t\t\t\t\t\t\t\t180 text 片段 \n\t\t\t\t\t\t\t\t181 text 02\n\t\t\t\t\t\t\t\t182 text 00:27\n\t\t\t\t\t\t\t183 checkbox (disabled) Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t184 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t185 image 航线视频片段 3\n\t\t\t\t\t\t\t\t186 text 片段 \n\t\t\t\t\t\t\t\t187 text 03\n\t\t\t\t\t\t\t\t188 text 00:30\n\t\t\t\t\t\t\t189 checkbox (disabled) Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t190 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t191 image 航线视频片段 4\n\t\t\t\t\t\t\t\t192 text 片段 \n\t\t\t\t\t\t\t\t193 text 04\n\t\t\t\t\t\t\t\t194 text 00:24\n\t\t\t\t\t\t\t195 checkbox (disabled) Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t196 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t197 image 航线视频片段 5\n\t\t\t\t\t\t\t\t198 text 片段 \n\t\t\t\t\t\t\t\t199 text 05\n\t\t\t\t\t\t\t\t200 text 00:31\n\t\t\t\t\t\t\t201 checkbox (disabled) Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t202 text 已显示保留期内的全部演示记录\n\t\t\t\t203 container\n\t\t\t\t\t204 text 下载中 · 1/2 段\n\t\t\t\t\t212 button 取消\n\t\t\t\t\t213 progress indicator Description: 批量下载进度, Value: 1\n\t\t\t\t\t206 button (disabled) 正在下载\n\t\t\t\t\t\t214 image\n\t\t\t\t\t\t215 text 正在下载\n\t\t\t211 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "10-空镜重试最终结果", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:25\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回机巢工作台\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 景区素材, Value: 1\n\t\t\t\t\t\t11 text 景区素材\n\t\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t\t13 button 体验景区素材其他状态\n\t\t\t\t\t\t14 image\n\t\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t\t16 button 筛选航线\n\t\t\t\t\t\t17 text 全部航线\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 button 筛选时间\n\t\t\t\t\t\t20 text 全部时间\n\t\t\t\t\t\t21 image\n\t\t\t\t22 container\n\t\t\t\t\t23 text 素材保留 90 天,请及时下载\n\t\t\t\t\t24 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t25 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t26 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t27 container\n\t\t\t\t\t\t\t28 text 10-23 17:20\n\t\t\t\t\t\t\t29 text · 5 段素材\n\t\t\t\t\t\t\t30 checkbox (disabled) Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t\t32 text 选择本组\n\t\t\t\t\t\t\t33 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t34 image 航线视频片段 1\n\t\t\t\t\t\t\t\t35 text 片段 \n\t\t\t\t\t\t\t\t36 text 01\n\t\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t\t38 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t39 checkbox (disabled) Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t40 text 已下载\n\t\t\t\t\t\t\t41 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t42 image 航线视频片段 2\n\t\t\t\t\t\t\t\t43 text 片段 \n\t\t\t\t\t\t\t\t44 text 02\n\t\t\t\t\t\t\t\t45 text 00:27\n\t\t\t\t\t\t\t46 checkbox (disabled) Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t47 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t48 image 航线视频片段 3\n\t\t\t\t\t\t\t\t49 text 片段 \n\t\t\t\t\t\t\t\t50 text 03\n\t\t\t\t\t\t\t\t51 text 00:30\n\t\t\t\t\t\t\t52 checkbox (disabled) Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t212 text 已下载\n\t\t\t\t\t\t\t54 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t55 image 航线视频片段 4\n\t\t\t\t\t\t\t\t56 text 片段 \n\t\t\t\t\t\t\t\t57 text 04\n\t\t\t\t\t\t\t\t58 text 00:24\n\t\t\t\t\t\t\t59 checkbox (disabled) Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t60 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t61 image 航线视频片段 5\n\t\t\t\t\t\t\t\t62 text 片段 \n\t\t\t\t\t\t\t\t63 text 05\n\t\t\t\t\t\t\t\t64 text 00:31\n\t\t\t\t\t\t\t65 checkbox (disabled) Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t66 container\n\t\t\t\t\t\t\t67 text 10-23 14:30\n\t\t\t\t\t\t\t68 text · 6 段素材\n\t\t\t\t\t\t\t69 checkbox (disabled) Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t\t\t71 text 选择本组\n\t\t\t\t\t\t\t72 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t73 image 航线视频片段 1\n\t\t\t\t\t\t\t\t74 text 片段 \n\t\t\t\t\t\t\t\t75 text 01\n\t\t\t\t\t\t\t\t76 container\n\t\t\t\t\t\t\t\t\t77 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t78 checkbox (disabled) Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t79 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t80 image 航线视频片段 2\n\t\t\t\t\t\t\t\t81 text 片段 \n\t\t\t\t\t\t\t\t82 text 02\n\t\t\t\t\t\t\t\t83 text 00:27\n\t\t\t\t\t\t\t84 checkbox (disabled) Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t85 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t86 image 航线视频片段 3\n\t\t\t\t\t\t\t\t87 text 片段 \n\t\t\t\t\t\t\t\t88 text 03\n\t\t\t\t\t\t\t\t89 text 00:30\n\t\t\t\t\t\t\t90 checkbox (disabled) Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t91 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t92 image 航线视频片段 4\n\t\t\t\t\t\t\t\t93 text 片段 \n\t\t\t\t\t\t\t\t94 text 04\n\t\t\t\t\t\t\t\t95 text 00:24\n\t\t\t\t\t\t\t96 checkbox (disabled) Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t97 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t98 image 航线视频片段 5\n\t\t\t\t\t\t\t\t99 text 片段 \n\t\t\t\t\t\t\t\t100 text 05\n\t\t\t\t\t\t\t\t101 text 00:31\n\t\t\t\t\t\t\t102 checkbox (disabled) Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t103 button 展开其余 1 段\n\t\t\t\t\t\t\t\t104 text 展开其余 1 段\n\t\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t106 container\n\t\t\t\t\t\t\t107 text 10-22 16:10\n\t\t\t\t\t\t\t108 text · 3 段素材\n\t\t\t\t\t\t\t109 checkbox (disabled) Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t110 image\n\t\t\t\t\t\t\t\t111 text 选择本组\n\t\t\t\t\t\t\t112 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t113 image 航线视频片段 1\n\t\t\t\t\t\t\t\t114 text 片段 \n\t\t\t\t\t\t\t\t115 text 01\n\t\t\t\t\t\t\t\t116 container\n\t\t\t\t\t\t\t\t\t117 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t118 checkbox (disabled) Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t119 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t120 image 航线视频片段 2\n\t\t\t\t\t\t\t\t121 text 片段 \n\t\t\t\t\t\t\t\t122 text 02\n\t\t\t\t\t\t\t\t123 text 00:27\n\t\t\t\t\t\t\t124 checkbox (disabled) Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t125 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t126 image 航线视频片段 3\n\t\t\t\t\t\t\t\t127 text 片段 \n\t\t\t\t\t\t\t\t128 text 03\n\t\t\t\t\t\t\t\t129 text 00:30\n\t\t\t\t\t\t\t130 checkbox (disabled) Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t131 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t132 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t133 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t134 container\n\t\t\t\t\t\t\t135 text 10-23 10:40\n\t\t\t\t\t\t\t136 text · 4 段素材\n\t\t\t\t\t\t\t137 checkbox (disabled) Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t138 image\n\t\t\t\t\t\t\t\t139 text 选择本组\n\t\t\t\t\t\t\t140 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t141 image 航线视频片段 1\n\t\t\t\t\t\t\t\t142 text 片段 \n\t\t\t\t\t\t\t\t143 text 01\n\t\t\t\t\t\t\t\t144 container\n\t\t\t\t\t\t\t\t\t145 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t146 checkbox (disabled) Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t147 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t148 image 航线视频片段 2\n\t\t\t\t\t\t\t\t149 text 片段 \n\t\t\t\t\t\t\t\t150 text 02\n\t\t\t\t\t\t\t\t151 text 00:27\n\t\t\t\t\t\t\t152 checkbox (disabled) Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t153 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t154 image 航线视频片段 3\n\t\t\t\t\t\t\t\t155 text 片段 \n\t\t\t\t\t\t\t\t156 text 03\n\t\t\t\t\t\t\t\t157 text 00:30\n\t\t\t\t\t\t\t158 checkbox (disabled) Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t159 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t160 image 航线视频片段 4\n\t\t\t\t\t\t\t\t161 text 片段 \n\t\t\t\t\t\t\t\t162 text 04\n\t\t\t\t\t\t\t\t163 text 00:24\n\t\t\t\t\t\t\t164 checkbox (disabled) Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t165 container\n\t\t\t\t\t\t\t166 text 10-10 15:35\n\t\t\t\t\t\t\t167 text · 5 段素材\n\t\t\t\t\t\t\t168 checkbox (disabled) Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t169 image\n\t\t\t\t\t\t\t\t170 text 选择本组\n\t\t\t\t\t\t\t171 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t172 image 航线视频片段 1\n\t\t\t\t\t\t\t\t173 text 片段 \n\t\t\t\t\t\t\t\t174 text 01\n\t\t\t\t\t\t\t\t175 container\n\t\t\t\t\t\t\t\t\t176 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t177 checkbox (disabled) Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t178 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t179 image 航线视频片段 2\n\t\t\t\t\t\t\t\t180 text 片段 \n\t\t\t\t\t\t\t\t181 text 02\n\t\t\t\t\t\t\t\t182 text 00:27\n\t\t\t\t\t\t\t183 checkbox (disabled) Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t184 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t185 image 航线视频片段 3\n\t\t\t\t\t\t\t\t186 text 片段 \n\t\t\t\t\t\t\t\t187 text 03\n\t\t\t\t\t\t\t\t188 text 00:30\n\t\t\t\t\t\t\t189 checkbox (disabled) Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t190 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t191 image 航线视频片段 4\n\t\t\t\t\t\t\t\t192 text 片段 \n\t\t\t\t\t\t\t\t193 text 04\n\t\t\t\t\t\t\t\t194 text 00:24\n\t\t\t\t\t\t\t195 checkbox (disabled) Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t196 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t197 image 航线视频片段 5\n\t\t\t\t\t\t\t\t198 text 片段 \n\t\t\t\t\t\t\t\t199 text 05\n\t\t\t\t\t\t\t\t200 text 00:31\n\t\t\t\t\t\t\t201 checkbox (disabled) Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t202 text 已显示保留期内的全部演示记录\n\t\t\t\t203 container\n\t\t\t\t\t204 text 已下载 2 段\n\t\t\t\t\t213 text 演示结果 · 未保存真实文件\n\t\t\t\t\t206 button 继续选择素材\n\t\t\t211 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "11-空镜视频预览", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 视频预览, ID: radix-_r_10_\n\t\t2 heading 视频预览, Value: 2, ID: radix-_r_11_\n\t\t\t3 text 视频预览\n\t\t4 text 演示播放器 · 展示封面与播放控件,未接入真实视频\n\t\t5 container\n\t\t\t6 image 视频封面预览\n\t\t\t7 button 演示播放\n\t\t\t\t8 image\n\t\t9 progress indicator Description: 演示播放进度, Value: 0\n\t\t10 text 00:00\n\t\t11 text / \n\t\t12 text 00:28\n\t\t13 text 4K · \n\t\t14 text 178\n\t\t15 text MB\n\t\t16 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 3\n\t\t\t17 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t18 container\n\t\t\t19 text 10-23 17:20 · 片段 1\n\t\t20 button 返回素材列表\n\nThe focused UI element is 7 button 演示播放" + }, + { + "name": "12-拍摄准备", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:26\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t11 text 拍摄准备\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 含 1 次拍摄\n\t\t\t\t\t21 container\n\t\t\t\t\t\t22 text 已拍摄 0 次\n\t\t\t\t\t23 container\n\t\t\t\t\t\t24 text 剩余 1 次\n\t\t\t\t\t25 heading 拍摄点, Value: 2\n\t\t\t\t\t\t26 text 拍摄点\n\t\t\t\t\t27 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t28 checkbox 三皇寨 范围内 未拍摄, Value: 1\n\t\t\t\t\t\t\t29 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t30 text 三皇寨\n\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t32 text 范围内\n\t\t\t\t\t\t\t33 text 未拍摄\n\t\t\t\t\t\t34 checkbox 金阙云宫 800 m 未拍摄, Value: 0\n\t\t\t\t\t\t\t35 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t36 text 金阙云宫\n\t\t\t\t\t\t\t37 image\n\t\t\t\t\t\t\t38 text 800 m\n\t\t\t\t\t\t\t39 text 未拍摄\n\t\t\t\t\t\t40 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t41 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t42 text 少室山\n\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 text 1.2 km\n\t\t\t\t\t\t\t45 text 未拍摄\n\t\t\t\t\t\t46 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t47 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t48 text 迎客峰\n\t\t\t\t\t\t\t49 image\n\t\t\t\t\t\t\t50 text 1.8 km\n\t\t\t\t\t\t\t51 text 未拍摄\n\t\t\t\t\t52 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t53 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t54 三皇寨的航线\n\t\t\t\t\t\t55 radio button 经典航线, Value: 1\n\t\t\t\t\t\t\t56 image\n\t\t\t\t\t\t\t57 text 经典航线\n\t\t\t\t\t\t\t58 image\n\t\t\t\t\t\t59 radio button 环绕专线, Value: 0\n\t\t\t\t\t\t\t60 image\n\t\t\t\t\t\t\t61 text 环绕专线\n\t\t\t\t\t\t\t62 image\n\t\t\t\t\t\t63 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t64 image\n\t\t\t\t\t\t\t65 text 远景拉升\n\t\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t69 text 全景环绕\n\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t71 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t73 text 高空俯瞰\n\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t75 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t77 text 山峰渐远\n\t\t\t\t\t\t\t78 image\n\t\t\t\t\t\t79 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 峡谷穿行\n\t\t\t\t\t\t\t82 image\n\t\t\t\t\t\t83 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t84 image\n\t\t\t\t\t\t\t85 text 山脊侧拍\n\t\t\t\t\t\t\t86 image\n\t\t\t\t87 container\n\t\t\t\t\t88 image\n\t\t\t\t\t89 text 机巢已连接\n\t\t\t\t\t90 image\n\t\t\t\t\t91 text 点位范围内\n\t\t\t\t\t92 heading 三皇寨 · 经典航线, Value: 3\n\t\t\t\t\t\t93 text 三皇寨 · 经典航线\n\t\t\t\t\t94 text 无人机: 空闲 · 电量 95%\n\t\t\t\t\t95 button 确认并召唤无人机\n\t\t\t\t\t96 text 每次拍摄成功后扣减 1 次,未成功不扣次数。\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "13-准备页状态菜单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_1e_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_1f_\n\t\t\t3 text 体验本页状态\n\t\t4 text 只切换当前页面。正常操作会自动推进,无需额外控制。\n\t\t5 container\n\t\t\t6 button 设备空闲\n\t\t\t\t7 text 设备空闲\n\t\t\t\t8 image\n\t\t\t9 button 无人机占用中\n\t\t\t\t10 text 无人机占用中\n\t\t\t\t11 image\n\t\t\t12 button 机巢未连接\n\t\t\t\t13 text 机巢未连接\n\t\t\t\t14 image\n\t\t\t15 button 无人机无信号\n\t\t\t\t16 text 无人机无信号\n\t\t\t\t17 image\n\t\t\t18 button 电量不足\n\t\t\t\t19 text 电量不足\n\t\t\t\t20 image\n\t\t\t21 button 设备状态未知\n\t\t\t\t22 text 设备状态未知\n\t\t\t\t23 image\n\t\t\t24 button 不在拍摄范围\n\t\t\t\t25 text 不在拍摄范围\n\t\t\t\t26 image\n\t\t\t27 button 暂无可用航线\n\t\t\t\t28 text 暂无可用航线\n\t\t\t\t29 image\n\t\t\t30 button 拍摄次数用完\n\t\t\t\t31 text 拍摄次数用完\n\t\t\t\t32 image\n\t\t\t33 text 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。\n\t\t\t34 button 恢复正常体验\n\t\t\t35 button 从头体验整个流程\n\nThe focused UI element is 6 button 设备空闲" + }, + { + "name": "14-准备页占用阻断", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:26\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t11 text 拍摄准备\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 含 1 次拍摄\n\t\t\t\t\t21 container\n\t\t\t\t\t\t22 text 已拍摄 0 次\n\t\t\t\t\t23 container\n\t\t\t\t\t\t24 text 剩余 1 次\n\t\t\t\t\t25 heading 拍摄点, Value: 2\n\t\t\t\t\t\t26 text 拍摄点\n\t\t\t\t\t27 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t28 checkbox 三皇寨 范围内 未拍摄, Value: 1\n\t\t\t\t\t\t\t29 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t30 text 三皇寨\n\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t32 text 范围内\n\t\t\t\t\t\t\t33 text 未拍摄\n\t\t\t\t\t\t34 checkbox 金阙云宫 800 m 未拍摄, Value: 0\n\t\t\t\t\t\t\t35 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t36 text 金阙云宫\n\t\t\t\t\t\t\t37 image\n\t\t\t\t\t\t\t38 text 800 m\n\t\t\t\t\t\t\t39 text 未拍摄\n\t\t\t\t\t\t40 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t41 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t42 text 少室山\n\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 text 1.2 km\n\t\t\t\t\t\t\t45 text 未拍摄\n\t\t\t\t\t\t46 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t47 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t48 text 迎客峰\n\t\t\t\t\t\t\t49 image\n\t\t\t\t\t\t\t50 text 1.8 km\n\t\t\t\t\t\t\t51 text 未拍摄\n\t\t\t\t\t52 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t53 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t54 三皇寨的航线\n\t\t\t\t\t\t55 radio button 经典航线, Value: 1\n\t\t\t\t\t\t\t56 image\n\t\t\t\t\t\t\t57 text 经典航线\n\t\t\t\t\t\t\t58 image\n\t\t\t\t\t\t59 radio button 环绕专线, Value: 0\n\t\t\t\t\t\t\t60 image\n\t\t\t\t\t\t\t61 text 环绕专线\n\t\t\t\t\t\t\t62 image\n\t\t\t\t\t\t63 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t64 image\n\t\t\t\t\t\t\t65 text 远景拉升\n\t\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t69 text 全景环绕\n\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t71 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t73 text 高空俯瞰\n\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t75 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t77 text 山峰渐远\n\t\t\t\t\t\t\t78 image\n\t\t\t\t\t\t79 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 峡谷穿行\n\t\t\t\t\t\t\t82 image\n\t\t\t\t\t\t83 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t84 image\n\t\t\t\t\t\t\t85 text 山脊侧拍\n\t\t\t\t\t\t\t86 image\n\t\t\t\t87 container\n\t\t\t\t\t88 image\n\t\t\t\t\t89 text 机巢已连接\n\t\t\t\t\t90 image\n\t\t\t\t\t91 text 点位范围内\n\t\t\t\t\t92 heading 三皇寨 · 经典航线, Value: 3\n\t\t\t\t\t\t93 text 三皇寨 · 经典航线\n\t\t\t\t\t94 text 无人机: 占用中 · 电量 95%\n\t\t\t\t\t95 button (disabled) 确认并召唤无人机\n\t\t\t\t\t96 text 无人机占用中,请稍后再试\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "15-恢复体验后的页面", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:26\n\t\t\t98 container\n\t\t\t\t99 container\n\t\t\t\t\t100 button 景区空镜库\n\t\t\t\t\t101 heading 机巢工作台, Value: 1\n\t\t\t\t\t\t102 text 机巢工作台\n\t\t\t\t\t103 button 收款码\n\t\t\t\t\t\t104 image\n\t\t\t\t\t\t105 text 收款码\n\t\t\t\t106 text 交互原型 · 无真实操作\n\t\t\t\t107 button 体验本页其他状态\n\t\t\t\t\t108 image\n\t\t\t\t\t109 text 体验其他状态\n\t\t\t\t110 container\n\t\t\t\t\t111 text 嵩山少林景区 · 吴家俊\n\t\t\t\t\t112 container 无人机设备状态\n\t\t\t\t\t\t113 container 左右滑动查看无人机\n\t\t\t\t\t\t\t114 container 01号无人机\n\t\t\t\t\t\t\t\t115 container 01号无人机的六项状态\n\t\t\t\t\t\t\t\t\t116 heading 01号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t117 text 01号无人机\n\t\t\t\t\t\t\t\t\t118 text 空闲\n\t\t\t\t\t\t\t\t\t119 level indicator Description: 电池电量, Value: 95\n\t\t\t\t\t\t\t\t\t120 image\n\t\t\t\t\t\t\t\t\t121 text 信号状态\n\t\t\t\t\t\t\t\t\t122 text 良好\n\t\t\t\t\t\t\t\t\t123 image\n\t\t\t\t\t\t\t\t\t124 text 搜星状态\n\t\t\t\t\t\t\t\t\t125 container\n\t\t\t\t\t\t\t\t\t\t126 text 36 颗\n\t\t\t\t\t\t\t\t\t127 container\n\t\t\t\t\t\t\t\t\t\t128 text 19.3 °C\n\t\t\t\t\t\t\t\t\t129 image\n\t\t\t\t\t\t\t\t\t130 text 环境温度\n\t\t\t\t\t\t\t\t\t131 container\n\t\t\t\t\t\t\t\t\t\t132 text 0 m/s\n\t\t\t\t\t\t\t\t\t133 image\n\t\t\t\t\t\t\t\t\t134 text 风速\n\t\t\t\t\t\t\t\t\t135 text 无雨\n\t\t\t\t\t\t\t\t\t136 image\n\t\t\t\t\t\t\t\t\t137 text 雨量\n\t\t\t\t\t\t\t138 container 02号无人机\n\t\t\t\t\t\t\t\t139 container 02号无人机的六项状态\n\t\t\t\t\t\t\t\t\t140 heading 02号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t141 text 02号无人机\n\t\t\t\t\t\t\t\t\t142 text 占用中\n\t\t\t\t\t\t\t\t\t143 level indicator Description: 电池电量, Value: 72\n\t\t\t\t\t\t\t\t\t144 image\n\t\t\t\t\t\t\t\t\t145 text 信号状态\n\t\t\t\t\t\t\t\t\t146 text 良好\n\t\t\t\t\t\t\t\t\t147 image\n\t\t\t\t\t\t\t\t\t148 text 搜星状态\n\t\t\t\t\t\t\t\t\t149 container\n\t\t\t\t\t\t\t\t\t\t150 text 32 颗\n\t\t\t\t\t\t\t\t\t151 container\n\t\t\t\t\t\t\t\t\t\t152 text 20.1 °C\n\t\t\t\t\t\t\t\t\t153 image\n\t\t\t\t\t\t\t\t\t154 text 环境温度\n\t\t\t\t\t\t\t\t\t155 container\n\t\t\t\t\t\t\t\t\t\t156 text 1.2 m/s\n\t\t\t\t\t\t\t\t\t157 image\n\t\t\t\t\t\t\t\t\t158 text 风速\n\t\t\t\t\t\t\t\t\t159 text 无雨\n\t\t\t\t\t\t\t\t\t160 image\n\t\t\t\t\t\t\t\t\t161 text 雨量\n\t\t\t\t\t\t\t162 container 03号无人机\n\t\t\t\t\t\t\t\t163 container 03号无人机的六项状态\n\t\t\t\t\t\t\t\t\t164 heading 03号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t165 text 03号无人机\n\t\t\t\t\t\t\t\t\t166 text 未连接\n\t\t\t\t\t\t\t\t\t167 container 电池电量未知\n\t\t\t\t\t\t\t\t\t168 image\n\t\t\t\t\t\t\t\t\t169 text 信号状态\n\t\t\t\t\t\t\t\t\t170 text —\n\t\t\t\t\t\t\t\t\t171 image\n\t\t\t\t\t\t\t\t\t172 text 搜星状态\n\t\t\t\t\t\t\t\t\t173 text —\n\t\t\t\t\t\t\t\t\t174 text —\n\t\t\t\t\t\t\t\t\t175 image\n\t\t\t\t\t\t\t\t\t176 text 环境温度\n\t\t\t\t\t\t\t\t\t177 text —\n\t\t\t\t\t\t\t\t\t178 image\n\t\t\t\t\t\t\t\t\t179 text 风速\n\t\t\t\t\t\t\t\t\t180 text —\n\t\t\t\t\t\t\t\t\t181 image\n\t\t\t\t\t\t\t\t\t182 text 雨量\n\t\t\t\t\t\t\t183 container 04号无人机\n\t\t\t\t\t\t\t\t184 container 04号无人机的六项状态\n\t\t\t\t\t\t\t\t\t185 heading 04号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t186 text 04号无人机\n\t\t\t\t\t\t\t\t\t187 text 低电量\n\t\t\t\t\t\t\t\t\t188 level indicator Description: 电池电量, Value: 18\n\t\t\t\t\t\t\t\t\t189 image\n\t\t\t\t\t\t\t\t\t190 text 信号状态\n\t\t\t\t\t\t\t\t\t191 text 良好\n\t\t\t\t\t\t\t\t\t192 image\n\t\t\t\t\t\t\t\t\t193 text 搜星状态\n\t\t\t\t\t\t\t\t\t194 container\n\t\t\t\t\t\t\t\t\t\t195 text 34 颗\n\t\t\t\t\t\t\t\t\t196 container\n\t\t\t\t\t\t\t\t\t\t197 text 19.8 °C\n\t\t\t\t\t\t\t\t\t198 image\n\t\t\t\t\t\t\t\t\t199 text 环境温度\n\t\t\t\t\t\t\t\t\t200 container\n\t\t\t\t\t\t\t\t\t\t201 text 0.6 m/s\n\t\t\t\t\t\t\t\t\t202 image\n\t\t\t\t\t\t\t\t\t203 text 风速\n\t\t\t\t\t\t\t\t\t204 text 无雨\n\t\t\t\t\t\t\t\t\t205 image\n\t\t\t\t\t\t\t\t\t206 text 雨量\n\t\t\t\t\t\t\t207 container 05号无人机\n\t\t\t\t\t\t\t\t208 container 05号无人机的六项状态\n\t\t\t\t\t\t\t\t\t209 heading 05号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t210 text 05号无人机\n\t\t\t\t\t\t\t\t\t211 text 空闲\n\t\t\t\t\t\t\t\t\t212 level indicator Description: 电池电量, Value: 88\n\t\t\t\t\t\t\t\t\t213 image\n\t\t\t\t\t\t\t\t\t214 text 信号状态\n\t\t\t\t\t\t\t\t\t215 text 良好\n\t\t\t\t\t\t\t\t\t216 image\n\t\t\t\t\t\t\t\t\t217 text 搜星状态\n\t\t\t\t\t\t\t\t\t218 container\n\t\t\t\t\t\t\t\t\t\t219 text 35 颗\n\t\t\t\t\t\t\t\t\t220 container\n\t\t\t\t\t\t\t\t\t\t221 text 20.3 °C\n\t\t\t\t\t\t\t\t\t222 image\n\t\t\t\t\t\t\t\t\t223 text 环境温度\n\t\t\t\t\t\t\t\t\t224 container\n\t\t\t\t\t\t\t\t\t\t225 text 0.8 m/s\n\t\t\t\t\t\t\t\t\t226 image\n\t\t\t\t\t\t\t\t\t227 text 风速\n\t\t\t\t\t\t\t\t\t228 text 无雨\n\t\t\t\t\t\t\t\t\t229 image\n\t\t\t\t\t\t\t\t\t230 text 雨量\n\t\t\t\t\t\t\t231 container 06号无人机\n\t\t\t\t\t\t\t\t232 container 06号无人机的六项状态\n\t\t\t\t\t\t\t\t\t233 heading 06号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t234 text 06号无人机\n\t\t\t\t\t\t\t\t\t235 text 无信号\n\t\t\t\t\t\t\t\t\t236 container 电池电量未知\n\t\t\t\t\t\t\t\t\t237 image\n\t\t\t\t\t\t\t\t\t238 text 信号状态\n\t\t\t\t\t\t\t\t\t239 text 无信号\n\t\t\t\t\t\t\t\t\t240 image\n\t\t\t\t\t\t\t\t\t241 text 搜星状态\n\t\t\t\t\t\t\t\t\t242 text —\n\t\t\t\t\t\t\t\t\t243 text —\n\t\t\t\t\t\t\t\t\t244 image\n\t\t\t\t\t\t\t\t\t245 text 环境温度\n\t\t\t\t\t\t\t\t\t246 text —\n\t\t\t\t\t\t\t\t\t247 image\n\t\t\t\t\t\t\t\t\t248 text 风速\n\t\t\t\t\t\t\t\t\t249 text —\n\t\t\t\t\t\t\t\t\t250 image\n\t\t\t\t\t\t\t\t\t251 text 雨量\n\t\t\t\t\t\t252 container 当前无人机\n\t\t\t\t\t\t\t253 button 查看01号无人机\n\t\t\t\t\t\t\t254 button 查看02号无人机\n\t\t\t\t\t\t\t255 button 查看03号无人机\n\t\t\t\t\t\t\t256 button 查看04号无人机\n\t\t\t\t\t\t\t257 button 查看05号无人机\n\t\t\t\t\t\t\t258 button 查看06号无人机\n\t\t\t\t\t259 heading 我的拍摄订单 8, Value: 2\n\t\t\t\t\t\t260 text 我的拍摄订单 8\n\t\t\t\t\t261 button 查看全部\n\t\t\t\t\t\t262 text 查看全部\n\t\t\t\t\t\t263 image\n\t\t\t\t\t264 container\n\t\t\t\t\t\t265 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t266 text 游客 158****8888\n\t\t\t\t\t\t267 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 · 剩余 2 次\n\t\t\t\t\t\t268 button 继续拍摄\n\t\t\t\t\t\t269 image\n\t\t\t\t\t\t270 text 素材 上传中\n\t\t\t\t\t\t271 button 查看素材\n\t\t\t\t\t\t\t272 text 查看素材\n\t\t\t\t\t\t\t273 image\n\t\t\t\t\t274 container\n\t\t\t\t\t\t275 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t276 text 游客 136****2806\n\t\t\t\t\t\t277 text 待拍摄 单次航拍 · 含 1 次拍摄 已拍摄 0 / 1 次 · 剩余 1 次\n\t\t\t\t\t\t278 button 开始拍摄\n\t\t\t\t\t279 container\n\t\t\t\t\t\t280 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t281 text 游客 139****5192\n\t\t\t\t\t\t282 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 · 剩余 3 次\n\t\t\t\t\t\t283 button 继续拍摄\n\t\t\t\t\t\t284 image\n\t\t\t\t\t\t285 text 素材 上传失败\n\t\t\t\t\t\t286 button 查看素材\n\t\t\t\t\t\t\t287 text 查看素材\n\t\t\t\t\t\t\t288 image\n\t\t\t\t\t289 heading 今日数据, Value: 2\n\t\t\t\t\t\t290 text 今日数据\n\t\t\t\t\t291 text 12\n\t\t\t\t\t292 text 成交订单\n\t\t\t\t\t293 text ¥1,896\n\t\t\t\t\t294 text 成交金额\n\t\t\t\t\t295 text 9\n\t\t\t\t\t296 text 完成拍摄\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "16-恢复正常准备", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:26\n\t\t\t98 container\n\t\t\t\t99 container\n\t\t\t\t\t100 button 返回\n\t\t\t\t\t\t110 image\n\t\t\t\t\t101 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t102 text 拍摄准备\n\t\t\t\t106 text 交互原型 · 无真实操作\n\t\t\t\t107 button 体验本页其他状态\n\t\t\t\t\t108 image\n\t\t\t\t\t109 text 体验其他状态\n\t\t\t\t111 container\n\t\t\t\t\t112 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t113 text 游客 136****2806\n\t\t\t\t\t114 container\n\t\t\t\t\t\t115 text 含 1 次拍摄\n\t\t\t\t\t116 container\n\t\t\t\t\t\t117 text 已拍摄 0 次\n\t\t\t\t\t118 container\n\t\t\t\t\t\t119 text 剩余 1 次\n\t\t\t\t\t120 heading 拍摄点, Value: 2\n\t\t\t\t\t\t121 text 拍摄点\n\t\t\t\t\t122 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t123 checkbox 三皇寨 范围内 未拍摄, Value: 1\n\t\t\t\t\t\t\t124 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t125 text 三皇寨\n\t\t\t\t\t\t\t126 image\n\t\t\t\t\t\t\t127 text 范围内\n\t\t\t\t\t\t\t128 text 未拍摄\n\t\t\t\t\t\t129 checkbox 金阙云宫 800 m 未拍摄, Value: 0\n\t\t\t\t\t\t\t130 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t131 text 金阙云宫\n\t\t\t\t\t\t\t132 image\n\t\t\t\t\t\t\t133 text 800 m\n\t\t\t\t\t\t\t134 text 未拍摄\n\t\t\t\t\t\t135 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t136 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t137 text 少室山\n\t\t\t\t\t\t\t138 image\n\t\t\t\t\t\t\t139 text 1.2 km\n\t\t\t\t\t\t\t140 text 未拍摄\n\t\t\t\t\t\t141 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t142 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t143 text 迎客峰\n\t\t\t\t\t\t\t144 image\n\t\t\t\t\t\t\t145 text 1.8 km\n\t\t\t\t\t\t\t146 text 未拍摄\n\t\t\t\t\t147 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t148 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t149 三皇寨的航线\n\t\t\t\t\t\t150 radio button 经典航线, Value: 1\n\t\t\t\t\t\t\t151 image\n\t\t\t\t\t\t\t152 text 经典航线\n\t\t\t\t\t\t\t153 image\n\t\t\t\t\t\t154 radio button 环绕专线, Value: 0\n\t\t\t\t\t\t\t155 image\n\t\t\t\t\t\t\t156 text 环绕专线\n\t\t\t\t\t\t\t157 image\n\t\t\t\t\t\t158 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t159 image\n\t\t\t\t\t\t\t160 text 远景拉升\n\t\t\t\t\t\t\t161 image\n\t\t\t\t\t\t162 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t163 image\n\t\t\t\t\t\t\t164 text 全景环绕\n\t\t\t\t\t\t\t165 image\n\t\t\t\t\t\t166 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t167 image\n\t\t\t\t\t\t\t168 text 高空俯瞰\n\t\t\t\t\t\t\t169 image\n\t\t\t\t\t\t170 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t171 image\n\t\t\t\t\t\t\t172 text 山峰渐远\n\t\t\t\t\t\t\t173 image\n\t\t\t\t\t\t174 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t175 image\n\t\t\t\t\t\t\t176 text 峡谷穿行\n\t\t\t\t\t\t\t177 image\n\t\t\t\t\t\t178 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t179 image\n\t\t\t\t\t\t\t180 text 山脊侧拍\n\t\t\t\t\t\t\t181 image\n\t\t\t\t182 container\n\t\t\t\t\t183 image\n\t\t\t\t\t184 text 机巢已连接\n\t\t\t\t\t185 image\n\t\t\t\t\t186 text 点位范围内\n\t\t\t\t\t187 heading 三皇寨 · 经典航线, Value: 3\n\t\t\t\t\t\t188 text 三皇寨 · 经典航线\n\t\t\t\t\t189 text 无人机: 空闲 · 电量 95%\n\t\t\t\t\t190 button 确认并召唤无人机\n\t\t\t\t\t191 text 每次拍摄成功后扣减 1 次,未成功不扣次数。\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "17-召唤当前任务", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:26\n\t\t\t98 container\n\t\t\t\t99 container\n\t\t\t\t\t100 button 返回\n\t\t\t\t\t\t101 image\n\t\t\t\t\t102 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t103 text 拍摄任务\n\t\t\t\t104 text 交互原型 · 无真实操作\n\t\t\t\t105 button 体验本页其他状态\n\t\t\t\t\t106 image\n\t\t\t\t\t107 text 体验其他状态\n\t\t\t\t108 container\n\t\t\t\t\t109 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t110 text 三皇寨 · 经典航线\n\t\t\t\t\t111 container\n\t\t\t\t\t\t112 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t113 container 无人机直播画面\n\t\t\t\t\t\t114 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t115 image\n\t\t\t\t\t\t116 text 实时图传\n\t\t\t\t\t\t117 button 放大直播画面\n\t\t\t\t\t\t\t118 image\n\t\t\t\t\t119 container 无人机六项状态\n\t\t\t\t\t\t120 text 电池电量\n\t\t\t\t\t\t121 container\n\t\t\t\t\t\t\t122 image\n\t\t\t\t\t\t\t123 text 95%\n\t\t\t\t\t\t124 text 环境温度\n\t\t\t\t\t\t125 container\n\t\t\t\t\t\t\t126 image\n\t\t\t\t\t\t\t127 text 20.3°C\n\t\t\t\t\t\t128 text 风速\n\t\t\t\t\t\t129 container\n\t\t\t\t\t\t\t130 image\n\t\t\t\t\t\t\t131 text 0m/s\n\t\t\t\t\t\t132 text 雨量\n\t\t\t\t\t\t133 container\n\t\t\t\t\t\t\t134 image\n\t\t\t\t\t\t\t135 text 无雨\n\t\t\t\t\t\t136 text 信号状态\n\t\t\t\t\t\t137 container\n\t\t\t\t\t\t\t138 image\n\t\t\t\t\t\t\t139 text 良好\n\t\t\t\t\t\t140 text 搜星状态\n\t\t\t\t\t\t141 container\n\t\t\t\t\t\t\t142 image\n\t\t\t\t\t\t\t143 text 36颗\n\t\t\t\t\t144 container\n\t\t\t\t\t\t145 image\n\t\t\t\t\t\t146 heading 无人机已到达, Value: 2\n\t\t\t\t\t\t\t147 text 无人机已到达\n\t\t\t\t\t\t148 heading 是否开始拍摄?, Value: 3\n\t\t\t\t\t\t\t149 text 是否开始拍摄?\n\t\t\t\t\t\t150 text 确认游客站位与取景后开始\n\t\t\t\t\t151 button 开始拍摄\n\t\t\t\t\t\t152 image\n\t\t\t\t\t\t153 text 开始拍摄\n\t\t\t\t\t154 text 安全控制\n\t\t\t\t\t155 button 紧急暂停 悬停待命\n\t\t\t\t\t\t156 image\n\t\t\t\t\t\t157 text 紧急暂停\n\t\t\t\t\t\t158 text 悬停待命\n\t\t\t\t\t159 button 立即返航 中断任务\n\t\t\t\t\t\t160 image\n\t\t\t\t\t\t161 text 立即返航\n\t\t\t\t\t\t162 text 中断任务\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "18-任务全部状态菜单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_2e_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_2f_\n\t\t\t3 text 体验本页状态\n\t\t4 text 只切换当前页面。正常操作会自动推进,无需额外控制。\n\t\t5 container\n\t\t\t6 button 已到达\n\t\t\t\t7 text 已到达\n\t\t\t\t8 image\n\t\t\t9 button 拍摄中\n\t\t\t\t10 text 拍摄中\n\t\t\t\t11 image\n\t\t\t12 button 悬停\n\t\t\t\t13 text 悬停\n\t\t\t\t14 image\n\t\t\t15 button 返航中\n\t\t\t\t16 text 返航中\n\t\t\t\t17 image\n\t\t\t18 button 拍摄完成\n\t\t\t\t19 text 拍摄完成\n\t\t\t\t20 image\n\t\t\t21 button 失败·返航中\n\t\t\t\t22 text 失败·返航中\n\t\t\t\t23 image\n\t\t\t24 button 失败·可重试\n\t\t\t\t25 text 失败·可重试\n\t\t\t\t26 image\n\t\t\t27 button 画面断流\n\t\t\t\t28 text 画面断流\n\t\t\t\t29 image\n\t\t\t30 button 手机断网\n\t\t\t\t31 text 手机断网\n\t\t\t\t32 image\n\t\t\t33 button 保护性返航\n\t\t\t\t34 text 保护性返航\n\t\t\t\t35 image\n\t\t\t36 button 拍摄完成弹窗\n\t\t\t\t37 text 拍摄完成弹窗\n\t\t\t\t38 image\n\t\t\t39 button 执行失败弹窗\n\t\t\t\t40 text 执行失败弹窗\n\t\t\t\t41 image\n\t\t\t42 button 体验指令超时\n\t\t\t\t43 text 体验指令超时\n\t\t\t\t44 image\n\t\t\t45 text 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。\n\t\t\t46 button 恢复正常体验\n\t\t\t47 button 从头体验整个流程\n\nThe focused UI element is 6 button 已到达" + }, + { + "name": "19-拍摄中", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:27\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t54 heading 无人机正在拍摄中, Value: 2\n\t\t\t\t\t\t\t55 text 无人机正在拍摄中\n\t\t\t\t\t\t56 text 请关注现场及实时画面。\n请勿关闭本页或息屏。\n\t\t\t\t\t57 button (disabled) 拍摄中\n\t\t\t\t\t\t58 image\n\t\t\t\t\t\t59 text 拍摄中\n\t\t\t\t\t60 text 安全控制\n\t\t\t\t\t61 button 紧急暂停 悬停待命\n\t\t\t\t\t\t62 image\n\t\t\t\t\t\t63 text 紧急暂停\n\t\t\t\t\t\t64 text 悬停待命\n\t\t\t\t\t65 button 立即返航 中断任务\n\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 text 立即返航\n\t\t\t\t\t\t68 text 中断任务\n\t\t\t69 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "20-紧急暂停", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:27\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t54 heading 无人机正在拍摄中, Value: 2\n\t\t\t\t\t\t\t55 text 无人机正在拍摄中\n\t\t\t\t\t\t56 text 请关注现场及实时画面。\n请勿关闭本页或息屏。\n\t\t\t\t\t57 button (disabled) 拍摄中\n\t\t\t\t\t\t58 image\n\t\t\t\t\t\t59 text 拍摄中\n\t\t\t\t\t60 text 安全控制\n\t\t\t\t\t61 button (disabled) 正在暂停 尚未确认悬停\n\t\t\t\t\t\t70 image\n\t\t\t\t\t\t63 text 正在暂停\n\t\t\t\t\t\t64 text 尚未确认悬停\n\t\t\t\t\t65 button 立即返航 中断任务\n\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 text 立即返航\n\t\t\t\t\t\t68 text 中断任务\n\t\t\t69 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "21-暂停生效", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:27\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t70 image\n\t\t\t\t\t\t54 heading 无人机已暂停, Value: 2\n\t\t\t\t\t\t\t55 text 无人机已暂停\n\t\t\t\t\t\t56 text 当前悬停待命。\n确认安全后,可继续任务或立即返航。\n\t\t\t\t\t57 button 继续任务\n\t\t\t\t\t\t71 image\n\t\t\t\t\t\t59 text 继续任务\n\t\t\t\t\t60 text 安全控制\n\t\t\t\t\t61 button (disabled) 已暂停 悬停待命\n\t\t\t\t\t\t72 image\n\t\t\t\t\t\t63 text 已暂停\n\t\t\t\t\t\t64 text 悬停待命\n\t\t\t\t\t65 button 立即返航 中断任务\n\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 text 立即返航\n\t\t\t\t\t\t68 text 中断任务\n\t\t\t69 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "22-立即返航直接提交", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:27\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t70 image\n\t\t\t\t\t\t54 heading 无人机已暂停, Value: 2\n\t\t\t\t\t\t\t55 text 无人机已暂停\n\t\t\t\t\t\t56 text 当前悬停待命。\n确认安全后,可继续任务或立即返航。\n\t\t\t\t\t57 button (disabled) 继续任务\n\t\t\t\t\t\t71 image\n\t\t\t\t\t\t59 text 继续任务\n\t\t\t\t\t60 text 安全控制\n\t\t\t\t\t61 button (disabled) 已暂停 悬停待命\n\t\t\t\t\t\t72 image\n\t\t\t\t\t\t63 text 已暂停\n\t\t\t\t\t\t64 text 悬停待命\n\t\t\t\t\t65 button (disabled) 正在发送返航指令 尚未确认返航\n\t\t\t\t\t\t73 image\n\t\t\t\t\t\t67 text 正在发送返航指令\n\t\t\t\t\t\t68 text 尚未确认返航\n\t\t\t69 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "23-返航后结果", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:27\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t73 image\n\t\t\t\t\t\t24 text 上次任务画面\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t74 image\n\t\t\t\t\t\t54 heading 本次拍摄已中断, Value: 2\n\t\t\t\t\t\t\t55 text 本次拍摄已中断\n\t\t\t\t\t\t56 text 无人机已返回机巢,本次未扣减拍摄次数。\n可重新选择点位和航线开始任务。\n\t\t\t\t\t57 button 重新召唤无人机\n\t\t\t\t\t\t75 image\n\t\t\t\t\t\t59 text 重新召唤无人机\n\t\t\t\t\t60 text 安全控制\n\t\t\t\t\t61 button (disabled) 紧急暂停 当前未执行任务\n\t\t\t\t\t\t72 image\n\t\t\t\t\t\t63 text 紧急暂停\n\t\t\t\t\t\t64 text 当前未执行任务\n\t\t\t\t\t65 button (disabled) 立即返航 当前未执行任务\n\t\t\t\t\t\t76 image\n\t\t\t\t\t\t67 text 立即返航\n\t\t\t\t\t\t68 text 当前未执行任务\n\t\t\t69 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "24-再次打开任务状态菜单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_2e_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_2f_\n\t\t\t3 text 体验本页状态\n\t\t4 text 只切换当前页面。正常操作会自动推进,无需额外控制。\n\t\t5 container\n\t\t\t6 button 已到达\n\t\t\t\t7 text 已到达\n\t\t\t\t8 image\n\t\t\t9 button 拍摄中\n\t\t\t\t10 text 拍摄中\n\t\t\t\t11 image\n\t\t\t12 button 悬停\n\t\t\t\t13 text 悬停\n\t\t\t\t14 image\n\t\t\t15 button 返航中\n\t\t\t\t16 text 返航中\n\t\t\t\t17 image\n\t\t\t18 button 拍摄完成\n\t\t\t\t19 text 拍摄完成\n\t\t\t\t20 image\n\t\t\t21 button 失败·返航中\n\t\t\t\t22 text 失败·返航中\n\t\t\t\t23 image\n\t\t\t24 button 失败·可重试\n\t\t\t\t25 text 失败·可重试\n\t\t\t\t26 image\n\t\t\t27 button 画面断流\n\t\t\t\t28 text 画面断流\n\t\t\t\t29 image\n\t\t\t30 button 手机断网\n\t\t\t\t31 text 手机断网\n\t\t\t\t32 image\n\t\t\t33 button 保护性返航\n\t\t\t\t34 text 保护性返航\n\t\t\t\t35 image\n\t\t\t36 button 拍摄完成弹窗\n\t\t\t\t37 text 拍摄完成弹窗\n\t\t\t\t38 image\n\t\t\t39 button 执行失败弹窗\n\t\t\t\t40 text 执行失败弹窗\n\t\t\t\t41 image\n\t\t\t42 button 体验指令超时\n\t\t\t\t43 text 体验指令超时\n\t\t\t\t44 image\n\t\t\t45 text 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。\n\t\t\t46 button 恢复正常体验\n\t\t\t47 button 从头体验整个流程\n\nThe focused UI element is 6 button 已到达" + }, + { + "name": "25-指令超时体验", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_2e_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_2f_\n\t\t\t3 text 体验本页状态\n\t\t4 text 只切换当前页面。正常操作会自动推进,无需额外控制。\n\t\t5 container\n\t\t\t6 button 已到达\n\t\t\t\t7 text 已到达\n\t\t\t\t8 image\n\t\t\t9 button 拍摄中\n\t\t\t\t10 text 拍摄中\n\t\t\t\t11 image\n\t\t\t12 button 悬停\n\t\t\t\t13 text 悬停\n\t\t\t\t14 image\n\t\t\t15 button 返航中\n\t\t\t\t16 text 返航中\n\t\t\t\t17 image\n\t\t\t18 button 拍摄完成\n\t\t\t\t19 text 拍摄完成\n\t\t\t\t20 image\n\t\t\t21 button 失败·返航中\n\t\t\t\t22 text 失败·返航中\n\t\t\t\t23 image\n\t\t\t24 button 失败·可重试\n\t\t\t\t25 text 失败·可重试\n\t\t\t\t26 image\n\t\t\t27 button 画面断流\n\t\t\t\t28 text 画面断流\n\t\t\t\t29 image\n\t\t\t30 button 手机断网\n\t\t\t\t31 text 手机断网\n\t\t\t\t32 image\n\t\t\t33 button 保护性返航\n\t\t\t\t34 text 保护性返航\n\t\t\t\t35 image\n\t\t\t36 button 拍摄完成弹窗\n\t\t\t\t37 text 拍摄完成弹窗\n\t\t\t\t38 image\n\t\t\t39 button 执行失败弹窗\n\t\t\t\t40 text 执行失败弹窗\n\t\t\t\t41 image\n\t\t\t42 button 体验指令超时\n\t\t\t\t43 text 体验指令超时\n\t\t\t\t44 image\n\t\t\t45 text 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。\n\t\t\t46 button 恢复正常体验\n\t\t\t47 button 从头体验整个流程\n\nThe focused UI element is 42 button 体验指令超时" + }, + { + "name": "26-指令超时状态", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:28\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t54 heading 无人机已到达, Value: 2\n\t\t\t\t\t\t\t55 text 无人机已到达\n\t\t\t\t\t\t56 heading 是否开始拍摄?, Value: 3\n\t\t\t\t\t\t\t57 text 是否开始拍摄?\n\t\t\t\t\t\t58 text 确认游客站位与取景后开始\n\t\t\t\t\t59 button 开始拍摄\n\t\t\t\t\t\t60 image\n\t\t\t\t\t\t61 text 开始拍摄\n\t\t\t\t\t62 text 安全控制\n\t\t\t\t\t63 button 紧急暂停 悬停待命\n\t\t\t\t\t\t64 image\n\t\t\t\t\t\t65 text 紧急暂停\n\t\t\t\t\t\t66 text 悬停待命\n\t\t\t\t\t67 button 立即返航 中断任务\n\t\t\t\t\t\t68 image\n\t\t\t\t\t\t69 text 立即返航\n\t\t\t\t\t\t70 text 中断任务\n\t\t\t71 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "27-开始指令提交", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:28\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t54 heading 无人机已到达, Value: 2\n\t\t\t\t\t\t\t55 text 无人机已到达\n\t\t\t\t\t\t56 heading 是否开始拍摄?, Value: 3\n\t\t\t\t\t\t\t57 text 是否开始拍摄?\n\t\t\t\t\t\t58 text 确认游客站位与取景后开始\n\t\t\t\t\t59 button (disabled) 正在启动拍摄\n\t\t\t\t\t\t72 image\n\t\t\t\t\t\t61 text 正在启动拍摄\n\t\t\t\t\t73 text 等待设备确认,不可重复启动。\n\t\t\t\t\t62 text 安全控制\n\t\t\t\t\t63 button 紧急暂停 悬停待命\n\t\t\t\t\t\t64 image\n\t\t\t\t\t\t65 text 紧急暂停\n\t\t\t\t\t\t66 text 悬停待命\n\t\t\t\t\t67 button 立即返航 中断任务\n\t\t\t\t\t\t68 image\n\t\t\t\t\t\t69 text 立即返航\n\t\t\t\t\t\t70 text 中断任务\n\t\t\t71 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "28-超时待确认", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:28\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t22 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t23 image\n\t\t\t\t\t\t24 text 实时图传\n\t\t\t\t\t\t25 button 放大直播画面\n\t\t\t\t\t\t\t26 image\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t28 text 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text 95%\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text 20.3°C\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text 0m/s\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text 无雨\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 良好\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 36颗\n\t\t\t\t\t52 container\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t54 heading 无人机已到达, Value: 2\n\t\t\t\t\t\t\t55 text 无人机已到达\n\t\t\t\t\t\t56 heading 是否开始拍摄?, Value: 3\n\t\t\t\t\t\t\t57 text 是否开始拍摄?\n\t\t\t\t\t\t58 text 确认游客站位与取景后开始\n\t\t\t\t\t72 container\n\t\t\t\t\t\t73 image\n\t\t\t\t\t\t74 text 执行结果待确认\n\t\t\t\t\t75 container\n\t\t\t\t\t\t76 text 暂未确认是否已开始拍摄。 请刷新任务状态,勿重复发送指令。\n\t\t\t\t\t77 button 刷新任务状态\n\t\t\t\t\t\t78 image\n\t\t\t\t\t\t79 text 刷新任务状态\n\t\t\t\t\t59 button (disabled) 执行结果待确认\n\t\t\t\t\t\t80 image\n\t\t\t\t\t\t61 text 执行结果待确认\n\t\t\t\t\t62 text 安全控制\n\t\t\t\t\t63 button 紧急暂停 悬停待命\n\t\t\t\t\t\t64 image\n\t\t\t\t\t\t65 text 紧急暂停\n\t\t\t\t\t\t66 text 悬停待命\n\t\t\t\t\t67 button 立即返航 中断任务\n\t\t\t\t\t\t68 image\n\t\t\t\t\t\t69 text 立即返航\n\t\t\t\t\t\t70 text 中断任务\n\t\t\t71 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "29-刷新原任务", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:28\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t11 text 拍摄任务\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t18 text 三皇寨 · 经典航线\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t21 container 无人机直播画面\n\t\t\t\t\t\t81 image\n\t\t\t\t\t\t82 heading 正在同步当前任务, Value: 3\n\t\t\t\t\t\t\t83 text 正在同步当前任务\n\t\t\t\t\t\t84 text 请检查网络后重新连接\n\t\t\t\t\t\t85 button (disabled) 同步中…\n\t\t\t\t\t27 container 无人机六项状态\n\t\t\t\t\t\t86 image\n\t\t\t\t\t\t87 text 状态暂未更新 电池电量\n\t\t\t\t\t\t29 container\n\t\t\t\t\t\t\t30 image\n\t\t\t\t\t\t\t31 text —\n\t\t\t\t\t\t32 text 环境温度\n\t\t\t\t\t\t33 container\n\t\t\t\t\t\t\t34 image\n\t\t\t\t\t\t\t35 text —\n\t\t\t\t\t\t36 text 风速\n\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t38 image\n\t\t\t\t\t\t\t39 text —\n\t\t\t\t\t\t40 text 雨量\n\t\t\t\t\t\t41 container\n\t\t\t\t\t\t\t42 image\n\t\t\t\t\t\t\t43 text —\n\t\t\t\t\t\t44 text 信号状态\n\t\t\t\t\t\t45 container\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text —\n\t\t\t\t\t\t48 text 搜星状态\n\t\t\t\t\t\t49 container\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text —\n\t\t\t\t\t52 container\n\t\t\t\t\t\t88 image\n\t\t\t\t\t\t54 heading 正在同步任务状态, Value: 2\n\t\t\t\t\t\t\t55 text 正在同步任务状态\n\t\t\t\t\t\t58 text 连接中断不代表任务失败。\n恢复连接后将同步当前任务。\n\t\t\t\t\t59 button (disabled) 同步任务状态中\n\t\t\t\t\t\t80 image\n\t\t\t\t\t\t61 text 同步任务状态中\n\t\t\t\t\t62 text 安全控制\n\t\t\t\t\t63 button (disabled) 紧急暂停 当前无法发送指令\n\t\t\t\t\t\t64 image\n\t\t\t\t\t\t65 text 紧急暂停\n\t\t\t\t\t\t66 text 当前无法发送指令\n\t\t\t\t\t67 button (disabled) 立即返航 当前无法发送指令\n\t\t\t\t\t\t68 image\n\t\t\t\t\t\t69 text 立即返航\n\t\t\t\t\t\t70 text 当前无法发送指令\n\t\t\t71 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "30-刷新后拍摄结果", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 拍摄已完成\n\t\t2 image\n\t\t3 heading 拍摄已完成, Value: 2, ID: task-dialog-title\n\t\t\t4 text 拍摄已完成\n\t\t5 text 本次拍摄已完成,\n请及时查看并下载素材。\n\t\t6 button 稍后再去\n\t\t7 button 去查看\n\nThe focused UI element is 7 button 去查看" + }, + { + "name": "31-本次订单素材", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:28\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单素材库, Value: 1\n\t\t\t\t\t\t11 text 订单素材库\n\t\t\t\t\t12 button 刷新素材状态\n\t\t\t\t\t\t13 image\n\t\t\t\t\t\t14 text 刷新\n\t\t\t\t15 text 交互原型 · 无真实操作\n\t\t\t\t16 button 体验本页其他状态\n\t\t\t\t\t17 image\n\t\t\t\t\t18 text 体验其他状态\n\t\t\t\t19 container\n\t\t\t\t\t20 container 订单信息\n\t\t\t\t\t\t21 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t22 text 游客 136****2806\n\t\t\t\t\t\t23 text 已完成\n\t\t\t\t\t\t24 text HT202610200002\n\t\t\t\t\t\t25 container\n\t\t\t\t\t\t\t26 text 含 1 次拍摄 · 已拍摄 1 次 · 剩余 0 次\n\t\t\t\t\t27 image\n\t\t\t\t\t28 text 三皇寨 仅显示当前打卡点素材 1 次拍摄 · 最新在前\n\t\t\t\t\t29 checkbox (disabled) 全选可下载, Value: 0\n\t\t\t\t\t\t30 image\n\t\t\t\t\t\t31 text 全选可下载\n\t\t\t\t\t32 container 拍摄记录\n\t\t\t\t\t\t33 container 拍摄记录01\n\t\t\t\t\t\t\t34 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t35 text 三皇寨\n\t\t\t\t\t\t\t36 button 三皇寨交付成片,记录01\n\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t38 text 经典航线 · 10-26 14:28 · 记录 01\n\t\t\t\t\t\t\t39 image\n\t\t\t\t\t\t\t40 text 等待素材上传,文件列表确认后显示\n\t\t\t\t41 container\n\t\t\t\t\t42 text 已选择 0 项 仅可选择已上传素材\n\t\t\t\t\t43 button (disabled) 下载所选素材\n\t\t\t\t\t\t44 image\n\t\t\t\t\t\t45 text 下载所选素材\n\t\t\t46 image\n\t\t\t47 text 仅显示三皇寨的素材\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "32-订单素材状态菜单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_2q_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_2r_\n\t\t\t3 text 体验本页状态\n\t\t4 text 只切换当前页面。正常操作会自动推进,无需额外控制。\n\t\t5 container\n\t\t\t6 button 素材上传中\n\t\t\t\t7 text 素材上传中\n\t\t\t\t8 image\n\t\t\t9 button 素材上传完成\n\t\t\t\t10 text 素材上传完成\n\t\t\t\t11 image\n\t\t\t12 button 素材上传失败\n\t\t\t\t13 text 素材上传失败\n\t\t\t\t14 image\n\t\t\t15 button 未选择素材\n\t\t\t\t16 text 未选择素材\n\t\t\t\t17 image\n\t\t\t18 button 已选择素材\n\t\t\t\t19 text 已选择素材\n\t\t\t\t20 image\n\t\t\t21 button 下载中\n\t\t\t\t22 text 下载中\n\t\t\t\t23 image\n\t\t\t24 button 下载完成\n\t\t\t\t25 text 下载完成\n\t\t\t\t26 image\n\t\t\t27 button 下载失败\n\t\t\t\t28 text 下载失败\n\t\t\t\t29 image\n\t\t\t30 button 重试中\n\t\t\t\t31 text 重试中\n\t\t\t\t32 image\n\t\t\t33 button 离开确认\n\t\t\t\t34 text 离开确认\n\t\t\t\t35 image\n\t\t\t36 button 相册权限不足\n\t\t\t\t37 text 相册权限不足\n\t\t\t\t38 image\n\t\t\t39 text 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。\n\t\t\t40 button 恢复正常体验\n\t\t\t41 button 从头体验整个流程\n\nThe focused UI element is 6 button 素材上传中" + }, + { + "name": "33-素材就绪", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:29\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单素材库, Value: 1\n\t\t\t\t\t\t11 text 订单素材库\n\t\t\t\t\t12 button 刷新素材状态\n\t\t\t\t\t\t13 image\n\t\t\t\t\t\t14 text 刷新\n\t\t\t\t15 text 交互原型 · 无真实操作\n\t\t\t\t16 button 体验本页其他状态\n\t\t\t\t\t17 image\n\t\t\t\t\t18 text 体验其他状态\n\t\t\t\t19 container\n\t\t\t\t\t20 container 订单信息\n\t\t\t\t\t\t21 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t22 text 游客 136****2806\n\t\t\t\t\t\t23 text 已完成\n\t\t\t\t\t\t24 text HT202610200002\n\t\t\t\t\t\t25 container\n\t\t\t\t\t\t\t26 text 含 1 次拍摄 · 已拍摄 1 次 · 剩余 0 次\n\t\t\t\t\t27 image\n\t\t\t\t\t28 text 三皇寨 仅显示当前打卡点素材 1 次拍摄 · 最新在前\n\t\t\t\t\t29 checkbox 全选可下载, Value: 0\n\t\t\t\t\t\t30 image\n\t\t\t\t\t\t31 text 全选可下载\n\t\t\t\t\t32 container 拍摄记录\n\t\t\t\t\t\t33 container 拍摄记录01\n\t\t\t\t\t\t\t34 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t35 text 三皇寨\n\t\t\t\t\t\t\t36 button 三皇寨交付成片,记录01\n\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t38 text 经典航线 · 10-26 14:28 · 记录 01\n\t\t\t\t\t\t\t39 container\n\t\t\t\t\t\t\t\t40 image 三皇寨拍摄素材01-demo\n\t\t\t\t\t\t\t\t41 button 预览本次素材01\n\t\t\t\t\t\t\t\t42 checkbox Description: 选择本次素材01, Value: 0\n\t\t\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 heading 本次素材01, Value: 4\n\t\t\t\t\t\t\t\t45 text 本次素材01\n\t\t\t\t\t\t\t46 text 上传完成 · 可下载\n\t\t\t\t47 container\n\t\t\t\t\t48 text 已选择 0 项 仅可选择已上传素材\n\t\t\t\t\t49 button (disabled) 下载所选素材\n\t\t\t\t\t\t50 image\n\t\t\t\t\t\t51 text 下载所选素材\n\t\t\t52 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "34-选择订单素材", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:29\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单素材库, Value: 1\n\t\t\t\t\t\t11 text 订单素材库\n\t\t\t\t\t12 button 刷新素材状态\n\t\t\t\t\t\t13 image\n\t\t\t\t\t\t14 text 刷新\n\t\t\t\t15 text 交互原型 · 无真实操作\n\t\t\t\t16 button 体验本页其他状态\n\t\t\t\t\t17 image\n\t\t\t\t\t18 text 体验其他状态\n\t\t\t\t19 container\n\t\t\t\t\t20 container 订单信息\n\t\t\t\t\t\t21 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t22 text 游客 136****2806\n\t\t\t\t\t\t23 text 已完成\n\t\t\t\t\t\t24 text HT202610200002\n\t\t\t\t\t\t25 container\n\t\t\t\t\t\t\t26 text 含 1 次拍摄 · 已拍摄 1 次 · 剩余 0 次\n\t\t\t\t\t27 image\n\t\t\t\t\t28 text 三皇寨 仅显示当前打卡点素材 1 次拍摄 · 最新在前\n\t\t\t\t\t29 checkbox 全选可下载, Value: 1\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t31 text 全选可下载\n\t\t\t\t\t32 container 拍摄记录\n\t\t\t\t\t\t33 container 拍摄记录01\n\t\t\t\t\t\t\t34 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t35 text 三皇寨\n\t\t\t\t\t\t\t36 button 三皇寨交付成片,记录01\n\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t38 text 经典航线 · 10-26 14:28 · 记录 01\n\t\t\t\t\t\t\t39 container\n\t\t\t\t\t\t\t\t40 image 三皇寨拍摄素材01-demo\n\t\t\t\t\t\t\t\t41 button 预览本次素材01\n\t\t\t\t\t\t\t\t42 checkbox Description: 选择本次素材01, Value: 1\n\t\t\t\t\t\t\t\t\t54 image\n\t\t\t\t\t\t\t44 heading 本次素材01, Value: 4\n\t\t\t\t\t\t\t\t45 text 本次素材01\n\t\t\t\t\t\t\t46 text 上传完成 · 可下载\n\t\t\t\t47 container\n\t\t\t\t\t48 text 已选择 1 项 仅可选择已上传素材\n\t\t\t\t\t49 button 下载所选素材\n\t\t\t\t\t\t50 image\n\t\t\t\t\t\t51 text 下载所选素材\n\t\t\t52 image\n\nThe focused UI element is 42 checkbox Description: 选择本次素材01, Value: 1" + }, + { + "name": "35-订单素材下载", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:29\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单素材库, Value: 1\n\t\t\t\t\t\t11 text 订单素材库\n\t\t\t\t\t12 button 刷新素材状态\n\t\t\t\t\t\t13 image\n\t\t\t\t\t\t14 text 刷新\n\t\t\t\t15 text 交互原型 · 无真实操作\n\t\t\t\t16 button 体验本页其他状态\n\t\t\t\t\t17 image\n\t\t\t\t\t18 text 体验其他状态\n\t\t\t\t19 container\n\t\t\t\t\t20 container 订单信息\n\t\t\t\t\t\t21 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t22 text 游客 136****2806\n\t\t\t\t\t\t23 text 已完成\n\t\t\t\t\t\t24 text HT202610200002\n\t\t\t\t\t\t25 container\n\t\t\t\t\t\t\t26 text 含 1 次拍摄 · 已拍摄 1 次 · 剩余 0 次\n\t\t\t\t\t27 image\n\t\t\t\t\t28 text 三皇寨 仅显示当前打卡点素材 1 次拍摄 · 最新在前\n\t\t\t\t\t29 checkbox (disabled) 全选可下载, Value: 1\n\t\t\t\t\t\t53 image\n\t\t\t\t\t\t31 text 全选可下载\n\t\t\t\t\t32 container 拍摄记录\n\t\t\t\t\t\t33 container 拍摄记录01\n\t\t\t\t\t\t\t34 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t35 text 三皇寨\n\t\t\t\t\t\t\t36 button 三皇寨交付成片,记录01\n\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t38 text 经典航线 · 10-26 14:28 · 记录 01\n\t\t\t\t\t\t\t39 container\n\t\t\t\t\t\t\t\t40 image 三皇寨拍摄素材01-demo\n\t\t\t\t\t\t\t\t41 button 预览本次素材01\n\t\t\t\t\t\t\t\t42 checkbox (disabled) Description: 选择本次素材01, Value: 1\n\t\t\t\t\t\t\t\t\t54 image\n\t\t\t\t\t\t\t44 heading 本次素材01, Value: 4\n\t\t\t\t\t\t\t\t45 text 本次素材01\n\t\t\t\t\t\t\t55 image\n\t\t\t\t\t\t\t56 text 下载中\n\t\t\t\t47 container\n\t\t\t\t\t57 text 本次下载 1 项 已完成 0 / 1 项\n\t\t\t\t\t58 progress indicator Description: 本次下载完成项数, Value: 0\n\t\t\t\t\t59 text 请保持本页开启,下载期间不可更改选择\n\t\t\t\t\t49 button (disabled) 下载中…\n\t\t\t\t\t\t60 image\n\t\t\t\t\t\t51 text 下载中…\n\t\t\t52 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "36-订单素材下载完成", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:29\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单素材库, Value: 1\n\t\t\t\t\t\t11 text 订单素材库\n\t\t\t\t\t12 button 刷新素材状态\n\t\t\t\t\t\t13 image\n\t\t\t\t\t\t14 text 刷新\n\t\t\t\t15 text 交互原型 · 无真实操作\n\t\t\t\t16 button 体验本页其他状态\n\t\t\t\t\t17 image\n\t\t\t\t\t18 text 体验其他状态\n\t\t\t\t19 container\n\t\t\t\t\t20 container 订单信息\n\t\t\t\t\t\t21 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t22 text 游客 136****2806\n\t\t\t\t\t\t23 text 已完成\n\t\t\t\t\t\t24 text HT202610200002\n\t\t\t\t\t\t25 container\n\t\t\t\t\t\t\t26 text 含 1 次拍摄 · 已拍摄 1 次 · 剩余 0 次\n\t\t\t\t\t27 image\n\t\t\t\t\t28 text 三皇寨 仅显示当前打卡点素材 1 次拍摄 · 最新在前\n\t\t\t\t\t29 checkbox (disabled) 全选可下载, Value: 0\n\t\t\t\t\t\t57 image\n\t\t\t\t\t\t31 text 全选可下载\n\t\t\t\t\t32 container 拍摄记录\n\t\t\t\t\t\t33 container 拍摄记录01\n\t\t\t\t\t\t\t34 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t35 text 三皇寨\n\t\t\t\t\t\t\t36 button 三皇寨交付成片,记录01\n\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t38 text 经典航线 · 10-26 14:28 · 记录 01\n\t\t\t\t\t\t\t39 container\n\t\t\t\t\t\t\t\t40 image 三皇寨拍摄素材01-demo\n\t\t\t\t\t\t\t\t41 button 预览本次素材01\n\t\t\t\t\t\t\t\t58 container 本次素材01已下载\n\t\t\t\t\t\t\t\t\t59 image\n\t\t\t\t\t\t\t44 heading 本次素材01, Value: 4\n\t\t\t\t\t\t\t\t45 text 本次素材01\n\t\t\t\t\t\t\t60 image\n\t\t\t\t\t\t\t56 text 已下载\n\t\t\t\t47 container\n\t\t\t\t\t61 image\n\t\t\t\t\t62 heading 本次素材下载完成, Value: 3\n\t\t\t\t\t\t63 text 本次素材下载完成\n\t\t\t\t\t64 text 1 项素材已保存到手机相册\n\t\t\t\t\t49 button 继续选择素材\n\t\t\t\t\t65 button 交付成片\n\t\t\t52 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "37-交付方式", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 交付成片, ID: radix-_r_2t_\n\t\t2 heading 交付成片, Value: 2, ID: radix-_r_2u_\n\t\t\t3 text 交付成片\n\t\t4 container\n\t\t\t5 button 关闭成片交付\n\t\t\t\t6 image\n\t\t\t7 text 游客 136****2806 请选择本次交付方式\n\t\t\t8 button 面对面闪传 近距离传给游客 · 流程待确认\n\t\t\t\t9 image\n\t\t\t\t10 text 面对面闪传\n\t\t\t\t11 text 近距离传给游客 · 流程待确认\n\t\t\t\t12 image\n\t\t\t13 button 云端上传 选择打卡点,上传后游客可查看\n\t\t\t\t14 image\n\t\t\t\t15 text 云端上传\n\t\t\t\t16 text 选择打卡点,上传后游客可查看\n\t\t\t\t17 image\n\t\t\t18 text 可分批交付多个作品,不影响拍摄次数\n\nThe focused UI element is 5 button 关闭成片交付" + }, + { + "name": "38-点位交付预选", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 选择打卡点, ID: radix-_r_2t_\n\t\t2 heading 选择打卡点, Value: 2, ID: radix-_r_2u_\n\t\t\t3 text 选择打卡点\n\t\t4 container\n\t\t\t5 button 关闭成片交付\n\t\t\t\t6 image\n\t\t\t7 text 游客 136****2806 云端上传 · 请选择本批成片对应的打卡点\n\t\t\t8 checkbox 三皇寨, Value: 1\n\t\t\t\t9 text 三皇寨\n\t\t\t\t10 image\n\t\t\t11 checkbox 金阙云宫, Value: 0\n\t\t\t\t12 text 金阙云宫\n\t\t\t\t13 image\n\t\t\t14 checkbox 少室山, Value: 0\n\t\t\t\t15 text 少室山\n\t\t\t\t16 image\n\t\t\t17 checkbox 迎客峰, Value: 0\n\t\t\t\t18 text 迎客峰\n\t\t\t\t19 image\n\t\t\t20 button 去相册选视频\n\t\t\t21 text 可选择一个或多个视频,上传成功即交付\n\t\t\t22 button 返回交付方式\n\nThe focused UI element is 1 container 选择打卡点, ID: radix-_r_2t_" + }, + { + "name": "39-演示视频选择", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 选择视频, ID: radix-_r_2t_\n\t\t2 heading 选择视频, Value: 2, ID: radix-_r_2u_\n\t\t\t3 text 选择视频\n\t\t4 container\n\t\t\t5 button 关闭成片交付\n\t\t\t\t6 image\n\t\t\t7 text 游客 136****2806 · 三皇寨 演示相册 · 不读取手机文件\n\t\t\t8 checkbox Description: 选择演示视频1, Value: 0\n\t\t\t\t9 container\n\t\t\t\t\t10 image 演示视频1\n\t\t\t\t\t11 image\n\t\t\t\t\t12 image\n\t\t\t\t\t13 text 00: 32\n\t\t\t\t14 container\n\t\t\t\t\t15 text 成片视频 01\n\t\t\t16 checkbox Description: 选择演示视频2, Value: 0\n\t\t\t\t17 container\n\t\t\t\t\t18 image 演示视频2\n\t\t\t\t\t19 image\n\t\t\t\t\t20 image\n\t\t\t\t\t21 text 00: 48\n\t\t\t\t22 container\n\t\t\t\t\t23 text 成片视频 02\n\t\t\t24 checkbox Description: 选择演示视频3, Value: 0\n\t\t\t\t25 container\n\t\t\t\t\t26 image 演示视频3\n\t\t\t\t\t27 image\n\t\t\t\t\t28 image\n\t\t\t\t\t29 text 00: 32\n\t\t\t\t30 container\n\t\t\t\t\t31 text 成片视频 03\n\t\t\t32 checkbox Description: 选择演示视频4, Value: 0\n\t\t\t\t33 container\n\t\t\t\t\t34 image 演示视频4\n\t\t\t\t\t35 image\n\t\t\t\t\t36 image\n\t\t\t\t\t37 text 00: 48\n\t\t\t\t38 container\n\t\t\t\t\t39 text 成片视频 04\n\t\t\t40 button (disabled) 上传所选视频\n\t\t\t41 text 选择后自动体验上传 → 交付完成\n\t\t\t42 button (collapsed) 体验上传异常, Secondary Actions: Expand\n\t\t\t\t43 text 体验上传异常\n\nThe focused UI element is 1 container 选择视频, ID: radix-_r_2t_" + }, + { + "name": "40-选择两段成片", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 选择视频, ID: radix-_r_2t_\n\t\t2 heading 选择视频, Value: 2, ID: radix-_r_2u_\n\t\t\t3 text 选择视频\n\t\t4 container\n\t\t\t5 button 关闭成片交付\n\t\t\t\t6 image\n\t\t\t7 text 游客 136****2806 · 三皇寨 演示相册 · 不读取手机文件\n\t\t\t8 checkbox Description: 选择演示视频1, Value: 1\n\t\t\t\t9 container\n\t\t\t\t\t10 image 演示视频1\n\t\t\t\t\t44 image\n\t\t\t\t\t12 image\n\t\t\t\t\t13 text 00: 32\n\t\t\t\t14 container\n\t\t\t\t\t15 text 成片视频 01\n\t\t\t16 checkbox Description: 选择演示视频2, Value: 1\n\t\t\t\t17 container\n\t\t\t\t\t18 image 演示视频2\n\t\t\t\t\t45 image\n\t\t\t\t\t20 image\n\t\t\t\t\t21 text 00: 48\n\t\t\t\t22 container\n\t\t\t\t\t23 text 成片视频 02\n\t\t\t24 checkbox Description: 选择演示视频3, Value: 0\n\t\t\t\t25 container\n\t\t\t\t\t26 image 演示视频3\n\t\t\t\t\t27 image\n\t\t\t\t\t28 image\n\t\t\t\t\t29 text 00: 32\n\t\t\t\t30 container\n\t\t\t\t\t31 text 成片视频 03\n\t\t\t32 checkbox Description: 选择演示视频4, Value: 0\n\t\t\t\t33 container\n\t\t\t\t\t34 image 演示视频4\n\t\t\t\t\t35 image\n\t\t\t\t\t36 image\n\t\t\t\t\t37 text 00: 48\n\t\t\t\t38 container\n\t\t\t\t\t39 text 成片视频 04\n\t\t\t40 button 上传所选视频(2)\n\t\t\t\t46 text 上传所选视频\n\t\t\t\t47 text (2)\n\t\t\t41 text 选择后自动体验上传 → 交付完成\n\t\t\t42 button (collapsed) 体验上传异常, Secondary Actions: Expand\n\t\t\t\t43 text 体验上传异常\n\nThe focused UI element is 16 checkbox Description: 选择演示视频2, Value: 1" + }, + { + "name": "41-成片上传队列", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 成片上传, ID: radix-_r_2t_\n\t\t2 heading 成片上传, Value: 2, ID: radix-_r_2u_\n\t\t\t3 text 成片上传\n\t\t4 container\n\t\t\t5 button 关闭成片交付\n\t\t\t\t6 image\n\t\t\t7 text 游客 136****2806 · 三皇寨 本次已交付 0 个作品 2 个上传中\n\t\t\t48 image\n\t\t\t49 text 三皇寨_成片01.mp4 00:32 · 48.6 MB\n\t\t\t50 image\n\t\t\t51 text 上传中\n\t\t\t52 image\n\t\t\t53 text 三皇寨_成片02.mp4 00:48 · 72.4 MB\n\t\t\t54 image\n\t\t\t55 text 上传中\n\t\t\t40 button (disabled) 正在上传…\n\t\t\t\t56 image\n\t\t\t\t47 text 正在上传…\n\t\t\t41 text 请保持页面开启,上传成功即交付\n\t\t\t57 button 体验上传失败\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "42-成片上传完成", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 成片上传, ID: radix-_r_2t_\n\t\t2 heading 成片上传, Value: 2, ID: radix-_r_2u_\n\t\t\t3 text 成片上传\n\t\t4 container\n\t\t\t5 button 关闭成片交付\n\t\t\t\t6 image\n\t\t\t7 text 游客 136****2806 · 三皇寨 本次已交付 2 个作品 全部上传成功\n\t\t\t48 image\n\t\t\t49 text 三皇寨_成片01.mp4 00:32 · 48.6 MB\n\t\t\t56 image\n\t\t\t51 text 已交付\n\t\t\t52 image\n\t\t\t53 text 三皇寨_成片02.mp4 00:48 · 72.4 MB\n\t\t\t57 image\n\t\t\t55 text 已交付\n\t\t\t40 button 继续上传成片\n\t\t\t41 text 可分批上传,不扣减拍摄次数\n\t\t\t58 button 完成\n\nThe focused UI element is 1 container 成片上传, ID: radix-_r_2t_" + }, + { + "name": "43-交付后素材库", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单素材库, Value: 1\n\t\t\t\t\t\t11 text 订单素材库\n\t\t\t\t\t12 button 刷新素材状态\n\t\t\t\t\t\t13 image\n\t\t\t\t\t\t14 text 刷新\n\t\t\t\t15 text 交互原型 · 无真实操作\n\t\t\t\t16 button 体验本页其他状态\n\t\t\t\t\t17 image\n\t\t\t\t\t18 text 体验其他状态\n\t\t\t\t19 container\n\t\t\t\t\t20 container 订单信息\n\t\t\t\t\t\t21 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t22 text 游客 136****2806\n\t\t\t\t\t\t23 text 已完成\n\t\t\t\t\t\t24 text HT202610200002\n\t\t\t\t\t\t25 container\n\t\t\t\t\t\t\t26 text 含 1 次拍摄 · 已拍摄 1 次 · 剩余 0 次\n\t\t\t\t\t27 image\n\t\t\t\t\t28 text 三皇寨 仅显示当前打卡点素材 1 次拍摄 · 最新在前\n\t\t\t\t\t29 checkbox (disabled) 全选可下载, Value: 0\n\t\t\t\t\t\t30 image\n\t\t\t\t\t\t31 text 全选可下载\n\t\t\t\t\t32 container 拍摄记录\n\t\t\t\t\t\t33 container 拍摄记录01\n\t\t\t\t\t\t\t34 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t35 text 三皇寨\n\t\t\t\t\t\t\t36 button 三皇寨交付成片,记录01\n\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t38 text 经典航线 · 10-26 14:28 · 记录 01\n\t\t\t\t\t\t\t39 container\n\t\t\t\t\t\t\t\t40 image 三皇寨拍摄素材01-demo\n\t\t\t\t\t\t\t\t41 button 预览本次素材01\n\t\t\t\t\t\t\t\t42 container 本次素材01已下载\n\t\t\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 heading 本次素材01, Value: 4\n\t\t\t\t\t\t\t\t45 text 本次素材01\n\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t47 text 已下载\n\t\t\t\t48 container\n\t\t\t\t\t49 image\n\t\t\t\t\t50 heading 本次素材下载完成, Value: 3\n\t\t\t\t\t\t51 text 本次素材下载完成\n\t\t\t\t\t52 text 1 项素材已保存到手机相册\n\t\t\t\t\t53 button 继续选择素材\n\t\t\t\t\t54 button 交付成片\n\t\t\t55 image\n\t\t\t56 text 已成功交付 2 个作品\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "44-离开素材库", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t57 container\n\t\t\t\t\t58 button 返回\n\t\t\t\t\t\t59 image\n\t\t\t\t\t60 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t61 text 拍摄任务\n\t\t\t\t62 text 交互原型 · 无真实操作\n\t\t\t\t63 button 体验本页其他状态\n\t\t\t\t\t64 image\n\t\t\t\t\t65 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t68 text 三皇寨 · 经典航线\n\t\t\t\t\t69 container\n\t\t\t\t\t\t70 text 游客 136****2806 · 含 1 次拍摄\n\t\t\t\t\t71 container 无人机直播画面\n\t\t\t\t\t\t72 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t73 image\n\t\t\t\t\t\t74 text 上次任务画面\n\t\t\t\t\t\t75 button 放大直播画面\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t77 container 无人机六项状态\n\t\t\t\t\t\t78 text 电池电量\n\t\t\t\t\t\t79 container\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 95%\n\t\t\t\t\t\t82 text 环境温度\n\t\t\t\t\t\t83 container\n\t\t\t\t\t\t\t84 image\n\t\t\t\t\t\t\t85 text 20.3°C\n\t\t\t\t\t\t86 text 风速\n\t\t\t\t\t\t87 container\n\t\t\t\t\t\t\t88 image\n\t\t\t\t\t\t\t89 text 0m/s\n\t\t\t\t\t\t90 text 雨量\n\t\t\t\t\t\t91 container\n\t\t\t\t\t\t\t92 image\n\t\t\t\t\t\t\t93 text 无雨\n\t\t\t\t\t\t94 text 信号状态\n\t\t\t\t\t\t95 container\n\t\t\t\t\t\t\t96 image\n\t\t\t\t\t\t\t97 text 良好\n\t\t\t\t\t\t98 text 搜星状态\n\t\t\t\t\t\t99 container\n\t\t\t\t\t\t\t100 image\n\t\t\t\t\t\t\t101 text 36颗\n\t\t\t\t\t102 container\n\t\t\t\t\t\t103 image\n\t\t\t\t\t\t104 heading 拍摄已完成, Value: 2\n\t\t\t\t\t\t\t105 text 拍摄已完成\n\t\t\t\t\t\t106 text 本次拍摄已结束,可前往查看素材。\n无人机已返回机巢。\n\t\t\t\t\t107 button 查看素材\n\t\t\t\t\t\t108 image\n\t\t\t\t\t\t109 text 查看素材\n\t\t\t\t\t110 text 安全控制\n\t\t\t\t\t111 button (disabled) 紧急暂停 当前未执行任务\n\t\t\t\t\t\t112 image\n\t\t\t\t\t\t113 text 紧急暂停\n\t\t\t\t\t\t114 text 当前未执行任务\n\t\t\t\t\t115 button (disabled) 立即返航 当前未执行任务\n\t\t\t\t\t\t116 image\n\t\t\t\t\t\t117 text 立即返航\n\t\t\t\t\t\t118 text 当前未执行任务\n\t\t\t55 image\n\t\t\t56 text 已成功交付 2 个作品\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "45-任务实际返回准备页", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t58 image\n\t\t\t\t\t59 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t60 text 拍摄准备\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t65 container\n\t\t\t\t\t66 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t67 text 游客 136****2806\n\t\t\t\t\t68 container\n\t\t\t\t\t\t69 text 含 1 次拍摄\n\t\t\t\t\t70 container\n\t\t\t\t\t\t71 text 已拍摄 1 次\n\t\t\t\t\t72 container\n\t\t\t\t\t\t73 text 剩余 0 次\n\t\t\t\t\t74 heading 拍摄点, Value: 2\n\t\t\t\t\t\t75 text 拍摄点\n\t\t\t\t\t76 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t77 checkbox 三皇寨 范围内 已拍 1 次, Value: 1\n\t\t\t\t\t\t\t78 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t79 text 三皇寨\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 范围内\n\t\t\t\t\t\t\t82 text 已拍 1 次\n\t\t\t\t\t\t83 checkbox 金阙云宫 800 m 未拍摄, Value: 0\n\t\t\t\t\t\t\t84 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t85 text 金阙云宫\n\t\t\t\t\t\t\t86 image\n\t\t\t\t\t\t\t87 text 800 m\n\t\t\t\t\t\t\t88 text 未拍摄\n\t\t\t\t\t\t89 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t90 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t91 text 少室山\n\t\t\t\t\t\t\t92 image\n\t\t\t\t\t\t\t93 text 1.2 km\n\t\t\t\t\t\t\t94 text 未拍摄\n\t\t\t\t\t\t95 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t96 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t97 text 迎客峰\n\t\t\t\t\t\t\t98 image\n\t\t\t\t\t\t\t99 text 1.8 km\n\t\t\t\t\t\t\t100 text 未拍摄\n\t\t\t\t\t101 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t102 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t103 三皇寨的航线\n\t\t\t\t\t\t104 radio button 经典航线, Value: 1\n\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t\t106 text 经典航线\n\t\t\t\t\t\t\t107 image\n\t\t\t\t\t\t108 radio button 环绕专线, Value: 0\n\t\t\t\t\t\t\t109 image\n\t\t\t\t\t\t\t110 text 环绕专线\n\t\t\t\t\t\t\t111 image\n\t\t\t\t\t\t112 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t113 image\n\t\t\t\t\t\t\t114 text 远景拉升\n\t\t\t\t\t\t\t115 image\n\t\t\t\t\t\t116 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t117 image\n\t\t\t\t\t\t\t118 text 全景环绕\n\t\t\t\t\t\t\t119 image\n\t\t\t\t\t\t120 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t121 image\n\t\t\t\t\t\t\t122 text 高空俯瞰\n\t\t\t\t\t\t\t123 image\n\t\t\t\t\t\t124 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t125 image\n\t\t\t\t\t\t\t126 text 山峰渐远\n\t\t\t\t\t\t\t127 image\n\t\t\t\t\t\t128 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t129 image\n\t\t\t\t\t\t\t130 text 峡谷穿行\n\t\t\t\t\t\t\t131 image\n\t\t\t\t\t\t132 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t133 image\n\t\t\t\t\t\t\t134 text 山脊侧拍\n\t\t\t\t\t\t\t135 image\n\t\t\t\t136 container\n\t\t\t\t\t137 image\n\t\t\t\t\t138 text 机巢已连接\n\t\t\t\t\t139 image\n\t\t\t\t\t140 text 点位范围内\n\t\t\t\t\t141 heading 三皇寨 · 经典航线, Value: 3\n\t\t\t\t\t\t142 text 三皇寨 · 经典航线\n\t\t\t\t\t143 text 无人机: 空闲 · 电量 95%\n\t\t\t\t\t144 button (disabled) 确认并召唤无人机\n\t\t\t\t\t145 text 当前订单拍摄次数已用完\n\t\t\t55 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "46-仍在准备页", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t58 image\n\t\t\t\t\t59 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t60 text 拍摄准备\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t65 container\n\t\t\t\t\t66 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t67 text 游客 136****2806\n\t\t\t\t\t68 container\n\t\t\t\t\t\t69 text 含 1 次拍摄\n\t\t\t\t\t70 container\n\t\t\t\t\t\t71 text 已拍摄 1 次\n\t\t\t\t\t72 container\n\t\t\t\t\t\t73 text 剩余 0 次\n\t\t\t\t\t74 heading 拍摄点, Value: 2\n\t\t\t\t\t\t75 text 拍摄点\n\t\t\t\t\t76 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t77 checkbox 三皇寨 范围内 已拍 1 次, Value: 1\n\t\t\t\t\t\t\t78 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t79 text 三皇寨\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 范围内\n\t\t\t\t\t\t\t82 text 已拍 1 次\n\t\t\t\t\t\t83 checkbox 金阙云宫 800 m 未拍摄, Value: 0\n\t\t\t\t\t\t\t84 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t85 text 金阙云宫\n\t\t\t\t\t\t\t86 image\n\t\t\t\t\t\t\t87 text 800 m\n\t\t\t\t\t\t\t88 text 未拍摄\n\t\t\t\t\t\t89 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t90 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t91 text 少室山\n\t\t\t\t\t\t\t92 image\n\t\t\t\t\t\t\t93 text 1.2 km\n\t\t\t\t\t\t\t94 text 未拍摄\n\t\t\t\t\t\t95 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t96 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t97 text 迎客峰\n\t\t\t\t\t\t\t98 image\n\t\t\t\t\t\t\t99 text 1.8 km\n\t\t\t\t\t\t\t100 text 未拍摄\n\t\t\t\t\t101 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t102 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t103 三皇寨的航线\n\t\t\t\t\t\t104 radio button 经典航线, Value: 0\n\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t\t106 text 经典航线\n\t\t\t\t\t\t\t146 image\n\t\t\t\t\t\t108 radio button 环绕专线, Value: 1\n\t\t\t\t\t\t\t109 image\n\t\t\t\t\t\t\t110 text 环绕专线\n\t\t\t\t\t\t\t147 image\n\t\t\t\t\t\t112 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t113 image\n\t\t\t\t\t\t\t114 text 远景拉升\n\t\t\t\t\t\t\t115 image\n\t\t\t\t\t\t116 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t117 image\n\t\t\t\t\t\t\t118 text 全景环绕\n\t\t\t\t\t\t\t119 image\n\t\t\t\t\t\t120 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t121 image\n\t\t\t\t\t\t\t122 text 高空俯瞰\n\t\t\t\t\t\t\t123 image\n\t\t\t\t\t\t124 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t125 image\n\t\t\t\t\t\t\t126 text 山峰渐远\n\t\t\t\t\t\t\t127 image\n\t\t\t\t\t\t128 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t129 image\n\t\t\t\t\t\t\t130 text 峡谷穿行\n\t\t\t\t\t\t\t131 image\n\t\t\t\t\t\t132 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t133 image\n\t\t\t\t\t\t\t134 text 山脊侧拍\n\t\t\t\t\t\t\t135 image\n\t\t\t\t136 container\n\t\t\t\t\t137 image\n\t\t\t\t\t138 text 机巢已连接\n\t\t\t\t\t139 image\n\t\t\t\t\t140 text 点位范围内\n\t\t\t\t\t141 heading 三皇寨 · 环绕专线, Value: 3\n\t\t\t\t\t\t142 text 三皇寨 · 环绕专线\n\t\t\t\t\t143 text 无人机: 空闲 · 电量 95%\n\t\t\t\t\t144 button (disabled) 确认并召唤无人机\n\t\t\t\t\t145 text 当前订单拍摄次数已用完\n\t\t\t55 image\n\nThe focused UI element is 108 radio button 环绕专线, Value: 1" + }, + { + "name": "47-准备返回首页", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 景区空镜库\n\t\t\t\t\t59 heading 机巢工作台, Value: 1\n\t\t\t\t\t\t60 text 机巢工作台\n\t\t\t\t\t65 button 收款码\n\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 text 收款码\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t68 container\n\t\t\t\t\t69 text 嵩山少林景区 · 吴家俊\n\t\t\t\t\t70 container 无人机设备状态\n\t\t\t\t\t\t71 container 左右滑动查看无人机\n\t\t\t\t\t\t\t72 container 01号无人机\n\t\t\t\t\t\t\t\t73 container 01号无人机的六项状态\n\t\t\t\t\t\t\t\t\t74 heading 01号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t75 text 01号无人机\n\t\t\t\t\t\t\t\t\t76 text 空闲\n\t\t\t\t\t\t\t\t\t77 level indicator Description: 电池电量, Value: 95\n\t\t\t\t\t\t\t\t\t78 image\n\t\t\t\t\t\t\t\t\t79 text 信号状态\n\t\t\t\t\t\t\t\t\t80 text 良好\n\t\t\t\t\t\t\t\t\t81 image\n\t\t\t\t\t\t\t\t\t82 text 搜星状态\n\t\t\t\t\t\t\t\t\t83 container\n\t\t\t\t\t\t\t\t\t\t84 text 36 颗\n\t\t\t\t\t\t\t\t\t85 container\n\t\t\t\t\t\t\t\t\t\t86 text 19.3 °C\n\t\t\t\t\t\t\t\t\t87 image\n\t\t\t\t\t\t\t\t\t88 text 环境温度\n\t\t\t\t\t\t\t\t\t89 container\n\t\t\t\t\t\t\t\t\t\t90 text 0 m/s\n\t\t\t\t\t\t\t\t\t91 image\n\t\t\t\t\t\t\t\t\t92 text 风速\n\t\t\t\t\t\t\t\t\t93 text 无雨\n\t\t\t\t\t\t\t\t\t94 image\n\t\t\t\t\t\t\t\t\t95 text 雨量\n\t\t\t\t\t\t\t96 container 02号无人机\n\t\t\t\t\t\t\t\t97 container 02号无人机的六项状态\n\t\t\t\t\t\t\t\t\t98 heading 02号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t99 text 02号无人机\n\t\t\t\t\t\t\t\t\t100 text 占用中\n\t\t\t\t\t\t\t\t\t101 level indicator Description: 电池电量, Value: 72\n\t\t\t\t\t\t\t\t\t102 image\n\t\t\t\t\t\t\t\t\t103 text 信号状态\n\t\t\t\t\t\t\t\t\t104 text 良好\n\t\t\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t\t\t\t106 text 搜星状态\n\t\t\t\t\t\t\t\t\t107 container\n\t\t\t\t\t\t\t\t\t\t108 text 32 颗\n\t\t\t\t\t\t\t\t\t109 container\n\t\t\t\t\t\t\t\t\t\t110 text 20.1 °C\n\t\t\t\t\t\t\t\t\t111 image\n\t\t\t\t\t\t\t\t\t112 text 环境温度\n\t\t\t\t\t\t\t\t\t113 container\n\t\t\t\t\t\t\t\t\t\t114 text 1.2 m/s\n\t\t\t\t\t\t\t\t\t115 image\n\t\t\t\t\t\t\t\t\t116 text 风速\n\t\t\t\t\t\t\t\t\t117 text 无雨\n\t\t\t\t\t\t\t\t\t118 image\n\t\t\t\t\t\t\t\t\t119 text 雨量\n\t\t\t\t\t\t\t120 container 03号无人机\n\t\t\t\t\t\t\t\t121 container 03号无人机的六项状态\n\t\t\t\t\t\t\t\t\t122 heading 03号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t123 text 03号无人机\n\t\t\t\t\t\t\t\t\t124 text 未连接\n\t\t\t\t\t\t\t\t\t125 container 电池电量未知\n\t\t\t\t\t\t\t\t\t126 image\n\t\t\t\t\t\t\t\t\t127 text 信号状态\n\t\t\t\t\t\t\t\t\t128 text —\n\t\t\t\t\t\t\t\t\t129 image\n\t\t\t\t\t\t\t\t\t130 text 搜星状态\n\t\t\t\t\t\t\t\t\t131 text —\n\t\t\t\t\t\t\t\t\t132 text —\n\t\t\t\t\t\t\t\t\t133 image\n\t\t\t\t\t\t\t\t\t134 text 环境温度\n\t\t\t\t\t\t\t\t\t135 text —\n\t\t\t\t\t\t\t\t\t136 image\n\t\t\t\t\t\t\t\t\t137 text 风速\n\t\t\t\t\t\t\t\t\t138 text —\n\t\t\t\t\t\t\t\t\t139 image\n\t\t\t\t\t\t\t\t\t140 text 雨量\n\t\t\t\t\t\t\t141 container 04号无人机\n\t\t\t\t\t\t\t\t142 container 04号无人机的六项状态\n\t\t\t\t\t\t\t\t\t143 heading 04号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t144 text 04号无人机\n\t\t\t\t\t\t\t\t\t145 text 低电量\n\t\t\t\t\t\t\t\t\t146 level indicator Description: 电池电量, Value: 18\n\t\t\t\t\t\t\t\t\t147 image\n\t\t\t\t\t\t\t\t\t148 text 信号状态\n\t\t\t\t\t\t\t\t\t149 text 良好\n\t\t\t\t\t\t\t\t\t150 image\n\t\t\t\t\t\t\t\t\t151 text 搜星状态\n\t\t\t\t\t\t\t\t\t152 container\n\t\t\t\t\t\t\t\t\t\t153 text 34 颗\n\t\t\t\t\t\t\t\t\t154 container\n\t\t\t\t\t\t\t\t\t\t155 text 19.8 °C\n\t\t\t\t\t\t\t\t\t156 image\n\t\t\t\t\t\t\t\t\t157 text 环境温度\n\t\t\t\t\t\t\t\t\t158 container\n\t\t\t\t\t\t\t\t\t\t159 text 0.6 m/s\n\t\t\t\t\t\t\t\t\t160 image\n\t\t\t\t\t\t\t\t\t161 text 风速\n\t\t\t\t\t\t\t\t\t162 text 无雨\n\t\t\t\t\t\t\t\t\t163 image\n\t\t\t\t\t\t\t\t\t164 text 雨量\n\t\t\t\t\t\t\t165 container 05号无人机\n\t\t\t\t\t\t\t\t166 container 05号无人机的六项状态\n\t\t\t\t\t\t\t\t\t167 heading 05号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t168 text 05号无人机\n\t\t\t\t\t\t\t\t\t169 text 空闲\n\t\t\t\t\t\t\t\t\t170 level indicator Description: 电池电量, Value: 88\n\t\t\t\t\t\t\t\t\t171 image\n\t\t\t\t\t\t\t\t\t172 text 信号状态\n\t\t\t\t\t\t\t\t\t173 text 良好\n\t\t\t\t\t\t\t\t\t174 image\n\t\t\t\t\t\t\t\t\t175 text 搜星状态\n\t\t\t\t\t\t\t\t\t176 container\n\t\t\t\t\t\t\t\t\t\t177 text 35 颗\n\t\t\t\t\t\t\t\t\t178 container\n\t\t\t\t\t\t\t\t\t\t179 text 20.3 °C\n\t\t\t\t\t\t\t\t\t180 image\n\t\t\t\t\t\t\t\t\t181 text 环境温度\n\t\t\t\t\t\t\t\t\t182 container\n\t\t\t\t\t\t\t\t\t\t183 text 0.8 m/s\n\t\t\t\t\t\t\t\t\t184 image\n\t\t\t\t\t\t\t\t\t185 text 风速\n\t\t\t\t\t\t\t\t\t186 text 无雨\n\t\t\t\t\t\t\t\t\t187 image\n\t\t\t\t\t\t\t\t\t188 text 雨量\n\t\t\t\t\t\t\t189 container 06号无人机\n\t\t\t\t\t\t\t\t190 container 06号无人机的六项状态\n\t\t\t\t\t\t\t\t\t191 heading 06号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t192 text 06号无人机\n\t\t\t\t\t\t\t\t\t193 text 无信号\n\t\t\t\t\t\t\t\t\t194 container 电池电量未知\n\t\t\t\t\t\t\t\t\t195 image\n\t\t\t\t\t\t\t\t\t196 text 信号状态\n\t\t\t\t\t\t\t\t\t197 text 无信号\n\t\t\t\t\t\t\t\t\t198 image\n\t\t\t\t\t\t\t\t\t199 text 搜星状态\n\t\t\t\t\t\t\t\t\t200 text —\n\t\t\t\t\t\t\t\t\t201 text —\n\t\t\t\t\t\t\t\t\t202 image\n\t\t\t\t\t\t\t\t\t203 text 环境温度\n\t\t\t\t\t\t\t\t\t204 text —\n\t\t\t\t\t\t\t\t\t205 image\n\t\t\t\t\t\t\t\t\t206 text 风速\n\t\t\t\t\t\t\t\t\t207 text —\n\t\t\t\t\t\t\t\t\t208 image\n\t\t\t\t\t\t\t\t\t209 text 雨量\n\t\t\t\t\t\t210 container 当前无人机\n\t\t\t\t\t\t\t211 button 查看01号无人机\n\t\t\t\t\t\t\t212 button 查看02号无人机\n\t\t\t\t\t\t\t213 button 查看03号无人机\n\t\t\t\t\t\t\t214 button 查看04号无人机\n\t\t\t\t\t\t\t215 button 查看05号无人机\n\t\t\t\t\t\t\t216 button 查看06号无人机\n\t\t\t\t\t217 heading 我的拍摄订单 7, Value: 2\n\t\t\t\t\t\t218 text 我的拍摄订单 7\n\t\t\t\t\t219 button 查看全部\n\t\t\t\t\t\t220 text 查看全部\n\t\t\t\t\t\t221 image\n\t\t\t\t\t222 container\n\t\t\t\t\t\t223 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t224 text 游客 158****8888\n\t\t\t\t\t\t225 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 · 剩余 2 次\n\t\t\t\t\t\t226 button 继续拍摄\n\t\t\t\t\t\t227 image\n\t\t\t\t\t\t228 text 素材 上传中\n\t\t\t\t\t\t229 button 查看素材\n\t\t\t\t\t\t\t230 text 查看素材\n\t\t\t\t\t\t\t231 image\n\t\t\t\t\t232 container\n\t\t\t\t\t\t233 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t234 text 游客 139****5192\n\t\t\t\t\t\t235 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 · 剩余 3 次\n\t\t\t\t\t\t236 button 继续拍摄\n\t\t\t\t\t\t237 image\n\t\t\t\t\t\t238 text 素材 上传失败\n\t\t\t\t\t\t239 button 查看素材\n\t\t\t\t\t\t\t240 text 查看素材\n\t\t\t\t\t\t\t241 image\n\t\t\t\t\t242 container\n\t\t\t\t\t\t243 heading 游客135****3092, Value: 2\n\t\t\t\t\t\t\t244 text 游客 135****3092\n\t\t\t\t\t\t245 text 待拍摄 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 · 剩余 5 次\n\t\t\t\t\t\t246 button 开始拍摄\n\t\t\t\t\t247 heading 今日数据, Value: 2\n\t\t\t\t\t\t248 text 今日数据\n\t\t\t\t\t249 text 12\n\t\t\t\t\t250 text 成交订单\n\t\t\t\t\t251 text ¥1,896\n\t\t\t\t\t252 text 成交金额\n\t\t\t\t\t253 text 9\n\t\t\t\t\t254 text 完成拍摄\n\t\t\t55 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "48-我的拍摄订单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 我的拍摄订单, Value: 1\n\t\t\t\t\t\t60 text 我的拍摄订单\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 text 分配给我的全部订单,含已完成订单\n\t\t\t\t\t68 container 订单状态\n\t\t\t\t\t\t69 checkbox 全部, Value: 1\n\t\t\t\t\t\t70 checkbox 待拍摄, Value: 0\n\t\t\t\t\t\t71 checkbox 进行中, Value: 0\n\t\t\t\t\t\t72 checkbox 已完成, Value: 0\n\t\t\t\t\t73 heading 全部订单 12, Value: 2\n\t\t\t\t\t\t74 text 全部订单 12\n\t\t\t\t\t75 container\n\t\t\t\t\t\t76 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t77 text 游客 158****8888\n\t\t\t\t\t\t78 text 进行中 HT202610200001 · 10-20 14:32 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 剩余 2 次\n\t\t\t\t\t\t79 progress indicator Description: 已拍摄 3 次,共 5 次, Value: 3\n\t\t\t\t\t\t80 button 查看素材 上传中\n\t\t\t\t\t\t\t81 text 查看素材\n\t\t\t\t\t\t\t82 image\n\t\t\t\t\t\t\t83 text 上传中\n\t\t\t\t\t\t84 button 交付成片\n\t\t\t\t\t\t85 button 继续拍摄\n\t\t\t\t\t86 container\n\t\t\t\t\t\t87 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t88 text 游客 136****2806\n\t\t\t\t\t\t89 text 拍摄完成 HT202610200002 · 10-20 14:18 单次航拍 · 含 1 次拍摄 已拍摄 1 / 1 次 剩余 0 次\n\t\t\t\t\t\t90 progress indicator Description: 已拍摄 1 次,共 1 次, Value: 1\n\t\t\t\t\t\t91 text 拍摄素材 上传完成\n\t\t\t\t\t\t92 button 请游客确认 已交付 2 个视频\n\t\t\t\t\t\t\t93 text 请游客确认\n\t\t\t\t\t\t\t94 image\n\t\t\t\t\t\t\t95 text 已交付 2 个视频\n\t\t\t\t\t\t96 button 查看素材\n\t\t\t\t\t\t97 button 交付成片\n\t\t\t\t\t98 container\n\t\t\t\t\t\t99 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t100 text 游客 139****5192\n\t\t\t\t\t\t101 text 进行中 HT202610200003 · 10-20 13:46 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 剩余 3 次\n\t\t\t\t\t\t102 progress indicator Description: 已拍摄 2 次,共 5 次, Value: 2\n\t\t\t\t\t\t103 button 查看素材 上传失败\n\t\t\t\t\t\t\t104 text 查看素材\n\t\t\t\t\t\t\t105 image\n\t\t\t\t\t\t\t106 text 上传失败\n\t\t\t\t\t\t107 button 交付成片\n\t\t\t\t\t\t108 button 继续拍摄\n\t\t\t\t\t109 container\n\t\t\t\t\t\t110 heading 游客137****6628, Value: 2\n\t\t\t\t\t\t\t111 text 游客 137****6628\n\t\t\t\t\t\t112 text 拍摄完成 HT202610190012 · 10-19 16:18 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t113 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t114 text 拍摄素材 上传完成\n\t\t\t\t\t\t115 button 查看素材\n\t\t\t\t\t\t116 button 交付成片\n\t\t\t\t\t117 container\n\t\t\t\t\t\t118 heading 游客135****3092, Value: 2\n\t\t\t\t\t\t\t119 text 游客 135****3092\n\t\t\t\t\t\t120 text 待拍摄 HT202610200005 · 10-20 12:15 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t121 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t122 button 交付成片\n\t\t\t\t\t\t123 button 开始拍摄\n\t\t\t\t\t124 container\n\t\t\t\t\t\t125 heading 游客159****7206, Value: 2\n\t\t\t\t\t\t\t126 text 游客 159****7206\n\t\t\t\t\t\t127 text 进行中 HT202610200006 · 10-20 11:15 航拍套餐 · 含 5 次拍摄 已拍摄 1 / 5 次 剩余 4 次\n\t\t\t\t\t\t128 progress indicator Description: 已拍摄 1 次,共 5 次, Value: 1\n\t\t\t\t\t\t129 button 查看素材 上传完成\n\t\t\t\t\t\t\t130 text 查看素材\n\t\t\t\t\t\t\t131 image\n\t\t\t\t\t\t\t132 text 上传完成\n\t\t\t\t\t\t133 button 交付成片\n\t\t\t\t\t\t134 button 继续拍摄\n\t\t\t\t\t135 container\n\t\t\t\t\t\t136 heading 游客138****0638, Value: 2\n\t\t\t\t\t\t\t137 text 游客 138****0638\n\t\t\t\t\t\t138 text 待拍摄 HT202610200007 · 10-20 10:15 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t139 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t140 button 交付成片\n\t\t\t\t\t\t141 button 开始拍摄\n\t\t\t\t\t142 container\n\t\t\t\t\t\t143 heading 游客186****9357, Value: 2\n\t\t\t\t\t\t\t144 text 游客 186****9357\n\t\t\t\t\t\t145 text 进行中 HT202610200008 · 10-20 9:15 航拍套餐 · 含 5 次拍摄 已拍摄 1 / 5 次 剩余 4 次\n\t\t\t\t\t\t146 progress indicator Description: 已拍摄 1 次,共 5 次, Value: 1\n\t\t\t\t\t\t147 button 查看素材 上传完成\n\t\t\t\t\t\t\t148 text 查看素材\n\t\t\t\t\t\t\t149 image\n\t\t\t\t\t\t\t150 text 上传完成\n\t\t\t\t\t\t151 button 交付成片\n\t\t\t\t\t\t152 button 继续拍摄\n\t\t\t\t\t153 container\n\t\t\t\t\t\t154 heading 游客151****8602, Value: 2\n\t\t\t\t\t\t\t155 text 游客 151****8602\n\t\t\t\t\t\t156 text 待拍摄 HT202610200009 · 10-20 8:15 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t157 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t158 button 交付成片\n\t\t\t\t\t\t159 button 开始拍摄\n\t\t\t\t\t160 container\n\t\t\t\t\t\t161 heading 游客180****4075, Value: 2\n\t\t\t\t\t\t\t162 text 游客 180****4075\n\t\t\t\t\t\t163 text 拍摄完成 HT202610200010 · 10-20 7:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t164 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t165 text 拍摄素材 上传完成\n\t\t\t\t\t\t166 button 查看素材\n\t\t\t\t\t\t167 button 交付成片\n\t\t\t\t\t168 container\n\t\t\t\t\t\t169 heading 游客185****5736, Value: 2\n\t\t\t\t\t\t\t170 text 游客 185****5736\n\t\t\t\t\t\t171 text 拍摄完成 HT202610200011 · 10-20 6:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t172 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t173 text 拍摄素材 上传完成\n\t\t\t\t\t\t174 button 查看素材\n\t\t\t\t\t\t175 button 交付成片\n\t\t\t\t\t176 container\n\t\t\t\t\t\t177 heading 游客188****3160, Value: 2\n\t\t\t\t\t\t\t178 text 游客 188****3160\n\t\t\t\t\t\t179 text 拍摄完成 HT202610200012 · 10-20 5:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t180 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t181 text 拍摄素材 上传完成\n\t\t\t\t\t\t182 button 查看素材\n\t\t\t\t\t\t183 button 交付成片\n\t\t\t\t\t184 text 已显示全部 12 个订单\n\t\t\t55 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "49-已完成Tab", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 我的拍摄订单, Value: 1\n\t\t\t\t\t\t60 text 我的拍摄订单\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 text 分配给我的全部订单,含已完成订单\n\t\t\t\t\t68 container 订单状态\n\t\t\t\t\t\t69 checkbox 全部, Value: 0\n\t\t\t\t\t\t70 checkbox 待拍摄, Value: 0\n\t\t\t\t\t\t71 checkbox 进行中, Value: 0\n\t\t\t\t\t\t72 checkbox 已完成, Value: 1\n\t\t\t\t\t73 heading 已完成订单 5, Value: 2\n\t\t\t\t\t\t74 text 已完成订单 5\n\t\t\t\t\t86 container\n\t\t\t\t\t\t87 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t88 text 游客 136****2806\n\t\t\t\t\t\t89 text 拍摄完成 HT202610200002 · 10-20 14:18 单次航拍 · 含 1 次拍摄 已拍摄 1 / 1 次 剩余 0 次\n\t\t\t\t\t\t90 progress indicator Description: 已拍摄 1 次,共 1 次, Value: 1\n\t\t\t\t\t\t91 text 拍摄素材 上传完成\n\t\t\t\t\t\t92 button 请游客确认 已交付 2 个视频\n\t\t\t\t\t\t\t93 text 请游客确认\n\t\t\t\t\t\t\t94 image\n\t\t\t\t\t\t\t95 text 已交付 2 个视频\n\t\t\t\t\t\t96 button 查看素材\n\t\t\t\t\t\t97 button 交付成片\n\t\t\t\t\t109 container\n\t\t\t\t\t\t110 heading 游客137****6628, Value: 2\n\t\t\t\t\t\t\t111 text 游客 137****6628\n\t\t\t\t\t\t112 text 拍摄完成 HT202610190012 · 10-19 16:18 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t113 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t114 text 拍摄素材 上传完成\n\t\t\t\t\t\t115 button 查看素材\n\t\t\t\t\t\t116 button 交付成片\n\t\t\t\t\t160 container\n\t\t\t\t\t\t161 heading 游客180****4075, Value: 2\n\t\t\t\t\t\t\t162 text 游客 180****4075\n\t\t\t\t\t\t163 text 拍摄完成 HT202610200010 · 10-20 7:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t164 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t165 text 拍摄素材 上传完成\n\t\t\t\t\t\t166 button 查看素材\n\t\t\t\t\t\t167 button 交付成片\n\t\t\t\t\t168 container\n\t\t\t\t\t\t169 heading 游客185****5736, Value: 2\n\t\t\t\t\t\t\t170 text 游客 185****5736\n\t\t\t\t\t\t171 text 拍摄完成 HT202610200011 · 10-20 6:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t172 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t173 text 拍摄素材 上传完成\n\t\t\t\t\t\t174 button 查看素材\n\t\t\t\t\t\t175 button 交付成片\n\t\t\t\t\t176 container\n\t\t\t\t\t\t177 heading 游客188****3160, Value: 2\n\t\t\t\t\t\t\t178 text 游客 188****3160\n\t\t\t\t\t\t179 text 拍摄完成 HT202610200012 · 10-20 5:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t180 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t181 text 拍摄素材 上传完成\n\t\t\t\t\t\t182 button 查看素材\n\t\t\t\t\t\t183 button 交付成片\n\t\t\t\t\t184 text 已显示全部 5 个订单\n\t\t\t55 image\n\nThe focused UI element is 72 checkbox 已完成, Value: 1" + }, + { + "name": "50-整单成片核对", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:31\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t60 text 订单交付确认\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t68 text 游客 136****2806\n\t\t\t\t\t69 text 整单确认\n\t\t\t\t\t70 text HT202610200002\n\t\t\t\t\t71 image\n\t\t\t\t\t72 heading 先核对,再请游客确认, Value: 2\n\t\t\t\t\t\t73 text 先核对,再请游客确认\n\t\t\t\t\t74 text 一次确认整单,不按打卡点逐次确认。\n\t\t\t\t\t75 text 本订单已交付 2 个成片 覆盖 1 个打卡点\n\t\t\t\t\t76 heading 整单交付清单, Value: 2\n\t\t\t\t\t\t77 text 整单交付清单\n\t\t\t\t\t78 text 含所有上传批次\n\t\t\t\t\t79 heading 三皇寨, Value: 3\n\t\t\t\t\t\t80 text 三皇寨\n\t\t\t\t\t81 text 2 个视频\n\t\t\t\t\t82 button 预览三皇寨成片1\n\t\t\t\t\t\t83 container\n\t\t\t\t\t\t\t84 image 成片演示封面\n\t\t\t\t\t\t\t85 image\n\t\t\t\t\t\t\t86 text 00:32\n\t\t\t\t\t\t87 container\n\t\t\t\t\t\t\t88 text 成片 01\n\t\t\t\t\t\t89 text 三皇寨_成片01.mp4\n\t\t\t\t\t90 button 预览三皇寨成片2\n\t\t\t\t\t\t91 container\n\t\t\t\t\t\t\t92 image 成片演示封面\n\t\t\t\t\t\t\t93 image\n\t\t\t\t\t\t\t94 text 00:48\n\t\t\t\t\t\t95 container\n\t\t\t\t\t\t\t96 text 成片 02\n\t\t\t\t\t\t97 text 三皇寨_成片02.mp4\n\t\t\t\t\t98 text 请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。\n\t\t\t\t99 container\n\t\t\t\t\t100 checkbox 我已核对,本订单成片已全部交齐, Value: 0\n\t\t\t\t\t101 button (disabled) 已交齐,展示订单确认码\n\t\t\t\t\t102 button 还未交齐,继续交付\n\t\t\t55 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "51-核对勾选", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t60 text 订单交付确认\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t68 text 游客 136****2806\n\t\t\t\t\t69 text 整单确认\n\t\t\t\t\t70 text HT202610200002\n\t\t\t\t\t71 image\n\t\t\t\t\t72 heading 先核对,再请游客确认, Value: 2\n\t\t\t\t\t\t73 text 先核对,再请游客确认\n\t\t\t\t\t74 text 一次确认整单,不按打卡点逐次确认。\n\t\t\t\t\t75 text 本订单已交付 2 个成片 覆盖 1 个打卡点\n\t\t\t\t\t76 heading 整单交付清单, Value: 2\n\t\t\t\t\t\t77 text 整单交付清单\n\t\t\t\t\t78 text 含所有上传批次\n\t\t\t\t\t79 heading 三皇寨, Value: 3\n\t\t\t\t\t\t80 text 三皇寨\n\t\t\t\t\t81 text 2 个视频\n\t\t\t\t\t82 button 预览三皇寨成片1\n\t\t\t\t\t\t83 container\n\t\t\t\t\t\t\t84 image 成片演示封面\n\t\t\t\t\t\t\t85 image\n\t\t\t\t\t\t\t86 text 00:32\n\t\t\t\t\t\t87 container\n\t\t\t\t\t\t\t88 text 成片 01\n\t\t\t\t\t\t89 text 三皇寨_成片01.mp4\n\t\t\t\t\t90 button 预览三皇寨成片2\n\t\t\t\t\t\t91 container\n\t\t\t\t\t\t\t92 image 成片演示封面\n\t\t\t\t\t\t\t93 image\n\t\t\t\t\t\t\t94 text 00:48\n\t\t\t\t\t\t95 container\n\t\t\t\t\t\t\t96 text 成片 02\n\t\t\t\t\t\t97 text 三皇寨_成片02.mp4\n\t\t\t\t\t98 text 请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。\n\t\t\t\t99 container\n\t\t\t\t\t100 checkbox 我已核对,本订单成片已全部交齐, Value: 1\n\t\t\t\t\t\t103 image\n\t\t\t\t\t\t104 text 我已核对,本订单成片已全部交齐\n\t\t\t\t\t101 button 已交齐,展示订单确认码\n\t\t\t\t\t102 button 还未交齐,继续交付\n\t\t\t55 image\n\nThe focused UI element is 100 checkbox 我已核对,本订单成片已全部交齐, Value: 1" + }, + { + "name": "52-整单确认码", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t60 text 订单交付确认\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t68 text 游客 136****2806\n\t\t\t\t\t69 text 整单确认\n\t\t\t\t\t70 text HT202610200002\n\t\t\t\t\t105 text 等待游客确认\n\t\t\t\t\t106 heading 请游客扫码确认收货, Value: 2\n\t\t\t\t\t\t107 text 请游客扫码确认收货\n\t\t\t\t\t108 text 查看本订单全部成片后,一次确认\n\t\t\t\t\t109 image 订单确认演示二维码\n\t\t\t\t\t110 container\n\t\t\t\t\t\t111 text 2 个成片\n\t\t\t\t\t112 text · 1 个打卡点\n\t\t\t\t\t113 text 扫描不等于收货,需游客本人主动确认\n\t\t\t\t\t75 text 仅供交互演示 · 不连接游客手机\n\t\t\t\t\t114 button 演示游客扫码\n\t\t\t\t\t\t115 text 演示游客扫码\n\t\t\t\t\t\t116 image\n\t\t\t\t\t117 button (collapsed) 查看本次整单确认清单, Secondary Actions: Expand\n\t\t\t\t\t\t118 text 查看本次整单确认清单\n\t\t\t\t\t119 text 演示码不提供真实扫码收货服务。正式功能需校验订单身份,并保存具体作品与确认记录。\n\t\t\t\t99 container\n\t\t\t\t\t100 button 刷新确认状态\n\t\t\t\t\t\t120 image\n\t\t\t\t\t\t104 text 刷新确认状态\n\t\t\t\t\t101 button 稍后确认,返回订单\n\t\t\t55 image\n\nThe focused UI element is 101 button 稍后确认,返回订单" + }, + { + "name": "53-刷新仍待确认", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t60 text 订单交付确认\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t68 text 游客 136****2806\n\t\t\t\t\t69 text 整单确认\n\t\t\t\t\t70 text HT202610200002\n\t\t\t\t\t105 text 等待游客确认\n\t\t\t\t\t106 heading 请游客扫码确认收货, Value: 2\n\t\t\t\t\t\t107 text 请游客扫码确认收货\n\t\t\t\t\t108 text 查看本订单全部成片后,一次确认\n\t\t\t\t\t109 image 订单确认演示二维码\n\t\t\t\t\t110 container\n\t\t\t\t\t\t111 text 2 个成片\n\t\t\t\t\t112 text · 1 个打卡点\n\t\t\t\t\t113 text 扫描不等于收货,需游客本人主动确认\n\t\t\t\t\t75 text 仅供交互演示 · 不连接游客手机\n\t\t\t\t\t114 button 演示游客扫码\n\t\t\t\t\t\t115 text 演示游客扫码\n\t\t\t\t\t\t116 image\n\t\t\t\t\t117 button (collapsed) 查看本次整单确认清单, Secondary Actions: Expand\n\t\t\t\t\t\t118 text 查看本次整单确认清单\n\t\t\t\t\t119 text 演示码不提供真实扫码收货服务。正式功能需校验订单身份,并保存具体作品与确认记录。\n\t\t\t\t120 container\n\t\t\t\t\t121 button 刷新确认状态\n\t\t\t\t\t\t122 image\n\t\t\t\t\t\t123 text 刷新确认状态\n\t\t\t\t\t124 button 稍后确认,返回订单\n\t\t\t\t\t125 text 暂未收到游客确认,请游客查看成片后主动确认。\n\t\t\t55 image\n\nThe focused UI element is 121 button 刷新确认状态" + }, + { + "name": "54-游客确认端", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t56 container\n\t\t\t\t\t57 button 返回\n\t\t\t\t\t\t65 image\n\t\t\t\t\t59 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t60 text 订单交付确认\n\t\t\t\t61 text 交互原型 · 无真实操作\n\t\t\t\t62 button 体验本页其他状态\n\t\t\t\t\t63 image\n\t\t\t\t\t64 text 体验其他状态\n\t\t\t\t66 container\n\t\t\t\t\t67 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t68 text 游客 136****2806\n\t\t\t\t\t69 text 游客端演示\n\t\t\t\t\t70 text HT202610200002\n\t\t\t\t\t126 image\n\t\t\t\t\t127 text 扫码后的游客端 · 演示身份校验\n\t\t\t\t\t128 heading 您的成片已交付, Value: 2\n\t\t\t\t\t\t129 text 您的成片已交付\n\t\t\t\t\t130 container\n\t\t\t\t\t\t131 text 共 2 个视频 · 1 个打卡点\n\t\t\t\t\t\t132 text 请核对视频数量与内容,再确认收到。\n\t\t\t\t\t133 heading 三皇寨, Value: 3\n\t\t\t\t\t\t134 text 三皇寨\n\t\t\t\t\t135 text 2 个视频\n\t\t\t\t\t136 button 预览三皇寨成片1\n\t\t\t\t\t\t137 container\n\t\t\t\t\t\t\t138 image 成片演示封面\n\t\t\t\t\t\t\t139 image\n\t\t\t\t\t\t\t140 text 00:32\n\t\t\t\t\t\t141 container\n\t\t\t\t\t\t\t142 text 成片 01\n\t\t\t\t\t\t143 text 三皇寨_成片01.mp4\n\t\t\t\t\t144 button 预览三皇寨成片2\n\t\t\t\t\t\t145 container\n\t\t\t\t\t\t\t146 image 成片演示封面\n\t\t\t\t\t\t\t147 image\n\t\t\t\t\t\t\t148 text 00:48\n\t\t\t\t\t\t149 container\n\t\t\t\t\t\t\t150 text 成片 02\n\t\t\t\t\t\t151 text 三皇寨_成片02.mp4\n\t\t\t\t\t152 text 我已查看本订单交付清单,确认收到上述全部成片。 如有缺失、无法播放或其他问题,请先反馈工作人员处理。\n\t\t\t\t120 container\n\t\t\t\t\t153 checkbox 我已查看清单,确认收到全部成片, Value: 0\n\t\t\t\t\t154 button (disabled) 确认收到全部成片(2 个)\n\t\t\t\t\t\t155 text 确认收到全部成片( 2 个)\n\t\t\t\t\t156 button 视频有问题,先反馈\n\t\t\t\t\t125 text 暂未收到游客确认,请游客查看成片后主动确认。\n\t\t\t55 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "55-游客问题反馈", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 反馈成片问题, ID: radix-_r_3q_\n\t\t2 heading 反馈成片问题, Value: 2, ID: radix-_r_3r_\n\t\t\t3 text 反馈成片问题\n\t\t4 text 反馈不会确认收货,请与工作人员沟通处理。\n\t\t5 container\n\t\t\t6 checkbox 视频缺失, Value: 0\n\t\t\t7 checkbox 无法播放, Value: 0\n\t\t\t8 checkbox 成片效果有异议, Value: 0\n\t\t\t9 checkbox 其他问题, Value: 0\n\t\t\t10 text entry area (settable) 补充问题说明\n\t\t\t11 button (disabled) 提交问题反馈\n\t\t\t12 text 演示提交仅保存在当前浏览器会话,不发送真实消息。\n\nThe focused UI element is 6 checkbox 视频缺失, Value: 0" + }, + { + "name": "56-选择缺失反馈", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 反馈成片问题, ID: radix-_r_3q_\n\t\t2 heading 反馈成片问题, Value: 2, ID: radix-_r_3r_\n\t\t\t3 text 反馈成片问题\n\t\t4 text 反馈不会确认收货,请与工作人员沟通处理。\n\t\t5 container\n\t\t\t6 checkbox 视频缺失, Value: 1\n\t\t\t7 checkbox 无法播放, Value: 0\n\t\t\t8 checkbox 成片效果有异议, Value: 0\n\t\t\t9 checkbox 其他问题, Value: 0\n\t\t\t10 text entry area (settable) 补充问题说明\n\t\t\t11 button 提交问题反馈\n\t\t\t12 text 演示提交仅保存在当前浏览器会话,不发送真实消息。\n\nThe focused UI element is 6 checkbox 视频缺失, Value: 1" + }, + { + "name": "57-已反馈未确认", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 游客端演示\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t21 image\n\t\t\t\t\t22 text 扫码后的游客端 · 演示身份校验\n\t\t\t\t\t23 image\n\t\t\t\t\t24 heading 问题已反馈, Value: 2\n\t\t\t\t\t\t25 text 问题已反馈\n\t\t\t\t\t26 text 请等待工作人员处理,当前未确认收货。\n\t\t\t\t\t27 button (collapsed) 问题反馈记录(1), Secondary Actions: Expand\n\t\t\t\t\t\t28 text 问题反馈记录(\n\t\t\t\t\t\t29 text 1\n\t\t\t\t\t\t30 text )\n\t\t\t\t31 button 返回工作人员页面\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "58-商家反馈待处理", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 整单确认\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t33 text 游客已反馈问题\n\t\t\t\t\t34 heading 请先处理游客反馈, Value: 2\n\t\t\t\t\t\t35 text 请先处理游客反馈\n\t\t\t\t\t36 text 订单尚未确认收货,不会自动确认\n\t\t\t\t\t37 container\n\t\t\t\t\t\t38 text 2 个成片\n\t\t\t\t\t39 text · 1 个打卡点\n\t\t\t\t\t40 text 扫描不等于收货,需游客本人主动确认\n\t\t\t\t\t41 text 仅供交互演示 · 不连接游客手机\n\t\t\t\t\t42 button (disabled) 演示游客扫码\n\t\t\t\t\t\t43 text 演示游客扫码\n\t\t\t\t\t\t44 image\n\t\t\t\t\t45 button (collapsed) 问题反馈记录(1), Secondary Actions: Expand\n\t\t\t\t\t\t46 text 问题反馈记录(\n\t\t\t\t\t\t47 text 1\n\t\t\t\t\t\t48 text )\n\t\t\t\t\t49 button (collapsed) 查看本次整单确认清单, Secondary Actions: Expand\n\t\t\t\t\t\t50 text 查看本次整单确认清单\n\t\t\t\t\t51 text 演示码不提供真实扫码收货服务。正式功能需校验订单身份,并保存具体作品与确认记录。\n\t\t\t\t52 container\n\t\t\t\t\t53 button 处理后重新核对交付\n\t\t\t\t\t54 button 稍后确认,返回订单\n\t\t\t32 image\n\nThe focused UI element is 54 button 稍后确认,返回订单" + }, + { + "name": "59-反馈后重新核对", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 整单确认\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t55 image\n\t\t\t\t\t56 heading 先核对,再请游客确认, Value: 2\n\t\t\t\t\t\t57 text 先核对,再请游客确认\n\t\t\t\t\t58 text 一次确认整单,不按打卡点逐次确认。\n\t\t\t\t\t41 text 本订单已交付 2 个成片 覆盖 1 个打卡点\n\t\t\t\t\t59 heading 整单交付清单, Value: 2\n\t\t\t\t\t\t60 text 整单交付清单\n\t\t\t\t\t61 text 含所有上传批次\n\t\t\t\t\t62 heading 三皇寨, Value: 3\n\t\t\t\t\t\t63 text 三皇寨\n\t\t\t\t\t64 text 2 个视频\n\t\t\t\t\t65 button 预览三皇寨成片1\n\t\t\t\t\t\t66 container\n\t\t\t\t\t\t\t67 image 成片演示封面\n\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t69 text 00:32\n\t\t\t\t\t\t70 container\n\t\t\t\t\t\t\t71 text 成片 01\n\t\t\t\t\t\t72 text 三皇寨_成片01.mp4\n\t\t\t\t\t73 button 预览三皇寨成片2\n\t\t\t\t\t\t74 container\n\t\t\t\t\t\t\t75 image 成片演示封面\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t77 text 00:48\n\t\t\t\t\t\t78 container\n\t\t\t\t\t\t\t79 text 成片 02\n\t\t\t\t\t\t80 text 三皇寨_成片02.mp4\n\t\t\t\t\t81 button (collapsed) 问题反馈记录(1), Secondary Actions: Expand\n\t\t\t\t\t\t82 text 问题反馈记录(\n\t\t\t\t\t\t83 text 1\n\t\t\t\t\t\t84 text )\n\t\t\t\t\t85 text 请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。\n\t\t\t\t52 container\n\t\t\t\t\t53 checkbox 我已核对,本订单成片已全部交齐, Value: 0\n\t\t\t\t\t54 button (disabled) 已交齐,展示订单确认码\n\t\t\t\t\t86 button 还未交齐,继续交付\n\t\t\t32 image\n\nThe focused UI element is 53 checkbox 我已核对,本订单成片已全部交齐, Value: 0" + }, + { + "name": "60-重新核对勾选", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 整单确认\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t55 image\n\t\t\t\t\t56 heading 先核对,再请游客确认, Value: 2\n\t\t\t\t\t\t57 text 先核对,再请游客确认\n\t\t\t\t\t58 text 一次确认整单,不按打卡点逐次确认。\n\t\t\t\t\t41 text 本订单已交付 2 个成片 覆盖 1 个打卡点\n\t\t\t\t\t59 heading 整单交付清单, Value: 2\n\t\t\t\t\t\t60 text 整单交付清单\n\t\t\t\t\t61 text 含所有上传批次\n\t\t\t\t\t62 heading 三皇寨, Value: 3\n\t\t\t\t\t\t63 text 三皇寨\n\t\t\t\t\t64 text 2 个视频\n\t\t\t\t\t65 button 预览三皇寨成片1\n\t\t\t\t\t\t66 container\n\t\t\t\t\t\t\t67 image 成片演示封面\n\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t69 text 00:32\n\t\t\t\t\t\t70 container\n\t\t\t\t\t\t\t71 text 成片 01\n\t\t\t\t\t\t72 text 三皇寨_成片01.mp4\n\t\t\t\t\t73 button 预览三皇寨成片2\n\t\t\t\t\t\t74 container\n\t\t\t\t\t\t\t75 image 成片演示封面\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t77 text 00:48\n\t\t\t\t\t\t78 container\n\t\t\t\t\t\t\t79 text 成片 02\n\t\t\t\t\t\t80 text 三皇寨_成片02.mp4\n\t\t\t\t\t81 button (collapsed) 问题反馈记录(1), Secondary Actions: Expand\n\t\t\t\t\t\t82 text 问题反馈记录(\n\t\t\t\t\t\t83 text 1\n\t\t\t\t\t\t84 text )\n\t\t\t\t\t85 text 请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。\n\t\t\t\t52 container\n\t\t\t\t\t53 checkbox 我已核对,本订单成片已全部交齐, Value: 1\n\t\t\t\t\t\t87 image\n\t\t\t\t\t\t88 text 我已核对,本订单成片已全部交齐\n\t\t\t\t\t54 button 已交齐,展示订单确认码\n\t\t\t\t\t86 button 还未交齐,继续交付\n\t\t\t32 image\n\nThe focused UI element is 53 checkbox 我已核对,本订单成片已全部交齐, Value: 1" + }, + { + "name": "61-重新出确认码", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 整单确认\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t89 text 等待游客确认\n\t\t\t\t\t90 heading 请游客扫码确认收货, Value: 2\n\t\t\t\t\t\t91 text 请游客扫码确认收货\n\t\t\t\t\t92 text 查看本订单全部成片后,一次确认\n\t\t\t\t\t93 image 订单确认演示二维码\n\t\t\t\t\t94 container\n\t\t\t\t\t\t95 text 2 个成片\n\t\t\t\t\t96 text · 1 个打卡点\n\t\t\t\t\t97 text 扫描不等于收货,需游客本人主动确认\n\t\t\t\t\t41 text 仅供交互演示 · 不连接游客手机\n\t\t\t\t\t98 button 演示游客扫码\n\t\t\t\t\t\t99 text 演示游客扫码\n\t\t\t\t\t\t100 image\n\t\t\t\t\t101 button (collapsed) 问题反馈记录(1), Secondary Actions: Expand\n\t\t\t\t\t\t102 text 问题反馈记录(\n\t\t\t\t\t\t103 text 1\n\t\t\t\t\t\t104 text )\n\t\t\t\t\t105 button (collapsed) 查看本次整单确认清单, Secondary Actions: Expand\n\t\t\t\t\t\t106 text 查看本次整单确认清单\n\t\t\t\t\t107 text 演示码不提供真实扫码收货服务。正式功能需校验订单身份,并保存具体作品与确认记录。\n\t\t\t\t52 container\n\t\t\t\t\t53 button 刷新确认状态\n\t\t\t\t\t\t108 image\n\t\t\t\t\t\t88 text 刷新确认状态\n\t\t\t\t\t54 button 稍后确认,返回订单\n\t\t\t32 image\n\nThe focused UI element is 54 button 稍后确认,返回订单" + }, + { + "name": "62-游客重新查看清单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:32\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 游客端演示\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t53 image\n\t\t\t\t\t54 text 扫码后的游客端 · 演示身份校验\n\t\t\t\t\t55 heading 您的成片已交付, Value: 2\n\t\t\t\t\t\t56 text 您的成片已交付\n\t\t\t\t\t57 container\n\t\t\t\t\t\t58 text 共 2 个视频 · 1 个打卡点\n\t\t\t\t\t\t59 text 请核对视频数量与内容,再确认收到。\n\t\t\t\t\t60 heading 三皇寨, Value: 3\n\t\t\t\t\t\t61 text 三皇寨\n\t\t\t\t\t62 text 2 个视频\n\t\t\t\t\t63 button 预览三皇寨成片1\n\t\t\t\t\t\t64 container\n\t\t\t\t\t\t\t65 image 成片演示封面\n\t\t\t\t\t\t\t66 image\n\t\t\t\t\t\t\t67 text 00:32\n\t\t\t\t\t\t68 container\n\t\t\t\t\t\t\t69 text 成片 01\n\t\t\t\t\t\t70 text 三皇寨_成片01.mp4\n\t\t\t\t\t71 button 预览三皇寨成片2\n\t\t\t\t\t\t72 container\n\t\t\t\t\t\t\t73 image 成片演示封面\n\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t\t75 text 00:48\n\t\t\t\t\t\t76 container\n\t\t\t\t\t\t\t77 text 成片 02\n\t\t\t\t\t\t78 text 三皇寨_成片02.mp4\n\t\t\t\t\t79 text 我已查看本订单交付清单,确认收到上述全部成片。 如有缺失、无法播放或其他问题,请先反馈工作人员处理。\n\t\t\t\t52 container\n\t\t\t\t\t80 checkbox 我已查看清单,确认收到全部成片, Value: 0\n\t\t\t\t\t81 button (disabled) 确认收到全部成片(2 个)\n\t\t\t\t\t\t82 text 确认收到全部成片( 2 个)\n\t\t\t\t\t83 button 视频有问题,先反馈\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "63-游客主动勾选", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:33\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 游客端演示\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t53 image\n\t\t\t\t\t54 text 扫码后的游客端 · 演示身份校验\n\t\t\t\t\t55 heading 您的成片已交付, Value: 2\n\t\t\t\t\t\t56 text 您的成片已交付\n\t\t\t\t\t57 container\n\t\t\t\t\t\t58 text 共 2 个视频 · 1 个打卡点\n\t\t\t\t\t\t59 text 请核对视频数量与内容,再确认收到。\n\t\t\t\t\t60 heading 三皇寨, Value: 3\n\t\t\t\t\t\t61 text 三皇寨\n\t\t\t\t\t62 text 2 个视频\n\t\t\t\t\t63 button 预览三皇寨成片1\n\t\t\t\t\t\t64 container\n\t\t\t\t\t\t\t65 image 成片演示封面\n\t\t\t\t\t\t\t66 image\n\t\t\t\t\t\t\t67 text 00:32\n\t\t\t\t\t\t68 container\n\t\t\t\t\t\t\t69 text 成片 01\n\t\t\t\t\t\t70 text 三皇寨_成片01.mp4\n\t\t\t\t\t71 button 预览三皇寨成片2\n\t\t\t\t\t\t72 container\n\t\t\t\t\t\t\t73 image 成片演示封面\n\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t\t75 text 00:48\n\t\t\t\t\t\t76 container\n\t\t\t\t\t\t\t77 text 成片 02\n\t\t\t\t\t\t78 text 三皇寨_成片02.mp4\n\t\t\t\t\t79 text 我已查看本订单交付清单,确认收到上述全部成片。 如有缺失、无法播放或其他问题,请先反馈工作人员处理。\n\t\t\t\t52 container\n\t\t\t\t\t80 checkbox 我已查看清单,确认收到全部成片, Value: 1\n\t\t\t\t\t\t84 image\n\t\t\t\t\t\t85 text 我已查看清单,确认收到全部成片\n\t\t\t\t\t81 button 确认收到全部成片(2 个)\n\t\t\t\t\t\t82 text 确认收到全部成片(\n\t\t\t\t\t\t86 text 2\n\t\t\t\t\t\t87 text 个)\n\t\t\t\t\t83 button 视频有问题,先反馈\n\t\t\t32 image\n\nThe focused UI element is 80 checkbox 我已查看清单,确认收到全部成片, Value: 1" + }, + { + "name": "64-游客确认结果", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:33\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 订单交付确认, Value: 1\n\t\t\t\t\t\t11 text 订单交付确认\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t18 text 游客 136****2806\n\t\t\t\t\t19 text 整单确认\n\t\t\t\t\t20 text HT202610200002\n\t\t\t\t\t53 image\n\t\t\t\t\t54 heading 游客已确认收货, Value: 2\n\t\t\t\t\t\t55 text 游客已确认收货\n\t\t\t\t\t56 container\n\t\t\t\t\t\t57 text 本订单一次确认,共 2 个成片\n\t\t\t\t\t58 definition list\n\t\t\t\t\t\t59 container 确认人\n\t\t\t\t\t\t\t60 text 确认人\n\t\t\t\t\t\t61 container\n\t\t\t\t\t\t\t62 text 游客 136****2806\n\t\t\t\t\t\t63 container 确认时间\n\t\t\t\t\t\t\t64 text 确认时间\n\t\t\t\t\t\t65 text 2026/10/26 14:33:02\n\t\t\t\t\t\t66 container 交付工作人员\n\t\t\t\t\t\t\t67 text 交付工作人员\n\t\t\t\t\t\t68 text 吴家俊\n\t\t\t\t\t\t69 container 确认范围\n\t\t\t\t\t\t\t70 text 确认范围\n\t\t\t\t\t\t71 container\n\t\t\t\t\t\t\t72 text 1 个打卡点 · 2 个成片\n\t\t\t\t\t73 text 游客确认内容 我已查看本订单交付清单,确认收到上述全部成片。\n\t\t\t\t\t74 heading 已确认的成片清单, Value: 2\n\t\t\t\t\t\t75 text 已确认的成片清单\n\t\t\t\t\t76 text 确认时的记录\n\t\t\t\t\t77 heading 三皇寨, Value: 3\n\t\t\t\t\t\t78 text 三皇寨\n\t\t\t\t\t79 text 2 个视频\n\t\t\t\t\t80 button 预览三皇寨成片1\n\t\t\t\t\t\t81 container\n\t\t\t\t\t\t\t82 image 成片演示封面\n\t\t\t\t\t\t\t83 image\n\t\t\t\t\t\t\t84 text 00:32\n\t\t\t\t\t\t85 container\n\t\t\t\t\t\t\t86 text 成片 01\n\t\t\t\t\t\t87 text 三皇寨_成片01.mp4\n\t\t\t\t\t88 button 预览三皇寨成片2\n\t\t\t\t\t\t89 container\n\t\t\t\t\t\t\t90 image 成片演示封面\n\t\t\t\t\t\t\t91 image\n\t\t\t\t\t\t\t92 text 00:48\n\t\t\t\t\t\t93 container\n\t\t\t\t\t\t\t94 text 成片 02\n\t\t\t\t\t\t95 text 三皇寨_成片02.mp4\n\t\t\t\t\t96 button (collapsed) 问题反馈记录(1), Secondary Actions: Expand\n\t\t\t\t\t\t97 text 问题反馈记录(\n\t\t\t\t\t\t98 text 1\n\t\t\t\t\t\t99 text )\n\t\t\t\t\t100 text 当前为本机演示记录,并非真实收货凭据。新增成片不会覆盖原确认清单。\n\t\t\t\t52 container\n\t\t\t\t\t101 text 仅确认交付清单,不代表对拍摄效果无异议\n\t\t\t\t\t102 button 返回订单列表\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "65-确认后订单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:33\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 我的拍摄订单, Value: 1\n\t\t\t\t\t\t11 text 我的拍摄订单\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t33 container\n\t\t\t\t\t34 text 分配给我的全部订单,含已完成订单\n\t\t\t\t\t35 container 订单状态\n\t\t\t\t\t\t36 checkbox 全部, Value: 0\n\t\t\t\t\t\t37 checkbox 待拍摄, Value: 0\n\t\t\t\t\t\t38 checkbox 进行中, Value: 0\n\t\t\t\t\t\t39 checkbox 已完成, Value: 1\n\t\t\t\t\t40 heading 已完成订单 5, Value: 2\n\t\t\t\t\t\t41 text 已完成订单 5\n\t\t\t\t\t42 container\n\t\t\t\t\t\t43 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t44 text 游客 136****2806\n\t\t\t\t\t\t45 text 拍摄完成 HT202610200002 · 10-20 14:18 单次航拍 · 含 1 次拍摄 已拍摄 1 / 1 次 剩余 0 次\n\t\t\t\t\t\t46 progress indicator Description: 已拍摄 1 次,共 1 次, Value: 1\n\t\t\t\t\t\t47 text 拍摄素材 上传完成\n\t\t\t\t\t\t48 button 查看记录 游客已确认收货 2026/10/26 14:33:02\n\t\t\t\t\t\t\t49 text 查看记录\n\t\t\t\t\t\t\t50 image\n\t\t\t\t\t\t\t51 text 游客已确认收货\n\t\t\t\t\t\t\t52 text 2026/10/26 14:33:02\n\t\t\t\t\t\t53 button 查看素材\n\t\t\t\t\t\t54 button 交付成片\n\t\t\t\t\t55 container\n\t\t\t\t\t\t56 heading 游客137****6628, Value: 2\n\t\t\t\t\t\t\t57 text 游客 137****6628\n\t\t\t\t\t\t58 text 拍摄完成 HT202610190012 · 10-19 16:18 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t59 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t60 text 拍摄素材 上传完成\n\t\t\t\t\t\t61 button 查看素材\n\t\t\t\t\t\t62 button 交付成片\n\t\t\t\t\t63 container\n\t\t\t\t\t\t64 heading 游客180****4075, Value: 2\n\t\t\t\t\t\t\t65 text 游客 180****4075\n\t\t\t\t\t\t66 text 拍摄完成 HT202610200010 · 10-20 7:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t67 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t68 text 拍摄素材 上传完成\n\t\t\t\t\t\t69 button 查看素材\n\t\t\t\t\t\t70 button 交付成片\n\t\t\t\t\t71 container\n\t\t\t\t\t\t72 heading 游客185****5736, Value: 2\n\t\t\t\t\t\t\t73 text 游客 185****5736\n\t\t\t\t\t\t74 text 拍摄完成 HT202610200011 · 10-20 6:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t75 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t76 text 拍摄素材 上传完成\n\t\t\t\t\t\t77 button 查看素材\n\t\t\t\t\t\t78 button 交付成片\n\t\t\t\t\t79 container\n\t\t\t\t\t\t80 heading 游客188****3160, Value: 2\n\t\t\t\t\t\t\t81 text 游客 188****3160\n\t\t\t\t\t\t82 text 拍摄完成 HT202610200012 · 10-20 5:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t83 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t84 text 拍摄素材 上传完成\n\t\t\t\t\t\t85 button 查看素材\n\t\t\t\t\t\t86 button 交付成片\n\t\t\t\t\t87 text 已显示全部 5 个订单\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "66-回到工作台", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:33\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 景区空镜库\n\t\t\t\t\t10 heading 机巢工作台, Value: 1\n\t\t\t\t\t\t11 text 机巢工作台\n\t\t\t\t\t33 button 收款码\n\t\t\t\t\t\t34 image\n\t\t\t\t\t\t35 text 收款码\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t36 container\n\t\t\t\t\t37 text 嵩山少林景区 · 吴家俊\n\t\t\t\t\t38 container 无人机设备状态\n\t\t\t\t\t\t39 container 左右滑动查看无人机\n\t\t\t\t\t\t\t40 container 01号无人机\n\t\t\t\t\t\t\t\t41 container 01号无人机的六项状态\n\t\t\t\t\t\t\t\t\t42 heading 01号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t43 text 01号无人机\n\t\t\t\t\t\t\t\t\t44 text 空闲\n\t\t\t\t\t\t\t\t\t45 level indicator Description: 电池电量, Value: 95\n\t\t\t\t\t\t\t\t\t46 image\n\t\t\t\t\t\t\t\t\t47 text 信号状态\n\t\t\t\t\t\t\t\t\t48 text 良好\n\t\t\t\t\t\t\t\t\t49 image\n\t\t\t\t\t\t\t\t\t50 text 搜星状态\n\t\t\t\t\t\t\t\t\t51 container\n\t\t\t\t\t\t\t\t\t\t52 text 36 颗\n\t\t\t\t\t\t\t\t\t53 container\n\t\t\t\t\t\t\t\t\t\t54 text 19.3 °C\n\t\t\t\t\t\t\t\t\t55 image\n\t\t\t\t\t\t\t\t\t56 text 环境温度\n\t\t\t\t\t\t\t\t\t57 container\n\t\t\t\t\t\t\t\t\t\t58 text 0 m/s\n\t\t\t\t\t\t\t\t\t59 image\n\t\t\t\t\t\t\t\t\t60 text 风速\n\t\t\t\t\t\t\t\t\t61 text 无雨\n\t\t\t\t\t\t\t\t\t62 image\n\t\t\t\t\t\t\t\t\t63 text 雨量\n\t\t\t\t\t\t\t64 container 02号无人机\n\t\t\t\t\t\t\t\t65 container 02号无人机的六项状态\n\t\t\t\t\t\t\t\t\t66 heading 02号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t67 text 02号无人机\n\t\t\t\t\t\t\t\t\t68 text 占用中\n\t\t\t\t\t\t\t\t\t69 level indicator Description: 电池电量, Value: 72\n\t\t\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t\t\t\t71 text 信号状态\n\t\t\t\t\t\t\t\t\t72 text 良好\n\t\t\t\t\t\t\t\t\t73 image\n\t\t\t\t\t\t\t\t\t74 text 搜星状态\n\t\t\t\t\t\t\t\t\t75 container\n\t\t\t\t\t\t\t\t\t\t76 text 32 颗\n\t\t\t\t\t\t\t\t\t77 container\n\t\t\t\t\t\t\t\t\t\t78 text 20.1 °C\n\t\t\t\t\t\t\t\t\t79 image\n\t\t\t\t\t\t\t\t\t80 text 环境温度\n\t\t\t\t\t\t\t\t\t81 container\n\t\t\t\t\t\t\t\t\t\t82 text 1.2 m/s\n\t\t\t\t\t\t\t\t\t83 image\n\t\t\t\t\t\t\t\t\t84 text 风速\n\t\t\t\t\t\t\t\t\t85 text 无雨\n\t\t\t\t\t\t\t\t\t86 image\n\t\t\t\t\t\t\t\t\t87 text 雨量\n\t\t\t\t\t\t\t88 container 03号无人机\n\t\t\t\t\t\t\t\t89 container 03号无人机的六项状态\n\t\t\t\t\t\t\t\t\t90 heading 03号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t91 text 03号无人机\n\t\t\t\t\t\t\t\t\t92 text 未连接\n\t\t\t\t\t\t\t\t\t93 container 电池电量未知\n\t\t\t\t\t\t\t\t\t94 image\n\t\t\t\t\t\t\t\t\t95 text 信号状态\n\t\t\t\t\t\t\t\t\t96 text —\n\t\t\t\t\t\t\t\t\t97 image\n\t\t\t\t\t\t\t\t\t98 text 搜星状态\n\t\t\t\t\t\t\t\t\t99 text —\n\t\t\t\t\t\t\t\t\t100 text —\n\t\t\t\t\t\t\t\t\t101 image\n\t\t\t\t\t\t\t\t\t102 text 环境温度\n\t\t\t\t\t\t\t\t\t103 text —\n\t\t\t\t\t\t\t\t\t104 image\n\t\t\t\t\t\t\t\t\t105 text 风速\n\t\t\t\t\t\t\t\t\t106 text —\n\t\t\t\t\t\t\t\t\t107 image\n\t\t\t\t\t\t\t\t\t108 text 雨量\n\t\t\t\t\t\t\t109 container 04号无人机\n\t\t\t\t\t\t\t\t110 container 04号无人机的六项状态\n\t\t\t\t\t\t\t\t\t111 heading 04号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t112 text 04号无人机\n\t\t\t\t\t\t\t\t\t113 text 低电量\n\t\t\t\t\t\t\t\t\t114 level indicator Description: 电池电量, Value: 18\n\t\t\t\t\t\t\t\t\t115 image\n\t\t\t\t\t\t\t\t\t116 text 信号状态\n\t\t\t\t\t\t\t\t\t117 text 良好\n\t\t\t\t\t\t\t\t\t118 image\n\t\t\t\t\t\t\t\t\t119 text 搜星状态\n\t\t\t\t\t\t\t\t\t120 container\n\t\t\t\t\t\t\t\t\t\t121 text 34 颗\n\t\t\t\t\t\t\t\t\t122 container\n\t\t\t\t\t\t\t\t\t\t123 text 19.8 °C\n\t\t\t\t\t\t\t\t\t124 image\n\t\t\t\t\t\t\t\t\t125 text 环境温度\n\t\t\t\t\t\t\t\t\t126 container\n\t\t\t\t\t\t\t\t\t\t127 text 0.6 m/s\n\t\t\t\t\t\t\t\t\t128 image\n\t\t\t\t\t\t\t\t\t129 text 风速\n\t\t\t\t\t\t\t\t\t130 text 无雨\n\t\t\t\t\t\t\t\t\t131 image\n\t\t\t\t\t\t\t\t\t132 text 雨量\n\t\t\t\t\t\t\t133 container 05号无人机\n\t\t\t\t\t\t\t\t134 container 05号无人机的六项状态\n\t\t\t\t\t\t\t\t\t135 heading 05号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t136 text 05号无人机\n\t\t\t\t\t\t\t\t\t137 text 空闲\n\t\t\t\t\t\t\t\t\t138 level indicator Description: 电池电量, Value: 88\n\t\t\t\t\t\t\t\t\t139 image\n\t\t\t\t\t\t\t\t\t140 text 信号状态\n\t\t\t\t\t\t\t\t\t141 text 良好\n\t\t\t\t\t\t\t\t\t142 image\n\t\t\t\t\t\t\t\t\t143 text 搜星状态\n\t\t\t\t\t\t\t\t\t144 container\n\t\t\t\t\t\t\t\t\t\t145 text 35 颗\n\t\t\t\t\t\t\t\t\t146 container\n\t\t\t\t\t\t\t\t\t\t147 text 20.3 °C\n\t\t\t\t\t\t\t\t\t148 image\n\t\t\t\t\t\t\t\t\t149 text 环境温度\n\t\t\t\t\t\t\t\t\t150 container\n\t\t\t\t\t\t\t\t\t\t151 text 0.8 m/s\n\t\t\t\t\t\t\t\t\t152 image\n\t\t\t\t\t\t\t\t\t153 text 风速\n\t\t\t\t\t\t\t\t\t154 text 无雨\n\t\t\t\t\t\t\t\t\t155 image\n\t\t\t\t\t\t\t\t\t156 text 雨量\n\t\t\t\t\t\t\t157 container 06号无人机\n\t\t\t\t\t\t\t\t158 container 06号无人机的六项状态\n\t\t\t\t\t\t\t\t\t159 heading 06号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t160 text 06号无人机\n\t\t\t\t\t\t\t\t\t161 text 无信号\n\t\t\t\t\t\t\t\t\t162 container 电池电量未知\n\t\t\t\t\t\t\t\t\t163 image\n\t\t\t\t\t\t\t\t\t164 text 信号状态\n\t\t\t\t\t\t\t\t\t165 text 无信号\n\t\t\t\t\t\t\t\t\t166 image\n\t\t\t\t\t\t\t\t\t167 text 搜星状态\n\t\t\t\t\t\t\t\t\t168 text —\n\t\t\t\t\t\t\t\t\t169 text —\n\t\t\t\t\t\t\t\t\t170 image\n\t\t\t\t\t\t\t\t\t171 text 环境温度\n\t\t\t\t\t\t\t\t\t172 text —\n\t\t\t\t\t\t\t\t\t173 image\n\t\t\t\t\t\t\t\t\t174 text 风速\n\t\t\t\t\t\t\t\t\t175 text —\n\t\t\t\t\t\t\t\t\t176 image\n\t\t\t\t\t\t\t\t\t177 text 雨量\n\t\t\t\t\t\t178 container 当前无人机\n\t\t\t\t\t\t\t179 button 查看01号无人机\n\t\t\t\t\t\t\t180 button 查看02号无人机\n\t\t\t\t\t\t\t181 button 查看03号无人机\n\t\t\t\t\t\t\t182 button 查看04号无人机\n\t\t\t\t\t\t\t183 button 查看05号无人机\n\t\t\t\t\t\t\t184 button 查看06号无人机\n\t\t\t\t\t185 heading 我的拍摄订单 7, Value: 2\n\t\t\t\t\t\t186 text 我的拍摄订单 7\n\t\t\t\t\t187 button 查看全部\n\t\t\t\t\t\t188 text 查看全部\n\t\t\t\t\t\t189 image\n\t\t\t\t\t190 container\n\t\t\t\t\t\t191 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t192 text 游客 158****8888\n\t\t\t\t\t\t193 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 · 剩余 2 次\n\t\t\t\t\t\t194 button 继续拍摄\n\t\t\t\t\t\t195 image\n\t\t\t\t\t\t196 text 素材 上传中\n\t\t\t\t\t\t197 button 查看素材\n\t\t\t\t\t\t\t198 text 查看素材\n\t\t\t\t\t\t\t199 image\n\t\t\t\t\t200 container\n\t\t\t\t\t\t201 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t202 text 游客 139****5192\n\t\t\t\t\t\t203 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 · 剩余 3 次\n\t\t\t\t\t\t204 button 继续拍摄\n\t\t\t\t\t\t205 image\n\t\t\t\t\t\t206 text 素材 上传失败\n\t\t\t\t\t\t207 button 查看素材\n\t\t\t\t\t\t\t208 text 查看素材\n\t\t\t\t\t\t\t209 image\n\t\t\t\t\t210 container\n\t\t\t\t\t\t211 heading 游客135****3092, Value: 2\n\t\t\t\t\t\t\t212 text 游客 135****3092\n\t\t\t\t\t\t213 text 待拍摄 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 · 剩余 5 次\n\t\t\t\t\t\t214 button 开始拍摄\n\t\t\t\t\t215 heading 今日数据, Value: 2\n\t\t\t\t\t\t216 text 今日数据\n\t\t\t\t\t217 text 12\n\t\t\t\t\t218 text 成交订单\n\t\t\t\t\t219 text ¥1,896\n\t\t\t\t\t220 text 成交金额\n\t\t\t\t\t221 text 9\n\t\t\t\t\t222 text 完成拍摄\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "67-套餐收款页", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:33\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t33 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t34 container\n\t\t\t\t\t35 container 收款二维码\n\t\t\t\t\t\t36 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t37 text 嵩山少林景区\n\t\t\t\t\t\t38 button 选择航拍套餐\n\t\t\t\t\t\t\t39 text 航拍套餐\n\t\t\t\t\t\t\t40 text 请选择\n\t\t\t\t\t\t\t41 image\n\t\t\t\t\t\t42 container\n\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 text 请选择航拍套餐 选择后生成对应套餐收款码\n\t\t\t\t\t\t45 text HTML 交互演示 · 不进行真实收款\n\t\t\t\t\t\t46 button (disabled) 设置金额\n\t\t\t\t\t\t47 button (disabled) 保存二维码\n\t\t\t\t\t48 container 收款信息\n\t\t\t\t\t\t49 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t50 button 收款记录\n\t\t\t\t\t\t51 text 收款记录\n\t\t\t\t\t\t52 image\n\t\t\t\t\t53 text 收款到账语音提醒\n\t\t\t\t\t54 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t55 heading 线下收款, Value: 3\n\t\t\t\t\t\t56 text 线下收款\n\t\t\t\t\t57 text 线下收款登记\n\t\t\t\t\t58 text 原有功能,本次演示不调整\n\t\t\t\t\t59 button 去登记\n\t\t\t32 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "68-套餐选择", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 container 收款二维码\n\t\t\t3 container\n\t\t\t\t4 image\n\t\t\t\t5 text 请选择航拍套餐 选择后生成对应套餐收款码\n\t\t6 container 选择航拍套餐, ID: radix-_r_42_\n\t\t\t7 heading 选择航拍套餐, Value: 2, ID: radix-_r_43_\n\t\t\t\t8 text 选择航拍套餐\n\t\t\t9 text 嵩山少林景区\n\t\t\t10 container\n\t\t\t\t11 当前项目套餐\n\t\t\t\t\t12 radio button 单次航拍 含 1 次拍摄 ¥99, Value: 0\n\t\t\t\t\t\t13 text 单次航拍\n\t\t\t\t\t\t14 container\n\t\t\t\t\t\t\t15 text 含 1 次拍摄\n\t\t\t\t\t\t16 container\n\t\t\t\t\t\t\t17 text ¥ 99\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 radio button 三次航拍套餐 含 3 次拍摄 ¥259, Value: 0\n\t\t\t\t\t\t20 text 三次航拍套餐\n\t\t\t\t\t\t21 container\n\t\t\t\t\t\t\t22 text 含 3 次拍摄\n\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t24 text ¥ 259\n\t\t\t\t\t\t25 image\n\t\t\t\t\t26 radio button 五次航拍套餐 含 5 次拍摄 ¥399, Value: 0\n\t\t\t\t\t\t27 text 五次航拍套餐\n\t\t\t\t\t\t28 container\n\t\t\t\t\t\t\t29 text 含 5 次拍摄\n\t\t\t\t\t\t30 container\n\t\t\t\t\t\t\t31 text ¥ 399\n\t\t\t\t\t\t32 image\n\t\t\t\t33 text 选择套餐后可通过「设置金额」调整成交价,拍摄次数不变。\n\t\t\t\t34 button 取消\n\t\t\t\t35 button (disabled) 确认套餐\n\nThe focused UI element is 12 radio button 单次航拍 含 1 次拍摄 ¥99, Value: 0" + }, + { + "name": "69-三次套餐选择", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 container 收款二维码\n\t\t\t3 container\n\t\t\t\t4 image\n\t\t\t\t5 text 请选择航拍套餐 选择后生成对应套餐收款码\n\t\t6 container 选择航拍套餐, ID: radix-_r_42_\n\t\t\t7 heading 选择航拍套餐, Value: 2, ID: radix-_r_43_\n\t\t\t\t8 text 选择航拍套餐\n\t\t\t9 text 嵩山少林景区\n\t\t\t10 container\n\t\t\t\t11 当前项目套餐\n\t\t\t\t\t12 radio button 单次航拍 含 1 次拍摄 ¥99, Value: 0\n\t\t\t\t\t\t13 text 单次航拍\n\t\t\t\t\t\t14 container\n\t\t\t\t\t\t\t15 text 含 1 次拍摄\n\t\t\t\t\t\t16 container\n\t\t\t\t\t\t\t17 text ¥ 99\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 radio button 三次航拍套餐 含 3 次拍摄 ¥259, Value: 1\n\t\t\t\t\t\t20 text 三次航拍套餐\n\t\t\t\t\t\t21 container\n\t\t\t\t\t\t\t22 text 含 3 次拍摄\n\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t24 text ¥ 259\n\t\t\t\t\t\t36 image\n\t\t\t\t\t26 radio button 五次航拍套餐 含 5 次拍摄 ¥399, Value: 0\n\t\t\t\t\t\t27 text 五次航拍套餐\n\t\t\t\t\t\t28 container\n\t\t\t\t\t\t\t29 text 含 5 次拍摄\n\t\t\t\t\t\t30 container\n\t\t\t\t\t\t\t31 text ¥ 399\n\t\t\t\t\t\t32 image\n\t\t\t\t33 text 选择套餐后可通过「设置金额」调整成交价,拍摄次数不变。\n\t\t\t\t34 button 取消\n\t\t\t\t35 button 确认套餐\n\nThe focused UI element is 19 radio button 三次航拍套餐 含 3 次拍摄 ¥259, Value: 1" + }, + { + "name": "70-生成套餐码", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:34\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 container 收款二维码\n\t\t\t\t\t\t18 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t19 text 嵩山少林景区\n\t\t\t\t\t\t20 button 更换套餐,当前三次航拍套餐\n\t\t\t\t\t\t\t21 text 航拍套餐\n\t\t\t\t\t\t\t22 text 三次航拍套餐\n\t\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t\t24 text 含 3 次拍摄\n\t\t\t\t\t\t\t25 image\n\t\t\t\t\t\t26 container\n\t\t\t\t\t\t\t27 text 本次收款 ¥ 259.00\n\t\t\t\t\t\t28 container\n\t\t\t\t\t\t\t29 image\n\t\t\t\t\t\t\t30 text 正在生成收款码…\n\t\t\t\t\t\t31 text HTML 交互演示 · 不进行真实收款\n\t\t\t\t\t\t32 button (disabled) 设置金额\n\t\t\t\t\t\t33 button (disabled) 保存二维码\n\t\t\t\t\t34 container 收款信息\n\t\t\t\t\t\t35 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t36 button 收款记录\n\t\t\t\t\t\t37 text 收款记录\n\t\t\t\t\t\t38 image\n\t\t\t\t\t39 text 收款到账语音提醒\n\t\t\t\t\t40 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t41 heading 线下收款, Value: 3\n\t\t\t\t\t\t42 text 线下收款\n\t\t\t\t\t43 text 线下收款登记\n\t\t\t\t\t44 text 原有功能,本次演示不调整\n\t\t\t\t\t45 button 去登记\n\t\t\t46 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "71-收款码就绪", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:35\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 container 收款二维码\n\t\t\t\t\t\t18 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t19 text 嵩山少林景区\n\t\t\t\t\t\t20 button 更换套餐,当前三次航拍套餐\n\t\t\t\t\t\t\t21 text 航拍套餐\n\t\t\t\t\t\t\t22 text 三次航拍套餐\n\t\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t\t24 text 含 3 次拍摄\n\t\t\t\t\t\t\t25 image\n\t\t\t\t\t\t26 container\n\t\t\t\t\t\t\t27 text 本次收款 ¥ 259.00\n\t\t\t\t\t\t47 image 演示收款二维码,不可支付\n\t\t\t\t\t\t31 text 演示码 · 不可支付\n\t\t\t\t\t\t48 button 体验游客扫码支付\n\t\t\t\t\t\t32 button 设置金额\n\t\t\t\t\t\t33 button 保存二维码\n\t\t\t\t\t\t49 text 等待游客支付\n\t\t\t\t\t\t50 button 刷新状态\n\t\t\t\t\t34 container 收款信息\n\t\t\t\t\t\t35 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t36 button 收款记录\n\t\t\t\t\t\t37 text 收款记录\n\t\t\t\t\t\t38 image\n\t\t\t\t\t39 text 收款到账语音提醒\n\t\t\t\t\t40 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t41 heading 线下收款, Value: 3\n\t\t\t\t\t\t42 text 线下收款\n\t\t\t\t\t43 text 线下收款登记\n\t\t\t\t\t44 text 原有功能,本次演示不调整\n\t\t\t\t\t45 button 去登记\n\t\t\t46 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "72-修改成交价", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 container 收款金额, ID: radix-_r_46_\n\t\t\t3 heading 收款金额, Value: 2, ID: radix-_r_47_\n\t\t\t\t4 text 收款金额\n\t\t\t5 text 仅修改本次成交价,不改变套餐拍摄次数\n\t\t\t6 container\n\t\t\t\t7 text ¥\n\t\t\t\t8 text field (settable) Description: 收款金额, Value: 259.00\n\t\t\t9 container\n\t\t\t\t10 text 备注(选填)\n\t\t\t\t11 text entry area (settable) 收款备注\n\t\t\t12 container\n\t\t\t\t13 text 0 /200\n\t\t\t14 button 取消\n\t\t\t15 button 确定\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "73-收款异常菜单", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 container 收款二维码\n\t\t\t3 image 演示收款二维码,不可支付\n\t\t4 container 体验本页状态, ID: radix-_r_3c_\n\t\t\t5 heading 体验本页状态, Value: 2, ID: radix-_r_3d_\n\t\t\t\t6 text 体验本页状态\n\t\t\t7 text 只切换当前页面。正常操作会自动推进,无需额外控制。\n\t\t\t8 container\n\t\t\t\t9 button 未选择套餐\n\t\t\t\t\t10 text 未选择套餐\n\t\t\t\t\t11 image\n\t\t\t\t12 button 收款码生成中\n\t\t\t\t\t13 text 收款码生成中\n\t\t\t\t\t14 image\n\t\t\t\t15 button 等待游客支付\n\t\t\t\t\t16 text 等待游客支付\n\t\t\t\t\t17 image\n\t\t\t\t18 button 收款成功\n\t\t\t\t\t19 text 收款成功\n\t\t\t\t\t20 image\n\t\t\t\t21 button 收款码生成失败\n\t\t\t\t\t22 text 收款码生成失败\n\t\t\t\t\t23 image\n\t\t\t\t24 button 收款码已失效\n\t\t\t\t\t25 text 收款码已失效\n\t\t\t\t\t26 image\n\t\t\t\t27 button 暂无可售套餐\n\t\t\t\t\t28 text 暂无可售套餐\n\t\t\t\t\t29 image\n\t\t\t\t30 text 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。\n\t\t\t\t31 button 恢复正常体验\n\t\t\t\t32 button 从头体验整个流程\n\nThe focused UI element is 9 button 未选择套餐" + }, + { + "name": "74-待支付", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:35\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 container 收款二维码\n\t\t\t\t\t\t18 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t19 text 嵩山少林景区\n\t\t\t\t\t\t20 button 更换套餐,当前五次航拍套餐\n\t\t\t\t\t\t\t21 text 航拍套餐\n\t\t\t\t\t\t\t22 text 五次航拍套餐\n\t\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t\t24 text 含 5 次拍摄\n\t\t\t\t\t\t\t25 image\n\t\t\t\t\t\t26 container\n\t\t\t\t\t\t\t27 text 本次收款 ¥ 399.00\n\t\t\t\t\t\t28 image 演示收款二维码,不可支付\n\t\t\t\t\t\t29 text 演示码 · 不可支付\n\t\t\t\t\t\t30 button 体验游客扫码支付\n\t\t\t\t\t\t31 button 设置金额\n\t\t\t\t\t\t32 button 保存二维码\n\t\t\t\t\t\t33 text 等待游客支付\n\t\t\t\t\t\t34 button 刷新状态\n\t\t\t\t\t35 container 收款信息\n\t\t\t\t\t\t36 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t37 button 收款记录\n\t\t\t\t\t\t38 text 收款记录\n\t\t\t\t\t\t39 image\n\t\t\t\t\t40 text 收款到账语音提醒\n\t\t\t\t\t41 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t42 heading 线下收款, Value: 3\n\t\t\t\t\t\t43 text 线下收款\n\t\t\t\t\t44 text 线下收款登记\n\t\t\t\t\t45 text 原有功能,本次演示不调整\n\t\t\t\t\t46 button 去登记\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "75-演示扫码支付", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:35\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 container 收款二维码\n\t\t\t\t\t\t18 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t19 text 嵩山少林景区\n\t\t\t\t\t\t20 button 更换套餐,当前五次航拍套餐\n\t\t\t\t\t\t\t21 text 航拍套餐\n\t\t\t\t\t\t\t22 text 五次航拍套餐\n\t\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t\t24 text 含 5 次拍摄\n\t\t\t\t\t\t\t25 image\n\t\t\t\t\t\t26 container\n\t\t\t\t\t\t\t27 text 本次收款 ¥ 399.00\n\t\t\t\t\t\t28 image 演示收款二维码,不可支付\n\t\t\t\t\t\t29 text 演示码 · 不可支付\n\t\t\t\t\t\t30 button (disabled) 正在体验支付…\n\t\t\t\t\t\t\t48 image\n\t\t\t\t\t\t\t49 text 正在体验支付…\n\t\t\t\t\t\t31 button 设置金额\n\t\t\t\t\t\t32 button 保存二维码\n\t\t\t\t\t\t33 text 等待游客支付\n\t\t\t\t\t\t34 button 刷新状态\n\t\t\t\t\t35 container 收款信息\n\t\t\t\t\t\t36 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t37 button 收款记录\n\t\t\t\t\t\t38 text 收款记录\n\t\t\t\t\t\t39 image\n\t\t\t\t\t40 text 收款到账语音提醒\n\t\t\t\t\t41 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t42 heading 线下收款, Value: 3\n\t\t\t\t\t\t43 text 线下收款\n\t\t\t\t\t44 text 线下收款登记\n\t\t\t\t\t45 text 原有功能,本次演示不调整\n\t\t\t\t\t46 button 去登记\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "76-支付成功页面", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:36\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 container 收款二维码\n\t\t\t\t\t\t18 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t19 text 嵩山少林景区\n\t\t\t\t\t\t20 button (disabled) 更换套餐,当前五次航拍套餐\n\t\t\t\t\t\t\t21 text 航拍套餐\n\t\t\t\t\t\t\t22 text 五次航拍套餐\n\t\t\t\t\t\t\t23 container\n\t\t\t\t\t\t\t\t24 text 含 5 次拍摄\n\t\t\t\t\t\t26 container\n\t\t\t\t\t\t\t27 text 本次收款 ¥ 399.00\n\t\t\t\t\t\t48 container\n\t\t\t\t\t\t\t49 image\n\t\t\t\t\t\t\t50 heading 收款成功, Value: 3\n\t\t\t\t\t\t\t\t51 text 收款成功\n\t\t\t\t\t\t\t52 text 订单已归属 吴家俊 游客 158****2026\n\t\t\t\t\t\t29 text 演示支付结果,未发生真实交易\n\t\t\t\t\t\t53 button 继续收款\n\t\t\t\t\t\t54 button 查看订单\n\t\t\t\t\t35 container 收款信息\n\t\t\t\t\t\t36 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t37 button 收款记录\n\t\t\t\t\t\t38 text 收款记录\n\t\t\t\t\t\t39 image\n\t\t\t\t\t40 text 收款到账语音提醒\n\t\t\t\t\t41 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t42 heading 线下收款, Value: 3\n\t\t\t\t\t\t43 text 线下收款\n\t\t\t\t\t44 text 线下收款登记\n\t\t\t\t\t45 text 原有功能,本次演示不调整\n\t\t\t\t\t46 button 去登记\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "77-支付后实际进入全部Tab", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:36\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 我的拍摄订单, Value: 1\n\t\t\t\t\t\t11 text 我的拍摄订单\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t48 container\n\t\t\t\t\t49 text 分配给我的全部订单,含已完成订单\n\t\t\t\t\t50 container 订单状态\n\t\t\t\t\t\t51 checkbox 全部, Value: 1\n\t\t\t\t\t\t52 checkbox 待拍摄, Value: 0\n\t\t\t\t\t\t53 checkbox 进行中, Value: 0\n\t\t\t\t\t\t54 checkbox 已完成, Value: 0\n\t\t\t\t\t55 heading 全部订单 13, Value: 2\n\t\t\t\t\t\t56 text 全部订单 13\n\t\t\t\t\t57 container\n\t\t\t\t\t\t58 heading 游客158****2026, Value: 2\n\t\t\t\t\t\t\t59 text 游客 158****2026\n\t\t\t\t\t\t60 text 待拍摄 DEMO-R-1792996553047 · 10/26 14:35 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t61 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t62 button 交付成片\n\t\t\t\t\t\t63 button 开始拍摄\n\t\t\t\t\t64 container\n\t\t\t\t\t\t65 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t66 text 游客 158****8888\n\t\t\t\t\t\t67 text 进行中 HT202610200001 · 10-20 14:32 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 剩余 2 次\n\t\t\t\t\t\t68 progress indicator Description: 已拍摄 3 次,共 5 次, Value: 3\n\t\t\t\t\t\t69 button 查看素材 上传中\n\t\t\t\t\t\t\t70 text 查看素材\n\t\t\t\t\t\t\t71 image\n\t\t\t\t\t\t\t72 text 上传中\n\t\t\t\t\t\t73 button 交付成片\n\t\t\t\t\t\t74 button 继续拍摄\n\t\t\t\t\t75 container\n\t\t\t\t\t\t76 heading 游客136****2806, Value: 2\n\t\t\t\t\t\t\t77 text 游客 136****2806\n\t\t\t\t\t\t78 text 拍摄完成 HT202610200002 · 10-20 14:18 单次航拍 · 含 1 次拍摄 已拍摄 1 / 1 次 剩余 0 次\n\t\t\t\t\t\t79 progress indicator Description: 已拍摄 1 次,共 1 次, Value: 1\n\t\t\t\t\t\t80 text 拍摄素材 上传完成\n\t\t\t\t\t\t81 button 查看记录 游客已确认收货 2026/10/26 14:33:02\n\t\t\t\t\t\t\t82 text 查看记录\n\t\t\t\t\t\t\t83 image\n\t\t\t\t\t\t\t84 text 游客已确认收货\n\t\t\t\t\t\t\t85 text 2026/10/26 14:33:02\n\t\t\t\t\t\t86 button 查看素材\n\t\t\t\t\t\t87 button 交付成片\n\t\t\t\t\t88 container\n\t\t\t\t\t\t89 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t90 text 游客 139****5192\n\t\t\t\t\t\t91 text 进行中 HT202610200003 · 10-20 13:46 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 剩余 3 次\n\t\t\t\t\t\t92 progress indicator Description: 已拍摄 2 次,共 5 次, Value: 2\n\t\t\t\t\t\t93 button 查看素材 上传失败\n\t\t\t\t\t\t\t94 text 查看素材\n\t\t\t\t\t\t\t95 image\n\t\t\t\t\t\t\t96 text 上传失败\n\t\t\t\t\t\t97 button 交付成片\n\t\t\t\t\t\t98 button 继续拍摄\n\t\t\t\t\t99 container\n\t\t\t\t\t\t100 heading 游客137****6628, Value: 2\n\t\t\t\t\t\t\t101 text 游客 137****6628\n\t\t\t\t\t\t102 text 拍摄完成 HT202610190012 · 10-19 16:18 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t103 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t104 text 拍摄素材 上传完成\n\t\t\t\t\t\t105 button 查看素材\n\t\t\t\t\t\t106 button 交付成片\n\t\t\t\t\t107 container\n\t\t\t\t\t\t108 heading 游客135****3092, Value: 2\n\t\t\t\t\t\t\t109 text 游客 135****3092\n\t\t\t\t\t\t110 text 待拍摄 HT202610200005 · 10-20 12:15 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t111 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t112 button 交付成片\n\t\t\t\t\t\t113 button 开始拍摄\n\t\t\t\t\t114 container\n\t\t\t\t\t\t115 heading 游客159****7206, Value: 2\n\t\t\t\t\t\t\t116 text 游客 159****7206\n\t\t\t\t\t\t117 text 进行中 HT202610200006 · 10-20 11:15 航拍套餐 · 含 5 次拍摄 已拍摄 1 / 5 次 剩余 4 次\n\t\t\t\t\t\t118 progress indicator Description: 已拍摄 1 次,共 5 次, Value: 1\n\t\t\t\t\t\t119 button 查看素材 上传完成\n\t\t\t\t\t\t\t120 text 查看素材\n\t\t\t\t\t\t\t121 image\n\t\t\t\t\t\t\t122 text 上传完成\n\t\t\t\t\t\t123 button 交付成片\n\t\t\t\t\t\t124 button 继续拍摄\n\t\t\t\t\t125 container\n\t\t\t\t\t\t126 heading 游客138****0638, Value: 2\n\t\t\t\t\t\t\t127 text 游客 138****0638\n\t\t\t\t\t\t128 text 待拍摄 HT202610200007 · 10-20 10:15 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t129 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t130 button 交付成片\n\t\t\t\t\t\t131 button 开始拍摄\n\t\t\t\t\t132 container\n\t\t\t\t\t\t133 heading 游客186****9357, Value: 2\n\t\t\t\t\t\t\t134 text 游客 186****9357\n\t\t\t\t\t\t135 text 进行中 HT202610200008 · 10-20 9:15 航拍套餐 · 含 5 次拍摄 已拍摄 1 / 5 次 剩余 4 次\n\t\t\t\t\t\t136 progress indicator Description: 已拍摄 1 次,共 5 次, Value: 1\n\t\t\t\t\t\t137 button 查看素材 上传完成\n\t\t\t\t\t\t\t138 text 查看素材\n\t\t\t\t\t\t\t139 image\n\t\t\t\t\t\t\t140 text 上传完成\n\t\t\t\t\t\t141 button 交付成片\n\t\t\t\t\t\t142 button 继续拍摄\n\t\t\t\t\t143 container\n\t\t\t\t\t\t144 heading 游客151****8602, Value: 2\n\t\t\t\t\t\t\t145 text 游客 151****8602\n\t\t\t\t\t\t146 text 待拍摄 HT202610200009 · 10-20 8:15 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 剩余 5 次\n\t\t\t\t\t\t147 progress indicator Description: 已拍摄 0 次,共 5 次, Value: 0\n\t\t\t\t\t\t148 button 交付成片\n\t\t\t\t\t\t149 button 开始拍摄\n\t\t\t\t\t150 container\n\t\t\t\t\t\t151 heading 游客180****4075, Value: 2\n\t\t\t\t\t\t\t152 text 游客 180****4075\n\t\t\t\t\t\t153 text 拍摄完成 HT202610200010 · 10-20 7:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t154 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t155 text 拍摄素材 上传完成\n\t\t\t\t\t\t156 button 查看素材\n\t\t\t\t\t\t157 button 交付成片\n\t\t\t\t\t158 container\n\t\t\t\t\t\t159 heading 游客185****5736, Value: 2\n\t\t\t\t\t\t\t160 text 游客 185****5736\n\t\t\t\t\t\t161 text 拍摄完成 HT202610200011 · 10-20 6:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t162 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t163 text 拍摄素材 上传完成\n\t\t\t\t\t\t164 button 查看素材\n\t\t\t\t\t\t165 button 交付成片\n\t\t\t\t\t166 container\n\t\t\t\t\t\t167 heading 游客188****3160, Value: 2\n\t\t\t\t\t\t\t168 text 游客 188****3160\n\t\t\t\t\t\t169 text 拍摄完成 HT202610200012 · 10-20 5:15 航拍套餐 · 含 5 次拍摄 已拍摄 5 / 5 次 剩余 0 次\n\t\t\t\t\t\t170 progress indicator Description: 已拍摄 5 次,共 5 次, Value: 5\n\t\t\t\t\t\t171 text 拍摄素材 上传完成\n\t\t\t\t\t\t172 button 查看素材\n\t\t\t\t\t\t173 button 交付成片\n\t\t\t\t\t174 text 已显示全部 13 个订单\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "78-从订单返回", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:36\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 收款详情, Value: 1\n\t\t\t\t\t\t11 text 收款详情\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t48 container\n\t\t\t\t\t49 container 收款二维码\n\t\t\t\t\t\t50 heading 嵩山少林景区, Value: 2\n\t\t\t\t\t\t\t51 text 嵩山少林景区\n\t\t\t\t\t\t52 button (disabled) 更换套餐,当前五次航拍套餐\n\t\t\t\t\t\t\t53 text 航拍套餐\n\t\t\t\t\t\t\t54 text 五次航拍套餐\n\t\t\t\t\t\t\t55 container\n\t\t\t\t\t\t\t\t56 text 含 5 次拍摄\n\t\t\t\t\t\t57 container\n\t\t\t\t\t\t\t58 text 本次收款 ¥ 399.00\n\t\t\t\t\t\t59 container\n\t\t\t\t\t\t\t60 image\n\t\t\t\t\t\t\t61 heading 收款成功, Value: 3\n\t\t\t\t\t\t\t\t62 text 收款成功\n\t\t\t\t\t\t\t63 text 订单已归属 吴家俊 游客 158****2026\n\t\t\t\t\t\t64 text 演示支付结果,未发生真实交易\n\t\t\t\t\t\t65 button 继续收款\n\t\t\t\t\t\t66 button 查看订单\n\t\t\t\t\t67 container 收款信息\n\t\t\t\t\t\t68 text 景区名称 嵩山少林景区 收款方 示例景区运营商 员工 ID 700\n\t\t\t\t\t69 button 收款记录\n\t\t\t\t\t\t70 text 收款记录\n\t\t\t\t\t\t71 image\n\t\t\t\t\t72 text 收款到账语音提醒\n\t\t\t\t\t73 switch Description: 收款到账语音提醒, Value: 0\n\t\t\t\t\t74 heading 线下收款, Value: 3\n\t\t\t\t\t\t75 text 线下收款\n\t\t\t\t\t76 text 线下收款登记\n\t\t\t\t\t77 text 原有功能,本次演示不调整\n\t\t\t\t\t78 button 去登记\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "79-收款返回首页", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:37\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 景区空镜库\n\t\t\t\t\t10 heading 机巢工作台, Value: 1\n\t\t\t\t\t\t11 text 机巢工作台\n\t\t\t\t\t48 button 收款码\n\t\t\t\t\t\t49 image\n\t\t\t\t\t\t50 text 收款码\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t51 container\n\t\t\t\t\t52 text 嵩山少林景区 · 吴家俊\n\t\t\t\t\t53 container 无人机设备状态\n\t\t\t\t\t\t54 container 左右滑动查看无人机\n\t\t\t\t\t\t\t55 container 01号无人机\n\t\t\t\t\t\t\t\t56 container 01号无人机的六项状态\n\t\t\t\t\t\t\t\t\t57 heading 01号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t58 text 01号无人机\n\t\t\t\t\t\t\t\t\t59 text 空闲\n\t\t\t\t\t\t\t\t\t60 level indicator Description: 电池电量, Value: 95\n\t\t\t\t\t\t\t\t\t61 image\n\t\t\t\t\t\t\t\t\t62 text 信号状态\n\t\t\t\t\t\t\t\t\t63 text 良好\n\t\t\t\t\t\t\t\t\t64 image\n\t\t\t\t\t\t\t\t\t65 text 搜星状态\n\t\t\t\t\t\t\t\t\t66 container\n\t\t\t\t\t\t\t\t\t\t67 text 36 颗\n\t\t\t\t\t\t\t\t\t68 container\n\t\t\t\t\t\t\t\t\t\t69 text 19.3 °C\n\t\t\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t\t\t\t71 text 环境温度\n\t\t\t\t\t\t\t\t\t72 container\n\t\t\t\t\t\t\t\t\t\t73 text 0 m/s\n\t\t\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t\t\t\t75 text 风速\n\t\t\t\t\t\t\t\t\t76 text 无雨\n\t\t\t\t\t\t\t\t\t77 image\n\t\t\t\t\t\t\t\t\t78 text 雨量\n\t\t\t\t\t\t\t79 container 02号无人机\n\t\t\t\t\t\t\t\t80 container 02号无人机的六项状态\n\t\t\t\t\t\t\t\t\t81 heading 02号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t82 text 02号无人机\n\t\t\t\t\t\t\t\t\t83 text 占用中\n\t\t\t\t\t\t\t\t\t84 level indicator Description: 电池电量, Value: 72\n\t\t\t\t\t\t\t\t\t85 image\n\t\t\t\t\t\t\t\t\t86 text 信号状态\n\t\t\t\t\t\t\t\t\t87 text 良好\n\t\t\t\t\t\t\t\t\t88 image\n\t\t\t\t\t\t\t\t\t89 text 搜星状态\n\t\t\t\t\t\t\t\t\t90 container\n\t\t\t\t\t\t\t\t\t\t91 text 32 颗\n\t\t\t\t\t\t\t\t\t92 container\n\t\t\t\t\t\t\t\t\t\t93 text 20.1 °C\n\t\t\t\t\t\t\t\t\t94 image\n\t\t\t\t\t\t\t\t\t95 text 环境温度\n\t\t\t\t\t\t\t\t\t96 container\n\t\t\t\t\t\t\t\t\t\t97 text 1.2 m/s\n\t\t\t\t\t\t\t\t\t98 image\n\t\t\t\t\t\t\t\t\t99 text 风速\n\t\t\t\t\t\t\t\t\t100 text 无雨\n\t\t\t\t\t\t\t\t\t101 image\n\t\t\t\t\t\t\t\t\t102 text 雨量\n\t\t\t\t\t\t\t103 container 03号无人机\n\t\t\t\t\t\t\t\t104 container 03号无人机的六项状态\n\t\t\t\t\t\t\t\t\t105 heading 03号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t106 text 03号无人机\n\t\t\t\t\t\t\t\t\t107 text 未连接\n\t\t\t\t\t\t\t\t\t108 container 电池电量未知\n\t\t\t\t\t\t\t\t\t109 image\n\t\t\t\t\t\t\t\t\t110 text 信号状态\n\t\t\t\t\t\t\t\t\t111 text —\n\t\t\t\t\t\t\t\t\t112 image\n\t\t\t\t\t\t\t\t\t113 text 搜星状态\n\t\t\t\t\t\t\t\t\t114 text —\n\t\t\t\t\t\t\t\t\t115 text —\n\t\t\t\t\t\t\t\t\t116 image\n\t\t\t\t\t\t\t\t\t117 text 环境温度\n\t\t\t\t\t\t\t\t\t118 text —\n\t\t\t\t\t\t\t\t\t119 image\n\t\t\t\t\t\t\t\t\t120 text 风速\n\t\t\t\t\t\t\t\t\t121 text —\n\t\t\t\t\t\t\t\t\t122 image\n\t\t\t\t\t\t\t\t\t123 text 雨量\n\t\t\t\t\t\t\t124 container 04号无人机\n\t\t\t\t\t\t\t\t125 container 04号无人机的六项状态\n\t\t\t\t\t\t\t\t\t126 heading 04号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t127 text 04号无人机\n\t\t\t\t\t\t\t\t\t128 text 低电量\n\t\t\t\t\t\t\t\t\t129 level indicator Description: 电池电量, Value: 18\n\t\t\t\t\t\t\t\t\t130 image\n\t\t\t\t\t\t\t\t\t131 text 信号状态\n\t\t\t\t\t\t\t\t\t132 text 良好\n\t\t\t\t\t\t\t\t\t133 image\n\t\t\t\t\t\t\t\t\t134 text 搜星状态\n\t\t\t\t\t\t\t\t\t135 container\n\t\t\t\t\t\t\t\t\t\t136 text 34 颗\n\t\t\t\t\t\t\t\t\t137 container\n\t\t\t\t\t\t\t\t\t\t138 text 19.8 °C\n\t\t\t\t\t\t\t\t\t139 image\n\t\t\t\t\t\t\t\t\t140 text 环境温度\n\t\t\t\t\t\t\t\t\t141 container\n\t\t\t\t\t\t\t\t\t\t142 text 0.6 m/s\n\t\t\t\t\t\t\t\t\t143 image\n\t\t\t\t\t\t\t\t\t144 text 风速\n\t\t\t\t\t\t\t\t\t145 text 无雨\n\t\t\t\t\t\t\t\t\t146 image\n\t\t\t\t\t\t\t\t\t147 text 雨量\n\t\t\t\t\t\t\t148 container 05号无人机\n\t\t\t\t\t\t\t\t149 container 05号无人机的六项状态\n\t\t\t\t\t\t\t\t\t150 heading 05号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t151 text 05号无人机\n\t\t\t\t\t\t\t\t\t152 text 空闲\n\t\t\t\t\t\t\t\t\t153 level indicator Description: 电池电量, Value: 88\n\t\t\t\t\t\t\t\t\t154 image\n\t\t\t\t\t\t\t\t\t155 text 信号状态\n\t\t\t\t\t\t\t\t\t156 text 良好\n\t\t\t\t\t\t\t\t\t157 image\n\t\t\t\t\t\t\t\t\t158 text 搜星状态\n\t\t\t\t\t\t\t\t\t159 container\n\t\t\t\t\t\t\t\t\t\t160 text 35 颗\n\t\t\t\t\t\t\t\t\t161 container\n\t\t\t\t\t\t\t\t\t\t162 text 20.3 °C\n\t\t\t\t\t\t\t\t\t163 image\n\t\t\t\t\t\t\t\t\t164 text 环境温度\n\t\t\t\t\t\t\t\t\t165 container\n\t\t\t\t\t\t\t\t\t\t166 text 0.8 m/s\n\t\t\t\t\t\t\t\t\t167 image\n\t\t\t\t\t\t\t\t\t168 text 风速\n\t\t\t\t\t\t\t\t\t169 text 无雨\n\t\t\t\t\t\t\t\t\t170 image\n\t\t\t\t\t\t\t\t\t171 text 雨量\n\t\t\t\t\t\t\t172 container 06号无人机\n\t\t\t\t\t\t\t\t173 container 06号无人机的六项状态\n\t\t\t\t\t\t\t\t\t174 heading 06号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t175 text 06号无人机\n\t\t\t\t\t\t\t\t\t176 text 无信号\n\t\t\t\t\t\t\t\t\t177 container 电池电量未知\n\t\t\t\t\t\t\t\t\t178 image\n\t\t\t\t\t\t\t\t\t179 text 信号状态\n\t\t\t\t\t\t\t\t\t180 text 无信号\n\t\t\t\t\t\t\t\t\t181 image\n\t\t\t\t\t\t\t\t\t182 text 搜星状态\n\t\t\t\t\t\t\t\t\t183 text —\n\t\t\t\t\t\t\t\t\t184 text —\n\t\t\t\t\t\t\t\t\t185 image\n\t\t\t\t\t\t\t\t\t186 text 环境温度\n\t\t\t\t\t\t\t\t\t187 text —\n\t\t\t\t\t\t\t\t\t188 image\n\t\t\t\t\t\t\t\t\t189 text 风速\n\t\t\t\t\t\t\t\t\t190 text —\n\t\t\t\t\t\t\t\t\t191 image\n\t\t\t\t\t\t\t\t\t192 text 雨量\n\t\t\t\t\t\t193 container 当前无人机\n\t\t\t\t\t\t\t194 button 查看01号无人机\n\t\t\t\t\t\t\t195 button 查看02号无人机\n\t\t\t\t\t\t\t196 button 查看03号无人机\n\t\t\t\t\t\t\t197 button 查看04号无人机\n\t\t\t\t\t\t\t198 button 查看05号无人机\n\t\t\t\t\t\t\t199 button 查看06号无人机\n\t\t\t\t\t200 heading 我的拍摄订单 8, Value: 2\n\t\t\t\t\t\t201 text 我的拍摄订单 8\n\t\t\t\t\t202 button 查看全部\n\t\t\t\t\t\t203 text 查看全部\n\t\t\t\t\t\t204 image\n\t\t\t\t\t205 container\n\t\t\t\t\t\t206 heading 游客158****2026, Value: 2\n\t\t\t\t\t\t\t207 text 游客 158****2026\n\t\t\t\t\t\t208 text 待拍摄 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 · 剩余 5 次\n\t\t\t\t\t\t209 button 开始拍摄\n\t\t\t\t\t210 container\n\t\t\t\t\t\t211 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t212 text 游客 158****8888\n\t\t\t\t\t\t213 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 · 剩余 2 次\n\t\t\t\t\t\t214 button 继续拍摄\n\t\t\t\t\t\t215 image\n\t\t\t\t\t\t216 text 素材 上传中\n\t\t\t\t\t\t217 button 查看素材\n\t\t\t\t\t\t\t218 text 查看素材\n\t\t\t\t\t\t\t219 image\n\t\t\t\t\t220 container\n\t\t\t\t\t\t221 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t222 text 游客 139****5192\n\t\t\t\t\t\t223 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 · 剩余 3 次\n\t\t\t\t\t\t224 button 继续拍摄\n\t\t\t\t\t\t225 image\n\t\t\t\t\t\t226 text 素材 上传失败\n\t\t\t\t\t\t227 button 查看素材\n\t\t\t\t\t\t\t228 text 查看素材\n\t\t\t\t\t\t\t229 image\n\t\t\t\t\t230 heading 今日数据, Value: 2\n\t\t\t\t\t\t231 text 今日数据\n\t\t\t\t\t232 text 12\n\t\t\t\t\t233 text 成交订单\n\t\t\t\t\t234 text ¥1,896\n\t\t\t\t\t235 text 成交金额\n\t\t\t\t\t236 text 9\n\t\t\t\t\t237 text 完成拍摄\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "80-空镜库最终复核", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:37\n\t\t\t6 container\n\t\t\t\t48 container\n\t\t\t\t\t49 button 返回机巢工作台\n\t\t\t\t\t\t50 image\n\t\t\t\t\t51 heading 景区素材, Value: 1\n\t\t\t\t\t\t52 text 景区素材\n\t\t\t\t\t53 text 交互原型 · 无真实操作\n\t\t\t\t\t54 button 体验景区素材其他状态\n\t\t\t\t\t\t55 image\n\t\t\t\t\t\t56 text 体验其他状态\n\t\t\t\t\t57 button 筛选航线\n\t\t\t\t\t\t58 text 全部航线\n\t\t\t\t\t\t59 image\n\t\t\t\t\t60 button 筛选时间\n\t\t\t\t\t\t61 text 全部时间\n\t\t\t\t\t\t62 image\n\t\t\t\t63 container\n\t\t\t\t\t64 text 素材保留 90 天,请及时下载\n\t\t\t\t\t65 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t66 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t67 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t68 container\n\t\t\t\t\t\t\t69 text 10-23 17:20\n\t\t\t\t\t\t\t70 text · 5 段素材\n\t\t\t\t\t\t\t71 checkbox Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t\t73 text 选择本组\n\t\t\t\t\t\t\t74 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t75 image 航线视频片段 1\n\t\t\t\t\t\t\t\t76 text 片段 \n\t\t\t\t\t\t\t\t77 text 01\n\t\t\t\t\t\t\t\t78 container\n\t\t\t\t\t\t\t\t\t79 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t80 checkbox Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t81 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t82 image 航线视频片段 2\n\t\t\t\t\t\t\t\t83 text 片段 \n\t\t\t\t\t\t\t\t84 text 02\n\t\t\t\t\t\t\t\t85 text 00:27\n\t\t\t\t\t\t\t86 checkbox Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t87 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t88 image 航线视频片段 3\n\t\t\t\t\t\t\t\t89 text 片段 \n\t\t\t\t\t\t\t\t90 text 03\n\t\t\t\t\t\t\t\t91 text 00:30\n\t\t\t\t\t\t\t92 checkbox Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t93 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t94 image 航线视频片段 4\n\t\t\t\t\t\t\t\t95 text 片段 \n\t\t\t\t\t\t\t\t96 text 04\n\t\t\t\t\t\t\t\t97 text 00:24\n\t\t\t\t\t\t\t98 checkbox Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t99 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t100 image 航线视频片段 5\n\t\t\t\t\t\t\t\t101 text 片段 \n\t\t\t\t\t\t\t\t102 text 05\n\t\t\t\t\t\t\t\t103 text 00:31\n\t\t\t\t\t\t\t104 checkbox Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t105 container\n\t\t\t\t\t\t\t106 text 10-23 14:30\n\t\t\t\t\t\t\t107 text · 6 段素材\n\t\t\t\t\t\t\t108 checkbox Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t109 image\n\t\t\t\t\t\t\t\t110 text 选择本组\n\t\t\t\t\t\t\t111 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t112 image 航线视频片段 1\n\t\t\t\t\t\t\t\t113 text 片段 \n\t\t\t\t\t\t\t\t114 text 01\n\t\t\t\t\t\t\t\t115 container\n\t\t\t\t\t\t\t\t\t116 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t117 checkbox Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t118 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t119 image 航线视频片段 2\n\t\t\t\t\t\t\t\t120 text 片段 \n\t\t\t\t\t\t\t\t121 text 02\n\t\t\t\t\t\t\t\t122 text 00:27\n\t\t\t\t\t\t\t123 checkbox Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t124 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t125 image 航线视频片段 3\n\t\t\t\t\t\t\t\t126 text 片段 \n\t\t\t\t\t\t\t\t127 text 03\n\t\t\t\t\t\t\t\t128 text 00:30\n\t\t\t\t\t\t\t129 checkbox Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t130 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t131 image 航线视频片段 4\n\t\t\t\t\t\t\t\t132 text 片段 \n\t\t\t\t\t\t\t\t133 text 04\n\t\t\t\t\t\t\t\t134 text 00:24\n\t\t\t\t\t\t\t135 checkbox Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t136 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t137 image 航线视频片段 5\n\t\t\t\t\t\t\t\t138 text 片段 \n\t\t\t\t\t\t\t\t139 text 05\n\t\t\t\t\t\t\t\t140 text 00:31\n\t\t\t\t\t\t\t141 checkbox Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t142 button 展开其余 1 段\n\t\t\t\t\t\t\t\t143 text 展开其余 1 段\n\t\t\t\t\t\t\t\t144 image\n\t\t\t\t\t\t145 container\n\t\t\t\t\t\t\t146 text 10-22 16:10\n\t\t\t\t\t\t\t147 text · 3 段素材\n\t\t\t\t\t\t\t148 checkbox Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t149 image\n\t\t\t\t\t\t\t\t150 text 选择本组\n\t\t\t\t\t\t\t151 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t152 image 航线视频片段 1\n\t\t\t\t\t\t\t\t153 text 片段 \n\t\t\t\t\t\t\t\t154 text 01\n\t\t\t\t\t\t\t\t155 container\n\t\t\t\t\t\t\t\t\t156 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t157 checkbox Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t158 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t159 image 航线视频片段 2\n\t\t\t\t\t\t\t\t160 text 片段 \n\t\t\t\t\t\t\t\t161 text 02\n\t\t\t\t\t\t\t\t162 text 00:27\n\t\t\t\t\t\t\t163 checkbox Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t164 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t165 image 航线视频片段 3\n\t\t\t\t\t\t\t\t166 text 片段 \n\t\t\t\t\t\t\t\t167 text 03\n\t\t\t\t\t\t\t\t168 text 00:30\n\t\t\t\t\t\t\t169 checkbox Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t170 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t171 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t172 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t173 container\n\t\t\t\t\t\t\t174 text 10-23 10:40\n\t\t\t\t\t\t\t175 text · 4 段素材\n\t\t\t\t\t\t\t176 checkbox Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t177 image\n\t\t\t\t\t\t\t\t178 text 选择本组\n\t\t\t\t\t\t\t179 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t180 image 航线视频片段 1\n\t\t\t\t\t\t\t\t181 text 片段 \n\t\t\t\t\t\t\t\t182 text 01\n\t\t\t\t\t\t\t\t183 container\n\t\t\t\t\t\t\t\t\t184 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t185 checkbox Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t186 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t187 image 航线视频片段 2\n\t\t\t\t\t\t\t\t188 text 片段 \n\t\t\t\t\t\t\t\t189 text 02\n\t\t\t\t\t\t\t\t190 text 00:27\n\t\t\t\t\t\t\t191 checkbox Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t192 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t193 image 航线视频片段 3\n\t\t\t\t\t\t\t\t194 text 片段 \n\t\t\t\t\t\t\t\t195 text 03\n\t\t\t\t\t\t\t\t196 text 00:30\n\t\t\t\t\t\t\t197 checkbox Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t198 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t199 image 航线视频片段 4\n\t\t\t\t\t\t\t\t200 text 片段 \n\t\t\t\t\t\t\t\t201 text 04\n\t\t\t\t\t\t\t\t202 text 00:24\n\t\t\t\t\t\t\t203 checkbox Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t204 container\n\t\t\t\t\t\t\t205 text 10-10 15:35\n\t\t\t\t\t\t\t206 text · 5 段素材\n\t\t\t\t\t\t\t207 checkbox Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t208 image\n\t\t\t\t\t\t\t\t209 text 选择本组\n\t\t\t\t\t\t\t210 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t211 image 航线视频片段 1\n\t\t\t\t\t\t\t\t212 text 片段 \n\t\t\t\t\t\t\t\t213 text 01\n\t\t\t\t\t\t\t\t214 container\n\t\t\t\t\t\t\t\t\t215 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t216 checkbox Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t217 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t218 image 航线视频片段 2\n\t\t\t\t\t\t\t\t219 text 片段 \n\t\t\t\t\t\t\t\t220 text 02\n\t\t\t\t\t\t\t\t221 text 00:27\n\t\t\t\t\t\t\t222 checkbox Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t223 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t224 image 航线视频片段 3\n\t\t\t\t\t\t\t\t225 text 片段 \n\t\t\t\t\t\t\t\t226 text 03\n\t\t\t\t\t\t\t\t227 text 00:30\n\t\t\t\t\t\t\t228 checkbox Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t229 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t230 image 航线视频片段 4\n\t\t\t\t\t\t\t\t231 text 片段 \n\t\t\t\t\t\t\t\t232 text 04\n\t\t\t\t\t\t\t\t233 text 00:24\n\t\t\t\t\t\t\t234 checkbox Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t235 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t236 image 航线视频片段 5\n\t\t\t\t\t\t\t\t237 text 片段 \n\t\t\t\t\t\t\t\t238 text 05\n\t\t\t\t\t\t\t\t239 text 00:31\n\t\t\t\t\t\t\t240 checkbox Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t241 text 已显示保留期内的全部演示记录\n\t\t\t\t242 container\n\t\t\t\t\t243 text 已选 0 段\n\t\t\t\t\t244 button (disabled) 下载所选\n\t\t\t47 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "81-空镜整组六段选择", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:37\n\t\t\t6 container\n\t\t\t\t48 container\n\t\t\t\t\t49 button 返回机巢工作台\n\t\t\t\t\t\t50 image\n\t\t\t\t\t51 heading 景区素材, Value: 1\n\t\t\t\t\t\t52 text 景区素材\n\t\t\t\t\t53 text 交互原型 · 无真实操作\n\t\t\t\t\t54 button 体验景区素材其他状态\n\t\t\t\t\t\t55 image\n\t\t\t\t\t\t56 text 体验其他状态\n\t\t\t\t\t57 button 筛选航线\n\t\t\t\t\t\t58 text 全部航线\n\t\t\t\t\t\t59 image\n\t\t\t\t\t60 button 筛选时间\n\t\t\t\t\t\t61 text 全部时间\n\t\t\t\t\t\t62 image\n\t\t\t\t63 container\n\t\t\t\t\t64 text 素材保留 90 天,请及时下载\n\t\t\t\t\t65 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t66 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t67 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t68 container\n\t\t\t\t\t\t\t69 text 10-23 17:20\n\t\t\t\t\t\t\t70 text · 5 段素材\n\t\t\t\t\t\t\t71 checkbox Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t\t73 text 选择本组\n\t\t\t\t\t\t\t74 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t75 image 航线视频片段 1\n\t\t\t\t\t\t\t\t76 text 片段 \n\t\t\t\t\t\t\t\t77 text 01\n\t\t\t\t\t\t\t\t78 container\n\t\t\t\t\t\t\t\t\t79 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t80 checkbox Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t81 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t82 image 航线视频片段 2\n\t\t\t\t\t\t\t\t83 text 片段 \n\t\t\t\t\t\t\t\t84 text 02\n\t\t\t\t\t\t\t\t85 text 00:27\n\t\t\t\t\t\t\t86 checkbox Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t87 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t88 image 航线视频片段 3\n\t\t\t\t\t\t\t\t89 text 片段 \n\t\t\t\t\t\t\t\t90 text 03\n\t\t\t\t\t\t\t\t91 text 00:30\n\t\t\t\t\t\t\t92 checkbox Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t93 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t94 image 航线视频片段 4\n\t\t\t\t\t\t\t\t95 text 片段 \n\t\t\t\t\t\t\t\t96 text 04\n\t\t\t\t\t\t\t\t97 text 00:24\n\t\t\t\t\t\t\t98 checkbox Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t99 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t100 image 航线视频片段 5\n\t\t\t\t\t\t\t\t101 text 片段 \n\t\t\t\t\t\t\t\t102 text 05\n\t\t\t\t\t\t\t\t103 text 00:31\n\t\t\t\t\t\t\t104 checkbox Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t105 container\n\t\t\t\t\t\t\t106 text 10-23 14:30\n\t\t\t\t\t\t\t107 text · 6 段素材\n\t\t\t\t\t\t\t108 checkbox Description: 选择本组 10-23 14:30 6段, Value: 1\n\t\t\t\t\t\t\t\t245 image\n\t\t\t\t\t\t\t\t110 text 选择本组\n\t\t\t\t\t\t\t111 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t112 image 航线视频片段 1\n\t\t\t\t\t\t\t\t113 text 片段 \n\t\t\t\t\t\t\t\t114 text 01\n\t\t\t\t\t\t\t\t115 container\n\t\t\t\t\t\t\t\t\t116 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t117 checkbox Description: 取消选择片段1,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t118 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t119 image 航线视频片段 2\n\t\t\t\t\t\t\t\t120 text 片段 \n\t\t\t\t\t\t\t\t121 text 02\n\t\t\t\t\t\t\t\t122 text 00:27\n\t\t\t\t\t\t\t123 checkbox Description: 取消选择片段2,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t124 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t125 image 航线视频片段 3\n\t\t\t\t\t\t\t\t126 text 片段 \n\t\t\t\t\t\t\t\t127 text 03\n\t\t\t\t\t\t\t\t128 text 00:30\n\t\t\t\t\t\t\t129 checkbox Description: 取消选择片段3,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t130 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t131 image 航线视频片段 4\n\t\t\t\t\t\t\t\t132 text 片段 \n\t\t\t\t\t\t\t\t133 text 04\n\t\t\t\t\t\t\t\t134 text 00:24\n\t\t\t\t\t\t\t135 checkbox Description: 取消选择片段4,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t136 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t137 image 航线视频片段 5\n\t\t\t\t\t\t\t\t138 text 片段 \n\t\t\t\t\t\t\t\t139 text 05\n\t\t\t\t\t\t\t\t140 text 00:31\n\t\t\t\t\t\t\t141 checkbox Description: 取消选择片段5,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t142 button 展开其余 1 段\n\t\t\t\t\t\t\t\t143 text 展开其余 1 段\n\t\t\t\t\t\t\t\t144 image\n\t\t\t\t\t\t145 container\n\t\t\t\t\t\t\t146 text 10-22 16:10\n\t\t\t\t\t\t\t147 text · 3 段素材\n\t\t\t\t\t\t\t148 checkbox Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t149 image\n\t\t\t\t\t\t\t\t150 text 选择本组\n\t\t\t\t\t\t\t151 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t152 image 航线视频片段 1\n\t\t\t\t\t\t\t\t153 text 片段 \n\t\t\t\t\t\t\t\t154 text 01\n\t\t\t\t\t\t\t\t155 container\n\t\t\t\t\t\t\t\t\t156 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t157 checkbox Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t158 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t159 image 航线视频片段 2\n\t\t\t\t\t\t\t\t160 text 片段 \n\t\t\t\t\t\t\t\t161 text 02\n\t\t\t\t\t\t\t\t162 text 00:27\n\t\t\t\t\t\t\t163 checkbox Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t164 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t165 image 航线视频片段 3\n\t\t\t\t\t\t\t\t166 text 片段 \n\t\t\t\t\t\t\t\t167 text 03\n\t\t\t\t\t\t\t\t168 text 00:30\n\t\t\t\t\t\t\t169 checkbox Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t170 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t171 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t172 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t173 container\n\t\t\t\t\t\t\t174 text 10-23 10:40\n\t\t\t\t\t\t\t175 text · 4 段素材\n\t\t\t\t\t\t\t176 checkbox Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t177 image\n\t\t\t\t\t\t\t\t178 text 选择本组\n\t\t\t\t\t\t\t179 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t180 image 航线视频片段 1\n\t\t\t\t\t\t\t\t181 text 片段 \n\t\t\t\t\t\t\t\t182 text 01\n\t\t\t\t\t\t\t\t183 container\n\t\t\t\t\t\t\t\t\t184 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t185 checkbox Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t186 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t187 image 航线视频片段 2\n\t\t\t\t\t\t\t\t188 text 片段 \n\t\t\t\t\t\t\t\t189 text 02\n\t\t\t\t\t\t\t\t190 text 00:27\n\t\t\t\t\t\t\t191 checkbox Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t192 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t193 image 航线视频片段 3\n\t\t\t\t\t\t\t\t194 text 片段 \n\t\t\t\t\t\t\t\t195 text 03\n\t\t\t\t\t\t\t\t196 text 00:30\n\t\t\t\t\t\t\t197 checkbox Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t198 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t199 image 航线视频片段 4\n\t\t\t\t\t\t\t\t200 text 片段 \n\t\t\t\t\t\t\t\t201 text 04\n\t\t\t\t\t\t\t\t202 text 00:24\n\t\t\t\t\t\t\t203 checkbox Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t204 container\n\t\t\t\t\t\t\t205 text 10-10 15:35\n\t\t\t\t\t\t\t206 text · 5 段素材\n\t\t\t\t\t\t\t207 checkbox Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t208 image\n\t\t\t\t\t\t\t\t209 text 选择本组\n\t\t\t\t\t\t\t210 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t211 image 航线视频片段 1\n\t\t\t\t\t\t\t\t212 text 片段 \n\t\t\t\t\t\t\t\t213 text 01\n\t\t\t\t\t\t\t\t214 container\n\t\t\t\t\t\t\t\t\t215 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t216 checkbox Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t217 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t218 image 航线视频片段 2\n\t\t\t\t\t\t\t\t219 text 片段 \n\t\t\t\t\t\t\t\t220 text 02\n\t\t\t\t\t\t\t\t221 text 00:27\n\t\t\t\t\t\t\t222 checkbox Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t223 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t224 image 航线视频片段 3\n\t\t\t\t\t\t\t\t225 text 片段 \n\t\t\t\t\t\t\t\t226 text 03\n\t\t\t\t\t\t\t\t227 text 00:30\n\t\t\t\t\t\t\t228 checkbox Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t229 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t230 image 航线视频片段 4\n\t\t\t\t\t\t\t\t231 text 片段 \n\t\t\t\t\t\t\t\t232 text 04\n\t\t\t\t\t\t\t\t233 text 00:24\n\t\t\t\t\t\t\t234 checkbox Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t235 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t236 image 航线视频片段 5\n\t\t\t\t\t\t\t\t237 text 片段 \n\t\t\t\t\t\t\t\t238 text 05\n\t\t\t\t\t\t\t\t239 text 00:31\n\t\t\t\t\t\t\t240 checkbox Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t241 text 已显示保留期内的全部演示记录\n\t\t\t\t242 container\n\t\t\t\t\t243 text 已选 6 段\n\t\t\t\t\t244 button 下载所选(6)\n\t\t\t\t\t\t246 text 下载所选\n\t\t\t\t\t\t247 text (6)\n\t\t\t47 image\n\nThe focused UI element is 108 checkbox Description: 选择本组 10-23 14:30 6段, Value: 1" + }, + { + "name": "82-折叠部分也纳入组选择", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:37\n\t\t\t6 container\n\t\t\t\t48 container\n\t\t\t\t\t49 button 返回机巢工作台\n\t\t\t\t\t\t50 image\n\t\t\t\t\t51 heading 景区素材, Value: 1\n\t\t\t\t\t\t52 text 景区素材\n\t\t\t\t\t53 text 交互原型 · 无真实操作\n\t\t\t\t\t54 button 体验景区素材其他状态\n\t\t\t\t\t\t55 image\n\t\t\t\t\t\t56 text 体验其他状态\n\t\t\t\t\t57 button 筛选航线\n\t\t\t\t\t\t58 text 全部航线\n\t\t\t\t\t\t59 image\n\t\t\t\t\t60 button 筛选时间\n\t\t\t\t\t\t61 text 全部时间\n\t\t\t\t\t\t62 image\n\t\t\t\t63 container\n\t\t\t\t\t64 text 素材保留 90 天,请及时下载\n\t\t\t\t\t65 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t66 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t67 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t68 container\n\t\t\t\t\t\t\t69 text 10-23 17:20\n\t\t\t\t\t\t\t70 text · 5 段素材\n\t\t\t\t\t\t\t71 checkbox Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t\t73 text 选择本组\n\t\t\t\t\t\t\t74 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t75 image 航线视频片段 1\n\t\t\t\t\t\t\t\t76 text 片段 \n\t\t\t\t\t\t\t\t77 text 01\n\t\t\t\t\t\t\t\t78 container\n\t\t\t\t\t\t\t\t\t79 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t80 checkbox Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t81 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t82 image 航线视频片段 2\n\t\t\t\t\t\t\t\t83 text 片段 \n\t\t\t\t\t\t\t\t84 text 02\n\t\t\t\t\t\t\t\t85 text 00:27\n\t\t\t\t\t\t\t86 checkbox Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t87 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t88 image 航线视频片段 3\n\t\t\t\t\t\t\t\t89 text 片段 \n\t\t\t\t\t\t\t\t90 text 03\n\t\t\t\t\t\t\t\t91 text 00:30\n\t\t\t\t\t\t\t92 checkbox Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t93 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t94 image 航线视频片段 4\n\t\t\t\t\t\t\t\t95 text 片段 \n\t\t\t\t\t\t\t\t96 text 04\n\t\t\t\t\t\t\t\t97 text 00:24\n\t\t\t\t\t\t\t98 checkbox Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t99 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t100 image 航线视频片段 5\n\t\t\t\t\t\t\t\t101 text 片段 \n\t\t\t\t\t\t\t\t102 text 05\n\t\t\t\t\t\t\t\t103 text 00:31\n\t\t\t\t\t\t\t104 checkbox Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t105 container\n\t\t\t\t\t\t\t106 text 10-23 14:30\n\t\t\t\t\t\t\t107 text · 6 段素材\n\t\t\t\t\t\t\t108 checkbox Description: 选择本组 10-23 14:30 6段, Value: 1\n\t\t\t\t\t\t\t\t245 image\n\t\t\t\t\t\t\t\t110 text 选择本组\n\t\t\t\t\t\t\t111 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t112 image 航线视频片段 1\n\t\t\t\t\t\t\t\t113 text 片段 \n\t\t\t\t\t\t\t\t114 text 01\n\t\t\t\t\t\t\t\t115 container\n\t\t\t\t\t\t\t\t\t116 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t117 checkbox Description: 取消选择片段1,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t118 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t119 image 航线视频片段 2\n\t\t\t\t\t\t\t\t120 text 片段 \n\t\t\t\t\t\t\t\t121 text 02\n\t\t\t\t\t\t\t\t122 text 00:27\n\t\t\t\t\t\t\t123 checkbox Description: 取消选择片段2,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t124 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t125 image 航线视频片段 3\n\t\t\t\t\t\t\t\t126 text 片段 \n\t\t\t\t\t\t\t\t127 text 03\n\t\t\t\t\t\t\t\t128 text 00:30\n\t\t\t\t\t\t\t129 checkbox Description: 取消选择片段3,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t130 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t131 image 航线视频片段 4\n\t\t\t\t\t\t\t\t132 text 片段 \n\t\t\t\t\t\t\t\t133 text 04\n\t\t\t\t\t\t\t\t134 text 00:24\n\t\t\t\t\t\t\t135 checkbox Description: 取消选择片段4,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t136 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t137 image 航线视频片段 5\n\t\t\t\t\t\t\t\t138 text 片段 \n\t\t\t\t\t\t\t\t139 text 05\n\t\t\t\t\t\t\t\t140 text 00:31\n\t\t\t\t\t\t\t141 checkbox Description: 取消选择片段5,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t248 button 预览10-23 14:30片段6\n\t\t\t\t\t\t\t\t249 image 航线视频片段 6\n\t\t\t\t\t\t\t\t250 text 片段 \n\t\t\t\t\t\t\t\t251 text 06\n\t\t\t\t\t\t\t\t252 text 00:26\n\t\t\t\t\t\t\t253 checkbox Description: 取消选择片段6,10-23 14:30, Value: 1\n\t\t\t\t\t\t\t142 button 收起片段\n\t\t\t\t\t\t\t\t143 text 收起片段\n\t\t\t\t\t\t\t\t144 image\n\t\t\t\t\t\t145 container\n\t\t\t\t\t\t\t146 text 10-22 16:10\n\t\t\t\t\t\t\t147 text · 3 段素材\n\t\t\t\t\t\t\t148 checkbox Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t149 image\n\t\t\t\t\t\t\t\t150 text 选择本组\n\t\t\t\t\t\t\t151 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t152 image 航线视频片段 1\n\t\t\t\t\t\t\t\t153 text 片段 \n\t\t\t\t\t\t\t\t154 text 01\n\t\t\t\t\t\t\t\t155 container\n\t\t\t\t\t\t\t\t\t156 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t157 checkbox Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t158 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t159 image 航线视频片段 2\n\t\t\t\t\t\t\t\t160 text 片段 \n\t\t\t\t\t\t\t\t161 text 02\n\t\t\t\t\t\t\t\t162 text 00:27\n\t\t\t\t\t\t\t163 checkbox Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t164 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t165 image 航线视频片段 3\n\t\t\t\t\t\t\t\t166 text 片段 \n\t\t\t\t\t\t\t\t167 text 03\n\t\t\t\t\t\t\t\t168 text 00:30\n\t\t\t\t\t\t\t169 checkbox Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t170 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t171 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t172 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t173 container\n\t\t\t\t\t\t\t174 text 10-23 10:40\n\t\t\t\t\t\t\t175 text · 4 段素材\n\t\t\t\t\t\t\t176 checkbox Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t177 image\n\t\t\t\t\t\t\t\t178 text 选择本组\n\t\t\t\t\t\t\t179 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t180 image 航线视频片段 1\n\t\t\t\t\t\t\t\t181 text 片段 \n\t\t\t\t\t\t\t\t182 text 01\n\t\t\t\t\t\t\t\t183 container\n\t\t\t\t\t\t\t\t\t184 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t185 checkbox Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t186 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t187 image 航线视频片段 2\n\t\t\t\t\t\t\t\t188 text 片段 \n\t\t\t\t\t\t\t\t189 text 02\n\t\t\t\t\t\t\t\t190 text 00:27\n\t\t\t\t\t\t\t191 checkbox Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t192 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t193 image 航线视频片段 3\n\t\t\t\t\t\t\t\t194 text 片段 \n\t\t\t\t\t\t\t\t195 text 03\n\t\t\t\t\t\t\t\t196 text 00:30\n\t\t\t\t\t\t\t197 checkbox Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t198 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t199 image 航线视频片段 4\n\t\t\t\t\t\t\t\t200 text 片段 \n\t\t\t\t\t\t\t\t201 text 04\n\t\t\t\t\t\t\t\t202 text 00:24\n\t\t\t\t\t\t\t203 checkbox Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t204 container\n\t\t\t\t\t\t\t205 text 10-10 15:35\n\t\t\t\t\t\t\t206 text · 5 段素材\n\t\t\t\t\t\t\t207 checkbox Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t208 image\n\t\t\t\t\t\t\t\t209 text 选择本组\n\t\t\t\t\t\t\t210 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t211 image 航线视频片段 1\n\t\t\t\t\t\t\t\t212 text 片段 \n\t\t\t\t\t\t\t\t213 text 01\n\t\t\t\t\t\t\t\t214 container\n\t\t\t\t\t\t\t\t\t215 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t216 checkbox Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t217 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t218 image 航线视频片段 2\n\t\t\t\t\t\t\t\t219 text 片段 \n\t\t\t\t\t\t\t\t220 text 02\n\t\t\t\t\t\t\t\t221 text 00:27\n\t\t\t\t\t\t\t222 checkbox Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t223 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t224 image 航线视频片段 3\n\t\t\t\t\t\t\t\t225 text 片段 \n\t\t\t\t\t\t\t\t226 text 03\n\t\t\t\t\t\t\t\t227 text 00:30\n\t\t\t\t\t\t\t228 checkbox Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t229 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t230 image 航线视频片段 4\n\t\t\t\t\t\t\t\t231 text 片段 \n\t\t\t\t\t\t\t\t232 text 04\n\t\t\t\t\t\t\t\t233 text 00:24\n\t\t\t\t\t\t\t234 checkbox Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t235 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t236 image 航线视频片段 5\n\t\t\t\t\t\t\t\t237 text 片段 \n\t\t\t\t\t\t\t\t238 text 05\n\t\t\t\t\t\t\t\t239 text 00:31\n\t\t\t\t\t\t\t240 checkbox Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t241 text 已显示保留期内的全部演示记录\n\t\t\t\t242 container\n\t\t\t\t\t243 text 已选 6 段\n\t\t\t\t\t244 button 下载所选(6)\n\t\t\t\t\t\t246 text 下载所选\n\t\t\t\t\t\t247 text (6)\n\t\t\t47 image\n\nThe focused UI element is 142 button 收起片段" + }, + { + "name": "83-空镜异常菜单复核", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_4h_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_4i_\n\t\t\t3 text 体验本页状态\n\t\t4 text 仅切换当前页面;正常下载会自动推进。\n\t\t5 button 正常素材列表\n\t\t\t6 text 正常素材列表\n\t\t\t7 image\n\t\t8 button 参考图 · 已选 2 段\n\t\t\t9 text 参考图 · 已选 2 段\n\t\t\t10 image\n\t\t11 button 下载中\n\t\t\t12 text 下载中\n\t\t\t13 image\n\t\t14 button 下载成功\n\t\t\t15 text 下载成功\n\t\t\t16 image\n\t\t17 button 部分下载失败\n\t\t\t18 text 部分下载失败\n\t\t\t19 image\n\t\t20 button 相册权限不足\n\t\t\t21 text 相册权限不足\n\t\t\t22 image\n\t\t23 button 暂无景区素材\n\t\t\t24 text 暂无景区素材\n\t\t\t25 image\n\t\t26 button 筛选无结果\n\t\t\t27 text 筛选无结果\n\t\t\t28 image\n\nThe focused UI element is 5 button 正常素材列表" + }, + { + "name": "84-空镜相册权限不足", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 需要相册保存权限, ID: radix-_r_4h_\n\t\t2 heading 需要相册保存权限, Value: 2, ID: radix-_r_4i_\n\t\t\t3 text 需要相册保存权限\n\t\t4 image\n\t\t5 text 允许保存视频后才能下载到相册。这里仅演示权限流程,不会修改手机设置。\n\t\t6 button 演示允许权限\n\t\t7 button 暂不下载\n\nThe focused UI element is 1 container 需要相册保存权限, ID: radix-_r_4h_" + }, + { + "name": "85-取消授权不下载", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 需要相册保存权限, ID: radix-_r_4h_\n\t\t2 heading 需要相册保存权限, Value: 2, ID: radix-_r_4i_\n\t\t\t3 text 需要相册保存权限\n\t\t4 image\n\t\t5 text 允许保存视频后才能下载到相册。这里仅演示权限流程,不会修改手机设置。\n\t\t6 button 演示允许权限\n\t\t7 button 暂不下载\n\nThe focused UI element is 7 button 暂不下载" + }, + { + "name": "86-打开空镜状态", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 体验本页状态, ID: radix-_r_4h_\n\t\t2 heading 体验本页状态, Value: 2, ID: radix-_r_4i_\n\t\t\t3 text 体验本页状态\n\t\t4 text 仅切换当前页面;正常下载会自动推进。\n\t\t5 button 正常素材列表\n\t\t\t6 text 正常素材列表\n\t\t\t7 image\n\t\t8 button 参考图 · 已选 2 段\n\t\t\t9 text 参考图 · 已选 2 段\n\t\t\t10 image\n\t\t11 button 下载中\n\t\t\t12 text 下载中\n\t\t\t13 image\n\t\t14 button 下载成功\n\t\t\t15 text 下载成功\n\t\t\t16 image\n\t\t17 button 部分下载失败\n\t\t\t18 text 部分下载失败\n\t\t\t19 image\n\t\t20 button 相册权限不足\n\t\t\t21 text 相册权限不足\n\t\t\t22 image\n\t\t23 button 暂无景区素材\n\t\t\t24 text 暂无景区素材\n\t\t\t25 image\n\t\t26 button 筛选无结果\n\t\t\t27 text 筛选无结果\n\t\t\t28 image\n\nThe focused UI element is 5 button 正常素材列表" + }, + { + "name": "87-结束时空镜列表", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:38\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回机巢工作台\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 景区素材, Value: 1\n\t\t\t\t\t\t11 text 景区素材\n\t\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t\t13 button 体验景区素材其他状态\n\t\t\t\t\t\t14 image\n\t\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t\t16 button 筛选航线\n\t\t\t\t\t\t17 text 全部航线\n\t\t\t\t\t\t18 image\n\t\t\t\t\t19 button 筛选时间\n\t\t\t\t\t\t20 text 全部时间\n\t\t\t\t\t\t21 image\n\t\t\t\t22 container\n\t\t\t\t\t23 text 素材保留 90 天,请及时下载\n\t\t\t\t\t24 container 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t25 heading 共眠岸 → 三皇寨 → 好汉坡, Value: 2\n\t\t\t\t\t\t\t26 text 共眠岸 → 三皇寨 → 好汉坡\n\t\t\t\t\t\t27 container\n\t\t\t\t\t\t\t28 text 10-23 17:20\n\t\t\t\t\t\t\t29 text · 5 段素材\n\t\t\t\t\t\t\t30 checkbox Description: 选择本组 10-23 17:20 5段, Value: 0\n\t\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t\t32 text 选择本组\n\t\t\t\t\t\t\t33 button 预览10-23 17:20片段1\n\t\t\t\t\t\t\t\t34 image 航线视频片段 1\n\t\t\t\t\t\t\t\t35 text 片段 \n\t\t\t\t\t\t\t\t36 text 01\n\t\t\t\t\t\t\t\t37 container\n\t\t\t\t\t\t\t\t\t38 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t39 checkbox Description: 选择片段1,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t40 button 预览10-23 17:20片段2\n\t\t\t\t\t\t\t\t41 image 航线视频片段 2\n\t\t\t\t\t\t\t\t42 text 片段 \n\t\t\t\t\t\t\t\t43 text 02\n\t\t\t\t\t\t\t\t44 text 00:27\n\t\t\t\t\t\t\t45 checkbox Description: 选择片段2,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t46 button 预览10-23 17:20片段3\n\t\t\t\t\t\t\t\t47 image 航线视频片段 3\n\t\t\t\t\t\t\t\t48 text 片段 \n\t\t\t\t\t\t\t\t49 text 03\n\t\t\t\t\t\t\t\t50 text 00:30\n\t\t\t\t\t\t\t51 checkbox Description: 选择片段3,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t52 button 预览10-23 17:20片段4\n\t\t\t\t\t\t\t\t53 image 航线视频片段 4\n\t\t\t\t\t\t\t\t54 text 片段 \n\t\t\t\t\t\t\t\t55 text 04\n\t\t\t\t\t\t\t\t56 text 00:24\n\t\t\t\t\t\t\t57 checkbox Description: 选择片段4,10-23 17:20, Value: 0\n\t\t\t\t\t\t\t58 button 预览10-23 17:20片段5\n\t\t\t\t\t\t\t\t59 image 航线视频片段 5\n\t\t\t\t\t\t\t\t60 text 片段 \n\t\t\t\t\t\t\t\t61 text 05\n\t\t\t\t\t\t\t\t62 text 00:31\n\t\t\t\t\t\t\t63 checkbox Description: 选择片段5,10-23 17:20, Value: 0\n\t\t\t\t\t\t64 container\n\t\t\t\t\t\t\t65 text 10-23 14:30\n\t\t\t\t\t\t\t66 text · 6 段素材\n\t\t\t\t\t\t\t67 checkbox Description: 选择本组 10-23 14:30 6段, Value: 0\n\t\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t\t69 text 选择本组\n\t\t\t\t\t\t\t70 button 预览10-23 14:30片段1\n\t\t\t\t\t\t\t\t71 image 航线视频片段 1\n\t\t\t\t\t\t\t\t72 text 片段 \n\t\t\t\t\t\t\t\t73 text 01\n\t\t\t\t\t\t\t\t74 container\n\t\t\t\t\t\t\t\t\t75 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t76 checkbox Description: 选择片段1,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t77 button 预览10-23 14:30片段2\n\t\t\t\t\t\t\t\t78 image 航线视频片段 2\n\t\t\t\t\t\t\t\t79 text 片段 \n\t\t\t\t\t\t\t\t80 text 02\n\t\t\t\t\t\t\t\t81 text 00:27\n\t\t\t\t\t\t\t82 checkbox Description: 选择片段2,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t83 button 预览10-23 14:30片段3\n\t\t\t\t\t\t\t\t84 image 航线视频片段 3\n\t\t\t\t\t\t\t\t85 text 片段 \n\t\t\t\t\t\t\t\t86 text 03\n\t\t\t\t\t\t\t\t87 text 00:30\n\t\t\t\t\t\t\t88 checkbox Description: 选择片段3,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t89 button 预览10-23 14:30片段4\n\t\t\t\t\t\t\t\t90 image 航线视频片段 4\n\t\t\t\t\t\t\t\t91 text 片段 \n\t\t\t\t\t\t\t\t92 text 04\n\t\t\t\t\t\t\t\t93 text 00:24\n\t\t\t\t\t\t\t94 checkbox Description: 选择片段4,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t95 button 预览10-23 14:30片段5\n\t\t\t\t\t\t\t\t96 image 航线视频片段 5\n\t\t\t\t\t\t\t\t97 text 片段 \n\t\t\t\t\t\t\t\t98 text 05\n\t\t\t\t\t\t\t\t99 text 00:31\n\t\t\t\t\t\t\t100 checkbox Description: 选择片段5,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t101 button 预览10-23 14:30片段6\n\t\t\t\t\t\t\t\t102 image 航线视频片段 6\n\t\t\t\t\t\t\t\t103 text 片段 \n\t\t\t\t\t\t\t\t104 text 06\n\t\t\t\t\t\t\t\t105 text 00:26\n\t\t\t\t\t\t\t106 checkbox Description: 选择片段6,10-23 14:30, Value: 0\n\t\t\t\t\t\t\t107 button 收起片段\n\t\t\t\t\t\t\t\t108 text 收起片段\n\t\t\t\t\t\t\t\t109 image\n\t\t\t\t\t\t110 container\n\t\t\t\t\t\t\t111 text 10-22 16:10\n\t\t\t\t\t\t\t112 text · 3 段素材\n\t\t\t\t\t\t\t113 checkbox Description: 选择本组 10-22 16:10 3段, Value: 0\n\t\t\t\t\t\t\t\t114 image\n\t\t\t\t\t\t\t\t115 text 选择本组\n\t\t\t\t\t\t\t116 button 预览10-22 16:10片段1\n\t\t\t\t\t\t\t\t117 image 航线视频片段 1\n\t\t\t\t\t\t\t\t118 text 片段 \n\t\t\t\t\t\t\t\t119 text 01\n\t\t\t\t\t\t\t\t120 container\n\t\t\t\t\t\t\t\t\t121 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t122 checkbox Description: 选择片段1,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t123 button 预览10-22 16:10片段2\n\t\t\t\t\t\t\t\t124 image 航线视频片段 2\n\t\t\t\t\t\t\t\t125 text 片段 \n\t\t\t\t\t\t\t\t126 text 02\n\t\t\t\t\t\t\t\t127 text 00:27\n\t\t\t\t\t\t\t128 checkbox Description: 选择片段2,10-22 16:10, Value: 0\n\t\t\t\t\t\t\t129 button 预览10-22 16:10片段3\n\t\t\t\t\t\t\t\t130 image 航线视频片段 3\n\t\t\t\t\t\t\t\t131 text 片段 \n\t\t\t\t\t\t\t\t132 text 03\n\t\t\t\t\t\t\t\t133 text 00:30\n\t\t\t\t\t\t\t134 checkbox Description: 选择片段3,10-22 16:10, Value: 0\n\t\t\t\t\t135 container 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t136 heading 少林寺 → 塔林 → 达摩洞, Value: 2\n\t\t\t\t\t\t\t137 text 少林寺 → 塔林 → 达摩洞\n\t\t\t\t\t\t138 container\n\t\t\t\t\t\t\t139 text 10-23 10:40\n\t\t\t\t\t\t\t140 text · 4 段素材\n\t\t\t\t\t\t\t141 checkbox Description: 选择本组 10-23 10:40 4段, Value: 0\n\t\t\t\t\t\t\t\t142 image\n\t\t\t\t\t\t\t\t143 text 选择本组\n\t\t\t\t\t\t\t144 button 预览10-23 10:40片段1\n\t\t\t\t\t\t\t\t145 image 航线视频片段 1\n\t\t\t\t\t\t\t\t146 text 片段 \n\t\t\t\t\t\t\t\t147 text 01\n\t\t\t\t\t\t\t\t148 container\n\t\t\t\t\t\t\t\t\t149 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t150 checkbox Description: 选择片段1,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t151 button 预览10-23 10:40片段2\n\t\t\t\t\t\t\t\t152 image 航线视频片段 2\n\t\t\t\t\t\t\t\t153 text 片段 \n\t\t\t\t\t\t\t\t154 text 02\n\t\t\t\t\t\t\t\t155 text 00:27\n\t\t\t\t\t\t\t156 checkbox Description: 选择片段2,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t157 button 预览10-23 10:40片段3\n\t\t\t\t\t\t\t\t158 image 航线视频片段 3\n\t\t\t\t\t\t\t\t159 text 片段 \n\t\t\t\t\t\t\t\t160 text 03\n\t\t\t\t\t\t\t\t161 text 00:30\n\t\t\t\t\t\t\t162 checkbox Description: 选择片段3,10-23 10:40, Value: 0\n\t\t\t\t\t\t\t163 button 预览10-23 10:40片段4\n\t\t\t\t\t\t\t\t164 image 航线视频片段 4\n\t\t\t\t\t\t\t\t165 text 片段 \n\t\t\t\t\t\t\t\t166 text 04\n\t\t\t\t\t\t\t\t167 text 00:24\n\t\t\t\t\t\t\t168 checkbox Description: 选择片段4,10-23 10:40, Value: 0\n\t\t\t\t\t\t169 container\n\t\t\t\t\t\t\t170 text 10-10 15:35\n\t\t\t\t\t\t\t171 text · 5 段素材\n\t\t\t\t\t\t\t172 checkbox Description: 选择本组 10-10 15:35 5段, Value: 0\n\t\t\t\t\t\t\t\t173 image\n\t\t\t\t\t\t\t\t174 text 选择本组\n\t\t\t\t\t\t\t175 button 预览10-10 15:35片段1\n\t\t\t\t\t\t\t\t176 image 航线视频片段 1\n\t\t\t\t\t\t\t\t177 text 片段 \n\t\t\t\t\t\t\t\t178 text 01\n\t\t\t\t\t\t\t\t179 container\n\t\t\t\t\t\t\t\t\t180 text 00:28 · 4K · 178MB\n\t\t\t\t\t\t\t181 checkbox Description: 选择片段1,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t182 button 预览10-10 15:35片段2\n\t\t\t\t\t\t\t\t183 image 航线视频片段 2\n\t\t\t\t\t\t\t\t184 text 片段 \n\t\t\t\t\t\t\t\t185 text 02\n\t\t\t\t\t\t\t\t186 text 00:27\n\t\t\t\t\t\t\t187 checkbox Description: 选择片段2,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t188 button 预览10-10 15:35片段3\n\t\t\t\t\t\t\t\t189 image 航线视频片段 3\n\t\t\t\t\t\t\t\t190 text 片段 \n\t\t\t\t\t\t\t\t191 text 03\n\t\t\t\t\t\t\t\t192 text 00:30\n\t\t\t\t\t\t\t193 checkbox Description: 选择片段3,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t194 button 预览10-10 15:35片段4\n\t\t\t\t\t\t\t\t195 image 航线视频片段 4\n\t\t\t\t\t\t\t\t196 text 片段 \n\t\t\t\t\t\t\t\t197 text 04\n\t\t\t\t\t\t\t\t198 text 00:24\n\t\t\t\t\t\t\t199 checkbox Description: 选择片段4,10-10 15:35, Value: 0\n\t\t\t\t\t\t\t200 button 预览10-10 15:35片段5\n\t\t\t\t\t\t\t\t201 image 航线视频片段 5\n\t\t\t\t\t\t\t\t202 text 片段 \n\t\t\t\t\t\t\t\t203 text 05\n\t\t\t\t\t\t\t\t204 text 00:31\n\t\t\t\t\t\t\t205 checkbox Description: 选择片段5,10-10 15:35, Value: 0\n\t\t\t\t\t206 text 已显示保留期内的全部演示记录\n\t\t\t\t207 container\n\t\t\t\t\t208 text 已选 0 段\n\t\t\t\t\t209 button (disabled) 下载所选\n\t\t\t210 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "88-活跃任务返回后的准备页", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:46\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t11 text 拍摄准备\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t18 text 游客 158****8888\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 含 5 次拍摄\n\t\t\t\t\t21 container\n\t\t\t\t\t\t22 text 已拍摄 3 次\n\t\t\t\t\t23 container\n\t\t\t\t\t\t24 text 剩余 2 次\n\t\t\t\t\t25 heading 拍摄点, Value: 2\n\t\t\t\t\t\t26 text 拍摄点\n\t\t\t\t\t27 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t28 checkbox 三皇寨 范围内 已拍 2 次, Value: 1\n\t\t\t\t\t\t\t29 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t30 text 三皇寨\n\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t32 text 范围内\n\t\t\t\t\t\t\t33 text 已拍 2 次\n\t\t\t\t\t\t34 checkbox 金阙云宫 800 m 已拍 1 次, Value: 0\n\t\t\t\t\t\t\t35 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t36 text 金阙云宫\n\t\t\t\t\t\t\t37 image\n\t\t\t\t\t\t\t38 text 800 m\n\t\t\t\t\t\t\t39 text 已拍 1 次\n\t\t\t\t\t\t40 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t41 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t42 text 少室山\n\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 text 1.2 km\n\t\t\t\t\t\t\t45 text 未拍摄\n\t\t\t\t\t\t46 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t47 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t48 text 迎客峰\n\t\t\t\t\t\t\t49 image\n\t\t\t\t\t\t\t50 text 1.8 km\n\t\t\t\t\t\t\t51 text 未拍摄\n\t\t\t\t\t52 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t53 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t54 三皇寨的航线\n\t\t\t\t\t\t55 radio button 经典航线, Value: 1\n\t\t\t\t\t\t\t56 image\n\t\t\t\t\t\t\t57 text 经典航线\n\t\t\t\t\t\t\t58 image\n\t\t\t\t\t\t59 radio button 环绕专线, Value: 0\n\t\t\t\t\t\t\t60 image\n\t\t\t\t\t\t\t61 text 环绕专线\n\t\t\t\t\t\t\t62 image\n\t\t\t\t\t\t63 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t64 image\n\t\t\t\t\t\t\t65 text 远景拉升\n\t\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t69 text 全景环绕\n\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t71 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t73 text 高空俯瞰\n\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t75 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t77 text 山峰渐远\n\t\t\t\t\t\t\t78 image\n\t\t\t\t\t\t79 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 峡谷穿行\n\t\t\t\t\t\t\t82 image\n\t\t\t\t\t\t83 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t84 image\n\t\t\t\t\t\t\t85 text 山脊侧拍\n\t\t\t\t\t\t\t86 image\n\t\t\t\t87 container\n\t\t\t\t\t88 image\n\t\t\t\t\t89 text 机巢已连接\n\t\t\t\t\t90 image\n\t\t\t\t\t91 text 点位范围内\n\t\t\t\t\t92 heading 三皇寨 · 经典航线, Value: 3\n\t\t\t\t\t\t93 text 三皇寨 · 经典航线\n\t\t\t\t\t94 text 无人机: 占用中 · 电量 95%\n\t\t\t\t\t95 button 继续查看任务\n\t\t\t\t\t96 text 当前订单已有任务执行中,请继续查看原任务\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "89-恢复活跃任务仍待开始", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:46\n\t\t\t6 container\n\t\t\t\t98 container\n\t\t\t\t\t99 button 返回\n\t\t\t\t\t\t100 image\n\t\t\t\t\t101 heading 拍摄任务, Value: 1\n\t\t\t\t\t\t102 text 拍摄任务\n\t\t\t\t103 text 交互原型 · 无真实操作\n\t\t\t\t104 button 体验本页其他状态\n\t\t\t\t\t105 image\n\t\t\t\t\t106 text 体验其他状态\n\t\t\t\t107 container\n\t\t\t\t\t108 heading 三皇寨 · 经典航线, Value: 2\n\t\t\t\t\t\t109 text 三皇寨 · 经典航线\n\t\t\t\t\t110 container\n\t\t\t\t\t\t111 text 游客 158****8888 · 含 5 次拍摄\n\t\t\t\t\t112 container 无人机直播画面\n\t\t\t\t\t\t113 image 无人机视角的游客取景演示画面\n\t\t\t\t\t\t114 image\n\t\t\t\t\t\t115 text 实时图传\n\t\t\t\t\t\t116 button 放大直播画面\n\t\t\t\t\t\t\t117 image\n\t\t\t\t\t118 container 无人机六项状态\n\t\t\t\t\t\t119 text 电池电量\n\t\t\t\t\t\t120 container\n\t\t\t\t\t\t\t121 image\n\t\t\t\t\t\t\t122 text 95%\n\t\t\t\t\t\t123 text 环境温度\n\t\t\t\t\t\t124 container\n\t\t\t\t\t\t\t125 image\n\t\t\t\t\t\t\t126 text 20.3°C\n\t\t\t\t\t\t127 text 风速\n\t\t\t\t\t\t128 container\n\t\t\t\t\t\t\t129 image\n\t\t\t\t\t\t\t130 text 0m/s\n\t\t\t\t\t\t131 text 雨量\n\t\t\t\t\t\t132 container\n\t\t\t\t\t\t\t133 image\n\t\t\t\t\t\t\t134 text 无雨\n\t\t\t\t\t\t135 text 信号状态\n\t\t\t\t\t\t136 container\n\t\t\t\t\t\t\t137 image\n\t\t\t\t\t\t\t138 text 良好\n\t\t\t\t\t\t139 text 搜星状态\n\t\t\t\t\t\t140 container\n\t\t\t\t\t\t\t141 image\n\t\t\t\t\t\t\t142 text 36颗\n\t\t\t\t\t143 container\n\t\t\t\t\t\t144 image\n\t\t\t\t\t\t145 heading 无人机已到达, Value: 2\n\t\t\t\t\t\t\t146 text 无人机已到达\n\t\t\t\t\t\t147 heading 是否开始拍摄?, Value: 3\n\t\t\t\t\t\t\t148 text 是否开始拍摄?\n\t\t\t\t\t\t149 text 确认游客站位与取景后开始\n\t\t\t\t\t150 button 开始拍摄\n\t\t\t\t\t\t151 image\n\t\t\t\t\t\t152 text 开始拍摄\n\t\t\t\t\t153 text 安全控制\n\t\t\t\t\t154 button 紧急暂停 悬停待命\n\t\t\t\t\t\t155 image\n\t\t\t\t\t\t156 text 紧急暂停\n\t\t\t\t\t\t157 text 悬停待命\n\t\t\t\t\t158 button 立即返航 中断任务\n\t\t\t\t\t\t159 image\n\t\t\t\t\t\t160 text 立即返航\n\t\t\t\t\t\t161 text 中断任务\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "90-活跃任务返回离页确认", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container 任务仍在执行\n\t\t2 image\n\t\t3 heading 任务仍在执行, Value: 2, ID: task-dialog-title\n\t\t\t4 text 任务仍在执行\n\t\t5 text 离开后将无法实时查看画面与状态。是否离开?\n\t\t6 button 离开页面\n\t\t7 button 继续查看\n\nThe focused UI element is 7 button 继续查看" + }, + { + "name": "91-确认离开回准备且任务保留", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:46\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 返回\n\t\t\t\t\t\t9 image\n\t\t\t\t\t10 heading 拍摄准备, Value: 1\n\t\t\t\t\t\t11 text 拍摄准备\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t16 container\n\t\t\t\t\t17 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t18 text 游客 158****8888\n\t\t\t\t\t19 container\n\t\t\t\t\t\t20 text 含 5 次拍摄\n\t\t\t\t\t21 container\n\t\t\t\t\t\t22 text 已拍摄 3 次\n\t\t\t\t\t23 container\n\t\t\t\t\t\t24 text 剩余 2 次\n\t\t\t\t\t25 heading 拍摄点, Value: 2\n\t\t\t\t\t\t26 text 拍摄点\n\t\t\t\t\t27 container 拍摄点,左右滑动选择\n\t\t\t\t\t\t28 checkbox 三皇寨 范围内 已拍 2 次, Value: 1\n\t\t\t\t\t\t\t29 heading 三皇寨, Value: 3\n\t\t\t\t\t\t\t\t30 text 三皇寨\n\t\t\t\t\t\t\t31 image\n\t\t\t\t\t\t\t32 text 范围内\n\t\t\t\t\t\t\t33 text 已拍 2 次\n\t\t\t\t\t\t34 checkbox 金阙云宫 800 m 已拍 1 次, Value: 0\n\t\t\t\t\t\t\t35 heading 金阙云宫, Value: 3\n\t\t\t\t\t\t\t\t36 text 金阙云宫\n\t\t\t\t\t\t\t37 image\n\t\t\t\t\t\t\t38 text 800 m\n\t\t\t\t\t\t\t39 text 已拍 1 次\n\t\t\t\t\t\t40 checkbox 少室山 1.2 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t41 heading 少室山, Value: 3\n\t\t\t\t\t\t\t\t42 text 少室山\n\t\t\t\t\t\t\t43 image\n\t\t\t\t\t\t\t44 text 1.2 km\n\t\t\t\t\t\t\t45 text 未拍摄\n\t\t\t\t\t\t46 checkbox 迎客峰 1.8 km 未拍摄, Value: 0\n\t\t\t\t\t\t\t47 heading 迎客峰, Value: 3\n\t\t\t\t\t\t\t\t48 text 迎客峰\n\t\t\t\t\t\t\t49 image\n\t\t\t\t\t\t\t50 text 1.8 km\n\t\t\t\t\t\t\t51 text 未拍摄\n\t\t\t\t\t52 heading 三皇寨的航线 共 8 条, Value: 2\n\t\t\t\t\t\t53 text 三皇寨 的航线 共 8 条\n\t\t\t\t\t54 三皇寨的航线\n\t\t\t\t\t\t55 radio button 经典航线, Value: 1\n\t\t\t\t\t\t\t56 image\n\t\t\t\t\t\t\t57 text 经典航线\n\t\t\t\t\t\t\t58 image\n\t\t\t\t\t\t59 radio button 环绕专线, Value: 0\n\t\t\t\t\t\t\t60 image\n\t\t\t\t\t\t\t61 text 环绕专线\n\t\t\t\t\t\t\t62 image\n\t\t\t\t\t\t63 radio button 远景拉升, Value: 0\n\t\t\t\t\t\t\t64 image\n\t\t\t\t\t\t\t65 text 远景拉升\n\t\t\t\t\t\t\t66 image\n\t\t\t\t\t\t67 radio button 全景环绕, Value: 0\n\t\t\t\t\t\t\t68 image\n\t\t\t\t\t\t\t69 text 全景环绕\n\t\t\t\t\t\t\t70 image\n\t\t\t\t\t\t71 radio button 高空俯瞰, Value: 0\n\t\t\t\t\t\t\t72 image\n\t\t\t\t\t\t\t73 text 高空俯瞰\n\t\t\t\t\t\t\t74 image\n\t\t\t\t\t\t75 radio button 山峰渐远, Value: 0\n\t\t\t\t\t\t\t76 image\n\t\t\t\t\t\t\t77 text 山峰渐远\n\t\t\t\t\t\t\t78 image\n\t\t\t\t\t\t79 radio button 峡谷穿行, Value: 0\n\t\t\t\t\t\t\t80 image\n\t\t\t\t\t\t\t81 text 峡谷穿行\n\t\t\t\t\t\t\t82 image\n\t\t\t\t\t\t83 radio button 山脊侧拍, Value: 0\n\t\t\t\t\t\t\t84 image\n\t\t\t\t\t\t\t85 text 山脊侧拍\n\t\t\t\t\t\t\t86 image\n\t\t\t\t87 container\n\t\t\t\t\t88 image\n\t\t\t\t\t89 text 机巢已连接\n\t\t\t\t\t90 image\n\t\t\t\t\t91 text 点位范围内\n\t\t\t\t\t92 heading 三皇寨 · 经典航线, Value: 3\n\t\t\t\t\t\t93 text 三皇寨 · 经典航线\n\t\t\t\t\t94 text 无人机: 占用中 · 电量 95%\n\t\t\t\t\t95 button 继续查看任务\n\t\t\t\t\t96 text 当前订单已有任务执行中,请继续查看原任务\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + }, + { + "name": "92-活跃订单未置顶且卡片仍显示进行中", + "state": "Browser tab: 1, Title: \"机巢 · 页面内交互体验\", URL: \"https://voicestudio.suixinkan.cn/\".\n0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/\n\t1 container\n\t\t2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand\n\t\t3 container\n\t\t\t4 container Device status bar\n\t\t\t\t5 text 2:48\n\t\t\t6 container\n\t\t\t\t7 container\n\t\t\t\t\t8 button 景区空镜库\n\t\t\t\t\t10 heading 机巢工作台, Value: 1\n\t\t\t\t\t\t11 text 机巢工作台\n\t\t\t\t\t98 button 收款码\n\t\t\t\t\t\t99 image\n\t\t\t\t\t\t100 text 收款码\n\t\t\t\t12 text 交互原型 · 无真实操作\n\t\t\t\t13 button 体验本页其他状态\n\t\t\t\t\t14 image\n\t\t\t\t\t15 text 体验其他状态\n\t\t\t\t101 container\n\t\t\t\t\t102 text 嵩山少林景区 · 吴家俊\n\t\t\t\t\t103 container 无人机设备状态\n\t\t\t\t\t\t104 container 左右滑动查看无人机\n\t\t\t\t\t\t\t105 container 01号无人机\n\t\t\t\t\t\t\t\t106 container 01号无人机的六项状态\n\t\t\t\t\t\t\t\t\t107 heading 01号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t108 text 01号无人机\n\t\t\t\t\t\t\t\t\t109 text 占用中\n\t\t\t\t\t\t\t\t\t110 level indicator Description: 电池电量, Value: 95\n\t\t\t\t\t\t\t\t\t111 image\n\t\t\t\t\t\t\t\t\t112 text 信号状态\n\t\t\t\t\t\t\t\t\t113 text 良好\n\t\t\t\t\t\t\t\t\t114 image\n\t\t\t\t\t\t\t\t\t115 text 搜星状态\n\t\t\t\t\t\t\t\t\t116 container\n\t\t\t\t\t\t\t\t\t\t117 text 36 颗\n\t\t\t\t\t\t\t\t\t118 container\n\t\t\t\t\t\t\t\t\t\t119 text 19.3 °C\n\t\t\t\t\t\t\t\t\t120 image\n\t\t\t\t\t\t\t\t\t121 text 环境温度\n\t\t\t\t\t\t\t\t\t122 container\n\t\t\t\t\t\t\t\t\t\t123 text 0 m/s\n\t\t\t\t\t\t\t\t\t124 image\n\t\t\t\t\t\t\t\t\t125 text 风速\n\t\t\t\t\t\t\t\t\t126 text 无雨\n\t\t\t\t\t\t\t\t\t127 image\n\t\t\t\t\t\t\t\t\t128 text 雨量\n\t\t\t\t\t\t\t129 container 02号无人机\n\t\t\t\t\t\t\t\t130 container 02号无人机的六项状态\n\t\t\t\t\t\t\t\t\t131 heading 02号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t132 text 02号无人机\n\t\t\t\t\t\t\t\t\t133 text 占用中\n\t\t\t\t\t\t\t\t\t134 level indicator Description: 电池电量, Value: 72\n\t\t\t\t\t\t\t\t\t135 image\n\t\t\t\t\t\t\t\t\t136 text 信号状态\n\t\t\t\t\t\t\t\t\t137 text 良好\n\t\t\t\t\t\t\t\t\t138 image\n\t\t\t\t\t\t\t\t\t139 text 搜星状态\n\t\t\t\t\t\t\t\t\t140 container\n\t\t\t\t\t\t\t\t\t\t141 text 32 颗\n\t\t\t\t\t\t\t\t\t142 container\n\t\t\t\t\t\t\t\t\t\t143 text 20.1 °C\n\t\t\t\t\t\t\t\t\t144 image\n\t\t\t\t\t\t\t\t\t145 text 环境温度\n\t\t\t\t\t\t\t\t\t146 container\n\t\t\t\t\t\t\t\t\t\t147 text 1.2 m/s\n\t\t\t\t\t\t\t\t\t148 image\n\t\t\t\t\t\t\t\t\t149 text 风速\n\t\t\t\t\t\t\t\t\t150 text 无雨\n\t\t\t\t\t\t\t\t\t151 image\n\t\t\t\t\t\t\t\t\t152 text 雨量\n\t\t\t\t\t\t\t153 container 03号无人机\n\t\t\t\t\t\t\t\t154 container 03号无人机的六项状态\n\t\t\t\t\t\t\t\t\t155 heading 03号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t156 text 03号无人机\n\t\t\t\t\t\t\t\t\t157 text 未连接\n\t\t\t\t\t\t\t\t\t158 container 电池电量未知\n\t\t\t\t\t\t\t\t\t159 image\n\t\t\t\t\t\t\t\t\t160 text 信号状态\n\t\t\t\t\t\t\t\t\t161 text —\n\t\t\t\t\t\t\t\t\t162 image\n\t\t\t\t\t\t\t\t\t163 text 搜星状态\n\t\t\t\t\t\t\t\t\t164 text —\n\t\t\t\t\t\t\t\t\t165 text —\n\t\t\t\t\t\t\t\t\t166 image\n\t\t\t\t\t\t\t\t\t167 text 环境温度\n\t\t\t\t\t\t\t\t\t168 text —\n\t\t\t\t\t\t\t\t\t169 image\n\t\t\t\t\t\t\t\t\t170 text 风速\n\t\t\t\t\t\t\t\t\t171 text —\n\t\t\t\t\t\t\t\t\t172 image\n\t\t\t\t\t\t\t\t\t173 text 雨量\n\t\t\t\t\t\t\t174 container 04号无人机\n\t\t\t\t\t\t\t\t175 container 04号无人机的六项状态\n\t\t\t\t\t\t\t\t\t176 heading 04号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t177 text 04号无人机\n\t\t\t\t\t\t\t\t\t178 text 低电量\n\t\t\t\t\t\t\t\t\t179 level indicator Description: 电池电量, Value: 18\n\t\t\t\t\t\t\t\t\t180 image\n\t\t\t\t\t\t\t\t\t181 text 信号状态\n\t\t\t\t\t\t\t\t\t182 text 良好\n\t\t\t\t\t\t\t\t\t183 image\n\t\t\t\t\t\t\t\t\t184 text 搜星状态\n\t\t\t\t\t\t\t\t\t185 container\n\t\t\t\t\t\t\t\t\t\t186 text 34 颗\n\t\t\t\t\t\t\t\t\t187 container\n\t\t\t\t\t\t\t\t\t\t188 text 19.8 °C\n\t\t\t\t\t\t\t\t\t189 image\n\t\t\t\t\t\t\t\t\t190 text 环境温度\n\t\t\t\t\t\t\t\t\t191 container\n\t\t\t\t\t\t\t\t\t\t192 text 0.6 m/s\n\t\t\t\t\t\t\t\t\t193 image\n\t\t\t\t\t\t\t\t\t194 text 风速\n\t\t\t\t\t\t\t\t\t195 text 无雨\n\t\t\t\t\t\t\t\t\t196 image\n\t\t\t\t\t\t\t\t\t197 text 雨量\n\t\t\t\t\t\t\t198 container 05号无人机\n\t\t\t\t\t\t\t\t199 container 05号无人机的六项状态\n\t\t\t\t\t\t\t\t\t200 heading 05号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t201 text 05号无人机\n\t\t\t\t\t\t\t\t\t202 text 空闲\n\t\t\t\t\t\t\t\t\t203 level indicator Description: 电池电量, Value: 88\n\t\t\t\t\t\t\t\t\t204 image\n\t\t\t\t\t\t\t\t\t205 text 信号状态\n\t\t\t\t\t\t\t\t\t206 text 良好\n\t\t\t\t\t\t\t\t\t207 image\n\t\t\t\t\t\t\t\t\t208 text 搜星状态\n\t\t\t\t\t\t\t\t\t209 container\n\t\t\t\t\t\t\t\t\t\t210 text 35 颗\n\t\t\t\t\t\t\t\t\t211 container\n\t\t\t\t\t\t\t\t\t\t212 text 20.3 °C\n\t\t\t\t\t\t\t\t\t213 image\n\t\t\t\t\t\t\t\t\t214 text 环境温度\n\t\t\t\t\t\t\t\t\t215 container\n\t\t\t\t\t\t\t\t\t\t216 text 0.8 m/s\n\t\t\t\t\t\t\t\t\t217 image\n\t\t\t\t\t\t\t\t\t218 text 风速\n\t\t\t\t\t\t\t\t\t219 text 无雨\n\t\t\t\t\t\t\t\t\t220 image\n\t\t\t\t\t\t\t\t\t221 text 雨量\n\t\t\t\t\t\t\t222 container 06号无人机\n\t\t\t\t\t\t\t\t223 container 06号无人机的六项状态\n\t\t\t\t\t\t\t\t\t224 heading 06号无人机, Value: 3\n\t\t\t\t\t\t\t\t\t\t225 text 06号无人机\n\t\t\t\t\t\t\t\t\t226 text 无信号\n\t\t\t\t\t\t\t\t\t227 container 电池电量未知\n\t\t\t\t\t\t\t\t\t228 image\n\t\t\t\t\t\t\t\t\t229 text 信号状态\n\t\t\t\t\t\t\t\t\t230 text 无信号\n\t\t\t\t\t\t\t\t\t231 image\n\t\t\t\t\t\t\t\t\t232 text 搜星状态\n\t\t\t\t\t\t\t\t\t233 text —\n\t\t\t\t\t\t\t\t\t234 text —\n\t\t\t\t\t\t\t\t\t235 image\n\t\t\t\t\t\t\t\t\t236 text 环境温度\n\t\t\t\t\t\t\t\t\t237 text —\n\t\t\t\t\t\t\t\t\t238 image\n\t\t\t\t\t\t\t\t\t239 text 风速\n\t\t\t\t\t\t\t\t\t240 text —\n\t\t\t\t\t\t\t\t\t241 image\n\t\t\t\t\t\t\t\t\t242 text 雨量\n\t\t\t\t\t\t243 container 当前无人机\n\t\t\t\t\t\t\t244 button 查看01号无人机\n\t\t\t\t\t\t\t245 button 查看02号无人机\n\t\t\t\t\t\t\t246 button 查看03号无人机\n\t\t\t\t\t\t\t247 button 查看04号无人机\n\t\t\t\t\t\t\t248 button 查看05号无人机\n\t\t\t\t\t\t\t249 button 查看06号无人机\n\t\t\t\t\t250 heading 我的拍摄订单 8, Value: 2\n\t\t\t\t\t\t251 text 我的拍摄订单 8\n\t\t\t\t\t252 button 查看全部\n\t\t\t\t\t\t253 text 查看全部\n\t\t\t\t\t\t254 image\n\t\t\t\t\t255 container\n\t\t\t\t\t\t256 heading 游客158****2026, Value: 2\n\t\t\t\t\t\t\t257 text 游客 158****2026\n\t\t\t\t\t\t258 text 待拍摄 航拍套餐 · 含 5 次拍摄 已拍摄 0 / 5 次 · 剩余 5 次\n\t\t\t\t\t\t259 button 开始拍摄\n\t\t\t\t\t260 container\n\t\t\t\t\t\t261 heading 游客158****8888, Value: 2\n\t\t\t\t\t\t\t262 text 游客 158****8888\n\t\t\t\t\t\t263 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 / 5 次 · 剩余 2 次\n\t\t\t\t\t\t264 button 继续查看任务\n\t\t\t\t\t\t265 image\n\t\t\t\t\t\t266 text 素材 上传中\n\t\t\t\t\t\t267 button 查看素材\n\t\t\t\t\t\t\t268 text 查看素材\n\t\t\t\t\t\t\t269 image\n\t\t\t\t\t270 container\n\t\t\t\t\t\t271 heading 游客139****5192, Value: 2\n\t\t\t\t\t\t\t272 text 游客 139****5192\n\t\t\t\t\t\t273 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 / 5 次 · 剩余 3 次\n\t\t\t\t\t\t274 button 继续拍摄\n\t\t\t\t\t\t275 image\n\t\t\t\t\t\t276 text 素材 上传失败\n\t\t\t\t\t\t277 button 查看素材\n\t\t\t\t\t\t\t278 text 查看素材\n\t\t\t\t\t\t\t279 image\n\t\t\t\t\t280 heading 今日数据, Value: 2\n\t\t\t\t\t\t281 text 今日数据\n\t\t\t\t\t282 text 12\n\t\t\t\t\t283 text 成交订单\n\t\t\t\t\t284 text ¥1,896\n\t\t\t\t\t285 text 成交金额\n\t\t\t\t\t286 text 9\n\t\t\t\t\t287 text 完成拍摄\n\t\t\t97 image\n\nThe focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/" + } + ] +} \ No newline at end of file diff --git a/docs/9.9.1/prototype-audit-2026-10-26/payment-order-tab.png b/docs/9.9.1/prototype-audit-2026-10-26/payment-order-tab.png new file mode 100644 index 0000000..000b670 Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/payment-order-tab.png differ diff --git a/docs/9.9.1/prototype-audit-2026-10-26/scenic-materials.png b/docs/9.9.1/prototype-audit-2026-10-26/scenic-materials.png new file mode 100644 index 0000000..8cb0f5c Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/scenic-materials.png differ diff --git a/docs/9.9.1/prototype-audit-2026-10-26/scenic-permission.png b/docs/9.9.1/prototype-audit-2026-10-26/scenic-permission.png new file mode 100644 index 0000000..27aa605 Binary files /dev/null and b/docs/9.9.1/prototype-audit-2026-10-26/scenic-permission.png differ diff --git a/docs/9.9.1/review/build-report.cjs b/docs/9.9.1/review/build-report.cjs new file mode 100644 index 0000000..4c56b36 --- /dev/null +++ b/docs/9.9.1/review/build-report.cjs @@ -0,0 +1,11 @@ +const fs=require('fs'); +const path=require('path'); +const b=__dirname; +const manifest=JSON.parse(fs.readFileSync(path.join(b,'manifest.json'),'utf8')); +const fragment=fs.readFileSync(path.join(b,'state-flows.html'),'utf8'); +let content=fs.readFileSync(path.join(b,'review-content.html'),'utf8'); +const links=manifest.flows.map(f=>`
    ${f.name} · ${f.states.length} 个状态

    ${f.note}

    ${f.name},各界面按从左到右排列

    ${f.states.map(s=>s.label).join(' | ')}

    查看高清整图
    `).join('\n'); +content=content.replace('
    ',`
    ${links}
    `).replace('
    ',fragment); +const css=`*{box-sizing:border-box}body{margin:0;background:#f3f6fa;color:#1b2c45;font-family:-apple-system,BlinkMacSystemFont,'PingFang SC',sans-serif;font-size:15px;line-height:1.8}.review{max-width:1240px;padding:50px 36px;margin:auto}.review header{padding:30px 0 24px}.review h1{font-size:34px;line-height:1.4;letter-spacing:-.6px;margin:10px 0 20px;max-width:920px}.review h2{font-size:23px;margin:0 0 18px;line-height:1.5}.review p{margin:10px 0}.eyebrow{color:#0073ff;font-size:13px;letter-spacing:1px;font-weight:600}.muted{color:#637188;font-size:13px}.review section{padding:30px 0;border-bottom:1px solid #dee6f0;scroll-margin-top:20px}.review a{color:#006ce9;text-decoration:none}.review a:hover{text-decoration:underline}.reportnav{display:flex;flex-wrap:wrap;gap:10px 22px;border-top:1px solid #dce5ef;border-bottom:1px solid #dce5ef;padding:17px 0}.chain{padding:22px;background:#e7f1ff;color:#17558f;border-radius:12px;line-height:2.1}.callout{padding:15px 18px;background:#fff3e0;color:#88571f;border-radius:10px}.review table{width:100%;border-collapse:collapse;background:#fff;margin:14px 0;line-height:1.8;font-size:14px}.review th,.review td{padding:13px 15px;text-align:left;vertical-align:top;border-bottom:1px solid #e5ebf3}.review th{background:#eaf0f7;font-weight:600}.review td:first-child{min-width:150px}.review li{margin:9px 0}.review code{font-size:12px;overflow-wrap:anywhere;white-space:normal}.review details{margin-bottom:20px;border:1px solid #dce6f2;padding:15px;border-radius:12px;background:#fff}.review summary{color:#173d71;font-weight:600;cursor:pointer}.sheet{display:block;width:100%;height:auto;margin:14px 0;border:1px solid #e1e8f2;border-radius:7px}.review footer{padding-top:25px;color:#6b7d94;font-size:12px}.review #sxk991{color:#18243a}.review #sxk991 .form-select{font:inherit;padding:8px 10px;border:1px solid #ccd9e8;border-radius:6px;background:#fff;color:#183357}.review #sxk991 .form-label{font-size:14px}.review #sxk991 .strip{background-image:radial-gradient(#cdd7e3 .6px,transparent .6px);background-size:12px 12px} @media(max-width:700px){.review{padding:22px 16px}.review h1{font-size:25px}.review h2{font-size:21px}.review table{font-size:12px}.review td,.review th{padding:9px 8px}.review td:first-child{min-width:80px}.review section{overflow-x:auto}.review header{padding:15px 0}.review #sxk991{min-width:0}}@media print{body{background:white}.review{padding:0;max-width:none}.reportnav,#interactive{display:none}.review section{break-inside:avoid}.review details{break-inside:avoid}a{color:inherit}}`; +fs.writeFileSync(path.join(b,'review.html'),`随心瞰 9.9.1 · 需求流程评审与横向状态截图
    ${content}
    `); +console.log(JSON.stringify({report:path.join(b,'review.html'),flows:manifest.flowCount,screens:manifest.screenCount,bytes:fs.statSync(path.join(b,'review.html')).size})); diff --git a/docs/9.9.1/review/flows/01-sales.png b/docs/9.9.1/review/flows/01-sales.png new file mode 100644 index 0000000..89f4fc8 Binary files /dev/null and b/docs/9.9.1/review/flows/01-sales.png differ diff --git a/docs/9.9.1/review/flows/02-shooting.png b/docs/9.9.1/review/flows/02-shooting.png new file mode 100644 index 0000000..07635cf Binary files /dev/null and b/docs/9.9.1/review/flows/02-shooting.png differ diff --git a/docs/9.9.1/review/flows/03-pause-return.png b/docs/9.9.1/review/flows/03-pause-return.png new file mode 100644 index 0000000..d181976 Binary files /dev/null and b/docs/9.9.1/review/flows/03-pause-return.png differ diff --git a/docs/9.9.1/review/flows/04-failure.png b/docs/9.9.1/review/flows/04-failure.png new file mode 100644 index 0000000..cfbb364 Binary files /dev/null and b/docs/9.9.1/review/flows/04-failure.png differ diff --git a/docs/9.9.1/review/flows/05-network-command.png b/docs/9.9.1/review/flows/05-network-command.png new file mode 100644 index 0000000..b2b04da Binary files /dev/null and b/docs/9.9.1/review/flows/05-network-command.png differ diff --git a/docs/9.9.1/review/flows/06-readiness.png b/docs/9.9.1/review/flows/06-readiness.png new file mode 100644 index 0000000..ca5e3ef Binary files /dev/null and b/docs/9.9.1/review/flows/06-readiness.png differ diff --git a/docs/9.9.1/review/flows/07-quota.png b/docs/9.9.1/review/flows/07-quota.png new file mode 100644 index 0000000..d154778 Binary files /dev/null and b/docs/9.9.1/review/flows/07-quota.png differ diff --git a/docs/9.9.1/review/flows/08-media.png b/docs/9.9.1/review/flows/08-media.png new file mode 100644 index 0000000..a338d44 Binary files /dev/null and b/docs/9.9.1/review/flows/08-media.png differ diff --git a/docs/9.9.1/review/flows/09-commerce-exceptions.png b/docs/9.9.1/review/flows/09-commerce-exceptions.png new file mode 100644 index 0000000..77caf8c Binary files /dev/null and b/docs/9.9.1/review/flows/09-commerce-exceptions.png differ diff --git a/docs/9.9.1/review/flows/10-web.png b/docs/9.9.1/review/flows/10-web.png new file mode 100644 index 0000000..8781d2b Binary files /dev/null and b/docs/9.9.1/review/flows/10-web.png differ diff --git a/docs/9.9.1/review/flows/11-workbench-resume.png b/docs/9.9.1/review/flows/11-workbench-resume.png new file mode 100644 index 0000000..4bafb17 Binary files /dev/null and b/docs/9.9.1/review/flows/11-workbench-resume.png differ diff --git a/docs/9.9.1/review/flows/12-workbench-task-states.png b/docs/9.9.1/review/flows/12-workbench-task-states.png new file mode 100644 index 0000000..580da31 Binary files /dev/null and b/docs/9.9.1/review/flows/12-workbench-task-states.png differ diff --git a/docs/9.9.1/review/manifest.json b/docs/9.9.1/review/manifest.json new file mode 100644 index 0000000..83adfcb --- /dev/null +++ b/docs/9.9.1/review/manifest.json @@ -0,0 +1,796 @@ +{ + "generatedAt": "2026-10-21", + "type": "static UI review mockups", + "flowCount": 12, + "screenCount": 68, + "flows": [ + { + "id": "01-sales", + "name": "01 销售收款与订单建立", + "note": "整个销售前置链路为建议稿;支付方式、付款码类型和订单分配机制待确认。", + "states": [ + { + "id": "sales-packages", + "label": "选择可售套餐", + "kind": "sale", + "mode": "list", + "proposed": true, + "caption": "套餐名称、价格与次数来自上架版本。空态、加载失败和下架另列验收。" + }, + { + "id": "sales-detail", + "label": "核对套餐信息", + "kind": "sale", + "mode": "detail", + "proposed": true, + "caption": "同点可重复拍摄;适用点位、航线范围及有效期须随套餐确认。" + }, + { + "id": "sales-unpaid", + "label": "展示收款码 · 待支付", + "kind": "sale", + "mode": "unpaid", + "proposed": true, + "caption": "付款会话与套餐、销售、景区关联方式待确认。示意码不可支付。" + }, + { + "id": "sales-confirming", + "label": "游客反馈已付款 · 核验中", + "kind": "sale", + "mode": "confirming", + "proposed": true, + "caption": "只以服务端支付结果为准;回调延迟不应再次收款。" + }, + { + "id": "sales-assignment", + "label": "已支付 · 待分配", + "kind": "sale", + "mode": "assigned", + "proposed": true, + "caption": "此处分配为待确认分支;若自动归属当前销售,可直接进入可拍摄订单。" + }, + { + "id": "sales-order", + "label": "已归属本人 · 待拍摄", + "kind": "sale", + "mode": "order", + "proposed": true, + "caption": "进入已分配订单;原有游客自助下单继续汇入同一履约入口。" + } + ] + }, + { + "id": "02-shooting", + "name": "02 正常召唤与拍摄", + "note": "额度示例连续:总5次、已3次、剩2次;本次成功后已4次、剩1次,三皇寨由2次变3次。", + "states": [ + { + "id": "workbench-home", + "label": "机巢工作台 · 从订单进入", + "kind": "workbench", + "caption": "查看设备状态与分配给自己的订单;必须从订单进入拍摄准备,不创建无订单任务。" + }, + { + "id": "prepare-ready", + "label": "点位、航线与执行条件满足", + "kind": "prepare", + "mode": "ready", + "caption": "恢复有效选择;准备页不放紧急暂停、返航操作。" + }, + { + "id": "summoning", + "label": "提交召唤中", + "kind": "prepare", + "mode": "submitting", + "caption": "锁定本次点位和航线,防重复提交;点击不代表已经起飞。" + }, + { + "id": "flight-outbound", + "label": "召唤确认 · 前往点位", + "kind": "flight", + "mode": "outbound", + "caption": "已建立同一任务;仅展示设备确认的飞行阶段。" + }, + { + "id": "flight-arrived", + "label": "已到达 · 等待开始", + "kind": "flight", + "mode": "arrived", + "caption": "只有确认到达且设备允许,开始拍摄才可点击。" + }, + { + "id": "flight-shooting", + "label": "开始指令确认 · 拍摄中", + "kind": "flight", + "mode": "shooting", + "caption": "开始指令反馈见第05组;此时尚未扣次数。" + }, + { + "id": "flight-success", + "label": "拍摄成功 · 更新次数", + "kind": "flight", + "mode": "success", + "caption": "成功与返航独立。设备本次已返航,不预设自动返航策略;导航入口待确认。" + } + ] + }, + { + "id": "03-pause-return", + "name": "03 暂停、恢复与返航", + "note": "恢复目标必须与暂停前阶段一致。拍摄恢复方式、普通/保护返航是否可暂停,必须以设备能力为准。", + "states": [ + { + "id": "pause-pending", + "label": "请求暂停 · 等待确认", + "kind": "flight", + "mode": "pausing", + "caption": "暂停处理中不等于已悬停;安全操作按独立设备能力决定。" + }, + { + "id": "pause-confirmed", + "label": "拍摄已暂停 · 悬停", + "kind": "flight", + "mode": "paused", + "caption": "保留原任务身份与拍摄结果;未确认成功不扣次数。" + }, + { + "id": "resume-pending", + "label": "请求恢复原阶段", + "kind": "flight", + "mode": "resuming", + "proposed": true, + "caption": "补齐恢复指令的处理中、待确认、拒绝与成功;不可按点击直接续拍。" + }, + { + "id": "return-active", + "label": "明确返航 · 返航中", + "kind": "flight", + "mode": "returning", + "caption": "示例为拍摄成功后手动返航;是否自动返航仍需确认。" + }, + { + "id": "return-paused", + "label": "返航被暂停 · 继续返航", + "kind": "flight", + "mode": "returnpaused", + "proposed": true, + "caption": "仅设备允许暂停返航时适用;恢复目标是返航,不能重新拍摄。" + }, + { + "id": "dock-recovering", + "label": "已回巢 · 设备准备中", + "kind": "prepare", + "mode": "recovering", + "proposed": true, + "caption": "落地或回巢不自动等于可再次执行;设备明确放行后再启用召唤。" + } + ], + "imagePath": "regenerated-03/03-pause-return-full.png", + "exportVerified": { + "method": "six complete individual viewport captures assembled into one horizontal image", + "width": 5232, + "height": 2324, + "stateCount": 6, + "footerVisible": true + } + }, + { + "id": "04-failure", + "name": "04 指令拒绝、任务失败与重试", + "note": "含三个并列分支:开始指令被拒、任务失败后恢复、设备保护返航。分支之间不表示自动跳转。", + "states": [ + { + "id": "command-rejected", + "label": "开始指令被拒绝", + "kind": "flight", + "mode": "rejected", + "proposed": true, + "caption": "仍在原任务待命,不必一律宣布任务失败。能否重试开始按设备返回能力。" + }, + { + "id": "failure-returning", + "branchStart": true, + "label": "任务确认失败 · 仍在返航", + "kind": "flight", + "mode": "failedreturn", + "caption": "显示真实失败原因,禁用重新召唤;关闭弹窗不自动重试。" + }, + { + "id": "failure-ready", + "label": "失败结果保留 · 设备可用", + "kind": "flight", + "mode": "failedready", + "caption": "确认原任务已终结且设备放行,才可返回准备页发起新任务。" + }, + { + "id": "retry-prepare", + "label": "返回准备 · 保留原选择", + "kind": "prepare", + "mode": "retry", + "caption": "失败不扣次数;当前条件需重新检查,不能沿用过期设备状态。" + }, + { + "id": "protection-return", + "branchStart": true, + "label": "设备保护返航 · 结果待确认", + "kind": "flight", + "mode": "protection", + "caption": "示例原因由设备报告;返航不直接代表拍摄失败或成功。" + } + ] + }, + { + "id": "05-network-command", + "name": "05 连接中断与指令结果未知", + "note": "包含图传、手机断网恢复、开始指令超时、恢复指令超时四个分支。超时或离页不能代替任务结果。", + "states": [ + { + "id": "stream-only-lost", + "label": "仅图传断流", + "kind": "flight", + "mode": "streamlost", + "caption": "任务与控制仍在线;仅重新连接画面,不新建拍摄任务。" + }, + { + "id": "phone-offline", + "branchStart": true, + "label": "手机断网 · 状态未知", + "kind": "flight", + "mode": "offline", + "caption": "六项实时读数为—并标记未更新;不能发送的控制置灰。" + }, + { + "id": "task-syncing", + "label": "恢复网络 · 同步原任务", + "kind": "flight", + "mode": "syncing", + "proposed": true, + "caption": "先同步任务、命令和次数。同步完成前不能再次召唤。" + }, + { + "id": "start-command-pending", + "branchStart": true, + "label": "开始指令处理中", + "kind": "flight", + "mode": "starting", + "caption": "防重复开始;是否允许返航按独立设备能力决定。" + }, + { + "id": "start-command-unknown", + "label": "超时 · 执行结果待确认", + "kind": "flight", + "mode": "unknown", + "caption": "同步同一任务与指令,不假定失败或再次开始。召唤、暂停、返航同理。" + }, + { + "id": "resume-command-unknown", + "branchStart": true, + "label": "恢复指令结果待确认", + "kind": "flight", + "mode": "resumeunknown", + "proposed": true, + "caption": "补齐原组件状态板缺少的恢复指令;同步后才能确定继续拍摄或仍悬停。" + } + ] + }, + { + "id": "06-readiness", + "name": "06 拍摄准备的阻断与恢复", + "note": "各图表示独立分支样例;这组按检查次序横向排列,不表示会自动依次发生。", + "states": [ + { + "id": "prepare-no-selection", + "label": "尚未选点位或航线", + "kind": "prepare", + "mode": "unselected", + "caption": "分别提示缺少点位/航线;无航线时清空该点失效选择。" + }, + { + "id": "prepare-location", + "branchStart": true, + "label": "定位未知 / 范围外", + "kind": "prepare", + "mode": "location", + "caption": "范围外仍可选点浏览;定位拒权、关闭、失败需给恢复入口。" + }, + { + "id": "prepare-busy", + "branchStart": true, + "label": "设备占用 · 不制造倒计时", + "kind": "prepare", + "mode": "busy", + "caption": "他人占用不可召唤;本订单任务则改为查看当前任务。" + }, + { + "id": "prepare-unavailable", + "branchStart": true, + "label": "设备不允许执行", + "kind": "prepare", + "mode": "unavailable", + "caption": "示例设备报告电量不足;不自行规定低电量阈值。" + }, + { + "id": "prepare-existing", + "branchStart": true, + "label": "本订单已有执行中任务", + "kind": "prepare", + "mode": "existing", + "caption": "进入原任务;后台、重进和重新登录后同样先查原任务。" + }, + { + "id": "prepare-empty", + "branchStart": true, + "label": "点位暂无可用航线", + "kind": "prepare", + "mode": "empty", + "caption": "无点位、已下线和航线失效需同样说明原因,不强行恢复同名航线。" + } + ] + }, + { + "id": "07-quota", + "name": "07 次数结算与订单终态", + "note": "前三图连续:最后一次→成功待结算→已5剩0。转交、退款为并列异常分支,沿用额度耗尽示例,不表示自动退款。", + "states": [ + { + "id": "quota-last", + "label": "订单剩余最后一次", + "kind": "prepare", + "mode": "last", + "caption": "同点可重复;两客户端同时争抢最后一次,服务端只允许一个有效执行。" + }, + { + "id": "quota-settling", + "label": "拍摄已成功 · 次数同步中", + "kind": "flight", + "mode": "settling", + "proposed": true, + "caption": "成功与次数落账分开表达;同步完成前禁用新任务,不自行再次扣减。" + }, + { + "id": "quota-zero", + "label": "额度耗尽 · 素材仍上传", + "kind": "sale", + "mode": "zero", + "proposed": true, + "caption": "不可再召唤,但素材查看入口保留。“已完成”的定义需确认。" + }, + { + "id": "order-transferred", + "branchStart": true, + "label": "订单已转交 / 当前人无权限", + "kind": "sale", + "mode": "transfer", + "proposed": true, + "caption": "禁止新任务;若无人机仍在飞行,必须有授权接管和安全控制通道。" + }, + { + "id": "order-refunding", + "branchStart": true, + "label": "订单退款中 / 不可新拍", + "kind": "sale", + "mode": "refund", + "proposed": true, + "caption": "仅展示后台可能产生的状态示例;本版是否支持退款及冻结规则待确认。" + } + ] + }, + { + "id": "08-media", + "name": "08 素材上传、下载与保存", + "note": "拍摄结果、素材上传、文件下载、保存相册分别表达;文件示意不代表真实产出数量。", + "states": [ + { + "id": "media-uploading", + "label": "拍摄成功 · 素材上传中", + "kind": "media", + "mode": "uploading", + "caption": "未知进度不造百分比;尚无条目不能误写成没有素材。" + }, + { + "id": "media-upload-partial", + "label": "部分已就绪 · 部分上传失败", + "kind": "media", + "mode": "uploadpartial", + "proposed": true, + "caption": "已就绪可下载;失败项的重传责任、最终不可恢复时如何交付需确认。" + }, + { + "id": "media-ready", + "label": "素材就绪 · 四份全选", + "kind": "media", + "mode": "ready", + "caption": "总开关、四张卡与底部数量一致;已修正原图全选空圈。" + }, + { + "id": "media-saving", + "label": "下载与写入相册进行中", + "kind": "media", + "mode": "saving", + "caption": "离页停止下载已有设计;切后台、锁屏、重启后的行为仍待确认。" + }, + { + "id": "media-download-partial", + "label": "三份已保存 · 一份失败", + "kind": "media", + "mode": "partial", + "caption": "只重试失败一份;已保存不重复处理,不影响拍摄次数。" + }, + { + "id": "media-saved", + "label": "四份已保存到本机相册", + "kind": "media", + "mode": "saved", + "caption": "“已下载”应以成功写入本机为准;不等于已经交付游客。" + } + ] + }, + { + "id": "09-commerce-exceptions", + "name": "09 收款与交付异常分支", + "note": "支付状态为建议补充;相册拒权原稿已有。各状态是并列异常分支,不代表一条必经顺序。", + "states": [ + { + "id": "payment-code-failed", + "label": "收款码生成失败", + "kind": "sale", + "mode": "codefailed", + "proposed": true, + "caption": "可重试取码;若已生成交易,必须沿用或核验原支付会话。" + }, + { + "id": "payment-code-expired", + "branchStart": true, + "label": "收款码失效 · 核验原付款", + "kind": "sale", + "mode": "expired", + "proposed": true, + "caption": "建议核验原交易后再获取新码;回调延迟不应引导游客重复付款。" + }, + { + "id": "package-unavailable", + "branchStart": true, + "label": "结算时套餐已变更", + "kind": "sale", + "mode": "changed", + "proposed": true, + "caption": "停售或新价格需重新确认;已支付订单保留购买时的权益快照。" + }, + { + "id": "photo-permission-denied", + "branchStart": true, + "label": "相册权限不足", + "kind": "media", + "mode": "permission", + "caption": "保留所选素材;返回设置授权后先校验权限再继续。" + }, + { + "id": "photo-storage-full", + "branchStart": true, + "label": "文件下载成功 · 相册保存失败", + "kind": "media", + "mode": "storage", + "proposed": true, + "caption": "区分网络失败、存储不足和写入失败;未成功保存不标记已下载。" + } + ] + }, + { + "id": "10-web", + "name": "10 Web 配套套餐生命周期", + "note": "后台均为建议补充稿:适用范围、上下架、历史订单快照、并发更新规则需先确认。", + "states": [ + { + "id": "web-draft", + "label": "草稿 · 完善套餐配置", + "kind": "web", + "mode": "draft", + "proposed": true, + "caption": "配置名称、价格、次数、适用范围;发布前服务端校验。" + }, + { + "id": "web-validation", + "label": "发布校验不通过", + "kind": "web", + "mode": "validation", + "proposed": true, + "caption": "必填缺失、无可执行点位航线或价格次数无效时明确阻断。" + }, + { + "id": "web-published", + "label": "上架 · App 可售", + "kind": "web", + "mode": "published", + "proposed": true, + "caption": "App 按上架版本销售;订单记录购买时套餐与权益快照。" + }, + { + "id": "web-modified", + "label": "修改并发布新版本", + "kind": "web", + "mode": "modified", + "proposed": true, + "caption": "建议新订单使用新版本;不回写既有已付订单权益。" + }, + { + "id": "web-offline", + "label": "下架 · 停止新售", + "kind": "web", + "mode": "offline", + "proposed": true, + "caption": "建议停止新售并保留已售履约;已引用套餐的删除限制待确认。" + } + ] + }, + { + "id": "11-workbench-resume", + "name": "11 任务页返回工作台与重新进入", + "note": "已确认:执行中点击返回直接回工作台,不弹确认;当前任务订单置顶,显示状态和查看当前任务。保留原卡片样式,仅改按钮标题并在右上角显示状态,不展示点位。前三屏为同一任务,最后一屏为成功返航分支。", + "states": [ + { + "id": "task-before-leave", + "label": "拍摄中 · 点击左上角返回", + "kind": "flight", + "mode": "shooting", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "直接返回机巢工作台;离开页面不取消任务、不重发指令、不扣次数。" + }, + { + "id": "workbench-ongoing-pinned", + "label": "回到工作台 · 当前任务订单置顶", + "kind": "workbench", + "phase": "shooting", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "当前用户当前景区的订单中,任务订单置顶;右上角显示拍摄中,按钮为查看当前任务;保留原卡片横向布局,不展示点位或航线。" + }, + { + "id": "task-after-reenter", + "label": "查看当前任务 · 回到原任务", + "kind": "flight", + "mode": "shooting", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "继续查看同一订单、同一次任务;不重新进入准备,不创建第二次拍摄。" + }, + { + "id": "workbench-success-returning", + "label": "成功后仍返航 · 两种状态同时显示", + "kind": "workbench", + "phase": "returning", + "result": "success", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "拍摄已完成与无人机返航中同时展示;已拍4次、剩1次,仍保留查看当前任务。" + } + ], + "imagePath": "flows/11-workbench-resume.png", + "exportVerified": { + "method": "individual complete screen captures composed horizontally", + "width": 3496, + "height": 2368, + "stateCount": 4, + "footerVisible": true + } + }, + { + "id": "12-workbench-task-states", + "name": "12 工作台订单卡片的任务状态提示", + "note": "七屏为同一订单在不同状态下的独立示例。保留原卡片横向布局及右侧按钮,仅替换为查看当前任务并在右上角显示状态;卡片不展示点位与航线。", + "states": [ + { + "id": "workbench-status-outbound", + "label": "前往点位 · 前往拍摄点中", + "kind": "workbench", + "phase": "outbound", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "右上角显示前往拍摄点中;查看当前任务回到原任务页面。" + }, + { + "id": "workbench-status-arrived", + "label": "已到达 · 待拍摄", + "kind": "workbench", + "phase": "arrived", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示已到达,待拍摄;开始拍摄操作仍在任务页,不直接放到订单卡片。" + }, + { + "id": "workbench-status-shooting", + "label": "拍摄中", + "kind": "workbench", + "phase": "shooting", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示拍摄中;未确认成功时,订单已拍次数与剩余次数保持不变。" + }, + { + "id": "workbench-status-paused", + "label": "拍摄已暂停", + "kind": "workbench", + "phase": "paused", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示拍摄已暂停;进入原任务页后,按实际许可继续拍摄或返航。" + }, + { + "id": "workbench-status-returning", + "label": "返航中 · 拍摄结果待确认", + "kind": "workbench", + "phase": "returning", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "右上角显示返航中;示例结果仍待确认,暂不扣次数,不将返航直接判成功或失败。" + }, + { + "id": "workbench-status-returnpaused", + "label": "返航已暂停", + "kind": "workbench", + "phase": "returnpaused", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示返航已暂停,区别于拍摄暂停;进入任务页继续返航,不能误恢复拍摄。" + }, + { + "id": "workbench-status-unknown", + "label": "任务状态待确认", + "kind": "workbench", + "phase": "unknown", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "保留当前任务入口;未知读数显示—,工作台标明待同步,卡片保留原字段与布局。" + } + ], + "imagePath": "flows/12-workbench-task-states.png", + "exportVerified": { + "method": "individual complete screen captures composed horizontally", + "width": 6100, + "height": 2324, + "stateCount": 7, + "footerVisible": true + } + } + ], + "layoutWarnings": [], + "expectedScrollableAreas": [ + { + "screen": "prepare-ready", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "summoning", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "dock-recovering", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 681 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "retry-prepare", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 681 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "prepare-location", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "prepare-busy", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "prepare-unavailable", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "prepare-existing", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + }, + { + "screen": "quota-last", + "clipping": [ + { + "class": "body", + "client": 560, + "scroll": 622 + } + ], + "expected": "scrollable application content" + } + ], + "runtimeErrors": [], + "workbenchReturnVerification": [ + { + "id": "11-workbench-resume", + "count": 4, + "checksPassed": true + }, + { + "id": "12-workbench-task-states", + "count": 7, + "checksPassed": true + } + ], + "confirmedAppRules": { + "orderScope": "当前登录用户在当前景区的订单", + "assignmentOwner": "backend", + "backDuringTask": "直接返回工作台,不弹确认,不取消任务", + "activeOrder": "置顶,右上状态标签,查看当前任务", + "successReturning": "拍摄已完成与无人机返航中分别展示,保留当前任务入口" + } +} \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/baseline-audit.md b/docs/9.9.1/review/product-comparison/baseline-audit.md new file mode 100644 index 0000000..3c5c10c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/baseline-audit.md @@ -0,0 +1,103 @@ +# 9.9.1 原型比对基线审阅 + +日期:2026-10-22。本文为只读审阅结果,不是新一轮原型实测记录。依据为 [当前方案基线](current-baseline.md)、原需求及附件 README、[已有收款能力核对](payment-existing-vs-new.md) 和当前已保存的 DOM/可访问性证据。未操作浏览器,未修改 App 代码。 + +## 一、最终比对时最容易遗漏的五项 + +1. **剩余 0 次立即移出首页,是“当前任务置顶”的例外。** 即使无人机还在返航,该订单也进入“我的拍摄订单 → 已完成”;在该卡片临时保留“查看当前任务”,任务结束后再移除临时入口。上传中不改变这一归类。不能为了保留任务入口把订单继续留在首页。 +2. **订单进度、拍摄结果、飞行任务、素材状态是独立维度。** “进行中+设备空闲”“已完成订单+返航中+上传中”都成立。下载成功还需区分实际保存到本机相册,与游客交付也不同。 +3. **新套餐收款页已经确定,但多数原收款功能可复用。** 套餐选择、所选套餐与收款码对应、支付结果到订单入口是业务增量;设置金额、保存二维码、收款记录、到账语音、线下登记已有,不能全部算成原型新增功能。旧 API 不足以证明套餐交易绑定已经实现。 +4. **原型行为不能覆盖已确认的交互选择。** 紧急暂停直接提交、失败回准备后人工召唤、前台下载暂停后手动继续、支付成功停留并进待拍 Tab 均已确认。原型若不同应列冲突。交付成片和主动返航二次确认仍未定,不能代用户选答案。 +5. **证据范围要更新,也要防止把状态菜单或历史 DOM 当实测。** 当前已存在准备页与到达任务页的证据,旧进度文档却还写未进入这些页面;同时 `04-workbench-disconnected.txt` 实际仍为状态菜单,不能算断连页面通过。看见菜单条目不等于跑通该分支,单次“已到达”快照也不能证明前往、提交中等瞬态已验证。 + +## 二、基线优先级与范围 + +优先级:最新用户明确确认 → 未被后续调整的原需求/README → 旧评审建议 → 产品原型的可观察行为。建议和观察分别记录,不升级成用户确认。 + +当前用户范围为 App:进入机巢工作台获取当前用户、当前景区的订单。派单算法、后台归属和设备结算实现属于接口协作,不再转成需要用户回答的 App 产品题。Web 套餐上下架维护不是 App 套餐管理开发范围。 + +旧版评审、Word 状态文档和横向截图未同步所有 10/22 确认。不能只依旧截图重新提出已经回答的问题。 + +## 三、必须保留的 App 规则 + +| 领域 | 必须保留的当前规则 | 原型比对应抓的证据 | +| --- | --- | --- | +| 首页任务卡 | 保留原有紧凑横向卡;当前任务置顶;原动作改“查看当前任务”;卡片右上角显示任务状态;不增加具体点位/航线信息。0 次按上文例外移出首页。 | 执行中返回首页、卡片布局、点击恢复同一任务、0 次时任务入口转移。 | +| 任务标签 | 前往拍摄点中、已到达,待拍摄、拍摄中、拍摄已暂停、返航中、返航已暂停、任务状态待确认。 | 拍摄暂停与返航暂停分别可辨,不用订单“进行中”代替任务阶段。 | +| 另一订单准备 | A 占用时仍可进入 B 的准备页、选点线;底部占用中,召唤不可点。无排队和自动起飞。 | A→首页→B→准备→禁召唤→恢复 A 的整条链路。仅首页占用标签不足以证明通过。 | +| 准备选择 | 一个点位+该点一条航线;恢复仍有效选择;换点不串航线;范围外可选不可召唤;无航线清空失效选择。 | 点位切换及切回、无航线、失效选择、未知位置和设备状态。 | +| 次数与完成 | 仅确认本次成功扣 1;失败/未知不扣;同点可重复;重复通知不重复扣;剩余 0 为已完成;部分已拍且有剩余为进行中。 | 初次/部分/最后一次成功、失败、同点重复、返回后的数量与 Tab。 | +| 任务离页与恢复 | 左上角直接回工作台,不确认、不取消;冷启动正常首页;进工作台同步后手动看任务;切景区允许,原任务继续。 | 同一任务身份、重进不重召、切回原景区;网页难代表的冷启动单列真机项。 | +| 指令反馈 | 紧急暂停直接发;未确认时为处理中;明确拒绝、结果未知、已生效分开;不能用点击/超时推断任务失败或成功。 | 暂停/恢复/召唤/开始/返航各操作的确认与恢复。 | +| 失败重试 | 明确失败+设备可用+有额度后,“重新准备拍摄”回准备页,恢复有效选择,再人工确认召唤。 | 原需求早期“重新召唤”文案已被后续确认细化,不能保留失败页直接重召的旧行为。 | +| 网络与画面 | 图传断流独立于控制;手机断网遥测为“—”且标未更新,无法发送的指令禁用;恢复先同步原任务。 | 图传单独故障、网络故障、恢复后的原任务;不得把陈旧读数当实时。 | +| 素材与下载 | 部分就绪可先选/下,全选只选可下载;后台/锁屏暂停,前台手动继续未完成;已保存不重下;未完成单文件可从头重下,无字节续传要求。 | 可选数、部分失败重试范围、实际保存成功、暂停/继续;网页不能证明真实后台和相册权限通过。 | +| 收款成功 | 停留支付成功页;按钮到“我的拍摄订单”,默认待拍摄 Tab。 | 页面不自动跳、按钮目标和 Tab,不从支付成功直接开任务。 | + +以上规则的逐项确认编号见 [C01–C20](current-baseline.md)。 + +## 四、应保留的冲突与未定事项 + +| 项目 | 报告应如何处理 | +| --- | --- | +| 交付成片按钮 | 用户明确暂跳过。原型即使有分享、二维码或标记交付,只能写“原型提供的方案”,不列已确认 App 行为。 | +| 主动立即返航二次确认 | 用户尚未回答。记录原型弹/不弹确认即可,不替用户定案。自动保护返航是另一入口。 | +| 收款页设置金额 | 旧页已有自由金额能力;套餐价是否允许改、改价是否改变套餐/次数、码如何换新仍需观察/接口对齐。不能因按钮存在就默认沿用旧逻辑。 | +| 当前任务卡按钮 | 设备空闲、套餐部分已用时“继续拍摄”可只是准备入口。必须有活跃任务的证据才可判定是否违反“查看当前任务”。 | +| 部分拍摄/保护性返航如何结算 | 显示设备原因与结果待确认;权威成功/失败及次数以契约为准,不由 App 因返航、停止画面或按钮点击自行判断。 | +| 状态菜单与正式 App | “体验其他状态”“恢复正常体验”“从头体验”是原型工具,不计入正式页面或开发功能。 | + +## 五、新收款页的复用边界 + +### 已有能力 + +旧收款页已经具备二维码展示与加载/错误刷新、金额备注及校验、保存相册、景区/收款方/员工信息、收款记录、到账语音配置和线下登记。普通组件及现有校验、相册保存工具可按需复用。详见 [旧能力代码定位](payment-existing-vs-new.md)。 + +本次再核对旧 `PaymentAPI.payCode`:只传 `scenic_id`;`PayCodeResponse` 只有 `static_pay_url` 和 `dynamic_pay_url`。收款记录模型仅包含订单号、手机号、金额及创建时间等信息。因此,不能用旧接口存在推导套餐 ID、套餐版本、次数、交易会话、支付结果及过期时间已经具备;历史收款记录也不能直接充当当前交易确认机制。 + +### 明确增量与建议核验 + +| 层次 | 内容 | 确认状态 | +| --- | --- | --- | +| 新增页面 | 支持套餐选择的现场收款页;旧无套餐页不可直接当作本业务完整页面。 | 用户已确认。 | +| 已观察初态 | 未选套餐时“请选择”“选择后生成对应套餐收款码”;设置金额、保存二维码禁用。 | PAY01 已观察。 | +| 套餐数据 | 套餐名称、价格、含拍摄次数、选中及切换;列表加载/空/失败、选择失效。 | 具体交互继续实测;异常状态为核验项,不预判已实现。 | +| 码与套餐联动 | 展示、价格、次数与码对应当前所选套餐;切换后的旧码与迟到响应不能错配。 | 必须补齐的交互/接口检查,不是已验证能力。 | +| 支付与订单 | 支付待确认、明确结果、恢复;成功页停留及待拍入口。 | 成功页路由已确认;其他详细状态需实测与接口对齐。 | +| 既有辅助入口 | 记录、到账语音、线下登记的承接;套餐是否需要额外字段。 | 已有功能不重复算新增;原型线下登记明确本次不调整。 | + +这份审阅不要求现在改代码,也不要求用户重新回答后端如何实现交易。最终文档应输出 App 需要消费和展示哪些信息,供后续接口对齐。 + +## 六、现有证据可以支持到哪一步 + +| 文件 | 可确认内容 | 不可推断内容 | +| --- | --- | --- | +| [P00](evidence/iab/P00-workbench-normal.txt) | 内部浏览器首页、空闲设备、订单样例、上传中/失败文案、今日数据。订单进行中可与设备空闲并存,符合 C15。 | 活跃任务卡、完成最后一次后的首页移除、列表筛选已通过。 | +| [PAY01](evidence/payment/PAY01-normal.txt) | 内部浏览器已进入收款详情;套餐未选、设置金额和保存码禁用;辅助入口可见。 | 套餐已选择、支付成功、异常分支及辅助按钮事件已跑通。 | +| [F01](evidence/flight/F01-prepare-current.txt) | 已进入准备页;三皇寨选中、经典航线选中、8 条航线、剩余 2、设备空闲且召唤按钮可用。 | 切点恢复、选项失效、占用/范围外阻断已实测。 | +| [F02](evidence/flight/F02-summon-after.txt) | 已到拍摄任务页;“无人机已到达”“是否开始拍摄”、开始拍摄及安全控制可见。 | “召唤中→前往→到达”各瞬态都观测到了,或暂停/返航事件已验证。 | +| [工作台占用](evidence/02-workbench-busy.txt) | 早期外部浏览器实际切换出工作台占用标签,订单入口仍在。 | B 准备禁召唤、原 A 任务可恢复。后续按用户要求继续使用内部浏览器。 | +| [工作台状态菜单](evidence/01-workbench-state-menu.txt) | 状态入口清单可见。 | 每个入口已实际切换并核对。 | +| [04-disconnected](evidence/04-workbench-disconnected.txt) | 快照仍是状态菜单,焦点位于机巢未连接。 | 已进入断连状态;文件名不能作为通过证据。 | + +PAY01、F01、F02 中均可能保留上一页 DOM。例如 PAY01 有首页主区域,F02 仍含准备页区域。报告只能依据当前标题、入口链路和当前内容判断,不应把这些历史节点解释成页面同时展示两套主内容的 UI 缺陷。 + +旧 [体验进度文档](体验进度与已验证差异.md) 关于“尚未进入收款、拍摄准备、任务执行”的段落已落后于上述证据,需要主报告更新;待核验表也应按新增观察逐条更新,不宜继续整表统一标 U。 + +## 七、交付主报告前的质量检查 + +- 原型新增、双方共同覆盖、当前方案补给原型、冲突未定、接口/真机验收五类分开写。 +- 每项“原型已覆盖”关联实际证据;只看到状态入口标“入口可见”,未触发标“未验证”。 +- 把测试通过和缺口严格区分:没观察到不等于没有,浏览器操作失败不等于产品缺陷。 +- 不把已确认规则重新列为“我们遗漏”;特别是支付成功待拍入口、前台下载与 0 次返航组合。 +- 不计入无关扩项:Web 套餐管理、原有线下登记重做、后台下载、App 派单和自动起飞。 +- 真实后台/锁屏、杀进程、相册授权/写入、并发设备与重复/乱序消息保留为 App/接口验收,网页演示不能代替验证。 + +## 来源 + +- [当前方案基线](current-baseline.md) +- [已有收款能力核对](payment-existing-vs-new.md) +- 原需求(原始输入:`随心瞰9.9.1.md`;原文件未随本次归档复制) +- 准备页 README(原始输入:`README.md`;原文件未随本次归档复制) +- [旧收款 API](../../../../suixinkan/Features/Payment/API/PaymentAPI.swift#L17) +- [旧收款响应模型](../../../../suixinkan/Features/Payment/Models/PaymentModels.swift#L106) diff --git a/docs/9.9.1/review/product-comparison/current-baseline.md b/docs/9.9.1/review/product-comparison/current-baseline.md new file mode 100644 index 0000000..46e3f1a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/current-baseline.md @@ -0,0 +1,148 @@ +# 随心瞰 9.9.1 当前方案基线 + +初版:2026-10-22;补充校准:2026-10-26。用途:供产品交互原型与当前方案双向比对。本文整理已确认规则;最新实测见[原型与接口复核](../../原型与接口复核-2026-10-26.md),UI 实施状态另见对应实现说明,不从原型推断真实接口已接通。 + +## 依据与优先级 + +1. **用户在当前对话中的最新明确确认**,包括 2026-10-22 的逐项问答和截图说明。 +2. **原需求正文与附件 README 已明确规定的行为**,且没有被后续用户确认调整。 +3. **2026-10-21 的评审报告、横向状态截图、状态分类文档中的建议补充**。这些建议不能自动升级为已确认规则。 +4. **产品交互原型中的可观察行为**,由主代理实际操作后另行记录。观察到的原型行为不自动覆盖用户已经确认的规则。 + +旧报告 `review-content.html` 和 Word 状态清单尚未收录今天的大部分确认。比对时必须使用本基线补齐,不能把旧文档仍写“待确认”的事项重复当成当前方案缺口。 + +## 一、用户已明确确认的 App 行为 + +| 编号 | 场景 | 当前已确认规则 | 比对时应检查的状态或入口 | +| --- | --- | --- | --- | +| C01 | App 范围与订单来源 | 用户只负责 App。进入机巢工作台后获取当前登录用户在当前景区的订单;订单归属、分配方式由后端负责。 | 本人+当前景区的列表;不要把派单、归属算法列成需要用户决定的 App 业务。 | +| C02 | 正在执行的任务离页 | 任务执行中点击左上角返回,直接回机巢工作台,不弹确认,不取消任务,不因离页重复创建任务或扣次。 | 返回后任务继续;重新进入同一任务。 | +| C03 | 工作台执行中订单 | 当前任务订单在首页订单区域置顶;保留原有紧凑横向卡片布局。 | 任务卡位于其他订单之前;不额外增加点位、航线说明区。 | +| C04 | 原卡片按钮与任务标签 | 原右侧“开始拍摄”按钮标题改为“查看当前任务”;卡片右上角显示任务状态;点击进入原任务。 | 仅换标题与右上角状态,保留原卡片样式和素材栏。 | +| C05 | 卡片任务提示值 | 前往拍摄点中、已到达,待拍摄、拍摄中、拍摄已暂停、返航中、返航已暂停、任务状态待确认。 | 暂停前阶段不同,返航暂停与拍摄暂停不能混为同一种状态。 | +| C06 | 拍摄成功但仍返航 | 拍摄结果与飞行状态分别表达;可以同时显示“拍摄已完成”和“无人机返航中”,返航期间保留当前任务入口。 | 成功不等于回巢或设备可重新执行。 | +| C07 | A 任务占用时打开 B 订单 | 可以进入 B 订单的拍摄准备页并选择点位、航线;底部无人机状态显示“占用中”,召唤按钮不可点击。 | 允许准备、禁止召唤;不新增排队或自动起飞功能。 | +| C08 | App 被关闭后重开 | 正常进入 App 首页,不自动跳转任务页;进入机巢工作台后同步最新状态,点击“查看当前任务”再进入。 | 冷启动恢复任务入口、同步未完成时的待确认提示。 | +| C09 | 明确拍摄失败后重试 | 设备恢复可用且有剩余次数时,失败页点击后回拍摄准备页,恢复仍有效的点位和航线,再由工作人员手动确认召唤。失败页按钮采用“重新准备拍摄”。 | 不能从失败页直接按旧选择重召;失效选择需重新选择。 | +| C10 | 次数用完后的首页展示 | 剩余拍摄次数为 0,立即不在首页订单区域显示;通过“查看全部”进入“我的拍摄订单”,在“已完成”Tab 查看。 | 0 次订单的完成归类不等待素材上传完成。 | +| C11 | 最后一次成功、0 次但仍返航 | 同样立即从首页移除,归入“已完成”;在该订单卡片里临时保留“查看当前任务”,任务结束后移除该临时入口,保留素材等原有操作。 | “已完成订单+返航中任务”这一组合必须仍能进入任务页。 | +| C12 | 上传与拍摄次数 | 最后一次拍摄成功后可能已经剩余 0 次,但该次产生的素材仍在上传。上传不表示可以继续拍摄,也不意味着新增工作人员手动上传素材的功能。 | 0 次+上传中、0 次+上传完成均成立;不要将上传完成作为订单完成的额外前提。 | +| C13 | 部分素材已就绪 | 已上传完成的素材可先预览、选择和下载;上传中的素材暂不可选;“全选”只包含当前可下载项。 | 部分就绪列表、不可选的上传中项、全选数量与可下载项一致。 | +| C14 | 下载切后台或锁屏 | 本版选低成本前台方案:切后台或锁屏暂停下载,回页面后手动“继续下载”;只处理未完成文件,已保存成功的不重复下载;未完成单个文件允许从头重新下载,暂不做字节断点续传。 | 暂停/未完成状态、手动继续、已保存项保留;不把后台继续下载算成本版已确认能力。 | +| C15 | 部分已拍但当前无执行任务 | 套餐已经成功拍过一部分、仍有剩余次数,即使当前无人机没有执行任务,也在“进行中”Tab。 | “进行中”是订单履约进度,不仅是当前飞行任务是否活跃。未用完的已开始订单不反复回“待拍摄”。 | +| C16 | 支付成功后页面 | 停留在支付成功页,页面提供跳转到“我的拍摄订单”的按钮。 | 不自动跳工作台或拍摄准备页,不从支付成功直接召唤。 | +| C17 | 支付成功页的订单入口 | 从该按钮进入“我的拍摄订单”时,默认选中“待拍摄”Tab。 | 支付成功来源的列表默认 Tab。 | +| C18 | 执行中切换景区 | 允许切换景区,原任务继续执行;切换后展示新景区订单,需要查看原任务时切回原景区。 | 不增加执行中禁止切景区的限制;各景区数据与任务上下文分开。 | +| C19 | 主动紧急暂停 | 点击“紧急暂停”直接提交暂停请求,不弹二次确认;提交后显示“暂停处理中”,设备确认后再显示已暂停/已悬停。 | 指令处理中、明确生效、失败、结果未知分别展示;防重复点击。 | +| C20 | 现场收款页范围 | **必须新增一个支持选择套餐的收款页面,不能直接复用原有不支持套餐选择的收款页面。** 用户在本次要求中已明确。 | 新收款入口、套餐选择、收款码及支付过程的状态需完整覆盖;详细交互以产品原型实测补齐。 | +| C21 | 主动立即返航 | 2026-10-23 用户要求到产品体验网页核对。实际点击后不弹二次确认,直接显示“正在发送返航指令/尚未确认返航”;原型随后模拟设备回执。App 界面采用直接提交,仍须区分提交和设备确认。 | 点击后禁重复发送;收到明确回执前不宣称已返航。原 U02 已补齐。 | +| C22 | 本轮搭建范围 | 2026-10-23 用户明确先跳过收款页面,继续搭建拍摄准备和当前任务,暂不接真实接口。 | 收款入口继续占位;本地演示事件不发送真实设备指令。 | +| C23 | 景区空镜库与机巢工作台的模块关系 | 2026-10-26 用户明确两者是独立模块,后续各自在 App 首页配置独立入口。原型把空镜库入口放在工作台内仅为方便体验。 | 空镜库不是工作台子页面,不依赖工作台初始化、拍摄订单或任务;独立配置入口及访问权限,具体菜单 URI 待后续配置。可复用登录、景区选择和下载基础能力。 | + +说明:C10/C11 是对之前“当前任务订单置顶”规则的明确例外:剩余次数为 0 的订单立即退出首页,未结束任务入口转移到“已完成”订单卡片,不继续留首页。 + +## 二、原需求与 README 已明确定义,当前方案应保留的状态 + +### R01 拍摄准备与选择 + +- 从已分配订单进入,带入订单、额度、拍摄记录,不创建无订单任务;每次准备一个点位及该点一条航线。 +- 新进入且没有有效选择:在本页直接选择,不额外增加弹窗或二级选择页。 +- 同一订单重进时恢复仍有效的选择;有正在执行的本订单任务时提供“查看当前任务”,不能重新召唤。 +- 点位横向列表;整卡可点;已拍过的点仍可再次选择;未拍过显示“未拍摄”。 +- 点位范围外仍可浏览和选择航线,但不能召唤;范围未知与位置未知需明确表达。 +- 切换点位后切换对应航线,不能沿用另一个点位的航线;本次访问内切回某点可恢复该点仍有效的航线,按身份而非同名匹配。 +- 位置变化只更新范围与距离,不自动重排点位;没有可信距离显示“位置待确认”。 +- 航线纵向列表、整行单选;重复点击当前项不取消;数量来自该点实际配置。 +- 无航线显示明确提示、清空失效选择并禁召唤;原选择失效需要重新选择。 +- 页面出现时刷新次数、范围、设备状态;未知或过期数据不当作空闲。 + +### R02 设备状态、执行许可与召唤 + +- 六项遥测:电池电量、环境温度、风速、雨量、信号状态、搜星状态;缺失电量不能显示成 0,不把旧值当实时值。 +- 准备页底部只读展示所选点位/航线、设备状态与电量,不增加大卡片或未知等待倒计时。 +- 底部需表达:空闲且允许执行、其他任务占用、本订单任务执行中、状态无法确认、设备报告不可执行。 +- 连接成功与设备空闲是不同条件;低电量阈值不由 App 自行设定,按设备执行许可展示。 +- 可召唤需订单权限、剩余次数、有效点位航线、范围、连接、设备许可全部满足,且没有重复提交或原任务待恢复。 +- 无点位、无航线、次数为零、范围外、位置未知、连接断开、设备未知各自给出原因,不伪造通过状态。 +- 召唤提交中:显示处理中、防重复点击、不能修改此次提交的点位航线。 +- 召唤确认成功后进入任务页,显示实际前往状态;明确失败保留选择;超时未知先同步原任务,不直接判失败并重召。 +- 仅到达确认后“开始拍摄”才可点;开始请求被提交不等于已经开始拍摄。 + +### R03 任务、飞行与指令相互独立 + +- 已到达待拍、拍摄中、紧急暂停、恢复、返航、成功、失败均已有需求语义覆盖。 +- 关闭成功弹窗后,任务页仍保留成功结果与查看素材入口;如果仍返航,继续表达返航与按能力允许的控制。 +- 任务失败但仍返航:保留失败原因,重新发起拍摄不可用;确认失败弹窗不自动重试。 +- 任务失败且设备恢复可用:允许工作人员重新准备拍摄(具体入口已被 C09 细化)。 +- 保护性返航展示设备报告的原因;未确认的拍摄结果仍待确认,不用返航状态替代成功/失败。 +- 指令处理中和结果未知必须分别展示,不能把请求加载、超时当作执行成功或整个任务失败。 +- 尚未召唤时返回不创建任务、不扣次;召唤处理中或未知时离开不代表取消;重进先核对原任务。 +- 切后台、断网不自动创建任务、不自动重发指令或扣次;恢复连接后同步原任务。 + +### R04 次数 + +- 套餐表达“含 N 次拍摄”,不是必须拍 N 个不同点位;同一点位允许重复拍摄。 +- 订单已成功次数、剩余次数及该点已成功次数分别展示;同点不同航线仍累计到同一点位。 +- 仅确认本次拍摄成功后更新计数,失败不扣;进入页面、切点、切线、召唤途中、结果待确认均不扣。 +- 同一次任务的重复结果不能重复扣次。 +- 示例:订单已 3 剩 2、该点已 2;该点再次成功后订单已 4 剩 1、该点已 3,失败则都保持原值。 + +### R05 网络、图传与遥测 + +- 只有图传断流:允许重新连接画面;任务状态、控制连接仍可有效,不误报任务失败。 +- 手机整体断网:当前任务状态未知,六项遥测显示“—”并标记未更新,无法发送的操作置灰;恢复连接先同步原任务。 +- 上次任务画面与当前设备实时读数不能混为同一时刻;未知状态不能伪装实时。 + +### R06 素材与下载 + +- 拍摄已完成但素材未上传完:显示“上传中”和刷新入口,不显示虚构进度,不误显示为“没有素材”。 +- 素材就绪后可逐项选择、全选、下载所选;全选标记、逐项勾选和底部数量保持一致。 +- 部分下载失败:逐项区分已下载与失败,只重试失败项,已成功项无需重复下载;素材重试不发起新的拍摄、不扣次数。 +- 旧评审根据原附件已经纳入:按拍摄记录分组、点位筛选、离页中止且保留成功项、相册拒权及恢复入口。实际产品是否仍保留,需主代理实测核对。 +- 原稿离开素材页面中止下载与 C14 切后台暂停是不同生命周期入口,但均需保留已保存成功项。 +- 下载完成不等于写入相册成功;只有本设备实际保存成功才能标记本机已保存;本机已保存也不等于已交付游客。 + +## 三、旧评审建议补充,尚不能称作用户已确认 + +旧文档建议使用 10 个独立状态维度。中文值用于需求讨论,不代表最终接口枚举,也不表示已经实现。 + +| 维度 | 已有方案提出的候选子状态 | 确认边界 | +| --- | --- | --- | +| 套餐 | 草稿、上架、下架;列表加载、空、失败;选择失效 | 套餐管理属 Web 范围;App 套餐选择页已确认为新增,但其细节需产品原型实测。 | +| 收款与支付 | 收款码未生成/生成中/可用/生成失败/已失效;交易待支付/确认中/已支付/明确失败/已关闭 | 只有成功后的页面与跳转已按 C16/C17 确认。付款会话细节、失效处理仍不能冒充已确认。 | +| 订单与归属 | 待拍摄/进行中/已完成;已取消、过期;待分配、转交、权限变化、退款等 | 订单展示已按 C01/C10/C11/C15 确认;归属、退款等后端流程不应转化为用户必须回答的 App 设计题。 | +| 拍摄准备 | 点位航线未选/有效/失效;定位获取中/未授权/关闭/失败/过期;范围内外与未知 | README 已覆盖主要选择和阻断;细分定位与加载反馈为建议补齐。 | +| 无人机设备 | 地面/前往/待命/拍摄飞行/悬停/返航/未知;任务占用;新任务许可 | 起飞、降落、回巢后检查/充电、允许再执行等细分如何上报需对接设备;App 不自定判据。 | +| 拍摄任务 | 前往/待拍/拍摄/暂停/执行结束/待确认;结果未产生/待确认/成功/失败/中断 | 部分拍摄、中途返航、中断的结算需后端/设备契约;不要用点击按钮推断成功或扣次。 | +| 操作指令 | 未发送/处理中/已确认/明确失败或拒绝/结果未知,及本操作许可 | 召唤、开始、暂停、恢复、返航应分别建模;恢复指令反馈原状态板覆盖不足,旧评审已建议补齐。 | +| 连接与同步 | 手机网络、控制连接、图传、遥测有效性、原任务同步分别表达 | 细分连接中/重连中/同步失败与长期未知兜底仍属建议,不表示已有接口。 | +| 次数与结算 | 可用/用完/待确认;无需扣次/等待或结算中/完成/待核查;执行占用 | 次数数据以权威快照为准;设备与额度并发、幂等、乱序结果防覆盖属于接口契约需求。 | +| 素材与交付 | 待生成/上传中/就绪/失败/不可用;下载/保存阶段;批次部分成功;权限;游客交付状态 | 部分就绪已按 C13 确认;前台下载已按 C14 确认;交付已获授权搭建本地 UI(见 U01),云端成片与整单确认已形成演示流程;真实上传、游客身份与会话契约仍待对接,闪传仍未定。 | + +旧评审另提出的候选缺口:列表首次加载/失败/空数据、套餐价格或配置变化、指令明确拒绝与任务失败分离、长期结果未知的人工核查、上传最终失败、链接失效、素材删除、空间不足、相册写入失败、重启恢复与完成去重。它们可作为原型覆盖检查项,但有无对应入口需要实际观察。 + +## 四、必须保留“待确认/待补充”的事项 + +| 编号 | 事项 | 当前边界 | +| --- | --- | --- | +| U01 | “交付成片”点击事件 | 原先暂缓;2026-10-23 用户已授权按新版原型搭建本地交付 UI,参见[实现说明](../../交付成片UI实现说明.md)。真实交付接口、游客身份和收货凭据另行对接,不从本机演示推断已接通。 | +| U03 | 新收款页的完整页面状态 | 新增并支持选择套餐已经明确;套餐列表、选中、收款码、支付结果、异常与返回等具体状态,需要本次跑产品原型后整理。 | +| U04 | App 与后端/设备的契约 | 任务成功判据、部分拍摄结算、原子占用、命令能力、最终上传失败处理等仍需接口对齐;不应擅自落成 App 自行判断的业务规则。 | + +原 U02 已按 2026-10-23 用户指示实际核对产品网页,移入 C21;核对结果见新增页面实现说明及 `../../shooting-ui-2026-10-23/prototype-return-result.txt`。 + +## 五、对本次原型比对的使用建议 + +1. 将每项原型观察记录成“页面入口 → 操作 → 可见状态 → 可执行按钮 → 返回/恢复”,标明实际点击到、仅状态模拟器提供或未验证。 +2. 同时检查两个方向:**原型相对基线新增了什么**,以及**原型遗漏了基线已确认的哪些组合状态**。 +3. 新收款页是用户本次明确扩展,不能仅对比旧的“复用收款页”假设。 +4. 重点组合:0 次+返航、已完成订单+上传中、已拍部分+无活跃任务、B 订单准备+A 任务占用、切景区后再恢复原任务、部分素材就绪+下载暂停、支付成功入口默认待拍。 +5. 原型出现不同规则时,标“差异/冲突待取舍”,不要自动覆盖 C01–C23。U01 区分已授权本地 UI 与待对接真实交付;原 U02 已移入 C21,不再作为未确认问题。空镜库入口位置按 C23 的正式模块规划解释,不从原型体验入口推导从属关系。 + +## 本地来源 + +- 原需求:《随心瞰9.9.1.md》(用户提供的原始输入,未随本次归档复制) +- 准备页规格:《图片和附件/README.md》(用户提供的原始输入,未随本次归档复制) +- 旧评审:[review-content.html](../review-content.html) +- 旧 10 类状态文档源:[build_states.py](../state-document/build_states.py);导出文档为[随心瞰9.9.1状态分类与取值清单.docx](../state-document/随心瞰9.9.1状态分类与取值清单.docx)。 +- 最新确认:当前对话;后续已补 C21/C22 与 U01 的本地 UI 授权,以及复核后用户明确的 C23 独立模块规划。2026-10-26 原型观察不自动覆盖既有交互确认。 diff --git a/docs/9.9.1/review/product-comparison/evidence/01-workbench-state-menu.txt b/docs/9.9.1/review/product-comparison/evidence/01-workbench-state-menu.txt new file mode 100644 index 0000000..73f3cf8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/01-workbench-state-menu.txt @@ -0,0 +1,98 @@ +Window: "机巢 · 页面内交互体验", App: Google Chrome. +0 标准窗口 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/, Secondary Actions: Raise + 1 container 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/ + 2 container + 3 工具栏 + 4 按钮 返回 + 5 按钮 (disabled) 前进 + 6 按钮 重新加载 + 7 container + 8 弹出式按钮 查看网站信息 + 9 文本栏 (settable) 地址和搜索栏, Value: voicestudio.suixinkan.cn, Placeholder: 问问 Google 或输入网址 + 10 按钮 为此标签页添加书签 + 11 container + 12 弹出式按钮 ChatGPT +可以访问此网站 + 13 弹出式按钮 扩展程序 + 14 按钮 秋 + 15 弹出式按钮 Chrome + 16 工具栏 书签 + 17 工具栏 已保存的标签页分组 + 18 按钮 标签页分组 + 19 分离器 分隔符 + 20 书签文件夹按钮 代码库 + 21 书签文件夹按钮 后台网站 + 22 书签文件夹按钮 实用工具 + 23 书签文件夹按钮 开放平台 + 24 书签按钮 蒲公英 - 控制台 + 25 书签文件夹按钮 后台管理系统 + 26 书签文件夹按钮 学习博客 + 27 书签文件夹按钮 账号管理 + 28 书签文件夹按钮 设计 + 29 书签文件夹按钮 STM32 + 30 书签文件夹按钮 有趣的网站 + 31 书签文件夹按钮 Metal 学习 + 32 书签文件夹按钮 高清古画 + 33 书签文件夹按钮 所有书签 + 34 分离器 分隔符 + 35 container + 36 滚动区 + 37 HTML 内容 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ + 38 container 体验本页状态 + 39 标题 体验本页状态, Value: 2 + 40 文本 体验本页状态 + 41 文本 只切换当前页面。正常操作会自动推进,无需额外控制。 + 42 container + 43 按钮 设备空闲 + 44 按钮 无人机占用中 + 45 按钮 机巢未连接 + 46 按钮 无人机无信号 + 47 按钮 电量不足 + 48 按钮 设备状态未知 + 49 按钮 暂无拍摄订单 + 50 文本 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + 51 按钮 恢复正常体验 + 52 按钮 从头体验整个流程 + 53 弹出式按钮 标签页搜索 + 54 container + 55 标签页组 + 56 标签 (settable, boolean) ShowMeYourApps - 内存用量 - 310 MB, Value: off + 57 按钮 关闭 + 58 标签 (settable, boolean) Kavsoft - YouTube, Value: off + 59 按钮 关闭 + 60 标签 (settable, boolean) 你的星星 - 内存用量 - 589 MB, Value: off + 61 按钮 关闭 + 62 标签 (settable, boolean) excalidraw/excalidraw: Virtual whiteboard for sketching hand-drawn like diagrams - 内存用量 - 195 MB, Value: off + 63 按钮 关闭 + 64 标签 (settable, boolean) hyperoslo/Lightbox: :milky_way: A convenient and easy to use image viewer for your iOS app, Value: off + 65 按钮 关闭 + 66 标签 (settable, boolean) EhPanda-Team/EhPanda: An unofficial E-Hentai App for iOS built with SwiftUI & TCA. - 内存用量 - 354 MB, Value: off + 67 按钮 关闭 + 68 标签 (settable, boolean) Introduction - Blender 5.2 LTS Manual - 内存用量 - 53.2 MB, Value: off + 69 按钮 关闭 + 70 标签 (settable, boolean) ⁣‌​⁡‍‌⁡‍​​‌‬⁣⁤‌⁢⁤‌‌​​⁢‬‬‍⁣⁤‬​⁡‬‌​⁤​‌⁢​‬⁣⁣⁣⁣​随心瞰9.9.1 - 飞书云文档 - 内存用量 - 774 MB, Value: off + 71 按钮 关闭 + 72 标签 (settable, boolean) Swift Developer News – Hacking with Swift - 内存用量 - 175 MB, Value: off + 73 按钮 关闭 + 74 标签 (settable, boolean) Peter Friese - 内存用量 - 95.4 MB, Value: off + 75 按钮 关闭 + 76 标签 (selected, settable, boolean) 机巢 · 页面内交互体验 - 内存用量 - 95.6 MB, Value: on + 77 按钮 关闭 + 78 按钮 新标签页 + 79 按钮 打开 Chrome 中的 Gemini + 80 关闭按钮 + 81 全屏幕按钮 Help: 此按钮也可以执行缩放窗口的操作, Secondary Actions: 缩放窗口 + 82 最小化按钮 +83 menu bar + 84 Chrome + 85 文件 + 86 编辑 + 87 显示 + 88 历史记录 + 89 书签 + 90 个人资料 + 91 标签页 + 92 窗口 + 93 帮助 + +The focused UI element is 43 按钮 设备空闲 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/02-workbench-busy.png b/docs/9.9.1/review/product-comparison/evidence/02-workbench-busy.png new file mode 100644 index 0000000..aec26df Binary files /dev/null and b/docs/9.9.1/review/product-comparison/evidence/02-workbench-busy.png differ diff --git a/docs/9.9.1/review/product-comparison/evidence/02-workbench-busy.txt b/docs/9.9.1/review/product-comparison/evidence/02-workbench-busy.txt new file mode 100644 index 0000000..b703da0 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/02-workbench-busy.txt @@ -0,0 +1,160 @@ +Window: "机巢 · 页面内交互体验", App: Google Chrome. +0 标准窗口 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/, Secondary Actions: Raise + 1 container 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/ + 2 container + 3 工具栏 + 4 按钮 返回 + 5 按钮 (disabled) 前进 + 6 按钮 重新加载 + 7 container + 8 弹出式按钮 查看网站信息 + 9 文本栏 (settable) 地址和搜索栏, Value: voicestudio.suixinkan.cn, Placeholder: 问问 Google 或输入网址 + 10 按钮 为此标签页添加书签 + 11 container + 12 弹出式按钮 ChatGPT +可以访问此网站 + 13 弹出式按钮 扩展程序 + 14 按钮 秋 + 15 弹出式按钮 Chrome + 16 工具栏 书签 + 17 工具栏 已保存的标签页分组 + 18 按钮 标签页分组 + 19 分离器 分隔符 + 20 书签文件夹按钮 代码库 + 21 书签文件夹按钮 后台网站 + 22 书签文件夹按钮 实用工具 + 23 书签文件夹按钮 开放平台 + 24 书签按钮 蒲公英 - 控制台 + 25 书签文件夹按钮 后台管理系统 + 26 书签文件夹按钮 学习博客 + 27 书签文件夹按钮 账号管理 + 28 书签文件夹按钮 设计 + 29 书签文件夹按钮 STM32 + 30 书签文件夹按钮 有趣的网站 + 31 书签文件夹按钮 Metal 学习 + 32 书签文件夹按钮 高清古画 + 33 书签文件夹按钮 所有书签 + 34 分离器 分隔符 + 35 container + 36 滚动区 + 37 HTML 内容 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ + 38 container + 39 弹出式按钮 Preview device: iPhone + 40 container + 41 container Device status bar + 42 文本 11:32 + 43 container + 44 container + 45 按钮 返回 + 46 标题 机巢工作台, Value: 1 + 47 文本 机巢工作台 + 48 按钮 收款码 + 49 文本 交互原型 · 无真实操作 + 50 按钮 体验本页其他状态 + 51 container + 52 标题 嵩山少林景区, Value: 2 + 53 文本 嵩山少林景区 + 54 图像 + 55 文本 已进入打卡范围 + 56 标题 吴家俊, Value: 3 + 57 文本 吴家俊 + 58 文本 现场工作人员 + 59 标题 无人机状态, Value: 2 + 60 文本 无人机状态 + 61 图像 + 62 文本 占用中 + 63 container + 64 图像 + 65 text 电池电量 95% + 66 container + 67 图像 + 68 text 环境温度 19.3°C + 69 container + 70 图像 + 71 text 风速 0m/s + 72 container + 73 图像 + 74 text 雨量 无雨 + 75 container + 76 图像 + 77 text 信号状态 良好 + 78 container + 79 图像 + 80 text 搜星状态 36颗 + 81 标题 我的拍摄订单 8, Value: 2 + 82 text 我的拍摄订单 8 + 83 按钮 查看全部 + 84 文本 仅展示分配给我的未完成订单 + 85 container + 86 标题 游客158****8888, Value: 2 + 87 text 游客 158****8888 + 88 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 3 次 剩余 2 次 + 89 按钮 继续拍摄 + 90 图像 + 91 文本 上传中 + 92 按钮 查看素材 + 93 container + 94 标题 游客136****2806, Value: 2 + 95 text 游客 136****2806 + 96 text 待拍摄 单次航拍 · 含 1 次拍摄 已拍摄 0 次 剩余 1 次 + 97 按钮 开始拍摄 + 98 container + 99 标题 游客139****5192, Value: 2 + 100 text 游客 139****5192 + 101 text 进行中 航拍套餐 · 含 5 次拍摄 已拍摄 2 次 剩余 3 次 + 102 按钮 继续拍摄 + 103 图像 + 104 文本 上传失败 + 105 按钮 查看素材 + 106 标题 今日数据, Value: 2 + 107 文本 今日数据 + 108 文本 12 + 109 文本 成交订单 + 110 文本 ¥1,896 + 111 文本 成交金额 + 112 文本 9 + 113 文本 完成拍摄 + 114 图像 + 115 弹出式按钮 标签页搜索 + 116 container + 117 标签页组 + 118 标签 (settable, boolean) ShowMeYourApps - 内存用量 - 310 MB, Value: off + 119 按钮 关闭 + 120 标签 (settable, boolean) Kavsoft - YouTube, Value: off + 121 按钮 关闭 + 122 标签 (settable, boolean) 你的星星 - 内存用量 - 589 MB, Value: off + 123 按钮 关闭 + 124 标签 (settable, boolean) excalidraw/excalidraw: Virtual whiteboard for sketching hand-drawn like diagrams - 内存用量 - 195 MB, Value: off + 125 按钮 关闭 + 126 标签 (settable, boolean) hyperoslo/Lightbox: :milky_way: A convenient and easy to use image viewer for your iOS app, Value: off + 127 按钮 关闭 + 128 标签 (settable, boolean) EhPanda-Team/EhPanda: An unofficial E-Hentai App for iOS built with SwiftUI & TCA. - 内存用量 - 354 MB, Value: off + 129 按钮 关闭 + 130 标签 (settable, boolean) Introduction - Blender 5.2 LTS Manual - 内存用量 - 53.2 MB, Value: off + 131 按钮 关闭 + 132 标签 (settable, boolean) ⁣‌​⁡‍‌⁡‍​​‌‬⁣⁤‌⁢⁤‌‌​​⁢‬‬‍⁣⁤‬​⁡‬‌​⁤​‌⁢​‬⁣⁣⁣⁣​随心瞰9.9.1 - 飞书云文档 - 内存用量 - 774 MB, Value: off + 133 按钮 关闭 + 134 标签 (settable, boolean) Swift Developer News – Hacking with Swift - 内存用量 - 175 MB, Value: off + 135 按钮 关闭 + 136 标签 (settable, boolean) Peter Friese - 内存用量 - 95.4 MB, Value: off + 137 按钮 关闭 + 138 标签 (selected, settable, boolean) 机巢 · 页面内交互体验 - 内存用量 - 84.9 MB, Value: on + 139 按钮 关闭 + 140 按钮 新标签页 + 141 按钮 打开 Chrome 中的 Gemini + 142 关闭按钮 + 143 全屏幕按钮 Help: 此按钮也可以执行缩放窗口的操作, Secondary Actions: 缩放窗口 + 144 最小化按钮 +145 menu bar + 146 Chrome + 147 文件 + 148 编辑 + 149 显示 + 150 历史记录 + 151 书签 + 152 个人资料 + 153 标签页 + 154 窗口 + 155 帮助 + +The focused UI element is 39 弹出式按钮 Preview device: iPhone \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/03-workbench-menu.txt b/docs/9.9.1/review/product-comparison/evidence/03-workbench-menu.txt new file mode 100644 index 0000000..af58c2d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/03-workbench-menu.txt @@ -0,0 +1,98 @@ +Window: "机巢 · 页面内交互体验", App: Google Chrome. +0 标准窗口 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/, Secondary Actions: Raise + 1 container 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/ + 2 container + 3 工具栏 + 4 按钮 返回 + 5 按钮 (disabled) 前进 + 6 按钮 重新加载 + 7 container + 8 弹出式按钮 查看网站信息 + 9 文本栏 (settable) 地址和搜索栏, Value: voicestudio.suixinkan.cn, Placeholder: 问问 Google 或输入网址 + 10 按钮 为此标签页添加书签 + 11 container + 12 弹出式按钮 ChatGPT +可以访问此网站 + 13 弹出式按钮 扩展程序 + 14 按钮 秋 + 15 弹出式按钮 Chrome + 16 工具栏 书签 + 17 工具栏 已保存的标签页分组 + 18 按钮 标签页分组 + 19 分离器 分隔符 + 20 书签文件夹按钮 代码库 + 21 书签文件夹按钮 后台网站 + 22 书签文件夹按钮 实用工具 + 23 书签文件夹按钮 开放平台 + 24 书签按钮 蒲公英 - 控制台 + 25 书签文件夹按钮 后台管理系统 + 26 书签文件夹按钮 学习博客 + 27 书签文件夹按钮 账号管理 + 28 书签文件夹按钮 设计 + 29 书签文件夹按钮 STM32 + 30 书签文件夹按钮 有趣的网站 + 31 书签文件夹按钮 Metal 学习 + 32 书签文件夹按钮 高清古画 + 33 书签文件夹按钮 所有书签 + 34 分离器 分隔符 + 35 container + 36 滚动区 + 37 HTML 内容 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ + 38 container 体验本页状态 + 39 标题 体验本页状态, Value: 2 + 40 文本 体验本页状态 + 41 文本 只切换当前页面。正常操作会自动推进,无需额外控制。 + 42 container + 43 按钮 设备空闲 + 44 按钮 无人机占用中 + 45 按钮 机巢未连接 + 46 按钮 无人机无信号 + 47 按钮 电量不足 + 48 按钮 设备状态未知 + 49 按钮 暂无拍摄订单 + 50 文本 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + 51 按钮 恢复正常体验 + 52 按钮 从头体验整个流程 + 53 弹出式按钮 标签页搜索 + 54 container + 55 标签页组 + 56 标签 (settable, boolean) ShowMeYourApps - 内存用量 - 310 MB, Value: off + 57 按钮 关闭 + 58 标签 (settable, boolean) Kavsoft - YouTube, Value: off + 59 按钮 关闭 + 60 标签 (settable, boolean) 你的星星 - 内存用量 - 589 MB, Value: off + 61 按钮 关闭 + 62 标签 (settable, boolean) excalidraw/excalidraw: Virtual whiteboard for sketching hand-drawn like diagrams - 内存用量 - 195 MB, Value: off + 63 按钮 关闭 + 64 标签 (settable, boolean) hyperoslo/Lightbox: :milky_way: A convenient and easy to use image viewer for your iOS app, Value: off + 65 按钮 关闭 + 66 标签 (settable, boolean) EhPanda-Team/EhPanda: An unofficial E-Hentai App for iOS built with SwiftUI & TCA. - 内存用量 - 354 MB, Value: off + 67 按钮 关闭 + 68 标签 (settable, boolean) Introduction - Blender 5.2 LTS Manual - 内存用量 - 53.2 MB, Value: off + 69 按钮 关闭 + 70 标签 (settable, boolean) ⁣‌​⁡‍‌⁡‍​​‌‬⁣⁤‌⁢⁤‌‌​​⁢‬‬‍⁣⁤‬​⁡‬‌​⁤​‌⁢​‬⁣⁣⁣⁣​随心瞰9.9.1 - 飞书云文档 - 内存用量 - 774 MB, Value: off + 71 按钮 关闭 + 72 标签 (settable, boolean) Swift Developer News – Hacking with Swift - 内存用量 - 175 MB, Value: off + 73 按钮 关闭 + 74 标签 (settable, boolean) Peter Friese - 内存用量 - 95.4 MB, Value: off + 75 按钮 关闭 + 76 标签 (selected, settable, boolean) 机巢 · 页面内交互体验 - 内存用量 - 84.9 MB, Value: on + 77 按钮 关闭 + 78 按钮 新标签页 + 79 按钮 打开 Chrome 中的 Gemini + 80 关闭按钮 + 81 全屏幕按钮 Help: 此按钮也可以执行缩放窗口的操作, Secondary Actions: 缩放窗口 + 82 最小化按钮 +83 menu bar + 84 Chrome + 85 文件 + 86 编辑 + 87 显示 + 88 历史记录 + 89 书签 + 90 个人资料 + 91 标签页 + 92 窗口 + 93 帮助 + +The focused UI element is 43 按钮 设备空闲 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/03a-refreshed-browser-state.txt b/docs/9.9.1/review/product-comparison/evidence/03a-refreshed-browser-state.txt new file mode 100644 index 0000000..284cce3 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/03a-refreshed-browser-state.txt @@ -0,0 +1,82 @@ +Window: "机巢 · 页面内交互体验", App: Google Chrome. +0 标准窗口 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/, Secondary Actions: Raise + 1 container 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/ + 2 container + 3 工具栏 + 4 按钮 返回 + 5 按钮 (disabled) 前进 + 6 按钮 重新加载 + 7 container + 8 弹出式按钮 查看网站信息 + 9 文本栏 (settable) 地址和搜索栏, Value: voicestudio.suixinkan.cn, Placeholder: 问问 Google 或输入网址 + 10 按钮 为此标签页添加书签 + 11 container + 12 弹出式按钮 ChatGPT +可以访问此网站 + 13 弹出式按钮 扩展程序 + 14 按钮 秋 + 15 弹出式按钮 Chrome + 16 工具栏 书签 + 17 工具栏 已保存的标签页分组 + 18 按钮 标签页分组 + 19 分离器 分隔符 + 20 书签文件夹按钮 代码库 + 21 书签文件夹按钮 后台网站 + 22 书签文件夹按钮 实用工具 + 23 书签文件夹按钮 开放平台 + 24 书签按钮 蒲公英 - 控制台 + 25 书签文件夹按钮 后台管理系统 + 26 书签文件夹按钮 学习博客 + 27 书签文件夹按钮 账号管理 + 28 书签文件夹按钮 设计 + 29 书签文件夹按钮 STM32 + 30 书签文件夹按钮 有趣的网站 + 31 书签文件夹按钮 Metal 学习 + 32 书签文件夹按钮 高清古画 + 33 书签文件夹按钮 所有书签 + 34 分离器 分隔符 + 35 container + 36 滚动区 + 37 HTML 内容 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ + 38 container 体验本页状态 + 39 标题 体验本页状态, Value: 2 + 40 文本 体验本页状态 + 41 文本 只切换当前页面。正常操作会自动推进,无需额外控制。 + 42 container + 43 按钮 设备空闲 + 44 按钮 无人机占用中 + 45 按钮 机巢未连接 + 46 按钮 无人机无信号 + 47 按钮 电量不足 + 48 按钮 设备状态未知 + 49 按钮 暂无拍摄订单 + 50 文本 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + 51 按钮 恢复正常体验 + 52 按钮 从头体验整个流程 + 53 弹出式按钮 标签页搜索 + 54 container + 55 标签页组 + 56 标签 (settable, boolean) ShowMeYourApps - 内存用量 - 310 MB, Value: off + 57 按钮 关闭 + 58 标签 (settable, boolean) Kavsoft - YouTube, Value: off + 59 按钮 关闭 + 60 标签 (selected, settable, boolean) 机巢 · 页面内交互体验 - 内存用量 - 86.8 MB, Value: on + 61 按钮 关闭 + 62 按钮 新标签页 + 63 按钮 打开 Chrome 中的 Gemini + 64 关闭按钮 + 65 全屏幕按钮 Help: 此按钮也可以执行缩放窗口的操作, Secondary Actions: 缩放窗口 + 66 最小化按钮 +67 menu bar + 68 Chrome + 69 文件 + 70 编辑 + 71 显示 + 72 历史记录 + 73 书签 + 74 个人资料 + 75 标签页 + 76 窗口 + 77 帮助 + +The focused UI element is 43 按钮 设备空闲 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/04-workbench-disconnected.txt b/docs/9.9.1/review/product-comparison/evidence/04-workbench-disconnected.txt new file mode 100644 index 0000000..7d5a316 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/04-workbench-disconnected.txt @@ -0,0 +1,82 @@ +Window: "机巢 · 页面内交互体验", App: Google Chrome. +0 标准窗口 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/, Secondary Actions: Raise + 1 container 机巢 · 页面内交互体验 - Google Chrome, URL: voicestudio.suixinkan.cn/ + 2 container + 3 工具栏 + 4 按钮 返回 + 5 按钮 (disabled) 前进 + 6 按钮 重新加载 + 7 container + 8 弹出式按钮 查看网站信息 + 9 文本栏 (settable) 地址和搜索栏, Value: voicestudio.suixinkan.cn, Placeholder: 问问 Google 或输入网址 + 10 按钮 为此标签页添加书签 + 11 container + 12 弹出式按钮 ChatGPT +可以访问此网站 + 13 弹出式按钮 扩展程序 + 14 按钮 秋 + 15 弹出式按钮 Chrome + 16 工具栏 书签 + 17 工具栏 已保存的标签页分组 + 18 按钮 标签页分组 + 19 分离器 分隔符 + 20 书签文件夹按钮 代码库 + 21 书签文件夹按钮 后台网站 + 22 书签文件夹按钮 实用工具 + 23 书签文件夹按钮 开放平台 + 24 书签按钮 蒲公英 - 控制台 + 25 书签文件夹按钮 后台管理系统 + 26 书签文件夹按钮 学习博客 + 27 书签文件夹按钮 账号管理 + 28 书签文件夹按钮 设计 + 29 书签文件夹按钮 STM32 + 30 书签文件夹按钮 有趣的网站 + 31 书签文件夹按钮 Metal 学习 + 32 书签文件夹按钮 高清古画 + 33 书签文件夹按钮 所有书签 + 34 分离器 分隔符 + 35 container + 36 滚动区 + 37 HTML 内容 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ + 38 container 体验本页状态 + 39 标题 体验本页状态, Value: 2 + 40 文本 体验本页状态 + 41 文本 只切换当前页面。正常操作会自动推进,无需额外控制。 + 42 container + 43 按钮 设备空闲 + 44 按钮 无人机占用中 + 45 按钮 机巢未连接 + 46 按钮 无人机无信号 + 47 按钮 电量不足 + 48 按钮 设备状态未知 + 49 按钮 暂无拍摄订单 + 50 文本 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + 51 按钮 恢复正常体验 + 52 按钮 从头体验整个流程 + 53 弹出式按钮 标签页搜索 + 54 container + 55 标签页组 + 56 标签 (settable, boolean) ShowMeYourApps - 内存用量 - 310 MB, Value: off + 57 按钮 关闭 + 58 标签 (settable, boolean) Kavsoft - YouTube, Value: off + 59 按钮 关闭 + 60 标签 (selected, settable, boolean) 机巢 · 页面内交互体验 - 内存用量 - 86.8 MB, Value: on + 61 按钮 关闭 + 62 按钮 新标签页 + 63 按钮 打开 Chrome 中的 Gemini + 64 关闭按钮 + 65 全屏幕按钮 Help: 此按钮也可以执行缩放窗口的操作, Secondary Actions: 缩放窗口 + 66 最小化按钮 +67 menu bar + 68 Chrome + 69 文件 + 70 编辑 + 71 显示 + 72 历史记录 + 73 书签 + 74 个人资料 + 75 标签页 + 76 窗口 + 77 帮助 + +The focused UI element is 45 按钮 机巢未连接 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight/F01-prepare-current.txt b/docs/9.9.1/review/product-comparison/evidence/flight/F01-prepare-current.txt new file mode 100644 index 0000000..1f4fb04 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight/F01-prepare-current.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:46 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight/F02-summon-after.txt b/docs/9.9.1/review/product-comparison/evidence/flight/F02-summon-after.txt new file mode 100644 index 0000000..0d05710 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight/F02-summon-after.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:47 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F01-preparation.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F01-preparation.txt new file mode 100644 index 0000000..d89df91 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F01-preparation.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F02-preparation-menu.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F02-preparation-menu.txt new file mode 100644 index 0000000..29a59ed --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F02-preparation-menu.txt @@ -0,0 +1,153 @@ +- button: + - generic: iPhone +- generic: 1:58 +- banner: + - button: + - heading [level=1]: 拍摄准备 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading [level=2]: 游客136****2806 + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading [level=2]: 拍摄点 + - region: + - button [pressed]: + - heading [level=3]: 三皇寨 + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button: + - heading [level=3]: 金阙云宫 + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button: + - heading [level=3]: 少室山 + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button: + - heading [level=3]: 迎客峰 + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup: + - radio [checked]: + - strong: 经典航线 + - radio: + - strong: 环绕专线 + - radio: + - strong: 远景拉升 + - radio: + - strong: 全景环绕 + - radio: + - strong: 高空俯瞰 + - radio: + - strong: 山峰渐远 + - radio: + - strong: 峡谷穿行 + - radio: + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading [level=3]: 三皇寨 · 经典航线 + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button: 确认并召唤无人机 + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "设备空闲" [active]: + - text: 设备空闲 + - button "无人机占用中": + - text: 无人机占用中 + - button "机巢未连接": + - text: 机巢未连接 + - button "无人机无信号": + - text: 无人机无信号 + - button "电量不足": + - text: 电量不足 + - button "设备状态未知": + - text: 设备状态未知 + - button "不在拍摄范围": + - text: 不在拍摄范围 + - button "暂无可用航线": + - text: 暂无可用航线 + - button "拍摄次数用完": + - text: 拍摄次数用完 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F03-prep-occupied.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F03-prep-occupied.txt new file mode 100644 index 0000000..ced5169 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F03-prep-occupied.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 无人机占用中,请稍后再试 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F04-prep-disconnected.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F04-prep-disconnected.txt new file mode 100644 index 0000000..a0cb601 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F04-prep-disconnected.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 未连接 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢未连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 未连接 + - button "确认并召唤无人机" [disabled] + - status: 机巢未连接,请连接后重试 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F05-prep-nosignal.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F05-prep-nosignal.txt new file mode 100644 index 0000000..b5a3ed2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F05-prep-nosignal.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 无信号 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 无信号 + - button "确认并召唤无人机" [disabled] + - status: 无人机无信号,暂时无法召唤 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F06-prep-lowbattery.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F06-prep-lowbattery.txt new file mode 100644 index 0000000..2ea6af2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F06-prep-lowbattery.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 低电量 + - generic: 电池电量 + - strong: 18% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 低电量 · 电量 18% + - button "确认并召唤无人机" [disabled] + - status: 电量不足,设备暂不允许执行 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F07-prep-unknown.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F07-prep-unknown.txt new file mode 100644 index 0000000..d101402 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F07-prep-unknown.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 状态未知 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 状态未知 + - button "确认并召唤无人机" [disabled] + - status: 无人机状态未知,请刷新确认 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F08-prep-outofrange.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F08-prep-outofrange.txt new file mode 100644 index 0000000..32198b6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F08-prep-outofrange.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 尚未进入范围 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 请先进入所选拍摄点的范围 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F09-prep-noroutes.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F09-prep-noroutes.txt new file mode 100644 index 0000000..2178470 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F09-prep-noroutes.txt @@ -0,0 +1,115 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 0 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 0 条 + - heading "暂无可用航线" [level=3] + - paragraph: 请选择其他拍摄点,或稍后重试 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 未选择航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前拍摄点暂无可用航线 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F10-prep-zeroquota.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F10-prep-zeroquota.txt new file mode 100644 index 0000000..7694d1a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F10-prep-zeroquota.txt @@ -0,0 +1,115 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 0 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 0 条 + - heading "暂无可用航线" [level=3] + - paragraph: 请选择其他拍摄点,或稍后重试 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 未选择航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前订单拍摄次数已用完 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F11-prep-restored.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F11-prep-restored.txt new file mode 100644 index 0000000..7984de6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F11-prep-restored.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F12-prep-switched-point.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F12-prep-switched-point.txt new file mode 100644 index 0000000..c5cb03d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F12-prep-switched-point.txt @@ -0,0 +1,120 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [active] [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F13-prep-return-first-point.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F13-prep-return-first-point.txt new file mode 100644 index 0000000..17d40bf --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F13-prep-return-first-point.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [active] [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F14-prep-choice-memory.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F14-prep-choice-memory.txt new file mode 100644 index 0000000..a90bd36 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F14-prep-choice-memory.txt @@ -0,0 +1,120 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [active] [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 金顶渐远" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F15-summon-actual.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F15-summon-actual.txt new file mode 100644 index 0000000..37f6294 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F15-summon-actual.txt @@ -0,0 +1,89 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F16-task-menu.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F16-task-menu.txt new file mode 100644 index 0000000..59dc968 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F16-task-menu.txt @@ -0,0 +1,119 @@ +- button: + - generic: iPhone +- generic: 2:01 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 游客136****2806 + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading [level=2]: 拍摄点 + - region: + - button: + - heading [level=3]: 三皇寨 + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button [pressed]: + - heading [level=3]: 金阙云宫 + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button: + - heading [level=3]: 少室山 + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button: + - heading [level=3]: 迎客峰 + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup: + - radio: + - strong: 云宫环绕 + - radio [checked]: + - strong: 金顶渐远 + - radio: + - strong: 云海全景 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机已到达 + - heading [level=3]: 是否开始拍摄? + - paragraph: 确认游客站位与取景后开始 + - button: + - text: 开始拍摄 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button: + - strong: 立即返航 + - generic: 中断任务 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达" [active]: + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F17-task-arrived-preview.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F17-task-arrived-preview.txt new file mode 100644 index 0000000..37f6294 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F17-task-arrived-preview.txt @@ -0,0 +1,89 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F18-pause-action.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F18-pause-action.txt new file mode 100644 index 0000000..b6043fb --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F18-pause-action.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F19-resume-action.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F19-resume-action.txt new file mode 100644 index 0000000..3f92c5c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F19-resume-action.txt @@ -0,0 +1,89 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F20-shoot-action.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F20-shoot-action.txt new file mode 100644 index 0000000..67d6793 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F20-shoot-action.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F21-shoot-autoprogress.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F21-shoot-autoprogress.txt new file mode 100644 index 0000000..c250b2c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F21-shoot-autoprogress.txt @@ -0,0 +1,93 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F22-success-still-returning.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F22-success-still-returning.txt new file mode 100644 index 0000000..b8f4eda --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F22-success-still-returning.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F23-complete-preview.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F23-complete-preview.txt new file mode 100644 index 0000000..756386b --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F23-complete-preview.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F24-return-workbench-zero.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F24-return-workbench-zero.txt new file mode 100644 index 0000000..a832027 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F24-return-workbench-zero.txt @@ -0,0 +1,93 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "任务仍在执行": + - heading "任务仍在执行" [level=2] + - paragraph: 离开后将无法实时查看画面与状态。是否离开? + - button "离开页面" + - button "继续查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F25-workbench-after-zero.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F25-workbench-after-zero.txt new file mode 100644 index 0000000..9afe0eb --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F25-workbench-after-zero.txt @@ -0,0 +1,121 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 金顶渐远" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "继续查看任务" + - status: 当前订单已有任务执行中,请继续查看原任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F26-home-zero-returning.png b/docs/9.9.1/review/product-comparison/evidence/flight2/F26-home-zero-returning.png new file mode 100644 index 0000000..7f32cb6 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/evidence/flight2/F26-home-zero-returning.png differ diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F26-home-zero-returning.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F26-home-zero-returning.txt new file mode 100644 index 0000000..fe035b8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F26-home-zero-returning.txt @@ -0,0 +1,74 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F27-orders-zero.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F27-orders-zero.txt new file mode 100644 index 0000000..3035936 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F27-orders-zero.txt @@ -0,0 +1,206 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F28-completed-task-entry.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F28-completed-task-entry.txt new file mode 100644 index 0000000..87683f6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F28-completed-task-entry.txt @@ -0,0 +1,131 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:05 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [active] [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F29-resumed-completed-task.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F29-resumed-completed-task.txt new file mode 100644 index 0000000..64f62a7 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F29-resumed-completed-task.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:05 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F30-menu-result.png b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-menu-result.png new file mode 100644 index 0000000..c4ef209 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-menu-result.png differ diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-hover.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-hover.txt new file mode 100644 index 0000000..c864f20 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-hover.txt @@ -0,0 +1,137 @@ +- button: + - generic: iPhone +- generic: 2:05 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机已暂停 + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button: + - text: 继续任务 + - generic: 安全控制 + - button [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button: + - strong: 立即返航 + - generic: 中断任务 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停" [active]: + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-returning.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-returning.txt new file mode 100644 index 0000000..3d271c7 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-returning.txt @@ -0,0 +1,137 @@ +- button: + - generic: iPhone +- generic: 2:05 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机正在返航 + - paragraph: 本次拍摄已中断。 请留意实时画面与无人机状态。 + - button [disabled]: + - text: 拍摄已中断 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中" [active]: + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-shooting.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-shooting.txt new file mode 100644 index 0000000..2a82512 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F30-task-shooting.txt @@ -0,0 +1,137 @@ +- button: + - generic: iPhone +- generic: 2:05 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机正在拍摄中 + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button: + - strong: 立即返航 + - generic: 中断任务 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中" [active]: + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-failed-ready.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-failed-ready.txt new file mode 100644 index 0000000..ed2943c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-failed-ready.txt @@ -0,0 +1,139 @@ +- button: + - generic: iPhone +- generic: 2:06 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 上次任务画面 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 任务执行失败 + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button [disabled]: + - text: 重新召唤无人机 + - paragraph: 当前订单拍摄次数已用完 + - generic: 安全控制 + - button [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试" [active]: + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-failed-returning.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-failed-returning.txt new file mode 100644 index 0000000..37b6946 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-failed-returning.txt @@ -0,0 +1,139 @@ +- button: + - generic: iPhone +- generic: 2:06 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 任务执行失败 + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机返航中,暂不可召唤 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中" [active]: + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-feed-lost.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-feed-lost.txt new file mode 100644 index 0000000..a47b9c4 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F31-task-feed-lost.txt @@ -0,0 +1,138 @@ +- button: + - generic: iPhone +- generic: 2:06 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - heading [level=3]: 直播画面连接中断 + - paragraph: 无人机状态仍在更新 + - button: 重新连接画面 + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机正在拍摄中 + - paragraph: 当前仅画面中断,请关注现场。 请勿关闭本页或息屏。 + - button [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button: + - strong: 立即返航 + - generic: 中断任务 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流" [active]: + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F32-feed-reconnect.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F32-feed-reconnect.txt new file mode 100644 index 0000000..9de35e1 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F32-feed-reconnect.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:06 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-command-timeout.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-command-timeout.txt new file mode 100644 index 0000000..b450c82 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-command-timeout.txt @@ -0,0 +1,138 @@ +- button: + - generic: iPhone +- generic: 2:06 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机已到达 + - heading [level=3]: 是否开始拍摄? + - paragraph: 确认游客站位与取景后开始 + - button: + - text: 开始拍摄 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button: + - strong: 立即返航 + - generic: 中断任务 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时" [active]: + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-phone-offline.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-phone-offline.txt new file mode 100644 index 0000000..321e120 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-phone-offline.txt @@ -0,0 +1,140 @@ +- button: + - generic: iPhone +- generic: 2:06 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - heading [level=3]: 手机网络连接中断 + - paragraph: 请检查网络后重新连接 + - button: 重新连接 + - region: + - paragraph: + - text: 状态暂未更新 + - generic: 电池电量 + - strong: + - text: — + - generic: 环境温度 + - strong: + - text: — + - generic: 风速 + - strong: + - text: — + - generic: 雨量 + - strong: + - text: — + - generic: 信号状态 + - strong: + - text: — + - generic: 搜星状态 + - strong: + - text: — + - status: + - heading [level=2]: 任务状态待确认 + - paragraph: 连接中断不代表任务失败。 恢复连接后将同步当前任务。 + - button [disabled]: + - text: 等待连接恢复 + - generic: 安全控制 + - button [disabled]: + - strong: 紧急暂停 + - generic: 当前无法发送指令 + - button [disabled]: + - strong: 立即返航 + - generic: 当前无法发送指令 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网" [active]: + - text: 手机断网 + - button "保护性返航": + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-protective-return.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-protective-return.txt new file mode 100644 index 0000000..1088d2d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F33-task-protective-return.txt @@ -0,0 +1,137 @@ +- button: + - generic: iPhone +- generic: 2:06 +- banner: + - button: + - heading [level=1]: 拍摄任务 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 5 + - article: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button: 继续查看任务 + - button: 交付成片 + - text: 上传中 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading [level=2]: 金阙云宫 · 金顶渐远 + - paragraph: 游客136****2806·含1次拍摄 + - region: + - text: 实时图传 + - button: + - region: + - generic: 电池电量 + - strong: + - text: 18% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading [level=2]: 无人机自动返航 + - paragraph: 返航原因:电量不足 拍摄结果待确认,请留意实时画面及现场。 + - button [disabled]: + - text: 结果待确认 + - generic: 安全控制 + - button: + - strong: 紧急暂停 + - generic: 悬停待命 + - button [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "已到达": + - text: 已到达 + - button "拍摄中": + - text: 拍摄中 + - button "悬停": + - text: 悬停 + - button "返航中": + - text: 返航中 + - button "拍摄完成": + - text: 拍摄完成 + - button "失败·返航中": + - text: 失败·返航中 + - button "失败·可重试": + - text: 失败·可重试 + - button "画面断流": + - text: 画面断流 + - button "手机断网": + - text: 手机断网 + - button "保护性返航" [active]: + - text: 保护性返航 + - button "拍摄完成弹窗": + - text: 拍摄完成弹窗 + - button "执行失败弹窗": + - text: 执行失败弹窗 + - button "体验指令超时": + - text: 体验指令超时 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F34-command-unknown.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F34-command-unknown.txt new file mode 100644 index 0000000..47c3dba --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F34-command-unknown.txt @@ -0,0 +1,113 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:06 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - strong: + - text: 执行结果待确认 + - paragraph: 暂未确认是否已开始拍摄。请刷新任务状态,勿重复发送指令。 + - button "刷新任务状态": + - text: 刷新任务状态 + - button "执行结果待确认" [disabled]: + - text: 执行结果待确认 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F35-command-refresh.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F35-command-refresh.txt new file mode 100644 index 0000000..9de35e1 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F35-command-refresh.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:06 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F36-post-refresh-result.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F36-post-refresh-result.txt new file mode 100644 index 0000000..c83a39f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F36-post-refresh-result.txt @@ -0,0 +1,112 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:07 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F37-failure-dialog.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F37-failure-dialog.txt new file mode 100644 index 0000000..c10e985 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F37-failure-dialog.txt @@ -0,0 +1,113 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:07 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机返航中,暂不可召唤 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "任务执行失败": + - heading "任务执行失败" [level=2] + - paragraph: 请排查错误后 再次召唤无人机。 + - button "确定" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F38-success-dialog-preview.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F38-success-dialog-preview.txt new file mode 100644 index 0000000..3231a12 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F38-success-dialog-preview.txt @@ -0,0 +1,112 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:07 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F39-reset-scenario.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F39-reset-scenario.txt new file mode 100644 index 0000000..080369d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F39-reset-scenario.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:08 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F40-package-prep.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F40-package-prep.txt new file mode 100644 index 0000000..5837677 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F40-package-prep.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:08 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F41-package-arrived.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F41-package-arrived.txt new file mode 100644 index 0000000..77a5fcc --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F41-package-arrived.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:08 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F42-failed-ready-nonzero.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F42-failed-ready-nonzero.txt new file mode 100644 index 0000000..6f0bef4 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F42-failed-ready-nonzero.txt @@ -0,0 +1,100 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:08 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F43-retry-destination.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F43-retry-destination.txt new file mode 100644 index 0000000..60a3e7d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F43-retry-destination.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:09 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F44-summon-immediate.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F44-summon-immediate.txt new file mode 100644 index 0000000..78eb214 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F44-summon-immediate.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F45-return-confirm.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F45-return-confirm.txt new file mode 100644 index 0000000..1babecc --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F45-return-confirm.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "本次拍摄已中断" [level=2] + - paragraph: 无人机已返回机巢,本次未扣减拍摄次数。 可重新选择点位和航线开始任务。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F46-return-preview.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F46-return-preview.txt new file mode 100644 index 0000000..9c2432d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F46-return-preview.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:10 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在返航" [level=2] + - paragraph: 本次拍摄已中断。 请留意实时画面与无人机状态。 + - button "拍摄已中断" [disabled]: + - text: 拍摄已中断 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F47-return-paused.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F47-return-paused.txt new file mode 100644 index 0000000..1ba827a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F47-return-paused.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:10 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在返航" [level=2] + - paragraph: 本次拍摄已中断。 请留意实时画面与无人机状态。 + - button "拍摄已中断" [disabled]: + - text: 拍摄已中断 + - generic: 安全控制 + - button "正在暂停 尚未确认悬停" [disabled]: + - strong: 正在暂停 + - generic: 尚未确认悬停 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F48-return-pause-confirmed.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F48-return-pause-confirmed.txt new file mode 100644 index 0000000..996e85a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F48-return-pause-confirmed.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:10 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F49-return-resume-pending.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F49-return-resume-pending.txt new file mode 100644 index 0000000..4efdf57 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F49-return-resume-pending.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:10 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "正在继续任务" [disabled]: + - text: 正在继续任务 + - paragraph: 等待设备确认,不可重复启动。 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F50-return-resume-confirmed.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F50-return-resume-confirmed.txt new file mode 100644 index 0000000..49d0a2a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F50-return-resume-confirmed.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:10 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "本次拍摄已中断" [level=2] + - paragraph: 无人机已返回机巢,本次未扣减拍摄次数。 可重新选择点位和航线开始任务。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F51-active-A.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F51-active-A.txt new file mode 100644 index 0000000..73cb858 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F51-active-A.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:11 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F52-leave-A-confirm.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F52-leave-A-confirm.txt new file mode 100644 index 0000000..bc9a28c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F52-leave-A-confirm.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:11 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 +- alertdialog "任务仍在执行": + - heading "任务仍在执行" [level=2] + - paragraph: 离开后将无法实时查看画面与状态。是否离开? + - button "离开页面" + - button "继续查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F53-left-A-to-prep.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F53-left-A-to-prep.txt new file mode 100644 index 0000000..625d8be --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F53-left-A-to-prep.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:11 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "继续查看任务" + - status: 当前订单已有任务执行中,请继续查看原任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F54-home-A-active.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F54-home-A-active.txt new file mode 100644 index 0000000..fbea06c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F54-home-A-active.txt @@ -0,0 +1,100 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:12 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客158****8888" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 已拍 1 次": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客158****8888·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F55-reset-for-third.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F55-reset-for-third.txt new file mode 100644 index 0000000..e026240 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F55-reset-for-third.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:12 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F56-third-prep.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F56-third-prep.txt new file mode 100644 index 0000000..1037534 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F56-third-prep.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F57-prep-idle-preview.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F57-prep-idle-preview.txt new file mode 100644 index 0000000..1037534 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F57-prep-idle-preview.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F58-third-arrived.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F58-third-arrived.txt new file mode 100644 index 0000000..51b2aaf --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F58-third-arrived.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F59-third-leave-confirm.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F59-third-leave-confirm.txt new file mode 100644 index 0000000..4fd7e8d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F59-third-leave-confirm.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 +- alertdialog "任务仍在执行": + - heading "任务仍在执行" [level=2] + - paragraph: 离开后将无法实时查看画面与状态。是否离开? + - button "离开页面" + - button "继续查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F60-third-left-prep.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F60-third-left-prep.txt new file mode 100644 index 0000000..696e3f1 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F60-third-left-prep.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "继续查看任务" + - status: 当前订单已有任务执行中,请继续查看原任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F61-home-third-active.png b/docs/9.9.1/review/product-comparison/evidence/flight2/F61-home-third-active.png new file mode 100644 index 0000000..ce55919 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/evidence/flight2/F61-home-third-active.png differ diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F61-home-third-active.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F61-home-third-active.txt new file mode 100644 index 0000000..37be283 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F61-home-third-active.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:14 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F62-B-prep-A-active.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F62-B-prep-A-active.txt new file mode 100644 index 0000000..53e5c4f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F62-B-prep-A-active.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:14 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 无人机占用中,请等待当前任务结束 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/flight2/F63-B-change-route-occupied.txt b/docs/9.9.1/review/product-comparison/evidence/flight2/F63-B-change-route-occupied.txt new file mode 100644 index 0000000..31f658e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/flight2/F63-B-change-route-occupied.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:14 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线": + - strong: 经典航线 + - radio "环绕专线" [checked] [active]: + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 环绕专线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 无人机占用中,请等待当前任务结束 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/iab/P00-workbench-normal.txt b/docs/9.9.1/review/product-comparison/evidence/iab/P00-workbench-normal.txt new file mode 100644 index 0000000..7f1f5ca --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/iab/P00-workbench-normal.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 11:42 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M01-orders-all.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M01-orders-all.txt new file mode 100644 index 0000000..26b89aa --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M01-orders-all.txt @@ -0,0 +1,204 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M02-orders-pending.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M02-orders-pending.txt new file mode 100644 index 0000000..2534b7e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M02-orders-pending.txt @@ -0,0 +1,116 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" [active] [pressed] + - button "进行中" + - button "已完成" + - heading "待拍摄订单 4" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - paragraph: 已显示全部 4 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M03-orders-progress.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M03-orders-progress.txt new file mode 100644 index 0000000..33d99b8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M03-orders-progress.txt @@ -0,0 +1,128 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [active] [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - paragraph: 已显示全部 4 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M04-orders-complete.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M04-orders-complete.txt new file mode 100644 index 0000000..4731acd --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M04-orders-complete.txt @@ -0,0 +1,120 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [active] [pressed] + - heading "已完成订单 4" [level=2] + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 4 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M05-orders-state-menu.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M05-orders-state-menu.txt new file mode 100644 index 0000000..005ae41 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M05-orders-state-menu.txt @@ -0,0 +1,129 @@ +- button: + - generic: iPhone +- generic: 1:58 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button: 进行中 + - button [pressed]: 已完成 + - heading [level=2]: 已完成订单 4 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 4 个订单 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "正常订单列表" [active]: + - text: 正常订单列表 + - button "暂无分配订单": + - text: 暂无分配订单 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M06-orders-empty.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M06-orders-empty.txt new file mode 100644 index 0000000..0586f97 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M06-orders-empty.txt @@ -0,0 +1,56 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 0" [level=2] + - heading "暂无已完成订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M07-orders-empty-all.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M07-orders-empty-all.txt new file mode 100644 index 0000000..2f6bcf7 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M07-orders-empty-all.txt @@ -0,0 +1,56 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [active] [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 0" [level=2] + - heading "暂无订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M08-orders-restored.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M08-orders-restored.txt new file mode 100644 index 0000000..05e632a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M08-orders-restored.txt @@ -0,0 +1,204 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M09-materials-entry.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M09-materials-entry.txt new file mode 100644 index 0000000..5c4db1f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M09-materials-entry.txt @@ -0,0 +1,210 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M10-materials-state-menu.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M10-materials-state-menu.txt new file mode 100644 index 0000000..434510f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M10-materials-state-menu.txt @@ -0,0 +1,231 @@ +- button: + - generic: iPhone +- generic: 2:00 +- banner: + - banner: + - button: + - heading [level=1]: 订单素材库 + - button: + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传失败 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传失败 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传完成 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传完成 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [pressed]: 全部点位 + - button: 三皇寨 + - button: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - button: + - heading [level=4]: 素材05 + - paragraph: 上传完成 · 可下载 + - button + - button: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - heading [level=4]: 素材02 + - button: 重试上传 + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button [disabled]: + - text: 下载所选素材 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "素材上传中" [active]: + - text: 素材上传中 + - button "素材上传完成": + - text: 素材上传完成 + - button "素材上传失败": + - text: 素材上传失败 + - button "未选择素材": + - text: 未选择素材 + - button "已选择素材": + - text: 已选择素材 + - button "下载中": + - text: 下载中 + - button "下载完成": + - text: 下载完成 + - button "下载失败": + - text: 下载失败 + - button "重试中": + - text: 重试中 + - button "离开确认": + - text: 离开确认 + - button "相册权限不足": + - text: 相册权限不足 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M11-uploading.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M11-uploading.txt new file mode 100644 index 0000000..097e7b2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M11-uploading.txt @@ -0,0 +1,199 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - generic "素材05上传中": + - heading "素材05" [level=4] + - paragraph: 上传中 + - generic "素材06上传中": + - heading "素材06" [level=4] + - paragraph: 上传中 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传中": + - heading "素材03" [level=4] + - paragraph: 上传中 + - generic "素材04上传中": + - heading "素材04" [level=4] + - paragraph: 上传中 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传中": + - heading "素材01" [level=4] + - paragraph: 上传中 + - generic "素材02上传中": + - heading "素材02" [level=4] + - paragraph: 上传中 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M12-upload-failed.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M12-upload-failed.txt new file mode 100644 index 0000000..770e0e5 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M12-upload-failed.txt @@ -0,0 +1,226 @@ +- button: + - generic: iPhone +- generic: 2:00 +- banner: + - banner: + - button: + - heading [level=1]: 订单素材库 + - button: + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传失败 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传失败 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客137****6628 + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传完成 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button: 继续拍摄 + - button: 交付成片 + - text: 上传完成 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button: 开始拍摄 + - button: 交付成片 + - article: + - heading [level=2]: 游客180****4075 + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客185****5736 + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - article: + - heading [level=2]: 游客188****3160 + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button: 查看素材 + - button: 交付成片 + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [pressed]: 全部点位 + - button: 三皇寨 + - button: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - heading [level=4]: 素材05 + - button: 重试上传 + - paragraph: 上传失败 + - heading [level=4]: 素材06 + - button: 重试上传 + - paragraph: 上传失败 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - heading [level=4]: 素材03 + - button: 重试上传 + - paragraph: 上传失败 + - heading [level=4]: 素材04 + - button: 重试上传 + - paragraph: 上传失败 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - heading [level=4]: 素材01 + - button: 重试上传 + - paragraph: 上传失败 + - heading [level=4]: 素材02 + - button: 重试上传 + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button [disabled]: + - text: 下载所选素材 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "素材上传中": + - text: 素材上传中 + - button "素材上传完成": + - text: 素材上传完成 + - button "素材上传失败" [active]: + - text: 素材上传失败 + - button "未选择素材": + - text: 未选择素材 + - button "已选择素材": + - text: 已选择素材 + - button "下载中": + - text: 下载中 + - button "下载完成": + - text: 下载完成 + - button "下载失败": + - text: 下载失败 + - button "重试中": + - text: 重试中 + - button "离开确认": + - text: 离开确认 + - button "相册权限不足": + - text: 相册权限不足 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M13-upload-failed-visible.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M13-upload-failed-visible.txt new file mode 100644 index 0000000..52f61d3 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M13-upload-failed-visible.txt @@ -0,0 +1,205 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - generic "素材05上传失败": + - heading "素材05" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材06上传失败": + - heading "素材06" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传失败": + - heading "素材03" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材04上传失败": + - heading "素材04" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传失败": + - heading "素材01" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M14-upload-retry.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M14-upload-retry.txt new file mode 100644 index 0000000..990fb14 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M14-upload-retry.txt @@ -0,0 +1,206 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材06上传失败": + - heading "素材06" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传失败": + - heading "素材03" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材04上传失败": + - heading "素材04" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传失败": + - heading "素材01" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M15-select-eligible-only.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M15-select-eligible-only.txt new file mode 100644 index 0000000..ad8c140 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M15-select-eligible-only.txt @@ -0,0 +1,206 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材06上传失败": + - heading "素材06" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传失败": + - heading "素材03" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材04上传失败": + - heading "素材04" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传失败": + - heading "素材01" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择1项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M16-preview.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M16-preview.txt new file mode 100644 index 0000000..081d589 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M16-preview.txt @@ -0,0 +1,204 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [pressed]: 全部点位 + - button: 三皇寨 + - button: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [pressed]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - button [pressed]: + - heading [level=4]: 素材05 + - paragraph: 上传完成 · 可下载 + - heading [level=4]: 素材06 + - button: 重试上传 + - paragraph: 上传失败 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - heading [level=4]: 素材03 + - button: 重试上传 + - paragraph: 上传失败 + - heading [level=4]: 素材04 + - button: 重试上传 + - paragraph: 上传失败 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - heading [level=4]: 素材01 + - button: 重试上传 + - paragraph: 上传失败 + - heading [level=4]: 素材02 + - button: 重试上传 + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择1项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- dialog "素材预览": + - button "关闭素材预览": + - img "素材05" + - paragraph: 素材05 · 演示素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M17-download-normal.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M17-download-normal.txt new file mode 100644 index 0000000..9d1857e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M17-download-normal.txt @@ -0,0 +1,208 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - generic "素材06上传失败": + - heading "素材06" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传失败": + - heading "素材03" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材04上传失败": + - heading "素材04" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传失败": + - heading "素材01" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 1项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M18-素材上传完成.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M18-素材上传完成.txt new file mode 100644 index 0000000..684fd4e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M18-素材上传完成.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M19-未选择素材.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M19-未选择素材.txt new file mode 100644 index 0000000..684fd4e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M19-未选择素材.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M20-已选择素材.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M20-已选择素材.txt new file mode 100644 index 0000000..d9f3a31 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M20-已选择素材.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M21-下载中.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M21-下载中.txt new file mode 100644 index 0000000..7f789a6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M21-下载中.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [disabled] [pressed]: + - heading "素材02" [level=4] + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M22-download-back-confirm.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M22-download-back-confirm.txt new file mode 100644 index 0000000..593c7a6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M22-download-back-confirm.txt @@ -0,0 +1,213 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - heading [level=4]: 素材05 + - paragraph: + - text: 已下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… +- alertdialog "素材仍在下载": + - heading "素材仍在下载" [level=2] + - paragraph: 离开将停止未完成的下载,已保存的素材会保留。确定离开吗? + - button "离开并停止" + - button "继续下载" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M23-leave-cancel-continue.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M23-leave-cancel-continue.txt new file mode 100644 index 0000000..7f789a6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M23-leave-cancel-continue.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [disabled] [pressed]: + - heading "素材02" [level=4] + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M24-下载完成.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M24-下载完成.txt new file mode 100644 index 0000000..75a39ea --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M24-下载完成.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 2项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M25-下载失败.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M25-下载失败.txt new file mode 100644 index 0000000..3c92c6e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M25-下载失败.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02下载失败": + - heading "素材02" [level=4] + - button "重试下载" + - paragraph: + - text: 下载失败 +- contentinfo: + - contentinfo: + - heading "部分素材下载失败" [level=3] + - paragraph: 成功1项 · 失败1项,已下载的无需重复下载 + - button "重试失败素材(1)": + - text: 重试失败素材(1) + - button "选择其他素材" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M26-重试中.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M26-重试中.txt new file mode 100644 index 0000000..0b5e209 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M26-重试中.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [disabled] [pressed]: + - heading "素材02" [level=4] + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载1项 + - generic: 已完成0/1项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M27-leave-preview.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M27-leave-preview.txt new file mode 100644 index 0000000..efab71d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M27-leave-preview.txt @@ -0,0 +1,213 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - heading [level=4]: 素材05 + - paragraph: + - text: 已下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… +- alertdialog "素材仍在下载": + - heading "素材仍在下载" [level=2] + - paragraph: 离开将停止未完成的下载,已保存的素材会保留。确定离开吗? + - button "离开并停止" + - button "继续下载" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M28-leave-confirmed.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M28-leave-confirmed.txt new file mode 100644 index 0000000..f676cd0 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M28-leave-confirmed.txt @@ -0,0 +1,204 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M29-materials-reenter.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M29-materials-reenter.txt new file mode 100644 index 0000000..ba43603 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M29-materials-reenter.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M30-photo-permission.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M30-photo-permission.txt new file mode 100644 index 0000000..3ba5910 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M30-photo-permission.txt @@ -0,0 +1,210 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材05 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- alertdialog "无法保存到手机相册": + - heading "无法保存到手机相册" [level=2] + - paragraph: 相册权限未开启。请在系统设置中允许App添加照片后,再下载素材。 + - button "暂不下载" + - button "去设置" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M31-photo-settings-return.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M31-photo-settings-return.txt new file mode 100644 index 0000000..cc0f900 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M31-photo-settings-return.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M32-failure-before-retry.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M32-failure-before-retry.txt new file mode 100644 index 0000000..b7f2023 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M32-failure-before-retry.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02下载失败": + - heading "素材02" [level=4] + - button "重试下载" + - paragraph: + - text: 下载失败 +- contentinfo: + - contentinfo: + - heading "部分素材下载失败" [level=3] + - paragraph: 成功1项 · 失败1项,已下载的无需重复下载 + - button "重试失败素材(1)": + - text: 重试失败素材(1) + - button "选择其他素材" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M33-retry-failed-result.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M33-retry-failed-result.txt new file mode 100644 index 0000000..a4219c6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M33-retry-failed-result.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 1项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M34-filter-point.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M34-filter-point.txt new file mode 100644 index 0000000..b3ee1b5 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M34-filter-point.txt @@ -0,0 +1,181 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" + - button "三皇寨" + - button "金阙云宫" [active] [pressed] + - generic: 1次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M35-filter-select-all.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M35-filter-select-all.txt new file mode 100644 index 0000000..6e8c291 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M35-filter-select-all.txt @@ -0,0 +1,181 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" + - button "三皇寨" + - button "金阙云宫" [pressed] + - generic: 1次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M36-filter-switch-selection.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M36-filter-switch-selection.txt new file mode 100644 index 0000000..6f94646 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M36-filter-switch-selection.txt @@ -0,0 +1,213 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [active] [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M37-refresh-uploading.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M37-refresh-uploading.txt new file mode 100644 index 0000000..ae50ebf --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M37-refresh-uploading.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:05 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态" [active]: + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M38-select-one.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M38-select-one.txt new file mode 100644 index 0000000..fb511e8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M38-select-one.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:05 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [active] [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择1项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M39-select-toggle-off.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M39-select-toggle-off.txt new file mode 100644 index 0000000..0bfc5b4 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M39-select-toggle-off.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:05 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [active]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M40-download-failure.png b/docs/9.9.1/review/product-comparison/evidence/materials2/M40-download-failure.png new file mode 100644 index 0000000..a22a75f Binary files /dev/null and b/docs/9.9.1/review/product-comparison/evidence/materials2/M40-download-failure.png differ diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M40-final-failure.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M40-final-failure.txt new file mode 100644 index 0000000..eaa1d2f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M40-final-failure.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:05 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02下载失败": + - heading "素材02" [level=4] + - button "重试下载" + - paragraph: + - text: 下载失败 +- contentinfo: + - contentinfo: + - heading "部分素材下载失败" [level=3] + - paragraph: 成功1项 · 失败1项,已下载的无需重复下载 + - button "重试失败素材(1)": + - text: 重试失败素材(1) + - button "选择其他素材" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M41-single-retry.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M41-single-retry.txt new file mode 100644 index 0000000..05dbe18 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M41-single-retry.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:06 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 1项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M42-failure-choose-other.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M42-failure-choose-other.txt new file mode 100644 index 0000000..2172e4d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M42-failure-choose-other.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:06 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - button "重试下载" + - paragraph: + - text: 下载失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M43-permission-cancel.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M43-permission-cancel.txt new file mode 100644 index 0000000..cf1c9c8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M43-permission-cancel.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:06 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M44-empty-待拍摄.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M44-empty-待拍摄.txt new file mode 100644 index 0000000..9c9ac89 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M44-empty-待拍摄.txt @@ -0,0 +1,56 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:07 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" [active] [pressed] + - button "进行中" + - button "已完成" + - heading "待拍摄订单 0" [level=2] + - heading "暂无待拍摄订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/materials2/M45-empty-进行中.txt b/docs/9.9.1/review/product-comparison/evidence/materials2/M45-empty-进行中.txt new file mode 100644 index 0000000..7524e0f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/materials2/M45-empty-进行中.txt @@ -0,0 +1,56 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:07 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [active] [pressed] + - button "已完成" + - heading "进行中订单 0" [level=2] + - heading "暂无进行中订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment/PAY01-normal.txt b/docs/9.9.1/review/product-comparison/evidence/payment/PAY01-normal.txt new file mode 100644 index 0000000..52b8c13 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment/PAY01-normal.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:38 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "选择航拍套餐": + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" [disabled] + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P02-package-picker.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P02-package-picker.txt new file mode 100644 index 0000000..4a8b4cb --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P02-package-picker.txt @@ -0,0 +1,116 @@ +- button: + - generic: iPhone +- generic: 1:57 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button [disabled]: 设置金额 + - button [disabled]: 保存二维码 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "选择航拍套餐": + - heading "选择航拍套餐" [level=2] + - paragraph: 嵩山少林景区 + - radiogroup "当前项目套餐": + - radio "单次航拍 含 1 次拍摄 ¥99" [active]: + - strong: 单次航拍 + - generic: 含 1 次拍摄 + - generic: ¥99 + - radio "三次航拍套餐 含 3 次拍摄 ¥259": + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - generic: ¥259 + - radio "五次航拍套餐 含 5 次拍摄 ¥399": + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - generic: ¥399 + - paragraph: 选择套餐后可通过「设置金额」调整成交价,拍摄次数不变。 + - button "取消" + - button "确认套餐" [disabled] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P03-selected-code.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P03-selected-code.txt new file mode 100644 index 0000000..5cc4cb2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P03-selected-code.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前三次航拍套餐": + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥259.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" + - generic: 等待游客支付 + - button "刷新状态" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P04-amount-validation.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P04-amount-validation.txt new file mode 100644 index 0000000..4ff050e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P04-amount-validation.txt @@ -0,0 +1,116 @@ +- button: + - generic: iPhone +- generic: 1:58 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥259.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button: 体验游客扫码支付 + - button: 设置金额 + - button: 保存二维码 + - generic: 等待游客支付 + - button: 刷新状态 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "收款金额": + - heading "收款金额" [level=2] + - paragraph: 仅修改本次成交价,不改变套餐拍摄次数 + - generic: ¥ + - textbox "收款金额": + - /placeholder: 请输入收款金额 + - text: "0" + - alert: 请输入大于 0 的金额,最多保留两位小数 + - text: 备注(选填) + - textbox "收款备注" + - paragraph: 0/200 + - button "取消" + - button "确定" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P05-payment-state-menu.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P05-payment-state-menu.txt new file mode 100644 index 0000000..f036968 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P05-payment-state-menu.txt @@ -0,0 +1,123 @@ +- button: + - generic: iPhone +- generic: 1:58 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥199.99 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button: 体验游客扫码支付 + - button: 设置金额 + - button: 保存二维码 + - generic: 等待游客支付 + - button: 刷新状态 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "未选择套餐" [active]: + - text: 未选择套餐 + - button "收款码生成中": + - text: 收款码生成中 + - button "等待游客支付": + - text: 等待游客支付 + - button "收款成功": + - text: 收款成功 + - button "收款码生成失败": + - text: 收款码生成失败 + - button "收款码已失效": + - text: 收款码已失效 + - button "暂无可售套餐": + - text: 暂无可售套餐 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P06-code-failed.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P06-code-failed.txt new file mode 100644 index 0000000..ff04318 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P06-code-failed.txt @@ -0,0 +1,102 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:58 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐": + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - paragraph: 收款码生成失败 + - button "重新生成" + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P07-code-expired.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P07-code-expired.txt new file mode 100644 index 0000000..317067b --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P07-code-expired.txt @@ -0,0 +1,102 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐": + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - paragraph: 收款码已失效 + - button "重新生成" + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P08-no-packages.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P08-no-packages.txt new file mode 100644 index 0000000..4526249 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P08-no-packages.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 1:59 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "选择航拍套餐": + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" [disabled] + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P08b-no-packages-picker.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P08b-no-packages-picker.txt new file mode 100644 index 0000000..f501da6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P08b-no-packages-picker.txt @@ -0,0 +1,103 @@ +- button: + - generic: iPhone +- generic: 1:59 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button [disabled]: 设置金额 + - button [disabled]: 保存二维码 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "选择航拍套餐": + - heading "选择航拍套餐" [level=2] + - paragraph: 嵩山少林景区 + - heading "暂无可售套餐" [level=3] + - paragraph: 请联系管理员在 Web 端配置套餐 + - button "知道了" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P09-payment-success.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P09-payment-success.txt new file mode 100644 index 0000000..e6094e0 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P09-payment-success.txt @@ -0,0 +1,100 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 9" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P10-payment-orders-default-all.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P10-payment-orders-default-all.txt new file mode 100644 index 0000000..505a5db --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P10-payment-orders-default-all.txt @@ -0,0 +1,184 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 13" [level=2] + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: DEMO-R-1792648814855·10/22 14:00 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 13 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P11-success.png b/docs/9.9.1/review/product-comparison/evidence/payment2/P11-success.png new file mode 100644 index 0000000..f555404 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/evidence/payment2/P11-success.png differ diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P12-continue-payment-reset.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P12-continue-payment-reset.txt new file mode 100644 index 0000000..9abd509 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P12-continue-payment-reset.txt @@ -0,0 +1,95 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 9" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "选择航拍套餐": + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" [disabled] + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P13-payment-records.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P13-payment-records.txt new file mode 100644 index 0000000..71b3ddc --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P13-payment-records.txt @@ -0,0 +1,48 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:00 +- banner: + - button "返回": + - heading "收款记录" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "选择航拍套餐": + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" [disabled] + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 仅展示本次演示的收款记录 + - article: + - heading "游客158****2026" [level=2] + - strong: ¥399.00 + - paragraph: 五次航拍套餐 · 含 5 次拍摄 + - paragraph: 10/22 14:00 · 收款成功 + - paragraph: 销售:吴家俊 + - paragraph: DEMO-R-1792648814855 + - button "查看订单": + - text: 查看订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P14-refresh-unpaid.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P14-refresh-unpaid.txt new file mode 100644 index 0000000..7d659d7 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P14-refresh-unpaid.txt @@ -0,0 +1,54 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:01 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 仅展示本次演示的收款记录 + - article: + - heading "游客158****2026" [level=2] + - strong: ¥399.00 + - paragraph: 五次航拍套餐 · 含 5 次拍摄 + - paragraph: 10/22 14:00 · 收款成功 + - paragraph: 销售:吴家俊 + - paragraph: DEMO-R-1792648814855 + - button "查看订单": + - text: 查看订单 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前单次航拍": + - generic: 航拍套餐 + - strong: 单次航拍 + - generic: 含 1 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥99.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" + - generic: 等待游客支付 + - button "刷新状态" [active] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P15-save-qr-simulated.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P15-save-qr-simulated.txt new file mode 100644 index 0000000..75fe8c7 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P15-save-qr-simulated.txt @@ -0,0 +1,54 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:02 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 仅展示本次演示的收款记录 + - article: + - heading "游客158****2026" [level=2] + - strong: ¥399.00 + - paragraph: 五次航拍套餐 · 含 5 次拍摄 + - paragraph: 10/22 14:00 · 收款成功 + - paragraph: 销售:吴家俊 + - paragraph: DEMO-R-1792648814855 + - button "查看订单": + - text: 查看订单 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前单次航拍": + - generic: 航拍套餐 + - strong: 单次航拍 + - generic: 含 1 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥99.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" [active] + - generic: 等待游客支付 + - button "刷新状态" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P16-amount-dialog.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P16-amount-dialog.txt new file mode 100644 index 0000000..1289fd0 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P16-amount-dialog.txt @@ -0,0 +1,115 @@ +- button: + - generic: iPhone +- generic: 2:12 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - heading [level=2]: 嵩山少林景区 + - paragraph: + - text: 已进入打卡范围 + - heading [level=3]: 吴家俊 + - paragraph: 现场工作人员 + - heading [level=2]: 无人机状态 + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button: 继续拍摄 + - text: 上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button: 继续拍摄 + - text: 上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥259.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button: 体验游客扫码支付 + - button: 设置金额 + - button: 保存二维码 + - generic: 等待游客支付 + - button: 刷新状态 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "收款金额": + - heading "收款金额" [level=2] + - paragraph: 仅修改本次成交价,不改变套餐拍摄次数 + - generic: ¥ + - textbox "收款金额": + - /placeholder: 请输入收款金额 + - text: "259.00" + - text: 备注(选填) + - textbox "收款备注" + - paragraph: 0/200 + - button "取消" + - button "确定" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P17-adjusted-price-same-quota.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P17-adjusted-price-same-quota.txt new file mode 100644 index 0000000..afa2bd2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P17-adjusted-price-same-quota.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:12 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前三次航拍套餐": + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥199.99 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" + - generic: 等待游客支付 + - button "刷新状态" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P18-cancel-change-package.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P18-cancel-change-package.txt new file mode 100644 index 0000000..e38793a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P18-cancel-change-package.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前三次航拍套餐": + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥199.99 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" + - generic: 等待游客支付 + - button "刷新状态" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/payment2/P19-confirm-change-package.txt b/docs/9.9.1/review/product-comparison/evidence/payment2/P19-confirm-change-package.txt new file mode 100644 index 0000000..9b4cc72 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/payment2/P19-confirm-change-package.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:13 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前单次航拍": + - generic: 航拍套餐 + - strong: 单次航拍 + - generic: 含 1 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥99.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" + - generic: 等待游客支付 + - button "刷新状态" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/无人机占用中.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/无人机占用中.txt new file mode 100644 index 0000000..0cade9a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/无人机占用中.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/无人机无信号.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/无人机无信号.txt new file mode 100644 index 0000000..da59225 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/无人机无信号.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 无信号 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/暂无拍摄订单.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/暂无拍摄订单.txt new file mode 100644 index 0000000..1687144 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/暂无拍摄订单.txt @@ -0,0 +1,48 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 状态未知 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/机巢未连接.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/机巢未连接.txt new file mode 100644 index 0000000..c8b89e9 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/机巢未连接.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 未连接 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/电量不足.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/电量不足.txt new file mode 100644 index 0000000..35897c8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/电量不足.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 低电量 + - generic: 电池电量 + - strong: 18% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/设备状态未知.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/设备状态未知.txt new file mode 100644 index 0000000..9aa8966 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/设备状态未知.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:04 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 状态未知 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/evidence/workbench2/设备空闲.txt b/docs/9.9.1/review/product-comparison/evidence/workbench2/设备空闲.txt new file mode 100644 index 0000000..91126c9 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/evidence/workbench2/设备空闲.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:03 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/flight-verified.md b/docs/9.9.1/review/product-comparison/flight-verified.md new file mode 100644 index 0000000..15b44a0 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/flight-verified.md @@ -0,0 +1,100 @@ +# 拍摄准备与飞行任务:原型实测记录 + +日期:2026-10-22。站点:https://voicestudio.suixinkan.cn/ 。仅通过内部浏览器的可见页面点击体验,无 App 代码修改,无真实飞行、支付或上传。比较依据为 [current-baseline.md](current-baseline.md)。证据目录:`evidence/flight2/`。 + +## 实测范围与证据解释 + +- **准备页 9 个状态选项、任务页 13 个状态选项均实际触发并保存 DOM**;“恢复正常体验”和“从头体验整个流程”是演示工具按钮,不计入业务状态数量。 +- “状态预览”表示通过原型菜单固定页面,不能证明真实设备已产生该结果;下面单独标出由普通业务按钮实走的链路。 +- 某些 DOM 保存于状态菜单的关闭动画期间,仍包含淡出的菜单;对应任务正文已经切到目标状态。[F30-menu-result.png](evidence/flight2/F30-menu-result.png) 和 `isVisible=false` 检查确认菜单最终关闭。 +- 原型会同时保留上一页面 DOM,故以顶部页面标题、当前任务正文及实际截图识别页面。`F25` 标题仍是拍摄准备;真正的工作台证据为 `F26`,不能混用。 + +## 一、准备页:9 个选项 + +菜单清单:[F02-preparation-menu.txt](evidence/flight2/F02-preparation-menu.txt)。 + +| 选项 | 实际触发后可见结果 | 证据 | +| --- | --- | --- | +| 设备空闲 | 底部“空闲·电量95%”,召唤可点 | [F57-prep-idle-preview.txt](evidence/flight2/F57-prep-idle-preview.txt) | +| 无人机占用中 | 底部占用中,召唤禁用,提示“请稍后再试” | [F03-prep-occupied.txt](evidence/flight2/F03-prep-occupied.txt) | +| 机巢未连接 | 机巢未连接、无人机未连接,召唤禁用 | [F04-prep-disconnected.txt](evidence/flight2/F04-prep-disconnected.txt) | +| 无人机无信号 | 机巢已连接、无人机无信号,召唤禁用 | [F05-prep-nosignal.txt](evidence/flight2/F05-prep-nosignal.txt) | +| 电量不足 | 低电量18%,设备暂不允许执行,召唤禁用;18%仅演示样例,不能作为 App 自定阈值 | [F06-prep-lowbattery.txt](evidence/flight2/F06-prep-lowbattery.txt) | +| 设备状态未知 | 状态未知,提示刷新确认,召唤禁用 | [F07-prep-unknown.txt](evidence/flight2/F07-prep-unknown.txt) | +| 不在拍摄范围 | 尚未进入范围,提示进入所选点范围,召唤禁用 | [F08-prep-outofrange.txt](evidence/flight2/F08-prep-outofrange.txt) | +| 暂无可用航线 | 共0条、空状态、未选择航线,召唤禁用 | [F09-prep-noroutes.txt](evidence/flight2/F09-prep-noroutes.txt) | +| 拍摄次数用完 | 已1剩0,提示次数已用完,召唤禁用 | [F10-prep-zeroquota.txt](evidence/flight2/F10-prep-zeroquota.txt) | + +注意:状态菜单部分设置会累积。`F10` 是在“暂无可用航线”之后触发“次数用完”,因此同时保留无航线状态;不能将此图解释为每个0次订单都无航线。点“恢复正常体验”后次数、航线均恢复(`F11`)。 + +普通操作实际验证: + +- 默认选三皇寨+经典航线;三皇寨8条航线。切金阙云宫显示3条,该点选金顶渐远,切回三皇寨再回来仍记住金顶渐远(`F12`~`F14`)。 +- 原型点击远处点位后将该选中点显示“范围内”,切走又显示距离。这是演示便利,不能证明真实定位变化或范围校验已完整实现。 +- **跨订单占用链路也实际跑通**:139订单真实召唤后停在已到达;离开回工作台,再进136订单,底部“占用中·电量95%”,召唤禁用;仍能由经典航线切到环绕专线(`F58`~`F63`)。符合 C07,不需要新增排队或自动召唤。 + +## 二、任务页:13 个选项 + +菜单清单:[F16-task-menu.txt](evidence/flight2/F16-task-menu.txt)。 + +| 选项 | 实际可见状态与按钮 | 证据与验证方式 | +| --- | --- | --- | +| 已到达 | “无人机已到达 / 是否开始拍摄”,开始、暂停、返航可用 | 预览 `F17`;正常召唤后亦见 `F15`、`F58` | +| 拍摄中 | 拍摄中主按钮禁用,暂停和返航可用 | 预览 [F30-task-shooting.txt](evidence/flight2/F30-task-shooting.txt);普通点击开始 `F20` | +| 悬停 | “无人机已暂停”,继续任务可用,暂停按钮禁用 | 预览 [F30-task-hover.txt](evidence/flight2/F30-task-hover.txt);真实暂停 `F18` | +| 返航中 | 本次拍摄已中断,拍摄不可用,返航按钮禁用,暂停可用 | [F30-task-returning.txt](evidence/flight2/F30-task-returning.txt)、`F46` 预览;主动返航最终 `F45` | +| 拍摄完成 | 成功结果与“无人机正在返航”同时出现,查看素材可用 | `F23` 预览;正常拍摄自动成功 `F21` | +| 失败·返航中 | 失败原因“拍摄指令执行失败”;重召禁用,提示返航中 | [F31-task-failed-returning.txt](evidence/flight2/F31-task-failed-returning.txt) 预览 | +| 失败·可重试 | 设备就绪、有次数时重召可用;0次则禁用 | 有次数 `F42`;0次 [F31-task-failed-ready.txt](evidence/flight2/F31-task-failed-ready.txt),均预览 | +| 画面断流 | 直播画面中断,但六项设备状态仍更新,拍摄中;可重连画面 | [F31-task-feed-lost.txt](evidence/flight2/F31-task-feed-lost.txt) 预览;真实点重连恢复 `F32` | +| 手机断网 | 任务状态待确认;六项均“—”并提示未更新;全部指令禁用,可重连 | [F33-task-phone-offline.txt](evidence/flight2/F33-task-phone-offline.txt) 预览 | +| 保护性返航 | 自动返航原因电量不足;**拍摄结果待确认**,不伪判失败 | [F33-task-protective-return.txt](evidence/flight2/F33-task-protective-return.txt) 预览 | +| 拍摄完成弹窗 | “稍后再去 / 去查看”;关闭后仍保留成功结果 | 菜单触发 `F38`;正常成功亦见 `F21` | +| 执行失败弹窗 | “确定”,关闭不自动重试,页面保留失败原因和返航阻断 | 菜单触发 `F37`,实际点击确定关闭 | +| 体验指令超时 | 菜单先设置下一次指令超时,本身恢复到已到达;实际点击开始后才出现待确认与刷新 | [F33-task-command-timeout.txt](evidence/flight2/F33-task-command-timeout.txt) → `F34` → `F35` | + +### 实际普通按钮链路 + +1. **单次订单完整成功**:136订单剩1 → 准备页召唤 → 已到达 → 紧急暂停 → 已暂停 → 继续任务 → 回已到达 → 开始拍摄 → 拍摄中 → 自动成功弹窗 → 成功且返航 → 回巢。已1剩0;次数没有因暂停、恢复或预览重复扣减(`F15`~`F29`)。 +2. **超时恢复**:菜单设置“体验指令超时”后点击的是**开始拍摄**。结果“暂未确认是否已开始拍摄 / 请刷新任务状态,勿重复发送指令”;开始按钮禁用,但安全控制仍可用。实际点刷新后同步为拍摄中,之后自动完成(`F34`~`F36`)。这不是召唤超时、暂停超时或返航超时的验证。 +3. **失败重试去向**:套餐订单已3剩2;预览失败且设备可用;实际点“重新召唤无人机”后回**拍摄准备页**,保留三皇寨+经典航线与剩2,仍需手动“确认并召唤无人机”(`F42`、`F43`)。行为符合 C09,按钮文案须按已确认方案改为“重新准备拍摄”。 +4. **主动返航**:已到达直接点立即返航,未出现确认弹窗,自动返航后提示“本次拍摄已中断 / 无人机已返回机巢,本次未扣减拍摄次数”(`F44`、`F45`)。是否采用直接提交仍是 U02,不能把原型行为写为用户已确认。 +5. **返航暂停与恢复**:固定返航预览后实际点紧急暂停,先出现“正在暂停 / 尚未确认悬停”,然后已暂停;继续任务先“正在继续任务 / 等待设备确认,不可重复启动”,最终回巢且不扣次(`F46`~`F50`)。可见处理中并非点击即成功。暂停确认页统一写“无人机已暂停”,未用“返航已暂停”单独区分展示;恢复后的短暂返航阶段未抓到,已抓到最终回巢,不应称所有中间帧均验证。 + +## 三、当前方案与原型的已证实差异 + +| 对应规则 | 原型观察 | 合并建议 | +| --- | --- | --- | +| C02 任务返回直接工作台、无确认 | 执行中返回弹“任务仍在执行”,离开后先回准备页,再返回工作台。`F24`~`F26`、独立新场景 `F59`~`F61` | 按已确认规则去掉离页确认并直接工作台,保持原任务继续 | +| C03 活跃任务订单置顶 | **独立有次数证据**:139订单已2剩3,召唤并已到达,回工作台仍在第三张。`F61-home-third-active.txt/png` | 剩余>0的活跃任务卡置顶;不能用0次卡的位置证明该规则 | +| C04/C05 按钮及任务标签 | 活跃139卡仍只有订单“进行中”,按钮为“继续查看任务”,没有“已到达,待拍摄”等任务状态。`F61` | 保留原卡样式,按钮统一“查看当前任务”,右上补具体任务标签 | +| C10/C11 0次立刻离开首页 | 单次真实成功变0后,固定成功返航预览,工作台仍显示该已完成订单。`F26-home-zero-returning.txt/png` | 0次立即从首页移除;入口转已完成 | +| C11 已完成里保留未结束任务入口 | 已完成tab已1剩0+上传中卡有“继续查看任务”,实际可进入原成功返航任务。`F28`、`F29` | 这一点原型已有;不要误列为缺少任务入口。只需改文案,任务结束移除临时入口 | +| C09 失败返回准备页 | “重新召唤无人机”实际回准备页,并未直接重发。`F42`、`F43` | 行为保留,只改“重新准备拍摄”文案 | +| C19 紧急暂停直接发,等待确认 | 无二次确认;F47明确显示正在暂停,F48设备确认后已暂停 | 与确认方案一致,应补入当前状态截图的处理中细节 | + +## 四、原型已帮助补齐的表达 + +- 失败但返航中与失败且设备就绪分开,失败重试还受次数限制。 +- 手机网络与单独图传断流分开;前者六项置“—”且控制禁用,后者保留实时状态与安全控制。 +- 超时不等于任务失败;保留原阶段同时显示该条指令“执行结果待确认”,主动刷新而非重发。 +- 暂停和恢复都有可见的设备确认处理中阶段。 +- 保护性返航明确原因,并保持拍摄结果待确认。 +- 任务结束后图像标为“上次任务画面”,与实时画面区分。 + +以上多项原需求/基线已有语义要求,原型的贡献主要是具体界面及按钮反馈,不能全部称为新业务状态。 + +## 五、未验证或原型未提供的组合 + +- 正常召唤立即进入已到达;两次尝试即时快照仍未抓到召唤提交中/起飞/前往阶段,菜单也没有这些选项。不能说这些中间态已验证。 +- 只验证开始拍摄指令超时;未验证召唤、暂停、恢复、返航各自的明确拒绝/失败/超时、长期无法同步。 +- “手机断网”是菜单模拟,未实际关闭网络或做系统后台、锁屏、冷启动;不能验证 C08 的原任务恢复、遥测乱序及跨景区切换 C18。 +- 无定位未知/拒权、距离过期、点位航线配置变更、选中航线失效、剩余次数被其他端改变等可见模拟入口;真实约束仍按 README 及接口契约补齐。 +- 状态菜单固定的成功返航组合用于跨页检查,不能等同一次持续真实设备回传;真实成功扣次与已完成归类已另外实走验证。 +- 保持 U01 交付成片事件和 U02 主动返航确认为待补充,本次不问用户,不按原型擅自定案。 + +## 截图证据 + +![有剩余次数的活跃139任务仍在第三张卡片](evidence/flight2/F61-home-third-active.png) + +![0次且返航中订单仍在工作台](evidence/flight2/F26-home-zero-returning.png) diff --git a/docs/9.9.1/review/product-comparison/materials-verified.md b/docs/9.9.1/review/product-comparison/materials-verified.md new file mode 100644 index 0000000..648bf3a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/materials-verified.md @@ -0,0 +1,101 @@ +# 订单与素材原型实测记录 + +日期:2026-10-22。原型:[机巢页面内交互体验](https://voicestudio.suixinkan.cn/)。全部操作在独立的内部浏览器标签页中进行。未修改 App 代码,未点击“交付成片”,未真实上传、收款或保存到 iOS 相册。 + +比对依据:[当前方案基线](current-baseline.md)。本文件是主对比文档的证据补充。 + +后续已由主代理重新跑完整非支付流程,并补到本文件当时未抓到的“部分仍上传中+部分就绪+失败”组合:2项上传中、3项就绪、1项失败,全选只选择3项。见[非支付复跑记录](非支付流程复跑记录.md)及[50号新证据](nonpayment-rerun/50-mixed-select-eligible-only.txt)。以下“未验证”表保留本文件初次体验的时间边界,不能据此忽略后续补证。 + +## 1. 覆盖范围与证据级别 + +- **实走**:由页面入口、按钮和筛选操作进入;结果由实际可见 DOM 核验。 +- **状态预览+恢复实走**:通过原型“体验其他状态”注入预设条件,再操作页面按钮验证恢复。不能证明真实接口、系统权限或设备生命周期行为。 +- **未验证**:没有可达入口,或必须在原生 App/真实设备下才能验证。 + +共保存 45 份 DOM 文本(M01~M45,其中 M12 捕获了状态菜单关闭动画,M13 为最终上传失败页)和 1 张真实浏览器 PNG。原型的订单状态菜单 2 项、素材状态菜单 11 项均已逐项触发。 + +## 2. 我的拍摄订单 + +| 场景 | 实际结果 | 证据 | +| --- | --- | --- | +| 工作台“查看全部” | 进入“我的拍摄订单”,默认“全部”。正常样例共 12 单。 | [M01](evidence/materials2/M01-orders-all.txt) | +| 待拍摄 | 4 单,已拍摄 0 次、有剩余,按钮“开始拍摄”。 | [M02](evidence/materials2/M02-orders-pending.txt) | +| 进行中 | 4 单,已拍摄部分、有剩余,按钮“继续拍摄”;素材状态可分别为上传中、失败、完成。当前无人机空闲。 | [M03](evidence/materials2/M03-orders-progress.txt) | +| 已完成 | 4 单,已拍摄 5 次、剩余 0 次,展示“查看素材”“交付成片”、上传完成,无继续拍摄按钮。 | [M04](evidence/materials2/M04-orders-complete.txt) | +| 暂无分配订单预览 | 工作台“暂无待处理订单”,列表“暂无订单”。各筛选分别为“暂无待拍摄订单”“暂无进行中订单”“暂无已完成订单”。 | [菜单](evidence/materials2/M05-orders-state-menu.txt)、[全部空态](evidence/materials2/M07-orders-empty-all.txt)、[待拍空态](evidence/materials2/M44-empty-待拍摄.txt)、[进行空态](evidence/materials2/M45-empty-进行中.txt)、[完成空态](evidence/materials2/M06-orders-empty.txt) | +| 正常订单列表预览 | 恢复样例 12 单及各卡片。 | [M08](evidence/materials2/M08-orders-restored.txt) | + +正常卡片额外显示订单号、下单时间;所有订单类型的卡片均出现“交付成片”入口,包括尚未拍过的订单。这里只记录入口存在,不推断其允许交付条件或点击结果;该事件按用户要求继续留空。 + +订单履约“进行中”与无人机正在飞行没有绑定,符合 C15。工作台仅显示未完成订单,已完成样例在完整列表中可查,符合 C10 的静态样例;本段不单独证明“最后一次拍摄成功且返航中”这一动态组合。 + +## 3. 订单素材库正常实走 + +从游客 158****8888 的“查看素材”进入“订单素材库”。订单头显示订单号、含 5 次/已拍 3 次/剩余 2 次。下方按拍摄记录分组,最新在前;组内显示点位、航线、时间、记录序号和素材序号。同一点位存在两次记录,不合并成一次拍摄。可按“全部点位/三皇寨/金阙云宫”筛选。 + +| 操作 | 可见结果 | 证据 | +| --- | --- | --- | +| 初次进入 | 3 次拍摄、6 份素材,5 份已上传可下载、1 份上传失败。订单列表的该单汇总同步变为“上传失败”。 | [M09](evidence/materials2/M09-materials-entry.txt) | +| 单项“重试上传” | 从“全失败”预览重试素材 05 后,仅该项变为上传完成,其他 5 项仍失败;次数不变。 | [M13](evidence/materials2/M13-upload-failed-visible.txt)、[M14](evidence/materials2/M14-upload-retry.txt) | +| 部分就绪时全选 | 仅选中唯一可下载的素材 05,已选择 1 项;失败项不提供选择按钮。 | [M15](evidence/materials2/M15-select-eligible-only.txt) | +| 预览 | 打开“素材预览”弹层,展示素材 05 和演示素材说明,可关闭;选择保留。 | [M16](evidence/materials2/M16-preview.txt) | +| 下载 1 项 | 模拟下载后仅该项标为“已下载”;底部“本次素材下载完成/1 项素材已保存到手机相册”,提供“继续选择素材”和“交付成片”。 | [M17](evidence/materials2/M17-download-normal.txt) | +| 继续选择素材 | 回普通选择模式,已下载项保留,不能再被全选重复下载。 | [M29](evidence/materials2/M29-materials-reenter.txt) 等 | +| 筛选金阙云宫 | 仅显示记录 02、两份素材,计数“1 次拍摄”;全选仅选择当前筛选两项。 | [M34](evidence/materials2/M34-filter-point.txt)、[M35](evidence/materials2/M35-filter-select-all.txt) | +| 切回全部点位 | 列表恢复 3 次记录,**当前选择被清空**,已下载标记保留。 | [M36](evidence/materials2/M36-filter-switch-selection.txt) | +| 上传中点击刷新 | 全部上传中预览,经“刷新素材状态”后变为全部上传完成可选。此为模拟推进,不代表真实上传耗时。 | [M11](evidence/materials2/M11-uploading.txt)、[M37](evidence/materials2/M37-refresh-uploading.txt) | +| 单项选择/取消 | 已选数量 0→1→0;0 时下载按钮禁用。 | [M38](evidence/materials2/M38-select-one.txt)、[M39](evidence/materials2/M39-select-toggle-off.txt) | + +## 4. 素材菜单 11 项逐项验证 + +菜单完整清单见 [M10](evidence/materials2/M10-materials-state-menu.txt)。 + +| 状态预览 | 可见状态与按钮 | 恢复验证/证据 | +| --- | --- | --- | +| 素材上传中 | 全部素材为上传中,没有预览/选择按钮;全选和下载禁用,保留刷新入口。 | [M11](evidence/materials2/M11-uploading.txt);刷新后就绪见 M37。 | +| 素材上传完成 | 6 项均可预览/选择,已选择 0,下载禁用。 | [M18](evidence/materials2/M18-素材上传完成.txt) | +| 素材上传失败 | 各项显示上传失败及“重试上传”,没有选择;全选禁用。 | [M13](evidence/materials2/M13-upload-failed-visible.txt);单项重试见 M14。 | +| 未选择素材 | 6 项就绪,已选 0,下载禁用。 | [M19](evidence/materials2/M19-未选择素材.txt) | +| 已选择素材 | 样例素材 05、02 被选,底部已选 2 项,下载可点。 | [M20](evidence/materials2/M20-已选择素材.txt) | +| 下载中 | 本次 2 项、已完成 1/2;素材 05 已下载、02 下载中。筛选、全选、逐项选择禁用;提示“请保持本页开启,下载期间不可更改选择”;按钮“下载中…”禁用。进度按完成文件数表达。 | [M21](evidence/materials2/M21-下载中.txt) | +| 下载完成 | 2 项标为已下载;底部完成说明、“继续选择素材”“交付成片”。 | [M24](evidence/materials2/M24-下载完成.txt) | +| 下载失败 | 1 项已下载,1 项下载失败;失败项“重试下载”;底部“成功 1 项 · 失败 1 项,已下载的无需重复下载”,可“重试失败素材(1)”或“选择其他素材”。 | [M25](evidence/materials2/M25-下载失败.txt);批量失败重试 M32→M33、单项重试 M40→M41 均完成 1 项,不重复成功项。 | +| 重试中 | 本次仅 1 项、已完成 0/1;原成功项仍已下载,重试项显示下载中,选择禁用。 | [M26](evidence/materials2/M26-重试中.txt) | +| 离开确认 | 弹窗“素材仍在下载”;离开停止未完成、保留已保存,按钮“离开并停止/继续下载”。 | [M27](evidence/materials2/M27-leave-preview.txt)。真实点返回也触发 M22;继续下载留页 M23;离开返回订单列表 M28;重进 M29 保留已保存,未完成项恢复可下载。 | +| 相册权限不足 | 弹窗“无法保存到手机相册”;要求系统允许 App 添加照片,按钮“暂不下载/去设置”。 | [M30](evidence/materials2/M30-photo-permission.txt)。去设置后回选择模式并保留选择 M31;暂不下载同样保留选择 M43。只是网页模拟,无真实系统设置、授权或写入验证。 | + +失败后“选择其他素材”会回普通选择模式、清空已选,已下载与失败标记保留,见 [M42](evidence/materials2/M42-failure-choose-other.txt)。 + +## 5. 与当前方案的双向补充 + +### 原型具体化了什么 + +1. **上传失败的单项恢复入口**:每个失败素材可“重试上传”;需接口/设备支持,不能理解为工作人员从手机重新上传文件。当前基线已包含上传失败,但该重试动作尚不是用户已确认的接口能力。 +2. **下载过程锁定选择和点位筛选**:避免本批下载过程中改变目标集合。 +3. **下载进度按文件数表达**:本次 N 项、已完成 X/N,可用于本版前台下载,不要求虚构字节百分比。 +4. **完成与部分失败的底部面板**:完成后继续选择;失败后只重试失败或选择其他素材,成功项保留。 +5. **切换点位筛选清空选择**:这是额外的明确交互策略,应在合并方案中写明,避免开发时默认跨筛选保留导致数量口径不同。 +6. **增加交付入口位置**:订单卡、每次拍摄记录、下载完成栏均出现“交付成片”。用户已明确延后该事件,不能直接采用其后续流程。 + +按记录分组、点位筛选、重复拍同点、部分就绪先下载、上传项不可选、失败仅重试、离页保留成功项、相册拒权本来就在基线中,**不应重复称为原型新增需求**。 + +### 当前方案中仍需保留、原型本段未证明的状态 + +| 项目 | 处理建议 | +| --- | --- | +| 后台/锁屏暂停、回前台手动继续(C14) | 菜单没有下载暂停状态;“继续下载”仅存在离开确认弹窗。须保留本版已确认的原生生命周期规则,不能由网页前台成功推断后台能力。 | +| 部分上传中+部分就绪(C13) | 已验证部分失败+部分就绪的可选集合;菜单“素材上传中”把全部项设为上传中。未专门验证就绪+仍上传中的混合预览,继续保留该组合。 | +| 0 次+仍返航的当前任务入口(C11) | 本段静态已完成样例无活跃任务,不能证明此组合;需结合任务流程的动态结果核对。 | +| 素材未生成/无素材/刷新加载与失败 | 该菜单没有对应选项;待拍摄订单没有“查看素材”入口。本次没有可达的素材库空态/加载失败页,不代表实现时无需处理。 | +| 链接失效、素材删除、存储不足、保存失败 | 没有对应原型预览入口。真实实现需区分网络文件下载成功与写入本机相册成功。 | +| 相册添加权限的真实恢复 | 去设置仅模拟返回;要在 iPhone 验证拒权、返回检测、仅写入权限和写入失败,不能把网页文案视为通过。 | +| 本机已下载的身份与持久化 | 已验证原型同一会话离页重进保留;没有验证 App 重启、换设备或系统相册删除后的标记。不能把原型标记当成真实照片库证据。 | +| 列表首次加载/请求失败/刷新失败 | 订单菜单仅正常和无订单两项;保留加载、失败及重试状态,空数据不能替代请求失败。 | + +## 6. 代表性截图 + +真实内部浏览器截图,展示“部分素材下载失败”、保留成功项、只重试失败项: + +![部分素材下载失败](evidence/materials2/M40-download-failure.png) + +截图与 DOM 同时核对过。原型中的“保存到手机相册”是模拟文案;本次未验证或执行真实 iOS 相册写入。 diff --git a/docs/9.9.1/review/product-comparison/nonpayment-checklist.md b/docs/9.9.1/review/product-comparison/nonpayment-checklist.md new file mode 100644 index 0000000..246c33b --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-checklist.md @@ -0,0 +1,53 @@ +# 非支付流程重跑核验清单 + +日期:2026-10-22。用途:指导本次内部浏览器重新操作。**本文只审阅旧证据,不表示本轮已重跑通过。** 不修改 App,不操作支付,不提前确定“交付成片”事件。 + +依据:[当前方案基线](current-baseline.md)、[前次飞行记录](flight-verified.md)、[前次订单素材记录](materials-verified.md)。本轮应另存证据,避免与 `flight2`、`materials2` 的前次结果混用。 + +## 1. 优先正常走通的四条链路 + +| 优先级 | 实际操作顺序 | 必须观察的结果 | +| --- | --- | --- | +| 1 | 从头恢复 → 136 单次订单准备 → 选择点位/航线 → 召唤 → 到达 → 暂停 → 恢复 → 开始拍摄 → 成功 → 关闭成功弹窗 | 每一步按钮状态;暂停/恢复是否有处理中;成功才从已0剩1变已1剩0;成功结果与返航同时存在;关闭弹窗仍能查看素材。尽量捕获召唤提交中/前往,未捕获则明确写未验证。 | +| 2 | 上述订单在仍返航时返回 → 工作台 → 查看全部 → 已完成 → 查看当前任务 → 结束后再次查看 | 基线要求0次立即退出工作台;已完成卡临时保留任务入口且进入同一任务;飞行结束才移除临时入口。返回是否弹确认、目的地是否直接工作台,均分别记录。 | +| 3 | 从头恢复 → 139 套餐订单实际召唤 → 任务返回工作台 → 打开另一个 B 订单准备 → 切点位/航线 → 返回 A 任务 | 用**有剩余次数**的活跃 A 检查置顶、右上任务标签、“查看当前任务”文案。B 允许选择,显示占用、召唤禁用;不得创建 B 任务或改变 A 次数。记录订单号,防止把其他示例任务当成 A。 | +| 4 | 查看全部 → 四个订单Tab → 有素材订单 → 点位筛选 → 单项选/取消 → 部分可用全选 → 预览 → 下载 → 返回并重进 | “进行中”包含已拍部分但设备空闲的订单;每次记录独立分组;选择数量对应可下载集合;下载中锁定选择;离页保留成功项;返回入口与选择保留/清空策略可见。 | + +“仍返航”可能很短。如确需菜单固定成功返航,应分开记录:**真实成功产生0次**,再**预览固定返航用于跨页组合检查**,不能写成持续自然设备回传。 + +## 2. 异常要操作恢复按钮,不能只切菜单 + +| 分支 | 最小恢复核验 | +| --- | --- | +| 准备页:占用/未连接/无信号/低电量/未知/范围外/无航线/0次 | 逐一触发可见状态;核对底部原因和召唤禁用;恢复正常后有效选择仍在、召唤恢复。无航线不能残留另一点航线。 | +| 图传断流 | 查看设备遥测与控制仍有效;实际点重连画面,核对恢复原任务,无重复召唤和扣次。 | +| 手机断网 | 六项“—”、未更新、任务待确认、指令禁用;实际点恢复/同步入口后返回原任务。仅为网页模拟,不能称实际关闭系统网络。 | +| 指令超时 | 预设超时后再点普通业务按钮,记录到底是哪条指令;未知时禁重复发,刷新同步原任务。前次只证实**开始拍摄**,不能扩展为召唤/暂停/恢复/返航都已验证。 | +| 失败且返航中 / 失败且设备就绪 | 前者不能重新准备;后者有余次可点击并回准备页,保留有效选择,需再次手动召唤。按钮文案与行为分别评价。 | +| 保护性返航、主动返航、返航暂停/恢复 | 自动返航保留原因和拍摄结果待确认;主动返航是否确认仅记录原型,U02尚未定;返航暂停不能误写成拍摄暂停。恢复处理中与最终状态分开抓取。 | +| 上传失败 | 实际点一项重试,确认只恢复该项、不重拍、不改次数;“重试上传”是否需要接口支持继续列待对接。 | +| 部分下载失败 | 实际点击批量或单项重试,成功项保留;仅失败项进入重试。可再试“选择其他素材”核对选择清空但保存标记保留。 | +| 下载中离页 | 实际点返回触发确认;先继续留页,再离开并停止,重进核对已保存/未完成各自状态。弹窗“继续下载”不是后台恢复能力的证据。 | +| 相册权限不足 | 仅记录网页的取消/去设置后选择状态;不能写真实授权、真实系统跳转或写入相册已通过。 | + +## 3. 前次证据的高风险误读 + +1. `F25` 标题仍是拍摄准备,真正工作台为 `F26`。原型可能保留前页 DOM,以当前页标题、可见区域及截图判定,不能只全文查到某个按钮。 +2. `F61` 是有余次139活跃任务仍第三张,能用于置顶差异;`F26` 为0次卡,基线本就要求移出首页,不能混用来证明置顶。 +3. 已完成卡的“继续查看任务”前次已实际能进入原任务,不能再称原型缺少这个入口;需核验的是统一文案、任务结束移除和0次移出首页。 +4. “重新召唤无人机”前次点击实际回准备页,没有直接重发。应区分**文案需改**与**流程已正确**。 +5. 前次部分可用验证是“部分失败+部分就绪”;全上传中菜单是全部上传中。二者均不能证明“部分仍上传中+部分就绪”组合已测。 +6. 订单已完成与素材上传完成独立;0次订单仍能上传最后一拍素材,不等于还能新增拍摄或手机手动上传。 +7. 订单“进行中”与设备飞行独立;设备空闲时显示“继续拍摄”本身不能证明活跃任务卡标题错误。 +8. 各菜单数是**预设状态覆盖**,不是同数量完整端到端流程。报告应单列正常实走、预览后恢复、未验证。 + +## 4. 本轮无法由网页证明的项目 + +- App冷启动恢复、后台/锁屏暂停下载及回前台手动继续、真实系统网络、真实相册权限/写入、App重启后的保存标记。 +- 未提供可见入口的定位未知/拒权、数据过期、航线失效、其他端改变额度、订单权限变化、长期指令未知、链接失效、磁盘不足、素材库加载失败。 +- 跨景区任务恢复:如原型没有可用切景区入口,保留C18规则并记未验证,不用重载网页替代切景区。 +- 交付成片事件继续跳过;主动返航确认策略继续待定,不用原型直接覆盖用户尚未回答的U02。 + +## 5. 本轮证据最小格式 + +每条链路记录:`入口/订单身份 → 普通点击 → 可见状态/可用按钮 → 返回/恢复 → 次数变化 → 证据文件`。证据注明本轮时间、是否用过状态菜单。截图至少保留:非支付任务中、0次返航的入口归属、B准备占用、素材部分失败恢复。对未捕获的短暂中间态直写未捕获。 diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/01-workbench.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/01-workbench.png new file mode 100644 index 0000000..16bd342 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/01-workbench.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/01-workbench.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/01-workbench.txt new file mode 100644 index 0000000..868c026 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/01-workbench.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:20 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/02-preparation-point-route.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/02-preparation-point-route.png new file mode 100644 index 0000000..31547f1 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/02-preparation-point-route.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/02-preparation-point-route.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/02-preparation-point-route.txt new file mode 100644 index 0000000..0a1d162 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/02-preparation-point-route.txt @@ -0,0 +1,120 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:20 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked] [active]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 金顶渐远" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/03-arrived.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/03-arrived.png new file mode 100644 index 0000000..ee6b908 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/03-arrived.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/03-arrived.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/03-arrived.txt new file mode 100644 index 0000000..87086a5 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/03-arrived.txt @@ -0,0 +1,89 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:20 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/04-pause-confirmed-observation.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/04-pause-confirmed-observation.txt new file mode 100644 index 0000000..e188968 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/04-pause-confirmed-observation.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:21 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/05-paused.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/05-paused.png new file mode 100644 index 0000000..613ec95 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/05-paused.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/05-paused.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/05-paused.txt new file mode 100644 index 0000000..e188968 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/05-paused.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:21 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/06-resumed-arrived.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/06-resumed-arrived.png new file mode 100644 index 0000000..63ad3cd Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/06-resumed-arrived.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/06-resumed-arrived.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/06-resumed-arrived.txt new file mode 100644 index 0000000..c44580d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/06-resumed-arrived.txt @@ -0,0 +1,89 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:21 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/07-shooting.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/07-shooting.png new file mode 100644 index 0000000..840cef6 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/07-shooting.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/07-shooting.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/07-shooting.txt new file mode 100644 index 0000000..714ff52 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/07-shooting.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:21 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/08-shoot-success-popup.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/08-shoot-success-popup.png new file mode 100644 index 0000000..c559e90 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/08-shoot-success-popup.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/08-shoot-success-popup.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/08-shoot-success-popup.txt new file mode 100644 index 0000000..0d479df --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/08-shoot-success-popup.txt @@ -0,0 +1,93 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:21 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/09-completed-returned.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/09-completed-returned.png new file mode 100644 index 0000000..adf0dd0 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/09-completed-returned.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/09-completed-returned.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/09-completed-returned.txt new file mode 100644 index 0000000..5d71f7f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/09-completed-returned.txt @@ -0,0 +1,88 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:22 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.png new file mode 100644 index 0000000..426183b Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.txt new file mode 100644 index 0000000..7ea157f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/10-new-shoot-materials-entry-ready.txt @@ -0,0 +1,79 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:22 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - region "订单信息": + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 金阙云宫 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录01": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录01": + - text: 交付成片 + - paragraph: 金顶渐远·10-22 14:21·记录01 + - img "金阙云宫拍摄素材01-demo" + - button "预览本次素材01" + - button "选择本次素材01": + - heading "本次素材01" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.png new file mode 100644 index 0000000..de54680 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.txt new file mode 100644 index 0000000..9ec0052 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/11-new-shoot-material-ready.txt @@ -0,0 +1,79 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:22 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态" [active]: + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - region "订单信息": + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 金阙云宫 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录01": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录01": + - text: 交付成片 + - paragraph: 金顶渐远·10-22 14:21·记录01 + - img "金阙云宫拍摄素材01-demo" + - button "预览本次素材01" + - button "选择本次素材01": + - heading "本次素材01" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/12-material-preview.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/12-material-preview.png new file mode 100644 index 0000000..818667b Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/12-material-preview.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/12-material-preview.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/12-material-preview.txt new file mode 100644 index 0000000..251d3e6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/12-material-preview.txt @@ -0,0 +1,82 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:22 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - region: + - heading [level=2]: 游客136****2806 + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 金阙云宫 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 金顶渐远·10-22 14:21·记录01 + - button + - button: + - heading [level=4]: 本次素材01 + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 +- dialog "素材预览": + - button "关闭素材预览": + - img "本次素材01" + - paragraph: 本次素材01 · 演示素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/13-selected-new-material.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/13-selected-new-material.txt new file mode 100644 index 0000000..082f190 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/13-selected-new-material.txt @@ -0,0 +1,79 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:22 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - region "订单信息": + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 金阙云宫 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button "全选可下载" [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录01": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录01": + - text: 交付成片 + - paragraph: 金顶渐远·10-22 14:21·记录01 + - img "金阙云宫拍摄素材01-demo" + - button "预览本次素材01" + - button "选择本次素材01" [active] [pressed]: + - heading "本次素材01" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择1项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/14-new-material-download-completed.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/14-new-material-download-completed.png new file mode 100644 index 0000000..e3caa1d Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/14-new-material-download-completed.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/14-new-material-download-completed.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/14-new-material-download-completed.txt new file mode 100644 index 0000000..8db91be --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/14-new-material-download-completed.txt @@ -0,0 +1,81 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:22 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "金阙云宫 · 金顶渐远" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - region "订单信息": + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 金阙云宫 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录01": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录01": + - text: 交付成片 + - paragraph: 金顶渐远·10-22 14:21·记录01 + - img "金阙云宫拍摄素材01-demo" + - button "预览本次素材01" + - generic "本次素材01已下载": + - heading "本次素材01" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 1项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/15-quota-zero-preparation-blocked.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/15-quota-zero-preparation-blocked.txt new file mode 100644 index 0000000..963f848 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/15-quota-zero-preparation-blocked.txt @@ -0,0 +1,120 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:23 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 金顶渐远" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前订单拍摄次数已用完 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.png new file mode 100644 index 0000000..338f267 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.txt new file mode 100644 index 0000000..66efb9e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/16-home-after-normal-completion.txt @@ -0,0 +1,113 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:23 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 已拍 1 次" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕": + - strong: 云宫环绕 + - radio "金顶渐远" [checked]: + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-全部.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-全部.txt new file mode 100644 index 0000000..b3d9182 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-全部.txt @@ -0,0 +1,205 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:23 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [active] [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-已完成.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-已完成.png new file mode 100644 index 0000000..6b398f9 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-已完成.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-已完成.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-已完成.txt new file mode 100644 index 0000000..63ceff8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-已完成.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:23 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [active] [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-待拍摄.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-待拍摄.txt new file mode 100644 index 0000000..6362f09 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-待拍摄.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:23 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" [active] [pressed] + - button "进行中" + - button "已完成" + - heading "待拍摄订单 3" [level=2] + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - paragraph: 已显示全部 3 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-进行中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-进行中.txt new file mode 100644 index 0000000..81381d5 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/17-orders-进行中.txt @@ -0,0 +1,128 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:23 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [active] [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - paragraph: 已显示全部 4 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/18-A-order-arrived.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/18-A-order-arrived.png new file mode 100644 index 0000000..a4f9741 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/18-A-order-arrived.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/18-A-order-arrived.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/18-A-order-arrived.txt new file mode 100644 index 0000000..a7138c1 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/18-A-order-arrived.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:24 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/19-active-return-confirm.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/19-active-return-confirm.png new file mode 100644 index 0000000..d3e9815 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/19-active-return-confirm.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/19-active-return-confirm.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/19-active-return-confirm.txt new file mode 100644 index 0000000..e8aa872 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/19-active-return-confirm.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:24 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 +- alertdialog "任务仍在执行": + - heading "任务仍在执行" [level=2] + - paragraph: 离开后将无法实时查看画面与状态。是否离开? + - button "离开页面" + - button "继续查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/20-return-destination-preparation.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/20-return-destination-preparation.txt new file mode 100644 index 0000000..fc43a5c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/20-return-destination-preparation.txt @@ -0,0 +1,169 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:24 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "继续查看任务" + - status: 当前订单已有任务执行中,请继续查看原任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/21-home-active-order-position.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/21-home-active-order-position.png new file mode 100644 index 0000000..081f30c Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/21-home-active-order-position.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/21-home-active-order-position.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/21-home-active-order-position.txt new file mode 100644 index 0000000..9ca8d42 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/21-home-active-order-position.txt @@ -0,0 +1,162 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:24 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.png new file mode 100644 index 0000000..5b902ff Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.txt new file mode 100644 index 0000000..b145054 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/22-B-select-route-while-occupied.txt @@ -0,0 +1,130 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:24 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客135****3092" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "5" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线": + - strong: 经典航线 + - radio "环绕专线" [checked] [active]: + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 环绕专线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 无人机占用中,请等待当前任务结束 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.png new file mode 100644 index 0000000..2330d8e Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.txt new file mode 100644 index 0000000..f5864b6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/23-return-to-original-A-task.txt @@ -0,0 +1,160 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:24 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客135****3092" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "5" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线": + - strong: 经典航线 + - radio "环绕专线" [checked]: + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/24-proactive-return.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/24-proactive-return.txt new file mode 100644 index 0000000..0426707 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/24-proactive-return.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:25 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "本次拍摄已中断" [level=2] + - paragraph: 无人机已返回机巢,本次未扣减拍摄次数。 可重新选择点位和航线开始任务。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/25-returned-without-deduction.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/25-returned-without-deduction.png new file mode 100644 index 0000000..f2b4113 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/25-returned-without-deduction.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/25-returned-without-deduction.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/25-returned-without-deduction.txt new file mode 100644 index 0000000..0426707 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/25-returned-without-deduction.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:25 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "本次拍摄已中断" [level=2] + - paragraph: 无人机已返回机巢,本次未扣减拍摄次数。 可重新选择点位和航线开始任务。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.png new file mode 100644 index 0000000..8524335 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.txt new file mode 100644 index 0000000..7899190 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/26-feed-reconnect-pending.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - heading "直播画面连接中断" [level=3] + - paragraph: 无人机状态仍在更新 + - button "正在连接画面…" [disabled] [active] + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 当前仅画面中断,请关注现场。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/27-phone-sync-pending.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/27-phone-sync-pending.png new file mode 100644 index 0000000..9cf5dea Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/27-phone-sync-pending.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/27-phone-sync-pending.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/27-phone-sync-pending.txt new file mode 100644 index 0000000..aa49f2e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/27-phone-sync-pending.txt @@ -0,0 +1,111 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - heading "正在同步当前任务" [level=3] + - paragraph: 请检查网络后重新连接 + - button "同步中…" [disabled] + - region "无人机六项状态": + - paragraph: + - text: 状态暂未更新 + - generic: 电池电量 + - strong: + - text: — + - generic: 环境温度 + - strong: + - text: — + - generic: 风速 + - strong: + - text: — + - generic: 雨量 + - strong: + - text: — + - generic: 信号状态 + - strong: + - text: — + - generic: 搜星状态 + - strong: + - text: — + - status: + - heading "正在同步任务状态" [level=2] + - paragraph: 连接中断不代表任务失败。 恢复连接后将同步当前任务。 + - button "同步任务状态中" [disabled]: + - text: 同步任务状态中 + - generic: 安全控制 + - button "紧急暂停 当前无法发送指令" [disabled]: + - strong: 紧急暂停 + - generic: 当前无法发送指令 + - button "立即返航 当前无法发送指令" [disabled]: + - strong: 立即返航 + - generic: 当前无法发送指令 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.png new file mode 100644 index 0000000..f96d4c8 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.txt new file mode 100644 index 0000000..2e8990d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/28-failure-retry-opens-preparation.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/29-start-result-unknown.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/29-start-result-unknown.png new file mode 100644 index 0000000..d3d0255 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/29-start-result-unknown.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/29-start-result-unknown.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/29-start-result-unknown.txt new file mode 100644 index 0000000..19a3afd --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/29-start-result-unknown.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:30 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - strong: + - text: 执行结果待确认 + - paragraph: 暂未确认是否已开始拍摄。请刷新任务状态,勿重复发送指令。 + - button "刷新任务状态": + - text: 刷新任务状态 + - button "执行结果待确认" [disabled]: + - text: 执行结果待确认 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/30-sync-original-task.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/30-sync-original-task.png new file mode 100644 index 0000000..15d7ace Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/30-sync-original-task.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/30-sync-original-task.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/30-sync-original-task.txt new file mode 100644 index 0000000..aa0dfaa --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/30-sync-original-task.txt @@ -0,0 +1,100 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:30 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - heading "正在同步当前任务" [level=3] + - paragraph: 请检查网络后重新连接 + - button "同步中…" [disabled] + - region "无人机六项状态": + - paragraph: + - text: 状态暂未更新 + - generic: 电池电量 + - strong: + - text: — + - generic: 环境温度 + - strong: + - text: — + - generic: 风速 + - strong: + - text: — + - generic: 雨量 + - strong: + - text: — + - generic: 信号状态 + - strong: + - text: — + - generic: 搜星状态 + - strong: + - text: — + - status: + - heading "正在同步任务状态" [level=2] + - paragraph: 连接中断不代表任务失败。 恢复连接后将同步当前任务。 + - button "同步任务状态中" [disabled]: + - text: 同步任务状态中 + - generic: 安全控制 + - button "紧急暂停 当前无法发送指令" [disabled]: + - strong: 紧急暂停 + - generic: 当前无法发送指令 + - button "立即返航 当前无法发送指令" [disabled]: + - strong: 立即返航 + - generic: 当前无法发送指令 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/31-after-sync.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/31-after-sync.txt new file mode 100644 index 0000000..6573fc8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/31-after-sync.txt @@ -0,0 +1,103 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:30 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/32-failure-dialog-closed.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/32-failure-dialog-closed.txt new file mode 100644 index 0000000..c2bef20 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/32-failure-dialog-closed.txt @@ -0,0 +1,100 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:31 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机返航中,暂不可召唤 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/33-return-paused.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/33-return-paused.png new file mode 100644 index 0000000..cc4f763 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/33-return-paused.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/33-return-paused.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/33-return-paused.txt new file mode 100644 index 0000000..02a4dce --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/33-return-paused.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:31 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/34-return-resume-outcome.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/34-return-resume-outcome.png new file mode 100644 index 0000000..5f74bda Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/34-return-resume-outcome.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/34-return-resume-outcome.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/34-return-resume-outcome.txt new file mode 100644 index 0000000..f8f685b --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/34-return-resume-outcome.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:32 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "本次拍摄已中断" [level=2] + - paragraph: 无人机已返回机巢,本次未扣减拍摄次数。 可重新选择点位和航线开始任务。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.png new file mode 100644 index 0000000..f847aa3 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.txt new file mode 100644 index 0000000..c815892 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/35-mixed-ready-failed.txt @@ -0,0 +1,210 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:34 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/36-select-only-ready-items.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/36-select-only-ready-items.png new file mode 100644 index 0000000..041b5dc Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/36-select-only-ready-items.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/36-select-only-ready-items.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/36-select-only-ready-items.txt new file mode 100644 index 0000000..c54ac75 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/36-select-only-ready-items.txt @@ -0,0 +1,210 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:34 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [pressed]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [pressed]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择5项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/37-retry-upload-one.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/37-retry-upload-one.txt new file mode 100644 index 0000000..655d109 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/37-retry-upload-one.txt @@ -0,0 +1,210 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:35 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [pressed]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [pressed]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传中": + - heading "素材02" [level=4] + - paragraph: 上传中 +- contentinfo: + - contentinfo: + - generic: 已选择5项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- status: 已重新发起上传 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/38-select-filtered-point.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/38-select-filtered-point.txt new file mode 100644 index 0000000..820aafb --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/38-select-filtered-point.txt @@ -0,0 +1,182 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:35 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" + - button "三皇寨" + - button "金阙云宫" [pressed] + - generic: 1次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- status: 已重新发起上传 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/39-filter-change-clears-selection.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/39-filter-change-clears-selection.txt new file mode 100644 index 0000000..c545404 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/39-filter-change-clears-selection.txt @@ -0,0 +1,210 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:35 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [active] [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传中": + - heading "素材02" [level=4] + - paragraph: 上传中 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 +- status: 已重新发起上传 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/40-all-ready-selection.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/40-all-ready-selection.png new file mode 100644 index 0000000..ef09035 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/40-all-ready-selection.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/40-all-ready-selection.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/40-all-ready-selection.txt new file mode 100644 index 0000000..279231c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/40-all-ready-selection.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:35 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [pressed]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [pressed]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择6项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/41-download-leave-confirm.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/41-download-leave-confirm.png new file mode 100644 index 0000000..461a183 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/41-download-leave-confirm.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/41-download-leave-confirm.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/41-download-leave-confirm.txt new file mode 100644 index 0000000..3fcd636 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/41-download-leave-confirm.txt @@ -0,0 +1,213 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:37 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - heading [level=4]: 素材05 + - paragraph: + - text: 已下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… +- alertdialog "素材仍在下载": + - heading "素材仍在下载" [level=2] + - paragraph: 离开将停止未完成的下载,已保存的素材会保留。确定离开吗? + - button "离开并停止" + - button "继续下载" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/42-continue-download-completed.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/42-continue-download-completed.png new file mode 100644 index 0000000..5c59fca Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/42-continue-download-completed.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/42-continue-download-completed.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/42-continue-download-completed.txt new file mode 100644 index 0000000..95ddc85 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/42-continue-download-completed.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:37 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 2项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/43-retry-only-failed-file.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/43-retry-only-failed-file.txt new file mode 100644 index 0000000..aa6f4ae --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/43-retry-only-failed-file.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:37 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [disabled] [pressed]: + - heading "素材02" [level=4] + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载1项 + - generic: 已完成0/1项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.png new file mode 100644 index 0000000..e0c7b5e Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.txt new file mode 100644 index 0000000..a60deac --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/44-failed-file-retry-completed.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:37 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 1项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/45-leave-stop-returns-orders.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/45-leave-stop-returns-orders.txt new file mode 100644 index 0000000..a4a942c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/45-leave-stop-returns-orders.txt @@ -0,0 +1,258 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:38 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - heading [level=4]: 素材05 + - paragraph: + - text: 已下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: + - text: 下载中 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.png new file mode 100644 index 0000000..e1bb590 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.txt new file mode 100644 index 0000000..ed378bd --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/46-reenter-retains-saved-items.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:38 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/47-permission-settings-simulated-return.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/47-permission-settings-simulated-return.txt new file mode 100644 index 0000000..a0eec0c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/47-permission-settings-simulated-return.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:39 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- status: 演示:相册权限已允许,请重新下载 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/48-permission-cancel-retains-selection.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/48-permission-cancel-retains-selection.txt new file mode 100644 index 0000000..a0eec0c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/48-permission-cancel-retains-selection.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:39 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- status: 演示:相册权限已允许,请重新下载 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/49-initial-mixed-upload-state.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/49-initial-mixed-upload-state.txt new file mode 100644 index 0000000..c4f198a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/49-initial-mixed-upload-state.txt @@ -0,0 +1,134 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:40 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - generic "素材05上传中": + - heading "素材05" [level=4] + - paragraph: 上传中 + - generic "素材06上传中": + - heading "素材06" [level=4] + - paragraph: 上传中 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.png new file mode 100644 index 0000000..6825812 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.txt new file mode 100644 index 0000000..197b7c8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/50-mixed-select-eligible-only.txt @@ -0,0 +1,134 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:40 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - generic "素材05上传中": + - heading "素材05" [level=4] + - paragraph: 上传中 + - generic "素材06上传中": + - heading "素材06" [level=4] + - paragraph: 上传中 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [pressed]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择3项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/51-normal-success-final-state.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/51-normal-success-final-state.txt new file mode 100644 index 0000000..1eaed34 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/51-normal-success-final-state.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.png new file mode 100644 index 0000000..29c552e Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.txt new file mode 100644 index 0000000..fd30ce1 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/52-zero-return-still-on-home.txt @@ -0,0 +1,162 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.png new file mode 100644 index 0000000..a448935 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.txt new file mode 100644 index 0000000..cc296d2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/53-completed-tab-task-entry.txt @@ -0,0 +1,131 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - text: 上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [active] [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.png new file mode 100644 index 0000000..ece9a94 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.txt new file mode 100644 index 0000000..abf855c --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/54-completed-entry-restores-return-task.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.png new file mode 100644 index 0000000..11c00bd Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.txt new file mode 100644 index 0000000..a77ca81 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/55-feed-reconnect-observation.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/56-phone-sync-completed.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/56-phone-sync-completed.png new file mode 100644 index 0000000..85c5400 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/56-phone-sync-completed.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/56-phone-sync-completed.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/56-phone-sync-completed.txt new file mode 100644 index 0000000..4ee9683 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/56-phone-sync-completed.txt @@ -0,0 +1,112 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.png new file mode 100644 index 0000000..6b1164d Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.txt new file mode 100644 index 0000000..e78e616 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/57-phone-recovery-final-task.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:43 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.png new file mode 100644 index 0000000..ad0c911 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.txt new file mode 100644 index 0000000..07e57ae --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/58-feed-recovery-image-restored.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:43 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/connection-recheck-手机断网.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/connection-recheck-手机断网.txt new file mode 100644 index 0000000..da2709d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/connection-recheck-手机断网.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - heading "手机网络连接中断" [level=3] + - paragraph: 请检查网络后重新连接 + - button "重新连接" + - region "无人机六项状态": + - paragraph: + - text: 状态暂未更新 + - generic: 电池电量 + - strong: + - text: — + - generic: 环境温度 + - strong: + - text: — + - generic: 风速 + - strong: + - text: — + - generic: 雨量 + - strong: + - text: — + - generic: 信号状态 + - strong: + - text: — + - generic: 搜星状态 + - strong: + - text: — + - status: + - heading "任务状态待确认" [level=2] + - paragraph: 连接中断不代表任务失败。 恢复连接后将同步当前任务。 + - button "等待连接恢复" [disabled]: + - text: 等待连接恢复 + - generic: 安全控制 + - button "紧急暂停 当前无法发送指令" [disabled]: + - strong: 紧急暂停 + - generic: 当前无法发送指令 + - button "立即返航 当前无法发送指令" [disabled]: + - strong: 立即返航 + - generic: 当前无法发送指令 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/connection-recheck-画面断流.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/connection-recheck-画面断流.txt new file mode 100644 index 0000000..7e51677 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/connection-recheck-画面断流.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - heading "直播画面连接中断" [level=3] + - paragraph: 无人机状态仍在更新 + - button "重新连接画面" + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 当前仅画面中断,请关注现场。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/feed-final-check-画面断流.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/feed-final-check-画面断流.txt new file mode 100644 index 0000000..5233e2e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/feed-final-check-画面断流.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:43 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄1次 + - generic: 剩余0次 + - button "继续查看任务" + - button "交付成片" + - text: 上传中 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - heading "直播画面连接中断" [level=3] + - paragraph: 无人机状态仍在更新 + - button "重新连接画面" + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 当前仅画面中断,请关注现场。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/manifest.json b/docs/9.9.1/review/product-comparison/nonpayment-rerun/manifest.json new file mode 100644 index 0000000..73a62d9 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/manifest.json @@ -0,0 +1,237 @@ +{ + "date": "2026-10-22", + "scope": "non-payment prototype rerun in internal browser", + "files": [ + "01-workbench.png", + "01-workbench.txt", + "02-preparation-point-route.png", + "02-preparation-point-route.txt", + "03-arrived.png", + "03-arrived.txt", + "04-pause-confirmed-observation.txt", + "05-paused.png", + "05-paused.txt", + "06-resumed-arrived.png", + "06-resumed-arrived.txt", + "07-shooting.png", + "07-shooting.txt", + "08-shoot-success-popup.png", + "08-shoot-success-popup.txt", + "09-completed-returned.png", + "09-completed-returned.txt", + "10-new-shoot-materials-entry-ready.png", + "10-new-shoot-materials-entry-ready.txt", + "11-new-shoot-material-ready.png", + "11-new-shoot-material-ready.txt", + "12-material-preview.png", + "12-material-preview.txt", + "13-selected-new-material.txt", + "14-new-material-download-completed.png", + "14-new-material-download-completed.txt", + "15-quota-zero-preparation-blocked.txt", + "16-home-after-normal-completion.png", + "16-home-after-normal-completion.txt", + "17-orders-全部.txt", + "17-orders-已完成.png", + "17-orders-已完成.txt", + "17-orders-待拍摄.txt", + "17-orders-进行中.txt", + "18-A-order-arrived.png", + "18-A-order-arrived.txt", + "19-active-return-confirm.png", + "19-active-return-confirm.txt", + "20-return-destination-preparation.txt", + "21-home-active-order-position.png", + "21-home-active-order-position.txt", + "22-B-select-route-while-occupied.png", + "22-B-select-route-while-occupied.txt", + "23-return-to-original-A-task.png", + "23-return-to-original-A-task.txt", + "24-proactive-return.txt", + "25-returned-without-deduction.png", + "25-returned-without-deduction.txt", + "26-feed-reconnect-pending.png", + "26-feed-reconnect-pending.txt", + "27-phone-sync-pending.png", + "27-phone-sync-pending.txt", + "28-failure-retry-opens-preparation.png", + "28-failure-retry-opens-preparation.txt", + "29-start-result-unknown.png", + "29-start-result-unknown.txt", + "30-sync-original-task.png", + "30-sync-original-task.txt", + "31-after-sync.txt", + "32-failure-dialog-closed.txt", + "33-return-paused.png", + "33-return-paused.txt", + "34-return-resume-outcome.png", + "34-return-resume-outcome.txt", + "35-mixed-ready-failed.png", + "35-mixed-ready-failed.txt", + "36-select-only-ready-items.png", + "36-select-only-ready-items.txt", + "37-retry-upload-one.txt", + "38-select-filtered-point.txt", + "39-filter-change-clears-selection.txt", + "40-all-ready-selection.png", + "40-all-ready-selection.txt", + "41-download-leave-confirm.png", + "41-download-leave-confirm.txt", + "42-continue-download-completed.png", + "42-continue-download-completed.txt", + "43-retry-only-failed-file.txt", + "44-failed-file-retry-completed.png", + "44-failed-file-retry-completed.txt", + "45-leave-stop-returns-orders.txt", + "46-reenter-retains-saved-items.png", + "46-reenter-retains-saved-items.txt", + "47-permission-settings-simulated-return.txt", + "48-permission-cancel-retains-selection.txt", + "49-initial-mixed-upload-state.txt", + "50-mixed-select-eligible-only.png", + "50-mixed-select-eligible-only.txt", + "51-normal-success-final-state.txt", + "52-zero-return-still-on-home.png", + "52-zero-return-still-on-home.txt", + "53-completed-tab-task-entry.png", + "53-completed-tab-task-entry.txt", + "54-completed-entry-restores-return-task.png", + "54-completed-entry-restores-return-task.txt", + "55-feed-reconnect-observation.png", + "55-feed-reconnect-observation.txt", + "56-phone-sync-completed.png", + "56-phone-sync-completed.txt", + "57-phone-recovery-final-task.png", + "57-phone-recovery-final-task.txt", + "58-feed-recovery-image-restored.png", + "58-feed-recovery-image-restored.txt", + "connection-recheck-手机断网.txt", + "connection-recheck-画面断流.txt", + "feed-final-check-画面断流.txt", + "materials-preview-下载中.png", + "materials-preview-下载中.txt", + "materials-preview-下载失败.png", + "materials-preview-下载失败.txt", + "materials-preview-下载完成.txt", + "materials-preview-已选择素材.txt", + "materials-preview-未选择素材.txt", + "materials-preview-相册权限不足.png", + "materials-preview-相册权限不足.txt", + "materials-preview-离开确认.txt", + "materials-preview-素材上传中.txt", + "materials-preview-素材上传失败.txt", + "materials-preview-素材上传完成.txt", + "materials-preview-重试中.txt", + "orders-preview-暂无分配订单.png", + "orders-preview-暂无分配订单.txt", + "orders-preview-正常订单列表.txt", + "prepare-preview-不在拍摄范围.png", + "prepare-preview-不在拍摄范围.txt", + "prepare-preview-拍摄次数用完.txt", + "prepare-preview-无人机占用中.txt", + "prepare-preview-无人机无信号.txt", + "prepare-preview-暂无可用航线.txt", + "prepare-preview-机巢未连接.txt", + "prepare-preview-电量不足.txt", + "prepare-preview-设备状态未知.txt", + "prepare-preview-设备空闲.txt", + "prepare-reset-恢复正常体验.txt", + "reset-final-从头体验整个流程.txt", + "reset-从头体验整个流程.txt", + "task-preview-体验指令超时.txt", + "task-preview-保护性返航.png", + "task-preview-保护性返航.txt", + "task-preview-失败·可重试.png", + "task-preview-失败·可重试.txt", + "task-preview-失败·返航中.png", + "task-preview-失败·返航中.txt", + "task-preview-已到达.txt", + "task-preview-悬停.txt", + "task-preview-手机断网.png", + "task-preview-手机断网.txt", + "task-preview-执行失败弹窗.png", + "task-preview-执行失败弹窗.txt", + "task-preview-拍摄中.txt", + "task-preview-拍摄完成.png", + "task-preview-拍摄完成.txt", + "task-preview-拍摄完成弹窗.png", + "task-preview-拍摄完成弹窗.txt", + "task-preview-画面断流.png", + "task-preview-画面断流.txt", + "task-preview-返航中.txt", + "workbench-preview-无人机占用中.txt", + "workbench-preview-无人机无信号.txt", + "workbench-preview-暂无拍摄订单.txt", + "workbench-preview-机巢未连接.txt", + "workbench-preview-电量不足.txt", + "workbench-preview-设备状态未知.txt", + "workbench-preview-设备空闲.txt", + "workbench-reset-恢复正常体验.txt", + "zero-return-preview-拍摄完成.png", + "zero-return-preview-拍摄完成.txt" + ], + "state_groups": { + "workbench-preview": [ + "workbench-preview-无人机占用中.txt", + "workbench-preview-无人机无信号.txt", + "workbench-preview-暂无拍摄订单.txt", + "workbench-preview-机巢未连接.txt", + "workbench-preview-电量不足.txt", + "workbench-preview-设备状态未知.txt", + "workbench-preview-设备空闲.txt" + ], + "orders-preview": [ + "orders-preview-暂无分配订单.txt", + "orders-preview-正常订单列表.txt" + ], + "prepare-preview": [ + "prepare-preview-不在拍摄范围.txt", + "prepare-preview-拍摄次数用完.txt", + "prepare-preview-无人机占用中.txt", + "prepare-preview-无人机无信号.txt", + "prepare-preview-暂无可用航线.txt", + "prepare-preview-机巢未连接.txt", + "prepare-preview-电量不足.txt", + "prepare-preview-设备状态未知.txt", + "prepare-preview-设备空闲.txt" + ], + "task-preview": [ + "task-preview-体验指令超时.txt", + "task-preview-保护性返航.txt", + "task-preview-失败·可重试.txt", + "task-preview-失败·返航中.txt", + "task-preview-已到达.txt", + "task-preview-悬停.txt", + "task-preview-手机断网.txt", + "task-preview-执行失败弹窗.txt", + "task-preview-拍摄中.txt", + "task-preview-拍摄完成.txt", + "task-preview-拍摄完成弹窗.txt", + "task-preview-画面断流.txt", + "task-preview-返航中.txt" + ], + "materials-preview": [ + "materials-preview-下载中.txt", + "materials-preview-下载失败.txt", + "materials-preview-下载完成.txt", + "materials-preview-已选择素材.txt", + "materials-preview-未选择素材.txt", + "materials-preview-相册权限不足.txt", + "materials-preview-离开确认.txt", + "materials-preview-素材上传中.txt", + "materials-preview-素材上传失败.txt", + "materials-preview-素材上传完成.txt", + "materials-preview-重试中.txt" + ] + }, + "state_count": 42, + "renamed_to_match_actual_content": { + "04-pause-pending": "04-pause-confirmed-observation", + "10-new-shoot-materials-awaiting": "10-new-shoot-materials-entry-ready", + "26-feed-reconnected": "26-feed-reconnect-pending", + "27-phone-reconnected": "27-phone-sync-pending", + "35-mixed-uploading-ready-failed": "35-mixed-ready-failed", + "40-mixed-uploading-only-ready-selection": "40-all-ready-selection", + "55-feed-reconnected-complete": "55-feed-reconnect-observation" + } +} \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载中.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载中.png new file mode 100644 index 0000000..6e76951 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载中.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载中.txt new file mode 100644 index 0000000..8e7e0be --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载中.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:37 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [disabled] [pressed]: + - heading "素材02" [level=4] + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载失败.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载失败.png new file mode 100644 index 0000000..230aaa6 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载失败.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载失败.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载失败.txt new file mode 100644 index 0000000..6ef0314 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载失败.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:37 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02下载失败": + - heading "素材02" [level=4] + - button "重试下载" + - paragraph: + - text: 下载失败 +- contentinfo: + - contentinfo: + - heading "部分素材下载失败" [level=3] + - paragraph: 成功1项 · 失败1项,已下载的无需重复下载 + - button "重试失败素材(1)": + - text: 重试失败素材(1) + - button "选择其他素材" \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载完成.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载完成.txt new file mode 100644 index 0000000..b650eec --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-下载完成.txt @@ -0,0 +1,214 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:39 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - generic "素材02已下载": + - heading "素材02" [level=4] + - paragraph: + - text: 已下载 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 2项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-已选择素材.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-已选择素材.txt new file mode 100644 index 0000000..e95f3f6 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-已选择素材.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:36 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [pressed]: + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-未选择素材.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-未选择素材.txt new file mode 100644 index 0000000..b6c815d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-未选择素材.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:36 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.png new file mode 100644 index 0000000..6df006b Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.txt new file mode 100644 index 0000000..e0c12ee --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-相册权限不足.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:39 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材05 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- status: 演示:相册权限已允许,请重新下载 +- alertdialog "无法保存到手机相册": + - heading "无法保存到手机相册" [level=2] + - paragraph: 相册权限未开启。请在系统设置中允许App添加照片后,再下载素材。 + - button "暂不下载" + - button "去设置" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-离开确认.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-离开确认.txt new file mode 100644 index 0000000..8f4657d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-离开确认.txt @@ -0,0 +1,213 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:38 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - heading [level=4]: 素材05 + - paragraph: + - text: 已下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材02 + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… +- alertdialog "素材仍在下载": + - heading "素材仍在下载" [level=2] + - paragraph: 离开将停止未完成的下载,已保存的素材会保留。确定离开吗? + - button "离开并停止" + - button "继续下载" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传中.txt new file mode 100644 index 0000000..2064081 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传中.txt @@ -0,0 +1,199 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:36 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - generic "素材05上传中": + - heading "素材05" [level=4] + - paragraph: 上传中 + - generic "素材06上传中": + - heading "素材06" [level=4] + - paragraph: 上传中 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传中": + - heading "素材03" [level=4] + - paragraph: 上传中 + - generic "素材04上传中": + - heading "素材04" [level=4] + - paragraph: 上传中 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传中": + - heading "素材01" [level=4] + - paragraph: 上传中 + - generic "素材02上传中": + - heading "素材02" [level=4] + - paragraph: 上传中 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传失败.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传失败.txt new file mode 100644 index 0000000..cd83677 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传失败.txt @@ -0,0 +1,205 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:36 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - generic "素材05上传失败": + - heading "素材05" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材06上传失败": + - heading "素材06" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - generic "素材03上传失败": + - heading "素材03" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材04上传失败": + - heading "素材04" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - generic "素材01上传失败": + - heading "素材01" [level=4] + - button "重试上传" + - paragraph: 上传失败 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传完成.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传完成.txt new file mode 100644 index 0000000..b6c815d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-素材上传完成.txt @@ -0,0 +1,211 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:36 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02": + - heading "素材02" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-重试中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-重试中.txt new file mode 100644 index 0000000..0e11ca5 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/materials-preview-重试中.txt @@ -0,0 +1,215 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:38 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材02" + - button "预览素材02" + - button "选择素材02" [disabled] [pressed]: + - heading "素材02" [level=4] + - paragraph: + - text: 下载中 +- contentinfo: + - contentinfo: + - strong: 本次下载1项 + - generic: 已完成0/1项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.png new file mode 100644 index 0000000..4965c29 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.txt new file mode 100644 index 0000000..11da77d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-暂无分配订单.txt @@ -0,0 +1,56 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 0" [level=2] + - heading "暂无订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-正常订单列表.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-正常订单列表.txt new file mode 100644 index 0000000..10715a9 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/orders-preview-正常订单列表.txt @@ -0,0 +1,204 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 12" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001·10-20 14:32 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - button "交付成片" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200002·10-20 14:18 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: HT202610200003·10-20 13:46 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - button "交付成片" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客137****6628" [level=2] + - generic: 已完成 + - paragraph: HT202610190012·10-19 16:18 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200005·10-20 12:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: HT202610200006·10-20 11:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200007·10-20 10:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: HT202610200008·10-20 9:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄1次 + - generic: 剩余4次 + - button "继续拍摄" + - button "交付成片" + - text: 上传完成 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: HT202610200009·10-20 8:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 已完成 + - paragraph: HT202610200010·10-20 7:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客185****5736" [level=2] + - generic: 已完成 + - paragraph: HT202610200011·10-20 6:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - article: + - heading "游客188****3160" [level=2] + - generic: 已完成 + - paragraph: HT202610200012·10-20 5:15 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄5次 + - generic: 剩余0次 + - button "查看素材" + - button "交付成片" + - text: 上传完成 + - paragraph: 已显示全部 12 个订单 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.png new file mode 100644 index 0000000..751c828 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.txt new file mode 100644 index 0000000..67b5fa0 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-不在拍摄范围.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 尚未进入范围 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 请先进入所选拍摄点的范围 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-拍摄次数用完.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-拍摄次数用完.txt new file mode 100644 index 0000000..a405e7d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-拍摄次数用完.txt @@ -0,0 +1,94 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 5 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 5 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 5 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 0 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 0 条 + - heading "暂无可用航线" [level=3] + - paragraph: 请选择其他拍摄点,或稍后重试 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 未选择航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前订单拍摄次数已用完 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-无人机占用中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-无人机占用中.txt new file mode 100644 index 0000000..0682598 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-无人机占用中.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机占用中,请稍后再试 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 无人机占用中,请稍后再试 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-无人机无信号.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-无人机无信号.txt new file mode 100644 index 0000000..f9fcd1d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-无人机无信号.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机无信号,暂时无法召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 无信号 + - button "确认并召唤无人机" [disabled] + - status: 无人机无信号,暂时无法召唤 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-暂无可用航线.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-暂无可用航线.txt new file mode 100644 index 0000000..a905db7 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-暂无可用航线.txt @@ -0,0 +1,94 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 0 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 0 条 + - heading "暂无可用航线" [level=3] + - paragraph: 请选择其他拍摄点,或稍后重试 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 未选择航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前拍摄点暂无可用航线 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-机巢未连接.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-机巢未连接.txt new file mode 100644 index 0000000..19c4d2a --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-机巢未连接.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 机巢未连接,请连接后重试 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢未连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 未连接 + - button "确认并召唤无人机" [disabled] + - status: 机巢未连接,请连接后重试 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-电量不足.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-电量不足.txt new file mode 100644 index 0000000..396dcd4 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-电量不足.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 电量不足,设备暂不允许执行 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 低电量 · 电量 18% + - button "确认并召唤无人机" [disabled] + - status: 电量不足,设备暂不允许执行 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-设备状态未知.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-设备状态未知.txt new file mode 100644 index 0000000..aab1382 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-设备状态未知.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机状态未知,请刷新确认 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 状态未知 + - button "确认并召唤无人机" [disabled] + - status: 无人机状态未知,请刷新确认 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-设备空闲.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-设备空闲.txt new file mode 100644 index 0000000..a2e2d70 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-preview-设备空闲.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-reset-恢复正常体验.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-reset-恢复正常体验.txt new file mode 100644 index 0000000..a2e2d70 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/prepare-reset-恢复正常体验.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:29 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/reset-final-从头体验整个流程.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/reset-final-从头体验整个流程.txt new file mode 100644 index 0000000..88cfe14 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/reset-final-从头体验整个流程.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:40 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/reset-从头体验整个流程.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/reset-从头体验整个流程.txt new file mode 100644 index 0000000..98ffede --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/reset-从头体验整个流程.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:32 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-体验指令超时.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-体验指令超时.txt new file mode 100644 index 0000000..a0b3dca --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-体验指令超时.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:30 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-保护性返航.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-保护性返航.png new file mode 100644 index 0000000..f7d4a77 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-保护性返航.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-保护性返航.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-保护性返航.txt new file mode 100644 index 0000000..2b89673 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-保护性返航.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 18% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机自动返航" [level=2] + - paragraph: 返航原因:电量不足 拍摄结果待确认,请留意实时画面及现场。 + - button "结果待确认" [disabled]: + - text: 结果待确认 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.png new file mode 100644 index 0000000..6f448b2 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.txt new file mode 100644 index 0000000..bd5b1f2 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·可重试.txt @@ -0,0 +1,111 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机": + - text: 重新召唤无人机 + - paragraph: 设备已就绪,排查后可重新召唤 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.png new file mode 100644 index 0000000..0579b58 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.txt new file mode 100644 index 0000000..5817687 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-失败·返航中.txt @@ -0,0 +1,111 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机返航中,暂不可召唤 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-已到达.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-已到达.txt new file mode 100644 index 0000000..59ac03d --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-已到达.txt @@ -0,0 +1,110 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:26 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-悬停.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-悬停.txt new file mode 100644 index 0000000..6f91516 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-悬停.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:26 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-手机断网.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-手机断网.png new file mode 100644 index 0000000..7024256 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-手机断网.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-手机断网.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-手机断网.txt new file mode 100644 index 0000000..1dfaf07 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-手机断网.txt @@ -0,0 +1,111 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - heading "手机网络连接中断" [level=3] + - paragraph: 请检查网络后重新连接 + - button "重新连接" + - region "无人机六项状态": + - paragraph: + - text: 状态暂未更新 + - generic: 电池电量 + - strong: + - text: — + - generic: 环境温度 + - strong: + - text: — + - generic: 风速 + - strong: + - text: — + - generic: 雨量 + - strong: + - text: — + - generic: 信号状态 + - strong: + - text: — + - generic: 搜星状态 + - strong: + - text: — + - status: + - heading "任务状态待确认" [level=2] + - paragraph: 连接中断不代表任务失败。 恢复连接后将同步当前任务。 + - button "等待连接恢复" [disabled]: + - text: 等待连接恢复 + - generic: 安全控制 + - button "紧急暂停 当前无法发送指令" [disabled]: + - strong: 紧急暂停 + - generic: 当前无法发送指令 + - button "立即返航 当前无法发送指令" [disabled]: + - strong: 立即返航 + - generic: 当前无法发送指令 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.png new file mode 100644 index 0000000..63ee81e Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.txt new file mode 100644 index 0000000..638e62f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-执行失败弹窗.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:31 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机返航中,暂不可召唤 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "任务执行失败": + - heading "任务执行失败" [level=2] + - paragraph: 请排查错误后 再次召唤无人机。 + - button "确定" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄中.txt new file mode 100644 index 0000000..1d4b1bb --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄中.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:26 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.png new file mode 100644 index 0000000..5a13cd4 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.txt new file mode 100644 index 0000000..2934248 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:31 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.png new file mode 100644 index 0000000..971cc91 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.txt new file mode 100644 index 0000000..7391423 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-拍摄完成弹窗.txt @@ -0,0 +1,103 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:31 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-画面断流.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-画面断流.png new file mode 100644 index 0000000..6d953e3 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-画面断流.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-画面断流.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-画面断流.txt new file mode 100644 index 0000000..830b45f --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-画面断流.txt @@ -0,0 +1,109 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:28 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续查看任务" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄0次 + - generic: 剩余5次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - heading "直播画面连接中断" [level=3] + - paragraph: 无人机状态仍在更新 + - button "重新连接画面" + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 当前仅画面中断,请关注现场。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-返航中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-返航中.txt new file mode 100644 index 0000000..12f7474 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/task-preview-返航中.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:31 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 3 次 + - paragraph: + - text: 剩余 + - strong: "2" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 3 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 3 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在返航" [level=2] + - paragraph: 本次拍摄已中断。 请留意实时画面与无人机状态。 + - button "拍摄已中断" [disabled]: + - text: 拍摄已中断 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-无人机占用中.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-无人机占用中.txt new file mode 100644 index 0000000..e4786cf --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-无人机占用中.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 占用中 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-无人机无信号.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-无人机无信号.txt new file mode 100644 index 0000000..3497063 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-无人机无信号.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 无信号 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-暂无拍摄订单.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-暂无拍摄订单.txt new file mode 100644 index 0000000..7fe3a30 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-暂无拍摄订单.txt @@ -0,0 +1,48 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 状态未知 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 0" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - heading "暂无待处理订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-机巢未连接.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-机巢未连接.txt new file mode 100644 index 0000000..98e252b --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-机巢未连接.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 未连接 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-电量不足.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-电量不足.txt new file mode 100644 index 0000000..57e14d8 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-电量不足.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 低电量 + - generic: 电池电量 + - strong: 18% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-设备状态未知.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-设备状态未知.txt new file mode 100644 index 0000000..8e49a89 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-设备状态未知.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 状态未知 + - generic: 电池电量 + - strong: — + - generic: 环境温度 + - strong: — + - generic: 风速 + - strong: — + - generic: 雨量 + - strong: — + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-设备空闲.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-设备空闲.txt new file mode 100644 index 0000000..81eafdd --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-preview-设备空闲.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-reset-恢复正常体验.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-reset-恢复正常体验.txt new file mode 100644 index 0000000..81eafdd --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/workbench-reset-恢复正常体验.txt @@ -0,0 +1,73 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:33 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "嵩山少林景区" [level=2] + - paragraph: + - text: 已进入打卡范围 + - heading "吴家俊" [level=3] + - paragraph: 现场工作人员 + - heading "无人机状态" [level=2] + - text: 空闲 + - generic: 电池电量 + - strong: 95% + - generic: 环境温度 + - strong: 19.3°C + - generic: 风速 + - strong: 0m/s + - generic: 雨量 + - strong: 无雨 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - paragraph: 仅展示分配给我的未完成订单 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄3次 + - generic: 剩余2次 + - button "继续拍摄" + - text: 上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄0次 + - generic: 剩余1次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄2次 + - generic: 剩余3次 + - button "继续拍摄" + - text: 上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.png b/docs/9.9.1/review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.png new file mode 100644 index 0000000..d9c9912 Binary files /dev/null and b/docs/9.9.1/review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.png differ diff --git a/docs/9.9.1/review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.txt b/docs/9.9.1/review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.txt new file mode 100644 index 0000000..d755181 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/nonpayment-rerun/zero-return-preview-拍摄完成.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:42 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/review/product-comparison/payment-existing-vs-new.md b/docs/9.9.1/review/product-comparison/payment-existing-vs-new.md new file mode 100644 index 0000000..d571fca --- /dev/null +++ b/docs/9.9.1/review/product-comparison/payment-existing-vs-new.md @@ -0,0 +1,79 @@ +# 新套餐收款页相对现有 App 收款能力的增量 + +> 本文件保留早期只读代码核对,表格中的“未验证”是当时状态。后续套餐选择、改价、收款异常、模拟支付、记录及保存提示已完成页面核验,最终覆盖请看[收款与工作台实际记录](payment-verified.md)。本文件主要用于确认哪些是旧App已有能力。 + +日期:2026-10-22。仅做只读核对,未修改 App 代码、未执行真实收款或运行功能测试。 + +## 结论 + +用户已经明确:9.9.1 新增一个支持选择航拍套餐的收款页面。**新增的是套餐选择及套餐收款业务链,不是重新新增“设置金额、保存二维码、收款记录、到账语音、线下收款登记”这些已有功能。** 新页面可以复用二维码绘制、金额校验、相册保存等通用能力,但不能直接把旧收款页作为已经支持套餐交易的页面。 + +当前原型证据仅使用主代理实际读取的 [PAY01-normal.txt](evidence/payment/PAY01-normal.txt):已进入“收款详情”,初始未选航拍套餐,显示“请选择航拍套餐”“选择后生成对应套餐收款码”,设置金额/保存二维码禁用。以下不把选套餐、生成套餐码、支付结果或各按钮的后续行为提前记为已跑通。 + +## 1. 已有能力,不能误记成原型新增 + +| 能力 | 现有 App 代码能确认的行为 | 原型 PAY01 的可见表现 | 增量判断 | +| --- | --- | --- | --- | +| 收款详情页面与二维码区 | 现有 `PaymentCollectionDetailsViewController` 已展示收款详情、二维码、景区及收款信息。 | 标题同为“收款详情”,有收款二维码区。 | 页面名称与二维码展示本身不是新增;套餐版是新增业务页面。 | +| 获取收款码与刷新 | `loadPayCode` 请求当前景区静态/动态支付 URL;初次加载有占位,失败可点击刷新;有请求防重。 | 未选套餐时提示先选择,未展示套餐码。 | 旧能力已存在;新增加码前的“套餐未选”状态及相应前置条件。 | +| 设置金额 | 已有设置金额弹窗、金额与备注输入;金额要求大于 0、最多两位小数;确认后生成带金额/备注的动态码。 | “设置金额”可见但当前禁用。 | 按钮与金额校验不是新增;套餐价格与可改金额的关系尚需核验。 | +| 保存二维码 | 已有保存二维码到系统相册的调用及保存成功/失败提示,无二维码时提示先获取收款码。 | “保存二维码”可见但当前禁用。 | 保存能力不是新增;增加在套餐未选或套餐码未就绪时禁用的套餐上下文。 | +| 收款信息 | 普通收款页已有景区名称、收款方、员工 ID;品牌页另显示摄影师与店铺信息。 | 显示景区名称、收款方、员工 ID。 | 这些基础展示字段不是新增。示例收款方也不证明新增了收款方接口。 | +| 收款记录 | 已有独立收款记录页,按日期分组展示近 7 天汇总与明细。 | “收款记录”入口可见。 | 入口和历史记录能力不是新增;记录是否新增套餐字段、是否复用旧记录接口仍未验证。 | +| 到账语音开关 | 已有“收款到账语音提醒”,切换后保存到 App 本地支付设置。 | 同名开关可见,尚未操作。 | 开关不是新增;不据此断言新套餐交易的语音事件已经与旧通道对接。 | +| 线下收款登记 | 旧收款页已嵌入线下收款区域,支持去登记、今日记录、待处理记录、统计刷新与错误重试。 | “线下收款登记”“去登记”,并明确“原有功能,本次演示不调整”。 | 既有能力,本版无需因原型再次列出就扩为新增开发范围。 | +| 景区品牌配置 | 旧页已有特定景区背景、Logo、标题、本地默认与缓存、远端刷新。 | 当前样例为普通景区收款展示,未见品牌切换验证。 | 旧功能存在;不能推断新套餐页必须重做全部品牌场景,也不能推断原型删除了旧能力。 | + +### 旧代码定位 + +- 页面元素与信息行:[PaymentCollectionDetailsViewController.swift:31](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L31),标题在 [104 行](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L104),基础操作和语音配置在 [170 行](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L170)。 +- 旧页加载/有二维码/错误刷新三态,以及操作区可用性:[PaymentCollectionDetailsViewController.swift:421](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L421)。旧实现无可用码时隐藏并禁止操作区;原型的“套餐未选”则显示置灰按钮,这是展示差异,不能将按钮本身当新功能。 +- 收款码请求及静态码绘制:[PaymentCollectionDetailsViewModel.swift:111](../../../../suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift#L111)。 +- 设置金额、备注与动态码:[PaymentCollectionDetailsViewModel.swift:162](../../../../suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift#L162),动态 URL 处理在 [202 行](../../../../suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift#L202),金额校验在 [236 行](../../../../suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift#L236)。 +- 保存二维码及语音设置持久化:[PaymentCollectionDetailsViewModel.swift:209](../../../../suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift#L209);相册保存工具 [PhotoLibrarySaver.swift:13](../../../../suixinkan/Common/PhotoLibrarySaver.swift#L13)。 +- 收款记录入口:[PaymentCollectionDetailsViewController.swift:706](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L706),加载与按日分组在 [PaymentCollectionRecordViewModel.swift:22](../../../../suixinkan/Features/Payment/ViewModels/PaymentCollectionRecordViewModel.swift#L22)。 +- 线下收款已有绑定:[PaymentCollectionDetailsViewController.swift:364](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L364),已有登记跳转在 [714 行](../../../../suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift#L714),登记提交逻辑在 [OfflineCollectionViewModels.swift:84](../../../../suixinkan/Features/OfflineCollection/ViewModels/OfflineCollectionViewModels.swift#L84)。 + +## 2. 套餐版收款的明确增量 + +| 增量 | 相对旧页的变化 | 当前证据/确认级别 | +| --- | --- | --- | +| 新页面承载套餐收款 | 旧页主要围绕当前景区收款码;新页需要独立表达套餐选择、套餐价格/次数与码就绪状态。 | 用户已明确新增收款页+选套餐。PAY01 已观察初始未选态。 | +| 套餐选择是生成套餐码前置条件 | 旧页进入后直接请求景区收款码;新页初始要求先选择套餐。 | PAY01 已观察“请选择”“选择后生成对应套餐收款码”。生成动作仍待操作验证。 | +| 套餐相关可用性 | 未选套餐时不能设置金额或保存码;后续还需处理套餐失效、切换、请求中等状态。 | “未选套餐禁用”已有 DOM 证据;其余是需检查/补齐的状态,不是已验证原型能力。 | +| 套餐与收款码对应关系 | 选择或切换套餐后,展示、价格、次数及收款码必须指向同一份选择,避免仍使用旧套餐码。 | 用户范围要求与原型提示表达了意图;具体刷新/确认流程仍待体验。 | +| 支付结果与订单入口 | 已支付后停留成功页,由按钮去“我的拍摄订单”,默认“待拍摄”。 | 当前方案 C16/C17 已确认;旧收款页自身未包含该路由,原型尚待后续操作验证。 | + +“支付成功页+订单入口”是当前方案已经确认而旧收款页没有的增量,**不能在最终对比中又记成产品原型相对我们新增的规则**。应检查产品原型是否与既有确认一致。 + +## 3. 旧 API 能证明什么、不能证明什么 + +当前 [PaymentAPI.swift:17](../../../../suixinkan/Features/Payment/API/PaymentAPI.swift#L17) 的收款码接口仅传 `scenic_id`,返回值 [PayCodeResponse:106](../../../../suixinkan/Features/Payment/Models/PaymentModels.swift#L106) 只有 `static_pay_url` 与 `dynamic_pay_url`。当前方法与模型未表达套餐 ID、套餐版本、拍摄次数、单笔收款会话、支付结果或过期时间。 + +旧收款记录接口位于 [PaymentAPI.swift:39](../../../../suixinkan/Features/Payment/API/PaymentAPI.swift#L39);明细 [PaymentModels.swift:155](../../../../suixinkan/Features/Payment/Models/PaymentModels.swift#L155) 仅有订单号、手机号、金额和创建时间等字段,未表达航拍套餐内容。历史记录查询不能直接视为当前交易结果确认机制。 + +因此,**现有代码不足以证明新套餐交易绑定或支付结果确认已经具备**。后续需要对接明确采用扩展旧接口还是新接口;前端不能自行在旧 URL 上拼一个套餐字段,就假设完成了套餐和订单绑定。这是接口信息需求,不是在要求用户决定后端分配或交易实现。 + +## 4. 当前最值得补核验的套餐收款状态 + +| 检查项 | 旧能力可复用部分 | 套餐版要核验/补齐的部分 | 当前状态 | +| --- | --- | --- | --- | +| 初次进入 | 旧页布局、二维码区与基础信息 | 未选套餐的占位、禁用及选择入口 | PAY01 已观察 | +| 套餐选择 | 通用列表/弹层组件可评估复用 | 列表加载、空、失败;选中与切换;价格和次数说明 | 未验证 | +| 生成套餐码 | 二维码绘制及请求中反馈 | 套餐码生成请求、失败重试、码就绪;请求结果与当前套餐一致 | 未验证 | +| 设置金额 | 旧金额输入/备注/校验工具 | 套餐是否允许改价、金额改变后码与权益仍指向同一套餐;不能照抄旧自由金额逻辑便宣称完整 | 未验证 | +| 码失效与返回 | 错误占位、刷新交互可复用 | 是否存在失效/关闭、结果未知与原交易恢复;换套餐如何处理旧码 | 未验证 | +| 支付完成 | 旧页没有对应套餐成功路由 | 成功页停留、订单按钮、默认待拍 Tab;状态以权威结果为准 | 方案已确认,原型待验证 | +| 保存套餐码 | 相册权限及保存工具 | 只有当前有效套餐码可保存;保存失败与码生成失败分开 | 入口与初始禁用已观察,点击未验证 | +| 收款记录、语音、线下登记 | 已有能力及入口 | 是否直接沿用、是否新增套餐展示;线下登记原型明确本次不调整 | 入口已观察,后续未验证 | + +这里的“套餐是否允许改价”是需要从产品交互中观察的规则,并未向用户重新提问。若原型允许自由金额而套餐价格仍固定,最终报告应把这种联动写成差异/待取舍,而非自行定案。 + +## 5. 后续开发范围建议 + +- 新建套餐收款页面与对应业务状态,避免把旧的普通景区收款页变成同时承载两种不清楚的流程。 +- 评估复用通用二维码绘制、金额校验、相册保存、基础信息行、记录入口与语音设置;不必把已有按钮和线下登记再次列为新增功能。 +- 套餐列表与套餐收款契约、支付结果到订单导航是本次主要增量。是否拆新 API 或扩旧 API 待接口对齐,不由本次原型操作代替验证。 +- 本次未跑代码测试;旧测试文件覆盖金额校验、动态码、加载态、语音设置持久化等,只能说明已有测试资产,不能称作新套餐功能已经测试通过。 + +本文件可随主代理新增原型 DOM 继续更新;目前不对未操作的套餐选择、支付异常及收款记录流程作“已验证”结论。 diff --git a/docs/9.9.1/review/product-comparison/payment-verified.md b/docs/9.9.1/review/product-comparison/payment-verified.md new file mode 100644 index 0000000..e6a0adc --- /dev/null +++ b/docs/9.9.1/review/product-comparison/payment-verified.md @@ -0,0 +1,67 @@ +# 套餐收款与工作台:实际体验记录 + +体验日期:2026-10-22。通过内部浏览器操作产品原型。以下“实走”均为演示交互,没有真实收款、生成可支付码或写入系统相册。 + +## 收款主流程 + +| 操作 | 实际可见结果 | 证据 | +| --- | --- | --- | +| 工作台 → 收款码 | 收款详情页,套餐“请选择”;设置金额、保存二维码禁用 | 旧 [PAY01-normal.txt](evidence/payment/PAY01-normal.txt) | +| 选择航拍套餐 | 单次 ¥99/1次、三次 ¥259/3次、五次 ¥399/5次;单选,无选择时确认禁用 | [P02-package-picker.txt](evidence/payment2/P02-package-picker.txt) | +| 选择三次并确认 | 先“正在生成收款码…”,随后演示二维码、¥259、含3次、等待游客支付 | [P03-selected-code.txt](evidence/payment2/P03-selected-code.txt) | +| 设置金额 | 弹层显示“仅修改本次成交价,不改变套餐拍摄次数”,金额与选填备注(200字计数) | [P16-amount-dialog.txt](evidence/payment2/P16-amount-dialog.txt) | +| 输入0后确定 | 留在弹层,提示“请输入大于0的金额,最多保留两位小数” | 同上;实际只验证0,未穷举所有金额边界 | +| 改为199.99并确定 | 保持三次套餐,显示新金额并重新生成收款码 | [P17-adjusted-price-same-quota.txt](evidence/payment2/P17-adjusted-price-same-quota.txt) | +| 更换弹层选五次后取消 | 回原三次套餐,保留199.99成交价和原演示码 | [P18-cancel-change-package.txt](evidence/payment2/P18-cancel-change-package.txt) | +| 改选单次并确认 | 页面变为单次、含1次、99元,生成对应演示码;不沿用三次套餐的199.99成交价 | [P19-confirm-change-package.txt](evidence/payment2/P19-confirm-change-package.txt) | +| 等待支付 → 刷新状态 | 提示“暂未收到支付结果,请游客完成支付”,仍等待 | [P14-refresh-unpaid.txt](evidence/payment2/P14-refresh-unpaid.txt) | +| 体验游客扫码支付 | 按钮禁用,先“正在体验支付…”,再收款成功 | [P09-payment-success.txt](evidence/payment2/P09-payment-success.txt) | +| 成功页 | 保留套餐和成交价,显示订单已归属工作人员、示例游客,提供继续收款、查看订单;不自动跳转 | [P11-success.png](evidence/payment2/P11-success.png) | +| 成功 → 查看订单 | 打开“我的拍摄订单”,新增示例订单在顶部,但默认**全部**Tab | [P10-payment-orders-default-all.txt](evidence/payment2/P10-payment-orders-default-all.txt) | +| 成功 → 继续收款 | 清空本次套餐、金额和旧码,回到请选择套餐;设置金额/保存二维码再次禁用 | [P12-continue-payment-reset.txt](evidence/payment2/P12-continue-payment-reset.txt) | +| 收款记录 | 显示本次演示成功记录的金额、套餐、次数、时间、销售、订单号、查看订单 | [P13-payment-records.txt](evidence/payment2/P13-payment-records.txt) | +| 保存二维码 | 仅提示“演示:已保存二维码(未写入系统相册)” | [P15-save-qr-simulated.txt](evidence/payment2/P15-save-qr-simulated.txt) | + +补充:正常流程实际选择过三次、单次套餐;状态预览使用五次样本。示例价格和次数不能硬编码为实际产品配置。 + +## 收款页面全部7个状态入口 + +菜单证据:[P05-payment-state-menu.txt](evidence/payment2/P05-payment-state-menu.txt)。 + +| 菜单状态 | 验证方式与结果 | 证据 | +| --- | --- | --- | +| 未选择套餐 | 主流程实际进入;未生成码,相关操作禁用 | PAY01、P12 | +| 收款码生成中 | 选套餐、改价、失败重试时正常流触发;按钮禁用 | 本次工具记录观察到,未单独保存加载瞬间;随后完成态见P03、P17 | +| 等待游客支付 | 主流程实际到达;可演示扫码、刷新状态、设置金额、保存码 | P03、P14 | +| 收款成功 | 正常模拟支付实际到达;停留、查看订单、继续收款均实走 | P09–P13 | +| 收款码生成失败 | 状态菜单触发;可重新生成,保存码禁用;重新生成后回到等待支付 | P06 | +| 收款码已失效 | 状态菜单触发;不显示可支付码,提供重新生成,保存码禁用 | P07 | +| 暂无可售套餐 | 状态菜单触发;点选择套餐后空态“请联系管理员在Web端配置套餐”,知道了退出 | P08、P08b | + +这里覆盖全部7种可见收款状态,但不代表真实支付接口、码的服务端失效、相册保存、回调幂等已验证。 + +## 与当前方案的比对 + +- **明确冲突**:成功页“查看订单”默认全部;用户已确认默认待拍摄(C17),合并方案保留待拍摄。 +- **新增页面细节**:套餐单选、确认前禁用;选中后生成对应码;改价不改次数;继续收款重置本次数据;无套餐处理;成功页可继续下一笔。 +- **切换选择的边界**:取消保持旧套餐和成交价;确认换套餐则使用新套餐默认价格/次数,生成新演示码。未验证服务端旧码是否作废,也没有证明旧码晚支付的处理。 +- **旧方案已有状态的细化**:生成中/失败/失效/等待支付、收款记录、金额校验与备注。不能把这些全部写成“此前完全没考虑”。 +- **原有App能力**:设置金额、保存码、收款记录、到账语音、线下登记已有实现;新开发重点是套餐关联和新页面的状态组织,见 [payment-existing-vs-new.md](payment-existing-vs-new.md)。 +- **双方仍需补齐**:套餐列表请求失败/重试、原套餐下架/价格变化、生成码时切套餐/旧请求晚返回、旧码支付与新码状态核对、支付结果未知/查询失败、成功但订单尚未查到、重复通知/重进后的恢复。它们是建议或接口契约,原型没有入口,不能当作已确认的界面。 +- **不属于本次新增**:后台配置套餐的草稿/上架/下架管理,以及订单分配算法。App只展示服务端可售套餐及本人当前景区订单。 + +## 工作台全部7种状态预览 + +均已逐项点击菜单并等待弹层关闭,文件位于 [workbench2](evidence/workbench2),不是只看菜单。 + +| 状态 | 页面表现 | +| --- | --- | +| 设备空闲 | 空闲;六项遥测有值 | +| 无人机占用中 | 占用中;仍可查看订单 | +| 机巢未连接 | 未连接;六项遥测均为“—” | +| 无人机无信号 | 无信号;信号字段无信号,其他样本遥测仍显示原值;不能据此推断数据是实时值 | +| 电量不足 | 低电量,示例电量18%;18%只是演示值,不是App判定阈值 | +| 设备状态未知 | 状态未知;六项遥测均为“—” | +| 暂无拍摄订单 | 数量0、暂无待处理订单、分配给你的订单会显示在这里 | + +菜单只切当前页面状态,部分维度会保留前次预览值。因此“暂无订单+状态未知”可同时出现,不应把这种组合误判成空态导致设备异常。 diff --git a/docs/9.9.1/review/product-comparison/体验进度与已验证差异.md b/docs/9.9.1/review/product-comparison/体验进度与已验证差异.md new file mode 100644 index 0000000..f67e4fa --- /dev/null +++ b/docs/9.9.1/review/product-comparison/体验进度与已验证差异.md @@ -0,0 +1,14 @@ +# 随心瞰9.9.1 原型体验进度 + +更新:2026-10-22。内部浏览器操作已恢复,本次已继续完成页面主流程与状态覆盖。此前仅首页可读的中途结论已被本次报告替代。 + +请阅读[完整双向对比文档](随心瞰9.9.1-产品原型与当前方案对比.md),其中包含: + +- 新套餐收款页面及可复用的旧能力。 +- 原型与已确认方案的差异。 +- 双方补充状态、10类状态取值与待联调项目。 +- 实走、状态预览及真机未验证的边界。 + +详细证据:[收款和工作台](payment-verified.md)、[准备和任务](flight-verified.md)、[订单和素材](materials-verified.md)。 + +本次未修改App代码。交付成片事件和主动返航确认仍按当前基线留待后续。 diff --git a/docs/9.9.1/review/product-comparison/待核验状态检查表.md b/docs/9.9.1/review/product-comparison/待核验状态检查表.md new file mode 100644 index 0000000..cdb1f6e --- /dev/null +++ b/docs/9.9.1/review/product-comparison/待核验状态检查表.md @@ -0,0 +1,146 @@ +# 随心瞰 9.9.1 产品原型待核验状态检查表(历史中途快照) + +> 本文件保留当时尚未恢复浏览器操作时的工作清单,以下U状态不是最终核验结论。后续已完成的范围及仍需联调事项,以[完整双向对比文档](随心瞰9.9.1-产品原型与当前方案对比.md)及其三份实测记录为准。 + +日期:2026-10-22。原型:。 + +**本文是后续体验和补证据的工作清单,不是已经完成的产品原型双向对比报告。** 当前浏览器控制存在超时,只能确认内部浏览器首页初始 DOM,以及切换到内部浏览器要求之前在外部浏览器实际触发的工作台占用态。不能由首页入口或状态菜单推断收款、订单、任务、素材等后续流程已经跑通。 + +当前方案依据:[current-baseline.md](current-baseline.md)。其中 C01–C20 为用户确认,R01–R06 为原稿已有规则,旧评审建议及 U01–U04 不能自动升级为已确认。 + +## 1. 核验标签与记录规则 + +| 标签 | 含义 | +| --- | --- | +| **O 已观察** | 实际页面状态已读到,但不等于已完成触发、返回或恢复测试。 | +| **E 入口已观察** | 按钮或菜单项可见;点击后的目标与行为尚未核验。 | +| **T 已实际触发** | 实际操作后,已观察到目标状态;只认可证据明确覆盖的范围。 | +| **U 未验证** | 尚无对应操作与目标状态证据。不能写成“原型没有”“原型已支持”。 | +| **A App 验收项** | 需要 App/真机或接口联调,原型未提供入口时仍保留;不能仅凭原型判定实现。 | + +后续每次补证据记录:`检查 ID|实际入口与操作|观察结果|证据路径|是否可返回/恢复|与基线一致/新增/冲突/仍不明`。只有执行并观察后才改成 T;状态选择器只证明菜单列出了该状态,不能代替正常链路的转移核验。 + +## 2. 已观察到的页面与入口 + +| ID | 已观察内容 | 标签 | 当前能证明什么 | 证据 | +| --- | --- | --- | --- | --- | +| O01 | 内部浏览器机巢工作台初始页 | O | 显示“交互原型·无真实操作”、景区及打卡范围、工作人员、设备空闲与六项遥测、订单区域、今日数据。 | `evidence/iab/P00-workbench-normal.txt` | +| E01 | 顶部“收款码”按钮 | E | 首页有收款入口;未进入收款页,不能确认套餐选择及支付状态。 | 同 O01 | +| E02 | “查看全部”按钮 | E | 首页有完整订单入口;未验证目标页面、默认 Tab 及返回行为。 | 同 O01 | +| E03 | 已拍部分订单的“继续拍摄”按钮 | E | 初始首页有已拍 3 剩 2、已拍 2 剩 3 的“进行中”样例,设备此时空闲;未验证点击后去向。 | 同 O01 | +| E04 | 未拍订单的“开始拍摄”按钮 | E | 初始首页有已拍 0 剩 1 的“待拍摄”样例;未验证点击后去向。 | 同 O01 | +| E05 | 订单“查看素材”按钮 | E | 首页样例分别出现“上传中”“上传失败”与素材入口;未进入素材页,不能据此确认下载或重试流程。 | 同 O01 | +| E06 | “体验本页其他状态”入口及其面板 | E | 外部浏览器曾打开面板,面板说明仅切换当前页、正常操作自动推进;此后应仅使用内部浏览器继续核验。 | `evidence/01-workbench-state-menu.txt` | +| E07 | 面板中的 7 个状态选项 | E | 可见“设备空闲/无人机占用中/机巢未连接/无人机无信号/电量不足/设备状态未知/暂无拍摄订单”;除占用态外,本清单不将其算作已触发。 | 同 E06 | +| E08 | 面板中的“恢复正常体验”“从头体验整个流程” | E | 恢复、重置入口可见;未证明其状态清理、计次或跳转效果。 | 同 E06 | + +首页还观察到“我的拍摄订单 8”,但当前 DOM 仅列出 3 张订单卡,**不能据此断言全部 8 张订单已完整展示或可滚动到达**。今日数据展示了成交订单、成交金额、完成拍摄;这些是可见信息,不应直接算作新增业务状态。 + +## 3. 已实际触发的状态 + +| ID | 操作与结果 | 标签 | 已覆盖范围 | 未覆盖范围 | 证据 | +| --- | --- | --- | --- | --- | --- | +| T01 | 外部浏览器从状态面板切到“无人机占用中”,工作台设备标签显示“占用中” | T | 占用标签与六项遥测、原有订单卡及入口可见。 | 未点击 B 订单;不能确认准备页底部占用态、召唤禁用或原任务恢复。 | `evidence/02-workbench-busy.txt`、`evidence/02-workbench-busy.png` | + +外部浏览器证据仅保留为历史观察。用户明确改为内部浏览器后,后续触发、返回和恢复测试应全部从内部浏览器继续。目录中的其他临时文件不因存在就自动升级为已核验结果。 + +## 4. 逐页面待核验清单 + +以下是依据当前方案整理的**预期覆盖区域**,不代表原型一定按这些名称拆成独立页面。每行目前均为 U;“入口已观察”只引用第 2 节,不改变后续流程未验证的结论。 + +### 4.1 机巢工作台 + +| ID | 待核验状态/转移 | 应观察的结果 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| W01 | 内部浏览器打开并关闭状态面板、恢复正常、从头体验 | 面板不冒充 App 功能;恢复与重置的范围明确,不误扣次数或遗留旧任务。 | R03 | U | +| W02 | 机巢未连接、无人机无信号、电量不足、设备未知、暂无订单 | 每项实际切换后的标签、遥测、按钮、空态及恢复结果;设备低电量按上报许可,未知值不伪装实时。 | R02/R05 | U;菜单入口 E07 | +| W03 | 从已拍部分/未拍订单进入,再返回 | “继续拍摄”“开始拍摄”各自的目标;设备空闲与其他任务占用时行为是否不同。 | C07/C15、R01 | U;入口 E03/E04 | +| W04 | 当前订单存在执行中任务后返回工作台 | 原任务继续、订单置顶、原卡片右上任务状态、“查看当前任务”进入同一任务,无点位详情。 | C02–C06 | U | +| W05 | 0 次订单从首页退出 | 次数一到 0 即隐藏;不等待上传或返航结束;“查看全部”仍可找到。 | C10/C11 | U | +| W06 | 列表加载、失败、空数据、刷新及全部订单数量 | 不用正常占位数据冒充加载完成;“8”与实际条数/分页语义明确。 | 旧评审建议 | U | + +### 4.2 新收款页、套餐与支付结果 + +| ID | 待核验状态/转移 | 应观察的结果 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| P01 | 点击工作台“收款码” | 是否进入新增的支持选套餐收款页;入口、返回目标、页面结构。 | C20 | U;入口 E01 | +| P02 | 套餐未选择、选择、切换、恢复选择 | 套餐名称、价格、次数与收款展示同步;切换套餐后的旧收款信息如何处理。 | C20、旧评审建议 | U | +| P03 | 套餐加载、空、失败、已下架/原选择失效 | 可见提示、重试或重新选择;不得假设原型已经有这些分支。 | 旧评审建议 | U | +| P04 | 收款码生成中、可用、生成失败、失效/关闭 | 每态操作及恢复入口;二维码失效不能直接当成支付失败。 | 旧评审建议 | U | +| P05 | 待支付、支付确认中、明确失败、支付成功 | 状态来源、按钮、刷新/重试与防重复;模拟成功按钮应与实际支付结果区分。 | C16、旧评审建议 | U | +| P06 | 支付成功页停留及“我的拍摄订单”按钮 | 停留成功页,点击后进入订单列表并默认“待拍摄”,不自动打开准备页或召唤。 | C16/C17 | U | +| P07 | 收款中返回、切套餐、重复点击、重进 | 原收款会话与选择怎样保留或关闭;结果未知时不能直接重复收款。 | 旧评审建议 | U | + +### 4.3 我的拍摄订单 + +| ID | 待核验状态/转移 | 应观察的结果 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| O10 | 工作台“查看全部”进入,切换全部/待拍摄/进行中/已完成 | 各 Tab 的实际归类、数量、空态、返回及滚动;支付成功入口另按 P06。 | C10/C15/C17 | U;入口 E02 | +| O11 | 已拍部分+剩余大于 0+无活跃任务 | 仍归“进行中”,可进入下一次准备。 | C15 | U | +| O12 | 0 次+上传中/上传失败/上传完成 | 均在“已完成”,素材状态单独显示;不回首页。 | C10/C12 | U | +| O13 | 0 次+返航中 → 任务结束 | 已完成卡片临时有“查看当前任务”,进入原任务;结束后去掉临时入口。 | C11 | U | +| O14 | 订单“查看素材”“交付成片” | 查看素材入口与禁用状态;交付成片只记录原型行为,事件仍待用户补充。 | C13、U01 | U | + +### 4.4 拍摄准备 + +| ID | 待核验状态/转移 | 应观察的结果 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| R10 | 首次无选择、选点、选航线、切点、切回原点 | 本页直接选;点线联动;恢复有效选择,不按同名错误恢复。 | R01 | U | +| R11 | 点位已拍过、重复同点或换航线 | 仍可选择;订单与点位累计次数分别显示。 | R01/R04 | U | +| R12 | 范围外、定位未知/未授权/关闭/失败/过期 | 可浏览,召唤禁用并给实际原因;不编造距离。 | R01、旧评审建议 | U | +| R13 | 点位/航线无数据、加载失败、原选择失效 | 清空失效选择、明确空态/重试,不能召唤。 | R01 | U | +| R14 | 设备空闲、其他任务占用、本订单执行中、未知、不可执行 | 底部设备标签及主操作对应;A 任务占用时 B 可准备但不可召唤;本订单任务则查看当前任务。 | C07、R02 | U | +| R15 | 无点位、无航线、0 次、断连、许可不足等组合阻断 | 禁用原因明确,不只凭连接或电量判定空闲可执行。 | R02/R04 | U | +| R16 | 召唤提交中、明确失败、超时未知、成功 | 防重复及切换;失败保留选择;未知先同步;确认建立任务后才进入前往态。 | R02/R03 | U | + +### 4.5 拍摄任务、指令与异常 + +| ID | 待核验状态/转移 | 应观察的结果 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| T10 | 前往 → 到达待拍 → 提交开始 → 拍摄中 | 到达前不能开始;点击不等于设备确认执行;阶段真实推进。 | R02/R03 | U | +| T11 | 点击紧急暂停、处理中、确认暂停、失败/未知 | 直接提交、不弹确认;确认后才显示悬停。 | C19 | U | +| T12 | 拍摄暂停 → 恢复,恢复处理中/拒绝/未知/成功 | 保持同一任务,反馈完整;不误开始新一次或再次扣次。 | R03、旧评审建议 | U | +| T13 | 主动立即返航,返航处理中/拒绝/未知/开始返航 | 只记录原型是否弹确认;用户对此尚未回答,不能标为方案已确认。 | U02、R03 | U | +| T14 | 返航暂停 → 恢复返航 | 暂停前阶段保留;恢复不误续拍。 | C05、旧评审建议 | U | +| T15 | 成功弹窗 → 关闭常驻任务页/稍后返回 | 结果与返航独立、保留素材入口;返回不取消,不重发,不重复扣次。 | C02/C06、R03 | U | +| T16 | 失败但仍返航 → 设备可用 → 重新准备拍摄 | 返航未完不能重召;恢复可用后回准备页保留有效选择,再人工确认。 | C09、R03 | U | +| T17 | 仅图传断流 → 重连 | 画面与控制、任务状态分开,不将断流判整个任务失败。 | R05 | U | +| T18 | 手机断网 → 连接恢复 → 原任务同步 | 六项读数“—”、无法发送操作置灰;同步后恢复同一任务,不自动重发。 | R03/R05 | U | +| T19 | 保护性返航、拍摄结果待确认、成功/失败迟到 | 显示设备原因;结果与飞行独立,不由返航直接判结果或扣次。 | R03/R04 | U | +| T20 | 每条指令重复点击、明确拒绝、长期未知、旧事件迟到 | 不重复提交/建任务;失败与未知分开;终态不被旧状态覆盖。 | R03、旧评审建议 | U;部分需 A | + +### 4.6 素材、预览、下载与本机保存 + +| ID | 待核验状态/转移 | 应观察的结果 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| M10 | 从订单/任务打开素材;上传中刷新、无素材、上传失败 | 待上传不误报无素材,无虚构进度;失败提示与恢复操作如实记录。 | R06 | U;入口 E05 | +| M11 | 按拍摄记录分组、点位筛选、素材预览与返回 | 观察原型实际支持的分组/筛选/预览类型及选择保留情况。 | R06 | U | +| M12 | 部分就绪+部分上传中,单选、全选、刷新新增就绪项 | 仅就绪可选可下;全选数量一致;未完成项不可选。 | C13 | U | +| M13 | 下载所选、逐项进度、全成功、部分失败、全失败 | 逐项与批次结果一致,已保存与失败分开,重试仅失败/未完成项。 | R06 | U | +| M14 | 下载中离开页面、返回、切后台/锁屏、回前台继续 | 离页保留成功项;后台暂停,前台手动继续,未完成单文件可重下,不承诺断点。 | C14、R06 | U;生命周期需 A | +| M15 | 下载成功但保存相册中/失败;相册拒权/恢复权限 | 只有实际保存成功标“已保存”;授权失败不伪装成功,已有选择可恢复。 | R06、旧评审建议 | U;权限需 A | +| M16 | 链接失效、素材删除、存储不足、下载中断与重试 | 逐项原因和重试范围;不导致新的拍摄或次数变化。 | 旧评审建议 | U;部分需 A | +| M17 | 已保存项再次进入/换设备 | 不把云端下载状态当本机已保存;本机记录与游客交付分开。 | R06、旧评审建议 | U;跨设备需 A | + +## 5. 跨页面组合与恢复验收 + +| ID | 组合场景 | 应检查的完整链路 | 基线 | 状态 | +| --- | --- | --- | --- | --- | +| X01 | A 任务执行中,返回工作台,打开 B 订单 | A 继续;B 选点线但占用禁召唤;返回后能查看原 A。 | C02/C04/C07 | U | +| X02 | 最后一次成功,0 次,仍返航,素材上传中 | 首页移除 → 已完成卡片有任务入口 → 原返航任务;上传继续,不开放新拍摄。 | C06/C10–C12 | U | +| X03 | 成功但额度暂未同步/结果待确认 | 不误开放下一次、不同步旧次数为实时值,确认结果只结算一次。 | R04、旧评审建议 | U;需接口 A | +| X04 | 当前无任务,订单部分已拍 | 首页仍未完成;订单 Tab 为进行中;开始下一次准备,不误当活跃任务。 | C15 | U | +| X05 | 正在执行时返回、冷启动/恢复连接后重进 | 首页正常启动 → 当前景区工作台同步 → 查看原任务;不自动跳、不重建。 | C02/C08、R03 | U;冷启动需 A | +| X06 | 执行中切 A→B 景区,再切回 A | 允许切换;B 只展示当前景区订单;A 任务继续,切回恢复原任务入口。 | C18 | U;原型无景区入口时列 A | +| X07 | 明确失败且可用后重新准备 | 同一订单恢复有效选择 → 召唤新一次;失败不扣,重进不自动召唤。 | C09、R04 | U | +| X08 | 收款成功 → 我的拍摄订单 → 新订单 → 准备 | 成功页停留,入口默认待拍;按订单进入,不直接召唤。 | C16/C17/C20 | U | +| X09 | 部分素材就绪 → 批量下载 → 暂停 → 手动继续 | 未就绪不选;已保存不重下;未完成单文件重下;不修改次数。 | C13/C14、R06 | U;后台需 A | +| X10 | 指令/完成事件重复、结果乱序、多手机并发 | 不重复建任务或扣次;已确认结果不被旧事件覆盖;不自定权威结果。 | R03/R04、旧评审建议 | U;必须接口 A | + +## 6. 补齐后才能形成最终结论 + +- 只有 O01/T01 及 E01–E08 有当前证据;尚未完成收款、订单、准备、任务、素材任一完整往返链路。 +- 内部浏览器控制超时是当前核验阻塞,不代表产品原型缺少这些状态或入口。 +- 恢复内部浏览器控制后,先跑一条正常全链路,再逐页穷举状态面板,并补失败、返回、恢复与组合链路;分别记录“正常推进可达”和“仅模拟器可预览”。 +- 对无法用网页原型重现的锁屏、后台、杀进程、系统相册权限、真实任务并发,保留为 App 验收项,并明确“原型未验证”;不因菜单里出现对应文字就当作实现。 +- 最终双向对比应分别列:共同覆盖、原型相对当前方案新增、当前方案需要补进原型、两边冲突待取舍、接口/真机待验证。仍待补充的交付成片与主动返航确认不能擅自定案。 diff --git a/docs/9.9.1/review/product-comparison/随心瞰9.9.1-产品原型与当前方案对比.md b/docs/9.9.1/review/product-comparison/随心瞰9.9.1-产品原型与当前方案对比.md new file mode 100644 index 0000000..62a2930 --- /dev/null +++ b/docs/9.9.1/review/product-comparison/随心瞰9.9.1-产品原型与当前方案对比.md @@ -0,0 +1,208 @@ +# 随心瞰 9.9.1:产品交互原型与当前方案对比 + +日期:2026-10-22
    +产品原型:
    +范围:商家 App 的机巢工作台、套餐收款、拍摄订单、拍摄准备、任务控制、素材与下载。 + +**后续补充:已在同一内部浏览器标签页重新跑过非支付流程。** 连续步骤、42个非支付菜单状态、正常拍摄生成本次素材并下载、混合上传状态及恢复截图,单独见[非支付流程复跑记录](非支付流程复跑记录.md)。后续补证优先参考这份记录。 + +## 1. 结论与使用方式 + +**两边的主要业务阶段基本一致。本次最大的新增开发范围是“支持选择套餐的新收款页面”;最大的差异集中在任务离页、当前任务卡片、0次订单入口、支付后默认Tab。** 原型把收款、素材选择和异常恢复的交互细节表现得更具体;当前方案对任务恢复、结果待确认、原生生命周期和跨景区组合考虑得更完整。 + +本次通过**内部浏览器实际点击**页面入口、主流程及各页的状态预览按钮,保存了DOM记录和代表性截图。没有修改App业务代码,没有真实支付、控制真实无人机或上传游客文件。原型明确标注“交互原型·无真实操作”。 + +比对优先级:**你最新明确确认的规则 → 原需求和附件README → 尚未确认的评审建议 → 本次原型观察**。原型与已确认规则不同的地方,本文保留当前规则并列出差异;不会自动用原型覆盖。 + +证据分为三种: + +| 标记 | 含义 | +| --- | --- | +| 实走 | 从页面按钮操作,观察到实际演示转移;仍不是后端或真机验证 | +| 预览 | 通过“体验其他状态”选择并实际看到目标页;证明界面存在,不证明真实触发条件或协议已经实现 | +| 待联调/真机验证 | 原型未提供入口,或网页无法证明;不能直接断言真实产品缺少该能力 | + +“体验其他状态”、设备尺寸选择、模拟扫码按钮均为原型测试工具,不是要加入App的功能。页面过渡会保留历史DOM,本文按当前可见页面判断,不把隐藏的旧页面当成重复界面缺陷。 + +完整确认依据见 [当前方案基线](current-baseline.md);详细体验记录见 [收款与工作台](payment-verified.md)、[准备与任务](flight-verified.md)、[订单与素材](materials-verified.md)。 + +## 2. 已体验的流程及覆盖边界 + +| 流程 | 本次实际体验 | 覆盖边界 | +| --- | --- | --- | +| 工作台 | 空闲、占用、机巢未连接、无人机无信号、低电量、未知、暂无订单逐项预览 | 真实遥测时效和执行许可需接口验证 | +| 套餐收款 | 未选 → 选择套餐 → 生成中 → 等待支付 → 模拟支付 → 成功停留 → 查看订单/继续收款;另测金额校验、刷新、记录、保存码反馈 | 无真实支付;保存码只提示演示成功,未写相册 | +| 收款异常 | 生成失败→重新生成;码失效;暂无可售套餐→选择弹层空态 | 套餐加载失败、支付结果未知等没有入口 | +| 拍摄订单 | 全部/待拍摄/进行中/已完成;无分配订单空态;从订单进入准备和素材 | 样例数据不代表真实分配、分页、权限或退款规则 | +| 拍摄准备 | 点位与航线联动、切回恢复;9种状态;正常召唤进入原任务 | 定位授权、选择失效、并发抢占需联调/真机补验 | +| 拍摄任务 | 到达、开始、暂停、恢复、拍摄成功、返航;任务异常与结果弹窗逐项预览 | 设备确认、乱序、重试幂等不由动画证明 | +| 素材 | 上传中/就绪/失败、预览、单选/全选、筛选、批量下载、完成、失败重试、离页处理、相册拒权演示 | 后台锁屏、真实相册权限和文件保存仍需真机 | + +原型可见状态共覆盖**6组、49个命名状态**:工作台7、收款7、订单2、准备9、任务13、素材11。这里按页面菜单口径计数,包含不同页面重复出现的设备状态;每项通过正常流程或状态预览到达,**不是49个互斥业务状态,也不是所有组合都通过了真实接口验证**。 + +**没有把网页原型可点击状态当成全部业务组合均已验收。** 冷启动、后台暂停下载、跨景区恢复、指令重复/乱序、真实交易结果等,单列为后续App验收项。“交付成片”按你此前要求继续跳过事件;只记录入口,未擅自确定交付方式。 + +## 3. 新增套餐收款页面应该怎样补进方案 + +### 3.1 原型实际主流程 + +```text +机巢工作台 → 收款码 → 收款详情 + → 未选套餐(设置金额、保存码禁用) + → 打开套餐单选弹层 → 选中 → 确认 + → 生成中 → 有效演示码/等待游客支付 + → 模拟支付处理中 → 收款成功(停留) + ├─ 继续收款 → 清空本次套餐和码,重新选套餐 + └─ 查看订单 → 我的拍摄订单 +``` + +原型“查看订单”默认进入**全部**;合并方案应按你已确认的C17改为**待拍摄**。 + +### 3.2 页面状态与操作 + +| 状态 | 原型表现 | 建议纳入App方案 | +| --- | --- | --- | +| 未选择套餐 | 请选择;选择后生成对应套餐收款码;金额/保存禁用 | 明确作为新收款页初态,不直接请求旧的普通收款码 | +| 套餐选择中 | 当前景区套餐单选;未选时确认禁用;显示名称、价格、含几次 | 名称、价格、次数来自接口,不能硬编码样例 | +| 无可售套餐 | 弹层“暂无可售套餐”,联系管理员在Web配置 | App展示空态即可,不加入套餐管理功能 | +| 生成收款码中 | 加载提示;设置金额、保存禁用 | 防重复;本次码必须对应当前套餐与金额 | +| 等待支付 | 套餐、次数、成交价、二维码;刷新状态 | 刷新没有结果时仍等待,不自行判断失败或再次开单 | +| 生成失败 | 重新生成;保存禁用 | 生成失败与支付失败分开 | +| 码已失效 | 重新生成;保存禁用 | 不能继续把失效码当有效码保存或展示 | +| 支付处理中 | 模拟按钮禁用并加载 | 原型只证明加载反馈;真实交易结果仍以权威查询为准 | +| 收款成功 | 成功、订单归属示例、继续收款/查看订单 | 保留成功页;订单按钮去待拍摄,属于已确认行为 | +| 开始下一笔 | 清空旧套餐/金额/码,再选择套餐 | 建议明确重置边界,避免沿用上笔成交信息 | + +套餐样例为单次99元/1次、三次259元/3次、五次399元/5次,仅用于体验。原型允许设置成交价,明确写着**修改金额不改变套餐拍摄次数**;这是本次得到的产品交互细节,建议补入新页面规格,尚不能当作真实接口已经支持。 + +更换套餐弹层中选择后再取消,原套餐和成交价保持不变;确认改选单次套餐后,页面改为单次/1次/99元,不沿用原三次套餐手动设置的199.99元。页面联动已经验证,服务端旧码是否失效及旧码晚支付仍需接口明确。 + +金额0的实测会提示“大于0、最多两位小数”;备注有200字计数。此类金额校验和备注能力在现有App已有,不应重复算作全新业务。 + +### 3.3 现有能力与新增范围 + +| 已有App能力,可评估复用 | 9.9.1真正新增/需要扩展 | +| --- | --- | +| 二维码绘制、金额与备注校验、相册保存、收款信息、收款记录、到账语音开关、线下收款登记 | 新套餐收款页面、当前景区可售套餐选择、套餐/次数/成交价与码一致、单笔交易结果、成功后订单入口、下一笔重置 | + +现有收款码接口只表达`scenic_id`和静态/动态URL,没有在当前请求模型中表达套餐和单笔交易状态。**不能仅复用旧URL或给它拼接一个套餐字段就认为完成套餐收款。** 具体扩旧接口还是新增接口由后端对接决定;App需要的是可售套餐、套餐收款请求、交易结果与订单标识等信息。 + +旧代码的只读核对及定位见 [现有收款能力与新增边界](payment-existing-vs-new.md)。原型“线下收款登记”明确标注本次不调整;Web套餐管理及订单归属算法不加入你的App开发范围。 + +## 4. 原型给当前方案补充了什么 + +这里区分“新增范围”和“原有状态的交互细化”,避免将我们已经考虑的状态再次列为遗漏。 + +| 补充点 | 当前方案此前情况 | 原型带来的具体补充 | 合并建议 | +| --- | --- | --- | --- | +| 独立套餐收款页 | 你本次已明确新增;旧的直接复用假设已失效 | 先选套餐,再生成码的完整页面 | 纳入本版开发范围 | +| 改成交价不改次数 | 旧App有金额功能,套餐联动未细化 | 弹层明确不改套餐权益 | 补充新页面规则,金额与权益分别展示 | +| 连续收款 | 旧讨论只明确成功停留及订单入口 | 成功页“继续收款”,清空本次选择 | 补充下一笔初态,避免把旧码沿用到新交易 | +| 空套餐与码异常 | 旧状态清单已有空/失败/失效候选值 | 有明确空态、生成失败/失效的重新生成入口 | 用原型补齐界面和恢复动作,不称为此前完全没有考虑 | +| 已拍部分订单文案 | 已确认仍属进行中 | 没有活跃任务时显示“继续拍摄”,进入准备 | 可作为普通进行中订单文案;活跃任务仍用“查看当前任务” | +| 素材筛选与选择 | 原稿已有分组、筛选、选择 | 最新拍摄记录在前;切点位筛选清空选择;下载中禁止修改筛选与选择 | 建议将这些细节补进素材页规格,避免隐藏选择造成数量不清 | +| 批次下载反馈 | 已有部分成功、失败重试原则 | 逐项进度、已保存/失败区分、批次汇总和仅失败项重试 | 将原型表现补入状态图和验收描述 | +| 相册拒权恢复 | 旧评审已考虑权限失败 | 原型提供去设置及返回后的演示恢复 | 保留真实权限检查;不把模拟跳转当作iOS授权已完成 | +| 上传失败操作 | 旧方案有上传失败,但操作边界仍需接口支持 | 素材项有“重试上传”,演示后恢复 | 作为产品参考单列;需明确这是重试原拍摄素材传输,不是App从相册新增上传,更不增加拍摄次数 | + +原型同时出现订单级、拍摄记录级及下载完成区域的“交付成片”入口。这里只记录入口位置;其点击事件继续等待你以后补充,不按原型替你定案。 + +## 5. 原型与已确认方案的差异 + +以下差异优先保留你的已确认规则。涉及状态预览构造的组合,明确写出条件,不将其伪装成真实设备完整链路。 + +| 场景 | 原型实际表现 | 当前已确认方案/应保留行为 | 证据 | +| --- | --- | --- | --- | +| 支付成功→查看订单 | 默认全部Tab | 默认**待拍摄**Tab(C17) | [P10](evidence/payment2/P10-payment-orders-default-all.txt) | +| 执行中任务点击返回 | 弹“任务仍在执行”的离开确认;离开后按进入栈回准备,需再返回到工作台 | **直接回机巢工作台,不确认**;原任务继续(C02) | [F24](evidence/flight2/F24-return-workbench-zero.txt) | +| 活跃任务订单卡 | 另从第三张139订单实走到达后返回,仍有3次,活跃卡仍在第3张;按钮“继续查看任务”,未显示右上任务阶段 | 保留旧紧凑卡;**查看当前任务+右上角阶段标签**;有余次数时置顶(C03–C05) | [有余次数活跃卡](evidence/flight2/F61-home-third-active.txt)、[截图](evidence/flight2/F61-home-third-active.png) | +| 最后一次成功、0次仍返航 | 实际拍摄已扣至0,再固定返航预览后返回:订单仍留工作台;已完成Tab中也已有可恢复原任务的入口 | **立即移出首页**;保留已完成卡的临时任务入口,飞行结束后移除(C10/C11) | [工作台记录](evidence/flight2/F26-home-zero-returning.txt)、[已完成入口](evidence/flight2/F28-completed-task-entry.txt) | +| 明确失败、设备可用后的重试 | 按钮写“重新召唤无人机”,实际点击回准备页、保留选择,需要再次人工确认召唤 | 行为符合C09;按钮改为**重新准备拍摄**,避免让人以为会直接起飞 | [重试去向](evidence/flight2/F43-retry-destination.txt) | + +任务“成功”和无人机“返航”本身可以同时成立;问题在于订单入口放在哪里,而不是要求等返航后才完成订单。上传中也不阻止订单进入已完成。 + +另已实走:紧急暂停直接提交,显示处理中后确认暂停;返航时暂停、继续任务并最终回巢,未扣次数,但没有抓到恢复后短暂返航的中间帧;开始指令超时先显示执行结果待确认,刷新同步到原任务。它们与当前原则一致。原型主动“立即返航”直接发送、不确认,但该问题仍未得到你的回答,不以原型行为直接定案。详见任务记录。 + +## 6. 当前方案需要补进原型或保留到App验收的状态 + +这些是原型本次没有完整表达/没有提供可达入口的部分,并不等于真实产品或后端一定没有能力。 + +| 状态/组合 | 当前方案已有要求 | 本次原型的覆盖边界 | 合并后的要求 | +| --- | --- | --- | --- | +| 活跃任务的7种卡片提示 | 前往拍摄点中/已到达,待拍摄/拍摄中/拍摄已暂停/返航中/返航已暂停/任务状态待确认 | 任务页有阶段预览,卡片未完整展示该套标签 | 在原卡右上角补齐;不加点位航线详情块 | +| 0次+返航+素材上传 | 首页移除、已完成保留任务入口,素材独立 | 原型的首页处理与确认规则不同 | 作为高优先级组合验收,不把全部状态合成一个“进行中” | +| A任务占用、打开B准备 | 可选点线,底部占用、召唤禁用;无排队 | 已实走139任务到达→返工作台→打开136准备,仍可切航线,召唤禁用;与确认规则一致 | 保留该链路;真实并发和点击时资格需接口验证 | +| 冷启动恢复 | 正常首页,进当前景区工作台同步,再手动进原任务 | 没有真实App杀进程流程 | 不自动跳任务、不重建、不重发指令 | +| 执行中切换景区 | 允许切换,A任务继续,B只展示B订单,切回A恢复入口 | 本次没有景区切换入口 | 保留C18,按景区隔离上下文 | +| 拍摄暂停与返航暂停 | 两种暂停不同,恢复到原阶段 | 返航时暂停→继续→最终回巢已实走;未抓到恢复后的短暂返航帧;页面统一暂停文案 | 卡片按暂停前阶段显示拍摄/返航暂停;真机补验恢复阶段 | +| 每条指令的处理中/拒绝/未知 | 召唤、开始、暂停、恢复、返航分别有状态 | 有加载/超时演示,未逐条覆盖所有结果 | 请求发出不代表设备执行;未知先同步原任务 | +| 选择未知/失效 | 无可信位置、定位拒权、旧点线失效时禁召唤 | 有范围外、无航线,不足以证明全部定位和配置变化 | 清失效项,说明原因,不能用默认有效数据代替 | +| 前台下载方案 | 切后台或锁屏暂停;回来手动继续;已保存不重下 | 网页离页弹窗不等于App后台暂停 | 保留C14;未完成单文件可重下,不要求字节断点 | +| 部分就绪+部分仍上传中 | 就绪项先可选可下,上传中项不可选 | 后续非支付复跑已补验:2项上传中、3项就绪、1项失败,全选只选3项 | C13页面组合已有证据;实际文件与权限仍需真机,见[本轮混合状态](nonpayment-rerun/50-mixed-select-eligible-only.txt) | +| 下载成功但相册写入失败 | 真实保存成功才标本机已保存 | 下载和权限为演示 | 分开下载、保存和批次结果,真机验证 | + +## 7. 双方都还需要补齐的异常 + +这些大多在旧评审中已经作为候选缺口提出。现在应转成开发前的接口信息或验收条件,不继续把后端职责变成需要你逐项拍板的业务问题。 + +| 区域 | 建议补齐的状态/转移 | App需要落实的边界 | +| --- | --- | --- | +| 页面数据 | 首次加载、刷新、请求失败、空数据、无权限/原订单不可访问 | 空数据与加载失败分开;重试不重复创建业务 | +| 套餐与码 | 套餐列表失败、选择后下架/价格变化、生成码时切套餐、旧请求晚返回 | 屏幕套餐、成交价、权益和码必须一致;过时响应不能覆盖当前选择 | +| 支付与订单 | 结果确认中/未知、查询失败、旧码迟到支付、重复成功通知、支付成功但订单暂未查询到 | 先查权威结果;保留成功事实和可恢复入口,不直接重复收款 | +| 任务与结算 | 指令拒绝/超时后仍执行、重复完成事件、旧事件乱序、多端同时操作 | 接口给任务标识与权威状态;App不重复召唤、不自行扣次 | +| 失败与返航 | 部分拍摄、任务中断、失败仍返航、保护返航后结果晚到 | 结果与飞行独立;明确成功才更新次数;不因返航自行定结算 | +| 连接 | 控制通道断开、重连中、同步失败、长时间无法确认、遥测过期 | 图传、手机网络、控制及数据时效分开;不将上次数据伪装实时 | +| 素材 | 暂无任何就绪项、最终上传失败、链接过期、文件删除、存储不足、相册保存失败 | 原因与可恢复动作分别表达;重试只针对失败/未完成项 | + +## 8. 合并后的状态分类与可能取值 + +沿用之前的**10类状态维度**,补入套餐收款细节。以下是中文需求值,供App设计与联调使用,**不是已经确定的接口枚举**。同一时刻可以从不同维度各取一个值,不能只靠一个总状态驱动整个页面。 + +| 类别 | 可能的值/子维度 | 来源与注意 | +| --- | --- | --- | +| 1. 套餐与选择 | 列表加载中/可选/空/失败;未选/已选/选择失效 | 新页面范围已确认;加载失败、失效是待补建议;上架下架管理在Web | +| 2. 收款与支付 | 码未生成/生成中/可用/生成失败/失效;交易待支付/确认中/成功/明确失败/结果未知/关闭 | 原型覆盖主要码状态与成功;支付失败、未知、关闭不能因码失效而推断 | +| 3. 订单进度 | 待拍摄/进行中/已完成;列表加载/空/失败 | 进行中表示部分已拍仍有余次;0次进已完成,不等待返航和上传 | +| 4. 拍摄准备 | 点位航线未选/有效/失效/无配置;位置获取中/可用/未知/不可用;范围内/外/未知 | 一次一个点+一条线;可浏览不等于可召唤 | +| 5. 无人机与执行许可 | 空闲/本订单占用/其他任务占用/未知/不可执行;连接、地面/飞行阶段分别表达 | 低电量按设备许可,不用原型18%硬编码阈值 | +| 6. 拍摄任务与结果 | 前往/到达待拍/拍摄中/拍摄暂停/返航/返航暂停/执行结束/待确认;结果未产生/待确认/成功/失败/中断 | 阶段与结果分开;成功但返航仍有当前任务入口 | +| 7. 操作指令 | 未发起/处理中/已确认/明确失败或拒绝/结果未知;是否允许本操作 | 分别用于召唤、开始、暂停、恢复、返航;紧急暂停直接发,等设备确认 | +| 8. 连接与同步 | 手机在线/离线;控制连接正常/中断/恢复中;画面正常/断流/重连;状态同步中/成功/失败,遥测有效/过期 | 图传断流不代表控制失效;手机断网六项为“—” | +| 9. 次数与结算 | 尚可拍/已用完/待同步或待确认;本次未结算/待确认/已结算;订单总计与各点累计 | 由权威成功结果更新一次;进入、召唤、失败、下载均不扣次数 | +| 10. 素材与交付 | 待生成/上传中/部分就绪/全部就绪/上传失败;未选/部分选/全选可下项;待下/下载中/暂停或未完成/失败/下载完成/保存中/本机已保存/保存失败;批次部分成功/全成功/失败 | 已保存≠游客已收到;“交付成片”事件和交付状态取值继续待你补充 | + +必须能同时表达的例子: + +- **已完成订单+剩余0次+拍摄成功+无人机返航+素材上传中**:首页不显示;已完成卡可查看当前任务和素材。 +- **进行中订单+还有次数+无人机空闲**:表示套餐用了一部分,可进入下一次准备,不是正在飞行。 +- **B订单准备完成+A任务占用**:B可选点线,底部占用,召唤禁用。 +- **部分素材就绪+部分上传中+部分下载失败**:就绪项可选、上传项不可选,重试只处理失败项。 + +## 9. 开发前建议采用的处理顺序 + +1. **更新规格中的确定项**:新增套餐收款页;保留你已确认的任务返回、卡片、0次订单规则和支付后待拍入口。 +2. **吸收原型细节**:套餐弹层、码状态与恢复、改价不改次数、继续收款重置、素材筛选与下载反馈。来源标为产品参考,避免当成已完成接口能力。 +3. **拿到接口信息后落状态模型**:套餐与码绑定、交易结果与订单、任务与指令结果、剩余次数、素材状态和下载链接。后端如何分配订单仍由后端负责。 +4. **补组合状态截图与验收**:0次返航入口、A占用B准备、拍摄/返航两种暂停、指令待确认、支付未知、后台暂停后手动继续。 +5. **保留两项未定事项**:“交付成片”点击事件;“立即返航”是否二次确认。本次继续暂停逐题提问,不替你作答。 + +## 10. 证据与附录 + +- [当前方案基线:C01–C20、原稿规则、未定事项](current-baseline.md) +- [收款与工作台逐项记录](payment-verified.md) +- [拍摄准备与任务逐项记录](flight-verified.md) +- [订单与素材逐项记录](materials-verified.md) +- [现有App收款能力的只读核对](payment-existing-vs-new.md) + +代表性实际截图(网页原型): + +![非支付复跑:普通按钮进入拍摄中](nonpayment-rerun/07-shooting.png) + +![非支付复跑:混合上传时只选就绪的3项素材](nonpayment-rerun/50-mixed-select-eligible-only.png) + +![套餐收款成功:停留页面,提供继续收款与查看订单](evidence/payment2/P11-success.png) + +另见[0次返航订单仍留首页的实际截图](evidence/flight2/F26-home-zero-returning.png)、[素材部分下载失败的实际截图](evidence/materials2/M40-download-failure.png)。 + +旧横向截图、旧Word状态清单没有在本次任务中重新导出;本报告与当前方案基线记录了后续确认和本次产品比对,应优先作为下一轮调整依据。 diff --git a/docs/9.9.1/review/product-comparison/非支付流程复跑记录.md b/docs/9.9.1/review/product-comparison/非支付流程复跑记录.md new file mode 100644 index 0000000..40accbb --- /dev/null +++ b/docs/9.9.1/review/product-comparison/非支付流程复跑记录.md @@ -0,0 +1,120 @@ +# 随心瞰9.9.1 非支付流程复跑记录 + +日期:2026-10-22。原型:。 + +本轮由主代理在**同一个内部浏览器标签页**重新操作订单、拍摄和素材流程,补留连续步骤与截图。本轮没有进行支付测试,没有修改App代码。“交付成片”事件仍按你此前要求跳过。 + +本轮保存111份DOM记录、56张浏览器截图;其中包括5组页面的42个命名状态。下面先列普通按钮的连续链路,再列通过状态菜单构造的异常与恢复。**网页演示不等于真实飞行、真实相册保存或真机后台测试。** + +## 1. 普通按钮连续跑通:订单→准备→拍摄→本次素材→下载 + +这条链路从游客136****2806的单次订单开始,没有用状态菜单跳过拍摄成功或制造本次素材。 + +| 步骤 | 本轮实际操作与结果 | 记录 | +| --- | --- | --- | +| 1 | 工作台点单次订单“开始拍摄”;初始已拍0、剩余1 | [01](nonpayment-rerun/01-workbench.txt) | +| 2 | 切换到金阙云宫,航线由8条切成3条;选择金顶渐远 | [02](nonpayment-rerun/02-preparation-point-route.txt) | +| 3 | 确认并召唤,进入本订单任务,显示“无人机已到达” | [03](nonpayment-rerun/03-arrived.txt) | +| 4 | 实点紧急暂停;工具观察到“正在暂停/尚未确认悬停”,随后“无人机已暂停” | [05 已暂停](nonpayment-rerun/05-paused.txt);处理中是瞬时工具观察,04落盘时已暂停 | +| 5 | 点继续任务,先等待设备确认,再恢复到已到达待拍 | [06](nonpayment-rerun/06-resumed-arrived.txt) | +| 6 | 点开始拍摄,先启动处理中,再显示正在拍摄 | [07](nonpayment-rerun/07-shooting.txt) | +| 7 | 自动到达拍摄成功弹窗;点稍后再去,结果常驻,最终显示无人机已返回机巢 | [08](nonpayment-rerun/08-shoot-success-popup.txt)、[09](nonpayment-rerun/09-completed-returned.txt) | +| 8 | 从结果页点查看素材,进入这个订单本次产生的拍摄记录;已拍1、剩余0 | [10](nonpayment-rerun/10-new-shoot-materials-entry-ready.txt) | +| 9 | 刷新素材状态,本次素材01可预览、可下载 | [11](nonpayment-rerun/11-new-shoot-material-ready.txt) | +| 10 | 打开并关闭本次素材预览,选中这1项 | [12](nonpayment-rerun/12-material-preview.txt)、[13](nonpayment-rerun/13-selected-new-material.txt) | +| 11 | 点下载所选素材,显示1项下载,最终为下载完成及已下载标记 | [14](nonpayment-rerun/14-new-material-download-completed.txt) | +| 12 | 返回准备页,剩余0,召唤禁用;再回工作台,该已回巢的0次订单已移除,未完成数量8→7 | [15](nonpayment-rerun/15-quota-zero-preparation-blocked.txt)、[16](nonpayment-rerun/16-home-after-normal-completion.txt) | +| 13 | 查看全部并切全部/待拍摄/进行中/已完成;本单进入已完成,数量变5 | [已完成](nonpayment-rerun/17-orders-已完成.txt) | + +这里实际暂停发生在“已到达、尚未开始拍摄”阶段;没有把它写成拍摄中暂停。文中未单列记录的短暂处理中属于现场工具观察,没有独立截图。首次进入素材时工具曾显示等待文件列表,落盘10时已就绪,因此10不作为等待上传的截图证据。下载完成文案是网页模拟,未写入iOS相册。 + +![本轮普通按钮进入拍摄中](nonpayment-rerun/07-shooting.png) + +![本次新拍摄素材的模拟下载完成](nonpayment-rerun/14-new-material-download-completed.png) + +## 2. 普通按钮连续跑通:A占用→B准备→恢复A→主动返航 + +本轮A为游客139****5192,已拍2、剩余3;B为游客135****3092,已拍0、剩余5。 + +| 操作 | 可见结果 | 记录 | +| --- | --- | --- | +| 从A继续拍摄并确认召唤 | A到达,等待开始拍摄 | [18](nonpayment-rerun/18-A-order-arrived.txt) | +| A执行中点返回 | 弹“任务仍在执行”,选择离开后先回准备页,再返回才到工作台 | [19](nonpayment-rerun/19-active-return-confirm.txt)、[20](nonpayment-rerun/20-return-destination-preparation.txt) | +| 查看首页A卡片 | A仍排在其他订单后面,本轮是第2张;按钮“继续查看任务”,没有具体任务阶段标签 | [21](nonpayment-rerun/21-home-active-order-position.png) | +| 打开B并切航线 | 可以选环绕专线;底部占用中、召唤禁用 | [22](nonpayment-rerun/22-B-select-route-while-occupied.txt) | +| 返回后点击A的任务入口 | 仍是A原任务、原三皇寨+经典航线、已到达,没有新召唤 | [23](nonpayment-rerun/23-return-to-original-A-task.txt) | +| A点立即返航 | 直接发送,先显示尚未确认返航;结束后“本次拍摄已中断/无人机已返回机巢/本次未扣减拍摄次数” | [25](nonpayment-rerun/25-returned-without-deduction.txt) | + +原型的返回确认、返回准备页、未置顶及任务卡文案,与已确认方案的差异本轮再次复现。B准备的行为符合你确认的方案。主动返航是否采用二次确认仍未定,不因原型直接发送而替你定案。 + +![A占用时B仍可准备但不能召唤](nonpayment-rerun/22-B-select-route-while-occupied.png) + +## 3. 异常条件由菜单构造,恢复按钮实际点击 + +| 分支 | 本轮实际操作/结果 | 记录 | +| --- | --- | --- | +| 图传断流 | 画面中断但遥测、任务和控制保留;点重新连接画面,先连接中,最后恢复实时图像及拍摄中状态 | [断流](nonpayment-rerun/task-preview-画面断流.txt)、[恢复终态](nonpayment-rerun/58-feed-recovery-image-restored.txt) | +| 手机断网 | 六项“—”、任务待确认、指令禁用;点重新连接,经历同步,恢复后最终显示原任务成功及回巢 | [断网](nonpayment-rerun/task-preview-手机断网.txt)、[同步中](nonpayment-rerun/27-phone-sync-pending.txt)、[恢复后](nonpayment-rerun/57-phone-recovery-final-task.txt) | +| 保护性返航 | 显示电量不足的原因,拍摄结果仍待确认,不直接判失败 | [记录](nonpayment-rerun/task-preview-保护性返航.txt) | +| 失败但仍返航 | 保留失败原因,重试禁用 | [记录](nonpayment-rerun/task-preview-失败·返航中.txt) | +| 失败且设备可用 | 点“重新召唤无人机”,实际回准备页,已2剩3及原点线保留,需要再次人工确认 | [28](nonpayment-rerun/28-failure-retry-opens-preparation.txt) | +| 开始指令超时 | 先在菜单设置超时,再实点开始;显示执行结果待确认,禁止重复开始 | [29](nonpayment-rerun/29-start-result-unknown.txt) | +| 超时后刷新 | 实点刷新任务状态,先同步中,后续收到成功结果;没有再次点开始 | [30](nonpayment-rerun/30-sync-original-task.txt)、[31](nonpayment-rerun/31-after-sync.txt) | +| 失败弹窗 | 点确定关闭,仍留失败与返航限制,没有自动重试 | [32](nonpayment-rerun/32-failure-dialog-closed.txt) | +| 返航暂停与恢复 | 先固定返航条件,实点暂停,确认暂停后点继续;等待确认,最终回巢且未扣次 | [33](nonpayment-rerun/33-return-paused.txt)、[34](nonpayment-rerun/34-return-resume-outcome.txt) | + +这里只验证了**开始指令**超时,未泛化为每条指令均已验证。超时刷新后短暂拍摄阶段、返航恢复的短暂中间帧未全部抓到;记录了可见同步过程和最终结果。26、27分别只是重连/同步中,未将它们当作恢复完成证据,终态另用57、58。 + +![开始指令结果待确认,提供同步入口](nonpayment-rerun/29-start-result-unknown.png) + +## 4. 素材分组、筛选、上传与下载恢复 + +从进行中订单158****8888进入3次记录、6项素材的素材库,实际操作预览、筛选、选择和恢复。上传/下载异常使用菜单构造,之后实际点击对应恢复按钮。 + +| 场景 | 本轮结果 | 记录 | +| --- | --- | --- | +| 单项上传失败重试 | 点重试上传,提示已重新发起上传;该项先进入上传中 | [37](nonpayment-rerun/37-retry-upload-one.txt) | +| 按点筛选及全选 | 金阙云宫仅对应1次记录、2项素材;切回全部点位,当前选择清空 | [38](nonpayment-rerun/38-select-filtered-point.txt)、[39](nonpayment-rerun/39-filter-change-clears-selection.txt) | +| **部分仍上传+部分就绪** | 重置演示后快速从首页进入:2项上传中、3项就绪、1项失败;全选只选中3项就绪素材,上传和失败项均未选 | [49](nonpayment-rerun/49-initial-mixed-upload-state.txt)、[50](nonpayment-rerun/50-mixed-select-eligible-only.txt) | +| 下载中离页,选择继续 | 实际点返回弹确认;点继续下载留页,最终完成 | [41](nonpayment-rerun/41-download-leave-confirm.txt)、[42](nonpayment-rerun/42-continue-download-completed.txt) | +| 部分失败后仅重试失败 | 原1项成功、1项失败;点重试失败素材,**本次仅下载1项**,成功项保留;最后完成 | [43](nonpayment-rerun/43-retry-only-failed-file.txt)、[44](nonpayment-rerun/44-failed-file-retry-completed.txt) | +| 下载中离页,选择停止 | 点离开并停止返回订单;重进后已下载项保留,未完成项可重新选择 | [45](nonpayment-rerun/45-leave-stop-returns-orders.txt)、[46](nonpayment-rerun/46-reenter-retains-saved-items.txt) | +| 相册权限不足 | 暂不下载和去设置两条路径均实点;返回后保留选择。去设置仅网页模拟,未进入真实iOS设置 | [47](nonpayment-rerun/47-permission-settings-simulated-return.txt)、[48](nonpayment-rerun/48-permission-cancel-retains-selection.txt) | + +35实际是已就绪+上传失败,40实际已全部就绪;它们不用于证明“部分仍上传中”。该组合的证据专用49/50,避免把自动推进后的状态当成混合状态。 + +![上传中项没有选择按钮,全选只选择3项就绪素材](nonpayment-rerun/50-mixed-select-eligible-only.png) + +## 5. 0次但仍返航:跨页入口再次核验 + +本轮又通过普通按钮完成了一次单次订单的演示拍摄并将次数更新到0。[正常流程抓到的常驻结果](nonpayment-rerun/51-normal-success-final-state.txt)已是回巢;为了可稳定检查跨页,随后用“拍摄完成”菜单**固定成功+返航组合**。这一段明确属于预览条件下的跨页测试,没有当作连续真实设备回传。 + +| 操作 | 结果 | 记录 | +| --- | --- | --- | +| 固定成功+返航 | 成功结果、返航状态、安全控制同时存在 | [组合状态](nonpayment-rerun/zero-return-preview-拍摄完成.txt) | +| 返回工作台 | 0次订单仍在首页;与“立即移出首页”的确认规则不同 | [52](nonpayment-rerun/52-zero-return-still-on-home.txt) | +| 查看全部→已完成 | 本单已1剩0、上传中,保留“继续查看任务” | [53](nonpayment-rerun/53-completed-tab-task-entry.txt) | +| 点击任务入口 | 能进入同一订单的成功返航任务 | [54](nonpayment-rerun/54-completed-entry-restores-return-task.txt) | + +因此原型**已有已完成订单的临时任务入口**;应调整的是0次返航时首页移除和任务按钮文案。已回巢时首页移除的普通链路,本轮16另有实际证据,不能将两种飞行状态混为同一结果。 + +## 6. 本轮重新触发的全部42个非支付菜单状态 + +| 页面 | 数量 | 已逐项触发并核对的名称 | +| --- | --- | --- | +| 工作台 | 7 | 设备空闲、无人机占用中、机巢未连接、无人机无信号、电量不足、设备状态未知、暂无拍摄订单 | +| 我的拍摄订单 | 2 | 正常订单列表、暂无分配订单;另实际切换4个Tab | +| 拍摄准备 | 9 | 设备空闲、无人机占用中、机巢未连接、无人机无信号、电量不足、设备状态未知、不在拍摄范围、暂无可用航线、拍摄次数用完 | +| 拍摄任务 | 13 | 已到达、拍摄中、悬停、返航中、拍摄完成、失败·返航中、失败·可重试、画面断流、手机断网、保护性返航、拍摄完成弹窗、执行失败弹窗、体验指令超时 | +| 订单素材库 | 11 | 素材上传中、素材上传完成、素材上传失败、未选择素材、已选择素材、下载中、下载完成、下载失败、重试中、离开确认、相册权限不足 | + +完整文件索引见[本轮证据清单](nonpayment-rerun/manifest.json)。菜单有些设置会继承前一预览,例如0次仍无航线、空订单仍设备未知;本轮没有宣称每项状态经过独立隔离,也没有把42个页面菜单选项当成42个互斥业务状态。 + +## 7. 与当前方案对比后的本轮结论 + +- 再次复现的差异:任务返回有确认且先回准备;有余次的活跃卡未置顶、任务按钮和阶段标签不符;0次返航订单仍留首页。 +- 已有且应保留:失败后回准备而非直接起飞;A占用时B可准备不可召唤;已完成卡有未结束任务入口;只选就绪素材、只重试失败下载、离页保留已保存项。 +- 新补足的证据:**部分仍上传中+部分就绪+失败并存时,只选可下载项**;本次通过普通按钮完成的演示拍摄所产生的素材到模拟下载完成的连续链路;重连/同步终态与处理中分别留证。 +- 仍需App/真机或接口:后台锁屏暂停与手动继续、冷启动、跨景区恢复、真实定位/权限、每条指令拒绝或超时、乱序与并发、真实相册写入。交付成片事件与主动返航确认继续保留未定。 + +原双向比对报告见[产品原型与当前方案对比](随心瞰9.9.1-产品原型与当前方案对比.md)。本轮补充不改变此前已确认的App规则。 diff --git a/docs/9.9.1/review/regenerated-03/03-pause-return-full.png b/docs/9.9.1/review/regenerated-03/03-pause-return-full.png new file mode 100644 index 0000000..d181976 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/03-pause-return-full.png differ diff --git a/docs/9.9.1/review/regenerated-03/checks.json b/docs/9.9.1/review/regenerated-03/checks.json new file mode 100644 index 0000000..f600d84 --- /dev/null +++ b/docs/9.9.1/review/regenerated-03/checks.json @@ -0,0 +1,109 @@ +{ + "flowId": "03-pause-return", + "count": 6, + "scale": 2, + "states": [ + { + "id": "pause-pending", + "label": "请求暂停 · 等待确认", + "kind": "flight", + "mode": "pausing", + "caption": "暂停处理中不等于已悬停;安全操作按独立设备能力决定。" + }, + { + "id": "pause-confirmed", + "label": "拍摄已暂停 · 悬停", + "kind": "flight", + "mode": "paused", + "caption": "保留原任务身份与拍摄结果;未确认成功不扣次数。" + }, + { + "id": "resume-pending", + "label": "请求恢复原阶段", + "kind": "flight", + "mode": "resuming", + "proposed": true, + "caption": "补齐恢复指令的处理中、待确认、拒绝与成功;不可按点击直接续拍。" + }, + { + "id": "return-active", + "label": "明确返航 · 返航中", + "kind": "flight", + "mode": "returning", + "caption": "示例为拍摄成功后手动返航;是否自动返航仍需确认。" + }, + { + "id": "return-paused", + "label": "返航被暂停 · 继续返航", + "kind": "flight", + "mode": "returnpaused", + "proposed": true, + "caption": "仅设备允许暂停返航时适用;恢复目标是返航,不能重新拍摄。" + }, + { + "id": "dock-recovering", + "label": "已回巢 · 设备准备中", + "kind": "prepare", + "mode": "recovering", + "proposed": true, + "caption": "落地或回巢不自动等于可再次执行;设备明确放行后再启用召唤。" + } + ], + "checks": [ + { + "id": "pause-pending", + "phoneHeight": 844, + "footerBottom": 921, + "phoneBottom": 922, + "footerVisible": true, + "mainContentClipped": false, + "footerText": "安全控制\n暂停处理中…\n立即返航" + }, + { + "id": "pause-confirmed", + "phoneHeight": 844, + "footerBottom": 921, + "phoneBottom": 922, + "footerVisible": true, + "mainContentClipped": false, + "footerText": "安全控制\n已悬停\n立即返航" + }, + { + "id": "resume-pending", + "phoneHeight": 844, + "footerBottom": 921, + "phoneBottom": 922, + "footerVisible": true, + "mainContentClipped": false, + "footerText": "安全控制\n紧急暂停\n立即返航" + }, + { + "id": "return-active", + "phoneHeight": 844, + "footerBottom": 921, + "phoneBottom": 922, + "footerVisible": true, + "mainContentClipped": false, + "footerText": "安全控制\n紧急暂停\n返航中" + }, + { + "id": "return-paused", + "phoneHeight": 844, + "footerBottom": 921, + "phoneBottom": 922, + "footerVisible": true, + "mainContentClipped": false, + "footerText": "安全控制\n已悬停\n立即返航" + }, + { + "id": "dock-recovering", + "phoneHeight": 844, + "footerBottom": 921, + "phoneBottom": 922, + "footerVisible": true, + "mainContentClipped": false, + "footerText": "机巢已连接\n点位范围已检查\n三皇寨 · 经典航线\n已回巢 · 设备准备中\n等待设备恢复可用\n每次拍摄成功后扣减 1 次,未成功不扣次数" + } + ], + "runtimeErrors": [] +} \ No newline at end of file diff --git a/docs/9.9.1/review/regenerated-03/dock-recovering.png b/docs/9.9.1/review/regenerated-03/dock-recovering.png new file mode 100644 index 0000000..a851a72 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/dock-recovering.png differ diff --git a/docs/9.9.1/review/regenerated-03/footer.png b/docs/9.9.1/review/regenerated-03/footer.png new file mode 100644 index 0000000..647ef25 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/footer.png differ diff --git a/docs/9.9.1/review/regenerated-03/header.png b/docs/9.9.1/review/regenerated-03/header.png new file mode 100644 index 0000000..42113c2 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/header.png differ diff --git a/docs/9.9.1/review/regenerated-03/pause-confirmed.png b/docs/9.9.1/review/regenerated-03/pause-confirmed.png new file mode 100644 index 0000000..ef16d3c Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/pause-confirmed.png differ diff --git a/docs/9.9.1/review/regenerated-03/pause-pending.png b/docs/9.9.1/review/regenerated-03/pause-pending.png new file mode 100644 index 0000000..fd27db8 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/pause-pending.png differ diff --git a/docs/9.9.1/review/regenerated-03/qa-pair-1.png b/docs/9.9.1/review/regenerated-03/qa-pair-1.png new file mode 100644 index 0000000..3147cb1 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/qa-pair-1.png differ diff --git a/docs/9.9.1/review/regenerated-03/qa-pair-2.png b/docs/9.9.1/review/regenerated-03/qa-pair-2.png new file mode 100644 index 0000000..6ce46e7 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/qa-pair-2.png differ diff --git a/docs/9.9.1/review/regenerated-03/qa-pair-3.png b/docs/9.9.1/review/regenerated-03/qa-pair-3.png new file mode 100644 index 0000000..a0f65f1 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/qa-pair-3.png differ diff --git a/docs/9.9.1/review/regenerated-03/resume-pending.png b/docs/9.9.1/review/regenerated-03/resume-pending.png new file mode 100644 index 0000000..8a4711b Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/resume-pending.png differ diff --git a/docs/9.9.1/review/regenerated-03/return-active.png b/docs/9.9.1/review/regenerated-03/return-active.png new file mode 100644 index 0000000..76cc673 Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/return-active.png differ diff --git a/docs/9.9.1/review/regenerated-03/return-paused.png b/docs/9.9.1/review/regenerated-03/return-paused.png new file mode 100644 index 0000000..a8d201e Binary files /dev/null and b/docs/9.9.1/review/regenerated-03/return-paused.png differ diff --git a/docs/9.9.1/review/report-preview.png b/docs/9.9.1/review/report-preview.png new file mode 100644 index 0000000..f15f262 Binary files /dev/null and b/docs/9.9.1/review/report-preview.png differ diff --git a/docs/9.9.1/review/review-content.html b/docs/9.9.1/review/review-content.html new file mode 100644 index 0000000..0ac4566 --- /dev/null +++ b/docs/9.9.1/review/review-content.html @@ -0,0 +1,95 @@ +
    随心瞰商家版 · 9.9.1 · 需求评审

    主拍摄链路已有基础,商业闭环与状态契约仍需补齐

    基于需求正文、拍摄准备 README 和全部 27 张附件图,只读分析现有 iOS 角色与收款接口。未修改业务代码。以下界面为需求评审用静态示意稿,不是 App 运行截图。

    2026-10-21 · 63 张手机界面(含机巢工作台)+ 5 张 Web 界面,共 68 张 · 12 组横向状态流

    + +

    已确认的 App 范围与返回规则

    App 进入机巢工作台后,获取当前登录用户在当前景区的订单并展示。订单归属与分配由后端处理。

    任务执行中点击左上角返回,直接回机巢工作台,不弹确认,不取消任务。当前任务订单置顶,卡片右上角显示任务状态,保留原订单卡片的横向布局,将原“开始拍摄”按钮标题改为“查看当前任务”,不增加点位或航线信息;点击后进入原任务,不重新召唤。

    卡片标签分别为前往拍摄点中、已到达待拍摄、拍摄中、拍摄已暂停、返航中、返航已暂停、任务状态待确认。拍摄成功但仍返航时,同时显示拍摄已完成和无人机返航中,保留查看当前任务。

    第 11 组补充返回与重新进入的连续流程及成功返航分支;第 12 组并列展示七种卡片状态。未知读数显示—,上次次数标明待同步。

    +

    端到端流程

    Web 套餐配置并上架 → 销售推荐套餐 → 建立付款会话并展示收款码 → 游客支付 → 服务端确认支付 → 订单归属销售/工作人员 → 机巢工作台 → 选择点位和航线 → 再次校验执行条件 → 召唤 → 前往 → 确认到达 → 点击开始并等待指令确认 → 拍摄 → 权威结果确认成功 → 同任务只扣 1 次 → 同步订单和点位次数 → 素材上传 → 查看与下载 → 保存本机/交付游客。

    飞行返航与拍摄结果、素材上传并行。成功时无人机可能仍在返航;失败时也可能仍在返航。剩余次数大于零时,可在设备重新允许执行后选择同一点位或其他点位开始下一次拍摄。保留原游客自助下单入口,支付并分配后的履约应复用同一机巢任务链。

    销售归属方式、成功判据、部分拍摄计次、返航策略与游客素材领取方式仍未确定;上面的完整链路包含建议补全,不代表这些规则已获确认。

    +

    哪些已齐,哪些尚未闭环

    + + + + + + + +
    领域覆盖判断依据与缺口
    点位与航线准备较完整README 已定义订单入口、恢复选择、范围外可浏览、无航线、过期状态、底部固定区和召唤校验。
    多次套餐与计数业务规则已有,落账契约待补同点可重复;只有成功才扣;同任务重复通知不能再计数。仍需成功事件、原子占用、落账延迟及乱序恢复规则。
    无人机任务主链已有,转移条件未全部定义召唤、到达、拍摄、暂停、恢复、返航、失败均有覆盖;恢复原阶段、回巢后可执行判据仍待确认。
    网络与命令异常大部分已有已区分图传断流、手机断网、指令处理中与结果未知。恢复指令的反馈、长时间未知和控制权变化尚缺。
    素材查看下载大部分已有已有上传中、混合素材状态、下载中、部分失败、只重试失败项、离页中止和相册拒权。最终上传失败、后台恢复和游客交付规则未闭环。
    现场销售、收款与订单归属主要缺口正文仅概述套餐推荐、收款码、销售对应订单;未明确交易绑定、付款确认、待分配、转交及权限失效。
    Web 套餐管理仅概述创建信息、价格、次数已有;适用范围、草稿、上下架、变更影响历史订单和删除限制未定义。

    “需求已有状态”与“接口已实现”不同。现有文档不足以证明上述机巢接口、设备能力或新增销售角色已经实现。

    +

    P0 · 建议开发前确定的 8 项

    + + + + + + + + +
    事项必须回答的问题建议闭环方式(待确认)
    1. 付款会话收款码是静态还是单笔动态码?如何绑定套餐、景区、销售和游客?付款前是否建待支付订单?至少明确生成中/失败、待支付、确认中、已支付、失效/关闭。结果未知先核验原交易,禁止用超时判失败后再次收款。
    2. 角色与订单归属销售是否就是拍摄操作人?自动分配、后台派单还是领取?原游客自助订单如何进入?定义待分配→归属当前人→可拍摄;转交、登录失效、控制权变更时禁止新任务,并提供执行中任务的授权接管通道。
    3. 拍摄成功与中断设备哪个事件确认成功?只完成部分镜头、人工提前返航、任务中断如何结算?服务端确认权威结果,同一任务最多扣一次。未确认成功不扣;上传失败与下载失败不自动改写拍摄结果或退次数。
    4. 额度与设备并发两台手机同时用最后一次、同时召唤同一设备怎么办?成功但次数未同步怎么办?服务端原子检查并占用设备及额度,幂等创建任务,按任务结算并返回权威次数快照。占用不等于提前扣次;未知和结算中阻止重复新任务。
    5. 暂停与恢复目标前往/拍摄/返航阶段各能否暂停?恢复是继续原航段、续拍还是重新执行?记录暂停前阶段。返航暂停恢复返航,不重新拍摄。补恢复指令处理中、结果未知、拒绝、成功四态。
    6. 指令与设备状态开始指令被拒绝是否使任务失败?保护返航能否暂停?回巢后何时可再执行?指令拒绝与任务失败分别表达;每阶段提供可信允许操作。落地、回巢、检查/充电、允许再执行分开判断,禁止 App 自定阈值。
    7. 订单终态与套餐变更次数用完是否即完成?素材还在上传怎么办?过期、取消、退款是否本版支持?改价下架影响已付订单吗?拍摄额度与素材交付分开。建议订单保留购买时价格、次数、适用范围等快照;下架停止新售。退款行为及飞行中限制需单独确认。
    8. 结果同步与素材交付杀进程、离线恢复、迟到通知如何回到同一任务?最终无有效素材怎么办?游客从哪里领取?按任务/指令 ID 和状态版本同步,拒绝旧事件覆盖终态。明确上传最终失败的责任人、补偿规则和游客领取入口;本机下载不等于已交付游客。
    +

    P1 · 补齐体验与运维状态

      +
    • 套餐/订单/点位/航线的首次加载、加载失败、空数据、配置已下线;创建收款会话时价格变更需要重新确认。
    • +
    • 定位未授权、系统定位关闭、定位失败、位置过期和范围外分别提示。位置变化不自动打乱点位或清除仍有效选择。
    • +
    • 机巢首次连接、图传建立中/失败、控制通道断开、遥测过期各自表达,不能只用“手机有网”判断设备可操作。
    • +
    • 长期结果未知给人工核查或联系负责人入口;允许持续查询,不能擅自超时定为失败或无限自动重试。
    • +
    • 明确上传失败/部分可用/最终不可恢复;已就绪素材是否先交付、谁可发起重传。
    • +
    • 下载地址失效、素材删除、相册写入失败、存储空间不足分别处理。“已保存”是本设备写入成功,跨设备不能继承为本机已保存。
    • +
    • 离页中止下载原稿已有;补切后台、锁屏、强退、重进后的继续/停止/重试规则。
    • +
    • Web 保存失败、重复提交、多人编辑冲突和被已售订单引用的套餐删除限制。
    • +
    +

    不要用一个状态字段包办全部业务

    + + + + + + + + +
    独立维度建议可表达的状态关键约束
    支付待支付/确认中/已支付/明确失败/已关闭游客口述、二维码失效和请求超时都不直接等于支付失败。
    订单与权限待分配/本人可操作/已转交/过期/退款中等终态是否支持及规则待确认。执行中任务不能失去安全接管通道。
    拍摄任务创建中/前往/待拍/拍摄/暂停/结果待确认/成功/失败/中断“中断”是否单独结算需确认;同任务不因切页或断网重建。
    飞行设备空闲/起飞前往/悬停/返航/降落回巢/准备中/不可执行/未知任务成功或失败时仍可返航;只有设备明确允许才可再次执行。
    每条指令可提交/处理中/已确认/明确拒绝/结果未知召唤、开始、暂停、恢复、返航各自建模。重试同指令与新建任务不是同一操作。
    连接与新鲜度手机网络/控制通道/图传/遥测分别在线或未知失效值用“—”或清楚标记历史;每次恢复先同步,不自动重发指令。
    额度可用次数/已成功次数/执行占用/结算同步中服务端快照为准;占用不提前计成功。任务重复结果只计一次。
    素材与本机保存未生成/上传中/部分就绪/上传失败/就绪;下载/保存中/成功/失败拍摄成功不等于素材已就绪,也不等于本机保存或游客领取成功。

    同步数据至少需要能对应订单、业务任务、设备任务、指令和素材;包括状态版本/更新时间、结果原因、返航原因、允许操作以及权威次数。这里是信息需求,不是已存在的 API 字段承诺。

    +

    各阶段操作边界

    + + + + + + + + + +
    阶段主操作安全操作与限制
    准备就绪确认并召唤订单授权、额度、点位航线、范围、连接、设备许可全部再次满足;本订单有任务则查看原任务。
    召唤/开始等提交中显示对应处理中防同指令重复提交;是否能返航按独立许可判断,不统一锁死全部安全操作。
    前往点位等待到达开始拍摄不可用;暂停和返航需设备当前允许。
    已到达开始拍摄等待开始指令确认;开始被拒绝不必直接判任务失败。
    拍摄/拍摄暂停拍摄中/按设备能力恢复拍摄恢复保持同一任务;未知结果不新拍、不扣次。
    普通/保护返航返航中保护原因由设备上报;能否暂停由设备决定;若暂停,恢复目标必须是返航。
    拍摄成功/失败但仍返航查看素材或保留失败原因不得重新召唤;结果确认与安全控制独立。
    手机离线/任务未知恢复连接与同步原任务无法发送的操作不可用;遥测不当实时值;重进页面不等于取消原任务。
    已回巢但设备准备中等待设备执行许可次数允许也不能立即召唤;确认放行后重新校验所有条件。
    +

    原稿的表达冲突与本稿处理

      +
    1. “5点套餐”与次数规则冲突:任务页统一写“含 5 次拍摄”,避免误解为五个不同点位。
    2. +
    3. 完成后返回目标不一致:正文“稍后回去”返回工作台,另有关闭弹窗后留任务页。建议关闭弹窗留任务页,另设明确“返回工作台”;返回不取消任务、不再次扣次。此建议待确认。
    4. +
    5. 全选状态不一致:image 19 四张素材已选、数量为 4,但总开关为空。本稿改为全选勾选、四卡勾选、底部 4 份一致。
    6. +
    7. 历史画面与实时读数混用:失败后设备已可用时,画面标明上次任务;六项读数另标当前设备及更新时间。若不可信则显示未知。
    8. +
    9. 分支不能画成顺序:失败终态不连接回“保护返航结果待确认”;转交和退款不重置次数。截图间“分支”表示独立样例,“→”表示本组内的后续步骤。
    10. +
    +

    12 组横向状态截图

    每组从左往右查看。点击对应的整图查看高清 PNG;下方也可切换组别查看界面细节。所有价格、订单、点位、数值与素材数量均为展示数据。原需求已有与建议补充均在界面上方标明;图传使用占位,不虚构真实飞行画面。

    +

    按组查看界面细节

    +

    建议验收清单

    + + + + + + + + + + + + + + + + + + + + +
    场景应成立的结果
    销售支付成功,通知延迟处于确认中,持续核验原交易;不直接重复收款,支付确认后才能进入履约。
    销售现场订单与原自助订单保持来源可区分,授权分配后进入同一任务执行与次数管理链;不重复建订单。
    同点再次成功拍摄已3剩2、三皇寨2 → 已4剩1、三皇寨3。换航线也按同点累计。
    召唤途中失败不增加已成功次数;返航未完成不允许重召。
    开始指令被拒保留原任务,按设备返回决定重试开始还是其他处理;不无条件当整个任务失败。
    拍摄暂停后继续沿用原任务与原额度占用,恢复确认后才显示拍摄中。
    返航暂停后继续恢复返航,已确认拍摄结果不变,不意外重拍。
    保护返航展示设备原因;拍摄结果未确认则继续待确认,后续按权威成功或失败结算。
    仅图传断开可重连画面,任务与控制状态保持各自可信结果;不重建任务。
    手机断网后恢复/杀进程重进同步原任务、指令与次数;无重召、无自动重发、无重复扣次。
    命令超时但实际执行成功显示未知后同步到实际结果;不因网络超时重复操作或提前报失败。
    重复完成事件/旧拍摄中事件迟到只结算一次;旧事件不能覆盖已确认终态。
    两手机争最后一次/同一设备仅一个有效任务建立;另一端显示占用或权益冲突并同步权威快照。
    最后一次成功,次数未同步显示次数更新中,阻止新任务;落账后已5剩0,素材入口保留。
    成功但上传未完/最终失败展示上传或失败原因,不虚构进度,不自行退次数;最终交付及补偿按确认后的规则执行。
    4份全选,下载1份失败选中数始终一致;3份已保存、1份待重试,重试仅处理失败项。
    相册拒权/本机存储不足保留选择,分别给权限或空间恢复入口;保存未成功不标已下载。
    订单转交或退款时设备在飞行禁止未授权的新拍摄,执行任务保有授权安全接管;不得因切换角色直接丢失任务。
    套餐改价、减次数、下架新售按当前版本;已支付订单权益不被静默改写,具体快照与退款规则需先确认。
    游客领取素材确认既有游客入口是否支持此类订单;销售本机保存不能作为游客已领取的证据。
    +

    建议实现顺序

    先确定上述 P0 规则和任务/指令同步契约,再对齐销售角色、套餐与订单归属;随后开发机巢准备与正常拍摄,接入次数结算、暂停返航和断线恢复,最后补素材交付及后台生命周期。按这些流程准备 Model/ViewModel 测试和设备联调场景。本次没有实现或执行 App 功能测试。

    +

    分析依据与限制

      +
    • 需求正文:随心瞰9.9.1.md(用户提供的原始输入,未随本次归档复制)。
    • +
    • 准备页规格:图片和附件/README.md(用户提供的原始输入,未随本次归档复制),重点为页面入口、计数、设备信息、主按钮和返回中断规则。
    • +
    • 附件共 27 张图,涵盖工作台、准备、到达、拍摄、暂停、返航、成功失败、断流断网、命令反馈、订单和素材下载。
    • +
    • iOS 只读核对:suixinkan/Theme/AppColor.swift、Features/Auth/Models/AppRoleCode.swift、Features/Payment/API/PaymentAPI.swift。现有收款接口提供景区摄影师收款 URL,不能据此认定已支持新套餐交易绑定;新增销售角色编码尚待对齐。
    • +
    • 评审时配置的 Android 参考工程在当时的环境中未找到,因此未将任何 Android 行为当作已核实规则。
    • +
    • 所有输出保存于本次评审目录,Git 工作区无改动。静态稿已做界面渲染与状态一致性复核,未连接支付、机巢或真实无人机。
    • +
    +
    随心瞰 9.9.1 · 需求评审与状态流示意 · 待产品、后端及设备方共同确认后进入实现
    diff --git a/docs/9.9.1/review/review.html b/docs/9.9.1/review/review.html new file mode 100644 index 0000000..64e5786 --- /dev/null +++ b/docs/9.9.1/review/review.html @@ -0,0 +1,363 @@ +随心瞰 9.9.1 · 需求流程评审与横向状态截图
    随心瞰商家版 · 9.9.1 · 需求评审

    主拍摄链路已有基础,商业闭环与状态契约仍需补齐

    基于需求正文、拍摄准备 README 和全部 27 张附件图,只读分析现有 iOS 角色与收款接口。未修改业务代码。以下界面为需求评审用静态示意稿,不是 App 运行截图。

    2026-10-21 · 63 张手机界面(含机巢工作台)+ 5 张 Web 界面,共 68 张 · 12 组横向状态流

    + +

    已确认的 App 范围与返回规则

    App 进入机巢工作台后,获取当前登录用户在当前景区的订单并展示。订单归属与分配由后端处理。

    任务执行中点击左上角返回,直接回机巢工作台,不弹确认,不取消任务。当前任务订单置顶,卡片右上角显示任务状态,保留原订单卡片的横向布局,将原“开始拍摄”按钮标题改为“查看当前任务”,不增加点位或航线信息;点击后进入原任务,不重新召唤。

    卡片标签分别为前往拍摄点中、已到达待拍摄、拍摄中、拍摄已暂停、返航中、返航已暂停、任务状态待确认。拍摄成功但仍返航时,同时显示拍摄已完成和无人机返航中,保留查看当前任务。

    第 11 组补充返回与重新进入的连续流程及成功返航分支;第 12 组并列展示七种卡片状态。未知读数显示—,上次次数标明待同步。

    +

    端到端流程

    Web 套餐配置并上架 → 销售推荐套餐 → 建立付款会话并展示收款码 → 游客支付 → 服务端确认支付 → 订单归属销售/工作人员 → 机巢工作台 → 选择点位和航线 → 再次校验执行条件 → 召唤 → 前往 → 确认到达 → 点击开始并等待指令确认 → 拍摄 → 权威结果确认成功 → 同任务只扣 1 次 → 同步订单和点位次数 → 素材上传 → 查看与下载 → 保存本机/交付游客。

    飞行返航与拍摄结果、素材上传并行。成功时无人机可能仍在返航;失败时也可能仍在返航。剩余次数大于零时,可在设备重新允许执行后选择同一点位或其他点位开始下一次拍摄。保留原游客自助下单入口,支付并分配后的履约应复用同一机巢任务链。

    销售归属方式、成功判据、部分拍摄计次、返航策略与游客素材领取方式仍未确定;上面的完整链路包含建议补全,不代表这些规则已获确认。

    +

    哪些已齐,哪些尚未闭环

    + + + + + + + +
    领域覆盖判断依据与缺口
    点位与航线准备较完整README 已定义订单入口、恢复选择、范围外可浏览、无航线、过期状态、底部固定区和召唤校验。
    多次套餐与计数业务规则已有,落账契约待补同点可重复;只有成功才扣;同任务重复通知不能再计数。仍需成功事件、原子占用、落账延迟及乱序恢复规则。
    无人机任务主链已有,转移条件未全部定义召唤、到达、拍摄、暂停、恢复、返航、失败均有覆盖;恢复原阶段、回巢后可执行判据仍待确认。
    网络与命令异常大部分已有已区分图传断流、手机断网、指令处理中与结果未知。恢复指令的反馈、长时间未知和控制权变化尚缺。
    素材查看下载大部分已有已有上传中、混合素材状态、下载中、部分失败、只重试失败项、离页中止和相册拒权。最终上传失败、后台恢复和游客交付规则未闭环。
    现场销售、收款与订单归属主要缺口正文仅概述套餐推荐、收款码、销售对应订单;未明确交易绑定、付款确认、待分配、转交及权限失效。
    Web 套餐管理仅概述创建信息、价格、次数已有;适用范围、草稿、上下架、变更影响历史订单和删除限制未定义。

    “需求已有状态”与“接口已实现”不同。现有文档不足以证明上述机巢接口、设备能力或新增销售角色已经实现。

    +

    P0 · 建议开发前确定的 8 项

    + + + + + + + + +
    事项必须回答的问题建议闭环方式(待确认)
    1. 付款会话收款码是静态还是单笔动态码?如何绑定套餐、景区、销售和游客?付款前是否建待支付订单?至少明确生成中/失败、待支付、确认中、已支付、失效/关闭。结果未知先核验原交易,禁止用超时判失败后再次收款。
    2. 角色与订单归属销售是否就是拍摄操作人?自动分配、后台派单还是领取?原游客自助订单如何进入?定义待分配→归属当前人→可拍摄;转交、登录失效、控制权变更时禁止新任务,并提供执行中任务的授权接管通道。
    3. 拍摄成功与中断设备哪个事件确认成功?只完成部分镜头、人工提前返航、任务中断如何结算?服务端确认权威结果,同一任务最多扣一次。未确认成功不扣;上传失败与下载失败不自动改写拍摄结果或退次数。
    4. 额度与设备并发两台手机同时用最后一次、同时召唤同一设备怎么办?成功但次数未同步怎么办?服务端原子检查并占用设备及额度,幂等创建任务,按任务结算并返回权威次数快照。占用不等于提前扣次;未知和结算中阻止重复新任务。
    5. 暂停与恢复目标前往/拍摄/返航阶段各能否暂停?恢复是继续原航段、续拍还是重新执行?记录暂停前阶段。返航暂停恢复返航,不重新拍摄。补恢复指令处理中、结果未知、拒绝、成功四态。
    6. 指令与设备状态开始指令被拒绝是否使任务失败?保护返航能否暂停?回巢后何时可再执行?指令拒绝与任务失败分别表达;每阶段提供可信允许操作。落地、回巢、检查/充电、允许再执行分开判断,禁止 App 自定阈值。
    7. 订单终态与套餐变更次数用完是否即完成?素材还在上传怎么办?过期、取消、退款是否本版支持?改价下架影响已付订单吗?拍摄额度与素材交付分开。建议订单保留购买时价格、次数、适用范围等快照;下架停止新售。退款行为及飞行中限制需单独确认。
    8. 结果同步与素材交付杀进程、离线恢复、迟到通知如何回到同一任务?最终无有效素材怎么办?游客从哪里领取?按任务/指令 ID 和状态版本同步,拒绝旧事件覆盖终态。明确上传最终失败的责任人、补偿规则和游客领取入口;本机下载不等于已交付游客。
    +

    P1 · 补齐体验与运维状态

      +
    • 套餐/订单/点位/航线的首次加载、加载失败、空数据、配置已下线;创建收款会话时价格变更需要重新确认。
    • +
    • 定位未授权、系统定位关闭、定位失败、位置过期和范围外分别提示。位置变化不自动打乱点位或清除仍有效选择。
    • +
    • 机巢首次连接、图传建立中/失败、控制通道断开、遥测过期各自表达,不能只用“手机有网”判断设备可操作。
    • +
    • 长期结果未知给人工核查或联系负责人入口;允许持续查询,不能擅自超时定为失败或无限自动重试。
    • +
    • 明确上传失败/部分可用/最终不可恢复;已就绪素材是否先交付、谁可发起重传。
    • +
    • 下载地址失效、素材删除、相册写入失败、存储空间不足分别处理。“已保存”是本设备写入成功,跨设备不能继承为本机已保存。
    • +
    • 离页中止下载原稿已有;补切后台、锁屏、强退、重进后的继续/停止/重试规则。
    • +
    • Web 保存失败、重复提交、多人编辑冲突和被已售订单引用的套餐删除限制。
    • +
    +

    不要用一个状态字段包办全部业务

    + + + + + + + + +
    独立维度建议可表达的状态关键约束
    支付待支付/确认中/已支付/明确失败/已关闭游客口述、二维码失效和请求超时都不直接等于支付失败。
    订单与权限待分配/本人可操作/已转交/过期/退款中等终态是否支持及规则待确认。执行中任务不能失去安全接管通道。
    拍摄任务创建中/前往/待拍/拍摄/暂停/结果待确认/成功/失败/中断“中断”是否单独结算需确认;同任务不因切页或断网重建。
    飞行设备空闲/起飞前往/悬停/返航/降落回巢/准备中/不可执行/未知任务成功或失败时仍可返航;只有设备明确允许才可再次执行。
    每条指令可提交/处理中/已确认/明确拒绝/结果未知召唤、开始、暂停、恢复、返航各自建模。重试同指令与新建任务不是同一操作。
    连接与新鲜度手机网络/控制通道/图传/遥测分别在线或未知失效值用“—”或清楚标记历史;每次恢复先同步,不自动重发指令。
    额度可用次数/已成功次数/执行占用/结算同步中服务端快照为准;占用不提前计成功。任务重复结果只计一次。
    素材与本机保存未生成/上传中/部分就绪/上传失败/就绪;下载/保存中/成功/失败拍摄成功不等于素材已就绪,也不等于本机保存或游客领取成功。

    同步数据至少需要能对应订单、业务任务、设备任务、指令和素材;包括状态版本/更新时间、结果原因、返航原因、允许操作以及权威次数。这里是信息需求,不是已存在的 API 字段承诺。

    +

    各阶段操作边界

    + + + + + + + + + +
    阶段主操作安全操作与限制
    准备就绪确认并召唤订单授权、额度、点位航线、范围、连接、设备许可全部再次满足;本订单有任务则查看原任务。
    召唤/开始等提交中显示对应处理中防同指令重复提交;是否能返航按独立许可判断,不统一锁死全部安全操作。
    前往点位等待到达开始拍摄不可用;暂停和返航需设备当前允许。
    已到达开始拍摄等待开始指令确认;开始被拒绝不必直接判任务失败。
    拍摄/拍摄暂停拍摄中/按设备能力恢复拍摄恢复保持同一任务;未知结果不新拍、不扣次。
    普通/保护返航返航中保护原因由设备上报;能否暂停由设备决定;若暂停,恢复目标必须是返航。
    拍摄成功/失败但仍返航查看素材或保留失败原因不得重新召唤;结果确认与安全控制独立。
    手机离线/任务未知恢复连接与同步原任务无法发送的操作不可用;遥测不当实时值;重进页面不等于取消原任务。
    已回巢但设备准备中等待设备执行许可次数允许也不能立即召唤;确认放行后重新校验所有条件。
    +

    原稿的表达冲突与本稿处理

      +
    1. “5点套餐”与次数规则冲突:任务页统一写“含 5 次拍摄”,避免误解为五个不同点位。
    2. +
    3. 完成后返回目标不一致:正文“稍后回去”返回工作台,另有关闭弹窗后留任务页。建议关闭弹窗留任务页,另设明确“返回工作台”;返回不取消任务、不再次扣次。此建议待确认。
    4. +
    5. 全选状态不一致:image 19 四张素材已选、数量为 4,但总开关为空。本稿改为全选勾选、四卡勾选、底部 4 份一致。
    6. +
    7. 历史画面与实时读数混用:失败后设备已可用时,画面标明上次任务;六项读数另标当前设备及更新时间。若不可信则显示未知。
    8. +
    9. 分支不能画成顺序:失败终态不连接回“保护返航结果待确认”;转交和退款不重置次数。截图间“分支”表示独立样例,“→”表示本组内的后续步骤。
    10. +
    +

    12 组横向状态截图

    每组从左往右查看。点击对应的整图查看高清 PNG;下方也可切换组别查看界面细节。所有价格、订单、点位、数值与素材数量均为展示数据。原需求已有与建议补充均在界面上方标明;图传使用占位,不虚构真实飞行画面。

    01 销售收款与订单建立 · 6 个状态

    整个销售前置链路为建议稿;支付方式、付款码类型和订单分配机制待确认。

    01 销售收款与订单建立,各界面按从左到右排列

    选择可售套餐 | 核对套餐信息 | 展示收款码 · 待支付 | 游客反馈已付款 · 核验中 | 已支付 · 待分配 | 已归属本人 · 待拍摄

    查看高清整图
    +
    02 正常召唤与拍摄 · 7 个状态

    额度示例连续:总5次、已3次、剩2次;本次成功后已4次、剩1次,三皇寨由2次变3次。

    02 正常召唤与拍摄,各界面按从左到右排列

    机巢工作台 · 从订单进入 | 点位、航线与执行条件满足 | 提交召唤中 | 召唤确认 · 前往点位 | 已到达 · 等待开始 | 开始指令确认 · 拍摄中 | 拍摄成功 · 更新次数

    查看高清整图
    +
    03 暂停、恢复与返航 · 6 个状态

    恢复目标必须与暂停前阶段一致。拍摄恢复方式、普通/保护返航是否可暂停,必须以设备能力为准。

    03 暂停、恢复与返航,各界面按从左到右排列

    请求暂停 · 等待确认 | 拍摄已暂停 · 悬停 | 请求恢复原阶段 | 明确返航 · 返航中 | 返航被暂停 · 继续返航 | 已回巢 · 设备准备中

    查看高清整图
    +
    04 指令拒绝、任务失败与重试 · 5 个状态

    含三个并列分支:开始指令被拒、任务失败后恢复、设备保护返航。分支之间不表示自动跳转。

    04 指令拒绝、任务失败与重试,各界面按从左到右排列

    开始指令被拒绝 | 任务确认失败 · 仍在返航 | 失败结果保留 · 设备可用 | 返回准备 · 保留原选择 | 设备保护返航 · 结果待确认

    查看高清整图
    +
    05 连接中断与指令结果未知 · 6 个状态

    包含图传、手机断网恢复、开始指令超时、恢复指令超时四个分支。超时或离页不能代替任务结果。

    05 连接中断与指令结果未知,各界面按从左到右排列

    仅图传断流 | 手机断网 · 状态未知 | 恢复网络 · 同步原任务 | 开始指令处理中 | 超时 · 执行结果待确认 | 恢复指令结果待确认

    查看高清整图
    +
    06 拍摄准备的阻断与恢复 · 6 个状态

    各图表示独立分支样例;这组按检查次序横向排列,不表示会自动依次发生。

    06 拍摄准备的阻断与恢复,各界面按从左到右排列

    尚未选点位或航线 | 定位未知 / 范围外 | 设备占用 · 不制造倒计时 | 设备不允许执行 | 本订单已有执行中任务 | 点位暂无可用航线

    查看高清整图
    +
    07 次数结算与订单终态 · 5 个状态

    前三图连续:最后一次→成功待结算→已5剩0。转交、退款为并列异常分支,沿用额度耗尽示例,不表示自动退款。

    07 次数结算与订单终态,各界面按从左到右排列

    订单剩余最后一次 | 拍摄已成功 · 次数同步中 | 额度耗尽 · 素材仍上传 | 订单已转交 / 当前人无权限 | 订单退款中 / 不可新拍

    查看高清整图
    +
    08 素材上传、下载与保存 · 6 个状态

    拍摄结果、素材上传、文件下载、保存相册分别表达;文件示意不代表真实产出数量。

    08 素材上传、下载与保存,各界面按从左到右排列

    拍摄成功 · 素材上传中 | 部分已就绪 · 部分上传失败 | 素材就绪 · 四份全选 | 下载与写入相册进行中 | 三份已保存 · 一份失败 | 四份已保存到本机相册

    查看高清整图
    +
    09 收款与交付异常分支 · 5 个状态

    支付状态为建议补充;相册拒权原稿已有。各状态是并列异常分支,不代表一条必经顺序。

    09 收款与交付异常分支,各界面按从左到右排列

    收款码生成失败 | 收款码失效 · 核验原付款 | 结算时套餐已变更 | 相册权限不足 | 文件下载成功 · 相册保存失败

    查看高清整图
    +
    10 Web 配套套餐生命周期 · 5 个状态

    后台均为建议补充稿:适用范围、上下架、历史订单快照、并发更新规则需先确认。

    10 Web 配套套餐生命周期,各界面按从左到右排列

    草稿 · 完善套餐配置 | 发布校验不通过 | 上架 · App 可售 | 修改并发布新版本 | 下架 · 停止新售

    查看高清整图
    +
    11 任务页返回工作台与重新进入 · 4 个状态

    已确认:执行中点击返回直接回工作台,不弹确认;当前任务订单置顶,显示状态和查看当前任务。保留原卡片样式,仅改按钮标题并在右上角显示状态,不展示点位。前三屏为同一任务,最后一屏为成功返航分支。

    11 任务页返回工作台与重新进入,各界面按从左到右排列

    拍摄中 · 点击左上角返回 | 回到工作台 · 当前任务订单置顶 | 查看当前任务 · 回到原任务 | 成功后仍返航 · 两种状态同时显示

    查看高清整图
    +
    12 工作台订单卡片的任务状态提示 · 7 个状态

    七屏为同一订单在不同状态下的独立示例。保留原卡片横向布局及右侧按钮,仅替换为查看当前任务并在右上角显示状态;卡片不展示点位与航线。

    12 工作台订单卡片的任务状态提示,各界面按从左到右排列

    前往点位 · 前往拍摄点中 | 已到达 · 待拍摄 | 拍摄中 | 拍摄已暂停 | 返航中 · 拍摄结果待确认 | 返航已暂停 | 任务状态待确认

    查看高清整图
    +

    按组查看界面细节

    +
    +
    从左向右 · 原需求 / 建议补充
    +
    +
    +
    + +
    +

    建议验收清单

    + + + + + + + + + + + + + + + + + + + + +
    场景应成立的结果
    销售支付成功,通知延迟处于确认中,持续核验原交易;不直接重复收款,支付确认后才能进入履约。
    销售现场订单与原自助订单保持来源可区分,授权分配后进入同一任务执行与次数管理链;不重复建订单。
    同点再次成功拍摄已3剩2、三皇寨2 → 已4剩1、三皇寨3。换航线也按同点累计。
    召唤途中失败不增加已成功次数;返航未完成不允许重召。
    开始指令被拒保留原任务,按设备返回决定重试开始还是其他处理;不无条件当整个任务失败。
    拍摄暂停后继续沿用原任务与原额度占用,恢复确认后才显示拍摄中。
    返航暂停后继续恢复返航,已确认拍摄结果不变,不意外重拍。
    保护返航展示设备原因;拍摄结果未确认则继续待确认,后续按权威成功或失败结算。
    仅图传断开可重连画面,任务与控制状态保持各自可信结果;不重建任务。
    手机断网后恢复/杀进程重进同步原任务、指令与次数;无重召、无自动重发、无重复扣次。
    命令超时但实际执行成功显示未知后同步到实际结果;不因网络超时重复操作或提前报失败。
    重复完成事件/旧拍摄中事件迟到只结算一次;旧事件不能覆盖已确认终态。
    两手机争最后一次/同一设备仅一个有效任务建立;另一端显示占用或权益冲突并同步权威快照。
    最后一次成功,次数未同步显示次数更新中,阻止新任务;落账后已5剩0,素材入口保留。
    成功但上传未完/最终失败展示上传或失败原因,不虚构进度,不自行退次数;最终交付及补偿按确认后的规则执行。
    4份全选,下载1份失败选中数始终一致;3份已保存、1份待重试,重试仅处理失败项。
    相册拒权/本机存储不足保留选择,分别给权限或空间恢复入口;保存未成功不标已下载。
    订单转交或退款时设备在飞行禁止未授权的新拍摄,执行任务保有授权安全接管;不得因切换角色直接丢失任务。
    套餐改价、减次数、下架新售按当前版本;已支付订单权益不被静默改写,具体快照与退款规则需先确认。
    游客领取素材确认既有游客入口是否支持此类订单;销售本机保存不能作为游客已领取的证据。
    +

    建议实现顺序

    先确定上述 P0 规则和任务/指令同步契约,再对齐销售角色、套餐与订单归属;随后开发机巢准备与正常拍摄,接入次数结算、暂停返航和断线恢复,最后补素材交付及后台生命周期。按这些流程准备 Model/ViewModel 测试和设备联调场景。本次没有实现或执行 App 功能测试。

    +

    分析依据与限制

      +
    • 需求正文:随心瞰9.9.1.md(用户提供的原始输入,未随本次归档复制)。
    • +
    • 准备页规格:图片和附件/README.md(用户提供的原始输入,未随本次归档复制),重点为页面入口、计数、设备信息、主按钮和返回中断规则。
    • +
    • 附件共 27 张图,涵盖工作台、准备、到达、拍摄、暂停、返航、成功失败、断流断网、命令反馈、订单和素材下载。
    • +
    • iOS 只读核对:suixinkan/Theme/AppColor.swift、Features/Auth/Models/AppRoleCode.swift、Features/Payment/API/PaymentAPI.swift。现有收款接口提供景区摄影师收款 URL,不能据此认定已支持新套餐交易绑定;新增销售角色编码尚待对齐。
    • +
    • 评审时配置的 Android 参考工程在当时的环境中未找到,因此未将任何 Android 行为当作已核实规则。
    • +
    • 所有输出保存于本次评审目录,Git 工作区无改动。静态稿已做界面渲染与状态一致性复核,未连接支付、机巢或真实无人机。
    • +
    +
    随心瞰 9.9.1 · 需求评审与状态流示意 · 待产品、后端及设备方共同确认后进入实现
    +
    diff --git a/docs/9.9.1/review/screens/command-rejected.png b/docs/9.9.1/review/screens/command-rejected.png new file mode 100644 index 0000000..7540ae0 Binary files /dev/null and b/docs/9.9.1/review/screens/command-rejected.png differ diff --git a/docs/9.9.1/review/screens/dock-recovering.png b/docs/9.9.1/review/screens/dock-recovering.png new file mode 100644 index 0000000..a851a72 Binary files /dev/null and b/docs/9.9.1/review/screens/dock-recovering.png differ diff --git a/docs/9.9.1/review/screens/failure-ready.png b/docs/9.9.1/review/screens/failure-ready.png new file mode 100644 index 0000000..5faa8ad Binary files /dev/null and b/docs/9.9.1/review/screens/failure-ready.png differ diff --git a/docs/9.9.1/review/screens/failure-returning.png b/docs/9.9.1/review/screens/failure-returning.png new file mode 100644 index 0000000..587eb62 Binary files /dev/null and b/docs/9.9.1/review/screens/failure-returning.png differ diff --git a/docs/9.9.1/review/screens/flight-arrived.png b/docs/9.9.1/review/screens/flight-arrived.png new file mode 100644 index 0000000..fefc728 Binary files /dev/null and b/docs/9.9.1/review/screens/flight-arrived.png differ diff --git a/docs/9.9.1/review/screens/flight-outbound.png b/docs/9.9.1/review/screens/flight-outbound.png new file mode 100644 index 0000000..57b51ea Binary files /dev/null and b/docs/9.9.1/review/screens/flight-outbound.png differ diff --git a/docs/9.9.1/review/screens/flight-shooting.png b/docs/9.9.1/review/screens/flight-shooting.png new file mode 100644 index 0000000..77c9338 Binary files /dev/null and b/docs/9.9.1/review/screens/flight-shooting.png differ diff --git a/docs/9.9.1/review/screens/flight-success.png b/docs/9.9.1/review/screens/flight-success.png new file mode 100644 index 0000000..9a87f28 Binary files /dev/null and b/docs/9.9.1/review/screens/flight-success.png differ diff --git a/docs/9.9.1/review/screens/media-download-partial.png b/docs/9.9.1/review/screens/media-download-partial.png new file mode 100644 index 0000000..2e2d32b Binary files /dev/null and b/docs/9.9.1/review/screens/media-download-partial.png differ diff --git a/docs/9.9.1/review/screens/media-ready.png b/docs/9.9.1/review/screens/media-ready.png new file mode 100644 index 0000000..dff854d Binary files /dev/null and b/docs/9.9.1/review/screens/media-ready.png differ diff --git a/docs/9.9.1/review/screens/media-saved.png b/docs/9.9.1/review/screens/media-saved.png new file mode 100644 index 0000000..7cc543f Binary files /dev/null and b/docs/9.9.1/review/screens/media-saved.png differ diff --git a/docs/9.9.1/review/screens/media-saving.png b/docs/9.9.1/review/screens/media-saving.png new file mode 100644 index 0000000..50fb4ba Binary files /dev/null and b/docs/9.9.1/review/screens/media-saving.png differ diff --git a/docs/9.9.1/review/screens/media-upload-partial.png b/docs/9.9.1/review/screens/media-upload-partial.png new file mode 100644 index 0000000..35ce88e Binary files /dev/null and b/docs/9.9.1/review/screens/media-upload-partial.png differ diff --git a/docs/9.9.1/review/screens/media-uploading.png b/docs/9.9.1/review/screens/media-uploading.png new file mode 100644 index 0000000..20d72f9 Binary files /dev/null and b/docs/9.9.1/review/screens/media-uploading.png differ diff --git a/docs/9.9.1/review/screens/order-refunding.png b/docs/9.9.1/review/screens/order-refunding.png new file mode 100644 index 0000000..c75e439 Binary files /dev/null and b/docs/9.9.1/review/screens/order-refunding.png differ diff --git a/docs/9.9.1/review/screens/order-transferred.png b/docs/9.9.1/review/screens/order-transferred.png new file mode 100644 index 0000000..2f45044 Binary files /dev/null and b/docs/9.9.1/review/screens/order-transferred.png differ diff --git a/docs/9.9.1/review/screens/package-unavailable.png b/docs/9.9.1/review/screens/package-unavailable.png new file mode 100644 index 0000000..9f6eebe Binary files /dev/null and b/docs/9.9.1/review/screens/package-unavailable.png differ diff --git a/docs/9.9.1/review/screens/pause-confirmed.png b/docs/9.9.1/review/screens/pause-confirmed.png new file mode 100644 index 0000000..ef16d3c Binary files /dev/null and b/docs/9.9.1/review/screens/pause-confirmed.png differ diff --git a/docs/9.9.1/review/screens/pause-pending.png b/docs/9.9.1/review/screens/pause-pending.png new file mode 100644 index 0000000..fd27db8 Binary files /dev/null and b/docs/9.9.1/review/screens/pause-pending.png differ diff --git a/docs/9.9.1/review/screens/payment-code-expired.png b/docs/9.9.1/review/screens/payment-code-expired.png new file mode 100644 index 0000000..7531eaa Binary files /dev/null and b/docs/9.9.1/review/screens/payment-code-expired.png differ diff --git a/docs/9.9.1/review/screens/payment-code-failed.png b/docs/9.9.1/review/screens/payment-code-failed.png new file mode 100644 index 0000000..5e9de94 Binary files /dev/null and b/docs/9.9.1/review/screens/payment-code-failed.png differ diff --git a/docs/9.9.1/review/screens/phone-offline.png b/docs/9.9.1/review/screens/phone-offline.png new file mode 100644 index 0000000..96741aa Binary files /dev/null and b/docs/9.9.1/review/screens/phone-offline.png differ diff --git a/docs/9.9.1/review/screens/photo-permission-denied.png b/docs/9.9.1/review/screens/photo-permission-denied.png new file mode 100644 index 0000000..bd12a14 Binary files /dev/null and b/docs/9.9.1/review/screens/photo-permission-denied.png differ diff --git a/docs/9.9.1/review/screens/photo-storage-full.png b/docs/9.9.1/review/screens/photo-storage-full.png new file mode 100644 index 0000000..ff6a3b7 Binary files /dev/null and b/docs/9.9.1/review/screens/photo-storage-full.png differ diff --git a/docs/9.9.1/review/screens/prepare-busy.png b/docs/9.9.1/review/screens/prepare-busy.png new file mode 100644 index 0000000..a948bf7 Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-busy.png differ diff --git a/docs/9.9.1/review/screens/prepare-empty.png b/docs/9.9.1/review/screens/prepare-empty.png new file mode 100644 index 0000000..2eae43b Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-empty.png differ diff --git a/docs/9.9.1/review/screens/prepare-existing.png b/docs/9.9.1/review/screens/prepare-existing.png new file mode 100644 index 0000000..3f276ff Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-existing.png differ diff --git a/docs/9.9.1/review/screens/prepare-location.png b/docs/9.9.1/review/screens/prepare-location.png new file mode 100644 index 0000000..0ddd8f3 Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-location.png differ diff --git a/docs/9.9.1/review/screens/prepare-no-selection.png b/docs/9.9.1/review/screens/prepare-no-selection.png new file mode 100644 index 0000000..192e40a Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-no-selection.png differ diff --git a/docs/9.9.1/review/screens/prepare-ready.png b/docs/9.9.1/review/screens/prepare-ready.png new file mode 100644 index 0000000..d36d7b3 Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-ready.png differ diff --git a/docs/9.9.1/review/screens/prepare-unavailable.png b/docs/9.9.1/review/screens/prepare-unavailable.png new file mode 100644 index 0000000..a98cff8 Binary files /dev/null and b/docs/9.9.1/review/screens/prepare-unavailable.png differ diff --git a/docs/9.9.1/review/screens/protection-return.png b/docs/9.9.1/review/screens/protection-return.png new file mode 100644 index 0000000..916ac78 Binary files /dev/null and b/docs/9.9.1/review/screens/protection-return.png differ diff --git a/docs/9.9.1/review/screens/quota-last.png b/docs/9.9.1/review/screens/quota-last.png new file mode 100644 index 0000000..865b324 Binary files /dev/null and b/docs/9.9.1/review/screens/quota-last.png differ diff --git a/docs/9.9.1/review/screens/quota-settling.png b/docs/9.9.1/review/screens/quota-settling.png new file mode 100644 index 0000000..b35cb9c Binary files /dev/null and b/docs/9.9.1/review/screens/quota-settling.png differ diff --git a/docs/9.9.1/review/screens/quota-zero.png b/docs/9.9.1/review/screens/quota-zero.png new file mode 100644 index 0000000..885a59c Binary files /dev/null and b/docs/9.9.1/review/screens/quota-zero.png differ diff --git a/docs/9.9.1/review/screens/resume-command-unknown.png b/docs/9.9.1/review/screens/resume-command-unknown.png new file mode 100644 index 0000000..fd6cbef Binary files /dev/null and b/docs/9.9.1/review/screens/resume-command-unknown.png differ diff --git a/docs/9.9.1/review/screens/resume-pending.png b/docs/9.9.1/review/screens/resume-pending.png new file mode 100644 index 0000000..8a4711b Binary files /dev/null and b/docs/9.9.1/review/screens/resume-pending.png differ diff --git a/docs/9.9.1/review/screens/retry-prepare.png b/docs/9.9.1/review/screens/retry-prepare.png new file mode 100644 index 0000000..1760038 Binary files /dev/null and b/docs/9.9.1/review/screens/retry-prepare.png differ diff --git a/docs/9.9.1/review/screens/return-active.png b/docs/9.9.1/review/screens/return-active.png new file mode 100644 index 0000000..76cc673 Binary files /dev/null and b/docs/9.9.1/review/screens/return-active.png differ diff --git a/docs/9.9.1/review/screens/return-paused.png b/docs/9.9.1/review/screens/return-paused.png new file mode 100644 index 0000000..a8d201e Binary files /dev/null and b/docs/9.9.1/review/screens/return-paused.png differ diff --git a/docs/9.9.1/review/screens/sales-assignment.png b/docs/9.9.1/review/screens/sales-assignment.png new file mode 100644 index 0000000..2988af7 Binary files /dev/null and b/docs/9.9.1/review/screens/sales-assignment.png differ diff --git a/docs/9.9.1/review/screens/sales-confirming.png b/docs/9.9.1/review/screens/sales-confirming.png new file mode 100644 index 0000000..bb3d2de Binary files /dev/null and b/docs/9.9.1/review/screens/sales-confirming.png differ diff --git a/docs/9.9.1/review/screens/sales-detail.png b/docs/9.9.1/review/screens/sales-detail.png new file mode 100644 index 0000000..89033ab Binary files /dev/null and b/docs/9.9.1/review/screens/sales-detail.png differ diff --git a/docs/9.9.1/review/screens/sales-order.png b/docs/9.9.1/review/screens/sales-order.png new file mode 100644 index 0000000..c9dc1da Binary files /dev/null and b/docs/9.9.1/review/screens/sales-order.png differ diff --git a/docs/9.9.1/review/screens/sales-packages.png b/docs/9.9.1/review/screens/sales-packages.png new file mode 100644 index 0000000..db18225 Binary files /dev/null and b/docs/9.9.1/review/screens/sales-packages.png differ diff --git a/docs/9.9.1/review/screens/sales-unpaid.png b/docs/9.9.1/review/screens/sales-unpaid.png new file mode 100644 index 0000000..1431202 Binary files /dev/null and b/docs/9.9.1/review/screens/sales-unpaid.png differ diff --git a/docs/9.9.1/review/screens/start-command-pending.png b/docs/9.9.1/review/screens/start-command-pending.png new file mode 100644 index 0000000..c02265e Binary files /dev/null and b/docs/9.9.1/review/screens/start-command-pending.png differ diff --git a/docs/9.9.1/review/screens/start-command-unknown.png b/docs/9.9.1/review/screens/start-command-unknown.png new file mode 100644 index 0000000..d87cb39 Binary files /dev/null and b/docs/9.9.1/review/screens/start-command-unknown.png differ diff --git a/docs/9.9.1/review/screens/stream-only-lost.png b/docs/9.9.1/review/screens/stream-only-lost.png new file mode 100644 index 0000000..17216ac Binary files /dev/null and b/docs/9.9.1/review/screens/stream-only-lost.png differ diff --git a/docs/9.9.1/review/screens/summoning.png b/docs/9.9.1/review/screens/summoning.png new file mode 100644 index 0000000..2fd5f26 Binary files /dev/null and b/docs/9.9.1/review/screens/summoning.png differ diff --git a/docs/9.9.1/review/screens/task-after-reenter.png b/docs/9.9.1/review/screens/task-after-reenter.png new file mode 100644 index 0000000..cb3ccb5 Binary files /dev/null and b/docs/9.9.1/review/screens/task-after-reenter.png differ diff --git a/docs/9.9.1/review/screens/task-before-leave.png b/docs/9.9.1/review/screens/task-before-leave.png new file mode 100644 index 0000000..8150df7 Binary files /dev/null and b/docs/9.9.1/review/screens/task-before-leave.png differ diff --git a/docs/9.9.1/review/screens/task-syncing.png b/docs/9.9.1/review/screens/task-syncing.png new file mode 100644 index 0000000..0bfff17 Binary files /dev/null and b/docs/9.9.1/review/screens/task-syncing.png differ diff --git a/docs/9.9.1/review/screens/web-draft.png b/docs/9.9.1/review/screens/web-draft.png new file mode 100644 index 0000000..9073ce8 Binary files /dev/null and b/docs/9.9.1/review/screens/web-draft.png differ diff --git a/docs/9.9.1/review/screens/web-modified.png b/docs/9.9.1/review/screens/web-modified.png new file mode 100644 index 0000000..0a9935d Binary files /dev/null and b/docs/9.9.1/review/screens/web-modified.png differ diff --git a/docs/9.9.1/review/screens/web-offline.png b/docs/9.9.1/review/screens/web-offline.png new file mode 100644 index 0000000..574a319 Binary files /dev/null and b/docs/9.9.1/review/screens/web-offline.png differ diff --git a/docs/9.9.1/review/screens/web-published.png b/docs/9.9.1/review/screens/web-published.png new file mode 100644 index 0000000..7cd0d74 Binary files /dev/null and b/docs/9.9.1/review/screens/web-published.png differ diff --git a/docs/9.9.1/review/screens/web-validation.png b/docs/9.9.1/review/screens/web-validation.png new file mode 100644 index 0000000..7b21a37 Binary files /dev/null and b/docs/9.9.1/review/screens/web-validation.png differ diff --git a/docs/9.9.1/review/screens/workbench-home.png b/docs/9.9.1/review/screens/workbench-home.png new file mode 100644 index 0000000..387ad10 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-home.png differ diff --git a/docs/9.9.1/review/screens/workbench-ongoing-pinned.png b/docs/9.9.1/review/screens/workbench-ongoing-pinned.png new file mode 100644 index 0000000..8d849cd Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-ongoing-pinned.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-arrived.png b/docs/9.9.1/review/screens/workbench-status-arrived.png new file mode 100644 index 0000000..c7ba343 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-arrived.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-outbound.png b/docs/9.9.1/review/screens/workbench-status-outbound.png new file mode 100644 index 0000000..99c84f2 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-outbound.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-paused.png b/docs/9.9.1/review/screens/workbench-status-paused.png new file mode 100644 index 0000000..fb6b96d Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-paused.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-returning.png b/docs/9.9.1/review/screens/workbench-status-returning.png new file mode 100644 index 0000000..aebf738 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-returning.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-returnpaused.png b/docs/9.9.1/review/screens/workbench-status-returnpaused.png new file mode 100644 index 0000000..c952e1e Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-returnpaused.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-shooting.png b/docs/9.9.1/review/screens/workbench-status-shooting.png new file mode 100644 index 0000000..d44a684 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-shooting.png differ diff --git a/docs/9.9.1/review/screens/workbench-status-unknown.png b/docs/9.9.1/review/screens/workbench-status-unknown.png new file mode 100644 index 0000000..db395a7 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-status-unknown.png differ diff --git a/docs/9.9.1/review/screens/workbench-success-returning.png b/docs/9.9.1/review/screens/workbench-success-returning.png new file mode 100644 index 0000000..42fd6c7 Binary files /dev/null and b/docs/9.9.1/review/screens/workbench-success-returning.png differ diff --git a/docs/9.9.1/review/state-document/build_states.py b/docs/9.9.1/review/state-document/build_states.py new file mode 100644 index 0000000..6cf8ecd --- /dev/null +++ b/docs/9.9.1/review/state-document/build_states.py @@ -0,0 +1,231 @@ +from pathlib import Path +from docx import Document +from docx.shared import Inches, Pt, RGBColor +from docx.enum.text import WD_ALIGN_PARAGRAPH +from docx.enum.table import WD_TABLE_ALIGNMENT, WD_CELL_VERTICAL_ALIGNMENT +from docx.oxml import OxmlElement +from docx.oxml.ns import qn + +BASE = Path(__file__).parent +OUT = BASE / '随心瞰9.9.1状态分类与取值清单.docx' +doc = Document() +section = doc.sections[0] +section.page_width = Inches(8.2677) +section.page_height = Inches(11.6929) +section.top_margin = Inches(0.64) +section.bottom_margin = Inches(0.64) +section.left_margin = Inches(0.74) +section.right_margin = Inches(0.74) +section.footer_distance = Inches(0.25) + +def set_font(style, size, bold=False): + style.font.name = 'Heiti SC' + style.font.size = Pt(size) + style.font.bold = bold + style.font.italic = False + style.font.color.rgb = RGBColor(0, 0, 0) + rpr = style.element.get_or_add_rPr() + fonts = rpr.find(qn('w:rFonts')) + if fonts is None: + fonts = OxmlElement('w:rFonts') + rpr.insert(0, fonts) + for k in ('ascii', 'hAnsi', 'eastAsia', 'cs'): + fonts.set(qn('w:' + k), 'Heiti SC') + for c in rpr.findall(qn('w:color')): + for a in ('themeColor', 'themeTint', 'themeShade'): + c.attrib.pop(qn('w:' + a), None) + +set_font(doc.styles['Normal'], 10.5) +set_font(doc.styles['Title'], 22, True) +set_font(doc.styles['Heading 1'], 14, True) +set_font(doc.styles['Heading 2'], 11.5, True) +set_font(doc.styles['Subtitle'], 10.5) +for name in ('Normal', 'Subtitle'): + pf = doc.styles[name].paragraph_format + pf.line_spacing = 1.28 + pf.space_after = Pt(6) +for name in ('Heading 1', 'Heading 2'): + pf = doc.styles[name].paragraph_format + pf.space_before = Pt(12) + pf.space_after = Pt(7) + pf.keep_with_next = True +doc.styles['Title'].paragraph_format.space_after = Pt(8) + +def para(text, bold_prefix=None): + p = doc.add_paragraph() + if bold_prefix and text.startswith(bold_prefix): + p.add_run(bold_prefix).bold = True + p.add_run(text[len(bold_prefix):]) + else: + p.add_run(text) + return p + +def table(rows): + t = doc.add_table(rows=1, cols=2) + t.alignment = WD_TABLE_ALIGNMENT.CENTER + t.autofit = False + widths = (1.4, 5.38) + for col, width in zip(t.columns, widths): + col.width = Inches(width) + for i, text in enumerate(('子状态', '可能的值')): + t.rows[0].cells[i].text = text + repeat = OxmlElement('w:tblHeader') + t.rows[0]._tr.get_or_add_trPr().append(repeat) + for a, b in rows: + r = t.add_row() + r.cells[0].text = a + r.cells[1].text = b + props = t._tbl.tblPr + borders = OxmlElement('w:tblBorders') + for tag in ('top', 'left', 'bottom', 'right', 'insideH', 'insideV'): + e = OxmlElement('w:' + tag) + e.set(qn('w:val'), 'single') + e.set(qn('w:sz'), '4') + e.set(qn('w:color'), 'D9D9D9') + borders.append(e) + props.append(borders) + margins = OxmlElement('w:tblCellMar') + for tag, value in [('top', '90'), ('bottom', '90'), ('left', '110'), ('right', '110')]: + e = OxmlElement('w:' + tag) + e.set(qn('w:w'), value) + e.set(qn('w:type'), 'dxa') + margins.append(e) + props.append(margins) + for ri, r in enumerate(t.rows): + rpr = r._tr.get_or_add_trPr() + cant = OxmlElement('w:cantSplit') + rpr.append(cant) + for ci, c in enumerate(r.cells): + c.width = Inches(widths[ci]) + c.vertical_alignment = WD_CELL_VERTICAL_ALIGNMENT.CENTER + if ri == 0: + fill = OxmlElement('w:shd') + fill.set(qn('w:fill'), 'E8EFF7') + c._tc.get_or_add_tcPr().append(fill) + for p in c.paragraphs: + p.paragraph_format.space_after = Pt(0) + p.paragraph_format.space_before = Pt(0) + p.paragraph_format.line_spacing = 1.18 + p.paragraph_format.keep_with_next = False + for run in p.runs: + run.font.size = Pt(10) + run.font.bold = ri == 0 + run.font.color.rgb = RGBColor(0, 0, 0) + return t + +def category(title, rows, note=None): + doc.add_heading(title, level=1) + table(rows) + if note: + p = para(note) + p.paragraph_format.space_before = Pt(6) + p.paragraph_format.space_after = Pt(5) + +doc.core_properties.title = '随心瞰9.9.1状态分类与取值清单' +doc.core_properties.subject = '需求评审中的业务状态分类与可能取值' +doc.core_properties.author = '随心瞰项目' +doc.core_properties.keywords = '9.9.1, 机巢, 现场销售, 状态分类' + +doc.add_paragraph('随心瞰状态分类与取值清单', style='Title') +doc.add_paragraph('适用版本 9.9.1 日期 2026年10月21日', style='Subtitle') +para('建议将本次需求归纳为 10 大类状态。每类中的子状态分别记录,可以同时存在。例如,同一任务可以是“拍摄成功”,无人机处于“返航中”,素材处于“上传中”。') +para('标有 * 的取值属于建议补充或细节待确认;未标记的取值已有需求语义覆盖。下列中文名称用于需求讨论,不代表最终接口编码,也不表示相关功能已实现。') +para('10 类分别是:套餐、收款与支付、订单与归属、拍摄准备、无人机设备、拍摄任务、操作指令、连接与同步、次数与结算、素材与交付。') + +category('1 套餐状态', [ + ('套餐生命周期', '草稿*、已上架*、已下架*'), +], '创建和维护套餐已提出,但草稿及上下架规则未完整定义。保存中、保存失败属于页面操作反馈,不作为套餐生命周期。') + +category('2 收款与支付状态', [ + ('收款码', '未生成*、生成中*、可用、生成失败*、已失效*'), + ('支付交易', '待支付*、支付结果确认中*、已支付、明确支付失败*、交易已关闭*'), +], '二维码失效不等于支付失败。游客反馈已付款、请求超时或通知延迟时,先核验原交易;明确失败的含义及重新付款规则由支付接口确认。') + +category('3 订单与归属状态', [ + ('订单履约', '待拍摄、进行中、已完成、已取消*、已过期*'), + ('当前归属', '待分配*、归属当前工作人员、归属其他工作人员*、归属待确认*'), + ('当前人权限', '允许操作、仅可查看*、不可访问*、权限待确认*'), + ('退款', '无退款*、退款处理中*、退款成功*、退款失败*'), +], '“已完成”的判据待确认:额度用完是否足够,是否还需素材交付完成。“已转交”表示归属发生变化,不应重置次数或自动触发退款。') + +doc.add_page_break() +category('4 拍摄准备状态', [ + ('点位选择', '未选择、已选择且有效、原选择已失效'), + ('航线选择', '未选择、已选择且有效、原选择已失效'), + ('点位或航线列表', '加载中*、有可用数据、无可用数据、加载失败*'), + ('定位', '位置待确认、定位获取中*、位置有效、未授权*、系统定位关闭*、定位失败*、位置已过期*'), + ('点位范围', '范围内、范围外、范围待确认'), +], '点位与航线分别记录,切点后不能沿用上一个点的航线。范围外允许浏览;未选、失效、定位未知或范围外均不能召唤。“不可召唤”由这些条件与订单、额度、设备条件共同计算。') + +category('5 无人机设备状态', [ + ('飞行阶段', '在巢或地面、起飞中*、前往点位、点位待命、执行拍摄飞行、悬停、返航中、降落中*、状态未知'), + ('任务占用', '空闲、本订单任务占用、其他任务占用、占用状态待确认'), + ('新任务执行许可', '允许执行、暂不允许执行、执行许可待确认'), +], '已回巢后归入地面阶段;检查、充电是否结束由执行许可表达。电量不足等是“不允许执行”的原因,不自行设定电量阈值。返航另保留设备报告的触发原因,保护返航能否暂停由设备确认。') + +category('6 拍摄任务状态', [ + ('业务任务阶段', '前往点位、到达待拍、拍摄中、已暂停、执行已结束、阶段待确认'), + ('拍摄结果', '尚未产生结果、结果待确认、成功、失败、已中断*'), +], '“执行已结束”不代表无人机已回巢。暂停需保留暂停前阶段;返航中暂停后恢复返航。部分拍摄、中途返航和中断是否扣次,需明确成功判据后确定。') + +doc.add_page_break() +category('7 操作指令状态', [ + ('每条指令的反馈', '未发送、处理中、执行已确认、明确失败或被拒绝、结果待确认'), + ('本操作许可', '允许、不允许、待确认*'), +], '召唤、开始拍摄、暂停、恢复、立即返航分别记录上述状态。指令执行已确认不等于拍摄成功;超时不等于明确失败。“恢复”指令也要补齐完整反馈,不能点击后直接显示已恢复。') + +category('8 连接与同步状态', [ + ('手机网络', '在线、离线、网络状态未知*'), + ('任务控制连接', '连接中*、已连接、已断开、重连中*、连接状态未知'), + ('直播图传', '未连接*、连接中*、播放中、断流、重连中*、连接失败*'), + ('遥测数据有效性', '有效、已过期、缺失或未知'), + ('原任务状态同步', '待同步*、同步中*、已同步*、同步失败*'), +], '图传断流时,任务和控制可能仍然有效。手机断网或遥测失效时显示“—”并标明未更新。恢复连接先同步原任务和次数,不能自动重发指令或创建新任务。') + +category('9 次数与结算状态', [ + ('额度可用性', '有可用次数、次数已用完、可用次数待确认*'), + ('本次任务结算', '无需扣次、等待结算*、结算中*、结算完成*、结算结果待核查*'), +], '订单总次数、已成功次数、剩余次数、各点位已成功次数都是数值,不是枚举。执行中的额度占用与扣次分开;同一任务只结算一次。结算未确认或原任务未结束时,不能重复发起新任务。') +para('计数示例:订单总 5 次、已成功 3 次、剩余 2 次,三皇寨已拍 2 次;该点再次成功后变为已成功 4 次、剩余 1 次、该点已拍 3 次。失败时这些数值保持不变。') + +doc.add_page_break() +category('10 素材与交付状态', [ + ('单项素材上传', '待生成或待同步*、上传中、已就绪、上传失败、素材不可用*'), + ('单项文件下载', '未下载、下载中、下载成功、下载失败、已停止'), + ('保存到本机相册', '未保存*、保存中*、已保存、保存失败*'), + ('相册添加权限', '未请求*、允许添加、已拒绝、受系统限制*'), + ('当前批次汇总', '未开始、处理中、部分成功、全部成功、全部失败*、已停止'), + ('游客交付跟踪', '未交付*、待领取*、已领取*、交付失败*'), +], '批次汇总由逐项结果计算,上传、下载、保存分开汇总。下载成功还不等于写入相册成功;本机已保存也不等于游客已领取。游客交付是否新增状态跟踪,需先确认本版范围。') + +doc.add_heading('状态组合示例', level=1) +table([ + ('成功但仍在返航', '拍摄结果=成功;飞行阶段=返航中;素材=上传中。'), + ('失败后暂不能重拍', '拍摄结果=失败;飞行阶段=返航中;新任务执行许可=不允许。'), + ('画面断开但任务在线', '图传=断流;控制连接=已连接;任务阶段=拍摄中。'), + ('仅一份下载失败', '3 份已保存,1 份下载失败;只重试失败项,拍摄次数不变。'), +]) + +doc.add_heading('需要优先确认的边界', level=1) +para('优先确认订单完成判据、拍摄成功与中断判据、暂停恢复目标、支付后订单归属、退款是否纳入本版,以及素材上传最终失败后的交付或补偿规则。') +para('错误原因随对应状态保存,例如电量不足、指令被拒绝、存储空间不足。按钮是否可用由当前条件和设备许可计算,避免将每一种原因再增加为同级业务状态。') + +doc.add_heading('依据', level=1) +p = para('随心瞰9.9.1.md、图片和附件中的 README.md 与状态截图,以及本次需求流程评审。标有 * 的取值在确认前不作为已定业务规则。') +p.paragraph_format.space_after = Pt(0) + +footer = section.footer.paragraphs[0] +footer.alignment = WD_ALIGN_PARAGRAPH.RIGHT +r = footer.add_run('第 ') +r.font.size = Pt(9) +field = OxmlElement('w:fldSimple') +field.set(qn('w:instr'), 'PAGE') +footer._p.append(field) +r = footer.add_run(' 页') +r.font.size = Pt(9) + +for element in [doc.element, doc.styles.element]: + for border in list(element.iter(qn('w:pBdr'))): + border.getparent().remove(border) +doc.save(OUT) +print(OUT) diff --git a/docs/9.9.1/review/state-document/render-final/page-1.png b/docs/9.9.1/review/state-document/render-final/page-1.png new file mode 100644 index 0000000..b0b9b01 Binary files /dev/null and b/docs/9.9.1/review/state-document/render-final/page-1.png differ diff --git a/docs/9.9.1/review/state-document/render-final/page-2.png b/docs/9.9.1/review/state-document/render-final/page-2.png new file mode 100644 index 0000000..f58cf5e Binary files /dev/null and b/docs/9.9.1/review/state-document/render-final/page-2.png differ diff --git a/docs/9.9.1/review/state-document/render-final/page-3.png b/docs/9.9.1/review/state-document/render-final/page-3.png new file mode 100644 index 0000000..2731ee0 Binary files /dev/null and b/docs/9.9.1/review/state-document/render-final/page-3.png differ diff --git a/docs/9.9.1/review/state-document/render-final/page-4.png b/docs/9.9.1/review/state-document/render-final/page-4.png new file mode 100644 index 0000000..ee2e2a4 Binary files /dev/null and b/docs/9.9.1/review/state-document/render-final/page-4.png differ diff --git a/docs/9.9.1/review/state-document/render-final/随心瞰9.9.1状态分类与取值清单.pdf b/docs/9.9.1/review/state-document/render-final/随心瞰9.9.1状态分类与取值清单.pdf new file mode 100644 index 0000000..e6c470d Binary files /dev/null and b/docs/9.9.1/review/state-document/render-final/随心瞰9.9.1状态分类与取值清单.pdf differ diff --git a/docs/9.9.1/review/state-document/随心瞰9.9.1状态分类与取值清单.docx b/docs/9.9.1/review/state-document/随心瞰9.9.1状态分类与取值清单.docx new file mode 100644 index 0000000..6dafe18 Binary files /dev/null and b/docs/9.9.1/review/state-document/随心瞰9.9.1状态分类与取值清单.docx differ diff --git a/docs/9.9.1/review/state-flows-workbench.html b/docs/9.9.1/review/state-flows-workbench.html new file mode 100644 index 0000000..93da0a0 --- /dev/null +++ b/docs/9.9.1/review/state-flows-workbench.html @@ -0,0 +1,256 @@ + +
    +
    从左向右 · 原需求 / 建议补充
    +
    +
    +
    + diff --git a/docs/9.9.1/review/state-flows.html b/docs/9.9.1/review/state-flows.html new file mode 100644 index 0000000..93da0a0 --- /dev/null +++ b/docs/9.9.1/review/state-flows.html @@ -0,0 +1,256 @@ + +
    +
    从左向右 · 原需求 / 建议补充
    +
    +
    +
    + diff --git a/docs/9.9.1/review/verification.json b/docs/9.9.1/review/verification.json new file mode 100644 index 0000000..cc2a5d5 --- /dev/null +++ b/docs/9.9.1/review/verification.json @@ -0,0 +1,90 @@ +{ + "status": "passed", + "checks": [ + { + "flow": "01-sales", + "stateCount": 6 + }, + { + "flow": "02-shooting", + "stateCount": 7 + }, + { + "flow": "03-pause-return", + "stateCount": 6 + }, + { + "flow": "04-failure", + "stateCount": 5 + }, + { + "flow": "05-network-command", + "stateCount": 6 + }, + { + "flow": "06-readiness", + "stateCount": 6 + }, + { + "flow": "07-quota", + "stateCount": 5 + }, + { + "flow": "08-media", + "stateCount": 6 + }, + { + "flow": "09-commerce-exceptions", + "stateCount": 5 + }, + { + "flow": "10-web", + "stateCount": 5 + }, + { + "flow": "11-workbench-resume", + "stateCount": 4 + }, + { + "flow": "12-workbench-task-states", + "stateCount": 7 + } + ], + "checksIncluded": [ + "flow selection", + "material selection consistency", + "unknown material count", + "offline telemetry", + "no quota reset", + "all screenshot links resolve", + "390px report layout" + ], + "runtimeErrors": [], + "responsive": { + "viewport": 390, + "pageWidth": 390, + "scrollStrip": 2336, + "stripViewport": 358 + }, + "workbenchReturn": { + "flows": 2, + "screens": 11, + "activeOrderPinned": true, + "originalTaskPreserved": true, + "successfulReturnBothStatesVisible": true, + "allScreenBottomsVisuallyChecked": true + }, + "workbenchCardUpdate": { + "flowIds": [ + "11-workbench-resume", + "12-workbench-task-states" + ], + "screenCount": 11, + "preservesHorizontalCardLayout": true, + "rightSideTaskButton": "查看当前任务", + "taskStatusPosition": "top right", + "pointDetailsVisible": false, + "individualAndCompositeImagesVisuallyChecked": true, + "footerAndCardClippingChecksPassed": true + } +} \ No newline at end of file diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/checks.json b/docs/9.9.1/review/workbench-return/11-workbench-resume/checks.json new file mode 100644 index 0000000..8c448f9 --- /dev/null +++ b/docs/9.9.1/review/workbench-return/11-workbench-resume/checks.json @@ -0,0 +1,129 @@ +{ + "flow": { + "id": "11-workbench-resume", + "name": "11 任务页返回工作台与重新进入", + "note": "已确认:执行中点击返回直接回工作台,不弹确认;当前任务订单置顶,显示状态和查看当前任务。保留原卡片样式,仅改按钮标题并在右上角显示状态,不展示点位。前三屏为同一任务,最后一屏为成功返航分支。", + "states": [ + { + "id": "task-before-leave", + "label": "拍摄中 · 点击左上角返回", + "kind": "flight", + "mode": "shooting", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "直接返回机巢工作台;离开页面不取消任务、不重发指令、不扣次数。" + }, + { + "id": "workbench-ongoing-pinned", + "label": "回到工作台 · 当前任务订单置顶", + "kind": "workbench", + "phase": "shooting", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "当前用户当前景区的订单中,任务订单置顶;右上角显示拍摄中,按钮为查看当前任务;保留原卡片横向布局,不展示点位或航线。" + }, + { + "id": "task-after-reenter", + "label": "查看当前任务 · 回到原任务", + "kind": "flight", + "mode": "shooting", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "继续查看同一订单、同一次任务;不重新进入准备,不创建第二次拍摄。" + }, + { + "id": "workbench-success-returning", + "label": "成功后仍返航 · 两种状态同时显示", + "kind": "workbench", + "phase": "returning", + "result": "success", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "拍摄已完成与无人机返航中同时展示;已拍4次、剩1次,仍保留查看当前任务。" + } + ] + }, + "checks": [ + { + "id": "task-before-leave", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "01 拍摄中 · 点击左上角返回\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n拍摄任务\n帮助\n三皇寨 · 经典航线\n游客尾号 6631 · 含 5 次拍摄\n任务控制已连接\n+\n图传区域示意 · 不代表真实直播\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n设备遥测 · 刚刚更新\n任务控制已连接\n无人机正在拍摄\n请保持当前任务,等待设备上报拍摄结果。\n拍摄中\n执行中 · 尚未扣次\n安全控制\n紧急暂停\n立即返航\n直接返回机巢工作台;离开页面不取消任务、不重发指令、不扣次数。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-ongoing-pinned", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "02 回到工作台 · 当前任务订单置顶\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n本订单任务执行中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n拍摄中\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n当前用户当前景区的订单中,任务订单置顶;右上角显示拍摄中,按钮为查看当前任务;保留原卡片横向布局,不展示点位或航线。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "task-after-reenter", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "03 查看当前任务 · 回到原任务\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n拍摄任务\n帮助\n三皇寨 · 经典航线\n游客尾号 6631 · 含 5 次拍摄\n任务控制已连接\n+\n图传区域示意 · 不代表真实直播\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n设备遥测 · 刚刚更新\n任务控制已连接\n无人机正在拍摄\n请保持当前任务,等待设备上报拍摄结果。\n拍摄中\n执行中 · 尚未扣次\n安全控制\n紧急暂停\n立即返航\n继续查看同一订单、同一次任务;不重新进入准备,不创建第二次拍摄。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-success-returning", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "04 成功后仍返航 · 两种状态同时显示\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n无人机返航中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n拍摄已完成 · 无人机返航中\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 4次\n剩余 1次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n拍摄已完成与无人机返航中同时展示;已拍4次、剩1次,仍保留查看当前任务。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + } + ] +} \ No newline at end of file diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/footer.png b/docs/9.9.1/review/workbench-return/11-workbench-resume/footer.png new file mode 100644 index 0000000..3943364 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/11-workbench-resume/footer.png differ diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/header.png b/docs/9.9.1/review/workbench-return/11-workbench-resume/header.png new file mode 100644 index 0000000..aff4e94 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/11-workbench-resume/header.png differ diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/task-after-reenter.png b/docs/9.9.1/review/workbench-return/11-workbench-resume/task-after-reenter.png new file mode 100644 index 0000000..cb3ccb5 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/11-workbench-resume/task-after-reenter.png differ diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/task-before-leave.png b/docs/9.9.1/review/workbench-return/11-workbench-resume/task-before-leave.png new file mode 100644 index 0000000..8150df7 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/11-workbench-resume/task-before-leave.png differ diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/workbench-ongoing-pinned.png b/docs/9.9.1/review/workbench-return/11-workbench-resume/workbench-ongoing-pinned.png new file mode 100644 index 0000000..8d849cd Binary files /dev/null and b/docs/9.9.1/review/workbench-return/11-workbench-resume/workbench-ongoing-pinned.png differ diff --git a/docs/9.9.1/review/workbench-return/11-workbench-resume/workbench-success-returning.png b/docs/9.9.1/review/workbench-return/11-workbench-resume/workbench-success-returning.png new file mode 100644 index 0000000..42fd6c7 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/11-workbench-resume/workbench-success-returning.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/checks.json b/docs/9.9.1/review/workbench-return/12-workbench-task-states/checks.json new file mode 100644 index 0000000..37f2fc8 --- /dev/null +++ b/docs/9.9.1/review/workbench-return/12-workbench-task-states/checks.json @@ -0,0 +1,220 @@ +{ + "flow": { + "id": "12-workbench-task-states", + "name": "12 工作台订单卡片的任务状态提示", + "note": "七屏为同一订单在不同状态下的独立示例。保留原卡片横向布局及右侧按钮,仅替换为查看当前任务并在右上角显示状态;卡片不展示点位与航线。", + "states": [ + { + "id": "workbench-status-outbound", + "label": "前往点位 · 前往拍摄点中", + "kind": "workbench", + "phase": "outbound", + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "右上角显示前往拍摄点中;查看当前任务回到原任务页面。" + }, + { + "id": "workbench-status-arrived", + "label": "已到达 · 待拍摄", + "kind": "workbench", + "phase": "arrived", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示已到达,待拍摄;开始拍摄操作仍在任务页,不直接放到订单卡片。" + }, + { + "id": "workbench-status-shooting", + "label": "拍摄中", + "kind": "workbench", + "phase": "shooting", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示拍摄中;未确认成功时,订单已拍次数与剩余次数保持不变。" + }, + { + "id": "workbench-status-paused", + "label": "拍摄已暂停", + "kind": "workbench", + "phase": "paused", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示拍摄已暂停;进入原任务页后,按实际许可继续拍摄或返航。" + }, + { + "id": "workbench-status-returning", + "label": "返航中 · 拍摄结果待确认", + "kind": "workbench", + "phase": "returning", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "右上角显示返航中;示例结果仍待确认,暂不扣次数,不将返航直接判成功或失败。" + }, + { + "id": "workbench-status-returnpaused", + "label": "返航已暂停", + "kind": "workbench", + "phase": "returnpaused", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "显示返航已暂停,区别于拍摄暂停;进入任务页继续返航,不能误恢复拍摄。" + }, + { + "id": "workbench-status-unknown", + "label": "任务状态待确认", + "kind": "workbench", + "phase": "unknown", + "branchStart": true, + "confirmed": true, + "orderId": "202610210031", + "taskId": "T0031", + "caption": "保留当前任务入口;未知读数显示—,工作台标明待同步,卡片保留原字段与布局。" + } + ] + }, + "checks": [ + { + "id": "workbench-status-outbound", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "01 前往点位 · 前往拍摄点中\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n本订单任务执行中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n前往拍摄点中\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n右上角显示前往拍摄点中;查看当前任务回到原任务页面。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-status-arrived", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "02 已到达 · 待拍摄\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n本订单任务执行中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n已到达,待拍摄\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n显示已到达,待拍摄;开始拍摄操作仍在任务页,不直接放到订单卡片。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-status-shooting", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "03 拍摄中\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n本订单任务执行中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n拍摄中\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n显示拍摄中;未确认成功时,订单已拍次数与剩余次数保持不变。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-status-paused", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "04 拍摄已暂停\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n本订单任务执行中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n拍摄已暂停\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n显示拍摄已暂停;进入原任务页后,按实际许可继续拍摄或返航。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-status-returning", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "05 返航中 · 拍摄结果待确认\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n无人机返航中\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n返航中\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n右上角显示返航中;示例结果仍待确认,暂不扣次数,不将返航直接判成功或失败。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-status-returnpaused", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "06 返航已暂停\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n机巢已连接 · 刚刚更新\n无人机状态\n返航已暂停\n电池电量\n85%\n环境温度\n20.3°C\n风速\n0 m/s\n雨量\n无雨\n信号状态\n良好\n搜星状态\n36 颗\n我的拍摄订单\n查看全部 ›\n游客158****6631\n返航已暂停\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务订单已置顶\n显示返航已暂停,区别于拍摄暂停;进入任务页继续返航,不能误恢复拍摄。", + "telemetry": [ + "85%", + "20.3°C", + "0 m/s", + "无雨", + "良好", + "36 颗" + ] + }, + { + "id": "workbench-status-unknown", + "phoneHeight": 844, + "footerVisible": true, + "mainContentClipped": false, + "activeCardFullyVisible": true, + "activeOrderFirst": true, + "taskId": "T0031", + "orderId": "202610210031", + "bodyText": "07 任务状态待确认\n已确认 · App交互规则\n9:41\n▰ ▰▰ ▱\n‹ 返回\n机巢工作台\n刷新\n嵩山少林景区\n设备状态待同步\n无人机状态\n状态待确认\n电池电量\n—\n环境温度\n—\n风速\n—\n雨量\n—\n信号状态\n—\n搜星状态\n—\n我的拍摄订单\n查看全部 ›\n游客158****6631\n任务状态待确认\n\n航拍套餐 · 含5次拍摄\n\n已拍摄 3次\n剩余 2次\n查看当前任务\n↑ 上传中\n▧ 查看素材 ›\n游客136****2806\n待拍摄\n\n单次航拍 · 含1次拍摄\n\n已拍摄 0次\n剩余 1次\n开始拍摄\n当前任务与次数待同步\n保留当前任务入口;未知读数显示—,工作台标明待同步,卡片保留原字段与布局。", + "telemetry": [ + "—", + "—", + "—", + "—", + "—", + "—" + ] + } + ] +} \ No newline at end of file diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/footer.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/footer.png new file mode 100644 index 0000000..3943364 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/footer.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/header.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/header.png new file mode 100644 index 0000000..51bfe5e Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/header.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-arrived.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-arrived.png new file mode 100644 index 0000000..c7ba343 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-arrived.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-outbound.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-outbound.png new file mode 100644 index 0000000..99c84f2 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-outbound.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-paused.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-paused.png new file mode 100644 index 0000000..fb6b96d Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-paused.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-returning.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-returning.png new file mode 100644 index 0000000..aebf738 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-returning.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-returnpaused.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-returnpaused.png new file mode 100644 index 0000000..c952e1e Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-returnpaused.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-shooting.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-shooting.png new file mode 100644 index 0000000..d44a684 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-shooting.png differ diff --git a/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-unknown.png b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-unknown.png new file mode 100644 index 0000000..db395a7 Binary files /dev/null and b/docs/9.9.1/review/workbench-return/12-workbench-task-states/workbench-status-unknown.png differ diff --git a/docs/9.9.1/review/使用说明.txt b/docs/9.9.1/review/使用说明.txt new file mode 100644 index 0000000..ab536e2 --- /dev/null +++ b/docs/9.9.1/review/使用说明.txt @@ -0,0 +1,6 @@ +随心瞰9.9.1需求评审 +打开review.html查看完整报告与12组横向状态图。 +flows/包含12张整图,screens/包含68张单独界面截图。 +新增第11组为任务返回工作台与重新进入,第12组为订单卡片七种任务提示。 +第03组保留已修复的完整长图。 +本次仅更新需求评审稿,未修改App业务代码。 diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/README.md b/docs/9.9.1/safety-command-mock-2026-10-30/README.md new file mode 100644 index 0000000..f3fe02e --- /dev/null +++ b/docs/9.9.1/safety-command-mock-2026-10-30/README.md @@ -0,0 +1,61 @@ +# 拍摄任务底部安全控制:本地模拟调试 + +日期:2026-10-30。全部请求与回执来自纯内存 Mock,**未访问后端、未向无人机发送指令**,不代表后端受理或设备执行成功。 + +## 接口合同 + +朱工提供 `POST /api/app/airport/command`,只发送同一订单飞行任务的 `id` 和指令码: + +| 按钮 | command | +| --- | --- | +| 紧急暂停 | `flighttask_pause` | +| 继续拍摄 | `flighttask_recovery` | +| 立即返航 | `return_home` | +| 取消返航 | `return_home_cancel` | + +不传 `plane_id`、`airport_sn`,也不编造 `dry_run` 参数。响应解析 `order_flight_task_id`、`command`、`airport_sn`、任意 JSON 类型的 `dji_status` 和非实时 `metrics`;回显任务及指令必须与请求一致。 + +成功后只查询同一任务 `shooting` 一次,不轮询;受理回执不直接代替设备状态。底部两列分别展示暂停/继续、返航/取消返航,位置固定。 + +## 模拟入口与场景 + +- Debug 启动参数 `--dock-command-mock`:直接进入合成任务 `901` 的模拟拍摄中。 +- `--dock-command-result=success`(默认)、`business-failure`、`timeout` 分别验证成功、明确拒绝与结果未知。 +- 原有准备页“本地模拟”及 `--dock-preparation-mock`、`--dock-start-shoot-mock` 也接入同一内存指令服务;不携带真实订单或设备身份。 +- 右上角文档图标展示当前模拟会话的完整请求、响应及错误,含 `source=local_mock`、`network_sent=false`。 + +真实入口仍未注入指令服务,按钮禁用。Debug 统一网络层的禁飞拦截未改动;普通传输即使实例化指令 API,也会在发送前被拦截。模拟传输仅接受 `https://mock.invalid` 的已知请求,未知请求本地失败,无网络回退能力。 + +## 交互与状态边界 + +- 必须存在有效任务、锁定飞机及明确的 `ui.commands` 白名单指令;缺失或未知指令不开放按钮。不用开拍门禁推导暂停/返航权限。 +- 连点只提交一次;开拍、指令和刷新互斥,等待时保留旧阶段与六项读数。 +- 明确业务拒绝可由用户再次点击重试;超时、错误回执或发送后取消会锁定控制操作,只允许读取状态,不自动重试。 +- 回查仍为旧数据时,所有已受理且仍出现在旧列表的指令分别保持防重锁,不能通过暂停/返航交替点击绕过。 +- 立即返航先弹确认。本地状态按文档模拟任务中断;取消返航后任务仍中断,不恢复任务、自动开拍或新建任务。该模拟状态是测试场景,不是后端当前行为的实测证据。 +- 离页、后台和身份变化会使迟到响应失效。 + +## 验证 + +首轮模拟器相关测试 99 项全部通过,覆盖 API、ViewModel、UI、既有开拍/准备流程和禁飞保护。防重复边界修正后,18 项指令 ViewModel 测试与 1 项暂停/恢复 UI 测试再次全部通过;累计 100 项不同测试通过。构建通过,`git diff --check` 通过。 + +- 首轮结果包:`test_sim_2026-10-30T02-17-48-735Z_pid48214_75e97ac8.xcresult`。 +- 最终结果包:`test_sim_2026-10-30T02-20-02-298Z_pid48214_c1e1a9c1.xcresult`。 +- 手动操作:在 iPhone 18 Pro / iOS 27 模拟器依次点击暂停、继续、返航并确认、取消返航;共 9 次本地交换(首次 GET + 4 组 POST/GET),全程任务 `901`。 +- [完整成功流程请求与回执](success-flow.mock.json):从本次实际模拟器操作日志提取,四个指令均有模拟 `code=100000` 回执。 +- [明确拒绝及再次点击记录](business-failure.mock.json)、[超时及只读刷新记录](timeout.mock.json):来自隔离 UI 测试附件。 +- 暂停后按钮变为继续;返航后只开放取消返航;取消后保持任务中断且控制按钮禁用。 + +## 模拟器截图 + +暂停后: + +![暂停成功(纯本地模拟)](paused-mock.png) + +返航中断任务后: + +![取消返航入口(纯本地模拟)](returning-mock.png) + +[取消返航后的中断状态](return-cancelled-mock.png) · [返航确认弹窗](return-confirmation-mock.png) · [超时结果待核对](timeout-mock.png) + +后续真实联调仍需在用户解除禁飞限制后进行,并核对后端不同阶段的 `ui.commands`、返航中断与取消返航的实际响应。本次不验证真实网络、设备飞行或素材产生。 diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/business-failure.mock.json b/docs/9.9.1/safety-command-mock-2026-10-30/business-failure.mock.json new file mode 100644 index 0000000..c3691fd --- /dev/null +++ b/docs/9.9.1/safety-command-mock-2026-10-30/business-failure.mock.json @@ -0,0 +1,154 @@ +{ + "command_scenario" : "business-failure", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 拍摄中 · 电量95%", + "work_status" : 2, + "work_status_label" : "拍摄中" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "already_started", + "message" : "本地模拟:开拍已受理", + "primary_action" : "shooting", + "primary_action_label" : "拍摄中" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "shooting", + "title" : "无人机正在拍摄中(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "http_status" : 200, + "method" : "POST", + "path" : "/api/app/airport/command", + "request_body" : { + "command" : "flighttask_pause", + "id" : 901 + }, + "response_body" : { + "code" : 100099, + "data" : { + + }, + "msg" : "本地模拟:指令被拒绝,未改变任务状态" + } + }, + { + "http_status" : 200, + "method" : "POST", + "path" : "/api/app/airport/command", + "request_body" : { + "command" : "flighttask_pause", + "id" : 901 + }, + "response_body" : { + "code" : 100099, + "data" : { + + }, + "msg" : "本地模拟:指令被拒绝,未改变任务状态" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/paused-mock.png b/docs/9.9.1/safety-command-mock-2026-10-30/paused-mock.png new file mode 100644 index 0000000..cb2dea3 Binary files /dev/null and b/docs/9.9.1/safety-command-mock-2026-10-30/paused-mock.png differ diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/return-cancelled-mock.png b/docs/9.9.1/safety-command-mock-2026-10-30/return-cancelled-mock.png new file mode 100644 index 0000000..584a6e5 Binary files /dev/null and b/docs/9.9.1/safety-command-mock-2026-10-30/return-cancelled-mock.png differ diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/return-confirmation-mock.png b/docs/9.9.1/safety-command-mock-2026-10-30/return-confirmation-mock.png new file mode 100644 index 0000000..e92a2d6 Binary files /dev/null and b/docs/9.9.1/safety-command-mock-2026-10-30/return-confirmation-mock.png differ diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/returning-mock.png b/docs/9.9.1/safety-command-mock-2026-10-30/returning-mock.png new file mode 100644 index 0000000..990f753 Binary files /dev/null and b/docs/9.9.1/safety-command-mock-2026-10-30/returning-mock.png differ diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/success-flow.mock.json b/docs/9.9.1/safety-command-mock-2026-10-30/success-flow.mock.json new file mode 100644 index 0000000..b2ef43f --- /dev/null +++ b/docs/9.9.1/safety-command-mock-2026-10-30/success-flow.mock.json @@ -0,0 +1,745 @@ +{ + "source": "local_mock", + "description": "模拟器实际点击,纯内存处理,未调用后端或设备", + "network_sent": false, + "task_id": 901, + "records": [ + { + "method": "GET", + "path": "/api/app/airport/shooting", + "query": "id=901&live_battery=1", + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 拍摄中 · 电量95%", + "work_status": 2, + "work_status_label": "拍摄中" + }, + "execute_gate": { + "can_execute": false, + "code": "already_started", + "message": "本地模拟:开拍已受理", + "primary_action": "shooting", + "primary_action_label": "拍摄中" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "本地模拟状态回查,未向设备发送指令。", + "phase": "shooting", + "title": "无人机正在拍摄中(模拟)" + } + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/app/airport/command", + "request_body": { + "id": 901, + "command": "flighttask_pause" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "command": "flighttask_pause", + "dji_status": "paused", + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task_id": 901 + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/shooting", + "query": "id=901&live_battery=1", + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 悬停中 · 电量95%", + "work_status": 2, + "work_status_label": "悬停中" + }, + "execute_gate": { + "can_execute": false, + "code": "already_started", + "message": "本地模拟:开拍已受理", + "primary_action": "paused", + "primary_action_label": "拍摄中" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "ui": { + "commands": [ + { + "command": "flighttask_recovery", + "label": "继续拍摄", + "sub": "恢复航线" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "本地模拟状态回查,未向设备发送指令。", + "phase": "paused", + "title": "拍摄已暂停(模拟)" + } + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/app/airport/command", + "request_body": { + "id": 901, + "command": "flighttask_recovery" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "command": "flighttask_recovery", + "dji_status": "shooting", + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task_id": 901 + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/shooting", + "query": "id=901&live_battery=1", + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 拍摄中 · 电量95%", + "work_status": 2, + "work_status_label": "拍摄中" + }, + "execute_gate": { + "can_execute": false, + "code": "already_started", + "message": "本地模拟:开拍已受理", + "primary_action": "shooting", + "primary_action_label": "拍摄中" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "本地模拟状态回查,未向设备发送指令。", + "phase": "shooting", + "title": "无人机正在拍摄中(模拟)" + } + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/app/airport/command", + "request_body": { + "id": 901, + "command": "return_home" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "command": "return_home", + "dji_status": "returning", + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task_id": 901 + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/shooting", + "query": "id=901&live_battery=1", + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 返航中 · 电量95%", + "work_status": 2, + "work_status_label": "返航中" + }, + "execute_gate": { + "can_execute": false, + "code": "return_home", + "message": "本地模拟:开拍已受理", + "primary_action": "returning", + "primary_action_label": "拍摄中" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "result_code": "return_home", + "result_message": "本地模拟:立即返航中断任务;无人机返航中。", + "scenic_id": 128, + "status": 40, + "status_label": "任务已中断(模拟)", + "wayline_status": 40, + "wayline_status_label": "已中断(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "result_code": "return_home", + "result_message": "本地模拟:立即返航中断任务;无人机返航中。", + "scenic_id": 128, + "status": 40, + "status_label": "任务已中断(模拟)", + "wayline_status": 40, + "wayline_status_label": "已中断(模拟)" + }, + "ui": { + "commands": [ + { + "command": "return_home_cancel", + "label": "取消返航", + "sub": "不恢复已中断任务" + } + ], + "message": "本地模拟:立即返航中断任务;无人机返航中", + "phase": "returning", + "title": "本地模拟:立即返航中断任务;无人机返航中" + } + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/app/airport/command", + "request_body": { + "command": "return_home_cancel", + "id": 901 + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "command": "return_home_cancel", + "dji_status": "failed", + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task_id": 901 + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/shooting", + "query": "id=901&live_battery=1", + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 悬停中 · 电量95%", + "work_status": 2, + "work_status_label": "悬停中" + }, + "execute_gate": { + "can_execute": false, + "code": "return_home", + "message": "本地模拟:开拍已受理", + "primary_action": "failed", + "primary_action_label": "拍摄中" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "result_code": "return_home", + "result_message": "本地模拟:返航已取消,任务仍已中断,不能继续拍摄。", + "scenic_id": 128, + "status": 40, + "status_label": "任务已中断(模拟)", + "wayline_status": 40, + "wayline_status_label": "已中断(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "result_code": "return_home", + "result_message": "本地模拟:返航已取消,任务仍已中断,不能继续拍摄。", + "scenic_id": 128, + "status": 40, + "status_label": "任务已中断(模拟)", + "wayline_status": 40, + "wayline_status_label": "已中断(模拟)" + }, + "ui": { + "commands": [], + "message": "本地模拟:返航已取消,任务仍已中断", + "phase": "failed", + "title": "本地模拟:返航已取消,任务仍已中断" + } + }, + "msg": "local mock success" + } + } + ] +} diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/timeout-mock.png b/docs/9.9.1/safety-command-mock-2026-10-30/timeout-mock.png new file mode 100644 index 0000000..c10ead2 Binary files /dev/null and b/docs/9.9.1/safety-command-mock-2026-10-30/timeout-mock.png differ diff --git a/docs/9.9.1/safety-command-mock-2026-10-30/timeout.mock.json b/docs/9.9.1/safety-command-mock-2026-10-30/timeout.mock.json new file mode 100644 index 0000000..7001e2e --- /dev/null +++ b/docs/9.9.1/safety-command-mock-2026-10-30/timeout.mock.json @@ -0,0 +1,244 @@ +{ + "command_scenario" : "timeout", + "description" : "纯内存模拟,未调用后端或设备", + "network_sent" : false, + "records" : [ + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 拍摄中 · 电量95%", + "work_status" : 2, + "work_status_label" : "拍摄中" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "already_started", + "message" : "本地模拟:开拍已受理", + "primary_action" : "shooting", + "primary_action_label" : "拍摄中" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "shooting", + "title" : "无人机正在拍摄中(模拟)" + } + }, + "msg" : "local mock success" + } + }, + { + "error" : "未能完成操作。(NSURLErrorDomain错误-1001。)", + "method" : "POST", + "path" : "/api/app/airport/command", + "request_body" : { + "command" : "flighttask_pause", + "id" : 901 + } + }, + { + "http_status" : 200, + "method" : "GET", + "path" : "/api/app/airport/shooting", + "query" : "id=901&live_battery=1", + "response_body" : { + "code" : 100000, + "data" : { + "air_line" : { + "id" : 401, + "name" : "模拟航线", + "scenic_spot_id" : 301 + }, + "current_plane" : { + "id" : 201, + "online_status" : 1, + "sn_number" : "LOCAL-MOCK-PLANE-201", + "status_text" : "本地模拟 · 拍摄中 · 电量95%", + "work_status" : 2, + "work_status_label" : "拍摄中" + }, + "execute_gate" : { + "can_execute" : false, + "code" : "already_started", + "message" : "本地模拟:开拍已受理", + "primary_action" : "shooting", + "primary_action_label" : "拍摄中" + }, + "header" : { + "order_number" : "LOCAL-MOCK-ORDER-901", + "package_name" : "模拟套餐 · 含5次拍摄", + "title" : "模拟点位 · 模拟航线", + "tourist_label" : "本地模拟,无设备指令" + }, + "metrics" : [ + { + "key" : "battery", + "value" : "95%" + }, + { + "key" : "env_temp", + "value" : "20.3℃" + }, + { + "key" : "wind_speed", + "value" : "0m/s" + }, + { + "key" : "rainfall", + "value" : "无雨" + }, + { + "key" : "signal", + "value" : "良好" + }, + { + "key" : "satellite", + "value" : "36颗" + } + ], + "order_flight_task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "order_number" : "LOCAL-MOCK-ORDER-901", + "plane_status" : { + "connected" : true, + "poll_hint_ms" : 5000, + "scenic_id" : 128 + }, + "scenic" : { + "id" : 128, + "name" : "本地模拟景区" + }, + "scenic_spot" : { + "id" : 301, + "name" : "模拟点位" + }, + "task" : { + "id" : 901, + "order_number" : "LOCAL-MOCK-ORDER-901", + "scenic_id" : 128, + "status" : 20, + "status_label" : "执行中(模拟)", + "wayline_status" : 20, + "wayline_status_label" : "执行中(模拟)" + }, + "ui" : { + "commands" : [ + { + "command" : "flighttask_pause", + "label" : "紧急暂停", + "sub" : "悬停待命" + }, + { + "command" : "return_home", + "label" : "立即返航", + "sub" : "中断任务" + } + ], + "message" : "本地模拟状态回查,未向设备发送指令。", + "phase" : "shooting", + "title" : "无人机正在拍摄中(模拟)" + } + }, + "msg" : "local mock success" + } + } + ], + "scenario" : "success", + "source" : "local_mock" +} \ No newline at end of file diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/completed.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/completed.png new file mode 100644 index 0000000..0965e92 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/completed.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/date-filter.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/date-filter.png new file mode 100644 index 0000000..0447591 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/date-filter.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/date-result.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/date-result.png new file mode 100644 index 0000000..9cefa2a Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/date-result.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/downloading.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/downloading.png new file mode 100644 index 0000000..08d3f03 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/downloading.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/evidence.json b/docs/9.9.1/scenic-materials-ui-2026-10-26/evidence.json new file mode 100644 index 0000000..7b5b736 --- /dev/null +++ b/docs/9.9.1/scenic-materials-ui-2026-10-26/evidence.json @@ -0,0 +1,119 @@ +{ + "date": "2026-10-26", + "tests": 24, + "failures": 0, + "screenshots": [ + { + "file": "paused.png", + "state": "空镜库-后台暂停待继续", + "test": "ScenicMaterialsFlowViewTests/testBackgroundPausesRejectsStaleCallbacksAndRequiresManualResume()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999280.445 + }, + { + "file": "permission.png", + "state": "空镜库-相册权限演示说明", + "test": "ScenicMaterialsFlowViewTests/testDeniedDemoPermissionShowsExplanationWithoutStartingBatch()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999283.667 + }, + { + "file": "completed.png", + "state": "空镜库-下载演示完成", + "test": "ScenicMaterialsFlowViewTests/testDownloadButtonCompletesLocalDemoAndKeepsSuccessfulClipUnavailable()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999286.855 + }, + { + "file": "downloading.png", + "state": "空镜库-本地下载演示", + "test": "ScenicMaterialsFlowViewTests/testDownloadButtonCompletesLocalDemoAndKeepsSuccessfulClipUnavailable()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999285.283 + }, + { + "file": "expanded-simulator.jpg", + "state": "空镜库-展开第六段", + "test": "ScenicMaterialsFlowViewTests/testIndependentEntryAndSixClipGroupSelectionAcrossExpandedLayout()", + "source": "iPhone 18 Pro Simulator visual check", + "verification": "Physical layout test passed; blank XCTest image replaced by verified simulator capture" + }, + { + "file": "group-selected.png", + "state": "空镜库-整组六段含折叠选择", + "test": "ScenicMaterialsFlowViewTests/testIndependentEntryAndSixClipGroupSelectionAcrossExpandedLayout()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999559.928, + "verification": "Final expanded-layout retest" + }, + { + "file": "selected.png", + "state": "空镜库-双列片段选择", + "test": "ScenicMaterialsFlowViewTests/testIndependentEntryAndSixClipGroupSelectionAcrossExpandedLayout()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999558.906, + "verification": "Final expanded-layout retest" + }, + { + "file": "library.png", + "state": "空镜库-常态首段与双列", + "test": "ScenicMaterialsFlowViewTests/testIndependentEntryAndSixClipGroupSelectionAcrossExpandedLayout()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999558.633, + "verification": "Final expanded-layout retest" + }, + { + "file": "preview.png", + "state": "空镜库-视频预览", + "test": "ScenicMaterialsFlowViewTests/testPreviewOpenAndClosePreservesPausedBatchAndSelection()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999291.454 + }, + { + "file": "retry-completed.png", + "state": "空镜库-失败重试完成", + "test": "ScenicMaterialsFlowViewTests/testRetryFailureOnlyRunsFailedClipAndPreservesSuccessfulDownloads()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999295.183 + }, + { + "file": "partial-failure.png", + "state": "空镜库-部分失败可重试", + "test": "ScenicMaterialsFlowViewTests/testRetryFailureOnlyRunsFailedClipAndPreservesSuccessfulDownloads()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999293.652 + }, + { + "file": "date-result.png", + "state": "空镜库-日期筛选结果", + "test": "ScenicMaterialsFlowViewTests/testRouteAndDateSheetCallbacksFilterResultsAndResetEmptyRoute()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999300.73 + }, + { + "file": "date-filter.png", + "state": "空镜库-起止日期筛选", + "test": "ScenicMaterialsFlowViewTests/testRouteAndDateSheetCallbacksFilterResultsAndResetEmptyRoute()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999299.615 + }, + { + "file": "no-results.png", + "state": "空镜库-航线无结果", + "test": "ScenicMaterialsFlowViewTests/testRouteAndDateSheetCallbacksFilterResultsAndResetEmptyRoute()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999297.768 + }, + { + "file": "route-filter.png", + "state": "空镜库-航线筛选", + "test": "ScenicMaterialsFlowViewTests/testRouteAndDateSheetCallbacksFilterResultsAndResetEmptyRoute()", + "source": "iPhone 11 XCTest window", + "timestamp": 1792999296.677 + } + ], + "finalLayoutRetest": { + "tests": 1, + "failures": 0 + } +} diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/expanded-simulator.jpg b/docs/9.9.1/scenic-materials-ui-2026-10-26/expanded-simulator.jpg new file mode 100644 index 0000000..1e5611b Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/expanded-simulator.jpg differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/group-selected.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/group-selected.png new file mode 100644 index 0000000..a74d32e Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/group-selected.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/library.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/library.png new file mode 100644 index 0000000..a064347 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/library.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/no-results.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/no-results.png new file mode 100644 index 0000000..285d2c4 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/no-results.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/partial-failure.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/partial-failure.png new file mode 100644 index 0000000..b053c92 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/partial-failure.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/paused.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/paused.png new file mode 100644 index 0000000..a355be9 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/paused.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/permission.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/permission.png new file mode 100644 index 0000000..e8909ab Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/permission.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/preview.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/preview.png new file mode 100644 index 0000000..7a76745 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/preview.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/retry-completed.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/retry-completed.png new file mode 100644 index 0000000..fb396ad Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/retry-completed.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/route-filter.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/route-filter.png new file mode 100644 index 0000000..bfc510d Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/route-filter.png differ diff --git a/docs/9.9.1/scenic-materials-ui-2026-10-26/selected.png b/docs/9.9.1/scenic-materials-ui-2026-10-26/selected.png new file mode 100644 index 0000000..cd7a321 Binary files /dev/null and b/docs/9.9.1/scenic-materials-ui-2026-10-26/selected.png differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/date-filter-crash-fixed.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/date-filter-crash-fixed.jpg new file mode 100644 index 0000000..93472f7 Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/date-filter-crash-fixed.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/date.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/date.json new file mode 100644 index 0000000..1a1fd9b --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/date.json @@ -0,0 +1,548 @@ +{ + "observed_at": "2026-10-30T11:10:27.421742+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 1, + "page_size": 20, + "retention_days": 90, + "date_from": "2026-10-24", + "date_to": "2026-10-30" + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 409, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1432, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 15:01:56", + "log_etime": "2026-10-28 15:10:23", + "sync_time": "2026-10-28 15:34:01", + "time_label": "10-28 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1431, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 13:01:56", + "log_etime": "2026-10-28 13:10:28", + "sync_time": "2026-10-28 13:29:43", + "time_label": "10-28 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1430, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 11:01:56", + "log_etime": "2026-10-28 11:10:28", + "sync_time": "2026-10-28 11:29:38", + "time_label": "10-28 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1429, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 09:01:56", + "log_etime": "2026-10-28 09:10:16", + "sync_time": "2026-10-28 09:29:28", + "time_label": "10-28 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1428, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 19:01:56", + "log_etime": "2026-10-27 19:10:22", + "sync_time": "2026-10-27 19:30:36", + "time_label": "10-27 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1427, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 17:01:56", + "log_etime": "2026-10-27 17:10:18", + "sync_time": "2026-10-27 17:31:12", + "time_label": "10-27 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1426, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 15:01:56", + "log_etime": "2026-10-26 15:10:15", + "sync_time": "2026-10-26 15:29:31", + "time_label": "10-26 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1425, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 13:01:56", + "log_etime": "2026-10-26 13:10:26", + "sync_time": "2026-10-26 13:29:29", + "time_label": "10-26 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1424, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 11:01:56", + "log_etime": "2026-10-26 11:10:19", + "sync_time": "2026-10-26 11:29:28", + "time_label": "10-26 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1423, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 09:01:56", + "log_etime": "2026-10-26 09:10:14", + "sync_time": "2026-10-26 09:29:37", + "time_label": "10-26 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1422, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 19:01:56", + "log_etime": "2026-10-25 19:10:33", + "sync_time": "2026-10-25 19:29:37", + "time_label": "10-25 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1421, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 17:01:56", + "log_etime": "2026-10-25 17:10:18", + "sync_time": "2026-10-25 17:29:31", + "time_label": "10-25 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1420, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 15:01:56", + "log_etime": "2026-10-25 15:10:24", + "sync_time": "2026-10-25 15:29:25", + "time_label": "10-25 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1419, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 19:01:56", + "log_etime": "2026-10-24 19:10:16", + "sync_time": "2026-10-24 19:29:31", + "time_label": "10-24 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1418, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 17:01:56", + "log_etime": "2026-10-24 17:10:10", + "sync_time": "2026-10-24 17:29:30", + "time_label": "10-24 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1417, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 15:01:56", + "log_etime": "2026-10-24 15:10:28", + "sync_time": "2026-10-24 15:29:24", + "time_label": "10-24 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 15:01:56", + "material_count": 8, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1432, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 15:01:56", + "log_etime": "2026-10-28 15:10:23", + "sync_time": "2026-10-28 15:34:01", + "time_label": "10-28 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1431, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 13:01:56", + "log_etime": "2026-10-28 13:10:28", + "sync_time": "2026-10-28 13:29:43", + "time_label": "10-28 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1430, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 11:01:56", + "log_etime": "2026-10-28 11:10:28", + "sync_time": "2026-10-28 11:29:38", + "time_label": "10-28 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1429, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 09:01:56", + "log_etime": "2026-10-28 09:10:16", + "sync_time": "2026-10-28 09:29:28", + "time_label": "10-28 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1428, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 19:01:56", + "log_etime": "2026-10-27 19:10:22", + "sync_time": "2026-10-27 19:30:36", + "time_label": "10-27 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1427, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 17:01:56", + "log_etime": "2026-10-27 17:10:18", + "sync_time": "2026-10-27 17:31:12", + "time_label": "10-27 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1426, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 15:01:56", + "log_etime": "2026-10-26 15:10:15", + "sync_time": "2026-10-26 15:29:31", + "time_label": "10-26 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1425, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 13:01:56", + "log_etime": "2026-10-26 13:10:26", + "sync_time": "2026-10-26 13:29:29", + "time_label": "10-26 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1424, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 11:01:56", + "log_etime": "2026-10-26 11:10:19", + "sync_time": "2026-10-26 11:29:28", + "time_label": "10-26 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1423, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 09:01:56", + "log_etime": "2026-10-26 09:10:14", + "sync_time": "2026-10-26 09:29:37", + "time_label": "10-26 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1422, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 19:01:56", + "log_etime": "2026-10-25 19:10:33", + "sync_time": "2026-10-25 19:29:37", + "time_label": "10-25 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1421, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 17:01:56", + "log_etime": "2026-10-25 17:10:18", + "sync_time": "2026-10-25 17:29:31", + "time_label": "10-25 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1420, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 15:01:56", + "log_etime": "2026-10-25 15:10:24", + "sync_time": "2026-10-25 15:29:25", + "time_label": "10-25 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1419, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 19:01:56", + "log_etime": "2026-10-24 19:10:16", + "sync_time": "2026-10-24 19:29:31", + "time_label": "10-24 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1418, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 17:01:56", + "log_etime": "2026-10-24 17:10:10", + "sync_time": "2026-10-24 17:29:30", + "time_label": "10-24 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1417, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 15:01:56", + "log_etime": "2026-10-24 15:10:28", + "sync_time": "2026-10-24 15:29:24", + "time_label": "10-24 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 15:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + } + ], + "total": 17, + "page": 1, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "2026-10-24", + "date_to": "2026-10-30" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:10:27" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/default.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/default.json new file mode 100644 index 0000000..90ba908 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/default.json @@ -0,0 +1,630 @@ +{ + "observed_at": "2026-10-30T11:10:13.527184+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 1, + "page_size": 20, + "retention_days": 90 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 429, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1432, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 15:01:56", + "log_etime": "2026-10-28 15:10:23", + "sync_time": "2026-10-28 15:34:01", + "time_label": "10-28 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1431, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 13:01:56", + "log_etime": "2026-10-28 13:10:28", + "sync_time": "2026-10-28 13:29:43", + "time_label": "10-28 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1430, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 11:01:56", + "log_etime": "2026-10-28 11:10:28", + "sync_time": "2026-10-28 11:29:38", + "time_label": "10-28 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1429, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 09:01:56", + "log_etime": "2026-10-28 09:10:16", + "sync_time": "2026-10-28 09:29:28", + "time_label": "10-28 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1428, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 19:01:56", + "log_etime": "2026-10-27 19:10:22", + "sync_time": "2026-10-27 19:30:36", + "time_label": "10-27 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1427, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 17:01:56", + "log_etime": "2026-10-27 17:10:18", + "sync_time": "2026-10-27 17:31:12", + "time_label": "10-27 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1426, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 15:01:56", + "log_etime": "2026-10-26 15:10:15", + "sync_time": "2026-10-26 15:29:31", + "time_label": "10-26 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1425, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 13:01:56", + "log_etime": "2026-10-26 13:10:26", + "sync_time": "2026-10-26 13:29:29", + "time_label": "10-26 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1424, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 11:01:56", + "log_etime": "2026-10-26 11:10:19", + "sync_time": "2026-10-26 11:29:28", + "time_label": "10-26 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1423, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 09:01:56", + "log_etime": "2026-10-26 09:10:14", + "sync_time": "2026-10-26 09:29:37", + "time_label": "10-26 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1422, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 19:01:56", + "log_etime": "2026-10-25 19:10:33", + "sync_time": "2026-10-25 19:29:37", + "time_label": "10-25 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1421, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 17:01:56", + "log_etime": "2026-10-25 17:10:18", + "sync_time": "2026-10-25 17:29:31", + "time_label": "10-25 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1420, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 15:01:56", + "log_etime": "2026-10-25 15:10:24", + "sync_time": "2026-10-25 15:29:25", + "time_label": "10-25 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1419, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 19:01:56", + "log_etime": "2026-10-24 19:10:16", + "sync_time": "2026-10-24 19:29:31", + "time_label": "10-24 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1418, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 17:01:56", + "log_etime": "2026-10-24 17:10:10", + "sync_time": "2026-10-24 17:29:30", + "time_label": "10-24 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1417, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 15:01:56", + "log_etime": "2026-10-24 15:10:28", + "sync_time": "2026-10-24 15:29:24", + "time_label": "10-24 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1416, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-22 19:01:56", + "log_etime": "2026-10-22 19:11:08", + "sync_time": "2026-10-22 19:30:08", + "time_label": "10-22 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-22 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1415, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-17 13:01:56", + "log_etime": "2026-10-17 13:11:26", + "sync_time": "2026-10-17 13:41:05", + "time_label": "10-17 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-17 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1414, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-17 11:01:56", + "log_etime": "2026-10-17 11:11:25", + "sync_time": "2026-10-17 11:29:42", + "time_label": "10-17 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-17 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1432, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 15:01:56", + "log_etime": "2026-10-28 15:10:23", + "sync_time": "2026-10-28 15:34:01", + "time_label": "10-28 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1431, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 13:01:56", + "log_etime": "2026-10-28 13:10:28", + "sync_time": "2026-10-28 13:29:43", + "time_label": "10-28 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1430, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 11:01:56", + "log_etime": "2026-10-28 11:10:28", + "sync_time": "2026-10-28 11:29:38", + "time_label": "10-28 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1429, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-28 09:01:56", + "log_etime": "2026-10-28 09:10:16", + "sync_time": "2026-10-28 09:29:28", + "time_label": "10-28 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-28 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1428, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 19:01:56", + "log_etime": "2026-10-27 19:10:22", + "sync_time": "2026-10-27 19:30:36", + "time_label": "10-27 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1427, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-27 17:01:56", + "log_etime": "2026-10-27 17:10:18", + "sync_time": "2026-10-27 17:31:12", + "time_label": "10-27 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-27 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1426, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 15:01:56", + "log_etime": "2026-10-26 15:10:15", + "sync_time": "2026-10-26 15:29:31", + "time_label": "10-26 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1425, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 13:01:56", + "log_etime": "2026-10-26 13:10:26", + "sync_time": "2026-10-26 13:29:29", + "time_label": "10-26 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1424, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 11:01:56", + "log_etime": "2026-10-26 11:10:19", + "sync_time": "2026-10-26 11:29:28", + "time_label": "10-26 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1423, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-26 09:01:56", + "log_etime": "2026-10-26 09:10:14", + "sync_time": "2026-10-26 09:29:37", + "time_label": "10-26 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-26 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1422, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 19:01:56", + "log_etime": "2026-10-25 19:10:33", + "sync_time": "2026-10-25 19:29:37", + "time_label": "10-25 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1421, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 17:01:56", + "log_etime": "2026-10-25 17:10:18", + "sync_time": "2026-10-25 17:29:31", + "time_label": "10-25 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1420, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-25 15:01:56", + "log_etime": "2026-10-25 15:10:24", + "sync_time": "2026-10-25 15:29:25", + "time_label": "10-25 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-25 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1419, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 19:01:56", + "log_etime": "2026-10-24 19:10:16", + "sync_time": "2026-10-24 19:29:31", + "time_label": "10-24 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1418, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 17:01:56", + "log_etime": "2026-10-24 17:10:10", + "sync_time": "2026-10-24 17:29:30", + "time_label": "10-24 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1417, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-24 15:01:56", + "log_etime": "2026-10-24 15:10:28", + "sync_time": "2026-10-24 15:29:24", + "time_label": "10-24 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-24 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1416, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-22 19:01:56", + "log_etime": "2026-10-22 19:11:08", + "sync_time": "2026-10-22 19:30:08", + "time_label": "10-22 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-22 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1415, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-17 13:01:56", + "log_etime": "2026-10-17 13:11:26", + "sync_time": "2026-10-17 13:41:05", + "time_label": "10-17 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-17 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1414, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-17 11:01:56", + "log_etime": "2026-10-17 11:11:25", + "sync_time": "2026-10-17 11:29:42", + "time_label": "10-17 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-17 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + } + ], + "total": 109, + "page": 1, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:10:13" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/detail1433.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/detail1433.json new file mode 100644 index 0000000..a4d4583 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/detail1433.json @@ -0,0 +1,176 @@ +{ + "observed_at": "2026-10-30T11:11:24.596696+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/session-detail", + "query": { + "scenic_media_id": 1433 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 303, + "response": { + "code": 100000, + "msg": "success", + "data": { + "session": { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "time_label": "10-29 11:01 · 8 段素材", + "group_select_label": "10-29 11:01 8 段素材" + }, + "materials": [ + { + "id": 5413, + "view_album_detail_id": 5413, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "01", + "file_label": "片段1", + "preview_label": "10-29 11:01片段1", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120552_0008_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120552_0008_V.jpg", + "size_bytes": 67541303296, + "download_times": 9, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5412, + "view_album_detail_id": 5412, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "02", + "file_label": "片段2", + "preview_label": "10-29 11:01片段2", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120517_0007_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120517_0007_V.jpg", + "size_bytes": 104956465152, + "download_times": 71, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5411, + "view_album_detail_id": 5411, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "03", + "file_label": "片段3", + "preview_label": "10-29 11:01片段3", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120422_0006_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120422_0006_V.jpg", + "size_bytes": 122252546048, + "download_times": 35, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5410, + "view_album_detail_id": 5410, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "04", + "file_label": "片段4", + "preview_label": "10-29 11:01片段4", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120350_0005_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120350_0005_V.jpg", + "size_bytes": 165236804608, + "download_times": 75, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5409, + "view_album_detail_id": 5409, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "05", + "file_label": "片段5", + "preview_label": "10-29 11:01片段5", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120311_0004_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120311_0004_V.jpg", + "size_bytes": 147552259072, + "download_times": 85, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5408, + "view_album_detail_id": 5408, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "06", + "file_label": "片段6", + "preview_label": "10-29 11:01片段6", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120224_0003_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120224_0003_V.jpg", + "size_bytes": 127153511424, + "download_times": 6, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5407, + "view_album_detail_id": 5407, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "07", + "file_label": "片段7", + "preview_label": "10-29 11:01片段7", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120138_0002_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120138_0002_V.jpg", + "size_bytes": 102819777536, + "download_times": 95, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5406, + "view_album_detail_id": 5406, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "08", + "file_label": "片段8", + "preview_label": "10-29 11:01片段8", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120129_0001_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120129_0001_V.jpg", + "size_bytes": 47900692480, + "download_times": 97, + "handpick": 2, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + } + ], + "material_count": 8 + }, + "time": "2026-10-30 11:11:24" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/library-real.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/library-real.jpg new file mode 100644 index 0000000..0477ca0 Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/library-real.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/media-head.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/media-head.json new file mode 100644 index 0000000..f770760 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/media-head.json @@ -0,0 +1,8 @@ +{ + "material_id": 5413, + "api_size_bytes": 67541303296, + "http_status": 200, + "content_length": "65958304", + "content_type": "video/mp4", + "check": "HEAD only; no media downloaded" +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-detail1433.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-detail1433.json new file mode 100644 index 0000000..57b154e --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-detail1433.json @@ -0,0 +1,203 @@ +{ + "observed_at": "2026-10-30T11:49:18.311630+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/session-detail", + "query": { + "scenic_media_id": 1433 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 312, + "response": { + "code": 100000, + "msg": "success", + "data": { + "session": { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "duration_seconds": 477, + "duration": 477, + "duration_label": "7分57秒", + "time_label": "10-29 11:01 · 7分57秒 · 8 段素材", + "group_select_label": "10-29 11:01 7分57秒 8 段素材" + }, + "materials": [ + { + "id": 5406, + "view_album_detail_id": 5406, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "01", + "file_label": "片段1", + "preview_label": "10-29 11:01片段1", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120129_0001_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120129_0001_V.jpg", + "size_bytes": 46778020, + "duration_seconds": 9, + "duration": 9, + "duration_label": "9秒", + "download_times": 97, + "handpick": 2, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5407, + "view_album_detail_id": 5407, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "02", + "file_label": "片段2", + "preview_label": "10-29 11:01片段2", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120138_0002_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120138_0002_V.jpg", + "size_bytes": 100409939, + "duration_seconds": 46, + "duration": 46, + "duration_label": "46秒", + "download_times": 95, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5408, + "view_album_detail_id": 5408, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "03", + "file_label": "片段3", + "preview_label": "10-29 11:01片段3", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120224_0003_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120224_0003_V.jpg", + "size_bytes": 124173351, + "duration_seconds": 47, + "duration": 47, + "duration_label": "47秒", + "download_times": 6, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5409, + "view_album_detail_id": 5409, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "04", + "file_label": "片段4", + "preview_label": "10-29 11:01片段4", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120311_0004_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120311_0004_V.jpg", + "size_bytes": 144094003, + "duration_seconds": 39, + "duration": 39, + "duration_label": "39秒", + "download_times": 85, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5410, + "view_album_detail_id": 5410, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "05", + "file_label": "片段5", + "preview_label": "10-29 11:01片段5", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120350_0005_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120350_0005_V.jpg", + "size_bytes": 161364067, + "duration_seconds": 32, + "duration": 32, + "duration_label": "32秒", + "download_times": 75, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5411, + "view_album_detail_id": 5411, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "06", + "file_label": "片段6", + "preview_label": "10-29 11:01片段6", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120422_0006_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120422_0006_V.jpg", + "size_bytes": 119387252, + "duration_seconds": 55, + "duration": 55, + "duration_label": "55秒", + "download_times": 35, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5412, + "view_album_detail_id": 5412, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "07", + "file_label": "片段7", + "preview_label": "10-29 11:01片段7", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120517_0007_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120517_0007_V.jpg", + "size_bytes": 102496548, + "duration_seconds": 35, + "duration": 35, + "duration_label": "35秒", + "download_times": 71, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + }, + { + "id": 5413, + "view_album_detail_id": 5413, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "08", + "file_label": "片段8", + "preview_label": "10-29 11:01片段8", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120552_0008_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120552_0008_V.jpg", + "size_bytes": 65958304, + "duration_seconds": 19004641, + "duration": 19004641, + "duration_label": "5279小时4分", + "download_times": 9, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + } + ], + "material_count": 8 + }, + "time": "2026-10-30 11:49:18" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-library.png b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-library.png new file mode 100644 index 0000000..9ebb0c7 Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-library.png differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-preview.png b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-preview.png new file mode 100644 index 0000000..e4b199d Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-preview.png differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-size1.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-size1.json new file mode 100644 index 0000000..7065f59 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-size1.json @@ -0,0 +1,98 @@ +{ + "observed_at": "2026-10-30T11:50:12.192899+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 1, + "page_size": 1, + "retention_days": 90 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 672, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "duration_seconds": 477, + "duration": 477, + "duration_label": "7分57秒", + "time_label": "10-29 11:01 · 7分57秒 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "duration_seconds": 477, + "duration": 477, + "duration_label": "7分57秒", + "time_label": "10-29 11:01 · 7分57秒 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + } + ], + "total": 108, + "page": 1, + "page_size": 1, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:50:11" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/page1-real.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page1-real.jpg new file mode 100644 index 0000000..0b9ff88 Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page1-real.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/page2-real.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page2-real.jpg new file mode 100644 index 0000000..8abe56b Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page2-real.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/page2.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page2.json new file mode 100644 index 0000000..d995ce9 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page2.json @@ -0,0 +1,630 @@ +{ + "observed_at": "2026-10-30T11:10:28.562207+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 2, + "page_size": 20, + "retention_days": 90 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 371, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1413, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-17 09:01:56", + "log_etime": "2026-10-17 09:11:49", + "sync_time": "2026-10-17 09:29:37", + "time_label": "10-17 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-17 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1412, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 19:01:56", + "log_etime": "2026-10-14 19:10:22", + "sync_time": "2026-10-14 19:29:39", + "time_label": "10-14 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1411, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 17:01:56", + "log_etime": "2026-10-14 17:10:19", + "sync_time": "2026-10-14 17:29:42", + "time_label": "10-14 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1410, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 15:01:56", + "log_etime": "2026-10-14 15:10:20", + "sync_time": "2026-10-14 15:29:30", + "time_label": "10-14 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1409, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 13:01:56", + "log_etime": "2026-10-14 13:09:47", + "sync_time": "2026-10-14 13:22:46", + "time_label": "10-14 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1408, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-13 13:01:56", + "log_etime": "2026-10-13 13:10:02", + "sync_time": "2026-10-13 13:21:24", + "time_label": "10-13 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-13 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1407, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-13 11:01:56", + "log_etime": "2026-10-13 11:10:15", + "sync_time": "2026-10-13 11:21:08", + "time_label": "10-13 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-13 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1406, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-13 09:01:56", + "log_etime": "2026-10-13 09:10:19", + "sync_time": "2026-10-13 09:21:11", + "time_label": "10-13 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-13 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1405, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-11 17:01:56", + "log_etime": "2026-10-11 17:10:10", + "sync_time": "2026-10-11 17:29:32", + "time_label": "10-11 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-11 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1404, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-11 11:01:56", + "log_etime": "2026-10-11 11:10:31", + "sync_time": "2026-10-11 11:29:34", + "time_label": "10-11 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-11 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1403, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 15:01:56", + "log_etime": "2026-10-08 15:13:09", + "sync_time": "2026-10-08 15:29:41", + "time_label": "10-08 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1402, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 13:01:56", + "log_etime": "2026-10-08 13:10:26", + "sync_time": "2026-10-08 13:22:59", + "time_label": "10-08 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1401, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 11:01:56", + "log_etime": "2026-10-08 11:10:16", + "sync_time": "2026-10-08 11:29:33", + "time_label": "10-08 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1400, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 09:01:56", + "log_etime": "2026-10-08 09:10:14", + "sync_time": "2026-10-08 09:23:03", + "time_label": "10-08 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1399, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-04 19:01:56", + "log_etime": "2026-10-04 19:12:45", + "sync_time": "2026-10-04 19:29:42", + "time_label": "10-04 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-04 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1398, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-04 15:01:56", + "log_etime": "2026-10-04 15:11:21", + "sync_time": "2026-10-04 15:29:15", + "time_label": "10-04 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-04 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1397, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 19:01:56", + "log_etime": "2026-10-02 19:10:18", + "sync_time": "2026-10-02 19:29:28", + "time_label": "10-02 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1396, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 17:01:56", + "log_etime": "2026-10-02 17:10:18", + "sync_time": "2026-10-02 17:29:35", + "time_label": "10-02 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1395, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 15:01:56", + "log_etime": "2026-10-02 15:10:11", + "sync_time": "2026-10-02 15:29:37", + "time_label": "10-02 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1394, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 13:01:56", + "log_etime": "2026-10-02 13:10:06", + "sync_time": "2026-10-02 13:29:33", + "time_label": "10-02 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 13:01:56", + "material_count": 8, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1413, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-17 09:01:56", + "log_etime": "2026-10-17 09:11:49", + "sync_time": "2026-10-17 09:29:37", + "time_label": "10-17 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-17 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1412, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 19:01:56", + "log_etime": "2026-10-14 19:10:22", + "sync_time": "2026-10-14 19:29:39", + "time_label": "10-14 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1411, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 17:01:56", + "log_etime": "2026-10-14 17:10:19", + "sync_time": "2026-10-14 17:29:42", + "time_label": "10-14 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1410, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 15:01:56", + "log_etime": "2026-10-14 15:10:20", + "sync_time": "2026-10-14 15:29:30", + "time_label": "10-14 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1409, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-14 13:01:56", + "log_etime": "2026-10-14 13:09:47", + "sync_time": "2026-10-14 13:22:46", + "time_label": "10-14 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-14 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1408, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-13 13:01:56", + "log_etime": "2026-10-13 13:10:02", + "sync_time": "2026-10-13 13:21:24", + "time_label": "10-13 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-13 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1407, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-13 11:01:56", + "log_etime": "2026-10-13 11:10:15", + "sync_time": "2026-10-13 11:21:08", + "time_label": "10-13 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-13 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1406, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-13 09:01:56", + "log_etime": "2026-10-13 09:10:19", + "sync_time": "2026-10-13 09:21:11", + "time_label": "10-13 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-13 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1405, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-11 17:01:56", + "log_etime": "2026-10-11 17:10:10", + "sync_time": "2026-10-11 17:29:32", + "time_label": "10-11 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-11 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1404, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-11 11:01:56", + "log_etime": "2026-10-11 11:10:31", + "sync_time": "2026-10-11 11:29:34", + "time_label": "10-11 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-11 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1403, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 15:01:56", + "log_etime": "2026-10-08 15:13:09", + "sync_time": "2026-10-08 15:29:41", + "time_label": "10-08 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1402, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 13:01:56", + "log_etime": "2026-10-08 13:10:26", + "sync_time": "2026-10-08 13:22:59", + "time_label": "10-08 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1401, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 11:01:56", + "log_etime": "2026-10-08 11:10:16", + "sync_time": "2026-10-08 11:29:33", + "time_label": "10-08 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1400, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-08 09:01:56", + "log_etime": "2026-10-08 09:10:14", + "sync_time": "2026-10-08 09:23:03", + "time_label": "10-08 09:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-08 09:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1399, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-04 19:01:56", + "log_etime": "2026-10-04 19:12:45", + "sync_time": "2026-10-04 19:29:42", + "time_label": "10-04 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-04 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1398, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-04 15:01:56", + "log_etime": "2026-10-04 15:11:21", + "sync_time": "2026-10-04 15:29:15", + "time_label": "10-04 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-04 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1397, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 19:01:56", + "log_etime": "2026-10-02 19:10:18", + "sync_time": "2026-10-02 19:29:28", + "time_label": "10-02 19:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 19:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1396, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 17:01:56", + "log_etime": "2026-10-02 17:10:18", + "sync_time": "2026-10-02 17:29:35", + "time_label": "10-02 17:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 17:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1395, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 15:01:56", + "log_etime": "2026-10-02 15:10:11", + "sync_time": "2026-10-02 15:29:37", + "time_label": "10-02 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1394, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-02 13:01:56", + "log_etime": "2026-10-02 13:10:06", + "sync_time": "2026-10-02 13:29:33", + "time_label": "10-02 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-02 13:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + } + ], + "total": 109, + "page": 2, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:10:28" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/page6.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page6.json new file mode 100644 index 0000000..ceb1bde --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page6.json @@ -0,0 +1,343 @@ +{ + "observed_at": "2026-10-30T11:29:17.845930+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 6, + "page_size": 20, + "retention_days": 90 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 334, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1333, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-06 11:01:56", + "log_etime": "2026-08-06 11:10:19", + "sync_time": "2026-08-06 11:29:41", + "time_label": "08-06 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-06 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1332, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-04 15:01:56", + "log_etime": "2026-08-04 15:10:28", + "sync_time": "2026-08-04 16:13:40", + "time_label": "08-04 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-04 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1331, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-04 13:01:56", + "log_etime": "2026-08-04 13:10:21", + "sync_time": "2026-08-04 13:53:39", + "time_label": "08-04 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-04 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1330, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-03 13:01:56", + "log_etime": "2026-08-03 13:10:41", + "sync_time": "2026-08-03 13:37:43", + "time_label": "08-03 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-03 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1329, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-03 11:01:56", + "log_etime": "2026-08-03 11:10:20", + "sync_time": "2026-08-03 11:29:40", + "time_label": "08-03 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-03 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1328, + "scenic_id": 271, + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "log_stime": "2026-08-02 10:46:56", + "log_etime": "2026-08-02 10:55:06", + "sync_time": "2026-08-02 10:59:56", + "time_label": "08-02 10:46 · 2 段素材", + "name": "三台观景航线(1、2镜头)2026-08-02 10:46:56", + "material_count": 2, + "source": "fly_plan" + }, + { + "scenic_media_id": 1327, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-02 09:46:56", + "log_etime": "2026-08-02 09:54:57", + "sync_time": "2026-08-02 10:00:58", + "time_label": "08-02 09:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-02 09:46:56", + "material_count": 2, + "source": "fly_plan" + }, + { + "scenic_media_id": 1326, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-01 13:46:56", + "log_etime": "2026-08-01 13:54:56", + "sync_time": "2026-08-01 14:00:18", + "time_label": "08-01 13:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-01 13:46:56", + "material_count": 2, + "source": "fly_plan" + }, + { + "scenic_media_id": 1325, + "scenic_id": 271, + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "log_stime": "2026-08-01 11:46:56", + "log_etime": "2026-08-01 11:55:31", + "sync_time": "2026-08-01 12:00:26", + "time_label": "08-01 11:46 · 2 段素材", + "name": "三台观景航线(7、8镜头)2026-08-01 11:46:56", + "material_count": 2, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1333, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-06 11:01:56", + "log_etime": "2026-08-06 11:10:19", + "sync_time": "2026-08-06 11:29:41", + "time_label": "08-06 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-06 11:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1332, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-04 15:01:56", + "log_etime": "2026-08-04 15:10:28", + "sync_time": "2026-08-04 16:13:40", + "time_label": "08-04 15:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-04 15:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1331, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-04 13:01:56", + "log_etime": "2026-08-04 13:10:21", + "sync_time": "2026-08-04 13:53:39", + "time_label": "08-04 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-04 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1330, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-03 13:01:56", + "log_etime": "2026-08-03 13:10:41", + "sync_time": "2026-08-03 13:37:43", + "time_label": "08-03 13:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-03 13:01:56", + "material_count": 8, + "source": "fly_plan" + }, + { + "scenic_media_id": 1329, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-08-03 11:01:56", + "log_etime": "2026-08-03 11:10:20", + "sync_time": "2026-08-03 11:29:40", + "time_label": "08-03 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-08-03 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "sessions": [ + { + "scenic_media_id": 1328, + "scenic_id": 271, + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "log_stime": "2026-08-02 10:46:56", + "log_etime": "2026-08-02 10:55:06", + "sync_time": "2026-08-02 10:59:56", + "time_label": "08-02 10:46 · 2 段素材", + "name": "三台观景航线(1、2镜头)2026-08-02 10:46:56", + "material_count": 2, + "source": "fly_plan" + } + ] + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "sessions": [ + { + "scenic_media_id": 1327, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-02 09:46:56", + "log_etime": "2026-08-02 09:54:57", + "sync_time": "2026-08-02 10:00:58", + "time_label": "08-02 09:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-02 09:46:56", + "material_count": 2, + "source": "fly_plan" + }, + { + "scenic_media_id": 1326, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-01 13:46:56", + "log_etime": "2026-08-01 13:54:56", + "sync_time": "2026-08-01 14:00:18", + "time_label": "08-01 13:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-01 13:46:56", + "material_count": 2, + "source": "fly_plan" + } + ] + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "sessions": [ + { + "scenic_media_id": 1325, + "scenic_id": 271, + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "log_stime": "2026-08-01 11:46:56", + "log_etime": "2026-08-01 11:55:31", + "sync_time": "2026-08-01 12:00:26", + "time_label": "08-01 11:46 · 2 段素材", + "name": "三台观景航线(7、8镜头)2026-08-01 11:46:56", + "material_count": 2, + "source": "fly_plan" + } + ] + } + ], + "total": 109, + "page": 6, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:29:17" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/page7.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page7.json new file mode 100644 index 0000000..b7c55e2 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/page7.json @@ -0,0 +1,61 @@ +{ + "observed_at": "2026-10-30T11:29:21.361134+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 7, + "page_size": 20, + "retention_days": 90 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 340, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [], + "groups": [], + "total": 109, + "page": 7, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:29:21" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/preview-real.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/preview-real.jpg new file mode 100644 index 0000000..8ad62c1 Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/preview-real.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/retention-boundary-real.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/retention-boundary-real.jpg new file mode 100644 index 0000000..c7a04f2 Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/retention-boundary-real.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/route273.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/route273.json new file mode 100644 index 0000000..0e7449e --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/route273.json @@ -0,0 +1,127 @@ +{ + "observed_at": "2026-10-30T11:11:23.697111+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 1, + "page_size": 20, + "retention_days": 90, + "air_line_id": 273 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 342, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1327, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-02 09:46:56", + "log_etime": "2026-08-02 09:54:57", + "sync_time": "2026-08-02 10:00:58", + "time_label": "08-02 09:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-02 09:46:56", + "material_count": 2, + "source": "fly_plan" + }, + { + "scenic_media_id": 1326, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-01 13:46:56", + "log_etime": "2026-08-01 13:54:56", + "sync_time": "2026-08-01 14:00:18", + "time_label": "08-01 13:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-01 13:46:56", + "material_count": 2, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "sessions": [ + { + "scenic_media_id": 1327, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-02 09:46:56", + "log_etime": "2026-08-02 09:54:57", + "sync_time": "2026-08-02 10:00:58", + "time_label": "08-02 09:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-02 09:46:56", + "material_count": 2, + "source": "fly_plan" + }, + { + "scenic_media_id": 1326, + "scenic_id": 271, + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "log_stime": "2026-08-01 13:46:56", + "log_etime": "2026-08-01 13:54:56", + "sync_time": "2026-08-01 14:00:18", + "time_label": "08-01 13:46 · 2 段素材", + "name": "三台观景航线(5、6镜头)2026-08-01 13:46:56", + "material_count": 2, + "source": "fly_plan" + } + ] + } + ], + "total": 2, + "page": 1, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 273, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:11:23" + } +} diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/routes-real.jpg b/docs/9.9.1/scenic-sessions-debug-2026-10-30/routes-real.jpg new file mode 100644 index 0000000..0cfe10f Binary files /dev/null and b/docs/9.9.1/scenic-sessions-debug-2026-10-30/routes-real.jpg differ diff --git a/docs/9.9.1/scenic-sessions-debug-2026-10-30/size1.json b/docs/9.9.1/scenic-sessions-debug-2026-10-30/size1.json new file mode 100644 index 0000000..64ec229 --- /dev/null +++ b/docs/9.9.1/scenic-sessions-debug-2026-10-30/size1.json @@ -0,0 +1,98 @@ +{ + "observed_at": "2026-10-30T11:10:28.235009+08:00", + "method": "GET", + "endpoint": "https://api-test.zhifly.cn/api/app/scenic-media/sessions", + "query": { + "scenic_id": 271, + "page": 1, + "page_size": 1, + "retention_days": 90 + }, + "app_version": "2.1.2", + "http_status": 200, + "duration_ms": 338, + "response": { + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + } + ], + "total": 109, + "page": 1, + "page_size": 1, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:10:28" + } +} diff --git a/docs/9.9.1/scenic-ui-2026-10-30/completed.jpg b/docs/9.9.1/scenic-ui-2026-10-30/completed.jpg new file mode 100644 index 0000000..f4bf03d Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/completed.jpg differ diff --git a/docs/9.9.1/scenic-ui-2026-10-30/date-filter.jpg b/docs/9.9.1/scenic-ui-2026-10-30/date-filter.jpg new file mode 100644 index 0000000..9c6643a Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/date-filter.jpg differ diff --git a/docs/9.9.1/scenic-ui-2026-10-30/downloading.jpg b/docs/9.9.1/scenic-ui-2026-10-30/downloading.jpg new file mode 100644 index 0000000..0c43651 Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/downloading.jpg differ diff --git a/docs/9.9.1/scenic-ui-2026-10-30/library.jpg b/docs/9.9.1/scenic-ui-2026-10-30/library.jpg new file mode 100644 index 0000000..3cd68f1 Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/library.jpg differ diff --git a/docs/9.9.1/scenic-ui-2026-10-30/partial-failure.jpg b/docs/9.9.1/scenic-ui-2026-10-30/partial-failure.jpg new file mode 100644 index 0000000..10d8dcc Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/partial-failure.jpg differ diff --git a/docs/9.9.1/scenic-ui-2026-10-30/preview.jpg b/docs/9.9.1/scenic-ui-2026-10-30/preview.jpg new file mode 100644 index 0000000..8e565f1 Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/preview.jpg differ diff --git a/docs/9.9.1/scenic-ui-2026-10-30/route-filter.jpg b/docs/9.9.1/scenic-ui-2026-10-30/route-filter.jpg new file mode 100644 index 0000000..ed39994 Binary files /dev/null and b/docs/9.9.1/scenic-ui-2026-10-30/route-filter.jpg differ diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shoot-airport-state-rejected-155852.json b/docs/9.9.1/shooting-integration-2026-10-29/shoot-airport-state-rejected-155852.json new file mode 100644 index 0000000..bea271a --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shoot-airport-state-rejected-155852.json @@ -0,0 +1,6 @@ +{ + "code": 180031, + "msg": "无法获取机场状态,暂时不可起飞", + "data": [], + "time": "2026-10-29 15:58:52" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shoot-task6-success-redacted.json b/docs/9.9.1/shooting-integration-2026-10-29/shoot-task6-success-redacted.json new file mode 100644 index 0000000..d31cf8c --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shoot-task6-success-redacted.json @@ -0,0 +1,63 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task": { + "id": 6, + "order_id": 0, + "order_number": "TEST-ORDER-004", + "scenic_id": 271, + "store_id": 38, + "store_user_id": 51, + "scenic_spot_id": 412, + "air_line_id": 302, + "plane_id": 61, + "airport_sn": "TEST-PLANE-61", + "wayline_task_id": 1926, + "task_uuid": "00000000-0000-4000-8000-000000001926", + "seq": 6, + "spot_attempt": 6, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-10-29 16:03:30", + "finished_at": null, + "medias": [] + }, + "order_progress": { + "order_number": "TEST-ORDER-004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_total": 1, + "shot_used": 0, + "shot_remain": 1, + "status_label": "待拍摄" + }, + "task_id": 1926, + "task_uuid": "00000000-0000-4000-8000-000000001926", + "plane_id": 61, + "airport_sn": "TEST-PLANE-61", + "air_line_id": 302, + "air_line_name": "天门寻梦", + "ui": { + "phase": "arrived_pending_start", + "title": "无人机已到达", + "message": "是否开始拍摄?确认游客站位与取景后开始", + "primary_action": "start_shoot", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ] + } + }, + "time": "2026-10-29 16:03:31" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-rejected.json b/docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-rejected.json new file mode 100644 index 0000000..b5b4d1e --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-rejected.json @@ -0,0 +1,6 @@ +{ + "code": 100099, + "msg": "不支持的订单类型", + "data": [], + "time": "2026-10-29 15:34:31" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-retry-rejected-154141.json b/docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-retry-rejected-154141.json new file mode 100644 index 0000000..70e853a --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-retry-rejected-154141.json @@ -0,0 +1,6 @@ +{ + "code": 100099, + "msg": "不支持的订单类型", + "data": [], + "time": "2026-10-29 15:41:41" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shooting-rejected.json b/docs/9.9.1/shooting-integration-2026-10-29/shooting-rejected.json new file mode 100644 index 0000000..82c008e --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shooting-rejected.json @@ -0,0 +1,6 @@ +{ + "code": 100099, + "data": [], + "msg": "多点位航拍请使用专用订单接口", + "time": "2026-10-29 14:14:42" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shooting-success-redacted.json b/docs/9.9.1/shooting-integration-2026-10-29/shooting-success-redacted.json new file mode 100644 index 0000000..3f601bb --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shooting-success-redacted.json @@ -0,0 +1,218 @@ +{ + "code": 100000, + "data": { + "air_line": { + "estimated_fly_time": 376, + "fly_type": 1, + "id": 302, + "line_video_duration": 25, + "name": "天门寻梦", + "scenic_spot_id": 412 + }, + "airport_sn": "", + "airport_status": { + "sn": "TEST-PLANE-58", + "status": 1, + "task_type": null, + "work_status_label": "空闲" + }, + "current_plane": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": true, + "id": 58, + "is_receive_order": 1, + "name": "测试设备 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "execute_gate": { + "can_execute": false, + "code": "wayline_missing", + "message": "航线任务未关联,请先完成召唤起飞", + "primary_action": "blocked", + "primary_action_label": "航线任务未关联,请先完成召唤起飞" + }, + "header": { + "order_number": "TEST-ORDER-004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "title": "天门寻梦 · 天门寻梦", + "tourist_label": "游客 130****0004", + "tourist_phone_mask": "130****0004" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": 93, + "value": "93%" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": 0, + "value": "0m/s" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": 32, + "value": "32颗" + } + ], + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "", + "deducted": 0, + "finished_at": null, + "id": 1, + "medias": [], + "order_id": 0, + "order_number": "TEST-ORDER-004", + "plane_id": 0, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 1, + "spot_attempt": 1, + "started_at": null, + "status": 10, + "status_label": "待执行", + "store_id": 38, + "store_user_id": 51, + "task_uuid": "", + "wayline_task_id": 0 + }, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 0, + "plane_status": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": true, + "id": 58, + "is_receive_order": 1, + "name": "测试设备 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试设备 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试设备 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": true, + "id": 58, + "is_receive_order": 1, + "name": "测试设备 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "scenic": { + "id": 271, + "name": "北大科技园" + }, + "scenic_spot": { + "id": 412, + "name": "天门寻梦" + }, + "task": { + "id": 1, + "status": 10, + "status_label": "待执行", + "task_uuid": "", + "wayline_status": 0, + "wayline_status_label": "", + "wayline_task_id": 0 + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "航线任务未关联,请先完成召唤起飞", + "phase": "blocked", + "primary_action": "blocked", + "primary_action_label": "航线任务未关联,请先完成召唤起飞", + "title": "航线任务未关联,请先完成召唤起飞" + } + }, + "msg": "success", + "time": "2026-10-29 15:07:25" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shooting-task-real.jpg b/docs/9.9.1/shooting-integration-2026-10-29/shooting-task-real.jpg new file mode 100644 index 0000000..138c380 Binary files /dev/null and b/docs/9.9.1/shooting-integration-2026-10-29/shooting-task-real.jpg differ diff --git a/docs/9.9.1/shooting-integration-2026-10-29/shooting-task6-after-shoot-redacted.json b/docs/9.9.1/shooting-integration-2026-10-29/shooting-task6-after-shoot-redacted.json new file mode 100644 index 0000000..aafad26 --- /dev/null +++ b/docs/9.9.1/shooting-integration-2026-10-29/shooting-task6-after-shoot-redacted.json @@ -0,0 +1,218 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task": { + "id": 6, + "order_id": 0, + "order_number": "TEST-ORDER-004", + "scenic_id": 271, + "store_id": 38, + "store_user_id": 51, + "scenic_spot_id": 412, + "air_line_id": 302, + "plane_id": 61, + "airport_sn": "TEST-PLANE-61", + "wayline_task_id": 1926, + "task_uuid": "00000000-0000-4000-8000-000000001926", + "seq": 6, + "spot_attempt": 6, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-10-29 16:03:30", + "finished_at": null, + "medias": [] + }, + "order_type": 25, + "order_type_label": "多点位航拍", + "task": { + "id": 6, + "task_uuid": "00000000-0000-4000-8000-000000001926", + "wayline_task_id": 1926, + "wayline_status": 91, + "wayline_status_label": "执行失败", + "status": 20, + "status_label": "执行中" + }, + "scenic": { + "id": 271, + "name": "北大科技园" + }, + "scenic_spot": { + "id": 412, + "name": "天门寻梦" + }, + "air_line": { + "id": 302, + "name": "天门寻梦", + "scenic_spot_id": 412, + "fly_type": 1, + "estimated_fly_time": 376, + "line_video_duration": 25 + }, + "header": { + "title": "天门寻梦 · 天门寻梦", + "order_number": "TEST-ORDER-004", + "tourist_phone_mask": "130****0004", + "tourist_label": "游客 130****0004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_total": 1, + "shot_remain": 1 + }, + "airport_sn": "TEST-PLANE-61", + "plane_id": 61, + "current_plane": { + "id": 61, + "sn_number": "TEST-PLANE-61", + "name": "测试设备 61", + "online_status": 2, + "is_receive_order": 1, + "work_status": 0, + "work_status_label": "离线", + "task_type": null, + "battery_percent": 94, + "battery_label": "电量 94%", + "can_fly": false, + "status_text": "离线 · 电量 94%" + }, + "plane_status": { + "scenic_id": 271, + "planes": [ + { + "id": 61, + "sn_number": "TEST-PLANE-61", + "name": "测试设备 61", + "online_status": 2, + "is_receive_order": 1, + "work_status": 0, + "work_status_label": "离线", + "task_type": null, + "battery_percent": 94, + "battery_label": "电量 94%", + "can_fly": false, + "status_text": "离线 · 电量 94%" + }, + { + "id": 58, + "sn_number": "TEST-PLANE-58", + "name": "测试设备 58", + "online_status": 1, + "is_receive_order": 2, + "work_status": 1, + "work_status_label": "空闲", + "task_type": null, + "battery_percent": null, + "battery_label": "", + "can_fly": false, + "status_text": "空闲" + }, + { + "id": 57, + "sn_number": "TEST-PLANE-57", + "name": "测试设备 57", + "online_status": 2, + "is_receive_order": 2, + "work_status": 0, + "work_status_label": "离线", + "task_type": null, + "battery_percent": null, + "battery_label": "", + "can_fly": false, + "status_text": "离线" + } + ], + "recommend": { + "id": 61, + "sn_number": "TEST-PLANE-61", + "name": "测试设备 61", + "online_status": 2, + "is_receive_order": 1, + "work_status": 0, + "work_status_label": "离线", + "task_type": null, + "battery_percent": 94, + "battery_label": "电量 94%", + "can_fly": false, + "status_text": "离线 · 电量 94%" + }, + "has_idle": true, + "has_shooting": false, + "connected": true, + "poll_hint_ms": 5000 + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "94%", + "raw": 94 + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "10.3℃", + "raw": 10.3 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "0m/s", + "raw": 0 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "信号良好", + "raw": "信号良好" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "17颗", + "raw": 17 + } + ], + "airport_status": { + "sn": "TEST-PLANE-61", + "status": 0, + "task_type": null, + "work_status_label": "离线" + }, + "execute_gate": { + "can_execute": false, + "code": "wayline_not_shooting", + "message": "航线任务状态不可拍摄(当前:执行失败)", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)" + }, + "ui": { + "phase": "blocked", + "title": "航线任务状态不可拍摄(当前:执行失败)", + "message": "航线任务状态不可拍摄(当前:执行失败)", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ] + } + }, + "time": "2026-10-29 16:04:52" +} diff --git a/docs/9.9.1/shooting-integration-2026-10-29/task6-fixed-layout-real.jpg b/docs/9.9.1/shooting-integration-2026-10-29/task6-fixed-layout-real.jpg new file mode 100644 index 0000000..9a30cda Binary files /dev/null and b/docs/9.9.1/shooting-integration-2026-10-29/task6-fixed-layout-real.jpg differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/preparation-occupied.png b/docs/9.9.1/shooting-ui-2026-10-23/preparation-occupied.png new file mode 100644 index 0000000..dbfa694 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/preparation-occupied.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/preparation-ready.png b/docs/9.9.1/shooting-ui-2026-10-23/preparation-ready.png new file mode 100644 index 0000000..aa7a73c Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/preparation-ready.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/preparation-unknown.png b/docs/9.9.1/shooting-ui-2026-10-23/preparation-unknown.png new file mode 100644 index 0000000..02011f8 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/preparation-unknown.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/prototype-return-result.jpg b/docs/9.9.1/shooting-ui-2026-10-23/prototype-return-result.jpg new file mode 100644 index 0000000..9e46a34 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/prototype-return-result.jpg differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/prototype-return-result.txt b/docs/9.9.1/shooting-ui-2026-10-23/prototype-return-result.txt new file mode 100644 index 0000000..b7b7044 --- /dev/null +++ b/docs/9.9.1/shooting-ui-2026-10-23/prototype-return-result.txt @@ -0,0 +1,74 @@ +Browser tab: 1, Title: "机巢 · 页面内交互体验", URL: "https://voicestudio.suixinkan.cn/". +0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ + 1 container + 2 pop up button (collapsed) Description: Preview device: iPhone, ID: radix-_r_0_, Secondary Actions: Expand + 3 container + 4 container Device status bar + 5 text 4:14 + 6 container + 207 container + 208 button 返回 + 209 image + 210 heading 拍摄任务, Value: 1 + 211 text 拍摄任务 + 212 text 交互原型 · 无真实操作 + 213 button 体验本页其他状态 + 214 image + 215 text 体验其他状态 + 216 container + 217 heading 三皇寨 · 经典航线, Value: 2 + 218 text 三皇寨 · 经典航线 + 219 container + 220 text 游客 136****2806 · 含 1 次拍摄 + 221 container 无人机直播画面 + 222 image 无人机视角的游客取景演示画面 + 271 image + 224 text 上次任务画面 + 225 button 放大直播画面 + 226 image + 227 container 无人机六项状态 + 228 text 电池电量 + 229 container + 230 image + 231 text 95% + 232 text 环境温度 + 233 container + 234 image + 235 text 20.3°C + 236 text 风速 + 237 container + 238 image + 239 text 0m/s + 240 text 雨量 + 241 container + 242 image + 243 text 无雨 + 244 text 信号状态 + 245 container + 246 image + 247 text 良好 + 248 text 搜星状态 + 249 container + 250 image + 251 text 36颗 + 252 container + 272 image + 254 heading 本次拍摄已中断, Value: 2 + 255 text 本次拍摄已中断 + 258 text 无人机已返回机巢,本次未扣减拍摄次数。 +可重新选择点位和航线开始任务。 + 259 button 重新召唤无人机 + 260 image + 261 text 重新召唤无人机 + 262 text 安全控制 + 263 button (disabled) 紧急暂停 当前未执行任务 + 264 image + 265 text 紧急暂停 + 266 text 当前未执行任务 + 267 button (disabled) 立即返航 当前未执行任务 + 273 image + 269 text 立即返航 + 270 text 当前未执行任务 + 206 image + +The focused UI element is 0 AXWebArea 机巢 · 页面内交互体验, URL: voicestudio.suixinkan.cn/ \ No newline at end of file diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-arrived.png b/docs/9.9.1/shooting-ui-2026-10-23/task-arrived.png new file mode 100644 index 0000000..92c210d Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-arrived.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-command-unconfirmed.png b/docs/9.9.1/shooting-ui-2026-10-23/task-command-unconfirmed.png new file mode 100644 index 0000000..3dd0a43 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-command-unconfirmed.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-paused.png b/docs/9.9.1/shooting-ui-2026-10-23/task-paused.png new file mode 100644 index 0000000..7a7d60e Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-paused.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-phone-offline.png b/docs/9.9.1/shooting-ui-2026-10-23/task-phone-offline.png new file mode 100644 index 0000000..e714239 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-phone-offline.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-stream-lost.png b/docs/9.9.1/shooting-ui-2026-10-23/task-stream-lost.png new file mode 100644 index 0000000..06ed071 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-stream-lost.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-success-return-paused.png b/docs/9.9.1/shooting-ui-2026-10-23/task-success-return-paused.png new file mode 100644 index 0000000..c5221fc Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-success-return-paused.png differ diff --git a/docs/9.9.1/shooting-ui-2026-10-23/task-zero-quota-returning.png b/docs/9.9.1/shooting-ui-2026-10-23/task-zero-quota-returning.png new file mode 100644 index 0000000..a93f774 Binary files /dev/null and b/docs/9.9.1/shooting-ui-2026-10-23/task-zero-quota-returning.png differ diff --git a/docs/9.9.1/shooting-websocket-2026-11-02/websocket-fallback-mock.png b/docs/9.9.1/shooting-websocket-2026-11-02/websocket-fallback-mock.png new file mode 100644 index 0000000..fe4dcf3 Binary files /dev/null and b/docs/9.9.1/shooting-websocket-2026-11-02/websocket-fallback-mock.png differ diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/README.md b/docs/9.9.1/start-shoot-mock-2026-10-29/README.md new file mode 100644 index 0000000..bff4b8e --- /dev/null +++ b/docs/9.9.1/start-shoot-mock-2026-10-29/README.md @@ -0,0 +1,40 @@ +# 开始拍摄:本地模拟调试记录 + +日期:2026-10-29。**全部回执来自纯内存 Mock,未调用后端、未向无人机发送指令,不代表真实接口或设备执行成功。** + +## 调试结果 + +- 提供人:朱工;合同为 `POST /api/app/airport/start-shoot`,请求仅传 `{"id":901}`。901 是合成的订单飞行任务 ID。 +- 模拟器手动操作顺序:进入任务页 GET `shooting` → 点击开始拍摄 POST `start-shoot` → 成功后 GET 同一任务 `shooting` 一次。没有定时轮询、创建、召唤或控制请求。 +- 初始状态为就绪,点击后保留原 UI,状态回查后显示“无人机正在拍摄中(模拟)”。顶部、底部位置保持固定。 +- 模拟器相关测试 **84 项通过,0 失败**:开拍 API 10、开拍 ViewModel 12、模拟页面 3、原任务 ViewModel 16、原任务页面 15、阶段展示 14、固定布局 8、禁飞保护 6。 +- 覆盖成功、明确业务拒绝、超时结果未知、重复点击、身份不匹配、离页取消、旧数据显示、提交后单次回查和真实传输前阻断。明确拒绝可手动重试;超时等不确定结果禁止重复提交。 + +## 证据 + +- [完整三次请求与回执](success-flow.mock.json):从本次模拟器日志提取,标记 `source=local_mock`、`network_sent=false`。 +- [开始拍摄完整模拟回执](start-shoot-response.mock.json)。 +- [模拟器成功态截图](start-shoot-success-mock.jpg)。 +- 测试结果:本机 XcodeBuildMCP `test_sim_2026-10-29T10-06-20-605Z_pid15238_c1dd52ad.xcresult`。 + +## 复现方式与边界 + +### 从拍摄准备进入拍摄任务 + +Debug 的真实准备页右上角点击“本地模拟”,打开独立的“拍摄准备 · 本地模拟”。选择默认模拟点位、航线,点击“确认并召唤(模拟)”,即可进入同一任务 901 的“拍摄任务 · 本地模拟”。也可用启动参数 `--dock-preparation-mock` 直接打开模拟准备页。 + +准备信息、飞机状态、创建、召唤及任务查询全部复用同一内存传输。原订单和登录身份不参与模拟,不生成真实待飞任务;真实准备页的提交按钮仍受禁飞保护。模拟创建仅发送四个合同字段,模拟召唤使用 `{"id":901,"restart":false}`,进入任务页后查询同一 `id=901`。 + +返回模拟准备页后按钮变为“查看拍摄任务”,重新进入只读取原模拟任务,不再创建或召唤。准备页与任务页均提供“查看模拟接口回执”;准备页提交期间禁用该入口,避免打断导航。 + +本次衔接验证:模拟器 **35 项相关测试全部通过**(准备页 19、完整模拟流程 2、禁飞准备页 5、网络保护 6、原开拍模拟页 3)。新增用例检查真实准备页的原服务没有提交、连续点击只创建/召唤一次、同任务进入并开拍,以及返回重进不重复写入。结果包:`test_sim_2026-10-29T10-19-41-808Z_pid15238_387aa23e.xcresult`。 + +模拟器手动操作也已通过:[准备页截图](preparation-mock.jpg)、[跳转后的任务页截图](preparation-to-task-mock.jpg)、[完整内存请求及回执](preparation-to-task.mock.json)。日志为准备配置与设备状态读取、点击后的配置复核、创建一次、召唤一次、同任务查询一次;没有真实后端请求,也未自动开始拍摄。 + +### 直接从拍摄任务开始 + +Debug 启动参数 `--dock-start-shoot-mock`,可加 `--dock-start-shoot-result=success`(默认)、`business-failure` 或 `timeout`。右上角“查看模拟接口回执”显示该会话 JSON。 + +此入口使用独立客户端 `https://mock.invalid` 和纯内存传输;未知请求直接本地失败,不回退网络。`live_battery=1` 仅用于验证 Mock 的查询合同,不触发实时采集;真实 Debug 查询强制改为 0。合成订单、飞机 ID、任务 UUID 和机巢序列号均不可作为真实业务参数。 + +正式任务页未注入开拍服务,按钮仍禁用;统一网络层继续阻断真实 `tasks/create/shoot/start-shoot/command/live`。2026-10-30 已为同一纯内存流程增加底部安全指令,见[安全控制模拟记录](../safety-command-mock-2026-10-30/README.md),真实暂停和返航仍未启用。后端目前没有约定不会下发设备指令的模拟协议,因此本次只验证客户端行为,不验证后端接收及实际执行。 diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-mock.jpg b/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-mock.jpg new file mode 100644 index 0000000..7dbb555 Binary files /dev/null and b/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-mock.jpg differ diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-to-task-mock.jpg b/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-to-task-mock.jpg new file mode 100644 index 0000000..29e29c1 Binary files /dev/null and b/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-to-task-mock.jpg differ diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-to-task.mock.json b/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-to-task.mock.json new file mode 100644 index 0000000..9961f80 --- /dev/null +++ b/docs/9.9.1/start-shoot-mock-2026-10-29/preparation-to-task.mock.json @@ -0,0 +1,313 @@ +{ + "source": "local_mock", + "network_sent": false, + "description": "从模拟器手动操作日志提取;模拟准备→创建→召唤→任务查询,没有后端请求。", + "records": [ + { + "method": "GET", + "path": "/api/yf-handset-app/photog/multi-plane/project-info", + "network_sent": false, + "query": { + "scenic_id": "128", + "project_id": "101", + "order_number": "LOCAL-MOCK-ORDER-901" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "film_count": 0, + "order_number": "LOCAL-MOCK-ORDER-901", + "order_status": 20, + "project_id": 101, + "project_name": "模拟五次套餐", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 401, + "air_line_name": "模拟航线", + "available": true, + "samples": [] + } + ], + "available": true, + "scenic_spot_id": 301, + "scenic_spot_name": "模拟点位" + } + ], + "user_phone": "本地模拟游客" + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/plane-status", + "network_sent": false, + "query": { + "scenic_id": "128", + "live_battery": "1" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "connected": true, + "planes": [ + { + "battery_percent": 95, + "can_fly": true, + "id": 201, + "is_receive_order": 1, + "name": "本地模拟无人机", + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 电量 95%", + "work_status": 1, + "work_status_label": "空闲(模拟)" + } + ], + "poll_hint_ms": 30000, + "recommend": { + "battery_percent": 95, + "can_fly": true, + "id": 201, + "is_receive_order": 1, + "name": "本地模拟无人机", + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "本地模拟 · 电量 95%", + "work_status": 1, + "work_status_label": "空闲(模拟)" + }, + "scenic_id": 128 + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/yf-handset-app/photog/multi-plane/project-info", + "network_sent": false, + "query": { + "scenic_id": "128", + "project_id": "101", + "order_number": "LOCAL-MOCK-ORDER-901" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "film_count": 0, + "order_number": "LOCAL-MOCK-ORDER-901", + "order_status": 20, + "project_id": 101, + "project_name": "模拟五次套餐", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 401, + "air_line_name": "模拟航线", + "available": true, + "samples": [] + } + ], + "available": true, + "scenic_spot_id": 301, + "scenic_spot_name": "模拟点位" + } + ], + "user_phone": "本地模拟游客" + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/yf-handset-app/photog/multi-plane/tasks/create", + "network_sent": false, + "request_body": { + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_spot_id": 301, + "scenic_id": 128, + "air_line_id": 401 + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "film_count": 0, + "order_number": "LOCAL-MOCK-ORDER-901", + "order_status": 20, + "project_id": 101, + "project_name": "模拟五次套餐", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "task_id": 901, + "user_phone": "本地模拟游客" + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/app/airport/shoot", + "network_sent": false, + "request_body": { + "restart": false, + "id": 901 + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_flight_task_id": 901, + "plane_id": 201, + "task_uuid": "LOCAL-MOCK-TASK-UUID-901", + "ui": { + "message": "本地模拟召唤成功,没有网络或设备指令。", + "phase": "arrived_pending_start", + "title": "无人机已到达(模拟)" + } + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/shooting", + "network_sent": false, + "query": { + "id": "901", + "live_battery": "1" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "模拟就绪 · 电量95%", + "work_status": 1, + "work_status_label": "空闲" + }, + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "本地模拟:允许验证开拍请求", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "ui": { + "message": "点击开始拍摄,仅验证本地接口流程。", + "phase": "arrived_pending_start", + "title": "无人机已到达(模拟)" + } + }, + "msg": "local mock success" + } + } + ] +} diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-response.mock.json b/docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-response.mock.json new file mode 100644 index 0000000..aeb1f9c --- /dev/null +++ b/docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-response.mock.json @@ -0,0 +1,41 @@ +{ + "source": "local_mock", + "network_sent": false, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_flight_task_id": 901, + "plane_id": 201, + "task_uuid": "LOCAL-MOCK-TASK-UUID-901", + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "本地模拟开拍回执,不代表真实设备执行。", + "phase": "shooting", + "primary_action": "shooting", + "title": "无人机正在拍摄中(模拟)" + } + }, + "msg": "local mock success" + } +} diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-success-mock.jpg b/docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-success-mock.jpg new file mode 100644 index 0000000..0322bea Binary files /dev/null and b/docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-success-mock.jpg differ diff --git a/docs/9.9.1/start-shoot-mock-2026-10-29/success-flow.mock.json b/docs/9.9.1/start-shoot-mock-2026-10-29/success-flow.mock.json new file mode 100644 index 0000000..6b57052 --- /dev/null +++ b/docs/9.9.1/start-shoot-mock-2026-10-29/success-flow.mock.json @@ -0,0 +1,264 @@ +{ + "source": "local_mock", + "description": "纯内存模拟,未调用后端或设备;从模拟器日志提取,不代表后端实测响应。", + "network_sent": false, + "scenario": "success", + "records": [ + { + "method": "GET", + "path": "/api/app/airport/shooting", + "network_sent": false, + "query": { + "id": "901", + "live_battery": "1" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "模拟就绪 · 电量95%", + "work_status": 1, + "work_status_label": "空闲" + }, + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "本地模拟:允许验证开拍请求", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "ui": { + "message": "点击开始拍摄,仅验证本地接口流程。", + "phase": "arrived_pending_start", + "title": "无人机已到达(模拟)" + } + }, + "msg": "local mock success" + } + }, + { + "method": "POST", + "path": "/api/app/airport/start-shoot", + "network_sent": false, + "request_body": { + "id": 901 + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "airport_sn": "LOCAL-MOCK-DOCK-201", + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_flight_task_id": 901, + "plane_id": 201, + "task_uuid": "LOCAL-MOCK-TASK-UUID-901", + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "本地模拟开拍回执,不代表真实设备执行。", + "phase": "shooting", + "primary_action": "shooting", + "title": "无人机正在拍摄中(模拟)" + } + }, + "msg": "local mock success" + } + }, + { + "method": "GET", + "path": "/api/app/airport/shooting", + "network_sent": false, + "query": { + "id": "901", + "live_battery": "1" + }, + "http_status": 200, + "response_body": { + "code": 100000, + "data": { + "air_line": { + "id": 401, + "name": "模拟航线", + "scenic_spot_id": 301 + }, + "current_plane": { + "id": 201, + "online_status": 1, + "sn_number": "LOCAL-MOCK-PLANE-201", + "status_text": "模拟拍摄中 · 电量95%", + "work_status": 2, + "work_status_label": "拍摄中" + }, + "execute_gate": { + "can_execute": false, + "code": "already_started", + "message": "本地模拟:开拍已受理", + "primary_action": "shooting", + "primary_action_label": "拍摄中" + }, + "header": { + "order_number": "LOCAL-MOCK-ORDER-901", + "package_name": "模拟套餐 · 含5次拍摄", + "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令" + }, + "metrics": [ + { + "key": "battery", + "value": "95%" + }, + { + "key": "env_temp", + "value": "20.3℃" + }, + { + "key": "wind_speed", + "value": "0m/s" + }, + { + "key": "rainfall", + "value": "无雨" + }, + { + "key": "signal", + "value": "良好" + }, + { + "key": "satellite", + "value": "36颗" + } + ], + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "order_number": "LOCAL-MOCK-ORDER-901", + "plane_status": { + "connected": true, + "poll_hint_ms": 5000, + "scenic_id": 128 + }, + "scenic": { + "id": 128, + "name": "本地模拟景区" + }, + "scenic_spot": { + "id": 301, + "name": "模拟点位" + }, + "task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "ui": { + "message": "本地模拟状态回查:拍摄中,未向设备发送指令。", + "phase": "shooting", + "title": "无人机正在拍摄中(模拟)" + } + }, + "msg": "local mock success" + } + } + ] +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/01-project-info-initial.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/01-project-info-initial.json new file mode 100644 index 0000000..9644fdc --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/01-project-info-initial.json @@ -0,0 +1,109 @@ +{ + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/project-info?scenic_id=271&project_id=386&order_number=261027271004" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17762401434725.png", + "id": 318, + "name": "天门寻梦", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776240058674_lgjimv.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道北大科技园花都汇商务中心", + "lat": 32.429597, + "lot": 119.440283, + "scenic_spot_str": "北大科技园" + }, + "sample_piece_ids": [ + 318 + ], + "samples": [ + { + "id": 318, + "name": "天门寻梦" + } + ], + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "air_line_name": "天门远山", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17768529312831.png", + "id": 319, + "name": "天门远山", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776852306874_5jh4xz.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道花都汇商务中心", + "lat": 32.429872, + "lot": 119.440194, + "scenic_spot_str": "天门远山" + }, + "sample_piece_ids": [ + 319 + ], + "samples": [ + { + "id": 319, + "name": "天门远山" + } + ], + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 17:17:25" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/02-plane-status-before-summon.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/02-plane-status-before-summon.json new file mode 100644 index 0000000..53f740a --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/02-plane-status-before-summon.json @@ -0,0 +1,79 @@ +{ + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:55" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/03-project-info-preflight.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/03-project-info-preflight.json new file mode 100644 index 0000000..bfb2844 --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/03-project-info-preflight.json @@ -0,0 +1,109 @@ +{ + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/project-info?scenic_id=271&project_id=386&order_number=261027271004" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17762401434725.png", + "id": 318, + "name": "天门寻梦", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776240058674_lgjimv.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道北大科技园花都汇商务中心", + "lat": 32.429597, + "lot": 119.440283, + "scenic_spot_str": "北大科技园" + }, + "sample_piece_ids": [ + 318 + ], + "samples": [ + { + "id": 318, + "name": "天门寻梦" + } + ], + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "air_line_name": "天门远山", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17768529312831.png", + "id": 319, + "name": "天门远山", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776852306874_5jh4xz.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道花都汇商务中心", + "lat": 32.429872, + "lot": 119.440194, + "scenic_spot_str": "天门远山" + }, + "sample_piece_ids": [ + 319 + ], + "samples": [ + { + "id": 319, + "name": "天门远山" + } + ], + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 17:18:59" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/04-tasks-create.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/04-tasks-create.json new file mode 100644 index 0000000..fb3f37c --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/04-tasks-create.json @@ -0,0 +1,40 @@ +{ + "request": { + "method": "POST", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/tasks/create", + "body": { + "air_line_id": 302, + "order_number": "261027271004", + "scenic_id": 271, + "scenic_spot_id": 412 + } + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "task_id": 11, + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 17:18:59" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/05-shoot.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/05-shoot.json new file mode 100644 index 0000000..b19322e --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/05-shoot.json @@ -0,0 +1,76 @@ +{ + "request": { + "method": "POST", + "url": "https://api-test.zhifly.cn/api/app/airport/shoot", + "body": { + "id": 11, + "restart": false + } + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "airport_sn": "TEST-PLANE-61", + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "TEST-PLANE-61", + "deducted": 0, + "finished_at": null, + "id": 11, + "medias": [], + "order_id": 0, + "order_number": "261027271004", + "plane_id": 61, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 11, + "spot_attempt": 11, + "started_at": "2026-10-29 17:19:00", + "status": 20, + "status_label": "执行中", + "store_id": 38, + "store_user_id": 772, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_task_id": 1931 + }, + "order_progress": { + "order_number": "261027271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄" + }, + "plane_id": 61, + "task_id": 1931, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "是否开始拍摄?确认游客站位与取景后开始", + "phase": "arrived_pending_start", + "primary_action": "start_shoot", + "title": "无人机已到达" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:01" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/06-shooting-entry.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/06-shooting-entry.json new file mode 100644 index 0000000..7064be9 --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/06-shooting-entry.json @@ -0,0 +1,227 @@ +{ + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/shooting?id=11&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "air_line": { + "estimated_fly_time": 376, + "fly_type": 1, + "id": 302, + "line_video_duration": 25, + "name": "天门寻梦", + "scenic_spot_id": 412 + }, + "airport_sn": "TEST-PLANE-61", + "airport_status": { + "sn": "TEST-PLANE-61", + "status": 2, + "task_type": 2, + "work_status_label": "拍摄中" + }, + "current_plane": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 2, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "拍摄中 · 电量 94%", + "task_type": 2, + "work_status": 2, + "work_status_label": "拍摄中" + }, + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "header": { + "order_number": "261027271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "title": "天门寻梦 · 天门寻梦", + "tourist_label": "游客 130****0004", + "tourist_phone_mask": "130****0004" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": 94, + "value": "94%" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": 10.3, + "value": "10.3℃" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": 0, + "value": "0m/s" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": "no_rain", + "value": "无雨" + }, + { + "key": "signal", + "label": "信号状态", + "raw": "信号良好", + "value": "信号良好" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": 17, + "value": "17颗" + } + ], + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "TEST-PLANE-61", + "deducted": 0, + "finished_at": null, + "id": 11, + "medias": [], + "order_id": 0, + "order_number": "261027271004", + "plane_id": 61, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 11, + "spot_attempt": 11, + "started_at": "2026-10-29 17:19:00", + "status": 20, + "status_label": "执行中", + "store_id": 38, + "store_user_id": 772, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_task_id": 1931 + }, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 61, + "plane_status": { + "connected": true, + "has_idle": true, + "has_shooting": true, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 2, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "拍摄中 · 电量 94%", + "task_type": 2, + "work_status": 2, + "work_status_label": "拍摄中" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 2, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "拍摄中 · 电量 94%", + "task_type": 2, + "work_status": 2, + "work_status_label": "拍摄中" + }, + "scenic_id": 271 + }, + "scenic": { + "id": 271, + "name": "北大科技园" + }, + "scenic_spot": { + "id": 412, + "name": "天门寻梦" + }, + "task": { + "id": 11, + "status": 20, + "status_label": "执行中", + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_status": 20, + "wayline_status_label": "拍摄中", + "wayline_task_id": 1931 + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "确认游客站位与取景后开始", + "phase": "arrived_pending_start", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "title": "无人机已到达 是否开始拍摄?" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:04" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/07-shooting-refresh.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/07-shooting-refresh.json new file mode 100644 index 0000000..6291033 --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/07-shooting-refresh.json @@ -0,0 +1,227 @@ +{ + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/shooting?id=11&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "air_line": { + "estimated_fly_time": 376, + "fly_type": 1, + "id": 302, + "line_video_duration": 25, + "name": "天门寻梦", + "scenic_spot_id": 412 + }, + "airport_sn": "TEST-PLANE-61", + "airport_status": { + "sn": "TEST-PLANE-61", + "status": 0, + "task_type": null, + "work_status_label": "离线" + }, + "current_plane": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线 · 电量 94%", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + "execute_gate": { + "can_execute": false, + "code": "wayline_not_shooting", + "message": "航线任务状态不可拍摄(当前:执行失败)", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)" + }, + "header": { + "order_number": "261027271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "title": "天门寻梦 · 天门寻梦", + "tourist_label": "游客 130****0004", + "tourist_phone_mask": "130****0004" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": 94, + "value": "94%" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": 10.3, + "value": "10.3℃" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": 0, + "value": "0m/s" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": "no_rain", + "value": "无雨" + }, + { + "key": "signal", + "label": "信号状态", + "raw": "信号良好", + "value": "信号良好" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": 17, + "value": "17颗" + } + ], + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "TEST-PLANE-61", + "deducted": 0, + "finished_at": null, + "id": 11, + "medias": [], + "order_id": 0, + "order_number": "261027271004", + "plane_id": 61, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 11, + "spot_attempt": 11, + "started_at": "2026-10-29 17:19:00", + "status": 20, + "status_label": "执行中", + "store_id": 38, + "store_user_id": 772, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_task_id": 1931 + }, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 61, + "plane_status": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线 · 电量 94%", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线 · 电量 94%", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + "scenic_id": 271 + }, + "scenic": { + "id": 271, + "name": "北大科技园" + }, + "scenic_spot": { + "id": 412, + "name": "天门寻梦" + }, + "task": { + "id": 11, + "status": 20, + "status_label": "执行中", + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_status": 91, + "wayline_status_label": "执行失败", + "wayline_task_id": 1931 + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "航线任务状态不可拍摄(当前:执行失败)", + "phase": "blocked", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)", + "title": "航线任务状态不可拍摄(当前:执行失败)" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:59" + } + } +} diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/README.md b/docs/9.9.1/takeoff-integration-2026-10-29-1718/README.md new file mode 100644 index 0000000..df18f36 --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/README.md @@ -0,0 +1,98 @@ +# 模拟器起飞流程联调记录 · 2026-10-29 17:16–17:20 + +本次已在模拟器从真实机巢首页进入拍摄准备,点击一次“确认并召唤”。`tasks/create → shoot → shooting` 串接成功并自动进入拍摄任务页,但 55 秒后手动回查发现航线执行失败。只能确认召唤请求被服务端受理,不能确认无人机实际起飞或到达成功。 + +## 环境和任务身份 + +- 测试环境:`https://api-test.zhifly.cn`;时间均为北京时间(Asia/Shanghai)。 +- iPhone 18 Pro 模拟器,iOS 27.0,`suixinkan-Simulator / SimulatorDebug`;构建与运行成功。 +- 当前门店账号,景区 `271`,项目 `386`,订单 `261027271004`。 +- 页面选择点位 `412`(天门寻梦)、航线 `302`(天门寻梦)。 +- 本次新建订单飞行任务 **11**;派机 **61**;航线任务 **1931**;任务 UUID `917d0fdf-d55b-4263-889a-aae81d99cd7c`。 +- `shoot.data.task_id=1931` 是航线任务 ID;后续查询始终使用 `shooting?id=11`。 + +## 实际请求与响应 + +以下所有已收到的响应均为 HTTP `200`、业务 `code=100000`。JSON 文件同时保存请求 method、完整 URL/body,以及 HTTP 状态和完整业务响应;设备 SN/名称与游客脱敏手机号已替换为测试值,其余字段保留真实值和类型。 + +| 响应时间 | 提供人 / 接口 | 关键返回 | 完整记录 | +| --- | --- | --- | --- | +| 17:17:25 | 张工 `GET /api/yf-handset-app/photog/multi-plane/project-info` | 总次数/剩余次数 5,`can_create_task=true`,点位 412 / 航线 302 可用 | [首次准备数据](01-project-info-initial.json) | +| 17:18:55 | 朱工 `GET /api/app/airport/plane-status` | 58 空闲、电量 93%,但 `can_fly=false`、`is_receive_order=2`;61、57 离线;三个设备的 `can_fly` 均为 false | [提交前设备状态](02-plane-status-before-summon.json) | +| 17:18:59 | 张工 `GET /api/yf-handset-app/photog/multi-plane/project-info` | 点击后的购买配置复核通过,仍剩余 5 次 | [提交前购买复核](03-project-info-preflight.json) | +| 17:18:59 | 张工 `POST /api/yf-handset-app/photog/multi-plane/tasks/create` | `task_id=11`,总/剩余次数仍为 5 | [创建任务](04-tasks-create.json) | +| 17:19:01 | 朱工 `POST /api/app/airport/shoot` | 任务 11 绑定飞机 61 / 航线任务 1931;`ui.phase=arrived_pending_start` | [召唤回执](05-shoot.json) | +| 17:19:04 | 朱工 `GET /api/app/airport/shooting?id=11&live_battery=1` | `task.wayline_status=20`,`execute_gate.can_execute=true`,文案“无人机已到达 是否开始拍摄?” | [进入任务页](06-shooting-entry.json) | +| 17:19:59 | 朱工同一 `shooting`,点击导航栏刷新一次 | `wayline_status=91` 执行失败,`can_execute=false`、`code=wayline_not_shooting`,飞机 61 离线 | [手动回查](07-shooting-refresh.json) | + +创建请求: + +```json +{ + "air_line_id": 302, + "order_number": "261027271004", + "scenic_id": 271, + "scenic_spot_id": 412 +} +``` + +召唤请求(没有传 `plane_id`,由服务端派机;没有覆盖航线): + +```json +{ + "id": 11, + "restart": false +} +``` + +最后一次 `shooting` 的关键返回(节选,完整 JSON 见表格): + +```json +{ + "code": 100000, + "data": { + "task": { + "id": 11, + "status": 20, + "status_label": "执行中", + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_status": 91, + "wayline_status_label": "执行失败", + "wayline_task_id": 1931 + }, + "execute_gate": { + "can_execute": false, + "code": "wayline_not_shooting", + "message": "航线任务状态不可拍摄(当前:执行失败)", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:59" +} +``` + +## 页面实际表现 + +- 首页点击该订单“开始拍摄”后进入准备页,再读取 `project-info` 与 `plane-status`。 +- 点击一次“确认并召唤”,先复核购买数据,再创建任务 11 并召唤;召唤返回后自动进入任务页。 +- 首次显示“无人机已到达 是否开始拍摄?”,六项读数为 `94% / 10.3℃ / 0m/s / 无雨 / 信号良好 / 17颗`。 +- 导航栏手动刷新后,显示“执行失败”和后端原因,设备显示“离线 · 电量94%”。 +- “开始拍摄”、暂停、返航尚未接入控制 API,按钮保持禁用。本次没有调用 `start-shoot`、`command`,也没有重建或重试召唤。 +- `shooting` 仅调用两次(进页一次、明确手动刷新一次),未恢复定时轮询。 + +本地截图(含真实页面信息,保留本地,不随代码提交):`preparation-local.jpg`、`task11-arrived-local.jpg`、`task11-failed-local.jpg`。 + +## 后端待核对事项 + +1. **朱工:定位航线任务 1931 的失败原因。** 首次查询 17:19:04 仍为状态 20,17:19:59 回查为 91;返回的 `result_code/result_message` 仍为空,客户端无法得知具体失败环节。请结合任务 UUID、飞机 61 和大疆/司空日志核查。 +2. **朱工:核对自动派机与执行门禁。** 召唤前飞机 61 是 `online_status=2/work_status=0/can_fly=false`,仍被 `shoot` 选中;首次 `shooting.current_plane.online_status=2/can_fly=false`,但门禁 `can_execute=true`。需要明确字段来源及允许派机/开始的条件,不能仅凭“已到达”文案确认物理状态,也不能从现有回执断定离线字段与失败存在因果关系。 +3. **朱工与张工:统一订单套餐次数。** 张工 `project-info/tasks/create` 是“多点位航拍”、总/剩余 5 次;朱工 `shoot.order_progress`、`shooting.header` 是“单次航拍 · 含1次拍摄”、总/剩余 1 次。当前 App 如实显示各接口返回。 +4. **朱工:统一通用响应示例。** 最新文档仍写成功 `code=0/message`,本次实际全部为 `code=100000/msg`,与现有客户端解析一致。 + +## 记录范围 + +[所有请求与响应](all-api-records.redacted.json) 共 25 条请求记录:主页 3 次、`project-info` 2 次、准备页 `plane-status` 16 次、创建 1 次、召唤 1 次、任务查询 2 次。准备页轮询中的最后一次请求在页面跳转时取消,日志为 `URLError.cancelled`,没有响应 JSON;其余 24 条均保留完整回执。准备页的既有轮询和任务页的单次读取相互独立。 + +[核验元数据](verification.json) 包含请求次数及原运行日志路径;原始未脱敏请求响应保留于本机 `/private/tmp/suixinkan-takeoff-20261029-1718-api-raw.json`。本次只进行模拟器联调与记录,没有修改业务代码。 diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/all-api-records.redacted.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/all-api-records.redacted.json new file mode 100644 index 0000000..b98c4e0 --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/all-api-records.redacted.json @@ -0,0 +1,2231 @@ +[ + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/home?scenic_id=271" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "测试无人机 61", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "TEST-PLANE-61", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "id": 58, + "is_receive_order": 2, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": 93, + "value": "93%" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": 0, + "value": "0m/s" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": 32, + "value": "32颗" + } + ], + "name": "测试无人机 58", + "online_status": 1, + "scenic_area_id": 271, + "sn_number": "TEST-PLANE-58", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "id": 57, + "is_receive_order": 2, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "测试无人机 57", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "TEST-PLANE-57", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:16:40" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/today-stats?scenic_id=271" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "cash_paid": "0.00", + "cash_refund": "0.00", + "completed_count": 0, + "deal_amount": "0.00", + "deal_count": 0, + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + }, + "msg": "success", + "time": "2026-10-29 17:16:39" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/orders?scenic_id=271&status=all&page=1&page_size=20" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "list": [ + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "user_phone": "130****0004" + }, + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:16:18", + "film_count": 0, + "material_status": 0, + "order_number": "261027271001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0004" + } + ], + "page": 1, + "page_size": 20, + "total": 2 + }, + "msg": "success", + "time": "2026-10-29 17:16:39" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:17:26" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/project-info?scenic_id=271&project_id=386&order_number=261027271004" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17762401434725.png", + "id": 318, + "name": "天门寻梦", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776240058674_lgjimv.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道北大科技园花都汇商务中心", + "lat": 32.429597, + "lot": 119.440283, + "scenic_spot_str": "北大科技园" + }, + "sample_piece_ids": [ + 318 + ], + "samples": [ + { + "id": 318, + "name": "天门寻梦" + } + ], + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "air_line_name": "天门远山", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17768529312831.png", + "id": 319, + "name": "天门远山", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776852306874_5jh4xz.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道花都汇商务中心", + "lat": 32.429872, + "lot": 119.440194, + "scenic_spot_str": "天门远山" + }, + "sample_piece_ids": [ + 319 + ], + "samples": [ + { + "id": 319, + "name": "天门远山" + } + ], + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 17:17:25" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:17:32" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:17:39" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:17:45" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:17:51" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:17:58" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:05" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:11" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:17" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:24" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:30" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:36" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:43" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:49" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 17:18:55" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/project-info?scenic_id=271&project_id=386&order_number=261027271004" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17762401434725.png", + "id": 318, + "name": "天门寻梦", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776240058674_lgjimv.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道北大科技园花都汇商务中心", + "lat": 32.429597, + "lot": 119.440283, + "scenic_spot_str": "北大科技园" + }, + "sample_piece_ids": [ + 318 + ], + "samples": [ + { + "id": 318, + "name": "天门寻梦" + } + ], + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "air_line_name": "天门远山", + "available": true, + "samples": [ + { + "cover_url": "https://fly-picture.tos-cn-beijing.volces.com/202604/17768529312831.png", + "id": 319, + "name": "天门远山", + "preview_url": "https://zhongchuan-picture.oss-cn-beijing.aliyuncs.com/simplepic/202604/1776852306874_5jh4xz.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "江苏省扬州市邗江区城北街道花都汇商务中心", + "lat": 32.429872, + "lot": 119.440194, + "scenic_spot_str": "天门远山" + }, + "sample_piece_ids": [ + 319 + ], + "samples": [ + { + "id": 319, + "name": "天门远山" + } + ], + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 17:18:59" + } + } + }, + { + "request": { + "method": "POST", + "url": "https://api-test.zhifly.cn/api/yf-handset-app/photog/multi-plane/tasks/create", + "body": { + "air_line_id": 302, + "order_number": "261027271004", + "scenic_id": 271, + "scenic_spot_id": 412 + } + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "261027271004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "task_id": 11, + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 17:18:59" + } + } + }, + { + "request": { + "method": "POST", + "url": "https://api-test.zhifly.cn/api/app/airport/shoot", + "body": { + "id": 11, + "restart": false + } + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "airport_sn": "TEST-PLANE-61", + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "TEST-PLANE-61", + "deducted": 0, + "finished_at": null, + "id": 11, + "medias": [], + "order_id": 0, + "order_number": "261027271004", + "plane_id": 61, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 11, + "spot_attempt": 11, + "started_at": "2026-10-29 17:19:00", + "status": 20, + "status_label": "执行中", + "store_id": 38, + "store_user_id": 772, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_task_id": 1931 + }, + "order_progress": { + "order_number": "261027271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄" + }, + "plane_id": 61, + "task_id": 1931, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "是否开始拍摄?确认游客站位与取景后开始", + "phase": "arrived_pending_start", + "primary_action": "start_shoot", + "title": "无人机已到达" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:01" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/plane-status?scenic_id=271&live_battery=1" + }, + "cancelled_reason": "URLError.cancelled" + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/shooting?id=11&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "air_line": { + "estimated_fly_time": 376, + "fly_type": 1, + "id": 302, + "line_video_duration": 25, + "name": "天门寻梦", + "scenic_spot_id": 412 + }, + "airport_sn": "TEST-PLANE-61", + "airport_status": { + "sn": "TEST-PLANE-61", + "status": 2, + "task_type": 2, + "work_status_label": "拍摄中" + }, + "current_plane": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 2, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "拍摄中 · 电量 94%", + "task_type": 2, + "work_status": 2, + "work_status_label": "拍摄中" + }, + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "header": { + "order_number": "261027271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "title": "天门寻梦 · 天门寻梦", + "tourist_label": "游客 130****0004", + "tourist_phone_mask": "130****0004" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": 94, + "value": "94%" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": 10.3, + "value": "10.3℃" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": 0, + "value": "0m/s" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": "no_rain", + "value": "无雨" + }, + { + "key": "signal", + "label": "信号状态", + "raw": "信号良好", + "value": "信号良好" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": 17, + "value": "17颗" + } + ], + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "TEST-PLANE-61", + "deducted": 0, + "finished_at": null, + "id": 11, + "medias": [], + "order_id": 0, + "order_number": "261027271004", + "plane_id": 61, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 11, + "spot_attempt": 11, + "started_at": "2026-10-29 17:19:00", + "status": 20, + "status_label": "执行中", + "store_id": 38, + "store_user_id": 772, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_task_id": 1931 + }, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 61, + "plane_status": { + "connected": true, + "has_idle": true, + "has_shooting": true, + "planes": [ + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 2, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "拍摄中 · 电量 94%", + "task_type": 2, + "work_status": 2, + "work_status_label": "拍摄中" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 2, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "拍摄中 · 电量 94%", + "task_type": 2, + "work_status": 2, + "work_status_label": "拍摄中" + }, + "scenic_id": 271 + }, + "scenic": { + "id": 271, + "name": "北大科技园" + }, + "scenic_spot": { + "id": 412, + "name": "天门寻梦" + }, + "task": { + "id": 11, + "status": 20, + "status_label": "执行中", + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_status": 20, + "wayline_status_label": "拍摄中", + "wayline_task_id": 1931 + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "确认游客站位与取景后开始", + "phase": "arrived_pending_start", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "title": "无人机已到达 是否开始拍摄?" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:04" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://api-test.zhifly.cn/api/app/airport/shooting?id=11&live_battery=1" + }, + "response": { + "http_status": 200, + "body": { + "code": 100000, + "data": { + "air_line": { + "estimated_fly_time": 376, + "fly_type": 1, + "id": 302, + "line_video_duration": 25, + "name": "天门寻梦", + "scenic_spot_id": 412 + }, + "airport_sn": "TEST-PLANE-61", + "airport_status": { + "sn": "TEST-PLANE-61", + "status": 0, + "task_type": null, + "work_status_label": "离线" + }, + "current_plane": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线 · 电量 94%", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + "execute_gate": { + "can_execute": false, + "code": "wayline_not_shooting", + "message": "航线任务状态不可拍摄(当前:执行失败)", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)" + }, + "header": { + "order_number": "261027271004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "title": "天门寻梦 · 天门寻梦", + "tourist_label": "游客 130****0004", + "tourist_phone_mask": "130****0004" + }, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": 94, + "value": "94%" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": 10.3, + "value": "10.3℃" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": 0, + "value": "0m/s" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": "no_rain", + "value": "无雨" + }, + { + "key": "signal", + "label": "信号状态", + "raw": "信号良好", + "value": "信号良好" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": 17, + "value": "17颗" + } + ], + "order_flight_task": { + "air_line_id": 302, + "airport_sn": "TEST-PLANE-61", + "deducted": 0, + "finished_at": null, + "id": 11, + "medias": [], + "order_id": 0, + "order_number": "261027271004", + "plane_id": 61, + "result_code": "", + "result_message": "", + "scenic_id": 271, + "scenic_spot_id": 412, + "seq": 11, + "spot_attempt": 11, + "started_at": "2026-10-29 17:19:00", + "status": 20, + "status_label": "执行中", + "store_id": 38, + "store_user_id": 772, + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_task_id": 1931 + }, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 61, + "plane_status": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "planes": [ + { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线 · 电量 94%", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 58, + "is_receive_order": 2, + "name": "测试无人机 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + { + "battery_label": "", + "battery_percent": null, + "can_fly": false, + "id": 57, + "is_receive_order": 2, + "name": "测试无人机 57", + "online_status": 2, + "sn_number": "TEST-PLANE-57", + "status_text": "离线", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 94%", + "battery_percent": 94, + "can_fly": false, + "id": 61, + "is_receive_order": 1, + "name": "测试无人机 61", + "online_status": 2, + "sn_number": "TEST-PLANE-61", + "status_text": "离线 · 电量 94%", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + }, + "scenic_id": 271 + }, + "scenic": { + "id": 271, + "name": "北大科技园" + }, + "scenic_spot": { + "id": 412, + "name": "天门寻梦" + }, + "task": { + "id": 11, + "status": 20, + "status_label": "执行中", + "task_uuid": "917d0fdf-d55b-4263-889a-aae81d99cd7c", + "wayline_status": 91, + "wayline_status_label": "执行失败", + "wayline_task_id": 1931 + }, + "ui": { + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ], + "message": "航线任务状态不可拍摄(当前:执行失败)", + "phase": "blocked", + "primary_action": "blocked", + "primary_action_label": "航线任务状态不可拍摄(当前:执行失败)", + "title": "航线任务状态不可拍摄(当前:执行失败)" + } + }, + "msg": "success", + "time": "2026-10-29 17:19:59" + } + } + } +] diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/preparation-local.jpg b/docs/9.9.1/takeoff-integration-2026-10-29-1718/preparation-local.jpg new file mode 100644 index 0000000..68c818d Binary files /dev/null and b/docs/9.9.1/takeoff-integration-2026-10-29-1718/preparation-local.jpg differ diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-arrived-local.jpg b/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-arrived-local.jpg new file mode 100644 index 0000000..c65ceb8 Binary files /dev/null and b/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-arrived-local.jpg differ diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-failed-local.jpg b/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-failed-local.jpg new file mode 100644 index 0000000..2954d82 Binary files /dev/null and b/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-failed-local.jpg differ diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-failure-aligned-local.jpg b/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-failure-aligned-local.jpg new file mode 100644 index 0000000..d5ae100 Binary files /dev/null and b/docs/9.9.1/takeoff-integration-2026-10-29-1718/task11-failure-aligned-local.jpg differ diff --git a/docs/9.9.1/takeoff-integration-2026-10-29-1718/verification.json b/docs/9.9.1/takeoff-integration-2026-10-29-1718/verification.json new file mode 100644 index 0000000..3394990 --- /dev/null +++ b/docs/9.9.1/takeoff-integration-2026-10-29-1718/verification.json @@ -0,0 +1,39 @@ +{ + "tested_at": "2026-10-29", + "timezone": "Asia/Shanghai", + "environment": "https://api-test.zhifly.cn", + "simulator": "iPhone 18 Pro / iOS 27.0", + "order_number": "261027271004", + "scenic_id": 271, + "project_id": 386, + "scenic_spot_id": 412, + "air_line_id": 302, + "task_id": 11, + "wayline_task_id": 1931, + "plane_id": 61, + "request_counts": { + "GET /api/app/airport/home": 1, + "GET /api/yf-handset-app/photog/multi-plane/today-stats": 1, + "GET /api/yf-handset-app/photog/multi-plane/orders": 1, + "GET /api/app/airport/plane-status": 16, + "GET /api/yf-handset-app/photog/multi-plane/project-info": 2, + "POST /api/yf-handset-app/photog/multi-plane/tasks/create": 1, + "POST /api/app/airport/shoot": 1, + "GET /api/app/airport/shooting": 2 + }, + "all_http_statuses": [ + 200 + ], + "all_business_codes": [ + 100000 + ], + "last_observation": { + "time": "2026-10-29 17:19:59", + "task_status": 20, + "wayline_status": 91, + "gate_can_execute": false + }, + "redaction": "设备SN替换为TEST-PLANE-id,设备名称及游客脱敏手机号替换为测试值;其它字段与真实回执一致。", + "raw_local_path": "/private/tmp/suixinkan-takeoff-20261029-1718-api-raw.json", + "runtime_log_path": "/Users/hanqiu/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/logs/com.yuanzhixiang.suixinkan_2026-10-29T09-16-37-232Z_helperpid61913_ownerpid15238_24c18594.log" +} diff --git a/docs/9.9.1/task-create-integration-2026-10-29/create-task6-redacted.json b/docs/9.9.1/task-create-integration-2026-10-29/create-task6-redacted.json new file mode 100644 index 0000000..503d774 --- /dev/null +++ b/docs/9.9.1/task-create-integration-2026-10-29/create-task6-redacted.json @@ -0,0 +1,25 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "order_number": "TEST-ORDER-004", + "project_id": 386, + "project_name": "多点位航拍", + "created_at": "2026-10-27 17:39:10", + "user_phone": "130****0004", + "shoot_count": 5, + "shot_count": 0, + "remaining_count": 5, + "shoot_status": "processing", + "order_status": 20, + "material_status": 0, + "film_count": 0, + "can_create_task": true, + "can_upload_film": true, + "can_confirm": false, + "confirm_status": 0, + "confirmed_at": null, + "task_id": 6 + }, + "time": "2026-10-29 16:03:01" +} diff --git a/docs/9.9.1/task-create-integration-2026-10-29/tasks-create-redacted.json b/docs/9.9.1/task-create-integration-2026-10-29/tasks-create-redacted.json new file mode 100644 index 0000000..7601be0 --- /dev/null +++ b/docs/9.9.1/task-create-integration-2026-10-29/tasks-create-redacted.json @@ -0,0 +1,25 @@ +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "task_id": 1, + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 11:56:26" +} diff --git a/docs/9.9.1/ui-implementation-2026-10-23/completed-returning-card.png b/docs/9.9.1/ui-implementation-2026-10-23/completed-returning-card.png new file mode 100644 index 0000000..057dc05 Binary files /dev/null and b/docs/9.9.1/ui-implementation-2026-10-23/completed-returning-card.png differ diff --git a/docs/9.9.1/ui-implementation-2026-10-23/orders-all.png b/docs/9.9.1/ui-implementation-2026-10-23/orders-all.png new file mode 100644 index 0000000..fdf1f3c Binary files /dev/null and b/docs/9.9.1/ui-implementation-2026-10-23/orders-all.png differ diff --git a/docs/9.9.1/ui-implementation-2026-10-23/orders-completed-returning.png b/docs/9.9.1/ui-implementation-2026-10-23/orders-completed-returning.png new file mode 100644 index 0000000..34c325d Binary files /dev/null and b/docs/9.9.1/ui-implementation-2026-10-23/orders-completed-returning.png differ diff --git a/docs/9.9.1/ui-implementation-2026-10-23/workbench.png b/docs/9.9.1/ui-implementation-2026-10-23/workbench.png new file mode 100644 index 0000000..ac500d0 Binary files /dev/null and b/docs/9.9.1/ui-implementation-2026-10-23/workbench.png differ diff --git a/docs/9.9.1/ui-review-2026-10-23/01-workbench.jpg b/docs/9.9.1/ui-review-2026-10-23/01-workbench.jpg new file mode 100644 index 0000000..90f8e87 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/01-workbench.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/01-workbench.txt b/docs/9.9.1/ui-review-2026-10-23/01-workbench.txt new file mode 100644 index 0000000..599d0ea --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/01-workbench.txt @@ -0,0 +1,165 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:23 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/02-workbench-single-drone.jpg b/docs/9.9.1/ui-review-2026-10-23/02-workbench-single-drone.jpg new file mode 100644 index 0000000..c529612 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/02-workbench-single-drone.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/02-workbench-single-drone.txt b/docs/9.9.1/ui-review-2026-10-23/02-workbench-single-drone.txt new file mode 100644 index 0000000..b3a4010 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/02-workbench-single-drone.txt @@ -0,0 +1,94 @@ +- button: + - generic: iPhone +- generic: 2:59 +- banner: + - button: + - heading [level=1]: 机巢工作台 + - button: + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- dialog "体验本页状态": + - heading "体验本页状态" [level=2] + - paragraph: 只切换当前页面。正常操作会自动推进,无需额外控制。 + - button "只有一台无人机" [active]: + - text: 只有一台无人机 + - button "多台无人机 · 左右滑动": + - text: 多台无人机 · 左右滑动 + - button "设备空闲": + - text: 设备空闲 + - button "无人机占用中": + - text: 无人机占用中 + - button "机巢未连接": + - text: 机巢未连接 + - button "无人机无信号": + - text: 无人机无信号 + - button "电量不足": + - text: 电量不足 + - button "设备状态未知": + - text: 设备状态未知 + - button "暂无拍摄订单": + - text: 暂无拍摄订单 + - paragraph: 状态预览可停留查看;点击页面上的操作或下方按钮继续自动体验。拍摄状态预览本身不扣次数。 + - button "恢复正常体验" + - button "从头体验整个流程" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/03-workbench-unknown.jpg b/docs/9.9.1/ui-review-2026-10-23/03-workbench-unknown.jpg new file mode 100644 index 0000000..b0d2940 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/03-workbench-unknown.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/03-workbench-unknown.txt b/docs/9.9.1/ui-review-2026-10-23/03-workbench-unknown.txt new file mode 100644 index 0000000..1150654 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/03-workbench-unknown.txt @@ -0,0 +1,71 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 2:59 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 状态未知 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/04-workbench-drone-carousel.jpg b/docs/9.9.1/ui-review-2026-10-23/04-workbench-drone-carousel.jpg new file mode 100644 index 0000000..222cd8e Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/04-workbench-drone-carousel.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/04-workbench-drone-carousel.txt b/docs/9.9.1/ui-review-2026-10-23/04-workbench-drone-carousel.txt new file mode 100644 index 0000000..ee51029 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/04-workbench-drone-carousel.txt @@ -0,0 +1,165 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:00 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机" [active]: + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/05-payment-initial.jpg b/docs/9.9.1/ui-review-2026-10-23/05-payment-initial.jpg new file mode 100644 index 0000000..4c9abc1 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/05-payment-initial.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/05-payment-initial.txt b/docs/9.9.1/ui-review-2026-10-23/05-payment-initial.txt new file mode 100644 index 0000000..f1d495c --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/05-payment-initial.txt @@ -0,0 +1,190 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:00 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "选择航拍套餐": + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" [disabled] + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/06-package-picker.jpg b/docs/9.9.1/ui-review-2026-10-23/06-package-picker.jpg new file mode 100644 index 0000000..8086ee3 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/06-package-picker.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/06-package-picker.txt b/docs/9.9.1/ui-review-2026-10-23/06-package-picker.txt new file mode 100644 index 0000000..2d4056b --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/06-package-picker.txt @@ -0,0 +1,195 @@ +- button: + - generic: iPhone +- generic: 3:00 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button [disabled]: 设置金额 + - button [disabled]: 保存二维码 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "选择航拍套餐": + - heading "选择航拍套餐" [level=2] + - paragraph: 嵩山少林景区 + - radiogroup "当前项目套餐": + - radio "单次航拍 含 1 次拍摄 ¥99" [active]: + - strong: 单次航拍 + - generic: 含 1 次拍摄 + - generic: ¥99 + - radio "三次航拍套餐 含 3 次拍摄 ¥259": + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - generic: ¥259 + - radio "五次航拍套餐 含 5 次拍摄 ¥399": + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - generic: ¥399 + - paragraph: 选择套餐后可通过「设置金额」调整成交价,拍摄次数不变。 + - button "取消" + - button "确认套餐" [disabled] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/07-payment-ready.jpg b/docs/9.9.1/ui-review-2026-10-23/07-payment-ready.jpg new file mode 100644 index 0000000..f934e9f Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/07-payment-ready.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/07-payment-ready.txt b/docs/9.9.1/ui-review-2026-10-23/07-payment-ready.txt new file mode 100644 index 0000000..f2ac569 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/07-payment-ready.txt @@ -0,0 +1,196 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:01 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前三次航拍套餐": + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥259.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button "体验游客扫码支付" + - button "设置金额" + - button "保存二维码" + - generic: 等待游客支付 + - button "刷新状态" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/08-payment-amount-sheet.jpg b/docs/9.9.1/ui-review-2026-10-23/08-payment-amount-sheet.jpg new file mode 100644 index 0000000..70e13da Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/08-payment-amount-sheet.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/08-payment-amount-sheet.txt b/docs/9.9.1/ui-review-2026-10-23/08-payment-amount-sheet.txt new file mode 100644 index 0000000..4a92ee3 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/08-payment-amount-sheet.txt @@ -0,0 +1,194 @@ +- button: + - generic: iPhone +- generic: 3:01 +- banner: + - button: + - heading [level=1]: 收款详情 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button: + - generic: 航拍套餐 + - strong: 三次航拍套餐 + - generic: 含 3 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥259.00 + - img "演示收款二维码,不可支付" + - paragraph: 演示码 · 不可支付 + - button: 体验游客扫码支付 + - button: 设置金额 + - button: 保存二维码 + - generic: 等待游客支付 + - button: 刷新状态 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- dialog "收款金额": + - heading "收款金额" [level=2] + - paragraph: 仅修改本次成交价,不改变套餐拍摄次数 + - generic: ¥ + - textbox "收款金额": + - /placeholder: 请输入收款金额 + - text: "259.00" + - text: 备注(选填) + - textbox "收款备注" + - paragraph: 0/200 + - button "取消" + - button "确定" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/09-payment-code-failed.jpg b/docs/9.9.1/ui-review-2026-10-23/09-payment-code-failed.jpg new file mode 100644 index 0000000..42e4bc0 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/09-payment-code-failed.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/09-payment-code-failed.txt b/docs/9.9.1/ui-review-2026-10-23/09-payment-code-failed.txt new file mode 100644 index 0000000..435216f --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/09-payment-code-failed.txt @@ -0,0 +1,194 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:01 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐": + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - paragraph: 收款码生成失败 + - button "重新生成" + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/10-payment-code-expired.jpg b/docs/9.9.1/ui-review-2026-10-23/10-payment-code-expired.jpg new file mode 100644 index 0000000..a3eb232 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/10-payment-code-expired.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/10-payment-code-expired.txt b/docs/9.9.1/ui-review-2026-10-23/10-payment-code-expired.txt new file mode 100644 index 0000000..8b89da4 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/10-payment-code-expired.txt @@ -0,0 +1,194 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:01 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐": + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - paragraph: 收款码已失效 + - button "重新生成" + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/11-payment-empty-packages.jpg b/docs/9.9.1/ui-review-2026-10-23/11-payment-empty-packages.jpg new file mode 100644 index 0000000..9aaea39 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/11-payment-empty-packages.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/11-payment-empty-packages.txt b/docs/9.9.1/ui-review-2026-10-23/11-payment-empty-packages.txt new file mode 100644 index 0000000..9d5367b --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/11-payment-empty-packages.txt @@ -0,0 +1,190 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:01 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "选择航拍套餐": + - generic: 航拍套餐 + - strong: 请选择 + - paragraph: 请选择航拍套餐 + - generic: 选择后生成对应套餐收款码 + - paragraph: HTML 交互演示 · 不进行真实收款 + - button "设置金额" [disabled] + - button "保存二维码" [disabled] + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/12-payment-success.jpg b/docs/9.9.1/ui-review-2026-10-23/12-payment-success.jpg new file mode 100644 index 0000000..abc8e16 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/12-payment-success.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/12-payment-success.txt b/docs/9.9.1/ui-review-2026-10-23/12-payment-success.txt new file mode 100644 index 0000000..bc0a2ba --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/12-payment-success.txt @@ -0,0 +1,192 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:02 +- banner: + - button "返回": + - heading "收款详情" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 9" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 0/5 次 + - generic: ·剩余 5 次 + - button "开始拍摄" + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/13-payment-orders-default.jpg b/docs/9.9.1/ui-review-2026-10-23/13-payment-orders-default.jpg new file mode 100644 index 0000000..d3cb69e Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/13-payment-orders-default.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/13-payment-orders-default.txt b/docs/9.9.1/ui-review-2026-10-23/13-payment-orders-default.txt new file mode 100644 index 0000000..06ca98c --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/13-payment-orders-default.txt @@ -0,0 +1,240 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:02 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" [pressed] + - button "待拍摄" + - button "进行中" + - button "已完成" + - heading "全部订单 13" [level=2] + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: + - text: DEMO-R-1792738915668 + - generic: · + - text: 10/23 15:01 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar "已拍摄 3 次,共 5 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar "已拍摄 0 次,共 1 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar "已拍摄 2 次,共 5 次" + - button "查看素材 上传失败": + - text: 查看素材 + - generic: 上传失败 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 13 个订单 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/14-orders-completed.jpg b/docs/9.9.1/ui-review-2026-10-23/14-orders-completed.jpg new file mode 100644 index 0000000..53988d8 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/14-orders-completed.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/14-orders-completed.txt b/docs/9.9.1/ui-review-2026-10-23/14-orders-completed.txt new file mode 100644 index 0000000..8593db0 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/14-orders-completed.txt @@ -0,0 +1,111 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:02 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [active] [pressed] + - heading "已完成订单 4" [level=2] + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 4 个订单 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/15-orders-pending.jpg b/docs/9.9.1/ui-review-2026-10-23/15-orders-pending.jpg new file mode 100644 index 0000000..54e2bad Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/15-orders-pending.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/15-orders-pending.txt b/docs/9.9.1/ui-review-2026-10-23/15-orders-pending.txt new file mode 100644 index 0000000..8476851 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/15-orders-pending.txt @@ -0,0 +1,116 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:02 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" [active] [pressed] + - button "进行中" + - button "已完成" + - heading "待拍摄订单 5" [level=2] + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: + - text: DEMO-R-1792738915668 + - generic: · + - text: 10/23 15:01 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar "已拍摄 0 次,共 1 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - paragraph: 已显示全部 5 个订单 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/16-orders-empty.jpg b/docs/9.9.1/ui-review-2026-10-23/16-orders-empty.jpg new file mode 100644 index 0000000..825e1f8 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/16-orders-empty.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/16-orders-empty.txt b/docs/9.9.1/ui-review-2026-10-23/16-orders-empty.txt new file mode 100644 index 0000000..6b49085 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/16-orders-empty.txt @@ -0,0 +1,52 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:03 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" [pressed] + - button "进行中" + - button "已完成" + - heading "待拍摄订单 0" [level=2] + - heading "暂无待拍摄订单" [level=3] + - paragraph: 分配给你的订单会显示在这里 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/17-orders-delivery-example.jpg b/docs/9.9.1/ui-review-2026-10-23/17-orders-delivery-example.jpg new file mode 100644 index 0000000..bc691f8 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/17-orders-delivery-example.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/17-orders-delivery-example.txt b/docs/9.9.1/ui-review-2026-10-23/17-orders-delivery-example.txt new file mode 100644 index 0000000..0369b80 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/17-orders-delivery-example.txt @@ -0,0 +1,116 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:03 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" [pressed] + - button "进行中" + - button "已完成" + - heading "待拍摄订单 5" [level=2] + - article: + - heading "游客158****2026" [level=2] + - generic: 待拍摄 + - paragraph: + - text: DEMO-R-1792738915668 + - generic: · + - text: 10/23 15:01 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar "已拍摄 0 次,共 1 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客138****0638" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - article: + - heading "游客151****8602" [level=2] + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar "已拍摄 0 次,共 5 次" + - button "交付成片" + - button "开始拍摄" + - paragraph: 已显示全部 5 个订单 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/18-orders-in-progress.jpg b/docs/9.9.1/ui-review-2026-10-23/18-orders-in-progress.jpg new file mode 100644 index 0000000..3acb68b Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/18-orders-in-progress.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/18-orders-in-progress.txt b/docs/9.9.1/ui-review-2026-10-23/18-orders-in-progress.txt new file mode 100644 index 0000000..f442a61 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/18-orders-in-progress.txt @@ -0,0 +1,118 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:03 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading "嵩山少林景区" [level=2] + - button "更换套餐,当前五次航拍套餐" [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button "继续收款" + - button "查看订单" + - region "收款信息": + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button "收款记录": + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch "收款到账语音提醒" + - heading "线下收款" [level=3] + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button "去登记" +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [active] [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar "已拍摄 3 次,共 5 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "请游客确认 已交付 3 个视频": + - text: 请游客确认 + - generic: 已交付 3 个视频 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar "已拍摄 2 次,共 5 次" + - button "查看素材 上传失败": + - text: 查看素材 + - generic: 上传失败 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - paragraph: 已显示全部 4 个订单 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/19-delivery-method-sheet.jpg b/docs/9.9.1/ui-review-2026-10-23/19-delivery-method-sheet.jpg new file mode 100644 index 0000000..9331e0c Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/19-delivery-method-sheet.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/19-delivery-method-sheet.txt b/docs/9.9.1/ui-review-2026-10-23/19-delivery-method-sheet.txt new file mode 100644 index 0000000..5167258 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/19-delivery-method-sheet.txt @@ -0,0 +1,130 @@ +- button: + - generic: iPhone +- generic: 3:03 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button: 继续收款 + - button: 查看订单 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button [pressed]: 进行中 + - button: 已完成 + - heading [level=2]: 进行中订单 4 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 已交付 3 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - paragraph: 已显示全部 4 个订单 +- dialog "交付成片": + - heading "交付成片" [level=2] + - button "关闭成片交付" [active]: + - paragraph: + - text: 游客158****8888 + - generic: 请选择本次交付方式 + - button "面对面闪传 近距离传给游客 · 流程待确认": + - strong: 面对面闪传 + - generic: 近距离传给游客 · 流程待确认 + - button "云端上传 选择打卡点,上传后游客可查看": + - strong: 云端上传 + - generic: 选择打卡点,上传后游客可查看 + - paragraph: 可分批交付多个作品,不影响拍摄次数 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/20-delivery-nearby-placeholder.jpg b/docs/9.9.1/ui-review-2026-10-23/20-delivery-nearby-placeholder.jpg new file mode 100644 index 0000000..04c0d5e Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/20-delivery-nearby-placeholder.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/20-delivery-nearby-placeholder.txt b/docs/9.9.1/ui-review-2026-10-23/20-delivery-nearby-placeholder.txt new file mode 100644 index 0000000..70a0dbd --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/20-delivery-nearby-placeholder.txt @@ -0,0 +1,129 @@ +- button: + - generic: iPhone +- generic: 3:03 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button: 继续收款 + - button: 查看订单 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button [pressed]: 进行中 + - button: 已完成 + - heading [level=2]: 进行中订单 4 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 已交付 3 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - paragraph: 已显示全部 4 个订单 +- dialog "面对面闪传" [active]: + - heading "面对面闪传" [level=2] + - button "关闭成片交付": + - paragraph: + - text: 游客158****8888 + - generic: 本次仅演示交付入口 + - heading "闪传流程待确认" [level=3] + - paragraph: + - text: 热点连接与游客接收流程暂未接入演示。 + - text: 现在可以先体验云端上传。 + - button "改用云端上传" + - button "返回交付方式" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/21-delivery-cloud-point.jpg b/docs/9.9.1/ui-review-2026-10-23/21-delivery-cloud-point.jpg new file mode 100644 index 0000000..5a089ee Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/21-delivery-cloud-point.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/21-delivery-cloud-point.txt b/docs/9.9.1/ui-review-2026-10-23/21-delivery-cloud-point.txt new file mode 100644 index 0000000..6d5ec69 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/21-delivery-cloud-point.txt @@ -0,0 +1,134 @@ +- button: + - generic: iPhone +- generic: 3:04 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - region "收款二维码": + - heading [level=2]: 嵩山少林景区 + - button [disabled]: + - generic: 航拍套餐 + - strong: 五次航拍套餐 + - generic: 含 5 次拍摄 + - paragraph: + - text: 本次收款 + - strong: ¥399.00 + - heading "收款成功" [level=3] + - paragraph: 订单已归属吴家俊 + - paragraph: 游客158****2026 + - paragraph: 演示支付结果,未发生真实交易 + - button: 继续收款 + - button: 查看订单 + - region: + - generic: 景区名称 + - generic: 嵩山少林景区 + - generic: 收款方 + - generic: 示例景区运营商 + - generic: 员工 ID + - generic: "700" + - button: + - generic: 收款记录 + - generic: 收款到账语音提醒 + - switch + - heading [level=3]: 线下收款 + - paragraph: + - text: 线下收款登记 + - generic: 原有功能,本次演示不调整 + - button: 去登记 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button [pressed]: 进行中 + - button: 已完成 + - heading [level=2]: 进行中订单 4 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 已交付 3 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - paragraph: 已显示全部 4 个订单 +- dialog "选择打卡点": + - heading "选择打卡点" [level=2] + - button "关闭成片交付": + - paragraph: + - text: 游客158****8888 + - generic: 云端上传 · 请选择本批成片对应的打卡点 + - button "三皇寨" [active] [pressed]: + - text: 三皇寨 + - button "金阙云宫": + - text: 金阙云宫 + - button "少室山": + - text: 少室山 + - button "迎客峰": + - text: 迎客峰 + - button "去相册选视频" + - paragraph: 可选择一个或多个视频,上传成功即交付 + - button "返回交付方式" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/22-order-delivery-review.jpg b/docs/9.9.1/ui-review-2026-10-23/22-order-delivery-review.jpg new file mode 100644 index 0000000..b6a0cd1 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/22-order-delivery-review.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/22-order-delivery-review.txt b/docs/9.9.1/ui-review-2026-10-23/22-order-delivery-review.txt new file mode 100644 index 0000000..0b55dc6 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/22-order-delivery-review.txt @@ -0,0 +1,121 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:04 +- banner: + - button "返回": + - heading "订单交付确认" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar "已拍摄 3 次,共 5 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "请游客确认 已交付 3 个视频": + - text: 请游客确认 + - generic: 已交付 3 个视频 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar "已拍摄 2 次,共 5 次" + - button "查看素材 上传失败": + - text: 查看素材 + - generic: 上传失败 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - paragraph: 已显示全部 4 个订单 +- main: + - heading "游客158****8888" [level=2] + - generic: 整单确认 + - paragraph: HT202610200001 + - heading "先核对,再请游客确认" [level=2] + - paragraph: 一次确认整单,不按打卡点逐次确认。 + - generic: 本订单已交付 + - strong: 3 个成片 + - generic: 覆盖 2 个打卡点 + - heading "整单交付清单" [level=2] + - generic: 含所有上传批次 + - heading "三皇寨" [level=3] + - generic: 2 个视频 + - button "预览三皇寨成片1": + - img "成片演示封面" + - generic: 00:32 + - strong: 成片 01 + - generic: 三皇寨_成片01.mp4 + - button "预览三皇寨成片2": + - img "成片演示封面" + - generic: 00:48 + - strong: 成片 02 + - generic: 三皇寨_成片02.mp4 + - heading "金阙云宫" [level=3] + - generic: 1 个视频 + - button "预览金阙云宫成片1": + - img "成片演示封面" + - generic: 00:32 + - strong: 成片 01 + - generic: 金阙云宫_成片01.mp4 + - paragraph: 请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。 +- contentinfo: + - checkbox "我已核对,本订单成片已全部交齐": 我已核对,本订单成片已全部交齐 + - button "已交齐,展示订单确认码" [disabled] + - button "还未交齐,继续交付" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/23-order-confirmation-code.jpg b/docs/9.9.1/ui-review-2026-10-23/23-order-confirmation-code.jpg new file mode 100644 index 0000000..3fb6fa4 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/23-order-confirmation-code.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/23-order-confirmation-code.txt b/docs/9.9.1/ui-review-2026-10-23/23-order-confirmation-code.txt new file mode 100644 index 0000000..a9ac068 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/23-order-confirmation-code.txt @@ -0,0 +1,107 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:04 +- banner: + - button "返回": + - heading "订单交付确认" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar "已拍摄 3 次,共 5 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "请游客确认 待游客确认 · 3 个视频": + - text: 请游客确认 + - generic: 待游客确认 · 3 个视频 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar "已拍摄 2 次,共 5 次" + - button "查看素材 上传失败": + - text: 查看素材 + - generic: 上传失败 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - paragraph: 已显示全部 4 个订单 +- main: + - heading "游客158****8888" [level=2] + - generic: 整单确认 + - paragraph: HT202610200001 + - generic: 等待游客确认 + - heading "请游客扫码确认收货" [level=2] + - paragraph: 查看本订单全部成片后,一次确认 + - img "订单确认演示二维码" + - strong: 3 个成片 + - generic: · + - text: 2 个打卡点 + - generic: 扫描不等于收货,需游客本人主动确认 + - generic: 仅供交互演示 · 不连接游客手机 + - button "演示游客扫码": + - text: 演示游客扫码 + - generic "查看本次整单确认清单" + - paragraph: 演示码不提供真实扫码收货服务。正式功能需校验订单身份,并保存具体作品与确认记录。 +- contentinfo: + - button "刷新确认状态": + - text: 刷新确认状态 + - button "稍后确认,返回订单" [active] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/24-visitor-confirmation-demo.jpg b/docs/9.9.1/ui-review-2026-10-23/24-visitor-confirmation-demo.jpg new file mode 100644 index 0000000..a485276 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/24-visitor-confirmation-demo.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/24-visitor-confirmation-demo.txt b/docs/9.9.1/ui-review-2026-10-23/24-visitor-confirmation-demo.txt new file mode 100644 index 0000000..af46b77 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/24-visitor-confirmation-demo.txt @@ -0,0 +1,119 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:04 +- banner: + - button "返回": + - heading "订单交付确认" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar "已拍摄 3 次,共 5 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "请游客确认 待游客确认 · 3 个视频": + - text: 请游客确认 + - generic: 待游客确认 · 3 个视频 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar "已拍摄 2 次,共 5 次" + - button "查看素材 上传失败": + - text: 查看素材 + - generic: 上传失败 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - paragraph: 已显示全部 4 个订单 +- main: + - heading "游客158****8888" [level=2] + - generic: 游客端演示 + - paragraph: HT202610200001 + - text: 扫码后的游客端 · 演示身份校验 + - heading "您的成片已交付" [level=2] + - paragraph: + - text: 共 3 个视频 · 2 个打卡点 + - text: 请核对视频数量与内容,再确认收到。 + - heading "三皇寨" [level=3] + - generic: 2 个视频 + - button "预览三皇寨成片1": + - img "成片演示封面" + - generic: 00:32 + - strong: 成片 01 + - generic: 三皇寨_成片01.mp4 + - button "预览三皇寨成片2": + - img "成片演示封面" + - generic: 00:48 + - strong: 成片 02 + - generic: 三皇寨_成片02.mp4 + - heading "金阙云宫" [level=3] + - generic: 1 个视频 + - button "预览金阙云宫成片1": + - img "成片演示封面" + - generic: 00:32 + - strong: 成片 01 + - generic: 金阙云宫_成片01.mp4 + - paragraph: 我已查看本订单交付清单,确认收到上述全部成片。 如有缺失、无法播放或其他问题,请先反馈工作人员处理。 +- contentinfo: + - checkbox "我已查看清单,确认收到全部成片": 我已查看清单,确认收到全部成片 + - button "确认收到全部成片(3 个)" [disabled] + - button "视频有问题,先反馈" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/25-delivery-feedback.jpg b/docs/9.9.1/ui-review-2026-10-23/25-delivery-feedback.jpg new file mode 100644 index 0000000..bdcb2db Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/25-delivery-feedback.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/25-delivery-feedback.txt b/docs/9.9.1/ui-review-2026-10-23/25-delivery-feedback.txt new file mode 100644 index 0000000..045fcb0 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/25-delivery-feedback.txt @@ -0,0 +1,124 @@ +- button: + - generic: iPhone +- generic: 3:04 +- banner: + - button: + - heading [level=1]: 订单交付确认 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button: 全部 + - button: 待拍摄 + - button [pressed]: 进行中 + - button: 已完成 + - heading [level=2]: 进行中订单 4 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 待游客确认 · 3 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - paragraph: 已显示全部 4 个订单 +- main: + - heading [level=2]: 游客158****8888 + - generic: 游客端演示 + - paragraph: HT202610200001 + - text: 扫码后的游客端 · 演示身份校验 + - heading [level=2]: 您的成片已交付 + - paragraph: 共 3 个视频 · 2 个打卡点 请核对视频数量与内容,再确认收到。 + - heading [level=3]: 三皇寨 + - generic: 2 个视频 + - button: + - generic: 00:32 + - strong: 成片 01 + - generic: 三皇寨_成片01.mp4 + - button: + - generic: 00:48 + - strong: 成片 02 + - generic: 三皇寨_成片02.mp4 + - heading [level=3]: 金阙云宫 + - generic: 1 个视频 + - button: + - generic: 00:32 + - strong: 成片 01 + - generic: 金阙云宫_成片01.mp4 + - paragraph: 我已查看本订单交付清单,确认收到上述全部成片。 如有缺失、无法播放或其他问题,请先反馈工作人员处理。 +- contentinfo: + - checkbox: 我已查看清单,确认收到全部成片 + - button [disabled]: 确认收到全部成片(3 个) + - button: 视频有问题,先反馈 +- dialog "反馈成片问题": + - heading "反馈成片问题" [level=2] + - paragraph: 反馈不会确认收货,请与工作人员沟通处理。 + - button "视频缺失" [active] + - button "无法播放" + - button "成片效果有异议" + - button "其他问题" + - textbox "补充问题说明": + - /placeholder: 可补充打卡点、视频名称与具体问题 + - button "提交问题反馈" [disabled] + - paragraph: 演示提交仅保存在当前浏览器会话,不发送真实消息。 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/26-order-confirmed-receipt.jpg b/docs/9.9.1/ui-review-2026-10-23/26-order-confirmed-receipt.jpg new file mode 100644 index 0000000..29a028b Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/26-order-confirmed-receipt.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/26-order-confirmed-receipt.txt b/docs/9.9.1/ui-review-2026-10-23/26-order-confirmed-receipt.txt new file mode 100644 index 0000000..61cbb74 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/26-order-confirmed-receipt.txt @@ -0,0 +1,128 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:05 +- banner: + - button "返回": + - heading "订单交付确认" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" [pressed] + - button "已完成" + - heading "进行中订单 4" [level=2] + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar "已拍摄 3 次,共 5 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "查看记录 游客已确认收货 2026/10/23 15:04:53": + - text: 查看记录 + - generic: 游客已确认收货 + - generic: 2026/10/23 15:04:53 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar "已拍摄 2 次,共 5 次" + - button "查看素材 上传失败": + - text: 查看素材 + - generic: 上传失败 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客159****7206" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - article: + - heading "游客186****9357" [level=2] + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar "已拍摄 1 次,共 5 次" + - button "查看素材 上传完成": + - text: 查看素材 + - generic: 上传完成 + - button "交付成片" + - button "继续拍摄" + - paragraph: 已显示全部 4 个订单 +- main: + - heading "游客158****8888" [level=2] + - generic: 整单确认 + - paragraph: HT202610200001 + - heading "游客已确认收货" [level=2] + - paragraph: 本订单一次确认,共 3 个成片 + - term: 确认人 + - definition: 游客158****8888 + - term: 确认时间 + - definition: 2026/10/23 15:04:53 + - term: 交付工作人员 + - definition: 吴家俊 + - term: 确认范围 + - definition: 2 个打卡点 · 3 个成片 + - strong: 游客确认内容 + - paragraph: 我已查看本订单交付清单,确认收到上述全部成片。 + - heading "已确认的成片清单" [level=2] + - generic: 确认时的记录 + - heading "三皇寨" [level=3] + - generic: 2 个视频 + - button "预览三皇寨成片1": + - img "成片演示封面" + - generic: 00:32 + - strong: 成片 01 + - generic: 三皇寨_成片01.mp4 + - button "预览三皇寨成片2": + - img "成片演示封面" + - generic: 00:48 + - strong: 成片 02 + - generic: 三皇寨_成片02.mp4 + - heading "金阙云宫" [level=3] + - generic: 1 个视频 + - button "预览金阙云宫成片1": + - img "成片演示封面" + - generic: 00:32 + - strong: 成片 01 + - generic: 金阙云宫_成片01.mp4 + - paragraph: 当前为本机演示记录,并非真实收货凭据。新增成片不会覆盖原确认清单。 +- contentinfo: + - paragraph: 仅确认交付清单,不代表对拍摄效果无异议 + - button "返回订单列表" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/27-preparation-ready.jpg b/docs/9.9.1/ui-review-2026-10-23/27-preparation-ready.jpg new file mode 100644 index 0000000..7d6c8c2 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/27-preparation-ready.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/27-preparation-ready.txt b/docs/9.9.1/ui-review-2026-10-23/27-preparation-ready.txt new file mode 100644 index 0000000..ce5469f --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/27-preparation-ready.txt @@ -0,0 +1,222 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:05 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/28-preparation-point-switch.jpg b/docs/9.9.1/ui-review-2026-10-23/28-preparation-point-switch.jpg new file mode 100644 index 0000000..89f8711 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/28-preparation-point-switch.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/28-preparation-point-switch.txt b/docs/9.9.1/ui-review-2026-10-23/28-preparation-point-switch.txt new file mode 100644 index 0000000..02da108 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/28-preparation-point-switch.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:05 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [active] [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" + - status: 每次拍摄成功后扣减 1 次,未成功不扣次数。 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/29-preparation-occupied.jpg b/docs/9.9.1/ui-review-2026-10-23/29-preparation-occupied.jpg new file mode 100644 index 0000000..608ac59 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/29-preparation-occupied.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/29-preparation-occupied.txt b/docs/9.9.1/ui-review-2026-10-23/29-preparation-occupied.txt new file mode 100644 index 0000000..fecf90c --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/29-preparation-occupied.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 无人机占用中,请稍后再试 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/30-preparation-disconnected.jpg b/docs/9.9.1/ui-review-2026-10-23/30-preparation-disconnected.jpg new file mode 100644 index 0000000..72060cb Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/30-preparation-disconnected.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/30-preparation-disconnected.txt b/docs/9.9.1/ui-review-2026-10-23/30-preparation-disconnected.txt new file mode 100644 index 0000000..285fd5d --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/30-preparation-disconnected.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢未连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 未连接 + - button "确认并召唤无人机" [disabled] + - status: 机巢未连接,请连接后重试 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/31-preparation-no-signal.jpg b/docs/9.9.1/ui-review-2026-10-23/31-preparation-no-signal.jpg new file mode 100644 index 0000000..eac5146 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/31-preparation-no-signal.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/31-preparation-no-signal.txt b/docs/9.9.1/ui-review-2026-10-23/31-preparation-no-signal.txt new file mode 100644 index 0000000..e20028e --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/31-preparation-no-signal.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 无信号 + - button "确认并召唤无人机" [disabled] + - status: 无人机无信号,暂时无法召唤 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/32-preparation-low-battery.jpg b/docs/9.9.1/ui-review-2026-10-23/32-preparation-low-battery.jpg new file mode 100644 index 0000000..aad748c Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/32-preparation-low-battery.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/32-preparation-low-battery.txt b/docs/9.9.1/ui-review-2026-10-23/32-preparation-low-battery.txt new file mode 100644 index 0000000..f27a8d0 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/32-preparation-low-battery.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 低电量 · 电量 18% + - button "确认并召唤无人机" [disabled] + - status: 电量不足,设备暂不允许执行 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/33-preparation-unknown.jpg b/docs/9.9.1/ui-review-2026-10-23/33-preparation-unknown.jpg new file mode 100644 index 0000000..732fe18 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/33-preparation-unknown.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/33-preparation-unknown.txt b/docs/9.9.1/ui-review-2026-10-23/33-preparation-unknown.txt new file mode 100644 index 0000000..9e8dd2a --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/33-preparation-unknown.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 状态未知 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 状态未知 + - button "确认并召唤无人机" [disabled] + - status: 无人机状态未知,请刷新确认 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/34-preparation-out-of-range.jpg b/docs/9.9.1/ui-review-2026-10-23/34-preparation-out-of-range.jpg new file mode 100644 index 0000000..0f508a5 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/34-preparation-out-of-range.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/34-preparation-out-of-range.txt b/docs/9.9.1/ui-review-2026-10-23/34-preparation-out-of-range.txt new file mode 100644 index 0000000..500c099 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/34-preparation-out-of-range.txt @@ -0,0 +1,212 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 3 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 3 条 + - radiogroup "金阙云宫的航线": + - radio "云宫环绕" [checked]: + - strong: 云宫环绕 + - radio "金顶渐远": + - strong: 金顶渐远 + - radio "云海全景": + - strong: 云海全景 +- contentinfo: + - text: 机巢已连接 + - text: 尚未进入范围 + - heading "金阙云宫 · 云宫环绕" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 请先进入所选拍摄点的范围 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/35-preparation-no-routes.jpg b/docs/9.9.1/ui-review-2026-10-23/35-preparation-no-routes.jpg new file mode 100644 index 0000000..0efb81a Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/35-preparation-no-routes.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/35-preparation-no-routes.txt b/docs/9.9.1/ui-review-2026-10-23/35-preparation-no-routes.txt new file mode 100644 index 0000000..440bde5 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/35-preparation-no-routes.txt @@ -0,0 +1,207 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 0 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 0 条 + - heading "暂无可用航线" [level=3] + - paragraph: 请选择其他拍摄点,或稍后重试 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 未选择航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前拍摄点暂无可用航线 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/36-preparation-no-quota.jpg b/docs/9.9.1/ui-review-2026-10-23/36-preparation-no-quota.jpg new file mode 100644 index 0000000..a34504a Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/36-preparation-no-quota.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/36-preparation-no-quota.txt b/docs/9.9.1/ui-review-2026-10-23/36-preparation-no-quota.txt new file mode 100644 index 0000000..6cd4e34 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/36-preparation-no-quota.txt @@ -0,0 +1,207 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 7" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客135****3092" [level=2] + - generic: 待拍摄 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 0/5 次 + - generic: ·剩余 5 次 + - button "开始拍摄" + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次": + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 范围内 未拍摄" [pressed]: + - heading "金阙云宫" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "金阙云宫的航线 共 0 条" [level=2]: + - text: 金阙云宫的航线 + - generic: 共 0 条 + - heading "暂无可用航线" [level=3] + - paragraph: 请选择其他拍摄点,或稍后重试 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "金阙云宫 · 未选择航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 空闲 · 电量 95% + - button "确认并召唤无人机" [disabled] + - status: 当前订单拍摄次数已用完 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/37-task-arrived.jpg b/docs/9.9.1/ui-review-2026-10-23/37-task-arrived.jpg new file mode 100644 index 0000000..0408bf7 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/37-task-arrived.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/37-task-arrived.txt b/docs/9.9.1/ui-review-2026-10-23/37-task-arrived.txt new file mode 100644 index 0000000..9d99188 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/37-task-arrived.txt @@ -0,0 +1,99 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:06 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 0 次 + - paragraph: + - text: 剩余 + - strong: "1" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 未拍摄" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 未拍摄 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/38-task-success-dialog.jpg b/docs/9.9.1/ui-review-2026-10-23/38-task-success-dialog.jpg new file mode 100644 index 0000000..abbbece Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/38-task-success-dialog.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/38-task-success-dialog.txt b/docs/9.9.1/ui-review-2026-10-23/38-task-success-dialog.txt new file mode 100644 index 0000000..4621614 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/38-task-success-dialog.txt @@ -0,0 +1,103 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:07 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机已返回机巢。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 +- alertdialog "拍摄已完成": + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已完成, 请及时查看并下载素材。 + - button "稍后再去" + - button "去查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/39-task-returning-zero-quota.jpg b/docs/9.9.1/ui-review-2026-10-23/39-task-returning-zero-quota.jpg new file mode 100644 index 0000000..185f9e9 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/39-task-returning-zero-quota.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/39-task-returning-zero-quota.txt b/docs/9.9.1/ui-review-2026-10-23/39-task-returning-zero-quota.txt new file mode 100644 index 0000000..f93827a --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/39-task-returning-zero-quota.txt @@ -0,0 +1,98 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:07 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在返航" [level=2] + - paragraph: 本次拍摄已中断。 请留意实时画面与无人机状态。 + - button "拍摄已中断" [disabled]: + - text: 拍摄已中断 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/40-task-leave-confirmation.jpg b/docs/9.9.1/ui-review-2026-10-23/40-task-leave-confirmation.jpg new file mode 100644 index 0000000..f142925 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/40-task-leave-confirmation.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/40-task-leave-confirmation.txt b/docs/9.9.1/ui-review-2026-10-23/40-task-leave-confirmation.txt new file mode 100644 index 0000000..09ddf9c --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/40-task-leave-confirmation.txt @@ -0,0 +1,103 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:07 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在返航" [level=2] + - paragraph: 本次拍摄已中断。 请留意实时画面与无人机状态。 + - button "拍摄已中断" [disabled]: + - text: 拍摄已中断 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- alertdialog "任务仍在执行": + - heading "任务仍在执行" [level=2] + - paragraph: 离开后将无法实时查看画面与状态。是否离开? + - button "离开页面" + - button "继续查看" [active] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/41-returned-to-preparation.jpg b/docs/9.9.1/ui-review-2026-10-23/41-returned-to-preparation.jpg new file mode 100644 index 0000000..c0e8760 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/41-returned-to-preparation.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/41-returned-to-preparation.txt b/docs/9.9.1/ui-review-2026-10-23/41-returned-to-preparation.txt new file mode 100644 index 0000000..c29dd96 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/41-returned-to-preparation.txt @@ -0,0 +1,223 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:07 +- banner: + - button "返回": + - heading "拍摄准备" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 1/1 次 + - generic: ·剩余 0 次 + - button "继续查看任务" + - text: 素材上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - heading "游客136****2806" [level=2] + - paragraph: 含 1 次拍摄 + - paragraph: 已拍摄 1 次 + - paragraph: + - text: 剩余 + - strong: "0" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 1 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 1 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- contentinfo: + - text: 机巢已连接 + - text: 点位范围内 + - heading "三皇寨 · 经典航线" [level=3] + - paragraph: + - text: 无人机: + - generic: 占用中 · 电量 95% + - button "继续查看任务" + - status: 当前订单已有任务执行中,请继续查看原任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/42-workbench-zero-quota-active.jpg b/docs/9.9.1/ui-review-2026-10-23/42-workbench-zero-quota-active.jpg new file mode 100644 index 0000000..5264200 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/42-workbench-zero-quota-active.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/42-workbench-zero-quota-active.txt b/docs/9.9.1/ui-review-2026-10-23/42-workbench-zero-quota-active.txt new file mode 100644 index 0000000..5de640b --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/42-workbench-zero-quota-active.txt @@ -0,0 +1,166 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:08 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 1/1 次 + - generic: ·剩余 0 次 + - button "继续查看任务" + - text: 素材上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/43-completed-order-active-task.jpg b/docs/9.9.1/ui-review-2026-10-23/43-completed-order-active-task.jpg new file mode 100644 index 0000000..10063dd Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/43-completed-order-active-task.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/43-completed-order-active-task.txt b/docs/9.9.1/ui-review-2026-10-23/43-completed-order-active-task.txt new file mode 100644 index 0000000..c78d314 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/43-completed-order-active-task.txt @@ -0,0 +1,249 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:08 +- banner: + - button "返回": + - heading "我的拍摄订单" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 1/1 次 + - generic: ·剩余 0 次 + - button "继续查看任务" + - text: 素材上传中 + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [active] [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/44-task-shooting.jpg b/docs/9.9.1/ui-review-2026-10-23/44-task-shooting.jpg new file mode 100644 index 0000000..1b9c1cd Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/44-task-shooting.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/44-task-shooting.txt b/docs/9.9.1/ui-review-2026-10-23/44-task-shooting.txt new file mode 100644 index 0000000..5ba239b --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/44-task-shooting.txt @@ -0,0 +1,133 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:08 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/45-task-pause-processing.jpg b/docs/9.9.1/ui-review-2026-10-23/45-task-pause-processing.jpg new file mode 100644 index 0000000..42d1053 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/45-task-pause-processing.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/45-task-pause-processing.txt b/docs/9.9.1/ui-review-2026-10-23/45-task-pause-processing.txt new file mode 100644 index 0000000..9fb2e63 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/45-task-pause-processing.txt @@ -0,0 +1,133 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:08 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 请关注现场及实时画面。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "正在暂停 尚未确认悬停" [disabled]: + - strong: 正在暂停 + - generic: 尚未确认悬停 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/46-task-paused.jpg b/docs/9.9.1/ui-review-2026-10-23/46-task-paused.jpg new file mode 100644 index 0000000..0e74f6c Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/46-task-paused.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/46-task-paused.txt b/docs/9.9.1/ui-review-2026-10-23/46-task-paused.txt new file mode 100644 index 0000000..3b0b101 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/46-task-paused.txt @@ -0,0 +1,133 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/47-task-expanded-video.jpg b/docs/9.9.1/ui-review-2026-10-23/47-task-expanded-video.jpg new file mode 100644 index 0000000..67b7330 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/47-task-expanded-video.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/47-task-expanded-video.txt b/docs/9.9.1/ui-review-2026-10-23/47-task-expanded-video.txt new file mode 100644 index 0000000..0928547 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/47-task-expanded-video.txt @@ -0,0 +1,137 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "继续任务": + - text: 继续任务 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 +- dialog "放大画面": + - button "关闭放大画面": + - img "无人机视角的游客取景演示画面" + - paragraph: 演示画面 · 16:9 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/48-task-resume-processing.jpg b/docs/9.9.1/ui-review-2026-10-23/48-task-resume-processing.jpg new file mode 100644 index 0000000..104334b Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/48-task-resume-processing.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/48-task-resume-processing.txt b/docs/9.9.1/ui-review-2026-10-23/48-task-resume-processing.txt new file mode 100644 index 0000000..f759d94 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/48-task-resume-processing.txt @@ -0,0 +1,134 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已暂停" [level=2] + - paragraph: 当前悬停待命。 确认安全后,可继续任务或立即返航。 + - button "正在继续任务" [disabled]: + - text: 正在继续任务 + - paragraph: 等待设备确认,不可重复启动。 + - generic: 安全控制 + - button "已暂停 悬停待命" [disabled]: + - strong: 已暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/49-task-failed-returning.jpg b/docs/9.9.1/ui-review-2026-10-23/49-task-failed-returning.jpg new file mode 100644 index 0000000..c3c51c6 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/49-task-failed-returning.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/49-task-failed-returning.txt b/docs/9.9.1/ui-review-2026-10-23/49-task-failed-returning.txt new file mode 100644 index 0000000..a3ba68f --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/49-task-failed-returning.txt @@ -0,0 +1,135 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 无人机返航中,暂不可召唤 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/50-task-failed-ready.jpg b/docs/9.9.1/ui-review-2026-10-23/50-task-failed-ready.jpg new file mode 100644 index 0000000..fdc47f2 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/50-task-failed-ready.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/50-task-failed-ready.txt b/docs/9.9.1/ui-review-2026-10-23/50-task-failed-ready.txt new file mode 100644 index 0000000..eaf6b8b --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/50-task-failed-ready.txt @@ -0,0 +1,134 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - generic: 拍摄素材 + - generic: 上传中 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 上次任务画面 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "任务执行失败" [level=2] + - paragraph: 失败原因:拍摄指令执行失败 + - paragraph: 请排查错误后再次召唤无人机。 + - button "重新召唤无人机" [disabled]: + - text: 重新召唤无人机 + - paragraph: 当前订单拍摄次数已用完 + - generic: 安全控制 + - button "紧急暂停 当前未执行任务" [disabled]: + - strong: 紧急暂停 + - generic: 当前未执行任务 + - button "立即返航 当前未执行任务" [disabled]: + - strong: 立即返航 + - generic: 当前未执行任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/51-task-stream-lost.jpg b/docs/9.9.1/ui-review-2026-10-23/51-task-stream-lost.jpg new file mode 100644 index 0000000..1c7ac5e Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/51-task-stream-lost.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/51-task-stream-lost.txt b/docs/9.9.1/ui-review-2026-10-23/51-task-stream-lost.txt new file mode 100644 index 0000000..d8f03ce --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/51-task-stream-lost.txt @@ -0,0 +1,133 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - heading "直播画面连接中断" [level=3] + - paragraph: 无人机状态仍在更新 + - button "重新连接画面" + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机正在拍摄中" [level=2] + - paragraph: 当前仅画面中断,请关注现场。 请勿关闭本页或息屏。 + - button "拍摄中" [disabled]: + - text: 拍摄中 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/52-task-phone-offline.jpg b/docs/9.9.1/ui-review-2026-10-23/52-task-phone-offline.jpg new file mode 100644 index 0000000..fedb106 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/52-task-phone-offline.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/52-task-phone-offline.txt b/docs/9.9.1/ui-review-2026-10-23/52-task-phone-offline.txt new file mode 100644 index 0000000..fe880ea --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/52-task-phone-offline.txt @@ -0,0 +1,135 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - heading "手机网络连接中断" [level=3] + - paragraph: 请检查网络后重新连接 + - button "重新连接" + - region "无人机六项状态": + - paragraph: + - text: 状态暂未更新 + - generic: 电池电量 + - strong: + - text: — + - generic: 环境温度 + - strong: + - text: — + - generic: 风速 + - strong: + - text: — + - generic: 雨量 + - strong: + - text: — + - generic: 信号状态 + - strong: + - text: — + - generic: 搜星状态 + - strong: + - text: — + - status: + - heading "任务状态待确认" [level=2] + - paragraph: 连接中断不代表任务失败。 恢复连接后将同步当前任务。 + - button "等待连接恢复" [disabled]: + - text: 等待连接恢复 + - generic: 安全控制 + - button "紧急暂停 当前无法发送指令" [disabled]: + - strong: 紧急暂停 + - generic: 当前无法发送指令 + - button "立即返航 当前无法发送指令" [disabled]: + - strong: 立即返航 + - generic: 当前无法发送指令 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/53-task-protective-return.jpg b/docs/9.9.1/ui-review-2026-10-23/53-task-protective-return.jpg new file mode 100644 index 0000000..54ed8eb Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/53-task-protective-return.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/53-task-protective-return.txt b/docs/9.9.1/ui-review-2026-10-23/53-task-protective-return.txt new file mode 100644 index 0000000..64c5d06 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/53-task-protective-return.txt @@ -0,0 +1,133 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 18% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机自动返航" [level=2] + - paragraph: 返航原因:电量不足 拍摄结果待确认,请留意实时画面及现场。 + - button "结果待确认" [disabled]: + - text: 结果待确认 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/54-task-command-timeout-mode.jpg b/docs/9.9.1/ui-review-2026-10-23/54-task-command-timeout-mode.jpg new file mode 100644 index 0000000..4cef573 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/54-task-command-timeout-mode.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/54-task-command-timeout-mode.txt b/docs/9.9.1/ui-review-2026-10-23/54-task-command-timeout-mode.txt new file mode 100644 index 0000000..ecdb3cc --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/54-task-command-timeout-mode.txt @@ -0,0 +1,134 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - button "开始拍摄": + - text: 开始拍摄 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/55-task-finished.jpg b/docs/9.9.1/ui-review-2026-10-23/55-task-finished.jpg new file mode 100644 index 0000000..52ee350 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/55-task-finished.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/55-task-finished.txt b/docs/9.9.1/ui-review-2026-10-23/55-task-finished.txt new file mode 100644 index 0000000..b2a7f0a --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/55-task-finished.txt @@ -0,0 +1,133 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:09 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation "订单状态": + - button "全部" + - button "待拍摄" + - button "进行中" + - button "已完成" [pressed] + - heading "已完成订单 5" [level=2] + - article: + - heading "游客136****2806" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 1 / 1 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 1 次,共 1 次" + - button "查看素材 上传中": + - text: 查看素材 + - generic: 上传中 + - button "交付成片" + - button "继续查看任务" + - article: + - heading "游客137****6628" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客180****4075" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客185****5736" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - article: + - heading "游客188****3160" [level=2] + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar "已拍摄 5 次,共 5 次" + - generic: 拍摄素材 + - generic: 上传完成 + - button "查看素材" + - button "交付成片" + - paragraph: 已显示全部 5 个订单 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/56-materials-current-point-ready.jpg b/docs/9.9.1/ui-review-2026-10-23/56-materials-current-point-ready.jpg new file mode 100644 index 0000000..4c0189f Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/56-materials-current-point-ready.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/56-materials-current-point-ready.txt b/docs/9.9.1/ui-review-2026-10-23/56-materials-current-point-ready.txt new file mode 100644 index 0000000..6abcba1 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/56-materials-current-point-ready.txt @@ -0,0 +1,79 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:10 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- main: + - region "订单信息": + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 三皇寨 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-23 15:07·记录01 + - img "三皇寨拍摄素材01-demo" + - button "预览本次素材01" + - button "选择本次素材01": + - heading "本次素材01" [level=4] + - paragraph: 上传完成 · 可下载 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/57-materials-uploading.jpg b/docs/9.9.1/ui-review-2026-10-23/57-materials-uploading.jpg new file mode 100644 index 0000000..1ce9d0a Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/57-materials-uploading.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/57-materials-uploading.txt b/docs/9.9.1/ui-review-2026-10-23/57-materials-uploading.txt new file mode 100644 index 0000000..13f22a8 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/57-materials-uploading.txt @@ -0,0 +1,77 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:10 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客136****2806·含1次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "拍摄已完成" [level=2] + - paragraph: 本次拍摄已结束,可前往查看素材。 无人机正在返航,请留意现场。 + - button "查看素材": + - text: 查看素材 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "返航中 返回机巢" [disabled]: + - strong: 返航中 + - generic: 返回机巢 +- main: + - region "订单信息": + - heading "游客136****2806" [level=2] + - generic: 已完成 + - paragraph: HT202610200002 + - paragraph: 含1次拍摄·已拍摄1次·剩余0次 + - strong: 三皇寨 + - generic: 仅显示当前打卡点素材 + - generic: 1次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-23 15:07·记录01 + - generic "本次素材01上传中": + - heading "本次素材01" [level=4] + - paragraph: 上传中 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/58-materials-mixed-status.jpg b/docs/9.9.1/ui-review-2026-10-23/58-materials-mixed-status.jpg new file mode 100644 index 0000000..c2855bf Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/58-materials-mixed-status.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/58-materials-mixed-status.txt b/docs/9.9.1/ui-review-2026-10-23/58-materials-mixed-status.txt new file mode 100644 index 0000000..81840e3 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/58-materials-mixed-status.txt @@ -0,0 +1,230 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:11 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载": + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05": + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06": + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03": + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04": + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01": + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择0项 + - generic: 仅可选择已上传素材 + - button "下载所选素材" [disabled]: + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/59-materials-select-downloadable.jpg b/docs/9.9.1/ui-review-2026-10-23/59-materials-select-downloadable.jpg new file mode 100644 index 0000000..1bb3310 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/59-materials-select-downloadable.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/59-materials-select-downloadable.txt b/docs/9.9.1/ui-review-2026-10-23/59-materials-select-downloadable.txt new file mode 100644 index 0000000..86fe390 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/59-materials-select-downloadable.txt @@ -0,0 +1,230 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:11 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [pressed] + - button "三皇寨" + - button "金阙云宫" + - generic: 3次拍摄·最新在前 + - button "全选可下载" [active] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [pressed]: + - heading "素材05" [level=4] + - paragraph: 上传完成 · 可下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [pressed]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [pressed]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [pressed]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [pressed]: + - heading "素材01" [level=4] + - paragraph: 上传完成 · 可下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择5项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/60-material-preview.jpg b/docs/9.9.1/ui-review-2026-10-23/60-material-preview.jpg new file mode 100644 index 0000000..cca7899 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/60-material-preview.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/60-material-preview.txt b/docs/9.9.1/ui-review-2026-10-23/60-material-preview.txt new file mode 100644 index 0000000..b977779 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/60-material-preview.txt @@ -0,0 +1,228 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:11 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [pressed]: 全部点位 + - button: 三皇寨 + - button: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [pressed]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - button [pressed]: + - heading [level=4]: 素材05 + - paragraph: 上传完成 · 可下载 + - button + - button [pressed]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [pressed]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [pressed]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [pressed]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - heading [level=4]: 素材02 + - button: 重试上传 + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择5项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- dialog "素材预览": + - button "关闭素材预览": + - img "素材03" + - paragraph: 素材03 · 演示素材 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/61-materials-downloading.jpg b/docs/9.9.1/ui-review-2026-10-23/61-materials-downloading.jpg new file mode 100644 index 0000000..6b99eff Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/61-materials-downloading.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/61-materials-downloading.txt b/docs/9.9.1/ui-review-2026-10-23/61-materials-downloading.txt new file mode 100644 index 0000000..9e94f72 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/61-materials-downloading.txt @@ -0,0 +1,237 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:11 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled] [pressed]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - button "选择素材05" [disabled] [pressed]: + - heading "素材05" [level=4] + - paragraph: + - text: 下载中 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled] [pressed]: + - heading "素材06" [level=4] + - paragraph: + - text: 下载中 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled] [pressed]: + - heading "素材03" [level=4] + - paragraph: + - text: 下载中 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled] [pressed]: + - heading "素材04" [level=4] + - paragraph: + - text: 下载中 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled] [pressed]: + - heading "素材01" [level=4] + - paragraph: + - text: 下载中 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - strong: 本次下载5项 + - generic: 已完成0/5项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/62-materials-download-result.jpg b/docs/9.9.1/ui-review-2026-10-23/62-materials-download-result.jpg new file mode 100644 index 0000000..539005c Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/62-materials-download-result.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/62-materials-download-result.txt b/docs/9.9.1/ui-review-2026-10-23/62-materials-download-result.txt new file mode 100644 index 0000000..fd5e7af --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/62-materials-download-result.txt @@ -0,0 +1,236 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:12 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - generic "素材06已下载": + - heading "素材06" [level=4] + - paragraph: + - text: 已下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - generic "素材03已下载": + - heading "素材03" [level=4] + - paragraph: + - text: 已下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - generic "素材04已下载": + - heading "素材04" [level=4] + - paragraph: + - text: 已下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - generic "素材01已下载": + - heading "素材01" [level=4] + - paragraph: + - text: 已下载 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - heading "本次素材下载完成" [level=3] + - paragraph: 5项素材已保存到手机相册 + - button "继续选择素材" + - button "交付成片": + - text: 交付成片 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/63-materials-download-failed.jpg b/docs/9.9.1/ui-review-2026-10-23/63-materials-download-failed.jpg new file mode 100644 index 0000000..2600ca4 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/63-materials-download-failed.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/63-materials-download-failed.txt b/docs/9.9.1/ui-review-2026-10-23/63-materials-download-failed.txt new file mode 100644 index 0000000..a9f4ff6 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/63-materials-download-failed.txt @@ -0,0 +1,234 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:12 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - generic "素材01下载失败": + - heading "素材01" [level=4] + - button "重试下载" + - paragraph: + - text: 下载失败 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - heading "部分素材下载失败" [level=3] + - paragraph: 成功1项 · 失败1项,已下载的无需重复下载 + - button "重试失败素材(1)": + - text: 重试失败素材(1) + - button "选择其他素材" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/64-materials-retrying.jpg b/docs/9.9.1/ui-review-2026-10-23/64-materials-retrying.jpg new file mode 100644 index 0000000..f9f1102 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/64-materials-retrying.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/64-materials-retrying.txt b/docs/9.9.1/ui-review-2026-10-23/64-materials-retrying.txt new file mode 100644 index 0000000..7b9a189 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/64-materials-retrying.txt @@ -0,0 +1,234 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:12 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region "订单信息": + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region "筛选拍摄点": + - button "全部点位" [disabled] [pressed] + - button "三皇寨" [disabled] + - button "金阙云宫" [disabled] + - generic: 3次拍摄·最新在前 + - button "全选可下载" [disabled]: + - text: 全选可下载 + - region "拍摄记录": + - article "拍摄记录03": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录03": + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - img "三皇寨拍摄素材05" + - button "预览素材05" + - generic "素材05已下载": + - heading "素材05" [level=4] + - paragraph: + - text: 已下载 + - img "三皇寨拍摄素材06" + - button "预览素材06" + - button "选择素材06" [disabled]: + - heading "素材06" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录02": + - heading "金阙云宫" [level=3] + - button "金阙云宫交付成片,记录02": + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - img "金阙云宫拍摄素材03" + - button "预览素材03" + - button "选择素材03" [disabled]: + - heading "素材03" [level=4] + - paragraph: 上传完成 · 可下载 + - img "金阙云宫拍摄素材04" + - button "预览素材04" + - button "选择素材04" [disabled]: + - heading "素材04" [level=4] + - paragraph: 上传完成 · 可下载 + - article "拍摄记录01": + - heading "三皇寨" [level=3] + - button "三皇寨交付成片,记录01": + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - img "三皇寨拍摄素材01" + - button "预览素材01" + - button "选择素材01" [disabled] [pressed]: + - heading "素材01" [level=4] + - paragraph: + - text: 下载中 + - generic "素材02上传失败": + - heading "素材02" [level=4] + - button "重试上传" + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - strong: 本次下载1项 + - generic: 已完成0/1项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/65-materials-photo-permission.jpg b/docs/9.9.1/ui-review-2026-10-23/65-materials-photo-permission.jpg new file mode 100644 index 0000000..ab45ce6 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/65-materials-photo-permission.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/65-materials-photo-permission.txt b/docs/9.9.1/ui-review-2026-10-23/65-materials-photo-permission.txt new file mode 100644 index 0000000..06f60a5 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/65-materials-photo-permission.txt @@ -0,0 +1,229 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:12 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材05 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材01 + - paragraph: 上传完成 · 可下载 + - heading [level=4]: 素材02 + - button: 重试上传 + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - generic: 已选择2项 + - generic: 仅可选择已上传素材 + - button "下载所选素材": + - text: 下载所选素材 +- alertdialog "无法保存到手机相册": + - heading "无法保存到手机相册" [level=2] + - paragraph: 相册权限未开启。请在系统设置中允许App添加照片后,再下载素材。 + - button "暂不下载" + - button "去设置" [active] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/66-materials-leave-confirmation.jpg b/docs/9.9.1/ui-review-2026-10-23/66-materials-leave-confirmation.jpg new file mode 100644 index 0000000..c2ab810 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/66-materials-leave-confirmation.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/66-materials-leave-confirmation.txt b/docs/9.9.1/ui-review-2026-10-23/66-materials-leave-confirmation.txt new file mode 100644 index 0000000..901b5fc --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/66-materials-leave-confirmation.txt @@ -0,0 +1,232 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:13 +- banner: + - banner: + - button "返回": + - heading "订单素材库" [level=1] + - button "刷新素材状态": + - generic: 刷新 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续拍摄" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - region: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: HT202610200001 + - paragraph: 含5次拍摄·已拍摄3次·剩余2次 + - region: + - button [disabled] [pressed]: 全部点位 + - button [disabled]: 三皇寨 + - button [disabled]: 金阙云宫 + - generic: 3次拍摄·最新在前 + - button [disabled]: + - text: 全选可下载 + - region: + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 14:32·记录03 + - button + - heading [level=4]: 素材05 + - paragraph: + - text: 已下载 + - button + - button [disabled]: + - heading [level=4]: 素材06 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 金阙云宫 + - button: + - text: 交付成片 + - paragraph: 云宫环绕·10-20 14:10·记录02 + - button + - button [disabled]: + - heading [level=4]: 素材03 + - paragraph: 上传完成 · 可下载 + - button + - button [disabled]: + - heading [level=4]: 素材04 + - paragraph: 上传完成 · 可下载 + - article: + - heading [level=3]: 三皇寨 + - button: + - text: 交付成片 + - paragraph: 经典航线·10-20 13:45·记录01 + - button + - button [disabled] [pressed]: + - heading [level=4]: 素材01 + - paragraph: + - text: 下载中 + - heading [level=4]: 素材02 + - button: 重试上传 + - paragraph: 上传失败 +- contentinfo: + - contentinfo: + - strong: 本次下载2项 + - generic: 已完成1/2项 + - progressbar "本次下载完成项数" + - paragraph: 请保持本页开启,下载期间不可更改选择 + - button "下载中…" [disabled]: + - text: 下载中… +- alertdialog "素材仍在下载": + - heading "素材仍在下载" [level=2] + - paragraph: 离开将停止未完成的下载,已保存的素材会保留。确定离开吗? + - button "离开并停止" + - button "继续下载" [active] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/67-task-command-unconfirmed.jpg b/docs/9.9.1/ui-review-2026-10-23/67-task-command-unconfirmed.jpg new file mode 100644 index 0000000..b895523 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/67-task-command-unconfirmed.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/67-task-command-unconfirmed.txt b/docs/9.9.1/ui-review-2026-10-23/67-task-command-unconfirmed.txt new file mode 100644 index 0000000..411babe --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/67-task-command-unconfirmed.txt @@ -0,0 +1,104 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:15 +- banner: + - button "返回": + - heading "拍摄任务" [level=1] + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - heading "游客139****5192" [level=2] + - paragraph: 含 5 次拍摄 + - paragraph: 已拍摄 2 次 + - paragraph: + - text: 剩余 + - strong: "3" + - text: 次 + - heading "拍摄点" [level=2] + - region "拍摄点,左右滑动选择": + - button "三皇寨 范围内 已拍 2 次" [pressed]: + - heading "三皇寨" [level=3] + - paragraph: + - text: 范围内 + - generic: 已拍 2 次 + - button "金阙云宫 800 m 未拍摄": + - heading "金阙云宫" [level=3] + - paragraph: + - text: 800 m + - generic: 未拍摄 + - button "少室山 1.2 km 未拍摄": + - heading "少室山" [level=3] + - paragraph: + - text: 1.2 km + - generic: 未拍摄 + - button "迎客峰 1.8 km 未拍摄": + - heading "迎客峰" [level=3] + - paragraph: + - text: 1.8 km + - generic: 未拍摄 + - heading "三皇寨的航线 共 8 条" [level=2]: + - text: 三皇寨的航线 + - generic: 共 8 条 + - radiogroup "三皇寨的航线": + - radio "经典航线" [checked]: + - strong: 经典航线 + - radio "环绕专线": + - strong: 环绕专线 + - radio "远景拉升": + - strong: 远景拉升 + - radio "全景环绕": + - strong: 全景环绕 + - radio "高空俯瞰": + - strong: 高空俯瞰 + - radio "山峰渐远": + - strong: 山峰渐远 + - radio "峡谷穿行": + - strong: 峡谷穿行 + - radio "山脊侧拍": + - strong: 山脊侧拍 +- main: + - heading "三皇寨 · 经典航线" [level=2] + - paragraph: 游客139****5192·含5次拍摄 + - region "无人机直播画面": + - img "无人机视角的游客取景演示画面" + - text: 实时图传 + - button "放大直播画面": + - region "无人机六项状态": + - generic: 电池电量 + - strong: + - text: 95% + - generic: 环境温度 + - strong: + - text: 20.3°C + - generic: 风速 + - strong: + - text: 0m/s + - generic: 雨量 + - strong: + - text: 无雨 + - generic: 信号状态 + - strong: + - text: 良好 + - generic: 搜星状态 + - strong: + - text: 36颗 + - status: + - heading "无人机已到达" [level=2] + - heading "是否开始拍摄?" [level=3] + - paragraph: 确认游客站位与取景后开始 + - strong: + - text: 执行结果待确认 + - paragraph: 暂未确认是否已开始拍摄。请刷新任务状态,勿重复发送指令。 + - button "刷新任务状态": + - text: 刷新任务状态 + - button "执行结果待确认" [disabled]: + - text: 执行结果待确认 + - generic: 安全控制 + - button "紧急暂停 悬停待命": + - strong: 紧急暂停 + - generic: 悬停待命 + - button "立即返航 中断任务": + - strong: 立即返航 + - generic: 中断任务 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/68-workbench-active-order-with-quota.jpg b/docs/9.9.1/ui-review-2026-10-23/68-workbench-active-order-with-quota.jpg new file mode 100644 index 0000000..d2c0fe8 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/68-workbench-active-order-with-quota.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/68-workbench-active-order-with-quota.txt b/docs/9.9.1/ui-review-2026-10-23/68-workbench-active-order-with-quota.txt new file mode 100644 index 0000000..442af5d --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/68-workbench-active-order-with-quota.txt @@ -0,0 +1,165 @@ +- 'button "Preview device: iPhone"': + - generic: iPhone +- generic "Device status bar": + - generic: 3:15 +- banner: + - button "返回": + - heading "机巢工作台" [level=1] + - button "收款码": + - text: 收款码 + - generic: 交互原型 · 无真实操作 + - button "体验本页其他状态": + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region "无人机设备状态": + - region "左右滑动查看无人机": + - group "01号无人机": + - region "01号无人机的六项状态": + - heading "01号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "02号无人机": + - region "02号无人机的六项状态": + - heading "02号无人机" [level=3] + - text: 占用中 + - meter "电池电量": + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "03号无人机": + - region "03号无人机的六项状态": + - heading "03号无人机" [level=3] + - text: 未连接 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - group "04号无人机": + - region "04号无人机的六项状态": + - heading "04号无人机" [level=3] + - text: 低电量 + - meter "电池电量": + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "05号无人机": + - region "05号无人机的六项状态": + - heading "05号无人机" [level=3] + - text: 空闲 + - meter "电池电量": + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - group "06号无人机": + - region "06号无人机的六项状态": + - heading "06号无人机" [level=3] + - text: 无信号 + - img "电池电量未知": + - strong: — + - generic: 电池电量 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - generic "当前无人机": + - button "查看01号无人机": + - button "查看02号无人机": + - button "查看03号无人机": + - button "查看04号无人机": + - button "查看05号无人机": + - button "查看06号无人机": + - heading "我的拍摄订单 8" [level=2] + - button "查看全部": + - text: 查看全部 + - article: + - heading "游客158****8888" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button "继续拍摄" + - text: 素材上传中 + - button "查看素材": + - text: 查看素材 + - article: + - heading "游客136****2806" [level=2] + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button "开始拍摄" + - article: + - heading "游客139****5192" [level=2] + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button "继续查看任务" + - text: 素材上传失败 + - button "查看素材": + - text: 查看素材 + - heading "今日数据" [level=2] + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/69-delivery-demo-video-picker.jpg b/docs/9.9.1/ui-review-2026-10-23/69-delivery-demo-video-picker.jpg new file mode 100644 index 0000000..bafa724 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/69-delivery-demo-video-picker.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/69-delivery-demo-video-picker.txt b/docs/9.9.1/ui-review-2026-10-23/69-delivery-demo-video-picker.txt new file mode 100644 index 0000000..cd09036 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/69-delivery-demo-video-picker.txt @@ -0,0 +1,358 @@ +- button: + - generic: iPhone +- generic: 3:16 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客137****6628 + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客180****4075 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客185****5736 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客188****3160 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - paragraph: 已显示全部 12 个订单 +- dialog "选择视频" [active]: + - heading "选择视频" [level=2] + - button "关闭成片交付": + - paragraph: 游客158****8888·三皇寨 + - paragraph: 演示相册 · 不读取手机文件 + - button "选择演示视频1": + - img "演示视频1" + - text: 00:32 + - strong: 成片视频 01 + - button "选择演示视频2": + - img "演示视频2" + - text: 00:48 + - strong: 成片视频 02 + - button "选择演示视频3": + - img "演示视频3" + - text: 00:32 + - strong: 成片视频 03 + - button "选择演示视频4": + - img "演示视频4" + - text: 00:48 + - strong: 成片视频 04 + - button "上传所选视频" [disabled] + - paragraph: 选择后自动体验上传 → 交付完成 + - generic "体验上传异常" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/70-delivery-upload-failure-option.jpg b/docs/9.9.1/ui-review-2026-10-23/70-delivery-upload-failure-option.jpg new file mode 100644 index 0000000..d3d5bab Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/70-delivery-upload-failure-option.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/70-delivery-upload-failure-option.txt b/docs/9.9.1/ui-review-2026-10-23/70-delivery-upload-failure-option.txt new file mode 100644 index 0000000..2578b8e --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/70-delivery-upload-failure-option.txt @@ -0,0 +1,359 @@ +- button: + - generic: iPhone +- generic: 3:16 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客137****6628 + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客180****4075 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客185****5736 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客188****3160 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - paragraph: 已显示全部 12 个订单 +- dialog "选择视频": + - heading "选择视频" [level=2] + - button "关闭成片交付": + - paragraph: 游客158****8888·三皇寨 + - paragraph: 演示相册 · 不读取手机文件 + - button "选择演示视频1" [pressed]: + - img "演示视频1" + - text: 00:32 + - strong: 成片视频 01 + - button "选择演示视频2" [pressed]: + - img "演示视频2" + - text: 00:48 + - strong: 成片视频 02 + - button "选择演示视频3": + - img "演示视频3" + - text: 00:32 + - strong: 成片视频 03 + - button "选择演示视频4": + - img "演示视频4" + - text: 00:48 + - strong: 成片视频 04 + - button "上传所选视频(2)" + - paragraph: 选择后自动体验上传 → 交付完成 + - generic "体验上传异常" + - button "已设置:本次最后一个视频上传失败" [active] [pressed] \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/71-delivery-uploading.jpg b/docs/9.9.1/ui-review-2026-10-23/71-delivery-uploading.jpg new file mode 100644 index 0000000..cba6cc7 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/71-delivery-uploading.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/71-delivery-uploading.txt b/docs/9.9.1/ui-review-2026-10-23/71-delivery-uploading.txt new file mode 100644 index 0000000..adcbded --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/71-delivery-uploading.txt @@ -0,0 +1,350 @@ +- button: + - generic: iPhone +- generic: 3:17 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客137****6628 + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客180****4075 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客185****5736 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客188****3160 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - paragraph: 已显示全部 12 个订单 +- dialog "成片上传": + - heading "成片上传" [level=2] + - button "关闭成片交付": + - paragraph: 游客158****8888·三皇寨 + - strong: 本次已交付 0 个作品 + - generic: 2 个上传中 + - strong: 三皇寨_成片01.mp4 + - generic: 00:32 · 48.6 MB + - text: 上传中 + - strong: 三皇寨_成片02.mp4 + - generic: 00:48 · 72.4 MB + - text: 上传中 + - button "正在上传…" [disabled]: + - text: 正在上传… + - paragraph: 请保持页面开启,上传成功即交付 + - button "体验上传失败" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/72-delivery-upload-partial-failure.jpg b/docs/9.9.1/ui-review-2026-10-23/72-delivery-upload-partial-failure.jpg new file mode 100644 index 0000000..65aa258 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/72-delivery-upload-partial-failure.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/72-delivery-upload-partial-failure.txt b/docs/9.9.1/ui-review-2026-10-23/72-delivery-upload-partial-failure.txt new file mode 100644 index 0000000..ab0d58a --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/72-delivery-upload-partial-failure.txt @@ -0,0 +1,353 @@ +- button: + - generic: iPhone +- generic: 3:17 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 已交付 1 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客137****6628 + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客180****4075 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客185****5736 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客188****3160 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - paragraph: 已显示全部 12 个订单 +- dialog "成片上传" [active]: + - heading "成片上传" [level=2] + - button "关闭成片交付": + - paragraph: 游客158****8888·三皇寨 + - strong: 本次已交付 1 个作品 + - generic: 1 个上传失败 + - strong: 三皇寨_成片01.mp4 + - generic: 00:32 · 48.6 MB + - text: 已交付 + - strong: 三皇寨_成片02.mp4 + - generic: 00:48 · 72.4 MB + - text: 上传失败 + - button "重试失败视频(1)": + - text: 重试失败视频(1) + - paragraph: 已交付的作品不会重复上传 + - button "完成" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/73-delivery-upload-retrying.jpg b/docs/9.9.1/ui-review-2026-10-23/73-delivery-upload-retrying.jpg new file mode 100644 index 0000000..8aa0826 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/73-delivery-upload-retrying.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/73-delivery-upload-retrying.txt b/docs/9.9.1/ui-review-2026-10-23/73-delivery-upload-retrying.txt new file mode 100644 index 0000000..d3815e8 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/73-delivery-upload-retrying.txt @@ -0,0 +1,353 @@ +- button: + - generic: iPhone +- generic: 3:18 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 已交付 1 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客137****6628 + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客180****4075 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客185****5736 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客188****3160 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - paragraph: 已显示全部 12 个订单 +- dialog "成片上传": + - heading "成片上传" [level=2] + - button "关闭成片交付": + - paragraph: 游客158****8888·三皇寨 + - strong: 本次已交付 1 个作品 + - generic: 1 个上传中 + - strong: 三皇寨_成片01.mp4 + - generic: 00:32 · 48.6 MB + - text: 已交付 + - strong: 三皇寨_成片02.mp4 + - generic: 00:48 · 72.4 MB + - text: 上传中 + - button "正在上传…" [disabled]: + - text: 正在上传… + - paragraph: 请保持页面开启,上传成功即交付 + - button "体验上传失败" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/74-delivery-upload-complete.jpg b/docs/9.9.1/ui-review-2026-10-23/74-delivery-upload-complete.jpg new file mode 100644 index 0000000..d7b6682 Binary files /dev/null and b/docs/9.9.1/ui-review-2026-10-23/74-delivery-upload-complete.jpg differ diff --git a/docs/9.9.1/ui-review-2026-10-23/74-delivery-upload-complete.txt b/docs/9.9.1/ui-review-2026-10-23/74-delivery-upload-complete.txt new file mode 100644 index 0000000..6aeaca9 --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/74-delivery-upload-complete.txt @@ -0,0 +1,352 @@ +- button: + - generic: iPhone +- generic: 3:19 +- banner: + - button: + - heading [level=1]: 我的拍摄订单 + - generic: 交互原型 · 无真实操作 + - button: + - text: 体验其他状态 +- main: + - generic: 嵩山少林景区 · 吴家俊 + - region: + - region: + - region: + - heading [level=3]: 01号无人机 + - text: 空闲 + - meter: + - strong: 95% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 36颗 + - strong: 19.3°C + - text: 环境温度 + - strong: 0m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 02号无人机 + - text: 占用中 + - meter: + - strong: 72% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 32颗 + - strong: 20.1°C + - text: 环境温度 + - strong: 1.2m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 03号无人机 + - text: 未连接 + - generic: 信号状态 + - strong: — + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - region: + - heading [level=3]: 04号无人机 + - text: 低电量 + - meter: + - strong: 18% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 34颗 + - strong: 19.8°C + - text: 环境温度 + - strong: 0.6m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 05号无人机 + - text: 空闲 + - meter: + - strong: 88% + - generic: 电池电量 + - generic: 信号状态 + - strong: 良好 + - generic: 搜星状态 + - strong: 35颗 + - strong: 20.3°C + - text: 环境温度 + - strong: 0.8m/s + - text: 风速 + - strong: 无雨 + - text: 雨量 + - region: + - heading [level=3]: 06号无人机 + - text: 无信号 + - generic: 信号状态 + - strong: 无信号 + - generic: 搜星状态 + - strong: — + - strong: — + - text: 环境温度 + - strong: — + - text: 风速 + - strong: — + - text: 雨量 + - button: + - button: + - button: + - button: + - button: + - button: + - heading [level=2]: 我的拍摄订单 8 + - button: + - text: 查看全部 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 3/5 次 + - generic: ·剩余 2 次 + - button: 继续拍摄 + - text: 素材上传中 + - button: + - text: 查看素材 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: 单次航拍·含1次拍摄 + - generic: 已拍摄 0/1 次 + - generic: ·剩余 1 次 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: 航拍套餐·含5次拍摄 + - generic: 已拍摄 2/5 次 + - generic: ·剩余 3 次 + - button: 继续拍摄 + - text: 素材上传失败 + - button: + - text: 查看素材 + - heading [level=2]: 今日数据 + - paragraph: + - strong: "12" + - generic: 成交订单 + - paragraph: + - strong: ¥1,896 + - generic: 成交金额 + - paragraph: + - strong: "9" + - generic: 完成拍摄 +- main: + - paragraph: 分配给我的全部订单,含已完成订单 + - navigation: + - button [pressed]: 全部 + - button: 待拍摄 + - button: 进行中 + - button: 已完成 + - heading [level=2]: 全部订单 12 + - article: + - heading [level=2]: 游客158****8888 + - generic: 进行中 + - paragraph: + - text: HT202610200001 + - generic: · + - text: 10-20 14:32 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 3 / 5 次 + - generic: 剩余 2 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传中 + - button: + - text: 请游客确认 + - generic: 已交付 2 个视频 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客136****2806 + - generic: 待拍摄 + - paragraph: + - text: HT202610200002 + - generic: · + - text: 10-20 14:18 + - paragraph: 单次航拍 · 含1次拍摄 + - generic: 已拍摄 0 / 1 次 + - generic: 剩余 1 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客139****5192 + - generic: 进行中 + - paragraph: + - text: HT202610200003 + - generic: · + - text: 10-20 13:46 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 2 / 5 次 + - generic: 剩余 3 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传失败 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客137****6628 + - generic: 拍摄完成 + - paragraph: + - text: HT202610190012 + - generic: · + - text: 10-19 16:18 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客135****3092 + - generic: 待拍摄 + - paragraph: + - text: HT202610200005 + - generic: · + - text: 10-20 12:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客159****7206 + - generic: 进行中 + - paragraph: + - text: HT202610200006 + - generic: · + - text: 10-20 11:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客138****0638 + - generic: 待拍摄 + - paragraph: + - text: HT202610200007 + - generic: · + - text: 10-20 10:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客186****9357 + - generic: 进行中 + - paragraph: + - text: HT202610200008 + - generic: · + - text: 10-20 9:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 1 / 5 次 + - generic: 剩余 4 次 + - progressbar + - button: + - text: 查看素材 + - generic: 上传完成 + - button: 交付成片 + - button: 继续拍摄 + - article: + - heading [level=2]: 游客151****8602 + - generic: 待拍摄 + - paragraph: + - text: HT202610200009 + - generic: · + - text: 10-20 8:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 0 / 5 次 + - generic: 剩余 5 次 + - progressbar + - button: 交付成片 + - button: 开始拍摄 + - article: + - heading [level=2]: 游客180****4075 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200010 + - generic: · + - text: 10-20 7:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客185****5736 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200011 + - generic: · + - text: 10-20 6:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - article: + - heading [level=2]: 游客188****3160 + - generic: 拍摄完成 + - paragraph: + - text: HT202610200012 + - generic: · + - text: 10-20 5:15 + - paragraph: 航拍套餐 · 含5次拍摄 + - generic: 已拍摄 5 / 5 次 + - generic: 剩余 0 次 + - progressbar + - generic: 拍摄素材 + - generic: 上传完成 + - button: 查看素材 + - button: 交付成片 + - paragraph: 已显示全部 12 个订单 +- dialog "成片上传" [active]: + - heading "成片上传" [level=2] + - button "关闭成片交付": + - paragraph: 游客158****8888·三皇寨 + - strong: 本次已交付 2 个作品 + - generic: 全部上传成功 + - strong: 三皇寨_成片01.mp4 + - generic: 00:32 · 48.6 MB + - text: 已交付 + - strong: 三皇寨_成片02.mp4 + - generic: 00:48 · 72.4 MB + - text: 已交付 + - button "继续上传成片" + - paragraph: 可分批上传,不扣减拍摄次数 + - button "完成" \ No newline at end of file diff --git a/docs/9.9.1/ui-review-2026-10-23/manifest.json b/docs/9.9.1/ui-review-2026-10-23/manifest.json new file mode 100644 index 0000000..81bbd5a --- /dev/null +++ b/docs/9.9.1/ui-review-2026-10-23/manifest.json @@ -0,0 +1,384 @@ +{ + "date": "2026-10-23", + "source": "https://voicestudio.suixinkan.cn/", + "browser": "Codex in-app browser", + "purpose": "UI更新复核,未修改App业务代码", + "notes": [ + "普通页面操作和状态菜单预览均包含;状态预览不代表真实接口或设备验证", + "截图为可见视口,DOM可包含页面过渡保留的历史节点", + "支付、下载、上传、游客确认均为原型演示;没有真实交易或上传个人文件" + ], + "count": 74, + "captures": [ + { + "name": "01-workbench", + "image": "01-workbench.jpg", + "dom": "01-workbench.txt" + }, + { + "name": "02-workbench-single-drone", + "image": "02-workbench-single-drone.jpg", + "dom": "02-workbench-single-drone.txt" + }, + { + "name": "03-workbench-unknown", + "image": "03-workbench-unknown.jpg", + "dom": "03-workbench-unknown.txt" + }, + { + "name": "04-workbench-drone-carousel", + "image": "04-workbench-drone-carousel.jpg", + "dom": "04-workbench-drone-carousel.txt" + }, + { + "name": "05-payment-initial", + "image": "05-payment-initial.jpg", + "dom": "05-payment-initial.txt" + }, + { + "name": "06-package-picker", + "image": "06-package-picker.jpg", + "dom": "06-package-picker.txt" + }, + { + "name": "07-payment-ready", + "image": "07-payment-ready.jpg", + "dom": "07-payment-ready.txt" + }, + { + "name": "08-payment-amount-sheet", + "image": "08-payment-amount-sheet.jpg", + "dom": "08-payment-amount-sheet.txt" + }, + { + "name": "09-payment-code-failed", + "image": "09-payment-code-failed.jpg", + "dom": "09-payment-code-failed.txt" + }, + { + "name": "10-payment-code-expired", + "image": "10-payment-code-expired.jpg", + "dom": "10-payment-code-expired.txt" + }, + { + "name": "11-payment-empty-packages", + "image": "11-payment-empty-packages.jpg", + "dom": "11-payment-empty-packages.txt" + }, + { + "name": "12-payment-success", + "image": "12-payment-success.jpg", + "dom": "12-payment-success.txt" + }, + { + "name": "13-payment-orders-default", + "image": "13-payment-orders-default.jpg", + "dom": "13-payment-orders-default.txt" + }, + { + "name": "14-orders-completed", + "image": "14-orders-completed.jpg", + "dom": "14-orders-completed.txt" + }, + { + "name": "15-orders-pending", + "image": "15-orders-pending.jpg", + "dom": "15-orders-pending.txt" + }, + { + "name": "16-orders-empty", + "image": "16-orders-empty.jpg", + "dom": "16-orders-empty.txt" + }, + { + "name": "17-orders-delivery-example", + "image": "17-orders-delivery-example.jpg", + "dom": "17-orders-delivery-example.txt" + }, + { + "name": "18-orders-in-progress", + "image": "18-orders-in-progress.jpg", + "dom": "18-orders-in-progress.txt" + }, + { + "name": "19-delivery-method-sheet", + "image": "19-delivery-method-sheet.jpg", + "dom": "19-delivery-method-sheet.txt" + }, + { + "name": "20-delivery-nearby-placeholder", + "image": "20-delivery-nearby-placeholder.jpg", + "dom": "20-delivery-nearby-placeholder.txt" + }, + { + "name": "21-delivery-cloud-point", + "image": "21-delivery-cloud-point.jpg", + "dom": "21-delivery-cloud-point.txt" + }, + { + "name": "22-order-delivery-review", + "image": "22-order-delivery-review.jpg", + "dom": "22-order-delivery-review.txt" + }, + { + "name": "23-order-confirmation-code", + "image": "23-order-confirmation-code.jpg", + "dom": "23-order-confirmation-code.txt" + }, + { + "name": "24-visitor-confirmation-demo", + "image": "24-visitor-confirmation-demo.jpg", + "dom": "24-visitor-confirmation-demo.txt" + }, + { + "name": "25-delivery-feedback", + "image": "25-delivery-feedback.jpg", + "dom": "25-delivery-feedback.txt" + }, + { + "name": "26-order-confirmed-receipt", + "image": "26-order-confirmed-receipt.jpg", + "dom": "26-order-confirmed-receipt.txt" + }, + { + "name": "27-preparation-ready", + "image": "27-preparation-ready.jpg", + "dom": "27-preparation-ready.txt" + }, + { + "name": "28-preparation-point-switch", + "image": "28-preparation-point-switch.jpg", + "dom": "28-preparation-point-switch.txt" + }, + { + "name": "29-preparation-occupied", + "image": "29-preparation-occupied.jpg", + "dom": "29-preparation-occupied.txt" + }, + { + "name": "30-preparation-disconnected", + "image": "30-preparation-disconnected.jpg", + "dom": "30-preparation-disconnected.txt" + }, + { + "name": "31-preparation-no-signal", + "image": "31-preparation-no-signal.jpg", + "dom": "31-preparation-no-signal.txt" + }, + { + "name": "32-preparation-low-battery", + "image": "32-preparation-low-battery.jpg", + "dom": "32-preparation-low-battery.txt" + }, + { + "name": "33-preparation-unknown", + "image": "33-preparation-unknown.jpg", + "dom": "33-preparation-unknown.txt" + }, + { + "name": "34-preparation-out-of-range", + "image": "34-preparation-out-of-range.jpg", + "dom": "34-preparation-out-of-range.txt" + }, + { + "name": "35-preparation-no-routes", + "image": "35-preparation-no-routes.jpg", + "dom": "35-preparation-no-routes.txt" + }, + { + "name": "36-preparation-no-quota", + "image": "36-preparation-no-quota.jpg", + "dom": "36-preparation-no-quota.txt" + }, + { + "name": "37-task-arrived", + "image": "37-task-arrived.jpg", + "dom": "37-task-arrived.txt" + }, + { + "name": "38-task-success-dialog", + "image": "38-task-success-dialog.jpg", + "dom": "38-task-success-dialog.txt" + }, + { + "name": "39-task-returning-zero-quota", + "image": "39-task-returning-zero-quota.jpg", + "dom": "39-task-returning-zero-quota.txt" + }, + { + "name": "40-task-leave-confirmation", + "image": "40-task-leave-confirmation.jpg", + "dom": "40-task-leave-confirmation.txt" + }, + { + "name": "41-returned-to-preparation", + "image": "41-returned-to-preparation.jpg", + "dom": "41-returned-to-preparation.txt" + }, + { + "name": "42-workbench-zero-quota-active", + "image": "42-workbench-zero-quota-active.jpg", + "dom": "42-workbench-zero-quota-active.txt" + }, + { + "name": "43-completed-order-active-task", + "image": "43-completed-order-active-task.jpg", + "dom": "43-completed-order-active-task.txt" + }, + { + "name": "44-task-shooting", + "image": "44-task-shooting.jpg", + "dom": "44-task-shooting.txt" + }, + { + "name": "45-task-pause-processing", + "image": "45-task-pause-processing.jpg", + "dom": "45-task-pause-processing.txt" + }, + { + "name": "46-task-paused", + "image": "46-task-paused.jpg", + "dom": "46-task-paused.txt" + }, + { + "name": "47-task-expanded-video", + "image": "47-task-expanded-video.jpg", + "dom": "47-task-expanded-video.txt" + }, + { + "name": "48-task-resume-processing", + "image": "48-task-resume-processing.jpg", + "dom": "48-task-resume-processing.txt" + }, + { + "name": "49-task-failed-returning", + "image": "49-task-failed-returning.jpg", + "dom": "49-task-failed-returning.txt" + }, + { + "name": "50-task-failed-ready", + "image": "50-task-failed-ready.jpg", + "dom": "50-task-failed-ready.txt" + }, + { + "name": "51-task-stream-lost", + "image": "51-task-stream-lost.jpg", + "dom": "51-task-stream-lost.txt" + }, + { + "name": "52-task-phone-offline", + "image": "52-task-phone-offline.jpg", + "dom": "52-task-phone-offline.txt" + }, + { + "name": "53-task-protective-return", + "image": "53-task-protective-return.jpg", + "dom": "53-task-protective-return.txt" + }, + { + "name": "54-task-command-timeout-mode", + "image": "54-task-command-timeout-mode.jpg", + "dom": "54-task-command-timeout-mode.txt" + }, + { + "name": "55-task-finished", + "image": "55-task-finished.jpg", + "dom": "55-task-finished.txt" + }, + { + "name": "56-materials-current-point-ready", + "image": "56-materials-current-point-ready.jpg", + "dom": "56-materials-current-point-ready.txt" + }, + { + "name": "57-materials-uploading", + "image": "57-materials-uploading.jpg", + "dom": "57-materials-uploading.txt" + }, + { + "name": "58-materials-mixed-status", + "image": "58-materials-mixed-status.jpg", + "dom": "58-materials-mixed-status.txt" + }, + { + "name": "59-materials-select-downloadable", + "image": "59-materials-select-downloadable.jpg", + "dom": "59-materials-select-downloadable.txt" + }, + { + "name": "60-material-preview", + "image": "60-material-preview.jpg", + "dom": "60-material-preview.txt" + }, + { + "name": "61-materials-downloading", + "image": "61-materials-downloading.jpg", + "dom": "61-materials-downloading.txt" + }, + { + "name": "62-materials-download-result", + "image": "62-materials-download-result.jpg", + "dom": "62-materials-download-result.txt" + }, + { + "name": "63-materials-download-failed", + "image": "63-materials-download-failed.jpg", + "dom": "63-materials-download-failed.txt" + }, + { + "name": "64-materials-retrying", + "image": "64-materials-retrying.jpg", + "dom": "64-materials-retrying.txt" + }, + { + "name": "65-materials-photo-permission", + "image": "65-materials-photo-permission.jpg", + "dom": "65-materials-photo-permission.txt" + }, + { + "name": "66-materials-leave-confirmation", + "image": "66-materials-leave-confirmation.jpg", + "dom": "66-materials-leave-confirmation.txt" + }, + { + "name": "67-task-command-unconfirmed", + "image": "67-task-command-unconfirmed.jpg", + "dom": "67-task-command-unconfirmed.txt" + }, + { + "name": "68-workbench-active-order-with-quota", + "image": "68-workbench-active-order-with-quota.jpg", + "dom": "68-workbench-active-order-with-quota.txt" + }, + { + "name": "69-delivery-demo-video-picker", + "image": "69-delivery-demo-video-picker.jpg", + "dom": "69-delivery-demo-video-picker.txt" + }, + { + "name": "70-delivery-upload-failure-option", + "image": "70-delivery-upload-failure-option.jpg", + "dom": "70-delivery-upload-failure-option.txt" + }, + { + "name": "71-delivery-uploading", + "image": "71-delivery-uploading.jpg", + "dom": "71-delivery-uploading.txt" + }, + { + "name": "72-delivery-upload-partial-failure", + "image": "72-delivery-upload-partial-failure.jpg", + "dom": "72-delivery-upload-partial-failure.txt" + }, + { + "name": "73-delivery-upload-retrying", + "image": "73-delivery-upload-retrying.jpg", + "dom": "73-delivery-upload-retrying.txt" + }, + { + "name": "74-delivery-upload-complete", + "image": "74-delivery-upload-complete.jpg", + "dom": "74-delivery-upload-complete.txt" + } + ] +} diff --git a/docs/9.9.1/交付成片UI实现说明.md b/docs/9.9.1/交付成片UI实现说明.md new file mode 100644 index 0000000..2b52344 --- /dev/null +++ b/docs/9.9.1/交付成片UI实现说明.md @@ -0,0 +1,82 @@ +# 9.9.1 交付成片 UI 实现说明 + +实现日期:2026-10-23。分支:`dev_9_9_1`。 + +2026-10-30:正式订单列表已接入交付方式弹窗,云端继续复用已接接口,见[订单交付方式弹窗](订单交付方式弹窗-2026-10-30.md)。下文为原本地演示的历史实现说明。 + +## 范围与依据 + +本轮按用户指示搭建交付成片 UI,收款页面继续暂缓,不接真实接口。采用[新版原型复核](UI更新复核-2026-10-23.md)中的交付方式、点位选择、演示视频选择、上传队列、整单核对、确认码和确认记录样式。 + +本次再次实际操作产品体验网页,核对了订单“交付成片”→云端选点→多选两个示例→上传→完成→订单“请游客确认”→整单核对→勾选交齐→确认码→刷新等待结果。未选点、未选视频、未核对时相应按钮禁用;刷新后仍等待游客主动确认。游客侧真实网页不属于本轮商家 App 原生页面。 + +此前基线 U01 的“交付入口先跳过”是历史范围;本轮用户已授权按新版原型搭建本地页面。真实交付接口、游客身份校验和收货凭据仍需后续对接。 + +## 页面与入口 + +| 入口/页面 | 本轮实现 | +| --- | --- | +| 订单“交付成片” | 打开白底圆角半屏面板,选择面对面或云端方式。 | +| 素材记录“交付成片” | 打开同一面板,并预选该记录的点位;不将原素材标记为成片。 | +| 面对面闪传 | 保留“流程待确认”说明,可返回或改用云端;不启动热点、局域网服务或分享。 | +| 云端选点 | 单批绑定一个点位;整单入口不自动选点,未选择时不能去选视频。 | +| 演示视频选择 | 两列本地示例视频,支持多选、取消和独立预览;不读取手机相册。 | +| 上传队列 | 显示本批数量、文件名、时长、逐项进度与结果;支持暂停继续、仅失败项重试、完成和追加批次。 | +| 订单“请游客确认” | 独立进入整单核对;不是打开新的上传批次。 | +| 整单核对 | 汇总所有点位、所有上传批次的成功作品,勾选已全部交齐后才可展示确认码。 | +| 确认码 | 显示本机演示码图和固定清单范围;刷新不自动确认,稍后可返回订单。 | +| 订单“查看记录” | 展示已确认时的作品、游客、工作人员、时间和范围;历史记录不随追加作品变化。 | + +## 保留的规则与状态 + +- 拍摄次数、原素材下载、剪辑成片交付和游客确认分别处理。上传、重试、预览和确认均不扣拍摄次数、不改变原任务、不改变订单 Tab;0 次订单仍属于已完成。 +- 开始上传后冻结点位和视频范围;成功回执仅登记一次,成功项不重传。可追加批次,整单清单包含各点位的全部成功作品。 +- 本地上传演示仅在前台推进;关闭面板、进入后台或锁屏暂停未完成项并作废旧令牌。返回前台或重新进入面板不会自动继续。视频预览覆盖面板不作为关闭处理。 +- 部分失败可单独重试失败项;暂停与失败分别表达,继续不会顺便重试失败项。 +- 上传成功不表示整单交齐,商家需明确核对。扫描/查看也不表示游客确认,游客主动确认仅通过 Debug 明确回执演示。 +- 游客演示状态包含等待、查看中、问题反馈和已确认;反馈支持视频缺失、无法播放、效果异议及其他问题,不发送真实消息。 +- 每次确认冻结当时的整单作品清单。追加作品后,当前交齐勾选和旧确认令牌失效,需要重新核对;历史已确认记录及其预览范围保留原快照。 +- 缓存按工作人员、景区和订单隔离;旧批次、其他订单及旧确认会话回执不能修改当前状态。数据仅保存在本次运行的内存中,重启会重置。 + +## 演示与限制 + +Debug 版“全部功能 → 机巢预览 → 查看全部”,点击订单“交付成片”;已有交付作品的订单还可点击“请游客确认/查看记录”。素材记录标题右侧也能进入交付并预选点位。 + +上传面板与整单确认页提供右上角本地状态菜单。正常上传按钮会自动演示逐项进度;状态菜单可注入部分失败、暂停、完成、待确认、查看中、反馈和已确认。确认页“模拟游客主动确认”明确模拟查看与勾选后收到确认回执,不由刷新触发。 + +| Debug 参数 | 用途 | +| --- | --- | +| `--dock-ui-delivery-preview` | 冷启动后显示交付方式面板 | +| `--dock-ui-delivery-review-preview` | 直接进入整单交付确认页 | +| `--dock-delivery-scenario=partialFailure` | 本地上传部分失败场景 | +| `--dock-delivery-scenario=completed` | 本批成功作品与整单待核对 | +| `--dock-delivery-scenario=awaitingConfirmation` | 演示确认码等待态 | +| `--dock-delivery-scenario=confirmed` | 已确认记录 | + +本轮不请求系统相册权限、不上传本机视频、不调用真实 OSS 或交付接口、不连接游客手机。视频复用随包的 3 秒本地示例;文案标明本机交互演示,码图不可作为真实游客收片服务或收货凭证。确认无真实有效期,因此未新增自动失效判据。 + +## 验证与真机截图 + +- iOS 真机目标与模拟器页面编译通过;模拟器仅用于视觉检查,未运行模拟器单元测试。 +- iPhone 11 真机最终复测 **99 项、0 失败**:本轮交付规则 20 项、交付联动 5 项,以及此前机巢/拍摄/素材相关 74 项。 +- 最终截图检查修正了上传中禁用按钮的文字颜色与反复刷新时的标题过渡,随后追加复测交付联动 **5 项、0 失败**,本文截图采用该次最终结果。 +- 联动测试从真实订单和素材按钮进入,验证未选点禁用、多选与独立预览、驱动逐项成功、失败项单独重试、后台暂停及手动继续、关闭后的订单摘要、整单核对门槛、刷新不确认及明确回执后的记录。 +- 窗口测试检查实际点击命中及可见布局;首轮发现的预览转场等待不足已修正为等待转场结束且按钮实际可点击后再验证。未发现需保留的新增布局错误。 +- 补查了下滑取消关闭的生命周期:取消手势不会暂停队列,实际关闭才暂停。该分支完成代码检查,未单独进行真机手势自动化测试。 +- 未进行真实上传、游客端联调或全工程回归。截图来自真机 XCTest 隔离窗口,系统状态栏不在截图中;独立弹层测试的背景为空白页面,因此部分截图背景为黑色,正常订单入口仍显示原订单页面。 + +| 交付方式 | 未选点 | 素材入口预选点 | +| --- | --- | --- | +| ![方式](delivery-ui-2026-10-23/delivery-method.png) | ![未选点](delivery-ui-2026-10-23/delivery-point-empty.png) | ![预选点](delivery-ui-2026-10-23/delivery-point-prefilled.png) | + +| 演示视频选择 | 上传队列 | 本批成功 | +| --- | --- | --- | +| ![视频选择](delivery-ui-2026-10-23/delivery-video-picker.png) | ![上传中](delivery-ui-2026-10-23/delivery-uploading.png) | ![完成](delivery-ui-2026-10-23/delivery-completed.png) | + +| 部分失败 | 回前台暂停 | 订单摘要 | +| --- | --- | --- | +| ![失败](delivery-ui-2026-10-23/delivery-partial-failure.png) | ![暂停](delivery-ui-2026-10-23/delivery-paused.png) | ![摘要](delivery-ui-2026-10-23/delivery-order-summary.png) | + +| 整单核对 | 确认码等待 | 确认记录 | +| --- | --- | --- | +| ![核对](delivery-ui-2026-10-23/delivery-review.png) | ![确认码](delivery-ui-2026-10-23/delivery-confirmation-code.png) | ![记录](delivery-ui-2026-10-23/delivery-receipt.png) | diff --git a/docs/9.9.1/原型与接口复核-2026-10-26.md b/docs/9.9.1/原型与接口复核-2026-10-26.md new file mode 100644 index 0000000..bb02e32 --- /dev/null +++ b/docs/9.9.1/原型与接口复核-2026-10-26.md @@ -0,0 +1,91 @@ +# 随心瞰 9.9.1 原型与接口复核 + +复核日期:2026-10-26。原型:[机巢交互体验](https://voicestudio.suixinkan.cn/)。本轮通过内部浏览器实际操作,结合[已确认方案基线](review/product-comparison/current-baseline.md),更新[后端接口需求](后端接口需求.md)。 + +本轮只更新资料,没有修改业务代码,没有真实支付、上传文件、控制无人机或向游客发送消息。原型明确标注为交互演示;以下观察不代表后端已经实现或联调通过。 + +## 1. 本轮实际走过的流程 + +| 流程 | 实际操作与可见结果 | 接口含义 | +| --- | --- | --- | +| 工作台与订单 | 工作台展示多台设备、六项状态、本人景区订单;拍摄成功后,该订单余次归零,从工作台移除并在“已完成”Tab 可见 | 设备、订单履约、次数、原素材状态必须分别返回;不能只用一个总状态 | +| 拍摄准备 | 打开订单,查看点位和航线;切到占用状态后,底部显示占用、召唤禁用;恢复正常后召唤进入任务 | 返回点位航线、资源绑定、范围、权限和不可执行原因;最终召唤由权威端校验 | +| 任务控制 | 从拍摄中点击暂停,先显示正在暂停,随后悬停;点击立即返航直接提交,显示等待确认;结束后提示中断且未扣次 | 指令受理与设备生效分离;不把返航、暂停直接当拍摄结果 | +| 超时恢复 | 启用指令超时演示,点击开始;出现结果待确认、禁止重复启动;点击刷新后同步原任务,随后出现拍摄完成弹窗 | 需要按原请求/任务/指令查询,不用换请求号重发来恢复 | +| 执行中返回 | 补测已到达、尚待开始的活跃任务;点击返回弹出“任务仍在执行”,选择离开后回准备页,设备占用且提供“继续查看任务” | 离页不取消任务;原型导航与已确认 C02 不同,按下文保留原方案 | +| 订单素材 | 从完成弹窗进入当前点素材库,先等待清单;切换就绪后选择并演示下载;完成后出现交付入口 | 待生成、上传就绪、下载与本机保存分别表达;原素材与剪辑成片不是同一数据集 | +| 成片交付 | 从拍摄记录进入交付,云端上传预选原点位;演示相册选择两个视频,经历上传中、两项已交付,再回到订单 | 批次、逐作品身份、点位归属和登记状态需持久化;上传不扣拍摄次数 | +| 整单核对 | “请游客确认”进入跨批次整单清单,工作人员勾选交齐后才能出码;刷新仍保持待游客确认 | 出码绑定具体整单版本与作品清单;刷新不产生确认结果 | +| 游客反馈与确认 | 演示扫码后先提交“视频缺失”;商家进入反馈待处理,重新核对后勾选清空;再次出码,游客主动勾选并确认,订单显示“查看记录” | 需要反馈记录、再次发起确认、身份授权、确认幂等和历史清单快照 | +| 套餐收款 | 查看套餐列表并选择三次套餐生成码;打开改价弹窗后取消;再切待支付演示并模拟支付成功,页面停留,点击查看订单 | 套餐、成交价、权益、支付与订单关联需服务端绑定;本轮未修改金额并验证付款 | + +上述步骤包含正常点击和原型“体验状态”切换,不是连续真实设备执行。尤其拍摄中、超时、素材就绪与部分下载失败使用了演示状态入口。 + +## 2. 新增重点:景区空镜库 + +原型工作台左上角现有“景区空镜库”,进入后标题为“景区素材”。**用户在复核后补充确认:景区空镜库与机巢工作台是两个独立模块,后续各自在首页配置独立入口;原型将入口放在工作台内仅为方便体验。** 因此不能据此把空镜库设计为工作台子页面,或要求先加载工作台、订单、任务后才可进入。 + +景区空镜库使用独立入口权限及景区数据范围,菜单 URI 待实际配置,不复用 `drone_dock` 作为授权依据。登录、景区选择和下载基础能力可以共用;订单原素材、游客成片和空镜仍分别识别来源、访问范围与稳定标识。截图与观察记录保留原型当时的真实位置,正式模块关系以此次用户补充为准。 + +实际观察及操作: + +- 页面提示素材保留 **90 天**;按航线分区,再按拍摄时间分组,组内显示片段序号、时长,部分卡片同时显示分辨率和大小。 +- 航线筛选可选全部或指定航线。选择“少室山 → 迎客峰”实际出现无符合条件素材,重置筛选恢复列表。 +- 打开时间筛选可见开始/结束日期、“全部时间”和保留期内日期限制。本轮只查看后取消,**未提交日期范围,未验证跨日或边界日期**。 +- 选择一组共六段的素材,底部计数为六;展开原先折叠的第六段后,该段也处于选中状态。后端不能只返回可见的前五段却让客户端声称整组选中。 +- 打开片段预览,看到航线、拍摄时间、片段号、时长、分辨率与大小;播放器注明演示,不是真实视频播放验证。 +- 激活部分下载失败:一项已下载、一项失败;点击重试失败后,进入下载中,再显示两项已下载。界面明确未保存真实文件。 +- 激活相册权限不足,显示本地权限提示及“暂不下载”;本轮取消,未修改系统相册权限。 + +接口需补充景区素材筛选选项、航线/拍摄批次/片段身份、分页与完整分组语义、可下载授权、真实保留策略及到期时间。90 天是本轮原型观察,正式保留规则由服务端契约确认;不能套用到订单原素材或游客成片。 + +## 3. 交付与确认应补齐的接口语义 + +- 成片上传授权、文件上传结果与业务登记分离;单次批次可包含多个视频,重试成功项不重复登记。 +- 整单清单包含所有上传批次,按点位归集;单批上传成功不代表整单已交齐。 +- 确认会话绑定整单版本与作品范围。扫描、查看、刷新、工作人员勾选都不能替代游客主动确认。 +- 原型反馈选项为视频缺失、无法播放、成片效果有异议、其他问题,可补充文字;本轮只提交了“视频缺失”。 +- 反馈后扫码入口禁用,工作人员可“处理后重新核对交付”;原核对勾选清空,反馈记录仍保留。重新核对不应被服务端直接解释为反馈已解决。 +- 确认记录显示确认人、确认时间、交付工作人员、点位/成片数量、确认声明及当时的清单;原型说明新增成片不覆盖旧清单。正式接口应保存不可变快照,不靠 App 当前列表回填历史。 +- “面对面闪传”仍标注流程待确认,本轮未进入;不能据此新增本期必做的局域网传输服务端接口。 + +## 4. 与已确认方案的差异及处理 + +| 项目 | 本轮原型观察 | 文档保留的规则 | +| --- | --- | --- | +| 空镜库入口位置 | 原型把入口放在机巢工作台左上角 | 按用户复核后确认,正式 App 为首页独立模块;原型入口仅供体验,不代表从属关系 | +| 支付后默认 Tab | 支付成功后点击“查看订单”实际进入“全部”,新订单位于列表首部 | 保留 C17:从支付成功页进入“待拍摄”;不因本轮原型自动改成“全部” | +| 任务返回路径 | 已完成任务返回准备页;补测活跃任务在已到达待拍阶段,返回先弹离开确认,选择离开后仍回准备页 | 保留 C02:执行中直接回工作台,不弹确认,任务继续;不能按原型新增离开弹窗或改为回准备页 | +| 工作台活跃任务卡 | 已到达待开始任务回工作台后,仍排在新支付订单后;按钮“继续查看任务”,标签仍为履约“进行中” | 保留 C03–C05:有余次的活跃任务置顶,按钮“查看当前任务”,右上角显示具体任务阶段;A06 仍需返回任务引用与阶段 | +| 失败后按钮文案 | 中断且回巢后显示“重新召唤无人机”;本轮未点击该按钮 | 保留 C09:“重新准备拍摄”,回准备页保留有效选择,再人工确认召唤;不按按钮字面推断直接重召 | +| 下载完成文字 | 订单素材演示显示已保存到相册,空镜演示注明未保存真实文件 | 真实 App 必须等本机保存成功才标记已保存,演示动画不构成真实写入证据 | + +收款 UI 仍按用户之前要求暂缓实施;这不等于删除后端套餐收款能力。交付 UI 已获授权并有本地实现,旧接口文档“交付事件全部暂缓”的表述应更新。 + +## 5. 覆盖边界与未验证项 + +以下菜单项本轮看到了,但没有逐项激活或跑通,不应列为已验证通过: + +| 页面 | 仅观察菜单、未逐一验证的分支 | +| --- | --- | +| 工作台/准备 | 单台切换、首页空订单;准备页未连接、无信号、低电量、状态未知、范围外、无航线。零次数禁用在主流程中实际出现 | +| 任务 | 失败仍返航、失败可重试的按钮路径、画面断流、手机断网、保护性返航、执行失败弹窗;已到达任务从准备页恢复已补测;返航暂停后恢复未实测 | +| 订单素材 | 原素材上传失败及重试、下载失败/重试、离开确认、该页面的相册拒权;本轮成功下载不是系统相册测试 | +| 成片交付 | 上传失败、关闭/后台暂停、多批跨点位累积、新增成片后的旧会话失效;确认页声明保留旧清单,但未追加作品验证历史变化 | +| 景区空镜 | 全库无素材、参考图已选两段的独立状态入口;时间筛选提交、取消下载、保留期真实到期和分页;筛选无结果、失败重试、权限弹窗已实际查看 | +| 收款 | 生成失败、二维码失效、无可售套餐、改价提交、旧码迟到付款、支付成功但订单生成中、收款记录/线下登记 | + +本轮未联调真实接口,因此权限撤销、多端并发、重复回调、乱序事件、凭证到期、后台恢复与实际设备执行等仍按[后端接口需求](后端接口需求.md)列为契约和联调用例,不能从原型推断已具备。 + +## 6. 证据 + +[逐步观察记录](prototype-audit-2026-10-26/observations.json)保存 93 条页面快照,其中包含重复观察和转场期间的快照,**不是 93 种独立业务状态**。以最终稳定页面及上文明确的操作范围为准。 + +- [景区素材列表截图](prototype-audit-2026-10-26/scenic-materials.png) +- [景区素材相册权限截图](prototype-audit-2026-10-26/scenic-permission.png) +- [游客确认记录截图](prototype-audit-2026-10-26/delivery-confirmed.png) +- [支付后实际进入全部 Tab 截图](prototype-audit-2026-10-26/payment-order-tab.png) +- [活跃任务离开确认截图](prototype-audit-2026-10-26/active-task-leave-dialog.png) +- [活跃任务离开后回准备页截图](prototype-audit-2026-10-26/active-task-back.png) + +- [工作台活跃任务卡截图](prototype-audit-2026-10-26/active-order-workbench.png) diff --git a/docs/9.9.1/后端接口需求.md b/docs/9.9.1/后端接口需求.md new file mode 100644 index 0000000..a295867 --- /dev/null +++ b/docs/9.9.1/后端接口需求.md @@ -0,0 +1,667 @@ +# 随心瞰 9.9.1 后端接口需求清单 + +初版:2026-10-22;更新:2026-10-26。面向:App、后端、机巢/设备及游客网页联调同事。 + +本文根据已确认的 App 流程、原需求、产品原型实测记录和当前 iOS 源码整理。**需要补齐的核心链路是:套餐收款 → 本人当前景区订单 → 点位航线及设备许可 → 可恢复的拍摄任务与指令 → 成功次数结算 → 原素材查看下载 → 剪辑成片交付 → 整单核对 → 游客确认与反馈。** 本次另补独立的“景区空镜库”查询与下载能力。 + +下面列出 **24 项接口能力**,不代表需要新增 24 个 URL。A01–A22 属于机巢工作台及其业务流程,A23–A24 属于独立的景区空镜库模块;为方便本期对接,仍汇总在同一文档。后端可扩展已有接口、合并查询,或提供已有但 App 尚未接入的接口;设备控制、遥测、图传也可能通过设备 SDK/协议提供。本文没有为新能力预设真实 URL、数字枚举或设备协议。 + +**模块边界(2026-10-26 用户补充确认):**景区空镜库与机巢工作台是两个独立模块,后续各自在 App 首页配置独立入口。原型将空镜库入口放在工作台左上角,仅为方便体验,不代表正式功能从属于工作台。 + +| 模块 | 正式入口规划与权限 | 调用依赖 | +| --- | --- | --- | +| 机巢工作台 | 首页独立入口,已适配菜单 URI `drone_dock` | 本人当前景区订单、设备及任务等上下文 | +| 景区空镜库 | 首页另配独立入口;菜单 URI/权限标识待实际配置,不在本文擅自命名,也不复用 `drone_dock` 作为授权依据 | 使用登录身份与景区上下文即可查询,不依赖先进入机巢工作台、加载工作台接口、绑定拍摄订单或存在拍摄任务 | + +两个模块可复用登录、景区选择、文件预览和下载基础能力;模块独立不要求后端拆成两个服务,但入口授权和数据访问范围必须分别校验。 + +### 本次更新要点 + +| 变更 | 对接口的影响 | +| --- | --- | +| 首页入口已适配 `drone_dock` | A01 明确权限 URI 和顶层返回位置 | +| 景区空镜库为独立模块,后续在首页单独配置入口 | A23–A24:独立入口权限、景区范围、航线/时间筛选、拍摄批次分组、90 天保留提示、预览/批量下载授权;工作台中的入口仅为原型体验入口 | +| 成片云端上传与整单确认已进入本地 UI 实施 | A17–A22:上传授权/登记、批次恢复、整单清单、会话、游客反馈/确认、历史快照;扩充 A06/A12 | +| 立即返航交互已核实 | 直接提交、先显示处理中;设备生效仍须查询/回报,删除“二次确认待定”旧描述 | +| 本轮重点复核的导航与卡片差异 | 活跃任务返回原型先弹离页确认,再回准备页;支付“查看订单”原型进全部 Tab。活跃卡还未置顶/显示具体阶段。App 仍保留 C02–C05、C17;A06 返回任务阶段,页面路由无需新增接口 | + +“原型可见”证明页面所需数据;“接口建议”用于补齐真实联调;两者均不证明后端已实现。空镜保留期、成片确认版本仲裁等需要后端明确,不能将演示样例写成既有协议。 + +## 1. 范围与依据 + +依据优先级:最新明确确认 → 原需求及附件 → 评审建议 → 产品原型观察。具体见: + +- [当前方案基线:C01–C23、原需求规则、未定事项](review/product-comparison/current-baseline.md)。 +- [2026-10-26 原型与接口复核:实走范围、差异与截图](原型与接口复核-2026-10-26.md)。原型地址:[产品交互网页](https://voicestudio.suixinkan.cn/)。 +- [交付成片本地 UI 实现说明](交付成片UI实现说明.md)、[首页入口适配说明](机巢UI首轮实现说明.md)。 +- [产品原型与当前方案对比](review/product-comparison/随心瞰9.9.1-产品原型与当前方案对比.md)。 +- [非支付流程复跑记录](review/product-comparison/非支付流程复跑记录.md)。 +- 原始输入:《随心瞰9.9.1.md》及《图片和附件/README.md》(用户提供,未复制进本次资料归档)。 + +核对范围为当前 `dev_9_9_1` 分支的 iOS 接口和模型,未请求真实后端、支付或设备。项目配置的 Android 参考目录在本机不存在,未核对 Android 实现。**“当前 iOS 未接入”不能证明“后端尚未实现”**,请后端优先提供可复用接口。 + +本版 App 的职责边界: + +- 进入机巢工作台后,获取**当前登录用户、当前景区**的订单;分配与归属由后端处理,App 不新增派单算法或管理后台。 +- 新收款页需支持选择套餐;**当前 UI 实施仍按用户要求暂缓**,本次仅保留接口需求。Web 套餐创建/上下架属于配套后台,不列为 App 管理接口。 +- 游客原有自助下单方式保留。符合归属条件的订单应能按统一拍摄订单契约查询,不要求 App 判断其分配来源。 +- 2026-10-23 已授权按新版原型搭建本地成片交付 UI;云端上传与整单确认现纳入接口需求。游客网页/身份校验由配套端与后端提供,商家 App 展示确认码并查询结果。 +- 面对面闪传在最新原型仍为“流程待确认”。之前仅讨论同 Wi-Fi/热点扫码下载的可行性,本轮不把它列为已定服务端交付功能。 +- 主动“立即返航”按 C21 直接提交,不弹二次确认;先显示指令处理中,不能提前当作设备已返航。 +- 景区空镜库是首页独立模块,不是机巢工作台的子页面。景区空镜是景区公共素材范围,游客原素材与剪辑成片是订单范围。三者分别鉴权、识别来源,不能因都叫“素材”而混用订单或状态。 + +## 2. 总览:需要后端提供或确认的能力 + +“必备”表示已确认流程或原需求依赖;“补充契约”表示异常恢复所需的数据语义;“原型补充”需随产品细节和接口一起落实,不能当作已上线能力。 + +| 编号 | 接口能力 | 主要调用时机 | 提供方式/范围 | +| --- | --- | --- | --- | +| A01 | 工作台上下文、权限、设备绑定与统计 | 进入/回到工作台、切换景区 | 必备;优先复用权限、景区和统计接口并补字段 | +| A02 | 当前景区可售航拍套餐 | 打开新收款页、刷新套餐 | 必备;提供套餐、价格、次数、版本;改价权限属原型补充 | +| A03 | 创建/重新生成套餐收款单与二维码 | 确认套餐、修改成交价、重新生成码 | 必备;绑定套餐快照与金额,具备幂等和旧码处理契约 | +| A04 | 查询收款与拍摄订单生成结果 | 等待支付、刷新、回前台、超时恢复 | 必备;支付结果与二维码状态独立 | +| A05 | 套餐收款记录 | 进入现有收款记录入口 | 优先复用;核对新业务是否纳入,并补套餐、交易、订单关联 | +| A06 | 本人当前景区拍摄订单列表/详情 | 工作台、查看全部、各 Tab、打开订单 | 必备;含履约、次数、任务引用、素材汇总 | +| A07 | 订单拍摄准备数据:点位、航线、已拍次数 | 打开/刷新准备页、切换点位 | 必备;可聚合返回或拆点位/航线查询 | +| A08 | 设备状态、遥测、范围与执行许可 | 工作台/准备页/任务页同步 | 必备;后端与设备共同提供权威状态及不可执行原因 | +| A09 | 创建并召唤一次拍摄任务 | 手动确认召唤 | 必备;原子校验、设备占用、幂等、按原请求恢复 | +| A10 | 当前任务与任务详情快照 | 重进任务、冷启动恢复、断网恢复、手动刷新 | 必备;成功/失败与飞行、结算分别表达 | +| A11 | 开始/暂停/恢复/返航指令提交与结果查询 | 任务控制、指令结果待确认 | 必备;服务受理与设备执行分开,有指令 ID | +| A12 | 状态更新与重新同步通道 | 页面展示期间、重连/切回前台 | 必备能力;事件、SDK 回调或约定轮询均可,不强制新 WebSocket | +| A13 | 图传接入、鉴权和续期/重连 | 进入任务页、画面断流/凭证到期 | 必备;提供后端接口或设备 SDK/协议文档 | +| A14 | 按订单/拍摄记录查询素材与上传状态 | 查看素材、本次拍摄成功后、刷新 | 必备;分组、点位筛选、混合上传状态和分页 | +| A15 | 获取/刷新有权限的预览与下载地址 | 预览、下载、继续下载、链接失效 | 必备;可并入 A14,不强制单独 URL | +| A16 | 重试原拍摄素材的失败上传 | 素材项“重试上传” | **条件项**;仅在产品保留且设备/服务端支持时提供 | +| A17 | 成片上传授权与作品登记 | 选择云端上传、点位与视频 | 新增交付能力;可复用上传基础服务,补订单/点位关联与登记结果 | +| A18 | 成片批次与逐项恢复查询 | 上传、重试、重进、结果未知 | 支持部分成功和已上传未登记,避免重复作品 | +| A19 | 整单成片清单与摘要 | 订单卡、商家整单核对 | 跨点位/批次聚合;清单版本、数量、权限与确认摘要 | +| A20 | 整单确认会话创建/恢复/状态查询 | 核对后出码、刷新、反馈后重新核对 | 固定清单范围;生命周期、旧会话与反馈关联需约定 | +| A21 | 游客访问、主动确认与反馈 | 游客扫码后查看/确认/反馈 | 游客网页配套能力;App 不代游客提交确认 | +| A22 | 历史确认记录及作品快照 | 订单“查看记录” | 保存确认时范围,新增成片不覆盖历史 | +| A23 | 景区空镜清单、分组与筛选条件 | 从首页独立入口进入景区空镜库、刷新/筛选 | 独立模块;入口权限、景区权限、航线、时间范围、保留期和分组分页 | +| A24 | 景区空镜预览/批量下载授权 | 预览片段、下载所选、重试 | 可复用 A15 底层能力;按空镜 ID 鉴权,逐项返回可用性及有效期 | + +## 3. 当前已有接口:可以复用什么 + +以下路径来自当前 iOS 源码,是已接入能力的边界,不能直接推断它们已支持航拍。 + +| 现有接口 | 当前能力 | 本期处理建议与源码 | +| --- | --- | --- | +| `GET /api/yf-handset-app/role-permission`;`GET /api/yf-handset-app/photog/scenic/list-all` | 角色权限树、景区范围和景区列表 | 优先扩新销售角色、机巢入口及操作权限;见 [HomeAPI.swift](../../suixinkan/Features/Home/API/HomeAPI.swift#L17)、[角色权限模型](../../suixinkan/Features/Home/Models/RolePermissionModels.swift#L50) | +| `GET /api/yf-handset-app/photog/pay-code` | 输入 `scenic_id`,返回静态/动态支付 URL | 未表达套餐、权益、单笔交易及有效期;不能直接当作 A03/A04。见 [PaymentAPI.swift](../../suixinkan/Features/Payment/API/PaymentAPI.swift#L17)、[支付模型](../../suixinkan/Features/Payment/Models/PaymentModels.swift#L106) | +| `GET /api/yf-handset-app/photog/pay-page-config` | 背景、Logo、标题等 | 可复用品牌展示配置;套餐与权益另补。见 [PaymentAPI.swift](../../suixinkan/Features/Payment/API/PaymentAPI.swift#L28) | +| `GET /api/yf-handset-app/photog/order/photo-scan-order-list` | 近 7 天收款记录与日汇总 | 核对新套餐交易是否纳入,必要时扩展 A05。见 [PaymentAPI.swift](../../suixinkan/Features/Payment/API/PaymentAPI.swift#L39) | +| `GET /api/yf-handset-app/photog/order/listv2` | 普通摄影订单、分页、旧订单状态筛选 | 需扩展或新建 A06。旧 `order_status`/`order_type` 不能直接等同航拍履约状态。见 [OrderAPI.swift](../../suixinkan/Features/Orders/API/OrderAPI.swift#L17)、[OrderEntity](../../suixinkan/Features/Orders/Models/OrderModels.swift#L23) | +| `GET /api/yf-handset-app/photog/analyse/user` | 订单金额、数量、均价等统计 | 核对是否覆盖本人/景区/航拍业务和成功拍摄口径。见 [StatisticsAPI.swift](../../suixinkan/Features/Statistics/API/StatisticsAPI.swift#L18) | +| `GET /api/yf-handset-app/photog/scenic-spot/list`、`/info`;`/list-all` | 打卡点资料、位置;简表只有 ID/名称 | 可协商复用点位身份;仍需航线、机巢绑定、有效范围、执行许可。见 [PunchPointAPI.swift](../../suixinkan/Features/PunchPoint/API/PunchPointAPI.swift#L33)、[简表模型](../../suixinkan/Features/ScenicQueue/Models/ScenicQueueAPIModels.swift#L492) | +| `POST /api/yf-handset-app/photog/task/create` | 云盘/上传文件相关的素材处理任务 | **不是无人机任务**,不能以此替代 A09。见 [TaskAPI.swift](../../suixinkan/Features/Task/API/TaskAPI.swift#L17)、[任务请求](../../suixinkan/Features/Task/Models/TaskModels.swift#L9) | +| `GET /api/app/socket-token` 及排队 WebSocket | 现有排队叫号订阅 | 可评估共用基础通道,但没有机巢事件契约;当前客户端 token 仅校验非空,未加入握手/订阅,不能直接认定已具备飞控鉴权。见 [ScenicQueueSocketClient.swift](../../suixinkan/Features/ScenicQueue/Services/ScenicQueueSocketClient.swift#L24)、[事件模型](../../suixinkan/Features/ScenicQueue/Models/ScenicQueueSocketModels.swift#L42) | +| `/api/app/manual-live/*` | 人工直播列表、详情、开播/停播/完成 | 不等于无人机图传与飞控;直播 `start/stop/finish` 不能映射任务指令。见 [LiveAPI.swift](../../suixinkan/Features/Live/API/LiveAPI.swift#L58) | +| `GET /api/yf-handset-app/photog/travel-album/material-list`、`/material-info` | 按 `user_equity_travel_id` 获取相册素材,含订单号 | 可评估共用文件能力;未表达拍摄任务/记录/点位航线分组及下载地址有效期。见 [TravelAlbumAPI.swift](../../suixinkan/Features/TravelAlbum/API/TravelAlbumAPI.swift#L121)、[素材模型](../../suixinkan/Features/TravelAlbum/Models/TravelAlbumModels.swift#L176) | +| `/api/app/media-album/*`;`/api/yf-handset-app/photog/cloud-driver/*` | 素材发布审核/云盘文件管理 | 审核状态不是上传状态;文件夹不是拍摄记录。不能直接充当 A14。见 [MaterialManagementAPI.swift](../../suixinkan/Features/MaterialManagement/API/MaterialManagementAPI.swift#L46)、[CloudDriveAPI.swift](../../suixinkan/Features/CloudDrive/API/CloudDriveAPI.swift#L52) | +| `GET /api/app/config/get-sts-token` | App 向 OSS 上传的临时凭证 | 原素材下载不需要上传权限;A17 的剪辑成片上传可评估复用,但须限定授权范围并补业务登记,不能仅拿到 STS 就认定成片已交付。见 [UploadAPI.swift](../../suixinkan/Core/Upload/UploadAPI.swift#L24) | + +旧收款改金额是客户端拼接动态支付 URL,见 [PaymentCollectionDetailsViewModel.swift:192](../../suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift#L192)。新增套餐 ID 到 URL 并不能替代套餐、成交价、权益和单笔交易的服务端绑定。 + +## 4. 工作台、套餐收款与订单 + +### A01 工作台上下文、权限与统计 + +**请求:**当前 `scenic_id`,身份从登录凭证获取。已有权限/景区接口可复用,不要求新建重复鉴权接口。 + +**需要返回或明确:** + +- 机巢工作台入口、新销售角色编码,以及收款、查看订单、操作任务、查看订单原素材、上传成片、发起确认和查看记录的能力与景区范围。建议动作权限分别返回,不能仅靠入口可见推断所有操作均允许。独立景区空镜库的入口及访问权限见 A23,不纳入 `drone_dock` 的隐式权限范围。 +- 已落地入口 URI 是 **`drone_dock`**:`role-permission` 需在匹配的当前角色 `role.permission` **顶层**返回,当前 App 不递归寻找子权限。标题与图标使用本地配置;加入首页常用由原有本地规则管理,后端不需要新建“添加常用”接口。已有入口不代表真实机巢业务数据已接通。 +- 当前景区的机巢/无人机资源及绑定关系;与拍摄点之间如何选择,见 A07/A08。不能默认整个景区只有一架无人机。 +- 本景区未结束任务的引用,或能稳定查询这些引用的方式。不能只从首页有剩余次数的订单中恢复任务。 +- 工作台若保留原型的“成交订单数/成交金额/完成拍摄”统计,明确本人、当前景区、航拍业务、当日时区的口径;“完成拍摄”是成功拍摄次数还是履约完成订单数,需给出定义,不能直接用旧 `order_count` 替代。 + +切换景区只切换查询上下文,**不取消原景区任务**。销售人和拍摄负责人是否一致由后端归属规则处理,App 不用收款人自行推断。 + +### A02 当前景区可售套餐 + +**请求:**`scenic_id`。 + +**最小响应:**套餐稳定 ID、配置版本、名称、标价、币种、包含拍摄次数、是否可售;原型允许修改成交价,如保留该能力,补充改价权限、金额范围及小数精度。金额建议使用最小货币单位整数或约定精确十进制字符串。 + +- 套餐为空与加载失败分开。套餐价格和次数来自服务端,不写死原型的 99/259/399 元或 1/3/5 次。 +- 套餐已下架/改价/改次数后,生成码时重新校验版本;订单和已建立收款单保存当时的套餐快照,不能被后续配置覆盖。 +- App 不调用 Web 套餐新增、编辑、上下架接口。 + +### A03 创建、重新生成套餐收款单/二维码 + +**请求:**`scenic_id`、`package_id`、套餐版本、实际成交价、备注、`client_request_id`。收款身份由服务端确定。 + +**最小响应:**稳定 `collection_id`/交易 ID、本次请求标识、套餐名称和权益快照、成交价、币种、二维码内容或可编码 URL、码状态及到期时间、交易状态、服务端时间。 + +后端需要保证: + +1. 校验套餐可售、版本、金额及改价权限。**修改成交价不改变套餐拍摄次数**(原型补充规则)。 +2. 相同幂等标识的重复提交只建立同一笔收款;同标识携带不同参数时明确拒绝或返回原单,不悄悄生成另一笔。 +3. 修改套餐/价格、刷新过期码时,明确是同单换码还是新建单,以及旧码能否继续支付、迟到付款如何关联订单。屏幕上的套餐、价格、权益和码必须属于同一收款快照。 +4. 如果单已创建但二维码生成失败,保留可恢复的收款标识,不要求 App 盲目重复开单。 +5. 超时导致 App 未拿到 `collection_id` 时,可用 `client_request_id` 查回原单(可以并入 A04)。 + +“重新生成”不能自动等同于“再收一次款”。码的生命周期和交易生命周期由服务端给出明确契约。 + +### A04 查询支付和关联订单结果 + +**请求:**`collection_id`;创建结果未知时支持按原 `client_request_id` 恢复。提供约定的查询方式,支付推送可用于加速但不能替代恢复查询。 + +**最小响应:**收款单 ID、码状态、交易状态、交易流水引用、实际到账金额、支付时间、关联拍摄订单 ID/号、订单生成状态、状态版本/更新时间。 + +至少能区分: + +- 二维码:生成中、可用、生成失败、失效;扫码不等于到账。 +- 支付:待支付、支付确认中、已支付、明确失败、已关闭;**查询失败/手机超时只是当前结果未知,不直接改成支付失败**。 +- 支付成功但订单异步生成中:保留已到账事实,并提供后续查询方式;订单暂未可见不引导再次付款。 + +重复支付通知/重复查询不得重复创建权益或订单。App 的支付成功页停留和跳转“我的拍摄订单 → 待拍摄”是本地路由,不需要新跳转接口;新订单仍按后端最终归属决定可见性。 + +### A05 收款记录扩展 + +优先核对旧 `photo-scan-order-list` 是否已经覆盖航拍套餐交易。若复用,至少补充收款单/交易 ID、关联拍摄订单 ID/号、套餐快照、含拍摄次数、实收金额、支付状态、支付时间,保留明确的景区/本人范围和现有时间口径。 + +不要把原普通收款记录仅换标题当作套餐收款记录。是否需要超出原近 7 天的分页/筛选,按最终页面需求确认,不预设新增历史管理功能。 + +### A06 本人当前景区拍摄订单列表/详情 + +**列表请求:**`scenic_id`、列表范围(工作台/全部订单)、拍摄履约筛选(全部/待拍摄/进行中/已完成)、分页参数。后端基于登录身份过滤;不依赖 App 传其他员工 ID 决定归属。 + +**列表最小响应:** + +- 稳定 `order_id`、订单号、游客脱敏展示信息、创建时间。 +- 套餐快照、总次数、已成功次数、剩余次数、独立的拍摄履约状态。 +- 当前未结束任务引用:`task_id`、阶段、暂停前阶段、是否已结束、可查看任务的权限;可以据此显示七种任务标签。 +- 素材汇总状态和数量;是否可查看素材。任务引用与素材汇总不能共用一个总状态。 +- **新增独立成片摘要:**成功作品数、覆盖点位数、待处理/失败上传数、整单清单版本、当前确认状态/会话引用、最近确认时间/记录引用、反馈摘要,以及上传/核对/查看记录权限。“拍摄完成”“原素材上传完成”“成片已交付”“游客已确认”必须可同时独立表达。 +- 稳定排序/分页信息、版本或更新时间;如页面显示 Tab 数量,返回相应筛选口径的数量。 + +**详情/恢复查询:**支持按订单 ID 获取当前次数、任务引用、套餐快照;可以与准备页数据聚合返回,但不能因为订单已完成而禁止查看原任务或素材。 + +必须保留的筛选规则: + +| 组合 | 工作台/首页 | 我的拍摄订单 | +| --- | --- | --- | +| 剩余次数为 0,无论返航/上传是否结束 | 立即移除 | 已完成;飞行任务未结束时临时保留“查看当前任务” | +| 已成功拍过部分、仍有次数、当前没有活跃飞行 | 保留 | 进行中,允许准备下一次 | +| 仍有次数且存在活跃任务 | 当前任务订单置顶 | 返回任务引用,打开同一任务 | +| 尚未开始拍摄且无活跃任务 | 按正常规则展示 | 待拍摄 | + +首次任务失败后尚无成功记录、任务中断等其他分类边界,请后端给出完整履约状态表;**App 不用旧摄影订单数字状态猜新状态**。旧模型的 `order_type` 也需要明确新的业务类型/识别方式。 + +## 5. 拍摄准备、设备与任务控制 + +### A07 订单拍摄准备上下文 + +**请求:**`order_id`、`scenic_id`;可带仍待校验的上次 `point_id`/`route_id`。如需根据手机位置评估范围,附坐标、坐标系、定位时间及精度,位置缺失必须可表达。 + +**最小响应:** + +- 最新订单次数、权限、当前任务引用;已有本订单任务时恢复原任务,不能再创建。 +- 拍摄点列表:稳定 ID、名称、图片、有效状态、各点成功拍摄次数、位置/范围所需数据。 +- 各点对应航线:稳定 ID、所属点 ID、名称、有效状态、配置版本。航线按点关联,不能按同名匹配。 +- 点位、机巢、无人机的绑定/资源选择规则。若设备由服务端分配,返回本次选择对应的目标资源,不让 App 猜测。 +- 范围/距离结果与有效时间,或足够的围栏数据和明确算法供 App 预判;最终召唤仍由权威端校验。 + +范围数据需明确圆形/多边形等表示、坐标系和距离单位,不能直接拿旧打卡点 `region` 当机巢可执行围栏。不要求后端另建“保存选中航线”接口:App 可本地记住选择,但每次进入/发起召唤都需校验其仍有效。 + +范围外可浏览和选择;未知位置、过期定位、无点、无航线或选择失效都不能当作允许召唤。切点只使用该点的有效航线;点位已成功拍过仍可再次选择。 + +### A08 设备状态、六项遥测与执行许可 + +后端/设备方先明确数据由谁产生、App 通过何种通道取得;可与 A07/A10 聚合,不能仅返回一个 `online=true`。 + +| 数据 | 最少需要表达 | +| --- | --- | +| 资源身份 | 景区、机巢、无人机稳定 ID;与当前点/航线或任务的关联 | +| 连接与占用 | 已连接/断开/未知;空闲/本订单任务占用/其他任务占用/未知;能否接新任务 | +| 执行许可 | `can_summon` 及结构化阻断原因、可展示说明;状态的更新时间/有效性 | +| 电量 | 数值、百分比单位、测量时间;未知为 `null`,不是 0 | +| 环境温度、风速、雨量 | 各自数值/状态、单位、测量时间及有效性;雨量是强度、累计值还是分级必须明确 | +| 信号、搜星 | 信号强度/级别的语义与单位;卫星数量/定位质量等实际字段含义及有效性 | +| 飞行状态 | 地面、前往、待命/到达、拍摄飞行、悬停、返航、降落/回巢、未知等实际可上报值 | + +设备低电量阈值、回巢后检查/充电是否可再次执行,由设备或后端提供许可,App 不按原型 18% 等样例自行判定。连接成功不代表资源空闲,回巢也不必然代表马上可召唤。 + +**A 占用时 B 可以准备,但 B 召唤被禁止。** 可以只向 B 返回“其他任务占用”,不必暴露其他游客或无权查看的任务详情。占用针对哪一架设备/资源池必须明确,不默认把整个景区锁死;本版不新增排队或自动起飞。 + +### A09 创建并召唤拍摄任务 + +**请求:**`order_id`、`point_id`、`route_id`、关联配置版本、必要的资源/景区上下文、定位及其时效信息、唯一 `client_request_id`。目标设备是否由 App 指定按 A07 约定。 + +**最小响应:**`client_request_id`、是否已建立任务、`task_id`、召唤 `command_id`、服务受理结果、设备执行确认状态、拒绝原因、可查询的任务快照引用。 + +必备契约: + +1. 权威端原子校验订单权限、剩余次数、点位航线、范围、连接、设备许可与资源占用;两个同时到达的召唤不能都占用同一设备。**同一订单已有未结束或待确认任务时,跨端、换请求号或换目标设备也不能另建任务,应返回原 `task_id` 与当前状态供恢复。** App 置灰不足以防并发。 +2. 相同请求标识的传输重试只恢复同一任务/召唤,不重新创建或重复执行;参数冲突明确拒绝。 +3. 受理不是已经起飞。设备是否开始前往需要确认;请求处理中或超时未知时均不扣次。 +4. 支持按原请求标识找回任务与召唤指令;查询需能区分处理中、已建立、明确未建立。一次“查无数据”不能在缺少一致性保证时直接当作未执行并再次召唤。 +5. 明确失败且确认原任务不会继续执行后,重新准备、人工再确认才是新的尝试,使用新的请求标识;失败页不能自动重召。 + +资源占用何时释放、失败仍在空中如何保持占用、设备回巢后多久可执行由权威端处理,不能由 App 离页或失败弹窗关闭来释放。 + +### A10 当前任务与任务详情快照 + +**查询:**按 `task_id`;按当前用户/景区找回未结束任务;召唤结果未知时按原 `client_request_id` 找回。可以合并到少量查询接口,但需要覆盖上述恢复入口。 + +**最小快照:** + +- 身份:任务、订单、景区、机巢/无人机、点位、航线 ID。 +- 任务阶段、飞行状态、拍摄结果分别返回;包含暂停前阶段/恢复目标阶段、保护性返航原因、明确失败原因。 +- `execution_ended` 等任务执行是否结束的明确标识;不能用拍摄成功或次数为 0 推断飞行结束。 +- 当前指令及状态、允许的开始/暂停/恢复/返航操作、各禁用原因。允许操作以权威能力为准。 +- 订单和点位的权威成功次数/剩余次数、结算状态、成功拍摄记录 ID、素材汇总。 +- 状态版本、更新时间;遥测另带采样时效。旧快照/事件不能覆盖新结果。 + +任务标签至少需要足够信息映射:**前往拍摄点中、已到达,待拍摄、拍摄中、拍摄已暂停、返航中、返航已暂停、任务状态待确认**。中文文案由 App 映射,不要求后端把这七句作为实际协议枚举。 + +必须同时支持“成功仍返航”“失败仍返航”“返航暂停”“保护性返航但拍摄结果待确认”。`task_id` 的可访问期要覆盖返航、任务结束后的结果与素材查询,不因订单刚归为已完成就失效。 + +### A11 指令提交与执行结果查询 + +开始拍摄、紧急暂停、恢复、立即返航可以共用一个指令提交接口,也可以分开;召唤虽在 A09 建任务,同样适用以下结果语义。 + +**提交请求:**`task_id`、操作类型、`client_request_id`,以及协议需要的任务/状态版本。**返回:**`command_id`、原请求标识、是否受理、当前状态、拒绝原因、对应任务版本。 + +**查询:**按 `command_id`,或在返回丢失时按原请求标识查询;返回受理时间、设备确认时间、执行状态、失败/拒绝原因、当前任务状态引用。 + +| 指令状态语义 | App 行为 | +| --- | --- | +| 服务受理/等待设备确认 | 显示处理中、防重复提交;不能提前显示已开始/已暂停 | +| 设备确认生效 | 按设备确认后的任务阶段更新;只有到达确认后才允许开始 | +| 明确拒绝/执行失败 | 展示原因并同步原任务;不自动判定整次拍摄失败 | +| 当前无法确认结果 | 显示待确认,查询原指令/任务,不换请求号盲目重发 | + +紧急暂停、立即返航点击后均直接提交,不做二次确认;设备确认前分别显示“暂停处理中”“返航指令处理中”。恢复必须回到实际暂停前的阶段,尤其返航暂停恢复后继续返航,不能默认重新开始拍摄。并发指令如何仲裁、暂停/返航的实际支持阶段由设备方提供,App 读取能力而不是自行允许所有操作。 + +### A12 状态同步通道 + +需要持续更新支付、订单次数、任务/指令、设备遥测、原素材,以及成片登记/整单清单版本、游客查看/反馈/确认状态,但**不强制每类都新增推送主题**:后端可以提供事件通知后拉快照、完整事件、SDK 回调或约定轮询。需说明每类的来源、更新时效、查询频率限制与降级方式。确认事件需带订单、会话、清单版本及记录引用,旧会话回执不能把新增作品标为已确认。 + +- 事件至少能定位景区、资源、任务/订单,带事件 ID 或版本、发生时间;订阅鉴权按用户可见范围执行。 +- 需要有去重/乱序处理约定,切景区后原景区回包不能覆盖新景区界面。 +- 重连/回前台/重进任务先取权威快照;可以全量同步,不强制建设完整事件重放服务。 +- 退出页面、切后台、取消订阅和切景区只是停止当前 App 的展示订阅,不能被当成取消任务。 +- 手机网络是 App 本地状态;控制连接、图传和遥测时效分别表达。手机离线后不能把缓存读数继续称为实时。 + +### A13 图传接入与重连 + +由后端/设备方给出:拉流协议或 SDK、会话创建方式、与任务/无人机的绑定、鉴权材料、有效期、续期与重连方法、流不存在/未就绪/不可用的原因。若用 URL,明确地址和必要请求头;若用 SDK,提供版本、集成文档及测试环境。 + +图传会话标识需防止把上次任务画面误当成本次实时画面。**单独重连图传不能创建任务、重发飞控指令或改变拍摄结果**;画面断流但控制正常是合法组合。现有人工直播 `push_url` 不足以证明具备无人机实时拉流能力。 + +## 6. 次数结算:后端必须统一处理的规则 + +本节是 A06/A09/A10 的共同契约,**不建议给 App 新增“扣一次”“标记拍摄成功”的接口**。 + +- 仅权威确认本次拍摄成功后扣一次;准备、召唤、前往、页面返回、失败、结果未知、控制重试、原素材/空镜下载、成片上传/重试/反馈/确认均不扣。 +- 同一次成功有唯一记录/结算标识;设备重复回调、事件重复、App 重查、多端查看只结算一次。 +- 后端负责并发额度检查及必要的内部执行占用。App 显示的剩余次数仍遵守“成功才扣”,不能在起飞时自行减一。 +- 订单总成功次数、剩余次数和该点累计成功次数分别提供;同点不同航线均计入同一点,重复拍同点合法。 +- 结果与次数结算不能产生无法解释的矛盾快照。若确有结算处理中/待核查,明确返回并让 App 查询,不让 App 根据动画补扣。 +- 部分拍摄、中途返航、保护性返航、任务中断如何认定成功/失败,以及结果迟到时怎样结算,由后端与设备共同提供判据。App 不根据“有几段视频”推断扣次。 +- 设备释放与次数用完独立:最后一次成功可以剩余 0、订单已完成,但设备仍在返航且占用中。 + +## 7. 素材清单、预览与下载 + +### A14 按订单查询拍摄记录及素材状态 + +**请求:**`order_id`、景区上下文,可选本次 `shoot_record_id`/`task_id`、点位筛选、分页游标。服务端校验用户对订单的可见权限,剩余次数为 0 不能成为禁止获取历史素材的理由。 + +**最小响应:** + +- 顶层:是否仍等待生成/文件清单、上传汇总、就绪/上传中/失败数量、版本/更新时间、分页信息。 +- 拍摄记录:稳定 `shoot_record_id`、关联 `task_id`、拍摄时间、点位 ID/名称、航线 ID/名称。按最新拍摄记录在前,同一点重复拍摄保留各次记录。 +- 文件:稳定 `material_id`、内容版本或文件标识、所属记录、文件名、媒体类型、大小、视频时长(适用时)、缩略图、上传状态、`can_preview`/`can_download`、不可用原因。 +- 状态至少能区分待生成/清单未到、上传中、就绪、上传失败、不可用。进度只有真实可得时才返回,不要求模拟百分比。 + +明确分组分页规则,避免同一拍摄记录跨页造成重复计数/错组。媒体类型字典单独提供:当前素材管理与云盘的图片/视频数字枚举不同,不能复用一个 `type` 数字猜含义。 + +列表暂时为空但仍在生成/上传时,要能显示“等待素材/上传中”,不能与确实没有素材共用语义。部分就绪时,就绪项先预览下载;上传中、失败或不可用项不纳入可下载“全选”。订单履约完成不等待上传完成。 + +### A15 获取/刷新预览与下载地址 + +可以在 A14 返回,失效后按 `material_id` 刷新;也可以提供批量授权地址接口,不要求业务后端转发文件字节。 + +需要返回原文件下载地址、预览地址(如不同)、必要请求头、有效期/到期时间、文件名、MIME/媒体类型、大小和内容版本。地址按用户权限和稳定素材 ID 获取,不由 App 任意提交 OSS key 换取权限。 + +区分链接过期、文件被删/不可用、权限撤销;继续下载/重试时可刷新地址。长期地址则明确是否有鉴权及失效条件。建议结合服务端时间避免设备时钟偏差。 + +本版是**前台下载方案**:后台/锁屏暂停,回页面手动继续,已保存的不重复下载,未完成单文件允许从头下载。无需为此要求 Range、字节断点续传、后台下载服务或服务端下载会话。 + +### A16 条件项:重试原拍摄素材上传 + +原型有此按钮,但最终失败处理与设备能力未确定。若保留: + +- 按订单、拍摄记录、素材/原上传任务 ID、幂等请求标识请求重试。 +- 返回是否接受、原上传任务、当前状态、失败原因、可否重试及不可重试原因。 +- 只重试原机巢/无人机到云端的明确失败项;已成功文件不重复上传,不生成新拍摄、不扣次、不生成重复素材。 +- 源文件不存在等无法恢复情况需明确反馈及支持处理方式,不能一直显示可重试。 + +现有 `media-album/upload`、`travel-album/upload-material`、`cloud-driver/file-upload` 是 App 文件发布/登记能力,不等于重试机巢上传。A16 不增加手机替机巢补传原素材的功能;工作人员从手机上传剪辑成片属于 A17–A22 的独立交付链路。 + +## 8. 剪辑成片交付、整单核对与游客确认 + +以下能力承接已搭建的本地交付 UI 与产品原型流程,**不代表真实上传、游客网页、身份校验或收货凭据已经接通,也不代表字段和协议已与后端定稿**。接口名称与字段为对接建议,可复用现有文件上传基础服务,但需补齐订单、点位、作品及确认关系。成片与 A14 的原拍摄素材分别建模;上传、交付、反馈和确认不扣拍摄次数,不改变拍摄订单的 Tab 归类。 + +### A17 成片上传授权与作品登记 + +**调用:**选择云端交付、点位和一个或多个视频后,为本批成片获取上传能力;上传结束后确认作品登记结果。 + +**建议请求:**`order_id`、`point_id`、`client_request_id`,以及各文件的客户端稳定标识、文件名、媒体类型、大小、时长和校验信息。用户身份由登录凭证确定;服务端校验订单可访问、点位归属及上传权限,不能用剩余次数为 0 拒绝合法交付。 + +**需要返回或明确:** + +- `delivery_batch_id`、各 `delivery_item_id`,文件限制和上传方式;若复用 OSS,提供最小范围临时凭证/签名地址、必要参数、有效期和刷新方法。 +- 文件字节已上传后,如何登记为可展示的 `work_id`;可以由回调自动完成,也可由 App 提交完成信息,但登记必须幂等并可查询。服务端应核对对象归属及完整性,不能只相信 App 声称成功。 +- 分开表达文件上传中、等待登记/处理中、可交付作品就绪、明确失败/不可用。原型的“已交付”需对应服务端可查、可播放的成功作品,不能仅根据上传进度达到 100% 判断。 +- 相同请求或完成回执重复到达只登记一次;请求超时可按原请求/项目标识恢复,不盲目新建作品。内容相同是否允许主动再次交付需明确,不强制按文件名或全局哈希去重。 + +本批绑定一个点位,开始后不改变文件归属。上传进度来自实际传输,业务登记状态来自服务端。授权过期与文件上传失败分别处理;失败重试不应要求成功作品重新上传。 + +### A18 成片批次、逐项结果与恢复查询 + +**请求:**按 `delivery_batch_id` 查询;创建结果未知时支持按原 `client_request_id` 查回。按订单查询待处理批次的入口可并入 A19。 + +**最小响应:**批次/订单/点位 ID、逐项 ID 与文件元信息、上传/登记结果、成功后的 `work_id`、失败原因及可否重试、版本/更新时间;如由服务端处理转码等步骤,需给出可查询状态及终态。 + +契约要求: + +- 返回逐项结果,支持本批全部成功、部分成功/失败及仍有处理中项;已成功作品在查询、刷新和重试后保持稳定身份,不重复计入整单。 +- 明确失败项可重试;结果暂未知的项目先查询原对象。重试上传、重新申请凭证和重新登记应区分,不能将已上传但登记待确认的文件一律重传。 +- App 关闭/重进、网络恢复后可以核对已存在的批次与作品;跨账号、景区、订单回包不得串用。 +- 当前本地 UI 采用前台上传演示、离页/后台暂停及手动继续。真实对接需确认其传输策略;暂停进度属于 App 本地任务状态,服务端不用因此新增通用暂停/继续接口,也不强制支持字节断点续传。App 已关闭并不撤销已经登记的作品。 + +“继续上传成片”是新批次;清理本地未完成队列不等于删除已经登记的作品。若未来需要删除云端作品,另行明确权限与对确认记录的影响,不隐含增加删除功能。 + +### A19 整单成片清单与交付摘要 + +**请求:**`order_id`;支持全部点位汇总,按点位筛选/分页可按页面规模约定。不能只返回当前批次或最后一次拍摄记录。 + +**最小响应:** + +- 跨点位、跨批次的全部成功作品;每项含稳定 `work_id`、点位 ID/名称、批次引用、上传/登记时间、封面、视频时长、大小及预览访问方式。 +- 整单作品总数、覆盖点位数、仍待处理/失败项摘要、清单版本 `manifest_version`;明确分页与统计口径,避免漏项或重复计数。 +- 商家是否可以发起核对/确认、阻断原因,以及当前确认会话和历史确认记录引用。需区分“有已交付作品”“商家核对交齐”“游客已确认”。 + +预览授权可复用 A15 的文件访问基础能力,但须按成片作品及其确认快照校验权限。原素材、手机已保存和成片已交付是不同数据,不能通过重命名同一个状态相互转换。 + +**建议契约:**商家核对与发起确认时携带当前清单版本;如果查询后又有作品追加/移除/变为不可用,服务端返回版本冲突和最新清单,要求重新核对。是否存在必须先处理完的上传批次,以及失败项目如何明确放弃,由产品与后端给出可解释的阻断规则;不以“当前屏幕没看到失败项”推断整单已交齐。 + +### A20 创建/恢复整单确认会话与查询状态 + +**调用:**商家查看整单成片并勾选“已全部交齐”后展示确认码;刷新、返回后重进或网络恢复时查询原会话。 + +**建议创建请求:**`order_id`、核对的 `manifest_version`、商家核对标识、`client_request_id`。确认范围应由服务端根据版本冻结,不能由 App 任意提交少量作品冒充整单。 + +**最小响应:**`confirmation_session_id`、冻结的清单版本/范围、游客访问链接或二维码载荷、状态、服务端时间;有效期、失效/撤销条件及能否重新生成需明确。恢复查询支持会话 ID,创建超时支持按原请求标识找回。 + +状态应足够表达等待游客、游客查看中、收到反馈、已确认,以及适用的失效/作废;返回查看时间、反馈引用、确认记录引用和版本。扫码或查看仅更新访问事实,**刷新按钮只查询,不触发游客确认**。 + +最新原型在反馈后提供“处理后重新核对交付”:点击后清空商家交齐勾选,重新核对后才能展示确认码。对应接口需返回是否允许重新核对/重开会话及阻断原因;若支持重开,建议请求携带原 `confirmation_session_id`、相关 `feedback_id`、最新清单版本与幂等标识,新会话保留原会话和反馈关联。重新核对或重开会话不等于游客撤回反馈,也不能自动将全部问题标为已解决。 + +**建议契约:**确认必须绑定固定作品快照。新增作品后,当前核对与旧待确认会话失效,工作人员重新核对并创建新会话;已完成的历史确认记录保留原范围。该规则与当前本地 UI 一致,但需后端确认版本仲裁和迟到回执处理,不能直接认定已存在此协议。有效期也不得照搬本地演示或由 App 自行设定。 + +### A21 游客访问、主动确认与问题反馈 + +此项由游客网页/游客端与后端配套提供,商家 App 只展示码并查询结果,不由商家 App 替游客提交确认。 + +需要提供以下能力,可拆分或合并端点: + +- 通过确认链接访问会话并完成约定的游客身份/访问资格校验,获取该会话固定范围的成片清单及授权预览;失效、无权、清单不可用时给出明确结果。 +- 游客查看清单、勾选已收到全部后主动确认。请求绑定会话及清单版本,具备幂等标识;服务端验证仍可确认并生成稳定确认记录。重复提交返回同一结果,超时后能查询,不能生成多份互相矛盾的记录。 +- 提交视频缺失、无法播放、成片效果有异议、其他问题四类反馈,并可填写补充说明。建议请求包含会话、问题类型、适用的作品引用和补充说明;返回稳定 `feedback_id`、关联会话/清单版本、提交时间、约定可展示的提交人、问题类型与说明、适用作品范围、处理状态及更新时间。提交反馈不等于确认收货。 + +反馈记录应可被商家重新查询,并在“处理后重新核对交付”后保留;若已有处理记录,明确处理人、时间、说明及与后续会话的关联。处理状态及状态转换由后端给出字典,不能把点击重新核对、创建新码或游客再次查看自动记录为解决反馈。原型能证明重新核对入口和反馈留存需求,不能证明后台已实现完整的问题处理状态流。 + +游客身份机制、码能否转发/重复打开、同会话多端确认、反馈后能否继续确认及商家如何处理反馈,均需产品与后端明确。文档只要求能支撑当前可见流程,不假定必须注册 App、发送短信或建设额外客服工单系统。 + +### A22 查询历史确认记录与当时作品快照 + +**请求:**`order_id` 查询历史记录,按 `confirmation_record_id` 查询详情;可合并在 A19/A20 响应中,但必须能查看历史已确认范围。 + +**最小响应:**稳定记录 ID、订单/景区、对应会话与清单版本、确认时间、约定可展示的确认人、工作人员身份、点位/成片数量、确认时作品清单、确认声明原文及版本。作品应保留稳定 ID 与当时的名称/归属等展示快照;历史预览须限定该快照,不混入后续新增作品。声明使用确认当时的内容,不以后续修改后的文案覆盖历史。 + +- 已确认记录不可被后续上传或清单变化覆盖;后续再次确认形成新的记录及范围,旧记录仍可查询。 +- 区分“历史范围已确认”与“当前整单仍有新增作品待确认”,订单卡不能只凭曾经存在确认记录就永久显示全部已确认。 +- 作品文件后来不可用时保留确认记录并明确标记预览不可用,不虚构可播放状态。记录保留期、访问授权和实际凭据效力由配套业务契约明确;本地演示记录不能迁移成真实游客收货凭证。 + +## 9. 景区空镜库:独立首页模块 + +2026-10-26 原型的工作台左上角设有“景区空镜库”体验入口,进入后标题为“景区素材”。用户随后明确:正式 App 中这是与机巢工作台并列的独立模块,后续在首页单独配置入口;原型位置仅用于体验,不作为正式页面层级依据。本次实测了航线筛选无结果与重置、时间筛选面板、视频预览、整组六段选择(含折叠第六段)、部分下载失败后重试成功、相册权限提示。**时间面板已查看,但未逐个日期组合验证;90 天是原型展示规则,正式保留策略需后端确认。** + +### A23 景区空镜列表、筛选条件与保留期 + +**入口与权限:**复用现有首页权限配置机制,后续提供独立菜单 URI/权限标识;按当前 App 机制在匹配角色的 `role.permission` 顶层返回。具体值待配置,不新增占位代码,也不将 `drone_dock` 权限当作空镜访问资格。应支持“仅有空镜权限”“仅有机巢权限”“两者都有”的账号;服务端仍分别校验各模块的景区数据范围。 + +**请求:**`scenic_id`、可选航线 ID、拍摄起止日期/时间、分页游标。身份和景区可见范围从登录权限校验,不要求关联游客 `order_id`;“景区公共素材”不代表匿名公开文件。 + +景区上下文可使用 App 已有景区选择能力,不需要先调用 A01 工作台初始化或查询其订单/设备。无当前景区或无访问权限时提供明确结果,由本模块完成必要选择或提示。 + +**最小响应:** + +- 当前景区及可用的空镜航线列表:稳定 `route_id`、显示名称与有效性。原型航线名称可由多个地标串联组成,不等于游客准备页某个点位下的航线;两个航线域是否共用 ID 必须明确。 +- 保留策略:如 `retention_days`、可查询最早时间、服务端当前时间、时区与到期计算规则;建议各素材/组返回 `expires_at`。原型为“保留 90 天”,不能把演示的 10 月 23 日当实际系统当天。 +- 分组标识:景区、航线、稳定拍摄批次/组 ID、拍摄时间、组内总段数。展示按航线分区、每条航线下按拍摄时间倒序;相同航线同一时刻也应以稳定 ID 区分,不靠文案拼主键。 +- 逐段元数据:稳定 `scenic_material_id`/内容版本、所属组、片段序号、封面、媒体类型、时长、分辨率(如 4K)、字节大小、可预览/可下载、不可用原因、有效期。数值和单位可机读,不只返回拼好的“178MB”。 +- 组内段列表是否完整、组总数/可下载数、是否还有更多片段;列表是否还有更多组、下一游标、当前筛选总数。建议区分景区全库 `has_any_materials`/`library_total_count` 与 `filtered_total_count`;数量需说明是组数还是片段数。若不返回全库标记,约定通过无筛选查询区分全库为空与筛选无结果。不能把只返回的前五段误称为全组。 + +**筛选与分页契约:** + +1. “全部航线/全部时间”如何编码、起止日期是否含端点、按哪个时区和拍摄时间字段筛选必须明确。无效日期、开始晚于结束、超出保留期/未来日期不得静默返回含义不明的数据。 +2. 原型时间面板只展示保留期内已到来的日期;以服务端时间和实际保留策略约束,不要求新增服务端日期选择状态接口。 +3. 区分景区无任何素材、筛选无结果、请求失败/无权限;空列表可由返回的总数和筛选条件表达,无需造一组业务数字枚举。 +4. “选择本组”覆盖整组的可下载片段,包括 UI 折叠部分。本次 6 段组实测选中数量为 6;如果服务端分页组内文件,需能获取完整可选 ID 集合/逐页遍历并明确完成标记,不能只选已加载五段。 +5. 新素材入库、保留期滚动与下架可能改变结果;返回稳定排序与游标/快照版本约定,避免翻页重复/遗漏。是否需要主动更新通知可按规模选择,不强制实时推送。 + +### A24 景区空镜预览与批量下载授权 + +**请求:**景区上下文、明确选中的空镜素材 ID 与内容版本(支持单项/批量);不能使用游客订单 ID 冒充权限,也不能任意提交 OSS key 换授权。 + +**最小响应:**每项稳定 ID、可访问状态、预览/原文件下载地址、必需请求头、有效期、MIME、文件名、大小与内容版本;批量中失效/无权/已过保留期的项逐项返回原因,其他有效项仍可下载。若统一文件授权服务可区分来源与权限,可复用 A15,不强制新增重复 URL。 + +需明确: + +- 列表加载后、下载前刚到期,以及下载途中签名失效时的规则:按原 ID 刷新授权;文件已真正过保留期/被移除则明确不可恢复,不能无限重试。 +- 保留到期与访问 URL 到期是两件事。需要约定已发放授权能否在文件到期后继续完成、过期如何处理;本轮原型未验证实际删除或访问失效。 +- 批量只对选中且仍有权限的文件授权;成功项不重复下载,失败项可单独重新授权。预览不增加拍摄次数,不创建订单或拍摄任务。 +- 本机选择、下载进度、取消/继续选择、重试失败、相册权限及保存结果属于 App。原型“已下载/下载成功”为演示,不是后端全局 `is_downloaded`;本机记录建议按账号+景区+空镜 ID+版本隔离。 + +空镜下载可复用已确认的前台下载方式;本轮不新增后台传输、自动补拍、空镜上传/删除管理、跨景区搜索或自动把空镜交付给游客的功能。若剪辑后作为成片交付,仍经 A17 的订单+点位上传链路,不擅自绑定原空镜为游客作品。 + +## 10. 建议的统一状态模型与响应示例 + +以下字段名和字符串只是**对接建议**,用于证明需要表达的组合,不是已约定协议。后端可以采用其他命名/枚举,但应提供完整字典、空值和兼容规则。 + +| 维度 | 最少需要区分的语义 | 不能替代的状态 | +| --- | --- | --- | +| 订单履约 | 待拍摄、进行中、已完成 | 不等于设备是否正在飞 | +| 飞行/任务阶段 | 前往、已到达待拍、拍摄、暂停及暂停前阶段、返航、执行结束、未知 | 不等于拍摄结果 | +| 拍摄结果 | 尚未产生、待确认、成功、失败/中断及其判据 | 不等于返航或上传完成 | +| 指令执行 | 已受理待确认、已确认、拒绝/失败、无法确认 | 不等于 HTTP 请求成功/失败 | +| 次数结算 | 未结算、确认中/待核查、已结算及权威次数 | 不靠 App 本地计数推断 | +| 素材上传 | 待生成、上传中、部分/全部就绪、失败/不可用 | 不等于 App 下载/保存 | +| 成片上传与登记 | 未开始、上传中、等待登记/处理中、作品就绪、失败/不可用;批次可部分成功 | 不等于原素材上传或游客已收到;暂停是本地传输状态 | +| 整单核对 | 未核对、已核对指定清单版本、清单变化需重核对 | 单批成功不表示整单交齐 | +| 游客确认会话 | 等待、查看中、收到反馈、已确认;失效/作废条件待约定 | 扫码/刷新不等于确认;历史已确认不等于新增作品已确认 | +| 景区空镜可用性 | 可预览/下载、过保留期、文件不可用、无权限;列表无数据与筛选无结果分开 | 不用订单履约/拍摄次数判断可用性 | +| 本机传输与保存 | 已选择、下载中、已暂停、下载失败、待保存、保存失败、已保存 | App 本地维度;不要求服务端维护每台手机相册状态 | + +示例:**最后一次拍摄成功、订单 0 次、仍返航、素材上传中**的查询数据可以如下表达: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": "task_example_01", + "order_id": "order_example_01", + "scenic_id": "scenic_example", + "dock_id": "dock_example", + "drone_id": "drone_example", + "point_id": "point_example", + "route_id": "route_example", + "state_version": 28, + "updated_at": "2026-10-22T10:00:00+08:00", + "phase": "returning", + "flight_state": "returning", + "paused_from_phase": null, + "execution_ended": false, + "shoot_result": "success", + "shoot_record_id": "record_example_01", + "settlement_state": "settled", + "order_summary": { + "fulfillment_state": "completed", + "total_count": 1, + "success_count": 1, + "remaining_count": 0, + "point_success_count": 1, + "version": 9 + }, + "device": { + "occupied": true, + "can_accept_new_task": false, + "control_connection": "connected", + "battery": { + "value": 67, + "unit": "%", + "measured_at": "2026-10-22T09:59:59+08:00", + "valid": true + }, + "wind_speed": { + "value": null, + "unit": "m/s", + "measured_at": null, + "valid": false + } + }, + "pending_command": null, + "action_permissions": { + "start": { "allowed": false, "reason": "shooting_finished" }, + "pause": { "allowed": true, "reason": null }, + "resume": { "allowed": false, "reason": "not_paused" }, + "return": { "allowed": false, "reason": "already_returning" } + }, + "materials_summary": { + "state": "uploading", + "ready_count": 0, + "uploading_count": 3 + } + } +} +``` + +示例仅省略了其余遥测等字段;`action_permissions` 的值由设备实际能力决定,不代表所有设备返航时都允许暂停。上述数据意味着首页移除订单,“已完成”卡片仍可看原任务及素材,不能显示设备空闲或继续拍摄。 + +## 11. 公共接口契约与异常恢复 + +### 11.1 与现有网络层对齐 + +- 现有环境:测试 `https://api-test.zhifly.cn`,生产 `https://api.zhifly.cn`,见 [APIEnvironment.swift](../../suixinkan/Core/Networking/APIEnvironment.swift)。新能力如使用其他域名/设备云,需明确环境和登录/授权方式。 +- 当前 App 普通业务请求使用 `token` 请求头,并携带 `X-APP-VERSION`、`X-OS-TYPE`,见 [APIClient.swift:223](../../suixinkan/Core/Networking/APIClient.swift#L223)。不能默认已经采用 Bearer 或同一凭证可直接访问设备云。 +- 当前统一包裹是 `{code,msg,data}`,业务成功码为 `100000`,见 [APIEnvelope.swift](../../suixinkan/Core/Networking/APIEnvelope.swift#L8)。 +- 当前解码器在业务失败码下会丢弃 `data`。若冲突/拒绝响应需要返回原 `task_id`/`command_id` 供恢复,需明确可解析契约:例如成功包裹内表达“已处理的业务拒绝”,或扩展错误数据模型;不能只把关键标识塞进现有不可读的错误 `data`。 +- 设备确认可能长于普通 HTTP 超时,需要可查询的任务/指令 ID;不要让一次 HTTP 一直等待整段飞行结束。 +- 统一 ID 类型、时间格式/时区、金额、距离和遥测单位、分页规则、枚举字典、`null` 与缺字段语义;未知枚举要能进入待确认并重新同步。 + +### 11.2 幂等与版本 + +收款单、召唤、控制指令、成片批次/作品登记、确认会话、游客确认/反馈的 `client_request_id`:同一次意图的传输重试沿用原值;已明确结束后人工发起的新尝试使用新值。后端需约定作用域、保留/查询时间和参数冲突处理,恢复窗口应覆盖 App 被杀后重进的情况。 + +订单、任务、素材、成片清单、确认会话各自可以有版本;跨对象响应需说明一致性关系,不要求用一个全局版本。成功结果、次数和任务引用的更新应可核对;旧请求晚返回或重复事件不能把已成功/已结算覆盖成旧状态。若操作携带预期版本,需明确哪些不兼容变化会拒绝、如何返回最新状态。成片新增与游客确认并发时,以服务端版本仲裁;不能让旧码确认覆盖未核对的新作品,也不能改写历史确认范围。 + +### 11.3 错误类别与后续动作 + +下面是需要表达的错误语义,**不是分配好的数字错误码**。请后端给出实际编码、可展示文案、能否重试和应重新查询的对象。 + +| 错误/状态类别 | App 需要的恢复信息 | +| --- | --- | +| 无权限、景区/订单不匹配、归属发生变化 | 明确不可访问或操作受限;停止展示无权数据,刷新上下文;不让 App 处理重新派单 | +| 套餐下架/版本或成交价不合法 | 刷新套餐和报价;不能沿用旧快照显示新码 | +| 收款码失效/生成失败 | 收款单与交易的真实状态、能否重新生成;先排除已到账 | +| 已到账但订单生成中 | 保留支付成功及可恢复标识,查询订单生成结果 | +| 次数已用完/订单不可再拍 | 最新权威次数/状态,刷新列表;已有素材/未结束任务仍按权限可查 | +| 点位航线失效、位置未知/过期、范围外 | 具体失效项或原因,重新选择/重新定位;不能一律显示设备故障 | +| 设备占用、未连接、状态未知、设备禁止执行 | 当前资源、禁用原因及刷新方式;B 可继续选点线但不能排队自动起飞 | +| 指令阶段不允许、已有指令处理中 | 当前任务/指令引用与状态;不创建替代任务 | +| 传输超时、执行结果暂不能确认 | 按原请求/任务/指令查询;不能直接当成明确失败重发 | +| 图传不可用/凭证过期 | 重连或续期方式,保持任务与控制状态独立 | +| 素材链接过期/文件不可用/上传失败 | 分别刷新授权地址、标不可用、或按能力重试原上传 | +| 成片上传授权到期/字节已上传但登记结果未知 | 续期或查询原项目的登记状态;不能统一清空批次重传 | +| 成片清单版本变化/存在未完成批次 | 返回最新清单、待处理项及核对阻断原因,重新核对而非静默出旧码 | +| 确认会话失效、游客无权、旧会话回执迟到 | 返回适当失效原因与当前会话引用;不自动确认新作品 | +| 游客反馈后再次核对/确认 | 保留反馈与历史记录,按允许动作重开;不以重开会话隐式消除反馈 | +| 空镜超保留期/被下架/筛选条件失效 | 重新查询有效清单;无法恢复的项不循环重试;批量中的其他可用项独立处理 | + +长时间无法确认任务/指令/结果时,后端还需提供可定位原请求的排查信息和支持处理方式,不能无限展示加载或通过再创建任务“解锁”。 + +## 12. 无需因此新增的后端接口 + +以下由 App 本地处理,不作为本期后端新能力清单: + +- 页面返回、Tab 切换、卡片置顶呈现、支付成功后去待拍摄 Tab。 +- 点位航线的临时选择与有效选择恢复(仍需服务端校验最新配置)。 +- 二维码绘制/保存、到账语音开关、相册权限引导。 +- 素材选择/全选、前台下载暂停/手动继续、仅重试未完成项、逐项保存结果、存储不足和写入相册失败。 +- 本设备“已保存”记录。订单原素材按账号/订单/素材 ID 及内容版本识别,景区空镜按账号/景区/空镜 ID 及版本识别,不能由后端单一全局 `is_downloaded` 代表所有手机都已保存。 +- 空镜组折叠/展开、选择高亮、日期选择器临时状态;但完整组清单、筛选查询和授权仍须 A23–A24 支持。 +- 成片传输本地进度和前台暂停/继续;作品登记、会话状态和游客确认记录仍需服务端持久化,不能归入纯本地状态。 + +已有云盘代码区分文件下载与相册保存:见 [CloudTransferWorkers.swift](../../suixinkan/Features/CloudDrive/Services/CloudTransferWorkers.swift#L35)、[CloudTransferManager.swift](../../suixinkan/Features/CloudDrive/Services/CloudTransferManager.swift#L220)。这些只是可参考基础能力,尚不能认定已适配订单素材。 + +**本机下载/保存成功不等于游客已收到成片。** 成片云端交付与游客主动确认现按 A17–A22 对接;面对面闪传仍待产品确定,本轮不增加短信发送、自动分享或局域网中转等接口。 + +## 13. 后端/设备方交付资料与联调顺序 + +建议按以下顺序提供,便于 App 先开发状态模型,再接真实设备: + +1. **先确定契约:**提供每项已有/新增接口映射、URL/方法、字段类型、状态/错误码字典、权限范围;明确设备控制/遥测/图传的责任方与 SDK 或协议,以及成功、部分拍摄和中断的结算判据。 +2. **先跑数据闭环:**A01–A07、A14–A15 的测试数据,覆盖可售/空套餐、待拍/进行中/已完成订单、有效/无航线、混合上传素材;支付侧提供测试渠道与可查询结果。 +3. **再接设备闭环:**A08–A13、一次成功结算与恢复查询,先验证召唤/到达/开始/成功/返航,随后覆盖暂停恢复、拒绝、超时和断线。 +4. **成片交付闭环:**A17–A22,从批次部分成功/失败、业务登记恢复、跨点位整单核对到游客反馈、再次确认和历史快照;先确定游客身份和清单版本契约,再与游客网页联调。 +5. **景区空镜独立闭环:**A23–A24 可独立于机巢工作台对接;验证首页独立入口、模块权限范围、航线筛选、日期边界、组内完整选择、授权过期与保留期边界。与订单素材共用下载基础设施时验证来源隔离。 +6. **收口条件项:**确认 A05 旧记录覆盖方式、A16 重试上传能力、空镜正式保留策略与成片会话失效规则。收款 UI 暂缓不影响先交付契约;闪传未定不作为本轮阻塞项。 + +除接口文档外,还需要测试环境权限/账号、绑定的景区/点位/航线/机巢数据、设备或可控模拟数据、图传测试源,以及可复现下列组合的方法。这里只要求测试和联调能力,不要求把原型的“模拟支付/体验状态”菜单加入正式 App。 + +| 必验组合 | 依赖能力 | 期望结果 | +| --- | --- | --- | +| 更换套餐/成交价后旧码晚到账 | A02–A04、A06 | 套餐、成交价、权益与订单关联明确,不错配、不重复收款建单 | +| 支付成功但订单尚在生成 | A04、A06 | 保留成功事实,能继续查询;成功页按钮仍去待拍摄 Tab | +| A 占用,B 已完成选点线;两端同时召唤 | A07–A09 | B 可准备、禁止召唤;同一设备只接受符合占用规则的一个任务 | +| 同一订单从两端使用不同请求号、选择不同设备召唤 | A07、A09–A10 | 同一订单只建立一个未结束任务,另一端恢复原任务;待确认期间不能绕过 | +| 召唤已执行但 HTTP 超时/App 被杀 | A09–A12 | 找回原任务及指令,不重复召唤、不重复扣次 | +| 暂停待确认/拒绝/晚确认;返航暂停后恢复 | A10–A12 | 不提前显示已暂停,恢复原阶段,失败指令不等于拍摄失败 | +| 最后一次成功+0 次+返航+上传中 | A06、A08、A10、A14 | 首页移除,已完成保留当前任务入口,上传和返航各自继续 | +| 已拍部分、有余次、没有活跃任务 | A06–A08 | 仍属进行中,可重新准备下一次 | +| 拍摄失败但仍返航/设备尚不可执行 | A08–A11 | 保留失败原因,禁止再次召唤;可执行后先回准备页人工确认 | +| 保护返航、拍摄结果迟到;重复/乱序成功事件 | A10–A12、结算契约 | 结果待确认期间不扣;确认成功只结算一次,旧数据不覆盖 | +| 切景区后回原景区/冷启动进工作台 | A01、A06、A10、A12 | 原任务继续且可手动恢复,新旧景区数据不串 | +| 仅画面断流/仅遥测过期/手机整体断网 | A08、A10、A12–A13 | 各维度独立显示;整体离线读数为“—”,恢复先同步 | +| 部分上传就绪+部分上传失败+下载地址过期 | A14–A16 | 就绪项可先选下,过期可刷新;重试不发起拍摄或扣次 | +| 下载后切后台/锁屏/相册写入失败 | A15+App 本地逻辑 | 回页面手动继续,已保存不重下,保存失败不误标已保存 | +| 权限顶层返回/撤销 `drone_dock`;入口可见但无成片操作权 | A01 | 菜单与具体操作分别校验,旧常用缓存不绕过权限 | +| 仅空镜权限/仅机巢权限/两者均有,从首页直接进入 | A01、A23–A24+首页既有权限配置 | 两个入口独立显示与鉴权;空镜查询不依赖工作台初始化、订单或任务;一方撤权不自动决定另一方权限 | +| 0 次订单上传两段成片,一成一败,重试时登记回执丢失 | A06、A17–A19 | 允许合法交付;只恢复失败/未知项,成功作品不重复登记,次数不变 | +| 两个点位多个上传批次后核对整单 | A18–A20 | 清单覆盖所有成功作品,数量及点位统计与版本一致 | +| 已核对后追加成片,旧二维码或旧确认回执迟到 | A19–A22 | 按约定版本仲裁;旧范围不能确认新作品,历史快照不变 | +| 游客扫码/查看/商家刷新但未主动确认 | A20–A21 | 仍待确认,不生成收货记录 | +| 游客反馈缺失后,商家重新核对并再次发码 | A20–A22 | 原反馈保留、勾选重新完成,新旧会话关联;重开不等于解决反馈 | +| 游客确认重复提交/回执超时;确认后再上传 | A19–A22 | 查询同一确认结果;历史范围可查,新增作品不被旧记录覆盖 | +| 空镜全库为空/筛选无结果/请求失败 | A23 | 各自显示明确状态,不把失败当空列表 | +| 空镜组有 6 段但首屏只显示 5 段,跨页全选本组 | A23–A24 | 获取完整合法 ID,选择数与授权范围一致,不漏折叠或未加载项 | +| 空镜日期跨日/90 天边界/授权刚过期/文件已到期 | A23–A24 | 按约定时区与保留期过滤;链接可续期与文件不可恢复分开 | +| 空镜批量一项无权或到期,另一项可用 | A24+App 本地逻辑 | 逐项结果,有效项可继续;成功下载不重复,保存结果由本机确定 | + +## 14. 仍需后端/产品提供的最终契约 + +1. A01–A24 对应的实际接口/SDK、字段和枚举字典;已有能力优先复用。本文的字段名、错误语义和版本机制均为需求建议。 +2. 景区空镜库独立首页入口的实际菜单 URI/权限标识、数据来源与航线 ID 体系、谁可见/可下载、正式保留期及起算点、日期时区、分组分页和过期下载处理;原型的 90 天暂作为对接依据,不能默认为全业务统一政策。 +3. 成片允许格式/大小/时长、上传基础服务与业务登记方式、可交付就绪标准、确认前未完成批次的处理规则。 +4. 游客访问资格/身份校验、确认链接期限、反馈后处理与重开权限、旧会话与新增作品的版本仲裁、确认记录保留期。无需 App 开发者设计后台派单或客服系统。 +5. 飞控指令支持范围、成功/部分拍摄判据、设备释放与次数结算仍按原契约待联调,不因页面可演示而视为完成。 + +本轮只更新接口文档及复核证据。App 已有机巢相关本地 UI,机巢首页入口 `drone_dock` 已适配;景区空镜库的独立首页入口待后续配置和开发。真实机巢接口、上传交付、游客身份与确认、设备及支付均未因此联调验收。没有修改业务代码,也没有提交或 push。 diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/01-http-state-ready.json b/docs/9.9.1/拍摄任务页-v2协议示例/01-http-state-ready.json new file mode 100644 index 0000000..584dfa5 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/01-http-state-ready.json @@ -0,0 +1,60 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + }, + "info": { + "order_number": "261106000001", + "spot_name": "示例拍摄点", + "route_name": "示例航线", + "tourist_label": "游客 158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "cover_url": null + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/02-http-pause-request.json b/docs/9.9.1/拍摄任务页-v2协议示例/02-http-pause-request.json new file mode 100644 index 0000000..31f7b90 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/02-http-pause-request.json @@ -0,0 +1,6 @@ +{ + "task_id": 501, + "request_id": "11111111-1111-4111-8111-111111111111", + "action": "pause", + "expected_execution_id": "execution-001" +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/03-http-pause-accepted.json b/docs/9.9.1/拍摄任务页-v2协议示例/03-http-pause-accepted.json new file mode 100644 index 0000000..44fc007 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/03-http-pause-accepted.json @@ -0,0 +1,34 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + }, + "state": { + "version": 19, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + } + ] + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/04-ws-subscribe.template.json b/docs/9.9.1/拍摄任务页-v2协议示例/04-ws-subscribe.template.json new file mode 100644 index 0000000..130fd21 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/04-ws-subscribe.template.json @@ -0,0 +1,8 @@ +{ + "type": "${V2_SUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "request_id": "subscribe-request-example" + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/05-ws-subscribed.json b/docs/9.9.1/拍摄任务页-v2协议示例/05-ws-subscribed.json new file mode 100644 index 0000000..48bea89 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/05-ws-subscribed.json @@ -0,0 +1,54 @@ +{ + "code": 100000, + "event": "airport_v2.subscribed", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + }, + "request_id": "subscribe-request-example" +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/06-ws-state-returning.json b/docs/9.9.1/拍摄任务页-v2协议示例/06-ws-state-returning.json new file mode 100644 index 0000000..489169e --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/06-ws-state-returning.json @@ -0,0 +1,18 @@ +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 30, + "stage": "returning", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/07-ws-state-completed.json b/docs/9.9.1/拍摄任务页-v2协议示例/07-ws-state-completed.json new file mode 100644 index 0000000..206cfb2 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/07-ws-state-completed.json @@ -0,0 +1,18 @@ +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 31, + "stage": "completed", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/08-ws-state-returned.json b/docs/9.9.1/拍摄任务页-v2协议示例/08-ws-state-returned.json new file mode 100644 index 0000000..a2dc968 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/08-ws-state-returned.json @@ -0,0 +1,18 @@ +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 32, + "stage": "returned", + "paused": false, + "context": null, + "live_version": 2, + "reason": "MANUAL_RETURN", + "operations": [] + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/09-ws-telemetry.json b/docs/9.9.1/拍摄任务页-v2协议示例/09-ws-telemetry.json new file mode 100644 index 0000000..176c6bd --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/09-ws-telemetry.json @@ -0,0 +1,44 @@ +{ + "code": 100000, + "event": "airport_v2.telemetry", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/10-ws-heartbeat.json b/docs/9.9.1/拍摄任务页-v2协议示例/10-ws-heartbeat.json new file mode 100644 index 0000000..1b40c7b --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/10-ws-heartbeat.json @@ -0,0 +1,11 @@ +{ + "code": 100000, + "event": "airport_v2.heartbeat", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state_version": 30, + "telemetry_version": 8 + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/11-http-live-response.json b/docs/9.9.1/拍摄任务页-v2协议示例/11-http-live-response.json new file mode 100644 index 0000000..ee33b16 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/11-http-live-response.json @@ -0,0 +1,24 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "live_version": 2, + "refresh_after": 30, + "sources": { + "airport": { + "available": true, + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_AIRPORT_ROOM", + "user_id": "EXAMPLE_VIEWER_AIRPORT", + "token": "EXAMPLE_RTC_TOKEN", + "expires_in": 2400 + }, + "drone": { + "available": false, + "reason": "DRONE_NOT_READY" + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/12-http-action-unknown.json b/docs/9.9.1/拍摄任务页-v2协议示例/12-http-action-unknown.json new file mode 100644 index 0000000..c8cadfb --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/12-http-action-unknown.json @@ -0,0 +1,40 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + }, + "state": { + "version": 21, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + } + ] + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/13-http-execution-changed.json b/docs/9.9.1/拍摄任务页-v2协议示例/13-http-execution-changed.json new file mode 100644 index 0000000..5c0c371 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/13-http-execution-changed.json @@ -0,0 +1,6 @@ +{ + "code": 100099, + "msg": "当前执行已变化,请刷新后重试", + "error_code": "EXECUTION_CHANGED", + "data": null +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/14-http-summon-response.json b/docs/9.9.1/拍摄任务页-v2协议示例/14-http-summon-response.json new file mode 100644 index 0000000..ef42c65 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/14-http-summon-response.json @@ -0,0 +1,36 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-002", + "operation": { + "request_id": "55555555-5555-4555-8555-555555555555", + "execution_id": "execution-001", + "action": "summon", + "status": "pending", + "version": 1, + "error": null, + "new_execution_id": "execution-002" + }, + "state": { + "version": 33, + "stage": "travelling", + "paused": false, + "context": null, + "live_version": 3, + "reason": null, + "operations": [ + { + "request_id": "55555555-5555-4555-8555-555555555555", + "execution_id": "execution-001", + "action": "summon", + "status": "pending", + "version": 1, + "error": null, + "new_execution_id": "execution-002" + } + ] + } + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/15-ws-unsubscribe.template.json b/docs/9.9.1/拍摄任务页-v2协议示例/15-ws-unsubscribe.template.json new file mode 100644 index 0000000..5ab995d --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/15-ws-unsubscribe.template.json @@ -0,0 +1,7 @@ +{ + "type": "${V2_UNSUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "subscription_id": "subscription-example-001" + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/16-http-first-summon-rejected-query.json b/docs/9.9.1/拍摄任务页-v2协议示例/16-http-first-summon-rejected-query.json new file mode 100644 index 0000000..28aea0b --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/16-http-first-summon-rejected-query.json @@ -0,0 +1,20 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": null, + "operation": { + "request_id": "88888888-8888-4888-8888-888888888888", + "execution_id": null, + "action": "summon", + "status": "rejected", + "version": 1, + "error": { + "code": "ACTION_NOT_ALLOWED", + "msg": "当前没有可用设备,请稍后重试" + } + }, + "state": null + } +} diff --git a/docs/9.9.1/拍摄任务页-v2协议示例/README.md b/docs/9.9.1/拍摄任务页-v2协议示例/README.md new file mode 100644 index 0000000..9bba09b --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2协议示例/README.md @@ -0,0 +1,9 @@ +# v2 协议样例 + +与《拍摄任务页-v2接口协议-后端实施稿.md》配套。所有数据为虚构、凭证无效,不能用于真实飞控或直播连接。 + +`*.template.json` 中的 type 是未分配编号的字符串占位。实际协议要求 JSON 整数;需朱工登记新编号后替换,不能使用旧310/311。 + +同一任务各示例演示不同业务分支,不能理解为按文件序号依次执行真实动作。HTTP 202/错误状态等传输语义见主文档。 + +文档1.1:HTTP接口使用固定路径。GET的task_id/request_id等放Query;POST的task_id及其它业务字段放JSON。WS参数位置不变。 diff --git a/docs/9.9.1/拍摄任务页-v2接口协议-后端实施稿.md b/docs/9.9.1/拍摄任务页-v2接口协议-后端实施稿.md new file mode 100644 index 0000000..b325f50 --- /dev/null +++ b/docs/9.9.1/拍摄任务页-v2接口协议-后端实施稿.md @@ -0,0 +1,1003 @@ +# 拍摄任务页 v2 接口协议(后端实施稿) + +日期:2026-11-06 · 文档版本:1.1 · 对接:朱工(service-fly / hyperf-socket) + +1.1 调整:所有新版 HTTP 使用固定路径,GET 业务参数放 Query,POST 业务参数放 JSON;路径中不拼接任务 ID、动作请求 ID 等动态标识。业务规则与 WS 协议不变。 + +**用途:按已确认的产品规则新增 v2 接口与 WS 协议,供后端实现。本文不是已上线接口说明。App 暂不改代码,待后端合同与实现确认后再同步改造 iOS / Android。** + +文中 JSON 均为虚构示例,无有效登录或 RTC 凭证;未调用真实设备。新 WS 订阅号、退订号由朱工登记未占用整数后补齐,其余命名与字段按本文实施;无法支持的设备能力需明确反馈,不能用延时或默认值模拟成功。 + +## 1. 已确认的业务范围 + +### 1.1 正常流程与中断流程 + +正常流程: + +**准备页召唤受理 → 前往拍摄点 → 已到达待开拍 → 拍摄中 → 返航回收中 → 拍摄任务已完成。** + +“返航回收中”包含返航、降落、入巢和关盖。只有后端确认正常拍完,且无人机已回巢、机巢盖关闭、回收结束,才输出任务完成。**录制结束、开始返航、仅进入机巢或素材开始上传都不能提前输出完成。** + +未正常拍完的中断流程: + +**当前阶段 → 返航回收中 → 已完成返航。** + +后者仍是本次拍摄中断,不能当作正常拍摄成功;主按钮提供“重新召唤”,是否执行由后端提交时校验。正常流程不会先显示“已完成返航”再显示“拍摄任务已完成”。 + +### 1.2 页面和图传 + +- 主状态文案、图标、按钮标题 / 颜色 / 显示规则在 App 本地维护;后端返回稳定业务状态,不返回 UI 配置。 +- 不返回 `allowed_actions`、`permissions`、`can_*` 或旧门禁集合。按钮多数场景允许尝试,后端执行前校验并明确返回结果。 +- 暂停、继续任务、立即返航不弹二次确认。只在对应按钮 loading,不显示中央“指令已受理”。 +- 自动到点悬停不是手动暂停。返航中手动暂停后继续,仍恢复返航。 +- 页面可见时自动接收图传;正常 / 中断流程都持续到回收结束,分别收到 completed / returned 后停止本机 RTC。离页或后台立即停止本机接收,不取消真实设备任务。 +- 正常任务 completed 后显示“稍后再去 / 去查看”弹窗;前者留在完成页,后者进入当前订单素材库。returned 显示重新召唤,不弹正常完成提示。 +- 任务页不展示素材处理进度或素材失败,也不订阅素材处理状态;后续由订单素材库负责。 + +### 1.3 本地倒计时 + +- 后端不提供倒计时、截止时间或剩余秒数。App 在本次执行首次可靠观察到已到达待开拍时,创建 30 秒倒计时,**只显示**,不负责真实自动开拍。 +- 同一执行的重复 HTTP / WS ready 不重置计时。倒计时归零保持 0,不发送开拍,不请求刷新,也不自行切换拍摄中。 +- 点击暂停、开始拍摄、立即返航时,**先销毁本地倒计时**再提交;即使提交失败也不重建。继续任务后仍待开拍,只显示“开始拍摄”。 +- 重新进入页面 / 重启 App 后没有可靠本地计时记录时,不补造 30 秒;仍 ready 就只显示“开始拍摄”。原记录仍在的普通前后台切换,按实际经过时间继续。 +- 新 execution 可在首次可靠到达时重新建立计时;不跨任务、执行或账号复用。 + +## 2. 新旧隔离与接口清单 + +### 2.1 隔离要求 + +新增前缀统一为 **`/api/app/airport/v2`**。旧 `/airport/shooting`、`shoot`、`start-shoot`、`command`、`live` 原路径、参数、响应和协议语义保留;不迁移旧客户端到 `/v1`,也不根据 App 版本隐式改变旧接口返回值。 + +| 项目 | 旧版 | 新版 | +| --- | --- | --- | +| HTTP | 当前旧路径 | `/api/app/airport/v2/...` | +| WS 地址 | `/wss` | 复用 `/wss` | +| 订阅 / 退订 | 310 / 311,保持旧行为 | **V2_SUBSCRIBE_TYPE / V2_UNSUBSCRIBE_TYPE,待朱工分配** | +| 业务事件 | 原 `app_airport_shooting_updated` | `airport_v2.state`、`airport_v2.telemetry` | +| 快照与缓存 | 原序列化和 key | v2 独立序列化、缓存 key、版本计数和推送频道 | + +**共享的底层事实和执行约束**:真实任务、执行记录、设备占用锁、动作派发 / 防重、次数及素材记录。不能给 v2 复制一套独立设备控制中心。同一任务由旧接口操作后,新投影应看到真实变化;反之亦然,仍各自输出自己的协议。 + +v2 正常完成时间不能通过改写旧 `ui.phase` / 完成回包来实现;应建立独立业务阶段映射。涉及共享底层实现的改动必须回归旧版,不能仅以“新 URL”承诺无影响。最终同时验证旧包、新包读取同一任务,以及跨版本操作同一设备。 + +### 2.2 HTTP 清单 + +| 方法与路径 | 用途 | 设备副作用 | +| --- | --- | --- | +| `GET /api/app/airport/v2/tasks/state` | 首屏、恢复、手动刷新、HTTP 兜底 | 不创建任务、不飞控、不启图传、不主动实时采集 | +| `POST /api/app/airport/v2/tasks/actions` | 召唤、开拍、暂停、继续、返航 | 可能派发真实动作 | +| `GET /api/app/airport/v2/tasks/action-requests` | 无回执或结果未知时查询 | 只读,不重新派发 | +| `POST /api/app/airport/v2/tasks/live` | 获取 / 补齐 / 续期两路连接参数 | 可能按需启动缺失图传,不能重复启动健康来源 | +| `GET /api/app/socket-token` | 复用公共 Socket 票据 | 沿用原接口,不修改旧合同 | + +准备页张工 `tasks/create` 不变,先获得订单飞行任务 ID,再调用 v2 `actions:summon`。失败重召仍复用同一订单任务,创建新的 execution。订单 / 次数 / 素材 / 交付接口不在本次重构范围,v2 不新增 `order_status=25`,也不提前改动既有计次或订单成功语义。 + +## 3. 公共约定与最小数据模型 + +### 3.1 鉴权与外壳 + +HTTP 沿用 `token: `;POST 使用 `Content-Type: application/json`。门店、账号、景区、订单和任务归属由后端检查,前端不额外提交这些重复定位参数。 + +所有新版 HTTP 路径固定,不含业务 ID。GET 的 task_id、request_id、include_info 等通过 `?` 后的 Query 传递,没有请求体;POST 的 task_id 和其他业务字段全部放 JSON 请求体,不在路径或 Query 中传递。WebSocket 仍按下文 params 对象传参。 + +成功:`code=100000`,`msg`,`data`。HTTP 读取成功 200;动作持久受理且待确认 202;已取得明确结果或幂等重放结果可为 200。**HTTP 成功不等于设备动作 succeeded。** 不增加必须重复携带的 Header 版本字段或 UI 文案字段。 + +业务失败保留非成功整数 code(示例采用 100099),新增稳定 `error_code` 用于分类,`msg` 用于提示。整数编码由后端沿用统一规范;客户端不通过中文提示猜“是否无权限”。 + +HTTP 400 参数错误、401 登录失效、403 任务读取无权限、404 任务不存在、409 动作条件 / 批次冲突、503 临时服务故障,均须返回可解析的上述业务 JSON。动作不可执行只影响该动作,不等于整页禁止读取。 + +### 3.2 身份和版本 + +| 字段 | 定义 | +| --- | --- | +| `task_id` | 始终是订单飞行任务 ID,即原 `order_flight_task.id`;不是航线任务 ID | +| `execution_id` | 每次召唤受理后分配的执行标识,非空不透明字符串;换批次必须换值 | +| `state.version` | 状态模块在整个 task 生命周期递增,换 execution 不归零 | +| `telemetry.version` | 指标模块在整个 task 生命周期独立递增,换 execution 不归零 | +| `operation.version` | 同一个 request_id 的动作结果版本,独立递增 | +| `state.live_version` | 图传来源连接信息变化标识,在 task 内递增;不是凭证续期版本 | + +同一模块版本的内容必须一致;新版本整份替换、同版本忽略、旧版本丢弃。**不能拿 telemetry 的版本大小判断 state 新旧,也不能混比动作 version。** 计数不能因 Redis 清空 / 服务重启归零。 + +新 execution 先发布新 state,再发布其指标。切换时清旧指标、倒计时和图传;不通过 execution 字符串排序判断新旧。未知 execution 的单独指标先丢弃并合并发一次 GET 全量核对,不能让指标包推动业务换批次。 + +### 3.3 state 对象 + +| 字段 | 类型 | 必需 | 说明 | +| --- | --- | --- | --- | +| `version` | int64,正数 | 是 | 状态版本 | +| `stage` | string | 是 | 下节列出的业务阶段 | +| `paused` | bool | 是 | **已确认的手动暂停**;自动到点等待是 false | +| `context` | string 或 null | 是 | 开拍 / 继续用的当前语义控制周期,不是权限集合 | +| `live_version` | int64,非负 | 是 | 两路来源出现、失效、替换或需重新连接时变化 | +| `reason` | string 或 null | 是 | 异常 / 中断原因码,如 MANUAL_RETURN;正常为空 | +| `operations` | array | 是 | 当前执行的未结束动作及近期结果;无记录为 [] | + +不返回重复的 task/OFT/wayline 状态、原始设备证据、素材阶段、权限、倒计时、主副标题、按钮配置。后端内部仍须保存完整设备事实和拍摄结果,按统一函数归一化 stage;字段精简不表示丢掉内部判定依据。 + +### 3.4 stage 与 App 本地状态 + +| stage | App 本地中央状态 | 精确语义 | +| --- | --- | --- | +| `travelling` | 前往拍摄点 | 召唤已受理,含开盖 / 自检 / 起飞准备及前往首点,不宣称已起飞 | +| `ready` | 已到达待开拍 | 本 execution 已到首点,尚未实际开拍 | +| `recording` | 拍摄中 | 已确认实际录制 | +| `returning` | 返航回收中 | 正常 / 中断返航,直到降落、入巢、关盖收尾结束 | +| `returned` | 已完成返航 | **未正常拍完的中断流程**已确认回收结束,仍保留中断结果 | +| `completed` | 拍摄任务已完成 | **正常流程**拍完并回巢、关盖,后端确认本次任务完成 | +| `failed` | 拍摄失败 | 后端明确任务执行失败,且没有待完成飞行/回收;不能用一次按钮拒绝充当任务失败 | +| `cancelled` | 任务已取消 | 明确取消且没有仍待结束的飞行 / 回收过程 | +| `unknown` | 状态待确认 | 当前业务阶段确实无法判断;临时 HTTP / WS 失败不要求把旧已知阶段改 unknown | + +`paused=true` 时,App 在保留 stage 的同时显示第十种本地状态“已暂停”;stage=returning 时可显示“返航已暂停”。仅适用于 travelling/ready/recording/returning。终态 returned/completed/failed/cancelled 不得 paused=true。 + +后端维护暂停前任务方向,继续后恢复对应 stage。手动暂停 ready 后继续仍 ready;暂停返航后继续仍 returning。App 不接收 / 推导 resume_phase。 + +**returned 与 completed 是业务终态,不是原始 inside 信号。** 两者都要求后端确认回收结束;仅在巢、设备空闲、任务失败、计次变化、超时等待都不够。未离巢取消也不能产出 returned。返回 completed 后,后续素材失败不改成 failed。 + +无 execution、仅张工任务已创建但尚未召唤时,GET 返回 `TASK_NOT_STARTED`(409);不新增“待召唤”中央主状态,也不假造 execution。首次召唤从准备页提交,受理后传最新 state 进入任务页。 + +## 4. GET 当前状态与六项指标 + +```text +GET /api/app/airport/v2/tasks/state?task_id=501&include_info=1 +``` + +| 参数 | 位置 | 必填 | 默认 | 说明 | +| --- | --- | --- | --- | --- | +| task_id | Query,正整数 | 是 | — | 已有订单飞行任务 | +| include_info | Query,0/1 | 否 | 0 | 首次需要顶部摘要时为1;无其它业务 Query | + +无 JSON 请求体。不传 live_battery/live_metrics;v2 固定读取服务端维护的数据,不因刷新主动采集设备。 + +返回 JSON: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + }, + "info": { + "order_number": "261106000001", + "spot_name": "示例拍摄点", + "route_name": "示例航线", + "tourist_label": "游客 158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "cover_url": null + } + } +} +``` + +`include_info=0` 时直接省略 info,其他结构不变。info 只放页面需要的顶部摘要和素材页导航所需订单号;封面没有时为 null,不返回演示图片。WS 不重复推 info。 + +### 4.1 telemetry 对象 + +固定六项:`battery/env_temp/wind_speed/rainfall/signal/satellite`。 + +每项只返回 `value`、`observed_at`、`stale`:value 是可直接显示的字符串或 null,observed_at 是真实采集时间(RFC3339 带时区,可 null),stale 是本项过期标记。无原始 raw、单位重复字段、供应商证据和整份物模型。 + +- 首次无读数也要返回六项:value=null、observed_at=null、stale=true;不能补0或阻塞 state 首包。 +- 每项独立判断真实采集时间。约15秒补采、约120秒过期;只保留最近有效值,不因读取接口刷新采集时间。 +- 有有效新采样 / 本项过期 / 恢复时,递增 telemetry.version 并推送;不因此改 state.version、context、倒计时或按钮等待。 +- 新 execution 清空上一执行的指标,不跨设备复用。后端主动维护活跃飞行直到回收结束,不依赖 App 调 GET / live 或是否有订阅。 +- completed/returned 后可停止采新读数;仍有读取 / 订阅时应如实维护过期状态。时间流逝本身不应伪装成新采样。 + +## 5. POST 统一动作 + +```text +POST /api/app/airport/v2/tasks/actions +``` + +### 5.1 入参 + +| 字段 | 类型 | 必填 | 说明 | +| --- | --- | --- | --- | +| task_id | 正整数 | 是 | 已有订单飞行任务 ID,从 JSON 请求体读取 | +| request_id | UUID string | 是 | 本次明确点击的唯一标识,客户端发送前生成 | +| action | string | 是 | summon/start_recording/pause/resume/return_home | +| expected_execution_id | string 或 null | 是 | 必须对应用户操作的当前执行;仅首次召唤可null | +| context | string 或 null | 开拍/继续时带 | 原样使用最新 state.context;暂停/返航/召唤省略 | + +暂停示例: + +```json +{ + "task_id": 501, + "request_id": "11111111-1111-4111-8111-111111111111", + "action": "pause", + "expected_execution_id": "execution-001" +} +``` + +开拍示例: + +```json +{ + "task_id": 501, + "request_id": "22222222-2222-4222-8222-222222222222", + "action": "start_recording", + "expected_execution_id": "execution-001", + "context": "context-ready-001" +} +``` + +继续示例: + +```json +{ + "task_id": 501, + "request_id": "33333333-3333-4333-8333-333333333333", + "action": "resume", + "expected_execution_id": "execution-001", + "context": "context-paused-001" +} +``` + +首次召唤示例: + +```json +{ + "task_id": 501, + "request_id": "77777777-7777-4777-8777-777777777777", + "action": "summon", + "expected_execution_id": null +} +``` + +重召唤仍为 summon,expected_execution_id 填原执行;返航为 return_home,其他结构与暂停相同。App 不提交 plane_id/air_line_id 覆盖任务锁定信息,不通过 tasks/create 重建失败任务。 + +### 5.2 已受理返回 JSON + +HTTP 202: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + }, + "state": { + "version": 19, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "version": 1, + "error": null + } + ] + } + } +} +``` + +回执中的 state 是**当前完整状态模块**,不附带无关的六项指标和固定摘要。operation 用于明确关联本次请求;state.operations 中出现同一请求时,内容与动作版本必须一致。该 state 可以直接采纳,无须每次 POST 成功固定追加 GET。 + +动作持久受理后应尽快返回pending/HTTP202,不让HTTP一直等待设备动作、返航或关盖。同步已取得确证时可直接返回明确结果;后续设备确认通过state/查询更新。设备确认等待必须有界,超过合理确认期限应转unknown而非假失败;具体期限由朱工结合上游能力登记,App结束持续动画后仍保留原请求的防重和只读核对。 + +本例设备尚未确认手动暂停,所以 stage 仍 ready、paused=false,只有该暂停按钮等待。真实确认后,新 state paused=true、动作 status=succeeded/version=2,再更新中央。 + +### 5.3 operation 最小结构 + +| 字段 | 必需 | 定义 | +| --- | --- | --- | +| request_id | 是 | 唯一动作记录 ID,等于客户端原请求 ID,不另设 command_id/action_id | +| execution_id | 是,可null | 原请求 expected_execution_id;首次 summon 可null | +| new_execution_id | 仅 summon 成功建批次时 | 新执行标识,持久分配后不变 | +| action | 是 | 原动作名 | +| status | 是 | 下表动作进度 | +| version | 是 | 此 request_id 的结果版本,初始1,变化递增 | +| error | 是,可null | 明确拒绝/失败/未知原因 `{code,msg}`,不是中央状态文案 | + +| status | 精确含义 | +| --- | --- | +| pending | 已持久受理,等待派发或设备确认 | +| succeeded | 达到该动作目标,含义见下表 | +| rejected | 明确校验拒绝,保证没有派发该动作 | +| failed | 明确执行失败,不能把超时直接标失败 | +| superseded | 旧意图被新动作替代,不表示旧物理动作从未执行 | +| unknown | 是否生效尚不能确认;可在取得证据后更新为明确结果 | + +动作状态比较只按相同 request_id 的 version。迟到的 pending(version=1) 不能覆盖已收到的 succeeded(version=2)。unknown 不能当失败后自动重发。 + +succeeded/rejected/failed/superseded 是该动作的明确终态,不能因迟到设备回执生成更高version的pending/unknown,也不能复活被取代的旧意图。迟到的真实设备事实仍应核对并更新当前state;这与旧动作恢复有效是两回事。只有pending/unknown可以继续等待确证并收敛到明确结果。 + +| action | succeeded 的含义 | +| --- | --- | +| summon | 新 execution 已建立、航线被设备侧受理调度;不代表已起飞/到达 | +| start_recording | 已确认进入实际录制 | +| pause | 已确认本次手动暂停;首点自动悬停不算 | +| resume | 已确认解除本次手动暂停,恢复原环节;ready 软恢复不能直接开拍 | +| return_home | 已确认进入返航;起飞前支持取消时,也可表示已确认取消起飞。**均不代表正常拍摄完成** | + +return_home 若在起飞前执行:后端按实际能力撤销起飞,确认后 stage=cancelled;不支持则 rejected 并提示,保留原 stage;不能把仍 inside 当已完成返航。具体上游取消能力由朱工确认,不能用假成功替代。 + +### 5.4 召唤回执的身份 + +重召的 operation.execution_id 是旧执行,new_execution_id 是新执行;外层 data.execution_id/state 已属于新执行。客户端按本次 request_id 识别合法换批,不能把重召回执当成旧包。首次召唤相同规则,只是原执行为null。 + +完整例子见附件 14。新 execution 一旦受理,state.stage=travelling(含起飞准备),上页可直接用回执 state 展示“前往拍摄点”,不等待物理起飞才跳转。 + +### 5.5 后端校验、并发与幂等 + +1. 后端必须校验最新设备/任务条件。去掉权限字段只精简回包,不移除服务端校验,也不让 App 根据按钮文案猜操作。 +2. 幂等范围:认证所得门店范围 + task_id + request_id。**先查已有幂等记录,再核 execution/context**;同键同参数回同一动作及当前结果,不再派发;同键异参返回 IDEMPOTENCY_CONFLICT。 +3. 任务可操作期间不删除幂等和动作记录,归档后禁止新控制,建议再保留至少7天查询。重放可返回最新状态,保证同一动作身份和不重复派发,不要求正文逐字不变。 +4. 旧执行请求返回 EXECUTION_CHANGED,不能把上一轮迟到指令作用到新飞行。**不得要求全量 state/telemetry 版本严格相等才接收动作**,指标变化不应误挡暂停/返航。 +5. context 只用于开拍/继续的语义周期;指标、live_version、普通 GET、无关按钮 loading 不轮换。ready→手动暂停→继续 ready 后必须有新的开拍 context;每次新的手动暂停生成新的继续 context。 +6. 暂停/返航受理时应作废与当前意图冲突的旧开拍/恢复上下文;真正出队下发前再次核 context 与是否已被取代。自动/手动开拍也须争用同一有效开拍上下文,避免双发;App 不实现自动开拍调度。 +7. context 缺失/过期或当前不适用时返回 ACTION_CONTEXT_CHANGED/ACTION_NOT_ALLOWED 和当前 state。App 不自动替换 context 重发,也不据 context=null 修改中央阶段。 +8. 对同一真实设备共享串行派发和占用锁,覆盖新旧接口与多个账号。App 可串行 HTTP 提交,但不能等待前一设备结果才允许另一安全动作。 +9. 暂停尚 pending 时允许提交返航,由后端按当前条件处理。返航清理旧暂停意图;迟到旧暂停回执不把页面锁回暂停。返航后新的暂停则保留返航方向,继续仍恢复返航,不简单删除原返航目标。 +10. 动作先持久落记录再对接设备。设备已受理而服务端结果丢失时保留 unknown 并探测;上游无幂等能力时不能宣称物理严格执行一次,也不能盲目补发。 +11. 可信的本次拍摄正常/中断结果由后端保存到收尾结束,分别输出 completed/returned;不能仅凭最后一个 DJI success 决定。 + +同一execution的同一种动作尚pending/unknown时,即使另一个客户端换了request_id,也不得再次派发同动作:返回ACTION_IN_PROGRESS并保留新请求的rejected记录,同时返回当前state供核对。该同动作防重不能变成全局等待锁;例如pause仍待确认时,return_home仍独立评估并可按规则取代旧意图。 + +state.operations 必须保留当前执行所有 pending/unknown 动作,并至少保留最近5条明确结果。召唤动作按 new_execution_id 归入新执行;旧动作历史仍可查询。记录从数组消失不能当成功。 + +### 5.6 拒绝与业务失败 + +单次动作不可执行时不改变中央 stage。设备忙、低电量、状态不符等返回稳定 error_code 和提示;可定位的合法请求保留 rejected 记录。响应 data 尽可能含 operation 和当前 state,若鉴权/参数/任务身份尚不能成立则 data=null。 + +例如客户端发了旧 execution: + +```json +{ + "code": 100099, + "msg": "当前执行已变化,请刷新后重试", + "error_code": "EXECUTION_CHANGED", + "data": null +} +``` + +操作响应的 msg 可以展示,主状态标题仍由 App 本地枚举维护。400/401/403/404/409 等错误不能被网关吞成非 JSON。failed 与 rejected 的来源要记录后端日志,不把数据库错误或设备超时变成假成功。 + +## 6. GET 按 request_id 查询动作 + +```text +GET /api/app/airport/v2/tasks/action-requests?task_id=501&request_id=11111111-1111-4111-8111-111111111111 +``` + +Query 必填 task_id(正整数)和 request_id(原动作 UUID),无请求体;即使丢失整个 POST 回执,也能用发送前已生成的原 request_id 查到。找到时返回 operation 及**同一提交视图下的当前 state**;外层 execution_id 是任务当前执行,operation.execution_id 可以是历史执行。 + +例外:首次summon已经被明确拒绝、尚未建立任何执行时,动作记录仍应可查;data.execution_id=null、state=null,operation.status=rejected。此处允许没有state,不改变GET state对此场景返回TASK_NOT_STARTED的约定,也不能为了查询回包造一个execution。 + +结果尚未知的示例: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "operation": { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + }, + "state": { + "version": 21, + "stage": "ready", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [ + { + "request_id": "11111111-1111-4111-8111-111111111111", + "execution_id": "execution-001", + "action": "pause", + "status": "unknown", + "version": 2, + "error": { + "code": "DEVICE_CONFIRMATION_UNKNOWN", + "msg": "暂未确认暂停是否生效" + } + } + ] + } + } +} +``` + +尚未查到: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "operation": null + } +} +``` + +operation=null 只表示此刻未查到,**不能证明原 POST 永远不会到达**。App 不因此换 request_id 自动补发。短期可约2秒查一次,之后合并到5秒读取兜底/手动核对,不为每个未知动作开启永久并行定时器。 + +操作结果只更新对应等待状态,中央按有效 state 更新。旧执行动作仍可核对,但不能用它覆盖当前执行。所有 pending/unknown/明确结果变化都需递增该 operation.version;当前执行相关变化还需递增 state.version 并推送。 + +## 7. WebSocket v2 + +### 7.1 连接、票据与编号 + +正式 `wss://api.zhifly.cn/wss`,测试 `wss://api-test.zhifly.cn/wss`,与 HTTP 环境一致。票据继续取旧公共 GET `/api/app/socket-token`,无业务入参,沿用 App 登录身份;票据不是登录 token,也不是 RTC token。原响应可含 account_type,任务页只需 socket_token/expire_seconds。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "expire_seconds": 3600, + "account_type": "store_user" + } +} +``` + +必须由朱工登记两个**未占用整数**: + +| 常量 | 含义 | +| --- | --- | +| V2_SUBSCRIBE_TYPE | 新版任务订阅 | +| V2_UNSUBSCRIBE_TYPE | 新版任务退订 | + +**以下订阅 JSON 是模板**:`${V2_SUBSCRIBE_TYPE}` / `${V2_UNSUBSCRIBE_TYPE}` 暂用字符串占位,实际发送时必须替换为分配的 JSON 整数,不允许按字符串发送,也不使用0/310/311等未确认编号代替。分配后后端更新这两处登记值,双方一起固化;不用在每个包再重复 protocol_version。 + +传输连接建立后直接发送一次业务 JSON **文本帧**,新版不依赖 Opened/ready/received 才开始订阅。共享服务仍可为旧连接保留旧欢迎行为,新版忽略无关欢迎帧,不让它延长超时。 + +### 7.2 订阅请求模板 + +```json +{ + "type": "${V2_SUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "request_id": "subscribe-request-example" + } +} +``` + +请求只包含 task_id、票据和订阅关联 request_id,不另订阅指标频道或图传频道。 + +### 7.3 正式成功:一次带齐两个完整模块 + +成功必须已经完成鉴权和频道登记,并能提供完整 state 与 telemetry;没有指标时返回六项未知值,不阻塞 state 首包。data 与 GET state 的动态部分一致,不含 info。 + +```json +{ + "code": 100000, + "event": "airport_v2.subscribed", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 18, + "stage": "ready", + "paused": false, + "context": "context-ready-001", + "live_version": 2, + "reason": null, + "operations": [] + }, + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + }, + "request_id": "subscribe-request-example" +} +``` + +该帧通过当前连接、订阅请求、任务、执行及模块结构校验后,WS 才就绪,停止常规 HTTP 轮询。按各模块版本采纳;即使 HTTP 已返回更高版本,也不能用此帧回滚,服务端随后补发首包之后的新变化。 + +失败必须明确返回,不返回“成功但无首包”,也不再输出 subscribe_meta/has_snapshot/HTTP seed 业务分支。 + +### 7.4 两类业务推送 + +**类型一:任务状态,event=airport_v2.state。** 中央业务阶段、手动暂停、动作进展、context 和 live_version 在同一条状态里原子更新。以下是正常返航回收中: + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 30, + "stage": "returning", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} +``` + +正常回巢关盖、后端确认任务完成后: + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 31, + "stage": "completed", + "paused": false, + "context": null, + "live_version": 2, + "reason": null, + "operations": [] + } + } +} +``` + +若未正常拍完,中断返航收尾结束则输出 returned(不是 completed): + +```json +{ + "code": 100000, + "event": "airport_v2.state", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state": { + "version": 32, + "stage": "returned", + "paused": false, + "context": null, + "live_version": 2, + "reason": "MANUAL_RETURN", + "operations": [] + } + } +} +``` + +**类型二:六项指标,event=airport_v2.telemetry。** 每次返回完整六项,不能用指标更新清理按钮等待、改中央状态或重建倒计时。 + +```json +{ + "code": 100000, + "event": "airport_v2.telemetry", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "telemetry": { + "version": 7, + "items": { + "battery": { + "value": "95%", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "env_temp": { + "value": "19.6℃", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "wind_speed": { + "value": "2m/s", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "rainfall": { + "value": "无雨", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "signal": { + "value": "良好", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "satellite": { + "value": "32颗", + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + } + } + } + } +} +``` + +两类均为**完整子对象替换**,不推 patch。状态与指标允许采集时间不同,任何一类不能等待另一类采集成功才发送。任务状态和操作结果不拆成独立第三类;图传来源变化仅改变 state.live_version。 + +### 7.5 协议心跳与错误 + +只有上面两类是业务数据消息;subscribed/heartbeat/error/unsubscribed 是连接协议帧,不是新增业务订阅。 + +后端默认每20秒必须发送一帧应用心跳,携带两类权威最新版本;即使某类业务推送频繁也不省略心跳: + +```json +{ + "code": 100000, + "event": "airport_v2.heartbeat", + "subscription_id": "subscription-example-001", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "state_version": 30, + "telemetry_version": 8 + } +} +``` + +- 两版本与本地一致:没有变化,正常等待,不因“拍摄120秒没变化”额外轮询。 +- 任一版本领先:合并安排一次 GET state 修复;未追上时保持5秒 HTTP 兜底,追上且订阅健康后停常规轮询。 +- 版本落后:不能回滚,记录异常;持续不一致时重建订阅。 +- 正式首包算首次双版本同步;随后60秒没有当前订阅的有效双版本心跳,则HTTP兜底并重连。单独state/telemetry业务帧只证明传输活跃,不能重置这条核对期限,避免“指标一直来、状态一直漏”却永久假健康。网络Ping/Pong也不能替代双版本核对。 +- 旧 subscription_id、旧连接回调、解析错误或不同任务的帧不算有效,不能延长健康期。心跳也不代表设备指标新鲜。 + +正式订阅失败示例: + +```json +{ + "code": 100099, + "event": "airport_v2.error", + "request_id": "subscribe-request-example", + "error_code": "AUTH_TIMEOUT", + "msg": "订阅鉴权暂不可用", + "data": { + "task_id": 501 + } +} +``` + +订阅成功后的错误带 subscription_id;成功前必须回显订阅 request_id,防止旧连接失败回执影响新会话。按 error_code 分类,不匹配中文 hint。 + +### 7.6 首包竞态与恢复 + +1. 后端鉴权、登记、读首包全链路建议总计不超过3秒,Redis/DB/队列各有有界超时。App 首包等待上限建议10秒;收到明确失败立即结束等待。 +2. 先登记频道,再获取当前一致快照。首包发送前缓存连接内后续更新,先发正式首包,再按各模块版本补发更新;同连接发送串行,防止漏掉登记/读取之间的变化。 +3. 空缓存由统一状态服务生成。不能生成则 SNAPSHOT_UNAVAILABLE 并撤销本次订阅,不能长期空等或给半成功ACK。 +4. 新 execution 的 state 先到,随后是其新指标;完整首包的两模块属于同一个执行。旧指标或凭证不能用于新执行。 +5. 发布失败需可靠补投(可采用持久消息/outbox);允许重复,不能悄悄丢。心跳取权威最新版本,不取该连接上次发出的版本。 +6. WS未就绪/失败/断线时,前台默认5秒串行GET(后端建议间隔限制2~30秒),同时按1/2/4/8/16/30秒加轻微抖动重连;每轮重新取票。页面只保留一个状态GET在途。 +7. TASK_READ_FORBIDDEN/TASK_NOT_FOUND 停该任务两路读取;SOCKET_TICKET_EXPIRED 仅换票,不清登录;AUTH_TIMEOUT/TEMPORARILY_UNAVAILABLE/SNAPSHOT_UNAVAILABLE 保留HTTP兜底。 +8. 离页/后台停止读取并尽力退订,不取消后台真实设备任务;回来立即GET并重新订阅。 + +### 7.7 退订模板 + +```json +{ + "type": "${V2_UNSUBSCRIBE_TYPE}", + "params": { + "task_id": 501, + "subscription_id": "subscription-example-001" + } +} +``` + +服务端可回 event=airport_v2.unsubscribed,带 subscription_id/task_id;App 离页不等待回执。旧310/311和旧推送流程保持不变,新频道不能向旧订阅者发送新结构。 + +## 8. POST 两路图传参数 + +```text +POST /api/app/airport/v2/tasks/live +``` + +入参: + +```json +{ + "task_id": 501, + "execution_id": "execution-001", + "viewer_id": "66666666-6666-4666-8666-666666666666" +} +``` + +| 字段 | 定义 | +| --- | --- | +| task_id | 已有订单飞行任务正整数 ID,从 JSON 请求体读取 | +| execution_id | 本次观看对应执行,必须与当前有效执行一致 | +| viewer_id | App 本次可见观看会话UUID;补取/续期保持不变,新观看/换执行重新生成 | + +该POST是幂等“确保观看并取当前参数”:同一 viewer_id 不反复创建观看身份、健康房间或重复启动已有设备流。后端仅按需开缺失来源,并对同任务不同观看者去重;重复调用可以返回刷新后的凭证,不要求原样重放过期参数。 + +返回 JSON,首版明确只支持火山 Volc RTC: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "live_version": 2, + "refresh_after": 30, + "sources": { + "airport": { + "available": true, + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_AIRPORT_ROOM", + "user_id": "EXAMPLE_VIEWER_AIRPORT", + "token": "EXAMPLE_RTC_TOKEN", + "expires_in": 2400 + }, + "drone": { + "available": false, + "reason": "DRONE_NOT_READY" + } + } + } +} +``` + +| 出参 | 定义 | +| --- | --- | +| task_id / execution_id / live_version | 必须回显当前来源版本和执行,用于丢弃旧参数 | +| refresh_after | 建议下次补取/续期的秒数。缺一路默认30秒、限制5~60;两路健康时可按最早凭证到期前30秒安排,至少5秒 | +| sources.airport / sources.drone | 固定两路,不再重复返回第三份 play 推荐对象 | +| available | 本次有有效连接参数,不代表手机已收到画面 | +| app_id/room_id/user_id/token | 结构化火山入房参数,只在available=true时必需 | +| expires_in | 回包时剩余有效秒数;App按请求往返时间保守扣减,再用单调时钟续期,不依赖手机墙上时钟 | +| reason | available=false时可选原因码,由App映射“等待来源”等提示 | + +不返回拼接URL、重复raw、设备指标或业务stage。非volc来源暂明确返回UNSUPPORTED_LIVE_PROVIDER,不能伪装当前App已支持其他SDK。 + +### 8.1 live_version 与实际画面 + +- 后端发现来源出现、撤销、换设备或必须重连的房间身份变化:递增live_version,同时递增state.version,随任务状态推送;**不新增第三类业务WS消息**。 +- App发现来源版本变化,在仍可见、当前执行尚未回收结束时合并请求live。两类数据与live回包交错时,以当前execution和已知来源版本为准,旧回包不能恢复旧画面。 +- 纯token续期不改live_version、不改业务state;保持有效room_id/user_id,使用SDK续期,不反复退房入房。 +- 同一viewer的live请求串行,WS变更、定时补参和续期合并到同一请求循环;已有请求在途时只记录需要再查,不并发另开请求。客户端按本地观看/请求代次作废迟到响应,即使live_version相同,旧请求也不能覆盖新请求凭证。纯续期不应提前吊销仍在原有效期内的旧凭证,避免客户端刚换参前掉流。 +- expires_in必须先保守扣除本次请求耗时;已无剩余有效期的参数不可入房。凭证临期需要尽快续取时,不能因为refresh_after“至少5秒”而等过实际过期;最小间隔用于普通补参/失败退避,不能延长旧凭证有效期。过期旧画面不能继续标实时。 +- 后端参数可用、SDK发布、手机实际视频帧是不同层次。只有真实有画面才显示实时标识;无人机有帧后切换,无人机异常则退回仍健康的机巢,两路无画面则等待。 +- 有一路缺参时仍按refresh_after补取,不能只依赖一次WS通知;保留健康房间。HTTP暂时缺某路参数不把仍有帧、凭证有效的健康连接直接关闭。 +- 必须区分“本次暂取不到参数”和“来源已明确撤销/替换”:available=false且reason=SOURCE_REVOKED,或新版本明确替换该路房间身份时,停止该路被撤销/替换的旧连接和凭证,不沿用健康流保留规则;其它健康来源可继续。替换锁定飞机必须使用新execution,同一设备的房间身份变化才仅增加live_version;不能在同execution下静默把画面换成另一架飞机。 +- completed/returned/failed/cancelled、离页、后台或执行身份失效时,停止本机接收,取消补流和续期;迟到live/SDK回调不得重启。初次读到这些已结束状态时不先调用live。 +- 任务failed/cancelled的输出必须与实际没有待回收飞行相符;仍在回收时应输出returning继续观看,不能用“拍摄失败”提前隐藏空中流程。 +- 释放本机RTC不调用设备停流,不影响其他观看者。后端清理失效viewer记录;需要设备级停流时另行定义,不能混入本次客户端退出。 + +后端暂无法可靠感知来源变化时,应反馈并保留限频缺流补取;不能伪造live_version变化。无论是否有WS通知,实际首帧/卡顿判断都由SDK完成。 + +## 9. App 本地展示与按钮规则 + +### 9.1 本地十种业务状态 + +前往拍摄点、已到达待开拍、拍摄中、已暂停、返航回收中、已完成返航、拍摄任务已完成、拍摄失败、任务已取消、状态待确认。 + +本地映射规则:先校验数据,若paused=true且stage为可暂停阶段,显示已暂停并保留原stage;否则按第3.4节映射。返航暂停显示“返航已暂停”,恢复后仍返航。没有“素材处理失败”或“上传中”主状态。 + +加载、网络错误、按钮等待、RTC播放状态和倒计时是独立状态。请求失败有旧数据时保留旧业务阶段;单次动作拒绝只提示,不把整个任务改failed。 + +### 9.2 常规按钮 + +| 当前本地场景 | 主操作 / 安全按钮 | +| --- | --- | +| 前往 / 待开拍 / 拍摄中 | 通常可暂停、返航;ready另有开始拍摄 | +| 已手动暂停 | 暂停按钮改继续任务;非返航暂停通常还可返航 | +| 返航回收中(含暂停返航) | 禁重复返航;返航未暂停可暂停,已暂停则继续任务 | +| 已完成返航 | 主按钮重新召唤恢复可点;暂停、返航不可点 | +| 拍摄任务已完成 | 主按钮查看素材;暂停、返航不可点 | +| 拍摄失败 | 显示原因和重新召唤入口;是否仍有权益、设备是否可用等均由POST校验,不再要求一个“可恢复”权限字段 | +| 任务已取消 | 展示取消结果;不在本稿中新增“取消后必提供重召”的产品约定,也不因取消而假造returned | +| 状态暂未知 / 刷新失败 | 不因一次读取失败整区禁用已有安全操作;后端最终校验,明确账号/任务身份失效则停操作 | + +本表是App固定展示规则,不要求后端返回可操作列表。对应动作正在提交/待确认时仅该按钮loading、防重复;其他安全动作仍可按规则尝试。会改变开拍语义的本地操作正在处理时避免并发开拍;后台变化最终由POST拒绝或确认。 + +### 9.3 倒计时实现边界 + +App按账号+task+execution维护本地“未建立/计时中/已销毁/已归零”记录。正常准备页持有本次新召唤回执,或当前会话已观察到travelling→ready,可认定本次首次可靠到达并创建30秒。直接重入仅看到ready、没有可靠记录时不创建。 + +同执行只创建一次。点击pause/start_recording/return_home前先销毁并记住,不因失败、resume、重复ready或WS重连恢复;离开ready进入其它业务阶段也清理显示。新execution才允许重新建立。无持久记录时不跨重启补造时间;后台保有原记录时实际经过时间继续扣减。 + +这只是现场提示,不保证与设备真实自动开拍剩余秒数精确一致。后端进入recording时立即以其更新UI。点击暂停销毁的是App计时,不是凭客户端计时去取消/创建设备自动开拍计划;后端仍须维护真实设备暂停/恢复语义。 + +### 9.4 完成与重新进入 + +正常完成弹窗按task+execution在当前页面会话去重:当前会话已展示非终态,之后首次确认completed时提示一次,前后台/重复快照不重复弹;重入时首份状态已经completed,则仅展示完成面板,不重复弹窗,也不自动启动RTC或计时。正常结束不等于素材就绪/整单确认。 + +returned仍是中断结果,说明“本次拍摄已中断,无人机已返回机巢”,重新召唤复用订单任务。再调用summon后必须换execution,清旧控制上下文/倒计时/图传。旧执行的指令结果可核对历史,但不能应用到新飞行。 + +## 10. 状态生产与错误分类 + +### 10.1 服务端生产要求 + +- 统一组装state/telemetry供HTTP、动作回执、WS使用;不在不同接口分别拼不同阶段。副本同版本必须内容一致。 +- 关键设备事件及时更新stage/paused;正常与中断收尾严格区分。后台跟踪不能因旧OFT进入25或素材上传而停止v2回巢/关盖核对。 +- state相关字段和当前动作进展变化升state.version;指标独立升telemetry.version;live来源变化升live_version及state.version。无变化GET、Ping/心跳、凭证纯续期不升业务版本。 +- 版本、执行身份、动作幂等和暂停方向必须在进程/缓存重启后恢复。先一致提交状态与版本,再可靠投递推送,不能只有进程内回调。 +- state完成不提前改写订单成功、素材成功、次数等其它模块既有语义。是否允许新任务提交仍由设备占用和订单权益检查;素材上传本身不拦下一次,但尚未回收的设备不能被抢占。 + +### 10.2 最少错误码集合 + +| error_code | 处理范围与行为 | +| --- | --- | +| LOGIN_EXPIRED | 统一登录处理 | +| TASK_READ_FORBIDDEN / TASK_NOT_FOUND | 停当前任务HTTP/WS;不是单次动作拒绝 | +| TASK_NOT_STARTED | 无执行的任务不进入任务页;回准备流程,不创建假阶段 | +| SOCKET_TICKET_EXPIRED | 只换票重连 | +| AUTH_TIMEOUT / SNAPSHOT_UNAVAILABLE / TEMPORARILY_UNAVAILABLE | 可恢复读取/订阅,HTTP兜底 | +| ACTION_NOT_ALLOWED / ACTION_IN_PROGRESS | 对应动作结束等待/提示或沿已有动作核对,保留业务stage | +| EXECUTION_CHANGED / ACTION_CONTEXT_CHANGED | 更新当前状态,等待明确操作;不自动改参数重发 | +| IDEMPOTENCY_CONFLICT | 原request_id被不同参数复用,明确拒绝 | +| DEVICE_COMMAND_FAILED | 明确执行失败,与任务阶段是否失败分开 | +| DEVICE_CONFIRMATION_UNKNOWN | 只读核对,不自动重发 | +| LIVE_NOT_AVAILABLE / UNSUPPORTED_LIVE_PROVIDER | 图传提示,不改变拍摄任务结果 | + +网络超时不映射成DEVICE_COMMAND_FAILED。权限/任务错误的范围必须准确:某条动作不允许,不应停止全部任务读取。异常日志应能按task/execution/request_id串联派发与设备确认,响应不泄漏数据库SQL或服务器堆栈。 + +## 11. 联合验收清单 + +| 场景 | 必须结果 | +| --- | --- | +| 召唤受理但设备尚在巢 | travelling,不误判returned;任务页能及时显示前往 | +| 到首点自动悬停 | ready+paused=false,不出现手动暂停 | +| 可信首次到达/重复到达 | 创建一次本地30秒,重复包/指标变化不重置 | +| 点击暂停/开拍/返航后失败 | 倒计时已销毁,不恢复,不重建30秒 | +| 暂停→继续仍ready | 只有开始拍摄按钮;新的context,旧开拍请求不能误执行 | +| 重入/重启无计时记录 | ready直接显示开始按钮,不补造30秒 | +| 后台有原计时记录 | 按实际经过时间继续;归零不发开拍 | +| 暂停未确认就返航 | 可提交返航,旧暂停迟到不反锁;一按钮等待不全局锁 | +| 返航暂停→继续 | stage保持returning,方向不丢 | +| 正常录制结束开始返航 | 仍returning,不弹完成,不停RTC | +| 已入巢但未关盖 | 仍returning,继续图传 | +| 正常收尾结束 | completed,提示一次并停本机RTC | +| 未拍完中断后收尾结束 | returned,中断结果保留,重新召唤入口可点而非假成功 | +| 起飞前返航/取消能力不足 | 真实取消或明确拒绝,不凭inside判回巢 | +| POST回执丢失/后端进程重启 | 同request_id可查,不自动换键重发,不盲目补派发 | +| 迟到pending与新succeeded | operation.version防回退,state版本防阶段回退 | +| 重召换执行 | 旧动作/倒计时/指标/图传均不能影响新执行 | +| WS首包登记竞争/空缓存 | 最新状态最终可达,完整首包或明确失败,不半成功空等 | +| 指标版本先到、状态后到 | 分模块比较,不因指标版本大丢掉有效状态 | +| 心跳无变化/漏推 | 无变化正常等待;版本领先触发一次合并GET修复 | +| 旧订阅/旧连接迟到 | 不能续当前健康期、不能回滚新数据 | +| 无读数/120秒过期/恢复 | 6项可空首包不阻塞,旧值保留,各项真实时间与版本正确 | +| 直播来源变更/漏通知 | live_version触发取参,缺路限频补取,保留健康流 | +| 纯token续期/参数身份不变 | 不升live_version,不反复入房 | +| 结束与live迟到同时发生 | 结束后不能恢复播放;不停止其他人的设备流 | +| 新旧包并行同任务/设备 | 旧HTTP和310/311原格式正常;新旧频道不串、共享设备占用和防重 | + +## 12. 朱工实施前登记与交付 + +1. 分配并登记V2_SUBSCRIBE_TYPE / V2_UNSUBSCRIBE_TYPE,确认共享/wss入口能独立路由。 +2. 确认正常/中断回收结束可获得“回巢、关盖、收尾完成”的可靠依据;不以计时模拟。确认起飞前return_home的真实取消能力,不支持则明确拒绝。 +3. 确认live_version变化的来源事件和缺流补取方式;纯凭证续期不改来源版本。 +4. service-fly与hyperf-socket按同一合同联调发布;旧协议兼容回归后再安排两端App适配。 +5. 提供各HTTP真实脱敏回包、两个WS编号、首包/两类推送/错误样例,以及当前未支持项;与本文有差异先反馈并同步合同,不悄悄改字段含义。 + +本稿不要求朱工提供设备无法可靠给出的倒计时时间,也不要求接口返回UI或按钮权限。后端负责真实业务事实与执行校验,App负责本地展示与请求恢复。 + +## 附:完整协议示例 + +同目录“拍摄任务页-v2协议示例”提供独立JSON。订阅/退订文件后缀template.json表示待替换整数编号,其余示例可作为结构校验夹具;所有凭证均无效。 + +| 文件 | 内容 | +| --- | --- | +| `01-http-state-ready.json` | 含首次info的GET回包 | +| `02-http-pause-request.json` | 暂停入参 | +| `03-http-pause-accepted.json` | 暂停已受理,设备尚待确认 | +| `04-ws-subscribe.template.json` | 新订阅模板,编号待分配 | +| `05-ws-subscribed.json` | 完整双模块首包 | +| `06-ws-state-returning.json` | 正常或中断返航回收中 | +| `07-ws-state-completed.json` | 正常任务回收完成 | +| `08-ws-state-returned.json` | 中断返航回收完成 | +| `09-ws-telemetry.json` | 完整六项指标 | +| `10-ws-heartbeat.json` | 协议心跳携带双版本 | +| `11-http-live-response.json` | 两路参数,一路待就绪 | +| `12-http-action-unknown.json` | 查到动作结果待确认 | +| `13-http-execution-changed.json` | 旧执行动作拒绝 | +| `14-http-summon-response.json` | 重召时旧/新execution对应关系 | +| `15-ws-unsubscribe.template.json` | 新退订模板,编号待分配 | +| `16-http-first-summon-rejected-query.json` | 首次召唤被拒绝且未建执行时,动作仍可查询 | + +旧《接口重构方案-讨论稿》及其旧示例已过期,实施以本文为准。此前《接口入参与返回JSON详解》仅描述旧客户端,不是v2协议。 + diff --git a/docs/9.9.1/拍摄任务页-接口入参与返回JSON详解.md b/docs/9.9.1/拍摄任务页-接口入参与返回JSON详解.md new file mode 100644 index 0000000..114e3bc --- /dev/null +++ b/docs/9.9.1/拍摄任务页-接口入参与返回JSON详解.md @@ -0,0 +1,1333 @@ +# 拍摄任务页:接口、入参与返回 JSON 详解 + +> 本文件描述旧客户端及旧接口。新增 v2 的业务规则、字段与独立 WS 协议见[拍摄任务页 v2 后端实施稿](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页-v2接口协议-后端实施稿.md),不要将两套协议混用。 + +更新日期:2026-11-06。核对范围:iOS `31f9853`、Android `e5aa2ca0` 的实际调用,以及朱工提供的《随心瞰9.9.1-App机巢与素材库接口.md》。本文是[机巢工作台页面接口清单](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/机巢工作台-页面接口与提供方清单.md)的任务页展开版。 + +**拍摄任务页共使用 6 个 HTTP 接口,加一条 `/wss` 实时通道。任务状态、按钮权限、设备读数主要来自 `shooting` / WS;图传来自 `live`;开拍、暂停、继续、返航、重新召唤分别提交写请求。** + +本文 JSON 按当前合同及 App 已接入字段整理,使用虚构的订单、设备和凭证。它们用于解释结构,不是本次真实请求的原始回包;没有访问真实设备或接口。注明“节选”的 JSON 只展示相关字段,不能当作完整任务快照。未注明节选的示例也不穷举服务端可能增加的扩展字段。 + +阅读顺序建议:先看第 1~2 节理解调用关系和任务 ID,再看第 3 节的主快照;暂停 / 继续 / 返航看第 7 节,任务结果的区别看第 10 节。其余接口按页面操作逐项查看。 + +## 1. 先看调用关系 + +| 用途 | 方法与路径 | 谁提供 | 何时调用 | +| --- | --- | --- | --- | +| 任务状态、权限、读数 | `GET /api/app/airport/shooting` | 朱工 | 进页、回前台、手动刷新、操作后核对、HTTP 兜底 | +| 订阅票据 | `GET /api/app/socket-token` | 公共 Socket 服务;具体维护人待确认 | 每轮建立 / 重建任务 WS 前 | +| 实时状态推送 | `/wss`,订阅 `310`、退订 `311` | 朱工任务合同 + 公共 Socket 服务 | 页面可见时维持任务订阅 | +| 机巢 / 无人机图传 | `GET /api/app/airport/live` | 朱工 | 页面可见且当前任务允许图传时自动获取;补流、续期、重试 | +| 开始拍摄 | `POST /api/app/airport/start-shoot` | 朱工 | 用户点击“开始拍摄”,且开拍门禁允许 | +| 暂停 / 继续 / 返航 | `POST /api/app/airport/command` | 朱工 | 用户点击对应按钮,且当前权限允许 | +| 重新召唤 | `POST /api/app/airport/shoot`,`restart=true` | 朱工 | 失败 / 中断后,回巢和重召唤门禁均满足时 | + +```mermaid +sequenceDiagram + participant A as App 拍摄任务页 + participant S as service-fly / HTTP + participant W as hyperf-socket / WS + participant R as 火山 RTC + A->>S: GET shooting(id, live_battery=0) + S-->>A: 任务完整快照 + A->>S: GET socket-token + S-->>A: socket_token + A->>W: 建立 /wss + W-->>A: Opened / ready + A->>W: 310(id, socket_token) 文本帧 + W-->>A: received → subscribe → subscribe_meta + W-->>A: app_airport_shooting_updated 完整快照 + Note over A,W: 正式订阅成功且拿到有效快照后,停止常规 HTTP 轮询 + opt 当前任务尚需图传 + A->>S: GET live(id) + S-->>A: airport / drone 两路 RTC 参数 + A->>R: 入房并接收视频 + end + opt 用户点击开拍或控制按钮 + A->>S: POST start-shoot / command / shoot + S-->>A: 操作回执 + A->>S: GET shooting 核对原任务 + W-->>A: 后续完整快照 + end +``` + +首次“确认并召唤”发生在**拍摄准备页**:张工 `tasks/create` 创建订单飞行任务,随后朱工 `shoot(restart=false)` 召唤。进入任务页后,不会因为进页、刷新或倒计时归零再次创建任务 / 召唤。 + +## 2. 所有接口共有的约定 + +### 2.1 环境与鉴权 + +| 项目 | 当前 App 使用方式 | +| --- | --- | +| 正式 HTTP 域名 | `https://api.zhifly.cn` | +| 测试 HTTP 域名 | `https://api-test.zhifly.cn` | +| HTTP 登录身份 | 沿用当前 App 登录 token;两端请求头实际字段为 `token`,不是请求 JSON 中的字段 | +| JSON 写请求 | `Content-Type: application/json` | +| Socket 鉴权 | 先用登录身份获取 `socket_token`,再放进 310 的 `params`;它与登录 token、RTC token 不同 | + +后端文档通用段写的是 `Header:YFHandSetAppToken`,与当前两端实际发送的 `token` 名称不一致;这个合同描述需要朱工澄清。本文按当前代码说明,不将二者写成客户端已经实现的兼容字段。 + +### 2.2 成功与失败外壳 + +当前两端业务成功码为 **`100000`**,常见格式如下。`time` 是服务端响应时间,部分回包可能不带;它不是设备读数采集时间。 + +```json +{ + "code": 100000, + "msg": "success", + "data": {}, + "time": "2026-11-06 10:00:00" +} +``` + +失败示例(示意;具体错误码、文案与 `data` 类型取决于服务端): + +```json +{ + "code": 100099, + "msg": "任务不存在或无权访问", + "data": [], + "time": "2026-11-06 10:00:00" +} +``` + +合同开头仍保留 `code=0/message` 的旧示例,WS 段也保留“HTTP 成功码为 0”的表述,**均与当前两端代码不一致,当前两端不会将 `code=0` 当作业务成功**。本文统一采用实际 App 的 `100000/msg`,不能直接照抄旧外壳。 + +### 2.3 这些 ID 不能混用 + +以下示例统一使用订单飞行任务 `501`、航线任务 / 执行批次 `9001`。它们是不同层级。 + +| 字段 / 位置 | 示例 | 含义 | +| --- | --- | --- | +| 本页各 HTTP 请求的 `id` | `501` | **`order_flight_task.id`**,订单飞行任务 ID | +| `shooting.data.order_flight_task_id` | `501` | 当前任务身份 | +| `shooting.data.task.id` / `order_flight_task.id` | `501` | 同一订单飞行任务身份 | +| `task.wayline_task_id` | `9001` | 底层航线任务 ID | +| `execution_batch` | `9001` | 当前执行批次;合同目前取航线任务 ID,App 使用明确返回值核对 | +| **`shoot.data.task_id`** | **`9002`** | **该召唤回执中的航线任务 ID**,不是下次请求应传的 `id` | +| 张工 `tasks/create.data.task_id` | `501` | 创建接口中的订单飞行任务 ID;同名字段在不同接口语义不同 | +| `plane_id` | `58` | 设备记录 ID,由后端锁定 | +| `airport_sn` | `DEMO_DOCK_SN` | 机巢序列号;与无人机 `drone_sn` 不同 | + +重新召唤仍传 `id=501`;后端新建航线后批次可变为 `9002`,旧 `9001` 的响应必须丢弃。 + +## 3. `GET /api/app/airport/shooting`:任务页主数据 + +### 3.1 入参 + +```text +GET /api/app/airport/shooting?id=501&live_battery=0 +``` + +| 参数 | 位置 | 必填 | 当前页面发送值 | 含义 | +| --- | --- | --- | --- | --- | +| `id` | Query | 是 | `501` | 已有订单飞行任务 ID | +| `live_battery` | Query | 合同可选 | **`0`** | 读取最近缓存读数,不启动图传;任务页固定关闭主动实时采集请求 | + +该 GET 没有 JSON 请求体。`live_battery=0` 不表示读数永远不刷新:后端有独立后台补采,详见 3.5。 + +### 3.2 返回 JSON:已到达待开拍示例 + +下面展开主字段。`task.wayline_status=20` / `work_status=2` 在这里仍可能带“拍摄中”标签,但**不代表已开始录制**;具体待开拍阶段看 `ui.phase`。 + +可单独打开 [HTTP完整快照示例.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页接口示例/HTTP完整快照示例.json),与 WS 完整示例比较结构。 + +为减少重复,此例不展开 `plane_status.planes` 的设备列表,当前任务设备已经在 `current_plane` 展开;实际响应可带完整景区设备列表。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 12, + "snapshot_kind": "full", + "state_updated_at": "2026-11-06 10:00:00", + "metrics_updated_at": "2026-11-06 09:59:55", + "metrics_stale": false, + "shoot_complete_returning": false, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "scenic": { + "id": 271, + "name": "示例景区" + }, + "scenic_spot": { + "id": 412, + "name": "示例拍摄点" + }, + "air_line": { + "id": 123, + "name": "示例航线", + "scenic_spot_id": 412, + "estimated_fly_time": 274, + "line_video_duration": 26, + "fly_type": 1 + }, + "header": { + "order_number": "261106000001", + "title": "示例拍摄点 · 示例航线", + "tourist_label": "游客 158****8888", + "tourist_phone_mask": "158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "shot_total": 2, + "shot_remain": 2 + }, + "task": { + "id": 501, + "status": 20, + "status_label": "执行中", + "task_uuid": "11111111-1111-4111-8111-111111111111", + "wayline_task_id": 9001, + "wayline_status": 20, + "wayline_status_label": "拍摄中" + }, + "order_flight_task": { + "id": 501, + "order_id": 10001, + "order_number": "261106000001", + "scenic_id": 271, + "store_id": 12, + "store_user_id": 88, + "scenic_spot_id": 412, + "air_line_id": 123, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "wayline_task_id": 9001, + "task_uuid": "11111111-1111-4111-8111-111111111111", + "seq": 1, + "spot_attempt": 1, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-06 09:59:00", + "finished_at": null, + "medias": [] + }, + "current_plane": { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + }, + "airport_status": { + "sn": "DEMO_DOCK_SN", + "status": 2, + "task_type": 2, + "work_status_label": "拍摄中" + }, + "plane_status": { + "scenic_id": 271, + "connected": true, + "has_idle": false, + "has_shooting": true, + "planes": [], + "recommend": { + "id": 58, + "sn_number": "DEMO_DOCK_SN", + "work_status": 2 + }, + "poll_hint_ms": 5000 + }, + "poll_hint_ms": 5000, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "95%", + "raw": 95, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "19.6℃", + "raw": 19.6 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "2m/s", + "raw": 2 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "running", + "message": "任务执行中,请等待结束或返航后再试", + "primary_action": "blocked", + "primary_action_label": "执行中" + }, + "flight_control": { + "state": "executing", + "is_airborne": true, + "pause_reason": "arrival_wait", + "resume_phase": "arrived_pending_start", + "return_reason": null, + "can_pause": true, + "can_resume": false, + "can_return_home": true, + "dji_task_status": "paused", + "drone_in_dock": "outside", + "execution_batch": 9001, + "pending_command": null, + "evidence": { + "drone_in_dock": "outside", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "ui": { + "phase": "arrived_pending_start", + "title": "无人机已到达 是否开始拍摄?", + "message": "确认游客站位与取景后开始", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ] + } + }, + "time": "2026-11-06 10:00:00" +} +``` + +### 3.3 返回字段如何影响页面 + +| 字段 | 页面用途 / 处理规则 | +| --- | --- | +| `header`、`scenic_spot`、`air_line` | 顶部点位、航线、游客、套餐摘要 | +| `order_flight_task_id`、嵌套任务身份 | 确认数据属于当前页;订单 / 景区等已提供身份也参与核对 | +| `execution_batch` | 区分重召唤前后;不将旧批次数据合并进新批次 | +| `state_version` | 同批次新旧顺序;旧版本丢弃,相同版本作重复包处理 | +| `snapshot_kind=full` | 完整快照,按整份替换;不保留上份快照的返航标记或旧许可 | +| `ui.phase` | 主要业务阶段来源,由 App 映射本地展示枚举和文案 | +| `ui.title/message/primary_action/commands` | 后端提示与诊断信息;当前产品文案、按钮展示在 App 本地映射,安全权限不直接照 `commands` 放行 | +| `flight_control` | 设备控制态、暂停来源、返航来源、暂停 / 继续 / 返航许可 | +| `execute_gate` | **只控制开始拍摄**,不作为安全按钮或重召唤的总开关 | +| `restart_gate` | **只控制重新召唤**,仍需可信回巢、设备空闲与本地防重等校验 | +| `current_plane.work_status` | 设备忙闲;不能用 `1=空闲` 推断本批次已经返航 | +| `task.status` / `order_flight_task.status` | 订单飞行任务进度与终态;两份状态若冲突,需要只读核对 | +| `task.wayline_status` | 航线拍摄、下载、上传、渲染的细分阶段,不能与任务 status 混用 | +| `shoot_complete_returning`、`ui.wayline_stage` | 可信正常拍完返航的补充依据,不可覆盖失败 / 手动返航 / 身份冲突 | +| `poll_hint_ms` / `plane_status.poll_hint_ms` | HTTP 兜底建议间隔,App 有本地默认及限幅 | + +### 3.4 `flight_control` 逐字段解释 + +| 字段 | 值 / 含义 | +| --- | --- | +| `state` | `starting` 起飞准备、`executing` 执行、`paused` 手动暂停、`returning` 返航、`returned` 已回巢、`unknown` 待核对 | +| `is_airborne` | `true` 有在飞证据;`false` 明确不在飞;`null` 遥测未知,不能擅自当 false | +| `pause_reason` | `arrival_wait` 到点自动悬停;`manual` 用户暂停确认;`null` 无明确暂停来源 | +| `resume_phase` | 继续后恢复到 `going_to_spot` / `arrived_pending_start` / `shooting` / `returning` | +| `return_reason` | `manual` 手动中断、`normal_complete` 正常拍完、`abnormal` 异常返航,或未知 | +| `can_pause` | 后端明确允许紧急暂停 | +| `can_resume` | 后端明确允许继续任务 | +| `can_return_home` | 后端明确允许立即返航 | +| `drone_in_dock` | `inside` 在巢、`outside` 舱外、`null` 未知;在巢未起飞不等于已返航 | +| `execution_batch` | 飞控状态所属批次,必须与当前快照一致 | +| `pending_command` | 当前指令及其进度,详见第 7 节 | +| `dji_task_status` | 司空原始航线态,用于对照;单独 `paused` 不能当成手动暂停 | +| `evidence` | 后端判定证据;可能包含 `ever_left_dock`、`ever_airborne`、`probe_ok`、无人机 SN、遥测来源 / 高度 / 速度等。App 不根据任意 evidence 键重新实现后端飞控判定 | + +本例 `dji_task_status=paused`,但 `pause_reason=arrival_wait`、`state=executing`,应显示**已到达待开拍**。只有可信的 `paused + pause_reason=manual` 才展示手动暂停。 + +安全控制还需要同任务、同批次、可信设备身份和本地提交状态。**`can_*=true` 是后端许可,不是绕过本地校验的入口**。`is_airborne=null` 不单独否决明确许可;`state=unknown` 不因某个 `can_*` 为 true 自动开放操作。 + +### 3.5 六项指标与刷新 + +| key | 含义 | 示例 `value` | +| --- | --- | --- | +| `battery` | 电量 | `95%` | +| `env_temp` | 环境温度 | `19.6℃` | +| `wind_speed` | 风速 | `2m/s` | +| `rainfall` | 降雨 | `无雨` | +| `signal` | 信号 | `无信号` | +| `satellite` | 搜星 | `32颗` | + +- `value` 是后端格式化文本;`raw` 可能是数字、字符串、null,缺失不能当 0;`source` 按原回包保留,不代表全部指标来自同一个物模型。 +- `metrics_updated_at` 是实际读数采集时间;`state_updated_at` 是业务状态写入时间;顶层 `time` 是接口回包时间,三者不能互换。 +- 后端合同约定:有活跃任务快照后,单任务约 **15 秒**节流补采;有新读数 / 采集时间 / 过期状态变化才递增版本并推送,**不依赖 App 持续请求 `shooting` 或 `live`**。 +- 超过约 **120 秒**没有有效新读数时 `metrics_stale=true`,保留最近值;恢复读数后再推 `false` 与新采集时间。15 秒是服务端补采节流,不是保证每 15 秒所有数值必须变化。 + +## 4. `GET /api/app/socket-token`:获取 WS 票据 + +### 入参 + +```text +GET /api/app/socket-token +``` + +无业务 Query、无 JSON 请求体,沿用当前登录身份。 + +### 返回 JSON + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "account_type": "store_user", + "expire_seconds": 3600, + "socket_token": "EXAMPLE_SOCKET_TOKEN" + }, + "time": "2026-11-06 10:00:00" +} +``` + +| 字段 | 说明 | +| --- | --- | +| `socket_token` | 用于下一次 310 订阅;不是登录 token,也不是图传 token | +| `expire_seconds` | 票据有效时长(秒),合同默认约 3600;每轮重连重新取票 | +| `account_type` | 服务端识别的账号类别;iOS 当前票据模型只消费前两项 | + +只拿到票据不代表订阅成功。不能凭票据接口成功、Socket 已连接或 `Opened` 就停掉 HTTP 兜底。 + +## 5. `/wss`:任务状态实时通道 + +### 5.1 建连和订阅 + +正式:`wss://api.zhifly.cn/wss`;测试:`wss://api-test.zhifly.cn/wss`。与当前 HTTP 环境保持一致。 + +服务端先返回纯文本 `Opened`,App 再显式发送一次 **JSON 文本帧**: + +```json +{ + "type": 310, + "params": { + "id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN" + } +} +``` + +`id` 仍是 `order_flight_task.id=501`。不把订阅参数拼进握手 Query,也不把 310 编码成 binary 帧。 + +| 收到的帧 | 说明 | 能否停止 HTTP 兜底 | +| --- | --- | --- | +| `Opened` | Socket 握手成功 | 否 | +| `data.ack=ready` | 服务端验证下行文本帧 | 否 | +| `data.ack=received` | 服务端收到了 310 | 否 | +| `ack=subscribe` 且 `subscribed=true` | 正式订阅成功 | 还需有效完整快照 | +| `ack=subscribe_meta` | 补充缓存有无与版本 | 仍要满足完整快照条件 | +| `action=app_airport_shooting_updated` | 完整任务快照 | 通过身份 / 批次 / 版本校验后可作为实时数据 | + +`ready` 与 `received` 是诊断回执,不等于正式订阅。 + +### 5.2 正式订阅成功 JSON + +```json +{ + "code": 100000, + "msg": "OK", + "data": { + "type": 310, + "ack": "subscribe", + "subscribed": true, + "order_flight_task_id": 501, + "has_snapshot": null, + "state_version": 0, + "execution_batch": 9001, + "hint": "订阅成功" + } +} +``` + +`has_snapshot=null` 表示此时尚未检查缓存,不等于 false。随后若收到缓存元数据: + +```json +{ + "code": 100000, + "msg": "OK", + "data": { + "type": 310, + "ack": "subscribe_meta", + "subscribed": true, + "order_flight_task_id": 501, + "has_snapshot": true, + "state_version": 12, + "execution_batch": 9001, + "hint": "订阅成功,即将推送完整快照" + } +} +``` + +无缓存时,同结构 `has_snapshot=false`,App 重新发起 `GET shooting` 获取全量。**这次读请求必须是在当前无缓存通知之后发起的,不能用页面留存的旧快照充当当前订阅首包。** + +### 5.3 推送 JSON + +下面是推送结构节选,`params` 在实际协议中必须携带第 3.2 节那样的完整 `data`,不是只推发生变化的字段。完整展开示例另存为[WS完整快照示例.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页接口示例/WS完整快照示例.json)。 + +```json +{ + "code": 100000, + "msg": "OK", + "data": { + "action": "app_airport_shooting_updated", + "params": { + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 12, + "snapshot_kind": "full", + "ui": { + "phase": "arrived_pending_start" + } + } + } +} +``` + +关系是:**HTTP `response.data` = WS `response.data.params` 的业务结构**。两端共用任务阶段和版本校验;完整快照可以跳版本覆盖,同批次同版本不重复驱动 UI。 + +### 5.4 失败、超时与 HTTP 兜底 + +票据失效: + +```json +{ + "code": 100098, + "msg": "Token 校验失败或已过期", + "data": { + "type": 310, + "ack": "subscribe", + "subscribed": false + } +} +``` + +无权限: + +```json +{ + "code": 100099, + "msg": "无权订阅该飞行任务", + "data": { + "type": 310, + "ack": "subscribe", + "subscribed": false + } +} +``` + +鉴权服务超时示例,必须与“明确无权限”区分。**下例 `100099` 仅为示意,合同没有约定鉴权超时专用错误码;识别需结合 `type=310`、`ack=subscribe`、`subscribed=false` 和 `hint` 中的“鉴权超时”。** + +```json +{ + "code": 100099, + "msg": "鉴权超时", + "data": { + "type": 310, + "ack": "subscribe", + "subscribed": false, + "hint": "鉴权超时,请稍后重试" + } +} +``` + +| 情况 | App 处理 | +| --- | --- | +| `100098` | 换 Socket 票据再重连;不等同于 App 登录失效 | +| 明确无权访问当前任务 | 停止该任务 HTTP / WS 读取,提示权限问题 | +| 正式失败回执 `hint` 含“鉴权超时” | 保留 HTTP 兜底,按服务暂不可用重连;不永久停读 | +| 只有 `ready/received`,迟迟没有 `subscribe` | 尚未订阅成功;保留 HTTP 兜底,超时重连 | +| `has_snapshot=false` | 串行补读一次新的 HTTP 全量;成功后才能结合正式 ack 认定实时链路可用 | +| Socket 断开 / 心跳异常 | 恢复 HTTP 兜底并退避重连,重新取票 | + +服务端合同目标是正式回执约 2 秒内返回,鉴权有约 3 秒硬超时;App 仍保留约 **12 秒**订阅 / 首包等待上限。合同目标不等于只等 2 秒就判断网。 + +HTTP 兜底默认 **5 秒串行**,间隔按后端建议限制在 **2~30 秒**。WS 健康且拿到有效快照后停常规轮询;拍摄中连续约 120 秒没有有效状态包会主动核对。当前 Android 业务阶段未知时仍会核对 HTTP;iOS 对过期指标也有额外读取兜底,具体见源码。 + +### 5.5 离页退订 + +```json +{ + "type": 311, + "params": { + "id": 501 + } +} +``` + +**311 是取消订阅,绝不是推送消息类型。** 离页 / 后台停止本页读取并关闭本页连接;回前台重新读取与订阅。Ping/Pong 使用 WebSocket 传输层,不另调用 REST 心跳接口。 + +## 6. `GET /api/app/airport/live`:获取实时图传参数 + +### 6.1 入参 + +```text +GET /api/app/airport/live?id=501 +``` + +只有 Query `id`,没有 JSON 请求体。**该接口可能启动设备推流**,不能把它理解成纯状态查询。 + +### 6.2 返回 JSON:两路均可用 + +以下为火山 `volc` 连接格式示例,所有凭证均为无效占位值。`url` 是 RTC 连接参数串,不是可以直接交给普通视频播放器的 MP4 / HLS 地址。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "playable": true, + "unavailable_code": "", + "unavailable_message": "", + "protocol": { + "name": "dji_fh_live_stream", + "vendor_source": "fh2_dynamic", + "supported_url_types": [ + "agora", + "volc", + "tencent" + ], + "side_effect": "starts_device_push", + "refresh_hint_ms": 30000, + "token_ttl_seconds": 3600 + }, + "airport": { + "available": true, + "role": "airport", + "device_sn": "DEMO_DOCK_SN", + "url_type": "volc", + "url": "app_id=EXAMPLE_APP_ID&expire_time=1793932800&room_id=DEMO_DOCK_ROOM&token=EXAMPLE_RTC_TOKEN&user_id=EXAMPLE_VIEWER_ID", + "expire_ts": 1793932800, + "expire_in_sec": 2400, + "vendor": "volcengine", + "message": "", + "raw": {} + }, + "drone": { + "available": true, + "role": "drone", + "device_sn": "DEMO_DRONE_SN", + "url_type": "volc", + "url": "app_id=EXAMPLE_APP_ID&expire_time=1793932800&room_id=DEMO_DRONE_ROOM&token=EXAMPLE_RTC_TOKEN&user_id=EXAMPLE_VIEWER_ID", + "expire_ts": 1793932800, + "expire_in_sec": 2400, + "vendor": "volcengine", + "message": "", + "raw": {} + }, + "play": { + "available": true, + "role": "drone", + "device_sn": "DEMO_DRONE_SN", + "url_type": "volc", + "url": "app_id=EXAMPLE_APP_ID&expire_time=1793932800&room_id=DEMO_DRONE_ROOM&token=EXAMPLE_RTC_TOKEN&user_id=EXAMPLE_VIEWER_ID", + "expire_ts": 1793932800, + "expire_in_sec": 2400, + "vendor": "volcengine", + "message": "", + "raw": {} + }, + "task": { + "id": 501, + "task_uuid": "11111111-1111-4111-8111-111111111111", + "wayline_task_id": 9001, + "status": 20, + "status_label": "拍摄中", + "drone_sn": "DEMO_DRONE_SN" + }, + "metrics": [] + }, + "time": "2026-11-06 10:00:00" +} +``` + +| 字段 | 含义 | +| --- | --- | +| `airport` | 机巢舱摄像头流参数 | +| `drone` | 无人机摄像头流参数;初期可能尚未上报 SN 或不可用 | +| `play` | 服务端推荐流,通常无人机优先;App 仍分别管理两路首帧与切换 | +| `available` | 该路是否有可用参数,不等于已经收到视频帧 | +| `playable` | 后端提供了可播放配置,不等于本机 RTC 已入房 / 已有画面 | +| `url_type` / `vendor` | RTC 厂商类型 | +| `url` | 按厂商解析的参数串;火山解析 `app_id/room_id/user_id/token/expire_time` | +| `expire_ts` | 绝对到期时间(Unix 秒);不是毫秒 | +| `expire_in_sec` | 回包时距离到期的剩余秒数 | +| `protocol.refresh_hint_ms` | 缺流补查建议,默认 30000 毫秒 | +| `protocol.token_ttl_seconds` | 合同默认票据有效期说明;实际续期以本路明确的到期时间为准 | +| `raw` | 厂商原始扩展参数,不依赖未约定的任意键实现业务 | + +合同枚举了 `agora/volc/tencent`,**当前两端实际接入的是火山 `volc`**。合同列出厂商不等于 App 已实现所有 SDK。 + +图传不可用时的返回示例: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "playable": false, + "unavailable_code": "stream_unavailable", + "unavailable_message": "开启直播流失败", + "play": null, + "airport": { + "available": false, + "role": "airport", + "url": "", + "message": "开启直播流失败" + }, + "drone": { + "available": false, + "role": "drone", + "url": "", + "message": "飞行器尚未上报 SN,暂无机载图传" + } + }, + "time": "2026-11-06 10:00:00" +} +``` + +### 6.3 当前 App 如何接收 + +- 页面可见、任务身份有效且未进入录制结束流程时自动获取;普通 `shooting` / WS 刷新不会反复启动图传。 +- 先接收机巢画面,收到无人机实际视频帧后切换;无人机停流 / 卡顿 / 失败时退回仍有画面的机巢。两路都没画面时显示等待,不能把旧静止帧标成实时。 +- 缺一路参数时补取 `live`:默认 30 秒,建议间隔限在 5~60 秒;凭证提前约 30 秒续取,补查最小间隔约 5 秒。 +- 录制完成、离页或后台停止**本地 RTC 接收**,取消补流和续期。不会因退出页面调用设备停流或返航接口。 +- `live` 中附带的 `metrics/task` 不能取代 `shooting` / WS 的完整业务快照。图传连接成功也不能用来推导“已到达”“已返航”。 + +## 7. `POST /api/app/airport/command`:紧急暂停、继续、立即返航 + +### 7.1 入参 + +| 字段 | 类型 | 合同必填 | 当前 App 行为 | +| --- | --- | --- | --- | +| `id` | int | 是 | 原订单飞行任务 `501` | +| `command` | string | 是 | 只发送当前按钮对应的已知指令 | +| `client_request_id` | string | 合同可选 | **App 每次点击均生成并发送**,用于幂等关联 | + +当前页面的三个按钮 / 操作: + +| 操作 | `command` | +| --- | --- | +| 紧急暂停 | `flighttask_pause` | +| 继续任务 | `flighttask_recovery` | +| 立即返航 | `return_home` | + +暂停请求: + +```json +{ + "id": 501, + "command": "flighttask_pause", + "client_request_id": "EXAMPLE-REQUEST-PAUSE-001" +} +``` + +继续请求: + +```json +{ + "id": 501, + "command": "flighttask_recovery", + "client_request_id": "EXAMPLE-REQUEST-RESUME-001" +} +``` + +立即返航请求: + +```json +{ + "id": 501, + "command": "return_home", + "client_request_id": "EXAMPLE-REQUEST-RETURN-001" +} +``` + +`return_home_cancel` 虽在后端合同 / 本地白名单中定义,**当前页面未开放该按钮和操作权限**。上述按钮点击后直接提交,不再弹二次确认;仅对应按钮显示 loading。 + +当前本地安全控制按下表筛选,再叠加后端对应 `can_*` 与任务身份 / 提交状态校验: + +| 可信 `flight_control.state` | 可参与授权的操作 | +| --- | --- | +| `starting` | 立即返航 | +| `executing` | 紧急暂停、立即返航 | +| `paused`(`pause_reason=manual`) | 继续任务、立即返航;返航中暂停后不重复发返航 | +| `returning` | 紧急暂停 | +| `returned` / `unknown` | 不开放安全指令;重新召唤使用独立门禁 | + +### 7.2 返回 JSON:暂停已受理,尚待设备确认 + +下面示例假定从拍摄中点击暂停。回执里仍是 `executing`,是因为设备尚未确认暂停,不能靠 `accepted=true` 提前改成“已暂停”。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "accepted": true, + "device_confirmed": false, + "acceptance": "accepted", + "hint": "指令已受理,等待状态确认", + "command": "flighttask_pause", + "command_id": "EXAMPLE-CMD-PAUSE-001", + "client_request_id": "EXAMPLE-REQUEST-PAUSE-001", + "pending_command": { + "command_id": "EXAMPLE-CMD-PAUSE-001", + "client_request_id": "EXAMPLE-REQUEST-PAUSE-001", + "command": "flighttask_pause", + "status": "pending" + }, + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 18, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "dji_status": "executing", + "drone_in_dock": "outside", + "is_airborne": true, + "flight_control": { + "state": "executing", + "is_airborne": true, + "pause_reason": null, + "resume_phase": "shooting", + "return_reason": null, + "can_pause": true, + "can_resume": false, + "can_return_home": true, + "dji_task_status": "executing", + "drone_in_dock": "outside", + "execution_batch": 9001, + "pending_command": { + "command_id": "EXAMPLE-CMD-PAUSE-001", + "client_request_id": "EXAMPLE-REQUEST-PAUSE-001", + "command": "flighttask_pause", + "status": "pending" + }, + "evidence": { + "drone_in_dock": "outside", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "metrics": [] + }, + "time": "2026-11-06 10:00:00" +} +``` + +### 7.3 设备确认后从 shooting / WS 获得的新状态 + +以下是**完整快照内的关键字段节选**,不是另一种 command 请求。 + +```json +{ + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 19, + "ui": { + "phase": "manual_paused" + }, + "flight_control": { + "state": "paused", + "is_airborne": true, + "pause_reason": "manual", + "resume_phase": "shooting", + "return_reason": null, + "can_pause": false, + "can_resume": true, + "can_return_home": true, + "dji_task_status": "paused", + "drone_in_dock": "outside", + "execution_batch": 9001, + "pending_command": { + "command_id": "EXAMPLE-CMD-PAUSE-001", + "client_request_id": "EXAMPLE-REQUEST-PAUSE-001", + "command": "flighttask_pause", + "status": "succeeded" + }, + "evidence": { + "drone_in_dock": "outside", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + } +} +``` + +`pending_command.status` 的含义: + +| 值 | 说明 | App 行为 | +| --- | --- | --- | +| `pending` | 等设备确认 | 对应按钮继续等待,中央保留已确认业务状态 | +| `succeeded` | 指令已确认 | 结束对应等待;中央和权限仍按完整快照更新 | +| `failed` | 指令明确失败 | 结束该操作等待并显示错误,允许状态核对 | +| `superseded` | 已被后续指令取代 | 旧回执不能恢复旧 loading 或旧状态 | + +`command_id` 是服务端指令 ID,`client_request_id` 是本次点击的客户端 ID,二者都不是任务 ID。`state_version` 还用于防止接受回执之后被旧快照回退。 + +### 7.4 继续任务和返航分别会发生什么 + +继续任务设备确认后的回执关键字段节选: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 21, + "accepted": true, + "device_confirmed": true, + "acceptance": "device_confirmed", + "command": "flighttask_recovery", + "command_id": "EXAMPLE-CMD-RESUME-001", + "client_request_id": "EXAMPLE-REQUEST-RESUME-001", + "pending_command": { + "command_id": "EXAMPLE-CMD-RESUME-001", + "client_request_id": "EXAMPLE-REQUEST-RESUME-001", + "command": "flighttask_recovery", + "status": "succeeded" + }, + "flight_control": { + "state": "executing", + "pause_reason": null, + "resume_phase": "shooting", + "return_reason": null, + "is_airborne": true, + "drone_in_dock": "outside", + "can_pause": true, + "can_resume": false, + "can_return_home": true, + "execution_batch": 9001 + } + }, + "time": "2026-11-06 10:00:00" +} +``` + +- 继续请求受理但设备仍 paused 时,应继续显示暂停;设备确认 executing 后才恢复相应业务阶段。 +- `resume_phase=arrived_pending_start` 表示恢复待开拍,后端只解除手动暂停,不直接开拍。 +- `resume_phase=returning` 表示恢复返航,不应回到普通拍摄中。 + +手动返航受理回执关键字段节选: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 22, + "accepted": true, + "device_confirmed": false, + "acceptance": "accepted", + "command": "return_home", + "command_id": "EXAMPLE-CMD-RETURN-001", + "client_request_id": "EXAMPLE-REQUEST-RETURN-001", + "pending_command": { + "command_id": "EXAMPLE-CMD-RETURN-001", + "client_request_id": "EXAMPLE-REQUEST-RETURN-001", + "command": "return_home", + "status": "pending" + }, + "flight_control": { + "state": "returning", + "pause_reason": null, + "resume_phase": "returning", + "return_reason": "manual", + "is_airborne": true, + "drone_in_dock": "outside", + "can_pause": true, + "can_resume": false, + "can_return_home": false, + "execution_batch": 9001 + } + }, + "time": "2026-11-06 10:00:00" +} +``` + +此例沿用后端合同中 `device_confirmed=false` 与 `flight_control.state=returning` 并存的组合。前者是本次指令的确认字段,**不是“是否已回巢”字段**;后者是服务端给出的当前控制态。不要因为两者并存就自行补造确认过程,App 仍用后续完整快照更新中央状态。 + +后续完整任务快照应同步 `ui.phase=returning_home`、任务 `status=40`、`result_code=return_home`。这是“手动中断后返航”,不应显示正常拍完成功弹窗。 + +真正回巢后才应出现 `flight_control.state=returned`。机巢若仍 `work_status=2`,重召唤仍关闭(`await_dock_idle`);不能因为接口受理、任务失败、设备释放接单或等待了一段时间就认定回巢。 + +### 7.5 回执不会直接替代完整快照 + +`accepted` 只表示接口受理;`device_confirmed` 表示回执探测时是否已看到对应设备态。回执不一定包含页面所需全部数据,App 还要通过同任务的 `shooting` / WS 核对。 + +当前 UI 不显示“指令已受理”作为中央状态,仅在对应按钮显示等待;网络结果未知时只查询原任务,不自动重发控制请求。服务端允许后续指令取代旧意图,本地也不会因为一个动作等待而无条件封锁另一个安全动作。 + +## 8. `POST /api/app/airport/start-shoot`:手动开拍 + +### 入参 + +```json +{ + "id": 501 +} +``` + +仅传已有任务 ID。后端从任务查锁定飞机与航线,App 不在开拍请求里重选设备或修改航线。 + +前提是可信的已到达待开拍阶段、`execute_gate.can_execute=true`、`primary_action=start_shoot`,并通过当前任务身份 / 飞控 / 本地防重等校验。开拍不是 `command=flighttask_recovery` 的替代写法。 + +### 返回 JSON + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "task_uuid": "11111111-1111-4111-8111-111111111111", + "order_flight_task_id": 501, + "order_flight_task": { + "id": 501, + "order_number": "261106000001", + "scenic_id": 271, + "status": 20, + "status_label": "执行中", + "wayline_task_id": 9001 + }, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "ui": { + "phase": "shooting", + "title": "无人机正在拍摄中", + "message": "请关注现场及实时画面。请勿关闭本页或息屏。", + "primary_action": "shooting", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ] + } + }, + "time": "2026-11-06 10:00:00" +} +``` + +`order_flight_task_id` 必须与请求一致。回执的 `ui` 描述受理结果,最终阶段由后续完整快照核对;不能凭 POST 成功推断素材已经存在。 + +**30 秒倒计时没有接口。** App 首次接受本批次可信到达快照后本地计时,按钮显示“开始拍摄(30s)”;同批次刷新不重置,归零不自动调用开拍。倒计时与手动点击不冲突,后台自动开拍后按新快照切换 UI。 + +## 9. `POST /api/app/airport/shoot`:本页用于重新召唤 + +### 入参 + +```json +{ + "id": 501, + "restart": true +} +``` + +| 参数 | 当前任务页发送方式 | +| --- | --- | +| `id` | 复用原订单飞行任务 `501` | +| `restart` | `true`,表示重召唤 | +| `plane_id`、`air_line_id` | 合同可选;当前页面**不传**,由后端复用任务 / 重新分配锁定设备 | + +不是 `tasks/create`,也不把此前回包的航线 `task_id` 当作新请求 ID。 + +### 返回 JSON:新航线批次 9002 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task": { + "id": 501, + "order_id": 10001, + "order_number": "261106000001", + "scenic_id": 271, + "store_id": 12, + "store_user_id": 88, + "scenic_spot_id": 412, + "air_line_id": 123, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "wayline_task_id": 9002, + "task_uuid": "22222222-2222-4222-8222-222222222222", + "seq": 1, + "spot_attempt": 2, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-06 10:10:00", + "finished_at": null, + "medias": [] + }, + "order_progress": { + "order_number": "261106000001", + "package_name": "航拍套餐 · 含 2 次拍摄", + "shot_total": 2, + "shot_used": 0, + "shot_remain": 2, + "status_label": "待拍摄" + }, + "restart": true, + "accepted": true, + "task_id": 9002, + "task_uuid": "22222222-2222-4222-8222-222222222222", + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "air_line_id": 123, + "air_line_name": "示例航线", + "ui": { + "phase": "going_to_spot", + "title": "正在重新召唤无人机", + "message": "已受理起飞指令,请轮询 shooting 确认到达后再开始拍摄", + "primary_action": "wait_arrive" + } + }, + "time": "2026-11-06 10:10:00" +} +``` + +关键是:**订单飞行任务仍为 501,航线任务变成 9002。** 下一次 `shooting/live/start-shoot/command` 仍传 `id=501`,新完整快照应返回 `execution_batch=9002`。 + +当前 App 要求重召唤门禁允许、设备确认已回巢且空闲、任务未成功计次 / 未取消、本地无未核对提交等。受理后的 `going_to_spot` 可用于前往点位过渡,不等于已经起飞或到达。新批次会清旧暂停、返航、倒计时与指令等待上下文。 + +## 10. 看 JSON 时最容易混淆的状态 + +### 10.1 订单任务 status 与航线 wayline_status + +| 字段 | 数值 | 含义 | +| --- | --- | --- | +| `task.status` / `order_flight_task.status` | `10 / 20 / 25 / 30 / 40 / 50 / 60` | 待执行 / 执行中 / 素材上传中 / 成功 / 失败 / 取消 / 待确认 | +| `task.wayline_status` | `10 / 20 / 24 / 30 / 40 / 50` | 待拍摄 / 拍摄中 / 下载中 / 上传中 / 渲染中 / 已完成 | +| `task.wayline_status` | `29 / 39 / 49 / 90 / 91` | 拍摄失败 / 上传失败 / 渲染失败 / 取消 / 执行失败 | + +同一个数字在不同字段完全不同:**任务 status=40 是失败,航线 wayline_status=40 是渲染中。** + +`order_type=25` 是“多点位航拍”的订单类型;`task.status=25` 是“素材上传中”的任务状态,两者也无关。订单列表 `active_task_status=25` 是任务摘要,**不是 `order_status` 新增 25**。总订单仍可 `order_status=20` 进行中;剩余次数允许时,旧任务上传不阻止下一次拍摄。 + +### 10.2 `ui.phase` 与页面展示 + +| `ui.phase` | 主要含义 | 注意事项 | +| --- | --- | --- | +| `going_to_spot` | 前往点位,含起飞准备 | `starting + inside` 不是已回巢 | +| `arrived_pending_start` | 已到达待开拍 | 到点悬停不是手动暂停;开拍按钮另查门禁 | +| `shooting` | 正在拍摄 | 显示“无人机正在拍摄中” | +| `manual_paused` | 手动暂停 | 需可信 `paused/manual`;按钮为“继续任务” | +| `returning_home` | 手动中断后的返航 | 与正常拍完返航区分 | +| `post_shoot_uploading` | 录制结束,返航 / 下载 / 上传 / 渲染 | 当前产品显示“拍摄已完成”,不等于素材就绪 | +| `post_shoot_upload_failed` | 录制已结束,素材处理失败 | 不因素材失败自动重飞,不弹拍完成功提示 | +| `completed` | 素材就绪 / 任务成功 | 可以查看素材;需与任务状态一致 | +| `failed_restartable` | 失败 / 中断 | 只有回巢和门禁满足后才能重召唤 | +| `blocked` | 后端阻止当前主操作 | 仍需独立检查安全权限,不能当所有按钮总锁 | +| `waiting_summon` | 待首次召唤 | 当前常规流程在准备页完成首次召唤 | + +**“状态待确认”是 App 的本地展示状态,不是后端某一个固定 status 数值。** 未知阶段、任务身份 / 批次不符、终态冲突等都可能进入核对。飞控暂时 unknown 不应抹掉可信的录制结束业务进度,但仍不能开放设备控制或凭空认定已回巢。 + +### 10.3 正常拍完返航与手动返航的对照 + +以下仅为完整快照中关键字段的节选。正常拍完与手动中断是**不同业务分支**,不能把第一份、第二份示例理解为同一次正常拍完之后又改成失败;第二份到第三份才是同一手动返航分支的前后变化。 + +正常拍完开始返航: + +```json +{ + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 30, + "shoot_complete_returning": true, + "task": { + "id": 501, + "status": 25, + "wayline_status": 24 + }, + "order_flight_task": { + "id": 501, + "status": 25, + "result_code": "" + }, + "ui": { + "phase": "post_shoot_uploading", + "wayline_stage": "shoot_done_returning", + "shoot_complete_returning": true, + "title": "拍摄已完成", + "message": "无人机正在返航,请留意现场" + }, + "flight_control": { + "state": "returning", + "return_reason": "normal_complete", + "drone_in_dock": "outside", + "is_airborne": true, + "execution_batch": 9001, + "can_pause": true, + "can_resume": false, + "can_return_home": false + } +} +``` + +手动返航途中: + +```json +{ + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 31, + "shoot_complete_returning": false, + "task": { + "id": 501, + "status": 40 + }, + "order_flight_task": { + "id": 501, + "status": 40, + "result_code": "return_home", + "result_message": "立即返航中断任务" + }, + "ui": { + "phase": "returning_home" + }, + "flight_control": { + "state": "returning", + "return_reason": "manual", + "drone_in_dock": "outside", + "is_airborne": true, + "execution_batch": 9001, + "can_pause": true, + "can_resume": false, + "can_return_home": false + }, + "restart_gate": { + "can_restart": false + } +} +``` + +手动返航已经回巢且机巢空闲: + +```json +{ + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 32, + "task": { + "id": 501, + "status": 40 + }, + "order_flight_task": { + "id": 501, + "status": 40, + "result_code": "return_home" + }, + "ui": { + "phase": "failed_restartable" + }, + "flight_control": { + "state": "returned", + "return_reason": "manual", + "drone_in_dock": "inside", + "is_airborne": false, + "execution_batch": 9001, + "can_pause": false, + "can_resume": false, + "can_return_home": false + }, + "current_plane": { + "id": 58, + "sn_number": "DEMO_DOCK_SN", + "work_status": 1 + }, + "restart_gate": { + "can_restart": true, + "code": "ok" + } +} +``` + +第一种可以触发正常录制完成提示;第二、三种仍是拍摄中断,第三种才具备重新评估召唤的设备条件。进入后续上传 / 渲染时,完整快照应清返航标记并更新说明,不残留“正在返航”。 + +## 11. 哪些变化没有单独接口 + +| 页面行为 | 实现方式 | +| --- | --- | +| 开始拍摄按钮的 30 秒倒计时 | App 本地单调计时;无倒计时 API、无归零自动开拍请求 | +| 中央阶段文案 / 图标 | 本地枚举映射 `ui.phase`、任务状态及飞控状态 | +| 对应控制按钮 loading | 本地请求状态 + `client_request_id/command_id/pending_command` | +| 拍摄完成提示弹窗 | 可信录制结束快照触发,按任务和批次去重 | +| 停止本机图传 | RTC 本地释放接收端,无单独业务 HTTP 停流接口 | +| 点击查看素材 | 跳订单素材库,后续素材接口属于素材页,不算本页额外请求 | +| 首次创建任务 / 确认并召唤 | 在准备页调用;本页不重复创建 | + +后端合同中的 `airport/task-info`、`airport/status`、`order-flight-task/detail` 等并非当前拍摄任务页实际使用的数据入口,不能因为文档有定义就认定页面都会调用。 + +## 12. 核对来源与代码入口 + +| 范围 | 来源 | +| --- | --- | +| 后端合同原文 | [随心瞰9.9.1-App机巢与素材库接口.md](/Users/hanqiu/Downloads/随心瞰9.9.1-App机巢与素材库接口.md),§7~§11、§9.1 | +| 六个 HTTP 请求体 / Query | [ShootingAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift)、[SocketTokenAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockSocketTokenAPI.swift)、[LiveAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockLiveAPI.swift)、[StartShootAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockStartShootAPI.swift)、[CommandAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockCommandAPI.swift)、[ShootAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift) | +| HTTP 成功码、请求头 | [APIEnvelope](/Users/hanqiu/Desktop/suixinkan/suixinkan/Core/Networking/APIEnvelope.swift)、[APIClient](/Users/hanqiu/Desktop/suixinkan/suixinkan/Core/Networking/APIClient.swift) | +| 快照 / 飞控模型 | [ShootingModels](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Models/DroneDockShootingModels.swift)、[FlightControl](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Models/DroneDockFlightControl.swift) | +| iOS 业务映射与动作校验 | [ShootingTaskViewModel](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/ViewModels/DroneDockShootingTaskViewModel.swift) | +| iOS WS 协议与读取策略 | [SocketMessage](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Models/DroneDockShootingSocketMessage.swift)、[RealtimeSession](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Services/DroneDockShootingRealtimeSession.swift) | +| iOS 图传及页面生命周期 | [LiveViewModel](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/ViewModels/DroneDockLiveViewModel.swift)、[TaskViewController](/Users/hanqiu/Desktop/suixinkan/suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift) | +| Android 实际调用与解析 | [RemoteDroneTaskViewModel](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/RemoteDroneTaskViewModel.kt)、[DroneTaskSnapshot](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/DroneTaskSnapshot.kt)、[DroneTaskSocket](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/DroneTaskSocket.kt)、[DroneLivePanel](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/DroneLivePanel.kt) | + +本次仅整理文档与示例,没有修改 iOS / Android 业务代码,没有执行真实请求。后端内部实现归属按已确认对接人记录;公共 Socket 基础服务的个人维护归属仍待确认。 + diff --git a/docs/9.9.1/拍摄任务页-接口重构方案-讨论稿.md b/docs/9.9.1/拍摄任务页-接口重构方案-讨论稿.md new file mode 100644 index 0000000..64692ef --- /dev/null +++ b/docs/9.9.1/拍摄任务页-接口重构方案-讨论稿.md @@ -0,0 +1,830 @@ +# 拍摄任务页接口重构方案(讨论稿) + +> **已废弃(2026-11-06)**:本稿早于后续产品确认,包含已取消的权限集合、后端倒计时、素材状态和提前完成规则。请勿按本稿或其配套旧示例实施,改以[拍摄任务页 v2 接口协议-后端实施稿](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页-v2接口协议-后端实施稿.md)为准。 + +版本:v0.1 · 日期:2026-11-06 · 状态:**供产品、App 与朱工讨论,尚未实施,也不是现网接口说明。** + +本文提出新的接口路径、字段和协议;除公共 Socket 票据外,不要求兼容旧拍摄任务页。现有业务详解见[原接口盘点](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页-接口入参与返回JSON详解.md)。文中 ID、凭证和 JSON 都是虚构示例,没有调用真实设备。 + +## 1. 建议采用的方案 + +**一份权威状态 + 一个动作提交入口 + 一个动作结果查询入口 + 独立图传会话 + 带完整首包的 WS 订阅。** + +重点是让每个字段、每次请求只有明确的职责,不以减少接口数量作为唯一目标。 + +| 现有难点 | 新方案 | +| --- | --- | +| `task`、`order_flight_task`、`wayline_status`、`ui.phase` 等可能互相矛盾 | 页面只接收一份归一化状态,拆成拍摄、素材、设备三个部分 | +| 已拍完却因设备 unknown 退回“状态待确认” | 拍摄结果独立保存,设备未知只影响设备信息和相应许可 | +| `execute_gate`、`restart_gate`、`can_*`、`ui.commands` 多套许可 | 只保留 `permissions`;App 不再重复推导后端门禁 | +| 开拍 / 重召 / 指令回执字段各不相同 | 统一 `actions` 与动作记录 `operation` | +| POST 超时,不知道后端有没有执行 | 以客户端请求 ID 只读查询,禁止自动重发真实动作 | +| 正式订阅 ACK / meta / 缓存首包相互等待 | 正式成功 ACK 直接携带完整快照;失败必须明确返回 | +| 只靠无状态推送时间判断掉线 | 心跳携带当前版本,区分无变化、漏推和断线 | +| `GET live` 同时取配置、开流、续期 | POST 申请观看会话;单独续期,不反复启动设备推流 | + +### 已与用户确认的产品约束 + +- 已到达时,“开始拍摄”可手动点击,倒计时不禁用按钮;到零也不由 App 自动开拍。 +- **暂定后端提供自动开拍截止时间,App 只显示。** 若朱工确认无法实现,再讨论改为本地 30 秒;本稿先按后端提供实现,不同时实现两套自动回退。 +- 待开拍倒计时剩 18 秒时暂停,暂停期间冻结,继续后仍倒数 18 秒,由后端给新的截止时间。 +- 首点自动悬停不算手动暂停。继续待开拍只是恢复等待,不直接触发开拍。 +- 正常录制结束、开始返航时即显示“拍摄已完成”,不等待回巢或素材就绪;仅停止本机图传接收。 +- 紧急暂停、继续任务、立即返航直接提交,只在对应按钮 loading,不弹二次确认,也不显示中央“指令已受理”。 +- 返航中可以暂停,继续后仍返航;未拍完手动返航属于中断,回巢且设备可用后才允许重召唤。 +- 旧任务上传不阻止剩余次数允许的下一次拍摄;不新增整单 `order_status=25`。 + +## 2. 范围和接口清单 + +建议统一放在 `/api/app/airport/tasks/{task_id}` 下,路径均为**拟定**。 + +| 方法与路径 | 职责 | 副作用 | +| --- | --- | --- | +| `GET /api/app/airport/tasks/{task_id}/state` | 读取页面完整快照 | 无设备操作,不主动补采物模型 | +| `POST /api/app/airport/tasks/{task_id}/actions` | 召唤、开拍、暂停、继续、返航 | 可能下发设备动作 | +| `GET /api/app/airport/tasks/{task_id}/action-requests/{client_request_id}` | 查询某次点击的处理结果 | 只读,不补发动作 | +| `POST /api/app/airport/tasks/{task_id}/live-sessions` | 申请两路观看会话 | 可能按需启动设备推流 | +| `POST /api/app/airport/tasks/{task_id}/live-sessions/{session_id}/refresh` | 续期 / 发现已登记的缺失来源 | 仅维护会话 / 凭证,不把已有流重新启动 | +| `GET /api/app/socket-token` | 复用公共 Socket 票据 | 无飞控操作 | +| `/wss`,新任务协议 v2 | 订阅完整快照 / 应用心跳 | 无飞控与开流操作 | + +准备页的张工 `tasks/create` 暂不重构,仍创建订单飞行任务。首次召唤和失败后重召唤均改为统一 `action=summon`;两种调用复用同一个订单任务 ID,后端根据当前状态决定首次执行或新建执行批次。订单列表、订单素材库、交付等接口仍按原职责对接,由朱工保持新旧领域数据一致。 + +### 责任分工 + +| 提供方 | 负责内容 | +| --- | --- | +| 朱工 / `service-fly` | 状态归一化、设备证据、动作许可、动作记录与幂等、倒计时调度、指标补采、图传会话 | +| 朱工协调 / `hyperf-socket` | 鉴权、订阅首包、版本化推送、应用心跳、明确错误回执 | +| iOS / Android | 调用与恢复、按本地枚举展示、显示倒计时、按钮等待、RTC 接收与页面生命周期 | +| 张工现有订单接口 | 创建订单任务、次数 / 订单列表 / 素材与交付业务;需与朱工核对投影更新时点 | + +## 3. 通用协议 + +### 3.1 ID、时间和版本 + +| 字段 | 规则 | +| --- | --- | +| `task_id` | 唯一含义:订单飞行任务 ID,即原 `order_flight_task.id`。所有入口、回包和 WS 一致 | +| `execution_id` | 每次召唤生成的执行标识,字符串,不要求 App 知道航线任务 ID;未召唤时为 null | +| `revision` | **整个 task 生命周期单调递增**,重召唤不归零;不是按 execution 重置的版本 | +| `updated_at` | 该版快照实际写入时间;同版本内容必须一致 | +| `server_time` | 每次 HTTP / WS 外壳的服务器当前时间,不参与快照内容比较 | +| 时间格式 | RFC 3339,带时区和毫秒;例如 `2026-11-06T10:00:00.000+08:00` | + +不再把航线 `task_id`、订单飞行任务 `task_id` 混用。内部 `wayline_task_id`、DJI 原始状态和探测证据保留在服务端诊断中,不参与 App 正常业务判定。 + +同一个任务:新版本替换,重复版本忽略,低版本丢弃。`execution_id` 用来隔离动作、倒计时和图传,**不再用它的字符串大小判断新旧**;新旧由 task 级 revision 决定。 + +revision 必须在缓存清空 / 服务重启后仍延续。HTTP、动作回执附带的 snapshot、WS 使用同一份已提交快照,不允许各自重新拼出不同字段组合。 + +### 3.2 外壳、HTTP 状态与错误 + +沿用登录请求头 `token`,成功业务码 `100000`。`request_id` 是服务端本次请求追踪标识,与客户端动作幂等键不同。读取成功 HTTP 200;动作已持久受理且仍处理中 HTTP 202,明确不代表设备动作完成。HTTP 202 的语义参考 [RFC 9110 §15.3.3](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.3.3)。 + +业务失败使用非成功码,本文暂沿用 `100099` 表示一般业务错误;**客户端必须使用结构化 `error.type` 分类,不匹配中文 msg/hint,也不单独靠 100099 判断永久无权限**。具体整数码可由后端统一登记。 + +```json +{ + "code": 100099, + "msg": "当前执行批次已变化,请刷新后重试", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "error": { + "type": "EXECUTION_CHANGED", + "scope": "task_action", + "retryable": false + }, + "data": null +} +``` + +HTTP 400 参数错误、401 登录 / 票据错误、403 权限、404 任务不存在、409 状态 / 幂等冲突、503 临时服务异常,均返回相同结构的 JSON 错误。两端网络层重构时需要保留并解析非 2xx 的业务正文,不能只显示通用网络错误。 + +## 4. `GET state`:一份权威状态 + +```text +GET /api/app/airport/tasks/501/state +``` + +仅传路径 `task_id`,无 `live_battery`、无 `scenic_id`、无 JSON 请求体。服务端按任务与登录账号核验归属。GET 不触发飞控、开流或同步向设备采集。 + +首次进页、回前台、手动刷新和 WS 异常兜底均使用本接口。返回 `data` 就是完整 snapshot: + +```json +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 128, + "updated_at": "2026-11-06T10:00:00.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "ready", + "finished_at": null, + "reason": null + }, + "media": { + "state": "not_started", + "error": null + }, + "flight": { + "mode": "mission", + "hold": "arrival_wait", + "dock_position": "outside", + "airborne": true, + "return_reason": null, + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": true, + "reason": null, + "context_id": "start-context-001" + }, + "pause": { + "allowed": true, + "reason": null, + "context_id": null + }, + "resume": { + "allowed": false, + "reason": { + "code": "NOT_MANUALLY_PAUSED", + "message": "当前没有已确认的手动暂停" + }, + "context_id": null + }, + "return_home": { + "allowed": true, + "reason": null, + "context_id": null + } + }, + "auto_start": { + "state": "counting_down", + "deadline_at": "2026-11-06T10:00:30.000+08:00", + "remaining_ms": null + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [], + "live": { + "allowed": true, + "reason": null + } + } +} +``` + +### 4.1 字段分工 + +| 模块 | 权威内容 | App 如何使用 | +| --- | --- | --- | +| `summary` | 当前订单、点位、航线、游客、设备和封面摘要 | 顶部信息;不承担控制许可 | +| `capture` | 拍摄环节与正常录制完成事实 | 中央业务阶段、完成提示;与素材结果分开 | +| `media` | 下载 / 上传 / 渲染 / 素材就绪 / 失败 | 展示处理情况;不能倒改录制结果 | +| `flight` | 设备事实、手动暂停、返航和位置 | 暂停 / 返航展示;未知不覆盖已完成拍摄 | +| `permissions` | **唯一一套动作许可**和不可操作原因 | 按本地已知按钮映射,不再次拼接旧门禁 | +| `auto_start` | 自动开拍实际计划 | 仅显示倒计时;无本地开拍调度 | +| `telemetry` | 六项指标及每项采集时间 / 过期情况 | 原值展示,保留最近有效值 | +| `operations` | 当前未核对动作及近期结果 | 对应按钮 loading 与恢复;不等同业务阶段 | +| `live` | 此时是否允许本页观看 | 决定是否申请 / 停止本机接收;不含 RTC 凭证 | + +移除面向 App 的重复 `task` / `order_flight_task`、数字 `wayline_status`、`ui.phase`、`ui.commands`、`execute_gate`、`restart_gate`、`shoot_complete_returning`。上述旧数据由服务端归一化后再输出新模型。页面文案、图标和排版仍由 App 本地枚举定义。 + +### 4.2 拍摄与素材状态 + +| `capture.state` | 含义 | +| --- | --- | +| `waiting_summon` | 已有订单任务,尚未召唤 | +| `travelling` | 召唤已受理,起飞准备 / 前往首点 | +| `ready` | 已到达待开拍 | +| `recording` | 已确认实际拍摄中 | +| `finished` | 已确认正常录制结束;无需等待回巢 / 上传 | +| `interrupted` | 未正常拍完而被手动 / 异常中断 | +| `failed` | 拍摄环节明确失败,例如未能执行航线 | +| `cancelled` | 本次执行已取消 | + +`capture.reason` 为 null 或 `{code,message}`。正常完成时 `finished_at` 必须有值;在同 execution 内,已确认的正常录制完成不能因遥测未知或上传失败撤回。明确没有正常拍完的手动 / 异常中断不允许后来被 DJI 通用 success 覆盖成 finished。 + +`media.state`:`not_started / queued / downloading / uploading / rendering / ready / failed`。没有进度数据就不虚构百分比。素材失败通过 `media.error={type,message,retryable}` 表达;不会自动开放重飞。首次看到的已是素材失败时,不弹正常拍摄成功提示。 + +### 4.3 设备状态改为 mode + hold + +`flight.mode`:`idle / starting / mission / returning / returned / unknown`。 + +`flight.hold`:`none / arrival_wait / manual / unknown`。mode 表达当前任务运动环节,hold 表达是否在等待 / 暂停,二者分开: + +| 组合 | 含义 | +| --- | --- | +| `mission + arrival_wait`,`capture=ready` | 首次到点自动悬停,**不是手动暂停** | +| `mission + manual` | 普通任务已手动暂停 | +| `returning + none` | 返航中 | +| `returning + manual` | 返航任务被暂停,继续后仍恢复返航 | +| `starting + inside` | 仍在巢内准备起飞,**不是已回巢** | +| `returned + inside` | 本 execution 曾起飞 / 离巢,现确认回巢 | + +不再让 App 读取 / 推导 `resume_phase`;恢复上下文由后端持久维护。`dock_position=inside/outside/unknown`,`airborne=true/false/null`;null 不能变 false,单独 outside 不能当作起飞。 + +`flight.return_reason=manual/normal_complete/abnormal/null`;`observed_at` 是设备证据时间,`stale` 表示证据过期。机巢工作态空闲、任务失败、接单释放、超时等待都不能替代回巢证据。设备未知时输出明确 unknown 和关闭相应控制许可,同时保留可信 capture/media。 + +正常拍完返航后又暂停:可中央显示“已暂停”,但 capture 仍 finished,本机图传仍停止,不重复弹完成提示。 + +### 4.4 唯一动作许可 + +`permissions` 固定返回五项:`summon/start_recording/pause/resume/return_home`。每项含 `allowed`、`reason`、`context_id`。allowed=false 必须有稳定 reason.code 和可展示 message;allowed=true 时 reason=null。 + +| 场景 | 暂停 | 继续 | 返航 | 开拍 / 重召 | +| --- | --- | --- | --- | --- | +| 前往 / 到点 / 拍摄,设备条件允许 | 可 | 不可 | 可 | ready 时独立评估开拍 | +| 手动暂停 | 不可重复暂停 | 可 | 可;若暂停的原本是返航则不可重复返航 | 不因倒计时开放开拍 | +| 返航中 | 可 | 不可 | 不可重复返航 | 不重召 | +| 已回巢 | 不可 | 不可 | 不可 | 设备可用、任务允许时才可重召 | +| 设备未知 | 不开放设备控制 | 不开放 | 不开放 | 不推测回巢或设备可用 | + +上表由**服务端计算并保证**,App 正常情况下直接用 permissions,不再用 airway / work_status / airborne 拼第二套权限。App 只保留当前任务 / 执行身份、本地防重、可见性、登录身份、已知协议字段等校验;服务端收到动作后还要重新校验最新条件。 + +`start_recording.context_id` 标识一次“可开拍授权周期”;`resume.context_id` 标识一次已确认手动暂停周期。不是登录凭证。相关操作请求必须原样带回,防止同一 execution 内的迟到请求作用到新一轮暂停。 + +- 待开拍 → 暂停 → 继续待开拍后,要生成**新的开拍 context**,即使仍是同一个点、仍剩 18 秒。 +- 每次新的手动暂停生效,生成新的 resume context。 +- 普通 GET、指标更新、按钮 loading 不轮换 context。 +- 暂停 / 返航不要求 context 或 snapshot revision 严格相等,避免指标变化误挡紧急操作;仍必须核当前 execution 与最新许可。 + +## 5. 后端截止时间与暂停倒计时 + +`auto_start.state`:`not_applicable / counting_down / paused / elapsed / disabled`。 + +| 状态 | `deadline_at` | `remaining_ms` | 含义 | +| --- | --- | --- | --- | +| counting_down | 必填 | null | 服务器计划的自动开拍截止时间 | +| paused | null | 必填非负数 | 冻结剩余时间,不随服务端时钟减少 | +| elapsed | 可保留原截止时间 | null | 时间已到,尚待开拍实际状态确认 | +| disabled / not_applicable | null | null | 不参与自动开拍 | + +确定行为: + +1. 可信到点后,后端安排一次 30 秒自动开拍计划并发出 deadline。 +2. 待开拍时,暂停请求一旦**持久受理**即冻结自动开拍、保存剩余时间并作废旧开拍 context / 定时任务;此时设备 hold 可以尚未确认 manual,中央不会提前当“已暂停”。暂停明确失败后,后端重建合法计划和 context,不让旧定时器自行恢复。 +3. 用户暂停时剩 18 秒,稍后继续设备确认后,后端设 `deadline_at=继续确认时刻+18秒`,同时生成新的开拍 context。 +4. App 根据 server_time、截止时间和本机单调时钟显示剩余秒数,按网络往返估计时差;不直接信任手机墙上时钟。显示归零后保持 0,不发送开拍、不自动切阶段。 +5. 后端自动开拍和用户手动开拍争用同一开拍 context,必须原子归并成一次动作;两个触发同时到达也不能下发两次。 +6. 定时任务执行前重新验证 task、execution、context、暂停 / 返航意图和当前许可,取消失败的旧定时器不能在恢复后误开拍。 +7. 离页 / 后台只停止 App 的显示刷新,不取消后端计划;回前台按新快照恢复倒计时。已在 recording 时立即显示拍摄中。 + +**需要朱工确认**:能否可靠获得 / 管理真实自动开拍计划,尤其设备自己还有自动恢复逻辑时,是否能与上述暂停冻结规则一致。无法实现时必须明确说明能力边界,再选择本地显示方案,不返回一个与真实开拍无关的虚假 deadline。 + +## 6. `POST actions`:统一动作模型 + +```text +POST /api/app/airport/tasks/501/actions +``` + +暂停请求: + +```json +{ + "client_request_id": "11111111-1111-4111-8111-111111111111", + "action": "pause", + "expected_execution_id": "execution-001", + "context_id": null, + "observed_revision": 128 +} +``` + +| 入参 | 必填 | 规则 | +| --- | --- | --- | +| `client_request_id` | 是 | 每次用户明确点击的 UUID;不是每次网络重试重新生成 | +| `action` | 是 | `summon/start_recording/pause/resume/return_home` | +| `expected_execution_id` | 是,可 null | 必须等于用户操作所针对的执行;首次召唤尚无执行时才是 null | +| `context_id` | 是,可 null | 开拍 / 继续必须使用 permissions 对应值,其余动作为 null | +| `observed_revision` | 是 | 仅诊断和审计,不要求等于当前全量 revision | + +开拍改为 `action=start_recording`、带 start context;继续改为 `action=resume`、带 resume context;返航 `action=return_home`;失败重召 `action=summon`,expected_execution_id 仍为原执行标识,后端创建新 execution。 + +### 6.1 统一回执 + +正常持久受理返回 HTTP 202、code=100000,`data` 固定为 `{operation,snapshot}`。snapshot 是第 4 节相同的**完整对象**,且 revision 不低于该 operation 的 accepted_revision;App 可以直接采纳,不再每次 POST 成功后固定追加一个 GET。 + +完整 JSON 见[动作受理回包](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/05-action-pending.json)。下面仅展开 `data.operation`: + +```json +{ + "action_id": "action-001", + "client_request_id": "11111111-1111-4111-8111-111111111111", + "task_id": 501, + "request_execution_id": "execution-001", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "accepted_revision": 129, + "submitted_at": "2026-11-06T10:00:12.000+08:00", + "updated_at": "2026-11-06T10:00:12.000+08:00", + "error": null +} +``` + +这份回包中的 snapshot 仍可保持原来的 capture / flight 事实,只增加操作记录、许可和必要的自动开拍冻结。后端观察到真实变化后,再发布新 snapshot。当前召唤是例外的明确定义过渡:受理后可 `capture=travelling + flight.mode=starting`,它不表示已经离巢。 + +不再输出 `accepted/device_confirmed/acceptance` 三套重叠字段。HTTP 202 是已受理,operation.status 表示动作进展;**HTTP code=100000 不等于 operation 已 succeeded**。 + +### 6.2 动作状态与成功含义 + +| `operation.status` | 精确定义 | +| --- | --- | +| `pending` | 已持久记录,等待下发或设备确认 | +| `succeeded` | 已达到该动作定义的目标,不等于整次拍摄成功 | +| `rejected` | 校验不通过,明确未下发设备 | +| `failed` | 后端 / 设备已明确确认动作失败,不能用“等待超时”随意填写 | +| `superseded` | 旧意图被新意图替代;不保证旧物理指令从未执行 | +| `unknown` | 是否生效尚不能确认,继续只读核对,不自动补发 | + +unknown 后允许依据确证转 succeeded/failed/superseded;不能为了释放按钮就把未知改失败。 + +| 动作 | succeeded 表示 | +| --- | --- | +| summon | 新 execution 已建立,航线已被设备侧受理调度;不代表已起飞 / 到点 | +| start_recording | 已确认进入实际录制 | +| pause | 已确认手动暂停生效;首点自动悬停不能充数 | +| resume | 已确认解除本次手动暂停,恢复对应任务环节;待开拍恢复不会直接开拍 | +| return_home | 已确认进入返航;**不代表已回巢**。起飞前取消见后面的边界确认项 | + +`action_id` 为服务端动作唯一标识,`client_request_id` 为客户端点击关联标识。`request_execution_id` 是提交时目标;`execution_id` 是动作实际归属。重召时前者为旧 execution,后者为新 execution,App 不能把这类正常回执当旧批次丢弃。 + +### 6.3 幂等、并发和迟到请求 + +1. 幂等范围为服务端认证得到的门店范围 + task + client_request_id。**先查幂等记录,再核当前 execution / context**。同键同参数回同一动作,不重复下发;同键不同参数返回 `IDEMPOTENCY_CONFLICT`。 +2. 重放允许 operation 已更新为最新状态,snapshot 也返回当前最新版;保证同一动作身份和不重复派发,不要求响应正文逐字不变。 +3. 在任务仍可操作期间不得删除幂等记录;任务归档后禁止新设备动作,并建议至少再保留 7 天查询记录。 +4. 当前 execution 不符返回 `EXECUTION_CHANGED`,不得把上一轮迟到暂停 / 返航发给新飞行。 +5. 开拍 / 继续的 context 不符返回 `ACTION_CONTEXT_CHANGED`;App 更新页面后等待重新点击,不能偷偷更换 context 自动重发。 +6. context 和当前意图既在接收时核验,也在**真正出队下发前**再次核验。同一开拍 context 原子占用;两个账号或自动 / 手动触发不能重复下发。 +7. 服务端对同一锁定设备串行处理派发,并保证跨任务占用关系;不能只靠两个手机各自防重。 +8. 暂停尚在确认时,后端仍可允许返航;不能要求先等暂停 succeeded 才能提交返航。App 只串行 HTTP 提交,不串行等待设备结果。 +9. 返航优先取代未完成的开拍 / 普通恢复 / 旧手动暂停目标,迟到回执不能重新锁回旧状态。返航之后的新暂停是“暂停返航”,**不能简单把原返航目标删除**;继续时仍恢复返航。 +10. 新 execution 清旧运行上下文,但保留旧动作历史可查。动作结果改变 / 被取代必须升 revision 推送,某条记录消失不能当作成功。 + +服务端先持久记录动作,再对接 DJI。若设备已受理但服务端在落结果前异常,只能恢复探测为 unknown;除非上游也提供幂等保证,不能承诺物理设备严格执行一次,更不能盲目重发。这是本方案需要处理的故障边界,不是要求 App 重试真实控制。 + +## 7. `GET action-requests`:提交超时后的核对 + +```text +GET /api/app/airport/tasks/501/action-requests/11111111-1111-4111-8111-111111111111 +``` + +即使没有拿到 action_id,也能用发请求前已经生成的 client_request_id 查询。找到记录时返回 HTTP 200:`data={found:true,operation:完整动作记录,snapshot:当前完整快照}`。 + +暂未找到时: + +```json +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "found": false, + "operation": null, + "snapshot": null + } +} +``` + +**found=false 只表示此刻没有查到记录,不能证明此前 POST 永远不会到达。** App 不因此生成新请求 ID 补发动作。保持“结果待核对”,在前台按约 2 秒、最多 10 秒短期查询,之后并入 5 秒状态兜底 / 手动核对;不要给每个未知动作再开一个永久定时器。 + +后端明确拒绝的、已通过身份定位的请求,也应保留 rejected 记录,使丢失失败回执时可以查明“未下发”。参数根本不合法 / 登录未通过 / 任务不存在的请求不必创建设备动作记录,错误响应必须明确。 + +快照 operations 保留所有 pending/unknown 动作,并至少保留当前 execution 最近 10 条结果;完整历史以本接口查询为准。App 同时处理的动作少于服务端历史上限时,可优先从快照结束等待,不为每条成功操作额外发查询。 + +明确收到 HTTP 错误时按 error.type 处理;网络断开 / 超时无有效回执才是“结果未知”。查询是只读,不下发设备动作、不创建任务。 + +## 8. WS v2:正式成功即有完整首包 + +继续复用公共 `/wss` 和 socket-token。只对该任务订阅实现新协议;不改共享连接其它业务。移除 `Opened → ready → received → subscribe_meta → HTTP seed` 这条业务握手依赖。 + +### 8.1 客户端订阅 + +传输连接建立后即可发送一次 JSON 文本帧,不再等纯文本 Opened 才发送: + +```json +{ + "type": 310, + "params": { + "protocol_version": 2, + "request_id": "subscribe-request-001", + "task_id": 501, + "socket_token": "EXAMPLE_SOCKET_TOKEN", + "last_revision": 128 + } +} +``` + +`last_revision` 仅说明本机目前版本;无论是否有变化,正式成功都返回一份最新完整 snapshot。后端无须补发全部历史事件。 + +### 8.2 正式成功 / 变更 / 心跳 + +| event | 必需 data 字段 | +| --- | --- | +| `task.subscribed` | request_id、subscription_id、task_id、**snapshot 完整对象** | +| `task.updated` | subscription_id、task_id、**snapshot 完整对象** | +| `task.heartbeat` | subscription_id、task_id、revision | +| `task.subscription_failed` | request_id、task_id、结构化 error | +| `task.unsubscribed` | request_id、subscription_id、task_id(离页不等待它) | + +成功帧完整 JSON 见[WS订阅成功示例](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/06-ws-subscribed.json),其中 `data.snapshot` 与 `GET state.data` 是同一个对象。只有当前连接匹配的正式成功帧、且 snapshot 校验有效,才将通道标为就绪并停止普通 HTTP 轮询。 + +心跳示例(外壳 server_time 每次变化,snapshot revision 不因心跳自增): + +```json +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "event": "task.heartbeat", + "subscription_id": "subscription-001", + "task_id": 501, + "revision": 128 + } +} +``` + +建议每 20 秒一帧应用心跳;连续 60 秒没有当前订阅的有效心跳 / 业务帧,恢复 HTTP 并重连。网络 Ping/Pong 可以保留,但只反映连接端是否响应;任务版本心跳还用于检查业务同步。Ping/Pong 的传输层语义见 [RFC 6455 §5.5.2](https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.2)。 + +- 心跳版本等于本地:无业务变化,正常等待,无需为了“120 秒无变化”查一次 GET。 +- 心跳版本高于本地:立即合并安排一次 GET 修复;未追上前按 HTTP 兜底,追上且当前订阅仍有效后再停轮询。心跳本身不能替代完整快照。 +- 心跳版本低于本地:不回滚;记录异常,持续不一致时重建订阅。 +- 收到无法解析 / 身份不符 / 缺少必填字段的帧不算有效心跳,不延长健康期。 + +### 8.3 服务端必须解决首包竞态与空等 + +1. 在总超时约 3 秒内完成鉴权、频道登记与首包读取;子步骤设置更短上限,不能卡在 Redis / DB 一直不回包。 +2. **先登记频道,再取最新状态**;正式首包发送前暂存本连接的更新,成功后只补发高于首包版本的更新。连接发送串行化,不让变更帧抢到正式首包前面。 +3. 没有缓存时由统一状态服务生成快照。生成失败返回 `SNAPSHOT_UNAVAILABLE`;**不允许 subscribed 成功却缺快照,也不再要求 App 通过 meta 补首包**。 +4. 登记或发送首包失败要撤销本次订阅。成功必须意味着服务端已登记频道且能提供完整状态,不只是验证了 token。 +5. 状态提交后可靠投递推送(建议持久消息 / outbox),投递失败能重试;允许重复,不允许悄悄丢失后仍长期报告旧版本。心跳读取权威最新 revision,而不是该连接最后一次成功发送的版本。 +6. 后台补采 / 状态生产器停止时,不能仅凭 Socket Ping 成功宣告设备数据新鲜;仍需正确过期 telemetry / flight 并收敛权限。心跳也不替代设备探测。 + +### 8.4 失败和恢复 + +```json +{ + "code": 100099, + "msg": "订阅鉴权服务暂不可用", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "event": "task.subscription_failed", + "request_id": "subscribe-request-001", + "task_id": 501, + "error": { + "type": "AUTH_TIMEOUT", + "scope": "realtime", + "retryable": true + } + } +} +``` + +| error.type | 行为 | +| --- | --- | +| SOCKET_TICKET_EXPIRED | 重新取票并重连,不清 App 登录 | +| AUTH_TIMEOUT / SNAPSHOT_UNAVAILABLE / TEMPORARILY_UNAVAILABLE | 保持 HTTP 兜底,退避重连 | +| TASK_READ_FORBIDDEN / TASK_NOT_FOUND | 停当前任务的 HTTP / WS 读取,提示原因 | +| LOGIN_EXPIRED | 走统一登录处理 | + +App 整个首包等待上限建议 10 秒,后端应先在自己的约 3 秒期限内明确回复。Socket 退避建议 1/2/4/8/16/30 秒并加少量随机抖动;每轮重连重新取票。重连生成新 subscription_id,旧连接回调不能影响新会话。 + +离页尽力退订并断开该页连接: + +```json +{ + "type": 311, + "params": { + "protocol_version": 2, + "request_id": "unsubscribe-request-001", + "task_id": 501, + "subscription_id": "subscription-001" + } +} +``` + +311 仍是退订。所有首次 / 重连 / 推送都是全量快照,不实现 patch、客户端补字段或多版本兼容分支。 + +## 9. 图传会话:与业务状态解耦 + +### 9.1 申请观看会话 + +```text +POST /api/app/airport/tasks/501/live-sessions +``` + +```json +{ + "client_session_id": "22222222-2222-4222-8222-222222222222", + "expected_execution_id": "execution-001", + "roles": [ + "dock", + "drone" + ] +} +``` + +页面可见且 `live.allowed=true` 时申请。client_session_id 标识本次观看,重复请求同会话不创建第二个观看身份、不反复启动同一路推流;换 execution / 新页面观看使用新标识。POST 超时允许核对 / 复用原会话标识,这只是幂等申请观看,不重发飞控。 + +HTTP 200 返回完整会话参数,仍没有视频二进制: + +```json +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "session_id": "live-session-001", + "client_session_id": "22222222-2222-4222-8222-222222222222", + "task_id": 501, + "execution_id": "execution-001", + "expires_at": "2026-11-06T10:40:00.000+08:00", + "next_refresh_at": "2026-11-06T10:00:30.000+08:00", + "sources": [ + { + "role": "dock", + "source_id": "dock-source-001", + "state": "ready", + "reason": null, + "provider": "volc", + "credentials": { + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_DOCK_ROOM", + "user_id": "EXAMPLE_VIEWER_ID", + "token": "EXAMPLE_RTC_TOKEN", + "expires_at": "2026-11-06T10:40:00.000+08:00" + } + }, + { + "role": "drone", + "source_id": null, + "state": "pending", + "reason": { + "code": "DRONE_SOURCE_PENDING", + "message": "等待无人机直播源" + }, + "provider": "volc", + "credentials": null + } + ] + } +} +``` + +### 9.2 续期与缺失来源 + +```text +POST /api/app/airport/tasks/501/live-sessions/live-session-001/refresh +``` + +```json +{ + "expected_execution_id": "execution-001", + "client_request_id": "33333333-3333-4333-8333-333333333333" +} +``` + +返回与申请相同的 session 结构,保留 session_id、已有健康来源的 room_id / user_id。新凭证仍有独立 expires_at;App 直接向 SDK 更新凭证,不因 user_id 每次轮换而退房重入。 + +- `sources[].state=ready/pending/unavailable`,只有 ready 才有 credentials;无来源参数时不填假值。 +- `source_id` 标识具体设备摄像源 / 房间身份;来源变更必须换 ID,旧 source 的迟到回调不能恢复画面。 +- 凭证结构化返回 `app_id/room_id/user_id/token/expires_at`,不再让 App 从 query-string 风格 `url` 猜字段 / 二次解码。 +- 首版只约定 `provider=volc`。未来接入其它厂商先扩展合同和 SDK,不因为返回枚举就当作已支持。 +- 后端根据已登记观看需求发现机巢 / 无人机来源,按需开缺失流并去重;refresh 不重新启动已存在的流,不重新派飞。该来源管理机制需朱工实现并确认。 +- 有 pending 来源时 next_refresh_at 默认约 30 秒后,建议限 5~60 秒;两路均就绪时按最早凭证到期前约 30 秒续期。App 用 server_time 换算,不能因手机时间快慢错过续期。 +- snapshot 中 live.allowed=false、execution 变化、离页或后台时取消在途请求、补流和续期,立即释放本机 RTC;迟到凭证直接丢弃。 +- 先接收机巢,再根据实际无人机视频帧切换,停流时回退健康机巢;这是 App 播放策略,不通过反复创建服务端会话实现。 + +第一版不要求退出页调用“停止设备推流”。会话 expires_at 到期后由后端清理,SDK 接收端退出立即释放本机资源;某个手机离页不能把其他人的设备流停掉。若将来需要设备停流,必须另定义服务端观看引用与权限,不混入本次本地释放。 + +`refresh` 不能偷偷创建已失效会话;失效返回 `LIVE_SESSION_EXPIRED`。App 在仍可见且允许观看时可用新 client_session_id 重新申请。此自动重建只涉及观看,不得重发召唤 / 开拍 / 飞控。 + +## 10. 指标与状态生产:后台独立维护 + +- 活跃执行即使没有 App 发 GET / live、没有任何订阅,也要继续维护设备阶段与需要的读数。不能依赖“用户刷新”推进真实设备业务。 +- 飞行 / 到点 / 暂停 / 返航建议约 1~3 秒探测关键设备状态,具体受上游限频约束;建议在可获得证据后 3 秒内产生新状态。此为目标,朱工需确认来源和频率,不作为已有保证。 +- 六项指标沿用约 15 秒补采、约 120 秒过期的已确认口径。**每项分别记录 observed_at / stale**,不能一项更新就刷新所有项时间。 +- 无新读数保留最近值,超过阈值升版本推 stale=true,恢复后升版本推有效值;从未采到则 value/raw/observed_at 为 null、stale=true,不能补 0。 +- 飞控证据过期与指标过期分开:电量 / 温度 stale 不等于飞行控制未知。反之,指标看似新鲜也不能掩盖设备位置探测失败。 +- 数据变化、过期 / 恢复、权限变化、操作进展、自动开拍计划变化、execution 变化均产生新 revision。纯 GET、无变化心跳、RTC token 轮换不修改业务 snapshot revision。 +- 合并短时间重复变更可以,但不能丢掉终态动作记录、录制正常完成事实或让 UI 长期不知道可操作状态。 +- 业务写入、权限重算、snapshot 版本分配 / 保存必须形成一致提交,再投递 WS。Redis 仅缓存时也不能丢版本、动作幂等和暂停上下文;进程重启后要能恢复。 + +## 11. App 请求流程与本地展示 + +### 11.1 进页、操作与恢复 + +1. 准备页统一召唤受理后,把同任务最新 snapshot 传给任务页作为首屏,避免先显示未知;导航仍以任务页替换准备页。 +2. 任务页 / 回前台 GET state 一次,并取票建立 WS;所有 snapshot 进入同一个采纳入口。旧画面保留到新快照替换,普通刷新不全页禁用。 +3. 正式订阅完整首包通过后停常规 HTTP;连接异常、首包失败、漏版本时 5 秒串行 GET(后端建议可限制 2~30 秒),同时重连。每页只允许一个状态 GET 在途。 +4. 用户操作使用统一 actions;先显示对应按钮 loading,回执带 snapshot 直接采纳。只有回执丢失 / 结果未知才查 action-requests,不固定追加 GET。 +5. 按 task 级 revision 采纳,execution 变化时清旧倒计时 / 指令 UI / 图传会话;仍保留旧动作查询关联,不把旧动作成功误当新飞行成功。 +6. 离页 / 后台停止本页读请求、WS、本地倒计时显示刷新和 RTC,作废迟到回调。后端真实任务和自动开拍调度继续运行;回前台立即读取。 + +加载、网络异常提示、按钮等待、业务阶段分别管理。HTTP / WS 暂时失败时展示上次数据与连接提示,不把网络错误改成“拍摄失败”,也不凭缓存推断新设备事实。动作最终始终由服务端按最新条件校验。 + +### 11.2 本地中央展示规则 + +| 权威事实 | 中央展示 | +| --- | --- | +| 可信 flight.hold=manual | 已暂停;flight.mode=returning 时为返航任务已暂停 | +| capture=finished 且 media=failed | 素材处理失败,保留拍摄已完成事实 | +| capture=finished | 拍摄已完成;按 flight 证据显示返航说明,或显示素材处理中 | +| capture=interrupted/failed 且 flight=returned | 已完成返航;是否可重召只看 summon 许可 | +| capture=interrupted/failed 且 flight=returning | 返航中;不弹正常完成提示 | +| capture=travelling | 前往拍摄点,含 starting | +| capture=ready | 已到达待开拍;start_recording=false 只禁按钮 / 显示原因 | +| capture=recording | 无人机正在拍摄中 | +| capture=waiting_summon | 等待召唤 | +| capture=cancelled / failed 且无以上设备态 | 已取消 / 拍摄失败 | +| 未知业务状态 | 状态待确认,只读核对 | + +这张表保留本地文案职责,**不用于重新推导 permissions**。已知 capture 不会因为 flight=unknown 自动整体变 unknown。异常字段分区处理:设备证据冲突只关闭相关控制并记录诊断,不抹掉独立可信的正常录制结果。 + +完成提示以 task + execution 在当前页面会话去重。首次看到 capture=finished 且 media!=failed 时可提示;已经提示后变暂停 / 上传 / 就绪或切前后台不重复。停止 RTC 按 `live.allowed=false` 执行,与中央是否恰好显示“已暂停”无关。 + +## 12. 错误类型与边界 + +| error.type | 范围 | 建议处理 | +| --- | --- | --- | +| LOGIN_EXPIRED | 登录 | 统一登录处理 | +| TASK_READ_FORBIDDEN / TASK_NOT_FOUND | 任务读取 | 停该任务 HTTP / WS | +| SOCKET_TICKET_EXPIRED | 实时订阅 | 换票重连 | +| AUTH_TIMEOUT / SNAPSHOT_UNAVAILABLE / TEMPORARILY_UNAVAILABLE | 读取 / 订阅 | 有界退避和 HTTP 兜底 | +| ACTION_NOT_ALLOWED | 单次动作 | 只关闭 / 结束该动作等待,采用回包当前 snapshot,不停止全部读取 | +| EXECUTION_CHANGED / ACTION_CONTEXT_CHANGED | 单次动作 | 刷新当前状态,等待用户重新点击,不自动换参数重发 | +| IDEMPOTENCY_CONFLICT | 单次请求 | 明确错误,不能复用同键修改动作 | +| DEVICE_COMMAND_FAILED | 单次动作 | 明确失败,记录原因,按当前许可处理 | +| DEVICE_CONFIRMATION_UNKNOWN | 单次动作 | 只读核对,不自动补发 | +| LIVE_SESSION_EXPIRED / LIVE_SOURCE_UNAVAILABLE | 图传 | 不改变拍摄结果,按观看许可重建 / 重试 | + +错误是否可重试和是否应停读由 type/scope 决定,不能把“某个动作不可做”当成“整页没有权限”。错误中的 retryable 对飞控不表示可自动重新 POST,只表示允许恢复查询 / 显式重新操作,具体按动作规则。 + +### 需要与朱工确认的实现边界 + +- **正常录制结束信号**:必须能在开始自动返航时给出 capture=finished;若司空的某个 success 只在回巢后出现,需要换用真实录制结束 / 航点完成证据,不靠等待时长猜。 +- **尚未起飞时点击返航**:建议按“取消起飞并确认未离巢”处理;不能把 starting+inside 冒充 returned。朱工需确认上游支持的停止 / 取消能力。若不支持,应在 permissions 禁用并给明确原因,不能假装返航成功。 +- **正常拍完与手动返航竞态**:以服务端已确认的录制事实及动作因果顺序裁定。正常 finished 已成立后不能倒改中断;正常结束之前的手动中断不能被迟到 DJI success 覆盖。 +- **倒计时冻结**:暂停受理冻结、继续确认后接剩余时间,必须与设备真实自动拍摄行为一致,不能只改回包时间。 +- **同设备跨任务**:上一飞行上传不占飞控任务,但无人机仍在返航时不能被下一任务抢占;“素材上传不阻止下一次”与“设备已经可飞”分别校验。 + +## 13. 后端与两端联合验收 + +| 场景 | 必须验证的结果 | +| --- | --- | +| 召唤首包仍 inside | capture=travelling、flight=starting,显示前往,不出现已返航 | +| 首点自动悬停 | mission+arrival_wait,capture=ready;不显示手动暂停 | +| 已到达但开拍门禁暂闭 | 仍显示已到达,只禁开拍;安全许可独立 | +| 剩18秒暂停,等待10秒后继续 | 暂停期间仍剩18秒,确认继续后新deadline约18秒后 | +| 暂停前旧开拍包延迟到恢复之后 | 旧context被拒;不能误开拍 | +| 自动开拍与手动开拍同时到达 | 同context最多一个真实开拍派发 | +| 暂停→继续设备仍manual hold | resume pending,中央继续暂停,确认后才恢复 | +| 暂停确认未完就返航 | 返航可以被受理;旧暂停回执不把状态锁回暂停 | +| 返航中暂停→继续 | 保留returning方向,继续后仍返航 | +| 正常拍完开始返航 | 立即finished,提示一次并停止本机RTC;无需等回巢 | +| 正常拍完后flight未知 / 上传失败 | capture完成事实保留;未知不重飞,素材失败不自动重召 | +| 手动返航→确认回巢 | interrupted保留;returned且设备可用后才允许summon | +| 起飞前取消 | 不伪造returned,不留下已失控的自动起飞 / 开拍任务 | +| 重召换execution | 旧指令 / 倒计时 / 图传回包均不能作用到新执行 | +| 指标刷新使revision前进 | 不误拒暂停 / 返航,不使开拍context变化 | +| POST已派发但回包丢失 | 按原client_request_id能查;服务端异常不盲目补发 | +| 幂等重放 / 改参数重放 | 同键不重复设备执行;同键异参明确冲突 | +| WS登记与首包之间有状态变化 | 首包或后续必到最新版本,不漏最终状态 | +| Redis无缓存 / 鉴权超时 | 返回完整首包或明确失败,不再半成功永久空等 | +| 心跳正常、业务无变化 | 不额外轮询;漏推版本可通过心跳发现并GET修复 | +| 15秒补采、120秒过期、恢复 | 各项真实采集时间独立,旧值保留,过期 / 恢复升版本推送 | +| 进后台 / 返前台 / 锁屏 | 本页读与RTC停止 / 恢复正确,后台设备任务不被本地退出取消 | +| RTC一条来源迟到 / 续期 / 手机时间偏差 | 健康流不反复入房,凭证有效期和来源身份正确,拍完迟到回包不恢复播放 | + +以上均可先用模拟设备 / 隔离替身验证协议,再由用户自行在真实环境联调。本文未实现服务端 / App,也未运行真实飞行或图传。 + +## 14. 旧接口到新协议的映射 + +| 旧能力 | 新能力 | +| --- | --- | +| GET shooting | GET state | +| POST shoot,restart=false/true | POST actions,action=summon | +| POST start-shoot | POST actions,action=start_recording | +| POST command,flighttask_pause | POST actions,action=pause | +| POST command,flighttask_recovery | POST actions,action=resume | +| POST command,return_home | POST actions,action=return_home | +| 一个pending_command被覆盖后无法查旧请求 | 持久operation + 按client_request_id查询 | +| GET live | POST创建live-session + 独立refresh | +| 310正式ACK/meta/首包/HTTP seed | 310新协议正式成功直接带snapshot | +| task/OFT/wayline/ui多路状态 | capture/media/flight + permissions | + +建议实施顺序:先与产品确认本稿模型及边界 → 朱工给出字段 / 实现反馈并冻结文档 → 后端两服务一起落地 → iOS / Android 按同一协议重构 → 隔离场景验证 → 真实联调。不在讨论阶段先修改客户端或提前替换现网接口。 + +## 15. 完整 JSON 示例文件 + +下列文件均是**新版提案样例**,不是现网回包,不保证当前 App 可以解析。不同分支的 revision 用于演示,不表示所有样例应在同一条真实飞行时间线上依次发生。 + +| 文件 | 场景 | +| --- | --- | +| [01-state-ready.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/01-state-ready.json) | 已到达待开拍、后端30秒计划 | +| [02-state-recorded-returning.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/02-state-recorded-returning.json) | 正常拍完,自动返航,素材下载中 | +| [03-state-recorded-paused-returning.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/03-state-recorded-paused-returning.json) | 正常拍完后的返航被暂停,仍保留完成事实 | +| [04-state-manual-returned.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/04-state-manual-returned.json) | 未拍完手动返航已回巢,可重新召唤 | +| [05-action-pending.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/05-action-pending.json) | 暂停受理但设备尚待确认;冻结自动开拍 | +| [06-ws-subscribed.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/06-ws-subscribed.json) | 正式订阅成功直接带完整状态 | +| [07-live-session.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/07-live-session.json) | 机巢流就绪、无人机流待发现 | +| [08-action-found.json](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页新版接口示例/08-action-found.json) | 按请求ID查到暂停成功和当前快照 | + +文档保留为讨论稿。除倒计时两项已确认外,其余为推荐设计,待与用户、朱工商定后再形成实施版。 + diff --git a/docs/9.9.1/拍摄任务页接口示例/HTTP完整快照示例.json b/docs/9.9.1/拍摄任务页接口示例/HTTP完整快照示例.json new file mode 100644 index 0000000..392d184 --- /dev/null +++ b/docs/9.9.1/拍摄任务页接口示例/HTTP完整快照示例.json @@ -0,0 +1,227 @@ +{ + "code": 100000, + "msg": "success", + "data": { + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 12, + "snapshot_kind": "full", + "state_updated_at": "2026-11-06 10:00:00", + "metrics_updated_at": "2026-11-06 09:59:55", + "metrics_stale": false, + "shoot_complete_returning": false, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "scenic": { + "id": 271, + "name": "示例景区" + }, + "scenic_spot": { + "id": 412, + "name": "示例拍摄点" + }, + "air_line": { + "id": 123, + "name": "示例航线", + "scenic_spot_id": 412, + "estimated_fly_time": 274, + "line_video_duration": 26, + "fly_type": 1 + }, + "header": { + "order_number": "261106000001", + "title": "示例拍摄点 · 示例航线", + "tourist_label": "游客 158****8888", + "tourist_phone_mask": "158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "shot_total": 2, + "shot_remain": 2 + }, + "task": { + "id": 501, + "status": 20, + "status_label": "执行中", + "task_uuid": "11111111-1111-4111-8111-111111111111", + "wayline_task_id": 9001, + "wayline_status": 20, + "wayline_status_label": "拍摄中" + }, + "order_flight_task": { + "id": 501, + "order_id": 10001, + "order_number": "261106000001", + "scenic_id": 271, + "store_id": 12, + "store_user_id": 88, + "scenic_spot_id": 412, + "air_line_id": 123, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "wayline_task_id": 9001, + "task_uuid": "11111111-1111-4111-8111-111111111111", + "seq": 1, + "spot_attempt": 1, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-06 09:59:00", + "finished_at": null, + "medias": [] + }, + "current_plane": { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + }, + "airport_status": { + "sn": "DEMO_DOCK_SN", + "status": 2, + "task_type": 2, + "work_status_label": "拍摄中" + }, + "plane_status": { + "scenic_id": 271, + "connected": true, + "has_idle": false, + "has_shooting": true, + "planes": [ + { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + } + ], + "recommend": { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + }, + "poll_hint_ms": 5000 + }, + "poll_hint_ms": 5000, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "95%", + "raw": 95, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "19.6℃", + "raw": 19.6 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "2m/s", + "raw": 2 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "running", + "message": "任务执行中,请等待结束或返航后再试", + "primary_action": "blocked", + "primary_action_label": "执行中" + }, + "flight_control": { + "state": "executing", + "is_airborne": true, + "pause_reason": "arrival_wait", + "resume_phase": "arrived_pending_start", + "return_reason": null, + "can_pause": true, + "can_resume": false, + "can_return_home": true, + "dji_task_status": "paused", + "drone_in_dock": "outside", + "execution_batch": 9001, + "pending_command": null, + "evidence": { + "drone_in_dock": "outside", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "ui": { + "phase": "arrived_pending_start", + "title": "无人机已到达 是否开始拍摄?", + "message": "确认游客站位与取景后开始", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ] + } + }, + "time": "2026-11-06 10:00:00" +} diff --git a/docs/9.9.1/拍摄任务页接口示例/WS完整快照示例.json b/docs/9.9.1/拍摄任务页接口示例/WS完整快照示例.json new file mode 100644 index 0000000..00746b1 --- /dev/null +++ b/docs/9.9.1/拍摄任务页接口示例/WS完整快照示例.json @@ -0,0 +1,229 @@ +{ + "code": 100000, + "msg": "OK", + "data": { + "action": "app_airport_shooting_updated", + "params": { + "order_flight_task_id": 501, + "execution_batch": 9001, + "state_version": 12, + "snapshot_kind": "full", + "state_updated_at": "2026-11-06 10:00:00", + "metrics_updated_at": "2026-11-06 09:59:55", + "metrics_stale": false, + "shoot_complete_returning": false, + "order_type": 25, + "order_type_label": "多点位航拍", + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "scenic": { + "id": 271, + "name": "示例景区" + }, + "scenic_spot": { + "id": 412, + "name": "示例拍摄点" + }, + "air_line": { + "id": 123, + "name": "示例航线", + "scenic_spot_id": 412, + "estimated_fly_time": 274, + "line_video_duration": 26, + "fly_type": 1 + }, + "header": { + "order_number": "261106000001", + "title": "示例拍摄点 · 示例航线", + "tourist_label": "游客 158****8888", + "tourist_phone_mask": "158****8888", + "package_name": "航拍套餐 · 含 2 次拍摄", + "shot_total": 2, + "shot_remain": 2 + }, + "task": { + "id": 501, + "status": 20, + "status_label": "执行中", + "task_uuid": "11111111-1111-4111-8111-111111111111", + "wayline_task_id": 9001, + "wayline_status": 20, + "wayline_status_label": "拍摄中" + }, + "order_flight_task": { + "id": 501, + "order_id": 10001, + "order_number": "261106000001", + "scenic_id": 271, + "store_id": 12, + "store_user_id": 88, + "scenic_spot_id": 412, + "air_line_id": 123, + "plane_id": 58, + "airport_sn": "DEMO_DOCK_SN", + "wayline_task_id": 9001, + "task_uuid": "11111111-1111-4111-8111-111111111111", + "seq": 1, + "spot_attempt": 1, + "status": 20, + "status_label": "执行中", + "result_code": "", + "result_message": "", + "deducted": 0, + "started_at": "2026-11-06 09:59:00", + "finished_at": null, + "medias": [] + }, + "current_plane": { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + }, + "airport_status": { + "sn": "DEMO_DOCK_SN", + "status": 2, + "task_type": 2, + "work_status_label": "拍摄中" + }, + "plane_status": { + "scenic_id": 271, + "connected": true, + "has_idle": false, + "has_shooting": true, + "planes": [ + { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + } + ], + "recommend": { + "id": 58, + "name": "示例无人机1号", + "sn_number": "DEMO_DOCK_SN", + "online_status": 1, + "work_status": 2, + "work_status_label": "拍摄中", + "is_receive_order": 2, + "can_fly": false, + "battery_percent": 95, + "battery_label": "电量 95%", + "status_text": "拍摄中 · 电量 95%", + "task_type": 2 + }, + "poll_hint_ms": 5000 + }, + "poll_hint_ms": 5000, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "value": "95%", + "raw": 95, + "source": "airport" + }, + { + "key": "env_temp", + "label": "环境温度", + "value": "19.6℃", + "raw": 19.6 + }, + { + "key": "wind_speed", + "label": "风速", + "value": "2m/s", + "raw": 2 + }, + { + "key": "rainfall", + "label": "雨量", + "value": "无雨", + "raw": "no_rain" + }, + { + "key": "signal", + "label": "信号状态", + "value": "无信号", + "raw": "no_signal" + }, + { + "key": "satellite", + "label": "搜星状态", + "value": "32颗", + "raw": 32 + } + ], + "execute_gate": { + "can_execute": true, + "code": "ok", + "message": "", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄" + }, + "restart_gate": { + "can_restart": false, + "code": "running", + "message": "任务执行中,请等待结束或返航后再试", + "primary_action": "blocked", + "primary_action_label": "执行中" + }, + "flight_control": { + "state": "executing", + "is_airborne": true, + "pause_reason": "arrival_wait", + "resume_phase": "arrived_pending_start", + "return_reason": null, + "can_pause": true, + "can_resume": false, + "can_return_home": true, + "dji_task_status": "paused", + "drone_in_dock": "outside", + "execution_batch": 9001, + "pending_command": null, + "evidence": { + "drone_in_dock": "outside", + "ever_left_dock": true, + "ever_airborne": true, + "probe_ok": true + } + }, + "ui": { + "phase": "arrived_pending_start", + "title": "无人机已到达 是否开始拍摄?", + "message": "确认游客站位与取景后开始", + "primary_action": "start_shoot", + "primary_action_label": "开始拍摄", + "commands": [ + { + "command": "flighttask_pause", + "label": "紧急暂停", + "sub": "悬停待命" + }, + { + "command": "return_home", + "label": "立即返航", + "sub": "中断任务" + } + ] + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/01-state-ready.json b/docs/9.9.1/拍摄任务页新版接口示例/01-state-ready.json new file mode 100644 index 0000000..0731264 --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/01-state-ready.json @@ -0,0 +1,150 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 128, + "updated_at": "2026-11-06T10:00:00.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "ready", + "finished_at": null, + "reason": null + }, + "media": { + "state": "not_started", + "error": null + }, + "flight": { + "mode": "mission", + "hold": "arrival_wait", + "dock_position": "outside", + "airborne": true, + "return_reason": null, + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": true, + "reason": null, + "context_id": "start-context-001" + }, + "pause": { + "allowed": true, + "reason": null, + "context_id": null + }, + "resume": { + "allowed": false, + "reason": { + "code": "NOT_MANUALLY_PAUSED", + "message": "当前没有已确认的手动暂停" + }, + "context_id": null + }, + "return_home": { + "allowed": true, + "reason": null, + "context_id": null + } + }, + "auto_start": { + "state": "counting_down", + "deadline_at": "2026-11-06T10:00:30.000+08:00", + "remaining_ms": null + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [], + "live": { + "allowed": true, + "reason": null + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/02-state-recorded-returning.json b/docs/9.9.1/拍摄任务页新版接口示例/02-state-recorded-returning.json new file mode 100644 index 0000000..ba390b0 --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/02-state-recorded-returning.json @@ -0,0 +1,159 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:02:00.000+08:00", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 150, + "updated_at": "2026-11-06T10:02:00.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "finished", + "finished_at": "2026-11-06T10:02:00.000+08:00", + "reason": null + }, + "media": { + "state": "downloading", + "error": null + }, + "flight": { + "mode": "returning", + "hold": "none", + "dock_position": "outside", + "airborne": true, + "return_reason": "normal_complete", + "observed_at": "2026-11-06T10:02:00.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": false, + "reason": { + "code": "CAPTURE_FINISHED", + "message": "本次拍摄已完成" + }, + "context_id": null + }, + "pause": { + "allowed": true, + "reason": null, + "context_id": null + }, + "resume": { + "allowed": false, + "reason": { + "code": "NOT_MANUALLY_PAUSED", + "message": "当前没有已确认的手动暂停" + }, + "context_id": null + }, + "return_home": { + "allowed": false, + "reason": { + "code": "ALREADY_RETURNING", + "message": "无人机正在返航" + }, + "context_id": null + } + }, + "auto_start": { + "state": "not_applicable", + "deadline_at": null, + "remaining_ms": null + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [], + "live": { + "allowed": false, + "reason": { + "code": "CAPTURE_FINISHED", + "message": "拍摄已完成" + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/03-state-recorded-paused-returning.json b/docs/9.9.1/拍摄任务页新版接口示例/03-state-recorded-paused-returning.json new file mode 100644 index 0000000..0db8dfa --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/03-state-recorded-paused-returning.json @@ -0,0 +1,159 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:02:05.000+08:00", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 151, + "updated_at": "2026-11-06T10:02:05.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "finished", + "finished_at": "2026-11-06T10:02:00.000+08:00", + "reason": null + }, + "media": { + "state": "downloading", + "error": null + }, + "flight": { + "mode": "returning", + "hold": "manual", + "dock_position": "outside", + "airborne": true, + "return_reason": "normal_complete", + "observed_at": "2026-11-06T10:02:05.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": false, + "reason": { + "code": "CAPTURE_FINISHED", + "message": "本次拍摄已完成" + }, + "context_id": null + }, + "pause": { + "allowed": false, + "reason": { + "code": "ALREADY_PAUSED", + "message": "返航任务已暂停" + }, + "context_id": null + }, + "resume": { + "allowed": true, + "reason": null, + "context_id": "pause-context-returning-001" + }, + "return_home": { + "allowed": false, + "reason": { + "code": "ALREADY_RETURNING", + "message": "无人机正在返航" + }, + "context_id": null + } + }, + "auto_start": { + "state": "not_applicable", + "deadline_at": null, + "remaining_ms": null + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [], + "live": { + "allowed": false, + "reason": { + "code": "CAPTURE_FINISHED", + "message": "拍摄已完成" + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/04-state-manual-returned.json b/docs/9.9.1/拍摄任务页新版接口示例/04-state-manual-returned.json new file mode 100644 index 0000000..80d9763 --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/04-state-manual-returned.json @@ -0,0 +1,162 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:03:00.000+08:00", + "data": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 160, + "updated_at": "2026-11-06T10:03:00.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "interrupted", + "finished_at": null, + "reason": { + "code": "MANUAL_RETURN", + "message": "立即返航中断本次拍摄" + } + }, + "media": { + "state": "not_started", + "error": null + }, + "flight": { + "mode": "returned", + "hold": "none", + "dock_position": "inside", + "airborne": false, + "return_reason": "manual", + "observed_at": "2026-11-06T10:03:00.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": true, + "reason": null, + "context_id": null + }, + "start_recording": { + "allowed": false, + "reason": { + "code": "CAPTURE_INTERRUPTED", + "message": "本次拍摄已中断" + }, + "context_id": null + }, + "pause": { + "allowed": false, + "reason": { + "code": "ALREADY_RETURNED", + "message": "无人机已回巢" + }, + "context_id": null + }, + "resume": { + "allowed": false, + "reason": { + "code": "ALREADY_RETURNED", + "message": "无人机已回巢" + }, + "context_id": null + }, + "return_home": { + "allowed": false, + "reason": { + "code": "ALREADY_RETURNED", + "message": "无人机已回巢" + }, + "context_id": null + } + }, + "auto_start": { + "state": "not_applicable", + "deadline_at": null, + "remaining_ms": null + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [], + "live": { + "allowed": false, + "reason": { + "code": "FLIGHT_ENDED", + "message": "本次飞行已结束" + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/05-action-pending.json b/docs/9.9.1/拍摄任务页新版接口示例/05-action-pending.json new file mode 100644 index 0000000..ef1abbb --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/05-action-pending.json @@ -0,0 +1,185 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:12.000+08:00", + "data": { + "operation": { + "action_id": "action-001", + "client_request_id": "11111111-1111-4111-8111-111111111111", + "task_id": 501, + "request_execution_id": "execution-001", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "accepted_revision": 129, + "submitted_at": "2026-11-06T10:00:12.000+08:00", + "updated_at": "2026-11-06T10:00:12.000+08:00", + "error": null + }, + "snapshot": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 129, + "updated_at": "2026-11-06T10:00:12.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "ready", + "finished_at": null, + "reason": null + }, + "media": { + "state": "not_started", + "error": null + }, + "flight": { + "mode": "mission", + "hold": "arrival_wait", + "dock_position": "outside", + "airborne": true, + "return_reason": null, + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": false, + "reason": { + "code": "PAUSE_PENDING", + "message": "正在暂停任务" + }, + "context_id": null + }, + "pause": { + "allowed": false, + "reason": { + "code": "ACTION_PENDING", + "message": "暂停指令处理中" + }, + "context_id": null + }, + "resume": { + "allowed": false, + "reason": { + "code": "NOT_MANUALLY_PAUSED", + "message": "当前没有已确认的手动暂停" + }, + "context_id": null + }, + "return_home": { + "allowed": true, + "reason": null, + "context_id": null + } + }, + "auto_start": { + "state": "paused", + "deadline_at": null, + "remaining_ms": 18000 + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [ + { + "action_id": "action-001", + "client_request_id": "11111111-1111-4111-8111-111111111111", + "task_id": 501, + "request_execution_id": "execution-001", + "execution_id": "execution-001", + "action": "pause", + "status": "pending", + "accepted_revision": 129, + "submitted_at": "2026-11-06T10:00:12.000+08:00", + "updated_at": "2026-11-06T10:00:12.000+08:00", + "error": null + } + ], + "live": { + "allowed": true, + "reason": null + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/06-ws-subscribed.json b/docs/9.9.1/拍摄任务页新版接口示例/06-ws-subscribed.json new file mode 100644 index 0000000..c9559a0 --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/06-ws-subscribed.json @@ -0,0 +1,156 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "event": "task.subscribed", + "request_id": "subscribe-request-001", + "subscription_id": "subscription-001", + "task_id": 501, + "snapshot": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 128, + "updated_at": "2026-11-06T10:00:00.000+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "ready", + "finished_at": null, + "reason": null + }, + "media": { + "state": "not_started", + "error": null + }, + "flight": { + "mode": "mission", + "hold": "arrival_wait", + "dock_position": "outside", + "airborne": true, + "return_reason": null, + "observed_at": "2026-11-06T10:00:00.000+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": true, + "reason": null, + "context_id": "start-context-001" + }, + "pause": { + "allowed": true, + "reason": null, + "context_id": null + }, + "resume": { + "allowed": false, + "reason": { + "code": "NOT_MANUALLY_PAUSED", + "message": "当前没有已确认的手动暂停" + }, + "context_id": null + }, + "return_home": { + "allowed": true, + "reason": null, + "context_id": null + } + }, + "auto_start": { + "state": "counting_down", + "deadline_at": "2026-11-06T10:00:30.000+08:00", + "remaining_ms": null + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [], + "live": { + "allowed": true, + "reason": null + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/07-live-session.json b/docs/9.9.1/拍摄任务页新版接口示例/07-live-session.json new file mode 100644 index 0000000..c5c5b35 --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/07-live-session.json @@ -0,0 +1,41 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:00.000+08:00", + "data": { + "session_id": "live-session-001", + "client_session_id": "22222222-2222-4222-8222-222222222222", + "task_id": 501, + "execution_id": "execution-001", + "expires_at": "2026-11-06T10:40:00.000+08:00", + "next_refresh_at": "2026-11-06T10:00:30.000+08:00", + "sources": [ + { + "role": "dock", + "source_id": "dock-source-001", + "state": "ready", + "reason": null, + "provider": "volc", + "credentials": { + "app_id": "EXAMPLE_APP_ID", + "room_id": "EXAMPLE_DOCK_ROOM", + "user_id": "EXAMPLE_VIEWER_ID", + "token": "EXAMPLE_RTC_TOKEN", + "expires_at": "2026-11-06T10:40:00.000+08:00" + } + }, + { + "role": "drone", + "source_id": null, + "state": "pending", + "reason": { + "code": "DRONE_SOURCE_PENDING", + "message": "等待无人机直播源" + }, + "provider": "volc", + "credentials": null + } + ] + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/08-action-found.json b/docs/9.9.1/拍摄任务页新版接口示例/08-action-found.json new file mode 100644 index 0000000..17edab9 --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/08-action-found.json @@ -0,0 +1,183 @@ +{ + "code": 100000, + "msg": "success", + "request_id": "server-request-example", + "server_time": "2026-11-06T10:00:12.500+08:00", + "data": { + "found": true, + "operation": { + "action_id": "action-001", + "client_request_id": "11111111-1111-4111-8111-111111111111", + "task_id": 501, + "request_execution_id": "execution-001", + "execution_id": "execution-001", + "action": "pause", + "status": "succeeded", + "accepted_revision": 129, + "submitted_at": "2026-11-06T10:00:12.000+08:00", + "updated_at": "2026-11-06T10:00:12.500+08:00", + "error": null + }, + "snapshot": { + "task_id": 501, + "execution_id": "execution-001", + "revision": 130, + "updated_at": "2026-11-06T10:00:12.500+08:00", + "summary": { + "order_number": "261106000001", + "scenic_id": 271, + "spot": { + "id": 412, + "name": "示例拍摄点" + }, + "route": { + "id": 123, + "name": "示例航线" + }, + "customer_label": "游客 158****8888", + "package_label": "航拍套餐 · 含 2 次拍摄", + "cover_url": null, + "aircraft": { + "id": 58, + "name": "示例无人机1号" + } + }, + "capture": { + "state": "ready", + "finished_at": null, + "reason": null + }, + "media": { + "state": "not_started", + "error": null + }, + "flight": { + "mode": "mission", + "hold": "manual", + "dock_position": "outside", + "airborne": true, + "return_reason": null, + "observed_at": "2026-11-06T10:00:12.500+08:00", + "stale": false + }, + "permissions": { + "summon": { + "allowed": false, + "reason": { + "code": "EXECUTION_ACTIVE", + "message": "当前飞行尚未结束" + }, + "context_id": null + }, + "start_recording": { + "allowed": false, + "reason": { + "code": "MANUALLY_PAUSED", + "message": "任务已暂停" + }, + "context_id": null + }, + "pause": { + "allowed": false, + "reason": { + "code": "ALREADY_PAUSED", + "message": "任务已暂停" + }, + "context_id": null + }, + "resume": { + "allowed": true, + "reason": null, + "context_id": "pause-context-001" + }, + "return_home": { + "allowed": true, + "reason": null, + "context_id": null + } + }, + "auto_start": { + "state": "paused", + "deadline_at": null, + "remaining_ms": 18000 + }, + "telemetry": { + "items": [ + { + "key": "battery", + "value": "95%", + "raw": 95, + "unit": "%", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "env_temp", + "value": "19.6℃", + "raw": 19.6, + "unit": "℃", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "wind_speed", + "value": "2m/s", + "raw": 2, + "unit": "m/s", + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "rainfall", + "value": "无雨", + "raw": "no_rain", + "unit": null, + "source": "dock", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "signal", + "value": "良好", + "raw": "good", + "unit": null, + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + }, + { + "key": "satellite", + "value": "32颗", + "raw": 32, + "unit": "颗", + "source": "drone", + "observed_at": "2026-11-06T09:59:55.000+08:00", + "stale": false + } + ] + }, + "operations": [ + { + "action_id": "action-001", + "client_request_id": "11111111-1111-4111-8111-111111111111", + "task_id": 501, + "request_execution_id": "execution-001", + "execution_id": "execution-001", + "action": "pause", + "status": "succeeded", + "accepted_revision": 129, + "submitted_at": "2026-11-06T10:00:12.000+08:00", + "updated_at": "2026-11-06T10:00:12.500+08:00", + "error": null + } + ], + "live": { + "allowed": true, + "reason": null + } + } + } +} diff --git a/docs/9.9.1/拍摄任务页新版接口示例/README.md b/docs/9.9.1/拍摄任务页新版接口示例/README.md new file mode 100644 index 0000000..6e52c2a --- /dev/null +++ b/docs/9.9.1/拍摄任务页新版接口示例/README.md @@ -0,0 +1,7 @@ +# 已废弃的讨论稿示例 + +本目录配套早期《拍摄任务页-接口重构方案-讨论稿.md》,早于2026-11-06后续产品确认。 + +其中权限集合、后端截止时间、素材状态、正常拍完开始返航即完成等内容已经废弃,不用于实现或验收。 + +最终协议见[拍摄任务页 v2 后端实施稿](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页-v2接口协议-后端实施稿.md),新样例位于同级目录“拍摄任务页-v2协议示例”。 diff --git a/docs/9.9.1/拍摄流程UI实现说明.md b/docs/9.9.1/拍摄流程UI实现说明.md new file mode 100644 index 0000000..0d5f2ae --- /dev/null +++ b/docs/9.9.1/拍摄流程UI实现说明.md @@ -0,0 +1,75 @@ +# 9.9.1 拍摄准备与当前任务 UI + +实现日期:2026-10-23。分支:`dev_9_9_1`。 + +后续更新:素材入口已在下一轮接通,见[素材库 UI 实现说明](素材库UI实现说明.md);下文保留本轮拍摄页面交付时的范围记录。 + +## 本轮范围 + +已从工作台和“我的拍摄订单”的拍摄按钮接通以下本地页面: + +- 拍摄准备:订单额度、横向拍摄点、纵向航线单选、底部机巢连接/范围/设备许可、召唤及阻断提示。 +- 当前任务:点位航线及游客摘要、原型同款本地演示画面及放大、六项遥测、任务状态、指令回执、开始/暂停/继续/返航、成功及失败提示。 +- 页面共用同一内存数据源,不调用真实拍摄接口,不控制无人机,不请求定位或相机权限。静态演示画面不表示真实图传。 +- 收款继续暂缓,素材及交付继续保留入口提示;本轮不实现这些下级业务。 + +## 与原型及确认规则的对应 + +| 场景 | 已实现的交互 | +| --- | --- | +| 点位和航线 | 整卡/整行单选;切点读取该点航线,切回恢复仍有效的选择;配置失效清空选择;范围外仍可浏览和选择,但不能召唤。 | +| A 订单正在执行,打开 B | B 可进入准备并选择点位航线;底部显示占用,召唤禁用,不增加排队或自动起飞。 | +| 召唤提交 | 先显示处理中,冻结此次选择、防重复提交;明确确认后进入原任务;超时只提示待确认与同步,不自动重新召唤。 | +| 从任务返回 | 左上返回直接回工作台,不弹确认、不取消任务、不扣次;再点“查看当前任务”恢复同一个任务身份。 | +| 开始/暂停/继续/返航 | 点击仅提交指令;设备回执与按钮点击分开建模,明确回执后才改变执行阶段。 | +| 立即返航是否确认 | 用户要求按产品体验网页核对;2026-10-23 实际点击无二次确认,先出现“正在发送返航指令/尚未确认返航”。本轮按直接提交实现。见[核对证据](shooting-ui-2026-10-23/prototype-return-result.txt)。 | +| 成功与返航 | 确认成功只扣一次;结果与飞行独立;0 次立即移出首页,但已完成订单仍能查看未结束的原任务。返航暂停时可继续返航,仍保留素材入口。 | +| 失败后重试 | 失败不扣次;飞行未结束或设备未恢复可用时禁止重新准备;允许后回准备页恢复有效选择,需再次手动召唤。 | +| 手机网络与图传 | 仅断流可重连画面,状态和控制保持独立;手机离线显示未更新与“—”,禁发指令,恢复后先同步原任务。 | +| 未知/保护性返航 | 指令未知不等于失败、不自动重发;保护性返航展示原因,拍摄结果仍独立确认。 | + +原型离页确认、“重新召唤”直重试等行为与既定规则不一致,本轮继续以已确认规则为准。完整依据见[当前方案基线](review/product-comparison/current-baseline.md)。 + +## 如何演示 + +Debug 版“全部功能 → 机巢预览”,点击订单“开始拍摄/继续拍摄”,或从订单列表进入。 + +1. 准备页右上角可选正常、占用、未连接、无信号、低电量、未知、范围外、位置未知、无点位、无航线、次数用完等本地场景。 +2. 正常选择后点击“确认并召唤无人机”,页面停留在召唤处理中。右上角选择“模拟召唤确认”才进入任务页。 +3. 任务页的“模拟状态”菜单可明确注入到达、拍摄、暂停/恢复处理中、返航、成功/失败、断流、手机断网、保护返航及指令待确认等回执。 +4. 演示不使用定时器自动推进。点击真实样式的操作按钮先保留处理中,再用模拟状态菜单提供明确设备回执。刷新和重连仅开始同步过程,不伪装已经恢复。 + +可选启动参数: + +| 参数 | 入口 | +| --- | --- | +| `--dock-ui-preparation-preview` | 直达本地准备页 | +| `--dock-preparation-scenario=occupied` | 准备页初始占用 | +| `--dock-ui-task-preview` | 直达本地任务,默认已到达 | +| `--dock-task-scenario=phoneOffline` | 任务页初始手机断网 | +| `--dock-task-scenario=succeededReturning` | 成功但仍返航 | + +这些入口仅在 Debug 生效,不改变正常启动规则或真实登录身份;关闭启动参数后恢复原有首页。 + +## 素材与验证 + +- 三张静态图片直接取自用户指定的产品原型可见素材:`assets/tourist-photo.png`、`assets/point-mountain.png`、`assets/point-pagoda.png`,保存为 Asset Catalog 本地演示资源。不是从网页截图裁出 UI,也不发起远程图传。 +- 真机截图由 XCTest 临时窗口渲染,系统状态栏不在截图内。 +- iPhone 11 真机验证通过:`DroneShootingSessionViewModelTests` 24 项、`DroneShootingFlowViewTests` 6 项,以及上一轮机巢测试 15 项,共 **45 项、0 失败**;未运行模拟器单元测试,也未进行全工程回归。 +- 测试覆盖按身份恢复选择、占用准入、显式指令回执、防重复提交、成功幂等扣次、失败重试边界、离页恢复原任务、连接独立和可见约束布局;修复后重新验证通过。 + +## 真机截图 + +| 准备正常 | 占用仍可选线 | 设备未知 | +| --- | --- | --- | +| ![准备正常](shooting-ui-2026-10-23/preparation-ready.png) | ![占用](shooting-ui-2026-10-23/preparation-occupied.png) | ![未知](shooting-ui-2026-10-23/preparation-unknown.png) | + +| 任务已到达 | 已暂停 | 零次仍返航 | +| --- | --- | --- | +| ![已到达](shooting-ui-2026-10-23/task-arrived.png) | ![已暂停](shooting-ui-2026-10-23/task-paused.png) | ![零次返航](shooting-ui-2026-10-23/task-zero-quota-returning.png) | + +| 手机离线 | 仅图传断流 | 指令结果待确认 | +| --- | --- | --- | +| ![手机离线](shooting-ui-2026-10-23/task-phone-offline.png) | ![断流](shooting-ui-2026-10-23/task-stream-lost.png) | ![指令未知](shooting-ui-2026-10-23/task-command-unconfirmed.png) | + +[成功后返航暂停,保留继续返航与素材入口](shooting-ui-2026-10-23/task-success-return-paused.png)。 diff --git a/docs/9.9.1/景区空境库UI对齐-2026-10-30.md b/docs/9.9.1/景区空境库UI对齐-2026-10-30.md new file mode 100644 index 0000000..2bedda7 --- /dev/null +++ b/docs/9.9.1/景区空境库UI对齐-2026-10-30.md @@ -0,0 +1,54 @@ +# 景区空境库 UI 对齐记录(2026-10-30) + +## 对照范围 + +依据当日实际打开的[产品体验网页](https://voicestudio.suixinkan.cn/)核对主列表、航线筛选、时间筛选、视频预览及下载状态。页面名称继续使用“景区空境库”,首页权限标识继续使用 `sceniclibrary`。 + +## 本次调整 + +| 区域 | 对齐内容 | +| --- | --- | +| 顶部筛选 | 左对齐文字、右侧箭头,40 点高度、11 点圆角及细边框;采用网页主蓝色 `#066BFF`。 | +| 航线筛选 | 底部抓手、紧凑列表、细分隔线;选中项为蓝字及普通勾号,移除圆形选择框和右上关闭按钮;点选后应用。 | +| 时间筛选 | 月/日两列滚轮、起止日期卡片、文字“全部时间”、底部取消/确定;只展示保留期内已到来的日期。 | +| 视频预览 | 16:9 封面、小型白色播放图标、独立进度条、左右两侧时长/规格信息、航线及时间、通栏蓝色返回按钮;移除右上关闭按钮。 | +| 选择底栏 | 左侧“已选 N 段”,数量蓝色强调;右侧下载按钮,零选择时保留可读的禁用标题。 | +| 下载/暂停 | 摘要与取消同行,下面放进度条和通栏主按钮;下载中保持蓝底、显示加载指示器且禁止重复触发,暂停后可手动继续。 | +| 部分失败 | 摘要及结果说明,上方不再堆叠下载按钮;下方并排“继续选择”和“重试失败”。 | +| 完成 | 摘要及保存结果说明,下方通栏“继续选择素材”;增加实际窗口中的按钮文字宽度回归检查。 | + +## 保留的行为与平台适配 + +- 日期打开后先编辑草稿。与网页一致,从全部时间打开后直接确定会提交当天范围;取消不改变原筛选。“全部时间”仍在确定后提交 `nil/nil`。 +- 月份内部保留年份,处理跨年、闰年、月末、首尾月份截断及夏令时;不把一年简单视作固定秒数。 +- 视频进度来自实际 `AVPlayer` 播放时间,支持暂停、继续、结束重播;关闭时释放观察令牌和播放器,迟到的异步结果不能恢复已关闭页面。 +- 演示封面所标原片时长与包内实际短片时长分别说明,演示下载不写入系统相册。正式素材缺少 URL 时不会回退为演示视频。 +- 使用 UIKit 原生 Sheet、抓手、安全区和滚轮,保留 iOS 平台的弹出动画与边缘外观。 +- 当前正式账号暂无素材,本次有数据页面使用本地演示数据核对;真实非空接口数据映射不属于本次 UI 调整范围。 +- 本次验证只使用模拟器及隔离测试替身,无真机测试、真实相册写入或无人机指令。 + +## 验证结果 + +- `suixinkan-Simulator` / `SimulatorDebug` 构建成功。 +- 最终在 iPhone 17e / iOS 27.0 模拟器运行本模块相关 **67 项测试,全部通过,0 失败、0 跳过**。首轮视觉检查使用 iPhone 18 Pro 模拟器。 +- 覆盖日期跨年、月末、闰年和保留期边界,取消/全部时间确认,真实播放时间与暂停/关闭清理,选择及下载状态切换、失败重试、远程空响应和权限入口。 +- 底栏额外在 320 / 375 / 393 点宽度下检查布局,并在实际 UIWindow 中验证初始完成态和连续状态切换后,按钮标题仍完整单行显示。 +- 修复了加载指示器约束依赖 UIButton 内部标题布局时造成的标题挤窄;指示器现在相对按钮自身定位。 +- 最终测试结果:`/private/tmp/suixinkan-scenic-ui-final-20261030.xcresult`。 +- `git diff --check` 通过;截图已逐张核对。 + +## 模拟器截图 + +以下均为本地演示页面。 + +| 主列表 | 航线筛选 | +| --- | --- | +| ![主列表](scenic-ui-2026-10-30/library.jpg) | ![航线筛选](scenic-ui-2026-10-30/route-filter.jpg) | + +| 时间筛选 | 视频预览 | +| --- | --- | +| ![时间筛选](scenic-ui-2026-10-30/date-filter.jpg) | ![视频预览](scenic-ui-2026-10-30/preview.jpg) | + +| 下载中 | 部分失败 | 完成 | +| --- | --- | --- | +| ![下载中](scenic-ui-2026-10-30/downloading.jpg) | ![部分失败](scenic-ui-2026-10-30/partial-failure.jpg) | ![完成](scenic-ui-2026-10-30/completed.jpg) | diff --git a/docs/9.9.1/景区空镜库UI实现说明.md b/docs/9.9.1/景区空镜库UI实现说明.md new file mode 100644 index 0000000..5bf0d3e --- /dev/null +++ b/docs/9.9.1/景区空镜库UI实现说明.md @@ -0,0 +1,102 @@ +# 9.9.1 景区空镜库 UI 实现说明 + +实现日期:2026-10-26。分支:`dev_9_9_1`。 + +## 2026-10-30 当前范围与接入状态 + +按用户确认,景区空境库 App 只负责获取、查看和下载素材并保存相册。素材上传、单条重试上传、整单重试上传均不属于本模块需求,不列为待接入功能。 + +| 用途 | 调用方式 | 状态 | +| --- | --- | --- | +| 素材场次列表、航线/日期筛选、分页 | 朱工 `GET /api/app/scenic-media/sessions` | 已接入;航线筛选项取 `filter_options.air_lines` | +| 场次详情与片段地址 | 朱工 `GET /api/app/scenic-media/session-detail` | 已接入,使用 `scenic_media_id` | +| 下载并保存相册 | 对返回的 `oss_url` 直接 GET,再写入系统相册 | 已接入,保存成功才计为完成;支持暂停、继续及下载失败重试 | + +用户明确确认:`/api/app/scenic-media/retry-upload` 和 `/api/app/scenic-media/retry-failed` 不需要对接,后续接口盘点不再列为未接入或待调试项。当前正式页面没有上传入口,也不调用 `mark-download`。界面的“重试失败”仅重试下载失败的素材。 + +非空场次、详情映射、筛选、分页和预览已完成接入,并已有真实非空响应记录;下文 10 月 29 日“待非空映射”的描述仅保留为历史。景区真实业务视频下载并保存相册的完整实测仍待验证,不将本地演示或替身测试写成真实业务成功。 + +## 2026-10-29 接口接入进度(历史记录) + +- 正式入口为 `sceniclibrary`,使用当前账号和景区,进入后请求 `GET /api/app/scenic-media/sessions`。列表支持加载、空态、下拉刷新、错误重试及日期参数;正式入口不会生成演示素材。 +- 依据朱工《随心瞰9.9.1-App机巢与素材库接口.md》接入列表和 `session-detail?scenic_media_id=...` 只读 API。测试环境实测沿用 `token` 请求头和 `code=100000/msg` 包装,而非文档示意的 `code=0/message`。保留期上限实测为 365 天。 +- 已验证列表根字段 `list/groups/total/page/page_size/retention_days/retention_tips/filter/filter_options.air_lines`;当前景区 271 的 90 天及 365 天查询均为空。用户确认目前尚未准备数据。 +- **尚未完成非空展示映射**:文档缺少场次、航线筛选项、详情场次身份、素材 ID、文件类型、时长/大小单位及封面字段的完整示例。API 无损保留这些对象;非空响应暂提示加载失败,不能将未知记录误当空库,也不猜 ID 请求详情。需朱工提供非空 `sessions` 与 `session-detail` 成功 JSON 后继续接入分组、航线筛选、翻页和片段展示。 +- 已准备真实封面加载、远程原片预览、串行下载和 Photos 添加保存能力。仅保存成功计为完成,支持取消、暂停和重试去重;这些能力仍需非空素材映射后才能从正式列表使用。 +- `mark-download` 仅接受 `order_flight_task_media.id`,不用于本空境库。本文档所述空境数据源为 `scenic_media`、`view_album/view_album_detail`,后台新增入口需后端确认。 +- 仅按用户要求运行模拟器测试:首轮 55 项全部通过;生命周期修正后追加 13 项 UI/加载回归全部通过。下载测试使用替身验证 HTTP 下载与相册保存的成功/失败/取消边界,未真实保存业务素材。不调用设备、飞行或订单写接口。 + +以下为初版 UI 历史记录。 + +## 范围与入口 + +依据 2026-10-26 实际查看的[产品体验网页](https://voicestudio.suixinkan.cn/)搭建独立景区空镜库。页面标题沿用原型的“景区素材”,采用白底、航线/时间筛选、首段大图和后续双列卡片、按拍摄时间分组、底部固定下载栏。 + +景区空镜库与机巢工作台各自独立。本模块不依赖机巢订单、拍摄任务、剩余次数或成片交付。正式首页入口等待单独的菜单配置与权限 URI;现有 `drone_dock` 仍只指向机巢工作台。 + +本轮使用本地数据搭建交互,不接真实接口。Debug 版从“首页 → 更多功能 → 全部功能”右上角“空镜预览”进入;无需先打开机巢工作台。页面右上角提供本地状态菜单。 + +## 页面与交互 + +| 功能 | 本轮实现 | +| --- | --- | +| 航线筛选 | 全部航线、指定航线,选择后应用;暂无素材的航线显示筛选空态。 | +| 日期筛选 | 选择起止日期或全部时间,确定后应用,取消不改变原条件;包含首尾两天。使用 iOS 日期滚轮。 | +| 保留期 | 演示显示 90 天,包含今天及此前 89 天;排除未来和保留期外记录。正式值以后端配置为准。 | +| 分组浏览 | 航线分区,同航线拍摄时间倒序;每组首段大图,其余双列,默认最多显示 5 段,可展开/收起。 | +| 选择 | 单段勾选与视频预览独立;整组选中包含折叠片段;切换筛选时清除筛选范围外的选择。 | +| 预览 | 独立半屏预览,展示航线、拍摄时间、片段信息,可播放随包的 3 秒示例短片;原片时长与演示短片明确区分。 | +| 下载演示 | 点击后逐段推进进度,显示批次总数和完成数;锁定选择与筛选,仍可浏览和预览。 | +| 暂停/继续 | 离开页面、锁屏或进入后台暂停;回到前台需手动继续,成功项保留,未完成单项允许从头开始。 | +| 部分失败 | 成功项不重复处理,只重试失败项;支持取消或继续选择。 | +| 权限提示 | 演示相册权限不足及恢复后的手动重试,不申请或更改真实系统权限。 | +| 空态 | 区分整个景区暂无素材与筛选无结果;有筛选条件时可重置。 | + +下载、预览与选择均不扣拍摄次数、不改变订单状态。开始后冻结当前批次,暂停、继续、重试和取消会使旧回执失效。演示记录仅保存在当前页面内存中,重新进入会重置。 + +## 实现结构 + +- `Features/ScenicMaterials/Models/ScenicMaterialModels.swift`:独立账号/景区上下文、航线、批次、片段和下载状态。 +- `Features/ScenicMaterials/ViewModels/ScenicMaterialsViewModel.swift`:Foundation 逻辑,管理筛选、选择、保留期及下载批次。 +- `UI/ScenicMaterials/ScenicMaterialsViewController.swift`:UIKit + SnapKit,Diffable Data Source 与 Compositional Layout,按操作显式刷新。 +- 同目录的组件、筛选面板、预览和演示驱动分别负责展示与本地进度。 +- `ScenicMaterialsPreview.swift`:独立 Debug 启动入口,未添加正式首页 URI 或权限常量。 + +下载阶段包括 `idle`、`downloading`、`paused`、`partialFailure`、`completed`。片段还可展示 `available`、`failed`、`unavailable` 等状态。成功文案为“演示已下载/演示完成”,不表示写入系统相册。 + +| Debug 启动参数 | 用途 | +| --- | --- | +| `--scenic-materials-preview` | 直接打开独立空镜库。 | +| `--scenic-materials-scenario=selected` | 已选择两段。 | +| `--scenic-materials-scenario=downloading` | 固定下载中状态,供布局检查;正常点击下载会自动推进。 | +| `--scenic-materials-scenario=partialFailure` | 一段成功、一段失败,可点击重试。 | +| `--scenic-materials-scenario=paused` | 一段成功、一段待继续。 | +| `--scenic-materials-scenario=completed` | 下载演示完成。 | +| `--scenic-materials-scenario=empty` | 整库为空。 | +| `--scenic-materials-scenario=noResults` | 航线筛选无结果。 | +| `--scenic-materials-permission-denied` | 点击下载后显示本地权限说明。 | + +## 验证 + +- iPhone 11 真机复测 **24 项、0 失败**:17 项模型/ViewModel 测试和 7 项实际 UI 联动测试。模拟器仅用于编译与首屏检查,未运行模拟器单元测试。 +- 验证筛选边界、90 天范围、独立上下文、隐藏第六段全选、真实筛选按钮、预览播放与关闭、下载演示完成、后台暂停、手动继续、旧回执隔离、失败项重试和权限不足。 +- 真机截图检查后修正了日期按钮文字与下载按钮标题的更新过渡,随后全量复测上述 24 项通过。另对展开后的奇数末行补充布局验证,追加真机复测 **1 项、0 失败**,确保“收起片段”独占整行。 +- 14 张截图来自真机 XCTest 隔离窗口,系统状态栏不在图片中。展开态真机测试截图为空白,因此该图采用最终版本的模拟器实际操作截图,已注明来源;文件与测试对应关系见 [evidence.json](scenic-materials-ui-2026-10-26/evidence.json)。未进行全工程回归。 + +| 默认列表 | 选择片段 | 展开第六段 | +| --- | --- | --- | +| ![列表](scenic-materials-ui-2026-10-26/library.png) | ![选择](scenic-materials-ui-2026-10-26/selected.png) | ![展开(模拟器)](scenic-materials-ui-2026-10-26/expanded-simulator.jpg) | + +| 航线筛选 | 日期筛选 | 筛选无结果 | +| --- | --- | --- | +| ![航线](scenic-materials-ui-2026-10-26/route-filter.png) | ![日期](scenic-materials-ui-2026-10-26/date-filter.png) | ![空态](scenic-materials-ui-2026-10-26/no-results.png) | + +| 视频预览 | 下载演示 | 演示完成 | +| --- | --- | --- | +| ![预览](scenic-materials-ui-2026-10-26/preview.png) | ![下载中](scenic-materials-ui-2026-10-26/downloading.png) | ![完成](scenic-materials-ui-2026-10-26/completed.png) | + +| 暂停待继续 | 部分失败 | 权限说明 | +| --- | --- | --- | +| ![暂停](scenic-materials-ui-2026-10-26/paused.png) | ![失败](scenic-materials-ui-2026-10-26/partial-failure.png) | ![权限](scenic-materials-ui-2026-10-26/permission.png) | + +本轮不包含真实空镜列表、授权下载地址、网络传输、相册写入、持久化恢复或后端联调。后续需对接独立景区素材的筛选选项、批次/片段列表及下载授权;具体接口契约另行确认。 diff --git a/docs/9.9.1/机巢UI首轮实现说明.md b/docs/9.9.1/机巢UI首轮实现说明.md new file mode 100644 index 0000000..d7722f0 --- /dev/null +++ b/docs/9.9.1/机巢UI首轮实现说明.md @@ -0,0 +1,65 @@ +# 9.9.1 机巢 UI 首轮实现 + +实现日期:2026-10-23。当前分支:`dev_9_9_1`。 + +后续更新:拍摄准备与当前任务已在第二轮补齐,参见[拍摄流程 UI 实现说明](拍摄流程UI实现说明.md)。本文记录首轮交付范围。 + +素材入口后续已接通,参见[素材库 UI 实现说明](素材库UI实现说明.md)。 + +## 后续:首页入口适配(2026-10-26) + +- 已注册正式菜单 URI `drone_dock`,名称“机巢工作台”,使用本地系统图标;服务端需在当前角色的 `role.permission` 顶层返回该权限。 +- 点击首页常用入口打开现有机巢工作台,保留“请先选择景区”的门槛;工作台仍为本地演示数据,未因此接入真实业务接口。 +- 重新打开 App 拉取权限后,已有常用配置的账号可在“更多功能”中添加该入口;保持默认前四项及用户自定义规则,撤权后缓存入口也会隐藏。 +- iPhone 11 真机验证 47 项、0 失败,包含新增菜单权限/常用配置 3 项、路由 2 项及首页相关回归;测试不修改用户已有常用配置或原账号景区。 + +## 范围 + +- 机巢工作台:景区与工作人员、无人机遥测卡、设备横向翻页、余次订单、素材摘要、查看全部、今日统计。 +- 我的拍摄订单:全部/待拍摄/进行中/已完成四个分类、数量、完整订单卡、进度、上传及交付摘要、空态。 +- UIKit + SnapKit + MVVM;复杂列表使用 Compositional Layout 与 Diffable Data Source。 +- 两页共享 `DroneDockDemoStore`,使用本地固定数据,不调用机巢业务接口、不向设备发送指令。 +- 收款、拍摄准备/当前任务、素材、成片交付的下级页面尚未搭建,本轮按钮显示相应订单的入口提示。 + +## 保留的交互规则 + +1. 仅读取当前用户在当前景区的订单;演示上下文不写入真实登录会话。 +2. 工作台只显示剩余次数大于 0 的订单,有当前任务的订单优先置顶。 +3. 有任务时主按钮为“查看当前任务”,右上角显示任务阶段,不增加点位或航线信息。 +4. 支持前往拍摄点、已到达待拍摄、拍摄中、拍摄暂停、返航中、返航暂停、任务状态待确认七种标签。 +5. 次数用完即移出工作台,在“已完成”中查看;仍在返航时保留“查看当前任务”入口。 +6. 已拍摄部分次数、尚有余次的订单归“进行中”。上传、交付、游客确认摘要独立于拍摄次数。 +7. 页面刷新、切换 Tab、查看任务不扣次、不新建任务、不改变任务阶段。 +8. 多设备横滑仅用于查看设备;单台隐藏分页点,未知遥测显示“—”,不显示为 0。 + +## 预览入口 + +Debug 构建进入“全部功能”,点击导航栏“机巢预览”。正式菜单与服务端权限判断保持原样,未伪造机巢权限。 + +工作台景区行右侧的“演示状态”菜单仅在 Debug 存在,可切换七种任务阶段、次数用完仍返航、单台设备、未知遥测、无设备和无订单。 + +也可以在 Xcode 的 Run → Arguments Passed On Launch 配置: + +| 参数 | 作用 | +| --- | --- | +| `--dock-ui-preview` | 冷启动直达本地工作台 | +| `--dock-ui-orders-preview` | 冷启动直达本地订单列表,默认全部 | +| `--dock-ui-scenario=shooting` | 使用拍摄中场景 | +| `--dock-ui-scenario=completedReturning` | 使用次数用完仍返航场景 | +| `--dock-ui-filter=completed` | 订单页初始显示已完成 | + +启动参数入口只在 Debug 生效,不修改账号、景区或登录凭证。不要在运行正常业务时保留这些启动参数。 + +## 验证 + +- iOS 真机目标编译通过。 +- 已在连接的 iPhone 11 上执行 `DroneDockViewModelTests` 与 `DroneDockViewTests`:15 项全部通过,0 失败。 +- 测试覆盖当前用户/景区过滤、任务置顶、0 次仍返航、四分类、刷新不扣次、切景区保留原任务、未知遥测、真实按钮跳转与回调、可见布局歧义检查。 +- 模拟器仅用于界面运行与手动交互核对,未在模拟器执行单元测试。 +- 当前仅验证上述新增测试,未执行全工程回归测试。 + +下面是真机 XCTest 保留的应用页面渲染图,系统状态栏不在临时窗口截图内: + +| 工作台 | 我的拍摄订单 | 已完成中仍返航 | +| --- | --- | --- | +| ![工作台](ui-implementation-2026-10-23/workbench.png) | ![全部订单](ui-implementation-2026-10-23/orders-all.png) | ![已完成返航](ui-implementation-2026-10-23/orders-completed-returning.png) | diff --git a/docs/9.9.1/机巢工作台-页面接口与提供方清单.md b/docs/9.9.1/机巢工作台-页面接口与提供方清单.md new file mode 100644 index 0000000..c98ea97 --- /dev/null +++ b/docs/9.9.1/机巢工作台-页面接口与提供方清单.md @@ -0,0 +1,297 @@ +# 机巢工作台:页面接口与提供方清单 + +更新日期:2026-11-05。适用:iOS、Android 当前正式业务页面,分支 `dev_9_9_1`。 + +核对版本:iOS `31f9853`,Android `e5aa2ca0`。本清单根据两端源码的实际调用链整理,不把本地演示页或接口合同中尚未被页面调用的能力算作已调用接口。 + +共梳理 **24 个不同的 HTTP 接口路径**:18 个机巢主流程业务接口、2 个公共服务接口、4 个复用线下收款接口;另列 WS、厂商 SDK 与动态文件地址请求。同一接口被多个页面复用时会在对应页面重复列出。 + +## 1. 接口由谁提供 + +| 提供方 | 本模块负责的接口范围 | 归属依据 | +| --- | --- | --- | +| **朱工** | 设备首页、设备状态与电量、召唤、任务状态、开始拍摄、安全指令、图传参数;机巢任务 WS 对接合同 | iOS 机巢 API 的明确注释,以及本轮《随心瞰9.9.1-App机巢与素材库接口》合同 | +| **张工** | 拍摄订单、今日统计、航拍套餐、套餐收款码、收款记录、购买点位航线、创建待飞任务、订单素材、成片登记、游客确认码 | iOS `multi-plane` API 的明确注释、既有联调记录;Android 相同路径互证 | +| **公共服务,具体维护人待确认** | Socket 订阅票据、OSS STS 上传配置 | 当前源码能确认复用公共服务,不能仅凭 URL 确定个人负责人 | +| **既有线下收款服务,具体维护人待确认** | 线下收款登记、统计、明细、补缴 | 机巢收款页复用已有线下收款模块;当前资料未明确个人负责人 | +| **云厂商 / App 本地能力** | 阿里云 OSS 文件上传、火山 RTC 收流、资源 URL 下载、相册选择与保存、局域网面对面闪传 | 不属于新增的机巢后端业务接口 | + +说明:文中的“提供方”是已确认的业务对接归属,不根据路径前缀推测人员。公共 Socket 服务参与 `/wss` 鉴权与推送;机巢任务协议按朱工合同对接,公共基础服务的个人维护归属仍需确认。 + +## 2. 页面关系 + +下图为主要流程示意,不枚举每个订单卡片的全部入口。 + +```mermaid +flowchart TD + A[机巢工作台] --> B[我的拍摄订单] + A --> C[收款详情] + C --> D[收款记录] + C --> E[线下收款登记] + A --> F[拍摄准备] + B --> F + F --> G[拍摄任务] + B --> G + B --> H[订单素材库] + G --> H + B --> I[交付方式弹窗] + H --> I + I --> J[面对面闪传] + I --> K[云端上传] + B --> L[订单交付确认] +``` + +“继续查看任务”携带已有任务 ID 直接进入任务页,不重新创建或召唤。任务页查看素材、交付弹窗选择方式等导航动作,不等于调用新的写接口。 + +## 3. 按页面查看接口 + +### 3.1 机巢工作台首页 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 无人机 / 机巢卡片 | `GET /api/app/airport/home` | `scenic_id` | **朱工** | +| 我的拍摄订单 | `GET /api/yf-handset-app/photog/multi-plane/orders` | `scenic_id`、`status=all`、`page`、`page_size=20` | **张工** | +| 今日统计 | `GET /api/yf-handset-app/photog/multi-plane/today-stats` | `scenic_id` | **张工** | + +调用时机:进入工作台、返回工作台、手动刷新。三个区域独立读取,订单加载更多只继续请求 `orders`。首页没有常规定时轮询。 + +设备横向切换使用 `home` 已返回的设备数组,不另查设备详情。今日统计的日期口径由服务端处理,App 不传本地日期。 + +### 3.2 我的拍摄订单列表 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 分类、刷新及分页 | `GET /api/yf-handset-app/photog/multi-plane/orders` | `scenic_id`、`status`、`page`、`page_size=20` | **张工** | + +`status` 分别为:`all` 全部、`pending` 待拍摄、`processing` 进行中、`completed` 已完成。 + +调用时机:进页、返回列表、切换分类、下拉刷新、加载更多。列表没有常规定时轮询。 + +订单按钮只决定导航:开始拍摄进入准备页;继续查看任务使用 `active_task_id` 进入已有任务;素材、交付和确认分别进入对应页面,不在列表点击时直接提交飞控或确认订单。 + +### 3.3 收款详情页 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 获取可售航拍套餐 | `GET /api/yf-handset-app/photog/multi-plane/projects` | `scenic_id` | **张工** | +| 生成指定套餐收款码 | `POST /api/yf-handset-app/photog/multi-plane/pay-code` | `scenic_id`、`project_id`;可选 `price` | **张工** | +| 加载收款码图片 | 请求 `pay-code` 回包中的图片地址 | 动态 `pay_url` | 地址由**张工接口**提供,文件由对应资源服务提供 | + +调用时机:页面加载套餐;用户确认套餐后生成码;设置金额并确认后重新请求收款码。首次按套餐生成码时省略 `price`,使用服务端售价。两端套餐重读时机见第 5 节。 + +- 套餐选择弹窗、金额输入弹窗本身是本地 UI,确认操作才触发相应业务请求。 +- 图片加载重试只重载图片,不等于再次生成收款码。 +- 收款方使用本地商户信息;员工 ID、景区名来自当前登录上下文,不在此页额外请求用户资料。 +- 此页没有单笔支付状态轮询,也没有页面专属 WS。收款记录可用于核对到账,不能把最新一条记录直接认作当前二维码已支付。 +- 当前机巢套餐收款页不调用旧普通收款的 `/photog/pay-page-config`、`/photog/pay-code`。 + +### 3.4 收款记录页 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 收款记录及汇总 | `GET /api/yf-handset-app/photog/multi-plane/receipts` | `scenic_id`、`page`;可选 `project_id` | **张工** | + +进入、下拉刷新、加载更多时读取。此接口当前不传 `page_size`,不是单笔支付状态查询接口。 + +### 3.5 拍摄准备页 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 购买范围、次数、可选点位和航线 | `GET /api/yf-handset-app/photog/multi-plane/project-info` | `scenic_id`、`project_id`、`order_number` | **张工** | +| 无人机推荐、忙闲及电量 | `GET /api/app/airport/plane-status` | `scenic_id`、`live_battery=1` | **朱工** | +| 创建当前订单的待飞任务 | `POST /api/yf-handset-app/photog/multi-plane/tasks/create` | `scenic_id`、`order_number`、`scenic_spot_id`、`air_line_id` | **张工** | +| 召唤已创建的任务 | `POST /api/app/airport/shoot` | `id=创建回包的task_id`、`restart=false` | **朱工** | + +调用顺序: + +1. 进入 / 返回准备页及手动刷新读取 `project-info`,并读取 / 轮询 `plane-status`;从后台回前台的两端策略见第 5 节。 +2. 用户本地选择点位、航线;选择动作本身不创建任务。 +3. 首次点击“确认并召唤”创建任务前,再次请求 `project-info`,并按已有设备快照校验设备条件;此动作不强制新增一次 `plane-status` 查询。 +4. 张工 `tasks/create` 返回任务 ID 后,串行调用朱工 `shoot`。 +5. 进入任务页,由任务页读取 `shooting` 并建立订阅。 + +仅 `plane-status` 周期读取,默认约 5 秒;`project-info` 不随每一轮设备查询重复请求。离页 / 后台停止设备轮询。准备页间隔限制的两端差异见第 5 节。 + +创建任务不等于召唤、起飞或开始拍摄。已创建的任务按现有回执继续处理,不因返回页面重复创建,不自动重发结果未知的写请求。 + +### 3.6 拍摄任务页 + +本页每个接口的完整入参、返回 JSON 示例及字段解释,见[拍摄任务页-接口入参与返回 JSON 详解](/Users/hanqiu/Desktop/suixinkan/docs/9.9.1/拍摄任务页-接口入参与返回JSON详解.md)(2026-11-06 补充)。 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 任务阶段、飞控权限、六项读数 | `GET /api/app/airport/shooting` | `id`、`live_battery=0` | **朱工** | +| 获取实时订阅票据 | `GET /api/app/socket-token` | 无业务参数,沿用当前登录鉴权 | **公共 Socket 服务,具体维护人待确认** | +| 机巢和无人机的图传参数 | `GET /api/app/airport/live` | `id` | **朱工** | +| 手动开始拍摄 | `POST /api/app/airport/start-shoot` | `id` | **朱工** | +| 紧急暂停、继续任务、立即返航 | `POST /api/app/airport/command` | `id`、`command`、`client_request_id` | **朱工** | +| 重新召唤同一任务 | `POST /api/app/airport/shoot` | `id`、`restart=true` | **朱工** | + +当前页面实际发送的 `command`: + +| 按钮 | command | +| --- | --- | +| 紧急暂停 | `flighttask_pause` | +| 继续任务 | `flighttask_recovery` | +| 立即返航 | `return_home` | + +`return_home_cancel` 虽在合同 / 白名单中定义,当前两端任务页没有开放该动作。 + +读取与调用时机: + +- 进页、回前台先请求 `shooting`,然后取 Socket 票据并建立任务订阅;导航栏刷新及操作后的核对也读取 `shooting`。 +- 默认约 5 秒串行 HTTP 兜底,后端间隔限制为 2~30 秒。正式订阅成功且拿到有效完整快照后,停止常规 HTTP 轮询;订阅失败、断连等情况恢复兜底。额外核对的两端差异见第 5 节。 +- `start-shoot`、`command`、重召唤 `shoot` 均由用户明确点击且门禁允许时提交,不由倒计时或普通状态刷新自动发送。 +- 到达后的 30 秒倒计时由 App 本地维护,只更新显示,不请求“倒计时接口”,不在归零时自动开拍。 +- 任务页可见、已有有效任务快照且未结束图传时自动取 `live`;缺一路参数时按建议间隔补取,默认 30 秒、限制 5~60 秒;凭证临期前 30 秒续取。 +- `live` 获取参数可能启动设备推流,不只是下载一张图片。两端使用火山 RTC SDK 接收 `airport` / `drone` 两路视频,SDK 入房、订阅、续期、退房不属于新增后端 REST 接口。 +- 离页 / 后台停止读取和本地接收;录制结束后停止本地接收。App 不因此下发设备停流接口。 + +#### 拍摄任务 WebSocket + +| 项目 | 当前实现 | 提供方 | +| --- | --- | --- | +| 通道 | 正式 `wss://api.zhifly.cn/wss`;测试 `wss://api-test.zhifly.cn/wss` | **朱工机巢任务合同 + 公共 Socket 服务** | +| 订阅 | 收到文本 `Opened` 后发送 `type=310`,`params` 含 `id`、`socket_token` | 同上 | +| 退订 | 发送 `type=311`,`params` 含 `id`,随后关闭连接 | 同上 | +| 业务推送 | `data.action=app_airport_shooting_updated`;`data.params` 是任务完整快照 | 同上 | + +`ready` / `received` 不是正式订阅成功。需收到 `ack=subscribe`、`subscribed=true`,并拿到有效完整快照;也支持 `subscribe_meta.has_snapshot=false` 后通过本次新 HTTP 完整快照补齐。`311` 是退订,不是推送类型。Ping/Pong 没有额外业务 HTTP 接口。 + +朱工合同中的技术分工为 `service-fly` 生成状态快照,公共 Socket 链路 / `hyperf-socket` 负责订阅鉴权与推送;基础服务的具体个人维护人仍需确认。 + +### 3.7 订单素材库页 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 订单摘要、次数、购买点位、交付权限 | `GET /api/yf-handset-app/photog/multi-plane/orders/detail` | `scenic_id`、`order_number` | **张工** | +| 当前订单任务、原素材及任务成片 | `GET /api/yf-handset-app/photog/multi-plane/tasks` | `scenic_id`、`order_number`;可选 `scenic_spot_id` | **张工** | + +首次进入 / 主动刷新先读取摘要,再读取任务;云端交付返回后重读清单。`tasks` 没有分页参数,全部点位时省略 `scenic_spot_id`。切点位的两端差异见第 5 节。 + +素材库没有固定轮询或 WS,页面所显示的素材上传状态依靠上述查询刷新。 + +### 3.8 素材预览与下载 + +| 操作 / 子页面 | 实际请求 | 提供方 | +| --- | --- | --- | +| 原素材 / 成片预览 | 使用 `tasks` 已返回的 `cover_url`、`file_url` 等地址加载图片或视频 | 地址由**张工接口**提供;文件由对应存储 / CDN 提供 | +| 下载原素材 | GET 返回的文件 URL,下载到本地后保存系统相册 | 对应存储 / CDN;相册保存由系统组件完成 | +| 勾选、全选、暂停 / 继续 / 失败重试 | 本地选择及下载管理,不新增业务接口 | App 本地 | + +没有另调“任务素材详情”业务接口。播放器可能产生 GET / Range 文件请求,但不是新的订单 API。当前原素材批量下载清单不包含独立交付成片;下载重试不会调用后端素材上传重试接口。 + +### 3.9 交付方式弹窗 + +| 操作 | iOS | Android | 提供方 | +| --- | --- | --- | --- | +| 打开“面对面闪传 / 云端上传”方式选择 | 使用入口订单摘要,无新增请求 | 共用交付容器初始化时会先查 `orders/detail` + `tasks` | 如有订单预读,由**张工**提供 | +| 切换交付方式 | 本地导航 | 本地切换阶段,复用已读数据 | App 本地 | + +没有独立的“获取交付方式”接口。从素材任务右侧进入时会透传已关联的任务 ID,云端页核对并选中原任务,不要求重新创建任务。 + +### 3.10 云端上传页 + +| 用途 | 方法与接口 | 关键入参 / 内容 | 提供方 | +| --- | --- | --- | --- | +| 订单、点位、权限核对 | `GET /api/yf-handset-app/photog/multi-plane/orders/detail` | `scenic_id`、`order_number` | **张工** | +| 获取可交付任务与已有成片 | `GET /api/yf-handset-app/photog/multi-plane/tasks` | `scenic_id`、`order_number` | **张工** | +| 获取 OSS 临时上传配置 | `GET /api/app/config/get-sts-token` | `bucket=default` | **公共上传配置服务,具体维护人待确认** | +| 上传视频文件 | OSS SDK `PutObject`,对应动态 OSS 地址的 `PUT` | 配置返回的 endpoint / bucket / region / STS,生成的 object key,视频二进制 | **阿里云 OSS** | +| 保存或替换任务成片 | `POST /api/yf-handset-app/photog/multi-plane/tasks/film` | `scenic_id`、`task_id`、`file_url`、`file_name` | **张工** | + +实际顺序: + +1. 进入 / 刷新时读 `orders/detail` + `tasks`;Android 可能已在方式选择容器中预读。 +2. 用户通过系统组件单选视频,App 准备本地文件与预览;选择视频不自动上传,不新增业务接口。 +3. 点击“上传所选视频”后,再读订单及任务,核对当前权限、目标任务和已有成片。 +4. 取得 STS 配置,调用 OSS SDK 上传视频。 +5. 上传完成后再次核对订单及任务,再调用 `tasks/film` 登记成片。 +6. 保存成功后刷新摘要及任务列表。 + +`tasks/film` 只登记地址,不接收文件二进制,也不提交 `order_number`。上传进度来自本机 SDK,没有另一个“查询上传百分比”接口。保存失败 / 结果未知时先核对,必要时复用已上传 URL 重试登记,避免重复上传。 + +### 3.11 面对面闪传页 + +传输由工作人员手机启动本地 HTTP 服务,游客浏览器访问二维码里的局域网地址。**提供方是 App 本地服务,不是张工或朱工的云端接口。** + +| 平台 | 接收网页 | 视频文件 | +| --- | --- | --- | +| iOS | `GET / HEAD http://{手机局域网IP}:{随机端口}/s/{token}` | `GET / HEAD /s/{token}/video` | +| Android | `GET / HEAD http://{手机局域网IP}:{随机端口}/t/{token}` | `GET / HEAD /t/{token}/file` | + +选择一个本地视频并主动生成二维码后才启动监听;默认会话 600 秒,文件支持 Range。离页 / 后台 / 结束闪传后停止服务,旧二维码失效。 + +传输本身不申请 STS、不上传 OSS、不登记 `tasks/film`、不自动确认订单。Android 进入交付容器时已有的订单预读见 3.9。“文件已发送”不等于游客已保存相册。 + +### 3.12 订单交付确认页:待确认 / 已确认 + +| 用途 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 读取订单及游客确认结果 | `GET /api/yf-handset-app/photog/multi-plane/orders/detail` | `scenic_id`、`order_number` | **张工** | +| 展示整单任务与成片清单 | `GET /api/yf-handset-app/photog/multi-plane/tasks` | `scenic_id`、`order_number`,不按点位缩小整单清单 | **张工** | +| 生成游客确认邀请小程序码 | `POST /api/yf-handset-app/photog/multi-plane/orders/confirm-code` | `scenic_id`、`order_number` | **张工** | +| 显示 / 保存确认码图片 | 加载回包的 `confirm_url` 图片地址 | 动态图片 URL | 地址由**张工接口**提供;资源服务 / 系统相册 | + +调用时机:首屏 / 完整刷新读 `detail` + `tasks`;工作人员勾选核对只修改本地状态;点击生成时先重新检查权限,再 POST 确认码。出码前核对范围的两端差异见第 5 节。 + +**自动刷新:仅页面可见、前台且待游客确认时,每次请求结束后等待 5 秒,只查 `orders/detail`。**离页 / 后台停止,返回立即查一次;确认完成后停止轮询。此页面不使用 WS 或消息推送获知确认结果。 + +确认码是后端返回的小程序码图片,App 不把 `confirm_url` 再编码成另一个二维码。生成码、扫码、工作人员勾选都不等于游客确认;订单完成以最新 `order_status=30` 为准。商家 App 没有代游客确认的 POST。 + +## 4. 收款详情复用的线下收款子页面 + +以下属于既有线下收款模块,因收款详情中有入口,在此一并列出。**具体个人负责人待确认,不仅凭 `yf-handset-app` 前缀归给张工。** + +| 页面 / 操作 | 方法与接口 | 关键入参 | 提供方 | +| --- | --- | --- | --- | +| 线下收款登记 | `POST /api/yf-handset-app/photog/offline-pay-collect/register` | `scenic_id`、`amount`(元字符串)、`pay_method` | 既有线下收款服务,**维护人待确认** | +| 登记成功汇总 / 线下收款汇总 | `GET /api/yf-handset-app/photog/offline-pay-collect/statistics` | `scenic_id` | 同上 | +| 日清 / 当日收款明细 | `GET /api/yf-handset-app/photog/offline-pay-collect/details` | `scenic_id`、`date`;不分页 | 同上 | +| 日清补缴 | `POST /api/yf-handset-app/photog/offline-pay-collect/supplement` | 仅 `scenic_id`、`date` | 同上 | + +登记成功刷新今日汇总;明细页进页、刷新或换营业日时读取明细;补缴后重读统计及明细。补缴金额与笔数由服务端结算,不提交本地汇总快照。 + +## 5. 当前两端调用差异 + +| 场景 | iOS 当前实现 | Android 当前实现 | +| --- | --- | --- | +| 收款套餐重新读取 | 首次进页 / 身份变化 / 失败重试 | 页面重新可见 / 下拉刷新 | +| 准备页设备轮询 | 默认 5 秒,后端间隔限制 **5~60 秒** | 默认 5 秒,后端间隔限制 **2~30 秒** | +| 准备页从后台回前台 | 重启 `plane-status` 轮询,不因此重查 `project-info` | 重新读取 `project-info` 并启动 `plane-status` 轮询 | +| 任务页额外 HTTP 核对 | 拍摄中 120 秒静默核对;`metrics_stale=true` 也会进入 HTTP 兜底 | 拍摄中 120 秒静默核对;本地 `UNKNOWN` 阶段继续周期只读核对 | +| 素材库切换点位 | 只重新请求带点位筛选的 `tasks` | 重新请求 `orders/detail` + 带点位筛选的 `tasks` | +| 打开交付方式弹窗 | 不请求订单;选云端后才加载 | 共用交付容器打开时已预读 `detail` + `tasks` | +| 交付确认点击出码前复核 | 再读 `orders/detail` | 再读 `orders/detail` + `tasks` | +| 闪传本地路由 | `/s/{token}`、`/s/{token}/video` | `/t/{token}`、`/t/{token}/file` | + +本表记录源码现状,不把两端表面相同的页面写成完全相同的请求次数。 + +## 6. 公共规则与容易混淆的边界 + +- 业务 HTTP 复用当前登录鉴权;页面范围使用当前景区和订单。登录、权限菜单和景区切换属于全局模块,不是每个机巢页面重新调用一遍。 +- `shooting / shoot / start-shoot / command / live` 的 `id` 是订单飞行任务 ID,即 `order_flight_task.id`,不是 `wayline_task_id`。`wayline_task_id` 是关联航线任务 ID;快照批次比较使用后端明确返回的 `execution_batch`,App 不自行推导批次。 +- `order_status=20` 表示整单进行中,`30` 表示整单已完成;`active_task_status=25` 表示关联任务素材处理中,不是新增 `order_status=25`。 +- 任务业务阶段主要来自 `ui.phase`,设备与安全操作许可来自 `flight_control`;两者由朱工任务状态接口 / WS 提供,订单次数和交付权限由张工订单接口提供。 +- 云端成片“上传成功”“登记成功”“游客已确认”是三件事,不能用 OSS 成功替代 `tasks/film`,也不能用 `tasks/film` 成功替代游客确认。 +- 系统相册选择、预览播放器、保存图片 / 视频、权限申请均不新增机巢后端业务接口;预览、码图和文件下载可能访问回包中的资源 URL。 +- 当前正式机巢页面不调用合同中另一套 `airport/list`、`airport/workbench`、`airport/info`、`airport/status`、`airport/task-info` 或 `order-flight-task/list/detail/sync/shoot-stats`。 +- 当前订单素材库使用张工 `multi-plane/orders/detail`、`tasks`,不使用朱工 `scenic-media/order-materials`、`mark-download`、`retry-upload`、`retry-failed`。独立“景区空境库”模块的 `sessions` / `session-detail` 不在本文范围。 + +## 7. 源码与归属依据 + +以下为本机可直接打开的核对入口;历史 UI 演示文档不作为当前请求清单。 + +| 范围 | iOS 依据 | Android 依据 | +| --- | --- | --- | +| 首页、订单、统计 | [DroneDockAPI.swift](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockAPI.swift:3) | [RemoteDroneHomeViewModel.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/home/RemoteDroneHomeViewModel.kt:31) | +| 套餐、收款码、记录 | [DroneDockPaymentAPI.swift](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockPaymentAPI.swift:3) | [RemoteDronePaymentViewModel](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/home/RemoteDroneHomeViewModel.kt:110) | +| 购买范围 / 设备 / 创建 / 召唤分工 | [PreparationAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockPreparationAPI.swift:10)、[PlaneStatusAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockPlaneStatusAPI.swift:10)、[TaskCreationAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockTaskCreationAPI.swift:10)、[ShootAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift:17) | [RemoteDronePreparationViewModel.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/preparation/RemoteDronePreparationViewModel.kt:109) | +| 任务读取与操作 | [ShootingAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift:3)、[CommandAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockCommandAPI.swift:10)、[TaskViewModel](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/ViewModels/DroneDockShootingTaskViewModel.swift:36) | [RemoteDroneTaskViewModel.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/RemoteDroneTaskViewModel.kt:72) | +| WS 与图传 | [RealtimeSession](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Services/DroneDockShootingRealtimeSession.swift:89)、[SocketTokenAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockSocketTokenAPI.swift:21)、[LiveAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockLiveAPI.swift:3) | [DroneTaskSocket.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/DroneTaskSocket.kt:22)、[DroneLivePanel.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/task/DroneLivePanel.kt:107) | +| 素材、成片登记、确认码 | [MaterialsAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockMaterialsAPI.swift:14)、[DeliveryAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockDeliveryAPI.swift:10)、[ConfirmationAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/API/DroneDockConfirmationAPI.swift:10) | [DroneRemoteMediaApi](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/media/DroneRemoteMediaModels.kt:72) | +| STS 与 OSS | [UploadAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Core/Upload/UploadAPI.swift:25)、[DroneDockFilmUploader](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Services/DroneDockFilmUploader.swift:36) | [DroneFilmUploader.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/delivery/DroneFilmUploader.kt:81) | +| 闪传本地协议 | [NearbyTransferServer](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferServer.swift:196) | [DroneNearbyHttpServer.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/ui/dronedock/remote/delivery/DroneNearbyHttpServer.kt:51) | +| 线下收款复用接口 | [OfflineCollectionAPI](/Users/hanqiu/Desktop/suixinkan/suixinkan/Features/OfflineCollection/API/OfflineCollectionAPI.swift:14) | [NetworkApi.kt](/Users/hanqiu/Desktop/Android_Pro/zhiflyfollow/app/src/main/java/com/zhifly/follow/network/NetworkApi.kt:315) | + +补充合同:[随心瞰9.9.1-App机巢与素材库接口.md](/Users/hanqiu/Downloads/随心瞰9.9.1-App机巢与素材库接口.md)。 diff --git a/docs/9.9.1/素材库UI实现说明.md b/docs/9.9.1/素材库UI实现说明.md new file mode 100644 index 0000000..8d01df7 --- /dev/null +++ b/docs/9.9.1/素材库UI实现说明.md @@ -0,0 +1,79 @@ +# 9.9.1 素材库 UI 实现说明 + +实现日期:2026-10-23。分支:`dev_9_9_1`。 + +后续更新:成片交付入口已在下一轮接通,参见[交付成片 UI 实现说明](交付成片UI实现说明.md);下文保留素材库交付时的范围记录。 + +2026-10-29:已将原型布局适配到读取真实接口的 `DroneDockMaterialsViewController`,并更新本地下载演示各状态的视觉组合。范围、边界及验证见[订单素材库 UI 对齐](订单素材库UI对齐-2026-10-29.md)。真实下载与上传重试仍未开放,不将演示进度或结果用于真实订单。 + +## 本轮范围 + +接通工作台、我的拍摄订单和当前任务的素材入口,实现本地订单素材库、照片/视频预览、多选及下载演示。布局按[新版原型复核](UI更新复核-2026-10-23.md)中的素材页面:订单摘要、点位标签、拍摄记录分组、两列缩略图、固定下载底栏。 + +使用现有本地演示图片,另将游客示例图编码为一个 3 秒静态画面视频,供播放器交互验收。没有真实游客媒体或远程视频请求。 + +## 已保留的交互规则 + +| 场景 | 实现行为 | +| --- | --- | +| 订单入口 | 展示整单素材,支持横向点位筛选,拍摄记录按时间从新到旧排列。 | +| 当前任务入口 | 只显示当前任务点位的素材,不提供切换到全部点位的入口。 | +| 预览与勾选 | 缩略图打开预览;右上角圆圈独立勾选;关闭预览保留选择及下载批次。 | +| 照片预览 | 黑底全屏、页码、左右翻页、双指/双击缩放和关闭。 | +| 视频预览 | 明确点击播放才打开本地播放器;无可播放文件时显示静帧及说明。 | +| 素材未全部上传 | 已就绪的文件可预览和下载;上传中、上传失败及不可用文件不可选择。 | +| 全选与筛选 | 全选仅覆盖当前范围可下载文件,排除已完成项;切换点位清空勾选。 | +| 下载执行 | 开始时冻结批次文件;下载与保存分别建模;执行期间禁止改变选择和筛选,重复点击不会新增批次。 | +| 返回/离页 | 下载进行中点击返回先提示,确认离开后暂停未完成项,保留已完成项;查看预览不会触发离页暂停。 | +| 后台/锁屏 | 停止本地驱动并暂停;返回前台不自动恢复,必须手动点“继续下载”。 | +| 继续/重试 | 继续跳过成功和明确失败项;失败后仅重试失败项;保存失败只重试保存。未完成文件重新下载,不实现字节续传。 | +| 跨入口 | 整单下载暂停后进入当前任务,只继续该点位;其他点位未完成文件保留暂停状态,之后可在整单入口重新选择。 | +| 完成与履约 | 演示完成不改变订单拍摄次数、当前任务或游客交付状态。已完成项在本次运行内保留,不重复选择。 | + +规则依据:[当前方案基线 C13/C14/R06](review/product-comparison/current-baseline.md)。素材页的下载离页确认与拍摄任务页返回规则分别处理。 + +## 状态覆盖 + +列表有加载中、加载失败、空列表和正常列表;文件区分上传中、上传完成、上传失败及不可用。下载阶段覆盖未选择、已选择、下载中、待保存、保存中、暂停、部分失败、完成;另有演示相册权限受限和保存失败。 + +文件身份、订单/景区上下文和批次令牌分开校验,暂停、继续及重试使旧回执失效。素材状态存放于共享内存数据源,同一订单从不同页面进入可恢复;应用重启后演示数据重置。 + +## 演示入口与限制 + +Debug 版“全部功能 → 机巢预览”,点击订单的“查看素材”;任务成功后的素材入口只显示当前点位。 + +素材页右上角菜单可切换就绪、混合上传、下载中、暂停、部分失败、保存失败、相册权限受限、完成、空列表及加载异常等验收场景。正常点击下载后,本地驱动自动演示逐项进度;也可使用菜单注入明确回执。菜单恢复权限后仍需手动继续。 + +可选启动参数: + +| 参数 | 用途 | +| --- | --- | +| `--dock-ui-materials-preview` | 直达素材库,默认混合上传场景 | +| `--dock-materials-scenario=paused` | 进入暂停场景;亦可选 `ready`、`partialFailure`、`completed` 等枚举值 | +| `--dock-materials-point=point-shaoshi` | 只显示指定演示点位 | + +本轮暂不接真实接口,不请求 Photos 权限,不下载远程文件,不写系统相册。完成文案明确为“演示完成,未写入系统相册”。相册拒权只是本地场景;交付成片保留占位提示,收款继续暂缓。 + +## 验证与截图 + +- iOS 真机目标编译通过;模拟器仅用于页面视觉检查,未运行模拟器单元测试。 +- iPhone 11 真机复测 **74 项、0 失败**:本轮素材规则 21 项、预览 3 项、素材联动 5 项,以及之前机巢与拍摄流程 45 项。 +- 覆盖真实入口导航、点位范围、勾选与预览互不影响、本地视频随包可播放、下载自动演示、后台暂停与手动继续、失败重试、保存阶段、旧回执隔离、订单额度不变及页面可见约束。 +- 首轮真机检查发现的预览图片零尺寸问题已修复,复测增加图片实际尺寸和图片/关闭/播放控件点击可达检查。 +- 未接真实网络/Photos,未进行全工程回归。截图由真机 XCTest 隔离窗口渲染,系统状态栏不在截图中。 + +| 混合上传状态 | 全选可下载 | +| --- | --- | +| ![混合上传](materials-ui-2026-10-23/library-mixed.png) | ![选择](materials-ui-2026-10-23/library-selected.png) | + +| 下载演示中 | 后台暂停 | +| --- | --- | +| ![下载中](materials-ui-2026-10-23/download-running.png) | ![暂停](materials-ui-2026-10-23/download-paused.png) | + +| 部分失败 | 演示完成 | +| --- | --- | +| ![部分失败](materials-ui-2026-10-23/download-partial-failure.png) | ![演示完成](materials-ui-2026-10-23/download-completed.png) | + +| 照片预览 | 无本地片源的视频说明 | +| --- | --- | +| ![照片预览](materials-ui-2026-10-23/preview-photo.png) | ![无片源](materials-ui-2026-10-23/preview-video-unavailable.png) | diff --git a/docs/9.9.1/订单交付方式弹窗-2026-10-30.md b/docs/9.9.1/订单交付方式弹窗-2026-10-30.md new file mode 100644 index 0000000..5f2bc3f --- /dev/null +++ b/docs/9.9.1/订单交付方式弹窗-2026-10-30.md @@ -0,0 +1,50 @@ +# 机巢模块:统一交付方式弹窗 + +依据:[产品体验网页](https://voicestudio.suixinkan.cn/),2026-10-30 实际核对订单和订单素材库的“交付成片 → 面对面闪传 / 云端上传”。 + +## 本轮交互 + +- 订单卡片的主、副“交付成片”按钮均先打开底部弹窗,显示游客、方式卡片、关闭按钮和底部说明。 +- 面对面闪传显示“闪传流程待确认”,可返回方式选择或改用云端上传;不建立热点、不调用设备或传输接口。 +- 选择云端后在同一弹窗导航内打开共用的真实交付页面。订单列表保留在下层,任务不默认选中。 +- 云端可以返回方式选择;关闭云端或返回方式后关闭弹窗,会重新读取订单列表。仅打开、取消方式弹窗保留当前筛选和已加载订单,不额外刷新。 +- 云端页面禁止下拉直接关闭,提供明确关闭按钮;正在准备文件、上传或保存时需先确认停止。取消侧滑返回后会恢复云端页的导航栏、大弹窗和退出保护。 +- 素材库的“交付成片/替换成片”使用同一方式弹窗;选择云端前不创建上传页或读取交付数据,选择后透传当前任务 ID 并定位其点位。 +- 仅取消素材库方式弹窗,保留当前点位和素材勾选;进入云端后关闭弹窗,再刷新来源摘要与任务。重复点击不会叠加多个弹窗。 +- 本地演示中,从订单、素材记录或确认记录进入交付时也先选方式;已有暂停、失败或完成的上传批次保留,选择云端后恢复队列,仍需手动继续。上传流程内部的继续、重试保持原操作。 +- 本地演示的下载完成底栏“交付成片”同样先弹方式选择。多个拍摄记录时不先弹记录选择框、不默认绑定某个点位;进入云端后再选择点位。 + +## 接口边界 + +| 操作 | 接口行为 | +| --- | --- | +| 打开交付方式、切换闪传说明、关闭方式弹窗 | 无新增请求 | +| 选择云端上传 | 张工 `GET orders/detail`、`GET tasks` | +| 切换点位、选择任务 | 使用已读取的数据,本地筛选 | +| 选择视频并提交 | 沿用既有 STS/OSS 上传、张工 `POST tasks/film`,本轮不改变协议 | + +正式云端页仍按当前后端协议:明确选择点位和任务,每个任务交付一个视频;已有成片需要确认替换。网页的多视频演示不作为新增接口能力。只调整交付入口及弹窗导航,不执行真实上传验收。 + +## 验证与截图 + +使用 iPhone 18 Pro 模拟器、隔离窗口和网络/上传替身验证。测试图片中的订单、任务和视频均为合成数据,不代表后端真实交付成功。禁飞保护保持生效,本轮未创建真实任务或发送设备指令。 + +此前订单入口适配构建通过,共 24 项相关用例最终通过,覆盖订单主副入口、重复点击、取消保留筛选、闪传返回、云端返回、任务不预选、上传/失败/替换原有流程及当时的素材库入口。首轮退出确认测试因弹窗动画未结束而提前断言,补齐等待条件后,与取消侧滑恢复测试及订单云端入口一并复跑,3 项均通过。 + +- 订单及交付原有测试首轮:22 通过、1 失败;新增和修正后的定向复跑:3 通过、0 失败。 +- 复跑结果包:`test_sim_2026-10-30T01-45-41-769Z_pid48214_67f25551.xcresult`。 +- `git diff --check` 通过。构建中的其他模块既有警告未在本轮调整。 + +交付方式弹窗: + +![交付方式弹窗(模拟数据)](order-delivery-sheet-2026-10-30/delivery-method.png) + +弹窗内复用的云端交付页: + +![云端交付(模拟数据)](order-delivery-sheet-2026-10-30/cloud-delivery.png) + +素材库替换成片也先选择交付方式(2026-10-30 统一入口后,纯本地模拟数据): + +![素材库交付方式弹窗](order-delivery-sheet-2026-10-30/materials-delivery-method.png) + +统一入口后的回归:iPhone 18 Pro / iOS 27.0 模拟器 **47 项通过,0 失败、0 跳过**。覆盖订单主副交付、素材交付与替换的任务预选、取消保留筛选/勾选、重复点击、关闭后仅刷新一次、下载完成底栏先选方式、暂停/失败/完成批次经两条云端入口恢复,以及既有上传、替换确认、下载和游客确认流程。测试使用网络与上传替身,未真实上传或发送无人机指令。结果包:`/private/tmp/suixinkan-unified-delivery-entry-20261030.xcresult`。 diff --git a/docs/9.9.1/订单素材库UI对齐-2026-10-29.md b/docs/9.9.1/订单素材库UI对齐-2026-10-29.md new file mode 100644 index 0000000..c1a677c --- /dev/null +++ b/docs/9.9.1/订单素材库UI对齐-2026-10-29.md @@ -0,0 +1,63 @@ +# 订单素材库 UI 对齐 + +核对日期:2026-10-29。依据:[产品交互体验网页](https://voicestudio.suixinkan.cn/)。本轮在独立浏览器标签中实际切换并检查页面状态,未操作真实后端或无人机。 + +## 网页布局与状态 + +| 区域/状态 | 网页表现 | iOS 对应处理 | +| --- | --- | --- | +| 订单信息 | 游客标题与小状态徽章同排;下一行订单号,再下一行购买/已拍/剩余次数 | 使用真实订单摘要,未知次数仍为“—” | +| 点位筛选 | 浅蓝选中标签、白底描边未选标签 | 点位身份来自 `orders/detail.spot`,切换仍只请求 `tasks` | +| 拍摄记录 | 次数与“最新在前”提示、右侧全选;点位标题和交付按钮同排,航线/时间/记录序号为次行 | 保持任务身份、顺序和原交付入口权限;不把任务总数当成成功拍摄次数 | +| 上传中 | 两列灰色缩略图,中央播放/图片占位,无勾选,蓝色状态文字 | 根据单文件 `upload_status=2` 展示 | +| 上传完成/未选择 | 两列 16:9 缩略图、右上角选择圆圈、绿色“上传完成 · 可下载” | 只有明确就绪且有效地址的原素材可选择与预览 | +| 已选择 | 蓝色勾选与边框,固定底栏更新所选数量,主按钮启用 | 选择使用任务 ID+素材 ID,不包含独立成片;切点/刷新后清空 | +| 上传失败 | 红色叉圈、文件名右侧重试入口、红色失败说明 | 失败原因保留;正式页重试入口禁用,因为尚无上传重试接口 | +| 下载中/重试中 | 底栏显示本次数量、完成数量、进度条、保持页面开启提示和禁用主按钮 | 通过本地演示验证布局,未接真实下载/保存 | +| 部分下载失败 | 橙色警示图标、成功/失败数量、重试失败素材主按钮及选择其他素材 | 本地演示只重试失败项,不重复处理完成项 | +| 下载完成 | 绿色勾圈、完成说明、继续选择按钮及描边交付按钮 | 本地演示明确未写入系统相册,不能作为真实下载成功 | +| 离开确认 | 下载仍进行中的提示、离开并停止/继续下载 | 保留 UIKit 确认交互及演示批次暂停行为 | +| 相册权限不足 | 无法保存到相册提示,暂不下载/去设置 | 本地演示不请求 Photos 权限,不打开设置或伪装已保存 | +| 无任务/读取失败/首次加载 | 原型基础布局之外的真实接口边界状态 | 居中图标、明确标题/说明,错误提供只读重试 | +| 任务尚无文件 | 文件数量不能从空数组推测 | 按任务 `material_status` 区分待生成、上传中、失败或暂无可用文件 | + +正式页仅调整展示与本地选择,不新增真实下载、上传重试、素材同步或飞控写入。`film` 继续作为独立交付成片展示,不计入原素材选择。 + +## 验收入口 + +- `--dock-materials-mock=ready`:通过真实页面渲染内存素材数据。还支持 `uploading`、`uploadFailed`、`mixed`、`empty`、`loading`、`error`、`taskUploading`、`taskFailed`、`film`。订单、任务和媒体全部为合成数据,图片来自随包演示资源。 +- `--dock-ui-materials-preview --dock-materials-scenario=downloading`:原有本地下载演示。可替换为 `paused`、`partialFailure`、`permissionDenied`、`saveFailure`、`completed`,不连接后端、不保存系统相册。 + +## 验证结果 + +- iPhone 18 Pro / iOS 27 模拟器;使用 `suixinkan-Simulator` + `SimulatorDebug`,未运行真机。 +- 相关 API、选择状态、页面、预览和演示流程共覆盖 75 项测试,已全部通过。首次发现旧测试仍从 `title(for:)` 读取配置式按钮标题,更新为 `configuration.title` 后复测通过。 +- 最后一轮正式页、状态截图、演示流程和固定底栏 19/19 通过;随后白色勾选图标和加载指示器调整后,两项状态/选择用例再次 2/2 通过,并重新导出 21 张测试截图。 +- 375pt、402pt 两种宽度覆盖 10 个正式页隔离场景;校验底栏不覆盖列表、按钮触控高度至少 44pt、缩略图比例 16:9、未就绪素材不可勾选,预览返回后仍保留选择。 +- 实际启动模拟器核对上传就绪与演示下载失败/完成状态。运行日志未发现 Auto Layout 冲突或 API 请求;未写入系统相册。 +- 图片为本地合成订单与随包演示资源,不能作为真实接口成功或实际下载成功的证据。 + +测试结果包(本机): + +- 19 项页面测试:`~/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-10-29T10-44-05-564Z_pid15238_fa6eb119.xcresult` +- 最终 2 项状态/选择测试:`~/Library/Developer/XcodeBuildMCP/workspaces/suixinkan-a3033d697ba3/result-bundles/test_sim_2026-10-29T10-51-59-931Z_pid15238_d80b3ec7.xcresult` + +## 状态截图 + +### 上传完成与已选择 + +![上传完成](materials-ui-2026-10-29/ready-402.png) +![已选择](materials-ui-2026-10-29/selected-402.png) + +### 上传中、失败与混合状态 + +![上传中](materials-ui-2026-10-29/uploading-402.png) +![上传失败](materials-ui-2026-10-29/uploadFailed-402.png) +![375pt 混合状态](materials-ui-2026-10-29/mixed-375.png) + +### 本地下载演示 + +![部分失败](materials-ui-2026-10-29/demo-partialFailure.jpg) +![演示完成](materials-ui-2026-10-29/demo-completed.jpg) + +其他边界状态见同目录中的 `empty`、`error`、`loading`、`taskUploading`、`taskFailed`、`film` 截图。 diff --git a/docs/9.9.1/面对面闪传-局域网协议.md b/docs/9.9.1/面对面闪传-局域网协议.md new file mode 100644 index 0000000..6fcb168 --- /dev/null +++ b/docs/9.9.1/面对面闪传-局域网协议.md @@ -0,0 +1,72 @@ +# 面对面闪传:局域网扫码直传(第一版) + +更新日期:2026-10-30。 + +## 范围 + +- 当前 iOS 工程提供发送端;游客无需安装 App,使用 Safari 或安卓兼容浏览器接收。 +- 双方先加入同一个允许设备互访的 Wi-Fi,再扫描发送端生成的二维码。网络不需要连接互联网;公共 Wi-Fi 的客户端隔离可能阻止传输。 +- 每次会话只开放商家明确选择的一段本地视频。接收页随 App 打包,不使用在线网页、CDN、字体、分析脚本或云存储。 +- 首版只从本机相册选择视频,不提供系统文件提供器或云盘入口。相册缩略图和视频资源导出均关闭网络访问;只有 iCloud 云端副本时提示无法读取,不自动下载。 +- 不使用 AirDrop、安卓系统互传、云端上传,也不调用订单、成片保存或无人机操作接口。已经加载的订单信息仅供本机展示。 +- 已确认本次只完成 iOS;安卓同事在安卓工程按本文接入发送端,本次未修改安卓工程。 + +## 本地协议 + +二维码格式为 `http://<发送手机局域网IPv4>:<动态端口>/s/`。`token` 是每次会话独立生成的 32 字节安全随机值,以 64 位小写十六进制编码。下文只用占位符,不记录真实令牌。 + +| 方法 | 路径 | 用途 | +| --- | --- | --- | +| GET / HEAD | `/s/` | 返回 UTF-8 接收网页或其响应头 | +| GET / HEAD | `/s//video` | 返回本次视频或其响应头;支持单段 `Range` | + +不提供目录浏览、任意文件路径、代理下载、上传、云端重定向或订单身份查询。错误令牌或其他路径不能访问文件。 + +文件响应使用实际 `Content-Length`、对应视频 `Content-Type`、`Content-Disposition: attachment`,中文名称通过 UTF-8 `filename*` 提供。Range 请求使用标准 `206` / `Content-Range`,非法或无法满足的范围返回 `416`。浏览器是否保留并恢复下载由浏览器决定,支持 Range 不等于承诺自动断点续传。 + +接收端直接使用普通下载链接,由浏览器流式下载文件。不得用 `fetch → Blob` 等方式把整段视频读入页面内存。发送端同样按块读取文件,不将整个视频一次载入内存。 + +## 会话和界面语义 + +会话有效期为 10 分钟。商家结束会话、退出发送页面或会话到期后,应关闭服务和传输连接,旧二维码失效。重新开始使用新令牌。发送期间需保持 App 前台亮屏。 + +推荐状态为:待选视频 → 准备连接 → 等待扫码 → 游客已打开 → 正在发送 → 发送结束,请游客核对。失败、中断和到期应保留明确的重试或重新生成二维码入口。 + +`GET` 接收页只代表网页已被打开;传输层发完字节只代表发送结束。`HEAD`、局部 Range、网页打开、链接点击均不能作为游客已收到完整视频的证明。首版不自动改变服务端“已交付”、成片数量或上传状态。 + +## 接收页与保存位置 + +接收页提供文件名、文件大小、下载按钮,以及网络和保存指引。页面不依赖 JavaScript;文件名经过 HTML 转义,下载链接严格限制为 `/s/<64位小写十六进制token>/video`。 + +- iPhone:建议 Safari;将 Safari 下载位置选择为“我的 iPhone”,下载后在“文件”App 查找。受支持的视频可由用户通过分享菜单存储到相册。 +- 安卓:在浏览器下载列表或文件管理的下载目录查找;是否自动出现在相册取决于系统和格式。 +- App 无法控制游客自己的 iCloud、相册备份或其他云同步设置,也不能自动确认游客已保存到相册。 + +## 本地访问边界 + +令牌只授权当前选中的文件,短期有效,不输出到业务日志;响应禁止缓存和 Referrer 外传。网页无外部资源,建议响应头: + +```text +Cache-Control: no-store +X-Content-Type-Options: nosniff +Referrer-Policy: no-referrer +Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none' +``` + +首版本地 HTTP 不提供传输层加密,随机令牌也不是加密。应在可信局域网使用,不将服务暴露到公网。 + +当前 iOS 实现只绑定 Wi-Fi / 网桥上的 RFC 1918 私有 IPv4 地址,不绑定蜂窝、VPN、公网或所有网卡;纯 IPv6 局域网暂不支持。热点是否允许设备互访取决于系统及配置。单文件上限为 2 GiB,逐块发送,单次仅允许一个文件下载连接;会话到期会中止尚未完成的下载,大文件需在有效期内完成。 + +## 验证边界 + +单元测试覆盖接收页不含远程资源、文件名转义、非法链接拒绝及不虚报下载完成。服务端另验证令牌、Range、关闭和过期等行为。 + +本轮 71 项相关模拟器测试全部通过(含入口导航、状态、页面、本地资源导出和真实回环 HTTP 文件传输),结果包:`/private/tmp/suixinkan-nearby-transfer-verified-20261030.xcresult`。 + +模拟器可验证页面、协议和流式传输逻辑;iPhone → iPhone、iPhone → 安卓浏览器在真实 Wi-Fi 下的互通、浏览器保存行为和大文件吞吐,需要单独实机验收。本文不将尚未执行的设备组合标为通过。 + +2026-10-30 已在 iPhone 17 Pro 模拟器启动本地服务,通过 Mac Chrome 打开实际局域网地址,下载项目自带测试视频;也已将该视频导入模拟器相册,经有限权限选择、本地导出、生成二维码后完成第二次下载。两次下载文件与原文件 SHA-256 均一致;发送端显示“文件已发送”,结束闪传后原地址返回连接拒绝。接收页 390×844 窄屏布局已检查,发送端生成新二维码后自动定位,完整露出二维码、复制和有效期。这是模拟器及桌面浏览器验证,不代替上述两台手机验收。 + +Debug 独立入口 `--dock-nearby-preview` 使用明确标注的项目演示视频,不读取订单或调用后端;叠加 `--dock-nearby-library` 可检查真正的本地相册选择流程。正常业务入口始终使用本地相册选择器。 + +有限相册权限新增/移除视频后的自动刷新已在模拟器实际操作验证,无需关闭后重开选片页。 diff --git a/docs/后端消息推送格式.md b/docs/后端消息推送格式.md index eabc42c..7cc16b3 100644 --- a/docs/后端消息推送格式.md +++ b/docs/后端消息推送格式.md @@ -295,7 +295,7 @@ iOS 通过 APNs/极光收到 `userInfo` 字典。与 Android 相比: | --- | --- | | 标题示例 | `付款成功通知` | | 正文示例 | `您的订单 #260722128006 已支付成功,支付金额 ¥0.01` | -| 客户端点击行为 | Android、iOS 均进入收款记录页 | +| 客户端点击行为 | iOS 进入订单 Tab,恢复默认筛选并刷新;Android 行为以 Android 实现为准 | `data` 字段: @@ -410,9 +410,9 @@ iOS 通过 APNs/极光收到 `userInfo` 字典。与 Android 相比: ## 7. 客户端解析约定 1. Android、iOS 的通知点击路由只根据业务字段 `type` 判断,不读取标题、正文、`data`、`route`、`uri`、`action` 或极光内部字段决定页面。 -2. `type = 1`:进入收款记录页。 +2. iOS `type = 1`、`type = 5`:进入订单 Tab 根页面,清空搜索、日期与状态筛选并刷新列表;不进入订单详情。Android 行为以 Android 实现为准。 3. `type = 6`:进入收款详情页。 -4. 其他任意 `type`、缺少 `type`、类型无法解析或 payload 损坏:进入消息中心。 +4. iOS `type = 14`:有效 `ai_retouch_batch_id` 进入 AI 修图任务详情,否则进入任务列表。其余未单独处理的 `type`、缺少 `type` 或类型无法解析:进入消息中心。 5. Android 从 `notificationExtras` 或厂商通道包装字段中提取 `type`;iOS 优先读取 payload 顶层 `type`,并兼容常见推送包装层中的 `type`。 6. `data` 仍可按消息类型用于页面内容刷新,但不参与通知点击路由。新增字段应保持向后兼容,客户端应忽略当前版本不认识的额外字段。 7. 金额继续使用字符串;时间戳建议统一为 Unix 秒级整数,并在协议中固定单位。 diff --git a/docs/周报-2026-10-19至2026-10-23.md b/docs/周报-2026-10-19至2026-10-23.md new file mode 100644 index 0000000..eebca26 --- /dev/null +++ b/docs/周报-2026-10-19至2026-10-23.md @@ -0,0 +1,69 @@ +# 工作周报(2026.10.19—2026.10.23) + +## 本周概况 + +本周围绕随心瞰商家版 iOS 的培训中心优化和 9.9.1 机巢航拍功能开展工作,共完成 **13 次提交**。培训中心完善学习、答题与附件阅读体验;机巢功能完成需求梳理及工作台、拍摄、素材等页面的本地演示,成片交付相关改动已在工作区实现,尚未提交。机巢业务当前处于 UI 与交互验证阶段,真实接口及设备联调尚未完成。 + +## 本周完成 + +### 1. 完善培训中心学习与考试体验 + +- 兼容后台 `training` 权限标识,修正培训中心入口的权限识别,并恢复培训接口 Debug 日志,便于联调排查。 +- 优化答题自动保存、草稿持久化及页面交互,统一课程学习与在线考试的步骤栏样式。 +- 新增 PDF、DOCX、TXT、Markdown 课程附件预览与整页阅读,兼容 HTTP 附件地址,完善加载与异常处理。 +- 新增“已结束”任务筛选及只读回顾,保留搜索和分页能力,精简课程页面的冗余信息。 +- 修复课程学习倒计时停顿,完善滚动阅读及学习进度上报期间的计时处理。 + +### 2. 完成 9.9.1 需求评审与接口需求整理 + +- 梳理套餐收款、订单归属、拍摄准备、设备控制、次数结算、素材及交付流程,对照产品原型核对主流程与异常状态。 +- 归档需求评审、状态分类、流程截图及原型实测记录,整理当前方案基线和原型差异。 +- 输出 **16 项后端/设备接口能力需求**,明确现有接口可复用范围、任务恢复、指令回执、幂等处理及联调资料要求。 + +### 3. 搭建机巢工作台与拍摄订单页面 + +- 完成景区与工作人员信息、无人机遥测、设备横向切换、订单卡片、素材摘要及今日统计展示。 +- 新增“我的拍摄订单”,支持全部、待拍摄、进行中、已完成四类筛选及空态。 +- 落实当前用户与景区隔离、任务订单置顶、次数用完移出工作台,以及已完成订单仍可查看返航中任务等展示规则。 + +### 4. 完成拍摄准备与当前任务的本地交互 + +- 接通点位与航线选择、有效选择恢复,以及设备占用、连接异常、范围未知和次数不足等阻断提示。 +- 搭建召唤、开始、暂停、继续和返航交互,区分指令提交、设备确认与结果待确认状态。 +- 覆盖成功仅扣一次、失败重试边界、离页后恢复原任务,以及手机断网、图传中断和保护性返航等演示场景。 + +### 5. 完成素材库预览、选择与下载演示 + +- 接通工作台、订单及当前任务的素材入口,支持点位筛选、拍摄记录分组、照片缩放与翻页、本地示例视频播放。 +- 支持可下载素材多选与全选,覆盖下载、保存、暂停、部分失败及重试等状态。 +- 完善切后台暂停、回前台手动继续、保留成功项及旧回执隔离;下载演示与拍摄次数、游客交付状态分别处理。 + +## 进行中:成片交付 + +- 已在工作区搭建交付方式、云端选点、演示视频多选、上传队列、整单核对、确认码及确认记录页面,尚未提交。 +- 支持上传暂停与继续、失败项重试、追加批次,以及追加作品后重新核对;游客确认与历史清单按明确回执和快照处理。 +- 当前为本机演示,面对面闪传流程仍待确认,真实上传、游客身份校验及收货凭据需后续对接;套餐收款页面继续暂缓。 + +## 测试与质量 + +- 根据现有实现文档,机巢、拍摄、素材及交付相关专项测试已在 **iPhone 11 真机累计复测 99 项,0 失败**;后续界面调整另有交付联动 5 项通过记录。 +- 测试覆盖订单与身份隔离、指令回执、成功幂等扣次、任务恢复、素材选择、前后台暂停、失败重试及交付确认门槛。 +- 培训中心已补充权限、草稿保存、附件预览、任务筛选及计时相关回归用例;本次查阅资料未确认对应的真机测试结果,需补充可追溯记录。 +- 本周机巢验证为本地演示专项,未进行真实飞行、远程素材下载、系统相册保存、真实上传或游客端联调,也未进行全工程回归。本次整理周报未重新运行测试。 + +## 风险与待验证项 + +- 机巢真实接入仍需对齐后端/设备的任务成功判据、执行许可、次数结算、指令查询、图传鉴权及恢复契约。 +- 成片交付需补齐真实接口与游客确认凭据,并将新增交付范围同步到后端接口需求文档。 +- 需继续补充真实网络、设备及媒体场景验证,完成全工程真机回归后再评估验收范围。 + +## 下周计划 + +- 推进后端与设备接口契约确认,准备测试账号、景区点位、航线、设备状态及图传测试数据。 +- 按接口就绪情况推进工作台、订单、拍摄任务与素材链路接入,重点验证任务恢复、异常回执和次数一致性。 +- 整理并提交成片交付改动,补齐接口需求与实现记录,继续明确面对面交付流程。 +- 补齐培训中心真机验证记录,开展受影响模块及全工程真机回归,修复发现的问题。 + +--- + +整理依据:本周 Git 提交、当前工作区改动,以及 [9.9.1 评审归档](9.9.1/README.md)、[后端接口需求](9.9.1/后端接口需求.md)、[机巢 UI 首轮实现说明](9.9.1/机巢UI首轮实现说明.md)、[拍摄流程 UI 实现说明](9.9.1/拍摄流程UI实现说明.md)、[素材库 UI 实现说明](9.9.1/素材库UI实现说明.md)和[交付成片 UI 实现说明](9.9.1/交付成片UI实现说明.md)。 diff --git a/scripts/verify-drone-dock-build-policy.swift b/scripts/verify-drone-dock-build-policy.swift new file mode 100644 index 0000000..e6020e1 --- /dev/null +++ b/scripts/verify-drone-dock-build-policy.swift @@ -0,0 +1,49 @@ +import Foundation + +/// 离线验证两种编译模式的设备请求策略;不创建 URLSession、不发送网络请求。 +@main +struct DroneDockBuildPolicyCheck { + static func main() throws { + #if DEBUG + let blocked = true + let mode = "Debug" + #else + let blocked = false + let mode = "Release" + #endif + precondition(DeviceCommandDebugPolicy.blocksFlightRequests == blocked) + precondition(DeviceCommandDebugPolicy.blocksLiveRequests == blocked) + let paths = ["/api/yf-handset-app/photog/multi-plane/tasks/create", + "/api/app/airport/shoot", "/api/app/airport/start-shoot", "/api/app/airport/command"] + for path in paths { + try check(path, method: "POST", shouldBlock: blocked) + try check(path, method: "GET", shouldBlock: true) + } + try check("/api/app/airport/live", method: "GET", shouldBlock: blocked) + try check("/api/app/airport/live", method: "POST", shouldBlock: true) + try check("/api/app/airport/future-control", method: "POST", shouldBlock: true) + let read = request("/api/app/airport/shooting?id=501&live_battery=1", method: "GET") + let prepared = try DeviceCommandDebugPolicy.prepare(read, isLocalSimulation: false) + precondition(prepared.url?.query?.contains("live_battery=0") == true) + let trace = DroneDockRequestTrace(request: prepared, isSimulation: true)! + let logged = trace.message("offline_check", fields: ["token": "TEST_TOKEN", "play": ["url": "TEST_RTC"]]) + precondition(logged.contains("TEST_TOKEN") && logged.contains("TEST_RTC")) + precondition(logged.contains(mode) && logged.contains("501")) + print("PASS \(mode): flight_blocked=\(blocked), unknown operations blocked, cached status, complete diagnostics. No network sent.") + } + + private static func request(_ path: String, method: String) -> URLRequest { + var value = URLRequest(url: URL(string: "https://example.invalid" + path)!) + value.httpMethod = method + return value + } + + private static func check(_ path: String, method: String, shouldBlock: Bool) throws { + do { + _ = try DeviceCommandDebugPolicy.prepare(request(path, method: method), isLocalSimulation: false) + precondition(!shouldBlock, "Unexpected allow: \(method) \(path)") + } catch is DeviceCommandDebugBlockedError { + precondition(shouldBlock, "Unexpected block: \(method) \(path)") + } + } +} diff --git a/suixinkan.xcodeproj/project.pbxproj b/suixinkan.xcodeproj/project.pbxproj index e6ec0c7..0d4e759 100644 --- a/suixinkan.xcodeproj/project.pbxproj +++ b/suixinkan.xcodeproj/project.pbxproj @@ -56,6 +56,9 @@ exceptions = ( 93FF17D72FFB84950033C304 /* Exceptions for "suixinkan" folder in "suixinkan" target */, ); + explicitFolders = ( + Resources/TrainingDocumentPreview, + ); path = suixinkan; sourceTree = ""; }; @@ -436,7 +439,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = suixinkan/suixinkan.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1040101; + CURRENT_PROJECT_VERSION = 2020202; DEVELOPMENT_TEAM = 56GVN5RNVN; ENABLE_USER_SCRIPT_SANDBOXING = NO; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]" = ( @@ -449,18 +452,19 @@ INFOPLIST_KEY_NSCameraUsageDescription = "需要访问相机以拍摄任务素材、扫描订单核销二维码,并连接有线相机进行旅拍相册传输"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "需要获取您的位置信息,用于位置上报、景区距离排序及多点位核销打卡"; INFOPLIST_KEY_NSMicrophoneUsageDescription = "需要访问麦克风以在拍摄素材视频时录制声音"; - INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "需要保存收款二维码、排队打卡点小程序码和云盘图片视频到相册"; - INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "需要访问相册以选择头像、身份证、银行卡照片和云盘上传素材"; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "需要保存收款二维码、排队打卡点小程序码、订单素材、景区空境素材和云盘图片视频到相册"; + INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "需要访问相册以选择头像、证件照片、云盘素材及面对面闪传的本地视频"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UIUserInterfaceStyle = Light; IPHONEOS_DEPLOYMENT_TARGET = 16; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.1; + MARKETING_VERSION = 2.2.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -502,7 +506,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = suixinkan/suixinkan.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1040101; + CURRENT_PROJECT_VERSION = 2020202; DEVELOPMENT_TEAM = 56GVN5RNVN; ENABLE_USER_SCRIPT_SANDBOXING = NO; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]" = ( @@ -515,18 +519,19 @@ INFOPLIST_KEY_NSCameraUsageDescription = "需要访问相机以拍摄任务素材、扫描订单核销二维码,并连接有线相机进行旅拍相册传输"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "需要获取您的位置信息,用于位置上报、景区距离排序及多点位核销打卡"; INFOPLIST_KEY_NSMicrophoneUsageDescription = "需要访问麦克风以在拍摄素材视频时录制声音"; - INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "需要保存收款二维码、排队打卡点小程序码和云盘图片视频到相册"; - INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "需要访问相册以选择头像、身份证、银行卡照片和云盘上传素材"; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "需要保存收款二维码、排队打卡点小程序码、订单素材、景区空境素材和云盘图片视频到相册"; + INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "需要访问相册以选择头像、证件照片、云盘素材及面对面闪传的本地视频"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UIUserInterfaceStyle = Light; IPHONEOS_DEPLOYMENT_TARGET = 16; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.1; + MARKETING_VERSION = 2.2.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -741,7 +746,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = suixinkan/suixinkan.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1040101; + CURRENT_PROJECT_VERSION = 2020202; DEVELOPMENT_TEAM = 56GVN5RNVN; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; @@ -750,18 +755,19 @@ INFOPLIST_KEY_NSCameraUsageDescription = "需要访问相机以拍摄任务素材、扫描订单核销二维码,并连接有线相机进行旅拍相册传输"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "需要获取您的位置信息,用于位置上报、景区距离排序及多点位核销打卡"; INFOPLIST_KEY_NSMicrophoneUsageDescription = "需要访问麦克风以在拍摄素材视频时录制声音"; - INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "需要保存收款二维码、排队打卡点小程序码和云盘图片视频到相册"; - INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "需要访问相册以选择头像、身份证、银行卡照片和云盘上传素材"; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "需要保存收款二维码、排队打卡点小程序码、订单素材、景区空境素材和云盘图片视频到相册"; + INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "需要访问相册以选择头像、证件照片、云盘素材及面对面闪传的本地视频"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UIUserInterfaceStyle = Light; IPHONEOS_DEPLOYMENT_TARGET = 16; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.1; + MARKETING_VERSION = 2.2.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/suixinkan.xcodeproj/xcshareddata/xcschemes/suixinkan.xcscheme b/suixinkan.xcodeproj/xcshareddata/xcschemes/suixinkan.xcscheme index 96c6a4b..cdeed51 100644 --- a/suixinkan.xcodeproj/xcshareddata/xcschemes/suixinkan.xcscheme +++ b/suixinkan.xcodeproj/xcshareddata/xcschemes/suixinkan.xcscheme @@ -53,7 +53,7 @@ diff --git a/suixinkan/App/NetworkServices.swift b/suixinkan/App/NetworkServices.swift index bf0b929..599cdd8 100644 --- a/suixinkan/App/NetworkServices.swift +++ b/suixinkan/App/NetworkServices.swift @@ -18,6 +18,8 @@ final class NetworkServices { let homeAPI: HomeAPI let paymentAPI: PaymentAPI let offlineCollectionAPI: OfflineCollectionAPI + /// 正式培训资源 API,页面使用身份作用域工厂创建会话。 + let trainingAPI: TrainingAPI let taskAPI: TaskAPI let inviteAPI: InviteAPI let walletAPI: WalletAPI @@ -45,6 +47,7 @@ final class NetworkServices { homeAPI = HomeAPI(client: client) paymentAPI = PaymentAPI(client: client) offlineCollectionAPI = OfflineCollectionAPI(client: client) + trainingAPI = TrainingAPI(client: client) taskAPI = TaskAPI(client: client) inviteAPI = InviteAPI(client: client) walletAPI = WalletAPI(client: client) @@ -77,6 +80,7 @@ final class NetworkServices { homeAPI = HomeAPI(client: apiClient) paymentAPI = PaymentAPI(client: apiClient) offlineCollectionAPI = OfflineCollectionAPI(client: apiClient) + trainingAPI = TrainingAPI(client: apiClient) taskAPI = TaskAPI(client: apiClient) inviteAPI = InviteAPI(client: apiClient) walletAPI = WalletAPI(client: apiClient) diff --git a/suixinkan/Assets.xcassets/DroneDock/Contents.json b/suixinkan/Assets.xcassets/DroneDock/Contents.json new file mode 100644 index 0000000..d8b757a --- /dev/null +++ b/suixinkan/Assets.xcassets/DroneDock/Contents.json @@ -0,0 +1,3 @@ +{ + "info" : { "author" : "xcode", "version" : 1 } +} diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_demo_mountain.imageset/Contents.json b/suixinkan/Assets.xcassets/DroneDock/drone_demo_mountain.imageset/Contents.json new file mode 100644 index 0000000..f7fd426 --- /dev/null +++ b/suixinkan/Assets.xcassets/DroneDock/drone_demo_mountain.imageset/Contents.json @@ -0,0 +1,4 @@ +{ + "images" : [ { "filename" : "drone_demo_mountain.png", "idiom" : "universal" } ], + "info" : { "author" : "xcode", "version" : 1 } +} diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_demo_mountain.imageset/drone_demo_mountain.png b/suixinkan/Assets.xcassets/DroneDock/drone_demo_mountain.imageset/drone_demo_mountain.png new file mode 100644 index 0000000..bfe1fe9 Binary files /dev/null and b/suixinkan/Assets.xcassets/DroneDock/drone_demo_mountain.imageset/drone_demo_mountain.png differ diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_demo_pagoda.imageset/Contents.json b/suixinkan/Assets.xcassets/DroneDock/drone_demo_pagoda.imageset/Contents.json new file mode 100644 index 0000000..7affda8 --- /dev/null +++ b/suixinkan/Assets.xcassets/DroneDock/drone_demo_pagoda.imageset/Contents.json @@ -0,0 +1,4 @@ +{ + "images" : [ { "filename" : "drone_demo_pagoda.png", "idiom" : "universal" } ], + "info" : { "author" : "xcode", "version" : 1 } +} diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_demo_pagoda.imageset/drone_demo_pagoda.png b/suixinkan/Assets.xcassets/DroneDock/drone_demo_pagoda.imageset/drone_demo_pagoda.png new file mode 100644 index 0000000..36ba9cf Binary files /dev/null and b/suixinkan/Assets.xcassets/DroneDock/drone_demo_pagoda.imageset/drone_demo_pagoda.png differ diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_demo_tourists.imageset/Contents.json b/suixinkan/Assets.xcassets/DroneDock/drone_demo_tourists.imageset/Contents.json new file mode 100644 index 0000000..69479a4 --- /dev/null +++ b/suixinkan/Assets.xcassets/DroneDock/drone_demo_tourists.imageset/Contents.json @@ -0,0 +1,4 @@ +{ + "images" : [ { "filename" : "drone_demo_tourists.png", "idiom" : "universal" } ], + "info" : { "author" : "xcode", "version" : 1 } +} diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_demo_tourists.imageset/drone_demo_tourists.png b/suixinkan/Assets.xcassets/DroneDock/drone_demo_tourists.imageset/drone_demo_tourists.png new file mode 100644 index 0000000..2e24fb8 Binary files /dev/null and b/suixinkan/Assets.xcassets/DroneDock/drone_demo_tourists.imageset/drone_demo_tourists.png differ diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_telemetry_satellite.imageset/Contents.json b/suixinkan/Assets.xcassets/DroneDock/drone_telemetry_satellite.imageset/Contents.json new file mode 100644 index 0000000..f7599ed --- /dev/null +++ b/suixinkan/Assets.xcassets/DroneDock/drone_telemetry_satellite.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "filename" : "drone_telemetry_satellite.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "template" + } +} diff --git a/suixinkan/Assets.xcassets/DroneDock/drone_telemetry_satellite.imageset/drone_telemetry_satellite.svg b/suixinkan/Assets.xcassets/DroneDock/drone_telemetry_satellite.imageset/drone_telemetry_satellite.svg new file mode 100644 index 0000000..c8e9e21 --- /dev/null +++ b/suixinkan/Assets.xcassets/DroneDock/drone_telemetry_satellite.imageset/drone_telemetry_satellite.svg @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/suixinkan/Assets.xcassets/Payment/payment_sailimu_background.imageset/Contents.json b/suixinkan/Assets.xcassets/Payment/payment_sailimu_background.imageset/Contents.json new file mode 100644 index 0000000..6406738 --- /dev/null +++ b/suixinkan/Assets.xcassets/Payment/payment_sailimu_background.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images": [ + { + "filename": "payment_sailimu_background.png", + "idiom": "universal", + "scale": "1x" + }, + { + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/suixinkan/Assets.xcassets/Payment/payment_sailimu_background.imageset/payment_sailimu_background.png b/suixinkan/Assets.xcassets/Payment/payment_sailimu_background.imageset/payment_sailimu_background.png new file mode 100644 index 0000000..4081eff Binary files /dev/null and b/suixinkan/Assets.xcassets/Payment/payment_sailimu_background.imageset/payment_sailimu_background.png differ diff --git a/suixinkan/Assets.xcassets/Payment/payment_sailimu_logo.imageset/Contents.json b/suixinkan/Assets.xcassets/Payment/payment_sailimu_logo.imageset/Contents.json new file mode 100644 index 0000000..30bfb67 --- /dev/null +++ b/suixinkan/Assets.xcassets/Payment/payment_sailimu_logo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images": [ + { + "filename": "payment_sailimu_logo.png", + "idiom": "universal", + "scale": "1x" + }, + { + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/suixinkan/Assets.xcassets/Payment/payment_sailimu_logo.imageset/payment_sailimu_logo.png b/suixinkan/Assets.xcassets/Payment/payment_sailimu_logo.imageset/payment_sailimu_logo.png new file mode 100644 index 0000000..4ac47bb Binary files /dev/null and b/suixinkan/Assets.xcassets/Payment/payment_sailimu_logo.imageset/payment_sailimu_logo.png differ diff --git a/suixinkan/Common/NotificationName.swift b/suixinkan/Common/NotificationName.swift index d4ba9db..d900658 100644 --- a/suixinkan/Common/NotificationName.swift +++ b/suixinkan/Common/NotificationName.swift @@ -26,6 +26,9 @@ enum NotificationName { /// 已登录状态下切换景区/门店账号 static let accountDidSwitch = name("accountDidSwitch") + /// 当前角色菜单权限已持久化,object 为实际写入的 AppPermissionStore。 + static let permissionItemsDidChange = name("permissionItemsDidChange") + /// Token 失效或鉴权失败,需重新登录 static let sessionDidExpire = name("sessionDidExpire") diff --git a/suixinkan/Core/Networking/APIClient.swift b/suixinkan/Core/Networking/APIClient.swift index f1feca4..0558e4c 100644 --- a/suixinkan/Core/Networking/APIClient.swift +++ b/suixinkan/Core/Networking/APIClient.swift @@ -11,6 +11,9 @@ protocol URLSessionProtocol { func data(for request: URLRequest) async throws -> (Data, URLResponse) } +/// 仅供完全在内存中返回预设响应的传输实现,不得转发至 URLSession 或外部服务。 +protocol LocalSimulationURLSession: URLSessionProtocol {} + extension URLSession: URLSessionProtocol {} @MainActor @@ -20,6 +23,8 @@ final class APIClient { private let encoder: JSONEncoder private let decoder: JSONDecoder private let notificationCenter: NotificationCenter + private let debugLogSink: (String) -> Void + private let droneDockLogSink: (String) -> Void private var authTokenProvider: (() -> String?)? private let environment: APIEnvironment @@ -34,13 +39,17 @@ final class APIClient { decoder: JSONDecoder = JSONDecoder(), appVersion: String = AppClientInfo.appVersion(), osType: String = AppClientInfo.osType, - notificationCenter: NotificationCenter = .default + notificationCenter: NotificationCenter = .default, + debugLogSink: @escaping (String) -> Void = APIConsoleDiagnostics.write, + droneDockLogSink: @escaping (String) -> Void = DroneDockDiagnostics.write ) { self.environment = environment self.session = session self.encoder = encoder self.decoder = decoder self.notificationCenter = notificationCenter + self.debugLogSink = debugLogSink + self.droneDockLogSink = droneDockLogSink self.appVersion = appVersion.trimmingCharacters(in: .whitespacesAndNewlines).nonEmpty ?? "1.0.0" self.osType = osType.trimmingCharacters(in: .whitespacesAndNewlines).nonEmpty ?? AppClientInfo.osType } @@ -63,31 +72,58 @@ final class APIClient { _ apiRequest: APIRequest, tokenOverride: String? = nil ) async throws -> Response { - let request = try makeURLRequest(apiRequest, tokenOverride: tokenOverride) - logRequest(request, includeBody: apiRequest.logsPayload) + let request = try DroneDockReadRequestPolicy.prepare(makeURLRequest(apiRequest, tokenOverride: tokenOverride)) + let isSimulation = session is any LocalSimulationURLSession + let trace = DroneDockRequestTrace(request: request, isSimulation: isSimulation) + if let trace { + droneDockLogSink(trace.message("request.started", fields: ["body": DroneDockDiagnostics.payload(request.httpBody)])) + } else { + logRequest(request, includeBody: apiRequest.logsPayload, category: apiRequest.redactedLogCategory) + } let data: Data let response: URLResponse do { (data, response) = try await session.data(for: request) } catch is CancellationError { - logCancelled(for: request, reason: "CancellationError") + if let trace { droneDockLogSink(trace.message("request.cancelled")) } + else { logCancelled(for: request, reason: "CancellationError", category: apiRequest.redactedLogCategory, includeBody: apiRequest.logsPayload) } throw CancellationError() } catch let error as URLError { + if let trace { droneDockLogSink(trace.message(error.code == .cancelled ? "request.cancelled" : "request.failed", + fields: DroneDockDiagnostics.errorFields(error))) } if error.code == .cancelled { - logCancelled(for: request, reason: "URLError.cancelled") + if trace == nil { logCancelled(for: request, reason: "URLError.cancelled", category: apiRequest.redactedLogCategory, includeBody: apiRequest.logsPayload) } throw CancellationError() } + if trace == nil { logFailure(for: request, error: error, category: apiRequest.redactedLogCategory, includeBody: apiRequest.logsPayload) } throw APIError.networkFailed(networkErrorMessage(for: error)) } catch { + if let trace { droneDockLogSink(trace.message("request.failed", fields: DroneDockDiagnostics.errorFields(error))) } + if trace == nil { logFailure(for: request, error: error, category: apiRequest.redactedLogCategory, includeBody: apiRequest.logsPayload) } throw APIError.networkFailed(error.localizedDescription) } - logResponse(for: request, response: response, data: data, includeBody: apiRequest.logsPayload) + if let trace { + // 用户要求机巢接口原样记录请求和响应,含 live / STS;统一通路避免重复打印。 + droneDockLogSink(trace.message("response.received", fields: [ + "http_status": (response as? HTTPURLResponse)?.statusCode ?? 0, + "response_headers": (response as? HTTPURLResponse)?.allHeaderFields.reduce(into: [String: String]()) { + $0[String(describing: $1.key)] = String(describing: $1.value) + } ?? [:], + "body": DroneDockDiagnostics.payload(data) + ])) + } else { + logResponse(for: request, response: response, data: data, includeBody: apiRequest.logsPayload, + category: apiRequest.redactedLogCategory) + } do { try validateHTTPResponse(response, data: data) - return try decodeEnvelope(Response.self, from: data) + let value = try decodeEnvelope(Response.self, from: data) + if let trace { droneDockLogSink(trace.message("response.decoded")) } + return value } catch let error as APIError { + if let trace { droneDockLogSink(trace.message("response.rejected", fields: DroneDockDiagnostics.errorFields(error))) } notifySessionErrorIfNeeded(for: error, request: request) throw error } @@ -120,6 +156,7 @@ final class APIClient { } request.httpBody = jsonBody.data(using: .utf8) + request = try DroneDockReadRequestPolicy.prepare(request) logRequest(request) let data: Data @@ -134,8 +171,10 @@ final class APIClient { logCancelled(for: request, reason: "URLError.cancelled") throw CancellationError() } + logFailure(for: request, error: error) throw APIError.networkFailed(networkErrorMessage(for: error)) } catch { + logFailure(for: request, error: error) throw APIError.networkFailed(error.localizedDescription) } @@ -191,6 +230,7 @@ final class APIClient { request.setValue(token, forHTTPHeaderField: "token") } request.httpBody = body + request = try DroneDockReadRequestPolicy.prepare(request) logRequest(request) let responseData: Data @@ -205,8 +245,10 @@ final class APIClient { logCancelled(for: request, reason: "URLError.cancelled") throw CancellationError() } + logFailure(for: request, error: error) throw APIError.networkFailed(networkErrorMessage(for: error)) } catch { + logFailure(for: request, error: error) throw APIError.networkFailed(error.localizedDescription) } @@ -234,6 +276,10 @@ final class APIClient { if !apiRequest.queryItems.isEmpty { components.queryItems = apiRequest.queryItems + // URLComponents 将 + 视为合法查询字符;PHP 表单式查询解析会把它当作空格。 + // 在已有百分号编码之后只替换字面 +,保留 %2B、空格和其他字符的原编码。 + components.percentEncodedQuery = components.percentEncodedQuery? + .replacingOccurrences(of: "+", with: "%2B") } guard let url = components.url else { @@ -301,7 +347,7 @@ final class APIClient { return payload } - /// 区分身份注销受限与凭证失效;150015 附带原请求 Token,便于忽略切换身份后的旧错误。 + /// 区分注销受限与凭证失效;已绑定会话时,旧 Token 的迟到错误不使新会话退出。 private func notifySessionErrorIfNeeded(for error: APIError, request: URLRequest) { if case .serverCode(150015, _) = error { guard let token = request.value(forHTTPHeaderField: "token"), !token.isEmpty else { return } @@ -313,6 +359,13 @@ final class APIClient { return } guard APIError.isAuthenticationExpired(error) else { return } + if let authTokenProvider { + let requestToken = request.value(forHTTPHeaderField: "token")? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + let currentToken = authTokenProvider()? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + guard requestToken == currentToken else { return } + } notificationCenter.post(name: NotificationName.sessionDidExpire, object: nil) } @@ -355,88 +408,44 @@ final class APIClient { } } - /// 在 Debug 环境打印请求信息(含 GET 查询参数与 POST 请求体,对齐 Android Ktor `LogLevel.BODY`)。 - private func logRequest(_ request: URLRequest, includeBody: Bool = true) { - #if DEBUG - let method = request.httpMethod ?? "REQUEST" - let url = request.url?.absoluteString ?? "" - var lines = ["[API][Request] \(method) \(url)"] - - if let queryItems = URLComponents(url: request.url ?? URL(fileURLWithPath: "/"), resolvingAgainstBaseURL: false)?.queryItems, - !queryItems.isEmpty { - let params = queryItems - .map { item in - let value = item.value ?? "" - return "\(item.name)=\(value)" - } - .joined(separator: "&") - lines.append("params: \(params)") + /// 发起请求时只打印路径和业务入参,不包含 Header、方法或诊断信封。 + private func logRequest(_ request: URLRequest, includeBody: Bool = true, category: String? = nil) { + if let category { + debugLogSink(APIRedactedLog.request(request, category: category, includeBody: includeBody)) + } else { + debugLogSink(APIConsoleFormat.message(path: request.url?.path ?? "", + params: APIConsoleFormat.parameters(request, includeBody: includeBody))) } - - let contentType = request.value(forHTTPHeaderField: "Content-Type") - if includeBody, let body = Self.debugRequestBody(from: request.httpBody, contentType: contentType) { - lines.append("body:\n\(body)") - } - - print(lines.joined(separator: "\n")) - #endif } - /// 在 Debug 环境打印响应状态和响应体。 - private func logResponse(for request: URLRequest, response: URLResponse, data: Data, includeBody: Bool = true) { - #if DEBUG - let method = request.httpMethod ?? "REQUEST" - let url = request.url?.absoluteString ?? "" - let statusCode = (response as? HTTPURLResponse).map { String($0.statusCode) } ?? "unknown" - let body = includeBody ? Self.debugResponseBody(from: data) : "" - print("[API][Response] \(method) \(url) status=\(statusCode)\n\(body)") - #endif + /// 原始回包整体放入 response,业务失败同样保留完整 JSON,不另打印解析事件。 + private func logResponse(for request: URLRequest, response: URLResponse, data: Data, + includeBody: Bool = true, category: String? = nil) { + if let category { + debugLogSink(APIRedactedLog.response(for: request, response: response, data: data, + category: category, includeBody: includeBody)) + } else { + debugLogSink(APIConsoleFormat.message(path: request.url?.path ?? "", + params: APIConsoleFormat.parameters(request, includeBody: includeBody), + response: includeBody ? APIConsoleFormat.payload(data) : "")) + } } - /// 在 Debug 环境打印被取消的请求信息。 - private func logCancelled(for request: URLRequest, reason: String) { - #if DEBUG - let method = request.httpMethod ?? "REQUEST" - let url = request.url?.absoluteString ?? "" - print("[API][Cancelled] \(method) \(url) reason=\(reason)") - #endif + /// 取消是本地结果,不生成后端业务成功或失败回包。 + private func logCancelled(for request: URLRequest, reason: String, category: String? = nil, includeBody: Bool = true) { + logLocalFailure(for: request, kind: "cancelled", message: "请求已取消", category: category, includeBody: includeBody) } - #if DEBUG - /// 将请求体格式化为便于调试阅读的字符串。 - private static func debugRequestBody(from data: Data?, contentType: String?) -> String? { - guard let data, !data.isEmpty else { return nil } - - if let contentType, contentType.lowercased().contains("multipart/form-data") { - return "" - } - - if - let object = try? JSONSerialization.jsonObject(with: data), - let prettyData = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted, .sortedKeys]), - let prettyJSON = String(data: prettyData, encoding: .utf8) { - return prettyJSON - } - - if let text = String(data: data, encoding: .utf8), !text.isEmpty { - return text.count > 2_000 ? String(text.prefix(2_000)) + "..." : text - } - - return "" + /// 仅网络层未收到响应时打印本地错误;已经打印原始回包的业务/解析异常不重复输出。 + private func logFailure(for request: URLRequest, error: Error, category: String? = nil, includeBody: Bool = true) { + logLocalFailure(for: request, kind: "network_failed", message: error.localizedDescription, category: category, includeBody: includeBody) } - /// 将响应体格式化为便于调试阅读的字符串。 - private static func debugResponseBody(from data: Data) -> String { - guard !data.isEmpty else { return "" } - if - let object = try? JSONSerialization.jsonObject(with: data), - let prettyData = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted, .sortedKeys]), - let prettyJSON = String(data: prettyData, encoding: .utf8) { - return prettyJSON - } - return String(data: data, encoding: .utf8) ?? "" + private func logLocalFailure(for request: URLRequest, kind: String, message: String, category: String?, includeBody: Bool) { + debugLogSink(APIConsoleFormat.failure(path: request.url?.path ?? "", + params: category == nil ? APIConsoleFormat.parameters(request, includeBody: includeBody) : APIRedactedLog.parameters(request, includeBody: includeBody), + kind: kind, message: message)) } - #endif } private extension String { diff --git a/suixinkan/Core/Networking/APIConsoleDiagnostics.swift b/suixinkan/Core/Networking/APIConsoleDiagnostics.swift new file mode 100644 index 0000000..ec9cc4c --- /dev/null +++ b/suixinkan/Core/Networking/APIConsoleDiagnostics.swift @@ -0,0 +1,73 @@ +import Darwin +import Foundation +import OSLog + +/// Debug/Release 共用简洁日志出口,序列化输出完整 JSON,避免并发日志互相穿插。 +enum APIConsoleDiagnostics { + private static let logger = Logger(subsystem: "com.yuanzhixiang.suixinkan", category: "API") + private static let droneDockLogger = Logger(subsystem: "com.yuanzhixiang.suixinkan", category: "DroneDock") + private static let outputWriter = APIConsoleOutputWriter() + + /// Xcode 附加调试时输出一个完整 JSON;脱离调试器时继续写入系统日志。 + static func write(_ message: String) { + output(message, logger: logger) + } + + /// 保留机巢原有系统日志 category,正文格式与其它模块一致。 + static func writeDroneDock(_ message: String) { + output(message, logger: droneDockLogger) + } + + private static func output(_ message: String, logger: Logger) { + guard let text = APIConsoleFormat.render(message) else { return } + outputWriter.write(text, prefersStandardOutput: isDebuggerAttached || isatty(STDOUT_FILENO) != 0) { text in + // 保留独立运行 Release 包的系统日志可见性,不加 session/entry/part 等包装。 + for chunk in DroneDockDiagnostics.chunks(text) { logger.notice("\(chunk, privacy: .public)") } + } + } + + private static var isDebuggerAttached: Bool { + var info = kinfo_proc() + var size = MemoryLayout.stride + var name: [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()] + return sysctl(&name, 4, &info, &size, nil, 0) == 0 + && (info.kp_proc.p_flag & P_TRACED) != 0 + } +} + +/// 串行写入日志;Xcode 输出通道断开后,本次运行改用系统日志,写入错误不能中断业务。 +final class APIConsoleOutputWriter: @unchecked Sendable { + private let lock = NSLock() + private var standardOutputFailed = false + private let writeStandardOutput: @Sendable (Data) throws -> Void + + /// 注入可失败的输出通道,以便使用隔离文件句柄验证断连及回退。 + init(writeStandardOutput: @escaping @Sendable (Data) throws -> Void = { + try APIConsoleOutputWriter.write($0, to: .standardOutput) + }) { + self.writeStandardOutput = writeStandardOutput + } + + /// 完整记录只走一个出口;stdout 失败时把原始记录交给系统日志,不再尝试损坏的通道。 + func write(_ text: String, prefersStandardOutput: Bool, fallback: (String) -> Void) { + lock.lock() + defer { lock.unlock() } + if prefersStandardOutput && !standardOutputFailed { + do { + try writeStandardOutput(Data((text + "\n").utf8)) + return + } catch { + standardOutputFailed = true + } + } + fallback(text) + } + + /// 使用可抛 Swift 错误的写入 API,并把断管转成 EPIPE,避免 NSException 或 SIGPIPE 退出进程。 + static func write(_ data: Data, to handle: FileHandle) throws { + guard fcntl(handle.fileDescriptor, F_SETNOSIGPIPE, 1) != -1 else { + throw POSIXError(POSIXErrorCode(rawValue: errno) ?? .EIO) + } + try handle.write(contentsOf: data) + } +} diff --git a/suixinkan/Core/Networking/APIConsoleFormat.swift b/suixinkan/Core/Networking/APIConsoleFormat.swift new file mode 100644 index 0000000..520457f --- /dev/null +++ b/suixinkan/Core/Networking/APIConsoleFormat.swift @@ -0,0 +1,96 @@ +import Foundation + +/// 接口日志保留路径、入参及原始返回;仅额外放行明确标识的拍摄任务关键事件。 +enum APIConsoleFormat { + /// 发起请求时立即输出路径和参数;响应记录携带同样参数,方便并发请求核对。 + static func message(path: String, params: Any, response: Any? = nil) -> String { + var values: [(String, Any)] = [("path", path), ("params", params)] + if let response { values.append(("response", response)) } + let fields = values.map { key, value in + " \"\(key)\": " + pretty(value).replacingOccurrences(of: "\n", with: "\n ") + } + return "{\n" + fields.joined(separator: ",\n") + "\n}" + } + + /// 从真正发送的 URLRequest 读取业务入参,不混入 Header 或环境配置。 + static func parameters(_ request: URLRequest, includeBody: Bool = true) -> Any { + let query = queryParameters(request.url) + guard includeBody, let data = request.httpBody, !data.isEmpty else { return query } + let body: Any + if request.value(forHTTPHeaderField: "Content-Type")?.lowercased().contains("multipart/form-data") == true { + // 不读取或打印视频/图片文件内容;multipart 入参以表单元信息表示。 + body = ["content_type": "multipart/form-data", "bytes": data.count] + } else { + body = payload(data) + } + return query.isEmpty ? body : ["query": query, "body": body] + } + + /// 保留重复参数和无值参数,避免诊断时丢失实际请求内容。 + static func queryParameters(_ url: URL?) -> [String: Any] { + let items = url.flatMap { URLComponents(url: $0, resolvingAgainstBaseURL: false)?.queryItems } ?? [] + var result: [String: Any] = [:] + for item in items { + let value: Any = item.value as Any? ?? NSNull() + if let previous = result[item.name] { + result[item.name] = (previous as? [Any] ?? [previous]) + [value] + } else { result[item.name] = value } + } + return result + } + + /// 保留完整 JSON 类型;空正文为 null,非 JSON 文本作为字符串显示。 + static func payload(_ data: Data) -> Any { + guard !data.isEmpty else { return NSNull() } + return (try? JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed)) + ?? String(data: data, encoding: .utf8) as Any? ?? ["binary_bytes": data.count] + } + + /// 本地失败没有后端响应,明确使用 local_error,避免伪装成后端业务返回。 + static func failure(path: String, params: Any, kind: String, message: String) -> String { + self.message(path: path, params: params, response: ["local_error": ["kind": kind, "message": message]]) + } + + /// 接口记录转换为简洁输出;只有 drone_task 专用事件保留诊断字段,其余内部事件仍过滤。 + static func render(_ text: String) -> String? { + guard let fields = try? JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String: Any] else { return nil } + if fields["diagnostic"] as? String == "drone_task" { + guard let event = fields["event"] as? String, + !event.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return nil } + return pretty(fields) + } + if fields["event"] == nil, let path = fields["path"] as? String, let params = fields["params"] { + return message(path: path, params: params, response: fields["response"]) + } + let event = fields["event"] as? String ?? "" + let isRequest = event.hasSuffix("request.started") + let isResponse = event.hasSuffix("response.received") + let isFailed = event.hasSuffix("request.failed") + let isCancelled = event.hasSuffix("request.cancelled") + let isBlocked = event.hasSuffix("request.blocked") + guard isRequest || isResponse || isFailed || isCancelled || isBlocked else { return nil } + let url = (fields["url"] as? String).flatMap(URL.init(string:)) + guard let path = fields["path"] as? String ?? url?.path else { return nil } + var params: Any = fields["request_params"] ?? queryParameters(url) + if fields["request_params"] == nil, isRequest, let body = fields["body"], body as? String != "" { + params = body + } + if event.hasPrefix("file_upload."), isRequest { + params = fields.filter { ["bucket", "object_key", "bytes", "content_type"].contains($0.key) } + } + if isRequest { return message(path: path, params: params) } + if isResponse { + let body = fields["body"] ?? fields["bytes"].map { ["binary_bytes": $0] } as Any? ?? NSNull() + return message(path: path, params: params, response: body as? String == "" ? NSNull() : body) + } + let kind = isBlocked ? "blocked" : isCancelled ? "cancelled" : "network_failed" + let reason = fields["message"] as? String ?? (isBlocked ? "请求已在本地拦截,未发送" : isCancelled ? "请求已取消" : "请求失败,未收到响应") + return failure(path: path, params: params, kind: kind, message: reason) + } + + private static func pretty(_ value: Any) -> String { + guard let data = try? JSONSerialization.data(withJSONObject: value, + options: [.prettyPrinted, .sortedKeys, .fragmentsAllowed, .withoutEscapingSlashes]) else { return "null" } + return String(decoding: data, as: UTF8.self) + } +} diff --git a/suixinkan/Core/Networking/APIRedactedLog.swift b/suixinkan/Core/Networking/APIRedactedLog.swift new file mode 100644 index 0000000..b9fee4b --- /dev/null +++ b/suixinkan/Core/Networking/APIRedactedLog.swift @@ -0,0 +1,75 @@ +import Foundation + +/// 沿用接口指定的正文脱敏策略生成简洁 JSON;只处理输出副本,不修改网络请求和响应。 +nonisolated enum APIRedactedLog { + private static let urlPattern = try? NSRegularExpression(pattern: #"https?://[^\s"<>]+"#, options: [.caseInsensitive]) + + /// 保留接口原有脱敏策略,只修改日志展示结构。 + static func request(_ request: URLRequest, category: String, includeBody: Bool) -> String { + APIConsoleFormat.message(path: request.url?.path ?? "", params: parameters(request, includeBody: includeBody)) + } + + /// 请求与回包共享参数,响应关闭正文记录时继续遵守原设置。 + static func response(for request: URLRequest, response: URLResponse, data: Data, + category: String, includeBody: Bool) -> String { + let payload: Any + if !includeBody { payload = "" } + else if let object = try? JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed) { payload = redact(object) } + else { payload = "" } + return APIConsoleFormat.message(path: request.url?.path ?? "", + params: parameters(request, includeBody: includeBody), response: payload) + } + + /// 脱敏只处理日志副本,原请求不受影响。 + static func parameters(_ request: URLRequest, includeBody: Bool) -> Any { + redact(APIConsoleFormat.parameters(request, includeBody: includeBody)) + } + + /// 递归处理嵌套对象与数组,保留普通字段、空值及 JSON 类型。 + private static func redact(_ value: Any) -> Any { + if let object = value as? [String: Any] { + return Dictionary(uniqueKeysWithValues: object.map { key, value in + (key, isSensitive(key) ? "" : redact(value)) + }) + } + if let array = value as? [Any] { return array.map(redact) } + if let text = value as? String { return redactURLs(in: text) } + return value + } + + /// 兼容 snake_case、大小写及 OSS/S3 常用签名字段。 + private static func isSensitive(_ key: String) -> Bool { + let normalized = key.lowercased().filter { $0.isLetter || $0.isNumber } + return ["token", "authorization", "signature", "credential", "accesskey", "secret", "password", "cookie"] + .contains { normalized.contains($0) } + } + + /// JSON 字段或消息中的 URL 只保留资源路径,不记录有效期、签名及其他查询值。 + private static func redactURLs(in text: String) -> String { + guard let pattern = urlPattern else { return text } + var result = text + for match in pattern.matches(in: text, range: NSRange(text.startIndex..., in: text)).reversed() { + guard let range = Range(match.range, in: result) else { continue } + let replacement = URL(string: String(result[range])).map { redactedURL($0, keepsQuery: false) } + ?? "" + result.replaceSubrange(range, with: replacement) + } + return result + } + + /// 请求地址保留业务查询值;正文中的资源地址删除完整查询,兼容未来签名参数。 + private static func redactedURL(_ url: URL, keepsQuery: Bool) -> String { + guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return "" } + components.user = nil + components.password = nil + components.fragment = nil + if keepsQuery { + components.queryItems = components.queryItems?.map { + URLQueryItem(name: $0.name, value: isSensitive($0.name) ? "" : $0.value.map(redactURLs)) + } + } else { + components.query = nil + } + return components.string ?? "" + } +} diff --git a/suixinkan/Core/Networking/APIRequest.swift b/suixinkan/Core/Networking/APIRequest.swift index eec0166..27affb1 100644 --- a/suixinkan/Core/Networking/APIRequest.swift +++ b/suixinkan/Core/Networking/APIRequest.swift @@ -9,6 +9,7 @@ import Foundation enum HTTPMethod: String { case get = "GET" case post = "POST" + case patch = "PATCH" case put = "PUT" case delete = "DELETE" } @@ -20,8 +21,10 @@ nonisolated struct APIRequest { var queryItems: [URLQueryItem] var headers: [String: String] var body: AnyEncodable? - /// 敏感请求关闭正文日志,避免验证码和注销资产进入调试日志。 + /// 控制普通正文日志;机巢范围按用户要求始终记录完整请求和响应。 var logsPayload: Bool + /// 为指定模块启用原有正文脱敏策略;隐藏凭证及媒体 URL 查询参数,不增加控制台标签。 + var redactedLogCategory: String? /// 创建一个 API 请求,并把可编码请求体擦除为统一的 AnyEncodable。 init( @@ -30,7 +33,8 @@ nonisolated struct APIRequest { queryItems: [URLQueryItem] = [], headers: [String: String] = [:], body: Body? = Optional.none, - logsPayload: Bool = true + logsPayload: Bool = true, + redactedLogCategory: String? = nil ) { self.method = method self.path = path @@ -38,6 +42,7 @@ nonisolated struct APIRequest { self.headers = headers self.body = body.map(AnyEncodable.init) self.logsPayload = logsPayload + self.redactedLogCategory = redactedLogCategory } } diff --git a/suixinkan/Core/Networking/DroneDockDiagnostics.swift b/suixinkan/Core/Networking/DroneDockDiagnostics.swift new file mode 100644 index 0000000..0246b00 --- /dev/null +++ b/suixinkan/Core/Networking/DroneDockDiagnostics.swift @@ -0,0 +1,142 @@ +import Foundation + +/// 机巢联调日志:按用户要求在 Debug 与 Release 控制台原样记录字段,不做脱敏。 +enum DroneDockDiagnostics { + /// 与其它模块共用简洁出口;内部诊断事件留作测试/业务核对,不在控制台刷屏。 + static func write(_ message: String) { + APIConsoleDiagnostics.writeDroneDock(message) + } + + /// 构造内部结构化事件;控制台仅选择请求、响应及本地传输失败输出。 + static func event(_ name: String, taskID: Int? = nil, fields: [String: Any] = [:]) { + var fields = fields + fields["task_id"] = taskID + fields["event"] = name + write(json(fields)) + } + + /// 覆盖机巢全部业务接口、景区空境库及共用 STS;不依赖页面或构建环境开关。 + static func includes(path: String) -> Bool { + ["/api/app/airport/", "/api/yf-handset-app/photog/multi-plane/", "/api/app/scenic-media/"] + .contains(where: path.hasPrefix) || path == "/api/app/config/get-sts-token" + } + + /// JSON 保留完整字段,文本错误页原样记录;二进制正文只记录字节数。 + static func payload(_ data: Data?) -> Any { + guard let data, !data.isEmpty else { return "" } + return (try? JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed)) + ?? String(data: data, encoding: .utf8) + ?? "" + } + + /// 排序 JSON 便于复制比对,所有字段值保持原样。 + static func json(_ object: Any) -> String { + guard let data = try? JSONSerialization.data(withJSONObject: object, + options: [.sortedKeys, .fragmentsAllowed, .withoutEscapingSlashes]), + let text = String(data: data, encoding: .utf8) else { return "" } + return text + } + + /// 记录业务码、HTTP 状态及原始错误说明,便于与后端回包对应。 + static func errorFields(_ error: Error) -> [String: Any] { + if error is CancellationError { return ["kind": "cancelled"] } + if case APIError.serverCode(let code, let message) = error { + return ["kind": "business_rejected", "code": code, "message": message] + } + if case APIError.decodeFailed(let message) = error { return ["kind": "decode_failed", "message": message] } + if case APIError.httpStatus(let code, let message) = error { + return ["kind": "http_rejected", "http_status": code, "message": message] + } + if case APIError.emptyData = error { return ["kind": "empty_data"] } + let value = error as NSError + var fields: [String: Any] = ["kind": "error", "domain": value.domain, "code": value.code, + "message": value.localizedDescription] + fields["failing_url"] = value.userInfo[NSURLErrorFailingURLStringErrorKey] as? String + return fields + } + + /// 独立运行时的系统日志按最多 600 字节分段;Xcode 控制台直接输出完整 JSON。 + static func chunks(_ text: String) -> [String] { + var result: [String] = [] + var current = "" + var bytes = 0 + for scalar in text.unicodeScalars { + let next = String(scalar) + if bytes + next.utf8.count > 600 { result.append(current); current = ""; bytes = 0 } + current += next + bytes += next.utf8.count + } + if !current.isEmpty { result.append(current) } + return result.isEmpty ? [""] : result + } + +} + +/// 视频上传和素材下载的网络摘要,保留完整地址和传输状态。 +struct DroneDockFileTransferTrace: Sendable { + private let requestID = UUID().uuidString + private let started = ProcessInfo.processInfo.systemUptime + private let operation: String + private let method: String + private let remoteURL: URL? + + /// 仅在实际文件传输边界创建,记录传入的完整目标地址。 + init(operation: String, method: String, remoteURL: URL?) { + self.operation = operation + self.method = method + self.remoteURL = remoteURL + } + + /// 请求、响应和错误共用同一关联 ID;文件响应仅记录状态与大小。 + func message(_ event: String, fields: [String: Any] = [:]) -> String { + var fields = fields + fields["event"] = operation + "." + event + fields["request_id"] = requestID + fields["elapsed_ms"] = Int((ProcessInfo.processInfo.systemUptime - started) * 1_000) + fields["source"] = "network" + fields["method"] = method + fields["host"] = remoteURL?.host + fields["url"] = remoteURL?.absoluteString + return DroneDockDiagnostics.json(fields) + } +} + +/// 一次请求的关联 ID 与耗时;模拟/真实传输明确区分,不把 HTTP 成功当作设备执行成功。 +struct DroneDockRequestTrace { + private let requestID = UUID().uuidString + private let started = ProcessInfo.processInfo.systemUptime + private let request: URLRequest + private let isSimulation: Bool + + /// 未在机巢范围的请求不生成日志。 + init?(request: URLRequest, isSimulation: Bool) { + guard DroneDockDiagnostics.includes(path: request.url?.path ?? "") else { return nil } + self.request = request + self.isSimulation = isSimulation + } + + /// 保留完整地址、请求头、业务参数与固定身份。 + func message(_ event: String, fields: [String: Any] = [:]) -> String { + var fields = fields + fields["event"] = event + fields["request_id"] = requestID + fields["elapsed_ms"] = Int((ProcessInfo.processInfo.systemUptime - started) * 1_000) + fields["source"] = isSimulation ? "local_simulation" : "network" + fields["host"] = request.url?.host + fields["path"] = request.url?.path + fields["method"] = request.httpMethod + fields["url"] = request.url?.absoluteString + fields["request_headers"] = request.allHTTPHeaderFields ?? [:] + fields["request_params"] = APIConsoleFormat.parameters(request) + fields["app_version"] = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String + fields["app_build"] = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String + #if DEBUG + fields["build"] = "Debug" + #else + fields["build"] = "Release" + #endif + let items = request.url.flatMap { URLComponents(url: $0, resolvingAgainstBaseURL: false)?.queryItems } ?? [] + fields["query"] = items.map { [$0.name: $0.value ?? ""] } + return DroneDockDiagnostics.json(fields) + } +} diff --git a/suixinkan/Core/Networking/DroneDockReadRequestPolicy.swift b/suixinkan/Core/Networking/DroneDockReadRequestPolicy.swift new file mode 100644 index 0000000..5c8f8a3 --- /dev/null +++ b/suixinkan/Core/Networking/DroneDockReadRequestPolicy.swift @@ -0,0 +1,25 @@ +import Foundation + +/// 任务与工作台状态使用缓存读数;设备操作和准备页电量保留调用方请求。 +enum DroneDockReadRequestPolicy { + /// Debug 与 Release 使用相同规则,不改写创建、飞控或图传请求。 + static func prepare(_ request: URLRequest) throws -> URLRequest { + guard request.httpMethod == "GET", let url = request.url else { return request } + let path = "/" + url.path.split(separator: "/").joined(separator: "/") + let liveKey: String + switch path { + case "/api/app/airport/shooting": liveKey = "live_battery" + case "/api/app/airport/status": liveKey = "live_metrics" + default: return request + } + guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { throw APIError.invalidURL } + var items = components.queryItems ?? [] + items.removeAll { $0.name == liveKey } + items.append(URLQueryItem(name: liveKey, value: "0")) + components.queryItems = items + guard let cachedURL = components.url else { throw APIError.invalidURL } + var cachedRequest = request + cachedRequest.url = cachedURL + return cachedRequest + } +} diff --git a/suixinkan/Core/Networking/DroneDockTaskDiagnostics.swift b/suixinkan/Core/Networking/DroneDockTaskDiagnostics.swift new file mode 100644 index 0000000..0d65a4e --- /dev/null +++ b/suixinkan/Core/Networking/DroneDockTaskDiagnostics.swift @@ -0,0 +1,87 @@ +import Foundation + +/// 拍摄任务会话的关键事件日志;与接口正文分开标识,Debug 和 Release 使用同一安全输出通道。 +final class DroneDockTaskDiagnostics: @unchecked Sendable { + /// 同一任务页及其 ViewModel 共用的会话标识,用于与录屏和接口日志对照。 + let sessionID: String + + private let lock = NSLock() + private let metadata: DroneDockTaskDiagnosticMetadata + private let now: @Sendable () -> Date + private let uptime: @Sendable () -> TimeInterval + private let sink: @Sendable (String) -> Void + private let startedUptime: TimeInterval + private var sequence = 0 + + /// 默认写入已有串行控制台出口;测试可注入时钟和纯内存 sink,不修改全局日志通道。 + init(sessionID: String = UUID().uuidString, + metadata: DroneDockTaskDiagnosticMetadata = .current, + now: @escaping @Sendable () -> Date = { Date() }, + uptime: @escaping @Sendable () -> TimeInterval = { ProcessInfo.processInfo.systemUptime }, + sink: @escaping @Sendable (String) -> Void = { DroneDockDiagnostics.write($0) }) { + self.sessionID = sessionID + self.metadata = metadata + self.now = now + self.uptime = uptime + self.sink = sink + startedUptime = uptime() + } + + /// 按同一会话顺序同步生成并输出关键事件;业务字段完整保留,不能覆盖关联身份及时间字段。 + func record(_ event: String, taskID: Int, fields: [String: Any] = [:]) { + lock.lock() + defer { lock.unlock() } + sequence += 1 + let elapsed = max(0, (uptime() - startedUptime) * 1_000) + let milliseconds = elapsed.isFinite && elapsed < Double(Int.max) ? Int(elapsed) : 0 + sink(Self.makeMessage(event, taskID: taskID, fields: fields, sessionID: sessionID, + sequence: sequence, timestamp: now(), elapsedMilliseconds: milliseconds, metadata: metadata)) + } + + /// 纯格式化入口:使用上海时区的毫秒时间,单调耗时与系统墙钟彼此独立。 + static func makeMessage(_ event: String, taskID: Int, fields: [String: Any] = [:], + sessionID: String, sequence: Int, timestamp: Date, + elapsedMilliseconds: Int, + metadata: DroneDockTaskDiagnosticMetadata = .current) -> String { + let formatter = DateFormatter() + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.calendar = Calendar(identifier: .gregorian) + formatter.timeZone = TimeZone(identifier: "Asia/Shanghai") + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" + var value = fields + value["diagnostic"] = "drone_task" + value["event"] = event + value["timestamp"] = formatter.string(from: timestamp) + value["timezone"] = "Asia/Shanghai" + value["elapsed_ms"] = max(0, elapsedMilliseconds) + value["sequence"] = sequence + value["session_id"] = sessionID + value["task_id"] = taskID + value["app_version"] = metadata.appVersion + value["app_build"] = metadata.appBuild + value["configuration"] = metadata.configuration + return DroneDockDiagnostics.json(value) + } +} + +/// 构建信息在会话创建时固定,不因后续事件或外部传入字段变化。 +struct DroneDockTaskDiagnosticMetadata: Sendable { + /// App 对外版本号。 + let appVersion: String + /// App 构建号。 + let appBuild: String + /// 当前构建配置,值为 Debug 或 Release。 + let configuration: String + + /// 从当前 App 获取只读构建信息;缺失时明确标为 unknown。 + static var current: Self { + #if DEBUG + let configuration = "Debug" + #else + let configuration = "Release" + #endif + return Self(appVersion: Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "unknown", + appBuild: Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "unknown", + configuration: configuration) + } +} diff --git a/suixinkan/Core/Push/PushModels.swift b/suixinkan/Core/Push/PushModels.swift index a0dbd0f..3d98d6c 100644 --- a/suixinkan/Core/Push/PushModels.swift +++ b/suixinkan/Core/Push/PushModels.swift @@ -2,7 +2,7 @@ import Foundation /// 推送点击后可到达的业务页面。 enum PushDestination: Sendable, Equatable { - case paymentRecord + case orders case paymentDetails case messageCenter case aiRetouchTaskList @@ -36,8 +36,8 @@ struct PushPayload: Sendable, Equatable { /// 仅根据后端业务消息类型解析目标页面。 nonisolated var destination: PushDestination { switch type { - case "1": - return .paymentRecord + case "1", "5": + return .orders case "6": return .paymentDetails case "14": diff --git a/suixinkan/Core/Upload/UploadAPI.swift b/suixinkan/Core/Upload/UploadAPI.swift index da041e8..7608c3b 100644 --- a/suixinkan/Core/Upload/UploadAPI.swift +++ b/suixinkan/Core/Upload/UploadAPI.swift @@ -27,7 +27,8 @@ final class UploadAPI { APIRequest( method: .get, path: "/api/app/config/get-sts-token", - queryItems: [URLQueryItem(name: "bucket", value: bucket)] + queryItems: [URLQueryItem(name: "bucket", value: bucket)], + logsPayload: false ) ) } diff --git a/suixinkan/DataStore/AppPermissionStore.swift b/suixinkan/DataStore/AppPermissionStore.swift index 722e770..8c0eeb6 100644 --- a/suixinkan/DataStore/AppPermissionStore.swift +++ b/suixinkan/DataStore/AppPermissionStore.swift @@ -46,9 +46,10 @@ final class AppPermissionStore { load([RolePermissionResponse].self, for: .rolePermissionList) ?? [] } - /// 保存当前角色扁平权限。 + /// 保存当前角色扁平权限,写入后通知入口页面读取最新快照。 func savePermissionItems(_ items: [HomePermissionItem]) { - save(items, for: .permissionItems) + guard save(items, for: .permissionItems) else { return } + NotificationCenter.default.post(name: NotificationName.permissionItemsDidChange, object: self) } /// 读取当前角色扁平权限。 @@ -82,10 +83,12 @@ final class AppPermissionStore { Key.allCases.forEach { defaults.removeObject(forKey: "\(accountScope)_\($0.rawValue)") } } - private func save(_ value: Value, for key: Key) { + @discardableResult + private func save(_ value: Value, for key: Key) -> Bool { guard let scopedKey = scopedKey(key), - let data = try? JSONEncoder().encode(value) else { return } + let data = try? JSONEncoder().encode(value) else { return false } defaults.set(data, forKey: scopedKey) + return true } private func load(_ type: Value.Type, for key: Key) -> Value? { diff --git a/suixinkan/Features/DroneDock/API/DroneDockAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockAPI.swift new file mode 100644 index 0000000..8e32fc1 --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockAPI.swift @@ -0,0 +1,77 @@ +import Foundation + +/// 首页三个独立只读数据源;设备由朱工提供,订单与统计由张工提供。 +protocol DroneDockHomeServing: Sendable { + /// 读取当前景区的机巢摘要;门店用于验证本地身份,不作为查询参数。 + @MainActor + func home(scenicID: Int, storeID: Int) async throws -> DroneDockHomeResponse + /// 按履约分类分页读取本人当前景区的类型 25 拍摄订单。 + @MainActor + func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse + /// 读取本人当前景区当天的成交和确认完成统计。 + @MainActor + func todayStats(scenicID: Int) async throws -> DroneDockHomeToday +} + +/// 首页继续读取全部状态;独立订单页显式传递当前筛选。 +extension DroneDockHomeServing { + /// 保留首页的全部订单入口,统一转发到带状态的服务方法。 + @MainActor + func orders(scenicID: Int, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse { + try await orders(scenicID: scenicID, status: .all, page: page, pageSize: pageSize) + } +} + +/// 机巢首页三接口适配,复用统一凭证及业务错误处理,不创建订单或飞行任务。 +@MainActor +final class DroneDockAPI: DroneDockHomeServing { + private let client: APIClient + private let orderPrefix = "/api/yf-handset-app/photog/multi-plane" + + /// 注入统一网络客户端,供正式页面及网络测试使用。 + init(client: APIClient) { self.client = client } + + /// 朱工 home 只传 scenic_id,响应仅用于设备区域。 + func home(scenicID: Int, storeID: Int) async throws -> DroneDockHomeResponse { + guard scenicID > 0, storeID > 0 else { + throw APIError.networkFailed("请先选择景区和门店") + } + return try await client.send(APIRequest( + method: .get, path: "/api/app/airport/home", + queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID))] + )) + } + + /// 张工 orders 由当前登录身份限定归属,不传其他摄影师或门店 ID。 + func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse { + try validateScenic(scenicID) + guard page > 0, (1...100).contains(pageSize) else { + throw APIError.networkFailed("订单分页参数无效") + } + let response: DroneDockOrdersResponse = try await client.send(APIRequest( + method: .get, path: orderPrefix + "/orders", + queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID)), + URLQueryItem(name: "status", value: status.apiStatus), + URLQueryItem(name: "page", value: String(page)), + URLQueryItem(name: "page_size", value: String(pageSize))] + )) + guard response.page == page else { + throw APIError.decodeFailed("订单页码与请求不一致") + } + return response + } + + /// 张工 today-stats 负责统计口径与上海时区日界限,客户端不传本地日期。 + func todayStats(scenicID: Int) async throws -> DroneDockHomeToday { + try validateScenic(scenicID) + return try await client.send(APIRequest( + method: .get, path: orderPrefix + "/today-stats", + queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID))] + )) + } + + /// 没有选择景区时阻止范围不明的请求。 + private func validateScenic(_ scenicID: Int) throws { + guard scenicID > 0 else { throw APIError.networkFailed("请先选择景区") } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockCommandAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockCommandAPI.swift new file mode 100644 index 0000000..d3a9820 --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockCommandAPI.swift @@ -0,0 +1,43 @@ +import Foundation + +/// 基于既有订单飞行任务发送单次安全指令;测试使用独立的本地模拟服务。 +protocol DroneDockCommandSending: Sendable { + /// 提交任务 ID 和白名单指令,不创建任务、不选机,也不自动重试。 + @MainActor + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse +} + +/// 朱工 command 合同适配,校验任务身份及幂等指令回执。 +@MainActor +final class DroneDockCommandAPI: DroneDockCommandSending { + private let client: APIClient + + /// 注入统一客户端;模拟调试使用完全不转发网络的响应替身。 + init(client: APIClient) { self.client = client } + + /// 每次点击使用独立幂等键,回执必须对应同一任务、指令及请求。 + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + try Task.checkCancellation() + guard taskID > 0, !clientRequestID.isEmpty else { throw APIError.networkFailed("缺少有效拍摄任务或指令标识,请返回任务页确认") } + let response: DroneDockCommandResponse = try await client.send(APIRequest( + method: .post, path: "/api/app/airport/command", + body: CommandBody(taskID: taskID, command: command.rawValue, clientRequestID: clientRequestID) + )) + guard response.orderFlightTaskID == taskID, response.command == command.rawValue, + DroneDockHomeMetric.usableText(response.commandID) != nil, + response.clientRequestID == nil || response.clientRequestID == clientRequestID else { + throw APIError.decodeFailed("安全指令回执的任务或指令不一致,请核对原任务状态") + } + return response + } + + /// 指令请求只携带任务身份及已确认的指令码。 + private struct CommandBody: Encodable { + let taskID: Int + let command: String + let clientRequestID: String + + /// 朱工请求字段映射,不附加飞机或模拟标志。 + private enum CodingKeys: String, CodingKey { case taskID = "id", command, clientRequestID = "client_request_id" } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockConfirmationAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockConfirmationAPI.swift new file mode 100644 index 0000000..0dce06c --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockConfirmationAPI.swift @@ -0,0 +1,59 @@ +import Foundation + +/// 游客交付确认数据源,读取整单状态并为原下单游客生成确认码图片。 +protocol DroneDockConfirmationServing: DroneDockMaterialsServing { + /// 发起确认邀请,不代替游客主动确认或完成订单。 + @MainActor + func createConfirmation(scenicID: Int, orderNumber: String) async throws -> DroneDockConfirmationCode +} + +/// 张工交付确认接口,复用订单素材查询的鉴权和订单归属校验。 +@MainActor +final class DroneDockConfirmationAPI: DroneDockConfirmationServing { + private let client: APIClient + private let materials: DroneDockMaterialsAPI + + /// 查询与生成确认码使用同一当前登录凭证。 + init(client: APIClient) { + self.client = client + materials = DroneDockMaterialsAPI(client: client) + } + + /// 读取整单确认权限与结果,不根据成片数量推断订单完成。 + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + try await materials.detail(scenicID: scenicID, orderNumber: orderNumber) + } + + /// 读取整单或指定点位的素材清单,不触发设备指令。 + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + try await materials.tasks(scenicID: scenicID, orderNumber: orderNumber, spotID: spotID) + } + + /// 只提交景区与完整订单号,服务端重复生成时复用已有确认记录。 + func createConfirmation(scenicID: Int, orderNumber: String) async throws -> DroneDockConfirmationCode { + guard scenicID > 0, !orderNumber.isEmpty, orderNumber.count <= 128, + orderNumber == orderNumber.trimmingCharacters(in: .whitespacesAndNewlines), + orderNumber.rangeOfCharacter(from: .controlCharacters) == nil else { + throw APIError.networkFailed("缺少有效景区或订单信息,请返回订单列表重新进入") + } + let result: DroneDockConfirmationCode = try await client.send(APIRequest( + method: .post, path: "/api/yf-handset-app/photog/multi-plane/orders/confirm-code", + body: ConfirmationBody(scenicID: scenicID, orderNumber: orderNumber) + )) + guard result.orderNumber == orderNumber else { + throw APIError.decodeFailed("确认码与当前订单不一致,请刷新后重试") + } + return result + } + + /// 确认码请求只包含文档规定的两项参数。 + private struct ConfirmationBody: Encodable { + let scenicID: Int + let orderNumber: String + + /// 张工确认码请求字段。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", orderNumber = "order_number" + } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockDeliveryAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockDeliveryAPI.swift new file mode 100644 index 0000000..799bca5 --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockDeliveryAPI.swift @@ -0,0 +1,61 @@ +import Foundation + +/// 成片交付复用订单素材查询,并在 OSS 上传完成后保存指定任务的成片。 +protocol DroneDockDeliveryServing: DroneDockMaterialsServing { + /// 保存或替换一个任务的唯一视频成片;此接口不上传文件二进制。 + @MainActor + func saveFilm(scenicID: Int, taskID: Int, fileURL: String, fileName: String) async throws -> DroneDockSavedFilm +} + +/// 张工云端交付接口,保留素材查询的订单归属校验与统一鉴权。 +@MainActor +final class DroneDockDeliveryAPI: DroneDockDeliveryServing { + private let client: APIClient + private let materials: DroneDockMaterialsAPI + + /// 注入统一客户端,查询和保存使用同一当前登录凭证。 + init(client: APIClient) { + self.client = client + materials = DroneDockMaterialsAPI(client: client) + } + + /// 读取整单点位和当前上传权限。 + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + try await materials.detail(scenicID: scenicID, orderNumber: orderNumber) + } + + /// 读取有效任务及各自成片,不以点位代替 task_id。 + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + try await materials.tasks(scenicID: scenicID, orderNumber: orderNumber, spotID: spotID) + } + + /// 只提交已上传的视频原始地址,响应身份与文件必须对应本次保存。 + func saveFilm(scenicID: Int, taskID: Int, fileURL: String, fileName: String) async throws -> DroneDockSavedFilm { + guard scenicID > 0, taskID > 0 else { throw DroneDockFilmError.invalidScope } + _ = try DroneDockFilmPolicy.contentType(fileName: fileName) + guard DroneDockFilmPolicy.remoteURL(fileURL) != nil else { + throw APIError.networkFailed("成片地址无效,请重新上传视频") + } + let response: DroneDockSavedFilm = try await client.send(APIRequest( + method: .post, path: "/api/yf-handset-app/photog/multi-plane/tasks/film", + body: SaveFilmBody(scenicID: scenicID, taskID: taskID, fileURL: fileURL, fileName: fileName) + )) + guard response.taskID == taskID, response.film.fileURL == fileURL else { + throw APIError.decodeFailed("保存结果与当前任务或视频不一致,请刷新后核对") + } + return response + } + + /// 保存仅需四项业务参数,封面和大小由后端读取文件生成。 + private struct SaveFilmBody: Encodable { + let scenicID: Int + let taskID: Int + let fileURL: String + let fileName: String + + /// 张工成片保存字段。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", taskID = "task_id", fileURL = "file_url", fileName = "file_name" + } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockLiveAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockLiveAPI.swift new file mode 100644 index 0000000..6104f45 --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockLiveAPI.swift @@ -0,0 +1,32 @@ +import Foundation + +/// 朱工任务图传参数服务;请求可能启动设备图传,由页面生命周期管理。 +protocol DroneDockLiveServing: Sendable { + /// 读取同一订单飞行任务的图传回执,不创建任务或更换飞机。 + @MainActor + func live(taskID: Int) async throws -> DroneDockLiveResponse +} + +/// 按已提供的 live 合同发送请求;不猜测 RTC 厂商、播放地址或连接凭证。 +@MainActor +final class DroneDockLiveAPI: DroneDockLiveServing { + private let client: APIClient + + /// 注入统一客户端,测试使用纯内存传输。 + init(client: APIClient) { self.client = client } + + /// 只发送一次 GET,请求失败不自动重试或发出其他设备请求。 + func live(taskID: Int) async throws -> DroneDockLiveResponse { + try Task.checkCancellation() + guard taskID > 0 else { throw APIError.networkFailed("缺少有效拍摄任务 ID") } + let value: DroneDockLiveResponse = try await client.send(APIRequest( + method: .get, path: "/api/app/airport/live", + queryItems: [URLQueryItem(name: "id", value: String(taskID))], + logsPayload: false + )) + guard value.orderFlightTaskID == taskID, value.task?.id == nil || value.task?.id == taskID else { + throw APIError.decodeFailed("图传回执与当前拍摄任务不一致") + } + return value + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockMaterialsAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockMaterialsAPI.swift new file mode 100644 index 0000000..fbdf350 --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockMaterialsAPI.swift @@ -0,0 +1,60 @@ +import Foundation + +/// 订单素材库只读数据源,分别读取整单摘要和指定范围内的任务。 +protocol DroneDockMaterialsServing: Sendable { + /// 获取整单摘要和购买点位;筛选任务不改变摘要口径。 + @MainActor + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail + + /// 一次获取全部有效任务;spotID 为空时省略点位参数。 + @MainActor + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks +} + +/// 张工订单素材库与点位筛选接口,复用统一登录凭证和业务错误处理。 +@MainActor +final class DroneDockMaterialsAPI: DroneDockMaterialsServing { + private let client: APIClient + + /// 注入统一客户端,便于在测试中隔离网络。 + init(client: APIClient) { self.client = client } + + /// 读取根级订单摘要及 spot,不使用 workbench 或其他订单的数据回填。 + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + let queryItems = try queryItems(scenicID: scenicID, orderNumber: orderNumber) + let response: DroneDockMaterialDetail = try await client.send(APIRequest( + method: .get, path: "/api/yf-handset-app/photog/multi-plane/orders/detail", queryItems: queryItems + )) + guard response.order.orderNumber == orderNumber else { + throw APIError.decodeFailed("素材库摘要与当前订单不一致,请刷新重试") + } + return response + } + + /// 点位仅筛选任务;响应必须属于请求订单和点位,不发送分页参数。 + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + var queryItems = try queryItems(scenicID: scenicID, orderNumber: orderNumber) + if let spotID { + guard spotID > 0 else { throw APIError.networkFailed("缺少有效拍摄点,请重新选择") } + queryItems.append(URLQueryItem(name: "scenic_spot_id", value: String(spotID))) + } + let response: DroneDockMaterialTasks = try await client.send(APIRequest( + method: .get, path: "/api/yf-handset-app/photog/multi-plane/tasks", queryItems: queryItems + )) + guard response.orderNumber == orderNumber, + spotID == nil || response.list.allSatisfy({ $0.spotID == spotID }) else { + throw APIError.decodeFailed("素材任务与当前订单或拍摄点不一致,请刷新重试") + } + return response + } + + /// 请求前验证页面范围,禁止用缺失身份请求其他订单。 + private func queryItems(scenicID: Int, orderNumber: String) throws -> [URLQueryItem] { + guard scenicID > 0, !orderNumber.isEmpty, orderNumber.count <= 128, + orderNumber == orderNumber.trimmingCharacters(in: .whitespacesAndNewlines) else { + throw APIError.networkFailed("缺少有效景区或订单信息,请返回订单列表重新进入") + } + return [URLQueryItem(name: "scenic_id", value: String(scenicID)), + URLQueryItem(name: "order_number", value: orderNumber)] + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockPaymentAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockPaymentAPI.swift new file mode 100644 index 0000000..71d9e0d --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockPaymentAPI.swift @@ -0,0 +1,79 @@ +import Foundation + +/// 张工的机巢套餐收款数据源;小程序收款码与收款记录不提供单笔支付状态查询。 +protocol DroneDockPaymentServing: Sendable { + /// 获取当前景区可售套餐,无分页。 + @MainActor func projects(scenicID: Int) async throws -> [DroneDockProject] + /// 获取指定套餐的小程序收款码;省略 price 时使用后端当前售价。 + @MainActor func payCode(scenicID: Int, projectID: Int, price: String?) async throws -> DroneDockPayCode + /// 获取本人当前景区的收款记录,默认日期与每页数量由后端决定。 + @MainActor func receipts(scenicID: Int, projectID: Int?, page: Int) async throws -> DroneDockReceiptsResponse +} + +/// 机巢套餐、小程序收款码及真实收款记录接口,复用统一登录凭证和业务错误处理。 +@MainActor +final class DroneDockPaymentAPI: DroneDockPaymentServing { + private let client: APIClient + private let prefix = "/api/yf-handset-app/photog/multi-plane" + + /// 注入统一客户端,支持正式服务和隔离的网络测试。 + init(client: APIClient) { self.client = client } + + /// 请求当前景区可售套餐;空数组表示无可售套餐。 + func projects(scenicID: Int) async throws -> [DroneDockProject] { + try validateScenic(scenicID) + let projects: [DroneDockProject] = try await client.send(APIRequest( + method: .get, path: prefix + "/projects", + queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID))] + )) + guard Set(projects.map(\.id)).count == projects.count else { + throw APIError.decodeFailed("套餐 ID 重复") + } + return projects + } + + /// 由后端生成完整小程序收款码;客户端不自行拼接金额、备注或身份参数。 + func payCode(scenicID: Int, projectID: Int, price: String? = nil) async throws -> DroneDockPayCode { + try validateScenic(scenicID) + guard projectID > 0 else { throw APIError.networkFailed("请选择航拍套餐") } + let normalized: String? + if let price { + guard let value = DroneDockPriceValidator.normalizedPrice(price) else { + throw APIError.networkFailed(DroneDockPriceValidator.validationMessage(for: price)!) + } + normalized = value + } else { normalized = nil } + return try await client.send(APIRequest( + method: .post, path: prefix + "/pay-code", + body: PayCodeBody(scenicID: scenicID, projectID: projectID, price: normalized) + )) + } + + /// 按当前身份读取实际收款记录;不把查询结果解释成当前码已支付。 + func receipts(scenicID: Int, projectID: Int? = nil, page: Int = 1) async throws -> DroneDockReceiptsResponse { + try validateScenic(scenicID) + guard page > 0, projectID.map({ $0 > 0 }) ?? true else { + throw APIError.networkFailed("收款记录查询参数无效") + } + var query = [URLQueryItem(name: "scenic_id", value: String(scenicID)), + URLQueryItem(name: "page", value: String(page))] + if let projectID { query.append(URLQueryItem(name: "project_id", value: String(projectID))) } + return try await client.send(APIRequest(method: .get, path: prefix + "/receipts", queryItems: query)) + } + + private func validateScenic(_ scenicID: Int) throws { + guard scenicID > 0 else { throw APIError.networkFailed("请先选择景区") } + } + + /// 报价请求体;nil 价格通过 Encodable 省略,不发送空串或 null。 + private struct PayCodeBody: Encodable { + let scenicID: Int + let projectID: Int + let price: String? + + /// 业务接口请求字段。 + enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", projectID = "project_id", price + } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockPlaneStatusAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockPlaneStatusAPI.swift new file mode 100644 index 0000000..52f6261 --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockPlaneStatusAPI.swift @@ -0,0 +1,32 @@ +import Foundation + +/// 准备页的独立无人机状态只读服务,不读取定位或创建飞行任务。 +protocol DroneDockPlaneStatusServing: Sendable { + /// 读取当前景区可展示的设备状态与实时电量。 + @MainActor + func planeStatus(scenicID: Int) async throws -> DroneDockPlaneStatusResponse +} + +/// 朱工 plane-status 接口适配,复用统一 Token 与业务错误处理。 +@MainActor +final class DroneDockPlaneStatusAPI: DroneDockPlaneStatusServing { + private let client: APIClient + + /// 注入统一客户端,便于替换网络测试依赖。 + init(client: APIClient) { self.client = client } + + /// 明确请求实时电量,返回景区不一致时拒绝将状态回填当前页面。 + func planeStatus(scenicID: Int) async throws -> DroneDockPlaneStatusResponse { + guard scenicID > 0 else { throw APIError.networkFailed("请先选择景区") } + let response: DroneDockPlaneStatusResponse = try await client.send(APIRequest( + method: .get, + path: "/api/app/airport/plane-status", + queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID)), + URLQueryItem(name: "live_battery", value: "1")] + )) + guard response.scenicID == scenicID else { + throw APIError.decodeFailed("无人机状态与当前景区不一致,请刷新重试") + } + return response + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockPreparationAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockPreparationAPI.swift new file mode 100644 index 0000000..c0d30ab --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockPreparationAPI.swift @@ -0,0 +1,37 @@ +import Foundation + +/// 拍摄准备页只读数据源,不创建订单任务或发送飞行控制指令。 +protocol DroneDockPreparationServing: Sendable { + /// 读取该订单实际购买的套餐、点位和航线,不使用当前上架项目替代购买快照。 + @MainActor + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse +} + +/// 张工购买快照的只读接口,登录凭证由统一客户端注入。 +@MainActor +final class DroneDockPreparationAPI: DroneDockPreparationServing { + private let client: APIClient + + /// 注入统一客户端,正式页面和测试使用相同请求构造。 + init(client: APIClient) { self.client = client } + + /// 订单号必传;响应必须属于请求的订单与项目,避免展示其他购买范围。 + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse { + let trimmedNumber = orderNumber.trimmingCharacters(in: .whitespacesAndNewlines) + guard scenicID > 0, projectID > 0, !trimmedNumber.isEmpty, + trimmedNumber == orderNumber, orderNumber.count <= 128 else { + throw APIError.networkFailed("缺少有效景区、项目或订单信息,请返回工作台重新进入") + } + let response: DroneDockProjectInfoResponse = try await client.send(APIRequest( + method: .get, path: "/api/yf-handset-app/photog/multi-plane/project-info", + queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID)), + URLQueryItem(name: "project_id", value: String(projectID)), + URLQueryItem(name: "order_number", value: orderNumber)] + )) + guard response.order.orderNumber == orderNumber, response.order.projectID == projectID else { + throw APIError.decodeFailed("套餐信息与当前订单或项目不一致,请刷新重试") + } + return response + } + +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift new file mode 100644 index 0000000..e42a1ee --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift @@ -0,0 +1,60 @@ +import Foundation + +/// 对已创建的订单飞行任务请求召唤,复用该任务及服务端锁定的飞机。 +protocol DroneDockShootServing: Sendable { + /// 只提交已有任务 ID;调用方负责防止重复提交及核对不确定结果。 + @MainActor + func shoot(taskID: Int) async throws -> DroneDockShootResponse +} + +/// 为已有失败任务提交重新召唤,不创建新任务或更换锁定飞机。 +protocol DroneDockResummonServing: Sendable { + /// 发送一次 restart=true 的召唤请求,调用方负责防重及受理后的状态核对。 + @MainActor + func resummon(taskID: Int) async throws -> DroneDockShootResponse +} + +/// 朱工 shoot 接口适配,业务成功仅表示接口受理结果,不推断飞机已经到达。 +@MainActor +final class DroneDockShootAPI: DroneDockShootServing, DroneDockResummonServing { + private let client: APIClient + + /// 注入统一网络客户端,沿用登录凭证、HTTP 与业务码处理。 + init(client: APIClient) { self.client = client } + + /// 仅发送一次召唤 POST;不创建任务、不重试、不修改任务已选航线。 + func shoot(taskID: Int) async throws -> DroneDockShootResponse { + try await send(taskID: taskID, restart: false) + } + + /// 复用同一订单飞行任务请求重启;Release 真实入口及隔离模拟入口按策略注入。 + func resummon(taskID: Int) async throws -> DroneDockShootResponse { + try await send(taskID: taskID, restart: true) + } + + private func send(taskID: Int, restart: Bool) async throws -> DroneDockShootResponse { + try Task.checkCancellation() + guard taskID > 0 else { throw APIError.networkFailed("缺少有效拍摄任务 ID,请先创建任务") } + do { + return try await client.send(APIRequest( + method: .post, + path: "/api/app/airport/shoot", + body: ShootBody(taskID: taskID, restart: restart) + )) + } catch APIError.emptyData { + // 统一客户端仅在 HTTP 和业务码均成功后抛 emptyData;此接口尚未约定成功 data 结构。 + return DroneDockShootResponse(dataJSON: nil) + } + } + + /// 仅发送任务身份和重启标记,完全省略 plane_id 与航线覆盖字段。 + private struct ShootBody: Encodable { + let taskID: Int + let restart: Bool + + /// 朱工已建任务召唤参数映射。 + private enum CodingKeys: String, CodingKey { + case taskID = "id", restart + } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift new file mode 100644 index 0000000..b08a1aa --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift @@ -0,0 +1,29 @@ +import Foundation + +/// 朱工拍摄任务信息只读服务,读取张工已创建的任务,不发送飞行控制。 +protocol DroneDockShootingServing: Sendable { + /// 按已有任务 ID 获取拍摄页信息;读取失败后可对同一 ID 再次读取。 + @MainActor + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse +} + +/// shooting GET 接口适配,鉴权及业务码由统一客户端处理。 +@MainActor +final class DroneDockShootingAPI: DroneDockShootingServing { + private let client: APIClient + + /// 注入共享网络客户端,便于验证请求只包含已创建任务的查询参数。 + init(client: APIClient) { self.client = client } + + /// 仅发送一次无请求体的 GET,不创建任务、不召唤、不调用 start-shoot。 + func shooting(taskID: Int, liveBattery: Bool = true) async throws -> DroneDockShootingResponse { + try Task.checkCancellation() + guard taskID > 0 else { throw APIError.networkFailed("缺少有效拍摄任务 ID,请先创建任务") } + return try await client.send(APIRequest( + method: .get, + path: "/api/app/airport/shooting", + queryItems: [URLQueryItem(name: "id", value: String(taskID)), + URLQueryItem(name: "live_battery", value: liveBattery ? "1" : "0")] + )) + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockSocketTokenAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockSocketTokenAPI.swift new file mode 100644 index 0000000..642e92a --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockSocketTokenAPI.swift @@ -0,0 +1,33 @@ +import Foundation + +/// 拍摄任务订阅票据,与 App 登录 token 分开管理。 +struct DroneDockSocketTicket: Decodable, Sendable { + /// 仅在 310 业务订阅中传递,不放入 WebSocket 握手 Header。 + let socketToken: String + /// 后端票据有效期;每次重新连接均重新取票,不复用过期票据。 + let expireSeconds: Int? + + private enum CodingKeys: String, CodingKey { + case socketToken = "socket_token", expireSeconds = "expire_seconds" + } +} + +/// 隔离票据获取,模拟测试无需登录或连接真实服务器。 +protocol DroneDockSocketTicketServing: Sendable { + /// 使用当前 App 登录身份获取只读订阅票据。 + @MainActor func socketTicket() async throws -> DroneDockSocketTicket +} + +/// 复用公共 socket-token 接口的鉴权及请求日志。 +@MainActor +final class DroneDockSocketTokenAPI: DroneDockSocketTicketServing { + private let client: APIClient + + /// 注入与 shooting 相同环境的客户端。 + init(client: APIClient) { self.client = client } + + /// 不调用任何创建、飞控或图传接口。 + func socketTicket() async throws -> DroneDockSocketTicket { + try await client.send(APIRequest(method: .get, path: "/api/app/socket-token")) + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockStartShootAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockStartShootAPI.swift new file mode 100644 index 0000000..087298c --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockStartShootAPI.swift @@ -0,0 +1,39 @@ +import Foundation + +/// 朱工开始拍摄服务,只使用已创建并召唤的订单飞行任务身份。 +protocol DroneDockStartShooting: Sendable { + /// 提交一次开拍请求;调用方负责校验执行门禁并阻止重复提交。 + @MainActor + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse +} + +/// start-shoot 合同适配;两种构建共用任务身份校验和单次提交规则。 +@MainActor +final class DroneDockStartShootAPI: DroneDockStartShooting { + private let client: APIClient + + /// 注入统一客户端,测试使用不会联网的本地模拟传输。 + init(client: APIClient) { self.client = client } + + /// 仅 POST 任务 ID,不附带飞机、航线或未约定的模拟参数,也不自动重试。 + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + try Task.checkCancellation() + guard taskID > 0 else { throw APIError.networkFailed("缺少有效拍摄任务 ID,请返回任务页确认") } + let response: DroneDockStartShootResponse = try await client.send(APIRequest( + method: .post, path: "/api/app/airport/start-shoot", body: StartShootBody(taskID: taskID) + )) + guard let returnedID = response.orderFlightTaskID, returnedID > 0, returnedID == taskID, + response.orderFlightTask?.id == nil || response.orderFlightTask?.id == taskID else { + throw APIError.decodeFailed("开始拍摄回执的任务身份缺失或不一致,请核对原任务状态") + } + return response + } + + /// 开拍只提交订单飞行任务身份,不使用航线任务 ID。 + private struct StartShootBody: Encodable { + let taskID: Int + + /// 朱工开拍请求的 JSON 字段。 + private enum CodingKeys: String, CodingKey { case taskID = "id" } + } +} diff --git a/suixinkan/Features/DroneDock/API/DroneDockTaskCreationAPI.swift b/suixinkan/Features/DroneDock/API/DroneDockTaskCreationAPI.swift new file mode 100644 index 0000000..79acbaa --- /dev/null +++ b/suixinkan/Features/DroneDock/API/DroneDockTaskCreationAPI.swift @@ -0,0 +1,50 @@ +import Foundation + +/// 创建张工订单待飞任务,不派机、不调用朱工召唤或开始拍摄接口。 +protocol DroneDockTaskCreating: Sendable { + /// 提交当前订单购买范围内的点位与航线,返回任务身份及订单摘要。 + @MainActor + func createTask(scenicID: Int, orderNumber: String, spotID: Int, airLineID: Int) async throws -> DroneDockCreatedTask +} + +/// 张工 tasks/create 接口,登录凭证和业务码由统一客户端处理。 +@MainActor +final class DroneDockTaskCreationAPI: DroneDockTaskCreating { + private let client: APIClient + + /// 注入共享网络客户端,测试可替换传输层。 + init(client: APIClient) { self.client = client } + + /// 单次调用仅发一次创建请求;响应身份异常交由页面核对,不自动重试写入。 + func createTask(scenicID: Int, orderNumber: String, spotID: Int, airLineID: Int) async throws -> DroneDockCreatedTask { + try Task.checkCancellation() + guard scenicID > 0, spotID > 0, airLineID > 0, !orderNumber.isEmpty, + orderNumber.count <= 128, + orderNumber == orderNumber.trimmingCharacters(in: .whitespacesAndNewlines), + orderNumber.rangeOfCharacter(from: .controlCharacters) == nil else { + throw APIError.networkFailed("缺少有效景区、订单、拍摄点或航线,请刷新准备信息") + } + let response: DroneDockCreatedTask = try await client.send(APIRequest( + method: .post, path: "/api/yf-handset-app/photog/multi-plane/tasks/create", + body: CreateTaskBody(scenicID: scenicID, orderNumber: orderNumber, spotID: spotID, airLineID: airLineID) + )) + guard response.order.orderNumber == orderNumber else { + throw APIError.decodeFailed("创建任务返回的订单与当前订单不一致,请先核对任务结果") + } + return response + } + + /// 创建仅提交四项身份,不发送选机、位置或任何起飞参数。 + private struct CreateTaskBody: Encodable { + let scenicID: Int + let orderNumber: String + let spotID: Int + let airLineID: Int + + /// 张工创建待飞任务参数名。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", orderNumber = "order_number" + case spotID = "scenic_spot_id", airLineID = "air_line_id" + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDeliveryModels.swift b/suixinkan/Features/DroneDock/Models/DroneDeliveryModels.swift new file mode 100644 index 0000000..96f2659 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDeliveryModels.swift @@ -0,0 +1,253 @@ +import Foundation + +/// 演示视频选择器中的本地示例,不读取设备相册。 +struct DroneDeliveryVideo: Hashable, Sendable { + /// 本地示例的稳定标识,用于同一点位成功上传去重。 + let id: String + /// 选择器中的视频名称。 + let title: String + /// 队列展示的文件名。 + let fileName: String + /// 本地封面图片名称。 + let previewAssetName: String + /// 可播放的本地示例文件,缺失时为 nil。 + let previewURL: URL? + /// 真实本地示例时长,不冒充实际拍摄时长。 + let durationText: String + /// 演示文件大小展示值。 + let sizeText: String + + /// 映射到已有只读预览页面使用的素材快照。 + var previewMaterial: DroneMaterial { + DroneMaterial(id: id, title: title, kind: .video, previewAssetName: previewAssetName, + previewURL: previewURL, durationText: durationText) + } +} + +/// 成片上传的单文件状态,成功项永远不由重试或继续重新上传。 +enum DroneDeliveryUploadState: Hashable, Sendable { + case uploading(progress: Double), paused, failed(message: String), completed + + /// 列表状态文字,全部结果都属于本地演示。 + var title: String { + switch self { + case .uploading: "演示上传中" + case .paused: "上传已暂停" + case .failed: "演示上传失败" + case .completed: "演示交付完成" + } + } + + /// 是否为明确成功,不能从百分比或暂停推断。 + var isCompleted: Bool { self == .completed } + /// 是否为明确失败,生命周期暂停不属于失败。 + var isFailed: Bool { + if case .failed = self { return true } + return false + } +} + +/// 单个上传任务保留稳定文件身份,执行令牌则归批次管理。 +struct DroneDeliveryUploadItem: Hashable, Sendable { + /// 本次新增作品的稳定身份。 + let id: String + /// 开始上传时冻结的视频快照。 + let video: DroneDeliveryVideo + /// 最新明确回执或暂停状态。 + var state: DroneDeliveryUploadState +} + +/// 上传暂停的明确生命周期入口。 +enum DroneDeliveryPauseReason: Hashable, Sendable { + case background, locked, leavingPage +} + +/// 一批固定点位、固定视频的上传任务。 +struct DroneDeliveryUploadBatch: Hashable, Sendable { + /// 执行令牌,暂停、继续与重试都会更换以拒绝旧回执。 + let id: UUID + /// 本批作品归属的点位,不随后续浏览改变。 + let pointID: String + /// 批次创建时的点位名称。 + let pointName: String + /// 固定的视频队列与逐项状态。 + var items: [DroneDeliveryUploadItem] + /// 是否等待用户手动继续。 + var isPaused: Bool + /// 最近一次暂停原因。 + var pauseReason: DroneDeliveryPauseReason? +} + +/// 上传底栏使用的批次阶段。 +enum DroneDeliveryUploadPhase: Hashable, Sendable { + case idle, uploading, paused, partialFailure, completed +} + +/// 可由本地演示驱动注入的明确回执,不包含真实上传服务。 +enum DroneDeliveryUploadEvent: Hashable, Sendable { + case progress(Double), succeeded, failed(message: String) +} + +/// 本机演示上传成功的作品,与原素材、拍摄记录和次数独立。 +struct DroneDeliveryWork: Hashable, Sendable { + /// 作品稳定身份,对同一上传成功回执去重。 + let id: String + /// 原本地示例视频标识。 + let sourceVideoID: String + /// 作品归属点位。 + let pointID: String + /// 上传时的点位名称。 + let pointName: String + /// 作品展示名称。 + let title: String + /// 本地示例文件名。 + let fileName: String + /// 本地封面资源。 + let previewAssetName: String + /// 本地示例视频文件,缺失时只显示封面。 + let previewURL: URL? + /// 本地示例时长。 + let durationText: String + /// 演示文件大小。 + let sizeText: String + /// 本机演示成功的时间,不作为真实云端凭证。 + let deliveredAt: Date + /// 当前始终为 true,避免将演示作品冒充真实交付。 + let isSimulation: Bool + + /// 通过既有素材预览组件打开本地示例。 + var previewMaterial: DroneMaterial { + DroneMaterial(id: id, title: title, kind: .video, previewAssetName: previewAssetName, + previewURL: previewURL, durationText: durationText) + } +} + +/// 整单清单按点位汇总,包含各次成功上传的作品。 +struct DroneDeliveryWorkGroup: Hashable, Sendable { + /// 分组稳定身份。 + var id: String { pointID } + /// 所属点位。 + let pointID: String + /// 点位展示名称。 + let pointName: String + /// 本点全部成功作品或某次确认快照中的作品。 + let works: [DroneDeliveryWork] +} + +/// 商家核对和游客演示确认的不同阶段,不由刷新推断推进。 +enum DroneDeliveryConfirmationPhase: Hashable, Sendable { + case review, awaitingConfirmation, viewing, feedback, confirmed + + /// 确认区域展示名称。 + var title: String { + switch self { + case .review: "请先核对整单交付" + case .awaitingConfirmation: "待游客确认 · 演示" + case .viewing: "演示查看中" + case .feedback: "成片问题待处理 · 演示" + case .confirmed: "游客已确认 · 演示" + } + } +} + +/// 原型中的四类成片问题,反馈不等于确认收货。 +enum DroneDeliveryFeedbackKind: String, CaseIterable, Hashable, Sendable { + case missingVideo, unplayable, quality, other + + /// 问题选项标题。 + var title: String { + switch self { + case .missingVideo: "视频缺失" + case .unplayable: "无法播放" + case .quality: "成片效果有异议" + case .other: "其他问题" + } + } +} + +/// 本机演示反馈记录,不发送真实消息。 +struct DroneDeliveryFeedback: Hashable, Sendable { + /// 选择的问题类型。 + let kind: DroneDeliveryFeedbackKind + /// 可选补充说明。 + let note: String + /// 本机演示提交时间。 + let createdAt: Date +} + +/// 某一交付版本的确认会话,作品清单一经创建便不可替换。 +struct DroneDeliveryConfirmationSession: Hashable, Sendable { + /// 单次确认令牌,其他订单和旧版本回执不能复用。 + let id: UUID + /// 确认创建时的整单作品版本。 + let revision: Int + /// 创建会话时的订单身份快照。 + let orderID: String + /// 可见订单号快照。 + let orderNumber: String + /// 创建时游客脱敏名称,不随后续资料改变。 + let visitorName: String + /// 发起整单核对的工作人员名称快照。 + let operatorName: String + /// 创建会话时的景区名称。 + let scenicName: String + /// 创建时全部作品的值类型快照,追加作品不改变此清单。 + let works: [DroneDeliveryWork] + /// 商家完成核对并创建会话的本机时间。 + let createdAt: Date + /// 只有明确 Debug 事件才推进状态。 + var status: DroneDeliveryConfirmationPhase + /// 明确模拟主动确认回执的时间。 + var confirmedAt: Date? + /// 最近一次演示问题反馈。 + var feedback: DroneDeliveryFeedback? + /// 本次演示查看中是否主动勾选已核对全部作品。 + var visitorAcknowledged: Bool + + /// 供本机占位码使用的演示文本,不是网页链接或真实收货凭据。 + var demoCodeText: String { "SUIXINKAN-DEMO-\(id.uuidString)" } +} + +/// 游客状态仅由显式 Debug 模拟回执产生,不实现游客原生网页。 +enum DroneDeliveryConfirmationEvent: Hashable, Sendable { + case viewing, confirmed, feedback(kind: DroneDeliveryFeedbackKind, note: String) +} + +/// 订单交付共享内存状态,景区及工作人员范围由缓存键隔离。 +struct DroneDeliveryLibraryState { + /// 整单成功作品,各批次追加而不互相覆盖。 + var works: [DroneDeliveryWork] = [] + /// 每次新增成功作品递增,避免旧核对覆盖新清单。 + var revision: Int = 0 + /// 当前点位上传队列。 + var batch: DroneDeliveryUploadBatch? + /// 商家明确核对的版本,新作品追加时失效。 + var merchantReviewedRevision: Int? + /// 所有历史确认会话,旧清单和已确认记录保留。 + var sessions: [DroneDeliveryConfirmationSession] = [] + /// 当前版本的确认会话身份,新作品追加时清空。 + var currentSessionID: UUID? +} + +#if DEBUG +/// 交付流程的本地显式验收场景。 +enum DroneDeliveryScenario: String, CaseIterable, Hashable { + case empty, ready, uploading, paused, partialFailure, completed, awaitingConfirmation, viewing, feedback, confirmed + + /// 场景菜单名称。 + var title: String { + switch self { + case .empty: "暂无交付作品" + case .ready: "点位与演示视频选择" + case .uploading: "成片上传中" + case .paused: "上传暂停待继续" + case .partialFailure: "部分上传失败" + case .completed: "本批演示交付完成" + case .awaitingConfirmation: "整单待游客确认" + case .viewing: "演示查看中" + case .feedback: "成片问题反馈" + case .confirmed: "已确认的演示记录" + } + } +} +#endif diff --git a/suixinkan/Features/DroneDock/Models/DroneDockCommandModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockCommandModels.swift new file mode 100644 index 0000000..2d1be22 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockCommandModels.swift @@ -0,0 +1,100 @@ +import Foundation + +/// 朱工 command 接口明确允许的四类安全指令,不接受服务端未知动作直接透传。 +enum DroneDockSafetyCommand: String, CaseIterable, Sendable { + /// 暂停航线并悬停待命。 + case pause = "flighttask_pause" + /// 恢复已暂停的航线。 + case resume = "flighttask_recovery" + /// 立即返航;中断拍摄结果,回巢前仍占用设备。 + case returnHome = "return_home" + /// 取消返航,不代表已恢复或重新创建原拍摄任务。 + case cancelReturn = "return_home_cancel" +} + +/// 指令受理回执;仅保留后端返回的身份、读数与状态,不推断设备已完成动作。 +struct DroneDockCommandResponse: Decodable, Equatable, Sendable { + /// 明确受理标记,仅受理不表示设备已执行。 + let accepted: Bool? + /// 回执探测时是否确认设备状态;页面最终仍读取完整 shooting/WS。 + let deviceConfirmed: Bool? + /// 本次指令的服务端唯一标识。 + let commandID: String? + /// 回显本次点击的幂等键,提供时必须与请求一致。 + let clientRequestID: String? + /// 回执顶层的指令进度;完整任务快照位于 flight_control 内。 + let pendingCommand: DroneDockCommandProgress? + /// 受理提示原文,用于诊断,不作为展示状态。 + let hint: String? + /// 回执所属批次,必须与提交时一致。 + let executionBatch: Int64? + /// 回执对应快照版本,用作后续状态核对的最低版本。 + let stateVersion: Int64? + /// 设备身份在提供时必须匹配任务锁定设备。 + let planeID: Int? + /// 回执中的设备状态不替代完整任务快照。 + let flightControl: DroneDockFlightControl? + /// 文档要求回显的订单飞行任务 ID。 + let orderFlightTaskID: Int? + /// 本次回显的指令码,API 核验其与请求一致。 + let command: String? + /// 任务实际锁定的机场标识,客户端不提交或覆盖它。 + let airportSN: String? + /// 司空状态允许任意 JSON 类型;null 与缺失都不构成执行成功证据。 + let djiStatus: DroneDockHomeJSONValue? + /// 非实时采集的六项读数,不替代 shooting 完整快照。 + let metrics: [DroneDockHomeMetric] + /// 完整 data 格式化 JSON,供本地模拟联调查看未知字段与原始类型。 + let dataJSON: String + + /// 朱工指令回执字段映射。 + private enum CodingKeys: String, CodingKey { + case accepted, deviceConfirmed = "device_confirmed", hint, executionBatch = "execution_batch" + case commandID = "command_id", clientRequestID = "client_request_id", pendingCommand = "pending_command" + case stateVersion = "state_version", planeID = "plane_id", flightControl = "flight_control" + case orderFlightTaskID = "order_flight_task_id", command, airportSN = "airport_sn" + case djiStatus = "dji_status", metrics + } + + /// 不补造身份、状态或读数,完整 JSON 仍保留实际出现的 null 字段。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + accepted = try container.decodeIfPresent(Bool.self, forKey: .accepted) + deviceConfirmed = try container.decodeIfPresent(Bool.self, forKey: .deviceConfirmed) + commandID = try container.decodeIfPresent(String.self, forKey: .commandID) + clientRequestID = try container.decodeIfPresent(String.self, forKey: .clientRequestID) + pendingCommand = try container.decodeIfPresent(DroneDockCommandProgress.self, forKey: .pendingCommand) + hint = try container.decodeIfPresent(String.self, forKey: .hint) + executionBatch = try container.decodeIfPresent(Int64.self, forKey: .executionBatch) + stateVersion = try container.decodeIfPresent(Int64.self, forKey: .stateVersion) + planeID = try container.decodeIfPresent(Int.self, forKey: .planeID) + flightControl = try container.decodeIfPresent(DroneDockFlightControl.self, forKey: .flightControl) + orderFlightTaskID = try container.decodeIfPresent(Int.self, forKey: .orderFlightTaskID) + command = try container.decodeIfPresent(String.self, forKey: .command) + airportSN = try container.decodeIfPresent(String.self, forKey: .airportSN) + djiStatus = try container.decodeIfPresent(DroneDockHomeJSONValue.self, forKey: .djiStatus) + metrics = try container.decodeIfPresent([DroneDockHomeMetric].self, forKey: .metrics) ?? [] + let raw = try DroneDockHomeJSONValue(from: decoder) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] + dataJSON = String(decoding: try encoder.encode(DroneDockCommandJSONSnapshot(value: raw)), as: UTF8.self) + } +} + +/// 将现有 JSON 值完整格式化,不更改指令回执的原始值与结构。 +private struct DroneDockCommandJSONSnapshot: Encodable { + let value: DroneDockHomeJSONValue + + /// 保留字符串、数字、布尔、null 和嵌套对象,不添加业务成功推断。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch value { + case .object(let object): try container.encode(object.mapValues { DroneDockCommandJSONSnapshot(value: $0) }) + case .array(let array): try container.encode(array.map { DroneDockCommandJSONSnapshot(value: $0) }) + case .string(let text): try container.encode(text) + case .number(let number): try container.encode(number) + case .bool(let flag): try container.encode(flag) + case .null: try container.encodeNil() + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockCommandOperation.swift b/suixinkan/Features/DroneDock/Models/DroneDockCommandOperation.swift new file mode 100644 index 0000000..52947e3 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockCommandOperation.swift @@ -0,0 +1,28 @@ +import Foundation + +/// 单次点击的本地生命周期;等待只作用于对应按钮,不充当页面业务阶段。 +enum DroneDockCommandOperationPhase: Sendable { + case queued, sending, pending, unknown, confirmed, finished +} + +/// 同任务批次内的幂等指令上下文;设备身份和提交版本防止迟到响应恢复旧锁。 +struct DroneDockCommandOperation: Sendable { + let requestID: String + let command: DroneDockSafetyCommand + let batch: Int64 + let sequence: Int + let generation: Int + let submittedVersion: Int64 + let planeID: Int + let airportSN: String? + let resumePhase: String? + var commandID: String? + var minimumVersion: Int64? + var phase: DroneDockCommandOperationPhase = .queued + var error: String? + + /// 未获得明确结果时禁止重复提交同一动作,其他安全动作独立授权。 + var isWaiting: Bool { phase != .finished } + /// 已确认但尚未收到更新快照时停止动画,仍防止按旧权限重复点击同一动作。 + var isLoading: Bool { isWaiting && phase != .confirmed && phase != .unknown } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockConfirmationModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockConfirmationModels.swift new file mode 100644 index 0000000..388a787 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockConfirmationModels.swift @@ -0,0 +1,54 @@ +import Foundation + +/// 订单确认邀请结果;图片是微信小程序码,不能再次编码为普通二维码。 +struct DroneDockConfirmationCode: Decodable, Equatable, Sendable { + /// 完整订单号,用于核对确认码的归属。 + let orderNumber: String + /// 生成成功仅表示等待游客确认,不表示订单已经完成。 + let confirmStatus: Int + /// 后端原样返回的小程序码图片地址。 + let confirmURL: String + private let validatedImageURL: URL + + /// 已校验的 HTTP(S) 图片地址,可直接交给图片加载组件。 + var imageURL: URL { validatedImageURL } + + /// 张工生成确认码的响应字段。 + private enum CodingKeys: String, CodingKey { + case orderNumber = "order_number", confirmStatus = "confirm_status", confirmURL = "confirm_url" + } + + /// 必要字段缺失、错误订单身份或不可展示地址均保留为失败,避免伪造确认码。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderNumber = try container.decode(String.self, forKey: .orderNumber) + guard !orderNumber.isEmpty, orderNumber.count <= 128, + orderNumber == orderNumber.trimmingCharacters(in: .whitespacesAndNewlines), + orderNumber.rangeOfCharacter(from: .controlCharacters) == nil else { + throw DecodingError.dataCorruptedError(forKey: .orderNumber, in: container, + debugDescription: "确认码缺少有效订单号") + } + if let value = try? container.decode(Int.self, forKey: .confirmStatus) { confirmStatus = value } + else if let text = try? container.decode(String.self, forKey: .confirmStatus), let value = Int(text) { confirmStatus = value } + else { + throw DecodingError.dataCorruptedError(forKey: .confirmStatus, in: container, + debugDescription: "确认码缺少有效确认状态") + } + guard confirmStatus == 1 else { + throw DecodingError.dataCorruptedError(forKey: .confirmStatus, in: container, + debugDescription: "确认码未处于待游客确认状态") + } + confirmURL = try container.decode(String.self, forKey: .confirmURL) + guard confirmURL.count <= 2048, + confirmURL.rangeOfCharacter(from: .whitespacesAndNewlines.union(.controlCharacters)) == nil, + let components = URLComponents(string: confirmURL), + ["http", "https"].contains(components.scheme?.lowercased() ?? ""), + let host = components.host, !host.isEmpty, + components.user == nil, components.password == nil, + let url = components.url else { + throw DecodingError.dataCorruptedError(forKey: .confirmURL, in: container, + debugDescription: "确认码图片地址无效") + } + validatedImageURL = url + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockDeliveryModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockDeliveryModels.swift new file mode 100644 index 0000000..e7c0444 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockDeliveryModels.swift @@ -0,0 +1,112 @@ +import Foundation + +/// 用户本次选择的一段本地视频;标识用于隔离重新选择后的上传回调。 +struct DroneDockDeliveryVideo: Equatable, Sendable { + /// 每次选择产生独立身份,即使来源文件相同也不复用旧上传状态。 + let id: UUID + /// App 已复制并持有的本地文件地址。 + let url: URL + /// 提交给成片接口的文件名称。 + let fileName: String + /// 选择时读取的实际字节数。 + let fileSize: Int + + /// 建立独立的待上传视频,不在模型内读取文件内容。 + init(url: URL, fileName: String, fileSize: Int) { + id = UUID() + self.url = url + self.fileName = fileName + self.fileSize = fileSize + } +} + +/// 张工保存成片的结果,只有与选中任务一致的有效视频才视为保存成功。 +struct DroneDockSavedFilm: Decodable, Equatable, Sendable { + /// 成片保存到的订单飞行任务 ID。 + let taskID: Int + /// 服务端读取文件后生成的成片与封面信息。 + let film: DroneDockMaterialFilm + + /// 成片保存响应字段。 + private enum CodingKeys: String, CodingKey { case taskID = "task_id", film } + + /// 兼容整数字符串身份,拒绝空成片、跨任务成片及无效视频地址。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + if let value = try? container.decode(Int.self, forKey: .taskID) { taskID = value } + else if let text = try? container.decode(String.self, forKey: .taskID), let value = Int(text) { taskID = value } + else { + throw DecodingError.dataCorruptedError(forKey: .taskID, in: container, debugDescription: "保存成片缺少有效任务 ID") + } + film = try container.decode(DroneDockMaterialFilm.self, forKey: .film) + guard taskID > 0, film.taskID == nil || film.taskID == taskID, + let fileURL = film.fileURL, DroneDockFilmPolicy.remoteURL(fileURL) != nil else { + throw DecodingError.dataCorruptedError(forKey: .film, in: container, debugDescription: "保存成片返回的任务或视频地址无效") + } + } +} + +/// 成片保存和 OSS 上传共用的格式规则,避免把原素材类型值当成上传 MIME。 +enum DroneDockFilmPolicy { + /// 沿用 App 通用上传的单文件大小上限,流式上传不整体载入内存。 + static let maximumFileSize = 2_048 * 1_024 * 1_024 + private static let mimeTypes = ["mp4": "video/mp4", "mov": "video/quicktime", "avi": "video/x-msvideo", + "mkv": "video/x-matroska", "flv": "video/x-flv", "wmv": "video/x-ms-wmv", "webm": "video/webm"] + + /// 校验本地视频没有丢失或变化,返回明确的 video/* MIME。 + static func validate(video: DroneDockDeliveryVideo) throws -> String { + guard video.url.isFileURL else { throw DroneDockFilmError.invalidLocalFile } + let type = try contentType(fileName: video.fileName) + // URL.resourceValues 会缓存大小;上传前复查必须重新读取文件系统属性。 + let attributes = try FileManager.default.attributesOfItem(atPath: video.url.path) + guard attributes[.type] as? FileAttributeType == .typeRegular, + let size = (attributes[.size] as? NSNumber)?.intValue else { throw DroneDockFilmError.invalidLocalFile } + guard size > 0 else { throw DroneDockFilmError.emptyFile } + guard size <= maximumFileSize else { throw DroneDockFilmError.fileTooLarge } + guard size == video.fileSize else { throw DroneDockFilmError.fileChanged } + return type + } + + /// 文件名保留用户可读内容,禁止目录和控制字符进入对象键或请求体。 + static func contentType(fileName: String) throws -> String { + guard !fileName.isEmpty, fileName.count <= 255, + fileName == fileName.trimmingCharacters(in: .whitespacesAndNewlines), + fileName.rangeOfCharacter(from: .controlCharacters) == nil, + !fileName.contains("/"), !fileName.contains("\\") else { throw DroneDockFilmError.invalidFileName } + guard let type = mimeTypes[URL(fileURLWithPath: fileName).pathExtension.lowercased()] else { + throw DroneDockFilmError.unsupportedFileType + } + return type + } + + /// 提交无查询参数的原始 OSS 视频地址,不接受本地地址或临时签名链接。 + static func remoteURL(_ value: String) -> URL? { + guard value.count <= 2048, value.rangeOfCharacter(from: .whitespacesAndNewlines) == nil, + let components = URLComponents(string: value), + ["http", "https"].contains(components.scheme?.lowercased() ?? ""), + let host = components.host, !host.isEmpty, + components.user == nil, components.password == nil, + components.query == nil, components.fragment == nil, + let url = components.url, mimeTypes[url.pathExtension.lowercased()] != nil else { return nil } + return url + } +} + +/// 成片文件和上传配置错误,不含 STS 密钥或访问凭证。 +enum DroneDockFilmError: LocalizedError, Equatable { + case invalidLocalFile, emptyFile, fileTooLarge, fileChanged, invalidFileName, unsupportedFileType, invalidConfiguration, invalidScope + + /// 向页面提供可操作的错误说明。 + var errorDescription: String? { + switch self { + case .invalidLocalFile: "视频文件不可用,请重新选择" + case .emptyFile: "视频文件为空,请重新选择" + case .fileTooLarge: "视频超过 2GB,请压缩后重试" + case .fileChanged: "视频文件已变化,请重新选择" + case .invalidFileName: "视频文件名称无效或超过 255 个字符" + case .unsupportedFileType: "请选择 MP4、MOV、AVI、MKV、FLV、WMV 或 WebM 视频" + case .invalidConfiguration: "上传配置暂不可用,请重试" + case .invalidScope: "缺少有效景区或拍摄任务,请重新进入" + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockFlightControl.swift b/suixinkan/Features/DroneDock/Models/DroneDockFlightControl.swift new file mode 100644 index 0000000..c3dd63c --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockFlightControl.swift @@ -0,0 +1,87 @@ +import Foundation + +/// 设备执行态独立于拍摄结果;未知或不一致状态不提供控制权限。 +enum DroneDockFlightControlState: String, Sendable { + case starting, executing, paused, returning, returned, unknown +} + +/// shooting/WS 的批次设备状态;原值保留以兼容未来枚举,但未知值不会开放操作。 +struct DroneDockFlightControl: Decodable, Equatable, Sendable { + /// 后端原始执行态。 + let state: String? + /// 设备遥测确认是否仍在飞行;未知保持原值,不单独覆盖后端操作许可。 + let isAirborne: Bool? + /// arrival_wait 是自动到点等待,manual 才是已确认的手动暂停。 + let pauseReason: String? + /// 司空原始航线态仅用于联调对照,不能直接代替手动暂停判定。 + let djiTaskStatus: String? + /// 继续任务将恢复的业务阶段,返航暂停后仍恢复返航。 + let resumePhase: String? + /// manual、normal_complete 或 abnormal,区分拍摄中断和正常拍完。 + let returnReason: String? + /// 明确允许暂停。 + let canPause: Bool? + /// 明确允许继续任务。 + let canResume: Bool? + /// 明确允许立即返航。 + let canReturnHome: Bool? + /// inside 是已回巢的必要依据,缺失或 outside 均不能视为回巢。 + let droneInDock: String? + /// 状态所属航线批次。 + let executionBatch: Int64? + /// 当前批次指令进度,供对应按钮结束等待,不覆盖业务阶段。 + let pendingCommand: DroneDockCommandProgress? + + /// 字段与 HTTP/WS 共用合同对应。 + private enum CodingKeys: String, CodingKey { + case state, isAirborne = "is_airborne", pauseReason = "pause_reason" + case djiTaskStatus = "dji_task_status" + case resumePhase = "resume_phase", returnReason = "return_reason" + case canPause = "can_pause", canResume = "can_resume", canReturnHome = "can_return_home" + case droneInDock = "drone_in_dock", executionBatch = "execution_batch" + case pendingCommand = "pending_command" + } + + /// 仅同一有效批次返回已知执行态;回巢仍须 inside,遥测缺失不覆盖后端状态。 + func resolvedState(for batch: Int64?) -> DroneDockFlightControlState { + guard let batch, batch > 0, executionBatch == batch, + let state, let value = DroneDockFlightControlState(rawValue: state) else { return .unknown } + if value == .returned { return droneInDock == "inside" ? .returned : .unknown } + if value == .paused && pauseReason != "manual" { return .unknown } + return value + } +} + +/// HTTP 回执和完整快照共用的指令进度;标识均由服务端回显,不按到包顺序猜测成功。 +struct DroneDockCommandProgress: Decodable, Equatable, Sendable { + /// 服务端唯一指令标识。 + let commandID: String? + /// 本次点击生成的幂等请求标识。 + let clientRequestID: String? + /// 明确对应的安全指令。 + let command: String? + /// pending、succeeded、failed 或 superseded;未知值继续只读核对。 + let status: String? + /// 服务端若提供失败说明则用于本次操作提示。 + let message: String? + + /// 与后端原始字段对应。 + private enum CodingKeys: String, CodingKey { + case commandID = "command_id", clientRequestID = "client_request_id", command, status, message + } +} + +/// 服务端重召唤门禁;客户端仍需验证设备回巢、可用性及操作防重锁。 +struct DroneDockShootingRestartGate: Decodable, Equatable, Sendable { + /// true 才允许进入重召唤校验。 + let canRestart: Bool? + /// 后端诊断原因码。 + let code: String? + /// 后端限制原因,供用户核对。 + let message: String? + + /// 使用后端原始字段名。 + private enum CodingKeys: String, CodingKey { + case canRestart = "can_restart", code, message + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockHomeModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockHomeModels.swift new file mode 100644 index 0000000..1b32119 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockHomeModels.swift @@ -0,0 +1,499 @@ +import Foundation + +/// 朱工首页接口仅提供设备摘要;订单和统计由张工的独立接口读取。 +struct DroneDockHomeResponse: Decodable, Equatable, Sendable { + /// 服务端返回的数据所属景区。 + let scenicID: Int + /// 当前景区的机巢设备。 + let airports: [DroneDockHomeAirport] + + /// 仅读取设备字段,忽略旧版本响应中的订单及统计。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id" + case airports + } + + /// 严格读取设备数组,拒绝身份缺失或重复的快照。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + scenicID = try container.decode(DroneDockHomeInteger.self, forKey: .scenicID).value + guard scenicID > 0 else { + throw DecodingError.dataCorruptedError(forKey: .scenicID, in: container, debugDescription: "景区 ID 必须为正整数") + } + airports = try container.decode([DroneDockHomeAirport].self, forKey: .airports) + guard Set(airports.map(\.id)).count == airports.count else { + throw DecodingError.dataCorruptedError(forKey: .airports, in: container, debugDescription: "设备 ID 重复,无法确定设备身份") + } + } +} + +/// 张工拍摄订单列表的一页结果;总数不由当前页条数推算。 +struct DroneDockOrdersResponse: Decodable, Equatable, Sendable { + /// 当前页订单,保持后端排序。 + let list: [DroneDockHomeOrder] + /// 当前筛选条件下的订单总数。 + let total: Int + /// 当前响应页码,从 1 开始。 + let page: Int + /// 服务端本次采用的每页数量。 + let pageSize: Int + + /// 分页响应字段。 + private enum CodingKeys: String, CodingKey { + case list, total, page + case pageSize = "page_size" + } + + /// 校验分页骨架和订单号,避免把失败数据当成空列表。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + list = try container.decode([DroneDockHomeOrder].self, forKey: .list) + total = try container.decode(DroneDockHomeInteger.self, forKey: .total).value + page = try container.decode(DroneDockHomeInteger.self, forKey: .page).value + pageSize = try container.decode(DroneDockHomeInteger.self, forKey: .pageSize).value + guard total >= 0, page > 0, (1...100).contains(pageSize), list.count <= pageSize, list.count <= total else { + throw DecodingError.dataCorruptedError(forKey: .page, in: container, debugDescription: "订单分页数据无效") + } + guard Set(list.map(\.orderID)).count == list.count else { + throw DecodingError.dataCorruptedError(forKey: .list, in: container, debugDescription: "订单号重复,无法确定订单身份") + } + } +} + +/// 首页设备卡的数据,只表达后端展示信息,不推导起飞或拍摄许可。 +struct DroneDockHomeAirport: Decodable, Equatable, Sendable { + /// 后端设备稳定 ID,用于 Diffable 项身份。 + let id: Int + /// 后端设备名称。 + let name: String + /// 后端设备序列号,不将它与尚未确认的飞控参数混用。 + let snNumber: String? + /// 后端设备所属景区 ID。 + let scenicAreaID: Int? + /// 飞机表在线标记:1 在线,其他已提供整数为离线;忙闲以 workStatus 为准。 + let onlineStatus: Int? + /// 原始工作状态;不据此决定设备可否执行任务。 + let workStatus: Int? + /// 后端工作状态展示文案。 + let workStatusLabel: String? + /// 接单配置:1 可接单、2 暂停接单;不等同于本次起飞许可。 + let isReceiveOrder: Int? + /// 任务类型原始值;当前样本为 null,暂不假定其枚举或值类型。 + let taskType: DroneDockHomeJSONValue? + /// 后端读数列表,展示时按稳定 key 匹配,不依赖返回顺序。 + let metrics: [DroneDockHomeMetric] + + /// 已实测的设备字段名。 + private enum CodingKeys: String, CodingKey { + case id, name, metrics + case snNumber = "sn_number" + case scenicAreaID = "scenic_area_id" + case onlineStatus = "online_status" + case workStatus = "work_status" + case workStatusLabel = "work_status_label" + case isReceiveOrder = "is_receive_order" + case taskType = "task_type" + } + + /// 读取实际设备结构;身份缺失时报错,缺失遥测保持未知。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.decode(DroneDockHomeInteger.self, forKey: .id).value + guard id > 0 else { + throw DecodingError.dataCorruptedError(forKey: .id, in: container, debugDescription: "设备 ID 必须为正整数") + } + name = try container.decode(String.self, forKey: .name) + snNumber = try container.decodeIfPresent(String.self, forKey: .snNumber) + scenicAreaID = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .scenicAreaID)?.value + onlineStatus = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .onlineStatus)?.value + workStatus = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .workStatus)?.value + workStatusLabel = try container.decodeIfPresent(String.self, forKey: .workStatusLabel) + isReceiveOrder = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .isReceiveOrder)?.value + taskType = try container.decodeIfPresent(DroneDockHomeJSONValue.self, forKey: .taskType) + metrics = try container.decodeIfPresent([DroneDockHomeMetric].self, forKey: .metrics) ?? [] + } + + /// 状态标签使用后端文案;缺失、空白或占位文案不显示成空闲。 + var statusTitle: String { DroneDockHomeMetric.usableText(workStatusLabel) ?? "状态待确认" } + + /// 只映射已验证的空闲状态样本,其余保持中性色,不新增业务状态推断。 + var statusTone: DroneDockStatusTone { workStatus == 1 && statusTitle == "空闲" ? .green : .gray } + + /// 返回指定读数的后端展示值,保留单位;未知值不从 raw 猜测生成。 + func metricText(for key: String) -> String { + metrics.first { $0.key == key }?.displayText ?? "—" + } + + /// 仅在电量原始值为 0~100 的真实数字时绘制环形进度,零电量与未知分开。 + var batteryProgress: Double? { + guard let metric = metrics.first(where: { $0.key == "battery" }), + case let .number(value)? = metric.raw, value >= 0, value <= 100 else { return nil } + return NSDecimalNumber(decimal: value).doubleValue / 100 + } +} + +/// 首页单项设备读数,区分可展示的后端文案和未经解释的原始值。 +struct DroneDockHomeMetric: Decodable, Equatable, Sendable { + /// 后端读数稳定键,如 battery、env_temp。 + let key: String + /// 后端读数名称。 + let label: String? + /// 后端原始读数;除合法数值电量环外不据此推测单位或设备许可。 + let raw: DroneDockHomeJSONValue? + /// 后端格式化展示值。 + let value: String? + + /// 统一未知占位,但保留有效零值及服务端单位。 + var displayText: String { Self.usableText(value) ?? "—" } + + /// 将空白和仅由破折号组成的占位文案判为未知。 + static func usableText(_ value: String?) -> String? { + guard let value else { return nil } + let text = value.trimmingCharacters(in: .whitespacesAndNewlines) + guard !text.isEmpty, !text.allSatisfy({ "-–—−― ".contains($0) }) else { return nil } + return text + } +} + +/// 张工的今日统计;仅覆盖本人当前景区类型 25 订单,按上海时区划分当天。 +struct DroneDockHomeToday: Decodable, Equatable, Sendable { + /// 今天付款且当前仍为已付款或已完成的成交订单数。 + let orderCount: Int? + /// 成交订单现金实收减成功退款,使用十进制金额。 + let orderAmount: Decimal? + /// 今天经游客确认完成、当前状态为已完成的订单数。 + let finishedShoot: Int? + + /// today-stats 的字段,不兼容旧 home 的统计口径。 + private enum CodingKeys: String, CodingKey { + case orderCount = "deal_count" + case orderAmount = "deal_amount" + case finishedShoot = "completed_count" + } + + /// 未知项保留 nil;明确的零值正常展示。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderCount = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .orderCount)?.value + orderAmount = try container.decodeIfPresent(DroneDockHomeDecimal.self, forKey: .orderAmount)?.value + finishedShoot = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .finishedShoot)?.value + for (key, value) in [(CodingKeys.orderCount, orderCount), (.finishedShoot, finishedShoot)] { + if let value, value < 0 { + throw DecodingError.dataCorruptedError(forKey: key, in: container, debugDescription: "统计数量不能为负数") + } + } + } +} + +/// 整单履约阶段,与订单飞行任务、航线任务的数字状态分别解析。 +enum DroneDockOrderStatus: Int, Sendable { + case executing = 20 + case completed = 30 +} + +/// 订单列表关联任务的阶段;素材上传不再占用继续查看飞行任务的入口。 +enum DroneDockActiveTaskStatus: Int, Sendable { + case executing = 20 + case uploading = 25 +} + +/// 张工类型 25 订单摘要;操作入口取后端 can_* 权限,进入准备页仍需校验设备条件。 +struct DroneDockHomeOrder: Decodable, Equatable, Sendable { + /// 订单号同时作为 Diffable 稳定身份,不虚构接口未提供的整数 ID。 + let orderID: String + /// 原始订单号,保留前导零;解码时要求非空。 + let orderNumber: String? + /// 已购买项目 ID,传递给后续准备页读取购买快照。 + let projectID: Int? + /// 订单创建时间的服务端字符串。 + let createdAt: String? + /// 后端已经脱敏的游客手机号。 + let touristPhoneMask: String? + /// 购买时的项目名称。 + let packageName: String? + /// 购买快照中的整单共享总次数。 + let shotTotal: Int? + /// 服务端已计次的拍摄数量,包含正常拍完后仍在上传的任务。 + let shotUsed: Int? + /// 服务端权威剩余次数,不在客户端重新计算。 + let shotRemain: Int? + /// 拍摄列表状态 pending、processing、completed;未知值保留。 + let shootStatus: String? + /// 整单履约状态:20 执行中、30 已完成;素材上传进度单独读取。 + let orderStatus: Int? + /// 整单原素材汇总状态。 + let materialStatus: Int? + /// 已有成片的有效任务数。 + let filmCount: Int? + /// orders 返回的关联订单飞行任务 ID;原值保留,操作入口另校验任务状态。 + let activeTaskID: Int? + /// 关联任务状态:20 执行中、25 素材上传中;不等于整单 orderStatus。 + let activeTaskStatus: Int? + /// 后端是否允许新增待飞任务;有执行中任务时优先查看该任务。 + let canCreateTask: Bool? + /// 后端是否允许上传成片。 + let canUploadFilm: Bool? + /// 后端是否允许邀请游客确认完成。 + let canConfirm: Bool? + /// 交付确认状态。 + let confirmStatus: Int? + /// 游客确认完成时间,未完成时为空。 + let confirmedAt: String? + + /// 张工 orders 与订单摘要的字段。 + private enum CodingKeys: String, CodingKey { + case orderNumber = "order_number", projectID = "project_id", createdAt = "created_at" + case touristPhoneMask = "user_phone", packageName = "project_name" + case shotTotal = "shoot_count", shotUsed = "shot_count", shotRemain = "remaining_count" + case shootStatus = "shoot_status", orderStatus = "order_status", materialStatus = "material_status" + case activeTaskID = "active_task_id", activeTaskStatus = "active_task_status" + case filmCount = "film_count", canCreateTask = "can_create_task", canUploadFilm = "can_upload_film" + case canConfirm = "can_confirm", confirmStatus = "confirm_status", confirmedAt = "confirmed_at" + } + + /// 保留未知展示值,但拒绝无身份、负次数和错误类型。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let number = try container.decode(String.self, forKey: .orderNumber) + guard !number.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, + number == number.trimmingCharacters(in: .whitespacesAndNewlines) else { + throw DecodingError.dataCorruptedError(forKey: .orderNumber, in: container, debugDescription: "订单号必须为有效非空字符串") + } + orderID = number + orderNumber = number + projectID = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .projectID)?.value + if let projectID, projectID <= 0 { + throw DecodingError.dataCorruptedError(forKey: .projectID, in: container, debugDescription: "项目 ID 必须为正整数") + } + createdAt = try container.decodeIfPresent(String.self, forKey: .createdAt) + touristPhoneMask = try container.decodeIfPresent(String.self, forKey: .touristPhoneMask) + packageName = try container.decodeIfPresent(String.self, forKey: .packageName) + shotTotal = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .shotTotal)?.value + shotUsed = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .shotUsed)?.value + shotRemain = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .shotRemain)?.value + filmCount = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .filmCount)?.value + for (key, value) in [(CodingKeys.shotTotal, shotTotal), (.shotUsed, shotUsed), (.shotRemain, shotRemain), (.filmCount, filmCount)] { + if let value, value < 0 { + throw DecodingError.dataCorruptedError(forKey: key, in: container, debugDescription: "次数不能为负数") + } + } + shootStatus = try container.decodeIfPresent(String.self, forKey: .shootStatus) + orderStatus = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .orderStatus)?.value + materialStatus = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .materialStatus)?.value + activeTaskID = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .activeTaskID)?.value + activeTaskStatus = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .activeTaskStatus)?.value + if let activeTaskID, activeTaskID <= 0 { + throw DecodingError.dataCorruptedError(forKey: .activeTaskID, in: container, debugDescription: "进行中任务 ID 必须为正整数") + } + canCreateTask = try container.decodeIfPresent(Bool.self, forKey: .canCreateTask) + canUploadFilm = try container.decodeIfPresent(Bool.self, forKey: .canUploadFilm) + canConfirm = try container.decodeIfPresent(Bool.self, forKey: .canConfirm) + confirmStatus = try container.decodeIfPresent(DroneDockHomeInteger.self, forKey: .confirmStatus)?.value + confirmedAt = try container.decodeIfPresent(String.self, forKey: .confirmedAt) + } + + /// 页面稳定身份。 + var id: String { orderID } + + /// 原样展示后端订单号。 + var orderNumberText: String { orderID } + + /// 仅使用后端提供的脱敏手机号。 + var touristTitle: String { + if let phone = DroneDockHomeMetric.usableText(touristPhoneMask) { return "游客 \(phone)" } + return "游客信息待确认" + } + + /// 缺失项目名称时保留未知。 + var packageTitle: String { DroneDockHomeMetric.usableText(packageName) ?? "套餐信息待确认" } + + /// 已知整单状态;未知值仍保留在原始 orderStatus 中。 + var knownOrderStatus: DroneDockOrderStatus? { orderStatus.flatMap(DroneDockOrderStatus.init(rawValue:)) } + + /// 执行中的整单仍未完成,具体操作由各自后端许可决定。 + var isActiveOrderStatus: Bool { knownOrderStatus == .executing } + + /// 仅明确执行中的关联任务可继续查看;上传、终态和未知状态不抢占订单操作。 + var activeFlightTaskID: Int? { + guard activeTaskStatus == DroneDockActiveTaskStatus.executing.rawValue else { return nil } + return activeTaskID + } + + /// 完成优先使用整单状态;执行中的未拍订单保留明确的待拍摄提示。 + var statusTitle: String { + switch knownOrderStatus { + case .completed: return "已完成" + case .executing: return shootStatus == "pending" ? "待拍摄" : "进行中" + case nil: break + } + switch shootStatus { + case "pending": return "待拍摄" + case "processing": return "进行中" + case "completed": return "已完成" + default: return "状态待确认" + } + } + + /// 卡片使用统一履约语义色,素材上传状态独立展示。 + var statusTone: DroneDockStatusTone { + switch knownOrderStatus { + case .completed: return .green + case .executing: return shootStatus == "pending" ? .blue : .orange + case nil: + switch shootStatus { + case "pending": return .blue + case "processing": return .orange + case "completed": return .green + default: return .gray + } + } + } + + /// 逐项展示真实计数和未知占位,不把任务数当作已使用次数。 + var progressTitle: String { + let used = shotUsed.map(String.init) ?? "—" + let total = shotTotal.map(String.init) ?? "—" + let remain = shotRemain.map(String.init) ?? "—" + return "已拍摄 \(used)/\(total) 次,剩余 \(remain) 次" + } + + /// 套餐成功拍摄次数已全部完成;未知或零次套餐不能作为邀请确认依据。 + var hasCompletedShootingQuota: Bool { + guard let total = shotTotal, total > 0, let used = shotUsed else { return false } + return used >= total + } + + /// 邀请游客确认须拍满套餐次数,且后端明确允许发起确认。 + var canInviteVisitorConfirmation: Bool { hasCompletedShootingQuota && canConfirm == true } + + /// 已确认订单允许再次交付,兼容旧接口在完成后返回 false;旧摘要缺少订单状态时仍使用交付权限。 + var canDeliverFilm: Bool { + switch orderStatus { + case 30: true + case 20, nil: canUploadFilm == true + default: false + } + } + + /// 后端选定的执行中任务优先于新增拍摄;无任务时沿用交付和次数规则。 + var primaryAction: String? { + if activeFlightTaskID != nil { return "view_task" } + if canCreateTask == true { return "start_shoot" } + if canInviteVisitorConfirmation { return "confirm_delivery" } + if canUploadFilm == true { return "view_materials" } + return nil + } + + /// 与后端权限对应的按钮文案。 + var actionTitle: String? { + switch primaryAction { + case "view_task": return "继续查看任务" + case "start_shoot": return "开始拍摄" + case "confirm_delivery": return "邀请确认" + case "view_materials": return "查看素材" + default: return nil + } + } + + /// 映射原素材汇总状态;未知值不显示成成功或失败。 + var mediaStatusTitle: String? { + switch materialStatus { + case 0: return "未开始上传" + case 1: return "上传完成" + case 2: return "上传中" + case 3: return "上传失败" + default: return nil + } + } + + /// 已有成功拍摄或素材处理记录即可查看订单素材,入口独立于成片上传权限。 + var showsMaterialsEntry: Bool { + if activeTaskStatus == DroneDockActiveTaskStatus.uploading.rawValue || (shotUsed ?? 0) > 0 { return true } + switch materialStatus { + case 1, 2, 3: return true + default: return false + } + } + + /// 列表卡片优先展示关联任务的上传阶段,不改写原素材汇总状态。 + var cardMaterialStatusTitle: String? { + activeTaskStatus == DroneDockActiveTaskStatus.uploading.rawValue ? "素材上传中" : mediaStatusTitle + } + + /// 与卡片实际文案保持一致,避免上传提示沿用滞后的失败颜色。 + var cardMaterialStatusTone: DroneDockStatusTone { + if activeTaskStatus == DroneDockActiveTaskStatus.uploading.rawValue { return .blue } + switch materialStatus { + case 1: return .green + case 2: return .blue + case 3: return .red + default: return .gray + } + } +} + +/// 保留未知记录的 JSON 结构;数字采用 Decimal,不参与未确认业务计算。 +indirect enum DroneDockHomeJSONValue: Decodable, Equatable, Sendable { + /// JSON 对象。 + case object([String: DroneDockHomeJSONValue]) + /// JSON 数组。 + case array([DroneDockHomeJSONValue]) + /// JSON 字符串。 + case string(String) + /// JSON 数字。 + case number(Decimal) + /// JSON 布尔值。 + case bool(Bool) + /// JSON 空值。 + case null + + /// 按 JSON 实际类型解码,不把字符串自动转换为其他类型。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if container.decodeNil() { self = .null } + else if let value = try? container.decode(Bool.self) { self = .bool(value) } + else if let value = try? container.decode(String.self) { self = .string(value) } + else if let value = try? container.decode(Decimal.self) { self = .number(value) } + else if let value = try? container.decode([String: DroneDockHomeJSONValue].self) { self = .object(value) } + else { self = .array(try container.decode([DroneDockHomeJSONValue].self)) } + } +} + +/// 已知整数统计字段的严格兼容解码器。 +private struct DroneDockHomeInteger: Decodable { + let value: Int + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let number = try? container.decode(Int.self) { + value = number + } else if let text = try? container.decode(String.self), let number = Int(text) { + value = number + } else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要整数或整数字符串") + } + } +} + +/// 已知金额字段的十进制兼容解码器,拒绝只含部分合法数字的字符串。 +private struct DroneDockHomeDecimal: Decodable { + let value: Decimal + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let text = try? container.decode(String.self) { + let normalized = text.trimmingCharacters(in: .whitespacesAndNewlines) + guard normalized.range(of: #"^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$"#, options: .regularExpression) != nil, + let number = Decimal(string: normalized, locale: Locale(identifier: "en_US_POSIX")), + !number.isNaN else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "金额必须为有效十进制数") + } + value = number + } else { + value = try container.decode(Decimal.self) + guard !value.isNaN else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "金额必须为有效十进制数") + } + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockLiveConnection.swift b/suixinkan/Features/DroneDock/Models/DroneDockLiveConnection.swift new file mode 100644 index 0000000..0b7cd7e --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockLiveConnection.swift @@ -0,0 +1,130 @@ +import Foundation + +/// 经验证的火山接收端配置;只在内存传递,禁止写入日志或持久化。 +struct DroneDockVolcLiveConfiguration: Equatable, Sendable, CustomDebugStringConvertible { + let appID: String + let roomID: String + let userID: String + let token: String + let expiresAt: Date + let role: String + + /// 调试器描述中不暴露连接凭证。 + var debugDescription: String { "DroneDockVolcLiveConfiguration()" } + + /// 按 2026-11-02 已确认的 volc querystring 解析;不猜测其它厂商的字段。 + static func parse(_ response: DroneDockLiveResponse, now: Date) throws -> Self { + guard response.playable == true else { + throw DroneDockLiveConnectionError(response.unavailableMessage.flatMap(DroneDockHomeMetric.usableText) + ?? "图传暂不可用") + } + guard let stream = response.play, stream.available == true else { + throw DroneDockLiveConnectionError("图传尚未提供可用的视频流") + } + return try parse(stream, response: response, now: now) + } + + /// 解析两路参数,机巢排在首位;一路缺失或参数无效不影响另一路播放。 + static func parseSources(_ response: DroneDockLiveResponse, now: Date) throws -> [Self] { + guard response.playable == true else { return [try parse(response, now: now)] } + var values: [Self] = [] + var lastError: Error? + for role in ["airport", "drone"] { + let explicit = role == "airport" ? response.airportStream : response.droneStream + let stream = explicit?.available != nil ? explicit : (response.play?.role == role ? response.play : nil) + guard let stream, stream.available == true else { continue } + do { + guard stream.role == role else { throw DroneDockLiveConnectionError("图传来源与设备角色不一致") } + values.append(try parse(stream, response: response, now: now)) + } catch { lastError = error } + } + guard !values.isEmpty else { throw lastError ?? DroneDockLiveConnectionError("图传尚未提供可用的视频流") } + if values.count == 2 { + guard values[0].appID == values[1].appID, values[0].roomID != values[1].roomID else { + throw DroneDockLiveConnectionError("机巢与无人机图传需使用同一应用下的不同房间,请联系后台确认") + } + } + return values + } + + private static func parse(_ stream: DroneDockLiveStream, response: DroneDockLiveResponse, now: Date) throws -> Self { + guard stream.urlType == "volc" else { + throw DroneDockLiveConnectionError("暂不支持当前图传类型,请联系后台确认使用火山图传") + } + guard let role = stream.role, ["drone", "airport"].contains(role), + (response.planeID ?? 0) > 0, + DroneDockHomeMetric.usableText(response.airportSN) != nil else { + throw DroneDockLiveConnectionError("图传设备信息不完整") + } + guard let query = stream.url, !query.isEmpty, query.utf8.count <= 32_768 else { + throw DroneDockLiveConnectionError("图传连接参数不完整") + } + var fields: [String: String] = [:] + // Token 中的 + 保留为 +;百分号只解码一次,避免把 %252B 错解为 +。 + for item in query.split(separator: "&", omittingEmptySubsequences: false) { + let pair = item.split(separator: "=", maxSplits: 1, omittingEmptySubsequences: false) + guard pair.count == 2, let name = String(pair[0]).removingPercentEncoding, + let value = String(pair[1]).removingPercentEncoding, + !name.isEmpty, fields[name] == nil else { + throw DroneDockLiveConnectionError("图传连接参数格式错误") + } + fields[name] = value + } + func required(_ key: String) throws -> String { + guard let value = fields[key], !value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, + value.rangeOfCharacter(from: .controlCharacters) == nil else { + throw DroneDockLiveConnectionError("图传缺少必要连接参数") + } + return value + } + guard let expiry = stream.expiresAt, expiry > 0 else { + throw DroneDockLiveConnectionError("图传缺少凭证有效期") + } + var effectiveExpiry = expiry + if let value = fields["expire_time"] { + guard let parsed = Int(value), parsed > 0 else { + throw DroneDockLiveConnectionError("图传凭证有效期格式错误") + } + effectiveExpiry = min(expiry, parsed) + } + let expiresAt = Date(timeIntervalSince1970: TimeInterval(effectiveExpiry)) + guard expiresAt.timeIntervalSince(now) > 5 else { + throw DroneDockLiveConnectionError("图传凭证已过期,请重新获取") + } + return try Self(appID: required("app_id"), roomID: required("room_id"), + userID: required("user_id"), token: required("token"), expiresAt: expiresAt, role: role) + } +} + +/// 对用户只显示不含连接串的校验原因。 +struct DroneDockLiveConnectionError: Error, LocalizedError, Equatable, Sendable { + let message: String + init(_ message: String) { self.message = message } + var errorDescription: String? { message } +} + +/// 播放器明确回调;只有首帧到达才算已显示真实画面。 +enum DroneDockLivePlaybackEvent: Equatable, Sendable { + case firstFrame + /// 实际有画面的来源切换;nil 表示两路当前均无视频,继续等待推流。 + case sourceChanged(String?) + case failed(String) + case expired +} + +/// 双路选流只使用视频就绪/中断事件;HTTP 的 available 不代表首帧已经到达。 +struct DroneDockLiveSourceSelection { + private(set) var readyRoles: Set = [] + /// 无人机有视频时优先;无人机停流立即退回仍有画面的机巢。 + var selectedRole: String? { + if readyRoles.contains("drone") { return "drone" } + if readyRoles.contains("airport") { return "airport" } + return nil + } + + /// 重复回调幂等,未知来源不会参与展示。 + mutating func setReady(_ ready: Bool, role: String) { + guard ["airport", "drone"].contains(role) else { return } + if ready { readyRoles.insert(role) } else { readyRoles.remove(role) } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockLiveGeometry.swift b/suixinkan/Features/DroneDock/Models/DroneDockLiveGeometry.swift new file mode 100644 index 0000000..35b7ee5 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockLiveGeometry.swift @@ -0,0 +1,33 @@ +import Foundation + +/// SDK 解码帧的原始尺寸和顺时针旋转角度,仅用于定位显示比例,不参与选流。 +struct DroneDockVideoFrameGeometry: Equatable, Sendable { + let width: Int + let height: Int + let rotation: Int +} + +/// 某一路图传在离散事件时的显示几何;不含凭证、视频内容或设备控制信息。 +struct DroneDockLiveGeometry: Equatable, Sendable { + let trigger: String + let role: String + let roomID: String + let streamID: String + let frame: DroneDockVideoFrameGeometry? + let containerWidth: Double + let containerHeight: Double + let hostWidth: Double + let hostHeight: Double + let isSelected: Bool + let sdkVersion: String? + + /// 复用任务页诊断通道;缺失帧信息保留 null,不将未知旋转或尺寸伪造成零。 + var diagnosticFields: [String: Any] { + ["trigger": trigger, "role": role, "room_id": roomID, "stream_id": streamID, + "frame_w": frame?.width as Any? ?? NSNull(), "frame_h": frame?.height as Any? ?? NSNull(), + "rotation": frame?.rotation as Any? ?? NSNull(), "frame_unit": "px", "rotation_unit": "degree", + "container_w": containerWidth, "container_h": containerHeight, + "host_w": hostWidth, "host_h": hostHeight, "container_unit": "pt", + "render_mode": "fit", "is_selected": isSelected, "sdk_version": sdkVersion as Any? ?? NSNull()] + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockLiveModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockLiveModels.swift new file mode 100644 index 0000000..d8e145e --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockLiveModels.swift @@ -0,0 +1,117 @@ +import Foundation + +/// 朱工 live 回执;任务身份与播放参数分别验证,凭证不进入展示 JSON。 +struct DroneDockLiveResponse: Decodable, Equatable, Sendable { + /// 后端回显的订单飞行任务 ID,不能用请求值补齐。 + let orderFlightTaskID: Int + /// 设备明细尚未定义字段,保留原 JSON 类型。 + let airport: DroneDockHomeJSONValue? + /// 无人机明细尚未定义字段,保留原 JSON 类型。 + let drone: DroneDockHomeJSONValue? + /// 文档中的任务摘要,若提供身份必须与顶层任务一致。 + let task: DroneDockShootingTaskIdentity? + /// 已锁定机场序列号,不用于客户端选择或重新绑定设备。 + let airportSN: String? + let planeID: Int? + let playable: Bool? + let unavailableMessage: String? + let play: DroneDockLiveStream? + /// 两路独立接收参数;是否真正有画面由 RTC 视频事件判断。 + let airportStream: DroneDockLiveStream? + let droneStream: DroneDockLiveStream? + /// 后端建议的缺流重查间隔,缺失时按 30 秒处理。 + let refreshHintMS: Int? + /// 随接口返回的展示读数,不触发额外实时采集。 + let metrics: [DroneDockHomeMetric] + /// 脱敏回执,不包含 RTC 连接串或 Token。 + let dataJSON: String + + /// live 文档中的已知字段映射。 + private enum CodingKeys: String, CodingKey { + case orderFlightTaskID = "order_flight_task_id", airport, drone, task + case protocolInfo = "protocol" + case airportSN = "airport_sn", metrics + case planeID = "plane_id", playable, play, unavailableMessage = "unavailable_message" + } + + /// 任务 ID 必须明确提供;未知字段及 null 留在完整 JSON 中供后续合同核对。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderFlightTaskID = try container.decode(Int.self, forKey: .orderFlightTaskID) + airport = try container.decodeIfPresent(DroneDockHomeJSONValue.self, forKey: .airport) + drone = try container.decodeIfPresent(DroneDockHomeJSONValue.self, forKey: .drone) + task = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .task) + airportSN = try container.decodeIfPresent(String.self, forKey: .airportSN) + planeID = try container.decodeIfPresent(Int.self, forKey: .planeID) + playable = try container.decodeIfPresent(Bool.self, forKey: .playable) + unavailableMessage = try container.decodeIfPresent(String.self, forKey: .unavailableMessage) + play = try container.decodeIfPresent(DroneDockLiveStream.self, forKey: .play) + airportStream = try? container.decodeIfPresent(DroneDockLiveStream.self, forKey: .airport) + droneStream = try? container.decodeIfPresent(DroneDockLiveStream.self, forKey: .drone) + let protocolInfo = try container.decodeIfPresent(DroneDockHomeJSONValue.self, forKey: .protocolInfo) + if case .object(let fields) = protocolInfo, case .number(let milliseconds) = fields["refresh_hint_ms"], + milliseconds.isFinite, milliseconds > 0, milliseconds < 3_600_000 { + refreshHintMS = NSDecimalNumber(decimal: milliseconds).intValue + } else { refreshHintMS = nil } + metrics = try container.decodeIfPresent([DroneDockHomeMetric].self, forKey: .metrics) ?? [] + let raw = try DroneDockHomeJSONValue(from: decoder) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] + dataJSON = String(decoding: try encoder.encode(DroneDockLiveJSONSnapshot(value: raw)), as: UTF8.self) + } +} + +/// 只负责原样编码解码所得的 JSON,不追加猜测的流媒体参数。 +private struct DroneDockLiveJSONSnapshot: Encodable { + let value: DroneDockHomeJSONValue + + /// 保持字典、数组、空值、数值与字符串的原始类型。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch value { + case .object(let value): + try container.encode(value.mapValuesWithKeys { key, value in + Self(value: ["url", "token"].contains(key.lowercased()) ? .string("") : value) + }) + case .array(let value): try container.encode(value.map { Self(value: $0) }) + case .string(let value): try container.encode(value) + case .number(let value): try container.encode(value) + case .bool(let value): try container.encode(value) + case .null: try container.encodeNil() + } + } +} + +/// 图传区域的明确状态;本地视频预览不代表设备连接或真实图传成功。 +enum DroneDockLiveState: Equatable, Sendable { + case idle + case loading + case unavailable(String) + case failed(String) + case localPreview(URL) + case connecting + case playing +} + +/// live 的首选流,按 url_type 选择已明确支持的播放器。 +struct DroneDockLiveStream: Decodable, Equatable, Sendable { + let available: Bool? + let role: String? + let deviceSN: String? + let urlType: String? + let url: String? + let expiresAt: Int? + + /// 后端播放字段映射。 + private enum CodingKeys: String, CodingKey { + case available, role, url + case deviceSN = "device_sn", urlType = "url_type", expiresAt = "expire_ts" + } +} + +/// 只用于递归脱敏 JSON,避免字典转换时丢失字段名。 +private extension Dictionary where Key == String { + func mapValuesWithKeys(_ transform: (String, Value) throws -> T) rethrows -> [String: T] { + try Dictionary(uniqueKeysWithValues: map { (key, value) in (key, try transform(key, value)) }) + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockMaterialSelectionID.swift b/suixinkan/Features/DroneDock/Models/DroneDockMaterialSelectionID.swift new file mode 100644 index 0000000..a50c953 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockMaterialSelectionID.swift @@ -0,0 +1,9 @@ +import Foundation + +/// 原素材的选择身份;文件 ID 只在所属任务内唯一,成片不计入原素材选择。 +struct DroneDockMaterialSelectionID: Hashable, Sendable { + /// 所属订单飞行任务。 + let taskID: Int + /// 任务中的原素材 ID。 + let fileID: Int +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockMaterialsModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockMaterialsModels.swift new file mode 100644 index 0000000..5c16e0f --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockMaterialsModels.swift @@ -0,0 +1,284 @@ +import Foundation + +/// 订单素材库的整单摘要和购买点位,不受当前素材筛选条件影响。 +struct DroneDockMaterialDetail: Decodable, Equatable, Sendable { + /// 复用张工订单摘要中的次数、状态和操作权限。 + let order: DroneDockHomeOrder + /// 按购买快照顺序返回的点位筛选项。 + let spots: [DroneDockMaterialSpot] + + /// 订单摘要位于根级,购买点位使用单数 spot 字段。 + private enum CodingKeys: String, CodingKey { case spots = "spot" } + + /// 显式空数组表示无点位;缺少配置或重复身份视为异常响应。 + init(from decoder: Decoder) throws { + order = try DroneDockHomeOrder(from: decoder) + let container = try decoder.container(keyedBy: CodingKeys.self) + spots = try container.decode([DroneDockMaterialSpot].self, forKey: .spots) + guard Set(spots.map(\.id)).count == spots.count else { + throw DecodingError.dataCorruptedError(forKey: .spots, in: container, debugDescription: "素材库点位 ID 重复") + } + } +} + +/// 订单购买快照中的点位筛选项。 +struct DroneDockMaterialSpot: Decodable, Equatable, Sendable { + /// 点位稳定身份,向 tasks 传递为 scenic_spot_id。 + let id: Int + /// 点位名称,缺失时由页面显示占位文本。 + let name: String + + /// 张工点位快照字段。 + private enum CodingKeys: String, CodingKey { + case id = "scenic_spot_id", name = "scenic_spot_name" + } + + /// 点位身份必须有效,缺失名称不影响查看该点位任务。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positiveMaterialID(forKey: .id) + name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" + } +} + +/// 当前订单及点位范围内的全部有效任务;接口一次返回,无分页。 +struct DroneDockMaterialTasks: Decodable, Equatable, Sendable { + /// 任务列表所属订单号。 + let orderNumber: String + /// 当前范围内的任务记录数,不能用作成功拍摄次数。 + let total: Int + /// 保留服务端顺序及待飞、失败等任务。 + let list: [DroneDockMaterialTask] + + /// tasks 响应根字段。 + private enum CodingKeys: String, CodingKey { case orderNumber = "order_number", total, list } + + /// 校验完整列表及订单归属,避免异常结构被展示成真实空态。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderNumber = try container.materialOrderNumber(forKey: .orderNumber) + total = try container.decode(DroneDockMaterialInteger.self, forKey: .total).value + list = try container.decode([DroneDockMaterialTask].self, forKey: .list) + guard total >= 0, total == list.count else { + throw DecodingError.dataCorruptedError(forKey: .total, in: container, debugDescription: "任务总数与完整列表不一致") + } + guard Set(list.map(\.id)).count == list.count else { + throw DecodingError.dataCorruptedError(forKey: .list, in: container, debugDescription: "素材库任务 ID 重复") + } + guard list.allSatisfy({ $0.orderNumber == orderNumber }) else { + throw DecodingError.dataCorruptedError(forKey: .list, in: container, debugDescription: "任务不属于当前订单") + } + } +} + +/// 一次有效飞行任务及其原素材、当前成片,不以素材是否就绪隐藏任务。 +struct DroneDockMaterialTask: Decodable, Equatable, Sendable { + /// 订单飞行任务身份,与实际飞行平台任务编号不同。 + let id: Int + /// 任务所属订单号。 + let orderNumber: String + /// 购买快照中的点位身份。 + let spotID: Int + /// 购买快照中的点位名称,缺失时为空。 + let spotName: String + /// 购买快照中的航线名称。 + let airLineName: String? + /// 订单内任务序号,不代表成功拍摄次数。 + let sequence: Int? + /// 后端飞行状态,未知状态原样保留。 + let flightStatus: Int? + /// 本任务原素材聚合状态。 + let materialStatus: Int? + /// 服务端记录的任务创建时间。 + let createdAt: String? + /// 本次任务的原素材,显式空数组表示尚无素材。 + let materials: [DroneDockMaterialFile] + /// 当前已交付的视频成片,未交付时为空。 + let film: DroneDockMaterialFilm? + + /// 张工任务字段,id 与 task_id 表示同一任务。 + private enum CodingKeys: String, CodingKey { + case id, taskID = "task_id", orderNumber = "order_number" + case spotID = "scenic_spot_id", spotName = "scenic_spot_name", airLineName = "air_line_name" + case sequence = "seq", flightStatus = "flight_status", materialStatus = "material_status" + case createdAt = "created_at", materials, film + } + + /// 兼容两种任务 ID 字段,但拒绝冲突、重复素材及其他任务的成片。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let identifier = try container.optionalPositiveMaterialID(forKey: .id) + let taskIdentifier = try container.optionalPositiveMaterialID(forKey: .taskID) + guard let resolvedID = identifier ?? taskIdentifier, + identifier == nil || taskIdentifier == nil || identifier == taskIdentifier else { + throw DecodingError.dataCorruptedError(forKey: .id, in: container, debugDescription: "任务 ID 缺失或不一致") + } + id = resolvedID + orderNumber = try container.materialOrderNumber(forKey: .orderNumber) + spotID = try container.positiveMaterialID(forKey: .spotID) + spotName = try container.decodeIfPresent(String.self, forKey: .spotName) ?? "" + airLineName = try container.decodeIfPresent(String.self, forKey: .airLineName) + sequence = try container.optionalMaterialInteger(forKey: .sequence) + flightStatus = try container.optionalMaterialInteger(forKey: .flightStatus) + materialStatus = try container.optionalMaterialInteger(forKey: .materialStatus) + createdAt = try container.decodeIfPresent(String.self, forKey: .createdAt) + materials = try container.decode([DroneDockMaterialFile].self, forKey: .materials) + film = try container.decodeIfPresent(DroneDockMaterialFilm.self, forKey: .film) + guard Set(materials.map(\.id)).count == materials.count else { + throw DecodingError.dataCorruptedError(forKey: .materials, in: container, debugDescription: "任务内素材 ID 重复") + } + if let filmTaskID = film?.taskID, filmTaskID != id { + throw DecodingError.dataCorruptedError(forKey: .film, in: container, debugDescription: "成片不属于当前任务") + } + } +} + +/// 飞行模块回写的原素材,上传未完成时保留其状态和失败说明。 +struct DroneDockMaterialFile: Decodable, Equatable, Sendable { + /// 素材稳定身份,在所属任务内唯一。 + let id: Int + /// 1 为图片、2 为视频,未知值保留且不开放预览。 + let fileType: Int? + /// 原素材文件名。 + let fileName: String? + /// 原素材字节数,缺失时不推测。 + let fileSize: Int? + /// 后端提供的封面地址。 + let coverURL: String? + /// 后端提供的文件地址,未上传完成时可能为空串。 + let fileURL: String? + /// 0 未开始、1 已就绪、2 上传中、3 失败。 + let uploadStatus: Int? + /// 服务端返回的上传失败原因。 + let failureReason: String? + + /// 只有明确就绪且类型受支持的 HTTP(S) 文件才可预览。 + var previewURL: URL? { + guard uploadStatus == 1, fileType == 1 || fileType == 2 else { return nil } + return DroneDockMaterialURL.preview(fileURL) + } + + /// 张工原素材字段。 + private enum CodingKeys: String, CodingKey { + case id, fileType = "file_type", fileName = "file_name", fileSize = "file_size" + case coverURL = "cover_url", fileURL = "file_url", uploadStatus = "upload_status" + case failureReason = "failure_reason" + } + + /// 解码可为空的回写信息,素材身份仍必须有效。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positiveMaterialID(forKey: .id) + fileType = try container.optionalMaterialInteger(forKey: .fileType) + fileName = try container.decodeIfPresent(String.self, forKey: .fileName) + fileSize = try container.optionalMaterialSize(forKey: .fileSize) + coverURL = try container.decodeIfPresent(String.self, forKey: .coverURL) + fileURL = try container.decodeIfPresent(String.self, forKey: .fileURL) + uploadStatus = try container.optionalMaterialInteger(forKey: .uploadStatus) + failureReason = try container.decodeIfPresent(String.self, forKey: .failureReason) + } +} + +/// 当前任务已交付的成片;缺少有效地址时保留记录但不提供预览。 +struct DroneDockMaterialFilm: Decodable, Equatable, Sendable { + /// 成片稳定身份。 + let id: Int + /// 所属任务身份,接口提供时必须与外层任务一致。 + let taskID: Int? + /// 成片文件名。 + let fileName: String? + /// 成片字节数。 + let fileSize: Int? + /// 后端提供的成片封面地址。 + let coverURL: String? + /// 后端提供的成片视频地址。 + let fileURL: String? + + /// 已交付成片只接受有效 HTTP(S) 视频地址。 + var previewURL: URL? { DroneDockMaterialURL.preview(fileURL) } + + /// 张工当前成片字段。 + private enum CodingKeys: String, CodingKey { + case id, taskID = "task_id", fileName = "file_name", fileSize = "file_size" + case coverURL = "cover_url", fileURL = "file_url" + } + + /// 容忍未回写的展示字段,保留可校验的任务归属。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positiveMaterialID(forKey: .id) + taskID = try container.optionalPositiveMaterialID(forKey: .taskID) + fileName = try container.decodeIfPresent(String.self, forKey: .fileName) + fileSize = try container.optionalMaterialSize(forKey: .fileSize) + coverURL = try container.decodeIfPresent(String.self, forKey: .coverURL) + fileURL = try container.decodeIfPresent(String.self, forKey: .fileURL) + } +} + +/// 素材库整数读取器,兼容整数字符串并拒绝布尔、分数和任意文本。 +private struct DroneDockMaterialInteger: Decodable { + let value: Int + + /// 数值范围由具体字段的读取方法校验。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let number = try? container.decode(Int.self) { value = number } + else if let text = try? container.decode(String.self), let number = Int(text) { value = number } + else { throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要整数或整数字符串") } + } +} + +/// 素材和成片共用的远程预览地址规则。 +private enum DroneDockMaterialURL { + /// 拒绝空值、空白字符、本地地址和无主机的 URL。 + static func preview(_ value: String?) -> URL? { + guard let value, !value.isEmpty, + value.rangeOfCharacter(from: .whitespacesAndNewlines) == nil, + let url = URL(string: value), let scheme = url.scheme?.lowercased(), + ["https", "http"].contains(scheme), let host = url.host, !host.isEmpty else { return nil } + return url + } +} + +private extension KeyedDecodingContainer { + /// 素材、任务、点位及成片必须有正整数身份。 + func positiveMaterialID(forKey key: Key) throws -> Int { + let value = try decode(DroneDockMaterialInteger.self, forKey: key).value + guard value > 0 else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "素材库 ID 必须为正整数") + } + return value + } + + /// 可选关联身份在提供值时仍要求正整数。 + func optionalPositiveMaterialID(forKey key: Key) throws -> Int? { + guard let value = try optionalMaterialInteger(forKey: key) else { return nil } + guard value > 0 else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "素材库关联 ID 必须为正整数") + } + return value + } + + /// 状态码不限定已知枚举,缺失或 null 保留未知。 + func optionalMaterialInteger(forKey key: Key) throws -> Int? { + try decodeIfPresent(DroneDockMaterialInteger.self, forKey: key)?.value + } + + /// 文件大小可缺失,但不能出现负字节数。 + func optionalMaterialSize(forKey key: Key) throws -> Int? { + let value = try optionalMaterialInteger(forKey: key) + if let value, value < 0 { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "素材大小不能为负数") + } + return value + } + + /// 保留订单号前导零,禁止缺失或带首尾空白的身份。 + func materialOrderNumber(forKey key: Key) throws -> String { + let value = try decode(String.self, forKey: key) + guard !value.isEmpty, value == value.trimmingCharacters(in: .whitespacesAndNewlines) else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "订单号必须为有效非空字符串") + } + return value + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockModels.swift new file mode 100644 index 0000000..3985dc2 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockModels.swift @@ -0,0 +1,353 @@ +import Foundation + +/// 机巢页面的数据所属范围;景区切换不改变原景区的任务。 +struct DroneDockContext: Hashable, Sendable { + /// 当前景区的稳定标识。 + let scenicID: String + /// 顶部展示的景区名称。 + let scenicName: String + /// 当前工作人员的稳定标识。 + let userID: String + /// 顶部展示的工作人员姓名。 + let photographerName: String + + /// UI 首轮验收使用的本地上下文,不关联实际订单。 + static let demo = DroneDockContext( + scenicID: "demo-songshan", scenicName: "嵩山少林景区", + userID: "demo-photographer", photographerName: "吴家俊" + ) +} + +/// 由视图映射到具体颜色的语义色,不依赖 UIKit。 +enum DroneDockStatusTone: Hashable, Sendable { + case blue, green, orange, red, gray +} + +/// 设备独立于订单履约的可用状态;低电量由设备状态指定,不推导电量阈值。 +enum DroneDockDeviceState: Hashable, Sendable { + case ready, occupied, disconnected, lowBattery, noSignal, unknown + + /// 无人机卡片的状态文字。 + var title: String { + switch self { + case .ready: "空闲" + case .occupied: "占用中" + case .disconnected: "未连接" + case .lowBattery: "低电量" + case .noSignal: "无信号" + case .unknown: "状态待确认" + } + } + + /// 状态标签语义色。 + var tone: DroneDockStatusTone { + switch self { + case .ready: .green + case .occupied, .lowBattery: .orange + case .disconnected, .unknown: .gray + case .noSignal: .red + } + } +} + +/// 无人机六项遥测;未知读数使用 nil,避免误显示成零。 +struct DroneDockTelemetry: Hashable, Sendable { + /// 电池电量百分比。 + let batteryPercent: Int? + /// 摄氏温度。 + let temperatureCelsius: Double? + /// 每秒米数的风速。 + let windSpeed: Double? + /// 设备提供的雨量描述。 + let rainDescription: String? + /// 设备提供的信号描述。 + let signalDescription: String? + /// 搜星数量。 + let satelliteCount: Int? + + /// 六项均无有效遥测的占位数据。 + static let unknown = DroneDockTelemetry( + batteryPercent: nil, temperatureCelsius: nil, windSpeed: nil, + rainDescription: nil, signalDescription: nil, satelliteCount: nil + ) + + /// 电池读数,未知时显示破折号。 + var batteryText: String { batteryPercent.map { "\($0)%" } ?? "—" } + /// 环形电量的有效进度,未知时不绘制进度。 + var batteryProgress: Double? { batteryPercent.map { Double(min(100, max(0, $0))) / 100 } } + /// 温度读数及单位。 + var temperatureText: String { temperatureCelsius.map { String(format: "%.1f°C", $0) } ?? "—" } + /// 风速读数及单位。 + var windText: String { + windSpeed.map { $0 == $0.rounded() ? String(format: "%.0fm/s", $0) : String(format: "%.1fm/s", $0) } ?? "—" + } + /// 雨量描述,空字符串同样视为未知。 + var rainText: String { Self.knownText(rainDescription) } + /// 信号描述,空字符串同样视为未知。 + var signalText: String { Self.knownText(signalDescription) } + /// 搜星读数及单位。 + var satelliteText: String { satelliteCount.map { "\($0)颗" } ?? "—" } + + private static func knownText(_ value: String?) -> String { + guard let value, !value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return "—" } + return value + } +} + +/// 横向设备列表中的单架无人机。 +struct DroneDockDevice: Hashable, Sendable { + /// 无人机稳定标识。 + let id: String + /// 无人机展示名称。 + let name: String + /// 设备可用状态。 + let state: DroneDockDeviceState + /// 六项遥测。 + let telemetry: DroneDockTelemetry +} + +/// 经确认的七种当前任务标签;不与成功扣次或上传结果合并。 +enum DroneShootingTaskPhase: String, CaseIterable, Hashable, Sendable { + case navigating, arrived, shooting, shootingPaused, returning, returnPaused, unconfirmed + + /// 首页及订单卡右上角展示的任务标签。 + var title: String { + switch self { + case .navigating: "前往拍摄点中" + case .arrived: "已到达,待拍摄" + case .shooting: "拍摄中" + case .shootingPaused: "拍摄已暂停" + case .returning: "返航中" + case .returnPaused: "返航已暂停" + case .unconfirmed: "任务状态待确认" + } + } + + /// 任务标签的语义色。 + var tone: DroneDockStatusTone { + switch self { + case .shootingPaused, .returnPaused, .unconfirmed: .orange + case .returning: .red + case .navigating, .arrived, .shooting: .blue + } + } +} + +/// 一次拍摄的结果独立于飞行阶段。 +enum DroneShootingResult: Hashable, Sendable { + case notStarted, inProgress, succeeded, failed, unknown +} + +/// 尚未结束的飞行任务引用,不暴露点位信息到首页卡片。 +struct DroneShootingTask: Hashable, Sendable { + /// 任务稳定标识。 + let id: String + /// 飞行或暂停阶段。 + let phase: DroneShootingTaskPhase + /// 该次拍摄的独立结果。 + let shootingResult: DroneShootingResult +} + +/// 订单按已成功拍摄次数和当前任务归属的履约分类。 +enum DroneShootingFulfillmentState: Hashable, Sendable { + case pending, inProgress, completed + + /// 列表状态标签。 + var title: String { + switch self { + case .pending: "待拍摄" + case .inProgress: "进行中" + case .completed: "拍摄完成" + } + } + + /// 履约状态的语义色。 + var tone: DroneDockStatusTone { + switch self { + case .pending: .gray + case .inProgress: .blue + case .completed: .green + } + } +} + +/// 原素材上传摘要,与拍摄次数和后续成片交付分开。 +enum DroneShootingMaterialState: Hashable, Sendable { + case none, uploading, partiallyReady, ready, failed + + /// 订单卡素材栏文案。 + var title: String { + switch self { + case .none: "暂无拍摄素材" + case .uploading: "上传中" + case .partiallyReady: "部分上传完成" + case .ready: "上传完成" + case .failed: "上传失败" + } + } + + /// 素材栏语义色。 + var tone: DroneDockStatusTone { + switch self { + case .none: .gray + case .uploading, .partiallyReady: .blue + case .ready: .green + case .failed: .red + } + } + + /// 素材状态对应的 SF Symbol 名称。 + var systemImageName: String { + switch self { + case .none: "photo.on.rectangle" + case .uploading, .partiallyReady: "icloud.and.arrow.up" + case .ready: "checkmark.icloud" + case .failed: "exclamationmark.icloud" + } + } +} + +/// 订单卡中的游客确认摘要,与交付清单及确认会话快照分别保存。 +enum DroneVisitorConfirmationState: Hashable, Sendable { + case none, awaitingConfirmation, confirmed + + /// 卡片确认区文案。 + var title: String { + switch self { + case .none: "尚未交付成片" + case .awaitingConfirmation: "待游客确认" + case .confirmed: "游客已确认" + } + } +} + +/// 订单主要入口的语义,避免 View 自行根据数字推断行为。 +enum DroneShootingPrimaryAction: Hashable, Sendable { + case startShooting, continueShooting, viewCurrentTask, prepareAgain, none + + /// 主要按钮标题。 + var title: String { + switch self { + case .startShooting: "开始拍摄" + case .continueShooting: "继续拍摄" + case .viewCurrentTask: "查看当前任务" + case .prepareAgain: "重新准备拍摄" + case .none: "拍摄已完成" + } + } +} + +/// 两种订单卡共享的数据;计数、当前任务、原素材和成片交付各自独立。 +struct DroneShootingOrder: Hashable, Sendable { + /// 订单稳定标识。 + let id: String + /// 所属景区标识。 + let scenicID: String + /// 被分配的工作人员标识。 + let assignedUserID: String + /// 游客脱敏展示名称。 + let customerName: String + /// 可见订单号。 + let orderNumber: String + /// 下单时间展示值。 + let createdAtText: String + /// 套餐展示名称,不包含次数。 + let packageName: String + /// 本单包含的拍摄次数。 + let totalShootingCount: Int + /// 已确认成功的拍摄次数。 + let successfulShootingCount: Int + /// 尚未结束的任务,次数为零时仍可存在。 + let activeTask: DroneShootingTask? + /// 设备已确认失败并可重新准备时的入口提示。 + let needsRepreparation: Bool + /// 原素材上传状态。 + let materialState: DroneShootingMaterialState + /// 新版视觉中的已交付数量,仅为演示摘要。 + let deliveredVideoCount: Int + /// 新版视觉中的游客确认摘要。 + let visitorConfirmationState: DroneVisitorConfirmationState + + /// 剩余次数只由成功数计算;查看任务、上传和交付不扣次。 + var remainingShootingCount: Int { max(0, totalShootingCount - successfulShootingCount) } + /// 本地演示与真实订单一致,拍满有效套餐次数后才展示游客确认入口。 + var hasCompletedShootingQuota: Bool { + totalShootingCount > 0 && successfulShootingCount >= totalShootingCount + } + /// 拍摄进度,防止除零或异常值溢出进度条。 + var progress: Double { + guard totalShootingCount > 0 else { return 0 } + return min(1, max(0, Double(successfulShootingCount) / Double(totalShootingCount))) + } + /// 零次立即已完成;有成功记录或当前任务时仍归进行中。 + var fulfillmentState: DroneShootingFulfillmentState { + if remainingShootingCount == 0 { return .completed } + if successfulShootingCount > 0 || activeTask != nil { return .inProgress } + return .pending + } + /// 有当前任务时优先回到该任务,包括零次仍在返航的情况。 + var primaryAction: DroneShootingPrimaryAction { + if activeTask != nil { return .viewCurrentTask } + guard remainingShootingCount > 0 else { return .none } + if needsRepreparation { return .prepareAgain } + return successfulShootingCount == 0 ? .startShooting : .continueShooting + } + /// 主要按钮可点击性。 + var primaryActionEnabled: Bool { primaryAction != .none } + /// 是否存在可进入的原素材记录;上传中和失败也保留查看入口。 + var hasMaterials: Bool { materialState != .none } + /// 首页和列表右上角优先展示具体任务阶段。 + var statusTitle: String { activeTask?.phase.title ?? fulfillmentState.title } + /// 状态文字对应语义色。 + var statusTone: DroneDockStatusTone { activeTask?.phase.tone ?? fulfillmentState.tone } + /// 套餐与购买次数的组合文案。 + var packageSummary: String { "\(packageName) · 含\(totalShootingCount)次拍摄" } +} + +/// 我的拍摄订单四个筛选入口。 +enum DroneShootingOrderFilter: String, CaseIterable, Hashable, Sendable { + case all, pending, inProgress, completed + + /// 张工 orders 的服务端筛选值,进行中不使用本地枚举名。 + var apiStatus: String { + switch self { + case .all: "all" + case .pending: "pending" + case .inProgress: "processing" + case .completed: "completed" + } + } + + /// Tab 标题。 + var title: String { + switch self { + case .all: "全部" + case .pending: "待拍摄" + case .inProgress: "进行中" + case .completed: "已完成" + } + } + + /// 订单列表区标题。 + var listTitle: String { self == .all ? "全部订单" : "\(title)订单" } + + /// 筛选只根据履约状态,上传或交付不会改变订单归属。 + func includes(_ order: DroneShootingOrder) -> Bool { + switch self { + case .all: true + case .pending: order.fulfillmentState == .pending + case .inProgress: order.fulfillmentState == .inProgress + case .completed: order.fulfillmentState == .completed + } + } +} + +/// 工作台的本地演示统计,与列表中的历史订单数量分别展示。 +struct DroneDockDailyStatistics: Hashable, Sendable { + /// 今日成交订单数。 + let orderCount: Int + /// 已格式化的成交金额,不使用浮点计算金额。 + let revenueText: String + /// 今日成功拍摄次数。 + let successfulShootingCount: Int +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockNearbyTransferModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockNearbyTransferModels.swift new file mode 100644 index 0000000..2cc3fea --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockNearbyTransferModels.swift @@ -0,0 +1,49 @@ +import Foundation + +/// 只在商家手机局域网内提供所选文件的临时会话,不包含订单或登录凭证。 +struct DroneDockNearbyTransferSession: Equatable, Sendable { + /// 每次重新生成二维码使用独立身份。 + let id: UUID + /// 游客浏览器访问的局域网接收页地址。 + let url: URL + /// 到期后停止监听并关闭已有连接。 + let expiresAt: Date +} + +/// 本机文件服务的状态;发送完字节不等于游客已经保存至相册。 +enum DroneDockNearbyTransferEvent: Equatable, Sendable { + case visitorConnected + /// 本次下载响应的已发送字节数;分段请求只统计该段,不推断游客已有文件。 + case sending(bytesSent: Int64, totalBytes: Int64) + case sent + /// 浏览器只请求了部分文件;等待其后续请求,不记为整段视频发送成功。 + case partialSent + case interrupted + case stopped + case failed(String) +} + +/// 闪传页面依赖的本地传输边界,不提供任何云端回退或上传功能。 +protocol DroneDockNearbyTransferServing: AnyObject { + /// 建立临时接收页;回调来自服务串行队列,调用方自行切换 UI 执行上下文。 + func start(video: DroneDockDeliveryVideo, + onEvent: @escaping @Sendable (DroneDockNearbyTransferEvent) -> Void) async throws -> DroneDockNearbyTransferSession + /// 同步撤销会话、关闭监听与正在发送的文件,迟到回调不能恢复旧会话。 + func stop() +} + +/// 可向用户显示的局域网服务启动失败原因。 +enum DroneDockNearbyTransferError: LocalizedError, Equatable { + case noLocalNetwork, invalidAddress, randomGenerationFailed, startTimedOut, listenerFailed + + /// 提示用户连接可互通的 Wi-Fi,并允许重新生成二维码。 + var errorDescription: String? { + switch self { + case .noLocalNetwork: "未找到可用的局域网地址,请先连接 Wi-Fi 后重试" + case .invalidAddress: "无法使用当前网络地址,请切换 Wi-Fi 后重试" + case .randomGenerationFailed: "无法生成本次接收凭证,请重试" + case .startTimedOut: "本地传输服务启动超时,请检查网络后重试" + case .listenerFailed: "无法启动本地传输服务,请检查局域网权限和网络后重试" + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockPaymentModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockPaymentModels.swift new file mode 100644 index 0000000..d925b9b --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockPaymentModels.swift @@ -0,0 +1,282 @@ +import Foundation + +/// 张工提供的当前景区可售航拍套餐;价格与次数来自服务器配置。 +struct DroneDockProject: Decodable, Hashable, Sendable { + /// 套餐稳定 ID。 + let id: Int + /// 套餐名称。 + let name: String + /// 当前默认售价,单位元。 + let price: Decimal + /// 整个套餐共享的拍摄次数。 + let shootCount: Int + + /// 套餐接口字段。 + private enum CodingKeys: String, CodingKey { + case id, name, price + case shootCount = "shoot_count" + } + + /// 严格读取可售套餐,不为缺失价格或次数生成默认值。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.paymentInteger(.id, minimum: 1) + name = try container.decode(String.self, forKey: .name) + price = try container.paymentMoney(.price) + shootCount = try container.paymentInteger(.shootCount, minimum: 1) + guard DroneDockPriceValidator.isValid(price) else { + throw DecodingError.dataCorruptedError(forKey: .price, in: container, debugDescription: "套餐价格超出报价范围") + } + } +} + +/// 后端生成的小程序收款码及报价;同一码可重复购买,不代表单笔交易或到账结果。 +struct DroneDockPayCode: Decodable, Equatable, Sendable { + /// 报价所属套餐 ID。 + let projectID: Int + /// 后端确认的套餐名称。 + let projectName: String + /// 后端确认的成交报价,单位元。 + let price: Decimal + /// 报价包含的拍摄次数。 + let shootCount: Int + /// 收款归属的店铺工作人员 ID。 + let storeUserID: Int + /// 收款归属的店铺 ID。 + let storeID: Int + /// 后端小程序码的 HTTP(S) 图片地址,直接加载原图,不再编码成普通二维码。 + let payURL: String + + /// 小程序收款码接口字段;pay_url 沿用字段名,内容为图片地址。 + private enum CodingKeys: String, CodingKey { + case price + case projectID = "project_id", projectName = "project_name", shootCount = "shoot_count" + case storeUserID = "store_user_id", storeID = "store_id", payURL = "pay_url" + } + + /// 验证身份、报价和图片地址格式;图片内容与加载结果由视图处理。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + projectID = try container.paymentInteger(.projectID, minimum: 1) + projectName = try container.decode(String.self, forKey: .projectName) + price = try container.paymentMoney(.price) + shootCount = try container.paymentInteger(.shootCount, minimum: 1) + storeUserID = try container.paymentInteger(.storeUserID, minimum: 1) + storeID = try container.paymentInteger(.storeID, minimum: 1) + payURL = try container.decode(String.self, forKey: .payURL) + guard DroneDockPriceValidator.isValid(price) else { + throw DecodingError.dataCorruptedError(forKey: .price, in: container, debugDescription: "付款报价超出范围") + } + guard payURL.rangeOfCharacter(from: .whitespacesAndNewlines.union(.controlCharacters)) == nil, + let components = URLComponents(string: payURL), + let scheme = components.scheme?.lowercased(), ["https", "http"].contains(scheme), + let host = components.host, !host.isEmpty, components.url != nil, + components.user == nil, components.password == nil else { + throw DecodingError.dataCorruptedError(forKey: .payURL, in: container, debugDescription: "收款码图片必须是有效 HTTP(S) 地址") + } + } +} + +/// 收款记录分页与筛选范围汇总,不能据此推断某次二维码的交易状态。 +struct DroneDockReceiptsResponse: Decodable, Equatable, Sendable { + /// Laravel 格式的收款记录分页。 + let records: DroneDockReceiptPage + /// 整个查询范围的收款汇总,与当前分页无关。 + let summary: DroneDockReceiptSummary +} + +/// 后端 records 分页对象;列表字段实际为 data。 +struct DroneDockReceiptPage: Decodable, Equatable, Sendable { + /// 当前页,从 1 开始。 + let currentPage: Int + /// 每页条数。 + let perPage: Int + /// 整个查询范围的记录数量。 + let total: Int + /// 最后一页页码。 + let lastPage: Int + /// 当前页实际记录。 + let items: [DroneDockReceipt] + + /// Laravel 分页字段。 + private enum CodingKeys: String, CodingKey { + case currentPage = "current_page", perPage = "per_page", total, lastPage = "last_page" + case items = "data" + } + + /// 保留真实分页,不把缺失列表当成正常空记录。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + currentPage = try container.paymentInteger(.currentPage, minimum: 1) + perPage = try container.paymentInteger(.perPage, minimum: 1) + total = try container.paymentInteger(.total, minimum: 0) + lastPage = try container.paymentInteger(.lastPage, minimum: 0) + items = try container.decode([DroneDockReceipt].self, forKey: .items) + guard Set(items.map(\.orderNumber)).count == items.count else { + throw DecodingError.dataCorruptedError(forKey: .items, in: container, debugDescription: "收款记录订单号重复") + } + } +} + +/// 已付款、已完成或已退款的真实收款记录,现金与积分分别展示。 +struct DroneDockReceipt: Decodable, Hashable, Sendable { + /// 真实订单号。 + let orderNumber: String + /// 套餐 ID。 + let projectID: Int + /// 购买时套餐名称。 + let projectName: String + /// 后端订单状态原值。 + let orderStatus: Int + /// 支付时间,Unix 秒。 + let payTime: TimeInterval + /// 服务端脱敏后的付款人昵称。 + let payer: String + /// 现金实收,单位元。 + let cashPaid: Decimal + /// 成功现金退款,单位元。 + let cashRefund: Decimal + /// 现金净收,单位元。 + let cashNet: Decimal + /// 消费积分数量。 + let pointsPaid: Int + /// 已退回积分数量。 + let pointsRefund: Int + /// 净消费积分数量。 + let pointsNet: Int + /// 积分抵扣金额,单位元。 + let pointAmount: Decimal + + /// 收款记录接口字段。 + private enum CodingKeys: String, CodingKey { + case orderNumber = "order_number", projectID = "project_id", projectName = "project_name" + case orderStatus = "order_status", payTime = "pay_time", payer + case cashPaid = "cash_paid", cashRefund = "cash_refund", cashNet = "cash_net" + case pointsPaid = "points_paid", pointsRefund = "points_refund", pointsNet = "points_net" + case pointAmount = "point_amount" + } + + /// 解码实际支付与退款字段,零现金支付保留为真实零值。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderNumber = try container.decode(String.self, forKey: .orderNumber) + guard !orderNumber.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { + throw DecodingError.dataCorruptedError(forKey: .orderNumber, in: container, debugDescription: "订单号不能为空") + } + projectID = try container.paymentInteger(.projectID, minimum: 1) + projectName = try container.decode(String.self, forKey: .projectName) + orderStatus = try container.paymentInteger(.orderStatus) + payTime = TimeInterval(try container.paymentInteger(.payTime, minimum: 0)) + payer = try container.decode(String.self, forKey: .payer) + cashPaid = try container.paymentMoney(.cashPaid) + cashRefund = try container.paymentMoney(.cashRefund) + cashNet = try container.paymentMoney(.cashNet) + pointsPaid = try container.paymentInteger(.pointsPaid, minimum: 0) + pointsRefund = try container.paymentInteger(.pointsRefund, minimum: 0) + pointsNet = try container.paymentInteger(.pointsNet) + pointAmount = try container.paymentMoney(.pointAmount) + } +} + +/// 整个筛选区间的到账与退款汇总,不把现金、积分合并为一种支付金额。 +struct DroneDockReceiptSummary: Decodable, Equatable, Sendable { + /// 收款记录总数量。 + let count: Int + /// 现金实收总额。 + let cashPaid: Decimal + /// 成功现金退款总额。 + let cashRefund: Decimal + /// 现金净收总额。 + let cashNet: Decimal + /// 消费积分总数。 + let pointsPaid: Int + /// 退回积分总数。 + let pointsRefund: Int + /// 净消费积分总数。 + let pointsNet: Int + /// 积分抵扣总金额。 + let pointAmount: Decimal + + /// 收款汇总接口字段。 + private enum CodingKeys: String, CodingKey { + case count + case cashPaid = "cash_paid", cashRefund = "cash_refund", cashNet = "cash_net" + case pointsPaid = "points_paid", pointsRefund = "points_refund", pointsNet = "points_net" + case pointAmount = "point_amount" + } + + /// 严格读取汇总;金额缺失或 null 不以零替代。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + count = try container.paymentInteger(.count, minimum: 0) + cashPaid = try container.paymentMoney(.cashPaid) + cashRefund = try container.paymentMoney(.cashRefund) + cashNet = try container.paymentMoney(.cashNet) + pointsPaid = try container.paymentInteger(.pointsPaid, minimum: 0) + pointsRefund = try container.paymentInteger(.pointsRefund, minimum: 0) + pointsNet = try container.paymentInteger(.pointsNet) + pointAmount = try container.paymentMoney(.pointAmount) + } +} + +/// 套餐报价校验与规范化,使用十进制金额并遵循后端报价范围。 +enum DroneDockPriceValidator { + /// 合法金额返回 nil,否则返回可展示的输入提示。 + static func validationMessage(for text: String) -> String? { + normalizedPrice(text) == nil ? "请输入 0.01~99999.99 元的金额,最多保留两位小数" : nil + } + + /// 将合法输入转换为固定两位小数的元字符串;拒绝指数、符号及不完整小数。 + static func normalizedPrice(_ text: String) -> String? { + let value = text.trimmingCharacters(in: .whitespacesAndNewlines) + guard value.range(of: #"^[0-9]+(?:\.[0-9]{1,2})?$"#, options: .regularExpression) != nil, + let amount = Decimal(string: value, locale: Locale(identifier: "en_US_POSIX")), isValid(amount) else { return nil } + let string = NSDecimalNumber(decimal: amount).stringValue + let parts = string.split(separator: ".", omittingEmptySubsequences: false) + if parts.count == 1 { return string + ".00" } + return string + String(repeating: "0", count: max(0, 2 - parts[1].count)) + } + + /// 验证金额处于后端支持范围且不存在超过分的精度。 + static func isValid(_ amount: Decimal) -> Bool { + guard !amount.isNaN, amount >= Decimal(string: "0.01")!, amount <= Decimal(string: "99999.99")! else { return false } + var value = amount + var rounded = Decimal() + NSDecimalRound(&rounded, &value, 2, .plain) + return amount == rounded + } +} + +/// 机巢收款字段的局部解码规则,不改变其他业务的网络解码策略。 +private extension KeyedDecodingContainer { + /// 兼容整数与整数字符串,拒绝小数、空值及越界数值。 + func paymentInteger(_ key: Key, minimum: Int? = nil) throws -> Int { + let value: Int + if let number = try? decode(Int.self, forKey: key) { value = number } + else if let text = try? decode(String.self, forKey: key), let number = Int(text) { value = number } + else { throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "需要整数或整数字符串") } + if let minimum, value < minimum { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "整数低于允许范围") + } + return value + } + + /// 兼容数字与金额字符串,拒绝非法文本和超过两位小数的金额。 + func paymentMoney(_ key: Key) throws -> Decimal { + let value: Decimal + if let text = try? decode(String.self, forKey: key) { + guard text.range(of: #"^-?[0-9]+(?:\.[0-9]{1,2})?$"#, options: .regularExpression) != nil, + let number = Decimal(string: text, locale: Locale(identifier: "en_US_POSIX")) else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "需要最多两位小数的金额") + } + value = number + } else { value = try decode(Decimal.self, forKey: key) } + var source = value + var rounded = Decimal() + NSDecimalRound(&rounded, &source, 2, .plain) + guard !value.isNaN, value == rounded else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "金额精度或数值无效") + } + return value + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockPlaneStatusModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockPlaneStatusModels.swift new file mode 100644 index 0000000..ce977c5 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockPlaneStatusModels.swift @@ -0,0 +1,104 @@ +import Foundation + +/// 朱工提供的景区无人机状态快照,推荐设备由服务端选择。 +struct DroneDockPlaneStatusResponse: Decodable, Equatable, Sendable { + /// 本次状态所属景区,必须与请求一致。 + let scenicID: Int + /// 当前景区的设备状态;空数组表示没有设备。 + let planes: [DroneDockPlaneStatus] + /// 服务端推荐设备,缺失时不在客户端另选一台。 + let recommend: DroneDockPlaneStatus? + /// 服务端是否存在空闲设备,未知时不当作 false。 + let hasIdle: Bool? + /// 服务端是否存在拍摄中的设备。 + let hasShooting: Bool? + /// 景区连接状态,缺失时仍为未知。 + let connected: Bool? + /// 服务端建议的轮询间隔;实际定时由页面生命周期控制。 + let pollHintMS: Int? + + /// 保留 plane-status 原始字段映射,不复用首页的不同状态枚举。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", planes, recommend + case hasIdle = "has_idle", hasShooting = "has_shooting", connected, pollHintMS = "poll_hint_ms" + } + + /// 校验景区和设备身份,不把缺失或错误列表当作正常空态。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + scenicID = try container.decode(DroneDockPlaneStatusInteger.self, forKey: .scenicID).value + guard scenicID > 0 else { + throw DecodingError.dataCorruptedError(forKey: .scenicID, in: container, debugDescription: "景区 ID 必须为正整数") + } + planes = try container.decode([DroneDockPlaneStatus].self, forKey: .planes) + guard Set(planes.map(\.id)).count == planes.count else { + throw DecodingError.dataCorruptedError(forKey: .planes, in: container, debugDescription: "无人机 ID 重复") + } + recommend = try container.decodeIfPresent(DroneDockPlaneStatus.self, forKey: .recommend) + hasIdle = try container.decodeIfPresent(Bool.self, forKey: .hasIdle) + hasShooting = try container.decodeIfPresent(Bool.self, forKey: .hasShooting) + connected = try container.decodeIfPresent(Bool.self, forKey: .connected) + pollHintMS = try container.decodeIfPresent(DroneDockPlaneStatusInteger.self, forKey: .pollHintMS)?.value + } +} + +/// 单台无人机的工作状态和电量,仅供准备页展示,不代表召唤许可。 +struct DroneDockPlaneStatus: Decodable, Equatable, Sendable { + /// 后端设备稳定身份。 + let id: Int + /// 设备序列号,不作为飞行任务 ID 使用。 + let snNumber: String? + /// 后端设备名称。 + let name: String? + /// 0 离线、1 空闲、2 拍摄中;其他整数原样保留。 + let workStatus: Int? + /// 后端工作状态名称。 + let workStatusLabel: String? + /// 原始电量百分比,0 与缺失分开表示。 + let batteryPercent: Int? + /// 后端格式化电量文案。 + let batteryLabel: String? + /// 后端设备可飞标记,不据此启用当前订单的召唤按钮。 + let canFly: Bool? + /// 准备页底栏优先展示的完整状态文案。 + let statusText: String? + + /// 后端字段映射。 + private enum CodingKeys: String, CodingKey { + case id, snNumber = "sn_number", name, workStatus = "work_status", workStatusLabel = "work_status_label" + case batteryPercent = "battery_percent", batteryLabel = "battery_label", canFly = "can_fly", statusText = "status_text" + } + + /// 状态允许未知,设备身份必须明确;不从电量或工作状态推导 can_fly。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.decode(DroneDockPlaneStatusInteger.self, forKey: .id).value + guard id > 0 else { + throw DecodingError.dataCorruptedError(forKey: .id, in: container, debugDescription: "无人机 ID 必须为正整数") + } + snNumber = try container.decodeIfPresent(String.self, forKey: .snNumber) + name = try container.decodeIfPresent(String.self, forKey: .name) + workStatus = try container.decodeIfPresent(DroneDockPlaneStatusInteger.self, forKey: .workStatus)?.value + workStatusLabel = try container.decodeIfPresent(String.self, forKey: .workStatusLabel) + batteryPercent = try container.decodeIfPresent(DroneDockPlaneStatusInteger.self, forKey: .batteryPercent)?.value + batteryLabel = try container.decodeIfPresent(String.self, forKey: .batteryLabel) + canFly = try container.decodeIfPresent(Bool.self, forKey: .canFly) + statusText = try container.decodeIfPresent(String.self, forKey: .statusText) + } +} + +/// 兼容整数与整数字符串,拒绝布尔值、浮点截断及非法数字。 +private struct DroneDockPlaneStatusInteger: Decodable { + let value: Int + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let number = try? container.decode(Int.self) { + value = number + } else if let text = try? container.decode(String.self), let number = Int(text) { + value = number + } else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要整数或整数字符串") + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockPreparationFailure.swift b/suixinkan/Features/DroneDock/Models/DroneDockPreparationFailure.swift new file mode 100644 index 0000000..9f2ae0d --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockPreparationFailure.swift @@ -0,0 +1,47 @@ +import Foundation + +/// 准备页的业务失败提示;区分创建与召唤,不把通用业务错误码当作未报备。 +struct DroneDockPreparationFailure: Equatable, Sendable { + /// 失败发生的提交步骤。 + enum Stage: Sendable { case creation, summon } + /// 面向工作人员的标题。 + let title: String + /// 原因及下一步操作,不包含接口 JSON。 + let message: String + /// 后端已确认的召唤业务码或明确文字指出报备问题时,额外弹出提醒。 + let requiresFiling: Bool + + /// shoot 的 41901 表示当日起飞未报备;其他接口或错误码仍仅匹配明确报备失败的文字。 + init(message: String, stage: Stage, outcomeUnknown: Bool, code: Int? = nil) { + let requiresFilingScreenshot = stage == .summon && code == 41901 + requiresFiling = !outcomeUnknown && (requiresFilingScreenshot || Self.isFilingFailure(message)) + if outcomeUnknown { + title = stage == .creation ? "任务创建结果待核对" : "召唤结果待核对" + self.message = message + } else if requiresFiling { + title = "请先完成飞行报备" + let guidance = requiresFilingScreenshot + ? "请联系相关负责人完成该无人机今日的起飞报备并提交报备截图,确认生效后再重试。" + : "请联系相关负责人核实并完成飞行报备,确认生效后再重试。" + self.message = message + "\n" + guidance + } else if stage == .summon && Self.requiresTaskReview(message) { + title = "任务已结束" + self.message = "当前任务已结束,无法直接召唤。请先查看拍摄任务状态;如需重新召唤,在任务页确认后操作。" + } else { + title = stage == .creation ? "任务创建失败" : "召唤失败" + self.message = message + } + } + + /// 仅识别实际返回的明确终止提示;不会据此自动发送 restart=true。 + static func requiresTaskReview(_ message: String) -> Bool { + message.contains("任务已结束") && message.contains("无法召唤") + } + + private static func isFilingFailure(_ message: String) -> Bool { + ["未报备", "未完成报备", "未完成起飞报备", "请先提交报备截图", "报备未", "报备失败", "报备过期", "报备已过期", + "报备失效", "报备已失效", "无有效报备", "没有报备", "无报备", "请先报备", "需要报备", + "未备案", "未完成备案", "备案未", "备案失败", "备案已过期", "请先备案"] + .contains(where: message.contains) + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockPreparationModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockPreparationModels.swift new file mode 100644 index 0000000..e2d7850 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockPreparationModels.swift @@ -0,0 +1,247 @@ +import Foundation + +/// 本次定位得到的准备页坐标;未知位置使用 nil,不以零坐标替代。 +struct DroneDockPreparationCoordinate: Equatable, Sendable { + /// 定位服务返回的纬度。 + let latitude: Double + /// 定位服务返回的经度。 + let longitude: Double + + /// 保存一次实际定位结果,发送请求前再校验有效性。 + init(latitude: Double, longitude: Double) { + self.latitude = latitude + self.longitude = longitude + } + + /// 仅接受有限且处于地理范围内的坐标,拒绝未定位时常见的零点占位。 + var isValid: Bool { + latitude.isFinite && longitude.isFinite + && (-90...90).contains(latitude) && (-180...180).contains(longitude) + && (latitude != 0 || longitude != 0) + } +} + +/// 朱工 workbench 的真实准备快照,仅描述当前订单、点位航线与服务端许可。 +struct DroneDockPreparationResponse: Decodable, Equatable, Sendable { + /// 响应所属景区。 + let scenicID: Int + /// 响应所属订单号。 + let orderNumber: String + /// 服务端最新订单进度;缺失时不沿用旧额度。 + let orderProgress: DroneDockPreparationOrderProgress? + /// 真实机巢摘要,不将它等同于已派机结果。 + let airports: [DroneDockHomeAirport] + /// 该订单的拍摄点位,保持服务端顺序。 + let spots: [DroneDockPreparationSpot] + /// 后端召唤许可快照,缺失时保持未知。 + let shootGate: DroneDockPreparationShootGate? + /// 后端规则提示原文。 + let tips: String? + + /// workbench 已验证的顶层字段。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", orderNumber = "order_number", orderProgress = "order_progress" + case airports, spots, shootGate = "shoot_gate", tips + } + + /// 严格读取订单范围和列表身份,避免坏响应伪装成成功空态或破坏 Diffable 更新。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + scenicID = try container.positivePreparationID(forKey: .scenicID) + orderNumber = try container.decode(String.self, forKey: .orderNumber) + guard !orderNumber.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { + throw DecodingError.dataCorruptedError(forKey: .orderNumber, in: container, debugDescription: "订单号不能为空") + } + orderProgress = try container.decodeIfPresent(DroneDockPreparationOrderProgress.self, forKey: .orderProgress) + if let progressOrder = orderProgress?.orderNumber, progressOrder != orderNumber { + throw DecodingError.dataCorruptedError(forKey: .orderProgress, in: container, debugDescription: "订单进度与当前订单不一致") + } + airports = try container.decode([DroneDockHomeAirport].self, forKey: .airports) + guard Set(airports.map(\.id)).count == airports.count else { + throw DecodingError.dataCorruptedError(forKey: .airports, in: container, debugDescription: "设备 ID 重复") + } + spots = try container.decode([DroneDockPreparationSpot].self, forKey: .spots) + guard Set(spots.map(\.id)).count == spots.count else { + throw DecodingError.dataCorruptedError(forKey: .spots, in: container, debugDescription: "拍摄点 ID 重复") + } + shootGate = try container.decodeIfPresent(DroneDockPreparationShootGate.self, forKey: .shootGate) + tips = try container.decodeIfPresent(String.self, forKey: .tips) + } +} + +/// 准备页服务端订单进度,不在客户端推算剩余次数或扣减额度。 +struct DroneDockPreparationOrderProgress: Decodable, Equatable, Sendable { + /// 进度所属订单号,存在时需与顶层一致。 + let orderNumber: String? + /// 服务端套餐说明。 + let packageName: String? + /// 服务端拍摄总次数。 + let shotTotal: Int? + /// 服务端已拍次数,保留合法零值。 + let shotUsed: Int? + /// 服务端剩余次数,缺失时保持未知。 + let shotRemain: Int? + /// 服务端订单状态文案。 + let statusLabel: String? + + /// 订单进度字段名。 + private enum CodingKeys: String, CodingKey { + case orderNumber = "order_number", packageName = "package_name", shotTotal = "shot_total" + case shotUsed = "shot_used", shotRemain = "shot_remain", statusLabel = "status_label" + } + + /// 兼容整数及整数字符串,同时区分未知次数与零次。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderNumber = try container.decodeIfPresent(String.self, forKey: .orderNumber) + packageName = try container.decodeIfPresent(String.self, forKey: .packageName) + shotTotal = try container.preparationCountIfPresent(forKey: .shotTotal) + shotUsed = try container.preparationCountIfPresent(forKey: .shotUsed) + shotRemain = try container.preparationCountIfPresent(forKey: .shotRemain) + statusLabel = try container.decodeIfPresent(String.self, forKey: .statusLabel) + } +} + +/// 拍摄点的服务端距离、已拍状态与可选航线;距离是否可用由请求是否带定位决定。 +struct DroneDockPreparationSpot: Decodable, Equatable, Sendable { + /// 拍摄点稳定 ID。 + let id: Int + /// 拍摄点名称。 + let name: String + /// 服务端格式化距离,不自行换算距离文案。 + let distanceLabel: String? + /// 服务端距离米数。 + let distanceM: Double? + /// 服务端范围判断,缺失时不默认在范围内。 + let inRange: Bool? + /// 本点位已拍次数。 + let shotCount: Int? + /// 本点位已拍状态文案。 + let shotStatusLabel: String? + /// 点位所属航线,按后端顺序展示。 + let airLines: [DroneDockPreparationAirLine] + + /// 已验证的点位字段名。 + private enum CodingKeys: String, CodingKey { + case id = "scenic_spot_id", name, distanceLabel = "distance_label", distanceM = "distance_m" + case inRange = "in_range", shotCount = "shot_count", shotStatusLabel = "shot_status_label", airLines = "air_lines" + } + + /// 点位和航线身份必须有效且点位内唯一,缺失距离与次数保留未知。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positivePreparationID(forKey: .id) + name = try container.decode(String.self, forKey: .name) + distanceLabel = try container.decodeIfPresent(String.self, forKey: .distanceLabel) + distanceM = try container.decodeIfPresent(DroneDockPreparationNumber.self, forKey: .distanceM)?.value + if let distanceM, distanceM < 0 { + throw DecodingError.dataCorruptedError(forKey: .distanceM, in: container, debugDescription: "距离不能为负数") + } + inRange = try container.decodeIfPresent(Bool.self, forKey: .inRange) + shotCount = try container.preparationCountIfPresent(forKey: .shotCount) + shotStatusLabel = try container.decodeIfPresent(String.self, forKey: .shotStatusLabel) + airLines = try container.decode([DroneDockPreparationAirLine].self, forKey: .airLines) + guard Set(airLines.map(\.id)).count == airLines.count else { + throw DecodingError.dataCorruptedError(forKey: .airLines, in: container, debugDescription: "点位内航线 ID 重复") + } + } +} + +/// 准备页返回的航线信息;不从飞行类型或时长推断设备执行许可。 +struct DroneDockPreparationAirLine: Decodable, Equatable, Sendable { + /// 航线稳定 ID。 + let id: Int + /// 航线名称。 + let name: String + /// 服务端预计飞行时长原值。 + let estimatedFlyTime: Int? + /// 服务端航线视频时长原值。 + let lineVideoDuration: Int? + /// 服务端飞行类型原值。 + let flyType: Int? + + /// 已验证的航线字段名。 + private enum CodingKeys: String, CodingKey { + case id = "air_line_id", name, estimatedFlyTime = "estimated_fly_time" + case lineVideoDuration = "line_video_duration", flyType = "fly_type" + } + + /// 航线 ID 必须有效,时长未知时不显示伪造零值。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positivePreparationID(forKey: .id) + name = try container.decode(String.self, forKey: .name) + estimatedFlyTime = try container.preparationCountIfPresent(forKey: .estimatedFlyTime) + lineVideoDuration = try container.preparationCountIfPresent(forKey: .lineVideoDuration) + flyType = try container.decodeIfPresent(DroneDockPreparationInteger.self, forKey: .flyType)?.value + } +} + +/// 后端召唤门禁,仅提供当前许可与原因,不等于客户端已实现或执行召唤。 +struct DroneDockPreparationShootGate: Decodable, Equatable, Sendable { + /// 后端明确允许召唤时为 true,缺失仍为未知。 + let canShoot: Bool? + /// 后端门禁代码,保留未知新值。 + let code: String? + /// 后端原因说明。 + let message: String? + /// 后端主操作标识。 + let primaryAction: String? + /// 后端主操作文案。 + let primaryActionLabel: String? + + /// 门禁字段名。 + private enum CodingKeys: String, CodingKey { + case canShoot = "can_shoot", code, message + case primaryAction = "primary_action", primaryActionLabel = "primary_action_label" + } +} + +/// 本接口整数与整数字符串的兼容读取器,不接受布尔、分数或部分数字。 +private struct DroneDockPreparationInteger: Decodable { + let value: Int + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let number = try? container.decode(Int.self) { value = number } + else if let text = try? container.decode(String.self), let number = Int(text) { value = number } + else { throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要整数或整数字符串") } + } +} + +/// 本接口距离数字的兼容读取器,不接受非有限值。 +private struct DroneDockPreparationNumber: Decodable { + let value: Double + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let number: Double + if let decoded = try? container.decode(Double.self) { number = decoded } + else if let text = try? container.decode(String.self), let decoded = Double(text) { number = decoded } + else { throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要数字或数字字符串") } + guard number.isFinite else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "数字必须为有限值") + } + value = number + } +} + +private extension KeyedDecodingContainer { + /// 读取会作为列表身份的正整数。 + func positivePreparationID(forKey key: Key) throws -> Int { + let value = try decode(DroneDockPreparationInteger.self, forKey: key).value + guard value > 0 else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "ID 必须为正整数") + } + return value + } + + /// 读取可缺失的非负次数或时长。 + func preparationCountIfPresent(forKey key: Key) throws -> Int? { + guard let value = try decodeIfPresent(DroneDockPreparationInteger.self, forKey: key)?.value else { return nil } + guard value >= 0 else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "次数或时长不能为负数") + } + return value + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockProjectInfoModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockProjectInfoModels.swift new file mode 100644 index 0000000..ea8137a --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockProjectInfoModels.swift @@ -0,0 +1,160 @@ +import Foundation + +/// 张工 project-info 的订单购买快照,权威提供次数、可选点位与航线。 +struct DroneDockProjectInfoResponse: Decodable, Equatable, Sendable { + /// 根级订单摘要,与首页 orders 使用同一业务字段和权限口径。 + let order: DroneDockHomeOrder + /// 购买快照中的点位,保持服务端顺序,不拼入其他来源的额外点位。 + let spots: [DroneDockPurchasedSpot] + + /// 购买点位数组使用单数 spot 字段。 + private enum CodingKeys: String, CodingKey { case spots = "spot" } + + /// 要求项目身份和点位数组存在,空数组才表示真实空态。 + init(from decoder: Decoder) throws { + order = try DroneDockHomeOrder(from: decoder) + guard order.projectID != nil else { + throw DecodingError.dataCorrupted(.init(codingPath: decoder.codingPath, + debugDescription: "购买快照缺少项目 ID")) + } + let container = try decoder.container(keyedBy: CodingKeys.self) + spots = try container.decode([DroneDockPurchasedSpot].self, forKey: .spots) + guard Set(spots.map(\.id)).count == spots.count else { + throw DecodingError.dataCorruptedError(forKey: .spots, in: container, debugDescription: "购买点位 ID 重复") + } + } +} + +/// 订单购买范围内的拍摄点;是否可选由 available 明确返回,不由位置或次数推导。 +struct DroneDockPurchasedSpot: Decodable, Equatable, Sendable { + /// 拍摄点稳定 ID。 + let id: Int + /// 购买快照的点位名称。 + let name: String + /// 当前点位是否可用;缺失保留未知。 + let available: Bool? + /// 点位封面地址,可缺失或为空。 + let coverURL: String? + /// 购买范围内的航线,按服务端顺序展示。 + let airLines: [DroneDockPurchasedAirLine] + + /// 卡片优先使用点位封面,缺失或无效时取本点位已购航线的第一张有效样片封面。 + var displayCoverURL: URL? { + if let url = Self.imageURL(coverURL) { return url } + for route in airLines { + for sample in route.samples { + if let url = Self.imageURL(sample.coverURL) { return url } + } + } + return nil + } + + private static func imageURL(_ value: String?) -> URL? { + guard let text = DroneDockHomeMetric.usableText(value), let url = URL(string: text), + let scheme = url.scheme?.lowercased(), ["https", "http"].contains(scheme), + let host = url.host, !host.isEmpty else { return nil } + return url + } + + /// 张工购买点位字段,不接收 workbench 的 name 作为替代。 + private enum CodingKeys: String, CodingKey { + case id = "scenic_spot_id", name = "scenic_spot_name", available + case coverURL = "cover_url", airLines = "air_lines" + } + + /// 点位与本点位航线身份必须有效且唯一,空航线数组保留为空。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positivePurchasedID(forKey: .id) + name = try container.decode(String.self, forKey: .name) + available = try container.decodeIfPresent(Bool.self, forKey: .available) + coverURL = try container.decodeIfPresent(String.self, forKey: .coverURL) + airLines = try container.decode([DroneDockPurchasedAirLine].self, forKey: .airLines) + guard Set(airLines.map(\.id)).count == airLines.count else { + throw DecodingError.dataCorruptedError(forKey: .airLines, in: container, debugDescription: "购买点位内航线 ID 重复") + } + } +} + +/// 订单已购航线及样片配置;不可用原因直接用于页面说明。 +struct DroneDockPurchasedAirLine: Decodable, Equatable, Sendable { + /// 航线稳定 ID。 + let id: Int + /// 航线名称。 + let name: String + /// 当前航线是否可用,未知不自动视为可用。 + let available: Bool? + /// 后端说明当前不可用的原因。 + let unavailableReason: String? + /// 与该购买航线关联的样片,缺失或 null 表示没有可展示样片。 + let samples: [DroneDockPurchasedSample] + + /// 张工购买航线字段。 + private enum CodingKeys: String, CodingKey { + case id = "air_line_id", name = "air_line_name", available + case unavailableReason = "unavailable_reason", samples + } + + /// 不替换未知可用状态或缺失样片地址,也不使用旧接口名称字段。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positivePurchasedID(forKey: .id) + name = try container.decode(String.self, forKey: .name) + available = try container.decodeIfPresent(Bool.self, forKey: .available) + unavailableReason = try container.decodeIfPresent(String.self, forKey: .unavailableReason) + samples = try container.decodeIfPresent([DroneDockPurchasedSample].self, forKey: .samples) ?? [] + guard Set(samples.map(\.id)).count == samples.count else { + throw DecodingError.dataCorruptedError(forKey: .samples, in: container, debugDescription: "航线内样片 ID 重复") + } + } +} + +/// 航线样片的服务端展示信息,不自行拼接预览或封面地址。 +struct DroneDockPurchasedSample: Decodable, Equatable, Sendable { + /// 样片稳定 ID。 + let id: Int + /// 样片名称,缺失时保留未知。 + let name: String? + /// 样片封面地址。 + let coverURL: String? + /// 样片视频预览地址。 + let previewURL: String? + + /// 样片字段名。 + private enum CodingKeys: String, CodingKey { + case id, name, coverURL = "cover_url", previewURL = "preview_url" + } + + /// 校验样片身份并兼容缺失、null 与空字符串的展示字段。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.positivePurchasedID(forKey: .id) + name = try container.decodeIfPresent(String.self, forKey: .name) + coverURL = try container.decodeIfPresent(String.self, forKey: .coverURL) + previewURL = try container.decodeIfPresent(String.self, forKey: .previewURL) + } +} + +/// 购买配置 ID 的整数读取器,兼容整数字符串但拒绝布尔、分数和任意文本。 +private struct DroneDockPurchasedInteger: Decodable { + let value: Int + + /// 读取确定的整数值,正数约束由字段读取处校验。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let number = try? container.decode(Int.self) { value = number } + else if let text = try? container.decode(String.self), let number = Int(text) { value = number } + else { throw DecodingError.dataCorruptedError(in: container, debugDescription: "需要整数或整数字符串") } + } +} + +private extension KeyedDecodingContainer { + /// 用于点位、航线、样片稳定身份的正整数。 + func positivePurchasedID(forKey key: Key) throws -> Int { + let value = try decode(DroneDockPurchasedInteger.self, forKey: key).value + guard value > 0 else { + throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "购买配置 ID 必须为正整数") + } + return value + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockShootModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockShootModels.swift new file mode 100644 index 0000000..17109e3 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockShootModels.swift @@ -0,0 +1,90 @@ +import Foundation + +/// 保留 shoot 原始 data,并读取明确的同任务前往回执;不补造飞机或飞行阶段字段。 +struct DroneDockShootResponse: Decodable, Equatable, Sendable { + /// 完整 data JSON;nil 表示统一客户端未提供 data,不补造 null 或空对象。 + let dataJSON: String? + + /// 保留已格式化回执;业务成功但 data 缺失或为 null 时使用 nil。 + init(dataJSON: String?) { self.dataJSON = dataJSON } + + /// 支持任意真实 JSON 值,保留未知结构、空数组、布尔值及原始字段类型。 + init(from decoder: Decoder) throws { + let raw = try DroneDockHomeJSONValue(from: decoder) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] + dataJSON = String(decoding: try encoder.encode(DroneDockShootJSONSnapshot(value: raw)), as: UTF8.self) + } + + /// 只认同一订单任务明确受理的前往阶段,用于进页过渡;回执不代表已经起飞或到达。 + func confirmsTravel(taskID: Int, orderNumber: String?, scenicID: Int) -> Bool { + guard taskID > 0, scenicID > 0, let orderNumber, !orderNumber.isEmpty, let dataJSON, + let receipt = try? JSONDecoder().decode(DroneDockSummonProgressReceipt.self, from: Data(dataJSON.utf8)), + receipt.accepted == true, receipt.ui?.phase == "going_to_spot", + receipt.orderFlightTask?.id == taskID, + receipt.orderFlightTask?.orderNumber == orderNumber, + receipt.orderFlightTask?.scenicID == scenicID else { return false } + return receipt.orderFlightTaskID == nil || receipt.orderFlightTaskID == taskID + } +} + +/// 首次召唤的已约定阶段和任务身份,仅支持显示前往中的过渡,不据此开放任何操作。 +private struct DroneDockSummonProgressReceipt: Decodable { + let accepted: Bool? + let ui: DroneDockShootingUI? + let orderFlightTaskID: Int? + let orderFlightTask: DroneDockResummonReceiptIdentity.TaskIdentity? + + /// 顶层 task_id 是航线任务,不参与订单任务匹配。 + private enum CodingKeys: String, CodingKey { + case accepted, ui, orderFlightTaskID = "order_flight_task_id", orderFlightTask = "order_flight_task" + } +} + +/// 重新召唤回执中可核对的订单任务身份;顶层 task_id 属于实际航线任务,不作订单任务 ID 使用。 +struct DroneDockResummonReceiptIdentity: Decodable, Sendable { + /// 后端明确回显的订单飞行任务 ID,缺失时由后续 shooting 核对。 + let orderFlightTaskID: Int? + /// 后端已提供的订单任务摘要身份。 + let orderFlightTask: TaskIdentity? + /// 已锁定任务的飞机 ID;实际提供时核对是否仍为原任务飞机。 + let planeID: Int? + + /// 只读取已约定的订单任务身份字段。 + private enum CodingKeys: String, CodingKey { + case orderFlightTaskID = "order_flight_task_id", orderFlightTask = "order_flight_task", planeID = "plane_id" + } + + /// 嵌套订单任务的可选身份字段,不读取或推断设备执行阶段。 + struct TaskIdentity: Decodable, Sendable { + /// 原订单飞行任务 ID。 + let id: Int? + /// 任务所属订单。 + let orderNumber: String? + /// 任务所属景区。 + let scenicID: Int? + + /// 订单任务摘要字段映射。 + private enum CodingKeys: String, CodingKey { + case id, orderNumber = "order_number", scenicID = "scenic_id" + } + } +} + +/// 将现有 JSON 值解码结果格式化,完整保留 shoot 尚未约定的成功数据结构。 +private struct DroneDockShootJSONSnapshot: Encodable { + let value: DroneDockHomeJSONValue + + /// 按真实 JSON 类型编码,不推导任务身份或追加外层业务字段。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch value { + case .object(let object): try container.encode(object.mapValues { DroneDockShootJSONSnapshot(value: $0) }) + case .array(let array): try container.encode(array.map { DroneDockShootJSONSnapshot(value: $0) }) + case .string(let text): try container.encode(text) + case .number(let number): try container.encode(number) + case .bool(let flag): try container.encode(flag) + case .null: try container.encodeNil() + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockShootingModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockShootingModels.swift new file mode 100644 index 0000000..1b5cea9 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockShootingModels.swift @@ -0,0 +1,281 @@ +import Foundation + +/// 朱工 shooting 的只读快照;完整 data 用于展示,不表示已召唤或已开始拍摄。 +struct DroneDockShootingResponse: Decodable, Equatable, Sendable { + /// HTTP/推送共用的顶层任务身份。 + let orderFlightTaskID: Int? + /// 同一执行批次下递增的完整快照版本。 + let stateVersion: Int64? + /// 当前航线执行批次,先比较批次再比较版本,防止重召唤后的旧数据回退。 + let executionBatch: Int64? + /// 第一版只接收 full 完整推送。 + let snapshotKind: String? + /// 后端状态写入时间,不能作为设备读数采集时间。 + let stateUpdatedAt: String? + /// 设备读数采集时间,用于显示来源和核对缓存。 + let metricsUpdatedAt: String? + /// 设备缓存过期时保留数值,但标为非实时读数。 + let metricsStale: Bool? + /// 后端确认本批次正常拍完并开始返航;缺失表示旧合同,不能从工作态忙闲推断。 + let shootCompleteReturning: Bool? + /// 后端若明确提供订单号则保留,不由请求上下文伪造响应身份。 + let orderNumber: String? + /// 实测返回的订单飞行任务身份;存在时必须与请求上下文核对。 + let orderFlightTask: DroneDockShootingTaskIdentity? + /// 实测返回的任务摘要,不以其状态推导控制动作。 + let task: DroneDockShootingTaskIdentity? + /// 拍摄任务关联的景区信息。 + let scenic: DroneDockShootingPlace? + /// 拍摄任务关联的点位信息。 + let scenicSpot: DroneDockShootingPlace? + /// 拍摄任务关联的航线信息。 + let airLine: DroneDockShootingAirLine? + /// 服务端给出的页面标题、游客及套餐文案。 + let header: DroneDockShootingHeader? + /// 服务端给出的当前设备,不由准备页推荐设备替代。 + let currentPlane: DroneDockShootingPlane? + /// 六项读数使用后端格式化文案,保留未知值与真实零值。 + let metrics: [DroneDockHomeMetric] + /// 景区设备连接与轮询建议,不在客户端改选推荐飞机。 + let planeStatus: DroneDockShootingPlaneStatus? + /// 执行门禁参与展示和开拍校验,缺失许可时不开放操作。 + let executeGate: DroneDockShootingExecuteGate? + /// 重召唤许可独立于开拍门禁,缺失不视为允许。 + let restartGate: DroneDockShootingRestartGate? + /// 当前批次设备执行状态与逐项权限,不依赖服务端显示文案。 + let flightControl: DroneDockFlightControl? + /// 服务端拍摄阶段和页面提示。 + let ui: DroneDockShootingUI? + /// 完整 data 的格式化 JSON,保留未知字段、空值及原 JSON 类型。 + let dataJSON: String + + /// 只映射已知展示字段,不假设响应中的任务 ID 位置。 + private enum CodingKeys: String, CodingKey { + case orderFlightTaskID = "order_flight_task_id", stateVersion = "state_version" + case executionBatch = "execution_batch", snapshotKind = "snapshot_kind" + case stateUpdatedAt = "state_updated_at", metricsUpdatedAt = "metrics_updated_at", metricsStale = "metrics_stale" + case shootCompleteReturning = "shoot_complete_returning" + case orderNumber = "order_number", orderFlightTask = "order_flight_task", task + case scenic, scenicSpot = "scenic_spot", airLine = "air_line" + case header, currentPlane = "current_plane", executeGate = "execute_gate", ui + case restartGate = "restart_gate", flightControl = "flight_control" + case metrics, planeStatus = "plane_status" + } + + /// 可选字段缺失或为 null 时保持未知;不把缺失执行门禁推断为允许。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderFlightTaskID = try container.decodeIfPresent(Int.self, forKey: .orderFlightTaskID) + stateVersion = try container.decodeIfPresent(Int64.self, forKey: .stateVersion) + executionBatch = try container.decodeIfPresent(Int64.self, forKey: .executionBatch) + snapshotKind = try container.decodeIfPresent(String.self, forKey: .snapshotKind) + stateUpdatedAt = try container.decodeIfPresent(String.self, forKey: .stateUpdatedAt) + metricsUpdatedAt = try container.decodeIfPresent(String.self, forKey: .metricsUpdatedAt) + metricsStale = try container.decodeIfPresent(Bool.self, forKey: .metricsStale) + shootCompleteReturning = try container.decodeIfPresent(Bool.self, forKey: .shootCompleteReturning) + orderNumber = try container.decodeIfPresent(String.self, forKey: .orderNumber) + orderFlightTask = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .orderFlightTask) + task = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .task) + scenic = try container.decodeIfPresent(DroneDockShootingPlace.self, forKey: .scenic) + scenicSpot = try container.decodeIfPresent(DroneDockShootingPlace.self, forKey: .scenicSpot) + airLine = try container.decodeIfPresent(DroneDockShootingAirLine.self, forKey: .airLine) + header = try container.decodeIfPresent(DroneDockShootingHeader.self, forKey: .header) + currentPlane = try container.decodeIfPresent(DroneDockShootingPlane.self, forKey: .currentPlane) + metrics = try container.decodeIfPresent([DroneDockHomeMetric].self, forKey: .metrics) ?? [] + planeStatus = try container.decodeIfPresent(DroneDockShootingPlaneStatus.self, forKey: .planeStatus) + executeGate = try container.decodeIfPresent(DroneDockShootingExecuteGate.self, forKey: .executeGate) + restartGate = try container.decodeIfPresent(DroneDockShootingRestartGate.self, forKey: .restartGate) + flightControl = try container.decodeIfPresent(DroneDockFlightControl.self, forKey: .flightControl) + ui = try container.decodeIfPresent(DroneDockShootingUI.self, forKey: .ui) + let raw = try DroneDockHomeJSONValue(from: decoder) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] + dataJSON = String(decoding: try encoder.encode(DroneDockShootingJSONSnapshot(value: raw)), as: UTF8.self) + } +} + +/// shooting 实测返回的已有任务身份和状态摘要,各身份仅在实际提供时参与核对。 +struct DroneDockShootingTaskIdentity: Decodable, Equatable, Sendable { + /// 订单飞行任务 ID。 + let id: Int? + /// 任务所属订单号。 + let orderNumber: String? + /// 任务所属景区。 + let scenicID: Int? + /// 订单飞行任务状态:10 待执行、20 执行中、25 素材上传中、30 成功、40 失败、50 取消、60 待确认。 + let status: Int? + /// 服务端任务状态文案。 + let statusLabel: String? + /// 航线状态独立保留:29/39/49/91 失败,90 取消,24/30/40 为录制后的素材处理。 + let waylineStatus: Int? + /// 服务端航线状态文案;执行失败优先于笼统的订单任务执行中。 + let waylineStatusLabel: String? + /// 服务端实际记录的任务结果原因,空值不视为具体失败说明。 + let resultMessage: String? + /// 任务结果原因码;return_home 表示手动返航中断,不能展示正常拍完提示。 + let resultCode: String? + + /// 已确认嵌套任务字段映射。 + private enum CodingKeys: String, CodingKey { + case id, orderNumber = "order_number", scenicID = "scenic_id", status, statusLabel = "status_label" + case waylineStatus = "wayline_status", waylineStatusLabel = "wayline_status_label" + case resultMessage = "result_message" + case resultCode = "result_code" + } +} + +/// shooting 的设备轮询提示与连接结果;缺失布尔保持未知。 +struct DroneDockShootingPlaneStatus: Decodable, Equatable, Sendable { + /// 后端实际提供的设备列表所属景区。 + let scenicID: Int? + /// 后端景区连接状态。 + let connected: Bool? + /// 后端建议轮询间隔,任务页校验并限制频率后使用。 + let pollHintMS: Int? + + /// 设备快照字段映射,其余字段仍保留在完整 dataJSON 中。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", connected, pollHintMS = "poll_hint_ms" + } +} + +/// shooting 返回的景区或点位信息,缺失身份不由客户端补齐。 +struct DroneDockShootingPlace: Decodable, Equatable, Sendable { + /// 服务端场景身份,未知时为 nil。 + let id: Int? + /// 服务端显示名称。 + let name: String? +} + +/// shooting 返回的航线及其所属点位。 +struct DroneDockShootingAirLine: Decodable, Equatable, Sendable { + /// 服务端航线身份。 + let id: Int? + /// 服务端航线名称。 + let name: String? + /// 航线所属点位,不用于推导当前任务 ID。 + let scenicSpotID: Int? + + /// 航线字段映射。 + private enum CodingKeys: String, CodingKey { case id, name, scenicSpotID = "scenic_spot_id" } +} + +/// shooting 拍摄页的服务端摘要文案。 +struct DroneDockShootingHeader: Decodable, Equatable, Sendable { + /// 实测摘要返回的订单身份,不能忽略其与请求订单的一致性。 + let orderNumber: String? + /// 页面主标题。 + let title: String? + /// 服务端提供的游客显示文案。 + let touristLabel: String? + /// 订单套餐显示文案。 + let packageName: String? + + /// 页面摘要字段映射。 + private enum CodingKeys: String, CodingKey { + case orderNumber = "order_number", title, touristLabel = "tourist_label", packageName = "package_name" + } +} + +/// shooting 当前设备的展示信息,不代表调用方已发送飞行指令。 +struct DroneDockShootingPlane: Decodable, Equatable, Sendable { + /// 当前设备身份。 + let id: Int? + /// 当前设备序列号。 + let snNumber: String? + /// 飞机表在线标记:1 在线,0/2 等非 1 为离线;不覆盖明确的机巢工作态。 + let onlineStatus: Int? + /// 文档工作状态:0 离线、1 空闲、2 拍摄中;不据此推断返航完成。 + let workStatus: Int? + /// 服务端工作状态文案。 + let workStatusLabel: String? + /// 服务端完整状态文案。 + let statusText: String? + + /// 当前设备字段映射。 + private enum CodingKeys: String, CodingKey { + case id, snNumber = "sn_number", workStatusLabel = "work_status_label", statusText = "status_text" + case onlineStatus = "online_status", workStatus = "work_status" + } +} + +/// shooting 执行门禁的原始结果;false 与未知分别保留。 +struct DroneDockShootingExecuteGate: Decodable, Equatable, Sendable { + /// 服务端明确的执行许可,不从文案或 action 推导。 + let canExecute: Bool? + /// 服务端门禁原因码。 + let code: String? + /// 服务端门禁说明。 + let message: String? + /// 服务端建议动作;本地模拟开拍要求明确为 start_shoot。 + let primaryAction: String? + /// 服务端建议动作名称。 + let primaryActionLabel: String? + + /// 门禁字段映射。 + private enum CodingKeys: String, CodingKey { + case canExecute = "can_execute", code, message + case primaryAction = "primary_action", primaryActionLabel = "primary_action_label" + } +} + +/// shooting 返回的拍摄阶段显示信息。 +struct DroneDockShootingUI: Decodable, Equatable, Sendable { + /// 原始阶段标识,未知值原样保留。 + let phase: String? + /// 服务端页面提示。 + let title: String? + /// 服务端阶段说明,不由 GET 请求成功拼造飞行进度。 + let message: String? + /// 拍摄环节子阶段,shoot_done_returning 表示正常拍完后开始返航。 + let waylineStage: String? + /// 页面层的正常拍完返航标记,和顶层字段共同保留。 + let shootCompleteReturning: Bool? + /// 服务端实际提供的安全指令;缺失时保持未知,不据阶段文案自行补齐。 + let commands: [DroneDockShootingCommand]? + + /// 保留既有展示构造方式,新增动作列表默认为未知。 + init(phase: String?, title: String?, message: String?, commands: [DroneDockShootingCommand]? = nil, + waylineStage: String? = nil, shootCompleteReturning: Bool? = nil) { + self.phase = phase + self.title = title + self.message = message + self.commands = commands + self.waylineStage = waylineStage + self.shootCompleteReturning = shootCompleteReturning + } + + /// 保留现有页面字段,并映射新增返航标记的原始命名。 + private enum CodingKeys: String, CodingKey { + case phase, title, message, commands + case waylineStage = "wayline_stage", shootCompleteReturning = "shoot_complete_returning" + } +} + +/// shooting 或 start-shoot 的指令展示项;原始字符串保留,执行时另作白名单校验。 +struct DroneDockShootingCommand: Decodable, Equatable, Sendable { + /// 服务端指令码,未知值不应开放动作。 + let command: String? + /// 服务端按钮标题。 + let label: String? + /// 服务端按钮副标题。 + let sub: String? +} + +/// 将现有 JSON 值解码结果重新格式化,完整保留 shooting 的未建模字段。 +private struct DroneDockShootingJSONSnapshot: Encodable { + let value: DroneDockHomeJSONValue + + /// 保留字符串、数字、布尔、null 及嵌套结构,不添加外层业务包裹。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch value { + case .object(let object): try container.encode(object.mapValues { DroneDockShootingJSONSnapshot(value: $0) }) + case .array(let array): try container.encode(array.map { DroneDockShootingJSONSnapshot(value: $0) }) + case .string(let text): try container.encode(text) + case .number(let number): try container.encode(number) + case .bool(let flag): try container.encode(flag) + case .null: try container.encodeNil() + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockShootingSocketMessage.swift b/suixinkan/Features/DroneDock/Models/DroneDockShootingSocketMessage.swift new file mode 100644 index 0000000..558bb0b --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockShootingSocketMessage.swift @@ -0,0 +1,103 @@ +import Foundation +import CoreFoundation + +/// HTTP 和 WebSocket 共用的快照接收结果;重复包可证明订阅有效,但旧包不能恢复实时状态。 +enum DroneDockSnapshotAcceptance { + case applied, duplicate, outdated, invalid +} + +/// 本次 HTTP 实际读取且已通过业务校验的结果,不用页面保留的旧快照证明订阅首包。 +struct DroneDockHTTPSnapshotResult { + let snapshot: DroneDockShootingResponse + let acceptance: DroneDockSnapshotAcceptance +} + +/// 先解析业务码再解析 data,兼容订阅失败时 data=[]。 +enum DroneDockShootingSocketMessage { + case opened + case subscribed(taskID: Int) + case subscriptionMetadata(taskID: Int, hasSnapshot: Bool, executionBatch: Int?) + case snapshot(DroneDockShootingResponse) + case subscriptionTimedOut(message: String) + case subscriptionRejected(code: Int, message: String) + case rejected(code: Int, message: String) + case unrelated + + /// 按新版协议解析 100000 成功包,欢迎帧仅用于触发 310,不代表订阅成功。 + static func decode(_ data: Data) throws -> Self { + // 服务端建连先发 Opened。它不代表 310 订阅成功,也不能取消订阅超时或 HTTP 兜底。 + if String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) == "Opened" { + return .opened + } + let json = try JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed) + if json as? String == "Opened" { return .opened } + guard let root = json as? [String: Any], + let code = root["code"] as? Int else { throw APIError.invalidResponse } + // 鉴权硬超时是服务暂不可用。合同以正式失败回执的 hint 标识,未约定专用错误码; + // 即使返回 100099,也不能按无权限永久关闭 HTTP 和 Socket 读取。 + if let body = root["data"] as? [String: Any], + body["type"] as? Int == 310, body["ack"] as? String == "subscribe", + boolean(body["subscribed"]) == false, + let hint = body["hint"] as? String, hint.contains("鉴权超时") { + return .subscriptionTimedOut(message: hint.trimmingCharacters(in: .whitespacesAndNewlines)) + } + if code != 100000 { + let message = root["msg"] as? String ?? "任务订阅失败" + if let body = root["data"] as? [String: Any], + body["type"] as? Int == 310, body["ack"] as? String == "subscribe", + boolean(body["subscribed"]) == false { + return .subscriptionRejected(code: code, message: message) + } + return .rejected(code: code, message: message) + } + guard let body = root["data"] as? [String: Any] else { throw APIError.invalidResponse } + if let ack = body["ack"] as? String { + // 只有正式 subscribe 确认订阅;诊断、元数据和未知 ack 都不能冒充正式结果。 + guard body["type"] as? Int == 310 else { return .unrelated } + switch ack { + case "subscribe": + guard let subscribed = boolean(body["subscribed"]) else { throw APIError.invalidResponse } + guard subscribed else { + return .subscriptionRejected(code: code, message: root["msg"] as? String ?? "任务订阅失败") + } + guard let id = body["order_flight_task_id"] as? Int, id > 0 else { throw APIError.invalidResponse } + // 此时尚未读缓存,has_snapshot=null 表示未判定,不等于没有快照。 + return .subscribed(taskID: id) + case "subscribe_meta": + guard boolean(body["subscribed"]) == true, + let id = body["order_flight_task_id"] as? Int, id > 0, + let hasSnapshot = boolean(body["has_snapshot"]) else { return .unrelated } + return .subscriptionMetadata(taskID: id, hasSnapshot: hasSnapshot, + executionBatch: (body["execution_batch"] as? Int).flatMap { $0 > 0 ? $0 : nil }) + default: + return .unrelated + } + } + guard body["action"] as? String == "app_airport_shooting_updated" else { return .unrelated } + guard let params = body["params"] as? [String: Any] else { throw APIError.invalidResponse } + let value = try JSONDecoder().decode(DroneDockShootingResponse.self, + from: JSONSerialization.data(withJSONObject: params)) + guard value.orderFlightTaskID != nil, value.snapshotKind == "full", + let version = value.stateVersion, version > 0, + let batch = value.executionBatch, batch >= 0, value.ui?.phase != nil else { + throw APIError.decodeFailed("任务推送缺少完整快照或版本信息") + } + return .snapshot(value) + } + + /// JSON 数值 0/1 不能通过 NSNumber 桥接冒充布尔字段。 + private static func boolean(_ value: Any?) -> Bool? { + guard let number = value as? NSNumber, CFGetTypeID(number) == CFBooleanGetTypeID() else { return nil } + return number.boolValue + } + + /// 构造已确认的只读订阅协议,不暴露任意 type 的发送入口。 + static func subscribe(taskID: Int, token: String) -> String { + DroneDockDiagnostics.json(["type": 310, "params": ["id": taskID, "socket_token": token]]) + } + + /// 离页尽力取消订阅;断开连接也会清除服务端 fd 订阅。 + static func unsubscribe(taskID: Int) -> String { + DroneDockDiagnostics.json(["type": 311, "params": ["id": taskID]]) + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockStartShootModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockStartShootModels.swift new file mode 100644 index 0000000..8dea5fc --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockStartShootModels.swift @@ -0,0 +1,58 @@ +import Foundation + +/// start-shoot 的受理回执;不凭请求成功推断飞行、拍摄或素材已完成。 +struct DroneDockStartShootResponse: Decodable, Equatable, Sendable { + /// 文档约定的订单飞行任务 ID,API 必须核对其与请求一致。 + let orderFlightTaskID: Int? + /// 服务端提供的任务摘要,嵌套身份存在时同样参与核对。 + let orderFlightTask: DroneDockShootingTaskIdentity? + /// 当前任务锁定的飞机,不由客户端选择或覆盖。 + let planeID: Int? + /// 服务端任务 UUID,用于后续核对,不等于订单飞行任务 ID。 + let taskUUID: String? + /// 服务端返回的机场标识,仅保留已有值。 + let airportSN: String? + /// 服务端受理后的阶段文案,最新设备状态由 shooting 单次回查确认。 + let ui: DroneDockShootingUI? + /// 完整 data 的格式化 JSON,保留未知字段与原始类型供模拟联调展示。 + let dataJSON: String + + /// 朱工开拍回执字段映射。 + private enum CodingKeys: String, CodingKey { + case orderFlightTaskID = "order_flight_task_id", orderFlightTask = "order_flight_task" + case planeID = "plane_id", taskUUID = "task_uuid", airportSN = "airport_sn", ui + } + + /// 仅解析响应实际提供的字段,不补造任务身份或成功状态。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + orderFlightTaskID = try container.decodeIfPresent(Int.self, forKey: .orderFlightTaskID) + orderFlightTask = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .orderFlightTask) + planeID = try container.decodeIfPresent(Int.self, forKey: .planeID) + taskUUID = try container.decodeIfPresent(String.self, forKey: .taskUUID) + airportSN = try container.decodeIfPresent(String.self, forKey: .airportSN) + ui = try container.decodeIfPresent(DroneDockShootingUI.self, forKey: .ui) + let raw = try DroneDockHomeJSONValue(from: decoder) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] + dataJSON = String(decoding: try encoder.encode(DroneDockStartShootJSONSnapshot(value: raw)), as: UTF8.self) + } +} + +/// 将已有 JSON 值完整格式化,不给模拟响应添加后端未提供的字段。 +private struct DroneDockStartShootJSONSnapshot: Encodable { + let value: DroneDockHomeJSONValue + + /// 保留字符串、数字、布尔、空值和嵌套对象,不追加业务码包裹。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch value { + case .object(let object): try container.encode(object.mapValues { DroneDockStartShootJSONSnapshot(value: $0) }) + case .array(let array): try container.encode(array.map { DroneDockStartShootJSONSnapshot(value: $0) }) + case .string(let text): try container.encode(text) + case .number(let number): try container.encode(number) + case .bool(let flag): try container.encode(flag) + case .null: try container.encodeNil() + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockTaskCreationModels.swift b/suixinkan/Features/DroneDock/Models/DroneDockTaskCreationModels.swift new file mode 100644 index 0000000..d67d1c8 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockTaskCreationModels.swift @@ -0,0 +1,54 @@ +import Foundation + +/// 张工创建待飞任务的回执,保留最新订单摘要和完整 data 字段供联调展示。 +struct DroneDockCreatedTask: Decodable, Equatable, Sendable { + /// 后端创建的订单飞行任务 ID,后续召唤应复用该任务。 + let taskID: Int + /// 创建后的权威订单摘要,待飞任务不由客户端扣减次数。 + let order: DroneDockHomeOrder + /// 格式化后的完整 data JSON;不添加或伪造外层 code、msg、time。 + let dataJSON: String + + /// 创建任务回执的必需身份字段。 + private enum CodingKeys: String, CodingKey { case taskID = "task_id" } + + /// 任务身份允许整数字符串,但必须为正整数;额外字段保留原 JSON 类型。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + if let value = try? container.decode(Int.self, forKey: .taskID) { + taskID = value + } else if let text = try? container.decode(String.self, forKey: .taskID), let value = Int(text) { + taskID = value + } else { + throw DecodingError.dataCorruptedError(forKey: .taskID, in: container, debugDescription: "创建任务未返回有效任务 ID") + } + guard taskID > 0 else { + throw DecodingError.dataCorruptedError(forKey: .taskID, in: container, debugDescription: "创建任务返回的任务 ID 必须为正整数") + } + order = try DroneDockHomeOrder(from: decoder) + let rawData = try DroneDockHomeJSONValue(from: decoder) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] + dataJSON = String(decoding: try encoder.encode(DroneDockTaskJSONSnapshot(value: rawData)), as: UTF8.self) + } +} + +/// 复用现有 JSON 值解码器,将回执 data 格式化,保留未建模字段和空值。 +private struct DroneDockTaskJSONSnapshot: Encodable { + let value: DroneDockHomeJSONValue + + /// JSON 类型保持不变,数字使用 Decimal 避免先转换为 Double 丢失精度。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch value { + case .object(let object): + try container.encode(object.mapValues { DroneDockTaskJSONSnapshot(value: $0) }) + case .array(let array): + try container.encode(array.map { DroneDockTaskJSONSnapshot(value: $0) }) + case .string(let text): try container.encode(text) + case .number(let number): try container.encode(number) + case .bool(let flag): try container.encode(flag) + case .null: try container.encodeNil() + } + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockTaskPresentation.swift b/suixinkan/Features/DroneDock/Models/DroneDockTaskPresentation.swift new file mode 100644 index 0000000..86caae4 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockTaskPresentation.swift @@ -0,0 +1,86 @@ +import Foundation + +/// 真实任务页的显示阶段;未确认或冲突数据保持未知,不代表客户端已发送控制指令。 +enum DroneDockTaskDisplayPhase: String, Equatable, Sendable { + /// 正在读取任务。 + case loading + /// 服务端明确正在前往拍摄点。 + case navigating + /// 服务端明确已到达且允许开始。 + case ready + /// 服务端明确正在拍摄。 + case shooting + /// 录制已结束,素材仍在下载、上传或渲染,尚未就绪。 + case postShootUploading + /// 录制已结束,但素材上传或渲染失败;可查看素材,不代表可重新召唤。 + case postShootUploadFailed + /// 服务端明确已暂停。 + case paused + /// 服务端明确正在返航。 + case returning + /// 明确返回机巢,本次拍摄仍为中断结果。 + case returned + /// 服务端明确任务已完成。 + case completed + /// 已确认的任务或航线执行失败。 + case failed + /// 服务端阻止执行或任务已取消。 + case blocked + /// 尚无足够信息确定阶段。 + case unknown + /// 当前读取失败,不能沿用旧阶段。 + case readError +} + +/// 本地状态区的动作,实际执行受操作服务、设备许可和防重复提交门禁共同约束。 +enum DroneDockTaskDisplayAction: Equatable, Sendable { + /// 重新读取同一任务。 + case refresh + /// 同一任务的开始拍摄动作。 + case start + /// 继续已暂停的任务,包括恢复返航;实际许可由设备状态和操作锁决定。 + case resume + /// 设备已回巢且后端门禁允许后的重新召唤。 + case retry + /// 查看已明确完成任务的订单素材。 + case materials + /// 当前无主动作。 + case none +} + +/// 状态区的纯展示数据,供固定区域布局使用,不依赖 UIKit 或虚构进度。 +struct DroneDockTaskPresentation: Equatable, Sendable { + /// 当前可信显示阶段。 + let phase: DroneDockTaskDisplayPhase + /// 阶段标题。 + let title: String + /// 本地阶段说明或实际失败原因,完整文字可由界面展开。 + let message: String + /// 当前任务设备的状态文案。 + let deviceStatus: String + /// 本轮允许展示的主动作。 + let action: DroneDockTaskDisplayAction + /// 主动作名称,无动作时为 nil。 + let actionTitle: String? + /// 是否可触发动作;禁用状态仍可保留按钮作为进度提示。 + let isActionEnabled: Bool + /// 主动作下方的真实设备限制说明,未提供时不展示。 + let actionNote: String? + /// 已到达阶段的本地展示倒计时;零秒不表示后端已经开始拍摄。 + let countdownSeconds: Int? + + /// 创建状态展示;动作提示默认为空,既有非失败状态保持原布局。 + init(phase: DroneDockTaskDisplayPhase, title: String, message: String, deviceStatus: String, + action: DroneDockTaskDisplayAction, actionTitle: String?, isActionEnabled: Bool, actionNote: String? = nil, + countdownSeconds: Int? = nil) { + self.phase = phase + self.title = title + self.message = message + self.deviceStatus = deviceStatus + self.action = action + self.actionTitle = actionTitle + self.isActionEnabled = isActionEnabled + self.actionNote = actionNote + self.countdownSeconds = countdownSeconds + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneDockTaskTraceFields.swift b/suixinkan/Features/DroneDock/Models/DroneDockTaskTraceFields.swift new file mode 100644 index 0000000..f4c1826 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneDockTaskTraceFields.swift @@ -0,0 +1,71 @@ +import Foundation + +/// 标记完整任务快照实际进入 App 的通道,避免把 HTTP 与 WS 的先后关系混淆。 +enum DroneDockTaskSnapshotSource: String, Sendable { + case http, webSocket = "websocket", unspecified +} + +/// 任务诊断摘要保留状态原值和明确身份;完整原始 JSON 仍由原网络日志输出。 +enum DroneDockTaskTraceFields { + /// 把可选值表示为 JSON null,不把缺失的设备证据补成 false 或零。 + static func value(_ value: T?) -> Any { value.map { $0 as Any } ?? NSNull() } + + /// 对照后端业务阶段、飞控事实、门禁及读数来源,不重写响应对象。 + static func snapshot(_ snapshot: DroneDockShootingResponse?) -> [String: Any] { + guard let snapshot else { return ["snapshot_present": false] } + let control = snapshot.flightControl + let raw = (try? JSONSerialization.jsonObject(with: Data(snapshot.dataJSON.utf8))) as? [String: Any] + let rawControl = raw?["flight_control"] as? [String: Any] + return [ + "snapshot_present": true, "order_flight_task_id": value(snapshot.orderFlightTaskID), + "task_id": value(snapshot.task?.id), "oft_id": value(snapshot.orderFlightTask?.id), + "execution_batch": value(snapshot.executionBatch), "state_version": value(snapshot.stateVersion), + "ui_phase": value(snapshot.ui?.phase), "task_status": value(snapshot.task?.status), + "oft_status": value(snapshot.orderFlightTask?.status), + "wayline_status": value(snapshot.task?.waylineStatus), + "oft_wayline_status": value(snapshot.orderFlightTask?.waylineStatus), + "result_code": value(snapshot.orderFlightTask?.resultCode ?? snapshot.task?.resultCode), + "plane_id": value(snapshot.currentPlane?.id), "airport_sn": value(snapshot.currentPlane?.snNumber), + "work_status": value(snapshot.currentPlane?.workStatus), + "flight_control": ["state": value(control?.state), + "resolved_state": control?.resolvedState(for: snapshot.executionBatch).rawValue ?? "unknown", + "execution_batch": value(control?.executionBatch), "is_airborne": value(control?.isAirborne), + "dji_task_status": value(control?.djiTaskStatus), + "pause_reason": value(control?.pauseReason), "resume_phase": value(control?.resumePhase), + "return_reason": value(control?.returnReason), "drone_in_dock": value(control?.droneInDock), + "can_pause": value(control?.canPause), "can_resume": value(control?.canResume), + "can_return_home": value(control?.canReturnHome), + "evidence": rawControl?["evidence"] ?? NSNull(), + "pending_command": progress(control?.pendingCommand)], + "can_start": value(snapshot.executeGate?.canExecute), "start_gate_code": value(snapshot.executeGate?.code), + "can_restart": value(snapshot.restartGate?.canRestart), "restart_gate_code": value(snapshot.restartGate?.code), + "metrics_count": snapshot.metrics.count, "metrics_stale": value(snapshot.metricsStale), + "metrics_updated_at": value(snapshot.metricsUpdatedAt), + "metrics": raw?["metrics"] ?? NSNull(), + "metric_display_values": snapshot.metrics.map { ["key": $0.key, "value": $0.displayText] } + ] + } + + /// 回执和快照共用的指令标识摘要,可与 client_request_id、command_id 逐条对应。 + static func progress(_ progress: DroneDockCommandProgress?) -> Any { + guard let progress else { return NSNull() } + return ["command_id": value(progress.commandID), "client_request_id": value(progress.clientRequestID), + "command": value(progress.command), "status": value(progress.status), "message": value(progress.message)] + } + + /// 召唤回执只摘录身份和阶段,记录是否存在初始前往状态依据。 + static func summon(_ receipt: DroneDockShootResponse?) -> [String: Any] { + guard let text = receipt?.dataJSON, + let object = try? JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String: Any] else { + return ["receipt_present": receipt != nil, "data_present": false] + } + var result: [String: Any] = ["receipt_present": true, "data_present": true] + for key in ["accepted", "order_flight_task_id", "task_id", "execution_batch", "state_version", "plane_id", "airport_sn", "ui", "flight_control"] { + result[key] = object[key] ?? NSNull() + } + if let task = object["order_flight_task"] as? [String: Any] { + result["order_flight_task"] = task.filter { ["id", "order_number", "scenic_id", "status", "wayline_task_id"].contains($0.key) } + } + return result + } +} diff --git a/suixinkan/Features/DroneDock/Models/DroneMaterialModels.swift b/suixinkan/Features/DroneDock/Models/DroneMaterialModels.swift new file mode 100644 index 0000000..ca1a347 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneMaterialModels.swift @@ -0,0 +1,252 @@ +import Foundation + +/// 素材内容类型,不把视频封面当作可播放视频。 +enum DroneMaterialKind: Hashable, Sendable { + case photo, video + + /// 素材类型展示名称。 + var title: String { self == .photo ? "照片" : "视频" } +} + +/// 云端上传状态独立于本机下载、相册保存和游客交付。 +enum DroneMaterialUploadState: Hashable, Sendable { + case uploading, ready, failed, unavailable + + /// 上传状态名称;上传中不展示虚构百分比。 + var title: String { + switch self { + case .uploading: "上传中" + case .ready: "上传完成" + case .failed: "上传失败" + case .unavailable: "素材不可用" + } + } +} + +/// 单文件下载和保存阶段;演示完成不能冒充实际写入相册。 +enum DroneMaterialDownloadState: Hashable, Sendable { + case available + case downloading(progress: Double) + case paused + case downloadFailed(message: String) + case awaitingSave + case saving + case saveFailed(message: String) + case completed(isSimulation: Bool) + + /// 只有本设备真实保存回执才能使用非演示完成状态。 + var isCompleted: Bool { + if case .completed = self { return true } + return false + } + + /// 下载失败与保存失败均可单独重试,权限拒绝不归入失败。 + var isFailed: Bool { + switch self { + case .downloadFailed, .saveFailed: true + default: false + } + } + + /// 当前文件是否仍在执行本地传输或保存。 + var isRunning: Bool { + switch self { + case .downloading, .awaitingSave, .saving: true + default: false + } + } + + /// 单文件状态文案。 + var title: String { + switch self { + case .available: "上传完成 · 可下载" + case .downloading: "下载中" + case .paused: "下载已暂停" + case .downloadFailed: "下载失败" + case .awaitingSave: "下载完成 · 待保存" + case .saving: "正在演示保存" + case .saveFailed: "保存失败" + case .completed(let isSimulation): isSimulation ? "演示完成 · 未写入相册" : "本机已保存" + } + } +} + +/// 单条原素材;预览使用本地资源,不请求真实素材接口。 +struct DroneMaterial: Hashable, Sendable { + /// 在订单中稳定且唯一的素材标识。 + let id: String + /// 素材展示名称。 + let title: String + /// 图片或视频。 + let kind: DroneMaterialKind + /// 本地图片或视频封面资源名。 + let previewAssetName: String + /// 可选本地媒体文件;演示夹具没有真实视频文件时为 nil。 + let previewURL: URL? + /// 已知本地示例时长,图片或未知视频使用 nil。 + let durationText: String? + /// 云端生成和上传结果。 + var uploadState: DroneMaterialUploadState + /// 本机下载和保存结果。 + var downloadState: DroneMaterialDownloadState + + /// 创建独立于 UI 框架的素材快照。 + init(id: String, title: String, kind: DroneMaterialKind = .photo, + previewAssetName: String = "drone_demo_tourists", previewURL: URL? = nil, durationText: String? = nil, + uploadState: DroneMaterialUploadState = .ready, + downloadState: DroneMaterialDownloadState = .available) { + self.id = id + self.title = title + self.kind = kind + self.previewAssetName = previewAssetName + self.previewURL = previewURL + self.durationText = durationText + self.uploadState = uploadState + self.downloadState = downloadState + } + + /// 上传成功后才允许进入预览,失败和上传中不显示假预览。 + var canPreview: Bool { uploadState == .ready } + /// 当前可纳入选择的未完成素材;已下载待保存的文件可重选后只做保存。 + var canDownload: Bool { + guard uploadState == .ready else { return false } + switch downloadState { + case .available, .paused, .downloadFailed, .awaitingSave, .saveFailed: return true + case .downloading, .saving, .completed: return false + } + } + /// 列表优先显示上传阻断,再显示本机处理阶段。 + var statusTitle: String { uploadState == .ready ? downloadState.title : uploadState.title } + /// 列表状态的语义色。 + var statusTone: DroneDockStatusTone { + guard uploadState == .ready else { + switch uploadState { + case .failed: return .red + case .uploading: return .blue + default: return .gray + } + } + switch downloadState { + case .available, .completed: return .green + case .downloadFailed, .saveFailed: return .red + case .paused: return .orange + default: return .blue + } + } +} + +/// 按一次拍摄分组的原素材,不把订单次数和素材数量合并。 +struct DroneMaterialRecord: Hashable, Sendable { + /// 拍摄记录稳定标识。 + let id: String + /// 所属拍摄点稳定标识。 + let pointID: String + /// 拍摄点快照名称。 + let pointName: String + /// 本次航线快照名称。 + let routeName: String + /// 用于最新在前排序的拍摄时间。 + let capturedAt: Date + /// 展示用拍摄时间。 + let capturedAtText: String + /// 订单内拍摄记录序号。 + let sequenceNumber: Int + /// 本次拍摄生成的文件。 + var materials: [DroneMaterial] + + /// 记录标题摘要。 + var summary: String { "\(routeName) · \(capturedAtText) · 记录\(String(format: "%02d", sequenceNumber))" } +} + +/// 整单素材库的点位筛选项,nil 代表全部点位。 +struct DroneMaterialPointFilter: Hashable, Sendable { + /// 稳定点位标识,全部项使用 nil。 + let id: String? + /// 点位展示名称。 + let title: String +} + +/// 列表加载结果与上传状态分别表达。 +enum DroneMaterialsListState: Hashable, Sendable { + case loaded, loading, failed(message: String) +} + +/// 本地演示的相册写入许可,不查询或请求系统 Photos 权限。 +enum DroneMaterialPhotoPermission: Hashable, Sendable { + case allowed, denied, restricted + + /// 只有许可明确时才允许发起演示保存。 + var canSave: Bool { self == .allowed } +} + +/// 暂停入口用于区分生命周期和权限阻断。 +enum DroneMaterialPauseReason: Hashable, Sendable { + case background, locked, leavingPage, permissionDenied +} + +/// 一批固定素材的执行引用;更换 UUID 后旧执行回执失效。 +struct DroneMaterialDownloadBatch: Hashable, Sendable { + /// 本次执行令牌,继续和重试时更新。 + let id: UUID + /// 批次固定范围,不受后续点位筛选影响。 + let itemIDs: [String] + /// 是否等待用户手动继续。 + var isPaused: Bool + /// 最近一次暂停的明确原因。 + var pauseReason: DroneMaterialPauseReason? +} + +/// 批次展示阶段,权限拒绝仍从独立许可属性读取。 +enum DroneMaterialDownloadPhase: Hashable, Sendable { + case idle, downloading, awaitingSave, saving, paused, partialFailure, completed +} + +/// 可注入本地驱动的明确回执,不包含网络或 Photos 实现。 +enum DroneMaterialTransferEvent: Hashable, Sendable { + case progress(Double) + case downloadCompleted + case downloadFailed(message: String) + case saveStarted + case saveFailed(message: String) + case saveSucceeded +} + +/// 订单共享素材缓存;不会修改拍摄任务、拍摄次数或游客交付状态。 +struct DroneMaterialLibraryState { + /// 按记录保存原素材。 + var records: [DroneMaterialRecord] + /// 首次加载或显式演示的列表状态。 + var listState: DroneMaterialsListState = .loaded + /// 当前下载批次。 + var batch: DroneMaterialDownloadBatch? + /// 演示许可,与系统权限无关。 + var photoPermission: DroneMaterialPhotoPermission = .allowed + /// 已映射到素材记录的成功拍摄数,后续成功可追加记录。 + var sourceShootingCount: Int = 0 +} + +#if DEBUG +/// 素材页面显式验收场景,不自动调用下载或照片写入接口。 +enum DroneMaterialsScenario: String, CaseIterable, Hashable { + case ready, uploading, mixed, downloading, paused, partialFailure, permissionDenied, saveFailure, completed + case empty, loading, loadFailure + + /// Debug 场景菜单名称。 + var title: String { + switch self { + case .ready: "素材全部就绪" + case .uploading: "素材上传中" + case .mixed: "部分就绪与上传失败" + case .downloading: "下载中" + case .paused: "后台暂停待继续" + case .partialFailure: "部分下载失败" + case .permissionDenied: "相册权限拒绝(演示)" + case .saveFailure: "下载完成但保存失败" + case .completed: "演示完成,未写入相册" + case .empty: "暂无素材" + case .loading: "首次加载中" + case .loadFailure: "列表加载失败" + } + } +} +#endif diff --git a/suixinkan/Features/DroneDock/Models/DroneShootingSessionModels.swift b/suixinkan/Features/DroneDock/Models/DroneShootingSessionModels.swift new file mode 100644 index 0000000..99c6245 --- /dev/null +++ b/suixinkan/Features/DroneDock/Models/DroneShootingSessionModels.swift @@ -0,0 +1,305 @@ +import Foundation + +/// 点位范围来自有效定位快照;选择点位不会改变范围判定。 +enum DroneShootingRange: Hashable, Sendable { + case inside + case outside(distanceText: String?) + case unknown + + /// 横向点位卡的距离或范围文字。 + var title: String { + switch self { + case .inside: "范围内" + case .outside(let distance): distance ?? "范围外" + case .unknown: "位置待确认" + } + } + + /// 底部许可栏的范围描述。 + var admissionTitle: String { + switch self { + case .inside: "点位范围内" + case .outside: "尚未进入范围" + case .unknown: "位置待确认" + } + } + + /// 范围标签的语义色。 + var tone: DroneDockStatusTone { self == .inside ? .green : .orange } +} + +/// 准备页一个稳定身份的拍摄点;同名点位不共享选择。 +struct DroneShootingPoint: Hashable, Sendable { + /// 点位标识。 + let id: String + /// 点位名称。 + let name: String + /// 最新有效的定位与范围判定。 + let range: DroneShootingRange + /// 本订单在该点已确认成功的次数。 + let successfulCount: Int + + /// 点位卡的拍摄记录摘要。 + var successfulCountText: String { successfulCount > 0 ? "已拍 \(successfulCount) 次" : "未拍摄" } +} + +/// 一条归属于单个点位的拍摄航线。 +struct DroneShootingRoute: Hashable, Sendable { + /// 航线标识,在点位内匹配,不以名称恢复选择。 + let id: String + /// 航线名称。 + let name: String +} + +/// 准备页召唤准入结果,页面只展示该结果,不自行合并设备和额度。 +enum DroneShootingAdmission: Hashable, Sendable { + case ready, currentTask, summoning, summonUnconfirmed, orderUnavailable, noQuota, noPoints, noPoint, noRoutes, noRoute + case outOfRange, unknownRange, occupied, disconnected, noSignal, lowBattery, unknownDevice + + /// 底部操作标题。 + var title: String { + switch self { + case .currentTask: "查看当前任务" + case .summoning: "召唤处理中" + case .summonUnconfirmed: "召唤结果待确认" + default: "确认并召唤无人机" + } + } + /// 当前是否允许创建新任务。 + var canSummon: Bool { self == .ready } + /// 准入提示语义色。 + var tone: DroneDockStatusTone { + switch self { + case .ready: .gray + case .currentTask: .blue + case .noSignal: .red + default: .orange + } + } + /// 明确说明当前许可或阻断原因。 + var message: String { + switch self { + case .ready: "每次拍摄成功后扣减 1 次,未成功不扣次数。" + case .currentTask: "本订单已有当前任务,请继续查看原任务。" + case .summoning: "等待设备确认召唤结果,请勿重复发送指令。" + case .summonUnconfirmed: "暂未确认是否已执行召唤,请同步原任务状态,勿重复召唤。" + case .orderUnavailable: "当前订单不可用,请返回工作台刷新。" + case .noQuota: "当前订单拍摄次数已用完" + case .noPoints: "当前景区暂无可用拍摄点,请稍后刷新。" + case .noPoint: "请选择拍摄点" + case .noRoutes: "当前拍摄点暂无可用航线" + case .noRoute: "请选择一条有效航线" + case .outOfRange: "请先进入所选拍摄点的范围" + case .unknownRange: "位置待确认,暂时无法召唤" + case .occupied: "无人机占用中,请稍后再试" + case .disconnected: "机巢未连接,请连接后重试" + case .noSignal: "无人机无信号,暂时无法召唤" + case .lowBattery: "电量不足,设备暂不允许执行" + case .unknownDevice: "无人机状态未知,请刷新确认" + } + } +} + +/// 手机网络和图传分别保存连接过程;点击重连不代表已经恢复。 +enum DroneShootingConnectionState: Hashable, Sendable { + case connected, disconnected, reconnecting, synchronizing +} + +/// 可独立追踪结果的设备指令。 +enum DroneShootingCommandKind: Hashable, Sendable { + case summon, start, pause, resume, returnHome + + /// 指令进行中的展示文字。 + var processingTitle: String { + switch self { + case .summon: "召唤处理中" + case .start: "开始拍摄处理中" + case .pause: "暂停处理中" + case .resume: "正在继续任务" + case .returnHome: "返航处理中" + } + } +} + +/// 指令处理与任务失败分离,超时只能表达结果未知。 +enum DroneShootingCommandStatus: Hashable, Sendable { + case processing, confirmed, unconfirmed, rejected(message: String) + + /// 尚无明确回执时禁止重复发送同一指令。 + var isUnresolved: Bool { self == .processing || self == .unconfirmed } +} + +/// 某一种操作最近一次指令的回执状态。 +struct DroneShootingCommand: Hashable, Sendable { + /// 操作类型。 + let kind: DroneShootingCommandKind + /// 当前处理结果。 + var status: DroneShootingCommandStatus +} + +/// 一个本地拍摄会话,飞行、拍摄结果、连接与指令各自独立。 +struct DroneShootingSession: Hashable, Sendable { + /// 任务稳定标识,重进页面不会变化。 + let id: String + /// 本次任务固定的拍摄点快照。 + let point: DroneShootingPoint + /// 本次任务固定的航线快照。 + let route: DroneShootingRoute + /// 最近一次明确设备回执的飞行阶段。 + var phase: DroneShootingTaskPhase + /// 拍摄结果,不通过飞行结束或超时推断成功。 + var result: DroneShootingResult + /// 明确回执的飞行结束标记。 + var isFlightFinished: Bool + /// 设备是否明确允许再次执行;不由电量百分比推导。 + var deviceReady: Bool + /// 该会话成功是否已经入账,用于重复成功回执去重。 + var successRecorded: Bool + /// 手机网络连接,不与图传合并。 + var phoneConnection: DroneShootingConnectionState + /// 独立的图传连接。 + var feedConnection: DroneShootingConnectionState + /// 最近有效的遥测;手机断网时页面显示未知占位。 + var telemetry: DroneDockTelemetry + /// 各操作分别记录回执,安全指令不覆盖开始指令的未知结果。 + var commands: [DroneShootingCommandKind: DroneShootingCommand] + /// 暂停前的明确阶段,用于恢复拍摄或返航。 + var phaseBeforePause: DroneShootingTaskPhase? + /// 设备给出的明确失败原因。 + var failureReason: String? + /// 设备触发的保护性返航原因。 + var protectiveReturnReason: String? + /// 结果弹窗已由工作人员关闭;刷新不会重复弹出。 + var resultNoticeDismissed: Bool + + /// 优先呈现尚未解决的操作,保留其他类型的独立回执。 + var command: DroneShootingCommand? { + let ordered = [DroneShootingCommandKind.returnHome, .pause, .resume, .start, .summon] + return ordered.compactMap { commands[$0] }.first { $0.status.isUnresolved } + ?? ordered.compactMap { commands[$0] }.first { + if case .rejected = $0.status { return true } + return false + } + } + + /// 飞行结束且结果明确后才移除当前任务入口。 + var hasCurrentTask: Bool { + !isFlightFinished || result == .unknown || result == .inProgress + } + + /// 卡片同步状态与手机连接、命令待确认保持一致,保留原设备阶段快照。 + var taskReference: DroneShootingTask? { + guard hasCurrentTask else { return nil } + let isUnknown = phoneConnection != .connected || commands.values.contains { $0.status == .unconfirmed } + return DroneShootingTask(id: id, phase: isUnknown ? .unconfirmed : phase, shootingResult: result) + } +} + +/// UI 主按钮的语义;导航由 Controller 执行。 +enum DroneShootingTaskPrimaryAction: Hashable, Sendable { + case start, resume, viewMaterials, prepareAgain, none +} + +/// 可去重展示的设备结果通知。 +struct DroneShootingResultNotice: Hashable, Sendable { + /// 由任务及结果组成的稳定通知身份。 + let id: String + /// 弹窗标题。 + let title: String + /// 弹窗详情。 + let message: String + /// 是否为明确拍摄成功。 + let isSuccess: Bool +} + +/// 显式本地设备回执;没有计时器,也不会向实际设备发送命令。 +enum DroneShootingSessionEvent: Hashable, Sendable { + case commandConfirmed(DroneShootingCommandKind) + case commandRejected(DroneShootingCommandKind, message: String) + case commandResultUnknown(DroneShootingCommandKind) + case phaseConfirmed(DroneShootingTaskPhase) + case shootingSucceeded + case shootingFailed(reason: String) + case flightFinished(deviceReady: Bool) + case protectiveReturn(reason: String) + case phoneConnectionChanged(DroneShootingConnectionState) + case feedConnectionChanged(DroneShootingConnectionState) + case telemetryUpdated(DroneDockTelemetry) + case synchronized(phase: DroneShootingTaskPhase, result: DroneShootingResult, flightFinished: Bool, deviceReady: Bool) +} + +/// 本地准备选择,按订单与点位身份保存。 +struct DroneShootingPreparationState { + /// 当前订单可用点位及其范围快照。 + var points: [DroneShootingPoint] + /// 每个点位当前有效的航线配置。 + var routesByPointID: [String: [DroneShootingRoute]] + /// 所选点位身份,配置移除时清空。 + var selectedPointID: String? + /// 按点位分别保存航线身份,失效时清除。 + var selectedRouteIDs: [String: String] +} + +/// 避免同名订单或景区切换共享错误会话的数据源键。 +struct DroneShootingSessionKey: Hashable { + /// 会话所属的景区和工作人员。 + let context: DroneDockContext + /// 本范围内的稳定订单标识。 + let orderID: String +} + +#if DEBUG +/// 准备页仅 Debug 可用的本地验收场景。 +enum DroneShootingPreparationScenario: String, CaseIterable { + case ready, occupied, disconnected, noSignal, lowBattery, unknown + case outOfRange, unknownRange, noPoints, noRoutes, noQuota + + /// 验收菜单标题。 + var title: String { + switch self { + case .ready: "恢复正常准备" + case .occupied: "无人机占用中" + case .disconnected: "机巢未连接" + case .noSignal: "无人机无信号" + case .lowBattery: "电量不足" + case .unknown: "设备状态未知" + case .outOfRange: "不在拍摄范围" + case .unknownRange: "位置待确认" + case .noPoints: "暂无拍摄点" + case .noRoutes: "暂无可用航线" + case .noQuota: "拍摄次数用完" + } + } +} + +/// 任务页仅 Debug 可用的显式设备事件组合。 +enum DroneShootingTaskScenario: String, CaseIterable { + case navigating, arrived, shooting, pauseProcessing, shootingPaused, resumeProcessing + case returning, returnPaused, succeededReturning, succeededFinished, failedReturning, failedReady + case streamLost, phoneOffline, protectiveReturn, commandUnconfirmed, commandRejected, synchronized + + /// 验收菜单标题。 + var title: String { + switch self { + case .navigating: "前往拍摄点中" + case .arrived: "已到达,待拍摄" + case .shooting: "拍摄中" + case .pauseProcessing: "暂停处理中" + case .shootingPaused: "拍摄已暂停" + case .resumeProcessing: "恢复处理中" + case .returning: "返航中" + case .returnPaused: "返航已暂停" + case .succeededReturning: "拍摄成功 · 返航中" + case .succeededFinished: "拍摄成功 · 飞行结束" + case .failedReturning: "执行失败 · 返航中" + case .failedReady: "执行失败 · 设备可用" + case .streamLost: "画面断流" + case .phoneOffline: "手机断网" + case .protectiveReturn: "保护性返航" + case .commandUnconfirmed: "指令执行结果待确认" + case .commandRejected: "指令明确拒绝" + case .synchronized: "同步当前任务回执" + } + } +} +#endif diff --git a/suixinkan/Features/DroneDock/Services/DroneDockFilmUploader.swift b/suixinkan/Features/DroneDock/Services/DroneDockFilmUploader.swift new file mode 100644 index 0000000..823b202 --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockFilmUploader.swift @@ -0,0 +1,146 @@ +import Foundation + +#if canImport(AlibabaCloudOSS) +import AlibabaCloudOSS +#endif + +/// 将用户选择的视频上传至 OSS,返回可提交给张工成片接口的原始地址。 +protocol DroneDockFilmUploading: Sendable { + /// 上传以文件为单位执行,进度在主线程回传;100 表示 OSS 已成功接收。 + @MainActor + func upload(video: DroneDockDeliveryVideo, scenicID: Int, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws -> String +} + +/// OSS 文件传输边界,生产使用 SDK,单元测试不访问外部存储。 +protocol DroneDockFilmTransporting: Sendable { + /// 使用服务端临时配置和文件流上传,不把整个视频载入内存。 + @MainActor + func put(fileURL: URL, objectKey: String, contentType: String, configuration: AliyunOSSResponse, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws +} + +/// 云端成片上传器,复用 STS 服务与通用对象键规则,按配置返回原始 OSS 地址。 +@MainActor +final class DroneDockFilmUploader: DroneDockFilmUploading { + private let configService: any OSSConfigServing + private let transport: any DroneDockFilmTransporting + + /// 注入上传配置及传输实现;正式页面默认使用阿里云 SDK。 + init(configService: any OSSConfigServing, transport: (any DroneDockFilmTransporting)? = nil) { + self.configService = configService + self.transport = transport ?? DroneDockOSSFilmTransport() + } + + /// 文件与临时凭证都有效时才开始上传,取消或失败不会返回成功地址。 + func upload(video: DroneDockDeliveryVideo, scenicID: Int, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws -> String { + try Task.checkCancellation() + guard scenicID > 0 else { throw DroneDockFilmError.invalidScope } + let contentType = try DroneDockFilmPolicy.validate(video: video) + let progress = DroneDockFilmProgress(onProgress: onProgress) + defer { progress.close() } + progress.report(1) + let configuration = try await configService.aliyunOSSBucket(bucket: "default") + try Task.checkCancellation() + try validate(configuration: configuration) + _ = try DroneDockFilmPolicy.validate(video: video) + // 对象名使用 ASCII,避免地址转义差异;原始文件名仍由成片保存接口记录。 + let fileExtension = URL(fileURLWithPath: video.fileName).pathExtension.lowercased() + let objectKey = OSSUploadPolicy.objectKey(fileName: "film.\(fileExtension)", scenicId: scenicID, moduleType: "task_upload") + var allowed = CharacterSet.urlPathAllowed + allowed.remove(charactersIn: "?#%") + guard let escapedKey = objectKey.addingPercentEncoding(withAllowedCharacters: allowed) else { + throw DroneDockFilmError.invalidFileName + } + let fileURL = OSSUploadPolicy.joinURL(baseURL: configuration.baseUrl, objectKey: escapedKey) + guard DroneDockFilmPolicy.remoteURL(fileURL) != nil else { throw DroneDockFilmError.invalidConfiguration } + progress.report(10) + try await transport.put(fileURL: video.url, objectKey: objectKey, contentType: contentType, + configuration: configuration) { value in + progress.report(10 + min(100, max(0, value)) * 89 / 100) + } + try Task.checkCancellation() + progress.finish() + return fileURL + } + + private func validate(configuration: AliyunOSSResponse) throws { + guard let base = URLComponents(string: configuration.baseUrl), + ["https", "http"].contains(base.scheme?.lowercased() ?? ""), + let host = base.host, !host.isEmpty, + base.user == nil, base.password == nil, base.query == nil, base.fragment == nil, + configuration.baseUrl.rangeOfCharacter(from: .whitespacesAndNewlines) == nil, + !configuration.endpoint.isEmpty, !configuration.region.isEmpty, !configuration.bucket.isEmpty, + configuration.expireSeconds > 0, + !configuration.credentials.accessKeyId.isEmpty, + !configuration.credentials.accessKeySecret.isEmpty, + !configuration.credentials.securityToken.isEmpty else { throw DroneDockFilmError.invalidConfiguration } + } +} + +/// 阿里云 SDK 的文件上传实现,与既有上传服务使用相同的临时凭证和 endpoint。 +@MainActor +struct DroneDockOSSFilmTransport: DroneDockFilmTransporting { + /// SDK 的 .file body 走 URLSession 文件上传,进度从网络回调切回主线程。 + func put(fileURL: URL, objectKey: String, contentType: String, configuration: AliyunOSSResponse, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws { + try Task.checkCancellation() + #if canImport(AlibabaCloudOSS) + let credentials = StaticCredentialsProvider(accessKeyId: configuration.credentials.accessKeyId, + accessKeySecret: configuration.credentials.accessKeySecret, securityToken: configuration.credentials.securityToken) + let sdkConfiguration = Configuration.default().withRegion(configuration.region).withCredentialsProvider(credentials) + sdkConfiguration.withEndpoint(configuration.endpoint) + let client = Client(sdkConfiguration) + let trace = DroneDockFileTransferTrace(operation: "file_upload", method: "PUT", + remoteURL: URL(string: configuration.endpoint)) + let fileSize = (try? fileURL.resourceValues(forKeys: [.fileSizeKey]).fileSize) ?? 0 + DroneDockDiagnostics.write(trace.message("request.started", fields: [ + "bucket": configuration.bucket, "object_key": objectKey, + "bytes": fileSize, "content_type": contentType, "body": "" + ])) + do { + let result = try await client.putObject(PutObjectRequest( + bucket: configuration.bucket, key: objectKey, contentType: contentType, body: .file(fileURL), + progress: ProgressClosure { _, transferred, expected in + guard expected > 0 else { return } + let value = Int(min(100, max(0, Double(transferred) / Double(expected) * 100))) + Task { @MainActor in onProgress(value) } + } + )) + DroneDockDiagnostics.write(trace.message("response.received", fields: [ + "http_status": result.statusCode, "oss_request_id": result.requestId, + "response_headers": result.headers ?? [:], + "body": DroneDockDiagnostics.payload(result.callbackResult) + ])) + } catch { + let cancelled = error is CancellationError || (error as? URLError)?.code == .cancelled + DroneDockDiagnostics.write(trace.message(cancelled ? "request.cancelled" : "request.failed", + fields: DroneDockDiagnostics.errorFields(error))) + throw error + } + try Task.checkCancellation() + #else + throw OSSUploadError.sdkUnavailable + #endif + } +} + +/// 丢弃已结束上传的迟到回调,并防止进度倒退或上传失败提前显示 100%。 +@MainActor +private final class DroneDockFilmProgress { + private var latest = -1 + private var isClosed = false + private let onProgress: @MainActor @Sendable (Int) -> Void + + init(onProgress: @escaping @MainActor @Sendable (Int) -> Void) { self.onProgress = onProgress } + + func report(_ value: Int) { + guard !isClosed, value > latest else { return } + latest = value + onProgress(value) + } + + func finish() { report(100); close() } + func close() { isClosed = true } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferEndpoint.swift b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferEndpoint.swift new file mode 100644 index 0000000..057bf0a --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferEndpoint.swift @@ -0,0 +1,49 @@ +import Darwin +import Foundation + +/// 可绑定的 IPv4 局域网接口;正式发现不使用蜂窝、VPN 或公网地址。 +struct DroneDockNearbyTransferEndpoint: Equatable, Sendable { + let address: String + let interfaceName: String + + /// 读取已启用的 Wi-Fi / 本地网桥地址,不进行网络探测或广播。 + static func current() throws -> DroneDockNearbyTransferEndpoint { + var list: UnsafeMutablePointer? + guard getifaddrs(&list) == 0, let first = list else { throw DroneDockNearbyTransferError.noLocalNetwork } + defer { freeifaddrs(list) } + var candidates: [DroneDockNearbyTransferEndpoint] = [] + var item: UnsafeMutablePointer? = first + while let current = item { + defer { item = current.pointee.ifa_next } + guard let address = current.pointee.ifa_addr, address.pointee.sa_family == UInt8(AF_INET), + current.pointee.ifa_flags & UInt32(IFF_UP) != 0, + current.pointee.ifa_flags & UInt32(IFF_RUNNING) != 0, + current.pointee.ifa_flags & UInt32(IFF_LOOPBACK) == 0 else { continue } + let name = String(cString: current.pointee.ifa_name) + guard name.hasPrefix("en") || name.hasPrefix("bridge") else { continue } + var host = [CChar](repeating: 0, count: Int(NI_MAXHOST)) + guard getnameinfo(address, socklen_t(address.pointee.sa_len), &host, socklen_t(host.count), nil, 0, NI_NUMERICHOST) == 0 else { continue } + let value = String(cString: host) + guard isPrivateIPv4(value) else { continue } + candidates.append(.init(address: value, interfaceName: name)) + } + guard let selected = candidates.sorted(by: { lhs, rhs in + let left = lhs.interfaceName == "en0" ? "0" : lhs.interfaceName + let right = rhs.interfaceName == "en0" ? "0" : rhs.interfaceName + return left < right + }).first else { throw DroneDockNearbyTransferError.noLocalNetwork } + return selected + } + + /// 接收页面只公布 RFC 1918 地址,避免意外选择公网或蜂窝接口。 + static func isPrivateIPv4(_ address: String) -> Bool { + let parts = address.split(separator: ".", omittingEmptySubsequences: false) + guard parts.count == 4 else { return false } + let numbers = parts.compactMap { part -> Int? in + guard !part.isEmpty, part.allSatisfy({ $0 >= "0" && $0 <= "9" }), let value = Int(part), value <= 255 else { return nil } + return value + } + guard numbers.count == 4 else { return false } + return numbers[0] == 10 || (numbers[0] == 172 && (16...31).contains(numbers[1])) || (numbers[0] == 192 && numbers[1] == 168) + } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferHTTP.swift b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferHTTP.swift new file mode 100644 index 0000000..2b471be --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferHTTP.swift @@ -0,0 +1,92 @@ +import Foundation + +/// 局域网文件服务的小型 HTTP 解析器,只支持单个无请求体的 GET / HEAD 请求。 +enum DroneDockNearbyTransferHTTP { + /// 限制每个连接的头部缓存,避免将任意大小请求读入内存。 + static let maximumHeaderBytes = 16 * 1_024 + /// 文件流每次最多读取 64 KiB;不随视频大小增长。 + static let fileChunkBytes = 64 * 1_024 + + /// 已校验的请求,路径保持原始形式,拒绝通过编码或查询参数绕过会话路径。 + struct Request: Equatable { + let method: String + let target: String + let headers: [String: String] + var isHead: Bool { method == "HEAD" } + } + + /// 一个闭区间文件片段,用于 Content-Range 和磁盘 seek。 + struct ByteRange: Equatable { + let lower: Int64 + let upper: Int64 + var count: Int64 { upper - lower + 1 } + } + + /// 拒绝格式异常、重复头、过长头部及带请求体的请求。 + static func parse(_ data: Data) -> Request? { + guard data.count <= maximumHeaderBytes, data.suffix(4) == Data([13, 10, 13, 10]), + let text = String(data: data.dropLast(4), encoding: .utf8) else { return nil } + // CRLF 在 Swift String 中是一个 Character;协议分隔符必须按四个字节移除。 + let lines = text.components(separatedBy: "\r\n") + guard let first = lines.first, first.utf8.count <= 2_048 else { return nil } + let parts = first.split(separator: " ", omittingEmptySubsequences: false) + guard parts.count == 3, ["HTTP/1.0", "HTTP/1.1"].contains(String(parts[2])), + !parts[0].isEmpty, parts[1].hasPrefix("/"), + parts[1].allSatisfy({ $0.isASCII && !$0.isWhitespace && !$0.isNewline }) else { return nil } + var headers: [String: String] = [:] + let allowedName = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-!") + for line in lines.dropFirst() { + guard let colon = line.firstIndex(of: ":"), colon != line.startIndex else { return nil } + let name = String(line[..= 32 && $0.value != 127 }), + headers[name.lowercased()] == nil else { return nil } + headers[name.lowercased()] = value + } + guard headers["transfer-encoding"] == nil, + headers["content-length"] == nil || headers["content-length"] == "0", + String(parts[2]) != "HTTP/1.1" || headers["host"] != nil else { return nil } + return Request(method: String(parts[0]), target: String(parts[1]), headers: headers) + } + + /// 解析单段 Range,包括从某字节到末尾及后缀片段;多段或越界请求返回 nil。 + static func range(_ value: String, size: Int64) -> ByteRange? { + guard size > 0, value.hasPrefix("bytes=") else { return nil } + let parts = value.dropFirst(6).split(separator: "-", omittingEmptySubsequences: false) + guard parts.count == 2 else { return nil } + func number(_ text: Substring) -> Int64? { + guard !text.isEmpty, text.allSatisfy({ $0 >= "0" && $0 <= "9" }) else { return nil } + return Int64(text) + } + if parts[0].isEmpty { + guard let suffix = number(parts[1]), suffix > 0 else { return nil } + return ByteRange(lower: max(0, size - suffix), upper: size - 1) + } + guard let lower = number(parts[0]), lower < size else { return nil } + if parts[1].isEmpty { return ByteRange(lower: lower, upper: size - 1) } + guard let upper = number(parts[1]), upper >= lower else { return nil } + return ByteRange(lower: lower, upper: min(upper, size - 1)) + } + + /// 保留中文文件名的 RFC 5987 下载头;ASCII 回退名不含用户输入。 + static func disposition(fileName: String) -> String { + let allowed = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$&+-.^_`|~") + let escaped = fileName.addingPercentEncoding(withAllowedCharacters: allowed) ?? "video.mp4" + let ext = URL(fileURLWithPath: fileName).pathExtension.lowercased() + let safeExtension = ext.allSatisfy({ $0.isASCII && $0.isLetter }) && !ext.isEmpty ? ext : "mp4" + return "attachment; filename=\"video.\(safeExtension)\"; filename*=UTF-8''\(escaped)" + } + + /// 所有响应禁止缓存和站外引用,不提供跨域访问能力。 + static func header(status: Int, length: Int64, contentType: String, extra: [String: String] = [:]) -> Data { + let reasons = [200: "OK", 206: "Partial Content", 400: "Bad Request", 403: "Forbidden", 404: "Not Found", + 405: "Method Not Allowed", 409: "Conflict", 416: "Range Not Satisfiable", 431: "Request Header Fields Too Large", 500: "Internal Server Error", 503: "Service Unavailable"] + var headers = ["Content-Length": String(length), "Content-Type": contentType, + "Connection": "close", "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff", + "Referrer-Policy": "no-referrer", "X-Frame-Options": "DENY"] + headers.merge(extra) { _, new in new } + let lines = headers.keys.sorted().map { "\($0): \(headers[$0]!)" }.joined(separator: "\r\n") + return Data("HTTP/1.1 \(status) \(reasons[status] ?? "Error")\r\n\(lines)\r\n\r\n".utf8) + } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferPage.swift b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferPage.swift new file mode 100644 index 0000000..447a357 --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferPage.swift @@ -0,0 +1,117 @@ +import Foundation + +/// 随 App 分发的局域网接收页;纯 HTML/CSS,不请求远程资源,也不在浏览器内缓存整段视频。 +enum DroneDockNearbyTransferPage { + /// 生成单个视频的下载页,仅接受当前局域网会话格式的相对下载路径。 + static func html(video: DroneDockDeliveryVideo, downloadPath: String) -> String { + let fileName = escape(video.fileName) + let size = escape(ByteCountFormatter.string(fromByteCount: Int64(max(0, video.fileSize)), countStyle: .file)) + let isValidPath = downloadPath.range(of: #"\A/s/[0-9a-f]{64}/video\z"#, options: .regularExpression) != nil + let download: String + if isValidPath { + download = """ + 下载视频 +

    点击后,请在浏览器下载列表查看进度。

    + """ + } else { + download = """ +

    下载链接不可用,请让商家重新生成二维码。

    + """ + } + return """ + + + + + + + + 面对面闪传 · 随心瞰 + + + +
    +
    随心瞰 · 面对面闪传
    +
    + 本地直传 +

    你的航拍作品
    就在这里

    +

    视频由附近的商家手机直接提供。

    +
    +
    +
    + +
    +

    \(fileName)

    +

    视频文件 · \(size)

    +
    +
    + \(download) +
    +
    + +

    双方请保持连接同一个 Wi-Fi。
    传输期间,请让商家保持闪传页面亮屏。

    +
    +
    +
    + iPhone 下载后在哪里查看? +

    建议使用 Safari 打开。下载前,可在系统设置中的 Safari 下载设置里选择“我的 iPhone”,避免保存到 iCloud Drive。

    +

    下载完成后,在“文件”App 的“下载”文件夹打开视频。格式受支持时,可通过分享菜单选择“存储视频”保存到相册。

    +
    +
    + 安卓下载后在哪里查看? +

    请在浏览器的“下载内容”或手机文件管理的“下载”文件夹中查看。是否显示在相册中取决于手机和视频格式。

    +
    +
    + 无法下载或传输中断怎么办? +

    请先确认双方仍连接同一个 Wi-Fi,商家没有关闭闪传页面,再点击下载重试。部分公共 Wi-Fi 会限制手机之间连接,可以更换网络后重新扫码。

    +

    本次链接短时有效。商家结束闪传后链接会失效,需要重新生成二维码。

    +
    +
    + +
    + + + """ + } + + private static func escape(_ value: String) -> String { + value.replacingOccurrences(of: "&", with: "&") + .replacingOccurrences(of: "<", with: "<") + .replacingOccurrences(of: ">", with: ">") + .replacingOccurrences(of: "\"", with: """) + .replacingOccurrences(of: "'", with: "'") + } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferServer.swift b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferServer.swift new file mode 100644 index 0000000..e481d16 --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockNearbyTransferServer.swift @@ -0,0 +1,401 @@ +import Foundation +import Network +import Security + +/// 仅绑定本地接口的临时 HTTP 服务;视频按 64 KiB 分块读取,不访问任何云端接口。 +final class DroneDockNearbyTransferServer: DroneDockNearbyTransferServing, @unchecked Sendable { + private let queue = DispatchQueue(label: "cn.suixinkan.nearby-transfer") + private let queueKey = DispatchSpecificKey() + private let endpointProvider: @Sendable () throws -> DroneDockNearbyTransferEndpoint + private let lifetime: TimeInterval + private let headerTimeout: TimeInterval + private let startTimeout: TimeInterval + private var generation: UInt64 = 0 + private var context: SessionContext? + + /// 正式使用自动发现的局域网地址;测试可注入回环端点与短超时,无需访问外网。 + init(endpointProvider: @escaping @Sendable () throws -> DroneDockNearbyTransferEndpoint = DroneDockNearbyTransferEndpoint.current, + lifetime: TimeInterval = 600, headerTimeout: TimeInterval = 10, startTimeout: TimeInterval = 10) { + self.endpointProvider = endpointProvider + self.lifetime = max(0.05, lifetime) + self.headerTimeout = max(0.05, headerTimeout) + self.startTimeout = max(0.05, startTimeout) + queue.setSpecific(key: queueKey, value: true) + } + + deinit { stop() } + + /// 建立新会话前撤销旧会话;取消启动会关闭监听且恰好恢复一次 continuation。 + func start(video: DroneDockDeliveryVideo, + onEvent: @escaping @Sendable (DroneDockNearbyTransferEvent) -> Void) async throws -> DroneDockNearbyTransferSession { + let id = UUID() + let cancellation = StartCancellation() + let expectedGeneration = onQueue { generation } + return try await withTaskCancellationHandler { + try Task.checkCancellation() + return try await withCheckedThrowingContinuation { continuation in + queue.async { [self] in + guard expectedGeneration == generation, !cancellation.isCancelled else { + continuation.resume(throwing: CancellationError()) + return + } + begin(id: id, video: video, cancellation: cancellation, onEvent: onEvent, continuation: continuation) + } + } + } onCancel: { [self] in + cancellation.cancel() + onQueue { + if context?.id == id { close(error: CancellationError(), event: nil) } + } + } + } + + /// 返回前会话已撤销;排队中的启动与发送回调不能复活旧二维码。 + func stop() { + onQueue { + generation &+= 1 + close(error: CancellationError(), event: nil) + } + } + + private func onQueue(_ action: () throws -> T) rethrows -> T { + if DispatchQueue.getSpecific(key: queueKey) == true { return try action() } + return try queue.sync(execute: action) + } + + private func begin(id: UUID, video: DroneDockDeliveryVideo, cancellation: StartCancellation, + onEvent: @escaping @Sendable (DroneDockNearbyTransferEvent) -> Void, + continuation: CheckedContinuation) { + close(error: CancellationError(), event: .stopped) + do { + let contentType = try DroneDockFilmPolicy.validate(video: video) + let endpoint = try endpointProvider() + guard IPv4Address(endpoint.address) != nil, + DroneDockNearbyTransferEndpoint.isPrivateIPv4(endpoint.address) || endpoint.address == "127.0.0.1" else { + throw DroneDockNearbyTransferError.invalidAddress + } + let token = try makeToken() + let parameters = NWParameters.tcp + parameters.requiredLocalEndpoint = .hostPort(host: .init(endpoint.address), port: .any) + parameters.includePeerToPeer = false + // 手机热点可能被标记为 expensive;本地绑定已限制接口,不按资费标签误拦局域网。 + let listener = try NWListener(using: parameters) + let current = SessionContext(id: id, video: video, contentType: contentType, token: token, + endpoint: endpoint, listener: listener, expiresAt: Date().addingTimeInterval(lifetime), + cancellation: cancellation, onEvent: onEvent, continuation: continuation) + context = current + listener.stateUpdateHandler = { [weak self] state in self?.listenerChanged(state, id: id) } + listener.newConnectionHandler = { [weak self] connection in + guard let self else { connection.cancel(); return } + accept(connection, sessionID: id) + } + let timeout = DispatchWorkItem { [weak self] in + guard let self, context?.id == id, context?.continuation != nil else { return } + close(error: DroneDockNearbyTransferError.startTimedOut, event: .failed(DroneDockNearbyTransferError.startTimedOut.localizedDescription)) + } + current.startTimer = timeout + queue.asyncAfter(deadline: .now() + startTimeout, execute: timeout) + listener.start(queue: queue) + } catch { + continuation.resume(throwing: error) + } + } + + private func listenerChanged(_ state: NWListener.State, id: UUID) { + guard let current = context, current.id == id else { return } + switch state { + case .ready: + guard !current.cancellation.isCancelled else { close(error: CancellationError(), event: nil); return } + guard current.continuation != nil, let port = current.listener.port else { return } + current.startTimer?.cancel() + current.startTimer = nil + var components = URLComponents() + components.scheme = "http" + components.host = current.endpoint.address + components.port = Int(port.rawValue) + components.path = current.pagePath + guard let url = components.url else { close(error: DroneDockNearbyTransferError.invalidAddress, event: nil); return } + current.host = "\(current.endpoint.address):\(port.rawValue)" + let session = DroneDockNearbyTransferSession(id: id, url: url, expiresAt: current.expiresAt) + let pending = current.continuation + current.continuation = nil + installSessionTimers(id: id) + pending?.resume(returning: session) + case .failed: + close(error: DroneDockNearbyTransferError.listenerFailed, + event: .failed(DroneDockNearbyTransferError.listenerFailed.localizedDescription)) + case .cancelled: + close(error: CancellationError(), event: .stopped) + default: break + } + } + + private func installSessionTimers(id: UUID) { + guard let current = context, current.id == id else { return } + let expiry = DispatchWorkItem { [weak self] in + guard let self, context?.id == id else { return } + close(error: CancellationError(), event: .failed("本次闪传已到期,请重新生成二维码")) + } + current.expiryTimer = expiry + queue.asyncAfter(deadline: .now() + max(0, current.expiresAt.timeIntervalSinceNow), execute: expiry) + let monitor = DispatchSource.makeTimerSource(queue: queue) + monitor.schedule(deadline: .now() + 2, repeating: 2) + monitor.setEventHandler { [weak self] in + guard let self, let active = context, active.id == id else { return } + guard let latest = try? endpointProvider(), latest == active.endpoint else { + close(error: CancellationError(), event: .failed("网络已变化,请连接同一 Wi-Fi 后重新生成二维码")) + return + } + } + current.networkTimer = monitor + monitor.resume() + } + + private func accept(_ connection: NWConnection, sessionID: UUID) { + guard let current = context, current.id == sessionID, current.continuation == nil, + current.expiresAt > Date(), current.connections.count < 8 else { connection.cancel(); return } + if case .hostPort(let host, _) = connection.endpoint { + let address = String(describing: host) + guard DroneDockNearbyTransferEndpoint.isPrivateIPv4(address) + || (current.endpoint.address == "127.0.0.1" && address == "127.0.0.1") else { connection.cancel(); return } + } else { connection.cancel(); return } + let state = ConnectionContext(connection: connection) + current.connections[state.id] = state + connection.stateUpdateHandler = { [weak self] status in + guard let self else { return } + switch status { + case .ready: receiveHeader(id: state.id, sessionID: sessionID) + case .failed, .cancelled: finish(id: state.id, sessionID: sessionID, successful: false) + default: break + } + } + setTimeout(id: state.id, sessionID: sessionID, seconds: headerTimeout) + connection.start(queue: queue) + } + + private func receiveHeader(id: UUID, sessionID: UUID) { + guard let state = connection(id: id, sessionID: sessionID) else { return } + let remaining = DroneDockNearbyTransferHTTP.maximumHeaderBytes - state.requestBytes.count + guard remaining > 0 else { sendError(431, id: id, sessionID: sessionID); return } + state.connection.receive(minimumIncompleteLength: 1, maximumLength: min(4_096, remaining)) { [weak self] data, _, complete, error in + guard let self, let state = connection(id: id, sessionID: sessionID) else { return } + if let data { state.requestBytes.append(data) } + if let ending = state.requestBytes.range(of: Data("\r\n\r\n".utf8)) { + guard ending.upperBound == state.requestBytes.endIndex, + let request = DroneDockNearbyTransferHTTP.parse(state.requestBytes) else { + sendError(400, id: id, sessionID: sessionID); return + } + state.requestBytes.removeAll(keepingCapacity: false) + respond(to: request, id: id, sessionID: sessionID) + } else if error != nil || complete { + finish(id: id, sessionID: sessionID, successful: false) + } else { receiveHeader(id: id, sessionID: sessionID) } + } + } + + private func respond(to request: DroneDockNearbyTransferHTTP.Request, id: UUID, sessionID: UUID) { + guard let current = context, current.id == sessionID, let state = current.connections[id] else { return } + if let host = request.headers["host"], host != current.host { sendError(403, id: id, sessionID: sessionID, head: request.isHead); return } + guard ["GET", "HEAD"].contains(request.method) else { + sendError(405, id: id, sessionID: sessionID, extra: ["Allow": "GET, HEAD"]); return + } + guard current.expiresAt > Date() else { close(error: CancellationError(), event: .failed("本次闪传已到期,请重新生成二维码")); return } + if request.target == current.pagePath { + let body = Data(DroneDockNearbyTransferPage.html(video: current.video, downloadPath: current.videoPath).utf8) + let csp = "default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'" + let header = DroneDockNearbyTransferHTTP.header(status: 200, length: Int64(body.count), contentType: "text/html; charset=utf-8", + extra: ["Content-Security-Policy": csp]) + if !request.isHead { current.onEvent(.visitorConnected) } + sendSmall(header + (request.isHead ? Data() : body), id: id, sessionID: sessionID) + return + } + guard request.target == current.videoPath else { sendError(404, id: id, sessionID: sessionID, head: request.isHead); return } + do { _ = try DroneDockFilmPolicy.validate(video: current.video) } + catch { sendError(409, id: id, sessionID: sessionID, head: request.isHead); return } + let size = Int64(current.video.fileSize) + let etag = "\"\(current.video.id.uuidString.lowercased())-\(size)\"" + let requestedRange = request.headers["if-range"] == nil || request.headers["if-range"] == etag ? request.headers["range"] : nil + let range: DroneDockNearbyTransferHTTP.ByteRange + if let requestedRange { + guard let value = DroneDockNearbyTransferHTTP.range(requestedRange, size: size) else { + sendError(416, id: id, sessionID: sessionID, head: request.isHead, extra: ["Content-Range": "bytes */\(size)"]); return + } + range = value + } else { range = .init(lower: 0, upper: size - 1) } + var extra = ["Accept-Ranges": "bytes", "ETag": etag, + "Content-Disposition": DroneDockNearbyTransferHTTP.disposition(fileName: current.video.fileName)] + if requestedRange != nil { extra["Content-Range"] = "bytes \(range.lower)-\(range.upper)/\(size)" } + let header = DroneDockNearbyTransferHTTP.header(status: requestedRange == nil ? 200 : 206, + length: range.count, contentType: current.contentType, extra: extra) + if request.isHead { sendSmall(header, id: id, sessionID: sessionID); return } + guard current.downloadID == nil else { sendError(409, id: id, sessionID: sessionID); return } + do { + let file = try FileHandle(forReadingFrom: current.video.url) + try file.seek(toOffset: UInt64(range.lower)) + state.file = file + } catch { sendError(500, id: id, sessionID: sessionID); return } + current.downloadID = id + state.isDownload = true + state.responseBytes = range.count + state.isWholeFile = range.lower == 0 && range.upper == size - 1 + state.lastProgressTime = DispatchTime.now().uptimeNanoseconds + current.onEvent(.sending(bytesSent: 0, totalBytes: range.count)) + setTimeout(id: id, sessionID: sessionID, seconds: 30) + state.connection.send(content: header, completion: .contentProcessed { [weak self] error in + guard let self else { return } + if error != nil { finish(id: id, sessionID: sessionID, successful: false) } + else { sendChunk(id: id, sessionID: sessionID) } + }) + } + + private func sendChunk(id: UUID, sessionID: UUID) { + guard let state = connection(id: id, sessionID: sessionID), let file = state.file else { return } + let remaining = state.responseBytes - state.sentBytes + guard remaining > 0 else { finish(id: id, sessionID: sessionID, successful: true); return } + do { + guard let data = try file.read(upToCount: Int(min(Int64(DroneDockNearbyTransferHTTP.fileChunkBytes), remaining))), + !data.isEmpty else { finish(id: id, sessionID: sessionID, successful: false); return } + let count = Int64(data.count) + let last = count == remaining + setTimeout(id: id, sessionID: sessionID, seconds: 30) + state.connection.send(content: data, contentContext: last ? .finalMessage : .defaultMessage, + isComplete: true, completion: .contentProcessed { [weak self] error in + guard let self, let state = connection(id: id, sessionID: sessionID) else { return } + if error != nil { finish(id: id, sessionID: sessionID, successful: false); return } + state.sentBytes += count + let now = DispatchTime.now().uptimeNanoseconds + if last || now - state.lastProgressTime >= 100_000_000 { + state.lastProgressTime = now + context?.onEvent(.sending(bytesSent: state.sentBytes, totalBytes: state.responseBytes)) + } + if last { finish(id: id, sessionID: sessionID, successful: true) } + else { sendChunk(id: id, sessionID: sessionID) } + }) + } catch { finish(id: id, sessionID: sessionID, successful: false) } + } + + private func sendError(_ status: Int, id: UUID, sessionID: UUID, head: Bool = false, extra: [String: String] = [:]) { + let body = Data("本次请求无法处理,请返回商家页面重新扫码。".utf8) + let header = DroneDockNearbyTransferHTTP.header(status: status, length: Int64(body.count), contentType: "text/plain; charset=utf-8", extra: extra) + sendSmall(header + (head ? Data() : body), id: id, sessionID: sessionID) + } + + private func sendSmall(_ data: Data, id: UUID, sessionID: UUID) { + guard let state = connection(id: id, sessionID: sessionID) else { return } + setTimeout(id: id, sessionID: sessionID, seconds: 30) + state.connection.send(content: data, contentContext: .finalMessage, isComplete: true, + completion: .contentProcessed { [weak self] error in self?.finish(id: id, sessionID: sessionID, successful: error == nil) }) + } + + private func connection(id: UUID, sessionID: UUID) -> ConnectionContext? { + guard context?.id == sessionID else { return nil } + return context?.connections[id] + } + + private func setTimeout(id: UUID, sessionID: UUID, seconds: TimeInterval) { + guard let state = connection(id: id, sessionID: sessionID) else { return } + state.timeout?.cancel() + let timeout = DispatchWorkItem { [weak self] in self?.finish(id: id, sessionID: sessionID, successful: false) } + state.timeout = timeout + queue.asyncAfter(deadline: .now() + seconds, execute: timeout) + } + + private func finish(id: UUID, sessionID: UUID, successful: Bool) { + guard let current = context, current.id == sessionID, let state = current.connections.removeValue(forKey: id) else { return } + state.timeout?.cancel() + try? state.file?.close() + state.file = nil + state.connection.stateUpdateHandler = nil + state.connection.cancel() + if current.downloadID == id { current.downloadID = nil } + if state.isDownload { + if successful && state.isWholeFile && state.sentBytes == state.responseBytes { current.onEvent(.sent) } + else if successful { current.onEvent(.partialSent) } + else if !successful { current.onEvent(.interrupted) } + } + } + + private func close(error: Error, event: DroneDockNearbyTransferEvent?) { + guard let old = context else { return } + context = nil + old.startTimer?.cancel() + old.expiryTimer?.cancel() + old.networkTimer?.cancel() + old.listener.stateUpdateHandler = nil + old.listener.newConnectionHandler = nil + old.listener.cancel() + for connection in old.connections.values { + connection.timeout?.cancel() + try? connection.file?.close() + connection.file = nil + connection.connection.stateUpdateHandler = nil + connection.connection.cancel() + } + old.connections.removeAll() + old.continuation?.resume(throwing: error) + old.continuation = nil + if let event { old.onEvent(event) } + } + + private func makeToken() throws -> String { + var bytes = [UInt8](repeating: 0, count: 32) + guard SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes) == errSecSuccess else { + throw DroneDockNearbyTransferError.randomGenerationFailed + } + return bytes.map { String(format: "%02x", $0) }.joined() + } +} + +/// 启动取消标记在任务执行器与服务队列间同步,取消先到时也不会遗留监听。 +private final class StartCancellation: @unchecked Sendable { + private let lock = NSLock() + private var cancelled = false + var isCancelled: Bool { lock.lock(); defer { lock.unlock() }; return cancelled } + func cancel() { lock.lock(); cancelled = true; lock.unlock() } +} + +/// 一个 listener 与其授权文件的生命周期,所有成员只在服务串行队列访问。 +private final class SessionContext { + let id: UUID + let video: DroneDockDeliveryVideo + let contentType: String + let token: String + let endpoint: DroneDockNearbyTransferEndpoint + let listener: NWListener + let expiresAt: Date + let cancellation: StartCancellation + let onEvent: @Sendable (DroneDockNearbyTransferEvent) -> Void + var continuation: CheckedContinuation? + var connections: [UUID: ConnectionContext] = [:] + var downloadID: UUID? + var host = "" + var startTimer: DispatchWorkItem? + var expiryTimer: DispatchWorkItem? + var networkTimer: DispatchSourceTimer? + var pagePath: String { "/s/\(token)" } + var videoPath: String { pagePath + "/video" } + + init(id: UUID, video: DroneDockDeliveryVideo, contentType: String, token: String, + endpoint: DroneDockNearbyTransferEndpoint, listener: NWListener, expiresAt: Date, + cancellation: StartCancellation, onEvent: @escaping @Sendable (DroneDockNearbyTransferEvent) -> Void, + continuation: CheckedContinuation) { + self.id = id; self.video = video; self.contentType = contentType; self.token = token + self.endpoint = endpoint; self.listener = listener; self.expiresAt = expiresAt + self.cancellation = cancellation; self.onEvent = onEvent; self.continuation = continuation + } +} + +/// 单个有界 HTTP 请求及文件游标,关闭连接时同步释放文件句柄。 +private final class ConnectionContext { + let id = UUID() + let connection: NWConnection + var requestBytes = Data() + var file: FileHandle? + var timeout: DispatchWorkItem? + var isDownload = false + var isWholeFile = false + var responseBytes: Int64 = 0 + var sentBytes: Int64 = 0 + var lastProgressTime: UInt64 = 0 + init(connection: NWConnection) { self.connection = connection } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockNearbyVideoResourceWriter.swift b/suixinkan/Features/DroneDock/Services/DroneDockNearbyVideoResourceWriter.swift new file mode 100644 index 0000000..9db99aa --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockNearbyVideoResourceWriter.swift @@ -0,0 +1,153 @@ +import Foundation +import Photos + +/// 本地 Photos 分块读取边界;实现必须允许回调同步发生,并支持跨线程取消。 +protocol DroneDockNearbyVideoResourceRequesting: AnyObject, Sendable { + /// 开始读取,数据和完成回调可以在任意线程或方法返回前到达。 + func requestData(onData: @escaping @Sendable (Data) -> Void, + onComplete: @escaping @Sendable (Error?) -> Void) -> PHAssetResourceDataRequestID + /// 停止已分配身份的读取请求。 + func cancelDataRequest(_ id: PHAssetResourceDataRequestID) +} + +/// 将 Photos 数据流写入独占文件;取消或超限立即关闭并删除未完成文件。 +enum DroneDockNearbyVideoResourceWriter { + /// 创建禁止 iCloud 下载的参数;没有网络回退路径。 + static func localResourceOptions() -> PHAssetResourceRequestOptions { + let options = PHAssetResourceRequestOptions() + options.isNetworkAccessAllowed = false + return options + } + + /// 从 Photos 导出本地资源,执行与成片选择一致的单文件大小上限。 + static func write(resource: PHAssetResource, to url: URL) async throws { + try await write(requester: PhotosNearbyVideoRequester(resource: resource), to: url, + maximumByteCount: Int64(DroneDockFilmPolicy.maximumFileSize)) + } + + /// 注入数据流以验证取消竞争、超限和失败清理;只保留完整成功的文件。 + static func write(requester: any DroneDockNearbyVideoResourceRequesting, to url: URL, + maximumByteCount: Int64) async throws { + let operation = try NearbyVideoWriteOperation(requester: requester, url: url, maximumByteCount: maximumByteCount) + try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { continuation in operation.start(continuation) } + } onCancel: { + operation.cancel() + } + } +} + +/// Photos 的线程安全系统入口适配;资源和管理器在建立后不再变化。 +private final class PhotosNearbyVideoRequester: DroneDockNearbyVideoResourceRequesting, @unchecked Sendable { + private let resource: PHAssetResource + private let manager: PHAssetResourceManager + + init(resource: PHAssetResource, manager: PHAssetResourceManager = .default()) { + self.resource = resource + self.manager = manager + } + + func requestData(onData: @escaping @Sendable (Data) -> Void, + onComplete: @escaping @Sendable (Error?) -> Void) -> PHAssetResourceDataRequestID { + manager.requestData(for: resource, options: DroneDockNearbyVideoResourceWriter.localResourceOptions(), + dataReceivedHandler: onData, completionHandler: onComplete) + } + + func cancelDataRequest(_ id: PHAssetResourceDataRequestID) { manager.cancelDataRequest(id) } +} + +/// 同一锁串行保护句柄、完成结果和请求身份,系统回调永远只恢复 continuation 一次。 +private final class NearbyVideoWriteOperation: @unchecked Sendable { + private let lock = NSLock() + private let requester: any DroneDockNearbyVideoResourceRequesting + private let url: URL + private let maximumByteCount: Int64 + private var handle: FileHandle? + private var byteCount: Int64 = 0 + private var requestID: PHAssetResourceDataRequestID? + private var continuation: CheckedContinuation? + private var result: Result? + private var needsRequestCancellation = false + + init(requester: any DroneDockNearbyVideoResourceRequesting, url: URL, maximumByteCount: Int64) throws { + guard url.isFileURL, maximumByteCount > 0 else { throw DroneDockFilmError.invalidLocalFile } + guard !FileManager.default.fileExists(atPath: url.path) else { throw CocoaError(.fileWriteFileExists) } + guard FileManager.default.createFile(atPath: url.path, contents: nil) else { throw CocoaError(.fileWriteUnknown) } + do { handle = try FileHandle(forWritingTo: url) } + catch { try? FileManager.default.removeItem(at: url); throw error } + self.requester = requester + self.url = url + self.maximumByteCount = maximumByteCount + } + + func start(_ continuation: CheckedContinuation) { + lock.lock() + if let result { + lock.unlock() + continuation.resume(with: result) + return + } + self.continuation = continuation + lock.unlock() + + let id = requester.requestData(onData: { [weak self] data in self?.receive(data) }, onComplete: { [weak self] error in + if let error { self?.finish(.failure(error), cancelRequest: false) } + else { self?.finish(.success(()), cancelRequest: false) } + }) + lock.lock() + requestID = id + let shouldCancel = needsRequestCancellation + lock.unlock() + // 取消和同步错误回调可能先于 requestData 返回,等拿到身份后补发取消。 + if shouldCancel { requester.cancelDataRequest(id) } + } + + func cancel() { finish(.failure(CancellationError()), cancelRequest: true) } + + private func receive(_ data: Data) { + lock.lock() + guard result == nil else { lock.unlock(); return } + guard Int64(data.count) <= maximumByteCount - byteCount else { + let completion = finishLocked(.failure(DroneDockFilmError.fileTooLarge), cancelRequest: true) + lock.unlock() + completion?() + return + } + do { + try handle?.write(contentsOf: data) + byteCount += Int64(data.count) + lock.unlock() + } catch { + let completion = finishLocked(.failure(error), cancelRequest: true) + lock.unlock() + completion?() + } + } + + private func finish(_ proposedResult: Result, cancelRequest: Bool) { + lock.lock() + let completion = finishLocked(proposedResult, cancelRequest: cancelRequest) + lock.unlock() + completion?() + } + + private func finishLocked(_ proposedResult: Result, cancelRequest: Bool) -> (() -> Void)? { + guard result == nil else { return nil } + var resolved = proposedResult + if case .success = resolved, byteCount == 0 { resolved = .failure(DroneDockFilmError.emptyFile) } + do { try handle?.close() } + catch { if case .success = resolved { resolved = .failure(error) } } + handle = nil + if case .failure = resolved { try? FileManager.default.removeItem(at: url) } + result = resolved + needsRequestCancellation = cancelRequest + let continuation = self.continuation + self.continuation = nil + let id = cancelRequest ? requestID : nil + // Photos 取消可能同步触发完成回调,不能在锁内调用。 + return { [requester] in + if let id { requester.cancelDataRequest(id) } + continuation?.resume(with: resolved) + } + } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockShootingRealtimeSession.swift b/suixinkan/Features/DroneDock/Services/DroneDockShootingRealtimeSession.swift new file mode 100644 index 0000000..2050557 --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockShootingRealtimeSession.swift @@ -0,0 +1,334 @@ +import Foundation + +/// 前台任务订阅协调器:完整推送正常时停 HTTP,连接异常时通知页面恢复串行兜底读取。 +@MainActor +final class DroneDockShootingRealtimeSession { + /// 明确区分订阅中、有效实时快照、兜底和永久权限失败。 + enum State: Equatable { + case stopped, connecting, live, fallback(String), denied(String) + } + + /// 接收完整快照,由业务 ViewModel 统一核对身份和 HTTP/推送版本。 + var onSnapshot: ((DroneDockShootingResponse) -> DroneDockSnapshotAcceptance)? + /// 通知页面调整读取策略和提示,不直接持有 UIKit。 + var onConnectionState: ((State) -> Void)? + /// 正式订阅确认无缓存后,请页面在现有串行读取通道补取一份新 HTTP 全量。 + var onHTTPSeedRequired: (() -> Void)? + /// 请求开始时捕获此标识;连接、缓存提示或首包变化后,旧标识不能完成新订阅。 + private(set) var pendingHTTPSeedRequest: UUID? + /// 当前链路状态;仅 live 表示订阅和完整快照都已确认。 + private(set) var state: State = .stopped + + private let taskID: Int + private let ticketService: any DroneDockSocketTicketServing + private let makeTransport: () -> any DroneDockShootingSocketTransport + private let identityIsCurrent: () -> Bool + private let delay: @Sendable (UInt64) async throws -> Void + private let now: () -> TimeInterval + private let source: String + private var transport: (any DroneDockShootingSocketTransport)? + private var connectionTask: Task? + private var deadlineTask: Task? + private var heartbeatTask: Task? + private var pongDeadlineTask: Task? + private var retryTask: Task? + private var active = false + private var generation = 0 + private var retryAttempt = 0 + private var subscriptionSent = false + private var subscribed = false + private var lastSnapshotAt: TimeInterval? + private var latestSnapshot: DroneDockShootingResponse? + private var requestedHTTPSeed = false + private var httpSeedMinimumBatch: Int? + + /// 全部外部依赖可替换,延时按纳秒注入以确定性验证断线、超时与重连。 + init(taskID: Int, ticketService: any DroneDockSocketTicketServing, + makeTransport: @escaping () -> any DroneDockShootingSocketTransport, + identityIsCurrent: @escaping () -> Bool, + source: String = "network", + now: @escaping () -> TimeInterval = { ProcessInfo.processInfo.systemUptime }, + delay: @escaping @Sendable (UInt64) async throws -> Void = { try await Task.sleep(nanoseconds: $0) }) { + self.taskID = taskID + self.ticketService = ticketService + self.makeTransport = makeTransport + self.identityIsCurrent = identityIsCurrent + self.delay = delay + self.now = now + self.source = source + } + + deinit { + connectionTask?.cancel() + deadlineTask?.cancel() + heartbeatTask?.cancel() + pongDeadlineTask?.cancel() + retryTask?.cancel() + } + + /// 初始 HTTP 完成后启动;重复出现事件不会重复订阅。 + func start() { + guard !active, taskID > 0 else { return } + if case .denied = state { return } + active = true + retryAttempt = 0 + connect() + } + + /// 离页/后台取消计时和接收,所有迟到消息由 generation 丢弃。 + func stop() { + active = false + retryTask?.cancel() + retryTask = nil + clearConnection(unsubscribe: true) + if case .denied = state { return } + update(.stopped) + } + + /// 仅接受当前无缓存订阅之后新发起、并已由业务层采纳或去重的完整 HTTP 结果。 + func acceptHTTPSeed(_ result: DroneDockHTTPSnapshotResult, requestID: UUID) { + guard active, subscribed, pendingHTTPSeedRequest == requestID, accepts(generation) else { return } + switch result.acceptance { + case .applied, .duplicate: break + case .outdated, .invalid: return + } + let snapshot = result.snapshot + guard snapshot.orderFlightTaskID == taskID, snapshot.snapshotKind == "full", + let batch = snapshot.executionBatch, batch >= 0, + httpSeedMinimumBatch.map({ batch >= $0 }) ?? true, + let version = snapshot.stateVersion, version > 0, snapshot.ui?.phase != nil else { return } + pendingHTTPSeedRequest = nil + deadlineTask?.cancel() + deadlineTask = nil + retryAttempt = 0 + latestSnapshot = snapshot + lastSnapshotAt = now() + log("websocket.http_seed_accepted", fields: ["execution_batch": batch, "state_version": version]) + checkDataHealth() + } + + private func connect() { + guard active else { return } + guard identityIsCurrent() else { deny("账号或景区已变化,请返回工作台重新进入"); return } + clearConnection(unsubscribe: false) + update(.connecting) + let current = generation + let ticketService = ticketService + let delay = delay + // 票据、握手、ack 或首包卡住时,HTTP 仍可兜底,随后重连。 + deadlineTask = Task { @MainActor [weak self] in + do { try await delay(12_000_000_000) } catch { return } + guard let self, self.accepts(current) else { return } + self.fail("任务订阅超时,正在通过接口更新") + } + connectionTask = Task { @MainActor [weak self] in + do { + let ticket = try await ticketService.socketTicket() + guard let self, self.accepts(current) else { return } + guard !ticket.socketToken.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { + throw APIError.decodeFailed("订阅票据为空") + } + let transport = self.makeTransport() + self.transport = transport + // 不让无限 receive 循环强持有协调器或页面。 + self.connectionTask = Task { @MainActor [weak self] in + do { + while !Task.isCancelled { + let data = try await transport.receive() + guard let self, self.accepts(current) else { return } + self.log("response.received", fields: ["body": DroneDockDiagnostics.payload(data)]) + try await self.handle(DroneDockShootingSocketMessage.decode(data), + generation: current, transport: transport, token: ticket.socketToken) + } + } catch { + guard let self, self.accepts(current) else { return } + self.fail(error.localizedDescription) + } + } + } catch { + guard let self, self.accepts(current) else { return } + if Self.isAccessFailure(error) { self.deny(error.localizedDescription) } + else { self.fail(error.localizedDescription) } + } + } + } + + private func handle(_ message: DroneDockShootingSocketMessage, generation current: Int, + transport: any DroneDockShootingSocketTransport, token: String) async throws { + switch message { + case .opened: + // 必须先等应用层 Opened,再发文本帧;重复欢迎消息不能重复订阅或延长首包期限。 + guard !subscriptionSent else { return } + let request = DroneDockShootingSocketMessage.subscribe(taskID: taskID, token: token) + try await transport.send(request) + guard accepts(current) else { return } + subscriptionSent = true + // 记录实际完成本地发送的 310;服务端是否接受仍以 ack 和完整快照为准。 + log("request.started", fields: ["body": DroneDockDiagnostics.payload(Data(request.utf8))]) + startHeartbeat(generation: current, transport: transport) + case .subscribed(let id): + guard subscriptionSent else { throw APIError.decodeFailed("订阅回执先于 310 发送") } + guard id == taskID else { throw APIError.decodeFailed("订阅回执任务不一致") } + subscribed = true + case .subscriptionMetadata(let id, let hasSnapshot, let batch): + // 元数据仅描述缓存,不确认订阅、不延长首包期限,也不能降级已有有效快照。 + guard subscribed, id == taskID, latestSnapshot == nil else { return } + if hasSnapshot { + pendingHTTPSeedRequest = nil + } else if !requestedHTTPSeed { + requestedHTTPSeed = true + httpSeedMinimumBatch = batch + pendingHTTPSeedRequest = UUID() + update(.fallback("任务缓存尚未就绪,正在通过接口更新")) + onHTTPSeedRequired?() + } + case .snapshot(let snapshot): + guard snapshot.orderFlightTaskID == taskID else { + log("websocket.snapshot_ignored", fields: ["reason": "different_task"]) + return + } + guard subscribed else { throw APIError.decodeFailed("任务快照先于订阅回执") } + switch onSnapshot?(snapshot) ?? .invalid { + case .applied, .duplicate: + pendingHTTPSeedRequest = nil + deadlineTask?.cancel() + deadlineTask = nil + retryAttempt = 0 + latestSnapshot = snapshot + lastSnapshotAt = now() + checkDataHealth() + case .outdated: + log("websocket.snapshot_ignored", fields: ["reason": "old_version"]) + case .invalid: throw APIError.decodeFailed("任务快照身份或结构不一致") + } + case .subscriptionTimedOut(let message): + // 收到服务端三秒鉴权超时便结束本轮等待,保留 HTTP,并退避取新票重连。 + fail(message) + case .subscriptionRejected(let code, let message): + // 310 明确拒绝可按错误码处理,不依赖服务端说明的语言或措辞。 + if code == 100099 { deny(message) } + else { fail(message) } + case .rejected(let code, let message): + if code == 100099, message.contains("无权订阅") || message.contains("飞行任务不存在") { + deny(message) + } else { + // 100098 是 socket 票据失败,重新取票;不当成 App 登录失效。 + fail(message) + } + case .unrelated: break + } + } + + private func startHeartbeat(generation current: Int, transport: any DroneDockShootingSocketTransport) { + let delay = delay + heartbeatTask = Task { @MainActor [weak self] in + do { + while !Task.isCancelled { + try await delay(20_000_000_000) + guard let self, self.accepts(current) else { return } + self.pongDeadlineTask = Task { @MainActor [weak self] in + do { try await delay(10_000_000_000) } catch { return } + guard let self, self.accepts(current) else { return } + self.fail("任务连接心跳超时,正在通过接口更新") + } + try await transport.ping() + guard self.accepts(current) else { return } + self.pongDeadlineTask?.cancel() + self.pongDeadlineTask = nil + self.log("websocket.pong") + self.checkDataHealth() + // 没有业务变化时允许长期静默,不能按 5 秒未推送误判断线。 + } + } catch { + guard let self, self.accepts(current) else { return } + self.fail(error.localizedDescription) + } + } + } + + private func fail(_ message: String) { + guard active else { return } + clearConnection(unsubscribe: false) + update(.fallback(message)) + guard active else { return } + retryTask?.cancel() + let seconds = [1, 2, 4, 8, 16, 30][min(retryAttempt, 5)] + retryAttempt += 1 + log("websocket.reconnect_scheduled", fields: ["delay_seconds": seconds]) + let current = generation + let delay = delay + retryTask = Task { @MainActor [weak self] in + do { try await delay(UInt64(seconds) * 1_000_000_000) } catch { return } + guard let self, self.accepts(current) else { return } + self.retryTask = nil + self.connect() + } + } + + private func deny(_ message: String) { + active = false + retryTask?.cancel() + retryTask = nil + clearConnection(unsubscribe: false) + update(.denied(message)) + } + + private func accepts(_ current: Int) -> Bool { + guard active, generation == current, !Task.isCancelled else { return false } + guard identityIsCurrent() else { deny("账号或景区已变化,请返回工作台重新进入"); return false } + return true + } + + private func clearConnection(unsubscribe: Bool) { + generation &+= 1 + connectionTask?.cancel(); connectionTask = nil + deadlineTask?.cancel(); deadlineTask = nil + heartbeatTask?.cancel(); heartbeatTask = nil + pongDeadlineTask?.cancel(); pongDeadlineTask = nil + let unsubscribeTaskID = unsubscribe && subscriptionSent ? taskID : nil + if unsubscribeTaskID != nil, transport != nil { + log("request.started", fields: ["body": DroneDockDiagnostics.payload(Data(DroneDockShootingSocketMessage.unsubscribe(taskID: taskID).utf8))]) + } + transport?.close(unsubscribing: unsubscribeTaskID) + transport = nil + subscriptionSent = false + subscribed = false + latestSnapshot = nil + lastSnapshotAt = nil + requestedHTTPSeed = false + pendingHTTPSeedRequest = nil + httpSeedMinimumBatch = nil + } + + private func checkDataHealth() { + guard subscribed, let snapshot = latestSnapshot, let receivedAt = lastSnapshotAt else { return } + if snapshot.metricsStale == true { + update(.fallback("设备读数缓存已过期,正在通过接口核对")) + } else if snapshot.ui?.phase == "shooting", now() - receivedAt >= 120 { + // 拍摄中后端约每 30 秒更新;连续四个周期无完整包,保持连接并用只读 HTTP 核对。 + // 其它阶段只在变化时推送,不能仅因静默判定异常。 + update(.fallback("拍摄状态长时间未更新,正在通过接口核对")) + } else { + update(.live) + } + } + + private static func isAccessFailure(_ error: Error) -> Bool { + if APIError.isAuthenticationExpired(error) { return true } + guard case APIError.serverCode(let code, let message) = error else { return false } + return code == 100099 && (message.contains("无权") || message.contains("无权限")) + } + + private func update(_ value: State) { + guard state != value else { return } + state = value + log("websocket.state", fields: ["state": String(describing: value)]) + onConnectionState?(value) + } + + private func log(_ event: String, fields: [String: Any] = [:]) { + DroneDockDiagnostics.event(event, taskID: taskID, + fields: fields.merging(["transport": "websocket", "path": "/wss", "source": source, + "request_params": event == "request.started" ? fields["body"] ?? [:] : ["id": taskID]]) { _, new in new }) + } +} diff --git a/suixinkan/Features/DroneDock/Services/DroneDockShootingSocketTransport.swift b/suixinkan/Features/DroneDock/Services/DroneDockShootingSocketTransport.swift new file mode 100644 index 0000000..fb30d29 --- /dev/null +++ b/suixinkan/Features/DroneDock/Services/DroneDockShootingSocketTransport.swift @@ -0,0 +1,59 @@ +import Foundation + +/// 任务 WebSocket 的隔离传输边界,测试替身不能转发到真实网络。 +@MainActor +protocol DroneDockShootingSocketTransport: AnyObject { + /// 发送订阅 JSON。 + func send(_ text: String) async throws + /// 等待一条完整消息。 + func receive() async throws -> Data + /// 使用原生 Ping/Pong 检查链路,不发送业务或设备指令。 + func ping() async throws + /// 关闭连接,离页时尽力发送 311,最多等待一秒。 + func close(unsubscribing taskID: Int?) +} + +/// Foundation WebSocket 实现;连接生命周期由任务页的实时协调器管理。 +@MainActor +final class DroneDockURLSessionShootingSocket: DroneDockShootingSocketTransport { + private let socket: URLSessionWebSocketTask + + /// 仅使用环境指定的 wss 地址,无登录 Header、无设备连接。 + init(url: URL, session: URLSession = .shared) { + socket = session.webSocketTask(with: url) + socket.resume() + } + + deinit { socket.cancel(with: .goingAway, reason: nil) } + + func send(_ text: String) async throws { try await socket.send(.string(text)) } + + func receive() async throws -> Data { + switch try await socket.receive() { + case .string(let text): return Data(text.utf8) + case .data(let data): return data + @unknown default: throw APIError.invalidResponse + } + } + + func ping() async throws { + try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in + socket.sendPing { error in + if let error { continuation.resume(throwing: error) } + else { continuation.resume() } + } + } + } + + func close(unsubscribing taskID: Int?) { + guard let taskID else { socket.cancel(with: .goingAway, reason: nil); return } + let socket = socket + socket.send(.string(DroneDockShootingSocketMessage.unsubscribe(taskID: taskID))) { _ in + socket.cancel(with: .normalClosure, reason: nil) + } + Task { + try? await Task.sleep(nanoseconds: 1_000_000_000) + socket.cancel(with: .normalClosure, reason: nil) + } + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDeliveryViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDeliveryViewModel.swift new file mode 100644 index 0000000..a1a7cf7 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDeliveryViewModel.swift @@ -0,0 +1,433 @@ +import Foundation + +/// 本地成片上传与整单确认规则;不访问网络、系统相册或真实游客服务。 +final class DroneDeliveryViewModel { + /// 与机巢、订单及原素材页面共享的数据源。 + let store: DroneDockDemoStore + /// 固定入口订单,避免列表位置变化后操作其他订单。 + let orderID: String + /// 用户为下一批明确选择的点位;整单入口初始不自动选点。 + private(set) var selectedPointID: String? + /// 用户选择的本地示例视频,不读取相册。 + private(set) var selectedVideoIDs: Set = [] + private let context: DroneDockContext + private let now: () -> Date + + /// 当前景区、工作人员范围内可访问的入口订单。 + var order: DroneShootingOrder? { isCurrentContext ? store.shootingOrder(id: orderID) : nil } + /// 配置允许选择的点位,上传不受拍摄距离约束。 + var points: [DroneShootingPoint] { order != nil ? store.shootingPreparations[key]?.points ?? [] : [] } + /// 当前明确选择的有效点位。 + var selectedPoint: DroneShootingPoint? { points.first { $0.id == selectedPointID } } + /// 本点尚未成功交付的四个本地视频样例。 + var availableVideos: [DroneDeliveryVideo] { + guard let point = selectedPoint else { return [] } + let uploadedSources = Set(works.filter { $0.pointID == point.id }.map(\.sourceVideoID)) + return Self.demoVideos(pointName: point.name).filter { !uploadedSources.contains($0.id) } + } + /// 当前人工选择的视频数量。 + var selectedVideoCount: Int { selectedVideoIDs.count } + /// 上传队列未清除前冻结点位与选择,包括失败结果页。 + var isUploadLocked: Bool { batch != nil } + /// 点位和至少一个视频均已明确选择才可开始。 + var canStartUpload: Bool { order != nil && batch == nil && selectedPoint != nil && selectedVideoCount > 0 } + /// 当前共享上传队列及执行令牌。 + var batch: DroneDeliveryUploadBatch? { library?.batch } + /// 本批成功项数,不代表整单交齐或游客确认。 + var uploadedCount: Int { batch?.items.filter { $0.state.isCompleted }.count ?? 0 } + /// 本批明确失败项数。 + var failedCount: Int { batch?.items.filter { $0.state.isFailed }.count ?? 0 } + /// 本批仍需继续的文件数,不包括明确失败项。 + var pendingCount: Int { batch?.items.filter { !$0.state.isCompleted && !$0.state.isFailed }.count ?? 0 } + /// 本批固定文件总数。 + var totalUploadCount: Int { batch?.items.count ?? 0 } + /// 完成文件数量占比,不从虚构网络数据推断交付成功。 + var uploadProgress: Double { totalUploadCount == 0 ? 0 : Double(uploadedCount) / Double(totalUploadCount) } + /// 上传底栏使用的阶段。 + var uploadPhase: DroneDeliveryUploadPhase { + guard let batch else { return .idle } + if batch.isPaused && pendingCount > 0 { return .paused } + if batch.items.contains(where: { if case .uploading = $0.state { return true }; return false }) { return .uploading } + if failedCount > 0 { return .partialFailure } + return uploadedCount == totalUploadCount ? .completed : .idle + } + /// 所有批次成功交付的本机演示作品。 + var works: [DroneDeliveryWork] { library?.works ?? [] } + /// 当前整单成功作品按点位汇总。 + var workGroups: [DroneDeliveryWorkGroup] { Self.groups(works) } + /// 当前版本是否由商家明确勾选交齐,新作品成功追加会清除此勾选。 + var isAllDeliveredReviewed: Bool { + guard let state = library else { return false } + return !state.works.isEmpty && state.merchantReviewedRevision == state.revision + } + /// 有成功作品、没有未结束上传且明确勾选交齐后才可创建整单确认。 + var canCreateConfirmation: Bool { canReviewCurrentWorks && isAllDeliveredReviewed } + /// 当前作品版本的有效确认会话,旧清单仍保留在历史中。 + var confirmationSession: DroneDeliveryConfirmationSession? { + guard let state = library, let id = state.currentSessionID else { return nil } + return state.sessions.first { $0.id == id && $0.revision == state.revision } + } + /// 核对、等待、查看、反馈和确认保持独立,不由刷新自动推进。 + var confirmationPhase: DroneDeliveryConfirmationPhase { confirmationSession?.status ?? .review } + /// 当前确认会话冻结清单按点位分组。 + var confirmationGroups: [DroneDeliveryWorkGroup] { Self.groups(confirmationSession?.works ?? []) } + /// 历次已明确模拟确认的记录,追加作品后原快照仍保留。 + var confirmationRecords: [DroneDeliveryConfirmationSession] { + (library?.sessions ?? []).enumerated().filter { $0.element.status == .confirmed }.sorted { + let firstDate = $0.element.confirmedAt ?? $0.element.createdAt + let secondDate = $1.element.confirmedAt ?? $1.element.createdAt + return firstDate == secondDate ? $0.offset > $1.offset : firstDate > secondDate + }.map(\.element) + } + /// 最近一次已确认的本机演示凭据,不冒充真实收货证明。 + var latestReceipt: DroneDeliveryConfirmationSession? { confirmationRecords.first } + /// 最近已确认快照的分点清单。 + var receiptGroups: [DroneDeliveryWorkGroup] { Self.groups(latestReceipt?.works ?? []) } + + private var isCurrentContext: Bool { store.context == context } + private var key: DroneShootingSessionKey { DroneShootingSessionKey(context: context, orderID: orderID) } + private var library: DroneDeliveryLibraryState? { order != nil ? store.deliveryLibraries[key] : nil } + private var canReviewCurrentWorks: Bool { order != nil && !works.isEmpty && pendingCount == 0 && failedCount == 0 } + + /// 指定入口订单和可选预选点位,时钟可注入以测试确认时间。 + init(store: DroneDockDemoStore, orderID: String, pointID: String? = nil, now: @escaping () -> Date = Date.init) { + self.store = store + self.orderID = orderID + selectedPointID = pointID + context = store.context + self.now = now + refresh() + } + + /// 主动读取共享状态;已存在交付摘要首次生成相应作品及确认快照。 + func refresh() { + guard isCurrentContext, let order else { + pauseStoredUpload(reason: .leavingPage) + selectedVideoIDs = [] + return + } + store.ensureShootingPreparation(orderID: orderID) + if store.deliveryLibraries[key] == nil { + store.deliveryLibraries[key] = initialState(order: order) + } + if let batch { selectedPointID = batch.pointID } + else if !points.contains(where: { $0.id == selectedPointID }) { selectedPointID = nil } + if batch == nil { selectedVideoIDs.formIntersection(Set(availableVideos.map(\.id))) } + projectOrderSummary() + } + + /// 点位改变清空旧视频勾选,进行中的固定批次不能改点。 + func selectPoint(id: String) { + guard !isUploadLocked, points.contains(where: { $0.id == id }), selectedPointID != id else { return } + selectedPointID = id + selectedVideoIDs = [] + } + + /// 独立切换本点仍可上传的视频选择。 + func toggleVideo(id: String) { + guard !isUploadLocked, availableVideos.contains(where: { $0.id == id }) else { return } + if !selectedVideoIDs.insert(id).inserted { selectedVideoIDs.remove(id) } + } + + /// 开始本地演示批次,只冻结已选文件,不表示真实云端已上传。 + @discardableResult + func startUpload() -> Bool { + guard canStartUpload, let point = selectedPoint, var state = library else { return false } + let videos = availableVideos.filter { selectedVideoIDs.contains($0.id) } + guard !videos.isEmpty else { return false } + state.batch = DroneDeliveryUploadBatch(id: UUID(), pointID: point.id, pointName: point.name, + items: videos.map { DroneDeliveryUploadItem(id: UUID().uuidString, video: $0, state: .uploading(progress: 0)) }, + isPaused: false, pauseReason: nil) + store.deliveryLibraries[key] = state + return true + } + + /// 后台、锁屏或离页停止未完成执行,已成功作品始终保留。 + func pauseUpload(reason: DroneDeliveryPauseReason) { + guard isCurrentContext else { return } + pauseStoredUpload(reason: reason) + } + + /// 用户手动继续仅处理未完成项,失败项需单独重试。 + @discardableResult + func continueUpload() -> Bool { + guard var state = library, let old = state.batch, old.isPaused, pendingCount > 0 else { return false } + let items = old.items.map { item -> DroneDeliveryUploadItem in + var item = item + if item.state == .paused { item.state = .uploading(progress: 0) } + return item + } + state.batch = renewedBatch(old, items: items, isPaused: false, reason: nil) + store.deliveryLibraries[key] = state + return true + } + + /// 仅重试明确失败的文件;已成功作品不会再次加入或上传。 + @discardableResult + func retryFailedUploads() -> Bool { + guard var state = library, let old = state.batch, pendingCount == 0, failedCount > 0 else { return false } + let items = old.items.map { item -> DroneDeliveryUploadItem in + var item = item + if item.state.isFailed { item.state = .uploading(progress: 0) } + return item + } + state.batch = renewedBatch(old, items: items, isPaused: false, reason: nil) + store.deliveryLibraries[key] = state + return true + } + + /// 明确结束已完成或失败的批次后继续同一点追加;成功作品不受影响。 + func clearUploadBatch() { + guard var state = library, state.batch != nil, pendingCount == 0 else { return } + state.batch = nil + store.deliveryLibraries[key] = state + selectedVideoIDs = [] + } + + /// 接收本地上传回执,校验上下文、批次令牌及单项状态后才追加作品。 + func receiveUpload(_ event: DroneDeliveryUploadEvent, itemID: String, batchID: UUID) { + guard var state = library, var batch = state.batch, batch.id == batchID, !batch.isPaused, + let index = batch.items.firstIndex(where: { $0.id == itemID }), + case .uploading(let previous) = batch.items[index].state else { return } + let item = batch.items[index] + switch event { + case .progress(let value): + guard value.isFinite else { return } + batch.items[index].state = .uploading(progress: max(previous, min(1, max(0, value)))) + case .failed(let message): batch.items[index].state = .failed(message: message) + case .succeeded: + batch.items[index].state = .completed + if !state.works.contains(where: { $0.id == item.id || ($0.pointID == batch.pointID && $0.sourceVideoID == item.video.id) }) { + state.works.append(Self.work(item: item, pointID: batch.pointID, pointName: batch.pointName, date: now())) + state.revision += 1 + state.merchantReviewedRevision = nil + state.currentSessionID = nil + } + } + state.batch = batch + store.deliveryLibraries[key] = state + projectOrderSummary() + } + + /// 商家明确核对本版本全部成功作品,不由上传完成自动勾选。 + func setAllDeliveredReviewed(_ checked: Bool) { + guard var state = library else { return } + state.merchantReviewedRevision = checked && canReviewCurrentWorks ? state.revision : nil + store.deliveryLibraries[key] = state + } + + /// 为当前整单清单创建不可替换的本机演示确认会话,重复点击复用同一会话。 + @discardableResult + func createConfirmationSession() -> Bool { + guard canCreateConfirmation, var state = library, let order else { return false } + if confirmationSession != nil { return true } + let session = makeSession(works: state.works, revision: state.revision, order: order) + state.sessions.append(session) + state.currentSessionID = session.id + store.deliveryLibraries[key] = state + projectOrderSummary() + return true + } + + /// 只刷新共享状态,不推断游客已经查看或已经确认。 + func refreshConfirmation() { refresh() } + + /// 明确回到商家核对并废弃当前令牌,历史清单与已确认记录仍保留。 + func beginNewReview() { + guard var state = library else { return } + state.currentSessionID = nil + state.merchantReviewedRevision = nil + store.deliveryLibraries[key] = state + projectOrderSummary() + } + + private func pauseStoredUpload(reason: DroneDeliveryPauseReason) { + guard var state = store.deliveryLibraries[key], let old = state.batch, + old.items.contains(where: { !$0.state.isCompleted && !$0.state.isFailed }) else { return } + let items = old.items.map { item -> DroneDeliveryUploadItem in + var item = item + if case .uploading = item.state { item.state = .paused } + return item + } + state.batch = renewedBatch(old, items: items, isPaused: true, reason: reason) + store.deliveryLibraries[key] = state + } + + private func renewedBatch(_ old: DroneDeliveryUploadBatch, items: [DroneDeliveryUploadItem], + isPaused: Bool, reason: DroneDeliveryPauseReason?) -> DroneDeliveryUploadBatch { + DroneDeliveryUploadBatch(id: UUID(), pointID: old.pointID, pointName: old.pointName, + items: items, isPaused: isPaused, pauseReason: reason) + } + + private func projectOrderSummary() { + guard let state = library, let order else { return } + let confirmation: DroneVisitorConfirmationState + if state.works.isEmpty { confirmation = .none } + else if confirmationSession?.status == .confirmed { confirmation = .confirmed } + else { confirmation = state.sessions.isEmpty ? .none : .awaitingConfirmation } + store.replaceShootingOrder(order.replacingDeliverySummary(count: state.works.count, confirmation: confirmation)) + } + + private func initialState(order: DroneShootingOrder) -> DroneDeliveryLibraryState { + var state = DroneDeliveryLibraryState() + guard order.deliveredVideoCount > 0 else { return state } + state.works = seededWorks(count: order.deliveredVideoCount) + state.revision = 1 + if order.visitorConfirmationState != .none { + var session = makeSession(works: state.works, revision: state.revision, order: order) + if order.visitorConfirmationState == .confirmed { + session.status = .confirmed + session.visitorAcknowledged = true + session.confirmedAt = now() + } + state.sessions = [session] + state.currentSessionID = session.id + state.merchantReviewedRevision = state.revision + } + return state + } + + private func makeSession(works: [DroneDeliveryWork], revision: Int, order: DroneShootingOrder) -> DroneDeliveryConfirmationSession { + DroneDeliveryConfirmationSession(id: UUID(), revision: revision, orderID: order.id, + orderNumber: order.orderNumber, visitorName: order.customerName, operatorName: context.photographerName, + scenicName: context.scenicName, works: works, createdAt: now(), status: .awaitingConfirmation, + confirmedAt: nil, feedback: nil, visitorAcknowledged: false) + } + + private func seededWorks(count: Int) -> [DroneDeliveryWork] { + guard count > 0 else { return [] } + let knownPoints = points + return (0.. DroneDeliveryWork { + DroneDeliveryWork(id: item.id, sourceVideoID: item.video.id, pointID: pointID, pointName: pointName, + title: item.video.title, fileName: item.video.fileName, previewAssetName: item.video.previewAssetName, + previewURL: item.video.previewURL, durationText: item.video.durationText, sizeText: item.video.sizeText, + deliveredAt: date, isSimulation: true) + } + + private static func groups(_ works: [DroneDeliveryWork]) -> [DroneDeliveryWorkGroup] { + var pointIDs: [String] = [] + var grouped: [String: [DroneDeliveryWork]] = [:] + for work in works { + if grouped[work.pointID] == nil { pointIDs.append(work.pointID) } + grouped[work.pointID, default: []].append(work) + } + return pointIDs.compactMap { id in + guard let items = grouped[id], let first = items.first else { return nil } + return DroneDeliveryWorkGroup(pointID: id, pointName: first.pointName, works: items) + } + } + + private static func demoVideos(pointName: String) -> [DroneDeliveryVideo] { + let url = Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + let assets = ["drone_demo_tourists", "drone_demo_mountain", "drone_demo_pagoda", "drone_demo_tourists"] + return (1...4).map { index in + let number = String(format: "%02d", index) + return DroneDeliveryVideo(id: "demo-video-\(index)", title: "成片视频 \(number)", + fileName: "\(pointName)_成片\(number).mp4", previewAssetName: assets[index - 1], + previewURL: url, durationText: "00:03", sizeText: "本地演示文件") + } + } + + #if DEBUG + /// 演示游客主动勾选当前冻结清单,关闭或刷新不会代为勾选。 + func setVisitorAcknowledged(_ checked: Bool) { + guard var state = library, let session = confirmationSession, session.status == .viewing, + let index = state.sessions.firstIndex(where: { $0.id == session.id }) else { return } + state.sessions[index].visitorAcknowledged = checked + store.deliveryLibraries[key] = state + } + + /// 只在 Debug 注入游客演示回执,旧会话或旧作品版本永不修改当前确认结果。 + func receiveConfirmation(_ event: DroneDeliveryConfirmationEvent, sessionID: UUID) { + guard var state = library, let session = confirmationSession, session.id == sessionID, + session.status != .confirmed, + let index = state.sessions.firstIndex(where: { $0.id == sessionID }) else { return } + switch event { + case .viewing: + guard session.status == .awaitingConfirmation || session.status == .feedback else { return } + state.sessions[index].status = .viewing + state.sessions[index].visitorAcknowledged = false + case .confirmed: + guard session.status == .viewing, session.visitorAcknowledged else { return } + state.sessions[index].status = .confirmed + state.sessions[index].confirmedAt = now() + case .feedback(let kind, let note): + guard session.status == .viewing else { return } + let trimmed = String(note.trimmingCharacters(in: .whitespacesAndNewlines).prefix(500)) + guard kind != .other || !trimmed.isEmpty else { return } + state.sessions[index].status = .feedback + state.sessions[index].visitorAcknowledged = false + state.sessions[index].feedback = DroneDeliveryFeedback(kind: kind, note: trimmed, createdAt: now()) + } + store.deliveryLibraries[key] = state + projectOrderSummary() + } + + /// 仅本地替换交付验收状态,保留拍摄额度、任务、原素材和订单归类。 + func applyScenario(_ scenario: DroneDeliveryScenario) { + guard let order else { return } + var state = library ?? initialState(order: order) + state.batch = nil + if scenario == .empty { state = DroneDeliveryLibraryState() } + store.deliveryLibraries[key] = state + selectedVideoIDs = [] + switch scenario { + case .empty, .ready: break + case .uploading, .paused, .partialFailure, .completed: + if selectedPoint == nil { selectedPointID = points.first?.id } + let chosen = Array(availableVideos.prefix(2)) + selectedVideoIDs = Set(chosen.map(\.id)) + guard startUpload(), let batch else { projectOrderSummary(); return } + if scenario == .uploading { break } + if let first = batch.items.first { receiveUpload(.succeeded, itemID: first.id, batchID: batch.id) } + if scenario == .paused { pauseUpload(reason: .background) } + else { + for item in batch.items.dropFirst() { + receiveUpload(scenario == .partialFailure ? .failed(message: "演示连接中断") : .succeeded, + itemID: item.id, batchID: batch.id) + } + } + case .awaitingConfirmation, .viewing, .feedback, .confirmed: + if state.works.isEmpty { + state.works = seededWorks(count: 3) + state.revision += 1 + store.deliveryLibraries[key] = state + } + beginNewReview() + setAllDeliveredReviewed(true) + guard createConfirmationSession(), let session = confirmationSession else { return } + if scenario != .awaitingConfirmation { receiveConfirmation(.viewing, sessionID: session.id) } + if scenario == .feedback { receiveConfirmation(.feedback(kind: .unplayable, note: "演示:有一个视频无法播放"), sessionID: session.id) } + if scenario == .confirmed { + setVisitorAcknowledged(true) + receiveConfirmation(.confirmed, sessionID: session.id) + } + } + projectOrderSummary() + } + #endif +} + +/// 复制订单交付摘要,拍摄次数、当前任务和原素材状态原样保留。 +extension DroneShootingOrder { + /// 只更新成功作品数和游客确认标签,不改变订单履约归类。 + func replacingDeliverySummary(count: Int, confirmation: DroneVisitorConfirmationState) -> DroneShootingOrder { + DroneShootingOrder(id: id, scenicID: scenicID, assignedUserID: assignedUserID, customerName: customerName, + orderNumber: orderNumber, createdAtText: createdAtText, packageName: packageName, + totalShootingCount: totalShootingCount, successfulShootingCount: successfulShootingCount, + activeTask: activeTask, needsRepreparation: needsRepreparation, materialState: materialState, + deliveredVideoCount: max(0, count), visitorConfirmationState: confirmation) + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockConfirmationViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockConfirmationViewModel.swift new file mode 100644 index 0000000..f497a48 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockConfirmationViewModel.swift @@ -0,0 +1,230 @@ +import Foundation + +/// 商家发起整单交付确认并读取游客确认结果;生成码不改变订单完成状态。 +final class DroneDockConfirmationViewModel { + /// 进入确认页时冻结的账号、景区及门店范围。 + let context: DroneDockHomeContext + /// 最近一次读取成功的服务端整单摘要与购买点位。 + private(set) var detail: DroneDockMaterialDetail? + /// 整单有效任务及当前云端成片,空列表不阻止确认邀请。 + private(set) var tasks: [DroneDockMaterialTask] = [] + /// 接口返回的小程序码图片信息,不在客户端再次编码二维码。 + private(set) var code: DroneDockConfirmationCode? + /// 整单摘要或确认结果是否正在读取。 + private(set) var isLoading = false + /// 重新校验订单及生成小程序码期间防止重复提交。 + private(set) var isSubmitting = false + /// 工作人员是否已明确核对本订单交付情况。 + private(set) var isReviewed = false + /// 区分尚未读取任务与服务端明确返回的空任务列表。 + private(set) var hasLoadedTasks = false + /// 订单读取、生成码或会话范围错误,生成失败后可重新尝试。 + private(set) var errorMessage: String? + /// 交付清单读取失败,不把失败当作无成片。 + private(set) var tasksErrorMessage: String? + + /// 读取成功后展示最新订单;首屏加载前仅使用入口摘要。 + var order: DroneDockHomeOrder { detail?.order ?? entryOrder } + /// 订单完成以最新服务端 order_status=30 为准,不由确认码或 confirm_status 推导。 + var isCompleted: Bool { detail?.order.orderStatus == 30 } + /// 最新订单仍待游客确认;本次出码成功后,无需等详情中的确认状态更新。 + var isAwaitingConfirmation: Bool { + detail?.order.isActiveOrderStatus == true && (order.confirmStatus == 1 || code != nil) + } + /// 允许无云端成片的订单生成码,权限由服务端 can_confirm 决定。 + var canGenerate: Bool { + !isLoading && !isSubmitting && !identityInvalidated && isReviewed + && hasLoadedTasks && tasksErrorMessage == nil && permitsInvitation + } + + private let entryOrder: DroneDockHomeOrder + private let service: any DroneDockConfirmationServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private var generation = 0 + private var identityInvalidated = false + + /// 注入订单接口和会话检查器,测试及演示可以使用完全隔离的数据源。 + init(context: DroneDockHomeContext, order: DroneDockHomeOrder, + service: any DroneDockConfirmationServing, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + entryOrder = order + self.service = service + self.currentContext = currentContext + } + + /// 核对勾选仅记录工作人员意图,不代替游客确认。 + @MainActor + func setReviewed(_ reviewed: Bool) { + guard accepts(generation), !isLoading, !isSubmitting, + hasLoadedTasks, tasksErrorMessage == nil, permitsInvitation else { return } + isReviewed = reviewed + } + + /// 进入页面时读取整单摘要和全部点位任务,不自动发起确认邀请。 + @MainActor + func refresh() async { + guard !isSubmitting else { return } + generation &+= 1 + let requestGeneration = generation + isLoading = true + errorMessage = nil + tasksErrorMessage = nil + defer { if generation == requestGeneration { isLoading = false } } + guard accepts(requestGeneration), let number = validOrderNumber() else { return } + do { + let value = try await service.detail(scenicID: context.scenicID, orderNumber: number) + guard accepts(requestGeneration) else { return } + try validate(value, orderNumber: number) + apply(value) + } catch { + guard accepts(requestGeneration) else { return } + errorMessage = Self.message(for: error) + return + } + do { + let value = try await service.tasks(scenicID: context.scenicID, orderNumber: number, spotID: nil) + guard accepts(requestGeneration) else { return } + let spotIDs = Set(detail?.spots.map(\.id) ?? []) + guard value.orderNumber == number, value.total == value.list.count, + Set(value.list.map(\.id)).count == value.list.count, + value.list.allSatisfy({ $0.orderNumber == number && spotIDs.contains($0.spotID) }) else { + throw APIError.decodeFailed("交付清单与当前订单或点位不一致,请刷新重试") + } + if tasks != value.list { isReviewed = false } + tasks = value.list + hasLoadedTasks = true + } catch { + guard accepts(requestGeneration) else { return } + hasLoadedTasks = false + isReviewed = false + tasksErrorMessage = Self.message(for: error) + } + } + + /// 只查询服务端确认结果;失败时保留已展示的数据和确认码供重试。 + @MainActor + func refreshStatus(silently: Bool = false) async { + guard !isLoading, !isSubmitting else { return } + generation &+= 1 + let requestGeneration = generation + isLoading = true + if !silently { errorMessage = nil } + defer { if generation == requestGeneration { isLoading = false } } + guard accepts(requestGeneration), let number = validOrderNumber() else { return } + do { + let value = try await service.detail(scenicID: context.scenicID, orderNumber: number) + guard accepts(requestGeneration) else { return } + try validate(value, orderNumber: number) + apply(value) + errorMessage = nil + } catch { + guard accepts(requestGeneration) else { return } + if !silently { errorMessage = Self.message(for: error) } + } + } + + /// 点击出码后先重读订单权限,再发送一次确认码请求,响应不会把订单改为已完成。 + @MainActor + func generateCode() async { + guard accepts(generation), canGenerate, let number = validOrderNumber() else { return } + generation &+= 1 + let requestGeneration = generation + isSubmitting = true + errorMessage = nil + defer { if generation == requestGeneration { isSubmitting = false } } + do { + let value = try await service.detail(scenicID: context.scenicID, orderNumber: number) + guard accepts(requestGeneration) else { return } + try validate(value, orderNumber: number) + apply(value) + guard permitsInvitation else { + errorMessage = isCompleted ? nil : "当前订单暂不可邀请确认,请刷新订单状态" + return + } + guard isReviewed else { + errorMessage = "订单交付信息已更新,请重新核对后再邀请确认" + return + } + let result = try await service.createConfirmation(scenicID: context.scenicID, orderNumber: number) + guard accepts(requestGeneration) else { return } + guard result.orderNumber == number, result.confirmStatus == 1 else { + throw APIError.decodeFailed("确认码与当前订单不一致,请刷新重试") + } + code = result + } catch { + guard accepts(requestGeneration) else { return } + errorMessage = Self.message(for: error) + } + } + + /// 离开页面时清除当前范围的数据,并丢弃所有迟到响应。 + @MainActor + func invalidate() { + generation &+= 1 + detail = nil + tasks = [] + code = nil + isLoading = false + isSubmitting = false + isReviewed = false + hasLoadedTasks = false + errorMessage = nil + tasksErrorMessage = nil + } + + /// 图片等异步 UI 回调展示前再次验证身份,相同会话不改变请求代数。 + @MainActor + func validateContext() -> Bool { accepts(generation) } + + private var permitsInvitation: Bool { + detail?.order.isActiveOrderStatus == true && detail?.order.canConfirm == true + } + + @MainActor + private func validOrderNumber() -> String? { + guard context.canLoad, let number = entryOrder.orderNumber, !number.isEmpty, + number == number.trimmingCharacters(in: .whitespacesAndNewlines) else { + errorMessage = "缺少景区、门店或订单信息,请返回订单列表重新进入" + return nil + } + return number + } + + @MainActor + private func accepts(_ requestGeneration: Int) -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + guard !identityInvalidated, context.hasSameIdentity(as: currentContext()) else { + invalidate() + identityInvalidated = true + errorMessage = "账号、景区或门店已变化,请返回订单列表重新进入" + return false + } + return true + } + + private func validate(_ value: DroneDockMaterialDetail, orderNumber: String) throws { + guard value.order.orderNumber == orderNumber else { + throw APIError.decodeFailed("交付确认摘要与当前订单不一致,请返回订单列表重新进入") + } + } + + @MainActor + private func apply(_ value: DroneDockMaterialDetail) { + if let previous = detail, + previous.spots != value.spots || previous.order.filmCount != value.order.filmCount + || previous.order.shotTotal != value.order.shotTotal || previous.order.shotUsed != value.order.shotUsed { + isReviewed = false + hasLoadedTasks = false + } + detail = value + if !permitsInvitation { + code = nil + isReviewed = false + } + } + + private static func message(for error: Error) -> String? { + error is CancellationError ? nil : error.localizedDescription + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockDeliveryViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockDeliveryViewModel.swift new file mode 100644 index 0000000..af5c0f3 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockDeliveryViewModel.swift @@ -0,0 +1,384 @@ +import Foundation + +/// 云端交付区分校验、文件上传和业务保存,OSS 上传完成不代表交付完成。 +enum DroneDockDeliveryPhase: Equatable, Sendable { + case idle, validating, uploading, saving, succeeded +} + +/// 两个入口共用的成片交付状态;每个视频明确绑定一个有效拍摄任务。 +final class DroneDockDeliveryViewModel { + /// 页面进入时冻结的账号、景区与门店身份。 + let context: DroneDockHomeContext + /// 入口订单仅用于确定身份,权限始终重新读取。 + let order: DroneDockHomeOrder + /// 当前服务端整单摘要与点位快照。 + private(set) var detail: DroneDockMaterialDetail? + /// 全部有效任务,点位选择只改变本地候选列表。 + private(set) var tasks: [DroneDockMaterialTask] = [] + /// 当前明确选择的购买点位。 + private(set) var selectedSpotID: Int? + /// 当前明确选择的拍摄任务。 + private(set) var selectedTaskID: Int? + /// 当前选择的单个本地视频。 + private(set) var video: DroneDockDeliveryVideo? + /// 是否正在读取首屏或刷新订单数据。 + private(set) var isLoading = false + /// 校验、上传、保存和成功后刷新期间冻结选择。 + private(set) var isSubmitting = false + /// 文件上传进度;业务保存阶段即使为 100 仍不表示交付成功。 + private(set) var progress = 0 + /// 当前提交阶段。 + private(set) var phase: DroneDockDeliveryPhase = .idle + /// 首屏或会话范围读取错误。 + private(set) var loadErrorMessage: String? + /// 最近一次上传或保存错误,重试前会重新核对服务端任务。 + private(set) var submissionErrorMessage: String? + /// 仅明确保存成功或查询确认已保存后显示。 + private(set) var successMessage: String? + /// 保存成功后的列表刷新失败,不将已成功保存误报为失败。 + private(set) var refreshWarning: String? + /// 最近一次明确保存成功的成片,刷新失败时仍保留回执。 + private(set) var lastSavedFilm: DroneDockMaterialFilm? + + /// 全部购买点位,保留服务端顺序。 + var spots: [DroneDockMaterialSpot] { detail?.spots ?? [] } + /// 当前点位的有效任务,不能用任务数推导拍摄次数或上传权限。 + var filteredTasks: [DroneDockMaterialTask] { + guard let selectedSpotID else { return [] } + return tasks.filter { $0.spotID == selectedSpotID } + } + /// 当前任务必须仍属于当前选择的点位。 + var selectedTask: DroneDockMaterialTask? { + filteredTasks.first { $0.id == selectedTaskID } + } + /// 素材记录入口已绑定任务;重新读取只核对该任务,不要求用户再次选择。 + var isTaskScoped: Bool { (initialTaskID ?? 0) > 0 } + /// 已上传但业务保存尚未确认的文件地址,失败重试可以复用。 + var uploadedFileURL: String? { pendingUpload?.url } + /// 当前任务已有成片时,用户必须明确确认替换。 + var needsReplacementConfirmation: Bool { + guard let selectedTask, selectedTask.film != nil else { return false } + return !isPendingFilm(selectedTask) + } + /// 云端上传以重新读取的订单状态和交付资格为准。 + var canUpload: Bool { + guard let order = detail?.order, order.orderStatus != nil else { return false } + return order.canDeliverFilm + } + /// 只有最新可交付订单中的有效任务可选择视频。 + var canChooseVideo: Bool { + !isLoading && !isSubmitting && loadErrorMessage == nil && canUpload && selectedTask != nil + } + /// 成功后需重新选择视频才能再次提交,避免重复点击保存同一文件。 + var canSubmit: Bool { + !isLoading && !isSubmitting && loadErrorMessage == nil && selectedTask != nil && video != nil + && phase != .succeeded && (canUpload || pendingUpload != nil) + } + + /// 上传回执与选中视频、任务绑定,不能被复用到其他任务。 + private struct PendingUpload { + let videoID: UUID + let taskID: Int + let url: String + } + + private let service: any DroneDockDeliveryServing + private let uploader: any DroneDockFilmUploading + private let initialTaskID: Int? + private var boundSpotID: Int? + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private var generation = 0 + private var pendingUpload: PendingUpload? + + /// 素材库可传任务 ID,订单列表入口不预选任务;依赖均可替换测试。 + init(context: DroneDockHomeContext, order: DroneDockHomeOrder, + service: any DroneDockDeliveryServing, uploader: any DroneDockFilmUploading, + initialTaskID: Int? = nil, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + self.order = order + self.service = service + self.uploader = uploader + self.initialTaskID = initialTaskID + self.currentContext = currentContext + } + + /// 读取最新摘要与全部任务,不自动替用户选择另一条任务。 + @MainActor + func refresh() async { + guard !isSubmitting else { return } + generation &+= 1 + let requestGeneration = generation + isLoading = true + loadErrorMessage = nil + defer { if generation == requestGeneration { isLoading = false } } + guard accepts(requestGeneration) else { return } + guard context.canLoad, orderNumber != nil else { + clearSnapshot() + loadErrorMessage = "缺少景区、门店或订单信息,请返回订单列表重新进入" + return + } + do { + let snapshot = try await readSnapshot(requestGeneration) + apply(snapshot) + if isTaskScoped, let initialTaskID { + if let task = tasks.first(where: { $0.id == initialTaskID }) { + if let boundSpotID, boundSpotID != task.spotID { + selectedTaskID = nil + resetSubmission() + submissionErrorMessage = "原拍摄任务的点位已变化,请返回素材库刷新" + } else if selectedTaskID != task.id || selectedSpotID != task.spotID { + resetSubmission() + self.boundSpotID = task.spotID + selectedSpotID = task.spotID + selectedTaskID = task.id + } + } else { + submissionErrorMessage = "原拍摄任务已不可用,请返回素材库刷新" + } + } + } catch { + guard accepts(requestGeneration) else { return } + clearSnapshot() + loadErrorMessage = Self.message(for: error) + } + } + + /// 选择点位后清除旧任务和视频,不将成片误提交到其他点位。 + @MainActor + func selectSpot(id: Int) { + guard !isTaskScoped, !isLoading, !isSubmitting, id != selectedSpotID, spots.contains(where: { $0.id == id }) else { return } + selectedSpotID = id + selectedTaskID = nil + resetSubmission() + } + + /// 任务需属于当前点位;切换任务清除与原任务绑定的文件。 + @MainActor + func selectTask(id: Int) { + guard !isTaskScoped, !isLoading, !isSubmitting, id != selectedTaskID, filteredTasks.contains(where: { $0.id == id }) else { return } + selectedTaskID = id + resetSubmission() + } + + /// 接受已复制到应用临时目录的单个非空视频,上传中不可更换。 + @MainActor + func selectVideo(_ video: DroneDockDeliveryVideo) { + guard canChooseVideo else { return } + guard video.url.isFileURL, video.fileSize > 0, !video.fileName.isEmpty else { + submissionErrorMessage = "视频文件无效,请重新选择" + return + } + do { _ = try DroneDockFilmPolicy.contentType(fileName: video.fileName) } + catch { submissionErrorMessage = error.localizedDescription; return } + resetSubmission() + self.video = video + } + + /// 手动移除视频同时放弃尚未保存的上传回执。 + @MainActor + func removeVideo() { + guard !isSubmitting else { return } + resetSubmission() + } + + /// 上传并保存一条成片;保存失败保留 OSS 地址,重试先查询是否已经保存。 + @MainActor + func submit(confirmReplacement: Bool = false, + onProgress: @escaping @MainActor (Int) -> Void = { _ in }) async { + guard canSubmit, let task = selectedTask, let video else { return } + if task.film != nil && !confirmReplacement && !isPendingFilm(task) { + submissionErrorMessage = "该任务已有成片,请确认替换后再上传" + return + } + generation &+= 1 + let requestGeneration = generation + isSubmitting = true + submissionErrorMessage = nil + refreshWarning = nil + successMessage = nil + phase = .validating + onProgress(progress) + defer { + if generation == requestGeneration { + isSubmitting = false + if phase != .succeeded { phase = .idle } + } + } + do { + let snapshot = try await readSnapshot(requestGeneration) + apply(snapshot) + let freshTask = try currentTarget(taskID: task.id, spotID: task.spotID) + if let pending = pendingUpload, pending.videoID == video.id, pending.taskID == task.id, + let film = freshTask.film, film.fileURL == pending.url { + markSaved(film) + onProgress(progress) + return + } + try validatePermissionAndReplacement(current: freshTask, expectedFilm: task.film, confirmed: confirmReplacement) + + let fileURL: String + if let pending = pendingUpload, pending.videoID == video.id, pending.taskID == task.id { + fileURL = pending.url + } else { + phase = .uploading + progress = 0 + onProgress(progress) + let url = try await uploader.upload(video: video, scenicID: context.scenicID) { [weak self] value in + guard let self, self.accepts(requestGeneration), self.isSubmitting, self.phase == .uploading else { return } + self.progress = max(self.progress, min(100, max(0, value))) + onProgress(self.progress) + } + guard accepts(requestGeneration) else { return } + guard DroneDockFilmPolicy.remoteURL(url) != nil else { + throw APIError.decodeFailed("上传地址无效,请重新上传视频") + } + pendingUpload = PendingUpload(videoID: video.id, taskID: task.id, url: url) + fileURL = url + // 上传期间交付资格、任务或成片可能变化,保存前再次核对。 + phase = .validating + onProgress(progress) + let current = try await readSnapshot(requestGeneration) + apply(current) + let currentTask = try currentTarget(taskID: task.id, spotID: task.spotID) + try validatePermissionAndReplacement(current: currentTask, expectedFilm: freshTask.film, confirmed: confirmReplacement) + } + guard accepts(requestGeneration) else { return } + phase = .saving + progress = 100 + onProgress(progress) + let result = try await service.saveFilm(scenicID: context.scenicID, taskID: task.id, + fileURL: fileURL, fileName: video.fileName) + guard accepts(requestGeneration) else { return } + guard result.taskID == task.id, result.film.taskID == nil || result.film.taskID == task.id, + result.film.fileURL == fileURL else { + throw APIError.decodeFailed("成片保存结果不一致,请重试核对") + } + markSaved(result.film) + onProgress(progress) + do { + let current = try await readSnapshot(requestGeneration) + apply(current) + } catch { + guard accepts(requestGeneration) else { return } + refreshWarning = "成片已保存,列表刷新失败,请稍后刷新" + } + } catch { + guard accepts(requestGeneration) else { return } + submissionErrorMessage = Self.message(for: error) + } + } + + /// 确认离开页面后清除内容,拒绝文件上传或保存的迟到回调。 + @MainActor + func invalidate() { + generation &+= 1 + clearSnapshot() + isLoading = false + isSubmitting = false + loadErrorMessage = nil + } + + private var orderNumber: String? { + guard let number = order.orderNumber, !number.isEmpty, + number == number.trimmingCharacters(in: .whitespacesAndNewlines) else { return nil } + return number + } + + private func isPendingFilm(_ task: DroneDockMaterialTask) -> Bool { + guard let pendingUpload, pendingUpload.videoID == video?.id, pendingUpload.taskID == task.id else { return false } + return task.film?.fileURL == pendingUpload.url + } + + @MainActor + private func accepts(_ requestGeneration: Int) -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + guard context.hasSameIdentity(as: currentContext()) else { + invalidate() + loadErrorMessage = "账号或景区已变化,请返回订单列表重新进入" + return false + } + return true + } + + @MainActor + private func readSnapshot(_ requestGeneration: Int) async throws -> (DroneDockMaterialDetail, [DroneDockMaterialTask]) { + guard accepts(requestGeneration), context.canLoad, let number = orderNumber else { throw CancellationError() } + let detail = try await service.detail(scenicID: context.scenicID, orderNumber: number) + guard accepts(requestGeneration) else { throw CancellationError() } + guard detail.order.orderNumber == number else { throw APIError.decodeFailed("交付订单不一致,请返回订单列表重新进入") } + let response = try await service.tasks(scenicID: context.scenicID, orderNumber: number, spotID: nil) + guard accepts(requestGeneration) else { throw CancellationError() } + let spotIDs = Set(detail.spots.map(\.id)) + guard response.orderNumber == number, response.total == response.list.count, + Set(response.list.map(\.id)).count == response.list.count, + response.list.allSatisfy({ $0.orderNumber == number && spotIDs.contains($0.spotID) }) else { + throw APIError.decodeFailed("拍摄任务与订单或点位不一致,请刷新重试") + } + return (detail, response.list) + } + + @MainActor + private func apply(_ snapshot: (DroneDockMaterialDetail, [DroneDockMaterialTask])) { + detail = snapshot.0 + tasks = snapshot.1 + if let selectedSpotID, !spots.contains(where: { $0.id == selectedSpotID }) { self.selectedSpotID = nil } + if selectedTaskID != nil && selectedTask == nil { + selectedTaskID = nil + video = nil + pendingUpload = nil + } + } + + @MainActor + private func currentTarget(taskID: Int, spotID: Int) throws -> DroneDockMaterialTask { + guard let task = tasks.first(where: { $0.id == taskID && $0.spotID == spotID }), + selectedTaskID == taskID, selectedSpotID == spotID else { + throw APIError.networkFailed("拍摄任务已不可用,请重新选择任务") + } + return task + } + + @MainActor + private func validatePermissionAndReplacement(current task: DroneDockMaterialTask, + expectedFilm: DroneDockMaterialFilm?, confirmed: Bool) throws { + guard canUpload else { throw APIError.networkFailed("当前订单不可上传成片,请返回订单列表刷新") } + guard task.film == expectedFilm else { throw APIError.networkFailed("该任务的成片已更新,请核对后重新确认替换") } + guard task.film == nil || confirmed else { throw APIError.networkFailed("该任务已有成片,请确认替换后再上传") } + } + + @MainActor + private func markSaved(_ film: DroneDockMaterialFilm) { + lastSavedFilm = film + pendingUpload = nil + phase = .succeeded + progress = 100 + submissionErrorMessage = nil + successMessage = "成片交付成功" + } + + @MainActor + private func resetSubmission() { + video = nil + pendingUpload = nil + phase = .idle + progress = 0 + submissionErrorMessage = nil + successMessage = nil + refreshWarning = nil + lastSavedFilm = nil + } + + @MainActor + private func clearSnapshot() { + detail = nil + tasks = [] + selectedSpotID = nil + selectedTaskID = nil + resetSubmission() + } + + private static func message(for error: Error) -> String? { + error is CancellationError ? nil : error.localizedDescription + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockHomeViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockHomeViewModel.swift new file mode 100644 index 0000000..0d6ac49 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockHomeViewModel.swift @@ -0,0 +1,250 @@ +import Foundation + +/// 一次真实首页请求的账号、景区和门店范围;凭证只参与隔离,不对外提供展示。 +struct DroneDockHomeContext: Equatable, Sendable { + /// 当前登录工作人员的稳定 ID。 + let userID: String + /// 当前账号类型,用于区分相同 ID 的不同账号域。 + let accountType: String + /// 当前景区 ID。 + let scenicID: Int + /// 当前景区名称。 + let scenicName: String + /// 当前景区下的门店 ID。 + let storeID: Int + /// 当前工作人员展示名称。 + let photographerName: String + private let token: String + + /// 冻结请求范围及登录凭证,仅用于与最新会话比较。 + init(userID: String, accountType: String, scenicID: Int, scenicName: String, + storeID: Int, photographerName: String, token: String) { + self.userID = userID + self.accountType = accountType + self.scenicID = scenicID + self.scenicName = scenicName + self.storeID = storeID + self.photographerName = photographerName + self.token = token.trimmingCharacters(in: .whitespacesAndNewlines) + } + + /// 是否具备查询当前首页所需的登录及景区、门店上下文。 + var canLoad: Bool { !userID.isEmpty && !token.isEmpty && scenicID > 0 && storeID > 0 } + + /// 判断响应是否仍属于当前会话,包含登录 Token 更新但忽略展示名称变化。 + func hasSameIdentity(as other: DroneDockHomeContext) -> Bool { + userID == other.userID && accountType == other.accountType && scenicID == other.scenicID + && storeID == other.storeID && token == other.token + } +} + +/// 分别读取朱工设备与张工订单、统计的首页状态,保留各区域独立的失败结果。 +final class DroneDockHomeViewModel { + /// 当前页面所属的真实账号、景区和门店。 + private(set) var context: DroneDockHomeContext + /// 朱工 home 返回的设备快照。 + private(set) var response: DroneDockHomeResponse? + /// 最近一页订单及服务端总数;累计订单通过 orders 读取。 + private(set) var ordersResponse: DroneDockOrdersResponse? + /// 张工 today-stats 返回的今日数据。 + private(set) var today: DroneDockHomeToday? + /// 三个首屏读取是否尚未全部结束。 + private(set) var isLoading = false + /// 是否正在加载下一页订单。 + private(set) var isLoadingMore = false + /// 登录、景区或门店范围发生问题时的整页提示。 + private(set) var errorMessage: String? + /// 设备接口错误,不影响订单和统计。 + private(set) var deviceErrorMessage: String? + /// 订单首屏错误,不影响设备和统计。 + private(set) var ordersErrorMessage: String? + /// 统计接口错误,不影响设备和订单。 + private(set) var statisticsErrorMessage: String? + /// 下一页错误,保留已显示订单并允许重试同一页。 + private(set) var ordersLoadMoreErrorMessage: String? + /// 当前累计订单,按服务端顺序显示并以订单号去重。 + var orders: [DroneDockHomeOrder] { loadedOrders } + /// 服务端整单列表总数,不以当前页数量代替。 + var orderTotal: Int? { ordersResponse?.total } + /// 分页依据服务端页码和总数,空页会停止继续加载。 + var hasMoreOrders: Bool { + guard let page = ordersResponse, !reachedEmptyPage else { return false } + return page.page < Int(ceil(Double(page.total) / Double(page.pageSize))) + } + + private let service: any DroneDockHomeServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private let pageSize = 20 + private var loadedOrders: [DroneDockHomeOrder] = [] + private var reachedEmptyPage = false + private var generation = 0 + private var paginationGeneration = 0 + + /// 注入只读服务及最新会话,界面在刷新或翻页完成后主动更新。 + init(context: DroneDockHomeContext, service: any DroneDockHomeServing, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + self.service = service + self.currentContext = currentContext + } + + /// 全部订单沿用首页账号范围和真实服务,分页状态与首页各自维护。 + func makeOrdersViewModel() -> DroneDockOrdersViewModel { + DroneDockOrdersViewModel(context: context, service: service, currentContext: currentContext) + } + + /// 并行刷新三个来源;单接口失败不丢弃其他区域的成功数据。 + func refresh() async { + generation &+= 1 + paginationGeneration &+= 1 + let requestGeneration = generation + isLoading = true + isLoadingMore = false + clearErrors() + defer { if generation == requestGeneration { isLoading = false } } + let requestedContext = await currentContext() + guard generation == requestGeneration, !Task.isCancelled else { return } + if !context.hasSameIdentity(as: requestedContext) { clearData() } + context = requestedContext + guard requestedContext.canLoad else { + clearData() + errorMessage = "请先登录并选择景区和门店" + return + } + let service = self.service + let pageSize = self.pageSize + async let devices = Self.capture { + try await service.home(scenicID: requestedContext.scenicID, storeID: requestedContext.storeID) + } + async let firstPage = Self.capture { + try await service.orders(scenicID: requestedContext.scenicID, page: 1, pageSize: pageSize) + } + async let statistics = Self.capture { + try await service.todayStats(scenicID: requestedContext.scenicID) + } + let results = await (devices, firstPage, statistics) + guard await accepts(requestGeneration, context: requestedContext) else { return } + switch results.0 { + case .success(let value) where value.scenicID == requestedContext.scenicID: + response = value + case .success: + response = nil + deviceErrorMessage = "接口返回的景区与当前景区不一致,请刷新重试" + case .failure(let error): + response = nil + deviceErrorMessage = Self.message(for: error) + } + switch results.1 { + case .success(let value) where value.page == 1: + ordersResponse = value + loadedOrders = value.list + reachedEmptyPage = value.list.isEmpty + case .success: + clearOrders() + ordersErrorMessage = "订单分页返回异常,请刷新重试" + case .failure(let error): + clearOrders() + ordersErrorMessage = Self.message(for: error) + } + switch results.2 { + case .success(let value): today = value + case .failure(let error): + today = nil + statisticsErrorMessage = Self.message(for: error) + } + } + + /// 加载下一页;失败不清除已加载订单,刷新或切换会话后拒绝旧分页响应。 + func loadMoreOrders() async { + guard !isLoading, !isLoadingMore, hasMoreOrders, let previousPage = ordersResponse else { return } + let requestGeneration = generation + paginationGeneration &+= 1 + let pageGeneration = paginationGeneration + let requestedContext = context + let nextPage = previousPage.page + 1 + isLoadingMore = true + ordersLoadMoreErrorMessage = nil + defer { + if generation == requestGeneration, paginationGeneration == pageGeneration { isLoadingMore = false } + } + guard await accepts(requestGeneration, context: requestedContext), + paginationGeneration == pageGeneration else { return } + do { + let value = try await service.orders(scenicID: requestedContext.scenicID, + page: nextPage, pageSize: previousPage.pageSize) + guard await accepts(requestGeneration, context: requestedContext), + paginationGeneration == pageGeneration else { return } + guard value.page == nextPage, value.pageSize == previousPage.pageSize else { + ordersLoadMoreErrorMessage = "订单分页返回异常,请重试" + return + } + var indices = Dictionary(uniqueKeysWithValues: loadedOrders.enumerated().map { ($0.element.orderID, $0.offset) }) + for order in value.list { + if let index = indices[order.orderID] { + loadedOrders[index] = order + } else { + indices[order.orderID] = loadedOrders.count + loadedOrders.append(order) + } + } + ordersResponse = value + reachedEmptyPage = value.list.isEmpty + } catch { + guard await accepts(requestGeneration, context: requestedContext), + paginationGeneration == pageGeneration else { return } + ordersLoadMoreErrorMessage = Self.message(for: error) + } + } + + /// 离开或取消时清空三处数据,并使全部在途请求和分页响应失效。 + func invalidate() { + generation &+= 1 + paginationGeneration &+= 1 + clearData() + clearErrors() + isLoading = false + isLoadingMore = false + } + + private func accepts(_ requestGeneration: Int, context requested: DroneDockHomeContext) async -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + let latest = await currentContext() + guard generation == requestGeneration, !Task.isCancelled else { return false } + guard requested.hasSameIdentity(as: latest) else { + invalidate() + context = latest + errorMessage = "账号或景区已变化,请刷新工作台" + return false + } + return true + } + + private func clearData() { + response = nil + today = nil + clearOrders() + } + + private func clearOrders() { + ordersResponse = nil + loadedOrders = [] + reachedEmptyPage = false + } + + private func clearErrors() { + errorMessage = nil + deviceErrorMessage = nil + ordersErrorMessage = nil + statisticsErrorMessage = nil + ordersLoadMoreErrorMessage = nil + } + + private static func message(for error: Error) -> String? { + error is CancellationError ? nil : error.localizedDescription + } + + private static func capture(_ operation: @Sendable () async throws -> Value) async -> Result { + do { return .success(try await operation()) } + catch { return .failure(error) } + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockLiveViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockLiveViewModel.swift new file mode 100644 index 0000000..6baac08 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockLiveViewModel.swift @@ -0,0 +1,244 @@ +import Foundation + +/// 任务图传的单次请求与生命周期;页面可见时自动开启,模拟来源单独注入。 +final class DroneDockLiveViewModel { + /// 当前图传所属的账号、景区与门店范围。 + let context: DroneDockHomeContext + /// 固定订单飞行任务身份。 + let taskID: Int + /// 最近一次通过身份核对的回执;播放配置还需通过独立的协议校验。 + private(set) var response: DroneDockLiveResponse? + /// 图传区域当前可展示状态。 + private(set) var state: DroneDockLiveState + /// 请求期间阻止重复获取,缺少流参数或凭证临期时由页面安排重查。 + private(set) var isLoading = false + /// 仅显式正式入口允许解析设备 RTC;本地模拟即使收到参数也不连接设备。 + let allowsDevicePlayback: Bool + /// 每次进入页面或回前台仅从空闲态自动加载,状态刷新不重复启动图传。 + var loadsAutomatically: Bool { canLoad && state == .idle } + private(set) var rtcConfiguration: DroneDockVolcLiveConfiguration? + /// 同一会话的机巢与无人机配置,可增补或续期而不重启正在播放的一路。 + private(set) var rtcConfigurations: [DroneDockVolcLiveConfiguration] = [] + private(set) var activeRole: String? + + /// 只在缺一路参数或凭证临期时请求 live;普通状态刷新不触发推流请求。 + var nextParameterRefreshDelay: TimeInterval? { + guard allowsDevicePlayback, !identityInvalidated, !rtcConfigurations.isEmpty else { return nil } + let expiryDelay = rtcConfigurations.map { $0.expiresAt.timeIntervalSince(now()) - 30 }.min() ?? 30 + let discoveryDelay = rtcConfigurations.count < 2 ? Double(min(max(response?.refreshHintMS ?? 30_000, 5_000), 60_000)) / 1000 : .infinity + return max(5, min(expiryDelay, discoveryDelay)) + } + private(set) var playbackSessionID: UUID? + + private let service: (any DroneDockLiveServing)? + private let localPreviewURL: URL? + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private var generation = 0 + private var identityInvalidated = false + private let now: @Sendable () -> Date + + /// 本地素材仅供明确的模拟入口注入,后端 JSON 不能生成此 URL。 + init(context: DroneDockHomeContext, taskID: Int, service: (any DroneDockLiveServing)? = nil, + localPreviewURL: URL? = nil, allowsDevicePlayback: Bool = false, + now: @escaping @Sendable () -> Date = { Date() }, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + self.taskID = taskID + self.service = service + self.localPreviewURL = localPreviewURL + self.allowsDevicePlayback = allowsDevicePlayback + self.now = now + self.currentContext = currentContext + state = service == nil ? .unavailable("当前页面未配置图传服务") : .idle + } + + /// 有明确注入服务且身份有效时允许发起请求。 + var canLoad: Bool { service != nil && !isLoading && !identityInvalidated && context.canLoad && taskID > 0 } + + /// 仅返回明确注入且已经过本地文件检查的模拟视频,不使用后端未定义字段。 + var playbackURL: URL? { + if case .localPreview(let url) = state { return url } + return nil + } + + /// 图传区域主文案,不把接口受理视为设备连接成功。 + var title: String { + switch state { + case .idle: return "实时图传" + case .loading: return "正在获取图传信息" + case .unavailable: return "图传暂不可用" + case .failed: return "图传加载失败" + case .localPreview: return "本地模拟画面" + case .connecting: return "正在连接图传" + case .playing: return "实时图传" + } + } + + /// 缺失协议时说明真实限制,不给示例视频贴上实时来源。 + var message: String { + switch state { + case .idle: return allowsDevicePlayback ? "正在准备连接图传" : "按当前任务获取图传信息" + case .loading: return "请稍候" + case .unavailable(let reason), .failed(let reason): return reason + case .localPreview: return "仅播放本地样片,未连接无人机" + case .connecting: return "正在等待视频画面" + case .playing: return (activeRole ?? rtcConfiguration?.role) == "airport" ? "机巢摄像头" : "无人机摄像头" + } + } + + /// 操作名称跟随当前阶段,模拟来源始终显式标记。 + var actionTitle: String? { + guard service != nil else { return nil } + if isLoading { return allowsDevicePlayback ? nil : "正在加载…" } + switch state { + case .idle: return nil + case .loading: return allowsDevicePlayback ? nil : "正在加载…" + case .failed, .unavailable: return "重试" + case .localPreview: return "重新加载模拟图传" + case .connecting: return nil + case .playing: return nil + } + } + + /// 发起一次图传请求,拒绝重复点击、迟到响应、身份不符及远程模拟视频来源。 + @MainActor + func refresh(keepingPlayback: Bool = false, onRequestStarted: (@MainActor () -> Void)? = nil) async { + guard canLoad, let service else { return } + generation &+= 1 + let requestGeneration = generation + guard accepts(requestGeneration) else { return } + isLoading = true + if playbackURL == nil && rtcConfiguration == nil { state = .loading } + onRequestStarted?() + defer { + if generation == requestGeneration { + isLoading = false + if Task.isCancelled, state == .loading { state = .idle } + } + } + do { + let value = try await service.live(taskID: taskID) + guard accepts(requestGeneration) else { return } + guard value.orderFlightTaskID == taskID, value.task?.id == nil || value.task?.id == taskID, + value.task?.scenicID == nil || value.task?.scenicID == context.scenicID else { + clearPlayback() + throw APIError.decodeFailed("图传回执与当前拍摄任务不一致") + } + let previousResponse = response + let sameDevice = previousResponse?.planeID == value.planeID && previousResponse?.airportSN == value.airportSN + if previousResponse != nil && !sameDevice { clearPlayback() } + response = value + if allowsDevicePlayback { + do { + let configurations = try DroneDockVolcLiveConfiguration.parseSources(value, now: now()) + let canKeepSession = keepingPlayback && playbackSessionID != nil + && sameDevice + && rtcConfigurations.first?.appID == configurations.first?.appID + rtcConfigurations = configurations.map { incoming in + // live 每次可能生成新 user_id;补流时保留尚未临期的原入房身份,避免销毁健康房间。 + guard canKeepSession, let previous = rtcConfigurations.first(where: { $0.role == incoming.role }), + previous.appID == incoming.appID, previous.roomID == incoming.roomID, + previous.userID != incoming.userID, previous.expiresAt.timeIntervalSince(now()) > 30 else { return incoming } + return previous + } + rtcConfiguration = rtcConfigurations.first + if !canKeepSession { + activeRole = nil + playbackSessionID = UUID() + state = .connecting + } + } catch { + if !keepingPlayback || rtcConfigurations.isEmpty { + clearPlayback() + state = .unavailable(error.localizedDescription) + } + } + return + } + guard let airportSN = DroneDockHomeMetric.usableText(value.airportSN), !airportSN.isEmpty else { + state = .unavailable("当前任务尚未返回已锁定的机场信息") + return + } + if let localPreviewURL { + guard localPreviewURL.isFileURL, FileManager.default.fileExists(atPath: localPreviewURL.path) else { + state = .failed("本地模拟视频不可用") + return + } + state = .localPreview(localPreviewURL) + } else { + state = .unavailable("暂未提供图传播放参数") + } + } catch is CancellationError { + guard generation == requestGeneration else { return } + if rtcConfigurations.isEmpty { state = .idle } + } catch { + guard accepts(requestGeneration) else { return } + let accessDenied: Bool + if case APIError.serverCode(let code, _) = error { accessDenied = code == 100098 || code == 100099 } + else { accessDenied = false } + if !keepingPlayback || rtcConfigurations.isEmpty || accessDenied { + clearPlayback() + state = .failed(error.localizedDescription) + } + } + } + + /// 离页、后台或取消时作废旧请求并清除本地播放来源,不向设备发送停止指令。 + @MainActor + func invalidate() { + if playbackSessionID != nil { DroneDockDiagnostics.event("live.stopped", taskID: taskID) } + generation &+= 1 + isLoading = false + response = nil + clearPlayback() + state = service == nil ? .unavailable("当前页面未配置图传服务") : .idle + } + + /// 只接受当前播放器会话的事件;首帧之前不显示已连接,旧回调不能恢复画面。 + @MainActor + func receivePlaybackEvent(_ event: DroneDockLivePlaybackEvent, sessionID: UUID) { + guard sessionID == playbackSessionID, rtcConfiguration != nil else { return } + guard context.hasSameIdentity(as: currentContext()), !identityInvalidated else { + invalidate() + identityInvalidated = true + state = .failed("账号或景区已变化,请返回工作台重新进入") + return + } + DroneDockDiagnostics.event("live.playback_event", taskID: taskID, + fields: ["playback_session": sessionID.uuidString, "result": String(describing: event)]) + switch event { + case .firstFrame: + activeRole = rtcConfiguration?.role + state = .playing + case .sourceChanged(let role): + activeRole = role + state = role == nil ? .connecting : .playing + case .failed(let message): + clearPlayback() + state = .failed(message) + case .expired: + clearPlayback() + state = .unavailable("图传凭证即将或已经过期,请重新获取") + } + } + + private func clearPlayback() { + rtcConfiguration = nil + rtcConfigurations = [] + activeRole = nil + playbackSessionID = nil + } + + /// 只接受当前页面与当前身份下的结果,身份变化后不允许重新请求旧任务。 + @MainActor + private func accepts(_ requestGeneration: Int) -> Bool { + guard generation == requestGeneration else { return false } + guard context.hasSameIdentity(as: currentContext()), !identityInvalidated else { + invalidate() + identityInvalidated = true + state = .failed("账号或景区已变化,请返回工作台重新进入") + return false + } + return !Task.isCancelled + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialDownloadViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialDownloadViewModel.swift new file mode 100644 index 0000000..8d75011 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialDownloadViewModel.swift @@ -0,0 +1,178 @@ +import Foundation + +/// 订单原素材下载批次的界面状态;只有系统相册事务成功才计为完成。 +final class DroneDockMaterialDownloadViewModel { + /// 前台下载、暂停与结果展示的互斥阶段。 + enum Phase: Equatable { case idle, downloading, paused, finished } + + /// 当前批次阶段。 + private(set) var phase: Phase = .idle + /// 最近一次失败原因,重试时清除。 + private(set) var lastErrorMessage: String? + /// 相册权限被拒绝时,页面可引导用户前往系统设置。 + private(set) var permissionDenied = false + /// 下载进度和结果变化时,由页面主动刷新相关视图。 + var onUpdate: (@MainActor () -> Void)? + /// 当前批次去重后的素材数。 + var totalCount: Int { items.count } + /// 已成功写入相册的素材数,不包含只完成下载的文件。 + var completedCount: Int { completedIDs.count } + /// 下载或保存失败的素材数。 + var failedCount: Int { failedIDs.count } + /// 按文件平均的批次进度;保存成功或失败的项目均已处理完毕。 + var progress: Double { + guard !items.isEmpty else { return 0 } + let processed = Double(completedIDs.count + failedIDs.count) + let pending = items.filter { !completedIDs.contains($0.id) && !failedIDs.contains($0.id) } + .reduce(0) { $0 + (progressByID[$1.id] ?? 0) } + return min(max((processed + pending) / Double(items.count), 0), 1) + } + + private let service: ScenicMaterialDownloadService + private let isContextValid: @MainActor () -> Bool + private var items: [ScenicMaterialDownloadItem] = [] + private var completedIDs = Set() + private var failedIDs = Set() + private var progressByID: [String: Double] = [:] + private var batchID: UUID? + + /// 注入下载保存服务及冻结账号范围的校验器,测试可完全隔离网络和相册。 + @MainActor + init(service: ScenicMaterialDownloadService? = nil, + isContextValid: @escaping @MainActor () -> Bool = { true }) { + self.service = service ?? ScenicMaterialDownloadService() + self.isContextValid = isContextValid + } + + /// 冻结所选原素材并开始新批次;下载或暂停期间的重复点击不改变当前批次。 + @discardableResult + @MainActor + func start(items: [ScenicMaterialDownloadItem]) -> Bool { + guard acceptsContext(), phase != .downloading, phase != .paused else { return false } + var visited = Set() + let unique = items.filter { visited.insert($0.id).inserted } + guard !unique.isEmpty else { return false } + reset() + self.items = unique + return run(unique) + } + + /// 只重试失败的项目,已保存成功的项目不重新下载或写入相册。 + @discardableResult + @MainActor + func retryFailed() -> Bool { + guard acceptsContext(), phase == .finished, !failedIDs.isEmpty else { return false } + let retry = items.filter { failedIDs.contains($0.id) } + failedIDs.removeAll() + return run(retry) + } + + /// 切入后台或用户暂停时中止未完成下载,保留本批次结果供继续。 + @MainActor + func pause() { + guard acceptsContext(), phase == .downloading else { return } + service.stop() + batchID = nil + phase = .paused + onUpdate?() + } + + /// 恢复未处理的项目;服务会等待已提交的相册事务,防止重复创建资产。 + @discardableResult + @MainActor + func resume() -> Bool { + guard acceptsContext(), phase == .paused else { return false } + return run(items.filter { !completedIDs.contains($0.id) && !failedIDs.contains($0.id) }) + } + + /// 离开页面或继续选择时取消批次,已保存的系统相册资产不会删除。 + @MainActor + func cancel() { + service.stop() + reset() + onUpdate?() + } + + /// 等待下载、相册事务及临时文件清理完成,供生命周期验证使用。 + @MainActor + func waitForPendingOperations() async { await service.waitForPendingOperations() } + + @MainActor + private func run(_ pending: [ScenicMaterialDownloadItem]) -> Bool { + lastErrorMessage = nil + permissionDenied = false + guard !pending.isEmpty else { + phase = .finished + onUpdate?() + return false + } + pending.forEach { progressByID[$0.id] = 0 } + let token = UUID() + batchID = token + phase = .downloading + service.start(items: pending, batchID: token, onEvent: { [weak self] id, token, event in + self?.receive(id: id, token: token, event: event) + }, onFailure: { [weak self] id, error in + self?.receiveFailure(id: id, token: token, error: error) + }) + onUpdate?() + return true + } + + @MainActor + private func receive(id: String, token: UUID, event: ScenicMaterialTransferEvent) { + guard token == batchID, phase == .downloading, acceptsContext(), + items.contains(where: { $0.id == id }) else { return } + switch event { + case .progress(let value): + guard !completedIDs.contains(id), !failedIDs.contains(id), value.isFinite else { return } + progressByID[id] = max(progressByID[id] ?? 0, min(max(value, 0), 0.9)) + case .completed: + completedIDs.insert(id) + failedIDs.remove(id) + progressByID[id] = nil + case .failed: + failedIDs.insert(id) + progressByID[id] = nil + } + if completedCount + failedCount == totalCount { phase = .finished } + onUpdate?() + } + + @MainActor + private func receiveFailure(id: String, token: UUID, error: Error) { + guard token == batchID, acceptsContext(), failedIDs.contains(id) else { return } + lastErrorMessage = error.localizedDescription + if error as? CloudTransferError == .photoPermissionDenied { + permissionDenied = true + service.stop() + // 权限拒绝影响整个批次,停止余下的网络下载,授权后统一重试未保存项。 + failedIDs = Set(items.map(\.id)).subtracting(completedIDs) + phase = .finished + } + onUpdate?() + } + + @MainActor + private func acceptsContext() -> Bool { + guard isContextValid() else { + service.stop() + reset() + lastErrorMessage = "账号或景区已变化,请返回工作台重新进入" + onUpdate?() + return false + } + return true + } + + private func reset() { + batchID = nil + items = [] + completedIDs = [] + failedIDs = [] + progressByID = [:] + lastErrorMessage = nil + permissionDenied = false + phase = .idle + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialsViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialsViewModel.swift new file mode 100644 index 0000000..67246c4 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialsViewModel.swift @@ -0,0 +1,258 @@ +import Foundation + +/// 订单素材库的远程状态,整单摘要与点位筛选后的任务分别维护。 +final class DroneDockMaterialsViewModel { + /// 进入页面时冻结的账号、景区和门店范围。 + let context: DroneDockHomeContext + /// 入口订单仅提供身份和首次读取前的摘要。 + let order: DroneDockHomeOrder + /// orders/detail 返回的整单摘要与购买点位。 + private(set) var detail: DroneDockMaterialDetail? + /// 当前点位下的全部有效任务,保持服务端顺序。 + private(set) var tasks: [DroneDockMaterialTask] = [] + /// 当前筛选下的任务数,未知时不以零代替。 + private(set) var total: Int? + /// 当前点位,nil 表示全部点位。 + private(set) var selectedSpotID: Int? + /// 是否正在读取整单摘要和点位标签。 + private(set) var isLoading = false + /// 是否正在读取全部或指定点位的任务。 + private(set) var isLoadingTasks = false + /// 整单摘要、入口参数或会话范围错误。 + private(set) var detailErrorMessage: String? + /// 当前任务列表读取错误,不改变已读取的整单摘要。 + private(set) var tasksErrorMessage: String? + /// 点位标签始终来自整单购买快照,不从当前任务推导。 + var spots: [DroneDockMaterialSpot] { detail?.spots ?? [] } + /// 已完整读取的任务可进入状态与图传页,不因素材尚未上传而隐藏。 + var canViewRecordedTasks: Bool { + detail != nil && !isLoading && !isLoadingTasks && detailErrorMessage == nil + && tasksErrorMessage == nil && !tasks.isEmpty + } + + /// 打开任务前重新核对账号和景区,并且只允许当前已加载订单中的任务。 + @MainActor + func taskForViewing(id: Int) -> DroneDockMaterialTask? { + guard acceptsSelectionContext(), canViewRecordedTasks else { return nil } + return tasks.first { $0.id == id && $0.orderNumber == order.orderNumber } + } + /// 当前范围内已选择的就绪原素材,不包含独立交付成片。 + private(set) var selectedMaterialIDs: Set = [] + /// 只有完整读取成功且具备有效文件地址的原素材允许选择。 + var selectableMaterialIDs: Set { + guard detail != nil, !isLoading, !isLoadingTasks, + detailErrorMessage == nil, tasksErrorMessage == nil else { return [] } + return Set(tasks.flatMap { task in + task.materials.filter { $0.previewURL != nil }.map { + DroneDockMaterialSelectionID(taskID: task.id, fileID: $0.id) + } + }) + } + /// 当前选择数量仅用于界面展示,不表示已经下载或保存。 + var selectedCount: Int { selectedMaterialIDs.count } + /// 空列表不展示全选;全部当前可用原素材被选中时才标记全选。 + var allDownloadableSelected: Bool { + let selectable = selectableMaterialIDs + return !selectable.isEmpty && selectedMaterialIDs == selectable + } + + private let service: any DroneDockMaterialsServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private var generation = 0 + + /// 注入只读素材服务和会话校验器,不依赖应用全局登录态。 + init(context: DroneDockHomeContext, order: DroneDockHomeOrder, + service: any DroneDockMaterialsServing, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + self.order = order + self.service = service + self.currentContext = currentContext + } + + /// 勾选只修改本地状态;无效、未就绪或其他任务的素材不会进入选择集合。 + @MainActor + func toggleSelection(taskID: Int, fileID: Int) { + guard acceptsSelectionContext() else { return } + let identifier = DroneDockMaterialSelectionID(taskID: taskID, fileID: fileID) + guard selectableMaterialIDs.contains(identifier) else { return } + if selectedMaterialIDs.contains(identifier) { + selectedMaterialIDs.remove(identifier) + } else { + selectedMaterialIDs.insert(identifier) + } + } + + /// 全选仅覆盖当前点位可用的原素材,不跨点位、订单或成片扩大范围。 + @MainActor + func toggleSelectAll() { + guard acceptsSelectionContext() else { return } + let selectable = selectableMaterialIDs + guard !selectable.isEmpty else { return } + selectedMaterialIDs = selectedMaterialIDs == selectable ? [] : selectable + } + + /// 在发起下载及处理回执前校验当前账号、景区和门店,失效时清除页面数据。 + @MainActor + func acceptsDownloadContext() -> Bool { + acceptsSelectionContext() + } + + /// 冻结当前选中的就绪原素材,沿用服务端顺序;成片不参与下载。 + @MainActor + func selectedDownloadItems() -> [ScenicMaterialDownloadItem] { + guard acceptsDownloadContext() else { return [] } + let selected = selectedMaterialIDs.intersection(selectableMaterialIDs) + return tasks.flatMap { task in + task.materials.compactMap { file in + guard selected.contains(.init(taskID: task.id, fileID: file.id)), + let url = file.previewURL else { return nil } + let isVideo = file.fileType == 2 + let extensions = isVideo ? ["mp4", "mov", "m4v"] : ["jpg", "jpeg", "png", "heic", "heif", "gif", "tif", "tiff", "webp"] + var name = CloudTransferFileName.sanitized(file.fileName ?? "material-\(file.id)") + if !extensions.contains((name as NSString).pathExtension.lowercased()) { + let suffix = url.pathExtension.lowercased() + name += "." + (extensions.contains(suffix) ? suffix : isVideo ? "mp4" : "jpg") + } + return ScenicMaterialDownloadItem(id: "\(orderNumber ?? "")/\(task.id)/\(file.id)", + remoteURL: url, fileName: name, fileType: isVideo ? 1 : 0) + } + } + } + + @MainActor + private func acceptsSelectionContext() -> Bool { + guard context.hasSameIdentity(as: currentContext()) else { + invalidate() + detailErrorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return true + } + + /// 先刷新整单摘要,再读取任务;保留仍在购买快照中的点位筛选。 + @MainActor + func refresh() async { + generation &+= 1 + let requestGeneration = generation + detail = nil + clearTasks() + isLoading = true + isLoadingTasks = false + detailErrorMessage = nil + defer { if generation == requestGeneration { isLoading = false } } + guard await accepts(requestGeneration) else { return } + guard context.canLoad, let number = orderNumber else { + selectedSpotID = nil + detailErrorMessage = "缺少当前景区、门店或订单信息,请返回工作台重新进入" + return + } + do { + let value = try await service.detail(scenicID: context.scenicID, orderNumber: number) + guard await accepts(requestGeneration) else { return } + guard value.order.orderNumber == number else { + selectedSpotID = nil + detailErrorMessage = "素材库摘要与当前订单不一致,请刷新重试" + return + } + detail = value + if let selectedSpotID, !value.spots.contains(where: { $0.id == selectedSpotID }) { + self.selectedSpotID = nil + } + isLoading = false + await loadTasks(requestGeneration: requestGeneration, orderNumber: number) + } catch { + guard await accepts(requestGeneration) else { return } + selectedSpotID = nil + detailErrorMessage = Self.message(for: error) + } + } + + /// 切换购买点位时只刷新 tasks,整单次数、状态和标签保持不变。 + @MainActor + func selectSpot(id: Int?) async { + guard !isLoading, detail != nil, id != selectedSpotID, + id == nil || spots.contains(where: { $0.id == id }) else { return } + generation &+= 1 + selectedSpotID = id + clearTasks() + guard let number = orderNumber else { return } + await loadTasks(requestGeneration: generation, orderNumber: number) + } + + /// 任务读取失败后重试当前点位,不重复请求整单摘要。 + @MainActor + func retryTasks() async { + guard !isLoading, !isLoadingTasks, detail != nil, let number = orderNumber else { return } + generation &+= 1 + clearTasks() + await loadTasks(requestGeneration: generation, orderNumber: number) + } + + /// 离开页面时清除敏感内容,并使所有在途响应失效。 + @MainActor + func invalidate() { + generation &+= 1 + detail = nil + selectedSpotID = nil + clearTasks() + isLoading = false + isLoadingTasks = false + detailErrorMessage = nil + } + + private var orderNumber: String? { + guard let number = order.orderNumber, !number.isEmpty, + number == number.trimmingCharacters(in: .whitespacesAndNewlines) else { return nil } + return number + } + + @MainActor + private func loadTasks(requestGeneration: Int, orderNumber: String) async { + let requestedSpotID = selectedSpotID + isLoadingTasks = true + tasksErrorMessage = nil + defer { if generation == requestGeneration { isLoadingTasks = false } } + guard await accepts(requestGeneration) else { return } + do { + let value = try await service.tasks(scenicID: context.scenicID, orderNumber: orderNumber, spotID: requestedSpotID) + guard await accepts(requestGeneration) else { return } + guard value.orderNumber == orderNumber, value.total == value.list.count, + value.list.allSatisfy({ $0.orderNumber == orderNumber && (requestedSpotID == nil || $0.spotID == requestedSpotID) }) else { + clearTasks() + tasksErrorMessage = "素材任务与当前订单或拍摄点不一致,请刷新重试" + return + } + tasks = value.list + total = value.total + } catch { + guard await accepts(requestGeneration) else { return } + clearTasks() + tasksErrorMessage = Self.message(for: error) + } + } + + @MainActor + private func accepts(_ requestGeneration: Int) async -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + let latest = currentContext() + guard context.hasSameIdentity(as: latest) else { + invalidate() + detailErrorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return true + } + + @MainActor + private func clearTasks() { + tasks = [] + selectedMaterialIDs = [] + total = nil + tasksErrorMessage = nil + } + + private static func message(for error: Error) -> String? { + error is CancellationError ? nil : error.localizedDescription + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockNearbyTransferViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockNearbyTransferViewModel.swift new file mode 100644 index 0000000..75d2124 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockNearbyTransferViewModel.swift @@ -0,0 +1,210 @@ +import Foundation + +/// 局域网闪传的生命周期;发送结束只表示本机完成发送,不代表游客保存到相册。 +enum DroneDockNearbyTransferPhase: Equatable, Sendable { + case idle, starting, waiting, connected, sending, sent, interrupted, ended, failed +} + +/// 给页面的不可变状态快照,网络回调可以在任意线程产生。 +struct DroneDockNearbyTransferSnapshot: Equatable, Sendable { + var video: DroneDockDeliveryVideo? + var session: DroneDockNearbyTransferSession? + var phase: DroneDockNearbyTransferPhase = .idle + var bytesSent: Int64 = 0 + var totalBytes: Int64 = 0 + var message: String? + + /// 会话存续期间禁止换片,避免游客拿到其他订单的视频。 + var isActive: Bool { phase == .starting || session != nil } + /// 生成二维码必须由用户主动操作,结束后可以重新生成。 + var canStart: Bool { video != nil && !isActive } + /// 在传输中不暴露换片操作。 + var canChooseVideo: Bool { !isActive } + /// 网络发送进度,不作为接收方落盘或相册保存的凭证。 + var progress: Float { + guard totalBytes > 0 else { return 0 } + return min(1, max(0, Float(bytesSent) / Float(totalBytes))) + } +} + +/// 管理单视频的本地传输会话;锁保护快照与代次,不依赖 UIKit 或隐式主线程。 +final class DroneDockNearbyTransferViewModel: @unchecked Sendable { + private let service: any DroneDockNearbyTransferServing + private let lock = NSLock() + private let lifecycleLock = NSLock() + private var state = DroneDockNearbyTransferSnapshot() + private var generation = UUID() + private var updateHandler: (@Sendable (DroneDockNearbyTransferSnapshot) -> Void)? + private var startTask: Task? + + /// 注入只在本地监听的服务,测试可以替换为不联网的实现。 + init(service: any DroneDockNearbyTransferServing = DroneDockNearbyTransferServer()) { + self.service = service + } + + deinit { startTask?.cancel(); service.stop() } + + /// 页面只读取副本,避免和网络线程共享可变属性。 + var snapshot: DroneDockNearbyTransferSnapshot { locked { state } } + + /// 更新通知可能来自后台线程;View 必须主动切回主线程再渲染。 + func setUpdateHandler(_ handler: (@Sendable (DroneDockNearbyTransferSnapshot) -> Void)?) { + locked { updateHandler = handler } + } + + /// 仅接收已准备好的本地视频;无效文件不覆盖原选择。 + @discardableResult + func selectVideo(_ video: DroneDockDeliveryVideo) throws -> Bool { + _ = try DroneDockFilmPolicy.validate(video: video) + let changed = locked { + guard state.canChooseVideo else { return false } + state = DroneDockNearbyTransferSnapshot(video: video) + return true + } + if changed { notify() } + return changed + } + + /// 用户明确生成二维码后才开始监听,不读取订单或调用云端接口。 + func start() async { + let request: (UUID, Task)? = lifecycle { + locked { + guard state.canStart, let video = state.video else { return nil } + generation = UUID() + let requestID = generation + state.phase = .starting + state.message = nil + state.bytesSent = 0 + state.totalBytes = Int64(video.fileSize) + let task = Task { [weak self] in + guard let self else { throw CancellationError() } + try Task.checkCancellation() + return try await self.service.start(video: video) { [weak self] event in + self?.receive(event, requestID: requestID) + } + } + startTask = task + return (requestID, task) + } + } + guard let (requestID, task) = request else { return } + notify() + do { + let session = try await withTaskCancellationHandler { + try await task.value + } onCancel: { [weak self] in + self?.cancel(requestID: requestID) + } + try Task.checkCancellation() + let accepted = locked { + guard generation == requestID, state.phase != .ended, state.phase != .failed else { return false } + startTask = nil + state.session = session + if state.phase == .starting { state.phase = .waiting } + return true + } + if accepted { notify() } + } catch { + let accepted = locked { + guard generation == requestID else { return false } + startTask = nil + state.session = nil + state.phase = error is CancellationError ? .ended : .failed + state.message = error is CancellationError ? "本次闪传已结束" : error.localizedDescription + return true + } + if accepted { notify() } + } + } + + /// 结束时立即使旧事件失效;后台或离开页面均使用同一清理路径。 + func stop(message: String = "本次闪传已结束,原二维码已失效") { + lifecycle { + let task = locked { + generation = UUID() + state.session = nil + state.phase = .ended + state.message = message + let task = startTask + startTask = nil + return task + } + task?.cancel() + service.stop() + } + notify() + } + + private func cancel(requestID: UUID) { + let cancelled = lifecycle { + let result: (Bool, Task?) = locked { + guard generation == requestID else { return (false, nil) } + generation = UUID() + state.session = nil + state.phase = .ended + state.message = "本次闪传已结束" + let task = startTask + startTask = nil + return (true, task) + } + guard result.0 else { return false } + result.1?.cancel() + service.stop() + return true + } + if cancelled { notify() } + } + + private func receive(_ event: DroneDockNearbyTransferEvent, requestID: UUID) { + let accepted = locked { + guard generation == requestID, state.phase != .ended, state.phase != .failed else { return false } + switch event { + case .visitorConnected: + if state.phase == .starting || state.phase == .waiting { state.phase = .connected } + case let .sending(bytesSent, totalBytes): + state.phase = .sending + state.bytesSent = max(0, min(bytesSent, totalBytes)) + state.totalBytes = max(0, totalBytes) + state.message = nil + case .sent: + state.phase = .sent + state.bytesSent = state.totalBytes + state.message = "文件已发送,请游客在浏览器中核对下载结果" + case .partialSent: + state.phase = .connected + state.bytesSent = 0 + state.message = "已发送部分内容,游客可继续下载" + case .interrupted: + state.phase = .interrupted + state.message = "连接中断,请游客保持连接同一 Wi-Fi,并在接收页重试下载" + case .stopped: + state.phase = .ended + state.session = nil + state.message = "本次闪传已结束,请重新生成二维码" + case let .failed(message): + state.phase = .failed + state.session = nil + state.message = message + } + return true + } + if accepted { notify() } + } + + private func notify() { + let delivery = locked { (updateHandler, state) } + delivery.0?(delivery.1) + } + + private func locked(_ work: () -> T) -> T { + lock.lock() + defer { lock.unlock() } + return work() + } + + private func lifecycle(_ work: () -> T) -> T { + lifecycleLock.lock() + defer { lifecycleLock.unlock() } + return work() + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockOrdersViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockOrdersViewModel.swift new file mode 100644 index 0000000..ac81fa7 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockOrdersViewModel.swift @@ -0,0 +1,161 @@ +import Foundation + +/// 当前工作人员全部拍摄订单的独立分页状态,不读取设备或首页统计。 +final class DroneDockOrdersViewModel { + /// 进入列表时冻结的账号、景区与门店范围。 + let context: DroneDockHomeContext + /// 当前履约分类,切换后由服务端重新筛选全部结果。 + private(set) var selectedFilter: DroneShootingOrderFilter + /// 累计订单,保持服务端顺序并按订单号去重。 + private(set) var orders: [DroneDockHomeOrder] = [] + /// 服务端订单总数,尚未成功读取时保持未知。 + private(set) var total: Int? + /// 是否正在刷新第一页。 + private(set) var isLoading = false + /// 是否正在读取下一页。 + private(set) var isLoadingMore = false + /// 首屏查询或账号范围错误。 + private(set) var errorMessage: String? + /// 下一页读取错误,不丢弃已显示的订单。 + private(set) var loadMoreErrorMessage: String? + /// 服务端尚有下一页且上一页不是空页时允许继续加载。 + var hasMore: Bool { + guard let response, !reachedEmptyPage else { return false } + return response.page < Int(ceil(Double(response.total) / Double(response.pageSize))) + } + + private let service: any DroneDockHomeServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private let pageSize = 20 + private var response: DroneDockOrdersResponse? + private var reachedEmptyPage = false + private var generation = 0 + private var paginationGeneration = 0 + + /// 注入与首页相同的只读订单服务及最新会话校验器。 + init(context: DroneDockHomeContext, service: any DroneDockHomeServing, + initialFilter: DroneShootingOrderFilter = .all, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + self.service = service + selectedFilter = initialFilter + self.currentContext = currentContext + } + + /// 切换分类立即清除旧列表和分页,再读取该分类第一页。 + func selectFilter(_ filter: DroneShootingOrderFilter) async { + guard filter != selectedFilter else { return } + selectedFilter = filter + clearOrders() + await refresh() + } + + /// 从第一页重新读取当前分类,刷新会使旧筛选和分页结果失效。 + func refresh() async { + generation &+= 1 + paginationGeneration &+= 1 + let requestGeneration = generation + let requestedFilter = selectedFilter + isLoading = true + isLoadingMore = false + errorMessage = nil + loadMoreErrorMessage = nil + defer { if generation == requestGeneration { isLoading = false } } + guard await accepts(requestGeneration) else { return } + guard context.canLoad else { + clearOrders() + errorMessage = "请先登录并选择景区和门店" + return + } + do { + let value = try await service.orders(scenicID: context.scenicID, status: requestedFilter, page: 1, pageSize: pageSize) + guard await accepts(requestGeneration) else { return } + guard value.page == 1, value.pageSize == pageSize else { + clearOrders() + errorMessage = "订单分页返回异常,请刷新重试" + return + } + response = value + orders = value.list + total = value.total + reachedEmptyPage = value.list.isEmpty + } catch { + guard await accepts(requestGeneration) else { return } + clearOrders() + errorMessage = Self.message(for: error) + } + } + + /// 继续读取下一页,失败后保留已有列表并允许重试同一页。 + func loadMore() async { + guard !isLoading, !isLoadingMore, hasMore, let previousPage = response else { return } + let requestGeneration = generation + let requestedFilter = selectedFilter + paginationGeneration &+= 1 + let pageGeneration = paginationGeneration + let nextPage = previousPage.page + 1 + isLoadingMore = true + loadMoreErrorMessage = nil + defer { + if generation == requestGeneration, paginationGeneration == pageGeneration { isLoadingMore = false } + } + guard await accepts(requestGeneration), paginationGeneration == pageGeneration else { return } + do { + let value = try await service.orders(scenicID: context.scenicID, status: requestedFilter, page: nextPage, pageSize: pageSize) + guard await accepts(requestGeneration), paginationGeneration == pageGeneration else { return } + guard value.page == nextPage, value.pageSize == pageSize else { + loadMoreErrorMessage = "订单分页返回异常,请重试" + return + } + var indices = Dictionary(uniqueKeysWithValues: orders.enumerated().map { ($0.element.orderID, $0.offset) }) + for order in value.list { + if let index = indices[order.orderID] { + orders[index] = order + } else { + indices[order.orderID] = orders.count + orders.append(order) + } + } + response = value + total = value.total + reachedEmptyPage = value.list.isEmpty + } catch { + guard await accepts(requestGeneration), paginationGeneration == pageGeneration else { return } + loadMoreErrorMessage = Self.message(for: error) + } + } + + /// 离开列表时清空状态并拒绝刷新、分页的迟到响应。 + func invalidate() { + generation &+= 1 + paginationGeneration &+= 1 + clearOrders() + isLoading = false + isLoadingMore = false + errorMessage = nil + loadMoreErrorMessage = nil + } + + private func accepts(_ requestGeneration: Int) async -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + let latest = await currentContext() + guard generation == requestGeneration, !Task.isCancelled else { return false } + guard context.hasSameIdentity(as: latest) else { + invalidate() + errorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return true + } + + private func clearOrders() { + response = nil + orders = [] + total = nil + reachedEmptyPage = false + } + + private static func message(for error: Error) -> String? { + error is CancellationError ? nil : error.localizedDescription + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockPaymentViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockPaymentViewModel.swift new file mode 100644 index 0000000..dc05212 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockPaymentViewModel.swift @@ -0,0 +1,164 @@ +import Foundation + +/// 独立机巢套餐收款状态;不使用普通景区收款链接,也不模拟单笔支付成功。 +final class DroneDockPaymentViewModel { + /// 当前页面所属账号、景区和门店。 + private(set) var context: DroneDockHomeContext + /// 服务端当前可售套餐。 + private(set) var projects: [DroneDockProject] = [] + /// 当前已确认报价的小程序收款码;改价、换套餐或失败时立即清除。 + private(set) var payCode: DroneDockPayCode? + /// 是否正在加载套餐列表。 + private(set) var isLoadingProjects = false + /// 是否正在向后端生成小程序收款码。 + private(set) var isGenerating = false + /// 套餐读取错误,与成功的空列表分开表达。 + private(set) var projectError: String? + /// 报价生成错误,不携带可继续使用的旧二维码。 + private(set) var payCodeError: String? + + private let service: any DroneDockPaymentServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private var scopeGeneration = 0 + private var projectGeneration = 0 + private var codeGeneration = 0 + private var pendingCode: PendingCode? + + /// 相同在途报价用于拦截重复点击;不同套餐或金额允许替换前一次请求。 + private struct PendingCode: Equatable { + let projectID: Int + let price: String? + } + + /// 注入真实收款服务与最新会话;调用方在完成后主动刷新 UIKit 界面。 + init(context: DroneDockHomeContext, service: any DroneDockPaymentServing, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.context = context + self.service = service + self.currentContext = currentContext + } + + /// 加载可售套餐;切换登录、景区或门店时清除之前的套餐和小程序收款码。 + func loadProjects() async { + let scope = scopeGeneration + let requested = await currentContext() + guard scope == scopeGeneration, !Task.isCancelled else { return } + if !context.hasSameIdentity(as: requested) { + invalidate() + context = requested + } + guard !isLoadingProjects else { return } + projectGeneration &+= 1 + let request = projectGeneration + isLoadingProjects = true + projectError = nil + defer { if projectGeneration == request { isLoadingProjects = false } } + guard requested.canLoad else { + projects = [] + payCode = nil + projectError = "请先登录并选择景区和门店" + return + } + do { + let result = try await service.projects(scenicID: requested.scenicID) + guard await accepts(request, isCode: false, context: requested) else { return } + guard Set(result.map(\.id)).count == result.count else { + projects = [] + projectError = "接口返回的套餐重复,请重试" + return + } + projects = result + } catch { + guard await accepts(request, isCode: false, context: requested) else { return } + projects = [] + if error is CancellationError { return } + projectError = error.localizedDescription + } + } + + /// 确认套餐或改价后重新生成;只接受所选套餐、当前门店及当前会话的响应。 + func generateCode(projectID: Int, price: String? = nil) async { + let normalized = price.flatMap(DroneDockPriceValidator.normalizedPrice) + let pending = PendingCode(projectID: projectID, price: normalized) + if isGenerating, pendingCode == pending, price == nil || normalized != nil { return } + codeGeneration &+= 1 + let request = codeGeneration + payCode = nil + payCodeError = nil + pendingCode = pending + isGenerating = true + defer { + if codeGeneration == request { + isGenerating = false + pendingCode = nil + } + } + guard price == nil || normalized != nil else { + payCodeError = DroneDockPriceValidator.validationMessage(for: price ?? "") + return + } + let requested = await currentContext() + guard codeGeneration == request, !Task.isCancelled else { return } + guard context.hasSameIdentity(as: requested) else { + rejectChangedContext(requested) + return + } + guard requested.canLoad else { + payCodeError = "请先登录并选择景区和门店" + return + } + guard projectID > 0, projects.contains(where: { $0.id == projectID }) else { + payCodeError = "请先选择当前可售的航拍套餐" + return + } + do { + let result = try await service.payCode(scenicID: requested.scenicID, projectID: projectID, price: normalized) + guard await accepts(request, isCode: true, context: requested) else { return } + guard result.projectID == projectID, result.storeID == requested.storeID else { + payCodeError = "返回的套餐或收款门店与当前选择不一致,请重新生成" + return + } + if let normalized, result.price != Decimal(string: normalized, locale: Locale(identifier: "en_US_POSIX")) { + payCodeError = "返回的收款金额与本次报价不一致,请重新生成" + return + } + payCode = result + } catch { + guard await accepts(request, isCode: true, context: requested) else { return } + if error is CancellationError { return } + payCodeError = error.localizedDescription + } + } + + /// 页面退出或会话失效时清除全部状态,并阻止任何在途请求回填旧二维码。 + func invalidate() { + scopeGeneration &+= 1 + projectGeneration &+= 1 + codeGeneration &+= 1 + projects = [] + payCode = nil + isLoadingProjects = false + isGenerating = false + projectError = nil + payCodeError = nil + pendingCode = nil + } + + private func accepts(_ request: Int, isCode: Bool, context requested: DroneDockHomeContext) async -> Bool { + guard request == (isCode ? codeGeneration : projectGeneration), !Task.isCancelled else { return false } + let latest = await currentContext() + guard request == (isCode ? codeGeneration : projectGeneration), !Task.isCancelled else { return false } + guard requested.hasSameIdentity(as: latest) else { + rejectChangedContext(latest) + return false + } + return true + } + + private func rejectChangedContext(_ latest: DroneDockHomeContext) { + invalidate() + context = latest + projectError = "账号、景区或门店已变化,请重新加载套餐" + payCodeError = "账号、景区或门店已变化,请重新选择套餐" + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockPreparationViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockPreparationViewModel.swift new file mode 100644 index 0000000..4676937 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockPreparationViewModel.swift @@ -0,0 +1,608 @@ +import Foundation + +/// 拍摄准备状态:明确点击创建待飞任务,再用同一任务 ID 召唤,保留回执并防止重复提交。 +final class DroneDockPreparationViewModel { + /// 页面进入时固定的账号、景区及门店范围。 + let context: DroneDockHomeContext + /// 首页订单仅提供身份和初次加载时的摘要。 + let order: DroneDockHomeOrder + /// 张工返回的订单购买范围及最新次数。 + private(set) var projectInfo: DroneDockProjectInfoResponse? + /// 购买配置是否尚未读取完成。 + private(set) var isLoading = false + /// 购买配置或请求身份错误。 + private(set) var errorMessage: String? + /// 已购且可用的当前点位。 + private(set) var selectedSpotID: Int? + /// 当前点位下已购且可用的航线。 + private(set) var selectedRouteID: Int? + /// 朱工返回的当前景区无人机快照,与购买配置独立刷新。 + private(set) var planeStatus: DroneDockPlaneStatusResponse? + /// 无人机状态读取失败时不沿用旧的空闲或电量信息。 + private(set) var planeStatusErrorMessage: String? + /// 同一页面只保留一个无人机状态请求,避免轮询与手动刷新重叠。 + private(set) var isLoadingPlaneStatus = false + /// 创建期间冻结选择和重复点击,不发送飞行指令。 + private(set) var isCreatingTask = false + /// 创建成功的任务回执,后续召唤应复用此任务 ID。 + private(set) var createdTask: DroneDockCreatedTask? + /// 创建预检或业务拒绝的具体提示。 + private(set) var taskCreationErrorMessage: String? + /// POST 结果不明确时禁止盲目重试,需核对服务端任务后再继续。 + private(set) var taskCreationOutcomeUnknown = false + /// 召唤提交期间禁用重复点击;请求成功不等于已经到达或开始拍摄。 + private(set) var isSummoning = false + /// 朱工接受召唤请求的回执,data 缺失时仍以明确业务成功为准。 + private(set) var shootResponse: DroneDockShootResponse? + /// 召唤业务拒绝或结果未知的提示,始终保留已创建任务身份。 + private(set) var shootErrorMessage: String? + /// 召唤写请求结果不明确时禁止重发,等待后续核对任务状态。 + private(set) var summonOutcomeUnknown = false + /// 后端明确说明原任务已结束时,转为查看原任务,禁止继续重复首次召唤。 + private(set) var summonRequiresTaskReview = false + + /// 创建失败的用户提示;成功回执仅供业务与日志使用,不在页面输出。 + var creationFailure: DroneDockPreparationFailure? { + guard createdTask == nil, let message = taskCreationErrorMessage else { return nil } + return DroneDockPreparationFailure(message: message, stage: .creation, outcomeUnknown: taskCreationOutcomeUnknown) + } + + /// 召唤失败与创建失败分开表达,保留已经创建的任务。 + var summonFailure: DroneDockPreparationFailure? { + guard let message = shootErrorMessage else { return nil } + return DroneDockPreparationFailure(message: message, stage: .summon, + outcomeUnknown: summonOutcomeUnknown, code: shootErrorCode) + } + + private let diagnostics: DroneDockTaskDiagnostics + private let service: any DroneDockPreparationServing + private let planeStatusService: any DroneDockPlaneStatusServing + private let taskCreationService: any DroneDockTaskCreating + private let shootService: any DroneDockShootServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private var generation = 0 + private var planeStatusGeneration = 0 + private var taskCreationGeneration = 0 + private var didSendTaskCreation = false + private var hasCreatedTask = false + private var creationContextInvalidated = false + private var summonGeneration = 0 + private var didSendSummon = false + private var shootErrorCode: Int? + private var hasSubmittedSummon = false + private var primaryActionGeneration = 0 + private var isPerformingPrimaryAction = false + + /// 注入购买、设备、任务创建与召唤服务及最新会话,不绑定默认 MainActor。 + init(context: DroneDockHomeContext, order: DroneDockHomeOrder, + service: any DroneDockPreparationServing, + planeStatusService: any DroneDockPlaneStatusServing, + taskCreationService: any DroneDockTaskCreating, + shootService: any DroneDockShootServing, + diagnostics: DroneDockTaskDiagnostics = DroneDockTaskDiagnostics(), + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.diagnostics = diagnostics + self.context = context + self.order = order + self.service = service + self.planeStatusService = planeStatusService + self.taskCreationService = taskCreationService + self.shootService = shootService + self.currentContext = currentContext + } + + /// 准备页会话可与后续任务页入口事件关联,区分重新进入和同一次召唤。 + var diagnosticSessionID: String { diagnostics.sessionID } + + /// 准备阶段日志只观察现有选择、门禁与请求结果,不发起任何额外请求。 + func recordPreparationEvent(_ event: String, fields: [String: Any] = [:]) { + let summary: [String: Any] = ["source": "preparation", "scenic_id": context.scenicID, + "order_number": DroneDockTaskTraceFields.value(order.orderNumber), + "spot_id": DroneDockTaskTraceFields.value(selectedSpotID), + "air_line_id": DroneDockTaskTraceFields.value(selectedRouteID), + "created_task_id": DroneDockTaskTraceFields.value(createdTask?.taskID), + "is_creating": isCreatingTask, "is_summoning": isSummoning, + "creation_outcome_unknown": taskCreationOutcomeUnknown, "summon_outcome_unknown": summonOutcomeUnknown, + "primary_action_enabled": isPrimaryActionEnabled] + diagnostics.record(event, taskID: createdTask?.taskID ?? 0, + fields: summary.merging(fields) { _, new in new }) + } + + /// 当前阶段只创建待飞任务,不以设备电量或位置作为创建任务条件。 + var canCreateTask: Bool { + guard context.canLoad, !creationContextInvalidated, !isLoading, !isCreatingTask, + !hasCreatedTask, !taskCreationOutcomeUnknown, errorMessage == nil, + let info = projectInfo, info.order.canCreateTask == true, + let total = info.order.shotTotal, total > 0, + let remaining = info.order.shotRemain, remaining > 0, + selectedSpot?.available == true, selectedRoute?.available == true, + let number = DroneDockHomeMetric.usableText(order.orderNumber), number.count <= 128, + number.rangeOfCharacter(from: .controlCharacters) == nil, + number == order.orderNumber, let projectID = order.projectID, projectID > 0 else { return false } + return info.order.orderNumber == number && info.order.projectID == projectID + } + + /// 提交中和已有回执/不确定结果时冻结点位航线,避免显示与任务归属不一致。 + var isTaskSelectionLocked: Bool { + isCreatingTask || isSummoning || isPerformingPrimaryAction || hasCreatedTask || taskCreationOutcomeUnknown + } + /// 为诊断保留实际 data JSON,正式准备页不展示此内容。 + var creationDataJSON: String? { createdTask?.dataJSON } + /// 仅保留 shoot 实际返回的 data;缺失时不拼造成功 JSON。 + var shootDataJSON: String? { shootResponse?.dataJSON } + /// 创建回执携带的最新订单摘要优先于创建前购买摘要。 + var latestOrderSummary: DroneDockHomeOrder? { createdTask?.order ?? projectInfo?.order } + + /// 已受理或后端明确要求核对已结束的任务时允许查看,导航不重复提交召唤。 + var canOpenShootingTask: Bool { + context.canLoad && !creationContextInvalidated && !isLoading && !isCreatingTask + && !isSummoning && !isPerformingPrimaryAction && !taskCreationOutcomeUnknown + && !summonOutcomeUnknown && ((hasSubmittedSummon && shootResponse != nil) || summonRequiresTaskReview) + && (createdTask?.taskID ?? 0) > 0 + } + + /// 首次允许创建再召唤;明确业务拒绝后可对同任务重试,成功和未知结果锁定。 + var isPrimaryActionEnabled: Bool { + guard context.canLoad, !creationContextInvalidated, !isLoading, !isCreatingTask, + !isSummoning, !isPerformingPrimaryAction, !taskCreationOutcomeUnknown, + !hasSubmittedSummon, !summonOutcomeUnknown, !summonRequiresTaskReview else { return false } + if let createdTask { return createdTask.taskID > 0 } + return canCreateTask + } + + /// 主按钮串接创建与召唤;已有任务跳过创建,成功后的导航由页面处理。 + @MainActor + func prepareAndSummon(onStateChange: @escaping @MainActor () -> Void = {}) async { + recordPreparationEvent("preparation.primary_requested") + guard isPrimaryActionEnabled else { return } + primaryActionGeneration &+= 1 + let actionGeneration = primaryActionGeneration + isPerformingPrimaryAction = true + onStateChange() + defer { + if primaryActionGeneration == actionGeneration { + isPerformingPrimaryAction = false + onStateChange() + } + } + if createdTask == nil { await createTask(onStateChange: onStateChange) } + guard primaryActionGeneration == actionGeneration, !Task.isCancelled else { return } + await summonCreatedTask(onStateChange: onStateChange) + } + + /// 对明确创建成功的任务发送一次召唤;只有明确业务拒绝允许之后再次提交。 + @MainActor + private func summonCreatedTask(onStateChange: @escaping @MainActor () -> Void) async { + guard !isCreatingTask, !isSummoning, !taskCreationOutcomeUnknown, + !hasSubmittedSummon, !summonOutcomeUnknown, + let taskID = createdTask?.taskID, taskID > 0 else { return } + summonGeneration &+= 1 + let requestGeneration = summonGeneration + isSummoning = true + didSendSummon = false + shootErrorMessage = nil + shootErrorCode = nil + onStateChange() + defer { + if summonGeneration == requestGeneration { + if Task.isCancelled && didSendSummon && !hasSubmittedSummon { markSummonUnknown() } + isSummoning = false + didSendSummon = false + onStateChange() + } + } + guard acceptsSummon(requestGeneration, taskID: taskID) else { return } + do { + didSendSummon = true + recordPreparationEvent("summon.sending") + let response = try await shootService.shoot(taskID: taskID) + guard acceptsSummon(requestGeneration, taskID: taskID) else { return } + shootResponse = response + recordPreparationEvent("summon.receipt_accepted", fields: ["receipt": DroneDockTaskTraceFields.summon(response), + "travel_transition_allowed": response.confirmsTravel(taskID: taskID, orderNumber: order.orderNumber, + scenicID: context.scenicID)]) + hasSubmittedSummon = true + summonOutcomeUnknown = false + } catch { + guard acceptsSummon(requestGeneration, taskID: taskID) else { return } + recordPreparationEvent("summon.failed_or_unknown", fields: ["error": DroneDockDiagnostics.errorFields(error)]) + if case let APIError.serverCode(code, message) = error { + shootErrorCode = code + shootErrorMessage = message + summonRequiresTaskReview = DroneDockPreparationFailure.requiresTaskReview(message) + } else { + markSummonUnknown(reason: error.localizedDescription) + } + } + } + + /// 页面暂停使迟到召唤回执失效;已发送请求保留未知锁,成功回执和任务 ID 不清除。 + @MainActor + func invalidateSummon() { + if isSummoning && didSendSummon && !hasSubmittedSummon { markSummonUnknown() } + primaryActionGeneration &+= 1 + isPerformingPrimaryAction = false + summonGeneration &+= 1 + isSummoning = false + didSendSummon = false + if creationContextInvalidated { + shootResponse = nil + shootErrorMessage = nil + shootErrorCode = nil + summonRequiresTaskReview = false + } + } + + /// 点击后先校验最新购买配置,再发送一次创建请求;成功留在准备页供核对。 + @MainActor + func createTask(onStateChange: @escaping @MainActor () -> Void = {}) async { + recordPreparationEvent("create.requested", fields: ["allowed": canCreateTask]) + guard canCreateTask, let spotID = selectedSpotID, let routeID = selectedRouteID, + let number = order.orderNumber, let projectID = order.projectID else { return } + taskCreationGeneration &+= 1 + let requestGeneration = taskCreationGeneration + isCreatingTask = true + didSendTaskCreation = false + taskCreationErrorMessage = nil + onStateChange() + defer { + if taskCreationGeneration == requestGeneration { + if Task.isCancelled && didSendTaskCreation && !hasCreatedTask { markTaskCreationUnknown() } + isCreatingTask = false + didSendTaskCreation = false + onStateChange() + } + } + guard acceptsTaskCreation(requestGeneration) else { return } + do { + let latest = try await service.projectInfo(scenicID: context.scenicID, projectID: projectID, orderNumber: number) + guard acceptsTaskCreation(requestGeneration) else { return } + guard latest.order.orderNumber == number, latest.order.projectID == projectID else { + throw APIError.decodeFailed("购买配置与当前订单或项目不一致,请刷新重试") + } + projectInfo = latest + guard latest.order.canCreateTask == true, + let total = latest.order.shotTotal, total > 0, + let remaining = latest.order.shotRemain, remaining > 0 else { + taskCreationErrorMessage = "当前订单已不可新增拍摄任务,请刷新状态" + return + } + guard let spot = latest.spots.first(where: { $0.id == spotID }), spot.available == true, + spot.airLines.contains(where: { $0.id == routeID && $0.available == true }) else { + restoreValidSelection() + taskCreationErrorMessage = "所选点位或航线已不可用,请重新选择" + return + } + guard acceptsTaskCreation(requestGeneration) else { return } + didSendTaskCreation = true + recordPreparationEvent("create.sending") + let response = try await taskCreationService.createTask(scenicID: context.scenicID, + orderNumber: number, spotID: spotID, airLineID: routeID) + guard acceptsTaskCreation(requestGeneration) else { return } + guard response.taskID > 0, response.order.orderNumber == number, + response.order.projectID == nil || response.order.projectID == projectID else { + throw APIError.decodeFailed("创建回执与当前订单或项目不一致,请核对任务") + } + createdTask = response + recordPreparationEvent("create.receipt_accepted", fields: ["receipt_task_id": DroneDockTaskTraceFields.value(response.taskID)]) + hasCreatedTask = true + taskCreationOutcomeUnknown = false + } catch { + guard acceptsTaskCreation(requestGeneration) else { return } + recordPreparationEvent("create.failed_or_unknown", fields: ["error": DroneDockDiagnostics.errorFields(error)]) + if didSendTaskCreation { + if case APIError.serverCode = error { + taskCreationErrorMessage = error.localizedDescription + } else { + markTaskCreationUnknown(reason: error.localizedDescription) + } + } else { + taskCreationErrorMessage = Self.message(for: error) + } + } + } + + /// 读取当前景区的无人机状态,不重读购买配置、不改变点位或航线选择。 + @MainActor + func refreshPlaneStatus() async { + guard !isLoadingPlaneStatus else { return } + planeStatusGeneration &+= 1 + let requestGeneration = planeStatusGeneration + isLoadingPlaneStatus = true + planeStatusErrorMessage = nil + defer { + if planeStatusGeneration == requestGeneration { + isLoadingPlaneStatus = false + if Task.isCancelled { planeStatus = nil } + } + } + guard acceptsPlaneStatus(requestGeneration) else { return } + guard context.canLoad else { + planeStatus = nil + planeStatusErrorMessage = "缺少当前景区或登录信息,请返回工作台重新进入" + return + } + do { + let response = try await planeStatusService.planeStatus(scenicID: context.scenicID) + guard acceptsPlaneStatus(requestGeneration) else { return } + guard response.scenicID == context.scenicID else { + planeStatus = nil + planeStatusErrorMessage = "无人机状态与当前景区不一致,请刷新重试" + return + } + planeStatus = response + } catch { + guard acceptsPlaneStatus(requestGeneration) else { return } + planeStatus = nil + planeStatusErrorMessage = Self.message(for: error) + } + } + + /// 采用服务端轮询建议;缺失使用五秒,限制到五至六十秒避免密集请求。 + var pollIntervalNanoseconds: UInt64 { + UInt64(min(60_000, max(5_000, planeStatus?.pollHintMS ?? 5_000))) * 1_000_000 + } + + /// 暂停或离开时只使无人机请求失效,购买配置与选中航线继续保留。 + @MainActor + func invalidatePlaneStatus() { + planeStatusGeneration &+= 1 + isLoadingPlaneStatus = false + planeStatus = nil + planeStatusErrorMessage = nil + } + + /// 只展示购买快照中的点位,保持张工返回顺序。 + var spots: [DroneDockPurchasedSpot] { projectInfo?.spots ?? [] } + /// 当前有效点位。 + var selectedSpot: DroneDockPurchasedSpot? { spots.first { $0.id == selectedSpotID } } + /// 只展示当前已购点位中的航线。 + var routes: [DroneDockPurchasedAirLine] { selectedSpot?.airLines ?? [] } + /// 当前有效航线。 + var selectedRoute: DroneDockPurchasedAirLine? { routes.first { $0.id == selectedRouteID } } + /// 进入页面后直接请求购买快照,不等待定位或设备接口。 + func refresh() async { + guard !isCreatingTask else { return } + generation &+= 1 + let requestGeneration = generation + isLoading = true + errorMessage = nil + defer { if generation == requestGeneration { isLoading = false } } + guard await accepts(requestGeneration) else { return } + guard context.canLoad, let number = DroneDockHomeMetric.usableText(order.orderNumber), + let projectID = order.projectID, projectID > 0 else { + clearProject() + errorMessage = "缺少当前景区、订单或套餐信息,请返回工作台重新进入" + return + } + + let projectResult: Result + do { + projectResult = .success(try await service.projectInfo(scenicID: context.scenicID, projectID: projectID, orderNumber: number)) + } catch { + projectResult = .failure(error) + } + guard await accepts(requestGeneration) else { return } + switch projectResult { + case .success(let value) where value.order.orderNumber == number && value.order.projectID == projectID: + projectInfo = value + restoreValidSelection() + case .success: + clearProject() + errorMessage = "接口返回的订单或套餐与当前订单不一致,请刷新重试" + case .failure(let error): + clearProject() + errorMessage = Self.message(for: error) + } + } + + /// 不可用或可用性未知的点位不能选中,切点后选择首条明确可用的已购航线。 + func selectSpot(id: Int) { + guard !isLoading, !isTaskSelectionLocked, spots.contains(where: { $0.id == id && $0.available == true }), selectedSpotID != id else { return } + selectedSpotID = id + selectedRouteID = routes.first(where: { $0.available == true })?.id + } + + /// 忽略其他点位、不可用及身份不明的航线选择。 + func selectRoute(id: Int) { + guard !isLoading, !isTaskSelectionLocked, selectedSpot?.available == true, + routes.contains(where: { $0.id == id && $0.available == true }) else { return } + selectedRouteID = id + } + + /// 离开后使请求失效,保留创建回执或不确定结果,避免返回后重复建任务。 + @MainActor + func invalidate() { + if isCreatingTask && didSendTaskCreation { markTaskCreationUnknown() } + taskCreationGeneration &+= 1 + isCreatingTask = false + didSendTaskCreation = false + generation &+= 1 + isLoading = false + errorMessage = nil + clearProject() + invalidatePlaneStatus() + invalidateSummon() + } + + /// 连接状态仅使用 plane-status 的 connected,不由是否空闲推导。 + var connectionTitle: String { + switch planeStatus?.connected { + case true: "机巢已连接" + case false: "机巢未连接" + default: "机巢连接待确认" + } + } + /// 明确连接时标绿,离线或未知保持中性色。 + var connectionTone: DroneDockStatusTone { planeStatus?.connected == true ? .green : .gray } + /// 以购买快照中的名称展示当前选择。 + var selectionSummary: String { + guard let selectedSpot else { return "请选择拍摄点" } + guard let selectedRoute else { return "\(selectedSpot.name) · 未选航线" } + return "\(selectedSpot.name) · \(selectedRoute.name)" + } + /// 展示后端推荐设备,状态文案缺少电量时补充电量字段,不重选设备或把未知电量当零。 + var deviceStatusText: String { + guard let planeStatus else { return "状态待确认" } + guard let recommendation = planeStatus.recommend else { + return planeStatus.planes.isEmpty ? "暂无无人机" : "状态待确认" + } + let state = DroneDockHomeMetric.usableText(recommendation.statusText) + ?? DroneDockHomeMetric.usableText(recommendation.workStatusLabel) ?? "状态待确认" + let percent = recommendation.batteryPercent.flatMap { (0...100).contains($0) ? $0 : nil } + let battery = DroneDockHomeMetric.usableText(recommendation.batteryLabel) ?? percent.map { "电量 \($0)%" } + if state.contains("%") || state.contains("%") || battery.map({ state.contains($0) }) == true { return state } + return battery.map { "\(state) · \($0)" } ?? state + } + /// 状态颜色只映射文档定义的工作状态,未知值不展示为空闲。 + var deviceTone: DroneDockStatusTone { + switch planeStatus?.recommend?.workStatus { + case 1: .green + case 2: .orange + default: .gray + } + } + /// 文案区分创建、召唤提交与待核对,不将请求被接受表述为到达或拍摄成功。 + var primaryButtonTitle: String { + if isCreatingTask { return "正在创建任务…" } + if isSummoning { return "正在召唤无人机…" } + if hasSubmittedSummon || summonRequiresTaskReview { return "查看拍摄任务" } + if summonOutcomeUnknown { return "召唤结果待核对" } + if hasCreatedTask { return shootErrorMessage == nil ? "确认并召唤" : "重试召唤" } + if taskCreationOutcomeUnknown { return "结果待核对" } + if projectInfo?.order.shotRemain == 0 { return "拍摄次数已用完" } + if let info = projectInfo, info.order.canCreateTask != true { return "暂不可召唤" } + return "确认并召唤" + } + /// 说明创建与召唤提交结果,实际飞行状态需要后续任务状态核对。 + var admissionMessage: String { + if isCreatingTask { return "正在创建待飞任务,请勿重复点击" } + if isSummoning { return "任务已创建,正在提交召唤请求" } + if creationContextInvalidated, let errorMessage { return errorMessage } + if createdTask != nil { + if hasSubmittedSummon { return "召唤请求已提交,请等待任务状态更新" } + if let summonFailure { return summonFailure.message } + if summonOutcomeUnknown { return "召唤结果待核对,请勿重复提交" } + return "任务已创建,等待召唤" + } + if let creationFailure { return creationFailure.message } + if taskCreationOutcomeUnknown { return "创建结果待核对,请勿重复提交" } + if isLoading { return "正在获取拍摄准备信息" } + if let errorMessage { return errorMessage } + guard let info = projectInfo else { return "正在加载拍摄准备信息" } + if info.order.shotRemain == 0 { return "当前订单拍摄次数已用完" } + guard let remaining = info.order.shotRemain, remaining > 0, + let total = info.order.shotTotal, total > 0 else { return "拍摄次数待确认,请刷新状态" } + guard info.order.canCreateTask == true else { return "当前订单暂不可新增拍摄任务,请刷新状态" } + if spots.isEmpty { return "当前暂无可用拍摄点" } + guard let spot = selectedSpot, spot.available == true else { return "请选择可用拍摄点" } + if routes.isEmpty { return "当前拍摄点暂无可用航线" } + guard selectedRoute?.available == true else { return "请选择可用航线" } + return "点击后创建任务并召唤无人机" + } + + private func restoreValidSelection() { + guard !hasCreatedTask, !taskCreationOutcomeUnknown else { return } + if !spots.contains(where: { $0.id == selectedSpotID && $0.available == true }) { + selectedSpotID = spots.first(where: { $0.available == true })?.id + selectedRouteID = nil + } + if !routes.contains(where: { $0.id == selectedRouteID && $0.available == true }) { + selectedRouteID = routes.first(where: { $0.available == true })?.id + } + } + + private func clearProject() { + projectInfo = nil + // 已提交的任务仍归属原点位航线,暂时清空购买快照不能替它重新选项。 + guard creationContextInvalidated || !isTaskSelectionLocked else { return } + selectedSpotID = nil + selectedRouteID = nil + } + + private func accepts(_ requestGeneration: Int) async -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + let latest = await currentContext() + guard generation == requestGeneration, !Task.isCancelled else { return false } + guard context.hasSameIdentity(as: latest) else { + creationContextInvalidated = true + createdTask = nil + await invalidate() + errorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return true + } + + /// 无人机回包独立验证请求代次、取消状态与当前登录身份。 + @MainActor + private func acceptsPlaneStatus(_ requestGeneration: Int) -> Bool { + guard planeStatusGeneration == requestGeneration, !Task.isCancelled else { return false } + guard context.hasSameIdentity(as: currentContext()) else { + creationContextInvalidated = true + createdTask = nil + invalidate() + let message = "账号或景区已变化,请返回工作台重新进入" + errorMessage = message + planeStatusErrorMessage = message + return false + } + return true + } + + /// 写请求代次和身份检查;取消或切换会话后不显示迟到的成功回执。 + @MainActor + private func acceptsTaskCreation(_ requestGeneration: Int) -> Bool { + guard taskCreationGeneration == requestGeneration else { return false } + guard !Task.isCancelled else { + if didSendTaskCreation { markTaskCreationUnknown() } + return false + } + guard context.hasSameIdentity(as: currentContext()), !creationContextInvalidated else { + creationContextInvalidated = true + createdTask = nil + invalidate() + errorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return true + } + + /// 召唤只接受同一任务、同一会话及当前请求代次;提交后取消保留未知锁。 + @MainActor + private func acceptsSummon(_ requestGeneration: Int, taskID: Int) -> Bool { + guard summonGeneration == requestGeneration else { return false } + guard !Task.isCancelled else { + if didSendSummon && !hasSubmittedSummon { markSummonUnknown() } + return false + } + guard + createdTask?.taskID == taskID, !taskCreationOutcomeUnknown else { return false } + guard context.hasSameIdentity(as: currentContext()), !creationContextInvalidated else { + creationContextInvalidated = true + createdTask = nil + invalidate() + errorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return true + } + + private func markSummonUnknown(reason: String? = nil) { + summonOutcomeUnknown = true + shootErrorCode = nil + shootErrorMessage = (reason.map { "\($0)。" } ?? "") + "召唤结果待核对,请先核对任务状态,勿重复提交" + recordPreparationEvent("summon.outcome_unknown") + } + + private func markTaskCreationUnknown(reason: String? = nil) { + taskCreationOutcomeUnknown = true + taskCreationErrorMessage = (reason.map { "\($0)。" } ?? "") + "创建结果待核对,请先查看订单任务,勿重复提交" + recordPreparationEvent("taskcreation.outcome_unknown") + } + + private static func message(for error: Error) -> String? { + error is CancellationError ? nil : error.localizedDescription + } + +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockReceiptsViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockReceiptsViewModel.swift new file mode 100644 index 0000000..94c54f3 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockReceiptsViewModel.swift @@ -0,0 +1,136 @@ +import Foundation + +/// 套餐收款记录的分页状态,只展示当前账号与景区的真实收款数据。 +final class DroneDockReceiptsViewModel { + /// 当前记录所属的账号、景区及门店范围。 + private(set) var context: DroneDockHomeContext + /// 按后端顺序排列并以订单号去重的收款记录。 + private(set) var receipts: [DroneDockReceipt] = [] + /// 后端提供的完整查询范围汇总,不将已加载页自行相加。 + private(set) var summary: DroneDockReceiptSummary? + /// 当前是否有有效的刷新或翻页请求。 + private(set) var isLoading = false + /// 当前读取错误;翻页失败时仍保留已有记录。 + private(set) var errorMessage: String? + /// 后端分页信息是否还有下一页。 + private(set) var hasMore = false + + private let service: any DroneDockPaymentServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private let projectID: Int? + private var currentPage = 0 + private var generation = 0 + + /// 注入只读收款服务和最新会话;可按当前选中的套餐过滤记录。 + init(context: DroneDockHomeContext, service: any DroneDockPaymentServing, + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext, projectID: Int? = nil) { + self.context = context + self.service = service + self.currentContext = currentContext + self.projectID = projectID + } + + /// 从第一页重新读取,新的刷新会使旧刷新和旧分页响应失效。 + func refresh() async { + await request(page: 1, replacing: true) + } + + /// 读取下一页;失败后可以重试同一页,不清除已有成功结果。 + func loadMore() async { + guard !isLoading, hasMore else { return } + await request(page: currentPage + 1, replacing: false) + } + + /// 离开页面时清除数据,并阻止在途响应重新填充旧账号记录。 + func invalidate() { + generation &+= 1 + clearRecords() + isLoading = false + errorMessage = nil + } + + private func request(page: Int, replacing: Bool) async { + generation &+= 1 + let requestGeneration = generation + isLoading = true + errorMessage = nil + defer { if generation == requestGeneration { isLoading = false } } + + let requestedContext = await currentContext() + guard generation == requestGeneration, !Task.isCancelled else { return } + let changedIdentity = !context.hasSameIdentity(as: requestedContext) + if changedIdentity { clearRecords() } + context = requestedContext + guard requestedContext.canLoad else { + clearRecords() + errorMessage = "请先登录并选择景区和门店" + return + } + guard projectID.map({ $0 > 0 }) ?? true else { + clearRecords() + errorMessage = "套餐信息无效,请返回后重新选择" + return + } + guard replacing || !changedIdentity else { + errorMessage = "账号或景区已变化,请刷新收款记录" + return + } + + do { + let response = try await service.receipts(scenicID: requestedContext.scenicID, projectID: projectID, page: page) + guard await accepts(requestGeneration, context: requestedContext) else { return } + guard response.records.currentPage == page else { + if replacing { clearRecords() } + errorMessage = "收款记录页码异常,请重试" + return + } + receipts = merge(replacing ? [] : receipts, with: response.records.items) + summary = response.summary + currentPage = response.records.currentPage + hasMore = currentPage < response.records.lastPage + } catch { + guard await accepts(requestGeneration, context: requestedContext) else { return } + if replacing { clearRecords() } + if error is CancellationError { return } + errorMessage = error.localizedDescription + } + } + + private func accepts(_ requestGeneration: Int, context requested: DroneDockHomeContext) async -> Bool { + guard generation == requestGeneration, !Task.isCancelled else { return false } + let latest = await currentContext() + guard generation == requestGeneration, !Task.isCancelled else { return false } + guard requested.hasSameIdentity(as: latest) else { + generation &+= 1 + context = latest + clearRecords() + isLoading = false + errorMessage = "账号或景区已变化,请刷新收款记录" + return false + } + return true + } + + private func clearRecords() { + receipts = [] + summary = nil + currentPage = 0 + hasMore = false + } + + /// 翻页可能再次返回前页订单;更新其值但维持首次出现的位置。 + private func merge(_ existing: [DroneDockReceipt], with incoming: [DroneDockReceipt]) -> [DroneDockReceipt] { + var result = existing + var positions: [String: Int] = [:] + for (index, receipt) in result.enumerated() { positions[receipt.orderNumber] = index } + for receipt in incoming { + if let index = positions[receipt.orderNumber] { + result[index] = receipt + } else { + positions[receipt.orderNumber] = result.count + result.append(receipt) + } + } + return result + } +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockShootingTaskViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockShootingTaskViewModel.swift new file mode 100644 index 0000000..6444173 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockShootingTaskViewModel.swift @@ -0,0 +1,1372 @@ +import Foundation + +/// 拍摄任务状态及可选控制流程,始终复用同一任务;Release 真实入口与隔离模拟入口按策略注入操作服务。 +final class DroneDockShootingTaskViewModel { + /// 页面绑定的账号、景区和门店身份。 + let context: DroneDockHomeContext + /// 创建并召唤时使用的同一订单飞行任务 ID。 + let taskID: Int + /// 进入页面携带的订单摘要,仅作未返回展示字段时的订单文案备用。 + let order: DroneDockHomeOrder + /// 最近一次通过身份检查的服务端快照,刷新期间保留,成功后整体替换。 + private(set) var response: DroneDockShootingResponse? + /// 同一页面最多存在一个读取请求。 + private(set) var isLoading = false + /// 读取失败或身份变化时的提示。 + private(set) var errorMessage: String? + /// 开拍提交及其后单次状态核对期间禁用重复操作,保留之前的显示快照。 + private(set) var isStartingShooting = false + /// 开拍业务拒绝、本地拦截或结果待核对的说明。 + private(set) var startErrorMessage: String? + /// 已发送但无法确认的开拍请求,不因后续读取仍允许开始而自动解除。 + private(set) var startOutcomeUnknown = false + /// 当前页面是否已收到明确开拍受理回执,收到后不会再次提交。 + private(set) var hasSubmittedStart = false + /// 同任务开拍回执;受理成功不直接替代 shooting 的完整状态快照。 + private(set) var startResponse: DroneDockStartShootResponse? + /// 当前有安全指令 HTTP 提交,供生命周期取消使用,不作为其他安全按钮的总锁。 + var isSendingCommand: Bool { commandOperations.values.contains { $0.phase == .sending } } + /// 最近正在提交的动作,仅供诊断;按钮分别读取 isCommandLoading。 + var activeCommand: DroneDockSafetyCommand? { + commandOperations.values.filter { $0.phase == .sending }.max { $0.sequence < $1.sequence }?.command + } + /// 最近一次明确受理且身份一致的指令回执,不替代任务快照。 + private(set) var commandResponse: DroneDockCommandResponse? + /// 最近一次操作提示,界面按对应动作读取,不覆盖中央业务文案。 + var commandErrorMessage: String? { + commandOperations.values.filter { $0.error != nil }.max { $0.sequence < $1.sequence }?.error + } + /// 任一动作结果未知时,开拍和重召唤保持保护,安全动作仍独立授权。 + var commandOutcomeUnknown: Bool { commandOperations.values.contains { $0.phase == .unknown } } + /// 重新召唤提交及其后单次回查期间保留旧画面并锁定其他操作。 + private(set) var isResummoning = false + /// 重新召唤明确拒绝、本地拦截或待核对的说明。 + private(set) var resummonErrorMessage: String? + /// 请求已发送但受理结果未知,普通刷新不能解除重发锁。 + private(set) var resummonOutcomeUnknown = false + /// 当前页面已受理一次重召唤;旧失败快照不能使同一请求再次提交。 + private(set) var hasSubmittedResummon = false + /// 重新召唤的原始受理回执,不替代 shooting 的设备状态。 + private(set) var resummonResponse: DroneDockShootResponse? + + private let diagnostics: DroneDockTaskDiagnostics + private let service: any DroneDockShootingServing + private let startService: (any DroneDockStartShooting)? + private let commandService: (any DroneDockCommandSending)? + private let resummonService: (any DroneDockResummonServing)? + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private let countdownNow: @Sendable () -> ContinuousClock.Instant + private var arrivalCountdownDeadlines: [String: ContinuousClock.Instant] = [:] + /// 无权限或登录失效后停止自动读取,旧数据仅用于展示。 + private(set) var readAccessError: String? + private var snapshotRevision = 0 + private var generation = 0 + private var identityInvalidated = false + private var startGeneration = 0 + private var didSendStart = false + private var commandGeneration = 0 + private var resummonGeneration = 0 + private var didSendResummon = false + private var awaitingResummonSnapshot = false + // 仅在首份完整快照返回之前使用同一任务的 going_to_spot 回执,不补造设备状态。 + private var hasInitialTravelReceipt: Bool + private var commandOperations: [DroneDockSafetyCommand: DroneDockCommandOperation] = [:] + private var commandSequence = 0 + private var commandTasks: [String: Task] = [:] + private var commandTransportTail: Task? + private var supersededCommandIDs: Set = [] + private var minimumCommandSnapshotVersion: Int64? + private var retainedMetrics: [String: DroneDockHomeMetric] = [:] + private var isUsingRetainedMetrics = false + + /// 当前等待确认的动作,仅用于开拍/重召唤保护,不覆盖页面阶段。 + var pendingCommand: DroneDockSafetyCommand? { + commandOperations.values.filter { $0.phase == .pending || $0.phase == .unknown || $0.phase == .confirmed } + .max { $0.sequence < $1.sequence }?.command ?? remotePendingCommand + } + + /// 默认只读;仅显式注入操作服务时开放对应动作,Release 入口按授权注入。 + init(context: DroneDockHomeContext, taskID: Int, order: DroneDockHomeOrder, + service: any DroneDockShootingServing, + startService: (any DroneDockStartShooting)? = nil, + commandService: (any DroneDockCommandSending)? = nil, + resummonService: (any DroneDockResummonServing)? = nil, + initialSummonReceipt: DroneDockShootResponse? = nil, + countdownNow: @escaping @Sendable () -> ContinuousClock.Instant = { ContinuousClock.now }, + diagnostics: DroneDockTaskDiagnostics = DroneDockTaskDiagnostics(), + currentContext: @escaping @MainActor @Sendable () -> DroneDockHomeContext) { + self.diagnostics = diagnostics + self.context = context + self.taskID = taskID + self.order = order + self.service = service + self.startService = startService + self.commandService = commandService + self.resummonService = resummonService + self.currentContext = currentContext + self.countdownNow = countdownNow + self.hasInitialTravelReceipt = context.canLoad && initialSummonReceipt?.confirmsTravel( + taskID: taskID, orderNumber: order.orderNumber, scenicID: context.scenicID) == true + recordTaskEvent("task.created", fields: ["initial_travel_receipt": hasInitialTravelReceipt, + "summon_receipt": DroneDockTaskTraceFields.summon(initialSummonReceipt)]) + } + + /// 页面与业务层共享会话标识,串联准备页导航、快照和按钮事件。 + var diagnosticSessionID: String { diagnostics.sessionID } + + /// 记录任务关键事件,不改变接口、定时器、门禁或任何业务状态。 + func recordTaskEvent(_ event: String, fields: [String: Any] = [:]) { + let contextFields: [String: Any] = ["scenic_id": context.scenicID, + "order_number": DroneDockTaskTraceFields.value(order.orderNumber), + "execution_batch": DroneDockTaskTraceFields.value(response?.executionBatch), + "state_version": DroneDockTaskTraceFields.value(response?.stateVersion)] + diagnostics.record(event, taskID: taskID, fields: contextFields.merging(fields) { _, new in new }) + } + + /// 同一时刻的后端证据与本地判断,用于和录屏中的实际显示逐段对照。 + var taskDiagnosticFields: [String: Any] { + let state = presentation + let metrics = telemetry + return ["backend": DroneDockTaskTraceFields.snapshot(response), "local": [ + "phase": state.phase.rawValue, "conflict": resolvedDisplayPhase().1, + "title": state.title, "message": state.message, "action": String(describing: state.action), + "action_enabled": state.isActionEnabled, "countdown_seconds": DroneDockTaskTraceFields.value(state.countdownSeconds), + "pause_allowed": canSendCommand(.pause), "resume_allowed": canSendCommand(.resume), + "return_allowed": canSendCommand(.returnHome), "start_allowed": canStartShooting, + "restart_allowed": canResummon, "pause_loading": isCommandLoading(.pause), + "resume_loading": isCommandLoading(.resume), "return_loading": isCommandLoading(.returnHome), + "start_outcome_unknown": startOutcomeUnknown, "command_outcome_unknown": commandOutcomeUnknown, + "resummon_outcome_unknown": resummonOutcomeUnknown, + "read_access_error": DroneDockTaskTraceFields.value(readAccessError), + "read_error": DroneDockTaskTraceFields.value(errorMessage), + "recording_finished": isRecordingFinished, "stop_live": shouldStopLiveReception, + "using_retained_metrics": isUsingRetainedMetrics, "telemetry_stale": isTelemetryStale, + "telemetry": ["battery": metrics.batteryText, "env_temp": metrics.temperatureText, + "wind_speed": metrics.windText, "rainfall": metrics.rainText, + "signal": metrics.signalText, "satellite": metrics.satelliteText]]] + } + + /// 页面可见时读取同一任务;刷新及普通失败保留旧快照,身份失效立即清除。 + @MainActor + func refresh() async { + await refreshSnapshot(allowWhileStarting: false) + } + + /// 无缓存订阅只认此调用新读取且采纳的 HTTP 结果;读取未发起、失败或旧版本均返回 nil。 + @MainActor + func refreshForRealtimeSeed() async -> DroneDockHTTPSnapshotResult? { + await refreshSnapshot(allowWhileStarting: false) + } + + /// 操作提交前仅作废在途读取,保留快照和操作防重锁;迟到的旧读取不能覆盖操作回查。 + @MainActor + func invalidatePendingRefresh() { + generation &+= 1 + isLoading = false + } + + /// 后端建议间隔限制为 2~30 秒;缺失或无效时默认 5 秒,从上次请求结束后计时。 + var pollIntervalNanoseconds: UInt64 { + let hint = response?.planeStatus?.pollHintMS ?? 5_000 + return UInt64(min(max(hint > 0 ? hint : 5_000, 2_000), 30_000)) * 1_000_000 + } + + /// 身份失效或缺少任务信息时停止安排下一次读取。 + var canContinuePolling: Bool { + !identityInvalidated && readAccessError == nil && context.canLoad && taskID > 0 + && DroneDockHomeMetric.usableText(order.orderNumber) != nil + } + + @MainActor + @discardableResult + private func refreshSnapshot(allowWhileStarting: Bool, allowWhileCommand: Bool = false, + allowWhileResummoning: Bool = false) async -> DroneDockHTTPSnapshotResult? { + guard !isLoading, !identityInvalidated, readAccessError == nil, !isStartingShooting || allowWhileStarting, + !isResummoning || allowWhileResummoning else { return nil } + generation &+= 1 + let requestGeneration = generation + let revisionAtRequest = snapshotRevision + isLoading = true + recordTaskEvent("snapshot.http_requested", fields: ["read_generation": requestGeneration, "live_battery": 0]) + // 已失败的旧快照须等有效新响应再恢复操作,避免每次重查先短暂放开。 + defer { + if generation == requestGeneration { + isLoading = false + } + } + guard accepts(requestGeneration) else { return nil } + guard context.canLoad, taskID > 0, + DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + response = nil + errorMessage = "缺少有效任务、订单或景区信息,请返回工作台重新进入" + return nil + } + do { + let value = try await service.shooting(taskID: taskID, liveBattery: false) + guard accepts(requestGeneration) else { + recordTaskEvent("snapshot.http_ignored", fields: ["read_generation": requestGeneration, + "current_generation": generation, "reason": "cancelled_or_stale_read", + "incoming": DroneDockTaskTraceFields.snapshot(value)]) + return nil + } + let acceptance = applyTaskSnapshot(value, source: .http) + if acceptance == .invalid { + response = nil + throw APIError.decodeFailed("拍摄任务返回的任务、订单或景区与当前页面不一致,请重新读取") + } + switch acceptance { + case .applied, .duplicate: + return DroneDockHTTPSnapshotResult(snapshot: value, acceptance: acceptance) + case .outdated, .invalid: return nil + } + } catch { + guard accepts(requestGeneration) else { return nil } + if Self.stopsTaskReading(error) { + stopReading(message: error.localizedDescription) + return nil + } + // 迟到 HTTP 失败不能覆盖请求期间已收到的有效实时状态。 + guard snapshotRevision == revisionAtRequest else { return nil } + if !(error is CancellationError) { errorMessage = error.localizedDescription } + recordTaskEvent("snapshot.http_failed", fields: [ + "retained_snapshot": response != nil, "error": DroneDockDiagnostics.errorFields(error) + ]) + return nil + } + } + + /// HTTP 和推送共享完整快照入口,按执行批次、版本去重,绝不按到达顺序覆盖。 + @MainActor + @discardableResult + func applyTaskSnapshot(_ value: DroneDockShootingResponse, + source: DroneDockTaskSnapshotSource = .unspecified) -> DroneDockSnapshotAcceptance { + let incoming = DroneDockTaskTraceFields.snapshot(value) + func rejected(_ result: DroneDockSnapshotAcceptance, reason: String) -> DroneDockSnapshotAcceptance { + recordTaskEvent("snapshot.ignored", fields: ["source": source.rawValue, + "result": String(describing: result), "reason": reason, "incoming": incoming]) + return result + } + guard readAccessError == nil else { return rejected(.invalid, reason: "read_access_denied") } + guard accepts(generation) else { return rejected(.invalid, reason: "cancelled_or_identity_changed") } + guard matchesIdentity(value) else { return rejected(.invalid, reason: "task_order_or_scenic_mismatch") } + let previousBatch = response?.executionBatch + let previousVersion = response?.stateVersion + let previousPhase = presentation.phase.rawValue + if let oldBatch = response?.executionBatch, let oldVersion = response?.stateVersion { + guard let batch = value.executionBatch, let version = value.stateVersion else { + return rejected(.outdated, reason: "missing_batch_or_version") + } + if batch == oldBatch, version < (minimumCommandSnapshotVersion ?? 0) { + return rejected(.outdated, reason: "below_command_receipt_version_floor") + } + if batch < oldBatch || (batch == oldBatch && version < oldVersion) { + return rejected(.outdated, reason: "older_batch_or_version") + } + if batch == oldBatch && version == oldVersion { + errorMessage = nil + snapshotRevision &+= 1 + return rejected(.duplicate, reason: "same_batch_and_version") + } + } + if let oldBatch = response?.executionBatch, let newBatch = value.executionBatch, newBatch > oldBatch { + recordTaskEvent("task.new_batch", fields: ["old_batch": oldBatch, "new_batch": newBatch]) + // 新批次是新的控制上下文;旧请求无论成功、失败还是取消均不得重建旧锁。 + startGeneration &+= 1 + invalidateCommand() + resummonGeneration &+= 1 + isStartingShooting = false + isResummoning = false + didSendStart = false + didSendResummon = false + awaitingResummonSnapshot = false + clearPendingCommand() + minimumCommandSnapshotVersion = nil + commandResponse = nil + hasSubmittedStart = false + startOutcomeUnknown = false + startErrorMessage = nil + startResponse = nil + hasSubmittedResummon = false + resummonOutcomeUnknown = false + resummonErrorMessage = nil + resummonResponse = nil + } + if response?.executionBatch != value.executionBatch || response?.currentPlane?.id != value.currentPlane?.id { + retainedMetrics.removeAll() + } + isUsingRetainedMetrics = false + for key in ["battery", "env_temp", "wind_speed", "rainfall", "signal", "satellite"] { + if let metric = value.metrics.first(where: { $0.key == key && $0.displayText != "—" }) { + retainedMetrics[key] = metric + } else if retainedMetrics[key] != nil { + isUsingRetainedMetrics = true + } + } + response = value + reconcilePendingCommand() + if resolvedDisplayPhase().0 == .ready, arrivalCountdownDeadlines[recordingExecutionID] == nil { + arrivalCountdownDeadlines[recordingExecutionID] = countdownNow().advanced(by: .seconds(30)) + recordTaskEvent("countdown.started", fields: ["seconds": 30, "source": source.rawValue]) + } + hasInitialTravelReceipt = false + errorMessage = nil + snapshotRevision &+= 1 + if awaitingResummonSnapshot, [.navigating, .ready, .shooting, .postShootUploading, .postShootUploadFailed, .paused, .returning, .completed].contains(resolvedDisplayPhase().0) { + awaitingResummonSnapshot = false + } + recordTaskEvent("snapshot.applied", fields: ["source": source.rawValue, + "previous_batch": DroneDockTaskTraceFields.value(previousBatch), + "previous_version": DroneDockTaskTraceFields.value(previousVersion), + "previous_local_phase": previousPhase, "state": taskDiagnosticFields]) + return .applied + } + + /// 订阅明确无权限或 HTTP 鉴权失效时保留快照、禁用操作并停止后续读取。 + @MainActor + func stopReading(message: String) { + generation &+= 1 + isLoading = false + readAccessError = message + errorMessage = message + recordTaskEvent("task.read_access_stopped", fields: ["message": message]) + } + + /// 只把已确认的权限信息视为终止条件,不把所有 100099 业务错误一概当成无权限。 + private static func stopsTaskReading(_ error: Error) -> Bool { + if APIError.isAuthenticationExpired(error) { return true } + guard case APIError.serverCode(let code, let message) = error else { return false } + return code == 100099 && (message.contains("无权") || message.contains("无权限") || message.contains("飞行任务不存在")) + } + + /// 使旧请求失效;同一身份离页或进入后台可保留快照,账号变化始终清除并停止旧任务读取。 + @MainActor + func invalidate(preservingSnapshot: Bool = false) { + recordTaskEvent("task.invalidated", fields: ["preserving_snapshot": preservingSnapshot]) + invalidateStartShooting() + invalidateCommand() + invalidateResummon() + generation &+= 1 + isLoading = false + if !context.hasSameIdentity(as: currentContext()) { identityInvalidated = true } + if identityInvalidated || !preservingSnapshot { hasInitialTravelReceipt = false } + if identityInvalidated || !preservingSnapshot { arrivalCountdownDeadlines.removeAll() } + if identityInvalidated { + response = nil + startResponse = nil + startErrorMessage = nil + commandResponse = nil + resummonResponse = nil + resummonErrorMessage = nil + clearPendingCommand() + errorMessage = "账号或景区已变化,请返回工作台重新进入" + } else { + if !preservingSnapshot { response = nil } + errorMessage = readAccessError + } + } + + /// 只在有效读取明确到达、锁定飞机并允许 start_shoot 后开放。 + var canStartShooting: Bool { + startService != nil && context.canLoad && taskID > 0 && !identityInvalidated + && hasControlSnapshotIdentity + && hasKnownShootingTaskState + && readAccessError == nil && !isStartingShooting && !isSendingCommand && !isResummoning && errorMessage == nil + && !hasSubmittedStart && !startOutcomeUnknown + && !commandOperations.values.contains(where: { $0.isWaiting }) + && !commandOutcomeUnknown && !resummonOutcomeUnknown && !awaitingResummonSnapshot && pendingCommand == nil + && flightControlState == .executing + && resolvedDisplayPhase().0 == .ready + && response?.executeGate?.canExecute == true + && response?.executeGate?.primaryAction == "start_shoot" + && (response?.currentPlane?.id ?? 0) > 0 + } + + /// 提交一次开拍并单次读取同任务;失败保留原快照,不重建、不自动重发控制请求。 + @MainActor + func startShooting(onStateChange: @escaping @MainActor () -> Void = {}) async { + recordTaskEvent("start.requested", fields: ["allowed": canStartShooting, "state": taskDiagnosticFields]) + guard canStartShooting, let startService else { return } + guard context.hasSameIdentity(as: currentContext()) else { + identityInvalidated = true + invalidate() + onStateChange() + return + } + guard !Task.isCancelled else { return } + invalidatePendingRefresh() + let planeID = response?.currentPlane?.id + startGeneration &+= 1 + let requestGeneration = startGeneration + isStartingShooting = true + didSendStart = false + startErrorMessage = nil + onStateChange() + defer { + if startGeneration == requestGeneration { + if Task.isCancelled && didSendStart && !hasSubmittedStart { markStartUnknown() } + isStartingShooting = false + didSendStart = false + onStateChange() + } + } + guard acceptsStart(requestGeneration) else { return } + do { + didSendStart = true + let value = try await startService.startShooting(taskID: taskID) + guard acceptsStart(requestGeneration) else { return } + guard value.orderFlightTaskID == taskID, + value.orderFlightTask?.id == nil || value.orderFlightTask?.id == taskID, + value.orderFlightTask?.orderNumber == nil || value.orderFlightTask?.orderNumber == order.orderNumber, + value.orderFlightTask?.scenicID == nil || value.orderFlightTask?.scenicID == context.scenicID, + value.planeID == nil || value.planeID == planeID else { + throw APIError.decodeFailed("开始拍摄回执与当前任务或飞机不一致,请先核对任务状态") + } + startResponse = value + recordTaskEvent("start.receipt_accepted", fields: ["receipt_task_id": DroneDockTaskTraceFields.value(value.orderFlightTaskID), + "receipt_plane_id": DroneDockTaskTraceFields.value(value.planeID)]) + hasSubmittedStart = true + startOutcomeUnknown = false + onStateChange() + guard acceptsStart(requestGeneration) else { return } + await refreshSnapshot(allowWhileStarting: true) + } catch { + guard acceptsStart(requestGeneration) else { return } + if case APIError.serverCode = error { + startErrorMessage = error.localizedDescription + } else { + markStartUnknown(reason: error.localizedDescription) + } + } + } + + /// 离页或进入后台后拒绝迟到回执;已发而未确认的请求保留待核对锁。 + @MainActor + func invalidateStartShooting() { + if isStartingShooting && didSendStart && !hasSubmittedStart { markStartUnknown() } + startGeneration &+= 1 + isStartingShooting = false + didSendStart = false + } + + /// 设备执行态必须属于当前完整快照批次;空对象、未知枚举或缺少回巢依据保持未知。 + var flightControlState: DroneDockFlightControlState { + response?.flightControl?.resolvedState(for: response?.executionBatch) ?? .unknown + } + + /// 安全操作服从同批次的后端明确许可;遥测未知或拍摄结果不单独否决权限。 + var availableSafetyCommands: [DroneDockSafetyCommand] { + guard hasControlSnapshotIdentity, let control = response?.flightControl else { return [] } + switch flightControlState { + case .starting: + return control.canReturnHome == true ? [.returnHome] : [] + case .executing: + return [(DroneDockSafetyCommand.pause, control.canPause), (.returnHome, control.canReturnHome)] + .compactMap { $0.1 == true ? $0.0 : nil } + case .paused: + return [(DroneDockSafetyCommand.resume, control.canResume), (.returnHome, control.canReturnHome)] + .compactMap { $0.1 == true ? $0.0 : nil } + case .returning: + return control.canPause == true ? [.pause] : [] + case .returned, .unknown: + return [] + } + } + + /// 本次按钮独立等待,包括重进页读取到的服务端 pending;未知结果不自动重发。 + func isCommandLoading(_ command: DroneDockSafetyCommand) -> Bool { + commandOperations[command]?.isLoading == true || remotePendingCommand == command + } + + /// 指令结果未知仅影响该动作的辅助提示和防重。 + func isCommandOutcomeUnknown(_ command: DroneDockSafetyCommand) -> Bool { + commandOperations[command]?.phase == .unknown + } + + /// 读取对应动作的错误,不让暂停失败污染返航按钮。 + func commandErrorMessage(for command: DroneDockSafetyCommand) -> String? { + commandOperations[command]?.error + } + + /// 已知飞行状态与逐项权限授权,不按业务失败/素材状态或另一按钮 loading 拦截。 + func canSendCommand(_ command: DroneDockSafetyCommand) -> Bool { + commandService != nil && context.canLoad && taskID > 0 && !identityInvalidated + && readAccessError == nil && !isStartingShooting && !isResummoning + && !resummonOutcomeUnknown && !awaitingResummonSnapshot + && commandOperations[command]?.isWaiting != true && !isCommandLoading(command) + && (response?.currentPlane?.id ?? 0) > 0 + && availableSafetyCommands.contains(command) + } + + /// 每次点击立即进入对应按钮等待;只串行 HTTP 提交,不等待前一设备指令确认。 + @MainActor + func sendCommand(_ command: DroneDockSafetyCommand, + onStateChange: @escaping @MainActor () -> Void = {}) async { + recordTaskEvent("command.requested", fields: ["command": command.rawValue, + "allowed": canSendCommand(command), "state": taskDiagnosticFields]) + guard canSendCommand(command), let batch = response?.executionBatch, + let plane = response?.currentPlane else { return } + guard context.hasSameIdentity(as: currentContext()) else { + identityInvalidated = true + invalidate() + onStateChange() + return + } + guard !Task.isCancelled else { return } + commandSequence += 1 + let operation = DroneDockCommandOperation(requestID: UUID().uuidString, command: command, + batch: batch, sequence: commandSequence, generation: commandGeneration, + submittedVersion: response?.stateVersion ?? 0, planeID: plane.id ?? 0, + airportSN: plane.snNumber, resumePhase: response?.flightControl?.resumePhase) + commandOperations[command] = operation + recordCommandEvent("command.queued", operation: operation) + let predecessor = commandTransportTail + let task = Task { @MainActor [weak self] in + await predecessor?.value + guard let self else { return } + await self.submitCommand(operation, onStateChange: onStateChange) + } + commandTransportTail = task + commandTasks[operation.requestID] = task + onStateChange() + await withTaskCancellationHandler { + await task.value + } onCancel: { + task.cancel() + } + commandTasks[operation.requestID] = nil + guard acceptsCommand(operation) else { return } + if commandOperations[command]?.commandID != nil { + await refreshSnapshot(allowWhileStarting: false, allowWhileCommand: true) + } + onStateChange() + } + + /// 回执只处理对应请求的按钮进度;随后由统一快照更新业务阶段。 + @MainActor + private func submitCommand(_ operation: DroneDockCommandOperation, + onStateChange: @escaping @MainActor () -> Void) async { + guard acceptsCommand(operation), let commandService else { + recordCommandEvent("command.queue_discarded", operation: operation, + fields: ["reason": "cancelled_or_task_context_changed"]) + if commandOperations[operation.command]?.requestID == operation.requestID, + commandOperations[operation.command]?.phase == .queued { commandOperations[operation.command] = nil } + onStateChange() + return + } + guard readAccessError == nil, !isStartingShooting, !isResummoning, + response?.currentPlane?.id == operation.planeID, + response?.currentPlane?.snNumber == operation.airportSN, + availableSafetyCommands.contains(operation.command) else { + commandOperations[operation.command]?.phase = .finished + commandOperations[operation.command]?.error = "设备状态或操作权限已变化,本次指令未发送" + recordCommandEvent("command.queue_discarded", operation: operation, + fields: ["reason": "latest_permission_or_plane_changed", "state": taskDiagnosticFields]) + onStateChange() + return + } + invalidatePendingRefresh() + commandOperations[operation.command]?.phase = .sending + recordCommandEvent("command.sending", operation: operation) + onStateChange() + defer { onStateChange() } + do { + let value = try await commandService.sendCommand(taskID: taskID, command: operation.command, + clientRequestID: operation.requestID) + try Task.checkCancellation() + guard acceptsCommand(operation) else { + recordCommandEvent("command.receipt_ignored", operation: operation, + fields: ["reason": "stale_task_context", "receipt_batch": DroneDockTaskTraceFields.value(value.executionBatch), + "receipt_command_id": DroneDockTaskTraceFields.value(value.commandID)]) + return + } + recordCommandEvent("command.receipt_received", operation: operation, fields: [ + "receipt_task_id": DroneDockTaskTraceFields.value(value.orderFlightTaskID), + "receipt_batch": DroneDockTaskTraceFields.value(value.executionBatch), + "receipt_version": DroneDockTaskTraceFields.value(value.stateVersion), + "receipt_command": DroneDockTaskTraceFields.value(value.command), + "receipt_command_id": DroneDockTaskTraceFields.value(value.commandID), + "receipt_client_request_id": DroneDockTaskTraceFields.value(value.clientRequestID), + "accepted": DroneDockTaskTraceFields.value(value.accepted), + "device_confirmed": DroneDockTaskTraceFields.value(value.deviceConfirmed), + "pending_command": DroneDockTaskTraceFields.progress(value.pendingCommand)]) + guard value.orderFlightTaskID == taskID, value.command == operation.command.rawValue, + value.executionBatch == operation.batch, + value.clientRequestID == nil || value.clientRequestID == operation.requestID, + value.flightControl == nil || value.flightControl?.executionBatch == operation.batch, + value.planeID == nil || value.planeID == operation.planeID, + value.airportSN == nil || value.airportSN == operation.airportSN, + value.stateVersion == nil || value.stateVersion! >= operation.submittedVersion else { + throw APIError.decodeFailed("安全指令回执与当前任务、批次、设备或请求不一致,请核对状态") + } + if value.accepted == false { throw APIError.serverCode(100099, "指令未受理,请核对任务状态后重试") } + guard value.accepted == true, let commandID = usable(value.commandID) else { + throw APIError.decodeFailed("指令回执缺少明确受理结果或 command_id,请核对状态") + } + commandResponse = value + if let version = value.stateVersion { + minimumCommandSnapshotVersion = max(minimumCommandSnapshotVersion ?? 0, version) + } + // HTTP 严格按点击顺序提交;后受理的本地请求按合同取代之前的等待意图。 + for (command, old) in commandOperations where old.sequence < operation.sequence && old.isWaiting { + if let id = old.commandID { supersededCommandIDs.insert(id) } + commandOperations[command]?.phase = .finished + commandOperations[command]?.error = nil + recordCommandEvent("command.superseded", operation: old, + fields: ["superseded_by_client_request_id": operation.requestID, + "superseded_by_command_id": commandID]) + } + if let old = response?.flightControl?.pendingCommand, let id = old.commandID, + id != commandID { supersededCommandIDs.insert(id) } + commandOperations[operation.command]?.commandID = commandID + commandOperations[operation.command]?.minimumVersion = value.stateVersion + commandOperations[operation.command]?.phase = .pending + commandOperations[operation.command]?.error = nil + if let progress = value.pendingCommand { + guard progressMatches(progress, operation: commandOperations[operation.command]!) else { + throw APIError.decodeFailed("指令进度与本次请求不一致,请核对状态") + } + applyCommandProgress(progress, command: operation.command) + } else if value.deviceConfirmed == true { + commandOperations[operation.command]?.phase = .confirmed + supersededCommandIDs.insert(commandID) + } + reconcilePendingCommand() + recordCommandEvent("command.receipt_applied", operation: operation) + } catch { + guard acceptsCommand(operation, allowingCancellation: true) else { + recordCommandEvent("command.error_ignored", operation: operation, + fields: ["reason": "stale_task_context", "error": DroneDockDiagnostics.errorFields(error)]) + return + } + if case APIError.serverCode = error { + commandOperations[operation.command]?.phase = .finished + commandOperations[operation.command]?.error = error.localizedDescription + } else { + commandOperations[operation.command]?.phase = .unknown + commandOperations[operation.command]?.error = "安全指令结果待核对,请刷新任务状态,勿重复提交" + } + recordCommandEvent("command.failed_or_unknown", operation: operation, + fields: ["error": DroneDockDiagnostics.errorFields(error)]) + } + } + + /// 离页取消在途请求;已发送的结果保持待核对,回前台仅通过快照核对。 + @MainActor + func invalidateCommand() { + recordTaskEvent("command.lifecycle_cancelled", fields: ["operation_count": commandOperations.count, + "transport_count": commandTasks.count]) + commandGeneration &+= 1 + for task in commandTasks.values { task.cancel() } + commandTasks.removeAll() + commandTransportTail = nil + for (command, operation) in commandOperations { + switch operation.phase { + case .queued: commandOperations[command] = nil + case .sending: + commandOperations[command]?.phase = .unknown + commandOperations[command]?.error = "安全指令结果待核对,请刷新任务状态,勿重复提交" + default: break + } + } + } + + /// 任务失败或中断回巢后,设备空闲且后端明确允许,无在途或未知操作时才可重召唤。 + var canResummon: Bool { + resummonService != nil && context.canLoad && taskID > 0 && !identityInvalidated + && hasControlSnapshotIdentity + && !isTaskAwaitingConfirmation + && readAccessError == nil && !isStartingShooting && !isSendingCommand && !isResummoning && errorMessage == nil + && !startOutcomeUnknown && !commandOutcomeUnknown && !resummonOutcomeUnknown + && !hasSubmittedResummon && pendingCommand == nil + && !commandOperations.values.contains(where: { $0.isWaiting }) + && [.failed, .returned].contains(resolvedDisplayPhase().0) + && response?.restartGate?.canRestart == true + && flightControlState == .returned + && response?.currentPlane?.workStatus == 1 + && (response?.orderFlightTask?.id == taskID || response?.task?.id == taskID) + && (response?.currentPlane?.id ?? 0) > 0 + && !isResummonDeviceUnavailable + } + + /// 复用同一任务提交一次 restart=true;受理后只查询一次 shooting,不推断已经到达。 + @MainActor + func resummon(onStateChange: @escaping @MainActor () -> Void = {}) async { + recordTaskEvent("resummon.requested", fields: ["allowed": canResummon, "state": taskDiagnosticFields]) + guard canResummon, let resummonService else { return } + guard context.hasSameIdentity(as: currentContext()) else { + identityInvalidated = true + invalidate() + onStateChange() + return + } + guard !Task.isCancelled else { return } + invalidatePendingRefresh() + resummonGeneration &+= 1 + let requestGeneration = resummonGeneration + isResummoning = true + didSendResummon = false + resummonResponse = nil + resummonErrorMessage = nil + onStateChange() + defer { + if resummonGeneration == requestGeneration { + if Task.isCancelled && didSendResummon && !hasSubmittedResummon { markResummonUnknown() } + isResummoning = false + didSendResummon = false + onStateChange() + } + } + guard acceptsResummon(requestGeneration) else { return } + do { + didSendResummon = true + let value = try await resummonService.resummon(taskID: taskID) + guard acceptsResummon(requestGeneration) else { return } + guard try matchesResummonReceipt(value) else { + throw APIError.decodeFailed("重新召唤回执与当前任务或订单不一致,请先核对任务状态") + } + resummonResponse = value + recordTaskEvent("resummon.receipt_accepted", fields: ["receipt": DroneDockTaskTraceFields.summon(value)]) + hasSubmittedResummon = true + resummonOutcomeUnknown = false + awaitingResummonSnapshot = true + hasSubmittedStart = false + startResponse = nil + startErrorMessage = nil + commandResponse = nil + onStateChange() + guard acceptsResummon(requestGeneration) else { return } + await refreshSnapshot(allowWhileStarting: false, allowWhileResummoning: true) + } catch { + guard acceptsResummon(requestGeneration) else { return } + if case APIError.serverCode = error { + didSendResummon = false + resummonErrorMessage = error.localizedDescription + } else { + markResummonUnknown(reason: error.localizedDescription) + } + } + } + + /// 离页或进入后台后忽略旧回执;发出后未确认的重新召唤继续保持待核对锁。 + @MainActor + func invalidateResummon() { + if isResummoning && didSendResummon && !hasSubmittedResummon { markResummonUnknown() } + resummonGeneration &+= 1 + isResummoning = false + didSendResummon = false + } + + /// 优先使用当前接口标题,缺失时展示当前接口的点位和航线名称。 + var title: String { + if let title = usable(response?.header?.title) { return title } + let names = [usable(response?.scenicSpot?.name), usable(response?.airLine?.name)].compactMap { $0 } + return names.isEmpty ? "拍摄任务" : names.joined(separator: " · ") + } + + /// 服务端游客和套餐文案优先,后端已返回的套餐不被进入页摘要覆盖。 + var subtitle: String { + let tourist = usable(response?.header?.touristLabel) ?? usable(order.touristPhoneMask) + let package = usable(response?.header?.packageName) ?? usable(order.packageName) + let parts = [tourist, package].compactMap { $0 } + return parts.isEmpty ? "—" : parts.joined(separator: " · ") + } + + /// 只展示本任务当前设备状态,不以景区推荐设备替代任务锁定设备。 + var deviceStatusText: String { + usable(response?.currentPlane?.statusText) ?? usable(response?.currentPlane?.workStatusLabel) ?? "—" + } + + /// 录制完成与素材就绪分别保留;只由可信阶段触发完成提示,不修改后端任务状态。 + var isRecordingFinished: Bool { + guard !isInterruptedReturn else { return false } + let phase = resolvedBusinessPhase().0 + let tasks = [response?.task, response?.orderFlightTask].compactMap { $0 } + let statuses = tasks.compactMap(\.status) + let completedWhilePaused = response?.flightControl?.returnReason == "normal_complete" + && !statuses.contains(where: { [40, 50, 60].contains($0) }) + && statuses.contains(where: { [25, 30].contains($0) }) + && tasks.contains(where: { [24, 30, 40, 50].contains($0.waylineStatus ?? -1) }) + return [.postShootUploading, .postShootUploadFailed, .completed].contains(phase) + || (phase == .failed && hasMediaProcessingFailure) + || completedWhilePaused + } + + /// 已正常拍完或中断后确认回巢均停止本机接收;回巢不触发拍摄成功提示。 + var shouldStopLiveReception: Bool { + isRecordingFinished || resolvedDevicePhase().0 == .returned + } + + /// 只有录制正常结束或素材就绪才弹出完成提示,素材处理失败只展示失败状态。 + var shouldPresentRecordingCompletion: Bool { + [.postShootUploading, .completed].contains(resolvedDisplayPhase().0) + } + + /// 正常拍完后的返航说明仅取本批次可信完成阶段,上传/渲染或显式清标记后不沿用。 + var isShootCompleteReturning: Bool { + guard resolvedDisplayPhase().0 == .postShootUploading else { return false } + let waylines = [response?.task?.waylineStatus, response?.orderFlightTask?.waylineStatus].compactMap { $0 } + guard !waylines.contains(where: { [30, 40, 50].contains($0) }) else { return false } + let flags = [response?.shootCompleteReturning, response?.ui?.shootCompleteReturning].compactMap { $0 } + if flags.contains(false) { return false } + if let control = response?.flightControl { + return flightControlState == .returning && control.returnReason == "normal_complete" + } + if flags.contains(true) || response?.ui?.waylineStage == "shoot_done_returning" { return true } + // 旧回包仍保留明确的设备返航文案;新合同不再依赖只有忙闲的 work_status。 + guard response?.ui?.waylineStage == nil else { return false } + return ["返航中", "正在返航"].contains(usable(response?.currentPlane?.workStatusLabel) ?? "") + } + + /// 完成提示按当前任务的执行批次去重,旧快照仍由统一版本校验拒绝。 + var recordingExecutionID: String { + "\(taskID):\(response?.executionBatch ?? 0)" + } + + /// App 首次确认本批次到达后显示 30 秒本地倒计时;到零仍等待后端阶段,不触发控制或状态读取。 + var countdownRemainingSeconds: Int? { + guard !identityInvalidated, readAccessError == nil, resolvedDisplayPhase().0 == .ready, + let deadline = arrivalCountdownDeadlines[recordingExecutionID] else { return nil } + let remaining = countdownNow().duration(to: deadline) + guard remaining > .zero else { return 0 } + let parts = remaining.components + return Int(min(30, parts.seconds + (parts.attoseconds > 0 ? 1 : 0))) + } + + /// 页面标题由本地显示阶段决定,服务端文案只保留在诊断数据中。 + var statusTitle: String { + if response == nil { + if errorMessage != nil { return "任务状态读取失败" } + if hasInitialTravelReceipt { return "无人机正在赶来" } + if isLoading { return "正在获取任务状态" } + } + let (phase, conflict) = resolvedDisplayPhase() + return presentationTitle(for: phase, conflict: conflict) + } + + /// 拍摄阶段使用产品提示,其余保留服务端说明;操作结果未知时优先提示核对。 + var statusMessage: String { + if response == nil { + if let errorMessage { return errorMessage } + if hasInitialTravelReceipt { return "召唤已受理,正在等待设备到达确认,请留在拍摄点。" } + if isLoading { return "正在读取当前拍摄任务" } + } + if let resummonErrorMessage { return resummonErrorMessage } + if awaitingResummonSnapshot { return "重新召唤请求已受理,请刷新核对任务状态" } + switch resolvedDisplayPhase().0 { + case .paused: + return response?.flightControl?.resumePhase == "returning" + ? "当前悬停待命。\n确认安全后,继续任务将恢复返航。" + : "当前悬停待命。\n确认安全后,可继续任务或立即返航。" + case .returning: return "本次拍摄已中断。请留意实时画面与无人机状态。" + case .returned: return "无人机已返回机巢,可在满足条件后重新召唤。" + case .unknown where isInterruptedReturn: return "暂无法确认无人机是否已返回机巢,请等待设备状态更新。" + default: break + } + if resolvedDisplayPhase().0 == .failed { return failureMessage } + if resolvedDisplayPhase().0 == .postShootUploadFailed { return mediaFailureMessage } + if isTaskAwaitingConfirmation { return usable(response?.ui?.message) ?? "任务结果待确认,请刷新核对状态。" } + if startOutcomeUnknown, let startErrorMessage { return startErrorMessage } + if resolvedDisplayPhase().0 == .ready { + if let startErrorMessage { return startErrorMessage } + if hasSubmittedStart { return "开始拍摄请求已受理,请刷新确认任务状态" } + if response?.executeGate?.canExecute != true, let message = usable(response?.executeGate?.message) { + return message + } + } + if resolvedDisplayPhase().0 == .postShootUploading { + let waylines = [response?.task?.waylineStatus, response?.orderFlightTask?.waylineStatus] + let note: String + if isShootCompleteReturning { note = "无人机正在返航,请留意现场。" } + else if waylines.contains(30) { note = "素材上传中,可在素材库查看进度。" } + else if waylines.contains(40) { note = "素材渲染中,可在素材库查看进度。" } + else { note = "素材处理中,可在素材库查看进度。" } + return "本次拍摄已结束,可前往查看素材。\n" + note + } + if resolvedDisplayPhase().0 == .shooting { return "请关注现场及实时画面。\n请勿关闭本页或息屏。" } + switch resolvedDisplayPhase().0 { + case .navigating: return "请留在拍摄点,等待无人机到达。" + case .ready: return "确认游客站位与取景后开始" + case .completed: return "素材已就绪,可前往素材库查看。" + case .unknown: return "暂无法确认任务状态,请刷新后重试。" + default: return usable(response?.executeGate?.message) ?? "请等待任务状态更新。" + } + } + + /// 组合可信阶段与本轮可用动作,不从请求成功、执行中或指令列表推断飞行进度。 + var presentation: DroneDockTaskPresentation { + if response == nil, hasInitialTravelReceipt, errorMessage == nil, !identityInvalidated { + return DroneDockTaskPresentation(phase: .navigating, title: statusTitle, message: statusMessage, + deviceStatus: deviceStatusText, action: .none, actionTitle: nil, isActionEnabled: false) + } + if response == nil, isLoading { + return DroneDockTaskPresentation(phase: .loading, title: "正在获取任务状态", message: "正在读取当前拍摄任务", + deviceStatus: deviceStatusText, action: .none, actionTitle: nil, isActionEnabled: false) + } + if response == nil, let errorMessage { + return DroneDockTaskPresentation(phase: .readError, title: "任务状态读取失败", message: errorMessage, + deviceStatus: deviceStatusText, action: .refresh, actionTitle: "重新读取", isActionEnabled: !identityInvalidated && readAccessError == nil) + } + let (phase, conflict) = resolvedDisplayPhase() + let message = conflict ? "任务状态信息不一致,请刷新后确认。" + (statusMessage == "—" ? "" : statusMessage) : statusMessage + let title = presentationTitle(for: phase, conflict: conflict) + let action: DroneDockTaskDisplayAction + let actionTitle: String? + let enabled: Bool + switch phase { + case .shooting: + action = .none + actionTitle = "拍摄中" + enabled = false + case .ready where hasSubmittedStart || startOutcomeUnknown || commandOutcomeUnknown || resummonOutcomeUnknown: + action = .refresh + actionTitle = "刷新状态" + enabled = !identityInvalidated + case .ready: + action = .start + actionTitle = isStartingShooting ? "正在提交开拍…" + : startErrorMessage == nil ? "开始拍摄" : "重试开始拍摄" + enabled = canStartShooting + case .paused: + action = .resume + actionTitle = "继续任务" + enabled = canSendCommand(.resume) + case .returning: + action = .none + actionTitle = "拍摄已中断" + enabled = false + case .completed, .postShootUploading, .postShootUploadFailed: + action = .materials + actionTitle = "查看素材" + enabled = true + case .failed where hasSubmittedResummon || resummonOutcomeUnknown, + .returned where hasSubmittedResummon || resummonOutcomeUnknown: + action = .refresh + actionTitle = "刷新状态" + enabled = !identityInvalidated + case .failed, .returned: + action = .retry + actionTitle = isResummoning ? "正在重新召唤…" : "重新召唤无人机" + enabled = canResummon + default: + action = .refresh + actionTitle = "刷新状态" + enabled = !identityInvalidated + } + return DroneDockTaskPresentation(phase: phase, title: title, message: message, + deviceStatus: deviceStatusText, action: action, actionTitle: actionTitle, + isActionEnabled: enabled && readAccessError == nil && !isStartingShooting && !isResummoning && !identityInvalidated && (errorMessage == nil || action == .refresh), + actionNote: [.failed, .returned].contains(phase) && action == .retry && !canResummon && !isResummoning ? retryUnavailableNote : nil, + countdownSeconds: countdownRemainingSeconds) + } + + /// 后端六项展示读数,不解析文案反推设备状态或数值单位。 + var telemetry: DroneDockShootingTelemetry { + func text(_ key: String) -> String { response == nil ? "—" : retainedMetrics[key]?.displayText ?? "—" } + return DroneDockShootingTelemetry(batteryText: text("battery"), temperatureText: text("env_temp"), + windText: text("wind_speed"), rainText: text("rainfall"), signalText: text("signal"), satelliteText: text("satellite")) + } + + /// 无快照或后端标记缓存过期时使用非实时样式;已有读数仍保留展示。 + var isTelemetryStale: Bool { response == nil || response?.metricsStale == true || isUsingRetainedMetrics } + /// 完整服务端 data,供页面展示和联调查看。 + var dataJSON: String? { response?.dataJSON } + + @MainActor + private func accepts(_ requestGeneration: Int) -> Bool { + guard generation == requestGeneration else { return false } + guard context.hasSameIdentity(as: currentContext()), !identityInvalidated else { + identityInvalidated = true + invalidate() + errorMessage = "账号或景区已变化,请返回工作台重新进入" + return false + } + return !Task.isCancelled + } + + @MainActor + private func acceptsStart(_ requestGeneration: Int) -> Bool { + guard startGeneration == requestGeneration else { return false } + guard context.hasSameIdentity(as: currentContext()), !identityInvalidated else { + identityInvalidated = true + invalidate() + return false + } + return !Task.isCancelled + } + + @MainActor + private func acceptsCommand(_ operation: DroneDockCommandOperation, allowingCancellation: Bool = false) -> Bool { + guard commandGeneration == operation.generation, response?.executionBatch == operation.batch, + commandOperations[operation.command]?.requestID == operation.requestID else { return false } + guard context.hasSameIdentity(as: currentContext()), !identityInvalidated else { + identityInvalidated = true + invalidate() + return false + } + return allowingCancellation || !Task.isCancelled + } + + @MainActor + private func acceptsResummon(_ requestGeneration: Int) -> Bool { + guard resummonGeneration == requestGeneration else { return false } + guard context.hasSameIdentity(as: currentContext()), !identityInvalidated else { + identityInvalidated = true + invalidate() + return false + } + return !Task.isCancelled + } + + private func markResummonUnknown(reason: String? = nil) { + resummonOutcomeUnknown = true + resummonErrorMessage = (reason.map { "\($0)。" } ?? "") + "重新召唤结果待核对,请刷新任务状态,勿重复提交" + recordTaskEvent("resummon.outcome_unknown") + } + + /// shoot 顶层 task_id 是实际航线任务 ID;只核对明确的订单任务身份,不混淆两种任务。 + private func matchesResummonReceipt(_ value: DroneDockShootResponse) throws -> Bool { + guard let json = value.dataJSON else { return true } + let data = Data(json.utf8) + guard case .object = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: data) else { return true } + let identity = try JSONDecoder().decode(DroneDockResummonReceiptIdentity.self, from: data) + return (identity.orderFlightTaskID == nil || identity.orderFlightTaskID == taskID) + && (identity.orderFlightTask?.id == nil || identity.orderFlightTask?.id == taskID) + && (identity.orderFlightTask?.orderNumber == nil || identity.orderFlightTask?.orderNumber == order.orderNumber) + && (identity.orderFlightTask?.scenicID == nil || identity.orderFlightTask?.scenicID == context.scenicID) + && (identity.planeID == nil || identity.planeID == response?.currentPlane?.id) + } + + private func markStartUnknown(reason: String? = nil) { + startOutcomeUnknown = true + startErrorMessage = (reason.map { "\($0)。" } ?? "") + "开始拍摄结果待核对,请刷新任务状态,勿重复提交" + recordTaskEvent("start.outcome_unknown") + } + + private func matchesIdentity(_ value: DroneDockShootingResponse) -> Bool { + let taskIDs = [value.orderFlightTaskID, value.orderFlightTask?.id, value.task?.id].compactMap { $0 } + let orderNumbers = [value.orderNumber, value.orderFlightTask?.orderNumber, + value.task?.orderNumber, value.header?.orderNumber].compactMap { $0 } + let scenicIDs = [value.scenic?.id, value.orderFlightTask?.scenicID, + value.task?.scenicID, value.planeStatus?.scenicID].compactMap { $0 } + return taskIDs.allSatisfy { $0 == taskID } + && orderNumbers.allSatisfy { $0 == order.orderNumber } + && scenicIDs.allSatisfy { $0 == context.scenicID } + } + + /// 手动或保护返航独立于拍摄结果,不能被普通失败摘要隐藏,也不升级为成功。 + private var isInterruptedReturn: Bool { + ["manual", "abnormal"].contains(response?.flightControl?.returnReason ?? "") + || response?.orderFlightTask?.resultCode == "return_home" + || response?.task?.resultCode == "return_home" + || response?.ui?.phase == "returning_home" + } + + /// 缺任务身份、版本或未知任务枚举的快照可只读展示,不能作为控制指令的授权依据。 + private var hasControlSnapshotIdentity: Bool { + guard let response, (response.stateVersion ?? 0) > 0, (response.executionBatch ?? 0) > 0, + response.orderFlightTaskID == taskID || response.orderFlightTask?.id == taskID || response.task?.id == taskID else { return false } + return matchesIdentity(response) + } + + /// 开拍仍要求已知任务业务态;紧急控制只依赖有效设备身份和逐项飞控许可。 + private var hasKnownShootingTaskState: Bool { + let statuses = [response?.task?.status, response?.orderFlightTask?.status].compactMap { $0 } + return !statuses.isEmpty && statuses.allSatisfy { [10, 20, 25, 30, 40, 50, 60].contains($0) } + } + + private func resolvedDisplayPhase() -> (DroneDockTaskDisplayPhase, Bool) { resolvedDevicePhase() } + + /// 先校验业务冲突,再用同批次设备状态覆盖暂停和中断返航;正常录制完成单独保留。 + private func resolvedDevicePhase() -> (DroneDockTaskDisplayPhase, Bool) { + let business = resolvedBusinessPhase() + guard let response else { return business } + let tasks = [response.task, response.orderFlightTask].compactMap { $0 } + let statuses = Set(tasks.compactMap(\.status)) + if statuses.contains(50) || statuses.contains(60) || tasks.contains(where: { $0.waylineStatus == 90 }) { + return (.blocked, false) + } + guard let control = response.flightControl else { + return isInterruptedReturn ? (.unknown, false) : business + } + if statuses.count > 1 { return (.unknown, true) } + if isInterruptedReturn && control.returnReason == "normal_complete" { return (.unknown, true) } + let recorded = [.postShootUploading, .postShootUploadFailed, .completed].contains(business.0) + && !isInterruptedReturn && !business.1 + switch flightControlState { + case .starting: + return business.0 == .navigating && !business.1 ? business : (.unknown, true) + case .unknown: + // 飞控暂缺不抹掉已明确的业务进度,操作许可仍需单独的可信飞控数据。 + return recorded || [.navigating, .ready, .shooting].contains(business.0) ? business : (.unknown, false) + case .returned: + if isInterruptedReturn { + guard !statuses.contains(30), !statuses.contains(25) else { return (.unknown, true) } + return (.returned, false) + } + if recorded || business.0 == .failed { return business } + return (.unknown, true) + case .returning: + if isInterruptedReturn { + guard !statuses.contains(30), !statuses.contains(25) else { return (.unknown, true) } + return (.returning, false) + } + if recorded && control.returnReason == "normal_complete" { return business } + return (.unknown, true) + case .paused: + guard ["going_to_spot", "arrived_pending_start", "shooting", "returning"].contains(control.resumePhase ?? "") else { + return (.unknown, false) + } + if isInterruptedReturn { + guard control.resumePhase == "returning", !statuses.contains(30), !statuses.contains(25) else { + return (.unknown, true) + } + return (.paused, false) + } + if isRecordingFinished && control.returnReason == "normal_complete" && control.resumePhase == "returning" { + return (.paused, false) + } + guard !business.1, [.navigating, .ready, .shooting, .paused, .blocked, .failed].contains(business.0) else { return business } + return (.paused, false) + case .executing: + if isInterruptedReturn { return (.unknown, true) } + // 执行态不是到达证据,正常业务进度仍由 ui.phase 和开拍门禁共同决定。 + return business + } + } + + /// 重进页也展示服务端当前指令的等待,仅识别已知且有唯一标识的动作。 + private var remotePendingCommand: DroneDockSafetyCommand? { + guard let control = response?.flightControl, control.executionBatch == response?.executionBatch, + let progress = control.pendingCommand, progress.status == "pending", + let id = usable(progress.commandID), !supersededCommandIDs.contains(id), + let command = progress.command.flatMap(DroneDockSafetyCommand.init(rawValue:)) else { return nil } + return command + } + + private func progressMatches(_ progress: DroneDockCommandProgress, operation: DroneDockCommandOperation) -> Bool { + guard progress.command == operation.command.rawValue, + progress.clientRequestID == nil || progress.clientRequestID == operation.requestID, + progress.commandID == nil || operation.commandID == nil || progress.commandID == operation.commandID else { return false } + return progress.clientRequestID == operation.requestID || (operation.commandID != nil && progress.commandID == operation.commandID) + } + + private func applyCommandProgress(_ progress: DroneDockCommandProgress, command: DroneDockSafetyCommand) { + let previousPhase = commandOperations[command]?.phase + defer { + if let operation = commandOperations[command], previousPhase != operation.phase { + recordCommandEvent("command.progress_changed", operation: operation, + fields: ["previous_phase": previousPhase.map { String(describing: $0) } ?? "none", + "server_progress": DroneDockTaskTraceFields.progress(progress)]) + } + } + switch progress.status { + case "pending": + if commandOperations[command]?.phase != .confirmed { commandOperations[command]?.phase = .pending } + case "succeeded": + if let id = progress.commandID { supersededCommandIDs.insert(id) } + commandOperations[command]?.phase = .confirmed + commandOperations[command]?.error = nil + case "superseded": + if let id = progress.commandID { supersededCommandIDs.insert(id) } + commandOperations[command]?.phase = .finished + commandOperations[command]?.error = nil + case "failed": + if let id = progress.commandID { supersededCommandIDs.insert(id) } + commandOperations[command]?.phase = .finished + commandOperations[command]?.error = usable(progress.message) ?? "安全指令执行失败,请核对设备状态" + default: break + } + } + + /// 匹配本次 command_id/幂等键的进度优先;无进度样例仅由更新的明确设备状态核对。 + private func reconcilePendingCommand() { + guard let response, let batch = response.executionBatch, let version = response.stateVersion else { return } + for (command, operation) in commandOperations where operation.batch == batch && operation.isWaiting { + if let progress = response.flightControl?.pendingCommand, progressMatches(progress, operation: operation) { + commandOperations[command]?.commandID = progress.commandID ?? operation.commandID + applyCommandProgress(progress, command: command) + if commandOperations[command]?.phase != .confirmed { continue } + } + guard version > operation.submittedVersion, version >= (operation.minimumVersion ?? 0), + commandOperations[command]?.commandID != nil, + response.flightControl?.pendingCommand == nil || commandOperations[command]?.phase == .confirmed else { continue } + let confirmed: Bool + switch command { + case .pause: confirmed = flightControlState == .paused + case .resume: + confirmed = operation.resumePhase == "returning" ? flightControlState == .returning + : flightControlState == .executing && response.ui?.phase == operation.resumePhase + case .returnHome: confirmed = flightControlState == .returned + case .cancelReturn: confirmed = false + } + if confirmed || flightControlState == .returned { + commandOperations[command]?.phase = .finished + recordCommandEvent("command.snapshot_confirmed", operation: operation, + fields: ["confirmed_flight_state": flightControlState.rawValue, + "confirmed_ui_phase": DroneDockTaskTraceFields.value(response.ui?.phase)]) + } + } + } + + /// 指令日志同时记录提交时与当前批次,便于识别旧回执、被替代动作和按钮等待原因。 + private func recordCommandEvent(_ event: String, operation: DroneDockCommandOperation, + fields: [String: Any] = [:]) { + let current = commandOperations[operation.command] + let summary: [String: Any] = ["command": operation.command.rawValue, + "client_request_id": operation.requestID, "command_id": DroneDockTaskTraceFields.value(current?.commandID ?? operation.commandID), + "submitted_batch": operation.batch, "submitted_version": operation.submittedVersion, + "command_sequence": operation.sequence, "submitted_plane_id": operation.planeID, + "submitted_airport_sn": DroneDockTaskTraceFields.value(operation.airportSN), + "operation_phase": current.map { String(describing: $0.phase) } ?? "discarded", + "button_loading": isCommandLoading(operation.command), + "button_allowed": canSendCommand(operation.command), + "command_error": DroneDockTaskTraceFields.value(current?.error)] + recordTaskEvent(event, fields: summary.merging(fields) { _, new in new }) + } + + private func clearPendingCommand() { + commandOperations.removeAll() + supersededCommandIDs.removeAll() + } + + /// 按任务终态、明确 UI 阶段与航线失败判断,不把机巢忙闲或订单执行中当作拍摄进度。 + private func resolvedBusinessPhase() -> (DroneDockTaskDisplayPhase, Bool) { + guard let response else { return (.unknown, false) } + let tasks = [response.task, response.orderFlightTask].compactMap { $0 } + let statuses = Set(tasks.compactMap(\.status)) + let waylines = Set(tasks.compactMap(\.waylineStatus)) + let rawPhase = usable(response.ui?.phase) + if statuses.contains(50) || waylines.contains(90) || statuses.contains(60) { return (.blocked, false) } + if tasks.contains(where: { $0.resultCode == "return_home" }) { return (.failed, false) } + if !waylines.isDisjoint(with: [29, 39, 49, 91]) || statuses.contains(40) { + let isMediaFailure = rawPhase == "post_shoot_upload_failed" + || (hasMediaProcessingFailure && rawPhase != "failed_restartable") + return (isMediaFailure ? .postShootUploadFailed : .failed, false) + } + if statuses.count > 1 { return (.unknown, true) } + let known: [String: DroneDockTaskDisplayPhase] = [ + "going_to_spot": .navigating, "failed_restartable": .failed, "waiting_summon": .blocked, + "navigating": .navigating, "arrived_pending_start": .ready, "shooting": .shooting, + "post_shoot_uploading": .postShootUploading, + "post_shoot_upload_failed": .postShootUploadFailed, + "manual_paused": .paused, "returning_home": .returning, "completed": .completed, "failed": .failed, "blocked": .blocked + ] + let phase = rawPhase.flatMap { known[$0] } + if rawPhase != nil && phase == nil { return (.unknown, false) } + if phase == .failed { return (.failed, false) } + if statuses.contains(30) { + if phase == .returning { return (.returning, false) } + if let phase, [.navigating, .ready, .shooting, .postShootUploading, .postShootUploadFailed, .paused].contains(phase) { return (.unknown, true) } + return (.completed, false) + } + if phase == .completed { + return statuses.isEmpty ? (.completed, false) : (.unknown, true) + } + if phase == .ready, response.executeGate?.canExecute == true { + if let action = usable(response.executeGate?.primaryAction), action != "start_shoot" { + return (.unknown, true) + } + } + return (phase ?? .unknown, false) + } + + private func presentationTitle(for phase: DroneDockTaskDisplayPhase, conflict: Bool) -> String { + if conflict { return "状态待确认" } + switch phase { + case .loading: return "正在获取任务状态" + case .readError: return "任务状态读取失败" + case .navigating: return "无人机正在赶来" + case .ready: return "无人机已到达" + case .shooting: return "无人机正在拍摄中" + case .postShootUploading, .completed: return "拍摄已完成" + case .postShootUploadFailed: return mediaFailureTitle + case .paused: return "无人机已暂停" + case .returning: return "无人机正在返航" + case .returned: return "本次拍摄已中断" + case .failed: return "任务执行失败" + case .blocked: + if isTaskAwaitingConfirmation { return "任务待确认" } + let tasks = [response?.task, response?.orderFlightTask].compactMap { $0 } + if tasks.contains(where: { $0.status == 50 || $0.waylineStatus == 90 }) { return "任务已取消" } + if response?.ui?.phase == "arrived_pending_start" { return "暂不可开始拍摄" } + return "当前任务暂不可执行" + case .unknown: return "状态待确认" + } + } + + private func usable(_ value: String?) -> String? { DroneDockHomeMetric.usableText(value) } + + /// 明确失败后优先展示任务结果原因,再保留执行门禁的实际限制,不用通用阶段标题充当原因。 + private var failureMessage: String { + usable(response?.orderFlightTask?.resultMessage) ?? usable(response?.task?.resultMessage) + ?? usable(response?.executeGate?.message) ?? usable(response?.ui?.message) ?? "暂未返回具体失败原因" + } + + /// 39/49 表示录制后的素材处理失败,不能据此生成起飞或重召唤许可。 + private var hasMediaProcessingFailure: Bool { + [response?.task?.waylineStatus, response?.orderFlightTask?.waylineStatus] + .compactMap { $0 }.contains { [39, 49].contains($0) } + } + + private var isTaskAwaitingConfirmation: Bool { + response?.orderFlightTask?.status == 60 || response?.task?.status == 60 + } + + private var mediaFailureTitle: String { + return [response?.task?.waylineStatus, response?.orderFlightTask?.waylineStatus].contains(49) + ? "素材渲染失败" : "素材上传失败" + } + + private var mediaFailureMessage: String { + usable(response?.orderFlightTask?.resultMessage) ?? usable(response?.task?.resultMessage) + ?? usable(response?.ui?.message) ?? usable(response?.task?.waylineStatusLabel) + ?? usable(response?.orderFlightTask?.waylineStatusLabel) ?? "素材处理失败,请前往素材库查看。" + } + + /// 工作态优先;工作态缺失或未识别时才用飞机表在线标记保守兜底。 + private var isResummonDeviceOffline: Bool { + switch response?.currentPlane?.workStatus { + case 0: return true + case 1, 2: return false + default: + if let online = response?.currentPlane?.onlineStatus { return online != 1 } + return usable(response?.currentPlane?.workStatusLabel) == "离线" + } + } + + /// 设备断连、离线或忙碌时禁用重召唤,不从显示文案推导设备可用性。 + private var isResummonDeviceUnavailable: Bool { + let plane = response?.currentPlane + return response?.planeStatus?.connected == false || isResummonDeviceOffline || plane?.workStatus == 2 + } + + /// 正式入口未注入操作服务时说明当前限制;模拟页保留实际设备不可用原因。 + private var retryUnavailableNote: String { + let plane = response?.currentPlane + if isResummonDeviceOffline { + return "无人机离线,暂不可召唤" + } + if plane?.workStatus == 2 { return "无人机忙碌,暂不可召唤" } + if let status = usable(plane?.workStatusLabel), ["返航中", "正在返航"].contains(status) { + return "无人机返航中,暂不可召唤" + } + if flightControlState != .returned { return "等待设备确认已返回机巢后再重新召唤" } + return usable(response?.restartGate?.message) ?? "暂不可重新召唤,请返回准备页确认设备状态" + } +} + +/// 任务页六项读数的后端展示文本,保持服务端单位与零值。 +struct DroneDockShootingTelemetry: Equatable, Sendable { + /// 电量读数。 + let batteryText: String + /// 环境温度读数。 + let temperatureText: String + /// 风速读数。 + let windText: String + /// 雨量读数。 + let rainText: String + /// 信号状态。 + let signalText: String + /// 搜星状态。 + let satelliteText: String +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneDockViewModels.swift b/suixinkan/Features/DroneDock/ViewModels/DroneDockViewModels.swift new file mode 100644 index 0000000..60752e2 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneDockViewModels.swift @@ -0,0 +1,314 @@ +import Foundation + +/// 机巢工作台、订单、准备和任务页面共享的本地数据源;不请求接口或自动推进任务。 +final class DroneDockDemoStore { + /// 当前登录用户与景区范围。 + private(set) var context: DroneDockContext + + private var ordersByContext: [DroneDockContext: [DroneShootingOrder]] = [:] + private var devicesByContext: [DroneDockContext: [DroneDockDevice]] = [:] + + /// 按上下文与订单保存的点位、航线和人工选择。 + var shootingPreparations: [DroneShootingSessionKey: DroneShootingPreparationState] = [:] + /// 当前或最近一次本地任务;飞行结束后仍保留结果页快照。 + var shootingSessions: [DroneShootingSessionKey: DroneShootingSession] = [:] + /// 原素材和本机演示下载结果按上下文、订单隔离,页面重进时仍可读取。 + var materialLibraries: [DroneShootingSessionKey: DroneMaterialLibraryState] = [:] + /// 成片上传和整单确认快照按上下文、订单隔离,不与原素材下载共用状态。 + var deliveryLibraries: [DroneShootingSessionKey: DroneDeliveryLibraryState] = [:] + #if DEBUG + /// 预览切换前的订单,恢复正常场景时不累计演示扣次。 + var shootingScenarioBaselines: [DroneShootingSessionKey: DroneShootingOrder] = [:] + #endif + + /// 注入初始上下文及可选数据,便于页面演示与独立规则测试。 + init( + context: DroneDockContext = .demo, + orders: [DroneShootingOrder]? = nil, + devices: [DroneDockDevice]? = nil + ) { + self.context = context + ordersByContext[context] = orders ?? DroneDockDemoData.orders(context: context) + devicesByContext[context] = devices ?? DroneDockDemoData.devices() + } + + /// 只向页面提供当前用户在当前景区的订单。 + var orders: [DroneShootingOrder] { + (ordersByContext[context] ?? []).filter { + $0.scenicID == context.scenicID && $0.assignedUserID == context.userID + } + } + + /// 当前景区的无人机,不将横向浏览等同于执行资源选择。 + var devices: [DroneDockDevice] { devicesByContext[context] ?? [] } + + /// 读取当前用户、当前景区内的指定订单。 + func shootingOrder(id: String) -> DroneShootingOrder? { orders.first { $0.id == id } } + + /// 写回一个已校验归属的本地订单,使工作台与列表主动刷新时得到相同结果。 + func replaceShootingOrder(_ order: DroneShootingOrder) { + guard order.scenicID == context.scenicID, order.assignedUserID == context.userID, + let index = ordersByContext[context]?.firstIndex(where: { $0.id == order.id }) else { return } + ordersByContext[context]?[index] = order + } + + /// 更新本地执行资源状态;仅使用明确状态,不从电量或卡片浏览位置推导许可。 + func setShootingDeviceState(_ state: DroneDockDeviceState, telemetry: DroneDockTelemetry? = nil) { + guard let device = devices.first else { return } + devicesByContext[context]?[0] = DroneDockDevice( + id: device.id, name: device.name, state: state, telemetry: telemetry ?? device.telemetry + ) + } + + /// 当前演示上下文的今日统计;空场景不保留误导的数值。 + var statistics: DroneDockDailyStatistics { + orders.isEmpty + ? DroneDockDailyStatistics(orderCount: 0, revenueText: "¥0", successfulShootingCount: 0) + : DroneDockDailyStatistics(orderCount: 12, revenueText: "¥1,896", successfulShootingCount: 9) + } + + /// 更换范围并保留旧范围中的本地任务,切回后仍可查看。 + func switchContext(to context: DroneDockContext) { + if ordersByContext[context] == nil { + ordersByContext[context] = DroneDockDemoData.orders(context: context) + devicesByContext[context] = DroneDockDemoData.devices() + } + self.context = context + } + + #if DEBUG + /// 只在 Debug 提供场景切换;不会触发扣次、真实设备或网络操作。 + func applyScenario(_ scenario: DroneDockDemoScenario) { + shootingPreparations = shootingPreparations.filter { $0.key.context != context } + shootingSessions = shootingSessions.filter { $0.key.context != context } + shootingScenarioBaselines = shootingScenarioBaselines.filter { $0.key.context != context } + materialLibraries = materialLibraries.filter { $0.key.context != context } + deliveryLibraries = deliveryLibraries.filter { $0.key.context != context } + var orders = DroneDockDemoData.orders(context: context) + var devices = DroneDockDemoData.devices() + switch scenario { + case .standard: break + case .singleDevice: devices = Array(devices.prefix(1)) + case .unknownTelemetry: + devices = [DroneDockDevice(id: "demo-unknown", name: "01号无人机", state: .unknown, telemetry: .unknown)] + case .noDevices: devices = [] + case .emptyOrders: orders = [] + case .completedReturning: + let index = 4 + orders[index] = DroneDockDemoData.withTask( + orders[index], phase: .returning, shootingResult: .succeeded + ) + default: + if let phase = scenario.taskPhase { + orders[2] = DroneDockDemoData.withTask( + orders[2], phase: phase, + shootingResult: phase == .returning || phase == .returnPaused ? .succeeded : .inProgress + ) + } + } + ordersByContext[context] = orders + devicesByContext[context] = devices + } + #endif +} + +/// 工作台的展示规则:仅余次订单、当前任务置顶,多设备只作展示。 +final class DroneDockWorkbenchViewModel { + /// 页面共享数据源,进入订单列表时传递同一实例。 + let store: DroneDockDemoStore + /// 当前用户与景区。 + var context: DroneDockContext { store.context } + /// 首页可见订单,不包含零次但尚在返航的订单。 + private(set) var orders: [DroneShootingOrder] = [] + /// 当前景区的设备列表。 + private(set) var devices: [DroneDockDevice] = [] + /// 今日统计摘要。 + private(set) var statistics = DroneDockDailyStatistics(orderCount: 0, revenueText: "¥0", successfulShootingCount: 0) + /// 当前用户全部订单数量,含已完成。 + var allOrderCount: Int { store.orders.count } + /// 首页实际可拍摄订单数量。 + var orderCount: Int { orders.count } + + /// 读取本地初始数据。 + init(store: DroneDockDemoStore = DroneDockDemoStore()) { + self.store = store + refresh() + } + + /// 在出现、返回或切换展示场景后主动刷新,不创建或取消任务。 + func refresh() { + orders = DroneShootingOrderSorter.activeFirst(store.orders.filter { $0.remainingShootingCount > 0 }) + devices = store.devices + statistics = store.statistics + } + + /// 返回当前范围中的订单,避免使用过期卡片跨景区跳转。 + func order(id: String) -> DroneShootingOrder? { + orders.first { $0.id == id } + } + + /// 切换景区并刷新展示;原景区数据保持不变。 + func switchContext(to context: DroneDockContext) { + store.switchContext(to: context) + refresh() + } + + #if DEBUG + /// 应用仅本地有效的验收场景。 + func applyScenario(_ scenario: DroneDockDemoScenario) { + store.applyScenario(scenario) + refresh() + } + #endif +} + +/// 我的拍摄订单展示逻辑;筛选按履约状态,不受上传、交付或返航干扰。 +final class DroneShootingOrdersViewModel { + /// 与工作台共享的数据源。 + let store: DroneDockDemoStore + /// 当前范围。 + var context: DroneDockContext { store.context } + /// 当前选中的 Tab;支付成功入口可显式传入 pending。 + private(set) var selectedFilter: DroneShootingOrderFilter + /// 当前 Tab 下的订单。 + private(set) var orders: [DroneShootingOrder] = [] + /// 当前列表的标题。 + var listTitle: String { selectedFilter.listTitle } + + /// 初始化明确的入口 Tab,普通查看全部默认 all。 + init(store: DroneDockDemoStore = DroneDockDemoStore(), initialFilter: DroneShootingOrderFilter = .all) { + self.store = store + selectedFilter = initialFilter + refresh() + } + + /// 进入页面时主动读取数据,不改变任务和计数。 + func refresh() { + orders = DroneShootingOrderSorter.activeFirst(store.orders.filter(selectedFilter.includes)) + } + + /// 用户切换 Tab。 + func selectFilter(_ filter: DroneShootingOrderFilter) { + selectedFilter = filter + refresh() + } + + /// 返回指定 Tab 下当前用户的订单数量。 + func count(for filter: DroneShootingOrderFilter) -> Int { + store.orders.filter(filter.includes).count + } + + /// 获取当前显示订单,过滤失效卡片操作。 + func order(id: String) -> DroneShootingOrder? { + orders.first { $0.id == id } + } +} + +/// 稳定地将当前任务置顶,其余顺序延续数据源。 +private enum DroneShootingOrderSorter { + static func activeFirst(_ orders: [DroneShootingOrder]) -> [DroneShootingOrder] { + orders.filter { $0.activeTask != nil } + orders.filter { $0.activeTask == nil } + } +} + +/// 本地 UI 展示夹具,不使用远程图片或任何真实接口。 +private enum DroneDockDemoData { + static func devices() -> [DroneDockDevice] { + [ + device(1, .ready, 95, 19.3, 0, 36), + device(2, .occupied, 72, 20.1, 1.2, 32), + DroneDockDevice(id: "demo-device-3", name: "03号无人机", state: .disconnected, telemetry: .unknown), + device(4, .lowBattery, 18, 19.8, 0.6, 34), + device(5, .ready, 88, 20.3, 0.8, 35), + DroneDockDevice( + id: "demo-device-6", name: "06号无人机", state: .noSignal, + telemetry: DroneDockTelemetry( + batteryPercent: nil, temperatureCelsius: nil, windSpeed: nil, + rainDescription: nil, signalDescription: "无信号", satelliteCount: nil + ) + ) + ] + } + + private static func device( + _ number: Int, _ state: DroneDockDeviceState, _ battery: Int, + _ temperature: Double, _ wind: Double, _ satellites: Int + ) -> DroneDockDevice { + DroneDockDevice( + id: "demo-device-\(number)", name: String(format: "%02d号无人机", number), state: state, + telemetry: DroneDockTelemetry( + batteryPercent: battery, temperatureCelsius: temperature, windSpeed: wind, + rainDescription: "无雨", signalDescription: "良好", satelliteCount: satellites + ) + ) + } + + static func orders(context: DroneDockContext) -> [DroneShootingOrder] { + [ + order(context, 1, "158****8888", 5, 3, .uploading), + order(context, 2, "136****2806", 1, 0, .none), + order(context, 3, "139****5192", 5, 2, .failed), + order(context, 4, "137****6628", 5, 5, .ready), + order(context, 5, "180****4075", 1, 1, .uploading), + order(context, 6, "185****5736", 5, 5, .ready, delivered: 2, confirmation: .awaitingConfirmation), + order(context, 7, "188****3160", 5, 5, .ready, delivered: 3, confirmation: .confirmed), + order(context, 8, "135****2026", 3, 3, .partiallyReady) + ] + } + + private static func order( + _ context: DroneDockContext, _ number: Int, _ phone: String, + _ total: Int, _ successful: Int, _ material: DroneShootingMaterialState, + delivered: Int = 0, confirmation: DroneVisitorConfirmationState = .none + ) -> DroneShootingOrder { + DroneShootingOrder( + id: "\(context.scenicID)-\(context.userID)-order-\(number)", + scenicID: context.scenicID, assignedUserID: context.userID, + customerName: "游客\(phone)", orderNumber: String(format: "HT2026102000%02d", number), + createdAtText: "10-20 \(14 - number):18", packageName: total == 1 ? "单次航拍" : "航拍套餐", + totalShootingCount: total, successfulShootingCount: successful, activeTask: nil, + needsRepreparation: false, materialState: material, deliveredVideoCount: delivered, + visitorConfirmationState: confirmation + ) + } + + static func withTask( + _ order: DroneShootingOrder, phase: DroneShootingTaskPhase, shootingResult: DroneShootingResult + ) -> DroneShootingOrder { + DroneShootingOrder( + id: order.id, scenicID: order.scenicID, assignedUserID: order.assignedUserID, + customerName: order.customerName, orderNumber: order.orderNumber, createdAtText: order.createdAtText, + packageName: order.packageName, totalShootingCount: order.totalShootingCount, + successfulShootingCount: order.successfulShootingCount, + activeTask: DroneShootingTask(id: "\(order.id)-task", phase: phase, shootingResult: shootingResult), + needsRepreparation: order.needsRepreparation, materialState: order.materialState, + deliveredVideoCount: order.deliveredVideoCount, visitorConfirmationState: order.visitorConfirmationState + ) + } +} + +#if DEBUG +/// 仅供 Debug 页面验收的状态集合,不会编译进正式版入口。 +enum DroneDockDemoScenario: String, CaseIterable { + case standard, singleDevice, unknownTelemetry, noDevices, emptyOrders + case navigating, arrived, shooting, shootingPaused, returning, returnPaused, unconfirmed, completedReturning + + /// 状态选择菜单文案。 + var title: String { + switch self { + case .standard: "默认数据 · 多架无人机" + case .singleDevice: "单架无人机" + case .unknownTelemetry: "遥测未知" + case .noDevices: "暂无无人机" + case .emptyOrders: "暂无订单" + case .completedReturning: "次数用完 · 仍在返航" + default: taskPhase?.title ?? "默认数据" + } + } + + /// 该演示场景对应的未结束任务阶段。 + var taskPhase: DroneShootingTaskPhase? { + DroneShootingTaskPhase(rawValue: rawValue) + } +} +#endif diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneMaterialsViewModel.swift b/suixinkan/Features/DroneDock/ViewModels/DroneMaterialsViewModel.swift new file mode 100644 index 0000000..ebf9ff3 --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneMaterialsViewModel.swift @@ -0,0 +1,399 @@ +import Foundation + +/// 订单原素材的分组、选择和前台下载规则;由 View 在明确事件后主动刷新。 +final class DroneMaterialsViewModel { + /// 与工作台、任务和订单列表共用的本地数据源。 + let store: DroneDockDemoStore + /// 入口订单的固定标识。 + let orderID: String + /// 任务入口固定点位,整单入口为 nil。 + let pointID: String? + /// 当前整单筛选;固定点位入口不能切换为其他点位。 + private(set) var selectedFilterID: String? + /// 当前筛选范围中的人工选择,切换筛选时清空。 + private(set) var selectedIDs: Set = [] + private let context: DroneDockContext + + /// 当前上下文可访问的订单,旧页面不能操作其他景区的同名订单。 + var order: DroneShootingOrder? { isCurrentContext ? store.shootingOrder(id: orderID) : nil } + /// 列表状态,不与素材上传失败混用。 + var listState: DroneMaterialsListState { library?.listState ?? .loaded } + /// 当前演示保存许可,不代表系统真实 Photos 权限。 + var photoPermission: DroneMaterialPhotoPermission { library?.photoPermission ?? .denied } + /// 固定于批次开始时的素材范围及执行令牌。 + var batch: DroneMaterialDownloadBatch? { library?.batch } + /// 当前点位范围下按拍摄时间从新到旧排列的记录。 + var sections: [DroneMaterialRecord] { + guard listState == .loaded else { return [] } + return allRecords.filter { selectedFilterID == nil || $0.pointID == selectedFilterID } + } + /// 整单入口提供全部点位,任务入口只展示限定点位。 + var filters: [DroneMaterialPointFilter] { + if let pointID { + let name = allRecords.first { $0.pointID == pointID }?.pointName + ?? store.shootingPreparations[key]?.points.first { $0.id == pointID }?.name ?? "当前拍摄点" + return [DroneMaterialPointFilter(id: pointID, title: name)] + } + var seen: Set = [] + return [DroneMaterialPointFilter(id: nil, title: "全部点位")] + allRecords.compactMap { + guard seen.insert($0.pointID).inserted else { return nil } + return DroneMaterialPointFilter(id: $0.pointID, title: $0.pointName) + } + } + /// 当前列表已上传且未完成的可选择素材,不包括其他筛选中的文件。 + var downloadableIDs: Set { Set(sections.flatMap(\.materials).filter(\.canDownload).map(\.id)) } + /// 当前有效的勾选项数量。 + var selectedCount: Int { selectedIDs.count } + /// 可下载项非空且全部被选中时才显示全选标记。 + var isAllSelected: Bool { !downloadableIDs.isEmpty && downloadableIDs.isSubset(of: selectedIDs) } + /// 批次未清除前锁定筛选和选择,继续选择入口明确结束旧批次。 + var isSelectionLocked: Bool { batch != nil } + /// 是否可创建一个新的本地演示批次;拒权仍允许按钮展示权限说明。 + var canStartDownload: Bool { order != nil && listState == .loaded && batch == nil && !isSelectionLocked && selectedCount > 0 } + /// 当前筛选下可预览素材;预览不会修改勾选或下载生命周期。 + var previewMaterials: [DroneMaterial] { sections.flatMap(\.materials).filter(\.canPreview) } + /// 本批次固定文件数。 + var batchTotalCount: Int { batch?.itemIDs.count ?? 0 } + /// 本批次真实或演示完成的数量,不把仅下载完成计作保存完成。 + var completedCount: Int { batchMaterials.filter { $0.downloadState.isCompleted }.count } + /// 本批次明确下载失败或保存失败的数量。 + var failedCount: Int { batchMaterials.filter { $0.downloadState.isFailed }.count } + /// 未完成且没有明确失败的文件数,继续时只处理这些文件。 + var pendingCount: Int { batchMaterials.filter { !$0.downloadState.isCompleted && !$0.downloadState.isFailed }.count } + /// 以完成文件数统计的进度,上传中不使用此进度。 + var batchProgress: Double { batchTotalCount == 0 ? 0 : Double(completedCount) / Double(batchTotalCount) } + /// 页面底部的批次阶段。 + var downloadPhase: DroneMaterialDownloadPhase { + guard let batch else { return .idle } + if batch.isPaused && pendingCount > 0 { return .paused } + if batchMaterials.contains(where: { if case .downloading = $0.downloadState { return true }; return false }) { return .downloading } + if batchMaterials.contains(where: { $0.downloadState == .saving }) { return .saving } + if batchMaterials.contains(where: { $0.downloadState == .awaitingSave }) { return .awaitingSave } + if failedCount > 0 { return .partialFailure } + return completedCount == batchTotalCount ? .completed : .idle + } + /// 主操作的标题,演示成功与真实保存始终区分。 + var downloadButtonTitle: String { + switch downloadPhase { + case .idle: "下载所选素材" + case .downloading, .awaitingSave, .saving: "演示下载中…" + case .paused: "继续下载" + case .partialFailure: "仅重试失败项" + case .completed: "继续选择素材" + } + } + /// 记录区数量摘要。 + var summaryText: String { "\(sections.count)次拍摄 · 最新在前" } + /// 页面标题。 + var title: String { "订单素材库" } + + private var isCurrentContext: Bool { store.context == context } + private var key: DroneShootingSessionKey { DroneShootingSessionKey(context: context, orderID: orderID) } + private var library: DroneMaterialLibraryState? { order != nil ? store.materialLibraries[key] : nil } + private var allRecords: [DroneMaterialRecord] { + (library?.records ?? []).sorted { + if $0.capturedAt == $1.capturedAt { return $0.sequenceNumber > $1.sequenceNumber } + return $0.capturedAt > $1.capturedAt + } + } + private var batchMaterials: [DroneMaterial] { + guard let batch else { return [] } + let ids = Set(batch.itemIDs) + return allRecords.flatMap(\.materials).filter { ids.contains($0.id) } + } + + /// 固定订单及可选任务点位;首次访问只创建对应成功记录的演示素材。 + init(store: DroneDockDemoStore, orderID: String, pointID: String? = nil) { + self.store = store + self.orderID = orderID + self.pointID = pointID + selectedFilterID = pointID + context = store.context + refresh() + } + + /// 页面出现或手动刷新时同步本地记录;不会自动完成上传或恢复暂停下载。 + func refresh() { + guard isCurrentContext, let order else { + pauseStoredBatch(reason: .leavingPage) + selectedIDs = [] + return + } + store.ensureShootingPreparation(orderID: orderID) + var state = store.materialLibraries[key] ?? DroneMaterialLibraryState(records: []) + state.listState = .loaded + if order.successfulShootingCount > state.sourceShootingCount { + let points = store.shootingPreparations[key]?.points ?? [] + let session = store.shootingSession(orderID: orderID) + for sequence in (state.sourceShootingCount + 1)...order.successfulShootingCount { + state.records.append(Self.demoRecord(order: order, sequence: sequence, points: points, session: session)) + } + state.sourceShootingCount = order.successfulShootingCount + } + restrictBatchToEntryScope(in: &state) + store.materialLibraries[key] = state + if isSelectionLocked { + let validIDs = Set(sections.flatMap(\.materials).filter { $0.canPreview && !$0.downloadState.isCompleted }.map(\.id)) + selectedIDs.formIntersection(validIDs) + } else { + selectedIDs.formIntersection(downloadableIDs) + } + } + + /// 显式切换整单点位筛选,清空旧范围的选择;固定点位入口拒绝扩大范围。 + func selectFilter(id: String?) { + guard !isSelectionLocked, pointID == nil, filters.contains(where: { $0.id == id }) else { return } + guard selectedFilterID != id else { return } + selectedFilterID = id + selectedIDs = [] + } + + /// 勾选当前可下载素材,上传中、失败上传、完成项和隐藏项都不可选。 + func toggleSelection(id: String) { + guard !isSelectionLocked, downloadableIDs.contains(id) else { return } + if !selectedIDs.insert(id).inserted { selectedIDs.remove(id) } + } + + /// 全选只覆盖当前筛选可下载项,再次点击取消本范围选择。 + func selectAll() { + guard !isSelectionLocked else { return } + selectedIDs = isAllSelected ? [] : downloadableIDs + } + + /// 读取入口范围内素材;执行回执另按批次固定范围校验。 + func material(id: String) -> DroneMaterial? { + allRecords.filter { pointID == nil || $0.pointID == pointID }.flatMap(\.materials).first { $0.id == id } + } + + /// 创建演示下载批次;系统权限和真实照片写入由后续真实服务单独接入。 + @discardableResult + func startDownload() -> Bool { + guard canStartDownload, photoPermission.canSave, var state = library else { return false } + let ids = sections.flatMap(\.materials).map(\.id).filter { selectedIDs.contains($0) && downloadableIDs.contains($0) } + guard !ids.isEmpty else { return false } + state.batch = DroneMaterialDownloadBatch(id: UUID(), itemIDs: ids, isPaused: false, pauseReason: nil) + prepareAttempts(in: &state, ids: Set(ids), retryFailures: true) + store.materialLibraries[key] = state + return true + } + + /// 后台、锁屏或离页暂停,并使暂停前回执令牌立即失效。 + func pauseDownloads(reason: DroneMaterialPauseReason) { + guard isCurrentContext else { return } + pauseStoredBatch(reason: reason) + } + + /// 离开素材页停止未完成执行;预览弹层不应调用此入口。 + func leavePage() { pauseDownloads(reason: .leavingPage) } + + /// 回到前台只由用户手动继续;不处理失败项,不重做已完成项。 + @discardableResult + func continueDownload() -> Bool { + guard photoPermission.canSave, var state = library, let oldBatch = state.batch, + oldBatch.isPaused, pendingCount > 0 else { return false } + let ids = Set(batchMaterials.filter { !$0.downloadState.isCompleted && !$0.downloadState.isFailed }.map(\.id)) + state.batch = DroneMaterialDownloadBatch(id: UUID(), itemIDs: oldBatch.itemIDs, isPaused: false, pauseReason: nil) + prepareAttempts(in: &state, ids: ids, retryFailures: false) + store.materialLibraries[key] = state + return true + } + + /// 只重试当前批次明确失败的文件;保存失败重试保存,不重新下载。 + @discardableResult + func retryFailed() -> Bool { + guard photoPermission.canSave, var state = library, let oldBatch = state.batch, + failedCount > 0, pendingCount == 0, + !batchMaterials.contains(where: { $0.downloadState.isRunning }) else { return false } + let ids = Set(batchMaterials.filter { $0.downloadState.isFailed }.map(\.id)) + state.batch = DroneMaterialDownloadBatch(id: UUID(), itemIDs: oldBatch.itemIDs, isPaused: false, pauseReason: nil) + prepareAttempts(in: &state, ids: ids, retryFailures: true) + store.materialLibraries[key] = state + return true + } + + /// 结束已停止或已完成的批次后继续选择;已完成文件永远保留。 + func clearBatch() { + guard var state = library, !batchMaterials.contains(where: { $0.downloadState.isRunning }), + state.batch != nil else { return } + state.batch = nil + store.materialLibraries[key] = state + selectedIDs = [] + } + + /// 设置演示许可,恢复许可不自动开始;拒权与文件失败分离。 + func setPhotoPermission(_ permission: DroneMaterialPhotoPermission) { + guard var state = library else { return } + state.photoPermission = permission + store.materialLibraries[key] = state + if !permission.canSave { pauseStoredBatch(reason: .permissionDenied) } + } + + /// 接收明确本地执行回执;旧批次、其他订单、暂停状态和重复保存均被忽略。 + func receive(_ event: DroneMaterialTransferEvent, materialID: String, batchID: UUID) { + guard var state = library, let batch = state.batch, batch.id == batchID, + !batch.isPaused, batch.itemIDs.contains(materialID), photoPermission.canSave else { return } + mutateMaterials(in: &state) { material in + guard material.id == materialID, material.uploadState == .ready else { return } + switch (event, material.downloadState) { + case (.progress(let value), .downloading(let previous)): + guard value.isFinite else { return } + material.downloadState = .downloading(progress: max(previous, min(1, max(0, value)))) + case (.downloadCompleted, .downloading): material.downloadState = .awaitingSave + case (.downloadFailed(let message), .downloading): material.downloadState = .downloadFailed(message: message) + case (.saveStarted, .awaitingSave): material.downloadState = .saving + case (.saveFailed(let message), .saving): material.downloadState = .saveFailed(message: message) + case (.saveSucceeded, .saving): material.downloadState = .completed(isSimulation: true) + default: break + } + } + store.materialLibraries[key] = state + selectedIDs = selectedIDs.filter { material(id: $0)?.downloadState.isCompleted == false } + } + + private func pauseStoredBatch(reason: DroneMaterialPauseReason) { + guard var state = store.materialLibraries[key], let batch = state.batch, + batch.itemIDs.contains(where: { id in + state.records.flatMap(\.materials).contains { $0.id == id && !$0.downloadState.isCompleted && !$0.downloadState.isFailed } + }) else { return } + let ids = Set(batch.itemIDs) + mutateMaterials(in: &state) { material in + guard ids.contains(material.id) else { return } + switch material.downloadState { + case .downloading: material.downloadState = .paused + case .saving: material.downloadState = .awaitingSave + default: break + } + } + state.batch = DroneMaterialDownloadBatch(id: UUID(), itemIDs: batch.itemIDs, isPaused: true, pauseReason: reason) + store.materialLibraries[key] = state + } + + private func prepareAttempts(in state: inout DroneMaterialLibraryState, ids: Set, retryFailures: Bool) { + mutateMaterials(in: &state) { material in + guard ids.contains(material.id), material.uploadState == .ready else { return } + switch material.downloadState { + case .available, .paused: material.downloadState = .downloading(progress: 0) + case .downloadFailed where retryFailures: material.downloadState = .downloading(progress: 0) + case .saveFailed where retryFailures: material.downloadState = .awaitingSave + default: break + } + } + } + + private func restrictBatchToEntryScope(in state: inout DroneMaterialLibraryState) { + guard let pointID, let batch = state.batch else { return } + let scopeIDs = Set(state.records.filter { $0.pointID == pointID }.flatMap(\.materials).map(\.id)) + guard !Set(batch.itemIDs).isSubset(of: scopeIDs) else { return } + let originalIDs = Set(batch.itemIDs) + mutateMaterials(in: &state) { material in + guard originalIDs.contains(material.id) else { return } + switch material.downloadState { + case .downloading: material.downloadState = .paused + case .saving: material.downloadState = .awaitingSave + default: break + } + } + let scopedIDs = batch.itemIDs.filter { scopeIDs.contains($0) } + state.batch = scopedIDs.isEmpty ? nil : DroneMaterialDownloadBatch( + id: UUID(), itemIDs: scopedIDs, isPaused: true, pauseReason: .leavingPage + ) + } + + private func mutateMaterials(in state: inout DroneMaterialLibraryState, update: (inout DroneMaterial) -> Void) { + for recordIndex in state.records.indices { + for materialIndex in state.records[recordIndex].materials.indices { + update(&state.records[recordIndex].materials[materialIndex]) + } + } + } + + private static func demoRecord(order: DroneShootingOrder, sequence: Int, points: [DroneShootingPoint], session: DroneShootingSession?) -> DroneMaterialRecord { + let latestSession = sequence == order.successfulShootingCount && session?.result == .succeeded ? session : nil + let point = latestSession?.point ?? (points.isEmpty ? nil : points[(sequence - 1) % points.count]) + let pointID = point?.id ?? "demo-point-1" + let pointName = point?.name ?? "三皇寨" + let uploadState: DroneMaterialUploadState + switch order.materialState { + case .none, .uploading: uploadState = .uploading + case .partiallyReady: uploadState = sequence == order.successfulShootingCount ? .uploading : .ready + case .ready: uploadState = .ready + case .failed: uploadState = sequence == 1 ? .failed : .ready + } + let id = "\(order.id)-record-\(sequence)" + return DroneMaterialRecord(id: id, pointID: pointID, pointName: pointName, + routeName: latestSession?.route.name ?? (sequence % 2 == 0 ? "云宫环绕" : "经典航线"), + capturedAt: Date(timeIntervalSince1970: 1_792_723_000 + Double(sequence) * 1_500), + capturedAtText: "10-23 \(String(format: "%02d:%02d", 13 + sequence / 3, (sequence * 17) % 60))", + sequenceNumber: sequence, + materials: [ + DroneMaterial(id: "\(id)-photo", title: "素材\(String(format: "%02d", sequence * 2 - 1))", + previewAssetName: sequence % 2 == 0 ? "drone_demo_pagoda" : "drone_demo_tourists", uploadState: uploadState), + DroneMaterial(id: "\(id)-video", title: "素材\(String(format: "%02d", sequence * 2))", kind: .video, + previewAssetName: "drone_demo_mountain", + previewURL: Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4"), durationText: "00:03", + uploadState: order.materialState == .partiallyReady && uploadState == .uploading ? .ready : uploadState) + ]) + } + + #if DEBUG + /// 单次显式演示事件推进一个文件的一个阶段,ViewModel 不持有计时器。 + func advanceDemoDownload() { + guard let batch, !batch.isPaused, + let material = batchMaterials.first(where: { $0.downloadState.isRunning }) else { return } + let event: DroneMaterialTransferEvent + switch material.downloadState { + case .downloading: event = .downloadCompleted + case .awaitingSave: event = .saveStarted + case .saving: event = .saveSucceeded + default: return + } + receive(event, materialID: material.id, batchID: batch.id) + } + + /// 替换当前订单的本地素材验收场景,保留拍摄次数、任务与游客交付信息。 + func applyScenario(_ scenario: DroneMaterialsScenario) { + guard let order else { return } + var state = DroneMaterialLibraryState(records: [], sourceShootingCount: order.successfulShootingCount) + let points = store.shootingPreparations[key]?.points ?? [] + let session = store.shootingSession(orderID: orderID) + if order.successfulShootingCount > 0 { + state.records = (1...order.successfulShootingCount).map { Self.demoRecord(order: order, sequence: $0, points: points, session: session) } + } + mutateMaterials(in: &state) { $0.uploadState = .ready; $0.downloadState = .available } + switch scenario { + case .empty: state.records = [] + case .loading: state.listState = .loading + case .loadFailure: state.listState = .failed(message: "素材列表加载失败,请刷新重试。") + case .uploading: mutateMaterials(in: &state) { $0.uploadState = .uploading } + case .mixed: + var index = 0 + mutateMaterials(in: &state) { material in + material.uploadState = index == 1 ? .failed : (index == 3 ? .uploading : .ready) + index += 1 + } + case .permissionDenied: state.photoPermission = .denied + case .downloading, .paused, .partialFailure, .saveFailure, .completed: + let ids = state.records.filter { pointID == nil || $0.pointID == pointID }.flatMap(\.materials).map(\.id) + if !ids.isEmpty { + state.batch = DroneMaterialDownloadBatch(id: UUID(), itemIDs: ids, isPaused: scenario == .paused, + pauseReason: scenario == .paused ? .background : nil) + } + var index = 0 + mutateMaterials(in: &state) { material in + guard ids.contains(material.id) else { return } + switch scenario { + case .paused: material.downloadState = index == 0 ? .completed(isSimulation: true) : .paused + case .partialFailure: material.downloadState = index == 0 ? .completed(isSimulation: true) : .downloadFailed(message: "演示连接中断") + case .saveFailure: material.downloadState = index == 0 ? .completed(isSimulation: true) : .saveFailed(message: "演示相册写入失败") + case .completed: material.downloadState = .completed(isSimulation: true) + default: material.downloadState = index == 0 ? .completed(isSimulation: true) : .downloading(progress: 0.3) + } + index += 1 + } + case .ready: break + } + store.materialLibraries[key] = state + selectedIDs = [] + } + #endif +} diff --git a/suixinkan/Features/DroneDock/ViewModels/DroneShootingSessionViewModels.swift b/suixinkan/Features/DroneDock/ViewModels/DroneShootingSessionViewModels.swift new file mode 100644 index 0000000..131201b --- /dev/null +++ b/suixinkan/Features/DroneDock/ViewModels/DroneShootingSessionViewModels.swift @@ -0,0 +1,799 @@ +import Foundation + +/// 准备页的选择、恢复和准入规则;读取共享数据源后由 View 主动刷新。 +final class DroneShootingPreparationViewModel { + /// 与工作台、订单及任务页面共享的本地数据源。 + let store: DroneDockDemoStore + /// 固定入口订单,避免通过列表位置恢复错误任务。 + let orderID: String + private let context: DroneDockContext + + /// 当前可访问订单;切换到其他上下文时不可继续操作旧页面。 + var order: DroneShootingOrder? { isCurrentContext ? store.shootingOrder(id: orderID) : nil } + /// 按配置顺序展示,不因距离更新自动重排。 + var points: [DroneShootingPoint] { preparation?.points ?? [] } + /// 当前选择的点位。 + var selectedPoint: DroneShootingPoint? { points.first { $0.id == preparation?.selectedPointID } } + /// 所选点的航线,不包含其他点位的同名航线。 + var routes: [DroneShootingRoute] { selectedPoint.flatMap { preparation?.routesByPointID[$0.id] } ?? [] } + /// 当前有效航线,配置失效时为空。 + var selectedRoute: DroneShootingRoute? { + guard let point = selectedPoint, let id = preparation?.selectedRouteIDs[point.id] else { return nil } + return routes.first { $0.id == id } + } + /// 当前设备明确状态;其他订单执行时仍允许浏览选择。 + var deviceState: DroneDockDeviceState { + guard isCurrentContext else { return .unknown } + if store.orders.contains(where: { $0.activeTask != nil }) { return .occupied } + return store.devices.first?.state ?? .unknown + } + /// 本单已有尚未结束的任务,召唤确认处理中也保持唯一引用。 + var hasCurrentTask: Bool { order?.activeTask != nil } + /// 召唤已经提交但尚无明确回执。 + var hasPendingSummon: Bool { + guard let command = session?.commands[.summon] else { return false } + return command.status.isUnresolved + } + /// 超时只提供同步入口,不以超时当作召唤失败。 + var shouldShowSummonRefresh: Bool { session?.commands[.summon]?.status == .unconfirmed } + /// 底部唯一准入结果。 + var admission: DroneShootingAdmission { + guard let order else { return .orderUnavailable } + if hasPendingSummon { + return shouldShowSummonRefresh ? .summonUnconfirmed : .summoning + } + if hasCurrentTask { return .currentTask } + if order.remainingShootingCount == 0 { return .noQuota } + if points.isEmpty { return .noPoints } + guard let point = selectedPoint else { return .noPoint } + if routes.isEmpty { return .noRoutes } + guard selectedRoute != nil else { return .noRoute } + switch point.range { + case .outside: return .outOfRange + case .unknown: return .unknownRange + case .inside: break + } + switch deviceState { + case .ready: return .ready + case .occupied: return .occupied + case .disconnected: return .disconnected + case .noSignal: return .noSignal + case .lowBattery: return .lowBattery + case .unknown: return .unknownDevice + } + } + /// 底部连接文字,设备未知时不误报已连接。 + var connectionTitle: String { + switch deviceState { + case .disconnected: "机巢未连接" + case .unknown: "机巢连接待确认" + default: "机巢已连接" + } + } + /// 底部连接语义色。 + var connectionTone: DroneDockStatusTone { + switch deviceState { + case .disconnected, .unknown: .gray + default: .green + } + } + /// 设备与有效电量摘要,未知值不显示为零。 + var deviceStatusText: String { + let value = store.devices.first?.telemetry.batteryText ?? "—" + return value == "—" ? deviceState.title : "\(deviceState.title) · 电量 \(value)" + } + /// 当前选择的点位与航线。 + var selectionSummary: String { "\(selectedPoint?.name ?? "未选择拍摄点") · \(selectedRoute?.name ?? "未选择航线")" } + /// 主要按钮标题由准入结果统一提供。 + var primaryButtonTitle: String { admission.title } + /// 仅有效召唤或查看已确认任务允许点击。 + var primaryButtonEnabled: Bool { admission.canSummon || admission == .currentTask } + + private var isCurrentContext: Bool { store.context == context } + private var key: DroneShootingSessionKey { DroneShootingSessionKey(context: context, orderID: orderID) } + private var preparation: DroneShootingPreparationState? { isCurrentContext ? store.shootingPreparations[key] : nil } + private var session: DroneShootingSession? { isCurrentContext ? store.shootingSession(orderID: orderID) : nil } + + /// 载入指定订单的本地选择,不创建任务。 + init(store: DroneDockDemoStore, orderID: String) { + self.store = store + self.orderID = orderID + context = store.context + refresh() + } + + /// 页面出现时校验选择与当前订单;不自动补选失效航线。 + func refresh() { + guard isCurrentContext, order != nil else { return } + store.ensureShootingPreparation(orderID: orderID) + _ = store.shootingSession(orderID: orderID) + store.validateShootingSelection(orderID: orderID) + } + + /// 整卡选点;切回已选点恢复其仍有效的航线,不把上一点航线带过来。 + func selectPoint(id: String) { + guard !hasPendingSummon, var state = preparation, state.points.contains(where: { $0.id == id }) else { return } + state.selectedPointID = id + let routes = state.routesByPointID[id] ?? [] + if state.selectedRouteIDs[id] == nil { state.selectedRouteIDs[id] = routes.first?.id } + store.shootingPreparations[key] = state + store.validateShootingSelection(orderID: orderID) + } + + /// 选择本点有效航线,重复点击不取消。 + func selectRoute(id: String) { + guard !hasPendingSummon, var state = preparation, let point = selectedPoint, + routes.contains(where: { $0.id == id }) else { return } + state.selectedRouteIDs[point.id] = id + store.shootingPreparations[key] = state + } + + /// 首次只提交本地召唤并返回 false;已有明确任务时返回 true 供页面导航。 + @discardableResult + func summon() -> Bool { + refresh() + if admission == .currentTask { return true } + guard admission.canSummon, let point = selectedPoint, let route = selectedRoute else { return false } + store.beginShootingSession(orderID: orderID, point: point, route: route) + return false + } + + /// 请求同步原召唤,不自动判定设备已执行。 + func refreshSummonStatus() { + guard isCurrentContext, hasPendingSummon else { return } + store.receiveShootingEvent(.phoneConnectionChanged(.synchronizing), orderID: orderID, taskID: session?.id) + } + + #if DEBUG + /// 显式模拟设备召唤确认;确认后才进入任务页。 + @discardableResult + func confirmSummon() -> Bool { + guard isCurrentContext, let session, session.commands[.summon]?.status.isUnresolved == true else { return false } + store.receiveShootingEvent(.commandConfirmed(.summon), orderID: orderID, taskID: session.id) + store.receiveShootingEvent(.phoneConnectionChanged(.connected), orderID: orderID, taskID: session.id) + return true + } + + /// 准备页本地验收入口;不连接网络或实际设备。 + func applyScenario(_ scenario: DroneShootingPreparationScenario) { + guard isCurrentContext, order != nil else { return } + store.applyPreparationScenario(scenario, orderID: orderID) + refresh() + } + #endif +} + +/// 当前任务的展示及指令入口;提交与设备确认严格分开。 +final class DroneShootingTaskViewModel { + /// 与入口页面共享的本地数据源。 + let store: DroneDockDemoStore + /// 本次入口订单。 + let orderID: String + private let context: DroneDockContext + + /// 当前上下文仍可访问的订单。 + var order: DroneShootingOrder? { isCurrentContext ? store.shootingOrder(id: orderID) : nil } + /// 原任务或最近一次结果快照。 + var session: DroneShootingSession? { isCurrentContext ? store.shootingSession(orderID: orderID) : nil } + /// 点位与航线标题。 + var title: String { session.map { "\($0.point.name) · \($0.route.name)" } ?? "当前任务" } + /// 订单游客和次数摘要。 + var subtitle: String { order.map { "\($0.customerName) · 含\($0.totalShootingCount)次拍摄" } ?? "当前订单不可用" } + /// 手机状态未同步时隐藏过期遥测,不将未知当作零。 + var telemetry: DroneDockTelemetry { phoneConnection == .connected ? (session?.telemetry ?? .unknown) : .unknown } + /// 卡片一致的七阶段状态;手机断网时为待确认。 + var phase: DroneShootingTaskPhase? { session?.taskReference?.phase ?? session?.phase } + /// 手机网络连接。 + var phoneConnection: DroneShootingConnectionState { session?.phoneConnection ?? .disconnected } + /// 图传独立连接。 + var feedConnection: DroneShootingConnectionState { session?.feedConnection ?? .disconnected } + /// 当前待处理或明确拒绝的指令,不混成拍摄失败。 + var commandTitle: String? { + guard let command = session?.command else { return nil } + switch command.status { + case .processing: return command.kind.processingTitle + case .unconfirmed: return "执行结果待确认" + case .rejected: return "指令未执行" + case .confirmed: return nil + } + } + /// 指令处理提示,避免点击按钮后误称已经生效。 + var commandMessage: String? { + guard let command = session?.command else { return nil } + switch command.status { + case .processing: return "等待设备确认,请勿重复发送指令。" + case .unconfirmed: return "暂未确认执行结果,请刷新任务状态,勿重复发送指令。" + case .rejected(let message): return message + case .confirmed: return nil + } + } + /// 用于按钮或提示区的处理指示器。 + var commandIsProcessing: Bool { session?.command?.status == .processing } + /// 只有结果未知才提示同步原任务。 + var shouldShowCommandRefresh: Bool { session?.commands.values.contains { $0.status == .unconfirmed } ?? false } + /// 主状态标题,拍摄结果和飞行返航同时可见。 + var statusTitle: String { + guard let session else { return "当前任务不可用" } + if phoneConnection != .connected { return "任务状态待确认" } + if session.result == .succeeded { return "拍摄已完成" } + if session.result == .failed { return "任务执行失败" } + if session.isFlightFinished { return session.result == .unknown ? "拍摄结果待确认" : "本次任务已结束" } + if session.protectiveReturnReason != nil { return "无人机自动返航" } + switch session.phase { + case .navigating: return "无人机正在前往拍摄点" + case .arrived: return "无人机已到达" + case .shooting: return "无人机正在拍摄中" + case .shootingPaused: return "无人机已暂停" + case .returning: return "无人机正在返航" + case .returnPaused: return "无人机返航已暂停" + case .unconfirmed: return "任务状态待确认" + } + } + /// 独立说明结果、飞行或连接状态。 + var statusMessage: String { + guard let session else { return "请返回工作台刷新当前订单。" } + if phoneConnection != .connected { return "连接中断不代表任务失败。恢复连接后需同步原任务。" } + if session.result == .succeeded { + if session.isFlightFinished { return "本次拍摄已结束,可前往查看素材。" } + let flightMessage: String + switch session.phase { + case .returning: flightMessage = "无人机返航中" + case .returnPaused: flightMessage = "无人机返航已暂停" + default: flightMessage = "无人机飞行任务尚未结束" + } + return "本次拍摄已完成。\(flightMessage),请留意现场。" + } + if session.result == .failed { + let reason = "失败原因:\(session.failureReason ?? "设备已确认本次拍摄失败")。" + if !session.isFlightFinished { return reason + "无人机尚未结束飞行,暂不可重新准备。" } + if order?.remainingShootingCount == 0 { return reason + "当前订单拍摄次数已用完。" } + return reason + (session.deviceReady ? "请排查后重新准备拍摄。" : "设备尚未恢复可用,请稍后刷新。") + } + if session.isFlightFinished { + if session.result == .unknown || session.result == .inProgress { return "飞行任务已结束,拍摄结果仍待确认。请同步原任务,勿重复召唤。" } + return "本次未开始拍摄,未扣减次数。\(session.deviceReady ? "可重新准备拍摄。" : "设备尚未恢复可用。")" + } + if let reason = session.protectiveReturnReason { return "返航原因:\(reason)。拍摄结果待确认,请留意现场。" } + switch session.phase { + case .navigating: return "请关注现场,等待设备确认到达。" + case .arrived: return "是否开始拍摄?确认游客站位与取景后开始。" + case .shooting: return feedConnection == .connected ? "请关注现场及实时画面。" : "当前仅画面中断,无人机状态仍在更新。" + case .shootingPaused: return "当前悬停待命。确认安全后,可继续任务或立即返航。" + case .returning: return "无人机返航中,请留意现场。拍摄结果单独确认。" + case .returnPaused: return "当前悬停待命,确认安全后可继续返航。" + case .unconfirmed: return "请同步原任务状态,勿重复创建任务。" + } + } + /// 主状态的语义色。 + var statusTone: DroneDockStatusTone { + guard let session else { return .gray } + if phoneConnection != .connected { return .orange } + if session.result == .succeeded { return .green } + if session.result == .failed { return .red } + return session.phase.tone + } + /// 导航和指令的主按钮语义。 + var primaryAction: DroneShootingTaskPrimaryAction { + guard let session, order != nil else { return .none } + if !session.isFlightFinished, session.phase == .returnPaused || session.phase == .shootingPaused { return .resume } + if session.result == .succeeded { return .viewMaterials } + if session.isFlightFinished, session.result == .failed || session.result == .notStarted { return .prepareAgain } + if session.result == .failed { return .prepareAgain } + switch session.phase { + case .arrived: return .start + case .shootingPaused, .returnPaused: return .resume + default: return .none + } + } + /// 主按钮标题,指令处理中与待确认时阻止重复操作。 + var primaryTitle: String { + if phoneConnection != .connected { return "等待任务同步" } + switch primaryAction { + case .start: + if let command = session?.commands[.start], command.status.isUnresolved { + return command.status == .unconfirmed ? "执行结果待确认" : command.kind.processingTitle + } + return "开始拍摄" + case .resume: + if let command = session?.commands[.resume], command.status.isUnresolved { + return command.status == .unconfirmed ? "执行结果待确认" : command.kind.processingTitle + } + return session?.phase == .returnPaused ? "继续返航" : "继续任务" + case .viewMaterials: return "查看素材" + case .prepareAgain: return "重新准备拍摄" + case .none: + if session?.result == .unknown { return "结果待确认" } + if session?.phase == .navigating { return "前往拍摄点中" } + if session?.phase == .returning { return "返航中" } + return "拍摄中" + } + } + /// 新任务必须等待飞行结束、设备可用并有剩余次数。 + var primaryEnabled: Bool { + guard let session, phoneConnection == .connected else { return false } + switch primaryAction { + case .viewMaterials: return true + case .prepareAgain: + return session.isFlightFinished && !session.hasCurrentTask && session.deviceReady + && (order?.remainingShootingCount ?? 0) > 0 && store.shootingDeviceState(orderID: orderID) == .ready + case .start: return canSend(.start) + case .resume: return canSend(.resume) + case .none: return false + } + } + /// 暂停按钮标题,提交后仍不展示已暂停。 + var pauseTitle: String { + if let command = session?.commands[.pause], command.status.isUnresolved { + return command.status == .processing ? "暂停处理中" : "暂停结果待确认" + } + return session?.phase == .shootingPaused || session?.phase == .returnPaused ? "已暂停" : "紧急暂停" + } + /// 暂停按钮补充说明。 + var pauseSubtitle: String { + if phoneConnection != .connected { return "当前无法发送指令" } + if session?.isFlightFinished != false { return "当前未执行任务" } + if session?.commands[.pause]?.status.isUnresolved == true { return "尚未确认悬停" } + return "悬停待命" + } + /// 暂停按钮许可,不因图传断流而禁用。 + var canPause: Bool { canSend(.pause) } + /// 返航按钮标题,等待明确回执才显示返航中。 + var returnTitle: String { + if let command = session?.commands[.returnHome], command.status.isUnresolved { + return command.status == .processing ? "正在发送返航指令" : "返航结果待确认" + } + return session?.phase == .returning ? "返航中" : "立即返航" + } + /// 返航按钮补充说明。 + var returnSubtitle: String { + if phoneConnection != .connected { return "当前无法发送指令" } + if session?.isFlightFinished != false { return "当前未执行任务" } + if session?.commands[.returnHome]?.status.isUnresolved == true { return "尚未确认返航" } + return session?.phase == .returning ? "返回机巢" : "中断任务" + } + /// 返航直接提交,无二次确认;提交与执行结果分开。 + var canReturn: Bool { canSend(.returnHome) } + /// 结果弹窗是任务快照的一部分,关闭后重进不重复展示。 + var resultNotice: DroneShootingResultNotice? { + guard let session, !session.resultNoticeDismissed else { return nil } + switch session.result { + case .succeeded: + return DroneShootingResultNotice(id: "\(session.id)-success", title: "拍摄完成", message: "本次拍摄已成功,扣减 1 次拍摄次数。飞行状态请继续留意现场。", isSuccess: true) + case .failed: + return DroneShootingResultNotice(id: "\(session.id)-failure", title: "任务执行失败", message: "\(session.failureReason ?? "设备已确认失败"),本次未扣减拍摄次数。", isSuccess: false) + default: return nil + } + } + + private var isCurrentContext: Bool { store.context == context } + + /// 只恢复原任务,构造页面不会自动创建、扣次或恢复执行。 + init(store: DroneDockDemoStore, orderID: String) { + self.store = store + self.orderID = orderID + context = store.context + refresh() + } + + /// 页面出现或手动操作后重新读取共享状态;没有自动进度。 + func refresh() { + guard isCurrentContext else { return } + _ = store.shootingSession(orderID: orderID) + } + + /// 直接提交开始请求,明确设备确认后才进入拍摄中。 + @discardableResult + func startShooting() -> Bool { send(.start) } + /// 直接提交紧急暂停,不弹二次确认,不提前宣称悬停。 + @discardableResult + func pause() -> Bool { send(.pause) } + /// 请求恢复暂停前阶段,收到回执前保持暂停。 + @discardableResult + func resume() -> Bool { send(.resume) } + /// 按已确认交互直接提交返航请求,收到回执前保持原阶段。 + @discardableResult + func requestReturn() -> Bool { send(.returnHome) } + /// 只开始手机重连,需明确同步回执才能恢复操作。 + func reconnectPhone() { receive(.phoneConnectionChanged(.reconnecting)) } + /// 图传重连不改变任务结果、飞行阶段或手机连接。 + func reconnectFeed() { receive(.feedConnectionChanged(.reconnecting)) } + /// 手动发起原任务同步;不清除未知结果或重复发送设备指令。 + func refreshTaskStatus() { receive(.phoneConnectionChanged(.synchronizing)) } + /// 关闭本任务的结果通知,写回共享快照防止重复弹窗。 + func dismissResultNotice() { + guard let session, isCurrentContext else { return } + store.dismissShootingResultNotice(orderID: orderID, taskID: session.id) + } + /// 注入显式本地回执,便于规则验证或后续数据源适配;过期任务回执会忽略。 + func receive(_ event: DroneShootingSessionEvent) { + guard let session, isCurrentContext else { return } + store.receiveShootingEvent(event, orderID: orderID, taskID: session.id) + } + + private func canSend(_ kind: DroneShootingCommandKind) -> Bool { + guard let session, order != nil, phoneConnection == .connected, !session.isFlightFinished, + session.commands[kind]?.status.isUnresolved != true, + session.commands[.summon]?.status.isUnresolved != true else { return false } + switch kind { + case .summon: return false + case .start: + return session.phase == .arrived && session.result == .notStarted + && !session.commands.values.contains { $0.status.isUnresolved } + case .resume: + return (session.phase == .shootingPaused || session.phase == .returnPaused) + && !session.commands.values.contains { $0.status.isUnresolved } + case .pause: + return session.phase != .shootingPaused && session.phase != .returnPaused && session.phase != .unconfirmed + case .returnHome: return session.phase != .returning && session.phase != .returnPaused && session.phase != .unconfirmed + } + } + + private func send(_ kind: DroneShootingCommandKind) -> Bool { + guard canSend(kind) else { return false } + return store.submitShootingCommand(kind, orderID: orderID) + } + + #if DEBUG + /// 显式模拟设备状态;场景切换不包含任何自动计时。 + func applyScenario(_ scenario: DroneShootingTaskScenario) { + guard isCurrentContext else { return } + store.applyTaskScenario(scenario, orderID: orderID) + refresh() + } + #endif +} + +/// 准备配置、会话与订单投影共享同一存储;页面间不存在独立任务副本。 +extension DroneDockDemoStore { + /// 当前上下文中读取或恢复原任务,已有任务引用只补齐本地展示快照。 + func shootingSession(orderID: String) -> DroneShootingSession? { + guard let order = shootingOrder(id: orderID) else { return nil } + let key = shootingKey(orderID) + if let session = shootingSessions[key], order.activeTask == nil || order.activeTask?.id == session.id { return session } + guard let task = order.activeTask else { return nil } + ensureShootingPreparation(orderID: orderID) + guard let state = shootingPreparations[key], + let point = state.points.first(where: { $0.id == state.selectedPointID }), + let route = state.routesByPointID[point.id]?.first(where: { $0.id == state.selectedRouteIDs[point.id] }) else { return nil } + let session = makeSession(id: task.id, point: point, route: route, phase: task.phase, result: task.shootingResult) + shootingSessions[key] = session + return session + } + + /// 外部明确的点位配置或定位快照;原选择失效时清空而不偷偷换航线。 + func updateShootingPoints(_ points: [DroneShootingPoint], routesByPointID: [String: [DroneShootingRoute]], orderID: String) { + guard shootingOrder(id: orderID) != nil else { return } + ensureShootingPreparation(orderID: orderID) + let key = shootingKey(orderID) + shootingPreparations[key]?.points = points + shootingPreparations[key]?.routesByPointID = routesByPointID + validateShootingSelection(orderID: orderID) + } + + /// 明确范围与设备都有效后创建唯一待确认会话;不扣次、不假称起飞。 + func beginShootingSession(orderID: String, point: DroneShootingPoint, route: DroneShootingRoute) { + guard let order = shootingOrder(id: orderID), order.activeTask == nil, + order.remainingShootingCount > 0, !orders.contains(where: { $0.activeTask != nil }), + point.range == .inside, shootingDeviceState(orderID: orderID) == .ready, + let state = shootingPreparations[shootingKey(orderID)], + state.points.contains(point), state.routesByPointID[point.id]?.contains(route) == true else { return } + var session = makeSession(id: UUID().uuidString, point: point, route: route, phase: .unconfirmed, result: .notStarted) + session.commands[.summon] = DroneShootingCommand(kind: .summon, status: .processing) + session.deviceReady = false + shootingSessions[shootingKey(orderID)] = session + setShootingDeviceState(.occupied) + projectShootingSession(orderID: orderID) + } + + /// 记录一种已通过页面许可校验的本地指令,防止同一种指令重复提交。 + @discardableResult + func submitShootingCommand(_ kind: DroneShootingCommandKind, orderID: String) -> Bool { + guard var session = shootingSession(orderID: orderID), !session.isFlightFinished, + session.phoneConnection == .connected, session.commands[kind]?.status.isUnresolved != true else { return false } + session.commands[kind] = DroneShootingCommand(kind: kind, status: .processing) + shootingSessions[shootingKey(orderID)] = session + projectShootingSession(orderID: orderID) + return true + } + + /// 显式设备事件入口,任务身份不匹配时忽略迟到回执。 + func receiveShootingEvent(_ event: DroneShootingSessionEvent, orderID: String, taskID: String?) { + guard var session = shootingSession(orderID: orderID), session.id == taskID else { return } + switch event { + case .commandConfirmed(let kind): + guard session.commands[kind]?.status.isUnresolved == true else { return } + session.commands[kind]?.status = .confirmed + if !session.isFlightFinished { + switch kind { + case .summon: session.phase = .navigating + case .start: + if session.result != .succeeded && session.result != .failed { + session.phase = .shooting + session.result = .inProgress + } + case .pause: + session.phaseBeforePause = session.phase + session.phase = session.phase == .returning ? .returnPaused : .shootingPaused + case .resume: + session.phase = session.phaseBeforePause ?? (session.phase == .returnPaused ? .returning : .shooting) + session.phaseBeforePause = nil + case .returnHome: + session.phase = .returning + if session.result == .inProgress { session.result = .unknown } + } + } + case .commandRejected(let kind, let message): + guard session.commands[kind]?.status.isUnresolved == true else { return } + session.commands[kind]?.status = .rejected(message: message) + if kind == .summon { + session.isFlightFinished = true + session.deviceReady = true + } + case .commandResultUnknown(let kind): + guard session.commands[kind]?.status.isUnresolved == true else { return } + session.commands[kind]?.status = .unconfirmed + case .phaseConfirmed(let phase): session.phase = phase + case .shootingSucceeded: + guard session.result != .failed else { return } + session.result = .succeeded + case .shootingFailed(let reason): + guard session.result != .succeeded else { return } + session.result = .failed + session.failureReason = reason + case .flightFinished(let deviceReady): + session.isFlightFinished = true + session.deviceReady = deviceReady + case .protectiveReturn(let reason): + session.phase = .returning + session.protectiveReturnReason = reason + if session.result != .succeeded && session.result != .failed { session.result = .unknown } + case .phoneConnectionChanged(let state): session.phoneConnection = state + case .feedConnectionChanged(let state): session.feedConnection = state + case .telemetryUpdated(let telemetry): session.telemetry = telemetry + case .synchronized(let phase, let result, let finished, let ready): + session.phase = phase + // 终态回执不被随后到达的非终态快照覆盖。 + if session.result != .succeeded && session.result != .failed { session.result = result } + session.isFlightFinished = session.isFlightFinished || finished + session.deviceReady = ready + session.phoneConnection = .connected + for kind in session.commands.keys { session.commands[kind]?.status = .confirmed } + } + shootingSessions[shootingKey(orderID)] = session + projectShootingSession(orderID: orderID) + } + + /// 关闭结果通知,后续页面只读取已关闭的同一快照。 + func dismissShootingResultNotice(orderID: String, taskID: String) { + let key = shootingKey(orderID) + guard shootingSessions[key]?.id == taskID else { return } + shootingSessions[key]?.resultNoticeDismissed = true + } + + /// 本地执行许可优先考虑其他活跃订单,不绑定工作台横向浏览的设备卡。 + func shootingDeviceState(orderID: String) -> DroneDockDeviceState { + if orders.contains(where: { $0.id != orderID && $0.activeTask != nil }) { return .occupied } + return devices.first?.state ?? .unknown + } + + /// 首次创建演示选择;后续进入保留每个点位的航线身份。 + func ensureShootingPreparation(orderID: String) { + let key = shootingKey(orderID) + guard shootingPreparations[key] == nil, let order = shootingOrder(id: orderID) else { return } + shootingPreparations[key] = DroneShootingSessionDemoData.preparation(successfulCount: order.successfulShootingCount) + } + + /// 配置失效时清除选择,不从其他同名点位恢复。 + func validateShootingSelection(orderID: String) { + let key = shootingKey(orderID) + guard var state = shootingPreparations[key] else { return } + if !state.points.contains(where: { $0.id == state.selectedPointID }) { state.selectedPointID = nil } + state.selectedRouteIDs = state.selectedRouteIDs.filter { pointID, routeID in + state.points.contains { $0.id == pointID } && (state.routesByPointID[pointID] ?? []).contains { $0.id == routeID } + } + shootingPreparations[key] = state + } + + private func shootingKey(_ orderID: String) -> DroneShootingSessionKey { + DroneShootingSessionKey(context: context, orderID: orderID) + } + + private func makeSession(id: String, point: DroneShootingPoint, route: DroneShootingRoute, phase: DroneShootingTaskPhase, result: DroneShootingResult) -> DroneShootingSession { + DroneShootingSession( + id: id, point: point, route: route, phase: phase, result: result, isFlightFinished: false, + deviceReady: false, successRecorded: result == .succeeded, phoneConnection: .connected, + feedConnection: .connected, telemetry: devices.first?.telemetry ?? .unknown, + commands: [:], phaseBeforePause: nil, failureReason: nil, protectiveReturnReason: nil, + resultNoticeDismissed: result == .succeeded || result == .failed + ) + } + + private func projectShootingSession(orderID: String) { + let key = shootingKey(orderID) + guard var session = shootingSessions[key], let order = shootingOrder(id: orderID) else { return } + let shouldRecordSuccess = session.result == .succeeded && !session.successRecorded + if shouldRecordSuccess { + session.successRecorded = true + incrementShootingPointCount(orderID: orderID, pointID: session.point.id) + } + shootingSessions[key] = session + let successfulCount = shouldRecordSuccess ? min(order.totalShootingCount, order.successfulShootingCount + 1) : order.successfulShootingCount + replaceShootingOrder(order.replacingShootingState( + successfulCount: successfulCount, task: session.taskReference, + needsRepreparation: !session.hasCurrentTask && session.result != .succeeded, + materialState: shouldRecordSuccess ? .uploading : order.materialState + )) + if !session.hasCurrentTask { + let hasOtherTask = orders.contains { $0.id != orderID && $0.activeTask != nil } + setShootingDeviceState(hasOtherTask ? .occupied : (session.deviceReady ? .ready : .unknown), telemetry: session.telemetry) + } + } + + private func incrementShootingPointCount(orderID: String, pointID: String) { + let key = shootingKey(orderID) + guard var state = shootingPreparations[key], let index = state.points.firstIndex(where: { $0.id == pointID }) else { return } + let point = state.points[index] + state.points[index] = DroneShootingPoint(id: point.id, name: point.name, range: point.range, successfulCount: point.successfulCount + 1) + shootingPreparations[key] = state + } +} + +/// 复制订单的会话相关字段,其余原素材和成片交付信息原样保留。 +private extension DroneShootingOrder { + func replacingShootingState(successfulCount: Int, task: DroneShootingTask?, needsRepreparation: Bool, materialState: DroneShootingMaterialState) -> DroneShootingOrder { + DroneShootingOrder( + id: id, scenicID: scenicID, assignedUserID: assignedUserID, customerName: customerName, + orderNumber: orderNumber, createdAtText: createdAtText, packageName: packageName, + totalShootingCount: totalShootingCount, successfulShootingCount: successfulCount, + activeTask: task, needsRepreparation: needsRepreparation, materialState: materialState, + deliveredVideoCount: deliveredVideoCount, visitorConfirmationState: visitorConfirmationState + ) + } +} + +/// 无真实接口的首轮 UI 配置;航线数量严格来自各点自己的配置。 +private enum DroneShootingSessionDemoData { + static func preparation(successfulCount: Int) -> DroneShootingPreparationState { + let points = [ + DroneShootingPoint(id: "point-sanhuang", name: "三皇寨", range: .inside, successfulCount: successfulCount), + DroneShootingPoint(id: "point-jinque", name: "金阙云宫", range: .outside(distanceText: "800 m"), successfulCount: 0), + DroneShootingPoint(id: "point-shaoshi", name: "少室山", range: .outside(distanceText: "1.2 km"), successfulCount: 0), + DroneShootingPoint(id: "point-yingke", name: "迎客峰", range: .outside(distanceText: "1.8 km"), successfulCount: 0) + ] + let routeNames = [ + ["经典航线", "环绕专线", "远景拉升", "全景环绕", "高空俯瞰", "山峰渐远", "峡谷穿行", "山脊侧拍"], + ["云宫环绕", "金顶渐远", "云海全景"], + ["山峦全景", "山间渐远"], + ["迎客环绕", "山峰远景", "山谷俯瞰"] + ] + var routesByPointID: [String: [DroneShootingRoute]] = [:] + for (index, point) in points.enumerated() { + routesByPointID[point.id] = routeNames[index].enumerated().map { DroneShootingRoute(id: "\(point.id)-route-\($0.offset)", name: $0.element) } + } + return DroneShootingPreparationState(points: points, routesByPointID: routesByPointID, selectedPointID: points.first?.id, selectedRouteIDs: [points[0].id: routesByPointID[points[0].id]![0].id]) + } +} + +#if DEBUG +/// 所有演示均由明确点击触发,不执行计时、API 或真实设备操作。 +private extension DroneDockDemoStore { + func applyPreparationScenario(_ scenario: DroneShootingPreparationScenario, orderID: String) { + guard let order = shootingOrder(id: orderID) else { return } + let key = shootingKey(orderID) + if shootingScenarioBaselines[key] == nil { shootingScenarioBaselines[key] = order } + guard let baseline = shootingScenarioBaselines[key] else { return } + let count = scenario == .noQuota ? baseline.totalShootingCount : baseline.successfulShootingCount + replaceShootingOrder(baseline.replacingShootingState(successfulCount: count, task: baseline.activeTask, needsRepreparation: baseline.needsRepreparation, materialState: baseline.materialState)) + if baseline.activeTask == nil { shootingSessions[key] = nil } + var state = DroneShootingSessionDemoData.preparation(successfulCount: count) + if let previous = shootingPreparations[key], state.points.contains(where: { $0.id == previous.selectedPointID }) { + state.selectedPointID = previous.selectedPointID + state.selectedRouteIDs.merge(previous.selectedRouteIDs) { _, previous in previous } + } + if let pointID = state.selectedPointID, let index = state.points.firstIndex(where: { $0.id == pointID }) { + let point = state.points[index] + let range: DroneShootingRange + switch scenario { + case .outOfRange: range = .outside(distanceText: "800 m") + case .unknownRange: range = .unknown + default: range = .inside + } + state.points[index] = DroneShootingPoint(id: point.id, name: point.name, range: range, successfulCount: point.successfulCount) + if scenario == .noRoutes { + state.routesByPointID[pointID] = [] + state.selectedRouteIDs[pointID] = nil + } + } + shootingPreparations[key] = state + if scenario == .noPoints { + shootingPreparations[key]?.points = [] + shootingPreparations[key]?.selectedPointID = nil + shootingPreparations[key]?.selectedRouteIDs = [:] + shootingPreparations[key]?.routesByPointID = [:] + } + let deviceState: DroneDockDeviceState + switch scenario { + case .occupied: deviceState = .occupied + case .disconnected: deviceState = .disconnected + case .noSignal: deviceState = .noSignal + case .lowBattery: deviceState = .lowBattery + case .unknown: deviceState = .unknown + default: deviceState = .ready + } + let telemetry = scenario == .unknown || scenario == .disconnected || scenario == .noSignal + ? DroneDockTelemetry.unknown + : DroneDockTelemetry(batteryPercent: scenario == .lowBattery ? 18 : 95, temperatureCelsius: 20.3, windSpeed: 0, rainDescription: "无雨", signalDescription: "良好", satelliteCount: 36) + setShootingDeviceState(deviceState, telemetry: telemetry) + } + + func applyTaskScenario(_ scenario: DroneShootingTaskScenario, orderID: String) { + guard var session = shootingSession(orderID: orderID) else { return } + let key = shootingKey(orderID) + if scenario == .synchronized { + let unresolvedStart = session.commands[.start]?.status.isUnresolved == true + receiveShootingEvent(.synchronized( + phase: unresolvedStart ? .shooting : session.phase, + result: unresolvedStart ? .inProgress : session.result, + flightFinished: session.isFlightFinished, deviceReady: session.deviceReady + ), orderID: orderID, taskID: session.id) + return + } + session.phase = .arrived + session.result = .notStarted + session.isFlightFinished = false + session.deviceReady = false + session.phoneConnection = .connected + session.feedConnection = .connected + session.commands = [:] + session.failureReason = nil + session.protectiveReturnReason = nil + session.phaseBeforePause = nil + session.resultNoticeDismissed = false + session.telemetry = DroneDockTelemetry(batteryPercent: 95, temperatureCelsius: 20.3, windSpeed: 0, rainDescription: "无雨", signalDescription: "良好", satelliteCount: 36) + switch scenario { + case .navigating: session.phase = .navigating + case .arrived: break + case .shooting, .pauseProcessing, .streamLost: + session.phase = .shooting + session.result = .inProgress + if scenario == .pauseProcessing { session.commands[.pause] = DroneShootingCommand(kind: .pause, status: .processing) } + if scenario == .streamLost { session.feedConnection = .disconnected } + case .shootingPaused, .resumeProcessing: + session.phase = .shootingPaused + session.phaseBeforePause = .shooting + session.result = .inProgress + if scenario == .resumeProcessing { session.commands[.resume] = DroneShootingCommand(kind: .resume, status: .processing) } + case .returning: session.phase = .returning + case .returnPaused: + session.phase = .returnPaused + session.phaseBeforePause = .returning + case .succeededReturning, .succeededFinished: + session.phase = .returning + session.result = .succeeded + session.isFlightFinished = scenario == .succeededFinished + session.deviceReady = session.isFlightFinished + case .failedReturning, .failedReady: + session.phase = .returning + session.result = .failed + session.failureReason = "拍摄指令执行失败" + session.isFlightFinished = scenario == .failedReady + session.deviceReady = session.isFlightFinished + case .phoneOffline: + session.phase = .shooting + session.result = .inProgress + session.phoneConnection = .disconnected + case .protectiveReturn: + session.phase = .returning + session.result = .unknown + session.protectiveReturnReason = "电量不足" + session.telemetry = DroneDockTelemetry(batteryPercent: 18, temperatureCelsius: 20.3, windSpeed: 0, rainDescription: "无雨", signalDescription: "良好", satelliteCount: 36) + case .commandUnconfirmed: session.commands[.start] = DroneShootingCommand(kind: .start, status: .unconfirmed) + case .commandRejected: session.commands[.start] = DroneShootingCommand(kind: .start, status: .rejected(message: "设备拒绝开始拍摄,请检查当前状态。")) + case .synchronized: break + } + shootingSessions[key] = session + setShootingDeviceState(.occupied, telemetry: session.telemetry) + projectShootingSession(orderID: orderID) + } +} +#endif diff --git a/suixinkan/Features/Home/Services/HomeCommonMenuStore.swift b/suixinkan/Features/Home/Services/HomeCommonMenuStore.swift index 40b267f..9094f17 100644 --- a/suixinkan/Features/Home/Services/HomeCommonMenuStore.swift +++ b/suixinkan/Features/Home/Services/HomeCommonMenuStore.swift @@ -18,7 +18,7 @@ final class HomeCommonMenuStore { func savedCommonURIs(accountScope: String, roleCode: String) -> [String] { guard let key = storageKey(accountScope: accountScope, roleCode: roleCode) else { return [] } let saved = defaults.stringArray(forKey: key) ?? [] - let sanitized = saved.filter(HomeMenuCatalog.isCustomizable(uri:)) + let sanitized = Self.normalizedCommonURIs(saved) if sanitized != saved { defaults.set(sanitized, forKey: key) } @@ -28,12 +28,12 @@ final class HomeCommonMenuStore { /// 保存常用 URI 列表。 func saveCommonURIs(_ uris: [String], accountScope: String, roleCode: String) { guard let key = storageKey(accountScope: accountScope, roleCode: roleCode) else { return } - defaults.set(uris.filter(HomeMenuCatalog.isCustomizable(uri:)), forKey: key) + defaults.set(Self.normalizedCommonURIs(uris), forKey: key) } /// 根据权限生成默认常用 URI(最多 4 个)。 static func defaultCommonURIs(from permissions: [HomePermissionItem]) -> [String] { - let uris = permissions.map(\.uri).filter(HomeMenuCatalog.isCustomizable(uri:)) + let uris = normalizedCommonURIs(permissions.map(\.uri)) return uris.count > 4 ? Array(uris.prefix(4)) : uris } @@ -55,13 +55,17 @@ final class HomeCommonMenuStore { from allMenus: [HomeMenuItem], commonURIs: [String] ) -> (common: [HomeMenuItem], more: [HomeMenuItem]) { - let commonSet = Set(commonURIs) + let commonSet = Set(normalizedCommonURIs(commonURIs)) let customizableMenus = allMenus.filter { HomeMenuCatalog.isCustomizable(uri: $0.uri) } let common = customizableMenus.filter { commonSet.contains($0.uri) } let more = customizableMenus.filter { !commonSet.contains($0.uri) } return (common, more) } + private static func normalizedCommonURIs(_ uris: [String]) -> [String] { + HomeMenuCatalog.canonicalURIs(uris).filter(HomeMenuCatalog.isCustomizable(uri:)) + } + private func storageKey(accountScope: String, roleCode: String) -> String? { let normalizedScope = accountScope.trimmingCharacters(in: .whitespacesAndNewlines) let normalizedRoleCode = roleCode.trimmingCharacters(in: .whitespacesAndNewlines) diff --git a/suixinkan/Features/Home/Services/HomeMenuCatalog.swift b/suixinkan/Features/Home/Services/HomeMenuCatalog.swift index f6d423b..1f78d1e 100644 --- a/suixinkan/Features/Home/Services/HomeMenuCatalog.swift +++ b/suixinkan/Features/Home/Services/HomeMenuCatalog.swift @@ -16,11 +16,13 @@ enum HomeMenuCatalog { HomeMenuItem(uri: "wallet", title: "我的钱包", iconName: "home_menu_wallet"), HomeMenuItem(uri: "cloud_management", title: "相册云盘", iconName: "icloud.fill"), HomeMenuItem(uri: "asset_management", title: "素材管理", iconName: "home_menu_material"), + HomeMenuItem(uri: "sceniclibrary", title: "景区空境库", iconName: "photo.on.rectangle.angled"), HomeMenuItem(uri: "task_management", title: "任务管理", iconName: "checklist"), HomeMenuItem(uri: "task_management_editor", title: "任务管理", iconName: "checklist"), HomeMenuItem(uri: "schedule_management", title: "日程管理", iconName: "calendar"), HomeMenuItem(uri: "system_settings", title: "设置中心", iconName: "gearshape.fill"), HomeMenuItem(uri: "message_center", title: "消息中心", iconName: "bell.fill"), + HomeMenuItem(uri: "/training", title: "培训中心", iconName: "graduationcap.fill"), HomeMenuItem(uri: "checkin_points", title: "打卡点管理", iconName: "home_menu_punch_point"), HomeMenuItem(uri: "sample_management", title: "样片管理", iconName: "sample_ic_home_menu_route"), HomeMenuItem(uri: "live_stream_management", title: "直播管理", iconName: "dot.radiowaves.left.and.right"), @@ -35,6 +37,7 @@ enum HomeMenuCatalog { HomeMenuItem(uri: "photographer_invite", title: "邀请摄影师", iconName: "envelope.open.fill"), HomeMenuItem(uri: "invite_record", title: "邀请记录", iconName: "list.bullet.rectangle.fill"), HomeMenuItem(uri: "store", title: "店铺管理", iconName: "building.2.fill"), + HomeMenuItem(uri: "drone_dock", title: "机巢工作台", iconName: "airplane.circle.fill"), HomeMenuItem(uri: "fly", title: "飞行管理", iconName: "paperplane.fill"), HomeMenuItem(uri: "pilot_cert", title: "飞手认证", iconName: "paperplane.fill"), HomeMenuItem(uri: "pilot_controller", title: "飞控", iconName: "paperplane.fill"), @@ -44,11 +47,16 @@ enum HomeMenuCatalog { HomeMenuItem(uri: "cooperation_order", title: "合作订单", iconName: "person.2"), ] - /// 将服务端权限映射为可展示菜单,保持服务端顺序。 + /// 将服务端权限映射为可展示菜单;培训两种 URI 只保留首次出现的位置。 static func visibleMenus(from permissions: [HomePermissionItem]) -> [HomeMenuItem] { - permissions.compactMap { permission in + var hasTraining = false + return permissions.compactMap { permission in guard isCustomizable(uri: permission.uri) else { return nil } - guard let catalog = allItems.first(where: { $0.uri == permission.uri }) else { return nil } + guard let catalog = item(for: permission.uri) else { return nil } + if catalog.uri == "/training" { + guard !hasTraining else { return nil } + hasTraining = true + } return HomeMenuItem( uri: catalog.uri, title: catalog.title, @@ -60,7 +68,25 @@ enum HomeMenuCatalog { /// 查找 catalog 项。 static func item(for uri: String) -> HomeMenuItem? { - allItems.first { $0.uri == uri } + allItems.first { $0.uri == canonicalURI(for: uri) } + } + + /// 仅将服务端 training 别名映射为内部 /training,不泛化其它 URI。 + static func canonicalURI(for uri: String) -> String { + uri == "training" ? "/training" : uri + } + + /// 常用配置统一培训 URI 并保留首项,其它菜单的顺序和重复项保持原样。 + static func canonicalURIs(_ uris: [String]) -> [String] { + var hasTraining = false + return uris.compactMap { uri in + let canonical = canonicalURI(for: uri) + if canonical == "/training" { + guard !hasTraining else { return nil } + hasTraining = true + } + return canonical + } } /// 判断入口是否允许出现在首页常用应用及其自定义页面中。 diff --git a/suixinkan/Features/Home/Services/HomeRouteHandler.swift b/suixinkan/Features/Home/Services/HomeRouteHandler.swift index 0edc583..8d8ac66 100644 --- a/suixinkan/Features/Home/Services/HomeRouteHandler.swift +++ b/suixinkan/Features/Home/Services/HomeRouteHandler.swift @@ -16,12 +16,13 @@ enum HomeRouteHandler { storeItem: StoreItem?, onCommonMenusChanged: (() -> Void)? = nil ) { + let uri = HomeMenuCatalog.canonicalURI(for: uri) if uri == "pilot_controller" { showDeveloping(from: viewController) return } - if uri != "pilot_controller", uri != "wallet", AppStore.shared.session.currentScenicId <= 0 { + if uri != "pilot_controller", uri != "wallet", uri != "/training", AppStore.shared.session.currentScenicId <= 0 { showToast("请先选择景区", from: viewController) return } @@ -39,6 +40,9 @@ enum HomeRouteHandler { viewController.navigationController?.pushViewController(SettingViewController(), animated: true) case "message_center": viewController.navigationController?.pushViewController(MessageCenterViewController(), animated: true) + case "/training": + guard AppStore.shared.session.accountType == .storeUser else { return } + viewController.navigationController?.pushViewController(TrainingCenterViewController(), animated: true) case "space_settings": viewController.navigationController?.pushViewController(ProfileSpaceSettingsViewController(), animated: true) case "cloud_management": @@ -64,6 +68,8 @@ enum HomeRouteHandler { viewController.navigationController?.pushViewController(InviteRecordViewController(), animated: true) case "/scenic-queue": viewController.navigationController?.pushViewController(ScenicQueueViewController(), animated: true) + case "drone_dock": + viewController.navigationController?.pushViewController(DroneDockHomeViewController(), animated: true) case "task_management", "task_management_editor": viewController.navigationController?.pushViewController(TaskAddViewController(), animated: true) case "travel_album": @@ -72,6 +78,13 @@ enum HomeRouteHandler { viewController.navigationController?.pushViewController(SampleListViewController(), animated: true) case "asset_management": viewController.navigationController?.pushViewController(MaterialListViewController(), animated: true) + case "sceniclibrary": + let session = AppStore.shared.session + let context = ScenicMaterialContext(userID: session.userId, + scenicID: String(session.currentScenicId), + scenicName: session.currentScenicName) + let viewModel = ScenicMaterialsViewModel(context: context, isRemote: true) + viewController.navigationController?.pushViewController(ScenicMaterialsViewController(viewModel: viewModel), animated: true) case "checkin_points": viewController.navigationController?.pushViewController(PunchPointListViewController(), animated: true) case "live_stream_management": diff --git a/suixinkan/Features/Home/ViewModels/AllFunctionsViewModel.swift b/suixinkan/Features/Home/ViewModels/AllFunctionsViewModel.swift index c64ded5..214bf87 100644 --- a/suixinkan/Features/Home/ViewModels/AllFunctionsViewModel.swift +++ b/suixinkan/Features/Home/ViewModels/AllFunctionsViewModel.swift @@ -48,6 +48,7 @@ final class AllFunctionsViewModel { /// 将菜单加入常用应用。 func addToCommon(_ menu: HomeMenuItem) { + guard isCurrentlyPermitted(menu) else { loadFunctions(); return } guard HomeMenuCatalog.isCustomizable(uri: menu.uri) else { return } guard !commonMenus.contains(where: { $0.uri == menu.uri }) else { return } commonMenus.append(menu) @@ -59,6 +60,7 @@ final class AllFunctionsViewModel { /// 将菜单移出常用应用。 func removeFromCommon(_ menu: HomeMenuItem) { + guard isCurrentlyPermitted(menu) else { loadFunctions(); return } guard commonMenus.contains(where: { $0.uri == menu.uri }) else { return } commonMenus.removeAll { $0.uri == menu.uri } if !moreMenus.contains(where: { $0.uri == menu.uri }) { @@ -69,6 +71,10 @@ final class AllFunctionsViewModel { notifyStateChange() } + private func isCurrentlyPermitted(_ menu: HomeMenuItem) -> Bool { + HomeMenuCatalog.visibleMenus(from: appStore.permissions.permissionItems()).contains { $0.uri == menu.uri } + } + private func persistCommonMenus() { commonMenuStore.saveCommonURIs( commonMenus.map(\.uri), diff --git a/suixinkan/Features/Home/ViewModels/HomeViewModel.swift b/suixinkan/Features/Home/ViewModels/HomeViewModel.swift index a954d91..6250480 100644 --- a/suixinkan/Features/Home/ViewModels/HomeViewModel.swift +++ b/suixinkan/Features/Home/ViewModels/HomeViewModel.swift @@ -280,7 +280,7 @@ final class HomeViewModel { isMinimalTopRole = currentAppRole?.usesHomeMinimalTopLayout ?? false } - /// 重建常用应用列表。 + /// 按服务端权限和本地常用配置重建应用列表。 func rebuildCommonMenus() { let permissions = appStore.permissions.permissionItems() let allMenus = HomeMenuCatalog.visibleMenus(from: permissions) diff --git a/suixinkan/Features/Location/LocationProvider.swift b/suixinkan/Features/Location/LocationProvider.swift index 3abde31..c2a1c8f 100644 --- a/suixinkan/Features/Location/LocationProvider.swift +++ b/suixinkan/Features/Location/LocationProvider.swift @@ -17,6 +17,8 @@ protocol CoreLocationManaging: AnyObject { func requestWhenInUseAuthorization() /// 请求一次当前位置。 func requestLocation() + /// 结束已取消或已超时的定位,释放系统中的单次请求。 + func stopUpdatingLocation() } extension CLLocationManager: CoreLocationManaging {} @@ -31,7 +33,11 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager private var manager: any CoreLocationManaging = CLLocationManager() private var geocoder: any LocationAddressGeocoding = LocationGeocoder.shared private var permissionContinuation: CheckedContinuation? + private var permissionRequestID: UUID? private var locationContinuation: CheckedContinuation? + private var locationRequestID: UUID? + private var locationTimeoutTask: Task? + private var locationTimeoutNanoseconds: UInt64 = 10_000_000_000 nonisolated override init() { super.init() @@ -41,11 +47,13 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager init( appStore: AppStore, manager: any CoreLocationManaging, - geocoder: any LocationAddressGeocoding + geocoder: any LocationAddressGeocoding, + locationTimeoutNanoseconds: UInt64 = 10_000_000_000 ) { self.appStore = appStore self.manager = manager self.geocoder = geocoder + self.locationTimeoutNanoseconds = max(1, locationTimeoutNanoseconds) super.init() manager.delegate = self } @@ -66,21 +74,41 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager ) } - /// 请求一次当前位置坐标。 + /// 请求一次当前位置坐标;系统未回调时超时结束,调用方取消时清理本次等待。 func requestCoordinate( desiredAccuracy: CLLocationAccuracy ) async throws -> CLLocationCoordinate2D { + try Task.checkCancellation() try requirePrivacyAgreement() try await ensureLocationPermission() + try Task.checkCancellation() guard locationContinuation == nil else { throw LocationProviderError.locationFailed } manager.delegate = self manager.desiredAccuracy = desiredAccuracy - return try await withCheckedThrowingContinuation { continuation in - locationContinuation = continuation - manager.requestLocation() + let requestID = UUID() + let timeout = locationTimeoutNanoseconds + return try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { continuation in + guard !Task.isCancelled else { + continuation.resume(throwing: CancellationError()) + return + } + locationRequestID = requestID + locationContinuation = continuation + locationTimeoutTask = Task { @MainActor [weak self] in + do { try await Task.sleep(nanoseconds: timeout) } + catch { return } + self?.finishLocation(requestID: requestID, result: .failure(LocationProviderError.locationFailed)) + } + manager.requestLocation() + } + } onCancel: { + Task { @MainActor [weak self] in + self?.finishLocation(requestID: requestID, result: .failure(CancellationError())) + } } } @@ -92,6 +120,7 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager /// 请求系统定位权限,等待用户完成首次授权。 func ensureLocationPermission() async throws { + try Task.checkCancellation() manager.delegate = self switch manager.authorizationStatus { case .authorizedAlways, .authorizedWhenInUse: @@ -102,9 +131,21 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager guard permissionContinuation == nil else { throw LocationProviderError.locationFailed } - try await withCheckedThrowingContinuation { continuation in - permissionContinuation = continuation - manager.requestWhenInUseAuthorization() + let requestID = UUID() + try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in + guard !Task.isCancelled else { + continuation.resume(throwing: CancellationError()) + return + } + permissionRequestID = requestID + permissionContinuation = continuation + manager.requestWhenInUseAuthorization() + } + } onCancel: { + Task { @MainActor [weak self] in + self?.finishPermission(requestID: requestID, result: .failure(CancellationError())) + } } @unknown default: throw LocationProviderError.permissionDenied @@ -116,21 +157,19 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { - guard let continuation = locationContinuation else { return } - locationContinuation = nil + guard let requestID = locationRequestID else { return } guard let coordinate = locations.last?.coordinate, CLLocationCoordinate2DIsValid(coordinate), coordinate.latitude != 0 || coordinate.longitude != 0 else { - continuation.resume(throwing: LocationProviderError.locationFailed) + finishLocation(requestID: requestID, result: .failure(LocationProviderError.locationFailed)) return } - continuation.resume(returning: coordinate) + finishLocation(requestID: requestID, result: .success(coordinate)) } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { - guard let continuation = locationContinuation else { return } - locationContinuation = nil - continuation.resume(throwing: LocationProviderError.locationFailed) + guard let requestID = locationRequestID else { return } + finishLocation(requestID: requestID, result: .failure(LocationProviderError.locationFailed)) } private func requirePrivacyAgreement() throws { @@ -140,21 +179,37 @@ final class CoreLocationProvider: NSObject, LocationProviding, CLLocationManager } private func resolvePermission(status: CLAuthorizationStatus) { - guard let continuation = permissionContinuation else { return } + guard let requestID = permissionRequestID else { return } switch status { case .authorizedAlways, .authorizedWhenInUse: - permissionContinuation = nil - continuation.resume() + finishPermission(requestID: requestID, result: .success(())) case .denied, .restricted: - permissionContinuation = nil - continuation.resume(throwing: LocationProviderError.permissionDenied) + finishPermission(requestID: requestID, result: .failure(LocationProviderError.permissionDenied)) case .notDetermined: break @unknown default: - permissionContinuation = nil - continuation.resume(throwing: LocationProviderError.permissionDenied) + finishPermission(requestID: requestID, result: .failure(LocationProviderError.permissionDenied)) } } + + /// 仅结束匹配的授权等待,旧任务的取消不能清除后续请求。 + private func finishPermission(requestID: UUID, result: Result) { + guard permissionRequestID == requestID, let continuation = permissionContinuation else { return } + permissionRequestID = nil + permissionContinuation = nil + continuation.resume(with: result) + } + + /// 统一处理成功、失败、超时和取消,先清理状态再恢复等待中的调用方。 + private func finishLocation(requestID: UUID, result: Result) { + guard locationRequestID == requestID, let continuation = locationContinuation else { return } + locationRequestID = nil + locationContinuation = nil + locationTimeoutTask?.cancel() + locationTimeoutTask = nil + manager.stopUpdatingLocation() + continuation.resume(with: result) + } } #if targetEnvironment(simulator) diff --git a/suixinkan/Features/Orders/ViewModels/DepositOrderListViewModel.swift b/suixinkan/Features/Orders/ViewModels/DepositOrderListViewModel.swift index fbd0c82..8789fee 100644 --- a/suixinkan/Features/Orders/ViewModels/DepositOrderListViewModel.swift +++ b/suixinkan/Features/Orders/ViewModels/DepositOrderListViewModel.swift @@ -8,6 +8,14 @@ import Foundation /// 店铺管理员押金单列表 ViewModel,对齐 Android `DepositOrderListViewModel`。 final class DepositOrderListViewModel { + private let appStore: AppStore + + /// 注入账号上下文,使订单查询与测试使用各自独立的会话。 + init(appStore: AppStore = .shared) { + self.appStore = appStore + } + + private(set) var searchText = "" private(set) var filterLabel = "全部" private(set) var tabIndex = 0 @@ -22,6 +30,7 @@ final class DepositOrderListViewModel { var onStateChange: (() -> Void)? var onShowMessage: ((String) -> Void)? + private var listRequestID = UUID() private var currentPage = 1 private var totalCount = 0 private var searchDebounceTask: Task? @@ -34,6 +43,18 @@ final class DepositOrderListViewModel { return formatter }() + /// 清除通知进入前的查询条件,由页面随后发起第一页刷新。 + func resetFiltersForOrderNotification() { + searchDebounceTask?.cancel() + searchDebounceTask = nil + searchText = "" + filterLabel = "全部" + tabIndex = 0 + startTime = nil + endTime = nil + notifyStateChange() + } + func refreshOrderList(api: OrderAPI) async { currentPage = 1 isRefreshing = true @@ -102,7 +123,7 @@ final class DepositOrderListViewModel { onShowMessage?("核销码内容不完整") return } - let storeId = AppStore.shared.session.currentStoreId + let storeId = appStore.session.currentStoreId guard storeId > 0 else { onShowMessage?("店铺信息异常,请先选择店铺") return @@ -125,7 +146,7 @@ final class DepositOrderListViewModel { refundReason: String, api: OrderAPI ) async { - let storeId = AppStore.shared.session.currentStoreId + let storeId = appStore.session.currentStoreId guard storeId > 0 else { onShowMessage?("店铺信息异常") return @@ -163,10 +184,12 @@ final class DepositOrderListViewModel { } private func loadOrderList(refresh: Bool, api: OrderAPI) async { + let requestID = UUID() + listRequestID = requestID let phone = searchText.trimmingCharacters(in: .whitespacesAndNewlines) let isPhoneSearch = !phone.isEmpty && Self.isValidPhone(phone) - let storeId = AppStore.shared.session.currentStoreId + let storeId = appStore.session.currentStoreId if storeId <= 0 { finishLoading() orderList = [] @@ -201,6 +224,7 @@ final class DepositOrderListViewModel { startTime: start, endTime: end ) + guard listRequestID == requestID else { return } totalCount = response.total if refresh || currentPage == 1 { orderList = response.list @@ -213,6 +237,7 @@ final class DepositOrderListViewModel { } catch is CancellationError { return } catch { + guard listRequestID == requestID else { return } onShowMessage?(error.localizedDescription) } finishLoading() diff --git a/suixinkan/Features/Orders/ViewModels/OrderListViewModel.swift b/suixinkan/Features/Orders/ViewModels/OrderListViewModel.swift index bcc8815..2276763 100644 --- a/suixinkan/Features/Orders/ViewModels/OrderListViewModel.swift +++ b/suixinkan/Features/Orders/ViewModels/OrderListViewModel.swift @@ -83,6 +83,14 @@ struct OrderSourceSelection: Equatable { /// 摄影师/景区管理员订单列表 ViewModel,对齐 Android `OrderListViewModel`。 final class OrderListViewModel { + private let appStore: AppStore + + /// 注入账号上下文,使订单查询与测试使用各自独立的会话。 + init(appStore: AppStore = .shared) { + self.appStore = appStore + } + + private(set) var orderList: [OrderEntity] = [] private(set) var searchText = "" private(set) var filterLabel = "全部" @@ -110,6 +118,7 @@ final class OrderListViewModel { var onShowMessage: ((String) -> Void)? var onNavigateBindAcquirer: ((Int) -> Void)? + private var listRequestID = UUID() private var currentPage = 1 private var totalCount = 0 @@ -122,7 +131,7 @@ final class OrderListViewModel { }() var isScenicAdminReadOnly: Bool { - AppStore.shared.session.currentAppRole == .scenicAdmin + appStore.session.currentAppRole == .scenicAdmin } var listAPIPath: String { @@ -131,6 +140,17 @@ final class OrderListViewModel { : "/api/yf-handset-app/photog/order/listv2" } + /// 清除通知进入前的查询条件,由页面随后发起第一页刷新。 + func resetFiltersForOrderNotification() { + searchText = "" + filterLabel = "全部" + tabIndex = 0 + rTabIndex = 0 + startTime = nil + endTime = nil + notifyStateChange() + } + func refreshOrderList(api: OrderAPI) async { currentPage = 1 isRefreshing = true @@ -359,7 +379,7 @@ final class OrderListViewModel { isLoadingOrderSourcePeople = false notifyStateChange() } - let storeId = AppStore.shared.session.currentStoreId + let storeId = appStore.session.currentStoreId let storeIdParam = storeId > 0 ? String(storeId) : nil do { let response = try await api.cooperativeSalers(storeId: storeIdParam) @@ -402,7 +422,9 @@ final class OrderListViewModel { } private func loadOrderList(api: OrderAPI, append: Bool) async { - let scenicId = AppStore.shared.session.currentScenicId + let requestID = UUID() + listRequestID = requestID + let scenicId = appStore.session.currentScenicId guard scenicId > 0 else { finishLoading() onShowMessage?("当前景区信息缺失") @@ -436,6 +458,7 @@ final class OrderListViewModel { isRefined: rTabIndex ) } + guard listRequestID == requestID else { return } totalCount = response.total if append { orderList.append(contentsOf: response.list) @@ -447,6 +470,7 @@ final class OrderListViewModel { } catch is CancellationError { return } catch { + guard listRequestID == requestID else { return } onShowMessage?(error.localizedDescription) } finishLoading() @@ -479,7 +503,7 @@ final class OrderListViewModel { var json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { return nil } - json["scenic_id"] = String(AppStore.shared.session.currentScenicId) + json["scenic_id"] = String(appStore.session.currentScenicId) guard let updated = try? JSONSerialization.data(withJSONObject: json), let string = String(data: updated, encoding: .utf8) else { return nil diff --git a/suixinkan/Features/Payment/Models/PaymentModels.swift b/suixinkan/Features/Payment/Models/PaymentModels.swift index 6fc2b1a..4f004c0 100644 --- a/suixinkan/Features/Payment/Models/PaymentModels.swift +++ b/suixinkan/Features/Payment/Models/PaymentModels.swift @@ -35,6 +35,14 @@ struct PayPageConfig: Codable, Sendable, Equatable { subtitle: "那拉提景区" ) + /// 赛里木湖景区随包默认文案,图片由展示层选择本地资源。 + static let sailimuDefault = PayPageConfig( + background: "", + logo: "", + title: "赛里木湖旅拍管理\n收费平台", + subtitle: "赛里木湖景区" + ) + /// 将服务端非空有效字段合并到当前可用配置。 func merging(_ response: PayPageConfigResponse) -> PayPageConfig { PayPageConfig( @@ -61,10 +69,22 @@ enum PayPageBrandingPolicy { /// 那拉提景区正式 ID。 static let nalatiScenicId = 128 - /// 判断当前景区是否启用品牌收款页。 + /// 赛里木湖景区正式 ID。 + static let sailimuScenicId = 125 + + /// 判断当前景区是否为那拉提。 static func isNalati(scenicId: Int) -> Bool { scenicId == nalatiScenicId } + + /// 返回支持品牌收款页的景区默认配置;其他景区继续使用普通页面。 + static func defaultConfig(scenicId: Int) -> PayPageConfig? { + switch scenicId { + case nalatiScenicId: return .nalatiDefault + case sailimuScenicId: return .sailimuDefault + default: return nil + } + } } /// 收款页当前账号信息的展示文本格式化规则。 diff --git a/suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift b/suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift index 26fec58..ba77499 100644 --- a/suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift +++ b/suixinkan/Features/Payment/ViewModels/PaymentCollectionDetailsViewModel.swift @@ -42,9 +42,7 @@ final class PaymentCollectionDetailsViewModel { scenicName = appStore.session.currentScenicName staffId = appStore.session.userId isVoiceBroadcastOpen = appStore.payment.isOpenReceiveVoice - if PayPageBrandingPolicy.isNalati(scenicId: scenicId) { - payPageConfig = payPageConfigCache.config(scenicId: scenicId) ?? .nalatiDefault - } + restorePayPageConfig() } var hasPayCode: Bool { @@ -60,8 +58,26 @@ final class PaymentCollectionDetailsViewModel { scenicName.isEmpty ? "暂无景区" : scenicName } - var usesNalatiBranding: Bool { - PayPageBrandingPolicy.isNalati(scenicId: scenicId) + /// 是否启用品牌收款页,包含那拉提与赛里木湖。 + var usesBranding: Bool { + PayPageBrandingPolicy.defaultConfig(scenicId: scenicId) != nil + } + + /// 当前景区的随包背景资源名称。 + var brandBackgroundAssetName: String { + scenicId == PayPageBrandingPolicy.sailimuScenicId + ? "payment_sailimu_background" : "payment_nalati_background" + } + + /// 当前景区的随包 Logo 资源名称。 + var brandLogoAssetName: String { + scenicId == PayPageBrandingPolicy.sailimuScenicId + ? "payment_sailimu_logo" : "payment_nalati_logo" + } + + /// 品牌主标题的最大行数,赛里木湖允许两行展示。 + var brandTitleNumberOfLines: Int { + scenicId == PayPageBrandingPolicy.sailimuScenicId ? 2 : 1 } var displayPhotographerName: String { @@ -80,14 +96,18 @@ final class PaymentCollectionDetailsViewModel { scenicName = appStore.session.currentScenicName staffId = appStore.session.userId isVoiceBroadcastOpen = appStore.payment.isOpenReceiveVoice - if usesNalatiBranding { - payPageConfig = payPageConfigCache.config(scenicId: scenicId) ?? .nalatiDefault - } else { - payPageConfig = .nalatiDefault - } + restorePayPageConfig() notifyStateChange() } + private func restorePayPageConfig() { + guard let defaults = PayPageBrandingPolicy.defaultConfig(scenicId: scenicId) else { + payPageConfig = .nalatiDefault + return + } + payPageConfig = payPageConfigCache.config(scenicId: scenicId) ?? defaults + } + func loadPayCode(api: PaymentAPI) async { guard !loading else { return } loading = true @@ -116,12 +136,14 @@ final class PaymentCollectionDetailsViewModel { func loadPayPageConfig(api: PaymentAPI) async { let requestedScenicId = appStore.session.currentScenicId - guard PayPageBrandingPolicy.isNalati(scenicId: requestedScenicId) else { return } + guard let defaults = PayPageBrandingPolicy.defaultConfig(scenicId: requestedScenicId) else { return } do { let response = try await api.payPageConfig(scenicId: requestedScenicId) - guard appStore.session.currentScenicId == requestedScenicId else { return } - let resolved = payPageConfig.merging(response) + guard appStore.session.currentScenicId == requestedScenicId, + scenicId == requestedScenicId else { return } + let cached = payPageConfigCache.config(scenicId: requestedScenicId) ?? defaults + let resolved = cached.merging(response) payPageConfigCache.save(resolved, scenicId: requestedScenicId) payPageConfig = resolved brandingRefreshVersion += 1 diff --git a/suixinkan/Features/Profile/ViewModels/ProfileViewModel.swift b/suixinkan/Features/Profile/ViewModels/ProfileViewModel.swift index 951f08f..011c413 100644 --- a/suixinkan/Features/Profile/ViewModels/ProfileViewModel.swift +++ b/suixinkan/Features/Profile/ViewModels/ProfileViewModel.swift @@ -70,6 +70,11 @@ final class ProfileViewModel { AppStore.shared.session.accountType == .storeUser } + /// 我的培训入口使用当前账号最新菜单权限,业务访问资格由点击路由和接口校验。 + var showsTrainingEntry: Bool { + AppStore.shared.permissions.permissionItems().contains { HomeMenuCatalog.canonicalURI(for: $0.uri) == "/training" } + } + var currentScenicName: String { let name = AppStore.shared.session.currentScenicName.trimmingCharacters(in: .whitespacesAndNewlines) return name.isEmpty ? "--" : name diff --git a/suixinkan/Features/ScenicMaterials/API/ScenicMaterialsAPI.swift b/suixinkan/Features/ScenicMaterials/API/ScenicMaterialsAPI.swift new file mode 100644 index 0000000..62f78ac --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/API/ScenicMaterialsAPI.swift @@ -0,0 +1,45 @@ +import Foundation + +/// 景区空境库的只读场次及详情接口,素材下载不回写订单素材状态。 +protocol ScenicMaterialsServing: Sendable { + /// 按当前景区及筛选分页读取场次。 + @MainActor + func sessions(query: ScenicMaterialsQuery) async throws -> ScenicMaterialsSessionsResponse + /// 使用场次身份读取完整片段信息和授权文件地址。 + @MainActor + func sessionDetail(scenicMediaID: Int) async throws -> ScenicMaterialsSessionDetailResponse +} + +/// 朱工景区空境库接口,复用部署环境验证过的 token 鉴权和统一业务包。 +@MainActor +final class ScenicMaterialsAPI: ScenicMaterialsServing { + private let client: APIClient + + /// 注入统一网络客户端,单元测试可使用 MockURLSession。 + init(client: APIClient) { self.client = client } + + /// 验证请求范围及响应页码,避免拼入其他页或其他筛选的数据。 + func sessions(query: ScenicMaterialsQuery) async throws -> ScenicMaterialsSessionsResponse { + let response: ScenicMaterialsSessionsResponse = try await client.send(APIRequest( + method: .get, path: "/api/app/scenic-media/sessions", queryItems: try query.queryItems(), + redactedLogCategory: "景区空境库" + )) + guard response.page == query.page, response.pageSize == query.pageSize, + response.retentionDays == query.retentionDays, + response.filter.airLineID == (query.airLineID ?? 0), + response.filter.dateFrom == (query.dateFrom ?? ""), response.filter.dateTo == (query.dateTo ?? "") else { + throw APIError.decodeFailed("空境库场次与当前查询条件不一致,请刷新重试") + } + return response + } + + /// 只传文档定义的 scenic_media_id,不传订单、任务或机巢身份。 + func sessionDetail(scenicMediaID: Int) async throws -> ScenicMaterialsSessionDetailResponse { + guard scenicMediaID > 0 else { throw APIError.networkFailed("空境场次无效,请刷新重试") } + return try await client.send(APIRequest( + method: .get, path: "/api/app/scenic-media/session-detail", + queryItems: [URLQueryItem(name: "scenic_media_id", value: String(scenicMediaID))], + redactedLogCategory: "景区空境库" + )) + } +} diff --git a/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialDatePickerOptions.swift b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialDatePickerOptions.swift new file mode 100644 index 0000000..d6c5732 --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialDatePickerOptions.swift @@ -0,0 +1,74 @@ +import Foundation + +/// 为月、日两列滚轮提供保留期内的真实日期,月份保留年份以正确处理跨年。 +struct ScenicMaterialDatePickerOptions { + /// 一个月中实际可选的日期;首月和末月只包含保留期覆盖的部分。 + struct Month { + /// 日历中的年份,供跨年识别及辅助功能使用。 + let year: Int + /// 日历中的月份。 + let number: Int + /// 当前月份内按先后排列且允许选择的日期。 + let dates: [Date] + } + + /// 包含端点、按日归一化的最早日期。 + let minimumDate: Date + /// 包含端点、按日归一化的最晚日期。 + let maximumDate: Date + /// 从最早到最晚排列的可选月份。 + let months: [Month] + private let calendar: Calendar + + /// 将闭区间展开为有限选项,不依赖每月天数或一天固定为 24 小时的假设。 + init(minimumDate: Date, maximumDate: Date, calendar: Calendar) { + self.calendar = calendar + let minimum = calendar.startOfDay(for: minimumDate) + let maximum = max(minimum, calendar.startOfDay(for: maximumDate)) + self.minimumDate = minimum + self.maximumDate = maximum + var months: [Month] = [] + var day = minimum + while day <= maximum { + let year = calendar.component(.year, from: day) + let number = calendar.component(.month, from: day) + if let last = months.last, last.year == year, last.number == number { + months[months.count - 1] = Month(year: year, number: number, dates: last.dates + [day]) + } else { + months.append(Month(year: year, number: number, dates: [day])) + } + guard let next = calendar.date(byAdding: .day, value: 1, to: day), next > day else { break } + day = next + } + self.months = months + } + + /// 将外部值归一到允许范围内的日历日。 + func clamped(_ date: Date) -> Date { + min(max(calendar.startOfDay(for: date), minimumDate), maximumDate) + } + + /// 找到日期对应的月份行,保留期外值先收敛到边界。 + func monthIndex(for date: Date) -> Int { + let value = clamped(date) + return months.firstIndex { month in + month.dates.first.map { $0 <= value } == true && month.dates.last.map { value <= $0 } == true + } ?? 0 + } + + /// 切换月份时尽量保留原日号;月末或截断的保留期会收敛到最近可选日。 + func date(inMonthAt index: Int, preferredDay: Int) -> Date { + let month = months[min(max(index, 0), months.count - 1)] + return month.dates.min { + abs(calendar.component(.day, from: $0) - preferredDay) + < abs(calendar.component(.day, from: $1) - preferredDay) + } ?? minimumDate + } + + /// 普通范围只显示月份;范围含同名月份时补年份,避免用户混淆。 + func monthTitle(at index: Int) -> String { + let month = months[index] + let repeats = months.filter { $0.number == month.number }.count > 1 + return repeats ? "\(month.year)年\(month.number)月" : "\(month.number)月" + } +} diff --git a/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialModels.swift b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialModels.swift new file mode 100644 index 0000000..ab4d058 --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialModels.swift @@ -0,0 +1,173 @@ +import Foundation + +/// 景区空镜库的独立访问上下文,不依赖拍摄订单、机巢或无人机任务。 +struct ScenicMaterialContext: Hashable, Sendable { + /// 当前账号标识,用于隔离本机演示状态。 + let userID: String + /// 当前景区稳定标识。 + let scenicID: String + /// 当前景区的展示名称。 + let scenicName: String + + /// 创建空镜库上下文;不会改写 App 的真实登录或景区会话。 + init(userID: String, scenicID: String, scenicName: String) { + self.userID = userID + self.scenicID = scenicID + self.scenicName = scenicName + } + + /// 仅供独立页面预览的演示身份。 + static let demo = ScenicMaterialContext(userID: "scenic-demo-user", scenicID: "scenic-demo-songshan", scenicName: "嵩山少林景区") +} + +/// 景区空镜航线,不以名称匹配游客拍摄航线。 +struct ScenicMaterialRoute: Hashable, Sendable { + /// 航线稳定标识。 + let id: String + /// 航线展示名称。 + let name: String + + /// 创建可供筛选的独立空镜航线。 + init(id: String, name: String) { + self.id = id + self.name = name + } +} + +/// 一次空镜拍摄批次;完整片段列表独立于 UI 是否折叠。 +struct ScenicMaterialGroup: Hashable, Sendable { + /// 批次稳定标识。 + let id: String + /// 所属空镜航线标识。 + let routeID: String + /// 批次拍摄时间,用于日期筛选和航线内排序。 + let capturedAt: Date + /// 批次完整片段列表,整组选择包含未展开片段。 + let clips: [ScenicMaterialClip] + + /// 创建一组完整空镜片段。 + init(id: String, routeID: String, capturedAt: Date, clips: [ScenicMaterialClip]) { + self.id = id + self.routeID = routeID + self.capturedAt = capturedAt + self.clips = clips + } +} + +/// 单个空镜视频片段的内容元数据;下载演示状态另由 ViewModel 管理。 +struct ScenicMaterialClip: Hashable, Sendable { + /// 在当前访问上下文中稳定且唯一的片段标识。 + let id: String + /// 所属拍摄批次标识。 + let groupID: String + /// 组内从 1 开始的片段序号。 + let ordinal: Int + /// 原片段时长,单位为秒;-1 表示接口没有有效数值。 + let durationSeconds: Int + /// 原片段展示大小,单位为字节。 + let fileSizeBytes: Int64 + /// 保留原片段分辨率元数据,页面不展示。 + let resolution: String + /// 本地演示封面资源名。 + let coverAssetName: String + /// 正式素材原片地址;预览素材为空。 + let remoteURL: URL? + /// 正式素材封面地址。 + let coverURL: URL? + /// 后端返回的片段名称。 + let fileLabel: String? + /// 是否来自正式接口,缺失地址时禁止回退到演示视频。 + let isRemote: Bool + /// 文件是否仍可预览和下载;不可用文件仍可展示其元数据。 + let isAvailable: Bool + + /// 创建片段元数据,不读取本地相册或请求网络。 + init(id: String, groupID: String, ordinal: Int, durationSeconds: Int, fileSizeBytes: Int64, + resolution: String, coverAssetName: String, isAvailable: Bool = true, + remoteURL: URL? = nil, coverURL: URL? = nil, fileLabel: String? = nil, isRemote: Bool = false) { + self.id = id + self.groupID = groupID + self.ordinal = ordinal + self.durationSeconds = durationSeconds + self.fileSizeBytes = fileSizeBytes + self.resolution = resolution + self.coverAssetName = coverAssetName + self.isAvailable = isAvailable + self.remoteURL = remoteURL + self.coverURL = coverURL + self.fileLabel = fileLabel + self.isRemote = isRemote + } + + /// 用于封面与预览信息的时长;超过一小时显示时分秒,保留后端秒数语义。 + var durationText: String { + guard durationSeconds >= 0 else { return "时长未知" } + let value = max(durationSeconds, 0) + if value >= 3_600 { + return String(format: "%02lld:%02lld:%02lld", Int64(value / 3_600), Int64(value / 60 % 60), Int64(value % 60)) + } + return String(format: "%02lld:%02lld", Int64(value / 60), Int64(value % 60)) + } + + /// 使用十进制 MB 展示片段大小,避免将原文件与本地示例文件混淆。 + var sizeText: String { + guard fileSizeBytes >= 0 else { return "大小未知" } + let megabytes = Double(max(fileSizeBytes, 0)) / 1_000_000 + return megabytes.rounded() == megabytes ? String(format: "%.0fMB", megabytes) : String(format: "%.1fMB", megabytes) + } +} + +/// 已规范化到日历日的闭区间筛选范围。 +struct ScenicMaterialDateRange: Hashable, Sendable { + /// 起始日的零点,包含该日全部记录。 + let start: Date + /// 结束日的零点,包含该日全部记录。 + let end: Date + + /// 由 ViewModel 校验并规范化日期后创建。 + init(start: Date, end: Date) { + self.start = start + self.end = end + } +} + +/// 本机批量下载演示的阶段,不代表服务器或系统相册已完成操作。 +enum ScenicMaterialDownloadPhase: String, Hashable, Sendable { + case idle, downloading, paused, partialFailure, completed +} + +/// 单个演示片段的本机状态,供列表显示,不写入服务端素材模型。 +enum ScenicMaterialDownloadState: Hashable, Sendable { + case available + case downloading(progress: Double) + case paused + case failed + case completed + case unavailable +} + +/// 演示驱动对当前批次单项的回执;所有成功只表示本地 UI 演示完成。 +enum ScenicMaterialTransferEvent: Sendable { + case progress(Double) + case completed + case failed +} + +/// 独立空镜库的可复现演示场景,不改变真实权限、订单或设备状态。 +enum ScenicMaterialsScenario: String, CaseIterable, Sendable { + case normal, selected, downloading, completed, partialFailure, paused, empty, noResults + + /// Debug 状态菜单的展示名称。 + var title: String { + switch self { + case .normal: "正常素材列表" + case .selected: "已选两段" + case .downloading: "下载中" + case .completed: "下载演示完成" + case .partialFailure: "部分下载失败" + case .paused: "下载已暂停" + case .empty: "暂无景区素材" + case .noResults: "筛选无结果" + } + } +} diff --git a/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsAPIModels.swift b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsAPIModels.swift new file mode 100644 index 0000000..b7ea57c --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsAPIModels.swift @@ -0,0 +1,113 @@ +import Foundation + +/// 场次接口中已由部署响应确认的分页和保留策略;子项保留原始字段供合同映射使用。 +struct ScenicMaterialsSessionsResponse: Decodable, Equatable, Sendable { + /// 当前页场次原始对象,不能把未确认的子项结构当成空列表。 + let list: [[String: ScenicMaterialsJSONValue]] + /// 服务端航线分组原始对象。 + let groups: [[String: ScenicMaterialsJSONValue]] + /// 当前筛选场次总数。 + let total: Int + /// 服务端实际返回的页码。 + let page: Int + /// 服务端实际返回的每页数量。 + let pageSize: Int + /// 本次查询的素材保留窗口。 + let retentionDays: Int + /// 服务端提供的保留期提示。 + let retentionTips: String + /// 服务端实际应用的筛选。 + let filter: ScenicMaterialsFilter + /// 当前景区可用的航线筛选对象。 + let airLines: [[String: ScenicMaterialsJSONValue]] + + /// 部署接口的根字段。 + private enum CodingKeys: String, CodingKey { + case list, groups, total, page, pageSize = "page_size", retentionDays = "retention_days" + case retentionTips = "retention_tips", filter, filterOptions = "filter_options" + } + + /// 只接受真实容器和有效分页,避免缺字段响应被误显示成空态。 + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + list = try container.decode([[String: ScenicMaterialsJSONValue]].self, forKey: .list) + groups = try container.decode([[String: ScenicMaterialsJSONValue]].self, forKey: .groups) + total = try container.decode(Int.self, forKey: .total) + page = try container.decode(Int.self, forKey: .page) + pageSize = try container.decode(Int.self, forKey: .pageSize) + retentionDays = try container.decode(Int.self, forKey: .retentionDays) + retentionTips = try container.decode(String.self, forKey: .retentionTips) + filter = try container.decode(ScenicMaterialsFilter.self, forKey: .filter) + airLines = try container.decode(ScenicMaterialsFilterOptions.self, forKey: .filterOptions).airLines + guard total >= 0, page > 0, (1...100).contains(pageSize), (1...365).contains(retentionDays), + list.count <= pageSize, list.count <= total else { + throw DecodingError.dataCorruptedError(forKey: .list, in: container, debugDescription: "空境库场次分页或保留期无效") + } + } +} + +/// 后端实际应用的筛选,全部航线为 0、全部日期为空字符串。 +struct ScenicMaterialsFilter: Decodable, Equatable, Sendable { + /// 当前航线筛选值。 + let airLineID: Int + /// 当前起始日期筛选值。 + let dateFrom: String + /// 当前结束日期筛选值。 + let dateTo: String + + /// 部署响应中的筛选字段。 + private enum CodingKeys: String, CodingKey { + case airLineID = "air_line_id", dateFrom = "date_from", dateTo = "date_to" + } +} + +/// filter_options 下独立返回当前景区的航线集合。 +private struct ScenicMaterialsFilterOptions: Decodable { + let airLines: [[String: ScenicMaterialsJSONValue]] + /// 部署响应中的航线容器。 + private enum CodingKeys: String, CodingKey { case airLines = "air_lines" } +} + +/// 场次详情的已确认素材数组及完整场次信息,不借用订单素材 ID 模型。 +struct ScenicMaterialsSessionDetailResponse: Decodable, Equatable, Sendable { + /// 文档明确返回的全部素材项,保留服务端所有字段。 + let materials: [[String: ScenicMaterialsJSONValue]] + /// 场次详情完整对象,供依据实际合同解码归属与展示信息。 + let fields: [String: ScenicMaterialsJSONValue] + + /// 缺少 materials 或容器错误时报错,不伪装成没有素材。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + fields = try container.decode([String: ScenicMaterialsJSONValue].self) + guard case let .array(values)? = fields["materials"] else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "空境场次详情缺少 materials 数组") + } + materials = try values.map { value in + guard case let .object(fields) = value else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "空境素材必须为对象") + } + return fields + } + } +} + +/// 保留空境库尚未完整描述的子项 JSON,不猜测字段类型或单位。 +indirect enum ScenicMaterialsJSONValue: Decodable, Equatable, Sendable { + case object([String: ScenicMaterialsJSONValue]) + case array([ScenicMaterialsJSONValue]) + case string(String) + case number(Decimal) + case bool(Bool) + case null + + /// 按真实 JSON 类型读取,未知字段不会静默丢失。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if container.decodeNil() { self = .null } + else if let value = try? container.decode(Bool.self) { self = .bool(value) } + else if let value = try? container.decode(String.self) { self = .string(value) } + else if let value = try? container.decode(Decimal.self) { self = .number(value) } + else if let value = try? container.decode([String: ScenicMaterialsJSONValue].self) { self = .object(value) } + else { self = .array(try container.decode([ScenicMaterialsJSONValue].self)) } + } +} diff --git a/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsQuery.swift b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsQuery.swift new file mode 100644 index 0000000..d844177 --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsQuery.swift @@ -0,0 +1,67 @@ +import Foundation + +/// 朱工空境库场次查询范围,分页和筛选均由服务端执行。 +struct ScenicMaterialsQuery: Equatable, Sendable { + /// 当前景区身份,不依赖订单、机巢或飞行任务。 + let scenicID: Int + /// 从 1 开始的场次页码。 + let page: Int + /// 每页场次数,接口允许 1 到 100。 + let pageSize: Int + /// 指定航线;nil 表示全部航线。 + let airLineID: Int? + /// 可选起始日期,格式为 yyyy-MM-dd。 + let dateFrom: String? + /// 可选结束日期,格式为 yyyy-MM-dd。 + let dateTo: String? + /// 保留期查询窗口,默认 90 天,部署接口允许 1 到 365。 + let retentionDays: Int + + /// 创建完整查询快照,便于判断翻页和筛选请求是否过期。 + init(scenicID: Int, page: Int = 1, pageSize: Int = 20, airLineID: Int? = nil, + dateFrom: String? = nil, dateTo: String? = nil, retentionDays: Int = 90) { + self.scenicID = scenicID + self.page = page + self.pageSize = pageSize + self.airLineID = airLineID + self.dateFrom = dateFrom + self.dateTo = dateTo + self.retentionDays = retentionDays + } + + /// 校验范围后生成文档规定的 GET 参数,全部航线和全部日期不发送占位值。 + func queryItems() throws -> [URLQueryItem] { + guard scenicID > 0 else { throw APIError.networkFailed("请先选择景区") } + guard page > 0, (1...100).contains(pageSize), (1...365).contains(retentionDays), + airLineID.map({ $0 > 0 }) ?? true else { + throw APIError.networkFailed("景区空境库查询参数无效") + } + guard Self.isValidDate(dateFrom), Self.isValidDate(dateTo) else { + throw APIError.networkFailed("请选择有效的日期范围") + } + if let dateFrom, let dateTo, dateFrom > dateTo { + throw APIError.networkFailed("请选择有效的日期范围") + } + var result = [URLQueryItem(name: "scenic_id", value: String(scenicID)), + URLQueryItem(name: "page", value: String(page)), + URLQueryItem(name: "page_size", value: String(pageSize)), + URLQueryItem(name: "retention_days", value: String(retentionDays))] + if let airLineID { result.append(URLQueryItem(name: "air_line_id", value: String(airLineID))) } + if let dateFrom { result.append(URLQueryItem(name: "date_from", value: dateFrom)) } + if let dateTo { result.append(URLQueryItem(name: "date_to", value: dateTo)) } + return result + } + + /// 严格校验公历日期,拒绝 DateFormatter 自动纠正的越界日期。 + private static func isValidDate(_ value: String?) -> Bool { + guard let value else { return true } + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .gregorian) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd" + formatter.isLenient = false + guard let date = formatter.date(from: value) else { return false } + return formatter.string(from: date) == value + } +} diff --git a/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsRemoteMapper.swift b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsRemoteMapper.swift new file mode 100644 index 0000000..16d1ec6 --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsRemoteMapper.swift @@ -0,0 +1,153 @@ +import Foundation + +/// sessions 返回的一次真实场次摘要,持有读取详情所需的身份及已确认展示字段。 +struct ScenicMaterialsRemoteSession: Equatable, Sendable { + /// 空境场次身份,对应 scenic_media_id。 + let id: Int + /// 场次所属景区,用于拒绝跨景区素材。 + let scenicID: Int + /// 所属航线的稳定身份。 + let routeID: String + /// 后端提供的航线展示名称。 + let routeName: String + /// 场次开始拍摄时间,按页面业务时区解析。 + let capturedAt: Date + /// 列表返回的素材数量,详情加载后使用完整素材数组。 + let materialCount: Int +} + +/// 将 2026-10-30 实测场次和详情字段转换为页面模型,不读取网络或生成演示素材。 +enum ScenicMaterialsRemoteMapper { + /// 从分页 list 读取场次,验证当前景区、唯一身份及真实拍摄时间。 + static func sessions(from response: ScenicMaterialsSessionsResponse, scenicID: Int, + calendar: Calendar) throws -> [ScenicMaterialsRemoteSession] { + guard scenicID > 0 else { throw invalid("景区身份无效") } + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .gregorian) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = calendar.timeZone + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + formatter.isLenient = false + var seen = Set() + return try response.list.map { fields in + let id = try positiveInteger(fields["scenic_media_id"], field: "场次身份") + let returnedScenicID = try positiveInteger(fields["scenic_id"], field: "景区身份") + guard returnedScenicID == scenicID else { throw invalid("场次不属于当前景区") } + guard seen.insert(id).inserted else { throw invalid("场次身份重复") } + let routeID = try positiveInteger(fields["air_line_id"], field: "航线身份") + let routeName = try routeName(fields) + guard let timestamp = string(fields["log_stime"]), + let date = formatter.date(from: timestamp), formatter.string(from: date) == timestamp else { + throw invalid("场次拍摄时间无效") + } + let count = try nonnegativeInteger(fields["material_count"], field: "场次素材数量") + return ScenicMaterialsRemoteSession(id: id, scenicID: returnedScenicID, routeID: String(routeID), + routeName: routeName, capturedAt: date, materialCount: count) + } + } + + /// 航线筛选只使用服务端 filter_options,保留服务端排序和名称。 + static func routes(from response: ScenicMaterialsSessionsResponse) throws -> [ScenicMaterialRoute] { + var seen = Set() + return try response.airLines.map { fields in + let id = try positiveInteger(fields["air_line_id"], field: "航线身份") + guard seen.insert(id).inserted else { throw invalid("航线身份重复") } + return ScenicMaterialRoute(id: String(id), name: try routeName(fields)) + } + } + + /// 校验详情及素材归属,再生成可预览和下载的完整批次;缺地址的文件保持不可用。 + static func group(session: ScenicMaterialsRemoteSession, + detail: ScenicMaterialsSessionDetailResponse) throws -> ScenicMaterialGroup { + guard case let .object(identity)? = detail.fields["session"], + try positiveInteger(identity["scenic_media_id"], field: "详情场次身份") == session.id, + try positiveInteger(identity["scenic_id"], field: "详情景区身份") == session.scenicID, + String(try positiveInteger(identity["air_line_id"], field: "详情航线身份")) == session.routeID else { + throw invalid("素材详情与请求的场次或景区不一致") + } + if let value = detail.fields["material_count"] { + guard try nonnegativeInteger(value, field: "详情素材数量") == detail.materials.count else { + throw invalid("场次详情的素材数量不完整") + } + } + var seen = Set() + let groupID = String(session.id) + let clips = try detail.materials.map { fields in + guard try positiveInteger(fields["scenic_media_id"], field: "素材场次身份") == session.id else { + throw invalid("素材不属于当前场次") + } + let id = try positiveInteger(fields["id"], field: "素材身份") + guard seen.insert(id).inserted else { throw invalid("素材身份重复") } + let ordinal: Int + if let value = string(fields["clip_no"]), let parsed = Int(value), parsed > 0 { + ordinal = parsed + } else { + ordinal = try positiveInteger(fields["clip_no"], field: "片段序号") + } + let remoteURL = mediaURL(fields["oss_url"]) + let coverURL = mediaURL(fields["cover_url"]) + let fileSize = integer64(fields["size_bytes"]).flatMap { $0 >= 0 ? $0 : nil } ?? -1 + let duration = integer64(fields["duration_seconds"]).flatMap { $0 >= 0 ? Int(exactly: $0) : nil } ?? -1 + let isVideo = integer64(fields["file_type"]) == 2 + let isAvailable = isVideo && fields["selectable"] == .bool(true) + && fields["downloadable"] == .bool(true) && remoteURL != nil + return ScenicMaterialClip(id: "scenic-media:\(session.id):\(id)", groupID: groupID, ordinal: ordinal, + durationSeconds: duration, fileSizeBytes: fileSize, resolution: "分辨率未知", + coverAssetName: "", isAvailable: isAvailable, remoteURL: remoteURL, + coverURL: coverURL, fileLabel: string(fields["file_label"]), isRemote: true) + } + return ScenicMaterialGroup(id: groupID, routeID: session.routeID, capturedAt: session.capturedAt, + clips: clips.sorted { $0.ordinal < $1.ordinal }) + } + + /// 接口明确提供 route_label,空值时使用同一航线的原始名称。 + private static func routeName(_ fields: [String: ScenicMaterialsJSONValue]) throws -> String { + guard let name = string(fields["route_label"]) ?? string(fields["air_line_name"]) else { + throw invalid("航线名称缺失") + } + return name + } + + /// 只接受可表达的整数,拒绝小数截断及越界转换。 + private static func integer64(_ value: ScenicMaterialsJSONValue?) -> Int64? { + guard case let .number(number)? = value else { return nil } + let integer = NSDecimalNumber(decimal: number).int64Value + return number == Decimal(integer) ? integer : nil + } + + /// 读取不允许为零的业务身份。 + private static func positiveInteger(_ value: ScenicMaterialsJSONValue?, field: String) throws -> Int { + guard let number = integer64(value), number > 0, let result = Int(exactly: number) else { + throw invalid("\(field)无效") + } + return result + } + + /// 数量允许为零,但必须是有效整数。 + private static func nonnegativeInteger(_ value: ScenicMaterialsJSONValue?, field: String) throws -> Int { + guard let number = integer64(value), number >= 0, let result = Int(exactly: number) else { + throw invalid("\(field)无效") + } + return result + } + + /// 空白文本作为缺失字段处理,不把其他 JSON 类型强制转成文本。 + private static func string(_ value: ScenicMaterialsJSONValue?) -> String? { + guard case let .string(text)? = value else { return nil } + let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines) + return trimmed.isEmpty ? nil : trimmed + } + + /// 远程媒体仅接受 HTTP(S),保留原始签名查询值供播放器和下载器使用。 + private static func mediaURL(_ value: ScenicMaterialsJSONValue?) -> URL? { + guard let text = string(value), let url = URL(string: text), + let scheme = url.scheme?.lowercased(), ["https", "http"].contains(scheme), + let host = url.host, !host.isEmpty else { return nil } + return url + } + + /// 统一映射失败为可重试的解析错误,不让错误字段变成演示数据或空库。 + private static func invalid(_ reason: String) -> APIError { + .decodeFailed("景区空境库数据异常:\(reason),请刷新重试") + } +} diff --git a/suixinkan/Features/ScenicMaterials/Services/ScenicMaterialDownloadService.swift b/suixinkan/Features/ScenicMaterials/Services/ScenicMaterialDownloadService.swift new file mode 100644 index 0000000..433ca8d --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/Services/ScenicMaterialDownloadService.swift @@ -0,0 +1,198 @@ +import Foundation +import Photos + +/// 一项待保存的空境素材;身份仅在当前账号、景区页面的服务实例内使用。 +struct ScenicMaterialDownloadItem: Sendable { + /// 当前素材的稳定标识。 + let id: String + /// 服务端提供的可下载原片地址。 + let remoteURL: URL + /// 本地临时文件名,保留媒体扩展名以便 Photos 识别。 + let fileName: String + /// 与相册保存器一致:1 为视频,其他值为图片。 + let fileType: Int + + /// 创建下载项,不附加 App 登录凭证到 OSS 地址。 + init(id: String, remoteURL: URL, fileName: String = "scenic-material.mp4", fileType: Int = 1) { + self.id = id + self.remoteURL = remoteURL + self.fileName = fileName + self.fileType = fileType + } +} + +/// 串行下载并保存真实空境素材;取消后屏蔽旧回执,已保存的文件不重复写入相册。 +@MainActor +final class ScenicMaterialDownloadService { + private let downloader: any CloudFileDownloading + private let photoSaver: any CloudPhotoSaving + private var task: Task? + private var activeBatchID: UUID? + private var savedIDs = Set() + + /// 注入下载和相册保存依赖,测试不访问网络或系统相册。 + init(downloader: any CloudFileDownloading = ScenicMaterialURLSessionDownloader(), + photoSaver: any CloudPhotoSaving = ScenicMaterialPhotoLibrarySaver()) { + self.downloader = downloader + self.photoSaver = photoSaver + } + + /// 开始当前批次;同一批次的重复启动无效,重新启动会等待前次相册事务结束。 + func start(items: [ScenicMaterialDownloadItem], batchID: UUID, + onEvent: @escaping @MainActor @Sendable (String, UUID, ScenicMaterialTransferEvent) -> Void, + onFailure: (@MainActor @Sendable (String, Error) -> Void)? = nil) { + guard activeBatchID != batchID else { return } + let previous = task + previous?.cancel() + activeBatchID = batchID + task = Task { @MainActor [weak self] in + // Photos 的已提交保存不可取消;先等旧事务落定,再决定是否需要重下。 + await previous?.value + guard let self else { return } + defer { if self.activeBatchID == batchID { self.activeBatchID = nil } } + var visited = Set() + for item in items where visited.insert(item.id).inserted { + guard self.isActive(batchID) else { return } + if self.savedIDs.contains(item.id) { + onEvent(item.id, batchID, .completed) + continue + } + var localURL: URL? + defer { if let localURL { try? FileManager.default.removeItem(at: localURL) } } + do { + localURL = try await self.downloader.downloadFile(remoteURL: item.remoteURL.absoluteString, + fileName: item.fileName) { [weak self] percent in + Task { @MainActor [weak self] in + guard let self, self.isActive(batchID), !self.savedIDs.contains(item.id) else { return } + // 下载完成只占 90%,最后一步是系统相册保存成功。 + onEvent(item.id, batchID, .progress(Double(min(max(percent, 0), 100)) / 100 * 0.9)) + } + } + guard self.isActive(batchID), let localURL else { return } + try await self.photoSaver.saveToPhotoLibrary(fileURL: localURL, fileType: item.fileType) + // 保存已落定,即便用户此时暂停,也保留事实以免继续时重复保存。 + self.savedIDs.insert(item.id) + guard self.isActive(batchID) else { return } + onEvent(item.id, batchID, .completed) + } catch { + guard self.isActive(batchID) else { return } + onEvent(item.id, batchID, .failed) + onFailure?(item.id, error) + } + } + } + } + + /// 停止下载并作废当前回执;正在提交的相册事务完成后会清理临时文件。 + func stop() { + activeBatchID = nil + task?.cancel() + } + + /// 等待已经启动的传输及临时文件清理完成。 + func waitForPendingOperations() async { await task?.value } + + private func isActive(_ batchID: UUID) -> Bool { + !Task.isCancelled && activeBatchID == batchID + } +} + +/// 检查 HTTP 状态与非空响应文件的空境原片下载器。 +struct ScenicMaterialURLSessionDownloader: CloudFileDownloading { + private let session: URLSession + private let logSink: @Sendable (String) -> Void + + /// 注入 URLSession 便于使用 URLProtocol 验证状态码及错误响应。 + init(session: URLSession = .shared, logSink: @escaping @Sendable (String) -> Void = DroneDockDiagnostics.write) { + self.session = session + self.logSink = logSink + } + + /// 下载到唯一临时路径;失败响应及取消下载均清理 URLSession 临时文件。 + func downloadFile(remoteURL: String, fileName: String, + onProgress: @escaping @Sendable (Int) -> Void) async throws -> URL { + guard let url = URL(string: remoteURL), ["https", "http"].contains(url.scheme?.lowercased() ?? ""), + url.host != nil else { throw ScenicMaterialDownloadError.invalidURL } + let trace = DroneDockFileTransferTrace(operation: "file_download", method: "GET", remoteURL: url) + logSink(trace.message("request.started")) + let temporaryURL: URL + let response: URLResponse + do { + let delegate = ScenicMaterialDownloadProgress(onProgress: onProgress) + (temporaryURL, response) = try await session.download(from: url, delegate: delegate) + } catch { + let cancelled = error is CancellationError || (error as? URLError)?.code == .cancelled + logSink(trace.message(cancelled ? "request.cancelled" : "request.failed", + fields: DroneDockDiagnostics.errorFields(error))) + throw error + } + defer { try? FileManager.default.removeItem(at: temporaryURL) } + let receivedSize = (try? FileManager.default.attributesOfItem(atPath: temporaryURL.path)[.size] as? NSNumber)?.int64Value ?? 0 + logSink(trace.message("response.received", fields: [ + "http_status": (response as? HTTPURLResponse)?.statusCode ?? 0, + "response_headers": (response as? HTTPURLResponse)?.allHeaderFields.reduce(into: [String: String]()) { + $0[String(describing: $1.key)] = String(describing: $1.value) + } ?? [:], + "bytes": receivedSize, "content_type": response.mimeType ?? "unknown", "body": "" + ])) + try Task.checkCancellation() + guard let response = response as? HTTPURLResponse, (200..<300).contains(response.statusCode) else { + throw ScenicMaterialDownloadError.httpFailure((response as? HTTPURLResponse)?.statusCode ?? 0) + } + let attributes = try FileManager.default.attributesOfItem(atPath: temporaryURL.path) + guard (attributes[.size] as? NSNumber)?.int64Value ?? 0 > 0 else { + throw ScenicMaterialDownloadError.emptyFile + } + let destination = FileManager.default.temporaryDirectory + .appendingPathComponent("\(UUID().uuidString)-\(CloudTransferFileName.sanitized(fileName))") + try FileManager.default.moveItem(at: temporaryURL, to: destination) + onProgress(100) + return destination + } +} + +/// 将 URLSession 的实际字节进度传回下载服务,不虚构中间进度。 +private final class ScenicMaterialDownloadProgress: NSObject, URLSessionDownloadDelegate, @unchecked Sendable { + private let onProgress: @Sendable (Int) -> Void + + init(onProgress: @escaping @Sendable (Int) -> Void) { self.onProgress = onProgress } + + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {} + + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) { + guard totalBytesExpectedToWrite > 0 else { return } + onProgress(Int(min(Double(totalBytesWritten) / Double(totalBytesExpectedToWrite), 1) * 100)) + } +} + +/// 只请求添加相册权限,Photos 成功创建资产后才返回成功。 +struct ScenicMaterialPhotoLibrarySaver: CloudPhotoSaving { + /// 保存本地真实图片或视频;授权期间取消操作不会继续提交相册事务。 + func saveToPhotoLibrary(fileURL: URL, fileType: Int) async throws { + let status = await PHPhotoLibrary.requestAuthorization(for: .addOnly) + try Task.checkCancellation() + guard status == .authorized || status == .limited else { throw CloudTransferError.photoPermissionDenied } + guard FileManager.default.fileExists(atPath: fileURL.path) else { throw CloudTransferError.localFileMissing } + try await PHPhotoLibrary.shared().performChanges { + let request = PHAssetCreationRequest.forAsset() + request.addResource(with: fileType == 1 ? .video : .photo, fileURL: fileURL, options: nil) + } + } +} + +/// 空境原片下载中可向用户解释的错误。 +enum ScenicMaterialDownloadError: LocalizedError, Equatable { + case invalidURL + case httpFailure(Int) + case emptyFile + + /// 下载失败原因,避免将服务端错误页作为素材保存。 + var errorDescription: String? { + switch self { + case .invalidURL: "素材地址无效" + case .httpFailure(let status): "素材下载失败(HTTP \(status))" + case .emptyFile: "素材文件为空,请稍后重试" + } + } +} diff --git a/suixinkan/Features/ScenicMaterials/ViewModels/ScenicMaterialsViewModel.swift b/suixinkan/Features/ScenicMaterials/ViewModels/ScenicMaterialsViewModel.swift new file mode 100644 index 0000000..8d1f334 --- /dev/null +++ b/suixinkan/Features/ScenicMaterials/ViewModels/ScenicMaterialsViewModel.swift @@ -0,0 +1,555 @@ +import Foundation + +/// 独立景区空境库的正式分页、筛选、选择与下载状态,同时支持本地演示;不依赖 UIKit 或机巢业务。 +final class ScenicMaterialsViewModel { + /// 正式模式使用网络素材与真实相册保存,预览模式使用本地演示。 + let isRemote: Bool + /// 本次页面的独立账号与景区范围。 + let context: ScenicMaterialContext + /// 用于筛选的日历及其时区。 + let calendar: Calendar + /// 默认保留天数,正式模式采用服务端回显的窗口。 + private(set) var retentionDays = 90 + /// 日期筛选首日;正式模式包含后端返回的第 90 天,演示模式包含今天共 90 天。 + private(set) var minimumDate: Date + /// 可选的最后一天零点,不允许选择未来日期。 + let maximumDate: Date + /// 当前景区的独立空镜航线,含暂无片段的航线。 + private(set) var routes: [ScenicMaterialRoute] + /// 当前已加载的批次;正式模式按服务端分页追加。 + private(set) var allGroups: [ScenicMaterialGroup] + /// 选择的航线标识,nil 代表全部航线。 + private(set) var selectedRouteID: String? + /// 已应用的日历日筛选范围,nil 代表全部保留期。 + private(set) var dateRange: ScenicMaterialDateRange? + /// 选择的未完成片段,不包含不可用或已完成文件。 + private(set) var selectedIDs = Set() + /// 需要展开超过五段的批次标识。 + private(set) var expandedGroupIDs = Set() + /// 当前下载演示阶段。 + private(set) var phase: ScenicMaterialDownloadPhase = .idle + /// 当前传输尝试的令牌;暂停、继续和重试会作废旧令牌。 + private(set) var batchID: UUID? + /// 本次下载完整范围,重试时仍保留已完成项用于展示进度。 + private(set) var batchItemIDs: [String] = [] + /// 当前页面已完成演示的片段;不等于写入系统相册。 + private(set) var completedIDs = Set() + /// 当前批次明确失败的片段,可单独重试。 + private(set) var failedIDs = Set() + /// 当前批次的逐项演示进度。 + private(set) var progressByID: [String: Double] = [:] + + /// 正在刷新第一页及其片段详情。 + private(set) var isLoading = false + /// 正在读取下一页及其片段详情。 + private(set) var isLoadingMore = false + /// 下一页加载失败时保留已展示内容,由用户重试。 + private(set) var loadMoreError: String? + /// 当前筛选在后端的场次总数。 + private(set) var remoteTotalCount = 0 + /// 已加载的去重场次数,不将同页重复项计为新内容。 + var loadedRemoteSessionCount: Int { isRemote ? allGroups.count : 0 } + /// 首次成功加载后,是否仍有未读取的场次。 + var hasMoreRemoteSessions: Bool { + isRemote && loadedRemotePage > 0 && loadedRemoteSessionCount < remoteTotalCount + } + /// 第一页请求、详情或字段校验失败时的可重试提示。 + private(set) var loadError: String? + /// 最近收到的完整场次响应,解析失败时仍供诊断,不代表已提交到页面。 + private(set) var remoteSessions: ScenicMaterialsSessionsResponse? + /// 素材保留说明优先使用后端返回的文案。 + private(set) var retentionTips = "素材保留 90 天,请及时下载" + private var loadID: UUID? + private var loadedRemotePage = 0 + private var loadedRemoteQuery: ScenicMaterialsQuery? + + private let initialGroups: [ScenicMaterialGroup] + + /// 创建正式或演示库;可注入日历、日期和数据,测试不依赖时间、网络或登录单例。 + init(context: ScenicMaterialContext = .demo, now: Date = Date(), calendar: Calendar = .current, + routes: [ScenicMaterialRoute]? = nil, groups: [ScenicMaterialGroup]? = nil, isRemote: Bool = false) { + self.isRemote = isRemote + self.context = context + self.calendar = calendar + maximumDate = calendar.startOfDay(for: now) + minimumDate = calendar.date(byAdding: .day, value: isRemote ? -retentionDays : -(retentionDays - 1), to: maximumDate) ?? maximumDate + let demoRoutes = isRemote ? [] : Self.makeRoutes(context: context) + self.routes = routes ?? demoRoutes + let data = groups ?? (isRemote ? [] : Self.makeGroups(context: context, routes: demoRoutes, today: maximumDate, calendar: calendar)) + initialGroups = data + allGroups = data + } + + /// 按航线及拍摄时间排序;正式范围遵守服务端查询,演示数据再按本地保留期筛选。 + var filteredGroups: [ScenicMaterialGroup] { + let routeOrder = Dictionary(routes.enumerated().map { ($0.element.id, $0.offset) }, uniquingKeysWith: { first, _ in first }) + return allGroups.filter { group in + guard routeOrder[group.routeID] != nil else { return false } + let day = calendar.startOfDay(for: group.capturedAt) + // 正式保留范围由接口执行,避免再次按本地日界限删掉后端已返回的边界场次。 + guard isRemote || (day >= minimumDate && day <= maximumDate) else { return false } + if let selectedRouteID, group.routeID != selectedRouteID { return false } + if let dateRange, day < dateRange.start || day > dateRange.end { return false } + return true + }.sorted { lhs, rhs in + let left = routeOrder[lhs.routeID] ?? 0 + let right = routeOrder[rhs.routeID] ?? 0 + if left != right { return left < right } + if lhs.capturedAt != rhs.capturedAt { return lhs.capturedAt > rhs.capturedAt } + return lhs.id < rhs.id + } + } + + /// 当前筛选范围内完整片段,包含 UI 折叠的部分。 + var filteredClips: [ScenicMaterialClip] { filteredGroups.flatMap(\.clips) } + /// 任何批次尚未清理时锁定选择与筛选,避免改变正在展示的批次范围。 + var isSelectionLocked: Bool { batchID != nil } + /// 尚未开始传输且有可选片段时可以下载。 + var canStartDownload: Bool { !isSelectionLocked && !isLoading && !isLoadingMore && !selectedIDs.isEmpty } + /// 当前选择数量。 + var selectedCount: Int { selectedIDs.count } + /// 当前批次总项数。 + var totalCount: Int { batchItemIDs.count } + /// 当前批次成功演示项数,不混入此前批次结果。 + var completedCount: Int { batchItemIDs.filter { completedIDs.contains($0) }.count } + /// 当前批次失败项数。 + var failedCount: Int { batchItemIDs.filter { failedIDs.contains($0) }.count } + /// 当前批次仍待处理的完整片段标识。 + var pendingIDs: [String] { batchItemIDs.filter { !completedIDs.contains($0) && !failedIDs.contains($0) } } + /// 按文件数量平均的演示进度,成功项始终计为 1。 + var downloadProgress: Double { + guard !batchItemIDs.isEmpty else { return 0 } + return batchItemIDs.reduce(0) { sum, id in + sum + (completedIDs.contains(id) ? 1 : progressByID[id, default: 0]) + } / Double(batchItemIDs.count) + } + /// 当前航线筛选标题。 + var routeFilterTitle: String { selectedRouteID.flatMap { route(id: $0)?.name } ?? "全部航线" } + /// 当前日期筛选标题。 + var dateFilterTitle: String { + guard let dateRange else { return "全部时间" } + let start = formatDate(dateRange.start, format: "MM.dd") + let end = formatDate(dateRange.end, format: "MM.dd") + return dateRange.start == dateRange.end ? start : "\(start) – \(end)" + } + /// 当前景区保留期内是否存在片段,不受用户筛选条件影响。 + var hasAnyMaterials: Bool { + allGroups.contains { group in + let day = calendar.startOfDay(for: group.capturedAt) + return !group.clips.isEmpty && (isRemote || (day >= minimumDate && day <= maximumDate)) + && routes.contains(where: { $0.id == group.routeID }) + } + } + /// 当前空态标题,区分全库为空与有筛选但无结果。 + var emptyTitle: String { + if isLoading { return "正在加载素材" } + if loadError != nil { return "素材加载失败" } + return hasAnyMaterials || (isRemote && (selectedRouteID != nil || dateRange != nil)) ? "没有符合条件的素材" : "暂无景区素材" + } + /// 当前空态说明。 + var emptyMessage: String { + if isLoading { return "请稍候" } + if let loadError { return loadError } + return hasAnyMaterials || (isRemote && (selectedRouteID != nil || dateRange != nil)) ? "试试其他航线或时间范围" : "景区素材更新后,将显示在这里" + } + + /// 刷新当前筛选第一页,并读取该页完整片段;详情失败时整页可重试,不混入演示数据。 + func loadRemoteSessions(api: any ScenicMaterialsServing) async { + guard isRemote, !isSelectionLocked else { return } + resetRemotePageState() + let requestID = UUID() + loadID = requestID + defer { if loadID == requestID { isLoading = false } } + isLoading = true + let query = remoteQuery(page: 1) + do { + let response = try await api.sessions(query: query) + guard loadID == requestID, !Task.isCancelled else { return } + remoteSessions = response + let sessions = try ScenicMaterialsRemoteMapper.sessions(from: response, scenicID: query.scenicID, calendar: calendar) + let mappedRoutes = try ScenicMaterialsRemoteMapper.routes(from: response) + if response.total > 0 && sessions.isEmpty { + throw APIError.decodeFailed("场次总数与列表不一致,请刷新重试") + } + let groups = try await Self.loadGroups(sessions: sessions, api: api) + guard loadID == requestID, !Task.isCancelled, remoteQuery(page: 1) == query else { return } + allGroups = groups + routes = Self.mergedRoutes(mappedRoutes, sessions: sessions) + applyRemoteMetadata(response) + loadedRemotePage = response.page + loadedRemoteQuery = query + } catch is CancellationError { + } catch { + guard loadID == requestID, !Task.isCancelled else { return } + loadError = error.localizedDescription + } + } + + /// 使用已成功加载的查询追加下一页,失败不清空已展示页面或选择状态。 + func loadMoreRemoteSessions(api: any ScenicMaterialsServing) async { + guard isRemote, !isSelectionLocked, !isLoading, !isLoadingMore, hasMoreRemoteSessions, + loadedRemoteQuery == remoteQuery(page: 1) else { return } + let requestID = UUID() + loadID = requestID + isLoadingMore = true + loadMoreError = nil + let query = remoteQuery(page: loadedRemotePage + 1) + defer { if loadID == requestID { isLoadingMore = false } } + do { + let response = try await api.sessions(query: query) + guard loadID == requestID, !Task.isCancelled else { return } + remoteSessions = response + let sessions = try ScenicMaterialsRemoteMapper.sessions(from: response, scenicID: query.scenicID, calendar: calendar) + let mappedRoutes = try ScenicMaterialsRemoteMapper.routes(from: response) + let existingIDs = Set(allGroups.map(\.id)) + let newSessions = sessions.filter { !existingIDs.contains(String($0.id)) } + guard !newSessions.isEmpty || response.total <= loadedRemoteSessionCount else { + throw APIError.decodeFailed("后续场次为空或重复,请刷新重试") + } + let groups = try await Self.loadGroups(sessions: newSessions, api: api) + guard loadID == requestID, !Task.isCancelled, loadedRemoteQuery == remoteQuery(page: 1) else { return } + allGroups.append(contentsOf: groups) + routes = Self.mergedRoutes(routes + mappedRoutes, sessions: sessions) + applyRemoteMetadata(response) + loadedRemotePage = response.page + } catch is CancellationError { + } catch { + guard loadID == requestID, !Task.isCancelled else { return } + loadMoreError = error.localizedDescription + } + } + + /// 同一时刻最多请求四个场次详情,返回顺序始终与列表一致。 + private static func loadGroups(sessions: [ScenicMaterialsRemoteSession], api: any ScenicMaterialsServing) async throws -> [ScenicMaterialGroup] { + try await withThrowingTaskGroup(of: (Int, ScenicMaterialGroup).self) { tasks in + var nextIndex = 0 + var groups: [Int: ScenicMaterialGroup] = [:] + func enqueue(_ index: Int) { + let session = sessions[index] + tasks.addTask { + try Task.checkCancellation() + let detail = try await api.sessionDetail(scenicMediaID: session.id) + try Task.checkCancellation() + return (index, try ScenicMaterialsRemoteMapper.group(session: session, detail: detail)) + } + } + while nextIndex < min(4, sessions.count) { + enqueue(nextIndex) + nextIndex += 1 + } + while let (index, group) = try await tasks.next() { + groups[index] = group + if nextIndex < sessions.count { + enqueue(nextIndex) + nextIndex += 1 + } + } + return (0.. [ScenicMaterialRoute] { + var seen = Set() + return (routes + sessions.map { ScenicMaterialRoute(id: $0.routeID, name: $0.routeName) }) + .filter { seen.insert($0.id).inserted } + } + + /// 保持页码之外的查询范围一致,翻页时不丢失航线和日期条件。 + private func remoteQuery(page: Int) -> ScenicMaterialsQuery { + ScenicMaterialsQuery(scenicID: Int(context.scenicID) ?? 0, page: page, + airLineID: selectedRouteID.flatMap(Int.init), + dateFrom: dateRange.map { formatDate($0.start, format: "yyyy-MM-dd") }, + dateTo: dateRange.map { formatDate($0.end, format: "yyyy-MM-dd") }, retentionDays: retentionDays) + } + + /// 正式日期下界包含后端已实测返回的第 90 天,不改变演示日历窗口。 + private func applyRemoteMetadata(_ response: ScenicMaterialsSessionsResponse) { + retentionDays = response.retentionDays + retentionTips = response.retentionTips + remoteTotalCount = response.total + minimumDate = calendar.date(byAdding: .day, value: -retentionDays, to: maximumDate) ?? maximumDate + } + + /// 刷新或筛选更换后作废旧请求、旧页码及选择,保留航线选项供筛选使用。 + private func resetRemotePageState() { + cancelRemoteLoad() + loadedRemotePage = 0 + loadedRemoteQuery = nil + remoteTotalCount = 0 + remoteSessions = nil + loadError = nil + loadMoreError = nil + allGroups.removeAll() + selectedIDs.removeAll() + expandedGroupIDs.removeAll() + } + + /// 离页或身份变化后作废尚未返回的列表请求。 + func cancelRemoteLoad() { + loadID = nil + isLoading = false + isLoadingMore = false + } + + /// 查找稳定航线,不依赖名称。 + func route(id: String) -> ScenicMaterialRoute? { routes.first { $0.id == id } } + /// 查找完整批次,不受折叠影响。 + func group(id: String) -> ScenicMaterialGroup? { allGroups.first { $0.id == id } } + /// 查找当前库片段,不扩大页面上下文。 + func clip(id: String) -> ScenicMaterialClip? { allGroups.lazy.flatMap(\.clips).first { $0.id == id } } + + /// 返回列表当前应显示的片段;默认显示首五段。 + func visibleClips(in group: ScenicMaterialGroup) -> [ScenicMaterialClip] { + expandedGroupIDs.contains(group.id) ? group.clips : Array(group.clips.prefix(5)) + } + + /// 格式化批次拍摄时间,使用同一日历时区。 + func capturedAtText(for group: ScenicMaterialGroup) -> String { formatDate(group.capturedAt, format: "MM-dd HH:mm") } + + /// 切换航线后移除隐藏选择,传入未知航线不会更改现有状态。 + @discardableResult + func setRoute(id: String?) -> Bool { + guard !isSelectionLocked, id == nil || routes.contains(where: { $0.id == id }) else { return false } + selectedRouteID = id + if isRemote { resetRemotePageState() } + pruneSelection() + return true + } + + /// 应用包含首尾两天的范围;两端均 nil 表示全部,非法或越界日期保持原值。 + @discardableResult + func setDateRange(start: Date?, end: Date?) -> Bool { + guard !isSelectionLocked else { return false } + if start == nil && end == nil { + dateRange = nil + if isRemote { resetRemotePageState() } + pruneSelection() + return true + } + guard let start, let end else { return false } + let first = calendar.startOfDay(for: start) + let last = calendar.startOfDay(for: end) + guard first >= minimumDate, last <= maximumDate, first <= last else { return false } + dateRange = ScenicMaterialDateRange(start: first, end: last) + if isRemote { resetRemotePageState() } + pruneSelection() + return true + } + + /// 清除筛选,保留仍有效的已选片段,不改变下载结果。 + func resetFilters() { + guard !isSelectionLocked else { return } + selectedRouteID = nil + dateRange = nil + if isRemote { resetRemotePageState() } + pruneSelection() + } + + /// 当前可选状态;完成、不可用、隐藏片段或锁定批次均不可新选。 + func canSelect(id: String) -> Bool { + !isSelectionLocked && filteredClips.contains { $0.id == id && $0.isAvailable && (!isRemote || $0.remoteURL != nil) && !completedIDs.contains(id) } + } + + /// 切换单项选择,不涉及预览或下载。 + func toggleSelection(id: String) { + guard canSelect(id: id) else { return } + if !selectedIDs.insert(id).inserted { selectedIDs.remove(id) } + } + + /// 完整批次内所有可选片段是否都已选中,不把空组视为全选。 + func isGroupSelected(id: String) -> Bool { + let ids = selectableIDs(in: id) + return !ids.isEmpty && ids.isSubset(of: selectedIDs) + } + + /// 全选或取消全选本组;包含未展开片段,排除已完成与不可用项。 + func toggleGroup(id: String) { + guard !isSelectionLocked else { return } + let ids = selectableIDs(in: id) + if !ids.isEmpty && ids.isSubset(of: selectedIDs) { selectedIDs.subtract(ids) } + else { selectedIDs.formUnion(ids) } + } + + /// 展开/收起只改变布局,下载过程中也可浏览,不改变选择和批次。 + func toggleExpandedGroup(id: String) { + guard filteredGroups.contains(where: { $0.id == id }) else { return } + if !expandedGroupIDs.insert(id).inserted { expandedGroupIDs.remove(id) } + } + + /// 获取当前片段的本机展示状态;成功仅表示本地演示完成。 + func downloadState(for id: String) -> ScenicMaterialDownloadState { + guard let clip = clip(id: id), clip.isAvailable else { return .unavailable } + if completedIDs.contains(id) { return .completed } + if failedIDs.contains(id) { return .failed } + guard batchItemIDs.contains(id) else { return .available } + if phase == .paused { return .paused } + if phase == .downloading { return .downloading(progress: progressByID[id, default: 0]) } + return .available + } + + /// 冻结当前可选范围并开启一轮下载演示,返回是否成功建立批次。 + @discardableResult + func startDownload() -> Bool { + guard canStartDownload else { return false } + let items = filteredClips.filter { selectedIDs.contains($0.id) && $0.isAvailable && (!isRemote || $0.remoteURL != nil) && !completedIDs.contains($0.id) } + guard !items.isEmpty else { return false } + batchItemIDs = items.map(\.id) + selectedIDs = Set(batchItemIDs) + failedIDs.removeAll() + progressByID = Dictionary(uniqueKeysWithValues: batchItemIDs.map { ($0, 0) }) + batchID = UUID() + phase = .downloading + return true + } + + /// 暂停当前演示并作废旧驱动回执,回前台不自动继续。 + func pauseDownload() { + guard phase == .downloading else { return } + batchID = UUID() + phase = .paused + } + + /// 手动继续未完成项,允许未完成文件从头演示,已完成项不重复处理。 + @discardableResult + func continueDownload() -> Bool { + guard phase == .paused, !pendingIDs.isEmpty else { return false } + for id in pendingIDs { progressByID[id] = 0 } + batchID = UUID() + phase = .downloading + return true + } + + /// 仅重新处理明确失败的项,成功项及原批次范围保留。 + @discardableResult + func retryFailedDownloads() -> Bool { + guard phase == .partialFailure, !failedIDs.isEmpty else { return false } + for id in failedIDs { progressByID[id] = 0 } + failedIDs.removeAll() + batchID = UUID() + phase = .downloading + return true + } + + /// 取消当前批次并清理未完成项;已成功的本机演示标记继续保留。 + func cancelDownload() { clearBatch() } + + /// 终态后开始重新选择;传输或暂停中的批次需先继续或取消。 + func continueSelecting() { + guard phase != .downloading, phase != .paused else { return } + clearBatch() + } + + /// 只接收当前传输令牌的未终结项,拒绝旧批次、重复终态及无效进度。 + func receive(_ event: ScenicMaterialTransferEvent, clipID: String, batchID: UUID) { + guard self.batchID == batchID, phase == .downloading, batchItemIDs.contains(clipID), + !completedIDs.contains(clipID), !failedIDs.contains(clipID), clip(id: clipID)?.isAvailable == true else { return } + switch event { + case .progress(let value): + guard value.isFinite else { return } + progressByID[clipID] = max(progressByID[clipID, default: 0], min(max(value, 0), 1)) + case .completed: + completedIDs.insert(clipID) + progressByID[clipID] = 1 + case .failed: + failedIDs.insert(clipID) + progressByID[clipID] = 0 + } + guard pendingIDs.isEmpty else { return } + phase = failedIDs.isEmpty ? .completed : .partialFailure + selectedIDs = failedIDs + } + + /// 切换本地状态预览,不读取真实相册,也不更改登录身份或订单。 + func applyScenario(_ scenario: ScenicMaterialsScenario) { + guard !isRemote else { return } + clearBatch() + completedIDs.removeAll() + allGroups = initialGroups + selectedRouteID = nil + dateRange = nil + expandedGroupIDs.removeAll() + switch scenario { + case .normal: break + case .empty: allGroups = [] + case .noResults: + selectedRouteID = routes.first(where: { route in !allGroups.contains(where: { $0.routeID == route.id }) })?.id + if selectedRouteID == nil { + dateRange = ScenicMaterialDateRange(start: maximumDate, end: maximumDate) + } + case .selected, .downloading, .completed, .partialFailure, .paused: + let items = Array(filteredClips.filter(\.isAvailable).prefix(2)) + selectedIDs = Set(items.map(\.id)) + guard scenario != .selected, startDownload(), let token = batchID else { return } + if scenario == .downloading { + if let item = items.first { receive(.progress(0.35), clipID: item.id, batchID: token) } + } else if scenario == .completed { + for item in items { receive(.completed, clipID: item.id, batchID: token) } + } else if scenario == .partialFailure { + for (index, item) in items.enumerated() { + receive(index == 0 ? .completed : .failed, clipID: item.id, batchID: token) + } + } else { + if let item = items.first, items.count > 1 { receive(.completed, clipID: item.id, batchID: token) } + pauseDownload() + } + } + } + + private func selectableIDs(in groupID: String) -> Set { + guard let group = filteredGroups.first(where: { $0.id == groupID }) else { return [] } + return Set(group.clips.filter { $0.isAvailable && (!isRemote || $0.remoteURL != nil) && !completedIDs.contains($0.id) }.map(\.id)) + } + + private func pruneSelection() { + let valid = Set(filteredClips.filter { $0.isAvailable && (!isRemote || $0.remoteURL != nil) && !completedIDs.contains($0.id) }.map(\.id)) + selectedIDs.formIntersection(valid) + } + + private func clearBatch() { + batchID = nil + batchItemIDs = [] + selectedIDs.removeAll() + failedIDs.removeAll() + progressByID.removeAll() + phase = .idle + } + + private func formatDate(_ date: Date, format: String) -> String { + let formatter = DateFormatter() + formatter.calendar = calendar + formatter.timeZone = calendar.timeZone + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = format + return formatter.string(from: date) + } + + private static func makeRoutes(context: ScenicMaterialContext) -> [ScenicMaterialRoute] { + let prefix = "\(context.userID):\(context.scenicID)" + return [ + ScenicMaterialRoute(id: "\(prefix):route-1", name: "共眠岸 → 三皇寨 → 好汉坡"), + ScenicMaterialRoute(id: "\(prefix):route-2", name: "少林寺 → 塔林 → 达摩洞"), + ScenicMaterialRoute(id: "\(prefix):route-3", name: "少室山 → 迎客峰") + ] + } + + private static func makeGroups(context: ScenicMaterialContext, routes: [ScenicMaterialRoute], today: Date, + calendar: Calendar) -> [ScenicMaterialGroup] { + let prefix = "\(context.userID):\(context.scenicID)" + let configurations = [(0, 3, 17, 20, 5), (0, 3, 14, 30, 6), (0, 4, 16, 10, 3), (1, 3, 10, 40, 4), (1, 16, 15, 35, 5)] + let durations = [28, 27, 30, 24, 31, 26] + let covers = ["drone_demo_mountain", "drone_demo_pagoda", "drone_demo_mountain", "drone_demo_pagoda", "drone_demo_mountain", "drone_demo_pagoda"] + return configurations.enumerated().map { index, configuration in + let (routeIndex, daysAgo, hour, minute, count) = configuration + let day = calendar.date(byAdding: .day, value: -daysAgo, to: today) ?? today + let capturedAt = calendar.date(bySettingHour: hour, minute: minute, second: 0, of: day) ?? day + let groupID = "\(prefix):group-\(index + 1)" + let clips = (0.. Date? { + let formatter = ISO8601DateFormatter() + formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds] + if let date = formatter.date(from: value) { return date } + formatter.formatOptions = [.withInternetDateTime] + return formatter.date(from: value) + } + + /// 按 RFC3339 编码日期,供测试和持久化使用。 + static func encode(_ date: Date) -> String { + let formatter = ISO8601DateFormatter() + formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds] + return formatter.string(from: date) + } +} + +/// 必填 RFC3339 日期,业务属性直接读写 Date。 +@propertyWrapper +struct TrainingAPIDate: Codable, Equatable, Sendable { + var wrappedValue: Date + /// 从业务日期创建包装,保留 DTO 的普通成员初始化方式。 + init(wrappedValue: Date) { self.wrappedValue = wrappedValue } + /// 从契约字符串解码,格式错误不转换为虚假时间。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let raw = try container.decode(String.self) + guard let value = TrainingAPIDateCodec.decode(raw) else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "Invalid RFC3339 training date") + } + wrappedValue = value + } + /// 编码为带时区字符串。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(TrainingAPIDateCodec.encode(wrappedValue)) + } +} + +/// 可空 RFC3339 日期;无有效期边界保持 nil,不使用本机时间代替。 +@propertyWrapper +struct TrainingAPIOptionalDate: Codable, Equatable, Sendable { + var wrappedValue: Date? + /// 从可空业务日期创建包装。 + init(wrappedValue: Date?) { self.wrappedValue = wrappedValue } + /// 解码 null 或 RFC3339 字符串。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if container.decodeNil() { wrappedValue = nil; return } + let raw = try container.decode(String.self) + guard let value = TrainingAPIDateCodec.decode(raw) else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "Invalid RFC3339 training date") + } + wrappedValue = value + } + /// 编码可空日期。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + if let value = wrappedValue { try container.encode(TrainingAPIDateCodec.encode(value)) } + else { try container.encodeNil() } + } +} + +extension KeyedDecodingContainer { + /// 可选日期允许省略字段;分页的 server_time 并非每个资源都会返回。 + func decode(_ type: TrainingAPIOptionalDate.Type, forKey key: Key) throws -> TrainingAPIOptionalDate { + try decodeIfPresent(type, forKey: key) ?? TrainingAPIOptionalDate(wrappedValue: nil) + } +} + +extension TrainingLearnerStatus: Codable { + /// 将正式接口 pending 映射到页面已有的待考试状态。 + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + switch try container.decode(String.self) { + case "pending": self = .pendingExam + case "completed": self = .completed + case "ended": self = .ended + default: throw DecodingError.dataCorruptedError(in: container, debugDescription: "Unknown training learner status") + } + } + /// 输出正式接口状态,不使用本地 enum 的 pendingExam 字符串。 + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(apiValue) + } + /// 查询参数使用的正式状态值。 + var apiValue: String { switch self { case .pendingExam: "pending"; case .completed: "completed"; case .ended: "ended" } } +} + +/// 游标分页;小节、附件、任务和成绩复用相同分页边界。 +struct TrainingCursorPage: Codable, Equatable, Sendable { + let items: [Item] + let nextCursor: String? + let hasMore: Bool + @TrainingAPIOptionalDate var serverTime: Date? + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case items + case nextCursor = "next_cursor" + case hasMore = "has_more" + case serverTime = "server_time" + } +} + +/// 概览最近成绩,只有首屏所需字段。 +struct TrainingLatestAttempt: Codable, Equatable, Sendable { + let id: String + let scoreHundredths: Int + @TrainingAPIDate var submittedAt: Date + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "attempt_id" + case scoreHundredths = "score_hundredths" + case submittedAt = "submitted_at" + } +} + +/// 当前学员全部分配任务的概览统计。 +struct TrainingSummary: Codable, Equatable, Sendable { + let pendingCount: Int + let completedCount: Int + let latestAttempt: TrainingLatestAttempt? + @TrainingAPIDate var serverTime: Date + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case pendingCount = "pending_count" + case completedCount = "completed_count" + case latestAttempt = "latest_attempt" + case serverTime = "server_time" + } +} + +/// 任务列表中的本人阅读与操作资格,不包含草稿或成绩数组。 +struct TrainingLearningFlags: Codable, Equatable, Sendable { + let progressPercent: Int + let readingCompleted: Bool + let hasDraft: Bool + let canViewCourse: Bool + let canStudy: Bool + let canStartExam: Bool + let blockReason: String? + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case progressPercent = "progress_percent" + case readingCompleted = "reading_completed" + case hasDraft = "has_draft" + case canViewCourse = "can_view_course" + case canStudy = "can_study" + case canStartExam = "can_start_exam" + case blockReason = "block_reason" + } +} + +/// 任务摘要与快照引用;课程正文和试卷独立按需读取。 +struct TrainingTaskSummary: Codable, Equatable, Sendable { + let id: String + let title: String + let publisherName: String? + let mode: TrainingMode + let taskStatus: TrainingTaskStatus + let learnerStatus: TrainingLearnerStatus + @TrainingAPIOptionalDate var startAt: Date? + @TrainingAPIOptionalDate var endAt: Date? + let courseSnapshotID: String + let courseTitle: String + let paperSnapshotID: String? + let sectionCount: Int + let questionCount: Int + let passScore: Int? + let learning: TrainingLearningFlags + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "task_id" + case title + case publisherName = "publisher_name" + case mode + case taskStatus = "task_status" + case learnerStatus = "learner_status" + case startAt = "start_at" + case endAt = "end_at" + case courseSnapshotID = "course_snapshot_id" + case courseTitle = "course_title" + case paperSnapshotID = "paper_snapshot_id" + case sectionCount = "section_count" + case questionCount = "question_count" + case passScore = "pass_score" + case learning + } +} + +/// 平铺任务详情,客户端以 summary 复用列表摘要。 +struct TrainingTaskDetail: Codable, Equatable, Sendable { + let summary: TrainingTaskSummary + let requiredReadingSeconds: Int + let readingRule: String + let scoring: String? + let serverTime: Date + + /// 使用已解码摘要和规则创建详情,便于纯逻辑测试。 + init(summary: TrainingTaskSummary, requiredReadingSeconds: Int, readingRule: String, scoring: String?, serverTime: Date) { + self.summary = summary + self.requiredReadingSeconds = requiredReadingSeconds + self.readingRule = readingRule + self.scoring = scoring + self.serverTime = serverTime + } + /// 从与摘要同一层的详情字段解码,避免要求不存在的 summary 对象。 + init(from decoder: Decoder) throws { + summary = try TrainingTaskSummary(from: decoder) + let container = try decoder.container(keyedBy: CodingKeys.self) + requiredReadingSeconds = try container.decode(Int.self, forKey: .requiredReadingSeconds) + readingRule = try container.decode(String.self, forKey: .readingRule) + scoring = try container.decodeIfPresent(String.self, forKey: .scoring) + serverTime = try container.decode(TrainingAPIDate.self, forKey: .serverTime).wrappedValue + } + /// 保持服务端平铺字段布局。 + func encode(to encoder: Encoder) throws { + try summary.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(requiredReadingSeconds, forKey: .requiredReadingSeconds) + try container.encode(readingRule, forKey: .readingRule) + try container.encodeIfPresent(scoring, forKey: .scoring) + try container.encode(TrainingAPIDate(wrappedValue: serverTime), forKey: .serverTime) + } + /// 详情额外字段的契约映射。 + enum CodingKeys: String, CodingKey { + case requiredReadingSeconds = "required_reading_seconds" + case readingRule = "reading_rule" + case scoring + case serverTime = "server_time" + } +} + +/// 课程快照元信息,不含小节正文。 +struct TrainingCourseInfo: Codable, Equatable, Sendable { + let id: String + let title: String + let introduction: String + let sectionCount: Int + let attachmentCount: Int + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "course_snapshot_id" + case title + case introduction + case sectionCount = "section_count" + case attachmentCount = "attachment_count" + } +} + +/// 冻结的小节目录项,序号从一开始。 +struct TrainingSectionInfo: Codable, Equatable, Sendable { + let id: String + let order: Int + let title: String + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "section_id" + case order + case title + } +} + +/// 单节正式正文;HTML 按后端发布快照读取。 +struct TrainingSectionContent: Codable, Equatable, Sendable { + let id: String + let order: Int + let title: String + let contentHTML: String + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "section_id" + case order + case title + case contentHTML = "content_html" + } +} + +/// 附件元信息,私有附件访问前单独申请授权链接。 +struct TrainingAttachmentInfo: Codable, Equatable, Sendable { + let id: String + let name: String + let mimeType: String + let sizeBytes: Int + let fileID: String + let downloadURL: URL? + @TrainingAPIOptionalDate var expiresAt: Date? + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "attachment_id" + case name + case mimeType = "mime_type" + case sizeBytes = "size_bytes" + case fileID = "file_id" + case downloadURL = "download_url" + case expiresAt = "expires_at" + } +} + +/// 经当前任务授权的短期附件访问链接。 +struct TrainingAttachmentLink: Codable, Equatable, Sendable { + let id: String + let name: String + let url: URL + @TrainingAPIDate var expiresAt: Date + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "attachment_id" + case name + case url + case expiresAt = "expires_at" + } +} + +/// 服务端权威进度与当前资格;不含课程、草稿答案或历史成绩。 +struct TrainingProgressSnapshot: Codable, Equatable, Sendable { + let taskID: String + let readingSeconds: Int + let requiredReadingSeconds: Int + let completedSectionCount: Int + let sectionCount: Int + let progressPercent: Int + let readingCompleted: Bool + let learnerStatus: TrainingLearnerStatus + @TrainingAPIOptionalDate var completedAt: Date? + let hasDraft: Bool + let canViewCourse: Bool + let canStudy: Bool + let canStartExam: Bool + let canRetry: Bool + let blockReason: String? + @TrainingAPIDate var serverTime: Date + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case taskID = "task_id" + case readingSeconds = "reading_seconds" + case requiredReadingSeconds = "required_reading_seconds" + case completedSectionCount = "completed_section_count" + case sectionCount = "section_count" + case progressPercent = "progress_percent" + case readingCompleted = "reading_completed" + case learnerStatus = "learner_status" + case completedAt = "completed_at" + case hasDraft = "has_draft" + case canViewCourse = "can_view_course" + case canStudy = "can_study" + case canStartExam = "can_start_exam" + case canRetry = "can_retry" + case blockReason = "block_reason" + case serverTime = "server_time" + } +} + +/// 阅读会话、上报规则及创建时已保存进度。 +struct TrainingStudySession: Codable, Equatable, Sendable { + let sessionID: String + @TrainingAPIDate var expiresAt: Date + let heartbeatIntervalSeconds: Int + let maxHeartbeatGapSeconds: Int + let progress: TrainingProgressSnapshot + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case sessionID = "session_id" + case expiresAt = "expires_at" + case heartbeatIntervalSeconds = "heartbeat_interval_seconds" + case maxHeartbeatGapSeconds = "max_heartbeat_gap_seconds" + case progress + } +} + +/// 幂等阅读上报确认;累计秒数只用于当前会话。 +struct TrainingHeartbeatConfirmation: Codable, Equatable, Sendable { + let sessionID: String + let acceptedSequence: Int + let acceptedActiveSecondsTotal: Int + let sessionClosed: Bool + let progress: TrainingProgressSnapshot + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case sessionID = "session_id" + case acceptedSequence = "accepted_sequence" + case acceptedActiveSecondsTotal = "accepted_active_seconds_total" + case sessionClosed = "session_closed" + case progress + } +} + +/// 冻结试卷规则与题数,不携带全卷或正确答案。 +struct TrainingPaperInfo: Codable, Equatable, Sendable { + let id: String + let scoring: String + let questionCount: Int + let maxOptionsPerQuestion: Int + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "paper_snapshot_id" + case scoring + case questionCount = "question_count" + case maxOptionsPerQuestion = "max_options_per_question" + } +} + +/// 考前选项,不透明 ID 按原值提交。 +struct TrainingQuestionOption: Codable, Equatable, Sendable { + let id: String + let text: String + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "option_id" + case text + } +} + +/// 一题考前快照,不包含答案和解析。 +struct TrainingQuestionItem: Codable, Equatable, Sendable { + let id: String + let order: Int + let type: TrainingQuestionType + let stem: String + let options: [TrainingQuestionOption] + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "question_id" + case order + case type + case stem + case options + } +} + +/// 按冻结题位随机访问的试题页。 +struct TrainingQuestionPage: Codable, Equatable, Sendable { + let paperSnapshotID: String + let total: Int + let offset: Int + let nextOffset: Int? + let hasMore: Bool + let items: [TrainingQuestionItem] + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case paperSnapshotID = "paper_snapshot_id" + case total + case offset + case nextOffset = "next_offset" + case hasMore = "has_more" + case items + } +} + +/// 固定题位范围内已保存的本人选择。 +struct TrainingDraftAnswerItem: Codable, Equatable, Sendable { + let questionID: String + let order: Int + let selectedOptionIDs: [String] + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case questionID = "question_id" + case order + case selectedOptionIDs = "selected_option_ids" + } +} + +/// 草稿版本、恢复位置、全部已答题号及当前题位答案页。 +struct TrainingDraftPage: Codable, Equatable, Sendable { + let taskID: String + let paperSnapshotID: String + let draftRevision: Int + @TrainingAPIOptionalDate var savedAt: Date? + let lastQuestionOrder: Int + let answeredCount: Int + let answeredQuestionOrders: [Int] + let total: Int + let offset: Int + let nextOffset: Int? + let hasMore: Bool + let items: [TrainingDraftAnswerItem] + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case taskID = "task_id" + case paperSnapshotID = "paper_snapshot_id" + case draftRevision = "draft_revision" + case savedAt = "saved_at" + case lastQuestionOrder = "last_question_order" + case answeredCount = "answered_count" + case answeredQuestionOrders = "answered_question_orders" + case total + case offset + case nextOffset = "next_offset" + case hasMore = "has_more" + case items + } +} + +/// 增量保存中一题的完整选择集合,空数组取消该题作答。 +struct TrainingDraftChange: Codable, Equatable, Sendable { + let questionID: String + let selectedOptionIDs: [String] + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case questionID = "question_id" + case selectedOptionIDs = "selected_option_ids" + } +} + +/// 带乐观版本与幂等键的增量草稿请求。 +struct TrainingDraftSaveRequest: Codable, Equatable, Sendable { + let requestID: String + let paperSnapshotID: String + let baseRevision: Int + let lastQuestionOrder: Int? + let changes: [TrainingDraftChange] + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case requestID = "request_id" + case paperSnapshotID = "paper_snapshot_id" + case baseRevision = "base_revision" + case lastQuestionOrder = "last_question_order" + case changes + } +} + +/// 用户明确重考时请求重置;重试沿用同一 requestID。 +struct TrainingDraftResetRequest: Codable, Equatable, Sendable { + let requestID: String + let paperSnapshotID: String + let baseRevision: Int + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case requestID = "request_id" + case paperSnapshotID = "paper_snapshot_id" + case baseRevision = "base_revision" + } +} + +/// 保存或重置后草稿实况;重置重试不能据此盲清本地答案。 +struct TrainingDraftConfirmation: Codable, Equatable, Sendable { + let draftRevision: Int + @TrainingAPIDate var savedAt: Date + let answeredCount: Int + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case draftRevision = "draft_revision" + case savedAt = "saved_at" + case answeredCount = "answered_count" + } +} + +/// 消费服务端已保存草稿版本的幂等交卷请求,不重新上传答案。 +struct TrainingSubmissionRequest: Codable, Equatable, Sendable { + let submissionID: String + let paperSnapshotID: String + let draftRevision: Int + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case submissionID = "submission_id" + case paperSnapshotID = "paper_snapshot_id" + case draftRevision = "draft_revision" + } +} + +/// 冻结成绩摘要;解析独立读取,资格由最新任务状态决定。 +struct TrainingAttemptSummary: Codable, Equatable, Sendable { + let id: String + let taskID: String + let taskTitle: String + let courseSnapshotID: String + let courseTitle: String + let paperSnapshotID: String + @TrainingAPIDate var submittedAt: Date + let scoreHundredths: Int + let correctCount: Int + let questionCount: Int + let passScore: Int + let passed: Bool + let reviewAvailable: Bool + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "attempt_id" + case taskID = "task_id" + case taskTitle = "task_title" + case courseSnapshotID = "course_snapshot_id" + case courseTitle = "course_title" + case paperSnapshotID = "paper_snapshot_id" + case submittedAt = "submitted_at" + case scoreHundredths = "score_hundredths" + case correctCount = "correct_count" + case questionCount = "question_count" + case passScore = "pass_score" + case passed + case reviewAvailable = "review_available" + } +} + +extension TrainingAttemptSummary { + /// 百分之一分整数转为最多两位小数的展示分数,不改变通过判断。 + var scoreText: String { + let whole = scoreHundredths / 100 + let fraction = scoreHundredths % 100 + if fraction == 0 { return String(whole) } + let digits = String(format: "%02d", fraction) + return "\(whole).\(fraction.isMultiple(of: 10) ? String(digits.prefix(1)) : digits)" + } +} + +/// 成绩页面使用的最新本人任务操作资格。 +struct TrainingTaskState: Codable, Equatable, Sendable { + let learnerStatus: TrainingLearnerStatus + @TrainingAPIOptionalDate var completedAt: Date? + let canRetry: Bool + let blockReason: String? + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case learnerStatus = "learner_status" + case completedAt = "completed_at" + case canRetry = "can_retry" + case blockReason = "block_reason" + } +} + +/// 单次历史成绩与最新重考资格,不含解析。 +struct TrainingAttemptDetail: Codable, Equatable, Sendable { + let attempt: TrainingAttemptSummary + let taskState: TrainingTaskState + @TrainingAPIDate var serverTime: Date + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case attempt + case taskState = "task_state" + case serverTime = "server_time" + } +} + +/// 原子交卷结果,直接显示成绩摘要并更新草稿版本。 +struct TrainingSubmissionResult: Codable, Equatable, Sendable { + let attempt: TrainingAttemptSummary + let taskState: TrainingTaskState + let draftRevision: Int + @TrainingAPIDate var serverTime: Date + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case attempt + case taskState = "task_state" + case draftRevision = "draft_revision" + case serverTime = "server_time" + } +} + +/// 本次考试冻结的题目、本人答案和考后解析。 +struct TrainingReviewItem: Codable, Equatable, Sendable { + let id: String + let order: Int + let type: TrainingQuestionType + let stem: String + let options: [TrainingQuestionOption] + let selectedOptionIDs: [String] + let correctOptionIDs: [String] + let isCorrect: Bool + let explanation: String + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case id = "question_id" + case order + case type + case stem + case options + case selectedOptionIDs = "selected_option_ids" + case correctOptionIDs = "correct_option_ids" + case isCorrect = "is_correct" + case explanation + } +} + +/// 成绩解析游标页,每次只读取最多十题。 +struct TrainingReviewPage: Codable, Equatable, Sendable { + let attemptID: String + let items: [TrainingReviewItem] + let nextCursor: String? + let hasMore: Bool + + /// 正式接口字段映射。 + enum CodingKeys: String, CodingKey { + case attemptID = "attempt_id" + case items + case nextCursor = "next_cursor" + case hasMore = "has_more" + } +} diff --git a/suixinkan/Features/Training/Models/TrainingModels.swift b/suixinkan/Features/Training/Models/TrainingModels.swift new file mode 100644 index 0000000..fe5788f --- /dev/null +++ b/suixinkan/Features/Training/Models/TrainingModels.swift @@ -0,0 +1,268 @@ +import Foundation + +/// 培训任务类型:仅学习或学习后考试。 +enum TrainingMode: String, Codable, Sendable { case study, exam } + +/// 任务发布状态;关闭后只允许回顾。 +enum TrainingTaskStatus: String, Codable, Sendable { case published, closed } + +/// 学员任务列表的待办、完成与结束状态。 +enum TrainingLearnerStatus: String, CaseIterable, Sendable { + case pendingExam, completed, ended + + /// 面向学员的状态名称。 + var title: String { switch self { case .pendingExam: "待考试"; case .completed: "已完成"; case .ended: "已结束" } } +} + +/// 单选和多选题型。 +enum TrainingQuestionType: String, Codable, Sendable { case single, multiple } + +/// 发布时冻结的课程图文小节,HTML 应由服务端清洗。 +struct TrainingSection: Codable, Equatable, Sendable { + let id: String + let title: String + let contentHTML: String +} + +/// 具有授权 HTTPS 地址的课程附件。 +struct TrainingAttachment: Codable, Equatable, Sendable { + let id: String + let name: String + let url: URL? +} + +/// 学习端课程快照,保留文字小节和附件。 +struct TrainingCourse: Codable, Equatable, Sendable { + let title: String + let introduction: String + let sections: [TrainingSection] + let attachments: [TrainingAttachment] +} + +/// 试题选项 ID 与正文。 +struct TrainingOption: Codable, Equatable, Sendable { + let id: String + let text: String +} + +/// 考前试题不携带正确答案和解析。 +struct TrainingQuestion: Codable, Equatable, Sendable { + let id: String + let type: TrainingQuestionType + let stem: String + let options: [TrainingOption] +} + +/// 答题草稿,以题目和选项快照 ID 保存。 +typealias TrainingAnswers = [String: Set] + +/// 交卷后返回的单题解析与本次所选答案。 +struct TrainingQuestionReview: Codable, Equatable, Sendable { + let question: TrainingQuestion + let selectedIDs: Set + let correctIDs: Set + let explanation: String + + /// 多选必须集合完全相等才算答对。 + var isCorrect: Bool { selectedIDs == correctIDs } + + /// 将选项 ID 转为可读的字母序号和正文。 + func answerText(ids: Set) -> String { + let values = question.options.enumerated().compactMap { index, option in + ids.contains(option.id) ? "\(TrainingQuestion.optionLetter(index)).\(option.text)" : nil + } + return values.isEmpty ? "未作答" : values.joined(separator: "\n") + } +} + +extension TrainingQuestion { + /// 题目最多六个选项,对外显示 A–F,提交仍使用原始 ID。 + static func optionLetter(_ index: Int) -> String { + let letters = ["A", "B", "C", "D", "E", "F"] + return letters.indices.contains(index) ? letters[index] : "?" + } +} + +/// 小程序任务卡的展示状态;学习进度由已保存小节计算。 +struct TrainingTaskPresentation { + let task: TrainingTask + /// 判断任务开始与截止状态的时间,可注入以验证时间边界。 + var now = Date() + + /// 已保存完成的小节占全部课程小节的整数百分比。 + var progressPercent: Int { + guard !task.course.sections.isEmpty else { return 0 } + return task.course.sections.filter { task.progress.completedSectionIDs.contains($0.id) }.count * 100 / task.course.sections.count + } + /// 已完成阅读且任务允许提交时才能进入考试。 + var canStartExam: Bool { task.mode == .exam && task.hasFinishedReading && task.submissionBlockReason(now: now) == nil } + + /// 根据完成状态、有效期与草稿决定任务卡主按钮文案。 + var actionTitle: String { + if task.learnerStatus == .completed { return "回顾学习" } + if task.submissionBlockReason(now: now) != nil { return "查看课程" } + if canStartExam { return task.progress.draftAnswers.values.contains(where: { !$0.isEmpty }) ? "继续答题" : "开始考试" } + return "去学习" + } + /// 解释任务当前可执行操作或继续学习的条件。 + var hint: String { + if task.learnerStatus == .completed { return "已完成本次学习任务" } + if task.submissionBlockReason(now: now) != nil { return now < task.startAt ? "任务尚未开始,暂不能提交" : "任务已结束,仅可回顾内容" } + if canStartExam { return "课程已学完,可以开始考试" } + return "请阅读课程内容,倒计时结束后" + (task.mode == .exam ? "即可考试" : "完成学习") + } +} + +/// 服务端考试记录;演示成绩必须明确标记。 +struct TrainingAttempt: Codable, Equatable, Sendable { + let id: String + let submittedAt: Date + let scoreHundredths: Int + let correctCount: Int + let questionCount: Int + let passed: Bool + let isDemo: Bool + let reviews: [TrainingQuestionReview] + + /// 分数最多两位小数,使用已经截断的百分之一分整数。 + var scoreText: String { + let whole = scoreHundredths / 100 + let fraction = scoreHundredths % 100 + if fraction == 0 { return String(whole) } + let digits = String(format: "%02d", fraction) + return "\(whole).\(fraction.isMultiple(of: 10) ? String(digits.prefix(1)) : digits)" + } +} + +/// 本人学习进度、草稿与全部考试历史。 +struct TrainingProgress: Codable, Equatable, Sendable { + var readingSeconds = 0 + var completedSectionIDs: Set = [] + var completedAt: Date? + var draftAnswers: TrainingAnswers = [:] + var attempts: [TrainingAttempt] = [] +} + +/// 当前学员被分配的任务,内容以发布快照为准。 +struct TrainingTask: Codable, Equatable, Sendable { + let id: String + let title: String + let publisherName: String? + let mode: TrainingMode + var status: TrainingTaskStatus + let startAt: Date + let endAt: Date + let passScore: Int + let scoring: String + let course: TrainingCourse + let questions: [TrainingQuestion] + var progress: TrainingProgress + + /// 与小程序统一的前台阅读门槛。 + static let requiredReadingSeconds = 20 + /// 当前百分制计分规则版本。 + static let equalPercentageScoring = "equal-percentage-v1" + + /// 所有未完成状态均归入待考试。 + var learnerStatus: TrainingLearnerStatus { + progress.completedAt != nil || progress.attempts.contains(where: \.passed) ? .completed : .pendingExam + } + + /// 读满时长且全部小节已经成功保存后才允许考试。 + var hasFinishedReading: Bool { + progress.readingSeconds >= Self.requiredReadingSeconds + && !course.sections.isEmpty + && Set(course.sections.map(\.id)).isSubset(of: progress.completedSectionIDs) + } + + /// 显示真实发布人;缺失时不从课程创建人推测。 + var publisherText: String { + guard let name = publisherName?.trimmingCharacters(in: .whitespacesAndNewlines), !name.isEmpty else { + return "未记录" + } + return name + } + + /// 时间窗口包含开始边界、不包含截止边界,完成后只可回顾。 + func submissionBlockReason(now: Date) -> String? { + if learnerStatus == .completed { return "任务已完成,可回顾课程和考试记录" } + if status == .closed { return "任务已结束,可回顾课程和考试记录" } + if now < startAt { return "任务尚未开始" } + if now >= endAt { return "任务已截止,可回顾课程和考试记录" } + return nil + } +} + +/// 培训业务和存储失败;避免把保存失败显示为完成。 +enum TrainingError: Error, LocalizedError, Equatable { + case unavailable, identityChanged, notFound, corruptStorage, saveFailed + case blocked(String), readingRequired, invalidPaper, invalidAnswers, unanswered(Int) + + /// 直接用于页面提示的错误说明。 + var errorDescription: String? { + switch self { + case .unavailable: "培训服务尚未接入,请等待景区开通" + case .identityChanged: "学习账号或景区已切换,请重新进入培训中心" + case .notFound: "任务不存在或未分配给当前账号" + case .corruptStorage: "本地演示数据异常,请联系管理员;原有记录未覆盖" + case .saveFailed: "保存失败,请重试;本次操作尚未完成" + case .blocked(let reason): reason + case .readingRequired: "请先完成课程阅读" + case .invalidPaper: "试卷或计分规则异常,请联系管理员" + case .invalidAnswers: "答案包含无效题目或选项,请重新进入考试" + case .unanswered(let count): "还有 \(count) 道题未作答" + } + } +} + +/// 校验试卷和答案的纯逻辑;正式成绩由服务端核算。 +enum TrainingValidation { + /// 校验百分制、唯一题目/选项及题型数量。 + static func validatePaper(_ task: TrainingTask) throws { + guard task.scoring == TrainingTask.equalPercentageScoring, + (1...100).contains(task.passScore), !task.questions.isEmpty, + task.questions.count <= 500, + Set(task.questions.map(\.id)).count == task.questions.count else { throw TrainingError.invalidPaper } + for question in task.questions { + guard !question.id.isEmpty, !question.stem.isEmpty, + (2...6).contains(question.options.count), + question.options.allSatisfy({ !$0.id.isEmpty && !$0.text.isEmpty }), + Set(question.options.map(\.id)).count == question.options.count else { throw TrainingError.invalidPaper } + } + } + + /// 校验所选 ID;完整交卷时返回漏答数量。 + static func validateAnswers(_ answers: TrainingAnswers, task: TrainingTask, requireComplete: Bool) throws { + try validatePaper(task) + guard Set(answers.keys).isSubset(of: Set(task.questions.map(\.id))) else { throw TrainingError.invalidAnswers } + var missing = 0 + for question in task.questions { + let selected = answers[question.id] ?? [] + guard selected.isSubset(of: Set(question.options.map(\.id))), + question.type != .single || selected.count <= 1 else { throw TrainingError.invalidAnswers } + if selected.isEmpty { missing += 1 } + } + if requireComplete, missing > 0 { throw TrainingError.unanswered(missing) } + } +} + +/// 使用单调时间累计前台整秒,暂停后不补记后台或离开页面的时间。 +struct TrainingReadingClock { + private var lastUptime: TimeInterval? + + /// 暂停后开始新的计时片段;持续可见时重复恢复不改变正在累计的起点。 + mutating func resume(at uptime: TimeInterval) { + guard lastUptime == nil else { return } + lastUptime = uptime + } + + /// 失去前台可见性时丢弃未满一秒的片段。 + mutating func pause() { lastUptime = nil } + + /// 每次最多累计一秒,不补记 run loop 阻塞期间的大段时间。 + mutating func takeSecond(at uptime: TimeInterval) -> Bool { + guard let lastUptime, uptime - lastUptime >= 1 else { return false } + self.lastUptime = uptime + return true + } +} diff --git a/suixinkan/Features/Training/Services/TrainingAPI.swift b/suixinkan/Features/Training/Services/TrainingAPI.swift new file mode 100644 index 0000000..c4476ef --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingAPI.swift @@ -0,0 +1,178 @@ +import Foundation + +/// 正式培训 API,显式在主 Actor 协调网络及登录上下文,不加载无关子资源。 +@MainActor +final class TrainingAPI: TrainingDataServing { + private let client: APIClient + private let tokenOverride: String? + private let eligible: Bool + private let validateContext: (@MainActor () -> Bool)? + private let prefix = "/api/app/training" + + /// 注入网络客户端;正式页面通过工厂固定本次身份,测试可单独注入校验。 + init(client: APIClient, tokenOverride: String? = nil, eligible: Bool = true, validateContext: (@MainActor () -> Bool)? = nil) { + self.client = client + self.tokenOverride = tokenOverride + self.eligible = eligible + self.validateContext = validateContext + } + + /// 为一次页面会话建立固定凭证及身份校验的数据源。 + func scoped(token: String, eligible: Bool, validateContext: @escaping @MainActor () -> Bool) -> TrainingAPI { + TrainingAPI(client: client, tokenOverride: token, eligible: eligible, validateContext: validateContext) + } + + /// GET /summary:读取本人统计。 + func summary() async throws -> TrainingSummary { try await read("/summary") } + + /// GET /tasks:状态和关键词只影响本次摘要页。 + func tasks(status: TrainingLearnerStatus?, keyword: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + var query = cursorQuery(cursor, limit: limit, maximum: 50) + if let status { query.append(item("learner_status", status.apiValue)) } + if !keyword.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { query.append(item("keyword", keyword)) } + return try await read("/tasks", query: query) + } + + /// GET /tasks/{id}:平铺任务规则,不读取正文或试卷。 + func task(id: String) async throws -> TrainingTaskDetail { try await read("/tasks/" + component(id)) } + + /// GET /courses/{id}:快照访问带本人 task_id。 + func course(id: String, taskID: String) async throws -> TrainingCourseInfo { + try await read("/courses/" + component(id), query: taskQuery(taskID)) + } + + /// GET /courses/{id}/sections:只读取目录页。 + func sections(courseID: String, taskID: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + try await read("/courses/" + component(courseID) + "/sections", query: taskQuery(taskID) + cursorQuery(cursor, limit: limit, maximum: 50)) + } + + /// GET /courses/{id}/sections/{id}:只读取一个小节。 + func section(courseID: String, sectionID: String, taskID: String) async throws -> TrainingSectionContent { + try await read("/courses/" + component(courseID) + "/sections/" + component(sectionID), query: taskQuery(taskID)) + } + + /// GET /courses/{id}/attachments:只读取附件元信息页。 + func attachments(courseID: String, taskID: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + try await read("/courses/" + component(courseID) + "/attachments", query: taskQuery(taskID) + cursorQuery(cursor, limit: limit, maximum: 50)) + } + + /// GET /courses/{id}/attachments/{id}:获取短时授权访问地址。 + func attachmentURL(courseID: String, attachmentID: String, taskID: String) async throws -> TrainingAttachmentLink { + try await read("/courses/" + component(courseID) + "/attachments/" + component(attachmentID), query: taskQuery(taskID)) + } + + /// GET /tasks/{id}/progress:读取已保存进度及资格。 + func progress(taskID: String) async throws -> TrainingProgressSnapshot { try await read("/tasks/" + component(taskID) + "/progress") } + + /// POST /tasks/{id}/study-sessions:幂等创建阅读会话。 + func startReading(taskID: String, requestID: String) async throws -> TrainingStudySession { + try await write(.post, "/tasks/" + component(taskID) + "/study-sessions", body: ReadingStartBody(requestID: requestID)) + } + + /// POST /study-sessions/{id}/heartbeat:确认当前会话读时,不自动生成新序号。 + func heartbeat(sessionID: String, sequence: Int, activeSecondsTotal: Int, final: Bool) async throws -> TrainingHeartbeatConfirmation { + try await write(.post, "/study-sessions/" + component(sessionID) + "/heartbeat", body: HeartbeatBody(sequence: sequence, activeSecondsTotal: activeSecondsTotal, final: final)) + } + + /// GET /papers/{id}:读取冻结计分规则。 + func paper(id: String, taskID: String) async throws -> TrainingPaperInfo { + try await read("/papers/" + component(id), query: taskQuery(taskID)) + } + + /// GET /papers/{id}/questions:按固定题位读取考前题目页。 + func questions(paperID: String, taskID: String, offset: Int, limit: Int) async throws -> TrainingQuestionPage { + try await read("/papers/" + component(paperID) + "/questions", query: taskQuery(taskID) + offsetQuery(offset, limit: limit, maximum: 20)) + } + + /// GET /tasks/{id}/draft:允许 limit=0 获取恢复位置和答题卡。 + func draft(taskID: String, offset: Int, limit: Int) async throws -> TrainingDraftPage { + try await read("/tasks/" + component(taskID) + "/draft", query: offsetQuery(offset, limit: limit, maximum: 100, minimum: 0)) + } + + /// PATCH /tasks/{id}/draft:只传变化题目的完整选择集合。 + func saveDraft(taskID: String, request: TrainingDraftSaveRequest) async throws -> TrainingDraftConfirmation { + try await write(.patch, "/tasks/" + component(taskID) + "/draft", body: request) + } + + /// POST /tasks/{id}/draft/reset:返回当前草稿实况,调用者按版本同步。 + func resetDraft(taskID: String, request: TrainingDraftResetRequest) async throws -> TrainingDraftConfirmation { + try await write(.post, "/tasks/" + component(taskID) + "/draft/reset", body: request) + } + + /// POST /tasks/{id}/submissions:消费已确认的草稿版本,不回传全部答案。 + func submit(taskID: String, request: TrainingSubmissionRequest) async throws -> TrainingSubmissionResult { + try await write(.post, "/tasks/" + component(taskID) + "/submissions", body: request) + } + + /// GET /attempts:任务筛选和提交恢复复用成绩分页接口。 + func attempts(taskID: String?, submissionID: String?, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + var query = cursorQuery(cursor, limit: limit, maximum: 50) + if let taskID { query.append(item("task_id", taskID)) } + if let submissionID { query.append(item("submission_id", submissionID)) } + return try await read("/attempts", query: query) + } + + /// GET /attempts/{id}:单次成绩和最新重考资格。 + func attempt(id: String) async throws -> TrainingAttemptDetail { try await read("/attempts/" + component(id)) } + + /// GET /attempts/{id}/reviews:单页最多十条,不自动下载全部解析。 + func reviews(attemptID: String, cursor: String?, limit: Int) async throws -> TrainingReviewPage { + try await read("/attempts/" + component(attemptID) + "/reviews", query: cursorQuery(cursor, limit: limit, maximum: 10)) + } + + private func read(_ path: String, query: [URLQueryItem] = []) async throws -> Response { + try await perform(APIRequest(method: .get, path: prefix + path, queryItems: query)) + } + + private func write(_ method: HTTPMethod, _ path: String, body: Body) async throws -> Response { + try await perform(APIRequest(method: method, path: prefix + path, body: body)) + } + + private func perform(_ request: APIRequest) async throws -> Response { + try checkContext() + do { + let response = try await client.send(request, tokenOverride: tokenOverride) + try checkContext() + return response + } catch { + try checkContext() + throw TrainingRemoteError.map(error) + } + } + + private func checkContext() throws { + guard eligible else { throw TrainingRemoteError.accountInvalid("请切换到店铺账号后进入培训中心") } + guard validateContext?() != false else { throw TrainingRemoteError.identityChanged } + } + + nonisolated private func item(_ name: String, _ value: String) -> URLQueryItem { URLQueryItem(name: name, value: value) } + nonisolated private func taskQuery(_ id: String) -> [URLQueryItem] { [item("task_id", id)] } + nonisolated private func cursorQuery(_ cursor: String?, limit: Int, maximum: Int) -> [URLQueryItem] { + var query = [item("limit", String(min(max(limit, 1), maximum)))] + if let cursor, !cursor.isEmpty { query.append(item("cursor", cursor)) } + return query + } + nonisolated private func offsetQuery(_ offset: Int, limit: Int, maximum: Int, minimum: Int = 1) -> [URLQueryItem] { + [item("offset", String(max(offset, 0))), item("limit", String(min(max(limit, minimum), maximum)))] + } + nonisolated private func component(_ id: String) -> String { + id.addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "-._~"))) ?? id + } + + /// 阅读会话创建请求,幂等键由业务状态持久保留。 + private struct ReadingStartBody: Encodable { + let requestID: String + enum CodingKeys: String, CodingKey { case requestID = "request_id" } + } + + /// 会话心跳请求;累计读时为本会话范围。 + private struct HeartbeatBody: Encodable { + let sequence: Int + let activeSecondsTotal: Int + let final: Bool + enum CodingKeys: String, CodingKey { + case sequence, final + case activeSecondsTotal = "active_seconds_total" + } + } +} diff --git a/suixinkan/Features/Training/Services/TrainingDataService.swift b/suixinkan/Features/Training/Services/TrainingDataService.swift new file mode 100644 index 0000000..2a12456 --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingDataService.swift @@ -0,0 +1,128 @@ +import Foundation + +/// 正式培训数据源;各资源独立读取,不为页面拼接全量任务聚合。 +protocol TrainingDataServing: Sendable { + /// 获取当前学员全局统计。 + func summary() async throws -> TrainingSummary + /// 按状态和关键词读取任务摘要页。 + func tasks(status: TrainingLearnerStatus?, keyword: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage + /// 获取任务规则和快照引用。 + func task(id: String) async throws -> TrainingTaskDetail + /// 获取课程元信息,附当前授权任务。 + func course(id: String, taskID: String) async throws -> TrainingCourseInfo + /// 获取小节目录页。 + func sections(courseID: String, taskID: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage + /// 读取一个小节的正式正文。 + func section(courseID: String, sectionID: String, taskID: String) async throws -> TrainingSectionContent + /// 读取附件元信息页。 + func attachments(courseID: String, taskID: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage + /// 获取短期附件授权链接。 + func attachmentURL(courseID: String, attachmentID: String, taskID: String) async throws -> TrainingAttachmentLink + /// 刷新服务端已保存进度与操作资格。 + func progress(taskID: String) async throws -> TrainingProgressSnapshot + /// 按幂等键建立阅读会话。 + func startReading(taskID: String, requestID: String) async throws -> TrainingStudySession + /// 按会话序号确认有效读时;重试保持相同请求内容。 + func heartbeat(sessionID: String, sequence: Int, activeSecondsTotal: Int, final: Bool) async throws -> TrainingHeartbeatConfirmation + /// 读取考试规则,不获取全部试题。 + func paper(id: String, taskID: String) async throws -> TrainingPaperInfo + /// 按固定题位读取试题页。 + func questions(paperID: String, taskID: String, offset: Int, limit: Int) async throws -> TrainingQuestionPage + /// 获取草稿元信息及当前题位答案;limit=0 只读取元信息。 + func draft(taskID: String, offset: Int, limit: Int) async throws -> TrainingDraftPage + /// 串行增量保存本人选择。 + func saveDraft(taskID: String, request: TrainingDraftSaveRequest) async throws -> TrainingDraftConfirmation + /// 用户确认重考后重置草稿;响应是当前实况而非恒定空草稿。 + func resetDraft(taskID: String, request: TrainingDraftResetRequest) async throws -> TrainingDraftConfirmation + /// 消费已保存草稿版本并幂等交卷。 + func submit(taskID: String, request: TrainingSubmissionRequest) async throws -> TrainingSubmissionResult + /// 分页读取成绩;taskID+submissionID 可恢复一次交卷结果。 + func attempts(taskID: String?, submissionID: String?, cursor: String?, limit: Int) async throws -> TrainingCursorPage + /// 读取一条成绩和最新重考资格。 + func attempt(id: String) async throws -> TrainingAttemptDetail + /// 用户展开时读取解析页。 + func reviews(attemptID: String, cursor: String?, limit: Int) async throws -> TrainingReviewPage +} + +/// 培训稳定业务码及身份切换;保留服务器文案,恢复逻辑只依据枚举或 code。 +enum TrainingRemoteError: Error, LocalizedError, Equatable, Sendable { + case accountInvalid(String), forbidden(String), notWritable(String), readingRequired(String) + case sessionExpired(String), sessionConflict(String), draftRevisionConflict(String), idempotencyConflict(String) + case answerInvalid(String), answerIncomplete(String), examNotAllowed(String), contentMissing(String) + case attemptNotFound(String), paramInvalid(String), identityChanged + + /// 返回稳定业务码,身份切换属于本地拒绝,没有服务端 code。 + var code: Int? { + switch self { + case .accountInvalid: 150100 + case .forbidden: 150101 + case .notWritable: 150102 + case .readingRequired: 150103 + case .sessionExpired: 150104 + case .sessionConflict: 150105 + case .draftRevisionConflict: 150106 + case .idempotencyConflict: 150107 + case .answerInvalid: 150108 + case .answerIncomplete: 150109 + case .examNotAllowed: 150110 + case .contentMissing: 150111 + case .attemptNotFound: 150112 + case .paramInvalid: 150113 + case .identityChanged: nil + } + } + + /// 用于页面展示的错误文案,不参与错误分类。 + var errorDescription: String? { + switch self { + case let .accountInvalid(message), let .forbidden(message), let .notWritable(message), let .readingRequired(message), + let .sessionExpired(message), let .sessionConflict(message), let .draftRevisionConflict(message), + let .idempotencyConflict(message), let .answerInvalid(message), let .answerIncomplete(message), + let .examNotAllowed(message), let .contentMissing(message), let .attemptNotFound(message), let .paramInvalid(message): message + case .identityChanged: "学习账号或业务身份已切换,请重新进入培训中心" + } + } + + /// 转换培训业务错误;网络和真正登录失效错误仍保留原类型。 + static func map(_ error: Error) -> Error { + guard let apiError = error as? APIError, + case let .serverCode(code, message) = apiError else { return error } + switch code { + case 150100: return Self.accountInvalid(message) + case 150101: return Self.forbidden(message) + case 150102: return Self.notWritable(message) + case 150103: return Self.readingRequired(message) + case 150104: return Self.sessionExpired(message) + case 150105: return Self.sessionConflict(message) + case 150106: return Self.draftRevisionConflict(message) + case 150107: return Self.idempotencyConflict(message) + case 150108: return Self.answerInvalid(message) + case 150109: return Self.answerIncomplete(message) + case 150110: return Self.examNotAllowed(message) + case 150111: return Self.contentMissing(message) + case 150112: return Self.attemptNotFound(message) + case 150113: return Self.paramInvalid(message) + default: return error + } + } +} + +/// 生产数据源固定进入时的账号和业务上下文,拒绝切换身份后的迟到响应。 +enum TrainingRemoteServiceFactory { + /// 当前店铺身份才可接入;Token 与业务范围固定在本次页面会话。 + @MainActor static func production() -> any TrainingDataServing { + let session = AppStore.shared.session + let token = session.token + let scope = session.accountCachePrefix + let scenicID = session.currentScenicId + let storeID = session.currentStoreId + let eligible = !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + && session.accountType == .storeUser && !scope.isEmpty + return NetworkServices.shared.trainingAPI.scoped(token: token, eligible: eligible, validateContext: { + let current = AppStore.shared.session + return current.isLoggedIn && current.accountType == .storeUser + && current.accountCachePrefix == scope && current.token == token + && current.currentScenicId == scenicID && current.currentStoreId == storeID + }) + } +} diff --git a/suixinkan/Features/Training/Services/TrainingDemoService.swift b/suixinkan/Features/Training/Services/TrainingDemoService.swift new file mode 100644 index 0000000..16b9575 --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingDemoService.swift @@ -0,0 +1,253 @@ +#if DEBUG +import Foundation + +/// 可替换的演示存储,用于验证原子保存与存储失败。 +protocol TrainingDemoStoring: Sendable { + /// 不存在时返回 nil;读取错误必须向调用者报告。 + func read(key: String) throws -> Data? + /// 原子写入一个作用域的完整快照。 + func write(_ data: Data, key: String) throws +} + +/// 使用原子文件保存本机演示,实际磁盘错误不会被忽略。 +struct TrainingDemoFileStorage: TrainingDemoStoring { + let directory: URL + + /// 默认存储在 App Application Support,不接触后台数据。 + init(directory: URL = URL.applicationSupportDirectory.appendingPathComponent("TrainingDemo", isDirectory: true)) { + self.directory = directory + } + + /// 保留读取失败,避免把坏文件当作首次使用。 + func read(key: String) throws -> Data? { + let url = fileURL(key: key) + guard FileManager.default.fileExists(atPath: url.path) else { return nil } + return try Data(contentsOf: url) + } + + /// 写入失败时原子文件不会被替换成不完整内容。 + func write(_ data: Data, key: String) throws { + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + try data.write(to: fileURL(key: key), options: .atomic) + } + + private func fileURL(key: String) -> URL { + let name = Data(key.utf8).map { String(format: "%02x", $0) }.joined() + return directory.appendingPathComponent(name).appendingPathExtension("json") + } +} + +/// 仅开发演示使用的答案和解析,绝不进入正式试卷模型。 +struct TrainingDemoSolution: Codable, Sendable { + let correctIDs: Set + let explanation: String +} + +/// 冻结任务内容、开发判分材料和学员进度。 +struct TrainingDemoPack: Codable, Sendable { + var task: TrainingTask + let solutions: [String: TrainingDemoSolution] +} + +/// 带版本的开发记录;未知版本和损坏文件均保留原数据。 +private struct TrainingDemoState: Codable { + let version: Int + var packs: [TrainingDemoPack] +} + +/// 开发演示数据源;actor 串行处理草稿、阅读和幂等交卷。 +actor TrainingDemoService: TrainingServing { + /// 页面据此标记本机演示任务与成绩,区分正式数据源。 + nonisolated let isDemo = true + private let context: TrainingContext + private let storage: any TrainingDemoStoring + private let now: @Sendable () -> Date + private let seed: @Sendable (Date) -> [TrainingDemoPack] + private let validateContext: @MainActor @Sendable () -> Bool + + /// 注入时钟、存储与身份校验,便于真机测试全部边界。 + init( + context: TrainingContext, + storage: any TrainingDemoStoring = TrainingDemoFileStorage(), + now: @escaping @Sendable () -> Date = { Date() }, + seed: @escaping @Sendable (Date) -> [TrainingDemoPack] = TrainingDemoFixtures.makePacks, + validateContext: @escaping @MainActor @Sendable () -> Bool = { true } + ) { + self.context = context + self.storage = storage + self.now = now + self.seed = seed + self.validateContext = validateContext + } + + /// 获取当前作用域全部本人演示任务。 + func listTasks() async throws -> [TrainingTask] { + try await authorize() + return try load().packs.map(\.task) + } + + /// 读取固定快照,后续示例代码更新不会覆盖已保存内容。 + func task(id: String) async throws -> TrainingTask { + try await authorize() + let state = try load() + return state.packs[try index(id, in: state)].task + } + + /// 前台阅读每次增加一秒,写入成功后才向页面返回完成进度。 + func recordReadingSecond(taskID: String) async throws -> TrainingTask { + try await authorize() + var state = try load() + let index = try index(taskID, in: state) + var task = state.packs[index].task + if task.learnerStatus == .completed || task.hasFinishedReading { return task } + try ensureOpen(task) + guard !task.course.sections.isEmpty, + Set(task.course.sections.map(\.id)).count == task.course.sections.count else { throw TrainingError.invalidPaper } + task.progress.readingSeconds = min(TrainingTask.requiredReadingSeconds, task.progress.readingSeconds + 1) + if task.progress.readingSeconds >= TrainingTask.requiredReadingSeconds { + task.progress.completedSectionIDs = Set(task.course.sections.map(\.id)) + if task.mode == .study { task.progress.completedAt = now() } + } + state.packs[index].task = task + try save(state) + return task + } + + /// 答案校验和保存作为同一笔操作,失败不清空原有草稿。 + func saveDraft(taskID: String, answers: TrainingAnswers) async throws { + try await authorize() + var state = try load() + let index = try index(taskID, in: state) + let task = state.packs[index].task + try ensureExamAllowed(task) + try TrainingValidation.validateAnswers(answers, task: task, requireComplete: false) + state.packs[index].task.progress.draftAnswers = answers + try save(state) + } + + /// 演示百分制本地判分;同一幂等键和答案返回原记录,正式服务须改为服务端判分。 + func submit(taskID: String, answers: TrainingAnswers, submissionID: String) async throws -> TrainingAttempt { + try await authorize() + var state = try load() + let index = try index(taskID, in: state) + let pack = state.packs[index] + guard !submissionID.isEmpty else { throw TrainingError.invalidAnswers } + if let attempt = pack.task.progress.attempts.first(where: { $0.id == submissionID }) { + let submitted = Dictionary(uniqueKeysWithValues: attempt.reviews.map { ($0.question.id, $0.selectedIDs) }) + guard submitted == answers else { throw TrainingError.invalidAnswers } + return attempt + } + try ensureExamAllowed(pack.task) + try TrainingValidation.validateAnswers(answers, task: pack.task, requireComplete: true) + let reviews = try pack.task.questions.map { question in + guard let solution = pack.solutions[question.id], + !solution.correctIDs.isEmpty, + solution.correctIDs.isSubset(of: Set(question.options.map(\.id))), + question.type == .single ? solution.correctIDs.count == 1 : solution.correctIDs.count >= 2 else { + throw TrainingError.invalidPaper + } + return TrainingQuestionReview(question: question, selectedIDs: answers[question.id] ?? [], + correctIDs: solution.correctIDs, explanation: solution.explanation) + } + let correct = reviews.filter(\.isCorrect).count + let count = reviews.count + let attempt = TrainingAttempt(id: submissionID, submittedAt: now(), scoreHundredths: correct * 10_000 / count, + correctCount: correct, questionCount: count, + passed: correct * 100 >= pack.task.passScore * count, isDemo: true, reviews: reviews) + state.packs[index].task.progress.attempts.append(attempt) + state.packs[index].task.progress.draftAnswers = [:] + if attempt.passed { state.packs[index].task.progress.completedAt = attempt.submittedAt } + try save(state) + return attempt + } + + private func authorize() async throws { + guard await validateContext() else { throw TrainingError.identityChanged } + } + + private func ensureOpen(_ task: TrainingTask) throws { + if let reason = task.submissionBlockReason(now: now()) { throw TrainingError.blocked(reason) } + } + + private func ensureExamAllowed(_ task: TrainingTask) throws { + try ensureOpen(task) + guard task.mode == .exam else { throw TrainingError.invalidPaper } + guard task.hasFinishedReading else { throw TrainingError.readingRequired } + } + + private func index(_ id: String, in state: TrainingDemoState) throws -> Int { + guard let index = state.packs.firstIndex(where: { $0.task.id == id }) else { throw TrainingError.notFound } + return index + } + + private func load() throws -> TrainingDemoState { + let data: Data? + do { data = try storage.read(key: context.storageKey) } catch { throw TrainingError.saveFailed } + guard let data else { + let initial = TrainingDemoState(version: 1, packs: seed(now())) + try save(initial) + return initial + } + guard let state = try? JSONDecoder().decode(TrainingDemoState.self, from: data), state.version == 1, + Set(state.packs.map { $0.task.id }).count == state.packs.count, + state.packs.allSatisfy({ !$0.task.id.isEmpty }) else { throw TrainingError.corruptStorage } + return state + } + + private func save(_ state: TrainingDemoState) throws { + do { try storage.write(JSONEncoder().encode(state), key: context.storageKey) } + catch { throw TrainingError.saveFailed } + } +} + +/// 示例取材于小程序培训内容;不代表正式景区政策。 +enum TrainingDemoFixtures { + /// 首次建立固定课程和试卷快照,不根据真实人员名单生成任务。 + /// 任务有效期相对首次建立时间设置,后续读取保持已持久化快照。 + static func makePacks(now: Date) -> [TrainingDemoPack] { + let sections = [ + TrainingSection(id: "section-1", title: "接待礼仪与服务告知", contentHTML: """ +

    让游客明白,再开始服务

    主动问候,介绍服务项目、费用、交付内容与时间。未经游客确认,不增加收费项目。

    +

    遇到相似套餐,要讲清包含和不包含的项目。如果游客没有听清,应换一种表达再次说明,不把沉默当作确认。

    +
    • 主动、清晰地说明服务范围
    • 尊重游客的知情与选择
    • 保持耐心,不作无法兑现的承诺
    + """), + TrainingSection(id: "section-2", title: "问题反馈与协同处理", contentHTML: """ +

    先倾听,再记录,再处理

    遇到问题先完整听取诉求,客观记录事情经过。超出职责范围时,联系景区工作人员协同处理,并跟进反馈。

    +

    交接时说明已核实的信息、尚未解决的问题及后续负责人。预计无法按原时间反馈时,及时说明变化。

    +

    演示提醒:实际处理要求以景区发布的正式制度为准。

    + """) + ] + let questions = [ + TrainingQuestion(id: "q1", type: .single, stem: "开始服务前,应先完成哪项工作?", options: [ + TrainingOption(id: "A", text: "说明项目、费用并取得游客确认"), TrainingOption(id: "B", text: "直接拍摄,结束后告知费用"), + TrainingOption(id: "C", text: "仅口头承诺,不介绍交付内容")]), + TrainingQuestion(id: "q2", type: .multiple, stem: "遇到超出职责范围的问题,以下做法正确的是?", options: [ + TrainingOption(id: "A", text: "倾听并记录游客诉求"), TrainingOption(id: "B", text: "联系景区工作人员协同处理"), + TrainingOption(id: "C", text: "忽略问题,不再反馈")]), + TrainingQuestion(id: "q3", type: .single, stem: "无法确定交付时间时,应该怎样回应?", options: [ + TrainingOption(id: "A", text: "随口给出一个时间"), TrainingOption(id: "B", text: "说明需要核实并约定反馈方式"), + TrainingOption(id: "C", text: "先保证今天完成")]), + TrainingQuestion(id: "q4", type: .multiple, stem: "交接服务时应明确哪些内容?", options: [ + TrainingOption(id: "A", text: "尚未解决的问题"), TrainingOption(id: "B", text: "后续负责人"), + TrainingOption(id: "C", text: "已核实的信息"), TrainingOption(id: "D", text: "把未经核实的猜测作为事实")]) + ] + let solutions = [ + "q1": TrainingDemoSolution(correctIDs: ["A"], explanation: "开始服务前应清晰告知项目、费用及交付约定,并取得游客确认。"), + "q2": TrainingDemoSolution(correctIDs: ["A", "B"], explanation: "先倾听记录,再协同处理,并跟进反馈。多选必须全部选对。"), + "q3": TrainingDemoSolution(correctIDs: ["B"], explanation: "不确定的信息应核实后反馈,不作无法兑现的承诺。"), + "q4": TrainingDemoSolution(correctIDs: ["A", "B", "C"], explanation: "交接应包含已核实信息、待办事项和后续负责人。") + ] + let course = TrainingCourse(title: "景区服务规范与游客沟通", introduction: "从接待到反馈,统一一线服务标准。以下为开发演示材料。", sections: sections, attachments: []) + func make(id: String, title: String, mode: TrainingMode, passScore: Int) -> TrainingDemoPack { + let task = TrainingTask(id: id, title: title, publisherName: "演示管理员", mode: mode, status: .published, + startAt: now.addingTimeInterval(-86400), endAt: now.addingTimeInterval(7 * 86400), + passScore: passScore, scoring: TrainingTask.equalPercentageScoring, course: course, + questions: mode == .exam ? questions : [], progress: TrainingProgress()) + return TrainingDemoPack(task: task, solutions: mode == .exam ? solutions : [:]) + } + return [make(id: "demo-service", title: "一线服务规范学习(演示)", mode: .exam, passScore: 100), + make(id: "demo-review", title: "游客沟通巩固练习(演示)", mode: .exam, passScore: 75), + make(id: "demo-study", title: "接待礼仪课程学习(演示)", mode: .study, passScore: 100)] + } +} +#endif diff --git a/suixinkan/Features/Training/Services/TrainingDocumentLoader.swift b/suixinkan/Features/Training/Services/TrainingDocumentLoader.swift new file mode 100644 index 0000000..b22408f --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingDocumentLoader.swift @@ -0,0 +1,147 @@ +import Foundation + +/// 课程附件允许在 App 内预览的文件格式,旧版 DOC 不作为 DOCX 处理。 +enum TrainingDocumentKind: String, Sendable { + case pdf, docx, txt, md + + /// 优先使用附件名称中的格式;无扩展名时才参考 URL 和 MIME。 + static func resolve(name: String, mimeType: String, url: URL) throws -> Self { + let namedExtension = (name as NSString).pathExtension.lowercased() + let fileExtension = namedExtension.isEmpty ? url.pathExtension.lowercased() : namedExtension + if !fileExtension.isEmpty { + guard let kind = Self(rawValue: fileExtension) else { throw TrainingDocumentError.unsupported } + return kind + } + switch mimeType.lowercased().split(separator: ";").first.map(String.init) { + case "application/pdf": return .pdf + case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return .docx + case "text/plain": return .txt + case "text/markdown", "text/x-markdown": return .md + default: throw TrainingDocumentError.unsupported + } + } +} + +/// 单次预览持有的私有临时文件,离开页面或切换附件后明确清理。 +struct TrainingLocalDocument: Sendable { + let fileURL: URL + let kind: TrainingDocumentKind + let name: String + let temporaryDirectory: URL? + + /// 只清理由下载器为本次预览创建的目录。 + func removeTemporaryFile() { + if let temporaryDirectory { try? FileManager.default.removeItem(at: temporaryDirectory) } + } +} + +/// 下载替身与正式实现共用的入口;不依赖视图或 App 登录客户端。 +protocol TrainingDocumentLoading: Sendable { + /// 原样读取授权链接,返回预览器可使用的本地文件。 + func load(attachment: TrainingAttachmentInfo, link: TrainingAttachmentLink) async throws -> TrainingLocalDocument +} + +/// 文件预览失败的可恢复原因。 +enum TrainingDocumentError: LocalizedError { + case unsupported, invalidURL, tooLarge, empty, invalidResponse, invalidFile + + var errorDescription: String? { + switch self { + case .unsupported: return "暂不支持此文件格式,请使用 PDF、DOCX、TXT 或 MD" + case .invalidURL: return "附件访问地址无效,请重试" + case .tooLarge: return "附件超过 30 MB,暂时无法预览" + case .empty: return "附件内容为空" + case .invalidResponse: return "附件下载失败,请重试" + case .invalidFile: return "附件格式不正确或文件已损坏" + } + } +} + +/// 独立的无凭证文件下载器,不复用带 Token 的业务网络会话。 +final class TrainingDocumentLoader: TrainingDocumentLoading, @unchecked Sendable { + static let maximumBytes = 30 * 1_024 * 1_024 + private let session: URLSession + + /// 使用短期、无 Cookie、无凭证存储的下载会话。 + init() { + let configuration = URLSessionConfiguration.ephemeral + configuration.httpCookieStorage = nil + configuration.httpShouldSetCookies = false + configuration.urlCredentialStorage = nil + configuration.urlCache = nil + configuration.timeoutIntervalForRequest = 60 + configuration.timeoutIntervalForResource = 120 + session = URLSession(configuration: configuration) + } + + /// 下载时保留 URL 的完整签名参数;文件名不会参与磁盘路径拼接。 + func load(attachment: TrainingAttachmentInfo, link: TrainingAttachmentLink) async throws -> TrainingLocalDocument { + guard Self.isAllowed(link.url) else { throw TrainingDocumentError.invalidURL } + let kind = try TrainingDocumentKind.resolve(name: attachment.name, mimeType: attachment.mimeType, url: link.url) + guard attachment.sizeBytes <= Self.maximumBytes else { throw TrainingDocumentError.tooLarge } + var request = URLRequest(url: link.url, cachePolicy: .reloadIgnoringLocalCacheData) + request.httpShouldHandleCookies = false + let delegate = TrainingDocumentDownloadDelegate() + let download: URL + let response: URLResponse + do { (download, response) = try await session.download(for: request, delegate: delegate) } + catch { + if delegate.exceededSize { throw TrainingDocumentError.tooLarge } + throw error + } + defer { try? FileManager.default.removeItem(at: download) } + try Task.checkCancellation() + guard let http = response as? HTTPURLResponse, (200..<300).contains(http.statusCode), + let finalURL = http.url, Self.isAllowed(finalURL) else { throw TrainingDocumentError.invalidResponse } + let size = (try FileManager.default.attributesOfItem(atPath: download.path)[.size] as? NSNumber)?.intValue ?? 0 + guard size > 0 else { throw TrainingDocumentError.empty } + guard size <= Self.maximumBytes, response.expectedContentLength <= Self.maximumBytes else { throw TrainingDocumentError.tooLarge } + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("training-preview-\(UUID().uuidString)", isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + do { + let target = directory.appendingPathComponent("document.\(kind.rawValue)") + try FileManager.default.moveItem(at: download, to: target) + try Task.checkCancellation() + return TrainingLocalDocument(fileURL: target, kind: kind, name: attachment.name, temporaryDirectory: directory) + } catch { + try? FileManager.default.removeItem(at: directory) + throw error + } + } + + /// 授权文件与重定向均只允许有效 HTTP/HTTPS 地址。 + static func isAllowed(_ url: URL) -> Bool { + ["http", "https"].contains(url.scheme?.lowercased() ?? "") && url.host?.isEmpty == false + && url.user == nil && url.password == nil + } + + deinit { session.invalidateAndCancel() } +} + +/// 下载过程中限制体积;重定向不允许进入本地协议或携带账号口令。 +private final class TrainingDocumentDownloadDelegate: NSObject, URLSessionDownloadDelegate, @unchecked Sendable { + private let lock = NSLock() + private var sizeExceeded = false + var exceededSize: Bool { lock.withLock { sizeExceeded } } + + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) { + if totalBytesWritten > TrainingDocumentLoader.maximumBytes || totalBytesExpectedToWrite > TrainingDocumentLoader.maximumBytes { + lock.withLock { sizeExceeded = true } + downloadTask.cancel() + } + } + + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {} + + func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) { + guard let url = request.url, TrainingDocumentLoader.isAllowed(url) else { completionHandler(nil); return } + var safe = request + safe.setValue(nil, forHTTPHeaderField: "Authorization") + safe.setValue(nil, forHTTPHeaderField: "Cookie") + safe.setValue(nil, forHTTPHeaderField: "Referer") + safe.httpShouldHandleCookies = false + completionHandler(safe) + } +} diff --git a/suixinkan/Features/Training/Services/TrainingDraftStore.swift b/suixinkan/Features/Training/Services/TrainingDraftStore.swift new file mode 100644 index 0000000..abe8f93 --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingDraftStore.swift @@ -0,0 +1,150 @@ +import Foundation +import CryptoKit + +/// 一题尚未确认的本机选择,题号用于离线恢复答题卡。 +struct TrainingDraftLocalAnswer: Codable, Equatable, Sendable { + let questionID: String + let order: Int + let selectedOptionIDs: [String] +} + +/// 持久保存本机意图和已冻结的请求;账号范围中不保存登录凭证。 +struct TrainingDraftRecord: Codable, Equatable, Sendable { + var generation: String = UUID().uuidString + let taskID: String + let paperSnapshotID: String + let accountScope: String + let scenicID: Int + let storeID: Int + var revision: Int + var answers: [TrainingDraftLocalAnswer] + var lastQuestionOrder: Int? + var pendingSave: TrainingDraftSaveRequest? + var pendingReset: TrainingDraftResetRequest? + var hasConflict: Bool + + /// 用固定的业务身份建立草稿日志。 + init(taskID: String, paperSnapshotID: String, context: TrainingContext, revision: Int, + answers: [TrainingDraftLocalAnswer] = [], lastQuestionOrder: Int? = nil, + pendingSave: TrainingDraftSaveRequest? = nil, pendingReset: TrainingDraftResetRequest? = nil, + hasConflict: Bool = false) { + self.taskID = taskID + self.paperSnapshotID = paperSnapshotID + accountScope = context.accountScope + scenicID = context.scenicID + storeID = context.storeID + self.revision = revision + self.answers = answers + self.lastQuestionOrder = lastQuestionOrder + self.pendingSave = pendingSave + self.pendingReset = pendingReset + self.hasConflict = hasConflict + } + + /// 草稿所属的账号、景区和店铺。 + var context: TrainingContext { TrainingContext(accountScope: accountScope, scenicID: scenicID, storeID: storeID) } +} + +/// 损坏日志或其它页面接管日志时,禁止继续覆盖未确认答案。 +enum TrainingDraftStorageError: Error, LocalizedError, Equatable { + case invalidRecord, replaced, unavailable + + /// 可呈现给用户的草稿恢复错误。 + var errorDescription: String? { + switch self { + case .invalidRecord: "本机未保存答案暂无法恢复,请保留当前页面并重试" + case .replaced: "此任务已在另一答题页面打开,请返回后重新进入" + case .unavailable: "未能保存本机答案,请检查可用空间后重试" + } + } +} + +/// 按账号、景区、店铺、任务和试卷隔离草稿,以代次比较防止迟到回调覆盖新页面。 +final class TrainingDraftStore { + private static let lock = NSRecursiveLock() + private let defaults: UserDefaults + private let directoryURL: URL? + + /// 正式日志使用原子文件;测试可注入目录或独立 defaults 替身,不读取正式用户日志。 + init(defaults: UserDefaults = .standard, directoryURL: URL? = nil) { + self.defaults = defaults + if let directoryURL { self.directoryURL = directoryURL } + else if defaults === UserDefaults.standard { + let support = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first + ?? URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("Library/Application Support") + self.directoryURL = support.appendingPathComponent("TrainingDrafts", isDirectory: true) + } else { self.directoryURL = nil } + } + + /// 恢复日志;损坏记录不可当成无本机答案而自动覆盖。 + func load(taskID: String, paperSnapshotID: String, context: TrainingContext) throws -> TrainingDraftRecord? { + Self.lock.lock() + defer { Self.lock.unlock() } + let storageKey = key(taskID, paperSnapshotID, context) + let data: Data? + if let fileURL = fileURL(storageKey), FileManager.default.fileExists(atPath: fileURL.path) { + do { data = try Data(contentsOf: fileURL) } + catch { throw TrainingDraftStorageError.unavailable } + } else { data = defaults.data(forKey: storageKey) } + guard let data else { return nil } + guard let record = try? JSONDecoder().decode(TrainingDraftRecord.self, from: data), + record.taskID == taskID, record.paperSnapshotID == paperSnapshotID, record.context == context, + isValid(record) else { throw TrainingDraftStorageError.invalidRecord } + return record + } + + /// 比较旧代次后原子更新日志,返回新代次;即使已保存也保留轻量代次防止旧页面复写。 + @discardableResult + func save(_ value: TrainingDraftRecord, replacing generation: String?) throws -> String { + Self.lock.lock() + defer { Self.lock.unlock() } + guard isValid(value) else { throw TrainingDraftStorageError.invalidRecord } + let existing = try load(taskID: value.taskID, paperSnapshotID: value.paperSnapshotID, context: value.context) + guard existing?.generation == generation else { throw TrainingDraftStorageError.replaced } + var updated = value + updated.generation = UUID().uuidString + let data = try JSONEncoder().encode(updated) + let storageKey = key(value.taskID, value.paperSnapshotID, value.context) + if let fileURL = fileURL(storageKey), let directoryURL { + do { + try FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: true) + // 原子替换完成才允许调用方发起 RPC;不依赖 UserDefaults 的异步磁盘刷新。 + try data.write(to: fileURL, options: .atomic) + } catch { throw TrainingDraftStorageError.unavailable } + } else { defaults.set(data, forKey: storageKey) } + return updated.generation + } + + private func fileURL(_ storageKey: String) -> URL? { + let name = SHA256.hash(data: Data(storageKey.utf8)).map { String(format: "%02x", $0) }.joined() + return directoryURL?.appendingPathComponent(name + ".json") + } + + private func isValid(_ record: TrainingDraftRecord) -> Bool { + func validOptions(_ values: [String]) -> Bool { + values.count <= 6 && values.allSatisfy { !$0.isEmpty } && Set(values).count == values.count + } + func validPosition(_ value: Int?) -> Bool { value == nil || (1...500).contains(value!) } + guard !record.generation.isEmpty, !record.taskID.isEmpty, !record.paperSnapshotID.isEmpty, + !record.accountScope.isEmpty, record.revision > 0, validPosition(record.lastQuestionOrder), + record.answers.count <= 500, Set(record.answers.map(\.questionID)).count == record.answers.count, + Set(record.answers.map(\.order)).count == record.answers.count, + record.answers.allSatisfy({ !$0.questionID.isEmpty && (1...500).contains($0.order) && validOptions($0.selectedOptionIDs) }), + record.pendingSave == nil || record.pendingReset == nil else { return false } + if let request = record.pendingSave { + guard request.paperSnapshotID == record.paperSnapshotID, !request.requestID.isEmpty, + request.baseRevision > 0, validPosition(request.lastQuestionOrder), request.changes.count <= 20, + Set(request.changes.map(\.questionID)).count == request.changes.count, + request.changes.allSatisfy({ !$0.questionID.isEmpty && validOptions($0.selectedOptionIDs) }) else { return false } + } + if let request = record.pendingReset { + guard request.paperSnapshotID == record.paperSnapshotID, !request.requestID.isEmpty, request.baseRevision > 0 else { return false } + } + return true + } + + private func key(_ task: String, _ paper: String, _ context: TrainingContext) -> String { + let components = [context.accountScope, String(context.scenicID), String(context.storeID), task, paper] + return "training-draft:v1:" + components.map { Data($0.utf8).base64EncodedString() }.joined(separator: ":") + } +} diff --git a/suixinkan/Features/Training/Services/TrainingPendingSubmissionStore.swift b/suixinkan/Features/Training/Services/TrainingPendingSubmissionStore.swift new file mode 100644 index 0000000..78ec39c --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingPendingSubmissionStore.swift @@ -0,0 +1,93 @@ +import Foundation + +/// 未确认交卷的原始请求及所属业务身份,供 App 重启后沿原键恢复。 +struct TrainingPendingSubmission: Codable, Equatable, Sendable { + let taskID: String + let request: TrainingSubmissionRequest + let accountScope: String + let scenicID: Int + let storeID: Int + + /// 固定本次提交的身份和请求,恢复时不读取新的草稿版本替换它。 + init(taskID: String, request: TrainingSubmissionRequest, context: TrainingContext) { + self.taskID = taskID + self.request = request + accountScope = context.accountScope + scenicID = context.scenicID + storeID = context.storeID + } + + /// 本次交卷的持久化作用域,不包含 Token。 + var context: TrainingContext { + TrainingContext(accountScope: accountScope, scenicID: scenicID, storeID: storeID) + } +} + +/// 待恢复记录损坏时停止生成新提交,避免重复成绩。 +enum TrainingPendingSubmissionError: Error, LocalizedError, Equatable, Sendable { + case invalidRecord, alreadyPending + + /// 告知用户尚不能安全恢复本次提交。 + var errorDescription: String? { + switch self { + case .invalidRecord: "上次交卷状态暂无法确认,请联系工作人员核查成绩后重试" + case .alreadyPending: "上次交卷尚未确认,请先恢复原提交结果" + } + } +} + +/// 按账号、景区、店铺和任务隔离待确认交卷,支持注入独立 UserDefaults 测试。 +final class TrainingPendingSubmissionStore { + private static let lock = NSRecursiveLock() + private let defaults: UserDefaults + + /// 使用指定的持久化域保存不含凭证的交卷请求。 + init(defaults: UserDefaults = .standard) { self.defaults = defaults } + + /// 草稿与交卷使用同一注入域,但以独立的键和数据格式保存。 + func makeDraftStore() -> TrainingDraftStore { TrainingDraftStore(defaults: defaults) } + + /// 当前店铺登录身份;与正式数据源一致,不要求景区 ID 大于零。 + @MainActor static func currentContext() -> TrainingContext? { + let session = AppStore.shared.session + guard session.isLoggedIn, session.accountType == .storeUser, !session.accountCachePrefix.isEmpty else { return nil } + return TrainingContext(accountScope: session.accountCachePrefix, scenicID: session.currentScenicId, storeID: session.currentStoreId) + } + + /// 读取当前作用域记录,损坏记录不当作首次交卷处理。 + func load(taskID: String, context: TrainingContext) throws -> TrainingPendingSubmission? { + Self.lock.lock() + defer { Self.lock.unlock() } + guard let data = defaults.data(forKey: key(taskID: taskID, context: context)) else { return nil } + guard let value = try? JSONDecoder().decode(TrainingPendingSubmission.self, from: data), + value.taskID == taskID, value.context == context, + !value.request.submissionID.isEmpty, !value.request.paperSnapshotID.isEmpty, + value.request.draftRevision > 0 else { throw TrainingPendingSubmissionError.invalidRecord } + return value + } + + /// 在发起网络提交前保存原始请求;不得用当前版本覆盖待恢复版本。 + func save(_ value: TrainingPendingSubmission) throws { + Self.lock.lock() + defer { Self.lock.unlock() } + if let existing = try load(taskID: value.taskID, context: value.context), existing != value { + throw TrainingPendingSubmissionError.alreadyPending + } + let storageKey = key(taskID: value.taskID, context: value.context) + defaults.set(try JSONEncoder().encode(value), forKey: storageKey) + } + + /// 只移除仍对应这次提交的记录,避免迟到响应删除后续待恢复请求。 + func remove(_ value: TrainingPendingSubmission) throws { + Self.lock.lock() + defer { Self.lock.unlock() } + guard try load(taskID: value.taskID, context: value.context) == value else { return } + defaults.removeObject(forKey: key(taskID: value.taskID, context: value.context)) + } + + private func key(taskID: String, context: TrainingContext) -> String { + let scope = Data(context.accountScope.utf8).map { String(format: "%02x", $0) }.joined() + let task = Data(taskID.utf8).map { String(format: "%02x", $0) }.joined() + return "training-pending-submission:v1:\(scope):scenic_\(context.scenicID):store_\(context.storeID):task_\(task)" + } +} diff --git a/suixinkan/Features/Training/Services/TrainingService.swift b/suixinkan/Features/Training/Services/TrainingService.swift new file mode 100644 index 0000000..27b1a41 --- /dev/null +++ b/suixinkan/Features/Training/Services/TrainingService.swift @@ -0,0 +1,68 @@ +import Foundation + +/// 培训数据源接口。正式实现应使用登录态授权,不接受任意学员 ID。 +protocol TrainingServing: Sendable { + /// 是否为本机开发演示。 + var isDemo: Bool { get } + /// 获取本人任务列表。 + func listTasks() async throws -> [TrainingTask] + /// 获取本人任务、发布快照与进度。 + func task(id: String) async throws -> TrainingTask + /// 累计一秒有效前台阅读,服务端实现需核验学习会话。 + func recordReadingSecond(taskID: String) async throws -> TrainingTask + /// 保存本人当前试卷草稿。 + func saveDraft(taskID: String, answers: TrainingAnswers) async throws + /// 按幂等键提交试卷,返回服务端成绩和考后解析。 + func submit(taskID: String, answers: TrainingAnswers, submissionID: String) async throws -> TrainingAttempt +} + +/// 尚未联调的正式数据源,不生成假任务或假成绩。 +struct UnconnectedTrainingService: TrainingServing { + /// 占位正式服务不会生成本地演示内容。 + let isDemo = false + /// 无正式接口时拒绝生成任务。 + func listTasks() async throws -> [TrainingTask] { throw TrainingError.unavailable } + /// 无正式接口时拒绝生成课程或进度。 + func task(id: String) async throws -> TrainingTask { throw TrainingError.unavailable } + /// 无正式接口时禁止记录真实学习完成。 + func recordReadingSecond(taskID: String) async throws -> TrainingTask { throw TrainingError.unavailable } + /// 无正式接口时禁止保存正式草稿。 + func saveDraft(taskID: String, answers: TrainingAnswers) async throws { throw TrainingError.unavailable } + /// 无正式接口时禁止返回正式成绩。 + func submit(taskID: String, answers: TrainingAnswers, submissionID: String) async throws -> TrainingAttempt { + throw TrainingError.unavailable + } +} + +/// 按登录账号、景区和店铺隔离本地开发记录;不表示自然人认证。 +struct TrainingContext: Equatable, Sendable { + let accountScope: String + let scenicID: Int + let storeID: Int + + /// 缺少有效登录身份时禁止初始化演示记录。 + @MainActor static func current() -> TrainingContext? { + let session = AppStore.shared.session + guard session.isLoggedIn, !session.accountCachePrefix.isEmpty, session.currentScenicId > 0 else { return nil } + return TrainingContext(accountScope: session.accountCachePrefix, scenicID: session.currentScenicId, storeID: session.currentStoreId) + } + + /// 使用不含凭证的账号与业务上下文作为持久化作用域。 + var storageKey: String { "training-demo:v1:\(accountScope):scenic_\(scenicID):store_\(storeID)" } +} + +/// 开发环境显式提供示例入口,Release 始终使用待接入服务。 +enum TrainingServiceFactory { + /// 正式入口默认处于待接入状态,避免演示替代真实任务。 + static func production() -> any TrainingServing { UnconnectedTrainingService() } + + #if DEBUG + /// 只在开发版本中创建隔离的本机演示数据源。 + @MainActor static func demo() throws -> any TrainingServing { + guard let context = TrainingContext.current() else { throw TrainingError.identityChanged } + return TrainingDemoService(context: context, validateContext: { + TrainingContext.current() == context + }) + } + #endif +} diff --git a/suixinkan/Features/Training/ViewModels/TrainingRemoteExamViewModel.swift b/suixinkan/Features/Training/ViewModels/TrainingRemoteExamViewModel.swift new file mode 100644 index 0000000..4031d47 --- /dev/null +++ b/suixinkan/Features/Training/ViewModels/TrainingRemoteExamViewModel.swift @@ -0,0 +1,744 @@ +import Foundation + +/// 分页考试状态;全局已答题号与当前页答案分离,交卷只消费服务端草稿版本。 +final class TrainingRemoteExamViewModel { + /// 固定的本人任务标识。 + let taskID: String + /// 已验证的轻量任务摘要。 + private(set) var task: TrainingTaskSummary? + /// 服务端当前考试资格。 + private(set) var progress: TrainingProgressSnapshot? + /// 冻结试卷规则与总题数。 + private(set) var paper: TrainingPaperInfo? + /// 当前展示题位,使用从零开始的索引。 + private(set) var currentIndex = 0 + /// 服务端已答题号叠加本机期望选择,题号从一开始。 + var answeredQuestionOrders: Set { + var orders = confirmedAnsweredOrders + for answer in desiredAnswers.values { + if answer.selectedOptionIDs.isEmpty { orders.remove(answer.order) } + else { orders.insert(answer.order) } + } + return orders + } + private var confirmedAnsweredOrders: Set = [] + /// 最近确认的草稿版本,未加载前为零。 + private(set) var draftRevision = 0 + /// 前台加载或交卷期间暂停编辑;后台草稿写入独立协调。 + private(set) var isBusy = false + /// 最近失败的展示文案,业务分支不依赖文案。 + private(set) var errorMessage: String? + /// 已提交或恢复的成绩,可直接进入成绩页面。 + private(set) var submittedAttempt: TrainingAttemptSummary? + /// 首次交卷返回的成绩及资格,成绩首屏可复用而无需等待额外请求。 + private(set) var submittedResult: TrainingAttemptDetail? + /// 账号不支持培训或任务无访问权限时返回培训中心,身份变化时退出到根页面。 + private(set) var shouldReturnToCenter = false + + private let pageSize: Int + private let pendingStore: TrainingPendingSubmissionStore + private let draftStore: TrainingDraftStore + private let debounceNanoseconds: UInt64 + private var desiredAnswers: [String: TrainingDraftLocalAnswer] = [:] + private var desiredPosition: Int? + private var draftGeneration: String? + private var restoredPaperID: String? + private var debounceTask: Task? + private var writerTask: Task? + private var isReadingDraft = false + private var draftReadWaiters: [CheckedContinuation] = [] + private var saveFailure: String? + /// 后台草稿请求状态变化;页面主动读取快照,不承担前台导航操作。 + var onDraftSaveStateChange: (@MainActor () -> Void)? + /// 后台请求不锁住已加载题目的编辑。 + private(set) var isSaving = false + /// 版本冲突必须由用户明确确认,不能悄悄覆盖其它设备的答案。 + private(set) var hasDraftConflict = false + /// 有待提交的本机意图或尚未确认的原请求。 + var hasUnsavedChanges: Bool { !desiredAnswers.isEmpty || desiredPosition != nil || pendingMutation != nil } + /// 底部轻量保存状态,不使用全局遮罩。 + var draftSaveMessage: String { + if hasDraftConflict { return "答案已在其他设备变更,重试保存将应用本机未保存选择" } + if let saveFailure { return "保存失败,本机选择已保留:" + saveFailure } + return isSaving || hasUnsavedChanges ? "正在保存答案…" : "答案已保存,可稍后继续" + } + private let currentContext: @MainActor @Sendable () -> TrainingContext? + private var context: TrainingContext? + private var questionCache: [Int: TrainingQuestionItem] = [:] + private var answerCache: TrainingAnswers = [:] + private var loadedDraftIndices: Set = [] + private var pendingSubmission: TrainingPendingSubmission? + private var pendingMutation: DraftMutation? + private var initialResetRequested = false + private var needsDraftRefresh = false + private var recoveryStorageFailed = false + private var identityIsValid = true + + /// 未确认的草稿写入保持原请求 ID、版本和内容,不能被新的选择替换。 + private enum DraftMutation { + case save(TrainingDraftSaveRequest) + case reset(TrainingDraftResetRequest) + } + + /// 注入身份与持久化域,测试不访问全局登录态或网络。 + init(taskID: String, context: TrainingContext? = nil, pageSize: Int = 10, + pendingStore: TrainingPendingSubmissionStore = TrainingPendingSubmissionStore(), + draftStore: TrainingDraftStore? = nil, debounceNanoseconds: UInt64 = 300_000_000, + currentContext: @escaping @MainActor @Sendable () -> TrainingContext? = { TrainingPendingSubmissionStore.currentContext() }) { + self.taskID = taskID + self.context = context + self.pageSize = min(20, max(1, pageSize)) + self.pendingStore = pendingStore + self.draftStore = draftStore ?? pendingStore.makeDraftStore() + self.debounceNanoseconds = debounceNanoseconds + self.currentContext = currentContext + } + + deinit { debounceTask?.cancel() } + + /// 已知总题数,无需获取全部题目正文。 + var questionCount: Int { paper?.questionCount ?? 0 } + /// 全局已答数量,不把未下载的答案当成漏答。 + var answeredCount: Int { answeredQuestionOrders.count } + /// 当前已加载的题目。 + var currentQuestion: TrainingQuestionItem? { questionCache[currentIndex] } + /// 当前题的本机期望选择,未修改时使用已确认答案。 + var currentSelectedIDs: Set { currentQuestion.map { Set(desiredAnswers[$0.id]?.selectedOptionIDs ?? Array(answerCache[$0.id] ?? [])) } ?? [] } + /// 第一处真正漏答的题位。 + var firstUnansweredIndex: Int? { + guard questionCount > 0 else { return nil } + return (1...questionCount).first { !answeredQuestionOrders.contains($0) }.map { $0 - 1 } + } + /// 存在未确认交卷时暂停编辑,直到恢复同一次结果。 + var hasPendingSubmission: Bool { pendingSubmission != nil } + /// 页面所属账号、景区或店铺已变化,不能继续显示原身份的数据。 + var isIdentityInvalid: Bool { !identityIsValid } + /// 存在需要用户明确重试或确认的草稿操作。 + var hasPendingMutation: Bool { saveFailure != nil || hasDraftConflict || isResetPending } + private var isResetPending: Bool { if case .reset? = pendingMutation { return true }; return false } + /// 当前题正文和对应草稿范围均成功读取后,才可展示为可编辑答案。 + var isCurrentPageReady: Bool { currentQuestion != nil && loadedDraftIndices.contains(currentIndex) && !needsDraftRefresh } + /// 页读取或冲突后的恢复失败时,沿当前题位重试读取,保留其它页缓存。 + var canRetryCurrentPage: Bool { + !isBusy && identityIsValid && !hasPendingSubmission && !isResetPending && !recoveryStorageFailed + && !shouldReturnToCenter && submittedAttempt == nil && paper != nil && !isCurrentPageReady + && progress?.canStartExam == true && progress?.learnerStatus == .pendingExam + } + /// 权威资格及当前页就绪时可编辑,后台保存不会阻断本机选择。 + var canEdit: Bool { + !isBusy && identityIsValid && !hasPendingSubmission && !isResetPending && !needsDraftRefresh && !recoveryStorageFailed + && submittedAttempt == nil && progress?.canStartExam == true && progress?.learnerStatus == .pendingExam + && !shouldReturnToCenter && paper != nil && isCurrentPageReady + } + + /// 返回已提交页面前再次核对身份,避免把缓存成绩显示给切换后的账号。 + func validateIdentity() async { + do { try await authorize() } + catch { report(error) } + } + + /// 恢复待确认提交优先于考试资格校验;正常加载只取恢复题位所在的一页。 + func load(service: any TrainingDataServing, resetDraft: Bool = false) async { + guard !isBusy else { return } + isBusy = true + isReadingDraft = true + debounceTask?.cancel() + debounceTask = nil + errorMessage = nil + defer { + isBusy = false + finishDraftRead(service: service) + } + do { + try await authorize() + guard let context else { throw TrainingRemoteError.identityChanged } + do { + pendingSubmission = try pendingStore.load(taskID: taskID, context: context) + recoveryStorageFailed = false + } catch { + recoveryStorageFailed = true + throw error + } + if pendingSubmission != nil { + _ = try await recoverSubmission(service: service) + return + } + if let writerTask { _ = await writerTask.value } + let detail = try await service.task(id: taskID) + try await authorize() + let latestProgress = try await service.progress(taskID: taskID) + try await authorize() + task = detail.summary + progress = latestProgress + try requireExamAllowed() + guard let paperID = task?.paperSnapshotID else { throw TrainingError.invalidPaper } + let loadedPaper = try await service.paper(id: paperID, taskID: taskID) + try await authorize() + guard loadedPaper.id == paperID, (1...500).contains(loadedPaper.questionCount), + loadedPaper.scoring == TrainingTask.equalPercentageScoring else { throw TrainingError.invalidPaper } + if paper?.id != loadedPaper.id { questionCache = [:]; answerCache = [:]; loadedDraftIndices = [] } + paper = loadedPaper + try restoreDraftIfNeeded() + // 已冻结请求先沿原键确认;明确重考也不能越过未知写入。 + if pendingMutation != nil, !hasDraftConflict { + saveFailure = nil + _ = await flushDraftNow(service: service) + guard identityIsValid, !shouldReturnToCenter, !isResetPending else { return } + } + let metadata = try await service.draft(taskID: taskID, offset: 0, limit: 0) + try await authorize() + try applyMetadata(metadata) + let position = desiredPosition ?? metadata.lastQuestionOrder + currentIndex = (1...questionCount).contains(position) ? position - 1 : 0 + if resetDraft, !initialResetRequested { + guard !hasUnsavedChanges, !hasDraftConflict else { + saveFailure = "请先确认上次未保存答案,再重新发起重考" + notifyDraftState() + return + } + initialResetRequested = true + pendingMutation = .reset(TrainingDraftResetRequest(requestID: UUID().uuidString, paperSnapshotID: paperID, baseRevision: draftRevision)) + try persistDraft() + guard await flushDraftNow(service: service) else { return } + } else { + try await loadCurrentPage(service: service) + } + try persistDraft() + if hasUnsavedChanges, !hasDraftConflict, saveFailure == nil { scheduleSave(service: service) } + } catch { + if error is TrainingDraftStorageError { reportSaveFailure(error) } + else { report(error) } + } + } + + /// 已缓存题目立即切换;位置变更并入后台串行草稿,不等待 ACK。 + @discardableResult + func goToCachedQuestion(_ index: Int, service: any TrainingDataServing) -> Bool { + guard canEdit, (0.. Set? { + guard canEdit, let question = currentQuestion, + question.options.contains(where: { $0.id == optionID }) else { return nil } + var selected = currentSelectedIDs + if question.type == .single { + guard selected != [optionID] else { return nil } + selected = [optionID] + } else if selected.contains(optionID) { selected.remove(optionID) } + else { selected.insert(optionID) } + return selected + } + + /// 同步更新并持久保存期望选择,允许上一请求未返回时继续改选。 + @discardableResult + func selectLocally(optionID: String, service: any TrainingDataServing) -> Bool { + guard let selected = selectionPreview(optionID: optionID), let question = currentQuestion else { return false } + desiredAnswers[question.id] = TrainingDraftLocalAnswer(questionID: question.id, order: question.order, + selectedOptionIDs: selected.sorted()) + desiredPosition = question.order + errorMessage = nil + // 尚未发出且已回到 ACK 选择的变化无需发送。 + if pendingMutation == nil, selected == (answerCache[question.id] ?? []) { desiredAnswers.removeValue(forKey: question.id) } + queueDraft(service: service) + return true + } + + /// 兼容调用方的异步入口,仅排入本机草稿;需要确认保存时显式 flushDraft。 + func select(optionID: String, service: any TrainingDataServing) async { + _ = selectLocally(optionID: optionID, service: service) + } + + /// 立即排空所有草稿,等待在飞请求后使用最新 ACK 版本,不并发提交同一版本。 + @discardableResult + func flushDraft(service: any TrainingDataServing) async -> Bool { + if isReadingDraft { + await withCheckedContinuation { draftReadWaiters.append($0) } + } + return await flushDraftNow(service: service) + } + + private func flushDraftNow(service: any TrainingDataServing) async -> Bool { + debounceTask?.cancel() + debounceTask = nil + while true { + if let writerTask { + guard await writerTask.value else { return false } + continue + } + guard !hasDraftConflict, saveFailure == nil, !recoveryStorageFailed else { return false } + guard hasUnsavedChanges else { return true } + let task = Task { @MainActor in await self.drainDraft(service: service) } + writerTask = task + guard await task.value else { return false } + } + } + + /// 保存失败后明确重试冻结的原请求,不能更换原幂等键和 payload。 + func retryMutation(service: any TrainingDataServing) async { + guard !isBusy, !hasPendingSubmission, !hasDraftConflict else { return } + if recoveryStorageFailed { + do { try persistDraft(); recoveryStorageFailed = false } + catch { reportSaveFailure(error); notifyDraftState(); return } + } + saveFailure = nil + errorMessage = nil + if await flushDraft(service: service), currentQuestion == nil { await load(service: service) } + } + + /// 用户明确选择本机或服务端答案后才结束版本冲突暂停。 + func resolveDraftConflict(useLocalAnswers: Bool, service: any TrainingDataServing) async { + guard !isBusy, hasDraftConflict, !hasPendingSubmission else { return } + do { + try await authorize() + try await refreshDraft(service: service) + if !useLocalAnswers { desiredAnswers = [:]; desiredPosition = nil } + hasDraftConflict = false + saveFailure = nil + errorMessage = nil + try persistDraft() + _ = await flushDraft(service: service) + } catch { reportSaveFailure(error) } + notifyDraftState() + } + + /// 仅重读当前未就绪题位;已确认的其它页不会因一次网络失败被清空。 + func retryCurrentPage(service: any TrainingDataServing) async { + guard canRetryCurrentPage else { return } + isBusy = true + isReadingDraft = true + debounceTask?.cancel() + debounceTask = nil + errorMessage = nil + defer { + isBusy = false + finishDraftRead(service: service) + } + do { + try await authorize() + if let writerTask { _ = await writerTask.value } + if needsDraftRefresh { try await refreshDraft(service: service) } + else { try await loadCurrentPage(service: service) } + } catch { report(error) } + } + + /// 持久保存交卷请求后提交;未知结果先查原键,再重试原版本。 + func submit(service: any TrainingDataServing) async -> TrainingAttemptSummary? { + guard !isBusy, !isResetPending, !recoveryStorageFailed else { return nil } + let wasEditable = canEdit + isBusy = true + errorMessage = nil + defer { isBusy = false } + do { + try await authorize() + if pendingSubmission != nil { return try await recoverSubmission(service: service) } + guard let context else { throw TrainingRemoteError.identityChanged } + if let persisted = try pendingStore.load(taskID: taskID, context: context) { + pendingSubmission = persisted + return try await recoverSubmission(service: service) + } + guard wasEditable, firstUnansweredIndex == nil else { + errorMessage = "还有 \(questionCount - answeredCount) 道题未作答" + return nil + } + try requireExamAllowed() + guard await flushDraft(service: service), !hasUnsavedChanges else { return nil } + try await authorize() + guard let paper else { throw TrainingError.invalidPaper } + let request = TrainingSubmissionRequest(submissionID: UUID().uuidString, paperSnapshotID: paper.id, draftRevision: draftRevision) + let pending = TrainingPendingSubmission(taskID: taskID, request: request, context: context) + do { try pendingStore.save(pending) } + catch TrainingPendingSubmissionError.alreadyPending { + pendingSubmission = try pendingStore.load(taskID: taskID, context: context) + return try await recoverSubmission(service: service) + } + pendingSubmission = pending + return try await sendSubmission(pending, service: service) + } catch { report(error); return nil } + } + + private func report(_ error: Error) { + errorMessage = error.localizedDescription + switch error { + case TrainingRemoteError.identityChanged: + identityIsValid = false + shouldReturnToCenter = true + task = nil + progress = nil + paper = nil + questionCache = [:] + answerCache = [:] + loadedDraftIndices = [] + confirmedAnsweredOrders = [] + desiredAnswers = [:] + desiredPosition = nil + debounceTask?.cancel() + draftRevision = 0 + currentIndex = 0 + submittedAttempt = nil + submittedResult = nil + // 保留原身份的未知请求,不能因切换账号而删除或换键重试。 + case TrainingRemoteError.forbidden, TrainingRemoteError.accountInvalid: shouldReturnToCenter = true + default: break + } + } + + private func authorize() async throws { + guard let actual = await currentContext() else { identityIsValid = false; throw TrainingRemoteError.identityChanged } + if context == nil { context = actual } + guard actual == context else { identityIsValid = false; throw TrainingRemoteError.identityChanged } + identityIsValid = true + } + + private func requireExamAllowed() throws { + guard task?.id == taskID, progress?.taskID == taskID else { throw TrainingError.invalidPaper } + guard task?.mode == .exam, task?.learnerStatus == .pendingExam, + progress?.learnerStatus == .pendingExam, progress?.completedAt == nil, + progress?.canStartExam == true, progress?.readingCompleted == true else { + throw TrainingRemoteError.examNotAllowed("当前任务暂不能考试,请返回课程确认学习进度和任务状态") + } + } + + private func applyMetadata(_ value: TrainingDraftPage) throws { + let orders = Set(value.answeredQuestionOrders) + guard value.taskID == taskID, value.paperSnapshotID == paper?.id, value.total == questionCount, + value.draftRevision > 0, orders.count == value.answeredCount, + orders.allSatisfy({ (1...questionCount).contains($0) }) else { throw TrainingError.invalidAnswers } + // 迟到 GET 不回退已确认版本;本机 overlay 与服务端缓存分别管理。 + guard value.draftRevision >= draftRevision else { return } + if value.draftRevision > draftRevision, !desiredAnswers.isEmpty, pendingMutation == nil { + hasDraftConflict = true + } + if value.draftRevision != draftRevision { answerCache = [:]; loadedDraftIndices = [] } + draftRevision = value.draftRevision + confirmedAnsweredOrders = orders + } + + private func loadCurrentPage(service: any TrainingDataServing) async throws { + guard let paper else { throw TrainingError.invalidPaper } + let offset = currentIndex / pageSize * pageSize + if questionCache[currentIndex] == nil { + try await fetchQuestions(offset: offset, paperID: paper.id, service: service) + // 大小预算允许后端缩短页;远处题号直接请求目标位置,避免遍历此前的页。 + if questionCache[currentIndex] == nil, currentIndex != offset { + try await fetchQuestions(offset: currentIndex, paperID: paper.id, service: service) + } + guard currentQuestion != nil else { throw TrainingError.invalidPaper } + } + if !loadedDraftIndices.contains(currentIndex) { + try await fetchDraft(offset: offset, service: service) + if !loadedDraftIndices.contains(currentIndex), currentIndex != offset { + try await fetchDraft(offset: currentIndex, service: service) + } + guard loadedDraftIndices.contains(currentIndex) else { throw TrainingError.invalidAnswers } + } + if let question = currentQuestion { + let selected = Set(desiredAnswers[question.id]?.selectedOptionIDs ?? Array(answerCache[question.id] ?? [])) + guard selected.isSubset(of: Set(question.options.map(\.id))), + question.type != .single || selected.count <= 1 else { throw TrainingError.invalidAnswers } + } + needsDraftRefresh = false + } + + private func fetchQuestions(offset: Int, paperID: String, service: any TrainingDataServing) async throws { + let page = try await service.questions(paperID: paperID, taskID: taskID, offset: offset, limit: pageSize) + try await authorize() + let end = min(questionCount, offset + pageSize) + guard page.paperSnapshotID == paperID, page.total == questionCount, page.offset == offset, + !page.items.isEmpty, page.items.count <= end - offset, + Set(page.items.map(\.order)).count == page.items.count, + Set(page.items.map(\.id)).count == page.items.count else { throw TrainingError.invalidPaper } + for question in page.items { + guard (offset + 1...end).contains(question.order), !question.id.isEmpty, + (2...6).contains(question.options.count), Set(question.options.map(\.id)).count == question.options.count, + !questionCache.values.contains(where: { $0.id == question.id && $0.order != question.order }) else { + throw TrainingError.invalidPaper + } + questionCache[question.order - 1] = question + } + } + + private func fetchDraft(offset: Int, service: any TrainingDataServing) async throws { + var page = try await service.draft(taskID: taskID, offset: offset, limit: pageSize) + try await authorize() + if page.draftRevision < draftRevision { + page = try await service.draft(taskID: taskID, offset: offset, limit: pageSize) + try await authorize() + } + guard page.draftRevision >= draftRevision else { throw TrainingError.invalidAnswers } + try applyMetadata(page) + let requestedEnd = min(questionCount, offset + pageSize) + let coveredEnd = page.nextOffset ?? requestedEnd + guard page.offset == offset, coveredEnd > offset, coveredEnd <= requestedEnd, + Set(page.items.map(\.questionID)).count == page.items.count, + Set(page.items.map(\.order)).count == page.items.count else { throw TrainingError.invalidAnswers } + for index in offset.. Bool { + isSaving = true + notifyDraftState() + defer { isSaving = false; writerTask = nil; notifyDraftState() } + do { + while hasUnsavedChanges { + try await authorize() + guard !hasDraftConflict, let paper else { return false } + if pendingMutation == nil { + // 一个任务只有一个 writer;发送后 payload 和幂等键不再被本机后续点击改写。 + let changes = desiredAnswers.values.sorted { $0.order < $1.order }.prefix(20).map { + TrainingDraftChange(questionID: $0.questionID, selectedOptionIDs: $0.selectedOptionIDs) + } + pendingMutation = .save(TrainingDraftSaveRequest(requestID: UUID().uuidString, + paperSnapshotID: paper.id, baseRevision: draftRevision, + lastQuestionOrder: desiredPosition, changes: changes)) + } + try persistDraft() + guard let mutation = pendingMutation else { return true } + do { + let confirmation: TrainingDraftConfirmation + switch mutation { + case .save(let request): confirmation = try await service.saveDraft(taskID: taskID, request: request) + case .reset(let request): confirmation = try await service.resetDraft(taskID: taskID, request: request) + } + try await authorize() + let base: Int + switch mutation { case .save(let value): base = value.baseRevision; case .reset(let value): base = value.baseRevision } + guard confirmation.draftRevision >= base, (0...questionCount).contains(confirmation.answeredCount) else { + throw TrainingError.invalidAnswers + } + let staleAcknowledgement = confirmation.draftRevision < draftRevision + pendingMutation = nil + if staleAcknowledgement, !desiredAnswers.isEmpty { hasDraftConflict = true } + draftRevision = max(draftRevision, confirmation.draftRevision) + switch mutation { + case .save(let request): + for change in request.changes { + let sent = Set(change.selectedOptionIDs) + answerCache[change.questionID] = sent + if let answer = desiredAnswers[change.questionID] { + if sent.isEmpty { confirmedAnsweredOrders.remove(answer.order) } + else { confirmedAnsweredOrders.insert(answer.order) } + // 迟到 ACK 只确认它发送的版本,不能覆盖期间产生的更新选择。 + if !staleAcknowledgement, answer.selectedOptionIDs == change.selectedOptionIDs { + desiredAnswers.removeValue(forKey: change.questionID) + } + } + } + if desiredPosition == request.lastQuestionOrder { desiredPosition = nil } + try persistDraft() + if staleAcknowledgement || confirmedAnsweredOrders.count != confirmation.answeredCount { + try await refreshDraft(service: service) + } + case .reset: + currentIndex = 0 + desiredAnswers = [:] + desiredPosition = nil + try persistDraft() + try await refreshDraft(service: service) + } + saveFailure = nil + errorMessage = nil + try persistDraft() + notifyDraftState() + } catch { + if case TrainingRemoteError.draftRevisionConflict = error { + // 明确拒绝才解除原请求;先取权威版本,保留全部本机意图并等待用户确认。 + pendingMutation = nil + hasDraftConflict = true + try persistDraft() + do { try await refreshDraft(service: service); try persistDraft() } + catch { reportSaveFailure(error) } + } + throw error + } + } + return true + } catch { + reportSaveFailure(error) + notifyDraftState() + return false + } + } + + private func recoverSubmission(service: any TrainingDataServing) async throws -> TrainingAttemptSummary? { + guard let pending = pendingSubmission else { return nil } + let page = try await service.attempts(taskID: taskID, submissionID: pending.request.submissionID, cursor: nil, limit: 1) + try await authorize() + guard page.items.count <= 1 else { throw TrainingError.invalidAnswers } + if let attempt = page.items.first { + return try finishSubmission(pending, attempt: attempt, serverTime: page.serverTime ?? attempt.submittedAt) + } + return try await sendSubmission(pending, service: service) + } + + private func sendSubmission(_ pending: TrainingPendingSubmission, service: any TrainingDataServing) async throws -> TrainingAttemptSummary? { + do { + let result = try await service.submit(taskID: taskID, request: pending.request) + try await authorize() + draftRevision = max(draftRevision, result.draftRevision) + let attempt = try finishSubmission(pending, attempt: result.attempt, serverTime: result.serverTime) + submittedResult = TrainingAttemptDetail(attempt: result.attempt, taskState: result.taskState, serverTime: result.serverTime) + return attempt + } catch { + if let remote = error as? TrainingRemoteError, remote.code != nil { + switch remote { + case .idempotencyConflict, .forbidden, .accountInvalid: + // 权限拒绝无法证明原请求未成功,保留恢复键。 + break + default: + try await authorize() + try pendingStore.remove(pending) + pendingSubmission = nil + needsDraftRefresh = true + if let latest = try? await service.progress(taskID: taskID) { + try await authorize() + progress = latest + if latest.canStartExam { try? await refreshDraft(service: service) } + } + } + } + throw error + } + } + + private func finishSubmission(_ pending: TrainingPendingSubmission, attempt: TrainingAttemptSummary, serverTime: Date) throws -> TrainingAttemptSummary { + guard attempt.taskID == taskID, attempt.paperSnapshotID == pending.request.paperSnapshotID else { throw TrainingError.invalidAnswers } + try pendingStore.remove(pending) + pendingSubmission = nil + desiredAnswers = [:] + desiredPosition = nil + pendingMutation = nil + hasDraftConflict = false + try? persistDraft() + submittedAttempt = attempt + let state = TrainingTaskState(learnerStatus: attempt.passed ? .completed : .pendingExam, + completedAt: attempt.passed ? attempt.submittedAt : nil, canRetry: false, blockReason: attempt.passed ? "completed" : nil) + submittedResult = TrainingAttemptDetail(attempt: attempt, taskState: state, serverTime: serverTime) + return attempt + } +} diff --git a/suixinkan/Features/Training/ViewModels/TrainingRemoteListViewModels.swift b/suixinkan/Features/Training/ViewModels/TrainingRemoteListViewModels.swift new file mode 100644 index 0000000..2249267 --- /dev/null +++ b/suixinkan/Features/Training/ViewModels/TrainingRemoteListViewModels.swift @@ -0,0 +1,248 @@ +import Foundation + +/// 培训列表只保存摘要和服务端游标,不聚合课程、试卷或解析。 +final class TrainingRemoteCenterViewModel { + /// 当前页面入口。 + var tab: TrainingCenterTab = .home + /// 服务端任务状态筛选。 + var filter: TrainingLearnerStatus = .pendingExam + /// 服务端同时搜索任务名和课程名。 + var keyword = "" + /// 当前任务摘要页。 + private(set) var tasks: [TrainingTaskSummary] = [] + /// 当前成绩摘要页。 + private(set) var records: [TrainingAttemptSummary] = [] + /// 不受分页和关键词影响的概览。 + private(set) var summary: TrainingSummary? + /// 首次加载或刷新状态。 + private(set) var isLoading = false + /// 翻页状态,避免重复消费同一游标。 + private(set) var isLoadingMore = false + /// 最近失败说明。 + private(set) var errorMessage: String? + /// 是否仍有下一页。 + private(set) var hasMore = false + /// 进入时的身份已失效,页面应关闭而不是展示旧作用域统计。 + private(set) var isIdentityInvalid = false + private var nextCursor: String? + private var generation = UUID() + + /// 概览中的待完成数量。 + var pendingCount: Int { summary?.pendingCount ?? 0 } + /// 概览中的已完成数量。 + var completedCount: Int { summary?.completedCount ?? 0 } + /// 最近成绩只来自概览接口,不遍历历史。 + var latestScore: String { summary?.latestAttempt.map { TrainingScore.text($0.scoreHundredths) } ?? "—" } + + /// 切换入口时保留筛选状态,清除搜索和旧游标。 + func selectTab(_ tab: TrainingCenterTab) { + self.tab = tab + keyword = "" + generation = UUID() + nextCursor = nil + hasMore = false + } + + /// 搜索文本变化立即失效游标与旧请求,网络首屏可以稍后防抖执行。 + func setKeyword(_ value: String) { + keyword = value + generation = UUID() + nextCursor = nil + hasMore = false + isLoading = false + isLoadingMore = false + } + + /// 页面并行读取概览和当前摘要页,保留顶部统计而不遍历其他资源。 + func load(service: any TrainingDataServing) async { + let requestID = UUID() + generation = requestID + isLoading = true + isLoadingMore = false + errorMessage = nil + hasMore = false + nextCursor = nil + let requestedTab = tab + let requestedFilter = filter + let query = keyword.trimmingCharacters(in: .whitespacesAndNewlines) + defer { if generation == requestID { isLoading = false } } + do { + async let overview = service.summary() + switch requestedTab { + case .home: + async let page = service.tasks(status: .pendingExam, keyword: "", cursor: nil, limit: 3) + let (loadedSummary, loadedPage) = try await (overview, page) + guard generation == requestID, !Task.isCancelled else { return } + summary = loadedSummary + tasks = loadedPage.items + records = [] + case .tasks: + let page = try await service.tasks(status: requestedFilter, keyword: query, cursor: nil, limit: 20) + let loadedSummary = try await overview + guard generation == requestID, !Task.isCancelled else { return } + summary = loadedSummary + tasks = page.items + records = [] + nextCursor = page.hasMore ? page.nextCursor : nil + hasMore = nextCursor != nil + case .records: + let page = try await service.attempts(taskID: nil, submissionID: nil, cursor: nil, limit: 20) + let loadedSummary = try await overview + guard generation == requestID, !Task.isCancelled else { return } + summary = loadedSummary + records = page.items + tasks = [] + nextCursor = page.hasMore ? page.nextCursor : nil + hasMore = nextCursor != nil + } + } catch { + guard generation == requestID, !Task.isCancelled else { return } + tasks = [] + records = [] + summary = nil + isIdentityInvalid = error as? TrainingRemoteError == .identityChanged + errorMessage = error.localizedDescription + } + } + + /// 用户主动加载下一页,不提前遍历全部任务或成绩。 + func loadMore(service: any TrainingDataServing) async { + guard !isLoading, !isLoadingMore, let cursor = nextCursor, tab != .home else { return } + isLoadingMore = true + errorMessage = nil + let requestID = generation + defer { if generation == requestID { isLoadingMore = false } } + do { + if tab == .tasks { + let page = try await service.tasks(status: filter, keyword: keyword.trimmingCharacters(in: .whitespacesAndNewlines), cursor: cursor, limit: 20) + guard generation == requestID, !Task.isCancelled else { return } + let existing = Set(tasks.map(\.id)) + tasks += page.items.filter { !existing.contains($0.id) } + nextCursor = page.hasMore && page.nextCursor != cursor ? page.nextCursor : nil + } else { + let page = try await service.attempts(taskID: nil, submissionID: nil, cursor: cursor, limit: 20) + guard generation == requestID, !Task.isCancelled else { return } + let existing = Set(records.map(\.id)) + records += page.items.filter { !existing.contains($0.id) } + nextCursor = page.hasMore && page.nextCursor != cursor ? page.nextCursor : nil + } + hasMore = nextCursor != nil + } catch { + guard generation == requestID, !Task.isCancelled else { return } + if error as? TrainingRemoteError == .identityChanged { + tasks = []; records = []; summary = nil; nextCursor = nil; hasMore = false + isIdentityInvalid = true + } + errorMessage = error.localizedDescription + } + } +} + +/// 成绩首屏只读单次摘要,解析由展开或翻页动作触发。 +final class TrainingRemoteResultViewModel { + /// 服务端成绩主键。 + let attemptID: String + /// 当前摘要与最新操作资格。 + private(set) var detail: TrainingAttemptDetail? + /// 已按需读取的解析页。 + private(set) var reviews: [TrainingReviewItem] = [] + /// 摘要加载状态。 + private(set) var isLoading = false + /// 解析分页状态。 + private(set) var isLoadingReviews = false + /// 是否已成功加载解析首屏。 + private(set) var hasLoadedReviews = false + /// 解析是否仍可继续翻页。 + private(set) var hasMoreReviews = false + /// 摘要失败信息。 + private(set) var errorMessage: String? + /// 解析失败信息,不替换已成功显示的成绩。 + private(set) var reviewErrorMessage: String? + /// 登录身份变化后清空成绩与解析,页面应退出旧身份作用域。 + private(set) var isIdentityInvalid = false + /// 非店铺账号或任务权限撤回时退出该次成绩。 + private(set) var isAccessRevoked = false + private var reviewCursor: String? + private var generation = UUID() + + /// 通过成绩 ID 定位,不读取任务的所有历史。 + init(attemptID: String, initialDetail: TrainingAttemptDetail? = nil) { + self.attemptID = attemptID + self.detail = initialDetail + } + + /// 返回页面时更新操作资格,但保留已读取的冻结解析。 + func load(service: any TrainingDataServing) async { + let requestID = UUID() + generation = requestID + isLoading = true + errorMessage = nil + defer { if generation == requestID { isLoading = false } } + do { + let loaded = try await service.attempt(id: attemptID) + guard generation == requestID, !Task.isCancelled else { return } + detail = loaded + if !loaded.attempt.reviewAvailable { + reviews = [] + hasLoadedReviews = false + hasMoreReviews = false + reviewCursor = nil + reviewErrorMessage = nil + } + } catch { + guard generation == requestID, !Task.isCancelled else { return } + detail = nil + reviews = [] + hasLoadedReviews = false + hasMoreReviews = false + isIdentityInvalid = error as? TrainingRemoteError == .identityChanged + isAccessRevoked = [150100, 150101].contains((error as? TrainingRemoteError)?.code ?? 0) + errorMessage = error.localizedDescription + } + } + + /// 初次展开只取第一页,再次展开复用已有解析。 + func loadReviews(service: any TrainingDataServing, nextPage: Bool = false) async { + guard !isLoadingReviews, detail?.attempt.reviewAvailable == true else { return } + if nextPage { guard hasMoreReviews, reviewCursor != nil else { return } } + else if hasLoadedReviews { return } + let cursor = nextPage ? reviewCursor : nil + let requestID = generation + isLoadingReviews = true + reviewErrorMessage = nil + defer { isLoadingReviews = false } + do { + let page = try await service.reviews(attemptID: attemptID, cursor: cursor, limit: 10) + guard generation == requestID, !Task.isCancelled else { return } + let existing = Set(reviews.map(\.id)) + reviews += page.items.filter { !existing.contains($0.id) } + hasLoadedReviews = true + reviewCursor = page.hasMore && page.nextCursor != cursor ? page.nextCursor : nil + hasMoreReviews = reviewCursor != nil + } catch { + guard generation == requestID, !Task.isCancelled else { return } + isAccessRevoked = [150100, 150101].contains((error as? TrainingRemoteError)?.code ?? 0) + if error as? TrainingRemoteError == .identityChanged || isAccessRevoked { + detail = nil + reviews = [] + hasLoadedReviews = false + hasMoreReviews = false + reviewCursor = nil + isIdentityInvalid = error as? TrainingRemoteError == .identityChanged + } + reviewErrorMessage = error.localizedDescription + } + } +} + +/// 服务端百分之一分的整数使用最多两位小数展示。 +enum TrainingScore { + /// 不自行判分,只格式化已确认的成绩。 + static func text(_ hundredths: Int) -> String { + let whole = hundredths / 100 + let fraction = hundredths % 100 + guard fraction != 0 else { return String(whole) } + let digits = String(format: "%02d", fraction) + return "\(whole).\(fraction.isMultiple(of: 10) ? String(digits.prefix(1)) : digits)" + } +} diff --git a/suixinkan/Features/Training/ViewModels/TrainingRemoteReadingViewModel.swift b/suixinkan/Features/Training/ViewModels/TrainingRemoteReadingViewModel.swift new file mode 100644 index 0000000..d8617bc --- /dev/null +++ b/suixinkan/Features/Training/ViewModels/TrainingRemoteReadingViewModel.swift @@ -0,0 +1,500 @@ +import Foundation + +/// 正式课程按需读取与有效前台读时;页面在操作完成后主动读取状态并刷新。 +final class TrainingRemoteReadingViewModel { + /// 当前本人任务标识。 + let taskID: String + /// 已加载的轻量任务规则与快照引用。 + private(set) var task: TrainingTaskDetail? + /// 已加载的课程元信息,不包含全部正文。 + private(set) var course: TrainingCourseInfo? + /// 用户已请求的附件元信息,不包含文件内容。 + private(set) var attachments: [TrainingAttachmentInfo] = [] + /// 当前选中文档,授权或预览失败时仍保留,供用户重试。 + private(set) var currentAttachment: TrainingAttachmentInfo? + /// 当前文档经任务授权的访问地址,不附带 App Token。 + private(set) var currentAttachmentLink: TrainingAttachmentLink? + /// 每次选择或重试生成新票据,拒绝同一个附件的旧下载或渲染回调。 + private(set) var attachmentPreviewID: UUID? + /// 只有当前附件已成功渲染后才可累计有效阅读。 + private(set) var isAttachmentRendered = false + /// 当前附件授权或预览错误,不被进度刷新清除。 + private(set) var attachmentErrorMessage: String? + /// 仅用于附件分页的提示,不阻挡当前已经显示的文档或有效阅读。 + private(set) var attachmentListErrorMessage: String? + /// 最新后端确认的学习进度与资格。 + private(set) var progress: TrainingProgressSnapshot? + /// 首次加载或切换附件期间阻止重复内容操作。 + private(set) var isLoading = false + /// 附件目录下一页正在加载。 + private(set) var isLoadingAttachments = false + /// 附件链接正在授权。 + private(set) var isAuthorizingAttachment = false + /// 附件目录是否还有用户可主动读取的页面。 + private(set) var hasMoreAttachments = false + /// 已经读取过附件第一页,避免反复取相同元信息。 + private(set) var hasLoadedAttachments = false + /// 是否正在累计本次会话的可见读时。 + private(set) var isReading = false + /// 当前会话本地累计秒数;新会话始终从零开始。 + private(set) var activeSecondsTotal = 0 + /// 最近一次阅读保存失败,可用原请求安全重试。 + private(set) var readingErrorMessage: String? + /// 会话恢复提示,与当前操作资格分开展示。 + private(set) var readingNotice: String? + /// 身份已经切换,所有迟到结果都应被丢弃。 + private(set) var isInvalidated = false + + private let service: any TrainingDataServing + private let validateIdentity: @MainActor @Sendable () -> Bool + private let now: @Sendable () -> Date + private var generation = 0 + private var attachmentCursor: String? + private var contentErrorMessage: String? + private var session: TrainingStudySession? + private var sessionRequestID: String? + private var acceptedActiveSecondsTotal = 0 + private var nextSequence = 1 + private var pendingHeartbeat: PendingHeartbeat? + private var finalRequested = false + private var wantsReading = false + private var isSessionBusy = false + private var sessionWaiters: [CheckedContinuation] = [] + private var readingClock = TrainingReadingClock() + private var lastVisibleUptime: TimeInterval = 0 + + /// 一次冻结的幂等心跳;重试时序号、累计秒数与 final 均不能变更。 + private struct PendingHeartbeat { + let sessionID: String + let sequence: Int + let activeSecondsTotal: Int + let final: Bool + } + + /// 注入正式数据源、身份校验与时钟,不让 ViewModel 依赖 UIKit 或共享登录视图。 + init( + taskID: String, + service: any TrainingDataServing, + now: @escaping @Sendable () -> Date = { Date() }, + validateIdentity: @escaping @MainActor @Sendable () -> Bool = { true } + ) { + self.taskID = taskID + self.service = service + self.now = now + self.validateIdentity = validateIdentity + } + + /// 页面展示的内容或保存错误,不用中文文案判断恢复分支。 + var errorMessage: String? { readingErrorMessage ?? attachmentErrorMessage ?? contentErrorMessage } + + /// 当前附件标识,预览失败时用于重试同一份文档。 + var currentAttachmentID: String? { currentAttachment?.id } + + /// 显示未确认读时的倒计时,但只有服务器确认后才允许开始考试。 + var remainingSeconds: Int { + guard let progress else { return task?.requiredReadingSeconds ?? 0 } + let unconfirmed = max(0, activeSecondsTotal - acceptedActiveSecondsTotal) + return max(0, progress.requiredReadingSeconds - progress.readingSeconds - unconfirmed) + } + + /// 当前后端是否允许继续有效学习,完成或只读任务不建立新会话。 + var canStudy: Bool { + task?.summary.learnerStatus == .pendingExam && progress?.learnerStatus == .pendingExam + && progress?.canStudy == true && progress?.readingCompleted == false && !isInvalidated + } + + /// 上一次请求结束后才允许发送下一次心跳;保存失败交由用户重试。 + var needsReadingFlush: Bool { + guard !isInvalidated, !isSessionBusy, readingErrorMessage == nil, let session else { return false } + return finalRequested || activeSecondsTotal - acceptedActiveSecondsTotal >= max(1, session.heartbeatIntervalSeconds) + } + + /// 首次只读课程元信息、附件第一页与进度,并为首个附件授权;不请求小节标题或 HTML。 + func load() async { + guard !isLoading, !isInvalidated else { return } + let epoch = generation + isLoading = true + contentErrorMessage = nil + attachmentErrorMessage = nil + attachmentListErrorMessage = nil + resetAttachmentPreview() + pauseReading() + defer { if generation == epoch { isLoading = false } } + await flush(final: true) + guard generation == epoch, !isInvalidated, !Task.isCancelled else { return } + do { + let detail = try await service.task(id: taskID) + try await checkIdentity(epoch) + guard detail.summary.learning.canViewCourse else { + throw TrainingRemoteError.forbidden("当前任务不能查看课程") + } + let courseID = detail.summary.courseSnapshotID + async let metadata = service.course(id: courseID, taskID: taskID) + async let documents = service.attachments(courseID: courseID, taskID: taskID, cursor: nil, limit: 20) + async let savedProgress = service.progress(taskID: taskID) + let (info, page, saved) = try await (metadata, documents, savedProgress) + try await checkIdentity(epoch) + guard saved.canViewCourse else { throw TrainingRemoteError.forbidden("当前任务不能查看课程") } + task = detail + course = info + attachments = page.items + attachmentCursor = page.nextCursor + hasMoreAttachments = page.hasMore + hasLoadedAttachments = true + progress = saved + if let first = attachments.first { + await prepareAttachment(first, epoch: epoch) + } + } catch { saveContentError(error, epoch: epoch) } + } + + /// 返回已缓存课程时只刷新本人资格与进度,保留文档和预览错误。 + func refreshProgress() async { + let epoch = generation + guard !isInvalidated else { return } + do { + let value = try await service.progress(taskID: taskID) + try await checkIdentity(epoch) + guard value.canViewCourse else { throw TrainingRemoteError.forbidden("当前任务不能查看课程") } + progress = value + if !value.canStudy || value.readingCompleted { pauseReading() } + contentErrorMessage = nil + } catch { saveContentError(error, epoch: epoch) } + } + + /// 选择或重试附件时先关闭旧读时片段,再为选中的文档重新授权。 + func selectAttachment(id: String) async { + guard !isLoading, !isInvalidated, + let attachment = attachments.first(where: { $0.id == id }) else { return } + let epoch = generation + isLoading = true + defer { if generation == epoch { isLoading = false } } + resetAttachmentPreview() + pauseReading() + await flush(final: true) + guard generation == epoch, !isInvalidated, !Task.isCancelled else { return } + contentErrorMessage = nil + await prepareAttachment(attachment, epoch: epoch) + } + + /// 当前文档真正展示完成才打开读时门禁;过期页面或旧下载回调不能恢复学习。 + @discardableResult + func markAttachmentRendered(id: String, previewID: UUID) -> Bool { + guard !isInvalidated, !isLoading, currentAttachmentID == id, + attachmentPreviewID == previewID, currentAttachmentLink != nil, + attachmentErrorMessage == nil else { return false } + isAttachmentRendered = true + return true + } + + /// 文档下载或渲染失败立即停止累计,页面随后通过已有保存管线关闭会话。 + func reportAttachmentFailure(id: String, previewID: UUID, message: String) { + guard !isInvalidated, currentAttachmentID == id, attachmentPreviewID == previewID else { return } + isAttachmentRendered = false + attachmentErrorMessage = message + pauseReading() + } + + /// 后续附件页仅由用户主动读取;已有第一页不重复获取。 + func loadAttachments(loadMore: Bool = false) async { + guard !isLoading, !isLoadingAttachments, let course, !isInvalidated else { return } + if hasLoadedAttachments && !loadMore { return } + if loadMore && (!hasMoreAttachments || attachmentCursor == nil) { return } + let epoch = generation + isLoadingAttachments = true + defer { if generation == epoch { isLoadingAttachments = false } } + do { + let page = try await service.attachments(courseID: course.id, taskID: taskID, cursor: loadMore ? attachmentCursor : nil, limit: 20) + try await checkIdentity(epoch) + let existing = Set(attachments.map(\.id)) + if !loadMore { attachments = page.items } + else { attachments.append(contentsOf: page.items.filter { !existing.contains($0.id) }) } + attachmentCursor = page.nextCursor + hasMoreAttachments = page.hasMore + hasLoadedAttachments = true + attachmentListErrorMessage = nil + } catch { saveAttachmentListError(error, epoch: epoch) } + } + + /// 获取同一附件的有效 HTTP/HTTPS 授权地址,保持签名参数原样,不附 App Token。 + func authorizeAttachment(id: String) async -> TrainingAttachmentLink? { + guard !isAuthorizingAttachment, let course, !isInvalidated else { return nil } + let epoch = generation + isAuthorizingAttachment = true + defer { if generation == epoch { isAuthorizingAttachment = false } } + do { + let link = try await service.attachmentURL(courseID: course.id, attachmentID: id, taskID: taskID) + try await checkIdentity(epoch) + let scheme = link.url.scheme?.lowercased() + guard link.id == id, scheme == "http" || scheme == "https", link.url.host?.isEmpty == false, + link.url.user == nil, link.url.password == nil, link.expiresAt > now() else { + throw TrainingRemoteError.paramInvalid("附件访问地址无效或已过期,请重试") + } + attachmentErrorMessage = nil + return link + } catch { saveAttachmentError(error, epoch: epoch); return nil } + } + + private func prepareAttachment(_ attachment: TrainingAttachmentInfo, epoch: Int) async { + currentAttachment = attachment + attachmentErrorMessage = nil + let previewID = UUID() + attachmentPreviewID = previewID + let link = await authorizeAttachment(id: attachment.id) + guard generation == epoch, !isInvalidated, !Task.isCancelled, + attachmentPreviewID == previewID, currentAttachmentID == attachment.id else { return } + currentAttachmentLink = link + } + + private func resetAttachmentPreview() { + currentAttachment = nil + currentAttachmentLink = nil + attachmentPreviewID = nil + isAttachmentRendered = false + attachmentErrorMessage = nil + } + + /// 附件已渲染且前台可见时建立或恢复会话;正在阅读时重复调用不重启计时。 + func startReading(at uptime: TimeInterval) async { + guard isAttachmentRendered, currentAttachmentLink != nil, canStudy else { return } + lastVisibleUptime = uptime + guard !isReading else { return } + let epoch = generation + wantsReading = true + await waitForSessionOperation(epoch: epoch) + guard generation == epoch, !isInvalidated, wantsReading, canStudy, isAttachmentRendered, !isReading else { return } + isSessionBusy = true + defer { finishSessionOperation(epoch: epoch) } + do { + try await checkIdentity(epoch) + if pendingHeartbeat != nil || finalRequested { + try await sendHeartbeats(epoch: epoch) + } + if session == nil && canStudy { try await createSession(epoch: epoch) } + if wantsReading, session != nil, canStudy, isAttachmentRendered { + readingErrorMessage = nil + readingClock.resume(at: uptime) + isReading = true + } else if session != nil { try await sendHeartbeats(epoch: epoch) } + } catch { await handleReadingError(error, epoch: epoch) } + } + + /// 前台可见时每次最多记一秒;网络心跳进行中仍累计,到门槛时同步停止。 + @discardableResult + func accumulateVisibleTime(at uptime: TimeInterval) -> Bool { + lastVisibleUptime = uptime + guard session != nil, isReading, wantsReading, canStudy, isAttachmentRendered, readingErrorMessage == nil, + readingClock.takeSecond(at: uptime) else { return false } + activeSecondsTotal += 1 + if remainingSeconds == 0 { pauseReading() } + return true + } + + /// 累计可见读时并等待本次保存;持续刷新的页面可分别调用累计与保存方法。 + func recordVisibleTime(at uptime: TimeInterval) async { + accumulateVisibleTime(at: uptime) + if needsReadingFlush { await flush() } + } + + /// 页面隐藏、锁屏、文档切换或预览失败时同步停止计时,丢弃未满一秒片段。 + func pauseReading() { + wantsReading = false + finalRequested = true + isReading = false + readingClock.pause() + } + + /// 保存已累计片段;先重试冻结的旧请求,再用新序号发送最终关闭请求。 + func flush(final: Bool = false) async { + if final { pauseReading() } + let epoch = generation + await waitForSessionOperation(epoch: epoch) + guard generation == epoch, !isInvalidated, session != nil else { return } + isSessionBusy = true + defer { finishSessionOperation(epoch: epoch) } + do { + try await checkIdentity(epoch) + try await sendHeartbeats(epoch: epoch) + readingErrorMessage = nil + } catch { await handleReadingError(error, epoch: epoch) } + } + + /// 身份切换使所有异步操作失效,清理旧账号内容和未确认片段。 + func invalidate() { + generation += 1 + isInvalidated = true + pauseReading() + clearSession() + task = nil + course = nil + attachments = [] + resetAttachmentPreview() + attachmentListErrorMessage = nil + progress = nil + contentErrorMessage = nil + readingErrorMessage = nil + readingNotice = nil + attachmentCursor = nil + hasMoreAttachments = false + hasLoadedAttachments = false + isLoading = false + isLoadingAttachments = false + isAuthorizingAttachment = false + isSessionBusy = false + resumeSessionWaiters() + } + + private func createSession(epoch: Int) async throws { + let requestID = sessionRequestID ?? UUID().uuidString + sessionRequestID = requestID + let value = try await service.startReading(taskID: taskID, requestID: requestID) + try await checkIdentity(epoch) + session = value + progress = value.progress + activeSecondsTotal = 0 + acceptedActiveSecondsTotal = 0 + nextSequence = 1 + finalRequested = !wantsReading || !canStudy + } + + private func sendHeartbeats(epoch: Int) async throws { + while let session { + if pendingHeartbeat == nil { + guard finalRequested || activeSecondsTotal > acceptedActiveSecondsTotal else { return } + pendingHeartbeat = PendingHeartbeat(sessionID: session.sessionID, sequence: nextSequence, + activeSecondsTotal: activeSecondsTotal, final: finalRequested) + } + guard let pending = pendingHeartbeat else { return } + let response = try await service.heartbeat(sessionID: pending.sessionID, sequence: pending.sequence, + activeSecondsTotal: pending.activeSecondsTotal, final: pending.final) + try await checkIdentity(epoch) + guard response.sessionID == pending.sessionID, response.acceptedSequence == pending.sequence, + response.acceptedActiveSecondsTotal >= acceptedActiveSecondsTotal, + response.acceptedActiveSecondsTotal <= pending.activeSecondsTotal else { + throw TrainingRemoteError.sessionConflict("学习上报确认与请求不一致") + } + progress = response.progress + acceptedActiveSecondsTotal = response.acceptedActiveSecondsTotal + nextSequence = pending.sequence + 1 + pendingHeartbeat = nil + if response.sessionClosed || pending.final { + clearSession() + return + } + if response.progress.readingCompleted || !response.progress.canStudy { pauseReading() } + if !finalRequested { return } + } + } + + private func clearSession() { + session = nil + sessionRequestID = nil + pendingHeartbeat = nil + activeSecondsTotal = 0 + acceptedActiveSecondsTotal = 0 + nextSequence = 1 + finalRequested = false + isReading = false + readingClock.pause() + } + + private func waitForSessionOperation(epoch: Int) async { + while isSessionBusy, generation == epoch, !isInvalidated { + await withCheckedContinuation { sessionWaiters.append($0) } + } + } + + private func finishSessionOperation(epoch: Int) { + guard generation == epoch else { return } + isSessionBusy = false + resumeSessionWaiters() + } + + private func resumeSessionWaiters() { + let waiters = sessionWaiters + sessionWaiters = [] + waiters.forEach { $0.resume() } + } + + private func checkIdentity(_ epoch: Int) async throws { + guard generation == epoch, !isInvalidated, !Task.isCancelled else { throw CancellationError() } + guard await validateIdentity() else { + invalidate() + throw TrainingRemoteError.identityChanged + } + } + + private func saveContentError(_ error: Error, epoch: Int) { + guard generation == epoch, !isInvalidated, !(error is CancellationError) else { return } + let mapped = TrainingRemoteError.map(error) + let code = (mapped as? TrainingRemoteError)?.code + if mapped as? TrainingRemoteError == .identityChanged || code == 150100 || code == 150101 { + invalidate() + return + } + contentErrorMessage = mapped.localizedDescription + } + + private func saveAttachmentError(_ error: Error, epoch: Int) { + guard generation == epoch, !isInvalidated, !(error is CancellationError) else { return } + let mapped = TrainingRemoteError.map(error) + let code = (mapped as? TrainingRemoteError)?.code + if mapped as? TrainingRemoteError == .identityChanged || code == 150100 || code == 150101 { + invalidate() + return + } + attachmentErrorMessage = mapped.localizedDescription + } + + private func saveAttachmentListError(_ error: Error, epoch: Int) { + guard generation == epoch, !isInvalidated, !(error is CancellationError) else { return } + let mapped = TrainingRemoteError.map(error) + let code = (mapped as? TrainingRemoteError)?.code + if mapped as? TrainingRemoteError == .identityChanged || code == 150100 || code == 150101 { + invalidate() + return + } + attachmentListErrorMessage = mapped.localizedDescription + } + + private func handleReadingError(_ error: Error, epoch: Int) async { + guard generation == epoch, !isInvalidated, !(error is CancellationError) else { return } + let mapped = TrainingRemoteError.map(error) + let code = (mapped as? TrainingRemoteError)?.code + if mapped as? TrainingRemoteError == .identityChanged || code == 150100 || code == 150101 { + invalidate() + return + } + isReading = false + readingClock.pause() + readingErrorMessage = mapped.localizedDescription + guard code == 150104 || code == 150105 || code == 150102 else { return } + do { + let saved = try await service.progress(taskID: taskID) + try await checkIdentity(epoch) + let shouldResume = wantsReading && isAttachmentRendered && code != 150102 + clearSession() + progress = saved + wantsReading = shouldResume + if code == 150104 || code == 150105 { + readingErrorMessage = nil + readingNotice = "学习会话已恢复,继续阅读即可" + } + if shouldResume, canStudy { + try await createSession(epoch: epoch) + if wantsReading, canStudy, isAttachmentRendered { + readingClock.resume(at: lastVisibleUptime) + isReading = true + readingErrorMessage = nil + readingNotice = "学习会话已恢复,继续阅读即可" + } else if session != nil { try await sendHeartbeats(epoch: epoch) } + } + } catch { + guard generation == epoch, !isInvalidated else { return } + let mapped = TrainingRemoteError.map(error) + let code = (mapped as? TrainingRemoteError)?.code + if mapped as? TrainingRemoteError == .identityChanged || code == 150100 || code == 150101 { invalidate() } + else { readingErrorMessage = mapped.localizedDescription } + } + } +} diff --git a/suixinkan/Features/Training/ViewModels/TrainingViewModels.swift b/suixinkan/Features/Training/ViewModels/TrainingViewModels.swift new file mode 100644 index 0000000..3be73e1 --- /dev/null +++ b/suixinkan/Features/Training/ViewModels/TrainingViewModels.swift @@ -0,0 +1,199 @@ +import Foundation + +/// 培训中心与小程序一致的三个入口。 +enum TrainingCenterTab: Int, CaseIterable { + case home, tasks, records + + /// 培训中心底部入口的展示名称。 + var title: String { switch self { case .home: "首页"; case .tasks: "任务"; case .records: "记录" } } +} + +/// 培训中心任务与历史记录状态,页面在加载完成后主动刷新。 +final class TrainingCenterViewModel { + /// 最近成功加载的本人任务,加载失败时清空。 + private(set) var tasks: [TrainingTask] = [] + /// 正在加载任务时阻止重复请求。 + private(set) var isLoading = false + /// 最近一次加载失败的页面提示。 + private(set) var errorMessage: String? + /// 任务列表当前选择的学员完成状态。 + var filter: TrainingLearnerStatus = .pendingExam + /// 当前培训中心入口,决定页面展示的数据范围。 + var tab: TrainingCenterTab = .home + /// 按任务或课程名称筛选任务的搜索词。 + var keyword = "" + /// 记录页当前展示的记录数量上限,由页面增加以加载更多。 + var recordLimit = 20 + + /// 本人全部任务中已完成的数量,不受搜索与筛选影响。 + var completedCount: Int { tasks.filter { $0.learnerStatus == .completed }.count } + /// 本人全部任务中尚未完成的数量。 + var pendingCount: Int { tasks.count - completedCount } + /// 合并各任务的考试记录,按提交时间从新到旧排列。 + var records: [(task: TrainingTask, attempt: TrainingAttempt)] { + tasks.flatMap { task in task.progress.attempts.map { (task: task, attempt: $0) } } + .sorted { $0.attempt.submittedAt > $1.attempt.submittedAt } + } + /// 最近一次考试的得分,无考试记录时显示占位符。 + var latestScore: String { records.first?.attempt.scoreText ?? "—" } + + /// 当前筛选的任务列表。 + var filteredTasks: [TrainingTask] { + let query = keyword.trimmingCharacters(in: .whitespacesAndNewlines) + return tasks.filter { $0.learnerStatus == filter && (query.isEmpty || $0.title.localizedCaseInsensitiveContains(query) || $0.course.title.localizedCaseInsensitiveContains(query)) } + } + + /// 首页展示前三项必读任务,任务页提供完整筛选与搜索。 + var visibleTasks: [TrainingTask] { + tab == .home ? Array(tasks.filter { $0.learnerStatus == .pendingExam }.prefix(3)) : filteredTasks + } + + /// 切换入口时清除搜索,保留用户选择的任务状态。 + func selectTab(_ tab: TrainingCenterTab) { self.tab = tab; keyword = "" } + + /// 加载失败时清除旧任务,防止切换身份后展示旧账号内容。 + func load(service: any TrainingServing) async { + guard !isLoading else { return } + isLoading = true + errorMessage = nil + defer { isLoading = false } + do { tasks = try await service.listTasks() } + catch { tasks = []; errorMessage = error.localizedDescription } + } +} + +/// 连续课程阅读状态;计时只由前台可见页面驱动。 +final class TrainingReadingViewModel { + /// 当前阅读页面对应的本人任务标识。 + let taskID: String + /// 最近一次成功读取或保存的课程与学习进度。 + private(set) var task: TrainingTask? + /// 加载课程或保存阅读秒数时阻止重复操作。 + private(set) var isBusy = false + /// 最近一次加载或保存失败的页面提示。 + private(set) var errorMessage: String? + + /// 指定当前本人任务。 + init(taskID: String) { self.taskID = taskID } + + /// 剩余有效阅读秒数。 + var remainingSeconds: Int { max(0, TrainingTask.requiredReadingSeconds - (task?.progress.readingSeconds ?? 0)) } + + /// 读取最新进度,不重置已经完成的课程。 + func load(service: any TrainingServing) async { + guard !isBusy else { return } + isBusy = true + errorMessage = nil + defer { isBusy = false } + do { task = try await service.task(id: taskID) } + catch { task = nil; errorMessage = error.localizedDescription } + } + + /// 每次只记一秒;失败保留上一次成功进度,并停止页面计时。 + func recordSecond(service: any TrainingServing) async { + guard !isBusy, let task, !task.hasFinishedReading, task.learnerStatus != .completed else { return } + isBusy = true + defer { isBusy = false } + do { + self.task = try await service.recordReadingSecond(taskID: taskID) + errorMessage = nil + } catch { errorMessage = error.localizedDescription } + } +} + +/// 逐题答题、答题卡、自动草稿保存与幂等交卷状态。 +final class TrainingExamViewModel { + /// 当前考试页面对应的本人任务标识。 + let taskID: String + /// 已通过时间、阅读门槛和试卷校验的考试任务。 + private(set) var task: TrainingTask? + /// 已成功保存的草稿选择,保存失败时保留原值。 + private(set) var answers: TrainingAnswers = [:] + /// 当前展示题目在试卷中的索引。 + private(set) var currentIndex = 0 + /// 加载、保存草稿或交卷期间阻止重复操作和题目跳转。 + private(set) var isBusy = false + /// 最近一次加载、保存或交卷失败的页面提示。 + private(set) var errorMessage: String? + private var submissionID: String? + + /// 指定任务,默认恢复草稿;重考从空白试卷开始。 + init(taskID: String) { self.taskID = taskID } + + /// 当前题目,无效试卷时为空。 + var currentQuestion: TrainingQuestion? { + guard let task, task.questions.indices.contains(currentIndex) else { return nil } + return task.questions[currentIndex] + } + + /// 第一处漏答位置,用于交卷时定位。 + var firstUnansweredIndex: Int? { + task?.questions.firstIndex { (answers[$0.id] ?? []).isEmpty } + } + + /// 当前作答数量。 + var answeredCount: Int { task?.questions.filter { !(answers[$0.id] ?? []).isEmpty }.count ?? 0 } + + /// 进入考试时重新验证任务时间与学习完成状态。 + func load(service: any TrainingServing, now: Date = Date(), resetDraft: Bool = false) async { + guard !isBusy else { return } + isBusy = true + errorMessage = nil + defer { isBusy = false } + do { + let loaded = try await service.task(id: taskID) + if let reason = loaded.submissionBlockReason(now: now) { throw TrainingError.blocked(reason) } + guard loaded.mode == .exam else { throw TrainingError.invalidPaper } + guard loaded.hasFinishedReading else { throw TrainingError.readingRequired } + let draft = resetDraft ? [:] : loaded.progress.draftAnswers + try TrainingValidation.validateAnswers(draft, task: loaded, requireComplete: false) + if resetDraft { try await service.saveDraft(taskID: taskID, answers: [:]) } + task = loaded + answers = draft + currentIndex = min(currentIndex, loaded.questions.count - 1) + } catch { task = nil; errorMessage = error.localizedDescription } + } + + /// 选择有效选项,保存成功后再更新页面,失败允许重试。 + func select(optionID: String, service: any TrainingServing) async { + guard !isBusy, let question = currentQuestion, + question.options.contains(where: { $0.id == optionID }) else { return } + var changed = answers + var selected = changed[question.id] ?? [] + if question.type == .single { selected = [optionID] } + else if selected.contains(optionID) { selected.remove(optionID) } + else { selected.insert(optionID) } + changed[question.id] = selected + isBusy = true + defer { isBusy = false } + do { + try await service.saveDraft(taskID: taskID, answers: changed) + answers = changed + submissionID = nil + errorMessage = nil + } catch { errorMessage = error.localizedDescription } + } + + /// 上一题、下一题和答题卡使用同一个安全跳转方法。 + func goToQuestion(_ index: Int) { + guard !isBusy, let task, task.questions.indices.contains(index) else { return } + currentIndex = index + } + + /// 交卷失败重试沿用同一 submissionID,避免新增重复考试记录。 + func submit(service: any TrainingServing) async -> TrainingAttempt? { + guard !isBusy, let task else { return nil } + if let missing = firstUnansweredIndex { + currentIndex = missing + errorMessage = TrainingError.unanswered(task.questions.count - answeredCount).localizedDescription + return nil + } + isBusy = true + errorMessage = nil + defer { isBusy = false } + let id = submissionID ?? UUID().uuidString + submissionID = id + do { return try await service.submit(taskID: taskID, answers: answers, submissionID: id) } + catch { errorMessage = error.localizedDescription; return nil } + } +} diff --git a/suixinkan/Info.plist b/suixinkan/Info.plist index f1405ba..7ac84ce 100644 --- a/suixinkan/Info.plist +++ b/suixinkan/Info.plist @@ -25,6 +25,19 @@ qqmap comgooglemaps + NSAppTransportSecurity + + NSExceptionDomains + + vipsky.oss-cn-shanghai.aliyuncs.com + + NSExceptionAllowsInsecureHTTPLoads + + + + + NSLocalNetworkUsageDescription + 用于面对面闪传,让同一 Wi-Fi 下的游客扫码接收本机视频 UIApplicationSceneManifest UIApplicationSupportsMultipleScenes diff --git a/suixinkan/Resources/DroneDock/TablerIcons-LICENSE.txt b/suixinkan/Resources/DroneDock/TablerIcons-LICENSE.txt new file mode 100644 index 0000000..9870cf6 --- /dev/null +++ b/suixinkan/Resources/DroneDock/TablerIcons-LICENSE.txt @@ -0,0 +1,25 @@ +Tabler Icons — satellite +Source: https://github.com/tabler/tabler-icons +Used by the device card to match https://voicestudio.suixinkan.cn/. + +MIT License + +Copyright (c) 2020-2026 Paweł Kuna + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/suixinkan/Resources/DroneDock/drone_material_demo.mp4 b/suixinkan/Resources/DroneDock/drone_material_demo.mp4 new file mode 100644 index 0000000..d59de20 Binary files /dev/null and b/suixinkan/Resources/DroneDock/drone_material_demo.mp4 differ diff --git a/suixinkan/Resources/TrainingDocumentPreview/NOTICE.md b/suixinkan/Resources/TrainingDocumentPreview/NOTICE.md new file mode 100644 index 0000000..f8a2cc0 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/NOTICE.md @@ -0,0 +1,22 @@ +# Third-party notices + +The application includes the following browser libraries as local, version-pinned assets: + +| Library | Version | Upstream | License used | +|---|---|---|---| +| docx-preview | 0.4.1 | https://github.com/VolodymyrBaydalka/docxjs | Apache-2.0 | +| JSZip | 3.10.2 | https://github.com/Stuk/jszip | MIT (chosen from its MIT/GPL license alternatives) | +| markdown-it | 15.0.3 | https://github.com/markdown-it/markdown-it | MIT | +| DOMPurify | 3.4.17 | https://github.com/cure53/DOMPurify | Apache-2.0 (chosen from its Apache/MPL license alternatives) | + +Copyright Volodymyr Baydalka (docx-preview). + +Copyright (c) 2009-2016 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso (JSZip). + +Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin (markdown-it). + +Copyright (c) Cure53 and other contributors (DOMPurify; see upstream license and preserved bundle header). + +The distributed JavaScript is transformed to ES2017 syntax and minified by esbuild 0.28.2; no library feature code is intentionally changed. Exact upstream tarball integrity, source SHA-256, output SHA-256, and transformations are recorded in `vendor-manifest.json`. + +Full upstream license texts appear in `licenses/`. Bundled dependency license families include JSZip's pako, lie/immediate, readable-stream and its support packages, setimmediate; markdown-it's mdurl, uc.micro, entities, linkify-it and punycode.js. Their preserved license texts appear in `licenses/bundled/` (the manifest's `licenseSourceVersion` identifies the package used to obtain that text, not a separate runtime package install). Browser dependency code is fixed by the parent library's bundled asset hash; the application does not fetch dependencies at runtime. diff --git a/suixinkan/Resources/TrainingDocumentPreview/README.md b/suixinkan/Resources/TrainingDocumentPreview/README.md new file mode 100644 index 0000000..c371b46 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/README.md @@ -0,0 +1,33 @@ +# Training document preview shell + +This local shell renders **DOCX, TXT, and Markdown** inside the native course card. PDF uses each platform's native PDF component. Legacy `.doc` is deliberately unsupported. All parser scripts ship with the application; no CDN, online converter, analytics, application token, or signed attachment URL is used in this page. + +## Native host contract + +- Open `index.html?type=docx|txt|md&requestId=` on a trusted local origin. `requestId` is a newly generated document-load ID matching `[A-Za-z0-9_-]{1,80}` and contains no course/user/URL credentials. +- iOS uses `training-document://preview/`; Android uses intercepted `https://training-preview.invalid/`. +- Serve the current downloaded attachment bytes at the relative path `./document//file`. Only the exact active ID is valid. The native host downloads the remote URL and enforces its own identity, expiry, file type, size, and redirect policy. The shell never receives the remote URL or auth headers. +- Serve this directory's files only by an explicit asset allowlist, without filesystem path traversal. Deny requests for every other scheme, host, document ID, and path. The page's CSP is defense in depth; the native host must also block all remote navigation and subresources. +- Resource loading uses `XMLHttpRequest` so WKURLSchemeHandler can serve bytes. If WebKit requires a CORS response header, add it only to this trusted local resource response; never enable general remote access. +- iOS messages: `window.webkit.messageHandlers.trainingDocument.postMessage(event)`. +- Android messages: `window.TrainingDocument.postMessage(JSON.stringify(event))`. Expose only this tiny bridge on the trusted local main-frame origin. Prefer origin-scoped WebMessageListener when available. +- Every event has `{ type, requestId }`. Native must discard stale IDs and messages from subframes/other origins. + - `ready`: `{ type: "ready", requestId, height }`, sent after content render, embedded-image settlement, and two animation frames. Native must also verify its view is visible before counting study time; Android should use its visual state callback. + - `error`: `{ type: "error", requestId, code, message }`; stop study time and expose a native retry action. Do not count navigation/onload as successful rendering. + - `link`: `{ type: "link", requestId, url }`; sent only for HTTP/HTTPS anchor clicks. Native validates again and explicitly opens the external browser, pausing study time. The local shell never navigates away. +- A retry or attachment change creates a fresh request ID and reloads the page. A closed/replaced view must not restart timing after late events. + +## Rendering and compatibility + +- Libraries are pinned by exact version, upstream npm SHA-512 integrity and file SHA-256 in `vendor-manifest.json`. +- Upstream browser bundles are transformed only with `esbuild 0.28.2 --target=es2017 --minify --legal-comments=inline`. This removes ES2020 optional chaining/nullish syntax from docx-preview for older Android WebViews. `compat.js` supplies `globalThis`, `Array.flatMap`, and the `Promise.allSettled` used by docx-preview only when missing. No full polyfill framework is loaded. The pinned browser bundles do not use `Promise.finally`, `Object.fromEntries`, or `String.replaceAll`; these are deliberately not patched. iOS 16 and Android WebView 58+ with ES2017 support are the intended baseline; device rendering tests remain required. +- DOCX uses `docx-preview` with `renderAltChunks: false`, no experimental features or embedded-font loading. It renders into a detached tree, then DOMPurify sanitizes the result before insertion. Script/frame/object/form/SVG/MathML content and unsafe links are removed. Style URLs are filtered, and CSP blocks remote images/fonts/styles/connections. Legal embedded bitmap images use local blob/data URLs. Complex Word pagination, fonts, and unsupported drawings may differ from Microsoft Word. +- Markdown uses markdown-it with raw HTML, automatic linkification and typographic rewrites disabled, followed by DOMPurify. Markdown external/relative images do not perform network requests; their alt text is displayed instead. HTTP/HTTPS links are handed to native on a user click. +- TXT uses a text node, never `innerHTML`. UTF-8, UTF-16 BOM or detectable ASCII UTF-16 byte order, then GB18030 fallback are supported. Binary control characters, empty text, and undecodable input produce an error. +- Native and shell both cap source files at **30 MiB**. Text is capped at **5 MiB**. DOCX checks the ZIP central directory before inflation and bounds actual streamed inflation: at most **1000 entries**, **20 MiB per entry**, and **100 MiB total**. ZIP64, split/encrypted archives, unsupported compression, malformed files and missing required DOCX parts are rejected. + +## Licensing and maintenance + +See `NOTICE.md`, `licenses/`, and `vendor-manifest.json`. Keep the copyright headers, license texts, notices, and exact version metadata whenever updating these files. The same resource directory is copied byte-for-byte to Android `app/src/main/assets/training-document-preview/`. + +To regenerate each bundle, download the exact upstream tarball in the manifest, verify its integrity, extract the named `upstreamSource`, run the esbuild command above, then verify the listed asset SHA-256. Do not load a remote "latest" bundle at runtime. diff --git a/suixinkan/Resources/TrainingDocumentPreview/compat.js b/suixinkan/Resources/TrainingDocumentPreview/compat.js new file mode 100644 index 0000000..ebb4a5b --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/compat.js @@ -0,0 +1,45 @@ +/* Compatibility helpers for Android WebView with ES2017 support. */ +(function () { + 'use strict'; + if (typeof globalThis === 'undefined') { window.globalThis = window; } + // docx-preview waits for embedded images with allSettled (Chrome 76+). + // Keep rejected optional resources from rejecting the entire document render. + if (!Promise.allSettled) { + Object.defineProperty(Promise, 'allSettled', { + configurable: true, + writable: true, + value: function (values) { + var Constructor = this; + try { + var results = Array.from(values).map(function (value) { + return Constructor.resolve(value).then(function (result) { + return { status: 'fulfilled', value: result }; + }, function (reason) { + return { status: 'rejected', reason: reason }; + }); + }); + return Constructor.all(results); + } catch (error) { return Constructor.reject(error); } + } + }); + } + if (!Array.prototype.flatMap) { + Object.defineProperty(Array.prototype, 'flatMap', { + configurable: true, + writable: true, + value: function (callback, receiver) { + var result = []; + for (var i = 0; i < this.length; i += 1) { + if (!(i in this)) { continue; } + var item = callback.call(receiver, this[i], i, this); + if (Array.isArray(item)) { + for (var j = 0; j < item.length; j += 1) { + if (j in item) { result.push(item[j]); } + } + } else { result.push(item); } + } + return result; + } + }); + } +}()); diff --git a/suixinkan/Resources/TrainingDocumentPreview/index.html b/suixinkan/Resources/TrainingDocumentPreview/index.html new file mode 100644 index 0000000..d55dc93 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/index.html @@ -0,0 +1,21 @@ + + + + + + + + 课程附件 + + + + + + + + + +

    正在加载附件…

    +
    + + diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/core-util-is-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/core-util-is-LICENSE new file mode 100644 index 0000000..d8d7f94 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/core-util-is-LICENSE @@ -0,0 +1,19 @@ +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/entities-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/entities-LICENSE new file mode 100644 index 0000000..c464f86 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/entities-LICENSE @@ -0,0 +1,11 @@ +Copyright (c) Felix Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/immediate-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/immediate-LICENSE.txt new file mode 100644 index 0000000..88c18c2 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/immediate-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, Domenic Denicola, Brian Cavalier + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/inherits-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/inherits-LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/inherits-LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/isarray-LICENSE-README.md b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/isarray-LICENSE-README.md new file mode 100644 index 0000000..16d2c59 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/isarray-LICENSE-README.md @@ -0,0 +1,60 @@ + +# isarray + +`Array#isArray` for older browsers. + +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/lie-license.md b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/lie-license.md new file mode 100644 index 0000000..59ca972 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/lie-license.md @@ -0,0 +1,7 @@ +#Copyright (c) 2014-2018 Calvin Metcalf, Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.** diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/linkify-it-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/linkify-it-LICENSE new file mode 100644 index 0000000..67596f5 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/linkify-it-LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2015 Vitaly Puzrin. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/manifest.json b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/manifest.json new file mode 100644 index 0000000..e615432 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/manifest.json @@ -0,0 +1,134 @@ +[ + { + "name": "mdurl", + "licenseSourceVersion": "2.1.0", + "licenseFiles": [ + "mdurl-LICENSE" + ] + }, + { + "name": "uc.micro", + "licenseSourceVersion": "3.0.0", + "licenseFiles": [ + "uc.micro-LICENSE.txt" + ] + }, + { + "name": "entities", + "licenseSourceVersion": "8.1.0", + "license": "BSD-2-Clause", + "repository": { + "url": "git+https://github.com/fb55/entities.git", + "type": "git" + }, + "licenseFiles": [ + "entities-LICENSE" + ] + }, + { + "name": "linkify-it", + "licenseSourceVersion": "6.1.0", + "licenseFiles": [ + "linkify-it-LICENSE" + ] + }, + { + "name": "punycode.js", + "licenseSourceVersion": "2.3.1", + "licenseFiles": [ + "punycode.js-LICENSE-MIT.txt" + ] + }, + { + "name": "pako", + "licenseSourceVersion": "1.0.11", + "licenseFiles": [ + "pako-LICENSE" + ] + }, + { + "name": "lie", + "licenseSourceVersion": "3.3.0", + "licenseFiles": [ + "lie-license.md" + ] + }, + { + "name": "immediate", + "licenseSourceVersion": "3.0.6", + "licenseFiles": [ + "immediate-LICENSE.txt" + ] + }, + { + "name": "readable-stream", + "licenseSourceVersion": "2.3.8", + "license": "MIT", + "repository": { + "url": "git://github.com/nodejs/readable-stream.git", + "type": "git" + }, + "licenseFiles": [ + "readable-stream-LICENSE" + ] + }, + { + "name": "core-util-is", + "licenseSourceVersion": "1.0.3", + "licenseFiles": [ + "core-util-is-LICENSE" + ] + }, + { + "name": "inherits", + "licenseSourceVersion": "2.0.4", + "licenseFiles": [ + "inherits-LICENSE" + ] + }, + { + "name": "isarray", + "licenseSourceVersion": "1.0.0", + "license": "MIT", + "repository": { + "url": "git://github.com/juliangruber/isarray.git", + "type": "git" + }, + "licenseFiles": [ + "isarray-LICENSE-README.md" + ] + }, + { + "name": "safe-buffer", + "licenseSourceVersion": "5.1.2", + "licenseFiles": [ + "safe-buffer-LICENSE" + ] + }, + { + "name": "string_decoder", + "licenseSourceVersion": "1.1.1", + "licenseFiles": [ + "string_decoder-LICENSE" + ] + }, + { + "name": "util-deprecate", + "licenseSourceVersion": "1.0.2", + "licenseFiles": [ + "util-deprecate-LICENSE" + ] + }, + { + "name": "setimmediate", + "licenseSourceVersion": "1.0.5", + "license": "MIT", + "repository": { + "url": "git+https://github.com/yuzujs/setImmediate.git", + "type": "git" + }, + "licenseFiles": [ + "setimmediate-LICENSE.txt" + ] + } +] diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/mdurl-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/mdurl-LICENSE new file mode 100644 index 0000000..3b2c7bf --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/mdurl-LICENSE @@ -0,0 +1,45 @@ +Copyright (c) 2015 Vitaly Puzrin, Alex Kocharin. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +-------------------------------------------------------------------------------- + +.parse() is based on Joyent's node.js `url` code: + +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/pako-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/pako-LICENSE new file mode 100644 index 0000000..a934ef8 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/pako-LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/punycode.js-LICENSE-MIT.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/punycode.js-LICENSE-MIT.txt new file mode 100644 index 0000000..a41e0a7 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/punycode.js-LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/readable-stream-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/readable-stream-LICENSE new file mode 100644 index 0000000..2873b3b --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/readable-stream-LICENSE @@ -0,0 +1,47 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/safe-buffer-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/safe-buffer-LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/safe-buffer-LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/setimmediate-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/setimmediate-LICENSE.txt new file mode 100644 index 0000000..32b20de --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/setimmediate-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, and Domenic Denicola + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/string_decoder-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/string_decoder-LICENSE new file mode 100644 index 0000000..778edb2 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/string_decoder-LICENSE @@ -0,0 +1,48 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/uc.micro-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/uc.micro-LICENSE.txt new file mode 100644 index 0000000..a41e0a7 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/uc.micro-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/util-deprecate-LICENSE b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/util-deprecate-LICENSE new file mode 100644 index 0000000..6a60e8c --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/bundled/util-deprecate-LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/docx-preview-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/docx-preview-LICENSE.txt new file mode 100644 index 0000000..2cc319c --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/docx-preview-LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2016-2023 Volodymyr Baydalka + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/dompurify-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/dompurify-LICENSE.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/dompurify-LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/jszip-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/jszip-LICENSE.txt new file mode 100644 index 0000000..f8250b3 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/jszip-LICENSE.txt @@ -0,0 +1,651 @@ +JSZip is dual licensed. At your choice you may use it under the MIT license *or* the GPLv3 +license. + +The MIT License +=============== + +Copyright (c) 2009-2016 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +GPL version 3 +============= + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS diff --git a/suixinkan/Resources/TrainingDocumentPreview/licenses/markdown-it-LICENSE.txt b/suixinkan/Resources/TrainingDocumentPreview/licenses/markdown-it-LICENSE.txt new file mode 100644 index 0000000..7ffa058 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/licenses/markdown-it-LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/suixinkan/Resources/TrainingDocumentPreview/preview.css b/suixinkan/Resources/TrainingDocumentPreview/preview.css new file mode 100644 index 0000000..2b49b33 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/preview.css @@ -0,0 +1,25 @@ +:root { color-scheme: light; } +* { box-sizing: border-box; } +html, body { margin: 0; padding: 0; background: #fff; color: #25334b; } +body { font: 16px/1.8 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif; overflow-wrap: break-word; -webkit-text-size-adjust: 100%; } +#status { padding: 20px 16px; margin: 0; color: #8897ad; white-space: pre-wrap; } +#document { min-height: 80px; padding: 16px; width: 100%; overflow-x: auto; } +#document[hidden], #status[hidden] { display: none; } +#document > :first-child { margin-top: 0; } +#document > :last-child { margin-bottom: 0; } +h1, h2, h3, h4, h5, h6 { line-height: 1.5; color: #182238; margin: 1.2em 0 .6em; } +h1 { font-size: 1.5em; } h2 { font-size: 1.3em; } h3 { font-size: 1.15em; } +p { margin: .65em 0; } +a { color: #2679ff; text-decoration: underline; } +img { max-width: 100%; height: auto; } +table { max-width: 100%; border-collapse: collapse; } +th, td { border: 1px solid #dfe7f2; padding: 6px 8px; vertical-align: top; } +pre { white-space: pre-wrap; overflow-wrap: break-word; margin: 0; font: inherit; tab-size: 4; } +pre code { font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; } +code { background: #f3f6fa; border-radius: 3px; padding: .1em .25em; } +pre:has(code) { padding: 12px; background: #f3f6fa; border-radius: 6px; } +blockquote { margin: 1em 0; padding: 0 12px; border-left: 3px solid #dfe7f2; color: #687b98; } +ul, ol { padding-left: 1.6em; } +.docx-wrapper { padding: 0 !important; background: transparent !important; } +.docx-wrapper > section.docx { box-shadow: none !important; margin: 0 !important; padding: 0 !important; min-height: 0 !important; width: 100% !important; max-width: 100% !important; } +section.docx article { min-height: 0 !important; } diff --git a/suixinkan/Resources/TrainingDocumentPreview/preview.js b/suixinkan/Resources/TrainingDocumentPreview/preview.js new file mode 100644 index 0000000..0d71405 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/preview.js @@ -0,0 +1,264 @@ +/* Trusted local document renderer. No application token or remote attachment URL enters this page. */ +(function () { + 'use strict'; + var params = new URLSearchParams(window.location.search); + var requestId = params.get('requestId') || ''; + var kind = params.get('type') || ''; + var content = document.getElementById('document'); + var status = document.getElementById('status'); + var finished = false; + var limits = { source: 30 * 1024 * 1024, text: 5 * 1024 * 1024, entries: 1000, item: 20 * 1024 * 1024, total: 100 * 1024 * 1024 }; + + /** Send only request-scoped, explicitly understood messages to the native host. */ + function post(type, fields) { + var message = { type: type, requestId: requestId }; + Object.keys(fields || {}).forEach(function (key) { message[key] = fields[key]; }); + if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.trainingDocument) { + window.webkit.messageHandlers.trainingDocument.postMessage(message); + } else if (window.TrainingDocument && typeof window.TrainingDocument.postMessage === 'function') { + window.TrainingDocument.postMessage(JSON.stringify(message)); + } + } + + function previewError(code, message) { + var error = new Error(message); + error.previewCode = code; + return error; + } + + function fail(error) { + if (finished) { return; } + finished = true; + content.hidden = true; + content.textContent = ''; + status.hidden = false; + status.textContent = error && error.message ? error.message : '附件无法预览,请重试'; + post('error', { code: error.previewCode || 'render_failed', message: status.textContent }); + } + + /** XHR also works for local WKURLSchemeHandler resources without exposing remote origins. */ + function loadBytes() { + return new Promise(function (resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', './document/' + requestId + '/file', true); + xhr.responseType = 'arraybuffer'; + xhr.timeout = 30000; + xhr.withCredentials = false; + xhr.onprogress = function (event) { + if (event.loaded > limits.source) { + xhr.abort(); + reject(previewError('file_too_large', '附件超过 30 MB,暂时无法预览')); + } + }; + xhr.onload = function () { + if (xhr.status !== 0 && (xhr.status < 200 || xhr.status >= 300)) { + reject(previewError('document_unavailable', '附件加载失败,请重试')); return; + } + if (!(xhr.response instanceof ArrayBuffer) || !xhr.response.byteLength) { + reject(previewError('empty_document', '附件内容为空')); return; + } + if (xhr.response.byteLength > limits.source) { + reject(previewError('file_too_large', '附件超过 30 MB,暂时无法预览')); return; + } + resolve(xhr.response); + }; + xhr.onerror = function () { reject(previewError('document_unavailable', '附件加载失败,请重试')); }; + xhr.ontimeout = function () { reject(previewError('document_timeout', '附件加载超时,请重试')); }; + xhr.onabort = function () { reject(previewError('document_cancelled', '附件加载已取消')); }; + xhr.send(); + }); + } + + /** Decode common Chinese text encodings, refusing binary input rather than showing corrupt markup. */ + function decodeText(buffer) { + if (buffer.byteLength > limits.text) { throw previewError('text_too_large', '文本附件超过 5 MB,暂时无法预览'); } + var bytes = new Uint8Array(buffer); + var encoding = 'utf-8'; + if (bytes[0] === 0xff && bytes[1] === 0xfe) { encoding = 'utf-16le'; } + else if (bytes[0] === 0xfe && bytes[1] === 0xff) { encoding = 'utf-16be'; } + else { + // Some TXT exporters omit the UTF-16 byte-order mark. + var evenNul = 0; var oddNul = 0; var count = Math.min(bytes.length, 256); + for (var i = 0; i < count; i += 1) { if (!bytes[i]) { if (i % 2) { oddNul += 1; } else { evenNul += 1; } } } + if (count > 4 && oddNul > count / 5 && evenNul === 0) { encoding = 'utf-16le'; } + else if (count > 4 && evenNul > count / 5 && oddNul === 0) { encoding = 'utf-16be'; } + } + var text; + try { text = new TextDecoder(encoding, { fatal: true }).decode(bytes); } + catch (error) { + if (encoding !== 'utf-8') { throw previewError('unsupported_encoding', '附件文本编码无法识别'); } + try { text = new TextDecoder('gb18030', { fatal: true }).decode(bytes); } + catch (fallbackError) { throw previewError('unsupported_encoding', '附件文本编码无法识别'); } + } + if (/[\u0000-\u0008\u000e-\u001f]/.test(text)) { throw previewError('invalid_text', '附件不是可预览的文本文件'); } + if (!text.trim()) { throw previewError('empty_document', '附件内容为空'); } + return text.replace(/^\uFEFF/, ''); + } + + /** Check advertised ZIP sizes before any decompression; ZIP64, encryption, split archives are unsupported. */ + function checkZipDirectory(buffer) { + var view = new DataView(buffer); + var end = -1; + for (var i = buffer.byteLength - 22; i >= Math.max(0, buffer.byteLength - 65557); i -= 1) { + if (view.getUint32(i, true) === 0x06054b50 && i + 22 + view.getUint16(i + 20, true) === buffer.byteLength) { end = i; break; } + } + if (end < 0 || view.getUint16(end + 4, true) || view.getUint16(end + 6, true)) { throw previewError('invalid_docx', 'DOCX 文件损坏或格式不受支持'); } + var count = view.getUint16(end + 10, true); + var cursor = view.getUint32(end + 16, true); + var directorySize = view.getUint32(end + 12, true); + if (count > limits.entries || count === 0xffff || cursor + directorySize > end) { throw previewError('docx_too_large', 'DOCX 结构过大,暂时无法预览'); } + var total = 0; + for (var item = 0; item < count; item += 1) { + if (cursor + 46 > end || view.getUint32(cursor, true) !== 0x02014b50) { throw previewError('invalid_docx', 'DOCX 文件结构不完整'); } + var size = view.getUint32(cursor + 24, true); + var flags = view.getUint16(cursor + 8, true); + var compression = view.getUint16(cursor + 10, true); + if ((flags & 1) || (compression !== 0 && compression !== 8)) { throw previewError('encrypted_docx', '暂不支持加密的 DOCX 附件'); } + total += size; + if (size > limits.item || total > limits.total) { throw previewError('docx_too_large', 'DOCX 解压后内容过大,暂时无法预览'); } + cursor += 46 + view.getUint16(cursor + 28, true) + view.getUint16(cursor + 30, true) + view.getUint16(cursor + 32, true); + } + if (cursor !== view.getUint32(end + 16, true) + directorySize) { throw previewError('invalid_docx', 'DOCX 文件结构不完整'); } + } + + /** Bound actual inflated bytes as well as directory declarations before docx-preview reads entries. */ + async function validateDocx(buffer) { + checkZipDirectory(buffer); + var zip = await JSZip.loadAsync(buffer); + var names = Object.keys(zip.files); + if (!zip.file('word/document.xml') || !zip.file('[Content_Types].xml') || names.length > limits.entries) { + throw previewError('invalid_docx', '附件不是有效的 DOCX 文件'); + } + var total = 0; + for (var i = 0; i < names.length; i += 1) { + var entry = zip.files[names[i]]; + if (entry.dir) { continue; } + await new Promise(function (resolve, reject) { + var size = 0; + var stream = entry.internalStream('uint8array'); + stream.on('data', function (chunk) { + size += chunk.length; total += chunk.length; + if (size > limits.item || total > limits.total) { + stream.pause(); reject(previewError('docx_too_large', 'DOCX 解压后内容过大,暂时无法预览')); + } + }); + stream.on('error', function () { reject(previewError('invalid_docx', 'DOCX 文件损坏,无法预览')); }); + stream.on('end', resolve); + stream.resume(); + }); + } + } + + /** Remove network-bearing attributes before connecting sanitized document nodes to the visible tree. */ + function cleanDocument(root) { + root.querySelectorAll('img').forEach(function (image) { + var src = image.getAttribute('src') || ''; + if (!/^(?:blob:|data:image\/(?:png|jpeg|gif|webp|bmp);base64,)/i.test(src)) { + var fallback = document.createElement('span'); + fallback.textContent = image.getAttribute('alt') || ''; + image.parentNode.replaceChild(fallback, image); + return; + } + image.removeAttribute('srcset'); + image.removeAttribute('onload'); + image.removeAttribute('onerror'); + }); + root.querySelectorAll('[href]').forEach(function (link) { + var href = link.getAttribute('href') || ''; + if (!/^(https?:\/\/|#)/i.test(href)) { link.removeAttribute('href'); } + link.removeAttribute('target'); + link.removeAttribute('download'); + link.setAttribute('rel', 'noopener noreferrer'); + }); + root.querySelectorAll('[style]').forEach(function (element) { + var style = element.getAttribute('style'); + if (/(?:url\s*\(|@import|expression\s*\()/i.test(style || '')) { element.removeAttribute('style'); } + }); + root.querySelectorAll('style').forEach(function (sheet) { + if (/(?:@import|url\s*\((?!\s*["']?(?:blob:|data:)))/i.test(sheet.textContent || '')) { sheet.remove(); } + }); + } + + async function render(buffer) { + if (kind === 'txt') { + var pre = document.createElement('pre'); + pre.textContent = decodeText(buffer); + content.appendChild(pre); + } else if (kind === 'md') { + var parser = window.markdownit({ html: false, linkify: false, typographer: false, breaks: true }); + var html = parser.render(decodeText(buffer)); + var fragment = DOMPurify.sanitize(html, { RETURN_DOM_FRAGMENT: true, USE_PROFILES: { html: true }, FORBID_TAGS: ['style', 'form', 'input', 'button', 'iframe', 'object', 'embed', 'video', 'audio'] }); + cleanDocument(fragment); + content.appendChild(fragment); + } else { + await validateDocx(buffer); + var body = document.createElement('div'); + var styles = document.createElement('div'); + await window.docx.renderAsync(buffer, body, styles, { + className: 'docx', inWrapper: true, ignoreWidth: true, ignoreHeight: true, + ignoreFonts: true, breakPages: false, experimental: false, renderChanges: false, + renderHeaders: true, renderFooters: true, renderFootnotes: true, renderEndnotes: true, + renderComments: false, renderAltChunks: false, useBase64URL: false + }); + var combined = document.createElement('div'); + combined.appendChild(styles); combined.appendChild(body); + var safe = DOMPurify.sanitize(combined, { + RETURN_DOM_FRAGMENT: true, ADD_TAGS: ['style'], ADD_ATTR: ['style'], + FORBID_TAGS: ['script', 'iframe', 'object', 'embed', 'form', 'input', 'button', 'video', 'audio', 'svg', 'math'], + ALLOWED_URI_REGEXP: /^(?:(?:https?|blob):|data:image\/|#)/i, + ALLOW_DATA_ATTR: false + }); + cleanDocument(safe); + var pages = safe.querySelectorAll('section.docx'); + var hasText = Array.prototype.some.call(pages, function (page) { return page.textContent.trim().length > 0; }); + if (!hasText && !safe.querySelector('img[src]')) { throw previewError('empty_document', 'DOCX 文件没有可预览的内容'); } + content.appendChild(safe); + } + } + + /** Wait for visible content and images to settle, then two paint opportunities before allowing reading time. */ + async function visibleReady() { + status.hidden = true; + content.hidden = false; + var images = Array.prototype.slice.call(content.querySelectorAll('img[src]')); + await Promise.all(images.map(function (image) { + if (image.complete) { return Promise.resolve(); } + return new Promise(function (resolve) { + var timeout = setTimeout(function () { image.removeAttribute('src'); resolve(); }, 8000); + var complete = function () { clearTimeout(timeout); resolve(); }; + image.addEventListener('load', complete, { once: true }); + image.addEventListener('error', complete, { once: true }); + }); + })); + if (document.fonts && document.fonts.ready) { await document.fonts.ready; } + await new Promise(function (resolve) { requestAnimationFrame(function () { requestAnimationFrame(resolve); }); }); + if (finished) { return; } + if (content.getBoundingClientRect().height <= 0) { throw previewError('render_failed', '附件内容尚未显示,请重试'); } + finished = true; + post('ready', { height: Math.ceil(Math.max(content.scrollHeight, content.getBoundingClientRect().height)) }); + } + + // Block every generated link from navigating this trusted local shell. + document.addEventListener('click', function (event) { + var element = event.target instanceof Element ? event.target.closest('a') : null; + if (!element) { return; } + event.preventDefault(); + var href = element.getAttribute('href') || ''; + if (/^https?:\/\//i.test(href)) { + try { + var url = new URL(href); + if ((url.protocol === 'http:' || url.protocol === 'https:') && !url.username && !url.password) { post('link', { url: url.href }); } + } catch (error) { /* Malformed or unsupported destinations do not leave the document. */ } + } else if (href.charAt(0) === '#') { + var anchor = document.getElementById(href.slice(1)); + if (anchor) { anchor.scrollIntoView(); } + } + }, true); + + if (!/^[A-Za-z0-9_-]{1,80}$/.test(requestId) || ['docx', 'txt', 'md'].indexOf(kind) === -1) { + fail(previewError('unsupported_type', '暂不支持此附件格式')); return; + } + loadBytes().then(render).then(visibleReady).catch(function (error) { + fail(error.previewCode ? error : previewError('render_failed', '附件无法预览,文件可能已损坏')); + }); +}()); diff --git a/suixinkan/Resources/TrainingDocumentPreview/vendor-manifest.json b/suixinkan/Resources/TrainingDocumentPreview/vendor-manifest.json new file mode 100644 index 0000000..c0521fb --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/vendor-manifest.json @@ -0,0 +1,70 @@ +[ + { + "name": "docx-preview", + "version": "0.4.1", + "license": "Apache-2.0", + "selectedLicense": "Apache-2.0", + "repository": { + "url": "git+https://github.com/VolodymyrBaydalka/docxjs.git", + "type": "git" + }, + "tarball": "https://registry.npmjs.org/docx-preview/-/docx-preview-0.4.1.tgz", + "integrity": "sha512-Dv4g+LeE0swHpPvNC0lAT0YsR5Zq5pAxw7d3vHQ8EChBLgIrqqe9VPL5nVt2HBJap8bEZbXUI0TJob7kBeNU9w==", + "upstreamSource": "dist/docx-preview.min.js", + "sourceSHA256": "c4a133c65a112799e35b143c572dfff9e923a3bf39b5fd3b07a06aa0f8f530c2", + "asset": "docx-preview.min.js", + "assetSHA256": "a0f8943d67e0fddec3d96ff7e1d3829ac63ce5d81598ac6ba2ab808afd520ad6", + "transformation": "esbuild 0.28.2 --target=es2017 --minify --legal-comments=inline" + }, + { + "name": "jszip", + "version": "3.10.2", + "license": "(MIT OR GPL-3.0-or-later)", + "selectedLicense": "MIT", + "repository": { + "url": "git+https://github.com/Stuk/jszip.git", + "type": "git" + }, + "tarball": "https://registry.npmjs.org/jszip/-/jszip-3.10.2.tgz", + "integrity": "sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==", + "upstreamSource": "dist/jszip.min.js", + "sourceSHA256": "7f839b2d4688b845c105ebf5d2f9803075f91ea0fe72bdaac176c3a04dd3d2c1", + "asset": "jszip.min.js", + "assetSHA256": "3ba8b2e2542143b2d970056513529b237f6b15ca71ff8a002d7287e813326e7c", + "transformation": "esbuild 0.28.2 --target=es2017 --minify --legal-comments=inline" + }, + { + "name": "markdown-it", + "version": "15.0.3", + "license": "MIT", + "selectedLicense": "MIT", + "repository": { + "url": "git+https://github.com/markdown-it/markdown-it.git", + "type": "git" + }, + "tarball": "https://registry.npmjs.org/markdown-it/-/markdown-it-15.0.3.tgz", + "integrity": "sha512-+Az7Ojz3iRGu8KYMvJ6xVhvrxP3eE+vEtJX75Ow88XBpcQNV/0lGX5ZynIIBftREo4DC2jsveAMDaeltmm8QvQ==", + "upstreamSource": "dist/browser/markdown-it.umd.min.js", + "sourceSHA256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e", + "asset": "markdown-it.min.js", + "assetSHA256": "431b4cc500c46c4935d4e2fc48d16f9b65705e0466d6e5026cf584c480ba303f", + "transformation": "esbuild 0.28.2 --target=es2017 --minify --legal-comments=inline" + }, + { + "name": "dompurify", + "version": "3.4.17", + "license": "(MPL-2.0 OR Apache-2.0)", + "selectedLicense": "Apache-2.0", + "repository": { + "url": "git://github.com/cure53/DOMPurify.git", + "type": "git" + }, + "tarball": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.17.tgz", + "integrity": "sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==", + "upstreamSource": "dist/purify.min.js", + "sourceSHA256": "cd37898f9782adf54820c413191b5691803f0f137c799d6edcfd38523b4c2c31", + "asset": "purify.min.js", + "assetSHA256": "01de8dd1aba9bfc934898eef69ff980fdcb2c7ec5f7da856cfe785e864a5c443", + "transformation": "esbuild 0.28.2 --target=es2017 --minify --legal-comments=inline" + } +] diff --git a/suixinkan/Resources/TrainingDocumentPreview/vendor/docx-preview.min.js b/suixinkan/Resources/TrainingDocumentPreview/vendor/docx-preview.min.js new file mode 100644 index 0000000..0a3021a --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/vendor/docx-preview.min.js @@ -0,0 +1,27 @@ +var Tt=Object.defineProperty,Et=Object.defineProperties;var Rt=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var Me=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var Se=(f,v,u)=>v in f?Tt(f,v,{enumerable:!0,configurable:!0,writable:!0,value:u}):f[v]=u,P=(f,v)=>{for(var u in v||(v={}))Me.call(v,u)&&Se(f,u,v[u]);if(z)for(var u of z(v))xe.call(v,u)&&Se(f,u,v[u]);return f},B=(f,v)=>Et(f,Rt(v));var K=(f,v)=>{var u={};for(var S in f)Me.call(f,S)&&v.indexOf(S)<0&&(u[S]=f[S]);if(f!=null&&z)for(var S of z(f))v.indexOf(S)<0&&xe.call(f,S)&&(u[S]=f[S]);return u};/* + * @license + * docx-preview + * Released under Apache License 2.0 + * Copyright Volodymyr Baydalka + */(function(f,v){typeof exports=="object"&&typeof module!="undefined"?v(exports,require("jszip")):typeof define=="function"&&define.amd?define(["exports","jszip"],v):v((f=typeof globalThis!="undefined"?globalThis:f||self).docx={},f.JSZip)})(this,function(f,v){"use strict";var u;function S(n){return/^[^"'].*\s.*[^"']$/.test(n)?`'${n}'`:n}function H(n){let e=n.lastIndexOf("/")+1;return[e==0?"":n.substring(0,e),e==0?n:n.substring(e)]}function V(n,e){try{const t="http://docx/";return new URL(n,t+e).toString().substring(t.length)}catch(t){return`${e}${n}`}}function A(n,e){return n.reduce((t,r)=>(t[e(r)]=r,t),{})}function W(n){return n&&typeof n=="object"&&!Array.isArray(n)}function X(n){return typeof n=="string"||n instanceof String}function I(n,...e){var r;if(!e.length)return n;const t=e.shift();if(W(n)&&W(t))for(const a in t)W(t[a])?I((r=n[a])!=null?r:n[a]={},t[a]):n[a]=t[a];return I(n,...e)}function D(n){return Array.isArray(n)?n:[n]}(function(n){n.OfficeDocument="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",n.FontTable="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",n.Image="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",n.Numbering="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",n.Styles="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",n.StylesWithEffects="http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects",n.Theme="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",n.Settings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",n.WebSettings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",n.Hyperlink="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",n.Footnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",n.Endnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",n.Footer="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",n.Header="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",n.ExtendedProperties="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",n.CoreProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",n.CustomProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/custom-properties",n.Comments="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",n.CommentsExtended="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",n.AltChunk="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"})(u||(u={}));const Q="http://schemas.openxmlformats.org/wordprocessingml/2006/main",G={mul:.05,unit:"pt"},C={mul:1/12700,unit:"pt"},U={mul:.5,unit:"pt"},ee={mul:.125,unit:"pt",min:.25,max:12},Ne={mul:1,unit:"pt"},Ce={mul:.02,unit:"%"};function te(n,e=G){if(n==null||/.+(p[xt]|[%])$/.test(n))return n;var t=parseInt(n)*e.mul;return e.min&&e.max&&(t=(function(r,a,s){return a>r?a:s(function(r,a){let s={name:a.attr(r,"name"),embedFontRefs:[]};for(let o of a.elements(r))switch(o.localName){case"family":s.family=a.attr(o,"val");break;case"altName":s.altName=a.attr(o,"val");break;case"embedRegular":case"embedBold":case"embedItalic":case"embedBoldItalic":s.embedFontRefs.push(Ee(o,a))}return s})(t,e))}function Ee(n,e){return{id:e.attr(n,"id"),key:e.attr(n,"fontKey"),type:Ae[n.localName]}}class Re extends M{parseXml(e){this.fonts=Te(e,this._package.xmlParser)}}class q{constructor(e,t){this._zip=e,this.options=t,this.xmlParser=new ae}get(e){var r;const t=(function(a){return a.startsWith("/")?a.substr(1):a})(e);return(r=this._zip.files[t])!=null?r:this._zip.files[t.replace(/\//g,"\\")]}update(e,t){this._zip.file(e,t)}static async load(e,t){const r=await v.loadAsync(e);return new q(r,t)}save(e="blob"){return this._zip.generateAsync({type:e})}load(e,t="string"){var r,a;return(a=(r=this.get(e))==null?void 0:r.async(t))!=null?a:Promise.resolve(null)}async loadRelationships(e=null){let t="_rels/.rels";if(e!=null){const[o,c]=H(e);t=`${o}_rels/${c}.rels`}const r=await this.load(t);return r?(a=this.parseXmlDocument(r).firstElementChild,(s=this.xmlParser).elements(a).map(o=>({id:s.attr(o,"Id"),type:s.attr(o,"Type"),target:s.attr(o,"Target"),targetMode:s.attr(o,"TargetMode")}))):null;var a,s}async loadContentTypes(){const e=await this.load("[Content_Types].xml");return e?(t=this.parseXmlDocument(e).firstElementChild,(r=this.xmlParser).elements(t).map(a=>({extension:r.attr(a,"Extension"),partName:r.attr(a,"PartName"),contentType:r.attr(a,"ContentType")}))):[];var t,r}parseXmlDocument(e){return(function(t,r=!1){var h;var a;r&&(t=t.replace(/<[?].*[?]>/,"")),t=(a=t).charCodeAt(0)===65279?a.substring(1):a;const s=new DOMParser().parseFromString(t,"application/xml"),o=(c=s,(h=c.getElementsByTagName("parsererror")[0])==null?void 0:h.textContent);var c;if(o)throw new Error(o);return s})(e,this.options.trimXmlDeclaration)}}class Be extends M{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.body=this._documentParser.parseDocumentFile(e)}}function O(n,e){return{type:e.attr(n,"val"),color:e.attr(n,"color"),size:e.lengthAttr(n,"sz",ee),offset:e.lengthAttr(n,"space",Ne),frame:e.boolAttr(n,"frame"),shadow:e.boolAttr(n,"shadow")}}function De(n,e){var t={};for(let r of e.elements(n))switch(r.localName){case"left":t.left=O(r,e);break;case"top":t.top=O(r,e);break;case"right":t.right=O(r,e);break;case"bottom":t.bottom=O(r,e)}return t}var se,i;function ne(n,e=l){var r,a;var t={};for(let s of e.elements(n))switch(s.localName){case"pgSz":t.pageSize={width:e.lengthAttr(s,"w"),height:e.lengthAttr(s,"h"),orientation:e.attr(s,"orient")};break;case"type":t.type=e.attr(s,"val");break;case"pgMar":t.pageMargins={left:e.lengthAttr(s,"left"),right:e.lengthAttr(s,"right"),top:e.lengthAttr(s,"top"),bottom:e.lengthAttr(s,"bottom"),header:e.lengthAttr(s,"header"),footer:e.lengthAttr(s,"footer"),gutter:e.lengthAttr(s,"gutter")};break;case"cols":t.columns=Le(s,e);break;case"headerReference":((r=t.headerRefs)!=null?r:t.headerRefs=[]).push(le(s,e));break;case"footerReference":((a=t.footerRefs)!=null?a:t.footerRefs=[]).push(le(s,e));break;case"titlePg":t.titlePage=e.boolAttr(s,"val",!0);break;case"pgBorders":t.pageBorders=De(s,e);break;case"pgNumType":t.pageNumber=$e(s,e)}return t}function Le(n,e){return{numberOfColumns:e.intAttr(n,"num"),space:e.lengthAttr(n,"space"),separator:e.boolAttr(n,"sep"),equalWidth:e.boolAttr(n,"equalWidth",!0),columns:e.elements(n,"col").map(t=>({width:e.lengthAttr(t,"w"),space:e.lengthAttr(t,"space")}))}}function $e(n,e){return{chapSep:e.attr(n,"chapSep"),chapStyle:e.attr(n,"chapStyle"),format:e.attr(n,"fmt"),start:e.intAttr(n,"start")}}function le(n,e){return{id:e.attr(n,"id"),type:e.attr(n,"type")}}function J(n,e){let t={};for(let r of e.elements(n))Fe(r,t,e);return t}function Fe(n,e,t){return!!re(n,e,t)}function oe(n,e){let t={};for(let r of e.elements(n))ie(r,t,e);return t}function ie(n,e,t){if(n.namespaceURI!=Q)return!1;if(re(n,e,t))return!0;switch(n.localName){case"tabs":e.tabs=(function(r,a){return a.elements(r,"tab").map(s=>({position:a.lengthAttr(s,"pos"),leader:a.attr(s,"leader"),style:a.attr(s,"val")}))})(n,t);break;case"sectPr":e.sectionProps=ne(n,t);break;case"numPr":e.numbering=(function(r,a){var s={};for(let o of a.elements(r))switch(o.localName){case"numId":s.id=a.attr(o,"val");break;case"ilvl":s.level=a.intAttr(o,"val")}return s})(n,t);break;case"spacing":return e.lineSpacing=(function(r,a){return{before:a.lengthAttr(r,"before"),after:a.lengthAttr(r,"after"),line:a.intAttr(r,"line"),lineRule:a.attr(r,"lineRule")}})(n,t),!1;case"textAlignment":return e.textAlignment=t.attr(n,"val"),!1;case"keepLines":e.keepLines=t.boolAttr(n,"val",!0);break;case"keepNext":e.keepNext=t.boolAttr(n,"val",!0);break;case"pageBreakBefore":e.pageBreakBefore=t.boolAttr(n,"val",!0);break;case"outlineLvl":e.outlineLevel=t.intAttr(n,"val");break;case"pStyle":e.styleName=t.attr(n,"val");break;case"rPr":e.runProps=J(n,t);break;default:return!1}return!0}function He(n,e){let t={id:e.attr(n,"numId"),overrides:[]};for(let r of e.elements(n))switch(r.localName){case"abstractNumId":t.abstractId=e.attr(r,"val");break;case"lvlOverride":t.overrides.push(Oe(r,e))}return t}function Ie(n,e){let t={id:e.attr(n,"abstractNumId"),levels:[]};for(let r of e.elements(n))switch(r.localName){case"name":t.name=e.attr(r,"val");break;case"multiLevelType":t.multiLevelType=e.attr(r,"val");break;case"numStyleLink":t.numberingStyleLink=e.attr(r,"val");break;case"styleLink":t.styleLink=e.attr(r,"val");break;case"lvl":t.levels.push(ce(r,e))}return t}function ce(n,e){let t={level:e.intAttr(n,"ilvl")};for(let r of e.elements(n))switch(r.localName){case"start":t.start=e.attr(r,"val");break;case"lvlRestart":t.restart=e.intAttr(r,"val");break;case"numFmt":t.format=e.attr(r,"val");break;case"lvlText":t.text=e.attr(r,"val");break;case"lvlJc":t.justification=e.attr(r,"val");break;case"lvlPicBulletId":t.bulletPictureId=e.attr(r,"val");break;case"pStyle":t.paragraphStyle=e.attr(r,"val");break;case"pPr":t.paragraphProps=oe(r,e);break;case"rPr":t.runProps=J(r,e)}return t}function Oe(n,e){let t={level:e.intAttr(n,"ilvl")};for(let r of e.elements(n))switch(r.localName){case"startOverride":t.start=e.intAttr(r,"val");break;case"lvl":t.numberingLevel=ce(r,e)}return t}function _e(n,e){var t=e.element(n,"pict"),r=t&&e.element(t,"shape"),a=r&&e.element(r,"imagedata");return a?{id:e.attr(n,"numPicBulletId"),referenceId:e.attr(a,"id"),style:e.attr(r,"style")}:null}(function(n){n.Continuous="continuous",n.NextPage="nextPage",n.NextColumn="nextColumn",n.EvenPage="evenPage",n.OddPage="oddPage"})(se||(se={}));class je extends M{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){Object.assign(this,(function(t,r){let a={numberings:[],abstractNumberings:[],bulletPictures:[]};for(let s of r.elements(t))switch(s.localName){case"num":a.numberings.push(He(s,r));break;case"abstractNum":a.abstractNumberings.push(Ie(s,r));break;case"numPicBullet":a.bulletPictures.push(_e(s,r))}return a})(e,this._package.xmlParser)),this.domNumberings=this._documentParser.parseNumberingFile(e)}}class ze extends M{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.styles=this._documentParser.parseStylesFile(e)}}(function(n){n.Document="document",n.Paragraph="paragraph",n.Run="run",n.Break="break",n.NoBreakHyphen="noBreakHyphen",n.Table="table",n.Row="row",n.Cell="cell",n.Hyperlink="hyperlink",n.SmartTag="smartTag",n.Drawing="drawing",n.Image="image",n.Text="text",n.Tab="tab",n.Symbol="symbol",n.BookmarkStart="bookmarkStart",n.BookmarkEnd="bookmarkEnd",n.Footer="footer",n.Header="header",n.FootnoteReference="footnoteReference",n.EndnoteReference="endnoteReference",n.Footnote="footnote",n.Endnote="endnote",n.SimpleField="simpleField",n.ComplexField="complexField",n.Instruction="instruction",n.VmlPicture="vmlPicture",n.MmlMath="mmlMath",n.MmlMathParagraph="mmlMathParagraph",n.MmlFraction="mmlFraction",n.MmlFunction="mmlFunction",n.MmlFunctionName="mmlFunctionName",n.MmlNumerator="mmlNumerator",n.MmlDenominator="mmlDenominator",n.MmlRadical="mmlRadical",n.MmlBase="mmlBase",n.MmlDegree="mmlDegree",n.MmlSuperscript="mmlSuperscript",n.MmlSubscript="mmlSubscript",n.MmlPreSubSuper="mmlPreSubSuper",n.MmlSubArgument="mmlSubArgument",n.MmlSuperArgument="mmlSuperArgument",n.MmlNary="mmlNary",n.MmlDelimiter="mmlDelimiter",n.MmlRun="mmlRun",n.MmlEquationArray="mmlEquationArray",n.MmlLimit="mmlLimit",n.MmlLimitLower="mmlLimitLower",n.MmlMatrix="mmlMatrix",n.MmlMatrixRow="mmlMatrixRow",n.MmlBox="mmlBox",n.MmlBar="mmlBar",n.MmlGroupChar="mmlGroupChar",n.VmlElement="vmlElement",n.Inserted="inserted",n.Deleted="deleted",n.DeletedText="deletedText",n.Comment="comment",n.CommentReference="commentReference",n.CommentRangeStart="commentRangeStart",n.CommentRangeEnd="commentRangeEnd",n.AltChunk="altChunk"})(i||(i={}));class E{constructor(){this.children=[],this.cssStyle={}}}class Ve extends E{constructor(){super(...arguments),this.type=i.Header}}class We extends E{constructor(){super(...arguments),this.type=i.Footer}}class he extends M{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.rootElement=this.createRootElement(),this.rootElement.children=this._documentParser.parseBodyElements(e)}}class Xe extends he{createRootElement(){return new Ve}}class Ge extends he{createRootElement(){return new We}}function L(n){if(n!==void 0)return parseInt(n)}class Ue extends M{parseXml(e){this.props=(function(t,r){const a={};for(let s of r.elements(t))switch(s.localName){case"Template":a.template=s.textContent;break;case"Pages":a.pages=L(s.textContent);break;case"Words":a.words=L(s.textContent);break;case"Characters":a.characters=L(s.textContent);break;case"Application":a.application=s.textContent;break;case"Lines":a.lines=L(s.textContent);break;case"Paragraphs":a.paragraphs=L(s.textContent);break;case"Company":a.company=s.textContent;break;case"AppVersion":a.appVersion=s.textContent}return a})(e,this._package.xmlParser)}}class qe extends M{parseXml(e){this.props=(function(t,r){const a={};for(let s of r.elements(t))switch(s.localName){case"title":a.title=s.textContent;break;case"description":a.description=s.textContent;break;case"subject":a.subject=s.textContent;break;case"creator":a.creator=s.textContent;break;case"keywords":a.keywords=s.textContent;break;case"language":a.language=s.textContent;break;case"lastModifiedBy":a.lastModifiedBy=s.textContent;break;case"revision":s.textContent&&(a.revision=parseInt(s.textContent))}return a})(e,this._package.xmlParser)}}class Je{}function Ze(n,e){var t={name:e.attr(n,"name"),colors:{}};for(let s of e.elements(n)){var r=e.element(s,"srgbClr"),a=e.element(s,"sysClr");r?t.colors[s.localName]=e.attr(r,"val"):a&&(t.colors[s.localName]=e.attr(a,"lastClr"))}return t}function Ye(n,e){var t={name:e.attr(n,"name")};for(let r of e.elements(n))switch(r.localName){case"majorFont":t.majorFont=me(r,e);break;case"minorFont":t.minorFont=me(r,e)}return t}function me(n,e){return{latinTypeface:e.elementAttr(n,"latin","typeface"),eaTypeface:e.elementAttr(n,"ea","typeface"),csTypeface:e.elementAttr(n,"cs","typeface")}}class Ke extends M{constructor(e,t){super(e,t)}parseXml(e){this.theme=(function(t,r){var a=new Je,s=r.element(t,"themeElements");for(let o of r.elements(s))switch(o.localName){case"clrScheme":a.colorScheme=Ze(o,r);break;case"fontScheme":a.fontScheme=Ye(o,r)}return a})(e,this._package.xmlParser)}}class ue{}class Qe extends ue{constructor(){super(...arguments),this.type=i.Footnote}}class et extends ue{constructor(){super(...arguments),this.type=i.Endnote}}class pe extends M{constructor(e,t,r){super(e,t),this._documentParser=r}}class tt extends pe{constructor(e,t,r){super(e,t,r)}parseXml(e){this.notes=this._documentParser.parseNotes(e,"footnote",Qe)}}class rt extends pe{constructor(e,t,r){super(e,t,r)}parseXml(e){this.notes=this._documentParser.parseNotes(e,"endnote",et)}}function de(n,e){var t={defaultNoteIds:[]};for(let r of e.elements(n))switch(r.localName){case"numFmt":t.nummeringFormat=e.attr(r,"val");break;case"footnote":case"endnote":t.defaultNoteIds.push(e.attr(r,"id"))}return t}class at extends M{constructor(e,t){super(e,t)}parseXml(e){this.settings=(function(t,r){var a={};for(let s of r.elements(t))switch(s.localName){case"defaultTabStop":a.defaultTabStop=r.lengthAttr(s,"val");break;case"footnotePr":a.footnoteProps=de(s,r);break;case"endnotePr":a.endnoteProps=de(s,r);break;case"autoHyphenation":a.autoHyphenation=r.boolAttr(s,"val");break;case"evenAndOddHeaders":a.evenAndOddHeaders=r.boolAttr(s,"val",!0)}return a})(e,this._package.xmlParser)}}class st extends M{parseXml(e){this.props=(function(t,r){return r.elements(t,"property").map(a=>{const s=a.firstChild;return{formatId:r.attr(a,"fmtid"),name:r.attr(a,"name"),type:s.nodeName,value:s.textContent}})})(e,this._package.xmlParser)}}class nt extends M{constructor(e,t,r){super(e,t),this._documentParser=r}parseXml(e){this.comments=this._documentParser.parseComments(e),this.commentMap=A(this.comments,t=>t.id)}}class lt extends M{constructor(e,t){super(e,t),this.comments=[]}parseXml(e){const t=this._package.xmlParser;for(let r of t.elements(e,"commentEx"))this.comments.push({paraId:t.attr(r,"paraId"),paraIdParent:t.attr(r,"paraIdParent"),done:t.boolAttr(r,"done")});this.commentMap=A(this.comments,r=>r.paraId)}}const ot=[{type:u.OfficeDocument,target:"word/document.xml"},{type:u.ExtendedProperties,target:"docProps/app.xml"},{type:u.CoreProperties,target:"docProps/core.xml"},{type:u.CustomProperties,target:"docProps/custom.xml"}];class Z{constructor(){this.parts=[],this.partsMap={},this.contentTypes=[]}static async load(e,t,r){var a=new Z;return a._options=r,a._parser=t,a._package=await q.load(e,r),a.rels=await a._package.loadRelationships(),a.contentTypes=await a._package.loadContentTypes(),await Promise.all(ot.map(s=>{var c;const o=(c=a.rels.find(h=>h.type===s.type))!=null?c:s;return a.loadRelationshipPart(o.target,o.type)})),a}save(e="blob"){return this._package.save(e)}async loadRelationshipPart(e,t){var a;if(this.partsMap[e])return this.partsMap[e];if(!this._package.get(e))return null;let r=null;switch(t){case u.OfficeDocument:this.documentPart=r=new Be(this._package,e,this._parser);break;case u.FontTable:this.fontTablePart=r=new Re(this._package,e);break;case u.Numbering:this.numberingPart=r=new je(this._package,e,this._parser);break;case u.Styles:this.stylesPart=r=new ze(this._package,e,this._parser);break;case u.Theme:this.themePart=r=new Ke(this._package,e);break;case u.Footnotes:this.footnotesPart=r=new tt(this._package,e,this._parser);break;case u.Endnotes:this.endnotesPart=r=new rt(this._package,e,this._parser);break;case u.Footer:r=new Ge(this._package,e,this._parser);break;case u.Header:r=new Xe(this._package,e,this._parser);break;case u.CoreProperties:this.corePropsPart=r=new qe(this._package,e);break;case u.ExtendedProperties:this.extendedPropsPart=r=new Ue(this._package,e);break;case u.CustomProperties:r=new st(this._package,e);break;case u.Settings:this.settingsPart=r=new at(this._package,e);break;case u.Comments:this.commentsPart=r=new nt(this._package,e,this._parser);break;case u.CommentsExtended:this.commentsExtendedPart=r=new lt(this._package,e)}if(r==null)return Promise.resolve(null);if(this.partsMap[e]=r,this.parts.push(r),await r.load(),((a=r.rels)==null?void 0:a.length)>0){const[s]=H(r.path);await Promise.all(r.rels.map(o=>this.loadRelationshipPart(V(o.target,s),o.type)))}return r}async loadDocumentImage(e,t){const r=this.getPathById(t!=null?t:this.documentPart,e);return r?this.blobToURL(await this._package.load(r,"blob"),r):null}async loadNumberingImage(e){const t=this.getPathById(this.numberingPart,e);return t?this.blobToURL(await this._package.load(t,"blob"),t):null}async loadFont(e,t){const r=this.getPathById(this.fontTablePart,e);if(!r)return null;const a=await this._package.load(r,"uint8array");return a&&this.blobToURL(new Blob([it(a,t)]),r)}async loadAltChunk(e,t){const r=this.getPathById(t!=null?t:this.documentPart,e);return r?this._package.load(r,"string"):Promise.resolve(null)}blobToURL(e,t){if(!e)return null;if(t){const r=this.contentTypes.find(a=>a.partName===t||a.extension&&t.endsWith(`.${a.extension}`));e=r?new Blob([e],{type:r.contentType}):e}return this._options.useBase64URL?(function(r){return new Promise((a,s)=>{const o=new FileReader;o.onloadend=()=>a(o.result),o.onerror=()=>s(),o.readAsDataURL(r)})})(e):URL.createObjectURL(e)}findPartByRelId(e,t=null){var s;var r=((s=t.rels)!=null?s:this.rels).find(o=>o.id==e);const a=t?H(t.path)[0]:"";return r?this.partsMap[V(r.target,a)]:null}getPathById(e,t){const r=e.rels.find(s=>s.id==t),[a]=H(e.path);return r?V(r.target,a):null}}function it(n,e){const t=e.replace(/{|}|-/g,""),r=new Array(16);for(let a=0;a<16;a++)r[16-a-1]=parseInt(t.substring(2*a,2*a+2),16);for(let a=0;a<32;a++)n[a]=n[a]^r[a%16];return n}function ct(n,e){return{type:i.BookmarkStart,id:e.attr(n,"id"),name:e.attr(n,"name"),colFirst:e.intAttr(n,"colFirst"),colLast:e.intAttr(n,"colLast")}}function ht(n,e){return{type:i.BookmarkEnd,id:e.attr(n,"id")}}class mt extends E{constructor(){super(...arguments),this.type=i.VmlElement,this.attrs={}}}function ge(n,e){var t=new mt;switch(n.localName){case"rect":t.tagName="rect",Object.assign(t.attrs,{width:"100%",height:"100%"});break;case"oval":t.tagName="ellipse",Object.assign(t.attrs,{cx:"50%",cy:"50%",rx:"50%",ry:"50%"});break;case"line":t.tagName="line";break;case"shape":t.tagName="g";break;case"textbox":t.tagName="foreignObject",Object.assign(t.attrs,{width:"100%",height:"100%"});break;default:return null}for(const r of l.attrs(n))switch(r.localName){case"style":t.cssStyleText=r.value;break;case"fillcolor":t.attrs.fill=r.value;break;case"from":const[a,s]=fe(r.value);Object.assign(t.attrs,{x1:a,y1:s});break;case"to":const[o,c]=fe(r.value);Object.assign(t.attrs,{x2:o,y2:c})}for(const r of l.elements(n))switch(r.localName){case"stroke":Object.assign(t.attrs,ut(r));break;case"fill":Object.assign(t.attrs,pt());break;case"imagedata":t.tagName="image",Object.assign(t.attrs,{width:"100%",height:"100%"}),t.imageHref={id:l.attr(r,"id"),title:l.attr(r,"title")};break;case"txbxContent":t.children.push(...e.parseBodyElements(r));break;default:const a=ge(r,e);a&&t.children.push(a)}return t}function ut(n){var e;return{stroke:l.attr(n,"color"),"stroke-width":(e=l.lengthAttr(n,"weight",C))!=null?e:"1px"}}function pt(n){return{}}function fe(n){return n.split(",")}class dt extends E{constructor(){super(...arguments),this.type=i.Comment}}class gt extends E{constructor(e){super(),this.id=e,this.type=i.CommentReference}}class ft extends E{constructor(e){super(),this.id=e,this.type=i.CommentRangeStart}}class bt extends E{constructor(e){super(),this.id=e,this.type=i.CommentRangeEnd}}var yt="inherit",kt="black",vt="black",wt="transparent";const Pt=[],be={oMath:i.MmlMath,oMathPara:i.MmlMathParagraph,f:i.MmlFraction,func:i.MmlFunction,fName:i.MmlFunctionName,num:i.MmlNumerator,den:i.MmlDenominator,rad:i.MmlRadical,deg:i.MmlDegree,e:i.MmlBase,sSup:i.MmlSuperscript,sSub:i.MmlSubscript,sPre:i.MmlPreSubSuper,sup:i.MmlSuperArgument,sub:i.MmlSubArgument,d:i.MmlDelimiter,nary:i.MmlNary,eqArr:i.MmlEquationArray,lim:i.MmlLimit,limLow:i.MmlLimitLower,m:i.MmlMatrix,mr:i.MmlMatrixRow,box:i.MmlBox,bar:i.MmlBar,groupChr:i.MmlGroupChar};class St{constructor(e){this.options=P({ignoreWidth:!1,debug:!1},e)}parseNotes(e,t,r){var a=[];for(let s of l.elements(e,t)){const o=new r;o.id=l.attr(s,"id"),o.noteType=l.attr(s,"type"),o.children=this.parseBodyElements(s),a.push(o)}return a}parseComments(e){var t=[];for(let r of l.elements(e,"comment")){const a=new dt;a.id=l.attr(r,"id"),a.author=l.attr(r,"author"),a.initials=l.attr(r,"initials"),a.date=l.attr(r,"date"),a.children=this.parseBodyElements(r),t.push(a)}return t}parseDocumentFile(e){var t=l.element(e,"body"),r=l.element(e,"background"),a=l.element(t,"sectPr");return{type:i.Document,children:this.parseBodyElements(t),props:a?ne(a,l):{},cssStyle:r?this.parseBackground(r):{}}}parseBackground(e){var t={},r=R.colorAttr(e,"color");return r&&(t["background-color"]=r),t}parseBodyElements(e){var t=[];for(const r of l.elements(e))switch(r.localName){case"p":t.push(this.parseParagraph(r));break;case"altChunk":t.push(this.parseAltChunk(r));break;case"tbl":t.push(this.parseTable(r));break;case"sdt":t.push(...this.parseSdt(r,a=>this.parseBodyElements(a)))}return t}parseStylesFile(e){var t=[];for(const r of l.elements(e))switch(r.localName){case"style":t.push(this.parseStyle(r));break;case"docDefaults":t.push(this.parseDefaultStyles(r))}return t}parseDefaultStyles(e){var t={id:null,name:null,target:null,basedOn:null,styles:[]};for(const s of l.elements(e))switch(s.localName){case"rPrDefault":var r=l.element(s,"rPr");r&&t.styles.push({target:"span",values:this.parseDefaultProperties(r,{})});break;case"pPrDefault":var a=l.element(s,"pPr");a&&t.styles.push({target:"p",values:this.parseDefaultProperties(a,{})})}return t}parseStyle(e){var t={id:l.attr(e,"styleId"),isDefault:l.boolAttr(e,"default"),name:null,target:null,basedOn:null,styles:[],linked:null};switch(l.attr(e,"type")){case"paragraph":t.target="p";break;case"table":t.target="table";break;case"character":t.target="span"}for(const r of l.elements(e))switch(r.localName){case"basedOn":t.basedOn=l.attr(r,"val");break;case"name":t.name=l.attr(r,"val");break;case"link":t.linked=l.attr(r,"val");break;case"next":t.next=l.attr(r,"val");break;case"aliases":t.aliases=l.attr(r,"val").split(",");break;case"pPr":t.styles.push({target:"p",values:this.parseDefaultProperties(r,{})}),t.paragraphProps=oe(r,l);break;case"rPr":t.styles.push({target:"span",values:this.parseDefaultProperties(r,{})}),t.runProps=J(r,l);break;case"tblPr":case"tcPr":t.styles.push({target:"td",values:this.parseDefaultProperties(r,{})});break;case"tblStylePr":for(let a of this.parseTableStyle(r))t.styles.push(a);break;case"rsid":case"qFormat":case"hidden":case"semiHidden":case"unhideWhenUsed":case"autoRedefine":case"uiPriority":break;default:this.options.debug&&console.warn(`DOCX: Unknown style element: ${r.localName}`)}return t}parseTableStyle(e){var t=[],r="",a="";switch(l.attr(e,"type")){case"firstRow":a=".first-row",r="tr.first-row td";break;case"lastRow":a=".last-row",r="tr.last-row td";break;case"firstCol":a=".first-col",r="td.first-col";break;case"lastCol":a=".last-col",r="td.last-col";break;case"band1Vert":a=":not(.no-vband)",r="td.odd-col";break;case"band2Vert":a=":not(.no-vband)",r="td.even-col";break;case"band1Horz":a=":not(.no-hband)",r="tr.odd-row";break;case"band2Horz":a=":not(.no-hband)",r="tr.even-row";break;default:return[]}for(const s of l.elements(e))switch(s.localName){case"pPr":t.push({target:`${r} p`,mod:a,values:this.parseDefaultProperties(s,{})});break;case"rPr":t.push({target:`${r} span`,mod:a,values:this.parseDefaultProperties(s,{})});break;case"tblPr":case"tcPr":t.push({target:r,mod:a,values:this.parseDefaultProperties(s,{})})}return t}parseNumberingFile(e){const t=[],r=[],a=[];for(const s of l.elements(e))switch(s.localName){case"abstractNum":t.push(...this.parseAbstractNumbering(s,a));break;case"numPicBullet":a.push(this.parseNumberingPicBullet(s));break;case"num":r.push({numId:l.attr(s,"numId"),abstractNumId:l.elementAttr(s,"abstractNumId","val")})}return r.flatMap(s=>t.filter(o=>s.abstractNumId==o.id).map(o=>B(P({},o),{id:s.numId})))}parseNumberingPicBullet(e){var t=l.element(e,"pict"),r=t&&l.element(t,"shape"),a=r&&l.element(r,"imagedata");return a?{id:l.intAttr(e,"numPicBulletId"),src:l.attr(a,"id"),style:l.attr(r,"style")}:null}parseAbstractNumbering(e,t){var r=[],a=l.attr(e,"abstractNumId");for(const s of l.elements(e))s.localName==="lvl"&&r.push(this.parseNumberingLevel(a,s,t));return r}parseNumberingLevel(e,t,r){var a={id:e,level:l.intAttr(t,"ilvl"),start:1,pStyleName:void 0,pStyle:{},rStyle:{},suff:"tab"};for(const o of l.elements(t))switch(o.localName){case"start":a.start=l.intAttr(o,"val");break;case"pPr":this.parseDefaultProperties(o,a.pStyle);break;case"rPr":this.parseDefaultProperties(o,a.rStyle);break;case"lvlPicBulletId":var s=l.intAttr(o,"val");a.bullet=r.find(c=>(c==null?void 0:c.id)==s);break;case"lvlText":a.levelText=l.attr(o,"val");break;case"pStyle":a.pStyleName=l.attr(o,"val");break;case"numFmt":a.format=l.attr(o,"val");break;case"suff":a.suff=l.attr(o,"val")}return a}parseSdt(e,t){const r=l.element(e,"sdtContent");return r?t(r):[]}parseChange(e,t,r){var a,s;return{type:e,children:(s=(a=r(t))==null?void 0:a.children)!=null?s:[],id:l.attr(t,"id"),author:l.attr(t,"author"),date:l.attr(t,"date")}}parseAltChunk(e){return{type:i.AltChunk,children:[],id:l.attr(e,"id")}}parseParagraph(e){var t={type:i.Paragraph,children:[]};for(let r of l.elements(e))switch(r.localName){case"pPr":this.parseParagraphProperties(r,t);break;case"r":t.children.push(this.parseRun(r,t));break;case"hyperlink":t.children.push(this.parseHyperlink(r,t));break;case"smartTag":t.children.push(this.parseSmartTag(r,t));break;case"bookmarkStart":t.children.push(ct(r,l));break;case"bookmarkEnd":t.children.push(ht(r,l));break;case"commentRangeStart":t.children.push(new ft(l.attr(r,"id")));break;case"commentRangeEnd":t.children.push(new bt(l.attr(r,"id")));break;case"oMath":case"oMathPara":t.children.push(this.parseMathElement(r));break;case"sdt":t.children.push(...this.parseSdt(r,a=>this.parseParagraph(a).children));break;case"ins":t.children.push(this.parseChange(i.Inserted,r,a=>this.parseParagraph(a)));break;case"del":t.children.push(this.parseChange(i.Deleted,r,a=>this.parseParagraph(a)))}return t}parseParagraphProperties(e,t){this.parseDefaultProperties(e,t.cssStyle={},null,r=>{if(ie(r,t,l))return!0;switch(r.localName){case"pStyle":t.styleName=l.attr(r,"val");break;case"cnfStyle":t.className=g.classNameOfCnfStyle(r);break;case"framePr":this.parseFrame(r,t);break;case"rPr":break;default:return!1}return!0})}parseFrame(e,t){l.attr(e,"dropCap")=="drop"&&(t.cssStyle.float="left")}parseHyperlink(e,t){var r={type:i.Hyperlink,parent:t,children:[]};r.anchor=l.attr(e,"anchor"),r.id=l.attr(e,"id");for(const a of l.elements(e))a.localName==="r"&&r.children.push(this.parseRun(a,r));return r}parseSmartTag(e,t){var r={type:i.SmartTag,parent:t,children:[]},a=l.attr(e,"uri"),s=l.attr(e,"element");a&&(r.uri=a),s&&(r.element=s);for(const o of l.elements(e))switch(o.localName){case"r":r.children.push(this.parseRun(o,r));break;case"smartTag":r.children.push(this.parseSmartTag(o,r))}return r}parseRun(e,t){var r={type:i.Run,parent:t,children:[]};for(let a of l.elements(e))switch(a=this.checkAlternateContent(a),a==null?void 0:a.localName){case"t":r.children.push({type:i.Text,text:a.textContent});break;case"delText":r.children.push({type:i.DeletedText,text:a.textContent});break;case"commentReference":r.children.push(new gt(l.attr(a,"id")));break;case"fldSimple":r.children.push({type:i.SimpleField,instruction:l.attr(a,"instr"),lock:l.boolAttr(a,"lock",!1),dirty:l.boolAttr(a,"dirty",!1)});break;case"instrText":r.fieldRun=!0,r.children.push({type:i.Instruction,text:a.textContent});break;case"fldChar":r.fieldRun=!0,r.children.push({type:i.ComplexField,charType:l.attr(a,"fldCharType"),lock:l.boolAttr(a,"lock",!1),dirty:l.boolAttr(a,"dirty",!1)});break;case"noBreakHyphen":r.children.push({type:i.NoBreakHyphen});break;case"br":r.children.push({type:i.Break,break:l.attr(a,"type")||"textWrapping"});break;case"lastRenderedPageBreak":r.children.push({type:i.Break,break:"lastRenderedPageBreak"});break;case"sym":r.children.push({type:i.Symbol,font:S(l.attr(a,"font")),char:l.hexAttr(a,"char")});break;case"tab":r.children.push({type:i.Tab});break;case"footnoteReference":r.children.push({type:i.FootnoteReference,id:l.attr(a,"id")});break;case"endnoteReference":r.children.push({type:i.EndnoteReference,id:l.attr(a,"id")});break;case"drawing":let s=this.parseDrawing(a);s&&r.children.push(s);break;case"pict":r.children.push(this.parseVmlPicture(a));break;case"rPr":this.parseRunProperties(a,r)}return r}parseMathElement(e){const t=`${e.localName}Pr`,r={type:be[e.localName],children:[]};for(const s of l.elements(e))if(be[s.localName])r.children.push(this.parseMathElement(s));else if(s.localName=="r"){var a=this.parseRun(s);a.type=i.MmlRun,r.children.push(a)}else s.localName==t&&(r.props=this.parseMathProperies(s));return r}parseMathProperies(e){const t={};for(const r of l.elements(e))switch(r.localName){case"chr":t.char=l.attr(r,"val");break;case"vertJc":t.verticalJustification=l.attr(r,"val");break;case"pos":t.position=l.attr(r,"val");break;case"degHide":t.hideDegree=l.boolAttr(r,"val");break;case"begChr":t.beginChar=l.attr(r,"val");break;case"endChr":t.endChar=l.attr(r,"val")}return t}parseRunProperties(e,t){this.parseDefaultProperties(e,t.cssStyle={},null,r=>{switch(r.localName){case"rStyle":t.styleName=l.attr(r,"val");break;case"vertAlign":t.verticalAlign=g.valueOfVertAlign(r,!0);break;default:return!1}return!0})}parseVmlPicture(e){const t={type:i.VmlPicture,children:[]};for(const r of l.elements(e)){const a=ge(r,this);a&&t.children.push(a)}return t}checkAlternateContent(e){var s;if(e.localName!="AlternateContent")return e;var t=l.element(e,"Choice");if(t){var r=l.attr(t,"Requires"),a=e.lookupNamespaceURI(r);if(Pt.includes(a))return t.firstElementChild}return(s=l.element(e,"Fallback"))==null?void 0:s.firstElementChild}parseDrawing(e){for(var t of l.elements(e))switch(t.localName){case"inline":case"anchor":return this.parseDrawingWrapper(t)}}parseDrawingWrapper(e){var b;var t={type:i.Drawing,children:[],cssStyle:{}},r=e.localName=="anchor";let a=null,s=l.boolAttr(e,"simplePos");l.boolAttr(e,"behindDoc");let o={relative:"page",align:"left",offset:"0"},c={relative:"page",align:"top",offset:"0"};for(var h of l.elements(e))switch(h.localName){case"simplePos":s&&(o.offset=l.lengthAttr(h,"x",C),c.offset=l.lengthAttr(h,"y",C));break;case"extent":t.cssStyle.width=l.lengthAttr(h,"cx",C),t.cssStyle.height=l.lengthAttr(h,"cy",C);break;case"positionH":case"positionV":if(!s){let w=h.localName=="positionH"?o:c;var m=l.element(h,"align"),p=l.element(h,"posOffset");w.relative=(b=l.attr(h,"relativeFrom"))!=null?b:w.relative,m&&(w.align=m.textContent),p&&(w.offset=te(p.textContent,C))}break;case"wrapTopAndBottom":a="wrapTopAndBottom";break;case"wrapNone":a="wrapNone";break;case"graphic":var y=this.parseGraphic(h);y&&t.children.push(y)}return a=="wrapTopAndBottom"?(t.cssStyle.display="block",o.align&&(t.cssStyle["text-align"]=o.align,t.cssStyle.width="100%")):a=="wrapNone"?(t.cssStyle.display="block",t.cssStyle.position="relative",t.cssStyle.width="0px",t.cssStyle.height="0px",o.offset&&(t.cssStyle.left=o.offset),c.offset&&(t.cssStyle.top=c.offset)):!r||o.align!="left"&&o.align!="right"||(t.cssStyle.float=o.align),t}parseGraphic(e){var t=l.element(e,"graphicData");for(let r of l.elements(t))if(r.localName==="pic")return this.parsePicture(r);return null}parsePicture(e){var t={type:i.Image,src:"",cssStyle:{}},r=l.element(e,"blipFill"),a=l.element(r,"blip"),s=l.element(r,"srcRect");t.src=l.attr(a,"embed"),s&&(t.srcRect=[l.intAttr(s,"l",0)/1e5,l.intAttr(s,"t",0)/1e5,l.intAttr(s,"r",0)/1e5,l.intAttr(s,"b",0)/1e5]);var o=l.element(e,"spPr"),c=l.element(o,"xfrm");if(t.cssStyle.position="relative",c)for(var h of(t.rotation=l.intAttr(c,"rot",0)/6e4,l.elements(c)))switch(h.localName){case"ext":t.cssStyle.width=l.lengthAttr(h,"cx",C),t.cssStyle.height=l.lengthAttr(h,"cy",C);break;case"off":t.cssStyle.left=l.lengthAttr(h,"x",C),t.cssStyle.top=l.lengthAttr(h,"y",C)}return t}parseTable(e){var t={type:i.Table,children:[]};for(const r of l.elements(e))switch(r.localName){case"tr":t.children.push(this.parseTableRow(r));break;case"tblGrid":t.columns=this.parseTableColumns(r);break;case"tblPr":this.parseTableProperties(r,t)}return t}parseTableColumns(e){var t=[];for(const r of l.elements(e))r.localName==="gridCol"&&t.push({width:l.lengthAttr(r,"w")});return t}parseTableProperties(e,t){switch(t.cssStyle={},t.cellStyle={},this.parseDefaultProperties(e,t.cssStyle,t.cellStyle,r=>{switch(r.localName){case"tblStyle":t.styleName=l.attr(r,"val");break;case"tblLook":t.className=g.classNameOftblLook(r);break;case"tblpPr":this.parseTablePosition(r,t);break;case"tblStyleColBandSize":t.colBandSize=l.intAttr(r,"val");break;case"tblStyleRowBandSize":t.rowBandSize=l.intAttr(r,"val");break;case"hidden":t.cssStyle.display="none";break;default:return!1}return!0}),t.cssStyle["text-align"]){case"center":delete t.cssStyle["text-align"],t.cssStyle["margin-left"]="auto",t.cssStyle["margin-right"]="auto";break;case"right":delete t.cssStyle["text-align"],t.cssStyle["margin-left"]="auto"}}parseTablePosition(e,t){var r=l.lengthAttr(e,"topFromText"),a=l.lengthAttr(e,"bottomFromText"),s=l.lengthAttr(e,"rightFromText"),o=l.lengthAttr(e,"leftFromText");t.cssStyle.float="left",t.cssStyle["margin-bottom"]=g.addSize(t.cssStyle["margin-bottom"],a),t.cssStyle["margin-left"]=g.addSize(t.cssStyle["margin-left"],o),t.cssStyle["margin-right"]=g.addSize(t.cssStyle["margin-right"],s),t.cssStyle["margin-top"]=g.addSize(t.cssStyle["margin-top"],r)}parseTableRow(e){var t={type:i.Row,children:[]};for(const r of l.elements(e))switch(r.localName){case"tc":t.children.push(this.parseTableCell(r));break;case"trPr":case"tblPrEx":this.parseTableRowProperties(r,t)}return t}parseTableRowProperties(e,t){t.cssStyle=this.parseDefaultProperties(e,{},null,r=>{switch(r.localName){case"cnfStyle":t.className=g.classNameOfCnfStyle(r);break;case"tblHeader":t.isHeader=l.boolAttr(r,"val");break;case"gridBefore":t.gridBefore=l.intAttr(r,"val");break;case"gridAfter":t.gridAfter=l.intAttr(r,"val");break;default:return!1}return!0})}parseTableCell(e){var t={type:i.Cell,children:[]};for(const r of l.elements(e))switch(r.localName){case"tbl":t.children.push(this.parseTable(r));break;case"p":t.children.push(this.parseParagraph(r));break;case"tcPr":this.parseTableCellProperties(r,t)}return t}parseTableCellProperties(e,t){t.cssStyle=this.parseDefaultProperties(e,{},null,r=>{var a;switch(r.localName){case"gridSpan":t.span=l.intAttr(r,"val",null);break;case"vMerge":t.verticalMerge=(a=l.attr(r,"val"))!=null?a:"continue";break;case"cnfStyle":t.className=g.classNameOfCnfStyle(r);break;default:return!1}return!0}),this.parseTableCellVerticalText(e,t)}parseTableCellVerticalText(e,t){const r={btLr:{writingMode:"vertical-rl",transform:"rotate(180deg)"},lrTb:{writingMode:"vertical-lr",transform:"none"},tbRl:{writingMode:"vertical-rl",transform:"none"}};for(const a of l.elements(e))if(a.localName==="textDirection"){const s=r[l.attr(a,"val")]||{writingMode:"horizontal-tb"};t.cssStyle["writing-mode"]=s.writingMode,t.cssStyle.transform=s.transform}}parseDefaultProperties(e,t=null,r=null,a=null){t=t||{};for(const s of l.elements(e))if(!(a!=null&&a(s)))switch(s.localName){case"jc":t["text-align"]=g.valueOfJc(s);break;case"textAlignment":t["vertical-align"]=g.valueOfTextAlignment(s);break;case"color":t.color=R.colorAttr(s,"val",null,kt);break;case"sz":t["font-size"]=t["min-height"]=l.lengthAttr(s,"val",U);break;case"shd":t["background-color"]=R.colorAttr(s,"fill",null,yt);break;case"highlight":t["background-color"]=R.colorAttr(s,"val",null,wt);break;case"vertAlign":break;case"position":t.verticalAlign=l.lengthAttr(s,"val",U);break;case"tcW":if(this.options.ignoreWidth)break;case"tblW":t.width=g.valueOfSize(s,"w");break;case"trHeight":this.parseTrHeight(s,t);break;case"strike":t["text-decoration"]=l.boolAttr(s,"val",!0)?"line-through":"none";break;case"b":t["font-weight"]=l.boolAttr(s,"val",!0)?"bold":"normal";break;case"i":t["font-style"]=l.boolAttr(s,"val",!0)?"italic":"normal";break;case"caps":t["text-transform"]=l.boolAttr(s,"val",!0)?"uppercase":"none";break;case"smallCaps":t["font-variant"]=l.boolAttr(s,"val",!0)?"small-caps":"none";break;case"u":this.parseUnderline(s,t);break;case"ind":case"tblInd":this.parseIndentation(s,t);break;case"rFonts":this.parseFont(s,t);break;case"tblBorders":this.parseBorderProperties(s,r||t);break;case"tblCellSpacing":t["border-spacing"]=g.valueOfMargin(s),t["border-collapse"]="separate";break;case"pBdr":this.parseBorderProperties(s,t);break;case"bdr":t.border=g.valueOfBorder(s);break;case"tcBorders":this.parseBorderProperties(s,t);break;case"vanish":l.boolAttr(s,"val",!0)&&(t.display="none");break;case"kern":case"noWrap":break;case"tblCellMar":case"tcMar":this.parseMarginProperties(s,r||t);break;case"tblLayout":t["table-layout"]=g.valueOfTblLayout(s);break;case"vAlign":t["vertical-align"]=g.valueOfTextAlignment(s);break;case"spacing":e.localName=="pPr"&&this.parseSpacing(s,t);break;case"wordWrap":l.boolAttr(s,"val")&&(t["overflow-wrap"]="break-word");break;case"suppressAutoHyphens":t.hyphens=l.boolAttr(s,"val",!0)?"none":"auto";break;case"lang":t.$lang=l.attr(s,"val");break;case"rtl":case"bidi":l.boolAttr(s,"val",!0)&&(t.direction="rtl");break;case"bCs":case"iCs":case"szCs":case"tabs":case"outlineLvl":case"contextualSpacing":case"tblStyleColBandSize":case"tblStyleRowBandSize":case"webHidden":case"pageBreakBefore":case"suppressLineNumbers":case"keepLines":case"keepNext":case"widowControl":case"noProof":break;default:this.options.debug&&console.warn(`DOCX: Unknown document element: ${e.localName}.${s.localName}`)}return t}parseUnderline(e,t){var r=l.attr(e,"val");if(r!=null){switch(r){case"dash":case"dashDotDotHeavy":case"dashDotHeavy":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dotDotDash":t["text-decoration"]="underline dashed";break;case"dotted":case"dottedHeavy":t["text-decoration"]="underline dotted";break;case"double":t["text-decoration"]="underline double";break;case"single":case"thick":case"words":t["text-decoration"]="underline";break;case"wave":case"wavyDouble":case"wavyHeavy":t["text-decoration"]="underline wavy";break;case"none":t["text-decoration"]="none"}var a=R.colorAttr(e,"color");a&&(t["text-decoration-color"]=a)}}parseFont(e,t){var r=[l.attr(e,"ascii"),g.themeValue(e,"asciiTheme"),l.attr(e,"eastAsia")].filter(a=>a).map(a=>S(a));r.length>0&&(t["font-family"]=[...new Set(r)].join(", "))}parseIndentation(e,t){var r=l.lengthAttr(e,"firstLine"),a=l.lengthAttr(e,"hanging"),s=l.lengthAttr(e,"left"),o=l.lengthAttr(e,"start"),c=l.lengthAttr(e,"right"),h=l.lengthAttr(e,"end");r&&(t["text-indent"]=r),a&&(t["text-indent"]=`-${a}`),(s||o)&&(t["margin-inline-start"]=s||o),(c||h)&&(t["margin-inline-end"]=c||h)}parseSpacing(e,t){var r=l.lengthAttr(e,"before"),a=l.lengthAttr(e,"after"),s=l.intAttr(e,"line",null),o=l.attr(e,"lineRule");if(r&&(t["margin-top"]=r),a&&(t["margin-bottom"]=a),s!==null)switch(o){case"auto":t["line-height"]=`${(s/240).toFixed(2)}`;break;case"atLeast":t["line-height"]=`calc(100% + ${s/20}pt)`;break;default:t["line-height"]=t["min-height"]=s/20+"pt"}}parseMarginProperties(e,t){for(const r of l.elements(e))switch(r.localName){case"left":t["padding-left"]=g.valueOfMargin(r);break;case"right":t["padding-right"]=g.valueOfMargin(r);break;case"top":t["padding-top"]=g.valueOfMargin(r);break;case"bottom":t["padding-bottom"]=g.valueOfMargin(r)}}parseTrHeight(e,t){l.attr(e,"hRule"),t.height=l.lengthAttr(e,"val")}parseBorderProperties(e,t){for(const r of l.elements(e))switch(r.localName){case"start":case"left":t["border-left"]=g.valueOfBorder(r);break;case"end":case"right":t["border-right"]=g.valueOfBorder(r);break;case"top":t["border-top"]=g.valueOfBorder(r);break;case"bottom":t["border-bottom"]=g.valueOfBorder(r)}}}const Mt=["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","none","red","white","yellow"];class R{static colorAttr(e,t,r=null,a="black"){var s=l.attr(e,t);if(s)return s=="auto"?a:Mt.includes(s)?s:`#${s}`;var o=l.attr(e,"themeColor");return o?`var(--docx-${o}-color)`:r}}class g{static themeValue(e,t){var r=l.attr(e,t);return r?`var(--docx-${r}-font)`:null}static valueOfSize(e,t){var r=G;switch(l.attr(e,"type")){case"dxa":break;case"pct":r=Ce;break;case"auto":return"auto"}return l.lengthAttr(e,t,r)}static valueOfMargin(e){return l.lengthAttr(e,"w")}static valueOfBorder(e){var t=g.parseBorderType(l.attr(e,"val"));if(t=="none")return"none";var r=R.colorAttr(e,"color");return`${l.lengthAttr(e,"sz",ee)} ${t} ${r=="auto"?vt:r}`}static parseBorderType(e){switch(e){case"single":case"dashDotStroked":case"thick":case"thickThinLargeGap":case"thickThinMediumGap":case"thickThinSmallGap":case"thinThickLargeGap":case"thinThickMediumGap":case"thinThickSmallGap":case"thinThickThinLargeGap":case"thinThickThinMediumGap":case"thinThickThinSmallGap":case"threeDEmboss":case"threeDEngrave":case"wave":return"solid";case"dashed":case"dashSmallGap":return"dashed";case"dotDash":case"dotDotDash":case"dotted":return"dotted";case"double":case"doubleWave":case"triple":return"double";case"inset":return"inset";case"nil":case"none":return"none";case"outset":return"outset"}return"solid"}static valueOfTblLayout(e){return l.attr(e,"val")=="fixed"?"fixed":"auto"}static classNameOfCnfStyle(e){const t=l.attr(e,"val"),r=["first-row","last-row","first-col","last-col","odd-col","even-col","odd-row","even-row","ne-cell","nw-cell","se-cell","sw-cell"];if(t)return r.filter((s,o)=>t[o]=="1").join(" ");const a=["firstRow","lastRow","firstColumn","lastColumn","oddVBand","evenVBand","oddHBand","evenHBand","firstRowLastColumn","firstRowFirstColumn","lastRowLastColumn","lastRowFirstColumn"];return r.filter((s,o)=>l.boolAttr(e,a[o])).join(" ")}static valueOfJc(e){var t=l.attr(e,"val");switch(t){case"start":case"left":return"left";case"center":return"center";case"end":case"right":return"right";case"both":return"justify"}return t}static valueOfVertAlign(e,t=!1){var r=l.attr(e,"val");switch(r){case"subscript":return"sub";case"superscript":return t?"sup":"super"}return t?null:r}static valueOfTextAlignment(e){var t=l.attr(e,"val");switch(t){case"auto":case"baseline":return"baseline";case"top":return"top";case"center":return"middle";case"bottom":return"bottom"}return t}static addSize(e,t){return e==null?t:t==null?e:`calc(${e} + ${t})`}static classNameOftblLook(e){const t=l.hexAttr(e,"val",0);let r="";return(l.boolAttr(e,"firstRow")||32&t)&&(r+=" first-row"),(l.boolAttr(e,"lastRow")||64&t)&&(r+=" last-row"),(l.boolAttr(e,"firstColumn")||128&t)&&(r+=" first-col"),(l.boolAttr(e,"lastColumn")||256&t)&&(r+=" last-col"),(l.boolAttr(e,"noHBand")||512&t)&&(r+=" no-hband"),(l.boolAttr(e,"noVBand")||1024&t)&&(r+=" no-vband"),r.trim()}}const ye={pos:0,leader:"none",style:"left"};function xt(n,e,t,r=.75){const a=n.closest("p"),s=n.getBoundingClientRect(),o=a.getBoundingClientRect(),c=getComputedStyle(a),h=(e==null?void 0:e.length)>0?e.map(N=>({pos:ke(N.position),leader:N.leader,style:N.style})).sort((N,_)=>N.pos-_.pos):[ye],m=h[h.length-1],p=o.width*r,y=ke(t);let b=m.pos+y;if(bN.style!="clear"&&N.pos>T);if(x==null)return;let F=1;if(x.style=="right"||x.style=="center"){const N=Array.from(a.querySelectorAll(`.${n.className}`)),_=N.indexOf(n)+1,j=document.createRange();j.setStart(n,1),_m.appendChild($(p))),m}if(t==="#comment")return document.createComment(s?s[0]:"");const c=e?document.createElementNS(e,t):document.createElement(t);if(r&&c.setAttribute("class",r),a&&(X(a)?c.setAttribute("style",a):Object.assign(c.style,a)),o)for(const[m,p]of Object.entries(o))p!==void 0&&(c[m]=p);return s&&s.forEach(m=>c.appendChild($(m))),c}(function(n){n.html="http://www.w3.org/1999/xhtml",n.svg="http://www.w3.org/2000/svg",n.mathML="http://www.w3.org/1998/Math/MathML"})(d||(d={}));class Nt{constructor(){this.className="docx",this.styleMap={},this.currentPart=null,this.tableVerticalMerges=[],this.currentVerticalMerge=null,this.tableCellPositions=[],this.currentCellPosition=null,this.footnoteMap={},this.endnoteMap={},this.currentEndnoteIds=[],this.usedHederFooterParts=[],this.currentTabs=[],this.commentMap={},this.tasks=[],this.postRenderTasks=[],this.h=$}async render(e,t){var s,o;this.document=e,this.options=t,this.className=t.className,this.rootSelector=t.inWrapper?`.${this.className}-wrapper`:":root",this.h=(s=t.h)!=null?s:$,this.styleMap=null,this.tasks=[],this.options.renderComments&&globalThis.Highlight&&(this.commentHighlight=new Highlight);const r=[...this.renderDefaultStyle()];e.themePart&&r.push(...this.renderTheme(e.themePart)),e.stylesPart!=null&&(this.styleMap=this.processStyles(e.stylesPart.styles),r.push(...this.renderStyles(e.stylesPart.styles))),e.numberingPart&&(this.prodessNumberings(e.numberingPart.domNumberings),r.push(...await this.renderNumbering(e.numberingPart.domNumberings))),e.footnotesPart&&(this.footnoteMap=A(e.footnotesPart.notes,c=>c.id)),e.endnotesPart&&(this.endnoteMap=A(e.endnotesPart.notes,c=>c.id)),e.settingsPart&&(this.defaultTabSize=(o=e.settingsPart.settings)==null?void 0:o.defaultTabStop),!t.ignoreFonts&&e.fontTablePart&&r.push(...await this.renderFontTable(e.fontTablePart));var a=this.renderSections(e.documentPart.body);return this.options.inWrapper?r.push(this.renderWrapper(a)):r.push(...a),this.commentHighlight&&t.renderComments&&CSS.highlights.set(`${this.className}-comments`,this.commentHighlight),this.postRenderTasks.forEach(c=>c()),await Promise.allSettled(this.tasks),this.refreshTabStops(),r}renderTheme(e){var o,c;const t={},r=(o=e.theme)==null?void 0:o.fontScheme;r&&(r.majorFont&&(t["--docx-majorHAnsi-font"]=r.majorFont.latinTypeface),r.minorFont&&(t["--docx-minorHAnsi-font"]=r.minorFont.latinTypeface));const a=(c=e.theme)==null?void 0:c.colorScheme;if(a)for(let[h,m]of Object.entries(a.colors))t[`--docx-${h}-color`]=`#${m}`;const s=this.styleToString(`.${this.className}`,t);return[this.h({tagName:"#comment",children:["docxjs document theme values"]}),this.h({tagName:"style",children:[s]})]}async renderFontTable(e){const t=[];for(let r of e.fonts)for(let a of r.embedFontRefs)try{const s=await this.document.loadFont(a.id,a.key),o={"font-family":S(r.name),src:`url(${s})`};a.type!="bold"&&a.type!="boldItalic"||(o["font-weight"]="bold"),a.type!="italic"&&a.type!="boldItalic"||(o["font-style"]="italic"),t.push(this.h({tagName:"#comment",children:[`docxjs ${r.name} font`]})),t.push(this.h({tagName:"style",children:[this.styleToString("@font-face",o)]}))}catch(s){this.options.debug&&console.warn(`Can't load font with id ${a.id} and key ${a.key}`)}return t}processStyleName(e){return e?`${this.className}_${(function(t){return t==null?void 0:t.replace(/[ .]+/g,"-").replace(/[&]+/g,"and").toLowerCase()})(e)}`:this.className}processStyles(e){const t=A(e.filter(a=>a.id!=null),a=>a.id);for(const a of e.filter(s=>s.basedOn)){var r=t[a.basedOn];if(r){a.paragraphProps=I(a.paragraphProps,r.paragraphProps),a.runProps=I(a.runProps,r.runProps);for(const s of r.styles){const o=a.styles.find(c=>c.target==s.target);o?this.copyStyleProperties(s.values,o.values):a.styles.push(B(P({},s),{values:P({},s.values)}))}}else this.options.debug&&console.warn(`Can't find base style ${a.basedOn}`)}for(let a of e)a.cssName=this.processStyleName(a.id);return t}prodessNumberings(e){var t;for(let r of e.filter(a=>a.pStyleName)){const a=this.findStyle(r.pStyleName);(t=a==null?void 0:a.paragraphProps)!=null&&t.numbering&&(a.paragraphProps.numbering.level=r.level)}}processElement(e){if(e.children)for(var t of e.children)t.parent=e,t.type==i.Table?this.processTable(t):this.processElement(t)}processTable(e){for(var t of e.children)for(var r of t.children)r.cssStyle=this.copyStyleProperties(e.cellStyle,r.cssStyle,["border-left","border-right","border-top","border-bottom","padding-left","padding-right","padding-top","padding-bottom"]),this.processElement(r)}copyStyleProperties(e,t,r=null){if(!e)return t;for(var a of(t==null&&(t={}),r==null&&(r=Object.getOwnPropertyNames(e)),r))e.hasOwnProperty(a)&&!t.hasOwnProperty(a)&&(t[a]=e[a]);return t}createPageElement(e,t,r){const a=P({},r);return t&&(t.pageMargins&&(a.paddingLeft=t.pageMargins.left,a.paddingRight=t.pageMargins.right,a.paddingTop=t.pageMargins.top,a.paddingBottom=t.pageMargins.bottom),t.pageSize&&(this.options.ignoreWidth||(a.width=t.pageSize.width),this.options.ignoreHeight||(a.minHeight=t.pageSize.height))),this.h({tagName:"section",className:e,style:a})}createSectionContent(e){const t={};return e.columns&&e.columns.numberOfColumns&&(t.columnCount=`${e.columns.numberOfColumns}`,t.columnGap=e.columns.space,e.columns.separator&&(t.columnRule="1px solid black")),this.h({tagName:"article",style:t})}renderSections(e){const t=[];this.processElement(e);const r=this.splitBySection(e.children,e.props),a=this.groupByPageBreaks(r);let s=null;for(let c=0,h=a.length;ck.type=="first"):null)!=null?b:r%2==1&&o?e.find(k=>k.type=="even"):null)!=null?w:e.find(k=>k.type=="default"),h=c&&this.document.findPartByRelId(c.id,this.document.documentPart);if(h){this.currentPart=h,this.usedHederFooterParts.includes(h.path)||(this.processElement(h.rootElement),this.usedHederFooterParts.push(h.path));const[k]=this.renderElements([h.rootElement],s);t!=null&&t.pageMargins&&(h.rootElement.type===i.Header?(k.style.marginTop=`calc(${t.pageMargins.header} - ${t.pageMargins.top})`,k.style.minHeight=`calc(${t.pageMargins.top} - ${t.pageMargins.header})`):h.rootElement.type===i.Footer&&(k.style.marginBottom=`calc(${t.pageMargins.footer} - ${t.pageMargins.bottom})`,k.style.minHeight=`calc(${t.pageMargins.bottom} - ${t.pageMargins.footer})`)),this.currentPart=null}}isPageBreakElement(e){return e.type==i.Break&&(e.break=="lastRenderedPageBreak"?!this.options.ignoreLastRenderedPageBreak:e.break=="page")}isPageBreakSection(e,t){var r,a,s,o,c,h;return!!e&&!!t&&(((r=e.pageSize)==null?void 0:r.orientation)!=((a=t.pageSize)==null?void 0:a.orientation)||((s=e.pageSize)==null?void 0:s.width)!=((o=t.pageSize)==null?void 0:o.width)||((c=e.pageSize)==null?void 0:c.height)!=((h=t.pageSize)==null?void 0:h.height))}splitBySection(e,t){var y;var r={sectProps:null,elements:[],pageBreak:!1},a=[r];for(let b of e){if(b.type==i.Paragraph){const w=b,k=this.findStyle(w.styleName);(w.pageBreakBefore||(y=k==null?void 0:k.paragraphProps)!=null&&y.pageBreakBefore)&&(r.sectProps=s,r.pageBreak=!0,r={sectProps:null,elements:[],pageBreak:!1},a.push(r))}if(r.elements.push(b),b.type==i.Paragraph){const w=b;var s=w.sectionProps,o=-1,c=-1;if(this.options.breakPages&&w.children&&(o=w.children.findIndex(k=>{var T,x;return(c=(x=(T=k.children)==null?void 0:T.findIndex(this.isPageBreakElement.bind(this)))!=null?x:-1)!=-1})),(s||o!=-1)&&(r.sectProps=s,r.pageBreak=o!=-1,r={sectProps:null,elements:[],pageBreak:!1},a.push(r)),o!=-1){let k=w.children[o],T=c=0;b--)a[b].sectProps==null?a[b].sectProps=p!=null?p:t:p=a[b].sectProps;return a}groupByPageBreaks(e){let t,r=[];const a=[r];for(let s of e)r.push(s),(this.options.ignoreLastRenderedPageBreak||s.pageBreak||this.isPageBreakSection(t,s.sectProps))&&a.push(r=[]),t=s.sectProps;return a.filter(s=>s.length>0)}renderWrapper(e){return this.h({tagName:"div",className:`${this.className}-wrapper`,children:e})}renderDefaultStyle(){var e=this.className,t=` +.${e}-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; } +.${e}-wrapper>section.${e} { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }`;this.options.hideWrapperOnPrint&&(t=`@media not print { ${t} }`);var r=`${t} +.${e} { color: black; hyphens: auto; text-underline-position: from-font; } +section.${e} { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; } +section.${e}>article { margin-bottom: auto; z-index: 1; } +section.${e}>footer { z-index: 1; } +.${e} table { border-collapse: collapse; } +.${e} table td, .${e} table th { vertical-align: top; } +.${e} p { margin: 0pt; min-height: 1em; } +.${e} span { white-space: pre-wrap; overflow-wrap: break-word; } +.${e} a { color: inherit; text-decoration: inherit; } +.${e} svg { fill: transparent; } +`;return this.options.renderComments&&(r+=` +.${e}-comment-ref { cursor: default; } +.${e}-comment-popover { display: none; z-index: 1000; padding: 0.5rem; background: white; position: absolute; box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.25); width: 30ch; } +.${e}-comment-ref:hover~.${e}-comment-popover { display: block; } +.${e}-comment-author,.${e}-comment-date { font-size: 0.875rem; color: #888; } +`),[this.h({tagName:"#comment",children:["docxjs library predefined styles"]}),this.h({tagName:"style",children:[r]})]}async renderNumbering(e){var t="",r=[];for(var a of e){var s=`p.${this.numberingClass(a.id,a.level)}`,o="none";if(a.bullet){let c=`--${this.className}-${a.bullet.src}`.toLowerCase();t+=this.styleToString(`${s}:before`,{content:"' '",display:"inline-block",background:`var(${c})`},a.bullet.style);try{const h=await this.document.loadNumberingImage(a.bullet.src);t+=`${this.rootSelector} { ${c}: url(${h}) }`}catch(h){this.options.debug&&console.warn(`Can't load numbering image with src ${a.bullet.src}`)}}else if(a.levelText){let c=this.numberingCounter(a.id,a.level);const h=c+" "+(a.start-1);a.level>0&&(t+=this.styleToString(`p.${this.numberingClass(a.id,a.level-1)}`,{"counter-set":h})),r.push(h),t+=this.styleToString(`${s}:before`,P({content:this.levelTextToContent(a.levelText,a.suff,a.id,this.numFormatToCssValue(a.format)),"counter-increment":c},a.rStyle))}else o=this.numFormatToCssValue(a.format);t+=this.styleToString(s,P({display:"list-item","list-style-position":"inside","list-style-type":o},a.pStyle))}return r.length>0&&(t+=this.styleToString(this.rootSelector,{"counter-reset":r.join(" ")})),[this.h({tagName:"#comment",children:["docxjs document numbering styles"]}),this.h({tagName:"style",children:[t]})]}renderStyles(e){var h;var t="";const r=this.styleMap,a=A(e.filter(m=>m.isDefault),m=>m.target);for(const m of e){var s=m.styles;if(m.linked){var o=m.linked&&r[m.linked];o?s=s.concat(o.styles):this.options.debug&&console.warn(`Can't find linked style ${m.linked}`)}for(const p of s){var c=`${(h=m.target)!=null?h:""}.${m.cssName}`;m.target!=p.target&&(c+=` ${p.target}`),a[m.target]==m&&(c=`.${this.className} ${m.target}, `+c),t+=this.styleToString(c,p.values)}}return[this.h({tagName:"#comment",children:["docxjs document styles"]}),this.h({tagName:"style",children:[t]})]}renderNotes(e,t){var r=e.map(a=>t[a]).filter(a=>a);if(r.length>0)return this.h({tagName:"ol",children:this.renderElements(r)})}renderElement(e){switch(e.type){case i.Paragraph:return this.renderParagraph(e);case i.BookmarkStart:return this.renderBookmarkStart(e);case i.BookmarkEnd:return null;case i.Run:return this.renderRun(e);case i.Table:return this.renderTable(e);case i.Row:return this.renderTableRow(e);case i.Cell:return this.renderTableCell(e);case i.Hyperlink:return this.renderHyperlink(e);case i.SmartTag:return this.renderSmartTag(e);case i.Drawing:return this.renderDrawing(e);case i.Image:return this.renderImage(e);case i.Text:case i.Text:return this.renderText(e);case i.DeletedText:return this.renderDeletedText(e);case i.Tab:return this.renderTab(e);case i.Symbol:return this.renderSymbol(e);case i.Break:return this.renderBreak(e);case i.Footer:return this.renderContainer(e,"footer");case i.Header:return this.renderContainer(e,"header");case i.Footnote:case i.Endnote:return this.renderContainer(e,"li");case i.FootnoteReference:return this.renderFootnoteReference(e);case i.EndnoteReference:return this.renderEndnoteReference(e);case i.NoBreakHyphen:return this.h({tagName:"wbr"});case i.VmlPicture:return this.renderVmlPicture(e);case i.VmlElement:return this.renderVmlElement(e);case i.MmlMath:return this.renderContainerNS(e,d.mathML,"math",{xmlns:d.mathML});case i.MmlMathParagraph:return this.renderContainer(e,"span");case i.MmlFraction:return this.renderContainerNS(e,d.mathML,"mfrac");case i.MmlBase:return this.renderContainerNS(e,d.mathML,e.parent.type==i.MmlMatrixRow?"mtd":"mrow");case i.MmlNumerator:case i.MmlDenominator:case i.MmlFunction:case i.MmlLimit:case i.MmlBox:return this.renderContainerNS(e,d.mathML,"mrow");case i.MmlGroupChar:return this.renderMmlGroupChar(e);case i.MmlLimitLower:return this.renderContainerNS(e,d.mathML,"munder");case i.MmlMatrix:return this.renderContainerNS(e,d.mathML,"mtable");case i.MmlMatrixRow:return this.renderContainerNS(e,d.mathML,"mtr");case i.MmlRadical:return this.renderMmlRadical(e);case i.MmlSuperscript:return this.renderContainerNS(e,d.mathML,"msup");case i.MmlSubscript:return this.renderContainerNS(e,d.mathML,"msub");case i.MmlDegree:case i.MmlSuperArgument:case i.MmlSubArgument:return this.renderContainerNS(e,d.mathML,"mn");case i.MmlFunctionName:return this.renderContainerNS(e,d.mathML,"ms");case i.MmlDelimiter:return this.renderMmlDelimiter(e);case i.MmlRun:return this.renderMmlRun(e);case i.MmlNary:return this.renderMmlNary(e);case i.MmlPreSubSuper:return this.renderMmlPreSubSuper(e);case i.MmlBar:return this.renderMmlBar(e);case i.MmlEquationArray:return this.renderMllList(e);case i.Inserted:return this.renderInserted(e);case i.Deleted:return this.renderDeleted(e);case i.CommentRangeStart:return this.renderCommentRangeStart(e);case i.CommentRangeEnd:return this.renderCommentRangeEnd(e);case i.CommentReference:return this.renderCommentReference(e);case i.AltChunk:return this.renderAltChunk(e)}return null}renderElements(e,t){if(e==null)return null;var r=e.flatMap(a=>this.renderElement(a)).filter(a=>a!=null);return t&&r.forEach(a=>t.appendChild(X(a)?document.createTextNode(a):a)),r}renderContainer(e,t,r){return this.h(P({tagName:t,children:this.renderElements(e.children)},r))}renderContainerNS(e,t,r,a){return this.h(P({ns:t,tagName:r,children:this.renderElements(e.children)},a))}renderParagraph(e){var s,o,c,h;var t=this.toHTML(e,d.html,"p");const r=this.findStyle(e.styleName);(o=e.tabs)!=null||(e.tabs=(s=r==null?void 0:r.paragraphProps)==null?void 0:s.tabs);const a=(h=e.numbering)!=null?h:(c=r==null?void 0:r.paragraphProps)==null?void 0:c.numbering;return a&&t.classList.add(this.numberingClass(a.id,a.level)),t}renderHyperlink(e){var r;const t=this.toH(e,d.html,"a");if(t.href="",e.id){const a=this.document.documentPart.rels.find(s=>s.id==e.id&&s.targetMode==="External");t.href=(r=a==null?void 0:a.target)!=null?r:t.href}return e.anchor&&(t.href+=`#${e.anchor}`),this.h(t)}renderSmartTag(e){return this.renderContainer(e,"span")}renderCommentRangeStart(e){var a;if(!this.options.renderComments)return null;const t=new Range;(a=this.commentHighlight)==null||a.add(t);const r=this.h({tagName:"#comment",children:[`start of comment #${e.id}`]});return this.later(()=>t.setStart(r,0)),this.commentMap[e.id]=t,r}renderCommentRangeEnd(e){if(!this.options.renderComments)return null;const t=this.commentMap[e.id],r=this.h({tagName:"#comment",children:[`end of comment #${e.id}`]});return this.later(()=>t==null?void 0:t.setEnd(r,0)),r}renderCommentReference(e){var s;if(!this.options.renderComments)return null;var t=(s=this.document.commentsPart)==null?void 0:s.commentMap[e.id];if(!t)return null;const r=this.h({tagName:"span",className:`${this.className}-comment-ref`,children:["\u{1F4AC}"]}),a=this.h({tagName:"div",className:`${this.className}-comment-popover`,children:[this.h({tagName:"div",className:`${this.className}-comment-author`,children:[t.author]}),this.h({tagName:"div",className:`${this.className}-comment-date`,children:[new Date(t.date).toLocaleString()]}),...this.renderElements(t.children)]});return this.h({tagName:"#fragment",children:[this.h({tagName:"#comment",children:[`comment #${t.id} by ${t.author} on ${t.date}`]}),r,a]})}renderAltChunk(e){if(!this.options.renderAltChunks)return null;var t=this.h({tagName:"iframe"});return this.tasks.push(this.document.loadAltChunk(e.id,this.currentPart).then(r=>{t.srcdoc=r})),t}renderDrawing(e){var t=this.toHTML(e,d.html,"div");return t.style.display="inline-block",t.style.position="relative",t.style.textIndent="0px",t}renderImage(e){var h;let t=this.toHTML(e,d.html,"img",[]),r=(h=e.cssStyle)==null?void 0:h.transform;if(e.srcRect&&e.srcRect.some(m=>m!=0)){var[a,s,o,c]=e.srcRect;r=`scale(${1/(1-a-o)}, ${1/(1-s-c)})`,t.style["clip-path"]=`rect(${(100*s).toFixed(2)}% ${(100*(1-o)).toFixed(2)}% ${(100*(1-c)).toFixed(2)}% ${(100*a).toFixed(2)}%)`}return e.rotation&&(r=`rotate(${e.rotation}deg) ${r!=null?r:""}`),t.style.transform=r==null?void 0:r.trim(),this.document&&this.tasks.push(this.document.loadDocumentImage(e.src,this.currentPart).then(m=>{t.src=m})),t}renderText(e){return this.h(e.text)}renderDeletedText(e){return this.options.renderChanges?this.renderText(e):null}renderBreak(e){return e.break=="textWrapping"?this.h({tagName:"br"}):null}renderInserted(e){return this.options.renderChanges?this.renderChange(e,"ins"):this.renderElements(e.children)}renderDeleted(e){return this.options.renderChanges?this.renderChange(e,"del"):null}renderChange(e,t){return this.renderContainer(e,t,{dateTime:e.date})}renderSymbol(e){return this.h({tagName:"span",children:[String.fromCharCode(e.char)],style:{fontFamily:e.font}})}renderFootnoteReference(e){return this.currentFootnoteIds.push(e.id),this.h({tagName:"sup",children:[`${this.currentFootnoteIds.length}`]})}renderEndnoteReference(e){return this.currentEndnoteIds.push(e.id),this.h({tagName:"sup",children:[`${this.currentEndnoteIds.length}`]})}renderTab(e){var a;var t=this.h({tagName:"span",children:["\u2003"]});if(this.options.experimental){t.className=this.tabStopClass();var r=(a=(function(s,o){for(var c=s.parent;c!=null&&c.type!=o;)c=c.parent;return c})(e,i.Paragraph))==null?void 0:a.tabs;this.currentTabs.push({stops:r,span:t})}return t}renderBookmarkStart(e){return this.h({tagName:"span",id:e.name})}renderRun(e){if(e.fieldRun)return null;let t=this.renderElements(e.children);e.verticalAlign&&(t=[this.h({tagName:e.verticalAlign,children:this.renderElements(e.children)})]);const r=this.toHTML(e,d.html,"span",t);return e.id&&(r.id=e.id),r}renderTable(e){this.tableCellPositions.push(this.currentCellPosition),this.tableVerticalMerges.push(this.currentVerticalMerge),this.currentVerticalMerge={},this.currentCellPosition={col:0,row:0};const t=[];return e.columns&&t.push(this.renderTableColumns(e.columns)),t.push(...this.renderElements(e.children)),this.currentVerticalMerge=this.tableVerticalMerges.pop(),this.currentCellPosition=this.tableCellPositions.pop(),this.toHTML(e,d.html,"table",t)}renderTableColumns(e){const t=e.map(r=>this.h({tagName:"col",style:{width:r.width}}));return this.h({tagName:"colgroup",children:t})}renderTableRow(e){this.currentCellPosition.col=0;const t=[];return e.gridBefore&&t.push(this.renderTableCellPlaceholder(e.gridBefore)),t.push(...this.renderElements(e.children)),e.gridAfter&&t.push(this.renderTableCellPlaceholder(e.gridAfter)),this.currentCellPosition.row++,this.toHTML(e,d.html,"tr",t)}renderTableCellPlaceholder(e){return this.h({tagName:"td",colSpan:e,style:{border:"none"}})}renderTableCell(e){let t=this.toHTML(e,d.html,"td");const r=this.currentCellPosition.col;return e.verticalMerge?e.verticalMerge=="restart"?(this.currentVerticalMerge[r]=t,t.rowSpan=1):this.currentVerticalMerge[r]&&(this.currentVerticalMerge[r].rowSpan+=1,t.style.display="none"):this.currentVerticalMerge[r]=null,e.span&&(t.colSpan=e.span),this.currentCellPosition.col+=t.colSpan,t}renderVmlPicture(e){return this.renderContainer(e,"div")}renderVmlElement(e){var a,s;var t=this.h({ns:d.svg,tagName:"svg",style:e.cssStyleText});const r=this.renderVmlChildElement(e);return(a=e.imageHref)!=null&&a.id&&this.tasks.push((s=this.document)==null?void 0:s.loadDocumentImage(e.imageHref.id,this.currentPart).then(o=>r.setAttribute("href",o))),t.appendChild(r),requestAnimationFrame(()=>{const o=t.firstElementChild.getBBox();t.setAttribute("width",`${Math.ceil(o.x+o.width)}`),t.setAttribute("height",`${Math.ceil(o.y+o.height)}`)}),t}renderVmlChildElement(e){const t=this.createSvgElement(e.tagName);Object.entries(e.attrs).forEach(([r,a])=>t.setAttribute(r,a));for(let r of e.children)r.type==i.VmlElement?t.appendChild(this.renderVmlChildElement(r)):t.appendChild(...D(this.renderElement(r)));return t}renderMmlRadical(e){var a;const t=e.children.find(s=>s.type==i.MmlBase);if((a=e.props)!=null&&a.hideDegree)return this.createMathMLElement("msqrt",null,this.renderElements([t]));const r=e.children.find(s=>s.type==i.MmlDegree);return this.createMathMLElement("mroot",null,this.renderElements([t,r]))}renderMmlDelimiter(e){var r,a;const t=[];return t.push(this.createMathMLElement("mo",null,[(r=e.props.beginChar)!=null?r:"("])),t.push(...this.renderElements(e.children)),t.push(this.createMathMLElement("mo",null,[(a=e.props.endChar)!=null?a:")"])),this.createMathMLElement("mrow",null,t)}renderMmlNary(e){var m,p;const t=[],r=A(e.children,y=>y.type),a=r[i.MmlSuperArgument],s=r[i.MmlSubArgument],o=a?this.createMathMLElement("mo",null,D(this.renderElement(a))):null,c=s?this.createMathMLElement("mo",null,D(this.renderElement(s))):null,h=this.createMathMLElement("mo",null,[(p=(m=e.props)==null?void 0:m.char)!=null?p:"\u222B"]);return o||c?t.push(this.createMathMLElement("munderover",null,[h,c,o])):o?t.push(this.createMathMLElement("mover",null,[h,o])):c?t.push(this.createMathMLElement("munder",null,[h,c])):t.push(h),t.push(...this.renderElements(r[i.MmlBase].children)),this.createMathMLElement("mrow",null,t)}renderMmlPreSubSuper(e){const t=[],r=A(e.children,m=>m.type),a=r[i.MmlSuperArgument],s=r[i.MmlSubArgument],o=a?this.createMathMLElement("mo",null,D(this.renderElement(a))):null,c=s?this.createMathMLElement("mo",null,D(this.renderElement(s))):null,h=this.createMathMLElement("mo",null);return t.push(this.createMathMLElement("msubsup",null,[h,c,o])),t.push(...this.renderElements(r[i.MmlBase].children)),this.createMathMLElement("mrow",null,t)}renderMmlGroupChar(e){const t=e.props.verticalJustification==="bot"?"mover":"munder",r=this.renderContainerNS(e,d.mathML,t);return e.props.char&&r.appendChild(this.createMathMLElement("mo",null,[e.props.char])),r}renderMmlBar(e){const t={};switch(e.props.position){case"top":t.textDecoration="overline";break;case"bottom":t.textDecoration="underline"}return this.renderContainerNS(e,d.mathML,"mrow",{style:t})}renderMmlRun(e){return this.toHTML(e,d.mathML,"ms")}renderMllList(e){const t=this.renderElements(e.children).map(r=>this.createMathMLElement("mtr",null,[this.createMathMLElement("mtd",null,[r])]));return this.toHTML(e,d.mathML,"mtable",t)}toH(e,t,r,a=null){var c;const h=(c=e.cssStyle)!=null?c:{},{$lang:s}=h,o=K(h,["$lang"]);return{ns:t,tagName:r,className:(function(...m){return m.filter(Boolean).join(" ")})(e.className,e.styleName&&this.processStyleName(e.styleName)),lang:s,style:o,children:a!=null?a:this.renderElements(e.children)}}toHTML(e,t,r,a=null){return this.h(this.toH(e,t,r,a))}findStyle(e){var t;return e&&((t=this.styleMap)==null?void 0:t[e])}numberingClass(e,t){return`${this.className}-num-${e}-${t}`}tabStopClass(){return`${this.className}-tab-stop`}styleToString(e,t,r=null){let a=`${e} {\r +`;for(const s in t)s.startsWith("$")||(a+=` ${s}: ${t[s]};\r +`);return r&&(a+=r),a+`}\r +`}numberingCounter(e,t){return`${this.className}-num-${e}-${t}`}levelTextToContent(e,t,r,a){var s;return`"${e.replace(/%\d*/g,o=>{let c=parseInt(o.substring(1),10)-1;return`"counter(${this.numberingCounter(r,c)}, ${a})"`})}${(s={tab:"\\9",space:"\\a0"}[t])!=null?s:""}"`}numFormatToCssValue(e){var t;return(t={none:"none",bullet:"disc",decimal:"decimal",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero",aiueo:"katakana",aiueoFullWidth:"katakana",chineseCounting:"simp-chinese-informal",chineseCountingThousand:"simp-chinese-informal",chineseLegalSimplified:"simp-chinese-formal",chosung:"hangul-consonant",ideographDigital:"cjk-ideographic",ideographTraditional:"cjk-heavenly-stem",ideographLegalTraditional:"trad-chinese-formal",ideographZodiac:"cjk-earthly-branch",iroha:"katakana-iroha",irohaFullWidth:"katakana-iroha",japaneseCounting:"japanese-informal",japaneseDigitalTenThousand:"cjk-decimal",japaneseLegal:"japanese-formal",thaiNumbers:"thai",koreanCounting:"korean-hangul-formal",koreanDigital:"korean-hangul-formal",koreanDigital2:"korean-hanja-informal",hebrew1:"hebrew",hebrew2:"hebrew",hindiNumbers:"devanagari",ganada:"hangul",taiwaneseCounting:"cjk-ideographic",taiwaneseCountingThousand:"cjk-ideographic",taiwaneseDigital:"cjk-decimal"}[e])!=null?t:e}refreshTabStops(){this.options.experimental&&setTimeout(()=>{const e=(function(t=document.body){const r=document.createElement("div");r.style.width="100pt",t.appendChild(r);const a=100/r.offsetWidth;return t.removeChild(r),a})();for(let t of this.currentTabs)xt(t.span,t.stops,this.defaultTabSize,e)},500)}createElementNS(e,t,r,a){return this.h(P({ns:e,tagName:t,children:a},r))}createElement(e,t,r){return this.createElementNS(d.html,e,t,r)}createMathMLElement(e,t,r){return this.createElementNS(d.mathML,e,t,r)}createSvgElement(e,t,r){return this.createElementNS(d.svg,e,t,r)}later(e){this.postRenderTasks.push(e)}}const Y={ignoreHeight:!1,ignoreWidth:!1,ignoreFonts:!1,breakPages:!0,debug:!1,experimental:!1,className:"docx",inWrapper:!0,hideWrapperOnPrint:!1,trimXmlDeclaration:!0,ignoreLastRenderedPageBreak:!0,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0,useBase64URL:!1,renderChanges:!1,renderComments:!1,renderAltChunks:!0,h:$};function ve(n,e){const t=P(P({},Y),e);return Z.load(n,new St(t),t)}async function we(n,e){const t=P(P({},Y),e);return await new Nt().render(n,t)}f.defaultOptions=Y,f.parseAsync=ve,f.renderAsync=async function(n,e,t,r){const a=await ve(n,r),s=await we(a,r);t!=null||(t=e),t.innerHTML="",e.innerHTML="";for(let o of s)(o.nodeName==="STYLE"?t:e).appendChild(o);return a},f.renderDocument=we}); diff --git a/suixinkan/Resources/TrainingDocumentPreview/vendor/jszip.min.js b/suixinkan/Resources/TrainingDocumentPreview/vendor/jszip.min.js new file mode 100644 index 0000000..322a885 --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/vendor/jszip.min.js @@ -0,0 +1,12 @@ +"use strict";/*! + +JSZip v3.10.2 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/(function(b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define([],b):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:this).JSZip=b()})(function(){return(function b(U,k,l){function h(_,y){if(!k[_]){if(!U[_]){var p=typeof require=="function"&&require;if(!y&&p)return p(_,!0);if(n)return n(_,!0);var g=new Error("Cannot find module '"+_+"'");throw g.code="MODULE_NOT_FOUND",g}var i=k[_]={exports:{}};U[_][0].call(i.exports,function(c){var e=U[_][1][c];return h(e||c)},i,i.exports,b,U,k,l)}return k[_].exports}for(var n=typeof require=="function"&&require,u=0;u>2,i=(3&_)<<4|y>>4,c=1>6:64,e=2>4,y=(15&g)<<4|(i=n.indexOf(u.charAt(e++)))>>2,p=(3&i)<<6|(c=n.indexOf(u.charAt(e++))),d[o++]=_,i!==64&&(d[o++]=y),c!==64&&(d[o++]=p);return d}},{"./support":30,"./utils":32}],2:[function(b,U,k){"use strict";var l=b("./external"),h=b("./stream/DataWorker"),n=b("./stream/Crc32Probe"),u=b("./stream/DataLengthProbe");function _(y,p,g,i,c){this.compressedSize=y,this.uncompressedSize=p,this.crc32=g,this.compression=i,this.compressedContent=c}_.prototype={getContentWorker:function(){var y=new h(l.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),p=this;return y.on("end",function(){if(this.streamInfo.data_length!==p.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),y},getCompressedWorker:function(){return new h(l.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},_.createWorkerFrom=function(y,p,g){return y.pipe(new n).pipe(new u("uncompressedSize")).pipe(p.compressWorker(g)).pipe(new u("compressedSize")).withStreamInfo("compression",p)},U.exports=_},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(b,U,k){"use strict";var l=b("./stream/GenericWorker");k.STORE={magic:"\0\0",compressWorker:function(){return new l("STORE compression")},uncompressWorker:function(){return new l("STORE decompression")}},k.DEFLATE=b("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(b,U,k){"use strict";var l=b("./utils"),h=(function(){for(var n,u=[],_=0;_<256;_++){n=_;for(var y=0;y<8;y++)n=1&n?3988292384^n>>>1:n>>>1;u[_]=n}return u})();U.exports=function(n,u){return n!==void 0&&n.length?l.getTypeOf(n)!=="string"?(function(_,y,p,g){var i=h,c=g+p;_^=-1;for(var e=g;e>>8^i[255&(_^y[e])];return-1^_})(0|u,n,n.length,0):(function(_,y,p,g){var i=h,c=g+p;_^=-1;for(var e=g;e>>8^i[255&(_^y.charCodeAt(e))];return-1^_})(0|u,n,n.length,0):0}},{"./utils":32}],5:[function(b,U,k){"use strict";k.base64=!1,k.binary=!1,k.dir=!1,k.createFolders=!0,k.date=null,k.compression=null,k.compressionOptions=null,k.comment=null,k.unixPermissions=null,k.dosPermissions=null},{}],6:[function(b,U,k){"use strict";var l=null;l=typeof Promise!="undefined"?Promise:b("lie"),U.exports={Promise:l}},{lie:37}],7:[function(b,U,k){"use strict";var l=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",h=b("pako"),n=b("./utils"),u=b("./stream/GenericWorker"),_=l?"uint8array":"array";function y(p,g){u.call(this,"FlateWorker/"+p),this._pako=null,this._pakoAction=p,this._pakoOptions=g,this.meta={}}k.magic="\b\0",n.inherits(y,u),y.prototype.processChunk=function(p){this.meta=p.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(_,p.data),!1)},y.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},y.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},y.prototype._createPako=function(){this._pako=new h[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var p=this;this._pako.onData=function(g){p.push({data:g,meta:p.meta})}},k.compressWorker=function(p){return new y("Deflate",p)},k.uncompressWorker=function(){return new y("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(b,U,k){"use strict";function l(i,c){var e,o="";for(e=0;e>>=8;return o}function h(i,c,e,o,s,d){var v,S,x=i.file,D=i.compression,O=d!==_.utf8encode,L=n.transformTo("string",d(x.name)),I=n.transformTo("string",_.utf8encode(x.name)),M=x.comment,V=n.transformTo("string",d(M)),m=n.transformTo("string",_.utf8encode(M)),B=I.length!==x.name.length,r=m.length!==M.length,T="",J="",P="",$=x.dir,j=x.date,q={crc32:0,compressedSize:0,uncompressedSize:0};c&&!e||(q.crc32=i.crc32,q.compressedSize=i.compressedSize,q.uncompressedSize=i.uncompressedSize);var E=0;c&&(E|=8),O||!B&&!r||(E|=2048);var C=0,X=0;$&&(C|=16),s==="UNIX"?(X=798,C|=(function(H,nt){var ot=H;return H||(ot=nt?16893:33204),(65535&ot)<<16})(x.unixPermissions,$)):(X=20,C|=(function(H){return 63&(H||0)})(x.dosPermissions)),v=j.getUTCHours(),v<<=6,v|=j.getUTCMinutes(),v<<=5,v|=j.getUTCSeconds()/2,S=j.getUTCFullYear()-1980,S<<=4,S|=j.getUTCMonth()+1,S<<=5,S|=j.getUTCDate(),B&&(J=l(1,1)+l(y(L),4)+I,T+="up"+l(J.length,2)+J),r&&(P=l(1,1)+l(y(V),4)+m,T+="uc"+l(P.length,2)+P);var G="";return G+=` +\0`,G+=l(E,2),G+=D.magic,G+=l(v,2),G+=l(S,2),G+=l(q.crc32,4),G+=l(q.compressedSize,4),G+=l(q.uncompressedSize,4),G+=l(L.length,2),G+=l(T.length,2),{fileRecord:p.LOCAL_FILE_HEADER+G+L+T,dirRecord:p.CENTRAL_FILE_HEADER+l(X,2)+G+l(V.length,2)+"\0\0\0\0"+l(C,4)+l(o,4)+L+T+V}}var n=b("../utils"),u=b("../stream/GenericWorker"),_=b("../utf8"),y=b("../crc32"),p=b("../signature");function g(i,c,e,o){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=c,this.zipPlatform=e,this.encodeFileName=o,this.streamFiles=i,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(g,u),g.prototype.push=function(i){var c=i.meta.percent||0,e=this.entriesCount,o=this._sources.length;this.accumulate?this.contentBuffer.push(i):(this.bytesWritten+=i.data.length,u.prototype.push.call(this,{data:i.data,meta:{currentFile:this.currentFile,percent:e?(c+100*(e-o-1))/e:100}}))},g.prototype.openedSource=function(i){this.currentSourceOffset=this.bytesWritten,this.currentFile=i.file.name;var c=this.streamFiles&&!i.file.dir;if(c){var e=h(i,c,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:e.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(i){this.accumulate=!1;var c=this.streamFiles&&!i.file.dir,e=h(i,c,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(e.dirRecord),c)this.push({data:(function(o){return p.DATA_DESCRIPTOR+l(o.crc32,4)+l(o.compressedSize,4)+l(o.uncompressedSize,4)})(i),meta:{percent:100}});else for(this.push({data:e.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var i=this.bytesWritten,c=0;c=this.index;u--)_=(_<<8)+this.byteAt(u);return this.index+=n,_},readString:function(n){return l.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},U.exports=h},{"../utils":32}],19:[function(b,U,k){"use strict";var l=b("./Uint8ArrayReader");function h(n){l.call(this,n)}b("../utils").inherits(h,l),h.prototype.readData=function(n){this.checkOffset(n);var u=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},U.exports=h},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(b,U,k){"use strict";var l=b("./DataReader");function h(n){l.call(this,n)}b("../utils").inherits(h,l),h.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},h.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},h.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},h.prototype.readData=function(n){this.checkOffset(n);var u=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},U.exports=h},{"../utils":32,"./DataReader":18}],21:[function(b,U,k){"use strict";var l=b("./ArrayReader");function h(n){l.call(this,n)}b("../utils").inherits(h,l),h.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},U.exports=h},{"../utils":32,"./ArrayReader":17}],22:[function(b,U,k){"use strict";var l=b("../utils"),h=b("../support"),n=b("./ArrayReader"),u=b("./StringReader"),_=b("./NodeBufferReader"),y=b("./Uint8ArrayReader");U.exports=function(p){var g=l.getTypeOf(p);return l.checkSupport(g),g!=="string"||h.uint8array?g==="nodebuffer"?new _(p):h.uint8array?new y(l.transformTo("uint8array",p)):new n(l.transformTo("array",p)):new u(p)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(b,U,k){"use strict";k.LOCAL_FILE_HEADER="PK",k.CENTRAL_FILE_HEADER="PK",k.CENTRAL_DIRECTORY_END="PK",k.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",k.ZIP64_CENTRAL_DIRECTORY_END="PK",k.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(b,U,k){"use strict";var l=b("./GenericWorker"),h=b("../utils");function n(u){l.call(this,"ConvertWorker to "+u),this.destType=u}h.inherits(n,l),n.prototype.processChunk=function(u){this.push({data:h.transformTo(this.destType,u.data),meta:u.meta})},U.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(b,U,k){"use strict";var l=b("./GenericWorker"),h=b("../crc32");function n(){l.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}b("../utils").inherits(n,l),n.prototype.processChunk=function(u){this.streamInfo.crc32=h(u.data,this.streamInfo.crc32||0),this.push(u)},U.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(b,U,k){"use strict";var l=b("../utils"),h=b("./GenericWorker");function n(u){h.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}l.inherits(n,h),n.prototype.processChunk=function(u){if(u){var _=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=_+u.data.length}h.prototype.processChunk.call(this,u)},U.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(b,U,k){"use strict";var l=b("../utils"),h=b("./GenericWorker");function n(u){h.call(this,"DataWorker");var _=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(y){_.dataIsReady=!0,_.data=y,_.max=y&&y.length||0,_.type=l.getTypeOf(y),_.isPaused||_._tickAndRepeat()},function(y){_.error(y)})}l.inherits(n,h),n.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,l.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(l.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,_=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,_);break;case"uint8array":u=this.data.subarray(this.index,_);break;case"array":case"nodebuffer":u=this.data.slice(this.index,_)}return this.index=_,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},U.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(b,U,k){"use strict";function l(h){this.name=h||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}l.prototype={push:function(h){this.emit("data",h)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(h){this.emit("error",h)}return!0},error:function(h){return!this.isFinished&&(this.isPaused?this.generatedError=h:(this.isFinished=!0,this.emit("error",h),this.previous&&this.previous.error(h),this.cleanUp()),!0)},on:function(h,n){return this._listeners[h].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(h,n){if(this._listeners[h])for(var u=0;u "+h:h}},U.exports=l},{}],29:[function(b,U,k){"use strict";var l=b("../utils"),h=b("./ConvertWorker"),n=b("./GenericWorker"),u=b("../base64"),_=b("../support"),y=b("../external"),p=null;if(_.nodestream)try{p=b("../nodejs/NodejsStreamOutputAdapter")}catch(c){}function g(c,e){return new y.Promise(function(o,s){var d=[],v=c._internalType,S=c._outputType,x=c._mimeType;c.on("data",function(D,O){d.push(D),e&&e(O)}).on("error",function(D){d=[],s(D)}).on("end",function(){try{var D=(function(O,L,I){switch(O){case"blob":return l.newBlob(l.transformTo("arraybuffer",L),I);case"base64":return u.encode(L);default:return l.transformTo(O,L)}})(S,(function(O,L){var I,M=0,V=null,m=0;for(I=0;I>>6:(o<65536?e[v++]=224|o>>>12:(e[v++]=240|o>>>18,e[v++]=128|o>>>12&63),e[v++]=128|o>>>6&63),e[v++]=128|63&o);return e})(i)},k.utf8decode=function(i){return h.nodebuffer?l.transformTo("nodebuffer",i).toString("utf-8"):(function(c){var e,o,s,d,v=c.length,S=new Array(2*v);for(e=o=0;e>10&1023,S[o++]=56320|1023&s)}return S.length!==o&&(S.subarray?S=S.subarray(0,o):S.length=o),l.applyFromCharCode(S)})(i=l.transformTo(h.uint8array?"uint8array":"array",i))},l.inherits(p,u),p.prototype.processChunk=function(i){var c=l.transformTo(h.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var e=c;(c=new Uint8Array(e.length+this.leftOver.length)).set(this.leftOver,0),c.set(e,this.leftOver.length)}else c=this.leftOver.concat(c);this.leftOver=null}var o=(function(d,v){var S;for((v=v||d.length)>d.length&&(v=d.length),S=v-1;0<=S&&(192&d[S])==128;)S--;return S<0||S===0?v:S+_[d[S]]>v?S:v})(c),s=c;o!==c.length&&(h.uint8array?(s=c.subarray(0,o),this.leftOver=c.subarray(o,c.length)):(s=c.slice(0,o),this.leftOver=c.slice(o,c.length))),this.push({data:k.utf8decode(s),meta:i.meta})},p.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:k.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},k.Utf8DecodeWorker=p,l.inherits(g,u),g.prototype.processChunk=function(i){this.push({data:k.utf8encode(i.data),meta:i.meta})},k.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(b,U,k){"use strict";var l=b("./support"),h=b("./base64"),n=b("./nodejsUtils"),u=b("./external");function _(e){return e}function y(e,o){for(var s=0;s>8;this.dir=!!(16&this.externalFileAttributes),i==0&&(this.dosPermissions=63&this.externalFileAttributes),i==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var i=l(this.extraFields[1].value);this.uncompressedSize===h.MAX_VALUE_32BITS&&(this.uncompressedSize=i.readInt(8)),this.compressedSize===h.MAX_VALUE_32BITS&&(this.compressedSize=i.readInt(8)),this.localHeaderOffset===h.MAX_VALUE_32BITS&&(this.localHeaderOffset=i.readInt(8)),this.diskNumberStart===h.MAX_VALUE_32BITS&&(this.diskNumberStart=i.readInt(4))}},readExtraFields:function(i){var c,e,o,s=i.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});i.index+4>>6:(i<65536?g[o++]=224|i>>>12:(g[o++]=240|i>>>18,g[o++]=128|i>>>12&63),g[o++]=128|i>>>6&63),g[o++]=128|63&i);return g},k.buf2binstring=function(p){return y(p,p.length)},k.binstring2buf=function(p){for(var g=new l.Buf8(p.length),i=0,c=g.length;i>10&1023,d[c++]=56320|1023&e)}return y(d,c)},k.utf8border=function(p,g){var i;for((g=g||p.length)>p.length&&(g=p.length),i=g-1;0<=i&&(192&p[i])==128;)i--;return i<0||i===0?g:i+u[p[i]]>g?i:g}},{"./common":41}],43:[function(b,U,k){"use strict";U.exports=function(l,h,n,u){for(var _=65535&l|0,y=l>>>16&65535|0,p=0;n!==0;){for(n-=p=2e3>>1:h>>>1;n[u]=h}return n})();U.exports=function(h,n,u,_){var y=l,p=_+u;h^=-1;for(var g=_;g>>8^y[255&(h^n[g])];return-1^h}},{}],46:[function(b,U,k){"use strict";var l,h=b("../utils/common"),n=b("./trees"),u=b("./adler32"),_=b("./crc32"),y=b("./messages"),p=0,g=4,i=0,c=-2,e=-1,o=4,s=2,d=8,v=9,S=286,x=30,D=19,O=2*S+1,L=15,I=3,M=258,V=M+I+1,m=42,B=113,r=1,T=2,J=3,P=4;function $(t,R){return t.msg=y[R],R}function j(t){return(t<<1)-(4t.avail_out&&(A=t.avail_out),A!==0&&(h.arraySet(t.output,R.pending_buf,R.pending_out,A,t.next_out),t.next_out+=A,R.pending_out+=A,t.total_out+=A,t.avail_out-=A,R.pending-=A,R.pending===0&&(R.pending_out=0))}function C(t,R){n._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,R),t.block_start=t.strstart,E(t.strm)}function X(t,R){t.pending_buf[t.pending++]=R}function G(t,R){t.pending_buf[t.pending++]=R>>>8&255,t.pending_buf[t.pending++]=255&R}function H(t,R){var A,f,a=t.max_chain_length,w=t.strstart,F=t.prev_length,N=t.nice_match,z=t.strstart>t.w_size-V?t.strstart-(t.w_size-V):0,Z=t.window,K=t.w_mask,W=t.prev,Y=t.strstart+M,et=Z[w+F-1],tt=Z[w+F];t.prev_length>=t.good_match&&(a>>=2),N>t.lookahead&&(N=t.lookahead);do if(Z[(A=R)+F]===tt&&Z[A+F-1]===et&&Z[A]===Z[w]&&Z[++A]===Z[w+1]){w+=2,A++;do;while(Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&Z[++w]===Z[++A]&&wz&&--a!=0);return F<=t.lookahead?F:t.lookahead}function nt(t){var R,A,f,a,w,F,N,z,Z,K,W=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=W+(W-V)){for(h.arraySet(t.window,t.window,W,W,0),t.match_start-=W,t.strstart-=W,t.block_start-=W,R=A=t.hash_size;f=t.head[--R],t.head[R]=W<=f?f-W:0,--A;);for(R=A=W;f=t.prev[--R],t.prev[R]=W<=f?f-W:0,--A;);a+=W}if(t.strm.avail_in===0)break;if(F=t.strm,N=t.window,z=t.strstart+t.lookahead,Z=a,K=void 0,K=F.avail_in,Z=I)for(w=t.strstart-t.insert,t.ins_h=t.window[w],t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I)if(f=n._tr_tally(t,t.strstart-t.match_start,t.match_length-I),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=I){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I&&t.match_length<=t.prev_length){for(a=t.strstart+t.lookahead-I,f=n._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-I),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=a&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(A=t.pending_buf_size-5);;){if(t.lookahead<=1){if(nt(t),t.lookahead===0&&R===p)return r;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var f=t.block_start+A;if((t.strstart===0||t.strstart>=f)&&(t.lookahead=t.strstart-f,t.strstart=f,C(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-V&&(C(t,!1),t.strm.avail_out===0))return r}return t.insert=0,R===g?(C(t,!0),t.strm.avail_out===0?J:P):(t.strstart>t.block_start&&(C(t,!1),t.strm.avail_out),r)}),new rt(4,4,8,4,ot),new rt(4,5,16,8,ot),new rt(4,6,32,32,ot),new rt(4,4,16,16,Q),new rt(8,16,32,32,Q),new rt(8,16,128,128,Q),new rt(8,32,128,256,Q),new rt(32,128,258,1024,Q),new rt(32,258,258,4096,Q)],k.deflateInit=function(t,R){return ut(t,R,d,15,8,0)},k.deflateInit2=ut,k.deflateReset=lt,k.deflateResetKeep=it,k.deflateSetHeader=function(t,R){return t&&t.state?t.state.wrap!==2?c:(t.state.gzhead=R,i):c},k.deflate=function(t,R){var A,f,a,w;if(!t||!t.state||5>8&255),X(f,f.gzhead.time>>16&255),X(f,f.gzhead.time>>24&255),X(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),X(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(X(f,255&f.gzhead.extra.length),X(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(t.adler=_(t.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=69):(X(f,0),X(f,0),X(f,0),X(f,0),X(f,0),X(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),X(f,3),f.status=B);else{var F=d+(f.w_bits-8<<4)<<8;F|=(2<=f.strategy||f.level<2?0:f.level<6?1:f.level===6?2:3)<<6,f.strstart!==0&&(F|=32),F+=31-F%31,f.status=B,G(f,F),f.strstart!==0&&(G(f,t.adler>>>16),G(f,65535&t.adler)),t.adler=1}if(f.status===69)if(f.gzhead.extra){for(a=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>a&&(t.adler=_(t.adler,f.pending_buf,f.pending-a,a)),E(t),a=f.pending,f.pending!==f.pending_buf_size));)X(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>a&&(t.adler=_(t.adler,f.pending_buf,f.pending-a,a)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=73)}else f.status=73;if(f.status===73)if(f.gzhead.name){a=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>a&&(t.adler=_(t.adler,f.pending_buf,f.pending-a,a)),E(t),a=f.pending,f.pending===f.pending_buf_size)){w=1;break}w=f.gzindexa&&(t.adler=_(t.adler,f.pending_buf,f.pending-a,a)),w===0&&(f.gzindex=0,f.status=91)}else f.status=91;if(f.status===91)if(f.gzhead.comment){a=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>a&&(t.adler=_(t.adler,f.pending_buf,f.pending-a,a)),E(t),a=f.pending,f.pending===f.pending_buf_size)){w=1;break}w=f.gzindexa&&(t.adler=_(t.adler,f.pending_buf,f.pending-a,a)),w===0&&(f.status=103)}else f.status=103;if(f.status===103&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&E(t),f.pending+2<=f.pending_buf_size&&(X(f,255&t.adler),X(f,t.adler>>8&255),t.adler=0,f.status=B)):f.status=B),f.pending!==0){if(E(t),t.avail_out===0)return f.last_flush=-1,i}else if(t.avail_in===0&&j(R)<=j(A)&&R!==g)return $(t,-5);if(f.status===666&&t.avail_in!==0)return $(t,-5);if(t.avail_in!==0||f.lookahead!==0||R!==p&&f.status!==666){var N=f.strategy===2?(function(z,Z){for(var K;;){if(z.lookahead===0&&(nt(z),z.lookahead===0)){if(Z===p)return r;break}if(z.match_length=0,K=n._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,K&&(C(z,!1),z.strm.avail_out===0))return r}return z.insert=0,Z===g?(C(z,!0),z.strm.avail_out===0?J:P):z.last_lit&&(C(z,!1),z.strm.avail_out===0)?r:T})(f,R):f.strategy===3?(function(z,Z){for(var K,W,Y,et,tt=z.window;;){if(z.lookahead<=M){if(nt(z),z.lookahead<=M&&Z===p)return r;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=I&&0z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=I?(K=n._tr_tally(z,1,z.match_length-I),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(K=n._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),K&&(C(z,!1),z.strm.avail_out===0))return r}return z.insert=0,Z===g?(C(z,!0),z.strm.avail_out===0?J:P):z.last_lit&&(C(z,!1),z.strm.avail_out===0)?r:T})(f,R):l[f.level].func(f,R);if(N!==J&&N!==P||(f.status=666),N===r||N===J)return t.avail_out===0&&(f.last_flush=-1),i;if(N===T&&(R===1?n._tr_align(f):R!==5&&(n._tr_stored_block(f,0,0,!1),R===3&&(q(f.head),f.lookahead===0&&(f.strstart=0,f.block_start=0,f.insert=0))),E(t),t.avail_out===0))return f.last_flush=-1,i}return R!==g?i:f.wrap<=0?1:(f.wrap===2?(X(f,255&t.adler),X(f,t.adler>>8&255),X(f,t.adler>>16&255),X(f,t.adler>>24&255),X(f,255&t.total_in),X(f,t.total_in>>8&255),X(f,t.total_in>>16&255),X(f,t.total_in>>24&255)):(G(f,t.adler>>>16),G(f,65535&t.adler)),E(t),0=A.w_size&&(w===0&&(q(A.head),A.strstart=0,A.block_start=0,A.insert=0),Z=new h.Buf8(A.w_size),h.arraySet(Z,R,K-A.w_size,A.w_size,0),R=Z,K=A.w_size),F=t.avail_in,N=t.next_in,z=t.input,t.avail_in=K,t.next_in=0,t.input=R,nt(A);A.lookahead>=I;){for(f=A.strstart,a=A.lookahead-(I-1);A.ins_h=(A.ins_h<>>=I=L>>>24,v-=I,(I=L>>>16&255)===0)T[y++]=65535&L;else{if(!(16&I)){if((64&I)==0){L=S[(65535&L)+(d&(1<>>=I,v-=I),v<15&&(d+=r[u++]<>>=I=L>>>24,v-=I,!(16&(I=L>>>16&255))){if((64&I)==0){L=x[(65535&L)+(d&(1<>>=I,v-=I,(I=y-p)>3,d&=(1<<(v-=M<<3))-1,l.next_in=u,l.next_out=y,l.avail_in=u<_?_-u+5:5-(u-_),l.avail_out=y>>24&255)+(m>>>8&65280)+((65280&m)<<8)+((255&m)<<24)}function d(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new l.Buf16(320),this.work=new l.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(m){var B;return m&&m.state?(B=m.state,m.total_in=m.total_out=B.total=0,m.msg="",B.wrap&&(m.adler=1&B.wrap),B.mode=c,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new l.Buf32(e),B.distcode=B.distdyn=new l.Buf32(o),B.sane=1,B.back=-1,g):i}function S(m){var B;return m&&m.state?((B=m.state).wsize=0,B.whave=0,B.wnext=0,v(m)):i}function x(m,B){var r,T;return m&&m.state?(T=m.state,B<0?(r=0,B=-B):(r=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=P.wsize?(l.arraySet(P.window,B,r-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(T<(J=P.wsize-P.wnext)&&(J=T),l.arraySet(P.window,B,r-T,J,P.wnext),(T-=J)?(l.arraySet(P.window,B,r-T,T,0),P.wnext=T,P.whave=P.wsize):(P.wnext+=J,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,r.check=n(r.check,w,2,0),C=E=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&E)<<8)+(E>>8))%31){m.msg="incorrect header check",r.mode=30;break}if((15&E)!=8){m.msg="unknown compression method",r.mode=30;break}if(C-=4,t=8+(15&(E>>>=4)),r.wbits===0)r.wbits=t;else if(t>r.wbits){m.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(w[0]=255&E,w[1]=E>>>8&255,r.check=n(r.check,w,2,0)),C=E=0,r.mode=3;case 3:for(;C<32;){if(j===0)break t;j--,E+=T[P++]<>>8&255,w[2]=E>>>16&255,w[3]=E>>>24&255,r.check=n(r.check,w,4,0)),C=E=0,r.mode=4;case 4:for(;C<16;){if(j===0)break t;j--,E+=T[P++]<>8),512&r.flags&&(w[0]=255&E,w[1]=E>>>8&255,r.check=n(r.check,w,2,0)),C=E=0,r.mode=5;case 5:if(1024&r.flags){for(;C<16;){if(j===0)break t;j--,E+=T[P++]<>>8&255,r.check=n(r.check,w,2,0)),C=E=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(j<(H=r.length)&&(H=j),H&&(r.head&&(t=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),l.arraySet(r.head.extra,T,P,H,t)),512&r.flags&&(r.check=n(r.check,T,H,P)),j-=H,P+=H,r.length-=H),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(j===0)break t;for(H=0;t=T[P+H++],r.head&&t&&r.length<65536&&(r.head.name+=String.fromCharCode(t)),t&&H>9&1,r.head.done=!0),m.adler=r.check=0,r.mode=12;break;case 10:for(;C<32;){if(j===0)break t;j--,E+=T[P++]<>>=7&C,C-=7&C,r.mode=27;break}for(;C<3;){if(j===0)break t;j--,E+=T[P++]<>>=1)){case 0:r.mode=14;break;case 1:if(M(r),r.mode=20,B!==6)break;E>>>=2,C-=2;break t;case 2:r.mode=17;break;case 3:m.msg="invalid block type",r.mode=30}E>>>=2,C-=2;break;case 14:for(E>>>=7&C,C-=7&C;C<32;){if(j===0)break t;j--,E+=T[P++]<>>16^65535)){m.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&E,C=E=0,r.mode=15,B===6)break t;case 15:r.mode=16;case 16:if(H=r.length){if(j>>=5,C-=5,r.ndist=1+(31&E),E>>>=5,C-=5,r.ncode=4+(15&E),E>>>=4,C-=4,286>>=3,C-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},R=_(0,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,R){m.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,at=65535&a,!((Q=a>>>24)<=C);){if(j===0)break t;j--,E+=T[P++]<>>=Q,C-=Q,r.lens[r.have++]=at;else{if(at===16){for(f=Q+2;C>>=Q,C-=Q,r.have===0){m.msg="invalid bit length repeat",r.mode=30;break}t=r.lens[r.have-1],H=3+(3&E),E>>>=2,C-=2}else if(at===17){for(f=Q+3;C>>=Q)),E>>>=3,C-=3}else{for(f=Q+7;C>>=Q)),E>>>=7,C-=7}if(r.have+H>r.nlen+r.ndist){m.msg="invalid bit length repeat",r.mode=30;break}for(;H--;)r.lens[r.have++]=t}}if(r.mode===30)break;if(r.lens[256]===0){m.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,A={bits:r.lenbits},R=_(y,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,R){m.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},R=_(p,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,R){m.msg="invalid distances set",r.mode=30;break}if(r.mode=20,B===6)break t;case 20:r.mode=21;case 21:if(6<=j&&258<=q){m.next_out=$,m.avail_out=q,m.next_in=P,m.avail_in=j,r.hold=E,r.bits=C,u(m,G),$=m.next_out,J=m.output,q=m.avail_out,P=m.next_in,T=m.input,j=m.avail_in,E=r.hold,C=r.bits,r.mode===12&&(r.back=-1);break}for(r.back=0;rt=(a=r.lencode[E&(1<>>16&255,at=65535&a,!((Q=a>>>24)<=C);){if(j===0)break t;j--,E+=T[P++]<>it)])>>>16&255,at=65535&a,!(it+(Q=a>>>24)<=C);){if(j===0)break t;j--,E+=T[P++]<>>=it,C-=it,r.back+=it}if(E>>>=Q,C-=Q,r.back+=Q,r.length=at,rt===0){r.mode=26;break}if(32&rt){r.back=-1,r.mode=12;break}if(64&rt){m.msg="invalid literal/length code",r.mode=30;break}r.extra=15&rt,r.mode=22;case 22:if(r.extra){for(f=r.extra;C>>=r.extra,C-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;rt=(a=r.distcode[E&(1<>>16&255,at=65535&a,!((Q=a>>>24)<=C);){if(j===0)break t;j--,E+=T[P++]<>it)])>>>16&255,at=65535&a,!(it+(Q=a>>>24)<=C);){if(j===0)break t;j--,E+=T[P++]<>>=it,C-=it,r.back+=it}if(E>>>=Q,C-=Q,r.back+=Q,64&rt){m.msg="invalid distance code",r.mode=30;break}r.offset=at,r.extra=15&rt,r.mode=24;case 24:if(r.extra){for(f=r.extra;C>>=r.extra,C-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){m.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(q===0)break t;if(H=G-q,r.offset>H){if((H=r.offset-H)>r.whave&&r.sane){m.msg="invalid distance too far back",r.mode=30;break}nt=H>r.wnext?(H-=r.wnext,r.wsize-H):r.wnext-H,H>r.length&&(H=r.length),ot=r.window}else ot=J,nt=$-r.offset,H=r.length;for(qO?(I=nt[ot+o[B]],C[X+o[B]]):(I=96,0),d=1<>$)+(v-=d)]=L<<24|I<<16|M|0,v!==0;);for(d=1<>=1;if(d!==0?(E&=d-1,E+=d):E=0,B++,--G[m]==0){if(m===T)break;m=p[g+o[B]]}if(J>>7)]}function X(a,w){a.pending_buf[a.pending++]=255&w,a.pending_buf[a.pending++]=w>>>8&255}function G(a,w,F){a.bi_valid>s-F?(a.bi_buf|=w<>s-a.bi_valid,a.bi_valid+=F-s):(a.bi_buf|=w<>>=1,F<<=1,0<--w;);return F>>>1}function ot(a,w,F){var N,z,Z=new Array(o+1),K=0;for(N=1;N<=o;N++)Z[N]=K=K+F[N-1]<<1;for(z=0;z<=w;z++){var W=a[2*z+1];W!==0&&(a[2*z]=nt(Z[W]++,W))}}function Q(a){var w;for(w=0;w>1;1<=F;F--)it(a,Z,F);for(z=Y;F=a.heap[1],a.heap[1]=a.heap[a.heap_len--],it(a,Z,1),N=a.heap[1],a.heap[--a.heap_max]=F,a.heap[--a.heap_max]=N,Z[2*z]=Z[2*F]+Z[2*N],a.depth[z]=(a.depth[F]>=a.depth[N]?a.depth[F]:a.depth[N])+1,Z[2*F+1]=Z[2*N+1]=z,a.heap[1]=z++,it(a,Z,1),2<=a.heap_len;);a.heap[--a.heap_max]=a.heap[1],(function(tt,ht){var dt,ft,pt,st,_t,bt,ct=ht.dyn_tree,vt=ht.max_code,wt=ht.stat_desc.static_tree,kt=ht.stat_desc.has_stree,xt=ht.stat_desc.extra_bits,yt=ht.stat_desc.extra_base,mt=ht.stat_desc.max_length,gt=0;for(st=0;st<=o;st++)tt.bl_count[st]=0;for(ct[2*tt.heap[tt.heap_max]+1]=0,dt=tt.heap_max+1;dt>=7;z>>=1)if(1&et&&W.dyn_ltree[2*Y]!==0)return h;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return n;for(Y=32;Y>>3,(Z=a.static_len+3+7>>>3)<=z&&(z=Z)):z=Z=F+5,F+4<=z&&w!==-1?f(a,w,F,N):a.strategy===4||Z===z?(G(a,2+(N?1:0),3),lt(a,V,m)):(G(a,4+(N?1:0),3),(function(W,Y,et,tt){var ht;for(G(W,Y-257,5),G(W,et-1,5),G(W,tt-4,4),ht=0;ht>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&w,a.pending_buf[a.l_buf+a.last_lit]=255&F,a.last_lit++,w===0?a.dyn_ltree[2*F]++:(a.matches++,w--,a.dyn_ltree[2*(r[F]+p+1)]++,a.dyn_dtree[2*C(w)]++),a.last_lit===a.lit_bufsize-1},k._tr_align=function(a){G(a,2,3),H(a,v,V),(function(w){w.bi_valid===16?(X(w,w.bi_buf),w.bi_buf=0,w.bi_valid=0):8<=w.bi_valid&&(w.pending_buf[w.pending++]=255&w.bi_buf,w.bi_buf>>=8,w.bi_valid-=8)})(a)}},{"../utils/common":41}],53:[function(b,U,k){"use strict";U.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(b,U,k){(function(l){(function(h,n){"use strict";if(!h.setImmediate){var u,_,y,p,g=1,i={},c=!1,e=h.document,o=Object.getPrototypeOf&&Object.getPrototypeOf(h);o=o&&o.setTimeout?o:h,u={}.toString.call(h.process)==="[object process]"?function(S){process.nextTick(function(){d(S)})}:(function(){if(h.postMessage&&!h.importScripts){var S=!0,x=h.onmessage;return h.onmessage=function(){S=!1},h.postMessage("","*"),h.onmessage=x,S}})()?(p="setImmediate$"+Math.random()+"$",h.addEventListener?h.addEventListener("message",v,!1):h.attachEvent("onmessage",v),function(S){h.postMessage(p+S,"*")}):h.MessageChannel?((y=new MessageChannel).port1.onmessage=function(S){d(S.data)},function(S){y.port2.postMessage(S)}):e&&"onreadystatechange"in e.createElement("script")?(_=e.documentElement,function(S){var x=e.createElement("script");x.onreadystatechange=function(){d(S),x.onreadystatechange=null,_.removeChild(x),x=null},_.appendChild(x)}):function(S){setTimeout(d,0,S)},o.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),D=0;D{let r={};for(var n in t)X(r,n,{get:t[n],enumerable:!0});return e||X(r,Symbol.toStringTag,{value:"Module"}),r},wt={};function je(t){let e=wt[t];if(e)return e;e=wt[t]=[];for(let r=0;r<128;r++){let n=String.fromCharCode(r);e.push(n)}for(let r=0;r=55296&&f<=57343?"\uFFFD\uFFFD\uFFFD":String.fromCharCode(f),i+=6;continue}}if((u&248)==240&&i+91114111?s+="\uFFFD\uFFFD\uFFFD\uFFFD":(c-=65536,s+=String.fromCharCode(55296+(c>>10),56320+(c&1023))),i+=9;continue}}s+="\uFFFD"}}return s})}Y.defaultChars=";/?:@&=+$,#",Y.componentChars="";var Ft={};function Je(t){let e=Ft[t];if(e)return e;e=Ft[t]=[];for(let r=0;r<128;r++){let n=String.fromCharCode(r);/^[0-9a-z]$/i.test(n)?e.push(n):e.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2))}for(let r=0;r=55296&&u<=57343){if(u>=55296&&u<=56319&&i+1=56320&&l<=57343){s+=encodeURIComponent(t[i]+t[i+1]),i++;continue}}s+="%EF%BF%BD"}else s+=encodeURIComponent(t[i])}return s}$.defaultChars=";/?:@&=+$,-_.!~*'()#",$.componentChars="-_.!~*'()";function pt(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function it(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Te=/^([a-z0-9.+-]+:)/i,Se=/:[0-9]*$/,Ie=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Et=["%","/","?",";","#","'","{","}","|","\\","^","`","<",">",'"',"`"," ","\r",` +`," "],yt=["/","?","#"],Le=255,Bt=/^[+a-z0-9A-Z_-]{0,63}$/,Me=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,zt={javascript:!0,"javascript:":!0},jt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function dt(t,e){if(t&&t instanceof it)return t;let r=new it;return r.parse(t,e),r}it.prototype.parse=function(t,e){let r,n,s,i=t;if(i=i.trim(),!e&&t.split("#").length===1){let o=Ie.exec(i);if(o)return this.pathname=o[1],o[2]&&(this.search=o[2]),this}let a=Te.exec(i);if(a&&(a=a[0],r=a.toLowerCase(),this.protocol=a,i=i.substr(a.length)),(e||a||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(s=i.substr(0,2)==="//",s&&!(a&&zt[a])&&(i=i.substr(2),this.slashes=!0)),!zt[a]&&(s||a&&!jt[a])){let o=-1;for(let h=0;h127?b+="x":b+=v[R];if(!b.match(Bt)){let R=h.slice(0,C),_=h.slice(C+1),k=v.match(Me);k&&(R.push(k[1]),_.unshift(k[2])),_.length&&(i=_.join(".")+i),this.hostname=R.join(".");break}}}}this.hostname.length>Le&&(this.hostname=""),p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let u=i.indexOf("#");u!==-1&&(this.hash=i.substr(u),i=i.slice(0,u));let l=i.indexOf("?");return l!==-1&&(this.search=i.substr(l),i=i.slice(0,l)),i&&(this.pathname=i),jt[r]&&this.hostname&&!this.pathname&&(this.pathname=""),this},it.prototype.parseHost=function(t){let e=Se.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var qe=W({decode:()=>Y,encode:()=>$,format:()=>pt,parse:()=>dt}),$e=W({Any:()=>Jt,Cc:()=>Tt,Cf:()=>Ze,P:()=>gt,S:()=>St,Z:()=>It}),Jt=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Tt=/[\0-\x1F\x7F-\x9F]/,Ze=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,gt=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,St=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,It=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,We=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function Ue(t){return t===0||t>=55296&&t<=57343||t>1114111}function Oe(t){return Ue(t)?65533:t>=128&&t<=159&&We[t-128]||t}function Pe(t){return t-1>>>0<127||t-160>>>0<55136?String.fromCharCode(t):String.fromCodePoint(Oe(t))}var T=(()=>{let t=new Uint8Array(127),e=0;for(let r=33;r<=126;r++)r!==34&&r!==36&&r!==92&&(t[r]=e++);return t})();function Ne(t,e,r,n,s,i){let a=t.length,u=i*90,l=0,o=()=>{let A=T[t.charCodeAt(l++)];return A=i&&(A=A*91-u+T[t.charCodeAt(l++)]);let E=d[A];if(E<0){let F=p[A],y=F+h[A];for(;F%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37w+vu9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a06Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:96Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2vyRgNj8w)v86Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|icQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf3Ds}KvGB)_6Vyk2sM=6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;RmRm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQRmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.>bU{0j9udv:Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_gg5u-rqJvy'!@9RkQcH(T#=>Ri~@Ri}@2@@=aybb}XjWv0Q~EfEj3vLv;5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=!|l=w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8waiL2b`{QJv*_Ouv2qgjZa&!*UaA=2Wls3cH#T(@Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@Ri{cNu+vlax-!(#a0qa9aY?C9:9au@9Cb]}9cl#U*5;5KqRlR=c>Z,k#u3vWs@u2]krvgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9Awwn;;Rn=c:Z'ARn<=Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(XaRn7Jw0!&>Rn5>Rn9Lunw?&a2!,5ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Shx'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUgA9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8uuq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{NaU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#cB{/T#=ayaL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[gJvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`aRfk=ayb^}4~Ad1#`*@@=aybb{w2@>==KqRlT=c>Z,k#u3vWs@u2]kqReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJRkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}wRn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']ox7gL#TzuwjirRipcon;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJRn1~?rOc:Z&Rn2=w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUgw*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!bRhG<7@C5vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2!a)-g>>Lt;return e===_t?Mt:e}function qt(t){return t-j.ZERO>>>0<=9}function Ve(t){return(t|at)-j.LOWER_A>>>0<=5}function $t(t){return(t|at)-j.LOWER_A>>>0<=25}function Qe(t){return t===j.EQUALS||$t(t)||qt(t)}var Zt;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Zt||(Zt={}));var Wt;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Wt||(Wt={}));function tr(t,e,r,n){let s=(e&B.BRANCH_LENGTH)>>7,i=e&B.JUMP_TABLE;if(i){if(s===0)return n===i?r:-1;let l=n-i;if(l>>>0>=s)return-1;let o=t[r+l];return o===0?-1:r+s+o-1&65535}if(s===0)return-1;let a=s+1>>1,u=r+a+s;for(let l=0;l>1)]>>((l&1)<<3)&255;if(o===n)return u+t[r+a+l]&65535;if(o>n)return-1}return-1}function Ut(t,e,r){return r===1?String.fromCharCode(t[e]&B.VALUE_MASK):r===2?String.fromCharCode(t[e+1]):String.fromCharCode(t[e+1],t[e+2])}function er(t,e,r){let n=e+1,s=0,i=n;if(n>>0>9)break;s=s*10+u,n+=1}if(n===i)return 0;n1114111&&(s=1114112);let a=n-e;return a>=_t&&(Mt=a,a=_t),a<>7;do{let c=s+1,d=t.charCodeAt(c),p,h;if(d===j.NUM){let C=er(t,c,i);p=He(C),e&&p>0&&t.charCodeAt(c+p-1)!==j.SEMI&&(p=0),h=p===0?"":Pe(C&Ge)}else if($t(d)){p=0,h="";let C=d-o,m;if(C>>>0>7;if(E===0){if(t.charCodeAt(_)!==A)break t;m+=1}else{let F=t.charCodeAt(_)-A;if(F>>>0>=E)break t;let y=n[m+1+F];if(y===0)break t;m=m+E+y&65535}if(R=n[m],_+=1,_>=i)break t}if((R&(B.VALUE_LENGTH|B.FLAG13))===B.FLAG13){let A=(R&B.BRANCH_LENGTH)>>7;if(t.charCodeAt(_)!==(R&B.JUMP_TABLE))break;_+=1;let E=A-1,F=m+1,y=0;for(;y+1>8&255)))break t;_+=1,F+=1}if(y>1),R=n[m];continue}let k=R>>>14,D=t.charCodeAt(_);if(k!==0){if(D===j.SEMI){p=_-c+1,h=k===1?String.fromCharCode(R&B.VALUE_MASK):Ut(n,m,k);break}if(!e&&(R&B.FLAG13)===0&&(p=_-c,v=m,b=k),k===1)break}let x=tr(n,R,m+(k||1),D);if(x<0)break;m=x,R=n[m],_+=1}if(h===""){let k=R>>>14;k!==0&&!e&&(R&B.FLAG13)===0&&(p=_-c,v=m,b=k),p>0&&(h=Ut(n,v,b))}}else p=0,h="";p===0||r&&d!==j.NUM&&t.charCodeAt(c+p-1)!==j.SEMI&&c+p=0);return u+t.slice(a)}function Ot(t){return rr(t,!0,!1)}var nr=W({arrayReplaceAt:()=>sr,asciiTrim:()=>lt,callable:()=>Pt,escapeHtml:()=>O,escapeRE:()=>dr,fromCodePoint:()=>Q,isMdAsciiPunct:()=>rt,isPunctChar:()=>Xt,isPunctCharCode:()=>et,isSpace:()=>w,isValidEntityCode:()=>mt,isWhiteSpace:()=>tt,lib:()=>gr,normalizeReference:()=>ut,unescapeAll:()=>K,unescapeMd:()=>lr});function Pt(t){let e=function(...r){return Reflect.construct(t,r,new.target&&new.target!==e?new.target:t)};return Object.defineProperty(e,"name",{value:t.name}),Object.setPrototypeOf(e,t),e.prototype=t.prototype,e}function sr(t,e,r){return[].concat(t.slice(0,e),r,t.slice(e+1))}function mt(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)==65535||(t&65535)==65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Q(t){if(t>65535){t-=65536;let e=55296+(t>>10),r=56320+(t&1023);return String.fromCharCode(e,r)}return String.fromCharCode(t)}var Nt=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,ir=RegExp(`${Nt.source}|&([a-z#][a-z0-9]{1,31});`,"gi"),ar=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function ur(t,e){if(e.charCodeAt(0)===35&&ar.test(e)){let n=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return mt(n)?Q(n):t}let r=Ot(t);return r===t?t:r}function lr(t){return t.indexOf("\\")<0?t:t.replace(Nt,"$1")}function K(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(ir,function(e,r,n){return r||ur(e,n)})}var or=/[&<>"]/,hr=/[&<>"]/g,cr={"&":"&","<":"<",">":">",'"':"""};function fr(t){return cr[t]}function O(t){return or.test(t)?t.replace(hr,fr):t}var pr=/[.?*+^$[\]\\(){}|-]/g;function dr(t){return t.replace(pr,"\\$&")}function w(t){switch(t){case 9:case 32:return!0}return!1}function tt(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Xt(t){return gt.test(t)||St.test(t)}function et(t){return Xt(Q(t))}function rt(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function ut(t){return t=t.trim().replace(/\s+/g," "),t.toLowerCase().toUpperCase()}function Yt(t){return t===32||t===9||t===10||t===13}function lt(t){let e=0;for(;e=e&&Yt(t.charCodeAt(r));r--);return t.slice(e,r+1)}var gr={mdurl:qe,ucmicro:$e};function _r(t,e,r){let n,s,i,a,u=t.posMax,l=t.pos;for(t.pos=e+1,n=1;t.pos32))return i;if(n===41){if(a===0)break;a--}s++}return e===s||a!==0||(i.str=K(t.slice(e,s)),i.pos=s,i.ok=!0),i}function Rr(t,e,r,n){let s,i=e,a={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)a.str=n.str,a.marker=n.marker;else{if(i>=r)return a;let u=t.charCodeAt(i);if(u!==34&&u!==39&&u!==40)return a;e++,i++,u===40&&(u=41),a.marker=u}for(;imr,parseLinkLabel:()=>_r,parseLinkTitle:()=>Rr}),P=class{constructor(t,e,r){g(this,"map",null),g(this,"level",0),g(this,"children",null),g(this,"content",""),g(this,"markup",""),g(this,"info",""),g(this,"block",!1),g(this,"hidden",!1),this.type=t,this.tag=e,this.attrs=null,this.nesting=r,this.meta=null}attrIndex(t){if(!this.attrs)return-1;let e=this.attrs;for(let r=0,n=e.length;r=0&&(r=this.attrs[e][1]),r}attrJoin(t,e){let r=this.attrIndex(t);r<0?this.attrPush([t,e]):this.attrs[r][1]=`${this.attrs[r][1]} ${e}`}},nt=class{constructor(){g(this,"__rules__",[]),g(this,"__cache__",null)}__find__(t){for(let e=0;e{e.enabled&&e.alt.forEach(r=>{r&&t.add(r)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(e=>{e.enabled&&this.__cache__[""].push(e.fn)}),t.forEach(e=>{this.__cache__[e]=[],this.__rules__.forEach(r=>{r.enabled&&r.alt.indexOf(e)>=0&&this.__cache__[e].push(r.fn)})})}at(t,e,r={}){let n=this.__find__(t);if(n===-1)throw Error(`Parser rule not found: ${t}`);this.__rules__[n].fn=e,this.__rules__[n].alt=r.alt||[],this.__cache__=null}before(t,e,r,n={}){let s=this.__find__(t);if(s===-1)throw Error(`Parser rule not found: ${t}`);this.__rules__.splice(s,0,{name:e,enabled:!0,fn:r,alt:n.alt||[]}),this.__cache__=null}after(t,e,r,n={}){let s=this.__find__(t);if(s===-1)throw Error(`Parser rule not found: ${t}`);this.__rules__.splice(s+1,0,{name:e,enabled:!0,fn:r,alt:n.alt||[]}),this.__cache__=null}push(t,e,r={}){this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null}enable(t,e=!1){Array.isArray(t)||(t=[t]);let r=[];return t.forEach(n=>{let s=this.__find__(n);if(s<0){if(e)return;throw Error(`Rules manager: invalid rule name ${n}`)}this.__rules__[s].enabled=!0,r.push(n)}),this.__cache__=null,r}enableOnly(t,e=!1){Array.isArray(t)||(t=[t]),this.__rules__.forEach(r=>{r.enabled=!1}),this.enable(t,e)}disable(t,e=!1){Array.isArray(t)||(t=[t]);let r=[];return t.forEach(n=>{let s=this.__find__(n);if(s<0){if(e)return;throw Error(`Rules manager: invalid rule name ${n}`)}this.__rules__[s].enabled=!1,r.push(n)}),this.__cache__=null,r}getRules(t){return this.__cache__||this.__compile__(),this.__cache__[t]||[]}},I={};I.code_inline=function(t,e,r,n,s){let i=t[e];return`${O(i.content)}`},I.code_block=function(t,e,r,n,s){let i=t[e];return`${O(t[e].content)} +`},I.fence=function(t,e,r,n,s){let i=t[e],a=i.info?K(i.info).trim():"",u="",l="";if(a){let f=a.split(/(\s+)/g);u=f[0],l=f.slice(2).join("")}let o;if(o=r.highlight&&r.highlight(i.content,u,l)||O(i.content),o.indexOf("${o} +`}return`
    ${o}
    +`},I.image=function(t,e,r,n,s){let i=t[e];return i.attrs[i.attrIndex("alt")][1]=s.renderInlineAsText(i.children,r,n),s.renderToken(t,e,r)},I.hardbreak=function(t,e,r){return r.xhtmlOut?`
    +`:`
    +`},I.softbreak=function(t,e,r){return r.breaks?r.xhtmlOut?`
    +`:`
    +`:` +`},I.text=function(t,e){return O(t[e].content)},I.html_block=function(t,e){return t[e].content},I.html_inline=function(t,e){return t[e].content};var Kt=class{constructor(){g(this,"rules",Object.assign({},I))}renderAttrs(t){let e,r,n;if(!t.attrs)return"";for(n="",e=0,r=t.attrs.length;e=0&&t[i].hidden&&t[i].nesting===0;)i--;n.block&&n.nesting!==-1&&i>=0&&t[i].hidden&&t[i].nesting===-1&&(s+=` +`),s+=(n.nesting===-1?" +`:">",s}renderInline(t,e,r){let n="",s=this.rules;for(let i=0,a=t.length;i\s]/i.test(t)}function Fr(t){return/^<\/a\s*>/i.test(t)}function Er(t){let e=t.tokens;if(t.md.options.linkify)for(let r=0,n=e.length;r=0;u--){let l=s[u];if(l.type==="link_close")for(u--;s[u].level!==l.level&&s[u].type!=="link_open";)u--;else if(l.type==="html_inline"&&(wr(l.content)&&a>0&&a--,Fr(l.content)&&a++),!(a>0)&&l.type==="text"&&t.md.linkify.test(l.content)){let o=l.content,f=t.md.linkify.match(o),c=[],d=l.level,p=0;f.length>0&&f[0].index===0&&u>0&&s[u-1].type==="text_special"&&(f=f.slice(1));for(let h=0;hp){let D=new t.Token("text","",0);D.content=o.slice(p,b),D.level=d,c.push(D)}let R=new t.Token("link_open","a",1);R.attrs=[["href",m]],R.level=d++,R.markup="linkify",R.info="auto",c.push(R);let _=new t.Token("text","",0);_.content=v,_.level=d,c.push(_);let k=new t.Token("link_close","a",-1);k.level=--d,k.markup="linkify",k.info="auto",c.push(k),p=f[h].lastIndex}if(p0){let u=s.length;for(let c of i)u+=c.nodes.length-1;let l=Array(u),o=0,f=0;i.reverse();for(let c=0;c=0;r--){let n=t[r];n.type==="text"&&!e&&(n.content=n.content.replace(Br,jr)),n.type==="link_open"&&n.info==="auto"&&e--,n.type==="link_close"&&n.info==="auto"&&e++}}function Tr(t){let e=0;for(let r=t.length-1;r>=0;r--){let n=t[r];n.type==="text"&&!e&&Ht.test(n.content)&&(n.content=n.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1\u2014").replace(/(^|\s)--(?=\s|$)/gm,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1\u2013")),n.type==="link_open"&&n.info==="auto"&&e--,n.type==="link_close"&&n.info==="auto"&&e++}}function Sr(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(yr.test(t.tokens[e].content)&&Jr(t.tokens[e].children),Ht.test(t.tokens[e].content)&&Tr(t.tokens[e].children))}var Ir=/['"]/,Vt=/['"]/g,Qt="\u2019",Lr=1e3;function te(t,e,r){for(;t.length>r;){let n=t.pop();n.isSingleQuote?e.single=n.prevSameQuoteIdx:e.double=n.prevSameQuoteIdx}}function ot(t,e,r,n){t[e]||(t[e]=[]),t[e].push({pos:r,ch:n})}function Mr(t,e){let r="",n=0;e.sort((s,i)=>s.pos-i.pos);for(let s=0;s=0&&!(n[r].level<=l);r--);if(te(n,s,r+1),u.type!=="text")continue;let o=u.content,f=0,c=o.length;t:for(;f=0)m=o.charCodeAt(d.index-1);else for(r=a-1;r>=0&&t[r].type!=="softbreak"&&t[r].type!=="hardbreak";r--)if(t[r].content){m=t[r].content.charCodeAt(t[r].content.length-1);break}let v=32;if(f=48&&m<=57&&(h=p=!1),p&&h&&(p=b,h=R),!p&&!h)C&&ot(i,a,d.index,Qt);else{if(h&&(r=C?s.single:s.double,r>=0&&n[r].level===l)){let D=n[r],x,A;C?(x=e.md.options.quotes[2],A=e.md.options.quotes[3]):(x=e.md.options.quotes[0],A=e.md.options.quotes[1]),ot(i,a,d.index,A),ot(i,D.tokenIdx,D.contentPos,x),te(n,s,r);continue t}if(p){if(n.length>=Lr)return;n.push({tokenIdx:a,contentPos:d.index,isSingleQuote:C,level:l,prevSameQuoteIdx:C?s.single:s.double}),C?s.single=n.length-1:s.double=n.length-1}else h&&C&&ot(i,a,d.index,Qt)}}}Object.keys(i).forEach(function(a){let u=Number(a);t[u].content=Mr(t[u].content,i[a])})}function $r(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&Ir.test(t.tokens[e].content)&&qr(t.tokens[e].children,t)}function Zr(t){let e,r,n=t.length;for(e=0;e0&&this.level++,this.tokens.push(n),n}isEmpty(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]}skipEmptyLines(t){for(let e=this.lineMax;te;)if(!w(this.src.charCodeAt(--t)))return t+1;return t}skipChars(t,e){for(let r=this.src.length;tr;)if(e!==this.src.charCodeAt(--t))return t+1;return t}getLines(t,e,r,n){if(t>=e)return"";let s=Array(e-t);for(let i=0,a=t;ar?s[i]=Array(u-r+1).join(" ")+this.src.slice(o,f):s[i]=this.src.slice(o,f)}return s.join("")}},Ur=65536;function kt(t,e){let r=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];return t.src.slice(r,n)}function ne(t){let e=[],r=t.length,n=0,s=t.charCodeAt(n),i=!1,a=0,u="";for(;nr)return!1;let s=e+1;if(t.sCount[s]=4)return!1;let i=t.bMarks[s]+t.tShift[s];if(i>=t.eMarks[s])return!1;let a=t.src.charCodeAt(i++);if(a!==124&&a!==45&&a!==58||i>=t.eMarks[s])return!1;let u=t.src.charCodeAt(i++);if(u!==124&&u!==45&&u!==58&&!w(u)||a===45&&w(u))return!1;for(;i=4)return!1;o=ne(l),o.length&&o[0]===""&&o.shift(),o.length&&o[o.length-1]===""&&o.pop();let c=o.length;if(c===0||c!==f.length)return!1;if(n)return!0;let d=t.parentType;t.parentType="table";let p=t.md.block.ruler.getRules("blockquote"),h=t.push("table_open","table",1),C=[e,0];h.map=C;let m=t.push("thead_open","thead",1);m.map=[e,e+1];let v=t.push("tr_open","tr",1);v.map=[e,e+1];for(let _=0;_=4||(o=ne(l),o.length&&o[0]===""&&o.shift(),o.length&&o[o.length-1]===""&&o.pop(),R+=c-o.length,R>Ur))break;if(s===e+2){let D=t.push("tbody_open","tbody",1);D.map=b=[e+2,0]}let k=t.push("tr_open","tr",1);k.map=[s,s+1];for(let D=0;D=4)n++,s=n;else break;t.line=s;let i=t.push("code_block","code",0);return i.content=t.getLines(e,s,4+t.blkIndent,!1)+` +`,i.map=[e,t.line],!0}function Nr(t,e,r,n){let s=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||s+3>i)return!1;let a=t.src.charCodeAt(s);if(a!==126&&a!==96)return!1;let u=s;s=t.skipChars(s,a);let l=s-u;if(l<3)return!1;let o=t.src.slice(u,s),f=t.src.slice(s,i);if(a===96&&f.indexOf(String.fromCharCode(a))>=0)return!1;if(n)return!0;let c=e,d=!1;for(;c++,!(c>=r||(s=u=t.bMarks[c]+t.tShift[c],i=t.eMarks[c],s=4)&&(s=t.skipChars(s,a),!(s-u=4||t.src.charCodeAt(s)!==62)return!1;if(n)return!0;let u=[],l=[],o=[],f=[],c=t.md.block.ruler.getRules("blockquote"),d=t.parentType;t.parentType="blockquote";let p=!1,h;for(h=e;h=i)break;if(t.src.charCodeAt(s++)===62&&!R){let k=t.sCount[h]+1,D,x;t.src.charCodeAt(s)===32?(s++,k++,x=!1,D=!0):t.src.charCodeAt(s)===9?(D=!0,(t.bsCount[h]+k)%4==3?(s++,k++,x=!1):x=!0):D=!1;let A=k;for(u.push(t.bMarks[h]),t.bMarks[h]=s;s=i,l.push(t.bsCount[h]),t.bsCount[h]=t.sCount[h]+1+ +!!D,o.push(t.sCount[h]),t.sCount[h]=A-k,f.push(t.tShift[h]),t.tShift[h]=s-t.bMarks[h];continue}if(p)break;let _=!1;for(let k=0,D=c.length;k";let v=[e,0];m.map=v,t.md.block.tokenize(t,e,h);let b=t.push("blockquote_close","blockquote",-1);b.markup=">",t.lineMax=a,t.parentType=d,v[1]=t.line;for(let R=0;R=4)return!1;let i=t.bMarks[e]+t.tShift[e],a=t.src.charCodeAt(i++);if(a!==42&&a!==45&&a!==95)return!1;let u=1;for(;i=n)return-1;let i=t.src.charCodeAt(s++);if(i<48||i>57)return-1;for(;;){if(s>=n)return-1;if(i=t.src.charCodeAt(s++),i>=48&&i<=57){if(s-r>=10)return-1}else{if(i===41||i===46)break;return-1}}return s=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]=t.blkIndent&&(f=!0);let c,d,p;if((p=ie(t,l))>=0){if(c=!0,a=t.bMarks[l]+t.tShift[l],d=Number(t.src.slice(a,p-1)),f&&d!==1)return!1}else if((p=se(t,l))>=0)c=!1;else return!1;if(f&&t.skipSpaces(p)>=t.eMarks[l])return!1;if(n)return!0;let h=t.src.charCodeAt(p-1),C=t.tokens.length;c?(u=t.push("ordered_list_open","ol",1),d!==1&&(u.attrs=[["start",d]])):u=t.push("bullet_list_open","ul",1);let m=[l,0];u.map=m,u.markup=String.fromCharCode(h);let v=!1,b=t.md.block.ruler.getRules("list"),R=t.parentType;for(t.parentType="list";l=s?1:k-_,x>4&&(x=1);let A=_+x;u=t.push("list_item_open","li",1),u.markup=String.fromCharCode(h);let E=[l,0];u.map=E,c&&(u.info=t.src.slice(a,p-1));let F=t.tight,y=t.tShift[l],J=t.sCount[l],S=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=A,t.tight=!0,t.tShift[l]=D-t.bMarks[l],t.sCount[l]=k,D>=s&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,r):t.md.block.tokenize(t,l,r),(!t.tight||v)&&(o=!1),v=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=S,t.tShift[l]=y,t.sCount[l]=J,t.tight=F,u=t.push("list_item_close","li",-1),u.markup=String.fromCharCode(h),l=t.line,E[1]=l,l>=r||t.sCount[l]=4)break;let q=!1;for(let H=0,es=b.length;H56319)continue;let s=t.charCodeAt(r+1);s>=56320&&s<=57343&&(e--,r++)}return e}function st(t,e){return Math.min(t.eMarks[e]+1,t.src.length)}function ht(t,e){let r=t.lineMax;if(e>=r||t.isEmpty(e))return-1;let n=!1;if(t.sCount[e]-t.blkIndent>3&&(n=!0),t.sCount[e]<0&&(n=!0),!n){let s=t.md.block.ruler.getRules("reference"),i=t.parentType;t.parentType="reference";let a=!1;for(let u=0,l=s.length;u=4||s.charCodeAt(i)!==91)return!1;let u=st(t,e),l="",o=-1,f=++i;for(;ibt*2)return!1;let D=s.charCodeAt(i);if(D===91)return!1;if(D===93){o=i;break}if(D===92&&(D=s.charCodeAt(++i)),D===10&&ibt&&Hr(l)>bt))return!1;for(i=o+2;i\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,ue="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";RegExp(`^(?:${ae}|${ue}||<[?][\\s\\S]*?[?]>|]*>|)`);var le=RegExp(`^(?:${ae}|${ue})`),N=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[RegExp(`^|$))`,"i"),/^$/,!0],[RegExp(`${le.source}\\s*$`),/^$/,!1]];function tn(t,e,r,n){let s=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(s)!==60)return!1;let a=t.src.slice(s,i),u=0;for(;u=4)return!1;let a=t.src.charCodeAt(s);if(a!==35||s>=i)return!1;let u=1;for(a=t.src.charCodeAt(++s);a===35&&s6||ss&&w(t.src.charCodeAt(l-1))&&(i=l),t.line=e+1;let o=t.push("heading_open",`h${u}`,1);o.markup="########".slice(0,u),o.map=[e,t.line];let f=t.push("inline","",0);f.content=lt(t.src.slice(s,i)),f.map=[e,t.line],f.children=[];let c=t.push("heading_close",`h${u}`,-1);return c.markup="########".slice(0,u),!0}function rn(t,e,r){let n=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.parentType;t.parentType="paragraph";let i=0,a,u=e+1;for(;u3)continue;if(t.sCount[u]>=t.blkIndent){let p=t.bMarks[u]+t.tShift[u],h=t.eMarks[u];if(p=h))){i=a===61?1:2;break}}if(t.sCount[u]<0)continue;let d=!1;for(let p=0,h=n.length;p3||t.sCount[i]<0)continue;let o=!1;for(let f=0,c=n.length;f=r||t.sCount[a]=i){t.line=r;break}let l=t.line,o=!1;for(let f=0;f=t.line)throw Error("block rule didn't increment state.line");break}if(!o)throw Error("none of the block rules matched");t.tight=!u,t.isEmpty(t.line-1)&&(u=!0),a=t.line,a0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(s),n}scanDelims(t,e){let r=this.posMax,n=this.src.charCodeAt(t),s;if(t===0)s=32;else if(t===1)s=this.src.charCodeAt(0),(s&63488)==55296&&(s=65533);else if(s=this.src.charCodeAt(t-1),(s&64512)==56320){let h=this.src.charCodeAt(t-2);s=(h&64512)==55296?65536+(h-55296<<10)+(s-56320):65533}else(s&64512)==55296&&(s=65533);let i=t;for(;i=65&&t<=90||t>=97&&t<=122}function ln(t){return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===43||t===45||t===46}function on(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;let r=t.pos,n=t.posMax;if(r+3>n||t.src.charCodeAt(r)!==58||t.src.charCodeAt(r+1)!==47||t.src.charCodeAt(r+2)!==47)return!1;let s=r-Math.min(10,t.pending.length,r),i=r;for(;i>s&&ln(t.src.charCodeAt(i-1));)i--;if(i===r||!un(t.src.charCodeAt(i)))return!1;let a=r-i,u=t.md.linkify.matchAtStart(t.src.slice(i));if(!u)return!1;let l=u.url;if(l.length<=a)return!1;let o=l.length;for(;o>0&&l.charCodeAt(o-1)===42;)o--;o!==l.length&&(l=l.slice(0,o));let f=t.md.normalizeLink(l);if(!t.md.validateLink(f))return!1;if(!e){t.pending=t.pending.slice(0,-a);let c=t.push("link_open","a",1);c.attrs=[["href",f]],c.markup="linkify",c.info="auto";let d=t.push("text","",0);d.content=t.md.normalizeLinkText(l);let p=t.push("link_close","a",-1);p.markup="linkify",p.info="auto"}return t.pos+=l.length-a,!0}function hn(t,e){let r=t.pos;if(t.src.charCodeAt(r)!==10)return!1;let n=t.pending.length-1,s=t.posMax;if(!e)if(n>=0&&t.pending.charCodeAt(n)===32)if(n>=1&&t.pending.charCodeAt(n-1)===32){let i=n-1;for(;i>=1&&t.pending.charCodeAt(i-1)===32;)i--;t.pending=t.pending.slice(0,i),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(r++;r?@[]^_`{|}~-".split("").forEach(function(t){vt[t.charCodeAt(0)]=1});function cn(t,e){let r=t.pos,n=t.posMax;if(t.src.charCodeAt(r)!==92||(r++,r>=n))return!1;let s=t.src.charCodeAt(r);if(s===10){for(e||t.push("hardbreak","br",0),r++;r=55296&&s<=56319&&r+1=56320&&u<=57343&&(i+=t.src[r+1],r++)}let a="\\"+i;if(!e){let u=t.push("text_special","",0);u.content=s<256&&vt[s]!==0?i:a,u.markup=a,u.info="escape"}return t.pos=r+1,!0}function fn(t){let e={},r=0;for(;(r=t.indexOf("`",r))!==-1;){let n=r;for(;t.charCodeAt(++r)===96;);e[r-n]=n}return e}function pn(t,e){var r;let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;let s=t.posMax,i=n+1;for(;i=i){let l=i,o;for(;(o=t.src.indexOf("`",l))!==-1&&os)break;if(l-o===u){if(!e){let f=t.push("code_inline","code",0);f.markup=a;let c=t.src.slice(i,o).replace(/\n/g," ");c.startsWith(" ")&&c.endsWith(" ")&&/[^ ]/.test(c)&&(c=c.slice(1,-1)),f.content=c}return t.pos=l,!0}}}return e||(t.pending+=a),t.pos=i,!0}function dn(t,e){let r=t.pos,n=t.src.charCodeAt(r);if(e||n!==126)return!1;let s=t.scanDelims(t.pos,!0),i=s.length,a=String.fromCharCode(n);if(i<2)return!1;let u;i%2&&(u=t.push("text","",0),u.content=a,i--);for(let l=0;l=0;n--){let s=e[n];if(s.marker!==95&&s.marker!==42||s.end===-1)continue;let i=e[s.end],a=n>0&&e[n-1].end===s.end+1&&e[n-1].marker===s.marker&&e[n-1].token===s.token-1&&e[s.end+1].token===i.token+1,u=String.fromCharCode(s.marker),l=t.tokens[s.token];l.type=a?"strong_open":"em_open",l.tag=a?"strong":"em",l.nesting=1,l.markup=a?u+u:u,l.content="";let o=t.tokens[i.token];o.type=a?"strong_close":"em_close",o.tag=a?"strong":"em",o.nesting=-1,o.markup=a?u+u:u,o.content="",a&&(t.tokens[e[n-1].token].content="",t.tokens[e[s.end+1].token].content="",n--)}}function mn(t){let e=t.tokens_meta,r=t.tokens_meta.length;pe(t,t.delimiters);for(let s=0;s=c)return!1;if(l=h,s=t.md.helpers.parseLinkDestination(t.src,h,t.posMax),s.ok){for(a=t.md.normalizeLink(s.str),t.md.validateLink(a)?h=s.pos:a="",l=h;h=c||t.src.charCodeAt(h)!==41)&&(o=!0),h++}if(o){if(t.env.references===void 0)return!1;if(h=0?n=t.src.slice(l,h++):h=p+1):h=p+1,n||(n=t.src.slice(d,p)),n=ut(n),i=t.env.references[n],!i)return t.pos=f,!1;a=i.href,u=i.title}if(!e){t.pos=d,t.posMax=p;let C=t.push("link_open","a",1),m=[["href",a]];if(C.attrs=m,u&&m.push(["title",u]),n){let v=Object.create(null);v.label=n,C.meta=v}t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=h,t.posMax=c,!0}function kn(t,e){let r,n,s,i,a,u,l,o,f="",c=t.pos,d=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;let p=t.pos+2,h=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(h<0)return!1;if(i=h+1,i=d)return!1;for(o=i,u=t.md.helpers.parseLinkDestination(t.src,i,t.posMax),u.ok&&(f=t.md.normalizeLink(u.str),t.md.validateLink(f)?i=u.pos:f=""),o=i;i=d||t.src.charCodeAt(i)!==41)return t.pos=c,!1;i++}else{if(t.env.references===void 0)return!1;if(i=0?s=t.src.slice(o,i++):i=h+1):i=h+1,s||(s=t.src.slice(p,h)),s=ut(s),a=t.env.references[s],!a)return t.pos=c,!1;f=a.href,l=a.title}if(!e){n=t.src.slice(p,h);let C=[];t.md.inline.parse(n,t.md,t.env,C);let m=t.push("image","img",0),v=[["src",f],["alt",""]];if(m.attrs=v,m.children=C,m.content=n,l&&v.push(["title",l]),s){let b=Object.create(null);b.label=s,m.meta=b}}return t.pos=i,t.posMax=d,!0}var bn=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,vn=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Dn(t,e){let r=t.pos;if(t.src.charCodeAt(r)!==60)return!1;let n=t.pos,s=t.posMax;for(;;){if(++r>=s)return!1;let a=t.src.charCodeAt(r);if(a===60)return!1;if(a===62)break}let i=t.src.slice(n+1,r);if(vn.test(i)){let a=t.md.normalizeLink(i);if(!t.md.validateLink(a))return!1;if(!e){let u=t.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";let l=t.push("text","",0);l.content=t.md.normalizeLinkText(i);let o=t.push("link_close","a",-1);o.markup="autolink",o.info="auto"}return t.pos+=i.length+2,!0}if(bn.test(i)){let a=t.md.normalizeLink(`mailto:${i}`);if(!t.md.validateLink(a))return!1;if(!e){let u=t.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";let l=t.push("text","",0);l.content=t.md.normalizeLinkText(i);let o=t.push("link_close","a",-1);o.markup="autolink",o.info="auto"}return t.pos+=i.length+2,!0}return!1}function Cn(t){return/^\s]/i.test(t)}function An(t){return/^<\/a\s*>/i.test(t)}function ge(t){let e=t|32;return e>=97&&e<=122}function xn(t,e){let r=t.src,n,s;if(r.startsWith(""}else if(r.startsWith("";else if(r.charCodeAt(e+1)===63)n=e+2,s="?>";else if(ge(r.charCodeAt(e+2)))n=e+3,s=">";else return-1;if(t.skipHtmlSpecial)return-1;let i=r.indexOf(s,n);return i<0?(t.skipHtmlSpecial=!0,-1):i+s.length}function wn(t,e){if(!t.md.options.html)return!1;let r=t.posMax,n=t.pos;if(t.src.charCodeAt(n)!==60||n+2>=r)return!1;let s,i=t.src.charCodeAt(n+1);if(i===33||i===63)s=xn(t,n);else if(i===47||ge(i)){let a=t.src.slice(n).match(le);s=a?n+a[0].length:-1}else return!1;if(s<0)return!1;if(!e){let a=t.push("html_inline","",0);a.content=t.src.slice(n,s),Cn(a.content)&&t.linkLevel++,An(a.content)&&t.linkLevel--}return t.pos=s,!0}var Fn=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,En=/^&([a-z][a-z0-9]{1,31});/i;function yn(t,e){let r=t.pos,n=t.posMax;if(t.src.charCodeAt(r)!==38||r+1>=n)return!1;if(t.src.charCodeAt(r+1)===35){let s=t.src.slice(r).match(Fn);if(s){if(!e){let i=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=t.push("text_special","",0);a.content=mt(i)?Q(i):Q(65533),a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}else{let s=t.src.slice(r).match(En);if(s){let i=Ot(s[0]);if(i!==s[0]){if(!e){let a=t.push("text_special","",0);a.content=i,a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function _e(t){let e={},r=t.length;if(!r)return;let n=0,s=-2,i=[];for(let a=0;al;o-=i[o]+1){let c=t[o];if(c.marker===u.marker&&c.open&&c.end<0){let d=!1;if((c.close||u.open)&&(c.length+u.length)%3==0&&(c.length%3!=0||u.length%3!=0)&&(d=!0),!d){let p=o>0&&!t[o-1].open?i[o-1]+1:0;i[a]=a-o+p,i[o]=p,u.open=!1,c.end=a,c.close=!1,f=-1,s=-2;break}}}f!==-1&&(e[u.marker][(u.open?3:0)+(u.length||0)%3]=f)}}function Bn(t){let e=t.tokens_meta,r=t.tokens_meta.length;_e(t.delimiters);for(let s=0;s0&&n++,s[e].type==="text"&&e+1=t.pos)throw Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;a||t.pos++,i[e]=t.pos}tokenize(t){let e=this.ruler.getRules(""),r=e.length,n=t.posMax,s=t.md.options.maxNesting;for(;t.pos=t.pos)throw Error("inline rule didn't increment state.pos");break}}if(a){if(t.pos>=n)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()}parse(t,e,r,n){let s=new this.State(t,e,r,n);this.tokenize(s);let i=this.ruler2.getRules(""),a=i.length;for(let u=0;u<\uff5c]/:e}get_pseudo_letter(){var t,e;return(e=(t=this.cache).src_pseudo_letter)==null?t.src_pseudo_letter=RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`):e}get_ipv4_addr(){var t,e;return(e=(t=this.cache).src_ip4)==null?t.src_ip4=RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])"):e}get_ipv6_addr(){var t,e;let r="[0-9A-Fa-f]{1,4}",n=`(?:(?:${r}:${r})|${this.get_ipv4_addr().source})`;return(e=(t=this.cache).src_ip6_addr)==null?t.src_ip6_addr=RegExp(`(?:(?:${r}:){6}${n}|::(?:${r}:){5}${n}|(?:${r})?::(?:${r}:){4}${n}|(?:(?:${r}:){0,1}${r})?::(?:${r}:){3}${n}|(?:(?:${r}:){0,2}${r})?::(?:${r}:){2}${n}|(?:(?:${r}:){0,3}${r})?::${r}:${n}|(?:(?:${r}:){0,4}${r})?::${n}|(?:(?:${r}:){0,5}${r})?::${r}|(?:(?:${r}:){0,6}${r})?::)`):e}get_ipv6_url_host(){var t,e;return(e=(t=this.cache).src_ip6_host)==null?t.src_ip6_host=RegExp(`\\[${this.get_ipv6_addr().source}\\]`):e}get_ipv6_mail_host(){var t,e;return(e=(t=this.cache).src_ipv6_mail_host)==null?t.src_ipv6_mail_host=RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`):e}get_auth(){var t,e;return(e=(t=this.cache).src_auth)==null?t.src_auth=RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`):e}get_port(){var t,e;return(e=(t=this.cache).src_port)==null?t.src_port=RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?"):e}get_host_terminator(){var t,e;return(e=(t=this.cache).src_host_terminator)==null?t.src_host_terminator=RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`):e}get_path_terminator(){var t,e;return(e=(t=this.cache).src_path_terminator)==null?t.src_path_terminator=RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`):e}get_path(){var t,e;return(e=(t=this.cache).src_path)==null?t.src_path=RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`):e}get_mail_name(){var t,e;return(e=(t=this.cache).src_mail_name)==null?t.src_mail_name=RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}"):e}get_xn(){var t,e;return(e=(t=this.cache).src_xn)==null?t.src_xn=RegExp("xn--[a-z0-9\\-]{1,59}"):e}get_tld(){if(this.cache.tld)return this.cache.tld;let t=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=RegExp(`${t||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){var t,e;return(e=(t=this.cache).src_domain_root)==null?t.src_domain_root=RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`):e}get_domain(){var t,e;return(e=(t=this.cache).src_domain)==null?t.src_domain=RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`):e}get_url_host_port(){var t,e;return(e=(t=this.cache).url_host_port)==null?t.url_host_port=RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source):e}get_fuzzy_url_host_port(){var t,e;return(e=(t=this.cache).fuzzy_url_host_port)==null?t.fuzzy_url_host_port=RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source):e}get_mail_host(){var t,e;return(e=(t=this.cache).src_mail_host)==null?t.src_mail_host=RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source):e}get_fuzzy_mail_host(){var t,e;return(e=(t=this.cache).src_fuzzy_mail_host)==null?t.src_fuzzy_mail_host=RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source):e}get_path_extra(){var t,e;return(e=(t=this.cache).src_path_extra)==null?t.src_path_extra=RegExp(""):e}get_fuzzy_mail_host_search(){var t,e;return(e=(t=this.cache).mail_fuzzy_host_search)==null?t.mail_fuzzy_host_search=RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig"):e}get_fuzzy_link_search(){var t,e;return(e=(t=this.cache).link_fuzzy_search)==null?t.link_fuzzy_search=RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uFF5C]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uFF5C])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig"):e}get_http_validator(){var t,e;return(e=(t=this.cache).http_validator)==null?t.http_validator=RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy"):e}get_relative_proto_validator(){var t,e;return(e=(t=this.cache).relative_proto_validator)==null?t.relative_proto_validator=RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy"):e}get_mail_name_validator(){var t,e;return(e=(t=this.cache).mail_name_validator)==null?t.mail_name_validator=RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`):e}get_mailto_validator(){var t,e;return(e=(t=this.cache).mailto_validator)==null?t.mailto_validator=RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy"):e}get_schema_names(){var t,e;return(e=(t=this.cache).schema_names)==null?t.schema_names=new RegExp((this.opts.schema_names||[]).map(r=>this.escapeRE(r)).join("|")):e}get_schema_search(){var t,e;return(e=(t=this.cache).schema_search)==null?t.schema_search=RegExp(`(^|(?!_)(?:[><\uFF5C]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig"):e}get_schema_at_start(){var t,e;return(e=(t=this.cache).schema_at_start)==null?t.schema_at_start=RegExp(`^${this.get_schema_search().source}`,"i"):e}},At={validate:(t,e,r)=>{let n=r.re.get_http_validator();n.lastIndex=e;let s=n.exec(t);return s?s[0].length:0},normalize:(t,e)=>e.normalize(t)},In={"http:":At,"https:":At,"ftp:":At,"//":{validate:function(t,e,r){let n=r.re.get_relative_proto_validator();n.lastIndex=e;let s=n.exec(t);return s?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:s[0].length:0},normalize:(t,e)=>e.normalize(t)},"mailto:":{validate:function(t,e,r){let n=r.re.get_mailto_validator();n.lastIndex=e;let s=n.exec(t);return s?s[0].length:0},normalize:(t,e)=>e.normalize(t)}},Ln="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",Mn="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444";function qn(){let t=Mn.split("|");return Ln.split("|").forEach(e=>{let r=e.indexOf(":"),n=e.slice(0,r);for(let s of e.slice(r+1))t.push(n+s)}),t}var $n={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:qn(),urlAuth:!1,maxLength:1e4},ke=class{constructor(t,e,r,n){g(this,"schema",void 0),g(this,"index",void 0),g(this,"lastIndex",void 0),g(this,"raw",void 0),g(this,"text",void 0),g(this,"url",void 0);let s=t.slice(r,n);this.schema=e.toLowerCase(),this.index=r,this.lastIndex=n,this.raw=s,this.text=s,this.url=s}},Zn=class{constructor(t={}){g(this,"__opts__",void 0),g(this,"__schemas__",void 0),g(this,"re",void 0);let{rebuilder:e}=t,r=Jn(t,Tn);this.__opts__=z(z({},$n),r),this.__schemas__=z({},In),this.re=e||new Sn,this.re.set(z(z({},this.__opts__),{},{schema_names:Object.keys(this.__schemas__)}))}add(t,e=null){if(!e)delete this.__schemas__[t];else{let r=z({normalize:(n,s)=>s.normalize(n)},e);this.__schemas__[t]=r}return this.re.set(z(z({},this.__opts__),{},{schema_names:Object.keys(this.__schemas__)})),this}set(t={}){return this.__opts__=z(z({},this.__opts__),t),this.re.set(z(z({},this.__opts__),{},{schema_names:Object.keys(this.__schemas__)})),this}test(t){if(!t.length)return!1;let e,r;for(r=this.re.get_schema_search(),r.lastIndex=0;(e=r.exec(t))!==null;)if(this.testSchemaAt(t,e[2],r.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0,r.exec(t)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&t.indexOf("@")>=0){let n=this.re.get_fuzzy_mail_host_search(),s=this.re.get_mail_name_validator();for(n.lastIndex=0;(e=n.exec(t))!==null;){let i=t.slice(Math.max(0,e.index-65),e.index);if(s.test(i))return!0}}return!1}testSchemaAt(t,e,r){return this.__schemas__[e.toLowerCase()]?this.__schemas__[e.toLowerCase()].validate(t.slice(0,r+this.__opts__.maxLength),r,this):0}match(t){let e=[],r=this.re.get_schema_search(),n,s,i,a,u,l,o=!1,f=!1,c=!1,d=0;if(!t.length)return null;for(r.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(s=this.re.get_fuzzy_mail_host_search(),s.lastIndex=0,i=this.re.get_mail_name_validator());;){let p=Math.max(d-1,0);if(s&&i&&!c&&(!u||u.index=d)break;s.lastIndex=d)break;n.lastIndexh.lastIndex))&&(h=a);let C;if(!o)for(;;){if(!l){r.lastIndexh.index)break;let b=l;l=void 0;let R=this.testSchemaAt(t,b.schema,b.lastIndex);if(R){C={schema:b.schema,index:b.index,lastIndex:b.lastIndex+R};break}}let m=C;if((!m||u&&(u.indexm.lastIndex))&&(m=u),(!m||a&&(a.indexm.lastIndex))&&(m=a),!m)break;m===u?u=void 0:m===a&&(a=void 0);let v=new ke(t,m.schema,m.index,m.lastIndex);v.schema?this.__schemas__[v.schema].normalize(v,this):this.normalize(v),e.push(v),d=m.lastIndex}return e.length?e:null}matchAtStart(t){if(!t.length)return null;let e=this.re.get_schema_at_start().exec(t);if(!e)return null;let r=this.testSchemaAt(t,e[2],e[0].length);if(!r)return null;let n=new ke(t,e[2],e.index+e[1].length,e.index+e[0].length+r);return this.__schemas__[n.schema].normalize(n,this),n}tlds(t,e=!1){return t=Array.isArray(t)?t:[t],e?this.__opts__.tlds=this.__opts__.tlds.concat(t):this.__opts__.tlds=t,this.re.set(z(z({},this.__opts__),{},{schema_names:Object.keys(this.__schemas__)})),this}normalize(t){t.schema||(t.url=`http://${t.url}`),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url=`mailto:${t.url}`)}},G=2147483647,Z=36,be=1,ft=26,Wn=38,Un=700,ve=72,De=128,Ce="-",On=/^xn--/,Pn=/[^\0-\x7F]/,Nn=/[\x2E\u3002\uFF0E\uFF61]/g,Xn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Yn=35,L=Math.floor,xt=String.fromCharCode;function U(t){throw RangeError(Xn[t])}function Kn(t,e){let r=[],n=t.length;for(;n--;)r[n]=e(t[n]);return r}function Ae(t,e){let r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(Nn,".");let s=Kn(t.split("."),e).join(".");return n+s}function xe(t){let e=[],r=0,n=t.length;for(;r=55296&&s<=56319&&rString.fromCodePoint(...t),Hn=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Z},we=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Fe=function(t,e,r){let n=0;for(t=r?L(t/Un):t>>1,t+=L(t/e);t>455;n+=Z)t=L(t/Yn);return L(n+36*t/(t+Wn))},Ee=function(t){let e=[],r=t.length,n=0,s=De,i=ve,a=t.lastIndexOf(Ce);a<0&&(a=0);for(let u=0;u=128&&U("not-basic"),e.push(t.charCodeAt(u));for(let u=a>0?a+1:0;u=r&&U("invalid-input");let d=Hn(t.charCodeAt(u++));d>=Z&&U("invalid-input"),d>L((G-n)/f)&&U("overflow"),n+=d*f;let p=c<=i?be:c>=i+ft?ft:c-i;if(dL(G/h)&&U("overflow"),f*=h}let o=e.length+1;i=Fe(n-l,o,l==0),L(n/o)>G-s&&U("overflow"),s+=L(n/o),n%=o,e.splice(n++,0,s)}return String.fromCodePoint(...e)},ye=function(t){let e=[];t=xe(t);let r=t.length,n=De,s=0,i=ve;for(let l of t)l<128&&e.push(xt(l));let a=e.length,u=a;for(a&&e.push(Ce);u=n&&fL((G-s)/o)&&U("overflow"),s+=(l-n)*o,n=l;for(let f of t)if(fG&&U("overflow"),f===n){let c=s;for(let d=Z;;d+=Z){let p=d<=i?be:d>=i+ft?ft:d-i;if(c=0))try{e.hostname=Be.toASCII(e.hostname)}catch(r){}return e.auth&&(e.auth=$(e.auth)),e.hostname&&(e.hostname=$(e.hostname)),e.pathname&&(e.pathname=$(e.pathname)),e.search&&(e.search=$(e.search)),e.hash&&(e.hash=$(e.hash)),pt(e)}normalizeLinkText(t){let e=dt(t,!0);if(e.hostname&&(!e.protocol||ze.indexOf(e.protocol)>=0))try{e.hostname=Be.toUnicode(e.hostname)}catch(r){}return Y(pt(e),Y.defaultChars+"%")}constructor(...t){g(this,"inline",new me),g(this,"block",new oe),g(this,"core",new ee),g(this,"renderer",new Kt),g(this,"linkify",new Zn),g(this,"utils",nr),g(this,"helpers",Object.assign({},kr));let[e,r]=t;typeof e=="string"?(this.configure(e),r&&this.set(r)):(this.configure("default"),this.set(e||{}))}set(t){return Object.assign(this.options,t),this}configure(t){let e;if(typeof t=="string"){let s=t;if(e=Vn[s],!e)throw Error(`Wrong 'markdown-it' preset "${s}", check name`)}else e=t;if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");e.options&&(this.options=z({},e.options));let r=e.components;if(r){var n;["core","block","inline"].forEach(i=>{var a;let u=(a=r[i])==null?void 0:a.rules;u&&this[i].ruler.enableOnly(u)});let s=(n=r.inline)==null?void 0:n.rules2;s&&this.inline.ruler2.enableOnly(s)}return this}enable(t,e=!1){let r=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(s=>{r=r.concat(this[s].ruler.enable(t,!0))}),r=r.concat(this.inline.ruler2.enable(t,!0));let n=t.filter(s=>r.indexOf(s)<0);if(n.length&&!e)throw Error(`MarkdownIt. Failed to enable unknown rule(s): ${n}`);return this}disable(t,e=!1){let r=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(s=>{r=r.concat(this[s].ruler.disable(t,!0))}),r=r.concat(this.inline.ruler2.disable(t,!0));let n=t.filter(s=>r.indexOf(s)<0);if(n.length&&!e)throw Error(`MarkdownIt. Failed to disable unknown rule(s): ${n}`);return this}use(t,...e){return t.apply(t,[this,...e]),this}parse(t,e){if(typeof t!="string")throw Error("Input data should be a String");let r=new this.core.State(t,this,e);return this.core.process(r),r.tokens}render(t,e={}){return this.renderer.render(this.parse(t,e),this.options,e)}parseInline(t,e){let r=new this.core.State(t,this,e);return r.inlineMode=!0,this.core.process(r),r.tokens}renderInline(t,e={}){return this.renderer.render(this.parseInline(t,e),this.options,e)}};return g(M,"Token",P),g(M,"Ruler",nt),g(M,"Renderer",Kt),g(M,"ParserCore",ee),g(M,"StateCore",Gt),g(M,"ParserBlock",oe),g(M,"StateBlock",re),g(M,"ParserInline",me),g(M,"StateInline",he),Pt(M)}); diff --git a/suixinkan/Resources/TrainingDocumentPreview/vendor/purify.min.js b/suixinkan/Resources/TrainingDocumentPreview/vendor/purify.min.js new file mode 100644 index 0000000..ebbb3da --- /dev/null +++ b/suixinkan/Resources/TrainingDocumentPreview/vendor/purify.min.js @@ -0,0 +1,3 @@ +/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */(function(ht,rt){typeof exports=="object"&&typeof module<"u"?module.exports=rt():typeof define=="function"&&define.amd?define([],rt):(ht=typeof globalThis<"u"?globalThis:ht||self,ht.DOMPurify=rt())})(this,function(){"use strict";function ht(r,i){this.v=r,this.k=i}function rt(r,i){(i==null||i>r.length)&&(i=r.length);for(var a=0,c=Array(i);a"u"?null:d(BigInt.prototype.toString),Le=typeof Symbol>"u"?null:d(Symbol.prototype.toString),N=d(Object.prototype.hasOwnProperty),Tt=d(Object.prototype.toString),x=d(RegExp.prototype.test),W=Me(TypeError);function d(r){return function(i){i instanceof RegExp&&(i.lastIndex=0);var a=[...arguments].slice(1);return jt(r,i,a)}}function Me(r){return function(){return Ht(r,[...arguments])}}function f(r,i){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:K;if(_e&&_e(r,null),!it(i))return r;let c=i.length;for(;c--;){let A=i[c];if(typeof A=="string"){let m=a(A);m!==A&&(Cn(i)||(i[c]=m),A=m)}r[A]=!0}return r}function Un(r){for(let i=0;i/g),qn=w(/\${[\w\W]*/g),Xn=w(/^data-[\-\w.\u00B7-\uFFFF]+$/),$n=w(/^aria-[\-\w]+$/),je=w(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kn=w(/^(?:\w+script|data):/i),Vn=w(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zn=w(/^html$/i),Jn=w(/^[a-z][.\w]*(-[.\w]+)+$/i),Kt=w(/<[/\w!]/g),He=w(/<[/\w]/g),Qn=w(/<\/no(script|embed|frames)/i),Be=w(/\/>/i),v={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},tr=E(f({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),er=function(){return typeof window>"u"?null:window},nr=function(r,i){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let a=null,c="data-tt-policy-suffix";i&&i.hasAttribute(c)&&(a=i.getAttribute(c));let A="dompurify"+(a?"#"+a:"");try{return r.createPolicy(A,{createHTML(m){return m},createScriptURL(m){return m}})}catch(m){return console.warn("TrustedTypes policy "+A+" could not be created."),null}},We=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},G=function(r,i,a,c){return N(r,i)&&it(r[i])?f(c.base?C(c.base):{},r[i],c.transform):a},Vt=function(r,i,a){let c=N(r,i)?r[i]:void 0;return c&&typeof c=="object"?C(c):a()};function Ye(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:er(),i=t=>Ye(t);if(i.version="3.4.17",i.removed=[],!r||!r.document||r.document.nodeType!==v.document||!r.Element)return i.isSupported=!1,i;let a=r.document,c=a,A=c.currentScript;r.DocumentFragment;let m=r.HTMLTemplateElement,T=r.Node,P=r.Element,y=r.NodeFilter;r.NamedNodeMap===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let U=r.DOMParser,O=r.trustedTypes,I=P.prototype,rr=R(I,"cloneNode"),Zt=R(I,"remove"),Ge=R(I,"removeAttributeNode"),or=R(I,"nextSibling"),St=R(I,"childNodes"),at=R(I,"parentNode"),Jt=R(I,"shadowRoot"),Qt=R(I,"attributes"),V=T&&T.prototype?R(T.prototype,"nodeType"):null,lt=T&&T.prototype?R(T.prototype,"nodeName"):null,kt=T&&T.prototype?R(T.prototype,"ownerDocument"):null,L=function(t){return V?V(t):t.nodeType},vt=function(t){return lt?lt(t):t.nodeName},qe=jn(I,"namespaceURI"),te=function(t){return qe?qe(t):t.namespaceURI};if(typeof m=="function"){let t=a.createElement("template");t.content&&t.content.ownerDocument&&(a=t.content.ownerDocument)}let k,Z="",ee,Xe=!1,At=0,$e=function(){if(At>0)throw W('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ut=function(t){$e(),At++;try{return k.createHTML(t)}finally{At--}},ir=function(t){$e(),At++;try{return k.createScriptURL(t)}finally{At--}},ar=function(){return Xe||(ee=nr(O,A),Xe=!0),ee},Dt=a,ne=Dt.implementation,Ke=Dt.createNodeIterator,lr=Dt.createDocumentFragment,ur=Dt.getElementsByTagName,cr=c.importNode,p=We();i.isSupported=typeof xe=="function"&&typeof at=="function"&&ne&&ne.createHTMLDocument!==void 0;let sr=Yn,fr=Gn,mr=qn,pr=Xn,dr=$n,hr=Kn,Ve=Vn,gr=Jn,Ze=je,h=null,re=f({},[...ze,...Gt,...qt,...Xt,...Pe]),g=null,oe=f({},[...Ue,...$t,...Fe,...Nt]),F=Object.seal(ot(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Et=null,Je=null,q=Object.seal(ot(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Qe=!0,ie=!0,tn=!1,ae=!0,Y=!1,J=!0,Q=!1,le=!1,Ct=null,Rt=null,ue=!1,ct=!1,It=!1,Lt=!1,en=!0,nn=!1,rn="user-content-",ce=!0,se=!1,tt=null,st={},et=null,on=f({},"annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")),an=null,ln=f({},["audio","video","img","source","image","track"]),un=null,cn=f({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Mt="http://www.w3.org/1998/Math/MathML",zt="http://www.w3.org/2000/svg",j="http://www.w3.org/1999/xhtml",ft=j,fe=!1,me=null,yr=f({},[Mt,zt,j],Yt),sn=E(["mi","mo","mn","ms","mtext"]),pe=f({},sn),fn=E(["annotation-xml"]),de=f({},fn),br=f({},["title","style","font","a","script"]),wt=null,Tr=["application/xhtml+xml","text/html"],S=null,mt=null,Sr=a.createElement("form"),mn=function(t){return t instanceof RegExp||t instanceof Function},he=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===t)return;(!t||typeof t!="object")&&(t={}),t=C(t),wt=Tr.indexOf(t.PARSER_MEDIA_TYPE)===-1?"text/html":t.PARSER_MEDIA_TYPE,S=wt==="application/xhtml+xml"?Yt:K,h=G(t,"ALLOWED_TAGS",re,{transform:S}),g=G(t,"ALLOWED_ATTR",oe,{transform:S}),me=G(t,"ALLOWED_NAMESPACES",yr,{transform:Yt}),un=G(t,"ADD_URI_SAFE_ATTR",cn,{transform:S,base:cn}),an=G(t,"ADD_DATA_URI_TAGS",ln,{transform:S,base:ln}),et=G(t,"FORBID_CONTENTS",on,{transform:S}),Et=G(t,"FORBID_TAGS",C({}),{transform:S}),Je=G(t,"FORBID_ATTR",C({}),{transform:S}),st=N(t,"USE_PROFILES")?t.USE_PROFILES&&typeof t.USE_PROFILES=="object"?C(t.USE_PROFILES):t.USE_PROFILES:!1,Qe=t.ALLOW_ARIA_ATTR!==!1,ie=t.ALLOW_DATA_ATTR!==!1,tn=t.ALLOW_UNKNOWN_PROTOCOLS||!1,ae=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=t.SAFE_FOR_TEMPLATES||!1,J=t.SAFE_FOR_XML!==!1,Q=t.WHOLE_DOCUMENT||!1,ct=t.RETURN_DOM||!1,It=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,ue=t.FORCE_BODY||!1,en=t.SANITIZE_DOM!==!1,nn=t.SANITIZE_NAMED_PROPS||!1,ce=t.KEEP_CONTENT!==!1,se=t.IN_PLACE||!1,Ze=Hn(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:je,ft=typeof t.NAMESPACE=="string"?t.NAMESPACE:j,pe=Vt(t,"MATHML_TEXT_INTEGRATION_POINTS",()=>f({},sn)),de=Vt(t,"HTML_INTEGRATION_POINTS",()=>f({},fn));let e=Vt(t,"CUSTOM_ELEMENT_HANDLING",()=>ot(null));if(F=ot(null),N(e,"tagNameCheck")&&mn(e.tagNameCheck)&&(F.tagNameCheck=e.tagNameCheck),N(e,"attributeNameCheck")&&mn(e.attributeNameCheck)&&(F.attributeNameCheck=e.attributeNameCheck),N(e,"allowCustomizedBuiltInElements")&&typeof e.allowCustomizedBuiltInElements=="boolean"&&(F.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),w(F),Y&&(ie=!1),It&&(ct=!0),st&&(h=f({},Pe),g=ot(null),st.html===!0&&(f(h,ze),f(g,Ue)),st.svg===!0&&(f(h,Gt),f(g,$t),f(g,Nt)),st.svgFilters===!0&&(f(h,qt),f(g,$t),f(g,Nt)),st.mathMl===!0&&(f(h,Xt),f(g,Fe),f(g,Nt))),q.tagCheck=null,q.attributeCheck=null,N(t,"ADD_TAGS")&&(typeof t.ADD_TAGS=="function"?q.tagCheck=t.ADD_TAGS:it(t.ADD_TAGS)&&(h===re&&(h=C(h)),f(h,t.ADD_TAGS,S))),N(t,"ADD_ATTR")&&(typeof t.ADD_ATTR=="function"?q.attributeCheck=t.ADD_ATTR:it(t.ADD_ATTR)&&(g===oe&&(g=C(g)),f(g,t.ADD_ATTR,S))),N(t,"ADD_FORBID_CONTENTS")&&it(t.ADD_FORBID_CONTENTS)&&(et===on&&(et=C(et)),f(et,t.ADD_FORBID_CONTENTS,S)),ce&&(h["#text"]=!0),Q&&f(h,["html","head","body"]),h.table&&(f(h,["tbody"]),delete Et.tbody),t.TRUSTED_TYPES_POLICY){if(typeof t.TRUSTED_TYPES_POLICY.createHTML!="function")throw W('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof t.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw W('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let n=k;k=t.TRUSTED_TYPES_POLICY;try{Z=ut("")}catch(o){throw k=n,o}}else t.TRUSTED_TYPES_POLICY===null?(k=void 0,Z=""):(k===void 0&&(k=ar()),k&&typeof Z=="string"&&(Z=ut("")));E&&E(t),mt=t},pn=f({},[...Gt,...qt,...Bn]),dn=f({},[...Xt,...Wn]),vr=function(t,e,n){return e.namespaceURI===j?t==="svg":e.namespaceURI===Mt?t==="svg"&&(n==="annotation-xml"||pe[n]):!!pn[t]},Ar=function(t,e,n){return e.namespaceURI===j?t==="math":e.namespaceURI===zt?t==="math"&&de[n]:!!dn[t]},Er=function(t,e,n){return e.namespaceURI===zt&&!de[n]||e.namespaceURI===Mt&&!pe[n]?!1:!dn[t]&&(br[t]||!pn[t])},wr=function(t){let e=te(t),n=K(vt(t)),o=at(t),l,u;return o&&L(o)===v.element?(l={namespaceURI:te(o)},u=K(vt(o))):(l={namespaceURI:ft},u="template"),me[e]?e===zt?vr(n,l,u):e===Mt?Ar(n,l,u):e===j?Er(n,l,u):!!(wt==="application/xhtml+xml"&&me[e]):!1},nt=function(t){gt(i.removed,{element:t});try{at(t).removeChild(t)}catch(e){if(Zt(t),!at(t))throw W("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},hn=function(t,e,n){try{Ge(t,e)}catch(o){try{t.removeAttribute(n)}catch(l){}}},ge=function(t){be(t);let e=St(t);e&&B(In(e),o=>{try{Zt(o)}catch(l){}});let n=L(t)===v.element?Qt(t):null;if(n)for(let o=n.length-1;o>=0;--o){let l=n[o],u=l&&l.name;typeof u=="string"&&hn(t,l,u)}},pt=function(t,e,n){if(!n)try{n=e.getAttributeNode(t)}catch(o){n=null}gt(i.removed,{attribute:n||null,from:e});try{n?Ge(e,n):e.removeAttribute(t)}catch(o){try{e.removeAttribute(t)}catch(l){}}if(t==="is")if(ct||It)try{nt(e)}catch(o){}else try{e.setAttribute(t,"")}catch(o){}},gn=function(t){let e=Qt(t);if(e)for(let n=e.length-1;n>=0;--n){let o=e[n],l=o&&o.name;typeof l!="string"||g[S(l)]||hn(t,o,l)}},ye=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],o=[t];for(;o.length>0;){let l=o.pop();if(e(l)===!1)continue;if(n&&L(l)===v.element){let s=Jt(l);X(s)&&o.push(s)}let u=St(l);if(u)for(let s=u.length-1;s>=0;--s)o.push(u[s])}},be=function(t){ye(t,e=>{L(e)===v.element&&gn(e)})},Te=function(t){let e=[];return ye(t,n=>{e.push(n)},!0),e},xr=function(t,e){let n=Bt();B(Te(t),o=>{L(o)===v.element&&Wt(n,o)}),B(e,o=>{L(o)===v.element&&!yt(n,o)&&gn(o)})},yn=function(t,e){let n=!1;return B(i.removed,o=>{o.element&&(n=n||o.element===t,be(o.element))}),xr(t,e),n},_r=function(t,e){let n=tt,o=null,l=()=>(o||(o=Bt(),B(e,u=>{Wt(o,u)})),o);for(let u=0;;u++){let s=Te(t),b=[t],$=!1;if(B(s,M=>{L(M)===v.documentFragment?gt(b,M):!$&&!yt(n,M)&&($=yt(l(),M))}),!$)return;if(u>=8)throw W("the tree kept changing during in-place sanitization; refusing to return it");B(b,(M,D)=>{Or(M,D>0,t,l())})}},Or=function(t,e,n,o){let l=Se(t),u;for(;u=l.nextNode();)yt(o,u)&&!yt(tt,u)&&(e&&z(p.uponSanitizeShadowNode,u,null),Ae(u,n),Ee(u,n),X(u.content)&&_t(u.content))},Nr=function(t){tt&&Wt(tt,t)},bn=function(t,e){return J?t==="patchsrc"||t==="for"&&e!=="label"&&e!=="output":!1},kr=function(t){J&&ye(t,e=>{let n=L(e);if(n===v.processingInstruction||n===v.comment&&x(He,e.data)){try{Zt(e)}catch(o){}return!1}if(n===v.element){let o=e,l=S(vt(e));try{o.hasAttribute&&o.hasAttribute("patchsrc")&&o.removeAttribute("patchsrc"),o.hasAttribute&&o.hasAttribute("for")&&bn("for",l)&&o.removeAttribute("for")}catch(u){}}return!0})},Tn=function(t){let e=null,n=null;if(ue)t=""+t;else{let u=Ce(t,/^[\r\n\t ]+/);n=u&&u[0]}wt==="application/xhtml+xml"&&ft===j&&(t=''+t+"");let o=k?ut(t):t;if(ft===j)try{e=new U().parseFromString(o,wt)}catch(u){}if(!e||!e.documentElement){e=ne.createDocument(ft,"template",null);try{e.documentElement.innerHTML=fe?Z:o}catch(u){}}let l=e.body||e.documentElement;return t&&n&&l.insertBefore(a.createTextNode(n),l.childNodes[0]||null),ft===j?ur.call(e,Q?"html":"body")[0]:Q?e.documentElement:l},Se=function(t){let e=kt?kt(t):t.ownerDocument;return Ke.call(e||t,t,y.SHOW_ELEMENT|y.SHOW_COMMENT|y.SHOW_TEXT|y.SHOW_PROCESSING_INSTRUCTION|y.SHOW_CDATA_SECTION,null)},Pt=function(t){return t=bt(t,sr," "),t=bt(t,fr," "),t=bt(t,mr," "),t},ve=function(t){var e;Sn(t);let n=(e=t.querySelectorAll)==null?void 0:e.call(t,"template");n&&B(n,o=>{X(o.content)&&ve(o.content)})},Sn=function(t){t.normalize();let e=kt?kt(t):t.ownerDocument,n=Ke.call(e||t,t,y.SHOW_TEXT|y.SHOW_COMMENT|y.SHOW_CDATA_SECTION|y.SHOW_PROCESSING_INSTRUCTION,null),o=n.nextNode();for(;o;)o.data=Pt(o.data),o=n.nextNode()},Ut=function(t){let e=lt?lt(t):null;return typeof e!="string"||S(e)!=="form"?!1:typeof t.nodeName!="string"||typeof t.textContent!="string"||typeof t.removeChild!="function"||t.attributes!==Qt(t)||typeof t.removeAttribute!="function"||typeof t.removeAttributeNode!="function"||typeof t.getAttributeNode!="function"||typeof t.setAttribute!="function"||typeof t.namespaceURI!="string"||typeof t.insertBefore!="function"||typeof t.hasChildNodes!="function"||t.nodeType!==V(t)||t.childNodes!==St(t)},X=function(t){if(!V||typeof t!="object"||!t)return!1;try{return V(t)===v.documentFragment}catch(e){return!1}},xt=function(t){if(!V||typeof t!="object"||!t)return!1;try{return typeof V(t)=="number"}catch(e){return!1}};function z(t,e,n){t.length!==0&&B(t,o=>{o.call(i,e,n,mt)})}let Dr=function(t,e){return!!(J&&t.hasChildNodes()&&!xt(t.firstElementChild)&&x(Kt,t.textContent)&&x(Kt,t.innerHTML)||J&&tr[e]&&L(t)===v.element&&te(t)===j&&(xt(t.firstElementChild)||typeof t.textContent=="string"&&x(Kt,t.textContent))||t.nodeType===v.processingInstruction||J&&t.nodeType===v.comment&&x(He,t.data))},Ft=function(t,e){return t instanceof RegExp?x(t,e):t instanceof Function&&!!t(e,...[...arguments].slice(2))},Cr=function(t,e,n){if(!Et[e]&&En(e)&&Ft(F.tagNameCheck,e))return!1;if(ce&&!et[e]&&!et[K(e)]){let o=at(t),l=St(t);if(l&&o){let u=l.length;for(let s=u-1;s>=0;--s){let b=t===n?rr(l[s],!0):l[s];o.insertBefore(b,or(t))}}}return nt(t),!0},vn=function(t,e,n,o){return t.length===0?e:e===n||e===o?C(e):e},dt=function(t,e){return t===e||at(t)!==null?!1:(se&&be(t),!0)},Ae=function(t,e){if(Nr(t),z(p.beforeSanitizeElements,t,null),dt(t,e))return!0;if(Ut(t))return nt(t),!0;let n=S(vt(t));if(h=vn(p.uponSanitizeElement,h,re,Ct),z(p.uponSanitizeElement,t,{tagName:n,allowedTags:h}),dt(t,e))return!0;if(Dr(t,n))return nt(t),!0;if(Et[n]||!(q.tagCheck instanceof Function&&q.tagCheck(n))&&!h[n]){let o=Cr(t,n,e);return o===!1&&(z(p.afterSanitizeElements,t,null),dt(t,e))?!0:o}if(L(t)===v.element&&!wr(t)||(n==="noscript"||n==="noembed"||n==="noframes")&&x(Qn,t.innerHTML))return nt(t),!0;if(Y&&t.nodeType===v.text){let o=Pt(t.textContent);t.textContent!==o&&(gt(i.removed,{element:t.cloneNode()}),t.textContent=o)}return z(p.afterSanitizeElements,t,null),dt(t,e)},An=function(t,e,n){if(Je[e]||bn(e,t)||en&&(e==="id"||e==="name")&&(n in a||n in Sr))return!1;let o=g[e]||q.attributeCheck instanceof Function&&q.attributeCheck(e,t);return ie&&x(pr,e)||Qe&&x(dr,e)?!0:o?un[e]||x(Ze,bt(n,Ve,""))||(e==="src"||e==="xlink:href"||e==="href")&&t!=="script"&&Re(n,"data:")===0&&an[t]||tn&&!x(hr,bt(n,Ve,""))?!0:!n:En(t)&&Ft(F.tagNameCheck,t)&&Ft(F.attributeNameCheck,e,t)||e==="is"&&F.allowCustomizedBuiltInElements&&Ft(F.tagNameCheck,n)},Rr=f({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),En=function(t){return!Rr[K(t)]&&x(gr,t)},Ir=function(t,e,n,o){if(k&&typeof O=="object"&&typeof O.getAttributeType=="function"&&!n)switch(O.getAttributeType(t,e)){case"TrustedHTML":return ut(o);case"TrustedScriptURL":return ir(o)}return o},Lr=function(t,e,n,o){try{return n?t.setAttributeNS(n,e,o):t.setAttribute(e,o),!Ut(t)||(nt(t),!1)}catch(l){return pt(e,t),!1}},wn=function(t,e){return J&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,e)?!0:K(t)==="attributename"&&Ce(e,"href")!==null},Ee=function(t,e){if(z(p.beforeSanitizeAttributes,t,null),dt(t,e))return;let n=t.attributes;if(!n||Ut(t))return;g=vn(p.uponSanitizeAttribute,g,oe,Rt);let o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:g,forceKeepAttr:void 0},l=n.length,u=S(t.nodeName);for(;l--;){let s=n[l],b=s.name,$=s.namespaceURI,M=s.value,D=S(b),H=M,_=b==="value"?H:Mn(H),xn=!1;o.attrName=D,o.attrValue=_,o.keepAttr=!0,o.forceKeepAttr=void 0,z(p.uponSanitizeAttribute,t,o),_=o.attrValue,nn&&(D==="id"||D==="name")&&Re(_,rn)!==0&&(pt(b,t,s),_=rn+_,xn=!0),wn(b,_)?pt(b,t,s):o.forceKeepAttr||(o.keepAttr?!ae&&x(Be,_)?pt(b,t,s):(Y&&(_=Pt(_)),An(u,D,_)?(_=Ir(u,D,$,_),_!==H&&Lr(t,b,$,_)&&xn&&De(i.removed)):pt(b,t,s)):pt(b,t,s))}z(p.afterSanitizeAttributes,t,null),dt(t,e)},_t=function(t){let e=null,n=Se(t);for(z(p.beforeSanitizeShadowDOM,t,null);e=n.nextNode();)if(z(p.uponSanitizeShadowNode,e,null),Ae(e,t),Ee(e,t),X(e.content)&&_t(e.content),L(e)===v.element){let o=Jt(e);X(o)&&(we(o),_t(o))}Y&&Sn(t),z(p.afterSanitizeShadowDOM,t,null)},we=function(t){let e=[{node:t,shadow:null}];for(;e.length>0;){let n=e.pop();if(n.shadow){_t(n.shadow);continue}let o=n.node,l=L(o)===v.element,u=St(o);if(u)for(let s=u.length-1;s>=0;--s)e.push({node:u[s],shadow:null});if(l){let s=lt?lt(o):null;if(typeof s=="string"&&S(s)==="template"){let b=o.content;X(b)&&e.push({node:b,shadow:null})}}if(l){let s=Jt(o);X(s)&&e.push({node:null,shadow:s},{node:s,shadow:null})}}};return i.sanitize=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,o=null,l=null,u=null;if(fe=!t,fe&&(t=""),typeof t!="string"&&!xt(t)&&(t=Fn(t),typeof t!="string"))throw W("dirty is not a string, aborting");if(!i.isSupported)return t;le?(h=Ct,g=Rt):he(e),(p.uponSanitizeElement.length>0||p.uponSanitizeAttribute.length>0)&&(h=C(h)),p.uponSanitizeAttribute.length>0&&(g=C(g)),i.removed=[];let s=se&&typeof t!="string"&&xt(t),b=[],$=tt;if(s){kr(t);let H=vt(t);if(typeof H=="string"){let _=S(H);if(!h[_]||Et[_])throw ge(t),W("root node is forbidden and cannot be sanitized in-place")}if(Ut(t))throw ge(t),W("root node is clobbered and cannot be sanitized in-place");b=Te(t),tt=Bt()}else if(xt(t))n=Tn(""),o=n.ownerDocument.importNode(t,!0),o.nodeType===v.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?n=o:n.appendChild(o),we(n);else{if(!ct&&!Y&&!Q&&t.indexOf("<")===-1)return k&&Lt?ut(t):t;if(n=Tn(t),!n)return ct?null:Lt?Z:""}n&&ue&&nt(n.firstChild);let M=s?t:n;try{s&&we(t);let H=Se(M);for(;l=H.nextNode();)Ae(l,M),Ee(l,M),X(l.content)&&_t(l.content);s&&_r(t,b)}catch(H){throw s&&(ge(t),yn(t,b)),H}finally{tt=$}if(s){if(yn(t,b))throw W("a node selected for removal could not be safely returned; refusing to sanitize in place");return Y&&ve(t),t}if(ct){if(Y&&ve(n),It)for(u=lr.call(n.ownerDocument);n.firstChild;)u.appendChild(n.firstChild);else u=n;return(g.shadowroot||g.shadowrootmode)&&(u=cr.call(c,u,!0)),u}let D=Q?n.outerHTML:n.innerHTML;return Q&&h["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&x(Zn,n.ownerDocument.doctype.name)&&(D=" +`+D),Y&&(D=Pt(D)),k&&Lt?ut(D):D},i.setConfig=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};he(t),le=!0,Ct=h,Rt=g},i.clearConfig=function(){mt=null,le=!1,Ct=null,Rt=null,k=ee,Z=""},i.isValidAttribute=function(t,e,n){mt||he({});let o=S(t),l=S(e);return typeof n=="string"&&(wn(e,n)||!ae&&x(Be,n))?!1:An(o,l,n)},i.addHook=function(t,e){typeof e=="function"&&N(p,t)&>(p[t],e)},i.removeHook=function(t,e){if(N(p,t)){if(e!==void 0){let n=Rn(p[t],e);return n===-1?void 0:Ln(p[t],n,1)[0]}return De(p[t])}},i.removeHooks=function(t){N(p,t)&&(p[t]=[])},i.removeAllHooks=function(){p=We()},i}return Ye()}); diff --git a/suixinkan/SceneDelegate.swift b/suixinkan/SceneDelegate.swift index 929eca2..a31e332 100644 --- a/suixinkan/SceneDelegate.swift +++ b/suixinkan/SceneDelegate.swift @@ -25,6 +25,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window.rootViewController = UIViewController() self.window = window (UIApplication.shared.delegate as? AppDelegate)?.window = window + #if DEBUG + if let preview = ScenicMaterialsPreview.navigationController(arguments: ProcessInfo.processInfo.arguments) + ?? DroneDockPreview.navigationController(arguments: ProcessInfo.processInfo.arguments) { + window.rootViewController = preview + window.makeKeyAndVisible() + return + } + #endif let appSession = AppStore.shared.session deregistrationCoordinator = StoreAccountDeregistrationRootCoordinator( window: window, session: appSession, diff --git a/suixinkan/UI/Common/MaterialSelectionIcon.swift b/suixinkan/UI/Common/MaterialSelectionIcon.swift new file mode 100644 index 0000000..5e9368f --- /dev/null +++ b/suixinkan/UI/Common/MaterialSelectionIcon.swift @@ -0,0 +1,77 @@ +import UIKit + +/// 按体验网页的矢量路径绘制空境库与订单素材库的选择图标。 +@MainActor +enum MaterialSelectionIcon { + /// 统一选择控件蓝色。 + static let primary = UIColor(hex: 0x066BFF) + + /// 绘制空境库的空心圆或带不透明白色勾的实心圆,支持不同尺寸与禁用透明度。 + static func scenicImage(selected: Bool, size: CGFloat, tint: UIColor, opacity: CGFloat = 1) -> UIImage { + UIGraphicsImageRenderer(size: CGSize(width: size, height: size)).image { context in + let canvas = context.cgContext + canvas.setAlpha(opacity) + canvas.beginTransparencyLayer(auxiliaryInfo: nil) + defer { canvas.endTransparencyLayer() } + canvas.scaleBy(x: size / 24, y: size / 24) + + let radius: CGFloat = selected ? 10 : 9 + let circle = UIBezierPath(ovalIn: CGRect(x: 12 - radius, y: 12 - radius, + width: radius * 2, height: radius * 2)) + if selected { + tint.setFill() + circle.fill() + UIColor.white.setStroke() + let check = UIBezierPath() + check.move(to: CGPoint(x: 9, y: 12)) + check.addLine(to: CGPoint(x: 11, y: 14)) + check.addLine(to: CGPoint(x: 15, y: 10)) + check.lineWidth = 2 + check.lineCapStyle = .round + check.lineJoinStyle = .round + check.stroke() + } else { + tint.setStroke() + circle.lineWidth = 2 + circle.stroke() + } + }.withRenderingMode(.alwaysOriginal) + } + + /// 绘制订单素材库的线框圆和勾;卡片可附圆形底色,文字按钮保持透明背景。 + static func orderImage(selected: Bool, size: CGFloat, tint: UIColor, + includesBackground: Bool, opacity: CGFloat = 1) -> UIImage { + UIGraphicsImageRenderer(size: CGSize(width: size, height: size)).image { context in + let canvas = context.cgContext + canvas.setAlpha(opacity) + canvas.beginTransparencyLayer(auxiliaryInfo: nil) + defer { canvas.endTransparencyLayer() } + canvas.scaleBy(x: size / 15, y: size / 15) + + if includesBackground { + (selected ? tint : UIColor.white).setFill() + UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 15, height: 15)).fill() + } + + let stroke = includesBackground && selected ? UIColor.white : tint + stroke.setStroke() + let center: CGFloat = 7.4999 + let radius: CGFloat = 6.1478 + let circle = UIBezierPath(ovalIn: CGRect(x: center - radius, y: center - radius, + width: radius * 2, height: radius * 2)) + circle.lineWidth = 0.95 + circle.stroke() + + if selected { + let check = UIBezierPath() + check.move(to: CGPoint(x: 5, y: 8.13735)) + check.addLine(to: CGPoint(x: 6.58333, y: 9.75)) + check.addLine(to: CGPoint(x: 9.75, y: 5.25)) + check.lineWidth = 1 + check.lineCapStyle = .round + check.lineJoinStyle = .round + check.stroke() + } + }.withRenderingMode(.alwaysOriginal) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDeliveryDemoUploadDriver.swift b/suixinkan/UI/DroneDock/DroneDeliveryDemoUploadDriver.swift new file mode 100644 index 0000000..fd996f2 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDeliveryDemoUploadDriver.swift @@ -0,0 +1,51 @@ +import Foundation + +/// 本地成片上传的 UI 演示驱动;不访问云存储、不读取相册或真实文件内容。 +@MainActor +final class DroneDeliveryDemoUploadDriver { + private var task: Task? + private var runningBatchID: UUID? + + /// 推进固定批次的明确演示回执,已成功和失败项不重复处理。 + func start(viewModel: DroneDeliveryViewModel, onTransferUpdate: @escaping () -> Void) { + guard let batch = viewModel.batch, viewModel.uploadPhase == .uploading else { return } + guard runningBatchID != batch.id || task == nil else { return } + stop() + let batchID = batch.id + runningBatchID = batchID + task = Task { @MainActor [weak self, weak viewModel] in + guard let self, let viewModel else { return } + defer { + if self.runningBatchID == batchID { + self.task = nil + self.runningBatchID = nil + } + } + for item in batch.items { + guard self.isCurrent(viewModel, batchID: batchID) else { return } + guard case .uploading = item.state else { continue } + for progress in [0.2, 0.45, 0.7, 1.0] { + do { try await Task.sleep(nanoseconds: 240_000_000) } catch { return } + guard self.isCurrent(viewModel, batchID: batchID) else { return } + viewModel.receiveUpload(.progress(progress), itemID: item.id, batchID: batchID) + onTransferUpdate() + } + guard self.isCurrent(viewModel, batchID: batchID) else { return } + viewModel.receiveUpload(.succeeded, itemID: item.id, batchID: batchID) + onTransferUpdate() + } + } + } + + /// 停止后续回执;生命周期处理方同时暂停 ViewModel,使旧令牌失效。 + func stop() { + task?.cancel() + task = nil + runningBatchID = nil + } + + private func isCurrent(_ viewModel: DroneDeliveryViewModel, batchID: UUID) -> Bool { + !Task.isCancelled && runningBatchID == batchID && viewModel.batch?.id == batchID + && viewModel.uploadPhase == .uploading + } +} diff --git a/suixinkan/UI/DroneDock/DroneDeliveryReviewComponents.swift b/suixinkan/UI/DroneDock/DroneDeliveryReviewComponents.swift new file mode 100644 index 0000000..50760b8 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDeliveryReviewComponents.swift @@ -0,0 +1,561 @@ +import Kingfisher +import SnapKit +import UIKit + +/// 核对页与确认记录共用的整单抬头,不把拍摄履约状态混入成片确认。 +@MainActor +final class DroneDeliveryReviewOrderCell: UICollectionViewCell { + private let nameLabel = DroneDockStyle.label(size: 18, weight: .semibold) + private let numberLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let badgeLabel = DroneDockStatusLabel() + + override init(frame: CGRect) { + super.init(frame: frame) + badgeLabel.apply(title: "整单确认", tone: .blue) + let row = UIStackView(arrangedSubviews: [nameLabel, UIView(), badgeLabel]) + row.alignment = .center + row.spacing = 10 + let stack = UIStackView(arrangedSubviews: [row, numberLabel]) + stack.axis = .vertical + stack.spacing = 7 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.leading.trailing.equalToSuperview(); make.top.bottom.equalToSuperview().inset(18) } + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + contentView.addSubview(divider) + divider.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview(); make.height.equalTo(1) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 展示订单身份,整单确认不按入口点位缩小清单。 + func apply(customer: String, orderNumber: String) { + nameLabel.text = customer + numberLabel.text = orderNumber + accessibilityIdentifier = "drone.delivery.review.order" + } +} + +/// 核对提示、清单标题和演示说明共用的文字单元。 +@MainActor +final class DroneDeliveryReviewTextCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let iconView = UIImageView() + private let row = UIStackView() + + override init(frame: CGRect) { + super.init(frame: frame) + titleLabel.numberOfLines = 0 + detailLabel.numberOfLines = 0 + iconView.tintColor = DroneDockStyle.primary + iconView.contentMode = .center + iconView.backgroundColor = DroneDockStyle.primary.withAlphaComponent(0.06) + iconView.layer.cornerRadius = 10 + iconView.snp.makeConstraints { make in make.size.equalTo(42).priority(999) } + let texts = UIStackView(arrangedSubviews: [titleLabel, detailLabel]) + texts.axis = .vertical + texts.spacing = 5 + row.addArrangedSubview(iconView) + row.addArrangedSubview(texts) + row.alignment = .center + row.spacing = 12 + contentView.addSubview(row) + row.snp.makeConstraints { make in make.leading.trailing.equalToSuperview(); make.top.bottom.equalToSuperview().inset(14) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 应用语义明确的标题和说明,可选图标仅用于核对引导。 + func apply(title: String?, detail: String?, symbol: String? = nil) { + titleLabel.text = title + titleLabel.isHidden = title == nil + detailLabel.text = detail + detailLabel.isHidden = detail == nil + iconView.isHidden = symbol == nil + iconView.image = symbol.flatMap { UIImage(systemName: $0, withConfiguration: UIImage.SymbolConfiguration(pointSize: 23)) } + } +} + +/// 整单已交付作品与覆盖点位数量,统计范围由 ViewModel 提供。 +@MainActor +final class DroneDeliveryReviewStatisticsCell: UICollectionViewCell { + private let countLabel = UILabel() + private let pointLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.backgroundColor = DroneDockStyle.primary.withAlphaComponent(0.055) + contentView.layer.cornerRadius = 11 + countLabel.numberOfLines = 0 + pointLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + let row = UIStackView(arrangedSubviews: [countLabel, UIView(), pointLabel]) + row.alignment = .center + row.spacing = 8 + contentView.addSubview(row) + row.snp.makeConstraints { make in make.edges.equalToSuperview().inset(15) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 显示整单所有上传批次的作品数量,不以本次上传数代替。 + func apply(workCount: Int, pointCount: Int, label: String = "本订单已交付") { + let text = NSMutableAttributedString(string: "\(label) ", attributes: [.font: UIFont.systemFont(ofSize: 12), .foregroundColor: DroneDockStyle.secondary]) + text.append(NSAttributedString(string: "\(workCount)", attributes: [.font: UIFont.systemFont(ofSize: 25, weight: .semibold), .foregroundColor: DroneDockStyle.primary])) + text.append(NSAttributedString(string: " 个成片", attributes: [.font: UIFont.systemFont(ofSize: 12, weight: .medium), .foregroundColor: DroneDockStyle.primary])) + countLabel.attributedText = text + pointLabel.text = "覆盖 \(pointCount) 个打卡点" + accessibilityIdentifier = "drone.delivery.review.statistics" + accessibilityLabel = "\(label)\(workCount)个成片,覆盖\(pointCount)个打卡点" + } +} + +/// 横排交付清单标题,也可作为确认码下方整单清单的展开入口。 +@MainActor +final class DroneDeliveryReviewManifestHeaderCell: UICollectionViewCell { + /// 用户点击整行后由页面切换清单展开状态。 + var onToggle: (() -> Void)? + private let titleLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let chevron = UIImageView() + private let toggleButton = UIButton(type: .custom) + + override init(frame: CGRect) { + super.init(frame: frame) + titleLabel.numberOfLines = 0 + detailLabel.textAlignment = .right + detailLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + chevron.contentMode = .scaleAspectFit + chevron.tintColor = DroneDockStyle.secondary + chevron.snp.makeConstraints { $0.size.equalTo(12) } + let row = UIStackView(arrangedSubviews: [chevron, titleLabel, UIView(), detailLabel]) + row.alignment = .center + row.spacing = 8 + contentView.addSubview(row) + row.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.top.equalToSuperview().offset(16) + $0.bottom.equalToSuperview().inset(8) + } + contentView.addSubview(toggleButton) + toggleButton.snp.makeConstraints { $0.edges.equalToSuperview() } + toggleButton.addTarget(self, action: #selector(toggleTapped), for: .touchUpInside) + toggleButton.accessibilityIdentifier = "drone.confirmation.manifest.toggle" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { super.prepareForReuse(); onToggle = nil } + + /// expanded 为 nil 时展示静态标题,否则按指定状态展示可折叠的清单入口。 + func apply(title: String, detail: String?, expanded: Bool? = nil) { + titleLabel.text = title + titleLabel.font = .systemFont(ofSize: expanded == nil ? 16 : 12, weight: expanded == nil ? .semibold : .regular) + titleLabel.textColor = expanded == nil ? DroneDockStyle.text : DroneDockStyle.secondary + detailLabel.text = detail + detailLabel.isHidden = detail?.isEmpty != false + chevron.isHidden = expanded == nil + chevron.image = UIImage(systemName: expanded == true ? "chevron.down" : "chevron.right") + toggleButton.isHidden = expanded == nil + toggleButton.accessibilityLabel = title + toggleButton.accessibilityValue = expanded == true ? "已展开" : "已收起" + toggleButton.accessibilityHint = expanded == true ? "收起成片清单" : "展开成片清单" + } + + @objc private func toggleTapped() { onToggle?() } +} + +/// 单个打卡点的成片分组标题,核对页和冻结记录复用同一布局。 +@MainActor +final class DroneDeliveryReviewPointHeader: UICollectionReusableView { + private let titleLabel = DroneDockStyle.label(size: 14, weight: .semibold) + private let countLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + let row = UIStackView(arrangedSubviews: [titleLabel, UIView(), countLabel]) + row.alignment = .center + row.spacing = 8 + addSubview(row) + row.snp.makeConstraints { make in make.leading.trailing.equalToSuperview(); make.centerY.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 只显示当前分组快照的名称与作品数。 + func apply(pointName: String, workCount: Int) { + titleLabel.text = pointName + countLabel.text = "\(workCount) 个视频" + } +} + +/// 两列成片封面,点击仅提出预览请求,不修改核对或游客确认状态。 +@MainActor +final class DroneDeliveryReviewWorkCell: UICollectionViewCell { + /// 点击封面或文件名时请求只读预览。 + var onPreviewTap: (() -> Void)? + private let imageView = UIImageView() + private let placeholderView = UIImageView(image: UIImage(systemName: "film")) + private let playView = UIImageView(image: UIImage(systemName: "play.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 10))) + private let durationLabel = UILabel() + private let titleLabel = DroneDockStyle.label(size: 13, weight: .semibold) + private let fileLabel = DroneDockStyle.label(size: 10, color: DroneDockStyle.secondary) + private let previewButton = UIButton(type: .custom) + private var imageGeneration = 0 + + override init(frame: CGRect) { + super.init(frame: frame) + imageView.contentMode = .scaleAspectFill + imageView.clipsToBounds = true + imageView.layer.cornerRadius = 8 + imageView.backgroundColor = DroneDockStyle.background + placeholderView.tintColor = DroneDockStyle.secondary + placeholderView.contentMode = .scaleAspectFit + playView.tintColor = .white + playView.contentMode = .center + playView.backgroundColor = UIColor(red: 16 / 255, green: 34 / 255, blue: 63 / 255, alpha: 0.4) + playView.layer.cornerRadius = 13 + playView.clipsToBounds = true + durationLabel.font = .monospacedDigitSystemFont(ofSize: 10, weight: .medium) + durationLabel.textColor = .white + durationLabel.backgroundColor = UIColor.black.withAlphaComponent(0.48) + durationLabel.layer.cornerRadius = 3 + durationLabel.clipsToBounds = true + durationLabel.textAlignment = .center + titleLabel.numberOfLines = 1 + fileLabel.numberOfLines = 1 + fileLabel.lineBreakMode = .byTruncatingMiddle + [imageView, placeholderView, playView, durationLabel, titleLabel, fileLabel, previewButton].forEach(contentView.addSubview) + imageView.snp.makeConstraints { make in make.leading.trailing.top.equalToSuperview(); make.height.equalTo(imageView.snp.width).multipliedBy(9.0 / 16.0) } + placeholderView.snp.makeConstraints { make in make.center.equalTo(imageView); make.size.equalTo(28) } + playView.snp.makeConstraints { make in make.center.equalTo(imageView); make.size.equalTo(26) } + durationLabel.snp.makeConstraints { make in make.bottom.trailing.equalTo(imageView).inset(5); make.width.greaterThanOrEqualTo(38); make.height.equalTo(19) } + titleLabel.snp.makeConstraints { make in make.top.equalTo(imageView.snp.bottom).offset(7); make.leading.trailing.equalToSuperview() } + fileLabel.snp.makeConstraints { make in make.top.equalTo(titleLabel.snp.bottom).offset(4); make.leading.trailing.equalToSuperview(); make.bottom.lessThanOrEqualToSuperview().inset(2) } + previewButton.snp.makeConstraints { make in make.edges.equalToSuperview() } + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + super.prepareForReuse() + onPreviewTap = nil + imageGeneration += 1 + imageView.kf.cancelDownloadTask() + imageView.image = nil + placeholderView.isHidden = false + playView.isHidden = true + durationLabel.text = nil + durationLabel.isHidden = true + } + + /// 本地封面与时长始终明确属于演示作品。 + func apply(id: String, title: String, fileName: String, previewAssetName: String, durationText: String) { + imageGeneration += 1 + imageView.kf.cancelDownloadTask() + imageView.image = UIImage(named: previewAssetName) + placeholderView.isHidden = imageView.image != nil + playView.isHidden = imageView.image == nil + titleLabel.text = title + fileLabel.text = fileName + durationLabel.text = durationText + durationLabel.isHidden = false + previewButton.accessibilityIdentifier = "drone.delivery.review.preview.\(id)" + previewButton.accessibilityLabel = "预览\(title),本地演示成片" + } + + /// 正式成片使用接口封面和文件名;接口未提供时长时不显示演示时长。 + func apply(film: DroneDockMaterialFilm, taskID: Int, title: String, localImage: UIImage?, allowsRemoteImage: Bool) { + imageGeneration += 1 + let generation = imageGeneration + imageView.kf.cancelDownloadTask() + imageView.image = localImage + placeholderView.isHidden = localImage != nil + playView.isHidden = localImage == nil + titleLabel.text = title + fileLabel.text = DroneDockHomeMetric.usableText(film.fileName) ?? "文件名未提供" + durationLabel.text = nil + durationLabel.isHidden = true + previewButton.accessibilityIdentifier = "drone.confirmation.preview.\(taskID)" + previewButton.accessibilityLabel = "预览\(title),\(fileLabel.text ?? "")" + guard allowsRemoteImage, localImage == nil, + let value = DroneDockHomeMetric.usableText(film.coverURL), + let url = URL(string: value), ["http", "https"].contains(url.scheme?.lowercased() ?? ""), + let host = url.host, !host.isEmpty else { return } + imageView.kf.setImage(with: url) { [weak self] result in + Task { @MainActor [weak self] in + guard let self, self.imageGeneration == generation else { return } + let loaded = (try? result.get()) != nil + self.placeholderView.isHidden = loaded + self.playView.isHidden = !loaded + } + } + } + + @objc private func previewTapped() { onPreviewTap?() } +} + +/// 订单确认码演示面板;图案没有编码任何游客地址,不提供真实扫码服务。 +@MainActor +final class DroneDeliveryConfirmationCodeCell: UICollectionViewCell { + private let statusLabel = DroneDockStatusLabel() + private let titleLabel = DroneDockStyle.label(size: 21, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let codeView = DroneDeliveryDemoCodeView() + private let countLabel = DroneDockStyle.label(size: 13, weight: .medium) + private let explanationLabel = DroneDockStyle.label("扫描不等于收货,需游客本人主动确认", size: 11, color: DroneDockStyle.secondary) + private let demoLabel = DroneDockStyle.label("仅供本机交互演示 · 不连接游客手机", size: 12, weight: .medium, color: DroneDockStyle.primary) + private let feedbackLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.warning) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.layer.cornerRadius = 15 + contentView.layer.borderWidth = 1 + contentView.layer.borderColor = DroneDockStyle.border.cgColor + contentView.backgroundColor = DroneDockStyle.primary.withAlphaComponent(0.025) + [titleLabel, detailLabel, countLabel, explanationLabel, demoLabel, feedbackLabel].forEach { $0.textAlignment = .center; $0.numberOfLines = 0 } + let stack = UIStackView(arrangedSubviews: [statusLabel, titleLabel, detailLabel, codeView, countLabel, explanationLabel, demoLabel, feedbackLabel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 13 + stack.setCustomSpacing(20, after: detailLabel) + codeView.snp.makeConstraints { make in make.size.equalTo(202) } + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.edges.equalToSuperview().inset(20) } + [titleLabel, detailLabel, countLabel, explanationLabel, demoLabel, feedbackLabel].forEach { label in + label.snp.makeConstraints { make in make.width.equalTo(stack) } + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 仅展示当前确认快照数量;刷新状态不代替游客本人主动确认。 + func apply(status: String, tone: DroneDockStatusTone, workCount: Int, pointCount: Int, feedback: String?) { + statusLabel.apply(title: status, tone: tone) + titleLabel.text = feedback == nil ? "请游客扫码确认收货" : "游客反馈待处理" + detailLabel.text = "查看本订单全部成片后,一次确认" + countLabel.text = "\(workCount) 个成片 · \(pointCount) 个打卡点" + feedbackLabel.text = feedback + feedbackLabel.isHidden = feedback == nil + accessibilityIdentifier = "drone.delivery.confirmation.code" + } +} + +/// 不可扫码的本地演示图案,刻意不生成二维码数据或有效游客链接。 +@MainActor +private final class DroneDeliveryDemoCodeView: UIView { + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + layer.cornerRadius = 12 + layer.borderWidth = 1 + layer.borderColor = DroneDockStyle.border.cgColor + isAccessibilityElement = true + accessibilityLabel = "订单确认演示图案,不支持真实扫码" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func draw(_ rect: CGRect) { + super.draw(rect) + guard let context = UIGraphicsGetCurrentContext() else { return } + let gridCount = 25 + let module = min(bounds.width, bounds.height) / 31 + let origin = CGPoint(x: (bounds.width - CGFloat(gridCount) * module) / 2, y: (bounds.height - CGFloat(gridCount) * module) / 2) + context.setFillColor(UIColor.black.cgColor) + for row in 0.. 16) || (row > 16 && column < 8) + guard !inFinder, (row * 13 + column * 7 + row * column) % 5 < 2 else { continue } + context.fill(CGRect(x: origin.x + CGFloat(column) * module, y: origin.y + CGFloat(row) * module, width: module, height: module)) + } + } + for position in [CGPoint.zero, CGPoint(x: 18, y: 0), CGPoint(x: 0, y: 18)] { + let outer = CGRect(x: origin.x + position.x * module, y: origin.y + position.y * module, width: 7 * module, height: 7 * module) + context.setFillColor(UIColor.black.cgColor) + context.fill(outer) + context.setFillColor(UIColor.white.cgColor) + context.fill(outer.insetBy(dx: module, dy: module)) + context.setFillColor(UIColor.black.cgColor) + context.fill(outer.insetBy(dx: 2 * module, dy: 2 * module)) + } + let badge = CGRect(x: 10, y: bounds.midY - 24, width: bounds.width - 20, height: 48) + context.setFillColor(UIColor.white.cgColor) + context.fill(badge) + let text = "演示 · 不可扫码" as NSString + let attributes: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 15, weight: .semibold), .foregroundColor: DroneDockStyle.primary] + let size = text.size(withAttributes: attributes) + text.draw(at: CGPoint(x: bounds.midX - size.width / 2, y: bounds.midY - size.height / 2), withAttributes: attributes) + } +} + +/// 游客确认回执的固定快照摘要,人员与时间由确认记录提供。 +@MainActor +final class DroneDeliveryReceiptCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label("游客已确认收货", size: 21, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let metadataStack = UIStackView() + private let statementLabel = DroneDockStyle.label("我已查看本订单交付清单,确认收到上述全部成片。", size: 12, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + let icon = UIImageView(image: UIImage(systemName: "checkmark.circle.fill")) + icon.tintColor = DroneDockStyle.success + icon.contentMode = .scaleAspectFit + icon.snp.makeConstraints { make in make.size.equalTo(38) } + titleLabel.textAlignment = .center + detailLabel.textAlignment = .center + detailLabel.numberOfLines = 0 + metadataStack.axis = .vertical + metadataStack.spacing = 14 + let panel = UIView() + panel.backgroundColor = DroneDockStyle.background + panel.layer.cornerRadius = 10 + panel.addSubview(metadataStack) + metadataStack.snp.makeConstraints { make in make.edges.equalToSuperview().inset(14) } + statementLabel.numberOfLines = 0 + let statementTitle = DroneDockStyle.label("游客确认内容", size: 13, weight: .semibold) + let stack = UIStackView(arrangedSubviews: [icon, titleLabel, detailLabel, panel, statementTitle, statementLabel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 14 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.leading.trailing.equalToSuperview(); make.top.bottom.equalToSuperview().inset(20) } + [panel, statementTitle, statementLabel].forEach { view in view.snp.makeConstraints { make in make.width.equalTo(stack) } } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 这些值来自确认时的记录,不读取当前追加后的作品数量或人员。 + func apply(workCount: Int, pointCount: Int, visitor: String, confirmedAt: String, operatorName: String) { + detailLabel.text = "本订单一次确认,共 \(workCount) 个成片\n本机演示记录 · 并非真实收货凭据" + metadataStack.arrangedSubviews.forEach { metadataStack.removeArrangedSubview($0); $0.removeFromSuperview() } + for (label, value) in [("确认人", visitor), ("确认时间", confirmedAt), ("交付工作人员", operatorName), ("确认范围", "\(pointCount) 个打卡点 · \(workCount) 个成片")] { + let key = DroneDockStyle.label(label, size: 12, color: DroneDockStyle.secondary) + key.snp.makeConstraints { make in make.width.equalTo(86) } + let content = DroneDockStyle.label(value, size: 12) + content.numberOfLines = 0 + content.textAlignment = .right + let row = UIStackView(arrangedSubviews: [key, content]) + row.alignment = .top + row.spacing = 10 + metadataStack.addArrangedSubview(row) + } + accessibilityIdentifier = "drone.delivery.confirmation.receipt" + } +} + +/// 核对、确认码与确认记录共用的固定底部操作区,所有按钮至少 44 点高。 +@MainActor +final class DroneDeliveryReviewFooterView: UIView { + /// 核对勾选变化由 Controller 主动同步到 ViewModel。 + var onAcknowledgementTap: (() -> Void)? + /// 主操作随页面阶段变化。 + var onPrimaryTap: (() -> Void)? + /// 次操作用于继续交付、稍后返回或回到当前核对。 + var onSecondaryTap: (() -> Void)? + private let noteLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let acknowledgementButton = UIButton(type: .system) + private let primaryButton = UIButton(type: .system) + private let secondaryButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + addSubview(divider) + divider.snp.makeConstraints { make in make.leading.trailing.top.equalToSuperview(); make.height.equalTo(1) } + noteLabel.textAlignment = .center + noteLabel.numberOfLines = 2 + acknowledgementButton.contentHorizontalAlignment = .leading + acknowledgementButton.tintColor = DroneDockStyle.primary + acknowledgementButton.addTarget(self, action: #selector(acknowledgementTapped), for: .touchUpInside) + primaryButton.layer.cornerRadius = 9 + primaryButton.backgroundColor = DroneDockStyle.primary + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(UIColor.white.withAlphaComponent(0.85), for: .disabled) + primaryButton.titleLabel?.font = .systemFont(ofSize: 15, weight: .semibold) + primaryButton.titleLabel?.adjustsFontSizeToFitWidth = true + primaryButton.titleLabel?.minimumScaleFactor = 0.8 + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + secondaryButton.setTitleColor(DroneDockStyle.secondary, for: .normal) + secondaryButton.titleLabel?.font = .systemFont(ofSize: 13) + secondaryButton.addTarget(self, action: #selector(secondaryTapped), for: .touchUpInside) + let stack = UIStackView(arrangedSubviews: [noteLabel, acknowledgementButton, primaryButton, secondaryButton]) + stack.axis = .vertical + stack.spacing = 5 + addSubview(stack) + stack.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(16) + make.top.equalToSuperview().offset(9) + make.bottom.equalTo(safeAreaLayoutGuide).inset(4) + } + acknowledgementButton.snp.makeConstraints { make in make.height.equalTo(44).priority(999) } + primaryButton.snp.makeConstraints { make in make.height.equalTo(48) } + secondaryButton.snp.makeConstraints { make in make.height.equalTo(44).priority(999) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 根据明确页面状态配置操作;未核对时不能展示确认码。 + func apply(acknowledged: Bool?, note: String?, primaryTitle: String, primaryIdentifier: String, primaryEnabled: Bool, + secondaryTitle: String?, secondaryIdentifier: String, primarySymbol: String? = nil) { + noteLabel.text = note + noteLabel.isHidden = note?.isEmpty != false + acknowledgementButton.isHidden = acknowledged == nil + if let acknowledged { + var configuration = UIButton.Configuration.plain() + configuration.title = "我已核对,本订单成片已全部交齐" + configuration.image = UIImage(systemName: acknowledged ? "checkmark.square.fill" : "square", + withConfiguration: UIImage.SymbolConfiguration(pointSize: 16))? + .withTintColor(acknowledged ? DroneDockStyle.primary : UIColor(hex: 0xCBD2DC), renderingMode: .alwaysOriginal) + configuration.baseForegroundColor = DroneDockStyle.secondary + configuration.imagePadding = 7 + configuration.contentInsets = .zero + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var attributes = attributes + attributes.font = .systemFont(ofSize: 12) + return attributes + } + acknowledgementButton.configuration = configuration + acknowledgementButton.accessibilityTraits = acknowledged ? [.button, .selected] : .button + } + acknowledgementButton.accessibilityIdentifier = "drone.delivery.review.acknowledge" + var primaryConfiguration = UIButton.Configuration.plain() + primaryConfiguration.cornerStyle = .fixed + primaryConfiguration.background.cornerRadius = 9 + primaryConfiguration.background.backgroundColor = primaryEnabled ? DroneDockStyle.primary : DroneDockStyle.primary.withAlphaComponent(0.2) + primaryConfiguration.title = primaryTitle + primaryConfiguration.image = primarySymbol.flatMap { UIImage(systemName: $0, withConfiguration: UIImage.SymbolConfiguration(pointSize: 14)) } + primaryConfiguration.imagePadding = 7 + primaryConfiguration.baseForegroundColor = primaryEnabled ? .white : DroneDockStyle.secondary + primaryConfiguration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var attributes = attributes + attributes.font = .systemFont(ofSize: 15, weight: .semibold) + return attributes + } + primaryButton.configuration = primaryConfiguration + primaryButton.accessibilityIdentifier = primaryIdentifier + primaryButton.isEnabled = primaryEnabled + primaryButton.backgroundColor = .clear + secondaryButton.setTitle(secondaryTitle, for: .normal) + secondaryButton.accessibilityIdentifier = secondaryIdentifier + secondaryButton.isHidden = secondaryTitle == nil + } + + @objc private func acknowledgementTapped() { onAcknowledgementTap?() } + @objc private func primaryTapped() { onPrimaryTap?() } + @objc private func secondaryTapped() { onSecondaryTap?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDeliveryReviewViewController.swift b/suixinkan/UI/DroneDock/DroneDeliveryReviewViewController.swift new file mode 100644 index 0000000..c5643b9 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDeliveryReviewViewController.swift @@ -0,0 +1,437 @@ +import SnapKit +import UIKit + +/// 整单核对页的导航请求由机巢入口处理,不在这里打开游客网页或执行上传。 +@MainActor +protocol DroneDeliveryReviewViewControllerDelegate: AnyObject { + /// 商家尚未交齐或需要追加成片时继续交付。 + func deliveryReviewViewControllerDidRequestUpload(_ controller: DroneDeliveryReviewViewController) + /// 只读预览当前核对清单或历史确认快照中的成片。 + func deliveryReviewViewController(_ controller: DroneDeliveryReviewViewController, didRequestPreview work: DroneDeliveryWork) +} + +/// 商家侧整单交付核对、演示确认码与冻结确认记录;刷新不会模拟游客主动确认。 +@MainActor +final class DroneDeliveryReviewViewController: BaseViewController { + /// 交付与确认状态的唯一业务来源,核对范围始终为整单全部点位。 + let viewModel: DroneDeliveryViewModel + /// 成片上传和本地预览的跨页面导航。 + weak var delegate: DroneDeliveryReviewViewControllerDelegate? + /// 当前实际呈现清单的只读预览范围;历史记录不会夹带后来追加的作品。 + var previewMaterials: [DroneMaterial] { displayedGroups.flatMap(\.works).map(\.previewMaterial) } + + /// 页面阶段只决定呈现,不改变确认会话。 + private enum Stage: Equatable { + case review, code, receipt + } + + /// 辅助内容与每个点位采用稳定的 Diffable 分区身份。 + private enum Section: Hashable { + case order, introduction, statistics, code, receipt, manifestTitle, point(String), note + } + + /// 素材身份与可变的确认状态分离,刷新时重配置现有项。 + private enum Item: Hashable { + case order, introduction, statistics, code, receipt, manifestTitle, work(String), note + } + + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let footerView = DroneDeliveryReviewFooterView() + private var displayedReceipt: DroneDeliveryConfirmationSession? + private var groupsByID: [String: DroneDeliveryWorkGroup] = [:] + private var worksByID: [String: DroneDeliveryWork] = [:] + + private var activeReceipt: DroneDeliveryConfirmationSession? { + displayedReceipt ?? (viewModel.confirmationPhase == .confirmed ? viewModel.latestReceipt : nil) + } + + private var stage: Stage { + if activeReceipt != nil { return .receipt } + return viewModel.confirmationPhase == .review ? .review : .code + } + + private var displayedGroups: [DroneDeliveryWorkGroup] { + if let receipt = activeReceipt { return Self.groups(for: receipt.works) } + return stage == .code ? viewModel.confirmationGroups : viewModel.workGroups + } + + /// 从任意商家订单入口打开整单核对,不继承上传页面的点位筛选。 + init(viewModel: DroneDeliveryViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + refreshDeliveryState() + } + + /// 成片上传弹层结束后显式刷新本地快照,不推进游客确认状态。 + func refreshDeliveryState() { + viewModel.refresh() + if dataSource != nil { applySnapshot(animated: false) } + } + + override func setupNavigationBar() { + title = "订单交付确认" + navigationItem.backButtonDisplayMode = .minimal + let back = UIBarButtonItem(image: UIImage(systemName: "chevron.left"), style: .plain, target: self, action: #selector(backTapped)) + back.accessibilityIdentifier = "drone.delivery.review.back" + back.accessibilityLabel = "返回" + navigationItem.leftBarButtonItem = back + updateNavigationActions() + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = false + collectionView.accessibilityIdentifier = "drone.delivery.review.list" + collectionView.register(DroneDeliveryReviewOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DroneDeliveryReviewTextCell.self, forCellWithReuseIdentifier: "text") + collectionView.register(DroneDeliveryReviewStatisticsCell.self, forCellWithReuseIdentifier: "statistics") + collectionView.register(DroneDeliveryReviewWorkCell.self, forCellWithReuseIdentifier: "work") + collectionView.register(DroneDeliveryConfirmationCodeCell.self, forCellWithReuseIdentifier: "code") + collectionView.register(DroneDeliveryReceiptCell.self, forCellWithReuseIdentifier: "receipt") + collectionView.register(DroneDeliveryReviewPointHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "point") + view.addSubview(collectionView) + view.addSubview(footerView) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + footerView.onAcknowledgementTap = { [weak self] in + guard let self, self.stage == .review else { return } + self.viewModel.setAllDeliveredReviewed(!self.viewModel.isAllDeliveredReviewed) + self.applySnapshot(animated: true) + } + footerView.onPrimaryTap = { [weak self] in self?.performPrimaryAction() } + footerView.onSecondaryTap = { [weak self] in self?.performSecondaryAction() } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, self.dataSource != nil else { return nil } + let sections = self.dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(index) else { return nil } + if case .point = sections[index] { + let width = (environment.container.effectiveContentSize.width - 44) / 2 + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.5), heightDimension: .fractionalHeight(1))) + let group = NSCollectionLayoutGroup.horizontal( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(width * 0.57 + 49)), + repeatingSubitem: item, count: 2 + ) + group.interItemSpacing = .fixed(12) + let section = NSCollectionLayoutSection(group: group) + section.interGroupSpacing = 12 + section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 18, trailing: 16) + section.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(40)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top + )] + return section + } + let estimate: CGFloat + switch sections[index] { + case .code: estimate = 450 + case .receipt: estimate = 360 + case .statistics: estimate = 66 + default: estimate = 70 + } + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(estimate))) + let group = NSCollectionLayoutGroup.vertical( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(estimate)), subitems: [item] + ) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = NSDirectionalEdgeInsets(top: sections[index] == .code ? 18 : 0, leading: 16, bottom: sections[index] == .statistics ? 8 : 0, trailing: 16) + return section + } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, indexPath, item in + guard let self else { return nil } + switch item { + case .order: + let cell = list.dequeueReusableCell(withReuseIdentifier: "order", for: indexPath) as! DroneDeliveryReviewOrderCell + cell.apply(customer: self.activeReceipt?.visitorName ?? self.viewModel.order?.customerName ?? "订单暂不可用", + orderNumber: self.activeReceipt?.orderNumber ?? self.viewModel.order?.orderNumber ?? "请返回订单重新进入") + return cell + case .statistics: + let cell = list.dequeueReusableCell(withReuseIdentifier: "statistics", for: indexPath) as! DroneDeliveryReviewStatisticsCell + cell.apply(workCount: self.viewModel.works.count, pointCount: self.viewModel.workGroups.count) + return cell + case .work(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "work", for: indexPath) as! DroneDeliveryReviewWorkCell + if let work = self.worksByID[id] { + cell.apply(id: work.id, title: work.title, fileName: work.fileName, previewAssetName: work.previewAssetName, durationText: work.durationText) + cell.onPreviewTap = { [weak self] in + guard let self, let current = self.worksByID[id] else { return } + self.delegate?.deliveryReviewViewController(self, didRequestPreview: current) + } + } + return cell + case .code: + let cell = list.dequeueReusableCell(withReuseIdentifier: "code", for: indexPath) as! DroneDeliveryConfirmationCodeCell + let session = self.viewModel.confirmationSession + let feedback = self.viewModel.confirmationPhase == .feedback + ? session?.feedback.map { "\($0.kind.title):\($0.note.isEmpty ? "请与游客核对成片清单" : $0.note)" } : nil + cell.apply(status: self.viewModel.confirmationPhase.title, + tone: self.viewModel.confirmationPhase == .feedback ? .orange : .blue, + workCount: session?.works.count ?? 0, pointCount: self.viewModel.confirmationGroups.count, feedback: feedback) + return cell + case .receipt: + let cell = list.dequeueReusableCell(withReuseIdentifier: "receipt", for: indexPath) as! DroneDeliveryReceiptCell + if let receipt = self.activeReceipt { + cell.apply(workCount: receipt.works.count, pointCount: Self.groups(for: receipt.works).count, + visitor: receipt.visitorName, confirmedAt: Self.dateText(receipt.confirmedAt), operatorName: receipt.operatorName) + } + return cell + case .introduction, .manifestTitle, .note: + let cell = list.dequeueReusableCell(withReuseIdentifier: "text", for: indexPath) as! DroneDeliveryReviewTextCell + switch item { + case .introduction: + cell.apply(title: "先核对,再请游客确认", detail: "一次确认整单,不按打卡点逐次确认。", symbol: "checkmark.shield") + case .manifestTitle: + let title = self.stage == .receipt ? "已确认的成片清单" : (self.stage == .code ? "本次整单确认清单" : "整单交付清单") + cell.apply(title: title, detail: self.stage == .review ? "含所有上传批次" : "确认时的固定作品清单") + case .note: + let message: String + switch self.stage { + case .review: + message = self.viewModel.works.isEmpty ? "暂无已交付成片。请先完成成片交付,再核对整单作品。" : "请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。" + case .code: + message = "演示图案没有有效游客链接,不提供真实扫码收货服务。刷新仅同步本机状态,不会代替游客主动确认。" + case .receipt: + message = "当前为本机演示记录,并非真实收货凭据。新增成片不会覆盖这份确认清单。" + } + cell.apply(title: nil, detail: message) + default: break + } + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] list, kind, indexPath in + guard let self else { return nil } + let header = list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "point", for: indexPath) as! DroneDeliveryReviewPointHeader + self.applyPointHeader(header, sectionIndex: indexPath.section) + return header + } + } + + private func applyPointHeader(_ header: DroneDeliveryReviewPointHeader, sectionIndex: Int) { + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(sectionIndex), case .point(let id) = sections[sectionIndex], let group = groupsByID[id] else { return } + header.apply(pointName: group.pointName, workCount: group.works.count) + } + + private func applySnapshot(animated: Bool) { + guard isViewLoaded, dataSource != nil else { return } + let groups = displayedGroups + groupsByID = Dictionary(uniqueKeysWithValues: groups.map { ($0.id, $0) }) + worksByID = Dictionary(uniqueKeysWithValues: groups.flatMap(\.works).map { ($0.id, $0) }) + let previous = dataSource.snapshot() + let existing = Set(previous.itemIdentifiers) + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.order]) + snapshot.appendItems([.order], toSection: .order) + switch stage { + case .review: + snapshot.appendSections([.introduction, .statistics]) + snapshot.appendItems([.introduction], toSection: .introduction) + snapshot.appendItems([.statistics], toSection: .statistics) + case .code: + snapshot.appendSections([.code]) + snapshot.appendItems([.code], toSection: .code) + case .receipt: + snapshot.appendSections([.receipt]) + snapshot.appendItems([.receipt], toSection: .receipt) + } + snapshot.appendSections([.manifestTitle]) + snapshot.appendItems([.manifestTitle], toSection: .manifestTitle) + for group in groups { + let section = Section.point(group.id) + snapshot.appendSections([section]) + snapshot.appendItems(group.works.map { .work($0.id) }, toSection: section) + } + snapshot.appendSections([.note]) + snapshot.appendItems([.note], toSection: .note) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existing.contains($0) }) + applyFooter() + updateNavigationActions() + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + guard let self else { return } + let kind = UICollectionView.elementKindSectionHeader + for path in self.collectionView.indexPathsForVisibleSupplementaryElements(ofKind: kind) { + guard let header = self.collectionView.supplementaryView(forElementKind: kind, at: path) as? DroneDeliveryReviewPointHeader else { continue } + self.applyPointHeader(header, sectionIndex: path.section) + } + } + if previous.sectionIdentifiers != snapshot.sectionIdentifiers { collectionView.collectionViewLayout.invalidateLayout() } + } + + private func applyFooter() { + switch stage { + case .review: + footerView.apply(acknowledged: viewModel.isAllDeliveredReviewed, note: "本机交互演示 · 无真实游客链接", + primaryTitle: "已交齐,展示订单确认码", primaryIdentifier: "drone.delivery.review.showCode", primaryEnabled: viewModel.canCreateConfirmation, + secondaryTitle: "还未交齐,继续交付", secondaryIdentifier: "drone.delivery.review.continueUpload") + case .code: + let feedback = viewModel.confirmationPhase == .feedback + footerView.apply(acknowledged: nil, note: "本机演示状态,不代表真实收货", + primaryTitle: feedback ? "重新核对整单" : "刷新确认状态", primaryIdentifier: feedback ? "drone.delivery.review.restart" : "drone.delivery.confirmation.refresh", primaryEnabled: true, + secondaryTitle: feedback ? "继续补充交付" : "稍后确认,返回订单", secondaryIdentifier: feedback ? "drone.delivery.review.continueUpload" : "drone.delivery.confirmation.later") + case .receipt: + let hasCurrentReview = displayedReceipt != nil && viewModel.confirmationPhase != .confirmed + footerView.apply(acknowledged: nil, note: "仅确认交付清单,不代表对拍摄效果无异议", + primaryTitle: hasCurrentReview ? "返回当前整单核对" : "返回订单", primaryIdentifier: hasCurrentReview ? "drone.delivery.review.current" : "drone.delivery.confirmation.backToOrders", primaryEnabled: true, + secondaryTitle: hasCurrentReview ? nil : "追加成片,开始新核对", secondaryIdentifier: "drone.delivery.review.continueUpload") + } + } + + private func performPrimaryAction() { + switch stage { + case .review: + guard viewModel.createConfirmationSession() else { return } + case .code: + if viewModel.confirmationPhase == .feedback { viewModel.beginNewReview() } + else { viewModel.refreshConfirmation() } + case .receipt: + if displayedReceipt != nil && viewModel.confirmationPhase != .confirmed { displayedReceipt = nil } + else { closePage(); return } + } + applySnapshot(animated: true) + collectionView.setContentOffset(CGPoint(x: 0, y: -collectionView.adjustedContentInset.top), animated: false) + } + + private func performSecondaryAction() { + switch stage { + case .review, .receipt: + displayedReceipt = nil + delegate?.deliveryReviewViewControllerDidRequestUpload(self) + case .code: + if viewModel.confirmationPhase == .feedback { delegate?.deliveryReviewViewControllerDidRequestUpload(self) } + else { closePage() } + } + } + + private func updateNavigationActions() { + var actions: [UIBarButtonItem] = [] + if !viewModel.confirmationRecords.isEmpty { + let records = viewModel.confirmationRecords.map { record in + UIAction(title: "\(Self.dateText(record.confirmedAt)) · \(record.works.count)个成片", + state: self.activeReceipt?.id == record.id ? .on : .off) { [weak self] _ in + guard let self else { return } + self.displayedReceipt = record + self.applySnapshot(animated: true) + self.collectionView.setContentOffset(CGPoint(x: 0, y: -self.collectionView.adjustedContentInset.top), animated: false) + } + } + let history = UIBarButtonItem(image: UIImage(systemName: "clock.arrow.circlepath"), menu: UIMenu(title: "本机演示确认记录", children: records)) + history.accessibilityIdentifier = "drone.delivery.confirmation.history" + history.accessibilityLabel = "查看确认记录" + actions.append(history) + } + #if DEBUG + let viewing = UIAction(title: "模拟游客查看中", image: UIImage(systemName: "eye")) { [weak self] _ in self?.simulateViewing() } + let confirmed = UIAction(title: "模拟游客主动确认", image: UIImage(systemName: "checkmark.circle")) { [weak self] _ in self?.simulateConfirmed() } + let feedback = DroneDeliveryFeedbackKind.allCases.map { kind in + UIAction(title: kind.title) { [weak self] _ in self?.simulateFeedback(kind) } + } + let scenarios: [DroneDeliveryScenario] = [.empty, .completed, .awaitingConfirmation, .viewing, .feedback, .confirmed] + let fixtures = scenarios.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in + guard let self else { return } + self.displayedReceipt = nil + self.viewModel.applyScenario(scenario) + self.applySnapshot(animated: true) + } + } + let menu = UIMenu(title: "本机确认演示,不连接游客", children: [ + UIMenu(options: .displayInline, children: [viewing, confirmed]), + UIMenu(title: "模拟游客反馈", children: feedback), + UIMenu(title: "载入演示状态", children: fixtures) + ]) + let debug = UIBarButtonItem(image: UIImage(systemName: "slider.horizontal.3"), menu: menu) + debug.accessibilityIdentifier = "drone.delivery.review.scenarios" + debug.accessibilityLabel = "交付确认演示状态" + actions.append(debug) + #endif + navigationItem.rightBarButtonItems = actions + } + + #if DEBUG + private func simulateViewing() { + guard let session = viewModel.confirmationSession else { showToast("请先核对整单并展示确认码"); return } + displayedReceipt = nil + viewModel.receiveConfirmation(.viewing, sessionID: session.id) + applySnapshot(animated: true) + } + + private func simulateConfirmed() { + guard let session = viewModel.confirmationSession else { showToast("请先核对整单并展示确认码"); return } + displayedReceipt = nil + viewModel.receiveConfirmation(.viewing, sessionID: session.id) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + applySnapshot(animated: true) + collectionView.setContentOffset(CGPoint(x: 0, y: -collectionView.adjustedContentInset.top), animated: false) + } + + private func simulateFeedback(_ kind: DroneDeliveryFeedbackKind) { + guard let session = viewModel.confirmationSession else { showToast("请先核对整单并展示确认码"); return } + displayedReceipt = nil + viewModel.receiveConfirmation(.viewing, sessionID: session.id) + viewModel.receiveConfirmation(.feedback(kind: kind, note: "本机演示反馈,请核对成片清单。"), sessionID: session.id) + applySnapshot(animated: true) + } + #endif + + private func closePage() { + if let navigationController, navigationController.viewControllers.first !== self { navigationController.popViewController(animated: true) } + else { dismiss(animated: true) } + } + + @objc private func backTapped() { + if displayedReceipt != nil && viewModel.confirmationPhase != .confirmed { + displayedReceipt = nil + applySnapshot(animated: true) + } else { closePage() } + } + + /// 按快照首次出现顺序呈现点位,不以当前作品库重新计算历史确认范围。 + private static func groups(for works: [DroneDeliveryWork]) -> [DroneDeliveryWorkGroup] { + var order: [String] = [] + var names: [String: String] = [:] + var values: [String: [DroneDeliveryWork]] = [:] + for work in works { + if values[work.pointID] == nil { order.append(work.pointID); names[work.pointID] = work.pointName } + values[work.pointID, default: []].append(work) + } + return order.map { DroneDeliveryWorkGroup(pointID: $0, pointName: names[$0] ?? "打卡点", works: values[$0] ?? []) } + } + + private static func dateText(_ date: Date?) -> String { + guard let date else { return "—" } + let formatter = DateFormatter() + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = "yyyy/MM/dd HH:mm:ss" + return formatter.string(from: date) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDeliveryUploadComponents.swift b/suixinkan/UI/DroneDock/DroneDeliveryUploadComponents.swift new file mode 100644 index 0000000..9fe7cfa --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDeliveryUploadComponents.swift @@ -0,0 +1,389 @@ +import SnapKit +import UIKit + +/// 交付 Sheet 的标题、订单摘要及 44 点关闭按钮。 +@MainActor +final class DroneDeliveryUploadHeaderView: UIView { + /// 关闭当前交付流程。 + var onCloseTap: (() -> Void)? + private let titleLabel = DroneDockStyle.label(size: 19, weight: .semibold) + private let customerLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let closeButton = UIButton(type: .system) + private let debugButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + closeButton.setImage(UIImage(systemName: "xmark", withConfiguration: UIImage.SymbolConfiguration(pointSize: 14)), for: .normal) + closeButton.tintColor = DroneDockStyle.secondary + closeButton.accessibilityLabel = "关闭成片交付" + closeButton.accessibilityIdentifier = "drone.delivery.upload.close" + closeButton.addTarget(self, action: #selector(closeTapped), for: .touchUpInside) + debugButton.setImage(UIImage(systemName: "slider.horizontal.3"), for: .normal) + debugButton.tintColor = DroneDockStyle.secondary + debugButton.showsMenuAsPrimaryAction = true + debugButton.isHidden = true + debugButton.accessibilityIdentifier = "drone.delivery.upload.scenarios" + debugButton.accessibilityLabel = "成片交付演示状态" + [titleLabel, customerLabel, detailLabel, closeButton, debugButton].forEach(addSubview) + titleLabel.accessibilityTraits = .header + titleLabel.snp.makeConstraints { make in make.top.equalToSuperview().offset(16); make.leading.equalToSuperview().offset(20); make.trailing.lessThanOrEqualTo(closeButton.snp.leading) } + customerLabel.snp.makeConstraints { make in make.leading.equalTo(titleLabel); make.top.equalTo(titleLabel.snp.bottom).offset(20); make.trailing.lessThanOrEqualTo(closeButton.snp.leading).offset(-4) } + detailLabel.snp.makeConstraints { make in make.leading.equalTo(titleLabel); make.top.equalTo(customerLabel.snp.bottom).offset(6); make.trailing.equalToSuperview().inset(20); make.bottom.equalToSuperview().inset(12) } + closeButton.snp.makeConstraints { make in make.trailing.equalToSuperview().inset(8); make.centerY.equalTo(customerLabel); make.size.equalTo(44) } + debugButton.snp.makeConstraints { make in make.trailing.equalTo(closeButton); make.centerY.equalTo(titleLabel); make.size.equalTo(44) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 阶段变化时只更新标题与上下文,不修改业务状态。 + func apply(title: String, customer: String, detail: String) { + titleLabel.text = title + customerLabel.text = customer + detailLabel.text = detail + } + + /// 在本地演示版本显示显式验收菜单。 + func setDebugMenu(_ menu: UIMenu) { + debugButton.menu = menu + debugButton.isHidden = false + } + + @objc private func closeTapped() { onCloseTap?() } +} + +/// 面对面闪传或云端上传的整卡入口。 +@MainActor +final class DroneDeliveryUploadMethodCell: UICollectionViewCell { + private let iconView = UIImageView() + private let titleLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let arrowView = UIImageView(image: UIImage(systemName: "chevron.right")) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.backgroundColor = UIColor(hex: 0xF9FAFD) + contentView.layer.cornerRadius = 12 + contentView.layer.borderWidth = 1 + contentView.layer.borderColor = DroneDockStyle.border.cgColor + iconView.tintColor = DroneDockStyle.primary + iconView.backgroundColor = DroneDockStyle.primary.withAlphaComponent(0.06) + iconView.layer.cornerRadius = 10 + iconView.contentMode = .center + arrowView.tintColor = DroneDockStyle.secondary + arrowView.contentMode = .scaleAspectFit + [iconView, titleLabel, detailLabel, arrowView].forEach(contentView.addSubview) + iconView.snp.makeConstraints { make in make.leading.equalToSuperview().offset(14); make.centerY.equalToSuperview(); make.size.equalTo(44) } + titleLabel.snp.makeConstraints { make in make.leading.equalTo(iconView.snp.trailing).offset(12); make.top.equalToSuperview().offset(21); make.trailing.lessThanOrEqualTo(arrowView.snp.leading).offset(-8) } + detailLabel.snp.makeConstraints { make in make.leading.equalTo(titleLabel); make.top.equalTo(titleLabel.snp.bottom).offset(6); make.trailing.lessThanOrEqualTo(arrowView.snp.leading).offset(-8) } + arrowView.snp.makeConstraints { make in make.trailing.equalToSuperview().inset(15); make.centerY.equalToSuperview(); make.width.equalTo(8); make.height.equalTo(13) } + isAccessibilityElement = true + accessibilityTraits = .button + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 展示可观察的方式说明,不暗示闪传已经接入。 + func apply(title: String, detail: String, symbol: String, identifier: String) { + titleLabel.text = title + detailLabel.text = detail + iconView.image = UIImage(systemName: symbol, withConfiguration: UIImage.SymbolConfiguration(pointSize: 23)) + accessibilityLabel = "\(title),\(detail)" + accessibilityIdentifier = identifier + } +} + +/// 云端交付目标点位的单选行。 +@MainActor +final class DroneDeliveryUploadPointCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 16) + private let checkmark = UIImageView() + + override init(frame: CGRect) { + super.init(frame: frame) + checkmark.contentMode = .scaleAspectFit + let line = UIView() + line.backgroundColor = DroneDockStyle.border + [titleLabel, checkmark, line].forEach(contentView.addSubview) + titleLabel.snp.makeConstraints { make in make.leading.centerY.equalToSuperview(); make.trailing.lessThanOrEqualTo(checkmark.snp.leading).offset(-12) } + checkmark.snp.makeConstraints { make in make.trailing.centerY.equalToSuperview(); make.size.equalTo(21) } + line.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview(); make.height.equalTo(1 / UIScreen.main.scale) } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 已选点位仍可再次点击,不通过 UI 取消单选。 + func apply(point: DroneShootingPoint, selected: Bool, locked: Bool) { + titleLabel.text = point.name + titleLabel.textColor = selected ? DroneDockStyle.primary : DroneDockStyle.text + checkmark.image = UIImage(systemName: selected ? "checkmark.circle" : "circle") + checkmark.tintColor = selected ? DroneDockStyle.primary : DroneDockStyle.secondary + contentView.alpha = locked ? 0.5 : 1 + accessibilityIdentifier = "drone.delivery.upload.point.\(point.id)" + accessibilityLabel = point.name + var traits: UIAccessibilityTraits = .button + if selected { traits.insert(.selected) } + if locked { traits.insert(.notEnabled) } + accessibilityTraits = traits + } +} + +/// 本地演示视频缩略图;整卡选择与预览按钮分开,避免打开预览时改变勾选。 +@MainActor +final class DroneDeliveryUploadVideoCell: UICollectionViewCell { + /// 点击整卡选择区域时仅切换当前视频。 + var onSelectionTap: (() -> Void)? + /// 点击独立预览按钮时通知控制器。 + var onPreviewTap: (() -> Void)? + private let thumbnail = UIImageView() + private let checkmark = UIImageView() + private let durationLabel = DroneDockStyle.label(size: 10, color: .white) + private let titleLabel = DroneDockStyle.label(size: 12, weight: .medium) + private let previewButton = UIButton(type: .system) + private let selectionButton = UIButton(type: .custom) + + override init(frame: CGRect) { + super.init(frame: frame) + thumbnail.contentMode = .scaleAspectFill + thumbnail.clipsToBounds = true + thumbnail.layer.cornerRadius = 7 + thumbnail.layer.borderWidth = 2 + checkmark.contentMode = .scaleAspectFit + durationLabel.backgroundColor = UIColor.black.withAlphaComponent(0.5) + durationLabel.textAlignment = .center + durationLabel.layer.cornerRadius = 3 + durationLabel.clipsToBounds = true + previewButton.setImage(UIImage(systemName: "play.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 22)), for: .normal) + previewButton.tintColor = .white + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + selectionButton.addTarget(self, action: #selector(selectionTapped), for: .touchUpInside) + [thumbnail, checkmark, durationLabel, titleLabel, selectionButton, previewButton].forEach(contentView.addSubview) + thumbnail.snp.makeConstraints { make in make.top.leading.trailing.equalToSuperview(); make.height.equalTo(thumbnail.snp.width).multipliedBy(0.56) } + checkmark.snp.makeConstraints { make in make.top.equalTo(thumbnail).offset(7); make.trailing.equalTo(thumbnail).inset(7); make.size.equalTo(22) } + durationLabel.snp.makeConstraints { make in make.bottom.trailing.equalTo(thumbnail).inset(6); make.width.equalTo(44); make.height.equalTo(18) } + previewButton.snp.makeConstraints { make in make.leading.bottom.equalTo(thumbnail); make.size.equalTo(44) } + titleLabel.snp.makeConstraints { make in make.leading.trailing.equalToSuperview(); make.top.equalTo(thumbnail.snp.bottom).offset(8); make.bottom.lessThanOrEqualToSuperview() } + selectionButton.snp.makeConstraints { make in make.edges.equalToSuperview() } + contentView.isAccessibilityElement = false + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 图片及预览均来自本地示例,不读取手机文件。 + func apply(video: DroneDeliveryVideo, selected: Bool) { + thumbnail.image = UIImage(named: video.previewAssetName) + thumbnail.layer.borderColor = selected ? DroneDockStyle.primary.cgColor : UIColor.clear.cgColor + checkmark.image = UIImage(systemName: selected ? "checkmark.circle.fill" : "circle") + checkmark.tintColor = selected ? DroneDockStyle.primary : .white + titleLabel.text = video.title + durationLabel.text = video.durationText + selectionButton.accessibilityIdentifier = "drone.delivery.upload.video.\(video.id)" + selectionButton.accessibilityLabel = "选择\(video.title),\(video.durationText)" + selectionButton.accessibilityTraits = selected ? [.button, .selected] : .button + isAccessibilityElement = false + previewButton.accessibilityIdentifier = "drone.delivery.upload.preview.\(video.id)" + previewButton.accessibilityLabel = "预览\(video.title)" + } + + @objc private func previewTapped() { onPreviewTap?() } + @objc private func selectionTapped() { onSelectionTap?() } +} + +/// 上传队列的一条视频记录,文件描述、逐项进度与演示结果分别展示。 +@MainActor +final class DroneDeliveryUploadQueueCell: UICollectionViewCell { + private let iconView = UIImageView(image: UIImage(systemName: "play.rectangle")) + private let titleLabel = DroneDockStyle.label(size: 13, weight: .medium) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let statusLabel = DroneDockStyle.label(size: 11) + private let progressView = UIProgressView(progressViewStyle: .default) + + override init(frame: CGRect) { + super.init(frame: frame) + iconView.tintColor = DroneDockStyle.secondary + iconView.contentMode = .scaleAspectFit + progressView.progressTintColor = DroneDockStyle.primary + progressView.trackTintColor = UIColor(hex: 0xEDF1F8) + let line = UIView() + line.backgroundColor = DroneDockStyle.border + [iconView, titleLabel, detailLabel, statusLabel, progressView, line].forEach(contentView.addSubview) + iconView.snp.makeConstraints { make in make.leading.equalToSuperview(); make.centerY.equalToSuperview().offset(-4); make.size.equalTo(24) } + statusLabel.snp.makeConstraints { make in make.trailing.equalToSuperview(); make.centerY.equalTo(iconView); make.width.lessThanOrEqualTo(100) } + titleLabel.lineBreakMode = .byTruncatingMiddle + titleLabel.snp.makeConstraints { make in make.leading.equalTo(iconView.snp.trailing).offset(12); make.top.equalToSuperview().offset(17); make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-10) } + detailLabel.snp.makeConstraints { make in make.leading.equalTo(titleLabel); make.top.equalTo(titleLabel.snp.bottom).offset(5); make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-10) } + progressView.snp.makeConstraints { make in make.leading.equalTo(titleLabel); make.trailing.equalToSuperview(); make.bottom.equalToSuperview().inset(9); make.height.equalTo(2) } + line.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview(); make.height.equalTo(1 / UIScreen.main.scale) } + isAccessibilityElement = true + accessibilityTraits = .button + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 队列成功只展示演示交付,不向游客发送作品。 + func apply(item: DroneDeliveryUploadItem) { + titleLabel.text = item.video.fileName + detailLabel.text = "\(item.video.durationText) · \(item.video.sizeText)" + let progress: Double? + switch item.state { + case .uploading(let value): + statusLabel.text = "上传中 \(Int(value * 100))%" + statusLabel.textColor = DroneDockStyle.primary + progress = value + case .paused: + statusLabel.text = "已暂停" + statusLabel.textColor = DroneDockStyle.warning + progress = nil + case .failed: + statusLabel.text = "上传失败" + statusLabel.textColor = DroneDockStyle.color(for: .red) + progress = nil + case .completed: + statusLabel.text = "演示交付成功" + statusLabel.textColor = DroneDockStyle.success + progress = nil + } + progressView.isHidden = progress == nil + progressView.setProgress(Float(progress ?? 0), animated: true) + accessibilityIdentifier = "drone.delivery.upload.item.\(item.id)" + accessibilityLabel = [item.video.fileName, detailLabel.text, statusLabel.text, "点按预览"].compactMap { $0 }.joined(separator: ",") + } +} + +/// 闪传待确认、无点位与无可选视频等状态的说明。 +@MainActor +final class DroneDeliveryUploadMessageCell: UICollectionViewCell { + private let iconView = UIImageView() + private let titleLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + iconView.tintColor = DroneDockStyle.primary + iconView.contentMode = .scaleAspectFit + titleLabel.textAlignment = .center + detailLabel.textAlignment = .center + detailLabel.numberOfLines = 0 + let stack = UIStackView(arrangedSubviews: [iconView, titleLabel, detailLabel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 15 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.centerY.equalToSuperview(); make.leading.trailing.equalToSuperview().inset(8) } + iconView.snp.makeConstraints { make in make.size.equalTo(34) } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 展示不包含真实设备连接或传输动作的说明。 + func apply(title: String, detail: String, symbol: String) { + titleLabel.text = title + detailLabel.text = detail + iconView.image = UIImage(systemName: symbol) + accessibilityLabel = "\(title),\(detail)" + } +} + +/// 队列摘要与查看已交付作品入口。 +@MainActor +final class DroneDeliveryUploadSummaryCell: UICollectionViewCell { + /// 查看当前订单的演示交付作品。 + var onReviewTap: (() -> Void)? + private let titleLabel = DroneDockStyle.label(size: 13, weight: .medium) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let reviewButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + reviewButton.setTitle("查看作品", for: .normal) + reviewButton.titleLabel?.font = .systemFont(ofSize: 11) + reviewButton.tintColor = DroneDockStyle.primary + reviewButton.accessibilityIdentifier = "drone.delivery.upload.review" + reviewButton.addTarget(self, action: #selector(reviewTapped), for: .touchUpInside) + [titleLabel, detailLabel, reviewButton].forEach(contentView.addSubview) + titleLabel.snp.makeConstraints { make in make.leading.equalToSuperview(); make.centerY.equalToSuperview().offset(-10) } + detailLabel.snp.makeConstraints { make in make.leading.equalTo(titleLabel); make.top.equalTo(titleLabel.snp.bottom).offset(6) } + reviewButton.snp.makeConstraints { make in make.trailing.centerY.equalToSuperview(); make.width.equalTo(68); make.height.equalTo(44) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 计数仅统计当前演示批次成功回执。 + func apply(completed: Int, detail: String) { + titleLabel.text = "本次演示交付 \(completed) 个作品" + detailLabel.text = detail + reviewButton.isHidden = completed == 0 + } + + @objc private func reviewTapped() { onReviewTap?() } +} + +/// 交付各阶段共用的主按钮、补充说明和返回或完成入口。 +@MainActor +final class DroneDeliveryUploadFooterView: UIView { + /// 执行当前阶段的主操作。 + var onPrimaryTap: (() -> Void)? + /// 返回上一阶段或完成本次流程。 + var onSecondaryTap: (() -> Void)? + private let primaryButton = UIButton(type: .system) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let secondaryButton = UIButton(type: .system) + private let stack = UIStackView() + + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + stack.axis = .vertical + stack.spacing = 9 + primaryButton.layer.cornerRadius = 8 + primaryButton.layer.cornerCurve = .continuous + primaryButton.tintColor = .white + primaryButton.titleLabel?.font = .systemFont(ofSize: 15, weight: .medium) + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + detailLabel.textAlignment = .center + detailLabel.numberOfLines = 2 + secondaryButton.titleLabel?.font = .systemFont(ofSize: 12) + secondaryButton.tintColor = DroneDockStyle.secondary + secondaryButton.addTarget(self, action: #selector(secondaryTapped), for: .touchUpInside) + [primaryButton, detailLabel, secondaryButton].forEach(stack.addArrangedSubview) + addSubview(stack) + stack.snp.makeConstraints { make in make.leading.trailing.equalToSuperview().inset(20); make.top.equalToSuperview().offset(14); make.bottom.equalTo(safeAreaLayoutGuide).inset(12) } + primaryButton.snp.makeConstraints { make in make.height.equalTo(44).priority(999) } + secondaryButton.snp.makeConstraints { make in make.height.equalTo(44).priority(999) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 不同阶段提供明确动作;上传中的按钮保留可见但不可重复提交。 + func apply(primaryTitle: String?, enabled: Bool, identifier: String, detail: String, secondaryTitle: String?) { + UIView.performWithoutAnimation { + primaryButton.setTitle(primaryTitle, for: .normal) + primaryButton.setTitle(primaryTitle, for: .disabled) + primaryButton.isHidden = primaryTitle == nil + primaryButton.isEnabled = enabled + primaryButton.backgroundColor = enabled ? DroneDockStyle.primary : UIColor(hex: 0xE7EEFF) + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(DroneDockStyle.primary.withAlphaComponent(0.6), for: .disabled) + primaryButton.accessibilityIdentifier = identifier + detailLabel.text = detail + detailLabel.isHidden = detail.isEmpty + secondaryButton.setTitle(secondaryTitle, for: .normal) + secondaryButton.isHidden = secondaryTitle == nil + secondaryButton.accessibilityIdentifier = "drone.delivery.upload.secondary" + primaryButton.layoutIfNeeded() + } + } + + @objc private func primaryTapped() { onPrimaryTap?() } + @objc private func secondaryTapped() { onSecondaryTap?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDeliveryUploadViewController.swift b/suixinkan/UI/DroneDock/DroneDeliveryUploadViewController.swift new file mode 100644 index 0000000..8013c42 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDeliveryUploadViewController.swift @@ -0,0 +1,430 @@ +import SnapKit +import UIKit + +/// 交付 Sheet 只请求完成、查看记录与本地视频预览,跨页面导航由入口统一处理。 +@MainActor +protocol DroneDeliveryUploadViewControllerDelegate: AnyObject { + /// 关闭交付流程并刷新入口的本地演示摘要。 + func deliveryUploadViewControllerDidFinish(_ controller: DroneDeliveryUploadViewController) + /// 进入当前订单的已交付作品记录。 + func deliveryUploadViewControllerDidRequestReview(_ controller: DroneDeliveryUploadViewController) + /// 预览本地示例视频,保持现有上传状态与勾选。 + func deliveryUploadViewController(_ controller: DroneDeliveryUploadViewController, didRequestPreview video: DroneDeliveryVideo) +} + +/// 成片交付的本地演示:选择方式、点位与视频,逐项展示前台上传及结果。 +@MainActor +final class DroneDeliveryUploadViewController: BaseViewController { + /// 订单、目标点位、选择及演示上传队列的业务状态来源。 + let viewModel: DroneDeliveryViewModel + /// 将完成与预览导航交回入口。 + weak var delegate: DroneDeliveryUploadViewControllerDelegate? + + /// 页面阶段只管理展示导航,不参与上传成功或拍摄次数计算。 + private enum Phase: Equatable { case method, point, picker, queue } + /// 队列摘要与主体使用独立分区。 + private enum Section: Hashable { case summary, content } + /// 每一项依靠稳定业务身份更新,选择与进度不改变 Diffable 标识。 + private enum Item: Hashable { + case nearbyMethod, cloudMethod, point(String), video(String), upload(String), summary, empty + } + + private var phase: Phase + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let headerView = DroneDeliveryUploadHeaderView() + private let footerView = DroneDeliveryUploadFooterView() + private let uploadDriver = DroneDeliveryDemoUploadDriver() + private var videosByID: [String: DroneDeliveryVideo] = [:] + private var uploadItemsByID: [String: DroneDeliveryUploadItem] = [:] + private var didRequestFinish = false + + /// 每次从外部进入均先选择交付方式,已有批次在选择云端后恢复。 + init(viewModel: DroneDeliveryViewModel) { + self.viewModel = viewModel + phase = .method + super.init(nibName: nil, bundle: nil) + modalPresentationStyle = .pageSheet + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 返回前台或结束预览后只刷新本地状态,不自动启动暂停队列。 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.setNavigationBarHidden(true, animated: false) + viewModel.refresh() + if dataSource != nil { applySnapshot(animated: false) } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + navigationController?.presentationController?.delegate = self + if navigationController == nil { presentationController?.delegate = self } + } + + /// 真正关闭交付 Sheet 时暂停未完成项;全屏预览覆盖页面不改变上传状态。 + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + if isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true { + if let coordinator = transitionCoordinator, coordinator.isInteractive { + coordinator.animate(alongsideTransition: nil) { [weak self] context in + if !context.isCancelled { self?.pauseForLeaving() } + } + } else { + pauseForLeaving() + } + } + } + + override func setupNavigationBar() { + navigationController?.setNavigationBarHidden(true, animated: false) + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = false + collectionView.showsVerticalScrollIndicator = false + collectionView.accessibilityIdentifier = "drone.delivery.upload.list" + collectionView.delegate = self + collectionView.register(DroneDeliveryUploadMethodCell.self, forCellWithReuseIdentifier: "method") + collectionView.register(DroneDeliveryUploadPointCell.self, forCellWithReuseIdentifier: "point") + collectionView.register(DroneDeliveryUploadVideoCell.self, forCellWithReuseIdentifier: "video") + collectionView.register(DroneDeliveryUploadQueueCell.self, forCellWithReuseIdentifier: "upload") + collectionView.register(DroneDeliveryUploadMessageCell.self, forCellWithReuseIdentifier: "message") + collectionView.register(DroneDeliveryUploadSummaryCell.self, forCellWithReuseIdentifier: "summary") + [headerView, collectionView, footerView].forEach(view.addSubview) + configureDataSource() + configureDebugMenu() + applySnapshot(animated: false) + } + + override func setupConstraints() { + headerView.snp.makeConstraints { make in make.top.equalTo(view.safeAreaLayoutGuide); make.leading.trailing.equalToSuperview() } + collectionView.snp.makeConstraints { make in + make.top.equalTo(headerView.snp.bottom) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + headerView.onCloseTap = { [weak self] in self?.finish() } + footerView.onPrimaryTap = { [weak self] in self?.primaryTapped() } + footerView.onSecondaryTap = { [weak self] in self?.secondaryTapped() } + NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), + name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] sectionIndex, environment in + guard let self, let dataSource = self.dataSource else { return nil } + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(sectionIndex) else { return nil } + let section = sections[sectionIndex] + if section == .summary { return self.listSection(height: 58) } + if self.phase == .picker, !self.viewModel.availableVideos.isEmpty { + let width = max(1, (environment.container.effectiveContentSize.width - 54) / 2) + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(0.5), heightDimension: .fractionalHeight(1) + )) + let group = NSCollectionLayoutGroup.horizontal( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(width * 0.56 + 32)), + repeatingSubitem: item, count: 2 + ) + group.interItemSpacing = .fixed(14) + let layoutSection = NSCollectionLayoutSection(group: group) + layoutSection.contentInsets = NSDirectionalEdgeInsets(top: 4, leading: 20, bottom: 6, trailing: 20) + layoutSection.interGroupSpacing = 14 + return layoutSection + } + let height: CGFloat + switch self.phase { + case .method: height = 88 + case .point: height = self.viewModel.points.isEmpty ? 180 : 52 + case .picker: height = 180 + case .queue: height = self.viewModel.batch?.items.isEmpty == false ? 82 : 180 + } + return self.listSection(height: height, spacing: self.phase == .method ? 12 : 0) + } + } + + private func listSection(height: CGFloat, spacing: CGFloat = 0) -> NSCollectionLayoutSection { + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1), heightDimension: .fractionalHeight(1) + )) + let group = NSCollectionLayoutGroup.vertical( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(height)), subitems: [item] + ) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = NSDirectionalEdgeInsets(top: 4, leading: 20, bottom: 4, trailing: 20) + section.interGroupSpacing = spacing + return section + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, indexPath, item in + guard let self else { return nil } + switch item { + case .nearbyMethod, .cloudMethod: + let cell = list.dequeueReusableCell(withReuseIdentifier: "method", for: indexPath) as! DroneDeliveryUploadMethodCell + if item == .nearbyMethod { + cell.apply(title: "面对面闪传", detail: "同一 Wi-Fi 扫码接收 · 无需上传", symbol: "wifi", + identifier: "drone.delivery.upload.method.nearby") + } else { + cell.apply(title: "云端上传", detail: "选择打卡点,演示上传成片", symbol: "icloud.and.arrow.up", + identifier: "drone.delivery.upload.method.cloud") + } + return cell + case .point(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "point", for: indexPath) as! DroneDeliveryUploadPointCell + if let point = self.viewModel.points.first(where: { $0.id == id }) { + cell.apply(point: point, selected: self.viewModel.selectedPointID == id, locked: self.viewModel.isUploadLocked) + } + return cell + case .video(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "video", for: indexPath) as! DroneDeliveryUploadVideoCell + if let video = self.videosByID[id] { + cell.apply(video: video, selected: self.viewModel.selectedVideoIDs.contains(id)) + cell.onSelectionTap = { [weak self] in + guard let self else { return } + self.viewModel.toggleVideo(id: id) + self.applySnapshot(animated: true) + } + cell.onPreviewTap = { [weak self] in + guard let self else { return } + self.delegate?.deliveryUploadViewController(self, didRequestPreview: video) + } + } + return cell + case .upload(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "upload", for: indexPath) as! DroneDeliveryUploadQueueCell + if let item = self.uploadItemsByID[id] { cell.apply(item: item) } + return cell + case .summary: + let cell = list.dequeueReusableCell(withReuseIdentifier: "summary", for: indexPath) as! DroneDeliveryUploadSummaryCell + cell.apply(completed: self.viewModel.uploadedCount, detail: self.queueSummary) + cell.onReviewTap = { [weak self] in + guard let self else { return } + self.pauseForLeaving() + self.delegate?.deliveryUploadViewControllerDidRequestReview(self) + } + return cell + case .empty: + let cell = list.dequeueReusableCell(withReuseIdentifier: "message", for: indexPath) as! DroneDeliveryUploadMessageCell + if self.phase == .point { + cell.apply(title: "暂无可交付点位", detail: "当前订单没有可用点位,请稍后重试。", symbol: "mappin.slash.circle") + } else if self.phase == .picker { + cell.apply(title: "暂无可选演示视频", detail: "本点位的示例视频已交付,可返回选择其他点位。", symbol: "video.slash") + } else { + cell.apply(title: "暂无上传队列", detail: "请选择视频后开始演示上传。", symbol: "icloud.and.arrow.up") + } + return cell + } + } + } + + private var queueSummary: String { + switch viewModel.uploadPhase { + case .idle: "请选择视频后开始演示上传" + case .uploading: "\(viewModel.pendingCount)个上传中 · 仅在本地演示" + case .paused: "上传已暂停,请手动继续" + case .partialFailure: "\(viewModel.failedCount)个上传失败" + case .completed: "全部演示上传成功 · 未向游客发送" + } + } + + private func applySnapshot(animated: Bool) { + guard isViewLoaded, dataSource != nil else { return } + videosByID = Dictionary(uniqueKeysWithValues: viewModel.availableVideos.map { ($0.id, $0) }) + let uploadItems = viewModel.batch?.items ?? [] + uploadItemsByID = Dictionary(uniqueKeysWithValues: uploadItems.map { ($0.id, $0) }) + let oldItems = Set(dataSource.snapshot().itemIdentifiers) + var snapshot = NSDiffableDataSourceSnapshot() + if phase == .queue { + snapshot.appendSections([.summary]) + snapshot.appendItems([.summary], toSection: .summary) + } + snapshot.appendSections([.content]) + let items: [Item] + switch phase { + case .method: items = [.nearbyMethod, .cloudMethod] + case .point: items = viewModel.points.isEmpty ? [.empty] : viewModel.points.map { .point($0.id) } + case .picker: items = viewModel.availableVideos.isEmpty ? [.empty] : viewModel.availableVideos.map { .video($0.id) } + case .queue: items = uploadItems.isEmpty ? [.empty] : uploadItems.map { .upload($0.id) } + } + snapshot.appendItems(items, toSection: .content) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { oldItems.contains($0) }) + applyHeaderAndFooter() + dataSource.apply(snapshot, animatingDifferences: animated) + collectionView.collectionViewLayout.invalidateLayout() + } + + private func applyHeaderAndFooter() { + let customer = viewModel.order?.customerName ?? "订单信息暂不可用" + let pointName = viewModel.batch?.pointName ?? viewModel.selectedPoint?.name + let context = pointName.map { "\(customer) · \($0)" } ?? customer + switch phase { + case .method: + headerView.apply(title: "交付成片", customer: customer, detail: "请选择本次交付方式") + footerView.apply(primaryTitle: nil, enabled: false, identifier: "", detail: "可分批演示交付多个作品,不影响拍摄次数", secondaryTitle: nil) + case .point: + headerView.apply(title: "选择打卡点", customer: customer, detail: "云端上传 · 请选择本批成片对应的打卡点") + footerView.apply(primaryTitle: "去演示相册选视频", enabled: viewModel.selectedPoint != nil && !viewModel.isUploadLocked, + identifier: "drone.delivery.upload.openPicker", detail: "可选择一个或多个视频,上传与交付仅在本地演示", secondaryTitle: "返回交付方式") + case .picker: + headerView.apply(title: "选择视频", customer: context, detail: "演示相册 · 不读取手机文件") + footerView.apply(primaryTitle: "开始演示上传(\(viewModel.selectedVideoIDs.count))", enabled: viewModel.canStartUpload, + identifier: "drone.delivery.upload.start", detail: "选择后体验演示上传,不执行真实云端上传", secondaryTitle: "返回选择点位") + case .queue: + headerView.apply(title: "成片上传", customer: context, detail: "本地演示 · 不执行真实上传或游客发送") + switch viewModel.uploadPhase { + case .idle: + footerView.apply(primaryTitle: "返回选择视频", enabled: true, identifier: "drone.delivery.upload.pickMore", detail: "", secondaryTitle: "完成") + case .uploading: + footerView.apply(primaryTitle: "正在演示上传…", enabled: false, identifier: "drone.delivery.upload.start", + detail: "请保持页面开启,演示成功后更新本地交付记录", secondaryTitle: nil) + case .paused: + footerView.apply(primaryTitle: "继续上传", enabled: true, identifier: "drone.delivery.upload.continue", + detail: "已成功作品会保留;继续时只处理未完成项", secondaryTitle: "完成") + case .partialFailure: + footerView.apply(primaryTitle: "重试失败视频(\(viewModel.failedCount))", enabled: viewModel.failedCount > 0, + identifier: "drone.delivery.upload.retry", detail: "演示交付成功的作品不会重复上传", secondaryTitle: "完成") + case .completed: + footerView.apply(primaryTitle: "继续上传成片", enabled: true, identifier: "drone.delivery.upload.pickMore", + detail: "可分批演示上传,不扣减拍摄次数", secondaryTitle: "完成") + } + } + } + + private func showPhase(_ phase: Phase) { + self.phase = phase + applySnapshot(animated: true) + collectionView.setContentOffset(.zero, animated: false) + let sheet = navigationController?.sheetPresentationController ?? sheetPresentationController + let detent: UISheetPresentationController.Detent.Identifier = phase == .picker || (phase == .queue && viewModel.totalUploadCount > 3) ? .large : .medium + sheet?.animateChanges { sheet?.selectedDetentIdentifier = detent } + } + + private func primaryTapped() { + switch phase { + case .method: break + case .point: if viewModel.selectedPoint != nil { showPhase(.picker) } + case .picker: + if viewModel.startUpload() { showPhase(.queue); startDemoUpload() } + case .queue: + switch viewModel.uploadPhase { + case .paused: + if viewModel.continueUpload() { applySnapshot(animated: true); startDemoUpload() } + case .partialFailure: + if viewModel.retryFailedUploads() { applySnapshot(animated: true); startDemoUpload() } + case .completed, .idle: + viewModel.clearUploadBatch() + showPhase(viewModel.selectedPoint == nil ? .point : .picker) + case .uploading: break + } + } + } + + /// 演示入口也使用同一局域网页面,但必须显式选择本机视频才会开放传输。 + private func openNearbyFlow() { + let nearby = DroneDockNearbyTransferViewController(customerTitle: "面对面交付") + if let navigation = navigationController { + nearby.onClose = { [weak navigation] in navigation?.popViewController(animated: true) } + navigation.sheetPresentationController?.animateChanges { + navigation.sheetPresentationController?.selectedDetentIdentifier = .large + } + navigation.setNavigationBarHidden(false, animated: true) + navigation.pushViewController(nearby, animated: true) + } else { + let navigation = UINavigationController(rootViewController: nearby) + navigation.modalPresentationStyle = .pageSheet + navigation.sheetPresentationController?.detents = [.large()] + nearby.onClose = { [weak navigation] in navigation?.dismiss(animated: true) } + present(navigation, animated: true) + } + } + + /// 选择云端仅恢复原队列或进入选点,不清除批次,也不自动继续上传。 + private func openCloudFlow() { + showPhase(viewModel.batch == nil ? .point : .queue) + } + + private func secondaryTapped() { + switch phase { + case .method: break + case .point: showPhase(.method) + case .picker: showPhase(.point) + case .queue: finish() + } + } + + private func startDemoUpload() { + uploadDriver.start(viewModel: viewModel) { [weak self] in self?.applySnapshot(animated: true) } + } + + private func pauseForLeaving() { + uploadDriver.stop() + guard phase == .queue else { return } + viewModel.pauseUpload(reason: .leavingPage) + } + + private func finish() { + guard !didRequestFinish else { return } + didRequestFinish = true + pauseForLeaving() + if let delegate { delegate.deliveryUploadViewControllerDidFinish(self) } + else if let navigationController { navigationController.dismiss(animated: true) } + else { dismiss(animated: true) } + } + + private func configureDebugMenu() { + #if DEBUG + let actions = DroneDeliveryScenario.allCases.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in + guard let self else { return } + self.uploadDriver.stop() + self.viewModel.applyScenario(scenario) + self.showPhase(self.viewModel.batch == nil ? .method : .queue) + } + } + headerView.setDebugMenu(UIMenu(title: "本地交付演示状态", children: actions)) + #endif + } + + @objc private func applicationWillResignActive() { + uploadDriver.stop() + viewModel.pauseUpload(reason: .background) + if isViewLoaded { applySnapshot(animated: false) } + } + + @objc private func applicationDidBecomeActive() { + viewModel.refresh() + if isViewLoaded { applySnapshot(animated: false) } + } +} + +extension DroneDeliveryUploadViewController: UICollectionViewDelegate { + /// 卡片与点位整行选择,队列行预览不影响当前批次。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard let item = dataSource.itemIdentifier(for: indexPath) else { return } + switch item { + case .nearbyMethod: openNearbyFlow() + case .cloudMethod: openCloudFlow() + case .point(let id): viewModel.selectPoint(id: id); applySnapshot(animated: true) + case .upload(let id): + if let item = uploadItemsByID[id] { delegate?.deliveryUploadViewController(self, didRequestPreview: item.video) } + default: break + } + } +} + +extension DroneDeliveryUploadViewController: UIAdaptivePresentationControllerDelegate { + /// 手势关闭 Sheet 后仍暂停未完成上传并刷新原入口。 + func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { finish() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockCompactOrderCell.swift b/suixinkan/UI/DroneDock/DroneDockCompactOrderCell.swift new file mode 100644 index 0000000..88f5e9f --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockCompactOrderCell.swift @@ -0,0 +1,160 @@ +import SnapKit +import UIKit + +/// 工作台沿用紧凑订单卡;当前任务只改变按钮标题及右上角状态。 +final class DroneDockCompactOrderCell: UICollectionViewCell { + /// 返回该订单的拍摄或当前任务入口。 + var onShootingTap: (() -> Void)? + /// 返回该订单原素材入口。 + var onMaterialsTap: (() -> Void)? + + private let customerLabel = DroneDockStyle.label(size: 16, weight: .bold) + private let statusLabel = DroneDockStatusLabel() + private let orderNumberLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let packageLabel = DroneDockStyle.label(size: 13, color: UIColor(hex: 0x666E7C)) + private let countsLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let actionButton = UIButton(type: .system) + private let materialButton = UIButton(type: .system) + private let footer = UIView() + + /// 创建紧凑卡片及可选素材栏。 + override init(frame: CGRect) { + super.init(frame: frame) + DroneDockStyle.applyCard(to: contentView) + setupUI() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 应用数据,不展示具体点位或航线,也不在卡片自行扣次。 + func apply(order: DroneShootingOrder) { + customerLabel.text = order.customerName + orderNumberLabel.isHidden = true + statusLabel.apply(title: order.statusTitle, tone: order.statusTone) + packageLabel.text = order.packageSummary + packageLabel.numberOfLines = 1 + countsLabel.numberOfLines = 1 + actionButton.titleLabel?.numberOfLines = 1 + countsLabel.text = "已拍摄 \(order.successfulShootingCount)/\(order.totalShootingCount) 次 · 剩余 \(order.remainingShootingCount) 次" + actionButton.setTitle(order.primaryAction.title, for: .normal) + actionButton.isHidden = false + actionButton.isEnabled = order.primaryActionEnabled + actionButton.backgroundColor = DroneDockStyle.primary + actionButton.accessibilityIdentifier = "drone.home.\(order.id).primary" + footer.isHidden = !order.hasMaterials + applyMaterial(title: order.materialState.title, symbol: order.materialState.systemImageName, + tone: order.materialState.tone) + accessibilityIdentifier = "drone.home.\(order.id)" + } + + /// 展示张工 orders 的真实摘要,权限决定按钮入口,点击交给页面处理。 + func apply(homeOrder order: DroneDockHomeOrder) { + customerLabel.text = order.touristTitle + orderNumberLabel.isHidden = false + orderNumberLabel.text = "订单号 \(order.orderNumberText)" + statusLabel.apply(title: order.statusTitle, tone: order.statusTone) + packageLabel.text = order.packageTitle + packageLabel.numberOfLines = 0 + countsLabel.numberOfLines = 0 + actionButton.titleLabel?.numberOfLines = 2 + countsLabel.text = order.progressTitle + actionButton.setTitle(order.actionTitle, for: .normal) + actionButton.isHidden = order.actionTitle == nil + actionButton.isEnabled = order.actionTitle != nil && order.primaryAction != "blocked" + actionButton.backgroundColor = actionButton.isEnabled ? DroneDockStyle.primary : DroneDockStyle.secondary + actionButton.accessibilityIdentifier = "drone.home.order.\(order.orderID).primary" + let materialTitle = order.cardMaterialStatusTitle ?? "素材状态待确认" + footer.isHidden = !order.showsMaterialsEntry + applyMaterial(title: materialTitle, symbol: "photo.on.rectangle.angled", tone: order.cardMaterialStatusTone) + accessibilityIdentifier = "drone.home.order.\(order.orderID)" + } + + private func applyMaterial(title: String, symbol: String, tone: DroneDockStatusTone) { + var configuration = UIButton.Configuration.plain() + configuration.image = UIImage(systemName: symbol) + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 15) + configuration.imagePadding = 6 + configuration.title = title + configuration.baseForegroundColor = DroneDockStyle.color(for: tone) + configuration.contentInsets = .zero + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var attributes = attributes + attributes.font = .systemFont(ofSize: 11) + return attributes + } + materialButton.configuration = configuration + materialButton.accessibilityLabel = "查看素材,\(title)" + } + + override func prepareForReuse() { + super.prepareForReuse() + onShootingTap = nil + onMaterialsTap = nil + } + + private func setupUI() { + customerLabel.adjustsFontSizeToFitWidth = true + customerLabel.minimumScaleFactor = 0.75 + customerLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + let titleRow = UIStackView(arrangedSubviews: [customerLabel, statusLabel]) + titleRow.alignment = .center + titleRow.spacing = 8 + orderNumberLabel.isHidden = true + orderNumberLabel.numberOfLines = 0 + let labels = UIStackView(arrangedSubviews: [packageLabel, countsLabel]) + labels.axis = .vertical + labels.spacing = 9 + packageLabel.adjustsFontSizeToFitWidth = true + packageLabel.minimumScaleFactor = 0.8 + labels.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + + actionButton.backgroundColor = DroneDockStyle.primary + actionButton.setTitleColor(.white, for: .normal) + actionButton.titleLabel?.font = .systemFont(ofSize: 13, weight: .medium) + actionButton.titleLabel?.adjustsFontSizeToFitWidth = true + actionButton.titleLabel?.minimumScaleFactor = 0.8 + actionButton.titleLabel?.textAlignment = .center + actionButton.layer.cornerRadius = 8 + actionButton.addTarget(self, action: #selector(shootingTapped), for: .touchUpInside) + actionButton.snp.makeConstraints { make in + make.width.equalTo(106).priority(999) + make.height.equalTo(42) + } + let body = UIStackView(arrangedSubviews: [labels, actionButton]) + body.spacing = 10 + body.alignment = .center + // 让内容行紧贴文字;按钮的固有高度仍可撑高整行,避免自适应高度的舍入余量在两行间游移。 + body.snp.makeConstraints { make in make.height.equalTo(labels).priority(249) } + + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + footer.addSubview(divider) + footer.addSubview(materialButton) + materialButton.contentHorizontalAlignment = .leading + materialButton.addTarget(self, action: #selector(materialsTapped), for: .touchUpInside) + let viewButton = UIButton(type: .system) + viewButton.setTitle("查看素材 ›", for: .normal) + viewButton.titleLabel?.font = .systemFont(ofSize: 11) + viewButton.tintColor = DroneDockStyle.primary + viewButton.addTarget(self, action: #selector(materialsTapped), for: .touchUpInside) + footer.addSubview(viewButton) + divider.snp.makeConstraints { make in make.leading.trailing.top.equalToSuperview(); make.height.equalTo(0.5) } + materialButton.snp.makeConstraints { make in + make.leading.equalToSuperview() + make.bottom.equalToSuperview().priority(999) + make.top.equalTo(divider.snp.bottom).offset(7) + make.height.equalTo(26) + make.trailing.lessThanOrEqualTo(viewButton.snp.leading).offset(-8) + } + viewButton.snp.makeConstraints { make in make.centerY.equalTo(materialButton); make.trailing.equalToSuperview() } + let stack = UIStackView(arrangedSubviews: [titleRow, orderNumberLabel, body, footer]) + stack.axis = .vertical + stack.spacing = 12 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.edges.equalToSuperview().inset(16) } + } + + @objc private func shootingTapped() { onShootingTap?() } + @objc private func materialsTapped() { onMaterialsTap?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockConfirmationCodeCell.swift b/suixinkan/UI/DroneDock/DroneDockConfirmationCodeCell.swift new file mode 100644 index 0000000..a7ac478 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockConfirmationCodeCell.swift @@ -0,0 +1,122 @@ +import SnapKit +import UIKit + +/// 原样展示服务端小程序码图片,加载失败只重试图片,不重新发起订单确认。 +@MainActor +final class DroneDockConfirmationCodeCell: UICollectionViewCell { + /// 请求重新下载同一张小程序码图片。 + var onRetry: (() -> Void)? + private let gradientLayer = CAGradientLayer() + private let codeFrame = UIView() + private let imageView = UIImageView() + private let countLabel = DroneDockStyle.label(size: 12) + private let stateLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let retryButton = UIButton(type: .system) + + /// 图片保留完整内容和留白,禁止裁剪成普通二维码样式。 + override init(frame: CGRect) { + super.init(frame: frame) + contentView.backgroundColor = .white + contentView.layer.cornerRadius = 17 + contentView.layer.borderWidth = 1 + contentView.layer.borderColor = UIColor(hex: 0xE1EAFB).cgColor + contentView.clipsToBounds = true + gradientLayer.colors = [UIColor(hex: 0xF1F5FF).cgColor, UIColor.white.cgColor] + gradientLayer.startPoint = CGPoint(x: 0.5, y: 0) + gradientLayer.endPoint = CGPoint(x: 0.5, y: 1) + contentView.layer.insertSublayer(gradientLayer, at: 0) + + let status = UIView() + status.backgroundColor = UIColor(hex: 0xEAF2FF) + status.layer.cornerRadius = 13 + status.layer.borderWidth = 1 + status.layer.borderColor = UIColor(hex: 0xD9E8FF).cgColor + let statusLabel = DroneDockStyle.label("等待游客确认", size: 11, color: UIColor(hex: 0x066BFF)) + status.addSubview(statusLabel) + statusLabel.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(10); $0.centerY.equalToSuperview() } + status.snp.makeConstraints { $0.height.equalTo(26) } + + let title = DroneDockStyle.label("请游客扫码确认收货", size: 20, weight: .semibold) + let detail = DroneDockStyle.label("查看本订单全部成片后,一次确认", size: 12, color: DroneDockStyle.secondary) + let explanation = DroneDockStyle.label("扫描不等于收货,需原下单游客主动确认", size: 10, color: DroneDockStyle.secondary) + for label in [title, detail, countLabel, explanation, stateLabel] { + label.numberOfLines = 0 + label.textAlignment = .center + } + + codeFrame.backgroundColor = .white + codeFrame.layer.cornerRadius = 12 + codeFrame.layer.borderWidth = 1 + codeFrame.layer.borderColor = UIColor(hex: 0xE8EDF5).cgColor + codeFrame.snp.makeConstraints { $0.size.equalTo(216).priority(999) } + imageView.contentMode = .scaleAspectFit + imageView.backgroundColor = .white + imageView.isAccessibilityElement = true + imageView.accessibilityIdentifier = "drone.confirmation.code.image" + imageView.accessibilityLabel = "游客交付确认小程序码" + codeFrame.addSubview(imageView) + imageView.snp.makeConstraints { $0.edges.equalToSuperview().inset(10) } + retryButton.setTitle("重新加载图片", for: .normal) + retryButton.accessibilityIdentifier = "drone.confirmation.image.retry" + retryButton.addTarget(self, action: #selector(retryTapped), for: .touchUpInside) + retryButton.snp.makeConstraints { $0.height.equalTo(44).priority(999) } + let stack = UIStackView(arrangedSubviews: [status, title, detail, codeFrame, stateLabel, retryButton, countLabel, explanation]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 12 + stack.setCustomSpacing(9, after: status) + stack.setCustomSpacing(4, after: title) + stack.setCustomSpacing(20, after: detail) + stack.setCustomSpacing(16, after: codeFrame) + contentView.addSubview(stack) + stack.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(16) + $0.top.equalToSuperview().offset(22) + $0.bottom.equalToSuperview().inset(20) + } + for label in [title, detail, countLabel, explanation, stateLabel] { label.snp.makeConstraints { $0.width.equalTo(stack) } } + accessibilityIdentifier = "drone.confirmation.code" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func layoutSubviews() { + super.layoutSubviews() + CATransaction.begin() + CATransaction.setDisableActions(true) + gradientLayer.frame = contentView.bounds + CATransaction.commit() + } + + override func prepareForReuse() { super.prepareForReuse(); onRetry = nil; clearImage() } + + /// 订单完成或身份失效时立即移除旧码,不等待 Diffable 回收单元格。 + func clearImage() { + imageView.image = nil + imageView.isHidden = true + codeFrame.isHidden = true + stateLabel.text = nil + stateLabel.isHidden = true + retryButton.isHidden = true + } + + /// 图片读取结果与请求状态分开,订单状态刷新不会清除已有图片。 + func apply(image: UIImage?, error: String?, workCount: Int? = nil, pointCount: Int? = nil) { + imageView.image = image + imageView.isHidden = image == nil && error != nil + codeFrame.isHidden = image == nil && error != nil + if let workCount, let pointCount { + countLabel.text = "云端 \(workCount) 个成片 · \(pointCount) 个打卡点" + countLabel.isHidden = false + } else { + countLabel.text = nil + countLabel.isHidden = true + } + stateLabel.text = error ?? (image == nil ? "正在加载确认码图片…" : nil) + stateLabel.isHidden = image != nil && error == nil + retryButton.isHidden = error == nil + } + + @objc private func retryTapped() { onRetry?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockConfirmationEntry.swift b/suixinkan/UI/DroneDock/DroneDockConfirmationEntry.swift new file mode 100644 index 0000000..767b196 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockConfirmationEntry.swift @@ -0,0 +1,14 @@ +import UIKit + +/// 首页邀请确认与订单确认记录共用的正式页面工厂。 +@MainActor +enum DroneDockConfirmationEntry { + /// 进入后重新读取订单;出码由工作人员核对后主动发起,不代替游客确认。 + static func makeController(order: DroneDockHomeOrder, context: DroneDockHomeContext) -> UIViewController { + DroneDockConfirmationViewController(viewModel: DroneDockConfirmationViewModel( + context: context, order: order, + service: DroneDockConfirmationAPI(client: NetworkServices.shared.apiClient), + currentContext: { DroneDockHomeViewController.currentContext() } + )) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockConfirmationReceiptCell.swift b/suixinkan/UI/DroneDock/DroneDockConfirmationReceiptCell.swift new file mode 100644 index 0000000..3c93afc --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockConfirmationReceiptCell.swift @@ -0,0 +1,57 @@ +import SnapKit +import UIKit + +/// 使用服务端已确认状态展示交付结果,不推断确认人、工作人员或历史成片范围。 +@MainActor +final class DroneDockConfirmationReceiptCell: UICollectionViewCell { + private let timeLabel = DroneDockStyle.label(size: 12) + + /// 完成态沿用网页的成功标识、居中标题与浅灰确认信息卡。 + override init(frame: CGRect) { + super.init(frame: frame) + let icon = UIImageView(image: UIImage(systemName: "checkmark.circle.fill")) + icon.tintColor = DroneDockStyle.success + icon.contentMode = .scaleAspectFit + icon.snp.makeConstraints { $0.size.equalTo(38) } + let title = DroneDockStyle.label("游客已确认收货", size: 22, weight: .semibold) + let detail = DroneDockStyle.label("本订单交付已完成", size: 13, color: DroneDockStyle.secondary) + for label in [title, detail] { + label.textAlignment = .center + label.numberOfLines = 0 + } + + let panel = UIView() + panel.backgroundColor = UIColor(hex: 0xF5F8FC) + panel.layer.cornerRadius = 12 + let keyLabel = DroneDockStyle.label("确认时间", size: 12, color: DroneDockStyle.secondary) + keyLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + timeLabel.textAlignment = .right + timeLabel.numberOfLines = 0 + let row = UIStackView(arrangedSubviews: [keyLabel, timeLabel]) + row.alignment = .top + row.spacing = 16 + panel.addSubview(row) + row.snp.makeConstraints { $0.edges.equalToSuperview().inset(14) } + + let stack = UIStackView(arrangedSubviews: [icon, title, detail, panel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 14 + contentView.addSubview(stack) + stack.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.top.equalToSuperview().offset(8) + $0.bottom.equalToSuperview().inset(24) + } + for view in [title, detail, panel] { view.snp.makeConstraints { $0.width.equalTo(stack) } } + accessibilityIdentifier = "drone.confirmation.receipt" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 只展示订单实际返回的确认时间;缺失时保留明确空值。 + func apply(confirmedAt: String?) { + timeLabel.text = DroneDockHomeMetric.usableText(confirmedAt) ?? "—" + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockConfirmationSimulation.swift b/suixinkan/UI/DroneDock/DroneDockConfirmationSimulation.swift new file mode 100644 index 0000000..f0c4218 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockConfirmationSimulation.swift @@ -0,0 +1,224 @@ +import Foundation +import UIKit + +#if DEBUG +/// 正式交付确认页的隔离预览,接口、图片和封面均由本机提供。 +@MainActor +enum DroneDockConfirmationSimulation { + /// 显式启动参数选择确认场景,不读取真实登录身份或回退线上服务。 + static func makeController(arguments: [String]) -> UIViewController? { + let flag = "--dock-confirmation-mock" + guard arguments.contains(flag) || arguments.contains(where: { $0.hasPrefix(flag + "=") }) else { return nil } + let value = arguments.first(where: { $0.hasPrefix(flag + "=") }) + .map { String($0.dropFirst(flag.count + 1)) } + let scenario = value.flatMap(DroneDockConfirmationMockScenario.init(rawValue:)) ?? .ready + let session = DroneDockConfirmationMockSession(scenario: scenario) + let environment = APIEnvironment(baseURL: URL(string: "https://mock.invalid")!, + webSocketURL: URL(string: "wss://mock.invalid/unused")!) + let client = APIClient(environment: environment, session: session, debugLogSink: { _ in }) + let context = DroneDockHomeContext(userID: "local-confirmation-mock", accountType: "store_user", + scenicID: 901, scenicName: "本地模拟景区", storeID: 901, + photographerName: "本地模拟工作人员", token: "local-confirmation-only") + client.bindAuthTokenProvider { "local-confirmation-only" } + guard let orderData = try? JSONSerialization.data(withJSONObject: session.initialDetail), + let order = try? JSONDecoder().decode(DroneDockHomeOrder.self, from: orderData) else { return nil } + let model = DroneDockConfirmationViewModel(context: context, order: order, + service: DroneDockConfirmationAPI(client: client), currentContext: { context }) + let controller = DroneDockConfirmationViewController(viewModel: model, + imageLoader: DroneDockConfirmationMockImageLoader(failsFirstLoad: scenario == .imageFailed), + allowsRemoteMedia: false, + thumbnailProvider: { UIImage(named: $0.spotID == 302 ? "drone_demo_pagoda" : "drone_demo_mountain") }, + deliveryControllerFactory: { _, _, _ in + let preview = UIViewController() + preview.title = "云端交付 · 本地模拟" + preview.view.backgroundColor = .white + let label = UILabel() + label.text = "本地 UI 预览,不上传文件" + label.textAlignment = .center + preview.view.addSubview(label) + label.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + label.centerXAnchor.constraint(equalTo: preview.view.centerXAnchor), + label.centerYAnchor.constraint(equalTo: preview.view.centerYAnchor) + ]) + return preview + }) + controller.navigationItem.prompt = "本地模拟 · 未联网 · 不可扫码" + print("[LOCAL MOCK][Confirmation] 场景=\(scenario.rawValue),全部响应来自内存,不连接后端或设备") + return controller + } +} + +/// 确认页预览场景,不表示任何真实订单或游客的操作结果。 +private enum DroneDockConfirmationMockScenario: String { + case ready, empty, completeAfterRefresh, generationFailed, imageFailed, confirmed +} + +/// 仅接受模拟域名和固定订单的内存传输,没有 URLSession 或网络回退路径。 +private final class DroneDockConfirmationMockSession: LocalSimulationURLSession { + private let scenario: DroneDockConfirmationMockScenario + private let lock = NSLock() + private var generationAttempts = 0 + private var hasInvitation = false + private var hasGeneratedImage = false + private static let orderNumber = "LOCAL-MOCK-CONFIRM-901" + private static let prefix = "/api/yf-handset-app/photog/multi-plane" + + /// 每次进入建立独立场景状态,不与其他模拟页面或真实订单共享。 + init(scenario: DroneDockConfirmationMockScenario) { self.scenario = scenario } + + /// 用于页面入口的固定摘要,读取它不会推进模拟状态。 + var initialDetail: [String: Any] { detail(completed: scenario == .confirmed, invited: false) } + + /// 真实 API 请求经过本方法获得模拟 JSON,未知请求直接失败且绝不转发。 + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + try Task.checkCancellation() + let data = try lock.withLock { try responseData(for: request) } + guard let url = request.url, + let response = HTTPURLResponse(url: url, statusCode: 200, httpVersion: nil, headerFields: nil) else { + throw URLError(.badURL) + } + print("[LOCAL MOCK][Confirmation Request] \(request.httpMethod ?? "") \(url.absoluteString) — 纯内存,未联网") + if let body = request.httpBody { print(String(decoding: body, as: UTF8.self)) } + print("[LOCAL MOCK][Confirmation Response] \(String(decoding: data, as: UTF8.self))") + return (data, response) + } + + private func responseData(for request: URLRequest) throws -> Data { + guard let url = request.url, url.scheme == "https", url.host == "mock.invalid" else { + throw APIError.networkFailed("本地确认模拟拒绝外部请求") + } + let payload: [String: Any] + if request.httpMethod == "GET" { + let items = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? [] + guard items.filter({ $0.name == "scenic_id" }).map(\.value) == ["901"], + items.filter({ $0.name == "order_number" }).map(\.value) == [Self.orderNumber] else { + throw APIError.networkFailed("本地确认模拟拒绝真实景区或订单") + } + switch url.path { + case Self.prefix + "/orders/detail": + guard Set(items.map(\.name)) == ["scenic_id", "order_number"] else { + throw APIError.networkFailed("本地确认详情不支持其他参数") + } + payload = detail(completed: scenario == .confirmed || (scenario == .completeAfterRefresh && hasGeneratedImage), + invited: hasInvitation) + case Self.prefix + "/tasks": + guard Set(items.map(\.name)).isSubset(of: ["scenic_id", "order_number", "scenic_spot_id"]) else { + throw APIError.networkFailed("本地确认任务不支持其他参数") + } + let spotItems = items.filter { $0.name == "scenic_spot_id" } + let spotID = spotItems.first?.value.flatMap(Int.init) + guard spotItems.isEmpty || (spotItems.count == 1 && spotID.map({ $0 > 0 }) == true) else { + throw APIError.networkFailed("本地确认模拟拒绝无效点位筛选") + } + let list = tasks().filter { spotID == nil || ($0["scenic_spot_id"] as? Int) == spotID } + payload = ["order_number": Self.orderNumber, "total": list.count, "list": list] + default: + throw APIError.networkFailed("本地确认模拟拒绝未配置接口") + } + } else if request.httpMethod == "POST", url.path == Self.prefix + "/orders/confirm-code" { + guard url.query == nil, let data = request.httpBody, + let body = try JSONSerialization.jsonObject(with: data) as? [String: Any], + Set(body.keys) == ["scenic_id", "order_number"], + body["scenic_id"] as? Int == 901, body["order_number"] as? String == Self.orderNumber else { + throw APIError.networkFailed("本地确认模拟拒绝非约定出码请求") + } + guard scenario != .confirmed, !(scenario == .completeAfterRefresh && hasGeneratedImage) else { + return try envelope([:], code: 160001, message: "本地模拟:订单已完成,不可生成确认码") + } + generationAttempts += 1 + hasInvitation = true + if scenario == .generationFailed, generationAttempts == 1 { + return try envelope([:], code: 160001, message: "本地模拟:确认码生成失败,请重试") + } + hasGeneratedImage = true + payload = ["order_number": Self.orderNumber, "confirm_status": 1, + "confirm_url": "https://mock.invalid/mini_qr/confirmation.png"] + } else { + throw APIError.networkFailed("本地确认模拟不支持此请求,不会访问后端或设备") + } + return try envelope(payload) + } + + private func detail(completed: Bool, invited: Bool) -> [String: Any] { + ["order_number": Self.orderNumber, "project_id": 901, "project_name": "本地模拟双点位航拍", + "created_at": "2026-10-30 10:00:00", "user_phone": "158****8888", + "shoot_count": 3, "shot_count": 3, "remaining_count": 0, + "shoot_status": completed ? "completed" : "processing", "order_status": completed ? 30 : 20, + "material_status": 0, "film_count": scenario == .empty ? 0 : 3, + "can_create_task": false, "can_upload_film": !completed, "can_confirm": !completed, + "confirm_status": completed ? 2 : invited ? 1 : 0, + "confirmed_at": completed ? "2026-10-30 10:30:00" as Any : NSNull(), + "spot": [["scenic_spot_id": 301, "scenic_spot_name": "三皇寨"], + ["scenic_spot_id": 302, "scenic_spot_name": "金阙云宫"]]] + } + + private func tasks() -> [[String: Any]] { + [301, 301, 302].enumerated().map { index, spotID in + let taskID = index + 901 + let title = spotID == 301 ? "三皇寨" : "金阙云宫" + var value: [String: Any] = [ + "id": taskID, "task_id": taskID, "order_number": Self.orderNumber, + "scenic_spot_id": spotID, "scenic_spot_name": title, + "air_line_name": "本地模拟航线", "seq": index + 1, + "flight_status": 30, "material_status": 0, + "created_at": "2026-10-30 10:10:00", "materials": [], "film": NSNull() + ] + if scenario != .empty { + value["film"] = ["id": taskID + 1000, "task_id": taskID, + "file_name": "\(title)本地模拟成片.mp4", "file_size": 8_388_608, + "file_url": "https://mock.invalid/films/\(taskID).mp4", + "cover_url": "https://mock.invalid/covers/\(taskID).jpg"] + } + return value + } + } + + private func envelope(_ data: [String: Any], code: Int = 100000, message: String = "success") throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": data, + "time": "2026-10-30 10:30:00"], options: [.sortedKeys]) + } +} + +/// 确认码图片的本地替身,只绘制不可扫码文字且不尝试下载 URL。 +@MainActor +private final class DroneDockConfirmationMockImageLoader: DroneDockPaymentImageLoading { + private let failsFirstLoad: Bool + private var loadCount = 0 + private var generation = 0 + + /// 图片失败场景只拒绝首轮读取,之后允许用户显式重试。 + init(failsFirstLoad: Bool) { self.failsFirstLoad = failsFirstLoad } + + /// 忽略远程地址的内容,返回带明确模拟来源的纯文字图片。 + func loadImage(from url: URL, forceRefresh: Bool, + completion: @escaping @MainActor @Sendable (Result) -> Void) { + generation &+= 1 + let currentGeneration = generation + loadCount += 1 + let shouldFail = failsFirstLoad && loadCount == 1 + Task { @MainActor [weak self] in + await Task.yield() + guard let self, self.generation == currentGeneration else { return } + print("[LOCAL MOCK][Confirmation Image] \(shouldFail ? "模拟加载失败" : "本机文字占位") — 未下载图片") + if shouldFail { + completion(.failure(APIError.networkFailed("本地模拟:确认码图片加载失败"))) + return + } + let image = UIGraphicsImageRenderer(size: CGSize(width: 260, height: 260)).image { context in + UIColor.white.setFill() + context.fill(CGRect(x: 0, y: 0, width: 260, height: 260)) + let paragraph = NSMutableParagraphStyle() + paragraph.alignment = .center + ("本地模拟·不可扫码" as NSString).draw(in: CGRect(x: 10, y: 115, width: 240, height: 40), + withAttributes: [.font: UIFont.systemFont(ofSize: 20, weight: .semibold), + .foregroundColor: UIColor(hex: 0x066BFF), .paragraphStyle: paragraph]) + } + completion(.success(image)) + } + } + + /// 让旧图片回调失效,不涉及任何真实图片传输。 + func cancel() { generation &+= 1 } +} +#endif diff --git a/suixinkan/UI/DroneDock/DroneDockConfirmationViewController.swift b/suixinkan/UI/DroneDock/DroneDockConfirmationViewController.swift new file mode 100644 index 0000000..3d3a6ef --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockConfirmationViewController.swift @@ -0,0 +1,486 @@ +import AVKit +import SnapKit +import UIKit + +/// 正式整单交付确认:商家核对后展示小程序码,完成结果只读取服务端订单。 +@MainActor +final class DroneDockConfirmationViewController: BaseViewController { + /// 当前订单确认状态,独立于本地演示交付会话。 + let viewModel: DroneDockConfirmationViewModel + + /// 整单内容使用稳定分区,点位只用于排列云端成片。 + private enum Section: Hashable { case summary, state, statistics, code, receipt, manifest, point(Int), note } + /// 刷新状态时重配置现有内容,避免二维码和旧数据闪空。 + private enum Item: Hashable { case summary, state, statistics, code, receipt, manifest, film(Int), note, error } + /// 用户操作期间禁止再次提交相同请求。 + private enum Operation { case refresh, status, generate, poll } + + private let imageLoader: any DroneDockPaymentImageLoading + private let allowsRemoteMedia: Bool + private let thumbnailProvider: ((DroneDockMaterialTask) -> UIImage?)? + private let deliveryControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController + private let statusPollDelay: @MainActor (UInt64) async throws -> Void + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let footer = DroneDeliveryReviewFooterView() + private var requestTask: Task? + private var pollDelayTask: Task? + private var operation: Operation? + private var hasAppeared = false + private var isPageVisible = false + private var isApplicationActive = false + private var isShowingDeliverySheet = false + private var needsImmediateStatusCheck = false + private var imageURL: URL? + private var codeImage: UIImage? + private var imageError: String? + private var imageGeneration = 0 + private var isManifestExpanded = false + + /// 复用原尺寸小程序码图片加载器;模拟测试可替换图片来源并关闭远程素材。 + init(viewModel: DroneDockConfirmationViewModel, + imageLoader: (any DroneDockPaymentImageLoading)? = nil, + allowsRemoteMedia: Bool = true, + thumbnailProvider: ((DroneDockMaterialTask) -> UIImage?)? = nil, + deliveryControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil, + statusPollDelay: @escaping @MainActor (UInt64) async throws -> Void = { try await Task.sleep(nanoseconds: $0) }) { + self.viewModel = viewModel + self.imageLoader = imageLoader ?? DroneDockPaymentImageLoader() + self.allowsRemoteMedia = allowsRemoteMedia + self.thumbnailProvider = thumbnailProvider + self.statusPollDelay = statusPollDelay + self.deliveryControllerFactory = deliveryControllerFactory ?? { order, context, taskID in + DroneDockDeliveryEntry.makeController(order: order, context: context, taskID: taskID) + } + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { + requestTask?.cancel() + pollDelayTask?.cancel() + } + + override func setupNavigationBar() { + title = "订单交付确认" + navigationItem.backButtonDisplayMode = .minimal + let refresh = UIBarButtonItem(image: UIImage(systemName: "arrow.clockwise"), style: .plain, + target: self, action: #selector(refreshTapped)) + refresh.accessibilityIdentifier = "drone.confirmation.refresh" + refresh.accessibilityLabel = "刷新确认状态" + navigationItem.rightBarButtonItem = refresh + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.accessibilityIdentifier = "drone.confirmation.list" + collectionView.register(DroneDeliveryReviewOrderCell.self, forCellWithReuseIdentifier: "summary") + collectionView.register(DroneDeliveryReviewTextCell.self, forCellWithReuseIdentifier: "text") + collectionView.register(DroneDeliveryReviewStatisticsCell.self, forCellWithReuseIdentifier: "statistics") + collectionView.register(DroneDockConfirmationCodeCell.self, forCellWithReuseIdentifier: "code") + collectionView.register(DroneDockConfirmationReceiptCell.self, forCellWithReuseIdentifier: "receipt") + collectionView.register(DroneDeliveryReviewManifestHeaderCell.self, forCellWithReuseIdentifier: "manifest") + collectionView.register(DroneDeliveryReviewWorkCell.self, forCellWithReuseIdentifier: "film") + collectionView.register(DroneDeliveryReviewPointHeader.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: "point") + view.addSubview(collectionView) + view.addSubview(footer) + configureDataSource() + applySnapshot() + isApplicationActive = UIApplication.shared.applicationState == .active + NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), + name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { + $0.top.equalTo(view.safeAreaLayoutGuide) + $0.leading.trailing.equalToSuperview() + $0.bottom.equalTo(footer.snp.top) + } + footer.snp.makeConstraints { $0.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + footer.onAcknowledgementTap = { [weak self] in + guard let self, self.operation == nil else { return } + self.viewModel.setReviewed(!self.viewModel.isReviewed) + self.applySnapshot() + } + footer.onPrimaryTap = { [weak self] in self?.performPrimaryAction() } + footer.onSecondaryTap = { [weak self] in self?.performSecondaryAction() } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + if !hasAppeared || !viewModel.isAwaitingConfirmation { run(.refresh) } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + isPageVisible = true + if hasAppeared { resumeStatusChecks() } + else { scheduleStatusCheck() } + hasAppeared = true + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + isPageVisible = false + pauseStatusChecks() + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + if isMovingFromParent || navigationController == nil || navigationController?.isBeingDismissed == true { + requestTask?.cancel() + viewModel.invalidate() + clearImage() + } + } + + private var filmTasks: [DroneDockMaterialTask] { viewModel.tasks.filter { $0.film != nil } } + private var isShowingOperation: Bool { operation != nil && operation != .poll } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, let sections = self.dataSource?.snapshot().sectionIdentifiers, + sections.indices.contains(index) else { return nil } + let sectionID = sections[index] + if case .point = sectionID { + let width = (environment.container.effectiveContentSize.width - 44) / 2 + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(0.5), heightDimension: .fractionalHeight(1))) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(width * 9 / 16 + 45)), repeatingSubitem: item, count: 2) + group.interItemSpacing = .fixed(12) + let section = NSCollectionLayoutSection(group: group) + section.interGroupSpacing = 12 + section.contentInsets = .init(top: 0, leading: 16, bottom: 14, trailing: 16) + section.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(40)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)] + return section + } + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .estimated(sectionID == .code ? 390 : 90))) + let group = NSCollectionLayoutGroup.vertical(layoutSize: item.layoutSize, subitems: [item]) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = .init(top: sectionID == .code || sectionID == .receipt ? 20 : 0, + leading: 16, bottom: sectionID == .statistics ? 8 : 0, trailing: 16) + return section + } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, path, item in + guard let self else { return nil } + switch item { + case .summary: + let cell = list.dequeueReusableCell(withReuseIdentifier: "summary", for: path) as! DroneDeliveryReviewOrderCell + cell.apply(customer: self.viewModel.order.touristTitle, orderNumber: self.viewModel.order.orderNumber ?? "—") + return cell + case .statistics: + let cell = list.dequeueReusableCell(withReuseIdentifier: "statistics", for: path) as! DroneDeliveryReviewStatisticsCell + cell.apply(workCount: self.filmTasks.count, pointCount: Set(self.filmTasks.map(\.spotID)).count, label: "本订单已上传") + return cell + case .code: + let cell = list.dequeueReusableCell(withReuseIdentifier: "code", for: path) as! DroneDockConfirmationCodeCell + cell.apply(image: self.codeImage, error: self.imageError, + workCount: self.viewModel.hasLoadedTasks ? self.filmTasks.count : nil, + pointCount: self.viewModel.hasLoadedTasks ? Set(self.filmTasks.map(\.spotID)).count : nil) + cell.onRetry = { [weak self] in self?.loadCodeImage(forceRefresh: true) } + return cell + case .receipt: + let cell = list.dequeueReusableCell(withReuseIdentifier: "receipt", for: path) as! DroneDockConfirmationReceiptCell + cell.apply(confirmedAt: self.viewModel.order.confirmedAt) + return cell + case .manifest: + let cell = list.dequeueReusableCell(withReuseIdentifier: "manifest", for: path) as! DroneDeliveryReviewManifestHeaderCell + if self.viewModel.code != nil { + cell.apply(title: "查看本订单云端成片清单", detail: nil, expanded: self.isManifestExpanded) + cell.onToggle = { [weak self] in + guard let self else { return } + self.isManifestExpanded.toggle() + self.applySnapshot() + } + } else { + cell.apply(title: self.viewModel.isCompleted ? "本订单云端成片" : "整单交付清单", + detail: self.viewModel.isCompleted ? "当前已上传内容" : "含所有云端成片") + cell.onToggle = nil + } + return cell + case .film(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "film", for: path) as! DroneDeliveryReviewWorkCell + if let task = self.filmTasks.first(where: { $0.id == id }), let film = task.film { + let index = self.filmTasks.filter { $0.spotID == task.spotID }.firstIndex { $0.id == id } ?? 0 + cell.apply(film: film, taskID: id, title: String(format: "成片 %02d", index + 1), + localImage: self.thumbnailProvider?(task), allowsRemoteImage: self.allowsRemoteMedia) + cell.onPreviewTap = { [weak self] in self?.preview(film) } + } + return cell + case .state, .note, .error: + let cell = list.dequeueReusableCell(withReuseIdentifier: "text", for: path) as! DroneDeliveryReviewTextCell + if item == .error { + cell.apply(title: "暂未更新", detail: [self.viewModel.errorMessage, self.viewModel.tasksErrorMessage].compactMap { $0 }.joined(separator: "\n"), symbol: "exclamationmark.circle") + cell.accessibilityIdentifier = "drone.confirmation.error" + } else if item == .note { + cell.apply(title: self.filmTasks.isEmpty ? "暂无云端成片" : nil, + detail: self.filmTasks.isEmpty ? "如已通过面对面闪传等方式交付,请核对交付情况后继续。" : "请核对约定交付的全部作品。单次上传完成,不代表整单已交齐。") + cell.accessibilityIdentifier = "drone.confirmation.manifest" + } else { + self.applyState(to: cell) + } + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] list, kind, path in + guard let self, case .point(let id) = self.dataSource.snapshot().sectionIdentifiers[path.section] else { return nil } + let header = list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "point", for: path) as! DroneDeliveryReviewPointHeader + let tasks = self.filmTasks.filter { $0.spotID == id } + header.apply(pointName: DroneDockHomeMetric.usableText(tasks.first?.spotName) ?? "拍摄点", workCount: tasks.count) + return header + } + } + + private func applyState(to cell: DroneDeliveryReviewTextCell) { + cell.accessibilityIdentifier = "drone.confirmation.state" + if viewModel.detail == nil { + cell.apply(title: operation == nil ? "订单信息暂不可用" : "正在加载订单", detail: "确认状态以最新订单信息为准。") + } else if viewModel.order.canConfirm != true { + cell.apply(title: "当前订单暂不可邀请确认", detail: "请返回订单列表查看最新拍摄状态,或刷新后重试。", symbol: "info.circle") + } else { + cell.apply(title: "先核对,再请游客确认", detail: "一次确认整单,不按打卡点逐次确认。", symbol: "checkmark.shield") + } + } + + private func applySnapshot() { + guard dataSource != nil else { return } + if viewModel.code == nil { clearImage() } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.summary]) + snapshot.appendItems([.summary], toSection: .summary) + if !viewModel.isCompleted && viewModel.code == nil { + snapshot.appendSections([.state]) + snapshot.appendItems([.state], toSection: .state) + } + if viewModel.errorMessage != nil || viewModel.tasksErrorMessage != nil { + if !snapshot.sectionIdentifiers.contains(.state) { snapshot.appendSections([.state]) } + snapshot.appendItems([.error], toSection: .state) + } + if viewModel.code != nil, !viewModel.isCompleted { + snapshot.appendSections([.code]) + snapshot.appendItems([.code], toSection: .code) + } else if viewModel.isCompleted { + snapshot.appendSections([.receipt]) + snapshot.appendItems([.receipt], toSection: .receipt) + } else if viewModel.hasLoadedTasks, !viewModel.isCompleted { + snapshot.appendSections([.statistics]) + snapshot.appendItems([.statistics], toSection: .statistics) + } + if viewModel.hasLoadedTasks { + snapshot.appendSections([.manifest]) + snapshot.appendItems([.manifest], toSection: .manifest) + } + if viewModel.hasLoadedTasks && (viewModel.code == nil || isManifestExpanded) { + for task in filmTasks where !snapshot.sectionIdentifiers.contains(.point(task.spotID)) { + snapshot.appendSections([.point(task.spotID)]) + snapshot.appendItems(filmTasks.filter { $0.spotID == task.spotID }.map { .film($0.id) }, toSection: .point(task.spotID)) + } + if !viewModel.isCompleted { + snapshot.appendSections([.note]) + snapshot.appendItems([.note], toSection: .note) + } + } + let existing = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existing.contains($0) }) + dataSource.apply(snapshot, animatingDifferences: false) + navigationItem.rightBarButtonItem?.isEnabled = !isShowingOperation + updateFooter() + } + + private func updateFooter() { + let busy = isShowingOperation + let needsReload = viewModel.detail == nil || !viewModel.hasLoadedTasks || viewModel.tasksErrorMessage != nil + let title: String + if viewModel.isCompleted { title = "返回订单列表" } + else if busy { title = operation == .generate ? "正在生成确认码…" : "正在刷新…" } + else if viewModel.code != nil { title = "刷新确认状态" } + else if needsReload { title = "重新加载订单" } + else if viewModel.order.canConfirm != true { title = "刷新订单状态" } + else { title = "已交齐,展示订单确认码" } + let needsReview = !viewModel.isCompleted && viewModel.code == nil && !needsReload && viewModel.order.canConfirm == true + footer.apply(acknowledged: needsReview ? viewModel.isReviewed : nil, + note: viewModel.isCompleted ? "仅确认交付清单,不代表对拍摄效果无异议" : nil, + primaryTitle: title, primaryIdentifier: "drone.confirmation.primary", + primaryEnabled: !busy && (!needsReview || viewModel.canGenerate), + secondaryTitle: viewModel.isCompleted ? nil : viewModel.code != nil ? "稍后确认,返回订单" : viewModel.detail != nil ? "还未交齐,继续交付" : "返回订单", + secondaryIdentifier: "drone.confirmation.back", + primarySymbol: viewModel.code != nil ? "arrow.clockwise" : nil) + } + + private func run(_ action: Operation) { + guard operation == nil else { return } + cancelPollDelay() + operation = action + if action != .poll { applySnapshot() } + requestTask = Task { @MainActor [weak self] in + guard let self else { return } + let previousDetail = self.viewModel.detail + let previousCode = self.viewModel.code + let previousError = self.viewModel.errorMessage + switch action { + case .refresh: await self.viewModel.refresh() + case .status: await self.viewModel.refreshStatus() + case .generate: await self.viewModel.generateCode() + case .poll: await self.viewModel.refreshStatus(silently: true) + } + self.operation = nil + self.requestTask = nil + defer { self.scheduleStatusCheck() } + guard !Task.isCancelled else { return } + if action == .poll, previousDetail == self.viewModel.detail, previousCode == self.viewModel.code, + previousError == self.viewModel.errorMessage { return } + let stageChanged = (previousCode == nil && self.viewModel.code != nil) + || (previousDetail?.order.orderStatus != 30 && self.viewModel.isCompleted) + if stageChanged { self.isManifestExpanded = false } + if self.viewModel.code?.imageURL != self.imageURL { self.loadCodeImage(forceRefresh: false) } + self.applySnapshot() + if stageChanged { + self.collectionView.setContentOffset(CGPoint(x: 0, y: -self.collectionView.adjustedContentInset.top), animated: false) + } + } + } + + private var canPollStatus: Bool { + isPageVisible && isApplicationActive && !isShowingDeliverySheet && viewIfLoaded?.window != nil + && viewModel.isAwaitingConfirmation + } + + private func scheduleStatusCheck() { + guard canPollStatus, operation == nil, pollDelayTask == nil else { return } + if needsImmediateStatusCheck { + needsImmediateStatusCheck = false + run(.poll) + return + } + let delay = statusPollDelay + pollDelayTask = Task { @MainActor [weak self] in + do { try await delay(5_000_000_000) } catch { return } + guard !Task.isCancelled, let self else { return } + self.pollDelayTask = nil + if self.canPollStatus { self.run(.poll) } + } + } + + private func resumeStatusChecks() { + guard canPollStatus else { return } + needsImmediateStatusCheck = true + cancelPollDelay() + scheduleStatusCheck() + } + + private func pauseStatusChecks() { + needsImmediateStatusCheck = false + cancelPollDelay() + if operation == .poll { requestTask?.cancel() } + } + + private func cancelPollDelay() { + pollDelayTask?.cancel() + pollDelayTask = nil + } + + @objc private func applicationWillResignActive() { + isApplicationActive = false + pauseStatusChecks() + } + + @objc private func applicationDidBecomeActive() { + guard !isApplicationActive else { return } + isApplicationActive = true + resumeStatusChecks() + } + + private func performPrimaryAction() { + guard operation == nil else { return } + if viewModel.isCompleted { navigationController?.popViewController(animated: true) } + else if viewModel.code != nil { run(.status) } + else if viewModel.detail == nil || !viewModel.hasLoadedTasks || viewModel.tasksErrorMessage != nil { run(.refresh) } + else if viewModel.order.canConfirm != true { run(.status) } + else { run(.generate) } + } + + private func performSecondaryAction() { + guard !isShowingOperation, presentedViewController == nil else { return } + guard viewModel.code == nil, !viewModel.isCompleted, viewModel.detail != nil else { + navigationController?.popViewController(animated: true) + return + } + guard operation == nil else { return } + guard viewModel.validateContext() else { applySnapshot(); return } + viewModel.setReviewed(false) + applySnapshot() + let sheet = DroneDockDeliveryEntry.makeMethodSheet(order: viewModel.order, context: viewModel.context, + controllerFactory: deliveryControllerFactory, onDidDismiss: { [weak self] openedCloud in + guard let self else { return } + self.isShowingDeliverySheet = false + if openedCloud { self.run(.refresh) } + else { self.resumeStatusChecks() } + }) + isShowingDeliverySheet = true + pauseStatusChecks() + present(sheet, animated: true) + } + + @objc private func refreshTapped() { run(viewModel.isAwaitingConfirmation || viewModel.isCompleted ? .status : .refresh) } + + private func clearImage() { + guard imageURL != nil || codeImage != nil || imageError != nil else { return } + imageGeneration &+= 1 + imageLoader.cancel() + imageURL = nil + codeImage = nil + imageError = nil + collectionView.visibleCells.compactMap { $0 as? DroneDockConfirmationCodeCell }.forEach { $0.clearImage() } + } + + private func loadCodeImage(forceRefresh: Bool) { + guard viewModel.validateContext(), let code = viewModel.code else { + clearImage() + applySnapshot() + return + } + imageGeneration &+= 1 + let generation = imageGeneration + imageLoader.cancel() + imageURL = code.imageURL + codeImage = nil + imageError = nil + imageLoader.loadImage(from: code.imageURL, forceRefresh: forceRefresh) { [weak self] result in + guard let self, self.imageGeneration == generation, self.viewModel.code == code else { return } + guard self.viewModel.validateContext() else { self.clearImage(); self.applySnapshot(); return } + switch result { + case .success(let image): self.codeImage = image + case .failure: self.imageError = "确认码图片加载失败,请重试" + } + self.applySnapshot() + } + applySnapshot() + } + + private func preview(_ film: DroneDockMaterialFilm) { + guard viewModel.validateContext() else { applySnapshot(); return } + guard allowsRemoteMedia else { showToast("本地模拟成片,不加载远程视频"); return } + guard let url = film.previewURL else { showToast("成片播放地址暂不可用"); return } + let controller = AVPlayerViewController() + controller.modalPresentationStyle = .fullScreen + controller.player = AVPlayer(url: url) + present(controller, animated: true) { controller.player?.play() } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliveryCloudComponents.swift b/suixinkan/UI/DroneDock/DroneDockDeliveryCloudComponents.swift new file mode 100644 index 0000000..262a7d0 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliveryCloudComponents.swift @@ -0,0 +1,120 @@ +import SnapKit +import UIKit + +/// 云端交付顶部的游客摘要,订单身份由页面读取真实数据后传入。 +@MainActor +final class DroneDockDeliveryCustomerCell: UICollectionViewCell { + private let customer = DroneDockDeliveryCustomerView(showsCard: false) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.addSubview(customer) + customer.snp.makeConstraints { $0.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 只展示当前订单的游客与尾号,不生成业务示例数据。 + func apply(title: String, orderNumber: String?) { + customer.apply(title: title, orderNumber: orderNumber) + accessibilityIdentifier = "drone.delivery.order" + } +} + +/// 云端上传的短标题与用途说明,与任务选择和提交权限分离。 +@MainActor +final class DroneDockDeliveryIntroCell: UICollectionViewCell { + override init(frame: CGRect) { + super.init(frame: frame) + let title = DroneDockStyle.label("交付你的精彩成片", size: 25, weight: .bold, color: DroneDockDeliveryDesign.text) + title.accessibilityIdentifier = "drone.delivery.intro.title" + title.numberOfLines = 0 + let detail = DroneDockStyle.label("将视频保存到当前拍摄任务,供游客查看", size: 13, color: DroneDockDeliveryDesign.secondary) + detail.numberOfLines = 0 + let stack = UIStackView(arrangedSubviews: [title, detail]) + stack.axis = .vertical + stack.spacing = 7 + contentView.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 5, left: 0, bottom: 8, right: 0)) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } +} + +/// 素材任务入口的只读任务卡;已关联的目标不会被设计成可切换选项。 +@MainActor +final class DroneDockDeliveryBoundTaskCell: UICollectionViewCell { + private let heading = DroneDockStyle.label("当前拍摄任务", size: 15, weight: .semibold, color: DroneDockDeliveryDesign.text) + private let badge = UILabel() + private let icon = UIImageView(image: UIImage(systemName: "mappin.circle")) + private let titleLabel = DroneDockStyle.label(size: 17, weight: .semibold, color: DroneDockDeliveryDesign.text) + private let detailsLabel = DroneDockStyle.label(size: 12, color: DroneDockDeliveryDesign.secondary) + private let filmLabel = DroneDockStyle.label(size: 12, color: DroneDockDeliveryDesign.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + DroneDockDeliveryDesign.card(to: contentView, cornerRadius: 16) + badge.text = "已关联" + badge.font = .systemFont(ofSize: 12, weight: .medium) + badge.textColor = DroneDockDeliveryDesign.primary + badge.textAlignment = .center + badge.backgroundColor = UIColor(hex: 0xE5EFFF) + badge.layer.cornerRadius = 12 + badge.clipsToBounds = true + badge.setContentCompressionResistancePriority(.required, for: .horizontal) + titleLabel.numberOfLines = 0 + titleLabel.accessibilityIdentifier = "drone.delivery.boundTask.title" + detailsLabel.numberOfLines = 0 + filmLabel.numberOfLines = 0 + filmLabel.isHidden = true + icon.tintColor = DroneDockDeliveryDesign.primary + icon.contentMode = .scaleAspectFit + let headingRow = UIStackView(arrangedSubviews: [heading, badge]) + headingRow.alignment = .center + headingRow.spacing = 12 + badge.snp.makeConstraints { $0.width.equalTo(62); $0.height.equalTo(25) } + let text = UIStackView(arrangedSubviews: [titleLabel, detailsLabel, filmLabel]) + text.axis = .vertical + text.spacing = 7 + let body = UIStackView(arrangedSubviews: [icon, text]) + body.alignment = .top + body.spacing = 12 + icon.snp.makeConstraints { $0.width.height.equalTo(25) } + let stack = UIStackView(arrangedSubviews: [headingRow, body]) + stack.axis = .vertical + stack.spacing = 15 + contentView.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(16) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 长点位名完整换行,已有成片的替换提示在卡片内保留。 + func apply(task: DroneDockMaterialTask?) { + if let task { + heading.text = "当前拍摄任务" + badge.isHidden = false + titleLabel.text = Self.text(task.spotName, fallback: "当前点位") + let number = task.sequence.map { String(format: "%02d", $0) } + let record = number.map { "拍摄记录 \($0)" } ?? "当前拍摄记录" + detailsLabel.text = "\(record) · \(Self.text(task.airLineName, fallback: "航线待确认"))\n\(Self.text(task.createdAt, fallback: "时间待确认"))" + filmLabel.text = task.film.map { "已有成片:\(Self.text($0.fileName, fallback: "视频成片"))\n上传新视频前会请你确认替换" } + filmLabel.isHidden = task.film == nil + accessibilityIdentifier = "drone.delivery.boundTask.\(task.id)" + } else { + heading.text = "当前拍摄任务" + badge.isHidden = true + titleLabel.text = "原拍摄任务暂不可用" + detailsLabel.text = "请返回素材库刷新后,从对应任务重新进入" + filmLabel.isHidden = true + accessibilityIdentifier = "drone.delivery.boundTask.unavailable" + } + } + + private static func text(_ value: String?, fallback: String) -> String { + DroneDockHomeMetric.usableText(value) ?? fallback + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliveryDesign.swift b/suixinkan/UI/DroneDock/DroneDockDeliveryDesign.swift new file mode 100644 index 0000000..28c2eeb --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliveryDesign.swift @@ -0,0 +1,170 @@ +import AVFoundation +import SnapKit +import UIKit + +/// 云端上传与面对面闪传共用的展示颜色和卡片外观,不参与交付业务。 +@MainActor +enum DroneDockDeliveryDesign { + static let background = UIColor(hex: 0xF5F7FB) + static let primary = UIColor(hex: 0x066BFF) + static let text = UIColor(hex: 0x172033) + static let secondary = UIColor(hex: 0x7B879C) + static let border = UIColor(hex: 0xE7ECF4) + + /// 应用两页一致的白色卡片与细边框,尺寸和内容布局由调用方决定。 + static func card(to view: UIView, cornerRadius: CGFloat = 14) { + view.backgroundColor = .white + view.layer.cornerRadius = cornerRadius + view.layer.cornerCurve = .continuous + view.layer.borderWidth = 1 + view.layer.borderColor = border.cgColor + } +} + +/// 交付对象摘要:中性系统头像、真实游客标题及可选订单尾号。 +@MainActor +final class DroneDockDeliveryCustomerView: UIView { + private let avatar = UIView() + private let avatarIcon = UIImageView(image: UIImage(systemName: "person.fill")) + private let titleLabel = DroneDockStyle.label(size: 16, weight: .semibold, color: DroneDockDeliveryDesign.text) + private let orderLabel = DroneDockStyle.label(size: 13, color: DroneDockDeliveryDesign.secondary) + private let labels = UIStackView() + private let row = UIStackView() + + /// 默认显示白卡;两种交付入口使用相同内容与自适应高度。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + /// 云端上传可选择透明背景,面对面闪传默认保留白色摘要卡。 + convenience init(showsCard: Bool = true) { + self.init(frame: .zero) + if !showsCard { + backgroundColor = .clear + layer.borderWidth = 0 + row.snp.updateConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)) } + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 直接展示调用方的游客标题;订单缺失时隐藏尾号行,不补造号码。 + func apply(title: String, orderNumber: String?) { + titleLabel.text = title + let number = orderNumber?.trimmingCharacters(in: .whitespacesAndNewlines) + orderLabel.text = number.flatMap { $0.isEmpty ? nil : "订单尾号 \($0.suffix(4))" } + orderLabel.isHidden = orderLabel.text == nil + } + + private func setupUI() { + DroneDockDeliveryDesign.card(to: self) + accessibilityIdentifier = "drone.delivery.customer" + avatar.backgroundColor = UIColor(hex: 0xE8EEF7) + avatar.layer.cornerRadius = 24 + avatarIcon.tintColor = UIColor(hex: 0x91A7C2) + avatarIcon.contentMode = .scaleAspectFit + avatarIcon.isAccessibilityElement = false + avatar.addSubview(avatarIcon) + titleLabel.numberOfLines = 0 + titleLabel.lineBreakMode = .byWordWrapping + titleLabel.accessibilityIdentifier = "drone.delivery.customer.title" + orderLabel.accessibilityIdentifier = "drone.delivery.customer.order" + orderLabel.isHidden = true + labels.axis = .vertical + labels.spacing = 5 + labels.addArrangedSubview(titleLabel) + labels.addArrangedSubview(orderLabel) + row.axis = .horizontal + row.alignment = .center + row.spacing = 12 + row.addArrangedSubview(avatar) + row.addArrangedSubview(labels) + addSubview(row) + } + + private func setupConstraints() { + row.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 14, left: 16, bottom: 14, right: 16)) } + avatar.snp.makeConstraints { $0.size.equalTo(48) } + avatarIcon.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(25) + } + } +} + +/// 从当前选中的本地视频异步生成封面;不加载网络图片,不包含播放按钮或固定比例。 +@MainActor +final class DroneDockDeliveryVideoThumbnailView: UIView { + private let imageView = UIImageView() + private let placeholder = UIImageView(image: UIImage(systemName: "video.fill")) + private var representedID: UUID? + private var generator: AVAssetImageGenerator? + private var thumbnailTask: Task? + + /// 默认圆角封面,外部页面决定大小、比例及预览操作。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { thumbnailTask?.cancel() } + + /// 同一视频身份只生成一次;更换或移除时取消生成并立即清除旧封面。 + func apply(video: DroneDockDeliveryVideo?) { + guard representedID != video?.id else { return } + representedID = video?.id + thumbnailTask?.cancel() + thumbnailTask = nil + generator?.cancelAllCGImageGeneration() + generator = nil + imageView.image = nil + placeholder.isHidden = false + accessibilityLabel = video == nil ? "未选择视频" : "视频封面暂不可用" + guard let video, video.url.isFileURL else { return } + let generator = AVAssetImageGenerator(asset: AVURLAsset(url: video.url)) + generator.appliesPreferredTrackTransform = true + generator.maximumSize = CGSize(width: 960, height: 540) + self.generator = generator + thumbnailTask = Task { @MainActor [weak self] in + let image = try? await generator.image(at: .zero).image + guard let self, !Task.isCancelled, self.representedID == video.id else { return } + self.generator = nil + self.thumbnailTask = nil + guard let image else { return } + self.imageView.image = UIImage(cgImage: image) + self.placeholder.isHidden = true + self.accessibilityLabel = "所选视频封面" + } + } + + private func setupUI() { + backgroundColor = UIColor(hex: 0xE8EEF7) + layer.cornerRadius = 10 + layer.cornerCurve = .continuous + clipsToBounds = true + isAccessibilityElement = true + accessibilityIdentifier = "drone.delivery.thumbnail" + accessibilityLabel = "未选择视频" + imageView.contentMode = .scaleAspectFill + imageView.accessibilityIdentifier = "drone.delivery.thumbnail.image" + placeholder.tintColor = UIColor(hex: 0x91A7C2) + placeholder.contentMode = .scaleAspectFit + placeholder.accessibilityIdentifier = "drone.delivery.thumbnail.placeholder" + [imageView, placeholder].forEach(addSubview) + } + + private func setupConstraints() { + imageView.snp.makeConstraints { $0.edges.equalToSuperview() } + placeholder.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(30) + } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliveryEntry.swift b/suixinkan/UI/DroneDock/DroneDockDeliveryEntry.swift new file mode 100644 index 0000000..7404644 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliveryEntry.swift @@ -0,0 +1,91 @@ +import UIKit + +/// 订单列表与素材库共用的真实成片交付页面工厂。 +@MainActor +enum DroneDockDeliveryEntry { + /// 所有交付入口先选择方式;素材入口保留任务预选,云端页面在同一弹窗内继续。 + static func makeMethodSheet(order: DroneDockHomeOrder, context: DroneDockHomeContext, + taskID: Int? = nil, + controllerFactory: @escaping (DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController, + onDidDismiss: ((Bool) -> Void)? = nil, + onDidCloseCloud: @escaping () -> Void = {}) -> UINavigationController { + let methods = DroneDockDeliveryMethodViewController(customerTitle: order.touristTitle) + let navigation = DroneDockDeliverySheetNavigationController(rootViewController: methods) + navigation.modalPresentationStyle = .pageSheet + navigation.onDidCloseCloud = onDidCloseCloud + navigation.onDidDismiss = onDidDismiss + methods.onClose = { [weak navigation] in navigation?.dismiss(animated: true) } + methods.onNearbyTransfer = { [weak navigation, weak methods] in + guard let navigation, let methods, navigation.topViewController === methods else { return } + let nearby = DroneDockNearbyTransferViewController(customerTitle: order.touristTitle, orderNumber: order.orderNumber) + nearby.onClose = { [weak navigation] in navigation?.dismiss(animated: true) } + navigation.isModalInPresentation = true + navigation.sheetPresentationController?.animateChanges { + navigation.sheetPresentationController?.detents = [.large()] + navigation.sheetPresentationController?.selectedDetentIdentifier = .large + } + navigation.setNavigationBarHidden(false, animated: true) + navigation.pushViewController(nearby, animated: true) + } + methods.onCloudUpload = { [weak navigation, weak methods] in + guard let navigation, let methods, navigation.topViewController === methods else { return } + let cloud = controllerFactory(order, context, taskID) + if let cloud = cloud as? DroneDockDeliveryViewController { + cloud.configureSheetPresentation { [weak navigation] in navigation?.dismiss(animated: true) } + } + navigation.didOpenCloud = true + navigation.isModalInPresentation = true + navigation.sheetPresentationController?.animateChanges { + navigation.sheetPresentationController?.detents = [.large()] + navigation.sheetPresentationController?.selectedDetentIdentifier = .large + } + navigation.setNavigationBarHidden(false, animated: true) + navigation.pushViewController(cloud, animated: true) + } + return navigation + } + + /// 同时传递订单与可选任务,进入页面后重新校验当前身份和上传权限。 + static func makeController(order: DroneDockHomeOrder, context: DroneDockHomeContext, taskID: Int?) -> UIViewController { + let client = NetworkServices.shared.apiClient + return DroneDockDeliveryViewController(viewModel: DroneDockDeliveryViewModel( + context: context, order: order, + service: DroneDockDeliveryAPI(client: client), + uploader: DroneDockFilmUploader(configService: UploadAPI(client: client)), + initialTaskID: taskID, + currentContext: { DroneDockHomeViewController.currentContext() } + )) + } +} + +/// 统一处理手动关闭与下拉关闭,云端交付结束后只通知来源列表一次。 +@MainActor +private final class DroneDockDeliverySheetNavigationController: UINavigationController, UIAdaptivePresentationControllerDelegate { + /// 云端页面已经进入,关闭弹窗后需要重读订单状态。 + var didOpenCloud = false + /// 不因仅查看交付方式而刷新订单。 + var onDidCloseCloud: (() -> Void)? + /// 关闭方式弹窗后通知来源页,并传回是否曾打开云端交付。 + var onDidDismiss: ((Bool) -> Void)? + private var didNotifyClose = false + + override func viewDidLoad() { + super.viewDidLoad() + presentationController?.delegate = self + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + if isBeingDismissed || presentingViewController == nil { notifyClose() } + } + + /// 系统下拉关闭与按钮关闭使用同一去重通知。 + func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { notifyClose() } + + private func notifyClose() { + guard !didNotifyClose else { return } + didNotifyClose = true + if didOpenCloud { onDidCloseCloud?() } + onDidDismiss?(didOpenCloud) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliveryMethodViewController.swift b/suixinkan/UI/DroneDock/DroneDockDeliveryMethodViewController.swift new file mode 100644 index 0000000..45a0308 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliveryMethodViewController.swift @@ -0,0 +1,150 @@ +import SnapKit +import UIKit + +/// 订单的交付方式弹窗,将云端交付和局域网闪传导航交回统一入口。 +@MainActor +final class DroneDockDeliveryMethodViewController: BaseViewController { + /// 用户选择云端上传后,由入口打开现有真实交付页。 + var onCloudUpload: (() -> Void)? + /// 用户选择面对面闪传后,由入口打开独立本地传输页。 + var onNearbyTransfer: (() -> Void)? + /// 用户关闭弹窗后,由入口统一结束当前模态流程。 + var onClose: (() -> Void)? + + /// 两种交付方式使用独立、稳定的列表身份。 + private enum Item: Hashable { case nearby, cloud } + + private let customerTitle: String + private let headerView = DroneDeliveryUploadHeaderView() + private let footerView = DroneDeliveryUploadFooterView() + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private var hasRequestedNavigation = false + + /// 游客标题由选中的订单传入,本弹窗不读取网络或改变订单状态。 + init(customerTitle: String) { + self.customerTitle = customerTitle + super.init(nibName: nil, bundle: nil) + modalPresentationStyle = .pageSheet + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + hasRequestedNavigation = false + navigationController?.isModalInPresentation = false + isModalInPresentation = false + navigationController?.setNavigationBarHidden(true, animated: false) + configureSheet() + } + + override func setupNavigationBar() { + title = "交付成片" + navigationController?.setNavigationBarHidden(true, animated: false) + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = false + collectionView.showsVerticalScrollIndicator = false + collectionView.accessibilityIdentifier = "drone.delivery.method.list" + collectionView.delegate = self + collectionView.register(DroneDeliveryUploadMethodCell.self, forCellWithReuseIdentifier: "method") + [headerView, collectionView, footerView].forEach(view.addSubview) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + headerView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + } + collectionView.snp.makeConstraints { make in + make.top.equalTo(headerView.snp.bottom) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + headerView.onCloseTap = { [weak self] in self?.onClose?() } + footerView.onPrimaryTap = { [weak self] in self?.requestCloudUpload() } + } + + private func configureSheet() { + guard let sheet = navigationController?.sheetPresentationController ?? sheetPresentationController else { return } + let identifier = UISheetPresentationController.Detent.Identifier("drone.delivery.method") + sheet.detents = [ + .custom(identifier: identifier) { context in min(410, context.maximumDetentValue) }, + .large() + ] + sheet.selectedDetentIdentifier = identifier + sheet.prefersGrabberVisible = true + sheet.preferredCornerRadius = 22 + sheet.prefersScrollingExpandsWhenScrolledToEdge = false + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { _, _ in + let height: CGFloat = 88 + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .fractionalHeight(1))) + let group = NSCollectionLayoutGroup.vertical( + layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(height)), subitems: [item]) + let section = NSCollectionLayoutSection(group: group) + section.interGroupSpacing = 12 + section.contentInsets = .init(top: 4, leading: 20, bottom: 4, trailing: 20) + return section + } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { collection, path, item in + switch item { + case .nearby, .cloud: + let cell = collection.dequeueReusableCell(withReuseIdentifier: "method", for: path) as! DroneDeliveryUploadMethodCell + if item == .nearby { + cell.apply(title: "面对面闪传", detail: "同一 Wi-Fi 扫码接收 · 无需上传", symbol: "wifi", identifier: "drone.delivery.method.nearby") + } else { + cell.apply(title: "云端上传", detail: "选择打卡点,上传后游客可查看", symbol: "icloud.and.arrow.up", identifier: "drone.delivery.method.cloud") + } + return cell + } + } + } + + private func applySnapshot(animated: Bool) { + guard dataSource != nil else { return } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + headerView.apply(title: "交付成片", customer: customerTitle, detail: "请选择本次交付方式") + footerView.apply(primaryTitle: nil, enabled: false, identifier: "", detail: "可分批交付多个作品,不影响拍摄次数", secondaryTitle: nil) + snapshot.appendItems([.nearby, .cloud]) + dataSource.apply(snapshot, animatingDifferences: animated) + collectionView.collectionViewLayout.invalidateLayout() + } + + private func requestCloudUpload() { + guard !hasRequestedNavigation, let onCloudUpload else { return } + hasRequestedNavigation = true + onCloudUpload() + } +} + +extension DroneDockDeliveryMethodViewController: UICollectionViewDelegate { + /// 只在用户选择后进入对应流程,方式弹窗本身不读取网络。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard let item = dataSource.itemIdentifier(for: indexPath), !hasRequestedNavigation else { return } + switch item { + case .nearby: + guard let onNearbyTransfer else { return } + hasRequestedNavigation = true + onNearbyTransfer() + case .cloud: requestCloudUpload() + } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliverySelectedVideoView.swift b/suixinkan/UI/DroneDock/DroneDockDeliverySelectedVideoView.swift new file mode 100644 index 0000000..3202ef6 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliverySelectedVideoView.swift @@ -0,0 +1,128 @@ +import AVFoundation +import SnapKit +import UIKit + +/// 固定上传操作区上方的大视频预览,使用真实本地封面并保留更换和移除。 +@MainActor +final class DroneDockDeliverySelectedVideoView: UIView { + private let content = UIView() + private let heading = DroneDockStyle.label("已选视频", size: 15, weight: .semibold, color: DroneDockDeliveryDesign.text) + private let thumbnail = DroneDockDeliveryVideoThumbnailView() + private let previewButton = UIButton(type: .custom) + private let nameLabel = DroneDockStyle.label(size: 15, weight: .semibold, color: DroneDockDeliveryDesign.text) + private let sizeLabel = DroneDockStyle.label(size: 12, color: DroneDockDeliveryDesign.secondary) + private let replaceButton = UIButton(type: .system) + private let removeButton = UIButton(type: .system) + private var preview: (() -> Void)? + private var replace: (() -> Void)? + private var remove: (() -> Void)? + private var representedID: UUID? + private var durationText: String? + private var metadataTask: Task? + + /// 创建可随屏幕高度收紧的预览卡,按钮均保留至少44点触控范围。 + override init(frame: CGRect) { + super.init(frame: frame) + DroneDockDeliveryDesign.card(to: self, cornerRadius: 16) + clipsToBounds = true + accessibilityIdentifier = "drone.delivery.selectedVideo" + thumbnail.layer.cornerRadius = 10 + thumbnail.isAccessibilityElement = false + thumbnail.accessibilityIdentifier = "drone.delivery.selectedVideo.cover" + previewButton.setImage(UIImage(systemName: "play.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 19, weight: .semibold)), for: .normal) + previewButton.tintColor = DroneDockDeliveryDesign.text + previewButton.backgroundColor = .white + previewButton.layer.cornerRadius = 24 + previewButton.accessibilityIdentifier = "drone.delivery.preview" + previewButton.accessibilityLabel = "预览所选视频" + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + nameLabel.numberOfLines = 2 + nameLabel.lineBreakMode = .byTruncatingMiddle + nameLabel.accessibilityIdentifier = "drone.delivery.selectedVideo.name" + replaceButton.setTitle("重新选择", for: .normal) + replaceButton.setTitleColor(DroneDockDeliveryDesign.primary, for: .normal) + replaceButton.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium) + replaceButton.accessibilityIdentifier = "drone.delivery.chooseVideo" + replaceButton.addTarget(self, action: #selector(replaceTapped), for: .touchUpInside) + removeButton.setTitle("移除", for: .normal) + removeButton.setTitleColor(DroneDockDeliveryDesign.secondary, for: .normal) + removeButton.titleLabel?.font = .systemFont(ofSize: 14) + removeButton.accessibilityLabel = "移除所选视频" + removeButton.accessibilityIdentifier = "drone.delivery.removeVideo" + removeButton.addTarget(self, action: #selector(removeTapped), for: .touchUpInside) + addSubview(content) + content.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + make.bottom.equalToSuperview().priority(999) + make.height.greaterThanOrEqualTo(200) + } + [heading, thumbnail, nameLabel, sizeLabel, replaceButton, removeButton].forEach(content.addSubview) + thumbnail.addSubview(previewButton) + heading.snp.makeConstraints { make in make.top.equalToSuperview().offset(16); make.leading.equalToSuperview().offset(16) } + replaceButton.snp.makeConstraints { make in make.top.equalToSuperview().offset(2); make.trailing.equalToSuperview().inset(8); make.height.equalTo(44); make.width.equalTo(86) } + thumbnail.snp.makeConstraints { make in + make.top.equalToSuperview().offset(44) + make.leading.trailing.equalToSuperview().inset(12) + make.bottom.equalTo(nameLabel.snp.top).offset(-9) + make.height.greaterThanOrEqualTo(70) + } + previewButton.snp.makeConstraints { make in make.center.equalToSuperview(); make.size.equalTo(48) } + removeButton.snp.makeConstraints { make in make.top.equalTo(nameLabel).offset(-5); make.trailing.equalToSuperview().inset(6); make.size.equalTo(48) } + nameLabel.snp.makeConstraints { make in + make.leading.equalToSuperview().offset(16) + make.trailing.equalTo(removeButton.snp.leading).offset(-4) + make.height.equalTo(36) + } + sizeLabel.snp.makeConstraints { make in + make.leading.equalTo(nameLabel) + make.trailing.lessThanOrEqualTo(removeButton.snp.leading).offset(-4) + make.top.equalTo(nameLabel.snp.bottom).offset(2) + make.height.equalTo(16) + make.bottom.equalToSuperview().inset(12) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { metadataTask?.cancel() } + + /// 选择只更新摘要,不发起上传;异步封面按视频身份丢弃迟到结果。 + func apply(video: DroneDockDeliveryVideo?, enabled: Bool, + preview: @escaping () -> Void, replace: @escaping () -> Void, remove: @escaping () -> Void) { + self.preview = preview + self.replace = replace + self.remove = remove + let changed = representedID != video?.id + if changed { durationText = nil } + nameLabel.text = video?.fileName + updateFileMetadata(video) + [previewButton, replaceButton, removeButton].forEach { $0.isEnabled = enabled && video != nil } + thumbnail.apply(video: video) + guard changed else { return } + representedID = video?.id + metadataTask?.cancel() + guard let video, video.url.isFileURL else { return } + metadataTask = Task { @MainActor [weak self] in + let duration = try? await AVURLAsset(url: video.url).load(.duration) + guard let self, !Task.isCancelled, self.representedID == video.id, + let seconds = duration?.seconds, seconds.isFinite, seconds > 0, + seconds < Double(Int.max / 2) else { return } + let whole = Int(seconds.rounded()) + let time = String(format: "%02d:%02d", whole / 60, whole % 60) + self.durationText = time + self.updateFileMetadata(video) + } + } + + private func updateFileMetadata(_ video: DroneDockDeliveryVideo?) { + sizeLabel.text = video.map { video in + [ByteCountFormatter.string(fromByteCount: Int64(video.fileSize), countStyle: .file), durationText] + .compactMap { $0 }.joined(separator: " · ") + } + } + + @objc private func previewTapped() { preview?() } + @objc private func replaceTapped() { replace?() } + @objc private func removeTapped() { remove?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliveryVideoLoader.swift b/suixinkan/UI/DroneDock/DroneDockDeliveryVideoLoader.swift new file mode 100644 index 0000000..67f199c --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliveryVideoLoader.swift @@ -0,0 +1,92 @@ +import AVFoundation +import Foundation +import PhotosUI +import UniformTypeIdentifiers + +/// 将用户选择的视频复制到本页独占的临时目录,避免相册临时文件提前失效。 +enum DroneDockDeliveryVideoLoader { + /// 相册回调返回前完成文件复制,随后验证本地视频轨道。 + @MainActor + static func load(provider: NSItemProvider) async throws -> DroneDockDeliveryVideo { + let suggestedName = provider.suggestedName + let copiedURL: URL = try await withCheckedThrowingContinuation { continuation in + provider.loadFileRepresentation(forTypeIdentifier: UTType.movie.identifier) { source, error in + if let error { continuation.resume(throwing: error); return } + guard let source else { continuation.resume(throwing: VideoError.unavailable); return } + do { continuation.resume(returning: try copy(source: source, suggestedName: suggestedName)) } + catch { continuation.resume(throwing: error) } + } + } + return try await validate(copiedURL) + } + + /// 文件选择器的安全作用域仅用于复制,上传不持有外部文件访问权限。 + @MainActor + static func load(documentURL: URL) async throws -> DroneDockDeliveryVideo { + let accessing = documentURL.startAccessingSecurityScopedResource() + defer { if accessing { documentURL.stopAccessingSecurityScopedResource() } } + let copiedURL = try await Task.detached(priority: .userInitiated) { + try copy(source: documentURL, suggestedName: documentURL.lastPathComponent) + }.value + return try await validate(copiedURL) + } + + /// 只清理本功能创建的独占目录,外部文件和测试文件不受影响。 + static func discard(_ url: URL) { + let directory = url.deletingLastPathComponent().standardizedFileURL + guard directory.deletingLastPathComponent() == root.standardizedFileURL else { return } + try? FileManager.default.removeItem(at: directory) + } + + private static var root: URL { FileManager.default.temporaryDirectory.appendingPathComponent("drone-dock-delivery", isDirectory: true) } + + private static func copy(source: URL, suggestedName: String?) throws -> URL { + guard source.isFileURL else { throw VideoError.unavailable } + let sourceExtension = source.pathExtension.lowercased() + let candidate = (suggestedName ?? source.lastPathComponent).trimmingCharacters(in: .whitespacesAndNewlines) + var name = URL(fileURLWithPath: candidate.isEmpty ? "成片视频" : candidate).lastPathComponent + if URL(fileURLWithPath: name).pathExtension.isEmpty, !sourceExtension.isEmpty { name += "." + sourceExtension } + guard name.count <= 255 else { throw VideoError.longName } + guard ["mp4", "mov", "avi", "mkv", "flv", "wmv", "webm"].contains(URL(fileURLWithPath: name).pathExtension.lowercased()) else { + throw VideoError.unsupported + } + let values = try source.resourceValues(forKeys: [.fileSizeKey, .isRegularFileKey]) + guard values.isRegularFile == true, let size = values.fileSize, size > 0 else { throw VideoError.unavailable } + guard size <= 2_048 * 1_024 * 1_024 else { throw VideoError.tooLarge } + let directory = root.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let destination = directory.appendingPathComponent(name) + do { try FileManager.default.copyItem(at: source, to: destination); return destination } + catch { try? FileManager.default.removeItem(at: directory); throw error } + } + + @MainActor + private static func validate(_ url: URL) async throws -> DroneDockDeliveryVideo { + do { + try Task.checkCancellation() + let asset = AVURLAsset(url: url) + let tracks = try await asset.loadTracks(withMediaType: .video) + guard !tracks.isEmpty else { throw VideoError.unsupported } + let values = try url.resourceValues(forKeys: [.fileSizeKey]) + guard let size = values.fileSize, size > 0 else { throw VideoError.unavailable } + try Task.checkCancellation() + return DroneDockDeliveryVideo(url: url, fileName: url.lastPathComponent, fileSize: size) + } catch { + discard(url) + throw error + } + } + + /// 文件准备失败时保留可操作的提示,不把无效文件交给上传队列。 + private enum VideoError: LocalizedError { + case unavailable, unsupported, tooLarge, longName + var errorDescription: String? { + switch self { + case .unavailable: "无法读取视频文件,请重新选择" + case .unsupported: "请选择 MP4、MOV 等受支持的视频;M4V 请先导出为 MP4" + case .tooLarge: "视频不能超过 2 GB,请压缩后重试" + case .longName: "视频文件名过长,请缩短后重新选择" + } + } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeliveryViewController.swift b/suixinkan/UI/DroneDock/DroneDockDeliveryViewController.swift new file mode 100644 index 0000000..5321e25 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeliveryViewController.swift @@ -0,0 +1,601 @@ +import AVKit +import PhotosUI +import SnapKit +import UIKit +import UniformTypeIdentifiers + +/// 订单列表与任务素材入口共用的云端成片交付页,一个任务保存一个视频。 +@MainActor +final class DroneDockDeliveryViewController: BaseViewController { + /// 当前订单、任务选择及上传保存状态。 + let viewModel: DroneDockDeliveryViewModel + private let onDidSave: (() -> Void)? + private let videoPicker: (@MainActor () async throws -> DroneDockDeliveryVideo?)? + private var operationTask: Task? + private var hasAppeared = false + private var isRefreshing = false + private var isPicking = false + private var isStartingSubmission = false + private var pickerError: String? + private var ownedVideoURLs: Set = [] + private var previousGestureEnabled: Bool? + private var onCloseSheet: (() -> Void)? + private weak var trackedNavigationController: UINavigationController? + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let footer = UIView() + private let stateLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let progressView = UIProgressView(progressViewStyle: .default) + private let footerNote = DroneDockStyle.label("保存成功后,游客可在小程序相册查看", size: 11, color: DroneDockDeliveryDesign.secondary) + private let submitButton = UIButton(type: .system) + private let selectedVideoView = DroneDockDeliverySelectedVideoView() + private var selectedVideoHeight: Constraint? + private var selectedVideoBottom: Constraint? + private var progressHeight: Constraint? + private var displayedVideoHeight: CGFloat = 0 + + /// 点位横向排列,其余信息按步骤向下展示。 + private enum Section: Hashable { case order, points, tasks, state } + /// 身份稳定的 Diffable 项目,上传进度不改变选择。 + private enum Item: Hashable { case order, intro, point(Int), task(Int), boundTask, choosePoint, emptyTasks, state } + + /// 注入上传状态、真实保存回调和可测试的视频选择入口。 + init(viewModel: DroneDockDeliveryViewModel, onDidSave: (() -> Void)? = nil, + videoPicker: (@MainActor () async throws -> DroneDockDeliveryVideo?)? = nil) { + self.viewModel = viewModel + self.onDidSave = onDidSave + self.videoPicker = videoPicker + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { + operationTask?.cancel() + ownedVideoURLs.forEach(DroneDockDeliveryVideoLoader.discard) + } + + /// 交付入口以弹窗展示时复用上传流程,并将关闭动作纳入处理中退出确认。 + func configureSheetPresentation(onClose: @escaping () -> Void) { + onCloseSheet = onClose + } + + override func setupNavigationBar() { + title = "云端上传" + navigationItem.backButtonDisplayMode = .minimal + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.backgroundColor = DroneDockDeliveryDesign.background + appearance.shadowColor = .clear + appearance.titleTextAttributes = [.foregroundColor: DroneDockDeliveryDesign.text, .font: UIFont.systemFont(ofSize: 18, weight: .semibold)] + navigationItem.standardAppearance = appearance + navigationItem.scrollEdgeAppearance = appearance + navigationController?.navigationBar.tintColor = DroneDockDeliveryDesign.text + let back = UIBarButtonItem(image: UIImage(systemName: "chevron.left"), style: .plain, target: self, action: #selector(backTapped)) + back.accessibilityLabel = onCloseSheet == nil ? "返回" : "返回交付方式" + back.accessibilityIdentifier = "drone.delivery.back" + navigationItem.leftBarButtonItem = back + let close = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(closeSheetTapped)) + close.accessibilityLabel = "关闭成片交付" + close.accessibilityIdentifier = "drone.delivery.sheet.close" + navigationItem.rightBarButtonItem = close + } + + override func setupUI() { + view.backgroundColor = DroneDockDeliveryDesign.background + collectionView.backgroundColor = .clear + collectionView.alwaysBounceVertical = true + collectionView.accessibilityIdentifier = "drone.delivery.remote.list" + collectionView.delegate = self + collectionView.register(DroneMaterialFilterCell.self, forCellWithReuseIdentifier: "point") + collectionView.register(DroneDockDeliveryTextCell.self, forCellWithReuseIdentifier: "text") + collectionView.register(DroneDockDeliveryCustomerCell.self, forCellWithReuseIdentifier: "customer") + collectionView.register(DroneDockDeliveryIntroCell.self, forCellWithReuseIdentifier: "intro") + collectionView.register(DroneDockDeliveryBoundTaskCell.self, forCellWithReuseIdentifier: "boundTask") + let refresh = UIRefreshControl() + refresh.addTarget(self, action: #selector(refreshTapped), for: .valueChanged) + collectionView.refreshControl = refresh + footer.backgroundColor = .white + stateLabel.numberOfLines = 0 + stateLabel.accessibilityIdentifier = "drone.delivery.progressText" + progressView.progressTintColor = DroneDockDeliveryDesign.primary + progressView.accessibilityIdentifier = "drone.delivery.progress" + var configuration = UIButton.Configuration.filled() + configuration.imagePadding = 10 + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 20, weight: .medium) + configuration.cornerStyle = .fixed + configuration.background.cornerRadius = 12 + configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 14, bottom: 0, trailing: 14) + submitButton.configuration = configuration + submitButton.configurationUpdateHandler = { button in + guard var configuration = button.configuration else { return } + let foreground = button.isEnabled || configuration.showsActivityIndicator ? UIColor.white : DroneDockDeliveryDesign.primary.withAlphaComponent(0.55) + configuration.background.backgroundColor = button.isEnabled || configuration.showsActivityIndicator + ? DroneDockDeliveryDesign.primary : UIColor(hex: 0xE5EFFF) + configuration.baseForegroundColor = foreground + configuration.imageColorTransformer = UIConfigurationColorTransformer { _ in foreground } + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: 17, weight: .semibold) + result.foregroundColor = foreground + return result + } + button.configuration = configuration + } + submitButton.accessibilityIdentifier = "drone.delivery.submit" + submitButton.addTarget(self, action: #selector(submitTapped), for: .touchUpInside) + view.addSubview(collectionView) + view.addSubview(selectedVideoView) + selectedVideoView.isHidden = true + view.addSubview(footer) + footerNote.numberOfLines = 0 + footerNote.textAlignment = .center + [stateLabel, progressView, submitButton, footerNote].forEach(footer.addSubview) + let divider = UIView() + divider.backgroundColor = DroneDockDeliveryDesign.border + footer.addSubview(divider) + divider.snp.makeConstraints { make in make.top.leading.trailing.equalToSuperview(); make.height.equalTo(0.5) } + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(selectedVideoView.snp.top) + } + selectedVideoView.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(20) + selectedVideoBottom = make.bottom.equalTo(footer.snp.top).constraint + selectedVideoHeight = make.height.equalTo(0).constraint + } + footer.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + stateLabel.snp.makeConstraints { make in make.top.equalToSuperview().offset(10); make.leading.trailing.equalToSuperview().inset(20) } + progressView.snp.makeConstraints { make in + make.top.equalTo(stateLabel.snp.bottom).offset(4) + make.leading.trailing.equalTo(stateLabel) + progressHeight = make.height.equalTo(0).constraint + } + submitButton.snp.makeConstraints { make in + make.top.equalTo(progressView.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(52) + } + footerNote.snp.makeConstraints { make in + make.top.equalTo(submitButton.snp.bottom).offset(8) + make.leading.trailing.equalTo(submitButton) + make.bottom.equalTo(footer.safeAreaLayoutGuide).offset(-8) + } + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + updateSelectedVideoLayout() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + if onCloseSheet != nil { + navigationController?.setNavigationBarHidden(false, animated: false) + navigationController?.isModalInPresentation = true + navigationController?.sheetPresentationController?.detents = [.large()] + navigationController?.sheetPresentationController?.selectedDetentIdentifier = .large + } + trackedNavigationController = navigationController + if previousGestureEnabled == nil { previousGestureEnabled = navigationController?.interactivePopGestureRecognizer?.isEnabled } + guard !hasAppeared else { updateFooter(); return } + hasAppeared = true + refresh() + } + + /// 预览和系统选择器覆盖不清空上传页,只有确认离开后才取消并清理。 + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + trackedNavigationController?.interactivePopGestureRecognizer?.isEnabled = previousGestureEnabled ?? true + guard isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true || parent == nil else { return } + operationTask?.cancel() + viewModel.invalidate() + ownedVideoURLs.forEach(DroneDockDeliveryVideoLoader.discard) + ownedVideoURLs.removeAll() + hasAppeared = false + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, path, item in + guard let self else { return nil } + if item == .order { + let cell = list.dequeueReusableCell(withReuseIdentifier: "customer", for: path) as! DroneDockDeliveryCustomerCell + let order = self.viewModel.detail?.order ?? self.viewModel.order + cell.apply(title: order.touristTitle, orderNumber: order.orderNumber) + return cell + } + if item == .intro { return list.dequeueReusableCell(withReuseIdentifier: "intro", for: path) } + if item == .boundTask { + let cell = list.dequeueReusableCell(withReuseIdentifier: "boundTask", for: path) as! DroneDockDeliveryBoundTaskCell + cell.apply(task: self.viewModel.selectedTask) + return cell + } + if case .point(let id) = item { + let cell = list.dequeueReusableCell(withReuseIdentifier: "point", for: path) as! DroneMaterialFilterCell + let title = self.viewModel.spots.first { $0.id == id }.map { Self.text($0.name, fallback: "点位 \(id)") } ?? "点位 \(id)" + cell.apply(title: title, id: String(id), selected: self.viewModel.selectedSpotID == id, locked: self.locked, wrapsTitle: true) + cell.accessibilityIdentifier = "drone.delivery.point.\(id)" + return cell + } + let cell = list.dequeueReusableCell(withReuseIdentifier: "text", for: path) as! DroneDockDeliveryTextCell + self.configureText(cell, item: item) + return cell + } + } + + private func configureText(_ cell: DroneDockDeliveryTextCell, item: Item) { + switch item { + case .choosePoint: + cell.apply(title: "选择点位与拍摄任务", body: "每个拍摄任务可交付一个视频成片", id: "drone.delivery.chooseTask") + case .task(let id): + guard let task = viewModel.tasks.first(where: { $0.id == id }) else { return } + let number = task.sequence.map(String.init) ?? String(task.id) + let film = task.film.map { "已有成片:\(Self.text($0.fileName, fallback: "视频成片"))\n重新上传将替换此任务的原成片" } ?? "尚未交付成片" + cell.apply(title: "任务 \(number) · \(Self.text(task.spotName, fallback: "点位 \(task.spotID)"))", + body: "\(Self.text(task.airLineName, fallback: "航线待确认")) · \(Self.flightTitle(task.flightStatus))\n\(Self.text(task.createdAt, fallback: "时间待确认"))\n\(film)", + id: "drone.delivery.task.\(id)", selected: viewModel.selectedTaskID == id, selectable: true) + case .emptyTasks: + let noTasks = viewModel.tasks.isEmpty + cell.apply(title: noTasks ? "暂无可交付的拍摄任务" : "此点位暂无拍摄任务", body: "请在拍摄任务创建后刷新,再选择对应任务上传成片", id: "drone.delivery.empty") + case .state: + if isRefreshing || viewModel.isLoading { cell.apply(title: "正在读取订单与任务", body: nil, id: "drone.delivery.loading") } + else if let error = viewModel.loadErrorMessage { + cell.apply(title: "订单信息加载失败", body: error, id: "drone.delivery.error", button: "重试", actionID: "drone.delivery.retry") { [weak self] in self?.refresh() } + } else if let error = pickerError ?? viewModel.submissionErrorMessage { + cell.apply(title: "交付尚未完成", body: error, id: "drone.delivery.error") + } else if let success = viewModel.successMessage { + cell.apply(title: success, body: viewModel.refreshWarning ?? "成片已保存,可返回素材库查看", id: "drone.delivery.success") + } else if !viewModel.canUpload { + cell.apply(title: "当前订单暂不可上传成片", body: "请确认订单已付款且已有有效拍摄任务,刷新后重试", id: "drone.delivery.unavailable") + } else { cell.apply(title: "上传说明", body: "选择一段本地视频,预览确认后再上传", id: "drone.delivery.hint") } + default: break + } + } + + private var locked: Bool { isRefreshing || isPicking || isStartingSubmission || viewModel.isLoading || viewModel.isSubmitting } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, let source = self.dataSource else { return nil } + let sections = source.snapshot().sectionIdentifiers + guard sections.indices.contains(index) else { return nil } + let points = sections[index] == .points + if points, !self.viewModel.spots.isEmpty { + let maximumWidth = min(200, max(1, environment.container.effectiveContentSize.width - 32)) + let sizes = self.viewModel.spots.map { + DroneMaterialFilterCell.wrappedSize(title: Self.text($0.name, fallback: "点位 \($0.id)"), maximumWidth: maximumWidth) + } + let width = sizes.reduce(0) { $0 + $1.width } + CGFloat(sizes.count - 1) * 10 + let height = sizes.map(\.height).max() ?? 40 + let group = NSCollectionLayoutGroup.custom(layoutSize: .init(widthDimension: .absolute(width), heightDimension: .absolute(height))) { _ in + var x: CGFloat = 0 + return sizes.map { size in + defer { x += size.width + 10 } + return NSCollectionLayoutGroupCustomItem(frame: CGRect(x: x, y: 0, width: size.width, height: size.height)) + } + } + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = .init(top: 0, leading: 20, bottom: 12, trailing: 20) + section.orthogonalScrollingBehavior = .continuous + return section + } + let size = NSCollectionLayoutSize(widthDimension: points ? .estimated(112) : .fractionalWidth(1), heightDimension: points ? .absolute(40) : .estimated(100)) + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: points ? .fractionalHeight(1) : .estimated(100))) + let group = NSCollectionLayoutGroup.vertical(layoutSize: size, subitems: [item]) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = .init(top: 0, leading: 20, bottom: 12, trailing: 20) + section.interGroupSpacing = 10 + if points { section.orthogonalScrollingBehavior = .continuous } + return section + } + } + + private func applySnapshot(animated: Bool) { + guard dataSource != nil else { return } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.order]) + snapshot.appendItems([.order, .intro], toSection: .order) + if viewModel.detail != nil && !isRefreshing { + if viewModel.isTaskScoped { + snapshot.appendSections([.tasks]) + snapshot.appendItems([.boundTask], toSection: .tasks) + } else { + snapshot.appendItems([.choosePoint], toSection: .order) + snapshot.appendSections([.points, .tasks]) + snapshot.appendItems(viewModel.spots.map { .point($0.id) }, toSection: .points) + if viewModel.selectedSpotID != nil { + snapshot.appendItems(viewModel.filteredTasks.isEmpty ? [.emptyTasks] : viewModel.filteredTasks.map { .task($0.id) }, toSection: .tasks) + } else if viewModel.tasks.isEmpty { snapshot.appendItems([.emptyTasks], toSection: .tasks) } + } + } + if isRefreshing || viewModel.isLoading || viewModel.loadErrorMessage != nil || pickerError != nil + || viewModel.submissionErrorMessage != nil || viewModel.successMessage != nil || !viewModel.canUpload { + snapshot.appendSections([.state]) + snapshot.appendItems([.state], toSection: .state) + } + let previous = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { previous.contains($0) }) + collectionView.collectionViewLayout.invalidateLayout() + dataSource.apply(snapshot, animatingDifferences: animated) + updateFooter() + } + + private func updateFooter() { + guard isViewLoaded else { return } + let working = viewModel.isSubmitting + let status: String + switch viewModel.phase { + case .validating: status = "正在核对订单与任务…" + case .uploading: status = "正在上传视频 \(viewModel.progress)%" + case .saving: status = "视频上传完成,正在保存成片…" + case .succeeded: status = "成片交付成功" + case .idle: status = isPicking ? "正在准备视频文件…" : viewModel.uploadedFileURL != nil ? "视频已上传,可重试保存成片" : viewModel.video != nil ? "已选择 1 个视频,预览确认后上传" : "请选择一个视频成片,选中后再上传" + } + stateLabel.text = status + progressView.isHidden = !working + progressHeight?.update(offset: working ? 3 : 0) + progressView.progress = Float(viewModel.progress) / 100 + let title = viewModel.successMessage != nil ? "交付成功" : viewModel.video == nil ? "去相册选视频" : "上传所选视频" + submitButton.setTitle(isPicking ? "正在准备视频…" : working ? "处理中…" : title, for: .normal) + submitButton.configuration?.title = submitButton.title(for: .normal) + submitButton.configuration?.image = UIImage(systemName: viewModel.video == nil ? "photo.on.rectangle" : "square.and.arrow.up") + submitButton.configuration?.showsActivityIndicator = working || isPicking + submitButton.isEnabled = (viewModel.video == nil ? viewModel.canChooseVideo : viewModel.canSubmit) && !locked + submitButton.setNeedsUpdateConfiguration() + selectedVideoView.isHidden = viewModel.video == nil + selectedVideoBottom?.update(offset: viewModel.video == nil ? 0 : -16) + updateSelectedVideoLayout() + selectedVideoView.apply(video: viewModel.video, enabled: viewModel.canChooseVideo && !locked, + preview: { [weak self] in self?.previewVideo() }, + replace: { [weak self] in self?.chooseVideo(fromFiles: false) }, + remove: { [weak self] in self?.removeVideo() }) + collectionView.refreshControl?.isEnabled = !working && !isPicking && !isRefreshing + navigationController?.interactivePopGestureRecognizer?.isEnabled = !working && !isStartingSubmission && !isPicking && (previousGestureEnabled ?? true) + } + + private func updateSelectedVideoLayout() { + guard isViewLoaded else { return } + let naturalHeight = max(1, view.bounds.width - 64) * 9 / 16 + 119 + let available = max(220, view.safeAreaLayoutGuide.layoutFrame.height * 0.44) + let height = viewModel.video == nil ? 0 : min(naturalHeight, available) + guard abs(displayedVideoHeight - height) > 0.5 else { return } + displayedVideoHeight = height + selectedVideoHeight?.update(offset: height) + } + + private func refresh() { + guard !viewModel.isSubmitting, !isStartingSubmission, !isPicking else { collectionView.refreshControl?.endRefreshing(); return } + operationTask?.cancel() + isRefreshing = true + pickerError = nil + applySnapshot(animated: false) + operationTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.refresh() + guard !Task.isCancelled else { return } + self.isRefreshing = false + self.discardUnusedVideos() + self.collectionView.refreshControl?.endRefreshing() + self.applySnapshot(animated: true) + } + } + + @objc private func refreshTapped() { refresh() } + + @objc private func submitTapped() { + if viewModel.video == nil { + chooseVideo(fromFiles: false) + return + } + guard viewModel.canSubmit, !locked else { return } + if viewModel.needsReplacementConfirmation { + let alert = UIAlertController(title: "替换此任务的成片?", message: "保存成功后,游客将看到新视频。保存失败会保留原成片。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "取消", style: .cancel)) + let replace = UIAlertAction(title: "替换成片", style: .destructive) { [weak self] _ in self?.submit(confirmed: true) } + alert.addAction(replace) + present(alert, animated: true) + } else { submit(confirmed: false) } + } + + private func submit(confirmed: Bool) { + guard viewModel.canSubmit, !locked else { return } + pickerError = nil + isStartingSubmission = true + updateFooter() + operationTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.submit(confirmReplacement: confirmed) { [weak self] _ in self?.applySnapshot(animated: false) } + guard !Task.isCancelled else { return } + self.isStartingSubmission = false + self.discardUnusedVideos() + self.applySnapshot(animated: true) + if self.viewModel.successMessage != nil { self.onDidSave?() } + } + } + + private func chooseVideo(fromFiles: Bool) { + guard viewModel.canChooseVideo, !locked else { return } + pickerError = nil + if let videoPicker { + loadPickedVideo { try await videoPicker() } + } else if fromFiles { + let picker = UIDocumentPickerViewController(forOpeningContentTypes: [.movie], asCopy: true) + picker.allowsMultipleSelection = false + picker.delegate = self + present(picker, animated: true) + } else { + var configuration = PHPickerConfiguration(photoLibrary: .shared()) + configuration.filter = .videos + configuration.selectionLimit = 1 + configuration.preferredAssetRepresentationMode = .current + let picker = PHPickerViewController(configuration: configuration) + picker.delegate = self + present(picker, animated: true) + } + } + + private func loadPickedVideo(_ loader: @escaping @MainActor () async throws -> DroneDockDeliveryVideo?) { + isPicking = true + applySnapshot(animated: false) + operationTask = Task { @MainActor [weak self] in + guard let self else { return } + defer { + if !Task.isCancelled { + self.isPicking = false + self.applySnapshot(animated: true) + } + } + do { + if let selected = try await loader() { + guard !Task.isCancelled, self.viewModel.canChooseVideo else { DroneDockDeliveryVideoLoader.discard(selected.url); return } + do { _ = try DroneDockFilmPolicy.validate(video: selected) } + catch { DroneDockDeliveryVideoLoader.discard(selected.url); throw error } + self.viewModel.selectVideo(selected) + if self.viewModel.video?.id == selected.id { + self.ownedVideoURLs.insert(selected.url) + self.discardUnusedVideos() + } else { DroneDockDeliveryVideoLoader.discard(selected.url) } + } + } catch { + if !Task.isCancelled { self.pickerError = error.localizedDescription } + } + guard !Task.isCancelled else { return } + } + } + + private func discardUnusedVideos() { + let unused = ownedVideoURLs.filter { $0 != viewModel.video?.url } + unused.forEach(DroneDockDeliveryVideoLoader.discard) + ownedVideoURLs.subtract(unused) + } + + private func removeVideo() { + guard !locked else { return } + if let video = viewModel.video { DroneDockDeliveryVideoLoader.discard(video.url); ownedVideoURLs.remove(video.url) } + viewModel.removeVideo() + pickerError = nil + applySnapshot(animated: true) + } + + private func previewVideo() { + guard !locked, let video = viewModel.video else { return } + let player = AVPlayerViewController() + player.player = AVPlayer(url: video.url) + present(player, animated: true) { player.player?.play() } + } + + @objc private func backTapped() { + requestExit { [weak self] in self?.navigationController?.popViewController(animated: true) } + } + + @objc private func closeSheetTapped() { + requestExit { [weak self] in + guard let self else { return } + if let onCloseSheet = self.onCloseSheet { onCloseSheet() } + else if (self.navigationController?.viewControllers.count ?? 0) > 1 { self.navigationController?.popViewController(animated: true) } + else { self.dismiss(animated: true) } + } + } + + private func requestExit(_ exit: @escaping () -> Void) { + guard presentedViewController == nil else { return } + guard viewModel.isSubmitting || isStartingSubmission || isPicking else { exit(); return } + let alert = UIAlertController(title: "停止处理并返回?", message: "未完成的上传将停止。如果正在保存成片,返回素材库刷新可核对实际结果。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "继续处理", style: .cancel)) + alert.addAction(UIAlertAction(title: "停止并返回", style: .destructive) { [weak self] _ in + guard let self else { return } + self.operationTask?.cancel() + self.viewModel.invalidate() + exit() + }) + present(alert, animated: true) + } + + private static func text(_ value: String?, fallback: String) -> String { DroneDockHomeMetric.usableText(value) ?? fallback } + private static func flightTitle(_ value: Int?) -> String { + switch value { case 10: "待飞行"; case 20: "执行中"; case 30: "飞行成功"; case 40: "飞行失败"; case 50: "已取消"; case 60: "待确认"; default: "状态待确认" } + } +} + +extension DroneDockDeliveryViewController: UICollectionViewDelegate { + /// 仅显式选择的点位与任务用于上传;切换任务不自动提交文件。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard !locked, let item = dataSource.itemIdentifier(for: indexPath) else { return } + switch item { + case .point(let id): viewModel.selectSpot(id: id) + case .task(let id): viewModel.selectTask(id: id) + default: return + } + discardUnusedVideos() + pickerError = nil + applySnapshot(animated: true) + } +} + +extension DroneDockDeliveryViewController: PHPickerViewControllerDelegate { + /// 相册取消不改变已选视频;选择结果复制完成后才交给上传状态。 + func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { + picker.dismiss(animated: true) + guard let result = results.first else { return } + loadPickedVideo { try await DroneDockDeliveryVideoLoader.load(provider: result.itemProvider) } + } +} + +extension DroneDockDeliveryViewController: UIDocumentPickerDelegate { + /// 文件选择器只接受一段视频,复制到本页临时目录后读取。 + func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { + guard let url = urls.first else { return } + loadPickedVideo { try await DroneDockDeliveryVideoLoader.load(documentURL: url) } + } +} + +/// 订单、任务与错误提示共用的自适应卡片。 +@MainActor +private final class DroneDockDeliveryTextCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 15, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let actionButton = UIButton(type: .system) + private var action: (() -> Void)? + + override init(frame: CGRect) { + super.init(frame: frame) + DroneDockDeliveryDesign.card(to: contentView, cornerRadius: 16) + titleLabel.numberOfLines = 0 + detailLabel.numberOfLines = 0 + let stack = UIStackView(arrangedSubviews: [titleLabel, detailLabel, actionButton]) + stack.axis = .vertical; stack.spacing = 8; stack.alignment = .leading + contentView.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(14) } + titleLabel.snp.makeConstraints { $0.width.equalTo(stack) } + detailLabel.snp.makeConstraints { $0.width.equalTo(stack) } + actionButton.addTarget(self, action: #selector(tapped), for: .touchUpInside) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 重配内容时同步清除旧操作与选中状态。 + func apply(title: String, body: String?, id: String, selected: Bool = false, selectable: Bool = false, + button: String? = nil, actionID: String? = nil, action: (() -> Void)? = nil) { + titleLabel.text = (selectable ? (selected ? "● " : "○ ") : "") + title + detailLabel.text = body + detailLabel.isHidden = body == nil + actionButton.setTitle(button, for: .normal) + actionButton.isHidden = button == nil + actionButton.accessibilityIdentifier = actionID + self.action = action + contentView.layer.borderColor = selected ? DroneDockStyle.primary.cgColor : UIColor.clear.cgColor + contentView.layer.borderWidth = selected ? 1 : 0 + accessibilityIdentifier = id + accessibilityTraits = selected ? [.button, .selected] : selectable ? .button : [] + } + @objc private func tapped() { action?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockDeviceCardView.swift b/suixinkan/UI/DroneDock/DroneDockDeviceCardView.swift new file mode 100644 index 0000000..a0f014c --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockDeviceCardView.swift @@ -0,0 +1,285 @@ +import SnapKit +import UIKit + +/// 设备遥测卡:只展示设备状态,横向浏览不会选择执行拍摄的无人机。 +final class DroneDockDeviceCardView: UIView { + private let nameLabel = DroneDockStyle.label(size: 15, weight: .semibold) + private let statusLabel = DroneDockDeviceStatusView() + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let batteryView = DroneDockBatteryView() + private let signalValue = DroneDockStyle.label(size: 19, weight: .semibold) + private let satelliteValue = DroneDockStyle.label(size: 19, weight: .semibold) + private let temperatureValue = DroneDockStyle.label(size: 22, weight: .semibold) + private let windValue = DroneDockStyle.label(size: 22, weight: .semibold) + private let rainValue = DroneDockStyle.label(size: 22, weight: .semibold) + + /// 创建六项遥测布局。 + override init(frame: CGRect) { + super.init(frame: frame) + DroneDockStyle.applyCard(to: self) + layer.shadowColor = UIColor.black.cgColor + layer.shadowOpacity = 0.045 + layer.shadowRadius = 8 + layer.shadowOffset = CGSize(width: 0, height: 3) + setupUI() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 未知读数由模型提供破折号,不以零代替未知。 + func apply(device: DroneDockDevice) { + detailLabel.isHidden = true + nameLabel.text = device.name + statusLabel.apply(title: device.state.title, tone: device.state.tone) + batteryView.apply(telemetry: device.telemetry) + signalValue.text = device.telemetry.signalText + satelliteValue.text = device.telemetry.satelliteText + temperatureValue.text = device.telemetry.temperatureText + windValue.text = device.telemetry.windText + rainValue.text = device.telemetry.rainText + accessibilityIdentifier = "drone.device.\(device.id)" + accessibilityLabel = "\(device.name),\(device.state.title)" + } + + /// 展示 home 返回的机巢名称、工作状态及格式化读数,不根据展示状态推断起飞许可。 + func apply(airport: DroneDockHomeAirport) { + detailLabel.isHidden = true + nameLabel.text = airport.name + statusLabel.apply(title: airport.statusTitle, tone: airport.statusTone) + batteryView.apply(text: airport.metricText(for: "battery"), progress: airport.batteryProgress) + temperatureValue.text = airport.metricText(for: "env_temp") + windValue.text = airport.metricText(for: "wind_speed") + rainValue.text = airport.metricText(for: "rainfall") + signalValue.text = airport.metricText(for: "signal") + satelliteValue.text = airport.metricText(for: "satellite") + accessibilityIdentifier = "drone.device.\(airport.id)" + accessibilityLabel = "\(airport.name),\(airport.statusTitle)" + } + + /// 没有设备快照时保留完整遥测卡,读数保持未知并展示当前加载结果。 + func applyPlaceholder(status: String, detail: String) { + nameLabel.text = "暂无无人机" + statusLabel.apply(title: status, tone: .gray) + detailLabel.text = detail + detailLabel.isHidden = false + batteryView.apply(telemetry: .unknown) + signalValue.text = "—" + satelliteValue.text = "—" + temperatureValue.text = "—" + windValue.text = "—" + rainValue.text = "—" + accessibilityIdentifier = "drone.device.empty" + accessibilityLabel = "暂无无人机,\(status),\(detail)" + } + + private func setupUI() { + temperatureValue.accessibilityIdentifier = "drone.metric.env_temp" + windValue.accessibilityIdentifier = "drone.metric.wind_speed" + rainValue.accessibilityIdentifier = "drone.metric.rainfall" + signalValue.accessibilityIdentifier = "drone.metric.signal" + satelliteValue.accessibilityIdentifier = "drone.metric.satellite" + detailLabel.isHidden = true + detailLabel.lineBreakMode = .byTruncatingMiddle + [nameLabel, statusLabel, detailLabel, batteryView].forEach(addSubview) + nameLabel.snp.makeConstraints { make in + make.top.leading.equalToSuperview().inset(16) + make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-8) + } + statusLabel.snp.makeConstraints { make in + make.centerY.equalTo(nameLabel) + make.trailing.equalToSuperview().inset(16) + } + detailLabel.snp.makeConstraints { make in + make.top.equalTo(nameLabel.snp.bottom).offset(2) + make.leading.trailing.equalToSuperview().inset(16) + } + batteryView.snp.makeConstraints { make in + make.leading.equalToSuperview().inset(20) + make.top.equalTo(nameLabel.snp.bottom).offset(16) + make.size.equalTo(102) + } + + let signal = telemetryRow(symbol: "antenna.radiowaves.left.and.right", title: "信号状态", value: signalValue) + let satellites = telemetryRow(image: UIImage(named: "drone_telemetry_satellite"), title: "搜星状态", value: satelliteValue) + let radioStack = UIStackView(arrangedSubviews: [signal, satellites]) + radioStack.axis = .vertical + radioStack.distribution = .fillEqually + radioStack.spacing = 12 + addSubview(radioStack) + radioStack.snp.makeConstraints { make in + make.leading.equalTo(batteryView.snp.trailing).offset(20) + make.trailing.equalToSuperview().inset(16) + make.centerY.equalTo(batteryView) + make.height.equalTo(92) + } + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + addSubview(divider) + divider.snp.makeConstraints { make in + make.top.equalTo(batteryView.snp.bottom).offset(15) + make.leading.trailing.equalToSuperview().inset(16) + make.height.equalTo(0.5) + } + let metricColumns = [ + metric(value: temperatureValue, symbol: "thermometer.medium", title: "环境温度"), + metric(value: windValue, symbol: "wind", title: "风速"), + metric(value: rainValue, symbol: "cloud.rain", title: "雨量") + ] + let metrics = UIStackView(arrangedSubviews: metricColumns) + metrics.axis = .horizontal + metrics.distribution = .fillEqually + addSubview(metrics) + metrics.snp.makeConstraints { make in + make.top.equalTo(divider.snp.bottom).offset(13) + make.leading.trailing.equalToSuperview().inset(12) + make.bottom.equalToSuperview().inset(14) + } + for column in metricColumns.dropFirst() { + let separator = UIView() + separator.backgroundColor = DroneDockStyle.border + metrics.addSubview(separator) + separator.snp.makeConstraints { make in + make.leading.equalTo(column.snp.leading) + make.top.bottom.equalToSuperview() + make.width.equalTo(0.5) + } + } + } + + private func telemetryRow(symbol: String, title: String, value: UILabel) -> UIView { + telemetryRow(image: UIImage(systemName: symbol), title: title, value: value) + } + + private func telemetryRow(image: UIImage?, title: String, value: UILabel) -> UIView { + let icon = UIImageView(image: image?.withRenderingMode(.alwaysTemplate)) + icon.tintColor = DroneDockStyle.secondary + icon.contentMode = .scaleAspectFit + let label = DroneDockStyle.label(title, size: 11, color: DroneDockStyle.secondary) + value.adjustsFontSizeToFitWidth = true + value.minimumScaleFactor = 0.7 + value.textAlignment = .right + value.setContentHuggingPriority(.required, for: .horizontal) + let row = UIStackView(arrangedSubviews: [icon, label, value]) + row.spacing = 5 + row.alignment = .center + icon.snp.makeConstraints { make in make.width.equalTo(16); make.height.equalTo(16) } + label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + return row + } + + private func metric(value: UILabel, symbol: String, title: String) -> UIView { + value.textAlignment = .center + value.adjustsFontSizeToFitWidth = true + value.minimumScaleFactor = 0.6 + let icon = UIImageView(image: UIImage(systemName: symbol)) + icon.tintColor = DroneDockStyle.secondary + icon.contentMode = .scaleAspectFit + icon.snp.makeConstraints { make in make.size.equalTo(13) } + let caption = UIStackView(arrangedSubviews: [icon, DroneDockStyle.label(title, size: 11, color: DroneDockStyle.secondary)]) + caption.spacing = 4 + caption.alignment = .center + let column = UIStackView(arrangedSubviews: [value, caption]) + column.axis = .vertical + column.alignment = .center + column.spacing = 5 + return column + } +} + +/// 设备专用状态标签,圆点与文字共用语义颜色,不改变其他业务标签。 +private final class DroneDockDeviceStatusView: UIView { + private let dot = UIView() + private let titleLabel = DroneDockStyle.label(size: 11, weight: .medium) + + override init(frame: CGRect) { + super.init(frame: frame) + layer.cornerRadius = 6 + dot.layer.cornerRadius = 3 + dot.snp.makeConstraints { $0.size.equalTo(6) } + let content = UIStackView(arrangedSubviews: [dot, titleLabel]) + content.axis = .horizontal + content.alignment = .center + content.spacing = 5 + addSubview(content) + content.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 4, left: 7, bottom: 4, right: 7)) } + titleLabel.setContentHuggingPriority(.required, for: .horizontal) + titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 圆点、文字及浅色背景同步更新,复用时不残留上一设备的状态色。 + func apply(title: String, tone: DroneDockStatusTone) { + let color = DroneDockStyle.color(for: tone) + titleLabel.text = title + titleLabel.textColor = color + dot.backgroundColor = color + backgroundColor = color.withAlphaComponent(0.09) + } +} + +/// 环形电量组件,未知电量只显示轨道和占位读数。 +private final class DroneDockBatteryView: UIView { + private let track = CAShapeLayer() + private let progress = CAShapeLayer() + private let valueLabel = DroneDockStyle.label(size: 28, weight: .semibold) + + override init(frame: CGRect) { + super.init(frame: frame) + valueLabel.accessibilityIdentifier = "drone.metric.battery" + for layer in [track, progress] { + layer.fillColor = UIColor.clear.cgColor + layer.lineWidth = 7 + self.layer.addSublayer(layer) + } + track.strokeColor = DroneDockStyle.border.cgColor + progress.strokeColor = DroneDockStyle.primary.cgColor + progress.lineCap = .round + let caption = DroneDockStyle.label("电池电量", size: 11, color: DroneDockStyle.secondary) + let stack = UIStackView(arrangedSubviews: [valueLabel, caption]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 1 + addSubview(stack) + stack.snp.makeConstraints { make in make.center.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func layoutSubviews() { + super.layoutSubviews() + let path = UIBezierPath(arcCenter: CGPoint(x: bounds.midX, y: bounds.midY), radius: min(bounds.width, bounds.height) / 2 - 5, + startAngle: -.pi / 2, endAngle: .pi * 1.5, clockwise: true).cgPath + track.path = path + progress.path = path + } + + func apply(telemetry: DroneDockTelemetry) { + apply(text: telemetry.batteryText, progress: telemetry.batteryProgress) + } + + /// 有效电量才绘制进度;未知值只保留环形轨道与破折号。 + func apply(text: String, progress value: Double?) { + valueLabel.text = text + progress.strokeEnd = value.map { CGFloat(min(1, max(0, $0))) } ?? 0 + accessibilityLabel = "电池电量 \(text)" + isAccessibilityElement = true + } +} + +/// 无人机卡片的集合视图容器。 +final class DroneDockDeviceCell: UICollectionViewCell { + let cardView = DroneDockDeviceCardView() + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.addSubview(cardView) + cardView.snp.makeConstraints { make in make.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } +} diff --git a/suixinkan/UI/DroneDock/DroneDockHomeViewController.swift b/suixinkan/UI/DroneDock/DroneDockHomeViewController.swift new file mode 100644 index 0000000..38666ac --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockHomeViewController.swift @@ -0,0 +1,587 @@ +import SnapKit +import UIKit + +/// 正式机巢首页:朱工提供设备,张工提供订单与今日统计。 +final class DroneDockHomeViewController: GlobalLoadingPageViewController { + /// 与演示数据源隔离的首页状态。 + let viewModel: DroneDockHomeViewModel + private let paymentControllerFactory: (() -> UIViewController)? + private let preparationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? + private let materialsControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? + private let confirmationControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let taskControllerFactory: (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private var refreshTask: Task? + private var loadMoreTask: Task? + private var isRefreshing = false + private var isLoadingOrdersPage = false + private var devicePage = 0 + private let pageControl = UIPageControl() + + /// 首页按当前身份、设备、订单与统计展示服务端快照。 + private enum Section: Int, CaseIterable { case context, devices, orders, statistics } + /// 稳定身份确保刷新使用 Diffable 更新。 + private enum Item: Hashable { case context, devices, device(Int), orders, order(String), moreOrders, statistics } + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + + /// 使用当前登录身份及选择的景区、门店构造正式首页。 + convenience init() { + self.init(viewModel: DroneDockHomeViewModel( + context: Self.currentContext(), + service: DroneDockAPI(client: NetworkServices.shared.apiClient), + currentContext: { Self.currentContext() } + )) + } + + /// 注入可测试的数据源,不加载演示数据。 + init(viewModel: DroneDockHomeViewModel, paymentControllerFactory: (() -> UIViewController)? = nil, + preparationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + materialsControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + confirmationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + taskControllerFactory: ((Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) { + self.viewModel = viewModel + self.paymentControllerFactory = paymentControllerFactory + self.preparationControllerFactory = preparationControllerFactory + self.materialsControllerFactory = materialsControllerFactory + self.confirmationControllerFactory = confirmationControllerFactory ?? DroneDockConfirmationEntry.makeController + self.taskControllerFactory = taskControllerFactory ?? DroneDockShootingTaskEntry.makeController + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { + refreshTask?.cancel() + loadMoreTask?.cancel() + } + + override func setupNavigationBar() { + title = "机巢工作台" + let button = UIBarButtonItem(title: "收款码", image: UIImage(systemName: "qrcode"), + target: self, action: #selector(receiptTapped)) + button.accessibilityIdentifier = "drone.home.receipt" + navigationItem.rightBarButtonItem = button + navigationItem.backButtonDisplayMode = .minimal + } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + collectionView.backgroundColor = .clear + collectionView.alwaysBounceVertical = true + collectionView.accessibilityIdentifier = "drone.home.remote.list" + collectionView.register(DroneDockHomeContentCell.self, forCellWithReuseIdentifier: "content") + collectionView.register(DroneDockDeviceCell.self, forCellWithReuseIdentifier: "device") + collectionView.register(DroneDockCompactOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DroneDockHomeHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: "header") + collectionView.register(DroneDockHomePageFooter.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, + withReuseIdentifier: "pages") + pageControl.currentPageIndicatorTintColor = DroneDockStyle.primary + pageControl.pageIndicatorTintColor = DroneDockStyle.border + pageControl.isUserInteractionEnabled = false + pageControl.accessibilityIdentifier = "drone.home.devicePages" + let refresh = UIRefreshControl() + refresh.tintColor = DroneDockStyle.primary + refresh.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + collectionView.refreshControl = refresh + view.addSubview(collectionView) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.bottom.equalToSuperview() + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + refreshHome() + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + refreshTask?.cancel() + loadMoreTask?.cancel() + isRefreshing = false + isLoadingOrdersPage = false + viewModel.invalidate() + } + + private func refreshHome() { + refreshTask?.cancel() + loadMoreTask?.cancel() + isLoadingOrdersPage = false + isRefreshing = true + setPageLoading(viewModel.response == nil && viewModel.ordersResponse == nil) + refreshTask = Task { @MainActor [weak self] in + guard let self else { return } + let isInitialLoad = self.viewModel.response == nil && self.viewModel.ordersResponse == nil + self.applySnapshot(animated: false) + await self.viewModel.refresh() + guard !Task.isCancelled else { return } + self.isRefreshing = false + self.setPageLoading(false) + self.collectionView.refreshControl?.endRefreshing() + self.applySnapshot(animated: true) { [weak self] in + if isInitialLoad, let self { + self.collectionView.layoutIfNeeded() + self.collectionView.setContentOffset(CGPoint(x: 0, y: -self.collectionView.adjustedContentInset.top), animated: false) + } + #if DEBUG + Task { @MainActor [weak self] in await self?.captureHomeIfRequested() } + #endif + } + } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collection, path, item in + guard let self else { return nil } + if item == .devices { + let cell = collection.dequeueReusableCell(withReuseIdentifier: "device", for: path) as! DroneDockDeviceCell + let error = self.viewModel.deviceErrorMessage ?? self.viewModel.errorMessage + if self.isRefreshing || error == nil && self.viewModel.response == nil { + cell.cardView.applyPlaceholder(status: "正在加载", detail: "正在获取最新数据") + } else if let error { + cell.cardView.applyPlaceholder(status: "设备加载失败", detail: error + ",请下拉重试") + } else { + cell.cardView.applyPlaceholder(status: "暂无数据", detail: "当前景区暂无设备数据") + } + return cell + } + if case .device(let id) = item { + let cell = collection.dequeueReusableCell(withReuseIdentifier: "device", for: path) as! DroneDockDeviceCell + if let airport = self.viewModel.response?.airports.first(where: { $0.id == id }) { + cell.cardView.apply(airport: airport) + } + return cell + } + if case .order(let id) = item { + let cell = collection.dequeueReusableCell(withReuseIdentifier: "order", for: path) as! DroneDockCompactOrderCell + if let order = self.viewModel.orders.first(where: { $0.orderID == id }) { + cell.apply(homeOrder: order) + cell.onShootingTap = { [weak self] in + self?.openPrimaryAction(orderID: id) + } + cell.onMaterialsTap = { [weak self] in self?.openMaterials(orderID: id) } + } + return cell + } + let cell = collection.dequeueReusableCell(withReuseIdentifier: "content", for: path) as! DroneDockHomeContentCell + switch item { + case .context: + let context = self.viewModel.context + let title = [context.scenicName, context.photographerName].filter { !$0.isEmpty }.joined(separator: " · ") + cell.applyContext(title.isEmpty ? "机巢工作台" : title) + case .statistics: + cell.applyStatistics(self.viewModel.today, + error: self.viewModel.statisticsErrorMessage ?? self.viewModel.errorMessage) + case .moreOrders: + cell.applyLoadMore(isLoading: self.isLoadingOrdersPage, + error: self.viewModel.ordersLoadMoreErrorMessage, + enabled: !self.isRefreshing) { [weak self] in self?.loadMoreOrders() } + case .orders: + self.applyOrderState(to: cell) + case .devices, .device, .order: break + } + return cell + } + dataSource.supplementaryViewProvider = { [weak self] collection, kind, path in + guard let self else { return nil } + if kind == UICollectionView.elementKindSectionFooter { + let footer = collection.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "pages", for: path) as! DroneDockHomePageFooter + footer.install(self.pageControl) + return footer + } + let header = collection.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "header", for: path) as! DroneDockHomeHeader + let isOrders = Section(rawValue: path.section) == .orders + let orderTitle = self.viewModel.orderTotal.map { "我的拍摄订单(\($0))" } ?? "我的拍摄订单" + header.onViewAll = isOrders ? { [weak self] in self?.openAllOrders() } : nil + header.apply(title: isOrders ? orderTitle : "今日统计", isOrders: isOrders) + return header + } + } + + private func applyOrderState(to cell: DroneDockHomeContentCell) { + let hasResponse = viewModel.ordersResponse != nil + let error = viewModel.ordersErrorMessage ?? viewModel.errorMessage + if isRefreshing, !hasResponse { + cell.applyMessage(symbol: "arrow.triangle.2.circlepath", title: "正在加载", detail: "正在获取最新数据") + return + } + if let error { + cell.applyMessage(symbol: "wifi.exclamationmark", title: "订单加载失败", + detail: error + ",请下拉重试") + return + } + guard hasResponse else { + cell.applyMessage(symbol: "arrow.triangle.2.circlepath", title: "正在加载", detail: "正在获取最新数据") + return + } + cell.applyMessage(symbol: "doc.text", title: "暂无拍摄订单", detail: "当前景区暂无拍摄订单数据") + } + + private func applySnapshot(animated: Bool, completion: (() -> Void)? = nil) { + guard dataSource != nil else { return } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections(Section.allCases) + snapshot.appendItems([.context], toSection: .context) + let airports = viewModel.response?.airports ?? [] + snapshot.appendItems(airports.isEmpty ? [.devices] : airports.map { .device($0.id) }, toSection: .devices) + let orders = viewModel.orders + snapshot.appendItems(orders.isEmpty ? [.orders] : orders.map { .order($0.orderID) }, toSection: .orders) + if viewModel.hasMoreOrders || viewModel.isLoadingMore || viewModel.ordersLoadMoreErrorMessage != nil { + snapshot.appendItems([.moreOrders], toSection: .orders) + } + snapshot.appendItems([.statistics], toSection: .statistics) + let old = Set(dataSource.snapshot().itemIdentifiers) + let previousDeviceCount = old.filter { if case .device = $0 { return true }; return false }.count + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { old.contains($0) }) + devicePage = min(devicePage, max(0, airports.count - 1)) + pageControl.numberOfPages = airports.count + pageControl.currentPage = devicePage + if previousDeviceCount != airports.count { + collectionView.setCollectionViewLayout(makeLayout(), animated: false) + } + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + if let self { + for path in self.collectionView.indexPathsForVisibleSupplementaryElements(ofKind: UICollectionView.elementKindSectionHeader) { + guard let header = self.collectionView.supplementaryView( + forElementKind: UICollectionView.elementKindSectionHeader, at: path) as? DroneDockHomeHeader else { continue } + let isOrders = Section(rawValue: path.section) == .orders + let title = self.viewModel.orderTotal.map { "我的拍摄订单(\($0))" } ?? "我的拍摄订单" + header.apply(title: isOrders ? title : "今日统计", isOrders: isOrders) + } + } + completion?() + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let section = Section(rawValue: index) else { return nil } + let deviceCount = self?.viewModel.response?.airports.count ?? 0 + let multipleDevices = section == .devices && deviceCount > 1 + let height: NSCollectionLayoutDimension = section == .devices ? .absolute(248) : section == .context ? .estimated(40) : .estimated(132) + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: height)) + let width: NSCollectionLayoutDimension = multipleDevices ? .absolute(environment.container.effectiveContentSize.width - 48) : .fractionalWidth(1) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: width, heightDimension: height), subitems: [item]) + let layout = NSCollectionLayoutSection(group: group) + layout.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: section == .statistics ? 24 : 0, trailing: 16) + if section == .orders { layout.interGroupSpacing = 12 } + if multipleDevices { + layout.interGroupSpacing = 12 + layout.orthogonalScrollingBehavior = .groupPaging + layout.visibleItemsInvalidationHandler = { [weak self] _, offset, _ in + guard let self else { return } + let step = max(1, environment.container.effectiveContentSize.width - 36) + let page = min(deviceCount - 1, max(0, Int((offset.x / step).rounded()))) + self.devicePage = page + self.pageControl.currentPage = page + } + layout.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(24)), + elementKind: UICollectionView.elementKindSectionFooter, alignment: .bottom)] + } + if section == .orders || section == .statistics { + layout.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(54)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)] + } + return layout + } + } + + private func showUnavailable(_ feature: String) { + showAlert(title: feature, message: "该功能暂未开放") + } + + private func openAllOrders() { + let controller = DroneDockOrdersViewController( + viewModel: viewModel.makeOrdersViewModel(), preparationControllerFactory: preparationFactory, + materialsControllerFactory: materialsFactory, confirmationControllerFactory: confirmationControllerFactory, + taskControllerFactory: taskControllerFactory) + navigationController?.pushViewController(controller, animated: true) + } + + /// 首页和全部订单页沿用同一真实拍摄准备入口。 + private var preparationFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController { + preparationControllerFactory ?? { order, context in + DroneDockRemotePreparationViewController(viewModel: DroneDockPreparationViewModel( + context: context, order: order, + service: DroneDockPreparationAPI(client: NetworkServices.shared.apiClient), + planeStatusService: DroneDockPlaneStatusAPI(client: NetworkServices.shared.apiClient), + taskCreationService: DroneDockTaskCreationAPI(client: NetworkServices.shared.apiClient), + shootService: DroneDockShootAPI(client: NetworkServices.shared.apiClient), + currentContext: { Self.currentContext() } + )) + } + } + + /// 首页和全部订单页复用同一真实素材入口,进入页面后才读取摘要和任务。 + private var materialsFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController { + materialsControllerFactory ?? { order, context in + DroneDockMaterialsViewController(viewModel: DroneDockMaterialsViewModel( + context: context, order: order, + service: DroneDockMaterialsAPI(client: NetworkServices.shared.apiClient), + currentContext: { Self.currentContext() } + )) + } + } + + private func openMaterials(orderID: String) { + guard !isRefreshing, let order = viewModel.orders.first(where: { $0.orderID == orderID }) else { return } + guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + showAlert(title: "订单素材库", message: "缺少订单号,请刷新工作台后重试") + return + } + navigationController?.pushViewController(materialsFactory(order, viewModel.context), animated: true) + } + + private func openPrimaryAction(orderID: String) { + guard !isRefreshing, let order = viewModel.orders.first(where: { $0.orderID == orderID }) else { return } + if let taskID = order.activeFlightTaskID { + guard let navigationController, navigationController.topViewController === self, + presentedViewController == nil else { return } + navigationController.pushViewController(taskControllerFactory(taskID, order, viewModel.context), animated: true) + return + } + if order.primaryAction == "confirm_delivery" { + openConfirmation(order: order) + return + } + if order.primaryAction == "view_materials" { + openMaterials(orderID: orderID) + return + } + guard order.primaryAction == "start_shoot" else { + showUnavailable(order.actionTitle ?? "拍摄订单") + return + } + guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + showAlert(title: "拍摄准备", message: "缺少订单号,请刷新工作台后重试") + return + } + let context = viewModel.context + let controller = preparationFactory(order, context) + navigationController?.pushViewController(controller, animated: true) + } + + private func openConfirmation(order: DroneDockHomeOrder) { + guard navigationController?.topViewController === self, presentedViewController == nil, + order.hasCompletedShootingQuota, + order.canConfirm == true || order.orderStatus == 30 || order.confirmStatus == 2 else { return } + guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + showAlert(title: "订单交付确认", message: "缺少订单号,请刷新工作台后重试") + return + } + navigationController?.pushViewController(confirmationControllerFactory(order, viewModel.context), animated: true) + } + + @objc private func receiptTapped() { + let controller = paymentControllerFactory?() ?? DroneDockPaymentViewController() + navigationController?.pushViewController(controller, animated: true) + } + @objc private func refreshTriggered() { refreshHome() } + + /// 按后端分页继续读取订单,失败保留已有列表并允许重试。 + private func loadMoreOrders() { + guard !isRefreshing, !isLoadingOrdersPage, !viewModel.isLoadingMore else { return } + loadMoreTask?.cancel() + isLoadingOrdersPage = true + applySnapshot(animated: false) + loadMoreTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.loadMoreOrders() + guard !Task.isCancelled else { return } + self.isLoadingOrdersPage = false + self.applySnapshot(animated: true) + } + } + + #if DEBUG + /// 显式联调参数下只保存本应用窗口,不截取用户切换后的其他 App。 + private func captureHomeIfRequested() async { + guard ProcessInfo.processInfo.arguments.contains("--dock-home-capture") else { return } + // Diffable 完成回调仍可能处于旧卡片的移除事务内,等下一轮屏幕提交后再取图。 + try? await Task.sleep(nanoseconds: 400_000_000) + guard !Task.isCancelled, !isRefreshing, let window = view.window else { return } + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + do { + let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] + .appendingPathComponent("AirportHomeDiagnostics", isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + try image.pngData()?.write(to: directory.appendingPathComponent("airport-home-real.png"), options: .atomic) + print("[AirportHome] App window screenshot saved") + } catch { print("[AirportHome] Screenshot failed: \(error.localizedDescription)") } + } + #endif + + /// 只从现有会话读取身份,不修改登录状态或当前选择。 + static func currentContext() -> DroneDockHomeContext { + let session = AppStore.shared.session + return DroneDockHomeContext(userID: session.userId, accountType: session.accountType.rawValue, + scenicID: session.currentScenicId, scenicName: session.currentScenicName, + storeID: session.currentStoreId, photographerName: session.userName, token: session.token) + } +} + +/// 多设备横向轮播的页码容器。 +private final class DroneDockHomePageFooter: UICollectionReusableView { + /// 安装首页维护的页码控件,避免复用时重复添加。 + func install(_ control: UIPageControl) { + guard control.superview !== self else { return } + control.removeFromSuperview() + addSubview(control) + control.snp.makeConstraints { make in + make.center.equalToSuperview() + make.height.equalTo(24) + } + } +} + +/// 真实首页的空态、加载状态及统计展示。 +private final class DroneDockHomeContentCell: UICollectionViewCell { + private var embeddedView: UIView? + + /// 展示当前身份与景区。 + func applyContext(_ text: String) { + let label = DroneDockStyle.label(text, size: 12, color: DroneDockStyle.secondary) + label.numberOfLines = 2 + install(label, insets: UIEdgeInsets(top: 6, left: 0, bottom: 12, right: 0), card: false) + } + + /// 展示明确空态或错误,避免将接口失败解释为没有订单。 + func applyMessage(symbol: String, title: String, detail: String) { + let image = UIImageView(image: UIImage(systemName: symbol)) + image.tintColor = DroneDockStyle.secondary.withAlphaComponent(0.6) + image.contentMode = .scaleAspectFit + image.snp.makeConstraints { $0.size.equalTo(28) } + let titleLabel = DroneDockStyle.label(title, size: 14, weight: .medium) + let detailLabel = DroneDockStyle.label(detail, size: 12, color: DroneDockStyle.secondary) + detailLabel.numberOfLines = 0 + detailLabel.textAlignment = .center + let stack = UIStackView(arrangedSubviews: [image, titleLabel, detailLabel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 9 + install(stack, insets: UIEdgeInsets(top: 22, left: 16, bottom: 22, right: 16), card: true) + } + + /// 展示张工 today-stats 的成交与确认完成统计,失败保持未知并提示重试。 + func applyStatistics(_ today: DroneDockHomeToday?, error: String?) { + let formatter = NumberFormatter() + formatter.locale = Locale(identifier: "zh_CN") + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + let amount = today?.orderAmount.flatMap { formatter.string(from: NSDecimalNumber(decimal: $0)) }.map { "¥" + $0 } ?? "—" + let values = [(today?.orderCount.map(String.init) ?? "—", "成交订单"), + (amount, "成交金额"), (today?.finishedShoot.map(String.init) ?? "—", "完成拍摄")] + let columns = values.map { value, title in + let label = DroneDockStyle.label(value, size: 23, weight: .semibold) + label.adjustsFontSizeToFitWidth = true + label.minimumScaleFactor = 0.6 + let stack = UIStackView(arrangedSubviews: [label, DroneDockStyle.label(title, size: 12, color: DroneDockStyle.secondary)]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 9 + return stack + } + let row = UIStackView(arrangedSubviews: columns) + row.distribution = .fillEqually + let stack = UIStackView(arrangedSubviews: [row]) + stack.axis = .vertical + stack.spacing = 12 + if let error { + let message = DroneDockStyle.label("统计加载失败,请下拉重试\n\(error)", size: 12, color: DroneDockStyle.secondary) + message.numberOfLines = 0 + message.textAlignment = .center + stack.addArrangedSubview(message) + } + install(stack, insets: UIEdgeInsets(top: 23, left: 10, bottom: 23, right: 10), card: true) + } + + /// 订单分页入口;提交期间禁用,查询失败不清空之前已加载的订单。 + func applyLoadMore(isLoading: Bool, error: String?, enabled: Bool, action: @escaping () -> Void) { + let button = UIButton(type: .system) + button.setTitle(isLoading ? "加载中…" : error == nil ? "加载更多订单" : "重试加载更多", for: .normal) + button.tintColor = DroneDockStyle.primary + button.isEnabled = enabled && !isLoading + button.accessibilityIdentifier = "drone.home.orders.loadMore" + button.snp.makeConstraints { $0.height.greaterThanOrEqualTo(44) } + button.addAction(UIAction { _ in action() }, for: .touchUpInside) + let stack = UIStackView(arrangedSubviews: [button]) + stack.axis = .vertical + if let error { + let label = DroneDockStyle.label(error, size: 12, color: DroneDockStyle.secondary) + label.numberOfLines = 0 + label.textAlignment = .center + stack.addArrangedSubview(label) + } + install(stack, insets: UIEdgeInsets(top: 4, left: 16, bottom: 8, right: 16), card: false) + } + + private func install(_ view: UIView, insets: UIEdgeInsets, card: Bool) { + embeddedView?.removeFromSuperview() + embeddedView = view + if card { DroneDockStyle.applyCard(to: contentView) } else { contentView.backgroundColor = .clear } + contentView.addSubview(view) + view.snp.makeConstraints { $0.edges.equalToSuperview().inset(insets) } + } +} + +/// 首页分区标题,订单数量使用接口 total,不使用当前页条数。 +private final class DroneDockHomeHeader: UICollectionReusableView { + /// 用户请求打开当前景区的全部真实拍摄订单。 + var onViewAll: (() -> Void)? + private let label = DroneDockStyle.label(size: 17, weight: .semibold) + private let viewAllButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + addSubview(label) + viewAllButton.setTitle("查看全部 ›", for: .normal) + viewAllButton.titleLabel?.font = .systemFont(ofSize: 13) + viewAllButton.tintColor = DroneDockStyle.primary + viewAllButton.accessibilityIdentifier = "drone.home.allOrders" + viewAllButton.addTarget(self, action: #selector(viewAllTapped), for: .touchUpInside) + addSubview(viewAllButton) + viewAllButton.setContentCompressionResistancePriority(.required, for: .horizontal) + label.adjustsFontSizeToFitWidth = true + label.minimumScaleFactor = 0.75 + label.snp.makeConstraints { make in + make.leading.centerY.equalToSuperview() + make.trailing.lessThanOrEqualTo(viewAllButton.snp.leading).offset(-8) + } + viewAllButton.snp.makeConstraints { make in + make.trailing.centerY.equalToSuperview() + make.height.equalTo(44) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 区分订单总数与统计标题,便于读取真实总数。 + func apply(title: String, isOrders: Bool) { + label.text = title + label.accessibilityIdentifier = isOrders ? "drone.home.orderCount" : nil + viewAllButton.isHidden = !isOrders + } + + override func prepareForReuse() { + super.prepareForReuse() + onViewAll = nil + } + + @objc private func viewAllTapped() { onViewAll?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockMaterialComponents.swift b/suixinkan/UI/DroneDock/DroneDockMaterialComponents.swift new file mode 100644 index 0000000..dcf03dd --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockMaterialComponents.swift @@ -0,0 +1,343 @@ +import Kingfisher +import SnapKit +import UIKit + +/// 真实订单素材库摘要:游客与状态同排,次数始终来自订单详情。 +@MainActor +final class DroneDockMaterialOrderCell: UICollectionViewCell { + private let customerLabel = DroneDockStyle.label(size: 19, weight: .semibold) + private let statusLabel = DroneDockStatusLabel() + private let numberLabel = DroneDockStyle.label(size: 13, color: UIColor(hex: 0x70809D)) + private let countLabel = DroneDockStyle.label(size: 13, color: UIColor(hex: 0x5D6C88)) + + override init(frame: CGRect) { + super.init(frame: frame) + let row = UIStackView(arrangedSubviews: [customerLabel, statusLabel, UIView()]) + row.axis = .horizontal + row.spacing = 8 + row.alignment = .center + customerLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + customerLabel.lineBreakMode = .byTruncatingTail + statusLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + numberLabel.numberOfLines = 2 + countLabel.numberOfLines = 2 + let stack = UIStackView(arrangedSubviews: [row, numberLabel, countLabel]) + stack.axis = .vertical + stack.spacing = 9 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in + make.top.equalToSuperview().offset(16) + make.leading.trailing.equalToSuperview() + make.bottom.equalToSuperview().inset(18) + } + accessibilityIdentifier = "drone.materials.remote.order" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 不根据任务数量或素材上传状态推导订单拍摄履约状态。 + func apply(order: DroneDockHomeOrder) { + customerLabel.text = order.touristTitle + statusLabel.apply(title: order.statusTitle, tone: order.statusTone) + numberLabel.text = order.orderNumberText + let total = order.shotTotal.map(String.init) ?? "—" + let used = order.shotUsed.map(String.init) ?? "—" + let remain = order.shotRemain.map(String.init) ?? "—" + countLabel.text = "含\(total)次拍摄 · 已拍摄\(used)次 · 剩余\(remain)次" + accessibilityLabel = [order.touristTitle, order.statusTitle, order.orderNumberText, countLabel.text].compactMap { $0 }.joined(separator: ",") + } +} + +/// 素材记录标题:点位和交付按钮同排,航线、时间、记录序号位于次行。 +@MainActor +final class DroneDockMaterialRecordCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 17, weight: .semibold) + private let metadataLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let deliveryButton = UIButton(type: .system) + private let emptyIcon = UIImageView() + private let emptyTitle = DroneDockStyle.label(size: 13, weight: .medium) + private let emptyDetail = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let emptyPanel = UIStackView() + private let separator = UIView() + private var action: (() -> Void)? + + override init(frame: CGRect) { + super.init(frame: frame) + titleLabel.numberOfLines = 1 + titleLabel.lineBreakMode = .byTruncatingTail + titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + deliveryButton.setContentCompressionResistancePriority(.required, for: .horizontal) + deliveryButton.tintColor = DroneDockStyle.primary + deliveryButton.addTarget(self, action: #selector(deliveryTapped), for: .touchUpInside) + let titleRow = UIStackView(arrangedSubviews: [titleLabel, UIView(), deliveryButton]) + titleRow.axis = .horizontal + titleRow.alignment = .center + titleRow.spacing = 8 + metadataLabel.numberOfLines = 2 + emptyIcon.contentMode = .scaleAspectFit + emptyTitle.numberOfLines = 2 + emptyDetail.numberOfLines = 0 + emptyPanel.axis = .vertical + emptyPanel.alignment = .leading + emptyPanel.spacing = 6 + let emptyHeading = UIStackView(arrangedSubviews: [emptyIcon, emptyTitle]) + emptyHeading.axis = .horizontal + emptyHeading.alignment = .center + emptyHeading.spacing = 6 + emptyIcon.snp.makeConstraints { $0.size.equalTo(16).priority(999) } + emptyPanel.addArrangedSubview(emptyHeading) + emptyPanel.addArrangedSubview(emptyDetail) + let stack = UIStackView(arrangedSubviews: [titleRow, metadataLabel, emptyPanel]) + stack.axis = .vertical + stack.spacing = 7 + stack.setCustomSpacing(14, after: metadataLabel) + contentView.addSubview(stack) + stack.snp.makeConstraints { make in + make.top.equalToSuperview().offset(14) + make.leading.trailing.equalToSuperview() + make.bottom.equalToSuperview().inset(14) + } + deliveryButton.snp.makeConstraints { $0.height.equalTo(44) } + separator.backgroundColor = DroneDockStyle.border + contentView.addSubview(separator) + separator.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview(); make.height.equalTo(0.5) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 保留无素材任务的独立飞行与上传状态,不伪造文件或上传进度。 + func apply(task: DroneDockMaterialTask, canDeliver: Bool, action: @escaping () -> Void) { + titleLabel.text = usable(task.spotName, fallback: "点位 \(task.spotID)") + let record = task.sequence.map { String(format: "记录%02d", $0) } ?? "记录序号待确认" + metadataLabel.text = "\(usable(task.airLineName, fallback: "航线待确认")) · \(shortDate(task.createdAt)) · \(record)" + var configuration = UIButton.Configuration.plain() + configuration.title = "交付成片" + configuration.image = UIImage(systemName: "play.rectangle") + configuration.imagePadding = 5 + configuration.contentInsets = .zero + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 13) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { value in + var attributes = value + attributes.font = .systemFont(ofSize: 12) + return attributes + } + deliveryButton.configuration = configuration + deliveryButton.isHidden = !canDeliver + deliveryButton.accessibilityIdentifier = "drone.materials.remote.delivery.\(task.id)" + self.action = action + emptyPanel.isHidden = !task.materials.isEmpty + separator.isHidden = !task.materials.isEmpty + let state: (String, String, String, UIColor) = switch task.materialStatus { + case 0: ("素材待上传", "拍摄完成后将自动上传,请稍后刷新", "icloud.and.arrow.up", DroneDockStyle.secondary) + case 1: ("暂无可用原素材", "素材记录尚未返回,请刷新查看", "photo.on.rectangle", DroneDockStyle.secondary) + case 2: ("素材上传中", "素材正在上传,请稍后刷新查看", "icloud.and.arrow.up", DroneDockStyle.primary) + case 3: ("素材上传失败", "请刷新查看最新状态,或联系工作人员", "xmark.circle", DroneDockStyle.color(for: .red)) + default: ("素材状态待确认", "暂无原素材,请稍后刷新查看", "questionmark.circle", DroneDockStyle.secondary) + } + emptyTitle.text = state.0 + emptyTitle.textColor = state.3 + emptyIcon.image = UIImage(systemName: state.2) + emptyIcon.tintColor = state.3 + emptyDetail.text = "\(flightTitle(task.flightStatus))\n\(state.1)" + accessibilityIdentifier = "drone.materials.remote.task.\(task.id)" + } + + private func usable(_ value: String?, fallback: String) -> String { DroneDockHomeMetric.usableText(value) ?? fallback } + private func shortDate(_ raw: String?) -> String { + guard let raw = DroneDockHomeMetric.usableText(raw) else { return "时间待确认" } + let formatter = DateFormatter() + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + guard let date = formatter.date(from: raw) else { return raw } + formatter.dateFormat = "MM-dd HH:mm" + return formatter.string(from: date) + } + private func flightTitle(_ value: Int?) -> String { + switch value { + case 10: "待飞行" + case 20: "执行中" + case 30: "飞行成功" + case 40: "飞行失败" + case 50: "已取消" + case 60: "待确认" + default: "飞行状态待确认" + } + } + @objc private func deliveryTapped() { action?() } +} + +/// 真实文件的缩略图、状态和选择控件;预览与选择使用独立点击区域。 +@MainActor +final class DroneDockMaterialMediaCell: UICollectionViewCell { + private let thumbnail = UIImageView() + private let icon = UIImageView() + private let previewButton = UIButton(type: .custom) + private let selectionButton = UIButton(type: .custom) + private let videoBadge = DroneDockStyle.label("视频", size: 10, color: .white) + private let titleLabel = DroneDockStyle.label(size: 13, weight: .medium) + private let stateLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let retryLabel = DroneDockStyle.label("重试上传", size: 11, color: DroneDockStyle.primary.withAlphaComponent(0.5)) + private var previewAction: (() -> Void)? + private var selectionAction: (() -> Void)? + + override init(frame: CGRect) { + super.init(frame: frame) + thumbnail.contentMode = .scaleAspectFill + thumbnail.clipsToBounds = true + thumbnail.layer.cornerRadius = 6 + thumbnail.layer.borderWidth = 2 + thumbnail.backgroundColor = UIColor(hex: 0xE9EDF5) + thumbnail.accessibilityIdentifier = "drone.materials.remote.thumbnail" + icon.contentMode = .scaleAspectFit + titleLabel.lineBreakMode = .byTruncatingMiddle + titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + retryLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + retryLabel.accessibilityTraits = [.button, .notEnabled] + retryLabel.accessibilityHint = "当前接口不支持重试上传,可通过页面刷新查看最新状态" + videoBadge.textAlignment = .center + videoBadge.backgroundColor = UIColor.black.withAlphaComponent(0.48) + videoBadge.layer.cornerRadius = 3 + videoBadge.clipsToBounds = true + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + selectionButton.addTarget(self, action: #selector(selectionTapped), for: .touchUpInside) + selectionButton.contentHorizontalAlignment = .right + selectionButton.contentVerticalAlignment = .top + let nameRow = UIStackView(arrangedSubviews: [titleLabel, retryLabel]) + nameRow.axis = .horizontal + nameRow.spacing = 4 + nameRow.alignment = .center + [thumbnail, icon, previewButton, videoBadge, selectionButton, nameRow, stateLabel].forEach(contentView.addSubview) + thumbnail.snp.makeConstraints { make in make.top.leading.trailing.equalToSuperview(); make.height.equalTo(thumbnail.snp.width).multipliedBy(9.0 / 16.0) } + icon.snp.makeConstraints { make in make.center.equalTo(thumbnail); make.size.equalTo(28) } + previewButton.snp.makeConstraints { $0.edges.equalTo(thumbnail) } + selectionButton.snp.makeConstraints { make in make.top.trailing.equalTo(thumbnail).inset(6); make.size.equalTo(44) } + videoBadge.snp.makeConstraints { make in make.leading.bottom.equalTo(thumbnail).inset(6); make.size.equalTo(CGSize(width: 32, height: 18)) } + nameRow.snp.makeConstraints { make in make.top.equalTo(thumbnail.snp.bottom).offset(7); make.leading.trailing.equalToSuperview() } + stateLabel.snp.makeConstraints { make in make.top.equalTo(nameRow.snp.bottom).offset(4); make.leading.trailing.equalToSuperview(); make.bottom.lessThanOrEqualToSuperview().inset(5) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + super.prepareForReuse() + thumbnail.kf.cancelDownloadTask() + thumbnail.image = nil + previewAction = nil + selectionAction = nil + } + + /// 原素材上传就绪且 URL 有效才可勾选;Mock 图片存在时不请求远程缩略图。 + func apply(file: DroneDockMaterialFile, taskID: Int, selected: Bool, selectionEnabled: Bool, + localImage: UIImage?, allowsRemoteImage: Bool, preview: @escaping () -> Void, select: @escaping () -> Void) { + let ready = file.previewURL != nil + let state: (String, UIColor) = switch file.uploadStatus { + case 0: ("待上传", DroneDockStyle.secondary) + case 1: (ready ? "上传完成 · 可下载" : "暂不可预览", ready ? DroneDockStyle.success : DroneDockStyle.secondary) + case 2: ("上传中", DroneDockStyle.primary) + case 3: ("上传失败", DroneDockStyle.color(for: .red)) + default: ("素材状态待确认", DroneDockStyle.secondary) + } + let title = DroneDockHomeMetric.usableText(file.fileName) ?? "原素材 \(file.id)" + apply(title: title, state: state.0, color: state.1, cover: ready ? file.coverURL : nil, + fallback: ready && file.fileType == 1 ? file.previewURL : nil, video: file.fileType == 2, + enabled: ready, failed: file.uploadStatus == 3, localImage: ready ? localImage : nil, + allowsRemoteImage: allowsRemoteImage, identifier: "drone.materials.remote.file.\(taskID).\(file.id)") + previewAction = preview + selectionAction = select + selectionButton.isHidden = !ready + selectionButton.isEnabled = ready && selectionEnabled + selectionButton.accessibilityIdentifier = "drone.materials.remote.select.\(taskID).\(file.id)" + selectionButton.accessibilityLabel = "选择\(title)" + selectionButton.accessibilityTraits = selected ? [.button, .selected] : .button + selectionButton.setImage(MaterialSelectionIcon.orderImage(selected: selected, size: 22, + tint: MaterialSelectionIcon.primary, + includesBackground: true), for: .normal) + thumbnail.layer.borderColor = selected ? DroneDockStyle.primary.cgColor : UIColor.clear.cgColor + previewButton.accessibilityHint = file.uploadStatus == 3 ? DroneDockHomeMetric.usableText(file.failureReason) : nil + } + + private func apply(title: String, state: String, color: UIColor, cover: String?, fallback: URL?, video: Bool, + enabled: Bool, failed: Bool, localImage: UIImage?, allowsRemoteImage: Bool, identifier: String) { + thumbnail.kf.cancelDownloadTask() + thumbnail.image = localImage + let coverURL = cover.flatMap(URL.init(string:)).flatMap { url in + ["http", "https"].contains(url.scheme?.lowercased() ?? "") && url.host != nil ? url : nil + } + if allowsRemoteImage, enabled { thumbnail.kf.setImage(with: coverURL ?? fallback) } + icon.image = UIImage(systemName: failed ? "xmark.circle" : video ? "play.fill" : "photo") + icon.tintColor = failed ? DroneDockStyle.color(for: .red) : UIColor(hex: 0x9CA6B6) + icon.isHidden = enabled && (localImage != nil || coverURL != nil || fallback != nil) + titleLabel.text = title + stateLabel.text = state + stateLabel.textColor = color + retryLabel.isHidden = !failed + retryLabel.accessibilityIdentifier = identifier + ".retryUpload" + videoBadge.isHidden = !video || !enabled + previewButton.isEnabled = enabled + previewButton.accessibilityIdentifier = identifier + ".preview" + previewButton.accessibilityLabel = "\(title),\(state)" + accessibilityIdentifier = identifier + accessibilityLabel = "\(title),\(state)" + accessibilityTraits = enabled ? .button : [.notEnabled] + } + + @objc private func previewTapped() { previewAction?() } + @objc private func selectionTapped() { selectionAction?() } +} + +/// 居中展示列表加载、空态和错误;刷新失败与没有素材是不同状态。 +@MainActor +final class DroneDockMaterialMessageCell: UICollectionViewCell { + private let icon = UIImageView() + private let titleLabel = DroneDockStyle.label(size: 16, weight: .medium) + private let detailLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let button = UIButton(type: .system) + private let spinner = UIActivityIndicatorView(style: .medium) + private var action: (() -> Void)? + + override init(frame: CGRect) { + super.init(frame: frame) + icon.contentMode = .scaleAspectFit + icon.tintColor = DroneDockStyle.secondary + titleLabel.textAlignment = .center + titleLabel.numberOfLines = 2 + detailLabel.textAlignment = .center + detailLabel.numberOfLines = 0 + button.tintColor = DroneDockStyle.primary + button.addTarget(self, action: #selector(retryTapped), for: .touchUpInside) + let stack = UIStackView(arrangedSubviews: [icon, spinner, titleLabel, detailLabel, button]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 12 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.centerY.equalToSuperview(); make.leading.trailing.equalToSuperview().inset(12) } + icon.snp.makeConstraints { $0.size.equalTo(38).priority(999) } + button.snp.makeConstraints { $0.height.equalTo(44).priority(999) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 不将错误转换为空列表,未提供重试闭包时隐藏操作。 + func apply(title: String, detail: String, identifier: String, loading: Bool = false, + error: Bool = false, retry: (() -> Void)? = nil) { + titleLabel.text = title + detailLabel.text = detail + detailLabel.isHidden = detail.isEmpty + icon.image = UIImage(systemName: error ? "exclamationmark.circle" : "photo.on.rectangle.angled") + icon.isHidden = loading + if loading { spinner.startAnimating() } else { spinner.stopAnimating() } + spinner.isHidden = !loading + spinner.alpha = loading ? 1 : 0 + button.isHidden = retry == nil + button.setTitle("重试", for: .normal) + button.accessibilityIdentifier = "drone.materials.remote.retry" + action = retry + accessibilityIdentifier = identifier + } + + @objc private func retryTapped() { action?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockMaterialsSimulation.swift b/suixinkan/UI/DroneDock/DroneDockMaterialsSimulation.swift new file mode 100644 index 0000000..cb9e63d --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockMaterialsSimulation.swift @@ -0,0 +1,277 @@ +import SnapKit +import UIKit + +#if DEBUG +/// 使用正式订单素材页和内存服务验证各展示状态,不读取登录身份或连接后端。 +@MainActor +enum DroneDockMaterialsSimulation { + /// 支持显式场景参数,未传场景的模拟入口默认展示混合上传状态。 + static func makeController(arguments: [String]) -> UIViewController? { + let flag = "--dock-materials-mock" + guard arguments.contains(flag) || arguments.contains(where: { $0.hasPrefix(flag + "=") }) else { return nil } + let value = arguments.first(where: { $0.hasPrefix(flag + "=") }).map { String($0.dropFirst(flag.count + 1)) } + let localFlag = "--dock-materials-download-local=" + let localValue = arguments.first(where: { $0.hasPrefix(localFlag) }).map { String($0.dropFirst(localFlag.count)) } + let localBaseURL = value == "ready" ? localValue.flatMap(loopbackBaseURL) : nil + return makeController(scenario: value ?? "mixed", localBaseURL: localBaseURL) + } + + /// 创建全新模拟会话;同一页的点位筛选、选择及刷新仍由正式 ViewModel 执行。 + static func makeController(scenario: String) -> UIViewController? { + makeController(scenario: scenario, localBaseURL: nil) + } + + private static func makeController(scenario: String, localBaseURL: URL?) -> UIViewController? { + let state = DroneDockMaterialsMockScenario(rawValue: scenario) ?? .mixed + guard let service = try? DroneDockMaterialsMockService(scenario: state, localBaseURL: localBaseURL) else { return nil } + let context = DroneDockHomeContext(userID: "local-materials-mock", accountType: "store_user", + scenicID: 901, scenicName: "本地模拟景区", storeID: 901, + photographerName: "本地演示", token: "local-materials-only") + let model = DroneDockMaterialsViewModel(context: context, order: service.order, + service: service, currentContext: { context }) + let downloadService: ScenicMaterialDownloadService + if localBaseURL != nil { + downloadService = ScenicMaterialDownloadService() + } else { + downloadService = ScenicMaterialDownloadService( + downloader: DroneDockMaterialsMockDownloader(), photoSaver: DroneDockMaterialsMockPhotoSaver()) + } + let downloadModel = DroneDockMaterialDownloadViewModel(service: downloadService, + isContextValid: { [weak model] in model?.acceptsDownloadContext() == true }) + let controller = DroneDockMaterialsViewController(viewModel: model, + deliveryControllerFactory: { _, _, _ in + DroneDockMaterialsMockPreviewController(title: "交付成片 · 本地演示", image: nil, + message: "本地演示仅验证入口,不连接云端或上传文件。") + }, + thumbnailProvider: { taskID, fileID in + guard service.isReady(taskID: taskID, fileID: fileID) else { return nil } + return UIImage(named: taskID == 902 ? "drone_demo_pagoda" : fileID.isMultiple(of: 2) ? "drone_demo_mountain" : "drone_demo_tourists") + }, + mediaPreviewControllerFactory: { _, isVideo, title in + DroneDockMaterialsMockPreviewController(title: title, image: UIImage(named: "drone_demo_tourists"), + message: isVideo ? "本地演示视频封面,不请求远程片源。" : "本地演示图片,不请求远程文件。") + }, + downloadViewModel: downloadModel, + downloadSourceDescription: localBaseURL == nil ? "本地演示 · 未下载或保存真实文件" : "本地测试素材 · 保存至系统相册", + downloadIsSimulated: localBaseURL == nil) + controller.navigationItem.prompt = localBaseURL == nil ? "本地演示 · 未联网" : "本地测试素材 · 无业务请求" + return controller + } + + /// 本地保存验证只接受显式 IPv4 回环地址与端口,路径和文件名由代码固定。 + private static func loopbackBaseURL(_ value: String) -> URL? { + guard let parts = URLComponents(string: value), parts.scheme == "http", parts.host == "127.0.0.1", + let port = parts.port, (1...65_535).contains(port), + parts.user == nil, parts.password == nil, parts.query == nil, parts.fragment == nil, + parts.path.isEmpty || parts.path == "/" else { return nil } + var canonical = URLComponents() + canonical.scheme = "http" + canonical.host = "127.0.0.1" + canonical.port = port + return canonical.url + } +} + +/// 上传、记录及首屏异常的固定样例,不表示实际接口或设备状态。 +private enum DroneDockMaterialsMockScenario: String { + case ready, uploading, uploadFailed, mixed, empty, loading, error, taskUploading, taskFailed, film +} + +/// 通过正式解码器构造的纯内存素材服务,没有真实网络或共享账号依赖。 +@MainActor +private final class DroneDockMaterialsMockService: DroneDockMaterialsServing { + private let scenario: DroneDockMaterialsMockScenario + private let detailValue: DroneDockMaterialDetail + private let taskValues: [[String: Any]] + + /// 合成订单用于正式页面的入口身份,不可用于真实请求。 + var order: DroneDockHomeOrder { detailValue.order } + + /// 固定三条拍摄记录与两处购买点位,文件状态由场景决定。 + init(scenario: DroneDockMaterialsMockScenario, localBaseURL: URL? = nil) throws { + self.scenario = scenario + let detail: [String: Any] = [ + "order_number": "LOCAL-MOCK-MATERIALS-901", "project_id": 901, + "project_name": "模拟航拍套餐", "user_phone": "158****8888", + "shoot_count": 5, "shot_count": scenario == .empty ? 0 : 3, + "remaining_count": scenario == .empty ? 5 : 2, "shoot_status": "processing", + "order_status": 20, "can_upload_film": true, "can_create_task": true, + "spot": [["scenic_spot_id": 301, "scenic_spot_name": "三皇寨"], + ["scenic_spot_id": 302, "scenic_spot_name": "金阙云宫"]] + ] + detailValue = try JSONDecoder().decode(DroneDockMaterialDetail.self, + from: JSONSerialization.data(withJSONObject: detail)) + taskValues = scenario == .empty ? [] : [3, 2, 1].map { sequence in + let taskID = 900 + sequence + let isPagoda = sequence == 2 + let files: [[String: Any]] = [sequence * 2 - 1, sequence * 2].map { fileID in + let status = Self.uploadStatus(scenario: scenario, sequence: sequence, fileID: fileID) + let fileURL = localBaseURL?.appendingPathComponent(fileID.isMultiple(of: 2) ? "demo.jpg" : "demo.mp4").absoluteString + ?? "https://mock.invalid/media/\(taskID)/\(fileID)" + return ["id": fileID, "file_name": String(format: "素材%02d", fileID), + "file_type": fileID.isMultiple(of: 2) ? 1 : 2, + "file_size": 4_194_304, + "file_url": status == 1 ? fileURL : "", + "cover_url": "", "upload_status": status, + "failure_reason": status == 3 ? "本地演示:素材上传失败,请刷新查看最新状态" : ""] + } + let taskOnly = scenario == .taskUploading || scenario == .taskFailed + var task: [String: Any] = [ + "id": taskID, "order_number": "LOCAL-MOCK-MATERIALS-901", "seq": sequence, + "scenic_spot_id": isPagoda ? 302 : 301, + "scenic_spot_name": isPagoda ? "金阙云宫" : "三皇寨", + "air_line_name": isPagoda ? "云宫环绕" : "经典航线", + "created_at": "2026-10-29 \(sequence == 3 ? "14:32:00" : sequence == 2 ? "14:10:00" : "13:45:00")", + "flight_status": 30, + "material_status": scenario == .taskFailed || scenario == .uploadFailed ? 3 : scenario == .ready || scenario == .film ? 1 : 2, + "materials": taskOnly ? [] : files, "film": NSNull() + ] + if scenario == .film, sequence == 3 { + task["film"] = ["id": 8001, "task_id": taskID, "file_name": "已交付成片", + "file_size": 8_388_608, "cover_url": "", + "file_url": "https://mock.invalid/film/\(taskID)"] + } + return task + } + } + + /// 纯内存详情;加载场景等待取消,错误场景提供明确失败。 + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + try validate(scenicID: scenicID, orderNumber: orderNumber) + if scenario == .loading { + while true { try await Task.sleep(nanoseconds: 30_000_000_000) } + } + if scenario == .error { throw APIError.networkFailed("本地演示:订单素材读取失败,请稍后重试") } + try Task.checkCancellation() + return detailValue + } + + /// 根据所选点位过滤内存任务,不发出 HTTP 请求。 + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + try validate(scenicID: scenicID, orderNumber: orderNumber) + try Task.checkCancellation() + let values = taskValues.filter { spotID == nil || ($0["scenic_spot_id"] as? Int) == spotID } + return try JSONDecoder().decode(DroneDockMaterialTasks.self, from: JSONSerialization.data(withJSONObject: [ + "order_number": orderNumber, "total": values.count, "list": values + ])) + } + + /// 仅就绪样例使用本地缩略图,上传中和失败仍保留页面占位样式。 + func isReady(taskID: Int, fileID: Int) -> Bool { + guard let task = taskValues.first(where: { $0["id"] as? Int == taskID }), + let files = task["materials"] as? [[String: Any]], + let file = files.first(where: { $0["id"] as? Int == fileID }) else { return false } + return file["upload_status"] as? Int == 1 + } + + private func validate(scenicID: Int, orderNumber: String) throws { + guard scenicID == 901, orderNumber == "LOCAL-MOCK-MATERIALS-901" else { + throw APIError.networkFailed("本地素材演示不接受真实订单身份") + } + } + + private static func uploadStatus(scenario: DroneDockMaterialsMockScenario, sequence: Int, fileID: Int) -> Int { + switch scenario { + case .uploading, .taskUploading: return 2 + case .uploadFailed, .taskFailed: return 3 + case .mixed: + if sequence == 3, fileID.isMultiple(of: 2) { return 2 } + if sequence == 2, !fileID.isMultiple(of: 2) { return 3 } + return 1 + default: return 1 + } + } +} + +/// 为纯本地演示复制 App 内的测试媒体,不访问网络,也不会将请求转发给真实下载器。 +private struct DroneDockMaterialsMockDownloader: CloudFileDownloading { + private let videoURL: URL? + private let imageData: Data? + + /// 在主线程读取 UIKit 图片资源,后续下载仅复制固定文件或数据。 + @MainActor + init() { + videoURL = Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock") + imageData = UIImage(named: "drone_demo_tourists")?.jpegData(compressionQuality: 0.8) + } + + /// 模拟约 0.3 秒的传输进度,返回独立临时文件供正式服务清理。 + func downloadFile(remoteURL: String, fileName: String, + onProgress: @escaping @Sendable (Int) -> Void) async throws -> URL { + guard let url = URL(string: remoteURL), url.scheme == "https", url.host == "mock.invalid", + url.pathComponents.count == 4, url.pathComponents[1] == "media", + let identifier = Int(url.lastPathComponent) else { throw ScenicMaterialDownloadError.invalidURL } + for percent in [30, 60, 100] { + try await Task.sleep(nanoseconds: 100_000_000) + onProgress(percent) + } + try Task.checkCancellation() + let isImage = identifier.isMultiple(of: 2) + let destination = FileManager.default.temporaryDirectory + .appendingPathComponent("dock-materials-demo-\(UUID().uuidString).\(isImage ? "jpg" : "mp4")") + if isImage { + guard let imageData else { throw CloudTransferError.localFileMissing } + try imageData.write(to: destination) + } else { + guard let videoURL else { throw CloudTransferError.localFileMissing } + try FileManager.default.copyItem(at: videoURL, to: destination) + } + return destination + } +} + +/// 纯本地演示的保存替身,不请求 Photos 权限、不创建相册资产。 +private struct DroneDockMaterialsMockPhotoSaver: CloudPhotoSaving { + /// 仅检查演示文件存在;界面明确标为模拟完成,不表示系统相册保存成功。 + func saveToPhotoLibrary(fileURL: URL, fileType: Int) async throws { + try Task.checkCancellation() + guard FileManager.default.fileExists(atPath: fileURL.path) else { throw CloudTransferError.localFileMissing } + } +} + +/// 图片预览及交付入口的本地占位,不使用播放器、云端上传或相册权限。 +@MainActor +private final class DroneDockMaterialsMockPreviewController: BaseViewController { + private let image: UIImage? + private let message: String + private let imageView = UIImageView() + private let messageLabel = UILabel() + + /// 固定当前演示内容,防止跳入真实媒体或上传服务。 + init(title: String, image: UIImage?, message: String) { + self.image = image + self.message = message + super.init(nibName: nil, bundle: nil) + self.title = title + navigationItem.prompt = "本地演示 · 未联网" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupUI() { + view.backgroundColor = .systemBackground + imageView.image = image + imageView.contentMode = .scaleAspectFit + messageLabel.text = message + messageLabel.numberOfLines = 0 + messageLabel.font = .systemFont(ofSize: 14) + messageLabel.textAlignment = .center + view.addSubview(imageView) + view.addSubview(messageLabel) + } + + override func setupConstraints() { + imageView.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(16) + make.top.equalTo(view.safeAreaLayoutGuide).offset(24) + make.height.equalTo(view).multipliedBy(0.5) + } + messageLabel.snp.makeConstraints { make in + make.top.equalTo(imageView.snp.bottom).offset(16) + make.leading.trailing.equalTo(imageView) + } + } +} +#endif diff --git a/suixinkan/UI/DroneDock/DroneDockMaterialsViewController.swift b/suixinkan/UI/DroneDock/DroneDockMaterialsViewController.swift new file mode 100644 index 0000000..73139ff --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockMaterialsViewController.swift @@ -0,0 +1,486 @@ +import AVKit +import Kingfisher +import SnapKit +import UIKit + +/// 展示订单任务的原素材并提供成片交付入口,已交付成片由交付确认页展示。 +@MainActor +final class DroneDockMaterialsViewController: BaseViewController { + /// 保存当前订单摘要、点位和任务的真实状态。 + let viewModel: DroneDockMaterialsViewModel + /// 当前页面的前台下载批次;成功保存后才计入完成数量。 + let downloadViewModel: DroneDockMaterialDownloadViewModel + private let thumbnailProvider: ((Int, Int) -> UIImage?)? + private let mediaPreviewControllerFactory: ((URL, Bool, String) -> UIViewController)? + private let footerView = DroneMaterialsFooterView() + private let deliveryControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController + private let downloadSourceDescription: String? + private let downloadIsSimulated: Bool + + /// 元数据与媒体分区独立,任务没有素材时也保留其状态。 + private enum Section: Hashable { case order, filters, summary, task(Int), media(Int), message } + /// 素材 ID 只在所属任务内唯一,使用任务 ID 共同构成稳定身份。 + private enum Item: Hashable { + case order, filter(Int?), summary, task(Int), file(Int, Int), message + } + /// 整页刷新更新两个接口;筛选及列表重试只读取任务。 + private enum LoadAction { case refresh, filter(Int?), retry } + + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private var loadTask: Task? + private var operation: LoadAction? + private var hasAppeared = false + private var refreshAfterDelivery = false + private var lastDownloadPhase = DroneDockMaterialDownloadViewModel.Phase.idle + private var hasPresentedPhotoPermission = false + private var selectionLocked: Bool { downloadViewModel.phase != .idle } + + /// 注入冻结订单范围的只读素材服务。 + init(viewModel: DroneDockMaterialsViewModel, + deliveryControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil, + thumbnailProvider: ((Int, Int) -> UIImage?)? = nil, + mediaPreviewControllerFactory: ((URL, Bool, String) -> UIViewController)? = nil, + downloadViewModel: DroneDockMaterialDownloadViewModel? = nil, + downloadSourceDescription: String? = nil, + downloadIsSimulated: Bool = false) { + self.viewModel = viewModel + self.downloadViewModel = downloadViewModel ?? DroneDockMaterialDownloadViewModel( + isContextValid: { [weak viewModel] in viewModel?.acceptsDownloadContext() == true }) + self.downloadSourceDescription = downloadSourceDescription + self.downloadIsSimulated = downloadIsSimulated + self.thumbnailProvider = thumbnailProvider + self.mediaPreviewControllerFactory = mediaPreviewControllerFactory + self.deliveryControllerFactory = deliveryControllerFactory ?? DroneDockDeliveryEntry.makeController + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { loadTask?.cancel() } + + override func setupNavigationBar() { + title = "订单素材库" + navigationItem.backButtonDisplayMode = .minimal + let refresh = UIBarButtonItem(image: UIImage(systemName: "arrow.clockwise"), style: .plain, target: self, action: #selector(refreshTapped)) + refresh.accessibilityLabel = "刷新素材状态" + refresh.accessibilityIdentifier = "drone.materials.remote.refresh" + navigationItem.rightBarButtonItems = [refresh] + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = false + collectionView.accessibilityIdentifier = "drone.materials.remote.list" + collectionView.delegate = self + collectionView.register(DroneDockMaterialOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DroneMaterialSelectionCell.self, forCellWithReuseIdentifier: "summary") + collectionView.register(DroneDockMaterialRecordCell.self, forCellWithReuseIdentifier: "record") + collectionView.register(DroneDockMaterialMessageCell.self, forCellWithReuseIdentifier: "message") + collectionView.register(DroneMaterialSeparatorView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, + withReuseIdentifier: "separator") + collectionView.register(DroneMaterialFilterCell.self, forCellWithReuseIdentifier: "filter") + collectionView.register(DroneDockMaterialMediaCell.self, forCellWithReuseIdentifier: "media") + let refresh = UIRefreshControl() + refresh.tintColor = DroneDockStyle.primary + refresh.addTarget(self, action: #selector(refreshTapped), for: .valueChanged) + collectionView.refreshControl = refresh + view.addSubview(collectionView) + view.addSubview(footerView) + footerView.accessibilityIdentifier = "drone.materials.remote.footer" + footerView.onPrimaryTap = { [weak self] in self?.downloadTapped() } + footerView.onSecondaryTap = { [weak self] in self?.downloadViewModel.cancel() } + downloadViewModel.onUpdate = { [weak self] in self?.downloadUpdated() } + NotificationCenter.default.addObserver(self, selector: #selector(pauseDownloadForBackground), + name: UIApplication.didEnterBackgroundNotification, object: nil) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + guard !hasAppeared || refreshAfterDelivery else { return } + hasAppeared = true + refreshAfterDelivery = false + load(.refresh) + } + + /// 确认离开后再清理;交互式返回取消或媒体预览覆盖不会丢失当前数据。 + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + guard isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true || parent == nil else { return } + hasAppeared = false + downloadViewModel.cancel() + loadTask?.cancel() + operation = nil + viewModel.invalidate() + collectionView.refreshControl?.endRefreshing() + } + + private var displayedSpotID: Int? { + if case .filter(let id) = operation { return id } + return viewModel.selectedSpotID + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collection, path, item in + guard let self else { return nil } + switch item { + case .order: + let cell = collection.dequeueReusableCell(withReuseIdentifier: "order", for: path) as! DroneDockMaterialOrderCell + if let order = self.viewModel.detail?.order { cell.apply(order: order) } + return cell + case .summary: + let cell = collection.dequeueReusableCell(withReuseIdentifier: "summary", for: path) as! DroneMaterialSelectionCell + cell.apply(recordCount: self.viewModel.total ?? 0, + allSelected: self.viewModel.allDownloadableSelected, + enabled: self.operation == nil && !self.selectionLocked && !self.viewModel.selectableMaterialIDs.isEmpty) + cell.accessibilityIdentifier = "drone.materials.remote.summary" + cell.onSelectAllTap = { [weak self] in + guard let self, self.operation == nil, !self.selectionLocked else { return } + self.viewModel.toggleSelectAll() + self.applySnapshot(animated: false) + } + return cell + case .filter(let id): + let cell = collection.dequeueReusableCell(withReuseIdentifier: "filter", for: path) as! DroneMaterialFilterCell + cell.apply(title: self.filterTitle(for: id), id: id.map(String.init), selected: id == self.displayedSpotID, + locked: self.viewModel.detail == nil || self.selectionLocked, wrapsTitle: true) + return cell + case .task(let taskID): + let cell = collection.dequeueReusableCell(withReuseIdentifier: "record", for: path) as! DroneDockMaterialRecordCell + if let task = self.task(taskID) { + cell.apply(task: task, canDeliver: self.operation == nil && !self.selectionLocked && self.viewModel.detail?.order.canDeliverFilm == true) { [weak self] in + self?.openDelivery(taskID: taskID) + } + } + return cell + case .file(let taskID, let fileID): + let cell = collection.dequeueReusableCell(withReuseIdentifier: "media", for: path) as! DroneDockMaterialMediaCell + if let file = self.task(taskID)?.materials.first(where: { $0.id == fileID }) { + let identity = DroneDockMaterialSelectionID(taskID: taskID, fileID: fileID) + cell.apply(file: file, taskID: taskID, + selected: self.viewModel.selectedMaterialIDs.contains(identity), + selectionEnabled: self.operation == nil && !self.selectionLocked && self.viewModel.selectableMaterialIDs.contains(identity), + localImage: self.thumbnailProvider?(taskID, fileID), + allowsRemoteImage: self.thumbnailProvider == nil, + preview: { [weak self] in self?.previewFile(taskID: taskID, fileID: fileID) }, + select: { [weak self] in + guard let self, self.operation == nil, !self.selectionLocked else { return } + self.viewModel.toggleSelection(taskID: taskID, fileID: fileID) + self.applySnapshot(animated: false) + }) + } + return cell + case .message: + let cell = collection.dequeueReusableCell(withReuseIdentifier: "message", for: path) as! DroneDockMaterialMessageCell + self.configureMessage(cell) + return cell + } + } + dataSource.supplementaryViewProvider = { collection, kind, path in + collection.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "separator", for: path) + } + } + + private func configureMessage(_ cell: DroneDockMaterialMessageCell) { + if operation != nil || viewModel.isLoading || viewModel.isLoadingTasks { + cell.apply(title: viewModel.detail == nil ? "正在加载订单素材库" : "正在加载任务素材", + detail: "请稍候", identifier: "drone.materials.remote.loading", loading: true) + } else if let error = viewModel.detailErrorMessage { + cell.apply(title: "订单信息加载失败", detail: error, identifier: "drone.materials.remote.error", error: true) { [weak self] in self?.load(.refresh) } + } else if let error = viewModel.tasksErrorMessage { + cell.apply(title: "任务素材加载失败", detail: error, identifier: "drone.materials.remote.error", error: true) { [weak self] in self?.load(.retry) } + } else { + cell.apply(title: displayedSpotID == nil ? "暂无任务记录" : "当前点位暂无任务记录", + detail: "拍摄任务与素材更新后,可下拉刷新查看", identifier: "drone.materials.remote.empty") + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, let dataSource = self.dataSource else { return nil } + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(index) else { return nil } + switch sections[index] { + case .filters: + let maximumWidth = min(200, max(1, environment.container.effectiveContentSize.width - 32)) + let sizes = dataSource.snapshot().itemIdentifiers(inSection: .filters).compactMap { item -> CGSize? in + guard case .filter(let id) = item else { return nil } + return DroneMaterialFilterCell.wrappedSize(title: self.filterTitle(for: id), maximumWidth: maximumWidth) + } + let width = sizes.reduce(0) { $0 + $1.width } + CGFloat(max(0, sizes.count - 1)) * 8 + let height = sizes.map(\.height).max() ?? 40 + let group = NSCollectionLayoutGroup.custom(layoutSize: .init(widthDimension: .absolute(max(1, width)), heightDimension: .absolute(height))) { _ in + var x: CGFloat = 0 + return sizes.map { size in + defer { x += size.width + 8 } + return NSCollectionLayoutGroupCustomItem(frame: CGRect(x: x, y: 0, width: size.width, height: size.height)) + } + } + let section = NSCollectionLayoutSection(group: group) + section.orthogonalScrollingBehavior = .continuous + section.interGroupSpacing = 8 + section.contentInsets = .init(top: 0, leading: 16, bottom: 8, trailing: 16) + return section + case .media: + let width = (environment.container.effectiveContentSize.width - 44) / 2 + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(0.5), heightDimension: .fractionalHeight(1))) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(width * 9 / 16 + 51)), repeatingSubitem: item, count: 2) + group.interItemSpacing = .fixed(12) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = .init(top: 0, leading: 16, bottom: 16, trailing: 16) + section.interGroupSpacing = 12 + section.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(1)), + elementKind: UICollectionView.elementKindSectionFooter, alignment: .bottom)] + return section + case .message: + return self.singleColumnSection(height: .absolute(250)) + case .summary: + return self.singleColumnSection(height: .absolute(46)) + default: + return self.singleColumnSection(height: .estimated(90)) + } + } + } + + private func singleColumnSection(height: NSCollectionLayoutDimension) -> NSCollectionLayoutSection { + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: height)) + let group = NSCollectionLayoutGroup.vertical(layoutSize: item.layoutSize, subitems: [item]) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = .init(top: 0, leading: 16, bottom: 0, trailing: 16) + return section + } + + private func applySnapshot(animated: Bool) { + guard dataSource != nil else { return } + var snapshot = NSDiffableDataSourceSnapshot() + if viewModel.detail != nil { + snapshot.appendSections([.order, .filters]) + snapshot.appendItems([.order], toSection: .order) + snapshot.appendItems([.filter(nil)] + viewModel.spots.map { .filter($0.id) }, toSection: .filters) + } + if operation == nil && !viewModel.isLoading && !viewModel.isLoadingTasks && viewModel.tasksErrorMessage == nil && viewModel.detailErrorMessage == nil && viewModel.total != nil { + snapshot.appendSections([.summary]) + snapshot.appendItems([.summary], toSection: .summary) + for task in viewModel.tasks { + snapshot.appendSections([.task(task.id)]) + snapshot.appendItems([.task(task.id)], toSection: .task(task.id)) + let media = task.materials.map { Item.file(task.id, $0.id) } + if !media.isEmpty { + snapshot.appendSections([.media(task.id)]) + snapshot.appendItems(media, toSection: .media(task.id)) + } + } + } + if viewModel.tasks.isEmpty || operation != nil || viewModel.isLoading || viewModel.isLoadingTasks || viewModel.detailErrorMessage != nil || viewModel.tasksErrorMessage != nil { + snapshot.appendSections([.message]) + snapshot.appendItems([.message], toSection: .message) + } + updateDownloadFooter() + let previous = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { previous.contains($0) }) + dataSource.apply(snapshot, animatingDifferences: animated) + } + + private func load(_ action: LoadAction) { + guard !selectionLocked else { + collectionView.refreshControl?.endRefreshing() + return + } + loadTask?.cancel() + operation = action + applySnapshot(animated: false) + loadTask = Task { @MainActor [weak self] in + guard let self else { return } + switch action { + case .refresh: await self.viewModel.refresh() + case .filter(let id): await self.viewModel.selectSpot(id: id) + case .retry: await self.viewModel.retryTasks() + } + guard !Task.isCancelled else { return } + self.operation = nil + self.collectionView.refreshControl?.endRefreshing() + self.applySnapshot(animated: true) + } + } + + @objc private func refreshTapped() { load(.refresh) } + private func task(_ id: Int) -> DroneDockMaterialTask? { viewModel.tasks.first { $0.id == id } } + + private func openDelivery(taskID: Int) { + guard operation == nil, !selectionLocked, presentedViewController == nil, + let order = viewModel.detail?.order, order.canDeliverFilm, task(taskID) != nil else { return } + let sheet = DroneDockDeliveryEntry.makeMethodSheet(order: order, context: viewModel.context, + taskID: taskID, controllerFactory: deliveryControllerFactory) { [weak self] in + guard let self else { return } + self.refreshAfterDelivery = true + guard self.viewIfLoaded?.window != nil else { return } + self.refreshAfterDelivery = false + self.load(.refresh) + } + present(sheet, animated: true) + } + + private func downloadTapped() { + guard operation == nil else { return } + switch downloadViewModel.phase { + case .idle: + _ = downloadViewModel.start(items: viewModel.selectedDownloadItems()) + applySnapshot(animated: false) + case .downloading: downloadViewModel.pause() + case .paused: downloadViewModel.resume() + case .finished: + if downloadViewModel.failedCount > 0 { downloadViewModel.retryFailed() } + else { downloadViewModel.cancel() } + } + } + + @objc private func pauseDownloadForBackground() { downloadViewModel.pause() } + + private func downloadUpdated() { + if lastDownloadPhase != downloadViewModel.phase { + lastDownloadPhase = downloadViewModel.phase + applySnapshot(animated: false) + } else { + updateDownloadFooter() + } + if !downloadViewModel.permissionDenied { hasPresentedPhotoPermission = false } + if downloadViewModel.permissionDenied, !hasPresentedPhotoPermission, + viewIfLoaded?.window != nil, presentedViewController == nil { + hasPresentedPhotoPermission = true + let alert = UIAlertController(title: "需要相册保存权限", + message: "请允许添加照片和视频,以保存所选素材。授权后可返回重试失败项。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "取消", style: .cancel)) + alert.addAction(UIAlertAction(title: "去设置", style: .default) { _ in + if let url = URL(string: UIApplication.openSettingsURLString) { UIApplication.shared.open(url) } + }) + present(alert, animated: true) + } + } + + private func updateDownloadFooter() { + navigationItem.rightBarButtonItem?.isEnabled = !selectionLocked + let model = downloadViewModel + let identifier = "drone.materials.remote.download" + switch model.phase { + case .idle: + footerView.apply(title: "已选择\(viewModel.selectedCount)项", detail: model.lastErrorMessage ?? downloadSourceDescription ?? "", + primaryTitle: "下载所选素材", primarySymbol: "arrow.down.to.line", + enabled: operation == nil && viewModel.selectedCount > 0, identifier: identifier, progress: nil, + trailingText: "仅可选择已上传素材") + case .downloading, .paused: + let paused = model.phase == .paused + footerView.apply(title: "\(paused ? "已暂停" : "下载中") · \(downloadIsSimulated ? "演示完成" : "已保存") \(model.completedCount)/\(model.totalCount) 项", + detail: downloadSourceDescription ?? "请保持页面开启,切到后台将暂停", primaryTitle: paused ? "继续下载" : "暂停下载", + primarySymbol: paused ? "play.fill" : "pause.fill", enabled: true, identifier: identifier, + progress: model.progress, secondaryTitle: "取消下载", trailingText: "\(Int(model.progress * 100))%") + case .finished: + let failed = model.failedCount > 0 + let saved = "\(downloadIsSimulated ? "演示完成" : "已保存") \(model.completedCount) 项" + footerView.apply(title: failed ? "\(saved) · 失败 \(model.failedCount) 项" : saved, + detail: failed ? model.lastErrorMessage ?? "失败项可重试,成功项已保存相册" : downloadSourceDescription ?? "可在系统相册查看", + primaryTitle: failed ? "重试失败项" : "继续选择", primarySymbol: failed ? "arrow.clockwise" : "checkmark", + enabled: true, identifier: identifier, progress: nil, secondaryTitle: failed ? "继续选择" : nil, + tone: failed ? .orange : .green, resultSymbol: failed ? "exclamationmark.circle.fill" : "checkmark.circle.fill") + } + } + + private func previewFile(taskID: Int, fileID: Int) { + guard operation == nil, let file = task(taskID)?.materials.first(where: { $0.id == fileID }), let url = file.previewURL else { return } + preview(url: url, isVideo: file.fileType == 2, title: file.fileName ?? "原素材") + } + + private func preview(url: URL, isVideo: Bool, title: String) { + if let mediaPreviewControllerFactory { + navigationController?.pushViewController(mediaPreviewControllerFactory(url, isVideo, title), animated: true) + } else if isVideo { + let player = AVPlayerViewController() + player.player = AVPlayer(url: url) + present(player, animated: true) { player.player?.play() } + } else { + navigationController?.pushViewController(DroneDockMaterialImageViewController(url: url, title: title), animated: true) + } + } + + private static func usable(_ value: String?, fallback: String) -> String { + DroneDockHomeMetric.usableText(value) ?? fallback + } + + private func filterTitle(for id: Int?) -> String { + id.flatMap { id in viewModel.spots.first { $0.id == id } } + .map { Self.usable($0.name, fallback: "点位 \($0.id)") } ?? "全部点位" + } + + +} + +extension DroneDockMaterialsViewController: UICollectionViewDelegate { + /// 点位只重读任务;仅已就绪且有合法地址的媒体可进入真实预览。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard let item = dataSource.itemIdentifier(for: indexPath) else { return } + switch item { + case .filter(let id): + guard viewModel.detail != nil, !selectionLocked, id != displayedSpotID else { return } + load(.filter(id)) + case .file(let taskID, let fileID): + previewFile(taskID: taskID, fileID: fileID) + default: break + } + } +} + +/// 通过 Kingfisher 展示真实图片,加载失败保留明确提示。 +@MainActor +private final class DroneDockMaterialImageViewController: UIViewController { + private let url: URL + private let imageView = UIImageView() + private let message = UILabel() + + /// 仅接收素材模型已经校验可预览的 HTTP(S) 地址。 + init(url: URL, title: String) { + self.url = url + super.init(nibName: nil, bundle: nil) + self.title = title + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .black + imageView.contentMode = .scaleAspectFit + imageView.accessibilityIdentifier = "drone.materials.remote.preview.image" + message.text = "正在加载图片" + message.textColor = .white + message.textAlignment = .center + message.numberOfLines = 0 + view.addSubview(imageView) + view.addSubview(message) + imageView.snp.makeConstraints { $0.edges.equalTo(view.safeAreaLayoutGuide) } + message.snp.makeConstraints { make in make.center.equalToSuperview(); make.leading.trailing.equalToSuperview().inset(24) } + imageView.kf.setImage(with: url) { [weak self] result in + switch result { + case .success: self?.message.isHidden = true + case .failure: self?.message.text = "图片加载失败,请返回后重试" + } + } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockNearbyTransferViewController.swift b/suixinkan/UI/DroneDock/DroneDockNearbyTransferViewController.swift new file mode 100644 index 0000000..071fd55 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockNearbyTransferViewController.swift @@ -0,0 +1,634 @@ +import AVKit +import SnapKit +import UIKit + +/// 单个本地视频的局域网扫码交付页,游客无需安装 App。 +@MainActor +final class DroneDockNearbyTransferViewController: BaseViewController { + /// 同一页面供订单和素材库入口复用,不依赖云端交付状态。 + let viewModel: DroneDockNearbyTransferViewModel + /// 在交付弹窗中关闭整个流程,由调用方决定如何退出。 + var onClose: (() -> Void)? + + private let customerTitle: String + private let orderNumber: String? + private let videoPicker: (@MainActor () async throws -> DroneDockDeliveryVideo?)? + private var operationTask: Task? + private var metadataTask: Task? + private var isPicking = false + private var pickerError: String? + private var ownedVideoURLs: Set = [] + private var displayedVideoID: UUID? + private var durationText: String? + private var pendingRevealSessionID: UUID? + private var revealedSessionID: UUID? + private var isRevealScheduled = false + private var previousIdleTimerDisabled: Bool? + private var previousGestureEnabled: Bool? + private let scrollView = UIScrollView() + private let content = UIStackView() + private let customerView = DroneDockDeliveryCustomerView() + private let thumbnail = DroneDockDeliveryVideoThumbnailView() + private let footerContent = UIStackView() + private let statusDot = UIView() + private let receiveTitle = DroneDockStyle.label("扫码接收视频", size: 25, weight: .bold) + private let emptyCodeView = UIImageView(image: UIImage(systemName: "qrcode.viewfinder")) + private let codeFrame = DroneDockNearbyQRCodeFrameView() + private var primaryHeight: Constraint? + private let fileLabel = DroneDockStyle.label("尚未选择视频", size: 16, weight: .semibold) + private let fileDetailLabel = DroneDockStyle.label("选择一段已在本机的视频", size: 12, color: DroneDockStyle.secondary) + private let chooseButton = UIButton(type: .system) + private let previewButton = UIButton(type: .system) + private let statusLabel = DroneDockStyle.label("准备闪传", size: 14, weight: .semibold) + private let statusDetailLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let qrContainer = UIView() + private let qrView = UIImageView() + private let addressButton = UIButton(type: .system) + private let expiryLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let progressView = UIProgressView(progressViewStyle: .default) + private let progressLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let footer = UIView() + private let primaryButton = UIButton(type: .system) + private let footerLabel = DroneDockStyle.label("仅发送所选视频,无需上传云端", size: 12, color: DroneDockStyle.secondary) + + /// 注入本地服务和测试视频选择器;默认使用禁止云端取片的本地相册选择器。 + init(customerTitle: String, orderNumber: String? = nil, viewModel: DroneDockNearbyTransferViewModel = DroneDockNearbyTransferViewModel(), + videoPicker: (@MainActor () async throws -> DroneDockDeliveryVideo?)? = nil) { + self.customerTitle = customerTitle + self.orderNumber = orderNumber + self.viewModel = viewModel + self.videoPicker = videoPicker + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { + operationTask?.cancel() + metadataTask?.cancel() + viewModel.setUpdateHandler(nil) + viewModel.stop() + ownedVideoURLs.forEach(DroneDockDeliveryVideoLoader.discard) + NotificationCenter.default.removeObserver(self) + } + + override func setupNavigationBar() { + title = "面对面闪传" + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.backgroundColor = DroneDockDeliveryDesign.background + appearance.shadowColor = .clear + appearance.titleTextAttributes = [.foregroundColor: DroneDockDeliveryDesign.text, + .font: UIFont.systemFont(ofSize: 19, weight: .semibold)] + navigationItem.standardAppearance = appearance + navigationItem.scrollEdgeAppearance = appearance + navigationItem.compactAppearance = appearance + let back = UIBarButtonItem(image: UIImage(systemName: "chevron.left"), style: .plain, target: self, action: #selector(backTapped)) + back.accessibilityLabel = "返回交付方式" + back.tintColor = DroneDockDeliveryDesign.text + back.accessibilityIdentifier = "drone.nearby.back" + navigationItem.leftBarButtonItem = back + let close = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(closeTapped)) + close.tintColor = DroneDockDeliveryDesign.text + close.accessibilityLabel = "关闭面对面闪传" + close.accessibilityIdentifier = "drone.nearby.close" + navigationItem.rightBarButtonItem = close + } + + override func setupUI() { + view.backgroundColor = DroneDockDeliveryDesign.background + scrollView.alwaysBounceVertical = true + scrollView.showsVerticalScrollIndicator = false + scrollView.accessibilityIdentifier = "drone.nearby.content" + content.axis = .vertical + content.spacing = 10 + customerView.apply(title: customerTitle, orderNumber: orderNumber) + customerView.accessibilityIdentifier = "drone.nearby.customer" + DroneDockDeliveryDesign.card(to: customerView) + content.addArrangedSubview(customerView) + content.addArrangedSubview(makeNetworkHint()) + content.addArrangedSubview(makeVideoCard()) + content.addArrangedSubview(makeReceiveCard()) + + footer.backgroundColor = .white + footer.accessibilityIdentifier = "drone.nearby.footer" + let separator = UIView() + separator.backgroundColor = DroneDockDeliveryDesign.border + footer.addSubview(separator) + separator.snp.makeConstraints { make in make.top.leading.trailing.equalToSuperview(); make.height.equalTo(0.5) } + footerContent.axis = .vertical + footerContent.spacing = 6 + footer.addSubview(footerContent) + [addressButton, primaryButton, footerLabel].forEach(footerContent.addArrangedSubview) + var configuration = UIButton.Configuration.filled() + configuration.title = "复制接收地址" + configuration.image = UIImage(systemName: "link") + configuration.imagePadding = 8 + configuration.preferredSymbolConfigurationForImage = .init(pointSize: 20, weight: .medium) + configuration.baseForegroundColor = .white + configuration.background.backgroundColor = DroneDockDeliveryDesign.primary + configuration.background.cornerRadius = 12 + configuration.cornerStyle = .fixed + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: 17, weight: .semibold) + return result + } + addressButton.configuration = configuration + addressButton.accessibilityIdentifier = "drone.nearby.copyAddress" + addressButton.snp.makeConstraints { $0.height.equalTo(48).priority(999) } + primaryButton.layer.cornerRadius = 12 + primaryButton.titleLabel?.font = .systemFont(ofSize: 16, weight: .semibold) + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(DroneDockDeliveryDesign.secondary, for: .disabled) + primaryButton.accessibilityIdentifier = "drone.nearby.primary" + primaryButton.snp.makeConstraints { primaryHeight = $0.height.equalTo(48).constraint } + footerLabel.textAlignment = .center + footerLabel.numberOfLines = 0 + footerLabel.textColor = DroneDockDeliveryDesign.secondary + view.addSubview(scrollView) + scrollView.addSubview(content) + view.addSubview(footer) + render() + } + + override func setupConstraints() { + scrollView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footer.snp.top) + } + content.snp.makeConstraints { make in + make.edges.equalTo(scrollView.contentLayoutGuide).inset(UIEdgeInsets(top: 12, left: 20, bottom: 12, right: 20)) + make.width.equalTo(scrollView.frameLayoutGuide).offset(-40) + } + footer.snp.makeConstraints { $0.leading.trailing.bottom.equalToSuperview() } + footerContent.snp.makeConstraints { make in + make.top.equalToSuperview().offset(12) + make.leading.trailing.equalToSuperview().inset(20) + make.bottom.equalTo(footer.safeAreaLayoutGuide).offset(-8) + } + } + + private func makeNetworkHint() -> UIView { + let hint = UIView() + hint.backgroundColor = DroneDockDeliveryDesign.primary.withAlphaComponent(0.08) + hint.layer.cornerRadius = 14 + hint.accessibilityIdentifier = "drone.nearby.networkHint" + let icon = UIImageView(image: UIImage(systemName: "wifi")) + icon.tintColor = DroneDockDeliveryDesign.primary + icon.contentMode = .scaleAspectFit + let divider = UIView() + divider.backgroundColor = DroneDockDeliveryDesign.primary.withAlphaComponent(0.16) + let title = DroneDockStyle.label("双方连接同一 Wi-Fi 或手机热点", size: 14, weight: .semibold, + color: DroneDockDeliveryDesign.text) + title.numberOfLines = 0 + let detail = DroneDockStyle.label("无需互联网,传输时请保持本页亮屏", size: 12, color: DroneDockDeliveryDesign.secondary) + detail.numberOfLines = 0 + let labels = UIStackView(arrangedSubviews: [title, detail]) + labels.axis = .vertical + labels.spacing = 4 + [icon, divider, labels].forEach(hint.addSubview) + icon.snp.makeConstraints { make in make.leading.equalToSuperview().offset(16); make.centerY.equalToSuperview(); make.size.equalTo(30) } + divider.snp.makeConstraints { make in make.leading.equalTo(icon.snp.trailing).offset(12); make.centerY.equalToSuperview(); make.width.equalTo(1); make.height.equalTo(34) } + labels.snp.makeConstraints { make in + make.leading.equalTo(divider.snp.trailing).offset(12) + make.trailing.equalToSuperview().inset(14) + make.top.bottom.equalToSuperview().inset(10) + } + return hint + } + + private func makeVideoCard() -> UIView { + let title = DroneDockStyle.label("本次发送", size: 16, weight: .semibold, color: DroneDockDeliveryDesign.text) + chooseButton.setTitle("选择视频", for: .normal) + chooseButton.titleLabel?.font = .systemFont(ofSize: 14, weight: .semibold) + chooseButton.tintColor = DroneDockDeliveryDesign.primary + chooseButton.accessibilityIdentifier = "drone.nearby.chooseVideo" + chooseButton.snp.makeConstraints { make in make.height.equalTo(44); make.width.greaterThanOrEqualTo(72).priority(999) } + let heading = UIStackView(arrangedSubviews: [title, UIView(), chooseButton]) + heading.alignment = .center + heading.spacing = 6 + fileLabel.numberOfLines = 2 + fileLabel.textColor = DroneDockDeliveryDesign.text + fileLabel.accessibilityIdentifier = "drone.nearby.fileName" + fileDetailLabel.numberOfLines = 0 + fileDetailLabel.textColor = DroneDockDeliveryDesign.secondary + fileDetailLabel.accessibilityIdentifier = "drone.nearby.fileDetail" + let labels = UIStackView(arrangedSubviews: [fileLabel, fileDetailLabel]) + labels.axis = .vertical + labels.spacing = 5 + let video = UIView() + thumbnail.accessibilityIdentifier = "drone.nearby.videoThumbnail" + video.addSubview(thumbnail) + video.addSubview(labels) + previewButton.setImage(UIImage(systemName: "play.circle.fill"), for: .normal) + previewButton.tintColor = .white + previewButton.setPreferredSymbolConfiguration(.init(pointSize: 28), forImageIn: .normal) + previewButton.accessibilityLabel = "预览本次发送的视频" + previewButton.accessibilityIdentifier = "drone.nearby.preview" + video.addSubview(previewButton) + thumbnail.snp.makeConstraints { make in make.leading.top.bottom.equalToSuperview(); make.width.equalTo(104); make.height.equalTo(62) } + previewButton.snp.makeConstraints { $0.edges.equalTo(thumbnail) } + labels.snp.makeConstraints { make in + make.leading.equalTo(thumbnail.snp.trailing).offset(12) + make.trailing.equalToSuperview() + make.centerY.equalTo(thumbnail) + make.top.greaterThanOrEqualToSuperview() + make.bottom.lessThanOrEqualToSuperview() + } + let result = card([heading, video], spacing: 8) + result.accessibilityIdentifier = "drone.nearby.videoCard" + return result + } + + private func makeReceiveCard() -> UIView { + statusDot.backgroundColor = DroneDockDeliveryDesign.primary + statusDot.layer.cornerRadius = 4 + statusDot.snp.makeConstraints { $0.size.equalTo(8) } + statusLabel.textColor = DroneDockDeliveryDesign.secondary + statusLabel.numberOfLines = 0 + statusLabel.accessibilityIdentifier = "drone.nearby.status" + let status = UIStackView(arrangedSubviews: [statusDot, statusLabel]) + status.spacing = 8 + status.alignment = .center + let statusRow = UIView() + statusRow.addSubview(status) + status.snp.makeConstraints { make in make.centerX.top.bottom.equalToSuperview(); make.leading.greaterThanOrEqualToSuperview(); make.trailing.lessThanOrEqualToSuperview() } + receiveTitle.textColor = DroneDockDeliveryDesign.text + receiveTitle.textAlignment = .center + receiveTitle.accessibilityIdentifier = "drone.nearby.receiveTitle" + statusDetailLabel.numberOfLines = 0 + statusDetailLabel.textAlignment = .center + statusDetailLabel.textColor = DroneDockDeliveryDesign.secondary + statusDetailLabel.accessibilityIdentifier = "drone.nearby.statusDetail" + qrView.contentMode = .scaleAspectFit + qrView.accessibilityIdentifier = "drone.nearby.qr" + qrView.isAccessibilityElement = true + qrView.accessibilityLabel = "请游客用系统相机扫描此二维码" + qrContainer.addSubview(codeFrame) + qrContainer.addSubview(qrView) + qrContainer.snp.makeConstraints { $0.height.equalTo(220).priority(999) } + codeFrame.snp.makeConstraints { make in make.center.equalToSuperview(); make.size.equalTo(220) } + qrView.snp.makeConstraints { make in make.center.equalToSuperview(); make.size.equalTo(196) } + emptyCodeView.contentMode = .scaleAspectFit + emptyCodeView.tintColor = DroneDockDeliveryDesign.primary.withAlphaComponent(0.4) + emptyCodeView.snp.makeConstraints { $0.height.equalTo(72).priority(999) } + emptyCodeView.accessibilityIdentifier = "drone.nearby.emptyCode" + expiryLabel.textAlignment = .center + expiryLabel.font = .systemFont(ofSize: 13) + expiryLabel.textColor = DroneDockDeliveryDesign.secondary + expiryLabel.numberOfLines = 0 + expiryLabel.accessibilityIdentifier = "drone.nearby.expiry" + progressView.progressTintColor = DroneDockDeliveryDesign.primary + progressView.accessibilityIdentifier = "drone.nearby.progress" + progressLabel.textAlignment = .center + progressLabel.accessibilityIdentifier = "drone.nearby.progressText" + let result = card([statusRow, receiveTitle, statusDetailLabel, emptyCodeView, qrContainer, expiryLabel, progressView, progressLabel], spacing: 8) + result.accessibilityIdentifier = "drone.nearby.receiveCard" + return result + } + + override func bindActions() { + chooseButton.addTarget(self, action: #selector(chooseVideoTapped), for: .touchUpInside) + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + addressButton.addTarget(self, action: #selector(copyAddressTapped), for: .touchUpInside) + viewModel.setUpdateHandler { [weak self] _ in + Task { @MainActor [weak self] in self?.render() } + } + NotificationCenter.default.addObserver(self, selector: #selector(enteredBackground), name: UIApplication.didEnterBackgroundNotification, object: nil) + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.setNavigationBarHidden(false, animated: false) + navigationController?.sheetPresentationController?.detents = [.large()] + navigationController?.sheetPresentationController?.selectedDetentIdentifier = .large + render() + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + if isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true { + finishForLeaving() + } + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + scheduleReceiveCodeReveal() + } + + private func scheduleReceiveCodeReveal() { + guard pendingRevealSessionID != nil, !isRevealScheduled else { return } + isRevealScheduled = true + DispatchQueue.main.async { [weak self] in + guard let self else { return } + defer { self.isRevealScheduled = false } + self.view.layoutIfNeeded() + self.scrollView.layoutIfNeeded() + self.content.layoutIfNeeded() + self.revealReceiveCodeIfNeeded() + } + } + + private func revealReceiveCodeIfNeeded() { + guard let sessionID = pendingRevealSessionID, + viewModel.snapshot.session?.id == sessionID, + view.window != nil, scrollView.bounds.height > 0, + qrContainer.bounds.height > 0, expiryLabel.bounds.height > 0 else { return } + pendingRevealSessionID = nil + revealedSessionID = sessionID + // 只在新接收码生成后定位一次;下载进度和游客连接事件不抢走用户的滚动位置。 + let target = qrContainer.convert(qrContainer.bounds, to: scrollView) + .union(expiryLabel.convert(expiryLabel.bounds, to: scrollView)) + .insetBy(dx: 0, dy: -8) + scrollView.scrollRectToVisible(target, animated: !UIAccessibility.isReduceMotionEnabled) + } + + private func card(_ views: [UIView], spacing: CGFloat = 10) -> UIView { + let container = UIView() + DroneDockDeliveryDesign.card(to: container) + let stack = UIStackView(arrangedSubviews: views) + stack.axis = .vertical + stack.spacing = spacing + container.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)) } + return container + } + + private func render() { + guard isViewLoaded else { return } + let state = viewModel.snapshot + updateScreenAwake(active: state.isActive) + navigationController?.isModalInPresentation = state.isActive || isPicking + if state.isActive { + if previousGestureEnabled == nil { previousGestureEnabled = navigationController?.interactivePopGestureRecognizer?.isEnabled } + navigationController?.interactivePopGestureRecognizer?.isEnabled = false + } else if let enabled = previousGestureEnabled { + navigationController?.interactivePopGestureRecognizer?.isEnabled = enabled + previousGestureEnabled = nil + } + chooseButton.isEnabled = state.canChooseVideo && !isPicking + chooseButton.isHidden = state.isActive + chooseButton.setTitle(isPicking ? "正在准备视频…" : state.video == nil ? "选择视频" : "更换", for: .normal) + previewButton.isHidden = state.video == nil || state.isActive + thumbnail.apply(video: state.video) + previewButton.isEnabled = !isPicking && !state.isActive + fileLabel.text = state.video?.fileName ?? "尚未选择视频" + if let video = state.video { + let size = ByteCountFormatter.string(fromByteCount: Int64(video.fileSize), countStyle: .file) + fileDetailLabel.text = [size, durationText].compactMap { $0 }.joined(separator: " · ") + } else { fileDetailLabel.text = "选择一段已在本机的视频,仅本次闪传可访问" } + if let pickerError { statusLabel.text = "视频准备失败"; statusDetailLabel.text = pickerError } + else { + switch state.phase { + case .idle: + statusLabel.text = "准备闪传" + statusDetailLabel.text = "选择视频后生成二维码,游客使用系统相机扫码,在浏览器中接收。" + case .starting: + statusLabel.text = "正在准备接收码…" + statusDetailLabel.text = "请保持本页打开,正在检查本地连接。" + case .waiting: + statusLabel.text = "等待游客扫码" + statusDetailLabel.text = "使用系统相机扫码,在浏览器中下载" + case .connected: + statusLabel.text = "游客已打开接收页" + statusDetailLabel.text = state.message ?? "请游客点击“下载视频”开始接收。" + case .sending: + statusLabel.text = "正在发送视频" + statusDetailLabel.text = "请保持本页亮屏,并让游客保持连接同一 Wi-Fi。" + case .sent: + statusLabel.text = "文件已发送" + statusDetailLabel.text = state.message + case .interrupted: + statusLabel.text = "传输已中断" + statusDetailLabel.text = state.message + case .ended: + statusLabel.text = "闪传已结束" + statusDetailLabel.text = state.message + case .failed: + statusLabel.text = "暂时无法闪传" + statusDetailLabel.text = state.message + } + } + let tone = state.phase == .sent ? DroneDockStyle.success : state.phase == .failed || state.phase == .interrupted || pickerError != nil ? DroneDockStyle.warning : DroneDockDeliveryDesign.primary + statusDot.backgroundColor = tone + statusLabel.textColor = state.phase == .failed || state.phase == .interrupted || pickerError != nil ? tone : DroneDockDeliveryDesign.secondary + let receiveURL = state.session?.url + qrContainer.isHidden = receiveURL == nil + emptyCodeView.isHidden = receiveURL != nil + receiveTitle.text = receiveURL != nil ? "扫码接收视频" : "面对面,轻松接收" + addressButton.isHidden = receiveURL == nil + addressButton.isEnabled = receiveURL != nil + expiryLabel.isHidden = receiveURL == nil + if let receiveURL { + if qrView.accessibilityValue != receiveURL.absoluteString { + qrView.image = QRCodeGenerator.generateStyledQRCode(content: receiveURL.absoluteString, backgroundColor: .white, cornerRadius: 0) + qrView.accessibilityValue = receiveURL.absoluteString + } + addressButton.accessibilityValue = receiveURL.absoluteString + if let expiry = state.session?.expiresAt { + expiryLabel.text = "接收码有效至 \(expiry.formatted(date: .omitted, time: .shortened))\n结束闪传或离开本页后失效" + } + } else { + qrView.image = nil + qrView.accessibilityValue = nil + addressButton.accessibilityValue = nil + } + let hasProgress = [.sending, .sent, .interrupted].contains(state.phase) + progressView.isHidden = !hasProgress + progressLabel.isHidden = !hasProgress + progressView.setProgress(state.progress, animated: state.phase == .sending) + progressLabel.text = "已发送 \(ByteCountFormatter.string(fromByteCount: state.bytesSent, countStyle: .file)) / \(ByteCountFormatter.string(fromByteCount: state.totalBytes, countStyle: .file))" + primaryButton.setTitle(state.isActive ? "结束闪传" : state.phase == .ended || state.phase == .failed ? "重新生成接收码" : "生成接收二维码", for: .normal) + primaryButton.isEnabled = !isPicking && (state.isActive || state.canStart) + primaryButton.setTitleColor(state.isActive ? .systemRed : .white, for: .normal) + primaryButton.backgroundColor = state.isActive ? .clear : primaryButton.isEnabled ? DroneDockDeliveryDesign.primary : DroneDockDeliveryDesign.border + primaryHeight?.update(offset: state.isActive ? 44 : 48) + footerLabel.isHidden = state.isActive + if let sessionID = state.session?.id, sessionID != revealedSessionID { + pendingRevealSessionID = sessionID + } else if state.session == nil { pendingRevealSessionID = nil } + view.setNeedsLayout() + scheduleReceiveCodeReveal() + } + + @objc private func chooseVideoTapped() { + guard viewModel.snapshot.canChooseVideo, !isPicking else { return } + pickerError = nil + if let videoPicker { + isPicking = true + render() + operationTask = Task { @MainActor [weak self] in + guard let self else { return } + defer { self.isPicking = false; self.render() } + do { + if let video = try await videoPicker() { + guard !Task.isCancelled else { DroneDockDeliveryVideoLoader.discard(video.url); return } + self.useVideo(video) + } + } catch { if !Task.isCancelled { self.pickerError = error.localizedDescription } } + } + } else { + let picker = DroneDockNearbyVideoPickerViewController(onSelect: { [weak self] video in + guard let self else { DroneDockDeliveryVideoLoader.discard(video.url); return } + self.dismiss(animated: true) + self.useVideo(video) + }, onCancel: { [weak self] in self?.dismiss(animated: true) }) + present(UINavigationController(rootViewController: picker), animated: true) + } + } + + private func useVideo(_ video: DroneDockDeliveryVideo) { + do { + guard try viewModel.selectVideo(video) else { DroneDockDeliveryVideoLoader.discard(video.url); return } + ownedVideoURLs.insert(video.url) + let obsolete = ownedVideoURLs.filter { $0 != video.url } + obsolete.forEach(DroneDockDeliveryVideoLoader.discard) + ownedVideoURLs.subtract(obsolete) + pickerError = nil + durationText = nil + displayedVideoID = video.id + metadataTask?.cancel() + metadataTask = Task { @MainActor [weak self] in + let duration = try? await AVURLAsset(url: video.url).load(.duration) + guard !Task.isCancelled, let self, self.displayedVideoID == video.id else { return } + if let seconds = duration?.seconds, seconds.isFinite, seconds > 0 { + let whole = Int(seconds.rounded()) + self.durationText = String(format: "%d:%02d", whole / 60, whole % 60) + } + self.render() + } + } catch { DroneDockDeliveryVideoLoader.discard(video.url); pickerError = error.localizedDescription } + render() + } + + @objc private func primaryTapped() { + guard !isPicking else { return } + if viewModel.snapshot.isActive { + confirmStop { [weak self] in + self?.operationTask?.cancel() + self?.viewModel.stop() + self?.render() + } + } else if viewModel.snapshot.canStart { + pickerError = nil + operationTask = Task { [weak self] in + guard let self else { return } + await self.viewModel.start() + } + } + } + + @objc private func previewTapped() { + guard let video = viewModel.snapshot.video, !viewModel.snapshot.isActive else { return } + let player = AVPlayerViewController() + player.player = AVPlayer(url: video.url) + present(player, animated: true) { player.player?.play() } + } + + @objc private func copyAddressTapped() { + guard let url = viewModel.snapshot.session?.url else { return } + UIPasteboard.general.setItems([[UIPasteboard.typeAutomatic: url.absoluteString]], options: [.localOnly: true, .expirationDate: Date().addingTimeInterval(120)]) + let alert = UIAlertController(title: "接收地址已复制", message: "请仅分享给同一 Wi-Fi 下的游客。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "知道了", style: .default)) + present(alert, animated: true) + } + + @objc private func backTapped() { + requestExit { [weak self] in self?.navigationController?.popViewController(animated: true) } + } + + @objc private func closeTapped() { + requestExit { [weak self] in + guard let self else { return } + if let onClose = self.onClose { onClose() } + else { self.dismiss(animated: true) } + } + } + + private func requestExit(_ exit: @escaping () -> Void) { + guard presentedViewController == nil else { return } + let finish = { [weak self] in self?.finishForLeaving(); exit() } + if viewModel.snapshot.isActive { confirmStop(finish) } + else { finish() } + } + + private func confirmStop(_ completion: @escaping () -> Void) { + let alert = UIAlertController(title: "结束本次闪传?", message: "正在下载的视频会停止,原接收二维码将失效。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "继续闪传", style: .cancel)) + alert.addAction(UIAlertAction(title: "结束闪传", style: .destructive) { _ in completion() }) + present(alert, animated: true) + } + + @objc private func enteredBackground() { + guard viewModel.snapshot.isActive else { return } + operationTask?.cancel() + viewModel.stop(message: "App 已离开前台,本次闪传已结束。请重新生成二维码。") + render() + } + + private func finishForLeaving() { + operationTask?.cancel() + metadataTask?.cancel() + viewModel.stop() + updateScreenAwake(active: false) + navigationController?.isModalInPresentation = false + if let enabled = previousGestureEnabled { + navigationController?.interactivePopGestureRecognizer?.isEnabled = enabled + previousGestureEnabled = nil + } + } + + private func updateScreenAwake(active: Bool) { + if active { + if previousIdleTimerDisabled == nil { previousIdleTimerDisabled = UIApplication.shared.isIdleTimerDisabled } + UIApplication.shared.isIdleTimerDisabled = true + } else if let previous = previousIdleTimerDisabled { + UIApplication.shared.isIdleTimerDisabled = previous + previousIdleTimerDisabled = nil + } + } +} + +/// 二维码外围的蓝色取景角,不覆盖二维码或改变扫码内容。 +@MainActor +private final class DroneDockNearbyQRCodeFrameView: UIView { + private let corners = CAShapeLayer() + + override init(frame: CGRect) { + super.init(frame: frame) + isUserInteractionEnabled = false + corners.fillColor = UIColor.clear.cgColor + corners.strokeColor = DroneDockDeliveryDesign.primary.cgColor + corners.lineWidth = 3 + corners.lineCap = .round + layer.addSublayer(corners) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func layoutSubviews() { + super.layoutSubviews() + corners.frame = bounds + let path = UIBezierPath() + let length: CGFloat = 23 + let radius: CGFloat = 10 + let inset: CGFloat = 2 + for (x, y, horizontal, vertical) in [(inset, inset, CGFloat(1), CGFloat(1)), + (bounds.width - inset, inset, -1, 1), + (inset, bounds.height - inset, 1, -1), + (bounds.width - inset, bounds.height - inset, -1, -1)] { + path.move(to: CGPoint(x: x, y: y + vertical * length)) + path.addLine(to: CGPoint(x: x, y: y + vertical * radius)) + path.addQuadCurve(to: CGPoint(x: x + horizontal * radius, y: y), controlPoint: CGPoint(x: x, y: y)) + path.addLine(to: CGPoint(x: x + horizontal * length, y: y)) + } + corners.path = path.cgPath + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockNearbyVideoPickerViewController.swift b/suixinkan/UI/DroneDock/DroneDockNearbyVideoPickerViewController.swift new file mode 100644 index 0000000..9cdb6b1 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockNearbyVideoPickerViewController.swift @@ -0,0 +1,322 @@ +import AVFoundation +import Photos +import PhotosUI +import SnapKit +import UIKit + +/// 闪传专用本地视频选择器;缩略图与视频资源均禁止从 iCloud 下载。 +@MainActor +final class DroneDockNearbyVideoPickerViewController: BaseViewController { + private let onSelect: (DroneDockDeliveryVideo) -> Void + private let onCancel: () -> Void + private let manager = PHCachingImageManager() + private var assets: [String: PHAsset] = [:] + private var operation: Task? + private var hasFinished = false + private var lastAuthorizationStatus: PHAuthorizationStatus? + private var isObservingLibrary = false + private var needsLibraryRefresh = false + private let messageLabel = UILabel() + private let spinner = UIActivityIndicatorView(style: .medium) + private let accessButton = UIButton(type: .system) + private lazy var collection = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + + /// 只返回已经复制到 App 独占临时目录的视频,由调用页负责清理。 + init(onSelect: @escaping (DroneDockDeliveryVideo) -> Void, onCancel: @escaping () -> Void) { + self.onSelect = onSelect + self.onCancel = onCancel + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { + PHPhotoLibrary.shared().unregisterChangeObserver(self) + NotificationCenter.default.removeObserver(self) + } + + override func setupNavigationBar() { + title = "选择本地视频" + navigationItem.leftBarButtonItem = UIBarButtonItem(title: "取消", style: .plain, target: self, action: #selector(cancel)) + } + + override func setupUI() { + view.backgroundColor = .systemBackground + messageLabel.font = .systemFont(ofSize: 13) + messageLabel.textColor = .secondaryLabel + messageLabel.numberOfLines = 0 + messageLabel.text = "仅发送本机已有视频,不下载 iCloud 视频。首次使用请允许访问需要交付的视频。" + collection.backgroundColor = .systemBackground + collection.accessibilityIdentifier = "drone.nearby.picker.list" + collection.delegate = self + collection.register(NearbyVideoCell.self, forCellWithReuseIdentifier: "video") + accessButton.setTitle("选择更多可访问的视频", for: .normal) + accessButton.addTarget(self, action: #selector(manageAccess), for: .touchUpInside) + accessButton.isHidden = true + [messageLabel, accessButton, collection, spinner].forEach(view.addSubview) + dataSource = UICollectionViewDiffableDataSource(collectionView: collection) { [weak self] list, path, id in + let cell = list.dequeueReusableCell(withReuseIdentifier: "video", for: path) as! NearbyVideoCell + if let self, let asset = self.assets[id] { cell.apply(asset: asset, manager: self.manager) } + return cell + } + PHPhotoLibrary.shared().register(self) + isObservingLibrary = true + operation = Task { @MainActor [weak self] in + let status = await PHPhotoLibrary.requestAuthorization(for: .readWrite) + guard !Task.isCancelled, let self else { return } + self.loadAssets(status: status) + self.operation = nil + self.applyPendingLibraryRefresh() + } + } + + override func setupConstraints() { + messageLabel.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).offset(16) + make.leading.trailing.equalToSuperview().inset(20) + } + accessButton.snp.makeConstraints { make in + make.top.equalTo(messageLabel.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(36) + } + collection.snp.makeConstraints { make in + make.top.equalTo(accessButton.snp.bottom).offset(8) + make.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) + } + spinner.snp.makeConstraints { make in make.center.equalToSuperview() } + } + + override func bindActions() { + NotificationCenter.default.addObserver(self, selector: #selector(refreshAuthorization), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + refreshAuthorization() + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + if isBeingDismissed || navigationController?.isBeingDismissed == true { + operation?.cancel() + stopObservingLibrary() + if !hasFinished { hasFinished = true; onCancel() } + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { _, environment in + let side = (environment.container.effectiveContentSize.width - 32) / 3 + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1.0 / 3), heightDimension: .fractionalHeight(1))) + item.contentInsets = .init(top: 2, leading: 2, bottom: 2, trailing: 2) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(side)), subitems: [item]) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = .init(top: 0, leading: 14, bottom: 20, trailing: 14) + return section + } + } + + private func loadAssets(status: PHAuthorizationStatus) { + lastAuthorizationStatus = status + guard status == .authorized || status == .limited else { + assets.removeAll() + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + dataSource.apply(snapshot, animatingDifferences: true) + messageLabel.text = "请在系统设置中允许访问相册,再选择手机中的视频。" + accessButton.isHidden = false + accessButton.setTitle("打开相册权限设置", for: .normal) + return + } + accessButton.isHidden = status != .limited + accessButton.setTitle("选择更多可访问的视频", for: .normal) + let options = PHFetchOptions() + options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] + let result = PHAsset.fetchAssets(with: .video, options: options) + assets.removeAll() + var ids: [String] = [] + result.enumerateObjects { asset, _, _ in + self.assets[asset.localIdentifier] = asset + ids.append(asset.localIdentifier) + } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]); snapshot.appendItems(ids) + dataSource.apply(snapshot, animatingDifferences: true) + messageLabel.text = ids.isEmpty ? "暂无可访问的视频。请先将成片保存在本机相册,或允许访问更多视频。" : "选择一段本地成片。仅存于 iCloud 的视频不会下载;单个视频不超过 2 GB。" + } + + @objc private func refreshAuthorization() { + guard !hasFinished, isViewLoaded else { return } + let status = PHPhotoLibrary.authorizationStatus(for: .readWrite) + guard status != .notDetermined, status != lastAuthorizationStatus || status == .limited else { return } + requestLibraryRefresh() + } + + private func requestLibraryRefresh() { + guard !hasFinished, isViewLoaded else { return } + needsLibraryRefresh = true + applyPendingLibraryRefresh() + } + + private func applyPendingLibraryRefresh() { + guard needsLibraryRefresh, !hasFinished, operation == nil else { return } + needsLibraryRefresh = false + loadAssets(status: PHPhotoLibrary.authorizationStatus(for: .readWrite)) + } + + private func stopObservingLibrary() { + guard isObservingLibrary else { return } + isObservingLibrary = false + needsLibraryRefresh = false + PHPhotoLibrary.shared().unregisterChangeObserver(self) + } + + @objc private func manageAccess() { + if PHPhotoLibrary.authorizationStatus(for: .readWrite) == .limited { + PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: self) { [weak self] _ in + // 完成回调可能早于 Photos 可访问资产集合更新;后续库变化通知会再次刷新。 + Task { @MainActor [weak self] in self?.requestLibraryRefresh() } + } + } else if let url = URL(string: UIApplication.openSettingsURLString) { UIApplication.shared.open(url) } + } + + @objc private func cancel() { + operation?.cancel() + guard !hasFinished else { return } + hasFinished = true + stopObservingLibrary() + onCancel() + } +} + +extension DroneDockNearbyVideoPickerViewController: UICollectionViewDelegate { + /// 选择后仅请求本地资源;资源在云端时保留选择界面并显示原因。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard operation == nil, let id = dataSource.itemIdentifier(for: indexPath), let asset = assets[id] else { return } + spinner.startAnimating() + collection.isUserInteractionEnabled = false + messageLabel.text = "正在准备本地视频…" + operation = Task { @MainActor [weak self] in + guard let self else { return } + var failureMessage: String? + defer { + self.operation = nil + self.spinner.stopAnimating() + self.collection.isUserInteractionEnabled = true + self.applyPendingLibraryRefresh() + if let failureMessage, !self.hasFinished { self.messageLabel.text = failureMessage } + } + do { + let video = try await DroneDockNearbyVideoLoader.load(asset: asset) + guard !Task.isCancelled, !self.hasFinished else { DroneDockDeliveryVideoLoader.discard(video.url); return } + self.hasFinished = true + self.stopObservingLibrary() + self.onSelect(video) + } catch { + if !Task.isCancelled { failureMessage = error.localizedDescription } + } + } + } +} + +extension DroneDockNearbyVideoPickerViewController: PHPhotoLibraryChangeObserver { + /// Photos 回调线程不固定;只刷新本地资产元数据,导出过程中合并到结束后处理。 + nonisolated func photoLibraryDidChange(_ changeInstance: PHChange) { + Task { @MainActor [weak self] in self?.requestLibraryRefresh() } + } +} + +/// 视频网格单元,取消复用中的缩略图请求,禁止图片从云端加载。 +@MainActor +private final class NearbyVideoCell: UICollectionViewCell { + private let thumbnail = UIImageView() + private let duration = UILabel() + private var representedID: String? + private var request: PHImageRequestID = PHInvalidImageRequestID + private weak var manager: PHImageManager? + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.backgroundColor = .secondarySystemBackground + contentView.layer.cornerRadius = 8 + contentView.clipsToBounds = true + thumbnail.contentMode = .scaleAspectFill + thumbnail.clipsToBounds = true + duration.textColor = .white + duration.font = .monospacedDigitSystemFont(ofSize: 12, weight: .medium) + duration.backgroundColor = UIColor.black.withAlphaComponent(0.6) + duration.textAlignment = .center + contentView.addSubview(thumbnail); contentView.addSubview(duration) + thumbnail.snp.makeConstraints { $0.edges.equalToSuperview() } + duration.snp.makeConstraints { make in make.trailing.bottom.equalToSuperview().inset(4); make.width.greaterThanOrEqualTo(42); make.height.equalTo(20) } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + super.prepareForReuse() + if request != PHInvalidImageRequestID { manager?.cancelImageRequest(request) } + request = PHInvalidImageRequestID; representedID = nil; thumbnail.image = nil + } + + /// 只读取本地缩略图,异步回调核对资产身份,避免复用串图。 + func apply(asset: PHAsset, manager: PHImageManager) { + prepareForReuse() + self.manager = manager + representedID = asset.localIdentifier + let seconds = Int(asset.duration.rounded()) + duration.text = String(format: "%d:%02d", seconds / 60, seconds % 60) + accessibilityLabel = "视频,\(duration.text ?? "")" + thumbnail.image = UIImage(systemName: "video") + let options = PHImageRequestOptions() + options.isNetworkAccessAllowed = false + options.deliveryMode = .opportunistic + let id = asset.localIdentifier + request = manager.requestImage(for: asset, targetSize: CGSize(width: 300, height: 300), contentMode: .aspectFill, options: options) { [weak self] image, _ in + Task { @MainActor in + guard let self, self.representedID == id, let image else { return } + self.thumbnail.image = image + } + } + } +} + +/// 导出本机 Photos 资源,网络访问始终关闭,不借助系统文件提供器下载云端内容。 +enum DroneDockNearbyVideoLoader { + /// 构造明确禁用云端下载的资源参数,供资源导出及回归测试共同使用。 + static func localResourceOptions() -> PHAssetResourceRequestOptions { + DroneDockNearbyVideoResourceWriter.localResourceOptions() + } + + /// 导出当前视频资源后复用成片校验和独占文件生命周期。 + @MainActor + static func load(asset: PHAsset) async throws -> DroneDockDeliveryVideo { + let resources = PHAssetResource.assetResources(for: asset) + guard let resource = resources.first(where: { $0.type == .fullSizeVideo }) ?? resources.first(where: { $0.type == .video }) else { throw LocalVideoError.unavailable } + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("nearby-video-import-\(UUID().uuidString)", isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let name = URL(fileURLWithPath: resource.originalFilename).lastPathComponent + let url = directory.appendingPathComponent(name) + try Task.checkCancellation() + do { + try await DroneDockNearbyVideoResourceWriter.write(resource: resource, to: url) + } catch is CancellationError { throw CancellationError() } + catch let error as DroneDockFilmError { throw error } + catch { throw LocalVideoError.unavailable } + try Task.checkCancellation() + return try await DroneDockDeliveryVideoLoader.load(documentURL: url) + } + + /// 本地不可读取时明确提示,不自动退回云端获取。 + private enum LocalVideoError: LocalizedError { + case unavailable + var errorDescription: String? { "无法读取本地视频,视频可能仅存于 iCloud。请选取已完整保存在本机的视频。" } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockOrdersViewController.swift b/suixinkan/UI/DroneDock/DroneDockOrdersViewController.swift new file mode 100644 index 0000000..6560079 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockOrdersViewController.swift @@ -0,0 +1,297 @@ +import SnapKit +import UIKit + +/// 当前账号在景区内的真实拍摄订单,支持履约状态筛选与分页。 +@MainActor +final class DroneDockOrdersViewController: BaseViewController { + /// 与首页共享接口及身份范围、独立维护分页的列表状态。 + let viewModel: DroneDockOrdersViewModel + private let preparationControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let materialsControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let deliveryControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController + private let confirmationControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let taskControllerFactory: (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let countLabel = DroneDockStyle.label(size: 17, weight: .semibold) + private let descriptionLabel = DroneDockStyle.label("分配给我的全部订单,含已完成订单", size: 12, color: DroneDockStyle.secondary) + private let filterView = DroneShootingOrderFilterView() + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private var loadTask: Task? + private var operation: LoadAction? + private weak var deliverySheet: UINavigationController? + + /// 使用订单号更新同一张卡片,空态和分页入口也纳入快照。 + private enum Item: Hashable { case order(String), message, more } + /// 刷新替换整页,翻页保留已加载订单。 + private enum LoadAction: Equatable { case refresh, more, filter(DroneShootingOrderFilter) } + + /// 注入真实订单服务、拍摄准备、素材库与共用云端交付入口。 + init(viewModel: DroneDockOrdersViewModel, + preparationControllerFactory: @escaping (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController, + materialsControllerFactory: @escaping (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController, + deliveryControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil, + confirmationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + taskControllerFactory: ((Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) { + self.viewModel = viewModel + self.preparationControllerFactory = preparationControllerFactory + self.materialsControllerFactory = materialsControllerFactory + self.deliveryControllerFactory = deliveryControllerFactory ?? DroneDockDeliveryEntry.makeController + self.confirmationControllerFactory = confirmationControllerFactory ?? DroneDockConfirmationEntry.makeController + self.taskControllerFactory = taskControllerFactory ?? DroneDockShootingTaskEntry.makeController + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { loadTask?.cancel() } + + override func setupNavigationBar() { + title = "我的拍摄订单" + navigationItem.backButtonDisplayMode = .minimal + } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + countLabel.accessibilityIdentifier = "drone.orders.count" + descriptionLabel.numberOfLines = 0 + collectionView.backgroundColor = .clear + collectionView.alwaysBounceVertical = true + collectionView.accessibilityIdentifier = "drone.orders.remote.list" + collectionView.register(DroneShootingOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DroneDockOrdersStateCell.self, forCellWithReuseIdentifier: "state") + let refresh = UIRefreshControl() + refresh.tintColor = DroneDockStyle.primary + refresh.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + collectionView.refreshControl = refresh + [countLabel, descriptionLabel, filterView, collectionView].forEach(view.addSubview) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + descriptionLabel.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).offset(12) + make.leading.trailing.equalToSuperview().inset(16) + } + filterView.snp.makeConstraints { make in + make.top.equalTo(descriptionLabel.snp.bottom).offset(12) + make.leading.trailing.equalToSuperview() + make.height.equalTo(50) + } + countLabel.snp.makeConstraints { make in + make.top.equalTo(filterView.snp.bottom).offset(16) + make.leading.trailing.equalToSuperview().inset(16) + } + collectionView.snp.makeConstraints { make in + make.top.equalTo(countLabel.snp.bottom).offset(16) + make.leading.trailing.bottom.equalToSuperview() + } + } + + override func bindActions() { + filterView.onFilterSelected = { [weak self] filter in + guard let self, filter != self.viewModel.selectedFilter else { return } + self.load(.filter(filter)) + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + guard deliverySheet == nil else { return } + load(.refresh) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + guard deliverySheet == nil else { return } + loadTask?.cancel() + operation = nil + collectionView.refreshControl?.endRefreshing() + viewModel.invalidate() + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collection, path, item in + guard let self else { return nil } + if case .order(let id) = item { + let cell = collection.dequeueReusableCell(withReuseIdentifier: "order", for: path) as! DroneShootingOrderCell + if let order = self.viewModel.orders.first(where: { $0.orderID == id }) { + cell.accessibilityIdentifier = "drone.orders.order.\(id)" + cell.cardView.apply(homeOrder: order) + cell.cardView.onShootingTap = { [weak self] in self?.openShooting(orderID: id) } + cell.cardView.onMaterialsTap = { [weak self] in self?.openMaterials(orderID: id) } + cell.cardView.onDeliveryTap = { [weak self] in self?.openDelivery(orderID: id) } + cell.cardView.onConfirmationTap = { [weak self] in self?.openConfirmation(orderID: id) } + } + return cell + } + let cell = collection.dequeueReusableCell(withReuseIdentifier: "state", for: path) as! DroneDockOrdersStateCell + if item == .more { + cell.apply(message: self.viewModel.loadMoreErrorMessage, + buttonTitle: self.operation == .more ? "加载中…" : self.viewModel.loadMoreErrorMessage == nil ? "加载更多订单" : "重试加载更多", + identifier: "drone.orders.loadMore", enabled: self.operation == nil) { [weak self] in self?.load(.more) } + } else if self.operation != nil || self.viewModel.isLoading { + cell.apply(message: "正在加载拍摄订单") + } else if let error = self.viewModel.errorMessage { + cell.apply(message: "订单加载失败\n\(error)", buttonTitle: "重试", identifier: "drone.orders.retry") { [weak self] in self?.load(.refresh) } + } else { + let title = self.viewModel.selectedFilter == .all ? "暂无拍摄订单" : "暂无\(self.viewModel.selectedFilter.title)订单" + cell.apply(message: "\(title)\n请下拉刷新或切换其他分类查看") + } + return cell + } + } + + private func makeLayout() -> UICollectionViewLayout { + let size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(320)) + let item = NSCollectionLayoutItem(layoutSize: size) + let group = NSCollectionLayoutGroup.vertical(layoutSize: size, subitems: [item]) + let section = NSCollectionLayoutSection(group: group) + section.interGroupSpacing = 12 + section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 24, trailing: 16) + return UICollectionViewCompositionalLayout(section: section) + } + + private func applySnapshot(animated: Bool) { + guard dataSource != nil else { return } + let isSwitching: Bool + let filter: DroneShootingOrderFilter + if case .filter(let selected) = operation { filter = selected; isSwitching = true } + else { filter = viewModel.selectedFilter; isSwitching = false } + filterView.apply(selectedFilter: filter) + countLabel.text = !isSwitching ? viewModel.total.map { "\(filter.listTitle)(\($0))" } ?? filter.listTitle : filter.listTitle + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + snapshot.appendItems(isSwitching || viewModel.orders.isEmpty ? [.message] : viewModel.orders.map { .order($0.orderID) }) + if !isSwitching && (viewModel.hasMore || viewModel.loadMoreErrorMessage != nil || operation == .more) { + snapshot.appendItems([.more]) + } + let previous = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { previous.contains($0) }) + dataSource.apply(snapshot, animatingDifferences: animated) + } + + private func load(_ action: LoadAction) { + if action == .more { + guard operation == nil, viewModel.hasMore else { return } + } + loadTask?.cancel() + operation = action + applySnapshot(animated: false) + loadTask = Task { @MainActor [weak self] in + guard let self else { return } + switch action { + case .refresh: await self.viewModel.refresh() + case .more: await self.viewModel.loadMore() + case .filter(let filter): await self.viewModel.selectFilter(filter) + } + guard !Task.isCancelled else { return } + self.operation = nil + self.collectionView.refreshControl?.endRefreshing() + self.applySnapshot(animated: true) + if case .filter = action { + self.collectionView.setContentOffset(CGPoint(x: 0, y: -self.collectionView.adjustedContentInset.top), animated: false) + } + } + } + + /// 优先继续查看服务端选定的既有任务,无任务时才进入拍摄准备。 + private func openShooting(orderID: String) { + guard operation == nil, let order = viewModel.orders.first(where: { $0.orderID == orderID }) else { return } + if let taskID = order.activeFlightTaskID { + guard let navigationController, navigationController.topViewController === self, + presentedViewController == nil else { return } + navigationController.pushViewController(taskControllerFactory(taskID, order, viewModel.context), animated: true) + return + } + guard order.primaryAction == "start_shoot" else { + showUnavailable(order.actionTitle ?? "拍摄订单") + return + } + guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + showAlert(title: "拍摄准备", message: "缺少订单号,请刷新拍摄订单后重试") + return + } + let controller = preparationControllerFactory(order, viewModel.context) + navigationController?.pushViewController(controller, animated: true) + } + + private func showUnavailable(_ feature: String) { showAlert(title: feature, message: "该功能暂未开放") } + + private func openConfirmation(orderID: String) { + guard operation == nil, navigationController?.topViewController === self, presentedViewController == nil, + let order = viewModel.orders.first(where: { $0.orderID == orderID }), + order.hasCompletedShootingQuota, + order.canConfirm == true || order.orderStatus == 30 || order.confirmStatus == 2 else { return } + guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + showAlert(title: "订单交付确认", message: "缺少订单号,请刷新拍摄订单后重试") + return + } + navigationController?.pushViewController(confirmationControllerFactory(order, viewModel.context), animated: true) + } + + private func openDelivery(orderID: String) { + guard operation == nil, presentedViewController == nil, + let order = viewModel.orders.first(where: { $0.orderID == orderID }), + order.canDeliverFilm else { return } + let sheet = DroneDockDeliveryEntry.makeMethodSheet(order: order, context: viewModel.context, + controllerFactory: deliveryControllerFactory) { [weak self] in + guard let self, self.viewIfLoaded?.window != nil else { return } + self.load(.refresh) + } + deliverySheet = sheet + present(sheet, animated: true) + } + + private func openMaterials(orderID: String) { + guard operation == nil, let order = viewModel.orders.first(where: { $0.orderID == orderID }) else { return } + guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else { + showAlert(title: "订单素材库", message: "缺少订单号,请刷新拍摄订单后重试") + return + } + navigationController?.pushViewController(materialsControllerFactory(order, viewModel.context), animated: true) + } + + @objc private func refreshTriggered() { load(.refresh) } +} + +/// 真实订单列表的加载、空态、错误重试及分页入口。 +private final class DroneDockOrdersStateCell: UICollectionViewCell { + private let messageLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let button = UIButton(type: .system) + private var onTap: (() -> Void)? + + /// 消息与操作按钮共同撑开自适应列表行。 + override init(frame: CGRect) { + super.init(frame: frame) + messageLabel.numberOfLines = 0 + messageLabel.textAlignment = .center + button.tintColor = DroneDockStyle.primary + button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) + button.snp.makeConstraints { $0.height.equalTo(44).priority(999) } + let stack = UIStackView(arrangedSubviews: [messageLabel, button]) + stack.axis = .vertical + stack.spacing = 12 + contentView.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 20, left: 16, bottom: 20, right: 16)) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 复用时完整替换消息和操作,纯提示不占按钮空间。 + func apply(message: String?, buttonTitle: String? = nil, identifier: String? = nil, + enabled: Bool = true, onTap: (() -> Void)? = nil) { + messageLabel.text = message + messageLabel.isHidden = message == nil + button.setTitle(buttonTitle, for: .normal) + button.isHidden = buttonTitle == nil + button.isEnabled = enabled + button.accessibilityIdentifier = identifier + self.onTap = onTap + } + + @objc private func buttonTapped() { onTap?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockPaymentImageLoader.swift b/suixinkan/UI/DroneDock/DroneDockPaymentImageLoader.swift new file mode 100644 index 0000000..6d59fc0 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockPaymentImageLoader.swift @@ -0,0 +1,42 @@ +import Kingfisher +import UIKit + +/// 收款页的图片依赖;只读取后端小程序码图片,不生成普通二维码或改变图片内容。 +@MainActor +protocol DroneDockPaymentImageLoading: AnyObject { + /// 加载原尺寸图片;强制刷新用于用户重试同一图片地址,完成回调始终在主线程。 + func loadImage(from url: URL, forceRefresh: Bool, + completion: @escaping @MainActor @Sendable (Result) -> Void) + /// 取消当前图片传输,调用方仍需拒绝已排队的旧回调。 + func cancel() +} + +/// 使用通用 Kingfisher 缓存与下载能力获取付款小程序码原图。 +@MainActor +final class DroneDockPaymentImageLoader: DroneDockPaymentImageLoading { + private var task: DownloadTask? + + deinit { task?.cancel() } + + /// 图片不经过裁剪或缩小处理,展示与保存使用同一份服务端图片。 + func loadImage(from url: URL, forceRefresh: Bool, + completion: @escaping @MainActor @Sendable (Result) -> Void) { + cancel() + var options: KingfisherOptionsInfo = [.callbackQueue(.mainCurrentOrAsync)] + if forceRefresh { options.append(.forceRefresh) } + task = KingfisherManager.shared.retrieveImage(with: url, options: options) { result in + Task { @MainActor in + switch result { + case .success(let value): completion(.success(value.image)) + case .failure(let error): completion(.failure(error)) + } + } + } + } + + /// 停止网络下载;缓存命中等已完成回调由页面请求代次拦截。 + func cancel() { + task?.cancel() + task = nil + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockPaymentViewController.swift b/suixinkan/UI/DroneDock/DroneDockPaymentViewController.swift new file mode 100644 index 0000000..9522738 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockPaymentViewController.swift @@ -0,0 +1,702 @@ +import SnapKit +import UIKit + +/// 独立机巢套餐收款页,展示后端小程序码图片并通过收款记录核对到账。 +@MainActor +final class DroneDockPaymentViewController: BaseViewController { + /// 当前账号范围内的套餐与付款码状态。 + let viewModel: DroneDockPaymentViewModel + private let service: any DroneDockPaymentServing + private let currentContext: @MainActor @Sendable () -> DroneDockHomeContext + private let imageLoader: any DroneDockPaymentImageLoading + private var requestTask: Task? + private var hasLoaded = false + private var isLoadingProjectRequest = false + private var isUpdatingCode = false + private var hasLeftPaymentFlow = false + private var requestedProjectID: Int? + private var requestedPrice: String? + private var renderedURL: String? + private var imageGeneration = 0 + private var imageContext: DroneDockHomeContext? + private var isLoadingImage = false + private var imageError: String? + private var amountDialog: PaymentSetAmountDialogView? + private var amountDraft = "" + private let scrollView = UIScrollView() + private let content = UIStackView() + private let scenicLabel = DroneDockStyle.label(size: 18, weight: .semibold) + private let projectButton = UIButton(type: .system) + private let projectNameLabel = DroneDockStyle.label("请选择", size: 14, weight: .medium, color: DroneDockStyle.primary) + private let projectCountLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let amountLabel = DroneDockStyle.label(size: 26, weight: .semibold) + private let qrImageView = UIImageView() + private let qrContainer = UIView() + private let placeholder = UIStackView() + private let placeholderIcon = UIImageView(image: UIImage(systemName: "qrcode")) + private let placeholderTitle = DroneDockStyle.label(size: 15, weight: .medium) + private let placeholderDetail = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let retryButton = UIButton(type: .system) + private let reloadImageButton = UIButton(type: .system) + private let retryProjectsButton = UIButton(type: .system) + private let spinner = UIActivityIndicatorView(style: .medium) + private let paymentHint = DroneDockStyle.label("请游客使用微信扫码,到账后核对收款记录\n付款码有效 7 天,失效时请重新生成", size: 11, color: DroneDockStyle.secondary) + private let setAmountButton = UIButton(type: .system) + private let saveButton = UIButton(type: .system) + private let recordsButton = UIButton(type: .system) + private let staffValue = DroneDockStyle.label(size: 13) + private let merchantValue = DroneDockStyle.label(size: 13) + private let scenicValue = DroneDockStyle.label(size: 13) + private let voiceSwitch = UISwitch() + + /// 使用当前会话和统一网络客户端进入真实套餐收款。 + convenience init() { + let service = DroneDockPaymentAPI(client: NetworkServices.shared.apiClient) + self.init(viewModel: DroneDockPaymentViewModel(context: Self.currentPaymentContext(), service: service, + currentContext: { Self.currentPaymentContext() }), + service: service, currentContext: { Self.currentPaymentContext() }) + } + + /// 注入服务和身份来源,测试可完全隔离真实账户及网络。 + init(viewModel: DroneDockPaymentViewModel, service: any DroneDockPaymentServing, + currentContext: (@MainActor @Sendable () -> DroneDockHomeContext)? = nil, + imageLoader: (any DroneDockPaymentImageLoading)? = nil) { + self.viewModel = viewModel + self.service = service + let context = viewModel.context + self.currentContext = currentContext ?? { context } + self.imageLoader = imageLoader ?? DroneDockPaymentImageLoader() + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { requestTask?.cancel() } + + override func setupNavigationBar() { + title = "收款详情" + navigationItem.backButtonDisplayMode = .minimal + } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + scrollView.alwaysBounceVertical = true + content.axis = .vertical + content.spacing = 14 + view.addSubview(scrollView) + scrollView.addSubview(content) + content.addArrangedSubview(makePaymentCard()) + content.addArrangedSubview(makeInformationCard()) + configureButton(recordsButton, title: "收款记录", identifier: "drone.payment.records", action: #selector(recordsTapped)) + recordsButton.contentHorizontalAlignment = .leading + var recordConfig = UIButton.Configuration.plain() + recordConfig.title = "收款记录" + recordConfig.contentInsets = NSDirectionalEdgeInsets(top: 16, leading: 16, bottom: 16, trailing: 16) + recordsButton.configuration = recordConfig + recordsButton.tintColor = DroneDockStyle.text + let recordsChevron = UIImageView(image: UIImage(systemName: "chevron.right")) + recordsChevron.tintColor = DroneDockStyle.secondary + recordsChevron.contentMode = .scaleAspectFit + recordsButton.addSubview(recordsChevron) + recordsChevron.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(16) + make.centerY.equalToSuperview() + make.width.equalTo(12) + make.height.equalTo(16) + } + DroneDockStyle.applyCard(to: recordsButton) + content.addArrangedSubview(recordsButton) + let voice = UIStackView(arrangedSubviews: [DroneDockStyle.label("收款到账语音提醒", size: 14), UIView(), voiceSwitch]) + voice.alignment = .center + voiceSwitch.onTintColor = DroneDockStyle.primary + voiceSwitch.isOn = AppStore.shared.payment.isOpenReceiveVoice + voiceSwitch.addTarget(self, action: #selector(voiceChanged), for: .valueChanged) + content.addArrangedSubview(card(voice, insets: 16)) + let offline = UIStackView() + offline.axis = .vertical + offline.spacing = 12 + offline.addArrangedSubview(DroneDockStyle.label("线下收款", size: 16, weight: .semibold)) + let register = UIButton(type: .system) + register.setTitle("去登记 ›", for: .normal) + register.addTarget(self, action: #selector(offlineTapped), for: .touchUpInside) + let offlineRow = UIStackView(arrangedSubviews: [DroneDockStyle.label("线下收款登记", size: 14), UIView(), register]) + offlineRow.alignment = .center + offline.addArrangedSubview(offlineRow) + content.addArrangedSubview(card(offline, insets: 16)) + applyState() + } + + override func setupConstraints() { + scrollView.snp.makeConstraints { $0.edges.equalTo(view.safeAreaLayoutGuide) } + content.snp.makeConstraints { make in + make.edges.equalTo(scrollView.contentLayoutGuide).inset(16) + make.width.equalTo(scrollView.frameLayoutGuide).offset(-32) + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + hasLeftPaymentFlow = false + if !hasLoaded || !viewModel.context.hasSameIdentity(as: currentContext()) { + requestedProjectID = nil + requestedPrice = nil + loadProjects() + } + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // 底部弹层和记录页返回时保留已选套餐;离开收款流程才取消正在进行的请求。 + if isMovingFromParent || navigationController?.isBeingDismissed == true { + finishPaymentFlow() + } + } + + override func didMove(toParent parent: UIViewController?) { + super.didMove(toParent: parent) + // 页面已被记录页等覆盖时,从导航栈移除不一定再次触发消失回调。 + if parent == nil { finishPaymentFlow() } + } + + /// 退出时只清理一次;拦截图片迟到回调,并允许页面之后重新进入时重新加载。 + private func finishPaymentFlow() { + guard !hasLeftPaymentFlow else { return } + hasLeftPaymentFlow = true + requestTask?.cancel() + requestTask = nil + clearImage() + viewModel.invalidate() + hasLoaded = false + isUpdatingCode = false + isLoadingProjectRequest = false + requestedProjectID = nil + requestedPrice = nil + applyState() + } + + private func makePaymentCard() -> UIView { + let stack = UIStackView() + stack.axis = .vertical + stack.spacing = 16 + scenicLabel.textAlignment = .center + stack.addArrangedSubview(scenicLabel) + configureButton(projectButton, title: "", identifier: "drone.payment.projectPicker", action: #selector(selectProject)) + let projectCaption = DroneDockStyle.label("航拍套餐", size: 13, color: DroneDockStyle.secondary) + let projectChevron = UIImageView(image: UIImage(systemName: "chevron.right")) + projectChevron.tintColor = DroneDockStyle.secondary + projectChevron.contentMode = .scaleAspectFit + projectNameLabel.textAlignment = .right + projectNameLabel.numberOfLines = 2 + projectCountLabel.textAlignment = .right + let projectTitles = UIStackView(arrangedSubviews: [projectNameLabel, projectCountLabel]) + projectTitles.axis = .vertical + projectTitles.alignment = .trailing + projectTitles.spacing = 4 + projectTitles.isUserInteractionEnabled = false + [projectCaption, projectChevron, projectTitles].forEach(projectButton.addSubview) + projectCaption.snp.makeConstraints { make in make.leading.centerY.equalToSuperview() } + projectChevron.snp.makeConstraints { make in + make.trailing.centerY.equalToSuperview() + make.size.equalTo(CGSize(width: 10, height: 14)) + } + projectTitles.snp.makeConstraints { make in + make.leading.greaterThanOrEqualTo(projectCaption.snp.trailing).offset(12) + make.trailing.equalTo(projectChevron.snp.leading).offset(-10) + make.centerY.equalToSuperview() + make.top.greaterThanOrEqualToSuperview().offset(6) + make.bottom.lessThanOrEqualToSuperview().offset(-6) + } + projectButton.snp.makeConstraints { $0.height.greaterThanOrEqualTo(54) } + stack.addArrangedSubview(line()) + stack.addArrangedSubview(projectButton) + stack.addArrangedSubview(line()) + amountLabel.textAlignment = .center + amountLabel.accessibilityIdentifier = "drone.payment.amount" + stack.addArrangedSubview(amountLabel) + stack.addArrangedSubview(qrContainer) + qrContainer.snp.makeConstraints { $0.height.equalTo(230) } + qrImageView.contentMode = .scaleAspectFit + qrImageView.accessibilityIdentifier = "drone.payment.qr" + qrImageView.isAccessibilityElement = true + qrImageView.accessibilityLabel = "套餐付款小程序码" + qrContainer.addSubview(qrImageView) + qrImageView.snp.makeConstraints { make in make.center.equalToSuperview(); make.size.equalTo(220) } + placeholder.axis = .vertical + placeholder.alignment = .center + placeholder.spacing = 12 + placeholderIcon.tintColor = DroneDockStyle.secondary.withAlphaComponent(0.65) + placeholderIcon.contentMode = .scaleAspectFit + placeholderIcon.snp.makeConstraints { $0.size.equalTo(40) } + placeholderDetail.numberOfLines = 0 + placeholderDetail.textAlignment = .center + placeholderTitle.numberOfLines = 0 + placeholderTitle.textAlignment = .center + [placeholderIcon, spinner, placeholderTitle, placeholderDetail, reloadImageButton, retryButton, retryProjectsButton].forEach(placeholder.addArrangedSubview) + qrContainer.addSubview(placeholder) + placeholder.snp.makeConstraints { make in + make.center.equalToSuperview() + make.leading.trailing.equalToSuperview().inset(4) + } + configureButton(retryButton, title: "重新生成", identifier: "drone.payment.retryCode", action: #selector(retryCode)) + configureButton(reloadImageButton, title: "重新加载图片", identifier: "drone.payment.reloadImage", action: #selector(reloadImage)) + configureButton(retryProjectsButton, title: "重新加载套餐", identifier: "drone.payment.retryProjects", action: #selector(retryProjects)) + paymentHint.numberOfLines = 0 + paymentHint.textAlignment = .center + stack.addArrangedSubview(paymentHint) + configureButton(setAmountButton, title: "设置金额", identifier: "drone.payment.setAmount", action: #selector(setAmountTapped)) + configureButton(saveButton, title: "保存二维码", identifier: "drone.payment.saveQR", action: #selector(saveTapped)) + let actions = UIStackView(arrangedSubviews: [setAmountButton, saveButton]) + actions.distribution = .fillEqually + actions.snp.makeConstraints { $0.height.equalTo(44) } + stack.addArrangedSubview(actions) + return card(stack, insets: 18) + } + + private func makeInformationCard() -> UIView { + let stack = UIStackView() + stack.axis = .vertical + stack.spacing = 14 + stack.addArrangedSubview(infoRow("景区名称", value: scenicValue)) + stack.addArrangedSubview(line()) + merchantValue.accessibilityIdentifier = "drone.payment.merchant" + staffValue.accessibilityIdentifier = "drone.payment.staff" + stack.addArrangedSubview(infoRow("收款方", value: merchantValue)) + stack.addArrangedSubview(line()) + stack.addArrangedSubview(infoRow("员工 ID", value: staffValue)) + return card(stack, insets: 16) + } + + private func infoRow(_ title: String, value: UILabel) -> UIView { + value.numberOfLines = 2 + value.textAlignment = .right + let caption = DroneDockStyle.label(title, size: 13, color: DroneDockStyle.secondary) + caption.setContentCompressionResistancePriority(.required, for: .horizontal) + let row = UIStackView(arrangedSubviews: [caption, UIView(), value]) + row.spacing = 12 + row.alignment = .center + row.snp.makeConstraints { $0.height.greaterThanOrEqualTo(26) } + return row + } + + private func card(_ child: UIView, insets: CGFloat) -> UIView { + let view = UIView() + DroneDockStyle.applyCard(to: view) + view.addSubview(child) + child.snp.makeConstraints { $0.edges.equalToSuperview().inset(insets) } + return view + } + + private func line() -> UIView { + let line = UIView() + line.backgroundColor = DroneDockStyle.border + line.snp.makeConstraints { $0.height.equalTo(0.5) } + return line + } + + private func configureButton(_ button: UIButton, title: String, identifier: String, action: Selector) { + button.setTitle(title, for: .normal) + button.titleLabel?.font = .systemFont(ofSize: 14) + button.tintColor = DroneDockStyle.primary + button.accessibilityIdentifier = identifier + button.addTarget(self, action: action, for: .touchUpInside) + } + + private func applyState() { + guard isViewLoaded else { return } + let busy = isUpdatingCode || viewModel.isGenerating || viewModel.isLoadingProjects || isLoadingProjectRequest + let hasCurrentContext = viewModel.context.hasSameIdentity(as: currentContext()) + let code = !busy && hasCurrentContext ? viewModel.payCode : nil + if let code, renderedURL != code.payURL { + // 新报价可能复用图片地址,必须重新取图,不能命中上一付款短码的缓存。 + loadCodeImage(code, forceRefresh: true) + } else if code == nil, renderedURL != nil || isLoadingImage || qrImageView.image != nil || imageError != nil { + clearImage() + } + scenicLabel.text = viewModel.context.scenicName.isEmpty ? "当前景区" : viewModel.context.scenicName + scenicValue.text = scenicLabel.text + let selected = viewModel.projects.first { $0.id == (code?.projectID ?? requestedProjectID) } + let name = code?.projectName ?? selected?.name + let count = code?.shootCount ?? selected?.shootCount + projectNameLabel.text = name ?? "请选择" + projectCountLabel.text = count.map { "含 \($0) 次拍摄" } + projectCountLabel.isHidden = count == nil + projectButton.accessibilityLabel = "航拍套餐," + (name ?? "请选择") + projectButton.isEnabled = !isLoadingProjectRequest && !viewModel.isLoadingProjects && !isUpdatingCode + amountLabel.isHidden = code == nil + amountLabel.text = code.map { "本次收款 ¥\(Self.money($0.price))" } + merchantValue.text = PaymentMerchantInfo.defaultInfo.company + staffValue.text = hasCurrentContext ? DroneDockHomeMetric.usableText(viewModel.context.userID) ?? "—" : "—" + let showingProgress = busy || isLoadingImage + if showingProgress { spinner.startAnimating() } else { spinner.stopAnimating() } + spinner.isHidden = !showingProgress + placeholderIcon.isHidden = showingProgress + retryButton.isHidden = viewModel.payCodeError == nil || busy || requestedProjectID == nil + reloadImageButton.isHidden = imageError == nil || code == nil || showingProgress + retryProjectsButton.isHidden = busy || (viewModel.projectError == nil && !viewModel.projects.isEmpty) + if isUpdatingCode || viewModel.isGenerating { + placeholderTitle.text = "正在生成收款码…" + placeholderDetail.text = "请稍候" + } else if viewModel.isLoadingProjects || isLoadingProjectRequest { + placeholderTitle.text = "正在加载套餐…" + placeholderDetail.text = "请稍候" + } else if let error = viewModel.payCodeError ?? viewModel.projectError { + placeholderTitle.text = viewModel.payCodeError != nil ? "收款码生成失败" : "套餐加载失败" + placeholderDetail.text = error + } else if isLoadingImage { + placeholderTitle.text = "正在加载小程序码…" + placeholderDetail.text = "请稍候" + } else if let imageError { + placeholderTitle.text = "小程序码图片加载失败" + placeholderDetail.text = imageError + } else if viewModel.projects.isEmpty && hasLoaded { + placeholderTitle.text = "暂无可售套餐" + placeholderDetail.text = "请联系管理员配置航拍套餐" + } else { + placeholderTitle.text = "请选择航拍套餐" + placeholderDetail.text = "选择后生成对应套餐收款码" + } + let hasImage = code != nil && renderedURL == code?.payURL && qrImageView.image != nil + && !isLoadingImage && imageContext?.hasSameIdentity(as: currentContext()) == true + qrImageView.isHidden = !hasImage + placeholder.isHidden = hasImage + paymentHint.isHidden = code == nil + setAmountButton.isEnabled = code != nil + saveButton.isEnabled = hasImage + setAmountButton.alpha = code != nil ? 1 : 0.4 + saveButton.alpha = hasImage ? 1 : 0.4 + } + + /// 每次报价或图片重试使用新代次,防止同地址的旧图片回调覆盖当前收款状态。 + private func loadCodeImage(_ code: DroneDockPayCode, forceRefresh: Bool) { + clearImage() + renderedURL = code.payURL + let context = viewModel.context + imageContext = context + guard let url = URL(string: code.payURL) else { + imageError = "图片地址无效,请重新生成" + return + } + isLoadingImage = true + let generation = imageGeneration + imageLoader.loadImage(from: url, forceRefresh: forceRefresh) { [weak self] result in + guard let self, self.imageGeneration == generation, + self.renderedURL == code.payURL, self.viewModel.payCode == code, + !self.isUpdatingCode, !self.isLoadingProjectRequest else { return } + guard context.hasSameIdentity(as: self.currentContext()), + context.hasSameIdentity(as: self.viewModel.context) else { + self.clearImage() + self.viewModel.invalidate() + self.requestedProjectID = nil + self.requestedPrice = nil + self.loadProjects() + return + } + self.isLoadingImage = false + switch result { + case .success(let image): + self.qrImageView.image = image + self.imageError = nil + case .failure: + self.qrImageView.image = nil + self.imageError = "请检查网络后重新加载,持续失败可重新生成" + } + self.applyState() + #if DEBUG + Task { @MainActor [weak self] in await self?.captureIfRequested() } + #endif + } + } + + /// 清除当前像素与图片请求;保存入口不能保留上一套餐或上一报价的码。 + private func clearImage() { + imageGeneration &+= 1 + imageLoader.cancel() + renderedURL = nil + imageContext = nil + isLoadingImage = false + imageError = nil + qrImageView.image = nil + } + + private func loadProjects() { + requestTask?.cancel() + isUpdatingCode = false + isLoadingProjectRequest = true + applyState() + requestTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.loadProjects() + guard !Task.isCancelled else { return } + self.isLoadingProjectRequest = false + self.hasLoaded = true + self.applyState() + #if DEBUG + if ProcessInfo.processInfo.arguments.contains("--dock-payment-probe"), + self.viewModel.payCode == nil, let first = self.viewModel.projects.first { + self.requestedProjectID = first.id + self.requestedPrice = nil + self.isUpdatingCode = true + self.applyState() + await self.viewModel.generateCode(projectID: first.id, price: nil) + self.isUpdatingCode = false + self.applyState() + } + await self.captureIfRequested() + #endif + } + } + + private func generateCode(projectID: Int, price: String?) { + requestTask?.cancel() + requestedProjectID = projectID + requestedPrice = price + isUpdatingCode = true + applyState() + requestTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.generateCode(projectID: projectID, price: price) + guard !Task.isCancelled else { return } + self.isUpdatingCode = false + self.applyState() + #if DEBUG + await self.captureIfRequested() + #endif + } + } + + @objc private func selectProject() { + guard !viewModel.projects.isEmpty else { + if viewModel.projectError != nil { loadProjects() } + else { showAlert(title: "暂无可售套餐", message: "请联系管理员配置航拍套餐") } + return + } + let picker = DroneDockProjectPickerViewController(projects: viewModel.projects, + selectedID: viewModel.payCode?.projectID ?? requestedProjectID, + scenicName: viewModel.context.scenicName) + picker.onConfirm = { [weak self] project in self?.generateCode(projectID: project.id, price: nil) } + let navigation = UINavigationController(rootViewController: picker) + if let sheet = navigation.sheetPresentationController { + sheet.detents = [.medium(), .large()] + sheet.prefersGrabberVisible = true + } + present(navigation, animated: true) + } + + @objc private func retryProjects() { loadProjects() } + @objc private func retryCode() { + guard let id = requestedProjectID else { return } + generateCode(projectID: id, price: requestedPrice) + } + + @objc private func reloadImage() { + guard let code = viewModel.payCode, !isUpdatingCode, !isLoadingProjectRequest, + viewModel.context.hasSameIdentity(as: currentContext()) else { + loadProjects() + return + } + loadCodeImage(code, forceRefresh: true) + applyState() + } + + @objc private func setAmountTapped() { + guard let code = viewModel.payCode, !isUpdatingCode else { return } + guard viewModel.context.hasSameIdentity(as: currentContext()) else { + loadProjects() + return + } + amountDraft = Self.money(code.price) + let dialog = PaymentSetAmountDialogView() + dialog.configureAmountOnly(accessibilityPrefix: "drone.payment.amount") + dialog.apply(amount: amountDraft, remark: "") + dialog.onAmountChange = { [weak self] value in self?.amountDraft = value } + dialog.onCancel = { [weak self, weak dialog] in dialog?.dismiss(); self?.amountDialog = nil } + dialog.onConfirm = { [weak self, weak dialog] in + guard let self else { return } + if let error = DroneDockPriceValidator.validationMessage(for: self.amountDraft) { + self.showToast(error) + return + } + guard let price = DroneDockPriceValidator.normalizedPrice(self.amountDraft) else { return } + dialog?.dismiss() + self.amountDialog = nil + self.generateCode(projectID: code.projectID, price: price) + } + amountDialog = dialog + dialog.show(in: view) + } + + @objc private func saveTapped() { + guard viewModel.context.hasSameIdentity(as: currentContext()), + imageContext?.hasSameIdentity(as: currentContext()) == true else { + loadProjects() + return + } + guard !isLoadingImage, !isUpdatingCode, !isLoadingProjectRequest, + renderedURL == viewModel.payCode?.payURL, + let image = qrImageView.image, !qrImageView.isHidden else { return } + let generation = imageGeneration + Task { @MainActor [weak self] in + guard let self, self.imageGeneration == generation, + self.imageContext?.hasSameIdentity(as: self.currentContext()) == true else { return } + let success = await PhotoLibrarySaver.saveImage(image) + self.showToast(success ? "保存成功" : "保存失败") + } + } + + @objc private func recordsTapped() { navigationController?.pushViewController(makeReceiptsController(), animated: true) } + @objc private func voiceChanged() { AppStore.shared.payment.isOpenReceiveVoice = voiceSwitch.isOn } + @objc private func offlineTapped() { navigationController?.pushViewController(OfflineCollectionRegistrationViewController(), animated: true) } + + /// 进入真实收款记录;不将最近一条记录推断为本次二维码的支付结果。 + func makeReceiptsController(projectID: Int? = nil) -> DroneDockReceiptsViewController { + let contextProvider = currentContext + return DroneDockReceiptsViewController(viewModel: DroneDockReceiptsViewModel(context: viewModel.context, service: service, + currentContext: { contextProvider() }, projectID: projectID)) + } + + /// 用十进制两位金额展示,不用浮点参与报价计算。 + private static func money(_ value: Decimal) -> String { + let formatter = NumberFormatter() + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.numberStyle = .decimal + formatter.usesGroupingSeparator = false + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + return formatter.string(from: NSDecimalNumber(decimal: value)) ?? "—" + } + + /// 从当前登录会话读取身份,不改变账号、景区或门店。 + private static func currentPaymentContext() -> DroneDockHomeContext { + let session = AppStore.shared.session + return DroneDockHomeContext(userID: session.userId, accountType: session.accountType.rawValue, + scenicID: session.currentScenicId, scenicName: session.currentScenicName, + storeID: session.currentStoreId, photographerName: session.userName, token: session.token) + } + + #if DEBUG + /// 显式联调参数下只保存本应用窗口,不采集其他 App 或系统屏幕。 + private func captureIfRequested() async { + guard ProcessInfo.processInfo.arguments.contains("--dock-payment-capture") else { return } + try? await Task.sleep(nanoseconds: 400_000_000) + guard !Task.isCancelled, let window = view.window else { return } + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + do { + let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] + .appendingPathComponent("DroneDockPaymentDiagnostics", isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + try image.pngData()?.write(to: directory.appendingPathComponent("payment.png"), options: .atomic) + print("[DroneDockPayment] App window screenshot saved") + } catch { print("[DroneDockPayment] Screenshot failed: \(error.localizedDescription)") } + } + #endif +} + +/// 套餐单选弹层,取消时保留原选择,确认后才向服务端请求付款小程序码。 +private final class DroneDockProjectPickerViewController: BaseViewController, UITableViewDelegate { + /// 仅用户确认当前候选套餐后通知收款页。 + var onConfirm: ((DroneDockProject) -> Void)? + private let projects: [DroneDockProject] + private var selectedID: Int? + private let scenicName: String + private let tableView = UITableView(frame: .zero, style: .insetGrouped) + private var dataSource: UITableViewDiffableDataSource! + private let confirmButton = UIButton(type: .system) + private let cancelButton = UIButton(type: .system) + private let footer = UIView() + + /// 冻结本次选择列表及原套餐,列表点击不产生收款请求。 + init(projects: [DroneDockProject], selectedID: Int?, scenicName: String) { + self.projects = projects + self.selectedID = selectedID + self.scenicName = scenicName + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { title = "选择航拍套餐" } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + tableView.backgroundColor = .clear + tableView.rowHeight = 78 + tableView.delegate = self + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "project") + let scenicHeader = DroneDockStyle.label(" " + scenicName, size: 13, color: DroneDockStyle.secondary) + scenicHeader.frame = CGRect(x: 0, y: 0, width: 320, height: 36) + tableView.tableHeaderView = scenicHeader + view.addSubview(tableView) + view.addSubview(footer) + let note = DroneDockStyle.label("选择套餐后可调整成交价,拍摄次数不变。", size: 12, color: DroneDockStyle.secondary) + note.numberOfLines = 0 + cancelButton.setTitle("取消", for: .normal) + confirmButton.setTitle("确认套餐", for: .normal) + cancelButton.accessibilityIdentifier = "drone.payment.cancelProject" + confirmButton.accessibilityIdentifier = "drone.payment.confirmProject" + cancelButton.addTarget(self, action: #selector(cancel), for: .touchUpInside) + confirmButton.addTarget(self, action: #selector(confirm), for: .touchUpInside) + cancelButton.backgroundColor = .white + confirmButton.backgroundColor = DroneDockStyle.primary + confirmButton.setTitleColor(.white, for: .normal) + [cancelButton, confirmButton].forEach { $0.layer.cornerRadius = 10 } + let buttons = UIStackView(arrangedSubviews: [cancelButton, confirmButton]) + buttons.distribution = .fillEqually + buttons.spacing = 12 + buttons.snp.makeConstraints { $0.height.equalTo(46) } + let stack = UIStackView(arrangedSubviews: [note, buttons]) + stack.axis = .vertical + stack.spacing = 16 + footer.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(16) } + dataSource = UITableViewDiffableDataSource(tableView: tableView) { [weak self] table, path, id in + guard let self, let project = self.projects.first(where: { $0.id == id }) else { return nil } + let cell = table.dequeueReusableCell(withIdentifier: "project", for: path) + var config = cell.defaultContentConfiguration() + config.text = project.name + config.secondaryText = "含 \(project.shootCount) 次拍摄 ¥\(NSDecimalNumber(decimal: project.price).stringValue)" + config.textProperties.font = .systemFont(ofSize: 15, weight: .medium) + config.secondaryTextProperties.color = DroneDockStyle.secondary + cell.contentConfiguration = config + cell.accessoryType = id == self.selectedID ? .checkmark : .none + cell.tintColor = DroneDockStyle.primary + cell.accessibilityIdentifier = "drone.payment.project.\(id)" + return cell + } + applySelection() + } + + override func setupConstraints() { + footer.snp.makeConstraints { make in make.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) } + tableView.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.bottom.equalTo(footer.snp.top) + } + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + selectedID = dataSource.itemIdentifier(for: indexPath) + applySelection() + } + + private func applySelection() { + confirmButton.isEnabled = selectedID != nil + confirmButton.alpha = selectedID == nil ? 0.4 : 1 + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + snapshot.appendItems(projects.map(\.id)) + let existing = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existing.contains($0) }) + dataSource.apply(snapshot, animatingDifferences: true) + } + + @objc private func cancel() { dismiss(animated: true) } + @objc private func confirm() { + guard let project = projects.first(where: { $0.id == selectedID }) else { return } + let completion = onConfirm + dismiss(animated: true) { completion?(project) } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockPreview.swift b/suixinkan/UI/DroneDock/DroneDockPreview.swift new file mode 100644 index 0000000..6d5193a --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockPreview.swift @@ -0,0 +1,156 @@ +import UIKit + +#if DEBUG +/// Debug 页面入口:本地演示与使用当前登录身份的真实首页联调分别进入。 +@MainActor +enum DroneDockPreview { + /// 启动参数存在时返回预览导航,正常冷启动继续使用原业务根页面。 + static func navigationController(arguments: [String]) -> UINavigationController? { + if let confirmation = DroneDockConfirmationSimulation.makeController(arguments: arguments) { + return UINavigationController(rootViewController: confirmation) + } + if arguments.contains("--dock-nearby-preview") { + if arguments.contains("--dock-nearby-library") { + return UINavigationController(rootViewController: DroneDockNearbyTransferViewController( + customerTitle: "本地相册测试 · 非游客订单")) + } + let nearby = DroneDockNearbyTransferViewController(customerTitle: "本地测试视频 · 非游客订单", videoPicker: { + guard let source = Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock") else { + throw DroneDockFilmError.invalidLocalFile + } + return try await DroneDockDeliveryVideoLoader.load(documentURL: source) + }) + return UINavigationController(rootViewController: nearby) + } + if let materials = DroneDockMaterialsSimulation.makeController(arguments: arguments) { + return UINavigationController(rootViewController: materials) + } + if let simulation = DroneDockStartShootSimulation.makeController(arguments: arguments) { + return UINavigationController(rootViewController: simulation) + } + // 仅打开已存在任务进行只读联调;不经过创建或召唤流程。 + if let taskArgument = arguments.first(where: { $0.hasPrefix("--dock-task-live=") }), + let taskID = Int(taskArgument.dropFirst("--dock-task-live=".count)), taskID > 0, + let orderArgument = arguments.first(where: { $0.hasPrefix("--dock-task-order=") }), + AppStore.shared.session.isLoggedIn { + let number = String(orderArgument.dropFirst("--dock-task-order=".count)).trimmingCharacters(in: .whitespacesAndNewlines) + if !number.isEmpty, + let data = try? JSONEncoder().encode(["order_number": number]), + let order = try? JSONDecoder().decode(DroneDockHomeOrder.self, from: data) { + let task = DroneDockShootingTaskEntry.makeController(taskID: taskID, order: order, + context: DroneDockHomeViewController.currentContext()) + let navigation = UINavigationController() + navigation.setViewControllers([DroneDockHomeViewController(), task], animated: false) + return navigation + } + } + if let argument = arguments.first(where: { $0.hasPrefix("--dock-delivery-live=") }), AppStore.shared.session.isLoggedIn { + let number = String(argument.dropFirst("--dock-delivery-live=".count)) + if let data = try? JSONEncoder().encode(["order_number": number]), + let order = try? JSONDecoder().decode(DroneDockHomeOrder.self, from: data) { + let home = DroneDockHomeViewController() + let delivery = DroneDockDeliveryEntry.makeController(order: order, context: DroneDockHomeViewController.currentContext(), taskID: nil) + let navigation = UINavigationController() + navigation.setViewControllers([home, delivery], animated: false) + return navigation + } + } + if (arguments.contains("--dock-payment-live") || arguments.contains("--dock-receipts-live")), AppStore.shared.session.isLoggedIn { + let home = DroneDockHomeViewController() + let payment = DroneDockPaymentViewController() + let navigation = UINavigationController() + if arguments.contains("--dock-receipts-live") { + navigation.setViewControllers([home, payment, payment.makeReceiptsController()], animated: false) + } else { + navigation.setViewControllers([home, payment], animated: false) + } + return navigation + } + if arguments.contains("--dock-home-live"), AppStore.shared.session.isLoggedIn { + // 显式联调既有任务,只读取 shooting,避免为检查响应额外创建订单任务。 + if let argument = arguments.first(where: { $0.hasPrefix("--dock-shooting-probe=") }), + let taskID = Int(argument.dropFirst("--dock-shooting-probe=".count)), taskID > 0 { + Task { @MainActor in + do { + _ = try await DroneDockShootingAPI(client: NetworkServices.shared.apiClient) + .shooting(taskID: taskID, liveBattery: true) + } catch { + print("[DroneDockShooting] Existing task read failed: \(error.localizedDescription)") + } + } + } + return UINavigationController(rootViewController: DroneDockHomeViewController()) + } + let entryFlags = ["--dock-ui-preview", "--dock-ui-orders-preview", "--dock-ui-preparation-preview", "--dock-ui-task-preview", "--dock-ui-materials-preview", "--dock-ui-delivery-preview", "--dock-ui-delivery-review-preview"] + guard arguments.contains(where: { entryFlags.contains($0) }) else { return nil } + let store = DroneDockDemoStore() + if let argument = arguments.first(where: { $0.hasPrefix("--dock-ui-scenario=") }), + let scenario = DroneDockDemoScenario(rawValue: String(argument.dropFirst("--dock-ui-scenario=".count))) { + store.applyScenario(scenario) + } + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let navigation = UINavigationController(rootViewController: workbench) + if arguments.contains("--dock-ui-orders-preview") { + let filterArgument = arguments.first { $0.hasPrefix("--dock-ui-filter=") } + let filter = filterArgument.flatMap { DroneShootingOrderFilter(rawValue: String($0.dropFirst("--dock-ui-filter=".count))) } ?? .all + let orders = DroneShootingOrdersViewController(viewModel: DroneShootingOrdersViewModel(store: store, initialFilter: filter)) + orders.delegate = workbench + navigation.setViewControllers([workbench, orders], animated: false) + } + if arguments.contains("--dock-ui-preparation-preview") || arguments.contains("--dock-ui-task-preview") { + guard let order = store.orders.first(where: { $0.activeTask != nil }) + ?? store.orders.first(where: { $0.id.hasSuffix("-order-2") }) else { return navigation } + let preparationViewModel = DroneShootingPreparationViewModel(store: store, orderID: order.id) + if let argument = arguments.first(where: { $0.hasPrefix("--dock-preparation-scenario=") }), + let scenario = DroneShootingPreparationScenario(rawValue: String(argument.dropFirst("--dock-preparation-scenario=".count))) { + preparationViewModel.applyScenario(scenario) + } + let preparation = DroneShootingPreparationViewController(viewModel: preparationViewModel) + preparation.delegate = workbench + var controllers: [UIViewController] = [workbench, preparation] + if arguments.contains("--dock-ui-task-preview") { + if store.shootingSession(orderID: order.id) == nil { + _ = preparationViewModel.summon() + _ = preparationViewModel.confirmSummon() + } + let taskViewModel = DroneShootingTaskViewModel(store: store, orderID: order.id) + let scenarioArgument = arguments.first { $0.hasPrefix("--dock-task-scenario=") } + let scenario = scenarioArgument.flatMap { DroneShootingTaskScenario(rawValue: String($0.dropFirst("--dock-task-scenario=".count))) } ?? .arrived + taskViewModel.applyScenario(scenario) + let task = DroneShootingTaskViewController(viewModel: taskViewModel) + task.delegate = workbench + controllers.append(task) + } + navigation.setViewControllers(controllers, animated: false) + } + if arguments.contains("--dock-ui-materials-preview"), let order = store.orders.first(where: { $0.successfulShootingCount > 0 }) { + let pointArgument = arguments.first { $0.hasPrefix("--dock-materials-point=") } + let pointID = pointArgument.map { String($0.dropFirst("--dock-materials-point=".count)) } + let materialsViewModel = DroneMaterialsViewModel(store: store, orderID: order.id, pointID: pointID) + let scenarioArgument = arguments.first { $0.hasPrefix("--dock-materials-scenario=") } + let scenario = scenarioArgument.flatMap { DroneMaterialsScenario(rawValue: String($0.dropFirst("--dock-materials-scenario=".count))) } ?? .mixed + materialsViewModel.applyScenario(scenario) + let materials = DroneMaterialsViewController(viewModel: materialsViewModel) + materials.delegate = workbench + navigation.setViewControllers([workbench, materials], animated: false) + } + if arguments.contains("--dock-ui-delivery-preview") || arguments.contains("--dock-ui-delivery-review-preview"), + let order = store.orders.first { + let deliveryModel = DroneDeliveryViewModel(store: store, orderID: order.id) + if let argument = arguments.first(where: { $0.hasPrefix("--dock-delivery-scenario=") }), + let scenario = DroneDeliveryScenario(rawValue: String(argument.dropFirst("--dock-delivery-scenario=".count))) { + deliveryModel.applyScenario(scenario) + } + if arguments.contains("--dock-ui-delivery-review-preview") { + let review = DroneDeliveryReviewViewController(viewModel: deliveryModel) + review.delegate = workbench + navigation.setViewControllers([workbench, review], animated: false) + } else { + workbench.prepareDeliveryPreview(orderID: order.id) + } + } + return navigation + } +} +#endif diff --git a/suixinkan/UI/DroneDock/DroneDockReceiptsViewController.swift b/suixinkan/UI/DroneDock/DroneDockReceiptsViewController.swift new file mode 100644 index 0000000..2fa336e --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockReceiptsViewController.swift @@ -0,0 +1,408 @@ +import SnapKit +import UIKit + +/// 真实套餐收款记录页,展示接口汇总与分页明细,不进入拍摄订单或演示流程。 +@MainActor +final class DroneDockReceiptsViewController: BaseViewController { + /// 当前页面的收款查询状态。 + let viewModel: DroneDockReceiptsViewModel + private let tableView = UITableView(frame: .zero, style: .plain) + private var dataSource: UITableViewDiffableDataSource! + private var loadTask: Task? + private var operation: LoadAction? + + /// 汇总与收款记录使用独立分区,空态也由同一 Diffable 数据源管理。 + private enum Section: Hashable { case summary, receipts } + /// 订单号作为列表的稳定身份,金额更新不生成重复记录。 + private enum Item: Hashable { case summary, receipt(String), message } + /// 区分整页刷新与保留现有记录的分页请求。 + private enum LoadAction: Equatable { case refresh, more } + + /// 注入当前景区及可选套餐范围的记录模型。 + init(viewModel: DroneDockReceiptsViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { loadTask?.cancel() } + + override func setupNavigationBar() { + title = "收款记录" + navigationItem.backButtonDisplayMode = .minimal + } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + tableView.backgroundColor = .clear + tableView.separatorStyle = .none + tableView.allowsSelection = false + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 230 + tableView.sectionHeaderTopPadding = 0 + tableView.accessibilityIdentifier = "drone.receipts.list" + tableView.register(DroneDockReceiptSummaryCell.self, forCellReuseIdentifier: "summary") + tableView.register(DroneDockReceiptCell.self, forCellReuseIdentifier: "receipt") + tableView.register(DroneDockReceiptsMessageCell.self, forCellReuseIdentifier: "message") + let refresh = UIRefreshControl() + refresh.tintColor = DroneDockStyle.primary + refresh.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + tableView.refreshControl = refresh + view.addSubview(tableView) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + tableView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.bottom.equalToSuperview() + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + load(.refresh) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + loadTask?.cancel() + operation = nil + viewModel.invalidate() + } + + private func configureDataSource() { + dataSource = UITableViewDiffableDataSource(tableView: tableView) { [weak self] table, path, item in + guard let self else { return nil } + switch item { + case .summary: + let cell = table.dequeueReusableCell(withIdentifier: "summary", for: path) as! DroneDockReceiptSummaryCell + cell.apply(self.operation == .refresh ? nil : self.viewModel.summary) + return cell + case .receipt(let orderNumber): + let cell = table.dequeueReusableCell(withIdentifier: "receipt", for: path) as! DroneDockReceiptCell + if let receipt = self.viewModel.receipts.first(where: { $0.orderNumber == orderNumber }) { + cell.apply(receipt) + } + return cell + case .message: + let cell = table.dequeueReusableCell(withIdentifier: "message", for: path) as! DroneDockReceiptsMessageCell + let isLoading = self.operation != nil || self.viewModel.isLoading + let error = self.viewModel.errorMessage + if isLoading || (self.viewModel.summary == nil && error == nil) { + cell.apply(title: "正在加载收款记录", detail: "正在获取最新数据", canRetry: false) + } else if let error { + cell.apply(title: "收款记录加载失败", detail: error, canRetry: true) + } else { + cell.apply(title: "暂无收款记录", detail: "近7天暂无收款数据", canRetry: false) + } + cell.onRetry = { [weak self] in self?.load(.refresh) } + return cell + } + } + } + + private func load(_ action: LoadAction) { + if action == .more, operation != nil || !viewModel.hasMore { return } + loadTask?.cancel() + operation = action + applySnapshot(animated: false) + loadTask = Task { @MainActor [weak self] in + guard let self else { return } + if action == .refresh { await self.viewModel.refresh() } + else { await self.viewModel.loadMore() } + guard !Task.isCancelled else { return } + self.operation = nil + self.tableView.refreshControl?.endRefreshing() + self.applySnapshot(animated: true) { [weak self] in + #if DEBUG + guard action == .refresh, self?.viewModel.errorMessage == nil else { return } + Task { @MainActor [weak self] in await self?.captureIfRequested() } + #endif + } + } + } + + private func applySnapshot(animated: Bool, completion: (() -> Void)? = nil) { + guard dataSource != nil else { return } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.summary, .receipts]) + snapshot.appendItems([.summary], toSection: .summary) + let records = operation == .refresh ? [] : viewModel.receipts.map { Item.receipt($0.orderNumber) } + snapshot.appendItems(records.isEmpty ? [.message] : records, toSection: .receipts) + let previous = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { previous.contains($0) }) + updateFooter() + dataSource.apply(snapshot, animatingDifferences: animated, completion: completion) + } + + private func updateFooter() { + guard operation != .refresh, !viewModel.receipts.isEmpty else { + tableView.tableFooterView = nil + return + } + let footer = UIView(frame: CGRect(x: 0, y: 0, width: tableView.bounds.width, height: 84)) + let label = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + label.numberOfLines = 2 + label.textAlignment = .center + let button = UIButton(type: .system) + button.tintColor = DroneDockStyle.primary + button.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium) + button.accessibilityIdentifier = "drone.receipts.loadMore" + button.addTarget(self, action: #selector(loadMoreTriggered), for: .touchUpInside) + if operation != nil { + label.text = operation == .more ? "正在加载更多…" : "正在刷新…" + button.isHidden = true + } else if let error = viewModel.errorMessage { + label.text = error + button.setTitle("重试加载", for: .normal) + } else if viewModel.hasMore { + label.text = "已显示 \(viewModel.receipts.count) 条记录" + button.setTitle("加载更多", for: .normal) + } else { + label.text = "已显示全部收款记录" + button.isHidden = true + } + let stack = UIStackView(arrangedSubviews: [label, button]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 4 + footer.addSubview(stack) + stack.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.trailing.equalToSuperview().inset(24) + } + button.snp.makeConstraints { $0.height.equalTo(36).priority(999) } + tableView.tableFooterView = footer + } + + @objc private func refreshTriggered() { load(.refresh) } + @objc private func loadMoreTriggered() { load(.more) } + + #if DEBUG + /// 显式联调时保存当前 App 的记录页,待 Diffable 动画与屏幕提交后再截图。 + private func captureIfRequested() async { + guard ProcessInfo.processInfo.arguments.contains("--dock-payment-capture") else { return } + try? await Task.sleep(nanoseconds: 400_000_000) + guard !Task.isCancelled, operation == nil, viewModel.summary != nil, + navigationController?.topViewController === self, + let window = view.window, window.windowScene?.activationState == .foregroundActive else { return } + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + do { + let folder = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] + .appendingPathComponent("DroneDockPaymentDiagnostics", isDirectory: true) + try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) + try image.pngData()?.write(to: folder.appendingPathComponent("receipts.png"), options: .atomic) + print("[DroneDockPayment] Receipts window screenshot saved") + } catch { print("[DroneDockPayment] Receipts screenshot failed: \(error.localizedDescription)") } + } + #endif +} + +/// 顶部收款汇总卡;现金金额与积分始终使用分开的展示区域。 +@MainActor +private final class DroneDockReceiptSummaryCell: UITableViewCell { + private let card = UIView() + private let stack = UIStackView() + + /// 建立自适应高度的汇总卡片。 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + backgroundColor = .clear + selectionStyle = .none + DroneDockStyle.applyCard(to: card) + stack.axis = .vertical + stack.spacing = 16 + contentView.addSubview(card) + card.addSubview(stack) + card.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 16, left: 16, bottom: 12, right: 16)) } + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(16) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 使用服务端完整汇总,尚未成功读取时保留未知占位。 + func apply(_ summary: DroneDockReceiptSummary?) { + stack.arrangedSubviews.forEach { $0.removeFromSuperview() } + let title = DroneDockStyle.label("近7天收款汇总", size: 16, weight: .semibold) + let count = DroneDockStyle.label(summary.map { "共 \($0.count) 笔" } ?? "—", size: 12, color: DroneDockStyle.secondary) + count.setContentHuggingPriority(.required, for: .horizontal) + let heading = UIStackView(arrangedSubviews: [title, count]) + stack.addArrangedSubview(heading) + stack.addArrangedSubview(DroneDockReceiptFormatting.cashColumns( + paid: summary?.cashPaid, refund: summary?.cashRefund, net: summary?.cashNet, large: true)) + if let summary, summary.pointsPaid != 0 || summary.pointsRefund != 0 || summary.pointsNet != 0 || summary.pointAmount != 0 { + stack.addArrangedSubview(DroneDockReceiptFormatting.pointsView( + paid: summary.pointsPaid, refund: summary.pointsRefund, net: summary.pointsNet, amount: summary.pointAmount)) + } + } +} + +/// 单笔收款卡片,仅展示套餐与支付字段,不推测拍摄次数或订单业务状态。 +@MainActor +private final class DroneDockReceiptCell: UITableViewCell { + private let card = UIView() + private let stack = UIStackView() + + /// 建立白底卡片与适应多行名称的纵向内容。 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + backgroundColor = .clear + selectionStyle = .none + DroneDockStyle.applyCard(to: card) + stack.axis = .vertical + stack.spacing = 12 + contentView.addSubview(card) + card.addSubview(stack) + card.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 16, bottom: 12, right: 16)) } + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(16) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 重建本笔内容,避免复用后残留上一笔积分或付款人信息。 + func apply(_ receipt: DroneDockReceipt) { + accessibilityIdentifier = "drone.receipt.\(receipt.orderNumber)" + stack.arrangedSubviews.forEach { $0.removeFromSuperview() } + let name = DroneDockStyle.label(receipt.projectName.isEmpty ? "套餐名称未提供" : receipt.projectName, size: 16, weight: .semibold) + name.numberOfLines = 0 + stack.addArrangedSubview(name) + let payer = DroneDockStyle.label("付款人 \(receipt.payer.isEmpty ? "—" : receipt.payer)", size: 12, color: DroneDockStyle.secondary) + payer.numberOfLines = 0 + stack.addArrangedSubview(payer) + stack.addArrangedSubview(DroneDockReceiptFormatting.cashColumns( + paid: receipt.cashPaid, refund: receipt.cashRefund, net: receipt.cashNet, large: false)) + if receipt.pointsPaid != 0 || receipt.pointsRefund != 0 || receipt.pointsNet != 0 || receipt.pointAmount != 0 { + stack.addArrangedSubview(DroneDockReceiptFormatting.pointsView( + paid: receipt.pointsPaid, refund: receipt.pointsRefund, net: receipt.pointsNet, amount: receipt.pointAmount)) + } + let separator = UIView() + separator.backgroundColor = DroneDockStyle.border + separator.snp.makeConstraints { $0.height.equalTo(1 / UIScreen.main.scale) } + stack.addArrangedSubview(separator) + let time = DroneDockStyle.label("支付时间 \(DroneDockReceiptFormatting.time(receipt.payTime))", size: 12, color: DroneDockStyle.secondary) + let order = DroneDockStyle.label("订单号 \(receipt.orderNumber)", size: 12, color: DroneDockStyle.secondary) + time.numberOfLines = 0 + order.numberOfLines = 0 + stack.addArrangedSubview(time) + stack.addArrangedSubview(order) + } +} + +/// 收款记录的加载、空数据和失败重试提示。 +@MainActor +private final class DroneDockReceiptsMessageCell: UITableViewCell { + /// 用户请求重新读取第一页。 + var onRetry: (() -> Void)? + private let titleLabel = DroneDockStyle.label(size: 16, weight: .medium) + private let detailLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let retryButton = UIButton(type: .system) + + /// 创建适合空记录列表的居中提示。 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + backgroundColor = .clear + selectionStyle = .none + titleLabel.textAlignment = .center + titleLabel.numberOfLines = 0 + detailLabel.textAlignment = .center + detailLabel.numberOfLines = 0 + retryButton.setTitle("重新加载", for: .normal) + retryButton.tintColor = DroneDockStyle.primary + retryButton.accessibilityIdentifier = "drone.receipts.retry" + retryButton.addTarget(self, action: #selector(retryTapped), for: .touchUpInside) + let icon = UIImageView(image: UIImage(systemName: "doc.text.magnifyingglass")) + icon.tintColor = DroneDockStyle.secondary.withAlphaComponent(0.6) + icon.contentMode = .scaleAspectFit + icon.snp.makeConstraints { $0.size.equalTo(38) } + let stack = UIStackView(arrangedSubviews: [icon, titleLabel, detailLabel, retryButton]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 12 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(48) + make.leading.trailing.equalToSuperview().inset(24) + } + retryButton.snp.makeConstraints { $0.height.equalTo(36).priority(999) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 失败与成功空态分开表达,只有失败时提供重试动作。 + func apply(title: String, detail: String, canRetry: Bool) { + titleLabel.text = title + detailLabel.text = detail + retryButton.isHidden = !canRetry + } + + @objc private func retryTapped() { onRetry?() } +} + +/// 收款记录的展示格式,不计算或混合现金与积分账目。 +@MainActor +private enum DroneDockReceiptFormatting { + /// 十进制金额按人民币展示两位小数,未知金额保留占位。 + static func money(_ amount: Decimal?) -> String { + guard let amount else { return "—" } + let formatter = NumberFormatter() + formatter.locale = Locale(identifier: "zh_CN") + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + return formatter.string(from: NSDecimalNumber(decimal: amount)).map { "¥" + $0 } ?? "—" + } + + /// 后端支付时间是 Unix 秒,缺失的零值不展示为 1970 年。 + static func time(_ timestamp: TimeInterval) -> String { + guard timestamp > 0 else { return "—" } + let formatter = DateFormatter() + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + return formatter.string(from: Date(timeIntervalSince1970: timestamp)) + } + + /// 三列明确区分现金实收、现金退款和现金净收。 + static func cashColumns(paid: Decimal?, refund: Decimal?, net: Decimal?, large: Bool) -> UIView { + let values = [("现金实收", paid), ("现金退款", refund), ("现金净收", net)] + let columns = values.map { title, amount in + let value = DroneDockStyle.label(money(amount), size: large ? 20 : 17, weight: .semibold, + color: title == "现金净收" ? DroneDockStyle.primary : DroneDockStyle.text) + value.adjustsFontSizeToFitWidth = true + value.minimumScaleFactor = 0.6 + let column = UIStackView(arrangedSubviews: [DroneDockStyle.label(title, size: 11, color: DroneDockStyle.secondary), value]) + column.axis = .vertical + column.spacing = 8 + return column + } + let row = UIStackView(arrangedSubviews: columns) + row.distribution = .fillEqually + row.spacing = 8 + return row + } + + /// 积分及其抵扣金额独立成行,绝不加到现金实收或净收中。 + static func pointsView(paid: Int, refund: Int, net: Int, amount: Decimal) -> UIView { + let label = DroneDockStyle.label("积分实收 \(paid) · 积分退款 \(refund) · 积分净收 \(net)", size: 12, color: DroneDockStyle.secondary) + label.numberOfLines = 0 + let stack = UIStackView(arrangedSubviews: [label]) + stack.axis = .vertical + stack.spacing = 6 + if amount != 0 { + let amountLabel = DroneDockStyle.label("积分抵扣金额 \(money(amount))", size: 12, color: DroneDockStyle.secondary) + amountLabel.numberOfLines = 0 + stack.addArrangedSubview(amountLabel) + } + return stack + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockRecordingCompletionView.swift b/suixinkan/UI/DroneDock/DroneDockRecordingCompletionView.swift new file mode 100644 index 0000000..dfeabb2 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockRecordingCompletionView.swift @@ -0,0 +1,86 @@ +import SnapKit +import UIKit + +/// 与任务原型一致的录制完成提示;只引导查看素材,不宣告上传成功或扣减次数。 +@MainActor +final class DroneDockRecordingCompletionView: UIView { + /// 关闭提示并继续留在任务页。 + var onLater: (() -> Void)? + /// 前往当前订单素材库。 + var onViewMaterials: (() -> Void)? + + /// 创建居中结果卡片,覆盖任务页但不触发生命周期或暂停只读状态更新。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + private func setupUI() { + backgroundColor = .black.withAlphaComponent(0.5) + accessibilityViewIsModal = true + accessibilityIdentifier = "drone.task.recordingCompletion" + let card = UIView() + card.backgroundColor = .white + card.layer.cornerRadius = 14 + addSubview(card) + let symbol = UIImageView(image: UIImage(systemName: "checkmark.circle.fill")) + symbol.tintColor = DroneDockStyle.success + symbol.contentMode = .scaleAspectFit + let title = DroneDockStyle.label(size: 20, weight: .semibold) + title.text = "拍摄已完成" + title.textAlignment = .center + let message = DroneDockStyle.label(size: 14, color: DroneDockStyle.secondary) + message.text = "本次拍摄已完成,\n可前往订单素材库查看上传进度和素材。" + message.numberOfLines = 0 + message.textAlignment = .center + let later = button("稍后再去", primary: false, action: #selector(laterTapped)) + let materials = button("去查看", primary: true, action: #selector(materialsTapped)) + later.accessibilityIdentifier = "drone.task.recordingCompletion.later" + materials.accessibilityIdentifier = "drone.task.recordingCompletion.materials" + let actions = UIStackView(arrangedSubviews: [later, materials]) + actions.spacing = 10 + actions.distribution = .fillEqually + [symbol, title, message, actions].forEach { card.addSubview($0) } + card.snp.makeConstraints { make in + make.center.equalToSuperview() + make.width.equalTo(320).priority(.high) + make.leading.greaterThanOrEqualToSuperview().offset(24) + make.trailing.lessThanOrEqualToSuperview().offset(-24) + } + symbol.snp.makeConstraints { make in + make.top.equalToSuperview().offset(24) + make.centerX.equalToSuperview() + make.size.equalTo(50) + } + title.snp.makeConstraints { make in + make.top.equalTo(symbol.snp.bottom).offset(16) + make.leading.trailing.equalToSuperview().inset(20) + } + message.snp.makeConstraints { make in + make.top.equalTo(title.snp.bottom).offset(12) + make.leading.trailing.equalToSuperview().inset(20) + } + actions.snp.makeConstraints { make in + make.top.equalTo(message.snp.bottom).offset(24) + make.leading.trailing.bottom.equalToSuperview().inset(16) + make.height.equalTo(46) + } + } + + private func button(_ title: String, primary: Bool, action: Selector) -> UIButton { + let button = UIButton(type: .system) + button.setTitle(title, for: .normal) + button.setTitleColor(primary ? .white : DroneDockStyle.text, for: .normal) + button.titleLabel?.font = .systemFont(ofSize: 15, weight: .semibold) + button.backgroundColor = primary ? DroneDockStyle.primary : UIColor(hex: 0xEEF0F6) + button.layer.cornerRadius = 7 + button.addTarget(self, action: action, for: .touchUpInside) + return button + } + + @objc private func laterTapped() { onLater?() } + @objc private func materialsTapped() { onViewMaterials?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockRemotePreparationViewController.swift b/suixinkan/UI/DroneDock/DroneDockRemotePreparationViewController.swift new file mode 100644 index 0000000..bb7e3ca --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockRemotePreparationViewController.swift @@ -0,0 +1,541 @@ +import SnapKit +import UIKit + +/// 展示准备信息并提交召唤;业务成功后携同一任务 ID 进入真实拍摄任务页。 +@MainActor +final class DroneDockRemotePreparationViewController: GlobalLoadingPageViewController { + /// 当前订单、准备信息及任务创建状态。 + let viewModel: DroneDockPreparationViewModel + + /// 点位与航线沿用原准备页顺序,状态区单独承载加载和错误说明。 + private enum Section: Int, CaseIterable { case order, points, routes, status, creationResult, shootResult } + /// 点位与航线使用后端稳定 ID,刷新时保留有效选择。 + private enum Item: Hashable { case order, point(Int), route(Int), emptyPoints, emptyRoutes, status, creationResult, shootResult } + + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let footerView = DronePreparationFooterView() + private let refreshControl = UIRefreshControl() + private var refreshTask: Task? + private var planeStatusTask: Task? + private var creationTask: Task? + private var isStartingCreation = false + private let planeStatusPollDelay: @Sendable (UInt64) async throws -> Void + private var isRefreshing = false + private var isPageVisible = false + private var isApplicationActive = false + private var automaticallyOpenedTaskID: Int? + private let taskControllerFactory: @MainActor (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let simulationRecordsProvider: (@MainActor () -> String)? + + /// 注入准备页业务状态和轮询等待,便于验证任务创建及页面生命周期。 + init(viewModel: DroneDockPreparationViewModel, + taskControllerFactory: (@MainActor (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + simulationRecordsProvider: (@MainActor () -> String)? = nil, + planeStatusPollDelay: @escaping @Sendable (UInt64) async throws -> Void = { try await Task.sleep(nanoseconds: $0) }) { + self.viewModel = viewModel + self.simulationRecordsProvider = simulationRecordsProvider + self.taskControllerFactory = taskControllerFactory ?? { taskID, order, context in + DroneDockShootingTaskEntry.makeController(taskID: taskID, order: order, context: context, + coverURL: viewModel.selectedSpot?.displayCoverURL, + initialSummonReceipt: viewModel.shootResponse) + } + self.planeStatusPollDelay = planeStatusPollDelay + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + deinit { + refreshTask?.cancel() + planeStatusTask?.cancel() + creationTask?.cancel() + NotificationCenter.default.removeObserver(self) + } + + override func setupNavigationBar() { + title = simulationRecordsProvider == nil ? "拍摄准备" : "拍摄准备 · 本地模拟" + navigationItem.backButtonDisplayMode = .minimal + if simulationRecordsProvider != nil { + let records = UIBarButtonItem(image: UIImage(systemName: "doc.text"), style: .plain, + target: self, action: #selector(showSimulationRecords)) + records.accessibilityLabel = "查看模拟接口回执" + records.accessibilityIdentifier = "drone.preparation.mock.recordsButton" + navigationItem.rightBarButtonItem = records + } + #if DEBUG + if simulationRecordsProvider == nil { + let simulation = UIBarButtonItem(title: "本地模拟", style: .plain, + target: self, action: #selector(openLocalSimulation)) + simulation.accessibilityIdentifier = "drone.preparation.mock.entry" + navigationItem.rightBarButtonItem = simulation + } + #endif + } + + #if DEBUG + /// 打开独立模拟订单,不沿用真实会话、服务或当前订单创建任务。 + @objc private func openLocalSimulation() { + guard !isStartingCreation, !viewModel.isCreatingTask, !viewModel.isSummoning, + let navigationController, navigationController.topViewController === self, + let controller = DroneDockStartShootSimulation.makePreparationController() else { return } + navigationController.pushViewController(controller, animated: true) + } + #endif + + /// 显示内存传输记录,并明确说明其不是后端真实回执。 + @objc private func showSimulationRecords() { + guard let simulationRecordsProvider, presentedViewController == nil, + !isStartingCreation, !viewModel.isCreatingTask, !viewModel.isSummoning else { return } + let controller = DroneDockSimulationRecordsViewController(records: simulationRecordsProvider()) + present(UINavigationController(rootViewController: controller), animated: true) + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = false + collectionView.delegate = self + collectionView.accessibilityIdentifier = "drone.preparation.remote.list" + collectionView.register(DronePreparationOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DronePreparationPointCell.self, forCellWithReuseIdentifier: "point") + collectionView.register(DronePreparationRouteCell.self, forCellWithReuseIdentifier: "route") + collectionView.register(DronePreparationEmptyCell.self, forCellWithReuseIdentifier: "message") + collectionView.register(DroneDockTaskCreationResultCell.self, forCellWithReuseIdentifier: "creationResult") + collectionView.register(DronePreparationHeadingView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: "heading") + refreshControl.tintColor = DroneDockStyle.primary + collectionView.refreshControl = refreshControl + view.addSubview(collectionView) + view.addSubview(footerView) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + refreshControl.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + footerView.onRefreshTap = { [weak self] in self?.refreshPreparation() } + footerView.onPrimaryTap = { [weak self] in self?.createSelectedTask() } + NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), + name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + isPageVisible = true + isApplicationActive = UIApplication.shared.applicationState == .active + logPreparationEvent("preparation.page.appeared") + refreshPreparation() + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + isPageVisible = false + logPreparationEvent("preparation.page.disappeared", fields: ["moving_from_parent": isMovingFromParent]) + stopPlaneStatusPolling() + refreshTask?.cancel() + creationTask?.cancel() + isStartingCreation = false + isRefreshing = false + refreshControl.endRefreshing() + viewModel.invalidate() + } + + private func refreshPreparation() { + guard !isStartingCreation, !viewModel.isCreatingTask, !viewModel.isSummoning else { refreshControl.endRefreshing(); return } + startPlaneStatusPolling() + guard !isRefreshing else { return } + isRefreshing = true + setPageLoading(viewModel.projectInfo == nil) + refreshTask = Task { @MainActor [weak self] in + guard let self else { return } + let isInitialLoad = self.viewModel.projectInfo == nil + self.applySnapshot(animated: false) + await self.viewModel.refresh() + guard !Task.isCancelled else { return } + self.isRefreshing = false + self.setPageLoading(false) + self.refreshControl.endRefreshing() + self.applySnapshot(animated: true) { [weak self] in + guard let self else { return } + if isInitialLoad { + self.collectionView.layoutIfNeeded() + self.collectionView.setContentOffset(CGPoint(x: 0, y: -self.collectionView.adjustedContentInset.top), animated: false) + } + #if DEBUG + Task { @MainActor [weak self] in await self?.capturePreparationIfRequested() } + #endif + } + } + } + + /// 首次创建并召唤;成功后进入原任务,再次查看不经过创建或召唤接口。 + private func createSelectedTask() { + logPreparationEvent("preparation.confirm_tapped", fields: [ + "order_number": viewModel.order.orderNumber as Any? ?? NSNull(), + "scenic_id": viewModel.context.scenicID, + "spot_id": viewModel.selectedSpotID as Any? ?? NSNull(), + "air_line_id": viewModel.selectedRouteID as Any? ?? NSNull(), + "enabled": viewModel.isPrimaryActionEnabled + ]) + guard !isRefreshing, !isStartingCreation else { + logPreparationEvent("preparation.confirm_rejected", fields: ["reason": "refresh_or_submission_in_progress"]) + return + } + if viewModel.canOpenShootingTask { + _ = openShootingTask(automatically: false) + return + } + guard viewModel.isPrimaryActionEnabled else { + logPreparationEvent("preparation.confirm_rejected", fields: ["reason": "primary_action_disabled"]) + return + } + isStartingCreation = true + applySnapshot(animated: false) + creationTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.prepareAndSummon { [weak self] in self?.applySnapshot(animated: false) } + guard !Task.isCancelled else { return } + self.isStartingCreation = false + self.logPreparationEvent("preparation.submission_presented", fields: [ + "has_summon_receipt": self.viewModel.shootResponse != nil, + "can_open_task": self.viewModel.canOpenShootingTask, + "error_message": self.viewModel.errorMessage as Any? ?? NSNull()]) + if self.openShootingTask(automatically: true) { return } + self.applySnapshot(animated: true) { [weak self] in + guard let self, + let path = self.dataSource.indexPath(for: .shootResult) ?? self.dataSource.indexPath(for: .creationResult) else { return } + self.collectionView.scrollToItem(at: path, at: .top, animated: true) + self.showFilingFailureIfNeeded() + } + } + } + + /// 报备问题在明确提交失败后提示一次,后台及设备轮询不会反复弹窗。 + private func showFilingFailureIfNeeded() { + guard isPageVisible, isApplicationActive, presentedViewController == nil, + let failure = viewModel.summonFailure ?? viewModel.creationFailure, + failure.requiresFiling else { return } + let alert = UIAlertController(title: failure.title, message: failure.message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "我知道了", style: .default)) + present(alert, animated: true) + } + + /// 进入任务时替换有前驱的准备页,返回直达工作台;独立调试根页保留原返回入口。 + @discardableResult + private func openShootingTask(automatically: Bool) -> Bool { + guard isPageVisible, isApplicationActive, viewModel.canOpenShootingTask, + let taskID = viewModel.createdTask?.taskID, + let navigationController, navigationController.topViewController === self, + !automatically || (viewModel.shootResponse != nil && automaticallyOpenedTaskID != taskID) else { + logPreparationEvent("navigation.open_task_rejected", fields: ["automatic": automatically, + "can_open_task": viewModel.canOpenShootingTask, + "is_navigation_top": navigationController?.topViewController === self, + "has_summon_receipt": viewModel.shootResponse != nil, + "previously_opened_task_id": automaticallyOpenedTaskID as Any? ?? NSNull()]) + return false + } + automaticallyOpenedTaskID = taskID + let controller = taskControllerFactory(taskID, viewModel.order, viewModel.context) + let stack = navigationController.viewControllers + let fields: [String: Any] = ["automatic": automatically, "task_id": taskID, + "preparation_session_id": viewModel.diagnosticSessionID, + "replaces_preparation": stack.count > 1, + "navigation_stack_before": stack.map { String(describing: type(of: $0)) }] + logPreparationEvent("navigation.open_task", fields: fields) + (controller as? DroneDockShootingTaskViewController)?.recordNavigationEntry(source: "preparation", fields: fields) + if stack.count > 1 { + navigationController.setViewControllers(Array(stack.dropLast()) + [controller], animated: true) + } else { + navigationController.pushViewController(controller, animated: true) + } + return true + } + + /// 设备请求与购买快照各自更新,轮询不重载列表或改变点位、航线选择。 + private func startPlaneStatusPolling() { + guard isPageVisible, isApplicationActive else { return } + stopPlaneStatusPolling() + let delay = planeStatusPollDelay + planeStatusTask = Task { @MainActor [weak self] in + while !Task.isCancelled { + guard let interval = await self?.refreshPlaneStatusIfVisible() else { return } + do { try await delay(interval) } + catch { return } + } + } + } + + private func refreshPlaneStatusIfVisible() async -> UInt64? { + guard isPageVisible, isApplicationActive, !Task.isCancelled else { return nil } + await viewModel.refreshPlaneStatus() + guard isPageVisible, isApplicationActive, !Task.isCancelled else { return nil } + if viewModel.errorMessage != nil { + applySnapshot(animated: false) + } else { + footerView.apply(preparationViewModel: viewModel, isRefreshing: isRefreshing || isStartingCreation, + isLocalSimulation: simulationRecordsProvider != nil) + } + return viewModel.pollIntervalNanoseconds + } + + private func stopPlaneStatusPolling() { + planeStatusTask?.cancel() + planeStatusTask = nil + viewModel.invalidatePlaneStatus() + } + + @objc private func applicationWillResignActive() { + isApplicationActive = false + logPreparationEvent("preparation.app.inactive") + stopPlaneStatusPolling() + footerView.apply(preparationViewModel: viewModel, isRefreshing: isRefreshing || isStartingCreation, + isLocalSimulation: simulationRecordsProvider != nil) + } + + @objc private func applicationDidBecomeActive() { + isApplicationActive = true + logPreparationEvent("preparation.app.active") + startPlaneStatusPolling() + } + + /// 准备页 UI 事件沿用业务会话,可与后续任务页的导航记录关联。 + private func logPreparationEvent(_ name: String, fields: [String: Any] = [:]) { + var fields = fields + fields["source"] = simulationRecordsProvider == nil ? "preparation_page" : "local_simulation" + fields["task_id"] = viewModel.createdTask?.taskID as Any? ?? NSNull() + fields["page_visible"] = isPageVisible + fields["app_active"] = isApplicationActive + fields["refreshing"] = isRefreshing + fields["submitting"] = isStartingCreation + viewModel.recordPreparationEvent(name, fields: fields) + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, path, item in + guard let self else { return nil } + switch item { + case .order: + let cell = list.dequeueReusableCell(withReuseIdentifier: "order", for: path) as! DronePreparationOrderCell + cell.apply(homeOrder: self.viewModel.order, summary: self.viewModel.latestOrderSummary, + usesHomeSnapshot: self.viewModel.projectInfo == nil && self.viewModel.errorMessage == nil) + return cell + case .point(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "point", for: path) as! DronePreparationPointCell + if let spot = self.viewModel.spots.first(where: { $0.id == id }) { + cell.apply(spot: spot, selected: self.viewModel.selectedSpotID == id) + } + return cell + case .route(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "route", for: path) as! DronePreparationRouteCell + if let route = self.viewModel.routes.first(where: { $0.id == id }) { + cell.apply(route: route, selected: self.viewModel.selectedRouteID == id) + } + return cell + case .creationResult: + let cell = list.dequeueReusableCell(withReuseIdentifier: "creationResult", for: path) as! DroneDockTaskCreationResultCell + if let failure = self.viewModel.creationFailure { + cell.apply(failure: failure, identifier: "drone.preparation.creationResponse") + } + return cell + case .shootResult: + let cell = list.dequeueReusableCell(withReuseIdentifier: "creationResult", for: path) as! DroneDockTaskCreationResultCell + if let failure = self.viewModel.summonFailure { + cell.apply(failure: failure, identifier: "drone.preparation.shootResponse") + } + return cell + case .emptyPoints, .emptyRoutes, .status: + let cell = list.dequeueReusableCell(withReuseIdentifier: "message", for: path) as! DronePreparationEmptyCell + if item == .status { + self.applyStatus(to: cell) + } else if item == .emptyPoints { + cell.apply(title: "暂无可用拍摄点", detail: "当前套餐暂无已购拍摄点,请刷新重试") + } else if self.viewModel.selectedSpot == nil { + cell.apply(title: "请选择拍摄点", detail: "选择拍摄点后查看对应航线") + } else { + cell.apply(title: "暂无可用航线", detail: "请选择其他拍摄点,或稍后刷新重试") + } + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] list, kind, path in + guard let self else { return nil } + let header = list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "heading", for: path) as! DronePreparationHeadingView + self.applyHeading(header, section: Section(rawValue: path.section)) + return header + } + } + + private func applyStatus(to cell: DronePreparationEmptyCell) { + if isRefreshing, viewModel.projectInfo == nil { + cell.apply(title: "正在加载", detail: "正在获取已购套餐、拍摄点和航线") + } else if let error = viewModel.errorMessage { + cell.apply(title: "准备信息加载失败", detail: error + ",请下拉或点击刷新状态重试") + } else { + cell.apply(title: "正在加载", detail: "正在获取拍摄准备信息") + } + } + + private func applySnapshot(animated: Bool, completion: (() -> Void)? = nil) { + navigationItem.rightBarButtonItem?.isEnabled = !isStartingCreation && !viewModel.isCreatingTask && !viewModel.isSummoning + guard dataSource != nil else { return } + let previous = dataSource.snapshot() + let existing = Set(previous.itemIdentifiers) + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections(Section.allCases) + snapshot.appendItems([.order], toSection: .order) + if viewModel.projectInfo != nil, viewModel.errorMessage == nil { + snapshot.appendItems(viewModel.spots.isEmpty ? [.emptyPoints] : viewModel.spots.map { .point($0.id) }, toSection: .points) + if !viewModel.spots.isEmpty { + snapshot.appendItems(viewModel.routes.isEmpty ? [.emptyRoutes] : viewModel.routes.map { .route($0.id) }, toSection: .routes) + } + } else { + snapshot.appendItems([.status], toSection: .status) + } + if viewModel.creationFailure != nil { + snapshot.appendItems([.creationResult], toSection: .creationResult) + } + if viewModel.summonFailure != nil { + snapshot.appendItems([.shootResult], toSection: .shootResult) + } + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existing.contains($0) }) + footerView.apply(preparationViewModel: viewModel, isRefreshing: isRefreshing || isStartingCreation, + isLocalSimulation: simulationRecordsProvider != nil) + let previousPointCount = previous.sectionIdentifiers.contains(.points) ? previous.numberOfItems(inSection: .points) : 0 + let previousRouteCount = previous.sectionIdentifiers.contains(.routes) ? previous.numberOfItems(inSection: .routes) : 0 + let layoutChanged = previousPointCount != snapshot.numberOfItems(inSection: .points) + || previous.itemIdentifiers.contains(.emptyPoints) != snapshot.itemIdentifiers.contains(.emptyPoints) + || previous.itemIdentifiers.contains(.emptyRoutes) != snapshot.itemIdentifiers.contains(.emptyRoutes) + || previousRouteCount != snapshot.numberOfItems(inSection: .routes) + if layoutChanged || viewModel.projectInfo != nil { collectionView.collectionViewLayout.invalidateLayout() } + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + guard let self else { return } + let kind = UICollectionView.elementKindSectionHeader + for path in self.collectionView.indexPathsForVisibleSupplementaryElements(ofKind: kind) { + if let header = self.collectionView.supplementaryView(forElementKind: kind, at: path) as? DronePreparationHeadingView { + self.applyHeading(header, section: Section(rawValue: path.section)) + } + } + completion?() + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, let section = Section(rawValue: index) else { return nil } + let height: NSCollectionLayoutDimension + let width: NSCollectionLayoutDimension + switch section { + case .order: height = .estimated(100); width = .fractionalWidth(1) + case .points: + height = .absolute(self.viewModel.spots.isEmpty ? 150 : DronePreparationPointCell.preferredHeight( + names: self.viewModel.spots.map(\.name), width: 200)) + width = self.viewModel.spots.isEmpty ? .fractionalWidth(1) : .absolute(200) + case .routes: + height = self.viewModel.routes.isEmpty ? .absolute(160) : .estimated(64) + width = .fractionalWidth(1) + case .status: height = .absolute(160); width = .fractionalWidth(1) + case .creationResult, .shootResult: height = .estimated(100); width = .fractionalWidth(1) + } + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: height)) + let group = NSCollectionLayoutGroup.vertical(layoutSize: NSCollectionLayoutSize(widthDimension: width, heightDimension: height), subitems: [item]) + let layout = NSCollectionLayoutSection(group: group) + layout.contentInsets = NSDirectionalEdgeInsets(top: section == .shootResult ? 12 : 0, leading: 16, bottom: section == .status ? 12 : 0, trailing: 16) + if section == .points, !self.viewModel.spots.isEmpty { + layout.orthogonalScrollingBehavior = .continuous + layout.interGroupSpacing = 8 + } + let showsHeading = self.viewModel.projectInfo != nil && self.viewModel.errorMessage == nil + && (section == .points || (section == .routes && !self.viewModel.spots.isEmpty)) + if showsHeading { + layout.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(section == .points ? 46 : DronePreparationHeadingView.preferredHeight( + title: self.viewModel.selectedSpot.map { "\($0.name)的航线" } ?? "拍摄航线", + detail: "共 \(self.viewModel.routes.count) 条", width: environment.container.effectiveContentSize.width - 32))), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)] + } + return layout + } + } + + private func applyHeading(_ header: DronePreparationHeadingView, section: Section?) { + switch section { + case .points: header.apply(title: "拍摄点", detail: nil) + case .routes: + header.apply(title: viewModel.selectedSpot.map { "\($0.name)的航线" } ?? "拍摄航线", detail: "共 \(viewModel.routes.count) 条") + default: header.apply(title: "", detail: nil) + } + } + + @objc private func refreshTriggered() { refreshPreparation() } + + #if DEBUG + /// 显式联调时只保存本应用窗口,不截取其他应用内容。 + private func capturePreparationIfRequested() async { + guard ProcessInfo.processInfo.arguments.contains("--dock-preparation-capture") else { return } + try? await Task.sleep(nanoseconds: 400_000_000) + guard !Task.isCancelled, !isRefreshing, let window = view.window else { return } + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + do { + let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] + .appendingPathComponent("DronePreparationDiagnostics", isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + try image.pngData()?.write(to: directory.appendingPathComponent("preparation-real.png"), options: .atomic) + print("[DronePreparation] App window screenshot saved") + } catch { print("[DronePreparation] Screenshot failed: \(error.localizedDescription)") } + } + #endif +} + +extension DroneDockRemotePreparationViewController: UICollectionViewDelegate { + /// 点位和航线只在当前成功快照中选择,刷新期间不切换旧配置。 + func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { + guard !isRefreshing, !isStartingCreation, !viewModel.isCreatingTask, + viewModel.createdTask == nil, !viewModel.taskCreationOutcomeUnknown, + viewModel.projectInfo != nil, viewModel.errorMessage == nil, + let item = dataSource.itemIdentifier(for: indexPath) else { return false } + switch item { + case .point(let id): return viewModel.spots.first { $0.id == id }?.available == true + case .route(let id): return viewModel.routes.first { $0.id == id }?.available == true + default: return false + } + } + + /// 更新本地点位、航线及底部摘要,不创建拍摄任务。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard !isRefreshing, !isStartingCreation, !viewModel.isCreatingTask, + viewModel.createdTask == nil, !viewModel.taskCreationOutcomeUnknown, + let item = dataSource.itemIdentifier(for: indexPath) else { return } + switch item { + case .point(let id): + viewModel.selectSpot(id: id) + applySnapshot(animated: true) { [weak self] in + guard let self, self.viewModel.selectedSpotID == id, + let path = self.dataSource.indexPath(for: .point(id)) else { return } + let pointsWidth = CGFloat(self.viewModel.spots.count) * 200 + CGFloat(max(0, self.viewModel.spots.count - 1)) * 8 + 32 + guard pointsWidth > collectionView.bounds.width else { return } + collectionView.scrollToItem(at: path, at: .centeredHorizontally, animated: true) + } + return + case .route(let id): viewModel.selectRoute(id: id) + default: return + } + applySnapshot(animated: true) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockShootingTaskEntry.swift b/suixinkan/UI/DroneDock/DroneDockShootingTaskEntry.swift new file mode 100644 index 0000000..d284231 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockShootingTaskEntry.swift @@ -0,0 +1,36 @@ +import UIKit + +/// 组装真实拍摄任务页;构造时不发请求,页面出现后才读取同一任务。 +@MainActor +enum DroneDockShootingTaskEntry { + /// 使用已有任务读取状态,两种构建均注入真实服务并按后端权限操作。 + static func makeController(taskID: Int, order: DroneDockHomeOrder, + context: DroneDockHomeContext) -> UIViewController { + makeController(taskID: taskID, order: order, context: context, coverURL: nil) + } + + /// 准备页携带封面及召唤回执;其它入口不推断前往阶段,等 shooting 返回。 + static func makeController(taskID: Int, order: DroneDockHomeOrder, + context: DroneDockHomeContext, coverURL: URL?, + initialSummonReceipt: DroneDockShootResponse? = nil) -> UIViewController { + let client = NetworkServices.shared.apiClient + let realtime = DroneDockShootingRealtimeSession(taskID: taskID, + ticketService: DroneDockSocketTokenAPI(client: client), + makeTransport: { DroneDockURLSessionShootingSocket(url: APIEnvironment.current.webSocketURL) }, + identityIsCurrent: { context.hasSameIdentity(as: DroneDockHomeViewController.currentContext()) }) + let live = DroneDockLiveViewModel( + context: context, taskID: taskID, + service: DroneDockLiveAPI(client: client), + allowsDevicePlayback: true, + currentContext: { DroneDockHomeViewController.currentContext() }) + return DroneDockShootingTaskViewController(viewModel: DroneDockShootingTaskViewModel( + context: context, taskID: taskID, order: order, + service: DroneDockShootingAPI(client: client), + startService: DroneDockStartShootAPI(client: client), + commandService: DroneDockCommandAPI(client: client), + resummonService: DroneDockShootAPI(client: client), + initialSummonReceipt: initialSummonReceipt, + currentContext: { DroneDockHomeViewController.currentContext() } + ), liveViewModel: live, coverURL: coverURL, realtimeSession: realtime) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift b/suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift new file mode 100644 index 0000000..777c1f6 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift @@ -0,0 +1,982 @@ +import SnapKit +import UIKit + +/// 拍摄任务页:前台优先订阅快照、异常时 HTTP 兜底;自动开启图传,飞控仍由用户操作。 +@MainActor +final class DroneDockShootingTaskViewController: GlobalLoadingPageViewController { + /// 入口传入的固定任务身份及只读状态,供导航协调和页面测试检查。 + let viewModel: DroneDockShootingTaskViewModel + /// 图传使用独立状态,刷新与播放不会影响任务阶段或固定布局。 + let liveViewModel: DroneDockLiveViewModel + private let realtimeSession: DroneDockShootingRealtimeSession? + + private let topView = UIView() + private let summaryView = UIView() + private let taskTitleLabel = DroneDockStyle.label(size: 17, weight: .semibold) + private let subtitleLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let feedPlaceholder: DroneDockTaskLiveView + private let telemetryView = DroneShootingTaskTelemetryView() + private let statusView = DroneDockTaskStatusView() + private let safetyView = DroneDockTaskSafetyView() + private var summaryHeight: Constraint? + private var safetyHeight: Constraint? + private var compactLayout: Bool? + private var bottomInset: CGFloat = -1 + private let materialsControllerFactory: @MainActor (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController + private let simulationRecordsProvider: (@MainActor () -> String)? + private let shootingPollDelay: @Sendable (UInt64) async throws -> Void + private var pollTask: Task? + private var pollGeneration = 0 + private var refreshTask: Task? + private var startTask: Task? + private var commandTasks: [UUID: Task] = [:] + private var commandAttemptIDs: [DroneDockSafetyCommand: UUID] = [:] + private var submittingCommands: Set = [] + private var resummonTask: Task? + private var liveTask: Task? + private var liveParameterTask: Task? + private let liveParameterDelay: @Sendable (TimeInterval) async throws -> Void + private var liveGeneration = 0 + private var requestGeneration = 0 + private var isPageVisible = false + private var isApplicationActive = false + private var isRequesting = false + private var isStartingAction = false + private var isSendingSafetyAction: Bool { !submittingCommands.isEmpty } + private var isResummoningAction = false + private var wasRealtimeLive = false + private let coverURL: URL? + private var stoppedLiveExecutionTitles: [String: String] = [:] + private var displayedCompletionIDs: Set = [] + private var completionNotice: DroneDockRecordingCompletionView? + private let countdownDelay: @Sendable () async throws -> Void + private var countdownTask: Task? + private var countdownGeneration = 0 + private var diagnosticStateData: [String: Data] = [:] + private var countdownDiagnosticKey: String? + private var entrySource = "existing_task_or_direct" + + /// 构造时只保存依赖,首次 GET 必须等页面完整出现后才发送。 + init(viewModel: DroneDockShootingTaskViewModel, + liveViewModel: DroneDockLiveViewModel? = nil, + livePlayer: (any DroneDockLivePlaying)? = nil, + coverURL: URL? = nil, + realtimeSession: DroneDockShootingRealtimeSession? = nil, + materialsControllerFactory: (@MainActor (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + simulationRecordsProvider: (@MainActor () -> String)? = nil, + shootingPollDelay: @escaping @Sendable (UInt64) async throws -> Void = { try await Task.sleep(nanoseconds: $0) }, + liveParameterDelay: @escaping @Sendable (TimeInterval) async throws -> Void = { try await Task.sleep(for: .seconds($0)) }, + countdownDelay: @escaping @Sendable () async throws -> Void = { try await Task.sleep(for: .seconds(1)) }) { + self.viewModel = viewModel + self.coverURL = coverURL + self.feedPlaceholder = livePlayer.map { DroneDockTaskLiveView(rtcPlayer: $0) } ?? DroneDockTaskLiveView() + self.realtimeSession = realtimeSession + self.liveViewModel = liveViewModel ?? DroneDockLiveViewModel( + context: viewModel.context, taskID: viewModel.taskID, + currentContext: { DroneDockHomeViewController.currentContext() }) + self.simulationRecordsProvider = simulationRecordsProvider + self.shootingPollDelay = shootingPollDelay + self.liveParameterDelay = liveParameterDelay + self.countdownDelay = countdownDelay + self.materialsControllerFactory = materialsControllerFactory ?? { order, context in + DroneDockMaterialsViewController(viewModel: DroneDockMaterialsViewModel( + context: context, order: order, + service: DroneDockMaterialsAPI(client: NetworkServices.shared.apiClient), + currentContext: { DroneDockHomeViewController.currentContext() })) + } + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + realtimeSession?.onSnapshot = { [weak self] snapshot in + guard let self, self.isPageVisible, self.isApplicationActive else { return .invalid } + let result = self.viewModel.applyTaskSnapshot(snapshot, source: .webSocket) + self.applySnapshot() + return result + } + realtimeSession?.onConnectionState = { [weak self] state in + self?.connectionStateChanged(state) + } + realtimeSession?.onHTTPSeedRequired = { [weak self] in + self?.refreshTaskIfVisible(isPolling: true) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 仅记录导航来源与上游诊断会话,不改变任务身份、页面加载或设备操作。 + func recordNavigationEntry(source: String, fields: [String: Any] = [:]) { + entrySource = source + logEvent("navigation.task_entry", fields: fields) + } + + deinit { + pollTask?.cancel() + refreshTask?.cancel() + startTask?.cancel() + commandTasks.values.forEach { $0.cancel() } + resummonTask?.cancel() + liveTask?.cancel() + liveParameterTask?.cancel() + countdownTask?.cancel() + NotificationCenter.default.removeObserver(self) + } + + /// 使用常规导航返回准备页,不劫持返回手势或自动创建任务。 + override func setupNavigationBar() { + title = simulationRecordsProvider == nil ? "拍摄任务" : "拍摄任务 · 本地模拟" + navigationItem.backButtonDisplayMode = .minimal + let refresh = UIBarButtonItem(image: UIImage(systemName: "arrow.clockwise"), style: .plain, + target: self, action: #selector(refreshTriggered)) + refresh.accessibilityLabel = "刷新任务状态" + refresh.accessibilityIdentifier = "drone.task.remote.navigationRefresh" + navigationItem.rightBarButtonItem = refresh + if simulationRecordsProvider != nil { + let records = UIBarButtonItem(image: UIImage(systemName: "doc.text"), style: .plain, + target: self, action: #selector(showSimulationRecords)) + records.accessibilityLabel = "查看模拟接口回执" + records.accessibilityIdentifier = "drone.task.mock.recordsButton" + navigationItem.rightBarButtonItems = [refresh, records] + } + } + + /// 顶部、中间状态和安全控制分开布局,状态切换不影响外部区域大小。 + override func setupUI() { + view.backgroundColor = .white + topView.accessibilityIdentifier = "drone.task.remote.top" + summaryView.accessibilityIdentifier = "drone.task.remote.summary" + statusView.accessibilityIdentifier = "drone.task.remote.stateContainer" + safetyView.accessibilityIdentifier = "drone.task.remote.safety" + view.addSubview(topView) + view.addSubview(statusView) + view.addSubview(safetyView) + topView.addSubview(summaryView) + summaryView.addSubview(taskTitleLabel) + summaryView.addSubview(subtitleLabel) + taskTitleLabel.numberOfLines = 1 + taskTitleLabel.lineBreakMode = .byTruncatingTail + taskTitleLabel.accessibilityIdentifier = "drone.task.remote.title" + subtitleLabel.numberOfLines = 1 + subtitleLabel.lineBreakMode = .byTruncatingTail + subtitleLabel.accessibilityIdentifier = "drone.task.remote.subtitle" + topView.addSubview(feedPlaceholder) + topView.addSubview(telemetryView) + telemetryView.accessibilityIdentifier = "drone.task.remote.telemetry" + telemetryView.configureFixedLayout(compact: false) + applySnapshot() + } + + /// 图传保持 16:9,底部贴安全区,中间占满剩余空间且没有滚动容器。 + override func setupConstraints() { + topView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + } + summaryView.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + summaryHeight = make.height.equalTo(60).constraint + } + taskTitleLabel.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(16) + make.bottom.equalTo(summaryView.snp.centerY).offset(-1) + } + subtitleLabel.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(16) + make.top.equalTo(summaryView.snp.centerY).offset(2) + } + feedPlaceholder.snp.makeConstraints { make in + make.top.equalTo(summaryView.snp.bottom) + make.leading.trailing.equalToSuperview() + make.height.equalTo(feedPlaceholder.snp.width).multipliedBy(9.0 / 16.0) + } + telemetryView.snp.makeConstraints { make in + make.top.equalTo(feedPlaceholder.snp.bottom) + make.leading.trailing.bottom.equalToSuperview() + } + safetyView.snp.makeConstraints { make in + make.leading.trailing.bottom.equalToSuperview() + safetyHeight = make.height.equalTo(104).constraint + } + statusView.snp.makeConstraints { make in + make.top.equalTo(topView.snp.bottom) + make.bottom.equalTo(safetyView.snp.top) + make.leading.trailing.equalToSuperview() + } + } + + /// 只按设备可用尺寸调整固定区域,数据、错误和加载状态不会改变它们的高度。 + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + defer { recordRenderedState() } + let availableHeight = view.bounds.height - view.safeAreaInsets.top - view.safeAreaInsets.bottom + let compact = availableHeight < 680 + let inset = view.safeAreaInsets.bottom + guard compactLayout != compact || bottomInset != inset else { return } + compactLayout = compact + bottomInset = inset + summaryHeight?.update(offset: compact ? 44 : 60) + safetyHeight?.update(offset: (compact ? 90 : 104) + inset) + telemetryView.configureFixedLayout(compact: compact) + safetyView.configure(compact: compact) + taskTitleLabel.font = .systemFont(ofSize: compact ? 16 : 17, weight: .semibold) + } + + /// 绑定页面操作与主线程播放回调;飞控仍受构建策略、服务注入及任务门禁约束。 + override func bindActions() { + statusView.onPrimaryAction = { [weak self] in self?.primaryActionTriggered() } + statusView.onDetails = { [weak self] in self?.showStatusDetails() } + safetyView.onCommand = { [weak self] command in self?.safetyCommandTriggered(command) } + feedPlaceholder.onRequest = { [weak self] in self?.refreshLiveIfVisible() } + feedPlaceholder.onDiagnosticEvent = { [weak self] event, fields in self?.logEvent(event, fields: fields) } + feedPlaceholder.onPlaybackEvent = { [weak self] event, sessionID in + guard let self else { return } + self.recordPlaybackEvent(event, sessionID: sessionID) + guard self.isPageVisible, self.isApplicationActive else { return } + self.liveViewModel.receivePlaybackEvent(event, sessionID: sessionID) + if self.liveViewModel.playbackSessionID == nil { + self.liveParameterTask?.cancel() + self.liveParameterTask = nil + } + self.applySnapshot() + } + NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), + name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + /// 完整进入任务页先读取一次,再启动同一任务的只读订阅。 + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + isPageVisible = true + isApplicationActive = UIApplication.shared.applicationState == .active + logEvent("page.appeared", fields: ["navigation_stack": navigationController?.viewControllers.map { String(describing: type(of: $0)) } ?? []]) + refreshTaskIfVisible() + refreshLiveIfVisible(automatically: true) + } + + /// 离页立即取消未完成的读取,使迟到响应失效。 + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + isPageVisible = false + dismissCompletionNotice() + logEvent("page.disappeared", fields: ["moving_from_parent": isMovingFromParent, "being_dismissed": isBeingDismissed]) + cancelRefresh() + stopLive() + } + + private func applySnapshot() { + guard isViewLoaded else { return } + if viewModel.shouldStopLiveReception { + stoppedLiveExecutionTitles[viewModel.recordingExecutionID] = viewModel.isRecordingFinished + ? "拍摄已完成" : "无人机已返回机巢" + } + let stoppedLiveTitle = stoppedLiveExecutionTitles[viewModel.recordingExecutionID] + let liveReceptionEnded = stoppedLiveTitle != nil + if !viewModel.shouldPresentRecordingCompletion { dismissCompletionNotice() } + if liveReceptionEnded, liveTask != nil || liveParameterTask != nil || liveViewModel.playbackSessionID != nil || liveViewModel.playbackURL != nil { + stopLive() + } + feedPlaceholder.showRecordingCover(liveReceptionEnded, url: coverURL, + title: stoppedLiveTitle ?? "拍摄已完成") + let loading = (viewModel.response == nil && (isRequesting || viewModel.isLoading)) + || isStartingAction || viewModel.isStartingShooting + || isResummoningAction || viewModel.isResummoning + feedPlaceholder.apply(liveViewModel) + feedPlaceholder.setPlaybackActive(isPageVisible && isApplicationActive && !liveReceptionEnded) + taskTitleLabel.text = viewModel.title + subtitleLabel.text = viewModel.subtitle + (viewModel.response?.metricsStale == true ? " · 读数已过期" : "") + let telemetry = viewModel.telemetry + telemetryView.apply(values: [telemetry.batteryText, telemetry.temperatureText, telemetry.windText, + telemetry.rainText, telemetry.signalText, telemetry.satelliteText], + isStale: viewModel.isTelemetryStale, accessibilityPrefix: "drone.task.remote.metric", preservingStaleValues: true) + let presentation = viewModel.presentation + setPageLoading(viewModel.response == nil && loading && presentation.phase != .navigating) + let value = loading && viewModel.response == nil && presentation.phase != .navigating ? DroneDockTaskPresentation( + phase: .loading, title: "正在获取任务状态", message: "正在读取当前拍摄任务", + deviceStatus: "—", action: .none, actionTitle: nil, isActionEnabled: false) : presentation + let primaryActionLoading = value.action == .resume + && (submittingCommands.contains(.resume) || viewModel.isCommandLoading(.resume)) + || value.action == .start && (isStartingAction || viewModel.isStartingShooting) + statusView.apply(value, isRefreshing: loading, isPrimaryActionLoading: primaryActionLoading) + updateArrivalCountdown() + safetyView.apply(model: viewModel, isSimulation: simulationRecordsProvider != nil, + isInteractive: isPageVisible && isApplicationActive && !loading, + submittingCommands: submittingCommands) + statusView.isUserInteractionEnabled = isPageVisible && isApplicationActive && !loading + navigationItem.rightBarButtonItems?.forEach { $0.isEnabled = isPageVisible && isApplicationActive && !loading } + navigationItem.rightBarButtonItem?.accessibilityValue = loading ? "正在刷新" : nil + recordRenderedState() + presentCompletionNoticeIfNeeded() + refreshLiveIfVisible(automatically: true) + } + + /// 倒计时只更新开拍按钮文案;网络读取、飞控及后端阶段仍由原有流程驱动。 + private func updateArrivalCountdown() { + let seconds = viewModel.countdownRemainingSeconds + statusView.updateCountdown(seconds: seconds) + recordCountdownState(seconds) + guard isPageVisible, isApplicationActive, let seconds, seconds > 0 else { + stopArrivalCountdown() + return + } + guard countdownTask == nil else { return } + countdownGeneration += 1 + let generation = countdownGeneration + let delay = countdownDelay + countdownTask = Task { @MainActor [weak self] in + while !Task.isCancelled { + do { try await delay() } catch { return } + guard let self, !Task.isCancelled, self.countdownGeneration == generation, + self.isPageVisible, self.isApplicationActive else { return } + let remaining = self.viewModel.countdownRemainingSeconds + self.statusView.updateCountdown(seconds: remaining) + self.recordCountdownState(remaining) + if remaining == nil || remaining == 0 { + self.countdownTask = nil + return + } + } + } + } + + private func stopArrivalCountdown() { + countdownGeneration += 1 + countdownTask?.cancel() + countdownTask = nil + } + + private func presentCompletionNoticeIfNeeded() { + let id = viewModel.recordingExecutionID + guard viewModel.shouldPresentRecordingCompletion, isPageVisible, isApplicationActive, view.window != nil, + presentedViewController == nil, completionNotice == nil, !displayedCompletionIDs.contains(id) else { return } + displayedCompletionIDs.insert(id) + let notice = DroneDockRecordingCompletionView() + completionNotice = notice + logEvent("ui.completion_notice.shown") + notice.onLater = { [weak self] in + self?.logEvent("ui.completion_notice.later") + self?.dismissCompletionNotice() + } + notice.onViewMaterials = { [weak self] in + guard let self, self.isPageVisible, self.isApplicationActive, + self.viewModel.recordingExecutionID == id else { return } + self.logEvent("ui.completion_notice.view_materials") + self.dismissCompletionNotice() + self.openMaterials() + } + let container = navigationController?.view ?? view! + container.addSubview(notice) + notice.snp.makeConstraints { $0.edges.equalToSuperview() } + UIAccessibility.post(notification: .screenChanged, argument: notice) + } + + private func dismissCompletionNotice() { + if completionNotice != nil { logEvent("ui.completion_notice.dismissed") } + completionNotice?.removeFromSuperview() + completionNotice = nil + } + + private func openMaterials() { + guard isPageVisible, isApplicationActive, presentedViewController == nil, + viewModel.presentation.action == .materials, viewModel.presentation.isActionEnabled, + let navigationController, navigationController.topViewController === self else { return } + dismissCompletionNotice() + navigationController.pushViewController(materialsControllerFactory(viewModel.order, viewModel.context), animated: true) + } + + private func primaryActionTriggered() { + logEvent("action.primary", fields: ["action": String(describing: viewModel.presentation.action), + "enabled": viewModel.presentation.isActionEnabled]) + guard isPageVisible, isApplicationActive, + !isStartingAction, !viewModel.isStartingShooting, + !isResummoningAction, !viewModel.isResummoning else { + logEvent("action.primary.rejected", fields: ["reason": "page_or_submission_guard", "ui": statusView.diagnosticFields]) + return + } + let state = viewModel.presentation + guard state.isActionEnabled else { + logEvent("action.primary.rejected", fields: ["reason": "presentation_action_disabled", "ui": statusView.diagnosticFields]) + return + } + switch state.action { + case .refresh: + refreshTaskIfVisible() + case .start: + startShootingIfAllowed() + case .retry: + resummonIfAllowed() + case .materials: + openMaterials() + case .resume: + safetyCommandTriggered(.resume) + case .none: + break + } + } + + private func showStatusDetails() { + guard isPageVisible, isApplicationActive, presentedViewController == nil else { return } + let state = viewModel.presentation + var texts = [state.title, state.message, state.deviceStatus].filter { !$0.isEmpty && $0 != "—" } + if viewModel.response != nil, let error = viewModel.errorMessage { + texts.append("刷新失败,当前显示上次数据:\(error)") + } + if case .fallback(let message) = realtimeSession?.state { + texts.append("实时连接暂不可用,已使用接口更新:\(message)") + } + if let error = viewModel.startErrorMessage { texts.append(error) } + if let error = viewModel.commandErrorMessage { texts.append(error) } + if let error = viewModel.resummonErrorMessage { texts.append(error) } + var distinct: [String] = [] + for text in texts where !distinct.contains(text) { distinct.append(text) } + let alert = UIAlertController(title: "任务状态详情", message: distinct.joined(separator: "\n\n"), preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "关闭", style: .cancel)) + present(alert, animated: true) + } + + /// 前台可见时串行读取;轮询失败保留旧快照,下个周期再读,不重复弹出提示。 + private func refreshTaskIfVisible(isPolling: Bool = false) { + guard isPageVisible, isApplicationActive, viewModel.readAccessError == nil, !isRequesting, !viewModel.isLoading, + !isStartingAction, !viewModel.isStartingShooting, + !isResummoningAction, !viewModel.isResummoning else { return } + cancelScheduledPoll() + requestGeneration &+= 1 + let generation = requestGeneration + let httpSeedRequest = realtimeSession?.pendingHTTPSeedRequest + isRequesting = true + applySnapshot() + refreshTask = Task { @MainActor [weak self] in + guard let self else { return } + let seedResult: DroneDockHTTPSnapshotResult? + if httpSeedRequest != nil { seedResult = await self.viewModel.refreshForRealtimeSeed() } + else { await self.viewModel.refresh(); seedResult = nil } + guard self.isPageVisible, self.isApplicationActive, + self.requestGeneration == generation, !Task.isCancelled else { return } + self.refreshTask = nil + self.isRequesting = false + if let httpSeedRequest, let seedResult { + self.realtimeSession?.acceptHTTPSeed(seedResult, requestID: httpSeedRequest) + } + self.applySnapshot() + if self.viewModel.canContinuePolling { self.realtimeSession?.start() } + else { self.realtimeSession?.stop() } + // 无缓存提示可能在旧 HTTP 读取途中到达;旧请求不充当首包,结束后再串行补读。 + if let pendingSeed = self.realtimeSession?.pendingHTTPSeedRequest, pendingSeed != httpSeedRequest, + self.viewModel.canContinuePolling { + self.refreshTaskIfVisible(isPolling: true) + return + } + self.scheduleNextPoll() + if !isPolling, self.viewModel.response != nil, let error = self.viewModel.errorMessage { + self.showToast("刷新失败,当前显示上次数据:\(error)") + } + } + } + + /// 每次读取或控制流程结束后仅安排一个可取消的延时,不持有页面等待计时结束。 + private func scheduleNextPoll() { + cancelScheduledPoll() + guard isPageVisible, isApplicationActive, viewModel.canContinuePolling, + realtimeSession?.state != .live, + !isRequesting, !isStartingAction, !isResummoningAction else { return } + let generation = pollGeneration + let delay = shootingPollDelay + let interval = viewModel.pollIntervalNanoseconds + pollTask = Task { @MainActor [weak self] in + do { try await delay(interval) } catch { return } + guard !Task.isCancelled, let self, self.pollGeneration == generation else { return } + self.pollTask = nil + self.refreshTaskIfVisible(isPolling: true) + } + } + + private func cancelScheduledPoll() { + pollGeneration &+= 1 + pollTask?.cancel() + pollTask = nil + } + + /// 用户操作优先于后台读取;不停止 Socket,也不解除任何已提交操作的防重锁。 + private func cancelPendingReadForAction() { + cancelScheduledPoll() + requestGeneration &+= 1 + refreshTask?.cancel() + refreshTask = nil + isRequesting = false + viewModel.invalidatePendingRefresh() + } + + private func cancelRefresh() { + stopArrivalCountdown() + wasRealtimeLive = false + realtimeSession?.stop() + cancelScheduledPoll() + requestGeneration &+= 1 + refreshTask?.cancel() + refreshTask = nil + startTask?.cancel() + startTask = nil + commandTasks.values.forEach { $0.cancel() } + commandTasks.removeAll() + commandAttemptIDs.removeAll() + submittingCommands.removeAll() + resummonTask?.cancel() + resummonTask = nil + isResummoningAction = false + isStartingAction = false + isRequesting = false + viewModel.invalidate(preservingSnapshot: true) + applySnapshot() + } + + private func connectionStateChanged(_ state: DroneDockShootingRealtimeSession.State) { + logChangedEvent("page.realtime_state", fields: ["state": String(describing: state)]) + guard isPageVisible, isApplicationActive else { return } + switch state { + case .live: + wasRealtimeLive = true + cancelScheduledPoll() + applySnapshot() + case .denied(let message): + wasRealtimeLive = false + cancelScheduledPoll() + requestGeneration &+= 1 + refreshTask?.cancel() + refreshTask = nil + isRequesting = false + viewModel.stopReading(message: message) + applySnapshot() + showToast(message) + case .fallback: + // 断线立即尝试一次 GET;已有读/写流程则由其完成回调安排下一轮,绝不并发。 + let shouldRefreshImmediately = wasRealtimeLive + wasRealtimeLive = false + if shouldRefreshImmediately { refreshTaskIfVisible(isPolling: true) } + else if pollTask == nil { scheduleNextPoll() } + case .connecting: + // 重连不能不断重置 HTTP 计时,否则长时间异常会饿死兜底请求。 + if pollTask == nil { scheduleNextPoll() } + case .stopped: wasRealtimeLive = false + } + } + + /// 点击后的同步锁覆盖 Task 调度间隙,回执成功后的单次回查由 ViewModel 协调。 + private func startShootingIfAllowed() { + guard !isStartingAction, !isSendingSafetyAction, !isResummoningAction, viewModel.canStartShooting else { return } + cancelPendingReadForAction() + let generation = requestGeneration + isStartingAction = true + applySnapshot() + startTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.startShooting { [weak self] in self?.applySnapshot() } + guard self.isPageVisible, self.isApplicationActive, + self.requestGeneration == generation, !Task.isCancelled else { return } + self.startTask = nil + self.isStartingAction = false + self.applySnapshot() + self.scheduleNextPoll() + if let error = self.viewModel.startErrorMessage { + self.showToast(error) + } else if let error = self.viewModel.errorMessage { + self.showToast("开始请求已受理,状态刷新失败:\(error)") + } + } + } + + /// 重召唤使用原任务 ID,回执后再查询状态,避免从受理结果推断设备已到达。 + private func resummonIfAllowed() { + guard isPageVisible, isApplicationActive, + !isResummoningAction, !isStartingAction, !isSendingSafetyAction, + viewModel.canResummon else { return } + cancelPendingReadForAction() + let generation = requestGeneration + isResummoningAction = true + applySnapshot() + resummonTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.resummon { [weak self] in self?.applySnapshot() } + guard self.isPageVisible, self.isApplicationActive, + self.requestGeneration == generation, !Task.isCancelled else { return } + self.resummonTask = nil + self.isResummoningAction = false + self.applySnapshot() + self.scheduleNextPoll() + if let error = self.viewModel.resummonErrorMessage { + self.showToast(error) + } else if self.viewModel.hasSubmittedResummon, let error = self.viewModel.errorMessage { + self.showToast("重召唤已受理,状态刷新失败:\(error)") + } else if self.viewModel.hasSubmittedResummon { + self.showToast(self.simulationRecordsProvider != nil + ? "本地模拟重召唤已受理,未发送设备指令" : "重召唤请求已受理,请等待任务状态更新") + } else if let error = self.viewModel.errorMessage { + self.showToast(error) + } + } + } + + /// 可见且活跃时自动开启一次;失败可手动重试,不随 shooting/Socket 刷新重复请求。 + private func refreshLiveIfVisible(automatically: Bool = false, keepingPlayback: Bool = false) { + guard viewModel.response != nil, viewModel.readAccessError == nil, + stoppedLiveExecutionTitles[viewModel.recordingExecutionID] == nil, !viewModel.shouldStopLiveReception else { return } + guard !automatically || liveViewModel.loadsAutomatically else { return } + guard isPageVisible, isApplicationActive, liveTask == nil, liveViewModel.canLoad else { return } + liveParameterTask?.cancel() + liveParameterTask = nil + logEvent("live.request", fields: ["automatic": automatically, "keeping_playback": keepingPlayback]) + liveGeneration &+= 1 + let generation = liveGeneration + liveTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.liveViewModel.refresh(keepingPlayback: keepingPlayback) { [weak self] in self?.applySnapshot() } + guard self.liveGeneration == generation, self.isPageVisible, self.isApplicationActive, + !Task.isCancelled else { return } + self.liveTask = nil + self.applySnapshot() + self.scheduleLiveParameterRefresh() + } + } + + /// 缺少第二路或凭证临期才重新取参数;补流/续期保留健康房间,不随 shooting 轮询。 + private func scheduleLiveParameterRefresh() { + liveParameterTask?.cancel() + liveParameterTask = nil + guard isPageVisible, isApplicationActive, let interval = liveViewModel.nextParameterRefreshDelay else { return } + let generation = liveGeneration + let delay = liveParameterDelay + liveParameterTask = Task { @MainActor [weak self] in + do { try await delay(interval) } catch { return } + guard let self, !Task.isCancelled, self.liveGeneration == generation, + self.isPageVisible, self.isApplicationActive, + self.liveViewModel.nextParameterRefreshDelay != nil else { return } + self.liveParameterTask = nil + self.refreshLiveIfVisible(keepingPlayback: true) + } + } + + /// 离页或进入后台立即释放播放器,使旧图传响应无法恢复播放。 + private func stopLive() { + if liveTask != nil || liveParameterTask != nil || liveViewModel.playbackSessionID != nil || liveViewModel.playbackURL != nil { + logEvent("live.reception_stopping", fields: ["recording_finished": viewModel.isRecordingFinished, + "task_requires_stop": viewModel.shouldStopLiveReception, "ui": feedPlaceholder.diagnosticFields]) + } + liveGeneration &+= 1 + liveParameterTask?.cancel() + liveParameterTask = nil + liveTask?.cancel() + liveTask = nil + liveViewModel.invalidate() + feedPlaceholder.setPlaybackActive(false) + feedPlaceholder.apply(liveViewModel) + } + + /// 安全动作点击后直接提交,沿用当前任务的权限与防重校验。 + private func safetyCommandTriggered(_ command: DroneDockSafetyCommand) { + logEvent("action.safety", fields: ["command": command.rawValue, "enabled": viewModel.canSendCommand(command)]) + guard isPageVisible, isApplicationActive, + presentedViewController == nil, !submittingCommands.contains(command), !isStartingAction, + !isResummoningAction, viewModel.canSendCommand(command) else { + logSafetyRejection(command, stage: "tap") + return + } + sendSafetyCommand(command) + } + + /// 同步锁只覆盖同一按钮;不同安全动作可各自等待,设备确认由 ViewModel 和快照处理。 + private func sendSafetyCommand(_ command: DroneDockSafetyCommand) { + guard isPageVisible, isApplicationActive, + !submittingCommands.contains(command), !isStartingAction, !isResummoningAction, + viewModel.canSendCommand(command) else { + logSafetyRejection(command, stage: "submit") + return + } + cancelPendingReadForAction() + let attemptID = UUID() + logEvent("action.safety.submitting", fields: ["command": command.rawValue, "ui_attempt_id": attemptID.uuidString]) + commandAttemptIDs[command] = attemptID + submittingCommands.insert(command) + applySnapshot() + commandTasks[attemptID] = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.sendCommand(command) { [weak self] in + guard let self, self.commandAttemptIDs[command] == attemptID else { return } + // ViewModel 已建立本次操作后,加载状态完全交由其管理;后续只读回查不延长动画。 + self.submittingCommands.remove(command) + self.applySnapshot() + } + self.commandTasks.removeValue(forKey: attemptID) + guard self.isPageVisible, self.isApplicationActive, + self.commandAttemptIDs[command] == attemptID, !Task.isCancelled else { return } + self.commandAttemptIDs.removeValue(forKey: command) + self.submittingCommands.remove(command) + self.applySnapshot() + self.scheduleNextPoll() + if let error = self.viewModel.commandErrorMessage(for: command) { + self.showToast(error) + } + } + } + + /// 模拟入口专用记录页,内容由内存传输提供,不请求后端日志或设备。 + @objc private func showSimulationRecords() { + guard let simulationRecordsProvider, presentedViewController == nil else { return } + let controller = DroneDockSimulationRecordsViewController(records: simulationRecordsProvider()) + present(UINavigationController(rootViewController: controller), animated: true) + } + + @objc private func refreshTriggered() { + logEvent("action.refresh") + guard isPageVisible, isApplicationActive, !isRequesting, !viewModel.isLoading else { + logEvent("action.refresh.rejected", fields: ["reason": "page_or_read_guard", "read_in_progress": isRequesting || viewModel.isLoading]) + return + } + refreshTaskIfVisible() + } + + @objc private func applicationWillResignActive() { + isApplicationActive = false + logEvent("app.inactive") + cancelRefresh() + stopLive() + } + + @objc private func applicationDidBecomeActive() { + guard !isApplicationActive else { return } + isApplicationActive = true + logEvent("app.active") + refreshTaskIfVisible() + refreshLiveIfVisible(automatically: true) + } + + private func logEvent(_ name: String, fields: [String: Any] = [:]) { + var fields = fields + fields["source"] = simulationRecordsProvider == nil ? "task_page" : "local_simulation" + fields["entry_source"] = entrySource + fields["page_visible"] = isPageVisible + fields["app_active"] = isApplicationActive + fields["view_in_window"] = isViewLoaded && view.window != nil + viewModel.recordTaskEvent(name, fields: fields) + } + + /// 去重只比较 UI 可观察值,不把快照版本或逐秒计时加入比较。 + private func logChangedEvent(_ name: String, fields: [String: Any]) { + guard let data = try? JSONSerialization.data(withJSONObject: fields, options: [.sortedKeys]), + diagnosticStateData[name] != data else { return } + diagnosticStateData[name] = data + logEvent(name, fields: fields) + } + + private func recordRenderedState() { + logChangedEvent("ui.render", fields: ["central": statusView.diagnosticFields, + "safety": safetyView.diagnosticFields, "page_visible": isPageVisible, + "app_active": isApplicationActive, "starting": isStartingAction || viewModel.isStartingShooting, + "resummoning": isResummoningAction || viewModel.isResummoning, + "submitting_commands": submittingCommands.map(\.rawValue).sorted()]) + var liveFields = feedPlaceholder.diagnosticFields + switch liveViewModel.state { + case .idle: liveFields["state"] = "idle" + case .loading: liveFields["state"] = "loading" + case .connecting: liveFields["state"] = "connecting" + case .playing: liveFields["state"] = "playing" + case .localPreview: liveFields["state"] = "local_preview" + case .unavailable(let message): liveFields["state"] = "unavailable"; liveFields["reason"] = message + case .failed(let message): liveFields["state"] = "failed"; liveFields["reason"] = message + } + liveFields["active_role"] = liveViewModel.activeRole as Any? ?? NSNull() + liveFields["playback_session"] = liveViewModel.playbackSessionID?.uuidString as Any? ?? NSNull() + logChangedEvent("live.render", fields: liveFields) + } + + private func recordCountdownState(_ seconds: Int?) { + let stage = !isPageVisible || !isApplicationActive || seconds == nil ? "hidden" : seconds == 0 ? "zero" : "running" + let key = viewModel.recordingExecutionID + ":" + stage + guard countdownDiagnosticKey != key else { return } + countdownDiagnosticKey = key + logEvent("ui.countdown", fields: ["state": stage, "remaining_seconds": seconds as Any? ?? NSNull(), + "execution_id": viewModel.recordingExecutionID]) + } + + private func recordPlaybackEvent(_ event: DroneDockLivePlaybackEvent, sessionID: UUID) { + var fields: [String: Any] = ["playback_session": sessionID.uuidString, + "page_session_valid": isPageVisible && isApplicationActive && liveViewModel.playbackSessionID == sessionID, + "previous_role": liveViewModel.activeRole as Any? ?? NSNull()] + let name: String + switch event { + case .firstFrame: + name = "live.first_frame" + fields["role"] = liveViewModel.rtcConfiguration?.role as Any? ?? NSNull() + case .sourceChanged(let role): + name = "live.source_changed" + fields["role"] = role as Any? ?? NSNull() + fields["fallback_to_airport"] = liveViewModel.activeRole == "drone" && role == "airport" + case .failed(let message): name = "live.receiver.failed"; fields["message"] = message + case .expired: name = "live.receiver.expired" + } + logChangedEvent(name, fields: fields) + } + + private func logSafetyRejection(_ command: DroneDockSafetyCommand, stage: String) { + var reasons: [String] = [] + if !isPageVisible { reasons.append("page_hidden") } + if !isApplicationActive { reasons.append("app_inactive") } + if stage == "tap", presentedViewController != nil { reasons.append("modal_presented") } + if submittingCommands.contains(command) { reasons.append("same_command_submitting") } + if isStartingAction { reasons.append("start_submitting") } + if isResummoningAction { reasons.append("resummon_submitting") } + if !viewModel.canSendCommand(command) { reasons.append("model_command_not_allowed") } + logEvent("action.safety.rejected", fields: ["command": command.rawValue, "stage": stage, + "reasons": reasons, "safety": safetyView.diagnosticFields]) + } + +} + +/// 以可选择的 JSON 文本展示本地模拟请求与回执,避免与真实接口联调混淆。 +@MainActor +final class DroneDockSimulationRecordsViewController: BaseViewController { + private let records: String + private let textView = UITextView() + + /// 固定展示打开时的内存记录快照。 + init(records: String) { + self.records = records + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { + title = "本地模拟回执(未联网)" + navigationItem.rightBarButtonItem = UIBarButtonItem(title: "关闭", style: .done, + target: self, action: #selector(close)) + } + + override func setupUI() { + view.backgroundColor = .systemBackground + textView.isEditable = false + textView.font = .monospacedSystemFont(ofSize: 12, weight: .regular) + textView.text = records + textView.accessibilityIdentifier = "drone.task.mock.records" + textView.textContainerInset = UIEdgeInsets(top: 16, left: 12, bottom: 24, right: 12) + view.addSubview(textView) + } + + override func setupConstraints() { + textView.snp.makeConstraints { make in make.edges.equalTo(view.safeAreaLayoutGuide) } + } + + @objc private func close() { dismiss(animated: true) } +} + +/// 固定底部的安全控制,文案来自本地阶段,操作许可统一由任务模型判断。 +@MainActor +private final class DroneDockTaskSafetyView: UIView { + /// 将用户选择的白名单指令交给页面,不直接调用任何服务。 + var onCommand: ((DroneDockSafetyCommand) -> Void)? + private let header = DroneDockStyle.label("安全控制", size: 11, color: DroneDockStyle.secondary) + private let pauseButton = DroneShootingTaskSafetyButton(symbol: "pause.circle", color: UIColor(hex: 0xEC982A), filled: true) + private let returnButton = DroneShootingTaskSafetyButton(symbol: "arrow.uturn.backward", color: UIColor(hex: 0xD85762), filled: false) + private let buttons = UIStackView() + private var headerTop: Constraint? + private var headerHeight: Constraint? + private var buttonGap: Constraint? + private var buttonHeight: Constraint? + + /// 两个固定按钮实际显示的标题、字幕、启用和加载状态。 + var diagnosticFields: [String: Any] { + ["pause": pauseButton.diagnosticFields, "return_home": returnButton.diagnosticFields] + } + + /// 复用安全按钮样式,初始没有状态数据时保持禁用。 + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + addSubview(divider) + divider.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + make.height.equalTo(0.5) + } + header.textAlignment = .center + addSubview(header) + buttons.axis = .horizontal + buttons.spacing = 8 + buttons.distribution = .fillEqually + buttons.addArrangedSubview(pauseButton) + buttons.addArrangedSubview(returnButton) + addSubview(buttons) + pauseButton.accessibilityIdentifier = "drone.task.remote.pause" + returnButton.accessibilityIdentifier = "drone.task.remote.return" + pauseButton.apply(title: "紧急暂停", subtitle: "暂不可用", enabled: false) + returnButton.apply(title: "立即返航", subtitle: "暂不可用", enabled: false) + pauseButton.addTarget(self, action: #selector(pauseTapped), for: .touchUpInside) + returnButton.addTarget(self, action: #selector(returnTapped), for: .touchUpInside) + header.snp.makeConstraints { make in + headerTop = make.top.equalToSuperview().offset(10).constraint + make.leading.trailing.equalToSuperview().inset(16) + headerHeight = make.height.equalTo(14).constraint + } + buttons.snp.makeConstraints { make in + buttonGap = make.top.equalTo(header.snp.bottom).offset(8).constraint + make.leading.trailing.equalToSuperview().inset(16) + buttonHeight = make.height.equalTo(62).constraint + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 两个按钮始终表示暂停与返航;已暂停、返航中和回巢使用本地文案,恢复入口位于中央。 + func apply(model: DroneDockShootingTaskViewModel, isSimulation: Bool, isInteractive: Bool, + submittingCommands: Set = []) { + let phase = model.presentation.phase + var controlState = model.flightControlState + if model.response?.flightControl == nil { + switch phase { + case .paused: controlState = .paused + case .returning: controlState = .returning + case .returned: controlState = .returned + default: break + } + } + header.text = isSimulation ? "安全控制 · 本地模拟,不发送设备指令" : "安全控制" + for (button, command) in [(pauseButton, DroneDockSafetyCommand.pause), (returnButton, .returnHome)] { + var title = command == .pause ? "紧急暂停" : "立即返航" + var subtitle = command == .pause ? "悬停待命" : "中断任务" + if controlState == .paused, command == .pause { + title = "已暂停" + } else if controlState == .returning { + if command == .returnHome { + title = "返航中" + subtitle = "返回机巢" + } + } else if controlState == .returned { + title = command == .pause ? "紧急暂停" : "已返航" + subtitle = command == .pause ? "当前未执行任务" : "已返回机巢" + } else if controlState == .unknown, model.response?.flightControl != nil { + subtitle = "暂不可用" + } else if [.loading, .readError, .unknown].contains(phase) { + subtitle = "暂不可用" + } + if model.isCommandOutcomeUnknown(command) { + subtitle = "结果待核对" + } + let loading = submittingCommands.contains(command) || model.isCommandLoading(command) + let enabled = isInteractive && model.canSendCommand(command) + button.apply(title: title, subtitle: subtitle, enabled: enabled, isLoading: loading) + button.setControlSymbol(command == .pause ? "pause.circle" : "arrow.uturn.backward") + } + } + + @objc private func pauseTapped() { guard pauseButton.isEnabled else { return }; onCommand?(.pause) } + @objc private func returnTapped() { guard returnButton.isEnabled else { return }; onCommand?(.returnHome) } + + /// 高度仅依设备空间切换,不随任务状态、按钮文案或网络响应变化。 + func configure(compact: Bool) { + headerTop?.update(offset: compact ? 8 : 10) + headerHeight?.update(offset: compact ? 12 : 14) + buttonGap?.update(offset: compact ? 6 : 8) + buttonHeight?.update(offset: compact ? 56 : 62) + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockStartShootSimulation.swift b/suixinkan/UI/DroneDock/DroneDockStartShootSimulation.swift new file mode 100644 index 0000000..e1e2c0d --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockStartShootSimulation.swift @@ -0,0 +1,500 @@ +import Foundation +import UIKit + +#if DEBUG +/// 独立的准备、召唤、开拍及安全控制模拟入口;所有请求在内存中处理,不复用真实网络。 +@MainActor +enum DroneDockStartShootSimulation { + /// 显式启动参数选择准备页或任务页,两个入口始终使用隔离的模拟会话。 + static func makeController(arguments: [String]) -> UIViewController? { + let startsAtPreparation = arguments.contains("--dock-preparation-mock") + let startsAtCommands = arguments.contains("--dock-command-mock") + let startsAtResummon = arguments.contains("--dock-resummon-mock") + let showsLive = arguments.contains("--dock-live-mock") + guard startsAtPreparation || startsAtCommands || startsAtResummon || showsLive + || arguments.contains("--dock-start-shoot-mock") else { return nil } + let resultArgument = arguments.first { $0.hasPrefix("--dock-start-shoot-result=") } + let result = resultArgument.flatMap { + DroneDockStartShootMockResult(rawValue: String($0.dropFirst("--dock-start-shoot-result=".count))) + } ?? .success + let commandResultArgument = arguments.first { $0.hasPrefix("--dock-command-result=") } + let commandResult = commandResultArgument.flatMap { + DroneDockStartShootMockResult(rawValue: String($0.dropFirst("--dock-command-result=".count))) + } ?? .success + let resummonResult = arguments.first { $0.hasPrefix("--dock-resummon-result=") }.flatMap { + DroneDockStartShootMockResult(rawValue: String($0.dropFirst("--dock-resummon-result=".count))) + } ?? .success + let liveResult = arguments.first { $0.hasPrefix("--dock-live-result=") }.map { + String($0.dropFirst("--dock-live-result=".count)) + } ?? "success" + return makeFlow(result: result, startsAtPreparation: startsAtPreparation, + commandResult: commandResult, startsAtCommands: startsAtCommands, + startsAtResummon: startsAtResummon, resummonResult: resummonResult, + showsLive: showsLive, liveResult: liveResult) + } + + /// 从正式准备页进入全新的纯内存模拟,不携带真实订单、账号或设备身份。 + static func makePreparationController() -> DroneDockRemotePreparationViewController? { + makeFlow(result: .success, startsAtPreparation: true) as? DroneDockRemotePreparationViewController + } + + private static func makeFlow(result: DroneDockStartShootMockResult, + startsAtPreparation: Bool, + commandResult: DroneDockStartShootMockResult = .success, + startsAtCommands: Bool = false, startsAtResummon: Bool = false, + resummonResult: DroneDockStartShootMockResult = .success, + showsLive: Bool = false, liveResult: String = "success") -> UIViewController? { + let session = DroneDockStartShootMockSession(result: result, requiresPreparation: startsAtPreparation, + commandResult: commandResult, hasStarted: startsAtCommands && !startsAtPreparation, + hasFailed: startsAtResummon && !startsAtPreparation, resummonResult: resummonResult, + liveResult: liveResult) + let environment = APIEnvironment(baseURL: URL(string: "https://mock.invalid")!, + webSocketURL: URL(string: "wss://mock.invalid/unused")!) + let client = APIClient(environment: environment, session: session) + let context = DroneDockHomeContext(userID: "local-start-shoot-mock", accountType: "store_user", + scenicID: 128, scenicName: "本地模拟景区", storeID: 38, + photographerName: "模拟操作员", token: "local-simulation-only") + let orderData = Data(#"{"order_number":"LOCAL-MOCK-ORDER-901","project_id":101,"project_name":"模拟五次套餐","user_phone":"本地模拟游客","shoot_count":5,"shot_count":0,"remaining_count":5}"#.utf8) + guard let order = try? JSONDecoder().decode(DroneDockHomeOrder.self, from: orderData) else { return nil } + let taskFactory: @MainActor (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController = { taskID, taskOrder, taskContext in + let model = DroneDockShootingTaskViewModel(context: taskContext, taskID: taskID, order: taskOrder, + service: DroneDockShootingAPI(client: client), + startService: DroneDockStartShootAPI(client: client), + commandService: DroneDockCommandAPI(client: client), + resummonService: startsAtResummon ? DroneDockShootAPI(client: client) : nil, + currentContext: { context }) + let live = showsLive ? DroneDockLiveViewModel(context: taskContext, taskID: taskID, + service: DroneDockLiveAPI(client: client), + localPreviewURL: liveResult == "success" ? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") : nil, + currentContext: { context }) : nil + return DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, + materialsControllerFactory: { _, _ in + let unavailable = UIViewController() + unavailable.title = "本地模拟不连接素材库" + unavailable.view.backgroundColor = .systemBackground + return unavailable + }, + simulationRecordsProvider: { session.transcriptJSON }) + } + guard startsAtPreparation else { return taskFactory(901, order, context) } + let model = DroneDockPreparationViewModel(context: context, order: order, + service: DroneDockPreparationAPI(client: client), + planeStatusService: DroneDockPlaneStatusAPI(client: client), + taskCreationService: DroneDockTaskCreationAPI(client: client), + shootService: DroneDockShootAPI(client: client), + currentContext: { context }) + return DroneDockRemotePreparationViewController(viewModel: model, + taskControllerFactory: taskFactory, + simulationRecordsProvider: { session.transcriptJSON }) + } +} + +/// 模拟开拍请求的三种结果,不构成真实接口结果或设备执行反馈。 +private enum DroneDockStartShootMockResult: String { + case success + case businessFailure = "business-failure" + case timeout +} + +/// 无任何网络转发能力的响应替身;仅接受 mock.invalid 上约定的准备、召唤、开拍和安全指令。 +private final class DroneDockStartShootMockSession: LocalSimulationURLSession { + private let result: DroneDockStartShootMockResult + private let commandResult: DroneDockStartShootMockResult + private let resummonResult: DroneDockStartShootMockResult + private let liveResult: String + private let lock = NSLock() + private var hasCreated: Bool + private var hasSummoned: Bool + private var hasStarted: Bool + private var lastCommandProgress: [String: Any]? + private var isPaused = false + private var isReturning = false + private var wasInterrupted = false + private var hasFailed: Bool + private var executionBatch = 9_001 + private var stateVersion = 1 + private var exchanges: [Exchange] = [] + + /// 固定当前实例结果,不能用参数切换到真实传输。 + init(result: DroneDockStartShootMockResult, requiresPreparation: Bool, + commandResult: DroneDockStartShootMockResult, hasStarted: Bool, + hasFailed: Bool, resummonResult: DroneDockStartShootMockResult, liveResult: String) { + self.result = result + self.commandResult = commandResult + self.hasStarted = hasStarted + self.hasFailed = hasFailed + self.resummonResult = resummonResult + self.liveResult = liveResult + hasCreated = !requiresPreparation + hasSummoned = !requiresPreparation + } + + /// 全部本地请求及完整模拟回执;任务、设备、游客均为虚构测试身份。 + var transcriptJSON: String { + let records = lock.withLock { exchanges } + let items: [[String: Any]] = records.map { record in + var item: [String: Any] = ["method": record.request.httpMethod ?? "", + "path": record.request.url?.path ?? ""] + if let query = record.request.url?.query { item["query"] = query } + if let body = record.request.httpBody { + item["request_body"] = (try? JSONSerialization.jsonObject(with: body)) ?? String(decoding: body, as: UTF8.self) + } + if let response = record.responseData { + item["http_status"] = 200 + item["response_body"] = (try? JSONSerialization.jsonObject(with: response)) ?? String(decoding: response, as: UTF8.self) + } + if let error = record.error { item["error"] = error } + return item + } + let object: [String: Any] = ["source": "local_mock", "description": "纯内存模拟,未调用后端或设备", + "network_sent": false, "scenario": result.rawValue, + "command_scenario": commandResult.rawValue, "records": items] + guard let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]) else { + return "本地模拟记录暂不可显示;没有网络请求。" + } + return String(decoding: data, as: UTF8.self) + } + + /// 模拟少量等待后返回内存响应,任何未知请求均在本机失败,绝不回退真实请求。 + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + print("[LOCAL MOCK][Request] \(request.httpMethod ?? "") \(request.url?.absoluteString ?? "") — 不联网") + if let body = request.httpBody { print(String(decoding: body, as: UTF8.self)) } + do { + try Task.checkCancellation() + if request.httpMethod == "POST" { try await Task.sleep(nanoseconds: 400_000_000) } + try Task.checkCancellation() + let data = try lock.withLock { try responseData(for: request) } + lock.withLock { exchanges.append(Exchange(request: request, responseData: data, error: nil)) } + guard let url = request.url, + let response = HTTPURLResponse(url: url, statusCode: 200, httpVersion: nil, headerFields: nil) else { + throw URLError(.badURL) + } + print("[LOCAL MOCK][Response] \(String(decoding: data, as: UTF8.self))") + return (data, response) + } catch { + let message = error is CancellationError ? "本地模拟请求取消" : error.localizedDescription + lock.withLock { exchanges.append(Exchange(request: request, responseData: nil, error: message)) } + print("[LOCAL MOCK][Error] \(message) — 没有网络或设备指令") + throw error + } + } + + private func responseData(for request: URLRequest) throws -> Data { + guard let url = request.url, url.scheme == "https", url.host == "mock.invalid" else { + throw URLError(.unsupportedURL) + } + if request.httpMethod == "GET", url.path == "/api/yf-handset-app/photog/multi-plane/project-info" { + guard queryMatches(url, required: ["scenic_id": "128", "project_id": "101", + "order_number": "LOCAL-MOCK-ORDER-901"]) else { throw URLError(.badURL) } + var payload = orderData() + payload["spot"] = [["scenic_spot_id": 301, "scenic_spot_name": "模拟点位", "available": true, + "air_lines": [["air_line_id": 401, "air_line_name": "模拟航线", + "available": true, "samples": []]]]] + return try envelope(payload) + } + if request.httpMethod == "GET", url.path == "/api/app/airport/plane-status" { + guard queryMatches(url, required: ["scenic_id": "128", "live_battery": "1"]) else { throw URLError(.badURL) } + let plane: [String: Any] = ["id": 201, "name": "本地模拟无人机", "sn_number": "LOCAL-MOCK-DOCK-201", + "online_status": 1, "work_status": 1, "work_status_label": "空闲(模拟)", + "status_text": "本地模拟 · 电量 95%", "battery_percent": 95, + "can_fly": true, "is_receive_order": 1] + return try envelope(["scenic_id": 128, "connected": true, "planes": [plane], + "recommend": plane, "poll_hint_ms": 30000]) + } + if request.httpMethod == "POST", url.path == "/api/yf-handset-app/photog/multi-plane/tasks/create" { + guard url.query == nil, let body = request.httpBody, + let object = try JSONSerialization.jsonObject(with: body) as? [String: Any], + Set(object.keys) == ["scenic_id", "order_number", "scenic_spot_id", "air_line_id"], + let values = try? JSONDecoder().decode(CreateBody.self, from: body), + values.scenicID == 128, values.orderNumber == "LOCAL-MOCK-ORDER-901", + values.spotID == 301, values.airLineID == 401 else { throw URLError(.badURL) } + guard !hasCreated else { return try envelope([:], code: 100099, message: "本地模拟:任务已经创建") } + hasCreated = true + var payload = orderData() + payload["task_id"] = 901 + return try envelope(payload) + } + if request.httpMethod == "POST", url.path == "/api/app/airport/shoot" { + guard url.query == nil, let body = request.httpBody, + let object = try JSONSerialization.jsonObject(with: body) as? [String: Any], + Set(object.keys) == ["id", "restart"], + let values = try? JSONDecoder().decode(ShootBody.self, from: body), + values.id == 901 else { throw URLError(.badURL) } + if values.restart { + guard hasCreated, hasSummoned, hasFailed else { + return try envelope([:], code: 100099, message: "本地模拟:当前任务不允许重新召唤") + } + switch resummonResult { + case .businessFailure: + return try envelope([:], code: 100099, message: "本地模拟:设备暂不可用,重新召唤被拒绝") + case .timeout: + throw URLError(.timedOut) + case .success: + hasFailed = false + hasStarted = false + isPaused = false + isReturning = false + wasInterrupted = false + executionBatch += 1 + } + } else if !hasCreated || hasSummoned { + return try envelope([:], code: 100099, message: "本地模拟:任务尚未创建或已召唤") + } + hasSummoned = true + stateVersion += 1 + return try envelope(["order_flight_task": taskData(), "order_flight_task_id": 901, + "plane_id": 201, "airport_sn": "LOCAL-MOCK-DOCK-201", + "task_uuid": "LOCAL-MOCK-TASK-UUID-901", + "ui": ["phase": "arrived_pending_start", "title": "无人机已到达(模拟)", + "message": "本地模拟召唤成功,没有网络或设备指令。"]]) + } + if request.httpMethod == "GET", url.path == "/api/app/airport/shooting" { + let query = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? [] + guard query.filter({ $0.name == "id" }).map(\.value) == ["901"] else { + throw URLError(.badURL) + } + guard hasSummoned else { return try envelope([:], code: 100099, message: "本地模拟:请先完成模拟召唤") } + return try envelope(shootingData()) + } + if request.httpMethod == "GET", url.path == "/api/app/airport/live" { + guard queryMatches(url, required: ["id": "901"]), hasSummoned else { throw URLError(.badURL) } + if liveResult == "timeout" { throw URLError(.timedOut) } + if liveResult == "business-failure" { + return try envelope([:], code: 100099, message: "本地模拟:图传连接不可用") + } + // 文档未提供播放协议;这里只模拟已知字段,本地视频通过独立依赖注入,绝不伪装成后端字段。 + return try envelope(["order_flight_task_id": 901, "airport": [:], "drone": [:], + "task": taskData(), "airport_sn": "LOCAL-MOCK-DOCK-201", "metrics": simulatedMetrics]) + } + if request.httpMethod == "POST", url.path == "/api/app/airport/command" { + guard url.query == nil, let body = request.httpBody, + let object = try JSONSerialization.jsonObject(with: body) as? [String: Any], + Set(object.keys) == ["id", "command", "client_request_id"], + let values = try? JSONDecoder().decode(CommandBody.self, from: body), + values.id == 901, let command = DroneDockSafetyCommand(rawValue: values.command) else { + throw URLError(.badURL) + } + guard availableCommands.contains(command) else { + return try envelope([:], code: 100099, message: "本地模拟:当前任务不允许这项指令") + } + switch commandResult { + case .businessFailure: + return try envelope([:], code: 100099, message: "本地模拟:指令被拒绝,未改变任务状态") + case .timeout: + throw URLError(.timedOut) + case .success: + switch command { + case .pause: isPaused = true + case .resume: isPaused = false + case .returnHome: isReturning = true; wasInterrupted = true; isPaused = false + case .cancelReturn: isReturning = false; isPaused = true + } + stateVersion += 1 + let commandID = "LOCAL-MOCK-COMMAND-\(stateVersion)" + lastCommandProgress = ["command_id": commandID, "client_request_id": values.clientRequestID, + "command": command.rawValue, "status": "succeeded"] + return try envelope(["accepted": true, "device_confirmed": true, + "command_id": commandID, "client_request_id": values.clientRequestID, + "pending_command": lastCommandProgress ?? [:], + "acceptance": command == .returnHome ? "accepted" : "device_confirmed", + "command": command.rawValue, "order_flight_task_id": 901, + "execution_batch": executionBatch, "state_version": stateVersion, + "flight_control": flightControlData(), + "airport_sn": "LOCAL-MOCK-DOCK-201", "dji_status": simulatedPhase, + "metrics": simulatedMetrics]) + } + } + guard request.httpMethod == "POST", url.path == "/api/app/airport/start-shoot", + url.query == nil, let body = request.httpBody, + let object = try JSONSerialization.jsonObject(with: body) as? [String: Any], + Set(object.keys) == ["id"], + (try? JSONDecoder().decode(StartBody.self, from: body).id) == 901 else { + throw URLError(.unsupportedURL) + } + guard hasSummoned else { return try envelope([:], code: 100099, message: "本地模拟:请先完成模拟召唤") } + guard !isPaused, !wasInterrupted, !hasFailed else { + return try envelope([:], code: 100099, message: "本地模拟:任务暂停或已中断,不可开始拍摄") + } + guard !hasStarted else { + return try envelope([:], code: 100099, message: "本地模拟:该任务已开始,请读取任务状态") + } + switch result { + case .businessFailure: + return try envelope([:], code: 100099, message: "本地模拟:电量不足,暂不可开始拍摄") + case .timeout: + throw URLError(.timedOut) + case .success: + hasStarted = true + stateVersion += 1 + return try envelope([ + "task_uuid": "LOCAL-MOCK-TASK-UUID-901", "order_flight_task_id": 901, + "order_flight_task": taskData(), "plane_id": 201, "airport_sn": "LOCAL-MOCK-DOCK-201", + "ui": ["phase": "shooting", "title": "无人机正在拍摄中(模拟)", + "message": "本地模拟开拍回执,不代表真实设备执行。", "primary_action": "shooting", + "commands": [["command": "flighttask_pause", "label": "紧急暂停", "sub": "悬停待命"], + ["command": "return_home", "label": "立即返航", "sub": "中断任务"]]] + ]) + } + } + + private func queryMatches(_ url: URL, required: [String: String]) -> Bool { + let items = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? [] + return items.count == required.count && required.allSatisfy { key, value in + items.filter { $0.name == key }.map(\.value) == [value] + } + } + + private func orderData() -> [String: Any] { + ["order_number": "LOCAL-MOCK-ORDER-901", "project_id": 101, "project_name": "模拟五次套餐", + "user_phone": "本地模拟游客", "shoot_count": 5, "shot_count": 0, "remaining_count": 5, + "shoot_status": "processing", "order_status": 20, "can_create_task": true, + "can_upload_film": false, "can_confirm": false, "film_count": 0] + } + + private func shootingData() -> [String: Any] { + let canStart = !hasStarted && !isPaused && !wasInterrupted && !hasFailed + let phaseTitle: String + if hasFailed { + phaseTitle = "本地模拟:航线执行失败,可验证重新召唤流程" + } else if wasInterrupted { + phaseTitle = isReturning ? "本地模拟:立即返航中断任务;无人机返航中" : "本地模拟:返航已取消,任务仍已中断" + } else if isPaused { + phaseTitle = "拍摄已暂停(模拟)" + } else { + phaseTitle = hasStarted ? "无人机正在拍摄中(模拟)" : "无人机已到达(模拟)" + } + let commands: [[String: String]] = availableCommands.map { command in + switch command { + case .pause: return ["command": command.rawValue, "label": "紧急暂停", "sub": "悬停待命"] + case .resume: return ["command": command.rawValue, "label": "继续拍摄", "sub": "恢复航线"] + case .returnHome: return ["command": command.rawValue, "label": "立即返航", "sub": "中断任务"] + case .cancelReturn: return ["command": command.rawValue, "label": "取消返航", "sub": "不恢复已中断任务"] + } + } + let deviceLabel = isReturning ? "返航中" : isPaused ? "悬停中" : hasStarted ? "拍摄中" : "空闲" + return ["order_number": "LOCAL-MOCK-ORDER-901", "order_flight_task": taskData(), "task": taskData(), + "execution_batch": executionBatch, "state_version": stateVersion, "snapshot_kind": "full", + "flight_control": flightControlData(), + "scenic": ["id": 128, "name": "本地模拟景区"], + "scenic_spot": ["id": 301, "name": "模拟点位"], + "air_line": ["id": 401, "name": "模拟航线", "scenic_spot_id": 301], + "header": ["order_number": "LOCAL-MOCK-ORDER-901", "title": "模拟点位 · 模拟航线", + "tourist_label": "本地模拟,无设备指令", "package_name": "模拟套餐 · 含5次拍摄"], + "current_plane": ["id": 201, "sn_number": "LOCAL-MOCK-DOCK-201", "online_status": 1, + "work_status": hasFailed ? 1 : 2, "work_status_label": deviceLabel, + "status_text": "本地模拟 · \(deviceLabel) · 电量95%"], + "metrics": simulatedMetrics, + "plane_status": ["scenic_id": 128, "connected": true, "poll_hint_ms": 5000], + "execute_gate": ["can_execute": canStart, "code": wasInterrupted ? "return_home" : hasStarted ? "already_started" : "ok", + "message": hasStarted ? "本地模拟:开拍已受理" : "本地模拟:允许验证开拍请求", + "primary_action": canStart ? "start_shoot" : simulatedPhase, + "primary_action_label": hasStarted ? "拍摄中" : "开始拍摄"], + "restart_gate": ["can_restart": hasFailed, "code": hasFailed ? "ok" : "running"], + "ui": ["phase": simulatedPhase, "title": phaseTitle, "commands": commands, + "message": wasInterrupted ? phaseTitle : "本地模拟状态回查,未向设备发送指令。"]] + } + + private func taskData() -> [String: Any] { + var task: [String: Any] = ["id": 901, "order_number": "LOCAL-MOCK-ORDER-901", "scenic_id": 128, + "wayline_task_id": executionBatch, "plane_id": 201, "airport_sn": "LOCAL-MOCK-DOCK-201", + "status": 20, "status_label": "执行中(模拟)", "wayline_status": 20, "wayline_status_label": "执行中(模拟)"] + if hasFailed { + task["status"] = 40 + task["status_label"] = "任务失败(模拟)" + task["wayline_status"] = 91 + task["wayline_status_label"] = "执行失败(模拟)" + task["result_message"] = "本地模拟:航线执行失败,无人机空闲待命。" + } else if wasInterrupted { + task["status"] = 40 + task["status_label"] = "任务已中断(模拟)" + task["wayline_status"] = 91 + task["wayline_status_label"] = "已中断(模拟)" + task["result_code"] = "return_home" + task["result_message"] = isReturning ? "本地模拟:立即返航中断任务;无人机返航中。" + : "本地模拟:返航已取消,任务仍已中断,不能继续拍摄。" + } + return task + } + + private var availableCommands: [DroneDockSafetyCommand] { + guard hasSummoned, !hasFailed else { return [] } + if isReturning { return [isPaused ? .resume : .pause] } + if wasInterrupted { return [] } + return [isPaused ? .resume : .pause, .returnHome] + } + + private var simulatedPhase: String { + if hasFailed { return "failed" } + if isPaused { return "manual_paused" } + if isReturning { return "returning_home" } + if wasInterrupted { return "failed" } + return hasStarted ? "shooting" : "arrived_pending_start" + } + + /// 同一模拟批次的执行状态和权限;回巢仅在显式失败起始场景中提供 inside 证据。 + private func flightControlData() -> [String: Any] { + let state = hasFailed ? "returned" : isPaused ? "paused" : isReturning ? "returning" : "executing" + let pauseReason: Any = isPaused ? "manual" : (hasStarted ? NSNull() : "arrival_wait" as Any) + return ["state": state, "execution_batch": executionBatch, + "is_airborne": !hasFailed, "pause_reason": pauseReason, + "pending_command": lastCommandProgress ?? [:], + "resume_phase": isReturning ? "returning" : hasStarted ? "shooting" : "arrived_pending_start", + "return_reason": wasInterrupted ? "manual" : NSNull(), + "drone_in_dock": hasFailed ? "inside" : "outside", + "can_pause": availableCommands.contains(.pause), + "can_resume": availableCommands.contains(.resume), + "can_return_home": availableCommands.contains(.returnHome)] + } + + private var simulatedMetrics: [[String: String]] { + [["key": "battery", "value": "95%"], ["key": "env_temp", "value": "20.3℃"], + ["key": "wind_speed", "value": "0m/s"], ["key": "rainfall", "value": "无雨"], + ["key": "signal", "value": "良好"], ["key": "satellite", "value": "36颗"]] + } + + private func envelope(_ data: [String: Any], code: Int = 100000, message: String = "local mock success") throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": data], + options: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]) + } + + /// 完整记录每次本地请求结果,数据不落到真实接口或共享会话中。 + private struct Exchange { + let request: URLRequest + let responseData: Data? + let error: String? + } + + /// 创建模拟任务仍验证真实合同的四项身份,不接受其他订单或航线。 + private struct CreateBody: Decodable { + let scenicID: Int + let orderNumber: String + let spotID: Int + let airLineID: Int + + /// 张工任务创建请求字段。 + private enum CodingKeys: String, CodingKey { + case scenicID = "scenic_id", orderNumber = "order_number" + case spotID = "scenic_spot_id", airLineID = "air_line_id" + } + } + + /// 首次召唤或失败重召唤只接受同一模拟任务,不产生真实设备操作。 + private struct ShootBody: Decodable { + let id: Int + let restart: Bool + } + + /// 用强类型解码确认本地开拍请求的 id 为整数。 + private struct StartBody: Decodable { + let id: Int + } + + /// 模拟指令仍严格匹配正式接口的整数任务 ID 与白名单指令码。 + private struct CommandBody: Decodable { + let id: Int + let command: String + let clientRequestID: String + private enum CodingKeys: String, CodingKey { case id, command, clientRequestID = "client_request_id" } + } +} +#endif diff --git a/suixinkan/UI/DroneDock/DroneDockStyle.swift b/suixinkan/UI/DroneDock/DroneDockStyle.swift new file mode 100644 index 0000000..2cf0c48 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockStyle.swift @@ -0,0 +1,73 @@ +import SnapKit +import UIKit + +/// 机巢新版界面的局部样式,不改变其他业务页面的主题。 +enum DroneDockStyle { + static let primary = UIColor(hex: 0x3164FF) + static let background = UIColor(hex: 0xF5F6FA) + static let text = UIColor(hex: 0x172033) + static let secondary = UIColor(hex: 0x8992A3) + static let border = UIColor(hex: 0xE8ECF3) + static let success = UIColor(hex: 0x169B6B) + static let warning = UIColor(hex: 0xD68A28) + + /// 将模型的语义色映射为界面颜色。 + static func color(for tone: DroneDockStatusTone) -> UIColor { + switch tone { + case .blue: primary + case .green: success + case .orange: warning + case .red: UIColor(hex: 0xD46B62) + case .gray: secondary + } + } + + /// 白色圆角卡片的统一装饰。 + static func applyCard(to view: UIView) { + view.backgroundColor = .white + view.layer.cornerRadius = 16 + view.layer.cornerCurve = .continuous + } + + /// 创建常用文字,显式传入字重及颜色。 + static func label(_ text: String? = nil, size: CGFloat = 14, weight: UIFont.Weight = .regular, + color: UIColor = DroneDockStyle.text) -> UILabel { + let label = UILabel() + label.text = text + label.font = .systemFont(ofSize: size, weight: weight) + label.textColor = color + return label + } +} + +/// 有内边距的状态标签,在两种订单卡和设备卡中保持一致。 +final class DroneDockStatusLabel: UILabel { + private let padding = UIEdgeInsets(top: 4, left: 7, bottom: 4, right: 7) + + /// 创建自适应文字宽度的浅色标签。 + override init(frame: CGRect) { + super.init(frame: frame) + font = .systemFont(ofSize: 11, weight: .medium) + layer.cornerRadius = 6 + clipsToBounds = true + setContentHuggingPriority(.required, for: .horizontal) + setContentCompressionResistancePriority(.required, for: .horizontal) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 应用状态文字及对应语义颜色。 + func apply(title: String, tone: DroneDockStatusTone) { + text = title + textColor = DroneDockStyle.color(for: tone) + backgroundColor = textColor.withAlphaComponent(0.09) + } + + override var intrinsicContentSize: CGSize { + let size = super.intrinsicContentSize + return CGSize(width: size.width + padding.left + padding.right, height: size.height + padding.top + padding.bottom) + } + + override func drawText(in rect: CGRect) { super.drawText(in: rect.inset(by: padding)) } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskCompletedView.swift b/suixinkan/UI/DroneDock/DroneDockTaskCompletedView.swift new file mode 100644 index 0000000..e20c40d --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskCompletedView.swift @@ -0,0 +1,133 @@ +import SnapKit +import UIKit + +/// 拍摄完成区域:左侧完成图标、右侧状态说明以及整行素材入口。 +@MainActor +final class DroneDockTaskCompletedView: UIView { + /// 用户点击已允许的素材入口时通知任务页面。 + var onViewMaterials: (() -> Void)? + /// 与任务固定区域共享紧凑布局指标,操作区域始终至少 44 点高。 + private(set) var usesCompactLayout = false + + private let content = UIView() + private let iconBackground = UIView() + private let icon = UIImageView(image: UIImage(systemName: "checkmark.circle.fill")) + private let titleLabel = DroneDockStyle.label(size: 20, weight: .semibold) + private let messageLabel = DroneDockStyle.label(size: 14, color: DroneDockStyle.secondary) + private let materialsButton = UIButton(type: .system) + private var messageHeight: Constraint? + private var titleHeight: Constraint? + private var buttonHeight: Constraint? + + /// 创建不包含设备摘要或次级详情按钮的完成面板。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 仅展示已确认的完成文案,素材入口继续服从任务门禁与页面刷新状态。 + func apply(_ presentation: DroneDockTaskPresentation, isRefreshing: Bool) { + titleLabel.text = presentation.title + messageLabel.text = presentation.message + var configuration = materialsButton.configuration + configuration?.title = presentation.actionTitle + materialsButton.isEnabled = presentation.action == .materials && presentation.isActionEnabled && !isRefreshing + configuration?.baseBackgroundColor = DroneDockStyle.primary.withAlphaComponent(materialsButton.isEnabled ? 1 : 0.35) + materialsButton.configuration = configuration + setNeedsLayout() + } + + /// 仅当前可见面板提供通用任务访问标识,防止状态切换后匹配到隐藏控件。 + func setIdentifiersActive(_ active: Bool) { + titleLabel.accessibilityIdentifier = active ? "drone.task.remote.statusTitle" : nil + messageLabel.accessibilityIdentifier = active ? "drone.task.remote.statusMessage" : nil + materialsButton.accessibilityIdentifier = active ? "drone.task.remote.primary" : nil + } + + /// 固定区域变小时收紧说明行数与间距,不改变整页布局或缩小点击区域。 + override func layoutSubviews() { + usesCompactLayout = bounds.height < 190 + let extreme = bounds.height < 120 + titleLabel.font = .systemFont(ofSize: extreme ? 17 : 20, weight: .semibold) + messageLabel.font = .systemFont(ofSize: usesCompactLayout ? 13 : 14) + messageLabel.numberOfLines = usesCompactLayout ? 2 : 3 + let width = max(1, bounds.width - 84) + let measured = messageLabel.sizeThatFits(CGSize(width: width, height: .greatestFiniteMagnitude)).height + let title = ceil(titleLabel.font.lineHeight) + let button: CGFloat = usesCompactLayout ? 44 : 50 + let availableMessageHeight = max(0, bounds.height - 24 - title - 6 - 16 - button) + let body = min(ceil(measured), availableMessageHeight) + messageLabel.isHidden = body < messageLabel.font.lineHeight + messageHeight?.update(offset: messageLabel.isHidden ? 0 : body) + titleHeight?.update(offset: title) + buttonHeight?.update(offset: button) + super.layoutSubviews() + } + + private func setupUI() { + accessibilityIdentifier = "drone.task.remote.completed" + addSubview(content) + [iconBackground, titleLabel, messageLabel, materialsButton].forEach(content.addSubview) + iconBackground.addSubview(icon) + iconBackground.backgroundColor = DroneDockStyle.success.withAlphaComponent(0.12) + iconBackground.layer.cornerRadius = 20 + icon.contentMode = .scaleAspectFit + icon.tintColor = DroneDockStyle.success + titleLabel.accessibilityTraits = .header + titleLabel.numberOfLines = 1 + titleLabel.lineBreakMode = .byTruncatingTail + messageLabel.lineBreakMode = .byTruncatingTail + var configuration = UIButton.Configuration.filled() + configuration.baseForegroundColor = .white + configuration.background.cornerRadius = 8 + configuration.cornerStyle = .fixed + configuration.image = UIImage(systemName: "photo", withConfiguration: UIImage.SymbolConfiguration(pointSize: 15)) + configuration.imagePadding = 8 + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: 15, weight: .semibold) + return result + } + materialsButton.configuration = configuration + materialsButton.addTarget(self, action: #selector(viewMaterials), for: .touchUpInside) + } + + private func setupConstraints() { + content.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(16) + make.centerY.equalToSuperview() + } + iconBackground.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + make.size.equalTo(40) + } + icon.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(22) + } + titleLabel.snp.makeConstraints { make in + make.top.trailing.equalToSuperview() + make.leading.equalTo(iconBackground.snp.trailing).offset(12) + titleHeight = make.height.equalTo(24).constraint + } + messageLabel.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(6) + make.leading.trailing.equalTo(titleLabel) + messageHeight = make.height.equalTo(34).constraint + } + materialsButton.snp.makeConstraints { make in + make.top.equalTo(messageLabel.snp.bottom).offset(16) + make.leading.trailing.bottom.equalToSuperview() + buttonHeight = make.height.equalTo(50).constraint + } + } + + @objc private func viewMaterials() { + guard !isHidden, materialsButton.isEnabled else { return } + onViewMaterials?() + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskControlStateView.swift b/suixinkan/UI/DroneDock/DroneDockTaskControlStateView.swift new file mode 100644 index 0000000..d05f1d2 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskControlStateView.swift @@ -0,0 +1,249 @@ +import SnapKit +import UIKit + +/// 暂停、返航及回巢面板,使用本地状态文案及整行主按钮,不显示设备摘要。 +@MainActor +final class DroneDockTaskControlStateView: UIView { + /// 用户点击已允许的主操作时交给任务页面执行。 + var onPrimaryAction: (() -> Void)? + /// 当前固定区域使用的排版比例,不通过 transform 缩小点击区域。 + private(set) var effectiveScale: CGFloat = 1 + /// 可用高度不足时收紧图标、字号与间距。 + private(set) var usesCompactLayout = false + + private let content = UIView() + private let header = UIView() + private let iconBackground = UIView() + private let icon = UIImageView() + private let titleLabel = DroneDockStyle.label(size: 22, weight: .semibold, color: UIColor(hex: 0x101523)) + private let messageLabel = DroneDockStyle.label(size: 14, color: UIColor(hex: 0x6A79A0)) + private let actionButton = UIButton(type: .system) + private let actionActivityIndicator = UIActivityIndicatorView(style: .medium) + private let noteLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private var presentation: DroneDockTaskPresentation? + private var identifiersActive = false + private var isPrimaryActionLoading = false + private var headerHeight: Constraint? + private var iconSize: Constraint? + private var textLeading: Constraint? + private var titleHeight: Constraint? + private var messageTop: Constraint? + private var messageHeight: Constraint? + private var actionTop: Constraint? + private var actionHeight: Constraint? + private var noteTop: Constraint? + private var noteHeight: Constraint? + + /// 创建与任务固定状态区域配合的控制状态视图。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 文案和动作均由本地展示模型提供,禁用按钮只显示状态且不会触发回调。 + func apply(_ presentation: DroneDockTaskPresentation, isRefreshing: Bool = false, isPrimaryActionLoading: Bool = false) { + self.presentation = presentation + self.isPrimaryActionLoading = isPrimaryActionLoading + titleLabel.text = presentation.title + messageLabel.text = presentation.message + noteLabel.text = presentation.actionNote + switch presentation.phase { + case .paused: icon.image = UIImage(systemName: "pause.fill") + case .returning: icon.image = UIImage(systemName: "arrow.uturn.backward") + case .returned: icon.image = UIImage(systemName: "house.fill") + default: icon.image = UIImage(systemName: "clock") + } + actionButton.isEnabled = presentation.action != .none && presentation.isActionEnabled && !isRefreshing && !isPrimaryActionLoading + actionButton.configuration?.title = presentation.actionTitle + let actionSymbol: String? = switch presentation.action { + case .resume: "play.fill" + case .retry: "paperplane.fill" + case .refresh: "arrow.clockwise" + default: nil + } + actionButton.configuration?.image = actionSymbol.flatMap { UIImage(systemName: $0) } + if isPrimaryActionLoading { actionActivityIndicator.startAnimating() } + else { actionActivityIndicator.stopAnimating() } + actionButton.accessibilityValue = isPrimaryActionLoading ? "处理中" : nil + setIdentifiersActive(identifiersActive) + actionButton.setNeedsUpdateConfiguration() + setNeedsLayout() + } + + /// 只有可见面板暴露通用标识,状态切换后不会匹配到隐藏的旧按钮。 + func setIdentifiersActive(_ active: Bool) { + identifiersActive = active + if !active { actionActivityIndicator.stopAnimating() } + titleLabel.accessibilityIdentifier = active ? "drone.task.remote.statusTitle" : nil + messageLabel.accessibilityIdentifier = active ? "drone.task.remote.statusMessage" : nil + actionButton.accessibilityIdentifier = active + ? (presentation?.action == .refresh ? "drone.task.remote.refresh" : "drone.task.remote.primary") : nil + actionActivityIndicator.accessibilityIdentifier = active ? "drone.task.remote.primary.loading" : nil + } + + /// 在固定区域内收紧排版,主按钮始终至少 44 点高。 + override func layoutSubviews() { + updateContentLayout() + super.layoutSubviews() + } + + private func setupUI() { + accessibilityIdentifier = "drone.task.remote.controlState" + backgroundColor = .white + addSubview(content) + [header, actionButton, noteLabel].forEach(content.addSubview) + [iconBackground, titleLabel, messageLabel].forEach(header.addSubview) + iconBackground.addSubview(icon) + iconBackground.backgroundColor = UIColor(hex: 0xFFF3E0) + iconBackground.layer.cornerRadius = 20.5 + icon.contentMode = .scaleAspectFit + icon.tintColor = UIColor(hex: 0xF39819) + titleLabel.accessibilityTraits = .header + titleLabel.numberOfLines = 1 + titleLabel.lineBreakMode = .byTruncatingTail + messageLabel.numberOfLines = 3 + messageLabel.lineBreakMode = .byTruncatingTail + noteLabel.numberOfLines = 1 + noteLabel.textAlignment = .center + noteLabel.accessibilityIdentifier = "drone.task.remote.controlNote" + var configuration = UIButton.Configuration.filled() + configuration.imagePadding = 10 + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 20, weight: .semibold) + configuration.background.cornerRadius = 8 + configuration.cornerStyle = .fixed + configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8) + actionButton.configuration = configuration + actionButton.configurationUpdateHandler = { [weak self] button in + guard let self, var configuration = button.configuration else { return } + let emphasizesAction = button.isEnabled || self.isPrimaryActionLoading + let foreground = emphasizesAction ? UIColor.white : UIColor(hex: 0x929BAE) + let font = UIFont.systemFont(ofSize: self.usesCompactLayout ? 16 : 18, weight: .semibold) + configuration.background.backgroundColor = emphasizesAction + ? DroneDockStyle.primary : UIColor(hex: 0xEDF0F5) + configuration.baseForegroundColor = foreground + configuration.imageColorTransformer = UIConfigurationColorTransformer { _ in foreground } + // loading 会禁用按钮;显式设置最终文字色,避免系统禁用态再次把白字变暗。 + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = font + result.foregroundColor = foreground + return result + } + button.configuration = configuration + } + actionActivityIndicator.color = .white + actionActivityIndicator.hidesWhenStopped = true + actionActivityIndicator.isUserInteractionEnabled = false + actionButton.addSubview(actionActivityIndicator) + actionButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + } + + private func setupConstraints() { + content.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(18) + make.centerY.equalToSuperview() + } + header.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + headerHeight = make.height.equalTo(81).constraint + } + iconBackground.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + iconSize = make.size.equalTo(41).constraint + } + icon.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(iconBackground.snp.width).multipliedBy(24.0 / 41.0) + } + titleLabel.snp.makeConstraints { make in + make.top.trailing.equalToSuperview() + textLeading = make.leading.equalTo(iconBackground.snp.trailing).offset(12).constraint + titleHeight = make.height.equalTo(28).constraint + } + messageLabel.snp.makeConstraints { make in + messageTop = make.top.equalTo(titleLabel.snp.bottom).offset(6).constraint + make.leading.trailing.equalTo(titleLabel) + messageHeight = make.height.equalTo(45).constraint + } + actionButton.snp.makeConstraints { make in + actionTop = make.top.equalTo(header.snp.bottom).offset(16).constraint + make.leading.trailing.equalToSuperview() + actionHeight = make.height.equalTo(50).constraint + } + actionActivityIndicator.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.trailing.equalToSuperview().inset(14) + make.size.equalTo(20) + } + noteLabel.snp.makeConstraints { make in + noteTop = make.top.equalTo(actionButton.snp.bottom).offset(6).constraint + make.leading.trailing.bottom.equalToSuperview() + noteHeight = make.height.equalTo(16).constraint + } + } + + private func updateContentLayout() { + guard let presentation, bounds.width > 0, bounds.height > 0 else { return } + let wasCompact = usesCompactLayout + usesCompactLayout = bounds.height < 190 + let extreme = bounds.height < 120 + let compact = usesCompactLayout + let diameter: CGFloat = extreme ? 24 : compact ? 32 : 41 + let iconGap: CGFloat = extreme ? 8 : compact ? 10 : 12 + let titleSize: CGFloat = extreme ? 17 : compact ? 20 : 22 + let messageSize: CGFloat = compact ? 13 : 14 + let textGap: CGFloat = extreme ? 3 : compact ? 4 : 6 + let buttonGap: CGFloat = extreme ? 8 : compact ? 12 : 16 + let buttonHeight: CGFloat = compact ? 44 : 50 + let available = max(1, bounds.height - (extreme ? 8 : 12)) + let textWidth = max(1, bounds.width - 36 - diameter - iconGap) + titleLabel.font = .systemFont(ofSize: titleSize, weight: .semibold) + let title = ceil(titleLabel.font.lineHeight) + let paragraph = NSMutableParagraphStyle() + paragraph.minimumLineHeight = messageSize * 1.5 + paragraph.maximumLineHeight = messageSize * 1.5 + let attributes: [NSAttributedString.Key: Any] = [ + .font: UIFont.systemFont(ofSize: messageSize), + .foregroundColor: UIColor(hex: 0x6A79A0), .paragraphStyle: paragraph + ] + messageLabel.attributedText = NSAttributedString(string: presentation.message, attributes: attributes) + let measured = (presentation.message as NSString).boundingRect( + with: CGSize(width: textWidth, height: .greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: attributes, context: nil).height + let hasNote = !extreme && DroneDockHomeMetric.usableText(presentation.actionNote) != nil + let note = hasNote ? ceil(noteLabel.font.lineHeight) : 0 + let noteGap: CGFloat = hasNote ? 6 : 0 + var lines = extreme || presentation.message.isEmpty ? 0 : 3 + var body = lines == 0 ? 0 : ceil(min(measured, paragraph.maximumLineHeight * CGFloat(lines))) + while max(diameter, title + (lines > 0 ? textGap + body : 0)) + buttonGap + buttonHeight + note + noteGap > available, + lines > 0 { + lines -= 1 + body = lines == 0 ? 0 : ceil(min(measured, paragraph.maximumLineHeight * CGFloat(lines))) + } + messageLabel.numberOfLines = max(1, lines) + messageLabel.isHidden = lines == 0 + noteLabel.isHidden = !hasNote + effectiveScale = compact ? 0.8 : 1 + headerHeight?.update(offset: max(diameter, title + (lines > 0 ? textGap + body : 0))) + iconSize?.update(offset: diameter) + iconBackground.layer.cornerRadius = diameter / 2 + textLeading?.update(offset: iconGap) + titleHeight?.update(offset: title) + messageTop?.update(offset: lines > 0 ? textGap : 0) + messageHeight?.update(offset: body) + actionTop?.update(offset: buttonGap) + actionHeight?.update(offset: buttonHeight) + noteTop?.update(offset: noteGap) + noteHeight?.update(offset: note) + if wasCompact != usesCompactLayout { actionButton.setNeedsUpdateConfiguration() } + } + + @objc private func primaryTapped() { + guard !isHidden, actionButton.isEnabled else { return } + onPrimaryAction?() + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskCreationResultCell.swift b/suixinkan/UI/DroneDock/DroneDockTaskCreationResultCell.swift new file mode 100644 index 0000000..393a9f7 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskCreationResultCell.swift @@ -0,0 +1,37 @@ +import SnapKit +import UIKit + +/// 准备页业务失败卡片,完整换行展示原因,不展示成功回执或接口 JSON。 +@MainActor +final class DroneDockTaskCreationResultCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 14, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.backgroundColor = DroneDockStyle.background + contentView.layer.cornerRadius = 10 + titleLabel.numberOfLines = 0 + detailLabel.numberOfLines = 0 + titleLabel.textColor = DroneDockStyle.warning + [titleLabel, detailLabel].forEach(contentView.addSubview) + titleLabel.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview().inset(12) + } + detailLabel.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(8) + make.leading.trailing.equalTo(titleLabel) + make.bottom.equalToSuperview().inset(12) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 只接收面向用户的错误模型,成功 data 不进入视图层。 + func apply(failure: DroneDockPreparationFailure, identifier: String) { + titleLabel.text = failure.title + detailLabel.text = failure.message + detailLabel.accessibilityIdentifier = identifier + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskFailureView.swift b/suixinkan/UI/DroneDock/DroneDockTaskFailureView.swift new file mode 100644 index 0000000..4764ecf --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskFailureView.swift @@ -0,0 +1,219 @@ +import SnapKit +import UIKit + +/// 对齐体验网页的任务失败组合:警示、原因、排查提示、重召或刷新操作及设备提示。 +@MainActor +final class DroneDockTaskFailureView: UIView { + /// 点击原因区域查看完整后端说明,页面无需额外占用一个详情按钮。 + var onDetails: (() -> Void)? + /// 将重召唤或结果核对操作交给任务页,视图不直接发送请求。 + var onPrimaryAction: (() -> Void)? + /// 内部排版参考比例,不对视图或点击区域使用整体缩放。 + private(set) var effectiveScale: CGFloat = 1 + /// 当前是否使用适配固定小高度的紧凑排版。 + private(set) var usesCompactLayout = false + + private let content = UIStackView() + private let notice = UIButton(type: .custom) + private let iconBackground = UIView() + private let icon = UIImageView(image: UIImage(systemName: "exclamationmark.circle.fill")) + private let body = UIStackView() + private let titleLabel = DroneDockStyle.label(size: 23, weight: .semibold) + private let reasonContainer = UIView() + private let reasonLabel = DroneDockStyle.label(size: 14, color: UIColor(hex: 0xF53242)) + private let adviceLabel = DroneDockStyle.label("请排查错误后再次召唤无人机。", size: 14, color: UIColor(hex: 0x6A79A0)) + private let retryButton = UIButton(type: .system) + private let noteLabel = DroneDockStyle.label(size: 12, color: UIColor(hex: 0x7E8BA9)) + private var presentation: DroneDockTaskPresentation? + private var contentTop: Constraint? + private var noticeHeight: Constraint? + private var iconSize: Constraint? + private var bodyLeading: Constraint? + private var titleHeight: Constraint? + private var reasonHeight: Constraint? + private var adviceHeight: Constraint? + private var buttonHeight: Constraint? + private var noteHeight: Constraint? + + /// 建立失败态专用层级,外部任务页仍决定该区域尺寸。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 更新真实失败原因及不可重召原因,不把开始拍摄许可当作重召许可。 + func apply(_ value: DroneDockTaskPresentation, isRefreshing: Bool = false) { + presentation = value + titleLabel.text = value.title + let reason = DroneDockHomeMetric.usableText(value.message).flatMap { $0 == "—" ? nil : $0 } + ?? "服务端暂未提供具体原因" + reasonLabel.text = reason.hasPrefix("失败原因:") ? reason : "失败原因:\(reason)" + noteLabel.text = value.actionNote ?? (value.action == .refresh ? "请核对原任务状态,勿重复召唤" : "") + retryButton.configuration?.title = value.actionTitle + retryButton.configuration?.image = UIImage(systemName: value.action == .refresh ? "arrow.clockwise" : "arrow.triangle.2.circlepath") + retryButton.isEnabled = value.isActionEnabled && !isRefreshing + notice.accessibilityLabel = [value.title, reasonLabel.text, adviceLabel.text].compactMap { $0 }.joined(separator: "。") + setNeedsLayout() + } + + /// 只收紧内部字号、行数和间距;主按钮保留至少 44 点高度。 + override func layoutSubviews() { + updateLayout() + super.layoutSubviews() + } + + private func setupUI() { + accessibilityIdentifier = "drone.task.remote.failure" + content.axis = .vertical + content.spacing = 10 + addSubview(content) + content.addArrangedSubview(notice) + content.addArrangedSubview(retryButton) + content.addArrangedSubview(noteLabel) + notice.accessibilityIdentifier = "drone.task.remote.failureDetails" + notice.accessibilityHint = "查看完整失败原因" + notice.addTarget(self, action: #selector(showDetails), for: .touchUpInside) + notice.addSubview(iconBackground) + iconBackground.backgroundColor = UIColor(hex: 0xFFEDED) + iconBackground.isUserInteractionEnabled = false + iconBackground.addSubview(icon) + icon.tintColor = UIColor(hex: 0xFF303B) + icon.contentMode = .scaleAspectFit + body.axis = .vertical + body.spacing = 5 + body.isUserInteractionEnabled = false + notice.addSubview(body) + body.addArrangedSubview(titleLabel) + body.addArrangedSubview(reasonContainer) + body.addArrangedSubview(adviceLabel) + titleLabel.textColor = UIColor(hex: 0x101523) + titleLabel.accessibilityIdentifier = "drone.task.remote.failureTitle" + reasonContainer.backgroundColor = UIColor(hex: 0xFFF0F2) + reasonContainer.layer.cornerRadius = 6 + reasonContainer.addSubview(reasonLabel) + reasonLabel.accessibilityIdentifier = "drone.task.remote.failureReason" + adviceLabel.accessibilityIdentifier = "drone.task.remote.failureAdvice" + noteLabel.accessibilityIdentifier = "drone.task.remote.failureNote" + noteLabel.textAlignment = .center + [titleLabel, reasonLabel, adviceLabel, noteLabel].forEach { $0.lineBreakMode = .byTruncatingTail } + + var configuration = UIButton.Configuration.filled() + configuration.title = "重新召唤无人机" + configuration.image = UIImage(systemName: "arrow.triangle.2.circlepath") + configuration.imagePadding = 12 + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 21, weight: .regular) + configuration.background.backgroundColor = UIColor(hex: 0xE8EBF1) + configuration.background.cornerRadius = 8 + configuration.baseForegroundColor = UIColor(hex: 0x939CB0) + configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8) + retryButton.configuration = configuration + retryButton.configurationUpdateHandler = { button in + button.configuration?.baseForegroundColor = button.isEnabled ? .white : UIColor(hex: 0x939CB0) + button.configuration?.background.backgroundColor = button.isEnabled ? DroneDockStyle.primary : UIColor(hex: 0xE8EBF1) + } + retryButton.isEnabled = false + retryButton.accessibilityIdentifier = "drone.task.remote.failureRetry" + retryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + } + + private func setupConstraints() { + content.snp.makeConstraints { make in + contentTop = make.top.equalToSuperview().offset(16).constraint + make.leading.trailing.equalToSuperview().inset(18) + } + notice.snp.makeConstraints { make in noticeHeight = make.height.equalTo(90).constraint } + iconBackground.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + iconSize = make.size.equalTo(41).constraint + } + icon.snp.makeConstraints { make in make.center.equalToSuperview(); make.size.equalToSuperview().multipliedBy(24.0 / 41.0) } + body.snp.makeConstraints { make in + make.top.trailing.equalToSuperview() + bodyLeading = make.leading.equalToSuperview().offset(53).constraint + } + titleLabel.snp.makeConstraints { make in titleHeight = make.height.equalTo(30).constraint } + reasonLabel.snp.makeConstraints { make in make.leading.trailing.equalToSuperview().inset(8); make.centerY.equalToSuperview() } + reasonContainer.snp.makeConstraints { make in reasonHeight = make.height.equalTo(30).priority(999).constraint } + adviceLabel.snp.makeConstraints { make in adviceHeight = make.height.equalTo(22).priority(999).constraint } + retryButton.snp.makeConstraints { make in buttonHeight = make.height.equalTo(50).constraint } + noteLabel.snp.makeConstraints { make in noteHeight = make.height.equalTo(18).constraint } + } + + private func updateLayout() { + guard let presentation, bounds.width > 0, bounds.height > 0 else { return } + let width = max(1, bounds.width - 36) + let naturalReason = textHeight(reasonLabel.text, font: .systemFont(ofSize: 14), width: width - 53 - 16, lines: 3) + 10 + let naturalHeight: CGFloat = 30 + naturalReason + 22 + 10 + 50 + 18 + 14 + 32 + effectiveScale = min(1, max(0.8, bounds.height / naturalHeight)) + usesCompactLayout = bounds.height < 190 + let compact = usesCompactLayout + let extreme = bounds.height < 120 + let scale = compact ? 0.8 : effectiveScale + let top: CGFloat = compact ? 6 : 16 * scale + let gap: CGFloat = compact ? 3 : 5 * scale + let diameter: CGFloat = compact ? 32 : 41 * scale + let iconGap: CGFloat = compact ? 8 : 12 * scale + let textWidth = max(1, width - diameter - iconGap) + titleLabel.font = .systemFont(ofSize: compact ? 20 : max(20, 23 * scale), weight: .semibold) + reasonLabel.font = .systemFont(ofSize: max(12, 14 * scale)) + adviceLabel.font = .systemFont(ofSize: max(12, 14 * scale)) + titleLabel.numberOfLines = 1 + reasonLabel.numberOfLines = compact ? 1 : 3 + adviceLabel.numberOfLines = 1 + noteLabel.numberOfLines = 1 + adviceLabel.isHidden = extreme + let title = textHeight(presentation.title, font: titleLabel.font, width: textWidth, lines: 1) + let reasonPadding: CGFloat = compact ? 6 : 10 * scale + var reason = textHeight(reasonLabel.text, font: reasonLabel.font, width: textWidth - 16, + lines: reasonLabel.numberOfLines) + reasonPadding + let advice = extreme ? 0 : textHeight(adviceLabel.text, font: adviceLabel.font, width: textWidth, lines: 1) + let note = textHeight(noteLabel.text, font: noteLabel.font, width: width, lines: 1) + let actionHeight: CGFloat = compact ? 44 : max(44, 50 * scale) + let actionGap: CGFloat = compact ? 5 : 10 * scale + let noteGap: CGFloat = compact ? 3 : 4 + var bodyHeight: CGFloat { title + reason + advice + gap * (extreme ? 1 : 2) } + // 长原因先限制可见行数,完整文本仍可点开;不挤压固定页脚或按钮。 + while top * 2 + max(44, bodyHeight) + actionGap + actionHeight + noteGap + note > bounds.height, + reasonLabel.numberOfLines > 1 { + reasonLabel.numberOfLines -= 1 + reason = textHeight(reasonLabel.text, font: reasonLabel.font, width: textWidth - 16, + lines: reasonLabel.numberOfLines) + reasonPadding + } + contentTop?.update(offset: top) + noticeHeight?.update(offset: max(44, bodyHeight)) + iconSize?.update(offset: diameter) + iconBackground.layer.cornerRadius = diameter / 2 + bodyLeading?.update(offset: diameter + iconGap) + titleHeight?.update(offset: title) + reasonHeight?.update(offset: reason) + adviceHeight?.update(offset: max(1, advice)) + buttonHeight?.update(offset: actionHeight) + noteHeight?.update(offset: note) + body.spacing = gap + content.setCustomSpacing(actionGap, after: notice) + content.setCustomSpacing(noteGap, after: retryButton) + retryButton.configuration?.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: compact ? 16 : max(16, 18 * scale), weight: .semibold) + return result + } + } + + private func textHeight(_ text: String?, font: UIFont, width: CGFloat, lines: Int) -> CGFloat { + let height = ((text ?? "") as NSString).boundingRect( + with: CGSize(width: max(1, width), height: .greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font: font], context: nil).height + return ceil(min(max(font.lineHeight, height), font.lineHeight * CGFloat(lines))) + } + + @objc private func showDetails() { onDetails?() } + + @objc private func primaryTapped() { + guard retryButton.isEnabled else { return } + onPrimaryAction?() + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskLiveView.swift b/suixinkan/UI/DroneDock/DroneDockTaskLiveView.swift new file mode 100644 index 0000000..6f02245 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskLiveView.swift @@ -0,0 +1,286 @@ +import AVFoundation +import Kingfisher +import SnapKit +import UIKit + +/// 固定图传区域:渲染已验证的 RTC 会话或明确标记的本地样片。 +@MainActor +final class DroneDockTaskLiveView: UIView { + /// 用户主动获取或重试图传信息,具体请求由控制器协调。 + var onRequest: (() -> Void)? + /// 播放事件附带会话 ID,控制器据此丢弃离页或重连后的旧回调。 + var onPlaybackEvent: ((DroneDockLivePlaybackEvent, UUID) -> Void)? + /// 只上报接收端启动、更新和停止等离散事件;不输出帧数据或解锁旧 SDK 日志。 + var onDiagnosticEvent: ((String, [String: Any]) -> Void)? + + private let playerLayer = AVPlayerLayer() + private let titleLabel = DroneDockStyle.label(size: 15, weight: .medium, color: .white) + private let messageLabel = DroneDockStyle.label(size: 12, color: .lightGray) + private let sourceLabel = DroneDockStyle.label(size: 11, weight: .medium, color: .white) + private let sourceBadge = UIStackView() + private let liveDot = UIView() + private let requestButton = UIButton(type: .system) + private let labels = UIStackView() + private var player: AVQueuePlayer? + private var looper: AVPlayerLooper? + private var requestedURL: URL? + private var activeURL: URL? + private var isPlaybackActive = false + private let rtcView = UIView() + private let coverView = UIImageView() + private let coverShade = UIView() + private let coverIcon = UIImageView(image: UIImage(systemName: "photo.on.rectangle.angled")) + private var labelsCenterY: Constraint? + private var isShowingCover = false + private var coverURL: URL? + private var coverTitle = "拍摄已完成" + private let rtcPlayer: any DroneDockLivePlaying + private var requestedRTC: [DroneDockVolcLiveConfiguration] = [] + private var activeRTC: [DroneDockVolcLiveConfiguration] = [] + private var requestedSessionID: UUID? + private var activeSessionID: UUID? + + /// 图传区域实际显示与接收状态;不记录 RTC token 或播放地址。 + var diagnosticFields: [String: Any] { + ["playback_active": isPlaybackActive, "showing_cover": isShowingCover, + "cover_title": isShowingCover ? coverTitle : "", + "badge_visible": !sourceBadge.isHidden, "badge_title": sourceLabel.text ?? "", + "display_title": titleLabel.isHidden ? "" : titleLabel.text ?? "", + "display_message": messageLabel.isHidden ? "" : messageLabel.text ?? "", + "receiver_session": activeSessionID?.uuidString as Any? ?? NSNull(), + "receiver_rooms": activeRTC.map { ["role": $0.role, "room_id": $0.roomID] }, + "local_preview_active": player != nil] + } + + /// 保留原任务页图传区域的访问标识,外部负责 16:9 约束。 + override init(frame: CGRect) { + rtcPlayer = DroneDockVolcLivePlayer() + super.init(frame: frame) + setupUI() + setupConstraints() + } + + /// 测试注入无网络播放器,覆盖首帧、失败和会话释放。 + init(rtcPlayer: any DroneDockLivePlaying) { + self.rtcPlayer = rtcPlayer + super.init(frame: .zero) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 根据外部固定容器尺寸更新播放器画面,不改变任务布局。 + override func layoutSubviews() { + super.layoutSubviews() + CATransaction.begin() + CATransaction.setDisableActions(true) + playerLayer.frame = bounds + CATransaction.commit() + } + + /// 移出窗口也释放播放资源,覆盖交互返回和容器移除。 + override func didMoveToWindow() { + super.didMoveToWindow() + if window == nil { setPlaybackActive(false) } + } + + /// 在明确时机应用模型;远程 URL 即使错误传入也不会创建播放器。 + func apply(_ model: DroneDockLiveViewModel) { + guard !isShowingCover else { return } + titleLabel.text = model.title + messageLabel.text = model.message + requestButton.setTitle(model.actionTitle, for: .normal) + requestButton.isHidden = model.actionTitle == nil + requestButton.isEnabled = model.canLoad + requestedURL = model.playbackURL.flatMap { $0.isFileURL ? $0 : nil } + requestedRTC = model.rtcConfigurations + requestedSessionID = model.playbackSessionID + let hasLocalPreview = requestedURL != nil + let isPlaying = model.state == .playing + sourceLabel.text = hasLocalPreview ? "本地模拟画面 · 未连接无人机" : "实时图传" + sourceBadge.isHidden = !hasLocalPreview && !isPlaying + liveDot.isHidden = hasLocalPreview + titleLabel.isHidden = hasLocalPreview || isPlaying + messageLabel.isHidden = hasLocalPreview || isPlaying + accessibilityLabel = hasLocalPreview || isPlaying ? sourceLabel.text : "\(model.title),\(model.message)" + updatePlayback() + } + + /// 页面离开或进入后台立即释放播放器;重新获取图传参数由控制器协调。 + func setPlaybackActive(_ active: Bool) { + isPlaybackActive = active && !isShowingCover + updatePlayback() + } + + /// 录制结束或中断回巢后展示静态封面;调用方提供本地标题,避免将中断任务显示为成功。 + func showRecordingCover(_ show: Bool, url: URL?, title: String = "拍摄已完成") { + guard isShowingCover != show || coverURL != url || coverTitle != title else { return } + isShowingCover = show + coverURL = url + coverTitle = title + coverView.isHidden = !show + coverShade.isHidden = !show + coverIcon.isHidden = !show || url != nil + labelsCenterY?.update(offset: show ? 38 : -15) + guard show else { coverView.kf.cancelDownloadTask(); return } + setPlaybackActive(false) + coverView.contentMode = .scaleAspectFill + coverView.kf.setImage(with: url) + titleLabel.text = title + titleLabel.isHidden = false + messageLabel.text = "拍摄封面 · 实时图传已结束" + messageLabel.isHidden = false + sourceBadge.isHidden = true + requestButton.isHidden = true + accessibilityLabel = "\(title),拍摄封面,实时图传已结束" + } + + private func setupUI() { + backgroundColor = UIColor(hex: 0x171B22) + clipsToBounds = true + accessibilityIdentifier = "drone.task.remote.feedPlaceholder" + layer.addSublayer(playerLayer) + rtcView.backgroundColor = .clear + addSubview(rtcView) + coverView.backgroundColor = UIColor(hex: 0x182A36) + coverView.tintColor = UIColor.white.withAlphaComponent(0.22) + coverView.clipsToBounds = true + coverView.isHidden = true + coverView.accessibilityIdentifier = "drone.task.remote.live.cover" + addSubview(coverView) + coverShade.backgroundColor = .black.withAlphaComponent(0.3) + coverShade.isHidden = true + addSubview(coverShade) + coverIcon.contentMode = .scaleAspectFit + coverIcon.tintColor = .white.withAlphaComponent(0.7) + coverIcon.isHidden = true + addSubview(coverIcon) + playerLayer.videoGravity = .resizeAspect + titleLabel.textAlignment = .center + messageLabel.textAlignment = .center + messageLabel.numberOfLines = 2 + messageLabel.accessibilityIdentifier = "drone.task.remote.live.status" + titleLabel.accessibilityIdentifier = "drone.task.remote.live.title" + sourceLabel.accessibilityIdentifier = "drone.task.remote.live.source" + sourceBadge.axis = .horizontal + sourceBadge.alignment = .center + sourceBadge.spacing = 6 + sourceBadge.isHidden = true + sourceBadge.accessibilityIdentifier = "drone.task.remote.live.badge" + liveDot.backgroundColor = DroneDockStyle.success + liveDot.layer.cornerRadius = 3 + liveDot.accessibilityIdentifier = "drone.task.remote.live.dot" + sourceBadge.addArrangedSubview(liveDot) + sourceBadge.addArrangedSubview(sourceLabel) + requestButton.tintColor = .white + requestButton.titleLabel?.font = .systemFont(ofSize: 13, weight: .medium) + requestButton.backgroundColor = UIColor.black.withAlphaComponent(0.45) + requestButton.layer.cornerRadius = 6 + requestButton.accessibilityIdentifier = "drone.task.remote.live.request" + requestButton.addTarget(self, action: #selector(requestTapped), for: .touchUpInside) + labels.axis = .vertical + labels.spacing = 8 + labels.alignment = .fill + labels.addArrangedSubview(titleLabel) + labels.addArrangedSubview(messageLabel) + addSubview(labels) + addSubview(sourceBadge) + addSubview(requestButton) + } + + private func setupConstraints() { + rtcView.snp.makeConstraints { $0.edges.equalToSuperview() } + coverView.snp.makeConstraints { $0.edges.equalToSuperview() } + coverShade.snp.makeConstraints { $0.edges.equalToSuperview() } + coverIcon.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.centerY.equalToSuperview().offset(-28) + make.size.equalTo(42) + } + labels.snp.makeConstraints { make in + labelsCenterY = make.centerY.equalToSuperview().offset(-15).constraint + make.leading.trailing.equalToSuperview().inset(20) + } + requestButton.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.bottom.equalToSuperview().inset(12) + make.width.greaterThanOrEqualTo(150) + make.height.equalTo(36) + } + liveDot.snp.makeConstraints { $0.size.equalTo(6).priority(999) } + sourceBadge.snp.makeConstraints { make in + make.top.leading.equalToSuperview().inset(12) + make.trailing.lessThanOrEqualToSuperview().inset(12) + } + } + + private func updatePlayback() { + guard isPlaybackActive else { + releasePlayer() + releaseRTC() + return + } + if !requestedRTC.isEmpty, let sessionID = requestedSessionID { + releasePlayer() + guard activeSessionID != sessionID || activeRTC != requestedRTC else { return } + let isNewSession = activeSessionID != sessionID + if isNewSession { releaseRTC() } + activeSessionID = sessionID + activeRTC = requestedRTC + onDiagnosticEvent?(isNewSession ? "live.receiver.start_requested" : "live.receiver.rooms_updated", [ + "receiver_session": sessionID.uuidString, + "rooms": requestedRTC.map { ["role": $0.role, "room_id": $0.roomID] }]) + rtcPlayer.setGeometryHandler { [weak self] geometry in + guard let self, self.activeSessionID == sessionID else { return } + var fields = geometry.diagnosticFields + fields["receiver_session"] = sessionID.uuidString + self.onDiagnosticEvent?("live.geometry", fields) + } + rtcPlayer.start(requestedRTC, in: rtcView) { [weak self] event in + guard let self, self.activeSessionID == sessionID else { return } + self.onPlaybackEvent?(event, sessionID) + } + return + } + releaseRTC() + guard let requestedURL, requestedURL.isFileURL else { + releasePlayer() + return + } + guard activeURL != requestedURL || player == nil else { return } + releasePlayer() + let queue = AVQueuePlayer() + queue.isMuted = true + looper = AVPlayerLooper(player: queue, templateItem: AVPlayerItem(url: requestedURL)) + player = queue + activeURL = requestedURL + playerLayer.player = queue + queue.play() + onDiagnosticEvent?("live.local_preview.started", ["simulation": true]) + } + + private func releaseRTC() { + guard let sessionID = activeSessionID else { return } + onDiagnosticEvent?("live.receiver.stopped", ["receiver_session": sessionID.uuidString, + "rooms": activeRTC.map { ["role": $0.role, "room_id": $0.roomID] }]) + activeSessionID = nil + activeRTC = [] + rtcPlayer.setGeometryHandler(nil) + rtcPlayer.stop() + } + + private func releasePlayer() { + if player != nil { onDiagnosticEvent?("live.local_preview.stopped", ["simulation": true]) } + player?.pause() + looper?.disableLooping() + player?.removeAllItems() + playerLayer.player = nil + looper = nil + player = nil + activeURL = nil + } + + @objc private func requestTapped() { onRequest?() } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskReadyView.swift b/suixinkan/UI/DroneDock/DroneDockTaskReadyView.swift new file mode 100644 index 0000000..ef5f927 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskReadyView.swift @@ -0,0 +1,260 @@ +import SnapKit +import UIKit + +/// 已到达待开拍面板:蓝色到达提示、分级文案及整行开拍按钮,倒计时只参与显示。 +@MainActor +final class DroneDockTaskReadyView: UIView { + /// 将已允许的主操作交给任务页面,组件自身不请求状态或发送开拍指令。 + var onPrimaryAction: (() -> Void)? + /// 当前排版比例,固定区域内不使用 transform 缩小点击范围。 + private(set) var effectiveScale: CGFloat = 1 + /// 固定区域较矮时收紧文字、图标和间距。 + private(set) var usesCompactLayout = false + + private let content = UIView() + private let header = UIView() + private let iconBackground = UIView() + private let icon = UIImageView(image: UIImage(systemName: "checkmark.circle.fill")) + private let titleLabel = DroneDockStyle.label(size: 23, weight: .semibold, color: UIColor(hex: 0x101523)) + private let promptLabel = DroneDockStyle.label(size: 18, weight: .medium, color: UIColor(hex: 0x101523)) + private let messageLabel = DroneDockStyle.label(size: 14, color: UIColor(hex: 0x6A79A0)) + private let actionButton = UIButton(type: .system) + private let activityIndicator = UIActivityIndicatorView(style: .medium) + private var presentation: DroneDockTaskPresentation? + private var countdownSeconds: Int? + private var identifiersActive = false + private var isPrimaryActionLoading = false + private var headerHeight: Constraint? + private var iconSize: Constraint? + private var textLeading: Constraint? + private var titleHeight: Constraint? + private var promptTop: Constraint? + private var promptHeight: Constraint? + private var messageTop: Constraint? + private var messageHeight: Constraint? + private var actionTop: Constraint? + private var actionHeight: Constraint? + + /// 创建与任务页固定状态区域配合的待开拍面板。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 保留展示模型中的真实限制说明和主操作许可,加载时仅显示对应按钮动画。 + func apply(_ presentation: DroneDockTaskPresentation, isRefreshing: Bool, isPrimaryActionLoading: Bool) { + self.presentation = presentation + self.isPrimaryActionLoading = isPrimaryActionLoading + titleLabel.text = presentation.title + messageLabel.text = presentation.message + actionButton.isHidden = presentation.action == .none || DroneDockHomeMetric.usableText(presentation.actionTitle) == nil + actionButton.isEnabled = presentation.isActionEnabled && !actionButton.isHidden && !isRefreshing && !isPrimaryActionLoading + actionButton.configuration?.image = UIImage(systemName: presentation.action == .refresh ? "arrow.clockwise" : "camera") + countdownSeconds = presentation.action == .start ? presentation.countdownSeconds.map { max(0, $0) } : nil + updateActionTitle() + if isPrimaryActionLoading { activityIndicator.startAnimating() } + else { activityIndicator.stopAnimating() } + actionButton.accessibilityValue = isPrimaryActionLoading ? "处理中" : nil + setIdentifiersActive(identifiersActive) + actionButton.setNeedsUpdateConfiguration() + setNeedsLayout() + } + + /// 更新已有按钮的数字,不改变权限、尺寸或触发任何业务回调。 + func updateCountdown(seconds: Int?) { + countdownSeconds = presentation?.action == .start ? seconds.map { max(0, $0) } : nil + updateActionTitle() + } + + /// 仅当前可见面板暴露公共标识,隐藏时清除数字及加载动画。 + func setIdentifiersActive(_ active: Bool) { + identifiersActive = active + if !active { + activityIndicator.stopAnimating() + updateCountdown(seconds: nil) + } + titleLabel.accessibilityIdentifier = active ? "drone.task.remote.statusTitle" : nil + promptLabel.accessibilityIdentifier = active ? "drone.task.remote.readyPrompt" : nil + messageLabel.accessibilityIdentifier = active ? "drone.task.remote.statusMessage" : nil + actionButton.accessibilityIdentifier = active + ? (presentation?.action == .refresh ? "drone.task.remote.refresh" : "drone.task.remote.primary") : nil + activityIndicator.accessibilityIdentifier = active ? "drone.task.remote.primary.loading" : nil + } + + /// 在固定区域内压缩排版,始终保留至少 44 点的主按钮。 + override func layoutSubviews() { + updateContentLayout() + super.layoutSubviews() + } + + private func setupUI() { + accessibilityIdentifier = "drone.task.remote.ready" + backgroundColor = .white + addSubview(content) + [header, actionButton].forEach(content.addSubview) + [iconBackground, titleLabel, promptLabel, messageLabel].forEach(header.addSubview) + iconBackground.addSubview(icon) + iconBackground.accessibilityIdentifier = "drone.task.remote.readyIcon" + iconBackground.backgroundColor = UIColor(hex: 0xE2EDFF) + iconBackground.layer.cornerRadius = 20.5 + icon.tintColor = UIColor(hex: 0x0671FF) + icon.contentMode = .scaleAspectFit + titleLabel.accessibilityTraits = .header + titleLabel.numberOfLines = 1 + promptLabel.text = "是否开始拍摄?" + promptLabel.numberOfLines = 1 + messageLabel.numberOfLines = 2 + messageLabel.lineBreakMode = .byTruncatingTail + var configuration = UIButton.Configuration.filled() + configuration.imagePadding = 12 + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 24, weight: .regular) + configuration.background.cornerRadius = 8 + configuration.cornerStyle = .fixed + configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8) + actionButton.configuration = configuration + actionButton.configurationUpdateHandler = { [weak self] button in + guard let self, var configuration = button.configuration else { return } + let foreground = UIColor.white + configuration.background.backgroundColor = UIColor(hex: 0x0671FF) + .withAlphaComponent(button.isEnabled || self.isPrimaryActionLoading ? 1 : 0.35) + configuration.baseForegroundColor = foreground + configuration.imageColorTransformer = UIConfigurationColorTransformer { _ in foreground } + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .monospacedDigitSystemFont(ofSize: self.usesCompactLayout ? 16 : 18, weight: .semibold) + result.foregroundColor = foreground + return result + } + button.configuration = configuration + } + actionButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + activityIndicator.color = .white + activityIndicator.hidesWhenStopped = true + activityIndicator.isUserInteractionEnabled = false + actionButton.addSubview(activityIndicator) + } + + private func setupConstraints() { + content.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(18) + make.centerY.equalToSuperview() + } + header.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + headerHeight = make.height.equalTo(86).constraint + } + iconBackground.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + iconSize = make.size.equalTo(41).constraint + } + icon.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(iconBackground.snp.width).multipliedBy(24.0 / 41.0) + } + titleLabel.snp.makeConstraints { make in + make.top.trailing.equalToSuperview() + textLeading = make.leading.equalTo(iconBackground.snp.trailing).offset(12).constraint + titleHeight = make.height.equalTo(30).constraint + } + promptLabel.snp.makeConstraints { make in + promptTop = make.top.equalTo(titleLabel.snp.bottom).offset(4).constraint + make.leading.trailing.equalTo(titleLabel) + promptHeight = make.height.equalTo(26).constraint + } + messageLabel.snp.makeConstraints { make in + messageTop = make.top.equalTo(promptLabel.snp.bottom).offset(3).constraint + make.leading.trailing.equalTo(titleLabel) + messageHeight = make.height.equalTo(23).constraint + } + actionButton.snp.makeConstraints { make in + actionTop = make.top.equalTo(header.snp.bottom).offset(10).constraint + make.leading.trailing.bottom.equalToSuperview() + actionHeight = make.height.equalTo(50).constraint + } + activityIndicator.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.trailing.equalToSuperview().inset(12) + make.size.equalTo(20) + } + } + + private func updateActionTitle() { + guard let presentation else { return } + var title = DroneDockHomeMetric.usableText(presentation.actionTitle) + if let seconds = countdownSeconds, let base = title { title = "\(base)(\(seconds)s)" } + UIView.performWithoutAnimation { + actionButton.setTitle(title, for: .normal) + actionButton.configuration?.title = title + actionButton.layoutIfNeeded() + } + } + + private func updateContentLayout() { + guard let presentation, bounds.width > 0, bounds.height > 0 else { return } + let wasCompact = usesCompactLayout + usesCompactLayout = bounds.height < 190 + let compact = usesCompactLayout + let extreme = bounds.height < 120 + let diameter: CGFloat = extreme ? 24 : compact ? 32 : 41 + let iconGap: CGFloat = extreme ? 8 : compact ? 10 : 12 + let titleSize: CGFloat = extreme ? 17 : compact ? 20 : 23 + let promptSize: CGFloat = extreme ? 15 : compact ? 17 : 18 + let messageSize: CGFloat = compact ? 13 : 14 + let buttonHeight: CGFloat = compact ? 44 : 50 + let buttonGap: CGFloat = extreme ? 6 : 10 + let available = max(1, bounds.height - (extreme ? 8 : 12)) + titleLabel.font = .systemFont(ofSize: titleSize, weight: .semibold) + promptLabel.font = .systemFont(ofSize: promptSize, weight: .medium) + messageLabel.font = .systemFont(ofSize: messageSize) + let title = max(ceil(titleLabel.font.lineHeight), compact ? 0 : 30) + var prompt = max(ceil(promptLabel.font.lineHeight), compact ? 0 : 26) + var firstGap: CGFloat = compact ? 2 : 4 + let secondGap: CGFloat = 3 + let textWidth = max(1, bounds.width - 36 - diameter - iconGap) + let paragraph = NSMutableParagraphStyle() + paragraph.minimumLineHeight = messageSize * 1.6 + paragraph.maximumLineHeight = messageSize * 1.6 + let attributes: [NSAttributedString.Key: Any] = [ + .font: messageLabel.font as Any, .foregroundColor: UIColor(hex: 0x6A79A0), .paragraphStyle: paragraph + ] + messageLabel.attributedText = NSAttributedString(string: presentation.message, attributes: attributes) + let measured = (presentation.message as NSString).boundingRect( + with: CGSize(width: textWidth, height: .greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: attributes, context: nil).height + var lines = extreme || presentation.message.isEmpty ? 0 : 2 + var body = lines == 0 ? 0 : ceil(min(measured, paragraph.maximumLineHeight * CGFloat(lines))) + while title + firstGap + prompt + (lines > 0 ? secondGap + body : 0) + buttonGap + buttonHeight > available, lines > 0 { + lines -= 1 + body = lines == 0 ? 0 : ceil(min(measured, paragraph.maximumLineHeight * CGFloat(lines))) + } + if title + firstGap + prompt + buttonGap + buttonHeight > available { + prompt = 0 + firstGap = 0 + } + promptLabel.isHidden = prompt == 0 + messageLabel.isHidden = lines == 0 + messageLabel.numberOfLines = max(1, lines) + effectiveScale = compact ? 0.8 : 1 + headerHeight?.update(offset: max(diameter, title + firstGap + prompt + (lines > 0 ? secondGap + body : 0))) + iconSize?.update(offset: diameter) + iconBackground.layer.cornerRadius = diameter / 2 + textLeading?.update(offset: iconGap) + titleHeight?.update(offset: title) + promptTop?.update(offset: firstGap) + promptHeight?.update(offset: prompt) + messageTop?.update(offset: lines > 0 ? secondGap : 0) + messageHeight?.update(offset: body) + actionTop?.update(offset: buttonGap) + actionHeight?.update(offset: buttonHeight) + if wasCompact != usesCompactLayout { actionButton.setNeedsUpdateConfiguration() } + } + + @objc private func primaryTapped() { + guard !isHidden, actionButton.isEnabled, !actionButton.isHidden else { return } + onPrimaryAction?() + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskShootingView.swift b/suixinkan/UI/DroneDock/DroneDockTaskShootingView.swift new file mode 100644 index 0000000..f1c5fd8 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskShootingView.swift @@ -0,0 +1,191 @@ +import SnapKit +import UIKit + +/// 拍摄中状态区域:对齐体验网页的蓝色视频提示和禁用状态按钮,不执行任何操作。 +@MainActor +final class DroneDockTaskShootingView: UIView { + /// 当前内容采用的排版参考比例,不通过 transform 缩小整个视图。 + private(set) var effectiveScale: CGFloat = 1 + /// 固定区域较小时收紧图标、字号和间距。 + private(set) var usesCompactLayout = false + + private let content = UIView() + private let header = UIView() + private let iconBackground = UIView() + private let icon = UIImageView(image: UIImage(systemName: "video.fill")) + private let titleLabel = DroneDockStyle.label(size: 23, weight: .semibold, color: UIColor(hex: 0x101523)) + private let messageLabel = DroneDockStyle.label(size: 14, color: UIColor(hex: 0x6A79A0)) + private let indicatorButton = UIButton(type: .system) + private var presentation: DroneDockTaskPresentation? + private var headerHeight: Constraint? + private var iconSize: Constraint? + private var textLeading: Constraint? + private var titleHeight: Constraint? + private var messageTop: Constraint? + private var messageHeight: Constraint? + private var indicatorTop: Constraint? + private var indicatorHeight: Constraint? + + /// 建立纯展示的拍摄中面板,外部任务页决定固定区域大小。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 展示已确认的拍摄中文案,按钮始终仅作状态指示。 + func apply(_ presentation: DroneDockTaskPresentation) { + self.presentation = presentation + titleLabel.text = presentation.title + messageLabel.text = presentation.message + indicatorButton.isEnabled = false + setNeedsLayout() + } + + /// 仅可见状态面板提供通用访问标识,避免匹配到隐藏的标题或说明。 + func setIdentifiersActive(_ active: Bool) { + titleLabel.accessibilityIdentifier = active ? "drone.task.remote.statusTitle" : nil + messageLabel.accessibilityIdentifier = active ? "drone.task.remote.statusMessage" : nil + } + + /// 按可用高度调整内部排版,状态按钮始终保留至少 44 点高度。 + override func layoutSubviews() { + updateContentLayout() + super.layoutSubviews() + } + + private func setupUI() { + accessibilityIdentifier = "drone.task.remote.shooting" + backgroundColor = .white + addSubview(content) + content.addSubview(header) + content.addSubview(indicatorButton) + [iconBackground, titleLabel, messageLabel].forEach(header.addSubview) + iconBackground.addSubview(icon) + iconBackground.backgroundColor = UIColor(hex: 0xE2EDFF) + iconBackground.layer.cornerRadius = 20.5 + icon.contentMode = .scaleAspectFit + icon.tintColor = UIColor(hex: 0x0671FF) + titleLabel.accessibilityTraits = .header + titleLabel.numberOfLines = 1 + titleLabel.lineBreakMode = .byTruncatingTail + messageLabel.numberOfLines = 2 + messageLabel.lineBreakMode = .byTruncatingTail + + var configuration = UIButton.Configuration.filled() + configuration.title = "拍摄中" + configuration.image = UIImage(systemName: "camera") + configuration.imagePadding = 12 + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 24, weight: .regular) + configuration.background.backgroundColor = UIColor(hex: 0xD7E7FF) + configuration.background.cornerRadius = 8 + configuration.cornerStyle = .fixed + configuration.baseForegroundColor = UIColor(hex: 0x4D91FF) + configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8) + indicatorButton.configuration = configuration + indicatorButton.isEnabled = false + indicatorButton.accessibilityIdentifier = "drone.task.remote.shootingIndicator" + indicatorButton.configurationUpdateHandler = { button in + button.configuration?.background.backgroundColor = UIColor(hex: 0xD7E7FF) + button.configuration?.baseForegroundColor = UIColor(hex: 0x4D91FF) + button.configuration?.imageColorTransformer = UIConfigurationColorTransformer { _ in UIColor(hex: 0x4D91FF) } + } + } + + private func setupConstraints() { + content.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(18) + make.centerY.equalToSuperview() + } + header.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + headerHeight = make.height.equalTo(81).constraint + } + iconBackground.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + iconSize = make.size.equalTo(41).constraint + } + icon.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(iconBackground.snp.width).multipliedBy(24.0 / 41.0) + } + titleLabel.snp.makeConstraints { make in + make.top.trailing.equalToSuperview() + textLeading = make.leading.equalTo(iconBackground.snp.trailing).offset(12).constraint + titleHeight = make.height.equalTo(30).constraint + } + messageLabel.snp.makeConstraints { make in + messageTop = make.top.equalTo(titleLabel.snp.bottom).offset(6).constraint + make.leading.trailing.equalTo(titleLabel) + messageHeight = make.height.equalTo(45).constraint + } + indicatorButton.snp.makeConstraints { make in + indicatorTop = make.top.equalTo(header.snp.bottom).offset(16).constraint + make.leading.trailing.bottom.equalToSuperview() + indicatorHeight = make.height.equalTo(50).constraint + } + } + + private func updateContentLayout() { + guard let presentation, bounds.width > 0, bounds.height > 0 else { return } + usesCompactLayout = bounds.height < 190 + let extreme = bounds.height < 120 + let compact = usesCompactLayout + let diameter: CGFloat = extreme ? 24 : compact ? 32 : 41 + let iconGap: CGFloat = extreme ? 8 : compact ? 10 : 12 + let titleSize: CGFloat = extreme ? 17 : compact ? 20 : 23 + let messageSize: CGFloat = compact ? 13 : 14 + let title = max(ceil(UIFont.systemFont(ofSize: titleSize, weight: .semibold).lineHeight), compact ? 0 : 30) + let textGap: CGFloat = extreme ? 3 : compact ? 4 : 6 + let actionGap: CGFloat = extreme ? 8 : compact ? 12 : 16 + let actionHeight: CGFloat = compact ? 44 : 50 + let inset: CGFloat = extreme ? 4 : 6 + let textWidth = max(1, bounds.width - 36 - diameter - iconGap) + let available = max(1, bounds.height - inset * 2) + let paragraph = NSMutableParagraphStyle() + paragraph.minimumLineHeight = messageSize * 1.6 + paragraph.maximumLineHeight = messageSize * 1.6 + paragraph.lineBreakMode = .byTruncatingTail + titleLabel.font = .systemFont(ofSize: titleSize, weight: .semibold) + let messageFont = UIFont.systemFont(ofSize: messageSize) + messageLabel.font = messageFont + let attributes: [NSAttributedString.Key: Any] = [ + .font: messageFont, + .foregroundColor: UIColor(hex: 0x6A79A0), + .paragraphStyle: paragraph + ] + messageLabel.attributedText = NSAttributedString(string: presentation.message, attributes: attributes) + let measured = (presentation.message as NSString).boundingRect( + with: CGSize(width: textWidth, height: .greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: attributes, context: nil).height + var lines = extreme || presentation.message.isEmpty ? 0 : 2 + var body = lines == 0 ? 0 : ceil(min(measured, paragraph.maximumLineHeight * CGFloat(lines))) + while max(diameter, title + (lines > 0 ? textGap + body : 0)) + actionGap + actionHeight > available, lines > 0 { + lines -= 1 + body = lines == 0 ? 0 : ceil(min(measured, paragraph.maximumLineHeight * CGFloat(lines))) + } + messageLabel.numberOfLines = max(1, lines) + messageLabel.isHidden = lines == 0 + let header = max(diameter, title + (lines > 0 ? textGap + body : 0)) + let natural = title + textGap + ceil(messageSize * 3.2) + actionGap + actionHeight + effectiveScale = min(1, max(0.8, available / max(1, natural))) + headerHeight?.update(offset: header) + iconSize?.update(offset: diameter) + iconBackground.layer.cornerRadius = diameter / 2 + textLeading?.update(offset: iconGap) + titleHeight?.update(offset: title) + messageTop?.update(offset: lines > 0 ? textGap : 0) + messageHeight?.update(offset: body) + indicatorTop?.update(offset: actionGap) + indicatorHeight?.update(offset: actionHeight) + indicatorButton.configuration?.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: compact ? 16 : 18, weight: .semibold) + result.foregroundColor = UIColor(hex: 0x4D91FF) + return result + } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockTaskStatusView.swift b/suixinkan/UI/DroneDock/DroneDockTaskStatusView.swift new file mode 100644 index 0000000..8e4959b --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockTaskStatusView.swift @@ -0,0 +1,394 @@ +import SnapKit +import UIKit + +/// 固定区域内组合任务状态与主操作,根据可用高度收紧内容,不滚动或改变外部尺寸。 +@MainActor +final class DroneDockTaskStatusView: UIView { + /// 当前状态的主操作,由页面协调执行,不在组件中调用接口。 + var onPrimaryAction: (() -> Void)? + /// 点击失败原因区域时展开完整说明,由页面协调展示。 + var onDetails: (() -> Void)? + /// 当前内容采用的字号和间距参考比例,始终介于 0.8 与 1。 + private(set) var effectiveScale: CGFloat = 1 + /// 中间区域不足以显示常规内容时采用紧凑布局。 + private(set) var usesCompactLayout = false + + private let contentStack = UIStackView() + private let titleRow = UIView() + private let iconView = UIImageView() + private let titleLabel = DroneDockStyle.label(size: 22, weight: .semibold) + private let messageLabel = DroneDockStyle.label(size: 14, color: DroneDockStyle.secondary) + private let deviceLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let actionRow = UIView() + private let primaryButton = UIButton(type: .system) + private let failureView = DroneDockTaskFailureView() + private let completedView = DroneDockTaskCompletedView() + private let shootingView = DroneDockTaskShootingView() + private let readyView = DroneDockTaskReadyView() + private let controlStateView = DroneDockTaskControlStateView() + private var presentation: DroneDockTaskPresentation? + private var countdownSeconds: Int? + private var contentTop: Constraint? + private var contentLeading: Constraint? + private var contentTrailing: Constraint? + private var iconSize: Constraint? + private var titleLeading: Constraint? + private var titleRowHeight: Constraint? + private var messageHeight: Constraint? + private var deviceHeight: Constraint? + + /// 读取当前可见控件的实际文案和许可,用于对照录屏;不改变布局或任务状态。 + var diagnosticFields: [String: Any] { + func descendants(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap(descendants) } + func isVisible(_ view: UIView) -> Bool { + if view === self { return !view.isHidden } + return !view.isHidden && (view.superview.map(isVisible) ?? false) + } + let visible = descendants(self).filter(isVisible) + let buttonIDs = ["drone.task.remote.primary", "drone.task.remote.refresh", "drone.task.remote.failureRetry", + "drone.task.remote.shooting.indicator"] + let button = visible.compactMap { $0 as? UIButton }.first { buttonIDs.contains($0.accessibilityIdentifier ?? "") } + ?? visible.compactMap { $0 as? UIButton }.first + let label = visible.compactMap { $0 as? UILabel }.first { + ["drone.task.remote.statusTitle", "drone.task.remote.failureTitle"].contains($0.accessibilityIdentifier ?? "") + } + let message = visible.compactMap { $0 as? UILabel }.first { + ["drone.task.remote.statusMessage", "drone.task.remote.failureReason"].contains($0.accessibilityIdentifier ?? "") + } + let countdownState = countdownSeconds == nil ? "hidden" : countdownSeconds == 0 ? "zero" : "running" + return ["phase": presentation?.phase.rawValue ?? "uninitialized", + "title": label?.text ?? presentation?.title ?? "", + "message": message?.text ?? "", "message_visible": message != nil, + "action": presentation.map { String(describing: $0.action) } ?? "none", + "action_title": button?.configuration?.title ?? button?.title(for: .normal) ?? "", + "action_enabled": button?.isEnabled == true && isUserInteractionEnabled, + "action_loading": visible.compactMap { $0 as? UIActivityIndicatorView }.contains { $0.isAnimating }, + "interactive": isUserInteractionEnabled, "countdown": countdownState] + } + + /// 创建固定状态槽,完成、失败与进行中使用各自的内容布局。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 外部容器决定高度;状态内容不会通过固有尺寸推高底部安全区。 + override var intrinsicContentSize: CGSize { + CGSize(width: UIView.noIntrinsicMetric, height: UIView.noIntrinsicMetric) + } + + /// 更新真实状态与动作许可;刷新期间保留内容,只暂时禁用主操作。 + func apply(_ presentation: DroneDockTaskPresentation, isRefreshing: Bool = false, isPrimaryActionLoading: Bool = false) { + self.presentation = presentation + updateCountdown(seconds: presentation.countdownSeconds) + let isFailure = presentation.phase == .failed + let isCompleted = [.postShootUploading, .completed].contains(presentation.phase) + let isShooting = presentation.phase == .shooting + let isReady = presentation.phase == .ready + let isControlState = [.paused, .returning, .returned].contains(presentation.phase) + contentStack.isHidden = isFailure || isCompleted || isShooting || isReady || isControlState + failureView.isHidden = !isFailure + completedView.isHidden = !isCompleted + shootingView.isHidden = !isShooting + readyView.isHidden = !isReady + controlStateView.isHidden = !isControlState + completedView.setIdentifiersActive(isCompleted) + shootingView.setIdentifiersActive(isShooting) + readyView.setIdentifiersActive(isReady) + controlStateView.setIdentifiersActive(isControlState) + titleLabel.accessibilityIdentifier = isCompleted || isShooting || isReady || isControlState ? nil : "drone.task.remote.statusTitle" + messageLabel.accessibilityIdentifier = isCompleted || isShooting || isReady || isControlState ? nil : "drone.task.remote.statusMessage" + if isReady { + primaryButton.accessibilityIdentifier = nil + readyView.apply(presentation, isRefreshing: isRefreshing, isPrimaryActionLoading: isPrimaryActionLoading) + setNeedsLayout() + return + } + if isControlState { + primaryButton.accessibilityIdentifier = nil + controlStateView.apply(presentation, isRefreshing: isRefreshing, isPrimaryActionLoading: isPrimaryActionLoading) + setNeedsLayout() + return + } + if isShooting { + primaryButton.accessibilityIdentifier = nil + shootingView.apply(presentation) + setNeedsLayout() + return + } + if isCompleted { + primaryButton.accessibilityIdentifier = nil + completedView.apply(presentation, isRefreshing: isRefreshing) + setNeedsLayout() + return + } + if isFailure { + failureView.apply(presentation, isRefreshing: isRefreshing) + setNeedsLayout() + return + } + titleLabel.text = presentation.title + messageLabel.text = presentation.message + deviceLabel.text = presentation.deviceStatus + let style = Self.style(for: presentation.phase) + iconView.image = UIImage(systemName: style.symbol) + iconView.tintColor = style.color + let actionTitle = DroneDockHomeMetric.usableText(presentation.actionTitle) + primaryButton.isHidden = presentation.action == .none || actionTitle == nil + updatePrimaryButtonTitle() + primaryButton.isEnabled = presentation.isActionEnabled && !primaryButton.isHidden && !isRefreshing + primaryButton.backgroundColor = primaryButton.isEnabled + ? DroneDockStyle.primary : DroneDockStyle.primary.withAlphaComponent(0.35) + primaryButton.accessibilityIdentifier = presentation.action == .refresh + ? "drone.task.remote.refresh" : "drone.task.remote.primary" + setNeedsLayout() + } + + /// 只刷新开拍按钮中的剩余秒数,不变更操作许可、服务端阶段或执行任何回调。 + func updateCountdown(seconds: Int?) { + let value = presentation?.phase == .ready && presentation?.action == .start + ? seconds.map { max(0, $0) } : nil + guard value != countdownSeconds else { return } + countdownSeconds = value + readyView.updateCountdown(seconds: value) + updatePrimaryButtonTitle() + } + + private func updatePrimaryButtonTitle() { + guard let presentation else { return } + let title = DroneDockHomeMetric.usableText(presentation.actionTitle) + let displayedTitle: String? + if presentation.phase == .ready, presentation.action == .start, + let title, let countdownSeconds { + displayedTitle = "\(title)(\(countdownSeconds)s)" + } else { + displayedTitle = title + } + // 秒数直接替换,避免系统按钮的标题过渡暂时保留旧数字。 + UIView.performWithoutAnimation { + primaryButton.setTitle(displayedTitle, for: .normal) + primaryButton.layoutIfNeeded() + } + } + + /// 尺寸改变时仅重排内部内容,保留至少 44 点操作区域,不使用 transform 缩放。 + override func layoutSubviews() { + if presentation?.phase == .ready { + super.layoutSubviews() + readyView.layoutIfNeeded() + effectiveScale = readyView.effectiveScale + usesCompactLayout = readyView.usesCompactLayout + return + } + if let phase = presentation?.phase, [.paused, .returning, .returned].contains(phase) { + super.layoutSubviews() + controlStateView.layoutIfNeeded() + effectiveScale = controlStateView.effectiveScale + usesCompactLayout = controlStateView.usesCompactLayout + return + } + if presentation?.phase == .shooting { + super.layoutSubviews() + shootingView.layoutIfNeeded() + effectiveScale = shootingView.effectiveScale + usesCompactLayout = shootingView.usesCompactLayout + return + } + if let phase = presentation?.phase, [.postShootUploading, .completed].contains(phase) { + super.layoutSubviews() + completedView.layoutIfNeeded() + effectiveScale = 1 + usesCompactLayout = completedView.usesCompactLayout + return + } + if presentation?.phase == .failed { + super.layoutSubviews() + failureView.layoutIfNeeded() + effectiveScale = failureView.effectiveScale + usesCompactLayout = failureView.usesCompactLayout + return + } + updateContentLayout() + super.layoutSubviews() + } + + private func setupUI() { + backgroundColor = .white + addSubview(readyView) + readyView.isHidden = true + readyView.onPrimaryAction = { [weak self] in self?.onPrimaryAction?() } + addSubview(controlStateView) + controlStateView.isHidden = true + controlStateView.onPrimaryAction = { [weak self] in self?.onPrimaryAction?() } + addSubview(shootingView) + shootingView.isHidden = true + addSubview(completedView) + completedView.isHidden = true + completedView.onViewMaterials = { [weak self] in self?.onPrimaryAction?() } + addSubview(failureView) + failureView.isHidden = true + failureView.onDetails = { [weak self] in self?.onDetails?() } + failureView.onPrimaryAction = { [weak self] in self?.onPrimaryAction?() } + contentStack.axis = .vertical + contentStack.alignment = .fill + contentStack.spacing = 10 + addSubview(contentStack) + contentStack.addArrangedSubview(titleRow) + contentStack.addArrangedSubview(messageLabel) + contentStack.addArrangedSubview(deviceLabel) + contentStack.addArrangedSubview(actionRow) + titleRow.addSubview(iconView) + titleRow.addSubview(titleLabel) + iconView.contentMode = .scaleAspectFit + titleLabel.numberOfLines = 2 + titleLabel.lineBreakMode = .byTruncatingTail + titleLabel.accessibilityTraits = .header + titleLabel.accessibilityIdentifier = "drone.task.remote.statusTitle" + messageLabel.numberOfLines = 3 + messageLabel.lineBreakMode = .byTruncatingTail + messageLabel.accessibilityIdentifier = "drone.task.remote.statusMessage" + deviceLabel.numberOfLines = 1 + deviceLabel.lineBreakMode = .byTruncatingTail + deviceLabel.accessibilityIdentifier = "drone.task.remote.deviceStatus" + actionRow.addSubview(primaryButton) + primaryButton.layer.cornerRadius = 9 + primaryButton.titleLabel?.font = .monospacedDigitSystemFont(ofSize: 15, weight: .semibold) + primaryButton.titleLabel?.lineBreakMode = .byTruncatingTail + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(.white.withAlphaComponent(0.9), for: .disabled) + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + } + + private func setupConstraints() { + readyView.snp.makeConstraints { $0.edges.equalToSuperview() } + controlStateView.snp.makeConstraints { $0.edges.equalToSuperview() } + shootingView.snp.makeConstraints { $0.edges.equalToSuperview() } + completedView.snp.makeConstraints { $0.edges.equalToSuperview() } + failureView.snp.makeConstraints { make in make.edges.equalToSuperview() } + contentStack.snp.makeConstraints { make in + contentTop = make.top.equalToSuperview().offset(12).constraint + contentLeading = make.leading.equalToSuperview().offset(16).constraint + contentTrailing = make.trailing.equalToSuperview().inset(16).constraint + } + titleRow.snp.makeConstraints { make in titleRowHeight = make.height.equalTo(36).priority(999).constraint } + iconView.snp.makeConstraints { make in + make.leading.centerY.equalToSuperview() + iconSize = make.size.equalTo(36).constraint + } + titleLabel.snp.makeConstraints { make in + titleLeading = make.leading.equalTo(iconView.snp.trailing).offset(10).constraint + make.trailing.centerY.equalToSuperview() + } + messageLabel.snp.makeConstraints { make in messageHeight = make.height.equalTo(34).priority(999).constraint } + deviceLabel.snp.makeConstraints { make in deviceHeight = make.height.equalTo(16).priority(999).constraint } + actionRow.snp.makeConstraints { make in make.height.equalTo(44) } + primaryButton.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + } + + private func updateContentLayout() { + guard let presentation, bounds.width > 0, bounds.height > 0 else { return } + let isExtreme = bounds.height < 120 + let horizontalInset: CGFloat = isExtreme ? 12 : 16 + let verticalInset: CGFloat = isExtreme ? 6 : 12 + let width = max(1, bounds.width - horizontalInset * 2) + let availableHeight = max(1, bounds.height - verticalInset * 2) + let message = DroneDockHomeMetric.usableText(presentation.message) + let hasMessage = message != nil && message != DroneDockHomeMetric.usableText(presentation.title) + let device = DroneDockHomeMetric.usableText(presentation.deviceStatus) + let hasDevice = device != nil && device != "—" + + let naturalTitle = max(36, Self.textHeight(presentation.title, font: .systemFont(ofSize: 22, weight: .semibold), + width: width - 46, lines: 2)) + let naturalMessage = hasMessage ? Self.textHeight(message, font: .systemFont(ofSize: 14), width: width, lines: 3) : 0 + let naturalDevice = hasDevice ? UIFont.systemFont(ofSize: 12).lineHeight : 0 + let naturalGaps = CGFloat(1 + (hasMessage ? 1 : 0) + (hasDevice ? 1 : 0)) * 10 + let naturalHeight = naturalTitle + naturalMessage + naturalDevice + 44 + naturalGaps + effectiveScale = min(1, max(0.8, availableHeight / max(1, naturalHeight))) + usesCompactLayout = bounds.height < 190 || naturalHeight * effectiveScale > availableHeight + + // 先收紧图标和间距;只有不足九成空间时才缩小文字。 + let fontScale: CGFloat = effectiveScale >= 0.9 ? 1 : effectiveScale / 0.9 + titleLabel.font = .systemFont(ofSize: max(17, 22 * fontScale), weight: .semibold) + messageLabel.font = .systemFont(ofSize: max(12, 14 * fontScale)) + deviceLabel.font = .systemFont(ofSize: 12) + let icon: CGFloat = isExtreme ? 20 : usesCompactLayout ? 24 : 36 * effectiveScale + let gap: CGFloat = isExtreme ? 4 : max(4, 10 * effectiveScale) + let titleGap: CGFloat = usesCompactLayout ? 8 : 10 * effectiveScale + titleLabel.numberOfLines = usesCompactLayout ? 1 : 2 + messageLabel.numberOfLines = usesCompactLayout ? 2 : 3 + messageLabel.isHidden = !hasMessage || isExtreme + deviceLabel.isHidden = !hasDevice || usesCompactLayout + let titleWidth = max(1, width - icon - titleGap) + var titleHeight = max(icon, Self.textHeight(presentation.title, font: titleLabel.font, + width: titleWidth, lines: titleLabel.numberOfLines)) + var messageLineCount = messageLabel.numberOfLines + var bodyHeight = messageLabel.isHidden ? 0 : Self.textHeight(message, font: messageLabel.font, + width: width, lines: messageLineCount) + let deviceTextHeight = deviceLabel.isHidden ? 0 : ceil(deviceLabel.font.lineHeight) + var contentHeight: CGFloat { + titleHeight + bodyHeight + deviceTextHeight + 44 + + CGFloat(1 + (messageLabel.isHidden ? 0 : 1) + (deviceLabel.isHidden ? 0 : 1)) * gap + } + while contentHeight > availableHeight && messageLineCount > 1 && !messageLabel.isHidden { + messageLineCount -= 1 + bodyHeight = Self.textHeight(message, font: messageLabel.font, width: width, lines: messageLineCount) + } + if contentHeight > availableHeight && titleLabel.numberOfLines > 1 { + titleLabel.numberOfLines = 1 + titleHeight = max(icon, ceil(titleLabel.font.lineHeight)) + } + if contentHeight > availableHeight && !messageLabel.isHidden { + messageLabel.isHidden = true + bodyHeight = 0 + } + messageLabel.numberOfLines = messageLineCount + let top = verticalInset + max(0, (availableHeight - contentHeight) / 2) + contentTop?.update(offset: top) + contentLeading?.update(offset: horizontalInset) + contentTrailing?.update(inset: horizontalInset) + iconSize?.update(offset: icon) + titleLeading?.update(offset: titleGap) + titleRowHeight?.update(offset: titleHeight) + messageHeight?.update(offset: max(1, bodyHeight)) + deviceHeight?.update(offset: max(1, deviceTextHeight)) + contentStack.spacing = gap + } + + private static func textHeight(_ text: String?, font: UIFont, width: CGFloat, lines: Int) -> CGFloat { + guard let text, !text.isEmpty else { return ceil(font.lineHeight) } + let height = (text as NSString).boundingRect(with: CGSize(width: max(1, width), height: .greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading], + attributes: [.font: font], context: nil).height + return ceil(min(height, font.lineHeight * CGFloat(lines))) + } + + private static func style(for phase: DroneDockTaskDisplayPhase) -> (symbol: String, color: UIColor) { + switch phase { + case .loading: ("clock.arrow.circlepath", DroneDockStyle.primary) + case .navigating: ("paperplane.fill", DroneDockStyle.primary) + case .ready: ("checkmark.circle.fill", DroneDockStyle.success) + case .shooting: ("video.fill", DroneDockStyle.primary) + case .postShootUploading: ("checkmark.circle.fill", DroneDockStyle.success) + case .postShootUploadFailed: ("exclamationmark.circle.fill", DroneDockStyle.warning) + case .paused: ("pause.circle.fill", DroneDockStyle.warning) + case .returning: ("arrow.uturn.backward.circle.fill", DroneDockStyle.warning) + case .returned: ("house.circle.fill", DroneDockStyle.warning) + case .completed: ("checkmark.circle.fill", DroneDockStyle.success) + case .failed: ("xmark.circle.fill", UIColor(hex: 0xD46B62)) + case .blocked, .readError: ("exclamationmark.circle.fill", DroneDockStyle.warning) + case .unknown: ("questionmark.circle.fill", DroneDockStyle.secondary) + } + } + + @objc private func primaryTapped() { + guard primaryButton.isEnabled, !primaryButton.isHidden else { return } + onPrimaryAction?() + } + +} diff --git a/suixinkan/UI/DroneDock/DroneDockVolcEngineAdapter.swift b/suixinkan/UI/DroneDock/DroneDockVolcEngineAdapter.swift new file mode 100644 index 0000000..1bd3866 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockVolcEngineAdapter.swift @@ -0,0 +1,107 @@ +import UIKit +@preconcurrency import VolcEngineRTC + +/// 接收端最小能力,隔离测试无需初始化 SDK 或使用真实凭证。 +@MainActor +protocol DroneDockRTCReceivingEngine: AnyObject { + /// 仅用于诊断的 SDK 版本;无 SDK 替身可保持未知。 + var sdkVersion: String? { get } + /// 创建一个独立接收房间并转交事件。 + func makeRoom(_ id: String, onEvent: @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingRoom)? + /// 按 SDK 提供的流 ID 绑定或解绑画布。 + func setVideoView(_ view: UIView?, streamID: String) -> Int + /// 销毁引擎及本地接收资源。 + func destroy() +} + +extension DroneDockRTCReceivingEngine { + var sdkVersion: String? { nil } +} + +/// 单路只收视频的房间;不提供发布、采集或设备控制能力。 +@MainActor +protocol DroneDockRTCReceivingRoom: AnyObject { + /// 使用与当前用户匹配的凭证入房。 + func join(_ configuration: DroneDockVolcLiveConfiguration) -> Int + /// 同用户凭证续期。 + func updateToken(_ token: String) -> Int + /// 订阅或取消订阅远端视频。 + func subscribeVideo(_ streamID: String, subscribe: Bool) -> Int + /// 退出并销毁接收房间。 + func destroy() +} + +/// 火山 SDK 适配器,封装当前任务的只收视频引擎与房间。 +@MainActor +final class DroneDockVolcEngineAdapter: DroneDockRTCReceivingEngine { + private let engine: ByteRTCEngine + private let delegate: DroneDockVolcDelegate + + /// 查询版本不会创建额外引擎或加入房间。 + var sdkVersion: String? { ByteRTCEngine.getSDKVersion() } + + private init(engine: ByteRTCEngine, delegate: DroneDockVolcDelegate) { + self.engine = engine + self.delegate = delegate + } + + /// 按已验证的当前任务播放配置构造 SDK。 + static func make(appID: String, onEvent: @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingEngine)? { + let delegate = DroneDockVolcDelegate(emit: onEvent) + let config = ByteRTCEngineConfig() + config.appID = appID + guard let engine = ByteRTCEngine.createRTCEngine(config, delegate: delegate) else { return nil } + return DroneDockVolcEngineAdapter(engine: engine, delegate: delegate) + } + + /// 每个房间独立保留回调桥接,避免弱引用导致事件丢失。 + func makeRoom(_ id: String, onEvent: @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingRoom)? { + guard let room = engine.createRTCRoom(id) else { return nil } + return DroneDockVolcRoomAdapter(room: room, delegate: DroneDockVolcDelegate(emit: onEvent)) + } + + /// 画布只依赖发布回调的 streamID,不假定远端流索引为零。 + func setVideoView(_ view: UIView?, streamID: String) -> Int { + let canvas = ByteRTCVideoCanvas() + canvas.view = view + canvas.renderMode = .fit + return Int(engine.setRemoteVideoCanvas(streamID, withCanvas: canvas)) + } + + /// 房间由接收器先释放,再销毁共享引擎。 + func destroy() { + engine.delegate = nil + ByteRTCEngine.destroyRTCEngine() + } +} + +/// 将只收视频的房间配置封装在 SDK 边界,所有回调由接收器切回主线程。 +@MainActor +private final class DroneDockVolcRoomAdapter: DroneDockRTCReceivingRoom { + private let room: ByteRTCRoom + private let delegate: DroneDockVolcDelegate + + init(room: ByteRTCRoom, delegate: DroneDockVolcDelegate) { + self.room = room + self.delegate = delegate + room.setRTCRoomDelegate(delegate) + } + + func join(_ configuration: DroneDockVolcLiveConfiguration) -> Int { + let config = ByteRTCRoomConfig() + config.isPublishAudio = false + config.isPublishVideo = false + config.isAutoSubscribeAudio = false + config.isAutoSubscribeVideo = false + let user = ByteRTCUserInfo() + user.userId = configuration.userID + return Int(room.joinRoom(configuration.token, userInfo: user, userVisibility: false, roomConfig: config)) + } + + func updateToken(_ token: String) -> Int { Int(room.updateToken(token)) } + func subscribeVideo(_ streamID: String, subscribe: Bool) -> Int { Int(room.subscribeStreamVideo(streamID, subscribe: subscribe)) } + func destroy() { + room.setRTCRoomDelegate(nil) + room.destroy() + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockVolcLivePlayer.swift b/suixinkan/UI/DroneDock/DroneDockVolcLivePlayer.swift new file mode 100644 index 0000000..16c4485 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockVolcLivePlayer.swift @@ -0,0 +1,385 @@ +import UIKit +@preconcurrency import VolcEngineRTC + +/// 可替换的双路图传播放器;测试注入内存替身,不初始化 RTC 或连接设备。 +@MainActor +protocol DroneDockLivePlaying: AnyObject { + /// 设置只读几何事件出口;不触发播放、连接或任务状态刷新。 + func setGeometryHandler(_ handler: (@MainActor (DroneDockLiveGeometry) -> Void)?) + /// 同一播放会话可增补或更新凭证,不重建未变化的房间。 + func start(_ configurations: [DroneDockVolcLiveConfiguration], in view: UIView, + onEvent: @escaping @MainActor (DroneDockLivePlaybackEvent) -> Void) + /// 只关闭本机订阅,不向设备发送停止推流指令。 + func stop() +} + +extension DroneDockLivePlaying { + /// 旧播放器替身无需实现诊断能力。 + func setGeometryHandler(_ handler: (@MainActor (DroneDockLiveGeometry) -> Void)?) {} +} + +/// 通过双路接收器播放真实图传,生命周期由任务页管理。 +@MainActor +final class DroneDockVolcLivePlayer: DroneDockLivePlaying { + private let receiver = DroneDockLiveReceiver(makeEngine: DroneDockVolcEngineAdapter.make) + + /// 几何事件与业务播放事件分离,不改变播放状态机。 + func setGeometryHandler(_ handler: (@MainActor (DroneDockLiveGeometry) -> Void)?) { + receiver.setGeometryHandler(handler) + } + + /// 两种构建均通过同一接收器播放当前任务的图传。 + func start(_ configurations: [DroneDockVolcLiveConfiguration], in view: UIView, + onEvent: @escaping @MainActor (DroneDockLivePlaybackEvent) -> Void) { + receiver.start(configurations, in: view, onEvent: onEvent) + } + + /// 释放本机播放资源,不发送任何设备控制请求。 + func stop() { receiver.stop() } +} + +/// 一个 RTC 引擎接收两个房间,机巢先接入,无人机有帧后覆盖,停流后恢复机巢。 +@MainActor +final class DroneDockLiveReceiver: DroneDockLivePlaying { + private var engine: (any DroneDockRTCReceivingEngine)? + private let makeEngine: (String, @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingEngine)? + private let firstFrameDelay: @Sendable () async throws -> Void + + /// 正式页面注入 SDK 适配器;测试注入内存接收端。 + init(makeEngine: @escaping (String, @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingEngine)?, + firstFrameDelay: @escaping @Sendable () async throws -> Void = { try await Task.sleep(for: .seconds(20)) }) { + self.makeEngine = makeEngine + self.firstFrameDelay = firstFrameDelay + } + private weak var container: UIView? + private var sources: [String: DroneDockVolcSource] = [:] + private var configurations: [DroneDockVolcLiveConfiguration] = [] + private var selection = DroneDockLiveSourceSelection() + private var displayedRole: String? + private var allowsDroneConnection = false + private var failedRoles: Set = [] + private var generation = UUID() + private var onEvent: (@MainActor (DroneDockLivePlaybackEvent) -> Void)? + private var onGeometry: (@MainActor (DroneDockLiveGeometry) -> Void)? + + /// 复用调用方的任务诊断会话,不在接收器中另建日志通道。 + func setGeometryHandler(_ handler: (@MainActor (DroneDockLiveGeometry) -> Void)?) { + onGeometry = handler + } + + /// 加入只收视频的房间;同一来源只更新 Token,避免后台重查导致画面闪断。 + func start(_ configurations: [DroneDockVolcLiveConfiguration], in view: UIView, + onEvent: @escaping @MainActor (DroneDockLivePlaybackEvent) -> Void) { + guard let first = configurations.first else { stop(); return } + if container !== view || self.configurations.first?.appID != first.appID { stop() } + self.onEvent = onEvent + self.container = view + self.configurations = configurations + if engine == nil { + let generation = generation + guard let engine = makeEngine(first.appID, { [weak self] event in + Task { @MainActor [weak self] in + guard let self, self.generation == generation else { return } + self.receive(event) + } + }) else { + stop(); onEvent(.failed("图传播放器初始化失败")); return + } + self.engine = engine + } + for role in Array(sources.keys) { + guard let source = sources[role] else { continue } + let replacement = configurations.first { $0.role == role } + if replacement?.roomID != source.configuration.roomID || replacement?.userID != source.configuration.userID { + removeSource(role) + } + } + if let airport = configurations.first(where: { $0.role == "airport" }) { connect(airport) } + else { allowsDroneConnection = true } + connectDroneIfAllowed() + if sources.isEmpty { + stop(); onEvent(.failed("无法加入图传房间,请重试")); return + } + displaySelectedSource() + } + + /// 离页释放两路订阅及同一个引擎,迟到回调由会话及房间身份拦截。 + func stop() { + generation = UUID() + onEvent = nil + for role in Array(sources.keys) { removeSource(role) } + engine?.destroy() + engine = nil + container = nil + configurations = [] + selection = DroneDockLiveSourceSelection() + displayedRole = nil + allowsDroneConnection = false + failedRoles = [] + } + + private func connect(_ configuration: DroneDockVolcLiveConfiguration) { + let role = configuration.role + guard configuration.expiresAt.timeIntervalSinceNow > 5 else { + removeSource(role) + failedRoles.insert(role) + if role == "airport" { allowsDroneConnection = true } + return + } + if let source = sources[role] { + guard source.configuration != configuration else { return } + guard source.room.updateToken(configuration.token) == 0 else { + removeSource(role) + connect(configuration) + return + } + source.configuration = configuration + scheduleExpiry(source) + return + } + guard let container else { return } + let generation = generation + let sourceID = UUID() + guard let room = engine?.makeRoom(configuration.roomID, onEvent: { [weak self] event in + Task { @MainActor [weak self] in + guard let self, self.generation == generation, self.sources[role]?.id == sourceID else { return } + self.receive(event) + } + }) else { + failedRoles.insert(role) + if role == "airport" { allowsDroneConnection = true } + return + } + let view = UIView(frame: container.bounds) + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] + view.backgroundColor = .black + view.isHidden = true + container.addSubview(view) + let source = DroneDockVolcSource(id: sourceID, configuration: configuration, room: room, view: view) + sources[role] = source + let result = room.join(configuration) + guard result == 0 else { + removeSource(role) + failedRoles.insert(role) + if role == "airport" { allowsDroneConnection = true } + return + } + // 机巢无首帧时不能无限等待,仍尝试无人机;已连房间继续等待发布事件。 + let delay = firstFrameDelay + source.timeoutTask = Task { @MainActor [weak self] in + do { try await delay() } catch { return } + guard !Task.isCancelled, let self, self.generation == generation, self.sources[role]?.id == sourceID else { return } + // 首帧等待超时只开放另一路;不能销毁仍在等待发布的房间或取消补取参数。 + self.markReady(false, source: source) + } + scheduleExpiry(source) + } + + private func connectDroneIfAllowed() { + guard allowsDroneConnection, let drone = configurations.first(where: { $0.role == "drone" }) else { return } + connect(drone) + } + + private func scheduleExpiry(_ source: DroneDockVolcSource) { + source.expiryTask?.cancel() + let role = source.configuration.role, sourceID = source.id, generation = generation + let delay = max(1, source.configuration.expiresAt.timeIntervalSinceNow) + source.expiryTask = Task { @MainActor [weak self] in + try? await Task.sleep(for: .seconds(delay)) + guard !Task.isCancelled, let self, self.generation == generation, self.sources[role]?.id == sourceID else { return } + self.removeSource(role) + self.displaySelectedSource() + if self.sources.isEmpty { + let callback = self.onEvent + self.stop() + callback?(.expired) + } + } + } + + private func removeSource(_ role: String) { + selection.setReady(false, role: role) + guard let source = sources.removeValue(forKey: role) else { return } + source.timeoutTask?.cancel() + source.expiryTask?.cancel() + if let streamID = source.streamID { _ = engine?.setVideoView(nil, streamID: streamID) } + source.room.destroy() + source.view.removeFromSuperview() + } + + private func receive(_ event: DroneDockVolcEvent) { + switch event { + case .published(let id, let roomID, let published): + guard !id.isEmpty, let source = source(in: roomID) else { return } + if !published { + guard source.streamID == id else { return } + _ = engine?.setVideoView(nil, streamID: id) + _ = source.room.subscribeVideo(id, subscribe: false) + source.streamID = nil + source.frameGeometry = nil + source.reportedFirstFrame = false + markReady(false, source: source) + return + } + guard source.streamID == nil else { return } + source.streamID = id + let render = engine?.setVideoView(source.view, streamID: id) + let subscribe = source.room.subscribeVideo(id, subscribe: true) + if render != 0 || subscribe != 0 { sourceFailed(source.configuration.role, message: "图传订阅失败(\(render ?? -1)/\(subscribe)),请重试") } + case .frame(let id, let roomID, let geometry): + guard let source = source(in: roomID), source.streamID == id else { return } + if let geometry { updateFrameGeometry(geometry, source: source, isFirstFrame: true) } + markReady(true, source: source) + case .videoSizeChanged(let id, let roomID, let geometry): + guard let source = source(in: roomID), source.streamID == id else { return } + updateFrameGeometry(geometry, source: source, isFirstFrame: false) + case .videoState(let id, let roomID, let state): + guard let source = source(in: roomID), source.streamID == id else { return } + switch state { + case .decoding: markReady(true, source: source) + case .stopped, .frozen, .failed: markReady(false, source: source) + default: break + } + case .roomFailed(let roomID, let code): + guard let source = source(in: roomID) else { return } + sourceFailed(source.configuration.role, message: "图传入房失败(\(code)),请重试") + case .connectionLost: + for source in sources.values { selection.setReady(false, role: source.configuration.role) } + displaySelectedSource() + case .failed(let code): + let callback = onEvent + stop() + callback?(.failed("图传连接失败(\(code)),请重试")) + } + } + + private func source(in roomID: String) -> DroneDockVolcSource? { + sources.values.first { $0.configuration.roomID == roomID } + } + + private func updateFrameGeometry(_ geometry: DroneDockVideoFrameGeometry, + source: DroneDockVolcSource, isFirstFrame: Bool) { + let changed = source.frameGeometry != geometry + source.frameGeometry = geometry + if isFirstFrame, !source.reportedFirstFrame { + source.reportedFirstFrame = true + emitGeometry(source, trigger: "first_frame") + } else if changed { + emitGeometry(source, trigger: "video_size_changed") + } + } + + private func emitGeometry(_ source: DroneDockVolcSource, trigger: String) { + guard let streamID = source.streamID, let container else { return } + onGeometry?(DroneDockLiveGeometry(trigger: trigger, role: source.configuration.role, + roomID: source.configuration.roomID, streamID: streamID, frame: source.frameGeometry, + containerWidth: Double(source.view.bounds.width), containerHeight: Double(source.view.bounds.height), + hostWidth: Double(container.bounds.width), hostHeight: Double(container.bounds.height), + isSelected: selection.selectedRole == source.configuration.role, sdkVersion: engine?.sdkVersion)) + } + + private func markReady(_ ready: Bool, source: DroneDockVolcSource) { + selection.setReady(ready, role: source.configuration.role) + if ready { + failedRoles.remove(source.configuration.role) + source.timeoutTask?.cancel(); source.timeoutTask = nil + } + displaySelectedSource() + if source.configuration.role == "airport" { + allowsDroneConnection = true + connectDroneIfAllowed() + } + } + + private func sourceFailed(_ role: String, message: String) { + failedRoles.insert(role) + selection.setReady(false, role: role) + if role == "airport" { allowsDroneConnection = true; connectDroneIfAllowed() } + displaySelectedSource() + if selection.selectedRole == nil, Set(configurations.map(\.role)).isSubset(of: failedRoles) { + let callback = onEvent + stop() + callback?(.failed(message)) + } + } + + private func displaySelectedSource() { + let role = selection.selectedRole + for source in sources.values { source.view.isHidden = source.configuration.role != role } + if let role, let view = sources[role]?.view { container?.bringSubviewToFront(view) } + guard displayedRole != role else { return } + displayedRole = role + if let role, let source = sources[role] { emitGeometry(source, trigger: "source_changed") } + onEvent?(.sourceChanged(role)) + } +} + +/// 每路独立持有房间、画布及超时;引擎由外层统一管理,避免销毁另一条流。 +@MainActor +private final class DroneDockVolcSource { + let id: UUID + var configuration: DroneDockVolcLiveConfiguration + let room: any DroneDockRTCReceivingRoom + let view: UIView + var streamID: String? + var frameGeometry: DroneDockVideoFrameGeometry? + var reportedFirstFrame = false + var timeoutTask: Task? + var expiryTask: Task? + + init(id: UUID, configuration: DroneDockVolcLiveConfiguration, room: any DroneDockRTCReceivingRoom, view: UIView) { + self.id = id; self.configuration = configuration; self.room = room; self.view = view + } +} + +/// SDK 工作线程只转交值类型事件;事件带房间和流身份以隔离两路回调。 +enum DroneDockVolcEvent: Sendable { + case published(String, String, Bool) + case frame(String, String, DroneDockVideoFrameGeometry? = nil) + case videoSizeChanged(String, String, DroneDockVideoFrameGeometry) + case videoState(String, String, ByteRTCRemoteVideoState) + case roomFailed(String, Int) + case connectionLost + case failed(Int) +} + +/// SDK 回调桥接,不采集音视频,不处理设备控制消息。 +final class DroneDockVolcDelegate: NSObject, ByteRTCEngineDelegate, ByteRTCRoomDelegate { + private let emit: @Sendable (DroneDockVolcEvent) -> Void + init(emit: @escaping @Sendable (DroneDockVolcEvent) -> Void) { self.emit = emit } + + func rtcRoom(_ rtcRoom: ByteRTCRoom, onUserPublishStreamVideo streamId: String, info: ByteRTCStreamInfo, isPublish: Bool) { + emit(.published(streamId, info.roomId, isPublish)) + } + + func rtcRoom(_ rtcRoom: ByteRTCRoom, onRoomStateChanged roomId: String, withUid uid: String, state: Int, extraInfo: String) { + if state != 0 { emit(.roomFailed(roomId, state)) } + } + + func rtcEngine(_ engine: ByteRTCEngine, onFirstRemoteVideoFrameDecoded streamId: String, + info: ByteRTCStreamInfo, withFrameInfo frameInfo: ByteRTCVideoFrameInfo) { + // 未展示的画布也能解码,不能依赖被隐藏视图的 rendered 回调判断首帧。 + emit(.frame(streamId, info.roomId, Self.geometry(frameInfo))) + } + + func rtcEngine(_ engine: ByteRTCEngine, onRemoteVideoSizeChanged streamId: String, + info: ByteRTCStreamInfo, withFrameInfo frameInfo: ByteRTCVideoFrameInfo) { + emit(.videoSizeChanged(streamId, info.roomId, Self.geometry(frameInfo))) + } + + private static func geometry(_ frameInfo: ByteRTCVideoFrameInfo) -> DroneDockVideoFrameGeometry { + DroneDockVideoFrameGeometry(width: frameInfo.width, height: frameInfo.height, + rotation: frameInfo.rotation.rawValue) + } + + func rtcEngine(_ engine: ByteRTCEngine, onRemoteVideoStateChanged streamId: String, info: ByteRTCStreamInfo, + withVideoState state: ByteRTCRemoteVideoState, withVideoStateReason reason: ByteRTCRemoteVideoStateChangeReason) { + emit(.videoState(streamId, info.roomId, state)) + } + + func rtcEngine(_ engine: ByteRTCEngine, onError errorCode: ByteRTCErrorCode) { emit(.failed(errorCode.rawValue)) } + func rtcEngine(_ engine: ByteRTCEngine, onConnectionStateChanged state: ByteRTCConnectionState) { + if state == .reconnecting { emit(.connectionLost) } + if state == .failed { emit(.failed(state.rawValue)) } + } +} diff --git a/suixinkan/UI/DroneDock/DroneDockWorkbenchViewController.swift b/suixinkan/UI/DroneDock/DroneDockWorkbenchViewController.swift new file mode 100644 index 0000000..6f3483a --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneDockWorkbenchViewController.swift @@ -0,0 +1,541 @@ +import SnapKit +import UIKit + +/// 机巢工作台:本地遥测、余次订单和今日统计;与订单页共享同一数据源。 +final class DroneDockWorkbenchViewController: BaseViewController { + /// 工作台展示逻辑,后续真实数据源接入时可保留页面结构。 + let viewModel: DroneDockWorkbenchViewModel + + /// 工作台分区,设备和订单分别更新。 + private enum Section: Int, CaseIterable { case context, devices, orders, statistics } + /// 使用稳定标识应用 Diffable 快照。 + private enum Item: Hashable { case context, device(String), order(String), emptyDevices, emptyOrders, statistics } + + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private var devicePage = 0 + private let pageControl = UIPageControl() + private weak var deliveryPresenter: UIViewController? + #if DEBUG + private var deliveryPreviewOrderID: String? + #endif + + /// 默认使用本地演示数据,不会发起请求。 + init(viewModel: DroneDockWorkbenchViewModel = DroneDockWorkbenchViewModel()) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { + title = "机巢工作台" + let receiptButton = UIButton(type: .system) + var configuration = UIButton.Configuration.plain() + configuration.title = "收款码" + configuration.image = UIImage(systemName: "qrcode") + configuration.imagePadding = 5 + configuration.baseForegroundColor = DroneDockStyle.text + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 17) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var attributes = attributes + attributes.font = .systemFont(ofSize: 12) + return attributes + } + receiptButton.configuration = configuration + receiptButton.snp.makeConstraints { make in make.height.equalTo(44) } + receiptButton.accessibilityLabel = "收款码" + receiptButton.accessibilityIdentifier = "drone.workbench.receipt" + receiptButton.addTarget(self, action: #selector(receiptTapped), for: .touchUpInside) + let receipt = UIBarButtonItem(customView: receiptButton) + receipt.accessibilityLabel = "收款码" + navigationItem.rightBarButtonItem = receipt + navigationItem.backButtonDisplayMode = .minimal + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + #if DEBUG + if let orderID = deliveryPreviewOrderID { + deliveryPreviewOrderID = nil + openDelivery(orderID: orderID, from: self) + } + #endif + } + + #if DEBUG + /// 等窗口完成展示后打开本地交付弹层,避免冷启动时抢先 present。 + func prepareDeliveryPreview(orderID: String) { deliveryPreviewOrderID = orderID } + #endif + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + collectionView.backgroundColor = .clear + collectionView.alwaysBounceVertical = true + collectionView.accessibilityIdentifier = "drone.workbench.list" + collectionView.register(DroneDockDeviceCell.self, forCellWithReuseIdentifier: "device") + collectionView.register(DroneDockCompactOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DroneDockContentCell.self, forCellWithReuseIdentifier: "content") + collectionView.register(DroneDockSectionHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header") + collectionView.register(DroneDockPageFooter.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "pages") + let refresh = UIRefreshControl() + refresh.tintColor = DroneDockStyle.primary + refresh.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + collectionView.refreshControl = refresh + view.addSubview(collectionView) + pageControl.currentPageIndicatorTintColor = DroneDockStyle.primary + pageControl.pageIndicatorTintColor = UIColor(hex: 0xD9DFEB) + pageControl.isUserInteractionEnabled = false + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.bottom.equalToSuperview() + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + viewModel.refresh() + if dataSource != nil { applySnapshot(animated: false) } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collection, indexPath, item in + guard let self else { return nil } + switch item { + case .device(let id): + let cell = collection.dequeueReusableCell(withReuseIdentifier: "device", for: indexPath) as! DroneDockDeviceCell + if let device = self.viewModel.devices.first(where: { $0.id == id }) { cell.cardView.apply(device: device) } + return cell + case .order(let id): + let cell = collection.dequeueReusableCell(withReuseIdentifier: "order", for: indexPath) as! DroneDockCompactOrderCell + if let order = self.viewModel.order(id: id) { + cell.apply(order: order) + cell.onShootingTap = { [weak self] in self?.showOrderEntry(id: id, action: .shooting) } + cell.onMaterialsTap = { [weak self] in self?.showOrderEntry(id: id, action: .materials) } + } + return cell + default: + let cell = collection.dequeueReusableCell(withReuseIdentifier: "content", for: indexPath) as! DroneDockContentCell + switch item { + case .context: + cell.applyContext("\(self.viewModel.context.scenicName) · \(self.viewModel.context.photographerName)") + #if DEBUG + cell.installScenarioMenu(UIMenu(title: "本地演示状态", children: DroneDockDemoScenario.allCases.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in self?.applyScenario(scenario) } + })) + #endif + case .emptyDevices: cell.applyEmpty(symbol: "airplane", title: "暂无可用无人机", detail: "当前景区尚未配置无人机") + case .emptyOrders: cell.applyEmpty(symbol: "doc.text", title: "暂无待拍摄订单", detail: "已完成订单可在“查看全部”中查看") + case .statistics: cell.applyStatistics(self.viewModel.statistics) + default: break + } + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] collection, kind, indexPath in + guard let self else { return nil } + let sections = self.dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(indexPath.section) else { return nil } + let section = sections[indexPath.section] + if kind == UICollectionView.elementKindSectionFooter { + let footer = collection.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "pages", for: indexPath) as! DroneDockPageFooter + footer.install(self.pageControl) + return footer + } + let header = collection.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "header", for: indexPath) as! DroneDockSectionHeader + header.apply(title: section == .orders ? "我的拍摄订单" : "今日统计", + count: section == .orders ? self.viewModel.orderCount : nil, + showsAction: section == .orders) + header.onViewAll = { [weak self] in self?.openOrders() } + return header + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, let section = Section(rawValue: index) else { return nil } + let height: NSCollectionLayoutDimension + switch section { + case .context: height = .absolute(40) + case .devices: height = .absolute(self.viewModel.devices.isEmpty ? 132 : 248) + case .orders: height = .estimated(150) + case .statistics: height = .absolute(104) + } + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: height)) + let multiple = section == .devices && self.viewModel.devices.count > 1 + let width: NSCollectionLayoutDimension = multiple ? .absolute(environment.container.effectiveContentSize.width - 48) : .fractionalWidth(1) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: width, heightDimension: height), subitems: [item]) + let layout = NSCollectionLayoutSection(group: group) + layout.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: section == .statistics ? 24 : 0, trailing: 16) + layout.interGroupSpacing = 12 + if section == .devices { + if multiple { + layout.orthogonalScrollingBehavior = .groupPaging + layout.visibleItemsInvalidationHandler = { [weak self] _, offset, _ in + guard let self else { return } + let step = max(1, environment.container.effectiveContentSize.width - 36) + let page = min(self.viewModel.devices.count - 1, max(0, Int((offset.x / step).rounded()))) + if self.devicePage != page { + self.devicePage = page + self.pageControl.currentPage = page + } + } + layout.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(24)), + elementKind: UICollectionView.elementKindSectionFooter, alignment: .bottom)] + } else { layout.contentInsets.bottom = 12 } + } + if section == .orders || section == .statistics { + layout.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(54)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)] + } + return layout + } + } + + private func applySnapshot(animated: Bool) { + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections(Section.allCases) + snapshot.appendItems([.context], toSection: .context) + snapshot.appendItems(viewModel.devices.isEmpty ? [.emptyDevices] : viewModel.devices.map { .device($0.id) }, toSection: .devices) + snapshot.appendItems(viewModel.orders.isEmpty ? [.emptyOrders] : viewModel.orders.map { .order($0.id) }, toSection: .orders) + snapshot.appendItems([.statistics], toSection: .statistics) + let previous = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { previous.contains($0) }) + pageControl.numberOfPages = viewModel.devices.count + pageControl.currentPage = min(devicePage, max(0, viewModel.devices.count - 1)) + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + guard let self else { return } + for case let header as DroneDockSectionHeader in self.collectionView.visibleSupplementaryViews(ofKind: UICollectionView.elementKindSectionHeader) { + if header.representsOrders { + header.apply(title: "我的拍摄订单", count: self.viewModel.orderCount, showsAction: true) + } + } + } + } + + private func openOrders() { + let controller = DroneShootingOrdersViewController(viewModel: DroneShootingOrdersViewModel(store: viewModel.store)) + controller.delegate = self + navigationController?.pushViewController(controller, animated: true) + } + + /// 拍摄、原素材和成片上传分别进入对应本地页面。 + private enum OrderEntry { case shooting, materials, delivery } + + private func showOrderEntry(id: String, action: OrderEntry) { + guard let order = viewModel.store.orders.first(where: { $0.id == id }) else { return } + showPreviewEntry(order: order, action: action) + } + + private func showPreviewEntry(order: DroneShootingOrder, action: OrderEntry, presenter: UIViewController? = nil) { + switch action { + case .shooting: + openShootingOrder(id: order.id, from: presenter ?? self) + return + case .materials: + openMaterials(orderID: order.id, from: presenter ?? self) + return + case .delivery: + openDelivery(orderID: order.id, from: presenter ?? self) + } + } + + /// 始终读取当前范围快照,恢复原任务而不因重新进入重复召唤。 + private func openShootingOrder(id: String, from presenter: UIViewController) { + guard let order = viewModel.store.shootingOrder(id: id) else { return } + if order.activeTask != nil { + openTask(orderID: id, from: presenter) + } else if order.remainingShootingCount > 0 { + let controller = DroneShootingPreparationViewController( + viewModel: DroneShootingPreparationViewModel(store: viewModel.store, orderID: id) + ) + controller.delegate = self + presenter.navigationController?.pushViewController(controller, animated: true) + } + } + + private func openTask(orderID: String, from presenter: UIViewController) { + let controller = DroneShootingTaskViewController( + viewModel: DroneShootingTaskViewModel(store: viewModel.store, orderID: orderID) + ) + controller.delegate = self + presenter.navigationController?.pushViewController(controller, animated: true) + } + + private func openMaterials(orderID: String, pointID: String? = nil, from presenter: UIViewController) { + guard viewModel.store.shootingOrder(id: orderID) != nil else { return } + let controller = DroneMaterialsViewController( + viewModel: DroneMaterialsViewModel(store: viewModel.store, orderID: orderID, pointID: pointID) + ) + controller.delegate = self + presenter.navigationController?.pushViewController(controller, animated: true) + } + + private func openDelivery(orderID: String, pointID: String? = nil, from presenter: UIViewController) { + guard viewModel.store.shootingOrder(id: orderID) != nil, presenter.presentedViewController == nil else { return } + let controller = DroneDeliveryUploadViewController( + viewModel: DroneDeliveryViewModel(store: viewModel.store, orderID: orderID, pointID: pointID) + ) + controller.delegate = self + deliveryPresenter = presenter + let navigation = UINavigationController(rootViewController: controller) + navigation.setNavigationBarHidden(true, animated: false) + navigation.modalPresentationStyle = .pageSheet + navigation.sheetPresentationController?.detents = [.medium(), .large()] + navigation.sheetPresentationController?.prefersGrabberVisible = true + navigation.sheetPresentationController?.preferredCornerRadius = 24 + presenter.present(navigation, animated: true) + } + + private func openDeliveryReview(orderID: String, from presenter: UIViewController) { + guard viewModel.store.shootingOrder(id: orderID) != nil else { return } + let controller = DroneDeliveryReviewViewController( + viewModel: DroneDeliveryViewModel(store: viewModel.store, orderID: orderID) + ) + controller.delegate = self + presenter.navigationController?.pushViewController(controller, animated: true) + } + + private func refreshAfterDelivery(in presenter: UIViewController?) { + viewModel.refresh() + if isViewLoaded { applySnapshot(animated: false) } + if let orders = presenter as? DroneShootingOrdersViewController { orders.refreshOrders() } + if let materials = presenter as? DroneMaterialsViewController { materials.refreshOrderSummary() } + if let review = presenter as? DroneDeliveryReviewViewController { review.refreshDeliveryState() } + } + + @objc private func receiptTapped() { + showAlert(title: "收款码", message: "套餐收款页面将在后续搭建,当前不会创建订单或发起收款。") + } + + @objc private func refreshTriggered() { + viewModel.refresh() + applySnapshot(animated: true) + collectionView.refreshControl?.endRefreshing() + } + + #if DEBUG + private func applyScenario(_ scenario: DroneDockDemoScenario) { + viewModel.applyScenario(scenario) + devicePage = 0 + collectionView.setCollectionViewLayout(makeLayout(), animated: false) + applySnapshot(animated: true) + } + #endif +} + +extension DroneDockWorkbenchViewController: DroneShootingOrdersViewControllerDelegate { + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectShooting order: DroneShootingOrder) { + showPreviewEntry(order: order, action: .shooting, presenter: controller) + } + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectMaterials order: DroneShootingOrder) { + showPreviewEntry(order: order, action: .materials, presenter: controller) + } + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectDelivery order: DroneShootingOrder) { + showPreviewEntry(order: order, action: .delivery, presenter: controller) + } + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectConfirmation order: DroneShootingOrder) { + openDeliveryReview(orderID: order.id, from: controller) + } +} + +extension DroneDockWorkbenchViewController: DroneShootingPreparationViewControllerDelegate { + func shootingPreparationViewController(_ controller: DroneShootingPreparationViewController, didRequestTaskFor orderID: String) { + openTask(orderID: orderID, from: controller) + } +} + +extension DroneDockWorkbenchViewController: DroneShootingTaskViewControllerDelegate { + func shootingTaskViewControllerDidRequestWorkbench(_ controller: DroneShootingTaskViewController) { + navigationController?.popToViewController(self, animated: true) + } + + func shootingTaskViewController(_ controller: DroneShootingTaskViewController, didRequestPreparationFor order: DroneShootingOrder) { + guard let navigationController, let index = navigationController.viewControllers.firstIndex(where: { $0 === self }) else { return } + let preparation = DroneShootingPreparationViewController( + viewModel: DroneShootingPreparationViewModel(store: viewModel.store, orderID: order.id) + ) + preparation.delegate = self + navigationController.setViewControllers(Array(navigationController.viewControllers.prefix(through: index)) + [preparation], animated: true) + } + + func shootingTaskViewController(_ controller: DroneShootingTaskViewController, didRequestMaterialsFor order: DroneShootingOrder) { + guard let order = viewModel.store.shootingOrder(id: order.id) else { return } + let pointID = viewModel.store.shootingSession(orderID: order.id)?.point.id + openMaterials(orderID: order.id, pointID: pointID, from: controller) + } +} + +extension DroneDockWorkbenchViewController: DroneMaterialsViewControllerDelegate { + func materialsViewController(_ controller: DroneMaterialsViewController, didRequestPreview material: DroneMaterial) { + guard material.canPreview else { return } + let preview = DroneMaterialPreviewViewController(items: controller.viewModel.previewMaterials, initialMaterialID: material.id) + controller.present(preview, animated: true) + } + + func materialsViewController(_ controller: DroneMaterialsViewController, didRequestDelivery record: DroneMaterialRecord?) { + openDelivery(orderID: controller.viewModel.orderID, pointID: record?.pointID, from: controller) + } +} + +extension DroneDockWorkbenchViewController: DroneDeliveryUploadViewControllerDelegate { + func deliveryUploadViewControllerDidFinish(_ controller: DroneDeliveryUploadViewController) { + let presenter = deliveryPresenter + if controller.presentingViewController != nil || controller.navigationController?.presentingViewController != nil { + controller.dismiss(animated: true) { [weak self] in self?.refreshAfterDelivery(in: presenter) } + } else { + refreshAfterDelivery(in: presenter) + } + } + + func deliveryUploadViewControllerDidRequestReview(_ controller: DroneDeliveryUploadViewController) { + let presenter = deliveryPresenter ?? self + let orderID = controller.viewModel.orderID + controller.dismiss(animated: true) { [weak self] in + guard let self else { return } + self.refreshAfterDelivery(in: presenter) + if !(presenter is DroneDeliveryReviewViewController) { self.openDeliveryReview(orderID: orderID, from: presenter) } + } + } + + func deliveryUploadViewController(_ controller: DroneDeliveryUploadViewController, didRequestPreview video: DroneDeliveryVideo) { + let material = video.previewMaterial + controller.present(DroneMaterialPreviewViewController(items: [material], initialMaterialID: material.id), animated: true) + } +} + +extension DroneDockWorkbenchViewController: DroneDeliveryReviewViewControllerDelegate { + func deliveryReviewViewControllerDidRequestUpload(_ controller: DroneDeliveryReviewViewController) { + openDelivery(orderID: controller.viewModel.orderID, from: controller) + } + + func deliveryReviewViewController(_ controller: DroneDeliveryReviewViewController, didRequestPreview work: DroneDeliveryWork) { + let materials = controller.previewMaterials + controller.present(DroneMaterialPreviewViewController(items: materials, initialMaterialID: work.id), animated: true) + } +} + +/// 工作台标题及查看全部入口。 +private final class DroneDockSectionHeader: UICollectionReusableView { + var onViewAll: (() -> Void)? + private(set) var representsOrders = false + private let titleLabel = DroneDockStyle.label(size: 17, weight: .semibold) + private let countLabel = DroneDockStyle.label(size: 15, color: DroneDockStyle.secondary) + private let button = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + let stack = UIStackView(arrangedSubviews: [titleLabel, countLabel, UIView(), button]) + stack.alignment = .center + stack.spacing = 9 + button.setTitle("查看全部 ›", for: .normal) + button.titleLabel?.font = .systemFont(ofSize: 13) + button.tintColor = DroneDockStyle.primary + button.accessibilityIdentifier = "drone.workbench.allOrders" + button.addTarget(self, action: #selector(viewAllTapped), for: .touchUpInside) + button.snp.makeConstraints { make in make.height.equalTo(44) } + addSubview(stack) + stack.snp.makeConstraints { make in make.leading.trailing.centerY.equalToSuperview() } + } + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + func apply(title: String, count: Int?, showsAction: Bool) { + representsOrders = showsAction + titleLabel.text = title + countLabel.text = count.map(String.init) + countLabel.isHidden = count == nil + button.isHidden = !showsAction + } + @objc private func viewAllTapped() { onViewAll?() } +} + +/// 单个页面指示器的容器,只有多设备布局才创建此页脚。 +private final class DroneDockPageFooter: UICollectionReusableView { + func install(_ control: UIPageControl) { + guard control.superview !== self else { return } + control.removeFromSuperview() + addSubview(control) + control.snp.makeConstraints { make in make.center.equalToSuperview(); make.height.equalTo(24) } + } +} + +/// 场景名称、空态和今日统计共用的简单容器。 +private final class DroneDockContentCell: UICollectionViewCell { + private var embeddedView: UIView? + private weak var contextLabel: UILabel? + + func applyContext(_ title: String) { + let label = DroneDockStyle.label(title, size: 12, color: DroneDockStyle.secondary) + label.numberOfLines = 2 + install(label, insets: UIEdgeInsets(top: 6, left: 0, bottom: 8, right: 0), isCard: false) + contextLabel = label + } + + #if DEBUG + func installScenarioMenu(_ menu: UIMenu) { + guard let label = contextLabel else { return } + label.removeFromSuperview() + embeddedView = nil + let button = UIButton(type: .system) + button.setTitle("演示状态 ⌄", for: .normal) + button.titleLabel?.font = .systemFont(ofSize: 11) + button.tintColor = DroneDockStyle.primary + button.menu = menu + button.showsMenuAsPrimaryAction = true + button.accessibilityLabel = "本地演示状态" + button.setContentHuggingPriority(.required, for: .horizontal) + let row = UIStackView(arrangedSubviews: [label, button]) + row.alignment = .center + row.spacing = 8 + install(row, insets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0), isCard: false) + } + #endif + + func applyEmpty(symbol: String, title: String, detail: String) { + let icon = UIImageView(image: UIImage(systemName: symbol)) + icon.tintColor = DroneDockStyle.secondary.withAlphaComponent(0.6) + icon.contentMode = .scaleAspectFit + icon.snp.makeConstraints { make in make.size.equalTo(28) } + let caption = DroneDockStyle.label(detail, size: 12, color: DroneDockStyle.secondary) + caption.numberOfLines = 0 + caption.textAlignment = .center + let stack = UIStackView(arrangedSubviews: [icon, DroneDockStyle.label(title, size: 14, weight: .medium), caption]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 9 + install(stack, insets: UIEdgeInsets(top: 20, left: 16, bottom: 20, right: 16), isCard: true) + } + + func applyStatistics(_ value: DroneDockDailyStatistics) { + let values = [("\(value.orderCount)", "成交订单"), (value.revenueText, "成交金额"), ("\(value.successfulShootingCount)", "成功拍摄")] + let stack = UIStackView(arrangedSubviews: values.map { value, title in + let number = DroneDockStyle.label(value, size: 23, weight: .semibold) + number.adjustsFontSizeToFitWidth = true + number.minimumScaleFactor = 0.7 + let column = UIStackView(arrangedSubviews: [number, DroneDockStyle.label(title, size: 12, color: DroneDockStyle.secondary)]) + column.axis = .vertical + column.alignment = .center + column.spacing = 9 + return column + }) + stack.distribution = .fillEqually + install(stack, insets: UIEdgeInsets(top: 23, left: 10, bottom: 23, right: 10), isCard: true) + } + + private func install(_ view: UIView, insets: UIEdgeInsets, isCard: Bool) { + embeddedView?.removeFromSuperview() + embeddedView = view + if isCard { DroneDockStyle.applyCard(to: contentView) } else { contentView.backgroundColor = .clear } + contentView.addSubview(view) + view.snp.makeConstraints { make in make.edges.equalToSuperview().inset(insets) } + } +} diff --git a/suixinkan/UI/DroneDock/DroneMaterialComponents.swift b/suixinkan/UI/DroneDock/DroneMaterialComponents.swift new file mode 100644 index 0000000..ffc6f00 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneMaterialComponents.swift @@ -0,0 +1,550 @@ +import SnapKit +import UIKit + +/// 素材库的订单摘要,保留拍摄履约与素材处理相互独立的表达。 +@MainActor +final class DroneMaterialOrderCell: UICollectionViewCell { + private let customerLabel = DroneDockStyle.label(size: 18, weight: .semibold) + private let statusLabel = DroneDockStatusLabel() + private let numberLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let countLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + let titleRow = UIStackView(arrangedSubviews: [customerLabel, statusLabel, UIView()]) + titleRow.axis = .horizontal + titleRow.alignment = .center + titleRow.spacing = 9 + let stack = UIStackView(arrangedSubviews: [titleRow, numberLabel, countLabel]) + stack.axis = .vertical + stack.spacing = 9 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview() + make.top.equalToSuperview().offset(16) + make.bottom.equalToSuperview().inset(18) + } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 显示本次入口订单的脱敏信息与拍摄次数。 + func apply(order: DroneShootingOrder?) { + guard let order else { + customerLabel.text = "订单信息暂不可用" + statusLabel.isHidden = true + numberLabel.text = "请返回订单列表重新进入" + countLabel.text = nil + accessibilityLabel = "订单信息暂不可用,请返回订单列表重新进入" + return + } + customerLabel.text = order.customerName + statusLabel.isHidden = false + statusLabel.apply(title: order.fulfillmentState.title, tone: order.fulfillmentState.tone) + numberLabel.text = order.orderNumber + countLabel.text = "含\(order.totalShootingCount)次拍摄 · 已拍摄\(order.successfulShootingCount)次 · 剩余\(order.remainingShootingCount)次" + accessibilityLabel = [order.customerName, order.fulfillmentState.title, order.orderNumber, countLabel.text].compactMap { $0 }.joined(separator: ",") + } +} + +/// 可横向浏览的点位筛选标签,下载期间保留现有筛选并禁用交互。 +@MainActor +final class DroneMaterialFilterCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 13, weight: .medium) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.layer.cornerRadius = 7 + contentView.layer.cornerCurve = .continuous + contentView.layer.borderWidth = 1 + titleLabel.textAlignment = .center + contentView.addSubview(titleLabel) + titleLabel.snp.makeConstraints { make in make.edges.equalToSuperview().inset(5) } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 映射筛选名称、选中态与交互许可。 + func apply(title: String, id: String?, selected: Bool, locked: Bool, wrapsTitle: Bool = false) { + titleLabel.numberOfLines = wrapsTitle ? 0 : 1 + titleLabel.lineBreakMode = wrapsTitle ? .byWordWrapping : .byTruncatingTail + titleLabel.text = title + titleLabel.textColor = selected ? DroneDockStyle.primary : UIColor(hex: 0x677183) + contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.09) : .white + contentView.layer.borderColor = (selected ? UIColor.clear : DroneDockStyle.border).cgColor + contentView.alpha = locked ? 0.5 : 1 + accessibilityIdentifier = "drone.materials.filter.\(id ?? "all")" + accessibilityLabel = title + var traits: UIAccessibilityTraits = .button + if selected { traits.insert(.selected) } + if locked { traits.insert(.notEnabled) } + accessibilityTraits = traits + } + + /// 云端交付点位在限定宽度内完整换行,短名称保留紧凑卡片。 + static func wrappedSize(title: String, maximumWidth: CGFloat) -> CGSize { + let font = UIFont.systemFont(ofSize: 13, weight: .medium) + let width = min(maximumWidth, ceil((title as NSString).size(withAttributes: [.font: font]).width) + 10) + let bounds = (title as NSString).boundingRect(with: CGSize(width: max(1, width - 10), height: .greatestFiniteMagnitude), + options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font: font], context: nil) + return CGSize(width: width, height: max(40, ceil(bounds.height) + 10)) + } +} + +/// 点位限定入口的只读提示,不将当前任务点位伪装成可切换筛选。 +@MainActor +final class DroneMaterialPointContextCell: UICollectionViewCell { + private let icon = UIImageView(image: UIImage(systemName: "mappin.circle.fill")) + private let titleLabel = DroneDockStyle.label(size: 14, weight: .semibold) + private let detailLabel = DroneDockStyle.label("仅显示当前打卡点素材", size: 11, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + icon.tintColor = DroneDockStyle.primary + [icon, titleLabel, detailLabel].forEach(contentView.addSubview) + icon.snp.makeConstraints { make in make.leading.centerY.equalToSuperview(); make.size.equalTo(16) } + titleLabel.snp.makeConstraints { make in + make.leading.equalTo(icon.snp.trailing).offset(6) + make.centerY.equalToSuperview() + make.trailing.lessThanOrEqualTo(detailLabel.snp.leading).offset(-8) + } + detailLabel.snp.makeConstraints { make in make.trailing.centerY.equalToSuperview() } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 展示限定点位的名称。 + func apply(title: String) { + titleLabel.text = title + accessibilityLabel = "\(title),仅显示当前打卡点素材" + } +} + +/// 素材分组上方的数量与全选控制,数量由当前可见记录提供。 +@MainActor +final class DroneMaterialSelectionCell: UICollectionViewCell { + /// 点击后由控制器调用 ViewModel 的全选操作。 + var onSelectAllTap: (() -> Void)? + private let countLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let selectAllButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + selectAllButton.titleLabel?.font = .systemFont(ofSize: 12) + selectAllButton.tintColor = DroneDockStyle.primary + selectAllButton.accessibilityIdentifier = "drone.materials.selectAll" + selectAllButton.addTarget(self, action: #selector(selectAllTapped), for: .touchUpInside) + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + [countLabel, selectAllButton, divider].forEach(contentView.addSubview) + countLabel.snp.makeConstraints { make in make.leading.centerY.equalToSuperview().offset(-2) } + selectAllButton.snp.makeConstraints { make in + make.trailing.equalToSuperview() + make.centerY.equalTo(countLabel) + make.leading.greaterThanOrEqualTo(countLabel.snp.trailing).offset(8) + make.height.equalTo(44) + } + divider.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview(); make.height.equalTo(1 / UIScreen.main.scale) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 全选只面向当前可下载项,上传中与失败素材不会计入。 + func apply(recordCount: Int, allSelected: Bool, enabled: Bool) { + countLabel.text = "\(recordCount)次拍摄 · 最新在前" + var config = UIButton.Configuration.plain() + config.title = "全选可下载" + config.imagePadding = 6 + config.contentInsets = .zero + let foreground = enabled ? MaterialSelectionIcon.primary : UIColor(hex: 0xC2C9D4) + config.image = MaterialSelectionIcon.orderImage(selected: allSelected, size: 19, + tint: foreground, includesBackground: false) + config.baseForegroundColor = foreground + config.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var attributes = incoming + attributes.font = .systemFont(ofSize: 12) + attributes.foregroundColor = foreground + return attributes + } + selectAllButton.configuration = config + selectAllButton.isEnabled = enabled + selectAllButton.accessibilityLabel = "全选可下载" + selectAllButton.accessibilityTraits = allSelected ? [.button, .selected] : .button + } + + @objc private func selectAllTapped() { onSelectAllTap?() } +} + +/// 每条拍摄记录的点位、航线、时间与独立的交付入口。 +@MainActor +final class DroneMaterialRecordHeaderView: UICollectionReusableView { + /// 交付入口向上层请求对应点位的成片上传。 + var onDeliveryTap: (() -> Void)? + private let titleLabel = DroneDockStyle.label(size: 17, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let deliveryButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + deliveryButton.titleLabel?.font = .systemFont(ofSize: 12) + var config = UIButton.Configuration.plain() + config.title = "交付成片" + config.image = UIImage(systemName: "play.rectangle") + config.imagePadding = 5 + config.contentInsets = .zero + config.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 13) + config.baseForegroundColor = DroneDockStyle.primary + config.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var attributes = incoming + attributes.font = .systemFont(ofSize: 12) + attributes.foregroundColor = DroneDockStyle.primary + return attributes + } + deliveryButton.configuration = config + deliveryButton.tintColor = DroneDockStyle.primary + deliveryButton.addTarget(self, action: #selector(deliveryTapped), for: .touchUpInside) + [titleLabel, detailLabel, deliveryButton].forEach(addSubview) + titleLabel.snp.makeConstraints { make in + make.leading.equalToSuperview() + make.top.equalToSuperview().offset(20) + make.trailing.lessThanOrEqualTo(deliveryButton.snp.leading).offset(-12) + } + deliveryButton.snp.makeConstraints { make in + make.trailing.equalToSuperview() + make.centerY.equalTo(titleLabel) + make.height.equalTo(44) + } + detailLabel.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview() + make.top.equalTo(titleLabel.snp.bottom).offset(9) + make.bottom.lessThanOrEqualToSuperview().inset(10) + } + titleLabel.accessibilityTraits = .header + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 使用完整拍摄记录身份绑定交付入口,避免仅按同名点位匹配。 + func apply(record: DroneMaterialRecord) { + titleLabel.text = record.pointName + detailLabel.text = record.summary + deliveryButton.accessibilityLabel = "\(record.pointName)交付成片,记录\(record.sequenceNumber)" + deliveryButton.accessibilityIdentifier = "drone.materials.delivery.\(record.id)" + } + + @objc private func deliveryTapped() { onDeliveryTap?() } +} + +/// 两列素材网格单元;缩略图预览与右上角多选按钮互不替代。 +@MainActor +final class DroneMaterialCell: UICollectionViewCell { + /// 点击就绪缩略图时请求预览。 + var onPreviewTap: (() -> Void)? + /// 点击右上角选择控件时仅改变选择。 + var onSelectionTap: (() -> Void)? + private let thumbnail = UIImageView() + private let previewButton = UIButton(type: .custom) + private let selectionButton = UIButton(type: .custom) + private let placeholderIcon = UIImageView() + private let videoBadge = UILabel() + private let nameLabel = DroneDockStyle.label(size: 13, weight: .medium) + private let statusLabel = DroneDockStyle.label(size: 12) + private let retryUploadButton = UIButton(type: .system) + private let nameRow = UIStackView() + + override init(frame: CGRect) { + super.init(frame: frame) + thumbnail.contentMode = .scaleAspectFill + thumbnail.clipsToBounds = true + thumbnail.layer.cornerRadius = 6 + thumbnail.layer.cornerCurve = .continuous + thumbnail.backgroundColor = UIColor(hex: 0xE9EDF5) + thumbnail.layer.borderWidth = 2 + placeholderIcon.contentMode = .scaleAspectFit + placeholderIcon.tintColor = UIColor(hex: 0x9CA6B6) + videoBadge.font = .systemFont(ofSize: 10, weight: .medium) + videoBadge.textColor = .white + videoBadge.backgroundColor = UIColor.black.withAlphaComponent(0.48) + videoBadge.layer.cornerRadius = 3 + videoBadge.clipsToBounds = true + videoBadge.textAlignment = .center + videoBadge.text = "视频" + selectionButton.imageView?.contentMode = .scaleAspectFit + selectionButton.contentHorizontalAlignment = .right + selectionButton.contentVerticalAlignment = .top + selectionButton.addTarget(self, action: #selector(selectionTapped), for: .touchUpInside) + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + retryUploadButton.setTitle("重试上传", for: .normal) + retryUploadButton.titleLabel?.font = .systemFont(ofSize: 11) + retryUploadButton.isEnabled = false + retryUploadButton.setTitleColor(DroneDockStyle.primary.withAlphaComponent(0.55), for: .disabled) + retryUploadButton.accessibilityHint = "当前演示不执行上传重试" + nameRow.axis = .horizontal + nameRow.alignment = .center + nameRow.spacing = 6 + nameRow.addArrangedSubview(nameLabel) + nameRow.addArrangedSubview(retryUploadButton) + retryUploadButton.setContentHuggingPriority(.required, for: .horizontal) + retryUploadButton.setContentCompressionResistancePriority(UILayoutPriority(999), for: .horizontal) + retryUploadButton.snp.makeConstraints { make in make.height.equalTo(16) } + [thumbnail, placeholderIcon, previewButton, videoBadge, selectionButton, nameRow, statusLabel].forEach(contentView.addSubview) + thumbnail.snp.makeConstraints { make in + make.leading.trailing.top.equalToSuperview() + make.height.equalTo(thumbnail.snp.width).multipliedBy(9.0 / 16.0) + } + previewButton.snp.makeConstraints { make in make.edges.equalTo(thumbnail) } + placeholderIcon.snp.makeConstraints { make in make.center.equalTo(thumbnail); make.size.equalTo(29) } + videoBadge.snp.makeConstraints { make in + make.leading.equalTo(thumbnail).offset(6) + make.bottom.equalTo(thumbnail).inset(6) + make.width.equalTo(32) + make.height.equalTo(18) + } + selectionButton.snp.makeConstraints { make in + make.top.trailing.equalTo(thumbnail).inset(6) + make.size.equalTo(44) + } + nameRow.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview() + make.top.equalTo(thumbnail.snp.bottom).offset(7) + } + statusLabel.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview() + make.top.equalTo(nameRow.snp.bottom).offset(4) + make.bottom.lessThanOrEqualToSuperview().inset(5) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 上传未就绪时显示占位且禁选,演示完成也不会标记为本机已保存。 + func apply(material: DroneMaterial, selected: Bool, selectionEnabled: Bool, completed: Bool) { + nameLabel.text = material.title + statusLabel.text = material.statusTitle + statusLabel.textColor = DroneDockStyle.color(for: material.statusTone) + thumbnail.image = material.canPreview ? UIImage(named: material.previewAssetName) : nil + thumbnail.layer.borderColor = selected ? DroneDockStyle.primary.cgColor : UIColor.clear.cgColor + placeholderIcon.isHidden = material.canPreview + placeholderIcon.image = UIImage(systemName: material.uploadState == .failed ? "xmark.circle" : "play.fill") + placeholderIcon.tintColor = material.uploadState == .failed ? DroneDockStyle.color(for: .red) : UIColor(hex: 0x9CA6B6) + retryUploadButton.isHidden = material.uploadState != .failed + retryUploadButton.accessibilityIdentifier = "drone.materials.retryUpload.\(material.id)" + videoBadge.isHidden = material.kind != .video || !material.canPreview + previewButton.isEnabled = material.canPreview + previewButton.accessibilityIdentifier = "drone.materials.preview.\(material.id)" + previewButton.accessibilityLabel = "预览\(material.title)" + selectionButton.isHidden = material.uploadState != .ready + selectionButton.isEnabled = selectionEnabled && !completed + selectionButton.accessibilityIdentifier = "drone.materials.select.\(material.id)" + selectionButton.accessibilityLabel = completed ? "\(material.title),演示完成,未写入相册" : "选择\(material.title)" + selectionButton.accessibilityTraits = selected || completed ? [.button, .selected] : .button + let tint = completed ? DroneDockStyle.success : MaterialSelectionIcon.primary + selectionButton.setImage(MaterialSelectionIcon.orderImage(selected: selected || completed, size: 22, + tint: tint, includesBackground: true), for: .normal) + selectionButton.setImage(MaterialSelectionIcon.orderImage(selected: selected || completed, size: 22, + tint: tint, includesBackground: true, opacity: 0.6), for: .disabled) + } + + @objc private func previewTapped() { onPreviewTap?() } + @objc private func selectionTapped() { onSelectionTap?() } +} + +/// 分组之间轻量的分隔线。 +@MainActor +final class DroneMaterialSeparatorView: UICollectionReusableView { + override init(frame: CGRect) { + super.init(frame: frame) + let line = UIView() + line.backgroundColor = DroneDockStyle.border + addSubview(line) + line.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview(); make.height.equalTo(1 / UIScreen.main.scale) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } +} + +/// 列表加载、为空与失败时的就地说明,保留顶部订单与刷新入口。 +@MainActor +final class DroneMaterialMessageCell: UICollectionViewCell { + private let icon = UIImageView() + private let titleLabel = DroneDockStyle.label(size: 16, weight: .medium) + private let detailLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + icon.tintColor = DroneDockStyle.secondary + icon.contentMode = .scaleAspectFit + titleLabel.textAlignment = .center + detailLabel.textAlignment = .center + detailLabel.numberOfLines = 0 + let stack = UIStackView(arrangedSubviews: [icon, titleLabel, detailLabel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 13 + contentView.addSubview(stack) + stack.snp.makeConstraints { make in make.centerY.equalToSuperview().offset(-12); make.leading.trailing.equalToSuperview().inset(12) } + icon.snp.makeConstraints { make in make.size.equalTo(38) } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 通过明确文案区分上传等待、空记录与加载异常。 + func apply(title: String, detail: String, symbol: String) { + titleLabel.text = title + detailLabel.text = detail + icon.image = UIImage(systemName: symbol) + accessibilityLabel = "\(title),\(detail)" + } +} + +/// 固定底栏以同一组件呈现选择、批次进度、暂停与完成结果。 +@MainActor +final class DroneMaterialsFooterView: UIView { + /// 执行当前状态对应的主要操作。 + var onPrimaryTap: (() -> Void)? + /// 返回选择状态或请求预留的交付入口。 + var onSecondaryTap: (() -> Void)? + private let titleLabel = DroneDockStyle.label(size: 13, weight: .medium) + private let trailingLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let resultIcon = UIImageView() + private let titleRow = UIStackView() + private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let progressView = UIProgressView(progressViewStyle: .default) + private let primaryButton = UIButton(type: .system) + private let secondaryButton = UIButton(type: .system) + private let stack = UIStackView() + + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + stack.axis = .vertical + stack.spacing = 10 + titleLabel.numberOfLines = 2 + titleLabel.accessibilityIdentifier = "drone.materials.footer.title" + trailingLabel.accessibilityIdentifier = "drone.materials.footer.trailing" + trailingLabel.textAlignment = .right + trailingLabel.setContentHuggingPriority(.required, for: .horizontal) + trailingLabel.setContentCompressionResistancePriority(UILayoutPriority(999), for: .horizontal) + resultIcon.contentMode = .scaleAspectFit + resultIcon.accessibilityIdentifier = "drone.materials.footer.resultIcon" + titleRow.axis = .horizontal + titleRow.alignment = .center + titleRow.spacing = 8 + [resultIcon, titleLabel, trailingLabel].forEach(titleRow.addArrangedSubview) + detailLabel.numberOfLines = 2 + detailLabel.accessibilityIdentifier = "drone.materials.footer.detail" + progressView.progressTintColor = DroneDockStyle.primary + progressView.trackTintColor = UIColor(hex: 0xE8EDF7) + progressView.accessibilityLabel = "本次素材下载保存进度" + primaryButton.titleLabel?.font = .systemFont(ofSize: 15, weight: .medium) + primaryButton.layer.cornerRadius = 7 + primaryButton.layer.cornerCurve = .continuous + primaryButton.tintColor = .white + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(UIColor.white.withAlphaComponent(0.85), for: .disabled) + secondaryButton.titleLabel?.font = .systemFont(ofSize: 12) + secondaryButton.tintColor = DroneDockStyle.secondary + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + secondaryButton.addTarget(self, action: #selector(secondaryTapped), for: .touchUpInside) + [titleRow, progressView, detailLabel, primaryButton, secondaryButton].forEach(stack.addArrangedSubview) + addSubview(divider) + addSubview(stack) + divider.snp.makeConstraints { make in make.leading.trailing.top.equalToSuperview(); make.height.equalTo(1 / UIScreen.main.scale) } + stack.snp.makeConstraints { make in + make.top.equalToSuperview().offset(12) + make.leading.trailing.equalToSuperview().inset(16) + make.bottom.equalTo(safeAreaLayoutGuide).inset(10) + } + primaryButton.snp.makeConstraints { make in make.height.equalTo(44) } + secondaryButton.snp.makeConstraints { make in make.height.equalTo(44).priority(999) } + resultIcon.snp.makeConstraints { make in make.width.height.equalTo(21).priority(999) } + progressView.snp.makeConstraints { make in make.height.equalTo(3).priority(999) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 只接受显示值,按钮语义和下载状态由控制器及 ViewModel 决定。 + func apply(title: String, detail: String, primaryTitle: String, primarySymbol: String, + enabled: Bool, identifier: String, progress: Double?, secondaryTitle: String? = nil, + tone: DroneDockStatusTone = .gray, trailingText: String? = nil, + resultSymbol: String? = nil, secondaryOutlined: Bool = false, secondaryEnabled: Bool = true) { + titleLabel.text = title + titleLabel.textColor = DroneDockStyle.text + titleLabel.font = .systemFont(ofSize: 13, weight: resultSymbol == nil ? .regular : .semibold) + trailingLabel.text = trailingText + trailingLabel.isHidden = trailingText == nil + trailingLabel.textColor = progress == nil ? DroneDockStyle.secondary : DroneDockStyle.primary + resultIcon.image = resultSymbol.flatMap(UIImage.init(systemName:)) + resultIcon.isHidden = resultSymbol == nil + resultIcon.tintColor = DroneDockStyle.color(for: tone) + detailLabel.text = detail + detailLabel.isHidden = detail.isEmpty + progressView.isHidden = progress == nil + progressView.setProgress(Float(progress ?? 0), animated: true) + var config = UIButton.Configuration.plain() + config.title = primaryTitle + config.image = UIImage(systemName: primarySymbol) + config.imagePadding = 7 + config.contentInsets = NSDirectionalEdgeInsets(top: 8, leading: 12, bottom: 8, trailing: 12) + config.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 16) + let primaryForeground: UIColor = enabled || progress == nil ? .white : DroneDockStyle.primary + let primaryBackground = enabled ? DroneDockStyle.primary : UIColor(hex: 0xCEDBFC) + config.cornerStyle = .fixed + config.background.cornerRadius = 7 + config.background.backgroundColor = primaryBackground + config.background.backgroundColorTransformer = UIConfigurationColorTransformer { _ in primaryBackground } + config.baseForegroundColor = primaryForeground + config.imageColorTransformer = UIConfigurationColorTransformer { _ in primaryForeground } + config.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var attributes = incoming + attributes.font = .systemFont(ofSize: 15, weight: .medium) + attributes.foregroundColor = primaryForeground + return attributes + } + primaryButton.configuration = config + primaryButton.isEnabled = enabled + primaryButton.backgroundColor = .clear + primaryButton.accessibilityIdentifier = identifier + var secondary = UIButton.Configuration.plain() + secondary.title = secondaryTitle + secondary.image = secondaryOutlined ? UIImage(systemName: "play.rectangle") : nil + secondary.imagePadding = 6 + secondary.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 14) + let secondaryForeground = secondaryOutlined ? DroneDockStyle.primary : DroneDockStyle.secondary + secondary.cornerStyle = .fixed + secondary.background.cornerRadius = 7 + secondary.baseForegroundColor = secondaryForeground + secondary.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var attributes = incoming + attributes.font = .systemFont(ofSize: 12) + attributes.foregroundColor = secondaryForeground + return attributes + } + secondaryButton.configuration = secondary + secondaryButton.tintColor = secondaryOutlined ? DroneDockStyle.primary : DroneDockStyle.secondary + secondaryButton.layer.cornerRadius = 7 + secondaryButton.layer.borderWidth = secondaryOutlined ? 1 : 0 + secondaryButton.layer.borderColor = DroneDockStyle.primary.cgColor + secondaryButton.isHidden = secondaryTitle == nil + secondaryButton.isEnabled = secondaryEnabled + secondaryButton.accessibilityIdentifier = secondaryOutlined ? "drone.materials.completedDelivery" : "drone.materials.continueSelecting" + } + + @objc private func primaryTapped() { onPrimaryTap?() } + @objc private func secondaryTapped() { onSecondaryTap?() } +} diff --git a/suixinkan/UI/DroneDock/DroneMaterialDemoTransferDriver.swift b/suixinkan/UI/DroneDock/DroneMaterialDemoTransferDriver.swift new file mode 100644 index 0000000..8fc9620 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneMaterialDemoTransferDriver.swift @@ -0,0 +1,65 @@ +import Foundation + +/// 本地 UI 演示的下载回执驱动,不连接网络、不写文件或系统相册。 +@MainActor +final class DroneMaterialDemoTransferDriver { + private var task: Task? + private var runningBatchID: UUID? + + /// 推进当前演示批次;相同批次不会重复启动,实际结果由 ViewModel 校验。 + func start(viewModel: DroneMaterialsViewModel, onTransferUpdate: @escaping () -> Void) { + guard let batch = viewModel.batch, !batch.isPaused else { return } + guard runningBatchID != batch.id || task == nil else { return } + stop() + let batchID = batch.id + runningBatchID = batchID + task = Task { @MainActor [weak self, weak viewModel] in + guard let self, let viewModel else { return } + defer { + if self.runningBatchID == batchID { + self.task = nil + self.runningBatchID = nil + } + } + for materialID in batch.itemIDs { + guard self.isCurrent(viewModel, batchID: batchID), + let material = viewModel.material(id: materialID) else { return } + switch material.downloadState { + case .downloading, .paused, .available: + for progress in [0.2, 0.45, 0.7, 1.0] { + guard await self.wait(viewModel, batchID: batchID) else { return } + viewModel.receive(.progress(progress), materialID: materialID, batchID: batchID) + onTransferUpdate() + } + viewModel.receive(.downloadCompleted, materialID: materialID, batchID: batchID) + onTransferUpdate() + case .awaitingSave: break + default: continue + } + guard self.isCurrent(viewModel, batchID: batchID) else { return } + viewModel.receive(.saveStarted, materialID: materialID, batchID: batchID) + onTransferUpdate() + guard await self.wait(viewModel, batchID: batchID) else { return } + viewModel.receive(.saveSucceeded, materialID: materialID, batchID: batchID) + onTransferUpdate() + } + } + } + + /// 取消演示回执;调用方再通知 ViewModel 暂停,返回前台不会自动启动。 + func stop() { + task?.cancel() + task = nil + runningBatchID = nil + } + + private func isCurrent(_ viewModel: DroneMaterialsViewModel, batchID: UUID) -> Bool { + !Task.isCancelled && runningBatchID == batchID + && viewModel.batch?.id == batchID && viewModel.batch?.isPaused == false + } + + private func wait(_ viewModel: DroneMaterialsViewModel, batchID: UUID) async -> Bool { + do { try await Task.sleep(nanoseconds: 180_000_000) } catch { return false } + return isCurrent(viewModel, batchID: batchID) + } +} diff --git a/suixinkan/UI/DroneDock/DroneMaterialPreviewViewController.swift b/suixinkan/UI/DroneDock/DroneMaterialPreviewViewController.swift new file mode 100644 index 0000000..8fc7bec --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneMaterialPreviewViewController.swift @@ -0,0 +1,429 @@ +import AVFoundation +import AVKit +import SnapKit +import UIKit + +/// 订单素材的本地只读预览页;分页与缩放不会改变素材选择、下载或拍摄任务。 +@MainActor +final class DroneMaterialPreviewViewController: UIViewController { + /// 本地预览列表只有一个媒体分区。 + private enum Section { + case materials + } + + private let items: [DroneMaterial] + private var currentIndex: Int + private var lastCollectionSize = CGSize.zero + private var dataSource: UICollectionViewDiffableDataSource! + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeCollectionLayout()) + private let closeButton = UIButton(type: .system) + private let counterLabel = UILabel() + private let emptyLabel = UILabel() + private let instructionLabel = UILabel() + private weak var videoController: AVPlayerViewController? + private var playbackTask: Task? + + /// 以当前素材为起点预览已就绪素材;未就绪项不会被带入预览列表。 + init(items: [DroneMaterial], initialMaterialID: String) { + var identifiers = Set() + self.items = items.filter { $0.canPreview && identifiers.insert($0.id).inserted } + currentIndex = self.items.firstIndex { $0.id == initialMaterialID } ?? 0 + super.init(nibName: nil, bundle: nil) + modalPresentationStyle = .fullScreen + modalTransitionStyle = .crossDissolve + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override var preferredStatusBarStyle: UIStatusBarStyle { .lightContent } + + override func viewDidLoad() { + super.viewDidLoad() + setupUI() + setupConstraints() + setupDataSource() + applySnapshot() + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + guard collectionView.bounds.width > 0, collectionView.bounds.size != lastCollectionSize else { return } + lastCollectionSize = collectionView.bounds.size + collectionView.collectionViewLayout.invalidateLayout() + collectionView.setContentOffset(CGPoint(x: CGFloat(currentIndex) * collectionView.bounds.width, y: 0), animated: false) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + if isBeingDismissed || navigationController?.isBeingDismissed == true { + playbackTask?.cancel() + videoController?.player?.pause() + } + } + + private func setupUI() { + view.backgroundColor = UIColor(hex: 0x141820) + view.accessibilityIdentifier = "drone.material.preview" + collectionView.backgroundColor = .clear + collectionView.isPagingEnabled = true + collectionView.showsHorizontalScrollIndicator = false + collectionView.alwaysBounceHorizontal = items.count > 1 + collectionView.contentInsetAdjustmentBehavior = .never + collectionView.accessibilityIdentifier = "drone.material.preview.pages" + collectionView.delegate = self + collectionView.register(DroneMaterialPreviewCell.self, forCellWithReuseIdentifier: DroneMaterialPreviewCell.reuseIdentifier) + + closeButton.setImage(UIImage(systemName: "xmark", withConfiguration: UIImage.SymbolConfiguration(pointSize: 18, weight: .regular)), for: .normal) + closeButton.tintColor = .white + closeButton.accessibilityLabel = "关闭素材预览" + closeButton.accessibilityIdentifier = "drone.material.preview.close" + closeButton.addTarget(self, action: #selector(closeTapped), for: .touchUpInside) + + counterLabel.textColor = UIColor.white.withAlphaComponent(0.75) + counterLabel.font = .monospacedDigitSystemFont(ofSize: 13, weight: .medium) + counterLabel.textAlignment = .center + counterLabel.accessibilityIdentifier = "drone.material.preview.counter" + updateCounter() + + emptyLabel.text = "暂无可预览的就绪素材" + emptyLabel.textColor = UIColor.white.withAlphaComponent(0.7) + emptyLabel.font = .systemFont(ofSize: 15) + emptyLabel.textAlignment = .center + emptyLabel.numberOfLines = 0 + emptyLabel.isHidden = !items.isEmpty + + instructionLabel.text = items.count > 1 ? "双指或双击缩放 · 左右滑动切换" : "双指或双击缩放" + instructionLabel.textColor = UIColor.white.withAlphaComponent(0.4) + instructionLabel.font = .systemFont(ofSize: 11) + instructionLabel.textAlignment = .center + instructionLabel.isHidden = items.isEmpty + + view.addSubview(collectionView) + view.addSubview(emptyLabel) + view.addSubview(closeButton) + view.addSubview(counterLabel) + view.addSubview(instructionLabel) + } + + private func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + closeButton.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).offset(4) + make.trailing.equalToSuperview().inset(10) + make.size.equalTo(44) + } + counterLabel.snp.makeConstraints { make in + make.centerY.equalTo(closeButton) + make.centerX.equalToSuperview() + make.leading.greaterThanOrEqualToSuperview().offset(64) + make.trailing.lessThanOrEqualTo(closeButton.snp.leading).offset(-8) + } + emptyLabel.snp.makeConstraints { make in + make.center.equalToSuperview() + make.leading.trailing.equalToSuperview().inset(32) + } + instructionLabel.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(24) + make.bottom.equalTo(view.safeAreaLayoutGuide).inset(16) + } + } + + private func setupDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collectionView, indexPath, identifier in + guard let self, let material = self.items.first(where: { $0.id == identifier }), + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: DroneMaterialPreviewCell.reuseIdentifier, for: indexPath) as? DroneMaterialPreviewCell else { + return UICollectionViewCell() + } + cell.configure(material: material) + cell.onPlayLocalVideo = { [weak self, weak cell] in + self?.playLocalVideo(material, sourceCell: cell) + } + return cell + } + } + + private func applySnapshot() { + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.materials]) + snapshot.appendItems(items.map(\.id)) + dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in + guard let self, self.collectionView.bounds.width > 0 else { return } + self.collectionView.layoutIfNeeded() + self.collectionView.setContentOffset(CGPoint(x: CGFloat(self.currentIndex) * self.collectionView.bounds.width, y: 0), animated: false) + } + } + + private func makeCollectionLayout() -> UICollectionViewLayout { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .horizontal + layout.minimumLineSpacing = 0 + layout.minimumInteritemSpacing = 0 + return layout + } + + private func updateCounter() { + counterLabel.text = items.isEmpty ? "0 / 0" : "\(currentIndex + 1) / \(items.count)" + counterLabel.accessibilityLabel = items.isEmpty ? "没有可预览素材" : "第 \(currentIndex + 1) 项,共 \(items.count) 项" + } + + private func updateCurrentIndex() { + guard collectionView.bounds.width > 0, !items.isEmpty else { return } + currentIndex = min(max(Int(round(collectionView.contentOffset.x / collectionView.bounds.width)), 0), items.count - 1) + updateCounter() + } + + private func playLocalVideo(_ material: DroneMaterial, sourceCell: DroneMaterialPreviewCell?) { + guard playbackTask == nil, let url = DroneMaterialPreviewCell.localVideoURL(for: material) else { return } + sourceCell?.setVideoValidationInProgress(true) + playbackTask = Task { @MainActor [weak self, weak sourceCell] in + let playable = (try? await AVURLAsset(url: url).load(.isPlayable)) == true + guard let self else { return } + self.playbackTask = nil + sourceCell?.setVideoValidationInProgress(false) + guard !Task.isCancelled, self.view.window != nil, self.presentedViewController == nil, + self.items.indices.contains(self.currentIndex), self.items[self.currentIndex].id == material.id else { return } + guard playable else { + sourceCell?.showUnavailableVideo() + return + } + let controller = AVPlayerViewController() + let player = AVPlayer(url: url) + controller.player = player + self.videoController = controller + self.present(controller, animated: true) { player.play() } + } + } + + @objc private func closeTapped() { + playbackTask?.cancel() + playbackTask = nil + videoController?.player?.pause() + dismiss(animated: true) + } +} + +extension DroneMaterialPreviewViewController: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + collectionView.bounds.size + } + + func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { updateCurrentIndex() } + + func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { updateCurrentIndex() } +} + +/// 单项本地素材预览,完整呈现图片并提供独立缩放,不触发远程请求。 +@MainActor +private final class DroneMaterialPreviewCell: UICollectionViewCell, UIScrollViewDelegate { + static let reuseIdentifier = "DroneMaterialPreviewCell" + + /// 用户明确点击本地可播放视频后通知预览页。 + var onPlayLocalVideo: (() -> Void)? + + private let scrollView = DroneMaterialPreviewZoomView() + private var imageView: UIImageView { scrollView.imageView } + private let titleLabel = UILabel() + private let typeLabel = UILabel() + private let zoomLabel = UILabel() + private let unavailableImageLabel = UILabel() + private let playButton = UIButton(type: .system) + private var imageAspectRatio: CGFloat = 9 / 16 + + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + super.prepareForReuse() + onPlayLocalVideo = nil + scrollView.setZoomScale(1, animated: false) + imageView.image = nil + playButton.isEnabled = true + } + + /// 只读取本地图片资源;视频无本地片源时明确显示静帧说明。 + func configure(material: DroneMaterial) { + scrollView.setZoomScale(1, animated: false) + scrollView.setContentOffset(.zero, animated: false) + let image: UIImage? + if material.kind == .photo, let url = material.previewURL, url.isFileURL { + image = UIImage(contentsOfFile: url.path) ?? UIImage(named: material.previewAssetName) + } else { + image = UIImage(named: material.previewAssetName) + } + imageView.image = image + imageView.accessibilityLabel = material.title + titleLabel.text = "\(material.title) · 演示素材" + imageAspectRatio = image.map { $0.size.height / max($0.size.width, 1) } ?? 9 / 16 + unavailableImageLabel.isHidden = image != nil + playButton.isHidden = Self.localVideoURL(for: material) == nil + switch material.kind { + case .photo: + typeLabel.text = "照片 · 本地演示图片" + case .video: + typeLabel.text = playButton.isHidden ? "视频 · 本地演示静帧 · 暂无演示视频" : "视频 · 本地演示视频" + } + zoomLabel.text = "100%" + updateMediaConstraints() + setNeedsLayout() + } + + /// 只接受实际存在的本地文件,远程地址不会被交给播放器。 + static func localVideoURL(for material: DroneMaterial) -> URL? { + guard material.kind == .video, let url = material.previewURL, url.isFileURL, + FileManager.default.fileExists(atPath: url.path), + ["mp4", "mov", "m4v"].contains(url.pathExtension.lowercased()) else { return nil } + return url + } + + /// 校验本地视频期间锁定播放按钮,避免重复创建播放器。 + func setVideoValidationInProgress(_ inProgress: Bool) { + playButton.isEnabled = !inProgress + playButton.accessibilityLabel = inProgress ? "正在检查本地视频" : "播放本地演示视频" + } + + /// 本地文件无法播放时保留真实静帧,不展示虚假的进度。 + func showUnavailableVideo() { + playButton.isHidden = true + typeLabel.text = "视频 · 本地演示静帧 · 暂无可播放演示视频" + } + + func viewForZooming(in scrollView: UIScrollView) -> UIView? { imageView } + + func scrollViewDidZoom(_ scrollView: UIScrollView) { + zoomLabel.text = "\(Int((scrollView.zoomScale * 100).rounded()))%" + } + + private func setupUI() { + scrollView.minimumZoomScale = 1 + scrollView.maximumZoomScale = 3 + scrollView.delegate = self + scrollView.showsHorizontalScrollIndicator = false + scrollView.showsVerticalScrollIndicator = false + scrollView.contentInsetAdjustmentBehavior = .never + scrollView.bouncesZoom = true + scrollView.accessibilityIdentifier = "drone.material.preview.zoomSurface" + imageView.contentMode = .scaleAspectFit + imageView.isAccessibilityElement = true + imageView.accessibilityIdentifier = "drone.material.preview.image" + + titleLabel.font = .systemFont(ofSize: 13, weight: .medium) + titleLabel.textColor = UIColor.white.withAlphaComponent(0.75) + titleLabel.textAlignment = .center + titleLabel.numberOfLines = 2 + titleLabel.accessibilityIdentifier = "drone.material.preview.title" + typeLabel.font = .systemFont(ofSize: 11) + typeLabel.textColor = UIColor.white.withAlphaComponent(0.5) + typeLabel.textAlignment = .center + typeLabel.numberOfLines = 2 + typeLabel.accessibilityIdentifier = "drone.material.preview.type" + zoomLabel.font = .monospacedDigitSystemFont(ofSize: 11, weight: .regular) + zoomLabel.textColor = UIColor.white.withAlphaComponent(0.4) + zoomLabel.textAlignment = .center + zoomLabel.accessibilityIdentifier = "drone.material.preview.zoom" + + unavailableImageLabel.text = "暂无本地演示图片" + unavailableImageLabel.font = .systemFont(ofSize: 14) + unavailableImageLabel.textColor = UIColor.white.withAlphaComponent(0.65) + unavailableImageLabel.textAlignment = .center + unavailableImageLabel.numberOfLines = 0 + playButton.setImage(UIImage(systemName: "play.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 58, weight: .regular)), for: .normal) + playButton.tintColor = .white + playButton.accessibilityLabel = "播放本地演示视频" + playButton.accessibilityIdentifier = "drone.material.preview.play" + playButton.addTarget(self, action: #selector(playTapped), for: .touchUpInside) + + contentView.addSubview(scrollView) + contentView.addSubview(unavailableImageLabel) + contentView.addSubview(titleLabel) + contentView.addSubview(typeLabel) + contentView.addSubview(zoomLabel) + contentView.addSubview(playButton) + let doubleTap = UITapGestureRecognizer(target: self, action: #selector(doubleTapped(_:))) + doubleTap.numberOfTapsRequired = 2 + scrollView.addGestureRecognizer(doubleTap) + } + + private func setupConstraints() { + updateMediaConstraints() + titleLabel.snp.makeConstraints { make in + make.top.equalTo(scrollView.snp.bottom).offset(16) + make.leading.trailing.equalToSuperview().inset(24) + } + typeLabel.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(6) + make.leading.trailing.equalTo(titleLabel) + } + zoomLabel.snp.makeConstraints { make in + make.top.equalTo(typeLabel.snp.bottom).offset(6) + make.leading.trailing.equalTo(titleLabel) + } + unavailableImageLabel.snp.makeConstraints { make in + make.center.equalTo(scrollView) + make.leading.trailing.equalToSuperview().inset(32) + } + playButton.snp.makeConstraints { make in + make.center.equalTo(scrollView) + make.size.equalTo(72) + } + } + + private func updateMediaConstraints() { + scrollView.snp.remakeConstraints { make in + make.leading.trailing.equalToSuperview() + make.centerY.equalToSuperview().offset(-28) + make.height.equalTo(scrollView.snp.width).multipliedBy(imageAspectRatio).priority(999) + make.height.lessThanOrEqualToSuperview().multipliedBy(0.6) + } + } + + @objc private func playTapped() { onPlayLocalVideo?() } + + @objc private func doubleTapped(_ gesture: UITapGestureRecognizer) { + guard imageView.image != nil else { return } + if scrollView.zoomScale > 1 { + scrollView.setZoomScale(1, animated: true) + return + } + let point = gesture.location(in: imageView) + let targetScale: CGFloat = 3 + let size = CGSize(width: scrollView.bounds.width / targetScale, height: scrollView.bounds.height / targetScale) + scrollView.zoom(to: CGRect(x: point.x - size.width / 2, y: point.y - size.height / 2, width: size.width, height: size.height), animated: true) + } +} + +/// 在自身视口完成布局后设置图片尺寸,避免依赖集合单元与约束子树的布局先后顺序。 +@MainActor +private final class DroneMaterialPreviewZoomView: UIScrollView { + /// 由素材单元配置的图片,也是 UIScrollView 的缩放目标。 + let imageView = UIImageView() + private var lastViewportSize = CGSize.zero + + override init(frame: CGRect) { + super.init(frame: frame) + imageView.isUserInteractionEnabled = true + addSubview(imageView) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func layoutSubviews() { + super.layoutSubviews() + let viewportSize = bounds.size + guard viewportSize.width > 0, viewportSize.height > 0, viewportSize != lastViewportSize else { return } + lastViewportSize = viewportSize + setZoomScale(1, animated: false) + imageView.frame = CGRect(origin: .zero, size: viewportSize) + contentSize = viewportSize + setContentOffset(.zero, animated: false) + } +} diff --git a/suixinkan/UI/DroneDock/DroneMaterialsViewController.swift b/suixinkan/UI/DroneDock/DroneMaterialsViewController.swift new file mode 100644 index 0000000..d69fa19 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneMaterialsViewController.swift @@ -0,0 +1,524 @@ +import SnapKit +import UIKit + +/// 素材库只提出导航请求,由机巢入口协调原素材预览与独立成片交付。 +@MainActor +protocol DroneMaterialsViewControllerDelegate: AnyObject { + /// 预览单项素材,保持素材库现有选择与下载批次。 + func materialsViewController(_ controller: DroneMaterialsViewController, didRequestPreview material: DroneMaterial) + /// 请求先选择交付方式;指定拍摄记录时保留点位预选,整批入口不猜测目标点位。 + func materialsViewController(_ controller: DroneMaterialsViewController, didRequestDelivery record: DroneMaterialRecord?) +} + +/// 订单素材库:按拍摄记录分组,支持点位筛选、独立预览选择与前台演示下载。 +@MainActor +final class DroneMaterialsViewController: BaseViewController { + /// 素材展示、选择与批次状态的来源。 + let viewModel: DroneMaterialsViewModel + /// 将跨页面操作交给机巢导航入口。 + weak var delegate: DroneMaterialsViewControllerDelegate? + + /// 订单、筛选和拍摄记录采用稳定分区标识,刷新时保留当前滚动位置。 + private enum Section: Hashable { + case order, filters, summary, record(String), message + } + + /// 网格和辅助单元的稳定身份,不将可变选择状态纳入 Diffable 标识。 + private enum Item: Hashable { + case order, filter(String?), context, summary, material(String), message + } + + /// 底部主按钮当前对应的操作;启用规则由 ViewModel 提供。 + private enum FooterAction { + case download, resume, retry, selectMore, permission, none + } + + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let footerView = DroneMaterialsFooterView() + private let refreshControl = UIRefreshControl() + private let transferDriver = DroneMaterialDemoTransferDriver() + private var footerAction: FooterAction = .download + private var recordsByID: [String: DroneMaterialRecord] = [:] + private var materialsByID: [String: DroneMaterial] = [:] + private var originalInteractivePopEnabled: Bool? + + private var hasRunningDownload: Bool { + switch viewModel.downloadPhase { + case .downloading, .awaitingSave, .saving: true + default: false + } + } + + /// 使用入口共享的素材状态,支持订单全量入口与当前任务点位入口。 + init(viewModel: DroneMaterialsViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 返回素材页只刷新快照,不自动继续已暂停的批次。 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + refreshOrderSummary() + } + + /// 成片弹层关闭后更新订单摘要,保留原素材选择与下载批次。 + func refreshOrderSummary() { + viewModel.refresh() + if dataSource != nil { applySnapshot(animated: false) } + } + + /// 真正返回上层页面时停止未完成项;全屏预览覆盖素材页不触发离页处理。 + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + if isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true { + transferDriver.stop() + viewModel.leavePage() + restoreInteractivePopGesture() + } + } + + override func setupNavigationBar() { + title = "订单素材库 · 演示" + navigationItem.backButtonDisplayMode = .minimal + let back = UIBarButtonItem(image: UIImage(systemName: "chevron.left"), style: .plain, + target: self, action: #selector(backTapped)) + back.accessibilityIdentifier = "drone.materials.back" + back.accessibilityLabel = "返回" + navigationItem.leftBarButtonItem = back + let refresh = UIBarButtonItem(title: "刷新", style: .plain, + target: self, action: #selector(refreshTapped)) + refresh.accessibilityIdentifier = "drone.materials.refresh" + refresh.accessibilityLabel = "刷新素材状态" + #if DEBUG + let scenarios = DroneMaterialsScenario.allCases.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in + guard let self else { return } + self.transferDriver.stop() + self.viewModel.applyScenario(scenario) + self.applySnapshot(animated: true) + } + } + let advance = UIAction(title: "模拟下一项下载回执", image: UIImage(systemName: "arrow.forward.circle")) { [weak self] _ in + guard let self else { return } + self.transferDriver.stop() + self.viewModel.advanceDemoDownload() + self.applySnapshot(animated: true) + } + let allowPermission = UIAction(title: "模拟相册权限恢复", image: UIImage(systemName: "lock.open")) { [weak self] _ in + guard let self, self.viewModel.photoPermission != .allowed else { return } + self.transferDriver.stop() + self.viewModel.setPhotoPermission(.allowed) + self.applySnapshot(animated: true) + self.showToast("演示权限已恢复,请手动继续下载") + } + let menu = UIMenu(title: "素材库本地演示状态", children: [ + UIMenu(options: .displayInline, children: scenarios), + UIMenu(options: .displayInline, children: [advance, allowPermission]) + ]) + let debug = UIBarButtonItem(image: UIImage(systemName: "slider.horizontal.3"), menu: menu) + debug.accessibilityIdentifier = "drone.materials.scenarios" + debug.accessibilityLabel = "素材库演示状态" + navigationItem.rightBarButtonItems = [refresh, debug] + #else + navigationItem.rightBarButtonItem = refresh + #endif + } + + override func setupUI() { + view.backgroundColor = .white + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = false + collectionView.accessibilityIdentifier = "drone.materials.list" + collectionView.delegate = self + collectionView.register(DroneMaterialOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DroneMaterialFilterCell.self, forCellWithReuseIdentifier: "filter") + collectionView.register(DroneMaterialPointContextCell.self, forCellWithReuseIdentifier: "context") + collectionView.register(DroneMaterialSelectionCell.self, forCellWithReuseIdentifier: "summary") + collectionView.register(DroneMaterialCell.self, forCellWithReuseIdentifier: "material") + collectionView.register(DroneMaterialMessageCell.self, forCellWithReuseIdentifier: "message") + collectionView.register(DroneMaterialRecordHeaderView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: "recordHeader") + collectionView.register(DroneMaterialSeparatorView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, + withReuseIdentifier: "separator") + refreshControl.tintColor = DroneDockStyle.primary + collectionView.refreshControl = refreshControl + view.addSubview(collectionView) + view.addSubview(footerView) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + refreshControl.addTarget(self, action: #selector(refreshTapped), for: .valueChanged) + footerView.onPrimaryTap = { [weak self] in self?.performFooterAction() } + footerView.onSecondaryTap = { [weak self] in + guard let self else { return } + if self.viewModel.downloadPhase == .completed { + self.chooseCompletedDelivery() + return + } + self.viewModel.clearBatch() + self.applySnapshot(animated: true) + } + NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), + name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] sectionIndex, environment in + guard let self, let dataSource = self.dataSource else { return nil } + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(sectionIndex) else { return nil } + let section = sections[sectionIndex] + switch section { + case .record: + let width = (environment.container.effectiveContentSize.width - 44) / 2 + let height = width * 0.57 + 51 + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(0.5), heightDimension: .fractionalHeight(1) + )) + let group = NSCollectionLayoutGroup.horizontal( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(height)), + repeatingSubitem: item, count: 2 + ) + group.interItemSpacing = .fixed(12) + let layoutSection = NSCollectionLayoutSection(group: group) + layoutSection.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 20, trailing: 16) + layoutSection.interGroupSpacing = 12 + layoutSection.boundarySupplementaryItems = [ + NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(80)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top + ), + NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(1)), + elementKind: UICollectionView.elementKindSectionFooter, alignment: .bottom + ) + ] + return layoutSection + case .order: + return self.singleColumnSection(height: .estimated(116)) + case .filters: + if self.viewModel.pointID != nil { return self.singleColumnSection(height: .absolute(46)) } + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1), heightDimension: .fractionalHeight(1) + )) + let group = NSCollectionLayoutGroup.horizontal( + layoutSize: NSCollectionLayoutSize(widthDimension: .absolute(90), heightDimension: .absolute(36)), + subitems: [item] + ) + let layoutSection = NSCollectionLayoutSection(group: group) + layoutSection.orthogonalScrollingBehavior = .continuous + layoutSection.interGroupSpacing = 9 + layoutSection.contentInsets = NSDirectionalEdgeInsets(top: 6, leading: 16, bottom: 8, trailing: 16) + return layoutSection + case .summary: + return self.singleColumnSection(height: .absolute(46)) + case .message: + return self.singleColumnSection(height: .absolute(250)) + } + } + } + + private func singleColumnSection(height: NSCollectionLayoutDimension) -> NSCollectionLayoutSection { + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1), heightDimension: height + )) + let group = NSCollectionLayoutGroup.vertical( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: height), subitems: [item] + ) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16) + return section + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, indexPath, item in + guard let self else { return nil } + switch item { + case .order: + let cell = list.dequeueReusableCell(withReuseIdentifier: "order", for: indexPath) as! DroneMaterialOrderCell + cell.apply(order: self.viewModel.order) + return cell + case .filter(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "filter", for: indexPath) as! DroneMaterialFilterCell + if let filter = self.viewModel.filters.first(where: { $0.id == id }) { + cell.apply(title: filter.title, id: filter.id, + selected: filter.id == self.viewModel.selectedFilterID, locked: self.viewModel.isSelectionLocked) + } + return cell + case .context: + let cell = list.dequeueReusableCell(withReuseIdentifier: "context", for: indexPath) as! DroneMaterialPointContextCell + let title = self.viewModel.filters.first(where: { $0.id == self.viewModel.pointID })?.title + ?? self.viewModel.sections.first?.pointName ?? "当前拍摄点" + cell.apply(title: title) + return cell + case .summary: + let cell = list.dequeueReusableCell(withReuseIdentifier: "summary", for: indexPath) as! DroneMaterialSelectionCell + cell.apply(recordCount: self.viewModel.sections.count, allSelected: self.viewModel.isAllSelected, + enabled: !self.viewModel.isSelectionLocked && !self.viewModel.downloadableIDs.isEmpty) + cell.onSelectAllTap = { [weak self] in + guard let self else { return } + self.viewModel.selectAll() + self.applySnapshot(animated: true) + } + return cell + case .material(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "material", for: indexPath) as! DroneMaterialCell + if let material = self.materialsByID[id] { + let completed: Bool + if case .completed = material.downloadState { completed = true } else { completed = false } + cell.apply(material: material, selected: self.viewModel.selectedIDs.contains(id), + selectionEnabled: !self.viewModel.isSelectionLocked && self.viewModel.downloadableIDs.contains(id), + completed: completed) + cell.onPreviewTap = { [weak self] in + guard let self, let current = self.viewModel.material(id: id), current.canPreview else { return } + self.delegate?.materialsViewController(self, didRequestPreview: current) + } + cell.onSelectionTap = { [weak self] in + guard let self else { return } + self.viewModel.toggleSelection(id: id) + self.applySnapshot(animated: true) + } + } + return cell + case .message: + let cell = list.dequeueReusableCell(withReuseIdentifier: "message", for: indexPath) as! DroneMaterialMessageCell + switch self.viewModel.listState { + case .loading: + cell.apply(title: "正在获取素材", detail: "请稍候", symbol: "arrow.triangle.2.circlepath") + case .failed(let message): + cell.apply(title: "素材加载失败", detail: "\(message)\n请下拉或点击右上角刷新", symbol: "wifi.exclamationmark") + case .loaded: + cell.apply(title: "暂无拍摄素材", detail: "拍摄完成后的素材会显示在这里", symbol: "photo.on.rectangle.angled") + } + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] list, kind, indexPath in + guard let self else { return nil } + if kind == UICollectionView.elementKindSectionFooter { + return list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "separator", for: indexPath) + } + let header = list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "recordHeader", for: indexPath) as! DroneMaterialRecordHeaderView + self.applyHeader(header, sectionIndex: indexPath.section) + return header + } + } + + private func applySnapshot(animated: Bool) { + guard isViewLoaded, dataSource != nil else { return } + let records = viewModel.sections + recordsByID = Dictionary(uniqueKeysWithValues: records.map { ($0.id, $0) }) + materialsByID = Dictionary(uniqueKeysWithValues: records.flatMap(\.materials).map { ($0.id, $0) }) + let previous = dataSource.snapshot() + let existing = Set(previous.itemIdentifiers) + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.order, .filters, .summary]) + snapshot.appendItems([.order], toSection: .order) + snapshot.appendItems(viewModel.pointID == nil ? viewModel.filters.map { .filter($0.id) } : [.context], toSection: .filters) + snapshot.appendItems([.summary], toSection: .summary) + switch viewModel.listState { + case .loaded where !records.isEmpty: + for record in records { + let section = Section.record(record.id) + snapshot.appendSections([section]) + snapshot.appendItems(record.materials.map { .material($0.id) }, toSection: section) + } + default: + snapshot.appendSections([.message]) + snapshot.appendItems([.message], toSection: .message) + } + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existing.contains($0) }) + applyFooter() + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + guard let self else { return } + let kind = UICollectionView.elementKindSectionHeader + for path in self.collectionView.indexPathsForVisibleSupplementaryElements(ofKind: kind) { + guard let header = self.collectionView.supplementaryView(forElementKind: kind, at: path) as? DroneMaterialRecordHeaderView else { continue } + self.applyHeader(header, sectionIndex: path.section) + } + } + if previous.sectionIdentifiers != snapshot.sectionIdentifiers { collectionView.collectionViewLayout.invalidateLayout() } + updateInteractivePopGesture() + } + + private func applyHeader(_ header: DroneMaterialRecordHeaderView, sectionIndex: Int) { + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(sectionIndex), case .record(let id) = sections[sectionIndex], let record = recordsByID[id] else { return } + header.apply(record: record) + header.onDeliveryTap = { [weak self] in + guard let self, let current = self.recordsByID[id] else { return } + self.delegate?.materialsViewController(self, didRequestDelivery: current) + } + } + + private func applyFooter() { + if viewModel.photoPermission != .allowed { + footerAction = .permission + footerView.apply(title: "无法保存到手机相册", detail: "演示相册权限未开启,恢复后请手动继续。", + primaryTitle: "检查相册权限", primarySymbol: "lock", enabled: true, + identifier: "drone.materials.permission", progress: nil, tone: .blue, resultSymbol: "lock") + return + } + switch viewModel.downloadPhase { + case .idle: + footerAction = .download + footerView.apply(title: "已选择\(viewModel.selectedCount)项", detail: "", + primaryTitle: "下载所选素材", primarySymbol: "arrow.down.to.line", enabled: viewModel.canStartDownload, + identifier: "drone.materials.download", progress: nil, trailingText: "仅可选择已上传素材") + case .downloading, .awaitingSave, .saving: + footerAction = .none + footerView.apply(title: "本次下载\(viewModel.batchTotalCount)项", + detail: "请保持本页开启,下载期间不可更改选择", + primaryTitle: viewModel.downloadButtonTitle, primarySymbol: "arrow.triangle.2.circlepath", enabled: false, + identifier: "drone.materials.download", progress: viewModel.batchProgress, tone: .blue, + trailingText: "已完成\(viewModel.completedCount)/\(viewModel.batchTotalCount)项") + case .paused: + footerAction = .resume + footerView.apply(title: "下载已暂停", + detail: "已完成项会保留;继续时仅处理未完成文件。", + primaryTitle: "继续下载", primarySymbol: "play.fill", enabled: true, + identifier: "drone.materials.continue", progress: viewModel.batchProgress, tone: .orange, + trailingText: "已完成\(viewModel.completedCount)/\(viewModel.batchTotalCount)项", resultSymbol: "pause.circle") + case .partialFailure: + footerAction = .retry + footerView.apply(title: "部分素材下载失败", detail: "演示成功\(viewModel.completedCount)项 · 失败\(viewModel.failedCount)项,已完成的无需重复下载", + primaryTitle: "重试失败素材(\(viewModel.failedCount))", primarySymbol: "arrow.clockwise", enabled: viewModel.failedCount > 0, + identifier: "drone.materials.retry", progress: nil, secondaryTitle: "选择其他素材", tone: .orange, + resultSymbol: "exclamationmark.triangle") + case .completed: + footerAction = .selectMore + footerView.apply(title: "本次素材下载完成(演示)", detail: "\(viewModel.completedCount)项演示完成,未写入系统相册", + primaryTitle: "继续选择素材", primarySymbol: "", enabled: true, + identifier: "drone.materials.continueSelecting", progress: nil, secondaryTitle: "交付成片", tone: .green, + resultSymbol: "checkmark.circle", secondaryOutlined: true, secondaryEnabled: delegate != nil) + } + } + + private func performFooterAction() { + var shouldStartDriver = false + switch footerAction { + case .download: + shouldStartDriver = viewModel.startDownload() + case .resume: + shouldStartDriver = viewModel.continueDownload() + case .retry: + shouldStartDriver = viewModel.retryFailed() + case .selectMore: + viewModel.clearBatch() + case .permission: + showPermissionSimulation() + case .none: + return + } + applySnapshot(animated: true) + if shouldStartDriver { startDemoTransfer() } + } + + private func startDemoTransfer() { + guard let batch = viewModel.batch, !batch.isPaused else { return } + transferDriver.start(viewModel: viewModel) { [weak self] in self?.applySnapshot(animated: true) } + } + + /// 权限说明与恢复只作用于演示状态,不打开系统设置或请求真实 Photos 授权。 + private func showPermissionSimulation() { + let alert = UIAlertController(title: "无法保存到手机相册", + message: "相册权限未开启。当前为本地演示,不读取或修改系统相册权限;模拟恢复后请手动继续下载。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "暂不下载", style: .cancel)) + alert.addAction(UIAlertAction(title: "模拟恢复权限", style: .default) { [weak self] _ in + guard let self else { return } + self.viewModel.setPhotoPermission(.allowed) + self.applySnapshot(animated: true) + }) + present(alert, animated: true) + } + + /// 完成底栏也先选交付方式;多记录批次在选择云端后再由用户选点位。 + private func chooseCompletedDelivery() { + guard delegate != nil, !viewModel.sections.isEmpty else { return } + let record = viewModel.sections.count == 1 ? viewModel.sections.first : nil + delegate?.materialsViewController(self, didRequestDelivery: record) + } + + private func updateInteractivePopGesture() { + guard let gesture = navigationController?.interactivePopGestureRecognizer else { return } + if hasRunningDownload { + if originalInteractivePopEnabled == nil { originalInteractivePopEnabled = gesture.isEnabled } + gesture.isEnabled = false + } else { + restoreInteractivePopGesture() + } + } + + private func restoreInteractivePopGesture() { + guard let originalInteractivePopEnabled else { return } + navigationController?.interactivePopGestureRecognizer?.isEnabled = originalInteractivePopEnabled + self.originalInteractivePopEnabled = nil + } + + private func leaveMaterialsPage() { + transferDriver.stop() + viewModel.leavePage() + restoreInteractivePopGesture() + if let navigationController, navigationController.viewControllers.first !== self { + navigationController.popViewController(animated: true) + } else { + dismiss(animated: true) + } + } + + @objc private func backTapped() { + guard hasRunningDownload else { leaveMaterialsPage(); return } + let alert = UIAlertController(title: "素材仍在下载", + message: "离开将暂停未完成的下载,已完成项会保留。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "继续下载", style: .cancel)) + alert.addAction(UIAlertAction(title: "离开并暂停", style: .default) { [weak self] _ in self?.leaveMaterialsPage() }) + present(alert, animated: true) + } + + @objc private func refreshTapped() { + viewModel.refresh() + applySnapshot(animated: true) + refreshControl.endRefreshing() + } + + @objc private func applicationWillResignActive() { + transferDriver.stop() + viewModel.pauseDownloads(reason: .background) + if isViewLoaded { applySnapshot(animated: false) } + } + + @objc private func applicationDidBecomeActive() { + viewModel.refresh() + if isViewLoaded { applySnapshot(animated: false) } + } +} + +extension DroneMaterialsViewController: UICollectionViewDelegate { + /// 点位标签整项可点,素材的预览与选择交由各自按钮处理。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard let item = dataSource.itemIdentifier(for: indexPath), case .filter(let id) = item else { return } + viewModel.selectFilter(id: id) + applySnapshot(animated: true) + } +} diff --git a/suixinkan/UI/DroneDock/DronePreparationComponents.swift b/suixinkan/UI/DroneDock/DronePreparationComponents.swift new file mode 100644 index 0000000..960dde9 --- /dev/null +++ b/suixinkan/UI/DroneDock/DronePreparationComponents.swift @@ -0,0 +1,594 @@ +import Kingfisher +import SnapKit +import UIKit + +/// 准备页顶部订单额度摘要,成功次数与剩余次数分别展示。 +@MainActor +final class DronePreparationOrderCell: UICollectionViewCell { + private let customerLabel = DroneDockStyle.label(size: 18, weight: .semibold) + private let packageLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + private let completedLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let remainingLabel = UILabel() + + override init(frame: CGRect) { + super.init(frame: frame) + let separator = UIView() + separator.backgroundColor = DroneDockStyle.border + [customerLabel, packageLabel, completedLabel, remainingLabel, separator].forEach(contentView.addSubview) + customerLabel.adjustsFontSizeToFitWidth = true + customerLabel.minimumScaleFactor = 0.8 + customerLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(18) + make.leading.equalToSuperview().offset(4) + make.trailing.lessThanOrEqualTo(separator.snp.leading).offset(-12) + } + packageLabel.snp.makeConstraints { make in + make.top.equalTo(customerLabel.snp.bottom).offset(8) + make.leading.equalTo(customerLabel) + make.trailing.lessThanOrEqualTo(separator.snp.leading).offset(-12) + make.bottom.equalToSuperview().inset(14) + } + packageLabel.numberOfLines = 2 + separator.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(94) + make.centerY.equalToSuperview() + make.width.equalTo(1 / UIScreen.main.scale) + make.height.equalTo(54) + } + completedLabel.snp.makeConstraints { make in + make.leading.equalTo(separator.snp.trailing).offset(16) + make.top.equalTo(customerLabel) + make.trailing.lessThanOrEqualToSuperview() + } + remainingLabel.snp.makeConstraints { make in + make.leading.equalTo(completedLabel) + make.top.equalTo(completedLabel.snp.bottom).offset(3) + make.trailing.lessThanOrEqualToSuperview() + } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 使用订单的权威计数填充摘要,不在视图层扣减额度。 + func apply(order: DroneShootingOrder?) { + guard let order else { + customerLabel.text = "订单信息暂不可用" + packageLabel.text = "请返回订单列表重新进入" + completedLabel.text = "已拍摄 — 次" + remainingLabel.attributedText = remainingText("—") + accessibilityLabel = "订单信息暂不可用" + return + } + customerLabel.text = order.customerName + packageLabel.text = "含 \(order.totalShootingCount) 次拍摄" + completedLabel.text = "已拍摄 \(order.successfulShootingCount) 次" + remainingLabel.attributedText = remainingText(String(order.remainingShootingCount)) + accessibilityLabel = "\(order.customerName),含\(order.totalShootingCount)次拍摄,已拍摄\(order.successfulShootingCount)次,剩余\(order.remainingShootingCount)次" + } + + /// 使用 project-info 的最新购买摘要;缺失次数不回退旧订单或 workbench 统计。 + func apply(homeOrder: DroneDockHomeOrder, summary: DroneDockHomeOrder?, usesHomeSnapshot: Bool = false) { + let snapshot = usesHomeSnapshot ? homeOrder : summary + let total = snapshot?.shotTotal + let used = snapshot?.shotUsed + let remaining = snapshot?.shotRemain + let package = snapshot?.packageName + let tourist = summary?.touristTitle ?? homeOrder.touristTitle + customerLabel.text = tourist + packageLabel.text = package?.isEmpty == false ? package : "含 \(total.map(String.init) ?? "—") 次拍摄" + completedLabel.text = "已拍摄 \(used.map(String.init) ?? "—") 次" + remainingLabel.attributedText = remainingText(remaining.map(String.init) ?? "—") + accessibilityLabel = "\(tourist),\(packageLabel.text ?? ""),已拍摄\(used.map(String.init) ?? "—")次,剩余\(remaining.map(String.init) ?? "—")次" + accessibilityIdentifier = "drone.preparation.order" + } + + private func remainingText(_ value: String) -> NSAttributedString { + let text = NSMutableAttributedString(string: "剩余 ", attributes: [.font: UIFont.systemFont(ofSize: 12), .foregroundColor: DroneDockStyle.secondary]) + text.append(NSAttributedString(string: value, attributes: [.font: UIFont.systemFont(ofSize: 26, weight: .medium), .foregroundColor: DroneDockStyle.primary])) + text.append(NSAttributedString(string: " 次", attributes: [.font: UIFont.systemFont(ofSize: 12), .foregroundColor: DroneDockStyle.secondary])) + return text + } +} + +/// 横向点位小卡,展示点位与拍摄记录,真实数据缺图时使用中性占位。 +@MainActor +final class DronePreparationPointCell: UICollectionViewCell { + private let nameLabel = DroneDockStyle.label(size: 13, weight: .semibold) + private let countLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let thumbnail = UIImageView() + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.layer.cornerRadius = 7 + contentView.layer.borderWidth = 1 + contentView.layer.cornerCurve = .continuous + thumbnail.contentMode = .scaleAspectFill + thumbnail.backgroundColor = DroneDockStyle.background + thumbnail.layer.cornerRadius = 5 + thumbnail.clipsToBounds = true + thumbnail.accessibilityIdentifier = "drone.preparation.point.cover" + nameLabel.numberOfLines = 0 + nameLabel.lineBreakMode = .byWordWrapping + nameLabel.accessibilityIdentifier = "drone.preparation.point.name" + let labels = UIStackView(arrangedSubviews: [nameLabel, countLabel]) + labels.axis = .vertical + labels.spacing = 6 + [thumbnail, labels].forEach(contentView.addSubview) + thumbnail.snp.makeConstraints { make in + make.leading.equalToSuperview().offset(8) + make.centerY.equalToSuperview() + make.size.equalTo(48) + } + labels.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.top.greaterThanOrEqualToSuperview().offset(8) + make.bottom.lessThanOrEqualToSuperview().inset(8) + make.leading.equalTo(thumbnail.snp.trailing).offset(8) + make.trailing.equalToSuperview().inset(8) + } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 横向同组卡片采用最长名称所需的高度,名称完整换行且不压缩字号。 + static func preferredHeight(names: [String], width: CGFloat) -> CGFloat { + let label = DroneDockStyle.label(size: 13, weight: .semibold) + label.numberOfLines = 0 + let nameWidth = max(1, width - 72) + let nameHeight = names.map { name -> CGFloat in + label.text = name + return label.sizeThatFits(CGSize(width: nameWidth, height: .greatestFiniteMagnitude)).height + }.max() ?? 0 + return max(64, ceil(nameHeight) + 6 + ceil(UIFont.systemFont(ofSize: 11).lineHeight) + 16) + } + + /// 展示点位名称与次数,已拍摄的点位仍保持可选择。 + func apply(point: DroneShootingPoint, selected: Bool) { + thumbnail.kf.cancelDownloadTask() + thumbnail.kf.setImage(with: nil as URL?) + contentView.alpha = 1 + nameLabel.text = point.name + thumbnail.contentMode = .scaleAspectFill + thumbnail.image = UIImage(named: point.id == "point-jinque" ? "drone_demo_pagoda" : "drone_demo_mountain") + countLabel.text = point.successfulCountText + contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.07) : .white + contentView.layer.borderColor = (selected ? DroneDockStyle.primary : DroneDockStyle.border).cgColor + accessibilityLabel = "\(point.name),\(point.successfulCountText)" + accessibilityTraits = selected ? [.button, .selected] : .button + accessibilityIdentifier = "drone.preparation.point.\(point.id)" + } + + /// 展示已购点位与可用性;无拍摄记录时显示“未拍摄”。 + func apply(spot: DroneDockPurchasedSpot, selected: Bool) { + nameLabel.text = spot.name + thumbnail.kf.cancelDownloadTask() + let coverURL = spot.displayCoverURL + thumbnail.contentMode = coverURL == nil ? .center : .scaleAspectFill + thumbnail.tintColor = DroneDockStyle.secondary + // nil 也交给 Kingfisher,撤销旧图片标识,防止复用后的迟到结果覆盖占位图。 + thumbnail.kf.setImage(with: coverURL, placeholder: UIImage(systemName: "photo")) + if spot.available != true { + countLabel.text = spot.available == false ? "拍摄点不可用" : "可用性待确认" + } else { + countLabel.text = "未拍摄" + } + contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.07) : .white + contentView.layer.borderColor = (selected ? DroneDockStyle.primary : DroneDockStyle.border).cgColor + contentView.alpha = spot.available == true ? 1 : 0.55 + accessibilityLabel = "\(spot.name),\(countLabel.text ?? "")" + accessibilityTraits = selected ? [.button, .selected] : .button + if spot.available != true { accessibilityTraits.insert(.notEnabled) } + accessibilityIdentifier = "drone.preparation.point.\(spot.id)" + } + + override func prepareForReuse() { + super.prepareForReuse() + thumbnail.kf.cancelDownloadTask() + thumbnail.kf.setImage(with: nil as URL?) + } +} + +/// 纵向单选航线行,点击整行后由 ViewModel 保留有效选择。 +@MainActor +final class DronePreparationRouteCell: UICollectionViewCell { + private let nameLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let unavailableLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let routeIcon = DronePreparationRouteIconView() + private let checkmark = UIImageView() + private let separator = UIView() + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.layer.cornerRadius = 8 + contentView.layer.cornerCurve = .continuous + checkmark.contentMode = .scaleAspectFit + separator.backgroundColor = DroneDockStyle.border + nameLabel.numberOfLines = 0 + unavailableLabel.numberOfLines = 0 + unavailableLabel.isHidden = true + let labels = UIStackView(arrangedSubviews: [nameLabel, unavailableLabel]) + labels.axis = .vertical + labels.spacing = 5 + [routeIcon, labels, checkmark, separator].forEach(contentView.addSubview) + routeIcon.snp.makeConstraints { make in + make.leading.equalToSuperview().offset(12) + make.centerY.equalToSuperview() + make.size.equalTo(40) + } + labels.snp.makeConstraints { make in + make.leading.equalTo(routeIcon.snp.trailing).offset(14) + make.centerY.equalToSuperview() + make.top.greaterThanOrEqualToSuperview().offset(12) + make.bottom.lessThanOrEqualToSuperview().inset(12) + make.trailing.equalTo(checkmark.snp.leading).offset(-12) + } + checkmark.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(14) + make.centerY.equalToSuperview() + make.size.equalTo(24) + } + separator.snp.makeConstraints { make in + make.leading.trailing.bottom.equalToSuperview() + make.height.equalTo(1 / UIScreen.main.scale) + } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 航线原因允许换行,自适应高度时保持列表提供的整行宽度。 + override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { + let width = layoutAttributes.size.width + let attributes = layoutAttributes.copy() as! UICollectionViewLayoutAttributes + let size = contentView.systemLayoutSizeFitting( + CGSize(width: width, height: 0), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + attributes.size = CGSize(width: width, height: max(64, ceil(size.height))) + return attributes + } + + /// 选中样式仅反映现有选择,重复点击不会在视图中取消单选。 + func apply(route: DroneShootingRoute, selected: Bool) { + unavailableLabel.isHidden = true + contentView.alpha = 1 + nameLabel.text = route.name + nameLabel.textColor = selected ? DroneDockStyle.primary : DroneDockStyle.text + routeIcon.apply(selected: selected) + checkmark.image = UIImage(systemName: selected ? "checkmark.circle.fill" : "circle") + checkmark.tintColor = selected ? DroneDockStyle.primary : UIColor(hex: 0xA4ABB8) + contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.08) : .white + separator.isHidden = selected + accessibilityLabel = route.name + accessibilityTraits = selected ? [.button, .selected] : .button + accessibilityIdentifier = "drone.preparation.route.\(route.id)" + } + + /// 展示当前真实点位的航线选择,不从行点击发起任何飞行操作。 + func apply(route: DroneDockPurchasedAirLine, selected: Bool) { + nameLabel.text = route.name + let reason = route.available == false + ? DroneDockHomeMetric.usableText(route.unavailableReason) ?? "航线暂不可用" + : "可用性待确认" + unavailableLabel.text = reason + unavailableLabel.isHidden = route.available == true + contentView.alpha = route.available == true ? 1 : 0.55 + nameLabel.textColor = selected ? DroneDockStyle.primary : DroneDockStyle.text + routeIcon.apply(selected: selected) + checkmark.image = UIImage(systemName: selected ? "checkmark.circle.fill" : "circle") + checkmark.tintColor = selected ? DroneDockStyle.primary : UIColor(hex: 0xA4ABB8) + contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.08) : .white + separator.isHidden = selected + accessibilityLabel = route.available == true ? route.name : "\(route.name),\(reason)" + accessibilityTraits = selected ? [.button, .selected] : .button + if route.available != true { accessibilityTraits.insert(.notEnabled) } + accessibilityIdentifier = "drone.preparation.route.\(route.id)" + } +} + +/// 源码绘制的小航线图标,不依赖远程图片和拍摄素材。 +@MainActor +final class DronePreparationRouteIconView: UIView { + private var lineColor = DroneDockStyle.secondary + + override init(frame: CGRect) { + super.init(frame: frame) + layer.cornerRadius = 10 + backgroundColor = UIColor(hex: 0xF0F2F6) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 图标跟随航线选中态使用统一主色。 + func apply(selected: Bool) { + lineColor = selected ? DroneDockStyle.primary : UIColor(hex: 0x697487) + backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.07) : UIColor(hex: 0xF0F2F6) + setNeedsDisplay() + } + + override func draw(_ rect: CGRect) { + let scale = min(rect.width, rect.height) / 40 + guard let context = UIGraphicsGetCurrentContext() else { return } + context.saveGState() + context.scaleBy(x: scale, y: scale) + lineColor.setStroke() + let path = UIBezierPath() + path.move(to: CGPoint(x: 22, y: 11)) + path.addLine(to: CGPoint(x: 16, y: 11)) + path.addCurve(to: CGPoint(x: 16, y: 20), controlPoint1: CGPoint(x: 8, y: 11), controlPoint2: CGPoint(x: 8, y: 20)) + path.addLine(to: CGPoint(x: 24, y: 20)) + path.addCurve(to: CGPoint(x: 24, y: 29), controlPoint1: CGPoint(x: 32, y: 20), controlPoint2: CGPoint(x: 32, y: 29)) + path.addLine(to: CGPoint(x: 18, y: 29)) + path.lineWidth = 1.8 + path.lineCapStyle = .round + path.stroke() + UIBezierPath(ovalIn: CGRect(x: 25, y: 8, width: 5, height: 5)).stroke() + UIBezierPath(ovalIn: CGRect(x: 10, y: 26, width: 5, height: 5)).stroke() + context.restoreGState() + } +} + +/// 点位与航线分区标题,数量来自当前点位的实际航线配置。 +@MainActor +final class DronePreparationHeadingView: UICollectionReusableView { + private let titleLabel = DroneDockStyle.label(size: 18, weight: .semibold) + private let detailLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + let stack = UIStackView(arrangedSubviews: [titleLabel, detailLabel, UIView()]) + stack.axis = .horizontal + stack.alignment = .firstBaseline + stack.spacing = 12 + titleLabel.numberOfLines = 0 + titleLabel.accessibilityIdentifier = "drone.preparation.heading.title" + addSubview(stack) + stack.snp.makeConstraints { make in + make.leading.equalToSuperview().offset(4) + make.trailing.equalToSuperview() + make.centerY.equalToSuperview().offset(3) + } + titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + detailLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + accessibilityTraits = .header + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 分开展示标题与较浅的航线数量。 + func apply(title: String, detail: String?) { + titleLabel.text = title + detailLabel.text = detail + detailLabel.isHidden = detail == nil + accessibilityLabel = [title, detail].compactMap { $0 }.joined(separator: ",") + } + + /// 为长点位名称预留完整标题高度,右侧航线数量保持可见。 + static func preferredHeight(title: String, detail: String, width: CGFloat) -> CGFloat { + let label = DroneDockStyle.label(size: 18, weight: .semibold) + label.numberOfLines = 0 + label.text = title + let detailWidth = (detail as NSString).size(withAttributes: [.font: UIFont.systemFont(ofSize: 13)]).width + let titleWidth = max(1, width - 4 - ceil(detailWidth) - 24) + return max(64, ceil(label.sizeThatFits(CGSize(width: titleWidth, height: .greatestFiniteMagnitude)).height) + 26) + } +} + +/// 无点位或无航线时保留就地提示,不增加额外的选择弹窗。 +@MainActor +final class DronePreparationEmptyCell: UICollectionViewCell { + private let titleLabel = DroneDockStyle.label(size: 15, weight: .medium, color: UIColor(hex: 0x697487)) + private let detailLabel = DroneDockStyle.label(size: 13, color: DroneDockStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + let icon = DronePreparationRouteIconView() + icon.backgroundColor = .clear + let stack = UIStackView(arrangedSubviews: [icon, titleLabel, detailLabel]) + stack.axis = .vertical + stack.alignment = .center + stack.spacing = 14 + detailLabel.numberOfLines = 0 + detailLabel.textAlignment = .center + contentView.addSubview(stack) + icon.snp.makeConstraints { make in make.size.equalTo(36) } + stack.snp.makeConstraints { make in + make.centerY.equalToSuperview().offset(-8) + make.leading.trailing.equalToSuperview().inset(8) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 明确区分点位未配置与已选点位没有航线。 + func apply(isPointEmpty: Bool) { + titleLabel.text = isPointEmpty ? "暂无可用拍摄点" : "暂无可用航线" + detailLabel.text = isPointEmpty ? "当前景区尚未配置拍摄点" : "请选择其他拍摄点,或稍后重试" + } + + /// 展示真实页面的加载、失败或未配置状态,不将请求失败描述为空数据。 + func apply(title: String, detail: String) { + titleLabel.text = title + detailLabel.text = detail + } +} + +/// 固定底部许可栏,独立刷新连接、设备与主按钮。 +@MainActor +final class DronePreparationFooterView: UIView { + /// 工作人员主动点击主操作时通知控制器。 + var onPrimaryTap: (() -> Void)? + /// 结果待确认时由工作人员主动请求同步原召唤状态。 + var onRefreshTap: (() -> Void)? + + private let connectionLabel = DronePreparationIndicatorView() + private let selectionLabel = DroneDockStyle.label(size: 13, weight: .semibold) + private let deviceCaption = DroneDockStyle.label("无人机:", size: 11, color: DroneDockStyle.secondary) + private let deviceLabel = DroneDockStatusLabel() + private let primaryButton = UIButton(type: .system) + private let messageLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let refreshButton = UIButton(type: .system) + + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = .white + let divider = UIView() + divider.backgroundColor = DroneDockStyle.border + let deviceRow = UIStackView(arrangedSubviews: [deviceCaption, deviceLabel, UIView()]) + deviceLabel.accessibilityIdentifier = "drone.preparation.planeStatus" + deviceLabel.numberOfLines = 2 + deviceLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + deviceRow.axis = .horizontal + deviceRow.alignment = .center + deviceRow.spacing = 3 + let summary = UIStackView(arrangedSubviews: [selectionLabel, deviceRow]) + summary.axis = .vertical + summary.spacing = 7 + messageLabel.textAlignment = .center + messageLabel.numberOfLines = 2 + messageLabel.accessibilityIdentifier = "drone.preparation.admission" + refreshButton.setTitle("刷新状态", for: .normal) + refreshButton.setTitleColor(DroneDockStyle.primary, for: .normal) + refreshButton.titleLabel?.font = .systemFont(ofSize: 12, weight: .medium) + refreshButton.accessibilityIdentifier = "drone.preparation.refreshSummon" + refreshButton.addTarget(self, action: #selector(refreshTapped), for: .touchUpInside) + let messageRow = UIStackView(arrangedSubviews: [messageLabel, refreshButton]) + messageRow.axis = .horizontal + messageRow.alignment = .center + messageRow.spacing = 6 + primaryButton.layer.cornerRadius = 8 + primaryButton.layer.cornerCurve = .continuous + primaryButton.titleLabel?.font = .systemFont(ofSize: 13, weight: .medium) + primaryButton.titleLabel?.adjustsFontSizeToFitWidth = true + primaryButton.titleLabel?.minimumScaleFactor = 0.85 + primaryButton.accessibilityIdentifier = "drone.preparation.summon" + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + [connectionLabel, divider, summary, primaryButton, messageRow].forEach(addSubview) + connectionLabel.snp.makeConstraints { make in + make.leading.trailing.top.equalToSuperview() + make.height.equalTo(42) + } + divider.snp.makeConstraints { make in + make.top.equalTo(connectionLabel.snp.bottom) + make.leading.trailing.equalToSuperview() + make.height.equalTo(1 / UIScreen.main.scale) + } + summary.snp.makeConstraints { make in + make.leading.equalToSuperview().offset(20) + make.top.equalTo(divider.snp.bottom).offset(14) + make.trailing.equalTo(primaryButton.snp.leading).offset(-10) + } + primaryButton.snp.makeConstraints { make in + make.top.equalTo(divider.snp.bottom).offset(12) + make.trailing.equalToSuperview().inset(16) + make.width.equalTo(148) + make.height.equalTo(46) + } + refreshButton.snp.makeConstraints { make in + make.width.equalTo(62).priority(999) + make.height.equalTo(26) + } + messageRow.snp.makeConstraints { make in + make.top.equalTo(summary.snp.bottom).offset(10) + make.top.greaterThanOrEqualTo(primaryButton.snp.bottom).offset(9) + make.leading.trailing.equalToSuperview().inset(16) + make.bottom.equalTo(safeAreaLayoutGuide.snp.bottom).inset(10) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 只绑定 ViewModel 已计算的展示内容和许可,不按电量或连接自行判定可召唤。 + func apply(viewModel: DroneShootingPreparationViewModel) { + connectionLabel.apply(title: viewModel.connectionTitle, tone: viewModel.connectionTone) + selectionLabel.text = viewModel.selectionSummary + deviceLabel.apply(title: viewModel.deviceStatusText, tone: viewModel.deviceState.tone) + primaryButton.setTitle(viewModel.primaryButtonTitle, for: .normal) + primaryButton.isEnabled = viewModel.primaryButtonEnabled + primaryButton.backgroundColor = viewModel.primaryButtonEnabled ? DroneDockStyle.primary : UIColor(hex: 0xE1E7F0) + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(UIColor(hex: 0x8792A5), for: .disabled) + switch viewModel.admission { + case .outOfRange, .unknownRange: + messageLabel.text = "当前暂不可召唤,请稍后重试" + default: + messageLabel.text = viewModel.admission.message + } + messageLabel.textColor = DroneDockStyle.color(for: viewModel.admission.tone) + refreshButton.isHidden = !viewModel.shouldShowSummonRefresh + } + + /// 绑定准备页提交许可;模拟来源仅影响文案,不改变业务权限或真实传输保护。 + func apply(preparationViewModel viewModel: DroneDockPreparationViewModel, isRefreshing: Bool = false, + isLocalSimulation: Bool = false) { + connectionLabel.apply(title: viewModel.connectionTitle, tone: viewModel.connectionTone) + selectionLabel.text = viewModel.selectionSummary + selectionLabel.numberOfLines = 2 + deviceLabel.apply(title: viewModel.deviceStatusText, tone: viewModel.deviceTone) + let title = isLocalSimulation && viewModel.canCreateTask ? "确认并召唤(模拟)" : viewModel.primaryButtonTitle + primaryButton.setTitle(title, for: .normal) + primaryButton.isEnabled = (viewModel.isPrimaryActionEnabled || viewModel.canOpenShootingTask) && !isRefreshing + primaryButton.backgroundColor = primaryButton.isEnabled ? DroneDockStyle.primary : UIColor(hex: 0xE1E7F0) + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(UIColor(hex: 0x8792A5), for: .disabled) + if viewModel.isTaskSelectionLocked || viewModel.taskCreationErrorMessage != nil { + messageLabel.text = viewModel.admissionMessage + } else { + messageLabel.text = viewModel.planeStatusErrorMessage.map { "无人机状态获取失败:\($0)" } ?? viewModel.admissionMessage + } + if isLocalSimulation { + messageLabel.text = "本地模拟,不会向无人机发送指令\n" + (messageLabel.text ?? "") + } + messageLabel.textColor = DroneDockStyle.secondary + refreshButton.isHidden = false + refreshButton.isEnabled = !viewModel.isLoading && !viewModel.isCreatingTask && !viewModel.isSummoning && !isRefreshing + } + + @objc private func primaryTapped() { onPrimaryTap?() } + @objc private func refreshTapped() { onRefreshTap?() } +} + +/// 机巢连接的小型状态图标,图标只映射语义色。 +@MainActor +private final class DronePreparationIndicatorView: UIView { + private let icon = UIImageView() + private let label = DroneDockStyle.label(size: 13) + + override init(frame: CGRect) { + super.init(frame: frame) + let stack = UIStackView(arrangedSubviews: [icon, label]) + stack.axis = .horizontal + stack.alignment = .center + stack.spacing = 6 + icon.contentMode = .scaleAspectFit + addSubview(stack) + icon.snp.makeConstraints { make in make.size.equalTo(16) } + stack.snp.makeConstraints { make in + make.center.equalToSuperview() + make.leading.greaterThanOrEqualToSuperview().offset(5) + make.trailing.lessThanOrEqualToSuperview().inset(5) + } + isAccessibilityElement = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 绿色为已满足状态,其他语义色保留各自的提示。 + func apply(title: String, tone: DroneDockStatusTone) { + label.text = title + label.textColor = tone == .green ? DroneDockStyle.text : DroneDockStyle.color(for: tone) + icon.tintColor = DroneDockStyle.color(for: tone) + icon.image = UIImage(systemName: tone == .green ? "checkmark.circle.fill" : "exclamationmark.circle.fill") + accessibilityLabel = title + } +} diff --git a/suixinkan/UI/DroneDock/DroneShootingOrderCardView.swift b/suixinkan/UI/DroneDock/DroneShootingOrderCardView.swift new file mode 100644 index 0000000..c3f82b1 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneShootingOrderCardView.swift @@ -0,0 +1,458 @@ +import SnapKit +import UIKit + +/// 机巢工作台与拍摄订单共用的订单卡片,展示次数、任务状态与素材入口。 +final class DroneShootingOrderCardView: UIView { + + /// 用户点击开始、继续或查看当前任务时触发。 + var onShootingTap: (() -> Void)? + /// 用户点击素材入口时触发。 + var onMaterialsTap: (() -> Void)? + /// 用户点击交付入口时触发;具体交付业务由外部协调。 + var onDeliveryTap: (() -> Void)? + /// 用户点击整单游客确认或历史记录摘要时触发,与追加上传分开。 + var onConfirmationTap: (() -> Void)? + + private let contentStack = UIStackView() + private let customerLabel = UILabel() + private let statusContainer = UIView() + private let statusLabel = UILabel() + private let metadataLabel = UILabel() + private let packageLabel = UILabel() + private let countsLabel = UILabel() + private let remainingLabel = UILabel() + private let progressView = UIProgressView(progressViewStyle: .bar) + private let materialRow = UIStackView() + private let materialControl = UIControl() + private let materialTitleLabel = UILabel() + private let materialStateLabel = UILabel() + private let materialChevron = UIImageView(image: UIImage(systemName: "chevron.right")) + private let deliveryControl = UIControl() + private let deliveryTitleLabel = UILabel() + private let deliveryStateLabel = UILabel() + private let deliveryChevron = UIImageView(image: UIImage(systemName: "chevron.right")) + private let actionStack = UIStackView() + private let secondaryButton = UIButton(type: .system) + private let primaryButton = UIButton(type: .system) + private var displayedOrder: DroneShootingOrder? + private var displayedHomeOrder: DroneDockHomeOrder? + + /// 创建可以按内容自行撑高的白色圆角订单卡。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + /// 应用完整订单快照;卡片不推断或修改订单及任务状态。 + func apply(order: DroneShootingOrder) { + displayedOrder = order + displayedHomeOrder = nil + materialControl.isEnabled = true + materialControl.accessibilityIdentifier = nil + deliveryControl.isEnabled = true + deliveryChevron.isHidden = false + actionStack.isHidden = false + primaryButton.isHidden = false + primaryButton.isEnabled = true + primaryButton.backgroundColor = DroneDockStyle.primary + secondaryButton.isHidden = false + secondaryButton.isEnabled = true + customerLabel.text = order.customerName + metadataLabel.text = "\(order.orderNumber) · \(order.createdAtText)" + packageLabel.text = order.packageSummary + statusLabel.text = order.statusTitle + countsLabel.attributedText = countsText(order: order) + remainingLabel.attributedText = remainingText(order: order) + progressView.setProgress(Float(order.progress), animated: false) + progressView.accessibilityLabel = "已拍摄 \(order.successfulShootingCount) 次,共 \(order.totalShootingCount) 次" + applyStatusAppearance(tone: order.statusTone) + applyMaterialSummary(order: order) + applyActions(order: order) + accessibilityIdentifier = "drone.order.\(order.id)" + } + + /// 展示张工订单摘要中的真实字段和操作权限,不推导飞行任务或交付完成。 + func apply(homeOrder order: DroneDockHomeOrder) { + displayedOrder = nil + displayedHomeOrder = order + let identifier = "drone.orders.order.\(order.orderID)" + customerLabel.text = order.touristTitle + let createdAt = DroneDockHomeMetric.usableText(order.createdAt) ?? "创建时间待确认" + metadataLabel.text = "订单号 \(order.orderNumberText) · \(createdAt)" + packageLabel.text = order.packageTitle + statusLabel.text = order.statusTitle + applyStatusAppearance(tone: order.statusTone) + + let used = order.shotUsed.map(String.init) ?? "—" + let total = order.shotTotal.map(String.init) ?? "—" + let remaining = order.shotRemain.map(String.init) ?? "—" + countsLabel.attributedText = countText(prefix: "已拍摄 ", value: used, suffix: " / \(total) 次") + remainingLabel.attributedText = countText(prefix: "剩余 ", value: remaining, suffix: " 次") + if let used = order.shotUsed, let total = order.shotTotal, total > 0 { + progressView.setProgress(Float(min(Double(used) / Double(total), 1)), animated: false) + progressView.accessibilityLabel = "已拍摄 \(used) 次,共 \(total) 次" + } else { + progressView.setProgress(0, animated: false) + progressView.accessibilityLabel = "拍摄进度待确认" + } + applyRemoteSummary(order: order, identifier: identifier) + applyRemoteActions(order: order, identifier: identifier) + accessibilityIdentifier = identifier + } + + /// 清除复用卡片中的订单及所有动作,避免点击到上一笔订单。 + func resetForReuse() { + displayedOrder = nil + displayedHomeOrder = nil + onShootingTap = nil + onMaterialsTap = nil + onDeliveryTap = nil + onConfirmationTap = nil + } + + private func setupUI() { + DroneDockStyle.applyCard(to: self) + + contentStack.axis = .vertical + contentStack.spacing = 15 + addSubview(contentStack) + contentStack.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(16) + } + + customerLabel.font = .systemFont(ofSize: 18, weight: .bold) + customerLabel.textColor = UIColor(hex: 0x172033) + customerLabel.adjustsFontSizeToFitWidth = true + customerLabel.minimumScaleFactor = 0.85 + customerLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + customerLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + customerLabel.accessibilityTraits = .header + + statusLabel.font = .systemFont(ofSize: 11, weight: .medium) + statusLabel.setContentHuggingPriority(.required, for: .horizontal) + statusLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + statusContainer.layer.cornerRadius = 6 + statusContainer.addSubview(statusLabel) + statusLabel.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(UIEdgeInsets(top: 5, left: 8, bottom: 5, right: 8)) + } + + let header = UIStackView(arrangedSubviews: [customerLabel, statusContainer]) + header.axis = .horizontal + header.alignment = .center + header.spacing = 8 + contentStack.addArrangedSubview(header) + + metadataLabel.font = .systemFont(ofSize: 11) + metadataLabel.textColor = UIColor(hex: 0x8992A3) + metadataLabel.numberOfLines = 2 + contentStack.addArrangedSubview(metadataLabel) + contentStack.setCustomSpacing(17, after: metadataLabel) + + packageLabel.font = .systemFont(ofSize: 14) + packageLabel.textColor = UIColor(hex: 0x474D59) + packageLabel.numberOfLines = 0 + contentStack.addArrangedSubview(packageLabel) + + countsLabel.font = .systemFont(ofSize: 12) + remainingLabel.font = .systemFont(ofSize: 12) + remainingLabel.setContentHuggingPriority(.required, for: .horizontal) + let countsRow = UIStackView(arrangedSubviews: [countsLabel, remainingLabel]) + countsRow.axis = .horizontal + countsRow.distribution = .equalSpacing + countsRow.spacing = 8 + let progressStack = UIStackView(arrangedSubviews: [countsRow, progressView]) + progressStack.axis = .vertical + progressStack.spacing = 9 + progressView.tintColor = DroneDockStyle.primary + progressView.trackTintColor = UIColor(hex: 0xE9EBF2) + progressView.layer.cornerRadius = 2 + progressView.clipsToBounds = true + progressView.snp.makeConstraints { make in make.height.equalTo(4) } + contentStack.addArrangedSubview(progressStack) + + setupSummaryControl( + materialControl, titleLabel: materialTitleLabel, + stateLabel: materialStateLabel, chevron: materialChevron + ) + setupSummaryControl( + deliveryControl, titleLabel: deliveryTitleLabel, + stateLabel: deliveryStateLabel, chevron: deliveryChevron + ) + materialControl.addTarget(self, action: #selector(materialsTapped), for: .touchUpInside) + deliveryControl.addTarget(self, action: #selector(confirmationTapped), for: .touchUpInside) + materialRow.axis = .horizontal + materialRow.spacing = 12 + materialRow.distribution = .fillEqually + materialRow.addArrangedSubview(materialControl) + materialRow.addArrangedSubview(deliveryControl) + materialRow.snp.makeConstraints { make in + // 隐藏摘要行时,允许 UIStackView 的零高度约束覆盖该展示高度。 + make.height.equalTo(40).priority(999) + } + contentStack.addArrangedSubview(materialRow) + + actionStack.axis = .horizontal + actionStack.spacing = 10 + actionStack.distribution = .fillEqually + actionStack.addArrangedSubview(secondaryButton) + actionStack.addArrangedSubview(primaryButton) + [secondaryButton, primaryButton].forEach { button in + button.layer.cornerRadius = 10 + button.layer.cornerCurve = .continuous + button.titleLabel?.font = .systemFont(ofSize: 14, weight: .semibold) + button.titleLabel?.adjustsFontSizeToFitWidth = true + button.titleLabel?.minimumScaleFactor = 0.85 + button.snp.makeConstraints { make in make.height.equalTo(44).priority(999) } + } + secondaryButton.backgroundColor = UIColor(hex: 0xECF3FF) + secondaryButton.setTitleColor(DroneDockStyle.primary, for: .normal) + primaryButton.backgroundColor = DroneDockStyle.primary + primaryButton.setTitleColor(.white, for: .normal) + secondaryButton.addTarget(self, action: #selector(secondaryTapped), for: .touchUpInside) + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + contentStack.addArrangedSubview(actionStack) + } + + private func setupSummaryControl( + _ control: UIControl, + titleLabel: UILabel, + stateLabel: UILabel, + chevron: UIImageView + ) { + titleLabel.font = .systemFont(ofSize: 13, weight: .semibold) + titleLabel.textColor = UIColor(hex: 0x232936) + titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + stateLabel.font = .systemFont(ofSize: 11) + stateLabel.textColor = UIColor(hex: 0x8992A3) + stateLabel.numberOfLines = 1 + chevron.tintColor = UIColor(hex: 0x5A79B5) + chevron.contentMode = .scaleAspectFit + control.addSubview(titleLabel) + control.addSubview(stateLabel) + control.addSubview(chevron) + titleLabel.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + make.trailing.lessThanOrEqualTo(chevron.snp.leading).offset(-5) + } + chevron.snp.makeConstraints { make in + make.leading.equalTo(titleLabel.snp.trailing).offset(6) + make.centerY.equalTo(titleLabel) + make.width.equalTo(6) + make.height.equalTo(10) + make.trailing.lessThanOrEqualToSuperview() + } + stateLabel.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview() + make.top.equalTo(titleLabel.snp.bottom).offset(6) + } + control.isAccessibilityElement = true + control.accessibilityTraits = .button + } + + private func applyStatusAppearance(tone: DroneDockStatusTone) { + let foreground: UIColor + let background: UIColor + switch tone { + case .blue: + foreground = DroneDockStyle.primary + background = UIColor(hex: 0xECF3FF) + case .green: + foreground = UIColor(hex: 0x169B6B) + background = UIColor(hex: 0xEDF8F3) + case .gray: + foreground = UIColor(hex: 0x8E97A6) + background = UIColor(hex: 0xF0F2F7) + case .orange: + foreground = UIColor(hex: 0xD68A28) + background = UIColor(hex: 0xFFF6E8) + case .red: + foreground = UIColor(hex: 0xCA5E57) + background = UIColor(hex: 0xFFF0ED) + } + statusLabel.textColor = foreground + statusContainer.backgroundColor = background + } + + private func applyRemoteSummary(order: DroneDockHomeOrder, identifier: String) { + materialControl.isHidden = !order.showsMaterialsEntry + materialControl.isEnabled = true + materialTitleLabel.text = "查看素材" + materialStateLabel.text = order.cardMaterialStatusTitle ?? "素材状态待确认" + materialStateLabel.textColor = order.cardMaterialStatusTone == .red ? UIColor(hex: 0xC26962) : UIColor(hex: 0x8992A3) + materialChevron.isHidden = false + materialControl.accessibilityIdentifier = identifier + ".materials" + materialControl.accessibilityLabel = "查看素材,\(materialStateLabel.text ?? "")" + + deliveryControl.isHidden = !order.hasCompletedShootingQuota + materialRow.isHidden = materialControl.isHidden && deliveryControl.isHidden + deliveryControl.isEnabled = order.hasCompletedShootingQuota && (order.canConfirm == true || order.orderStatus == 30 || order.confirmStatus == 2) + deliveryChevron.isHidden = !deliveryControl.isEnabled + let confirmation: String = switch order.confirmStatus { + case 0: "未发起确认" + case 1: "待游客确认" + case 2: "已确认完成" + default: "确认状态待确认" + } + deliveryTitleLabel.text = order.orderStatus == 30 || order.confirmStatus == 2 ? "查看记录" : order.canConfirm == true ? "邀请确认" : confirmation + deliveryStateLabel.text = "已交付 \(order.filmCount.map(String.init) ?? "—") 个视频" + deliveryControl.accessibilityIdentifier = identifier + ".confirmation" + deliveryControl.accessibilityLabel = "\(deliveryTitleLabel.text ?? ""),\(deliveryStateLabel.text ?? ""),\(confirmation)" + } + + private func applyRemoteActions(order: DroneDockHomeOrder, identifier: String) { + let canShoot = order.activeFlightTaskID != nil || order.canCreateTask == true + let canConfirm = order.canInviteVisitorConfirmation + let canDeliver = order.canDeliverFilm + primaryButton.isHidden = !canShoot && !canConfirm && !canDeliver + primaryButton.isEnabled = !primaryButton.isHidden + primaryButton.backgroundColor = DroneDockStyle.primary + primaryButton.setTitle(canShoot ? order.actionTitle : canConfirm ? "邀请确认" : "交付成片", for: .normal) + primaryButton.accessibilityIdentifier = identifier + ".primary" + secondaryButton.isHidden = !canDeliver || (!canShoot && !canConfirm) + secondaryButton.isEnabled = !secondaryButton.isHidden + secondaryButton.setTitle("交付成片", for: .normal) + secondaryButton.accessibilityIdentifier = identifier + ".delivery" + actionStack.isHidden = primaryButton.isHidden && secondaryButton.isHidden + } + + private func applyMaterialSummary(order: DroneShootingOrder) { + let showsDelivery = order.hasCompletedShootingQuota && order.deliveredVideoCount > 0 + materialRow.isHidden = !order.hasMaterials && !showsDelivery + materialControl.isHidden = !order.hasMaterials + let isCompleted = order.fulfillmentState == .completed && order.activeTask == nil + materialTitleLabel.text = isCompleted ? "拍摄素材" : "查看素材" + materialChevron.isHidden = isCompleted + materialStateLabel.text = order.materialState.title + materialStateLabel.textColor = order.materialState == .failed + ? UIColor(hex: 0xC26962) : UIColor(hex: 0x8992A3) + materialControl.accessibilityLabel = "\(materialTitleLabel.text ?? "查看素材"),\(order.materialState.title)" + + deliveryControl.isHidden = !showsDelivery + deliveryControl.isEnabled = showsDelivery + deliveryTitleLabel.text = order.visitorConfirmationState == .confirmed ? "查看记录" : "请游客确认" + deliveryStateLabel.text = "已交付 \(order.deliveredVideoCount) 个视频" + deliveryControl.accessibilityLabel = "\(deliveryTitleLabel.text ?? "交付成片"),\(deliveryStateLabel.text ?? "")" + deliveryControl.accessibilityIdentifier = "drone.order.\(order.id).confirmation" + } + + private func applyActions(order: DroneShootingOrder) { + let isFinished = order.primaryAction == .none + secondaryButton.setTitle(isFinished ? "查看素材" : "交付成片", for: .normal) + if order.primaryAction == .none { + primaryButton.setTitle("交付成片", for: .normal) + } else { + primaryButton.setTitle(order.primaryAction.title, for: .normal) + } + secondaryButton.accessibilityIdentifier = "drone.order.\(order.id).secondary" + primaryButton.accessibilityIdentifier = "drone.order.\(order.id).primary" + } + + private func countsText(order: DroneShootingOrder) -> NSAttributedString { + let text = NSMutableAttributedString( + string: "已拍摄 ", attributes: [.foregroundColor: UIColor(hex: 0x69717F)] + ) + text.append(NSAttributedString( + string: "\(order.successfulShootingCount)", + attributes: [.foregroundColor: DroneDockStyle.primary, .font: UIFont.systemFont(ofSize: 12, weight: .medium)] + )) + text.append(NSAttributedString( + string: " / \(order.totalShootingCount) 次", attributes: [.foregroundColor: UIColor(hex: 0x69717F)] + )) + return text + } + + private func remainingText(order: DroneShootingOrder) -> NSAttributedString { + let text = NSMutableAttributedString( + string: "剩余 ", attributes: [.foregroundColor: UIColor(hex: 0x69717F)] + ) + text.append(NSAttributedString( + string: "\(order.remainingShootingCount)", + attributes: [.foregroundColor: DroneDockStyle.primary, .font: UIFont.systemFont(ofSize: 12, weight: .medium)] + )) + text.append(NSAttributedString(string: " 次", attributes: [.foregroundColor: UIColor(hex: 0x69717F)])) + return text + } + + private func countText(prefix: String, value: String, suffix: String) -> NSAttributedString { + let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor(hex: 0x69717F)] + let text = NSMutableAttributedString(string: prefix, attributes: attributes) + text.append(NSAttributedString(string: value, attributes: [ + .foregroundColor: DroneDockStyle.primary, + .font: UIFont.systemFont(ofSize: 12, weight: .medium) + ])) + text.append(NSAttributedString(string: suffix, attributes: attributes)) + return text + } + + @objc private func secondaryTapped() { + if let order = displayedHomeOrder { + guard !secondaryButton.isHidden, secondaryButton.isEnabled, order.canDeliverFilm else { return } + onDeliveryTap?() + return + } + guard let displayedOrder else { return } + if displayedOrder.primaryAction == .none { + onMaterialsTap?() + } else { + onDeliveryTap?() + } + } + + @objc private func primaryTapped() { + if let order = displayedHomeOrder { + guard !primaryButton.isHidden, primaryButton.isEnabled else { return } + if order.activeFlightTaskID != nil || order.canCreateTask == true { onShootingTap?() } + else if order.canInviteVisitorConfirmation { onConfirmationTap?() } + else if order.canDeliverFilm { onDeliveryTap?() } + return + } + guard let displayedOrder else { return } + if displayedOrder.primaryAction == .none { + onDeliveryTap?() + } else { + onShootingTap?() + } + } + + @objc private func materialsTapped() { + guard displayedOrder != nil || displayedHomeOrder != nil else { return } + onMaterialsTap?() + } + @objc private func confirmationTapped() { + guard !deliveryControl.isHidden, deliveryControl.isEnabled else { return } + guard displayedOrder != nil || displayedHomeOrder != nil else { return } + onConfirmationTap?() + } +} + +/// Diffable 订单列表使用的自适应高度容器。 +final class DroneShootingOrderCell: UICollectionViewCell { + /// UICollectionView 注册与出队标识。 + static let reuseIdentifier = "DroneShootingOrderCell" + /// 供页面配置订单与语义明确的动作回调。 + let cardView = DroneShootingOrderCardView() + + /// 创建完全依赖卡片内容撑高的列表单元格。 + override init(frame: CGRect) { + super.init(frame: frame) + contentView.addSubview(cardView) + cardView.snp.makeConstraints { make in make.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + /// 清除上一订单动作,避免复用时调用旧订单。 + override func prepareForReuse() { + super.prepareForReuse() + cardView.resetForReuse() + } +} diff --git a/suixinkan/UI/DroneDock/DroneShootingOrderFilterView.swift b/suixinkan/UI/DroneDock/DroneShootingOrderFilterView.swift new file mode 100644 index 0000000..1af6e3b --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneShootingOrderFilterView.swift @@ -0,0 +1,72 @@ +import SnapKit +import UIKit + +/// 我的拍摄订单四个等宽筛选 Tab,使用蓝色下划线标识当前履约分类。 +final class DroneShootingOrderFilterView: UIView { + /// 用户选择新的订单分类时触发。 + var onFilterSelected: ((DroneShootingOrderFilter) -> Void)? + + private let stackView = UIStackView() + private var buttons: [DroneShootingOrderFilter: UIButton] = [:] + private var indicators: [DroneShootingOrderFilter: UIView] = [:] + + /// 创建全部、待拍摄、进行中与已完成四个筛选入口。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + /// 按 ViewModel 提供的分类刷新文字与辅助功能选中状态。 + func apply(selectedFilter: DroneShootingOrderFilter) { + for filter in DroneShootingOrderFilter.allCases { + let isSelected = filter == selectedFilter + buttons[filter]?.setTitleColor( + isSelected ? DroneDockStyle.primary : DroneDockStyle.secondary, for: .normal + ) + buttons[filter]?.titleLabel?.font = .systemFont(ofSize: 14, weight: isSelected ? .semibold : .regular) + buttons[filter]?.accessibilityTraits = isSelected ? [.button, .selected] : .button + indicators[filter]?.isHidden = !isSelected + } + } + + private func setupUI() { + backgroundColor = .white + stackView.axis = .horizontal + stackView.distribution = .fillEqually + addSubview(stackView) + stackView.snp.makeConstraints { make in make.edges.equalToSuperview() } + + for filter in DroneShootingOrderFilter.allCases { + let itemView = UIView() + let button = UIButton(type: .system) + let indicator = UIView() + button.setTitle(filter.title, for: .normal) + button.accessibilityIdentifier = "drone.orders.filter.\(filter.rawValue)" + button.addAction(UIAction { [weak self] _ in + self?.onFilterSelected?(filter) + }, for: .touchUpInside) + indicator.backgroundColor = DroneDockStyle.primary + indicator.layer.cornerRadius = 1.5 + itemView.addSubview(button) + itemView.addSubview(indicator) + button.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + make.bottom.equalToSuperview().offset(-4) + } + indicator.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.bottom.equalToSuperview() + make.width.equalTo(30) + make.height.equalTo(3) + } + stackView.addArrangedSubview(itemView) + buttons[filter] = button + indicators[filter] = indicator + } + } +} diff --git a/suixinkan/UI/DroneDock/DroneShootingOrdersViewController.swift b/suixinkan/UI/DroneDock/DroneShootingOrdersViewController.swift new file mode 100644 index 0000000..1650840 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneShootingOrdersViewController.swift @@ -0,0 +1,315 @@ +import SnapKit +import UIKit + +/// 拍摄订单页发出明确导航意图,由工作台协调器展示对应下级页面。 +@MainActor +protocol DroneShootingOrdersViewControllerDelegate: AnyObject { + /// 用户请求开始、继续、重新准备拍摄,或查看当前任务。 + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectShooting order: DroneShootingOrder) + /// 用户请求查看该订单的原素材。 + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectMaterials order: DroneShootingOrder) + /// 用户请求追加交付成片。 + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectDelivery order: DroneShootingOrder) + /// 用户请求整单游客确认或查看确认记录。 + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectConfirmation order: DroneShootingOrder) +} + +/// 当前用户在当前景区的拍摄订单页面;使用本地 ViewModel 展示四种履约分类。 +final class DroneShootingOrdersViewController: BaseViewController { + /// 由入口页协调拍摄、素材和交付导航。 + weak var delegate: (any DroneShootingOrdersViewControllerDelegate)? + + private let viewModel: DroneShootingOrdersViewModel + private let descriptionLabel = UILabel() + private let filterView = DroneShootingOrderFilterView() + private let refreshControl = UIRefreshControl() + private let emptyView = DroneShootingOrdersEmptyView() + private var collectionView: UICollectionView! + private var dataSource: UICollectionViewDiffableDataSource? + private var ordersByID: [String: DroneShootingOrder] = [:] + + /// 注入共享演示数据及初始分类;从支付成功页进入时由 ViewModel 指定待拍摄。 + init(viewModel: DroneShootingOrdersViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + /// 回到页面后读取共享的本地快照,不创建或重新发送任务。 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + refreshOrders() + } + + /// 成片弹层关闭后主动读取共享摘要,保留当前 Tab 与滚动位置。 + func refreshOrders() { + viewModel.refresh() + if isViewLoaded { applySnapshot(animatingDifferences: false) } + } + + override func setupNavigationBar() { + title = "我的拍摄订单" + } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + descriptionLabel.text = "分配给我的全部订单,含已完成订单" + descriptionLabel.font = .systemFont(ofSize: 12) + descriptionLabel.textColor = UIColor(hex: 0x8992A3) + descriptionLabel.textAlignment = .center + descriptionLabel.backgroundColor = .white + view.addSubview(descriptionLabel) + view.addSubview(filterView) + + collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + collectionView.backgroundColor = .clear + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = false + collectionView.accessibilityIdentifier = "drone.orders.list" + collectionView.refreshControl = refreshControl + collectionView.register(DroneShootingOrderCell.self, forCellWithReuseIdentifier: DroneShootingOrderCell.reuseIdentifier) + collectionView.register( + DroneShootingOrdersHeadingView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: DroneShootingOrdersHeadingView.reuseIdentifier + ) + collectionView.register( + DroneShootingOrdersFooterView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, + withReuseIdentifier: DroneShootingOrdersFooterView.reuseIdentifier + ) + view.addSubview(collectionView) + configureDataSource() + } + + override func setupConstraints() { + descriptionLabel.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.height.equalTo(32) + } + filterView.snp.makeConstraints { make in + make.top.equalTo(descriptionLabel.snp.bottom) + make.leading.trailing.equalToSuperview() + make.height.equalTo(50) + } + collectionView.snp.makeConstraints { make in + make.top.equalTo(filterView.snp.bottom) + make.leading.trailing.bottom.equalToSuperview() + } + } + + override func bindActions() { + filterView.onFilterSelected = { [weak self] filter in + guard let self, filter != self.viewModel.selectedFilter else { return } + self.viewModel.selectFilter(filter) + self.applySnapshot(animatingDifferences: true) + self.collectionView.setContentOffset(.zero, animated: false) + } + refreshControl.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + } + + private func makeLayout() -> UICollectionViewLayout { + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1), heightDimension: .estimated(280) + )) + let group = NSCollectionLayoutGroup.vertical( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(280)), + subitems: [item] + ) + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 8, trailing: 16) + section.interGroupSpacing = 12 + section.boundarySupplementaryItems = [ + NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(54)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top + ), + NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(48)), + elementKind: UICollectionView.elementKindSectionFooter, alignment: .bottom + ) + ] + return UICollectionViewCompositionalLayout(section: section) + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, indexPath, orderID in + guard let self, + let order = self.ordersByID[orderID], + let cell = list.dequeueReusableCell(withReuseIdentifier: DroneShootingOrderCell.reuseIdentifier, for: indexPath) as? DroneShootingOrderCell else { + return nil + } + cell.cardView.apply(order: order) + cell.cardView.onShootingTap = { [weak self] in + guard let self else { return } + self.delegate?.shootingOrdersViewController(self, didSelectShooting: order) + } + cell.cardView.onMaterialsTap = { [weak self] in + guard let self else { return } + self.delegate?.shootingOrdersViewController(self, didSelectMaterials: order) + } + cell.cardView.onDeliveryTap = { [weak self] in + guard let self else { return } + self.delegate?.shootingOrdersViewController(self, didSelectDelivery: order) + } + cell.cardView.onConfirmationTap = { [weak self] in + guard let self else { return } + self.delegate?.shootingOrdersViewController(self, didSelectConfirmation: order) + } + return cell + } + dataSource?.supplementaryViewProvider = { [weak self] list, kind, indexPath in + guard let self else { return nil } + if kind == UICollectionView.elementKindSectionHeader { + let header = list.dequeueReusableSupplementaryView( + ofKind: kind, withReuseIdentifier: DroneShootingOrdersHeadingView.reuseIdentifier, for: indexPath + ) as? DroneShootingOrdersHeadingView + header?.apply(title: self.viewModel.selectedFilter.listTitle, count: self.viewModel.orders.count) + return header + } + let footer = list.dequeueReusableSupplementaryView( + ofKind: kind, withReuseIdentifier: DroneShootingOrdersFooterView.reuseIdentifier, for: indexPath + ) as? DroneShootingOrdersFooterView + footer?.apply(count: self.viewModel.orders.count) + return footer + } + } + + private func applySnapshot(animatingDifferences: Bool) { + guard isViewLoaded, let dataSource else { return } + let orders = viewModel.orders + ordersByID = Dictionary(uniqueKeysWithValues: orders.map { ($0.id, $0) }) + filterView.apply(selectedFilter: viewModel.selectedFilter) + emptyView.apply(filter: viewModel.selectedFilter) + collectionView.backgroundView = orders.isEmpty ? emptyView : nil + + let existingIDs = Set(dataSource.snapshot().itemIdentifiers) + var snapshot = NSDiffableDataSourceSnapshot() + if !orders.isEmpty { + snapshot.appendSections([0]) + snapshot.appendItems(orders.map(\.id)) + snapshot.reconfigureItems(orders.map(\.id).filter { existingIDs.contains($0) }) + } + dataSource.apply(snapshot, animatingDifferences: animatingDifferences) { [weak self] in + self?.updateVisibleSupplementaryViews() + } + } + + private func updateVisibleSupplementaryViews() { + for case let header as DroneShootingOrdersHeadingView in collectionView.visibleSupplementaryViews(ofKind: UICollectionView.elementKindSectionHeader) { + header.apply(title: viewModel.selectedFilter.listTitle, count: viewModel.orders.count) + } + for case let footer as DroneShootingOrdersFooterView in collectionView.visibleSupplementaryViews(ofKind: UICollectionView.elementKindSectionFooter) { + footer.apply(count: viewModel.orders.count) + } + } + + @objc private func refreshTriggered() { + viewModel.refresh() + applySnapshot(animatingDifferences: true) + refreshControl.endRefreshing() + } +} + +/// 列表上方的订单分类标题与数量。 +private final class DroneShootingOrdersHeadingView: UICollectionReusableView { + /// Supplementary view 复用标识。 + static let reuseIdentifier = "DroneShootingOrdersHeadingView" + private let titleLabel = UILabel() + + override init(frame: CGRect) { + super.init(frame: frame) + titleLabel.font = .systemFont(ofSize: 16, weight: .semibold) + titleLabel.accessibilityTraits = .header + addSubview(titleLabel) + titleLabel.snp.makeConstraints { make in + make.leading.trailing.centerY.equalToSuperview() + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 分类标题和数量使用不同字重,便于快速扫视。 + func apply(title: String, count: Int) { + let text = NSMutableAttributedString(string: title, attributes: [.foregroundColor: UIColor(hex: 0x172033)]) + text.append(NSAttributedString( + string: " \(count)", + attributes: [.foregroundColor: UIColor(hex: 0x8992A3), .font: UIFont.systemFont(ofSize: 14)] + )) + titleLabel.attributedText = text + } +} + +/// 演示订单全部展示完成后的底部文案,不伪装接口分页。 +private final class DroneShootingOrdersFooterView: UICollectionReusableView { + /// Supplementary view 复用标识。 + static let reuseIdentifier = "DroneShootingOrdersFooterView" + private let label = UILabel() + + override init(frame: CGRect) { + super.init(frame: frame) + label.font = .systemFont(ofSize: 12) + label.textColor = UIColor(hex: 0xA0A6B2) + label.textAlignment = .center + addSubview(label) + label.snp.makeConstraints { make in make.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 显示当前本地快照的订单数量。 + func apply(count: Int) { label.text = "已显示全部 \(count) 个订单" } +} + +/// 没有订单时保留四个筛选入口,并给出当前分类的空状态。 +private final class DroneShootingOrdersEmptyView: UIView { + private let titleLabel = UILabel() + + override init(frame: CGRect) { + super.init(frame: frame) + let icon = UIImageView(image: UIImage(systemName: "doc.text.magnifyingglass")) + icon.tintColor = UIColor(hex: 0xBBC4D4) + icon.contentMode = .scaleAspectFit + titleLabel.font = .systemFont(ofSize: 16, weight: .medium) + titleLabel.textColor = UIColor(hex: 0x697487) + titleLabel.textAlignment = .center + let subtitle = UILabel() + subtitle.text = "当前景区暂无分配给你的此类订单" + subtitle.font = .systemFont(ofSize: 13) + subtitle.textColor = UIColor(hex: 0xA0A8B7) + subtitle.textAlignment = .center + subtitle.numberOfLines = 0 + addSubview(icon) + addSubview(titleLabel) + addSubview(subtitle) + icon.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.centerY.equalToSuperview().offset(-65) + make.size.equalTo(54) + } + titleLabel.snp.makeConstraints { make in + make.top.equalTo(icon.snp.bottom).offset(20) + make.leading.trailing.equalToSuperview().inset(24) + } + subtitle.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(10) + make.leading.trailing.equalToSuperview().inset(24) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 根据已选分类生成空列表标题。 + func apply(filter: DroneShootingOrderFilter) { + titleLabel.text = filter == .all ? "暂无拍摄订单" : "暂无\(filter.title)订单" + } +} diff --git a/suixinkan/UI/DroneDock/DroneShootingPreparationViewController.swift b/suixinkan/UI/DroneDock/DroneShootingPreparationViewController.swift new file mode 100644 index 0000000..4be97e6 --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneShootingPreparationViewController.swift @@ -0,0 +1,260 @@ +import SnapKit +import UIKit + +/// 准备页只提出查看任务的导航请求,导航栈由机巢入口统一维护。 +@MainActor +protocol DroneShootingPreparationViewControllerDelegate: AnyObject { + /// 召唤已明确确认,或工作人员主动查看本订单已有任务。 + func shootingPreparationViewController(_ controller: DroneShootingPreparationViewController, didRequestTaskFor orderID: String) +} + +/// 拍摄准备页:选择点位与航线,展示订单额度和设备执行许可。 +@MainActor +final class DroneShootingPreparationViewController: BaseViewController { + /// 由入口注入的共享订单与准备状态。 + let viewModel: DroneShootingPreparationViewModel + /// 将任务导航交回机巢入口,避免页面自行创建任务控制器。 + weak var delegate: DroneShootingPreparationViewControllerDelegate? + + /// 点位使用横向分区,航线使用纵向分区。 + private enum Section: Int, CaseIterable { case order, points, routes } + /// 稳定标识让选择和许可刷新时保留点位的横向滚动位置。 + private enum Item: Hashable { + case order, point(String), route(String), emptyPoints, emptyRoutes + } + + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private let footerView = DronePreparationFooterView() + private let refreshControl = UIRefreshControl() + + /// 准备页与订单页、任务页读取同一个本地状态源。 + init(viewModel: DroneShootingPreparationViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 返回页面时刷新配额、选择与设备状态,不提交任何飞行操作。 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + viewModel.refresh() + if dataSource != nil { applySnapshot(animated: false) } + } + + override func setupNavigationBar() { + title = "拍摄准备" + navigationItem.backButtonDisplayMode = .minimal + #if DEBUG + let scenarios = DroneShootingPreparationScenario.allCases.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in + guard let self else { return } + self.viewModel.applyScenario(scenario) + self.applySnapshot(animated: true) + } + } + let confirmAction = UIAction(title: "模拟召唤确认", image: UIImage(systemName: "checkmark.circle")) { [weak self] _ in + guard let self else { return } + let confirmed = self.viewModel.confirmSummon() + self.applySnapshot(animated: true) + if confirmed { + self.delegate?.shootingPreparationViewController(self, didRequestTaskFor: self.viewModel.orderID) + } + } + let menu = UIMenu(title: "拍摄准备验收状态", children: [ + UIMenu(options: .displayInline, children: scenarios), + UIMenu(options: .displayInline, children: [confirmAction]) + ]) + let item = UIBarButtonItem(image: UIImage(systemName: "slider.horizontal.3"), menu: menu) + item.accessibilityLabel = "拍摄准备验收状态" + item.accessibilityIdentifier = "drone.preparation.scenarios" + navigationItem.rightBarButtonItem = item + #endif + } + + override func setupUI() { + view.backgroundColor = DroneDockStyle.background + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = false + collectionView.delegate = self + collectionView.accessibilityIdentifier = "drone.preparation.list" + collectionView.register(DronePreparationOrderCell.self, forCellWithReuseIdentifier: "order") + collectionView.register(DronePreparationPointCell.self, forCellWithReuseIdentifier: "point") + collectionView.register(DronePreparationRouteCell.self, forCellWithReuseIdentifier: "route") + collectionView.register(DronePreparationEmptyCell.self, forCellWithReuseIdentifier: "empty") + collectionView.register(DronePreparationHeadingView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: "heading") + refreshControl.tintColor = DroneDockStyle.primary + collectionView.refreshControl = refreshControl + view.addSubview(collectionView) + view.addSubview(footerView) + configureDataSource() + applySnapshot(animated: false) + } + + override func setupConstraints() { + collectionView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footerView.snp.top) + } + footerView.snp.makeConstraints { make in + make.leading.trailing.bottom.equalToSuperview() + } + } + + override func bindActions() { + refreshControl.addTarget(self, action: #selector(refreshTriggered), for: .valueChanged) + footerView.onPrimaryTap = { [weak self] in + guard let self, self.viewModel.primaryButtonEnabled else { return } + let shouldShowTask = self.viewModel.summon() + self.applySnapshot(animated: true) + if shouldShowTask { + self.delegate?.shootingPreparationViewController(self, didRequestTaskFor: self.viewModel.orderID) + } + } + footerView.onRefreshTap = { [weak self] in + guard let self else { return } + self.viewModel.refreshSummonStatus() + self.applySnapshot(animated: true) + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] sectionIndex, _ in + guard let self, let section = Section(rawValue: sectionIndex) else { return nil } + let height: NSCollectionLayoutDimension + let width: NSCollectionLayoutDimension + switch section { + case .order: + width = .fractionalWidth(1) + height = .estimated(90) + case .points: + width = self.viewModel.points.isEmpty ? .fractionalWidth(1) : .absolute(144) + height = self.viewModel.points.isEmpty ? .absolute(124) : .absolute(64) + case .routes: + width = .fractionalWidth(1) + height = self.viewModel.routes.isEmpty ? .absolute(200) : .absolute(64) + } + let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1), heightDimension: section == .order ? .estimated(90) : .fractionalHeight(1) + )) + let group = NSCollectionLayoutGroup.vertical( + layoutSize: NSCollectionLayoutSize(widthDimension: width, heightDimension: height), subitems: [item] + ) + let layoutSection = NSCollectionLayoutSection(group: group) + layoutSection.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: section == .routes ? 16 : 0, trailing: 16) + if section == .points { + layoutSection.orthogonalScrollingBehavior = self.viewModel.points.isEmpty ? .none : .continuous + layoutSection.interGroupSpacing = 8 + } + if section != .order { + let headerHeight: CGFloat = section == .points ? 46 : 64 + layoutSection.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(headerHeight)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top + )] + } + return layoutSection + } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, indexPath, item in + guard let self else { return nil } + switch item { + case .order: + let cell = list.dequeueReusableCell(withReuseIdentifier: "order", for: indexPath) as! DronePreparationOrderCell + cell.apply(order: self.viewModel.order) + return cell + case .point(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "point", for: indexPath) as! DronePreparationPointCell + if let point = self.viewModel.points.first(where: { $0.id == id }) { + cell.apply(point: point, selected: self.viewModel.selectedPoint?.id == id) + } + return cell + case .route(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "route", for: indexPath) as! DronePreparationRouteCell + if let route = self.viewModel.routes.first(where: { $0.id == id }) { + cell.apply(route: route, selected: self.viewModel.selectedRoute?.id == id) + } + return cell + case .emptyPoints, .emptyRoutes: + let cell = list.dequeueReusableCell(withReuseIdentifier: "empty", for: indexPath) as! DronePreparationEmptyCell + cell.apply(isPointEmpty: item == .emptyPoints) + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] list, kind, indexPath in + guard let self, kind == UICollectionView.elementKindSectionHeader else { return nil } + let header = list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "heading", for: indexPath) as! DronePreparationHeadingView + self.applyHeading(header, section: Section(rawValue: indexPath.section)) + return header + } + } + + private func applySnapshot(animated: Bool) { + guard isViewLoaded, dataSource != nil else { return } + let previous = dataSource.snapshot() + let existingItems = Set(previous.itemIdentifiers) + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections(Section.allCases) + snapshot.appendItems([.order], toSection: .order) + snapshot.appendItems(viewModel.points.isEmpty ? [.emptyPoints] : viewModel.points.map { .point($0.id) }, toSection: .points) + snapshot.appendItems(viewModel.routes.isEmpty ? [.emptyRoutes] : viewModel.routes.map { .route($0.id) }, toSection: .routes) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existingItems.contains($0) }) + footerView.apply(viewModel: viewModel) + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + guard let self else { return } + let kind = UICollectionView.elementKindSectionHeader + for indexPath in self.collectionView.indexPathsForVisibleSupplementaryElements(ofKind: kind) { + guard let header = self.collectionView.supplementaryView(forElementKind: kind, at: indexPath) as? DronePreparationHeadingView else { continue } + self.applyHeading(header, section: Section(rawValue: indexPath.section)) + } + } + let pointEmptinessChanged = previous.itemIdentifiers.contains(.emptyPoints) != snapshot.itemIdentifiers.contains(.emptyPoints) + let routeEmptinessChanged = previous.itemIdentifiers.contains(.emptyRoutes) != snapshot.itemIdentifiers.contains(.emptyRoutes) + if pointEmptinessChanged || routeEmptinessChanged { collectionView.collectionViewLayout.invalidateLayout() } + } + + private func applyHeading(_ header: DronePreparationHeadingView, section: Section?) { + switch section { + case .points: + header.apply(title: "拍摄点", detail: nil) + case .routes: + let title = viewModel.selectedPoint.map { "\($0.name)的航线" } ?? "拍摄航线" + header.apply(title: title, detail: "共 \(viewModel.routes.count) 条") + default: + header.apply(title: "", detail: nil) + } + } + + @objc private func refreshTriggered() { + viewModel.refresh() + applySnapshot(animated: true) + refreshControl.endRefreshing() + } +} + +extension DroneShootingPreparationViewController: UICollectionViewDelegate { + /// 召唤处理中保留滚动浏览,但冻结已提交的点位与航线选择。 + func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { + !viewModel.hasPendingSummon + } + + /// 整卡点位与整行航线均可选择;实际有效性和选择恢复由 ViewModel 处理。 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard !viewModel.hasPendingSummon, let item = dataSource.itemIdentifier(for: indexPath) else { return } + switch item { + case .point(let id): viewModel.selectPoint(id: id) + case .route(let id): viewModel.selectRoute(id: id) + default: return + } + applySnapshot(animated: true) + } +} diff --git a/suixinkan/UI/DroneDock/DroneShootingTaskViewController.swift b/suixinkan/UI/DroneDock/DroneShootingTaskViewController.swift new file mode 100644 index 0000000..d4bae5f --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneShootingTaskViewController.swift @@ -0,0 +1,481 @@ +import SnapKit +import UIKit + +/// 当前任务页面的导航意图;返回始终由工作台协调器处理。 +@MainActor +protocol DroneShootingTaskViewControllerDelegate: AnyObject { + /// 直接回工作台,保留原任务,不弹离页确认。 + func shootingTaskViewControllerDidRequestWorkbench(_ controller: DroneShootingTaskViewController) + /// 任务确认结束且仍有余次后,进入准备页恢复有效选择。 + func shootingTaskViewController(_ controller: DroneShootingTaskViewController, didRequestPreparationFor order: DroneShootingOrder) + /// 查看当前订单的素材;首轮由入口协调器提供占位。 + func shootingTaskViewController(_ controller: DroneShootingTaskViewController, didRequestMaterialsFor order: DroneShootingOrder) +} + +/// 原任务控制页:独立展示飞行、拍摄结果、连接及指令确认状态。 +@MainActor +final class DroneShootingTaskViewController: BaseViewController { + /// 协调工作台、重新准备与素材入口,不在页面内创建新任务。 + weak var delegate: (any DroneShootingTaskViewControllerDelegate)? + + private let viewModel: DroneShootingTaskViewModel + private let demoBar = UIView() + private let scrollView = UIScrollView() + private let contentStack = UIStackView() + private let summaryView = UIView() + private let taskTitleLabel = DroneDockStyle.label(size: 17, weight: .semibold) + private let subtitleLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let feedView = DroneShootingTaskFeedView() + private let telemetryView = DroneShootingTaskTelemetryView() + private let controlPanel = UIView() + private let controlStack = UIStackView() + private let statusIconBackground = UIView() + private let statusIconView = UIImageView() + private let statusTitleLabel = DroneDockStyle.label(size: 21, weight: .semibold) + private let statusMessageLabel = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let commandView = UIView() + private let commandTitleLabel = DroneDockStyle.label(size: 12, weight: .semibold, color: DroneDockStyle.warning) + private let commandMessageLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary) + private let refreshTaskButton = UIButton(type: .system) + private let primaryButton = UIButton(type: .system) + private let preparationButton = UIButton(type: .system) + private let materialsButton = UIButton(type: .system) + private let pauseButton = DroneShootingTaskSafetyButton(symbol: "pause.circle", color: UIColor(hex: 0xEC982A), filled: true) + private let returnButton = DroneShootingTaskSafetyButton(symbol: "arrow.uturn.backward", color: UIColor(hex: 0xD85762), filled: false) + private var displayedResultNoticeID: String? + private var interactivePopWasEnabled: Bool? + + /// 注入共享数据源上的原任务 ViewModel;构造及页面出现不会发起召唤。 + init(viewModel: DroneShootingTaskViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 重进时只读取原任务,等待明确状态,不重发控制指令。 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + if interactivePopWasEnabled == nil { + interactivePopWasEnabled = navigationController?.interactivePopGestureRecognizer?.isEnabled + } + navigationController?.interactivePopGestureRecognizer?.isEnabled = false + viewModel.refresh() + applySnapshot() + } + + /// 页面完整呈现后才显示本次结果提示,用户可以稍后查看素材。 + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + presentResultNoticeIfNeeded() + } + + /// 恢复其他页面原有返回手势;本页返回统一直接回工作台。 + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + if let interactivePopWasEnabled { + navigationController?.interactivePopGestureRecognizer?.isEnabled = interactivePopWasEnabled + self.interactivePopWasEnabled = nil + } + } + + /// 配置直接返回工作台的导航入口。 + override func setupNavigationBar() { + title = "拍摄任务" + navigationItem.hidesBackButton = true + let back = UIBarButtonItem(image: UIImage(systemName: "chevron.left"), style: .plain, target: self, action: #selector(backTapped)) + back.tintColor = DroneDockStyle.text + back.accessibilityLabel = "返回机巢工作台" + back.accessibilityIdentifier = "drone.task.back" + navigationItem.leftBarButtonItem = back + } + + /// 依原型布局摘要、演示画面、遥测与固定控制区。 + override func setupUI() { + view.backgroundColor = .white + setupDemoBar() + scrollView.showsVerticalScrollIndicator = false + scrollView.alwaysBounceVertical = false + scrollView.accessibilityIdentifier = "drone.task.overview" + view.addSubview(scrollView) + contentStack.axis = .vertical + contentStack.spacing = 0 + scrollView.addSubview(contentStack) + contentStack.addArrangedSubview(summaryView) + summaryView.addSubview(taskTitleLabel) + summaryView.addSubview(subtitleLabel) + taskTitleLabel.numberOfLines = 2 + subtitleLabel.numberOfLines = 1 + subtitleLabel.adjustsFontSizeToFitWidth = true + subtitleLabel.minimumScaleFactor = 0.8 + contentStack.addArrangedSubview(feedView) + contentStack.addArrangedSubview(telemetryView) + setupControlPanel() + } + + /// 上部内容允许在小屏滚动,安全控制始终保持可见。 + override func setupConstraints() { + demoBar.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + make.height.equalTo(29) + } + scrollView.snp.makeConstraints { make in + make.top.equalTo(demoBar.snp.bottom) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(controlPanel.snp.top) + } + contentStack.snp.makeConstraints { make in + make.edges.equalTo(scrollView.contentLayoutGuide) + make.width.equalTo(scrollView.frameLayoutGuide) + } + taskTitleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(10) + make.leading.trailing.equalToSuperview().inset(16) + } + subtitleLabel.snp.makeConstraints { make in + make.top.equalTo(taskTitleLabel.snp.bottom).offset(5) + make.leading.trailing.equalToSuperview().inset(16) + make.bottom.equalToSuperview().inset(10) + } + feedView.snp.makeConstraints { make in + make.height.equalTo(feedView.snp.width).multipliedBy(9.0 / 16.0) + } + controlPanel.snp.makeConstraints { make in + make.leading.trailing.bottom.equalToSuperview() + } + controlStack.snp.makeConstraints { make in + make.top.equalToSuperview().offset(17) + make.leading.trailing.equalToSuperview().inset(16) + make.bottom.equalTo(view.safeAreaLayoutGuide).inset(12) + } + } + + /// 将按钮操作交给 ViewModel,提交后主动刷新当前快照。 + override func bindActions() { + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + preparationButton.addTarget(self, action: #selector(preparationTapped), for: .touchUpInside) + materialsButton.addTarget(self, action: #selector(materialsTapped), for: .touchUpInside) + pauseButton.addTarget(self, action: #selector(pauseTapped), for: .touchUpInside) + returnButton.addTarget(self, action: #selector(returnTapped), for: .touchUpInside) + refreshTaskButton.addTarget(self, action: #selector(refreshTaskTapped), for: .touchUpInside) + feedView.onExpand = { [weak self] in + let expanded = DroneShootingTaskExpandedFeedViewController() + expanded.modalPresentationStyle = .fullScreen + self?.present(expanded, animated: true) + } + feedView.onReconnect = { [weak self] in + guard let self else { return } + if self.viewModel.phoneConnection == .disconnected { + self.viewModel.reconnectPhone() + } else if self.viewModel.phoneConnection == .connected { + self.viewModel.reconnectFeed() + } + self.applySnapshot() + } + } + + private func setupDemoBar() { + demoBar.backgroundColor = UIColor(hex: 0xF3F6FC) + view.addSubview(demoBar) + let label = DroneDockStyle.label("本地界面演示 · 无真实操作", size: 10, color: DroneDockStyle.secondary) + demoBar.addSubview(label) + label.snp.makeConstraints { make in + make.leading.equalToSuperview().offset(16) + make.centerY.equalToSuperview() + } + #if DEBUG + let scenarioButton = UIButton(type: .system) + var configuration = UIButton.Configuration.plain() + configuration.title = "模拟状态" + configuration.image = UIImage(systemName: "slider.horizontal.3") + configuration.imagePadding = 4 + configuration.baseForegroundColor = DroneDockStyle.primary + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 11) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var outgoing = incoming + outgoing.font = .systemFont(ofSize: 10) + return outgoing + } + scenarioButton.configuration = configuration + scenarioButton.showsMenuAsPrimaryAction = true + scenarioButton.menu = UIMenu(title: "本地模拟事件 · 不自动推进", children: DroneShootingTaskScenario.allCases.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in + self?.viewModel.applyScenario(scenario) + self?.applySnapshot() + self?.presentResultNoticeIfNeeded() + } + }) + scenarioButton.accessibilityIdentifier = "drone.task.scenarios" + demoBar.addSubview(scenarioButton) + scenarioButton.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(12) + make.top.bottom.equalToSuperview() + } + #endif + } + + private func setupControlPanel() { + controlPanel.backgroundColor = .white + view.addSubview(controlPanel) + controlStack.axis = .vertical + controlStack.spacing = 11 + controlPanel.addSubview(controlStack) + + let statusRow = UIStackView() + statusRow.axis = .horizontal + statusRow.spacing = 12 + statusRow.alignment = .top + statusIconBackground.layer.cornerRadius = 19 + statusIconBackground.addSubview(statusIconView) + statusIconView.contentMode = .scaleAspectFit + statusIconView.snp.makeConstraints { make in + make.center.equalToSuperview() + make.size.equalTo(22) + } + statusIconBackground.snp.makeConstraints { make in make.size.equalTo(38) } + let statusTexts = UIStackView(arrangedSubviews: [statusTitleLabel, statusMessageLabel]) + statusTexts.axis = .vertical + statusTexts.spacing = 6 + statusTitleLabel.numberOfLines = 2 + statusTitleLabel.accessibilityTraits = .header + statusTitleLabel.accessibilityIdentifier = "drone.task.statusTitle" + statusMessageLabel.numberOfLines = 0 + statusMessageLabel.accessibilityIdentifier = "drone.task.statusMessage" + statusRow.addArrangedSubview(statusIconBackground) + statusRow.addArrangedSubview(statusTexts) + controlStack.addArrangedSubview(statusRow) + setupCommandView() + controlStack.addArrangedSubview(commandView) + controlStack.addArrangedSubview(primaryButton) + primaryButton.accessibilityIdentifier = "drone.task.primary" + primaryButton.snp.makeConstraints { make in make.height.equalTo(49) } + + materialsButton.accessibilityIdentifier = "drone.task.materials" + materialsButton.setTitle("查看素材", for: .normal) + materialsButton.setTitleColor(DroneDockStyle.primary, for: .normal) + materialsButton.titleLabel?.font = .systemFont(ofSize: 13, weight: .medium) + materialsButton.snp.makeConstraints { make in make.height.equalTo(30).priority(999) } + controlStack.addArrangedSubview(materialsButton) + + preparationButton.accessibilityIdentifier = "drone.task.prepareAgain" + preparationButton.setTitle("继续准备拍摄", for: .normal) + preparationButton.setTitleColor(DroneDockStyle.primary, for: .normal) + preparationButton.titleLabel?.font = .systemFont(ofSize: 13, weight: .medium) + preparationButton.snp.makeConstraints { make in make.height.equalTo(27).priority(999) } + controlStack.addArrangedSubview(preparationButton) + + let safetyHeader = UIView() + let safetyLabel = DroneDockStyle.label("安全控制", size: 10, color: DroneDockStyle.secondary) + let leftLine = UIView() + let rightLine = UIView() + leftLine.backgroundColor = DroneDockStyle.border + rightLine.backgroundColor = DroneDockStyle.border + safetyHeader.addSubview(leftLine) + safetyHeader.addSubview(rightLine) + safetyHeader.addSubview(safetyLabel) + safetyLabel.snp.makeConstraints { make in make.center.equalToSuperview() } + leftLine.snp.makeConstraints { make in + make.leading.centerY.equalToSuperview() + make.trailing.equalTo(safetyLabel.snp.leading).offset(-9) + make.height.equalTo(0.5) + } + rightLine.snp.makeConstraints { make in + make.trailing.centerY.equalToSuperview() + make.leading.equalTo(safetyLabel.snp.trailing).offset(9) + make.height.equalTo(0.5) + } + safetyHeader.snp.makeConstraints { make in make.height.equalTo(13) } + controlStack.addArrangedSubview(safetyHeader) + controlStack.setCustomSpacing(5, after: primaryButton) + controlStack.setCustomSpacing(5, after: safetyHeader) + let safetyButtons = UIStackView(arrangedSubviews: [pauseButton, returnButton]) + safetyButtons.axis = .horizontal + safetyButtons.spacing = 8 + safetyButtons.distribution = .fillEqually + safetyButtons.snp.makeConstraints { make in make.height.equalTo(62) } + pauseButton.accessibilityIdentifier = "drone.task.pause" + returnButton.accessibilityIdentifier = "drone.task.return" + controlStack.addArrangedSubview(safetyButtons) + } + + private func setupCommandView() { + commandView.backgroundColor = UIColor(hex: 0xFFF8EB) + commandView.layer.cornerRadius = 8 + commandView.layer.borderColor = UIColor(hex: 0xF4E5C7).cgColor + commandView.layer.borderWidth = 1 + let commandStack = UIStackView(arrangedSubviews: [commandTitleLabel, commandMessageLabel, refreshTaskButton]) + commandStack.axis = .vertical + commandStack.spacing = 5 + commandTitleLabel.numberOfLines = 0 + commandMessageLabel.numberOfLines = 0 + commandView.addSubview(commandStack) + commandStack.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview().inset(10) + make.bottom.equalToSuperview().inset(10).priority(999) + } + var configuration = UIButton.Configuration.bordered() + configuration.title = "刷新任务状态" + configuration.image = UIImage(systemName: "arrow.clockwise") + configuration.imagePadding = 6 + configuration.baseForegroundColor = DroneDockStyle.primary + configuration.background.backgroundColor = .clear + configuration.background.strokeColor = DroneDockStyle.primary.withAlphaComponent(0.5) + configuration.background.strokeWidth = 1 + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var outgoing = incoming + outgoing.font = .systemFont(ofSize: 12) + return outgoing + } + refreshTaskButton.configuration = configuration + refreshTaskButton.accessibilityIdentifier = "drone.task.sync" + refreshTaskButton.snp.makeConstraints { make in make.height.equalTo(34).priority(999) } + } + + private func applySnapshot() { + guard isViewLoaded else { return } + taskTitleLabel.text = viewModel.title + subtitleLabel.text = viewModel.subtitle + feedView.apply(phone: viewModel.phoneConnection, feed: viewModel.feedConnection, isFlightFinished: viewModel.session?.isFlightFinished == true) + telemetryView.apply(telemetry: viewModel.telemetry, isStale: viewModel.phoneConnection != .connected) + statusTitleLabel.text = viewModel.statusTitle + statusMessageLabel.text = viewModel.statusMessage + let statusColor = DroneDockStyle.color(for: viewModel.statusTone) + statusIconBackground.backgroundColor = statusColor.withAlphaComponent(0.1) + statusIconView.tintColor = statusColor + statusIconView.image = UIImage(systemName: statusSymbol) + commandView.isHidden = viewModel.commandTitle == nil + commandTitleLabel.text = viewModel.commandTitle + commandMessageLabel.text = viewModel.commandMessage + refreshTaskButton.isHidden = !viewModel.shouldShowCommandRefresh + configurePrimaryButton() + materialsButton.isHidden = !(viewModel.session?.result == .succeeded && viewModel.primaryAction != .viewMaterials) + preparationButton.isHidden = !(viewModel.session?.isFlightFinished == true && (viewModel.order?.remainingShootingCount ?? 0) > 0 && viewModel.primaryAction == .viewMaterials) + pauseButton.apply(title: viewModel.pauseTitle, subtitle: viewModel.pauseSubtitle, enabled: viewModel.canPause) + returnButton.apply(title: viewModel.returnTitle, subtitle: viewModel.returnSubtitle, enabled: viewModel.canReturn) + } + + private var statusSymbol: String { + if viewModel.phoneConnection != .connected { return "questionmark.circle.fill" } + if viewModel.session?.result == .succeeded { return "checkmark.circle.fill" } + if viewModel.session?.result == .failed { return "exclamationmark.circle.fill" } + switch viewModel.phase { + case .navigating: return "paperplane.fill" + case .arrived: return "checkmark.circle.fill" + case .shooting: return "video.fill" + case .shootingPaused, .returnPaused: return "pause.fill" + case .returning: return "arrow.uturn.backward" + case .unconfirmed, .none: return "questionmark.circle.fill" + } + } + + private func configurePrimaryButton() { + var configuration = UIButton.Configuration.filled() + configuration.title = viewModel.primaryTitle + configuration.image = UIImage(systemName: primarySymbol) + configuration.imagePadding = 9 + configuration.baseBackgroundColor = DroneDockStyle.primary + configuration.baseForegroundColor = .white + configuration.cornerStyle = .medium + let command = viewModel.session?.command + configuration.showsActivityIndicator = command?.status == .processing && ( + (viewModel.primaryAction == .start && command?.kind == .start) + || (viewModel.primaryAction == .resume && command?.kind == .resume) + ) + configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 20) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var outgoing = incoming + outgoing.font = .systemFont(ofSize: 17, weight: .semibold) + return outgoing + } + primaryButton.configuration = configuration + primaryButton.isEnabled = viewModel.primaryEnabled + primaryButton.alpha = viewModel.primaryEnabled ? 1 : 0.46 + } + + private var primarySymbol: String { + switch viewModel.primaryAction { + case .start: "camera" + case .resume: "play.fill" + case .viewMaterials: "photo.on.rectangle" + case .prepareAgain: "arrow.clockwise" + case .none: "camera" + } + } + + private func presentResultNoticeIfNeeded() { + guard viewIfLoaded?.window != nil, presentedViewController == nil, + let notice = viewModel.resultNotice, displayedResultNoticeID != notice.id else { return } + displayedResultNoticeID = notice.id + let alert = UIAlertController(title: notice.title, message: notice.message, preferredStyle: .alert) + if notice.isSuccess { + alert.addAction(UIAlertAction(title: "稍后再去", style: .cancel) { [weak self] _ in self?.viewModel.dismissResultNotice() }) + alert.addAction(UIAlertAction(title: "去查看", style: .default) { [weak self] _ in + guard let self else { return } + self.viewModel.dismissResultNotice() + self.requestMaterials() + }) + } else { + alert.addAction(UIAlertAction(title: "知道了", style: .default) { [weak self] _ in self?.viewModel.dismissResultNotice() }) + } + present(alert, animated: true) + } + + private func requestMaterials() { + guard let order = viewModel.order else { return } + if let delegate { + delegate.shootingTaskViewController(self, didRequestMaterialsFor: order) + } else { + showAlert(title: "素材库", message: "本地界面预览:素材入口将在后续接入。") + } + } + + @objc private func materialsTapped() { requestMaterials() } + + @objc private func backTapped() { + if let delegate { + delegate.shootingTaskViewControllerDidRequestWorkbench(self) + } else if let workbench = navigationController?.viewControllers.first(where: { $0 is DroneDockWorkbenchViewController }) { + navigationController?.popToViewController(workbench, animated: true) + } else { + navigationController?.popToRootViewController(animated: true) + } + } + + @objc private func primaryTapped() { + guard viewModel.primaryEnabled else { return } + switch viewModel.primaryAction { + case .start: _ = viewModel.startShooting() + case .resume: _ = viewModel.resume() + case .viewMaterials: requestMaterials() + case .prepareAgain: preparationTapped() + case .none: break + } + applySnapshot() + } + + @objc private func preparationTapped() { + guard let order = viewModel.order, order.remainingShootingCount > 0, viewModel.session?.isFlightFinished == true else { return } + delegate?.shootingTaskViewController(self, didRequestPreparationFor: order) + } + + @objc private func pauseTapped() { + guard viewModel.canPause else { return } + _ = viewModel.pause() + applySnapshot() + } + + @objc private func returnTapped() { + guard viewModel.canReturn else { return } + _ = viewModel.requestReturn() + applySnapshot() + } + + @objc private func refreshTaskTapped() { + viewModel.refreshTaskStatus() + applySnapshot() + presentResultNoticeIfNeeded() + } +} diff --git a/suixinkan/UI/DroneDock/DroneShootingTaskViews.swift b/suixinkan/UI/DroneDock/DroneShootingTaskViews.swift new file mode 100644 index 0000000..6fca35b --- /dev/null +++ b/suixinkan/UI/DroneDock/DroneShootingTaskViews.swift @@ -0,0 +1,393 @@ +import SnapKit +import UIKit + +/// 任务页的本地画面演示组件;连接、断流与任务结果分别展示。 +@MainActor +final class DroneShootingTaskFeedView: UIView { + /// 用户请求查看本地静帧大图。 + var onExpand: (() -> Void)? + /// 用户请求重连手机或画面,具体意图由当前连接状态决定。 + var onReconnect: (() -> Void)? + + private let imageView = UIImageView(image: UIImage(named: "drone_demo_tourists")) + private let captionLabel = DroneDockStyle.label("演示画面 · 本地静帧", size: 11, color: .white) + private let expandButton = UIButton(type: .system) + private let interruptionView = UIView() + private let interruptionIcon = UIImageView() + private let interruptionTitle = DroneDockStyle.label(size: 16, weight: .semibold) + private let interruptionMessage = DroneDockStyle.label(size: 12, color: DroneDockStyle.secondary) + private let reconnectButton = UIButton(type: .system) + + /// 创建 16:9 本地图片画面,不请求网络,也不播放视频。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 独立应用手机连接与画面连接;完成任务只改变静帧说明。 + func apply(phone: DroneShootingConnectionState, feed: DroneShootingConnectionState, isFlightFinished: Bool) { + let phoneUnavailable = phone != .connected + let feedUnavailable = feed != .connected + interruptionView.isHidden = !phoneUnavailable && !feedUnavailable + expandButton.isHidden = phoneUnavailable || feedUnavailable + captionLabel.text = isFlightFinished ? "上次任务画面 · 本地演示" : "演示画面 · 本地静帧" + + if phoneUnavailable { + interruptionIcon.image = UIImage(systemName: "wifi.slash") + switch phone { + case .disconnected: + interruptionTitle.text = "手机网络连接中断" + interruptionMessage.text = "状态暂未更新,请恢复连接后同步当前任务" + configureReconnect(title: "重新连接", enabled: true) + case .reconnecting: + interruptionTitle.text = "正在重新连接" + interruptionMessage.text = "等待本地模拟连接回执" + configureReconnect(title: "正在连接", enabled: false) + case .synchronizing: + interruptionTitle.text = "正在同步当前任务" + interruptionMessage.text = "同步确认前请勿重复发送指令" + configureReconnect(title: "正在同步", enabled: false) + case .connected: break + } + } else if feedUnavailable { + interruptionIcon.image = UIImage(systemName: "video.slash") + interruptionTitle.text = feed == .disconnected ? "演示画面连接中断" : "正在重新连接画面" + interruptionMessage.text = "仅画面中断,任务与控制状态分别更新" + configureReconnect(title: feed == .disconnected ? "重新连接画面" : "正在连接画面", enabled: feed == .disconnected) + } + } + + private func setupUI() { + backgroundColor = UIColor(hex: 0xE9EEF6) + clipsToBounds = true + imageView.contentMode = .scaleAspectFill + imageView.clipsToBounds = true + imageView.accessibilityLabel = "游客取景示意,本地演示静帧" + addSubview(imageView) + + let captionBackground = UIView() + captionBackground.backgroundColor = UIColor.black.withAlphaComponent(0.38) + captionBackground.layer.cornerRadius = 5 + captionBackground.addSubview(captionLabel) + addSubview(captionBackground) + captionBackground.snp.makeConstraints { make in + make.leading.top.equalToSuperview().inset(12) + } + captionLabel.snp.makeConstraints { make in make.edges.equalToSuperview().inset(UIEdgeInsets(top: 5, left: 7, bottom: 5, right: 7)) } + + expandButton.setImage(UIImage(systemName: "arrow.up.left.and.arrow.down.right"), for: .normal) + expandButton.tintColor = .white + expandButton.backgroundColor = UIColor.black.withAlphaComponent(0.35) + expandButton.layer.cornerRadius = 18 + expandButton.accessibilityLabel = "放大本地演示画面" + expandButton.accessibilityIdentifier = "drone.task.feed.expand" + expandButton.addTarget(self, action: #selector(expandTapped), for: .touchUpInside) + addSubview(expandButton) + + interruptionView.backgroundColor = UIColor(hex: 0xE9EEF6) + addSubview(interruptionView) + interruptionIcon.contentMode = .scaleAspectFit + interruptionIcon.tintColor = UIColor(hex: 0x8992A3) + interruptionTitle.textAlignment = .center + interruptionMessage.textAlignment = .center + interruptionMessage.numberOfLines = 0 + interruptionView.addSubview(interruptionIcon) + interruptionView.addSubview(interruptionTitle) + interruptionView.addSubview(interruptionMessage) + interruptionView.addSubview(reconnectButton) + reconnectButton.accessibilityIdentifier = "drone.task.feed.reconnect" + reconnectButton.addTarget(self, action: #selector(reconnectTapped), for: .touchUpInside) + } + + private func setupConstraints() { + imageView.snp.makeConstraints { make in make.edges.equalToSuperview() } + expandButton.snp.makeConstraints { make in + make.trailing.bottom.equalToSuperview().inset(12) + make.size.equalTo(36) + } + interruptionView.snp.makeConstraints { make in make.edges.equalToSuperview() } + interruptionIcon.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.centerY.equalToSuperview().offset(-49) + make.size.equalTo(30) + } + interruptionTitle.snp.makeConstraints { make in + make.top.equalTo(interruptionIcon.snp.bottom).offset(11) + make.leading.trailing.equalToSuperview().inset(16) + } + interruptionMessage.snp.makeConstraints { make in + make.top.equalTo(interruptionTitle.snp.bottom).offset(5) + make.leading.trailing.equalToSuperview().inset(18) + } + reconnectButton.snp.makeConstraints { make in + make.top.equalTo(interruptionMessage.snp.bottom).offset(11) + make.centerX.equalToSuperview() + make.height.equalTo(34) + } + } + + private func configureReconnect(title: String, enabled: Bool) { + var configuration = UIButton.Configuration.bordered() + configuration.title = title + configuration.baseForegroundColor = DroneDockStyle.primary + configuration.background.strokeColor = DroneDockStyle.primary.withAlphaComponent(0.5) + configuration.background.strokeWidth = 1 + configuration.background.backgroundColor = .clear + configuration.cornerStyle = .medium + configuration.contentInsets = NSDirectionalEdgeInsets(top: 6, leading: 16, bottom: 6, trailing: 16) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var outgoing = incoming + outgoing.font = .systemFont(ofSize: 12, weight: .medium) + return outgoing + } + reconnectButton.configuration = configuration + reconnectButton.isEnabled = enabled + } + + @objc private func expandTapped() { onExpand?() } + @objc private func reconnectTapped() { onReconnect?() } +} + +/// 任务页六项遥测格;手机断网或读数缺失时保留未知值。 +@MainActor +final class DroneShootingTaskTelemetryView: UIView { + private let stackView = UIStackView() + private let staleLabel = DroneDockStyle.label("ⓘ 状态暂未更新", size: 11, color: DroneDockStyle.secondary) + private var cells: [DroneShootingTaskTelemetryCell] = [] + private var rowHeights: [Constraint] = [] + private var contentEdges: Constraint? + private var usesFixedLayout = false + + /// 以两行三列固定展示电量、温度、风速、雨量、信号与搜星。 + override init(frame: CGRect) { + super.init(frame: frame) + backgroundColor = DroneDockStyle.background + stackView.axis = .vertical + stackView.spacing = 6 + stackView.alignment = .fill + addSubview(stackView) + stackView.addArrangedSubview(staleLabel) + let definitions = [ + ("电池电量", "battery.75percent"), ("环境温度", "thermometer.medium"), ("风速", "wind"), + ("雨量", "cloud.rain"), ("信号状态", "cellularbars"), ("搜星状态", "location.north.circle") + ] + for rowIndex in 0..<2 { + let row = UIStackView() + row.axis = .horizontal + row.distribution = .fillEqually + row.spacing = 6 + for columnIndex in 0..<3 { + let definition = definitions[rowIndex * 3 + columnIndex] + let cell = DroneShootingTaskTelemetryCell(title: definition.0, symbol: definition.1) + cells.append(cell) + row.addArrangedSubview(cell) + } + stackView.addArrangedSubview(row) + row.snp.makeConstraints { make in rowHeights.append(make.height.equalTo(55).constraint) } + } + stackView.snp.makeConstraints { make in contentEdges = make.edges.equalToSuperview().inset(10).constraint } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 固定任务页不增减状态提示行;小屏仅压缩格子间距与留白,六项参数位置保持稳定。 + func configureFixedLayout(compact: Bool) { + usesFixedLayout = true + staleLabel.isHidden = true + rowHeights.forEach { $0.update(offset: compact ? 46 : 55) } + stackView.spacing = compact ? 4 : 6 + contentEdges?.update(inset: compact ? 8 : 10) + } + + /// 新快照覆盖全部读数;不保留断网前的值冒充有效数据。 + func apply(telemetry: DroneDockTelemetry, isStale: Bool) { + apply(values: [telemetry.batteryText, telemetry.temperatureText, telemetry.windText, + telemetry.rainText, telemetry.signalText, telemetry.satelliteText], isStale: isStale) + } + + /// 展示后端格式化读数;缺项显示破折号,任务页可保留过期旧值并使用灰色提示。 + func apply(values: [String], isStale: Bool, accessibilityPrefix: String? = nil, preservingStaleValues: Bool = false) { + staleLabel.isHidden = usesFixedLayout || !isStale + let keys = ["battery", "temperature", "wind", "rain", "signal", "satellite"] + for (index, cell) in cells.enumerated() { + let value = (!isStale || preservingStaleValues) && values.indices.contains(index) + ? DroneDockHomeMetric.usableText(values[index]) ?? "—" : "—" + cell.apply(value: value, isStale: isStale) + if let accessibilityPrefix { cell.accessibilityIdentifier = "\(accessibilityPrefix).\(keys[index])" } + } + } +} + +/// 单项遥测读数,标题与图标保持稳定位置。 +@MainActor +private final class DroneShootingTaskTelemetryCell: UIView { + private let valueLabel = DroneDockStyle.label(size: 16, weight: .semibold) + private let iconView: UIImageView + + /// 创建标题、图标与数值的紧凑展示。 + init(title: String, symbol: String) { + iconView = UIImageView(image: UIImage(systemName: symbol)) + super.init(frame: .zero) + backgroundColor = .white + layer.cornerRadius = 7 + let titleLabel = DroneDockStyle.label(title, size: 11, color: DroneDockStyle.secondary) + titleLabel.textAlignment = .center + iconView.contentMode = .scaleAspectFit + let valueRow = UIStackView(arrangedSubviews: [iconView, valueLabel]) + valueRow.axis = .horizontal + valueRow.spacing = 6 + valueRow.alignment = .center + addSubview(titleLabel) + addSubview(valueRow) + iconView.snp.makeConstraints { make in make.size.equalTo(17) } + titleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(7) + make.leading.trailing.equalToSuperview().inset(4) + } + valueRow.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.top.equalTo(titleLabel.snp.bottom).offset(4) + make.leading.greaterThanOrEqualToSuperview().offset(4) + make.trailing.lessThanOrEqualToSuperview().offset(-4) + } + valueLabel.adjustsFontSizeToFitWidth = true + valueLabel.minimumScaleFactor = 0.8 + isAccessibilityElement = true + accessibilityLabel = title + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 更新数值和有效性,不根据电量自行推导执行许可。 + func apply(value: String, isStale: Bool) { + valueLabel.text = value + valueLabel.textColor = isStale ? DroneDockStyle.secondary : DroneDockStyle.text + iconView.tintColor = isStale ? DroneDockStyle.secondary : DroneDockStyle.primary + accessibilityValue = value + } +} + +/// 安全控制按钮,双行文案分别表达指令及当前执行状态。 +@MainActor +final class DroneShootingTaskSafetyButton: UIButton { + private let controlTitleLabel = DroneDockStyle.label(size: 15, weight: .semibold) + private let controlSubtitleLabel = DroneDockStyle.label(size: 10) + private let controlIconView: UIImageView + private let activityIndicator = UIActivityIndicatorView(style: .medium) + + /// 输出实际呈现的控件状态,供页面按变化记录;不推导业务许可。 + var diagnosticFields: [String: Any] { + ["title": controlTitleLabel.text ?? "", "subtitle": controlSubtitleLabel.text ?? "", + "enabled": isEnabled, "loading": activityIndicator.isAnimating, + "accessibility_value": accessibilityValue ?? ""] + } + + /// 创建暂停或返航按钮;返回状态只由 ViewModel 决定。 + init(symbol: String, color: UIColor, filled: Bool) { + controlIconView = UIImageView(image: UIImage(systemName: symbol)) + super.init(frame: .zero) + layer.cornerRadius = 9 + layer.borderWidth = filled ? 0 : 1 + layer.borderColor = color.withAlphaComponent(0.6).cgColor + backgroundColor = filled ? color : color.withAlphaComponent(0.05) + controlTitleLabel.textColor = filled ? .white : color + controlSubtitleLabel.textColor = filled ? UIColor.white.withAlphaComponent(0.85) : DroneDockStyle.secondary + controlIconView.tintColor = filled ? .white : color + controlIconView.contentMode = .scaleAspectFit + activityIndicator.color = filled ? .white : color + activityIndicator.hidesWhenStopped = true + activityIndicator.isUserInteractionEnabled = false + let titles = UIStackView(arrangedSubviews: [controlTitleLabel, controlSubtitleLabel]) + titles.axis = .vertical + titles.spacing = 3 + titles.alignment = .leading + let content = UIStackView(arrangedSubviews: [controlIconView, titles]) + content.axis = .horizontal + content.spacing = 10 + content.alignment = .center + content.isUserInteractionEnabled = false + addSubview(content) + content.snp.makeConstraints { make in + make.center.equalToSuperview() + make.leading.greaterThanOrEqualToSuperview().offset(9) + make.trailing.lessThanOrEqualToSuperview().offset(-9) + } + controlIconView.snp.makeConstraints { make in make.size.equalTo(27) } + addSubview(activityIndicator) + activityIndicator.snp.makeConstraints { make in + make.center.equalTo(controlIconView) + make.size.equalTo(27) + } + controlTitleLabel.adjustsFontSizeToFitWidth = true + controlTitleLabel.minimumScaleFactor = 0.8 + controlSubtitleLabel.adjustsFontSizeToFitWidth = true + controlSubtitleLabel.minimumScaleFactor = 0.8 + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 应用独立操作许可和加载状态;加载时仅替换本按钮图标,不改变布局或其他按钮。 + func apply(title: String, subtitle: String, enabled: Bool, isLoading: Bool = false) { + controlTitleLabel.text = title + controlSubtitleLabel.text = subtitle + isEnabled = enabled && !isLoading + alpha = enabled || isLoading ? 1 : 0.42 + controlIconView.alpha = isLoading ? 0 : 1 + if isLoading { activityIndicator.startAnimating() } + else { activityIndicator.stopAnimating() } + activityIndicator.accessibilityIdentifier = accessibilityIdentifier.map { "\($0).loading" } + accessibilityLabel = title + accessibilityValue = isLoading ? "处理中,\(subtitle)" : subtitle + } + + /// 切换同一位置的暂停/继续或返航/取消图标,不改变按钮布局。 + func setControlSymbol(_ symbol: String) { + controlIconView.image = UIImage(systemName: symbol) + } +} + +/// 任务本地静帧的全屏放大页,明确标记画面来源。 +@MainActor +final class DroneShootingTaskExpandedFeedViewController: UIViewController { + /// 显示同一张本地静帧;不建立视频连接。 + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = UIColor(hex: 0x141923) + let imageView = UIImageView(image: UIImage(named: "drone_demo_tourists")) + imageView.contentMode = .scaleAspectFill + imageView.clipsToBounds = true + imageView.accessibilityLabel = "游客取景示意,本地演示静帧" + let caption = DroneDockStyle.label("演示画面 · 本地静帧 · 16:9", size: 12, color: UIColor(hex: 0xA7AFBE)) + caption.textAlignment = .center + let close = UIButton(type: .system) + close.setImage(UIImage(systemName: "xmark"), for: .normal) + close.tintColor = .white + close.accessibilityLabel = "关闭放大画面" + close.accessibilityIdentifier = "drone.task.closeExpandedFeed" + close.addTarget(self, action: #selector(closeTapped), for: .touchUpInside) + view.addSubview(imageView) + view.addSubview(caption) + view.addSubview(close) + imageView.snp.makeConstraints { make in + make.leading.trailing.centerY.equalToSuperview() + make.height.equalTo(imageView.snp.width).multipliedBy(9.0 / 16.0) + } + caption.snp.makeConstraints { make in + make.top.equalTo(imageView.snp.bottom).offset(16) + make.leading.trailing.equalToSuperview().inset(20) + } + close.snp.makeConstraints { make in + make.top.trailing.equalTo(view.safeAreaLayoutGuide).inset(12) + make.size.equalTo(44) + } + } + + @objc private func closeTapped() { dismiss(animated: true) } +} diff --git a/suixinkan/UI/Home/AllFunctionsViewController.swift b/suixinkan/UI/Home/AllFunctionsViewController.swift index 1473cc6..079d949 100644 --- a/suixinkan/UI/Home/AllFunctionsViewController.swift +++ b/suixinkan/UI/Home/AllFunctionsViewController.swift @@ -58,8 +58,25 @@ final class AllFunctionsViewController: BaseViewController { override func setupNavigationBar() { title = "全部功能" + #if DEBUG + navigationItem.rightBarButtonItems = [ + UIBarButtonItem(title: "空镜预览", style: .plain, target: self, action: #selector(openScenicMaterialsPreview)), + UIBarButtonItem(title: "机巢预览", style: .plain, target: self, action: #selector(openDroneDockPreview)) + ] + #endif } + #if DEBUG + @objc private func openDroneDockPreview() { + navigationController?.pushViewController(DroneDockWorkbenchViewController(), animated: true) + } + + /// 空镜库作为独立模块预览,不经机巢工作台导航或业务状态。 + @objc private func openScenicMaterialsPreview() { + navigationController?.pushViewController(ScenicMaterialsViewController(), animated: true) + } + #endif + override func setupUI() { view.backgroundColor = AppColor.pageBackground @@ -100,13 +117,29 @@ final class AllFunctionsViewController: BaseViewController { self?.applyViewModel(animated: self?.hasAppliedInitialSnapshot == true) } } + NotificationCenter.default.addObserver( + self, + selector: #selector(reloadFunctions), + name: NotificationName.permissionItemsDidChange, + object: AppStore.shared.permissions + ) + NotificationCenter.default.addObserver( + self, + selector: #selector(reloadFunctions), + name: NotificationName.accountDidSwitch, + object: nil + ) } - override func viewDidLoad() { - super.viewDidLoad() + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) viewModel.loadFunctions() } + @objc private func reloadFunctions() { + Task { @MainActor [weak self] in self?.viewModel.loadFunctions() } + } + override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) if isMovingFromParent, viewModel.didCustomize { diff --git a/suixinkan/UI/Loading/GlobalLoadingManager.swift b/suixinkan/UI/Loading/GlobalLoadingManager.swift index bb382b9..47b3b7b 100644 --- a/suixinkan/UI/Loading/GlobalLoadingManager.swift +++ b/suixinkan/UI/Loading/GlobalLoadingManager.swift @@ -12,6 +12,7 @@ final class GlobalLoadingManager { static let shared = GlobalLoadingManager() private var loadingCount = 0 + private var requestTokens: Set = [] private weak var hostWindow: UIWindow? private var overlayView: GlobalLoadingOverlayView? @@ -19,13 +20,14 @@ final class GlobalLoadingManager { /// 当前是否正在展示 Loading。 var isShowing: Bool { - loadingCount > 0 + loadingCount > 0 || !requestTokens.isEmpty } /// 增加 Loading 引用计数并展示遮罩。 func show() { + let wasShowing = isShowing loadingCount += 1 - guard loadingCount == 1 else { return } + guard !wasShowing else { return } attachOverlayIfNeeded() overlayView?.present() } @@ -34,18 +36,41 @@ final class GlobalLoadingManager { func hide() { guard loadingCount > 0 else { return } loadingCount -= 1 - guard loadingCount == 0 else { return } - overlayView?.dismiss() - overlayView?.removeFromSuperview() + dismissOverlayIfIdle() + } + + /// 为一次请求持有 Loading;使用令牌避免迟到回调结束其它请求的展示。 + func beginRequest() -> UUID { + let token = UUID() + let wasShowing = isShowing + requestTokens.insert(token) + if !wasShowing { + attachOverlayIfNeeded() + overlayView?.present() + } + return token + } + + /// 仅结束仍有效的请求令牌,重复结束或 hideAll 后的旧令牌均无副作用。 + func endRequest(_ token: UUID) { + guard requestTokens.remove(token) != nil else { return } + dismissOverlayIfIdle() } /// 强制关闭所有 Loading。 func hideAll() { + requestTokens = [] loadingCount = 0 overlayView?.dismiss() overlayView?.removeFromSuperview() } + private func dismissOverlayIfIdle() { + guard !isShowing else { return } + overlayView?.dismiss() + overlayView?.removeFromSuperview() + } + private func attachOverlayIfNeeded() { guard let window = keyWindow else { return } hostWindow = window diff --git a/suixinkan/UI/Loading/GlobalLoadingPageViewController.swift b/suixinkan/UI/Loading/GlobalLoadingPageViewController.swift new file mode 100644 index 0000000..2a35de0 --- /dev/null +++ b/suixinkan/UI/Loading/GlobalLoadingPageViewController.swift @@ -0,0 +1,62 @@ +import UIKit + +/// 将页面的阻塞读取接入应用通用 Loading,离页或后台仅释放本页令牌。 +@MainActor +class GlobalLoadingPageViewController: BaseViewController { + private var requestsPageLoading = false + private var pageIsVisible = false + private var applicationIsActive = UIApplication.shared.applicationState == .active + private var pageLoadingToken: UUID? + + override func viewDidLoad() { + super.viewDidLoad() + NotificationCenter.default.addObserver(self, selector: #selector(loadingApplicationWillResignActive), + name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(loadingApplicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, object: nil) + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + pageIsVisible = true + applicationIsActive = UIApplication.shared.applicationState == .active + updatePageLoading() + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + pageIsVisible = false + updatePageLoading() + } + + deinit { + if let token = pageLoadingToken { + Task { @MainActor in GlobalLoadingManager.shared.endRequest(token) } + } + } + + /// 仅首次无可用内容或需要等待的页面读取使用;轮询、分页及按钮进度保持局部反馈。 + func setPageLoading(_ isLoading: Bool) { + requestsPageLoading = isLoading + updatePageLoading() + } + + @objc private func loadingApplicationWillResignActive() { + applicationIsActive = false + updatePageLoading() + } + + @objc private func loadingApplicationDidBecomeActive() { + applicationIsActive = true + updatePageLoading() + } + + private func updatePageLoading() { + if requestsPageLoading && pageIsVisible && applicationIsActive { + if pageLoadingToken == nil { pageLoadingToken = GlobalLoadingManager.shared.beginRequest() } + } else if let token = pageLoadingToken { + pageLoadingToken = nil + GlobalLoadingManager.shared.endRequest(token) + } + } +} diff --git a/suixinkan/UI/MainTab/MainTabBarController.swift b/suixinkan/UI/MainTab/MainTabBarController.swift index 07d0aff..d35cc23 100644 --- a/suixinkan/UI/MainTab/MainTabBarController.swift +++ b/suixinkan/UI/MainTab/MainTabBarController.swift @@ -67,16 +67,20 @@ final class MainTabBarController: UITabBarController { /// 响应推送点击,切换到目标 Tab 并打开对应业务页面。 func openPushDestination(_ destination: PushDestination) { - let targetTab = AppTab.home + loadViewIfNeeded() + let targetTab: AppTab = destination == .orders ? .orders : .home + let wasAlreadyOnOrders = targetTab == .orders && selectedViewController === tabNavigationControllers[.orders] selectTab(targetTab) guard let navigationController = tabNavigationControllers[targetTab] else { return } _ = navigationController.popToRootViewController(animated: false) let controller: UIViewController? switch destination { - case .paymentRecord: - controller = PaymentCollectionRecordViewController() + case .orders: + (navigationController.viewControllers.first as? OrdersViewController)?.openFromOrderNotification() + if wasAlreadyOnOrders { badgeViewModel.refreshPendingWriteOffCount() } + controller = nil case .paymentDetails: controller = PaymentCollectionDetailsViewController() case .messageCenter: diff --git a/suixinkan/UI/OfflineCollection/OfflineCollectionRegistrationViewController.swift b/suixinkan/UI/OfflineCollection/OfflineCollectionRegistrationViewController.swift index 9e3b7d6..51e466f 100644 --- a/suixinkan/UI/OfflineCollection/OfflineCollectionRegistrationViewController.swift +++ b/suixinkan/UI/OfflineCollection/OfflineCollectionRegistrationViewController.swift @@ -338,7 +338,7 @@ final class OfflineCollectionRegistrationViewController: BaseViewController { } @objc private func quickAmountTapped(_ sender: UIButton) { - viewModel.updateAmount(OfflineCollectionMoney.apiAmount(sender.tag)) + viewModel.updateAmount(OfflineCollectionMoney.displayAmount(sender.tag)) amountField.becomeFirstResponder() moveAmountCursorToEnd() } diff --git a/suixinkan/UI/Orders/OrderCardCell.swift b/suixinkan/UI/Orders/OrderCardCell.swift index 7052427..42947d4 100644 --- a/suixinkan/UI/Orders/OrderCardCell.swift +++ b/suixinkan/UI/Orders/OrderCardCell.swift @@ -87,7 +87,10 @@ final class OrderCardCell: UITableViewCell { createdAtLabel.text = order.createdAt.isEmpty ? "--" : order.createdAt typeChip.apply(text: order.orderTypeLabel) - let showRefund = !hideWriteActions && (order.orderStatus == 18 || order.orderStatus == 30) && order.orderType != 19 + let showRefund = !hideWriteActions && order.orderType != 19 && ( + order.orderStatus == 18 || order.orderStatus == 30 + || (order.orderType == 25 && order.orderStatus == 20) + ) let showVerify = !hideWriteActions && ( (order.photoTravel?.needCheckIn == true && order.orderStatus != 30) || order.orderType == 19 ) diff --git a/suixinkan/UI/Orders/OrdersViewController.swift b/suixinkan/UI/Orders/OrdersViewController.swift index 50ee754..cc8635c 100644 --- a/suixinkan/UI/Orders/OrdersViewController.swift +++ b/suixinkan/UI/Orders/OrdersViewController.swift @@ -8,17 +8,64 @@ import SnapKit import UIKit /// 订单 Tab 根页面,按角色分流摄影师/景区管理员/店铺管理员。 -final class OrdersViewController: BaseViewController, UITableViewDataSource, UITableViewDelegate { +final class OrdersViewController: BaseViewController, UITableViewDelegate { - private let orderAPI = NetworkServices.shared.orderAPI - private let orderListViewModel = OrderListViewModel() - private let depositViewModel = DepositOrderListViewModel() + private let appStore: AppStore + private let orderAPI: OrderAPI + private let orderListViewModel: OrderListViewModel + private let depositViewModel: DepositOrderListViewModel + + /// 表格快照持有完整行数据,避免刷新清空 ViewModel 后仍按旧行号取值。 + private struct OrderRow: Hashable { + /// 同一快照内按位置区分行,兼容接口返回重复订单号。 + let position: Int + let content: Content + + /// 摄影师和店铺订单的不可变展示数据。 + enum Content: Equatable { + case photographer(OrderEntity, source: OrderSourceSelection?, readOnly: Bool, showSource: Bool) + case deposit(StoreOrderItem) + } + + func hash(into hasher: inout Hasher) { + hasher.combine(position) + switch content { + case .photographer(let order, _, _, _): + hasher.combine(0) + hasher.combine(order.orderNumber) + case .deposit(let order): + hasher.combine(1) + hasher.combine(order.orderNumber) + } + } + } + + private var dataSource: UITableViewDiffableDataSource? + + /// 注入订单数据依赖;默认使用应用共享 API 和独立的页面 ViewModel。 + init( + orderAPI: OrderAPI? = nil, + orderListViewModel: OrderListViewModel? = nil, + depositViewModel: DepositOrderListViewModel? = nil, + appStore: AppStore = .shared + ) { + self.appStore = appStore + self.orderAPI = orderAPI ?? NetworkServices.shared.orderAPI + self.orderListViewModel = orderListViewModel ?? OrderListViewModel(appStore: appStore) + self.depositViewModel = depositViewModel ?? DepositOrderListViewModel(appStore: appStore) + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } private let filterBar = OrderFilterBarView() private let listView = OrderListView() private var hasInitialized = false - private var isStoreMode: Bool { AppStore.shared.session.currentAppRole == .storeAdmin } + private var isStoreMode: Bool { appStore.session.currentAppRole == .storeAdmin } private var pendingOrderSourceNumber: String? private weak var orderSourcePicker: OrderSourcePickerViewController? private var pendingGiftOrderNumber: String? @@ -32,10 +79,10 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT override func setupUI() { view.addSubview(filterBar) view.addSubview(listView) - listView.tableView.dataSource = self listView.tableView.delegate = self listView.tableView.register(OrderCardCell.self, forCellReuseIdentifier: OrderCardCell.reuseIdentifier) listView.tableView.register(DepositOrderCardCell.self, forCellReuseIdentifier: DepositOrderCardCell.reuseIdentifier) + configureDataSource() } override func setupConstraints() { @@ -133,6 +180,21 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT Task { await initializeList() } } + /// 从订单通知进入时恢复默认查询,并刷新已有或首次打开的列表。 + func openFromOrderNotification() { + loadViewIfNeeded() + hasInitialized = true + if isStoreMode { + depositViewModel.resetFiltersForOrderNotification() + } else { + orderListViewModel.resetFiltersForOrderNotification() + } + applyViewModel() + Task { @MainActor [weak self] in + await self?.initializeList() + } + } + private func initializeList() async { if isStoreMode { await depositViewModel.refreshOrderList(api: orderAPI) @@ -142,6 +204,7 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT } private func applyViewModel() { + applyOrderSnapshot() if isStoreMode { filterBar.configure( isStoreMode: true, @@ -191,7 +254,6 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT presentMultiVerifySheet() } } - listView.tableView.reloadData() } private func dateRangeText(start: Date?, end: Date?) -> String { @@ -314,31 +376,60 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT // MARK: - UITableView - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - isStoreMode ? depositViewModel.orderList.count : orderListViewModel.orderList.count + private func configureDataSource() { + dataSource = UITableViewDiffableDataSource(tableView: listView.tableView) { [weak self] tableView, _, row in + guard let self else { return nil } + switch row.content { + case .deposit(let item): + let cell = tableView.dequeueReusableCell(withIdentifier: DepositOrderCardCell.reuseIdentifier) as! DepositOrderCardCell + cell.configure(item: item, actions: self.makeDepositActions(for: item)) + return cell + case .photographer(let order, let source, let readOnly, let showSource): + let cell = tableView.dequeueReusableCell(withIdentifier: OrderCardCell.reuseIdentifier) as! OrderCardCell + cell.configure( + order: order, + hideWriteActions: readOnly, + actions: self.makeOrderActions(for: order), + showOrderSource: showSource, + sourceSelection: source + ) + return cell + } + } } - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + private func applyOrderSnapshot() { + let rows: [OrderRow] if isStoreMode { - let cell = tableView.dequeueReusableCell(withIdentifier: DepositOrderCardCell.reuseIdentifier, for: indexPath) as! DepositOrderCardCell - let item = depositViewModel.orderList[indexPath.row] - cell.configure(item: item, actions: makeDepositActions(for: item)) - listView.notifyLoadMoreIfNeeded(at: indexPath.row, shouldLoad: depositViewModel.shouldLoadMore(at: indexPath.row)) - return cell + rows = depositViewModel.orderList.enumerated().map { + OrderRow(position: $0.offset, content: .deposit($0.element)) + } + } else { + rows = orderListViewModel.orderList.enumerated().map { index, order in + OrderRow(position: index, content: .photographer( + order, + source: orderListViewModel.orderSourceSelection(for: order), + readOnly: orderListViewModel.isScenicAdminReadOnly, + showSource: orderListViewModel.shouldShowOrderSource(for: order) + )) + } } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + snapshot.appendItems(rows) + dataSource?.apply(snapshot, animatingDifferences: true) + } - let cell = tableView.dequeueReusableCell(withIdentifier: OrderCardCell.reuseIdentifier, for: indexPath) as! OrderCardCell - let order = orderListViewModel.orderList[indexPath.row] - let source = orderListViewModel.orderSourceSelection(for: order) - cell.configure( - order: order, - hideWriteActions: orderListViewModel.isScenicAdminReadOnly, - actions: makeOrderActions(for: order), - showOrderSource: orderListViewModel.shouldShowOrderSource(for: order), - sourceSelection: source - ) - listView.notifyLoadMoreIfNeeded(at: indexPath.row, shouldLoad: orderListViewModel.shouldLoadMore(at: indexPath.row)) - return cell + func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { + guard let row = dataSource?.itemIdentifier(for: indexPath) else { return } + let shouldLoad: Bool + switch row.content { + case .deposit: + shouldLoad = isStoreMode && depositViewModel.shouldLoadMore(at: row.position) + case .photographer: + shouldLoad = !isStoreMode && orderListViewModel.shouldLoadMore(at: row.position) + } + listView.notifyLoadMoreIfNeeded(at: row.position, shouldLoad: shouldLoad) } private func makeOrderActions(for order: OrderEntity) -> OrderCardActions { diff --git a/suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift b/suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift index 69f5dc3..a8d93e9 100644 --- a/suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift +++ b/suixinkan/UI/Payment/PaymentCollectionDetailsViewController.swift @@ -101,15 +101,16 @@ final class PaymentCollectionDetailsViewController: BaseViewController { } override func setupNavigationBar() { - title = viewModel.usesNalatiBranding ? nil : "收款详情" + title = viewModel.usesBranding ? nil : "收款详情" } override func setupUI() { - let usesBranding = viewModel.usesNalatiBranding + let usesBranding = viewModel.usesBranding view.backgroundColor = usesBranding ? .clear : AppColor.pageBackground scrollView.showsVerticalScrollIndicator = !usesBranding scrollView.isScrollEnabled = true scrollView.alwaysBounceVertical = true + scrollView.contentInsetAdjustmentBehavior = .always contentStack.axis = .vertical contentStack.spacing = usesBranding ? brandSectionSpacing : AppSpacing.md @@ -187,7 +188,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { configureBrandHeader() backgroundImageView.contentMode = .scaleAspectFill backgroundImageView.clipsToBounds = true - backgroundImageView.image = UIImage(named: "payment_nalati_background") + backgroundImageView.image = UIImage(named: viewModel.brandBackgroundAssetName) view.addSubview(backgroundImageView) } @@ -320,30 +321,24 @@ final class PaymentCollectionDetailsViewController: BaseViewController { } override func setupConstraints() { - if viewModel.usesNalatiBranding { + if viewModel.usesBranding { backgroundImageView.snp.makeConstraints { make in make.edges.equalToSuperview() } } scrollView.snp.makeConstraints { make in - if viewModel.usesNalatiBranding { - make.leading.trailing.equalToSuperview() - make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(-44) - make.bottom.equalTo(view.safeAreaLayoutGuide) - } else { - make.edges.equalTo(view.safeAreaLayoutGuide) - } + make.edges.equalToSuperview() } contentContainerView.snp.makeConstraints { make in - make.edges.equalToSuperview() - make.width.equalTo(scrollView.snp.width) - if viewModel.usesNalatiBranding { + make.edges.equalTo(scrollView.contentLayoutGuide) + make.width.equalTo(scrollView.frameLayoutGuide) + if viewModel.usesBranding { make.height.greaterThanOrEqualTo(scrollView.snp.height) } } contentStack.snp.makeConstraints { make in make.width.equalTo(scrollView.snp.width).offset(-AppSpacing.screenHorizontalInset * 2) - if viewModel.usesNalatiBranding { + if viewModel.usesBranding { make.centerX.equalToSuperview() make.top.bottom.equalToSuperview().inset(AppSpacing.screenHorizontalInset) } else { @@ -403,7 +398,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { } override var preferredStatusBarStyle: UIStatusBarStyle { - viewModel.usesNalatiBranding ? .darkContent : .default + viewModel.usesBranding ? .darkContent : .default } private func loadData() async { @@ -426,7 +421,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { if viewModel.isPayCodeLoading { qrImageView.isHidden = true qrContainerView.isHidden = true - qrPlaceholderView.backgroundColor = viewModel.usesNalatiBranding + qrPlaceholderView.backgroundColor = viewModel.usesBranding ? .white : AppColor.inputBackground qrPlaceholderView.isHidden = false @@ -437,7 +432,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { } else if let image = viewModel.qrImage { qrImageView.image = image qrImageView.isHidden = false - qrContainerView.isHidden = !viewModel.usesNalatiBranding + qrContainerView.isHidden = !viewModel.usesBranding qrPlaceholderView.isHidden = true qrLoadingIndicator.stopAnimating() setActionRowAvailable(true) @@ -527,7 +522,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { brandHeaderStack.alignment = .center brandHeaderStack.spacing = brandScreenHeight <= 700 ? 6 : 8 - brandLogoImageView.image = UIImage(named: "payment_nalati_logo") + brandLogoImageView.image = UIImage(named: viewModel.brandLogoAssetName) brandLogoImageView.contentMode = .scaleAspectFit brandLogoImageView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) @@ -537,7 +532,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { ) brandTitleLabel.textColor = UIColor(hex: 0x102D54) brandTitleLabel.textAlignment = .center - brandTitleLabel.numberOfLines = 1 + brandTitleLabel.numberOfLines = viewModel.brandTitleNumberOfLines brandTitleLabel.adjustsFontSizeToFitWidth = true brandTitleLabel.minimumScaleFactor = 0.8 @@ -604,7 +599,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { @MainActor private func applyBrandConfigIfNeeded() { - guard viewModel.usesNalatiBranding else { return } + guard viewModel.usesBranding else { return } let config = viewModel.payPageConfig brandTitleLabel.text = config.title brandSubtitleLabel.text = config.subtitle @@ -615,13 +610,13 @@ final class PaymentCollectionDetailsViewController: BaseViewController { setBrandImage( backgroundImageView, urlString: config.background, - fallbackName: "payment_nalati_background", + fallbackName: viewModel.brandBackgroundAssetName, forceRefresh: forceRefresh ) setBrandImage( brandLogoImageView, urlString: config.logo, - fallbackName: "payment_nalati_logo", + fallbackName: viewModel.brandLogoAssetName, forceRefresh: forceRefresh ) appliedBrandConfig = config @@ -639,6 +634,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { guard let url = URL(string: trimmed), url.scheme?.lowercased() == "https", url.host != nil else { + imageView.kf.cancelDownloadTask() imageView.image = fallback return } @@ -655,7 +651,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { } private func applyBrandNavigationAppearanceIfNeeded() { - guard viewModel.usesNalatiBranding, let navigationBar = navigationController?.navigationBar else { return } + guard viewModel.usesBranding, let navigationBar = navigationController?.navigationBar else { return } previousStandardAppearance = navigationBar.standardAppearance previousScrollEdgeAppearance = navigationBar.scrollEdgeAppearance previousCompactAppearance = navigationBar.compactAppearance @@ -677,7 +673,7 @@ final class PaymentCollectionDetailsViewController: BaseViewController { } private func restoreNavigationAppearanceIfNeeded() { - guard viewModel.usesNalatiBranding, let navigationBar = navigationController?.navigationBar else { return } + guard viewModel.usesBranding, let navigationBar = navigationController?.navigationBar else { return } if let previousStandardAppearance { navigationBar.standardAppearance = previousStandardAppearance } diff --git a/suixinkan/UI/Payment/Views/PaymentSetAmountDialogView.swift b/suixinkan/UI/Payment/Views/PaymentSetAmountDialogView.swift index 3301aea..f57316e 100644 --- a/suixinkan/UI/Payment/Views/PaymentSetAmountDialogView.swift +++ b/suixinkan/UI/Payment/Views/PaymentSetAmountDialogView.swift @@ -47,6 +47,21 @@ final class PaymentSetAmountDialogView: KeyboardAvoidingDialogView { remarkCountLabel.text = "\(remark.count)/200" } + /// 套餐报价复用金额输入与键盘避让;接口不支持备注时隐藏对应区域。 + func configureAmountOnly(accessibilityPrefix: String) { + remarkTitleLabel.isHidden = true + remarkField.isHidden = true + remarkCountLabel.isHidden = true + buttonStack.snp.remakeConstraints { make in + make.top.equalTo(amountContainer.snp.bottom).offset(AppSpacing.lg) + make.leading.trailing.bottom.equalToSuperview().inset(AppSpacing.md) + make.height.equalTo(44) + } + amountField.accessibilityIdentifier = accessibilityPrefix + ".input" + confirmButton.accessibilityIdentifier = accessibilityPrefix + ".confirm" + cancelButton.accessibilityIdentifier = accessibilityPrefix + ".cancel" + } + func show(in parent: UIView) { frame = parent.bounds autoresizingMask = [.flexibleWidth, .flexibleHeight] diff --git a/suixinkan/UI/Profile/ProfileViewController.swift b/suixinkan/UI/Profile/ProfileViewController.swift index af535dc..eb1e819 100644 --- a/suixinkan/UI/Profile/ProfileViewController.swift +++ b/suixinkan/UI/Profile/ProfileViewController.swift @@ -30,6 +30,7 @@ final class ProfileViewController: BaseViewController { private let realNameRow = ProfileInfoRowView(title: "认证状态") private let statusRow = ProfileInfoRowView(title: "账号状态") private let scenicRow = ProfileInfoRowView(title: "当前景区") + private let trainingRow = ProfileInfoRowView(title: "培训中心") private let settingRow = ProfileInfoRowView(title: "设置中心") private let logoutButton = UIButton(type: .system) private var hasLoadedProfileOnce = false @@ -92,6 +93,7 @@ final class ProfileViewController: BaseViewController { withdrawalRow.addTarget(self, action: #selector(withdrawalTapped), for: .touchUpInside) realNameRow.addTarget(self, action: #selector(realNameTapped), for: .touchUpInside) settingRow.addTarget(self, action: #selector(settingTapped), for: .touchUpInside) + trainingRow.addTarget(self, action: #selector(trainingTapped), for: .touchUpInside) NotificationCenter.default.addObserver( self, @@ -105,10 +107,17 @@ final class ProfileViewController: BaseViewController { name: NotificationName.userProfileDidUpdate, object: nil ) + NotificationCenter.default.addObserver( + self, + selector: #selector(handlePermissionItemsDidChange), + name: NotificationName.permissionItemsDidChange, + object: AppStore.shared.permissions + ) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + applyViewModel() let showLoading = !hasLoadedProfileOnce && !viewModel.hasCachedBasicInfo Task { await reloadProfile(showGlobalLoading: showLoading) @@ -183,7 +192,7 @@ final class ProfileViewController: BaseViewController { [ nameRow, accountRow, phoneRow, withdrawalRow, passwordRow, realNameRow, statusRow, scenicRow, - settingRow + trainingRow, settingRow ].forEach { infoCard.addArrangedSubview($0) } nameRow.isUserInteractionEnabled = false @@ -202,6 +211,8 @@ final class ProfileViewController: BaseViewController { } private func applyViewModel() { + trainingRow.isHidden = !viewModel.showsTrainingEntry + trainingRow.configure(value: "学习课程与答题", accessory: .chevron) nicknameField.text = viewModel.displayNickname uidLabel.text = "UID:\(viewModel.displayUID)" avatarImageView.loadRemoteImage(urlString: viewModel.displayAvatarURL) @@ -289,9 +300,14 @@ final class ProfileViewController: BaseViewController { } @objc private func handleAccountDidSwitch() { + applyViewModel() Task { await reloadProfile(showGlobalLoading: true) } } + @objc private func handlePermissionItemsDidChange() { + Task { @MainActor [weak self] in self?.applyViewModel() } + } + @objc private func handleProfileDidUpdate() { viewModel.applyLocalProfileUpdate() applyViewModel() @@ -353,6 +369,10 @@ final class ProfileViewController: BaseViewController { navigationController?.pushViewController(SettingViewController(), animated: true) } + @objc private func trainingTapped() { + HomeRouteHandler.open(uri: "/training", from: self, storeItem: nil) + } + @objc private func logoutTapped() { let alert = UIAlertController(title: "确定退出登录?", message: "退出后将需要重新登录", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "取消", style: .cancel)) diff --git a/suixinkan/UI/Scan/QRCodeCaptureSessionController.swift b/suixinkan/UI/Scan/QRCodeCaptureSessionController.swift new file mode 100644 index 0000000..d217eb7 --- /dev/null +++ b/suixinkan/UI/Scan/QRCodeCaptureSessionController.swift @@ -0,0 +1,56 @@ +import AVFoundation + +/// 扫码采集会话的配置与运行接口,便于独立验证生命周期顺序。 +protocol QRCodeCaptureSession: AnyObject { + /// 当前是否正在采集。 + var isRunning: Bool { get } + /// 开始批量配置。 + func beginConfiguration() + /// 提交批量配置。 + func commitConfiguration() + /// 启动采集。 + func startRunning() + /// 停止采集。 + func stopRunning() +} + +extension AVCaptureSession: QRCodeCaptureSession {} + +/// 在同一串行队列中配置和启停相机,避免配置提交与启动交叉执行。 +final class QRCodeCaptureSessionController { + private let session: QRCodeCaptureSession + private let queue: DispatchQueue + private var isConfigured = false + + /// 创建会话生命周期控制器;队列必须为串行队列。 + init(session: QRCodeCaptureSession, + queue: DispatchQueue = DispatchQueue(label: "com.zhifly.suixinkan.qr-capture")) { + self.session = session + self.queue = queue + } + + /// 在配置事务内添加输入输出,提交完成后在主线程通知结果。 + func configure(_ configuration: @escaping () -> Bool, completion: @escaping (Bool) -> Void) { + queue.async { [self] in + if !isConfigured { + session.beginConfiguration() + isConfigured = configuration() + session.commitConfiguration() + } + let succeeded = isConfigured + DispatchQueue.main.async { completion(succeeded) } + } + } + + /// 按提交顺序更新运行状态,运行状态的读取也限定在会话队列内。 + func setRunning(_ shouldRun: Bool) { + queue.async { [self] in + if shouldRun { + guard isConfigured, !session.isRunning else { return } + session.startRunning() + } else if session.isRunning { + session.stopRunning() + } + } + } +} diff --git a/suixinkan/UI/Scan/QRCodeScannerViewController.swift b/suixinkan/UI/Scan/QRCodeScannerViewController.swift index 54c38e4..884c554 100644 --- a/suixinkan/UI/Scan/QRCodeScannerViewController.swift +++ b/suixinkan/UI/Scan/QRCodeScannerViewController.swift @@ -10,11 +10,15 @@ import UIKit /// AVFoundation 二维码扫描页。 final class QRCodeScannerViewController: BaseViewController, AVCaptureMetadataOutputObjectsDelegate { + /// 识别到有效二维码后返回内容,每次展示仅回调一次。 var onScanResult: ((String) -> Void)? private let captureSession = AVCaptureSession() + private lazy var captureController = QRCodeCaptureSessionController(session: captureSession) private var previewLayer: AVCaptureVideoPreviewLayer? private var isCameraConfigured = false + private var isCameraConfiguring = false + private var isScannerVisible = false private var hasHandledResult = false private let maskView = UIView() @@ -63,6 +67,7 @@ final class QRCodeScannerViewController: BaseViewController, AVCaptureMetadataOu override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + isScannerVisible = true updatePreviewLayout() startCaptureSessionIfNeeded() } @@ -75,6 +80,7 @@ final class QRCodeScannerViewController: BaseViewController, AVCaptureMetadataOu override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) + isScannerVisible = false stopCaptureSession() } @@ -105,32 +111,44 @@ final class QRCodeScannerViewController: BaseViewController, AVCaptureMetadataOu return } - guard let device = AVCaptureDevice.default(for: .video), - let input = try? AVCaptureDeviceInput(device: device) else { - showToast("无法打开相机") - return - } + guard !isCameraConfiguring else { return } + isCameraConfiguring = true + captureController.configure({ [weak self, captureSession] in + guard let self, + let device = AVCaptureDevice.default(for: .video), + let input = try? AVCaptureDeviceInput(device: device), + captureSession.canAddInput(input) else { return false } + captureSession.addInput(input) - captureSession.beginConfiguration() - defer { captureSession.commitConfiguration() } - - guard captureSession.canAddInput(input) else { return } - captureSession.addInput(input) - - let output = AVCaptureMetadataOutput() - guard captureSession.canAddOutput(output) else { return } - captureSession.addOutput(output) - output.setMetadataObjectsDelegate(self, queue: DispatchQueue.main) - output.metadataObjectTypes = [.qr] - - let layer = AVCaptureVideoPreviewLayer(session: captureSession) - layer.videoGravity = .resizeAspectFill - view.layer.insertSublayer(layer, at: 0) - previewLayer = layer - isCameraConfigured = true - - updatePreviewLayout() - startCaptureSessionIfNeeded() + let output = AVCaptureMetadataOutput() + guard captureSession.canAddOutput(output) else { + captureSession.removeInput(input) + return false + } + captureSession.addOutput(output) + guard output.availableMetadataObjectTypes.contains(.qr) else { + captureSession.removeOutput(output) + captureSession.removeInput(input) + return false + } + output.setMetadataObjectsDelegate(self, queue: .main) + output.metadataObjectTypes = [.qr] + return true + }, completion: { [weak self] succeeded in + guard let self else { return } + self.isCameraConfiguring = false + guard succeeded else { + self.showToast("无法打开相机") + return + } + let layer = AVCaptureVideoPreviewLayer(session: self.captureSession) + layer.videoGravity = .resizeAspectFill + self.view.layer.insertSublayer(layer, at: 0) + self.previewLayer = layer + self.isCameraConfigured = true + self.updatePreviewLayout() + self.startCaptureSessionIfNeeded() + }) } private func updatePreviewLayout() { @@ -138,17 +156,12 @@ final class QRCodeScannerViewController: BaseViewController, AVCaptureMetadataOu } private func startCaptureSessionIfNeeded() { - guard isCameraConfigured, !captureSession.isRunning else { return } - DispatchQueue.global(qos: .userInitiated).async { [weak self] in - self?.captureSession.startRunning() - } + guard isScannerVisible, isCameraConfigured, !hasHandledResult else { return } + captureController.setRunning(true) } private func stopCaptureSession() { - guard captureSession.isRunning else { return } - DispatchQueue.global(qos: .userInitiated).async { [weak self] in - self?.captureSession.stopRunning() - } + captureController.setRunning(false) } private func updateMask() { diff --git a/suixinkan/UI/ScenicMaterials/ScenicMaterialComponents.swift b/suixinkan/UI/ScenicMaterials/ScenicMaterialComponents.swift new file mode 100644 index 0000000..e266281 --- /dev/null +++ b/suixinkan/UI/ScenicMaterials/ScenicMaterialComponents.swift @@ -0,0 +1,455 @@ +import Kingfisher +import SnapKit +import UIKit + +/// 景区素材模块的局部样式,可独立于机巢业务使用。 +@MainActor +enum ScenicMaterialsStyle { + static let primary = UIColor(hex: 0x066BFF) + static let background = UIColor.white + static let text = UIColor(hex: 0x151515) + static let secondary = UIColor(hex: 0x8490A5) + static let border = UIColor(hex: 0xE7E9EF) + static let success = UIColor(hex: 0x17986A) + static let warning = UIColor(hex: 0xD98926) + + /// 创建模块内使用的系统字体标签。 + static func label(_ text: String? = nil, size: CGFloat = 14, weight: UIFont.Weight = .regular, + color: UIColor? = nil) -> UILabel { + let label = UILabel() + label.text = text + label.font = .systemFont(ofSize: size, weight: weight) + label.textColor = color ?? ScenicMaterialsStyle.text + return label + } +} + +/// 视频封面底部渐变,只用于保证白色元信息在照片上的对比度。 +@MainActor +private final class ScenicMaterialGradientView: UIView { + override class var layerClass: AnyClass { CAGradientLayer.self } + + override init(frame: CGRect) { + super.init(frame: frame) + isUserInteractionEnabled = false + if let gradient = layer as? CAGradientLayer { + gradient.colors = [UIColor.clear.cgColor, UIColor.black.withAlphaComponent(0.68).cgColor] + gradient.locations = [0, 1] + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } +} + +/// 景区空镜片段卡,预览和选择分别命中,下载期间仍可预览。 +@MainActor +final class ScenicMaterialClipCell: UICollectionViewCell { + /// 请求预览当前片段,不改变选择状态。 + var onPreview: (() -> Void)? + /// 请求切换当前片段的勾选状态。 + var onToggleSelection: (() -> Void)? + + private let cover = UIImageView() + private let previewButton = UIButton(type: .custom) + private let selectionButton = UIButton(type: .custom) + private let ordinalLabel = ScenicMaterialsStyle.label(size: 11, color: .white) + private let metadataLabel = ScenicMaterialsStyle.label(size: 11, color: .white) + private let statusLabel = ScenicMaterialsStyle.label(size: 10, weight: .medium, color: .white) + private let progressView = UIProgressView(progressViewStyle: .bar) + + /// 创建圆角图片卡和独立的四十四点选择命中区。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + super.prepareForReuse() + onPreview = nil + onToggleSelection = nil + cover.image = nil + progressView.isHidden = true + statusLabel.isHidden = true + } + + /// 显示片段及本机演示传输状态;首段大图展示时长和文件大小。 + func configure(clip: ScenicMaterialClip, selected: Bool, isSelectionEnabled: Bool, + statusText: String? = nil, progress: Double? = nil, isHero: Bool = false) { + cover.kf.cancelDownloadTask() + if clip.isRemote { + cover.kf.setImage(with: clip.coverURL, placeholder: UIImage(systemName: "photo")) + } else { cover.image = UIImage(named: clip.coverAssetName) } + ordinalLabel.text = clip.fileLabel ?? String(format: "片段 %02d", clip.ordinal) + metadataLabel.text = isHero ? "\(clip.durationText) · \(clip.sizeText)" : clip.durationText + metadataLabel.font = .monospacedDigitSystemFont(ofSize: isHero ? 11 : 10, weight: .regular) + selectionButton.setImage(MaterialSelectionIcon.scenicImage(selected: selected, size: 25, + tint: selected ? MaterialSelectionIcon.primary : .white), for: .normal) + selectionButton.isEnabled = isSelectionEnabled + selectionButton.alpha = isSelectionEnabled ? 1 : 0.45 + selectionButton.accessibilityIdentifier = "scenic.materials.select.\(clip.id)" + selectionButton.accessibilityLabel = "\(selected ? "取消选择" : "选择")片段\(clip.ordinal)" + selectionButton.accessibilityTraits = selected ? [.button, .selected] : .button + if !isSelectionEnabled { selectionButton.accessibilityTraits.insert(.notEnabled) } + previewButton.accessibilityIdentifier = "scenic.materials.preview.\(clip.id)" + previewButton.accessibilityLabel = "预览片段\(clip.ordinal),\(clip.durationText)" + previewButton.isEnabled = clip.isAvailable + statusLabel.text = statusText.map { " \($0) " } + statusLabel.isHidden = statusText == nil + statusLabel.backgroundColor = statusText?.contains("失败") == true + ? ScenicMaterialsStyle.warning.withAlphaComponent(0.95) + : ScenicMaterialsStyle.primary.withAlphaComponent(0.88) + progressView.isHidden = progress == nil + progressView.progress = Float(min(max(progress ?? 0, 0), 1)) + accessibilityIdentifier = "scenic.materials.clip.\(clip.id)" + } + + private func setupUI() { + contentView.backgroundColor = UIColor(hex: 0xE9EDF4) + contentView.layer.cornerRadius = 10 + contentView.layer.cornerCurve = .continuous + contentView.clipsToBounds = true + cover.contentMode = .scaleAspectFill + cover.clipsToBounds = true + previewButton.setImage(UIImage(systemName: "play.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 24)), for: .normal) + previewButton.tintColor = .white + previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside) + selectionButton.addTarget(self, action: #selector(selectionTapped), for: .touchUpInside) + statusLabel.layer.cornerRadius = 5 + statusLabel.clipsToBounds = true + statusLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + ordinalLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + metadataLabel.textAlignment = .right + metadataLabel.minimumScaleFactor = 0.85 + metadataLabel.adjustsFontSizeToFitWidth = true + progressView.progressTintColor = ScenicMaterialsStyle.primary + progressView.trackTintColor = .white.withAlphaComponent(0.4) + let gradient = ScenicMaterialGradientView() + gradient.tag = 701 + [cover, previewButton, gradient, ordinalLabel, metadataLabel, statusLabel, selectionButton, progressView].forEach(contentView.addSubview) + } + + private func setupConstraints() { + cover.snp.makeConstraints { $0.edges.equalToSuperview() } + previewButton.snp.makeConstraints { $0.edges.equalToSuperview() } + contentView.viewWithTag(701)?.snp.makeConstraints { + $0.leading.trailing.bottom.equalToSuperview() + $0.height.equalTo(55) + } + selectionButton.snp.makeConstraints { $0.top.leading.equalToSuperview(); $0.size.equalTo(44) } + statusLabel.snp.makeConstraints { + $0.top.trailing.equalToSuperview().inset(9) + $0.leading.greaterThanOrEqualTo(selectionButton.snp.trailing).offset(2) + $0.height.equalTo(22) + } + ordinalLabel.snp.makeConstraints { $0.leading.bottom.equalToSuperview().inset(9) } + metadataLabel.snp.makeConstraints { + $0.trailing.bottom.equalToSuperview().inset(9) + $0.leading.greaterThanOrEqualTo(ordinalLabel.snp.trailing).offset(5) + } + progressView.snp.makeConstraints { $0.leading.trailing.bottom.equalToSuperview(); $0.height.equalTo(3) } + } + + @objc private func previewTapped() { onPreview?() } + @objc private func selectionTapped() { onToggleSelection?() } +} + +/// 航线与拍摄批次标题,整组勾选由 ViewModel 决定完整片段范围。 +@MainActor +final class ScenicMaterialGroupHeaderView: UICollectionReusableView { + /// 请求勾选或取消本组全部可选片段。 + var onToggleGroup: (() -> Void)? + private let routeLabel = ScenicMaterialsStyle.label(size: 17, weight: .semibold) + private let timeLabel = ScenicMaterialsStyle.label(size: 11, color: ScenicMaterialsStyle.secondary) + private let groupButton = UIButton(type: .system) + + /// 创建可复用的航线标题和批次选择行。 + override init(frame: CGRect) { + super.init(frame: frame) + routeLabel.numberOfLines = 2 + routeLabel.accessibilityTraits = .header + timeLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + groupButton.addTarget(self, action: #selector(groupTapped), for: .touchUpInside) + addSubview(routeLabel) + addSubview(timeLabel) + addSubview(groupButton) + routeLabel.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.top.equalToSuperview().offset(10) + $0.bottom.lessThanOrEqualTo(groupButton.snp.top).offset(-4) + } + timeLabel.snp.makeConstraints { + $0.leading.equalToSuperview() + $0.centerY.equalTo(groupButton) + $0.trailing.lessThanOrEqualTo(groupButton.snp.leading).offset(-6) + } + groupButton.snp.makeConstraints { + $0.trailing.equalToSuperview() + $0.bottom.equalToSuperview() + $0.height.equalTo(44) + $0.width.greaterThanOrEqualTo(88) + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { super.prepareForReuse(); onToggleGroup = nil } + + /// 首组显示航线标题,后续同航线批次仅显示时间和数量。 + func configure(groupID: String, routeName: String?, timeTitle: String, count: Int, + isSelected: Bool, canSelect: Bool) { + routeLabel.text = routeName + routeLabel.isHidden = routeName == nil + routeLabel.snp.remakeConstraints { + $0.leading.trailing.equalToSuperview() + if routeName == nil { + $0.top.equalToSuperview() + $0.height.equalTo(0) + } else { + $0.top.equalToSuperview().offset(10) + $0.bottom.lessThanOrEqualTo(groupButton.snp.top).offset(-4) + } + } + timeLabel.text = "\(timeTitle) · \(count) 段素材" + var configuration = UIButton.Configuration.plain() + configuration.title = "选择本组" + configuration.image = MaterialSelectionIcon.scenicImage(selected: isSelected, size: 21, + tint: isSelected ? MaterialSelectionIcon.primary : UIColor(hex: 0x687084)) + configuration.imagePadding = 5 + configuration.contentInsets = .zero + configuration.baseForegroundColor = isSelected ? ScenicMaterialsStyle.primary : ScenicMaterialsStyle.secondary + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { input in + var output = input + output.font = .systemFont(ofSize: 11) + return output + } + groupButton.configuration = configuration + groupButton.isEnabled = canSelect + groupButton.accessibilityIdentifier = "scenic.materials.group.\(groupID)" + groupButton.accessibilityLabel = "\(isSelected ? "取消选择本组" : "选择本组"),\(timeTitle),\(count)段" + groupButton.accessibilityTraits = isSelected ? [.button, .selected] : .button + if !canSelect { groupButton.accessibilityTraits.insert(.notEnabled) } + } + + @objc private func groupTapped() { onToggleGroup?() } +} + +/// 展开或收起同一拍摄批次中默认折叠的片段。 +@MainActor +final class ScenicMaterialExpandCell: UICollectionViewCell { + /// 切换本组片段展示范围,选择范围不随折叠改变。 + var onToggleExpanded: (() -> Void)? + private let button = UIButton(type: .system) + + /// 创建居中的轻量展开按钮。 + override init(frame: CGRect) { + super.init(frame: frame) + button.tintColor = ScenicMaterialsStyle.secondary + button.titleLabel?.font = .systemFont(ofSize: 12) + button.addTarget(self, action: #selector(tapped), for: .touchUpInside) + contentView.addSubview(button) + button.snp.makeConstraints { $0.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { super.prepareForReuse(); onToggleExpanded = nil } + + /// 显示展开余量或收起文案。 + func configure(groupID: String, title: String) { + button.setTitle(title, for: .normal) + button.setImage(UIImage(systemName: title.contains("收起") ? "chevron.up" : "chevron.down"), for: .normal) + button.semanticContentAttribute = .forceRightToLeft + button.accessibilityIdentifier = "scenic.materials.expand.\(groupID)" + } + + @objc private func tapped() { onToggleExpanded?() } +} + +/// 固定底部的选择/下载摘要,由页面显式传入布局和状态,不执行文件操作。 +@MainActor +final class ScenicMaterialsFooterView: UIView { + /// 选择态左右排列;传输态显示摘要、进度和通栏按钮;结果态显示摘要和操作行。 + enum Layout { case selection, progress, result } + + /// 当前阶段的主要操作,例如下载、继续或重试。 + var onPrimaryTap: (() -> Void)? + /// 当前阶段的次要操作,例如取消或继续选择。 + var onSecondaryTap: (() -> Void)? + private let titleLabel = ScenicMaterialsStyle.label(size: 14) + private let detailLabel = ScenicMaterialsStyle.label(size: 11, color: ScenicMaterialsStyle.secondary) + private let primaryButton = UIButton(type: .custom) + private let secondaryButton = UIButton(type: .custom) + private let progressView = UIProgressView(progressViewStyle: .bar) + private let activity = UIActivityIndicatorView(style: .medium) + private let summaryRow = UIStackView() + private let actionRow = UIStackView() + private let stack = UIStackView() + private var currentLayout: Layout? + private var hasSecondaryAction = false + + /// 创建随安全区延伸的白色底栏。 + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setupConstraints() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + private func setupUI() { + backgroundColor = .white + titleLabel.numberOfLines = 2 + titleLabel.accessibilityIdentifier = "scenic.materials.footer.title" + detailLabel.numberOfLines = 2 + detailLabel.accessibilityIdentifier = "scenic.materials.footer.detail" + primaryButton.titleLabel?.font = .systemFont(ofSize: 15, weight: .semibold) + primaryButton.titleLabel?.numberOfLines = 1 + primaryButton.titleLabel?.textAlignment = .center + primaryButton.setTitleColor(.white, for: .normal) + primaryButton.setTitleColor(.white, for: .disabled) + primaryButton.layer.cornerRadius = 10 + primaryButton.clipsToBounds = true + primaryButton.accessibilityIdentifier = "scenic.materials.primary" + primaryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside) + secondaryButton.setTitleColor(ScenicMaterialsStyle.secondary, for: .normal) + secondaryButton.titleLabel?.font = .systemFont(ofSize: 15) + secondaryButton.titleLabel?.numberOfLines = 1 + secondaryButton.titleLabel?.textAlignment = .center + secondaryButton.layer.cornerRadius = 10 + secondaryButton.accessibilityIdentifier = "scenic.materials.secondary" + secondaryButton.addTarget(self, action: #selector(secondaryTapped), for: .touchUpInside) + progressView.progressTintColor = ScenicMaterialsStyle.primary + progressView.trackTintColor = UIColor(hex: 0xE7EDF7) + progressView.accessibilityIdentifier = "scenic.materials.footer.progress" + activity.color = .white + activity.hidesWhenStopped = true + activity.isUserInteractionEnabled = false + activity.accessibilityIdentifier = "scenic.materials.footer.activity" + primaryButton.addSubview(activity) + summaryRow.axis = .horizontal + summaryRow.alignment = .center + summaryRow.spacing = 8 + actionRow.axis = .horizontal + actionRow.alignment = .center + actionRow.spacing = 16 + stack.axis = .vertical + stack.spacing = 8 + addSubview(stack) + } + + private func setupConstraints() { + stack.snp.makeConstraints { + $0.top.equalToSuperview().offset(14) + $0.leading.trailing.equalToSuperview().inset(18) + $0.bottom.equalTo(safeAreaLayoutGuide).inset(14) + } + primaryButton.snp.makeConstraints { $0.height.equalTo(46) } + progressView.snp.makeConstraints { $0.height.equalTo(3).priority(999) } + activity.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.centerX.equalToSuperview() + $0.size.equalTo(18) + } + } + + /// 按产品页面的状态布局刷新底栏,忙碌按钮保持蓝色但不可重复触发。 + func configure(title: String, detail: String?, primaryTitle: String, primaryEnabled: Bool, + secondaryTitle: String? = nil, progress: Float? = nil, + layout: Layout = .selection, isBusy: Bool = false) { + UIView.performWithoutAnimation { + if currentLayout != layout || hasSecondaryAction != (secondaryTitle != nil) { + arrange(layout, hasSecondary: secondaryTitle != nil) + } + titleLabel.attributedText = nil + titleLabel.text = title + if layout == .selection, let range = title.range(of: #"\d+"#, options: .regularExpression) { + let attributed = NSMutableAttributedString(string: title) + attributed.addAttributes([.foregroundColor: ScenicMaterialsStyle.primary, + .font: UIFont.systemFont(ofSize: 20, weight: .bold)], + range: NSRange(range, in: title)) + titleLabel.attributedText = attributed + } + detailLabel.text = detail + detailLabel.isHidden = detail == nil || layout == .progress + primaryButton.accessibilityHint = detail + primaryButton.setTitle(primaryTitle, for: .normal) + primaryButton.setTitle(primaryTitle, for: .disabled) + let titleFont = primaryButton.titleLabel?.font ?? .systemFont(ofSize: 15, weight: .semibold) + let titleWidth = ceil(primaryTitle.size(withAttributes: [.font: titleFont]).width) + 2 + activity.snp.updateConstraints { $0.centerX.equalToSuperview().offset(-titleWidth / 2 - 4) } + primaryButton.backgroundColor = primaryEnabled || isBusy ? ScenicMaterialsStyle.primary : UIColor(hex: 0xCDDFFF) + primaryButton.isEnabled = primaryEnabled + secondaryButton.setTitle(secondaryTitle, for: .normal) + secondaryButton.isHidden = secondaryTitle == nil + secondaryButton.isEnabled = secondaryTitle != nil + progressView.isHidden = progress == nil + progressView.progress = min(max(progress ?? 0, 0), 1) + if isBusy { activity.startAnimating() } else { activity.stopAnimating() } + layoutIfNeeded() + } + } + + private func arrange(_ layout: Layout, hasSecondary: Bool) { + for container in [stack, summaryRow, actionRow] { + container.arrangedSubviews.forEach { container.removeArrangedSubview($0); $0.removeFromSuperview() } + } + titleLabel.snp.removeConstraints() + detailLabel.snp.removeConstraints() + secondaryButton.snp.removeConstraints() + actionRow.distribution = .fill + titleLabel.font = .systemFont(ofSize: layout == .selection ? 17 : 12) + detailLabel.textAlignment = layout == .selection ? .left : .right + secondaryButton.backgroundColor = layout == .result ? UIColor(hex: 0xF2F4F7) : .clear + secondaryButton.titleLabel?.font = .systemFont(ofSize: layout == .progress ? 12 : 15) + switch layout { + case .selection: + actionRow.addArrangedSubview(titleLabel) + actionRow.addArrangedSubview(primaryButton) + titleLabel.snp.makeConstraints { $0.width.equalTo(126).priority(999) } + stack.addArrangedSubview(actionRow) + stack.addArrangedSubview(detailLabel) + case .progress: + summaryRow.addArrangedSubview(titleLabel) + if hasSecondary { + summaryRow.addArrangedSubview(secondaryButton) + secondaryButton.snp.makeConstraints { $0.width.equalTo(44); $0.height.equalTo(28) } + } + actionRow.addArrangedSubview(primaryButton) + stack.addArrangedSubview(summaryRow) + stack.addArrangedSubview(progressView) + stack.addArrangedSubview(actionRow) + case .result: + summaryRow.addArrangedSubview(titleLabel) + summaryRow.addArrangedSubview(detailLabel) + titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + detailLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + if hasSecondary { + actionRow.addArrangedSubview(secondaryButton) + secondaryButton.snp.makeConstraints { $0.height.equalTo(46) } + actionRow.distribution = .fillEqually + } + actionRow.addArrangedSubview(primaryButton) + stack.addArrangedSubview(summaryRow) + stack.addArrangedSubview(actionRow) + } + currentLayout = layout + hasSecondaryAction = hasSecondary + } + + @objc private func primaryTapped() { + guard primaryButton.isEnabled else { return } + onPrimaryTap?() + } + @objc private func secondaryTapped() { + guard secondaryButton.isEnabled, !secondaryButton.isHidden else { return } + onSecondaryTap?() + } +} diff --git a/suixinkan/UI/ScenicMaterials/ScenicMaterialDemoDownloadDriver.swift b/suixinkan/UI/ScenicMaterials/ScenicMaterialDemoDownloadDriver.swift new file mode 100644 index 0000000..32e7ee5 --- /dev/null +++ b/suixinkan/UI/ScenicMaterials/ScenicMaterialDemoDownloadDriver.swift @@ -0,0 +1,44 @@ +import Foundation + +/// 推进空镜库本地下载演示,不发起网络请求,也不写入文件或系统相册。 +@MainActor +final class ScenicMaterialDemoDownloadDriver { + private var task: Task? + private var activeBatchID: UUID? + + /// 只推进当前批次的未完成项,旧批次回执由 ViewModel 再次校验。 + func start(viewModel: ScenicMaterialsViewModel, onProgress: @escaping () -> Void) { + guard viewModel.phase == .downloading, let batchID = viewModel.batchID else { return } + guard activeBatchID != batchID || task == nil else { return } + stop() + activeBatchID = batchID + let itemIDs = viewModel.pendingIDs + task = Task { @MainActor [weak self, weak viewModel] in + guard let self, let viewModel else { return } + defer { + if self.activeBatchID == batchID { + self.task = nil + self.activeBatchID = nil + } + } + for id in itemIDs where !viewModel.completedIDs.contains(id) { + for progress in [0.2, 0.45, 0.7, 0.95] { + do { try await Task.sleep(nanoseconds: 200_000_000) } catch { return } + guard !Task.isCancelled, self.activeBatchID == batchID, + viewModel.batchID == batchID, viewModel.phase == .downloading else { return } + viewModel.receive(.progress(progress), clipID: id, batchID: batchID) + onProgress() + } + viewModel.receive(.completed, clipID: id, batchID: batchID) + onProgress() + } + } + } + + /// 停止演示计时;调用方另行暂停或取消批次,避免把取消计时视为下载成功。 + func stop() { + task?.cancel() + task = nil + activeBatchID = nil + } +} diff --git a/suixinkan/UI/ScenicMaterials/ScenicMaterialFilterViewControllers.swift b/suixinkan/UI/ScenicMaterials/ScenicMaterialFilterViewControllers.swift new file mode 100644 index 0000000..f8e56a3 --- /dev/null +++ b/suixinkan/UI/ScenicMaterials/ScenicMaterialFilterViewControllers.swift @@ -0,0 +1,361 @@ +import SnapKit +import UIKit + +/// 独立景区素材航线筛选 Sheet,选择即应用,不要求加载工作台。 +@MainActor +final class ScenicMaterialRouteFilterViewController: UIViewController, UITableViewDelegate { + /// 选择全部传 nil,选择具体航线传稳定 ID。 + var onSelectRoute: ((String?) -> Void)? + + /// 筛选行使用明确身份,避免“全部”与业务航线 ID 冲突。 + private enum Row: Hashable { case all, route(String) } + private let routes: [ScenicMaterialRoute] + private let selectedRouteID: String? + private let tableView = UITableView(frame: .zero, style: .plain) + private var dataSource: UITableViewDiffableDataSource! + + /// 使用当前筛选快照创建独立选择面板。 + init(routes: [ScenicMaterialRoute], selectedRouteID: String?) { + var identifiers = Set() + self.routes = routes.filter { identifiers.insert($0.id).inserted } + self.selectedRouteID = selectedRouteID + super.init(nibName: nil, bundle: nil) + modalPresentationStyle = .pageSheet + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewDidLoad() { + super.viewDidLoad() + setupUI() + let desiredHeight = min(CGFloat(routes.count + 1) * 50 + 100, 460) + sheetPresentationController?.detents = [.custom { min($0.maximumDetentValue, desiredHeight) }] + sheetPresentationController?.prefersGrabberVisible = true + sheetPresentationController?.preferredCornerRadius = 22 + } + + private func setupUI() { + view.backgroundColor = .white + view.accessibilityIdentifier = "scenic.materials.route.sheet" + let title = ScenicMaterialsStyle.label("选择航线", size: 18, weight: .semibold) + tableView.backgroundColor = .white + tableView.separatorStyle = .singleLine + tableView.separatorColor = ScenicMaterialsStyle.border + tableView.separatorInset = .zero + tableView.tableFooterView = UIView() + tableView.rowHeight = 50 + tableView.delegate = self + tableView.accessibilityIdentifier = "scenic.materials.route.list" + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "route") + [title, tableView].forEach(view.addSubview) + title.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide).offset(22); $0.leading.equalToSuperview().offset(18) } + tableView.snp.makeConstraints { + $0.top.equalTo(title.snp.bottom).offset(12) + $0.leading.trailing.equalToSuperview().inset(22) + $0.bottom.equalTo(view.safeAreaLayoutGuide).inset(10) + } + dataSource = UITableViewDiffableDataSource(tableView: tableView) { [weak self] table, indexPath, row in + guard let self else { return nil } + let cell = table.dequeueReusableCell(withIdentifier: "route", for: indexPath) + let id: String? + let name: String + switch row { + case .all: id = nil; name = "全部航线" + case let .route(routeID): + id = routeID + name = self.routes.first { $0.id == routeID }?.name ?? "航线暂不可用" + } + let selected = id == self.selectedRouteID + var configuration = cell.defaultContentConfiguration() + configuration.text = name + configuration.textProperties.font = .systemFont(ofSize: 14, weight: selected ? .medium : .regular) + configuration.textProperties.color = selected ? ScenicMaterialsStyle.primary : ScenicMaterialsStyle.text + configuration.directionalLayoutMargins = .zero + cell.contentConfiguration = configuration + cell.backgroundColor = .white + cell.selectionStyle = .none + cell.layoutMargins = .zero + cell.preservesSuperviewLayoutMargins = false + cell.separatorInset = .zero + if selected { + let image = UIImageView(image: UIImage(systemName: "checkmark", + withConfiguration: UIImage.SymbolConfiguration(pointSize: 16, weight: .medium))) + image.tintColor = ScenicMaterialsStyle.primary + image.frame = CGRect(x: 0, y: 0, width: 20, height: 20) + cell.accessoryView = image + } else { + cell.accessoryView = nil + } + cell.accessibilityLabel = name + cell.accessibilityIdentifier = "scenic.materials.route.\(id ?? "all")" + cell.accessibilityTraits = selected ? [.button, .selected] : .button + return cell + } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + snapshot.appendItems([.all] + routes.map { .route($0.id) }) + dataSource.apply(snapshot, animatingDifferences: false) + } + + /// 将选中航线提交给调用页,再关闭筛选面板。 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + guard let item = dataSource.itemIdentifier(for: indexPath) else { return } + let id: String? + switch item { case .all: id = nil; case let .route(routeID): id = routeID } + let completion = onSelectRoute + dismiss(animated: true) { completion?(id) } + } + +} + +/// 景区素材起止日期筛选 Sheet,临时选择只在点击确定后应用。 +@MainActor +final class ScenicMaterialDateFilterViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate { + /// nil/nil 表示保留期内的全部时间,其他值为按日包含端点的区间。 + var onSelectRange: ((Date?, Date?) -> Void)? + + /// 当前正在编辑的日期端点。 + private enum Endpoint: Equatable { case start, end } + private let dateOptions: ScenicMaterialDatePickerOptions + private let calendar: Calendar + private var startDate: Date + private var endDate: Date + private var usesAllDates: Bool + private var endpoint: Endpoint = .start + // 日列不能依赖 UIPickerView 正在切换的月份选择,UIKit 可能仍请求上一个月的行。 + private var displayedMonthIndex: Int + private let allButton = UIButton(type: .system) + private let startButton = UIButton(type: .custom) + private let endButton = UIButton(type: .custom) + private let picker = UIPickerView() + + /// 约束到服务端约定或演示给定的保留区间,不提供未来日期。 + init(start: Date?, end: Date?, minimumDate: Date, maximumDate: Date, calendar: Calendar = .current) { + self.calendar = calendar + let options = ScenicMaterialDatePickerOptions(minimumDate: minimumDate, maximumDate: maximumDate, calendar: calendar) + dateOptions = options + let clampedStart = options.clamped(start ?? maximumDate) + let clampedEnd = options.clamped(end ?? maximumDate) + self.startDate = min(clampedStart, clampedEnd) + self.endDate = max(clampedStart, clampedEnd) + displayedMonthIndex = options.monthIndex(for: min(clampedStart, clampedEnd)) + // 打开面板先编辑日期草稿;取消不会改变列表当前的“全部时间”。 + usesAllDates = false + super.init(nibName: nil, bundle: nil) + modalPresentationStyle = .pageSheet + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewDidLoad() { + super.viewDidLoad() + setupUI() + updateUI() + sheetPresentationController?.detents = [.custom { min($0.maximumDetentValue, 531) }] + sheetPresentationController?.prefersGrabberVisible = true + sheetPresentationController?.preferredCornerRadius = 22 + } + + private func setupUI() { + view.backgroundColor = .white + view.accessibilityIdentifier = "scenic.materials.date.sheet" + let title = ScenicMaterialsStyle.label("选择时间", size: 18, weight: .semibold) + let hint = ScenicMaterialsStyle.label("选择起止日期", size: 13, color: ScenicMaterialsStyle.secondary) + allButton.addTarget(self, action: #selector(allTapped), for: .touchUpInside) + allButton.accessibilityIdentifier = "scenic.materials.date.all" + startButton.addTarget(self, action: #selector(startTapped), for: .touchUpInside) + startButton.accessibilityIdentifier = "scenic.materials.date.start" + endButton.addTarget(self, action: #selector(endTapped), for: .touchUpInside) + endButton.accessibilityIdentifier = "scenic.materials.date.end" + [startButton, endButton].forEach { + $0.layer.cornerRadius = 10 + $0.layer.borderWidth = 1 + } + let dateRow = UIStackView(arrangedSubviews: [startButton, endButton]) + dateRow.distribution = .fillEqually + dateRow.spacing = 12 + picker.dataSource = self + picker.delegate = self + picker.accessibilityIdentifier = "scenic.materials.date.picker" + let retention = ScenicMaterialsStyle.label("仅显示保留期内已到来的日期", size: 11, color: ScenicMaterialsStyle.secondary) + retention.textAlignment = .center + let cancel = UIButton(type: .system) + cancel.setTitle("取消", for: .normal) + cancel.titleLabel?.font = .systemFont(ofSize: 15, weight: .medium) + cancel.tintColor = ScenicMaterialsStyle.secondary + cancel.backgroundColor = UIColor(hex: 0xF5F6F8) + cancel.layer.cornerRadius = 10 + cancel.accessibilityIdentifier = "scenic.materials.date.cancel" + cancel.addTarget(self, action: #selector(cancelTapped), for: .touchUpInside) + let confirm = UIButton(type: .system) + confirm.setTitle("确定", for: .normal) + confirm.titleLabel?.font = .systemFont(ofSize: 15, weight: .semibold) + confirm.setTitleColor(.white, for: .normal) + confirm.backgroundColor = ScenicMaterialsStyle.primary + confirm.layer.cornerRadius = 10 + confirm.accessibilityIdentifier = "scenic.materials.date.confirm" + confirm.addTarget(self, action: #selector(confirmTapped), for: .touchUpInside) + let actions = UIStackView(arrangedSubviews: [cancel, confirm]) + actions.distribution = .fillEqually + actions.spacing = 12 + let scrollView = UIScrollView() + let content = UIView() + view.addSubview(scrollView) + view.addSubview(actions) + scrollView.addSubview(content) + [title, hint, allButton, dateRow, picker, retention].forEach(content.addSubview) + actions.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(18) + $0.bottom.equalTo(view.safeAreaLayoutGuide).inset(12) + $0.height.equalTo(46) + } + scrollView.snp.makeConstraints { + $0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.bottom.equalTo(actions.snp.top).offset(-12) + } + content.snp.makeConstraints { $0.edges.equalTo(scrollView.contentLayoutGuide); $0.width.equalTo(scrollView.frameLayoutGuide) } + title.snp.makeConstraints { $0.top.equalToSuperview().offset(24); $0.leading.equalToSuperview().offset(18) } + hint.snp.makeConstraints { $0.top.equalTo(title.snp.bottom).offset(22); $0.leading.equalTo(title) } + allButton.snp.makeConstraints { $0.centerY.equalTo(hint); $0.trailing.equalToSuperview().inset(18); $0.height.equalTo(36) } + dateRow.snp.makeConstraints { $0.top.equalTo(hint.snp.bottom).offset(20); $0.leading.trailing.equalToSuperview().inset(18); $0.height.equalTo(72) } + picker.snp.makeConstraints { $0.top.equalTo(dateRow.snp.bottom).offset(10); $0.leading.trailing.equalToSuperview().inset(18); $0.height.equalTo(200) } + retention.snp.makeConstraints { $0.top.equalTo(picker.snp.bottom).offset(12); $0.leading.trailing.equalToSuperview().inset(18); $0.bottom.equalToSuperview().inset(4) } + } + + private func updateUI() { + var allConfiguration = UIButton.Configuration.plain() + allConfiguration.title = "全部时间" + allConfiguration.baseForegroundColor = ScenicMaterialsStyle.primary + allConfiguration.contentInsets = .zero + allConfiguration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { input in + var output = input; output.font = .systemFont(ofSize: 12); return output + } + allButton.configuration = allConfiguration + allButton.accessibilityTraits = usesAllDates ? [.button, .selected] : .button + let formatter = DateFormatter() + formatter.calendar = calendar + formatter.timeZone = calendar.timeZone + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = "M月d日" + for (button, value, name, candidate) in [(startButton, startDate, "开始日期", Endpoint.start), (endButton, endDate, "结束日期", Endpoint.end)] { + let active = endpoint == candidate && !usesAllDates + let foreground = active ? ScenicMaterialsStyle.primary : ScenicMaterialsStyle.text + let titleColor = ScenicMaterialsStyle.secondary + var configuration = UIButton.Configuration.plain() + configuration.title = name + configuration.subtitle = formatter.string(from: value) + configuration.titleAlignment = .center + configuration.titlePadding = 4 + configuration.contentInsets = NSDirectionalEdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8) + configuration.baseForegroundColor = foreground + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: 12, weight: .regular) + result.foregroundColor = titleColor + return result + } + configuration.subtitleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { attributes in + var result = attributes + result.font = .systemFont(ofSize: 18, weight: .semibold) + result.foregroundColor = foreground + return result + } + UIView.performWithoutAnimation { + button.configuration = configuration + button.layoutIfNeeded() + } + button.backgroundColor = active ? ScenicMaterialsStyle.primary.withAlphaComponent(0.06) : UIColor(hex: 0xF7F8FA) + button.layer.borderColor = (active ? ScenicMaterialsStyle.primary.withAlphaComponent(0.35) : ScenicMaterialsStyle.border).cgColor + button.accessibilityTraits = active ? [.button, .selected] : .button + button.accessibilityLabel = "\(name),\(formatter.string(from: value))" + } + let value = endpoint == .start ? startDate : endDate + let monthIndex = dateOptions.monthIndex(for: value) + displayedMonthIndex = monthIndex + picker.reloadAllComponents() + picker.selectRow(monthIndex, inComponent: 0, animated: false) + let dayIndex = dateOptions.months[monthIndex].dates.firstIndex(of: value) ?? 0 + picker.selectRow(dayIndex, inComponent: 1, animated: false) + picker.accessibilityLabel = endpoint == .start ? "开始日期,月份和日期" : "结束日期,月份和日期" + picker.alpha = usesAllDates ? 0.4 : 1 + picker.isUserInteractionEnabled = !usesAllDates + } + + @objc private func allTapped() { usesAllDates.toggle(); updateUI() } + @objc private func startTapped() { endpoint = .start; usesAllDates = false; updateUI() } + @objc private func endTapped() { endpoint = .end; usesAllDates = false; updateUI() } + + /// 两列分别表示保留期内的月份与所选月份内的日号。 + func numberOfComponents(in pickerView: UIPickerView) -> Int { 2 } + + /// 首尾月份按保留期裁剪,滚轮中不会出现不可提交的日期。 + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + if component == 0 { return dateOptions.months.count } + guard component == 1, dateOptions.months.indices.contains(displayedMonthIndex) else { return 0 } + return dateOptions.months[displayedMonthIndex].dates.count + } + + /// 使用与网页一致的 40 点行高。 + func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { 40 } + + /// 月份和日期占据等宽两列。 + func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { pickerView.bounds.width / 2 } + + /// 日期文案不显示年份列,辅助功能仍包含月份的年份。 + func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { + let label = (view as? UILabel) ?? UILabel() + label.font = .systemFont(ofSize: 20, weight: .medium) + label.textColor = ScenicMaterialsStyle.text + label.textAlignment = .center + label.text = nil + label.accessibilityLabel = nil + if component == 0 { + guard dateOptions.months.indices.contains(row) else { return label } + let month = dateOptions.months[row] + label.text = dateOptions.monthTitle(at: row) + label.accessibilityLabel = "\(month.year)年\(month.number)月" + } else if component == 1 { + guard dateOptions.months.indices.contains(displayedMonthIndex) else { return label } + let month = dateOptions.months[displayedMonthIndex] + // 切换到短月或截断末月时,UIKit 过渡帧可能仍请求旧日列的末尾行。 + guard month.dates.indices.contains(row) else { return label } + label.text = "\(calendar.component(.day, from: month.dates[row]))日" + label.accessibilityLabel = label.text + } + return label + } + + /// 更改月份时保留日号并收敛月末;更改端点后同步修正倒置区间。 + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + let value: Date + if component == 0 { + guard dateOptions.months.indices.contains(row) else { return } + let current = endpoint == .start ? startDate : endDate + value = dateOptions.date(inMonthAt: row, preferredDay: calendar.component(.day, from: current)) + } else if component == 1 { + guard dateOptions.months.indices.contains(displayedMonthIndex), + dateOptions.months[displayedMonthIndex].dates.indices.contains(row) else { return } + value = dateOptions.months[displayedMonthIndex].dates[row] + } else { return } + usesAllDates = false + if endpoint == .start { + startDate = value + if endDate < value { endDate = value } + } else { + endDate = value + if startDate > value { startDate = value } + } + updateUI() + } + + @objc private func cancelTapped() { dismiss(animated: true) } + + @objc private func confirmTapped() { + let start: Date? = usesAllDates ? nil : startDate + let end: Date? = usesAllDates ? nil : endDate + let completion = onSelectRange + dismiss(animated: true) { completion?(start, end) } + } +} diff --git a/suixinkan/UI/ScenicMaterials/ScenicMaterialPreviewViewController.swift b/suixinkan/UI/ScenicMaterials/ScenicMaterialPreviewViewController.swift new file mode 100644 index 0000000..9507afa --- /dev/null +++ b/suixinkan/UI/ScenicMaterials/ScenicMaterialPreviewViewController.swift @@ -0,0 +1,300 @@ +import Kingfisher +import AVFoundation +import AVKit +import SnapKit +import UIKit + +/// 景区空境视频预览,正式素材播放服务端地址,Debug 素材保留本地预览。 +@MainActor +final class ScenicMaterialPreviewViewController: UIViewController { + private let clip: ScenicMaterialClip + private let routeName: String + private let capturedAt: Date + private let calendar: Calendar + private let playerController = AVPlayerViewController() + private let contentView = UIView() + private let coverView = UIImageView() + private let playButton = UIButton(type: .system) + private let playbackStatus = ScenicMaterialsStyle.label(size: 13, color: ScenicMaterialsStyle.secondary) + private let playbackTime = ScenicMaterialsStyle.label(size: 11, color: ScenicMaterialsStyle.secondary) + private let progressView = UIProgressView(progressViewStyle: .bar) + private var playbackTask: Task? + private var playbackObservation: ScenicMaterialPlaybackObservation? + private var playbackGeneration = UUID() + private var playbackDuration: Double? + private var playbackFinished = false + + /// 预览指定片段,原片元信息与本地演示视频时长明确区分。 + init(clip: ScenicMaterialClip, routeName: String, capturedAt: Date, calendar: Calendar = .current) { + self.clip = clip + self.routeName = routeName + self.capturedAt = capturedAt + self.calendar = calendar + super.init(nibName: nil, bundle: nil) + modalPresentationStyle = .pageSheet + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewDidLoad() { + super.viewDidLoad() + setupUI() + sheetPresentationController?.detents = [.custom { [weak self] context in + guard let self else { return min(context.maximumDetentValue, 490) } + let width = max(self.view.bounds.width, 320) + let fittingSize = self.contentView.systemLayoutSizeFitting( + CGSize(width: width, height: UIView.layoutFittingCompressedSize.height), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + return min(context.maximumDetentValue, fittingSize.height) + }] + sheetPresentationController?.prefersGrabberVisible = true + sheetPresentationController?.preferredCornerRadius = 22 + NotificationCenter.default.addObserver(self, selector: #selector(pausePlayback), + name: UIApplication.willResignActiveNotification, object: nil) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + pausePlayback() + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + stopPlayback() + } + + private func setupUI() { + view.backgroundColor = .white + view.accessibilityIdentifier = "scenic.materials.preview.sheet" + let title = ScenicMaterialsStyle.label("视频预览", size: 18, weight: .semibold) + let mediaContainer = UIView() + mediaContainer.backgroundColor = .black + mediaContainer.layer.cornerRadius = 10 + mediaContainer.clipsToBounds = true + mediaContainer.accessibilityIdentifier = "scenic.materials.preview.media" + if clip.isRemote { + coverView.kf.setImage(with: clip.coverURL, placeholder: UIImage(systemName: "photo")) + playbackStatus.text = "点击播放原片" + } else { + coverView.image = UIImage(named: clip.coverAssetName) + playbackStatus.text = "本地演示短片 · 非真实景区视频" + } + coverView.contentMode = .scaleAspectFill + coverView.clipsToBounds = true + playButton.tintColor = .white + playButton.accessibilityIdentifier = "scenic.materials.preview.play" + playButton.addTarget(self, action: #selector(playTapped), for: .touchUpInside) + updatePlayButton(isPlaying: false) + playbackStatus.numberOfLines = 2 + progressView.progressTintColor = ScenicMaterialsStyle.primary + progressView.trackTintColor = ScenicMaterialsStyle.border + progressView.accessibilityIdentifier = "scenic.materials.preview.progress" + progressView.accessibilityLabel = "播放进度" + playbackTime.accessibilityIdentifier = "scenic.materials.preview.playbackTime" + resetPlaybackTime() + let metadata = ScenicMaterialsStyle.label("\(clip.durationText) · \(clip.sizeText)", size: 11, color: ScenicMaterialsStyle.secondary) + metadata.numberOfLines = 2 + metadata.textAlignment = .right + metadata.accessibilityIdentifier = "scenic.materials.preview.metadata" + let timeline = UIStackView(arrangedSubviews: [playbackTime, metadata]) + timeline.alignment = .top + timeline.distribution = .fillEqually + timeline.spacing = 8 + let route = ScenicMaterialsStyle.label(routeName, size: 16, weight: .semibold) + route.numberOfLines = 2 + route.accessibilityIdentifier = "scenic.materials.preview.route" + let formatter = DateFormatter() + formatter.calendar = calendar + formatter.timeZone = calendar.timeZone + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = "MM-dd HH:mm" + let time = ScenicMaterialsStyle.label("\(formatter.string(from: capturedAt)) · 片段 \(clip.ordinal)", size: 12, color: ScenicMaterialsStyle.secondary) + time.accessibilityIdentifier = "scenic.materials.preview.capturedAt" + let done = UIButton(type: .system) + done.setTitle("返回素材列表", for: .normal) + done.setTitleColor(.white, for: .normal) + done.titleLabel?.font = .systemFont(ofSize: 15, weight: .semibold) + done.backgroundColor = ScenicMaterialsStyle.primary + done.layer.cornerRadius = 10 + done.accessibilityIdentifier = "scenic.materials.preview.done" + done.addTarget(self, action: #selector(closeTapped), for: .touchUpInside) + let scroll = UIScrollView() + view.addSubview(scroll) + scroll.addSubview(contentView) + [title, playbackStatus, mediaContainer, progressView, timeline, route, time, done].forEach(contentView.addSubview) + addChild(playerController) + playerController.view.backgroundColor = .black + playerController.view.isHidden = true + playerController.showsPlaybackControls = false + playerController.allowsPictureInPicturePlayback = false + mediaContainer.addSubview(playerController.view) + playerController.didMove(toParent: self) + mediaContainer.addSubview(coverView) + mediaContainer.addSubview(playButton) + scroll.snp.makeConstraints { $0.edges.equalTo(view.safeAreaLayoutGuide) } + contentView.snp.makeConstraints { $0.edges.equalTo(scroll.contentLayoutGuide); $0.width.equalTo(scroll.frameLayoutGuide) } + title.snp.makeConstraints { $0.top.equalToSuperview().offset(24); $0.leading.trailing.equalToSuperview().inset(18) } + playbackStatus.snp.makeConstraints { $0.top.equalTo(title.snp.bottom).offset(6); $0.leading.trailing.equalTo(title) } + mediaContainer.snp.makeConstraints { + $0.top.equalTo(playbackStatus.snp.bottom).offset(18) + $0.leading.trailing.equalTo(title) + $0.height.equalTo(mediaContainer.snp.width).multipliedBy(9.0 / 16.0) + } + playerController.view.snp.makeConstraints { $0.edges.equalToSuperview() } + coverView.snp.makeConstraints { $0.edges.equalToSuperview() } + playButton.snp.makeConstraints { $0.center.equalToSuperview(); $0.size.equalTo(44) } + progressView.snp.makeConstraints { $0.top.equalTo(mediaContainer.snp.bottom).offset(16); $0.leading.trailing.equalTo(mediaContainer); $0.height.equalTo(3) } + timeline.snp.makeConstraints { $0.top.equalTo(progressView.snp.bottom).offset(8); $0.leading.trailing.equalTo(mediaContainer) } + route.snp.makeConstraints { $0.top.equalTo(timeline.snp.bottom).offset(22); $0.leading.trailing.equalTo(mediaContainer) } + time.snp.makeConstraints { $0.top.equalTo(route.snp.bottom).offset(7); $0.leading.trailing.equalTo(mediaContainer) } + done.snp.makeConstraints { + $0.top.equalTo(time.snp.bottom).offset(20) + $0.leading.trailing.equalTo(mediaContainer) + $0.height.equalTo(46) + $0.bottom.equalToSuperview().inset(18) + } + } + + @objc private func playTapped() { + guard playbackTask == nil, clip.isAvailable else { return } + if let player = playerController.player { + if player.rate > 0 { + pausePlayback() + } else { + if playbackFinished { player.seek(to: .zero); playbackFinished = false } + player.play() + updatePlayButton(isPlaying: true) + updatePlayingStatus() + } + return + } + let demoURL = Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock") + guard let url = clip.isRemote ? clip.remoteURL : demoURL else { + playbackStatus.text = "视频地址暂不可用" + return + } + playButton.isEnabled = false + playbackGeneration = UUID() + let generation = playbackGeneration + playbackTask = Task { @MainActor [weak self] in + let asset = AVURLAsset(url: url) + let playable = (try? await asset.load(.isPlayable)) == true + let duration = try? await asset.load(.duration) + guard let self, self.playbackGeneration == generation else { return } + self.playbackTask = nil + self.playButton.isEnabled = true + guard !Task.isCancelled, self.view.window != nil else { return } + guard playable else { + self.playbackStatus.text = "视频暂不可播放,请稍后重试" + return + } + let seconds = duration?.seconds ?? .nan + self.playbackDuration = seconds.isFinite && seconds > 0 ? seconds : nil + let player = AVPlayer(playerItem: AVPlayerItem(asset: asset)) + self.playerController.player = player + self.playerController.view.isHidden = false + self.coverView.isHidden = true + self.playbackFinished = false + self.playbackObservation = ScenicMaterialPlaybackObservation(player: player) { [weak self] time in + Task { @MainActor [weak self] in + guard let self, self.playbackGeneration == generation else { return } + self.updatePlaybackProgress(time) + } + } + NotificationCenter.default.addObserver(self, selector: #selector(playbackEnded), + name: .AVPlayerItemDidPlayToEndTime, object: player.currentItem) + self.updatePlaybackProgress(.zero) + self.updatePlayingStatus() + self.updatePlayButton(isPlaying: true) + player.play() + } + } + + private func updatePlaybackProgress(_ time: CMTime) { + let seconds = time.seconds.isFinite ? max(time.seconds, 0) : 0 + progressView.progress = playbackDuration.map { Float(min(seconds / $0, 1)) } ?? 0 + let total = playbackDuration.map(Self.durationText) ?? "时长未知" + playbackTime.text = "\(Self.durationText(seconds)) / \(total)" + } + + private func updatePlayingStatus() { + if clip.isRemote { + playbackStatus.text = "正在播放原片" + } else if let duration = playbackDuration { + playbackStatus.text = "正在播放 \(Int(duration.rounded())) 秒本地演示 · 原片 \(clip.durationText)" + } else { + playbackStatus.text = "正在播放本地演示 · 原片 \(clip.durationText)" + } + } + + private func updatePlayButton(isPlaying: Bool) { + let symbol = isPlaying ? "pause.fill" : "play.fill" + playButton.setImage(UIImage(systemName: symbol, withConfiguration: UIImage.SymbolConfiguration(pointSize: 24)), for: .normal) + playButton.accessibilityLabel = isPlaying ? "暂停播放" : (clip.isRemote ? "播放景区视频" : "播放本地演示视频") + } + + private func resetPlaybackTime() { + playbackTime.text = "00:00 / \(clip.isRemote ? "" : "原片 ")\(clip.durationText)" + } + + private static func durationText(_ seconds: Double) -> String { + let value = max(Int(seconds), 0) + return String(format: "%02d:%02d", value / 60, value % 60) + } + + @objc private func playbackEnded() { + playbackFinished = true + if let duration = playbackDuration { updatePlaybackProgress(CMTime(seconds: duration, preferredTimescale: 600)) } + updatePlayButton(isPlaying: false) + playbackStatus.text = clip.isRemote ? "播放结束,点击重新播放" : "本地演示已结束 · 原片 \(clip.durationText)" + } + + @objc private func pausePlayback() { + playerController.player?.pause() + if playbackTask != nil { + playbackGeneration = UUID() + playbackTask?.cancel() + playbackTask = nil + playButton.isEnabled = true + } + updatePlayButton(isPlaying: false) + if playerController.player != nil { + playbackStatus.text = clip.isRemote ? "已暂停,点击继续播放" : "本地演示已暂停 · 原片 \(clip.durationText)" + } + } + + private func stopPlayback() { + pausePlayback() + playbackGeneration = UUID() + NotificationCenter.default.removeObserver(self, name: .AVPlayerItemDidPlayToEndTime, object: playerController.player?.currentItem) + playbackObservation = nil + playerController.player = nil + playerController.view.isHidden = true + coverView.isHidden = false + playbackDuration = nil + playbackFinished = false + progressView.progress = 0 + resetPlaybackTime() + } + + @objc private func closeTapped() { + stopPlayback() + dismiss(animated: true) + } +} + +/// 与播放器成对持有周期观察令牌,释放时移除观察,避免弹窗销毁后残留定时回调。 +private final class ScenicMaterialPlaybackObservation { + private let player: AVPlayer + private let token: Any + + init(player: AVPlayer, onTime: @escaping @Sendable (CMTime) -> Void) { + self.player = player + token = player.addPeriodicTimeObserver(forInterval: CMTime(seconds: 0.1, preferredTimescale: 600), + queue: .main, using: onTime) + } + + deinit { player.removeTimeObserver(token) } +} diff --git a/suixinkan/UI/ScenicMaterials/ScenicMaterialsPreview.swift b/suixinkan/UI/ScenicMaterials/ScenicMaterialsPreview.swift new file mode 100644 index 0000000..fa9b22b --- /dev/null +++ b/suixinkan/UI/ScenicMaterials/ScenicMaterialsPreview.swift @@ -0,0 +1,20 @@ +import UIKit + +#if DEBUG +/// 空镜库独立调试入口,不伪造正式首页权限,也不创建机巢工作台或订单。 +@MainActor +enum ScenicMaterialsPreview { + /// 指定启动参数时展示演示素材;正式首页由 sceniclibrary 权限控制入口。 + static func navigationController(arguments: [String]) -> UINavigationController? { + guard arguments.contains("--scenic-materials-preview") else { return nil } + let model = ScenicMaterialsViewModel() + if let value = arguments.first(where: { $0.hasPrefix("--scenic-materials-scenario=") }), + let scenario = ScenicMaterialsScenario(rawValue: String(value.dropFirst("--scenic-materials-scenario=".count))) { + model.applyScenario(scenario) + } + let controller = ScenicMaterialsViewController(viewModel: model, + isDemoPhotoPermissionAllowed: !arguments.contains("--scenic-materials-permission-denied")) + return UINavigationController(rootViewController: controller) + } +} +#endif diff --git a/suixinkan/UI/ScenicMaterials/ScenicMaterialsViewController.swift b/suixinkan/UI/ScenicMaterials/ScenicMaterialsViewController.swift new file mode 100644 index 0000000..d493e1b --- /dev/null +++ b/suixinkan/UI/ScenicMaterials/ScenicMaterialsViewController.swift @@ -0,0 +1,655 @@ +import Photos +import SnapKit +import UIKit + +/// 独立景区空镜库页面,提供筛选、分组预览、选择与前台下载演示,不依赖机巢订单。 +@MainActor +final class ScenicMaterialsViewController: GlobalLoadingPageViewController { + /// 当前景区的素材与本地选择、下载状态。 + let viewModel: ScenicMaterialsViewModel + + /// 辅助说明与每次拍摄批次分别使用稳定分区身份。 + private enum Section: Hashable { case retention, group(String), end } + /// 选择与进度不参与身份,Diffable 更新时复用原有单元。 + private enum Item: Hashable { case retention, clip(String), expand(String), loadMore, end } + + private let filterBar = UIStackView() + private let routeButton = UIButton(type: .system) + private let dateButton = UIButton(type: .system) + private let footer = ScenicMaterialsFooterView() + private let emptyView = UIView() + private let emptyTitle = ScenicMaterialsStyle.label(size: 18, weight: .semibold) + private let emptyMessage = ScenicMaterialsStyle.label(size: 14, color: ScenicMaterialsStyle.secondary) + private let resetButton = UIButton(type: .system) + private let driver = ScenicMaterialDemoDownloadDriver() + private let downloadService = ScenicMaterialDownloadService() + private var loadTask: Task? + private var isLoadingNextPage = false + private let refreshControl = UIRefreshControl() + private let retryButton = UIButton(type: .system) + private var authorizationTask: Task? + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeLayout()) + private var dataSource: UICollectionViewDiffableDataSource! + private var isDemoPhotoPermissionAllowed: Bool + + /// 注入独立景区上下文;权限开关只用于本地演示,不读写系统相册授权。 + init(viewModel: ScenicMaterialsViewModel = ScenicMaterialsViewModel(), isDemoPhotoPermissionAllowed: Bool = true) { + self.viewModel = viewModel + self.isDemoPhotoPermissionAllowed = isDemoPhotoPermissionAllowed + super.init(nibName: nil, bundle: nil) + hidesBottomBarWhenPushed = true + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewDidLoad() { + super.viewDidLoad() + if viewModel.isRemote { reloadRemoteMaterials() } + } + + @objc private func reloadRemoteMaterials() { + guard viewModel.isRemote, !viewModel.isSelectionLocked else { refreshControl.endRefreshing(); return } + loadTask?.cancel() + isLoadingNextPage = false + let session = AppStore.shared.session + guard session.accountType == .storeUser, session.userId == viewModel.context.userID, + String(session.currentScenicId) == viewModel.context.scenicID else { + setPageLoading(false) + refreshControl.endRefreshing() + showToast("请使用门店账号并重新进入当前景区素材库") + return + } + let api = ScenicMaterialsAPI(client: NetworkServices.shared.apiClient) + setPageLoading(!refreshControl.isRefreshing) + emptyTitle.text = "正在加载素材" + emptyMessage.text = "请稍候" + retryButton.isHidden = true + routeButton.isEnabled = false + dateButton.isEnabled = false + loadTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.loadRemoteSessions(api: api) + guard !Task.isCancelled else { return } + self.setPageLoading(false) + self.refreshControl.endRefreshing() + self.refreshDisplay() + } + } + + /// 用户主动加载下一页;不把第一页误标为全部素材,失败时保留已展示内容。 + private func loadMoreRemoteMaterials() { + guard viewModel.isRemote, !viewModel.isSelectionLocked, !viewModel.isLoading, + !isLoadingNextPage, viewModel.hasMoreRemoteSessions else { return } + let session = AppStore.shared.session + guard session.accountType == .storeUser, session.userId == viewModel.context.userID, + String(session.currentScenicId) == viewModel.context.scenicID else { + showToast("请使用门店账号并重新进入当前景区素材库") + return + } + isLoadingNextPage = true + refreshDisplay(animated: false) + let api = ScenicMaterialsAPI(client: NetworkServices.shared.apiClient) + loadTask = Task { @MainActor [weak self] in + guard let self else { return } + await self.viewModel.loadMoreRemoteSessions(api: api) + guard !Task.isCancelled else { return } + self.isLoadingNextPage = false + self.refreshDisplay() + if let error = self.viewModel.loadMoreError { self.showToast(error) } + } + } + + override func setupNavigationBar() { + title = "景区空境库" + navigationItem.backButtonDisplayMode = .minimal + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.backgroundColor = .white + appearance.shadowColor = .clear + appearance.titleTextAttributes = [.foregroundColor: ScenicMaterialsStyle.text, + .font: UIFont.systemFont(ofSize: 18, weight: .semibold)] + navigationItem.standardAppearance = appearance + navigationItem.scrollEdgeAppearance = appearance + #if DEBUG + guard !viewModel.isRemote else { return } + var actions: [UIAction] = ScenicMaterialsScenario.allCases.map { scenario in + UIAction(title: scenario.title) { [weak self] _ in self?.applyPreviewScenario(scenario) } + } + actions.append(UIAction(title: "相册权限不足") { [weak self] _ in + guard let self else { return } + self.driver.stop() + self.downloadService.stop() + self.viewModel.pauseDownload() + self.isDemoPhotoPermissionAllowed = false + self.refreshDisplay(animated: false) + self.presentPermissionDemo() + }) + let menu = UIBarButtonItem(image: UIImage(systemName: "slider.horizontal.3"), menu: UIMenu(title: "空镜库本地演示", children: actions)) + menu.accessibilityLabel = "体验空镜库其他状态" + menu.accessibilityIdentifier = "scenic.materials.scenarios" + navigationItem.rightBarButtonItem = menu + #endif + } + + override func setupUI() { + view.backgroundColor = .white + view.accessibilityIdentifier = "scenic.materials" + filterBar.axis = .horizontal + filterBar.distribution = .fillEqually + filterBar.spacing = 10 + configureFilterButton(routeButton, identifier: "scenic.materials.routeFilter") + configureFilterButton(dateButton, identifier: "scenic.materials.dateFilter") + filterBar.addArrangedSubview(routeButton) + filterBar.addArrangedSubview(dateButton) + collectionView.backgroundColor = .white + collectionView.alwaysBounceVertical = true + collectionView.showsVerticalScrollIndicator = true + collectionView.accessibilityIdentifier = "scenic.materials.list" + collectionView.register(ScenicMaterialClipCell.self, forCellWithReuseIdentifier: "clip") + collectionView.register(ScenicMaterialExpandCell.self, forCellWithReuseIdentifier: "expand") + collectionView.register(ScenicMaterialTextCell.self, forCellWithReuseIdentifier: "text") + collectionView.register(ScenicMaterialPageFooterCell.self, forCellWithReuseIdentifier: "pageFooter") + collectionView.register(ScenicMaterialGroupHeaderView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: "group") + view.addSubview(filterBar) + view.addSubview(collectionView) + view.addSubview(footer) + if viewModel.isRemote { + collectionView.refreshControl = refreshControl + refreshControl.addTarget(self, action: #selector(reloadRemoteMaterials), for: .valueChanged) + } + setupEmptyView() + configureDataSource() + refreshDisplay(animated: false) + } + + override func setupConstraints() { + filterBar.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).offset(10) + make.leading.trailing.equalToSuperview().inset(16) + make.height.equalTo(40) + } + collectionView.snp.makeConstraints { make in + make.top.equalTo(filterBar.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview() + make.bottom.equalTo(footer.snp.top) + } + footer.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() } + } + + override func bindActions() { + routeButton.addTarget(self, action: #selector(selectRoute), for: .touchUpInside) + dateButton.addTarget(self, action: #selector(selectDateRange), for: .touchUpInside) + resetButton.addTarget(self, action: #selector(resetFilters), for: .touchUpInside) + footer.onPrimaryTap = { [weak self] in self?.performPrimaryAction() } + footer.onSecondaryTap = { [weak self] in + guard let self else { return } + self.driver.stop() + self.downloadService.stop() + if self.viewModel.phase == .downloading || self.viewModel.phase == .paused { + self.viewModel.cancelDownload() + } else { + self.viewModel.continueSelecting() + } + self.refreshDisplay(animated: true) + } + NotificationCenter.default.addObserver(self, selector: #selector(pauseForBackground), + name: UIApplication.willResignActiveNotification, object: nil) + } + + /// 真正离开时暂停;预览或筛选弹层不会中止下载,取消返回手势也不会误暂停。 + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + guard isMovingFromParent || isBeingDismissed || navigationController?.isBeingDismissed == true else { return } + if let coordinator = transitionCoordinator, coordinator.isInteractive { + coordinator.animate(alongsideTransition: nil) { [weak self] context in + if !context.isCancelled { self?.finishLeaving() } + } + } else { + finishLeaving() + } + } + + /// 仅在确认离开页面后作废异步工作,取消返回手势继续保留原来的加载及下载。 + private func finishLeaving() { + loadTask?.cancel() + setPageLoading(false) + isLoadingNextPage = false + viewModel.cancelRemoteLoad() + authorizationTask?.cancel() + authorizationTask = nil + pauseForBackground() + } + + /// 外部演示回执后显式刷新,不自动开始或继续任何传输。 + func refreshDisplay(animated: Bool = true) { + guard dataSource != nil else { return } + routeButton.setTitle(viewModel.routeFilterTitle, for: .normal) + dateButton.setTitle(viewModel.dateFilterTitle, for: .normal) + routeButton.isEnabled = !viewModel.isSelectionLocked && !viewModel.isLoading && !isLoadingNextPage + dateButton.isEnabled = !viewModel.isSelectionLocked && !viewModel.isLoading && !isLoadingNextPage + retryButton.isHidden = viewModel.loadError == nil + emptyTitle.text = viewModel.emptyTitle + emptyMessage.text = viewModel.emptyMessage + resetButton.isHidden = viewModel.selectedRouteID == nil && viewModel.dateRange == nil + collectionView.backgroundView = viewModel.filteredGroups.isEmpty ? emptyView : nil + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([.retention]) + snapshot.appendItems([.retention]) + for group in viewModel.filteredGroups { + snapshot.appendSections([.group(group.id)]) + snapshot.appendItems(viewModel.visibleClips(in: group).map { .clip($0.id) }) + if group.clips.count > 5 { snapshot.appendItems([.expand(group.id)]) } + } + if !viewModel.filteredGroups.isEmpty { + snapshot.appendSections([.end]) + snapshot.appendItems([viewModel.isRemote && viewModel.hasMoreRemoteSessions ? .loadMore : .end]) + } + let existing = Set(dataSource.snapshot().itemIdentifiers) + snapshot.reconfigureItems(snapshot.itemIdentifiers.filter { existing.contains($0) }) + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in + guard let self else { return } + self.collectionView.collectionViewLayout.invalidateLayout() + self.refreshVisibleHeaders() + } + updateFooter() + } + + #if DEBUG + /// 状态菜单只切换本地演示,重置演示权限后等待工作人员主动操作。 + func applyPreviewScenario(_ scenario: ScenicMaterialsScenario) { + driver.stop() + isDemoPhotoPermissionAllowed = true + viewModel.applyScenario(scenario) + refreshDisplay(animated: true) + } + #endif + + private func configureFilterButton(_ button: UIButton, identifier: String) { + var configuration = UIButton.Configuration.plain() + configuration.baseForegroundColor = ScenicMaterialsStyle.text + configuration.cornerStyle = .fixed + configuration.background.cornerRadius = 11 + configuration.contentInsets = NSDirectionalEdgeInsets(top: 8, leading: 12, bottom: 8, trailing: 32) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var result = incoming; result.font = .systemFont(ofSize: 15, weight: .medium); return result + } + button.configuration = configuration + button.contentHorizontalAlignment = .leading + button.backgroundColor = UIColor(hex: 0xF7F8FA) + button.layer.cornerRadius = 11 + button.layer.borderWidth = 1 + button.layer.borderColor = ScenicMaterialsStyle.border.cgColor + button.titleLabel?.lineBreakMode = .byTruncatingTail + button.titleLabel?.numberOfLines = 1 + button.accessibilityIdentifier = identifier + let chevron = UIImageView(image: UIImage(systemName: "chevron.down", withConfiguration: UIImage.SymbolConfiguration(pointSize: 10, weight: .medium))) + chevron.tintColor = ScenicMaterialsStyle.secondary + chevron.isUserInteractionEnabled = false + button.addSubview(chevron) + chevron.snp.makeConstraints { $0.trailing.equalToSuperview().inset(12); $0.centerY.equalToSuperview() } + } + + private func setupEmptyView() { + let icon = UIImageView(image: UIImage(systemName: "photo.on.rectangle.angled")) + icon.tintColor = ScenicMaterialsStyle.secondary.withAlphaComponent(0.5) + icon.contentMode = .scaleAspectFit + emptyTitle.textAlignment = .center + emptyTitle.numberOfLines = 0 + emptyMessage.textAlignment = .center + emptyMessage.numberOfLines = 0 + resetButton.setTitle("重置筛选", for: .normal) + resetButton.tintColor = ScenicMaterialsStyle.primary + resetButton.accessibilityIdentifier = "scenic.materials.resetFilters" + emptyView.accessibilityIdentifier = "scenic.materials.empty" + retryButton.setTitle("重新加载", for: .normal) + retryButton.accessibilityIdentifier = "scenic.materials.retry" + retryButton.addTarget(self, action: #selector(reloadRemoteMaterials), for: .touchUpInside) + let stack = UIStackView(arrangedSubviews: [icon, emptyTitle, emptyMessage, resetButton, retryButton]) + stack.axis = .vertical + stack.spacing = 14 + emptyView.addSubview(stack) + stack.snp.makeConstraints { make in + make.centerX.equalToSuperview(); make.centerY.equalToSuperview().offset(-24) + make.leading.trailing.equalToSuperview().inset(32) + } + icon.snp.makeConstraints { $0.height.equalTo(48) } + resetButton.snp.makeConstraints { $0.height.equalTo(44).priority(999) } + } + + private func configureDataSource() { + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] list, path, item in + guard let self else { return UICollectionViewCell() } + switch item { + case .clip(let id): + guard let clip = self.viewModel.clip(id: id), + let cell = list.dequeueReusableCell(withReuseIdentifier: "clip", for: path) as? ScenicMaterialClipCell else { return UICollectionViewCell() } + self.configureClip(cell, clip: clip) + return cell + case .expand(let id): + let cell = list.dequeueReusableCell(withReuseIdentifier: "expand", for: path) as! ScenicMaterialExpandCell + let expanded = self.viewModel.expandedGroupIDs.contains(id) + let remaining = max((self.viewModel.group(id: id)?.clips.count ?? 5) - 5, 0) + cell.configure(groupID: id, title: expanded ? "收起片段" : "展开其余 \(remaining) 段") + cell.onToggleExpanded = { [weak self] in + self?.viewModel.toggleExpandedGroup(id: id) + self?.refreshDisplay(animated: true) + } + return cell + case .loadMore: + let cell = list.dequeueReusableCell(withReuseIdentifier: "pageFooter", for: path) as! ScenicMaterialPageFooterCell + let title = self.isLoadingNextPage ? "正在加载更多场次…" : self.viewModel.loadMoreError != nil ? "加载失败,点击重试" : + "加载更多场次(\(self.viewModel.loadedRemoteSessionCount) / \(self.viewModel.remoteTotalCount))" + cell.configure(title: title, enabled: !self.isLoadingNextPage && !self.viewModel.isSelectionLocked) + cell.onLoadMore = { [weak self] in self?.loadMoreRemoteMaterials() } + return cell + case .retention, .end: + let cell = list.dequeueReusableCell(withReuseIdentifier: "text", for: path) as! ScenicMaterialTextCell + cell.configure(item == .retention ? self.viewModel.retentionTips : (self.viewModel.isRemote ? "已显示全部素材" : "已显示保留期内的全部演示记录"), identifier: item == .retention ? "scenic.materials.retention" : "scenic.materials.end") + return cell + } + } + dataSource.supplementaryViewProvider = { [weak self] list, kind, path in + guard let self, kind == UICollectionView.elementKindSectionHeader else { return nil } + let sections = self.dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(path.section), case .group(let id) = sections[path.section], + let group = self.viewModel.group(id: id) else { return nil } + let header = list.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "group", for: path) as! ScenicMaterialGroupHeaderView + self.configureHeader(header, group: group) + return header + } + } + + private func configureClip(_ cell: ScenicMaterialClipCell, clip: ScenicMaterialClip) { + let completed = viewModel.completedIDs.contains(clip.id) + let failed = viewModel.failedIDs.contains(clip.id) + let inBatch = viewModel.batchItemIDs.contains(clip.id) + let status: String? = completed ? (viewModel.isRemote ? "已保存相册" : "演示已下载") : failed ? "下载失败" : inBatch && viewModel.phase == .paused ? "已暂停" : nil + cell.configure(clip: clip, selected: viewModel.selectedIDs.contains(clip.id), + isSelectionEnabled: viewModel.canSelect(id: clip.id), statusText: status, + progress: inBatch && viewModel.phase == .downloading && !completed ? viewModel.progressByID[clip.id] ?? 0 : nil, + isHero: viewModel.group(id: clip.groupID)?.clips.first?.id == clip.id) + cell.onToggleSelection = { [weak self] in + self?.viewModel.toggleSelection(id: clip.id) + self?.refreshDisplay(animated: true) + } + cell.onPreview = { [weak self] in self?.preview(clip) } + } + + private func configureHeader(_ header: ScenicMaterialGroupHeaderView, group: ScenicMaterialGroup) { + let index = viewModel.filteredGroups.firstIndex { $0.id == group.id } ?? 0 + let showRoute = index == 0 || viewModel.filteredGroups[index - 1].routeID != group.routeID + let formatter = DateFormatter() + formatter.locale = Locale(identifier: "zh_CN") + formatter.calendar = viewModel.calendar + formatter.timeZone = viewModel.calendar.timeZone + formatter.dateFormat = "MM-dd HH:mm" + header.configure(groupID: group.id, routeName: showRoute ? viewModel.route(id: group.routeID)?.name : nil, + timeTitle: formatter.string(from: group.capturedAt), count: group.clips.count, + isSelected: viewModel.isGroupSelected(id: group.id), + canSelect: group.clips.contains { viewModel.canSelect(id: $0.id) }) + header.onToggleGroup = { [weak self] in + self?.viewModel.toggleGroup(id: group.id) + self?.refreshDisplay(animated: true) + } + } + + private func refreshVisibleHeaders() { + for path in collectionView.indexPathsForVisibleSupplementaryElements(ofKind: UICollectionView.elementKindSectionHeader) { + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(path.section), case .group(let id) = sections[path.section], + let group = viewModel.group(id: id), + let header = collectionView.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, at: path) as? ScenicMaterialGroupHeaderView else { continue } + configureHeader(header, group: group) + } + } + + private func makeLayout() -> UICollectionViewLayout { + UICollectionViewCompositionalLayout { [weak self] index, environment in + guard let self, let dataSource = self.dataSource else { return nil } + let sections = dataSource.snapshot().sectionIdentifiers + guard sections.indices.contains(index) else { return nil } + let section = sections[index] + guard case .group(let id) = section, let group = self.viewModel.group(id: id) else { + let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .fractionalHeight(1))) + let row = NSCollectionLayoutGroup.vertical(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(section == .end ? 48 : 36)), subitems: [item]) + let layout = NSCollectionLayoutSection(group: row) + layout.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16) + return layout + } + let width = max(environment.container.effectiveContentSize.width - 32, 1) + let heroHeight = width * 9 / 16 + let smallWidth = (width - 8) / 2 + let smallHeight = smallWidth * 9 / 16 + var rows: [NSCollectionLayoutItem] = [NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(heroHeight)))] + var height = heroHeight + var remaining = max(self.viewModel.visibleClips(in: group).count - 1, 0) + while remaining > 0 { + let count = min(remaining, 2) + let items = (0.. 5 { + rows.append(NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(40)))) + height += 48 + } + let grid = NSCollectionLayoutGroup.vertical(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(height)), subitems: rows) + grid.interItemSpacing = .fixed(8) + let layout = NSCollectionLayoutSection(group: grid) + layout.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 20, trailing: 16) + let previous = self.viewModel.filteredGroups.firstIndex { $0.id == id } ?? 0 + let showRoute = previous == 0 || self.viewModel.filteredGroups[previous - 1].routeID != group.routeID + layout.boundarySupplementaryItems = [NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(showRoute ? 94 : 48)), + elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)] + return layout + } + } + + private func updateFooter() { + let completed = viewModel.completedCount + let total = viewModel.totalCount + switch viewModel.phase { + case .idle: + footer.configure(title: "已选 \(viewModel.selectedCount) 段", detail: viewModel.isRemote ? nil : "本地演示 · 不下载或保存真实文件", + primaryTitle: "下载所选", primaryEnabled: viewModel.canStartDownload && !isLoadingNextPage) + case .downloading: + footer.configure(title: "下载中 · \(completed)/\(total) 段", detail: "请保持页面开启,切后台将暂停", + primaryTitle: "正在下载…", primaryEnabled: false, secondaryTitle: "取消", progress: Float(viewModel.downloadProgress), layout: .progress, isBusy: true) + case .paused: + footer.configure(title: "已暂停 · 已完成 \(completed)/\(total) 段", detail: "已完成项已保留,请手动继续", + primaryTitle: "继续下载", primaryEnabled: true, secondaryTitle: "取消", progress: Float(viewModel.downloadProgress), layout: .progress) + case .partialFailure: + footer.configure(title: "已下载 \(completed) 段 · 失败 \(viewModel.failedCount) 段", detail: viewModel.isRemote ? "成功项已保存相册" : "演示结果 · 未保存真实文件", + primaryTitle: "重试失败(\(viewModel.failedCount))", primaryEnabled: true, secondaryTitle: "继续选择", layout: .result) + case .completed: + footer.configure(title: viewModel.isRemote ? "已保存 \(completed) 段" : "演示完成 \(completed) 段", detail: viewModel.isRemote ? "可在系统相册查看" : "未写入系统相册", + primaryTitle: "继续选择素材", primaryEnabled: true, layout: .result) + } + } + + private func performPrimaryAction() { + guard !isLoadingNextPage, !viewModel.isLoading, !viewModel.isLoadingMore else { return } + if viewModel.phase == .completed { + viewModel.continueSelecting(); refreshDisplay(); return + } + if viewModel.isRemote { + guard authorizationTask == nil else { return } + authorizationTask = Task { @MainActor [weak self] in + let status = await PHPhotoLibrary.requestAuthorization(for: .addOnly) + guard let self else { return } + self.authorizationTask = nil + guard !Task.isCancelled, self.view.window != nil, + UIApplication.shared.applicationState == .active else { return } + guard status == .authorized || status == .limited else { + self.presentPhotoPermissionSettings() + return + } + self.startTransfer() + } + return + } + guard isDemoPhotoPermissionAllowed else { presentPermissionDemo(); return } + startTransfer() + } + + private func startTransfer() { + guard !isLoadingNextPage, !viewModel.isLoading, !viewModel.isLoadingMore else { return } + let started: Bool + switch viewModel.phase { + case .idle: started = viewModel.startDownload() + case .paused: started = viewModel.continueDownload() + case .partialFailure: started = viewModel.retryFailedDownloads() + case .downloading, .completed: started = false + } + refreshDisplay(animated: false) + guard started else { return } + if viewModel.isRemote, let batchID = viewModel.batchID { + let items = viewModel.pendingIDs.compactMap { id -> ScenicMaterialDownloadItem? in + guard let clip = viewModel.clip(id: id), let url = clip.remoteURL else { return nil } + return ScenicMaterialDownloadItem(id: id, remoteURL: url, + fileName: url.pathExtension.isEmpty ? "scenic-material.mp4" : url.lastPathComponent) + } + downloadService.start(items: items, batchID: batchID) { [weak self] id, token, event in + self?.viewModel.receive(event, clipID: id, batchID: token) + self?.refreshDisplay(animated: false) + } onFailure: { [weak self] _, error in self?.showToast(error.localizedDescription) } + } else { + driver.start(viewModel: viewModel) { [weak self] in self?.refreshDisplay(animated: false) } + } + } + + @objc private func pauseForBackground() { + driver.stop() + downloadService.stop() + viewModel.pauseDownload() + if isViewLoaded { refreshDisplay(animated: false) } + } + + @objc private func selectRoute() { + guard !viewModel.isSelectionLocked else { return } + let picker = ScenicMaterialRouteFilterViewController(routes: viewModel.routes, selectedRouteID: viewModel.selectedRouteID) + picker.onSelectRoute = { [weak self] id in + self?.viewModel.setRoute(id: id) + self?.reloadRemoteMaterials() + self?.refreshDisplay() + self?.collectionView.setContentOffset(.zero, animated: false) + } + present(picker, animated: true) + } + + @objc private func selectDateRange() { + guard !viewModel.isSelectionLocked else { return } + let picker = ScenicMaterialDateFilterViewController(start: viewModel.dateRange?.start, end: viewModel.dateRange?.end, + minimumDate: viewModel.minimumDate, maximumDate: viewModel.maximumDate, + calendar: viewModel.calendar) + picker.onSelectRange = { [weak self] start, end in + guard let self else { return } + if self.viewModel.setDateRange(start: start, end: end) { + self.reloadRemoteMaterials() + self.refreshDisplay() + self.collectionView.setContentOffset(.zero, animated: false) + } else { self.showToast("请选择保留期内的有效日期范围") } + } + present(picker, animated: true) + } + + @objc private func resetFilters() { + viewModel.resetFilters() + reloadRemoteMaterials() + refreshDisplay() + } + + private func preview(_ clip: ScenicMaterialClip) { + guard clip.isAvailable, let group = viewModel.group(id: clip.groupID) else { return } + let controller = ScenicMaterialPreviewViewController(clip: clip, routeName: viewModel.route(id: group.routeID)?.name ?? "景区航线", + capturedAt: group.capturedAt, calendar: viewModel.calendar) + present(controller, animated: true) + } + + private func presentPhotoPermissionSettings() { + guard presentedViewController == nil else { return } + let alert = UIAlertController(title: "需要相册保存权限", message: "请允许添加照片和视频,以保存所选素材。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "取消", style: .cancel)) + alert.addAction(UIAlertAction(title: "去设置", style: .default) { _ in + if let url = URL(string: UIApplication.openSettingsURLString) { UIApplication.shared.open(url) } + }) + present(alert, animated: true) + } + + private func presentPermissionDemo() { + guard presentedViewController == nil else { return } + let alert = UIAlertController(title: "需要相册保存权限", message: "真实下载需允许保存视频。此处仅演示权限流程,不读取或修改系统权限。", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "暂不下载", style: .cancel)) + alert.addAction(UIAlertAction(title: "演示允许权限", style: .default) { [weak self] _ in + self?.isDemoPhotoPermissionAllowed = true + self?.refreshDisplay(animated: false) + self?.showToast("演示权限已恢复,请手动下载") + }) + present(alert, animated: true) + } +} + +/// 分页末行仅负责触发用户主动加载,加载中禁用,失败后由页面设置重试文案。 +@MainActor +final class ScenicMaterialPageFooterCell: UICollectionViewCell { + /// 请求下一页或重试失败页。 + var onLoadMore: (() -> Void)? + private let button = UIButton(type: .system) + + /// 创建完整行宽的可访问加载按钮。 + override init(frame: CGRect) { + super.init(frame: frame) + button.titleLabel?.font = .systemFont(ofSize: 13) + button.tintColor = ScenicMaterialsStyle.primary + button.accessibilityIdentifier = "scenic.materials.loadMore" + button.addTarget(self, action: #selector(loadMore), for: .touchUpInside) + contentView.addSubview(button) + button.snp.makeConstraints { $0.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + super.prepareForReuse() + onLoadMore = nil + } + + /// 显示数量、加载中或重试状态,避免重复触发网络请求。 + func configure(title: String, enabled: Bool) { + button.setTitle(title, for: .normal) + button.isEnabled = enabled + } + + @objc private func loadMore() { + guard button.isEnabled else { return } + onLoadMore?() + } +} + +/// 空镜列表的保留期与末尾说明,不参与素材选择。 +private final class ScenicMaterialTextCell: UICollectionViewCell { + private let label = ScenicMaterialsStyle.label(size: 12, color: ScenicMaterialsStyle.secondary) + + override init(frame: CGRect) { + super.init(frame: frame) + contentView.addSubview(label) + label.snp.makeConstraints { $0.edges.equalToSuperview() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 根据单元用途更新文案及可访问标识。 + func configure(_ text: String, identifier: String) { + label.text = text + label.accessibilityIdentifier = identifier + } +} diff --git a/suixinkan/UI/Training/TrainingCenterViewController.swift b/suixinkan/UI/Training/TrainingCenterViewController.swift new file mode 100644 index 0000000..2df2fe0 --- /dev/null +++ b/suixinkan/UI/Training/TrainingCenterViewController.swift @@ -0,0 +1,384 @@ +import SnapKit +import UIKit + +/// 培训首页、完整任务列表和考试记录共用一个页面,与小程序入口保持一致。 +@MainActor +final class TrainingCenterViewController: TrainingBaseViewController { + /// 差异化列表中的任务与考试记录标识。 + private enum Item: Hashable { case task(String), attempt(String) } + private var reloadTask: Task? + private var reloadLoadingToken: UUID? + private var moreTask: Task? + private var moreLoadingToken: UUID? + private var searchTask: Task? + private let service: any TrainingDataServing + private let viewModel = TrainingRemoteCenterViewModel() + private let tableView = UITableView(frame: .zero, style: .plain) + private let refreshControl = UIRefreshControl() + private let header = UIStackView() + private let hero = UIStackView() + private let greetingLabel = TrainingUI.text(size: 14, color: .white) + private let titleLabel = TrainingUI.text("我的培训中心", size: 18, weight: .bold, color: .white) + private var statLabels: [UILabel] = [] + private let headingLabel = TrainingUI.text(size: 15.5, weight: .semibold) + private let viewAllButton = TrainingUI.button("查看全部", plain: true) + private let filters = UIStackView() + private var filterButtons: [UIButton] = [] + private let searchField = UITextField() + private let tabBar = UIStackView() + private let tabBackground = UIView() + private var tabButtons: [UIButton] = [] + private let footer = UIStackView() + private let stateLabel = TrainingUI.text(size: 14, color: TrainingUI.muted) + private let retryButton = TrainingUI.button("重新加载", secondary: true) + private let moreButton = TrainingUI.button("加载更多记录", plain: true) + private var dataSource: UITableViewDiffableDataSource! + + /// 默认使用当前登录身份连接环境配置中的培训接口。 + init(service: (any TrainingDataServing)? = nil, showsHistory: Bool = false) { + self.service = service ?? TrainingRemoteServiceFactory.production() + viewModel.tab = showsHistory ? .records : .home + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { + TrainingUI.navigation(self, title: "培训中心") + } + + override func setupUI() { + view.backgroundColor = TrainingUI.background + header.axis = .vertical + header.spacing = 0 + hero.axis = .vertical + hero.spacing = 8 + hero.backgroundColor = UIColor(red: 45/255, green: 128/255, blue: 250/255, alpha: 1) + hero.layer.cornerRadius = 14 + hero.isLayoutMarginsRelativeArrangement = true + hero.layoutMargins = UIEdgeInsets(top: 19, left: 17, bottom: 18, right: 17) + hero.addArrangedSubview(greetingLabel) + hero.addArrangedSubview(titleLabel) + let stats = UIStackView() + stats.distribution = .fillEqually + stats.alignment = .fill + for caption in ["待考试", "已完成", "最近得分"] { + let value = TrainingUI.text("—", size: 23, weight: .bold, color: .white) + value.textAlignment = .center + statLabels.append(value) + let name = TrainingUI.text(caption, size: 12.5, color: .white) + name.textAlignment = .center + let column = UIStackView(arrangedSubviews: [value, name]) + column.axis = .vertical + column.spacing = 6 + stats.addArrangedSubview(column) + if statLabels.count > 1 { + let line = UIView() + line.backgroundColor = UIColor.white.withAlphaComponent(0.4) + column.addSubview(line) + line.snp.makeConstraints { $0.leading.top.bottom.equalToSuperview(); $0.width.equalTo(1) } + } + } + hero.setCustomSpacing(18, after: titleLabel) + hero.addArrangedSubview(stats) + let heroContainer = UIStackView(arrangedSubviews: [hero]) + heroContainer.axis = .vertical + heroContainer.isLayoutMarginsRelativeArrangement = true + heroContainer.layoutMargins = UIEdgeInsets(top: 12, left: 13, bottom: 12, right: 13) + header.addArrangedSubview(heroContainer) + let body = UIStackView() + body.axis = .vertical + body.spacing = 11 + body.isLayoutMarginsRelativeArrangement = true + body.layoutMargins = UIEdgeInsets(top: 14, left: 13, bottom: 10, right: 13) + let heading = UIStackView(arrangedSubviews: [headingLabel, viewAllButton]) + heading.alignment = .center + heading.spacing = 8 + headingLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + viewAllButton.setContentHuggingPriority(.required, for: .horizontal) + body.addArrangedSubview(heading) + filters.distribution = .fillEqually + filters.spacing = 9 + for (index, state) in TrainingLearnerStatus.allCases.enumerated() { + let button = TrainingUI.button(state.title, secondary: true) + var configuration = button.configuration + configuration?.contentInsets = NSDirectionalEdgeInsets(top: 12, leading: 6, bottom: 12, trailing: 6) + configuration?.titleAlignment = .center + configuration?.titleLineBreakMode = .byWordWrapping + button.configuration = configuration + button.tag = index + button.accessibilityIdentifier = "training.filter.\(button.tag)" + button.addTarget(self, action: #selector(filterTapped(_:)), for: .touchUpInside) + filterButtons.append(button) + filters.addArrangedSubview(button) + } + body.addArrangedSubview(filters) + searchField.font = .systemFont(ofSize: 13) + searchField.backgroundColor = .white + searchField.layer.cornerRadius = 8 + searchField.placeholder = "搜索任务或课程名称" + searchField.clearButtonMode = .whileEditing + searchField.returnKeyType = .search + searchField.accessibilityIdentifier = "training.search" + searchField.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 12, height: 1)) + searchField.leftViewMode = .always + searchField.snp.makeConstraints { $0.height.equalTo(44) } + body.addArrangedSubview(searchField) + header.addArrangedSubview(body) + tableView.backgroundColor = .clear + tableView.separatorStyle = .none + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 250 + tableView.delegate = self + tableView.keyboardDismissMode = .onDrag + tableView.refreshControl = refreshControl + tableView.register(TrainingTaskCell.self, forCellReuseIdentifier: TrainingTaskCell.reuseIdentifier) + tableView.register(TrainingRecordCell.self, forCellReuseIdentifier: TrainingRecordCell.reuseIdentifier) + tableView.tableHeaderView = header + footer.axis = .vertical + footer.spacing = 12 + footer.isLayoutMarginsRelativeArrangement = true + footer.layoutMargins = UIEdgeInsets(top: 24, left: 26, bottom: 24, right: 26) + stateLabel.textAlignment = .center + [stateLabel, retryButton, moreButton].forEach(footer.addArrangedSubview) + tableView.tableFooterView = footer + tabBackground.backgroundColor = .white + let line = UIView() + line.backgroundColor = TrainingUI.border + tabBackground.addSubview(line) + line.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview(); $0.height.equalTo(1) } + tabBar.distribution = .fillEqually + for tab in TrainingCenterTab.allCases { + let button = TrainingUI.button(tab.title, plain: true) + button.tag = tab.rawValue + button.accessibilityIdentifier = "training.tab.\(tab.rawValue)" + button.addTarget(self, action: #selector(tabTapped(_:)), for: .touchUpInside) + tabButtons.append(button) + tabBar.addArrangedSubview(button) + } + view.addSubview(tableView) + view.addSubview(tabBackground) + tabBackground.addSubview(tabBar) + configureDataSource() + applyState() + } + + override func setupConstraints() { + tabBackground.snp.makeConstraints { $0.leading.trailing.bottom.equalToSuperview() } + tabBar.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(12) + $0.top.equalToSuperview().offset(7) + $0.bottom.equalTo(view.safeAreaLayoutGuide).offset(-7) + } + tableView.snp.makeConstraints { + $0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.bottom.equalTo(tabBackground.snp.top) + } + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + sizeTableSupplementaryViews() + } + + private func sizeTableSupplementaryViews() { + let width = tableView.bounds.width + guard width > 0 else { return } + for stack in [header, footer] { + let height = stack.systemLayoutSizeFitting(CGSize(width: width, height: 0), withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel).height + if abs(stack.frame.height - height) > 0.5 || stack.frame.width != width { + stack.frame = CGRect(x: 0, y: 0, width: width, height: height) + if stack === header { tableView.tableHeaderView = header } else { tableView.tableFooterView = footer } + } + } + } + + override func bindActions() { + retryButton.accessibilityIdentifier = "training.center.retry" + moreButton.accessibilityIdentifier = "training.center.more" + refreshControl.addTarget(self, action: #selector(reloadTapped), for: .valueChanged) + retryButton.addTarget(self, action: #selector(reloadTapped), for: .touchUpInside) + viewAllButton.addTarget(self, action: #selector(viewAllTapped), for: .touchUpInside) + searchField.addTarget(self, action: #selector(searchChanged), for: .editingChanged) + moreButton.addTarget(self, action: #selector(moreTapped), for: .touchUpInside) + } + + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated); reloadTapped() } + override func onSessionDidExpire() { navigationController?.popToRootViewController(animated: true) } + + private func configureDataSource() { + dataSource = UITableViewDiffableDataSource(tableView: tableView) { [weak self] table, indexPath, item in + guard let self else { return nil } + switch item { + case .task(let id): + guard let task = self.viewModel.tasks.first(where: { $0.id == id }), let cell = table.dequeueReusableCell(withIdentifier: TrainingTaskCell.reuseIdentifier, for: indexPath) as? TrainingTaskCell else { return nil } + cell.configure(task: task) + cell.onAction = { [weak self] in self?.openTask(task, directAction: true) } + return cell + case .attempt(let attemptID): + guard let attempt = self.viewModel.records.first(where: { $0.id == attemptID }), let cell = table.dequeueReusableCell(withIdentifier: TrainingRecordCell.reuseIdentifier, for: indexPath) as? TrainingRecordCell else { return nil } + cell.configure(attempt: attempt) + return cell + } + } + } + + private func applyState(completion: (() -> Void)? = nil) { + let session = AppStore.shared.session + let name = [session.realName, session.userName].first { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } ?? "当前学员" + greetingLabel.text = "你好,\(name)" + let context = session.currentScenicName.trimmingCharacters(in: .whitespacesAndNewlines) + titleLabel.text = context.isEmpty ? "我的培训中心" : "\(context) · 培训中心" + for (label, value) in zip(statLabels, [String(viewModel.pendingCount), String(viewModel.completedCount), viewModel.latestScore]) { label.text = value } + headingLabel.text = switch viewModel.tab { case .home: "新政策与必读内容"; case .tasks: "我的学习任务"; case .records: "考试记录" } + viewAllButton.isHidden = viewModel.tab != .home + filters.isHidden = viewModel.tab != .tasks + searchField.isHidden = viewModel.tab != .tasks + for (index, button) in filterButtons.enumerated() { + let state = TrainingLearnerStatus.allCases[index] + let selected = state == viewModel.filter + var configuration = button.configuration + configuration?.title = switch state { + case .pendingExam: "待考试 \(viewModel.pendingCount)" + case .completed: "已完成 \(viewModel.completedCount)" + case .ended: state.title + } + configuration?.background.backgroundColor = selected ? TrainingUI.primary.withAlphaComponent(0.09) : .white + configuration?.baseForegroundColor = selected ? TrainingUI.primary : TrainingUI.muted + button.configuration = configuration + button.accessibilityTraits = selected ? [.button, .selected] : .button + } + for (index, button) in tabButtons.enumerated() { + var configuration = button.configuration + configuration?.baseForegroundColor = index == viewModel.tab.rawValue ? TrainingUI.primary : TrainingUI.muted + button.configuration = configuration + button.accessibilityTraits = index == viewModel.tab.rawValue ? [.button, .selected] : .button + } + let items: [Item] = viewModel.tab == .records ? viewModel.records.map { .attempt($0.id) } : viewModel.tasks.map { .task($0.id) } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + snapshot.appendItems(items) + snapshot.reconfigureItems(items.filter { dataSource.snapshot().indexOfItem($0) != nil }) + dataSource.apply(snapshot, animatingDifferences: true, completion: completion) + stateLabel.text = viewModel.errorMessage ?? (viewModel.isLoading ? "正在加载培训任务…" : viewModel.tab == .records ? "暂无考试记录\n交卷后可在此查看成绩和解析" : "暂无符合条件的任务\n景区分配给当前账号的任务会显示在这里") + stateLabel.isHidden = !items.isEmpty + retryButton.isHidden = viewModel.errorMessage == nil + retryButton.isEnabled = !viewModel.isLoading + moreButton.isHidden = !viewModel.hasMore + moreButton.isEnabled = !viewModel.isLoadingMore + var moreConfiguration = moreButton.configuration + moreConfiguration?.title = viewModel.isLoadingMore ? "正在加载…" : "加载更多" + moreButton.configuration = moreConfiguration + if !viewModel.isLoading { refreshControl.endRefreshing() } + sizeTableSupplementaryViews() + } + + /// 页面出现和下拉刷新都读取最新本人任务。 + func reload() async { + await viewModel.load(service: service) + guard !Task.isCancelled else { return } + if viewModel.isIdentityInvalid { navigationController?.popToRootViewController(animated: false); return } + await withCheckedContinuation { (continuation: CheckedContinuation) in + applyState { continuation.resume() } + } + } + + /// 在同一页面切换入口,返回课程时保留筛选上下文。 + func selectTab(_ tab: TrainingCenterTab) { + view.endEditing(true) + viewModel.selectTab(tab) + searchField.text = "" + reloadTapped() + tableView.setContentOffset(.zero, animated: false) + } + + @objc private func reloadTapped() { + scheduleReload(showsLoading: true) + } + + private func releaseReloadLoading() { + if let token = reloadLoadingToken { endRequestLoading(token) } + reloadLoadingToken = nil + } + + private func releaseMoreLoading() { + if let token = moreLoadingToken { endRequestLoading(token) } + moreLoadingToken = nil + } + + private func scheduleReload(showsLoading: Bool) { + if showsLoading { + searchTask?.cancel() + searchTask = nil + } + reloadTask?.cancel() + releaseReloadLoading() + moreTask?.cancel() + moreTask = nil + releaseMoreLoading() + let token = showsLoading ? beginRequestLoading() : nil + reloadLoadingToken = token + reloadTask = Task { @MainActor in + defer { + if let token { endRequestLoading(token) } + if reloadLoadingToken == token { reloadLoadingToken = nil } + } + await reload() + } + } + @objc private func tabTapped(_ button: UIButton) { if let tab = TrainingCenterTab(rawValue: button.tag) { selectTab(tab) } } + @objc private func filterTapped(_ button: UIButton) { + guard TrainingLearnerStatus.allCases.indices.contains(button.tag) else { return } + viewModel.filter = TrainingLearnerStatus.allCases[button.tag] + reloadTapped() + } + @objc private func searchChanged() { + viewModel.setKeyword(searchField.text ?? "") + reloadTask?.cancel() + releaseReloadLoading() + moreTask?.cancel() + moreTask = nil + releaseMoreLoading() + searchTask?.cancel() + moreButton.isHidden = true + searchTask = Task { @MainActor [weak self] in + do { try await Task.sleep(for: .milliseconds(300)) } catch { return } + self?.scheduleReload(showsLoading: false) + } + } + @objc private func moreTapped() { + guard moreTask == nil, viewModel.hasMore, !viewModel.isLoading, !viewModel.isLoadingMore else { return } + let token = beginRequestLoading() + moreLoadingToken = token + moreTask = Task { @MainActor in + defer { + endRequestLoading(token) + if moreLoadingToken == token { + moreLoadingToken = nil + moreTask = nil + } + } + await viewModel.loadMore(service: service) + if viewModel.isIdentityInvalid { navigationController?.popToRootViewController(animated: false); return } + applyState() + } + } + @objc private func viewAllTapped() { viewModel.filter = .pendingExam; selectTab(.tasks) } + + private func openTask(_ task: TrainingTaskSummary, directAction: Bool) { + let controller: UIViewController = directAction && task.learnerStatus == .pendingExam && task.learning.canStartExam ? TrainingExamViewController(taskID: task.id, service: service) : TrainingCourseViewController(taskID: task.id, service: service) + navigationController?.pushViewController(controller, animated: true) + } +} + +extension TrainingCenterViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + guard let item = dataSource.itemIdentifier(for: indexPath) else { return } + switch item { + case .task(let id): if let task = viewModel.tasks.first(where: { $0.id == id }) { openTask(task, directAction: false) } + case .attempt(let attemptID): if let attempt = viewModel.records.first(where: { $0.id == attemptID }) { navigationController?.pushViewController(TrainingResultViewController(taskID: attempt.taskID, attemptID: attempt.id, service: service), animated: true) } + } + } +} diff --git a/suixinkan/UI/Training/TrainingCourseViewController.swift b/suixinkan/UI/Training/TrainingCourseViewController.swift new file mode 100644 index 0000000..176bf71 --- /dev/null +++ b/suixinkan/UI/Training/TrainingCourseViewController.swift @@ -0,0 +1,525 @@ +import SafariServices +import SnapKit +import UIKit + +/// 原生课程信息与附件文件预览,并上报服务端确认的有效前台读时。 +@MainActor +final class TrainingCourseViewController: TrainingBaseViewController { + private let service: any TrainingDataServing + private let viewModel: TrainingRemoteReadingViewModel + private let validateIdentity: @MainActor @Sendable () -> Bool + private let documentLoader: any TrainingDocumentLoading + private let scrollView = UIScrollView() + private let contentStack = UIStackView() + private let metadataStack = UIStackView() + private let taskTitleLabel = TrainingUI.text(size: 17, weight: .semibold) + private let courseNameLabel = TrainingUI.text(size: 12.5, color: TrainingUI.muted) + private let examInfoLabel = TrainingUI.text(size: 12.5, color: TrainingUI.muted) + private let introductionLabel = TrainingUI.text(size: 12.5, color: TrainingUI.muted) + private let previewView = TrainingDocumentPreviewView() + private var previewHeightConstraint: Constraint? + private var localDocument: TrainingLocalDocument? + private let stepView = TrainingStepView(currentStep: .learning) + private let bottomStack = UIStackView() + private let noticeLabel = TrainingUI.label(style: .footnote, color: AppColor.textSecondary) + private let actionButton = TrainingUI.button("正在加载课程…") + private var readingTimer: Timer? + private var contentTask: Task? + private var readingTask: Task? + private var closingTask: Task? + private var closingGeneration = 0 + private var appIsActive = UIApplication.shared.applicationState == .active + private var isOpeningExternalLink = false + private var contentIsReady = false + private var contentLoadFailed = false + private var pageIsVisible = false + private var userRequestID: UUID? + + /// 用户操作独占的请求票据;缓存复用仍防重复操作,但不展示全局进度。 + private struct UserRequest { + let id: UUID + let loadingToken: UUID? + } + + /// 当前任务标识,成绩页可复用已有课程页面。 + var taskID: String { viewModel.taskID } + + /// 使用正式接口与独立文件下载器读取课程附件,支持测试注入本地文件。 + init(taskID: String, service: any TrainingDataServing, documentLoader: any TrainingDocumentLoading = TrainingDocumentLoader()) { + self.service = service + self.documentLoader = documentLoader + let session = AppStore.shared.session + let scope = session.accountCachePrefix + let scenicID = session.currentScenicId + let storeID = session.currentStoreId + let token = session.token + let validate: @MainActor @Sendable () -> Bool = { + let current = AppStore.shared.session + return current.accountCachePrefix == scope && current.currentScenicId == scenicID + && current.currentStoreId == storeID && current.token == token + } + validateIdentity = validate + viewModel = TrainingRemoteReadingViewModel(taskID: taskID, service: service, validateIdentity: validate) + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { TrainingUI.navigation(self, title: "课程学习") } + + override func setupUI() { + view.backgroundColor = TrainingUI.background + scrollView.delegate = self + scrollView.accessibilityIdentifier = "training.reading.scroll" + scrollView.alwaysBounceVertical = true + contentStack.axis = .vertical + contentStack.spacing = 14 + metadataStack.axis = .vertical + metadataStack.spacing = 8 + metadataStack.isHidden = true + [taskTitleLabel, courseNameLabel, examInfoLabel, introductionLabel].forEach(metadataStack.addArrangedSubview) + taskTitleLabel.accessibilityIdentifier = "training.reading.taskTitle" + courseNameLabel.accessibilityIdentifier = "training.reading.courseName" + examInfoLabel.accessibilityIdentifier = "training.reading.examInfo" + introductionLabel.accessibilityIdentifier = "training.reading.introduction" + contentStack.addArrangedSubview(metadataStack) + contentStack.addArrangedSubview(previewView) + stepView.isHidden = true + bottomStack.axis = .vertical + bottomStack.spacing = 8 + bottomStack.layoutMargins = UIEdgeInsets(top: 10, left: 12, bottom: 10, right: 12) + bottomStack.isLayoutMarginsRelativeArrangement = true + bottomStack.backgroundColor = AppColor.cardBackground + bottomStack.addArrangedSubview(noticeLabel) + bottomStack.addArrangedSubview(actionButton) + actionButton.accessibilityIdentifier = "training.reading.action" + view.addSubview(stepView) + view.addSubview(scrollView) + scrollView.addSubview(contentStack) + view.addSubview(bottomStack) + previewView.onReady = { [weak self] previewID in + guard let self else { return } + guard self.validateIdentity() else { self.identityChanged(); return } + guard let id = self.viewModel.currentAttachmentID, + self.viewModel.markAttachmentRendered(id: id, previewID: previewID) else { return } + self.contentIsReady = true + self.contentLoadFailed = false + self.applyState() + self.resumeReading() + } + previewView.onFailure = { [weak self] previewID, message in + guard let self, self.viewModel.attachmentPreviewID == previewID, + let id = self.viewModel.currentAttachmentID else { return } + self.viewModel.reportAttachmentFailure(id: id, previewID: previewID, message: message) + self.contentIsReady = false + self.contentLoadFailed = true + self.pauseReading() + self.applyState() + } + previewView.onOpenLink = { [weak self] url in self?.openExternalLink(url) } + previewView.onContentHeightChange = { [weak self] height in + guard let self else { return } + self.previewHeightConstraint?.update(offset: height) + self.view.layoutIfNeeded() + let minimum = -self.scrollView.adjustedContentInset.top + let maximum = max(minimum, self.scrollView.contentSize.height - self.scrollView.bounds.height + + self.scrollView.adjustedContentInset.bottom) + if self.scrollView.contentOffset.y > maximum { + self.scrollView.setContentOffset(CGPoint(x: 0, y: maximum), animated: false) + } + self.previewView.notifyIfRenderedAndVisible() + if self.isContentVisible { self.resumeReading() } + } + previewView.onScrollToPosition = { [weak self] top in self?.scrollToDocumentPosition(top) } + applyState() + } + + override func setupConstraints() { + stepView.snp.makeConstraints { + $0.top.equalTo(view.safeAreaLayoutGuide).offset(8) + $0.leading.trailing.equalToSuperview().inset(13) + } + scrollView.snp.makeConstraints { + $0.top.equalTo(stepView.snp.bottom).offset(8) + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.bottom.equalTo(bottomStack.snp.top) + } + contentStack.snp.makeConstraints { + $0.edges.equalTo(scrollView.contentLayoutGuide).inset(UIEdgeInsets(top: 14, left: 13, bottom: 14, right: 13)) + $0.width.equalTo(scrollView.frameLayoutGuide).offset(-26) + } + previewView.snp.makeConstraints { + previewHeightConstraint = $0.height.equalTo(previewView.preferredContentHeight).constraint + } + bottomStack.snp.makeConstraints { $0.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) } + } + + override func bindActions() { + actionButton.addTarget(self, action: #selector(actionTapped), for: .touchUpInside) + NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActive), name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil) + for name in [NotificationName.accountDidSwitch, NotificationName.scenicDidChange, NotificationName.userDidLogout] { + NotificationCenter.default.addObserver(self, selector: #selector(identityChanged), name: name, object: nil) + } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + pageIsVisible = true + let previousContent = contentTask + contentTask = Task { @MainActor [weak self] in + guard let self else { return } + await previousContent?.value + guard !Task.isCancelled, pageIsVisible, navigationController?.topViewController === self, + userRequestID == nil else { return } + if viewModel.task == nil { loadCourse() } + else if localDocument == nil, let id = viewModel.currentAttachmentID { selectAttachment(id) } + else { + await viewModel.refreshProgress() + applyState() + resumeReading() + } + } + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + pageIsVisible = false + contentTask?.cancel() + pauseReading() + } + + override func onSessionDidExpire() { identityChanged() } + + private var isContentVisible: Bool { + let visibleFrame = previewView.convert(previewView.bounds, to: view).intersection(scrollView.frame) + return pageIsVisible && contentIsReady && viewModel.isAttachmentRendered && previewView.isReady + && visibleFrame.height >= 40 && !contentLoadFailed && !isOpeningExternalLink && presentedViewController == nil + && navigationController?.topViewController === self && appIsActive && UIApplication.shared.applicationState == .active + } + + private func loadCourse() { + guard let request = beginUserRequest(showsLoading: true) else { return } + resetDocument() + contentTask = Task { @MainActor [weak self] in + guard let self else { return } + await performUserRequest(request) { + await self.viewModel.load() + await self.loadSelectedDocument() + } + self.applyMetadata() + self.applyState() + } + } + + private func selectAttachment(_ id: String) { + guard let request = beginUserRequest(showsLoading: true) else { return } + resetDocument() + contentTask = Task { @MainActor [weak self] in + guard let self else { return } + await performUserRequest(request) { + await self.viewModel.selectAttachment(id: id) + await self.loadSelectedDocument() + } + self.applyMetadata() + self.applyState() + } + } + + private func resetDocument() { + pauseReading() + contentIsReady = false + contentLoadFailed = false + previewView.showStatus("正在加载附件…") + localDocument?.removeTemporaryFile() + localDocument = nil + scrollView.setContentOffset(CGPoint(x: 0, y: -scrollView.adjustedContentInset.top), animated: false) + } + + private func scrollToDocumentPosition(_ top: CGFloat) { + view.layoutIfNeeded() + let target = previewView.convert(CGPoint(x: 0, y: top), to: scrollView).y - scrollView.adjustedContentInset.top + let minimum = -scrollView.adjustedContentInset.top + let maximum = max(minimum, scrollView.contentSize.height - scrollView.bounds.height + scrollView.adjustedContentInset.bottom) + scrollView.setContentOffset(CGPoint(x: 0, y: min(maximum, max(minimum, target))), animated: true) + } + + private func loadSelectedDocument() async { + guard !Task.isCancelled, pageIsVisible, !viewModel.isInvalidated else { return } + applyMetadata() + guard let attachment = viewModel.currentAttachment, let link = viewModel.currentAttachmentLink, + let previewID = viewModel.attachmentPreviewID else { + contentLoadFailed = viewModel.errorMessage != nil + previewView.showStatus(viewModel.errorMessage ?? "暂未上传课程附件") + return + } + do { + let document = try await documentLoader.load(attachment: attachment, link: link) + guard !Task.isCancelled, pageIsVisible, !viewModel.isInvalidated, + viewModel.attachmentPreviewID == previewID else { document.removeTemporaryFile(); return } + guard validateIdentity() else { + document.removeTemporaryFile() + identityChanged() + return + } + localDocument = document + previewView.show(document, requestID: previewID) + } catch { + guard !Task.isCancelled, pageIsVisible, !viewModel.isInvalidated, + viewModel.attachmentPreviewID == previewID else { return } + contentLoadFailed = true + viewModel.reportAttachmentFailure(id: attachment.id, previewID: previewID, message: error.localizedDescription) + previewView.showStatus(error.localizedDescription) + } + } + + private func applyMetadata() { + guard let task = viewModel.task?.summary, let course = viewModel.course else { return } + metadataStack.isHidden = false + taskTitleLabel.text = task.title + courseNameLabel.text = course.title + courseNameLabel.isHidden = course.title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + examInfoLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.questionCount) 题 · \(task.passScore ?? 0) 分及格" : "仅学习" + introductionLabel.text = course.introduction + introductionLabel.isHidden = course.introduction.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + } + + private func applyState() { + guard !viewModel.isInvalidated else { leaveUnavailableCourse(); return } + if let task = viewModel.task?.summary { + stepView.configure(mode: task.mode) + stepView.isHidden = false + } + let canInteract = userRequestID == nil + actionButton.isUserInteractionEnabled = canInteract + guard canInteract else { return } + if contentLoadFailed || viewModel.attachmentErrorMessage != nil || viewModel.task == nil { + noticeLabel.text = viewModel.errorMessage ?? "正在加载课程…" + setActionTitle(contentLoadFailed || viewModel.errorMessage != nil ? "重新加载附件" : "正在加载课程…") + actionButton.isEnabled = !viewModel.isLoading && (contentLoadFailed || viewModel.errorMessage != nil) + return + } + if viewModel.hasLoadedAttachments && viewModel.attachments.isEmpty { + noticeLabel.text = "暂未上传课程附件" + setActionTitle("返回培训中心") + actionButton.isEnabled = true + return + } + if viewModel.progress?.learnerStatus == .ended { + noticeLabel.text = "任务已结束,仅可回顾课程内容" + setActionTitle("返回培训中心") + actionButton.isEnabled = true + readingTimer?.invalidate() + readingTimer = nil + return + } + if let progress = viewModel.progress, progress.readingCompleted { + noticeLabel.text = viewModel.readingErrorMessage ?? "课程阅读已完成" + if viewModel.task?.summary.mode == .exam && viewModel.task?.summary.learnerStatus == .pendingExam + && progress.learnerStatus == .pendingExam && progress.canStartExam { setActionTitle("开始考试") } + else { setActionTitle("返回培训中心") } + actionButton.isEnabled = true + readingTimer?.invalidate() + readingTimer = nil + return + } + if !contentIsReady { + noticeLabel.text = "正在打开课程附件…" + setActionTitle("正在加载附件…") + actionButton.isEnabled = false + return + } + if !viewModel.canStudy { + readingTimer?.invalidate() + readingTimer = nil + noticeLabel.text = viewModel.readingErrorMessage ?? "当前任务可回顾课程,不能继续提交学习记录" + setActionTitle("返回培训中心") + actionButton.isEnabled = true + } else if let error = viewModel.errorMessage { + readingTimer?.invalidate() + readingTimer = nil + noticeLabel.text = error + setActionTitle(viewModel.readingErrorMessage != nil ? "重试保存并继续学习" : "重新加载课程") + actionButton.isEnabled = true + } else { + let action = viewModel.task?.summary.mode == .exam ? "开始考试" : "完成学习" + noticeLabel.text = viewModel.readingNotice ?? (viewModel.remainingSeconds == 0 ? "正在确认学习进度…" : "请在前台阅读课程内容,倒计时结束后等待保存确认") + setActionTitle("\(action)(\(viewModel.remainingSeconds)s)") + actionButton.isEnabled = false + } + } + + private func setActionTitle(_ title: String) { + var configuration = actionButton.configuration + configuration?.title = title + actionButton.configuration = configuration + } + + private func beginUserRequest(showsLoading: Bool) -> UserRequest? { + guard userRequestID == nil, !viewModel.isInvalidated else { return nil } + let request = UserRequest(id: UUID(), loadingToken: showsLoading ? beginRequestLoading() : nil) + userRequestID = request.id + applyState() + return request + } + + private func endUserRequest(_ request: UserRequest) { + if let token = request.loadingToken { endRequestLoading(token) } + guard userRequestID == request.id else { return } + userRequestID = nil + applyState() + } + + private func performUserRequest(_ request: UserRequest, operation: () async -> Value) async -> Value { + defer { endUserRequest(request) } + return await operation() + } + + @objc private func pauseReading() { + readingTimer?.invalidate() + readingTimer = nil + viewModel.pauseReading() + let previousClose = closingTask + closingGeneration += 1 + let epoch = closingGeneration + closingTask = Task { @MainActor [weak self] in + guard let self else { return } + await previousClose?.value + await viewModel.flush() + if closingGeneration == epoch { closingTask = nil } + applyState() + resumeReading() + } + } + + @objc private func appWillResignActive() { appIsActive = false; pauseReading() } + + @objc private func appDidBecomeActive() { appIsActive = true; resumeReading() } + + private func resumeReading(retrying: Bool = false) { + guard isContentVisible, viewModel.canStudy, (retrying || viewModel.readingErrorMessage == nil) else { return } + if viewModel.isReading { + installReadingTimer() + return + } + guard readingTask == nil else { return } + let request = retrying ? beginUserRequest(showsLoading: true) : nil + guard !retrying || request != nil else { return } + let pendingClose = closingTask + readingTask = Task { @MainActor [weak self] in + guard let self else { return } + defer { if let request { endUserRequest(request) } } + await pendingClose?.value + guard isContentVisible, viewModel.canStudy, (retrying || viewModel.readingErrorMessage == nil), !Task.isCancelled else { + readingTask = nil + return + } + await viewModel.startReading(at: ProcessInfo.processInfo.systemUptime) + readingTask = nil + applyState() + if isContentVisible && viewModel.isReading { installReadingTimer() } + } + } + + private func installReadingTimer() { + guard readingTimer == nil else { return } + let timer = Timer(timeInterval: 0.25, repeats: true) { [weak self] _ in + Task { @MainActor in self?.readingTick() } + } + readingTimer = timer + RunLoop.main.add(timer, forMode: .common) + } + + private func readingTick() { + guard isContentVisible else { return } + if viewModel.accumulateVisibleTime(at: ProcessInfo.processInfo.systemUptime) { applyState() } + guard readingTask == nil, viewModel.needsReadingFlush else { return } + readingTask = Task { @MainActor [weak self] in + guard let self else { return } + await viewModel.flush() + readingTask = nil + applyState() + if isContentVisible, viewModel.canStudy, !viewModel.isReading, viewModel.remainingSeconds > 0 { resumeReading() } + } + } + + @objc private func identityChanged() { + readingTimer?.invalidate() + readingTimer = nil + contentTask?.cancel() + readingTask?.cancel() + closingTask?.cancel() + previewView.showStatus("") + localDocument?.removeTemporaryFile() + localDocument = nil + viewModel.invalidate() + leaveUnavailableCourse() + } + + @objc private func actionTapped() { + guard userRequestID == nil else { return } + if contentLoadFailed || viewModel.attachmentErrorMessage != nil || viewModel.task == nil { + if let id = viewModel.currentAttachmentID { selectAttachment(id) } + else { loadCourse() } + } else if viewModel.attachments.isEmpty { returnToCenter() } + else if let progress = viewModel.progress, progress.readingCompleted { + pauseReading() + if viewModel.task?.summary.mode == .exam && viewModel.task?.summary.learnerStatus == .pendingExam + && progress.learnerStatus == .pendingExam && progress.canStartExam { + navigationController?.pushViewController(TrainingExamViewController(taskID: taskID, service: service), animated: true) + } else { returnToCenter() } + } else if !viewModel.canStudy { returnToCenter() } + else if viewModel.readingErrorMessage != nil { resumeReading(retrying: true) } + else if viewModel.errorMessage != nil { loadCourse() } + } + + private func openExternalLink(_ url: URL) { + guard TrainingDocumentLoader.isAllowed(url), presentedViewController == nil else { return } + isOpeningExternalLink = true + pauseReading() + let controller = SFSafariViewController(url: url) + controller.delegate = self + present(controller, animated: true) + } + + private func returnToCenter() { + if let center = navigationController?.viewControllers.last(where: { $0 is TrainingCenterViewController }) { + navigationController?.popToViewController(center, animated: true) + } else { navigationController?.popToRootViewController(animated: true) } + } + + private func leaveUnavailableCourse() { + readingTimer?.invalidate() + readingTimer = nil + previewView.showStatus("") + localDocument?.removeTemporaryFile() + localDocument = nil + if let presentedViewController { + presentedViewController.dismiss(animated: false) { [weak self] in self?.returnToCenter() } + } else { returnToCenter() } + } + + deinit { localDocument?.removeTemporaryFile() } + + private func finishExternalLinkPresentation() { + isOpeningExternalLink = false + resumeReading() + } +} + +extension TrainingCourseViewController: UIScrollViewDelegate { + /// 原生课程信息滚动到覆盖整个预览区时暂停,文件再次可见时才恢复。 + func scrollViewDidScroll(_ scrollView: UIScrollView) { + previewView.notifyIfRenderedAndVisible() + if isContentVisible { resumeReading() } + else if viewModel.isReading { pauseReading() } + } +} + +extension TrainingCourseViewController: SFSafariViewControllerDelegate { + /// 关闭外部链接后,仅在正文重新可见时建立新的阅读片段。 + func safariViewControllerDidFinish(_ controller: SFSafariViewController) { + controller.dismiss(animated: true) { [weak self] in self?.finishExternalLinkPresentation() } + } +} diff --git a/suixinkan/UI/Training/TrainingDocumentPreviewView.swift b/suixinkan/UI/Training/TrainingDocumentPreviewView.swift new file mode 100644 index 0000000..4c2f422 --- /dev/null +++ b/suixinkan/UI/Training/TrainingDocumentPreviewView.swift @@ -0,0 +1,335 @@ +import PDFKit +import SnapKit +import UIKit +import WebKit + +/// 白色卡片内的文件预览:PDF 使用 PDFKit,其他格式使用离线、受控的 WebView。 +@MainActor +final class TrainingDocumentPreviewView: UIView { + /// 当前票据的文件已真正进入可阅读状态。 + var onReady: ((UUID) -> Void)? + /// 当前票据的文件无法渲染,交由课程页面停止计时并展示重试。 + var onFailure: ((UUID, String) -> Void)? + /// 用户明确点击文档外部链接。 + var onOpenLink: ((URL) -> Void)? + /// 文档排版高度变化时通知课程页更新卡片高度,由外层页面统一滚动。 + var onContentHeightChange: ((CGFloat) -> Void)? + /// 文档目录锚点的位置,由课程页在外层滚动区域中定位。 + var onScrollToPosition: ((CGFloat) -> Void)? + /// 包含卡片边框的完整内容高度,加载和错误状态使用紧凑占位高度。 + private(set) var preferredContentHeight: CGFloat = 160 + /// 当前文件是否已渲染成功,供页面与布局测试查询。 + private(set) var isReady = false + + override var isHidden: Bool { + didSet { if !isHidden { pdfView.notifyIfRenderedAndVisible() } } + } + + private let resourceHandler = TrainingDocumentResourceHandler() + private let messageProxy = TrainingDocumentMessageProxy() + private let pdfView = TrainingPDFDocumentView() + private let statusLabel = TrainingUI.text("正在加载附件…", size: 13, color: TrainingUI.muted) + private var currentID: UUID? + private var currentNavigation: WKNavigation? + private var renderWatchdog: Task? + private lazy var webView: WKWebView = { + let configuration = WKWebViewConfiguration() + configuration.websiteDataStore = .nonPersistent() + configuration.setURLSchemeHandler(resourceHandler, forURLScheme: "training-document") + configuration.userContentController.add(messageProxy, name: "trainingDocument") + configuration.userContentController.addUserScript(WKUserScript(source: Self.pageLayoutScript, + injectionTime: .atDocumentStart, forMainFrameOnly: true)) + let view = WKWebView(frame: .zero, configuration: configuration) + view.navigationDelegate = self + view.isOpaque = false + view.backgroundColor = .white + view.scrollView.backgroundColor = .white + view.scrollView.isScrollEnabled = false + view.scrollView.bounces = false + view.scrollView.contentInsetAdjustmentBehavior = .never + return view + }() + + /// 创建独立文档沙箱,不共享登录 Cookie、业务脚本或 JS Bridge。 + init() { + super.init(frame: .zero) + backgroundColor = .white + layer.cornerRadius = 11 + layer.borderWidth = 1 + layer.borderColor = TrainingUI.border.cgColor + clipsToBounds = true + accessibilityIdentifier = "training.reading.preview" + pdfView.backgroundColor = .white + pdfView.onContentHeightChange = { [weak self] height in + guard let self, self.currentID != nil else { return } + self.updateContentHeight(height) + } + pdfView.onOpenLink = { [weak self] url in + if TrainingDocumentLoader.isAllowed(url) { self?.onOpenLink?(url) } + } + statusLabel.textAlignment = .center + [pdfView, webView, statusLabel].forEach(addSubview) + pdfView.snp.makeConstraints { $0.edges.equalToSuperview().inset(1) } + webView.snp.makeConstraints { $0.edges.equalToSuperview().inset(1) } + statusLabel.snp.makeConstraints { $0.center.equalToSuperview(); $0.leading.trailing.equalToSuperview().inset(20) } + messageProxy.owner = self + showStatus("正在加载附件…") + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 加载中、空态和失败态均停止显示旧文件。 + func showStatus(_ message: String) { + renderWatchdog?.cancel() + renderWatchdog = nil + currentID = nil + currentNavigation = nil + isReady = false + setPreferredContentHeight(160) + webView.stopLoading() + resourceHandler.clear() + webView.isHidden = true + pdfView.isHidden = true + pdfView.onVisiblePageDrawn = nil + pdfView.document = nil + statusLabel.text = message + statusLabel.isHidden = false + } + + /// 外层页面滚动后重新检查 PDF 已绘制页面是否真正进入阅读区域。 + func notifyIfRenderedAndVisible() { pdfView.notifyIfRenderedAndVisible() } + + /// 用唯一票据隔离同一附件重试时迟到的文档事件。 + func show(_ document: TrainingLocalDocument, requestID: UUID) { + showStatus("正在打开附件…") + currentID = requestID + if document.kind == .pdf { + guard let pdf = PDFDocument(url: document.fileURL), !pdf.isLocked, pdf.pageCount > 0 else { + fail(requestID, message: TrainingDocumentError.invalidFile.localizedDescription) + return + } + pdfView.onVisiblePageDrawn = { [weak self, weak pdf] in + guard let self, let pdf, self.currentID == requestID, + self.pdfView.document === pdf, self.window != nil, !self.pdfView.isHidden else { return } + self.complete(requestID) + } + pdfView.document = pdf + pdfView.isHidden = false + layoutIfNeeded() + pdfView.layoutIfNeeded() + } else { + resourceHandler.configure(document: document, requestID: requestID) + webView.isHidden = false + let value = "training-document://preview/index.html?type=\(document.kind.rawValue)&requestId=\(requestID.uuidString)" + currentNavigation = webView.load(URLRequest(url: URL(string: value)!)) + renderWatchdog = Task { @MainActor [weak self] in + do { try await Task.sleep(for: .seconds(40)) } catch { return } + self?.fail(requestID, message: "附件预览超时,请重试") + } + } + } + + fileprivate func receive(_ message: WKScriptMessage) { + guard message.frameInfo.isMainFrame, + message.frameInfo.securityOrigin.protocol == "training-document", + message.frameInfo.securityOrigin.host == "preview", + let payload = message.body as? [String: Any], let rawID = payload["requestId"] as? String, + let id = UUID(uuidString: rawID), currentID == id else { return } + switch payload["type"] as? String { + case "ready": + if let height = payload["height"] as? NSNumber { updateContentHeight(CGFloat(height.doubleValue)) } + complete(id) + case "layout": + if let height = payload["height"] as? NSNumber { updateContentHeight(CGFloat(height.doubleValue)) } + case "scroll": + if isReady, let value = payload["top"] as? NSNumber { + let top = CGFloat(value.doubleValue) + if top.isFinite, top >= 0 { onScrollToPosition?(min(top + 1, preferredContentHeight)) } + } + case "error": + let message = (payload["message"] as? String).flatMap { $0.isEmpty || $0.count > 200 ? nil : $0 } + fail(id, message: message ?? "附件预览失败,文件可能已损坏或格式不受支持,请重试") + case "link": + if let value = payload["url"] as? String, let url = URL(string: value), TrainingDocumentLoader.isAllowed(url) { onOpenLink?(url) } + default: break + } + } + + private func updateContentHeight(_ height: CGFloat) { + guard height.isFinite, height > 0 else { return } + setPreferredContentHeight(max(82, ceil(height) + 2)) + } + + private func setPreferredContentHeight(_ height: CGFloat) { + guard abs(height - preferredContentHeight) >= 1 else { return } + preferredContentHeight = height + onContentHeightChange?(height) + } + + private func complete(_ id: UUID) { + guard currentID == id, !isReady else { return } + renderWatchdog?.cancel() + renderWatchdog = nil + isReady = true + statusLabel.isHidden = true + onReady?(id) + } + + private func fail(_ id: UUID, message: String) { + guard currentID == id else { return } + currentID = nil + currentNavigation = nil + renderWatchdog?.cancel() + renderWatchdog = nil + webView.stopLoading() + resourceHandler.clear() + isReady = false + setPreferredContentHeight(160) + statusLabel.text = message + statusLabel.isHidden = false + webView.isHidden = true + pdfView.isHidden = true + onFailure?(id, message) + } + + // 只注入 iOS 宿主:观察内容本身而非 WebView 视口,短文件才能正确缩回。 + // 锚点交给外层 UIScrollView,避免 scrollIntoView 在禁用手势后仍改变内部偏移。 + private static let pageLayoutScript = """ + (function () { + 'use strict'; + var requestId = new URLSearchParams(window.location.search).get('requestId'); + function post(type, fields) { + var message = Object.assign({ type: type, requestId: requestId }, fields); + window.webkit.messageHandlers.trainingDocument.postMessage(message); + } + document.addEventListener('click', function (event) { + var link = event.target instanceof Element ? event.target.closest('a') : null; + var href = link && link.getAttribute('href'); + if (!href || href.charAt(0) !== '#') { return; } + event.preventDefault(); + event.stopImmediatePropagation(); + var identifier; + try { identifier = decodeURIComponent(href.slice(1)); } catch (_) { return; } + var target = document.getElementById(identifier); + if (target) { post('scroll', { top: Math.max(0, target.getBoundingClientRect().top + window.scrollY) }); } + }, true); + function observe() { + var content = document.getElementById('document'); + if (!content) { return; } + var scheduled = false; + var previousHeight = 0; + function measure() { + scheduled = false; + if (content.hidden) { return; } + var height = Math.ceil(Math.max(content.scrollHeight, content.getBoundingClientRect().height)); + if (height > 0 && height !== previousHeight) { + previousHeight = height; + post('layout', { height: height }); + } + } + function schedule() { + if (scheduled) { return; } + scheduled = true; + requestAnimationFrame(measure); + } + new ResizeObserver(schedule).observe(content); + new MutationObserver(schedule).observe(content, { attributes: true, attributeFilter: ['hidden'] }); + window.addEventListener('resize', schedule); + schedule(); + } + if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', observe, { once: true }); } + else { observe(); } + }()); + """ +} + +extension TrainingDocumentPreviewView: WKNavigationDelegate { + /// WebView 只加载 App 提供的本地预览壳,文档不能直接导航到远端网页。 + func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, + decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { + let url = navigationAction.request.url + let local = url?.scheme == "training-document" && url?.host == "preview" && url?.path == "/index.html" + decisionHandler(local ? .allow : .cancel) + if navigationAction.navigationType == .linkActivated, let url, TrainingDocumentLoader.isAllowed(url) { onOpenLink?(url) } + } + + /// 壳加载失败不会触发阅读成功事件。 + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + guard let currentNavigation, navigation === currentNavigation, (error as NSError).code != NSURLErrorCancelled else { return } + if let id = currentID { fail(id, message: "附件预览加载失败,请重试") } + } + + /// 当前壳已开始导航后失败,同样撤销预览状态。 + func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { + guard let currentNavigation, navigation === currentNavigation, (error as NSError).code != NSURLErrorCancelled else { return } + if let id = currentID { fail(id, message: "附件预览加载失败,请重试") } + } + + /// 文档渲染进程退出时立即撤销可阅读状态。 + func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { + if currentNavigation != nil, !webView.isHidden, let id = currentID { fail(id, message: "附件预览已中断,请重试") } + } +} + +/// 弱引用消息转发,避免 WKUserContentController 长期持有预览视图。 +@MainActor +private final class TrainingDocumentMessageProxy: NSObject, WKScriptMessageHandler { + weak var owner: TrainingDocumentPreviewView? + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { owner?.receive(message) } +} + +/// 仅响应当前票据的私有文件和固定 App 资源,不代理任何远程地址。 +@MainActor +private final class TrainingDocumentResourceHandler: NSObject, WKURLSchemeHandler { + private var document: TrainingLocalDocument? + private var requestID: UUID? + private var active: Set = [] + + func configure(document: TrainingLocalDocument, requestID: UUID) { self.document = document; self.requestID = requestID } + func clear() { document = nil; requestID = nil; active.removeAll() } + + func webView(_ webView: WKWebView, start urlSchemeTask: any WKURLSchemeTask) { + let token = ObjectIdentifier(urlSchemeTask) + guard let url = urlSchemeTask.request.url, url.scheme == "training-document", url.host == "preview" else { + urlSchemeTask.didFailWithError(URLError(.unsupportedURL)); return + } + let file: URL? + let mime: String + if let requestID, url.path == "/document/\(requestID.uuidString)/file", let document { + file = document.fileURL + mime = "application/octet-stream" + } else { + let path = url.path.dropFirst() + guard !path.contains(".."), !path.hasPrefix("/"), !path.isEmpty, + let root = Bundle.main.url(forResource: "TrainingDocumentPreview", withExtension: nil) else { + urlSchemeTask.didFailWithError(URLError(.fileDoesNotExist)); return + } + file = root.appendingPathComponent(String(path)) + switch (String(path) as NSString).pathExtension { + case "html": mime = "text/html" + case "js": mime = "text/javascript" + case "css": mime = "text/css" + default: urlSchemeTask.didFailWithError(URLError(.unsupportedURL)); return + } + } + guard let file else { urlSchemeTask.didFailWithError(URLError(.fileDoesNotExist)); return } + active.insert(token) + Task { @MainActor [weak self] in + let result = await Task.detached(priority: .userInitiated) { Result { try Data(contentsOf: file) } }.value + guard let self, self.active.remove(token) != nil else { return } + switch result { + case .success(let data): + let response = HTTPURLResponse(url: url, statusCode: 200, httpVersion: "HTTP/1.1", headerFields: [ + "Content-Type": "\(mime); charset=utf-8", "Cache-Control": "no-store", "Access-Control-Allow-Origin": "*" + ])! + urlSchemeTask.didReceive(response) + urlSchemeTask.didReceive(data) + urlSchemeTask.didFinish() + case .failure(let error): urlSchemeTask.didFailWithError(error) + } + } + } + + func webView(_ webView: WKWebView, stop urlSchemeTask: any WKURLSchemeTask) { active.remove(ObjectIdentifier(urlSchemeTask)) } +} diff --git a/suixinkan/UI/Training/TrainingExamViewController.swift b/suixinkan/UI/Training/TrainingExamViewController.swift new file mode 100644 index 0000000..fa6f838 --- /dev/null +++ b/suixinkan/UI/Training/TrainingExamViewController.swift @@ -0,0 +1,468 @@ +import SnapKit +import UIKit + +/// 按需分页的原生考试页,增量保存草稿并持久恢复未知交卷结果。 +@MainActor +final class TrainingExamViewController: TrainingBaseViewController { + private let service: any TrainingDataServing + private let viewModel: TrainingRemoteExamViewModel + private let resetDraft: Bool + private var openedResult = false + private var navigationIsScheduled = false + private var hasAppeared = false + private var isPerformingOperation = false + private var requestLoadingToken: UUID? + private var needsReloadOnReturn = false + private var renderedQuestion: TrainingQuestionItem? + private var optionButtons: [String: UIButton] = [:] + private let scrollView = UIScrollView() + private let pageStack = UIStackView() + private let stepView = TrainingStepView(currentStep: .exam) + private let contentStack = TrainingUI.card() + private let positionLabel = TrainingUI.label(style: .subheadline, color: AppColor.primary) + private let questionLabel = TrainingUI.label(style: .title3) + private let hintLabel = TrainingUI.label(style: .footnote, color: AppColor.textSecondary) + private let optionStack = UIStackView() + private let navigationStack = UIStackView() + private let previousButton = AppButton(title: "上一题", style: .secondary) + private let nextButton = AppButton(title: "下一题", style: .secondary) + private let bottomStack = UIStackView() + private let statusLabel = TrainingUI.label(style: .footnote, color: AppColor.textSecondary) + private let submitButton = AppButton(title: "交卷") + + /// 用户明确重考才传 resetDraft;默认恢复已有草稿和未确认提交。 + init(taskID: String, service: any TrainingDataServing, resetDraft: Bool = false, viewModel: TrainingRemoteExamViewModel? = nil) { + self.service = service + self.viewModel = viewModel ?? TrainingRemoteExamViewModel(taskID: taskID, context: TrainingPendingSubmissionStore.currentContext()) + self.resetDraft = resetDraft + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { + title = "培训答题" + navigationItem.rightBarButtonItem = UIBarButtonItem(title: "答题卡", style: .plain, target: self, action: #selector(answerCardTapped)) + } + + override func setupUI() { + scrollView.alwaysBounceVertical = true + pageStack.axis = .vertical + pageStack.spacing = 16 + pageStack.addArrangedSubview(stepView) + pageStack.addArrangedSubview(contentStack) + optionStack.axis = .vertical + optionStack.spacing = 12 + navigationStack.axis = .horizontal + navigationStack.spacing = 12 + navigationStack.distribution = .fillEqually + navigationStack.addArrangedSubview(previousButton) + navigationStack.addArrangedSubview(nextButton) + previousButton.accessibilityIdentifier = "training.exam.previous" + nextButton.accessibilityIdentifier = "training.exam.next" + [positionLabel, questionLabel, hintLabel, optionStack, navigationStack].forEach(contentStack.addArrangedSubview) + bottomStack.axis = .vertical + bottomStack.spacing = 8 + bottomStack.backgroundColor = AppColor.cardBackground + bottomStack.layoutMargins = UIEdgeInsets(top: 12, left: 20, bottom: 12, right: 20) + bottomStack.isLayoutMarginsRelativeArrangement = true + bottomStack.addArrangedSubview(statusLabel) + bottomStack.addArrangedSubview(submitButton) + submitButton.accessibilityIdentifier = "training.exam.submit" + scrollView.addSubview(pageStack) + view.addSubview(scrollView) + view.addSubview(bottomStack) + applyState() + } + + override func setupConstraints() { + scrollView.snp.makeConstraints { + $0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.bottom.equalTo(bottomStack.snp.top) + } + pageStack.snp.makeConstraints { + $0.edges.equalTo(scrollView.contentLayoutGuide).inset(16) + $0.width.equalTo(scrollView.frameLayoutGuide).offset(-32) + } + bottomStack.snp.makeConstraints { $0.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) } + } + + override func bindActions() { + previousButton.addTarget(self, action: #selector(previousTapped), for: .touchUpInside) + nextButton.addTarget(self, action: #selector(nextTapped), for: .touchUpInside) + submitButton.addTarget(self, action: #selector(submitTapped), for: .touchUpInside) + } + + override func viewDidLoad() { + super.viewDidLoad() + viewModel.onDraftSaveStateChange = { [weak self] in + guard let self, !self.isPerformingOperation else { return } + self.applyState() + self.scheduleNavigationIfNeeded() + } + loadExam() + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + let returning = hasAppeared + let shouldReload = needsReloadOnReturn + needsReloadOnReturn = false + hasAppeared = true + guard !isPerformingOperation, !viewModel.isBusy else { return } + if viewModel.submittedAttempt != nil || viewModel.shouldReturnToCenter { + beginOperation(message: "正在确认考试状态…", showsLoading: false) + Task { @MainActor in await viewModel.validateIdentity(); finishOperation() } + return + } + if returning, shouldReload { loadExam() } + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // 自有答题卡和确认弹窗关闭后继续当前题,真实导航返回才刷新考试资格。 + if navigationController?.topViewController !== self { + needsReloadOnReturn = true + Task { @MainActor in _ = await viewModel.flushDraft(service: service) } + } + } + + override func onSessionDidExpire() { navigationController?.popToRootViewController(animated: true) } + + private func loadExam() { + guard !isPerformingOperation, !viewModel.isBusy else { return } + beginOperation(message: "正在加载试卷…") + Task { @MainActor in + await viewModel.load(service: service, resetDraft: resetDraft) + finishOperation() + } + } + + private func applyState() { + setOperationInteractionEnabled(true) + let pendingTitle = viewModel.hasPendingSubmission ? "恢复交卷结果" + : viewModel.hasDraftConflict ? "确认本机答案" : viewModel.hasPendingMutation ? "重试保存" : viewModel.canRetryCurrentPage ? "重试加载本题" : nil + guard let question = viewModel.currentQuestion else { + clearOptions() + positionLabel.text = "" + questionLabel.text = viewModel.errorMessage ?? (viewModel.hasPendingSubmission ? "正在确认上次交卷结果…" : "正在加载试卷…") + hintLabel.text = "" + statusLabel.text = viewModel.hasPendingSubmission ? "上次提交尚未确认,恢复结果后再继续操作" : "" + navigationStack.isHidden = true + submitButton.setTitle(pendingTitle ?? "重新加载", for: .normal) + submitButton.isEnabled = !viewModel.isBusy && (viewModel.errorMessage != nil || pendingTitle != nil) + navigationItem.rightBarButtonItem?.isEnabled = false + return + } + navigationStack.isHidden = false + navigationItem.rightBarButtonItem?.isEnabled = viewModel.canEdit + positionLabel.text = "第 \(viewModel.currentIndex + 1) / \(viewModel.questionCount) 题 · \(question.type == .single ? "单选题" : "多选题")" + questionLabel.text = question.stem + hintLabel.text = question.type == .single ? "请选择一个答案" : "请选择所有正确答案,少选、多选、错选均不得分" + renderOptions(for: question) + updateOptionSelection(viewModel.currentSelectedIDs) + for button in optionButtons.values { button.isEnabled = viewModel.canEdit } + previousButton.isEnabled = viewModel.canEdit && viewModel.currentIndex > 0 + nextButton.isEnabled = viewModel.canEdit && viewModel.currentIndex < viewModel.questionCount - 1 + let saveState = viewModel.draftSaveMessage + statusLabel.text = viewModel.hasPendingMutation || viewModel.errorMessage == nil + ? "已答 \(viewModel.answeredCount)/\(viewModel.questionCount) · \(saveState)" : viewModel.errorMessage + statusLabel.textColor = viewModel.hasPendingMutation || viewModel.errorMessage != nil ? AppColor.danger : AppColor.textSecondary + submitButton.setTitle(pendingTitle ?? (viewModel.isBusy ? "正在保存…" : "交卷"), for: .normal) + submitButton.isEnabled = !viewModel.isBusy && (pendingTitle != nil || viewModel.canEdit) + } + + private func clearOptions() { + for child in optionStack.arrangedSubviews { optionStack.removeArrangedSubview(child); child.removeFromSuperview() } + optionButtons = [:] + renderedQuestion = nil + } + + private func renderOptions(for question: TrainingQuestionItem) { + guard renderedQuestion != question else { return } + clearOptions() + renderedQuestion = question + for (index, option) in question.options.enumerated() { + let button = UIButton(type: .system) + var configuration = UIButton.Configuration.filled() + configuration.title = "\(TrainingQuestion.optionLetter(index)).\(option.text)" + configuration.contentInsets = NSDirectionalEdgeInsets(top: 18, leading: 16, bottom: 18, trailing: 16) + configuration.imagePadding = 12 + configuration.titleAlignment = .leading + configuration.cornerStyle = .medium + button.configuration = configuration + button.contentHorizontalAlignment = .leading + button.titleLabel?.numberOfLines = 0 + button.titleLabel?.lineBreakMode = .byWordWrapping + button.accessibilityIdentifier = "training.option.\(option.id)" + button.addAction(UIAction { [weak self] _ in self?.selectOption(option.id) }, for: .touchUpInside) + optionButtons[option.id] = button + optionStack.addArrangedSubview(button) + button.snp.makeConstraints { $0.height.greaterThanOrEqualTo(56) } + } + } + + private func updateOptionSelection(_ selectedIDs: Set) { + UIView.performWithoutAnimation { + for (id, button) in optionButtons { + let selected = selectedIDs.contains(id) + var configuration = button.configuration + configuration?.baseBackgroundColor = selected ? AppColor.primaryLight : AppColor.pageBackgroundSoft + configuration?.baseForegroundColor = selected ? AppColor.primary : AppColor.textPrimary + configuration?.image = UIImage(systemName: selected ? "checkmark.circle.fill" : "circle") + button.configuration = configuration + button.accessibilityTraits = selected ? [.button, .selected] : .button + } + } + } + + private func setOperationInteractionEnabled(_ enabled: Bool) { + // 网络操作只暂停动作,保留已启用控件的颜色和透明度。 + let buttons: [UIButton] = Array(optionButtons.values) + [previousButton, nextButton, submitButton] + for button in buttons { button.isUserInteractionEnabled = enabled } + } + + private func beginOperation(message: String, showsLoading: Bool = true) { + isPerformingOperation = true + if showsLoading { requestLoadingToken = beginRequestLoading() } + setOperationInteractionEnabled(false) + statusLabel.text = message + statusLabel.textColor = AppColor.textSecondary + } + + private func finishOperation() { + if let requestLoadingToken { + endRequestLoading(requestLoadingToken) + self.requestLoadingToken = nil + } + isPerformingOperation = false + applyState() + scheduleNavigationIfNeeded() + } + + private func scheduleNavigationIfNeeded() { + guard !openedResult, !navigationIsScheduled, + viewModel.shouldReturnToCenter || viewModel.submittedAttempt != nil, + let navigationController, navigationController.topViewController === self else { return } + navigationIsScheduled = true + let complete: @MainActor @Sendable () -> Void = { [weak self, weak navigationController] in + guard let self else { return } + self.navigationIsScheduled = false + guard let navigationController, navigationController.topViewController === self else { return } + // 返回页面的原 pop 必须先结束,否则新的成绩栈会被 UIKit 恢复成旧考试栈。 + if navigationController.transitionCoordinator != nil { self.scheduleNavigationIfNeeded(); return } + if self.viewModel.shouldReturnToCenter { self.returnToCenter() } + else if let attempt = self.viewModel.submittedAttempt { self.openResult(attempt) } + } + if let coordinator = navigationController.transitionCoordinator { + let registered = coordinator.animate(alongsideTransition: nil) { _ in + DispatchQueue.main.async(execute: complete) + } + if !registered { DispatchQueue.main.async(execute: complete) } + } else { DispatchQueue.main.async(execute: complete) } + } + + private func returnToCenter() { + guard let navigationController, navigationController.topViewController === self else { return } + if viewModel.isIdentityInvalid { + navigationController.popToRootViewController(animated: false) + return + } + if let center = navigationController.viewControllers.last(where: { $0 is TrainingCenterViewController }) { + navigationController.popToViewController(center, animated: true) + } else { navigationController.popToRootViewController(animated: true) } + } + + private func selectOption(_ id: String) { + guard !isPerformingOperation, viewModel.selectLocally(optionID: id, service: service) else { return } + // desired 已同步更新;连续多选不等待 Task 或网络,保留同题按钮实例。 + applyState() + } + + private func goToQuestion(_ index: Int) { + guard !isPerformingOperation, viewModel.canEdit, + (0.. + private let currentIndex: Int + private let collectionView: UICollectionView + private var dataSource: UICollectionViewDiffableDataSource! + /// 关闭答题卡后将用户选择的题目位置返回考试页面。 + var onSelect: ((Int) -> Void)? + + /// 使用总题数和已答题号展示答题卡,无需下载题目或全部答案。 + init(questionCount: Int, answeredOrders: Set, currentIndex: Int) { + self.questionCount = min(500, max(0, questionCount)) + self.answeredOrders = answeredOrders + self.currentIndex = currentIndex + collectionView = UICollectionView(frame: .zero, collectionViewLayout: Self.makeLayout()) + super.init(nibName: nil, bundle: nil) + } + + /// 保留演示渲染测试的初始化入口,将本地试卷转换成轻量题号状态。 + convenience init(task: TrainingTask, answers: TrainingAnswers, currentIndex: Int) { + let orders = Set(task.questions.enumerated().compactMap { index, question in + (answers[question.id] ?? []).isEmpty ? nil : index + 1 + }) + self.init(questionCount: task.questions.count, answeredOrders: orders, currentIndex: currentIndex) + } + + /// 保持原有五列、52 点行高与 12 点间距,随可用宽度自动计算列宽。 + private static func makeLayout() -> UICollectionViewCompositionalLayout { + UICollectionViewCompositionalLayout { _, environment in + let columns = 5 + let spacing: CGFloat = 12 + let inset: CGFloat = 20 + let availableWidth = environment.container.effectiveContentSize.width - inset * 2 + let itemWidth = max(0, floor((availableWidth - spacing * CGFloat(columns - 1)) / CGFloat(columns))) + let itemSize = NSCollectionLayoutSize(widthDimension: .absolute(itemWidth), heightDimension: .absolute(52)) + let item = NSCollectionLayoutItem(layoutSize: itemSize) + let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(52)) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, repeatingSubitem: item, count: columns) + group.interItemSpacing = .fixed(spacing) + let section = NSCollectionLayoutSection(group: group) + section.interGroupSpacing = spacing + section.contentInsets = NSDirectionalEdgeInsets(top: inset, leading: inset, bottom: inset, trailing: inset) + return section + } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func viewDidLoad() { + super.viewDidLoad() + title = "答题卡 · 蓝色为已答" + navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .done, primaryAction: UIAction { [weak self] _ in self?.dismiss(animated: true) }) + collectionView.backgroundColor = AppColor.pageBackgroundSoft + collectionView.delegate = self + collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "question") + view.addSubview(collectionView) + collectionView.snp.makeConstraints { $0.edges.equalTo(view.safeAreaLayoutGuide) } + dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collection, indexPath, index in + guard let self else { return nil } + let cell = collection.dequeueReusableCell(withReuseIdentifier: "question", for: indexPath) + let answered = self.answeredOrders.contains(index + 1) + var content = UIListContentConfiguration.cell() + content.text = "\(index + 1)" + content.textProperties.alignment = .center + content.textProperties.color = answered ? AppColor.primary : AppColor.textSecondary + content.directionalLayoutMargins = .zero + cell.contentConfiguration = content + cell.backgroundColor = answered ? AppColor.primaryLight : AppColor.cardBackground + cell.layer.cornerRadius = 10 + cell.layer.borderWidth = index == self.currentIndex ? 2 : 0 + cell.layer.borderColor = AppColor.primary.cgColor + cell.isAccessibilityElement = true + cell.accessibilityLabel = "第 \(index + 1) 题,\(answered ? "已答" : "未答")\(index == self.currentIndex ? ",当前题" : "")" + cell.accessibilityTraits = .button + return cell + } + var snapshot = NSDiffableDataSourceSnapshot() + snapshot.appendSections([0]) + snapshot.appendItems(Array(0.. Void)? + /// 用户点击 PDF 中的 URL 注解,由宿主校验并打开。 + var onOpenLink: ((URL) -> Void)? + /// 按当前宽度排版后的全部页面高度,供宿主更新白色卡片约束。 + var onContentHeightChange: ((CGFloat) -> Void)? + + private var pageViews: [TrainingPDFPageDrawingView] = [] + private var contentHeight: CGFloat = 0 + private var lastLayoutWidth: CGFloat = 0 + private let pageSpacing: CGFloat = 12 + + override var intrinsicContentSize: CGSize { + CGSize(width: UIView.noIntrinsicMetric, height: contentHeight) + } + + override var isHidden: Bool { + didSet { if !isHidden { notifyIfRenderedAndVisible() } } + } + + /// 创建不含内部滚动视图的 PDF 页面容器。 + init() { + super.init(frame: .zero) + backgroundColor = .white + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func layoutSubviews() { + super.layoutSubviews() + let width = bounds.width + guard width.isFinite, width > 0 else { return } + if abs(width - lastLayoutWidth) > 0.5 { + lastLayoutWidth = width + var offset: CGFloat = 0 + for page in pageViews { + let height = ceil(width * page.heightToWidthRatio) + page.frame = CGRect(x: 0, y: offset, width: width, height: height) + offset += height + pageSpacing + } + let height = pageViews.isEmpty ? 0 : offset - pageSpacing + updateContentHeight(height) + } + notifyIfRenderedAndVisible() + } + + override func didMoveToWindow() { + super.didMoveToWindow() + notifyIfRenderedAndVisible() + } + + /// 外层滚动、隐藏恢复或布局更新后,确认已绘制内容确实与可见区域相交。 + func notifyIfRenderedAndVisible() { + guard document != nil, pageViews.contains(where: { $0.hasVisibleDrawnTile() }) else { return } + onVisiblePageDrawn?() + } + + private func rebuildPages() { + pageViews.forEach { $0.removeFromSuperview() } + pageViews.removeAll() + lastLayoutWidth = 0 + let drawingLock = NSLock() + if let document { + for index in 0.. 0.5 else { return } + contentHeight = height + invalidateIntrinsicContentSize() + onContentHeightChange?(height) + } +} + +/// 单页使用分块图层按需绘制,避免将长 PDF 的所有页面预先生成大图。 +@MainActor +private final class TrainingPDFPageDrawingView: UIView { + let heightToWidthRatio: CGFloat + var onDrawn: (() -> Void)? + var onOpenLink: ((URL) -> Void)? + private let drawingState: TrainingPDFPageDrawingState + private var drawnTiles: [CGRect] = [] + private var lastDrawingSize: CGSize = .zero + + override class var layerClass: AnyClass { TrainingPDFPageTiledLayer.self } + + init?(document: PDFDocument, page: PDFPage, drawingLock: NSLock) { + let transform = page.transform(for: .cropBox) + let displayBounds = page.bounds(for: .cropBox).applying(transform).standardized + guard displayBounds.width.isFinite, displayBounds.height.isFinite, + displayBounds.width > 0, displayBounds.height > 0 else { return nil } + heightToWidthRatio = displayBounds.height / displayBounds.width + drawingState = TrainingPDFPageDrawingState(document: document, page: page, + displayBounds: displayBounds, pageTransform: transform, drawingLock: drawingLock) + super.init(frame: .zero) + backgroundColor = .white + isOpaque = true + accessibilityLabel = page.label.map { "PDF 第 \($0) 页" } ?? "PDF 页面" + let tiledLayer = layer as! TrainingPDFPageTiledLayer + tiledLayer.contentsScale = UIScreen.main.scale + tiledLayer.tileSize = CGSize(width: 512, height: 512) + tiledLayer.levelsOfDetail = 1 + tiledLayer.levelsOfDetailBias = 0 + tiledLayer.needsDisplayOnBoundsChange = true + drawingState.onDraw = { [weak self] rect, size in + Task { @MainActor [weak self] in + guard let self, self.bounds.size == size else { return } + if !self.drawnTiles.contains(rect) { self.drawnTiles.append(rect) } + self.onDrawn?() + } + } + tiledLayer.configure(drawingState) + addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(openLink(_:)))) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func layoutSubviews() { + super.layoutSubviews() + if bounds.size != lastDrawingSize { + lastDrawingSize = bounds.size + drawnTiles.removeAll() + layer.setNeedsDisplay() + } + } + + func hasVisibleDrawnTile() -> Bool { + guard let window, !drawnTiles.isEmpty else { return false } + var visible = convert(bounds, to: window).intersection(window.bounds) + var ancestor: UIView? = self + while let view = ancestor { + guard !view.isHidden, view.alpha > 0.01 else { return false } + if view.clipsToBounds { visible = visible.intersection(view.convert(view.bounds, to: window)) } + guard !visible.isNull, !visible.isEmpty else { return false } + ancestor = view.superview + } + return drawnTiles.contains { !convert($0, to: window).intersection(visible).isEmpty } + } + + @objc private func openLink(_ gesture: UITapGestureRecognizer) { + guard let url = drawingState.link(at: gesture.location(in: self), size: bounds.size) else { return } + onOpenLink?(url) + } +} + +/// 持有不可变页数据,以文档级锁串行化后台绘制和主线程链接查询。 +private final class TrainingPDFPageDrawingState: @unchecked Sendable { + private let document: PDFDocument + private let page: PDFPage + private let displayBounds: CGRect + private let pageTransform: CGAffineTransform + private let drawingLock: NSLock + var onDraw: (@Sendable (CGRect, CGSize) -> Void)? + + init(document: PDFDocument, page: PDFPage, displayBounds: CGRect, + pageTransform: CGAffineTransform, drawingLock: NSLock) { + self.document = document + self.page = page + self.displayBounds = displayBounds + self.pageTransform = pageTransform + self.drawingLock = drawingLock + } + + func draw(in context: CGContext, bounds: CGRect) { + guard bounds.width > 0, bounds.height > 0 else { return } + let tile = context.boundingBoxOfClipPath.intersection(bounds) + guard !tile.isNull, !tile.isEmpty else { return } + drawingLock.lock() + context.saveGState() + context.setFillColor(UIColor.white.cgColor) + context.fill(bounds) + let scale = bounds.width / displayBounds.width + context.translateBy(x: -displayBounds.minX * scale, y: bounds.height + displayBounds.minY * scale) + context.scaleBy(x: scale, y: -scale) + page.draw(with: .cropBox, to: context) + context.restoreGState() + drawingLock.unlock() + onDraw?(tile, bounds.size) + } + + func link(at point: CGPoint, size: CGSize) -> URL? { + guard size.width > 0 else { return nil } + drawingLock.lock() + defer { drawingLock.unlock() } + let scale = size.width / displayBounds.width + let displayPoint = CGPoint(x: point.x / scale + displayBounds.minX, + y: (size.height - point.y) / scale + displayBounds.minY) + let pagePoint = displayPoint.applying(pageTransform.inverted()) + return page.annotation(at: pagePoint)?.url + } +} + +/// CATiledLayer 可在后台请求图块;状态快照受锁保护,回调仅返回已绘制的页内矩形。 +private final class TrainingPDFPageTiledLayer: CATiledLayer { + private let stateLock = NSLock() + private var state: TrainingPDFPageDrawingState? + + override class func fadeDuration() -> CFTimeInterval { 0 } + + override init() { super.init() } + + override init(layer: Any) { + super.init(layer: layer) + if let source = layer as? TrainingPDFPageTiledLayer { state = source.snapshot() } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + func configure(_ state: TrainingPDFPageDrawingState) { + stateLock.lock() + self.state = state + stateLock.unlock() + setNeedsDisplay() + } + + override func draw(in context: CGContext) { snapshot()?.draw(in: context, bounds: bounds) } + + private func snapshot() -> TrainingPDFPageDrawingState? { + stateLock.lock() + defer { stateLock.unlock() } + return state + } +} diff --git a/suixinkan/UI/Training/TrainingResultViewController.swift b/suixinkan/UI/Training/TrainingResultViewController.swift new file mode 100644 index 0000000..d6805f1 --- /dev/null +++ b/suixinkan/UI/Training/TrainingResultViewController.swift @@ -0,0 +1,303 @@ +import SnapKit +import UIKit + +/// 成绩概览、可展开解析和返回学习入口,历史记录只按最新任务状态提供重考。 +@MainActor +final class TrainingResultViewController: TrainingBaseViewController { + private let taskID: String + private let attemptID: String + private let service: any TrainingDataServing + private let documentLoader: any TrainingDocumentLoading + private let viewModel: TrainingRemoteResultViewModel + private let validateIdentity: () -> Bool + private var loadFailed = false + private var showsDetails = false + private var usesInitialDetail: Bool + private var resultLoadTask: Task? + private var isRequestInFlight = false + private var requestLoadingToken: UUID? + private let scrollView = UIScrollView() + private let contentStack = UIStackView() + private let footer = UIView() + private let actionButton = TrainingUI.button("完成,返回培训中心") + + /// 使用记录 ID 读取最新本人任务,禁止通过后从旧失败记录继续重考。 + init(taskID: String, attemptID: String, service: any TrainingDataServing, initialDetail: TrainingAttemptDetail? = nil, + documentLoader: any TrainingDocumentLoading = TrainingDocumentLoader()) { + self.taskID = taskID + self.attemptID = attemptID + self.service = service + self.documentLoader = documentLoader + let session = AppStore.shared.session + let scope = session.accountCachePrefix + let token = session.token + let scenicID = session.currentScenicId + let storeID = session.currentStoreId + validateIdentity = { + let current = AppStore.shared.session + return current.accountCachePrefix == scope && current.token == token + && current.currentScenicId == scenicID && current.currentStoreId == storeID + } + viewModel = TrainingRemoteResultViewModel(attemptID: attemptID, initialDetail: initialDetail) + usesInitialDetail = initialDetail != nil + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func setupNavigationBar() { TrainingUI.navigation(self, title: "考试结果") } + + override func setupUI() { + view.backgroundColor = TrainingUI.background + contentStack.axis = .vertical + contentStack.spacing = 12 + scrollView.addSubview(contentStack) + view.addSubview(scrollView) + footer.backgroundColor = .white + let line = UIView() + line.backgroundColor = TrainingUI.border + footer.addSubview(line) + line.snp.makeConstraints { $0.leading.trailing.top.equalToSuperview(); $0.height.equalTo(1) } + footer.addSubview(actionButton) + view.addSubview(footer) + actionButton.accessibilityIdentifier = "training.result.action" + } + + override func setupConstraints() { + footer.snp.makeConstraints { $0.leading.trailing.bottom.equalToSuperview() } + actionButton.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(12) + $0.top.equalToSuperview().offset(10) + $0.bottom.equalTo(view.safeAreaLayoutGuide).offset(-10) + } + scrollView.snp.makeConstraints { $0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide); $0.bottom.equalTo(footer.snp.top) } + contentStack.snp.makeConstraints { + $0.edges.equalTo(scrollView.contentLayoutGuide).inset(UIEdgeInsets(top: 14, left: 13, bottom: 20, right: 13)) + $0.width.equalTo(scrollView.frameLayoutGuide).offset(-26) + } + } + + override func bindActions() { actionButton.addTarget(self, action: #selector(actionTapped), for: .touchUpInside) } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + if leaveInaccessibleTaskIfNeeded() { return } + if usesInitialDetail, let detail = viewModel.detail { + usesInitialDetail = false + render(detail: detail) + } else { loadResult() } + } + override func onSessionDidExpire() { navigationController?.popToRootViewController(animated: true) } + + private func loadResult() { Task { @MainActor in await reload() } } + + /// 页面出现时只刷新该次成绩,解析在用户展开后加载。 + func reload() async { + if let resultLoadTask { await resultLoadTask.value; return } + guard !isRequestInFlight, !viewModel.isLoading, !viewModel.isLoadingReviews, + !Task.isCancelled else { return } + if leaveInaccessibleTaskIfNeeded() { return } + let token = beginResultRequest() + let task = Task { @MainActor [weak self] in + guard let self else { return } + defer { finishResultRequest(token) } + await performReload() + } + resultLoadTask = task + await task.value + resultLoadTask = nil + } + + private func performReload() async { + await viewModel.load(service: service) + if leaveInaccessibleTaskIfNeeded() { return } + if let detail = viewModel.detail { + loadFailed = false + render(detail: detail) + } else { + loadFailed = true + clearContent() + contentStack.addArrangedSubview(TrainingUI.text(viewModel.errorMessage ?? "成绩加载失败", color: TrainingUI.muted)) + setActionTitle("重新加载") + } + } + + /// 同步锁定请求动作,Loading 令牌只属于这一次真正发出的请求。 + private func beginResultRequest() -> UUID { + isRequestInFlight = true + contentStack.isUserInteractionEnabled = false + actionButton.isUserInteractionEnabled = false + let token = beginRequestLoading() + requestLoadingToken = token + return token + } + + /// 成功、失败和取消均释放原令牌,保持按钮正常外观。 + private func finishResultRequest(_ token: UUID) { + endRequestLoading(token) + guard requestLoadingToken == token else { return } + requestLoadingToken = nil + isRequestInFlight = false + contentStack.isUserInteractionEnabled = true + actionButton.isUserInteractionEnabled = true + } + + /// 导航前主动释放本页请求;离页后的旧 defer 可以安全再次结束同一令牌。 + private func finishCurrentRequestBeforeNavigation() { + if let token = requestLoadingToken { finishResultRequest(token) } + } + + private func clearContent() { + for child in contentStack.arrangedSubviews { contentStack.removeArrangedSubview(child); child.removeFromSuperview() } + } + + private func leaveInaccessibleTaskIfNeeded() -> Bool { + let identityChanged = !validateIdentity() || viewModel.isIdentityInvalid + guard identityChanged || viewModel.isAccessRevoked else { return false } + finishCurrentRequestBeforeNavigation() + clearContent() + if !identityChanged, + let center = navigationController?.viewControllers.first(where: { $0 is TrainingCenterViewController }) { + navigationController?.popToViewController(center, animated: true) + } else { navigationController?.popToRootViewController(animated: false) } + return true + } + + private func setActionTitle(_ title: String) { var configuration = actionButton.configuration; configuration?.title = title; actionButton.configuration = configuration } + + private func render(detail: TrainingAttemptDetail) { + let attempt = detail.attempt + clearContent() + let summary = UIStackView() + summary.axis = .vertical + summary.spacing = 11 + summary.alignment = .center + summary.backgroundColor = .white + summary.layer.cornerRadius = 11 + summary.layer.borderWidth = 1 + summary.layer.borderColor = TrainingUI.border.cgColor + summary.isLayoutMarginsRelativeArrangement = true + summary.layoutMargins = UIEdgeInsets(top: 25, left: 12, bottom: 25, right: 12) + let symbol = UIImageView(image: UIImage(systemName: attempt.passed ? "checkmark.circle.fill" : "info.circle.fill")) + symbol.tintColor = attempt.passed ? TrainingUI.success : UIColor(red: 237/255, green: 140/255, blue: 36/255, alpha: 1) + symbol.contentMode = .scaleAspectFit + symbol.snp.makeConstraints { $0.size.equalTo(54) } + summary.addArrangedSubview(symbol) + let title = TrainingUI.text(attempt.passed ? "考试通过,学习任务已完成" : "本次未通过,再接再厉", size: 16.5, weight: .bold) + title.textAlignment = .center + summary.addArrangedSubview(title) + let score = UIStackView(arrangedSubviews: [TrainingUI.text(attempt.scoreText, size: 46, weight: .bold, color: TrainingUI.primary), TrainingUI.text("/ 100 分", size: 13, color: TrainingUI.muted)]) + score.alignment = .firstBaseline + score.spacing = 6 + score.snp.makeConstraints { $0.height.greaterThanOrEqualTo(69) } + summary.addArrangedSubview(score) + let dateLabel = TrainingUI.text("\(attempt.passScore) 分及格 · \(TrainingUI.date(attempt.submittedAt))", size: 12.5, color: TrainingUI.muted) + dateLabel.textAlignment = .center + summary.addArrangedSubview(dateLabel) + contentStack.addArrangedSubview(summary) + let counts = TrainingUI.card() + let row = UIStackView(arrangedSubviews: [TrainingUI.text("答对 \(attempt.correctCount) 题"), TrainingUI.text("答错 \(attempt.questionCount - attempt.correctCount) 题")]) + row.distribution = .fillEqually + for label in row.arrangedSubviews.compactMap({ $0 as? UILabel }) { label.textAlignment = .center } + counts.addArrangedSubview(row) + contentStack.addArrangedSubview(counts) + let details = TrainingUI.button(showsDetails ? "收起答案解析" : "查看答案解析", secondary: true) + details.accessibilityIdentifier = "training.result.details" + details.addTarget(self, action: #selector(toggleDetails), for: .touchUpInside) + details.isEnabled = attempt.reviewAvailable + contentStack.addArrangedSubview(details) + let learning = TrainingUI.button("返回学习", plain: true) + learning.accessibilityIdentifier = "training.result.learning" + learning.addTarget(self, action: #selector(returnToLearning), for: .touchUpInside) + contentStack.addArrangedSubview(learning) + if showsDetails && attempt.reviewAvailable { + for review in viewModel.reviews { + let card = TrainingUI.card() + let top = UIStackView(arrangedSubviews: [TrainingUI.text("第 \(review.order) 题", size: 12.5, color: TrainingUI.muted), TrainingUI.text(review.isCorrect ? "回答正确" : "回答错误", size: 12, color: review.isCorrect ? TrainingUI.success : .systemRed)]) + top.distribution = .equalSpacing + card.addArrangedSubview(top) + card.addArrangedSubview(TrainingUI.text(review.stem, size: 15.5, weight: .semibold)) + for (optionIndex, option) in review.options.enumerated() { + card.addArrangedSubview(TrainingUI.text("\(TrainingQuestion.optionLetter(optionIndex)). \(option.text)", size: 13.5, color: UIColor(red: 92/255, green: 108/255, blue: 132/255, alpha: 1))) + } + func letters(_ ids: Set) -> String { + let values = review.options.enumerated().compactMap { ids.contains($0.element.id) ? TrainingQuestion.optionLetter($0.offset) : nil } + return values.isEmpty ? "未作答" : values.joined(separator: "、") + } + card.addArrangedSubview(TrainingUI.text("你的答案:\(letters(Set(review.selectedOptionIDs))) · 正确答案:\(letters(Set(review.correctOptionIDs)))", size: 12.5, color: TrainingUI.muted)) + card.addArrangedSubview(TrainingUI.notice(review.explanation.isEmpty ? "暂无解析" : review.explanation)) + contentStack.addArrangedSubview(card) + } + } + if showsDetails && attempt.reviewAvailable { + if let error = viewModel.reviewErrorMessage { contentStack.addArrangedSubview(TrainingUI.notice(error)) } + if viewModel.isLoadingReviews { contentStack.addArrangedSubview(TrainingUI.text("正在加载解析…", color: TrainingUI.muted)) } + if viewModel.hasMoreReviews || viewModel.reviewErrorMessage != nil { + let more = TrainingUI.button(viewModel.reviewErrorMessage != nil ? "重试加载解析" : "加载更多解析", plain: true) + more.accessibilityIdentifier = "training.result.reviews.more" + more.addTarget(self, action: #selector(moreReviewsTapped), for: .touchUpInside) + contentStack.addArrangedSubview(more) + } + } + let canRetry = !attempt.passed && detail.taskState.learnerStatus == .pendingExam && detail.taskState.canRetry + contentStack.addArrangedSubview(TrainingUI.text(canRetry ? "截止前可不限次数重考,每次成绩都会保留。" : "本次记录只读,可回顾课程内容和答案解析。", size: 12, color: TrainingUI.muted)) + setActionTitle(canRetry ? "再考一次" : "完成,返回培训中心") + } + + @objc private func toggleDetails() { + guard !isRequestInFlight, !viewModel.isLoading, !viewModel.isLoadingReviews else { return } + if leaveInaccessibleTaskIfNeeded() { return } + guard let detail = viewModel.detail, detail.attempt.reviewAvailable else { return } + showsDetails.toggle() + render(detail: detail) + guard showsDetails, !viewModel.hasLoadedReviews else { return } + loadReviewPage(nextPage: false) + } + + @objc private func moreReviewsTapped() { + guard !isRequestInFlight, !viewModel.isLoading, !viewModel.isLoadingReviews else { return } + if leaveInaccessibleTaskIfNeeded() { return } + loadReviewPage(nextPage: viewModel.hasLoadedReviews) + } + + /// 首次展开、翻页和失败重试才持有 Loading,已缓存解析切换不发请求。 + private func loadReviewPage(nextPage: Bool) { + guard !isRequestInFlight, !viewModel.isLoading, !viewModel.isLoadingReviews, + viewModel.detail?.attempt.reviewAvailable == true else { return } + if nextPage { guard viewModel.hasMoreReviews else { return } } + else { guard !viewModel.hasLoadedReviews else { return } } + let token = beginResultRequest() + Task { @MainActor in + defer { finishResultRequest(token) } + await viewModel.loadReviews(service: service, nextPage: nextPage) + if leaveInaccessibleTaskIfNeeded() { return } + if let current = viewModel.detail { render(detail: current) } + } + } + + /// 无论是否通过都能返回本次课程,优先复用导航栈中的课程页面。 + @objc private func returnToLearning() { + guard !isRequestInFlight, !viewModel.isLoading, !viewModel.isLoadingReviews else { return } + if leaveInaccessibleTaskIfNeeded() { return } + guard viewModel.detail != nil, let navigationController else { return } + finishCurrentRequestBeforeNavigation() + if let course = navigationController.viewControllers.last(where: { ($0 as? TrainingCourseViewController)?.taskID == taskID }) { + navigationController.popToViewController(course, animated: true) + } else { + navigationController.pushViewController(TrainingCourseViewController(taskID: taskID, service: service, documentLoader: documentLoader), animated: true) + } + } + + @objc private func actionTapped() { + guard !isRequestInFlight, !viewModel.isLoading, !viewModel.isLoadingReviews else { return } + if leaveInaccessibleTaskIfNeeded() { return } + if loadFailed { loadResult(); return } + guard let detail = viewModel.detail, let navigationController else { return } + finishCurrentRequestBeforeNavigation() + if !detail.attempt.passed, detail.taskState.learnerStatus == .pendingExam, detail.taskState.canRetry { + navigationController.setViewControllers(Array(navigationController.viewControllers.dropLast()) + [TrainingExamViewController(taskID: taskID, service: service, resetDraft: true)], animated: true) + } else if let center = navigationController.viewControllers.last(where: { $0 is TrainingCenterViewController }) { + navigationController.popToViewController(center, animated: true) + } else { navigationController.setViewControllers([TrainingCenterViewController(service: service)], animated: true) } + } +} diff --git a/suixinkan/UI/Training/TrainingStepView.swift b/suixinkan/UI/Training/TrainingStepView.swift new file mode 100644 index 0000000..b12d70c --- /dev/null +++ b/suixinkan/UI/Training/TrainingStepView.swift @@ -0,0 +1,53 @@ +import SnapKit +import UIKit + +/// 学习与考试共用的进度提示,两项等宽居中,仅突出当前步骤。 +@MainActor +final class TrainingStepView: UIView { + /// 当前页面对应的学习流程阶段。 + enum Step { + case learning + case exam + } + + private let learningLabel: UILabel + private let nextLabel: UILabel + + /// 创建只读步骤栏,任务模式可在课程详情返回后更新。 + init(currentStep: Step, mode: TrainingMode = .exam) { + learningLabel = TrainingUI.text("1 课程学习", size: 13, + weight: currentStep == .learning ? .semibold : .regular, + color: currentStep == .learning ? TrainingUI.primary : TrainingUI.muted) + nextLabel = TrainingUI.text(size: 13, + weight: currentStep == .exam ? .semibold : .regular, + color: currentStep == .exam ? TrainingUI.primary : TrainingUI.muted) + super.init(frame: .zero) + backgroundColor = UIColor(red: 237/255, green: 241/255, blue: 247/255, alpha: 1) + layer.cornerRadius = 8 + accessibilityIdentifier = "training.steps" + learningLabel.accessibilityIdentifier = "training.steps.learning" + nextLabel.accessibilityIdentifier = "training.steps.next" + for label in [learningLabel, nextLabel] { label.textAlignment = .center } + let currentLabel = currentStep == .learning ? learningLabel : nextLabel + currentLabel.accessibilityTraits.insert(.selected) + currentLabel.accessibilityValue = "当前步骤" + let stack = UIStackView(arrangedSubviews: [learningLabel, nextLabel]) + stack.axis = .horizontal + stack.alignment = .center + stack.distribution = .fillEqually + addSubview(stack) + stack.snp.makeConstraints { + $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 10, left: 12, bottom: 10, right: 12)) + } + snp.makeConstraints { $0.height.greaterThanOrEqualTo(44) } + configure(mode: mode) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 仅学习任务展示完成学习,考试任务展示在线考试。 + func configure(mode: TrainingMode) { + nextLabel.text = mode == .exam ? "2 在线考试" : "完成学习" + } +} diff --git a/suixinkan/UI/Training/TrainingUI.swift b/suixinkan/UI/Training/TrainingUI.swift new file mode 100644 index 0000000..b535516 --- /dev/null +++ b/suixinkan/UI/Training/TrainingUI.swift @@ -0,0 +1,321 @@ +import SnapKit +import UIKit + +/// 与小程序培训页面一致的色彩、字体和内容间距。 +@MainActor +enum TrainingUI { + static let primary = UIColor(red: 35/255, green: 121/255, blue: 1, alpha: 1) + static let background = UIColor(red: 245/255, green: 248/255, blue: 252/255, alpha: 1) + static let textColor = UIColor(red: 23/255, green: 32/255, blue: 51/255, alpha: 1) + static let muted = UIColor(red: 132/255, green: 145/255, blue: 166/255, alpha: 1) + static let border = UIColor(red: 227/255, green: 235/255, blue: 245/255, alpha: 1) + static let hintColor = UIColor(red: 189/255, green: 121/255, blue: 24/255, alpha: 1) + static let hintBackground = UIColor(red: 1, green: 246/255, blue: 233/255, alpha: 1) + static let success = UIColor(red: 21/255, green: 151/255, blue: 108/255, alpha: 1) + + /// 创建支持系统字体缩放的标签。 + static func text(_ value: String = "", size: CGFloat = 14, weight: UIFont.Weight = .regular, color: UIColor = textColor) -> UILabel { + let label = UILabel() + label.text = value + label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: size, weight: weight)) + label.adjustsFontForContentSizeCategory = true + label.textColor = color + label.numberOfLines = 0 + return label + } + + /// 为答题等现有页面保留语义字体入口。 + static func label(_ text: String = "", style: UIFont.TextStyle = .body, color: UIColor = textColor) -> UILabel { + let label = self.text(text, color: color) + label.font = .preferredFont(forTextStyle: style) + return label + } + + /// 白色内容卡片使用细边框和统一内边距。 + static func card() -> UIStackView { + let stack = UIStackView() + stack.axis = .vertical + stack.spacing = 10 + stack.backgroundColor = .white + stack.layer.cornerRadius = 11 + stack.layer.borderWidth = 1 + stack.layer.borderColor = border.cgColor + stack.layoutMargins = UIEdgeInsets(top: 14, left: 14, bottom: 14, right: 14) + stack.isLayoutMarginsRelativeArrangement = true + return stack + } + + /// 提示内容在浅橙背景中展示。 + static func notice(_ value: String, demo: Bool = false) -> UIStackView { + let box = UIStackView(arrangedSubviews: [text(value, size: demo ? 11 : 12, color: hintColor)]) + box.axis = .vertical + box.backgroundColor = hintBackground + box.layer.cornerRadius = 6 + box.isLayoutMarginsRelativeArrangement = true + box.layoutMargins = UIEdgeInsets(top: 9, left: 10, bottom: 9, right: 10) + return box + } + + /// 明确标识本机演示边界。 + static func demoNotice() -> UIStackView { + notice("开发演示 · 记录仅保存在本机,未同步景区后台", demo: true) + } + + /// 使用本地时区展示任务截止和考试时间。 + static func date(_ date: Date) -> String { + let formatter = DateFormatter() + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = "MM-dd HH:mm" + return formatter.string(from: date) + } + + /// 培训专用按钮,文字缩放时高度随内容增加。 + static func button(_ title: String, secondary: Bool = false, plain: Bool = false, pill: Bool = false) -> UIButton { + let button = UIButton(type: .system) + var configuration = UIButton.Configuration.plain() + configuration.title = title + configuration.baseForegroundColor = plain || secondary ? primary : .white + configuration.background.backgroundColor = plain ? .clear : secondary ? primary.withAlphaComponent(0.08) : primary + configuration.background.cornerRadius = pill ? 24 : 11 + configuration.contentInsets = NSDirectionalEdgeInsets(top: plain ? 10 : 12, leading: 14, bottom: plain ? 10 : 12, trailing: 14) + configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var output = incoming + output.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14, weight: plain ? .regular : .semibold)) + return output + } + button.configuration = configuration + if !plain, !secondary { + button.configurationUpdateHandler = { button in + var updated = button.configuration + updated?.background.backgroundColor = button.isEnabled ? primary : border + updated?.baseForegroundColor = button.isEnabled ? .white : muted + button.configuration = updated + } + } + button.titleLabel?.adjustsFontForContentSizeCategory = true + button.snp.makeConstraints { $0.height.greaterThanOrEqualTo(44) } + return button + } + + /// 导航栏保持普通白色背景,入口使用文本与箭头。 + static func navigation(_ controller: UIViewController, title: String) { + controller.title = title + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.backgroundColor = .white + appearance.shadowColor = .clear + appearance.titleTextAttributes = [.font: UIFont.systemFont(ofSize: 17, weight: .medium), .foregroundColor: textColor] + controller.navigationItem.standardAppearance = appearance + controller.navigationItem.scrollEdgeAppearance = appearance + controller.navigationItem.compactAppearance = appearance + controller.navigationItem.backButtonDisplayMode = .minimal + let back = UIButton(type: .system) + back.tintColor = textColor + back.setImage(UIImage(systemName: "chevron.left", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .medium)), for: .normal) + back.accessibilityLabel = "返回" + back.snp.makeConstraints { $0.size.equalTo(44) } + back.addAction(UIAction { [weak controller] _ in controller?.navigationController?.popViewController(animated: true) }, for: .touchUpInside) + let item = UIBarButtonItem(customView: back) + if #available(iOS 26.0, *) { item.hidesSharedBackground = true } + controller.navigationItem.leftBarButtonItem = item + } +} + +/// 任务卡显示截止、考试信息、提示、进度条和对应的操作入口。 +@MainActor +final class TrainingTaskCell: UITableViewCell { + static let reuseIdentifier = "TrainingTaskCell" + private let stack = TrainingUI.card() + private let deadlineLabel = TrainingUI.text(size: 11.5, color: .systemRed) + private let statusLabel = TrainingUI.text(size: 11, color: TrainingUI.primary) + private let titleLabel = TrainingUI.text(size: 15.5, weight: .semibold) + private let publisherLabel = TrainingUI.text(size: 12.5, color: TrainingUI.muted) + private let metaLabel = TrainingUI.text(size: 12.5, color: TrainingUI.muted) + private let hintLabel = TrainingUI.text(size: 12, color: TrainingUI.hintColor) + private let progressView = UIProgressView(progressViewStyle: .bar) + private let progressLabel = TrainingUI.text(size: 12.5, color: TrainingUI.muted) + private let actionButton = TrainingUI.button("去学习", pill: true) + private let footer = UIStackView() + var onAction: (() -> Void)? + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + backgroundColor = .clear + selectionStyle = .none + contentView.addSubview(stack) + let deadline = UIStackView(arrangedSubviews: [deadlineLabel]) + deadline.backgroundColor = UIColor.systemRed.withAlphaComponent(0.06) + deadline.layer.cornerRadius = 12 + deadline.isLayoutMarginsRelativeArrangement = true + deadline.layoutMargins = UIEdgeInsets(top: 4, left: 8, bottom: 4, right: 8) + let top = UIStackView(arrangedSubviews: [deadline, UIView(), statusLabel]) + top.alignment = .center + top.spacing = 8 + statusLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + let hint = UIStackView(arrangedSubviews: [hintLabel]) + hint.backgroundColor = TrainingUI.hintBackground + hint.layer.cornerRadius = 6 + hint.isLayoutMarginsRelativeArrangement = true + hint.layoutMargins = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) + progressView.progressTintColor = TrainingUI.primary + progressView.trackTintColor = TrainingUI.border + progressView.layer.cornerRadius = 3 + progressView.clipsToBounds = true + progressView.snp.makeConstraints { $0.height.equalTo(6) } + footer.spacing = 12 + footer.alignment = .center + footer.addArrangedSubview(progressLabel) + footer.addArrangedSubview(actionButton) + progressLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + actionButton.setContentHuggingPriority(.defaultHigh, for: .horizontal) + actionButton.setContentCompressionResistancePriority(.required, for: .horizontal) + actionButton.snp.makeConstraints { $0.width.greaterThanOrEqualTo(140).priority(750) } + [top, titleLabel, publisherLabel, metaLabel, hint, progressView, footer].forEach(stack.addArrangedSubview) + stack.setCustomSpacing(14, after: top) + stack.setCustomSpacing(14, after: metaLabel) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 13, bottom: 10, right: 13)) } + actionButton.addTarget(self, action: #selector(actionTapped), for: .touchUpInside) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 每个任务始终可回顾课程,只有已读完且有效时直接进入考试。 + func configure(task: TrainingTask) { + let presentation = TrainingTaskPresentation(task: task) + titleLabel.text = task.title + deadlineLabel.text = "截止时间:\(TrainingUI.date(task.endAt))" + statusLabel.text = task.learnerStatus.title + statusLabel.textColor = task.learnerStatus == .completed ? TrainingUI.success : TrainingUI.primary + publisherLabel.text = "发布人:\(task.publisherText)" + metaLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.questions.count) 题 · \(task.passScore) 分及格" : "仅学习" + hintLabel.text = presentation.hint + progressView.progress = Float(presentation.progressPercent) / 100 + progressLabel.text = "学习进度 \(presentation.progressPercent)%" + var configuration = actionButton.configuration + configuration?.title = presentation.actionTitle + actionButton.configuration = configuration + actionButton.accessibilityIdentifier = "training.task.action.\(task.id)" + footer.axis = traitCollection.preferredContentSizeCategory.isAccessibilityCategory ? .vertical : .horizontal + } + + /// 正式任务卡只展示摘要和服务端资格,不由本地时钟推断是否可交卷。 + func configure(task: TrainingTaskSummary) { + titleLabel.text = task.title + deadlineLabel.text = task.endAt.map { "截止时间:\(TrainingUI.date($0))" } ?? "未设置截止时间" + statusLabel.text = task.learnerStatus.title + statusLabel.textColor = switch task.learnerStatus { case .pendingExam: TrainingUI.primary; case .completed: TrainingUI.success; case .ended: TrainingUI.muted } + let publisher = task.publisherName?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + publisherLabel.text = "发布人:\(publisher.isEmpty ? "未记录" : publisher)" + metaLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.questionCount) 题 · \(task.passScore ?? 0) 分及格" : "仅学习" + let completed = task.learnerStatus == .completed + let ended = task.learnerStatus == .ended + hintLabel.text = ended ? "任务已结束,仅可回顾课程内容" : completed ? "已完成本次学习任务" : task.learning.canStartExam ? "课程已学完,可以开始考试" : task.learning.canStudy ? "请阅读课程,完成学习要求" : "任务暂不可提交,可回顾课程内容" + let progress = min(100, max(0, task.learning.progressPercent)) + progressView.progress = Float(progress) / 100 + progressLabel.text = "学习进度 \(progress)%" + var configuration = actionButton.configuration + configuration?.title = ended || completed ? "回顾学习" : task.learning.canStartExam ? (task.learning.hasDraft ? "继续答题" : "开始考试") : task.learning.canStudy ? "去学习" : "查看课程" + actionButton.configuration = configuration + actionButton.isEnabled = task.learning.canViewCourse || (!ended && task.learning.canStartExam) + actionButton.accessibilityIdentifier = "training.task.action.\(task.id)" + footer.axis = traitCollection.preferredContentSizeCategory.isAccessibilityCategory ? .vertical : .horizontal + } + + @objc private func actionTapped() { onAction?() } +} + +/// 考试记录沿用小程序的标题、蓝色得分和通过状态卡片。 +@MainActor +final class TrainingRecordCell: UITableViewCell { + static let reuseIdentifier = "TrainingRecordCell" + private let stack = TrainingUI.card() + private let titleLabel = TrainingUI.text(weight: .semibold) + private let scoreLabel = TrainingUI.text(weight: .semibold, color: TrainingUI.primary) + private let detailLabel = TrainingUI.text(size: 11.5, color: TrainingUI.muted) + private let statusLabel = TrainingUI.text(size: 11.5) + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + backgroundColor = .clear + selectionStyle = .none + let top = UIStackView(arrangedSubviews: [titleLabel, scoreLabel]) + top.spacing = 12 + top.alignment = .top + scoreLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + scoreLabel.setContentHuggingPriority(.required, for: .horizontal) + titleLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + let bottom = UIStackView(arrangedSubviews: [detailLabel, statusLabel]) + bottom.spacing = 12 + bottom.alignment = .top + statusLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + statusLabel.setContentHuggingPriority(.required, for: .horizontal) + detailLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + stack.addArrangedSubview(top) + stack.addArrangedSubview(bottom) + contentView.addSubview(stack) + stack.snp.makeConstraints { $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 13, bottom: 10, right: 13)) } + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + /// 展示已提交记录,点击后进入该次成绩。 + func configure(task: TrainingTask, attempt: TrainingAttempt) { + titleLabel.text = task.title + scoreLabel.text = "\(attempt.scoreText) 分" + detailLabel.text = "\(TrainingUI.date(attempt.submittedAt)) · 答对 \(attempt.correctCount) / \(attempt.questionCount) 题" + statusLabel.text = attempt.passed ? "已通过" : "未通过" + statusLabel.textColor = attempt.passed ? TrainingUI.success : .systemRed + } + + /// 正式历史列表使用成绩摘要,不读取任务或完整解析。 + func configure(attempt: TrainingAttemptSummary) { + titleLabel.text = attempt.taskTitle + scoreLabel.text = "\(attempt.scoreText) 分" + detailLabel.text = "\(TrainingUI.date(attempt.submittedAt)) · 答对 \(attempt.correctCount) / \(attempt.questionCount) 题" + statusLabel.text = attempt.passed ? "已通过" : "未通过" + statusLabel.textColor = attempt.passed ? TrainingUI.success : .systemRed + } +} + +/// 培训页面在账号或景区切换时立即关闭,停止展示旧身份记录。 +@MainActor +class TrainingBaseViewController: BaseViewController { + private var requestLoadingTokens: Set = [] + + /// 展示本页面请求持有的 App 通用 Loading,在完成或离开页面时释放。 + func beginRequestLoading() -> UUID { + let token = GlobalLoadingManager.shared.beginRequest() + requestLoadingTokens.insert(token) + return token + } + + /// 只释放本页面持有的令牌,迟到请求不能关闭其它页面的 Loading。 + func endRequestLoading(_ token: UUID) { + guard requestLoadingTokens.remove(token) != nil else { return } + GlobalLoadingManager.shared.endRequest(token) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + endOwnedRequestLoading() + } + + override func viewDidLoad() { + super.viewDidLoad() + for name in [NotificationName.accountDidSwitch, NotificationName.scenicDidChange, NotificationName.userDidLogout] { + NotificationCenter.default.addObserver(self, selector: #selector(contextChanged), name: name, object: nil) + } + } + + private func endOwnedRequestLoading() { + for token in requestLoadingTokens { GlobalLoadingManager.shared.endRequest(token) } + requestLoadingTokens = [] + } + + @objc private func contextChanged() { + endOwnedRequestLoading() + navigationController?.popToRootViewController(animated: false) + } +} diff --git a/suixinkanTests/APIClientConsoleLoggingTests.swift b/suixinkanTests/APIClientConsoleLoggingTests.swift new file mode 100644 index 0000000..604cc14 --- /dev/null +++ b/suixinkanTests/APIClientConsoleLoggingTests.swift @@ -0,0 +1,146 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证统一控制台日志覆盖普通、裸 JSON 和文件上传入口,全部使用内存响应。 +@MainActor +final class APIClientConsoleLoggingTests: XCTestCase { + /// 机巢内部诊断通过真正控制台格式化入口后,POST 回包仍带原入参且没有重复解析事件。 + func testDroneResponseKeepsOriginalQueryAndBodyWithoutDiagnosticFields() async throws { + var logs: [String] = [] + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 100099, msg: "模拟业务拒绝")]) + let client = APIClient(environment: .testing, session: session, droneDockLogSink: { + if let text = APIConsoleFormat.render($0) { logs.append(text) } + }) + do { + let _: EmptyPayload = try await client.send(APIRequest(method: .post, + path: "/api/yf-handset-app/photog/multi-plane/pay-code", + queryItems: [.init(name: "scenic_id", value: "128")], body: ["project_id": 386])) + XCTFail("应保留业务拒绝") + } catch {} + XCTAssertEqual(logs.count, 2) + let start = try json(logs[0]) + let end = try json(logs[1]) + let params = try XCTUnwrap(end["params"] as? [String: Any]) + XCTAssertEqual((params["query"] as? [String: String])?["scenic_id"], "128") + XCTAssertEqual((params["body"] as? [String: Int])?["project_id"], 386) + XCTAssertTrue(NSDictionary(dictionary: params).isEqual(to: try XCTUnwrap(start["params"] as? [String: Any]))) + XCTAssertEqual(Set(end.keys), ["path", "params", "response"]) + XCTAssertEqual((end["response"] as? [String: Any])?["code"] as? Int, 100099) + XCTAssertEqual(session.requests.count, 1) + } + + /// 业务拒绝只输出一次原始回包,没有模块标签和重复失败事件。 + func testBusinessFailureLogsOnlyRequestAndOriginalResponse() async throws { + var logs: [String] = [] + let payload = try TestJSON.errorEnvelope(code: 100099, msg: "测试订单不存在") + let client = APIClient(environment: .testing, session: MockURLSession(responses: [payload]), + debugLogSink: { logs.append($0) }) + do { + let _: EmptyPayload = try await client.send(APIRequest(method: .get, path: "/api/app/store/order/detail")) + XCTFail("应保留业务拒绝") + } catch {} + XCTAssertEqual(logs.count, 2) + XCTAssertEqual(Set(try json(logs[0]).keys), ["path", "params"]) + let received = try json(logs[1]) + XCTAssertEqual(Set(received.keys), ["path", "params", "response"]) + XCTAssertEqual((received["response"] as? [String: Any])?["code"] as? Int, 100099) + XCTAssertEqual(received["path"] as? String, "/api/app/store/order/detail") + } + + /// 请求与大响应完整保留;multipart 记录大小,不把文件字节打印到控制台。 + func testEveryRequestEntryLogsRequestAndCompleteResponse() async throws { + let detail = String(repeating: "完整中文字段😀", count: 1_000) + "END-OF-RESPONSE" + let response = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": ["detail": detail]]) + for kind in RequestKind.allCases { + let session = MockURLSession(responses: [response]) + var logs: [String] = [] + let client = APIClient(environment: .testing, session: session, debugLogSink: { logs.append($0) }) + client.bindAuthTokenProvider { "test-auth-token" } + try await send(kind, client: client) + XCTAssertEqual(logs.count, 2, kind.rawValue) + let request = try XCTUnwrap(logs.first) + XCTAssertEqual(Set(try json(request).keys), ["path", "params"]) + XCTAssertTrue(request.contains("/api/mock/release-logging")) + XCTAssertFalse(request.contains("test-auth-token")) + XCTAssertEqual(session.requests.first?.value(forHTTPHeaderField: "token"), "test-auth-token") + if kind == .multipart { + XCTAssertTrue(request.contains("multipart/form-data")) + XCTAssertFalse(request.contains("BINARY-FILE-CONTENTS")) + } else { + XCTAssertTrue(request.contains("END-OF-REQUEST")) + if kind == .typed { + let params = try XCTUnwrap(try json(request)["params"] as? [String: Any]) + XCTAssertEqual((params["query"] as? [String: String])?["page"], "2") + } + } + let received = try XCTUnwrap(logs.last) + XCTAssertEqual(Set(try json(received).keys), ["path", "params", "response"]) + XCTAssertFalse(received.contains("status=200")) + XCTAssertTrue(received.contains(detail), "完整响应不能因为长度被截断") + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 传输失败和两种取消在三个入口均有终态日志,取消不伪造 Response。 + func testEveryRequestEntryLogsFailureAndCancellation() async throws { + for kind in RequestKind.allCases { + for error in [URLError(.timedOut), CancellationError(), URLError(.cancelled), + NSError(domain: "TestFailure", code: 9)] as [Error] { + var logs: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(results: [.failure(error)]), + debugLogSink: { logs.append($0) }) + do { try await send(kind, client: client); XCTFail("失败必须保留") } catch {} + XCTAssertEqual(logs.count, 2, kind.rawValue) + let cancelled = error is CancellationError || (error as? URLError)?.code == .cancelled + let response = try XCTUnwrap(try json(logs[1])["response"] as? [String: Any]) + let local = try XCTUnwrap(response["local_error"] as? [String: String]) + XCTAssertEqual(local["kind"], cancelled ? "cancelled" : "network_failed") + XCTAssertNil(response["code"]) + } + } + } + + /// HTTP、业务和解析失败保留原始回包且不重复打印错误,保持原有抛错行为。 + func testEveryRequestEntryLogsRejectedAndMalformedResponses() async throws { + for kind in RequestKind.allCases { + for (data, status) in [ + (try TestJSON.errorEnvelope(code: 100099, msg: "测试业务拒绝"), 200), + (Data("测试网关错误".utf8), 503), + (Data("invalid-json".utf8), 200) + ] { + var logs: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(responses: [data], statusCode: status), + debugLogSink: { logs.append($0) }) + do { try await send(kind, client: client); XCTFail("失败必须抛出") } catch {} + XCTAssertEqual(logs.count, 2, kind.rawValue) + XCTAssertNotNil(try json(logs[1])["response"]) + XCTAssertFalse(logs[1].contains("local_error")) + } + } + } + + private func json(_ text: String) throws -> [String: Any] { + try XCTUnwrap(JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String: Any]) + } + + /// 三种统一网络发送入口。 + private enum RequestKind: String, CaseIterable { case typed, rawJSON, multipart } + + private func send(_ kind: RequestKind, client: APIClient) async throws { + let path = "/api/mock/release-logging" + let text = String(repeating: "请求正文", count: 1_000) + "END-OF-REQUEST" + switch kind { + case .typed: + let _: EmptyPayload = try await client.send(APIRequest(method: .post, path: path, + queryItems: [.init(name: "page", value: "2")], body: ["note": text])) + case .rawJSON: + let body = try JSONSerialization.data(withJSONObject: ["note": text]) + let _: EmptyPayload = try await client.sendRawJSON(method: .post, path: path, + jsonBody: String(decoding: body, as: UTF8.self)) + case .multipart: + let _: EmptyPayload = try await client.sendMultipart(path: path, fileName: "test.jpg", + mimeType: "image/jpeg", data: Data("BINARY-FILE-CONTENTS".utf8)) + } + } +} diff --git a/suixinkanTests/APIClientTests.swift b/suixinkanTests/APIClientTests.swift index 979ba97..9906ed7 100644 --- a/suixinkanTests/APIClientTests.swift +++ b/suixinkanTests/APIClientTests.swift @@ -40,6 +40,45 @@ final class APIClientTests: XCTestCase { XCTAssertEqual(session.requests[0].value(forHTTPHeaderField: "token"), "test-token-abc") } + func testQueryPreservesOpaqueCursorWithPlusAndDoesNotEncodePercentTwice() async throws { + let responseData = try TestJSON.envelope(data: AppConfigResponse(enableRegister: false)) + let session = MockURLSession(responses: [responseData]) + let client = APIClient(environment: .testing, session: session) + let cursor = "base64+part/with=padding 中文" + let literalPercent = "%2B already encoded text" + + let _: AppConfigResponse = try await client.send(APIRequest( + method: .get, + path: "/api/app/config", + queryItems: [ + URLQueryItem(name: "cursor", value: cursor), + URLQueryItem(name: "literal", value: literalPercent), + ] + )) + + let url = try XCTUnwrap(session.requests.first?.url) + let components = try XCTUnwrap(URLComponents(url: url, resolvingAgainstBaseURL: false)) + let encodedQuery = try XCTUnwrap(components.percentEncodedQuery) + XCTAssertFalse(encodedQuery.contains("+")) + XCTAssertTrue(encodedQuery.contains("base64%2Bpart")) + XCTAssertTrue(encodedQuery.contains("part/with%3Dpadding"), "保留原有斜线编码语义,等号仍作为值编码") + XCTAssertTrue(encodedQuery.contains("%20")) + XCTAssertTrue(encodedQuery.contains("%E4%B8%AD%E6%96%87")) + XCTAssertTrue(encodedQuery.contains("literal=%252B%20"), "请求值中的字面百分号只编码一次") + XCTAssertFalse(encodedQuery.contains("base64%252B"), "修正生成的 %2B 不能再次编码为 %252B") + + // 模拟 PHP/Laravel 常见的 form-query 解析,区别于 URLComponents 对 + 的保留行为。 + let decodedPairs = encodedQuery.split(separator: "&").map { pair -> (String, String) in + let parts = pair.split(separator: "=", maxSplits: 1, omittingEmptySubsequences: false) + let name = String(parts[0]).replacingOccurrences(of: "+", with: " ").removingPercentEncoding ?? "" + let value = String(parts[1]).replacingOccurrences(of: "+", with: " ").removingPercentEncoding ?? "" + return (name, value) + } + let decoded = Dictionary(uniqueKeysWithValues: decodedPairs) + XCTAssertEqual(decoded["cursor"], cursor, "加号、空格、斜线、等号和中文均须原样到达后端") + XCTAssertEqual(decoded["literal"], literalPercent) + } + func testSendThrowsServerCodeErrorForBusinessFailure() async throws { let responseData = try TestJSON.errorEnvelope(code: 100001, msg: "密码错误") let session = MockURLSession(responses: [responseData]) @@ -97,6 +136,49 @@ final class APIClientTests: XCTestCase { await fulfillment(of: [expectation], timeout: 1) } + func testExpiredResponseFromReplacedTokenDoesNotExpireNewSession() async throws { + let center = NotificationCenter() + let expired = XCTNSNotificationExpectation(name: NotificationName.sessionDidExpire, object: nil, notificationCenter: center) + expired.isInverted = true + let token = APIClientTestTokenState("old-token") + let session = APIClientExpiredResponseSession( + response: try TestJSON.errorEnvelope(code: 100060, msg: "旧 Token 已失效"), + beforeResponse: { token.value = "new-token" } + ) + let client = APIClient(environment: .testing, session: session, notificationCenter: center) + client.bindAuthTokenProvider { token.value } + + do { + let _: AppConfigResponse = try await client.send(APIRequest(method: .get, path: "/api/app/config")) + XCTFail("旧请求仍须向调用者返回原始失败") + } catch let APIError.serverCode(code, _) { + XCTAssertEqual(code, 100060) + } + + let sentToken = await session.requestToken + XCTAssertEqual(sentToken, "old-token") + XCTAssertEqual(token.value, "new-token") + await fulfillment(of: [expired], timeout: 0.1) + } + + func testExpiredResponseForCurrentTokenStillExpiresSession() async throws { + let center = NotificationCenter() + let expired = XCTNSNotificationExpectation(name: NotificationName.sessionDidExpire, object: nil, notificationCenter: center) + let token = APIClientTestTokenState("current-token") + let session = APIClientExpiredResponseSession( + response: try TestJSON.errorEnvelope(code: 180024, msg: "Token 已失效"), + beforeResponse: { token.value = "current-token" } + ) + let client = APIClient(environment: .testing, session: session, notificationCenter: center) + client.bindAuthTokenProvider { token.value } + + _ = try? await client.send(APIRequest(method: .get, path: "/api/app/config")) + + let sentToken = await session.requestToken + XCTAssertEqual(sentToken, "current-token") + await fulfillment(of: [expired], timeout: 1) + } + func testMultipartUploadBuildsAndroidCompatibleRequest() async throws { let session = MockURLSession(responses: [try TestJSON.envelope(data: EmptyPayload())]) let client = APIClient( @@ -152,3 +234,28 @@ final class APIClientTests: XCTestCase { } } } + +/// 网络等待期间可以切换的主 Actor 凭证,避免并发测试修改捕获变量。 +@MainActor +private final class APIClientTestTokenState { + var value: String + init(_ value: String) { self.value = value } +} + +/// 在请求已发出、响应返回前切换会话,模拟真实账号切换时的迟到失败。 +private actor APIClientExpiredResponseSession: URLSessionProtocol { + private let response: Data + private let beforeResponse: @MainActor @Sendable () -> Void + private(set) var requestToken: String? + + init(response: Data, beforeResponse: @escaping @MainActor @Sendable () -> Void) { + self.response = response + self.beforeResponse = beforeResponse + } + + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + requestToken = request.value(forHTTPHeaderField: "token") + await beforeResponse() + return (response, HTTPURLResponse(url: request.url!, statusCode: 200, httpVersion: nil, headerFields: nil)!) + } +} diff --git a/suixinkanTests/APIConsoleFormatTests.swift b/suixinkanTests/APIConsoleFormatTests.swift new file mode 100644 index 0000000..9ef9acb --- /dev/null +++ b/suixinkanTests/APIConsoleFormatTests.swift @@ -0,0 +1,130 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证普通接口保持简洁格式,仅明确标识的任务关键事件可输出诊断字段。 +final class APIConsoleFormatTests: XCTestCase { + func testReadableJSONContainsOnlyPathParamsAndResponse() throws { + let text = APIConsoleFormat.message(path: "/api/app/airport/shooting", params: ["id": "501", "live_battery": "0"], + response: ["code": 100000, "data": ["enabled": true, "battery": 0], "msg": "success"]) + let value = try object(text) + XCTAssertEqual(Set(value.keys), ["path", "params", "response"]) + XCTAssertEqual(value["path"] as? String, "/api/app/airport/shooting") + XCTAssertEqual(value["params"] as? [String: String], ["id": "501", "live_battery": "0"]) + XCTAssertEqual((value["response"] as? [String: Any])?["code"] as? Int, 100000) + XCTAssertTrue(text.hasPrefix("{\n \"path\":")) + XCTAssertTrue(text.contains("\n \"code\"")) + XCTAssertEqual(APIConsoleFormat.render(text), text) + } + + func testQueryAndBodyPreserveCollisionsDuplicateKeysAndNulls() throws { + var request = URLRequest(url: URL(string: "https://example.invalid/api/read?id=1&id=2&empty&name=%E4%B8%AD%E6%96%87")!) + request.httpBody = Data(#"{"id":3,"flag":false,"value":null}"#.utf8) + let params = try XCTUnwrap(APIConsoleFormat.parameters(request) as? [String: Any]) + let query = try XCTUnwrap(params["query"] as? [String: Any]) + XCTAssertEqual(query["id"] as? [String], ["1", "2"]) + XCTAssertTrue(query["empty"] is NSNull) + XCTAssertEqual(query["name"] as? String, "中文") + let body = try XCTUnwrap(params["body"] as? [String: Any]) + XCTAssertEqual(body["id"] as? Int, 3) + XCTAssertEqual(body["flag"] as? Bool, false) + XCTAssertTrue(body["value"] is NSNull) + } + + func testDiagnosticEnvelopeDoesNotReachConsoleButOriginalResponseDoes() throws { + let body: [String: Any] = ["code": 100000, "data": ["token": "MOCK-TOKEN", "sn_number": "MOCK-SN", "list": [1, 2]]] + let text = DroneDockDiagnostics.json(["event": "response.received", "path": "/api/app/airport/shooting", + "method": "GET", "request_id": "INTERNAL", "elapsed_ms": 123, "request_headers": ["token": "HEADER-TOKEN"], + "app_version": "1.0.0", "source": "local_simulation", "request_params": ["id": "501"], "body": body]) + let rendered = try XCTUnwrap(APIConsoleFormat.render(text)) + let value = try object(rendered) + XCTAssertEqual(Set(value.keys), ["path", "params", "response"]) + XCTAssertEqual(value["params"] as? [String: String], ["id": "501"]) + XCTAssertTrue(NSDictionary(dictionary: try XCTUnwrap(value["response"] as? [String: Any])).isEqual(to: body)) + for extra in ["HEADER-TOKEN", "INTERNAL", "request_headers", "app_version", "source", "elapsed_ms", "session=", "entry=", "part=", "【"] { + XCTAssertFalse(rendered.contains(extra), extra) + } + } + + func testPageHeartbeatRTCAndParsedResultEventsAreSilent() { + for event in ["page.appeared", "websocket.pong", "websocket.state", "shooting.snapshot_applied", "rtc.callback", "response.decoded", "response.rejected"] { + XCTAssertNil(APIConsoleFormat.render(DroneDockDiagnostics.json(["event": event, "path": "/api/app/airport/shooting", "body": ["id": 1]]))) + } + XCTAssertNil(APIConsoleFormat.render("plain diagnostic")) + } + + func testExplicitDroneTaskEventPreservesDiagnosticFields() throws { + let fields: [String: Any] = ["diagnostic": "drone_task", "event": "snapshot.applied", + "task_id": 8, "session_id": "SESSION", "sequence": 3, "elapsed_ms": 1250, + "timestamp": "2026-11-04T10:11:12.123+08:00", "phase": "arrived_pending_start", + "can_pause": true, "pending_command": NSNull()] + let rendered = try XCTUnwrap(APIConsoleFormat.render(DroneDockDiagnostics.json(fields))) + let value = try object(rendered) + XCTAssertTrue(NSDictionary(dictionary: value).isEqual(to: fields)) + XCTAssertNil(value["path"]) + XCTAssertNil(value["response"]) + } + + func testUnrelatedOrIncompleteTaskMarkersDoNotOpenDiagnosticOutput() { + let fields: [[String: Any]] = [ + ["event": "snapshot.applied", "task_id": 8], + ["diagnostic": "rtc", "event": "snapshot.applied", "task_id": 8], + ["diagnostic": "drone_task", "task_id": 8], + ["diagnostic": "drone_task", "event": "", "task_id": 8], + ["diagnostic": "drone_task", "event": " \n\t", "task_id": 8], + ["diagnostic": "drone_task", "event": 123, "task_id": 8] + ] + for value in fields { + XCTAssertNil(APIConsoleFormat.render(DroneDockDiagnostics.json(value))) + } + } + + func testBackendTaskMarkerRemainsInsideOrdinaryAPIResponse() throws { + let body: [String: Any] = ["diagnostic": "drone_task", "event": "backend.event", "code": 100000] + let raw = DroneDockDiagnostics.json(["event": "response.received", "path": "/api/read", + "request_params": ["id": 8], "body": body]) + let value = try object(XCTUnwrap(APIConsoleFormat.render(raw))) + XCTAssertEqual(Set(value.keys), ["path", "params", "response"]) + XCTAssertTrue(NSDictionary(dictionary: try XCTUnwrap(value["response"] as? [String: Any])).isEqual(to: body)) + } + + func testLongJSONStringsArraysAndTextAreNotTruncatedOrStringified() throws { + let text = String(repeating: "长字段中文😀\n", count: 1000) + "END-OF-BODY" + for payload: Any in [["detail": text], [1, 2, 3], NSNull(), "网关异常"] { + let data = try JSONSerialization.data(withJSONObject: payload, options: .fragmentsAllowed) + let rendered = APIConsoleFormat.message(path: "/api/read", params: [:], response: APIConsoleFormat.payload(data)) + let value = try XCTUnwrap(try object(rendered)["response"]) + XCTAssertEqual(DroneDockDiagnostics.json(value), DroneDockDiagnostics.json(payload)) + } + } + + func testLocalFailuresAreClearlyNotBackendResponses() throws { + for event in ["request.failed", "request.cancelled", "request.blocked"] { + let raw = DroneDockDiagnostics.json(["path": "/api/app/airport/shoot", "event": event, + "request_params": ["id": 501], "message": "模拟本地失败"]) + let value = try object(XCTUnwrap(APIConsoleFormat.render(raw))) + let response = try XCTUnwrap(value["response"] as? [String: Any]) + XCTAssertNotNil(response["local_error"]) + XCTAssertNil(response["code"]) + XCTAssertEqual(value["params"] as? [String: Int], ["id": 501]) + } + } + + func testSocketAndFileTransferUseActualPaths() throws { + let socket = DroneDockDiagnostics.json(["event": "response.received", "path": "/wss", "request_params": ["id": 501], + "body": ["code": 0, "data": ["action": "app_airport_shooting_updated"]]]) + let value = try object(XCTUnwrap(APIConsoleFormat.render(socket))) + XCTAssertEqual(value["path"] as? String, "/wss") + XCTAssertEqual((value["response"] as? [String: Any])?["code"] as? Int, 0) + let file = DroneDockFileTransferTrace(operation: "file_download", method: "GET", + remoteURL: URL(string: "https://example.invalid/mock.mp4?signature=MOCK")) + let download = try object(XCTUnwrap(APIConsoleFormat.render(file.message("response.received", fields: ["bytes": 2048])))) + XCTAssertEqual(download["path"] as? String, "/mock.mp4") + XCTAssertEqual(download["params"] as? [String: String], ["signature": "MOCK"]) + XCTAssertEqual(download["response"] as? [String: Int], ["binary_bytes": 2048]) + } + + private func object(_ text: String) throws -> [String: Any] { + try XCTUnwrap(JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String: Any]) + } +} diff --git a/suixinkanTests/APIConsoleOutputWriterTests.swift b/suixinkanTests/APIConsoleOutputWriterTests.swift new file mode 100644 index 0000000..593b76c --- /dev/null +++ b/suixinkanTests/APIConsoleOutputWriterTests.swift @@ -0,0 +1,80 @@ +import Darwin +import Foundation +import XCTest +@testable import suixinkan + +/// 复现控制台断连与写入失败,仅操作隔离句柄,不修改测试进程的 stdout。 +final class APIConsoleOutputWriterTests: XCTestCase { + /// 长 JSON 和中文完整写入,成功时不重复输出系统日志。 + func testCompleteJSONUsesStandardOutputOnce() throws { + let url = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + FileManager.default.createFile(atPath: url.path, contents: nil) + defer { try? FileManager.default.removeItem(at: url) } + let handle = try FileHandle(forWritingTo: url) + defer { try? handle.close() } + let writer = APIConsoleOutputWriter { try APIConsoleOutputWriter.write($0, to: handle) } + let text = APIConsoleFormat.message(path: "/api/app/airport/shooting", params: ["id": 501], + response: ["code": 100000, "data": ["message": String(repeating: "本地模拟图传", count: 2_000)]]) + var fallback: [String] = [] + writer.write(text, prefersStandardOutput: true) { fallback.append($0) } + XCTAssertEqual(try Data(contentsOf: url), Data((text + "\n").utf8)) + XCTAssertTrue(fallback.isEmpty) + } + + /// 与截图同类的 EIO 只触发回退,后续日志不再重试损坏的 Xcode 输出通道。 + func testInputOutputErrorFallsBackAndDisablesFailedChannel() { + let probe = ConsoleWriteFailureProbe() + let writer = APIConsoleOutputWriter { _ in try probe.fail() } + let text = APIConsoleFormat.message(path: "/api/app/airport/shooting", params: ["id": 501]) + var fallback: [String] = [] + writer.write(text, prefersStandardOutput: true) { fallback.append($0) } + writer.write(text, prefersStandardOutput: true) { fallback.append($0) } + XCTAssertEqual(probe.count, 1) + XCTAssertEqual(fallback, [text, text]) + } + + /// 真实关闭管道读端后写入应得到可捕获错误,不能触发 SIGPIPE 终止 App。 + func testBrokenPipeReturnsErrorAndFallsBack() throws { + let pipe = Pipe() + try pipe.fileHandleForReading.close() + defer { try? pipe.fileHandleForWriting.close() } + XCTAssertThrowsError(try APIConsoleOutputWriter.write(Data("test".utf8), to: pipe.fileHandleForWriting)) + let writer = APIConsoleOutputWriter { try APIConsoleOutputWriter.write($0, to: pipe.fileHandleForWriting) } + var fallback: [String] = [] + writer.write("完整记录", prefersStandardOutput: true) { fallback.append($0) } + XCTAssertEqual(fallback, ["完整记录"]) + } + + /// 无效文件描述符通过 POSIX 错误退出,不调用会抛 NSException 的旧写入方法。 + func testInvalidDescriptorDoesNotRaiseException() throws { + let descriptor = open("/dev/null", O_WRONLY) + XCTAssertGreaterThanOrEqual(descriptor, 0) + guard descriptor >= 0 else { return } + let handle = FileHandle(fileDescriptor: descriptor, closeOnDealloc: false) + XCTAssertEqual(Darwin.close(descriptor), 0) + XCTAssertThrowsError(try APIConsoleOutputWriter.write(Data("test".utf8), to: handle)) + } + + /// 独立运行不访问 stdout,系统日志保留原始内容。 + func testDetachedOutputUsesSystemFallbackDirectly() { + let probe = ConsoleWriteFailureProbe() + let writer = APIConsoleOutputWriter { _ in try probe.fail() } + var fallback: [String] = [] + writer.write("原始 JSON", prefersStandardOutput: false) { fallback.append($0) } + XCTAssertEqual(probe.count, 0) + XCTAssertEqual(fallback, ["原始 JSON"]) + } +} + +/// 带锁的失败输出替身,允许由 Sendable 写入闭包记录尝试次数。 +private final class ConsoleWriteFailureProbe: @unchecked Sendable { + private let lock = NSLock() + private var attempts = 0 + var count: Int { lock.lock(); defer { lock.unlock() }; return attempts } + func fail() throws { + lock.lock() + attempts += 1 + lock.unlock() + throw POSIXError(.EIO) + } +} diff --git a/suixinkanTests/AllFunctionsViewModelTests.swift b/suixinkanTests/AllFunctionsViewModelTests.swift index 9dfe9f7..7963767 100644 --- a/suixinkanTests/AllFunctionsViewModelTests.swift +++ b/suixinkanTests/AllFunctionsViewModelTests.swift @@ -144,6 +144,78 @@ final class AllFunctionsViewModelTests: XCTestCase { XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["location_report", "report_photographer"]) } + + /// 培训权限不额外按账号类型过滤,并按持久化配置区分常用和更多。 + func testTrainingPermissionFollowsSavedGroupingForStoreAndScenicAccounts() throws { + for accountType in [AppAccountType.storeUser, .scenicUser] { + appStore.session.accountType = accountType + appStore.session.roleCode = accountType == .storeUser ? AppRoleCode.storeAdmin.rawValue : AppRoleCode.photographer.rawValue + appStore.permissions.savePermissionItems([ + HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet"), + HomePermissionItem(id: "training", name: "培训", uri: "training"), + ]) + menuStore.saveCommonURIs(["wallet"], accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode) + let viewModel = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + viewModel.loadFunctions() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(viewModel.moreMenus.map(\.uri), ["/training"]) + + let training = try XCTUnwrap(viewModel.moreMenus.first) + viewModel.addToCommon(training) + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet", "/training"]) + viewModel.removeFromCommon(training) + viewModel.loadFunctions() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(viewModel.moreMenus.map(\.uri), ["/training"]) + } + } + + /// 撤回兼容的两种权限后隐藏旧记录,格式近似的 URI 不能授权培训。 + func testTrainingPermissionWithdrawalAndUnrecognizedURIsCannotExposeSavedEntry() { + appStore.session.accountType = .storeUser + appStore.session.roleCode = AppRoleCode.storeAdmin.rawValue + menuStore.saveCommonURIs(["wallet", "/training"], accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode) + appStore.permissions.savePermissionItems([ + HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet"), + HomePermissionItem(id: "training", name: "培训", uri: "/training"), + ]) + let viewModel = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + viewModel.loadFunctions() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet", "/training"]) + + for trainingURI in [nil, "Training", " training", "training/", "/training/"] as [String?] { + var permissions = [HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet")] + if let trainingURI { permissions.append(HomePermissionItem(id: "training", name: "培训", uri: trainingURI)) } + appStore.permissions.savePermissionItems(permissions) + viewModel.loadFunctions() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet"]) + XCTAssertTrue(viewModel.moreMenus.isEmpty) + } + } + + /// 在飞权限撤回后,迟到的列表快照不能把入口重新加入常用或更多。 + func testRevokedTrainingCannotBeMovedUsingStaleSnapshot() throws { + let wallet = HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet") + let training = HomePermissionItem(id: "training", name: "培训", uri: "/training") + for startsInCommon in [false, true] { + appStore.permissions.savePermissionItems([wallet, training]) + menuStore.saveCommonURIs(startsInCommon ? ["wallet", "/training"] : ["wallet"], + accountScope: appStore.session.accountCachePrefix, roleCode: appStore.session.roleCode) + let viewModel = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + viewModel.loadFunctions() + let stale = try XCTUnwrap((viewModel.commonMenus + viewModel.moreMenus).first { $0.uri == "/training" }) + appStore.permissions.savePermissionItems([wallet]) + + if startsInCommon { viewModel.removeFromCommon(stale) } + else { viewModel.addToCommon(stale) } + + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet"]) + XCTAssertTrue(viewModel.moreMenus.isEmpty) + XCTAssertFalse(viewModel.didCustomize) + } + } } /// 全部功能菜单卡片交互语义测试。 diff --git a/suixinkanTests/AppStoreModuleTests.swift b/suixinkanTests/AppStoreModuleTests.swift index 839a902..338460e 100644 --- a/suixinkanTests/AppStoreModuleTests.swift +++ b/suixinkanTests/AppStoreModuleTests.swift @@ -126,6 +126,34 @@ final class AppStoreModuleTests: XCTestCase { XCTAssertFalse(appStore.scenicQueue.useOfflineTTS) } + /// 权限通知归属于实际写入的 store,观察者可在收到时立即读到持久化快照。 + func testPermissionChangesNotifyMatchingStoreAfterPersistence() { + selectAccount(userId: "permissions", type: .storeUser) + let items = [HomePermissionItem(id: "training", name: "培训", uri: "/training")] + let granted = expectation(description: "实际写入的权限 store 通知") + let grantedObserver = NotificationCenter.default.addObserver(forName: NotificationName.permissionItemsDidChange, + object: appStore.permissions, queue: nil) { notification in + XCTAssertEqual((notification.object as? AppPermissionStore)?.permissionItems(), items) + granted.fulfill() + } + granted.assertForOverFulfill = true + let otherStore = AppStore(defaults: defaults) + otherStore.permissions.savePermissionItems(items) + appStore.permissions.savePermissionItems(items) + wait(for: [granted], timeout: 1) + NotificationCenter.default.removeObserver(grantedObserver) + + let revoked = expectation(description: "撤回权限已持久化后通知") + let revokedObserver = NotificationCenter.default.addObserver(forName: NotificationName.permissionItemsDidChange, + object: appStore.permissions, queue: nil) { notification in + XCTAssertEqual((notification.object as? AppPermissionStore)?.permissionItems(), []) + revoked.fulfill() + } + defer { NotificationCenter.default.removeObserver(revokedObserver) } + appStore.permissions.savePermissionItems([]) + wait(for: [revoked], timeout: 1) + } + func testStoreAndQueueCachesAreIsolatedByScenicAndSpot() { selectAccount(userId: "1001", type: .scenicUser, scenicId: 22) appStore.session.currentStoreId = 220 diff --git a/suixinkanTests/CoreLocationProviderTests.swift b/suixinkanTests/CoreLocationProviderTests.swift index 96e93ee..9be312c 100644 --- a/suixinkanTests/CoreLocationProviderTests.swift +++ b/suixinkanTests/CoreLocationProviderTests.swift @@ -84,6 +84,81 @@ final class CoreLocationProviderTests: XCTestCase { XCTAssertEqual(snapshot.address, "") } + /// 系统始终不回调时结束本次定位,清理后可再次正常获取坐标。 + func testLocationTimeoutReleasesRequestAndAllowsRetry() async throws { + let context = makeContext(locationResult: .noCallback, locationTimeoutNanoseconds: 30_000_000) + + await assertLocationError(.locationFailed) { + _ = try await context.provider.requestCoordinate() + } + XCTAssertEqual(context.manager.requestLocationCallCount, 1) + XCTAssertEqual(context.manager.stopUpdatingLocationCallCount, 1) + + context.manager.locationResult = .success(CLLocation(latitude: 31.2, longitude: 121.4)) + let coordinate = try await context.provider.requestCoordinate() + XCTAssertEqual(coordinate.latitude, 31.2, accuracy: 0.000_001) + XCTAssertEqual(context.manager.requestLocationCallCount, 2) + XCTAssertEqual(context.manager.stopUpdatingLocationCallCount, 2) + } + + /// 离页取消会立即恢复等待并停止定位,不占用下一次请求。 + func testCancellationStopsPendingLocationAndAllowsRetry() async throws { + let context = makeContext(locationResult: .noCallback) + let task = Task { try await context.provider.requestCoordinate() } + try await waitUntil { context.manager.requestLocationCallCount == 1 } + + task.cancel() + do { + _ = try await task.value + XCTFail("取消定位后不应成功返回坐标") + } catch { + XCTAssertTrue(error is CancellationError) + } + XCTAssertEqual(context.manager.stopUpdatingLocationCallCount, 1) + + context.manager.locationResult = .success(CLLocation(latitude: 30.3, longitude: 120.2)) + let coordinate = try await context.provider.requestCoordinate() + XCTAssertEqual(coordinate.longitude, 120.2, accuracy: 0.000_001) + XCTAssertEqual(context.manager.requestLocationCallCount, 2) + } + + /// 授权弹窗尚未响应时取消,不残留等待者或在迟到授权后发起定位。 + func testCancellationWhileWaitingForPermissionAllowsNewRequest() async throws { + let context = makeContext(authorizationStatus: .notDetermined, requestedAuthorizationStatus: .notDetermined) + let task = Task { try await context.provider.requestCoordinate() } + try await waitUntil { context.manager.requestAuthorizationCallCount == 1 } + + task.cancel() + do { + _ = try await task.value + XCTFail("取消授权等待后不应继续定位") + } catch { + XCTAssertTrue(error is CancellationError) + } + XCTAssertEqual(context.manager.requestLocationCallCount, 0) + + context.manager.requestedAuthorizationStatus = .authorizedWhenInUse + _ = try await context.provider.requestCoordinate() + XCTAssertEqual(context.manager.requestAuthorizationCallCount, 2) + XCTAssertEqual(context.manager.requestLocationCallCount, 1) + } + + /// 已取消任务不能在注册取消处理之前启动授权或定位。 + func testAlreadyCancelledTaskDoesNotStartLocation() async { + let context = makeContext(authorizationStatus: .notDetermined) + let task = Task { try await context.provider.requestCoordinate() } + task.cancel() + + do { + _ = try await task.value + XCTFail("已取消任务不应返回坐标") + } catch { + XCTAssertTrue(error is CancellationError) + } + XCTAssertEqual(context.manager.requestAuthorizationCallCount, 0) + XCTAssertEqual(context.manager.requestLocationCallCount, 0) + } + private func makeContext( privacyAccepted: Bool = true, authorizationStatus: CLAuthorizationStatus = .authorizedWhenInUse, @@ -91,7 +166,8 @@ final class CoreLocationProviderTests: XCTestCase { locationResult: FakeCoreLocationManager.LocationResult = .success( CLLocation(latitude: 39.9042, longitude: 116.4074) ), - geocodedAddress: String = "北京市东城区" + geocodedAddress: String = "北京市东城区", + locationTimeoutNanoseconds: UInt64 = 10_000_000_000 ) -> TestContext { let suiteName = "CoreLocationProviderTests.\(UUID().uuidString)" let defaults = UserDefaults(suiteName: suiteName)! @@ -108,7 +184,8 @@ final class CoreLocationProviderTests: XCTestCase { let provider = CoreLocationProvider( appStore: appStore, manager: manager, - geocoder: geocoder + geocoder: geocoder, + locationTimeoutNanoseconds: locationTimeoutNanoseconds ) return TestContext(provider: provider, manager: manager, geocoder: geocoder) } @@ -124,6 +201,16 @@ final class CoreLocationProviderTests: XCTestCase { XCTAssertEqual(error as? LocationProviderError, expected) } } + + /// 等待替身请求开始再取消,避免用固定睡眠决定请求是否已挂起。 + private func waitUntil(_ condition: () -> Bool) async throws { + for _ in 0..<100 { + if condition() { return } + try await Task.sleep(nanoseconds: 1_000_000) + } + XCTFail("定位替身未收到预期请求") + throw NSError(domain: "CoreLocationProviderTests", code: 1) + } } /// Core Location fallback 测试依赖集合。 @@ -142,6 +229,7 @@ private final class FakeCoreLocationManager: CoreLocationManaging { enum LocationResult { case success(CLLocation) case failure + case noCallback } var authorizationStatus: CLAuthorizationStatus @@ -149,9 +237,10 @@ private final class FakeCoreLocationManager: CoreLocationManaging { weak var delegate: CLLocationManagerDelegate? private(set) var requestAuthorizationCallCount = 0 private(set) var requestLocationCallCount = 0 + private(set) var stopUpdatingLocationCallCount = 0 - private let requestedAuthorizationStatus: CLAuthorizationStatus - private let locationResult: LocationResult + var requestedAuthorizationStatus: CLAuthorizationStatus + var locationResult: LocationResult init( authorizationStatus: CLAuthorizationStatus, @@ -180,8 +269,15 @@ private final class FakeCoreLocationManager: CoreLocationManaging { callbackManager, didFailWithError: CLError(.locationUnknown) ) + case .noCallback: + break } } + + /// 记录被测服务是否释放超时或取消的单次请求。 + func stopUpdatingLocation() { + stopUpdatingLocationCallCount += 1 + } } /// 可控的逆地理编码替身。 diff --git a/suixinkanTests/DepositOrderListViewModelTests.swift b/suixinkanTests/DepositOrderListViewModelTests.swift index f94896a..4a6b928 100644 --- a/suixinkanTests/DepositOrderListViewModelTests.swift +++ b/suixinkanTests/DepositOrderListViewModelTests.swift @@ -24,6 +24,19 @@ final class DepositOrderListViewModelTests: XCTestCase { super.tearDown() } + func testOrderNotificationResetsFilters() { + let viewModel = DepositOrderListViewModel() + viewModel.onSearchTextChange("123", api: OrderAPI(client: APIClient(environment: .testing, session: MockURLSession(results: [])))) + viewModel.onFilterChange(tab: 18) + viewModel.onDateRangeSelected(start: Date(), end: Date()) + viewModel.resetFiltersForOrderNotification() + XCTAssertEqual(viewModel.searchText, "") + XCTAssertEqual(viewModel.tabIndex, 0) + XCTAssertEqual(viewModel.filterLabel, "全部") + XCTAssertNil(viewModel.startTime) + XCTAssertNil(viewModel.endTime) + } + func testStoreFilterMapsPaidStatusToAPI20() { XCTAssertEqual(DepositOrderListViewModel.apiOrderStatus(forTabIndex: 18), 20) XCTAssertEqual(DepositOrderListViewModel.apiOrderStatus(forTabIndex: 30), 30) diff --git a/suixinkanTests/DroneDeliveryFlowViewTests.swift b/suixinkanTests/DroneDeliveryFlowViewTests.swift new file mode 100644 index 0000000..a8f5055 --- /dev/null +++ b/suixinkanTests/DroneDeliveryFlowViewTests.swift @@ -0,0 +1,629 @@ +import UIKit +import XCTest +@testable import suixinkan + +#if DEBUG +/// 在隔离窗口验证实际交付入口、纯本地演示上传与整单确认页面联动。 +@MainActor +final class DroneDeliveryFlowViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 订单底部入口贯通选点、多选、本地预览和上传;关闭 Sheet 后实际订单摘要更新。 + func testOrdersDeliverySelectsVideosPreviewsAndCompletesLocalUpload() async throws { + let store = makeStore() + let orderID = try XCTUnwrap(store.orders.first?.id) + let seed = DroneDeliveryViewModel(store: store, orderID: orderID) + seed.applyScenario(.empty) + let originalOrder = try XCTUnwrap(store.shootingOrder(id: orderID)) + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let orders = try await openOrders(from: workbench, window: window) + let delivery = try button(in: orders.view, identifier: "drone.order.\(orderID).secondary") + XCTAssertEqual(delivery.title(for: .normal), "交付成片") + assertReachable(delivery, in: window) + delivery.sendActions(for: .touchUpInside) + let upload = try await waitForUploadSheet(from: orders, window: window) + XCTAssertNil(upload.viewModel.selectedPointID) + capture(window, root: upload.view, named: "交付流程-选择方式") + + let list = try collection(in: upload.view, identifier: "drone.delivery.upload.list") + try selectCell(in: list, identifier: "drone.delivery.upload.method.cloud", window: window) + try await settle(window) { self.find(in: upload.view, identifier: "drone.delivery.upload.openPicker") != nil } + let openPicker = try button(in: upload.view, identifier: "drone.delivery.upload.openPicker") + XCTAssertFalse(openPicker.isEnabled) + XCTAssertNil(upload.viewModel.selectedPoint) + capture(window, root: upload.view, named: "交付流程-未选点禁止打开演示相册") + let point = try XCTUnwrap(upload.viewModel.points.first) + try selectCell(in: list, identifier: "drone.delivery.upload.point.\(point.id)", window: window) + try await settle(window) { upload.viewModel.selectedPointID == point.id && openPicker.isEnabled } + assertReachable(openPicker, in: window) + openPicker.sendActions(for: .touchUpInside) + let videos = Array(upload.viewModel.availableVideos.prefix(2)) + XCTAssertEqual(upload.viewModel.availableVideos.count, 4) + XCTAssertEqual(videos.count, 2) + try await settle(window) { self.find(in: upload.view, identifier: "drone.delivery.upload.video.\(videos[1].id)") != nil } + for video in videos { + let toggle = try button(in: upload.view, identifier: "drone.delivery.upload.video.\(video.id)") + assertReachable(toggle, in: window) + toggle.sendActions(for: .touchUpInside) + } + try await settle(window) { upload.viewModel.selectedVideoIDs.count == 2 } + let selected = upload.viewModel.selectedVideoIDs + capture(window, root: upload.view, named: "交付流程-演示相册选择两个视频") + let preview = try button(in: upload.view, identifier: "drone.delivery.upload.preview.\(videos[0].id)") + assertReachable(preview, in: window) + preview.sendActions(for: .touchUpInside) + let previewController = try await waitForReadyPreview(from: upload, window: window) + XCTAssertEqual(upload.viewModel.selectedVideoIDs, selected) + XCTAssertNil(upload.viewModel.batch) + let closePreview = try button(in: previewController.view, identifier: "drone.material.preview.close") + assertReachable(closePreview, in: window) + closePreview.sendActions(for: .touchUpInside) + try await settle(window) { upload.presentedViewController == nil } + XCTAssertEqual(upload.viewModel.selectedVideoIDs, selected) + XCTAssertNil(upload.viewModel.batch) + + let start = try button(in: upload.view, identifier: "drone.delivery.upload.start") + XCTAssertTrue(start.isEnabled) + assertReachable(start, in: window) + start.sendActions(for: .touchUpInside) + XCTAssertEqual(upload.viewModel.uploadPhase, .uploading) + XCTAssertTrue(upload.viewModel.isUploadLocked) + try await settle(window, stabilization: 0.4) { list.numberOfSections == 2 } + capture(window, root: upload.view, named: "交付流程-逐项演示上传中") + let runningBatch = try XCTUnwrap(upload.viewModel.batch) + let queuedItem = try XCTUnwrap(runningBatch.items.first) + try selectCell(in: list, identifier: "drone.delivery.upload.item.\(queuedItem.id)", window: window) + let queuedPreview = try await waitForReadyPreview(from: upload, window: window) + XCTAssertEqual(upload.viewModel.batch?.id, runningBatch.id) + XCTAssertEqual(upload.viewModel.batch?.isPaused, false) + XCTAssertNotEqual(upload.viewModel.uploadPhase, .paused) + let closeQueuedPreview = try button(in: queuedPreview.view, identifier: "drone.material.preview.close") + assertReachable(closeQueuedPreview, in: window) + closeQueuedPreview.sendActions(for: .touchUpInside) + try await settle(window) { upload.presentedViewController == nil } + try await settle(window, timeout: 8) { upload.viewModel.uploadPhase == .completed } + XCTAssertEqual(upload.viewModel.uploadedCount, 2) + XCTAssertEqual(upload.viewModel.works.count, 2) + XCTAssertTrue(upload.viewModel.works.allSatisfy(\.isSimulation)) + assertShootingUnchanged(originalOrder, current: upload.viewModel.order) + capture(window, root: upload.view, named: "交付流程-本批演示交付成功") + let closeButton = try button(in: upload.view, identifier: "drone.delivery.upload.close") + assertReachable(closeButton, in: window) + closeButton.sendActions(for: .touchUpInside) + try await settle(window) { + orders.presentedViewController == nil && self.find(in: orders.view, identifier: "drone.order.\(orderID).confirmation")?.accessibilityLabel?.contains("已交付 2 个视频") == true + } + let confirmation = try control(in: orders.view, identifier: "drone.order.\(orderID).confirmation") + XCTAssertEqual(store.shootingOrder(id: orderID)?.deliveredVideoCount, 2) + XCTAssertTrue(confirmation.accessibilityLabel?.contains("请游客确认") == true) + assertShootingUnchanged(originalOrder, current: store.shootingOrder(id: orderID)) + capture(window, root: orders.view, named: "交付流程-关闭后订单交付摘要刷新") + } + + /// 素材记录的实际交付入口预选对应点位,保留原素材与拍摄次数。 + func testMaterialsRecordDeliveryPreservesRecordPointAndOriginalMaterials() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let materialsModel = DroneMaterialsViewModel(store: store, orderID: order.id) + materialsModel.applyScenario(.ready) + let originalRecords = materialsModel.sections + let record = try XCTUnwrap(originalRecords.first) + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let navigation = try XCTUnwrap(workbench.navigationController) + let homeList = try collection(in: workbench.view, identifier: "drone.workbench.list") + try await settle(window) { homeList.numberOfSections > 2 && homeList.numberOfItems(inSection: 2) == 1 } + homeList.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.home.\(order.id)") != nil } + let card = try XCTUnwrap(find(in: workbench.view, identifier: "drone.home.\(order.id)")) + let materialsEntry = try XCTUnwrap(allViews(in: card).compactMap { $0 as? UIButton }.first { + $0.accessibilityLabel?.hasPrefix("查看素材,") == true + }) + assertReachable(materialsEntry, in: window) + materialsEntry.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneMaterialsViewController && navigation.transitionCoordinator == nil } + let materials = try XCTUnwrap(navigation.topViewController as? DroneMaterialsViewController) + try await settle(window) { self.find(in: materials.view, identifier: "drone.materials.delivery.\(record.id)") != nil } + let delivery = try button(in: materials.view, identifier: "drone.materials.delivery.\(record.id)") + assertReachable(delivery, in: window) + delivery.sendActions(for: .touchUpInside) + let upload = try await waitForUploadSheet(from: materials, window: window) + XCTAssertEqual(upload.viewModel.selectedPointID, record.pointID) + let list = try collection(in: upload.view, identifier: "drone.delivery.upload.list") + XCTAssertNotNil(find(in: upload.view, identifier: "drone.delivery.upload.method.cloud")) + try selectCell(in: list, identifier: "drone.delivery.upload.method.cloud", window: window) + try await settle(window) { self.find(in: upload.view, identifier: "drone.delivery.upload.openPicker") != nil } + XCTAssertTrue(try button(in: upload.view, identifier: "drone.delivery.upload.openPicker").isEnabled) + let selectedPoint = try XCTUnwrap(find(in: upload.view, identifier: "drone.delivery.upload.point.\(record.pointID)")) + XCTAssertTrue(selectedPoint.accessibilityTraits.contains(.selected)) + capture(window, root: upload.view, named: "交付流程-素材记录入口预选对应点位") + materialsModel.refresh() + XCTAssertEqual(materialsModel.sections, originalRecords) + assertShootingUnchanged(order, current: store.shootingOrder(id: order.id)) + XCTAssertNil(upload.viewModel.batch) + try button(in: upload.view, identifier: "drone.delivery.upload.close").sendActions(for: .touchUpInside) + try await settle(window) { materials.presentedViewController == nil } + materialsModel.refresh() + XCTAssertEqual(materialsModel.sections, originalRecords) + assertShootingUnchanged(order, current: store.shootingOrder(id: order.id)) + } + + /// 多条拍摄记录下载完成后,底部交付先选方式,云端选点前不猜测记录。 + func testCompletedMaterialsFooterShowsMethodBeforeChoosingPoint() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let materialsModel = DroneMaterialsViewModel(store: store, orderID: order.id) + materialsModel.applyScenario(.completed) + let originalRecords = materialsModel.sections + let originalBatch = materialsModel.batch + XCTAssertGreaterThan(originalRecords.count, 1) + let deliveryModel = DroneDeliveryViewModel(store: store, orderID: order.id) + deliveryModel.applyScenario(.empty) + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let navigation = try XCTUnwrap(workbench.navigationController) + let homeList = try collection(in: workbench.view, identifier: "drone.workbench.list") + try await settle(window) { homeList.numberOfSections > 2 && homeList.numberOfItems(inSection: 2) == 1 } + homeList.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.home.\(order.id)") != nil } + let card = try XCTUnwrap(find(in: workbench.view, identifier: "drone.home.\(order.id)")) + let materialsEntry = try XCTUnwrap(allViews(in: card).compactMap { $0 as? UIButton }.first { + $0.accessibilityLabel?.hasPrefix("查看素材,") == true + }) + assertReachable(materialsEntry, in: window) + materialsEntry.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneMaterialsViewController && navigation.transitionCoordinator == nil } + let materials = try XCTUnwrap(navigation.topViewController as? DroneMaterialsViewController) + try await settle(window) { + guard let delivery = self.find(in: materials.view, identifier: "drone.materials.completedDelivery") else { return false } + return self.isReachable(delivery, in: window) + } + let delivery = try button(in: materials.view, identifier: "drone.materials.completedDelivery") + delivery.sendActions(for: .touchUpInside) + XCTAssertFalse(materials.presentedViewController is UIAlertController) + let upload = try await waitForUploadSheet(from: materials, window: window) + XCTAssertNotNil(find(in: upload.view, identifier: "drone.delivery.upload.method.cloud")) + XCTAssertNotNil(find(in: upload.view, identifier: "drone.delivery.upload.method.nearby")) + XCTAssertNil(upload.viewModel.selectedPointID) + XCTAssertNil(upload.viewModel.batch) + try await chooseCloud(in: upload, window: window) + XCTAssertNil(upload.viewModel.selectedPointID) + XCTAssertFalse(try button(in: upload.view, identifier: "drone.delivery.upload.openPicker").isEnabled) + let point = try XCTUnwrap(upload.viewModel.points.first) + let list = try collection(in: upload.view, identifier: "drone.delivery.upload.list") + try selectCell(in: list, identifier: "drone.delivery.upload.point.\(point.id)", window: window) + try await settle(window) { upload.viewModel.selectedPointID == point.id } + XCTAssertTrue(try button(in: upload.view, identifier: "drone.delivery.upload.openPicker").isEnabled) + materialsModel.refresh() + XCTAssertEqual(materialsModel.sections, originalRecords) + XCTAssertEqual(materialsModel.batch, originalBatch) + assertShootingUnchanged(order, current: store.shootingOrder(id: order.id)) + } + + /// 暂停、失败及完成批次重新进入均先选方式,两种云端入口只恢复队列不自动上传。 + func testExistingBatchRequiresMethodChoiceAndBothCloudPathsPreserveQueue() async throws { + let scenarios: [DroneDeliveryScenario] = [.paused, .partialFailure, .completed] + for scenario in scenarios { + for viaNearby in [false, true] { + let store = makeStore() + let orderID = try XCTUnwrap(store.orders.first?.id) + let viewModel = DroneDeliveryViewModel(store: store, orderID: orderID) + viewModel.applyScenario(.empty) + viewModel.applyScenario(scenario) + let originalBatch = try XCTUnwrap(viewModel.batch) + let firstItem = try XCTUnwrap(originalBatch.items.first) + let originalWorks = viewModel.works + let originalPhase = viewModel.uploadPhase + let presenter = UIViewController() + let window = makeWindow(root: presenter) + defer { close(window) } + let upload = try await presentUpload(viewModel, from: presenter, window: window) + XCTAssertNotNil(find(in: upload.view, identifier: "drone.delivery.upload.method.cloud")) + XCTAssertNotNil(find(in: upload.view, identifier: "drone.delivery.upload.method.nearby")) + XCTAssertFalse(visibleViews(in: upload.view).contains { $0.accessibilityIdentifier == "drone.delivery.upload.item.\(firstItem.id)" }) + XCTAssertEqual(viewModel.batch, originalBatch) + try await chooseCloud(in: upload, window: window, viaNearby: viaNearby) + try await Task.sleep(nanoseconds: 450_000_000) + window.layoutIfNeeded() + XCTAssertEqual(viewModel.batch, originalBatch, "\(scenario) / viaNearby=\(viaNearby)") + XCTAssertEqual(viewModel.selectedPointID, originalBatch.pointID) + XCTAssertEqual(viewModel.works, originalWorks) + XCTAssertEqual(viewModel.uploadPhase, originalPhase) + } + } + } + + /// 订单入口取消方式选择不续传,也不替换已有暂停批次的令牌或点位。 + func testOrdersCancelMethodChoicePreservesPausedBatch() async throws { + let store = makeStore() + let orderID = try XCTUnwrap(store.orders.first?.id) + let seed = DroneDeliveryViewModel(store: store, orderID: orderID) + seed.applyScenario(.empty) + seed.applyScenario(.paused) + let originalBatch = try XCTUnwrap(seed.batch) + let originalWorks = seed.works + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let orders = try await openOrders(from: workbench, window: window) + try button(in: orders.view, identifier: "drone.order.\(orderID).secondary").sendActions(for: .touchUpInside) + let upload = try await waitForUploadSheet(from: orders, window: window) + XCTAssertNotNil(find(in: upload.view, identifier: "drone.delivery.upload.method.cloud")) + XCTAssertEqual(upload.viewModel.batch, originalBatch) + let close = try button(in: upload.view, identifier: "drone.delivery.upload.close") + assertReachable(close, in: window) + close.sendActions(for: .touchUpInside) + try await settle(window) { orders.presentedViewController == nil } + XCTAssertEqual(seed.batch, originalBatch) + XCTAssertEqual(seed.works, originalWorks) + } + + /// 部分失败重试只执行失败项,成功作品保持身份且点位与选择持续锁定。 + func testPartialUploadRetryUsesDriverWithoutRepeatingSuccessfulWorks() async throws { + let store = makeStore() + let orderID = try XCTUnwrap(store.orders.first?.id) + let viewModel = DroneDeliveryViewModel(store: store, orderID: orderID) + viewModel.applyScenario(.empty) + viewModel.applyScenario(.partialFailure) + let completedItem = try XCTUnwrap(viewModel.batch?.items.first { $0.state.isCompleted }) + let successfulWorks = viewModel.works + let failedIDs = Set((viewModel.batch?.items ?? []).filter { $0.state.isFailed }.map(\.id)) + XCTAssertEqual(failedIDs.count, 1) + let presenter = UIViewController() + let window = makeWindow(root: presenter) + defer { close(window) } + let upload = try await presentUpload(viewModel, from: presenter, window: window) + try await chooseCloud(in: upload, window: window) + capture(window, root: upload.view, named: "交付流程-部分上传失败") + let retry = try button(in: upload.view, identifier: "drone.delivery.upload.retry") + assertReachable(retry, in: window) + retry.sendActions(for: .touchUpInside) + XCTAssertEqual(viewModel.uploadPhase, .uploading) + XCTAssertTrue(viewModel.isUploadLocked) + XCTAssertEqual(viewModel.batch?.items.first { $0.id == completedItem.id }, completedItem) + let runningIDs = Set((viewModel.batch?.items ?? []).filter { + if case .uploading = $0.state { return true }; return false + }.map(\.id)) + XCTAssertEqual(runningIDs, failedIDs) + let oldPoint = viewModel.selectedPointID + let oldSelection = viewModel.selectedVideoIDs + if let otherPoint = viewModel.points.first(where: { $0.id != oldPoint }) { viewModel.selectPoint(id: otherPoint.id) } + if let videoID = viewModel.availableVideos.first?.id { viewModel.toggleVideo(id: videoID) } + XCTAssertEqual(viewModel.selectedPointID, oldPoint) + XCTAssertEqual(viewModel.selectedVideoIDs, oldSelection) + XCTAssertFalse(viewModel.canStartUpload) + try await settle(window, timeout: 5) { viewModel.uploadPhase == .completed } + XCTAssertEqual(viewModel.batch?.items.first { $0.id == completedItem.id }, completedItem) + XCTAssertEqual(viewModel.works.filter { successfulWorks.map(\.id).contains($0.id) }, successfulWorks) + XCTAssertEqual(Set(viewModel.works.map(\.id)).count, viewModel.works.count) + XCTAssertEqual(viewModel.works.count, 2) + capture(window, root: upload.view, named: "交付流程-仅重试失败视频后成功") + } + + /// 后台暂停使旧令牌失效,回前台不自动恢复,手动继续保留成功项。 + func testBackgroundUploadRequiresManualContinueAndRejectsOldBatchReceipt() async throws { + let store = makeStore() + let orderID = try XCTUnwrap(store.orders.first?.id) + let viewModel = DroneDeliveryViewModel(store: store, orderID: orderID) + viewModel.applyScenario(.empty) + viewModel.applyScenario(.paused) + let completedItem = try XCTUnwrap(viewModel.batch?.items.first { $0.state.isCompleted }) + let successfulWorks = viewModel.works + let presenter = UIViewController() + let window = makeWindow(root: presenter) + defer { close(window) } + let upload = try await presentUpload(viewModel, from: presenter, window: window) + try await chooseCloud(in: upload, window: window) + capture(window, root: upload.view, named: "交付流程-暂停待手动继续") + let continueButton = try button(in: upload.view, identifier: "drone.delivery.upload.continue") + assertReachable(continueButton, in: window) + continueButton.sendActions(for: .touchUpInside) + let oldBatch = try XCTUnwrap(viewModel.batch) + let pendingID = try XCTUnwrap(oldBatch.items.first { !$0.state.isCompleted }?.id) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + let pausedBatch = try XCTUnwrap(viewModel.batch) + XCTAssertEqual(viewModel.uploadPhase, .paused) + XCTAssertTrue(pausedBatch.isPaused) + XCTAssertEqual(pausedBatch.pauseReason, .background) + XCTAssertNotEqual(pausedBatch.id, oldBatch.id) + viewModel.receiveUpload(.succeeded, itemID: pendingID, batchID: oldBatch.id) + XCTAssertEqual(viewModel.batch, pausedBatch) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 450_000_000) + window.layoutIfNeeded() + XCTAssertEqual(viewModel.batch, pausedBatch) + XCTAssertEqual(viewModel.works, successfulWorks) + XCTAssertEqual(viewModel.uploadPhase, .paused) + capture(window, root: upload.view, named: "交付流程-回前台仍暂停") + let resume = try button(in: upload.view, identifier: "drone.delivery.upload.continue") + assertReachable(resume, in: window) + resume.sendActions(for: .touchUpInside) + XCTAssertNotEqual(viewModel.batch?.id, pausedBatch.id) + XCTAssertEqual(viewModel.batch?.items.first { $0.id == completedItem.id }, completedItem) + try await settle(window, timeout: 5) { viewModel.uploadPhase == .completed } + XCTAssertEqual(viewModel.batch?.items.first { $0.id == completedItem.id }, completedItem) + XCTAssertEqual(viewModel.works.count, 2) + } + + /// 实际订单确认入口独立于上传,核对勾选后才展示码,刷新不替代游客确认回执。 + func testOrderConfirmationRouteRequiresReviewAndExplicitReceipt() async throws { + let store = makeStore() + let orderID = try XCTUnwrap(store.orders.first?.id) + let seed = DroneDeliveryViewModel(store: store, orderID: orderID) + seed.applyScenario(.empty) + seed.applyScenario(.completed) + let originalOrder = try XCTUnwrap(store.shootingOrder(id: orderID)) + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let orders = try await openOrders(from: workbench, window: window) + let confirmation = try control(in: orders.view, identifier: "drone.order.\(orderID).confirmation") + assertReachable(confirmation, in: window) + confirmation.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(orders.navigationController) + try await settle(window) { navigation.topViewController is DroneDeliveryReviewViewController && navigation.transitionCoordinator == nil } + let review = try XCTUnwrap(navigation.topViewController as? DroneDeliveryReviewViewController) + let viewModel = review.viewModel + try await settle(window) { self.find(in: review.view, identifier: "drone.delivery.review.showCode") != nil } + let showCode = try button(in: review.view, identifier: "drone.delivery.review.showCode") + XCTAssertFalse(showCode.isEnabled) + XCTAssertFalse(viewModel.isAllDeliveredReviewed) + XCTAssertNil(viewModel.confirmationSession) + capture(window, root: review.view, named: "交付流程-整单交付核对门槛") + let acknowledgement = try button(in: review.view, identifier: "drone.delivery.review.acknowledge") + assertReachable(acknowledgement, in: window) + acknowledgement.sendActions(for: .touchUpInside) + try await settle(window) { viewModel.canCreateConfirmation && showCode.isEnabled } + assertReachable(showCode, in: window) + showCode.sendActions(for: .touchUpInside) + try await settle(window) { self.find(in: review.view, identifier: "drone.delivery.confirmation.code") != nil } + let session = try XCTUnwrap(viewModel.confirmationSession) + XCTAssertEqual(viewModel.confirmationPhase, .awaitingConfirmation) + XCTAssertFalse(session.visitorAcknowledged) + let refresh = try button(in: review.view, identifier: "drone.delivery.confirmation.refresh") + assertReachable(refresh, in: window) + refresh.sendActions(for: .touchUpInside) + try await settle(window) { viewModel.confirmationPhase == .awaitingConfirmation } + XCTAssertEqual(viewModel.confirmationSession?.id, session.id) + XCTAssertNil(viewModel.latestReceipt) + capture(window, root: review.view, named: "交付流程-演示确认码刷新不确认") + viewModel.receiveConfirmation(.viewing, sessionID: session.id) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + review.refreshDeliveryState() + try await settle(window) { self.find(in: review.view, identifier: "drone.delivery.confirmation.receipt") != nil } + let receipt = try XCTUnwrap(viewModel.latestReceipt) + XCTAssertEqual(receipt.id, session.id) + XCTAssertEqual(receipt.works, session.works) + XCTAssertNotNil(receipt.confirmedAt) + XCTAssertTrue(receipt.visitorAcknowledged) + XCTAssertEqual(viewModel.confirmationPhase, .confirmed) + XCTAssertEqual(store.shootingOrder(id: orderID)?.visitorConfirmationState, .confirmed) + assertShootingUnchanged(originalOrder, current: store.shootingOrder(id: orderID)) + capture(window, root: review.view, named: "交付流程-明确回执后的冻结确认记录") + } + + private func makeStore() -> DroneDockDemoStore { + let demo = DroneDockDemoStore() + return DroneDockDemoStore(context: .demo, orders: [demo.orders[0]], devices: Array(demo.devices.prefix(1))) + } + + /// 从工作台真实“查看全部”按钮进入订单列表,保留真实导航协调器。 + private func openOrders(from workbench: DroneDockWorkbenchViewController, window: UIWindow) async throws -> DroneShootingOrdersViewController { + let navigation = try XCTUnwrap(workbench.navigationController) + let homeList = try collection(in: workbench.view, identifier: "drone.workbench.list") + try await settle(window) { homeList.numberOfSections > 2 && homeList.numberOfItems(inSection: 2) > 0 } + homeList.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.workbench.allOrders") != nil } + let allOrders = try button(in: workbench.view, identifier: "drone.workbench.allOrders") + assertReachable(allOrders, in: window) + allOrders.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneShootingOrdersViewController && navigation.transitionCoordinator == nil } + let orders = try XCTUnwrap(navigation.topViewController as? DroneShootingOrdersViewController) + let list = try collection(in: orders.view, identifier: "drone.orders.list") + try await settle(window) { list.numberOfSections == 1 && list.numberOfItems(inSection: 0) == 1 } + list.scrollToItem(at: IndexPath(item: 0, section: 0), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: orders.view, identifier: "drone.order.\(workbench.viewModel.store.orders[0].id).secondary") != nil } + return orders + } + + private func waitForUploadSheet(from presenter: UIViewController, window: UIWindow) async throws -> DroneDeliveryUploadViewController { + try await settle(window) { + guard let navigation = presenter.presentedViewController as? UINavigationController, + let upload = navigation.viewControllers.first as? DroneDeliveryUploadViewController else { return false } + return upload.isViewLoaded && upload.view.window != nil && navigation.transitionCoordinator == nil && !navigation.isBeingPresented + } + let navigation = try XCTUnwrap(presenter.presentedViewController as? UINavigationController) + let upload = try XCTUnwrap(navigation.viewControllers.first as? DroneDeliveryUploadViewController) + let list = try collection(in: upload.view, identifier: "drone.delivery.upload.list") + try await settle(window) { list.numberOfSections > 0 && list.numberOfItems(inSection: 0) > 0 } + XCTAssertTrue(navigation.isNavigationBarHidden) + XCTAssertEqual(navigation.modalPresentationStyle, .pageSheet) + return upload + } + + private func presentUpload(_ viewModel: DroneDeliveryViewModel, from presenter: UIViewController, window: UIWindow) async throws -> DroneDeliveryUploadViewController { + let upload = DroneDeliveryUploadViewController(viewModel: viewModel) + let navigation = UINavigationController(rootViewController: upload) + navigation.setNavigationBarHidden(true, animated: false) + navigation.modalPresentationStyle = .pageSheet + navigation.sheetPresentationController?.detents = [.medium(), .large()] + navigation.sheetPresentationController?.prefersGrabberVisible = true + navigation.sheetPresentationController?.preferredCornerRadius = 24 + presenter.present(navigation, animated: false) + return try await waitForUploadSheet(from: presenter, window: window) + } + + /// 经直接云端或闪传页切换进入云端,等待选点或原批次操作按钮可用。 + private func chooseCloud(in upload: DroneDeliveryUploadViewController, window: UIWindow, viaNearby: Bool = false) async throws { + let list = try collection(in: upload.view, identifier: "drone.delivery.upload.list") + if viaNearby { + try selectCell(in: list, identifier: "drone.delivery.upload.method.nearby", window: window) + try await settle(window) { upload.navigationController?.topViewController is DroneDockNearbyTransferViewController } + upload.navigationController?.popViewController(animated: false) + try await settle(window) { upload.navigationController?.topViewController === upload } + } + try selectCell(in: list, identifier: "drone.delivery.upload.method.cloud", window: window) + let identifier: String + if upload.viewModel.batch == nil { + identifier = "drone.delivery.upload.openPicker" + } else { + switch upload.viewModel.uploadPhase { + case .paused: identifier = "drone.delivery.upload.continue" + case .partialFailure: identifier = "drone.delivery.upload.retry" + case .completed, .idle: identifier = "drone.delivery.upload.pickMore" + case .uploading: identifier = "drone.delivery.upload.start" + } + } + try await settle(window) { + self.visibleViews(in: upload.view).contains { $0.accessibilityIdentifier == identifier } + } + } + + /// 全屏预览登记为 presented 后仍可能在淡入,须等转场结束且关闭按钮实际可命中。 + private func waitForReadyPreview(from presenter: UIViewController, window: UIWindow) async throws -> DroneMaterialPreviewViewController { + try await settle(window, timeout: 5, stabilization: 0.05) { + guard let preview = presenter.presentedViewController as? DroneMaterialPreviewViewController, + preview.isViewLoaded, !preview.isBeingPresented, preview.transitionCoordinator == nil, + let close = self.find(in: preview.view, identifier: "drone.material.preview.close") else { return false } + return self.isReachable(close, in: window) + } + return try XCTUnwrap(presenter.presentedViewController as? DroneMaterialPreviewViewController) + } + + /// 对真实列表身份执行代理选择;先验证该可见整卡中心可以通过窗口命中。 + private func selectCell(in list: UICollectionView, identifier: String, window: UIWindow) throws { + let cell = try XCTUnwrap(allViews(in: list).compactMap { $0 as? UICollectionViewCell }.first { $0.accessibilityIdentifier == identifier }) + assertReachable(cell, in: window) + let path = try XCTUnwrap(list.indexPath(for: cell)) + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + + private func makeWindow(root controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待明确快照或驱动结果;短轮询不替代对状态及实际回执的断言。 + private func settle(_ window: UIWindow, timeout: TimeInterval = 4, stabilization: TimeInterval = 0.3, until condition: () -> Bool) async throws { + let deadline = Date().addingTimeInterval(timeout) + while Date() < deadline { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: UInt64(stabilization * 1_000_000_000)) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("交付流程未在预期时间内完成导航、快照或演示回执") + throw NSError(domain: "DroneDeliveryFlowViewTests", code: 1) + } + + private func allViews(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews(in: $0) } } + + private func find(in root: UIView, identifier: String) -> UIView? { + allViews(in: root).first { $0.accessibilityIdentifier == identifier } + } + + private func button(in root: UIView, identifier: String) throws -> UIButton { + try XCTUnwrap(find(in: root, identifier: identifier) as? UIButton, "缺少按钮 \(identifier)") + } + + private func control(in root: UIView, identifier: String) throws -> UIControl { + try XCTUnwrap(find(in: root, identifier: identifier) as? UIControl, "缺少控件 \(identifier)") + } + + private func collection(in root: UIView, identifier: String) throws -> UICollectionView { + try XCTUnwrap(find(in: root, identifier: identifier) as? UICollectionView, "缺少列表 \(identifier)") + } + + private func isHiddenByAncestor(_ view: UIView) -> Bool { + if view.isHidden || view.alpha < 0.01 { return true } + return view.superview.map { isHiddenByAncestor($0) } ?? false + } + + private func visibleViews(in root: UIView) -> [UIView] { + allViews(in: root).filter { + !isHiddenByAncestor($0) && !$0.bounds.isEmpty && $0.convert($0.bounds, to: root).intersects(root.bounds) + } + } + + /// 截图前确认业务视图已附着窗口,且所有可见约束视图没有布局歧义。 + private func assertVisibleLayout(in root: UIView, window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + window.layoutIfNeeded() + root.layoutIfNeeded() + XCTAssertTrue(root.window === window, "预期页面未附着测试窗口", file: file, line: line) + XCTAssertFalse(isHiddenByAncestor(root), "预期页面不可见", file: file, line: line) + let ambiguous = visibleViews(in: root).filter { + !$0.translatesAutoresizingMaskIntoConstraints && !String(describing: type(of: $0)).hasPrefix("_") && $0.hasAmbiguousLayout + } + XCTAssertTrue(ambiguous.isEmpty, "可见布局歧义:\(ambiguous.map { String(describing: type(of: $0)) + " " + ($0.accessibilityIdentifier ?? "") })", file: file, line: line) + } + + /// 在发送动作前检查实际窗口命中,避免约束存在但按钮被覆盖或移出屏幕。 + private func assertReachable(_ view: UIView, in window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + window.layoutIfNeeded() + view.layoutIfNeeded() + XCTAssertFalse(isHiddenByAncestor(view), "控件被隐藏:\(view.accessibilityIdentifier ?? "")", file: file, line: line) + XCTAssertFalse(view.bounds.isEmpty, "控件没有点击区域", file: file, line: line) + let point = view.convert(CGPoint(x: view.bounds.midX, y: view.bounds.midY), to: window) + XCTAssertTrue(window.bounds.contains(point), "控件中心超出窗口:\(view.accessibilityIdentifier ?? "")", file: file, line: line) + let hit = window.hitTest(point, with: nil) + XCTAssertTrue(hit === view || hit?.isDescendant(of: view) == true, + "控件无法由窗口命中:\(view.accessibilityIdentifier ?? ""),命中\(String(describing: hit))", file: file, line: line) + } + + /// 供等待条件轮询真实命中状态,不替代动作前保留的 assertReachable 断言。 + private func isReachable(_ view: UIView, in window: UIWindow) -> Bool { + guard view.window === window, !isHiddenByAncestor(view), !view.bounds.isEmpty else { return false } + view.layoutIfNeeded() + let point = view.convert(CGPoint(x: view.bounds.midX, y: view.bounds.midY), to: window) + guard window.bounds.contains(point) else { return false } + let hit = window.hitTest(point, with: nil) + return hit === view || hit?.isDescendant(of: view) == true + } + + private func assertShootingUnchanged(_ original: DroneShootingOrder, current: DroneShootingOrder?, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertEqual(current?.successfulShootingCount, original.successfulShootingCount, file: file, line: line) + XCTAssertEqual(current?.remainingShootingCount, original.remainingShootingCount, file: file, line: line) + XCTAssertEqual(current?.activeTask, original.activeTask, file: file, line: line) + XCTAssertEqual(current?.materialState, original.materialState, file: file, line: line) + XCTAssertEqual(current?.fulfillmentState, original.fulfillmentState, file: file, line: line) + } + + /// 关键状态保留在 xcresult,便于复核 Sheet、网格及确认记录的实际画面。 + private func capture(_ window: UIWindow, root: UIView, named name: String) { + assertVisibleLayout(in: root, window: window) + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} +#endif diff --git a/suixinkanTests/DroneDeliveryViewModelTests.swift b/suixinkanTests/DroneDeliveryViewModelTests.swift new file mode 100644 index 0000000..47b9a0c --- /dev/null +++ b/suixinkanTests/DroneDeliveryViewModelTests.swift @@ -0,0 +1,478 @@ +import XCTest +@testable import suixinkan + +/// 验证本地成片上传、整单核对和确认快照的隔离、去重与显式回执规则。 +final class DroneDeliveryViewModelTests: XCTestCase { + func testWholeOrderRequiresExplicitPointAndRecordEntryOnlyPrefillsValidPoint() throws { + let store = makeStore() + let wholeOrder = DroneDeliveryViewModel(store: store, orderID: "order-a") + XCTAssertNil(wholeOrder.selectedPointID) + XCTAssertTrue(wholeOrder.availableVideos.isEmpty) + XCTAssertFalse(wholeOrder.canStartUpload) + let point = try XCTUnwrap(wholeOrder.points.first) + let recordEntry = DroneDeliveryViewModel(store: store, orderID: "order-a", pointID: point.id) + XCTAssertEqual(recordEntry.selectedPoint?.id, point.id) + XCTAssertEqual(recordEntry.availableVideos.count, 4) + XCTAssertTrue(recordEntry.selectedVideoIDs.isEmpty) + let invalid = DroneDeliveryViewModel(store: store, orderID: "order-a", pointID: "removed-point") + XCTAssertNil(invalid.selectedPoint) + XCTAssertFalse(invalid.startUpload()) + } + + func testChangingPointClearsSelectionAndInvalidVideoCannotBeSelected() throws { + let viewModel = makeViewModel() + let first = viewModel.points[0] + let second = viewModel.points[1] + viewModel.selectPoint(id: first.id) + viewModel.toggleVideo(id: try XCTUnwrap(viewModel.availableVideos.first?.id)) + viewModel.toggleVideo(id: "foreign-source") + XCTAssertEqual(viewModel.selectedVideoCount, 1) + viewModel.selectPoint(id: second.id) + XCTAssertEqual(viewModel.selectedPointID, second.id) + XCTAssertEqual(viewModel.selectedVideoCount, 0) + viewModel.selectPoint(id: "removed-point") + XCTAssertEqual(viewModel.selectedPointID, second.id) + } + + func testQueueFreezesPointAndSelectionUntilExplicitlyCleared() throws { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 2) + XCTAssertTrue(viewModel.startUpload()) + let original = try XCTUnwrap(viewModel.batch) + let selection = viewModel.selectedVideoIDs + viewModel.selectPoint(id: viewModel.points[1].id) + viewModel.toggleVideo(id: original.items[0].video.id) + viewModel.clearUploadBatch() + viewModel.refresh() + XCTAssertEqual(viewModel.selectedPointID, original.pointID) + XCTAssertEqual(viewModel.selectedVideoIDs, selection) + XCTAssertEqual(viewModel.batch?.id, original.id) + XCTAssertFalse(viewModel.startUpload()) + for item in original.items { viewModel.receiveUpload(.succeeded, itemID: item.id, batchID: original.id) } + XCTAssertTrue(viewModel.isUploadLocked) + viewModel.clearUploadBatch() + XCTAssertFalse(viewModel.isUploadLocked) + XCTAssertEqual(viewModel.selectedPointID, original.pointID) + XCTAssertEqual(viewModel.selectedVideoCount, 0) + } + + func testSuccessIsExplicitDeduplicatedAndDoesNotChangeShootingOrOriginalMaterials() throws { + let store = makeStore() + let viewModel = DroneDeliveryViewModel(store: store, orderID: "order-a") + let before = try XCTUnwrap(viewModel.order) + let materials = DroneMaterialsViewModel(store: store, orderID: "order-a").sections + try selectVideos(viewModel, count: 1) + viewModel.startUpload() + let batch = try XCTUnwrap(viewModel.batch) + let item = batch.items[0] + viewModel.receiveUpload(.progress(1), itemID: item.id, batchID: batch.id) + XCTAssertTrue(viewModel.works.isEmpty) + viewModel.receiveUpload(.succeeded, itemID: item.id, batchID: batch.id) + viewModel.receiveUpload(.succeeded, itemID: item.id, batchID: batch.id) + viewModel.receiveUpload(.failed(message: "迟到失败"), itemID: item.id, batchID: batch.id) + XCTAssertEqual(viewModel.works.count, 1) + XCTAssertEqual(viewModel.uploadedCount, 1) + XCTAssertEqual(viewModel.works.first?.isSimulation, true) + XCTAssertEqual(viewModel.order?.deliveredVideoCount, 1) + XCTAssertEqual(viewModel.order?.successfulShootingCount, before.successfulShootingCount) + XCTAssertEqual(viewModel.order?.remainingShootingCount, before.remainingShootingCount) + XCTAssertEqual(viewModel.order?.activeTask, before.activeTask) + XCTAssertEqual(viewModel.order?.materialState, before.materialState) + XCTAssertEqual(viewModel.order?.fulfillmentState, before.fulfillmentState) + XCTAssertEqual(DroneMaterialsViewModel(store: store, orderID: "order-a").sections, materials) + XCTAssertEqual(viewModel.confirmationPhase, .review) + XCTAssertFalse(viewModel.isAllDeliveredReviewed) + } + + func testProgressDoesNotRegressAndInvalidOrForeignCallbacksAreIgnored() throws { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 1) + viewModel.startUpload() + let batch = try XCTUnwrap(viewModel.batch) + let itemID = batch.items[0].id + viewModel.receiveUpload(.progress(0.6), itemID: itemID, batchID: batch.id) + viewModel.receiveUpload(.progress(0.2), itemID: itemID, batchID: batch.id) + viewModel.receiveUpload(.progress(.nan), itemID: itemID, batchID: batch.id) + viewModel.receiveUpload(.succeeded, itemID: "foreign-item", batchID: batch.id) + viewModel.receiveUpload(.succeeded, itemID: itemID, batchID: UUID()) + XCTAssertEqual(viewModel.batch?.items[0].state, .uploading(progress: 0.6)) + XCTAssertTrue(viewModel.works.isEmpty) + viewModel.receiveUpload(.progress(3), itemID: itemID, batchID: batch.id) + XCTAssertEqual(viewModel.batch?.items[0].state, .uploading(progress: 1)) + XCTAssertEqual(viewModel.uploadProgress, 0) + } + + func testPartialFailureRetriesOnlyFailedItemsAndNeverReuploadsSuccess() throws { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 2) + viewModel.startUpload() + let original = try XCTUnwrap(viewModel.batch) + viewModel.receiveUpload(.succeeded, itemID: original.items[0].id, batchID: original.id) + viewModel.receiveUpload(.failed(message: "演示连接中断"), itemID: original.items[1].id, batchID: original.id) + let deliveredWork = try XCTUnwrap(viewModel.works.first) + XCTAssertEqual(viewModel.uploadPhase, .partialFailure) + XCTAssertEqual(viewModel.failedCount, 1) + XCTAssertFalse(viewModel.continueUpload()) + XCTAssertTrue(viewModel.retryFailedUploads()) + let retried = try XCTUnwrap(viewModel.batch) + XCTAssertNotEqual(retried.id, original.id) + XCTAssertEqual(retried.items[0].state, .completed) + XCTAssertEqual(retried.items[1].state, .uploading(progress: 0)) + viewModel.receiveUpload(.succeeded, itemID: original.items[1].id, batchID: original.id) + XCTAssertEqual(viewModel.works, [deliveredWork]) + viewModel.receiveUpload(.succeeded, itemID: retried.items[1].id, batchID: retried.id) + XCTAssertEqual(viewModel.works.count, 2) + XCTAssertEqual(viewModel.works.first, deliveredWork) + XCTAssertEqual(viewModel.uploadProgress, 1) + } + + func testBackgroundLockAndLeavePauseWithoutAutoResumeAndDiscardOldReceipts() throws { + for reason in [DroneDeliveryPauseReason.background, .locked, .leavingPage] { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 2) + viewModel.startUpload() + let original = try XCTUnwrap(viewModel.batch) + viewModel.receiveUpload(.succeeded, itemID: original.items[0].id, batchID: original.id) + viewModel.receiveUpload(.progress(0.8), itemID: original.items[1].id, batchID: original.id) + viewModel.pauseUpload(reason: reason) + let paused = try XCTUnwrap(viewModel.batch) + XCTAssertNotEqual(paused.id, original.id) + XCTAssertEqual(paused.pauseReason, reason) + XCTAssertEqual(paused.items[0].state, .completed) + XCTAssertEqual(paused.items[1].state, .paused) + viewModel.receiveUpload(.succeeded, itemID: original.items[1].id, batchID: original.id) + viewModel.refresh() + XCTAssertEqual(viewModel.uploadPhase, .paused) + XCTAssertEqual(viewModel.works.count, 1) + XCTAssertTrue(viewModel.continueUpload()) + let resumed = try XCTUnwrap(viewModel.batch) + XCTAssertNotEqual(resumed.id, paused.id) + XCTAssertEqual(resumed.items[1].state, .uploading(progress: 0)) + XCTAssertEqual(resumed.items[0].state, .completed) + viewModel.receiveUpload(.succeeded, itemID: resumed.items[1].id, batchID: resumed.id) + XCTAssertEqual(viewModel.works.count, 2) + } + } + + func testContinueDoesNotRetryFailedItemsAndRetryWaitsForUnfinishedItems() throws { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 2) + viewModel.startUpload() + let original = try XCTUnwrap(viewModel.batch) + viewModel.receiveUpload(.failed(message: "演示失败"), itemID: original.items[0].id, batchID: original.id) + viewModel.pauseUpload(reason: .background) + XCTAssertFalse(viewModel.retryFailedUploads()) + XCTAssertTrue(viewModel.continueUpload()) + let resumed = try XCTUnwrap(viewModel.batch) + XCTAssertEqual(resumed.items[0].state, .failed(message: "演示失败")) + viewModel.receiveUpload(.succeeded, itemID: resumed.items[1].id, batchID: resumed.id) + XCTAssertTrue(viewModel.retryFailedUploads()) + XCTAssertEqual(viewModel.batch?.items[1].state, .completed) + } + + func testAdditionalBatchesAppendAcrossPointsAndExcludePreviouslyUploadedSourceAtSamePoint() throws { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 2) + let pointID = try XCTUnwrap(viewModel.selectedPointID) + let sources = viewModel.selectedVideoIDs + try completeBatch(viewModel) + let firstWorks = viewModel.works + viewModel.clearUploadBatch() + XCTAssertEqual(viewModel.selectedPointID, pointID) + XCTAssertEqual(viewModel.availableVideos.count, 2) + XCTAssertTrue(sources.isDisjoint(with: Set(viewModel.availableVideos.map(\.id)))) + viewModel.selectPoint(id: viewModel.points[1].id) + XCTAssertEqual(viewModel.availableVideos.count, 4) + viewModel.toggleVideo(id: try XCTUnwrap(viewModel.availableVideos.first?.id)) + try completeBatch(viewModel) + XCTAssertEqual(viewModel.works.count, 3) + XCTAssertEqual(Array(viewModel.works.prefix(2)), firstWorks) + XCTAssertEqual(viewModel.workGroups.map { $0.works.count }, [2, 1]) + XCTAssertEqual(viewModel.order?.deliveredVideoCount, 3) + } + + func testNoWorksUncheckedOrUnfinishedQueueCannotCreateConfirmation() throws { + let viewModel = makeViewModel() + viewModel.setAllDeliveredReviewed(true) + XCTAssertFalse(viewModel.isAllDeliveredReviewed) + XCTAssertFalse(viewModel.createConfirmationSession()) + try selectVideos(viewModel, count: 2) + viewModel.startUpload() + let batch = try XCTUnwrap(viewModel.batch) + viewModel.receiveUpload(.succeeded, itemID: batch.items[0].id, batchID: batch.id) + viewModel.setAllDeliveredReviewed(true) + XCTAssertFalse(viewModel.canCreateConfirmation) + viewModel.receiveUpload(.failed(message: "未交付"), itemID: batch.items[1].id, batchID: batch.id) + viewModel.setAllDeliveredReviewed(true) + XCTAssertFalse(viewModel.canCreateConfirmation) + viewModel.clearUploadBatch() + XCTAssertFalse(viewModel.createConfirmationSession()) + viewModel.setAllDeliveredReviewed(true) + XCTAssertTrue(viewModel.canCreateConfirmation) + XCTAssertTrue(viewModel.createConfirmationSession()) + } + + func testCreatingConfirmationFreezesWholeOrderAndRefreshNeverViewsOrConfirms() throws { + let viewModel = makeViewModel() + try selectVideos(viewModel, count: 2) + try completeBatch(viewModel) + viewModel.clearUploadBatch() + viewModel.setAllDeliveredReviewed(true) + XCTAssertTrue(viewModel.createConfirmationSession()) + let session = try XCTUnwrap(viewModel.confirmationSession) + XCTAssertEqual(session.works, viewModel.works) + XCTAssertEqual(session.orderID, "order-a") + XCTAssertEqual(session.visitorName, "游客136****2806") + XCTAssertEqual(session.operatorName, context.photographerName) + XCTAssertEqual(viewModel.confirmationPhase, .awaitingConfirmation) + XCTAssertTrue(viewModel.createConfirmationSession()) + for _ in 0..<3 { viewModel.refreshConfirmation() } + XCTAssertEqual(viewModel.confirmationSession?.id, session.id) + XCTAssertNil(viewModel.confirmationSession?.confirmedAt) + XCTAssertTrue(viewModel.confirmationRecords.isEmpty) + XCTAssertEqual(viewModel.order?.visitorConfirmationState, .awaitingConfirmation) + } + + func testExistingDeliverySummariesSeedCorrespondingWorksAndConfirmationSnapshotOnce() throws { + let awaitingStore = makeStore(delivered: 2, confirmation: .awaitingConfirmation) + let awaiting = DroneDeliveryViewModel(store: awaitingStore, orderID: "order-a") + XCTAssertEqual(awaiting.works.count, 2) + XCTAssertEqual(awaiting.confirmationSession?.works.count, 2) + XCTAssertEqual(awaiting.confirmationPhase, .awaitingConfirmation) + XCTAssertNil(awaiting.selectedPointID) + XCTAssertNil(awaiting.latestReceipt) + let confirmed = DroneDeliveryViewModel(store: makeStore(delivered: 3, confirmation: .confirmed), orderID: "order-a") + let receipt = try XCTUnwrap(confirmed.latestReceipt) + XCTAssertEqual(receipt.works.count, 3) + XCTAssertEqual(confirmed.receiptGroups.map { $0.works.count }, [2, 1]) + XCTAssertEqual(confirmed.confirmationPhase, .confirmed) + confirmed.refresh() + XCTAssertEqual(confirmed.latestReceipt?.id, receipt.id) + XCTAssertEqual(confirmed.confirmationRecords.count, 1) + } + + func testOrdersContextsAndOldUploadTokensCannotCrossContaminate() throws { + let store = makeStore(includeSecondOrder: true) + let first = DroneDeliveryViewModel(store: store, orderID: "order-a") + let second = DroneDeliveryViewModel(store: store, orderID: "order-b") + try selectVideos(first, count: 1) + try selectVideos(second, count: 1) + first.startUpload() + second.startUpload() + let firstBatch = try XCTUnwrap(first.batch) + let secondBatch = try XCTUnwrap(second.batch) + second.receiveUpload(.succeeded, itemID: secondBatch.items[0].id, batchID: firstBatch.id) + XCTAssertTrue(second.works.isEmpty) + store.switchContext(to: DroneDockContext(scenicID: "other", scenicName: "另一景区", userID: "user", photographerName: "工作人员")) + first.receiveUpload(.succeeded, itemID: firstBatch.items[0].id, batchID: firstBatch.id) + first.refresh() + XCTAssertNil(first.order) + XCTAssertTrue(first.works.isEmpty) + store.switchContext(to: context) + first.refresh() + XCTAssertEqual(first.uploadPhase, .paused) + XCTAssertTrue(first.works.isEmpty) + XCTAssertEqual(second.batch?.id, secondBatch.id) + } + + #if DEBUG + func testVisitorConfirmationRequiresViewingAndExplicitAcknowledgmentAndIsIdempotent() throws { + let viewModel = makeViewModel() + let session = try awaitingSession(viewModel) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + XCTAssertEqual(viewModel.confirmationPhase, .awaitingConfirmation) + viewModel.receiveConfirmation(.viewing, sessionID: session.id) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + XCTAssertEqual(viewModel.confirmationPhase, .viewing) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + let receipt = try XCTUnwrap(viewModel.latestReceipt) + XCTAssertEqual(receipt.works, session.works) + XCTAssertNotNil(receipt.confirmedAt) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + viewModel.receiveConfirmation(.feedback(kind: .missingVideo, note: "迟到反馈"), sessionID: session.id) + viewModel.refreshConfirmation() + XCTAssertEqual(viewModel.confirmationRecords, [receipt]) + XCTAssertEqual(viewModel.order?.visitorConfirmationState, .confirmed) + } + + func testFeedbackDoesNotConfirmAndNewReviewInvalidatesPriorSession() throws { + let viewModel = makeViewModel() + let original = try awaitingSession(viewModel) + viewModel.receiveConfirmation(.viewing, sessionID: original.id) + viewModel.receiveConfirmation(.feedback(kind: .other, note: " "), sessionID: original.id) + XCTAssertEqual(viewModel.confirmationPhase, .viewing) + viewModel.receiveConfirmation(.feedback(kind: .unplayable, note: " 演示无法播放 "), sessionID: original.id) + XCTAssertEqual(viewModel.confirmationPhase, .feedback) + XCTAssertEqual(viewModel.confirmationSession?.feedback?.note, "演示无法播放") + XCTAssertTrue(viewModel.confirmationRecords.isEmpty) + XCTAssertNil(viewModel.confirmationSession?.confirmedAt) + viewModel.beginNewReview() + XCTAssertEqual(viewModel.confirmationPhase, .review) + XCTAssertFalse(viewModel.isAllDeliveredReviewed) + viewModel.setAllDeliveredReviewed(true) + viewModel.createConfirmationSession() + let replacement = try XCTUnwrap(viewModel.confirmationSession) + XCTAssertNotEqual(replacement.id, original.id) + viewModel.receiveConfirmation(.viewing, sessionID: original.id) + viewModel.receiveConfirmation(.confirmed, sessionID: original.id) + XCTAssertEqual(viewModel.confirmationPhase, .awaitingConfirmation) + XCTAssertEqual(replacement.works, original.works) + } + + func testAppendingWorksPreservesOldReceiptAndRequiresNewWholeOrderReview() throws { + let fixedDate = Date(timeIntervalSince1970: 1_700_000_000) + let viewModel = DroneDeliveryViewModel(store: makeStore(), orderID: "order-a", now: { fixedDate }) + let original = try awaitingSession(viewModel) + viewModel.receiveConfirmation(.viewing, sessionID: original.id) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: original.id) + let receipt = try XCTUnwrap(viewModel.latestReceipt) + let originalWorks = receipt.works + viewModel.selectPoint(id: viewModel.points[1].id) + viewModel.toggleVideo(id: try XCTUnwrap(viewModel.availableVideos.first?.id)) + try completeBatch(viewModel) + viewModel.clearUploadBatch() + XCTAssertEqual(viewModel.works.count, originalWorks.count + 1) + XCTAssertEqual(viewModel.latestReceipt, receipt) + XCTAssertEqual(viewModel.latestReceipt?.works, originalWorks) + XCTAssertEqual(viewModel.confirmationPhase, .review) + XCTAssertEqual(viewModel.order?.visitorConfirmationState, .awaitingConfirmation) + XCTAssertFalse(viewModel.isAllDeliveredReviewed) + viewModel.receiveConfirmation(.confirmed, sessionID: original.id) + XCTAssertEqual(viewModel.confirmationPhase, .review) + viewModel.setAllDeliveredReviewed(true) + XCTAssertTrue(viewModel.createConfirmationSession()) + let newSession = try XCTUnwrap(viewModel.confirmationSession) + XCTAssertNotEqual(newSession.id, original.id) + XCTAssertGreaterThan(newSession.revision, original.revision) + XCTAssertEqual(newSession.works.count, originalWorks.count + 1) + XCTAssertEqual(viewModel.confirmationRecords, [receipt]) + viewModel.receiveConfirmation(.viewing, sessionID: newSession.id) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: newSession.id) + XCTAssertEqual(viewModel.confirmationRecords.count, 2) + XCTAssertEqual(viewModel.latestReceipt?.id, newSession.id) + XCTAssertEqual(viewModel.confirmationRecords.last, receipt) + } + + func testNewSuccessInvalidatesMerchantCheckAndPendingOldConfirmationBeforeReceipt() throws { + let viewModel = makeViewModel() + let original = try awaitingSession(viewModel) + viewModel.selectPoint(id: viewModel.points[1].id) + viewModel.toggleVideo(id: try XCTUnwrap(viewModel.availableVideos.first?.id)) + viewModel.startUpload() + XCTAssertFalse(viewModel.canCreateConfirmation) + let batch = try XCTUnwrap(viewModel.batch) + viewModel.receiveUpload(.succeeded, itemID: batch.items[0].id, batchID: batch.id) + XCTAssertNil(viewModel.confirmationSession) + XCTAssertFalse(viewModel.isAllDeliveredReviewed) + viewModel.receiveConfirmation(.viewing, sessionID: original.id) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: original.id) + XCTAssertTrue(viewModel.confirmationRecords.isEmpty) + } + + func testConfirmationMetadataUsesFrozenVisitorOperatorOrderAndExplicitTime() throws { + let store = makeStore() + let fixedDate = Date(timeIntervalSince1970: 1_700_000_000) + let viewModel = DroneDeliveryViewModel(store: store, orderID: "order-a", now: { fixedDate }) + let session = try awaitingSession(viewModel) + store.replaceShootingOrder(order(customerName: "更改后的游客")) + viewModel.refreshConfirmation() + viewModel.receiveConfirmation(.viewing, sessionID: session.id) + viewModel.setVisitorAcknowledged(true) + viewModel.receiveConfirmation(.confirmed, sessionID: session.id) + let receipt = try XCTUnwrap(viewModel.latestReceipt) + XCTAssertEqual(receipt.visitorName, "游客136****2806") + XCTAssertEqual(receipt.operatorName, context.photographerName) + XCTAssertEqual(receipt.orderNumber, "TEST-order-a") + XCTAssertEqual(receipt.createdAt, fixedDate) + XCTAssertEqual(receipt.confirmedAt, fixedDate) + } + + func testForeignConfirmationSessionAndContextCannotConfirmOrder() throws { + let store = makeStore(includeSecondOrder: true) + let first = DroneDeliveryViewModel(store: store, orderID: "order-a") + let second = DroneDeliveryViewModel(store: store, orderID: "order-b") + let firstSession = try awaitingSession(first) + let secondSession = try awaitingSession(second) + second.receiveConfirmation(.viewing, sessionID: firstSession.id) + XCTAssertEqual(second.confirmationPhase, .awaitingConfirmation) + store.switchContext(to: DroneDockContext(scenicID: "other", scenicName: "另一景区", userID: "user", photographerName: "工作人员")) + first.receiveConfirmation(.viewing, sessionID: firstSession.id) + first.setVisitorAcknowledged(true) + first.receiveConfirmation(.confirmed, sessionID: firstSession.id) + store.switchContext(to: context) + XCTAssertEqual(first.confirmationPhase, .awaitingConfirmation) + XCTAssertEqual(second.confirmationSession?.id, secondSession.id) + XCTAssertTrue(first.confirmationRecords.isEmpty) + } + + func testExplicitScenariosPreserveShootingOrderAndCanRepresentFeedbackAndConfirmedSnapshot() throws { + let viewModel = makeViewModel() + let original = try XCTUnwrap(viewModel.order) + viewModel.applyScenario(.partialFailure) + XCTAssertEqual(viewModel.uploadedCount, 1) + XCTAssertEqual(viewModel.failedCount, 1) + viewModel.applyScenario(.viewing) + XCTAssertEqual(viewModel.confirmationPhase, .viewing) + viewModel.applyScenario(.feedback) + XCTAssertEqual(viewModel.confirmationPhase, .feedback) + viewModel.applyScenario(.confirmed) + XCTAssertEqual(viewModel.confirmationPhase, .confirmed) + XCTAssertEqual(viewModel.latestReceipt?.works, viewModel.works) + XCTAssertEqual(viewModel.order?.successfulShootingCount, original.successfulShootingCount) + XCTAssertEqual(viewModel.order?.activeTask, original.activeTask) + XCTAssertEqual(viewModel.order?.materialState, original.materialState) + viewModel.store.applyScenario(.standard) + XCTAssertTrue(viewModel.store.deliveryLibraries.isEmpty) + } + #endif + + private var context: DroneDockContext { + DroneDockContext(scenicID: "scenic", scenicName: "测试景区", userID: "user", photographerName: "测试工作人员") + } + + private func order(id: String = "order-a", delivered: Int = 0, + confirmation: DroneVisitorConfirmationState = .none, + customerName: String = "游客136****2806") -> DroneShootingOrder { + DroneShootingOrder(id: id, scenicID: context.scenicID, assignedUserID: context.userID, + customerName: customerName, orderNumber: "TEST-\(id)", createdAtText: "10-23 09:00", packageName: "航拍套餐", + totalShootingCount: 5, successfulShootingCount: 2, + activeTask: DroneShootingTask(id: "\(id)-task", phase: .returning, shootingResult: .succeeded), + needsRepreparation: false, materialState: .partiallyReady, + deliveredVideoCount: delivered, visitorConfirmationState: confirmation) + } + + private func makeStore(delivered: Int = 0, confirmation: DroneVisitorConfirmationState = .none, + includeSecondOrder: Bool = false) -> DroneDockDemoStore { + var orders = [order(delivered: delivered, confirmation: confirmation)] + if includeSecondOrder { orders.append(order(id: "order-b")) } + return DroneDockDemoStore(context: context, orders: orders, devices: []) + } + + private func makeViewModel() -> DroneDeliveryViewModel { + DroneDeliveryViewModel(store: makeStore(), orderID: "order-a") + } + + private func selectVideos(_ viewModel: DroneDeliveryViewModel, count: Int) throws { + viewModel.selectPoint(id: try XCTUnwrap(viewModel.points.first?.id)) + for video in viewModel.availableVideos.prefix(count) { viewModel.toggleVideo(id: video.id) } + } + + private func completeBatch(_ viewModel: DroneDeliveryViewModel) throws { + XCTAssertTrue(viewModel.startUpload()) + let batch = try XCTUnwrap(viewModel.batch) + for item in batch.items { viewModel.receiveUpload(.succeeded, itemID: item.id, batchID: batch.id) } + } + + private func awaitingSession(_ viewModel: DroneDeliveryViewModel) throws -> DroneDeliveryConfirmationSession { + try selectVideos(viewModel, count: 2) + try completeBatch(viewModel) + viewModel.clearUploadBatch() + viewModel.setAllDeliveredReviewed(true) + XCTAssertTrue(viewModel.createConfirmationSession()) + return try XCTUnwrap(viewModel.confirmationSession) + } +} diff --git a/suixinkanTests/DroneDockActiveTaskViewFixtures.swift b/suixinkanTests/DroneDockActiveTaskViewFixtures.swift new file mode 100644 index 0000000..e3e4b3a --- /dev/null +++ b/suixinkanTests/DroneDockActiveTaskViewFixtures.swift @@ -0,0 +1,23 @@ +import UIKit +@testable import suixinkan + +/// 继续查看入口的隔离任务页,只允许 MockURLSession 接收同任务 shooting,不配置图传或飞控。 +@MainActor +enum DroneDockActiveTaskViewFixtures { + /// 构造时不读接口;页面显示后才发出携带 active_task_id 的只读请求。 + static func controller(taskID: Int, order: DroneDockHomeOrder, context: DroneDockHomeContext) throws + -> (DroneDockShootingTaskViewController, MockURLSession) { + let data: [String: Any] = [ + "order_flight_task_id": taskID, + "order_flight_task": ["id": taskID, "order_number": order.orderID, "scenic_id": context.scenicID], + "task": ["id": taskID, "status": 20], "ui": ["phase": "shooting", "title": "模拟拍摄中"] + ] + let body = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": data]) + let session = MockURLSession(responses: [body]) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + let model = DroneDockShootingTaskViewModel(context: context, taskID: taskID, order: order, + service: DroneDockShootingAPI(client: client), currentContext: { context }) + let live = DroneDockLiveViewModel(context: context, taskID: taskID, currentContext: { context }) + return (DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live), session) + } +} diff --git a/suixinkanTests/DroneDockArrivalCountdownTests.swift b/suixinkanTests/DroneDockArrivalCountdownTests.swift new file mode 100644 index 0000000..5df14c0 --- /dev/null +++ b/suixinkanTests/DroneDockArrivalCountdownTests.swift @@ -0,0 +1,299 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证 App 自行维护的到达倒计时只影响显示,所有时钟和接口均由隔离替身提供。 +@MainActor +final class DroneDockArrivalCountdownTests: XCTestCase { + /// 只有首次可信到达才开始 30 秒;零点之前向上取整,永不显示负数。 + func testReadyStartsThirtySecondsAndRoundsRemainingTimeUp() async throws { + let fixture = try makeFixture() + XCTAssertNil(fixture.model.countdownRemainingSeconds) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 30) + XCTAssertEqual(fixture.model.presentation.countdownSeconds, 30) + fixture.clock.advance(by: .milliseconds(1)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 30) + fixture.clock.advance(by: .milliseconds(999)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 29) + fixture.clock.advance(by: .milliseconds(28_500)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 1) + fixture.clock.advance(by: .milliseconds(500)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 0) + fixture.clock.advance(by: .seconds(100)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 0) + } + + /// 倒数到零既不读取接口也不调用开拍,页面仍等后端返回拍摄中。 + func testExpiryDoesNotStartShootingOrIssueAdditionalRequests() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canStartShooting, "测试显式注入开拍替身,验证到零也不会调用它") + fixture.clock.advance(by: .seconds(35)) + for _ in 0..<5 { + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 0) + XCTAssertEqual(fixture.model.presentation.countdownSeconds, 0) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertFalse(fixture.model.hasSubmittedStart) + } + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertEqual(fixture.actions.startCount, 0) + let shooting = try snapshot(phase: "shooting", version: 2) + XCTAssertEqual(fixture.model.applyTaskSnapshot(shooting), .applied) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertNil(fixture.model.presentation.countdownSeconds) + XCTAssertEqual(fixture.actions.startCount, 0) + XCTAssertEqual(fixture.service.requests.count, 1) + } + + /// 后端提前开拍时立即按快照切换,不等待 App 的显示倒数结束。 + func testBackendShootingSnapshotEndsCountdownBeforeZero() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(7)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 23) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(phase: "shooting", version: 2)), .applied) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertNil(fixture.model.presentation.countdownSeconds) + fixture.clock.advance(by: .seconds(40)) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertEqual(fixture.actions.startCount, 0) + XCTAssertEqual(fixture.service.requests.count, 1) + } + + /// HTTP 刷新、重复版本和新版本到达包都不重新从 30 秒开始。 + func testRepeatedHTTPAndWebSocketReadySnapshotsDoNotResetDeadline() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(12)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 18) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot()), .duplicate) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 18) + guard case .snapshot(let socketValue) = try DroneDockShootingSocketMessage.decode( + RealtimeTestData.push(payload(version: 2))) else { return XCTFail("隔离完整推送应可解析") } + XCTAssertEqual(fixture.model.applyTaskSnapshot(socketValue), .applied) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 18) + fixture.clock.advance(by: .seconds(7)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 11) + XCTAssertEqual(fixture.service.requests.count, 2) + XCTAssertTrue(fixture.service.requests.allSatisfy { !$0.liveBattery }) + XCTAssertEqual(fixture.actions.startCount, 0) + } + + /// 新执行批次建立新期限,过期版本和旧批次不能重置或清除当前倒计时。 + func testNewExecutionBatchStartsFreshCountdownAndRejectsOldSnapshots() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(20)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 10) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(batch: 101, version: 1)), .applied) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 30) + fixture.clock.advance(by: .seconds(4)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(phase: "shooting", batch: 100, version: 999)), .outdated) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 26) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(phase: "shooting", batch: 101, version: 0)), .outdated) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 26) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + } + + /// HTTP 或 WS 首次进入到达状态都使用接收时的 App 时钟,不要求后端倒计时字段。 + func testHTTPAndWebSocketFirstArrivalHaveEquivalentCountdowns() async throws { + let http = try makeFixture() + let socket = try makeFixture() + await http.model.refresh() + guard case .snapshot(let value) = try DroneDockShootingSocketMessage.decode( + RealtimeTestData.push(payload())) else { return XCTFail("隔离完整推送应可解析") } + XCTAssertEqual(socket.model.applyTaskSnapshot(value), .applied) + XCTAssertEqual(http.model.countdownRemainingSeconds, 30) + XCTAssertEqual(socket.model.countdownRemainingSeconds, 30) + http.clock.advance(by: .seconds(9)) + socket.clock.advance(by: .seconds(9)) + XCTAssertEqual(http.model.presentation.countdownSeconds, socket.model.presentation.countdownSeconds) + XCTAssertTrue(socket.service.requests.isEmpty) + XCTAssertEqual(http.actions.startCount + socket.actions.startCount, 0) + } + + /// 后台或离页只停止 UI 刷新;保留快照时本地期限继续流逝,回到同批次不重置。 + func testPreservedSnapshotCountsElapsedForegroundGapWithoutResetting() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(8)) + fixture.model.invalidate(preservingSnapshot: true) + fixture.clock.advance(by: .seconds(15)) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 7) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 7) + fixture.model.invalidate(preservingSnapshot: true) + fixture.clock.advance(by: .seconds(40)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 0) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.actions.startCount, 0) + } + + /// 离开到达阶段隐藏数字,同批次再次返回到达不重建已开始的期限。 + func testLeavingReadyHidesCountdownWithoutResettingSameExecution() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(6)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(phase: "manual_paused", version: 2)), .applied) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertNil(fixture.model.presentation.countdownSeconds) + fixture.clock.advance(by: .seconds(5)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(version: 3)), .applied) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 19) + for (version, phase) in [(4, "shooting"), (5, "post_shoot_uploading"), (6, "post_shoot_upload_failed"), (7, "blocked")] { + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(phase: phase, version: version)), .applied) + XCTAssertNil(fixture.model.countdownRemainingSeconds, phase) + XCTAssertNil(fixture.model.presentation.countdownSeconds, phase) + } + } + + /// 缺少执行批次的旧响应仍可计时,但重复刷新不能反复延长显示。 + func testLegacySnapshotsWithoutBatchShareOneLocalDeadline() async throws { + let fixture = try makeFixture(response: snapshot(batch: nil, version: nil)) + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(10)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 20) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(batch: nil, version: nil)), .applied) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 20) + } + + /// 明确到达即显示倒计时,开拍门禁独立;未知阶段和错误身份不能显示或创建新倒计时。 + func testDeniedStartGateKeepsArrivalCountdownButUnknownAndMismatchedStatesDoNot() async throws { + let fixture = try makeFixture(response: snapshot(phase: "going_to_spot")) + await fixture.model.refresh() + XCTAssertNil(fixture.model.countdownRemainingSeconds) + var denied = payload(version: 2) + denied["execute_gate"] = ["can_execute": false, "primary_action": "blocked"] + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(denied)), .applied) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 30) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(phase: "future_phase", version: 3)), .applied) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + var wrong = payload(version: 4) + wrong["order_flight_task_id"] = 999 + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(wrong)), .invalid) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertEqual(fixture.actions.startCount, 0) + } + + /// 明确清除快照或身份变化会清理本地计时;不能把旧任务秒数带到失效页面。 + func testClearSnapshotAndIdentityChangeRemoveCountdown() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.clock.advance(by: .seconds(12)) + fixture.model.invalidate() + XCTAssertNil(fixture.model.countdownRemainingSeconds) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 30) + fixture.scope.value = DroneDockShootingTaskTestData.context(scenicID: 129) + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertNil(fixture.model.presentation.countdownSeconds) + XCTAssertFalse(fixture.model.canContinuePolling) + } + + /// 权限终止立即隐藏旧倒计时,即使为只读展示仍保留旧任务快照。 + func testPermissionDenialHidesCountdownAndRejectsLaterReadySnapshot() async throws { + let fixture = try makeFixture() + await fixture.model.refresh() + fixture.model.stopReading(message: "本地模拟:无权限") + XCTAssertNotNil(fixture.model.response) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertNil(fixture.model.presentation.countdownSeconds) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try snapshot(version: 2)), .invalid) + XCTAssertEqual(fixture.actions.startCount, 0) + } + + private func payload(phase: String = "arrived_pending_start", batch: Int? = 100, version: Int? = 1) -> [String: Any] { + var value = DroneDockShootingTaskTestData.payload() + value["order_flight_task_id"] = 501 + value["task"] = ["id": 501, "status": 20, "wayline_status": 20] + value["order_flight_task"] = ["id": 501, "status": 20, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128] + value["ui"] = ["phase": phase, "title": "本地模拟:任务阶段", "message": "未连接真实无人机"] + value["execute_gate"] = ["can_execute": phase == "arrived_pending_start", "primary_action": phase == "arrived_pending_start" ? "start_shoot" : "blocked"] + if let batch { + value["execution_batch"] = batch + value["flight_control"] = DroneDockShootingTaskTestData.flightControl( + state: phase == "manual_paused" ? "paused" : "executing", batch: batch, + canPause: phase != "manual_paused", canResume: phase == "manual_paused", + resumePhase: phase == "manual_paused" || phase == "arrived_pending_start" ? "arrived_pending_start" : nil, + pauseReason: phase == "manual_paused" ? "manual" : phase == "arrived_pending_start" ? "arrival_wait" : nil) + } + if let version { value["state_version"] = version } + value["snapshot_kind"] = "full" + return value + } + + private func snapshot(phase: String = "arrived_pending_start", batch: Int? = 100, version: Int? = 1) throws -> DroneDockShootingResponse { + try DroneDockShootingTaskTestData.decode(payload(phase: phase, batch: batch, version: version)) + } + + private func makeFixture(response: DroneDockShootingResponse? = nil) throws -> ( + model: DroneDockShootingTaskViewModel, service: DroneDockShootingTaskTestService, + clock: DroneDockCountdownTestClock, actions: ArrivalCountdownStartProbe, scope: ArrivalCountdownScope + ) { + let context = DroneDockShootingTaskTestData.context() + let scope = ArrivalCountdownScope(value: context) + let clock = DroneDockCountdownTestClock() + let service = DroneDockShootingTaskTestService(result: .success(try response ?? snapshot())) + let actions = ArrivalCountdownStartProbe() + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, startService: actions, + countdownNow: { clock.now() }, currentContext: { scope.value }) + return (model, service, clock, actions, scope) + } +} + +/// 以锁保护可推进的单调时钟,测试不依赖真实 30 秒等待或系统墙钟调整。 +final class DroneDockCountdownTestClock: @unchecked Sendable { + private let lock = NSLock() + private var instant = ContinuousClock.now + + /// 从当前单调时间建立可推进测试时钟。 + init() {} + + /// 读取当前模拟时间,供 nonisolated ViewModel 的 Sendable 闭包使用。 + func now() -> ContinuousClock.Instant { + lock.lock() + defer { lock.unlock() } + return instant + } + + /// 手动推进经过时间,不调度计时器或任何网络请求。 + func advance(by duration: Duration) { + lock.lock() + defer { lock.unlock() } + instant = instant.advanced(by: duration) + } + + /// 供页面生命周期测试按秒推进同一时钟。 + func advance(seconds: Double) { advance(by: .seconds(seconds)) } +} + +/// 可切换身份的隔离会话,仅用于检查旧任务倒计时清理。 +@MainActor +private final class ArrivalCountdownScope { + var value: DroneDockHomeContext + + /// 建立固定匿名测试会话。 + init(value: DroneDockHomeContext) { self.value = value } +} + +/// 只统计手动开拍服务调用,不连接网络;倒数到零时必须仍为零次。 +@MainActor +private final class ArrivalCountdownStartProbe: DroneDockStartShooting { + private(set) var startCount = 0 + + /// 任何误触发都会留下次数;返回本地错误避免伪造后端成功。 + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + startCount += 1 + throw APIError.networkFailed("本地模拟,未发送真实开拍") + } +} diff --git a/suixinkanTests/DroneDockArrivalCountdownViewTests.swift b/suixinkanTests/DroneDockArrivalCountdownViewTests.swift new file mode 100644 index 0000000..e76b9f8 --- /dev/null +++ b/suixinkanTests/DroneDockArrivalCountdownViewTests.swift @@ -0,0 +1,220 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用可推进时钟和隔离读取验证逐秒显示、生命周期与后端状态切换,不连接真实设备。 +@MainActor +final class DroneDockArrivalCountdownViewTests: XCTestCase { + /// 每秒只更新显示,到零不额外读取或开拍;后端明确拍摄中后才切换阶段。 + func testCountdownOnlyUpdatesStartButtonAndWaitsForBackendShooting() async throws { + let fixture = try makeFixture() + defer { fixture.close() } + try await settle(fixture.window) { fixture.pulse.pendingCount == 1 } + let action = try XCTUnwrap(find(in: fixture.controller.view, id: "drone.task.remote.primary") as? UIButton) + XCTAssertNil(find(in: fixture.controller.view, id: "drone.task.remote.countdown")) + XCTAssertEqual(action.title(for: .normal), "开始拍摄(30s)") + XCTAssertTrue(action.isEnabled) + let initialFrame = action.convert(action.bounds, to: fixture.controller.view) + try await capture(fixture.window, action: action, expectedTitle: "开始拍摄(30s)", name: "App本地到达倒计时30秒(隔离替身)") + fixture.clock.advance(seconds: 1) + fixture.pulse.fire() + try await settle(fixture.window) { action.title(for: .normal) == "开始拍摄(29s)" && fixture.pulse.pendingCount == 1 } + XCTAssertTrue(find(in: fixture.controller.view, id: "drone.task.remote.primary") === action) + XCTAssertEqual(action.convert(action.bounds, to: fixture.controller.view), initialFrame) + fixture.clock.advance(seconds: 29.5) + fixture.pulse.fire() + try await settle(fixture.window) { action.title(for: .normal) == "开始拍摄(0s)" && fixture.pulse.pendingCount == 0 } + XCTAssertTrue(find(in: fixture.controller.view, id: "drone.task.remote.primary") === action) + XCTAssertEqual(action.convert(action.bounds, to: fixture.controller.view), initialFrame) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertEqual(fixture.start.count, 0, "本地倒数到零不能下发开拍") + XCTAssertTrue(action.isEnabled, "秒数不会改变后端开拍门禁") + try await capture(fixture.window, action: action, expectedTitle: "开始拍摄(0s)", name: "App本地倒计时0秒仍等待后端(隔离替身)") + fixture.service.result = .success(try snapshot(phase: "shooting", version: 2)) + let item = try XCTUnwrap(fixture.controller.navigationItem.rightBarButtonItem) + _ = UIApplication.shared.sendAction(try XCTUnwrap(item.action), to: item.target, from: item, for: nil) + try await settle(fixture.window) { fixture.model.presentation.phase == .shooting } + XCTAssertNil(find(in: fixture.controller.view, id: "drone.task.remote.countdown")) + XCTAssertFalse(action.currentTitle?.contains("s)") == true, "后端拍摄中必须清除旧倒计时文案") + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertEqual(fixture.service.requests.count, 2) + XCTAssertEqual(fixture.start.count, 0) + XCTAssertEqual(fixture.pulse.pendingCount, 0) + } + + /// 手动开拍与本地数字显示并行,30秒、倒数中和0秒均可点,连点仍只提交一次。 + func testManualStartRemainsTappableThroughoutCountdown() async throws { + for elapsed in [0.0, 12.0, 30.0] { + let fixture = try makeFixture() + defer { fixture.close() } + try await settle(fixture.window) { fixture.pulse.pendingCount == 1 } + let action = try XCTUnwrap(find(in: fixture.controller.view, id: "drone.task.remote.primary") as? UIButton) + if elapsed > 0 { + fixture.clock.advance(seconds: elapsed) + fixture.pulse.fire() + try await settle(fixture.window) { action.title(for: .normal) == "开始拍摄(\(30 - Int(elapsed))s)" } + } + XCTAssertEqual(action.title(for: .normal), "开始拍摄(\(30 - Int(elapsed))s)") + XCTAssertNil(find(in: fixture.controller.view, id: "drone.task.remote.countdown")) + XCTAssertTrue(action.isEnabled) + let center = action.convert(CGPoint(x: action.bounds.midX, y: action.bounds.midY), to: fixture.controller.view) + let hit = fixture.controller.view.hitTest(center, with: nil) + XCTAssertTrue(hit === action || hit?.isDescendant(of: action) == true) + XCTAssertEqual(fixture.start.count, 0) + action.sendActions(for: .touchUpInside) + action.sendActions(for: .touchUpInside) + try await settle(fixture.window) { fixture.start.count == 1 && !fixture.model.isStartingShooting } + XCTAssertTrue(fixture.model.startOutcomeUnknown, "隔离替身返回超时类错误,不能自动再次开拍") + XCTAssertEqual(fixture.service.requests.count, 1, "本地倒计时与未知开拍结果不额外触发读取") + XCTAssertEqual(fixture.model.presentation.phase, .ready, "受理或提交本身不替代后端拍摄中状态") + } + } + + /// 后台与离页取消定时刷新;同任务批次返回后按已经过去的时间继续,不再从30开始。 + func testBackgroundAndPageReentryPreserveElapsedTimeAndCancelTicks() async throws { + let fixture = try makeFixture() + defer { fixture.close() } + try await settle(fixture.window) { fixture.pulse.pendingCount == 1 } + let action = try XCTUnwrap(find(in: fixture.controller.view, id: "drone.task.remote.primary") as? UIButton) + let initialFrame = action.convert(action.bounds, to: fixture.controller.view) + fixture.clock.advance(seconds: 8) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await settle(fixture.window) { fixture.pulse.pendingCount == 0 } + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 22) + fixture.clock.advance(seconds: 12) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(fixture.window) { fixture.service.requests.count == 2 && action.title(for: .normal) == "开始拍摄(10s)" && fixture.pulse.pendingCount == 1 } + fixture.controller.viewWillDisappear(false) + try await settle(fixture.window) { fixture.pulse.pendingCount == 0 } + fixture.clock.advance(seconds: 15) + fixture.controller.viewDidAppear(false) + try await settle(fixture.window) { fixture.service.requests.count == 3 && action.title(for: .normal) == "开始拍摄(0s)" } + XCTAssertTrue(find(in: fixture.controller.view, id: "drone.task.remote.primary") === action) + XCTAssertEqual(action.convert(action.bounds, to: fixture.controller.view), initialFrame) + XCTAssertNil(find(in: fixture.controller.view, id: "drone.task.remote.countdown")) + XCTAssertEqual(fixture.pulse.pendingCount, 0) + XCTAssertEqual(fixture.start.count, 0) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + } + + private func makeFixture() throws -> CountdownPageFixture { + let context = DroneDockShootingTaskTestData.context() + let clock = DroneDockCountdownTestClock() + let service = DroneDockShootingTaskTestService(result: .success(try snapshot(phase: "arrived_pending_start", version: 1))) + let start = CountdownPageStartProbe() + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: service, startService: start, + countdownNow: { clock.now() }, currentContext: { context }) + let pulse = CountdownPagePulse() + let controller = DroneDockShootingTaskViewController(viewModel: model, + shootingPollDelay: { _ in try await Task.sleep(for: .seconds(3600)) }, countdownDelay: { try await pulse.wait() }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return CountdownPageFixture(controller: controller, window: window, previous: previous, model: model, + service: service, clock: clock, pulse: pulse, start: start) + } + + private func snapshot(phase: String, version: Int) throws -> DroneDockShootingResponse { + try DroneDockShootingTaskTestData.response(changes: [ + "task": ["id": 501, "status": 20], "order_flight_task": ["id": 501, "status": 20], + "execution_batch": 100, "state_version": version, "snapshot_kind": "full", + "flight_control": DroneDockShootingTaskTestData.flightControl(batch: 100, resumePhase: phase, + pauseReason: phase == "arrived_pending_start" ? "arrival_wait" : nil), + "ui": ["phase": phase, "title": phase == "shooting" ? "正在拍摄" : "无人机已到达", + "message": "本地模拟:未连接真实设备"], + "execute_gate": ["can_execute": phase == "arrived_pending_start", "primary_action": "start_shoot"] + ]) + } + + private func find(in root: UIView, id: String) -> UIView? { + if root.accessibilityIdentifier == id { return root } + return root.subviews.lazy.compactMap { self.find(in: $0, id: id) }.first + } + + private func settle(_ window: UIWindow, until predicate: () -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while ContinuousClock.now < deadline { + window.layoutIfNeeded() + if predicate() { return } + try await Task.sleep(for: .milliseconds(10)) + } + XCTFail("本地倒计时页面未达到预期状态") + throw NSError(domain: "CountdownPage", code: 1) + } + + private func capture(_ window: UIWindow, action: UIButton, expectedTitle: String, name: String) async throws { + try await Task.sleep(for: .milliseconds(300)) + window.layoutIfNeeded() + let label = try XCTUnwrap(action.titleLabel) + XCTAssertEqual(label.text, expectedTitle, "按钮实际渲染文字包含完整剩余秒数") + let textSize = (expectedTitle as NSString).size(withAttributes: [.font: label.font as Any]) + XCTAssertGreaterThanOrEqual(label.bounds.width + 1, ceil(textSize.width), "按钮标题不能裁切秒数") + XCTAssertGreaterThanOrEqual(action.bounds.height, 44) + let attachment = XCTAttachment(image: UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + }) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 持有单页隔离依赖并恢复测试前的窗口,避免通知或计时任务影响其他用例。 +@MainActor +private struct CountdownPageFixture { + let controller: DroneDockShootingTaskViewController + let window: UIWindow + let previous: UIWindow? + let model: DroneDockShootingTaskViewModel + let service: DroneDockShootingTaskTestService + let clock: DroneDockCountdownTestClock + let pulse: CountdownPagePulse + let start: CountdownPageStartProbe + + func close() { + controller.viewWillDisappear(false) + window.isHidden = true + window.rootViewController = nil + previous?.makeKeyAndVisible() + } +} + +/// 由测试主动唤醒的本地逐秒刷新等待器,取消时立即释放 continuation。 +@MainActor +private final class CountdownPagePulse { + private var pending: [(UUID, CheckedContinuation)] = [] + var pendingCount: Int { pending.count } + + func wait() async throws { + let id = UUID() + try Task.checkCancellation() + try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { pending.append((id, $0)) } + } onCancel: { + Task { @MainActor in + guard let index = self.pending.firstIndex(where: { $0.0 == id }) else { return } + self.pending.remove(at: index).1.resume(throwing: CancellationError()) + } + } + } + + func fire() { + guard !pending.isEmpty else { return } + pending.removeFirst().1.resume() + } +} + +/// 记录意外开拍调用,只返回本地错误,不创建网络传输。 +@MainActor +private final class CountdownPageStartProbe: DroneDockStartShooting { + private(set) var count = 0 + + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + count += 1 + throw APIError.networkFailed("本地模拟:不应自动开拍") + } +} diff --git a/suixinkanTests/DroneDockCommandAPITests.swift b/suixinkanTests/DroneDockCommandAPITests.swift new file mode 100644 index 0000000..8f47be3 --- /dev/null +++ b/suixinkanTests/DroneDockCommandAPITests.swift @@ -0,0 +1,233 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用纯内存响应核验四类安全指令合同,不访问后端或真实设备。 +@MainActor +final class DroneDockCommandAPITests: XCTestCase { + /// 四种操作都只发一次带鉴权 POST,任务身份使用 id,不传飞机或机场标识。 + func testEachCommandSendsTaskIDCommandAndIdempotencyKey() async throws { + for command in DroneDockSafetyCommand.allCases { + let session = MockURLSession(responses: [try envelope(data: payload(command: command))]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "command-test-token" } + let response = try await DroneDockCommandAPI(client: client).sendCommand(taskID: 501, command: command, clientRequestID: "local-command-request") + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/app/airport/command") + XCTAssertNil(request.url?.query) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "command-test-token") + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["id", "command", "client_request_id"]) + XCTAssertEqual(body["client_request_id"] as? String, "local-command-request") + XCTAssertEqual(body["id"] as? Int, 501) + XCTAssertEqual(body["command"] as? String, command.rawValue) + XCTAssertEqual(response.orderFlightTaskID, 501) + XCTAssertEqual(response.command, command.rawValue) + XCTAssertEqual(response.commandID, "local-command-1") + XCTAssertEqual(response.clientRequestID, "local-command-request") + XCTAssertEqual(response.pendingCommand?.commandID, response.commandID) + XCTAssertEqual(response.pendingCommand?.status, "pending") + XCTAssertEqual(response.airportSN, "LOCAL-MOCK-AIRPORT-501") + XCTAssertEqual(response.accepted, true) + XCTAssertEqual(response.deviceConfirmed, false) + XCTAssertEqual(response.executionBatch, 100) + XCTAssertEqual(response.stateVersion, 8) + XCTAssertEqual(response.metrics.map(\.key), ["battery", "satellite"]) + } + } + + /// 无效任务 ID 与已经取消的操作在进入传输前终止。 + func testInvalidOrCancelledRequestNeverReachesTransport() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + for taskID in [0, -1] { + do { + _ = try await api.sendCommand(taskID: taskID, command: .pause, clientRequestID: "local-command-request") + XCTFail("无效任务 ID 不应提交") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + } + do { + _ = try await api.sendCommand(taskID: 501, command: .pause, clientRequestID: "") + XCTFail("缺少幂等键的设备指令不应提交") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + let pending = Task { @MainActor in try await api.sendCommand(taskID: 501, command: .returnHome, clientRequestID: "local-command-request") } + pending.cancel() + do { + _ = try await pending.value + XCTFail("已取消的指令不应提交") + } catch is CancellationError {} + XCTAssertTrue(session.requests.isEmpty) + } + + /// 业务拒绝不受 data 形状影响,不伪造成成功或自动重试。 + func testBusinessFailurePreservesBackendReasonWithoutRetry() async throws { + for data: Any in [NSNull(), [:] as [String: Any], [] as [Any], payload()] { + let session = MockURLSession(responses: [try envelope(data: data, code: 100099, + message: "模拟:任务未锁定飞机,请先召唤无人机")]) + do { + _ = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .pause, clientRequestID: "local-command-request") + XCTFail("拒绝不能转换为成功") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "模拟:任务未锁定飞机,请先召唤无人机") + } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 网络超时只回报一次失败,不自动重复具有设备副作用的指令。 + func testTimeoutDoesNotAutomaticallyRetry() async throws { + let session = MockURLSession(results: [.failure(URLError(.timedOut))]) + do { + _ = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .returnHome, clientRequestID: "local-command-request") + XCTFail("超时不能伪造成功") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.requests.count, 1) + } + + /// HTTP 失败不能因业务包裹恰为成功而转成受理回执。 + func testHTTPFailureDoesNotBecomeSuccess() async throws { + let session = MockURLSession(responses: [try envelope(data: payload())], statusCode: 503) + do { + _ = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .pause, clientRequestID: "local-command-request") + XCTFail("HTTP 失败不能算成功") + } catch let APIError.httpStatus(code, _) { XCTAssertEqual(code, 503) } + XCTAssertEqual(session.requests.count, 1) + } + + /// 错任务、无效身份和错误回显指令都拒绝,不将别的操作结果交给当前按钮。 + func testMismatchedIdentityAndEchoAreRejected() async throws { + let changes: [[String: Any]] = [ + ["order_flight_task_id": 502], ["order_flight_task_id": 0], + ["order_flight_task_id": -1], ["order_flight_task_id": "501"], + ["order_flight_task_id": true], ["order_flight_task_id": NSNull()], + ["command": "return_home"], ["command": "unknown"], ["command": NSNull()], + ["client_request_id": "another-request"], ["command_id": ""], ["command_id": NSNull()] + ] + for change in changes { + let session = MockURLSession(responses: [try envelope(data: payload().merging(change) { _, new in new })]) + do { + _ = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .pause, clientRequestID: "local-command-request") + XCTFail("错误任务或指令回显应拒绝") + } catch let APIError.decodeFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 空响应或缺少必需回显不能生成成功回执。 + func testMissingDataAndEchoAreRejected() async throws { + let data: [Any] = [NSNull(), [:] as [String: Any], [] as [Any], + ["order_flight_task_id": 501], ["command": "flighttask_pause"], + ["order_flight_task_id": 501, "command": "flighttask_pause"]] + for value in data { + let session = MockURLSession(responses: [try envelope(data: value)]) + do { + _ = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .pause, clientRequestID: "local-command-request") + XCTFail("缺失回显不能算成功") + } catch let error as APIError { + switch error { + case .emptyData, .decodeFailed: break + default: XCTFail("应保留数据缺失或解析错误:\(error)") + } + } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// dji_status 的字符串、数字、对象、数组和 null 均保留原始 JSON,不强行映射为飞行阶段。 + func testMixedDJIStatusAndUnknownFieldsArePreserved() async throws { + let statuses: [Any] = ["paused", 3, false, ["phase": "running", "code": 20], + [NSNull(), "pending"], NSNull()] + for status in statuses { + var data = payload() + data["dji_status"] = status + data["future"] = ["text": "001", "count": 0, "empty": NSNull()] as [String: Any] + let session = MockURLSession(responses: [try envelope(data: data)]) + let response = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .pause, clientRequestID: "local-command-request") + let original = try JSONDecoder().decode(DroneDockHomeJSONValue.self, + from: JSONSerialization.data(withJSONObject: data)) + let displayed = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: Data(response.dataJSON.utf8)) + XCTAssertEqual(displayed, original) + if status is NSNull { XCTAssertNil(response.djiStatus) } + else { XCTAssertNotNil(response.djiStatus) } + } + } + + /// 缺少非身份展示字段仍保留未知值,不阻断已经核对身份的回执。 + func testOptionalDisplayFieldsRemainUnknownWhenMissing() async throws { + let session = MockURLSession(responses: [try envelope(data: ["order_flight_task_id": 501, + "command": "flighttask_pause", "command_id": "local-command-1"])]) + let response = try await DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)) + .sendCommand(taskID: 501, command: .pause, clientRequestID: "local-command-request") + XCTAssertNil(response.airportSN) + XCTAssertNil(response.djiStatus) + XCTAssertNil(response.accepted) + XCTAssertNil(response.deviceConfirmed) + XCTAssertNil(response.executionBatch) + XCTAssertNil(response.flightControl) + XCTAssertNil(response.clientRequestID) + XCTAssertNil(response.pendingCommand) + XCTAssertTrue(response.metrics.isEmpty) + } + + /// 四类指令在两种环境均进入普通隔离传输,不依赖模拟标记或构建类型。 + func testEveryCommandReachesOrdinaryInMemoryTransport() async throws { + for environment in [APIEnvironment.testing, .production] { + let session = SafetyCommandTransportProbe() + let api = DroneDockCommandAPI(client: APIClient(environment: environment, session: session)) + for command in DroneDockSafetyCommand.allCases { + do { + _ = try await api.sendCommand(taskID: 501, command: command, clientRequestID: "local-command-request") + XCTFail("隔离传输主动失败") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + } + XCTAssertEqual(session.requestCount, DroneDockSafetyCommand.allCases.count) + } + } + + /// 服务端动作列表缺失保持未知;未知动作可展示原文但不成为本地指令枚举。 + func testShootingCommandsDecodeKnownAndUnknownEntries() throws { + let ui = try JSONDecoder().decode(DroneDockShootingUI.self, from: Data(#"{"phase":"paused","commands":[{"command":"flighttask_recovery","label":"继续拍摄","sub":"恢复航线"},{"command":"future_control","label":"未来操作"}]}"#.utf8)) + XCTAssertEqual(ui.commands?.count, 2) + XCTAssertEqual(ui.commands?.first?.command, DroneDockSafetyCommand.resume.rawValue) + XCTAssertEqual(ui.commands?.first?.label, "继续拍摄") + XCTAssertEqual(ui.commands?.first?.sub, "恢复航线") + XCTAssertNil(DroneDockSafetyCommand(rawValue: try XCTUnwrap(ui.commands?.last?.command))) + let missing = try JSONDecoder().decode(DroneDockShootingUI.self, from: Data(#"{"phase":"shooting"}"#.utf8)) + XCTAssertNil(missing.commands) + XCTAssertNil(DroneDockShootingUI(phase: "shooting", title: nil, message: nil).commands) + } + + private func payload(command: DroneDockSafetyCommand = .pause) -> [String: Any] { + ["order_flight_task_id": 501, "command": command.rawValue, "airport_sn": "LOCAL-MOCK-AIRPORT-501", + "accepted": true, "device_confirmed": false, "execution_batch": 100, "state_version": 8, + "command_id": "local-command-1", "client_request_id": "local-command-request", + "pending_command": ["command_id": "local-command-1", "client_request_id": "local-command-request", + "command": command.rawValue, "status": "pending"], + "dji_status": "paused", "metrics": [["key": "battery", "value": "95%"], + ["key": "satellite", "value": "36颗"]]] + } + + private func envelope(data: Any, code: Int = 100000, message: String = "local mock success") throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": data]) + } +} + +/// 仅记录调用并抛错的普通传输探针,不具备联网能力。 +private final class SafetyCommandTransportProbe: URLSessionProtocol { + private(set) var requestCount = 0 + + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + requestCount += 1 + throw URLError(.unsupportedURL) + } +} diff --git a/suixinkanTests/DroneDockCommandProgressTests.swift b/suixinkanTests/DroneDockCommandProgressTests.swift new file mode 100644 index 0000000..a938579 --- /dev/null +++ b/suixinkanTests/DroneDockCommandProgressTests.swift @@ -0,0 +1,453 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 指令进度只更新对应按钮;所有请求、延迟和回执均由内存替身产生。 +@MainActor +final class DroneDockCommandProgressTests: XCTestCase { + /// 第二个按钮立即进入等待,HTTP 串行发出,但无需等第一条设备指令确认。 + func testIndependentButtonsQueueHTTPInOrderWithoutWaitingForDeviceConfirmation() async throws { + let fixture = try CommandProgressFixture() + defer { fixture.service.cancelAll() } + await fixture.model.refresh() + fixture.service.holdsCommands = true + let pause = Task { await fixture.model.sendCommand(.pause) } + try await wait { fixture.service.requests.count == 1 } + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + let returning = Task { await fixture.model.sendCommand(.returnHome) } + try await wait { fixture.model.isCommandLoading(.returnHome) } + XCTAssertEqual(fixture.service.requests.map(\.command), [.pause]) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + try fixture.service.resolve(0, changes: ["state_version": 2]) + try await wait { fixture.service.requests.count == 2 } + XCTAssertEqual(fixture.service.requests.map(\.command), [.pause, .returnHome]) + XCTAssertTrue(fixture.model.isCommandLoading(.pause), "第一条仍在等待设备确认,第二条已经可以提交") + try fixture.service.resolve(1, changes: ["state_version": 3]) + await pause.value + await returning.value + XCTAssertEqual(fixture.service.maximumConcurrentCommands, 1) + XCTAssertEqual(Set(fixture.service.requests.map(\.clientRequestID)).count, 2) + XCTAssertFalse(fixture.model.isCommandLoading(.pause), "后受理的返航取代旧暂停意图") + XCTAssertTrue(fixture.model.isCommandLoading(.returnHome)) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.model.presentation.phase, .shooting, "受理回执不替代完整业务快照") + } + + /// 排队期间已收到本批次回巢证据,尚未发出的暂停不能继续沿用点击时的飞行许可。 + func testQueuedPauseIsNotSentAfterReturned() async throws { + let fixture = try CommandProgressFixture() + defer { fixture.service.cancelAll() } + await fixture.model.refresh() + fixture.service.holdsCommands = true + let returning = Task { await fixture.model.sendCommand(.returnHome) } + try await wait { fixture.service.requests.count == 1 } + let pause = Task { await fixture.model.sendCommand(.pause) } + try await wait { fixture.model.isCommandLoading(.pause) } + fixture.service.value = try DroneDockShootingTaskTestData.response(changes: [ + "order_flight_task_id": 501, "execution_batch": 9001, "state_version": 3, + "task": ["id": 501, "status": 40, "result_code": "return_home"], + "order_flight_task": ["id": 501, "status": 40, "result_code": "return_home"], + "current_plane": ["id": 58, "sn_number": "LOCAL-PROGRESS-058", "work_status": 1], + "flight_control": DroneDockShootingTaskTestData.flightControl(state: "returned", batch: 9001, + canPause: false, canResume: false, canReturn: false, resumePhase: "returning", + returnReason: "manual", droneInDock: "inside", isAirborne: false), + "ui": ["phase": "failed_restartable"]]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(fixture.service.value), .applied) + try fixture.service.resolve(0) + await returning.value + await pause.value + XCTAssertEqual(fixture.service.requests.map(\.command), [.returnHome]) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertEqual(fixture.model.flightControlState, .returned) + } + + /// 权限撤销后,队列中尚未发出的另一安全指令必须取消,不能继续使用旧快照权限。 + func testQueuedCommandIsNotSentAfterAccessDenied() async throws { + let fixture = try CommandProgressFixture() + defer { fixture.service.cancelAll() } + await fixture.model.refresh() + fixture.service.holdsCommands = true + let pause = Task { await fixture.model.sendCommand(.pause) } + try await wait { fixture.service.requests.count == 1 } + let returning = Task { await fixture.model.sendCommand(.returnHome) } + try await wait { fixture.model.isCommandLoading(.returnHome) } + fixture.model.stopReading(message: "当前账号无权限操作该任务") + try fixture.service.resolve(0) + await pause.value + await returning.value + XCTAssertEqual(fixture.service.requests.map(\.command), [.pause]) + XCTAssertFalse(fixture.model.isCommandLoading(.returnHome)) + XCTAssertFalse(fixture.model.canSendCommand(.returnHome)) + XCTAssertNotNil(fixture.model.readAccessError) + } + + /// 回执已报告更高版本时,迟到的较低版本完整快照不能回退状态或确认按钮。 + func testAcceptedReceiptVersionFloorRejectsOlderFullSnapshots() async throws { + let fixture = try CommandProgressFixture() + await fixture.model.refresh() + fixture.service.receiptChanges = ["state_version": 5] + await fixture.model.sendCommand(.pause) + let request = try XCTUnwrap(fixture.service.requests.first) + let old = try CommandProgressFixture.snapshot(version: 4, state: "paused", + progress: request.progress(status: "succeeded")) + XCTAssertEqual(fixture.model.applyTaskSnapshot(old), .outdated) + XCTAssertEqual(fixture.model.response?.stateVersion, 1) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 5, + progress: request.progress(status: "pending"))), .applied) + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 6, state: "paused", + progress: request.progress(status: "succeeded"))), .applied) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + } + + /// succeeded、failed 和 superseded 都结束对应动画,不触发另一条设备指令。 + func testMatchingTerminalProgressStopsOnlyItsButtonLoading() async throws { + for status in ["succeeded", "failed", "superseded"] { + let fixture = try CommandProgressFixture() + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + let request = try XCTUnwrap(fixture.service.requests.first) + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 3, + state: status == "succeeded" ? "paused" : "executing", + progress: request.progress(status: status))) + XCTAssertFalse(fixture.model.isCommandLoading(.pause), status) + XCTAssertFalse(fixture.model.isCommandLoading(.returnHome), status) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome), status) + XCTAssertEqual(fixture.service.requests.count, 1) + if status == "failed" { + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertNotNil(fixture.model.commandErrorMessage(for: .pause)) + XCTAssertNil(fixture.model.commandErrorMessage(for: .returnHome)) + } + if status == "superseded" { XCTAssertTrue(fixture.model.canSendCommand(.pause)) } + } + } + + /// 指令或请求标识不匹配的终态不能停止本按钮等待,普通新版本也不能冒充确认。 + func testUnrelatedProgressCannotFinishCurrentOperation() async throws { + let fixture = try CommandProgressFixture() + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + let request = try XCTUnwrap(fixture.service.requests.first) + for (offset, changes) in [ + ["command_id": "another-command"], + ["client_request_id": "another-request"], + ["command": DroneDockSafetyCommand.returnHome.rawValue] + ].enumerated() { + let unrelated = request.progress(status: "succeeded").merging(changes) { _, new in new } + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: offset + 3, progress: unrelated)) + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + } + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 6, state: "paused", + progress: request.progress(status: "succeeded"))) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertEqual(fixture.service.requests.count, 1) + } + + /// 缺省 pending 的设备确认回执可停动画,旧权限快照仍不能让同一按钮重复提交。 + func testDeviceConfirmedStopsSpinnerButNeedsFreshStateBeforeSameActionCanRepeat() async throws { + let fixture = try CommandProgressFixture() + await fixture.model.refresh() + fixture.service.receiptChanges = ["pending_command": NSNull(), "device_confirmed": true, "state_version": 2] + await fixture.model.sendCommand(.pause) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.service.requests.count, 1) + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 2, state: "paused")) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 3)) + XCTAssertTrue(fixture.model.canSendCommand(.pause), "完整状态已经完成暂停和恢复后才允许新的暂停操作") + } + + /// 恢复已确认先结束动画,随后同批次 executing 完整快照才清理暂停与恢复防重锁。 + func testRecoverySucceededWaitsForExecutingSnapshotThenRestoresPausePermission() async throws { + let fixture = try CommandProgressFixture() + defer { fixture.service.cancelAll() } + fixture.service.value = try CommandProgressFixture.snapshot(state: "paused") + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + fixture.service.holdsCommands = true + let recovery = Task { await fixture.model.sendCommand(.resume) } + try await wait { fixture.service.requests.count == 1 } + let request = try XCTUnwrap(fixture.service.requests.first) + try fixture.service.resolve(0, changes: ["device_confirmed": true, "state_version": 2, + "pending_command": request.progress(status: "succeeded")]) + await recovery.value + XCTAssertFalse(fixture.model.isCommandLoading(.resume)) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertFalse(fixture.model.canSendCommand(.resume), "设备确认回执不能让旧暂停快照再次发送恢复") + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + + XCTAssertEqual(fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 2, state: "paused", + progress: request.progress(status: "succeeded"))), .applied) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + await fixture.model.sendCommand(.resume) + XCTAssertEqual(fixture.service.requests.count, 1) + + XCTAssertEqual(fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 3, + progress: request.progress(status: "succeeded"))), .applied) + XCTAssertEqual(fixture.model.flightControlState, .executing) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertFalse(fixture.model.canSendCommand(.resume)) + XCTAssertFalse(fixture.model.isCommandLoading(.resume)) + XCTAssertEqual(fixture.service.requests.map(\.command), [.resume]) + } + + /// 数据库错误使用整数业务码与空数组,真实 API 解码进入业务错误且不自动重发设备指令。 + func testIntegerDatabaseFailurePreservesSnapshotWithoutDenyingAccessOrRetryingCommand() async throws { + let message = "任务状态处理失败,请稍后重试" + let data = try JSONSerialization.data(withJSONObject: ["code": 100050, "msg": message, "data": []] as [String: Any]) + let session = MockURLSession(responses: [data]) + let context = DroneDockShootingTaskTestData.context() + let service = CommandProgressService(value: try CommandProgressFixture.snapshot()) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: service, + commandService: DroneDockCommandAPI(client: APIClient(environment: .testing, session: session)), + currentContext: { context }) + await model.refresh() + let previous = model.response + await model.sendCommand(.pause) + XCTAssertEqual(model.commandErrorMessage(for: .pause), message) + XCTAssertFalse(model.isCommandOutcomeUnknown(.pause), "100050 是明确业务错误,不是解析失败导致的未知结果") + XCTAssertFalse(model.isCommandLoading(.pause)) + XCTAssertEqual(model.response, previous) + XCTAssertEqual(model.presentation.phase, .shooting) + XCTAssertNil(model.readAccessError) + XCTAssertTrue(model.canContinuePolling) + XCTAssertTrue(model.canSendCommand(.pause)) + XCTAssertTrue(model.canSendCommand(.returnHome)) + XCTAssertEqual(service.readCount, 1, "拒绝的写入不附加回查") + await model.refresh() + await model.refresh() + XCTAssertEqual(session.requests.count, 1, "只读核对不能自动重新发送设备指令") + XCTAssertEqual(session.requests.first?.url?.path, "/api/app/airport/command") + XCTAssertEqual(service.readCount, 3) + XCTAssertEqual(model.response, previous) + } + + /// 重新进入时仅从服务器 pending 锁住对应动作,不显示中央受理阶段。 + func testRemotePendingLocksOnlyMatchingButtonAndClearsOnExplicitFailure() async throws { + let fixture = try CommandProgressFixture() + let request = CommandProgressRequest(taskID: 501, command: .pause, clientRequestID: "remote-request", batch: 9001) + fixture.service.value = try CommandProgressFixture.snapshot(progress: request.progress(status: "pending")) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(version: 2, + progress: request.progress(status: "failed"))) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.service.requests.isEmpty) + } + + /// 结果未知只锁住该动作;重复刷新不重发,另一安全按钮仍保留明确授权。 + func testUnknownResultLocksOnlyItsActionWithoutAutomaticallyResending() async throws { + for error in [APIError.networkFailed("本地超时"), APIError.decodeFailed("本地错误回执")] { + let fixture = try CommandProgressFixture() + await fixture.model.refresh() + fixture.service.commandError = error + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.isCommandOutcomeUnknown(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertFalse(fixture.model.isCommandOutcomeUnknown(.returnHome)) + XCTAssertNil(fixture.model.commandErrorMessage(for: .returnHome)) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.service.requests.count, 1) + } + } + + /// 明确业务拒绝不是未知结果,同一按钮仅由再次点击触发重试。 + func testKnownFailureStopsLoadingAndLeavesOtherActionUntouched() async throws { + for error: Error in [APIError.serverCode(100099, "模拟拒绝"), APIError.serverCode(100050, "服务暂不可用")] { + let fixture = try CommandProgressFixture() + await fixture.model.refresh() + fixture.service.commandError = error + await fixture.model.sendCommand(.pause) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.isCommandOutcomeUnknown(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertNil(fixture.model.commandErrorMessage(for: .returnHome)) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertEqual(fixture.service.readCount, 1) + } + } + + /// 传输故意忽略取消,旧批次成功或失败均不能在新批次重建按钮等待或错误。 + func testNewBatchRejectsLateOldReceiptAndFailure() async throws { + for succeeds in [true, false] { + let fixture = try CommandProgressFixture() + defer { fixture.service.cancelAll() } + await fixture.model.refresh() + fixture.service.holdsCommands = true + let operation = Task { await fixture.model.sendCommand(.pause) } + try await wait { fixture.service.requests.count == 1 } + fixture.model.applyTaskSnapshot(try CommandProgressFixture.snapshot(batch: 9002, state: "starting")) + if succeeds { try fixture.service.resolve(0) } + else { fixture.service.fail(0, error: APIError.networkFailed("迟到的旧批次失败")) } + await operation.value + XCTAssertEqual(fixture.model.response?.executionBatch, 9002) + XCTAssertEqual(fixture.model.presentation.phase, .navigating) + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertNil(fixture.model.commandResponse) + XCTAssertNil(fixture.model.commandErrorMessage) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.service.requests.count, 1) + } + } + + /// 仅等待内存任务调度,不接触网络或设备。 + private func wait(_ condition: () -> Bool) async throws { + for _ in 0..<200 { + if condition() { return } + try await Task.sleep(for: .milliseconds(10)) + } + XCTFail("隔离指令任务未进入预期状态") + throw CommandProgressTestError.timedOut + } +} + +/// 仅用于及时退出未完成的内存调度等待,避免测试继续挂起。 +private enum CommandProgressTestError: Error { case timedOut } + +/// 记录一个逻辑请求,服务端 ID 与客户端幂等键分别建模。 +private struct CommandProgressRequest { + let taskID: Int + let command: DroneDockSafetyCommand + let clientRequestID: String + let batch: Int64 + var commandID: String { "server-\(clientRequestID)" } + + /// 构造 HTTP/WS 共用的同一条指令进度。 + func progress(status: String) -> [String: Any] { + ["command_id": commandID, "client_request_id": clientRequestID, + "command": command.rawValue, "status": status, + "message": status == "failed" ? "本地设备执行失败" : ""] + } + + /// 合成受理回执,不将受理作为设备已经执行的证据。 + func receipt(changes: [String: Any] = [:]) throws -> DroneDockCommandResponse { + let data: [String: Any] = [ + "order_flight_task_id": taskID, "execution_batch": batch, "state_version": 2, + "plane_id": 58, "airport_sn": "LOCAL-PROGRESS-058", + "accepted": true, "device_confirmed": false, "command": command.rawValue, + "command_id": commandID, "client_request_id": clientRequestID, + "pending_command": progress(status: "pending")] + return try JSONDecoder().decode(DroneDockCommandResponse.self, + from: JSONSerialization.data(withJSONObject: data.merging(changes) { _, new in new })) + } +} + +/// 当前任务与服务完整隔离,快照默认有已确认的飞行状态和两项安全许可。 +@MainActor +private struct CommandProgressFixture { + let service: CommandProgressService + let model: DroneDockShootingTaskViewModel + + /// 注入只读与指令内存替身,不提供任何真实传输能力。 + init() throws { + service = CommandProgressService(value: try Self.snapshot()) + let context = DroneDockShootingTaskTestData.context() + model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, commandService: service, + currentContext: { context }) + } + + /// 提供当前批次完整状态,进度放在合同规定的 flight_control.pending_command 下。 + static func snapshot(version: Int = 1, batch: Int = 9001, state: String = "executing", + progress: [String: Any]? = nil) throws -> DroneDockShootingResponse { + let starting = state == "starting" + let paused = state == "paused" + return try DroneDockShootingTaskTestData.response(changes: [ + "order_flight_task_id": 501, "execution_batch": batch, "state_version": version, "snapshot_kind": "full", + "task": ["id": 501, "status": 20], "order_flight_task": ["id": 501, "status": 20], + "current_plane": ["id": 58, "sn_number": "LOCAL-PROGRESS-058", "work_status": 2], + "flight_control": DroneDockShootingTaskTestData.flightControl(state: state, batch: batch, + canPause: !paused && !starting, canResume: paused, canReturn: true, + resumePhase: starting ? "going_to_spot" : "shooting", + droneInDock: starting ? "inside" : "outside", isAirborne: !starting, + pauseReason: paused ? "manual" : nil, pendingCommand: progress), + "ui": ["phase": starting ? "going_to_spot" : paused ? "manual_paused" : "shooting"], + "execute_gate": ["can_execute": false, "primary_action": "blocked"]]) + } +} + +/// 可挂起且故意忽略取消的指令服务,用于验证 FIFO 与迟到响应;从不转发网络。 +@MainActor +private final class CommandProgressService: DroneDockShootingServing, DroneDockCommandSending { + var value: DroneDockShootingResponse + var holdsCommands = false + var receiptChanges: [String: Any] = [:] + var commandError: Error? + private(set) var requests: [CommandProgressRequest] = [] + private(set) var readCount = 0 + private(set) var maximumConcurrentCommands = 0 + private var activeCommands = 0 + private var continuations: [String: CheckedContinuation] = [:] + + /// 使用显式内存快照初始化测试读取。 + init(value: DroneDockShootingResponse) { self.value = value } + + /// 只读返回同任务配置快照,实时采集参数必须关闭。 + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + XCTAssertEqual(taskID, 501) + XCTAssertFalse(liveBattery) + readCount += 1 + return value + } + + /// 保存幂等请求并可选择挂起,允许测试控制回执顺序。 + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + let request = CommandProgressRequest(taskID: taskID, command: command, + clientRequestID: clientRequestID, batch: value.executionBatch ?? 9001) + requests.append(request) + activeCommands += 1 + maximumConcurrentCommands = max(maximumConcurrentCommands, activeCommands) + defer { activeCommands -= 1 } + if holdsCommands { + return try await withCheckedThrowingContinuation { continuations[clientRequestID] = $0 } + } + if let commandError { throw commandError } + return try request.receipt(changes: receiptChanges) + } + + /// 将指定请求完成为合成回执,保持同请求身份。 + func resolve(_ index: Int, changes: [String: Any] = [:]) throws { + let request = requests[index] + let result = try request.receipt(changes: changes) + continuations.removeValue(forKey: request.clientRequestID)?.resume(returning: result) + } + + /// 将指定请求完成为错误,即使其调用任务已经取消。 + func fail(_ index: Int, error: Error) { + continuations.removeValue(forKey: requests[index].clientRequestID)?.resume(throwing: error) + } + + /// 失败退出时释放所有测试 continuation,避免影响后续用例。 + func cancelAll() { + let pending = Array(continuations.values) + continuations.removeAll() + for continuation in pending { continuation.resume(throwing: CancellationError()) } + } +} diff --git a/suixinkanTests/DroneDockCommandViewModelTests.swift b/suixinkanTests/DroneDockCommandViewModelTests.swift new file mode 100644 index 0000000..0e7dc0e --- /dev/null +++ b/suixinkanTests/DroneDockCommandViewModelTests.swift @@ -0,0 +1,467 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 安全控制仅通过隔离服务验证请求、单次回查及重复操作保护,不连接后端或设备。 +@MainActor +final class DroneDockCommandViewModelTests: XCTestCase { + /// 正式页默认不注入控制服务,即使快照提供指令也不可发送。 + func testDefaultReadonlyModelCannotSendCommands() async throws { + let fixture = try CommandTaskFixture(allowCommands: false) + await fixture.model.refresh() + for command in DroneDockSafetyCommand.allCases { + XCTAssertFalse(fixture.model.canSendCommand(command)) + await fixture.model.sendCommand(command) + } + XCTAssertTrue(fixture.write.requests.isEmpty) + } + + /// 新版权限来自 flight_control,旧指令列表的顺序和文案不改变本地安全动作。 + func testFlightControlPermissionsDoNotUseStartGateOrLegacyCommands() async throws { + let fixture = try CommandTaskFixture() + fixture.read.result = .success(try CommandTaskData.snapshot(commands: ["unknown_command", "return_home", "flighttask_pause", "flighttask_pause"])) + await fixture.model.refresh() + XCTAssertEqual(Set(fixture.model.availableSafetyCommands), Set([.returnHome, .pause])) + XCTAssertEqual(fixture.model.response?.executeGate?.canExecute, false) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertFalse(fixture.model.canSendCommand(.resume)) + await fixture.model.sendCommand(.resume) + XCTAssertTrue(fixture.write.requests.isEmpty) + } + + /// 缺少明确任务身份、锁定飞机或当前指令时,不将其它状态字段推导为许可。 + func testIncompleteSnapshotCannotSendCommands() async throws { + for snapshot in [ + try CommandTaskData.snapshot(includeFlightControl: false), + try CommandTaskData.snapshot(lockedPlane: false), + try CommandTaskData.snapshot(includeTaskIdentity: false) + ] { + let fixture = try CommandTaskFixture() + fixture.read.result = .success(snapshot) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.write.requests.isEmpty) + } + } + + /// 接受回执时仍保留旧画面,只按随后同任务读取结果切换阶段,不轮询。 + func testSuccessRetainsSnapshotUntilSingleSameTaskRead() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + let paused = try CommandTaskData.snapshot(phase: "paused", commands: ["flighttask_recovery", "return_home"], version: 2) + fixture.write.onRequest = { fixture.read.result = .success(paused) } + var observedReceiptBeforeRefresh = false + await fixture.model.sendCommand(.pause) { + if fixture.model.commandResponse != nil && fixture.model.response == previous { + observedReceiptBeforeRefresh = true + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.isSendingCommand) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + } + } + XCTAssertTrue(observedReceiptBeforeRefresh) + XCTAssertEqual(fixture.write.requests.map(\.taskID), [501]) + XCTAssertEqual(fixture.write.requests.map(\.command), [.pause]) + XCTAssertEqual(fixture.read.requests, [501, 501]) + XCTAssertEqual(fixture.model.response, paused) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertNotNil(fixture.model.commandResponse?.dataJSON) + XCTAssertFalse(fixture.model.isSendingCommand) + XCTAssertNil(fixture.model.activeCommand) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + } + + /// 回查仍返回旧指令时,不重复提交已受理的同一指令。 + func testAcceptedCommandCannotRepeatFromStaleSnapshot() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + fixture.model.invalidate(preservingSnapshot: true) + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.write.requests.count, 1) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + } + + /// 暂停等待确认仅锁住暂停,仍可提交后端允许的返航,且不覆盖中央业务阶段。 + func testAcceptedPauseDoesNotBlockIndependentReturnCommand() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + await fixture.model.sendCommand(.returnHome) + XCTAssertFalse(fixture.model.canSendCommand(.returnHome)) + await fixture.model.sendCommand(.returnHome) + XCTAssertEqual(fixture.write.requests.map(\.command), [.pause, .returnHome]) + XCTAssertEqual(Set(fixture.write.requests.map(\.clientRequestID)).count, 2) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + } + + /// 暂停、恢复再暂停使用新的权限快照,可按用户操作继续调试同一任务。 + func testPauseResumeCycleAcceptsFreshCommandAvailability() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "paused", commands: ["flighttask_recovery", "return_home"], version: 2)) + await fixture.model.sendCommand(.pause) + fixture.read.result = .success(try CommandTaskData.snapshot(version: 3)) + await fixture.model.sendCommand(.resume) + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "paused", commands: ["flighttask_recovery", "return_home"], version: 4)) + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.write.requests.map(\.command), [.pause, .resume, .pause]) + XCTAssertEqual(fixture.read.requests, [501, 501, 501, 501]) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + } + + /// 明确业务拒绝保留旧状态,只在再次点击时重试。 + func testBusinessRejectionAllowsExplicitRetryWithoutRead() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.write.result = .failure(APIError.serverCode(100099, "模拟设备拒绝暂停")) + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.write.requests.count, 1) + XCTAssertEqual(fixture.read.requests.count, 1) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertEqual(fixture.model.commandErrorMessage, "模拟设备拒绝暂停") + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + fixture.write.result = nil + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.write.requests.count, 2) + XCTAssertNil(fixture.model.commandErrorMessage) + XCTAssertNotNil(fixture.model.commandResponse) + } + + /// 网络或解析失败仅锁定结果未知的动作及开拍,另一安全动作仍可依据可信权限执行。 + func testUnknownOutcomeLocksSameCommandAndStartAcrossRefresh() async throws { + for error in [APIError.networkFailed("模拟超时"), APIError.httpStatus(500, "模拟异常"), APIError.decodeFailed("模拟回执无法解析")] { + let fixture = try CommandTaskFixture() + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "arrived_pending_start")) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canStartShooting) + let previous = fixture.model.response + fixture.write.result = .failure(error) + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.commandOutcomeUnknown) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + fixture.model.invalidate(preservingSnapshot: true) + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + await fixture.model.startShooting() + XCTAssertEqual(fixture.write.requests.count, 1) + XCTAssertTrue(fixture.start.requests.isEmpty) + } + } + + /// 后端明确拒绝不误判为结果未知,刷新和页面离开均不自动重发。 + func testBusinessRejectionIsNotAnUnknownRemoteOutcome() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + fixture.write.result = .failure(APIError.serverCode(100050, "服务暂不可用,请稍后重试")) + await fixture.model.sendCommand(.pause) + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertEqual(fixture.model.commandErrorMessage, "服务暂不可用,请稍后重试") + XCTAssertNil(fixture.model.commandResponse) + XCTAssertEqual(fixture.read.requests.count, 1) + } + + /// 指令在途时拒绝同按钮连点与开拍,但不无条件禁用另一安全按钮。 + func testPendingCommandRejectsDoubleTapAndStartWithoutBlockingReturn() async throws { + let fixture = try CommandTaskFixture() + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "arrived_pending_start")) + await fixture.model.refresh() + let previous = fixture.model.response + fixture.write.suspend = true + let sent = expectation(description: "指令进入隔离服务") + fixture.write.onRequest = { sent.fulfill() } + let pending = Task { await fixture.model.sendCommand(.pause) } + await fulfillment(of: [sent], timeout: 2) + XCTAssertTrue(fixture.model.isSendingCommand) + XCTAssertEqual(fixture.model.response, previous) + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + await fixture.model.startShooting() + XCTAssertEqual(fixture.write.requests.count, 1) + XCTAssertTrue(fixture.start.requests.isEmpty) + XCTAssertEqual(fixture.read.requests.count, 1) + fixture.write.finish() + await pending.value + XCTAssertEqual(fixture.read.requests.count, 2) + } + + /// 开拍在途时底部指令也保持互斥,不产生第二条控制请求。 + func testPendingStartRejectsCommands() async throws { + let fixture = try CommandTaskFixture() + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "arrived_pending_start")) + await fixture.model.refresh() + fixture.start.suspend = true + let sent = expectation(description: "开拍进入隔离服务") + fixture.start.onRequest = { sent.fulfill() } + let pending = Task { await fixture.model.startShooting() } + await fulfillment(of: [sent], timeout: 2) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.write.requests.isEmpty) + fixture.start.finish() + await pending.value + } + + /// 取消、离页后的迟到成功不能回填,也不能触发新的 shooting 读取。 + func testCancelledOrInvalidatedRequestIgnoresLateReceipt() async throws { + for leavePage in [false, true] { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.write.suspend = true + let sent = expectation(description: "指令等待取消") + fixture.write.onRequest = { sent.fulfill() } + let pending = Task { await fixture.model.sendCommand(.pause) } + await fulfillment(of: [sent], timeout: 2) + if leavePage { fixture.model.invalidate(preservingSnapshot: true) } else { pending.cancel() } + fixture.write.finish() + await pending.value + XCTAssertTrue(fixture.model.commandOutcomeUnknown) + XCTAssertNil(fixture.model.commandResponse) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertEqual(fixture.read.requests.count, 1) + XCTAssertFalse(fixture.model.isSendingCommand) + XCTAssertNil(fixture.model.activeCommand) + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.write.requests.count, 1) + } + } + + /// 点击前身份变化不发送;在途身份变化则撤下旧任务及回执。 + func testIdentityChangeBeforeOrDuringCommandClearsSnapshot() async throws { + let before = try CommandTaskFixture() + await before.model.refresh() + before.scope.scenicID = 999 + await before.model.sendCommand(.pause) + XCTAssertTrue(before.write.requests.isEmpty) + XCTAssertNil(before.model.response) + + let during = try CommandTaskFixture() + await during.model.refresh() + during.write.suspend = true + let sent = expectation(description: "指令等待身份变化") + during.write.onRequest = { sent.fulfill() } + let pending = Task { await during.model.sendCommand(.pause) } + await fulfillment(of: [sent], timeout: 2) + during.scope.scenicID = 999 + during.write.finish() + await pending.value + XCTAssertNil(during.model.response) + XCTAssertNil(during.model.commandResponse) + XCTAssertNil(during.model.commandErrorMessage) + XCTAssertFalse(during.model.canSendCommand(.pause)) + XCTAssertEqual(during.read.requests.count, 1) + } + + /// 即使替身绕过 API 校验,任务或回显指令错误也不能接受为成功。 + func testMismatchedReceiptLocksOutcomeWithoutFollowupRead() async throws { + for receipt in [try CommandTaskData.receipt(command: .pause, taskID: 999), + try CommandTaskData.receipt(command: .returnHome)] { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + fixture.write.result = .success(receipt) + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.commandOutcomeUnknown) + XCTAssertNil(fixture.model.commandResponse) + XCTAssertEqual(fixture.read.requests.count, 1) + } + } + + /// 新版返航权限不会借旧 commands 开放取消返航,拍摄中断不能自动恢复。 + func testReturningDoesNotPermitLegacyCancelReturnCommand() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "returning", commands: ["return_home_cancel"], taskStatus: 40, version: 2)) + await fixture.model.sendCommand(.returnHome) + XCTAssertEqual(fixture.model.presentation.phase, .returning) + XCTAssertFalse(fixture.model.canSendCommand(.cancelReturn)) + XCTAssertFalse(fixture.model.canSendCommand(.resume)) + await fixture.model.sendCommand(.cancelReturn) + XCTAssertEqual(fixture.write.requests.map(\.command), [.returnHome]) + XCTAssertEqual(fixture.model.presentation.phase, .returning) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.availableSafetyCommands, [.pause]) + } + + /// 已接受后读取失败保留旧快照与本动作等待,另一安全动作仍使用已确认的许可。 + func testAcceptedCommandWithFailedReadKeepsSnapshotAndReceipt() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.read.result = .failure(APIError.networkFailed("模拟回查失败")) + await fixture.model.sendCommand(.pause) + XCTAssertNotNil(fixture.model.commandResponse) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + fixture.read.result = .success(try CommandTaskData.snapshot(phase: "paused", commands: ["flighttask_recovery", "return_home"], version: 2)) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + } + + /// 调用前已经取消的任务不能进入指令服务。 + func testCancellationBeforeSubmissionSendsNothing() async throws { + let fixture = try CommandTaskFixture() + await fixture.model.refresh() + let pending = Task { await fixture.model.sendCommand(.pause) } + pending.cancel() + await pending.value + XCTAssertTrue(fixture.write.requests.isEmpty) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + } +} + +/// 隔离账号、读取、开拍及安全控制依赖,共用匿名任务身份。 +@MainActor +private struct CommandTaskFixture { + let scope: CommandTaskScope + let read: CommandTaskReadService + let write: CommandTaskWriteService + let start: CommandTaskStartService + let model: DroneDockShootingTaskViewModel + + init(allowCommands: Bool = true) throws { + scope = CommandTaskScope() + read = CommandTaskReadService(result: .success(try CommandTaskData.snapshot())) + write = CommandTaskWriteService() + start = CommandTaskStartService() + let boundScope = scope + model = DroneDockShootingTaskViewModel(context: boundScope.value, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: read, startService: start, + commandService: allowCommands ? write : nil, currentContext: { boundScope.value }) + } +} + +/// 显式切换景区,不改动共享登录状态。 +@MainActor +private final class CommandTaskScope { + var scenicID = 128 + var value: DroneDockHomeContext { DroneDockShootingTaskTestData.context(scenicID: scenicID) } +} + +/// 只返回配置的内存快照,记录回查次数。 +@MainActor +private final class CommandTaskReadService: DroneDockShootingServing { + var result: Result + private(set) var requests: [Int] = [] + + init(result: Result) { self.result = result } + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + requests.append(taskID) + return try result.get() + } +} + +/// 支持挂起和错误注入的安全控制替身,不具有联网能力。 +@MainActor +private final class CommandTaskWriteService: DroneDockCommandSending { + var result: Result? + var onRequest: (() -> Void)? + var suspend = false + private(set) var requests: [(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String)] = [] + private var continuation: CheckedContinuation? + + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + requests.append((taskID, command, clientRequestID)) + onRequest?() + if suspend { return try await withCheckedThrowingContinuation { continuation = $0 } } + return try result?.get() ?? CommandTaskData.receipt(command: command, clientRequestID: clientRequestID) + } + + func finish() { + let receipt = result ?? Result { try CommandTaskData.receipt(command: requests.last?.command ?? .pause, clientRequestID: requests.last?.clientRequestID) } + continuation?.resume(with: receipt) + continuation = nil + } +} + +/// 仅用于确认开拍与安全控制互斥的内存替身。 +@MainActor +private final class CommandTaskStartService: DroneDockStartShooting { + var onRequest: (() -> Void)? + var suspend = false + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + requests.append(taskID) + onRequest?() + if suspend { return try await withCheckedThrowingContinuation { continuation = $0 } } + return try CommandTaskData.startReceipt() + } + + func finish() { + continuation?.resume(with: Result { try CommandTaskData.startReceipt() }) + continuation = nil + } +} + +/// 按接口合同构造的合成数据,不表示真实设备状态或受理回执。 +private enum CommandTaskData { + static func snapshot(phase: String = "shooting", commands: [String] = ["flighttask_pause", "return_home"], + taskStatus: Int = 20, lockedPlane: Bool = true, + includeTaskIdentity: Bool = true, includeFlightControl: Bool = true, + version: Int = 1) throws -> DroneDockShootingResponse { + var task: [String: Any] = ["status": taskStatus] + if includeTaskIdentity { task["id"] = 501 } + let paused = phase == "paused" + let returning = phase == "returning" + if returning { task["result_code"] = "return_home" } + let control = DroneDockShootingTaskTestData.flightControl( + state: paused ? "paused" : returning ? "returning" : "executing", + canPause: !paused, canResume: paused, canReturn: !returning, + resumePhase: paused ? "shooting" : returning ? "returning" : nil, + returnReason: returning ? "manual" : nil, isAirborne: true, + pauseReason: paused ? "manual" : phase == "arrived_pending_start" ? "arrival_wait" : nil) + return try DroneDockShootingTaskTestData.response(changes: [ + "execution_batch": 100, "state_version": version, "snapshot_kind": "full", + "flight_control": includeFlightControl ? control : NSNull(), + "order_flight_task": task, "task": task, + "current_plane": ["id": lockedPlane ? 58 : 0, "sn_number": "LOCAL-COMMAND-PLANE-058"], + "execute_gate": ["can_execute": phase == "arrived_pending_start", + "primary_action": phase == "arrived_pending_start" ? "start_shoot" : phase], + "ui": ["phase": paused ? "manual_paused" : returning ? "returning_home" : phase, "title": "模拟安全指令阶段", "message": "本地模拟,未发送设备指令", + "commands": commands.map { ["command": $0] }] + ]) + } + + static func receipt(command: DroneDockSafetyCommand, taskID: Int = 501, + clientRequestID: String? = nil) throws -> DroneDockCommandResponse { + let commandID = "local-\(command.rawValue)-\(clientRequestID ?? "fixture")" + let payload: [String: Any] = ["order_flight_task_id": taskID, "command": command.rawValue, + "accepted": true, "device_confirmed": false, "execution_batch": 100, + "command_id": commandID, "client_request_id": clientRequestID as Any? ?? NSNull(), + "pending_command": ["command_id": commandID, + "client_request_id": clientRequestID as Any? ?? NSNull(), + "command": command.rawValue, "status": "pending"], + "airport_sn": "LOCAL-COMMAND-PLANE-058", "plane_id": 58, + "dji_status": NSNull(), "metrics": []] + return try JSONDecoder().decode(DroneDockCommandResponse.self, + from: JSONSerialization.data(withJSONObject: payload)) + } + + static func startReceipt() throws -> DroneDockStartShootResponse { + try JSONDecoder().decode(DroneDockStartShootResponse.self, + from: Data(#"{"order_flight_task_id":501,"plane_id":58}"#.utf8)) + } +} diff --git a/suixinkanTests/DroneDockCommandViewTests.swift b/suixinkanTests/DroneDockCommandViewTests.swift new file mode 100644 index 0000000..f6314ab --- /dev/null +++ b/suixinkanTests/DroneDockCommandViewTests.swift @@ -0,0 +1,292 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用隔离的内存模拟入口检查任务页安全按钮,不连接后端或真实无人机。 +@MainActor +final class DroneDockCommandViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 暂停和继续点击即提交且不弹确认,连点仅提交一次,刷新期间保留旧数据与固定区域。 + func testPauseAndResumeUseSameTaskWithoutDuplicateRequestsOrLayoutChanges() async throws { + let controller = try makeController(result: "success") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canSendCommand(.pause) } + XCTAssertEqual(controller.title, "拍摄任务 · 本地模拟") + let pause = try button(controller, suffix: "pause") + let returnHome = try button(controller, suffix: "return") + let fixedIDs = ["top", "stateContainer", "safety"] + let frames = try fixedIDs.map { try XCTUnwrap(find(controller.view, suffix: $0)).frame } + let oldTitle = model.presentation.title + let oldBattery = find(controller.view, suffix: "metric.battery")?.accessibilityValue + + pause.sendActions(for: .touchUpInside) + pause.sendActions(for: .touchUpInside) + XCTAssertNil(controller.presentedViewController, "暂停直接提交,不显示确认弹窗") + XCTAssertFalse(pause.isEnabled) + XCTAssertTrue(returnHome.isEnabled) + XCTAssertEqual(model.presentation.title, oldTitle) + XCTAssertEqual(find(controller.view, suffix: "metric.battery")?.accessibilityValue, oldBattery) + + try await settle(window) { + model.canSendCommand(.resume) && !model.isSendingCommand + && pause.accessibilityLabel == "已暂停" + } + XCTAssertEqual(model.presentation.phase, .paused) + XCTAssertFalse(pause.isEnabled) + XCTAssertEqual(pause.accessibilityValue, "悬停待命") + XCTAssertEqual(returnHome.accessibilityLabel, "立即返航") + XCTAssertTrue(returnHome.isEnabled) + XCTAssertEqual(model.commandResponse?.command, "flighttask_pause") + assertFrames(controller, suffixes: fixedIDs, frames: frames) + capture(window, name: "安全控制-暂停成功-本地模拟") + + let resume = try button(controller, suffix: "primary") + XCTAssertEqual(resume.configuration?.title, "继续任务") + XCTAssertTrue(resume.isEnabled) + resume.sendActions(for: .touchUpInside) + resume.sendActions(for: .touchUpInside) + XCTAssertNil(controller.presentedViewController, "继续任务直接提交,不显示确认弹窗") + XCTAssertFalse(resume.isEnabled) + try await settle(window) { + model.canSendCommand(.pause) && !model.isSendingCommand + && (pause.accessibilityLabel?.contains("暂停") == true) + } + XCTAssertEqual(model.presentation.phase, .shooting) + XCTAssertEqual(model.commandResponse?.command, "flighttask_recovery") + assertFrames(controller, suffixes: fixedIDs, frames: frames) + capture(window, name: "安全控制-继续任务-本地模拟") + + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + XCTAssertEqual(entries.compactMap { $0["method"] as? String }, ["GET", "POST", "GET", "POST", "GET"]) + let posts = entries.filter { $0["method"] as? String == "POST" } + XCTAssertEqual(posts.compactMap { $0["path"] as? String }, Array(repeating: "/api/app/airport/command", count: 2)) + let bodies = posts.compactMap { $0["request_body"] as? [String: Any] } + XCTAssertEqual(bodies.compactMap { $0["id"] as? Int }, [901, 901]) + XCTAssertEqual(bodies.compactMap { $0["command"] as? String }, ["flighttask_pause", "flighttask_recovery"]) + for body in bodies { + XCTAssertEqual(Set(body.keys), ["id", "command", "client_request_id"]) + XCTAssertFalse(try XCTUnwrap(body["client_request_id"] as? String).isEmpty) + } + XCTAssertEqual(Set(bodies.compactMap { $0["client_request_id"] as? String }).count, 2) + } + + /// 返航点击即提交且不弹确认;同步锁覆盖连点,受理后仍等待同任务状态核对。 + func testReturnSubmitsImmediatelyOnceWithoutConfirmation() async throws { + let controller = try makeController(result: "success") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canSendCommand(.returnHome) } + let returnHome = try button(controller, suffix: "return") + let oldTitle = model.presentation.title + returnHome.sendActions(for: .touchUpInside) + returnHome.sendActions(for: .touchUpInside) + XCTAssertNil(controller.presentedViewController, "返航直接提交,不需要再次确认") + XCTAssertFalse(returnHome.isEnabled) + XCTAssertTrue(try XCTUnwrap(find(controller.view, suffix: "return.loading") as? UIActivityIndicatorView).isAnimating) + XCTAssertEqual(model.presentation.title, oldTitle, "点击本身不伪造设备已返航状态") + try await settle(window) { model.presentation.phase == .returning && !model.isSendingCommand } + XCTAssertNil(controller.presentedViewController) + XCTAssertFalse(returnHome.isEnabled) + XCTAssertEqual(model.commandResponse?.command, DroneDockSafetyCommand.returnHome.rawValue) + XCTAssertFalse(model.shouldPresentRecordingCompletion) + returnHome.sendActions(for: .touchUpInside) + capture(window, name: "安全控制-直接返航-本地模拟") + + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(entries.compactMap { $0["method"] as? String }, ["GET", "POST", "GET"]) + let posts = entries.filter { $0["method"] as? String == "POST" } + XCTAssertEqual(posts.count, 1) + XCTAssertEqual(posts.first?["path"] as? String, "/api/app/airport/command") + let body = try XCTUnwrap(posts.first?["request_body"] as? [String: Any]) + XCTAssertEqual(body["id"] as? Int, 901) + XCTAssertEqual(body["command"] as? String, "return_home") + XCTAssertFalse(try XCTUnwrap(body["client_request_id"] as? String).isEmpty) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + } + + /// 明确拒绝保留原任务状态,只在用户再次点击后重发,不创建或召唤新任务。 + func testBusinessFailurePreservesSnapshotAndAllowsExplicitRetry() async throws { + let controller = try makeController(result: "business-failure") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canSendCommand(.pause) } + let original = model.response + let pause = try button(controller, suffix: "pause") + pause.sendActions(for: .touchUpInside) + try await settle(window) { model.commandErrorMessage != nil && model.canSendCommand(.pause) && pause.isEnabled } + XCTAssertEqual(model.response, original) + XCTAssertFalse(model.commandOutcomeUnknown) + XCTAssertNil(model.commandResponse) + pause.sendActions(for: .touchUpInside) + try await settle(window) { model.commandErrorMessage != nil && model.canSendCommand(.pause) && pause.isEnabled } + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(entries.compactMap { $0["method"] as? String }, ["GET", "POST", "POST"]) + XCTAssertEqual(entries.filter { $0["method"] as? String == "POST" }.compactMap { $0["path"] as? String }, + Array(repeating: "/api/app/airport/command", count: 2)) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + } + + /// 超时保留旧数据且仅锁定结果未知的暂停动作,另一安全按钮和只读刷新继续可用。 + func testTimeoutLocksOnlyAffectedSafetyButtonWhileReadRefreshRemainsAvailable() async throws { + let controller = try makeController(result: "timeout") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canSendCommand(.pause) } + let original = model.response + let pause = try button(controller, suffix: "pause") + let returnHome = try button(controller, suffix: "return") + pause.sendActions(for: .touchUpInside) + try await settle(window) { model.commandOutcomeUnknown && !model.isSendingCommand } + XCTAssertEqual(model.response, original) + XCTAssertFalse(pause.isEnabled) + XCTAssertTrue(returnHome.isEnabled) + XCTAssertFalse(model.canStartShooting) + XCTAssertFalse(model.canSendCommand(.pause)) + let refresh = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.remote.navigationRefresh" + }) + XCTAssertTrue(refresh.isEnabled) + send(refresh) + try await settle(window) { !model.isLoading && refresh.isEnabled } + XCTAssertTrue(model.commandOutcomeUnknown) + XCTAssertFalse(pause.isEnabled) + XCTAssertTrue(returnHome.isEnabled) + capture(window, name: "安全控制-结果待核对-本地模拟") + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(entries.filter { $0["method"] as? String == "POST" }.count, 1) + XCTAssertEqual(entries.filter { $0["method"] as? String == "GET" }.count, 2) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + } + + /// 未注入指令服务的只读页面即使收到可用指令,也不提供无法执行的操作。 + func testReadOnlyEntryKeepsSafetyButtonsDisabledWhenSnapshotOffersCommands() async throws { + let context = DroneDockShootingTaskTestData.context() + let response = try DroneDockShootingTaskTestData.response(changes: [ + "order_flight_task": ["id": 501, "status": 20, "wayline_task_id": 9001], + "task": ["id": 501, "status": 20, "wayline_task_id": 9001], + "execution_batch": 9001, "state_version": 1, + "flight_control": ["state": "executing", "execution_batch": 9001, + "is_airborne": true, + "drone_in_dock": "outside", "can_pause": true, "can_resume": false, "can_return_home": true], + "ui": ["phase": "shooting", "title": "拍摄中", "commands": [ + ["command": "flighttask_pause", "label": "紧急暂停"], + ["command": "return_home", "label": "立即返航"] + ]] + ]) + let service = DroneDockShootingTaskTestService(result: .success(response)) + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model) + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { model.response != nil && !model.isLoading } + let pause = try button(controller, suffix: "pause") + let returnHome = try button(controller, suffix: "return") + XCTAssertFalse(pause.isEnabled) + XCTAssertFalse(returnHome.isEnabled) + pause.sendActions(for: .touchUpInside) + returnHome.sendActions(for: .touchUpInside) + XCTAssertNil(controller.presentedViewController) + XCTAssertFalse(model.isSendingCommand) + XCTAssertNil(model.commandResponse) + XCTAssertEqual(service.requests.count, 1) + } + + private func makeController(result: String) throws -> DroneDockShootingTaskViewController { + try XCTUnwrap(DroneDockStartShootSimulation.makeController(arguments: [ + "--dock-command-mock", "--dock-command-result=\(result)" + ]) as? DroneDockShootingTaskViewController) + } + + private func button(_ controller: UIViewController, suffix: String) throws -> UIButton { + try XCTUnwrap(find(controller.view, suffix: suffix) as? UIButton) + } + + private func records(_ controller: UIViewController, window: UIWindow) async throws -> [String: Any] { + let item = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.mock.recordsButton" + }) + XCTAssertTrue(item.isEnabled) + send(item) + try await settle(window) { controller.presentedViewController != nil } + let sheet = try XCTUnwrap(controller.presentedViewController) + let text = try XCTUnwrap(allViews(sheet.view).first { + $0.accessibilityIdentifier == "drone.task.mock.records" + } as? UITextView) + let attachment = XCTAttachment(data: Data(text.text.utf8), uniformTypeIdentifier: "public.json") + attachment.name = "安全控制模拟回执" + attachment.lifetime = .keepAlways + add(attachment) + return try XCTUnwrap(JSONSerialization.jsonObject(with: Data(text.text.utf8)) as? [String: Any]) + } + + private func assertFrames(_ controller: UIViewController, suffixes: [String], frames: [CGRect]) { + for (suffix, frame) in zip(suffixes, frames) { XCTAssertEqual(find(controller.view, suffix: suffix)?.frame, frame) } + } + + private func capture(_ window: UIWindow, name: String) { + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } + + private func send(_ item: UIBarButtonItem) { + guard let action = item.action else { return XCTFail("缺少导航操作") } + _ = UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + + private func makeWindow(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<250 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 100_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("本地安全指令页面未在预期时间内完成状态更新") + throw NSError(domain: "DroneDockCommandViewTests", code: 1) + } + + private func find(_ root: UIView, suffix: String) -> UIView? { + allViews(root).first { $0.accessibilityIdentifier == "drone.task.remote.\(suffix)" } + } + + private func allViews(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews($0) } } +} diff --git a/suixinkanTests/DroneDockConfirmationAPITests.swift b/suixinkanTests/DroneDockConfirmationAPITests.swift new file mode 100644 index 0000000..ad42a2b --- /dev/null +++ b/suixinkanTests/DroneDockConfirmationAPITests.swift @@ -0,0 +1,161 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用隔离网络替身验证游客确认码的请求、响应与整单只读查询。 +@MainActor +final class DroneDockConfirmationAPITests: XCTestCase { + private let number = "TEST-CONFIRM-ORDER" + private let imageAddress = "https://example.invalid/mini_qr/confirm.png" + + /// 生成确认码只传景区和完整订单号,复用当前摄影师登录凭证。 + func testCreateSendsDocumentedBodyAndToken() async throws { + let session = MockURLSession(responses: [try envelope(code())]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "confirmation-test-token" } + let result = try await DroneDockConfirmationAPI(client: client) + .createConfirmation(scenicID: 128, orderNumber: number) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/orders/confirm-code") + XCTAssertNil(request.url?.query) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "confirmation-test-token") + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["scenic_id", "order_number"]) + XCTAssertEqual(body["scenic_id"] as? Int, 128) + XCTAssertEqual(body["order_number"] as? String, number) + XCTAssertEqual(result.orderNumber, number) + XCTAssertEqual(result.confirmStatus, 1) + XCTAssertEqual(result.confirmURL, imageAddress) + XCTAssertEqual(result.imageURL.absoluteString, imageAddress) + } + + /// 刷新只读订单摘要和任务,不生成确认记录、创建任务或向无人机发指令。 + func testConfirmationReusesScopedReadOnlyQueries() async throws { + let detail: [String: Any] = ["order_number": number, "can_confirm": true, "confirm_status": 1, + "order_status": 20, "film_count": 0, "spot": []] + let tasks: [String: Any] = ["order_number": number, "total": 0, "list": []] + let session = MockURLSession(responses: [try envelope(detail), try envelope(tasks), try envelope(tasks)]) + let api = DroneDockConfirmationAPI(client: APIClient(environment: .testing, session: session)) + let result = try await api.detail(scenicID: 128, orderNumber: number) + _ = try await api.tasks(scenicID: 128, orderNumber: number, spotID: nil) + _ = try await api.tasks(scenicID: 128, orderNumber: number, spotID: 201) + XCTAssertEqual(result.order.canConfirm, true) + XCTAssertEqual(result.order.orderStatus, 20) + XCTAssertEqual(result.order.filmCount, 0) + XCTAssertEqual(session.requests.map { $0.url?.path }, [ + "/api/yf-handset-app/photog/multi-plane/orders/detail", + "/api/yf-handset-app/photog/multi-plane/tasks", + "/api/yf-handset-app/photog/multi-plane/tasks" + ]) + for (index, request) in session.requests.enumerated() { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertNil(request.httpBody) + var expected = ["scenic_id": "128", "order_number": number] + if index == 2 { expected["scenic_spot_id"] = "201" } + XCTAssertEqual(try query(request), expected) + } + } + + /// 无效页面范围在发送前拒绝,订单号不做截断或自动修正。 + func testInvalidScopeNeverReachesNetwork() async { + let session = MockURLSession(responses: []) + let api = DroneDockConfirmationAPI(client: APIClient(environment: .testing, session: session)) + for (scenicID, order) in [(0, number), (-1, number), (128, ""), (128, " \n"), + (128, " TEST"), (128, "TEST\nORDER"), (128, String(repeating: "T", count: 129))] { + await assertFailure { _ = try await api.createConfirmation(scenicID: scenicID, orderNumber: order) } + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 后端拒绝原样展示;重试由页面发起,失败请求不自动冒充待确认成功。 + func testBackendFailurePreservesMessageAndAllowsExplicitRetry() async throws { + let session = MockURLSession(responses: [ + try TestJSON.errorEnvelope(code: 160001, msg: "确认码生成失败,请重试"), try envelope(code()) + ]) + let api = DroneDockConfirmationAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.createConfirmation(scenicID: 128, orderNumber: number) + XCTFail("应保留后端拒绝") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "确认码生成失败,请重试") + } + XCTAssertEqual(session.requests.count, 1) + let result = try await api.createConfirmation(scenicID: 128, orderNumber: number) + XCTAssertEqual(result.confirmStatus, 1) + XCTAssertEqual(session.requests.count, 2) + } + + /// 其他订单的确认码不能在当前订单展示。 + func testMismatchedOrderResponseIsRejected() async throws { + var payload = code() + payload["order_number"] = "OTHER-ORDER" + let session = MockURLSession(responses: [try envelope(payload)]) + let api = DroneDockConfirmationAPI(client: APIClient(environment: .testing, session: session)) + await assertFailure { _ = try await api.createConfirmation(scenicID: 128, orderNumber: self.number) } + } + + /// 状态兼容整数字符串,图片地址可带合法查询参数且保持原样。 + func testCodeAcceptsStringStatusAndRemoteImageQuery() throws { + var payload = code() + payload["confirm_status"] = "1" + payload["confirm_url"] = "http://example.invalid/mini_qr/confirm.png?version=2" + let result = try decode(payload) + XCTAssertEqual(result.confirmStatus, 1) + XCTAssertEqual(result.imageURL.absoluteString, payload["confirm_url"] as? String) + } + + /// 缺失、空值、错误类型或非待确认状态不能被当成有效确认邀请。 + func testMalformedCodeAndUnexpectedStatusAreRejected() throws { + for key in ["order_number", "confirm_status", "confirm_url"] { + var missing = code(); missing.removeValue(forKey: key) + XCTAssertThrowsError(try decode(missing), key) + var null = code(); null[key] = NSNull() + XCTAssertThrowsError(try decode(null), key) + } + for status: Any in [0, 2, -1, true, "unknown", 1.5, [:] as [String: Any]] { + var value = code(); value["confirm_status"] = status + XCTAssertThrowsError(try decode(value)) + } + for order: Any in ["", " \n", " TEST", "TEST\nORDER", 123, String(repeating: "T", count: 129)] { + var value = code(); value["order_number"] = order + XCTAssertThrowsError(try decode(value)) + } + } + + /// 只接受可远程加载的 HTTP(S) 地址,不接受本地路径、凭据或无主机的 URL。 + func testInvalidImageAddressesAreRejected() throws { + for address in ["", "/tmp/confirm.png", "file:///tmp/confirm.png", "data:image/png;base64,abcd", + "ftp://example.invalid/confirm.png", "https:///confirm.png", "https://", + "https://user:password@example.invalid/confirm.png", "https://user@example.invalid/confirm.png", + " https://example.invalid/confirm.png", "https://example.invalid/confirm code.png", + "https://example.invalid/confirm\ncode.png", "https://example.invalid/" + String(repeating: "a", count: 2048)] { + var payload = code(); payload["confirm_url"] = address + XCTAssertThrowsError(try decode(payload), address) + } + } + + private func code() -> [String: Any] { + ["order_number": number, "confirm_status": 1, "confirm_url": imageAddress] + } + + private func envelope(_ value: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": value]) + } + + private func decode(_ value: [String: Any]) throws -> DroneDockConfirmationCode { + try JSONDecoder().decode(DroneDockConfirmationCode.self, from: JSONSerialization.data(withJSONObject: value)) + } + + private func query(_ request: URLRequest) throws -> [String: String] { + let url = try XCTUnwrap(request.url) + let items = try XCTUnwrap(URLComponents(url: url, resolvingAgainstBaseURL: false)).queryItems ?? [] + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } + + private func assertFailure(_ action: () async throws -> Void, file: StaticString = #filePath, line: UInt = #line) async { + do { try await action(); XCTFail("应拒绝无效确认结果", file: file, line: line) } catch {} + } +} diff --git a/suixinkanTests/DroneDockConfirmationNavigationTests.swift b/suixinkanTests/DroneDockConfirmationNavigationTests.swift new file mode 100644 index 0000000..386ed5c --- /dev/null +++ b/suixinkanTests/DroneDockConfirmationNavigationTests.swift @@ -0,0 +1,205 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 正式首页与订单列表共用确认入口;导航仅传递订单范围,不自动创建确认码。 +@MainActor +final class DroneDockConfirmationNavigationTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + private let number = "TEST-CONFIRM-NAV" + + /// 首页邀请确认传入选中订单并阻止连点重复入栈,返回后重读首页摘要。 + func testHomeInvitationPassesScopeOnceAndRefreshesAfterReturning() async throws { + let context = makeContext() + let service = try ConfirmationNavigationService(number: number) + let model = DroneDockHomeViewModel(context: context, service: service, currentContext: { context }) + let destination = UIViewController() + var received: [(DroneDockHomeOrder, DroneDockHomeContext)] = [] + let controller = DroneDockHomeViewController(viewModel: model, confirmationControllerFactory: { order, scope in + received.append((order, scope)) + return destination + }) + let window = show(controller) + defer { close(window) } + let list = try collection(controller.view, "drone.home.remote.list") + try await settle(window) { model.orders.count == 1 && !model.isLoading && list.numberOfItems(inSection: 2) == 1 } + list.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(controller.view, "drone.home.order.\(self.number).primary") != nil } + let invite = try control(controller.view, "drone.home.order.\(number).primary") + invite.sendActions(for: .touchUpInside) + invite.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { navigation.topViewController === destination && navigation.transitionCoordinator == nil } + XCTAssertEqual(received.count, 1) + XCTAssertEqual(received.first?.0.orderNumber, number) + XCTAssertEqual(received.first?.1, context) + XCTAssertEqual(navigation.viewControllers.count, 2) + let readsBeforeReturning = service.orderReadCount + navigation.popViewController(animated: false) + try await settle(window) { service.orderReadCount > readsBeforeReturning && !model.isLoading } + XCTAssertEqual(service.calls.filter { $0 == "home" }.count, 2) + XCTAssertTrue(service.calls.allSatisfy { ["home", "orders", "today-stats"].contains($0) }) + } + + /// 从首页进入全部订单仍使用相同确认工厂,而不是落入演示页或占位提示。 + func testAllOrdersInheritsHomeConfirmationFactory() async throws { + let context = makeContext() + let service = try ConfirmationNavigationService(number: number) + let model = DroneDockHomeViewModel(context: context, service: service, currentContext: { context }) + let destination = UIViewController() + var received: [(DroneDockHomeOrder, DroneDockHomeContext)] = [] + let controller = DroneDockHomeViewController(viewModel: model, confirmationControllerFactory: { order, scope in + received.append((order, scope)) + return destination + }) + let window = show(controller) + defer { close(window) } + let list = try collection(controller.view, "drone.home.remote.list") + try await settle(window) { model.orders.count == 1 && !model.isLoading && list.numberOfItems(inSection: 2) == 1 } + list.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(controller.view, "drone.home.allOrders") != nil } + try control(controller.view, "drone.home.allOrders").sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { + guard let orders = navigation.topViewController as? DroneDockOrdersViewController else { return false } + return orders.viewModel.orders.count == 1 && !orders.viewModel.isLoading && navigation.transitionCoordinator == nil + } + let orders = try XCTUnwrap(navigation.topViewController as? DroneDockOrdersViewController) + try await settle(window) { self.find(orders.view, "drone.orders.order.\(self.number).confirmation") != nil } + try control(orders.view, "drone.orders.order.\(number).confirmation").sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController === destination && navigation.transitionCoordinator == nil } + XCTAssertEqual(received.count, 1) + XCTAssertEqual(received.first?.0.orderNumber, number) + XCTAssertEqual(received.first?.1, context) + XCTAssertNil(orders.presentedViewController) + XCTAssertEqual(navigation.viewControllers.count, 3) + } + + /// 订单主按钮、邀请确认摘要和已确认记录都进入同一正式页面。 + func testOrdersInvitationAndCompletedRecordUseSharedFactory() async throws { + for (completed, suffix) in [(false, "primary"), (false, "confirmation"), (true, "confirmation")] { + let context = makeContext() + let service = try ConfirmationNavigationService(number: number, completed: completed) + let model = DroneDockOrdersViewModel(context: context, service: service, currentContext: { context }) + let destination = UIViewController() + var received: [(DroneDockHomeOrder, DroneDockHomeContext)] = [] + let controller = DroneDockOrdersViewController(viewModel: model, + preparationControllerFactory: { _, _ in XCTFail("确认入口不能进入拍摄准备"); return UIViewController() }, + materialsControllerFactory: { _, _ in XCTFail("确认入口不能进入素材库"); return UIViewController() }, + confirmationControllerFactory: { order, scope in received.append((order, scope)); return destination }) + let window = show(controller) + defer { close(window) } + try await settle(window) { model.orders.count == 1 && !model.isLoading && self.find(controller.view, "drone.orders.order.\(self.number).\(suffix)") != nil } + let invite = try control(controller.view, "drone.orders.order.\(number).\(suffix)") + XCTAssertTrue(invite.isEnabled) + if completed { XCTAssertTrue(invite.accessibilityLabel?.contains("查看记录") == true) } + invite.sendActions(for: .touchUpInside) + invite.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { navigation.topViewController === destination && navigation.transitionCoordinator == nil } + XCTAssertEqual(received.count, 1) + XCTAssertEqual(received.first?.0.orderNumber, number) + XCTAssertEqual(received.first?.0.orderStatus, completed ? 30 : 20) + XCTAssertEqual(received.first?.1, context) + XCTAssertEqual(service.calls, ["orders"]) + let reads = service.orderReadCount + navigation.popViewController(animated: false) + try await settle(window) { service.orderReadCount > reads && !model.isLoading } + } + } + + private func makeContext() -> DroneDockHomeContext { + DroneDockHomeContext(userID: "confirmation-nav-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "confirmation-nav-token") + } + + private func show(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.rootViewController = UINavigationController(rootViewController: controller) + window.overrideUserInterfaceStyle = .light + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func collection(_ root: UIView, _ id: String) throws -> UICollectionView { + try XCTUnwrap(find(root, id) as? UICollectionView) + } + + private func control(_ root: UIView, _ id: String) throws -> UIControl { + try XCTUnwrap(find(root, id) as? UIControl) + } + + private func find(_ root: UIView, _ id: String) -> UIView? { + if root.accessibilityIdentifier == id { return root } + return root.subviews.lazy.compactMap { self.find($0, id) }.first + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 250_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("确认入口导航未完成") + throw NSError(domain: "DroneDockConfirmationNavigationTests", code: 1) + } +} + +/// 完全内存的首页与订单服务,记录只读调用并始终返回同一测试订单。 +@MainActor +private final class ConfirmationNavigationService: DroneDockHomeServing { + private let orderPayload: [String: Any] + private(set) var calls: [String] = [] + /// 用于验证返回来源页后再次读取订单。 + var orderReadCount: Int { calls.filter { $0 == "orders" }.count } + + /// 构造可邀请或已确认摘要,不包含成片、真实设备和任何写接口。 + init(number: String, completed: Bool = false) throws { + let payload: [String: Any] = ["order_number": number, "project_id": 101, + "user_phone": "130****0001", "project_name": "测试套餐", "shoot_count": 1, + "shot_count": 1, "remaining_count": 0, "shoot_status": completed ? "completed" : "processing", + "order_status": completed ? 30 : 20, "material_status": 0, "film_count": 0, + "can_create_task": false, "can_upload_film": !completed, "can_confirm": !completed, + "confirm_status": completed ? 2 : 0] + _ = try JSONDecoder().decode(DroneDockHomeOrder.self, from: JSONSerialization.data(withJSONObject: payload)) + orderPayload = payload + } + + /// 首页设备只提供显式空数组。 + func home(scenicID: Int, storeID: Int) async throws -> DroneDockHomeResponse { + calls.append("home") + return try decode(["scenic_id": scenicID, "airports": []]) + } + + /// 返回当前页面请求的页码及同一订单摘要。 + func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse { + calls.append("orders") + return try decode(["list": [orderPayload], "total": 1, "page": page, "page_size": pageSize]) + } + + /// 统计不参与确认入口判断。 + func todayStats(scenicID: Int) async throws -> DroneDockHomeToday { + calls.append("today-stats") + return try decode(["deal_count": 0, "deal_amount": "0.00", "completed_count": 0]) + } + + private func decode(_ payload: [String: Any]) throws -> T { + try JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: payload)) + } +} diff --git a/suixinkanTests/DroneDockConfirmationViewModelTests.swift b/suixinkanTests/DroneDockConfirmationViewModelTests.swift new file mode 100644 index 0000000..ee18b85 --- /dev/null +++ b/suixinkanTests/DroneDockConfirmationViewModelTests.swift @@ -0,0 +1,385 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 确认交付使用隔离服务替身,不创建真实确认记录或调用任何设备接口。 +@MainActor +final class DroneDockConfirmationViewModelTests: XCTestCase { + /// 首屏只查询摘要及整单任务;无云端成片仍可在核对后邀请确认。 + func testEmptyFilmsAllowInvitationAfterExplicitReview() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + XCTAssertEqual(fixture.service.events, ["detail", "tasks"]) + XCTAssertTrue(fixture.model.hasLoadedTasks) + XCTAssertTrue(fixture.model.tasks.isEmpty) + XCTAssertFalse(fixture.model.isReviewed) + XCTAssertFalse(fixture.model.canGenerate) + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.createCalls, 0) + fixture.model.setReviewed(true) + XCTAssertTrue(fixture.model.canGenerate) + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.events, ["detail", "tasks", "detail", "create"]) + XCTAssertEqual(fixture.model.code?.confirmStatus, 1) + XCTAssertEqual(fixture.model.order.orderStatus, 20) + XCTAssertEqual(fixture.model.order.confirmStatus, 0) + XCTAssertFalse(fixture.model.isCompleted) + } + + /// 执行订单的素材上传不能替代后端确认许可、清单读取和人工核对。 + func testUploadingMaterialsKeepInvitationPermissionReadAndReviewGates() async throws { + let fixture = try ConfirmationVMFixture() + fixture.service.detailValue = try ConfirmationVMData.detail(allowed: false, materialStatus: 2, activeTaskStatus: 25) + await fixture.model.refresh() + fixture.model.setReviewed(true) + await fixture.model.generateCode() + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertEqual(fixture.service.createCalls, 0) + + fixture.service.detailValue = try ConfirmationVMData.detail(materialStatus: 2, activeTaskStatus: 25) + fixture.service.tasksError = APIError.networkFailed("测试清单读取失败") + await fixture.model.refresh() + fixture.model.setReviewed(true) + await fixture.model.generateCode() + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertEqual(fixture.service.createCalls, 0) + + fixture.service.tasksError = nil + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canGenerate) + fixture.model.setReviewed(true) + XCTAssertTrue(fixture.model.canGenerate) + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.createCalls, 1) + XCTAssertEqual(fixture.model.order.orderStatus, 20) + XCTAssertTrue(fixture.model.isAwaitingConfirmation) + XCTAssertFalse(fixture.model.isCompleted) + } + + /// 素材上传失败不增加文档之外的交付确认门槛。 + func testMaterialFailureDoesNotOverrideBackendConfirmationPermission() async throws { + let fixture = try ConfirmationVMFixture() + fixture.service.records = [ConfirmationVMData.task(materialStatus: 3)] + await fixture.model.refresh() + fixture.model.setReviewed(true) + await fixture.model.generateCode() + XCTAssertEqual(fixture.model.tasks.first?.materialStatus, 3) + XCTAssertEqual(fixture.service.createCalls, 1) + XCTAssertNotNil(fixture.model.code) + } + + /// 未完成读取、无权限及已完成订单均不能勾选后发起写请求。 + func testMissingPermissionOrCompletedOrderNeverGeneratesCode() async throws { + for (allowed, status) in [(false, 20), (true, 25), (true, 30), (true, 40)] { + let fixture = try ConfirmationVMFixture() + fixture.service.detailValue = try ConfirmationVMData.detail(allowed: allowed, status: status) + fixture.model.setReviewed(true) + XCTAssertFalse(fixture.model.isReviewed) + await fixture.model.refresh() + fixture.model.setReviewed(true) + await fixture.model.generateCode() + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertFalse(fixture.model.isReviewed) + XCTAssertEqual(fixture.service.createCalls, 0) + XCTAssertEqual(fixture.model.isCompleted, status == 30) + } + } + + /// 刷新只读取摘要;确认状态 2 本身不等于订单已完成。 + func testOnlyOrderStatusThirtyCompletesAndRemovesOldCode() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.prepareCode() + fixture.service.events.removeAll() + fixture.service.detailValue = try ConfirmationVMData.detail(confirmStatus: 2) + await fixture.model.refreshStatus() + XCTAssertEqual(fixture.service.events, ["detail"]) + XCTAssertFalse(fixture.model.isCompleted) + XCTAssertNotNil(fixture.model.code) + fixture.service.detailValue = try ConfirmationVMData.detail(allowed: false, status: 30, confirmStatus: 2) + await fixture.model.refreshStatus() + XCTAssertTrue(fixture.model.isCompleted) + XCTAssertNil(fixture.model.code) + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertEqual(fixture.service.createCalls, 1) + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.createCalls, 1) + } + + /// 网络失败不将已经展示的码、订单与清单切换成空数据。 + func testStatusRefreshFailurePreservesExistingCodeAndSnapshot() async throws { + let fixture = try ConfirmationVMFixture() + fixture.service.records = [ConfirmationVMData.task()] + await fixture.prepareCode() + let previousCode = fixture.model.code + let previousDetail = fixture.model.detail + let previousTasks = fixture.model.tasks + fixture.service.detailError = APIError.networkFailed("测试网络错误") + await fixture.model.refreshStatus() + XCTAssertEqual(fixture.model.code, previousCode) + XCTAssertEqual(fixture.model.detail, previousDetail) + XCTAssertEqual(fixture.model.tasks, previousTasks) + XCTAssertEqual(fixture.model.errorMessage, APIError.networkFailed("测试网络错误").localizedDescription) + XCTAssertFalse(fixture.model.isLoading) + XCTAssertEqual(fixture.service.createCalls, 1) + } + + /// 出码失败展示原始业务原因并允许复用核对意图重新尝试。 + func testBackendCreationFailureCanRetryWithoutMarkingComplete() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + fixture.model.setReviewed(true) + fixture.service.createError = APIError.serverCode(160001, "测试图片生成失败") + await fixture.model.generateCode() + XCTAssertEqual(fixture.model.errorMessage, "测试图片生成失败") + XCTAssertNil(fixture.model.code) + XCTAssertTrue(fixture.model.canGenerate) + XCTAssertFalse(fixture.model.isCompleted) + fixture.service.createError = nil + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.createCalls, 2) + XCTAssertNotNil(fixture.model.code) + XCTAssertNil(fixture.model.errorMessage) + } + + /// 清单失败不是空清单,重试读取成功后才允许工作人员勾选核对。 + func testTaskReadFailureRequiresRetryBeforeReview() async throws { + let fixture = try ConfirmationVMFixture() + fixture.service.tasksError = APIError.networkFailed("测试清单读取失败") + await fixture.model.refresh() + fixture.model.setReviewed(true) + XCTAssertNotNil(fixture.model.detail) + XCTAssertFalse(fixture.model.hasLoadedTasks) + XCTAssertFalse(fixture.model.isReviewed) + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertEqual(fixture.model.tasksErrorMessage, APIError.networkFailed("测试清单读取失败").localizedDescription) + fixture.service.tasksError = nil + await fixture.model.refresh() + fixture.model.setReviewed(true) + XCTAssertTrue(fixture.model.canGenerate) + XCTAssertNil(fixture.model.tasksErrorMessage) + } + + /// 出码前重新校验权限,订单在其他端完成时不再发送 POST。 + func testPermissionRevokedDuringPreflightStopsCreation() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + fixture.model.setReviewed(true) + fixture.service.detailValue = try ConfirmationVMData.detail(allowed: false, status: 30, confirmStatus: 2) + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.createCalls, 0) + XCTAssertTrue(fixture.model.isCompleted) + XCTAssertNil(fixture.model.code) + } + + /// 已展示确认码的订单失去邀请权限后,旧码立即隐藏。 + func testRefreshRevokedPermissionHidesOldCode() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.prepareCode() + fixture.service.detailValue = try ConfirmationVMData.detail(allowed: false) + await fixture.model.refreshStatus() + XCTAssertNil(fixture.model.code) + XCTAssertFalse(fixture.model.isReviewed) + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertFalse(fixture.model.isCompleted) + } + + /// 出码请求挂起时重复点击不会发送第二个请求。 + func testConcurrentGenerationIsDeduplicated() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + fixture.model.setReviewed(true) + fixture.service.holdCreate = true + let pending = Task { @MainActor in await fixture.model.generateCode() } + defer { fixture.service.releaseCreate(); pending.cancel() } + try await waitUntil { fixture.service.createCalls == 1 } + XCTAssertTrue(fixture.model.isSubmitting) + await fixture.model.generateCode() + await fixture.model.refreshStatus() + XCTAssertEqual(fixture.service.createCalls, 1) + fixture.service.releaseCreate() + await pending.value + XCTAssertNotNil(fixture.model.code) + XCTAssertFalse(fixture.model.isSubmitting) + } + + /// 账号、景区、门店或凭证变化后的迟到码不得留在原页面。 + func testIdentityChangeRejectsLateCreationAndImageCallbacks() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + fixture.model.setReviewed(true) + fixture.service.holdCreate = true + let pending = Task { @MainActor in await fixture.model.generateCode() } + defer { fixture.service.releaseCreate(); pending.cancel() } + try await waitUntil { fixture.service.createCalls == 1 } + fixture.latestContext = ConfirmationVMData.context(token: "replacement-test-token") + fixture.service.releaseCreate() + await pending.value + XCTAssertNil(fixture.model.code) + XCTAssertNil(fixture.model.detail) + XCTAssertTrue(fixture.model.tasks.isEmpty) + XCTAssertFalse(fixture.model.isSubmitting) + XCTAssertFalse(fixture.model.validateContext()) + XCTAssertNotNil(fixture.model.errorMessage) + fixture.latestContext = fixture.initialContext + XCTAssertFalse(fixture.model.validateContext()) + } + + /// 离页取消使迟到响应失效,不能重新填充确认码。 + func testInvalidationAndCancellationDiscardLateCreation() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + fixture.model.setReviewed(true) + fixture.service.holdCreate = true + let pending = Task { @MainActor in await fixture.model.generateCode() } + defer { fixture.service.releaseCreate(); pending.cancel() } + try await waitUntil { fixture.service.createCalls == 1 } + pending.cancel() + fixture.model.invalidate() + fixture.service.releaseCreate() + await pending.value + XCTAssertNil(fixture.model.code) + XCTAssertNil(fixture.model.detail) + XCTAssertFalse(fixture.model.hasLoadedTasks) + XCTAssertFalse(fixture.model.isSubmitting) + } + + /// 订单摘要与预先核对的数据变化时必须重新勾选,不能沿用旧意图。 + func testChangedOrderRequiresReviewAgainBeforeGenerating() async throws { + let fixture = try ConfirmationVMFixture() + await fixture.model.refresh() + fixture.model.setReviewed(true) + fixture.service.detailValue = try ConfirmationVMData.detail(filmCount: 1) + await fixture.model.generateCode() + XCTAssertEqual(fixture.service.createCalls, 0) + XCTAssertFalse(fixture.model.isReviewed) + XCTAssertNotNil(fixture.model.errorMessage) + XCTAssertFalse(fixture.model.hasLoadedTasks) + fixture.model.setReviewed(true) + XCTAssertFalse(fixture.model.canGenerate) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.hasLoadedTasks) + fixture.model.setReviewed(true) + XCTAssertTrue(fixture.model.canGenerate) + } + + /// 即使注入的数据源返回其他订单,也不能显示其信息或发起确认。 + func testMismatchedDetailIsRejected() async throws { + let fixture = try ConfirmationVMFixture() + fixture.service.detailValue = try ConfirmationVMData.detail(number: "OTHER-ORDER") + await fixture.model.refresh() + XCTAssertNil(fixture.model.detail) + XCTAssertFalse(fixture.model.hasLoadedTasks) + XCTAssertFalse(fixture.model.canGenerate) + XCTAssertEqual(fixture.service.events, ["detail"]) + XCTAssertNotNil(fixture.model.errorMessage) + } + + private func waitUntil(_ predicate: () -> Bool) async throws { + for _ in 0..<500 { + if predicate() { return } + try await Task.sleep(nanoseconds: 1_000_000) + } + XCTFail("等待测试替身请求开始超时") + } +} + +/// 固定身份和可变会话替身,所有测试数据均为虚构值。 +@MainActor +private final class ConfirmationVMFixture { + let initialContext = ConfirmationVMData.context() + var latestContext = ConfirmationVMData.context() + let service: ConfirmationVMService + private(set) var model: DroneDockConfirmationViewModel! + + init() throws { + service = try ConfirmationVMService() + model = DroneDockConfirmationViewModel(context: initialContext, order: service.detailValue.order, + service: service, currentContext: { [weak self] in self?.latestContext ?? ConfirmationVMData.context(token: "") }) + } + + func prepareCode() async { + await model.refresh() + model.setReviewed(true) + await model.generateCode() + } +} + +/// 以正式模型解码的本地确认响应,不持有真实订单或登录信息。 +private enum ConfirmationVMData { + static func context(token: String = "confirmation-vm-test-token") -> DroneDockHomeContext { + .init(userID: "confirmation-test-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: token) + } + + static func detail(allowed: Bool = true, status: Int = 20, confirmStatus: Int = 0, + filmCount: Int = 0, number: String = "TEST-CONFIRM-ORDER", materialStatus: Int = 0, + activeTaskStatus: Int? = nil) throws -> DroneDockMaterialDetail { + var value: [String: Any] = ["order_number": number, "order_status": status, "can_confirm": allowed, + "confirm_status": confirmStatus, "shoot_count": 1, "shot_count": 1, + "remaining_count": 0, "film_count": filmCount, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "测试点位"]]] + value["material_status"] = materialStatus + value["active_task_status"] = activeTaskStatus + if activeTaskStatus != nil { value["active_task_id"] = 21 } + return try decode(value) + } + + static func task(materialStatus: Int = 1) -> [String: Any] { + ["id": 501, "order_number": "TEST-CONFIRM-ORDER", "scenic_spot_id": 201, + "scenic_spot_name": "测试点位", "flight_status": 30, "material_status": materialStatus, + "materials": [], "film": NSNull()] + } + + static func code() throws -> DroneDockConfirmationCode { + try decode(["order_number": "TEST-CONFIRM-ORDER", "confirm_status": 1, + "confirm_url": "https://example.invalid/mini_qr/test-confirm.png"]) + } + + static func decode(_ object: [String: Any]) throws -> T { + try JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: object)) + } +} + +/// 可挂起和失败的确认服务,记录请求顺序以验证 GET 与 POST 的职责边界。 +@MainActor +private final class ConfirmationVMService: DroneDockConfirmationServing { + var detailValue: DroneDockMaterialDetail + var records: [[String: Any]] = [] + var detailError: Error? + var tasksError: Error? + var createError: Error? + var holdCreate = false + var events: [String] = [] + private(set) var createCalls = 0 + private var createContinuation: CheckedContinuation? + + init() throws { detailValue = try ConfirmationVMData.detail() } + + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + events.append("detail") + if let detailError { throw detailError } + return detailValue + } + + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + events.append("tasks") + XCTAssertNil(spotID) + if let tasksError { throw tasksError } + return try ConfirmationVMData.decode(["order_number": "TEST-CONFIRM-ORDER", "total": records.count, "list": records]) + } + + func createConfirmation(scenicID: Int, orderNumber: String) async throws -> DroneDockConfirmationCode { + events.append("create") + createCalls += 1 + XCTAssertEqual(scenicID, 128) + XCTAssertEqual(orderNumber, "TEST-CONFIRM-ORDER") + if holdCreate { await withCheckedContinuation { createContinuation = $0 } } + if let createError { throw createError } + return try ConfirmationVMData.code() + } + + func releaseCreate() { + createContinuation?.resume() + createContinuation = nil + } +} diff --git a/suixinkanTests/DroneDockConfirmationViewTests.swift b/suixinkanTests/DroneDockConfirmationViewTests.swift new file mode 100644 index 0000000..987f967 --- /dev/null +++ b/suixinkanTests/DroneDockConfirmationViewTests.swift @@ -0,0 +1,344 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 在隔离窗口验证整单核对、真实接口调用顺序和确认码原图展示,不访问外部网络。 +@MainActor +final class DroneDockConfirmationViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + private let number = "TEST-CONFIRM-UI" + private let codeURL = "https://example.invalid/mini_qr/confirmation.png" + + /// 无云端成片也可人工核对出码;刷新只读订单,直到服务端明确完成才显示结果。 + func testReviewGeneratesImageAndStatusRefreshWaitsForConfirmedOrder() async throws { + let images = DroneDockPaymentImageLoaderStub() + let (controller, session) = try makeController(responses: [ + detail(), tasks(), detail(), code(), detail(confirmStatus: 1), detail(completed: true, confirmStatus: 2) + ], images: images) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.hasLoadedTasks && !controller.viewModel.isLoading } + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks"]) + XCTAssertTrue(images.requests.isEmpty) + XCTAssertTrue(texts(controller.view).contains("暂无云端成片")) + let primary = try button(controller.view, "drone.confirmation.primary") + XCTAssertFalse(primary.isEnabled) + try button(controller.view, "drone.delivery.review.acknowledge").sendActions(for: .touchUpInside) + XCTAssertTrue(primary.isEnabled) + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + try await settle(window) { + controller.viewModel.code != nil && !controller.viewModel.isSubmitting + && (self.find(controller.view, "drone.confirmation.code.image") as? UIImageView)?.image != nil + } + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks", "detail", "confirm-code"]) + XCTAssertEqual(session.requests.filter { $0.httpMethod == "POST" }.count, 1) + XCTAssertFalse(controller.viewModel.isCompleted) + XCTAssertEqual(controller.viewModel.order.orderStatus, 20) + XCTAssertTrue(texts(controller.view).contains("等待游客确认")) + XCTAssertEqual(images.requests.count, 1) + XCTAssertEqual(images.requests.first?.url.absoluteString, codeURL) + let image = try XCTUnwrap(find(controller.view, "drone.confirmation.code.image") as? UIImageView) + XCTAssertEqual(image.contentMode, .scaleAspectFit) + XCTAssertEqual(image.image?.pngData(), images.defaultImage.pngData()) + + try button(controller.view, "drone.confirmation.primary").sendActions(for: .touchUpInside) + try await settle(window) { session.requests.count == 5 && !controller.viewModel.isLoading } + XCTAssertFalse(controller.viewModel.isCompleted) + XCTAssertNotNil(controller.viewModel.code) + XCTAssertEqual(images.requests.count, 1) + XCTAssertEqual(image.image?.pngData(), images.defaultImage.pngData()) + + try button(controller.view, "drone.confirmation.primary").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.isCompleted && self.texts(controller.view).contains("游客已确认收货") } + XCTAssertNil(controller.viewModel.code) + XCTAssertNil((find(controller.view, "drone.confirmation.code.image") as? UIImageView)?.image) + XCTAssertTrue(texts(controller.view).contains { $0.contains("2026-10-30 15:00:00") }) + XCTAssertEqual(try button(controller.view, "drone.confirmation.primary").configuration?.title, "返回订单列表") + XCTAssertEqual(session.requests.filter { $0.httpMethod == "POST" }.count, 1) + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks", "detail", "confirm-code", "detail", "detail"]) + } + + /// 图片失败只重载同一原图,不再次请求确认码;原尺寸像素保持不变。 + func testImageRetryOnlyReloadsSameURLWithoutCreatingAnotherCode() async throws { + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, session) = try makeController(responses: [detail(), tasks(), detail(), code()], images: images) + let window = show(controller) + defer { close(window) } + try await generateCode(controller, window: window) + try await settle(window) { images.requests.count == 1 } + images.completeRequest(at: 0, with: .failure(URLError(.cannotLoadFromNetwork))) + try await settle(window) { + guard let retry = self.find(controller.view, "drone.confirmation.image.retry") else { return false } + return !retry.isHidden + } + let count = session.requests.count + try button(controller.view, "drone.confirmation.image.retry").sendActions(for: .touchUpInside) + try await settle(window) { images.requests.count == 2 } + XCTAssertEqual(images.requests[0].url, images.requests[1].url) + XCTAssertFalse(images.requests[0].forceRefresh) + XCTAssertTrue(images.requests[1].forceRefresh) + XCTAssertEqual(session.requests.count, count) + let original = DroneDockPaymentImageLoaderStub.fixtureImage(color: .systemIndigo) + images.completeRequest(at: 1, with: .success(original)) + try await settle(window) { (self.find(controller.view, "drone.confirmation.code.image") as? UIImageView)?.image != nil } + let image = try XCTUnwrap(find(controller.view, "drone.confirmation.code.image") as? UIImageView) + XCTAssertEqual(image.image?.pngData(), original.pngData()) + XCTAssertEqual(session.requests.filter { $0.httpMethod == "POST" }.count, 1) + } + + /// 确认状态读取失败保留旧图片并展示后端消息,重试不重新生成码。 + func testStatusFailureKeepsExistingImageAndAllowsReadOnlyRetry() async throws { + let images = DroneDockPaymentImageLoaderStub() + let failure = try TestJSON.errorEnvelope(code: 160001, msg: "确认状态暂时不可用") + let (controller, session) = try makeController(responses: [detail(), tasks(), detail(), code(), failure, detail(confirmStatus: 1)], images: images) + let window = show(controller) + defer { close(window) } + try await generateCode(controller, window: window) + try button(controller.view, "drone.confirmation.primary").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.errorMessage != nil && !controller.viewModel.isLoading } + XCTAssertTrue(texts(controller.view).contains { $0.contains("确认状态暂时不可用") }) + XCTAssertNotNil(controller.viewModel.code) + XCTAssertFalse(controller.viewModel.isCompleted) + let image = try XCTUnwrap(find(controller.view, "drone.confirmation.code.image") as? UIImageView) + XCTAssertEqual(image.image?.pngData(), images.defaultImage.pngData()) + XCTAssertTrue(try button(controller.view, "drone.confirmation.primary").isEnabled) + try button(controller.view, "drone.confirmation.primary").sendActions(for: .touchUpInside) + try await settle(window) { session.requests.count == 6 && !controller.viewModel.isLoading && controller.viewModel.errorMessage == nil } + XCTAssertEqual(images.requests.count, 1) + XCTAssertEqual(session.requests.filter { $0.httpMethod == "POST" }.count, 1) + } + + private func generateCode(_ controller: DroneDockConfirmationViewController, window: UIWindow) async throws { + try await settle(window) { controller.viewModel.hasLoadedTasks && !controller.viewModel.isLoading } + try button(controller.view, "drone.delivery.review.acknowledge").sendActions(for: .touchUpInside) + try button(controller.view, "drone.confirmation.primary").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.code != nil && !controller.viewModel.isSubmitting } + } + + /// 等待确认态的清单可反复展开收起,纯展示操作不提交确认或刷新接口。 + func testWaitingManifestToggleDoesNotRequestNetworkOrChangeConfirmation() async throws { + let images = DroneDockPaymentImageLoaderStub() + let (controller, session) = try makeController(responses: [detail(), tasks(), detail(), code()], images: images) + let window = show(controller) + defer { close(window) } + try await generateCode(controller, window: window) + let list = try XCTUnwrap(find(controller.view, "drone.confirmation.list") as? UICollectionView) + list.setContentOffset(CGPoint(x: 0, y: max(0, list.contentSize.height - list.bounds.height)), animated: false) + window.layoutIfNeeded() + let toggle = try button(controller.view, "drone.confirmation.manifest.toggle") + XCTAssertEqual(toggle.accessibilityValue, "已收起") + toggle.sendActions(for: .touchUpInside) + try await settle(window) { toggle.accessibilityValue == "已展开" } + XCTAssertNotNil(controller.viewModel.code) + XCTAssertFalse(controller.viewModel.isCompleted) + toggle.sendActions(for: .touchUpInside) + try await settle(window) { toggle.accessibilityValue == "已收起" } + XCTAssertEqual(session.requests.count, 4) + XCTAssertEqual(session.requests.filter { $0.httpMethod == "POST" }.count, 1) + } + + /// “继续交付”打开统一的方式弹窗,不直接进入云端页面或生成游客确认码。 + func testContinueDeliveryPresentsMethodChoiceWithoutCreatingConfirmation() async throws { + let (controller, session) = try makeController(responses: [detail(), tasks()], images: DroneDockPaymentImageLoaderStub()) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.hasLoadedTasks && !controller.viewModel.isLoading } + let secondary = try button(controller.view, "drone.confirmation.back") + XCTAssertEqual(secondary.title(for: .normal), "还未交齐,继续交付") + secondary.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController != nil } + let sheet = try XCTUnwrap(controller.presentedViewController as? UINavigationController) + XCTAssertTrue(sheet.topViewController is DroneDockDeliveryMethodViewController) + XCTAssertEqual(session.requests.count, 2) + XCTAssertNil(controller.viewModel.code) + } + + /// 出码后每轮只读详情,自动失败保留二维码,读取完成回执后停止。 + func testAutomaticStatusChecksUseFiveSecondsAndStopAfterReceipt() async throws { + let clock = DroneDockPollTestClock() + let images = DroneDockPaymentImageLoaderStub() + let failure = try TestJSON.errorEnvelope(code: 160001, msg: "测试自动查询失败") + let (controller, session) = try makeController(responses: [ + detail(), tasks(), detail(), code(), failure, detail(completed: true, confirmStatus: 2) + ], images: images, clock: clock) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.hasLoadedTasks } + XCTAssertTrue(clock.intervals.isEmpty) + try await generateCode(controller, window: window) + try await settle(window) { clock.pendingCount == 1 } + XCTAssertEqual(clock.intervals, [5_000_000_000]) + XCTAssertEqual(session.requests.count, 4) + XCTAssertEqual(controller.viewModel.order.confirmStatus, 0) + + clock.advance() + try await settle(window) { session.requests.count == 5 && clock.pendingCount == 1 } + XCTAssertNil(controller.viewModel.errorMessage) + XCTAssertNotNil(controller.viewModel.code) + XCTAssertEqual(images.requests.count, 1) + XCTAssertTrue(try button(controller.view, "drone.confirmation.primary").isEnabled) + + clock.advance() + try await settle(window) { controller.viewModel.isCompleted && self.texts(controller.view).contains("游客已确认收货") } + XCTAssertNil(controller.viewModel.code) + XCTAssertEqual(clock.pendingCount, 0) + XCTAssertEqual(clock.intervals, [5_000_000_000, 5_000_000_000]) + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks", "detail", "confirm-code", "detail", "detail"]) + } + + /// 上传中的待确认订单每五秒只读核对,后端变为 30 后自动结束等待与轮询。 + func testExecutingOrderWithUploadingMaterialsPollsUntilConfirmedWithoutAnotherInvitation() async throws { + let clock = DroneDockPollTestClock() + let images = DroneDockPaymentImageLoaderStub() + let pending = try detail(confirmStatus: 1, materialStatus: 2, activeTaskStatus: 25) + let (controller, session) = try makeController(responses: [ + pending, tasks(), pending, detail(completed: true, confirmStatus: 2) + ], images: images, clock: clock) + let window = show(controller) + defer { close(window) } + try await settle(window) { clock.pendingCount == 1 } + XCTAssertEqual(controller.viewModel.order.orderStatus, 20) + XCTAssertTrue(controller.viewModel.isAwaitingConfirmation) + XCTAssertFalse(controller.viewModel.isCompleted) + XCTAssertEqual(session.requests.count, 2) + + clock.advance() + try await settle(window) { session.requests.count == 3 && clock.pendingCount == 1 } + XCTAssertEqual(controller.viewModel.order.orderStatus, 20) + XCTAssertFalse(controller.viewModel.isCompleted) + clock.advance() + try await settle(window) { controller.viewModel.isCompleted && self.texts(controller.view).contains("游客已确认收货") } + XCTAssertFalse(controller.viewModel.isAwaitingConfirmation) + XCTAssertEqual(clock.pendingCount, 0) + XCTAssertEqual(clock.intervals, [5_000_000_000, 5_000_000_000]) + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks", "detail", "detail"]) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" }) + XCTAssertTrue(images.requests.isEmpty) + } + + /// 已有待确认订单即使本地无码也会查询;后台、离页和交付弹窗暂停,恢复时立即读取。 + func testPendingOrderResumesStatusCheckOnlyWhenVisibleAndActive() async throws { + let clock = DroneDockPollTestClock() + let pending = try detail(confirmStatus: 1) + let (controller, session) = try makeController(responses: [ + pending, tasks(), pending, pending, detail(completed: true, confirmStatus: 2) + ], images: DroneDockPaymentImageLoaderStub(), clock: clock) + let window = show(controller) + defer { close(window) } + try await settle(window) { clock.pendingCount == 1 } + XCTAssertNil(controller.viewModel.code) + XCTAssertEqual(session.requests.count, 2) + + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await settle(window) { clock.pendingCount == 0 } + let navigation = try XCTUnwrap(controller.navigationController) + navigation.pushViewController(UIViewController(), animated: false) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { navigation.topViewController !== controller } + XCTAssertEqual(session.requests.count, 2) + XCTAssertEqual(clock.pendingCount, 0) + + navigation.popViewController(animated: false) + try await settle(window) { session.requests.count == 3 && clock.pendingCount == 1 } + try button(controller.view, "drone.confirmation.back").sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController != nil && clock.pendingCount == 0 } + XCTAssertEqual(session.requests.count, 3) + let sheet = try XCTUnwrap(controller.presentedViewController as? UINavigationController) + let methods = try XCTUnwrap(sheet.topViewController) + try button(methods.view, "drone.delivery.upload.close").sendActions(for: .touchUpInside) + try await settle(window) { session.requests.count == 4 && clock.pendingCount == 1 } + + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await settle(window) { clock.pendingCount == 0 } + XCTAssertEqual(session.requests.count, 4) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { controller.viewModel.isCompleted } + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks", "detail", "detail", "detail"]) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" }) + XCTAssertEqual(clock.pendingCount, 0) + } + + private func makeController(responses: [Data], images: DroneDockPaymentImageLoaderStub, + clock: DroneDockPollTestClock? = nil) throws -> (DroneDockConfirmationViewController, MockURLSession) { + let context = DroneDockHomeContext(userID: "confirm-ui-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "confirm-ui-token") + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, from: JSONSerialization.data(withJSONObject: ["order_number": number])) + let session = MockURLSession(responses: responses) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "confirm-ui-token" } + let model = DroneDockConfirmationViewModel(context: context, order: order, + service: DroneDockConfirmationAPI(client: client), currentContext: { context }) + let controller = DroneDockConfirmationViewController(viewModel: model, imageLoader: images, allowsRemoteMedia: false, + statusPollDelay: { interval in + if let clock { try await clock.wait(interval) } + else { try await Task.sleep(nanoseconds: interval) } + }) + return (controller, session) + } + + private func detail(completed: Bool = false, confirmStatus: Int = 0, materialStatus: Int = 3, + activeTaskStatus: Int? = nil) throws -> Data { + var value: [String: Any] = ["order_number": number, "user_phone": "130****0001", "order_status": completed ? 30 : 20, + "shoot_count": 1, "shot_count": 1, "remaining_count": 0, "can_confirm": !completed, + "confirm_status": confirmStatus, "confirmed_at": completed ? "2026-10-30 15:00:00" as Any : NSNull(), + "can_create_task": false, "can_upload_film": !completed, "film_count": 0, "material_status": materialStatus, "spot": []] + value["active_task_status"] = activeTaskStatus + if activeTaskStatus != nil { value["active_task_id"] = 21 } + return try envelope(value) + } + + private func tasks() throws -> Data { try envelope(["order_number": number, "total": 0, "list": []]) } + + private func code() throws -> Data { try envelope(["order_number": number, "confirm_status": 1, "confirm_url": codeURL]) } + + private func envelope(_ payload: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload]) + } + + private func show(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.rootViewController = UINavigationController(rootViewController: controller) + window.overrideUserInterfaceStyle = .light + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func find(_ root: UIView, _ id: String) -> UIView? { + if root.accessibilityIdentifier == id { return root } + return root.subviews.lazy.compactMap { self.find($0, id) }.first + } + + private func texts(_ root: UIView) -> [String] { + let text = (root as? UILabel)?.text + return (text.map { [$0] } ?? []) + root.subviews.flatMap(texts) + } + + private func button(_ root: UIView, _ id: String) throws -> UIButton { try XCTUnwrap(find(root, id) as? UIButton) } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 200_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("确认页未在预期时间内完成展示") + throw NSError(domain: "DroneDockConfirmationViewTests", code: 1) + } +} diff --git a/suixinkanTests/DroneDockDeliveryAPITests.swift b/suixinkanTests/DroneDockDeliveryAPITests.swift new file mode 100644 index 0000000..e4b766c --- /dev/null +++ b/suixinkanTests/DroneDockDeliveryAPITests.swift @@ -0,0 +1,141 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证张工成片保存的四项参数、同任务身份、文件结果及只读接口复用。 +@MainActor +final class DroneDockDeliveryAPITests: XCTestCase { + private let remote = "https://test-bucket.oss-cn-shanghai.aliyuncs.com/task/test.mp4" + + /// 保存只提交原始视频地址,封面、大小和订单状态均由后端决定。 + func testSaveFilmSendsDocumentedBodyAndUsesToken() async throws { + let session = MockURLSession(responses: [try envelope(saved())]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "delivery-api-test-token" } + let result = try await DroneDockDeliveryAPI(client: client).saveFilm(scenicID: 128, taskID: 501, + fileURL: remote, fileName: "测试成片.mp4") + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/tasks/film") + XCTAssertNil(request.url?.query) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "delivery-api-test-token") + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["scenic_id", "task_id", "file_url", "file_name"]) + XCTAssertEqual(body["scenic_id"] as? Int, 128) + XCTAssertEqual(body["task_id"] as? Int, 501) + XCTAssertEqual(body["file_url"] as? String, remote) + XCTAssertEqual(body["file_name"] as? String, "测试成片.mp4") + XCTAssertEqual(result.taskID, 501) + XCTAssertEqual(result.film.id, 901) + XCTAssertEqual(result.film.fileSize, 4096) + } + + /// 读取摘要和点位任务复用现有只读接口,没有旧 workbench 或创建任务请求。 + func testDeliveryReusesDetailAndFilteredTasks() async throws { + let detail: [String: Any] = ["order_number": "TEST-ORDER", "can_upload_film": true, "spot": []] + let tasks: [String: Any] = ["order_number": "TEST-ORDER", "total": 0, "list": []] + let session = MockURLSession(responses: [try envelope(detail), try envelope(tasks)]) + let api = DroneDockDeliveryAPI(client: APIClient(environment: .testing, session: session)) + let result = try await api.detail(scenicID: 128, orderNumber: "TEST-ORDER") + _ = try await api.tasks(scenicID: 128, orderNumber: "TEST-ORDER", spotID: 201) + XCTAssertEqual(result.order.canUploadFilm, true) + XCTAssertEqual(session.requests.map { $0.url?.lastPathComponent }, ["detail", "tasks"]) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" && $0.httpBody == nil }) + let query = URLComponents(url: try XCTUnwrap(session.requests.last?.url), resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(Dictionary(uniqueKeysWithValues: query.map { ($0.name, $0.value ?? "") }), + ["scenic_id": "128", "order_number": "TEST-ORDER", "scenic_spot_id": "201"]) + } + + /// 缺失身份、文件名异常、非视频或带签名查询的地址在发送前拒绝。 + func testInvalidSaveParametersNeverReachNetwork() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockDeliveryAPI(client: APIClient(environment: .testing, session: session)) + for (scenic, task) in [(0, 501), (128, 0), (128, -1)] { + await assertFailure { _ = try await api.saveFilm(scenicID: scenic, taskID: task, fileURL: self.remote, fileName: "test.mp4") } + } + for name in ["", "test.m4v", "test.jpg", "../test.mp4", "test\n.mp4", String(repeating: "x", count: 252) + ".mp4"] { + await assertFailure { _ = try await api.saveFilm(scenicID: 128, taskID: 501, fileURL: self.remote, fileName: name) } + } + for address in ["", "file:///tmp/test.mp4", "https:///test.mp4", remote + "?signature=test", remote + "#part", + "https://example.invalid/test.jpg", "https://user:password@example.invalid/test.mp4", "https://example.invalid/test film.mp4"] { + await assertFailure { _ = try await api.saveFilm(scenicID: 128, taskID: 501, fileURL: address, fileName: "test.mp4") } + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 服务端完成或退款等拒绝原样交给页面,不能误记为交付成功。 + func testBackendSaveFailurePreservesBusinessMessage() async throws { + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 160001, msg: "订单已完成,不可交付成片")]) + let api = DroneDockDeliveryAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.saveFilm(scenicID: 128, taskID: 501, fileURL: remote, fileName: "test.mp4") + XCTFail("应保留后端拒绝") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "订单已完成,不可交付成片") + } + } + + /// 迟到或错误的另一个任务/文件保存响应不能绑定到本次选择。 + func testMismatchedTaskOrFileResponseIsRejected() async throws { + for payload in [saved(taskID: 502), saved(url: "https://example.invalid/other.mp4")] { + let session = MockURLSession(responses: [try envelope(payload)]) + let api = DroneDockDeliveryAPI(client: APIClient(environment: .testing, session: session)) + await assertFailure { _ = try await api.saveFilm(scenicID: 128, taskID: 501, fileURL: self.remote, fileName: "test.mp4") } + } + } + + /// 解码接受字符串身份和可空展示字段,但必要成片对象与关联必须有效。 + func testSavedFilmResponseValidatesIdentityAndRequiredVideo() throws { + var valid = saved() + valid["task_id"] = "501" + var film = try XCTUnwrap(valid["film"] as? [String: Any]) + film["task_id"] = NSNull() + film["cover_url"] = NSNull() + valid["film"] = film + let decoded = try decode(valid) + XCTAssertEqual(decoded.taskID, 501) + XCTAssertNil(decoded.film.coverURL) + var invalids: [[String: Any]] = [["task_id": 501], ["task_id": 501, "film": NSNull()]] + for id: Any in [0, -1, true, "wrong"] { + var value = saved(); value["task_id"] = id; invalids.append(value) + } + for change in [["task_id": 999], ["file_url": ""], ["file_url": "file:///tmp/test.mp4"]] as [[String: Any]] { + var value = saved() + var changedFilm = try XCTUnwrap(value["film"] as? [String: Any]) + changedFilm.merge(change) { _, new in new }; value["film"] = changedFilm; invalids.append(value) + } + for value in invalids { XCTAssertThrowsError(try decode(value)) } + } + + /// 公共配置请求显式使用文档 default 名称,最终存储桶以响应为准。 + func testSTSUsesDefaultConfigurationAlias() async throws { + let payload: [String: Any] = ["base_url": "https://test-bucket.oss-cn-shanghai.aliyuncs.com", "endpoint": "https://oss-cn-shanghai.aliyuncs.com", + "region": "cn-shanghai", "bucket": "test-bucket", "expire_seconds": 3600, + "credentials": ["access_key_id": "test-key", "access_key_secret": "test-secret", "security_token": "test-security-token"]] + let session = MockURLSession(responses: [try envelope(payload)]) + let configuration = try await UploadAPI(client: APIClient(environment: .testing, session: session)).aliyunOSSBucket(bucket: "default") + XCTAssertEqual(configuration.bucket, "test-bucket") + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.url?.path, "/api/app/config/get-sts-token") + XCTAssertEqual(request.url?.query, "bucket=default") + XCTAssertEqual(request.httpMethod, "GET") + } + + private func saved(taskID: Int = 501, url: String? = nil) -> [String: Any] { + ["task_id": taskID, "film": ["id": 901, "task_id": taskID, "file_url": url ?? remote, + "file_name": "测试成片.mp4", "file_size": 4096, "cover_url": "https://example.invalid/cover.jpg"]] + } + + private func envelope(_ value: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": value]) + } + + private func decode(_ value: [String: Any]) throws -> DroneDockSavedFilm { + try JSONDecoder().decode(DroneDockSavedFilm.self, from: JSONSerialization.data(withJSONObject: value)) + } + + private func assertFailure(_ action: () async throws -> Void, file: StaticString = #filePath, line: UInt = #line) async { + do { try await action(); XCTFail("应拒绝无效保存结果", file: file, line: line) } catch {} + } +} diff --git a/suixinkanTests/DroneDockDeliveryDesignTests.swift b/suixinkanTests/DroneDockDeliveryDesignTests.swift new file mode 100644 index 0000000..4e699fe --- /dev/null +++ b/suixinkanTests/DroneDockDeliveryDesignTests.swift @@ -0,0 +1,122 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 两种交付入口共享的摘要与真实本地封面,不访问网络或初始化 RTC。 +@MainActor +final class DroneDockDeliveryDesignTests: XCTestCase { + /// 长游客标题随卡片增高,订单仅展示原号码末四位,不挤压或截断标题。 + func testLongCustomerTitleWrapsAndKeepsRealOrderSuffixVisible() throws { + let view = DroneDockDeliveryCustomerView(showsCard: true) + let title = "游客 南京牛首山佛顶塔观景平台来自同一旅行团队的亲友共同拍摄成片接收人" + view.apply(title: title, orderNumber: " 261105175018 \n") + layout(view, width: 320) + let name = try label(view, "drone.delivery.customer.title") + let order = try label(view, "drone.delivery.customer.order") + XCTAssertEqual(name.text, title) + XCTAssertEqual(name.numberOfLines, 0) + XCTAssertGreaterThan(name.bounds.height, name.font.lineHeight) + XCTAssertGreaterThanOrEqual(name.bounds.height + 1, name.sizeThatFits(CGSize(width: name.bounds.width, height: .greatestFiniteMagnitude)).height) + XCTAssertEqual(order.text, "订单尾号 5018") + XCTAssertFalse(order.isHidden) + XCTAssertTrue(view.bounds.contains(name.convert(name.bounds, to: view))) + XCTAssertTrue(view.bounds.contains(order.convert(order.bounds, to: view))) + XCTAssertFalse(view.hasAmbiguousLayout) + } + + /// 透明摘要与外部卡片齐边;切换为缺失订单后隐藏原尾号,没有占位假号码。 + func testTransparentCustomerHidesMissingOrderAndUsesNoHorizontalInset() throws { + let view = DroneDockDeliveryCustomerView(showsCard: false) + view.apply(title: "游客 132****9413", orderNumber: "123") + let order = try label(view, "drone.delivery.customer.order") + XCTAssertEqual(order.text, "订单尾号 123", "短订单号只展示实际内容,不补零") + for value: String? in [nil, "", " \n "] { + view.apply(title: "游客 132****9413", orderNumber: value) + layout(view, width: 320) + XCTAssertTrue(order.isHidden) + XCTAssertNil(order.text) + } + XCTAssertEqual(view.backgroundColor, .clear) + XCTAssertEqual(view.layer.borderWidth, 0) + let name = try label(view, "drone.delivery.customer.title") + XCTAssertEqual(name.convert(.zero, to: view).x, 60, accuracy: 0.5, "48 点头像与 12 点间距,不重复增加外层内边距") + XCTAssertEqual(view.bounds.height, 64, accuracy: 0.5) + } + + /// 封面必须来自本地视频;同一选择不重新生成,更换/移除立即清除且迟到结果不恢复旧图。 + func testBundledVideoThumbnailDeduplicatesAndRemovalDiscardsLateImage() async throws { + let source = try XCTUnwrap(Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock")) + let size = try XCTUnwrap(source.resourceValues(forKeys: [.fileSizeKey]).fileSize) + let video = DroneDockDeliveryVideo(url: source, fileName: source.lastPathComponent, fileSize: size) + let view = DroneDockDeliveryVideoThumbnailView(frame: CGRect(x: 0, y: 0, width: 320, height: 180)) + let image = try imageView(view, "drone.delivery.thumbnail.image") + let placeholder = try imageView(view, "drone.delivery.thumbnail.placeholder") + XCTAssertNil(image.image) + XCTAssertFalse(placeholder.isHidden) + view.apply(video: video) + try await waitForImage(image) + let firstImage = try XCTUnwrap(image.image) + XCTAssertNotNil(firstImage.cgImage, "必须为实际视频帧,而不是系统符号或演示封面") + XCTAssertTrue(placeholder.isHidden) + for _ in 0..<3 { view.apply(video: video) } + XCTAssertTrue(image.image === firstImage) + let nextSelection = DroneDockDeliveryVideo(url: source, fileName: "另一选择.mp4", fileSize: size) + view.apply(video: nextSelection) + XCTAssertNil(image.image) + view.apply(video: nil) + try await Task.sleep(for: .milliseconds(200)) + XCTAssertNil(image.image, "已取消的首帧不能覆盖移除后的空状态") + XCTAssertFalse(placeholder.isHidden) + XCTAssertEqual(view.accessibilityLabel, "未选择视频") + view.apply(video: nextSelection) + try await waitForImage(image) + XCTAssertTrue(placeholder.isHidden, "取消后重新选择仍可正常生成") + view.apply(video: nil) + XCTAssertNil(image.image) + } + + /// 非文件 URL 被直接拒绝,本地无视频内容也只展示中性占位,不以示例图替代。 + func testRemoteAndInvalidVideoKeepNeutralPlaceholder() async throws { + let view = DroneDockDeliveryVideoThumbnailView(frame: .zero) + let image = try imageView(view, "drone.delivery.thumbnail.image") + let placeholder = try imageView(view, "drone.delivery.thumbnail.placeholder") + view.apply(video: .init(url: try XCTUnwrap(URL(string: "https://invalid.test/not-requested.mp4")), fileName: "remote.mp4", fileSize: 100)) + XCTAssertNil(image.image) + XCTAssertFalse(placeholder.isHidden) + let url = FileManager.default.temporaryDirectory.appendingPathComponent("\(UUID().uuidString).mp4") + try Data("not a video".utf8).write(to: url) + defer { try? FileManager.default.removeItem(at: url) } + view.apply(video: .init(url: url, fileName: "invalid.mp4", fileSize: 11)) + try await Task.sleep(for: .milliseconds(200)) + XCTAssertNil(image.image) + XCTAssertFalse(placeholder.isHidden) + XCTAssertEqual(view.accessibilityLabel, "视频封面暂不可用") + view.apply(video: nil) + } + + private func layout(_ view: UIView, width: CGFloat) { + let size = view.systemLayoutSizeFitting(CGSize(width: width, height: UIView.layoutFittingCompressedSize.height), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + view.frame = CGRect(origin: .zero, size: CGSize(width: width, height: size.height)) + view.layoutIfNeeded() + } + + private func label(_ view: UIView, _ id: String) throws -> UILabel { + try XCTUnwrap(descendants(view).first { $0.accessibilityIdentifier == id } as? UILabel) + } + + private func imageView(_ view: UIView, _ id: String) throws -> UIImageView { + try XCTUnwrap(descendants(view).first { $0.accessibilityIdentifier == id } as? UIImageView) + } + + private func descendants(_ view: UIView) -> [UIView] { [view] + view.subviews.flatMap(descendants) } + + private func waitForImage(_ view: UIImageView, file: StaticString = #filePath, line: UInt = #line) async throws { + for _ in 0..<300 { + if view.image?.cgImage != nil { return } + try await Task.sleep(for: .milliseconds(10)) + } + XCTFail("本地测试视频未生成真实封面", file: file, line: line) + } +} diff --git a/suixinkanTests/DroneDockDeliveryIntegrationTests.swift b/suixinkanTests/DroneDockDeliveryIntegrationTests.swift new file mode 100644 index 0000000..2eefb89 --- /dev/null +++ b/suixinkanTests/DroneDockDeliveryIntegrationTests.swift @@ -0,0 +1,346 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 串联正式交付业务与请求编码,仅网络边界和 OSS 传输使用完全隔离的内存替身。 +@MainActor +final class DroneDockDeliveryIntegrationTests: XCTestCase { + /// STS、文件上传、成片保存及读回共享同一身份,并保留文档要求的地址和字段。 + func testFullUploadUsesSTSConfigurationAndReadsBackSavedFilm() async throws { + let fixture = try makeFixture() + await fixture.prepare() + fixture.backend.events.removeAll() + + await fixture.model.submit() + + XCTAssertEqual(fixture.backend.events, ["detail", "tasks", "sts", "put", "detail", "tasks", "save", "detail", "tasks"]) + XCTAssertEqual(fixture.transport.calls.count, 1) + let upload = try XCTUnwrap(fixture.transport.calls.first) + XCTAssertEqual(upload.fileURL, fixture.video.url) + XCTAssertEqual(upload.contentType, "video/mp4") + XCTAssertEqual(upload.configuration.bucket, "integration-bucket") + XCTAssertEqual(upload.configuration.endpoint, "https://oss-cn-shanghai.aliyuncs.com") + XCTAssertEqual(upload.configuration.region, "cn-shanghai") + XCTAssertEqual(upload.configuration.credentials.accessKeyId, "integration-test-key") + XCTAssertEqual(upload.configuration.credentials.securityToken, "integration-test-security-token") + XCTAssertTrue(upload.objectKey.hasPrefix("task/")) + XCTAssertTrue(upload.objectKey.contains("/128/")) + XCTAssertTrue(upload.objectKey.hasSuffix("_film.mp4")) + + let sts = try XCTUnwrap(fixture.backend.requests.first { $0.url?.lastPathComponent == "get-sts-token" }) + XCTAssertEqual(sts.httpMethod, "GET") + XCTAssertEqual(sts.url?.query, "bucket=default") + XCTAssertNil(sts.httpBody) + XCTAssertTrue(fixture.backend.requests.allSatisfy { + $0.value(forHTTPHeaderField: "token") == DeliveryIntegrationFixture.token + }) + for request in fixture.backend.requests where ["detail", "tasks"].contains(request.url?.lastPathComponent ?? "") { + let requestURL = try XCTUnwrap(request.url) + let query = URLComponents(url: requestURL, resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(Dictionary(uniqueKeysWithValues: query.map { ($0.name, $0.value ?? "") }), + ["scenic_id": "128", "order_number": "INTEGRATION-ORDER"]) + } + + let save = try XCTUnwrap(fixture.backend.requests.first { $0.url?.path == DeliveryIntegrationBackend.savePath }) + XCTAssertEqual(save.httpMethod, "POST") + let body = try requestBody(save) + XCTAssertEqual(Set(body.keys), ["scenic_id", "task_id", "file_url", "file_name"]) + XCTAssertEqual(body["scenic_id"] as? Int, 128) + XCTAssertEqual(body["task_id"] as? Int, 501) + XCTAssertEqual(body["file_name"] as? String, fixture.video.fileName) + let address = try XCTUnwrap(body["file_url"] as? String) + let url = try XCTUnwrap(URL(string: address)) + XCTAssertEqual(url.host, "integration-bucket.oss-cn-shanghai.aliyuncs.com") + XCTAssertEqual(url.path, "/" + upload.objectKey) + XCTAssertNil(url.query) + XCTAssertNil(url.fragment) + XCTAssertFalse(address.contains(" ")) + XCTAssertFalse(address.contains("%")) + XCTAssertTrue(address.unicodeScalars.allSatisfy { $0.isASCII }) + XCTAssertTrue(address.hasPrefix(upload.configuration.baseUrl + "/")) + + XCTAssertEqual(fixture.model.phase, .succeeded) + XCTAssertEqual(fixture.model.progress, 100) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileURL, address) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileSize, fixture.video.fileSize) + XCTAssertEqual(fixture.model.selectedTask?.film?.coverURL, "https://example.invalid/integration-cover.jpg") + XCTAssertEqual(fixture.model.lastSavedFilm?.taskID, 501) + XCTAssertEqual(fixture.model.detail?.order.filmCount, 1) + XCTAssertNotNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.submissionErrorMessage) + XCTAssertNil(fixture.model.uploadedFileURL) + } + + /// 已确认订单兼容旧权限字段,可在同一任务上再次选择视频并替换成片。 + func testConfirmedOrderAllowsRepeatedDeliveryAndExplicitReplacement() async throws { + let fixture = try makeFixture() + fixture.backend.orderStatus = 30 + fixture.backend.canUpload = false + await fixture.prepare() + + await fixture.model.submit() + let original = try XCTUnwrap(fixture.model.selectedTask?.film) + XCTAssertEqual(fixture.model.phase, .succeeded) + XCTAssertTrue(fixture.model.canChooseVideo) + XCTAssertFalse(fixture.model.canSubmit) + + let replacement = DroneDockDeliveryVideo(url: fixture.video.url, fileName: "重新交付.mp4", fileSize: fixture.video.fileSize) + fixture.model.selectVideo(replacement) + XCTAssertTrue(fixture.model.canSubmit) + XCTAssertTrue(fixture.model.needsReplacementConfirmation) + await fixture.model.submit() + XCTAssertEqual(fixture.transport.calls.count, 1) + XCTAssertEqual(fixture.model.selectedTask?.film, original) + + await fixture.model.submit(confirmReplacement: true) + + let saves = fixture.backend.requests.filter { $0.url?.path == DeliveryIntegrationBackend.savePath } + XCTAssertEqual(saves.count, 2) + XCTAssertEqual(fixture.transport.calls.count, 2) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileName, replacement.fileName) + XCTAssertNotEqual(fixture.model.selectedTask?.film?.fileURL, original.fileURL) + XCTAssertEqual(fixture.model.detail?.order.orderStatus, 30) + XCTAssertEqual(fixture.model.detail?.order.confirmStatus, 2) + XCTAssertEqual(fixture.model.phase, .succeeded) + } + + /// 业务文件名完整保留,中文、空格和井号均不会进入 OSS 对象地址。 + func testSpecialFileNamesRemainInBusinessMetadataWithASCIIObjectURLs() async throws { + for name in ["中文成片.mp4", "test film.MOV", "test#film.MP4"] { + let fixture = try makeFixture(name: name) + await fixture.prepare() + await fixture.model.submit() + + let save = try XCTUnwrap(fixture.backend.requests.first { $0.url?.path == DeliveryIntegrationBackend.savePath }) + let body = try requestBody(save) + let address = try XCTUnwrap(body["file_url"] as? String) + let upload = try XCTUnwrap(fixture.transport.calls.first) + XCTAssertEqual(body["file_name"] as? String, name) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileName, name) + XCTAssertEqual(fixture.model.phase, .succeeded) + XCTAssertTrue(address.unicodeScalars.allSatisfy { $0.isASCII }) + XCTAssertFalse(address.contains("%")) + XCTAssertFalse(address.contains(" ")) + XCTAssertFalse(address.contains("#")) + XCTAssertEqual(address, upload.configuration.baseUrl + "/" + upload.objectKey) + XCTAssertTrue(upload.objectKey.hasSuffix("_film." + URL(fileURLWithPath: name).pathExtension.lowercased())) + } + } + + /// 保存业务失败后仍复用首次 OSS 地址,重试不重新申请 STS 或上传文件。 + func testSaveFailureRetriesSameURLWithoutUploadingAgain() async throws { + let fixture = try makeFixture() + fixture.backend.saveFailuresRemaining = 1 + await fixture.prepare() + await fixture.model.submit() + + let pending = try XCTUnwrap(fixture.model.uploadedFileURL) + XCTAssertEqual(fixture.model.submissionErrorMessage, "测试成片保存失败") + XCTAssertNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.selectedTask?.film) + XCTAssertNil(fixture.backend.savedFilm) + fixture.backend.events.removeAll() + + await fixture.model.submit() + + XCTAssertEqual(fixture.backend.events, ["detail", "tasks", "save", "detail", "tasks"]) + XCTAssertEqual(fixture.transport.calls.count, 1) + XCTAssertEqual(fixture.backend.requests.filter { $0.url?.lastPathComponent == "get-sts-token" }.count, 1) + let saves = fixture.backend.requests.filter { $0.url?.path == DeliveryIntegrationBackend.savePath } + XCTAssertEqual(saves.count, 2) + for request in saves { + let body = try requestBody(request) + XCTAssertEqual(body["file_url"] as? String, pending) + XCTAssertEqual(body["task_id"] as? Int, 501) + } + XCTAssertEqual(fixture.model.phase, .succeeded) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileURL, pending) + XCTAssertEqual(fixture.model.detail?.order.filmCount, 1) + XCTAssertNil(fixture.model.uploadedFileURL) + XCTAssertNil(fixture.model.submissionErrorMessage) + XCTAssertNotNil(fixture.model.successMessage) + } + + /// OSS 完成后订单权限变化时,正式 ViewModel 读回最新权限并停止成片保存。 + func testPermissionChangeAfterPutPreventsFilmSave() async throws { + let fixture = try makeFixture() + await fixture.prepare() + let backend = fixture.backend + fixture.transport.onPut = { + backend.canUpload = false + } + fixture.backend.events.removeAll() + + await fixture.model.submit() + + XCTAssertEqual(fixture.backend.events, ["detail", "tasks", "sts", "put", "detail", "tasks"]) + XCTAssertEqual(fixture.transport.calls.count, 1) + XCTAssertFalse(fixture.backend.requests.contains { $0.url?.path == DeliveryIntegrationBackend.savePath }) + XCTAssertEqual(fixture.model.detail?.order.canUploadFilm, false) + XCTAssertEqual(fixture.model.detail?.order.orderStatus, 20) + XCTAssertNotNil(fixture.model.uploadedFileURL) + XCTAssertNotNil(fixture.model.submissionErrorMessage) + XCTAssertNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.lastSavedFilm) + XCTAssertNil(fixture.backend.savedFilm) + } + + private func makeFixture(name: String = "集成测试 #1.mp4") throws -> DeliveryIntegrationFixture { + let directory = FileManager.default.temporaryDirectory + .appendingPathComponent("dock-delivery-integration-\(UUID().uuidString)", isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + addTeardownBlock { try FileManager.default.removeItem(at: directory) } + let url = directory.appendingPathComponent(name) + let bytes = Data(repeating: 0, count: 32) + try bytes.write(to: url) + return try DeliveryIntegrationFixture(video: .init(url: url, fileName: name, fileSize: bytes.count)) + } + + private func requestBody(_ request: URLRequest) throws -> [String: Any] { + try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + } +} + +/// 正式 APIClient、业务 API、STS API、上传器和 ViewModel 组成的测试依赖图。 +@MainActor +private final class DeliveryIntegrationFixture { + static let token = "delivery-integration-test-token" + let backend = DeliveryIntegrationBackend() + let transport: DeliveryIntegrationTransport + let video: DroneDockDeliveryVideo + let model: DroneDockDeliveryViewModel + + /// 文件仅来自测试临时目录,所有请求均注入本地传输。 + init(video: DroneDockDeliveryVideo) throws { + self.video = video + transport = DeliveryIntegrationTransport(backend: backend) + let client = APIClient(environment: .testing, session: DeliveryIntegrationSession(backend: backend), debugLogSink: { _ in }) + client.bindAuthTokenProvider { Self.token } + let detail = try JSONDecoder().decode(DroneDockMaterialDetail.self, + from: JSONSerialization.data(withJSONObject: backend.detailPayload)) + let context = DroneDockHomeContext(userID: "integration-user", accountType: "store_user", scenicID: 128, + scenicName: "集成测试景区", storeID: 37, photographerName: "集成测试工作人员", token: Self.token) + model = DroneDockDeliveryViewModel(context: context, order: detail.order, + service: DroneDockDeliveryAPI(client: client), + uploader: DroneDockFilmUploader(configService: UploadAPI(client: client), transport: transport), + initialTaskID: 501, currentContext: { context }) + } + + /// 首次读取通过正式模型解码,再选择真实存在的测试临时文件。 + func prepare() async { + await model.refresh() + model.selectVideo(video) + XCTAssertTrue(model.canSubmit) + } +} + +/// 只允许交付链路的四个路由,完全在内存中保存与读回,不存在网络转发路径。 +@MainActor +private final class DeliveryIntegrationBackend { + static let savePath = "/api/yf-handset-app/photog/multi-plane/tasks/film" + private(set) var requests: [URLRequest] = [] + var events: [String] = [] + var canUpload = true + var orderStatus = 20 + var saveFailuresRemaining = 0 + private(set) var savedFilm: [String: Any]? + + var detailPayload: [String: Any] { + ["order_number": "INTEGRATION-ORDER", "order_status": orderStatus, "can_upload_film": canUpload, + "confirm_status": orderStatus == 30 ? 2 : 0, + "film_count": savedFilm == nil ? 0 : 1, "shoot_count": 5, "shot_count": 1, "remaining_count": 4, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "集成测试点位"]]] + } + + /// 依据正式 URLRequest 生成协议 Envelope,未知路由直接失败。 + func respond(to request: URLRequest) throws -> (Data, URLResponse) { + requests.append(request) + guard let url = request.url else { throw URLError(.badURL) } + let payload: [String: Any] + var code = 100000 + var message = "success" + switch (request.httpMethod, url.path) { + case ("GET", "/api/yf-handset-app/photog/multi-plane/orders/detail"): + events.append("detail") + payload = detailPayload + case ("GET", "/api/yf-handset-app/photog/multi-plane/tasks"): + events.append("tasks") + var task: [String: Any] = ["id": 501, "order_number": "INTEGRATION-ORDER", "scenic_spot_id": 201, + "scenic_spot_name": "集成测试点位", "flight_status": 20, "materials": []] + task["film"] = savedFilm as Any? ?? NSNull() + payload = ["order_number": "INTEGRATION-ORDER", "total": 1, "list": [task]] + case ("GET", "/api/app/config/get-sts-token"): + events.append("sts") + payload = ["base_url": "https://integration-bucket.oss-cn-shanghai.aliyuncs.com", + "endpoint": "https://oss-cn-shanghai.aliyuncs.com", "region": "cn-shanghai", + "bucket": "integration-bucket", "expire_seconds": 3600, + "credentials": ["access_key_id": "integration-test-key", "access_key_secret": "integration-test-secret", + "security_token": "integration-test-security-token"]] + case ("POST", Self.savePath): + events.append("save") + guard let bodyData = request.httpBody, + let body = try JSONSerialization.jsonObject(with: bodyData) as? [String: Any], + let taskID = body["task_id"] as? Int, let address = body["file_url"] as? String, + let name = body["file_name"] as? String else { throw URLError(.badServerResponse) } + if saveFailuresRemaining > 0 { + saveFailuresRemaining -= 1 + code = 160001 + message = "测试成片保存失败" + payload = [:] + } else { + let film: [String: Any] = ["id": 901, "task_id": taskID, "file_url": address, + "file_name": name, "file_size": 32, "cover_url": "https://example.invalid/integration-cover.jpg"] + savedFilm = film + payload = ["task_id": taskID, "film": film] + } + default: + throw URLError(.unsupportedURL) + } + let data = try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": payload]) + guard let response = HTTPURLResponse(url: url, statusCode: 200, httpVersion: nil, headerFields: nil) else { + throw URLError(.badServerResponse) + } + return (data, response) + } +} + +/// 正式 APIClient 使用的本地会话,只委托内存后端,绝不调用 URLSession。 +private final class DeliveryIntegrationSession: LocalSimulationURLSession { + private let backend: DeliveryIntegrationBackend + + /// 注入单用例专属后端,避免全局可变请求处理器。 + init(backend: DeliveryIntegrationBackend) { self.backend = backend } + + /// 跨回主线程处理测试状态,返回纯内存响应。 + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + try await backend.respond(to: request) + } +} + +/// 记录正式上传器的文件、MIME、对象路径及配置,不调用 SDK 或外部存储。 +@MainActor +private final class DeliveryIntegrationTransport: DroneDockFilmTransporting { + /// 一次准备发送的 OSS 对象参数。 + struct Call { + let fileURL: URL + let objectKey: String + let contentType: String + let configuration: AliyunOSSResponse + } + private let backend: DeliveryIntegrationBackend + private(set) var calls: [Call] = [] + var onPut: (() -> Void)? + + /// 与 HTTP 替身共享事件时间线,便于验证上传和保存的先后顺序。 + init(backend: DeliveryIntegrationBackend) { self.backend = backend } + + /// 仅模拟传输完成及期间业务变化,不写入任何云端对象。 + func put(fileURL: URL, objectKey: String, contentType: String, configuration: AliyunOSSResponse, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws { + calls.append(Call(fileURL: fileURL, objectKey: objectKey, contentType: contentType, configuration: configuration)) + backend.events.append("put") + onProgress(50) + onPut?() + onProgress(100) + } +} diff --git a/suixinkanTests/DroneDockDeliveryNavigationFixtures.swift b/suixinkanTests/DroneDockDeliveryNavigationFixtures.swift new file mode 100644 index 0000000..29d1805 --- /dev/null +++ b/suixinkanTests/DroneDockDeliveryNavigationFixtures.swift @@ -0,0 +1,36 @@ +import XCTest +@testable import suixinkan + +/// 两个正式入口共用真实交付控制器,只替换网络和上传边界。 +@MainActor +enum DroneDockDeliveryNavigationFixtures { + /// 构造对应订单的两条可交付任务,进入页面不应触发上传或写接口。 + static func controller(context: DroneDockHomeContext, order: DroneDockHomeOrder, taskID: Int?) throws -> (DroneDockDeliveryViewController, MockURLSession) { + let number = order.orderNumber ?? order.orderID + let detail: [String: Any] = ["order_number": number, "order_status": 20, "can_upload_film": true, + "project_name": "测试交付套餐", "shoot_count": 5, "shot_count": 1, "remaining_count": 4, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "测试点位一"], ["scenic_spot_id": 202, "scenic_spot_name": "测试点位二"]]] + let tasks: [[String: Any]] = [1, 2].map { id in + ["id": id, "task_id": id, "order_number": number, "scenic_spot_id": id == 1 ? 201 : 202, + "scenic_spot_name": id == 1 ? "测试点位一" : "测试点位二", "flight_status": 30, + "materials": [], "film": NSNull()] + } + let taskData: [String: Any] = ["order_number": number, "total": tasks.count, "list": tasks] + let responses = try [detail, taskData].map { try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": $0]) } + let session = MockURLSession(responses: responses) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "delivery-navigation-test-token" } + let model = DroneDockDeliveryViewModel(context: context, order: order, service: DroneDockDeliveryAPI(client: client), + uploader: NavigationUploader(), initialTaskID: taskID, currentContext: { context }) + return (DroneDockDeliveryViewController(viewModel: model), session) + } + + /// 入口导航不得自行上传或触发任何交付写操作。 + @MainActor + private final class NavigationUploader: DroneDockFilmUploading { + func upload(video: DroneDockDeliveryVideo, scenicID: Int, onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws -> String { + XCTFail("进入交付页不应自动上传") + throw CancellationError() + } + } +} diff --git a/suixinkanTests/DroneDockDeliveryViewModelTests.swift b/suixinkanTests/DroneDockDeliveryViewModelTests.swift new file mode 100644 index 0000000..2476a5d --- /dev/null +++ b/suixinkanTests/DroneDockDeliveryViewModelTests.swift @@ -0,0 +1,606 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 成片交付状态测试:网络及 OSS 均替换,任何测试都不会上传真实文件。 +@MainActor +final class DroneDockDeliveryViewModelTests: XCTestCase { + /// 订单入口只加载已购点位与全部任务,不替用户选择目标。 + func testOrderEntryLoadsBothReadsWithoutAutomaticTaskSelection() async throws { + let fixture = try DeliveryVMFixture() + await fixture.model.refresh() + XCTAssertEqual(fixture.log.events, ["detail", "tasks"]) + XCTAssertEqual(fixture.model.spots.map(\.id), [201, 202]) + XCTAssertEqual(fixture.model.tasks.map(\.id), [11, 12]) + XCTAssertFalse(fixture.model.isTaskScoped) + XCTAssertNil(fixture.model.selectedSpotID) + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertFalse(fixture.model.canSubmit) + fixture.model.selectSpot(id: 202) + XCTAssertEqual(fixture.model.filteredTasks.map(\.id), [12]) + XCTAssertNil(fixture.model.selectedTaskID) + } + + /// 素材入口绑定真实任务和点位,不能通过隐藏的选择接口改投其他任务。 + func testMaterialEntryKeepsExactTaskAndPointWhenSelectionIsAttempted() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 12) + await fixture.prepare() + let originalVideo = fixture.model.video + XCTAssertTrue(fixture.model.isTaskScoped) + XCTAssertEqual(fixture.model.selectedTaskID, 12) + XCTAssertEqual(fixture.model.selectedSpotID, 202) + XCTAssertEqual(fixture.model.selectedTask?.flightStatus, 10) + XCTAssertTrue(fixture.model.canChooseVideo) + fixture.model.selectSpot(id: 201) + fixture.model.selectTask(id: 11) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.selectedTaskID, 12) + XCTAssertEqual(fixture.model.selectedSpotID, 202) + XCTAssertEqual(fixture.model.video, originalVideo) + await fixture.model.submit() + XCTAssertEqual(fixture.service.saves.map(\.taskID), [12]) + } + + /// 素材入口绑定任务已不存在时,只能返回刷新,不能重新选择另一任务。 + func testMissingBoundTaskCannotBeReplacedByAnotherTask() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 999) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.isTaskScoped) + fixture.model.selectSpot(id: 201) + fixture.model.selectTask(id: 11) + fixture.model.selectVideo(DeliveryVMData.video()) + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.selectedSpotID) + XCTAssertNil(fixture.model.video) + XCTAssertTrue(fixture.model.submissionErrorMessage?.contains("返回素材库") == true) + XCTAssertFalse(fixture.model.canChooseVideo) + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertTrue(fixture.service.saves.isEmpty) + } + + /// 更换点位或任务清除原视频,非法任务不能跨点位选中。 + func testSelectionChangesClearVideoAndRejectWrongPointTask() async throws { + let fixture = try DeliveryVMFixture() + await fixture.model.refresh() + fixture.model.selectSpot(id: 201) + fixture.model.selectTask(id: 11) + fixture.model.selectVideo(DeliveryVMData.video()) + fixture.model.selectTask(id: 12) + XCTAssertEqual(fixture.model.selectedTaskID, 11) + XCTAssertNotNil(fixture.model.video) + fixture.model.selectSpot(id: 202) + XCTAssertNil(fixture.model.video) + XCTAssertNil(fixture.model.selectedTaskID) + fixture.model.selectTask(id: 12) + XCTAssertEqual(fixture.model.selectedTaskID, 12) + XCTAssertFalse(fixture.model.canSubmit) + } + + /// 原素材上传中的执行订单仍按成片交付许可决定操作,活动任务 25 不额外授权。 + func testUploadingMaterialsDeliveryRequiresExplicitPermission() async throws { + for allowed in [false, true] { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + fixture.service.detailValue = try DeliveryVMData.detail(allowed: allowed, materialStatus: 2, activeTaskStatus: 25) + await fixture.prepare() + XCTAssertEqual(fixture.model.canChooseVideo, allowed) + XCTAssertEqual(fixture.model.canSubmit, allowed) + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, allowed ? 1 : 0) + XCTAssertEqual(fixture.service.saves.count, allowed ? 1 : 0) + if allowed { XCTAssertEqual(fixture.model.phase, .succeeded) } + } + } + + /// 无上传权限、已取消、已退款和不支持的视频均不发送写请求。 + func testPermissionAndVideoValidationDisableSubmission() async throws { + for (allowed, status) in [(false, 20), (true, 10), (true, 25), (true, 40), (true, 50)] { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + fixture.service.detailValue = try DeliveryVMData.detail(allowed: allowed, status: status) + await fixture.prepare() + XCTAssertFalse(fixture.model.canChooseVideo) + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertEqual(fixture.service.saves.count, 0) + } + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.model.refresh() + fixture.model.selectVideo(.init(url: URL(fileURLWithPath: "/tmp/video.m4v"), fileName: "video.m4v", fileSize: 12)) + XCTAssertNil(fixture.model.video) + XCTAssertNotNil(fixture.model.submissionErrorMessage) + } + + /// 先校验再上传,保存前再核对;只有业务保存成功才显示交付成功。 + func testUploadThenSaveAndRefreshHasDistinctProgressPhases() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.log.events.removeAll() + var phases: [DroneDockDeliveryPhase] = [] + await fixture.model.submit { progress in + phases.append(fixture.model.phase) + if fixture.model.phase == .uploading || fixture.model.phase == .saving { + XCTAssertNil(fixture.model.successMessage) + } + XCTAssertTrue((0...100).contains(progress)) + } + XCTAssertEqual(fixture.log.events, ["detail", "tasks", "upload", "detail", "tasks", "save", "detail", "tasks"]) + XCTAssertTrue(phases.contains(.validating)) + XCTAssertTrue(phases.contains(.uploading)) + XCTAssertTrue(phases.contains(.saving)) + XCTAssertEqual(phases.last, .succeeded) + XCTAssertEqual(fixture.model.phase, .succeeded) + XCTAssertEqual(fixture.model.progress, 100) + XCTAssertEqual(fixture.model.lastSavedFilm?.fileURL, fixture.uploader.returnedURL) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileURL, fixture.uploader.returnedURL) + XCTAssertNotNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.uploadedFileURL) + XCTAssertFalse(fixture.model.canSubmit) + XCTAssertFalse(fixture.model.isSubmitting) + await fixture.model.submit() + XCTAssertEqual(fixture.service.saves.count, 1) + } + + /// 已有成片必须明确替换;取消确认不会读取或上传,也不清空旧成片。 + func testExistingFilmRequiresExplicitReplacementConfirmation() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + fixture.service.records[0]["film"] = DeliveryVMData.film(taskID: 11, url: "https://example.com/old.mp4") + await fixture.prepare() + fixture.log.events.removeAll() + await fixture.model.submit() + XCTAssertTrue(fixture.log.events.isEmpty) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileURL, "https://example.com/old.mp4") + XCTAssertNotNil(fixture.model.submissionErrorMessage) + await fixture.model.submit(confirmReplacement: true) + XCTAssertEqual(fixture.uploader.calls, 1) + XCTAssertEqual(fixture.service.saves.count, 1) + XCTAssertEqual(fixture.model.phase, .succeeded) + } + + /// 页面加载后成片发生变化时,先展示新快照再要求重新确认,不能直接覆盖。 + func testChangedFilmBeforeUploadRequiresNewConfirmation() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.records[0]["film"] = DeliveryVMData.film(taskID: 11, url: "https://example.com/other.mp4") + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertEqual(fixture.service.saves.count, 0) + XCTAssertTrue(fixture.model.needsReplacementConfirmation) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileURL, "https://example.com/other.mp4") + XCTAssertNotNil(fixture.model.submissionErrorMessage) + } + + /// 上传期间订单取消时不再调用成片保存接口,已上传地址留作核对。 + func testCancellationDuringUploadStopsSave() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.uploader.onUpload = { fixture.service.detailValue = try! DeliveryVMData.detail(allowed: false, status: 40) } + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 1) + XCTAssertTrue(fixture.service.saves.isEmpty) + XCTAssertNil(fixture.model.successMessage) + XCTAssertNotNil(fixture.model.uploadedFileURL) + XCTAssertNotNil(fixture.model.submissionErrorMessage) + } + + /// 上传失败重试重新上传,失败期间任务旧成片保持不变。 + func testUploadFailurePreservesOldFilmAndRetriesUpload() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + fixture.service.records[0]["film"] = DeliveryVMData.film(taskID: 11, url: "https://example.com/old.mp4") + await fixture.prepare() + fixture.uploader.error = APIError.networkFailed("测试上传失败") + await fixture.model.submit(confirmReplacement: true) + XCTAssertEqual(fixture.model.selectedTask?.film?.fileURL, "https://example.com/old.mp4") + XCTAssertNil(fixture.model.uploadedFileURL) + XCTAssertNil(fixture.model.successMessage) + XCTAssertTrue(fixture.service.saves.isEmpty) + fixture.uploader.error = nil + await fixture.model.submit(confirmReplacement: true) + XCTAssertEqual(fixture.uploader.calls, 2) + XCTAssertEqual(fixture.service.saves.count, 1) + XCTAssertNotNil(fixture.model.successMessage) + } + + /// OSS 已成功但保存失败时保留原始 URL,重试只核对并保存,不再次上传。 + func testSaveFailureRetriesSameUploadedURLWithoutSecondUpload() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.saveError = APIError.networkFailed("测试保存失败") + await fixture.model.submit() + XCTAssertEqual(fixture.model.uploadedFileURL, fixture.uploader.returnedURL) + XCTAssertNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.selectedTask?.film) + fixture.service.saveError = nil + fixture.log.events.removeAll() + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 1) + XCTAssertEqual(fixture.service.saves.count, 2) + XCTAssertEqual(fixture.service.saves.map(\.url), [fixture.uploader.returnedURL, fixture.uploader.returnedURL]) + XCTAssertEqual(fixture.log.events, ["detail", "tasks", "save", "detail", "tasks"]) + XCTAssertEqual(fixture.model.phase, .succeeded) + } + + /// 保存超时但服务端已落库时,重试查询相同地址即确认成功,完成订单也不再写入。 + func testAmbiguousSaveReconcilesExistingFilmWithoutDuplicateWrite() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.saveError = APIError.networkFailed("测试保存超时") + fixture.service.persistDespiteError = true + await fixture.model.submit() + fixture.service.detailValue = try DeliveryVMData.detail(allowed: false, status: 30) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canSubmit) + XCTAssertFalse(fixture.model.needsReplacementConfirmation) + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 1) + XCTAssertEqual(fixture.service.saves.count, 1) + XCTAssertNotNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.submissionErrorMessage) + } + + /// 成片保存已成功而摘要刷新失败时保留成功回执,不能提示重新上传。 + func testSuccessfulSaveSurvivesRefreshFailure() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.onSave = { fixture.service.detailError = APIError.networkFailed("测试刷新失败") } + await fixture.model.submit() + XCTAssertNotNil(fixture.model.successMessage) + XCTAssertNotNil(fixture.model.refreshWarning) + XCTAssertNotNil(fixture.model.lastSavedFilm) + XCTAssertNil(fixture.model.submissionErrorMessage) + XCTAssertFalse(fixture.model.canSubmit) + } + + /// 上传过程不允许更换点位、任务或视频,也不能重复开始提交。 + func testUploadLocksAllSelections() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + let original = fixture.model.video + fixture.uploader.onUpload = { + XCTAssertTrue(fixture.model.isSubmitting) + fixture.model.selectSpot(id: 202) + fixture.model.selectTask(id: 12) + fixture.model.selectVideo(DeliveryVMData.video(name: "other.mp4")) + fixture.model.removeVideo() + XCTAssertEqual(fixture.model.selectedSpotID, 201) + XCTAssertEqual(fixture.model.selectedTaskID, 11) + XCTAssertEqual(fixture.model.video, original) + XCTAssertFalse(fixture.model.canSubmit) + } + await fixture.model.submit() + XCTAssertEqual(fixture.service.saves.first?.taskID, 11) + } + + /// 上传回调发现账号切换后清除本页内容,不能把文件保存到新账号。 + func testChangedContextDuringUploadPreventsSave() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.uploader.onUpload = { fixture.context.value = DeliveryVMData.context(token: "different-test-token") } + await fixture.model.submit() + XCTAssertTrue(fixture.service.saves.isEmpty) + XCTAssertNil(fixture.model.detail) + XCTAssertTrue(fixture.model.tasks.isEmpty) + XCTAssertNil(fixture.model.video) + XCTAssertNil(fixture.model.successMessage) + XCTAssertNotNil(fixture.model.loadErrorMessage) + } + + /// 保存请求期间会话切换时,迟到成功不能显示在新会话页面。 + func testChangedContextDuringSaveRejectsLateSuccess() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.onSave = { fixture.context.value = DeliveryVMData.context(token: "different-test-token") } + await fixture.model.submit() + XCTAssertEqual(fixture.service.saves.count, 1) + XCTAssertNil(fixture.model.successMessage) + XCTAssertNil(fixture.model.lastSavedFilm) + XCTAssertNil(fixture.model.detail) + XCTAssertNotNil(fixture.model.loadErrorMessage) + } + + /// 上传开始前发现任务已禁用或删除时清除选择,不自动使用下一条任务。 + func testRemovedTaskStopsBeforeUploadAndClearsSelection() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.records.removeFirst() + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertTrue(fixture.service.saves.isEmpty) + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.video) + XCTAssertNotNil(fixture.model.submissionErrorMessage) + } + + /// 刷新发现绑定任务消失后,保留入口绑定约束,不能把视频转给仍存在的其他任务。 + func testDisappearedBoundTaskCannotRedirectVideoToRemainingTask() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.records.removeFirst() + await fixture.model.refresh() + XCTAssertEqual(fixture.model.tasks.map(\.id), [12]) + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.video) + XCTAssertNil(fixture.model.uploadedFileURL) + XCTAssertTrue(fixture.model.submissionErrorMessage?.contains("返回素材库") == true) + + fixture.model.selectSpot(id: 202) + fixture.model.selectTask(id: 12) + fixture.model.selectVideo(DeliveryVMData.video(name: "replacement.mp4")) + await fixture.model.refresh() + await fixture.model.submit() + XCTAssertTrue(fixture.model.isTaskScoped) + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.video) + XCTAssertFalse(fixture.model.canChooseVideo) + XCTAssertFalse(fixture.model.canSubmit) + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertTrue(fixture.service.saves.isEmpty) + } + + /// 首次绑定后同任务被移至另一点位,清空视频且持续要求返回素材库,不静默重绑定。 + func testBoundTaskPointChangeInvalidatesVideoAndCannotRebind() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.records[0]["scenic_spot_id"] = 202 + await fixture.model.refresh() + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.video) + XCTAssertTrue(fixture.model.submissionErrorMessage?.contains("返回素材库") == true) + + fixture.model.selectSpot(id: 202) + fixture.model.selectTask(id: 11) + fixture.model.selectTask(id: 12) + fixture.model.selectVideo(DeliveryVMData.video(name: "replacement.mp4")) + await fixture.model.refresh() + await fixture.model.submit() + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.video) + XCTAssertFalse(fixture.model.canChooseVideo) + XCTAssertFalse(fixture.model.canSubmit) + XCTAssertTrue(fixture.model.submissionErrorMessage?.contains("返回素材库") == true) + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertTrue(fixture.service.saves.isEmpty) + } + + /// 已上传但保存失败的地址绑定原点位,任务改点后重试不能复用该地址保存。 + func testBoundTaskPointChangeDiscardsUploadedURLBeforeRetry() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.service.saveError = APIError.networkFailed("测试保存失败") + await fixture.model.submit() + XCTAssertEqual(fixture.model.uploadedFileURL, fixture.uploader.returnedURL) + XCTAssertEqual(fixture.service.saves.count, 1) + + fixture.service.records[0]["scenic_spot_id"] = 202 + fixture.service.saveError = nil + await fixture.model.refresh() + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertNil(fixture.model.video) + XCTAssertNil(fixture.model.uploadedFileURL) + XCTAssertTrue(fixture.model.submissionErrorMessage?.contains("返回素材库") == true) + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 1) + XCTAssertEqual(fixture.service.saves.count, 1) + XCTAssertNil(fixture.model.successMessage) + } + + /// 页面离开或任务取消后,迟到 OSS 成功不会继续调用保存接口。 + func testInvalidationAndCancellationIgnoreLateUpload() async throws { + for invalidate in [false, true] { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + let started = expectation(description: "测试上传已经挂起") + fixture.uploader.suspend = true + fixture.uploader.onUpload = { started.fulfill() } + let operation = Task { await fixture.model.submit() } + await fulfillment(of: [started], timeout: 2) + if invalidate { fixture.model.invalidate() } else { operation.cancel() } + fixture.uploader.finish() + await operation.value + XCTAssertTrue(fixture.service.saves.isEmpty) + XCTAssertNil(fixture.model.successMessage) + XCTAssertFalse(fixture.model.isSubmitting) + } + } + + /// 首次摘要或任务列表失败不消耗入口绑定,重试成功后仍自动绑定原任务。 + func testBoundTaskRecoversAfterInitialDetailOrTasksReadFailure() async throws { + for failsDetail in [true, false] { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + let failure = APIError.networkFailed("测试首次读取失败") + if failsDetail { fixture.service.detailError = failure } + else { fixture.service.tasksError = failure } + await fixture.model.refresh() + XCTAssertNotNil(fixture.model.loadErrorMessage) + XCTAssertNil(fixture.model.detail) + XCTAssertNil(fixture.model.selectedTaskID) + XCTAssertFalse(fixture.model.canChooseVideo) + fixture.model.selectSpot(id: 202) + fixture.model.selectTask(id: 12) + + fixture.service.detailError = nil + fixture.service.tasksError = nil + await fixture.model.refresh() + XCTAssertNil(fixture.model.loadErrorMessage) + XCTAssertNil(fixture.model.submissionErrorMessage) + XCTAssertTrue(fixture.model.isTaskScoped) + XCTAssertEqual(fixture.model.selectedTaskID, 11) + XCTAssertEqual(fixture.model.selectedSpotID, 201) + XCTAssertTrue(fixture.model.canChooseVideo) + fixture.model.selectVideo(DeliveryVMData.video()) + await fixture.model.submit() + XCTAssertEqual(fixture.service.saves.map(\.taskID), [11]) + } + } + + /// 交付前读取到其他订单时拒绝上传和保存。 + func testWrongOrderResponseIsRejectedBeforeUpload() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + XCTAssertTrue(fixture.model.canSubmit) + fixture.service.detailValue = try DeliveryVMData.detail(number: "OTHER-ORDER") + await fixture.model.submit() + XCTAssertEqual(fixture.uploader.calls, 0) + XCTAssertTrue(fixture.service.saves.isEmpty) + XCTAssertNotNil(fixture.model.submissionErrorMessage) + } + + /// 上传器返回不可提交的地址时立即失败,不将错误地址写给后端。 + func testInvalidUploadedURLIsNeverSaved() async throws { + let fixture = try DeliveryVMFixture(initialTaskID: 11) + await fixture.prepare() + fixture.uploader.returnedURL = "https://example.com/film.mp4?signature=test" + await fixture.model.submit() + XCTAssertTrue(fixture.service.saves.isEmpty) + XCTAssertNil(fixture.model.uploadedFileURL) + XCTAssertNotNil(fixture.model.submissionErrorMessage) + } +} + +/// 单个测试的相互隔离依赖和会话盒。 +@MainActor +private final class DeliveryVMFixture { + let log = DeliveryVMEvents() + let context = DeliveryVMContext(DeliveryVMData.context()) + let service: DeliveryVMService + let uploader: DeliveryVMUploader + let model: DroneDockDeliveryViewModel + + /// 创建一单两点位、每点一任务的测试依赖。 + init(initialTaskID: Int? = nil) throws { + service = try DeliveryVMService(log: log) + uploader = DeliveryVMUploader(log: log) + let context = context + model = DroneDockDeliveryViewModel(context: context.value, order: service.detailValue.order, + service: service, uploader: uploader, initialTaskID: initialTaskID, currentContext: { context.value }) + } + + /// 在已有预选任务上准备一段匿名本地视频。 + func prepare() async { + await model.refresh() + model.selectVideo(DeliveryVMData.video()) + } +} + +/// 保存测试过程中可切换的会话,避免读写应用登录态。 +@MainActor +private final class DeliveryVMContext { + var value: DroneDockHomeContext + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 网络和上传共用的调用时间线。 +@MainActor +private final class DeliveryVMEvents { var events: [String] = [] } + +/// 单元测试使用的正式解码模型,不包含真实订单或凭证。 +private enum DeliveryVMData { + static func context(token: String = "delivery-vm-test-token") -> DroneDockHomeContext { + .init(userID: "delivery-test-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: token) + } + + static func video(name: String = "test-film.mp4") -> DroneDockDeliveryVideo { + .init(url: URL(fileURLWithPath: "/tmp/\(name)"), fileName: name, fileSize: 20) + } + + static func detail(allowed: Bool = true, status: Int = 20, number: String = "TEST-ORDER", + materialStatus: Int = 0, activeTaskStatus: Int? = nil) throws -> DroneDockMaterialDetail { + var value: [String: Any] = ["order_number": number, "order_status": status, "can_upload_film": allowed, + "shoot_count": 5, "shot_count": 1, "remaining_count": 4, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "测试点位一"], + ["scenic_spot_id": 202, "scenic_spot_name": "测试点位二"]]] + value["material_status"] = materialStatus + value["active_task_status"] = activeTaskStatus + if activeTaskStatus != nil { value["active_task_id"] = 21 } + return try decode(value) + } + + static func record(id: Int, spot: Int) -> [String: Any] { + ["id": id, "order_number": "TEST-ORDER", "scenic_spot_id": spot, + "scenic_spot_name": "测试点位", "flight_status": 10, "materials": [], "film": NSNull()] + } + + static func film(taskID: Int, url: String) -> [String: Any] { + ["id": 99, "task_id": taskID, "file_url": url, "file_name": "test-film.mp4", "file_size": 20] + } + + static func decode(_ value: [String: Any]) throws -> T { + try JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: value)) + } +} + +/// 同步可控的订单和成片替身,模拟业务失败及请求成功但回包丢失。 +@MainActor +private final class DeliveryVMService: DroneDockDeliveryServing { + /// 已发出的成片保存参数。 + struct Save { let taskID: Int; let url: String; let name: String } + let log: DeliveryVMEvents + var detailValue: DroneDockMaterialDetail + var records: [[String: Any]] = [DeliveryVMData.record(id: 11, spot: 201), DeliveryVMData.record(id: 12, spot: 202)] + var detailError: Error? + var tasksError: Error? + var saveError: Error? + var persistDespiteError = false + var onSave: (() -> Void)? + private(set) var saves: [Save] = [] + + init(log: DeliveryVMEvents) throws { self.log = log; detailValue = try DeliveryVMData.detail() } + + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + log.events.append("detail") + if let detailError { throw detailError } + return detailValue + } + + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + log.events.append("tasks") + XCTAssertNil(spotID) + if let tasksError { throw tasksError } + return try DeliveryVMData.decode(["order_number": "TEST-ORDER", "total": records.count, "list": records]) + } + + func saveFilm(scenicID: Int, taskID: Int, fileURL: String, fileName: String) async throws -> DroneDockSavedFilm { + log.events.append("save") + saves.append(Save(taskID: taskID, url: fileURL, name: fileName)) + let film = DeliveryVMData.film(taskID: taskID, url: fileURL) + if saveError == nil || persistDespiteError, let index = records.firstIndex(where: { $0["id"] as? Int == taskID }) { + records[index]["film"] = film + } + onSave?() + if let saveError { throw saveError } + return try DeliveryVMData.decode(["task_id": taskID, "film": film]) + } +} + +/// 不访问磁盘或 OSS 的上传替身,可挂起验证离页取消行为。 +@MainActor +private final class DeliveryVMUploader: DroneDockFilmUploading { + let log: DeliveryVMEvents + var returnedURL = "https://example.com/test-film.mp4" + var error: Error? + var onUpload: (() -> Void)? + var suspend = false + private(set) var calls = 0 + private var continuation: CheckedContinuation? + + init(log: DeliveryVMEvents) { self.log = log } + + func upload(video: DroneDockDeliveryVideo, scenicID: Int, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws -> String { + calls += 1 + log.events.append("upload") + if suspend { + await withCheckedContinuation { continuation in + self.continuation = continuation + onUpload?() + } + } else { onUpload?() } + onProgress(10) + onProgress(50) + if let error { throw error } + onProgress(100) + return returnedURL + } + + func finish() { continuation?.resume(); continuation = nil } +} diff --git a/suixinkanTests/DroneDockDeliveryViewTests.swift b/suixinkanTests/DroneDockDeliveryViewTests.swift new file mode 100644 index 0000000..8656d8f --- /dev/null +++ b/suixinkanTests/DroneDockDeliveryViewTests.swift @@ -0,0 +1,648 @@ +import AVKit +import PhotosUI +import UIKit +import XCTest +@testable import suixinkan + +/// 使用隔离窗口和网络、上传替身验证共用云端交付页。 +@MainActor +final class DroneDockDeliveryViewTests: XCTestCase { + /// 云端点位最多 200 点宽,长名称完整换行且仍可选择到对应任务。 + func testLongPointNamesWrapWithinMaximumCardWidth() async throws { + let fixture = try DeliveryUIFixture() + let name = "测试景区东南观景平台通往山顶步道的全景航拍游客打卡点" + fixture.service.pointNames[0] = name + let controller = fixture.controller() + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.detail != nil && !controller.viewModel.isLoading } + let list = try collection(controller) + let point = try XCTUnwrap(find(controller.view, "drone.delivery.point.201") as? UICollectionViewCell) + let label = try XCTUnwrap(point.contentView.subviews.first as? UILabel) + XCTAssertEqual(label.text, name) + XCTAssertEqual(label.numberOfLines, 0) + XCTAssertLessThanOrEqual(point.bounds.width, 200) + XCTAssertGreaterThan(point.bounds.height, 40) + XCTAssertGreaterThanOrEqual(label.bounds.height + 1, + label.sizeThatFits(CGSize(width: label.bounds.width, height: .greatestFiniteMagnitude)).height) + try select("drone.delivery.point.201", list: list) + try await settle(window) { controller.viewModel.selectedSpotID == 201 } + capture(window, "云端交付-长点位限定宽度完整换行") + } + private weak var previousKeyWindow: UIWindow? + + /// 弹窗关闭与普通返回共享处理中确认,取消提示不会结束正在进行的上传。 + func testSheetCloseRequiresConfirmationDuringUpload() async throws { + let fixture = try DeliveryUIFixture() + fixture.uploader.hold = true + let controller = fixture.controller(initialTaskID: 1) + var closed = 0 + controller.configureSheetPresentation { closed += 1 } + let window = show(controller) + defer { fixture.uploader.release(); close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + try await chooseVideo(controller, window: window) + try button(controller.view, "drone.delivery.submit").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.phase == .uploading } + let closeItem = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { $0.accessibilityIdentifier == "drone.delivery.sheet.close" }) + XCTAssertTrue(closeItem.isEnabled) + XCTAssertNil(controller.navigationItem.rightBarButtonItems?.first { $0.accessibilityIdentifier == "drone.delivery.refresh" }) + XCTAssertFalse(try collection(controller).refreshControl?.isEnabled == true) + UIApplication.shared.sendAction(try XCTUnwrap(closeItem.action), to: closeItem.target, from: closeItem, for: nil) + try await settle(window) { controller.presentedViewController is UIAlertController && controller.presentedViewController?.transitionCoordinator == nil } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "停止处理并返回?") + XCTAssertEqual(alert.actions.map(\.title), ["继续处理", "停止并返回"]) + XCTAssertEqual(closed, 0) + XCTAssertEqual(controller.viewModel.phase, .uploading) + controller.dismiss(animated: false) + try await settle(window) { controller.presentedViewController == nil } + fixture.uploader.release() + try await settle(window) { controller.viewModel.successMessage != nil && !controller.viewModel.isSubmitting } + UIApplication.shared.sendAction(try XCTUnwrap(closeItem.action), to: closeItem.target, from: closeItem, for: nil) + XCTAssertEqual(closed, 1) + } + + /// 取消侧滑返回后云端页重新出现,必须恢复大弹窗与退出保护。 + func testSheetReappearanceRestoresModalProtection() async throws { + let fixture = try DeliveryUIFixture() + let controller = fixture.controller() + controller.configureSheetPresentation { XCTFail("恢复外观不能关闭弹窗") } + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.detail != nil && !controller.viewModel.isLoading } + let navigation = try XCTUnwrap(controller.navigationController) + navigation.setNavigationBarHidden(true, animated: false) + navigation.isModalInPresentation = false + controller.beginAppearanceTransition(true, animated: false) + controller.endAppearanceTransition() + XCTAssertFalse(navigation.isNavigationBarHidden) + XCTAssertTrue(navigation.isModalInPresentation) + XCTAssertEqual(controller.viewModel.detail?.order.orderNumber, "TEST-DELIVERY-UI") + } + + /// 订单入口不自动选择任务,用户明确点位、任务和视频后才可提交。 + func testOrderEntryRequiresExplicitTaskAndVideoSelection() async throws { + let fixture = try DeliveryUIFixture() + let controller = fixture.controller() + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.detail != nil && !controller.viewModel.isLoading } + XCTAssertEqual(controller.title, "云端上传") + XCTAssertNil(controller.viewModel.selectedTaskID) + XCTAssertFalse(try button(controller.view, "drone.delivery.submit").isEnabled) + XCTAssertEqual(try button(controller.view, "drone.delivery.submit").title(for: .normal), "去相册选视频") + XCTAssertNil(find(controller.view, "drone.delivery.selectedVideo")) + XCTAssertNil(find(controller.view, "drone.delivery.chooseVideo")) + let list = try collection(controller) + try select("drone.delivery.point.201", list: list) + try await settle(window) { self.find(controller.view, "drone.delivery.task.1") != nil } + try select("drone.delivery.task.1", list: list) + try await chooseVideo(controller, window: window) + XCTAssertEqual(controller.viewModel.selectedTaskID, 1) + XCTAssertEqual(controller.viewModel.video?.fileName, "测试成片.mp4") + XCTAssertTrue(try button(controller.view, "drone.delivery.submit").isEnabled) + XCTAssertEqual(try button(controller.view, "drone.delivery.submit").title(for: .normal), "上传所选视频") + XCTAssertNotNil(find(controller.view, "drone.delivery.selectedVideo")) + XCTAssertEqual(fixture.service.saved.count, 0) + XCTAssertEqual(fixture.uploader.count, 0) + capture(window, "云端交付-点位任务与单视频选择") + } + + /// 素材入口的任务从最新列表定位点位,页面显示其已有成片。 + func testMaterialEntryPreselectsTaskAndRequiresReplacementConfirmation() async throws { + let fixture = try DeliveryUIFixture(filmTask: 2) + let controller = fixture.controller(initialTaskID: 2) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 2 && !controller.viewModel.isLoading } + XCTAssertTrue(controller.viewModel.isTaskScoped) + XCTAssertEqual(controller.viewModel.selectedSpotID, 202) + XCTAssertEqual(controller.viewModel.selectedTask?.film?.fileName, "原成片.mp4") + XCTAssertNotNil(find(controller.view, "drone.delivery.boundTask.2")) + XCTAssertNil(find(controller.view, "drone.delivery.point.202")) + XCTAssertNil(find(controller.view, "drone.delivery.task.2")) + XCTAssertNil(find(controller.view, "drone.delivery.chooseTask")) + try await chooseVideo(controller, window: window) + try button(controller.view, "drone.delivery.submit").sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController is UIAlertController } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "替换此任务的成片?") + XCTAssertEqual(alert.actions.map(\.title), ["取消", "替换成片"]) + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + controller.dismiss(animated: false) + try await settle(window) { controller.presentedViewController == nil } + XCTAssertNotNil(controller.viewModel.video) + XCTAssertEqual(controller.viewModel.selectedTask?.film?.fileName, "原成片.mp4") + } + + /// 绑定任务入口直接使用底部按钮选片,选片只进入预览待上传状态。 + func testBoundTaskChoosesVideoFromVisibleFooterWithoutTaskSelection() async throws { + let fixture = try DeliveryUIFixture() + var pickerCount = 0 + let controller = fixture.controller(initialTaskID: 1, picker: { pickerCount += 1; return fixture.video }) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 && !controller.viewModel.isLoading } + XCTAssertNotNil(find(controller.view, "drone.delivery.boundTask.1")) + XCTAssertTrue(texts(controller.view).contains("交付你的精彩成片")) + XCTAssertTrue(texts(controller.view).contains("当前拍摄任务")) + XCTAssertTrue(texts(controller.view).contains("已关联")) + XCTAssertNil(find(controller.view, "drone.delivery.chooseTask")) + XCTAssertNil(find(controller.view, "drone.delivery.point.201")) + XCTAssertNil(find(controller.view, "drone.delivery.task.1")) + XCTAssertNil(find(controller.view, "drone.delivery.chooseVideo")) + XCTAssertNil(find(controller.view, "drone.delivery.chooseFile")) + let action = try button(controller.view, "drone.delivery.submit") + XCTAssertEqual(action.title(for: .normal), "去相册选视频") + assertVisibleAndHittable(action, in: window) + try await chooseVideo(controller, window: window) + + XCTAssertEqual(pickerCount, 1) + XCTAssertEqual(controller.viewModel.selectedTaskID, 1) + XCTAssertEqual(controller.viewModel.selectedSpotID, 201) + XCTAssertEqual(action.title(for: .normal), "上传所选视频") + XCTAssertNotNil(find(controller.view, "drone.delivery.selectedVideo")) + let cover = try XCTUnwrap(find(controller.view, "drone.delivery.selectedVideo.cover")) + XCTAssertGreaterThan(cover.bounds.width, 200) + XCTAssertGreaterThan(cover.bounds.height, 120) + XCTAssertTrue(texts(controller.view).contains("已选视频")) + XCTAssertTrue(texts(controller.view).contains("重新选择")) + XCTAssertTrue(texts(controller.view).contains("移除")) + assertVisibleAndHittable(try button(controller.view, "drone.delivery.preview"), in: window) + assertVisibleAndHittable(try button(controller.view, "drone.delivery.chooseVideo"), in: window) + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + capture(window, "云端上传-绑定任务直接选择并预览") + } + + /// 窄屏顶部任务信息可以滚动,视频预览与底部上传操作始终留在屏幕内。 + func testSmallScreenKeepsSelectedVideoAndFooterActionsVisibleWhileTaskScrolls() async throws { + let fixture = try DeliveryUIFixture() + let pointName = "佛顶塔七楼西南角通往观景平台的超长拍摄打卡点" + fixture.service.records[0]["scenic_spot_name"] = pointName + let controller = fixture.controller(initialTaskID: 1) + let window = show(controller, size: CGSize(width: 375, height: 667)) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 && !controller.viewModel.isLoading } + let point = try XCTUnwrap(find(controller.view, "drone.delivery.boundTask.title") as? UILabel) + XCTAssertEqual(point.text, pointName) + XCTAssertEqual(point.numberOfLines, 0) + XCTAssertGreaterThan(point.bounds.height, point.font.lineHeight * 1.5) + XCTAssertLessThanOrEqual(point.sizeThatFits(CGSize(width: point.bounds.width, height: .greatestFiniteMagnitude)).height, point.bounds.height + 1) + try await chooseVideo(controller, window: window) + let list = try collection(controller) + let card = try XCTUnwrap(find(controller.view, "drone.delivery.selectedVideo")) + let frame = card.convert(card.bounds, to: window) + XCTAssertTrue(window.bounds.contains(frame)) + XCTAssertGreaterThan(frame.height, 200) + let controls = try ["drone.delivery.preview", "drone.delivery.chooseVideo", "drone.delivery.removeVideo", "drone.delivery.submit"].map { try button(controller.view, $0) } + controls.forEach { assertVisibleAndHittable($0, in: window) } + list.setContentOffset(CGPoint(x: 0, y: max(0, list.contentSize.height - list.bounds.height)), animated: false) + window.layoutIfNeeded() + XCTAssertEqual(card.convert(card.bounds, to: window), frame) + controls.forEach { assertVisibleAndHittable($0, in: window) } + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + capture(window, "云端上传-设计稿小屏固定预览与操作") + } + + /// 长文件名摘要固定在底栏上方,滚动列表不遮挡预览和上传,播放本地视频不触发上传。 + func testLongVideoPreviewStaysVisibleAboveFooterWithoutUploading() async throws { + let fixture = try DeliveryUIFixture() + let source = try XCTUnwrap(Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock")) + let size = try XCTUnwrap(source.resourceValues(forKeys: [.fileSizeKey]).fileSize) + let name = "测试景区山顶观景平台与游客合影全景航拍完整剪辑交付成片_包含字幕与背景音乐的最终确认版本.mp4" + let video = DroneDockDeliveryVideo(url: source, fileName: name, fileSize: size) + let controller = fixture.controller(initialTaskID: 1, picker: { video }) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + try await chooseVideo(controller, window: window) + let list = try collection(controller) + let card = try XCTUnwrap(find(controller.view, "drone.delivery.selectedVideo")) + let label = try XCTUnwrap(find(card, "drone.delivery.selectedVideo.name") as? UILabel) + let submit = try button(controller.view, "drone.delivery.submit") + let footer = try XCTUnwrap(submit.superview) + let cardFrame = card.convert(card.bounds, to: window) + let footerFrame = footer.convert(footer.bounds, to: window) + XCTAssertEqual(label.text, name) + XCTAssertEqual(label.numberOfLines, 2) + XCTAssertGreaterThan(label.bounds.height, label.font.lineHeight) + XCTAssertTrue(card.bounds.contains(label.convert(label.bounds, to: card))) + XCTAssertTrue(window.bounds.contains(cardFrame)) + XCTAssertLessThanOrEqual(cardFrame.maxY, footerFrame.minY - 11) + XCTAssertFalse(card.isDescendant(of: list)) + for id in ["drone.delivery.preview", "drone.delivery.chooseVideo", "drone.delivery.removeVideo", "drone.delivery.submit"] { + assertVisibleAndHittable(try button(controller.view, id), in: window) + } + let bottomOffset = max(-list.adjustedContentInset.top, + list.contentSize.height - list.bounds.height + list.adjustedContentInset.bottom) + list.setContentOffset(CGPoint(x: 0, y: bottomOffset), animated: false) + window.layoutIfNeeded() + XCTAssertEqual(card.convert(card.bounds, to: window), cardFrame) + assertVisibleAndHittable(submit, in: window) + let preview = try button(controller.view, "drone.delivery.preview") + assertVisibleAndHittable(preview, in: window) + capture(window, "云端上传-长视频名预览与底部按钮可见") + + preview.sendActions(for: .touchUpInside) + try await settle(window) { + controller.presentedViewController is AVPlayerViewController && controller.presentedViewController?.transitionCoordinator == nil + } + let player = try XCTUnwrap(controller.presentedViewController as? AVPlayerViewController) + let asset = try XCTUnwrap(player.player?.currentItem?.asset as? AVURLAsset) + XCTAssertEqual(asset.url, source) + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + player.player?.pause() + controller.dismiss(animated: false) + try await settle(window) { controller.presentedViewController == nil } + XCTAssertEqual(controller.viewModel.video?.id, video.id) + assertVisibleAndHittable(submit, in: window) + try button(controller.view, "drone.delivery.removeVideo").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.video == nil && self.find(controller.view, "drone.delivery.selectedVideo") == nil } + XCTAssertEqual(submit.title(for: .normal), "去相册选视频") + assertVisibleAndHittable(submit, in: window) + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(FileManager.default.fileExists(atPath: source.path)) + } + + /// 取消重新选片保留原有视频和页面拥有的文件,不变更任务或发起上传。 + func testCancelledReplacementKeepsSelectedVideoAndOwnedFile() async throws { + let fixture = try DeliveryUIFixture() + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("drone-dock-delivery").appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let url = directory.appendingPathComponent("保留的视频.mp4") + try Data([1, 2, 3]).write(to: url) + defer { try? FileManager.default.removeItem(at: directory) } + let video = DroneDockDeliveryVideo(url: url, fileName: "保留的视频.mp4", fileSize: 3) + var picks = 0 + let controller = fixture.controller(initialTaskID: 1, picker: { picks += 1; return picks == 1 ? video : nil }) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + try await chooseVideo(controller, window: window) + let replace = try button(controller.view, "drone.delivery.chooseVideo") + assertVisibleAndHittable(replace, in: window) + replace.sendActions(for: .touchUpInside) + try await settle(window) { picks == 2 && self.buttonIfPresent(controller.view, "drone.delivery.submit")?.isEnabled == true } + XCTAssertEqual(controller.viewModel.video?.id, video.id) + XCTAssertEqual(controller.viewModel.selectedTaskID, 1) + XCTAssertTrue(FileManager.default.fileExists(atPath: url.path)) + XCTAssertEqual((find(controller.view, "drone.delivery.selectedVideo.name") as? UILabel)?.text, video.fileName) + XCTAssertEqual(try button(controller.view, "drone.delivery.submit").title(for: .normal), "上传所选视频") + XCTAssertFalse(texts(controller.view).contains("交付尚未完成")) + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + } + + /// 系统相册仅允许单选视频,模拟取消不读取媒体且保留绑定任务。 + func testSystemPickerAllowsOneVideoAndCancellationKeepsBoundTask() async throws { + let fixture = try DeliveryUIFixture() + let controller = fixture.controller(initialTaskID: 1, useSystemPicker: true) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 && !controller.viewModel.isLoading } + let choose = try button(controller.view, "drone.delivery.submit") + assertVisibleAndHittable(choose, in: window) + choose.sendActions(for: .touchUpInside) + try await settle(window) { + controller.presentedViewController is PHPickerViewController && controller.presentedViewController?.transitionCoordinator == nil + } + let picker = try XCTUnwrap(controller.presentedViewController as? PHPickerViewController) + XCTAssertEqual(picker.configuration.selectionLimit, 1) + XCTAssertNotNil(picker.configuration.filter) + XCTAssertEqual(picker.configuration.preferredAssetRepresentationMode, .current) + XCTAssertTrue(picker.delegate === controller) + controller.picker(picker, didFinishPicking: []) + try await settle(window) { controller.presentedViewController == nil } + XCTAssertEqual(controller.viewModel.selectedTaskID, 1) + XCTAssertEqual(controller.viewModel.selectedSpotID, 201) + XCTAssertNil(controller.viewModel.video) + XCTAssertNil(find(controller.view, "drone.delivery.selectedVideo")) + XCTAssertEqual(choose.title(for: .normal), "去相册选视频") + assertVisibleAndHittable(choose, in: window) + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + } + + /// 没有有效任务或服务端不允许上传时不能选择视频或发送文件。 + func testEmptyAndUnavailableOrdersKeepUploadDisabled() async throws { + for empty in [true, false] { + let fixture = try DeliveryUIFixture(empty: empty, allowed: false) + let controller = fixture.controller(initialTaskID: empty ? nil : 1) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.detail != nil && !controller.viewModel.isLoading } + XCTAssertFalse(try button(controller.view, "drone.delivery.submit").isEnabled) + XCTAssertFalse(controller.viewModel.canChooseVideo) + if empty { XCTAssertTrue(texts(controller.view).contains("暂无可交付的拍摄任务")) } + XCTAssertEqual(fixture.uploader.count, 0) + XCTAssertTrue(fixture.service.saved.isEmpty) + } + } + + /// OSS 达到 100% 后仍处于保存阶段,保存成功才触发上级刷新回调。 + func testUploadProgressAndSavingAreDistinctFromDeliveredSuccess() async throws { + let fixture = try DeliveryUIFixture() + fixture.uploader.hold = true + fixture.service.holdSave = true + var notified = 0 + let controller = fixture.controller(initialTaskID: 1, saved: { notified += 1 }) + let window = show(controller) + defer { fixture.uploader.release(); fixture.service.releaseSave(); close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + try await chooseVideo(controller, window: window) + try button(controller.view, "drone.delivery.submit").sendActions(for: .touchUpInside) + try await settle(window) { fixture.uploader.count == 1 && controller.viewModel.phase == .uploading } + fixture.uploader.report(55) + try await settle(window) { self.texts(controller.view).contains("正在上传视频 55%") } + XCTAssertFalse(try button(controller.view, "drone.delivery.submit").isEnabled) + fixture.uploader.release() + try await settle(window) { controller.viewModel.phase == .saving && fixture.service.saved.count == 1 } + XCTAssertEqual(controller.viewModel.progress, 100) + XCTAssertTrue(texts(controller.view).contains("视频上传完成,正在保存成片…")) + XCTAssertNil(controller.viewModel.successMessage) + XCTAssertEqual(notified, 0) + fixture.service.releaseSave() + try await settle(window) { controller.viewModel.successMessage != nil && !controller.viewModel.isSubmitting && notified == 1 } + XCTAssertFalse(try button(controller.view, "drone.delivery.submit").isEnabled) + XCTAssertEqual(fixture.service.saved.first?.task, 1) + XCTAssertEqual(fixture.service.saved.first?.name, "测试成片.mp4") + capture(window, "云端交付-业务保存后成功") + } + + /// 保存失败仍使用统一上传按钮,内部复用已上传 URL,不再次上传同一视频。 + func testSaveFailureRetriesWithoutUploadingAgain() async throws { + let fixture = try DeliveryUIFixture() + fixture.service.failSaveCount = 1 + var notified = 0 + let controller = fixture.controller(initialTaskID: 1, saved: { notified += 1 }) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + try await chooseVideo(controller, window: window) + try button(controller.view, "drone.delivery.submit").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.submissionErrorMessage != nil && !controller.viewModel.isSubmitting } + XCTAssertEqual(notified, 0) + XCTAssertEqual(fixture.uploader.count, 1) + XCTAssertNotNil(controller.viewModel.uploadedFileURL) + XCTAssertEqual(try button(controller.view, "drone.delivery.submit").title(for: .normal), "上传所选视频") + try button(controller.view, "drone.delivery.submit").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.successMessage != nil && notified == 1 } + XCTAssertEqual(fixture.uploader.count, 1) + XCTAssertEqual(fixture.service.saved.count, 2) + } + + /// 首次读取失败可重试,视频准备失败不会触发上传。 + func testLoadRetryAndPickerFailureRemainRecoverable() async throws { + let fixture = try DeliveryUIFixture() + fixture.service.failDetail = true + let controller = fixture.controller(initialTaskID: 1, picker: { throw URLError(.cannotOpenFile) }) + let window = show(controller) + defer { close(window) } + try await settle(window) { self.find(controller.view, "drone.delivery.retry") != nil } + XCTAssertFalse(try button(controller.view, "drone.delivery.submit").isEnabled) + fixture.service.failDetail = false + try button(controller.view, "drone.delivery.retry").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + let choose = try button(controller.view, "drone.delivery.submit") + XCTAssertTrue(choose.isEnabled) + XCTAssertEqual(choose.title(for: .normal), "去相册选视频") + choose.sendActions(for: .touchUpInside) + try await settle(window) { self.texts(controller.view).contains("交付尚未完成") } + XCTAssertNil(controller.viewModel.video) + XCTAssertTrue(try button(controller.view, "drone.delivery.submit").isEnabled) + XCTAssertEqual(try button(controller.view, "drone.delivery.submit").title(for: .normal), "去相册选视频") + XCTAssertEqual(fixture.uploader.count, 0) + } + + /// 新文件被校验拒绝时保留之前的有效选择及其临时文件。 + func testRejectedReplacementVideoPreservesPreviousOwnedFile() async throws { + let fixture = try DeliveryUIFixture() + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("drone-dock-delivery").appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let url = directory.appendingPathComponent("原选择.mp4") + try Data([1, 2, 3]).write(to: url) + defer { try? FileManager.default.removeItem(at: directory) } + let original = DroneDockDeliveryVideo(url: url, fileName: "原选择.mp4", fileSize: 3) + let invalid = DroneDockDeliveryVideo(url: fixture.video.url, fileName: "无效\n文件.mp4", fileSize: 3) + var picks = 0 + let controller = fixture.controller(initialTaskID: 1, picker: { picks += 1; return picks == 1 ? original : invalid }) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedTaskID == 1 } + try await chooseVideo(controller, window: window) + try button(controller.view, "drone.delivery.chooseVideo").sendActions(for: .touchUpInside) + try await settle(window) { self.texts(controller.view).contains("交付尚未完成") } + XCTAssertEqual(controller.viewModel.video?.id, original.id) + XCTAssertTrue(FileManager.default.fileExists(atPath: original.url.path)) + XCTAssertEqual(fixture.uploader.count, 0) + } + + /// 有效视频从 App 资源复制并校验成功,清理只删除本页拥有的副本。 + func testDocumentLoaderCopiesValidBundledVideoAndDiscardsOnlyItsCopy() async throws { + let source = try XCTUnwrap(Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock")) + let sourceSize = try XCTUnwrap(source.resourceValues(forKeys: [.fileSizeKey]).fileSize) + let video = try await DroneDockDeliveryVideoLoader.load(documentURL: source) + defer { DroneDockDeliveryVideoLoader.discard(video.url) } + XCTAssertNotEqual(video.url.standardizedFileURL, source.standardizedFileURL) + XCTAssertEqual(video.fileName, source.lastPathComponent) + XCTAssertEqual(video.fileSize, sourceSize) + XCTAssertGreaterThan(video.fileSize, 0) + XCTAssertEqual(try DroneDockFilmPolicy.validate(video: video), "video/mp4") + XCTAssertTrue(FileManager.default.fileExists(atPath: source.path)) + XCTAssertTrue(FileManager.default.fileExists(atPath: video.url.path)) + DroneDockDeliveryVideoLoader.discard(source) + XCTAssertTrue(FileManager.default.fileExists(atPath: source.path)) + DroneDockDeliveryVideoLoader.discard(video.url) + XCTAssertFalse(FileManager.default.fileExists(atPath: video.url.path)) + XCTAssertTrue(FileManager.default.fileExists(atPath: source.path)) + XCTAssertEqual(try source.resourceValues(forKeys: [.fileSizeKey]).fileSize, sourceSize) + } + + /// 无视频轨道的伪装 MP4 在文件准备阶段失败,且原文件不会被误删。 + func testDocumentLoaderRejectsInvalidVideoAndKeepsSource() async throws { + let folder = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) + let source = folder.appendingPathComponent("invalid.mp4") + try Data("not a video".utf8).write(to: source) + defer { try? FileManager.default.removeItem(at: folder) } + do { + _ = try await DroneDockDeliveryVideoLoader.load(documentURL: source) + XCTFail("没有视频轨道时不应允许上传") + } catch { XCTAssertTrue(FileManager.default.fileExists(atPath: source.path)) } + DroneDockDeliveryVideoLoader.discard(source) + XCTAssertTrue(FileManager.default.fileExists(atPath: source.path)) + } + + private func chooseVideo(_ controller: DroneDockDeliveryViewController, window: UIWindow) async throws { + let actionID = controller.viewModel.video == nil ? "drone.delivery.submit" : "drone.delivery.chooseVideo" + try await settle(window) { self.buttonIfPresent(controller.view, actionID)?.isEnabled == true } + let choose = try button(controller.view, actionID) + assertVisibleAndHittable(choose, in: window) + choose.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.video != nil && self.buttonIfPresent(controller.view, "drone.delivery.submit")?.isEnabled == true } + } + + /// 同时验证布局与实际触摸命中,避免离屏或被其他视图遮住的按钮通过测试。 + private func assertVisibleAndHittable(_ control: UIControl, in window: UIWindow, + file: StaticString = #filePath, line: UInt = #line) { + let frame = control.convert(control.bounds, to: window) + XCTAssertFalse(hidden(control), file: file, line: line) + XCTAssertTrue(control.isEnabled, file: file, line: line) + XCTAssertGreaterThan(frame.width, 0, file: file, line: line) + XCTAssertGreaterThan(frame.height, 0, file: file, line: line) + XCTAssertTrue(window.bounds.contains(frame), file: file, line: line) + let hit = window.hitTest(CGPoint(x: frame.midX, y: frame.midY), with: nil) + XCTAssertTrue(hit === control || hit?.isDescendant(of: control) == true, + "可见按钮必须能收到点击:\(control.accessibilityIdentifier ?? "")", file: file, line: line) + } + + private func collection(_ controller: UIViewController) throws -> UICollectionView { + controller.loadViewIfNeeded() + return try XCTUnwrap(find(controller.view, "drone.delivery.remote.list") as? UICollectionView) + } + private func select(_ id: String, list: UICollectionView) throws { + let cell = try XCTUnwrap(find(list, id) as? UICollectionViewCell) + let path = try XCTUnwrap(list.indexPath(for: cell)) + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + private func buttonIfPresent(_ view: UIView, _ id: String) -> UIButton? { find(view, id) as? UIButton } + private func button(_ view: UIView, _ id: String) throws -> UIButton { try XCTUnwrap(buttonIfPresent(view, id)) } + private func descendants(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap(descendants) } + private func hidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(hidden) ?? false) } + private func find(_ root: UIView, _ id: String) -> UIView? { descendants(root).first { $0.accessibilityIdentifier == id && !hidden($0) } } + private func texts(_ root: UIView) -> [String] { descendants(root).compactMap { ($0 as? UILabel).flatMap { hidden($0) ? nil : $0.text } } } + private func show(_ controller: UIViewController, size: CGSize? = nil) -> UIWindow { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map(UIWindow.init(windowScene:)) ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = size.map { CGRect(origin: .zero, size: $0) } ?? scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible(); window.layoutIfNeeded() + return window + } + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true; window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + private func settle(_ window: UIWindow, file: StaticString = #filePath, line: UInt = #line, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 200_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + capture(window, "交付页等待超时-\(line)") + XCTFail("交付页面未按预期更新", file: file, line: line) + throw URLError(.timedOut) + } + private func capture(_ window: UIWindow, _ name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + let attachment = XCTAttachment(image: image); attachment.name = name; attachment.lifetime = .keepAlways; add(attachment) + } +} + +/// 为两个入口提供同一订单快照,所有上传与保存均由替身处理。 +@MainActor +private final class DeliveryUIFixture { + let service: DeliveryUIService + let uploader = DeliveryUIUploader() + let context = DroneDockHomeContext(userID: "delivery-ui-user", accountType: "store_user", scenicID: 128, scenicName: "测试景区", storeID: 37, photographerName: "测试人员", token: "delivery-ui-token") + let order: DroneDockHomeOrder + let video: DroneDockDeliveryVideo + let directory: URL + + init(empty: Bool = false, allowed: Bool = true, filmTask: Int? = nil) throws { + service = try DeliveryUIService(empty: empty, allowed: allowed, filmTask: filmTask) + order = try deliveryDecode(["order_number": "TEST-DELIVERY-UI"]) + directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let url = directory.appendingPathComponent("测试成片.mp4") + try Data([1, 2, 3]).write(to: url) + video = DroneDockDeliveryVideo(url: url, fileName: "测试成片.mp4", fileSize: 3) + } + deinit { try? FileManager.default.removeItem(at: directory) } + func controller(initialTaskID: Int? = nil, saved: (() -> Void)? = nil, useSystemPicker: Bool = false, + picker: (@MainActor () async throws -> DroneDockDeliveryVideo?)? = nil) -> DroneDockDeliveryViewController { + let context = context + let video = video + let model = DroneDockDeliveryViewModel(context: context, order: order, service: service, uploader: uploader, initialTaskID: initialTaskID, currentContext: { context }) + return DroneDockDeliveryViewController(viewModel: model, onDidSave: saved, + videoPicker: useSystemPicker ? nil : picker ?? { video }) + } +} + +/// 可暂停保存以验证 OSS 成功和业务交付成功的展示边界。 +@MainActor +private final class DeliveryUIService: DroneDockDeliveryServing { + var pointNames = ["测试点位一", "测试点位二"] + var failDetail = false + var failSaveCount = 0 + var holdSave = false + var saved: [(task: Int, url: String, name: String)] = [] + private var saveContinuation: CheckedContinuation? + var records: [[String: Any]] + private let allowed: Bool + + init(empty: Bool, allowed: Bool, filmTask: Int?) throws { + self.allowed = allowed + records = empty ? [] : [1, 2].map { id in + var result: [String: Any] = ["id": id, "task_id": id, "order_number": "TEST-DELIVERY-UI", "scenic_spot_id": id == 1 ? 201 : 202, + "scenic_spot_name": id == 1 ? "测试点位一" : "测试点位二", "seq": id, "air_line_name": "测试航线", "flight_status": 30, + "created_at": "2026-10-29 10:00:00", "materials": [], "film": NSNull()] + if id == filmTask { result["film"] = ["id": 99, "task_id": id, "file_url": "https://example.invalid/old.mp4", "file_name": "原成片.mp4"] } + return result + } + } + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + if failDetail { throw URLError(.notConnectedToInternet) } + return try deliveryDecode(["order_number": "TEST-DELIVERY-UI", "user_phone": "130****0001", "project_name": "测试航拍套餐", + "order_status": 20, "can_upload_film": allowed, "shoot_count": 5, "shot_count": 2, "remaining_count": 3, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": pointNames[0]], ["scenic_spot_id": 202, "scenic_spot_name": pointNames[1]]]]) + } + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + try deliveryDecode(["order_number": "TEST-DELIVERY-UI", "total": records.count, "list": records]) + } + func saveFilm(scenicID: Int, taskID: Int, fileURL: String, fileName: String) async throws -> DroneDockSavedFilm { + saved.append((taskID, fileURL, fileName)) + if holdSave { await withCheckedContinuation { saveContinuation = $0 } } + if failSaveCount > 0 { failSaveCount -= 1; throw URLError(.timedOut) } + let film: [String: Any] = ["id": 100 + taskID, "task_id": taskID, "file_url": fileURL, "file_name": fileName] + if let index = records.firstIndex(where: { $0["id"] as? Int == taskID }) { records[index]["film"] = film } + return try deliveryDecode(["task_id": taskID, "film": film]) + } + func releaseSave() { holdSave = false; saveContinuation?.resume(); saveContinuation = nil } +} + +/// 可控制上传进度,不访问 OSS 或读取测试视频内容。 +@MainActor +private final class DeliveryUIUploader: DroneDockFilmUploading { + var count = 0 + var hold = false + private var continuation: CheckedContinuation? + private var progress: (@MainActor @Sendable (Int) -> Void)? + func upload(video: DroneDockDeliveryVideo, scenicID: Int, onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws -> String { + count += 1; progress = onProgress; onProgress(1) + if hold { await withCheckedContinuation { continuation = $0 } } + onProgress(100) + return "https://example.invalid/uploaded.mp4" + } + func report(_ value: Int) { progress?(value) } + func release() { hold = false; continuation?.resume(); continuation = nil } +} + +/// 业务模型使用与后端相同的 JSON 结构,避免测试构造绕过解码校验。 +private func deliveryDecode(_ value: [String: Any]) throws -> T { + try JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: value)) +} diff --git a/suixinkanTests/DroneDockDiagnosticsTests.swift b/suixinkanTests/DroneDockDiagnosticsTests.swift new file mode 100644 index 0000000..b80118a --- /dev/null +++ b/suixinkanTests/DroneDockDiagnosticsTests.swift @@ -0,0 +1,165 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// Release 共用日志通路的原值、请求关联和异常覆盖;全部使用内存传输。 +@MainActor +final class DroneDockDiagnosticsTests: XCTestCase { + /// 每个已接入业务接口均输出完整请求和响应,重复轮询也不去重;普通日志开关不屏蔽机巢诊断。 + func testAllModuleEndpointsLogPayloadAndRepeatedResponses() async throws { + let prefix = "/api/yf-handset-app/photog/multi-plane/" + let paths = ["orders", "today-stats", "projects", "pay-code", "receipts", "project-info", + "tasks/create", "orders/detail", "tasks", "tasks/film", "orders/confirm-code"].map { prefix + $0 } + + ["home", "plane-status", "shoot", "shooting", "start-shoot", "command", "live", "status"].map { "/api/app/airport/" + $0 } + + ["/api/app/scenic-media/sessions", "/api/app/scenic-media/session-detail"] + let text = String(repeating: "完整业务数据", count: 300) + let response = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": ["detail": text]]) + for path in paths { + let session = MockURLSession(responses: [response, response]) + var logs: [String] = [] + var debug: [String] = [] + let client = APIClient(environment: .testing, session: session, debugLogSink: { debug.append($0) }, + droneDockLogSink: { logs.append($0) }) + for _ in 0..<2 { + let _: DroneDockHomeJSONValue = try await client.send(APIRequest( + method: .post, path: path, queryItems: [.init(name: "scenic_id", value: "123")], + body: ["task_id": 501], logsPayload: false)) + } + let objects = try logs.map { try XCTUnwrap(JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any]) } + let starts = objects.filter { $0["event"] as? String == "request.started" } + let responses = objects.filter { $0["event"] as? String == "response.received" } + XCTAssertEqual(starts.count, 2, path) + XCTAssertEqual(responses.count, 2, path) + XCTAssertEqual(Set(starts.compactMap { $0["request_id"] as? String }).count, 2) + XCTAssertEqual((starts.first?["body"] as? [String: Int])?["task_id"], 501) + XCTAssertEqual(starts.first?["query"] as? [[String: String]], [["scenic_id": "123"]]) + let envelope = try XCTUnwrap(responses.first?["body"] as? [String: Any]) + XCTAssertEqual((envelope["data"] as? [String: String])?["detail"], text) + XCTAssertTrue(debug.isEmpty, path) + } + } + + /// STS 按用户要求输出完整配置及临时凭证,且不改写业务响应。 + func testSharedSTSLogsConfigurationAndCredentials() async throws { + let payload = Data(#"{"code":100000,"data":{"base_url":"https://example.com","endpoint":"oss-test","region":"cn-test","bucket":"test-bucket","expire_seconds":3600,"credentials":{"access_key_id":"SECRET_KEY","access_key_secret":"SECRET_SECRET","security_token":"SECRET_TOKEN"}}}"#.utf8) + var logs: [String] = [] + var debug: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(responses: [payload]), + debugLogSink: { debug.append($0) }, droneDockLogSink: { logs.append($0) }) + let result = try await UploadAPI(client: client).aliyunOSSBucket(bucket: "default") + XCTAssertEqual(result.credentials.accessKeyId, "SECRET_KEY") + XCTAssertTrue(debug.isEmpty) + let text = logs.joined() + for secret in ["SECRET_KEY", "SECRET_SECRET", "SECRET_TOKEN"] { XCTAssertTrue(text.contains(secret)) } + XCTAssertTrue(text.contains("test-bucket")) + XCTAssertTrue(text.contains("3600")) + XCTAssertTrue(text.contains("response.received")) + XCTAssertTrue(text.contains("default")) + } + + /// 文件日志保留完整签名地址、大小、状态及关联 ID。 + func testFileTransferTraceRetainsCorrelationAndSignedAddress() throws { + let trace = DroneDockFileTransferTrace(operation: "file_download", method: "GET", + remoteURL: URL(string: "https://example.test/private-name.mp4?signature=SECRET")) + let start = trace.message("request.started") + let end = trace.message("response.received", fields: ["http_status": 200, "bytes": 1024]) + let objects = try [start, end].map { try XCTUnwrap(JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any]) } + XCTAssertEqual(objects[0]["request_id"] as? String, objects[1]["request_id"] as? String) + XCTAssertEqual(objects[1]["http_status"] as? Int, 200) + XCTAssertEqual(objects[1]["bytes"] as? Int, 1024) + XCTAssertTrue(end.contains("example.test")) + XCTAssertTrue((start + end).contains("SECRET")) + XCTAssertTrue((start + end).contains("private-name")) + } + + /// 请求 Header、RTC URL 和嵌套字段均按原值记录;实际请求和响应保持不变。 + func testLiveResponseIsCompleteAndCorrelatedWithoutChangingPayload() async throws { + let body: [String: Any] = ["code": 100000, "data": [ + "order_flight_task_id": 501, "playable": true, + "play": ["url_type": "volc", "url": "app_id=one&token=SECRET_RTC&room_id=room"], + "token": "SECRET_BODY", "phone": "13912345678", "airport_sn": "SECRET_SN", + "nested": [["Authorization": "SECRET_NESTED"]] + ]] + let session = MockURLSession(responses: [try JSONSerialization.data(withJSONObject: body)]) + var logs: [String] = [] + var debug: [String] = [] + let client = APIClient(environment: .testing, session: session, debugLogSink: { debug.append($0) }, + droneDockLogSink: { logs.append($0) }) + client.bindAuthTokenProvider { "SECRET_AUTH" } + let result: DroneDockHomeJSONValue = try await client.send(APIRequest( + method: .get, path: "/api/app/airport/live", queryItems: [.init(name: "id", value: "501")], logsPayload: false)) + XCTAssertTrue(String(describing: result).contains("SECRET_RTC"), "日志不修改业务响应") + XCTAssertEqual(session.requests.first?.value(forHTTPHeaderField: "token"), "SECRET_AUTH") + XCTAssertTrue(debug.isEmpty, "机巢日志不重复进入旧日志通路") + let text = logs.joined() + for value in ["SECRET_RTC", "SECRET_BODY", "13912345678", "SECRET_SN", "SECRET_NESTED", "SECRET_AUTH"] { + XCTAssertTrue(text.contains(value), value) + } + XCTAssertTrue(text.contains("volc")) + XCTAssertTrue(text.contains("501")) + XCTAssertTrue(text.contains("local_simulation")) + let objects = try logs.map { try XCTUnwrap(JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any]) } + XCTAssertEqual(objects.compactMap { $0["event"] as? String }, ["request.started", "response.received", "response.decoded"]) + XCTAssertEqual(Set(objects.compactMap { $0["request_id"] as? String }).count, 1) + XCTAssertTrue(objects.allSatisfy { $0["elapsed_ms"] != nil }) + let response = try XCTUnwrap(objects.first { $0["event"] as? String == "response.received" }) + XCTAssertTrue(NSDictionary(dictionary: try XCTUnwrap(response["body"] as? [String: Any])).isEqual(to: body)) + XCTAssertNotNil(response["response_headers"]) + XCTAssertFalse(text.contains("")) + } + + /// 区分服务端业务拒绝、HTTP 错误、解析失败、网络失败和主动取消。 + func testErrorOutcomesAreVisible() async throws { + let cases: [(MockURLSession, String)] = [ + (.init(responses: [try TestJSON.errorEnvelope(code: 100099, msg: "条件不满足")]), "business_rejected"), + (.init(responses: [Data("bad gateway".utf8)], statusCode: 502), "response.rejected"), + (.init(responses: [Data("invalid JSON".utf8)]), "decode_failed"), + (.init(results: [.failure(URLError(.timedOut))]), "request.failed"), + (.init(results: [.failure(URLError(.cancelled))]), "request.cancelled") + ] + for (session, expected) in cases { + var logs: [String] = [] + let client = APIClient(environment: .testing, session: session, droneDockLogSink: { logs.append($0) }) + do { + let _: DroneDockHomeJSONValue = try await client.send(APIRequest(method: .get, path: "/api/app/airport/shooting")) + XCTFail("应失败") + } catch {} + XCTAssertTrue(logs.joined().contains(expected), expected) + } + } + + /// 设备请求进入普通隔离传输,失败日志如实记录网络失败而非构建拦截。 + func testDeviceRequestFailureIsLoggedAfterOrdinaryTransportAttempt() async throws { + let session = DiagnosticsUnreachableSession() + var logs: [String] = [] + let client = APIClient(environment: .production, session: session, droneDockLogSink: { logs.append($0) }) + do { + let _: DroneDockHomeJSONValue = try await client.send(APIRequest(method: .post, path: "/api/app/airport/shoot")) + XCTFail("隔离传输主动失败") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.calls, 1) + XCTAssertTrue(logs.joined().contains("request.started")) + XCTAssertTrue(logs.joined().contains("request.failed")) + XCTAssertFalse(logs.joined().contains("request.blocked")) + } + + /// 长中文 JSON 按字节分段后可以无损拼接,不额外截断业务字段。 + func testChunkingAndFreeTextPreservation() { + let text = String(repeating: "中文😀\n", count: 1_000) + let chunks = DroneDockDiagnostics.chunks(text) + XCTAssertEqual(chunks.joined(), text) + XCTAssertTrue(chunks.allSatisfy { $0.utf8.count <= 600 }) + let logged = DroneDockDiagnostics.json(["message": "token=ABC https://example.test/a?signature=DEF 13912345678"]) + for secret in ["ABC", "DEF", "13912345678"] { XCTAssertTrue(logged.contains(secret)) } + XCTAssertFalse(DroneDockDiagnostics.includes(path: "/api/login")) + } +} + +/// 无网络能力的普通传输替身,进入后立即回报离线,不调用 URLSession。 +private final class DiagnosticsUnreachableSession: URLSessionProtocol { + private(set) var calls = 0 + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + calls += 1 + throw URLError(.notConnectedToInternet) + } +} diff --git a/suixinkanTests/DroneDockFilmUploaderTests.swift b/suixinkanTests/DroneDockFilmUploaderTests.swift new file mode 100644 index 0000000..519b403 --- /dev/null +++ b/suixinkanTests/DroneDockFilmUploaderTests.swift @@ -0,0 +1,249 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用本地临时文件与传输替身验证云端上传,不访问 OSS 或真实凭证。 +@MainActor +final class DroneDockFilmUploaderTests: XCTestCase { + private let directory = FileManager.default.temporaryDirectory.appendingPathComponent("dock-film-tests-\(UUID().uuidString)", isDirectory: true) + + /// 上传使用配置返回的 bucket/base_url、真实文件 URL 和 video MIME,成功后才返回地址。 + func testUploadStreamsFileUsingReturnedConfigurationAndRawAddress() async throws { + let config = try FilmConfigStub() + let transport = FilmTransportStub() + let progress = FilmProgressRecorder() + let video = try video(name: "测试成片 #1.mp4") + let result = try await DroneDockFilmUploader(configService: config, transport: transport) + .upload(video: video, scenicID: 128) { progress.values.append($0) } + XCTAssertEqual(config.requests, ["default"]) + let call = try XCTUnwrap(transport.calls.first) + XCTAssertEqual(call.fileURL, video.url) + XCTAssertEqual(call.configuration.bucket, "test-bucket") + XCTAssertEqual(call.configuration.credentials.accessKeyId, "test-key") + XCTAssertEqual(call.configuration.endpoint, "https://oss-cn-shanghai.aliyuncs.com") + XCTAssertEqual(call.contentType, "video/mp4") + XCTAssertTrue(call.objectKey.hasPrefix("task/")) + XCTAssertTrue(call.objectKey.contains("/128/")) + XCTAssertTrue(call.objectKey.hasSuffix("_film.mp4")) + let url = try XCTUnwrap(URL(string: result)) + XCTAssertEqual(url.host, "test-bucket.oss-cn-shanghai.aliyuncs.com") + XCTAssertEqual(url.path, "/prefix/" + call.objectKey) + XCTAssertNil(url.query) + XCTAssertNil(url.fragment) + XCTAssertFalse(result.contains(" ")) + XCTAssertFalse(result.contains("%")) + XCTAssertTrue(result.unicodeScalars.allSatisfy { $0.isASCII }) + XCTAssertNotNil(DroneDockFilmPolicy.remoteURL(result)) + XCTAssertEqual(progress.values.first, 1) + XCTAssertEqual(progress.values.last, 100) + } + + /// 中文、空格和井号不进入对象路径,原格式保留为小写扩展名。 + func testObjectKeysUseASCIIForSpecialFileNamesAndLowercaseExtensions() async throws { + for name in ["中文成片.MP4", "test film.MOV", "test#film.WEBM"] { + let transport = FilmTransportStub() + let selection = try video(name: name) + let address = try await DroneDockFilmUploader(configService: FilmConfigStub(), transport: transport) + .upload(video: selection, scenicID: 128) { _ in } + let call = try XCTUnwrap(transport.calls.first) + let fileExtension = URL(fileURLWithPath: name).pathExtension.lowercased() + XCTAssertTrue(call.objectKey.hasSuffix("_film." + fileExtension)) + XCTAssertTrue(call.objectKey.unicodeScalars.allSatisfy { $0.isASCII }) + XCTAssertFalse(address.contains("%")) + XCTAssertFalse(address.contains(" ")) + XCTAssertFalse(address.contains("#")) + XCTAssertEqual(call.fileURL, selection.url) + XCTAssertEqual(call.contentType, try DroneDockFilmPolicy.contentType(fileName: name)) + XCTAssertEqual(URL(string: address)?.path, "/prefix/" + call.objectKey) + } + } + + /// 网络失败不会返回 URL 或完成进度,结束后的迟到进度也不能更新页面。 + func testTransportFailureAndLateProgressNeverReportSuccess() async throws { + let config = try FilmConfigStub() + let transport = FilmTransportStub() + transport.error = URLError(.networkConnectionLost) + let progress = FilmProgressRecorder() + let video = try video() + do { + _ = try await DroneDockFilmUploader(configService: config, transport: transport) + .upload(video: video, scenicID: 128) { progress.values.append($0) } + XCTFail("失败上传不能返回成功地址") + } catch {} + XCTAssertFalse(progress.values.contains(100)) + let previous = progress.values + transport.latestProgress?(100) + XCTAssertEqual(progress.values, previous) + } + + /// 进度乱序或越界时保持单调,真正完成后忽略迟到回调。 + func testProgressIsMonotonicAndClampedUntilPutSucceeds() async throws { + let transport = FilmTransportStub() + transport.progress = [-10, 50, 20, 150, 99] + let recorder = FilmProgressRecorder() + _ = try await DroneDockFilmUploader(configService: FilmConfigStub(), transport: transport) + .upload(video: video(), scenicID: 128) { recorder.values.append($0) } + XCTAssertEqual(recorder.values, [1, 10, 54, 99, 100]) + transport.latestProgress?(30) + XCTAssertEqual(recorder.values.last, 100) + } + + /// 每次尝试重新读取临时配置,配置失败不调用 OSS。 + func testConfigurationFailureDoesNotStartTransport() async throws { + let config = try FilmConfigStub() + config.error = APIError.serverCode(160001, "测试上传配置不可用") + let transport = FilmTransportStub() + let uploader = DroneDockFilmUploader(configService: config, transport: transport) + let video = try video() + for _ in 0..<2 { + do { _ = try await uploader.upload(video: video, scenicID: 128) { _ in }; XCTFail("配置失败应停止") } catch {} + } + XCTAssertEqual(config.requests, ["default", "default"]) + XCTAssertTrue(transport.calls.isEmpty) + } + + /// 缺失凭证、过期配置或带签名查询的 base_url 都不可开始上传。 + func testIncompleteOrSignedConfigurationIsRejected() async throws { + let invalids: [[String: Any]] = [ + ["base_url": "file:///tmp"], ["base_url": "https://example.invalid?signature=x"], + ["bucket": ""], ["endpoint": ""], ["region": ""], ["expire_seconds": 0], + ["credentials": ["access_key_id": "", "access_key_secret": "test-secret", "security_token": "test-token"]] + ] + for change in invalids { + let config = try FilmConfigStub(changes: change) + let transport = FilmTransportStub() + do { + _ = try await DroneDockFilmUploader(configService: config, transport: transport).upload(video: video(), scenicID: 128) { _ in } + XCTFail("无效配置不可上传") + } catch {} + XCTAssertTrue(transport.calls.isEmpty) + } + } + + /// 无任务范围、空文件、不支持格式及选择后丢失的文件均不获取 STS。 + func testInvalidVideoOrScenicDoesNotRequestSTS() async throws { + let config = try FilmConfigStub() + let transport = FilmTransportStub() + let uploader = DroneDockFilmUploader(configService: config, transport: transport) + let valid = try video() + let invalid = [try video(name: "empty.mp4", bytes: 0), try video(name: "unsupported.m4v"), + DroneDockDeliveryVideo(url: URL(string: "https://example.invalid/test.mp4")!, fileName: "test.mp4", fileSize: 10), + DroneDockDeliveryVideo(url: directory.appendingPathComponent("missing.mp4"), fileName: "missing.mp4", fileSize: 10), + DroneDockDeliveryVideo(url: valid.url, fileName: valid.fileName, fileSize: valid.fileSize + 1)] + for value in invalid { + do { _ = try await uploader.upload(video: value, scenicID: 128) { _ in }; XCTFail("文件无效不能上传") } catch {} + } + do { _ = try await uploader.upload(video: valid, scenicID: 0) { _ in }; XCTFail("景区无效不能上传") } catch {} + XCTAssertTrue(config.requests.isEmpty) + XCTAssertTrue(transport.calls.isEmpty) + } + + /// 获取配置期间文件变化会重新校验,不能发送已失效的选择。 + func testFileChangedWhileFetchingConfigurationIsRejectedBeforePut() async throws { + let config = try FilmConfigStub() + let video = try video() + config.onFetch = { try Data([0]).write(to: video.url) } + let transport = FilmTransportStub() + do { + _ = try await DroneDockFilmUploader(configService: config, transport: transport).upload(video: video, scenicID: 128) { _ in } + XCTFail("文件已变化应重选") + } catch let error as DroneDockFilmError { XCTAssertEqual(error, .fileChanged) } + XCTAssertEqual(config.requests, ["default"]) + XCTAssertTrue(transport.calls.isEmpty) + } + + /// 上传开始前取消不请求 STS,也不把取消转为成功状态。 + func testCancelledTaskDoesNotRequestSTS() async throws { + let config = try FilmConfigStub() + let transport = FilmTransportStub() + let uploader = DroneDockFilmUploader(configService: config, transport: transport) + let video = try video() + let request = Task { try await uploader.upload(video: video, scenicID: 128) { _ in } } + request.cancel() + do { _ = try await request.value; XCTFail("取消不能成功") } catch is CancellationError {} + XCTAssertTrue(config.requests.isEmpty) + XCTAssertTrue(transport.calls.isEmpty) + } + + /// 文档允许的视频扩展名映射到正确的 video/*,通用模块的 m4v 不进入成片接口。 + func testDocumentedVideoTypesAndSizeLimitAreEnforced() throws { + for (name, mime) in ["a.mp4": "video/mp4", "a.MOV": "video/quicktime", "a.avi": "video/x-msvideo", + "a.mkv": "video/x-matroska", "a.flv": "video/x-flv", "a.wmv": "video/x-ms-wmv", "a.webm": "video/webm"] { + XCTAssertEqual(try DroneDockFilmPolicy.contentType(fileName: name), mime) + } + XCTAssertThrowsError(try DroneDockFilmPolicy.contentType(fileName: "a.m4v")) + let large = try video(name: "large.mp4") + let handle = try FileHandle(forWritingTo: large.url) + defer { try? handle.close() } + try handle.truncate(atOffset: UInt64(DroneDockFilmPolicy.maximumFileSize + 1)) + let selection = DroneDockDeliveryVideo(url: large.url, fileName: "large.mp4", fileSize: DroneDockFilmPolicy.maximumFileSize + 1) + XCTAssertThrowsError(try DroneDockFilmPolicy.validate(video: selection)) { error in + XCTAssertEqual(error as? DroneDockFilmError, .fileTooLarge) + } + } + + private func video(name: String = "test.mp4", bytes: Int = 16) throws -> DroneDockDeliveryVideo { + if !FileManager.default.fileExists(atPath: directory.path) { + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let directory = directory + addTeardownBlock { try FileManager.default.removeItem(at: directory) } + } + let url = directory.appendingPathComponent(name) + try Data(repeating: 0, count: bytes).write(to: url) + return DroneDockDeliveryVideo(url: url, fileName: name, fileSize: bytes) + } +} + +/// 显式测试凭证,只记录调用范围并返回预设配置。 +@MainActor +private final class FilmConfigStub: OSSConfigServing { + var requests: [String] = [] + var error: Error? + var onFetch: (() throws -> Void)? + let configuration: AliyunOSSResponse + + init(changes: [String: Any] = [:]) throws { + var value: [String: Any] = ["base_url": "https://test-bucket.oss-cn-shanghai.aliyuncs.com/prefix", "endpoint": "https://oss-cn-shanghai.aliyuncs.com", + "region": "cn-shanghai", "bucket": "test-bucket", "expire_seconds": 3600, + "credentials": ["access_key_id": "test-key", "access_key_secret": "test-secret", "security_token": "test-security-token"]] + value.merge(changes) { _, new in new } + configuration = try JSONDecoder().decode(AliyunOSSResponse.self, from: JSONSerialization.data(withJSONObject: value)) + } + + func aliyunOSSBucket(bucket: String) async throws -> AliyunOSSResponse { + requests.append(bucket) + try onFetch?() + if let error { throw error } + return configuration + } +} + +/// 文件上传替身,用请求记录证明上传仍以文件地址传递而非 Data。 +@MainActor +private final class FilmTransportStub: DroneDockFilmTransporting { + /// 保存一次上传需要的配置与元信息。 + struct Call { + let fileURL: URL + let objectKey: String + let contentType: String + let configuration: AliyunOSSResponse + } + var calls: [Call] = [] + var error: Error? + var progress: [Int] = [0, 50, 100] + var latestProgress: (@MainActor @Sendable (Int) -> Void)? + + func put(fileURL: URL, objectKey: String, contentType: String, configuration: AliyunOSSResponse, + onProgress: @escaping @MainActor @Sendable (Int) -> Void) async throws { + calls.append(Call(fileURL: fileURL, objectKey: objectKey, contentType: contentType, configuration: configuration)) + latestProgress = onProgress + progress.forEach(onProgress) + if let error { throw error } + } +} + +/// 在主线程收集可发送上传回调的数值。 +@MainActor +private final class FilmProgressRecorder { + var values: [Int] = [] +} diff --git a/suixinkanTests/DroneDockFlightControlTests.swift b/suixinkanTests/DroneDockFlightControlTests.swift new file mode 100644 index 0000000..fb2c2c5 --- /dev/null +++ b/suixinkanTests/DroneDockFlightControlTests.swift @@ -0,0 +1,504 @@ +import XCTest +@testable import suixinkan + +/// 新设备状态合同的隔离回归,覆盖拍摄结果与物理返航分离、批次和受理确认保护。 +@MainActor +final class DroneDockFlightControlTests: XCTestCase { + /// 起飞准备仍在巢内,既不能当作未知,也不能冒充本批次已返航。 + func testStartingInsideShowsTravelAndKeepsExplicitReturnPermission() async throws { + let fixture = try FlightControlFixture(state: "starting") + await fixture.model.refresh() + XCTAssertEqual(fixture.model.flightControlState, .starting) + XCTAssertEqual(fixture.model.presentation.phase, .navigating) + XCTAssertEqual(fixture.model.presentation.title, "无人机正在赶来") + XCTAssertEqual(fixture.model.response?.flightControl?.isAirborne, false) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome), "合同允许起飞准备阶段取消本次出发") + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.isRecordingFinished) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + } + + /// 首点自动悬停保留待开拍和本地倒计时,原始 DJI paused 不等于用户紧急暂停。 + func testArrivalWaitShowsReadyCountdownAndIndependentSafetyActions() async throws { + let fixture = try FlightControlFixture() + var control = DroneDockShootingTaskTestData.flightControl(batch: 9001, + resumePhase: "arrived_pending_start", pauseReason: "arrival_wait") + control["dji_task_status"] = "paused" + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", phase: "arrived_pending_start", + changes: ["flight_control": control]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.flightControlState, .executing) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.model.presentation.title, "无人机已到达") + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 30) + XCTAssertTrue(fixture.model.canStartShooting) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertFalse(fixture.model.canSendCommand(.resume)) + XCTAssertTrue(fixture.service.commands.isEmpty) + XCTAssertEqual(fixture.service.startCount, 0) + } + + /// 待开拍时手动暂停后继续只恢复等待,倒计时沿用本批次期限,不自动开拍。 + func testManualPauseFromArrivalResumesReadyWithoutRestartingCountdownOrStartingShoot() async throws { + let clock = DroneDockCountdownTestClock() + let fixture = try FlightControlFixture(countdownNow: { clock.now() }) + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", phase: "arrived_pending_start") + await fixture.model.refresh() + clock.advance(by: .seconds(12)) + fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "paused", version: 2, + resumePhase: "arrived_pending_start")) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + clock.advance(by: .seconds(5)) + fixture.service.nextSnapshot = try FlightControlFixture.snapshot(state: "executing", version: 3, + phase: "arrived_pending_start") + await fixture.model.sendCommand(.resume) + XCTAssertEqual(fixture.service.commands, [.resume]) + XCTAssertEqual(fixture.service.startCount, 0) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.model.countdownRemainingSeconds, 13) + XCTAssertTrue(fixture.model.canStartShooting) + } + + /// 起飞遥测三态仅供展示;执行、暂停和返航的安全操作均以明确 can_* 为准。 + func testExplicitSafetyPermissionsAreIndependentOfAirborneTelemetry() async throws { + let states: [(String, Set)] = [ + ("executing", [.pause, .returnHome]), ("paused", [.resume, .returnHome]), ("returning", [.pause])] + for (state, allowed) in states { + for airborne: Bool? in [true, false, nil] { + let fixture = try FlightControlFixture() + let control = DroneDockShootingTaskTestData.flightControl(state: state, batch: 9001, + canPause: allowed.contains(.pause), canResume: allowed.contains(.resume), + canReturn: allowed.contains(.returnHome), resumePhase: "shooting", + droneInDock: "outside", isAirborne: airborne, pauseReason: state == "paused" ? "manual" : nil) + fixture.service.value = try FlightControlFixture.snapshot(state: state, changes: ["flight_control": control]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.response?.flightControl?.isAirborne, airborne) + XCTAssertNotEqual(fixture.model.flightControlState, .unknown) + for command in DroneDockSafetyCommand.allCases { + XCTAssertEqual(fixture.model.canSendCommand(command), allowed.contains(command), "\(state): \(command)") + } + XCTAssertFalse(fixture.model.canResummon) + XCTAssertTrue(fixture.service.commands.isEmpty) + } + } + } + + /// 有效遥测和已知飞行态都不能补造缺失或明确禁止的安全许可。 + func testMissingOrFalseSafetyPermissionsRemainDeniedWithValidTelemetry() async throws { + for permission: Any in [NSNull(), false] { + let fixture = try FlightControlFixture() + var control = DroneDockShootingTaskTestData.flightControl(batch: 9001) + for field in ["can_pause", "can_resume", "can_return_home"] { control[field] = permission } + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", changes: ["flight_control": control]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.response?.flightControl?.isAirborne, true) + XCTAssertTrue(fixture.model.availableSafetyCommands.isEmpty) + for command in DroneDockSafetyCommand.allCases { XCTAssertFalse(fixture.model.canSendCommand(command)) } + } + } + + /// 业务失败或素材完成不代表飞机已落地,安全动作独立服从本批次飞控许可。 + func testBusinessFailureAndCompletionDoNotBlockAuthorizedSafetyActions() async throws { + for (status, phase, wayline) in [(40, "failed_restartable", 91), (30, "completed", 50), + (25, "post_shoot_uploading", 30), (40, "post_shoot_upload_failed", 39)] { + let fixture = try FlightControlFixture() + let task: [String: Any] = ["id": 501, "status": status, "wayline_status": wayline] + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", phase: phase, + changes: ["task": task, "order_flight_task": task]) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canSendCommand(.pause), phase) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome), phase) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canResummon) + } + } + + /// 同批次读数缺失时保留最近指标并标记过期,新批次清空旧读数和旧控制态。 + func testRetainedStaleMetricsStayWithinCurrentExecutionBatch() async throws { + let fixture = try FlightControlFixture() + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", changes: [ + "metrics": [["key": "battery", "value": "76%"], ["key": "wind_speed", "value": "2m/s"]], + "metrics_stale": false]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.telemetry.batteryText, "76%") + XCTAssertFalse(fixture.model.isTelemetryStale) + fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "paused", version: 2, + changes: ["metrics": [], "metrics_stale": true])) + XCTAssertEqual(fixture.model.telemetry.batteryText, "76%") + XCTAssertEqual(fixture.model.telemetry.windText, "2m/s") + XCTAssertTrue(fixture.model.isTelemetryStale) + XCTAssertTrue(fixture.model.canSendCommand(.resume), "指标过期不覆盖独立飞控许可") + fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "starting", batch: 9002, + changes: ["metrics": [], "metrics_stale": true])) + XCTAssertEqual(fixture.model.telemetry.batteryText, "—") + XCTAssertEqual(fixture.model.telemetry.windText, "—") + XCTAssertEqual(fixture.model.presentation.phase, .navigating) + XCTAssertFalse(fixture.model.canSendCommand(.resume)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "paused", version: 99)), .outdated) + XCTAssertEqual(fixture.model.response?.executionBatch, 9002) + XCTAssertEqual(fixture.model.telemetry.batteryText, "—") + } + + func testPausedUsesLocalCopyAndResumePermissionInsteadOfStartGateOrCommandLabels() async throws { + let fixture = try FlightControlFixture(state: "paused") + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertEqual(fixture.model.presentation.title, "无人机已暂停") + XCTAssertEqual(fixture.model.presentation.actionTitle, "继续任务") + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + fixture.service.nextSnapshot = try FlightControlFixture.snapshot(state: "executing", version: 2) + await fixture.model.sendCommand(.resume) + XCTAssertEqual(fixture.service.commands, [.resume]) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertNil(fixture.model.pendingCommand) + } + + func testMissingUnknownMismatchedAndContradictoryControlCannotEnableAnyDeviceAction() async throws { + let controls: [Any] = [NSNull(), [:], ["state": "future", "execution_batch": 9001], + ["state": "executing", "execution_batch": 9002, "can_pause": true], + ["state": "paused", "execution_batch": 9001, "resume_phase": "shooting", "drone_in_dock": "inside", "can_resume": true], + ["state": "returned", "execution_batch": 9001, "drone_in_dock": "outside"], + ["state": "returned", "execution_batch": 9001]] + for control in controls { + let fixture = try FlightControlFixture() + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", phase: "arrived_pending_start", + changes: ["flight_control": control, "execute_gate": ["can_execute": true, "primary_action": "start_shoot"], + "restart_gate": ["can_restart": true]]) + await fixture.model.refresh() + for command in DroneDockSafetyCommand.allCases { XCTAssertFalse(fixture.model.canSendCommand(command)) } + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canResummon) + } + } + + func testManualReturnKeepsFailureResultAndRequiresInsideAndRestartGate() async throws { + let fixture = try FlightControlFixture(state: "returning", reason: "manual") + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .returning) + XCTAssertEqual(fixture.model.presentation.title, "无人机正在返航") + XCTAssertEqual(fixture.model.presentation.actionTitle, "拍摄已中断") + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.returnHome)) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + for gate in [false, true] { + fixture.service.value = try FlightControlFixture.snapshot(state: "returned", reason: "manual", version: gate ? 3 : 2, + changes: ["restart_gate": ["can_restart": gate]]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .returned) + XCTAssertEqual(fixture.model.response?.task?.status, 40) + XCTAssertEqual(fixture.model.canResummon, gate) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertTrue(fixture.model.availableSafetyCommands.isEmpty) + } + } + + /// 手动返航可伴随航线下载态,仍是中断;回巢、机巢空闲和重召许可缺一不可。 + func testManualReturnWithDownloadingWaylineWaitsForReturnedIdleAndRestartGate() async throws { + let fixture = try FlightControlFixture(state: "returning", reason: "manual") + let task: [String: Any] = ["id": 501, "status": 40, "wayline_status": 24, + "result_code": "return_home", "result_message": "立即返航中断任务"] + let stages: [(state: String, workStatus: Int, gate: Bool, code: String, mayRestart: Bool)] = [ + ("returning", 2, false, "await_returned", false), + ("returned", 2, false, "await_dock_idle", false), + ("returned", 1, false, "low_battery", false), + ("returned", 2, true, "ok", false), + ("returned", 1, true, "ok", true) + ] + for (index, stage) in stages.enumerated() { + fixture.service.value = try FlightControlFixture.snapshot(state: stage.state, reason: "manual", version: index + 1, + phase: stage.state == "returned" ? "failed_restartable" : "returning_home", changes: [ + "task": task, "order_flight_task": task, "shoot_complete_returning": false, + "current_plane": ["id": 58, "sn_number": "LOCAL-FLIGHT-058", "work_status": stage.workStatus, "online_status": 1], + "restart_gate": ["can_restart": stage.gate, "code": stage.code] + ]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, stage.state == "returned" ? .returned : .returning) + XCTAssertEqual(fixture.model.response?.orderFlightTask?.status, 40) + XCTAssertEqual(fixture.model.response?.task?.waylineStatus, 24) + XCTAssertEqual(fixture.model.response?.orderFlightTask?.resultCode, "return_home") + XCTAssertFalse(fixture.model.isRecordingFinished) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertEqual(fixture.model.shouldStopLiveReception, stage.state == "returned") + XCTAssertEqual(fixture.model.canResummon, stage.mayRestart, stage.code) + } + XCTAssertEqual(fixture.model.presentation.action, .retry) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertTrue(fixture.service.commands.isEmpty) + XCTAssertEqual(fixture.service.startCount, 0) + } + + func testIdleAndFailureCannotProveReturnEvenIfBackendRestartGateIsTrue() async throws { + for state in ["returning", "unknown"] { + let fixture = try FlightControlFixture(state: state, reason: "manual") + fixture.service.value = try FlightControlFixture.snapshot(state: state, reason: "manual", + changes: ["restart_gate": ["can_restart": true]]) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canResummon) + XCTAssertNotEqual(fixture.model.presentation.phase, .returned) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + } + } + + func testPausedReturnResumesReturningAndNeverStartsShooting() async throws { + let fixture = try FlightControlFixture(state: "paused", reason: "manual") + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertTrue(fixture.model.presentation.message.contains("恢复返航")) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + XCTAssertFalse(fixture.model.canSendCommand(.returnHome)) + fixture.service.nextSnapshot = try FlightControlFixture.snapshot(state: "returning", reason: "manual", version: 2) + await fixture.model.sendCommand(.resume) + XCTAssertEqual(fixture.service.commands, [.resume]) + XCTAssertEqual(fixture.service.startCount, 0) + XCTAssertEqual(fixture.model.presentation.phase, .returning) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + } + + func testNormalRecordingCompletionStaysDistinctFromInterruptedReturnIncludingPausedReturn() async throws { + for state in ["returning", "returned", "unknown", "paused"] { + let fixture = try FlightControlFixture(state: state, reason: "normal_complete") + await fixture.model.refresh() + XCTAssertEqual(fixture.model.response?.task?.status, 25) + XCTAssertTrue(fixture.model.isRecordingFinished) + XCTAssertEqual(fixture.model.presentation.phase, state == "paused" ? .paused : .postShootUploading) + XCTAssertFalse(fixture.model.canResummon) + if state == "paused" { XCTAssertTrue(fixture.model.canSendCommand(.resume)) } + } + } + + /// 未知业务枚举不能开放开拍,也不能抹掉独立且可信的安全控制权限。 + func testUnknownBusinessStatusKeepsAuthorizedSafetyActionsWithoutEnablingStart() async throws { + let fixture = try FlightControlFixture() + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", phase: "arrived_pending_start", changes: [ + "task": ["id": 501, "status": 99], "order_flight_task": ["id": 501, "status": 99]]) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertFalse(fixture.model.canSendCommand(.resume)) + XCTAssertFalse(fixture.model.canSendCommand(.cancelReturn)) + XCTAssertFalse(fixture.model.canStartShooting) + } + + /// 身份和版本是所有控制的前提,已知业务状态额外约束开拍而非安全指令。 + func testStartRequiresResponseIdentityAndVersionWithKnownTaskState() async throws { + let cases: [(changes: [String: Any], canReturn: Bool)] = [ + (["order_flight_task_id": NSNull(), "task": ["status": 20], "order_flight_task": ["status": 20]], false), + (["state_version": NSNull()], false), + (["task": ["id": 501, "status": 99], "order_flight_task": ["id": 501, "status": 99]], true) + ] + for (changes, canReturn) in cases { + let fixture = try FlightControlFixture() + let gates: [String: Any] = ["execute_gate": ["can_execute": true, "primary_action": "start_shoot"]] + fixture.service.value = try FlightControlFixture.snapshot(state: "executing", phase: "arrived_pending_start", + changes: gates.merging(changes) { _, new in new }) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.canSendCommand(.returnHome), canReturn) + } + } + + func testAcceptedReceiptWaitsForNewMatchingFullSnapshot() async throws { + let fixture = try FlightControlFixture() + await fixture.model.refresh() + fixture.service.receiptChanges = ["device_confirmed": false, "state_version": 3] + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertEqual(fixture.model.presentation.title, "无人机正在拍摄中") + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "paused", version: 1)), .outdated) + XCTAssertNotNil(fixture.model.pendingCommand) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "paused", version: 2)), .outdated) + XCTAssertNotNil(fixture.model.pendingCommand, "不能早于指令回执对应版本") + fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "unknown", version: 3)) + XCTAssertNotNil(fixture.model.pendingCommand, "新版本本身不是执行确认") + fixture.model.applyTaskSnapshot(try FlightControlFixture.snapshot(state: "paused", version: 4)) + XCTAssertNil(fixture.model.pendingCommand) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertTrue(fixture.model.canSendCommand(.resume)) + } + + func testFullSnapshotArrivingBeforeReceiptCanConfirmSameOperation() async throws { + let fixture = try FlightControlFixture() + await fixture.model.refresh() + fixture.service.onCommand = { + fixture.model.applyTaskSnapshot(try! FlightControlFixture.snapshot(state: "paused", version: 2)) + } + fixture.service.receiptChanges = ["state_version": 2] + await fixture.model.sendCommand(.pause) + XCTAssertNil(fixture.model.pendingCommand) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + } + + func testWrongReceiptIdentityOrMissingAcceptanceKeepsUnknownOutcomeLock() async throws { + for changes: [String: Any] in [ + ["execution_batch": 9002], ["plane_id": 99], ["airport_sn": "OTHER"], ["accepted": NSNull()], + ["flight_control": ["execution_batch": 9002]] + ] { + let fixture = try FlightControlFixture() + await fixture.model.refresh() + fixture.service.receiptChanges = changes + await fixture.model.sendCommand(.pause) + XCTAssertTrue(fixture.model.commandOutcomeUnknown) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertNil(fixture.model.commandResponse) + } + } + + func testExplicitRejectedReceiptAllowsUserRetryWithoutPretendingAccepted() async throws { + let fixture = try FlightControlFixture() + await fixture.model.refresh() + fixture.service.receiptChanges = ["accepted": false] + await fixture.model.sendCommand(.pause) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertNil(fixture.model.pendingCommand) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + } + + func testNewBatchDiscardsPendingCommandAndLateOldReceipt() async throws { + let fixture = try FlightControlFixture() + await fixture.model.refresh() + fixture.service.onCommand = { + fixture.model.applyTaskSnapshot(try! FlightControlFixture.snapshot(state: "executing", batch: 9002)) + } + await fixture.model.sendCommand(.pause) + XCTAssertNil(fixture.model.pendingCommand) + XCTAssertNil(fixture.model.commandResponse) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertEqual(fixture.model.response?.executionBatch, 9002) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + } + + func testNewBatchIgnoresLateFailureOfOldCommand() async throws { + let fixture = try FlightControlFixture() + await fixture.model.refresh() + fixture.service.commandError = APIError.networkFailed("旧批次指令网络失败") + fixture.service.onCommand = { + fixture.model.applyTaskSnapshot(try! FlightControlFixture.snapshot(state: "executing", batch: 9002)) + } + await fixture.model.sendCommand(.pause) + XCTAssertNil(fixture.model.pendingCommand) + XCTAssertFalse(fixture.model.commandOutcomeUnknown) + XCTAssertEqual(fixture.model.response?.executionBatch, 9002) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + } + + func testConflictingReturnResultCannotDeclareCompletionOrEnableResummon() async throws { + let fixture = try FlightControlFixture() + let task: [String: Any] = ["id": 501, "status": 40, "result_code": "return_home"] + fixture.service.value = try FlightControlFixture.snapshot(state: "returned", reason: "normal_complete", + changes: ["task": task, "order_flight_task": task]) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .unknown) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertFalse(fixture.model.isRecordingFinished) + } + + func testAbnormalReturnNeverUsesStaleCompletionPhaseToStopLive() async throws { + let fixture = try FlightControlFixture(state: "returning", reason: "abnormal") + fixture.service.value = try FlightControlFixture.snapshot(state: "returning", reason: "abnormal", phase: "post_shoot_uploading") + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .returning) + XCTAssertFalse(fixture.model.isRecordingFinished) + XCTAssertFalse(fixture.model.shouldStopLiveReception) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + } +} + +/// 每份匿名快照明确区分设备飞行态与拍摄结果,所有操作只在内存记录。 +@MainActor +private struct FlightControlFixture { + let service: FlightControlService + let model: DroneDockShootingTaskViewModel + + init(state: String = "executing", reason: String? = nil, + countdownNow: @escaping @Sendable () -> ContinuousClock.Instant = { ContinuousClock.now }) throws { + service = FlightControlService(value: try Self.snapshot(state: state, reason: reason)) + let context = DroneDockShootingTaskTestData.context() + model = DroneDockShootingTaskViewModel(context: context, taskID: 501, order: try DroneDockShootingTaskTestData.order(), + service: service, startService: service, commandService: service, resummonService: service, + countdownNow: countdownNow, currentContext: { context }) + } + + static func snapshot(state: String, reason: String? = nil, version: Int = 1, batch: Int = 9001, + phase: String? = nil, resumePhase: String? = nil, + changes: [String: Any] = [:]) throws -> DroneDockShootingResponse { + let interrupted = reason == "manual" || reason == "abnormal" + let normal = reason == "normal_complete" + let status = interrupted ? 40 : normal ? 25 : 20 + let businessPhase = phase ?? (state == "starting" ? "going_to_spot" : state == "paused" ? "manual_paused" + : normal ? "post_shoot_uploading" : interrupted ? "returning_home" : "shooting") + let resume = resumePhase ?? (reason != nil ? "returning" : businessPhase == "arrived_pending_start" ? "arrived_pending_start" + : state == "starting" ? "going_to_spot" : "shooting") + let control = DroneDockShootingTaskTestData.flightControl(state: state, batch: batch, + canPause: state == "executing" || state == "returning", canResume: state == "paused", + canReturn: state == "starting" || state == "executing" || (state == "paused" && resume != "returning"), + resumePhase: resume, returnReason: reason, + droneInDock: state == "unknown" ? nil : state == "returned" || state == "starting" ? "inside" : "outside", + isAirborne: state == "unknown" ? nil : state != "returned" && state != "starting", + pauseReason: state == "paused" ? "manual" : businessPhase == "arrived_pending_start" ? "arrival_wait" : nil) + let task: [String: Any] = ["id": 501, "status": status, "wayline_status": normal ? 24 : interrupted ? 91 : 20, + "result_code": interrupted ? "return_home" : ""] + let value: [String: Any] = [ + "order_flight_task_id": 501, "execution_batch": batch, "state_version": version, "snapshot_kind": "full", + "task": task, "order_flight_task": task, + "current_plane": ["id": 58, "sn_number": "LOCAL-FLIGHT-058", "work_status": 1, "online_status": 1], + "restart_gate": ["can_restart": true], + "execute_gate": ["can_execute": businessPhase == "arrived_pending_start", + "primary_action": businessPhase == "arrived_pending_start" ? "start_shoot" : "blocked"], + "ui": ["phase": businessPhase, + "title": "错误接口标题", "message": "错误接口提示", "commands": [["command": "return_home_cancel"]]], + "flight_control": control] + return try DroneDockShootingTaskTestData.decode(value.merging(changes) { _, new in new }) + } +} + +/// 不访问网络的同任务读取、控制和重召唤替身。 +@MainActor +private final class FlightControlService: DroneDockShootingServing, DroneDockCommandSending, DroneDockStartShooting, DroneDockResummonServing { + var value: DroneDockShootingResponse + var nextSnapshot: DroneDockShootingResponse? + var receiptChanges: [String: Any] = [:] + var onCommand: (() -> Void)? + var commandError: Error? + var commands: [DroneDockSafetyCommand] = [] + var startCount = 0 + + init(value: DroneDockShootingResponse) { self.value = value } + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { value } + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + commands.append(command) + let batch = value.executionBatch ?? 9001 + onCommand?() + if let commandError { throw commandError } + if let nextSnapshot { value = nextSnapshot } + let receipt: [String: Any] = ["order_flight_task_id": taskID, "command": command.rawValue, + "execution_batch": batch, "accepted": true, "device_confirmed": false, + "command_id": "local-flight-\(clientRequestID)", "client_request_id": clientRequestID, + "plane_id": 58, "airport_sn": "LOCAL-FLIGHT-058"] + return try JSONDecoder().decode(DroneDockCommandResponse.self, + from: JSONSerialization.data(withJSONObject: receipt.merging(receiptChanges) { _, new in new })) + } + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + startCount += 1 + throw APIError.networkFailed("本地测试不应触发开拍") + } + func resummon(taskID: Int) async throws -> DroneDockShootResponse { throw APIError.networkFailed("本地测试不触发重召唤") } +} diff --git a/suixinkanTests/DroneDockHTTPSeedTests.swift b/suixinkanTests/DroneDockHTTPSeedTests.swift new file mode 100644 index 0000000..c9531de --- /dev/null +++ b/suixinkanTests/DroneDockHTTPSeedTests.swift @@ -0,0 +1,280 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用内存 Socket、虚拟时钟和只读服务,验证无缓存订阅的 HTTP 首包证明。 +@MainActor +final class DroneDockHTTPSeedTests: XCTestCase { + /// 新 HTTP 的采纳与去重都可完成首包;重复元数据不重复请求或重置期限。 + func testAppliedAndDuplicateSeedsCompleteHandshakeOnce() async throws { + for acceptance in [DroneDockSnapshotAcceptance.applied, .duplicate] { + let harness = RealtimeHarness() + var requests = 0 + harness.session.onHTTPSeedRequired = { requests += 1 } + defer { harness.session.stop() } + let (socket, requestID) = try await beginSeed(harness) + let received = socket.receiveCount + socket.emit(try metadata(hasSnapshot: false)) + socket.emit(try metadata(hasSnapshot: false)) + await settle { socket.receiveCount >= received + 2 } + XCTAssertEqual(requests, 1) + XCTAssertEqual(harness.session.pendingHTTPSeedRequest, requestID) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + harness.session.acceptHTTPSeed(.init(snapshot: try RealtimeTestData.snapshot(), acceptance: acceptance), requestID: requestID) + XCTAssertEqual(harness.session.state, .live) + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + await settle { !harness.clock.has(12) } + socket.emit(try metadata(hasSnapshot: false)) + await settle { socket.receiveCount >= received + 3 } + XCTAssertEqual(requests, 1) + XCTAssertEqual(harness.session.state, .live) + } + } + + /// 元数据不能建立订阅,正式 ack 的 null 也不能自行生成 HTTP 首包许可。 + func testMetadataBeforeAckAndAckAloneCannotAcceptHTTPSeed() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + harness.session.start() + await settle { harness.sockets.first?.sent.count == 1 } + let socket = try XCTUnwrap(harness.sockets.first) + let received = socket.receiveCount + socket.emit(try metadata(hasSnapshot: false)) + socket.emit(try RealtimeTestData.ack()) + await settle { socket.receiveCount >= received + 2 } + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + harness.session.acceptHTTPSeed(.init(snapshot: try RealtimeTestData.snapshot(), acceptance: .applied), requestID: UUID()) + XCTAssertEqual(harness.session.state, .connecting) + XCTAssertTrue(harness.clock.has(12)) + } + + /// 不完整、错误任务、低于元数据批次及业务层拒绝的结果都不能结束原首包期限。 + func testIncompleteOldBatchAndRejectedSeedsKeepOriginalDeadline() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (_, requestID) = try await beginSeed(harness, batch: 101) + let valid = try RealtimeTestData.snapshot(batch: 101) + var notFull = RealtimeTestData.payload(batch: 101) + notFull.removeValue(forKey: "snapshot_kind") + var wrongTask = RealtimeTestData.payload(batch: 101) + wrongTask["order_flight_task_id"] = 502 + var unversioned = RealtimeTestData.payload(batch: 101) + unversioned.removeValue(forKey: "state_version") + let results: [DroneDockHTTPSnapshotResult] = [ + .init(snapshot: try DroneDockShootingTaskTestData.decode(notFull), acceptance: .duplicate), + .init(snapshot: try DroneDockShootingTaskTestData.decode(wrongTask), acceptance: .applied), + .init(snapshot: try DroneDockShootingTaskTestData.decode(unversioned), acceptance: .applied), + .init(snapshot: try RealtimeTestData.snapshot(batch: 100), acceptance: .duplicate), + .init(snapshot: valid, acceptance: .outdated), + .init(snapshot: valid, acceptance: .invalid) + ] + for result in results { + harness.session.acceptHTTPSeed(result, requestID: requestID) + XCTAssertNotEqual(harness.session.state, .live) + XCTAssertEqual(harness.session.pendingHTTPSeedRequest, requestID) + } + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + harness.clock.fire(seconds: 12) + await settle { harness.clock.has(1) } + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + XCTAssertNotEqual(harness.session.state, .live) + } + + /// 后续明确有缓存时旧 HTTP 证明失效;须等有效 WS 全量,不能被旧 HTTP 抢先确认。 + func testMetadataTrueRevokesPendingSeed() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (socket, requestID) = try await beginSeed(harness) + socket.emit(try metadata(hasSnapshot: true)) + await settle { harness.session.pendingHTTPSeedRequest == nil } + harness.session.acceptHTTPSeed(.init(snapshot: try RealtimeTestData.snapshot(), acceptance: .applied), requestID: requestID) + XCTAssertNotEqual(harness.session.state, .live) + XCTAssertTrue(harness.clock.has(12)) + harness.session.onSnapshot = { _ in .applied } + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live } + } + + /// 换票重连保留 HTTP 兜底,但上一条连接的迟到结果不能完成新连接首包。 + func testTokenExpiryReticketsAndRejectsPreviousConnectionSeed() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (firstSocket, firstID) = try await beginSeed(harness) + firstSocket.emit(try RealtimeTestData.subscriptionFailure(100098, "本地模拟:票据过期")) + await settle { harness.clock.has(1) } + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 && harness.sockets[1].sent.count == 1 } + XCTAssertEqual(harness.tickets.count, 2) + let secondSocket = harness.sockets[1] + secondSocket.emit(try RealtimeTestData.ack()) + secondSocket.emit(try metadata(hasSnapshot: false)) + await settle { harness.session.pendingHTTPSeedRequest != nil } + let secondID = try XCTUnwrap(harness.session.pendingHTTPSeedRequest) + XCTAssertNotEqual(firstID, secondID) + let result = DroneDockHTTPSnapshotResult(snapshot: try RealtimeTestData.snapshot(), acceptance: .duplicate) + harness.session.acceptHTTPSeed(result, requestID: firstID) + XCTAssertNotEqual(harness.session.state, .live) + XCTAssertEqual(harness.session.pendingHTTPSeedRequest, secondID) + harness.session.acceptHTTPSeed(result, requestID: secondID) + XCTAssertEqual(harness.session.state, .live) + } + + /// 页面离开或进后台使用同一 stop 入口;回来不能复用旧连接的 HTTP 首包标识。 + func testStopAndReentryInvalidatePendingSeed() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (_, previousID) = try await beginSeed(harness) + let result = DroneDockHTTPSnapshotResult(snapshot: try RealtimeTestData.snapshot(), acceptance: .applied) + harness.session.stop() + harness.session.acceptHTTPSeed(result, requestID: previousID) + XCTAssertEqual(harness.session.state, .stopped) + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + harness.session.start() + await settle { harness.sockets.count == 2 && harness.sockets[1].sent.count == 1 } + harness.sockets[1].emit(try RealtimeTestData.ack()) + harness.sockets[1].emit(try metadata(hasSnapshot: false)) + await settle { harness.session.pendingHTTPSeedRequest != nil } + XCTAssertNotEqual(harness.session.pendingHTTPSeedRequest, previousID) + harness.session.acceptHTTPSeed(result, requestID: previousID) + XCTAssertNotEqual(harness.session.state, .live) + } + + /// 明确无权限后保留终止状态,不能因迟到 HTTP 或 start 再次订阅。 + func testPermissionDenialRevokesSeedAndPreventsRestart() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (socket, requestID) = try await beginSeed(harness) + socket.emit(try RealtimeTestData.subscriptionFailure(100099, "permission denied")) + await settle { harness.session.state == .denied("permission denied") } + harness.session.acceptHTTPSeed(.init(snapshot: try RealtimeTestData.snapshot(), acceptance: .applied), requestID: requestID) + harness.session.start() + XCTAssertEqual(harness.session.state, .denied("permission denied")) + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + XCTAssertEqual(harness.tickets.count, 1) + await settle { !harness.clock.has(12) && !harness.clock.has(1) } + } + + /// 过期读数仍是有效首包,不再订阅超时重连;沿用数据健康规则继续 HTTP 核对。 + func testStaleSeedCompletesDeadlineButKeepsHTTPFallback() async throws { + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (_, requestID) = try await beginSeed(harness) + var payload = RealtimeTestData.payload() + payload["metrics_stale"] = true + harness.session.acceptHTTPSeed(.init(snapshot: try DroneDockShootingTaskTestData.decode(payload), acceptance: .applied), requestID: requestID) + XCTAssertEqual(harness.session.state, .fallback("设备读数缓存已过期,正在通过接口核对")) + XCTAssertNil(harness.session.pendingHTTPSeedRequest) + await settle { !harness.clock.has(12) } + XCTAssertFalse(harness.clock.has(1)) + XCTAssertEqual(harness.tickets.count, 1) + } + + /// 失败或旧版实际读取不能借页面保留的数据认证;同版本必须保留本次原始完整性字段。 + func testViewModelReturnsOnlyActualSuccessfulAcceptedHTTPResult() async throws { + let service = DroneDockShootingTaskTestService(result: .success(try RealtimeTestData.snapshot(version: 3))) + let model = try makeModel(service: service) + let first = await model.refreshForRealtimeSeed() + XCTAssertEqual(first?.acceptance, .applied) + service.result = .failure(APIError.networkFailed("本地模拟读取失败")) + let failed = await model.refreshForRealtimeSeed() + XCTAssertNil(failed) + XCTAssertEqual(model.response?.stateVersion, 3) + service.result = .success(try RealtimeTestData.snapshot(version: 2)) + let old = await model.refreshForRealtimeSeed() + XCTAssertNil(old) + XCTAssertEqual(model.response?.stateVersion, 3) + + var incomplete = RealtimeTestData.payload(version: 3) + incomplete.removeValue(forKey: "snapshot_kind") + service.result = .success(try DroneDockShootingTaskTestData.decode(incomplete)) + let duplicateResult = await model.refreshForRealtimeSeed() + let duplicate = try XCTUnwrap(duplicateResult) + XCTAssertEqual(duplicate.acceptance, .duplicate) + XCTAssertNil(duplicate.snapshot.snapshotKind, "证明保留本次 HTTP 原始字段,不能借用旧完整快照") + XCTAssertEqual(model.response?.snapshotKind, "full", "业务去重仍保留页面原快照") + let harness = RealtimeHarness() + defer { harness.session.stop() } + let (_, requestID) = try await beginSeed(harness) + harness.session.acceptHTTPSeed(duplicate, requestID: requestID) + XCTAssertNotEqual(harness.session.state, .live) + XCTAssertTrue(service.requests.allSatisfy { $0.taskID == 501 && !$0.liveBattery }) + } + + /// 不发送请求的身份/加载门禁返回 nil;并发调用不能拿另一条在途请求的结果冒充本次读取。 + func testViewModelSkippedAndInvalidatedReadsCannotProduceSeedProof() async throws { + let immediate = DroneDockShootingTaskTestService(result: .success(try RealtimeTestData.snapshot())) + let invalid = try makeModel(service: immediate, taskID: 0) + let skipped = await invalid.refreshForRealtimeSeed() + XCTAssertNil(skipped) + XCTAssertTrue(immediate.requests.isEmpty) + + let service = HTTPSeedSuspendedRead() + let model = try makeModel(service: service) + defer { service.cancel() } + let first = Task { await model.refreshForRealtimeSeed() } + await settle { service.pending != nil } + let overlapping = await model.refreshForRealtimeSeed() + XCTAssertNil(overlapping) + XCTAssertEqual(service.requestCount, 1) + model.invalidate(preservingSnapshot: true) + service.resolve(try RealtimeTestData.snapshot()) + let invalidated = await first.value + XCTAssertNil(invalidated) + XCTAssertNil(model.response) + } + + private func beginSeed(_ harness: RealtimeHarness, batch: Int = 100) async throws -> (RealtimeTestSocket, UUID) { + harness.session.start() + await settle { harness.sockets.first?.sent.count == 1 } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.ack()) + socket.emit(try metadata(hasSnapshot: false, batch: batch)) + await settle { harness.session.pendingHTTPSeedRequest != nil && harness.clock.has(12) } + return (socket, try XCTUnwrap(harness.session.pendingHTTPSeedRequest)) + } + + private func metadata(hasSnapshot: Bool, batch: Int = 100) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "data": [ + "type": 310, "ack": "subscribe_meta", "subscribed": true, + "order_flight_task_id": 501, "has_snapshot": hasSnapshot, + "execution_batch": batch, "state_version": 0 + ]]) + } + + private func makeModel(service: any DroneDockShootingServing, taskID: Int = 501) throws -> DroneDockShootingTaskViewModel { + let context = DroneDockShootingTaskTestData.context() + return try DroneDockShootingTaskViewModel(context: context, taskID: taskID, + order: DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + } + + private func settle(_ condition: () -> Bool, file: StaticString = #filePath, line: UInt = #line) async { + for _ in 0..<300 { + if condition() { return } + try? await Task.sleep(nanoseconds: 1_000_000) + } + XCTAssertTrue(condition(), file: file, line: line) + } +} + +/// 可挂起的纯内存只读请求,不创建 URLSession,不提供任何设备操作能力。 +@MainActor +private final class HTTPSeedSuspendedRead: DroneDockShootingServing { + private(set) var pending: CheckedContinuation? + private(set) var requestCount = 0 + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + requestCount += 1 + return try await withCheckedThrowingContinuation { pending = $0 } + } + + func resolve(_ snapshot: DroneDockShootingResponse) { + pending?.resume(returning: snapshot) + pending = nil + } + + func cancel() { + pending?.resume(throwing: CancellationError()) + pending = nil + } +} diff --git a/suixinkanTests/DroneDockHomeAPITests.swift b/suixinkanTests/DroneDockHomeAPITests.swift new file mode 100644 index 0000000..e9bbf7c --- /dev/null +++ b/suixinkanTests/DroneDockHomeAPITests.swift @@ -0,0 +1,205 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证首页三接口的参数、身份和独立响应结构,不请求真实账号或控制设备。 +@MainActor +final class DroneDockHomeAPITests: XCTestCase { + /// 朱工 home 仅传景区,不再携带 store_id,也不依赖旧订单及统计字段。 + func testHomeUsesDeviceOnlyRequestAndResponse() async throws { + let session = MockURLSession(responses: [envelope(#"{"scenic_id":128,"airports":[]}"#)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "home-contract-test-token" } + + let response = try await DroneDockAPI(client: client).home(scenicID: 128, storeID: 37) + + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.host, "api-test.zhifly.cn") + XCTAssertEqual(request.url?.path, "/api/app/airport/home") + XCTAssertEqual(try query(request), ["scenic_id": "128"]) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "home-contract-test-token") + XCTAssertNil(request.httpBody) + XCTAssertEqual(response.scenicID, 128) + XCTAssertTrue(response.airports.isEmpty) + } + + /// 即使旧版本继续返回错误类型的 orders/today,也不影响设备区域。 + func testHomeIgnoresObsoleteOrderAndStatisticPayloads() throws { + let payload = #"{"scenic_id":"128","airports":[{"id":58,"name":"测试机巢","metrics":[]}],"orders":"obsolete","today":{"order_amount":"not-a-number"}}"# + let response = try JSONDecoder().decode(DroneDockHomeResponse.self, from: Data(payload.utf8)) + XCTAssertEqual(response.scenicID, 128) + XCTAssertEqual(response.airports.map(\.id), [58]) + } + + /// 缺失、null 或类型错误的设备数组不能伪装成真实空列表。 + func testMalformedRequiredDeviceListsAreRejected() { + for payload in [#"{"scenic_id":128}"#, #"{"scenic_id":128,"airports":null}"#, + #"{"scenic_id":128,"airports":{}}"#, #"{"scenic_id":128,"airports":[12]}"#] { + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockHomeResponse.self, from: Data(payload.utf8))) + } + } + + /// 订单请求使用张工前缀、当前身份和分页条件,数据不来自 home。 + func testOrdersUsesMultiPlaneRouteAndPagination() async throws { + let session = MockURLSession(responses: [envelope(#"{"list":[{"order_number":"001-TEST","project_id":101,"project_name":"测试套餐","can_create_task":true}],"total":35,"page":2,"page_size":20}"#)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "orders-contract-test-token" } + + let response = try await DroneDockAPI(client: client).orders(scenicID: 128, page: 2, pageSize: 20) + + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/orders") + XCTAssertEqual(try query(request), ["scenic_id": "128", "status": "all", "page": "2", "page_size": "20"]) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "orders-contract-test-token") + XCTAssertNil(request.httpBody) + XCTAssertEqual(response.total, 35) + XCTAssertEqual(response.page, 2) + XCTAssertEqual(response.pageSize, 20) + XCTAssertEqual(response.list.first?.orderID, "001-TEST") + XCTAssertEqual(response.list.first?.projectID, 101) + } + + /// 四种订单分类交给后端筛选,进行中使用 processing,不能发送本地 inProgress。 + func testOrdersSendsEachDocumentedStatus() async throws { + let filters: [(DroneShootingOrderFilter, String)] = [(.all, "all"), (.pending, "pending"), + (.inProgress, "processing"), (.completed, "completed")] + let session = MockURLSession(responses: filters.map { _ in envelope(#"{"list":[],"total":0,"page":1,"page_size":20}"#) }) + let api = DroneDockAPI(client: APIClient(environment: .testing, session: session)) + for (filter, expected) in filters { + _ = try await api.orders(scenicID: 128, status: filter, page: 1, pageSize: 20) + let request = try XCTUnwrap(session.requests.last) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/orders") + XCTAssertEqual(try query(request), ["scenic_id": "128", "status": expected, "page": "1", "page_size": "20"]) + XCTAssertNil(request.httpBody) + } + XCTAssertEqual(session.requests.count, 4) + } + + /// 明确的空订单页保留真实总数和页码。 + func testEmptyOrdersDecodeWithoutFabricatedRows() async throws { + let session = MockURLSession(responses: [envelope(#"{"list":[],"total":0,"page":1,"page_size":20}"#)]) + let response = try await DroneDockAPI(client: APIClient(environment: .testing, session: session)) + .orders(scenicID: 128, page: 1, pageSize: 20) + XCTAssertTrue(response.list.isEmpty) + XCTAssertEqual(response.total, 0) + } + + /// 页码错配不允许将其他页错误追加到当前列表。 + func testMismatchedOrderPageIsRejected() async { + let session = MockURLSession(responses: [envelope(#"{"list":[],"total":0,"page":1,"page_size":20}"#)]) + do { + _ = try await DroneDockAPI(client: APIClient(environment: .testing, session: session)) + .orders(scenicID: 128, page: 2, pageSize: 20) + XCTFail("页码不一致应报错") + } catch {} + } + + /// 统计只向张工请求 scenic_id;日期边界由服务端处理。 + func testTodayStatsUsesDedicatedRouteAndDocumentedMetrics() async throws { + let session = MockURLSession(responses: [envelope(#"{"deal_count":12,"deal_amount":"1896.10","completed_count":9,"cash_paid":"1996.10","cash_refund":"100.00","points_net":180}"#)]) + let response = try await DroneDockAPI(client: APIClient(environment: .testing, session: session)) + .todayStats(scenicID: 128) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/today-stats") + XCTAssertEqual(try query(request), ["scenic_id": "128"]) + XCTAssertNil(request.httpBody) + XCTAssertEqual(response.orderCount, 12) + XCTAssertEqual(response.orderAmount, Decimal(string: "1896.10")) + XCTAssertEqual(response.finishedShoot, 9) + } + + /// 数字字符串与数值均保持十进制金额精度,不重算退款或积分。 + func testStatisticsPreserveDecimalPrecisionAndZero() throws { + for amount in ["1896.10", "\"1896.10\""] { + let response = try JSONDecoder().decode(DroneDockHomeToday.self, from: Data("{\"deal_count\":\"12\",\"deal_amount\":\(amount),\"completed_count\":\"9\"}".utf8)) + XCTAssertEqual(response.orderCount, 12) + XCTAssertEqual(response.finishedShoot, 9) + XCTAssertEqual(response.orderAmount, Decimal(string: "1896.10")) + } + let zero = try JSONDecoder().decode(DroneDockHomeToday.self, from: Data(#"{"deal_count":0,"deal_amount":"0.00","completed_count":0}"#.utf8)) + XCTAssertEqual(zero.orderCount, 0) + XCTAssertEqual(zero.orderAmount, .zero) + XCTAssertEqual(zero.finishedShoot, 0) + } + + /// 缺失统计和旧 home 字段保持未知,不能误显示成零或沿用旧口径。 + func testMissingOrObsoleteStatisticsRemainUnknown() throws { + for payload in ["{}", #"{"deal_count":null,"deal_amount":null,"completed_count":null}"#, + #"{"order_count":12,"order_amount":99,"finished_shoot":9}"#] { + let response = try JSONDecoder().decode(DroneDockHomeToday.self, from: Data(payload.utf8)) + XCTAssertNil(response.orderCount) + XCTAssertNil(response.orderAmount) + XCTAssertNil(response.finishedShoot) + } + } + + /// 非法数量、金额及类型明确拒绝,防止错误数据变成零统计。 + func testMalformedStatisticsAreRejected() { + for payload in [#"{"deal_count":"invalid"}"#, #"{"deal_count":-1}"#, + #"{"deal_amount":"12yuan"}"#, #"{"completed_count":1.5}"#, + #"{"completed_count":-1}"#] { + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockHomeToday.self, from: Data(payload.utf8))) + } + } + + /// 各接口业务失败保留后端说明,不改成成功空态。 + func testBackendFailurePropagatesForAllThreeEndpoints() async throws { + let failure = try TestJSON.errorEnvelope(code: 160001, msg: "当前账号无权访问该景区") + let session = MockURLSession(responses: [failure, failure, failure]) + let api = DroneDockAPI(client: APIClient(environment: .testing, session: session)) + for endpoint in 0..<3 { + do { + switch endpoint { + case 0: _ = try await api.home(scenicID: 128, storeID: 37) + case 1: _ = try await api.orders(scenicID: 128, page: 1, pageSize: 20) + default: _ = try await api.todayStats(scenicID: 128) + } + XCTFail("业务失败不能成为空数据") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "当前账号无权访问该景区") + } + } + } + + /// 不发送无景区、门店或非法分页范围的请求。 + func testInvalidContextAndPaginationDoNotSendRequests() async { + let session = MockURLSession(responses: []) + let api = DroneDockAPI(client: APIClient(environment: .testing, session: session)) + for (scenicID, storeID) in [(0, 37), (128, 0)] { + do { + _ = try await api.home(scenicID: scenicID, storeID: storeID) + XCTFail("无效身份应报错") + } catch {} + } + for filter in DroneShootingOrderFilter.allCases { + for (scenicID, page, pageSize) in [(0, 1, 20), (128, 0, 20), (128, 1, 0), (128, 1, 101)] { + do { + _ = try await api.orders(scenicID: scenicID, status: filter, page: page, pageSize: pageSize) + XCTFail("无效分页应报错") + } catch {} + } + } + do { + _ = try await api.todayStats(scenicID: 0) + XCTFail("无景区应报错") + } catch {} + XCTAssertTrue(session.requests.isEmpty) + } + + /// 读取查询参数以确认接口边界,不接触真实登录凭证。 + private func query(_ request: URLRequest) throws -> [String: String] { + let items = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems ?? [] + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } + + /// 补齐统一业务包裹。 + private func envelope(_ payload: String) -> Data { + Data("{\"code\":100000,\"msg\":\"success\",\"data\":\(payload)}".utf8) + } +} diff --git a/suixinkanTests/DroneDockHomeAirportTests.swift b/suixinkanTests/DroneDockHomeAirportTests.swift new file mode 100644 index 0000000..7e37a0e --- /dev/null +++ b/suixinkanTests/DroneDockHomeAirportTests.swift @@ -0,0 +1,102 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证实际设备字段、按键匹配的六项读数及未知状态,不访问设备或后端。 +final class DroneDockHomeAirportTests: XCTestCase { + /// 六项读数即使乱序返回,也按 key 展示后端文案及单位。 + func testMetricsMatchKeysInsteadOfArrayPositions() throws { + let airport = try decodeAirport(metrics: #""" + [ + {"key":"satellite","label":"搜星状态","raw":30,"value":"30颗"}, + {"key":"rainfall","label":"雨量","raw":0,"value":"无雨"}, + {"key":"battery","label":"电池电量","raw":85,"value":"85%"}, + {"key":"signal","label":"信号状态","raw":4,"value":"良好"}, + {"key":"wind_speed","label":"风速","raw":1.2,"value":"1.2m/s"}, + {"key":"env_temp","label":"环境温度","raw":19.3,"value":"19.3°C"} + ] + """#) + + let expected = ["battery": "85%", "env_temp": "19.3°C", "wind_speed": "1.2m/s", + "rainfall": "无雨", "signal": "良好", "satellite": "30颗"] + for (key, value) in expected { XCTAssertEqual(airport.metricText(for: key), value) } + XCTAssertEqual(try XCTUnwrap(airport.batteryProgress), 0.85, accuracy: 0.0001) + } + + /// 原始值存在也不猜测展示单位;缺项、null、空白及破折占位统一显示未知。 + func testMissingAndPlaceholderMetricsStayUnknownWithoutGuessingRawUnits() throws { + let airport = try decodeAirport(metrics: #""" + [ + {"key":"battery","raw":null,"value":null}, + {"key":"env_temp","raw":20,"value":""}, + {"key":"wind_speed","raw":2,"value":" "}, + {"key":"rainfall","raw":0,"value":"--"}, + {"key":"signal","raw":4,"value":" – "} + ] + """#) + + for key in metricKeys { XCTAssertEqual(airport.metricText(for: key), "—") } + XCTAssertNil(airport.batteryProgress) + + let noMetrics = try JSONDecoder().decode(DroneDockHomeAirport.self, from: Data(#"{"id":58,"name":"测试设备"}"#.utf8)) + for key in metricKeys { XCTAssertEqual(noMetrics.metricText(for: key), "—") } + XCTAssertNil(noMetrics.batteryProgress) + } + + /// 真实零值保留零值和零进度,不能与未知电量混为一谈。 + func testMeasuredZeroDiffersFromUnknown() throws { + let zero = try decodeAirport(metrics: #"[{"key":"battery","raw":0,"value":"0%"},{"key":"wind_speed","raw":0,"value":"0m/s"}]"#) + let unknown = try decodeAirport(metrics: #"[{"key":"battery","raw":null,"value":"—"}]"#) + + XCTAssertEqual(zero.metricText(for: "battery"), "0%") + XCTAssertEqual(zero.metricText(for: "wind_speed"), "0m/s") + XCTAssertEqual(zero.batteryProgress, 0) + XCTAssertEqual(unknown.metricText(for: "battery"), "—") + XCTAssertNil(unknown.batteryProgress) + } + + /// 电量环仅接受合法数值 raw;不把展示文本、数字字符串或越界值当作读数。 + func testBatteryProgressRejectsNonNumericAndOutOfRangeRaw() throws { + for raw in ["null", "-1", "101", "\"85\"", "true", "{}"] { + let airport = try decodeAirport(metrics: "[{\"key\":\"battery\",\"raw\":\(raw),\"value\":\"85%\"}]") + XCTAssertNil(airport.batteryProgress, "raw=\(raw)") + XCTAssertEqual(airport.metricText(for: "battery"), "85%") + } + let full = try decodeAirport(metrics: #"[{"key":"battery","raw":100,"value":"100%"}]"#) + XCTAssertEqual(full.batteryProgress, 1) + } + + /// 只按后端状态文案及已验证状态着色,在线和接单标记不会生成空闲状态。 + func testStatusUsesBackendLabelWithoutInferringFlightReadiness() throws { + let idle = try decodeAirport(metrics: "[]") + XCTAssertEqual(idle.statusTitle, "空闲") + XCTAssertEqual(idle.statusTone, .green) + + let unknown = try JSONDecoder().decode(DroneDockHomeAirport.self, from: Data(#"{"id":58,"name":"测试设备","online_status":1,"is_receive_order":1,"work_status":1,"work_status_label":null}"#.utf8)) + XCTAssertEqual(unknown.statusTitle, "状态待确认") + XCTAssertEqual(unknown.statusTone, .gray) + + let occupied = try JSONDecoder().decode(DroneDockHomeAirport.self, from: Data(#"{"id":58,"name":"测试设备","work_status":2,"work_status_label":"占用中"}"#.utf8)) + XCTAssertEqual(occupied.statusTitle, "占用中") + XCTAssertEqual(occupied.statusTone, .gray) + } + + /// 重复设备 ID 会破坏 Diffable 稳定身份,接口层明确拒绝而非触发页面崩溃。 + func testDuplicateAirportIDsAreRejected() { + let payload = #"{"scenic_id":128,"airports":[{"id":58,"name":"设备A"},{"id":58,"name":"设备B"}],"orders":[]}"# + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockHomeResponse.self, from: Data(payload.utf8))) + } + + /// 测试固定的六项读数键。 + private var metricKeys: [String] { ["battery", "env_temp", "wind_speed", "rainfall", "signal", "satellite"] } + + /// 使用当前真实设备结构搭配可控读数,不添加未经验证的字段别名。 + private func decodeAirport(metrics: String) throws -> DroneDockHomeAirport { + let payload = """ + {"id":58,"name":"测试机巢M4D","sn_number":"test-airport-sn","scenic_area_id":128, + "online_status":1,"work_status":1,"work_status_label":"空闲","is_receive_order":1, + "task_type":null,"metrics":\(metrics)} + """ + return try JSONDecoder().decode(DroneDockHomeAirport.self, from: Data(payload.utf8)) + } +} diff --git a/suixinkanTests/DroneDockHomeEntryTests.swift b/suixinkanTests/DroneDockHomeEntryTests.swift new file mode 100644 index 0000000..6a1067f --- /dev/null +++ b/suixinkanTests/DroneDockHomeEntryTests.swift @@ -0,0 +1,128 @@ +import XCTest +@testable import suixinkan + +/// 机巢首页入口沿用权限与常用配置,避免新增权限绕过用户已保存的首页选择。 +@MainActor +final class DroneDockHomeEntryTests: XCTestCase { + /// 后台 URI 命中本地菜单,并在撤回权限后隐藏仍留在常用缓存中的入口。 + func testConfiguredPermissionUsesLocalEntryAndHidesSavedMenuWhenRevoked() throws { + let fixture = makeFixture() + defer { fixture.defaults.removePersistentDomain(forName: fixture.suiteName) } + let appStore = fixture.appStore + let menuStore = fixture.menuStore + let permissions = [walletPermission, droneDockPermission] + appStore.permissions.savePermissionItems(permissions) + menuStore.saveCommonURIs(["wallet", "drone_dock"], + accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode) + let home = makeHome(appStore: appStore, menuStore: menuStore) + + home.rebuildCommonMenus() + + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet", "drone_dock"]) + let droneDock = try XCTUnwrap(home.commonMenus.first { $0.uri == "drone_dock" }) + XCTAssertEqual(droneDock.title, "机巢工作台") + XCTAssertEqual(droneDock.iconName, "airplane.circle.fill") + XCTAssertEqual(droneDock.serverName, "后台配置的机巢入口") + + appStore.permissions.savePermissionItems([walletPermission]) + home.rebuildCommonMenus() + + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), + ["wallet", "drone_dock"]) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + functions.loadFunctions() + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet"]) + XCTAssertTrue(functions.moreMenus.isEmpty) + } + + /// 新权限先进入更多功能,用户明确添加或移除后首页读取同一份常用配置。 + func testExistingCommonSelectionChangesOnlyAfterAddingOrRemovingDroneDock() throws { + let fixture = makeFixture() + defer { fixture.defaults.removePersistentDomain(forName: fixture.suiteName) } + let appStore = fixture.appStore + let menuStore = fixture.menuStore + appStore.permissions.savePermissionItems([walletPermission, droneDockPermission]) + menuStore.saveCommonURIs(["wallet"], accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + let home = makeHome(appStore: appStore, menuStore: menuStore) + + functions.loadFunctions() + home.rebuildCommonMenus() + + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["drone_dock"]) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + let droneDock = try XCTUnwrap(functions.moreMenus.first) + + functions.addToCommon(droneDock) + home.rebuildCommonMenus() + + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet", "drone_dock"]) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), + ["wallet", "drone_dock"]) + XCTAssertTrue(functions.moreMenus.isEmpty) + + functions.removeFromCommon(droneDock) + functions.loadFunctions() + home.rebuildCommonMenus() + + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["drone_dock"]) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), ["wallet"]) + } + + /// 未自定义时仍只取权限前四项,不为第五项机巢入口改变现有默认策略。 + func testDefaultFirstFourKeepsDroneDockInMoreUntilUserSelectsIt() { + let fixture = makeFixture() + defer { fixture.defaults.removePersistentDomain(forName: fixture.suiteName) } + let appStore = fixture.appStore + let menuStore = fixture.menuStore + appStore.permissions.savePermissionItems([ + walletPermission, + HomePermissionItem(id: "cloud", name: "云盘", uri: "cloud_management"), + HomePermissionItem(id: "task", name: "任务", uri: "task_management"), + HomePermissionItem(id: "settings", name: "设置", uri: "system_settings"), + droneDockPermission, + ]) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + let home = makeHome(appStore: appStore, menuStore: menuStore) + + functions.loadFunctions() + home.rebuildCommonMenus() + + let expected = ["wallet", "cloud_management", "task_management", "system_settings"] + XCTAssertEqual(functions.commonMenus.map(\.uri), expected) + XCTAssertEqual(home.commonMenus.map(\.uri), expected) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["drone_dock"]) + } + + private var walletPermission: HomePermissionItem { + HomePermissionItem(id: "wallet", name: "我的钱包", uri: "wallet") + } + + private var droneDockPermission: HomePermissionItem { + HomePermissionItem(id: "drone-dock", name: "后台配置的机巢入口", uri: "drone_dock") + } + + /// 每项测试独立使用账号、角色与 UserDefaults,避免影响真机已有登录及常用菜单。 + private func makeFixture() -> (suiteName: String, defaults: UserDefaults, appStore: AppStore, menuStore: HomeCommonMenuStore) { + let suiteName = "DroneDockHomeEntryTests.\(UUID().uuidString)" + let defaults = UserDefaults(suiteName: suiteName)! + let appStore = AppStore(defaults: defaults) + appStore.session.configureTestAccount(userId: "drone-home-menu", scenicId: 11) + appStore.session.roleCode = AppRoleCode.photographer.rawValue + return (suiteName, defaults, appStore, HomeCommonMenuStore(defaults: defaults)) + } + + /// 菜单测试只重建本地展示,定位和在线状态均注入隔离替身,不触发接口或授权。 + private func makeHome(appStore: AppStore, menuStore: HomeCommonMenuStore) -> HomeViewModel { + HomeViewModel(appStore: appStore, locationStateStore: HomeLocationStateStore(store: appStore), + commonMenuStore: menuStore, locationProvider: MockLocationProvider()) + } +} diff --git a/suixinkanTests/DroneDockHomeOrderTests.swift b/suixinkanTests/DroneDockHomeOrderTests.swift new file mode 100644 index 0000000..a1bd5fe --- /dev/null +++ b/suixinkanTests/DroneDockHomeOrderTests.swift @@ -0,0 +1,334 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证张工订单摘要、稳定订单号与权限,所有载荷均为匿名测试数据。 +final class DroneDockHomeOrderTests: XCTestCase { + /// 整单仅识别执行与完成,素材上传另有字段;25 不再被误解为整单状态。 + func testOrderStatusOverridesBadgesWithoutChangingPendingOrUnknownFallback() throws { + let cases: [(Int?, String?, String, DroneDockStatusTone)] = [ + (25, "processing", "进行中", .orange), + (30, "pending", "已完成", .green), + (20, "pending", "待拍摄", .blue), + (20, "processing", "进行中", .orange), + (20, nil, "进行中", .orange), + (nil, "processing", "进行中", .orange), + (99, "pending", "待拍摄", .blue), + (99, nil, "状态待确认", .gray) + ] + for (status, shootStatus, title, tone) in cases { + var payload: [String: Any] = ["order_number": "TEST-STATUS"] + payload["order_status"] = status + payload["shoot_status"] = shootStatus + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: payload)) + XCTAssertEqual(order.orderStatus, status) + XCTAssertEqual(order.knownOrderStatus?.rawValue, status.flatMap { [20, 30].contains($0) ? $0 : nil }) + XCTAssertEqual(order.isActiveOrderStatus, status == 20) + XCTAssertEqual(order.statusTitle, title, "order_status=\(String(describing: status)), shoot_status=\(String(describing: shootStatus))") + XCTAssertEqual(order.statusTone, tone) + } + } + + /// 上传任务不占用活动飞行入口;次数耗尽不隐藏仍在执行的最后一飞。 + func testUploadingTaskKeepsOrderProgressAndFlightActionsSeparate() throws { + let cases: [(Int?, Int, Bool, String)] = [ + (25, 0, false, "view_materials"), (25, 1, true, "start_shoot"), + (20, 0, false, "view_task"), (20, 1, true, "view_task"), + (nil, 1, true, "start_shoot"), (30, 0, false, "view_materials"), + (99, 1, true, "start_shoot") + ] + for (taskStatus, remaining, canCreate, action) in cases { + var payload: [String: Any] = ["order_number": "TEST-UPLOADING", "order_status": 20, + "shoot_status": "processing", "shoot_count": 2, "shot_count": 2 - remaining, + "remaining_count": remaining, "material_status": 2, "active_task_id": 21, + "can_create_task": canCreate, "can_upload_film": true] + payload["active_task_status"] = taskStatus + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: payload)) + XCTAssertEqual(order.statusTitle, "进行中") + XCTAssertEqual(order.mediaStatusTitle, "上传中") + XCTAssertEqual(order.primaryAction, action) + XCTAssertEqual(order.activeTaskID, 21, "原始任务 ID 仍保留用于诊断") + XCTAssertEqual(order.activeTaskStatus, taskStatus) + XCTAssertEqual(order.activeFlightTaskID, taskStatus == 20 ? 21 : nil) + } + } + + /// 卡片用上传任务补足滞后的素材汇总文案,原始字段、权限与活动飞行入口保持独立。 + func testUploadingTaskOverridesOnlyCardMaterialPresentation() throws { + let materials: [(Int?, String?, DroneDockStatusTone)] = [ + (nil, nil, .gray), (0, "未开始上传", .gray), (1, "上传完成", .green), + (2, "上传中", .blue), (3, "上传失败", .red), (99, nil, .gray) + ] + let taskStatuses: [Int?] = [25, 20, nil] + for taskStatus in taskStatuses { + for (materialStatus, rawTitle, rawTone) in materials { + var payload: [String: Any] = ["order_number": "TEST-CARD-MATERIAL", "order_status": 20, + "shoot_status": "processing", "active_task_id": 21, + "can_create_task": false, "can_upload_film": false, "can_confirm": false] + payload["active_task_status"] = taskStatus + payload["material_status"] = materialStatus + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: payload)) + let context = "active_task_status=\(String(describing: taskStatus)), material_status=\(String(describing: materialStatus))" + XCTAssertEqual(order.materialStatus, materialStatus, context) + XCTAssertEqual(order.mediaStatusTitle, rawTitle, context) + XCTAssertEqual(order.cardMaterialStatusTitle, taskStatus == 25 ? "素材上传中" : rawTitle, context) + XCTAssertEqual(order.cardMaterialStatusTone, taskStatus == 25 ? .blue : rawTone, context) + XCTAssertEqual(order.showsMaterialsEntry, taskStatus == 25 || materialStatus == 1 || materialStatus == 2 || materialStatus == 3, context) + XCTAssertEqual(order.statusTitle, "进行中", context) + XCTAssertEqual(order.activeFlightTaskID, taskStatus == 20 ? 21 : nil, context) + XCTAssertEqual(order.primaryAction, taskStatus == 20 ? "view_task" : nil, context) + XCTAssertFalse(order.canDeliverFilm, context) + XCTAssertFalse(order.canInviteVisitorConfirmation, context) + } + } + } + + /// 已拍次数可在素材汇总滞后或缺失时保留入口,展示仍取服务端素材状态。 + func testSuccessfulRecordingKeepsMaterialsEntryWhileSummaryIsUnavailable() throws { + let materials: [(Int?, String?)] = [(nil, nil), (0, "未开始上传"), (99, nil)] + for (materialStatus, title) in materials { + for shotCount in [0, 1] { + var payload: [String: Any] = ["order_number": "TEST-SHOT", "shot_count": shotCount, + "active_task_id": 21, "active_task_status": 20, "can_upload_film": false] + payload["material_status"] = materialStatus + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: payload)) + XCTAssertEqual(order.showsMaterialsEntry, shotCount > 0) + XCTAssertEqual(order.cardMaterialStatusTitle, title) + XCTAssertEqual(order.primaryAction, "view_task") + XCTAssertFalse(order.canDeliverFilm) + } + } + } + + /// 后端选定任务优先于新增、交付和确认权限,不从剩余次数推断是否飞行中。 + func testActiveTaskTakesPriorityOverAllOtherActions() throws { + let order = try decodeOrder(#"{"order_number":"TEST-ACTIVE","active_task_id":501,"active_task_status":20,"can_create_task":true,"can_upload_film":true,"can_confirm":true,"shoot_count":5,"shot_count":5}"#) + XCTAssertEqual(order.activeTaskID, 501) + XCTAssertEqual(order.activeTaskStatus, 20) + XCTAssertEqual(order.primaryAction, "view_task") + XCTAssertEqual(order.actionTitle, "继续查看任务") + } + + /// 增量字段只出现在 orders;旧响应和详情缺字段、返回 null 均保持原入口。 + func testMissingAndNullActiveTaskFallBackToExistingActions() throws { + for extra in ["", #", "active_task_id":null,"active_task_status":null"#] { + let order = try decodeOrder("{\"order_number\":\"TEST-NONE\",\"can_create_task\":true\(extra)}") + XCTAssertNil(order.activeTaskID) + XCTAssertNil(order.activeTaskStatus) + XCTAssertEqual(order.primaryAction, "start_shoot") + } + let noPermission = try decodeOrder(#"{"order_number":"TEST-NONE","active_task_id":null,"active_task_status":null,"can_create_task":false,"can_upload_film":true}"#) + XCTAssertEqual(noPermission.primaryAction, "view_materials") + } + + /// 没有新建权限也能继续查看;仅有状态或航线 ID 时不能猜测订单任务 ID。 + func testContinuationRequiresTaskIDButNotCreatePermission() throws { + let active = try decodeOrder(#"{"order_number":"TEST-ACTIVE","active_task_id":502,"active_task_status":20,"can_create_task":false}"#) + XCTAssertEqual(active.primaryAction, "view_task") + let noID = try decodeOrder(#"{"order_number":"TEST-NONE","active_task_status":20,"shoot_status":"processing","wayline_task_id":999,"can_create_task":true}"#) + XCTAssertNil(noID.activeTaskID) + XCTAssertEqual(noID.primaryAction, "start_shoot") + } + + /// 无效任务 ID 不能进入任务页或变成默认任务,延续订单模型对身份的严格校验。 + func testInvalidActiveTaskIDIsRejected() { + for id in ["0", "-1", "true", "1.5", "\"invalid\""] { + XCTAssertThrowsError(try decodeOrder("{\"order_number\":\"TEST-INVALID\",\"active_task_id\":\(id)}")) + } + } + + /// 完整订单摘要保留购买项目、整单计次和操作权限。 + func testMultiPlaneOrderPreservesPurchasedProjectAndSummary() throws { + let order = try decodeOrder(#""" + { + "order_number":"001TESTORDER","project_id":101,"project_name":"多点位航拍", + "created_at":"2026-10-27 10:00:00","user_phone":"138****0000", + "shoot_count":3,"shot_count":1,"remaining_count":2,"shoot_status":"processing", + "order_status":20,"material_status":2,"film_count":1, + "can_create_task":true,"can_upload_film":true,"can_confirm":false, + "confirm_status":0,"confirmed_at":null + } + """#) + + XCTAssertEqual(order.id, "001TESTORDER") + XCTAssertEqual(order.orderID, "001TESTORDER") + XCTAssertEqual(order.orderNumberText, "001TESTORDER") + XCTAssertEqual(order.projectID, 101) + XCTAssertEqual(order.createdAt, "2026-10-27 10:00:00") + XCTAssertEqual(order.touristTitle, "游客 138****0000") + XCTAssertEqual(order.packageTitle, "多点位航拍") + XCTAssertEqual(order.statusTitle, "进行中") + XCTAssertEqual(order.shotTotal, 3) + XCTAssertEqual(order.shotUsed, 1) + XCTAssertEqual(order.shotRemain, 2) + XCTAssertEqual(order.progressTitle, "已拍摄 1/3 次,剩余 2 次") + XCTAssertEqual(order.orderStatus, 20) + XCTAssertEqual(order.materialStatus, 2) + XCTAssertEqual(order.mediaStatusTitle, "上传中") + XCTAssertEqual(order.filmCount, 1) + XCTAssertEqual(order.primaryAction, "start_shoot") + XCTAssertEqual(order.actionTitle, "开始拍摄") + XCTAssertEqual(order.canUploadFilm, true) + XCTAssertEqual(order.canConfirm, false) + XCTAssertEqual(order.confirmStatus, 0) + XCTAssertNil(order.confirmedAt) + } + + /// 无展示值时保持未知,旧 home 字段不得成为订单或权限回退来源。 + func testMissingAndObsoleteFieldsStayUnknown() throws { + for payload in [#"{"order_number":"TEST-001"}"#, + #"{"order_number":"TEST-001","project_id":null,"project_name":"--","user_phone":" ","shoot_count":null,"shot_count":null,"remaining_count":null,"shoot_status":null,"material_status":null,"can_create_task":null,"package_name":"旧套餐","shot_total":99,"primary_action":"start_shoot","primary_action_label":"开始拍摄"}"#] { + let order = try decodeOrder(payload) + XCTAssertNil(order.projectID) + XCTAssertEqual(order.touristTitle, "游客信息待确认") + XCTAssertEqual(order.packageTitle, "套餐信息待确认") + XCTAssertEqual(order.statusTitle, "状态待确认") + XCTAssertNil(order.shotTotal) + XCTAssertNil(order.shotUsed) + XCTAssertNil(order.shotRemain) + XCTAssertEqual(order.progressTitle, "已拍摄 —/— 次,剩余 — 次") + XCTAssertNil(order.primaryAction) + XCTAssertNil(order.actionTitle) + XCTAssertNil(order.mediaStatusTitle) + } + } + + /// 数字字符串兼容服务端响应,明确的零次仍显示零。 + func testNumericStringsAndZeroCountsArePreserved() throws { + let order = try decodeOrder(#"{"order_number":"TEST-001","project_id":"101","shoot_count":"0","shot_count":0,"remaining_count":"0","order_status":"20","film_count":"0"}"#) + XCTAssertEqual(order.projectID, 101) + XCTAssertEqual(order.orderStatus, 20) + XCTAssertEqual(order.filmCount, 0) + XCTAssertEqual(order.progressTitle, "已拍摄 0/0 次,剩余 0 次") + } + + /// 不重新计算剩余次数,也不掩盖后端允许的已成功次数超过购买次数。 + func testProgressDoesNotRecalculateQuota() throws { + let incomplete = try decodeOrder(#"{"order_number":"TEST-001","shoot_count":5,"shot_count":2}"#) + XCTAssertEqual(incomplete.progressTitle, "已拍摄 2/5 次,剩余 — 次") + let overQuota = try decodeOrder(#"{"order_number":"TEST-001","shoot_count":5,"shot_count":6,"remaining_count":0}"#) + XCTAssertEqual(overQuota.progressTitle, "已拍摄 6/5 次,剩余 0 次") + } + + /// 有剩余次数不等于获准新增任务,入口只取 can_create_task。 + func testShootingActionRequiresExplicitServerPermission() throws { + for suffix in ["", #", "can_create_task":false"#, #", "can_create_task":null"#] { + let order = try decodeOrder("{\"order_number\":\"TEST-001\",\"shoot_status\":\"pending\",\"remaining_count\":3\(suffix)}") + XCTAssertNil(order.primaryAction) + XCTAssertNil(order.actionTitle) + } + let allowed = try decodeOrder(#"{"order_number":"TEST-001","can_create_task":true}"#) + XCTAssertEqual(allowed.primaryAction, "start_shoot") + } + + /// 次数用完且获准确认时显示确认入口,不误判为已经完成。 + func testConfirmationAndMaterialActionsUseTheirOwnPermissions() throws { + let confirming = try decodeOrder(#"{"order_number":"TEST-001","shoot_status":"processing","shoot_count":5,"shot_count":5,"remaining_count":0,"can_create_task":false,"can_upload_film":true,"can_confirm":true}"#) + XCTAssertEqual(confirming.statusTitle, "进行中") + XCTAssertEqual(confirming.primaryAction, "confirm_delivery") + XCTAssertEqual(confirming.actionTitle, "邀请确认") + let materials = try decodeOrder(#"{"order_number":"TEST-001","can_create_task":false,"can_upload_film":true,"can_confirm":false}"#) + XCTAssertEqual(materials.primaryAction, "view_materials") + XCTAssertEqual(materials.actionTitle, "查看素材") + let completed = try decodeOrder(#"{"order_number":"TEST-001","shoot_status":"completed","can_create_task":false,"can_upload_film":false,"can_confirm":false}"#) + XCTAssertEqual(completed.statusTitle, "已完成") + XCTAssertNil(completed.actionTitle) + } + + /// 拍摄满额必须同时具备有效总次数与成功次数,权限或状态字段不能代替计数。 + func testConfirmationQuotaRequiresAllPurchasedShots() throws { + let scenarios: [(Int?, Int?, Bool)] = [ + (5, 0, false), (5, 4, false), (5, 5, true), (5, 6, true), + (0, 0, false), (0, 5, false), (nil, 5, false), (5, nil, false), (nil, nil, false) + ] + for (total, used, expected) in scenarios { + let payload: [String: Any] = ["order_number": "TEST-QUOTA", "can_confirm": true, + "shoot_count": total.map { $0 as Any } ?? NSNull(), + "shot_count": used.map { $0 as Any } ?? NSNull(), + "remaining_count": 0, "shoot_status": "completed", "confirm_status": 2, "order_status": 30] + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: payload)) + XCTAssertEqual(order.hasCompletedShootingQuota, expected, "total=\(String(describing: total)), used=\(String(describing: used))") + XCTAssertEqual(order.canInviteVisitorConfirmation, expected) + XCTAssertEqual(order.primaryAction, expected ? "confirm_delivery" : nil) + } + } + + /// 拍满只是确认入口的前置条件,不能取代后端明确授予的确认权限。 + func testCompletedShootingQuotaDoesNotGrantConfirmationPermission() throws { + for permission in [NSNull(), false] as [Any] { + let payload: [String: Any] = ["order_number": "TEST-QUOTA", "shoot_count": 5, + "shot_count": 5, "can_confirm": permission, "can_upload_film": true] + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: payload)) + XCTAssertTrue(order.hasCompletedShootingQuota) + XCTAssertFalse(order.canInviteVisitorConfirmation) + XCTAssertEqual(order.primaryAction, "view_materials") + } + } + + /// 未知枚举不映射成已完成或上传成功。 + func testUnknownStatusRemainsUnknown() throws { + let order = try decodeOrder(#"{"order_number":"TEST-001","shoot_status":"future","material_status":99}"#) + XCTAssertEqual(order.statusTitle, "状态待确认") + XCTAssertNil(order.mediaStatusTitle) + let labels = [0: "未开始上传", 1: "上传完成", 2: "上传中", 3: "上传失败"] + for (value, label) in labels { + let item = try decodeOrder("{\"order_number\":\"TEST-001\",\"material_status\":\(value)}") + XCTAssertEqual(item.mediaStatusTitle, label) + } + } + + /// Diffable 使用完整字符串订单号,拒绝缺失、空白和重复身份。 + func testInvalidAndDuplicateOrderNumbersAreRejected() throws { + for payload in ["{}", "null", "[]", "false", #"{"order_number":null}"#, + #"{"order_number":1001}"#, #"{"order_number":""}"#, + #"{"order_number":" "}"#, #"{"order_number":" TEST-001 "}"#] { + XCTAssertThrowsError(try decodeOrder(payload), payload) + } + let duplicate = #"{"list":[{"order_number":"001"},{"order_number":"001"}],"total":2,"page":1,"page_size":20}"# + XCTAssertThrowsError(try decodePage(duplicate)) + let distinct = try decodePage(#"{"list":[{"order_number":"001"},{"order_number":"1"}],"total":2,"page":1,"page_size":20}"#) + XCTAssertEqual(distinct.list.map(\.id), ["001", "1"]) + } + + /// 分页信息与列表必须完整、合法,后端总数不能以当前页条数代替。 + func testMalformedPaginationIsRejected() { + for payload in [#"{"total":0,"page":1,"page_size":20}"#, + #"{"list":null,"total":0,"page":1,"page_size":20}"#, + #"{"list":[],"total":-1,"page":1,"page_size":20}"#, + #"{"list":[],"total":0,"page":0,"page_size":20}"#, + #"{"list":[],"total":0,"page":1,"page_size":0}"#, + #"{"list":[],"total":0,"page":1,"page_size":101}"#, + #"{"list":[{"order_number":"TEST-001"}],"total":0,"page":1,"page_size":20}"#] { + XCTAssertThrowsError(try decodePage(payload), payload) + } + } + + /// 非法项目 ID、负次数和权限的错误类型必须暴露解析错误。 + func testMalformedCountsAndPermissionTypesAreRejected() { + for field in ["shoot_count", "shot_count", "remaining_count", "film_count"] { + for value in ["-1", "1.5", "true", "\"invalid\"", "{}"] { + XCTAssertThrowsError(try decodeOrder("{\"order_number\":\"TEST-001\",\"\(field)\":\(value)}")) + } + } + for value in ["0", "-1", "1.5", "true"] { + XCTAssertThrowsError(try decodeOrder("{\"order_number\":\"TEST-001\",\"project_id\":\(value)}")) + } + XCTAssertThrowsError(try decodeOrder(#"{"order_number":"TEST-001","can_create_task":"true"}"#)) + } + + /// 解码单条匿名摘要。 + private func decodeOrder(_ payload: String) throws -> DroneDockHomeOrder { + try JSONDecoder().decode(DroneDockHomeOrder.self, from: Data(payload.utf8)) + } + + /// 解码独立订单分页响应。 + private func decodePage(_ payload: String) throws -> DroneDockOrdersResponse { + try JSONDecoder().decode(DroneDockOrdersResponse.self, from: Data(payload.utf8)) + } +} diff --git a/suixinkanTests/DroneDockHomeRouteTests.swift b/suixinkanTests/DroneDockHomeRouteTests.swift new file mode 100644 index 0000000..5b741e0 --- /dev/null +++ b/suixinkanTests/DroneDockHomeRouteTests.swift @@ -0,0 +1,64 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 在真机验证正式首页 URI 接入,并保持既有景区选择门槛。 +@MainActor +final class DroneDockHomeRouteTests: XCTestCase { + /// 未选择景区时提示用户,不能从正式菜单绕过景区门槛。 + func testDroneDockRouteRequiresSelectedScenic() { + withTemporaryScenic(0) { + let root = DroneDockHomeRouteProbeController() + let navigation = UINavigationController(rootViewController: root) + + HomeRouteHandler.open(uri: "drone_dock", from: root, storeItem: nil) + + XCTAssertTrue(navigation.topViewController === root) + XCTAssertEqual(navigation.viewControllers.count, 1) + XCTAssertEqual(root.lastPresentedMessage, "请先选择景区") + } + } + + /// 正式 URI 打开真实首页,加载前不生成演示设备或订单。 + func testDroneDockRouteOpensWorkbenchAfterSelectingScenic() throws { + try withTemporaryScenic(26) { + let root = DroneDockHomeRouteProbeController() + let navigation = UINavigationController(rootViewController: root) + + HomeRouteHandler.open(uri: "drone_dock", from: root, storeItem: nil) + + let workbench = try XCTUnwrap(navigation.topViewController as? DroneDockHomeViewController) + XCTAssertEqual(navigation.viewControllers.count, 2) + XCTAssertTrue(workbench.hidesBottomBarWhenPushed) + XCTAssertNil(workbench.viewModel.response) + XCTAssertEqual(workbench.viewModel.context.scenicID, 26) + XCTAssertNil(root.lastPresentedMessage) + } + } + + /// 使用临时账号的景区键,不依赖真机登录状态,也不修改原账号景区。 + private func withTemporaryScenic(_ scenicID: Int, perform body: () throws -> Void) rethrows { + let session = AppStore.shared.session + let originalUserID = session.userId + let originalAccountType = session.accountType + session.configureTestAccount(userId: "drone-home-route-\(UUID().uuidString)", scenicId: scenicID) + let temporaryScenicKey = session.accountScopedKey("key_in_current_scenic_id") + defer { + if let temporaryScenicKey { UserDefaults.standard.removeObject(forKey: temporaryScenicKey) } + session.userId = originalUserID + session.accountType = originalAccountType + } + try body() + } +} + +/// 只捕获未选景区时的提示,避免测试触发真实弹层或依赖可见窗口。 +@MainActor +private final class DroneDockHomeRouteProbeController: UIViewController { + private(set) var lastPresentedMessage: String? + + override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) { + lastPresentedMessage = (viewControllerToPresent as? UIAlertController)?.message + completion?() + } +} diff --git a/suixinkanTests/DroneDockLiveAPITests.swift b/suixinkanTests/DroneDockLiveAPITests.swift new file mode 100644 index 0000000..794cedd --- /dev/null +++ b/suixinkanTests/DroneDockLiveAPITests.swift @@ -0,0 +1,118 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// live 请求合同只交给纯内存传输,测试不会连接后端或启动设备图传。 +@MainActor +final class DroneDockLiveAPITests: XCTestCase { + /// 仅向 live 发送同一任务 ID 的 GET,并复用统一鉴权。 + func testRequestContainsOnlyTaskIDAndNoBody() async throws { + let session = MockURLSession(responses: [try DroneDockLiveTestData.envelope()]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "live-test-token" } + let response = try await DroneDockLiveAPI(client: client).live(taskID: 501) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/live") + XCTAssertNil(request.httpBody) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "live-test-token") + XCTAssertEqual(URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems, + [URLQueryItem(name: "id", value: "501")]) + XCTAssertEqual(response.orderFlightTaskID, 501) + XCTAssertEqual(response.airportSN, "TEST-LIVE-AIRPORT") + XCTAssertEqual(response.metrics.first?.displayText, "0%") + } + + /// 未定义的字段与原类型保留在回执中,不解析成真实连接参数。 + func testUnknownJSONFieldsPreserveOriginalTypes() throws { + let fields = DroneDockLiveTestData.payload().merging([ + "future": ["flag": false, "values": [NSNull(), "001", 0, 1.5]] as [String: Any], + "play_url": "https://example.invalid/not-a-confirmed-contract" + ]) { _, new in new } + let response = try DroneDockLiveTestData.response(fields) + let result = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(response.dataJSON.utf8)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: result).isEqual(to: fields)) + XCTAssertEqual(response.airport, .object([:])) + } + + /// 缺失身份、字符串任务 ID 和非对象 data 不作为可信回执。 + func testMissingOrMalformedIdentityIsRejected() throws { + XCTAssertThrowsError(try DroneDockLiveTestData.response([:])) + XCTAssertThrowsError(try DroneDockLiveTestData.response(["order_flight_task_id": "501"])) + XCTAssertThrowsError(try DroneDockLiveTestData.response(["order_flight_task_id": true])) + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockLiveResponse.self, from: Data("[]".utf8))) + } + + /// 顶层与嵌套任务均参与核对,避免给当前页返回其他任务的图传。 + func testMismatchedTaskIdentitiesAreRejected() async throws { + for changes: [String: Any] in [["order_flight_task_id": 502], ["task": ["id": 502]]] { + let fields = DroneDockLiveTestData.payload().merging(changes) { _, new in new } + let session = MockURLSession(responses: [try DroneDockLiveTestData.envelope(fields)]) + do { + _ = try await DroneDockLiveAPI(client: APIClient(environment: .testing, session: session)).live(taskID: 501) + XCTFail("应拒绝其他任务的图传回执") + } catch let APIError.decodeFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 后端业务拒绝保留原码与说明,不变为占位的成功连接。 + func testBusinessRejectionPreservesReason() async throws { + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 100099, msg: "任务尚未锁定机场")]) + do { + _ = try await DroneDockLiveAPI(client: APIClient(environment: .testing, session: session)).live(taskID: 501) + XCTFail("业务拒绝不应算成功") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "任务尚未锁定机场") + } + } + + /// HTTP 失败及超时各只提交一次,不在适配器中重试或使用其他机场接口。 + func testTransportFailuresDoNotRetry() async throws { + let sessions = [MockURLSession(responses: [try DroneDockLiveTestData.envelope()], statusCode: 503), + MockURLSession(results: [.failure(URLError(.timedOut))])] + for session in sessions { + do { + _ = try await DroneDockLiveAPI(client: APIClient(environment: .testing, session: session)).live(taskID: 501) + XCTFail("传输失败不应算成功") + } catch {} + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 无效任务 ID 与调用前取消都在传输前结束。 + func testInvalidOrCancelledRequestDoesNotReachTransport() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockLiveAPI(client: APIClient(environment: .testing, session: session)) + for id in [0, -1] { + do { _ = try await api.live(taskID: id); XCTFail("应拒绝无效 ID") } catch {} + } + let task = Task { @MainActor in try await api.live(taskID: 501) } + task.cancel() + do { _ = try await task.value; XCTFail("应处理取消") } catch is CancellationError {} + XCTAssertTrue(session.requests.isEmpty) + } +} + +/// live 测试仅使用文档已说明字段;不存在任何可连接的真实设备身份。 +enum DroneDockLiveTestData { + /// 构造含明确任务身份、空设备明细与零电量读数的匿名数据。 + static func payload() -> [String: Any] { + ["order_flight_task_id": 501, "airport": [:], "drone": [:], + "airport_sn": "TEST-LIVE-AIRPORT", "task": ["id": 501, "status": 20], + "metrics": [["key": "battery", "value": "0%"]]] + } + + /// 将匿名对象解析为正式 DTO,不伪造服务层已验证结论。 + static func response(_ value: [String: Any]? = nil) throws -> DroneDockLiveResponse { + try JSONDecoder().decode(DroneDockLiveResponse.self, + from: JSONSerialization.data(withJSONObject: value ?? payload())) + } + + /// 将匿名 data 包装为统一成功响应,仅供内存传输。 + static func envelope(_ value: [String: Any]? = nil) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": value ?? payload()]) + } +} diff --git a/suixinkanTests/DroneDockLiveConnectionTests.swift b/suixinkanTests/DroneDockLiveConnectionTests.swift new file mode 100644 index 0000000..b1b5652 --- /dev/null +++ b/suixinkanTests/DroneDockLiveConnectionTests.swift @@ -0,0 +1,107 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证真实协议的参数边界;样例只有虚构值,测试从不连接 RTC。 +final class DroneDockLiveConnectionTests: XCTestCase { + /// 保留 Token 中的加号与等号,百分号只解码一次。 + func testVolcQueryDecodesOnceAndPreservesTokenCharacters() throws { + let value = try DroneDockVolcLiveConfiguration.parse(DroneDockRTCFixture.response(), now: DroneDockRTCFixture.now) + XCTAssertEqual(value.appID, "test-app") + XCTAssertEqual(value.roomID, "test-room") + XCTAssertEqual(value.userID, "test-user") + XCTAssertEqual(value.token, "fake+token+/%2B==") + XCTAssertEqual(value.role, "drone") + XCTAssertEqual(value.expiresAt.timeIntervalSince1970, 2_000_000_600) + XCTAssertFalse(value.debugDescription.contains(value.token)) + } + + /// 缺失、重复和非法转义的参数不进入 SDK,也不在错误中泄露原值。 + func testInvalidQueriesAreRejectedWithoutLeakingSecrets() throws { + let valid = DroneDockRTCFixture.query + for query in [valid + "&app_id=second", valid + "&token=secret", "bad=%ZZ", "https://test.invalid/a", + "app_id=x&room_id=y&user_id=z&token=", "app_id=x&room_id=y&user_id=z&token=%0Asecret", + "app_id=x&room_id=y&user_id=z", valid + "&expire_time=bad"] { + XCTAssertThrowsError(try DroneDockVolcLiveConfiguration.parse( + DroneDockRTCFixture.response(play: ["url": query]), now: DroneDockRTCFixture.now)) { error in + XCTAssertFalse(error.localizedDescription.contains("secret")) + } + } + } + + /// 只接受已明确支持的 volc,绝不把未知 RTC 连接串当 HTTP 视频播放。 + func testUnsupportedVendorsAreExplicitlyRejected() throws { + for type in ["agora", "tencent", "srs", "", "unknown"] { + XCTAssertThrowsError(try DroneDockVolcLiveConfiguration.parse( + DroneDockRTCFixture.response(play: ["url_type": type]), now: DroneDockRTCFixture.now)) { error in + XCTAssertTrue(error.localizedDescription.contains("暂不支持")) + } + } + } + + /// 不可播放回执优先展示后端原因,不强求成功态中的设备字段。 + func testUnavailableResponsePreservesReason() throws { + let response = try DroneDockLiveTestData.response([ + "order_flight_task_id": 501, "playable": false, "play": NSNull(), + "unavailable_message": "飞行器暂未上报视频流"]) + XCTAssertThrowsError(try DroneDockVolcLiveConfiguration.parse(response, now: DroneDockRTCFixture.now)) { + XCTAssertEqual($0.localizedDescription, "飞行器暂未上报视频流") + } + } + + /// 可播放标志不替代流可用、设备身份、角色的验证。 + func testMissingStreamOrDeviceFieldsCannotConnect() throws { + for change: [String: Any] in [["available": false], ["available": NSNull()], ["role": "other"], + ["url": NSNull()], ["expire_ts": NSNull()]] { + XCTAssertThrowsError(try DroneDockVolcLiveConfiguration.parse( + DroneDockRTCFixture.response(play: change), now: DroneDockRTCFixture.now)) + } + for change: [String: Any] in [["plane_id": 0], ["airport_sn": ""], ["play": NSNull()]] { + XCTAssertThrowsError(try DroneDockVolcLiveConfiguration.parse( + DroneDockRTCFixture.response(root: change), now: DroneDockRTCFixture.now)) + } + } + + /// 使用两个有效期中较早者,过期或即将过期的凭证不能进房。 + func testExpiryUsesEarlierTimestampAndRejectsNearExpiry() throws { + let response = try DroneDockRTCFixture.response(play: ["url": DroneDockRTCFixture.query + "&expire_time=2000000100"]) + XCTAssertEqual(try DroneDockVolcLiveConfiguration.parse(response, now: DroneDockRTCFixture.now) + .expiresAt.timeIntervalSince1970, 2_000_000_100) + for expiry in [0, 1_999_999_999, 2_000_000_005] { + XCTAssertThrowsError(try DroneDockVolcLiveConfiguration.parse( + DroneDockRTCFixture.response(play: ["expire_ts": expiry]), now: DroneDockRTCFixture.now)) + } + } + + /// 后端优先流为机巢时明确保留角色,不冒充无人机摄像头。 + func testAirportFallbackKeepsSourceRole() throws { + let response = try DroneDockRTCFixture.response(play: ["role": "airport"]) + XCTAssertEqual(try DroneDockVolcLiveConfiguration.parse(response, now: DroneDockRTCFixture.now).role, "airport") + } + + /// 展示 JSON 中的 play/raw/airport/drone 均不能暴露连接串。 + func testDiagnosticJSONRedactsNestedConnectionSecrets() throws { + let response = try DroneDockRTCFixture.response(root: ["drone": ["url": "secret-drone", "token": "secret-token"]], + play: ["raw": ["url": "secret-raw", "token": "secret-token"]]) + XCTAssertFalse(response.dataJSON.contains("fake+token")) + XCTAssertFalse(response.dataJSON.contains("secret-")) + XCTAssertTrue(response.dataJSON.contains("")) + XCTAssertTrue(response.play?.url?.contains("fake+token") == true) + } +} + +/// 固定时间与合成凭证;仅供内存解析和播放器替身使用。 +enum DroneDockRTCFixture { + static let now = Date(timeIntervalSince1970: 2_000_000_000) + static let query = "app_id=test-app&room_id=test-room&user_id=test-user&token=fake+token%2B%2F%252B==" + + /// 支持覆写错误字段,所有样例均没有真实设备或可用凭证。 + static func response(root: [String: Any] = [:], play: [String: Any] = [:]) throws -> DroneDockLiveResponse { + let stream: [String: Any] = ["available": true, "role": "drone", "device_sn": "TEST-DRONE", + "url_type": "volc", "url": query, "expire_ts": 2_000_000_600] + let data = DroneDockLiveTestData.payload().merging([ + "plane_id": 5, "playable": true, "play": stream.merging(play) { _, new in new } + ]) { _, new in new }.merging(root) { _, new in new } + return try DroneDockLiveTestData.response(data) + } +} diff --git a/suixinkanTests/DroneDockLiveGeometryTests.swift b/suixinkanTests/DroneDockLiveGeometryTests.swift new file mode 100644 index 0000000..bc394d0 --- /dev/null +++ b/suixinkanTests/DroneDockLiveGeometryTests.swift @@ -0,0 +1,246 @@ +import UIKit +import VolcEngineRTC +import XCTest +@testable import suixinkan + +/// 图传几何诊断仅使用内存接收器和播放器,验证日志不能改变播放或网络行为。 +@MainActor +final class DroneDockLiveGeometryTests: XCTestCase { + /// 帧宽高及旋转保留 SDK 原值,缺失信息为 null,便于与实际画布比例对照。 + func testDiagnosticPayloadPreservesRawRotationAndUnknownFrame() throws { + let value = geometry(frame: .init(width: 720, height: 1280, rotation: 90)) + let fields = value.diagnosticFields + XCTAssertEqual(fields["frame_w"] as? Int, 720) + XCTAssertEqual(fields["frame_h"] as? Int, 1280) + XCTAssertEqual(fields["rotation"] as? Int, 90) + XCTAssertEqual(fields["rotation_unit"] as? String, "degree") + XCTAssertEqual(fields["frame_unit"] as? String, "px") + XCTAssertEqual(fields["container_unit"] as? String, "pt") + XCTAssertEqual(fields["container_w"] as? Double, 390) + XCTAssertEqual(fields["container_h"] as? Double, 219.375) + XCTAssertEqual(fields["render_mode"] as? String, "fit") + XCTAssertTrue(JSONSerialization.isValidJSONObject(fields)) + let unknown = geometry(frame: nil).diagnosticFields + for key in ["frame_w", "frame_h", "rotation", "sdk_version"] { + XCTAssertTrue(unknown[key] is NSNull, key) + } + XCTAssertTrue(JSONSerialization.isValidJSONObject(unknown)) + } + + /// 重复首帧及相同尺寸不重复输出,真正尺寸变化只更新诊断,不重新订阅或切流。 + func testFirstFrameAndSizeChangesAreDeduplicatedWithoutChangingSubscriptions() async throws { + let engine = GeometryEngineProbe() + let receiver = DroneDockLiveReceiver(makeEngine: { _, _ in engine }) + let view = UIView(frame: CGRect(x: 0, y: 0, width: 390, height: 219.375)) + var geometries: [DroneDockLiveGeometry] = [] + var playback: [DroneDockLivePlaybackEvent] = [] + receiver.setGeometryHandler { geometries.append($0) } + receiver.start([configuration("airport")], in: view) { playback.append($0) } + defer { receiver.stop() } + let room = try XCTUnwrap(engine.rooms["airport-room"]) + room.emit(.published("airport-stream", "airport-room", true)) + await drain() + let frame = DroneDockVideoFrameGeometry(width: 1920, height: 1080, rotation: 0) + room.emit(.frame("airport-stream", "airport-room", frame)) + await drain() + XCTAssertEqual(geometries.map(\.trigger), ["first_frame", "source_changed"]) + let shown = try XCTUnwrap(geometries.last) + XCTAssertEqual(shown.role, "airport") + XCTAssertEqual(shown.roomID, "airport-room") + XCTAssertEqual(shown.streamID, "airport-stream") + XCTAssertEqual(shown.frame, frame) + XCTAssertEqual(shown.sdkVersion, "TEST-SDK") + XCTAssertEqual(shown.containerWidth, 390) + XCTAssertEqual(shown.containerHeight, 219.375) + XCTAssertEqual(shown.hostWidth, 390) + XCTAssertTrue(shown.isSelected) + for _ in 0..<5 { + room.emit(.frame("airport-stream", "airport-room", frame)) + room.emit(.videoSizeChanged("airport-stream", "airport-room", frame)) + } + await drain() + XCTAssertEqual(geometries.count, 2) + let rotated = DroneDockVideoFrameGeometry(width: 720, height: 1280, rotation: 90) + room.emit(.videoSizeChanged("airport-stream", "airport-room", rotated)) + await drain() + XCTAssertEqual(geometries.last?.trigger, "video_size_changed") + XCTAssertEqual(geometries.last?.frame, rotated) + XCTAssertEqual(geometries.count, 3) + XCTAssertEqual(playback, [.sourceChanged("airport")]) + XCTAssertEqual(room.subscriptions, ["airport-stream:true"]) + XCTAssertEqual(engine.bindings, ["airport-stream"]) + XCTAssertEqual(view.bounds.size, CGSize(width: 390, height: 219.375)) + XCTAssertEqual(view.subviews.first?.bounds.size, view.bounds.size) + } + + /// 尺寸回调不是首帧证据,不能提前开放另一房间或将页面变成正在播放。 + func testSizeCallbackCannotStartPlaybackOrConnectSecondSource() async throws { + let engine = GeometryEngineProbe() + let receiver = DroneDockLiveReceiver(makeEngine: { _, _ in engine }) + let view = UIView(frame: CGRect(x: 0, y: 0, width: 390, height: 219.375)) + var geometries: [DroneDockLiveGeometry] = [] + var playback: [DroneDockLivePlaybackEvent] = [] + receiver.setGeometryHandler { geometries.append($0) } + receiver.start([configuration("airport"), configuration("drone")], in: view) { playback.append($0) } + defer { receiver.stop() } + let room = try XCTUnwrap(engine.rooms["airport-room"]) + room.emit(.published("airport-stream", "airport-room", true)) + await drain() + room.emit(.videoSizeChanged("airport-stream", "airport-room", .init(width: 1440, height: 1080, rotation: 0))) + await drain() + XCTAssertEqual(geometries.map(\.trigger), ["video_size_changed"]) + XCTAssertFalse(try XCTUnwrap(geometries.first).isSelected) + XCTAssertTrue(playback.isEmpty) + XCTAssertNil(engine.rooms["drone-room"]) + XCTAssertEqual(engine.bindings, ["airport-stream"]) + } + + /// 两路尺寸各自保存;错误身份和已释放会话的迟到回调不能污染日志,回退使用机巢尺寸。 + func testSourceSwitchFallbackAndStaleIdentityKeepIndependentGeometry() async throws { + let engine = GeometryEngineProbe() + let receiver = DroneDockLiveReceiver(makeEngine: { _, _ in engine }) + let view = UIView(frame: CGRect(x: 0, y: 0, width: 390, height: 219.375)) + var geometries: [DroneDockLiveGeometry] = [] + receiver.setGeometryHandler { geometries.append($0) } + receiver.start([configuration("airport"), configuration("drone")], in: view) { _ in } + defer { receiver.stop() } + let airport = try XCTUnwrap(engine.rooms["airport-room"]) + let airportFrame = DroneDockVideoFrameGeometry(width: 1920, height: 1080, rotation: 0) + airport.emit(.published("airport-stream", "airport-room", true)) + await drain() + airport.emit(.frame("airport-stream", "airport-room", airportFrame)) + await drain() + let drone = try XCTUnwrap(engine.rooms["drone-room"]) + drone.emit(.published("drone-stream", "drone-room", true)) + await drain() + let droneFrame = DroneDockVideoFrameGeometry(width: 1440, height: 1080, rotation: 0) + drone.emit(.frame("wrong-stream", "drone-room", droneFrame)) + drone.emit(.videoSizeChanged("drone-stream", "wrong-room", droneFrame)) + await drain() + XCTAssertEqual(geometries.count, 2) + drone.emit(.frame("drone-stream", "drone-room", droneFrame)) + await drain() + XCTAssertEqual(geometries.last?.role, "drone") + XCTAssertEqual(geometries.last?.frame, droneFrame) + drone.emit(.videoState("drone-stream", "drone-room", .frozen)) + await drain() + XCTAssertEqual(geometries.last?.trigger, "source_changed") + XCTAssertEqual(geometries.last?.role, "airport") + XCTAssertEqual(geometries.last?.frame, airportFrame) + receiver.stop() + let count = geometries.count + drone.emit(.frame("drone-stream", "drone-room", droneFrame)) + airport.emit(.videoSizeChanged("airport-stream", "airport-room", droneFrame)) + await drain() + XCTAssertEqual(geometries.count, count) + XCTAssertEqual(engine.destroyCount, 1) + } + + /// 诊断回调沿用当前任务会话,离页和重新进入后的旧回调均被丢弃,不能触发播放或新请求。 + func testViewForwardsOnlyCurrentSessionGeometryWithoutChangingPlayback() async throws { + let context = DroneDockShootingTaskTestData.context() + let service = GeometryParameterProbe(response: try DroneDockRTCFixture.response()) + let model = DroneDockLiveViewModel(context: context, taskID: 501, service: service, + allowsDevicePlayback: true, now: { DroneDockRTCFixture.now }, currentContext: { context }) + await model.refresh() + let player = GeometryPlayerProbe() + let view = DroneDockTaskLiveView(rtcPlayer: player) + var records: [[String: Any]] = [] + view.onDiagnosticEvent = { event, fields in if event == "live.geometry" { records.append(fields) } } + view.apply(model) + view.setPlaybackActive(true) + let oldHandler = try XCTUnwrap(player.geometryHandler) + oldHandler(geometry(frame: .init(width: 1440, height: 1080, rotation: 0))) + XCTAssertEqual(records.count, 1) + XCTAssertEqual(records.first?["receiver_session"] as? String, model.playbackSessionID?.uuidString) + XCTAssertEqual(model.state, .connecting) + XCTAssertEqual(player.starts, 1) + XCTAssertEqual(service.calls, 1) + view.setPlaybackActive(false) + oldHandler(geometry(frame: nil)) + XCTAssertEqual(records.count, 1) + XCTAssertNil(player.geometryHandler) + model.invalidate() + await model.refresh() + view.apply(model) + view.setPlaybackActive(true) + oldHandler(geometry(frame: nil)) + XCTAssertEqual(records.count, 1) + try XCTUnwrap(player.geometryHandler)(geometry(frame: .init(width: 1920, height: 1080, rotation: 0))) + XCTAssertEqual(records.count, 2) + XCTAssertNotEqual(records.first?["receiver_session"] as? String, records.last?["receiver_session"] as? String) + XCTAssertEqual(model.state, .connecting) + XCTAssertEqual(player.starts, 2) + XCTAssertEqual(service.calls, 2) + view.setPlaybackActive(false) + } + + /// 尺寸回调是 SDK optional Objective-C 方法,必须确实注册才能收到旋转或分辨率变化。 + func testSDKSizeChangeDelegateSelectorIsRegistered() { + let delegate = DroneDockVolcDelegate { _ in } + XCTAssertTrue(delegate.responds(to: NSSelectorFromString("rtcEngine:onRemoteVideoSizeChanged:info:withFrameInfo:"))) + } + + private func configuration(_ role: String) -> DroneDockVolcLiveConfiguration { + .init(appID: "TEST", roomID: "\(role)-room", userID: "viewer", token: "TEST", + expiresAt: Date().addingTimeInterval(3600), role: role) + } + + private func geometry(frame: DroneDockVideoFrameGeometry?) -> DroneDockLiveGeometry { + .init(trigger: "first_frame", role: "drone", roomID: "TEST-room", streamID: "TEST-stream", frame: frame, + containerWidth: 390, containerHeight: 219.375, hostWidth: 390, hostHeight: 219.375, + isSelected: true, sdkVersion: nil) + } + + private func drain() async { for _ in 0..<20 { await Task.yield() } } +} + +/// 无 SDK 引擎,只记录绑定与房间创建次数。 +@MainActor +private final class GeometryEngineProbe: DroneDockRTCReceivingEngine { + let sdkVersion: String? = "TEST-SDK" + var rooms: [String: GeometryRoomProbe] = [:] + var bindings: [String] = [] + var destroyCount = 0 + func makeRoom(_ id: String, onEvent: @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingRoom)? { + let room = GeometryRoomProbe(emit: onEvent) + rooms[id] = room + return room + } + func setVideoView(_ view: UIView?, streamID: String) -> Int { bindings.append(streamID); return 0 } + func destroy() { destroyCount += 1 } +} + +/// 所有事件由测试主动发送,不访问网络或设备。 +@MainActor +private final class GeometryRoomProbe: DroneDockRTCReceivingRoom { + let emit: @Sendable (DroneDockVolcEvent) -> Void + var subscriptions: [String] = [] + init(emit: @escaping @Sendable (DroneDockVolcEvent) -> Void) { self.emit = emit } + func join(_ configuration: DroneDockVolcLiveConfiguration) -> Int { 0 } + func updateToken(_ token: String) -> Int { 0 } + func subscribeVideo(_ streamID: String, subscribe: Bool) -> Int { + subscriptions.append("\(streamID):\(subscribe)"); return 0 + } + func destroy() {} +} + +/// 几何和播放回调分离的无网络播放器。 +@MainActor +private final class GeometryPlayerProbe: DroneDockLivePlaying { + var starts = 0 + var geometryHandler: (@MainActor (DroneDockLiveGeometry) -> Void)? + func setGeometryHandler(_ handler: (@MainActor (DroneDockLiveGeometry) -> Void)?) { geometryHandler = handler } + func start(_ configurations: [DroneDockVolcLiveConfiguration], in view: UIView, + onEvent: @escaping @MainActor (DroneDockLivePlaybackEvent) -> Void) { starts += 1 } + func stop() {} +} + +/// 参数查询计数替身,验证诊断不会引入额外接口读取。 +@MainActor +private final class GeometryParameterProbe: DroneDockLiveServing { + let response: DroneDockLiveResponse + var calls = 0 + init(response: DroneDockLiveResponse) { self.response = response } + func live(taskID: Int) async throws -> DroneDockLiveResponse { calls += 1; return response } +} diff --git a/suixinkanTests/DroneDockLiveReceiverTests.swift b/suixinkanTests/DroneDockLiveReceiverTests.swift new file mode 100644 index 0000000..33e2f40 --- /dev/null +++ b/suixinkanTests/DroneDockLiveReceiverTests.swift @@ -0,0 +1,123 @@ +import UIKit +import XCTest +@preconcurrency import VolcEngineRTC +@testable import suixinkan + +/// 直接驱动生产接收器的房间与首帧流程,SDK 边界全部使用无网络替身。 +@MainActor +final class DroneDockLiveReceiverTests: XCTestCase { + /// 首帧晚于原 20 秒窗口时仍可订阅;超时开放第二路,不销毁第一路。 + func testLatePublicationAfterTimeoutStillPlaysAndFallsBack() async throws { + let engine = ReceiverEngineProbe() + let receiver = DroneDockLiveReceiver(makeEngine: { _, _ in engine }, firstFrameDelay: { try await Task.sleep(for: .milliseconds(10)) }) + let view = UIView(frame: CGRect(x: 0, y: 0, width: 390, height: 220)) + var events: [DroneDockLivePlaybackEvent] = [] + receiver.start([configuration("airport"), configuration("drone")], in: view) { events.append($0) } + defer { receiver.stop() } + XCTAssertEqual(engine.rooms.count, 1) + try await Task.sleep(for: .milliseconds(80)) + XCTAssertEqual(engine.rooms.count, 2) + XCTAssertEqual(engine.destroyCount, 0) + XCTAssertTrue(events.isEmpty, "无首帧不能上报致命失败或假装正在播放") + let airport = try XCTUnwrap(engine.rooms["airport-room"]) + let drone = try XCTUnwrap(engine.rooms["drone-room"]) + airport.emit(.published("airport-video", "airport-room", true)) + try await settle() + XCTAssertEqual(airport.subscriptions, ["airport-video:true"]) + airport.emit(.frame("airport-video", "airport-room")) + try await settle() + XCTAssertEqual(events.last, .sourceChanged("airport")) + drone.emit(.published("drone-video", "drone-room", true)) + try await settle() + XCTAssertEqual(events.last, .sourceChanged("airport"), "凭证或发布成功不能提前切走机巢画面") + drone.emit(.frame("drone-video", "drone-room")) + try await settle() + XCTAssertEqual(events.last, .sourceChanged("drone")) + drone.emit(.videoState("drone-video", "drone-room", .frozen)) + try await settle() + XCTAssertEqual(events.last, .sourceChanged("airport")) + receiver.stop() + let count = events.count + drone.emit(.frame("drone-video", "drone-room")) + try await settle() + XCTAssertEqual(events.count, count) + XCTAssertEqual(airport.destroyCount, 1) + XCTAssertEqual(drone.destroyCount, 1) + XCTAssertEqual(engine.destroyCount, 1) + } + + /// 缺少无人机参数时机巢继续等待,补取参数后仍可接入第二路。 + func testSingleSourceTimeoutDoesNotCancelFutureDiscovery() async throws { + let engine = ReceiverEngineProbe() + let receiver = DroneDockLiveReceiver(makeEngine: { _, _ in engine }, firstFrameDelay: { try await Task.sleep(for: .milliseconds(10)) }) + let view = UIView() + var events: [DroneDockLivePlaybackEvent] = [] + receiver.start([configuration("airport")], in: view) { events.append($0) } + try await Task.sleep(for: .milliseconds(60)) + XCTAssertEqual(engine.destroyCount, 0) + XCTAssertTrue(events.isEmpty) + receiver.start([configuration("airport"), configuration("drone")], in: view) { events.append($0) } + XCTAssertEqual(engine.rooms.count, 2) + receiver.stop() + } + + /// SDK 入房错误保留数值供用户定位;纯等待与错误不混为一谈。 + func testRoomFailureShowsActualSDKCode() async throws { + let engine = ReceiverEngineProbe() + let receiver = DroneDockLiveReceiver(makeEngine: { _, _ in engine }) + var events: [DroneDockLivePlaybackEvent] = [] + let view = UIView() + receiver.start([configuration("drone")], in: view) { events.append($0) } + engine.rooms["drone-room"]?.emit(.roomFailed("drone-room", -1000)) + try await settle() + XCTAssertEqual(events.last, .failed("图传入房失败(-1000),请重试")) + XCTAssertEqual(engine.destroyCount, 1) + } + + /// 验证 optional Objective-C 回调确实注册,防止 Swift 方法仅编译通过却不被 SDK 调用。 + func testSDKDelegateSelectorsAreRegisteredWithoutInitializingEngine() { + let delegate = DroneDockVolcDelegate { _ in } + for selector in ["rtcRoom:onUserPublishStreamVideo:info:isPublish:", "rtcRoom:onRoomStateChanged:withUid:state:extraInfo:", + "rtcEngine:onFirstRemoteVideoFrameDecoded:info:withFrameInfo:", + "rtcEngine:onRemoteVideoStateChanged:info:withVideoState:withVideoStateReason:"] { + XCTAssertTrue(delegate.responds(to: NSSelectorFromString(selector)), selector) + } + } + + private func configuration(_ role: String) -> DroneDockVolcLiveConfiguration { + DroneDockVolcLiveConfiguration(appID: "TEST", roomID: "\(role)-room", userID: "viewer", token: "TEST", + expiresAt: Date().addingTimeInterval(3600), role: role) + } + + private func settle() async throws { try await Task.sleep(for: .milliseconds(25)) } +} + +/// 无 SDK 引擎;只记录画布绑定和房间创建。 +@MainActor +private final class ReceiverEngineProbe: DroneDockRTCReceivingEngine { + var rooms: [String: ReceiverRoomProbe] = [:] + var destroyCount = 0 + func makeRoom(_ id: String, onEvent: @escaping @Sendable (DroneDockVolcEvent) -> Void) -> (any DroneDockRTCReceivingRoom)? { + let room = ReceiverRoomProbe(emit: onEvent) + rooms[id] = room + return room + } + func setVideoView(_ view: UIView?, streamID: String) -> Int { 0 } + func destroy() { destroyCount += 1 } +} + +/// 无网络房间;回调由测试主动发送。 +@MainActor +private final class ReceiverRoomProbe: DroneDockRTCReceivingRoom { + let emit: @Sendable (DroneDockVolcEvent) -> Void + var subscriptions: [String] = [] + var destroyCount = 0 + init(emit: @escaping @Sendable (DroneDockVolcEvent) -> Void) { self.emit = emit } + func join(_ configuration: DroneDockVolcLiveConfiguration) -> Int { 0 } + func updateToken(_ token: String) -> Int { 0 } + func subscribeVideo(_ streamID: String, subscribe: Bool) -> Int { + subscriptions.append("\(streamID):\(subscribe)") + return 0 + } + func destroy() { destroyCount += 1 } +} diff --git a/suixinkanTests/DroneDockLiveViewModelTests.swift b/suixinkanTests/DroneDockLiveViewModelTests.swift new file mode 100644 index 0000000..89ef63b --- /dev/null +++ b/suixinkanTests/DroneDockLiveViewModelTests.swift @@ -0,0 +1,220 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证图传参数不足、显式本地来源与生命周期;测试不访问网络或播放器。 +@MainActor +final class DroneDockLiveViewModelTests: XCTestCase { + /// 未注入服务时保持不可用状态,调用刷新也不会变为可播放。 + func testMissingServiceRemainsUnavailable() async { + let model = makeModel() + await model.refresh() + XCTAssertEqual(model.state, .unavailable("当前页面未配置图传服务")) + XCTAssertEqual(model.title, "图传暂不可用") + XCTAssertFalse(model.canLoad) + XCTAssertNil(model.playbackURL) + XCTAssertNil(model.response) + } + + /// 文档回执本身不含播放参数,GET 成功仍显示参数未提供。 + func testDocumentResponseDoesNotPretendVideoIsConnected() async throws { + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response())) + let model = makeModel(service: service) + await model.refresh() + XCTAssertEqual(model.state, .unavailable("暂未提供图传播放参数")) + XCTAssertNil(model.playbackURL) + XCTAssertEqual(model.response?.orderFlightTaskID, 501) + XCTAssertEqual(service.requests, [501]) + } + + /// 后端未知字段即使看起来像播放地址,也不能开启未约定的流媒体连接。 + func testUnspecifiedPlaybackFieldIsIgnored() async throws { + var fields = DroneDockLiveTestData.payload() + fields["play_url"] = "https://example.invalid/stream.m3u8" + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response(fields))) + let model = makeModel(service: service) + await model.refresh() + XCTAssertNil(model.playbackURL) + XCTAssertEqual(model.state, .unavailable("暂未提供图传播放参数")) + } + + /// 显式注入的本地文件与设备回执分离,界面始终标明模拟来源。 + func testExplicitLocalFileEnablesOnlyMarkedSimulation() async throws { + let file = try localFixture() + defer { try? FileManager.default.removeItem(at: file) } + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response())) + let model = makeModel(service: service, file: file) + await model.refresh() + XCTAssertEqual(model.state, .localPreview(file)) + XCTAssertEqual(model.playbackURL, file) + XCTAssertEqual(model.title, "本地模拟画面") + XCTAssertTrue(model.message.contains("未连接无人机")) + model.invalidate() + XCTAssertNil(model.playbackURL) + XCTAssertNil(model.response) + XCTAssertEqual(model.state, .idle) + } + + /// 模拟注入也拒绝远程地址与不存在的文件,不能通过假模拟连接设备或外网。 + func testRemoteAndMissingLocalPreviewAreRejected() async throws { + for file in [URL(string: "https://example.invalid/live.mp4")!, + FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)] { + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response())) + let model = makeModel(service: service, file: file) + await model.refresh() + XCTAssertEqual(model.state, .failed("本地模拟视频不可用")) + XCTAssertNil(model.playbackURL) + } + } + + /// 没有已锁定机场时,不因注入了本地样片就跳过合同前置条件。 + func testMissingLockedAirportDoesNotBecomeSimulationSuccess() async throws { + let file = try localFixture() + defer { try? FileManager.default.removeItem(at: file) } + var fields = DroneDockLiveTestData.payload() + fields["airport_sn"] = NSNull() + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response(fields))) + let model = makeModel(service: service, file: file) + await model.refresh() + XCTAssertEqual(model.state, .unavailable("当前任务尚未返回已锁定的机场信息")) + XCTAssertNil(model.playbackURL) + } + + /// 纯内存服务也必须匹配任务和景区,不能绕过 API 适配层的身份校验。 + func testMismatchedTaskOrScenicIsRejected() async throws { + for change: [String: Any] in [["order_flight_task_id": 502], ["task": ["id": 501, "scenic_id": 129]]] { + let fields = DroneDockLiveTestData.payload().merging(change) { _, new in new } + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response(fields))) + let model = makeModel(service: service) + await model.refresh() + XCTAssertNil(model.response) + XCTAssertNil(model.playbackURL) + guard case .failed = model.state else { return XCTFail("不一致回执应失败") } + } + } + + /// 进行中重复点击不重复请求,加载开始回调可以同步刷新按钮状态。 + func testInFlightRequestIsExclusiveAndNotifiesLoadingOnce() async throws { + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response()), suspended: true) + let model = makeModel(service: service) + var starts = 0 + let pending = Task { @MainActor in + await model.refresh { starts += 1; XCTAssertTrue(model.isLoading); XCTAssertFalse(model.canLoad) } + } + await waitForRequest(service) + await model.refresh { starts += 1 } + XCTAssertEqual(service.requests, [501]) + XCTAssertEqual(starts, 1) + service.finish() + await pending.value + XCTAssertFalse(model.isLoading) + XCTAssertTrue(model.canLoad) + } + + /// 离页后迟到成功响应不能重建已释放的播放来源。 + func testInvalidationDiscardsLateResponse() async throws { + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response()), suspended: true) + let model = makeModel(service: service) + let pending = Task { @MainActor in await model.refresh() } + await waitForRequest(service) + model.invalidate() + service.finish() + await pending.value + XCTAssertEqual(model.state, .idle) + XCTAssertNil(model.response) + XCTAssertNil(model.playbackURL) + } + + /// 登录或景区切换后旧任务永久停用,不能用同一页面重试新身份的请求。 + func testIdentityChangeInvalidatesOldPage() async throws { + let scope = LiveContextTestBox() + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response()), suspended: true) + let model = DroneDockLiveViewModel(context: scope.value, taskID: 501, service: service, currentContext: { scope.value }) + let pending = Task { @MainActor in await model.refresh() } + await waitForRequest(service) + scope.value = DroneDockShootingTaskTestData.context(scenicID: 129) + service.finish() + await pending.value + XCTAssertFalse(model.canLoad) + XCTAssertNil(model.response) + XCTAssertEqual(model.state, .failed("账号或景区已变化,请返回工作台重新进入")) + await model.refresh() + XCTAssertEqual(service.requests, [501]) + } + + /// 请求取消不残留正在加载状态,迟到响应也不能显示成功。 + func testCancellationDiscardsLateSuccess() async throws { + let service = LiveParameterTestService(result: .success(try DroneDockLiveTestData.response()), suspended: true) + let model = makeModel(service: service) + let pending = Task { @MainActor in await model.refresh() } + await waitForRequest(service) + pending.cancel() + service.finish() + await pending.value + XCTAssertEqual(model.state, .idle) + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.response) + } + + /// 超时只展示失败,由用户显式重试同一任务,没有后台自动重试。 + func testTimeoutRequiresExplicitRetry() async throws { + let service = LiveParameterTestService(result: .failure(URLError(.timedOut))) + let model = makeModel(service: service) + await model.refresh() + guard case .failed = model.state else { return XCTFail("超时应展示失败") } + XCTAssertEqual(service.requests, [501]) + service.result = .success(try DroneDockLiveTestData.response()) + await model.refresh() + XCTAssertEqual(service.requests, [501, 501]) + XCTAssertEqual(model.state, .unavailable("暂未提供图传播放参数")) + } + + private func makeModel(service: (any DroneDockLiveServing)? = nil, file: URL? = nil) -> DroneDockLiveViewModel { + let context = DroneDockShootingTaskTestData.context() + return DroneDockLiveViewModel(context: context, taskID: 501, service: service, localPreviewURL: file, + currentContext: { context }) + } + + private func localFixture() throws -> URL { + let url = FileManager.default.temporaryDirectory.appendingPathComponent("\(UUID().uuidString).mp4") + // ViewModel 只检查本地来源;这里不启动播放器,不把该测试字节当作可播放的视频。 + try Data("local-fixture".utf8).write(to: url) + return url + } + + private func waitForRequest(_ service: LiveParameterTestService) async { + for _ in 0..<100 where service.requests.isEmpty { await Task.yield() } + XCTAssertFalse(service.requests.isEmpty) + } +} + +/// 可暂停的图传参数替身,用于验证重复点击和离页后迟到回执。 +@MainActor +private final class LiveParameterTestService: DroneDockLiveServing { + var result: Result + private(set) var requests: [Int] = [] + private let suspended: Bool + private var continuation: CheckedContinuation? + + /// 配置纯内存结果,可暂停直到测试明确释放。 + init(result: Result, suspended: Bool = false) { + self.result = result + self.suspended = suspended + } + + /// 记录同一任务读取,不提供实际网络传输能力。 + func live(taskID: Int) async throws -> DroneDockLiveResponse { + requests.append(taskID) + if suspended { await withCheckedContinuation { continuation = $0 } } + return try result.get() + } + + /// 手动完成挂起请求,可模拟取消之后仍收到旧响应。 + func finish() { continuation?.resume(); continuation = nil } +} + +/// 允许主 Actor 测试显式切换当前身份,避免捕获可并发修改的局部变量。 +@MainActor +private final class LiveContextTestBox { + var value = DroneDockShootingTaskTestData.context() +} diff --git a/suixinkanTests/DroneDockMaterialDownloadViewModelTests.swift b/suixinkanTests/DroneDockMaterialDownloadViewModelTests.swift new file mode 100644 index 0000000..1579d02 --- /dev/null +++ b/suixinkanTests/DroneDockMaterialDownloadViewModelTests.swift @@ -0,0 +1,270 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 订单原素材批次使用隔离下载与相册替身验证,不访问网络或设备。 +@MainActor +final class DroneDockMaterialDownloadViewModelTests: XCTestCase { + /// 相册保存完成前只显示下载进度;重复选择去重,图片与视频类型原样传给保存器。 + func testCompletionWaitsForPhotoSaveAndDeduplicatesSelection() async { + let downloader = OrderMaterialDownloadStub() + let saver = OrderMaterialPhotoStub(suspendFirst: true) + let model = makeModel(downloader, saver) + XCTAssertTrue(model.start(items: [item("image", type: 0), item("image", type: 0), item("video")])) + await saver.waitForStart() + for _ in 0..<20 where model.progress == 0 { await Task.yield() } + XCTAssertEqual(model.totalCount, 2) + XCTAssertEqual(model.completedCount, 0) + XCTAssertEqual(model.phase, .downloading) + XCTAssertEqual(model.progress, 0.45, accuracy: 0.001) + XCTAssertFalse(model.start(items: [item("unselected")])) + + await saver.finishSave() + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .finished) + XCTAssertEqual(model.completedCount, 2) + XCTAssertEqual(model.failedCount, 0) + XCTAssertEqual(model.progress, 1) + let types = await saver.fileTypes + XCTAssertEqual(types, [0, 1]) + let calls = await downloader.names + XCTAssertEqual(calls, ["image.jpg", "video.mp4"]) + let files = await downloader.files + XCTAssertTrue(files.allSatisfy { !FileManager.default.fileExists(atPath: $0.path) }) + } + + /// 一项下载失败不会保存错误文件;重试仅处理失败项并保留成功项目。 + func testRetryOnlyDownloadsFailedItemsAndPreservesSpecificError() async { + let downloader = OrderMaterialDownloadStub(failOnce: ["bad.mp4"]) + let saver = OrderMaterialPhotoStub() + let model = makeModel(downloader, saver) + model.start(items: [item("good"), item("bad")]) + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .finished) + XCTAssertEqual(model.completedCount, 1) + XCTAssertEqual(model.failedCount, 1) + XCTAssertEqual(model.lastErrorMessage, "素材下载失败(HTTP 403)") + XCTAssertTrue(model.retryFailed()) + await model.waitForPendingOperations() + + XCTAssertEqual(model.completedCount, 2) + XCTAssertEqual(model.failedCount, 0) + XCTAssertNil(model.lastErrorMessage) + let calls = await downloader.names + let saves = await saver.fileTypes + XCTAssertEqual(calls, ["good.mp4", "bad.mp4", "bad.mp4"]) + XCTAssertEqual(saves.count, 2) + } + + /// 权限拒绝停止后续下载,显示真实失败并允许授权后重试全部未保存项目。 + func testPermissionDenialStopsRemainingItemsAndCanRetry() async { + let downloader = OrderMaterialDownloadStub() + let saver = OrderMaterialPhotoStub(permissionFailures: 1) + let model = makeModel(downloader, saver) + model.start(items: [item("first"), item("second")]) + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .finished) + XCTAssertTrue(model.permissionDenied) + XCTAssertEqual(model.failedCount, 2) + XCTAssertEqual(model.completedCount, 0) + XCTAssertNotNil(model.lastErrorMessage) + let beforeRetry = await downloader.names + XCTAssertEqual(beforeRetry, ["first.mp4"]) + + XCTAssertTrue(model.retryFailed()) + await model.waitForPendingOperations() + + XCTAssertFalse(model.permissionDenied) + XCTAssertEqual(model.completedCount, 2) + XCTAssertEqual(model.failedCount, 0) + } + + /// 在不可取消的 Photos 事务期间暂停再继续,不重复下载或创建同一资产。 + func testPauseAndResumeWaitForSubmittedPhotoTransaction() async { + let downloader = OrderMaterialDownloadStub() + let saver = OrderMaterialPhotoStub(suspendFirst: true) + let model = makeModel(downloader, saver) + model.start(items: [item("video")]) + await saver.waitForStart() + model.pause() + XCTAssertEqual(model.phase, .paused) + XCTAssertFalse(model.start(items: [item("other")])) + XCTAssertTrue(model.resume()) + await saver.finishSave() + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .finished) + XCTAssertEqual(model.completedCount, 1) + let calls = await downloader.names + let saves = await saver.fileTypes + XCTAssertEqual(calls.count, 1) + XCTAssertEqual(saves.count, 1) + } + + /// 下载器在取消后返回文件也不能保存或恢复已取消的界面状态。 + func testCancelRejectsLateDownloadAndCleansTemporaryFile() async { + let downloader = OrderMaterialDownloadStub(suspendFirst: true) + let saver = OrderMaterialPhotoStub() + let model = makeModel(downloader, saver) + model.start(items: [item("old")]) + await downloader.waitForStart() + model.cancel() + await downloader.finishDownload() + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .idle) + XCTAssertEqual(model.totalCount, 0) + XCTAssertEqual(model.completedCount, 0) + let saves = await saver.fileTypes + let files = await downloader.files + XCTAssertTrue(saves.isEmpty) + XCTAssertTrue(files.allSatisfy { !FileManager.default.fileExists(atPath: $0.path) }) + } + + /// 账号范围失效时拒绝开始,不触发下载或相册保存。 + func testInvalidContextPreventsStart() async { + let downloader = OrderMaterialDownloadStub() + let saver = OrderMaterialPhotoStub() + let model = makeModel(downloader, saver, isContextValid: { false }) + XCTAssertFalse(model.start(items: [item("video")])) + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .idle) + XCTAssertEqual(model.totalCount, 0) + XCTAssertEqual(model.lastErrorMessage, "账号或景区已变化,请返回工作台重新进入") + let calls = await downloader.names + XCTAssertTrue(calls.isEmpty) + } + + /// 账号在已提交保存期间变化时清空批次,后续项目不再下载,旧回执不能回写。 + func testContextChangeDuringSaveClearsBatchAndStopsNextItem() async { + let downloader = OrderMaterialDownloadStub() + let saver = OrderMaterialPhotoStub(suspendFirst: true) + let scope = OrderMaterialDownloadScope() + let model = makeModel(downloader, saver, isContextValid: { scope.valid }) + model.start(items: [item("first"), item("second")]) + await saver.waitForStart() + scope.valid = false + await saver.finishSave() + await model.waitForPendingOperations() + + XCTAssertEqual(model.phase, .idle) + XCTAssertEqual(model.totalCount, 0) + XCTAssertEqual(model.completedCount, 0) + XCTAssertNotNil(model.lastErrorMessage) + let calls = await downloader.names + XCTAssertEqual(calls, ["first.mp4"]) + } + + /// 新批次重复选择本页已保存的原素材时同步成功事实,不重复写入相册。 + func testNewSelectionDoesNotSaveCompletedMaterialTwice() async { + let downloader = OrderMaterialDownloadStub() + let saver = OrderMaterialPhotoStub() + let model = makeModel(downloader, saver) + model.start(items: [item("first")]) + await model.waitForPendingOperations() + model.cancel() + XCTAssertTrue(model.start(items: [item("first"), item("second")])) + await model.waitForPendingOperations() + + XCTAssertEqual(model.completedCount, 2) + let calls = await downloader.names + let saves = await saver.fileTypes + XCTAssertEqual(calls, ["first.mp4", "second.mp4"]) + XCTAssertEqual(saves.count, 2) + } + + private func item(_ id: String, type: Int = 1) -> ScenicMaterialDownloadItem { + let name = "\(id).\(type == 1 ? "mp4" : "jpg")" + return ScenicMaterialDownloadItem(id: id, remoteURL: URL(string: "https://example.com/\(name)")!, + fileName: name, fileType: type) + } + + private func makeModel(_ downloader: OrderMaterialDownloadStub, _ saver: OrderMaterialPhotoStub, + isContextValid: @escaping @MainActor () -> Bool = { true }) -> DroneDockMaterialDownloadViewModel { + DroneDockMaterialDownloadViewModel(service: ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver), + isContextValid: isContextValid) + } +} + +/// 可切换的会话校验替身,不读取应用真实账号。 +@MainActor +private final class OrderMaterialDownloadScope { var valid = true } + +/// 文件下载替身支持单次失败、迟到响应和真实临时文件清理验证。 +private actor OrderMaterialDownloadStub: CloudFileDownloading { + private var failOnce: Set + private let suspendFirst: Bool + private var continuation: CheckedContinuation? + private var startWaiter: CheckedContinuation? + private(set) var names: [String] = [] + private(set) var files: [URL] = [] + + init(failOnce: Set = [], suspendFirst: Bool = false) { + self.failOnce = failOnce + self.suspendFirst = suspendFirst + } + + func downloadFile(remoteURL: String, fileName: String, onProgress: @escaping @Sendable (Int) -> Void) async throws -> URL { + names.append(fileName) + if failOnce.remove(fileName) != nil { throw ScenicMaterialDownloadError.httpFailure(403) } + if suspendFirst, names.count == 1 { + await withCheckedContinuation { continuation in + self.continuation = continuation + self.startWaiter?.resume() + self.startWaiter = nil + } + } + let url = FileManager.default.temporaryDirectory.appendingPathComponent("order-material-\(UUID().uuidString)-\(fileName)") + try Data("isolated-test-media".utf8).write(to: url) + files.append(url) + onProgress(100) + return url + } + + func waitForStart() async { + if continuation != nil { return } + await withCheckedContinuation { startWaiter = $0 } + } + + func finishDownload() { continuation?.resume(); continuation = nil } +} + +/// 相册替身可模拟权限拒绝及已提交事务的不可取消窗口。 +private actor OrderMaterialPhotoStub: CloudPhotoSaving { + private var permissionFailures: Int + private let suspendFirst: Bool + private var continuation: CheckedContinuation? + private var startWaiter: CheckedContinuation? + private(set) var fileTypes: [Int] = [] + + init(permissionFailures: Int = 0, suspendFirst: Bool = false) { + self.permissionFailures = permissionFailures + self.suspendFirst = suspendFirst + } + + func saveToPhotoLibrary(fileURL: URL, fileType: Int) async throws { + fileTypes.append(fileType) + if permissionFailures > 0 { + permissionFailures -= 1 + throw CloudTransferError.photoPermissionDenied + } + if suspendFirst, fileTypes.count == 1 { + await withCheckedContinuation { continuation in + self.continuation = continuation + self.startWaiter?.resume() + self.startWaiter = nil + } + } + } + + func waitForStart() async { + if continuation != nil { return } + await withCheckedContinuation { startWaiter = $0 } + } + + func finishSave() { continuation?.resume(); continuation = nil } +} diff --git a/suixinkanTests/DroneDockMaterialsAPITests.swift b/suixinkanTests/DroneDockMaterialsAPITests.swift new file mode 100644 index 0000000..e064ed1 --- /dev/null +++ b/suixinkanTests/DroneDockMaterialsAPITests.swift @@ -0,0 +1,290 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用匿名响应验证张工素材库的请求范围、完整任务列表及媒体就绪条件。 +@MainActor +final class DroneDockMaterialsAPITests: XCTestCase { + /// 摘要只携带景区和订单,保留整单次数以及购买点位顺序。 + func testDetailReadsRootSummaryAndPurchasedSpots() async throws { + let session = MockURLSession(responses: [try envelope(Self.detail)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "materials-test-token" } + let result = try await DroneDockMaterialsAPI(client: client) + .detail(scenicID: 128, orderNumber: Self.number) + + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/orders/detail") + XCTAssertEqual(try query(request), ["scenic_id": "128", "order_number": Self.number]) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "materials-test-token") + XCTAssertNil(request.httpBody) + XCTAssertEqual(result.order.orderNumber, Self.number) + XCTAssertEqual(result.order.shotTotal, 3) + XCTAssertEqual(result.order.shotUsed, 1) + XCTAssertEqual(result.order.shotRemain, 2) + XCTAssertNil(result.order.projectID) + XCTAssertEqual(result.spots.map(\.id), [201, 202]) + XCTAssertEqual(result.spots.map(\.name), ["测试点位一", "测试点位二"]) + } + + /// 全部点位不发送筛选值,指定点位只增加 scenic_spot_id,均不分页。 + func testTaskRequestsOmitAllFilterAndNeverPaginate() async throws { + let payload = Self.tasks([Self.task]) + let session = MockURLSession(responses: [try envelope(payload), try envelope(payload)]) + let api = DroneDockMaterialsAPI(client: APIClient(environment: .testing, session: session)) + let all = try await api.tasks(scenicID: 128, orderNumber: Self.number, spotID: nil) + let filtered = try await api.tasks(scenicID: 128, orderNumber: Self.number, spotID: 201) + + XCTAssertEqual(session.requests.count, 2) + XCTAssertEqual(all, filtered) + XCTAssertEqual(all.total, 1) + XCTAssertEqual(all.list.first?.flightStatus, 10) + for (index, request) in session.requests.enumerated() { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/tasks") + var expected = ["scenic_id": "128", "order_number": Self.number] + if index == 1 { expected["scenic_spot_id"] = "201" } + XCTAssertEqual(try query(request), expected) + XCTAssertNil(request.httpBody) + } + } + + /// 不完整的页面身份和非正点位在发送请求前拒绝。 + func testInvalidScopeDoesNotRequestNetwork() async { + let session = MockURLSession(responses: []) + let api = DroneDockMaterialsAPI(client: APIClient(environment: .testing, session: session)) + for (scenicID, number) in [(0, Self.number), (-1, Self.number), (128, ""), + (128, " \n"), (128, " TEST"), (128, String(repeating: "T", count: 129))] { + do { + _ = try await api.detail(scenicID: scenicID, orderNumber: number) + XCTFail("无效身份不能读取订单摘要") + } catch {} + do { + _ = try await api.tasks(scenicID: scenicID, orderNumber: number, spotID: nil) + XCTFail("无效身份不能读取任务") + } catch {} + } + for spotID in [0, -1] { + do { + _ = try await api.tasks(scenicID: 128, orderNumber: Self.number, spotID: spotID) + XCTFail("点位必须为正整数或省略") + } catch {} + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 订单权限错误直接保留,不伪装为成功空列表。 + func testBackendPermissionErrorIsPreserved() async throws { + let failure = try TestJSON.errorEnvelope(code: 160001, msg: "该订单不属于当前景区") + let session = MockURLSession(responses: [failure, failure]) + let api = DroneDockMaterialsAPI(client: APIClient(environment: .testing, session: session)) + for readDetail in [true, false] { + do { + if readDetail { _ = try await api.detail(scenicID: 128, orderNumber: Self.number) } + else { _ = try await api.tasks(scenicID: 128, orderNumber: Self.number, spotID: nil) } + XCTFail("应显示后端权限拒绝") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "该订单不属于当前景区") + } + } + } + + /// 显式空任务和点位可展示空态,null 展示字段保留为未知。 + func testEmptyListsAndNullableDisplayFieldsAreSupported() throws { + var detail = Self.detail + detail["spot"] = [] as [Any] + XCTAssertTrue(try decode(DroneDockMaterialDetail.self, detail).spots.isEmpty) + XCTAssertEqual(try decode(DroneDockMaterialTasks.self, Self.tasks([])).total, 0) + detail["spot"] = [["scenic_spot_id": 201, "scenic_spot_name": NSNull()]] + XCTAssertEqual(try decode(DroneDockMaterialDetail.self, detail).spots.first?.name, "") + var task = Self.task + for key in ["scenic_spot_name", "air_line_name", "seq", "flight_status", "material_status", "created_at", "film"] { + task[key] = NSNull() + } + let result = try decode(DroneDockMaterialTask.self, task) + XCTAssertEqual(result.spotName, "") + XCTAssertNil(result.airLineName) + XCTAssertNil(result.sequence) + XCTAssertNil(result.flightStatus) + XCTAssertNil(result.materialStatus) + XCTAssertNil(result.createdAt) + XCTAssertNil(result.film) + XCTAssertTrue(result.materials.isEmpty) + let file = try decode(DroneDockMaterialFile.self, ["id": 801, "file_type": NSNull(), "file_url": NSNull()]) + XCTAssertNil(file.fileType) + XCTAssertNil(file.previewURL) + } + + /// 整数字符串及单独 task_id 可用,未知状态和所有有效任务原样保留。 + func testStringIntegersAliasAndUnknownFlightStatusArePreserved() throws { + var task = Self.task + task.removeValue(forKey: "id") + task["task_id"] = "501" + task["scenic_spot_id"] = "201" + task["seq"] = "2" + task["flight_status"] = "999" + task["material_status"] = "3" + task["materials"] = [["id": "801", "file_type": "2", "file_size": "2048", "upload_status": "3", + "failure_reason": "测试上传失败", "file_url": ""]] + let result = try decode(DroneDockMaterialTasks.self, ["order_number": Self.number, "total": "1", "list": [task]]) + XCTAssertEqual(result.list.first?.id, 501) + XCTAssertEqual(result.list.first?.sequence, 2) + XCTAssertEqual(result.list.first?.flightStatus, 999) + XCTAssertEqual(result.list.first?.materials.first?.fileSize, 2048) + XCTAssertEqual(result.list.first?.materials.first?.failureReason, "测试上传失败") + XCTAssertNil(result.list.first?.materials.first?.previewURL) + } + + /// 缺失、null 或错误容器不能被误判为没有点位、任务或素材。 + func testRequiredContainersAndTaskCountsAreStrict() throws { + for invalid: Any in [NSNull(), [:] as [String: Any], ""] { + var detail = Self.detail + detail["spot"] = invalid + XCTAssertThrowsError(try decode(DroneDockMaterialDetail.self, detail)) + var tasks = Self.tasks([]) + tasks["list"] = invalid + XCTAssertThrowsError(try decode(DroneDockMaterialTasks.self, tasks)) + var task = Self.task + task["materials"] = invalid + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, task)) + } + var detail = Self.detail + detail.removeValue(forKey: "spot") + XCTAssertThrowsError(try decode(DroneDockMaterialDetail.self, detail)) + var task = Self.task + task.removeValue(forKey: "materials") + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, task)) + for invalid: Any in [NSNull(), -1, 2, true, "bad"] { + var tasks = Self.tasks([Self.task]) + tasks["total"] = invalid + XCTAssertThrowsError(try decode(DroneDockMaterialTasks.self, tasks)) + } + } + + /// 任务的两种身份不能冲突,也不能接受缺失、非正整数或错误字段类型。 + func testMalformedTaskIdentityAndFieldsAreRejected() throws { + for invalid: Any in [0, -1, true, 1.5, "bad"] { + var task = Self.task + task["id"] = invalid + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, task)) + } + var missing = Self.task + missing.removeValue(forKey: "id") + missing.removeValue(forKey: "task_id") + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, missing)) + for extra: [String: Any] in [["task_id": 502], ["scenic_spot_id": 0], ["order_number": ""], + ["order_number": " TEST"], ["scenic_spot_name": 7], ["created_at": 12]] { + var task = Self.task + task.merge(extra) { _, value in value } + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, task)) + } + } + + /// 重复稳定身份会破坏列表和素材归属,因此在进入 UI 前拒绝。 + func testDuplicateTaskSpotAndMaterialIdentitiesAreRejected() throws { + XCTAssertThrowsError(try decode(DroneDockMaterialTasks.self, Self.tasks([Self.task, Self.task]))) + var detail = Self.detail + let spot: [String: Any] = ["scenic_spot_id": 201] + detail["spot"] = [spot, spot] + XCTAssertThrowsError(try decode(DroneDockMaterialDetail.self, detail)) + var task = Self.task + task["materials"] = [["id": 801], ["id": 801]] + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, task)) + } + + /// 根级摘要、任务列表与筛选点位必须属于请求范围。 + func testRequestResponseScopeMismatchIsRejected() async throws { + var detail = Self.detail + detail["order_number"] = "OTHER-ORDER" + var foreign = Self.tasks([]) + foreign["order_number"] = "OTHER-ORDER" + let session = MockURLSession(responses: [try envelope(detail), try envelope(foreign), try envelope(Self.tasks([Self.task]))]) + let api = DroneDockMaterialsAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.detail(scenicID: 128, orderNumber: Self.number) + XCTFail("不能展示其他订单的摘要") + } catch let error as APIError { + guard case .decodeFailed = error else { return XCTFail("应拒绝响应归属") } + } + for spotID: Int? in [nil, 202] { + do { + _ = try await api.tasks(scenicID: 128, orderNumber: Self.number, spotID: spotID) + XCTFail("不能展示其他订单或点位的任务") + } catch let error as APIError { + guard case .decodeFailed = error else { return XCTFail("应拒绝响应归属") } + } + } + } + + /// 外层订单与子任务、任务与成片之间不能串单。 + func testNestedOrderAndFilmTaskMismatchIsRejected() throws { + var task = Self.task + task["order_number"] = "OTHER-ORDER" + XCTAssertThrowsError(try decode(DroneDockMaterialTasks.self, Self.tasks([task]))) + task = Self.task + task["film"] = ["id": 901, "task_id": 502] + XCTAssertThrowsError(try decode(DroneDockMaterialTask.self, task)) + task["film"] = ["id": "901", "task_id": "501", "file_url": "https://example.com/film.mp4"] + XCTAssertEqual(try decode(DroneDockMaterialTask.self, task).film?.previewURL?.host, "example.com") + } + + /// 未就绪、未知类型和非 HTTP(S) 地址均不可预览,即使服务端给了地址。 + func testPreviewRequiresReadySupportedRemoteMedia() throws { + let ready: [String: Any] = ["id": 801, "file_type": 2, "upload_status": 1, "file_url": "https://example.com/video.mp4"] + XCTAssertEqual(try decode(DroneDockMaterialFile.self, ready).previewURL?.absoluteString, "https://example.com/video.mp4") + for extra: [String: Any] in [["upload_status": 0], ["upload_status": 2], ["upload_status": 3], + ["upload_status": NSNull()], ["file_type": 0], ["file_type": 99], + ["file_url": ""], ["file_url": "file:///tmp/video.mp4"], + ["file_url": "javascript:alert(1)"], ["file_url": "/relative.mp4"], + ["file_url": "https:///"], ["file_url": " https://example.com/video.mp4"]] { + var payload = ready + payload.merge(extra) { _, value in value } + XCTAssertNil(try decode(DroneDockMaterialFile.self, payload).previewURL) + } + XCTAssertNil(try decode(DroneDockMaterialFilm.self, ["id": 901, "file_url": NSNull()]).previewURL) + XCTAssertNil(try decode(DroneDockMaterialFilm.self, ["id": 901, "file_url": "file:///tmp/film.mp4"]).previewURL) + XCTAssertEqual(try decode(DroneDockMaterialFilm.self, ["id": 901, "file_url": "http://example.com/film.mp4"]).previewURL?.host, "example.com") + } + + /// 测试订单号不关联真实游客信息。 + private static let number = "TEST-MATERIALS-001" + + /// 最小合法整单摘要,无需 project_id 即可查看素材。 + private static var detail: [String: Any] { + ["order_number": number, "shoot_count": 3, "shot_count": 1, "remaining_count": 2, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "测试点位一"], + ["scenic_spot_id": 202, "scenic_spot_name": "测试点位二"]]] + } + + /// 待飞任务也需出现在完整素材库任务列表中。 + private static var task: [String: Any] { + ["id": 501, "task_id": 501, "order_number": number, "scenic_spot_id": 201, + "scenic_spot_name": "测试点位一", "air_line_name": "测试航线", "seq": 1, + "flight_status": 10, "material_status": 0, "created_at": "2026-10-28 10:00:00", + "materials": [], "film": NSNull()] + } + + /// tasks 一次返回完整列表,total 与 list 数量保持一致。 + private static func tasks(_ list: [[String: Any]]) -> [String: Any] { + ["order_number": number, "total": list.count, "list": list] + } + + /// 构造标准成功响应,避免测试调用真实接口。 + private func envelope(_ payload: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload]) + } + + /// 直接校验模型的响应约束。 + private func decode(_ type: T.Type, _ payload: [String: Any]) throws -> T { + try JSONDecoder().decode(type, from: JSONSerialization.data(withJSONObject: payload)) + } + + /// 精确核对查询参数,额外的分页或筛选字段也会导致断言失败。 + private func query(_ request: URLRequest) throws -> [String: String] { + let url = try XCTUnwrap(request.url) + let items = try XCTUnwrap(URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems) + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } +} diff --git a/suixinkanTests/DroneDockMaterialsNavigationFixtures.swift b/suixinkanTests/DroneDockMaterialsNavigationFixtures.swift new file mode 100644 index 0000000..aa35b72 --- /dev/null +++ b/suixinkanTests/DroneDockMaterialsNavigationFixtures.swift @@ -0,0 +1,21 @@ +import UIKit +@testable import suixinkan + +/// 首页与完整订单列表的真实素材入口测试,使用独立的只读网络替身。 +@MainActor +enum DroneDockMaterialsNavigationFixtures { + /// 构造匹配传入订单的空素材响应,验证跳转后才读取两项接口。 + static func controller(context: DroneDockHomeContext, order: DroneDockHomeOrder) throws -> (DroneDockMaterialsViewController, MockURLSession) { + let number = order.orderNumber ?? order.orderID + let detail = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", + "data": ["order_number": number, "spot": []]] as [String: Any]) + let tasks = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", + "data": ["order_number": number, "total": 0, "list": []]] as [String: Any]) + let session = MockURLSession(responses: [detail, tasks]) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "materials-navigation-test-token" } + let model = DroneDockMaterialsViewModel(context: context, order: order, + service: DroneDockMaterialsAPI(client: client), currentContext: { context }) + return (DroneDockMaterialsViewController(viewModel: model), session) + } +} diff --git a/suixinkanTests/DroneDockMaterialsSimulationViewTests.swift b/suixinkanTests/DroneDockMaterialsSimulationViewTests.swift new file mode 100644 index 0000000..1cb2f33 --- /dev/null +++ b/suixinkanTests/DroneDockMaterialsSimulationViewTests.swift @@ -0,0 +1,182 @@ +import Photos +import UIKit +import XCTest +@testable import suixinkan + +/// 用正式素材页的隔离场景检查窄屏布局与交互,所有媒体都来自随包资源。 +@MainActor +final class DroneDockMaterialsSimulationViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 十种真实接口边界状态均保留固定底栏,内容和操作区不互相遮挡。 + func testAllMockStatesKeepFooterAndContentSeparateOnPhoneWidths() async throws { + for width in [375.0, 402.0] { + for scenario in ["ready", "uploading", "uploadFailed", "mixed", "empty", "loading", "error", "taskUploading", "taskFailed", "film"] { + let controller = try XCTUnwrap(DroneDockMaterialsSimulation.makeController(scenario: scenario) as? DroneDockMaterialsViewController) + let window = show(controller, width: width) + defer { close(window) } + try await settle(window) { + if scenario == "loading" { return controller.viewModel.isLoading } + if scenario == "error" { return controller.viewModel.detailErrorMessage != nil } + return controller.viewModel.total != nil + } + let list = try XCTUnwrap(find(controller.view, "drone.materials.remote.list") as? UICollectionView) + let footer = try XCTUnwrap(find(controller.view, "drone.materials.remote.footer")) + let button = try XCTUnwrap(find(footer, "drone.materials.remote.download") as? UIButton) + XCTAssertLessThanOrEqual(list.frame.maxY, footer.frame.minY + 1, scenario) + XCTAssertGreaterThanOrEqual(button.bounds.height, 44, scenario) + XCTAssertLessThanOrEqual(footer.frame.maxY, controller.view.bounds.maxY + 1, scenario) + XCTAssertFalse(button.isEnabled, scenario) + XCTAssertEqual(controller.viewModel.selectedCount, 0) + for thumbnail in views(list).filter({ $0.accessibilityIdentifier == "drone.materials.remote.thumbnail" }) { + XCTAssertEqual(thumbnail.bounds.height, thumbnail.bounds.width * 9 / 16, accuracy: 1) + } + if scenario == "uploading" || scenario == "uploadFailed" || scenario.hasPrefix("task") { + XCTAssertTrue(controller.viewModel.selectableMaterialIDs.isEmpty, scenario) + } + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = "订单素材库-\(scenario)-\(Int(width))" + attachment.lifetime = .keepAlways + add(attachment) + } + } + } + + /// 选择不打开预览,预览不改变选择;返回时继续显示固定底栏中的已选数量。 + func testLocalSelectionAndPreviewAreIndependent() async throws { + let controller = try XCTUnwrap(DroneDockMaterialsSimulation.makeController(scenario: "ready") as? DroneDockMaterialsViewController) + let window = show(controller, width: 402) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 3 } + let selection = try XCTUnwrap(find(controller.view, "drone.materials.remote.select.903.5") as? UIButton) + selection.sendActions(for: .touchUpInside) + XCTAssertEqual(controller.viewModel.selectedCount, 1) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + window.layoutIfNeeded() + let selectedImage = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let selectedAttachment = XCTAttachment(image: selectedImage) + selectedAttachment.name = "订单素材库-selected-402" + selectedAttachment.lifetime = .keepAlways + add(selectedAttachment) + let preview = try XCTUnwrap(find(controller.view, "drone.materials.remote.file.903.5.preview") as? UIButton) + preview.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { navigation.viewControllers.count == 2 } + XCTAssertEqual(controller.viewModel.selectedCount, 1) + navigation.popViewController(animated: false) + try await settle(window) { navigation.topViewController === controller } + XCTAssertEqual(controller.viewModel.selectedCount, 1) + let download = try XCTUnwrap(find(controller.view, "drone.materials.remote.download") as? UIButton) + XCTAssertTrue(download.isEnabled) + } + + /// 默认演示使用 mock.invalid 与随包素材,完成文案不声称写入相册,也不申请相册权限。 + func testDefaultMockDownloadCompletesAsSimulationWithoutPhotoPermissionChange() async throws { + let authorizationBefore = PHPhotoLibrary.authorizationStatus(for: .addOnly) + let controller = try XCTUnwrap(DroneDockMaterialsSimulation.makeController(arguments: ["--dock-materials-mock=ready"]) as? DroneDockMaterialsViewController) + let window = show(controller, width: 402) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 3 } + XCTAssertEqual(controller.navigationItem.prompt, "本地演示 · 未联网") + XCTAssertTrue(controller.viewModel.tasks.flatMap(\.materials).allSatisfy { $0.previewURL?.host == "mock.invalid" }) + try XCTUnwrap(find(controller.view, "drone.materials.remote.select.903.5") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 1 } + try XCTUnwrap(find(controller.view, "drone.materials.remote.download") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.downloadViewModel.phase == .finished } + XCTAssertEqual(controller.downloadViewModel.completedCount, 1) + XCTAssertEqual(controller.downloadViewModel.failedCount, 0) + let labels = views(controller.view).compactMap { ($0 as? UILabel)?.text } + XCTAssertTrue(labels.contains { $0.contains("演示完成") }) + XCTAssertTrue(labels.contains { $0.contains("未下载或保存真实文件") }) + XCTAssertFalse(labels.contains { $0.hasPrefix("已保存") }) + XCTAssertNil(controller.presentedViewController) + XCTAssertEqual(PHPhotoLibrary.authorizationStatus(for: .addOnly), authorizationBefore) + } + + /// 显式回环参数只改变固定测试媒体地址;这里只检查模型,不触发下载或 Photos。 + func testLocalDownloadFlagOnlyBuildsCanonicalLoopbackMediaURLs() async throws { + for base in ["http://127.0.0.1:18765", "http://127.0.0.1:18765/"] { + let controller = try XCTUnwrap(DroneDockMaterialsSimulation.makeController(arguments: [ + "--dock-materials-mock=ready", "--dock-materials-download-local=\(base)" + ]) as? DroneDockMaterialsViewController) + await controller.viewModel.refresh() + XCTAssertEqual(controller.navigationItem.prompt, "本地测试素材 · 无业务请求") + let files = controller.viewModel.tasks.flatMap(\.materials) + XCTAssertEqual(files.count, 6) + for file in files { + XCTAssertEqual(file.fileURL, "http://127.0.0.1:18765/\(file.fileType == 1 ? "demo.jpg" : "demo.mp4")") + } + XCTAssertEqual(controller.downloadViewModel.phase, .idle) + XCTAssertEqual(controller.downloadViewModel.completedCount, 0) + } + } + + /// 非回环、隐式端口、路径、鉴权与查询等参数全部回退纯模拟,不能借调试入口访问任意地址。 + func testInvalidLocalDownloadFlagsFallBackToIsolatedMockURLs() async throws { + let invalidBases = [ + "https://127.0.0.1:18765", "http://localhost:18765", "http://192.168.1.10:18765", + "http://example.com:18765", "http://127.0.0.1", "http://127.0.0.1:0", + "http://127.0.0.1:65536", "http://127.0.0.1:18765/files", + "http://user:pass@127.0.0.1:18765", "http://127.0.0.1:18765?source=remote", + "http://127.0.0.1:18765#fragment", "file:///tmp/materials" + ] + for base in invalidBases { + let controller = try XCTUnwrap(DroneDockMaterialsSimulation.makeController(arguments: [ + "--dock-materials-mock=ready", "--dock-materials-download-local=\(base)" + ]) as? DroneDockMaterialsViewController) + await controller.viewModel.refresh() + XCTAssertEqual(controller.navigationItem.prompt, "本地演示 · 未联网", base) + XCTAssertTrue(controller.viewModel.tasks.flatMap(\.materials).allSatisfy { $0.previewURL?.host == "mock.invalid" }, base) + XCTAssertEqual(controller.downloadViewModel.phase, .idle) + } + let mixed = try XCTUnwrap(DroneDockMaterialsSimulation.makeController(arguments: [ + "--dock-materials-mock=mixed", "--dock-materials-download-local=http://127.0.0.1:18765" + ]) as? DroneDockMaterialsViewController) + await mixed.viewModel.refresh() + XCTAssertTrue(mixed.viewModel.tasks.flatMap(\.materials).compactMap(\.previewURL).allSatisfy { $0.host == "mock.invalid" }) + XCTAssertEqual(mixed.navigationItem.prompt, "本地演示 · 未联网") + XCTAssertNil(DroneDockMaterialsSimulation.makeController(arguments: ["--dock-materials-download-local=http://127.0.0.1:18765"])) + } + + private func show(_ controller: UIViewController, width: CGFloat) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow() + window.frame = CGRect(x: 0, y: 0, width: width, height: width == 375 ? 812 : 874) + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<150 { + window.layoutIfNeeded() + if condition() { + // 等待 Diffable 的淡入结束,避免截图叠加上一帧的加载占位。 + try await Task.sleep(nanoseconds: 400_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 15_000_000) + } + XCTFail("素材演示未完成状态展示") + throw NSError(domain: "DroneDockMaterialsSimulationViewTests", code: 1) + } + + private func views(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap { views($0) } } + private func find(_ root: UIView, _ identifier: String) -> UIView? { views(root).first { $0.accessibilityIdentifier == identifier } } +} diff --git a/suixinkanTests/DroneDockMaterialsViewModelTests.swift b/suixinkanTests/DroneDockMaterialsViewModelTests.swift new file mode 100644 index 0000000..81730be --- /dev/null +++ b/suixinkanTests/DroneDockMaterialsViewModelTests.swift @@ -0,0 +1,603 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证订单素材库的整单口径、点位读取、并发响应和会话隔离。 +@MainActor +final class DroneDockMaterialsViewModelTests: XCTestCase { + /// 只允许打开当前订单中已加载的任务,不因无素材就创建新任务。 + func testRecordedTaskViewingRequiresLoadedCurrentOrderTask() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + XCTAssertFalse(model.canViewRecordedTasks) + XCTAssertNil(model.taskForViewing(id: 10)) + await model.refresh() + XCTAssertTrue(model.canViewRecordedTasks) + XCTAssertEqual(model.taskForViewing(id: 10)?.id, 10) + XCTAssertNil(model.taskForViewing(id: 999)) + XCTAssertEqual(service.requests.count, 2) + } + + /// 刷新任务失败后,旧列表不能继续用于进入图传页。 + func testRecordedTaskViewingRejectsStaleTaskList() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + service.tasksResponse = .failure(URLError(.timedOut)) + await model.refresh() + XCTAssertFalse(model.canViewRecordedTasks) + XCTAssertNil(model.taskForViewing(id: 10)) + } + /// 首次先读取购买摘要,再读取全部任务,任务数不改变整单拍摄次数。 + func testRefreshReadsDetailThenAllTasksWithoutChangingQuota() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasks(ids: [9, 8, 7], statuses: [40, 10, 30])) + let model = try makeModel(service: service) + XCTAssertNil(model.total) + await model.refresh() + XCTAssertEqual(service.requests, [.detail(128, "ORDER-1"), .tasks(128, "ORDER-1", nil)]) + XCTAssertEqual(model.tasks.map(\.id), [9, 8, 7]) + XCTAssertEqual(model.tasks.map(\.flightStatus), [40, 10, 30]) + XCTAssertEqual(model.total, 3) + XCTAssertEqual(model.detail?.order.shotUsed, 1) + XCTAssertEqual(model.detail?.order.shotRemain, 4) + XCTAssertEqual(model.spots.map(\.id), [201, 202]) + XCTAssertNil(model.selectedSpotID) + XCTAssertNil(model.detailErrorMessage) + XCTAssertNil(model.tasksErrorMessage) + XCTAssertFalse(model.isLoading || model.isLoadingTasks) + } + + /// 点位切换和切回全部只查询 tasks,摘要和购买点位保持整单范围。 + func testSwitchingSpotOnlyLoadsTasksAndAllOmitsSpot() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + let detail = model.detail + await model.selectSpot(id: 201) + await model.selectSpot(id: nil) + XCTAssertEqual(service.requests, [.detail(128, "ORDER-1"), .tasks(128, "ORDER-1", nil), + .tasks(128, "ORDER-1", 201), .tasks(128, "ORDER-1", nil)]) + XCTAssertEqual(model.detail, detail) + XCTAssertEqual(model.spots.map(\.id), [201, 202]) + XCTAssertNil(model.selectedSpotID) + } + + /// 未读取详情、重复点位及未购买点位均不发送任务请求。 + func testInvalidAndDuplicateSelectionsAreIgnored() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.selectSpot(id: 201) + await model.retryTasks() + XCTAssertTrue(service.requests.isEmpty) + await model.refresh() + await model.selectSpot(id: nil) + await model.selectSpot(id: 999) + await model.selectSpot(id: 0) + XCTAssertEqual(service.requests.count, 2) + await model.selectSpot(id: 201) + await model.selectSpot(id: 201) + XCTAssertEqual(service.requests.count, 3) + } + + /// 当前点位暂无任务是成功空态,仍保留全量点位和整单摘要。 + func testEmptyPointKeepsDetailAndOtherSpotOptions() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasks(ids: [])) + await model.selectSpot(id: 202) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertEqual(model.total, 0) + XCTAssertEqual(model.selectedSpotID, 202) + XCTAssertEqual(model.spots.map(\.id), [201, 202]) + XCTAssertEqual(model.detail?.order.shotTotal, 5) + XCTAssertNil(model.tasksErrorMessage) + } + + /// 任务失败清除上一个点位内容;重试只读当前点位,不重复获取摘要。 + func testTaskFailureAndRetryKeepCurrentSpotAndWholeOrder() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + service.tasksResponse = .failure(APIError.networkFailed("素材暂不可用")) + await model.selectSpot(id: 201) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertNil(model.total) + XCTAssertEqual(model.selectedSpotID, 201) + XCTAssertNotNil(model.detail) + XCTAssertNil(model.detailErrorMessage) + XCTAssertTrue(model.tasksErrorMessage?.contains("素材暂不可用") == true) + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasks(ids: [22])) + await model.retryTasks() + XCTAssertEqual(model.tasks.map(\.id), [22]) + XCTAssertNil(model.tasksErrorMessage) + XCTAssertEqual(service.requests.filter { if case .detail = $0 { true } else { false } }.count, 1) + XCTAssertEqual(service.requests.last, .tasks(128, "ORDER-1", 201)) + } + + /// 摘要失败时不继续查询任务,也不把旧数据伪装为当前结果。 + func testDetailFailureClearsOldSnapshotAndSkipsTasks() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + await model.selectSpot(id: 201) + service.detailResponse = .failure(APIError.networkFailed("摘要读取失败")) + await model.refresh() + XCTAssertEqual(service.requests.count, 4) + XCTAssertEqual(service.requests.last, .detail(128, "ORDER-1")) + XCTAssertNil(model.detail) + XCTAssertNil(model.total) + XCTAssertNil(model.selectedSpotID) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertTrue(model.spots.isEmpty) + XCTAssertNotNil(model.detailErrorMessage) + XCTAssertNil(model.tasksErrorMessage) + service.detailResponse = .success(try MaterialsViewModelFixtures.detail()) + await model.refresh() + XCTAssertNotNil(model.detail) + XCTAssertEqual(model.total, 1) + XCTAssertNil(model.detailErrorMessage) + } + + /// 刷新保留仍存在的点位,购买快照移除该点位后退回全部。 + func testRefreshRestoresValidSelectionAndResetsRemovedSpot() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + await model.selectSpot(id: 201) + await model.refresh() + XCTAssertEqual(model.selectedSpotID, 201) + XCTAssertEqual(service.requests.last, .tasks(128, "ORDER-1", 201)) + service.detailResponse = .success(try MaterialsViewModelFixtures.detail(spotIDs: [202])) + await model.refresh() + XCTAssertNil(model.selectedSpotID) + XCTAssertEqual(model.spots.map(\.id), [202]) + XCTAssertEqual(service.requests.last, .tasks(128, "ORDER-1", nil)) + } + + /// 切换点位后,旧点位的迟到成功和失败都不能覆盖最新内容。 + func testLatePointResponsesCannotReplaceNewSelection() async throws { + for oldFails in [false, true] { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + service.suspendTasks = true + let firstStarted = expectation(description: "首个点位已请求") + let secondStarted = expectation(description: "第二个点位已请求") + service.requestStarted = { index in + if index == 2 { firstStarted.fulfill() } + if index == 3 { secondStarted.fulfill() } + } + let first = Task { await model.selectSpot(id: 201) } + await fulfillment(of: [firstStarted], timeout: 2) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertTrue(model.isLoadingTasks) + let second = Task { await model.selectSpot(id: 202) } + await fulfillment(of: [secondStarted], timeout: 2) + service.finishTasks(3, .success(try MaterialsViewModelFixtures.tasks(ids: [20], spotID: 202))) + await second.value + let oldResult: Result = oldFails + ? .failure(APIError.networkFailed("旧点位失败")) + : .success(try MaterialsViewModelFixtures.tasks(ids: [10])) + service.finishTasks(2, oldResult) + await first.value + XCTAssertEqual(model.selectedSpotID, 202) + XCTAssertEqual(model.tasks.map(\.id), [20]) + XCTAssertEqual(model.total, 1) + XCTAssertNil(model.tasksErrorMessage) + XCTAssertFalse(model.isLoadingTasks) + } + } + + /// 整页刷新会使旧任务请求失效,旧任务不能回填新快照。 + func testRefreshRejectsPendingTasksFromPreviousSnapshot() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + service.suspendTasks = true + let started = expectation(description: "旧任务已请求") + service.requestStarted = { if $0 == 2 { started.fulfill() } } + let old = Task { await model.selectSpot(id: 201) } + await fulfillment(of: [started], timeout: 2) + service.suspendTasks = false + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasks(ids: [99])) + await model.refresh() + service.finishTasks(2, .success(try MaterialsViewModelFixtures.tasks(ids: [10]))) + await old.value + XCTAssertEqual(model.tasks.map(\.id), [99]) + XCTAssertEqual(model.selectedSpotID, 201) + XCTAssertFalse(model.isLoading || model.isLoadingTasks) + } + + /// 详情属于其他订单时停止后续请求,任务属于其他订单或点位时不展示。 + func testMismatchedOrderAndPointResponsesAreRejected() async throws { + let service = try MaterialsViewModelService() + service.detailResponse = .success(try MaterialsViewModelFixtures.detail(orderNumber: "OTHER")) + let model = try makeModel(service: service) + await model.refresh() + XCTAssertNil(model.detail) + XCTAssertNotNil(model.detailErrorMessage) + XCTAssertEqual(service.requests.count, 1) + service.detailResponse = .success(try MaterialsViewModelFixtures.detail()) + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasks(orderNumber: "OTHER")) + await model.refresh() + XCTAssertNotNil(model.detail) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertNotNil(model.tasksErrorMessage) + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasks(spotID: 202)) + await model.selectSpot(id: 201) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertNil(model.total) + XCTAssertNotNil(model.tasksErrorMessage) + } + + /// 登录、景区或门店缺失时不发出任一接口请求。 + func testMissingSessionOrScopeDoesNotRequest() async throws { + for context in [makeContext(token: ""), makeContext(scenicID: 0), makeContext(storeID: 0)] { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service, scope: MaterialsContextBox(context)) + await model.refresh() + XCTAssertTrue(service.requests.isEmpty) + XCTAssertNotNil(model.detailErrorMessage) + XCTAssertFalse(model.isLoading || model.isLoadingTasks) + } + } + + /// 摘要在途时切换景区,不允许旧账号结果触发任务请求。 + func testChangedContextDuringDetailRejectsResponseAndFutureRequests() async throws { + let service = try MaterialsViewModelService() + service.suspendDetail = true + let started = expectation(description: "摘要请求已挂起") + service.requestStarted = { _ in started.fulfill() } + let scope = MaterialsContextBox(makeContext()) + let model = try makeModel(service: service, scope: scope) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + scope.value = makeContext(scenicID: 129) + service.finishDetail(0, .success(try MaterialsViewModelFixtures.detail())) + await pending.value + await model.refresh() + XCTAssertEqual(service.requests.count, 1) + XCTAssertNil(model.detail) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertNotNil(model.detailErrorMessage) + } + + /// 任务在途时更新 token、门店、用户或账号类型会同时清除摘要和素材。 + func testChangedIdentityDuringTasksClearsAllData() async throws { + for replacement in [makeContext(token: "new-token"), makeContext(storeID: 38), + makeContext(userID: "new-user"), makeContext(accountType: "photog")] { + let service = try MaterialsViewModelService() + let scope = MaterialsContextBox(makeContext()) + let model = try makeModel(service: service, scope: scope) + await model.refresh() + service.suspendTasks = true + let started = expectation(description: "任务请求已挂起") + service.requestStarted = { if $0 == 2 { started.fulfill() } } + let pending = Task { await model.selectSpot(id: 201) } + await fulfillment(of: [started], timeout: 2) + scope.value = replacement + service.finishTasks(2, .success(try MaterialsViewModelFixtures.tasks())) + await pending.value + XCTAssertNil(model.detail) + XCTAssertNil(model.total) + XCTAssertNil(model.selectedSpotID) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertNotNil(model.detailErrorMessage) + XCTAssertFalse(model.isLoading || model.isLoadingTasks) + } + } + + /// 取消加载或离开页面后,详情迟到结果不能发起素材请求。 + func testCancellationAndInvalidationRejectLateDetail() async throws { + for cancel in [true, false] { + let service = try MaterialsViewModelService() + service.suspendDetail = true + let started = expectation(description: "摘要挂起等待取消") + service.requestStarted = { _ in started.fulfill() } + let model = try makeModel(service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + if cancel { pending.cancel() } else { model.invalidate() } + service.finishDetail(0, .success(try MaterialsViewModelFixtures.detail())) + await pending.value + XCTAssertEqual(service.requests.count, 1) + XCTAssertNil(model.detail) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertNil(model.detailErrorMessage) + XCTAssertFalse(model.isLoading || model.isLoadingTasks) + } + } + + /// 返回上级页面时清空已加载摘要和任务,任务晚到也不能恢复。 + func testInvalidationRejectsLateTasks() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + await model.refresh() + service.suspendTasks = true + let started = expectation(description: "任务挂起等待离开") + service.requestStarted = { if $0 == 2 { started.fulfill() } } + let pending = Task { await model.selectSpot(id: 201) } + await fulfillment(of: [started], timeout: 2) + model.invalidate() + service.finishTasks(2, .success(try MaterialsViewModelFixtures.tasks())) + await pending.value + XCTAssertNil(model.detail) + XCTAssertNil(model.total) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertTrue(model.spots.isEmpty) + XCTAssertFalse(model.isLoading || model.isLoadingTasks) + } + + /// 上传状态、类型和文件地址均需就绪;成片与其他任务同名文件不会误入选择。 + func testSelectionOnlyIncludesReadyOriginalFilesWithCompositeIdentity() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles(ids: [10, 11])) + let model = try makeModel(service: service) + await model.refresh() + let expected: Set = [ + .init(taskID: 10, fileID: 1), .init(taskID: 10, fileID: 2), + .init(taskID: 11, fileID: 1), .init(taskID: 11, fileID: 2) + ] + XCTAssertEqual(model.selectableMaterialIDs, expected) + for fileID in [3, 4, 5, 6, 7, 8, 90] { model.toggleSelection(taskID: 10, fileID: fileID) } + model.toggleSelection(taskID: 999, fileID: 1) + XCTAssertEqual(model.selectedCount, 0) + model.toggleSelection(taskID: 10, fileID: 1) + model.toggleSelection(taskID: 11, fileID: 1) + XCTAssertEqual(model.selectedMaterialIDs, [.init(taskID: 10, fileID: 1), .init(taskID: 11, fileID: 1)]) + model.toggleSelection(taskID: 10, fileID: 1) + XCTAssertEqual(model.selectedMaterialIDs, [.init(taskID: 11, fileID: 1)]) + XCTAssertEqual(service.requests.count, 2, "勾选不得发出网络请求") + } + + /// 全选只覆盖当前可用文件,第二次点击清空;无文件时不显示全选。 + func testSelectAllTogglesOnlyAvailableOriginals() async throws { + let service = try MaterialsViewModelService() + let model = try makeModel(service: service) + model.toggleSelectAll() + XCTAssertFalse(model.allDownloadableSelected) + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles()) + await model.refresh() + model.toggleSelection(taskID: 10, fileID: 1) + XCTAssertFalse(model.allDownloadableSelected) + model.toggleSelectAll() + XCTAssertEqual(model.selectedCount, 2) + XCTAssertTrue(model.allDownloadableSelected) + model.toggleSelectAll() + XCTAssertTrue(model.selectedMaterialIDs.isEmpty) + XCTAssertFalse(model.allDownloadableSelected) + XCTAssertEqual(service.requests.count, 2) + } + + /// 切点、刷新和读取失败都清除旧选择;重新获取的数据不会自动恢复勾选。 + func testFilterRefreshAndFailureClearPreviousSelection() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles()) + let model = try makeModel(service: service) + await model.refresh() + model.toggleSelectAll() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles(ids: [20], spotID: 202)) + await model.selectSpot(id: 202) + XCTAssertTrue(model.selectedMaterialIDs.isEmpty) + XCTAssertEqual(model.selectableMaterialIDs, [.init(taskID: 20, fileID: 1), .init(taskID: 20, fileID: 2)]) + model.toggleSelectAll() + await model.refresh() + XCTAssertEqual(model.selectedCount, 0) + model.toggleSelectAll() + service.tasksResponse = .failure(APIError.networkFailed("测试任务读取失败")) + await model.retryTasks() + model.toggleSelection(taskID: 20, fileID: 1) + model.toggleSelectAll() + XCTAssertTrue(model.selectedMaterialIDs.isEmpty) + XCTAssertTrue(model.selectableMaterialIDs.isEmpty) + XCTAssertFalse(model.allDownloadableSelected) + } + + /// 读取期间没有可选旧数据,离页后迟到响应不能恢复文件或选择。 + func testPendingLoadAndInvalidationCannotRestoreSelection() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles()) + let model = try makeModel(service: service) + await model.refresh() + model.toggleSelectAll() + service.suspendTasks = true + let started = expectation(description: "任务选择刷新挂起") + service.requestStarted = { if $0 == 2 { started.fulfill() } } + let pending = Task { await model.selectSpot(id: 201) } + await fulfillment(of: [started], timeout: 2) + XCTAssertTrue(model.isLoadingTasks) + model.toggleSelectAll() + model.toggleSelection(taskID: 10, fileID: 1) + XCTAssertTrue(model.selectedMaterialIDs.isEmpty) + XCTAssertTrue(model.selectableMaterialIDs.isEmpty) + model.invalidate() + service.finishTasks(2, .success(try MaterialsViewModelFixtures.tasksWithFiles())) + await pending.value + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertTrue(model.selectedMaterialIDs.isEmpty) + XCTAssertFalse(model.allDownloadableSelected) + } + + /// 即使尚未刷新,账号身份改变后的勾选也会撤下旧订单和旧选择。 + func testSelectionContextChangeClearsOrderWithoutRequesting() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles()) + let scope = MaterialsContextBox(makeContext()) + let model = try makeModel(service: service, scope: scope) + await model.refresh() + model.toggleSelectAll() + scope.value = makeContext(userID: "new-test-user") + model.toggleSelection(taskID: 10, fileID: 1) + XCTAssertNil(model.detail) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertTrue(model.selectedMaterialIDs.isEmpty) + XCTAssertNotNil(model.detailErrorMessage) + XCTAssertEqual(service.requests.count, 2) + } + + /// 下载使用稳定的任务/素材联合身份和原片地址,并将后端媒体类型转换为相册类型。 + func testDownloadItemsContainOnlySelectedReadyRawFilesInServerOrder() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles(ids: [10, 20])) + let model = try makeModel(service: service) + await model.refresh() + model.toggleSelectAll() + let items = model.selectedDownloadItems() + XCTAssertEqual(items.map(\.id), ["ORDER-1/10/1", "ORDER-1/10/2", "ORDER-1/20/1", "ORDER-1/20/2"]) + XCTAssertEqual(items.map(\.fileType), [0, 1, 0, 1]) + XCTAssertEqual(items.map(\.fileName), ["material-1.jpg", "material-2.mp4", "material-1.jpg", "material-2.mp4"]) + XCTAssertEqual(items.map { $0.remoteURL.lastPathComponent }, ["photo.jpg", "video.mp4", "photo.jpg", "video.mp4"]) + model.toggleSelection(taskID: 10, fileID: 2) + XCTAssertEqual(model.selectedDownloadItems().map(\.id), ["ORDER-1/10/1", "ORDER-1/20/1", "ORDER-1/20/2"]) + XCTAssertEqual(service.requests.count, 2) + } + + /// 已勾选后切换账号,发起下载前仍须撤销旧订单范围。 + func testDownloadRejectsContextChangedAfterSelection() async throws { + let service = try MaterialsViewModelService() + service.tasksResponse = .success(try MaterialsViewModelFixtures.tasksWithFiles()) + let scope = MaterialsContextBox(makeContext()) + let model = try makeModel(service: service, scope: scope) + await model.refresh() + model.toggleSelectAll() + scope.value = makeContext(storeID: 999) + XCTAssertTrue(model.selectedDownloadItems().isEmpty) + XCTAssertNil(model.detail) + XCTAssertTrue(model.tasks.isEmpty) + XCTAssertFalse(model.acceptsDownloadContext()) + } + + private func makeModel(service: MaterialsViewModelService, scope: MaterialsContextBox? = nil) throws -> DroneDockMaterialsViewModel { + let scope = scope ?? MaterialsContextBox(makeContext()) + return DroneDockMaterialsViewModel(context: scope.value, order: try MaterialsViewModelFixtures.detail().order, + service: service, currentContext: { scope.value }) + } + + private func makeContext(scenicID: Int = 128, storeID: Int = 37, token: String = "test-token", + userID: String = "materials-test-user", accountType: String = "store_user") -> DroneDockHomeContext { + DroneDockHomeContext(userID: userID, accountType: accountType, scenicID: scenicID, + scenicName: "测试景区", storeID: storeID, photographerName: "测试工作人员", token: token) + } +} + +/// 测试中替换会话身份,不读写应用账户存储。 +@MainActor +private final class MaterialsContextBox { + var value: DroneDockHomeContext + + /// 保存素材页所属的初始会话。 + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 经过正式解码器校验的匿名素材库数据。 +private enum MaterialsViewModelFixtures { + /// 生成整单摘要与购买点位。 + static func detail(orderNumber: String = "ORDER-1", spotIDs: [Int] = [201, 202]) throws -> DroneDockMaterialDetail { + let value: [String: Any] = [ + "order_number": orderNumber, "project_id": 101, "project_name": "测试套餐", + "shoot_count": 5, "shot_count": 1, "remaining_count": 4, + "spot": spotIDs.map { ["scenic_spot_id": $0, "scenic_spot_name": "测试点位\($0)"] as [String: Any] } + ] + return try JSONDecoder().decode(DroneDockMaterialDetail.self, from: JSONSerialization.data(withJSONObject: value)) + } + + /// 生成全部任务响应,任务状态不会影响整单次数夹具。 + static func tasks(ids: [Int] = [10], spotID: Int = 201, orderNumber: String = "ORDER-1", + statuses: [Int]? = nil) throws -> DroneDockMaterialTasks { + let list: [[String: Any]] = ids.enumerated().map { index, id in + ["id": id, "order_number": orderNumber, "scenic_spot_id": spotID, + "scenic_spot_name": "测试点位", "air_line_name": "测试航线", + "flight_status": statuses?[index] ?? 10, "materials": [], "film": NSNull()] + } + return try JSONDecoder().decode(DroneDockMaterialTasks.self, from: JSONSerialization.data(withJSONObject: [ + "order_number": orderNumber, "total": list.count, "list": list + ])) + } + + /// 每个任务复用文件 ID,混合就绪、上传中、失败和无效地址,并包含独立成片。 + static func tasksWithFiles(ids: [Int] = [10], spotID: Int = 201) throws -> DroneDockMaterialTasks { + let files: [[String: Any]] = [ + ["id": 1, "file_type": 1, "upload_status": 1, "file_url": "https://example.com/photo.jpg"], + ["id": 2, "file_type": 2, "upload_status": 1, "file_url": "https://example.com/video.mp4"], + ["id": 3, "file_type": 1, "upload_status": 0, "file_url": "https://example.com/pending.jpg"], + ["id": 4, "file_type": 1, "upload_status": 2, "file_url": "https://example.com/uploading.jpg"], + ["id": 5, "file_type": 1, "upload_status": 3, "file_url": "https://example.com/failed.jpg"], + ["id": 6, "file_type": 1, "upload_status": 1, "file_url": "file:///tmp/not-remote.jpg"], + ["id": 7, "file_type": 99, "upload_status": 1, "file_url": "https://example.com/unknown"], + ["id": 8, "file_type": 1, "file_url": "https://example.com/unconfirmed.jpg"] + ] + let list: [[String: Any]] = ids.map { id in + ["id": id, "order_number": "ORDER-1", "scenic_spot_id": spotID, + "scenic_spot_name": "测试点位", "materials": files, + "film": ["id": 90, "task_id": id, "file_url": "https://example.com/film.mp4"]] + } + return try JSONDecoder().decode(DroneDockMaterialTasks.self, from: JSONSerialization.data(withJSONObject: [ + "order_number": "ORDER-1", "total": list.count, "list": list + ])) + } +} + +/// 记录两类只读请求,并可分别挂起以验证迟到响应保护。 +@MainActor +private final class MaterialsViewModelService: DroneDockMaterialsServing { + /// 保留接口和筛选范围,便于断言没有额外读取。 + enum Request: Equatable { + case detail(Int, String) + case tasks(Int, String, Int?) + } + + var detailResponse: Result + var tasksResponse: Result + var suspendDetail = false + var suspendTasks = false + var requestStarted: ((Int) -> Void)? + private(set) var requests: [Request] = [] + private var pendingDetails: [Int: CheckedContinuation] = [:] + private var pendingTasks: [Int: CheckedContinuation] = [:] + + /// 默认使用一单两点位、一条任务的匿名成功响应。 + init() throws { + detailResponse = .success(try MaterialsViewModelFixtures.detail()) + tasksResponse = .success(try MaterialsViewModelFixtures.tasks()) + } + + /// 记录详情范围并按测试安排返回或挂起。 + func detail(scenicID: Int, orderNumber: String) async throws -> DroneDockMaterialDetail { + let index = requests.count + requests.append(.detail(scenicID, orderNumber)) + if suspendDetail { + return try await withCheckedThrowingContinuation { continuation in + pendingDetails[index] = continuation + requestStarted?(index) + } + } + requestStarted?(index) + return try detailResponse.get() + } + + /// 记录任务点位参数并按测试安排返回或挂起。 + func tasks(scenicID: Int, orderNumber: String, spotID: Int?) async throws -> DroneDockMaterialTasks { + let index = requests.count + requests.append(.tasks(scenicID, orderNumber, spotID)) + if suspendTasks { + return try await withCheckedThrowingContinuation { continuation in + pendingTasks[index] = continuation + requestStarted?(index) + } + } + requestStarted?(index) + return try tasksResponse.get() + } + + /// 放行指定详情请求。 + func finishDetail(_ index: Int, _ result: Result) { + pendingDetails.removeValue(forKey: index)?.resume(with: result) + } + + /// 放行指定任务请求。 + func finishTasks(_ index: Int, _ result: Result) { + pendingTasks.removeValue(forKey: index)?.resume(with: result) + } +} diff --git a/suixinkanTests/DroneDockMaterialsViewTests.swift b/suixinkanTests/DroneDockMaterialsViewTests.swift new file mode 100644 index 0000000..7945b98 --- /dev/null +++ b/suixinkanTests/DroneDockMaterialsViewTests.swift @@ -0,0 +1,781 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用真实请求构造验证素材页的订单摘要、筛选、任务状态与媒体可用性。 +@MainActor +final class DroneDockMaterialsViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + private let number = "TEST-MATERIAL-ORDER" + + /// 素材上传不覆盖整单执行状态;同一摘要更新到完成时正确切换文案和颜色。 + func testOrderSummaryKeepsExecutionSeparateFromUploadingMaterialStatus() throws { + let cell = DroneDockMaterialOrderCell(frame: CGRect(x: 0, y: 0, width: 350, height: 140)) + for (status, shootStatus, title, color) in [(20, "processing", "进行中", DroneDockStyle.warning), + (30, "pending", "已完成", DroneDockStyle.success)] { + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: ["order_number": number, "order_status": status, + "shoot_status": shootStatus, "shoot_count": 5, "shot_count": 1, "remaining_count": 4, + "material_status": 2, "active_task_id": 21, "active_task_status": 25])) + cell.apply(order: order) + cell.layoutIfNeeded() + let badge = try XCTUnwrap(descendants(cell).compactMap { $0 as? DroneDockStatusLabel }.first) + XCTAssertEqual(badge.text, title) + XCTAssertEqual(badge.textColor, color) + XCTAssertEqual(badge.backgroundColor, color.withAlphaComponent(0.09)) + XCTAssertTrue(cell.accessibilityLabel?.contains(title) == true) + } + } + + /// 有任务的素材库仅保留刷新入口,不再从导航栏打开拍摄任务。 + func testNavigationOnlyShowsRefreshForExistingTasks() async throws { + let (controller, session) = try makeController([detail(), taskList([task(51)])]) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + XCTAssertEqual(controller.navigationItem.rightBarButtonItems?.map(\.accessibilityIdentifier), ["drone.materials.remote.refresh"]) + XCTAssertTrue(controller.navigationItem.rightBarButtonItem?.isEnabled == true) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(session.requests.count, 2) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" }) + } + + /// 空任务列表同样不显示查看任务,不通过创建任务补齐条件。 + func testNavigationOnlyShowsRefreshForEmptyOrder() async throws { + let (controller, session) = try makeController([detail(), taskList([])]) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 0 } + XCTAssertEqual(controller.navigationItem.rightBarButtonItems?.map(\.accessibilityIdentifier), ["drone.materials.remote.refresh"]) + XCTAssertEqual(session.requests.count, 2) + } + + /// 长点位在与云端上传一致的最大宽度内完整换行,筛选仍使用原点位 ID。 + func testLongPointFilterWrapsAndRemainsSelectableWithoutOverlappingSummary() async throws { + let name = "测试景区东南观景平台通往山顶步道的全景航拍游客打卡点—LongScenicViewpointName" + let (controller, session) = try makeController([ + detail(pointNames: [name, "短点位"]), taskList([task(51)]), taskList([task(51)])]) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + let list = try collection(controller) + let card = try XCTUnwrap(find(list, id: "drone.materials.filter.201") as? UICollectionViewCell) + let label = try XCTUnwrap(card.contentView.subviews.first as? UILabel) + let all = try XCTUnwrap(find(list, id: "drone.materials.filter.all") as? UICollectionViewCell) + let summary = try XCTUnwrap(find(list, id: "drone.materials.remote.summary") as? UICollectionViewCell) + XCTAssertEqual(label.text, name) + XCTAssertEqual(label.numberOfLines, 0) + XCTAssertEqual(label.lineBreakMode, .byWordWrapping) + XCTAssertLessThanOrEqual(card.bounds.width, min(200, list.bounds.width - 32)) + XCTAssertGreaterThan(card.bounds.height, 40) + XCTAssertGreaterThanOrEqual(label.bounds.height + 1, + label.sizeThatFits(CGSize(width: label.bounds.width, height: .greatestFiniteMagnitude)).height) + XCTAssertLessThan(all.bounds.width, card.bounds.width) + XCTAssertLessThanOrEqual(card.convert(card.bounds, to: list).maxY, + summary.convert(summary.bounds, to: list).minY) + try selectFilter(201, list: list) + try await settle(window) { controller.viewModel.selectedSpotID == 201 && session.requests.count == 3 } + XCTAssertEqual(query(try XCTUnwrap(session.requests.last))["scenic_spot_id"], "201") + capture(window, name: "订单素材库-点位名称完整换行") + } + + /// 小宽度下卡片高度容纳完整名称,复用到原有单行调用时恢复默认样式。 + func testFilterWrappingFitsNarrowWidthsAndPreservesSharedDefault() throws { + let title = "佛顶塔七楼西南角观景平台超长名称的游客航拍打卡点" + for maximumWidth: CGFloat in [160, 200] { + let size = DroneMaterialFilterCell.wrappedSize(title: title, maximumWidth: maximumWidth) + let cell = DroneMaterialFilterCell(frame: CGRect(origin: .zero, size: size)) + cell.apply(title: title, id: "201", selected: false, locked: false, wrapsTitle: true) + cell.layoutIfNeeded() + let label = try XCTUnwrap(cell.contentView.subviews.first as? UILabel) + XCTAssertLessThanOrEqual(cell.bounds.width, maximumWidth) + XCTAssertGreaterThan(cell.bounds.height, 40) + XCTAssertGreaterThanOrEqual(label.bounds.height + 1, + label.sizeThatFits(CGSize(width: label.bounds.width, height: .greatestFiniteMagnitude)).height) + cell.apply(title: "短点位", id: "202", selected: true, locked: false) + XCTAssertEqual(label.numberOfLines, 1) + XCTAssertEqual(label.lineBreakMode, .byTruncatingTail) + } + } + + /// 下载只覆盖已选就绪原素材,图片及视频正确保存,既有成片不进入批次。 + func testSelectionControlsDownloadReadyRawFilesAndSaveCorrectMediaTypes() async throws { + var record = task(1, status: 30) + var picture = file(14, status: 1, url: "https://example.invalid/raw.jpg") + picture["file_type"] = 1 + picture["file_name"] = "原始图片.jpg" + record["materials"] = [file(11, status: 1, url: "https://example.invalid/raw.mp4"), + file(12, status: 2), file(13, status: 3), picture] + record["film"] = ["id": 21, "task_id": 1, "file_name": "测试成片.mp4", "file_url": "https://example.invalid/film.mp4"] + let downloader = OrderMaterialsViewDownloadStub() + let saver = OrderMaterialsViewPhotoStub() + let downloadModel = DroneDockMaterialDownloadViewModel(service: ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver)) + let (controller, session) = try makeController([detail(), taskList([record])], downloadModel: downloadModel) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + let list = try collection(controller) + let first = try await visibleCell(list, path: IndexPath(item: 0, section: 4), window: window) + let select = try XCTUnwrap(find(first, id: "drone.materials.remote.select.1.11") as? UIButton) + select.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 1 } + XCTAssertNil(controller.presentedViewController) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertTrue(texts(controller.view).contains("已选择1项")) + let unavailable = try await visibleCell(list, path: IndexPath(item: 1, section: 4), window: window) + XCTAssertNil(find(unavailable, id: "drone.materials.remote.select.1.12")) + let failed = try await visibleCell(list, path: IndexPath(item: 2, section: 4), window: window) + let retry = try XCTUnwrap(find(failed, id: "drone.materials.remote.file.1.13.retryUpload")) + XCTAssertTrue(retry.accessibilityTraits.contains(.notEnabled)) + XCTAssertEqual(list.numberOfItems(inSection: 4), 4) + XCTAssertNil(find(controller.view, id: "drone.materials.remote.film.1.21")) + XCTAssertEqual(controller.viewModel.selectableMaterialIDs.count, 2) + let readyPicture = try await visibleCell(list, path: IndexPath(item: 3, section: 4), window: window) + try XCTUnwrap(find(readyPicture, id: "drone.materials.remote.select.1.14") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 2 } + let download = try XCTUnwrap(find(controller.view, id: "drone.materials.remote.download") as? UIButton) + XCTAssertTrue(download.isEnabled) + download.sendActions(for: .touchUpInside) + try await settle(window) { downloadModel.phase == .finished && self.texts(controller.view).contains("已保存 2 项") } + XCTAssertNil(controller.presentedViewController) + let addresses = await downloader.addresses + let types = await saver.fileTypes + XCTAssertEqual(addresses, ["https://example.invalid/raw.mp4", "https://example.invalid/raw.jpg"]) + XCTAssertEqual(types, [1, 0]) + XCTAssertEqual(downloadModel.completedCount, 2) + XCTAssertEqual(downloadModel.failedCount, 0) + XCTAssertEqual(downloadModel.progress, 1) + XCTAssertEqual(session.requests.count, 2) + XCTAssertEqual(controller.viewModel.selectedCount, 2) + capture(window, name: "订单素材库-下载并保存成功") + } + + /// 部分失败清楚保留成功数量,重试只下载失败项,不重复保存已成功的素材。 + func testPartialDownloadFailureRetriesOnlyFailedItem() async throws { + var record = task(1, status: 30) + record["materials"] = [file(11, status: 1, url: "https://example.invalid/first.mp4"), + file(12, status: 1, url: "https://example.invalid/retry.mp4")] + let downloader = OrderMaterialsViewDownloadStub(failOnceSuffix: "retry.mp4") + let saver = OrderMaterialsViewPhotoStub() + let downloadModel = DroneDockMaterialDownloadViewModel(service: ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver)) + let (controller, session) = try makeController([detail(), taskList([record])], downloadModel: downloadModel) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + try XCTUnwrap(find(controller.view, id: "drone.materials.selectAll") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 2 } + let download = try XCTUnwrap(find(controller.view, id: "drone.materials.remote.download") as? UIButton) + download.sendActions(for: .touchUpInside) + try await settle(window) { downloadModel.phase == .finished && self.texts(controller.view).contains("已保存 1 项 · 失败 1 项") } + XCTAssertEqual(download.configuration?.title, "重试失败项") + XCTAssertEqual(downloadModel.completedCount, 1) + XCTAssertEqual(downloadModel.failedCount, 1) + capture(window, name: "订单素材库-部分下载失败") + download.sendActions(for: .touchUpInside) + try await settle(window) { downloadModel.phase == .finished && downloadModel.completedCount == 2 } + let addresses = await downloader.addresses + let types = await saver.fileTypes + XCTAssertEqual(addresses, ["https://example.invalid/first.mp4", "https://example.invalid/retry.mp4", "https://example.invalid/retry.mp4"]) + XCTAssertEqual(types, [1, 1]) + XCTAssertEqual(session.requests.count, 2) + } + + /// 进入后台暂停当前下载,回到前台需手动继续;进行中不允许改点位或重复发起。 + func testBackgroundPausesDownloadAndResumeKeepsOriginalSelection() async throws { + var record = task(1, status: 30) + record["materials"] = [file(11, status: 1, url: "https://example.invalid/raw.mp4")] + let downloader = OrderMaterialsViewDownloadStub(suspendFirst: true) + let saver = OrderMaterialsViewPhotoStub() + let downloadModel = DroneDockMaterialDownloadViewModel(service: ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver)) + let (controller, session) = try makeController([detail(), taskList([record])], downloadModel: downloadModel) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + try XCTUnwrap(find(controller.view, id: "drone.materials.selectAll") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 1 } + let download = try XCTUnwrap(find(controller.view, id: "drone.materials.remote.download") as? UIButton) + download.sendActions(for: .touchUpInside) + await downloader.waitForFirstStart() + try await settle(window) { downloadModel.phase == .downloading } + try selectFilter(201, list: collection(controller)) + XCTAssertNil(controller.viewModel.selectedSpotID) + XCTAssertFalse(try XCTUnwrap(find(controller.view, id: "drone.materials.selectAll") as? UIButton).isEnabled) + XCTAssertEqual(session.requests.count, 2) + NotificationCenter.default.post(name: UIApplication.didEnterBackgroundNotification, object: nil) + try await settle(window) { downloadModel.phase == .paused } + XCTAssertEqual(download.configuration?.title, "继续下载") + await downloader.releaseFirst() + await downloadModel.waitForPendingOperations() + let savedWhilePaused = await saver.fileTypes + XCTAssertTrue(savedWhilePaused.isEmpty) + download.sendActions(for: .touchUpInside) + try await settle(window) { downloadModel.phase == .finished && downloadModel.completedCount == 1 } + XCTAssertEqual(session.requests.count, 2) + XCTAssertEqual(controller.viewModel.selectedCount, 1) + } + + /// 权限拒绝不能显示保存成功,页面给出可前往系统设置的明确提示。 + func testPhotoPermissionDeniedShowsSettingsAndNoSuccess() async throws { + var record = task(1, status: 30) + record["materials"] = [file(11, status: 1, url: "https://example.invalid/raw.mp4")] + let downloader = OrderMaterialsViewDownloadStub() + let saver = OrderMaterialsViewPhotoStub(denyPermission: true) + let downloadModel = DroneDockMaterialDownloadViewModel(service: ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver)) + let (controller, session) = try makeController([detail(), taskList([record])], downloadModel: downloadModel) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + try XCTUnwrap(find(controller.view, id: "drone.materials.selectAll") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 1 } + try XCTUnwrap(find(controller.view, id: "drone.materials.remote.download") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController is UIAlertController } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "需要相册保存权限") + XCTAssertEqual(alert.actions.compactMap(\.title), ["取消", "去设置"]) + XCTAssertEqual(downloadModel.completedCount, 0) + XCTAssertTrue(downloadModel.permissionDenied) + XCTAssertEqual(session.requests.count, 2) + capture(window, name: "订单素材库-相册保存权限拒绝") + } + + /// 固定下载底栏不随列表滚动移动,预览保持选择且只打开被点击文件。 + func testFooterStaysFixedAndPreviewPreservesSelection() async throws { + var record = task(1, status: 30) + record["materials"] = [file(11, status: 1, url: "https://example.invalid/raw.mp4")] + var previews = 0 + let (controller, session) = try makeController([detail(), taskList([record])], previewFactory: { url, isVideo, _ in + previews += 1 + XCTAssertEqual(url.absoluteString, "https://example.invalid/raw.mp4") + XCTAssertTrue(isVideo) + return UIViewController() + }) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + let list = try collection(controller) + let footer = try XCTUnwrap(find(controller.view, id: "drone.materials.remote.footer")) + let frame = footer.frame + let all = try XCTUnwrap(find(controller.view, id: "drone.materials.selectAll") as? UIButton) + all.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 1 } + let cell = try await visibleCell(list, path: IndexPath(item: 0, section: 4), window: window) + XCTAssertEqual(footer.frame, frame) + XCTAssertLessThanOrEqual(list.frame.maxY, footer.frame.minY + 0.5) + try XCTUnwrap(find(cell, id: "drone.materials.remote.file.1.11.preview") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.viewControllers.count == 2 } + XCTAssertEqual(previews, 1) + XCTAssertEqual(controller.viewModel.selectedCount, 1) + XCTAssertEqual(session.requests.count, 2) + } + + /// 空文件任务依据聚合状态呈现上传等待、同步、失败或未知,不补造素材。 + func testEmptyTaskMaterialsShowAggregateStatus() async throws { + var records = [task(1), task(2), task(3), task(4), task(5)] + for index in 0..<4 { records[index]["material_status"] = index } + let (controller, _) = try makeController([detail(), taskList(records)]) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 5 } + let list = try collection(controller) + for (index, title) in ["素材待上传", "暂无可用原素材", "素材上传中", "素材上传失败", "素材状态待确认"].enumerated() { + let cell = try await visibleCell(list, path: IndexPath(item: 0, section: index + 3), window: window) + XCTAssertTrue(texts(cell).contains(title)) + } + XCTAssertEqual(controller.viewModel.selectableMaterialIDs.count, 0) + XCTAssertFalse(try XCTUnwrap(find(controller.view, id: "drone.materials.remote.download") as? UIButton).isEnabled) + } + + /// 进入页面后才读取两个接口,整单次数来自详情而不是任务总数。 + func testAppearanceLoadsDetailAndTasksWithWholeOrderCounts() async throws { + let tasks = [task(3, status: 40), task(2, status: 10), task(1, status: 30)] + let (controller, session) = try makeController([detail(), taskList(tasks)]) + XCTAssertTrue(session.requests.isEmpty) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 3 && self.texts(controller.view).contains("3次拍摄 · 最新在前") } + XCTAssertEqual(controller.title, "订单素材库") + XCTAssertTrue(texts(controller.view).contains("游客 130****0001")) + XCTAssertTrue(texts(controller.view).contains { $0.contains("含5次拍摄 · 已拍摄1次 · 剩余4次") }) + XCTAssertEqual(controller.viewModel.tasks.map(\.id), [3, 2, 1]) + XCTAssertEqual(session.requests.map { $0.url?.path.components(separatedBy: "/").suffix(2).joined(separator: "/") }, ["orders/detail", "multi-plane/tasks"]) + for request in session.requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertNil(request.httpBody) + XCTAssertEqual(query(request)["order_number"], number) + XCTAssertEqual(query(request)["scenic_id"], "128") + XCTAssertNil(query(request)["scenic_spot_id"]) + XCTAssertNil(query(request)["page"]) + XCTAssertNil(query(request)["page_size"]) + } + capture(window, name: "订单素材库-真实接口结构") + } + + /// 点位筛选与切回全部只请求 tasks,空态保留整单摘要与所有标签。 + func testPointFilterOnlyReloadsTasksAndAllOmitsPointParameter() async throws { + let (controller, session) = try makeController([detail(), taskList([task(1)]), taskList([]), taskList([task(2)])]) + let window = show(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.total == 1 } + let list = try collection(controller) + try selectFilter(201, list: list) + try await settle(window) { controller.viewModel.total == 0 && self.texts(controller.view).contains("当前点位暂无任务记录") } + XCTAssertTrue(texts(controller.view).contains { $0.contains("含5次拍摄 · 已拍摄1次 · 剩余4次") }) + XCTAssertEqual(controller.viewModel.spots.map(\.id), [201, 202]) + let selected = try XCTUnwrap(find(controller.view, id: "drone.materials.filter.201")) + XCTAssertTrue(selected.accessibilityTraits.contains(.selected)) + try selectFilter(nil, list: list) + try await settle(window) { controller.viewModel.tasks.first?.id == 2 } + XCTAssertEqual(session.requests.count, 4) + XCTAssertTrue(session.requests.dropFirst().allSatisfy { $0.url?.path.hasSuffix("/tasks") == true }) + XCTAssertEqual(session.requests.map { query($0)["scenic_spot_id"] }, [nil, nil, "201", nil]) + } + + /// 摘要错误和任务错误各自可重试;任务重试不会再次读取成功的摘要。 + func testDetailAndTaskFailuresRetryTheirOwnReads() async throws { + let error = try TestJSON.errorEnvelope(code: 160001, msg: "测试服务暂不可用") + let (controller, session) = try makeController([error, detail(), error, taskList([])]) + let window = show(controller) + defer { close(window) } + try await settle(window) { self.texts(controller.view).contains("订单信息加载失败") } + XCTAssertNil(find(controller.view, id: "drone.materials.remote.order")) + try retry(controller) + try await settle(window) { self.texts(controller.view).contains("任务素材加载失败") } + XCTAssertNotNil(find(controller.view, id: "drone.materials.remote.order")) + XCTAssertFalse(texts(controller.view).contains("暂无任务记录")) + try retry(controller) + try await settle(window) { self.texts(controller.view).contains("暂无任务记录") } + XCTAssertTrue(texts(controller.view).contains("0次拍摄 · 最新在前")) + XCTAssertEqual(session.requests.filter { $0.url?.path.hasSuffix("/orders/detail") == true }.count, 2) + XCTAssertEqual(session.requests.filter { $0.url?.path.hasSuffix("/tasks") == true }.count, 2) + } + + /// 未生成素材的待飞、失败、取消和未知任务均可见,不误算成成功拍摄。 + func testTasksWithoutMediaKeepFlightStatusesAndUnknownPlaceholders() async throws { + var unknown = task(7, status: 999) + unknown["scenic_spot_name"] = NSNull() + unknown["air_line_name"] = NSNull() + unknown["created_at"] = NSNull() + let tasks = [task(1, status: 10), task(2, status: 20), task(3, status: 30), task(4, status: 40), task(5, status: 50), task(6, status: 60), unknown] + let (controller, _) = try makeController([detail(), taskList(tasks)]) + let window = show(controller) + defer { close(window) } + let list = try collection(controller) + try await settle(window) { controller.viewModel.total == 7 && list.numberOfSections == 10 } + for (index, status) in ["待飞行", "执行中", "飞行成功", "飞行失败", "已取消", "待确认", "飞行状态待确认"].enumerated() { + let cell = try await visibleCell(list, path: IndexPath(item: 0, section: index + 3), window: window) + XCTAssertTrue(texts(cell).contains { $0.contains(status) }) + XCTAssertTrue(texts(cell).contains { $0.contains("暂无原素材") }) + XCTAssertFalse(texts(cell).contains { $0.contains("暂无视频成片") }) + if index == 6 { + XCTAssertTrue(texts(cell).contains { $0.contains("点位 201") }) + XCTAssertTrue(texts(cell).contains { $0.contains("航线待确认") && $0.contains("时间待确认") }) + } + } + } + + /// 已交付成片不进入素材列表;仅已就绪的原素材可以预览和选择。 + func testMediaReadinessShowsOnlyOriginalFilesAndExcludesFilm() async throws { + var record = task(1, status: 30) + record["materials"] = [file(11, status: 1, url: "https://example.invalid/raw.mp4"), file(12, status: 2), file(13, status: 3), file(14, status: 1)] + record["film"] = ["id": 21, "task_id": 1, "file_name": "测试成片.mp4", "file_url": "https://example.invalid/film.mp4"] + var previews: [URL] = [] + let (controller, _) = try makeController([detail(), taskList([record])], previewFactory: { url, _, _ in + previews.append(url) + return UIViewController() + }) + let window = show(controller) + defer { close(window) } + let list = try collection(controller) + try await settle(window) { controller.viewModel.total == 1 && list.numberOfSections == 5 } + XCTAssertEqual(list.numberOfItems(inSection: 4), 4) + XCTAssertEqual(controller.viewModel.tasks.first?.film?.id, 21) + XCTAssertEqual(controller.viewModel.selectableMaterialIDs.count, 1) + let expected = ["上传完成 · 可下载", "上传中", "上传失败", "暂不可预览"] + for (index, state) in expected.enumerated() { + let path = IndexPath(item: index, section: 4) + let cell = try await visibleCell(list, path: path, window: window) + XCTAssertTrue(texts(cell).contains(state)) + XCTAssertFalse(texts(cell).contains { $0.contains("测试成片") || $0.contains("视频成片") }) + if index == 0 { + XCTAssertTrue(cell.accessibilityTraits.contains(.button)) + XCTAssertFalse(cell.accessibilityTraits.contains(.notEnabled)) + } else { + XCTAssertTrue(cell.accessibilityTraits.contains(.notEnabled)) + list.delegate?.collectionView?(list, didSelectItemAt: path) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertNil(controller.presentedViewController) + } + } + XCTAssertTrue(previews.isEmpty) + XCTAssertNil(find(controller.view, id: "drone.materials.remote.film.1.21")) + let raw = try await visibleCell(list, path: IndexPath(item: 0, section: 4), window: window) + capture(window, name: "订单素材库-仅展示原素材") + try XCTUnwrap(find(raw, id: "drone.materials.remote.file.1.11.preview") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.viewControllers.count == 2 } + XCTAssertEqual(previews.map(\.absoluteString), ["https://example.invalid/raw.mp4"]) + } + + /// 只有成片的任务仍保留交付入口和原素材空态,不展示成片或让其参与下载。 + func testFilmOnlyTaskKeepsOriginalMaterialEmptyStateAndFixedDeliveryTitle() async throws { + var record = task(1, status: 30) + record["material_status"] = 0 + record["film"] = ["id": 21, "task_id": 1, "file_name": "隐藏的已交付成片.mp4", + "file_url": "https://example.invalid/film.mp4"] + var previews = 0 + let (controller, session) = try makeController([detail(canUpload: true), taskList([record])], + previewFactory: { _, _, _ in previews += 1; return UIViewController() }) + let window = show(controller) + defer { close(window) } + let list = try collection(controller) + try await settle(window) { controller.viewModel.total == 1 && list.numberOfSections == 4 } + let recordCell = try await visibleCell(list, path: IndexPath(item: 0, section: 3), window: window) + let labels = texts(recordCell) + XCTAssertTrue(labels.contains("素材待上传")) + XCTAssertFalse(labels.contains { $0.contains("隐藏的已交付成片") || $0.contains("暂无视频成片") || $0.contains("替换成片") }) + XCTAssertEqual(controller.viewModel.tasks.first?.film?.id, 21) + XCTAssertTrue(controller.viewModel.selectableMaterialIDs.isEmpty) + XCTAssertEqual(controller.viewModel.selectedCount, 0) + XCTAssertNil(find(controller.view, id: "drone.materials.remote.film.1.21")) + let delivery = try XCTUnwrap(find(recordCell, id: "drone.materials.remote.delivery.1") as? UIButton) + XCTAssertEqual(delivery.configuration?.title, "交付成片") + XCTAssertFalse(delivery.isHidden) + XCTAssertFalse(try XCTUnwrap(find(controller.view, id: "drone.materials.remote.download") as? UIButton).isEnabled) + list.delegate?.collectionView?(list, didSelectItemAt: IndexPath(item: 0, section: 3)) + XCTAssertEqual(previews, 0) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(session.requests.count, 2) + capture(window, name: "订单素材库-仅有成片仍显示原素材空态") + } + + /// 下拉刷新重新读取两个接口,保留购买快照中仍有效的点位。 + func testRefreshKeepsPointAndUpdatesWholeOrderSummary() async throws { + let (controller, session) = try makeController([detail(), taskList([]), taskList([]), detail(used: 2), taskList([])]) + let window = show(controller) + defer { close(window) } + let list = try collection(controller) + try await settle(window) { controller.viewModel.total == 0 } + try selectFilter(201, list: list) + try await settle(window) { controller.viewModel.selectedSpotID == 201 && session.requests.count == 3 } + try XCTUnwrap(list.refreshControl).sendActions(for: .valueChanged) + try await settle(window) { controller.viewModel.detail?.order.shotUsed == 2 && session.requests.count == 5 && self.texts(controller.view).contains { $0.contains("含5次拍摄 · 已拍摄2次 · 剩余3次") } } + XCTAssertEqual(controller.viewModel.selectedSpotID, 201) + XCTAssertEqual(query(session.requests[3])["scenic_spot_id"], nil) + XCTAssertEqual(query(session.requests[4])["scenic_spot_id"], "201") + } + + /// 有无已有成片均显示交付成片,选择云端仍预选同一任务;关闭弹窗只刷新一次来源素材。 + func testTaskDeliveryEntryPreselectsTaskAndRefreshesAfterReturn() async throws { + for hasFilm in [false, true] { + var record = task(2, status: 30) + record["scenic_spot_id"] = 202 + record["scenic_spot_name"] = "测试点位二" + if hasFilm { record["film"] = ["id": 21, "task_id": 2, "file_name": "原成片.mp4", "file_url": ""] } + var destinationSession: MockURLSession? + var factoryCount = 0 + let (controller, session) = try makeController([detail(canUpload: true), taskList([record]), detail(canUpload: true), taskList([record])], + deliveryFactory: { order, context, taskID in + factoryCount += 1 + XCTAssertEqual(taskID, 2) + let pair = try! DroneDockDeliveryNavigationFixtures.controller(context: context, order: order, taskID: taskID) + destinationSession = pair.1 + XCTAssertTrue(pair.1.requests.isEmpty) + return pair.0 + }) + let window = show(controller) + defer { close(window) } + let list = try collection(controller) + try await settle(window) { controller.viewModel.total == 1 && list.numberOfSections == 4 } + let taskCell = try await visibleCell(list, path: IndexPath(item: 0, section: 3), window: window) + let button = try XCTUnwrap(find(taskCell, id: "drone.materials.remote.delivery.2") as? UIButton) + XCTAssertEqual(button.configuration?.title, "交付成片") + XCTAssertFalse(texts(taskCell).contains { $0.contains("原成片.mp4") || $0.contains("暂无视频成片") }) + button.sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller)?.topViewController is DroneDockDeliveryMethodViewController } + let sheet = try XCTUnwrap(deliveryNavigation(from: controller)) + let methods = try XCTUnwrap(sheet.topViewController as? DroneDockDeliveryMethodViewController) + XCTAssertEqual(sheet.modalPresentationStyle, .pageSheet) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + XCTAssertTrue(texts(methods.view).contains("请选择本次交付方式")) + XCTAssertEqual(factoryCount, 0) + XCTAssertNil(destinationSession) + XCTAssertEqual(session.requests.count, 2) + capture(window, name: hasFilm ? "订单素材库-已有成片的交付方式弹窗" : "订单素材库-交付成片方式弹窗") + + try await selectDeliveryMethod("cloud", in: methods, window: window) + try await settle(window) { + guard let page = sheet.topViewController as? DroneDockDeliveryViewController else { return false } + return page.viewModel.selectedTaskID == 2 && sheet.transitionCoordinator == nil + } + let page = try XCTUnwrap(sheet.topViewController as? DroneDockDeliveryViewController) + XCTAssertEqual(factoryCount, 1) + XCTAssertEqual(sheet.viewControllers.count, 2) + XCTAssertTrue(sheet.isModalInPresentation) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(page.viewModel.selectedSpotID, 202) + XCTAssertEqual(page.viewModel.order.orderNumber, number) + XCTAssertEqual(page.viewModel.context, controller.viewModel.context) + XCTAssertNil(page.viewModel.video) + XCTAssertEqual(destinationSession?.requests.compactMap { $0.url?.lastPathComponent }, ["detail", "tasks"]) + XCTAssertTrue(destinationSession?.requests.allSatisfy { $0.httpMethod == "GET" } == true) + XCTAssertEqual(session.requests.count, 2) + capture(window, name: "订单素材库-弹窗内预选拍摄任务") + + if hasFilm { + let back = try XCTUnwrap(page.navigationItem.leftBarButtonItem) + UIApplication.shared.sendAction(try XCTUnwrap(back.action), to: back.target, from: back, for: nil) + try await settle(window) { sheet.topViewController === methods && sheet.transitionCoordinator == nil } + XCTAssertFalse(sheet.isModalInPresentation) + XCTAssertEqual(session.requests.count, 2) + try XCTUnwrap(find(methods.view, id: "drone.delivery.upload.close") as? UIButton).sendActions(for: .touchUpInside) + } else { + let closeButton = try XCTUnwrap(page.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.delivery.sheet.close" + }) + UIApplication.shared.sendAction(try XCTUnwrap(closeButton.action), to: closeButton.target, from: closeButton, for: nil) + } + try await settle(window) { + self.deliveryNavigation(from: controller) == nil && session.requests.count == 4 + && controller.viewModel.total == 1 && !controller.viewModel.isLoadingTasks + } + XCTAssertEqual(session.requests.compactMap { $0.url?.lastPathComponent }, ["detail", "tasks", "detail", "tasks"]) + XCTAssertEqual(factoryCount, 1) + XCTAssertEqual(destinationSession?.requests.count, 2) + } + } + + /// 连点交付只弹出一个方式窗;仅查看或取消方式不重新请求接口,也不清空点位与勾选。 + func testDeliverySheetCancelPreservesFilterAndSelectionWithoutRequests() async throws { + var record = task(1, status: 30) + record["materials"] = [file(11, status: 1, url: "https://example.invalid/raw.mp4")] + var factoryCount = 0 + let (controller, session) = try makeController([detail(canUpload: true), taskList([record]), taskList([record])], + deliveryFactory: { _, _, _ in + factoryCount += 1 + return UIViewController() + }) + let window = show(controller) + defer { close(window) } + let list = try collection(controller) + try await settle(window) { controller.viewModel.total == 1 && list.numberOfSections == 5 } + try selectFilter(201, list: list) + try await settle(window) { controller.viewModel.selectedSpotID == 201 && session.requests.count == 3 } + try XCTUnwrap(find(controller.view, id: "drone.materials.selectAll") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.selectedCount == 1 } + let taskCell = try await visibleCell(list, path: IndexPath(item: 0, section: 3), window: window) + let button = try XCTUnwrap(find(taskCell, id: "drone.materials.remote.delivery.1") as? UIButton) + button.sendActions(for: .touchUpInside) + button.sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller)?.topViewController is DroneDockDeliveryMethodViewController } + let sheet = try XCTUnwrap(deliveryNavigation(from: controller)) + let methods = try XCTUnwrap(sheet.topViewController as? DroneDockDeliveryMethodViewController) + button.sendActions(for: .touchUpInside) + XCTAssertTrue(deliveryNavigation(from: controller) === sheet) + XCTAssertNil(sheet.presentedViewController) + XCTAssertEqual(factoryCount, 0) + XCTAssertEqual(session.requests.count, 3) + try XCTUnwrap(find(methods.view, id: "drone.delivery.upload.close") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller) == nil } + XCTAssertEqual(controller.viewModel.selectedSpotID, 201) + XCTAssertEqual(controller.viewModel.selectedCount, 1) + XCTAssertEqual(controller.viewModel.tasks.map(\.id), [1]) + XCTAssertEqual(session.requests.count, 3) + XCTAssertEqual(factoryCount, 0) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" }) + } + + private func makeController(_ responses: [Data], + deliveryFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil, + previewFactory: ((URL, Bool, String) -> UIViewController)? = nil, + downloadModel: DroneDockMaterialDownloadViewModel? = nil) throws -> (DroneDockMaterialsViewController, MockURLSession) { + let context = DroneDockHomeContext(userID: "materials-ui-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "materials-ui-token") + let session = MockURLSession(responses: responses) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "materials-ui-token" } + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, from: JSONSerialization.data(withJSONObject: ["order_number": number])) + let model = DroneDockMaterialsViewModel(context: context, order: order, service: DroneDockMaterialsAPI(client: client), currentContext: { context }) + return (DroneDockMaterialsViewController(viewModel: model, deliveryControllerFactory: deliveryFactory, + thumbnailProvider: { _, _ in nil }, + mediaPreviewControllerFactory: previewFactory, + downloadViewModel: downloadModel), session) + } + + private func detail(used: Int = 1, canUpload: Bool = false, + pointNames: [String] = ["测试点位一", "测试点位二"]) throws -> Data { + try envelope(["order_number": number, "user_phone": "130****0001", "project_name": "测试航拍套餐", + "order_status": 20, "can_upload_film": canUpload, + "shoot_count": 5, "shot_count": used, "remaining_count": 5 - used, "shoot_status": "processing", + "spot": pointNames.enumerated().map { ["scenic_spot_id": 201 + $0.offset, "scenic_spot_name": $0.element] }]) + } + + private func taskList(_ tasks: [[String: Any]]) throws -> Data { + try envelope(["order_number": number, "total": tasks.count, "list": tasks]) + } + + private func envelope(_ value: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": value]) + } + + private func task(_ id: Int, status: Int = 10) -> [String: Any] { + ["id": id, "task_id": id, "order_number": number, "scenic_spot_id": 201, "scenic_spot_name": "测试点位一", + "air_line_name": "测试航线", "seq": id, "flight_status": status, "created_at": "2026-10-28 12:00:00", + "materials": [], "film": NSNull()] + } + + private func file(_ id: Int, status: Int, url: String = "") -> [String: Any] { + ["id": id, "file_type": 2, "file_name": "测试视频\(id).mp4", "file_url": url, "upload_status": status] + } + + private func query(_ request: URLRequest) -> [String: String] { + Dictionary(uniqueKeysWithValues: (URLComponents(url: request.url!, resolvingAgainstBaseURL: false)?.queryItems ?? []).map { ($0.name, $0.value ?? "") }) + } + + private func collection(_ controller: UIViewController) throws -> UICollectionView { + controller.loadViewIfNeeded() + return try XCTUnwrap(find(controller.view, id: "drone.materials.remote.list") as? UICollectionView) + } + + /// 模态交付挂在来源页或其导航容器上时均可取得同一个弹窗。 + private func deliveryNavigation(from controller: UIViewController) -> UINavigationController? { + (controller.presentedViewController ?? controller.navigationController?.presentedViewController) as? UINavigationController + } + + /// 通过列表代理选择真实方式单元格,不直接跳过方式页回调。 + private func selectDeliveryMethod(_ method: String, in controller: UIViewController, window: UIWindow) async throws { + let list = try XCTUnwrap(find(controller.view, id: "drone.delivery.method.list") as? UICollectionView) + let identifier = "drone.delivery.method.\(method)" + try await settle(window) { self.find(list, id: identifier) != nil } + let cell = try XCTUnwrap(find(list, id: identifier) as? UICollectionViewCell) + let path = try XCTUnwrap(list.indexPath(for: cell)) + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + + private func selectFilter(_ id: Int?, list: UICollectionView) throws { + let cell = try XCTUnwrap(find(list, id: "drone.materials.filter.\(id.map(String.init) ?? "all")") as? UICollectionViewCell) + let path = try XCTUnwrap(list.indexPath(for: cell)) + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + + private func retry(_ controller: UIViewController) throws { + try XCTUnwrap(find(controller.view, id: "drone.materials.remote.retry") as? UIButton).sendActions(for: .touchUpInside) + } + + private func visibleCell(_ list: UICollectionView, path: IndexPath, window: UIWindow) async throws -> UICollectionViewCell { + list.scrollToItem(at: path, at: .centeredVertically, animated: false) + try await settle(window) { list.cellForItem(at: path) != nil } + return try XCTUnwrap(list.cellForItem(at: path)) + } + + private func show(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, file: StaticString = #filePath, line: UInt = #line, + until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 300_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + capture(window, name: "素材库等待超时-\(line)") + XCTFail("素材页未在预期时间内稳定显示", file: file, line: line) + throw NSError(domain: "DroneDockMaterialsViewTests", code: 1) + } + + private func descendants(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap(descendants) } + private func hidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(hidden) ?? false) } + private func find(_ root: UIView, id: String) -> UIView? { descendants(root).first { $0.accessibilityIdentifier == id && !hidden($0) } } + private func texts(_ root: UIView) -> [String] { + descendants(root).compactMap { view in + guard let label = view as? UILabel, !hidden(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + + private func capture(_ window: UIWindow, name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 下载替身只写独立临时文件,支持单次失败和可控的取消迟到响应。 +private actor OrderMaterialsViewDownloadStub: CloudFileDownloading { + private let failOnceSuffix: String? + private let suspendFirst: Bool + private var didFail = false + private var firstStarted = false + private var continuation: CheckedContinuation? + private var startWaiter: CheckedContinuation? + private(set) var addresses: [String] = [] + + init(failOnceSuffix: String? = nil, suspendFirst: Bool = false) { + self.failOnceSuffix = failOnceSuffix + self.suspendFirst = suspendFirst + } + + func downloadFile(remoteURL: String, fileName: String, + onProgress: @escaping @Sendable (Int) -> Void) async throws -> URL { + addresses.append(remoteURL) + if suspendFirst, addresses.count == 1 { + await withCheckedContinuation { continuation in + self.continuation = continuation + self.firstStarted = true + self.startWaiter?.resume() + self.startWaiter = nil + } + } + if let failOnceSuffix, remoteURL.hasSuffix(failOnceSuffix), !didFail { + didFail = true + throw ScenicMaterialDownloadError.httpFailure(503) + } + let local = FileManager.default.temporaryDirectory.appendingPathComponent("order-material-test-\(UUID().uuidString)-\(fileName)") + try Data("mock-media".utf8).write(to: local) + onProgress(100) + return local + } + + func waitForFirstStart() async { + if firstStarted { return } + await withCheckedContinuation { startWaiter = $0 } + } + + func releaseFirst() { continuation?.resume(); continuation = nil } +} + +/// 相册替身只记录保存媒体类型,权限拒绝与成功均不访问系统 Photos。 +private actor OrderMaterialsViewPhotoStub: CloudPhotoSaving { + private let denyPermission: Bool + private(set) var fileTypes: [Int] = [] + + init(denyPermission: Bool = false) { self.denyPermission = denyPermission } + + func saveToPhotoLibrary(fileURL: URL, fileType: Int) async throws { + guard !denyPermission else { throw CloudTransferError.photoPermissionDenied } + fileTypes.append(fileType) + } +} diff --git a/suixinkanTests/DroneDockNearbyTransferPageTests.swift b/suixinkanTests/DroneDockNearbyTransferPageTests.swift new file mode 100644 index 0000000..8328c1d --- /dev/null +++ b/suixinkanTests/DroneDockNearbyTransferPageTests.swift @@ -0,0 +1,62 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 局域网接收页安全与兼容性测试,不打开浏览器或连接网络。 +final class DroneDockNearbyTransferPageTests: XCTestCase { + private let path = "/s/" + String(repeating: "a1", count: 32) + "/video" + + /// 下载交给浏览器处理,页面不使用脚本将大视频读入内存。 + func testPageDownloadsFromSessionPathWithoutExternalDependencies() { + let page = DroneDockNearbyTransferPage.html(video: video(), downloadPath: path) + XCTAssertTrue(page.contains("href=\"\(path)\" download")) + XCTAssertTrue(page.contains("")) + XCTAssertTrue(page.contains("name=\"viewport\"")) + XCTAssertTrue(page.contains("我的 iPhone")) + XCTAssertTrue(page.contains("安卓下载后在哪里查看")) + XCTAssertTrue(page.contains("同一个 Wi-Fi")) + for forbidden in [" DroneDockDeliveryVideo { + DroneDockDeliveryVideo(url: URL(fileURLWithPath: "/unused/local-video.mp4"), fileName: name, fileSize: 12_345_678) + } +} diff --git a/suixinkanTests/DroneDockNearbyTransferServiceTests.swift b/suixinkanTests/DroneDockNearbyTransferServiceTests.swift new file mode 100644 index 0000000..3b9df3a --- /dev/null +++ b/suixinkanTests/DroneDockNearbyTransferServiceTests.swift @@ -0,0 +1,366 @@ +import Foundation +import Network +import XCTest +@testable import suixinkan + +/// 通过纯解析与回环 TCP 验证离线文件服务;不访问后端、云端或真实设备。 +final class DroneDockNearbyTransferServiceTests: XCTestCase { + /// HTTP 尾部 CRLF 是四个字节,不能按四个 Swift Character 截掉最后一个头的内容。 + func testLastHeaderPreservesFullHostPortAndRangeValue() { + let hostLast = Data("GET /s/test HTTP/1.1\r\nConnection: close\r\nHost: 127.0.0.1:12345\r\n\r\n".utf8) + XCTAssertEqual(DroneDockNearbyTransferHTTP.parse(hostLast)?.headers["host"], "127.0.0.1:12345") + let rangeLast = Data("GET /s/test/video HTTP/1.1\r\nHost: 127.0.0.1:12345\r\nRange: bytes=0-9\r\n\r\n".utf8) + XCTAssertEqual(DroneDockNearbyTransferHTTP.parse(rangeLast)?.headers["range"], "bytes=0-9") + let malformedLast = Data("GET / HTTP/1.1\r\nHost: 127.0.0.1:12345\r\nX-Test: a\nb\r\n\r\n".utf8) + XCTAssertNil(DroneDockNearbyTransferHTTP.parse(malformedLast)) + } + + /// 只接受有界、无请求体且头部无歧义的 HTTP 请求。 + func testRequestParserRejectsAmbiguousAndOversizedHeaders() { + let valid = Data("GET /s/test HTTP/1.1\r\nHost: 127.0.0.1:9000\r\nRange: bytes=0-9\r\n\r\n".utf8) + let result = DroneDockNearbyTransferHTTP.parse(valid) + XCTAssertEqual(result?.target, "/s/test") + XCTAssertEqual(result?.headers["range"], "bytes=0-9") + for request in [ + "GET / HTTP/1.1\r\n\r\n", + "GET / HTTP/2.0\r\nHost: test\r\n\r\n", + "GET / HTTP/1.1\r\nHost: test\r\n\r\n", + "GET / HTTP/1.1\r\nHost: test\r\nHOST: other\r\n\r\n", + "GET / HTTP/1.1\r\nHost: test\r\nContent-Length: 1\r\n\r\n", + "GET / HTTP/1.1\r\nHost: test\r\nTransfer-Encoding: chunked\r\n\r\n", + "GET / HTTP/1.1\r\nHost: test\r\nBad Header: value\r\n\r\n", + "GET / HTTP/1.1\r\nHost: test\r\nX-Test: a\nb\r\n\r\n" + ] { XCTAssertNil(DroneDockNearbyTransferHTTP.parse(Data(request.utf8)), request) } + XCTAssertNil(DroneDockNearbyTransferHTTP.parse(Data(repeating: 65, count: DroneDockNearbyTransferHTTP.maximumHeaderBytes + 1))) + } + + /// Range 支持单段、尾段和开放结尾,不接受多段、负数、反序或整数溢出。 + func testByteRangesCoverBoundariesAndRejectInvalidInput() { + typealias Range = DroneDockNearbyTransferHTTP.ByteRange + XCTAssertEqual(DroneDockNearbyTransferHTTP.range("bytes=0-9", size: 100), Range(lower: 0, upper: 9)) + XCTAssertEqual(DroneDockNearbyTransferHTTP.range("bytes=90-", size: 100), Range(lower: 90, upper: 99)) + XCTAssertEqual(DroneDockNearbyTransferHTTP.range("bytes=-10", size: 100), Range(lower: 90, upper: 99)) + XCTAssertEqual(DroneDockNearbyTransferHTTP.range("bytes=-200", size: 100), Range(lower: 0, upper: 99)) + XCTAssertEqual(DroneDockNearbyTransferHTTP.range("bytes=99-999", size: 100), Range(lower: 99, upper: 99)) + for value in ["bytes=", "bytes=-", "bytes=-0", "bytes=100-", "bytes=9-1", "bytes=0-1,2-3", "items=0-1", + "bytes=+1-5", "bytes=1 -5", "bytes=0-999999999999999999999999999999", "bytes=--5"] { + XCTAssertNil(DroneDockNearbyTransferHTTP.range(value, size: 100), value) + } + XCTAssertNil(DroneDockNearbyTransferHTTP.range("bytes=0-", size: 0)) + } + + /// 正式地址策略排除公网、回环、蜂窝常见 CGNAT 与无效 IPv4。 + func testEndpointPolicyOnlyAcceptsPrivateIPv4() { + for address in ["10.1.2.3", "172.16.0.1", "172.31.255.254", "192.168.10.2"] { + XCTAssertTrue(DroneDockNearbyTransferEndpoint.isPrivateIPv4(address), address) + } + for address in ["127.0.0.1", "0.0.0.0", "8.8.8.8", "100.64.0.1", "172.15.0.1", "172.32.0.1", "192.169.1.1", + "10.0.0.256", "10.0.0.-1", "10.0.1", "::1", "10.0.0.1evil"] { + XCTAssertFalse(DroneDockNearbyTransferEndpoint.isPrivateIPv4(address), address) + } + } + + /// 页面、中文下载文件名和完整文件均由同一个回环服务返回,进度保持单调且不超过文件大小。 + func testLocalPageAndWholeVideoTransfer() async throws { + let fixture = try LocalVideoFixture(size: 256 * 1_024 + 17) + defer { fixture.remove() } + let events = TransferEvents() + let server = server() + defer { server.stop() } + let session = try await server.start(video: fixture.video, onEvent: events.append) + XCTAssertEqual(session.url.scheme, "http") + XCTAssertEqual(session.url.host, "127.0.0.1") + XCTAssertEqual(session.url.lastPathComponent.count, 64) + XCTAssertNil(session.url.query) + let page = try await LocalHTTPExchange.request(url: session.url) + XCTAssertEqual(page.status, 200) + let html = try XCTUnwrap(String(data: page.body, encoding: .utf8)) + XCTAssertTrue(html.contains("面对面闪传")) + XCTAssertTrue(html.contains(session.url.path + "/video")) + XCTAssertFalse(html.contains("https://")) + XCTAssertEqual(page.headers["cache-control"], "no-store") + XCTAssertTrue(page.headers["content-security-policy"]?.contains("default-src 'none'") == true) + + let response = try await LocalHTTPExchange.request(url: session.url, target: session.url.path + "/video") + XCTAssertEqual(response.status, 200) + XCTAssertEqual(response.body, fixture.bytes) + XCTAssertEqual(response.headers["content-length"], String(fixture.bytes.count)) + XCTAssertEqual(response.headers["content-type"], "video/mp4") + XCTAssertTrue(response.headers["content-disposition"]?.contains("filename*=UTF-8''%") == true) + try await eventually { events.values.contains(.sent) } + let progress = events.values.compactMap { event -> Int64? in + if case .sending(let sent, _) = event { return sent } + return nil + } + XCTAssertEqual(progress.first, 0) + XCTAssertEqual(progress.last, Int64(fixture.bytes.count)) + for (before, after) in zip(progress, progress.dropFirst()) { + XCTAssertGreaterThan(after, before) + XCTAssertLessThanOrEqual(after, Int64(fixture.bytes.count)) + } + } + + /// HEAD 不读文件体也不报告发送完成;局部响应结束与整片发送完成分开。 + func testHeadAndPartialRangesDoNotReportWholeFileSent() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let events = TransferEvents() + let server = server() + defer { server.stop() } + let session = try await server.start(video: fixture.video, onEvent: events.append) + let path = session.url.path + "/video" + let head = try await LocalHTTPExchange.request(url: session.url, target: path, method: "HEAD") + XCTAssertEqual(head.status, 200) + XCTAssertEqual(head.headers["content-length"], "100") + XCTAssertTrue(head.body.isEmpty) + XCTAssertTrue(events.values.isEmpty) + + for (range, expected) in [("bytes=0-1", 0..<2), ("bytes=-10", 90..<100), ("bytes=95-", 95..<100)] { + let response = try await LocalHTTPExchange.request(url: session.url, target: path, headers: ["Range": range]) + XCTAssertEqual(response.status, 206) + XCTAssertEqual(response.body, fixture.bytes.subdata(in: expected)) + } + try await eventually { events.values.filter { $0 == .partialSent }.count == 3 } + XCTAssertFalse(events.values.contains(.sent)) + let full = try await LocalHTTPExchange.request(url: session.url, target: path, headers: ["Range": "bytes=0-"]) + XCTAssertEqual(full.status, 206) + XCTAssertEqual(full.body, fixture.bytes) + try await eventually { events.values.contains(.sent) } + } + + /// 随机凭证、Host 与精确路径共同限制访问,不开放目录、任意文件或跨域路由。 + func testInvalidTokensPathsMethodsAndRangesAreRejected() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let server = server() + defer { server.stop() } + let session = try await server.start(video: fixture.video) { _ in } + for path in ["/", "/s/wrong", session.url.path + "/other", session.url.path + "/video?token=anything", + session.url.path + "/../video", session.url.path + "%2fvideo"] { + let response = try await LocalHTTPExchange.request(url: session.url, target: path) + XCTAssertEqual(response.status, 404, path) + } + let host = try await LocalHTTPExchange.request(url: session.url, headers: ["Host": "public.example"]) + XCTAssertEqual(host.status, 403) + let post = try await LocalHTTPExchange.request(url: session.url, method: "POST") + XCTAssertEqual(post.status, 405) + XCTAssertEqual(post.headers["allow"], "GET, HEAD") + let range = try await LocalHTTPExchange.request(url: session.url, target: session.url.path + "/video", headers: ["Range": "bytes=100-"]) + XCTAssertEqual(range.status, 416) + XCTAssertEqual(range.headers["content-range"], "bytes */100") + } + + /// 每次重建都轮换凭证;显式结束后不再提供接收页。 + func testRestartRotatesTokenAndStopClosesListener() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let server = server() + let first = try await server.start(video: fixture.video) { _ in } + let second = try await server.start(video: fixture.video) { _ in } + XCTAssertNotEqual(first.id, second.id) + XCTAssertNotEqual(first.url.path, second.url.path) + let oldToken = try await LocalHTTPExchange.request(url: second.url, target: first.url.path) + XCTAssertEqual(oldToken.status, 404) + server.stop() + await assertConnectionFails(second.url) + } + + /// 文件在会话中被修改时拒绝继续发送,不能使用过期长度截断或泄露其他内容。 + func testChangedFileIsRejected() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let events = TransferEvents() + let server = server() + defer { server.stop() } + let session = try await server.start(video: fixture.video, onEvent: events.append) + try (fixture.bytes + Data([1])).write(to: fixture.video.url) + let response = try await LocalHTTPExchange.request(url: session.url, target: session.url.path + "/video") + XCTAssertEqual(response.status, 409) + XCTAssertFalse(events.values.contains(.sent)) + } + + /// 到期时关闭整个会话,已失效二维码无法再次获取文件。 + func testExpiryStopsSessionAndReportsReason() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let events = TransferEvents() + let server = server(lifetime: 0.25) + defer { server.stop() } + let session = try await server.start(video: fixture.video, onEvent: events.append) + try await eventually { + events.values.contains { if case .failed(let message) = $0 { return message.contains("到期") }; return false } + } + await assertConnectionFails(session.url) + } + + /// 无局域网时返回明确错误,不生成不可达二维码。 + func testMissingNetworkAndInvalidFilesFailBeforeServing() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let server = DroneDockNearbyTransferServer(endpointProvider: { throw DroneDockNearbyTransferError.noLocalNetwork }) + do { _ = try await server.start(video: fixture.video) { _ in }; XCTFail("应拒绝无网络") } + catch { XCTAssertEqual(error as? DroneDockNearbyTransferError, .noLocalNetwork) } + let remote = DroneDockDeliveryVideo(url: URL(string: "https://example.invalid/video.mp4")!, fileName: "video.mp4", fileSize: 1) + do { _ = try await server.start(video: remote) { _ in }; XCTFail("应拒绝远程文件") } + catch { XCTAssertEqual(error as? DroneDockFilmError, .invalidLocalFile) } + } + + /// 已取消的任务不能通过 start 打开监听。 + func testCancelledStartNeverProducesSessionOrEvents() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let events = TransferEvents() + let server = server() + defer { server.stop() } + let task = Task { + // 留出取消时机,随后仍显式调用 start,验证服务自己的取消检查。 + try? await Task.sleep(nanoseconds: 50_000_000) + return try await server.start(video: fixture.video, onEvent: events.append) + } + task.cancel() + do { _ = try await task.value; XCTFail("取消后不能返回会话") } + catch { XCTAssertTrue(error is CancellationError) } + XCTAssertTrue(events.values.isEmpty) + } + + /// 过大的未完成请求头得到 431,缓冲上限不会跟随请求大小增长。 + func testOversizedHeaderIsRejectedOnRealSocket() async throws { + let fixture = try LocalVideoFixture(size: 100) + defer { fixture.remove() } + let server = server() + defer { server.stop() } + let session = try await server.start(video: fixture.video) { _ in } + let raw = "GET / HTTP/1.1\r\nHost: 127.0.0.1:\(session.url.port!)\r\nX-Large: " + String(repeating: "a", count: DroneDockNearbyTransferHTTP.maximumHeaderBytes) + let response = try await LocalHTTPExchange.request(url: session.url, raw: raw) + XCTAssertEqual(response.status, 431) + } + + private func server(lifetime: TimeInterval = 600) -> DroneDockNearbyTransferServer { + DroneDockNearbyTransferServer(endpointProvider: { .init(address: "127.0.0.1", interfaceName: "lo0") }, lifetime: lifetime) + } + + private func eventually(_ condition: @escaping () -> Bool) async throws { + for _ in 0..<200 { + if condition() { return } + try await Task.sleep(nanoseconds: 10_000_000) + } + XCTFail("本地服务未进入预期状态") + } + + private func assertConnectionFails(_ url: URL) async { + do { _ = try await LocalHTTPExchange.request(url: url); XCTFail("已停止的服务仍可访问") } + catch { } + } +} + +/// 文件服务测试使用固定字节内容,无需真实游客素材。 +private struct LocalVideoFixture { + let directory: URL + let video: DroneDockDeliveryVideo + let bytes: Data + + init(size: Int) throws { + directory = FileManager.default.temporaryDirectory.appendingPathComponent("nearby-tests-\(UUID().uuidString)") + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let url = directory.appendingPathComponent("测试成片.mp4") + bytes = Data((0..? + private var response = Data() + private var timeout: DispatchWorkItem? + + private init(connection: NWConnection, requestData: Data, continuation: CheckedContinuation) { + self.connection = connection; self.requestData = requestData; self.continuation = continuation + } + + static func request(url: URL, target: String? = nil, method: String = "GET", headers: [String: String] = [:], raw: String? = nil) async throws -> Response { + let port = try XCTUnwrap(url.port.flatMap { NWEndpoint.Port(rawValue: UInt16($0)) }) + var values = ["Host": "127.0.0.1:\(port.rawValue)", "Connection": "close"] + values.merge(headers) { _, new in new } + let request = raw ?? "\(method) \(target ?? url.path) HTTP/1.1\r\n" + values.map { "\($0.key): \($0.value)" }.joined(separator: "\r\n") + "\r\n\r\n" + let data: Data = try await withCheckedThrowingContinuation { continuation in + let exchange = LocalHTTPExchange(connection: NWConnection(host: "127.0.0.1", port: port, using: .tcp), + requestData: Data(request.utf8), continuation: continuation) + exchange.run() + } + return try Response(data: data) + } + + private func run() { + connection.stateUpdateHandler = { [self] state in + switch state { + case .ready: + connection.send(content: requestData, completion: .contentProcessed { [self] error in + if let error { finish(.failure(error)) } else { receive() } + }) + case .failed(let error): finish(.failure(error)) + case .cancelled: finish(.failure(URLError(.cancelled))) + default: break + } + } + let deadline = DispatchWorkItem { [weak self] in self?.finish(.failure(URLError(.timedOut))) } + timeout = deadline + queue.asyncAfter(deadline: .now() + 3, execute: deadline) + connection.start(queue: queue) + } + + private func receive() { + connection.receive(minimumIncompleteLength: 1, maximumLength: 64 * 1_024) { [self] data, _, complete, error in + guard continuation != nil else { return } + if let data { response.append(data) } + if complete { finish(.success(response)) } + else if let error { finish(.failure(error)) } + else { receive() } + } + } + + private func finish(_ result: Result) { + guard let pending = continuation else { return } + continuation = nil + timeout?.cancel() + connection.stateUpdateHandler = nil + connection.cancel() + pending.resume(with: result) + } +} diff --git a/suixinkanTests/DroneDockNearbyTransferViewModelTests.swift b/suixinkanTests/DroneDockNearbyTransferViewModelTests.swift new file mode 100644 index 0000000..bc3ba42 --- /dev/null +++ b/suixinkanTests/DroneDockNearbyTransferViewModelTests.swift @@ -0,0 +1,238 @@ +import XCTest +@testable import suixinkan + +/// 闪传生命周期测试只使用本机临时文件和内存服务,不访问后端。 +final class DroneDockNearbyTransferViewModelTests: XCTestCase { + private var directory: URL! + private var video: DroneDockDeliveryVideo! + + override func setUpWithError() throws { + directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let url = directory.appendingPathComponent("测试成片.mp4") + try Data([1, 2, 3, 4]).write(to: url) + video = DroneDockDeliveryVideo(url: url, fileName: "测试成片.mp4", fileSize: 4) + } + + override func tearDownWithError() throws { + try FileManager.default.removeItem(at: directory) + } + + /// 没有文件不能创建会话。 + func testStartWithoutVideoDoesNothing() async { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + await model.start() + XCTAssertEqual(service.startCount, 0) + XCTAssertEqual(model.snapshot.phase, .idle) + XCTAssertFalse(model.snapshot.canStart) + } + + /// 完整发送与游客落盘是不同状态,发送结束仍允许核对或重新下载。 + func testSentKeepsSessionAndDoesNotClaimSavedToPhotos() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + XCTAssertTrue(try model.selectVideo(video)) + await model.start() + XCTAssertEqual(model.snapshot.phase, .waiting) + XCTAssertFalse(model.snapshot.canChooseVideo) + service.send(.visitorConnected) + XCTAssertEqual(model.snapshot.phase, .connected) + service.send(.sending(bytesSent: 2, totalBytes: 4)) + XCTAssertEqual(model.snapshot.progress, 0.5) + service.send(.sent) + XCTAssertEqual(model.snapshot.phase, .sent) + XCTAssertEqual(model.snapshot.progress, 1) + XCTAssertNotNil(model.snapshot.session) + XCTAssertTrue(model.snapshot.isActive) + XCTAssertTrue(model.snapshot.message?.contains("核对下载结果") == true) + XCTAssertFalse(model.snapshot.message?.contains("已保存") == true) + } + + /// 选择无效文件时保留旧文件;当前会话锁定后不能更换视频。 + func testInvalidAndActiveSelectionDoNotReplaceVideo() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + let invalid = DroneDockDeliveryVideo(url: video.url, fileName: "bad\nname.mp4", fileSize: 4) + XCTAssertThrowsError(try model.selectVideo(invalid)) + XCTAssertEqual(model.snapshot.video, video) + await model.start() + let replacement = DroneDockDeliveryVideo(url: video.url, fileName: "另一个视频.mp4", fileSize: 4) + XCTAssertFalse(try model.selectVideo(replacement)) + XCTAssertEqual(model.snapshot.video, video) + } + + /// 重复开始不会创建两份可访问同一文件的会话。 + func testRepeatedStartDoesNotCreateAnotherSession() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + await model.start() + XCTAssertEqual(service.startCount, 1) + } + + /// 网络连接失败后允许重试,不需要重新选择同一视频。 + func testFailureCanRetryWithSameVideo() async throws { + let service = NearbyViewModelService() + service.shouldFail = true + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + XCTAssertEqual(model.snapshot.phase, .failed) + XCTAssertTrue(model.snapshot.canStart) + XCTAssertNil(model.snapshot.session) + service.shouldFail = false + await model.start() + XCTAssertEqual(model.snapshot.phase, .waiting) + XCTAssertEqual(service.startCount, 2) + } + + /// 游客中断后保留二维码,允许从浏览器重新请求文件。 + func testInterruptedDownloadKeepsSessionForRetry() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + let session = model.snapshot.session + service.send(.sending(bytesSent: 2, totalBytes: 4)) + service.send(.interrupted) + XCTAssertEqual(model.snapshot.phase, .interrupted) + XCTAssertEqual(model.snapshot.session, session) + service.send(.sending(bytesSent: 1, totalBytes: 4)) + XCTAssertEqual(model.snapshot.phase, .sending) + XCTAssertEqual(model.snapshot.progress, 0.25) + } + + /// 结束后到达的发送回调不能恢复二维码或改变结束结果。 + func testStopRejectsLateEventsAndAllowsRestart() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + let original = model.snapshot.session + model.stop(message: "已离开前台") + service.send(.sent, index: 0) + XCTAssertEqual(model.snapshot.phase, .ended) + XCTAssertEqual(model.snapshot.message, "已离开前台") + XCTAssertNil(model.snapshot.session) + await model.start() + let current = model.snapshot.session + XCTAssertNotEqual(current?.id, original?.id) + service.send(.failed("旧会话错误"), index: 0) + XCTAssertEqual(model.snapshot.session, current) + XCTAssertEqual(model.snapshot.phase, .waiting) + } + + /// 会话启动尚未返回时停止,迟到的启动结果不会让页面重新等待扫码。 + func testStopWhileStartingRejectsLateSession() async throws { + let service = NearbyViewModelService() + service.shouldSuspend = true + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + let task = Task { await model.start() } + for _ in 0..<100 where !service.hasPendingStart { try await Task.sleep(for: .milliseconds(5)) } + XCTAssertEqual(model.snapshot.phase, .starting) + model.stop() + service.releaseStart() + await task.value + XCTAssertEqual(model.snapshot.phase, .ended) + XCTAssertNil(model.snapshot.session) + } + + /// 服务过期后清除接收地址并允许重新生成。 + func testServerExpirationInvalidatesQRCode() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + service.send(.stopped) + XCTAssertEqual(model.snapshot.phase, .ended) + XCTAssertNil(model.snapshot.session) + XCTAssertTrue(model.snapshot.canStart) + service.send(.sent) + XCTAssertEqual(model.snapshot.phase, .ended) + } + + /// 部分内容发送结束不能显示完整文件已发送。 + func testPartialRangeDoesNotReportWholeFileSent() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + service.send(.sending(bytesSent: 2, totalBytes: 2)) + service.send(.partialSent) + XCTAssertEqual(model.snapshot.phase, .connected) + XCTAssertNotNil(model.snapshot.session) + XCTAssertEqual(model.snapshot.progress, 0) + XCTAssertTrue(model.snapshot.message?.contains("部分内容") == true) + } + + /// 畸形进度也不会让进度条超过范围或除零。 + func testProgressClampsInvalidValues() async throws { + let service = NearbyViewModelService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(video) + await model.start() + service.send(.sending(bytesSent: 20, totalBytes: 4)) + XCTAssertEqual(model.snapshot.progress, 1) + service.send(.sending(bytesSent: -1, totalBytes: 0)) + XCTAssertEqual(model.snapshot.progress, 0) + } +} + +/// 支持迟到事件与延迟启动的内存服务,所有状态以锁保护。 +private final class NearbyViewModelService: DroneDockNearbyTransferServing, @unchecked Sendable { + private let lock = NSLock() + private var callbacks: [@Sendable (DroneDockNearbyTransferEvent) -> Void] = [] + private var pendingStart: CheckedContinuation? + private var failure = false + private var suspended = false + + /// 控制下一次启动失败,不发出网络请求。 + var shouldFail: Bool { + get { locked { failure } } + set { locked { failure = newValue } } + } + /// 延迟返回启动结果以验证取消竞争。 + var shouldSuspend: Bool { + get { locked { suspended } } + set { locked { suspended = newValue } } + } + /// 已接收到的启动次数。 + var startCount: Int { locked { callbacks.count } } + /// 延迟任务已保存 continuation,避免测试在挂起点之前释放。 + var hasPendingStart: Bool { locked { pendingStart != nil } } + + /// 返回一个只用于界面状态断言的测试地址。 + func start(video: DroneDockDeliveryVideo, onEvent: @escaping @Sendable (DroneDockNearbyTransferEvent) -> Void) async throws -> DroneDockNearbyTransferSession { + locked { callbacks.append(onEvent) } + if shouldFail { throw URLError(.notConnectedToInternet) } + if shouldSuspend { + await withCheckedContinuation { continuation in locked { pendingStart = continuation } } + } + return DroneDockNearbyTransferSession(id: UUID(), url: URL(string: "http://192.168.0.2:8000/s/test-session")!, expiresAt: Date().addingTimeInterval(600)) + } + + /// 停止不自动抹掉旧事件,便于模拟已排队的异步回调。 + func stop() {} + + /// 向指定代次发送事件;默认使用最新会话。 + func send(_ event: DroneDockNearbyTransferEvent, index: Int? = nil) { + let callback = locked { callbacks[index ?? callbacks.count - 1] } + callback(event) + } + + /// 释放延迟启动,模拟取消后仍到达的结果。 + func releaseStart() { + let continuation = locked { let value = pendingStart; pendingStart = nil; return value } + continuation?.resume() + } + + private func locked(_ block: () -> T) -> T { + lock.lock() + defer { lock.unlock() } + return block() + } +} diff --git a/suixinkanTests/DroneDockNearbyTransferViewTests.swift b/suixinkanTests/DroneDockNearbyTransferViewTests.swift new file mode 100644 index 0000000..91957e3 --- /dev/null +++ b/suixinkanTests/DroneDockNearbyTransferViewTests.swift @@ -0,0 +1,309 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 用内存服务检验闪传页的按钮、后台清理和完成文案,不访问设备或后端。 +@MainActor +final class DroneDockNearbyTransferViewTests: XCTestCase { + /// 未选片时不能生成二维码,不自动打开本地监听。 + func testInitialPageDoesNotStartService() throws { + let service = NearbyViewService() + let controller = DroneDockNearbyTransferViewController(customerTitle: "测试游客", orderNumber: "TEST-5018", viewModel: .init(service: service)) + let window = show(controller) + defer { close(window) } + XCTAssertFalse(try button(controller.view, "drone.nearby.primary").isEnabled) + XCTAssertEqual(service.startCount, 0) + XCTAssertEqual(try label(controller.view, "drone.nearby.status").text, "准备闪传") + XCTAssertNil(controller.viewModel.snapshot.session) + XCTAssertTrue(texts(in: controller.view).contains("测试游客")) + XCTAssertTrue(texts(in: controller.view).contains("订单尾号 5018")) + XCTAssertTrue(texts(in: controller.view).contains("双方连接同一 Wi-Fi 或手机热点")) + XCTAssertTrue(isHidden(try button(controller.view, "drone.nearby.copyAddress"))) + let choose = try button(controller.view, "drone.nearby.chooseVideo") + let center = choose.convert(CGPoint(x: choose.bounds.midX, y: choose.bounds.midY), to: window) + let hit = window.hitTest(center, with: nil) + XCTAssertTrue(hit === choose || hit?.isDescendant(of: choose) == true, "选择视频按钮必须可被实际触摸命中") + } + + /// 文件准备失败保持可重试,绝不调用传输服务。 + func testPickerErrorIsRecoverable() async throws { + let service = NearbyViewService() + let controller = DroneDockNearbyTransferViewController(customerTitle: "测试游客", viewModel: .init(service: service), videoPicker: { + throw URLError(.fileDoesNotExist) + }) + let window = show(controller) + defer { close(window) } + try button(controller.view, "drone.nearby.chooseVideo").sendActions(for: .touchUpInside) + try await settle { try self.label(controller.view, "drone.nearby.status").text == "视频准备失败" } + XCTAssertTrue(try button(controller.view, "drone.nearby.chooseVideo").isEnabled) + XCTAssertFalse(try button(controller.view, "drone.nearby.primary").isEnabled) + XCTAssertEqual(service.startCount, 0) + } + + /// 等待扫码和发送完成时保持亮屏,后台立即撤销二维码并恢复原亮屏设置。 + func testBackgroundStopsSessionAndRestoresIdleTimer() async throws { + let originalIdle = UIApplication.shared.isIdleTimerDisabled + UIApplication.shared.isIdleTimerDisabled = false + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { + try? FileManager.default.removeItem(at: directory) + UIApplication.shared.isIdleTimerDisabled = originalIdle + } + let file = directory.appendingPathComponent("测试视频.mp4") + try Data([1, 2, 3, 4]).write(to: file) + let video = DroneDockDeliveryVideo(url: file, fileName: "测试视频.mp4", fileSize: 4) + let service = NearbyViewService() + let model = DroneDockNearbyTransferViewModel(service: service) + let controller = DroneDockNearbyTransferViewController(customerTitle: "测试游客", viewModel: model, videoPicker: { video }) + let window = show(controller) + defer { close(window) } + try button(controller.view, "drone.nearby.chooseVideo").sendActions(for: .touchUpInside) + try await settle { model.snapshot.video != nil } + try button(controller.view, "drone.nearby.primary").sendActions(for: .touchUpInside) + try await settle { model.snapshot.session != nil && UIApplication.shared.isIdleTimerDisabled } + XCTAssertEqual(service.startCount, 1) + XCTAssertFalse(try button(controller.view, "drone.nearby.chooseVideo").isEnabled) + XCTAssertTrue(controller.navigationController?.isModalInPresentation == true) + let qr = try XCTUnwrap(find(controller.view, "drone.nearby.qr") as? UIImageView) + XCTAssertNotNil(qr.image) + service.send(.sent) + try await settle { try self.label(controller.view, "drone.nearby.status").text == "文件已发送" } + XCTAssertTrue(try label(controller.view, "drone.nearby.statusDetail").text?.contains("核对下载结果") == true) + XCTAssertTrue(UIApplication.shared.isIdleTimerDisabled) + NotificationCenter.default.post(name: UIApplication.didEnterBackgroundNotification, object: nil) + XCTAssertEqual(model.snapshot.phase, .ended) + XCTAssertNil(model.snapshot.session) + XCTAssertNil(qr.image) + XCTAssertFalse(UIApplication.shared.isIdleTimerDisabled) + XCTAssertTrue(try button(controller.view, "drone.nearby.chooseVideo").isEnabled) + XCTAssertGreaterThan(service.stopCount, 0) + } + + /// 小屏生成接收码后完整露出二维码与接收信息,进度刷新不反复滚动。 + func testNewSessionRevealsQRCodeOnceOnSmallScreen() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let file = directory.appendingPathComponent("测试视频.mp4") + try Data([1, 2, 3, 4]).write(to: file) + let service = NearbyViewService() + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(.init(url: file, fileName: "测试视频.mp4", fileSize: 4)) + let controller = DroneDockNearbyTransferViewController(customerTitle: "测试游客", viewModel: model) + let window = show(controller) + window.frame = CGRect(x: 0, y: 0, width: 375, height: 667) + window.layoutIfNeeded() + defer { close(window) } + let scroll = try XCTUnwrap(find(controller.view, "drone.nearby.content") as? UIScrollView) + let qr = try XCTUnwrap(find(controller.view, "drone.nearby.qr")) + let expiry = try XCTUnwrap(find(controller.view, "drone.nearby.expiry")) + let copy = try button(controller.view, "drone.nearby.copyAddress") + try button(controller.view, "drone.nearby.primary").sendActions(for: .touchUpInside) + try await settle { + window.layoutIfNeeded() + return model.snapshot.session != nil && scroll.contentOffset.y > 0 + && scroll.bounds.contains(qr.convert(qr.bounds, to: scroll)) + && scroll.bounds.contains(expiry.convert(expiry.bounds, to: scroll)) + && controller.view.bounds.contains(copy.convert(copy.bounds, to: controller.view)) + } + XCTAssertGreaterThan(scroll.contentOffset.y, 0) + let footer = try XCTUnwrap(find(controller.view, "drone.nearby.footer")) + XCTAssertTrue(copy.isDescendant(of: footer), "复制地址固定在页脚,不随内容滚走") + XCTAssertEqual(copy.configuration?.title, "复制接收地址") + XCTAssertTrue(copy.isEnabled) + XCTAssertEqual(try button(controller.view, "drone.nearby.primary").title(for: .normal), "结束闪传") + // 等待首次定位动画收尾,再模拟用户主动返回顶部。 + try await Task.sleep(for: .milliseconds(350)) + let center = copy.convert(CGPoint(x: copy.bounds.midX, y: copy.bounds.midY), to: window) + let hit = window.hitTest(center, with: nil) + XCTAssertTrue(hit === copy || hit?.isDescendant(of: copy) == true) + capture(window, name: "面对面闪传-小屏接收码与固定操作-隔离替身") + scroll.setContentOffset(.zero, animated: false) + service.send(.sending(bytesSent: 2, totalBytes: 4)) + try await settle { try self.label(controller.view, "drone.nearby.status").text == "正在发送视频" } + window.layoutIfNeeded() + XCTAssertEqual(scroll.contentOffset.y, 0, accuracy: 1, "同一会话进度更新不能再次自动滚动") + model.stop() + try await settle { try self.label(controller.view, "drone.nearby.status").text == "闪传已结束" } + await model.start() + try await settle { + window.layoutIfNeeded() + return scroll.contentOffset.y > 0 && scroll.bounds.contains(qr.convert(qr.bounds, to: scroll)) + && scroll.bounds.contains(expiry.convert(expiry.bounds, to: scroll)) + } + } + + /// 会话期间固定复制入口不会结束传输,结束操作先确认,原视频不能被更换或预览。 + func testActiveFooterCopiesAddressAndRequiresStopConfirmation() async throws { + let file = try XCTUnwrap(Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4") + ?? Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4", subdirectory: "DroneDock")) + let fileSize = try XCTUnwrap(file.resourceValues(forKeys: [.fileSizeKey]).fileSize) + let service = NearbyViewService() + let model = DroneDockNearbyTransferViewModel(service: service) + // 直接预选 Bundle 文件,不交给页面的临时选片文件清理流程。 + try model.selectVideo(.init(url: file, fileName: file.lastPathComponent, fileSize: fileSize)) + let controller = DroneDockNearbyTransferViewController(customerTitle: "测试游客132****9413", orderNumber: "TEST-5018", viewModel: model) + let window = show(controller) + defer { close(window) } + XCTAssertEqual(service.startCount, 0, "选片本身不得开启本地监听") + try button(controller.view, "drone.nearby.primary").sendActions(for: .touchUpInside) + try await settle { try !self.button(controller.view, "drone.nearby.copyAddress").isHidden && model.snapshot.session != nil } + let copy = try button(controller.view, "drone.nearby.copyAddress") + let stop = try button(controller.view, "drone.nearby.primary") + XCTAssertFalse(try button(controller.view, "drone.nearby.chooseVideo").isEnabled) + let preview = try button(controller.view, "drone.nearby.preview") + XCTAssertFalse(preview.isEnabled) + XCTAssertTrue(isHidden(preview), "发送期间不向触摸或 VoiceOver 暴露预览操作") + XCTAssertEqual(stop.currentTitleColor, .systemRed) + XCTAssertEqual(stop.backgroundColor, .clear) + let thumbnail = try XCTUnwrap(find(controller.view, "drone.nearby.videoThumbnail")) + try await settle { thumbnail.accessibilityLabel == "所选视频封面" } + window.layoutIfNeeded() + try await Task.sleep(for: .milliseconds(350)) + window.layoutIfNeeded() + let scroll = try XCTUnwrap(find(controller.view, "drone.nearby.content") as? UIScrollView) + let qr = try XCTUnwrap(find(controller.view, "drone.nearby.qr")) + let expiry = try XCTUnwrap(find(controller.view, "drone.nearby.expiry")) + XCTAssertTrue(scroll.bounds.contains(qr.convert(qr.bounds, to: scroll)), "标准屏必须完整显示二维码") + XCTAssertTrue(scroll.bounds.contains(expiry.convert(expiry.bounds, to: scroll)), "标准屏必须完整显示接收码有效期") + XCTAssertEqual(qr.bounds.width, 196, accuracy: 0.5) + XCTAssertEqual(qr.bounds.height, 196, accuracy: 0.5) + XCTAssertTrue(controller.view.bounds.contains(copy.convert(copy.bounds, to: controller.view))) + XCTAssertTrue(controller.view.bounds.contains(stop.convert(stop.bounds, to: controller.view))) + let footer = try XCTUnwrap(find(controller.view, "drone.nearby.footer")) + XCTAssertEqual(copy.convert(copy.bounds, to: footer).minX, 20, accuracy: 0.5) + XCTAssertLessThanOrEqual(copy.convert(copy.bounds, to: footer).maxY, stop.convert(stop.bounds, to: footer).minY) + capture(window, name: "面对面闪传-标准屏真实本地视频封面-隔离替身") + copy.sendActions(for: .touchUpInside) + try await settle { controller.presentedViewController is UIAlertController } + XCTAssertEqual((controller.presentedViewController as? UIAlertController)?.title, "接收地址已复制") + XCTAssertEqual(UIPasteboard.general.string, model.snapshot.session?.url.absoluteString) + XCTAssertEqual(service.stopCount, 0) + controller.dismiss(animated: false) + try await settle { controller.presentedViewController == nil } + stop.sendActions(for: .touchUpInside) + try await settle { controller.presentedViewController is UIAlertController } + let confirmation = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(confirmation.title, "结束本次闪传?") + XCTAssertEqual(confirmation.actions.map(\.title), ["继续闪传", "结束闪传"]) + XCTAssertEqual(confirmation.actions.map(\.style), [.cancel, .destructive]) + XCTAssertNotNil(model.snapshot.session, "确认前不能撤销接收码") + XCTAssertEqual(service.startCount, 1) + XCTAssertEqual(service.stopCount, 0) + controller.dismiss(animated: false) + } + + /// 启动失败不保留虚假二维码或复制入口,原视频和主动重试入口继续可用。 + func testStartFailureRestoresVideoSelectionAndGenerateAction() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let file = directory.appendingPathComponent("测试视频.mp4") + try Data([1, 2, 3, 4]).write(to: file) + let service = NearbyViewService(startError: DroneDockNearbyTransferError.noLocalNetwork) + let model = DroneDockNearbyTransferViewModel(service: service) + try model.selectVideo(.init(url: file, fileName: "测试视频.mp4", fileSize: 4)) + let controller = DroneDockNearbyTransferViewController(customerTitle: "测试游客", viewModel: model) + let window = show(controller) + defer { close(window) } + try button(controller.view, "drone.nearby.primary").sendActions(for: .touchUpInside) + try await settle { try self.label(controller.view, "drone.nearby.status").text == "暂时无法闪传" } + XCTAssertEqual(try button(controller.view, "drone.nearby.primary").title(for: .normal), "重新生成接收码") + XCTAssertTrue(try button(controller.view, "drone.nearby.primary").isEnabled) + XCTAssertTrue(try button(controller.view, "drone.nearby.chooseVideo").isEnabled) + XCTAssertTrue(isHidden(try button(controller.view, "drone.nearby.copyAddress"))) + XCTAssertNil((find(controller.view, "drone.nearby.qr") as? UIImageView)?.image) + XCTAssertEqual(model.snapshot.video?.fileName, "测试视频.mp4") + XCTAssertEqual(service.startCount, 1) + } + + private func show(_ controller: UIViewController) -> UIWindow { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first! + let window = UIWindow(windowScene: scene) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + controller.loadViewIfNeeded() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + if let navigation = window.rootViewController as? UINavigationController, + let controller = navigation.topViewController as? DroneDockNearbyTransferViewController { + controller.viewModel.stop() + NotificationCenter.default.post(name: UIApplication.didEnterBackgroundNotification, object: nil) + } + window.isHidden = true + window.rootViewController = nil + } + + private func find(_ view: UIView, _ identifier: String) -> UIView? { + if view.accessibilityIdentifier == identifier { return view } + return view.subviews.lazy.compactMap { self.find($0, identifier) }.first + } + + private func button(_ view: UIView, _ identifier: String) throws -> UIButton { + try XCTUnwrap(find(view, identifier) as? UIButton) + } + + private func label(_ view: UIView, _ identifier: String) throws -> UILabel { + try XCTUnwrap(find(view, identifier) as? UILabel) + } + + private func isHidden(_ view: UIView) -> Bool { + view.isHidden || view.alpha < 0.01 || (view.superview.map(isHidden) ?? false) + } + + private func texts(in view: UIView) -> [String] { + (isHidden(view) ? [] : (view as? UILabel)?.text.map { [$0] } ?? []) + view.subviews.flatMap { texts(in: $0) } + } + + private func capture(_ window: UIWindow, name: String) { + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } + + private func settle(_ condition: () throws -> Bool) async throws { + for _ in 0..<100 { + if try condition() { return } + try await Task.sleep(for: .milliseconds(10)) + } + XCTFail("页面未在预期时间内更新") + } +} + +/// 无网络的页面替身,模拟本地监听成功及发送事件。 +private final class NearbyViewService: DroneDockNearbyTransferServing, @unchecked Sendable { + private let lock = NSLock() + private var handler: (@Sendable (DroneDockNearbyTransferEvent) -> Void)? + private var starts = 0 + private var stops = 0 + private let startError: Error? + var startCount: Int { locked { starts } } + var stopCount: Int { locked { stops } } + + init(startError: Error? = nil) { self.startError = startError } + + func start(video: DroneDockDeliveryVideo, onEvent: @escaping @Sendable (DroneDockNearbyTransferEvent) -> Void) async throws -> DroneDockNearbyTransferSession { + locked { starts += 1; handler = onEvent } + if let startError { throw startError } + return .init(id: UUID(), url: URL(string: "http://192.168.0.2:8000/s/local-test")!, expiresAt: Date().addingTimeInterval(600)) + } + + func stop() { locked { stops += 1 } } + + func send(_ event: DroneDockNearbyTransferEvent) { locked { handler }?(event) } + + private func locked(_ block: () -> T) -> T { + lock.lock() + defer { lock.unlock() } + return block() + } +} diff --git a/suixinkanTests/DroneDockNearbyVideoLoaderTests.swift b/suixinkanTests/DroneDockNearbyVideoLoaderTests.swift new file mode 100644 index 0000000..2223280 --- /dev/null +++ b/suixinkanTests/DroneDockNearbyVideoLoaderTests.swift @@ -0,0 +1,14 @@ +import Photos +import XCTest +@testable import suixinkan + +/// 闪传资源读取的离线约束,防止后续复用上传选择器时意外开启 iCloud 下载。 +final class DroneDockNearbyVideoLoaderTests: XCTestCase { + /// Photos 导出参数每次独立创建,并且始终禁止网络拉取。 + func testLocalResourceRequestNeverEnablesCloudDownload() { + let first = DroneDockNearbyVideoLoader.localResourceOptions() + XCTAssertFalse(first.isNetworkAccessAllowed) + first.isNetworkAccessAllowed = true + XCTAssertFalse(DroneDockNearbyVideoLoader.localResourceOptions().isNetworkAccessAllowed) + } +} diff --git a/suixinkanTests/DroneDockNearbyVideoResourceWriterTests.swift b/suixinkanTests/DroneDockNearbyVideoResourceWriterTests.swift new file mode 100644 index 0000000..0493de0 --- /dev/null +++ b/suixinkanTests/DroneDockNearbyVideoResourceWriterTests.swift @@ -0,0 +1,182 @@ +import Foundation +import Photos +import XCTest +@testable import suixinkan + +/// 本地视频流式导出测试;Photos 请求替换为内存回调,不访问相册或网络。 +final class DroneDockNearbyVideoResourceWriterTests: XCTestCase { + /// 分块写入和精确上限均保留原始字节,不依赖系统资源回调的异步时序。 + func testSynchronousChunksAtExactLimitProduceCompleteFile() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let requester = ResourceRequestStub(initialChunks: [Data([1, 2]), Data([3, 4, 5])], finishesSynchronously: true) + try await DroneDockNearbyVideoResourceWriter.write(requester: requester, to: fixture.url, maximumByteCount: 5) + XCTAssertEqual(try Data(contentsOf: fixture.url), Data([1, 2, 3, 4, 5])) + XCTAssertEqual(requester.requestCount, 1) + XCTAssertEqual(requester.cancelledIDs, []) + XCTAssertFalse(DroneDockNearbyVideoResourceWriter.localResourceOptions().isNetworkAccessAllowed) + } + + /// 请求身份尚未返回时超限,仍须取消正确请求并删除部分文件,迟到完成不能变成成功。 + func testOverflowBeforeRequestIDIsReturnedCancelsAndRemovesPartialFile() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let requester = ResourceRequestStub(initialChunks: [Data([1, 2]), Data([3, 4, 5, 6])], finishesSynchronously: true) + do { + try await DroneDockNearbyVideoResourceWriter.write(requester: requester, to: fixture.url, maximumByteCount: 5) + XCTFail("超限文件不能成功") + } catch { XCTAssertEqual(error as? DroneDockFilmError, .fileTooLarge) } + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + XCTAssertEqual(requester.cancelledIDs, [41]) + requester.send(Data([7])) + requester.complete(nil) + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + } + + /// 取消已开始的读取立即移除部分文件,取消触发的同步完成不能重复恢复 continuation。 + func testCancellationStopsRequestAndIgnoresLateCallbacks() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let started = expectation(description: "读取已开始") + let requester = ResourceRequestStub(onStart: { started.fulfill() }) + let task = Task { + try await DroneDockNearbyVideoResourceWriter.write(requester: requester, to: fixture.url, maximumByteCount: 100) + } + await fulfillment(of: [started], timeout: 2) + requester.send(Data([1, 2, 3])) + task.cancel() + do { try await task.value; XCTFail("取消不能成功") } + catch { XCTAssertTrue(error is CancellationError) } + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + XCTAssertEqual(requester.cancelledIDs, [41]) + requester.send(Data([4, 5])) + requester.complete(nil) + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + } + + /// Task 在 continuation 注册前已经取消时,不应发起 Photos 请求或残留空文件。 + func testAlreadyCancelledTaskDoesNotStartResourceRequest() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let requester = ResourceRequestStub(finishesSynchronously: true) + let task = Task { + withUnsafeCurrentTask { $0?.cancel() } + try await DroneDockNearbyVideoResourceWriter.write(requester: requester, to: fixture.url, maximumByteCount: 100) + } + do { try await task.value; XCTFail("取消不能成功") } + catch { XCTAssertTrue(error is CancellationError) } + XCTAssertEqual(requester.requestCount, 0) + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + } + + /// 取消发生在系统方法返回请求身份之前时,文件先清理,身份返回后补发一次取消。 + func testCancellationWhileWaitingForRequestIDCancelsThatIDOnce() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let started = expectation(description: "等待请求身份") + let gate = DispatchSemaphore(value: 0) + let requester = ResourceRequestStub(onStart: { started.fulfill() }, beforeReturningID: { _ = gate.wait(timeout: .now() + 3) }) + let task = Task { + try await DroneDockNearbyVideoResourceWriter.write(requester: requester, to: fixture.url, maximumByteCount: 100) + } + await fulfillment(of: [started], timeout: 2) + task.cancel() + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + gate.signal() + do { try await task.value; XCTFail("取消不能成功") } + catch { XCTAssertTrue(error is CancellationError) } + XCTAssertEqual(requester.cancelledIDs, [41]) + } + + /// 空资源与 Photos 错误都清理文件,不交给下一步视频校验。 + func testEmptyResourceAndReadFailureLeaveNoFile() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let empty = ResourceRequestStub(finishesSynchronously: true) + do { + try await DroneDockNearbyVideoResourceWriter.write(requester: empty, to: fixture.url, maximumByteCount: 100) + XCTFail("空资源不能成功") + } catch { XCTAssertEqual(error as? DroneDockFilmError, .emptyFile) } + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + + let failed = ResourceRequestStub(initialChunks: [Data([1])], finishesSynchronously: true, completionError: CocoaError(.fileReadNoPermission)) + do { + try await DroneDockNearbyVideoResourceWriter.write(requester: failed, to: fixture.url, maximumByteCount: 100) + XCTFail("读取失败不能成功") + } catch { XCTAssertEqual((error as NSError).code, CocoaError.fileReadNoPermission.rawValue) } + XCTAssertFalse(FileManager.default.fileExists(atPath: fixture.url.path)) + } + + /// 独占文件要求不能覆盖已经存在的文件,即使读取器随后返回成功。 + func testExistingDestinationIsNotOverwritten() async throws { + let fixture = try ResourceFileFixture() + defer { fixture.remove() } + let original = Data([9, 8, 7]) + try original.write(to: fixture.url) + let requester = ResourceRequestStub(initialChunks: [Data([1])], finishesSynchronously: true) + do { + try await DroneDockNearbyVideoResourceWriter.write(requester: requester, to: fixture.url, maximumByteCount: 100) + XCTFail("不能覆盖已有文件") + } catch { XCTAssertEqual((error as NSError).code, CocoaError.fileWriteFileExists.rawValue) } + XCTAssertEqual(try Data(contentsOf: fixture.url), original) + XCTAssertEqual(requester.requestCount, 0) + } +} + +/// 单个测试独占的文件路径,避免清理其他测试资源。 +private struct ResourceFileFixture { + let directory: URL + let url: URL + + init() throws { + directory = FileManager.default.temporaryDirectory.appendingPathComponent("nearby-resource-test-\(UUID().uuidString)", isDirectory: true) + url = directory.appendingPathComponent("video.mp4") + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + } + + func remove() { try? FileManager.default.removeItem(at: directory) } +} + +/// 可制造同步完成、迟到回调和请求身份延迟的线程安全资源替身。 +private final class ResourceRequestStub: DroneDockNearbyVideoResourceRequesting, @unchecked Sendable { + private let lock = NSLock() + private let initialChunks: [Data] + private let finishesSynchronously: Bool + private let completionError: Error? + private let onStart: @Sendable () -> Void + private let beforeReturningID: @Sendable () -> Void + private var dataHandler: (@Sendable (Data) -> Void)? + private var completionHandler: (@Sendable (Error?) -> Void)? + private var starts = 0 + private var cancellations: [PHAssetResourceDataRequestID] = [] + + var requestCount: Int { lock.withLock { starts } } + var cancelledIDs: [PHAssetResourceDataRequestID] { lock.withLock { cancellations } } + + init(initialChunks: [Data] = [], finishesSynchronously: Bool = false, completionError: Error? = nil, + onStart: @escaping @Sendable () -> Void = {}, beforeReturningID: @escaping @Sendable () -> Void = {}) { + self.initialChunks = initialChunks + self.finishesSynchronously = finishesSynchronously + self.completionError = completionError + self.onStart = onStart + self.beforeReturningID = beforeReturningID + } + + func requestData(onData: @escaping @Sendable (Data) -> Void, + onComplete: @escaping @Sendable (Error?) -> Void) -> PHAssetResourceDataRequestID { + lock.withLock { starts += 1; dataHandler = onData; completionHandler = onComplete } + onStart() + initialChunks.forEach(onData) + if finishesSynchronously { onComplete(completionError) } + beforeReturningID() + return 41 + } + + func cancelDataRequest(_ id: PHAssetResourceDataRequestID) { + lock.withLock { cancellations.append(id) } + complete(CancellationError()) + } + + func send(_ data: Data) { lock.withLock { dataHandler }?(data) } + func complete(_ error: Error?) { lock.withLock { completionHandler }?(error) } +} diff --git a/suixinkanTests/DroneDockOrdersViewModelTests.swift b/suixinkanTests/DroneDockOrdersViewModelTests.swift new file mode 100644 index 0000000..c22a035 --- /dev/null +++ b/suixinkanTests/DroneDockOrdersViewModelTests.swift @@ -0,0 +1,424 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证全部订单的真实服务复用、独立分页、失败恢复及会话隔离。 +@MainActor +final class DroneDockOrdersViewModelTests: XCTestCase { + /// 全部订单只读取订单接口,保留服务端顺序和已完成订单。 + func testRefreshLoadsOnlyOrdersIncludingCompletedOrders() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["DONE", "PENDING"], total: 2, completed: ["DONE"])) + let model = makeModel(service: service) + XCTAssertNil(model.total) + await model.refresh() + XCTAssertEqual(model.orders.map(\.orderID), ["DONE", "PENDING"]) + XCTAssertEqual(model.orders.first?.shootStatus, "completed") + XCTAssertEqual(model.total, 2) + XCTAssertFalse(model.hasMore) + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.errorMessage) + XCTAssertEqual(service.requests.map(\.page), [1]) + XCTAssertEqual(service.requests.first?.scenicID, 128) + XCTAssertEqual(service.requests.first?.pageSize, 20) + XCTAssertEqual(service.requests.first?.status, .all) + XCTAssertEqual(service.otherRequests, 0) + } + + /// 初始分类和后续刷新、分页都交给后端,重复点击当前分类不额外读取。 + func testInitialFilterRefreshAndPaginationPreserveStatus() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 21)) + service.responses[2] = .success(try OrdersListFixtures.page(ids: ["ORDER-21"], total: 21, page: 2)) + let model = makeModel(service: service, initialFilter: .pending) + XCTAssertEqual(model.selectedFilter, .pending) + await model.refresh() + await model.selectFilter(.pending) + await model.loadMore() + await model.refresh() + XCTAssertEqual(model.selectedFilter, .pending) + XCTAssertEqual(model.orders.count, 20) + XCTAssertEqual(service.requests.map(\.page), [1, 2, 1]) + XCTAssertEqual(service.requests.map(\.status), [.pending, .pending, .pending]) + } + + /// 切分类重新读第一页;失败时不显示上一个分类订单,重试仍沿用失败分类。 + func testSwitchingFilterClearsPreviousDataAndRetryPreservesFilter() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["ALL-ORDER"], total: 1)) + let model = makeModel(service: service) + await model.refresh() + service.responses[1] = .failure(APIError.networkFailed("待拍摄读取失败")) + await model.selectFilter(.pending) + XCTAssertEqual(model.selectedFilter, .pending) + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.total) + XCTAssertFalse(model.hasMore) + XCTAssertNotNil(model.errorMessage) + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["PENDING-ORDER"], total: 1)) + await model.refresh() + XCTAssertEqual(model.orders.map(\.orderID), ["PENDING-ORDER"]) + XCTAssertNil(model.errorMessage) + service.responses[1] = .success(try OrdersListFixtures.page(ids: [], total: 0)) + await model.selectFilter(.completed) + XCTAssertEqual(model.total, 0) + XCTAssertTrue(model.orders.isEmpty) + XCTAssertEqual(service.requests.map(\.page), [1, 1, 1, 1]) + XCTAssertEqual(service.requests.map(\.status), [.all, .pending, .pending, .completed]) + } + + /// 切换后旧分类成功或失败均不能回填,也不能改变新分类加载与错误状态。 + func testLateResponseFromPreviousFilterCannotReplaceCurrentFilter() async throws { + for oldFails in [false, true] { + let service = OrdersListService() + service.suspended = true + let firstStarted = expectation(description: "全部订单挂起") + let secondStarted = expectation(description: "进行中订单挂起") + service.requestStarted = { if $0 == 0 { firstStarted.fulfill() } else if $0 == 1 { secondStarted.fulfill() } } + let model = makeModel(service: service) + let first = Task { await model.refresh() } + await fulfillment(of: [firstStarted], timeout: 2) + let second = Task { await model.selectFilter(.inProgress) } + await fulfillment(of: [secondStarted], timeout: 2) + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.total) + service.finish(0, result: oldFails ? .failure(APIError.networkFailed("旧分类错误")) + : .success(try OrdersListFixtures.page(ids: ["OLD"], total: 1))) + await first.value + XCTAssertTrue(model.isLoading) + XCTAssertNil(model.errorMessage) + XCTAssertTrue(model.orders.isEmpty) + service.finish(1, result: .success(try OrdersListFixtures.page(ids: ["PROCESSING"], total: 1, processing: ["PROCESSING"]))) + await second.value + XCTAssertEqual(model.selectedFilter, .inProgress) + XCTAssertEqual(model.orders.map(\.orderID), ["PROCESSING"]) + XCTAssertEqual(model.orders.first?.shootStatus, "processing") + XCTAssertEqual(model.orders.first?.shotRemain, 0, "次数用完但未确认的订单仍按后端进行中状态展示") + XCTAssertEqual(model.orders.first?.orderStatus, 20) + XCTAssertNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + } + + /// 新分类已显示后,旧分类分页的迟到成功或错误均不能污染新列表。 + func testFilterSwitchRejectsLatePaginationAndItsError() async throws { + for oldFails in [false, true] { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 21)) + let model = makeModel(service: service) + await model.refresh() + service.suspended = true + let started = expectation(description: "旧分类下一页挂起") + service.requestStarted = { if $0 == 1 { started.fulfill() } } + let oldPage = Task { await model.loadMore() } + await fulfillment(of: [started], timeout: 2) + service.suspended = false + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["DONE"], total: 1, completed: ["DONE"])) + await model.selectFilter(.completed) + service.finish(1, result: oldFails ? .failure(APIError.networkFailed("旧分页错误")) + : .success(try OrdersListFixtures.page(ids: ["OLD-PAGE"], total: 21, page: 2))) + await oldPage.value + XCTAssertEqual(model.selectedFilter, .completed) + XCTAssertEqual(model.orders.map(\.orderID), ["DONE"]) + XCTAssertEqual(model.total, 1) + XCTAssertFalse(model.hasMore) + XCTAssertFalse(model.isLoadingMore) + XCTAssertNil(model.loadMoreErrorMessage) + XCTAssertNil(model.errorMessage) + XCTAssertEqual(service.requests.map(\.status), [.all, .all, .completed]) + XCTAssertEqual(service.requests.map(\.page), [1, 2, 1]) + } + } + + /// 成功空列表保留服务端零值,不能继续请求下一页。 + func testSuccessfulEmptyListStopsPagination() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: [], total: 0)) + let model = makeModel(service: service) + await model.refresh() + await model.loadMore() + XCTAssertTrue(model.orders.isEmpty) + XCTAssertEqual(model.total, 0) + XCTAssertFalse(model.hasMore) + XCTAssertNil(model.errorMessage) + XCTAssertEqual(service.requests.count, 1) + } + + /// 翻页按服务端总数推进;重复订单原位更新,新增订单保持返回顺序。 + func testPaginationDeduplicatesAndUpdatesExistingOrders() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 21)) + service.responses[2] = .success(try OrdersListFixtures.page(ids: ["ORDER-1", "ORDER-21"], total: 21, page: 2, name: "更新套餐")) + let model = makeModel(service: service) + await model.refresh() + XCTAssertTrue(model.hasMore) + await model.loadMore() + await model.loadMore() + XCTAssertEqual(model.orders.map(\.orderID), (1...21).map { "ORDER-\($0)" }) + XCTAssertEqual(model.orders.first?.packageName, "更新套餐") + XCTAssertEqual(model.total, 21) + XCTAssertFalse(model.hasMore) + XCTAssertEqual(service.requests.map(\.page), [1, 2]) + } + + /// 下一页失败保留列表和总数,重试仍读取同一页。 + func testPaginationFailurePreservesDataAndRetriesSamePage() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 21)) + service.responses[2] = .failure(APIError.networkFailed("下一页超时")) + let model = makeModel(service: service) + await model.refresh() + await model.loadMore() + XCTAssertEqual(model.orders.map(\.orderID), firstPageIDs) + XCTAssertEqual(model.total, 21) + XCTAssertTrue(model.loadMoreErrorMessage?.contains("下一页超时") == true) + XCTAssertNil(model.errorMessage) + service.responses[2] = .success(try OrdersListFixtures.page(ids: ["ORDER-21"], total: 21, page: 2)) + await model.loadMore() + XCTAssertEqual(model.orders.count, 21) + XCTAssertNil(model.loadMoreErrorMessage) + XCTAssertEqual(service.requests.map(\.page), [1, 2, 2]) + } + + /// 首屏刷新失败清除旧快照,重试成功后只显示最新订单。 + func testRefreshFailureClearsOldDataAndRetryRestoresLatestPage() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["OLD"], total: 1)) + let model = makeModel(service: service) + await model.refresh() + service.responses[1] = .failure(APIError.networkFailed("订单加载失败")) + await model.refresh() + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.total) + XCTAssertFalse(model.hasMore) + XCTAssertNotNil(model.errorMessage) + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["NEW"], total: 1)) + await model.refresh() + XCTAssertEqual(model.orders.map(\.orderID), ["NEW"]) + XCTAssertNil(model.errorMessage) + } + + /// 服务端分页骨架不匹配时拒绝首屏,下一页异常时保留已有数据。 + func testMismatchedPageAndPageSizeAreRejected() async throws { + let service = OrdersListService() + let model = makeModel(service: service) + for invalid in [try OrdersListFixtures.page(ids: ["BAD"], total: 1, page: 2), + try OrdersListFixtures.page(ids: ["BAD"], total: 1, pageSize: 10)] { + service.responses[1] = .success(invalid) + await model.refresh() + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.total) + XCTAssertNotNil(model.errorMessage) + } + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 21)) + await model.refresh() + service.responses[2] = .success(try OrdersListFixtures.page(ids: ["BAD"], total: 21, page: 1)) + await model.loadMore() + XCTAssertEqual(model.orders.map(\.orderID), firstPageIDs) + XCTAssertNotNil(model.loadMoreErrorMessage) + } + + /// 服务端总数未同步时,空下一页也必须停止继续翻页。 + func testEmptyNextPageStopsFurtherRequests() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 61)) + service.responses[2] = .success(try OrdersListFixtures.page(ids: [], total: 61, page: 2)) + let model = makeModel(service: service) + await model.refresh() + await model.loadMore() + await model.loadMore() + XCTAssertEqual(model.orders.count, 20) + XCTAssertFalse(model.hasMore) + XCTAssertEqual(service.requests.map(\.page), [1, 2]) + } + + /// 缺少登录或景区门店范围时阻止网络调用。 + func testMissingSessionOrScopeDoesNotRequestOrders() async throws { + for context in [makeContext(token: ""), makeContext(scenicID: 0), makeContext(storeID: 0)] { + let service = OrdersListService() + let model = makeModel(service: service, scope: OrdersListContextBox(context)) + await model.refresh() + XCTAssertTrue(service.requests.isEmpty) + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + } + + /// 请求中切换账号范围时丢弃旧订单,也不让后续刷新静默换到新范围。 + func testChangedIdentityRejectsInFlightResponseAndFurtherRefresh() async throws { + let service = OrdersListService() + service.suspended = true + let started = expectation(description: "旧范围请求已发出") + service.requestStarted = { _ in started.fulfill() } + let scope = OrdersListContextBox(makeContext()) + let model = makeModel(service: service, scope: scope) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + scope.value = makeContext(scenicID: 129) + service.finish(0, result: .success(try OrdersListFixtures.page(ids: ["OLD"], total: 1))) + await pending.value + await model.refresh() + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.total) + XCTAssertNotNil(model.errorMessage) + XCTAssertEqual(service.requests.count, 1) + } + + /// 取消任务或离开页面后,即使服务仍成功返回,也不能写入订单。 + func testCancellationAndInvalidationRejectLateSuccessfulResponses() async throws { + for cancelTask in [true, false] { + let service = OrdersListService() + service.suspended = true + let started = expectation(description: "可取消的订单请求") + service.requestStarted = { _ in started.fulfill() } + let model = makeModel(service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + if cancelTask { pending.cancel() } else { model.invalidate() } + service.finish(0, result: .success(try OrdersListFixtures.page(ids: ["LATE"], total: 1))) + await pending.value + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.total) + XCTAssertNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + } + + /// 刷新使旧分页失效,重复分页点击也只发出一次请求。 + func testRefreshRejectsPendingPaginationAndBlocksDuplicateLoadMore() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: firstPageIDs, total: 21)) + let model = makeModel(service: service) + await model.refresh() + service.suspended = true + let pageStarted = expectation(description: "下一页请求已发出") + service.requestStarted = { if $0 == 1 { pageStarted.fulfill() } } + let pendingPage = Task { await model.loadMore() } + await fulfillment(of: [pageStarted], timeout: 2) + await model.loadMore() + XCTAssertEqual(service.requests.map(\.page), [1, 2]) + service.suspended = false + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["NEW"], total: 1)) + await model.refresh() + service.finish(1, result: .success(try OrdersListFixtures.page(ids: ["OLD-PAGE"], total: 21, page: 2))) + await pendingPage.value + XCTAssertEqual(model.orders.map(\.orderID), ["NEW"]) + XCTAssertEqual(model.total, 1) + XCTAssertFalse(model.hasMore) + XCTAssertFalse(model.isLoadingMore) + } + + /// 首页工厂复用真实依赖,但首页失效不会清除独立列表已加载的订单。 + func testHomeFactorySharesServiceAndContextWithIndependentState() async throws { + let service = OrdersListService() + service.responses[1] = .success(try OrdersListFixtures.page(ids: ["ALL-ORDER"], total: 1)) + let scope = OrdersListContextBox(makeContext()) + let home = DroneDockHomeViewModel(context: scope.value, service: service, currentContext: { scope.value }) + let model = home.makeOrdersViewModel() + await model.refresh() + home.invalidate() + XCTAssertEqual(model.context, scope.value) + XCTAssertEqual(model.orders.map(\.orderID), ["ALL-ORDER"]) + XCTAssertTrue(home.orders.isEmpty) + XCTAssertEqual(service.otherRequests, 0) + scope.value = makeContext(token: "renewed-token") + await model.refresh() + XCTAssertTrue(model.orders.isEmpty) + XCTAssertEqual(service.requests.count, 1) + } + + private var firstPageIDs: [String] { (1...20).map { "ORDER-\($0)" } } + + private func makeModel(service: OrdersListService, scope: OrdersListContextBox? = nil, + initialFilter: DroneShootingOrderFilter = .all) -> DroneDockOrdersViewModel { + let scope = scope ?? OrdersListContextBox(makeContext()) + return DroneDockOrdersViewModel(context: scope.value, service: service, initialFilter: initialFilter, + currentContext: { scope.value }) + } + + private func makeContext(scenicID: Int = 128, storeID: Int = 37, token: String = "test-token") -> DroneDockHomeContext { + DroneDockHomeContext(userID: "orders-test-user", accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: storeID, photographerName: "测试工作人员", token: token) + } +} + +/// 测试中可替换的最新会话范围。 +@MainActor +private final class OrdersListContextBox { + var value: DroneDockHomeContext + + /// 保存当前范围,不访问应用全局登录态。 + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 全部订单分页的匿名夹具,包含已完成订单和可更新的套餐字段。 +private enum OrdersListFixtures { + /// 生成可由正式模型校验的订单页,不依赖真实用户数据。 + static func page(ids: [String], total: Int, page: Int = 1, pageSize: Int = 20, + name: String = "测试套餐", completed: Set = [], + processing: Set = []) throws -> DroneDockOrdersResponse { + let list: [[String: Any]] = ids.map { id in + ["order_number": id, "project_id": 101, "project_name": name, + "shoot_count": 1, "shot_count": completed.contains(id) || processing.contains(id) ? 1 : 0, + "remaining_count": completed.contains(id) || processing.contains(id) ? 0 : 1, + "shoot_status": completed.contains(id) ? "completed" : processing.contains(id) ? "processing" : "pending", + "order_status": completed.contains(id) ? 30 : 20, + "can_create_task": !completed.contains(id) && !processing.contains(id)] + } + return try JSONDecoder().decode(DroneDockOrdersResponse.self, from: JSONSerialization.data(withJSONObject: [ + "list": list, "total": total, "page": page, "page_size": pageSize + ])) + } +} + +/// 只允许订单调用的内存服务,支持精确挂起指定请求以模拟刷新和会话变化。 +@MainActor +private final class OrdersListService: DroneDockHomeServing { + /// 订单请求参数快照。 + struct Request { + let scenicID: Int + let status: DroneShootingOrderFilter + let page: Int + let pageSize: Int + } + + var responses: [Int: Result] = [:] + var suspended = false + var requestStarted: ((Int) -> Void)? + private(set) var requests: [Request] = [] + private(set) var otherRequests = 0 + private var pending: [Int: CheckedContinuation] = [:] + + /// 记录订单分页并按测试安排立即返回或挂起。 + func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse { + let index = requests.count + requests.append(Request(scenicID: scenicID, status: status, page: page, pageSize: pageSize)) + if suspended { + return try await withCheckedThrowingContinuation { continuation in + pending[index] = continuation + requestStarted?(index) + } + } + requestStarted?(index) + guard let result = responses[page] else { throw APIError.networkFailed("未配置订单测试响应") } + return try result.get() + } + + /// 独立列表不应请求设备,若误调用则记录并失败。 + func home(scenicID: Int, storeID: Int) async throws -> DroneDockHomeResponse { + otherRequests += 1 + throw APIError.networkFailed("全部订单不应读取设备") + } + + /// 独立列表不应请求首页统计。 + func todayStats(scenicID: Int) async throws -> DroneDockHomeToday { + otherRequests += 1 + throw APIError.networkFailed("全部订单不应读取统计") + } + + /// 放行指定调用,允许构造晚到的成功或失败结果。 + func finish(_ index: Int, result: Result) { + pending.removeValue(forKey: index)?.resume(with: result) + } +} diff --git a/suixinkanTests/DroneDockOrdersViewTests.swift b/suixinkanTests/DroneDockOrdersViewTests.swift new file mode 100644 index 0000000..28eba9b --- /dev/null +++ b/suixinkanTests/DroneDockOrdersViewTests.swift @@ -0,0 +1,828 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用真实请求构造验证独立拍摄订单页的筛选、分页、完整卡及准备入口。 +@MainActor +final class DroneDockOrdersViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 页面显示后才读取张工订单,完整卡保留游客、时间、套餐和次数进度。 + func testAppearingLoadsOnlyOrdersAndDisplaysFullOrderCard() async throws { + let (controller, session) = makeController(responses: [try envelope([record("FIRST")], total: 1)]) + XCTAssertTrue(session.requests.isEmpty) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.total == 1 && list.numberOfItems(inSection: 0) == 1 } + let cell = try await card(at: 0, in: list, window: window) + let texts = visibleTexts(in: cell) + XCTAssertEqual(controller.title, "我的拍摄订单") + XCTAssertTrue(texts.contains("游客 130****0001")) + XCTAssertTrue(texts.contains { $0.contains("TEST-ORDER-FIRST") && $0.contains("2026-10-28 10:00:00") }) + XCTAssertTrue(texts.contains { $0.contains("测试多点位套餐") }) + XCTAssertTrue(texts.contains("待拍摄")) + XCTAssertTrue(texts.contains { $0.contains("已拍摄") && $0.contains("0") && $0.contains("5") }) + XCTAssertTrue(texts.contains { $0.contains("剩余") && $0.contains("5") }) + XCTAssertEqual(try countLabel(in: controller).text, "全部订单(1)") + XCTAssertNotNil(views(in: cell).first { $0 is UIProgressView }) + XCTAssertEqual(session.requests.count, 1) + assertOnlyOrders(session) + XCTAssertEqual(query(session.requests[0])["status"], "all") + assertUnambiguousLayout(in: controller.view) + capture(window, name: "我的拍摄订单-真实完整卡") + } + + /// 两种新增权限下均优先查看已有任务,保留交付入口,回来读取 null 后恢复原操作。 + func testActiveTaskPriorityNavigationAndReturnRefresh() async throws { + for canCreate in [true, false] { + var order = record("ACTIVE", status: "processing") + order["active_task_id"] = 801; order["active_task_status"] = 20 + order["shot_count"] = 5; order["remaining_count"] = 0 + order["can_create_task"] = canCreate; order["can_upload_film"] = true + var ended = order; ended["active_task_id"] = NSNull(); ended["active_task_status"] = NSNull() + var taskSession: MockURLSession? + var factoryCalls = 0 + let (controller, session) = makeController(responses: try [envelope([order], total: 1), envelope([ended], total: 1)], + taskFactory: { id, order, context in + factoryCalls += 1 + XCTAssertEqual(id, 801) + let pair = try! DroneDockActiveTaskViewFixtures.controller(taskID: id, order: order, context: context) + taskSession = pair.1 + return pair.0 + }, factory: { _, _ in XCTFail("不能创建新任务"); return UIViewController() }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.first?.activeTaskID == 801 } + let cell = try await card(at: 0, in: list, window: window) + let primary = try button(in: cell, id: "drone.orders.order.TEST-ORDER-ACTIVE.primary") + XCTAssertEqual(primary.title(for: .normal), "继续查看任务") + XCTAssertFalse(try button(in: cell, id: "drone.orders.order.TEST-ORDER-ACTIVE.delivery").isHidden) + capture(window, name: "我的拍摄订单-继续查看任务") + primary.sendActions(for: .touchUpInside); primary.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { + navigation.topViewController is DroneDockShootingTaskViewController + && navigation.transitionCoordinator == nil + } + let page = try XCTUnwrap(navigation.topViewController as? DroneDockShootingTaskViewController) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { page.viewModel.response != nil } + XCTAssertEqual(page.viewModel.taskID, 801) + XCTAssertEqual(page.viewModel.order.orderID, "TEST-ORDER-ACTIVE") + XCTAssertEqual(factoryCalls, 1) + XCTAssertEqual(taskSession?.requests.count, 1) + let request = try XCTUnwrap(taskSession?.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/shooting") + XCTAssertEqual(query(request)["id"], "801") + XCTAssertEqual(query(request)["live_battery"], "0") + navigation.popViewController(animated: false) + try await settle(window) { controller.viewModel.orders.count == 1 && controller.viewModel.orders.first?.activeTaskID == nil } + let refreshed = try await card(at: 0, in: list, window: window) + XCTAssertEqual(try button(in: refreshed, id: "drone.orders.order.TEST-ORDER-ACTIVE.primary").title(for: .normal), canCreate ? "开始拍摄" : "交付成片") + XCTAssertEqual(session.requests.count, 2) + assertOnlyOrders(session) + } + } + + /// 上传任务覆盖滞后的素材完成或失败文案;拍满后提供交付,仍有次数才进入隔离的准备页。 + func testUploadingActiveTaskDoesNotNavigateToFlightAndKeepsAvailableActions() async throws { + for remaining in [0, 1] { + var order = record("UPLOADING", status: "processing") + order["shoot_count"] = 2; order["shot_count"] = 2 - remaining; order["remaining_count"] = remaining + order["order_status"] = 20; order["material_status"] = remaining == 0 ? 1 : 3 + order["active_task_id"] = 21; order["active_task_status"] = 25 + order["can_create_task"] = remaining > 0; order["can_upload_film"] = true + var openedFlights = 0 + var openedPreparations = 0 + let preparation = UIViewController() + let (controller, session) = makeController(responses: [try envelope([order], total: 1)], + deliveryFactory: { _, _, _ in UIViewController() }, + taskFactory: { _, _, _ in openedFlights += 1; return UIViewController() }, + factory: { selected, _ in + openedPreparations += 1 + XCTAssertEqual(selected.activeTaskID, 21) + XCTAssertNil(selected.activeFlightTaskID) + return preparation + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.count == 1 } + let cell = try await card(at: 0, in: list, window: window) + XCTAssertTrue(visibleTexts(in: cell).contains("进行中")) + XCTAssertTrue(visibleTexts(in: cell).contains("素材上传中")) + XCTAssertFalse(visibleTexts(in: cell).contains("上传完成")) + XCTAssertFalse(visibleTexts(in: cell).contains("上传失败")) + XCTAssertFalse(visibleTexts(in: cell).contains("继续查看任务")) + let primary = try button(in: cell, id: "drone.orders.order.TEST-ORDER-UPLOADING.primary") + XCTAssertEqual(primary.title(for: .normal), remaining > 0 ? "开始拍摄" : "交付成片") + primary.sendActions(for: .touchUpInside) + if remaining > 0 { + try await settle(window) { controller.navigationController?.topViewController === preparation } + XCTAssertEqual(openedPreparations, 1) + } else { + try await settle(window) { self.deliveryNavigation(from: controller) != nil } + XCTAssertEqual(openedPreparations, 0) + } + XCTAssertEqual(openedFlights, 0) + XCTAssertEqual(session.requests.count, 1) + assertOnlyOrders(session) + } + } + + /// 四个状态分别向服务端查询且从第一页加载,不在已加载页面上本地筛选。 + func testEachStatusFilterStartsAtPageOneAndKeepsServerResults() async throws { + let payloads = try [envelope([record("ALL")], total: 1), + envelope([record("PENDING")], total: 1), + envelope([record("PROCESSING", status: "processing")], total: 1), + envelope([record("COMPLETED", status: "completed")], total: 1), + envelope([record("ALL-NEW")], total: 1)] + let (controller, session) = makeController(responses: payloads) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.orders.first?.orderID == "TEST-ORDER-ALL" } + for (filter, id, title) in [("pending", "PENDING", "待拍摄订单(1)"), + ("inProgress", "PROCESSING", "进行中订单(1)"), + ("completed", "COMPLETED", "已完成订单(1)"), + ("all", "ALL-NEW", "全部订单(1)")] { + try button(in: controller.view, id: "drone.orders.filter.\(filter)").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.orders.first?.orderID == "TEST-ORDER-\(id)" && self.visibleTexts(in: controller.view).contains(title) } + XCTAssertTrue(try button(in: controller.view, id: "drone.orders.filter.\(filter)").accessibilityTraits.contains(.selected)) + } + XCTAssertEqual(session.requests.map { query($0)["status"] }, ["all", "pending", "processing", "completed", "all"]) + XCTAssertEqual(session.requests.map { query($0)["page"] }, Array(repeating: "1", count: 5)) + assertOnlyOrders(session) + } + + /// 次数耗尽的进行中订单仍展示服务端状态,不能自行变成已完成。 + func testExhaustedProcessingOrderRemainsInProgressUntilVisitorConfirms() async throws { + var order = record("EXHAUSTED", status: "processing") + order["shot_count"] = 5 + order["remaining_count"] = 0 + order["can_create_task"] = false + order["can_confirm"] = true + order["can_upload_film"] = true + let (controller, session) = makeController(responses: [try envelope([order], total: 1)]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.total == 1 } + let cell = try await card(at: 0, in: list, window: window) + XCTAssertTrue(visibleTexts(in: cell).contains("进行中")) + XCTAssertFalse(visibleTexts(in: cell).contains("已完成")) + XCTAssertFalse(visibleTexts(in: cell).contains("开始拍摄")) + XCTAssertTrue(visibleTexts(in: cell).contains { $0.contains("剩余") && $0.contains("0") }) + let primary = try button(in: cell, id: "drone.orders.order.TEST-ORDER-EXHAUSTED.primary") + XCTAssertEqual(primary.title(for: .normal), "邀请确认") + XCTAssertTrue(primary.isEnabled) + assertOnlyOrders(session) + } + + /// 首屏错误展示重试;成功空态保留零总数,之后下拉刷新可恢复真实数据。 + func testInitialFailureRetryEmptyAndPullRefreshRecovery() async throws { + let (controller, session) = makeController(responses: [ + try TestJSON.errorEnvelope(code: 160001, msg: "测试订单暂不可用"), + try envelope([], total: 0), try envelope([record("RECOVERED")], total: 1) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { self.visibleTexts(in: controller.view).contains { $0.contains("订单加载失败") } } + XCTAssertNil(controller.viewModel.total) + XCTAssertFalse(visibleTexts(in: controller.view).contains { $0.contains("暂无拍摄订单") }) + try button(in: controller.view, id: "drone.orders.retry").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.total == 0 && self.visibleTexts(in: controller.view).contains { $0.contains("暂无拍摄订单") } } + XCTAssertEqual(try countLabel(in: controller).text, "全部订单(0)") + XCTAssertNil(find(in: controller.view, id: "drone.orders.loadMore")) + try XCTUnwrap(list.refreshControl).sendActions(for: .valueChanged) + try await settle(window) { controller.viewModel.orders.first?.orderID == "TEST-ORDER-RECOVERED" } + XCTAssertEqual(session.requests.count, 3) + XCTAssertEqual(session.requests.map { query($0)["page"] }, ["1", "1", "1"]) + assertOnlyOrders(session) + } + + /// 翻页失败不丢第一页,重试读取相同页,成功后追加订单并结束分页。 + func testPageFailurePreservesCardsAndRetryAppendsSecondPage() async throws { + let first = (1...20).map { record(String($0)) } + let (controller, session) = makeController(responses: [ + try envelope(first, total: 21), + try TestJSON.errorEnvelope(code: 160001, msg: "测试分页暂不可用"), + try envelope([record("21")], total: 21, page: 2) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.count == 20 && list.numberOfItems(inSection: 0) == 21 } + list.scrollToItem(at: IndexPath(item: 20, section: 0), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: controller.view, id: "drone.orders.loadMore") != nil } + try button(in: controller.view, id: "drone.orders.loadMore").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.loadMoreErrorMessage != nil && session.requests.count == 2 } + XCTAssertEqual(controller.viewModel.orders.count, 20) + XCTAssertEqual(try countLabel(in: controller).text, "全部订单(21)") + // 错误说明会增加分页行高度,重新滚入视口后再读取当前复用行的重试按钮。 + let footerPath = IndexPath(item: 20, section: 0) + list.scrollToItem(at: footerPath, at: .bottom, animated: false) + try await settle(window) { + guard let cell = list.cellForItem(at: footerPath), + let retry = self.find(in: cell, id: "drone.orders.loadMore") as? UIButton else { return false } + return retry.isEnabled && retry.title(for: .normal) == "重试加载更多" + } + let retryCell = try XCTUnwrap(list.cellForItem(at: footerPath)) + try button(in: retryCell, id: "drone.orders.loadMore").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.orders.count == 21 && !controller.viewModel.hasMore && list.numberOfItems(inSection: 0) == 21 } + XCTAssertEqual(controller.viewModel.orders.last?.orderID, "TEST-ORDER-21") + XCTAssertNil(controller.viewModel.loadMoreErrorMessage) + XCTAssertEqual(session.requests.map { query($0)["page"] }, ["1", "2", "2"]) + assertOnlyOrders(session) + } + + /// 从完整卡开始拍摄传递选中订单和当前范围,跳转前只有读取订单请求。 + func testShootingPassesSelectedOrderAndContextWithoutCreatingTasks() async throws { + var receivedOrder: DroneDockHomeOrder? + var receivedContext: DroneDockHomeContext? + var second = record("SECOND") + second["project_id"] = 202 + let destination = UIViewController() + let (controller, session) = makeController(responses: [try envelope([record("FIRST"), second], total: 2)], factory: { order, context in + receivedOrder = order + receivedContext = context + return destination + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.count == 2 } + let cell = try await card(at: 1, in: list, window: window) + try button(in: cell, id: "drone.orders.order.TEST-ORDER-SECOND.primary").sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.topViewController === destination && controller.navigationController?.transitionCoordinator == nil } + XCTAssertEqual(receivedOrder?.orderNumber, "TEST-ORDER-SECOND") + XCTAssertEqual(receivedOrder?.projectID, 202) + XCTAssertEqual(receivedContext?.scenicID, 128) + XCTAssertEqual(receivedContext?.storeID, 37) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 2) + XCTAssertEqual(session.requests.count, 1) + assertOnlyOrders(session) + } + + /// 确认主按钮进入正式共用页面,来源列表不自动出码,也不进入演示确认页面。 + func testConfirmationRoutesToInjectedPageWithoutWritingFromOrders() async throws { + var order = record("ACTIONS", status: "processing") + order["shot_count"] = 5 + order["remaining_count"] = 0 + order["can_create_task"] = false + order["can_confirm"] = true + order["can_upload_film"] = true + order["material_status"] = 1 + order["film_count"] = 2 + let destination = UIViewController() + var receivedOrder: DroneDockHomeOrder? + let (controller, session) = makeController(responses: [try envelope([order], total: 1)], confirmationFactory: { order, _ in + receivedOrder = order + return destination + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.total == 1 } + let cell = try await card(at: 0, in: list, window: window) + let summary = try XCTUnwrap(find(in: cell, id: "drone.orders.order.TEST-ORDER-ACTIONS.confirmation") as? UIControl) + XCTAssertFalse(hidden(summary)) + XCTAssertTrue(summary.isEnabled) + let control = try XCTUnwrap(find(in: cell, id: "drone.orders.order.TEST-ORDER-ACTIONS.primary") as? UIControl) + XCTAssertTrue(control.isEnabled) + control.sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.topViewController === destination && controller.navigationController?.transitionCoordinator == nil } + XCTAssertEqual(receivedOrder?.orderNumber, "TEST-ORDER-ACTIONS") + XCTAssertEqual(controller.navigationController?.viewControllers.count, 2) + XCTAssertNil(controller.presentedViewController) + XCTAssertEqual(session.requests.count, 1) + assertOnlyOrders(session) + } + + /// 未拍满、零套餐或未知计数均隐藏确认摘要,后端权限和旧完成标记不能绕过次数限制。 + func testIncompleteOrdersHideConfirmationEvenWhenServerAllowsIt() async throws { + let counts: [(Int?, Int?)] = [(5, 4), (5, 0), (0, 0), (nil, 5), (5, nil)] + let records = counts.enumerated().map { index, pair in + var value = record("INCOMPLETE-\(index)", status: "completed") + value["shoot_count"] = pair.0.map { $0 as Any } ?? NSNull() + value["shot_count"] = pair.1.map { $0 as Any } ?? NSNull() + value["can_confirm"] = true + value["can_upload_film"] = true + return value + } + var confirmations = 0 + let (controller, session) = makeController(responses: [try envelope(records, total: records.count)], confirmationFactory: { _, _ in + confirmations += 1 + return UIViewController() + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.count == records.count } + for index in records.indices { + let cell = try await card(at: index, in: list, window: window) + let id = "drone.orders.order.TEST-ORDER-INCOMPLETE-\(index)" + let control = try XCTUnwrap(find(in: cell, id: id + ".confirmation") as? UIControl) + XCTAssertTrue(hidden(control)) + control.sendActions(for: .touchUpInside) + XCTAssertFalse(visibleTexts(in: cell).contains("邀请确认")) + XCTAssertFalse(visibleTexts(in: cell).contains("请游客确认")) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + } + XCTAssertEqual(confirmations, 0) + XCTAssertEqual(session.requests.count, 1) + assertOnlyOrders(session) + } + + /// 同一张卡从拍满更新为未拍满时撤下旧入口,强制触发隐藏控件也不会调用确认。 + func testReusedOrderCardRemovesPreviouslyAvailableConfirmation() throws { + let card = DroneShootingOrderCardView() + var value = record("REUSE", status: "processing") + value["shot_count"] = 5 + value["remaining_count"] = 0 + value["can_create_task"] = false + value["can_confirm"] = true + var confirmations = 0 + card.onConfirmationTap = { confirmations += 1 } + let complete = try JSONDecoder().decode(DroneDockHomeOrder.self, from: JSONSerialization.data(withJSONObject: value)) + card.apply(homeOrder: complete) + let confirmation = try XCTUnwrap(find(in: card, id: "drone.orders.order.TEST-ORDER-REUSE.confirmation") as? UIControl) + XCTAssertFalse(hidden(confirmation)) + confirmation.sendActions(for: .touchUpInside) + XCTAssertEqual(confirmations, 1) + + value["shot_count"] = 4 + value["remaining_count"] = 1 + let incomplete = try JSONDecoder().decode(DroneDockHomeOrder.self, from: JSONSerialization.data(withJSONObject: value)) + card.apply(homeOrder: incomplete) + XCTAssertTrue(hidden(confirmation)) + confirmation.sendActions(for: .touchUpInside) + try button(in: card, id: "drone.orders.order.TEST-ORDER-REUSE.primary").sendActions(for: .touchUpInside) + XCTAssertEqual(confirmations, 1) + } + + /// 复用卡片根据已拍次数和上传状态更新素材入口,并保留邀请确认和历史记录。 + func testReusedCardUpdatesMaterialEntryAndConfirmation() throws { + let card = DroneShootingOrderCardView(frame: CGRect(x: 0, y: 0, width: 358, height: 360)) + let cases: [(Int?, Int?, Int, Bool, String?)] = [ + (0, 25, 0, false, "素材上传中"), + (0, nil, 0, false, nil), (1, nil, 1, false, "上传完成"), + (nil, nil, 0, false, nil), (99, nil, 0, false, nil), + (2, nil, 1, false, "上传中"), (3, nil, 1, false, "上传失败"), + (0, nil, 5, false, "未开始上传"), (1, nil, 5, true, "上传完成"), + (nil, nil, 1, false, "素材状态待确认"), (99, nil, 1, false, "素材状态待确认"), + (nil, 25, 0, false, "素材上传中"), (0, nil, 0, false, nil) + ] + for (materialStatus, activeStatus, shotCount, confirmed, notice) in cases { + var value = record("NOTICE", status: "processing") + let fullQuota = shotCount == 5 + value["material_status"] = materialStatus + value["active_task_status"] = activeStatus + value["active_task_id"] = 21 + value["shot_count"] = shotCount + value["remaining_count"] = 5 - shotCount + value["can_confirm"] = fullQuota + value["order_status"] = confirmed ? 30 : 20 + value["confirm_status"] = confirmed ? 2 : 0 + card.resetForReuse() + card.apply(homeOrder: try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: value))) + let size = card.systemLayoutSizeFitting(CGSize(width: 358, height: 0), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + card.frame.size = size + card.setNeedsLayout() + card.layoutIfNeeded() + let prefix = "drone.orders.order.TEST-ORDER-NOTICE" + let material = try XCTUnwrap(find(in: card, id: prefix + ".materials") as? UIControl) + let confirmation = try XCTUnwrap(find(in: card, id: prefix + ".confirmation") as? UIControl) + let row = try XCTUnwrap(material.superview as? UIStackView) + XCTAssertEqual(material.isHidden, notice == nil) + XCTAssertEqual(confirmation.isHidden, !fullQuota) + XCTAssertEqual(row.isHidden, notice == nil && !fullQuota) + if let notice { + XCTAssertTrue(visibleTexts(in: material).contains("查看素材")) + XCTAssertTrue(visibleTexts(in: material).contains(notice)) + XCTAssertFalse(hidden(material)) + } else { + XCTAssertTrue(visibleTexts(in: material).isEmpty) + } + if fullQuota { + XCTAssertFalse(hidden(confirmation)) + XCTAssertTrue(confirmation.isEnabled) + XCTAssertTrue(visibleTexts(in: confirmation).contains(confirmed ? "查看记录" : "邀请确认")) + } else if notice == nil { + XCTAssertEqual(row.bounds.height, 0, accuracy: 0.5, "没有摘要内容时不保留空白底栏") + } + } + } + + /// 拍摄已满但尚不允许确认时,不显示可操作的邀请按钮,也不绕过后端权限进入确认页。 + func testCompletedQuotaWithoutConfirmationPermissionCannotNavigate() async throws { + var order = record("NO-CONFIRM", status: "processing") + order["shot_count"] = 5 + order["remaining_count"] = 0 + order["can_create_task"] = false + order["can_upload_film"] = true + order["can_confirm"] = false + var confirmations = 0 + let (controller, session) = makeController(responses: [try envelope([order], total: 1)], confirmationFactory: { _, _ in + confirmations += 1 + return UIViewController() + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.total == 1 } + let cell = try await card(at: 0, in: list, window: window) + let confirmation = try XCTUnwrap(find(in: cell, id: "drone.orders.order.TEST-ORDER-NO-CONFIRM.confirmation") as? UIControl) + XCTAssertFalse(confirmation.isEnabled) + confirmation.sendActions(for: .touchUpInside) + XCTAssertEqual(try button(in: cell, id: "drone.orders.order.TEST-ORDER-NO-CONFIRM.primary").title(for: .normal), "交付成片") + XCTAssertEqual(confirmations, 0) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(session.requests.count, 1) + } + + /// 主、副交付按钮及已确认订单先展示方式弹窗,再按所选方式加载交付。 + func testDeliveryButtonsOpenSharedPageWithoutPreselectingTask() async throws { + for (hasShootingPermission, isConfirmed) in [(true, false), (false, false), (false, true)] { + var order = record("DELIVERY", status: isConfirmed ? "completed" : "processing") + order["can_upload_film"] = !isConfirmed + order["can_create_task"] = hasShootingPermission + var destinationSession: MockURLSession? + var factoryCount = 0 + let (controller, session) = makeController(responses: [try envelope([order], total: 1)], deliveryFactory: { order, context, taskID in + factoryCount += 1 + XCTAssertNil(taskID) + let pair = try! DroneDockDeliveryNavigationFixtures.controller(context: context, order: order, taskID: taskID) + destinationSession = pair.1 + XCTAssertTrue(pair.1.requests.isEmpty) + return pair.0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.count == 1 } + let cell = try await card(at: 0, in: list, window: window) + let suffix = hasShootingPermission ? "delivery" : "primary" + let action = try button(in: cell, id: "drone.orders.order.TEST-ORDER-DELIVERY.\(suffix)") + XCTAssertEqual(action.title(for: .normal), "交付成片") + XCTAssertFalse(action.isHidden) + XCTAssertTrue(action.isEnabled) + if isConfirmed { + let confirmation = try XCTUnwrap(find(in: cell, id: "drone.orders.order.TEST-ORDER-DELIVERY.confirmation") as? UIControl) + XCTAssertTrue(confirmation.isEnabled) + XCTAssertTrue(confirmation.accessibilityLabel?.contains("查看记录") == true) + } + action.sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller)?.topViewController is DroneDockDeliveryMethodViewController } + let sheet = try XCTUnwrap(deliveryNavigation(from: controller)) + let methods = try XCTUnwrap(sheet.topViewController as? DroneDockDeliveryMethodViewController) + XCTAssertEqual(sheet.modalPresentationStyle, .pageSheet) + XCTAssertEqual(factoryCount, 0) + XCTAssertNil(destinationSession) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(session.requests.count, 1) + XCTAssertTrue(visibleTexts(in: methods.view).contains("请选择本次交付方式")) + capture(window, name: "我的拍摄订单-交付方式弹窗") + try await selectDeliveryMethod("cloud", in: methods, window: window) + try await settle(window) { + guard let page = sheet.topViewController as? DroneDockDeliveryViewController else { return false } + return page.viewModel.tasks.count == 2 && sheet.transitionCoordinator == nil + } + let page = try XCTUnwrap(sheet.topViewController as? DroneDockDeliveryViewController) + XCTAssertEqual(factoryCount, 1) + XCTAssertTrue(sheet.isModalInPresentation) + XCTAssertEqual(sheet.viewControllers.count, 2) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(page.viewModel.order.orderNumber, "TEST-ORDER-DELIVERY") + XCTAssertNil(page.viewModel.selectedTaskID) + XCTAssertEqual(page.viewModel.context.scenicID, 128) + XCTAssertEqual(destinationSession?.requests.compactMap { $0.url?.lastPathComponent }, ["detail", "tasks"]) + XCTAssertTrue(destinationSession?.requests.allSatisfy { $0.httpMethod == "GET" } == true) + XCTAssertEqual(session.requests.count, 1) + capture(window, name: "我的拍摄订单-弹窗内云端交付") + let back = try XCTUnwrap(page.navigationItem.leftBarButtonItem) + let backAction = try XCTUnwrap(back.action) + UIApplication.shared.sendAction(backAction, to: back.target, from: back, for: nil) + try await settle(window) { sheet.topViewController === methods && sheet.transitionCoordinator == nil } + XCTAssertFalse(sheet.isModalInPresentation) + XCTAssertEqual(sheet.viewControllers.count, 1) + XCTAssertTrue(sheet.isNavigationBarHidden) + XCTAssertEqual(factoryCount, 1) + XCTAssertEqual(destinationSession?.requests.count, 2) + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 连点只显示一个弹窗,取消不会读取交付接口或重置订单筛选和已加载卡片。 + func testDeliverySheetCancelPreservesFilterWithoutExtraRequests() async throws { + var order = record("CANCEL", status: "processing") + order["can_upload_film"] = true + var factoryCount = 0 + let (controller, session) = makeController(responses: [ + try envelope([record("INITIAL")], total: 1), try envelope([order], total: 1) + ], deliveryFactory: { _, _, _ in factoryCount += 1; return UIViewController() }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.orders.first?.orderID == "TEST-ORDER-INITIAL" } + try button(in: controller.view, id: "drone.orders.filter.inProgress").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.orders.first?.orderID == "TEST-ORDER-CANCEL" } + let list = try collection(in: controller) + let cell = try await card(at: 0, in: list, window: window) + let action = try button(in: cell, id: "drone.orders.order.TEST-ORDER-CANCEL.delivery") + action.sendActions(for: .touchUpInside) + action.sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller)?.topViewController is DroneDockDeliveryMethodViewController } + let firstSheet = try XCTUnwrap(deliveryNavigation(from: controller)) + action.sendActions(for: .touchUpInside) + XCTAssertTrue(deliveryNavigation(from: controller) === firstSheet) + XCTAssertNil(firstSheet.presentedViewController) + XCTAssertEqual(factoryCount, 0) + XCTAssertEqual(session.requests.count, 2) + let methods = try XCTUnwrap(firstSheet.topViewController) + try button(in: methods.view, id: "drone.delivery.upload.close").sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller) == nil } + XCTAssertEqual(controller.viewModel.selectedFilter, .inProgress) + XCTAssertEqual(controller.viewModel.orders.map(\.orderID), ["TEST-ORDER-CANCEL"]) + XCTAssertEqual(try countLabel(in: controller).text, "进行中订单(1)") + XCTAssertEqual(session.requests.count, 2) + XCTAssertEqual(factoryCount, 0) + assertOnlyOrders(session) + } + + /// 闪传进入独立本地页面;尚未选视频时不启动监听,也不请求云端或设备接口。 + func testNearbyMethodReturnsToChoicesWithoutOpeningCloud() async throws { + var order = record("NEARBY", status: "processing") + order["can_upload_film"] = true + var factoryCount = 0 + let (controller, session) = makeController(responses: [try envelope([order], total: 1)], + deliveryFactory: { _, _, _ in factoryCount += 1; return UIViewController() }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.orders.count == 1 } + let cell = try await card(at: 0, in: collection(in: controller), window: window) + try button(in: cell, id: "drone.orders.order.TEST-ORDER-NEARBY.delivery").sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller)?.topViewController is DroneDockDeliveryMethodViewController } + let sheet = try XCTUnwrap(deliveryNavigation(from: controller)) + let methods = try XCTUnwrap(sheet.topViewController as? DroneDockDeliveryMethodViewController) + try await selectDeliveryMethod("nearby", in: methods, window: window) + try await settle(window) { sheet.topViewController is DroneDockNearbyTransferViewController } + XCTAssertEqual(sheet.viewControllers.count, 2) + XCTAssertEqual(factoryCount, 0) + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(sheet.topViewController?.title, "面对面闪传") + capture(window, name: "我的拍摄订单-局域网闪传选择视频") + sheet.popViewController(animated: false) + try await settle(window) { self.find(in: methods.view, id: "drone.delivery.method.cloud") != nil } + XCTAssertTrue(visibleTexts(in: methods.view).contains("请选择本次交付方式")) + XCTAssertEqual(factoryCount, 0) + try button(in: methods.view, id: "drone.delivery.upload.close").sendActions(for: .touchUpInside) + try await settle(window) { self.deliveryNavigation(from: controller) == nil } + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(controller.viewModel.orders.count, 1) + } + + /// 从已有任务返回后刷新同一订单,已上传的素材可以从列表打开并读取正确订单。 + func testReturningFromTaskShowsUploadedMaterialsAndOpensSelectedOrder() async throws { + var materialsSession: MockURLSession? + var second = record("SECOND", status: "processing") + second["shoot_count"] = 1 + second["shot_count"] = 0 + second["remaining_count"] = 1 + second["active_task_id"] = 801 + second["active_task_status"] = 20 + var completed = record("SECOND", status: "completed") + completed["shoot_count"] = 1 + completed["shot_count"] = 1 + completed["material_status"] = 1 + let task = UIViewController() + let responses = try [ + envelope([record("FIRST"), second], total: 2), + envelope([record("FIRST"), completed], total: 2) + ] + let (controller, session) = makeController(responses: responses, + materialsFactory: { order, context in + XCTAssertEqual(order.canUploadFilm, false) + let result = try! DroneDockMaterialsNavigationFixtures.controller(context: context, order: order) + materialsSession = result.1 + XCTAssertTrue(result.1.requests.isEmpty) + return result.0 + }, taskFactory: { taskID, order, _ in + XCTAssertEqual(taskID, 801) + XCTAssertEqual(order.orderNumber, "TEST-ORDER-SECOND") + return task + }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.orders.count == 2 } + let cell = try await card(at: 1, in: list, window: window) + let identifier = "drone.orders.order.TEST-ORDER-SECOND" + XCTAssertTrue(hidden(try XCTUnwrap(find(in: cell, id: identifier + ".materials")))) + try button(in: cell, id: identifier + ".primary").sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { navigation.topViewController === task && navigation.transitionCoordinator == nil } + navigation.popViewController(animated: false) + + try await settle(window) { controller.viewModel.orders.last?.materialStatus == 1 } + let refreshed = try await card(at: 1, in: list, window: window) + let control = try XCTUnwrap(find(in: refreshed, id: identifier + ".materials") as? UIControl) + XCTAssertFalse(hidden(control)) + XCTAssertTrue(control.isEnabled) + XCTAssertTrue(visibleTexts(in: control).contains("查看素材")) + XCTAssertTrue(visibleTexts(in: control).contains("上传完成")) + control.sendActions(for: .touchUpInside) + try await settle(window) { + (controller.navigationController?.topViewController as? DroneDockMaterialsViewController)?.viewModel.total == 0 + && controller.navigationController?.transitionCoordinator == nil + } + let materials = try XCTUnwrap(controller.navigationController?.topViewController as? DroneDockMaterialsViewController) + XCTAssertEqual(materials.viewModel.order.orderNumber, "TEST-ORDER-SECOND") + XCTAssertEqual(materials.viewModel.context.scenicID, 128) + XCTAssertEqual(materials.viewModel.context.storeID, 37) + let requests = try XCTUnwrap(materialsSession?.requests) + XCTAssertEqual(requests.compactMap { $0.url?.lastPathComponent }, ["detail", "tasks"]) + XCTAssertTrue(requests.allSatisfy { $0.httpMethod == "GET" && $0.httpBody == nil }) + XCTAssertEqual(requests.map { query($0)["order_number"] }, ["TEST-ORDER-SECOND", "TEST-ORDER-SECOND"]) + XCTAssertEqual(requests.map { query($0)["scenic_id"] }, ["128", "128"]) + XCTAssertEqual(session.requests.count, 2) + assertOnlyOrders(session) + } + + /// 同订单刷新缺失字段时清除上一张卡的游客、套餐、次数及动作,未知不补零。 + func testRefreshClearsMissingFieldsAndShowsUnknownCounts() async throws { + let minimal: [String: Any] = ["order_number": "TEST-ORDER-UNKNOWN", "project_id": 101] + let (controller, session) = makeController(responses: [try envelope([record("UNKNOWN")], total: 1), try envelope([minimal], total: 1)]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.total == 1 } + _ = try await card(at: 0, in: list, window: window) + try XCTUnwrap(list.refreshControl).sendActions(for: .valueChanged) + try await settle(window) { controller.viewModel.orders.first?.shotTotal == nil && self.visibleTexts(in: controller.view).contains("游客信息待确认") } + let cell = try await card(at: 0, in: list, window: window) + let texts = visibleTexts(in: cell) + XCTAssertTrue(texts.contains("套餐信息待确认")) + XCTAssertTrue(texts.contains("状态待确认")) + XCTAssertTrue(texts.contains { $0.contains("—") }) + XCTAssertFalse(texts.contains("游客 130****0001")) + XCTAssertFalse(texts.contains { $0.contains("测试多点位套餐") }) + XCTAssertFalse(texts.contains("开始拍摄")) + XCTAssertFalse(texts.contains { $0.contains("0/0") }) + let primary = find(in: cell, id: "drone.orders.order.TEST-ORDER-UNKNOWN.primary") as? UIButton + XCTAssertTrue(primary == nil || hidden(primary!) || primary?.isEnabled == false) + XCTAssertEqual(session.requests.count, 2) + assertOnlyOrders(session) + } + + private func makeController(responses: [Data], + materialsFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + deliveryFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil, + confirmationFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + taskFactory: ((Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + factory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) -> (DroneDockOrdersViewController, MockURLSession) { + let context = DroneDockHomeContext(userID: "orders-ui-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "orders-ui-token") + let session = MockURLSession(responses: responses) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "orders-ui-token" } + let model = DroneDockOrdersViewModel(context: context, service: DroneDockAPI(client: client), currentContext: { context }) + return (DroneDockOrdersViewController(viewModel: model, + preparationControllerFactory: factory ?? { _, _ in UIViewController() }, + materialsControllerFactory: materialsFactory ?? { _, _ in UIViewController() }, + deliveryControllerFactory: deliveryFactory, confirmationControllerFactory: confirmationFactory, + taskControllerFactory: taskFactory), session) + } + + private func record(_ id: String, status: String = "pending") -> [String: Any] { + ["order_number": "TEST-ORDER-\(id)", "project_id": 101, "created_at": "2026-10-28 10:00:00", + "user_phone": "130****0001", "project_name": "测试多点位套餐", "shoot_count": 5, + "shot_count": status == "completed" ? 5 : status == "pending" ? 0 : 1, + "remaining_count": status == "completed" ? 0 : status == "pending" ? 5 : 4, + "shoot_status": status, "order_status": status == "completed" ? 30 : 20, + "material_status": 0, "film_count": 0, "confirm_status": status == "completed" ? 2 : 0, + "can_create_task": status != "completed", "can_upload_film": false, "can_confirm": false] + } + + private func envelope(_ orders: [[String: Any]], total: Int, page: Int = 1) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": [ + "list": orders, "total": total, "page": page, "page_size": 20 + ]]) + } + + private func query(_ request: URLRequest) -> [String: String] { + let items = URLComponents(url: request.url!, resolvingAgainstBaseURL: false)?.queryItems ?? [] + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } + + private func assertOnlyOrders(_ session: MockURLSession, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertFalse(session.requests.isEmpty, file: file, line: line) + for request in session.requests { + XCTAssertEqual(request.httpMethod, "GET", file: file, line: line) + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/orders", file: file, line: line) + XCTAssertNil(request.httpBody, file: file, line: line) + XCTAssertEqual(query(request)["scenic_id"], "128", file: file, line: line) + XCTAssertEqual(query(request)["page_size"], "20", file: file, line: line) + XCTAssertNil(query(request)["lat"], file: file, line: line) + XCTAssertNil(query(request)["lng"], file: file, line: line) + } + } + + private func deliveryNavigation(from controller: UIViewController) -> UINavigationController? { + (controller.presentedViewController ?? controller.navigationController?.presentedViewController) as? UINavigationController + } + + private func selectDeliveryMethod(_ method: String, in controller: UIViewController, window: UIWindow) async throws { + let list = try XCTUnwrap(find(in: controller.view, id: "drone.delivery.method.list") as? UICollectionView) + let identifier = "drone.delivery.method.\(method)" + try await settle(window) { self.find(in: list, id: identifier) != nil } + let cell = try XCTUnwrap(find(in: list, id: identifier) as? UICollectionViewCell) + let path = try XCTUnwrap(list.indexPath(for: cell)) + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + + private func collection(in controller: UIViewController) throws -> UICollectionView { + controller.loadViewIfNeeded() + return try XCTUnwrap(find(in: controller.view, id: "drone.orders.remote.list") as? UICollectionView) + } + + private func countLabel(in controller: UIViewController) throws -> UILabel { + try XCTUnwrap(find(in: controller.view, id: "drone.orders.count") as? UILabel) + } + + private func button(in root: UIView, id: String) throws -> UIButton { + try XCTUnwrap(find(in: root, id: id) as? UIButton) + } + + private func card(at index: Int, in list: UICollectionView, window: UIWindow) async throws -> UICollectionViewCell { + let path = IndexPath(item: index, section: 0) + list.scrollToItem(at: path, at: .centeredVertically, animated: false) + try await settle(window) { list.cellForItem(at: path) is DroneShootingOrderCell } + return try XCTUnwrap(list.cellForItem(at: path)) + } + + private func makeWindow(root: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: root) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, file: StaticString = #filePath, line: UInt = #line, + until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 300_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + capture(window, name: "拍摄订单页等待超时-\(line)") + XCTFail("拍摄订单页未在预期时间内稳定显示", file: file, line: line) + throw NSError(domain: "DroneDockOrdersViewTests", code: 1) + } + + private func views(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { views(in: $0) } } + private func hidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(hidden) ?? false) } + private func find(in root: UIView, id: String) -> UIView? { views(in: root).first { $0.accessibilityIdentifier == id } } + private func visibleTexts(in root: UIView) -> [String] { + views(in: root).compactMap { view in + guard let label = view as? UILabel, !hidden(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + + private func assertUnambiguousLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = views(in: root).filter { !hidden($0) && !$0.bounds.isEmpty && $0.hasAmbiguousLayout } + XCTAssertTrue(ambiguous.isEmpty, "可见布局存在歧义:\(ambiguous.map { String(describing: type(of: $0)) })", file: file, line: line) + } + + private func capture(_ window: UIWindow, name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/suixinkanTests/DroneDockPaymentAPITests.swift b/suixinkanTests/DroneDockPaymentAPITests.swift new file mode 100644 index 0000000..7019da2 --- /dev/null +++ b/suixinkanTests/DroneDockPaymentAPITests.swift @@ -0,0 +1,132 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 核对张工的三个收款接口契约;全部使用匿名数据和隔离网络替身。 +@MainActor +final class DroneDockPaymentAPITests: XCTestCase { + /// 套餐请求只发送景区范围,凭证由统一客户端注入。 + func testProjectsRequestUsesContractAndDecodesPriceAndQuota() async throws { + let session = MockURLSession(responses: [DroneDockPaymentTestFixtures.envelope(DroneDockPaymentTestFixtures.projects)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "payment-fixture-token" } + let projects = try await DroneDockPaymentAPI(client: client).projects(scenicID: 128) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/projects") + XCTAssertEqual(query(request), ["scenic_id": "128"]) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "payment-fixture-token") + XCTAssertNil(request.httpBody) + XCTAssertEqual(projects.map(\.id), [101, 102]) + XCTAssertEqual(projects[0].price, Decimal(string: "99.00")) + XCTAssertEqual(projects[0].shootCount, 3) + } + + /// 可选报价必须真正省略;指定报价使用 JSON 字符串和精确的元金额。 + func testPayCodeOmitsDefaultPriceAndNormalizesExplicitQuote() async throws { + let payload = DroneDockPaymentTestFixtures.envelope(DroneDockPaymentTestFixtures.code()) + let session = MockURLSession(responses: [payload, payload]) + let api = DroneDockPaymentAPI(client: APIClient(environment: .testing, session: session)) + _ = try await api.payCode(scenicID: 128, projectID: 101) + let result = try await api.payCode(scenicID: 128, projectID: 101, price: "88.1") + XCTAssertEqual(session.requests.count, 2) + for request in session.requests { + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/pay-code") + XCTAssertTrue(query(request).isEmpty) + } + let first = try body(session.requests[0]) + let second = try body(session.requests[1]) + XCTAssertEqual(first["scenic_id"] as? Int, 128) + XCTAssertEqual(first["project_id"] as? Int, 101) + XCTAssertNil(first["price"]) + XCTAssertEqual(second["price"] as? String, "88.10") + XCTAssertEqual(Set(second.keys), ["scenic_id", "project_id", "price"]) + XCTAssertEqual(result.storeID, 37) + XCTAssertEqual(result.payURL, "https://example.com/mini_qr/project-101.png") + } + + /// 收款查询使用 Laravel 分页,保留现金退款及积分,不猜测当前码的支付状态。 + func testReceiptsUsesFilterAndBackendDateDefaults() async throws { + let payload = DroneDockPaymentTestFixtures.envelope(DroneDockPaymentTestFixtures.receipts) + let session = MockURLSession(responses: [payload, payload]) + let api = DroneDockPaymentAPI(client: APIClient(environment: .testing, session: session)) + _ = try await api.receipts(scenicID: 128) + let response = try await api.receipts(scenicID: 128, projectID: 101, page: 2) + XCTAssertEqual(query(session.requests[0]), ["scenic_id": "128", "page": "1"]) + XCTAssertEqual(query(session.requests[1]), ["scenic_id": "128", "project_id": "101", "page": "2"]) + XCTAssertEqual(session.requests[1].httpMethod, "GET") + XCTAssertEqual(session.requests[1].url?.path, "/api/yf-handset-app/photog/multi-plane/receipts") + XCTAssertEqual(response.records.items[0].orderNumber, "TEST-ORDER-001") + XCTAssertEqual(response.records.items[0].cashRefund, Decimal(8)) + XCTAssertEqual(response.records.items[0].cashNet, Decimal(80)) + XCTAssertEqual(response.summary.count, 3) + XCTAssertEqual(response.summary.pointsNet, 90) + } + + /// 无效金额、身份或分页在本地拒绝,不向后端发空值或范围不明的请求。 + func testInvalidInputsDoNotSendRequests() async { + let session = MockURLSession(responses: []) + let api = DroneDockPaymentAPI(client: APIClient(environment: .testing, session: session)) + do { _ = try await api.projects(scenicID: 0); XCTFail("应拒绝无效景区") } catch {} + for price in ["", "0", "100000", "1.001", "nan", "1e2", "-1"] { + do { _ = try await api.payCode(scenicID: 128, projectID: 101, price: price); XCTFail(price) } catch {} + } + do { _ = try await api.payCode(scenicID: 128, projectID: 0); XCTFail("应拒绝无效套餐") } catch {} + do { _ = try await api.receipts(scenicID: 128, page: 0); XCTFail("应拒绝无效页码") } catch {} + do { _ = try await api.receipts(scenicID: 128, projectID: 0); XCTFail("应拒绝无效套餐筛选") } catch {} + XCTAssertTrue(session.requests.isEmpty) + } + + /// 业务错误透传提示,重复套餐身份也不能进入列表。 + func testBusinessErrorAndDuplicateProjectIDsAreRejected() async throws { + let duplicate = #"[{"id":101,"name":"套餐甲","price":"99.00","shoot_count":3},{"id":101,"name":"套餐乙","price":"99.00","shoot_count":3}]"# + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 160001, msg: "套餐已下架"), + DroneDockPaymentTestFixtures.envelope(duplicate)]) + let api = DroneDockPaymentAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.payCode(scenicID: 128, projectID: 101) + XCTFail("业务失败不能生成小程序收款码") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "套餐已下架") + } + do { _ = try await api.projects(scenicID: 128); XCTFail("应拒绝重复套餐 ID") } catch {} + } + + private func query(_ request: URLRequest) -> [String: String] { + let items = request.url.flatMap { URLComponents(url: $0, resolvingAgainstBaseURL: false)?.queryItems } ?? [] + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } + + private func body(_ request: URLRequest) throws -> [String: Any] { + try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + } +} + +/// 按张工接口字段编写的匿名契约样本;不含真实账户、游客或小程序收款码。 +enum DroneDockPaymentTestFixtures { + /// 当前景区两款可售套餐。 + static let projects = #"[{"id":101,"name":"三次航拍","price":"99.00","shoot_count":3},{"id":"102","name":"五次航拍","price":199.99,"shoot_count":"5"}]"# + + /// 可复用链接样本,参数用于验证错配与乱序回包。 + static func code(projectID: Int = 101, price: String = "88.00", storeID: Int = 37) -> String { + """ + {"project_id":\(projectID),"project_name":"测试航拍套餐","price":"\(price)","shoot_count":3, + "store_user_id":51,"store_id":\(storeID),"pay_url":"https://example.com/mini_qr/project-\(projectID).png"} + """ + } + + /// 列表只有当前页一项,汇总覆盖三项,用于防止把汇总误算成当前页。 + static let receipts = #"{"records":{"current_page":"1","per_page":20,"total":3,"last_page":1,"data":[{"project_id":101,"project_name":"三次航拍","order_number":"TEST-ORDER-001","order_status":20,"pay_time":1793066400,"payer":"测**","cash_paid":"88.00","cash_refund":"8.00","cash_net":"80.00","points_paid":100,"points_refund":10,"points_net":90,"point_amount":"1.00"}]},"summary":{"count":3,"cash_paid":"188.00","cash_refund":"8.00","cash_net":"180.00","points_paid":100,"points_refund":10,"points_net":90,"point_amount":"1.00"}}"# + + /// 为网络替身补齐统一业务包裹。 + static func envelope(_ payload: String) -> Data { + Data("{\"code\":100000,\"msg\":\"success\",\"data\":\(payload),\"time\":\"2026-10-27 14:00:00\"}".utf8) + } + + /// 用与网络相同的解码入口构造测试对象。 + static func decode(_ type: T.Type, _ payload: String) throws -> T { + try JSONDecoder().decode(type, from: Data(payload.utf8)) + } +} diff --git a/suixinkanTests/DroneDockPaymentModelTests.swift b/suixinkanTests/DroneDockPaymentModelTests.swift new file mode 100644 index 0000000..3876cf2 --- /dev/null +++ b/suixinkanTests/DroneDockPaymentModelTests.swift @@ -0,0 +1,75 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证收款结构、金额精度和图片地址边界,不替代真实支付验证。 +final class DroneDockPaymentModelTests: XCTestCase { + /// 报价按十进制边界校验,固定两位格式交给后端。 + func testPriceValidationAndNormalization() { + for (input, expected) in [("0.01", "0.01"), ("99999.99", "99999.99"), (" 88.1 ", "88.10"), + ("0099", "99.00"), ("1", "1.00")] { + XCTAssertEqual(DroneDockPriceValidator.normalizedPrice(input), expected) + XCTAssertNil(DroneDockPriceValidator.validationMessage(for: input)) + } + for input in ["", "0", "0.001", "1.001", "100000", "-1", "+1", "1.", ".1", "1e2", "1,000", "nan", "9元"] { + XCTAssertNil(DroneDockPriceValidator.normalizedPrice(input), input) + XCTAssertNotNil(DroneDockPriceValidator.validationMessage(for: input), input) + } + } + + /// ID、次数和时间适度兼容整数文本;金额兼容数字而不丢分。 + func testNumericCompatibilityPreservesExactDecimalAndIntegers() throws { + let projects = try DroneDockPaymentTestFixtures.decode([DroneDockProject].self, DroneDockPaymentTestFixtures.projects) + XCTAssertEqual(projects[1].id, 102) + XCTAssertEqual(projects[1].shootCount, 5) + XCTAssertEqual(projects[1].price, Decimal(string: "199.99")) + let payload = DroneDockPaymentTestFixtures.receipts + .replacingOccurrences(of: "1793066400", with: "\"1793066400\"") + .replacingOccurrences(of: "\"cash_paid\":\"88.00\"", with: "\"cash_paid\":0") + let response = try DroneDockPaymentTestFixtures.decode(DroneDockReceiptsResponse.self, payload) + XCTAssertEqual(response.records.currentPage, 1) + XCTAssertEqual(response.records.items[0].payTime, 1_793_066_400) + XCTAssertEqual(response.records.items[0].cashPaid, .zero) + XCTAssertEqual(response.records.items[0].cashRefund, Decimal(8)) + } + + /// 缺失、null、非法小数及布尔数值不能被当成可售套餐。 + func testInvalidProjectFieldsAreRejected() { + for price in ["null", "\"nan\"", "\"99oops\"", "\"1.001\"", "1.001", "true", "0", "100000"] { + let payload = "{\"id\":101,\"name\":\"测试套餐\",\"price\":\(price),\"shoot_count\":3}" + XCTAssertThrowsError(try DroneDockPaymentTestFixtures.decode(DroneDockProject.self, payload), price) + } + for payload in [#"{"id":101,"name":"测试套餐","shoot_count":3}"#, + #"{"id":0,"name":"测试套餐","price":"99.00","shoot_count":3}"#, + #"{"id":101,"name":"测试套餐","price":"99.00","shoot_count":0}"#, + #"{"id":101,"name":"测试套餐","price":"99.00","shoot_count":1.5}"#] { + XCTAssertThrowsError(try DroneDockPaymentTestFixtures.decode(DroneDockProject.self, payload)) + } + } + + /// 只允许完整 HTTP(S) 图片地址,拒绝脚本、自定义协议及带凭证地址。 + func testPaymentURLValidation() throws { + let original = "https://example.com/mini_qr/project-101.png" + for url in ["http://example.com/pay.png", original, "https://example.com/image?id=101"] { + let payload = DroneDockPaymentTestFixtures.code().replacingOccurrences(of: original, with: url) + XCTAssertEqual(try DroneDockPaymentTestFixtures.decode(DroneDockPayCode.self, payload).payURL, url) + } + for url in ["", "javascript:alert(1)", "file:///tmp/pay", "/pay", "https://", "https://user:pass@example.com/pay", "https://example.com/a b"] { + let payload = DroneDockPaymentTestFixtures.code().replacingOccurrences(of: original, with: url) + XCTAssertThrowsError(try DroneDockPaymentTestFixtures.decode(DroneDockPayCode.self, payload), url) + } + } + + /// Laravel 列表缺失或汇总金额未知时报错,不产生伪造空记录与零金额。 + func testReceiptsRequireRealPaginationAndMoneyFields() throws { + let response = try DroneDockPaymentTestFixtures.decode(DroneDockReceiptsResponse.self, DroneDockPaymentTestFixtures.receipts) + XCTAssertEqual(response.records.total, 3) + XCTAssertEqual(response.records.items.count, 1) + XCTAssertEqual(response.summary.cashPaid, Decimal(188)) + for payload in [#"{"records":{"current_page":1,"per_page":20,"total":0,"last_page":1},"summary":{}}"#, + DroneDockPaymentTestFixtures.receipts.replacingOccurrences(of: "\"cash_paid\":\"188.00\"", with: "\"cash_paid\":null"), + DroneDockPaymentTestFixtures.receipts.replacingOccurrences(of: "\"points_net\":90", with: "\"points_net\":1.5")] { + XCTAssertThrowsError(try DroneDockPaymentTestFixtures.decode(DroneDockReceiptsResponse.self, payload)) + } + } +} diff --git a/suixinkanTests/DroneDockPaymentViewModelTests.swift b/suixinkanTests/DroneDockPaymentViewModelTests.swift new file mode 100644 index 0000000..334f894 --- /dev/null +++ b/suixinkanTests/DroneDockPaymentViewModelTests.swift @@ -0,0 +1,383 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证独立套餐收款状态、报价校验与会话隔离,不调用真实付款服务。 +@MainActor +final class DroneDockPaymentViewModelTests: XCTestCase { + /// 成功空列表与请求失败分开表达,并允许明确重试。 + func testProjectsEmptyFailureAndRetryAreDistinct() async throws { + let scope = PaymentContextBox(context()) + let service = try ImmediatePaymentService() + let model = makeModel(scope, service) + service.projectsResult = .success([]) + await model.loadProjects() + XCTAssertTrue(model.projects.isEmpty) + XCTAssertNil(model.projectError) + XCTAssertFalse(model.isLoadingProjects) + + service.projectsResult = .failure(APIError.networkFailed("套餐读取超时")) + await model.loadProjects() + XCTAssertTrue(model.projects.isEmpty) + XCTAssertTrue(model.projectError?.contains("套餐读取超时") == true) + + service.projectsResult = .success(try projects()) + await model.loadProjects() + XCTAssertEqual(model.projects.map(\.id), [101, 102]) + XCTAssertNil(model.projectError) + XCTAssertNil(model.payCode) + } + + /// 默认价格留给后端确定;显式改价采用规范化字符串并接受后端确认值。 + func testDefaultAndCustomQuotesUseServerConfirmedResult() async throws { + let scope = PaymentContextBox(context()) + let service = try ImmediatePaymentService() + let model = makeModel(scope, service) + await model.loadProjects() + await model.generateCode(projectID: 101) + XCTAssertNil(service.codeRequests.first?.price) + XCTAssertEqual(model.payCode?.price, Decimal(88)) + XCTAssertFalse(model.isGenerating) + XCTAssertNil(model.payCodeError) + + service.codeResult = .success(try code(price: "88.10")) + await model.generateCode(projectID: 101, price: " 88.1 ") + XCTAssertEqual(service.codeRequests.last?.price, "88.10") + XCTAssertEqual(model.payCode?.price, Decimal(string: "88.10")) + XCTAssertEqual(service.codeRequests.last?.scenicID, 128) + } + + /// 生成失败或输入无效时不能留下可保存、可扫码的旧小程序收款码。 + func testGeneratingFailureAndInvalidInputClearOldCode() async throws { + let scope = PaymentContextBox(context()) + let service = try ImmediatePaymentService() + let model = makeModel(scope, service) + await model.loadProjects() + await model.generateCode(projectID: 101) + XCTAssertNotNil(model.payCode) + + service.codeResult = .failure(APIError.serverCode(160001, "套餐已下架")) + await model.generateCode(projectID: 102) + XCTAssertNil(model.payCode) + XCTAssertEqual(model.payCodeError, "套餐已下架") + XCTAssertFalse(model.isGenerating) + let count = service.codeRequests.count + await model.generateCode(projectID: 101, price: "0") + XCTAssertEqual(service.codeRequests.count, count) + XCTAssertNil(model.payCode) + XCTAssertNotNil(model.payCodeError) + } + + /// 所选套餐、当前门店和显式金额任一不一致都拒绝回包。 + func testMismatchedProjectStoreOrExplicitPriceIsRejected() async throws { + let scope = PaymentContextBox(context()) + let service = try ImmediatePaymentService() + let model = makeModel(scope, service) + await model.loadProjects() + for result in [try code(projectID: 102), try code(storeID: 999), try code(price: "89.00")] { + service.codeResult = .success(result) + await model.generateCode(projectID: 101, price: "88.00") + XCTAssertNil(model.payCode) + XCTAssertNotNil(model.payCodeError) + XCTAssertFalse(model.isGenerating) + } + } + + /// 缺失登录范围或未加载的套餐不能创建小程序收款码。 + func testInvalidContextAndUnknownProjectNeverCallCodeService() async throws { + let scope = PaymentContextBox(context(token: "")) + let service = try ImmediatePaymentService() + let model = makeModel(scope, service) + await model.loadProjects() + await model.generateCode(projectID: 101) + XCTAssertTrue(service.projectRequests.isEmpty) + XCTAssertTrue(service.codeRequests.isEmpty) + XCTAssertNotNil(model.projectError) + XCTAssertNotNil(model.payCodeError) + + scope.value = context() + await model.loadProjects() + await model.generateCode(projectID: 999) + XCTAssertTrue(service.codeRequests.isEmpty) + XCTAssertNil(model.payCode) + } + + /// 同一在途报价重复点击只发一次;换套餐后的迟到旧结果不能覆盖新二维码。 + func testDuplicateSubmissionAndOutOfOrderQuotes() async throws { + let scope = PaymentContextBox(context()) + let service = try SuspendedPaymentCodeService() + let model = makeModel(scope, service) + await model.loadProjects() + let firstStarted = expectation(description: "第一个报价请求") + let secondStarted = expectation(description: "换套餐报价请求") + service.requestStarted = { index in + if index == 0 { firstStarted.fulfill() } + if index == 1 { secondStarted.fulfill() } + } + defer { service.cancelAll() } + let first = Task { await model.generateCode(projectID: 101, price: "88") } + await fulfillment(of: [firstStarted], timeout: 2) + XCTAssertTrue(model.isGenerating) + XCTAssertNil(model.payCode) + await model.generateCode(projectID: 101, price: "88.00") + XCTAssertEqual(service.requests.count, 1) + + let second = Task { await model.generateCode(projectID: 102, price: "199.99") } + await fulfillment(of: [secondStarted], timeout: 2) + service.finish(1, .success(try code(projectID: 102, price: "199.99"))) + await second.value + XCTAssertEqual(model.payCode?.projectID, 102) + service.finish(0, .success(try code())) + await first.value + XCTAssertEqual(model.payCode?.projectID, 102) + XCTAssertEqual(model.payCode?.price, Decimal(string: "199.99")) + XCTAssertFalse(model.isGenerating) + XCTAssertNil(model.payCodeError) + } + + /// 开始新报价就撤下旧码,旧请求失败也不能终止新请求的加载状态。 + func testOldFailureDoesNotOverwriteNewQuoteLoadingState() async throws { + let scope = PaymentContextBox(context()) + let service = try SuspendedPaymentCodeService() + let model = makeModel(scope, service) + await model.loadProjects() + let firstStarted = expectation(description: "首个请求") + let secondStarted = expectation(description: "新的报价请求") + service.requestStarted = { index in + if index == 0 { firstStarted.fulfill() } + if index == 1 { secondStarted.fulfill() } + } + defer { service.cancelAll() } + let first = Task { await model.generateCode(projectID: 101) } + await fulfillment(of: [firstStarted], timeout: 2) + let second = Task { await model.generateCode(projectID: 101, price: "80.00") } + await fulfillment(of: [secondStarted], timeout: 2) + service.finish(0, .failure(APIError.networkFailed("旧报价失败"))) + await first.value + XCTAssertTrue(model.isGenerating) + XCTAssertNil(model.payCodeError) + XCTAssertNil(model.payCode) + service.finish(1, .success(try code(price: "80.00"))) + await second.value + XCTAssertEqual(model.payCode?.price, Decimal(80)) + } + + /// 更换登录凭证、账号、景区或门店后,旧会话小程序收款码均不能回填。 + func testChangedIdentityRejectsInFlightQuoteAndClearsProjects() async throws { + for changed in [context(token: "another-test-token"), context(userID: "other-user"), + context(scenicID: 129), context(storeID: 38)] { + let scope = PaymentContextBox(context()) + let service = try SuspendedPaymentCodeService() + let model = makeModel(scope, service) + await model.loadProjects() + let started = expectation(description: "旧身份报价已发送") + service.requestStarted = { _ in started.fulfill() } + let task = Task { await model.generateCode(projectID: 101) } + await fulfillment(of: [started], timeout: 2) + scope.value = changed + service.finish(0, .success(try code())) + await task.value + XCTAssertEqual(model.context, changed) + XCTAssertNil(model.payCode) + XCTAssertTrue(model.projects.isEmpty) + XCTAssertFalse(model.isGenerating) + XCTAssertNotNil(model.payCodeError) + } + } + + /// 页面退出后成功回包无效,下一次重新加载仍能工作。 + func testInvalidateRejectsPendingQuote() async throws { + let scope = PaymentContextBox(context()) + let service = try SuspendedPaymentCodeService() + let model = makeModel(scope, service) + await model.loadProjects() + let started = expectation(description: "待取消报价请求") + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let task = Task { await model.generateCode(projectID: 101) } + await fulfillment(of: [started], timeout: 2) + model.invalidate() + service.finish(0, .success(try code())) + await task.value + XCTAssertTrue(model.projects.isEmpty) + XCTAssertNil(model.payCode) + XCTAssertFalse(model.isGenerating) + XCTAssertNil(model.payCodeError) + await model.loadProjects() + XCTAssertEqual(model.projects.count, 2) + } + + /// 取消的报价即使网络仍成功完成,也不显示链接或取消错误。 + func testTaskCancellationDoesNotPublishCode() async throws { + let scope = PaymentContextBox(context()) + let service = try SuspendedPaymentCodeService() + let model = makeModel(scope, service) + await model.loadProjects() + let started = expectation(description: "待取消任务") + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let task = Task { await model.generateCode(projectID: 101) } + await fulfillment(of: [started], timeout: 2) + task.cancel() + service.finish(0, .success(try code())) + await task.value + XCTAssertNil(model.payCode) + XCTAssertNil(model.payCodeError) + XCTAssertFalse(model.isGenerating) + } + + /// 套餐加载防重复,切换范围后可以发新请求,旧列表不能覆盖新的空态。 + func testProjectsDeduplicateAndRejectPreviousContextResponse() async throws { + let scope = PaymentContextBox(context()) + let service = SuspendedPaymentProjectsService() + let model = makeModel(scope, service) + let firstStarted = expectation(description: "旧景区套餐请求") + let secondStarted = expectation(description: "新景区套餐请求") + service.requestStarted = { index in + if index == 0 { firstStarted.fulfill() } + if index == 1 { secondStarted.fulfill() } + } + defer { service.cancelAll() } + let first = Task { await model.loadProjects() } + await fulfillment(of: [firstStarted], timeout: 2) + await model.loadProjects() + XCTAssertEqual(service.requests.count, 1) + scope.value = context(scenicID: 129) + let second = Task { await model.loadProjects() } + await fulfillment(of: [secondStarted], timeout: 2) + service.finish(1, .success([])) + await second.value + service.finish(0, .success(try projects())) + await first.value + XCTAssertEqual(model.context.scenicID, 129) + XCTAssertTrue(model.projects.isEmpty) + XCTAssertFalse(model.isLoadingProjects) + XCTAssertNil(model.projectError) + } + + private func context(userID: String = "test-user", scenicID: Int = 128, storeID: Int = 37, + token: String = "test-payment-session") -> DroneDockHomeContext { + DroneDockHomeContext(userID: userID, accountType: "photographer", scenicID: scenicID, + scenicName: "测试景区", storeID: storeID, photographerName: "测试员工", token: token) + } + + private func makeModel(_ scope: PaymentContextBox, _ service: any DroneDockPaymentServing) -> DroneDockPaymentViewModel { + DroneDockPaymentViewModel(context: scope.value, service: service, currentContext: { scope.value }) + } + + private func projects() throws -> [DroneDockProject] { + try DroneDockPaymentTestFixtures.decode([DroneDockProject].self, DroneDockPaymentTestFixtures.projects) + } + + private func code(projectID: Int = 101, price: String = "88.00", storeID: Int = 37) throws -> DroneDockPayCode { + try DroneDockPaymentTestFixtures.decode(DroneDockPayCode.self, DroneDockPaymentTestFixtures.code(projectID: projectID, price: price, storeID: storeID)) + } +} + +/// 测试中可切换的账号范围,仅由主 Actor 访问。 +@MainActor +private final class PaymentContextBox { + var value: DroneDockHomeContext + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 立即完成的收款服务替身,记录真实请求参数供断言。 +@MainActor +private final class ImmediatePaymentService: DroneDockPaymentServing { + var projectsResult: Result<[DroneDockProject], Error> + var codeResult: Result + var projectRequests: [Int] = [] + var codeRequests: [(scenicID: Int, projectID: Int, price: String?)] = [] + + init() throws { + projectsResult = .success(try DroneDockPaymentTestFixtures.decode([DroneDockProject].self, DroneDockPaymentTestFixtures.projects)) + codeResult = .success(try DroneDockPaymentTestFixtures.decode(DroneDockPayCode.self, DroneDockPaymentTestFixtures.code())) + } + + func projects(scenicID: Int) async throws -> [DroneDockProject] { + projectRequests.append(scenicID) + return try projectsResult.get() + } + + func payCode(scenicID: Int, projectID: Int, price: String?) async throws -> DroneDockPayCode { + codeRequests.append((scenicID, projectID, price)) + return try codeResult.get() + } + + func receipts(scenicID: Int, projectID: Int?, page: Int) async throws -> DroneDockReceiptsResponse { + throw APIError.networkFailed("主收款 ViewModel 不应请求收款记录") + } +} + +/// 可指定响应顺序的报价服务,用于验证重复提交和旧请求隔离。 +@MainActor +private final class SuspendedPaymentCodeService: DroneDockPaymentServing { + var requestStarted: ((Int) -> Void)? + var requests: [(projectID: Int, price: String?)] = [] + private var continuations: [Int: CheckedContinuation] = [:] + private let availableProjects: [DroneDockProject] + + init() throws { + availableProjects = try DroneDockPaymentTestFixtures.decode([DroneDockProject].self, DroneDockPaymentTestFixtures.projects) + } + + func projects(scenicID: Int) async throws -> [DroneDockProject] { availableProjects } + + func payCode(scenicID: Int, projectID: Int, price: String?) async throws -> DroneDockPayCode { + let index = requests.count + requests.append((projectID, price)) + return try await withCheckedThrowingContinuation { continuation in + continuations[index] = continuation + requestStarted?(index) + } + } + + func receipts(scenicID: Int, projectID: Int?, page: Int) async throws -> DroneDockReceiptsResponse { + throw APIError.networkFailed("不应查询收款记录") + } + + func finish(_ index: Int, _ result: Result) { + continuations.removeValue(forKey: index)?.resume(with: result) + } + + func cancelAll() { + let pending = continuations.values + continuations.removeAll() + for continuation in pending { continuation.resume(throwing: CancellationError()) } + } +} + +/// 可控制列表完成顺序的服务,用于验证切换景区后的数据隔离。 +@MainActor +private final class SuspendedPaymentProjectsService: DroneDockPaymentServing { + var requestStarted: ((Int) -> Void)? + var requests: [Int] = [] + private var continuations: [Int: CheckedContinuation<[DroneDockProject], Error>] = [:] + + func projects(scenicID: Int) async throws -> [DroneDockProject] { + let index = requests.count + requests.append(scenicID) + return try await withCheckedThrowingContinuation { continuation in + continuations[index] = continuation + requestStarted?(index) + } + } + + func payCode(scenicID: Int, projectID: Int, price: String?) async throws -> DroneDockPayCode { + throw APIError.networkFailed("列表测试不应生成小程序收款码") + } + + func receipts(scenicID: Int, projectID: Int?, page: Int) async throws -> DroneDockReceiptsResponse { + throw APIError.networkFailed("不应查询收款记录") + } + + func finish(_ index: Int, _ result: Result<[DroneDockProject], Error>) { + continuations.removeValue(forKey: index)?.resume(with: result) + } + + func cancelAll() { + let pending = continuations.values + continuations.removeAll() + for continuation in pending { continuation.resume(throwing: CancellationError()) } + } +} diff --git a/suixinkanTests/DroneDockPaymentViewTests.swift b/suixinkanTests/DroneDockPaymentViewTests.swift new file mode 100644 index 0000000..6d6996b --- /dev/null +++ b/suixinkanTests/DroneDockPaymentViewTests.swift @@ -0,0 +1,714 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 在独立窗口验证套餐收款页面的确认、取消、图片加载和真实记录入口;业务与图片请求均使用替身。 +@MainActor +final class DroneDockPaymentViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 套餐加载不会自动生成二维码,未选套餐时改价和保存保持禁用。 + func testInitialPageRequiresExplicitProjectBeforeCodeAndAmountActions() async throws { + let (controller, service) = try makeController() + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + + XCTAssertNil(controller.viewModel.payCode) + XCTAssertTrue(service.payCodeCalls.isEmpty) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.setAmount", in: controller.view).isEnabled) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertTrue(try button("drone.payment.projectPicker", in: controller.view).isEnabled) + XCTAssertEqual((find(in: controller.view, identifier: "drone.payment.merchant") as? UILabel)?.text, PaymentMerchantInfo.defaultInfo.company) + XCTAssertEqual((find(in: controller.view, identifier: "drone.payment.staff") as? UILabel)?.text, DroneDockPaymentViewFixtures.context.userID) + capture(window, named: "套餐收款-未选套餐无二维码") + } + + /// 套餐选择先暂存,取消不生成码;确认后显示服务端价格与次数,之后取消切换保留原码。 + func testProjectSelectionGeneratesOnlyOnConfirmationAndCancelPreservesCode() async throws { + let (controller, service) = try makeController() + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + + let firstPicker = try await openProjectPicker(controller, window: window) + try selectProject(8012, in: firstPicker) + XCTAssertTrue(service.payCodeCalls.isEmpty) + try button("drone.payment.cancelProject", in: firstPicker).sendActions(for: .touchUpInside) + try await settle(window: window) { controller.presentedViewController == nil } + XCTAssertNil(controller.viewModel.payCode) + XCTAssertTrue(service.payCodeCalls.isEmpty) + + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { controller.viewModel.payCode?.projectID == 8012 } + XCTAssertEqual(service.payCodeCalls.count, 1) + XCTAssertEqual(service.payCodeCalls[0].projectID, 8012) + XCTAssertEqual(controller.viewModel.payCode?.price, Decimal(string: "99.00")) + XCTAssertEqual(controller.viewModel.payCode?.shootCount, 3) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("99.00") }) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("含 3 次拍摄") }) + XCTAssertNotNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertTrue(try button("drone.payment.setAmount", in: controller.view).isEnabled) + XCTAssertTrue(try button("drone.payment.saveQR", in: controller.view).isEnabled) + let originalURL = controller.viewModel.payCode?.payURL + + let secondPicker = try await openProjectPicker(controller, window: window) + try selectProject(8011, in: secondPicker) + try button("drone.payment.cancelProject", in: secondPicker).sendActions(for: .touchUpInside) + try await settle(window: window) { controller.presentedViewController == nil } + XCTAssertEqual(service.payCodeCalls.count, 1) + XCTAssertEqual(controller.viewModel.payCode?.projectID, 8012) + XCTAssertEqual(controller.viewModel.payCode?.payURL, originalURL) + capture(window, named: "套餐收款-确认三次套餐后生成二维码") + } + + /// 改价提交重新申请同套餐付款链接,拍摄次数保持服务端套餐次数。 + func testChangingAmountRegeneratesCodeWithoutChangingShootCount() async throws { + let (controller, service) = try makeController() + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { controller.viewModel.payCode?.projectID == 8012 } + + try button("drone.payment.setAmount", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { self.findInWindows("drone.payment.amount.input", window: window) != nil } + let input = try XCTUnwrap(findInWindows("drone.payment.amount.input", window: window) as? UITextField) + input.text = "88.50" + input.sendActions(for: .editingChanged) + let confirm = try XCTUnwrap(findInWindows("drone.payment.amount.confirm", window: window) as? UIButton) + XCTAssertTrue(confirm.isEnabled) + confirm.sendActions(for: .touchUpInside) + try await settle(window: window) { controller.viewModel.payCode?.price == Decimal(string: "88.50") } + + XCTAssertEqual(service.payCodeCalls.count, 2) + XCTAssertEqual(service.payCodeCalls.last?.projectID, 8012) + XCTAssertEqual(Decimal(string: service.payCodeCalls.last?.price ?? ""), Decimal(string: "88.50")) + XCTAssertEqual(controller.viewModel.payCode?.shootCount, 3) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("88.50") }) + XCTAssertNotNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertTrue(try button("drone.payment.saveQR", in: controller.view).isEnabled) + capture(window, named: "套餐收款-改价后次数保持不变") + } + + /// 非法金额留在输入框供修改,取消金额编辑时保留原套餐码且不发送新报价。 + func testInvalidAmountDoesNotRegenerateAndCancelPreservesCode() async throws { + let (controller, service) = try makeController() + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { controller.viewModel.payCode != nil } + let originalURL = controller.viewModel.payCode?.payURL + + try button("drone.payment.setAmount", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { self.findInWindows("drone.payment.amount.input", window: window) != nil } + let input = try XCTUnwrap(findInWindows("drone.payment.amount.input", window: window) as? UITextField) + let confirm = try XCTUnwrap(findInWindows("drone.payment.amount.confirm", window: window) as? UIButton) + for invalidAmount in ["0", "8.888", "100000", "1e2"] { + input.text = invalidAmount + input.sendActions(for: .editingChanged) + confirm.sendActions(for: .touchUpInside) + XCTAssertEqual(service.payCodeCalls.count, 1) + XCTAssertEqual(controller.viewModel.payCode?.payURL, originalURL) + XCTAssertNotNil(findInWindows("drone.payment.amount.input", window: window)) + } + + let cancel = try XCTUnwrap(findInWindows("drone.payment.amount.cancel", window: window) as? UIButton) + cancel.sendActions(for: .touchUpInside) + try await settle(window: window) { self.findInWindows("drone.payment.amount.input", window: window) == nil } + XCTAssertEqual(service.payCodeCalls.count, 1) + XCTAssertEqual(controller.viewModel.payCode?.price, Decimal(string: "99.00")) + XCTAssertEqual(controller.viewModel.payCode?.payURL, originalURL) + XCTAssertTrue(try button("drone.payment.saveQR", in: controller.view).isEnabled) + } + + /// 保留独立收款记录入口,正常收款页只展示设置金额与保存二维码操作。 + func testReceiptsAndRefreshEntriesUseRealReceiptPageWithoutGeneratingAnotherCode() async throws { + let (controller, service) = try makeController() + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { controller.viewModel.payCode != nil } + let navigation = try XCTUnwrap(controller.navigationController) + let originalURL = controller.viewModel.payCode?.payURL + + try button("drone.payment.records", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { + navigation.topViewController !== controller && service.receiptCalls.count == 1 + && navigation.transitionCoordinator == nil + } + XCTAssertEqual(navigation.topViewController?.title, "收款记录") + XCTAssertEqual(service.receiptCalls.first?.scenicID, 128) + XCTAssertEqual(service.receiptCalls.first?.page, 1) + XCTAssertNil(service.receiptCalls.first?.projectID) + XCTAssertEqual(service.payCodeCalls.count, 1) + + navigation.popViewController(animated: false) + try await settle(window: window) { navigation.topViewController === controller } + XCTAssertNil(find(in: controller.view, identifier: "drone.payment.refreshReceipts")) + XCTAssertNil(find(in: controller.view, identifier: "drone.payment.regenerateCode")) + XCTAssertEqual(service.receiptCalls.count, 1) + XCTAssertEqual(service.payCodeCalls.count, 1) + XCTAssertEqual(controller.viewModel.payCode?.payURL, originalURL) + } + + /// 无可售套餐时不会写死套餐和二维码,改价、保存也不可用。 + func testEmptyProjectsDoNotFabricatePurchasablePackageOrCode() async throws { + let service = try DroneDockPaymentViewServiceStub(projects: []) + let (controller, _) = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + + XCTAssertTrue(controller.viewModel.projects.isEmpty) + XCTAssertNil(controller.viewModel.payCode) + XCTAssertTrue(service.payCodeCalls.isEmpty) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.setAmount", in: controller.view).isEnabled) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("暂无") && $0.contains("套餐") }) + } + + /// 套餐请求失败时展示可重试状态,重试只重新获取套餐,不自动收款或生成码。 + func testProjectLoadFailureCanRetryWithoutFabricatingCode() async throws { + let service = try DroneDockPaymentViewServiceStub() + service.projectFailureCount = 1 + let (controller, _) = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { + controller.viewModel.projectError != nil && self.find(in: controller.view, identifier: "drone.payment.retryProjects") != nil + } + XCTAssertNil(controller.viewModel.payCode) + XCTAssertTrue(service.payCodeCalls.isEmpty) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + + try button("drone.payment.retryProjects", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { service.projectCalls == 2 && controller.viewModel.projectError == nil } + + XCTAssertEqual(controller.viewModel.projects.count, 2) + XCTAssertNil(controller.viewModel.payCode) + XCTAssertTrue(service.payCodeCalls.isEmpty) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + } + + /// 确认更换套餐后生成失败,页面不能继续显示上一套餐的旧码供游客误付。 + func testFailedRegenerationRemovesOldCodeAndDisablesSaving() async throws { + let (controller, service) = try makeController() + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { controller.viewModel.payCode != nil } + XCTAssertNotNil(try imageView("drone.payment.qr", in: controller.view).image) + + service.payCodeFailure = APIError.networkFailed("测试生成付款链接失败") + try await confirmProject(8011, controller: controller, window: window) + try await settle(window: window) { controller.viewModel.payCodeError != nil } + + XCTAssertEqual(service.payCodeCalls.count, 2) + XCTAssertNil(controller.viewModel.payCode) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("测试生成付款链接失败") }) + } + + /// 报价成功不等于图片就绪;显示与保存使用加载器返回的原图,而不是把地址再次编码。 + func testImageLoadingDisablesSavingUntilOriginalServerImageArrives() async throws { + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, service) = try makeController(imageLoader: images) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { images.requests.count == 1 } + + XCTAssertEqual(images.requests[0].url.absoluteString, controller.viewModel.payCode?.payURL) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("加载") }) + + let original = DroneDockPaymentImageLoaderStub.fixtureImage(color: .systemPurple) + images.completeRequest(at: 0, with: .success(original)) + try await settle(window: window) { self.find(in: controller.view, identifier: "drone.payment.qr").map { !$0.isHidden } ?? false } + + XCTAssertEqual(try imageView("drone.payment.qr", in: controller.view).image?.pngData(), original.pngData()) + XCTAssertTrue(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertEqual(service.payCodeCalls.count, 1) + } + + /// 图片失败独立于生成接口;重载相同图片不额外生成新的付款短码。 + func testImageFailureReloadsSameURLWithoutGeneratingAnotherCode() async throws { + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, service) = try makeController(imageLoader: images) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { images.requests.count == 1 } + images.completeRequest(at: 0, with: .failure(APIError.networkFailed("测试图片下载失败"))) + try await settle(window: window) { + self.find(in: controller.view, identifier: "drone.payment.reloadImage").map { !self.isHiddenByAncestor($0) } ?? false + } + + XCTAssertNotNil(controller.viewModel.payCode) + XCTAssertNil(controller.viewModel.payCodeError) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("图片") && $0.contains("失败") }) + try button("drone.payment.reloadImage", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { images.requests.count == 2 } + + XCTAssertEqual(service.payCodeCalls.count, 1) + XCTAssertEqual(images.requests[1].url, images.requests[0].url) + XCTAssertTrue(images.requests[1].forceRefresh) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + images.completeRequest(at: 1, with: .success(images.defaultImage)) + try await settle(window: window) { (self.find(in: controller.view, identifier: "drone.payment.saveQR") as? UIButton)?.isEnabled == true } + XCTAssertEqual(try imageView("drone.payment.qr", in: controller.view).image?.pngData(), images.defaultImage.pngData()) + } + + /// 自定义报价沿用原设置金额入口,并且员工信息不随套餐回包变化。 + func testReadyCodeUsesAmountActionAndKeepsLoginStaffIdentity() async throws { + let images = DroneDockPaymentImageLoaderStub() + let (controller, service) = try makeController(imageLoader: images) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await setPrice("88.50", controller: controller, window: window) + let previousURL = controller.viewModel.payCode?.payURL + XCTAssertNil(find(in: controller.view, identifier: "drone.payment.regenerateCode")) + XCTAssertNil(find(in: controller.view, identifier: "drone.payment.refreshReceipts")) + try await setPrice("88.50", controller: controller, window: window) + try await settle(window: window) { service.payCodeCalls.count == 3 && !controller.viewModel.isGenerating } + + XCTAssertEqual(service.payCodeCalls.last?.projectID, 8012) + XCTAssertEqual(Decimal(string: service.payCodeCalls.last?.price ?? ""), Decimal(string: "88.50")) + XCTAssertEqual(controller.viewModel.payCode?.price, Decimal(string: "88.50")) + XCTAssertEqual(controller.viewModel.payCode?.shootCount, 3) + XCTAssertNotEqual(controller.viewModel.payCode?.payURL, previousURL) + XCTAssertEqual(images.requests.count, 3) + XCTAssertTrue(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertEqual((find(in: controller.view, identifier: "drone.payment.staff") as? UILabel)?.text, DroneDockPaymentViewFixtures.context.userID) + } + + /// 新码会使旧图片回调失效;即使服务端复用图片 URL,也必须按请求代次区分。 + func testLateImagesCannotReplaceRegeneratedCodeWithSameOrDifferentURL() async throws { + for fixedURL in [nil, "https://example.com/mini_qr/reused.png"] as [String?] { + let service = try DroneDockPaymentViewServiceStub() + service.imageURLOverride = fixedURL + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, _) = try makeController(service: service, imageLoader: images) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { images.requests.count == 1 } + try await setPrice("88.50", controller: controller, window: window) + try await settle(window: window) { images.requests.count == 2 } + XCTAssertEqual(service.payCodeCalls.count, 2) + XCTAssertTrue(images.requests[1].forceRefresh, "新报价即使复用图片地址,也不能使用上一付款码的图片缓存") + if fixedURL != nil { XCTAssertEqual(images.requests[0].url, images.requests[1].url) } + else { XCTAssertNotEqual(images.requests[0].url, images.requests[1].url) } + + images.completeRequest(at: 0, with: .success(DroneDockPaymentImageLoaderStub.fixtureImage(color: .systemRed))) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + let currentImage = DroneDockPaymentImageLoaderStub.fixtureImage(color: .systemBlue) + images.completeRequest(at: 1, with: .success(currentImage)) + try await settle(window: window) { (self.find(in: controller.view, identifier: "drone.payment.saveQR") as? UIButton)?.isEnabled == true } + XCTAssertEqual(try imageView("drone.payment.qr", in: controller.view).image?.pngData(), currentImage.pngData()) + XCTAssertGreaterThan(images.cancelCount, 0) + } + } + + /// 图片请求在途时账号范围变化,迟到成功也不能显示旧账号的收款码。 + func testChangedIdentityRejectsPendingImageAndClearsPaymentCode() async throws { + let scope = DroneDockPaymentImageContextBox() + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, service) = try makeController(imageLoader: images, contextBox: scope) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { images.requests.count == 1 } + scope.context = DroneDockHomeContext(userID: "other-test-user", accountType: "store_user", scenicID: 129, + scenicName: "另一个测试景区", storeID: 38, photographerName: "测试人员", token: "other-test-token") + + images.completeRequest(at: 0, with: .success(images.defaultImage)) + try await settle(window: window) { controller.viewModel.payCode == nil } + + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + XCTAssertEqual(service.payCodeCalls.count, 1) + } + + /// 退出收款流程取消图片请求,加载器仍回调时也不能恢复旧码或保存按钮。 + func testLeavingPaymentPageCancelsAndRejectsPendingImage() async throws { + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, service) = try makeController(imageLoader: images) + let window = makeWindow(root: UIViewController()) + defer { close(window) } + let navigation = try XCTUnwrap(window.rootViewController as? UINavigationController) + navigation.pushViewController(controller, animated: false) + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { + images.requests.count == 1 && navigation.visibleViewController === controller + && controller.presentedViewController == nil && controller.view.window === window + && controller.transitionCoordinator == nil && navigation.transitionCoordinator == nil + } + let cancelsBeforeExit = images.cancelCount + let popped = navigation.popViewController(animated: true) + XCTAssertTrue(popped === controller) + try await settle(window: window) { + navigation.topViewController !== controller && controller.parent == nil + && controller.view.window == nil && navigation.transitionCoordinator == nil + } + + XCTAssertGreaterThan(images.cancelCount, cancelsBeforeExit) + images.completeRequest(at: 0, with: .success(images.defaultImage)) + XCTAssertNil(controller.viewModel.payCode) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + } + + /// 收款页被后续页面覆盖后整段出栈,也必须取消在途图片;普通覆盖本身不清除收款状态。 + func testRemovingCoveredPaymentPageCancelsAndRejectsPendingImage() async throws { + let images = DroneDockPaymentImageLoaderStub(automaticallyCompletes: false) + let (controller, service) = try makeController(imageLoader: images) + let root = UIViewController() + let window = makeWindow(root: root) + defer { close(window) } + let navigation = try XCTUnwrap(window.rootViewController as? UINavigationController) + navigation.pushViewController(controller, animated: false) + try await waitForProjects(controller, service: service, window: window) + try await confirmProject(8012, controller: controller, window: window) + try await settle(window: window) { + images.requests.count == 1 && navigation.visibleViewController === controller + && controller.presentedViewController == nil && controller.view.window === window + && controller.transitionCoordinator == nil && navigation.transitionCoordinator == nil + } + let cancelsBeforeCover = images.cancelCount + let cover = UIViewController() + navigation.pushViewController(cover, animated: true) + try await settle(window: window) { + navigation.visibleViewController === cover && cover.view.window === window + && controller.view.window == nil && navigation.transitionCoordinator == nil + } + XCTAssertTrue(controller.parent === navigation) + XCTAssertNotNil(controller.viewModel.payCode) + XCTAssertEqual(images.cancelCount, cancelsBeforeCover) + + let removed = navigation.popToRootViewController(animated: true) ?? [] + XCTAssertTrue(removed.contains { $0 === controller }) + try await settle(window: window) { + navigation.topViewController === root && controller.parent == nil + && controller.view.window == nil && navigation.transitionCoordinator == nil + } + + XCTAssertGreaterThan(images.cancelCount, cancelsBeforeCover) + images.completeRequest(at: 0, with: .success(images.defaultImage)) + XCTAssertNil(controller.viewModel.payCode) + XCTAssertNil(try imageView("drone.payment.qr", in: controller.view).image) + XCTAssertFalse(try button("drone.payment.saveQR", in: controller.view).isEnabled) + } + + /// 通过原金额输入交互提交报价,用于校验后续重新生成保留已确认金额。 + private func setPrice(_ price: String, controller: DroneDockPaymentViewController, window: UIWindow) async throws { + try button("drone.payment.setAmount", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { self.findInWindows("drone.payment.amount.input", window: window) != nil } + let input = try XCTUnwrap(findInWindows("drone.payment.amount.input", window: window) as? UITextField) + input.text = price + input.sendActions(for: .editingChanged) + let confirm = try XCTUnwrap(findInWindows("drone.payment.amount.confirm", window: window) as? UIButton) + confirm.sendActions(for: .touchUpInside) + try await settle(window: window) { controller.viewModel.payCode?.price == Decimal(string: price) } + } + + /// 以固定测试身份及业务、图片替身创建页面,不读取设备账号或访问网络。 + private func makeController(service: DroneDockPaymentViewServiceStub? = nil, + imageLoader: DroneDockPaymentImageLoaderStub? = nil, + contextBox: DroneDockPaymentImageContextBox? = nil) throws -> (DroneDockPaymentViewController, DroneDockPaymentViewServiceStub) { + let service = try service ?? DroneDockPaymentViewServiceStub() + let scope = contextBox ?? DroneDockPaymentImageContextBox() + let currentContext: @MainActor @Sendable () -> DroneDockHomeContext = { scope.context } + let model = DroneDockPaymentViewModel(context: scope.context, service: service, currentContext: currentContext) + return (DroneDockPaymentViewController(viewModel: model, service: service, currentContext: currentContext, + imageLoader: imageLoader ?? DroneDockPaymentImageLoaderStub()), service) + } + + /// 等待项目读取完成,以真实页面发起的请求作为准备条件。 + private func waitForProjects(_ controller: DroneDockPaymentViewController, service: DroneDockPaymentViewServiceStub, window: UIWindow) async throws { + try await settle(window: window) { service.projectCalls > 0 && !controller.viewModel.isLoadingProjects } + } + + /// 打开实际套餐选择弹层,不调用页面私有选择方法。 + private func openProjectPicker(_ controller: DroneDockPaymentViewController, window: UIWindow) async throws -> UIView { + try button("drone.payment.projectPicker", in: controller.view).sendActions(for: .touchUpInside) + try await settle(window: window) { + guard let presented = controller.presentedViewController else { return false } + return self.find(in: presented.view, identifier: "drone.payment.confirmProject") != nil + } + return try XCTUnwrap(controller.presentedViewController?.view) + } + + /// 点击套餐行;兼容真实按钮或表格行,避免通过测试绕过用户选择。 + private func selectProject(_ id: Int, in picker: UIView) throws { + let target = try XCTUnwrap(find(in: picker, identifier: "drone.payment.project.\(id)")) + if let control = target as? UIControl { + control.sendActions(for: .touchUpInside) + return + } + if let cell = target as? UITableViewCell, + let table = allViews(in: picker).compactMap({ $0 as? UITableView }).first, + let indexPath = table.indexPath(for: cell) { + table.selectRow(at: indexPath, animated: false, scrollPosition: .none) + table.delegate?.tableView?(table, didSelectRowAt: indexPath) + return + } + XCTFail("套餐项没有公开可触发的按钮或表格选择") + } + + /// 通过选中与确认两步触发生成付款码。 + private func confirmProject(_ id: Int, controller: DroneDockPaymentViewController, window: UIWindow) async throws { + let picker = try await openProjectPicker(controller, window: window) + try selectProject(id, in: picker) + let confirm = try button("drone.payment.confirmProject", in: picker) + XCTAssertTrue(confirm.isEnabled) + confirm.sendActions(for: .touchUpInside) + try await settle(window: window) { controller.presentedViewController == nil && !controller.viewModel.isGenerating } + } + + /// 将独立页面放进测试窗口,测试结束时恢复原 keyWindow。 + private func makeWindow(root: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: root) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + /// 关闭测试弹层与窗口,保留用户账号及正常应用窗口。 + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待异步替身和布局完成,不用固定长延时推断成功。 + private func settle(window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<150 { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 250_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("套餐收款页面未完成预期渲染或操作") + throw NSError(domain: "DroneDockPaymentViewTests", code: 1) + } + + /// 枚举实际视图树,包含弹层的内容由调用方传入。 + private func allViews(in view: UIView) -> [UIView] { [view] + view.subviews.flatMap { allViews(in: $0) } } + + /// 按稳定标识查找控件,不读取生产页面私有字段。 + private func find(in root: UIView, identifier: String) -> UIView? { + allViews(in: root).first { $0.accessibilityIdentifier == identifier } + } + + /// 金额浮层可能挂在窗口或呈现控制器中,搜索当前测试窗口内所有真实视图。 + private func findInWindows(_ identifier: String, window: UIWindow) -> UIView? { + if let view = find(in: window, identifier: identifier) { return view } + var controller = window.rootViewController + while let current = controller { + if let view = current.viewIfLoaded, let found = find(in: view, identifier: identifier) { return found } + controller = current.presentedViewController + } + return nil + } + + /// 提取可点击的实际按钮。 + private func button(_ identifier: String, in root: UIView) throws -> UIButton { + try XCTUnwrap(find(in: root, identifier: identifier) as? UIButton, "缺少按钮 \(identifier)") + } + + /// 提取小程序码图像视图,检查是否确有服务端图片内容。 + private func imageView(_ identifier: String, in root: UIView) throws -> UIImageView { + try XCTUnwrap(find(in: root, identifier: identifier) as? UIImageView, "缺少二维码视图") + } + + /// 获取页面中未隐藏的文案。 + private func visibleTexts(in root: UIView) -> [String] { + allViews(in: root).compactMap { view in + guard let label = view as? UILabel, !isHiddenByAncestor(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + + /// 排除隐藏容器里的按钮、占位和复用文案。 + private func isHiddenByAncestor(_ view: UIView) -> Bool { + if view.isHidden || view.alpha < 0.01 { return true } + return view.superview.map { isHiddenByAncestor($0) } ?? false + } + + /// 将测试窗口写入 xcresult 供视觉检查,不保存至系统相册。 + private func capture(_ window: UIWindow, named name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 收款页面及首页路由测试共用的匿名业务夹具。 +@MainActor +enum DroneDockPaymentViewFixtures { + /// 独立于设备登录数据的固定范围。 + static let context = DroneDockHomeContext(userID: "payment-ui-test", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试人员", token: "payment-ui-test-token") + + /// 用文档结构生成两份测试套餐。 + static func projects() throws -> [DroneDockProject] { + try JSONDecoder().decode([DroneDockProject].self, from: Data(#"[{"id":8011,"name":"测试单次航拍","price":"39.00","shoot_count":1},{"id":8012,"name":"测试三次航拍","price":"99.00","shoot_count":3}]"#.utf8)) + } + + /// 创建可以真实导航、但只使用替身请求的独立收款页面。 + static func controller(context suppliedContext: DroneDockHomeContext? = nil) throws -> DroneDockPaymentViewController { + let context = suppliedContext ?? Self.context + let service = try DroneDockPaymentViewServiceStub() + let model = DroneDockPaymentViewModel(context: context, service: service, currentContext: { context }) + return DroneDockPaymentViewController(viewModel: model, service: service, imageLoader: DroneDockPaymentImageLoaderStub()) + } +} + +/// 按测试套餐生成付款响应并返回空收款记录,不发出真实请求或真实支付。 +@MainActor +final class DroneDockPaymentViewServiceStub: DroneDockPaymentServing { + /// 允许指定首次套餐请求失败以验证页面重试入口。 + var projectFailureCount = 0 + /// 指定付款码生成失败,验证旧码清除与错误状态。 + var payCodeFailure: Error? + /// 可固定图片地址,覆盖后端重复返回同一 URL 时的请求代次隔离。 + var imageURLOverride: String? + /// 已请求套餐列表的次数。 + private(set) var projectCalls = 0 + /// 已生成付款码的请求参数。 + private(set) var payCodeCalls: [(projectID: Int, price: String?)] = [] + /// 已查询收款记录的范围。 + private(set) var receiptCalls: [(scenicID: Int, projectID: Int?, page: Int)] = [] + private let availableProjects: [DroneDockProject] + + /// 注入空或非空套餐,不改变产品的本地缓存和登录态。 + init(projects: [DroneDockProject]? = nil) throws { + availableProjects = try projects ?? DroneDockPaymentViewFixtures.projects() + } + + /// 记录套餐查询,并按测试安排返回一次失败或固定套餐。 + func projects(scenicID: Int) async throws -> [DroneDockProject] { + projectCalls += 1 + if projectFailureCount > 0 { + projectFailureCount -= 1 + throw APIError.networkFailed("测试套餐请求失败") + } + return availableProjects + } + + /// 使用所选测试套餐和报价构造服务端小程序码图片地址,不把生成码当作已支付。 + func payCode(scenicID: Int, projectID: Int, price: String?) async throws -> DroneDockPayCode { + payCodeCalls.append((projectID, price)) + if let payCodeFailure { throw payCodeFailure } + let project = try XCTUnwrap(availableProjects.first { $0.id == projectID }) + let amount = price ?? NSDecimalNumber(decimal: project.price).stringValue + let data: [String: Any] = ["project_id": project.id, "project_name": project.name, + "price": amount, "shoot_count": project.shootCount, + "store_user_id": 1001, "store_id": 37, + "pay_url": imageURLOverride ?? "https://example.com/mini_qr/project-\(projectID)-request-\(payCodeCalls.count).png"] + return try JSONDecoder().decode(DroneDockPayCode.self, from: JSONSerialization.data(withJSONObject: data)) + } + + /// 返回 Laravel 分页与汇总的空记录,提供页面导航和刷新证据。 + func receipts(scenicID: Int, projectID: Int?, page: Int) async throws -> DroneDockReceiptsResponse { + receiptCalls.append((scenicID, projectID, page)) + let payload = #"{"records":{"current_page":1,"per_page":20,"total":0,"last_page":1,"data":[]},"summary":{"count":0,"cash_paid":"0.00","cash_refund":"0.00","cash_net":"0.00","points_paid":0,"points_refund":0,"points_net":0,"point_amount":"0.00"}}"# + return try JSONDecoder().decode(DroneDockReceiptsResponse.self, from: Data(payload.utf8)) + } +} + +/// 图片请求替身;保留被取消的完成回调,验证页面对迟到结果的隔离。 +@MainActor +final class DroneDockPaymentImageLoaderStub: DroneDockPaymentImageLoading { + /// 一次图片请求及其完成入口,不访问网络或 Kingfisher 全局缓存。 + struct Request { + let url: URL + let forceRefresh: Bool + let completion: @MainActor @Sendable (Result) -> Void + } + + /// 用于默认成功回包的确定性像素,刻意与二维码图案不同。 + let defaultImage: UIImage + /// 请求按发起顺序记录,测试可以乱序返回。 + private(set) var requests: [Request] = [] + /// 取消次数用于确认页面切换时取消旧加载任务。 + private(set) var cancelCount = 0 + private let automaticallyCompletes: Bool + + /// 默认立即成功,异步状态用例可指定手动完成。 + init(automaticallyCompletes: Bool = true) { + self.automaticallyCompletes = automaticallyCompletes + defaultImage = Self.fixtureImage(color: .systemTeal) + } + + /// 记录来源 URL 和是否强制刷新,并按当前模式完成。 + func loadImage(from url: URL, forceRefresh: Bool, + completion: @escaping @MainActor @Sendable (Result) -> Void) { + requests.append(Request(url: url, forceRefresh: forceRefresh, completion: completion)) + if automaticallyCompletes { completion(.success(defaultImage)) } + } + + /// 不丢弃旧回调,以模拟底层已完成但尚未交给页面的响应。 + func cancel() { cancelCount += 1 } + + /// 由测试明确触发成功或失败,避免固定网络延时。 + func completeRequest(at index: Int, with result: Result) { + requests[index].completion(result) + } + + /// 生成带固定尺寸和颜色的原图,供逐像素比较验证未重绘成普通二维码。 + static func fixtureImage(color: UIColor) -> UIImage { + let format = UIGraphicsImageRendererFormat() + format.scale = 1 + return UIGraphicsImageRenderer(size: CGSize(width: 48, height: 32), format: format).image { context in + color.setFill() + context.fill(CGRect(x: 0, y: 0, width: 48, height: 32)) + UIColor.white.setFill() + context.fill(CGRect(x: 5, y: 7, width: 11, height: 9)) + } + } +} + +/// 可变测试身份容器,不写入应用会话或本地持久化。 +@MainActor +private final class DroneDockPaymentImageContextBox { + var context: DroneDockHomeContext + + /// 默认使用匿名固定身份。 + init() { context = DroneDockPaymentViewFixtures.context } +} diff --git a/suixinkanTests/DroneDockPlaneStatusAPITests.swift b/suixinkanTests/DroneDockPlaneStatusAPITests.swift new file mode 100644 index 0000000..a5e5c80 --- /dev/null +++ b/suixinkanTests/DroneDockPlaneStatusAPITests.swift @@ -0,0 +1,195 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证朱工无人机状态请求、推荐设备与未知状态解析,不访问真实飞行接口。 +@MainActor +final class DroneDockPlaneStatusAPITests: XCTestCase { + /// 只发送当前景区和实时电量参数,鉴权沿用统一 Token。 + func testRequestUsesDocumentedPathLiveBatteryAndToken() async throws { + let session = MockURLSession(responses: [try envelope(Self.payload)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "plane-status-test-token" } + + let response = try await DroneDockPlaneStatusAPI(client: client).planeStatus(scenicID: 128) + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/plane-status") + XCTAssertEqual(request.url?.host, "api-test.zhifly.cn") + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "plane-status-test-token") + XCTAssertNil(request.httpBody) + let url = try XCTUnwrap(request.url) + let query = try XCTUnwrap(URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems) + XCTAssertEqual(Dictionary(uniqueKeysWithValues: query.map { ($0.name, $0.value ?? "") }), + ["scenic_id": "128", "live_battery": "1"]) + XCTAssertEqual(response.scenicID, 128) + XCTAssertEqual(response.connected, true) + XCTAssertEqual(response.hasIdle, true) + XCTAssertEqual(response.hasShooting, false) + XCTAssertEqual(response.pollHintMS, 5000) + XCTAssertEqual(response.recommend?.statusText, "空闲 · 电量 95%") + XCTAssertEqual(response.recommend?.batteryPercent, 95) + XCTAssertEqual(response.recommend?.canFly, true) + } + + /// 缺少有效景区时不得发出范围不明的请求。 + func testInvalidScenicIDIsRejectedBeforeRequest() async { + let session = MockURLSession(responses: []) + let api = DroneDockPlaneStatusAPI(client: APIClient(environment: .testing, session: session)) + for id in [0, -1] { + do { + _ = try await api.planeStatus(scenicID: id) + XCTFail("无效景区必须在请求前拒绝") + } catch {} + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 返回其他景区的数据不能显示在当前准备页。 + func testMismatchedScenicResponseIsRejected() async throws { + var payload = Self.payload + payload["scenic_id"] = 129 + let session = MockURLSession(responses: [try envelope(payload)]) + do { + _ = try await DroneDockPlaneStatusAPI(client: APIClient(environment: .testing, session: session)) + .planeStatus(scenicID: 128) + XCTFail("必须拒绝其他景区的状态") + } catch let APIError.decodeFailed(message) { + XCTAssertTrue(message.contains("景区不一致")) + } + XCTAssertEqual(session.requests.count, 1) + } + + /// 后端业务失败保留原提示,不转换成离线或正常空设备。 + func testBusinessFailurePreservesServerMessage() async throws { + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 160001, msg: "无权访问测试景区")]) + do { + _ = try await DroneDockPlaneStatusAPI(client: APIClient(environment: .testing, session: session)) + .planeStatus(scenicID: 128) + XCTFail("业务失败应抛出") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "无权访问测试景区") + } + } + + /// 空设备和无推荐设备保持明确空态,布尔 false 不等同于字段缺失。 + func testEmptyPlanesAndNullRecommendationRemainEmpty() throws { + let response = try decode([ + "scenic_id": 128, "planes": [], "recommend": NSNull(), + "connected": false, "has_idle": false, "has_shooting": false, "poll_hint_ms": 5000 + ]) + XCTAssertTrue(response.planes.isEmpty) + XCTAssertNil(response.recommend) + XCTAssertEqual(response.connected, false) + XCTAssertEqual(response.hasIdle, false) + XCTAssertEqual(response.hasShooting, false) + } + + /// 数字字符串和真实零电量可解析,不把 0 当作缺失。 + func testIntegerStringsAndZeroBatteryArePreserved() throws { + let plane: [String: Any] = [ + "id": "501", "work_status": "0", "battery_percent": "0", "can_fly": false, + "battery_label": "电量 0%", "status_text": "离线 · 电量 0%" + ] + let response = try decode(["scenic_id": "128", "planes": [plane], "recommend": plane, "poll_hint_ms": "5000"]) + XCTAssertEqual(response.planes.first?.id, 501) + XCTAssertEqual(response.recommend?.workStatus, 0) + XCTAssertEqual(response.recommend?.batteryPercent, 0) + XCTAssertEqual(response.recommend?.canFly, false) + XCTAssertEqual(response.recommend?.statusText, "离线 · 电量 0%") + XCTAssertEqual(response.pollHintMS, 5000) + } + + /// 缺失或 null 的可选字段保持未知,不补成空闲、离线或零电量。 + func testMissingAndNullFieldsRemainUnknown() throws { + for plane: [String: Any] in [ + ["id": 501], + ["id": 501, "sn_number": NSNull(), "name": NSNull(), "work_status": NSNull(), + "work_status_label": NSNull(), "battery_percent": NSNull(), "battery_label": NSNull(), + "can_fly": NSNull(), "status_text": NSNull()] + ] { + let response = try decode(["scenic_id": 128, "planes": [plane], "recommend": plane]) + let value = try XCTUnwrap(response.recommend) + XCTAssertNil(value.snNumber) + XCTAssertNil(value.name) + XCTAssertNil(value.workStatus) + XCTAssertNil(value.workStatusLabel) + XCTAssertNil(value.batteryPercent) + XCTAssertNil(value.batteryLabel) + XCTAssertNil(value.canFly) + XCTAssertNil(value.statusText) + XCTAssertNil(response.connected) + XCTAssertNil(response.hasIdle) + XCTAssertNil(response.hasShooting) + XCTAssertNil(response.pollHintMS) + } + } + + /// 未来状态和推荐顺序遵循服务端,客户端不按电量重新挑选设备。 + func testUnknownStateAndServerRecommendationArePreserved() throws { + let preferred: [String: Any] = ["id": 502, "work_status": 99, "battery_percent": 20, + "work_status_label": "维护中", "status_text": "维护中 · 等待检查", "can_fly": false] + let response = try decode(["scenic_id": 128, "planes": [Self.plane, preferred], "recommend": preferred]) + XCTAssertEqual(response.planes.map(\.id), [501, 502]) + XCTAssertEqual(response.recommend?.id, 502) + XCTAssertEqual(response.recommend?.workStatus, 99) + XCTAssertEqual(response.recommend?.statusText, "维护中 · 等待检查") + XCTAssertEqual(response.recommend?.canFly, false) + let withoutRecommendation = try decode(["scenic_id": 128, "planes": [Self.plane]]) + XCTAssertNil(withoutRecommendation.recommend) + } + + /// 景区和设备身份必须正整数且设备列表唯一,错误列表不得冒充空态。 + func testMalformedIdentitiesAndRequiredListsAreRejected() throws { + for id: Any in [0, -1, 1.5, true, "invalid"] { + XCTAssertThrowsError(try decode(["scenic_id": id, "planes": []])) + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": [["id": id]]])) + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": [], "recommend": ["id": id]])) + } + XCTAssertThrowsError(try decode(["scenic_id": 128])) + XCTAssertThrowsError(try decode(["planes": []])) + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": NSNull()])) + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": [:]])) + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": [Self.plane, Self.plane]])) + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": [], "recommend": [:]])) + } + + /// 错误类型不会被宽松转换成可飞、已连接或有效电量。 + func testMalformedOptionalValuesAreRejected() throws { + for extra: [String: Any] in [ + ["work_status": "unknown"], ["battery_percent": true], ["battery_percent": 1.5], + ["can_fly": "true"], ["status_text": 123], ["battery_label": false] + ] { + var plane = Self.plane + plane.merge(extra) { _, new in new } + XCTAssertThrowsError(try decode(["scenic_id": 128, "planes": [plane]])) + } + for extra: [String: Any] in [["connected": 1], ["has_idle": "true"], ["has_shooting": "false"], ["poll_hint_ms": "invalid"]] { + var payload = Self.payload + payload.merge(extra) { _, new in new } + XCTAssertThrowsError(try decode(payload)) + } + } + + private func decode(_ payload: [String: Any]) throws -> DroneDockPlaneStatusResponse { + try JSONDecoder().decode(DroneDockPlaneStatusResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } + + private func envelope(_ payload: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload]) + } + + private static var plane: [String: Any] { + ["id": 501, "sn_number": "TEST-PLANE-501", "name": "测试无人机", "work_status": 1, + "work_status_label": "空闲", "battery_percent": 95, "battery_label": "电量 95%", + "can_fly": true, "status_text": "空闲 · 电量 95%"] + } + + private static var payload: [String: Any] { + ["scenic_id": 128, "planes": [plane], "recommend": plane, "has_idle": true, + "has_shooting": false, "connected": true, "poll_hint_ms": 5000] + } +} diff --git a/suixinkanTests/DroneDockPlaneStatusTestSupport.swift b/suixinkanTests/DroneDockPlaneStatusTestSupport.swift new file mode 100644 index 0000000..fe2c54f --- /dev/null +++ b/suixinkanTests/DroneDockPlaneStatusTestSupport.swift @@ -0,0 +1,47 @@ +import Foundation +@testable import suixinkan + +/// 准备页测试共用的脱敏无人机响应,不访问真实设备或保存账号凭证。 +enum DroneDockPlaneStatusTestData { + /// 构造当前景区快照,空列表与无推荐分别保留接口语义。 + static func response(scenicID: Int = 128, planes: [[String: Any]] = [], + recommend: [String: Any]? = nil, connected: Bool? = nil, + pollHintMS: Int? = nil) throws -> DroneDockPlaneStatusResponse { + var payload: [String: Any] = ["scenic_id": scenicID, "planes": planes] + payload["recommend"] = recommend + payload["connected"] = connected + payload["poll_hint_ms"] = pollHintMS + return try JSONDecoder().decode(DroneDockPlaneStatusResponse.self, + from: JSONSerialization.data(withJSONObject: payload)) + } + + /// 使用明确测试名称与序列号,状态文案可按场景置空。 + static func plane(id: Int = 1, status: Int = 1, text: String? = "空闲 · 电量 95%", + battery: Int? = 95) -> [String: Any] { + var value: [String: Any] = ["id": id, "sn_number": "TEST-PLANE-\(id)", "name": "测试无人机 \(id)", + "work_status": status, "can_fly": status == 1] + value["status_text"] = text + value["battery_percent"] = battery + return value + } +} + +/// 可更换返回值并记录请求景区的即时服务,用于页面与状态测试。 +@MainActor +final class DroneDockPlaneStatusTestService: DroneDockPlaneStatusServing { + /// 每次读取使用当前结果,支持恢复与业务错误场景。 + var result: Result + /// 已读取的景区列表,便于验证独立轮询频率与身份。 + private(set) var requests: [Int] = [] + + /// 默认提供无设备的合法空态,不默认推断设备已连接。 + init(response: DroneDockPlaneStatusResponse? = nil) throws { + result = .success(try response ?? DroneDockPlaneStatusTestData.response()) + } + + /// 仅记录读取请求,不提供任务创建或飞行指令。 + func planeStatus(scenicID: Int) async throws -> DroneDockPlaneStatusResponse { + requests.append(scenicID) + return try result.get() + } +} diff --git a/suixinkanTests/DroneDockPointCoverTests.swift b/suixinkanTests/DroneDockPointCoverTests.swift new file mode 100644 index 0000000..2f27053 --- /dev/null +++ b/suixinkanTests/DroneDockPointCoverTests.swift @@ -0,0 +1,111 @@ +import Kingfisher +import UIKit +import XCTest +@testable import suixinkan + +/// 真实响应缺点位封面时,验证同点位样片回退与卡片复用;图片只读取预置内存缓存。 +@MainActor +final class DroneDockPointCoverTests: XCTestCase { + /// 点位封面优先于样片,去掉外层空白后保留 URL 查询参数。 + func testPointCoverTakesPriorityOverSampleCover() throws { + let url = "https://images.example.invalid/spot.png?signature=test-value" + let spot = try makeSpot(cover: " \n" + url + " \n", sampleCovers: ["https://images.example.invalid/sample.png"]) + XCTAssertEqual(spot.displayCoverURL?.absoluteString, url) + XCTAssertEqual(spot.coverURL, " \n" + url + " \n", "不能改写原始接口字段") + } + + /// 兼容实际空字符串及缺失、null、无效协议,按航线顺序寻找第一张有效封面。 + func testMissingOrInvalidPointCoverFallsBackToFirstValidSample() throws { + for cover: Any? in [nil, NSNull(), "", " \n", "/relative.png", "file:///tmp/local.png", "https://"] { + let spot = try makeSpot(cover: cover, sampleCovers: ["", "file:///tmp/sample.png", + " https://images.example.invalid/first.png ", "https://images.example.invalid/second.png"]) + XCTAssertEqual(spot.displayCoverURL?.absoluteString, "https://images.example.invalid/first.png") + } + let spot = try decode([ + "scenic_spot_id": 201, "scenic_spot_name": "测试点", "cover_url": "", "air_lines": [ + ["air_line_id": 301, "air_line_name": "第一条", "samples": [["id": 401, "cover_url": ""]]], + ["air_line_id": 302, "air_line_name": "第二条", "samples": [["id": 402, "cover_url": "https://images.example.invalid/next-route.png"]]] + ] + ]) + XCTAssertEqual(spot.displayCoverURL?.lastPathComponent, "next-route.png") + } + + /// 无有效封面时保持占位,不把预览视频当图片,也不会借用其他点位图片。 + func testMissingCoverDoesNotUsePreviewOrAnotherPoint() throws { + let empty = try decode([ + "scenic_spot_id": 201, "scenic_spot_name": "缺图点", "air_lines": [[ + "air_line_id": 301, "air_line_name": "测试航线", "samples": [[ + "id": 401, "preview_url": "https://images.example.invalid/video.mp4" + ]] + ]] + ]) + let other = try makeSpot(id: 202, sampleCovers: ["https://images.example.invalid/other.png"]) + XCTAssertNil(empty.displayCoverURL) + XCTAssertEqual(other.displayCoverURL?.lastPathComponent, "other.png") + XCTAssertNil(try makeSpot().displayCoverURL) + } + + /// 同一个卡片依次显示两个点位各自的缓存封面,切到缺图点或回收时清除旧图片与加载身份。 + func testCellDisplaysMatchingSampleImagesAndClearsThemOnReuse() async throws { + let key = UUID().uuidString + let firstURL = "https://images.example.invalid/\(key)-first.png" + let secondURL = "https://images.example.invalid/\(key)-second.png" + let firstImage = image(color: .red) + let secondImage = image(color: .blue) + ImageCache.default.store(firstImage, forKey: firstURL, toDisk: false, completionHandler: nil) + ImageCache.default.store(secondImage, forKey: secondURL, toDisk: false, completionHandler: nil) + defer { + ImageCache.default.removeImage(forKey: firstURL, fromDisk: false) + ImageCache.default.removeImage(forKey: secondURL, fromDisk: false) + } + XCTAssertNotNil(ImageCache.default.retrieveImageInMemoryCache(forKey: firstURL)) + XCTAssertNotNil(ImageCache.default.retrieveImageInMemoryCache(forKey: secondURL)) + + let cell = DronePreparationPointCell(frame: CGRect(x: 0, y: 0, width: 200, height: 64)) + let thumbnail = try XCTUnwrap(cell.contentView.subviews.first { + $0.accessibilityIdentifier == "drone.preparation.point.cover" + } as? UIImageView) + cell.apply(spot: try makeSpot(cover: "", sampleCovers: [firstURL]), selected: true) + try await assertImage(firstImage, in: thumbnail) + cell.apply(spot: try makeSpot(id: 202, cover: "", sampleCovers: [secondURL]), selected: false) + try await assertImage(secondImage, in: thumbnail) + XCTAssertEqual(thumbnail.contentMode, .scaleAspectFill) + + cell.apply(spot: try makeSpot(id: 203), selected: false) + XCTAssertNil(thumbnail.kf.taskIdentifier) + XCTAssertEqual(thumbnail.contentMode, .center) + XCTAssertNotNil(thumbnail.image) + XCTAssertNotEqual(thumbnail.image?.pngData(), secondImage.pngData()) + cell.prepareForReuse() + XCTAssertNil(thumbnail.image) + XCTAssertNil(thumbnail.kf.taskIdentifier) + } + + private func makeSpot(id: Int = 201, cover: Any? = nil, sampleCovers: [String] = []) throws -> DroneDockPurchasedSpot { + var fields: [String: Any] = ["scenic_spot_id": id, "scenic_spot_name": "测试点\(id)", "available": true, + "air_lines": [["air_line_id": 301, "air_line_name": "测试航线", "samples": sampleCovers.enumerated().map { + ["id": 401 + $0.offset, "cover_url": $0.element] as [String: Any] + }]]] + fields["cover_url"] = cover + return try decode(fields) + } + + private func decode(_ fields: [String: Any]) throws -> DroneDockPurchasedSpot { + try JSONDecoder().decode(DroneDockPurchasedSpot.self, from: JSONSerialization.data(withJSONObject: fields)) + } + + private func image(color: UIColor) -> UIImage { + UIGraphicsImageRenderer(size: CGSize(width: 48, height: 48)).image { context in + color.setFill() + context.fill(CGRect(x: 0, y: 0, width: 48, height: 48)) + } + } + + private func assertImage(_ expected: UIImage, in view: UIImageView) async throws { + for _ in 0..<20 { + if view.image?.pngData() == expected.pngData() { return } + try await Task.sleep(nanoseconds: 50_000_000) + } + XCTFail("卡片应显示当前点位对应的样片封面") + } +} diff --git a/suixinkanTests/DroneDockPreparationAPITests.swift b/suixinkanTests/DroneDockPreparationAPITests.swift new file mode 100644 index 0000000..aa8ae4c --- /dev/null +++ b/suixinkanTests/DroneDockPreparationAPITests.swift @@ -0,0 +1,111 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 保留旧准备 DTO 的解码回归,不发起 workbench 或其他网络请求。 +@MainActor +final class DroneDockPreparationAPITests: XCTestCase { + /// 整数字符串与真实零值均能解析;剩余次数独立读取,不用总数重算。 + func testNumericStringsAndZeroValuesRemainAccurate() throws { + let response = try decode(#""" + {"scenic_id":"128","order_number":"TEST-ORDER-001","airports":[], + "order_progress":{"shot_total":"1","shot_used":"2","shot_remain":0}, + "spots":[{"scenic_spot_id":"201","name":"测试点位","distance_m":"0","shot_count":"0","in_range":true, + "air_lines":[{"air_line_id":"301","name":"测试航线","estimated_fly_time":"0","line_video_duration":0,"fly_type":"1"}]}]} + """#) + XCTAssertEqual(response.scenicID, 128) + XCTAssertEqual(response.orderProgress?.shotTotal, 1) + XCTAssertEqual(response.orderProgress?.shotUsed, 2) + XCTAssertEqual(response.orderProgress?.shotRemain, 0) + XCTAssertEqual(response.spots[0].distanceM, 0) + XCTAssertEqual(response.spots[0].shotCount, 0) + XCTAssertEqual(response.spots[0].inRange, true) + XCTAssertEqual(response.spots[0].airLines[0].estimatedFlyTime, 0) + XCTAssertEqual(response.spots[0].airLines[0].lineVideoDuration, 0) + } + + /// 缺失或 null 的可选字段保持未知,不生成额度或可召唤结论。 + func testMissingAndNullOptionalFieldsRemainUnknown() throws { + let response = try decode(#""" + {"scenic_id":128,"order_number":"TEST-ORDER-001","airports":[],"tips":null, + "order_progress":{"shot_total":null},"shoot_gate":{}, + "spots":[{"scenic_spot_id":201,"name":"测试点位","in_range":null, + "air_lines":[{"air_line_id":301,"name":"测试航线","estimated_fly_time":null}]}]} + """#) + XCTAssertNil(response.orderProgress?.orderNumber) + XCTAssertNil(response.orderProgress?.packageName) + XCTAssertNil(response.orderProgress?.shotTotal) + XCTAssertNil(response.orderProgress?.shotUsed) + XCTAssertNil(response.orderProgress?.shotRemain) + XCTAssertNil(response.orderProgress?.statusLabel) + XCTAssertNil(response.shootGate?.canShoot) + XCTAssertNil(response.shootGate?.code) + XCTAssertNil(response.shootGate?.primaryAction) + XCTAssertNil(response.tips) + XCTAssertNil(response.spots[0].distanceLabel) + XCTAssertNil(response.spots[0].distanceM) + XCTAssertNil(response.spots[0].inRange) + XCTAssertNil(response.spots[0].shotCount) + XCTAssertNil(response.spots[0].airLines[0].estimatedFlyTime) + } + + /// 缺失与错误列表不能伪装成准备页正常空态。 + func testMalformedRequiredListsAndScopeAreRejected() { + for payload in [ + #"{"scenic_id":128,"order_number":"TEST","spots":[]}"#, + #"{"scenic_id":128,"order_number":"TEST","airports":[],"spots":null}"#, + #"{"scenic_id":128,"order_number":"TEST","airports":[],"spots":{}}"#, + #"{"scenic_id":0,"order_number":"TEST","airports":[],"spots":[]}"#, + #"{"scenic_id":128,"order_number":" ","airports":[],"spots":[]}"#, + #"{"scenic_id":128,"order_number":"TEST","airports":[],"spots":[{"scenic_spot_id":201,"name":"测试点位"}]}"#, + #"{"scenic_id":128,"order_number":"TEST","airports":[],"spots":[{"scenic_spot_id":201,"name":"测试点位","air_lines":[null]}]}"# + ] { XCTAssertThrowsError(try decode(payload), payload) } + } + + /// 列表身份必须正整数且各自唯一,同一航线可归属不同点位而不产生虚假重复。 + func testInvalidAndDuplicateIdentitiesAreRejected() throws { + for id in ["0", "-1", "1.5", "true", "\"invalid\""] { + XCTAssertThrowsError(try decode("{\"scenic_id\":128,\"order_number\":\"TEST\",\"airports\":[],\"spots\":[{\"scenic_spot_id\":\(id),\"name\":\"测试\",\"air_lines\":[]}] }")) + } + let route = #"{"air_line_id":301,"name":"测试航线"}"# + let point = "{\"scenic_spot_id\":201,\"name\":\"测试点位\",\"air_lines\":[\(route)]}" + XCTAssertThrowsError(try decode("{\"scenic_id\":128,\"order_number\":\"TEST\",\"airports\":[],\"spots\":[\(point),\(point)]}")) + XCTAssertThrowsError(try decode("{\"scenic_id\":128,\"order_number\":\"TEST\",\"airports\":[],\"spots\":[{\"scenic_spot_id\":201,\"name\":\"测试点位\",\"air_lines\":[\(route),\(route)]}]}")) + XCTAssertThrowsError(try decode(#"{"scenic_id":128,"order_number":"TEST","airports":[{"id":1,"name":"测试设备"},{"id":1,"name":"测试设备"}],"spots":[]}"#)) + let otherPoint = point.replacingOccurrences(of: "201", with: "202") + let response = try decode("{\"scenic_id\":128,\"order_number\":\"TEST\",\"airports\":[],\"spots\":[\(point),\(otherPoint)]}") + XCTAssertEqual(response.spots.map { $0.airLines.first?.id }, [301, 301]) + } + + /// 进度属于其他订单时拒绝响应,防止串单额度显示。 + func testMismatchingProgressOrderIsRejected() { + XCTAssertThrowsError(try decode(#"{"scenic_id":128,"order_number":"TEST-ORDER-001","order_progress":{"order_number":"TEST-ORDER-002"},"airports":[],"spots":[]}"#)) + } + + /// 非法次数、距离和布尔类型明确报错,不静默变成零或允许操作。 + func testMalformedCountsDistancesAndGateAreRejected() { + for value in ["-1", "1.5", "true", "\"invalid\""] { + XCTAssertThrowsError(try decode("{\"scenic_id\":128,\"order_number\":\"TEST\",\"airports\":[],\"spots\":[],\"order_progress\":{\"shot_used\":\(value)}}")) + } + for value in ["-1", "\"NaN\"", "\"infinity\"", "true", "\"invalid\""] { + XCTAssertThrowsError(try decode("{\"scenic_id\":128,\"order_number\":\"TEST\",\"airports\":[],\"spots\":[{\"scenic_spot_id\":201,\"name\":\"测试\",\"air_lines\":[],\"distance_m\":\(value)}]}")) + } + XCTAssertThrowsError(try decode(#"{"scenic_id":128,"order_number":"TEST","airports":[],"spots":[],"shoot_gate":{"can_shoot":"true"}}"#)) + } + + /// 未知门禁代码和文案原样保留,不将未识别状态视为允许召唤。 + func testNewGateCodesArePreservedWithoutInventingPermission() throws { + let response = try decode(#"{"scenic_id":128,"order_number":"TEST","airports":[],"spots":[],"shoot_gate":{"code":"future_check","message":"需要新的检查","primary_action":"future_action","primary_action_label":"检查状态"}}"#) + XCTAssertEqual(response.shootGate?.code, "future_check") + XCTAssertEqual(response.shootGate?.message, "需要新的检查") + XCTAssertEqual(response.shootGate?.primaryAction, "future_action") + XCTAssertEqual(response.shootGate?.primaryActionLabel, "检查状态") + XCTAssertNil(response.shootGate?.canShoot) + } + + /// 解码独立准备载荷,便于定位字段错误。 + private func decode(_ payload: String) throws -> DroneDockPreparationResponse { + try JSONDecoder().decode(DroneDockPreparationResponse.self, from: Data(payload.utf8)) + } + +} diff --git a/suixinkanTests/DroneDockPreparationFailureTests.swift b/suixinkanTests/DroneDockPreparationFailureTests.swift new file mode 100644 index 0000000..619f167 --- /dev/null +++ b/suixinkanTests/DroneDockPreparationFailureTests.swift @@ -0,0 +1,62 @@ +import XCTest +@testable import suixinkan + +/// 报备提示仅来自明确错误语义,不凭同一个通用业务码猜测原因。 +final class DroneDockPreparationFailureTests: XCTestCase { + /// 创建与召唤均可提示报备,保留具体原因与处理指引。 + func testExplicitFilingErrorsProvideGuidance() { + for message in ["未报备,禁止飞行", "当前航线未完成报备", "报备已过期", "请先备案", + "该无人机今日未完成起飞报备,请先提交报备截图"] { + for stage in [DroneDockPreparationFailure.Stage.creation, .summon] { + let value = DroneDockPreparationFailure(message: message, stage: stage, outcomeUnknown: false) + XCTAssertTrue(value.requiresFiling) + XCTAssertEqual(value.title, "请先完成飞行报备") + XCTAssertTrue(value.message.contains(message)) + XCTAssertTrue(value.message.contains("确认生效后再重试")) + } + } + } + + /// 真实 shoot 回执的 41901 不依赖后端文案;未确认属于创建接口的码不跨接口套用。 + func testConfirmedSummonCodeProvidesScreenshotGuidance() { + let failure = DroneDockPreparationFailure(message: "请处理后重试", stage: .summon, + outcomeUnknown: false, code: 41901) + XCTAssertTrue(failure.requiresFiling) + XCTAssertEqual(failure.title, "请先完成飞行报备") + XCTAssertTrue(failure.message.contains("今日的起飞报备并提交报备截图")) + XCTAssertTrue(failure.message.contains("请处理后重试")) + let creation = DroneDockPreparationFailure(message: "请处理后重试", stage: .creation, + outcomeUnknown: false, code: 41901) + XCTAssertFalse(creation.requiresFiling) + let generic = DroneDockPreparationFailure(message: "请处理后重试", stage: .summon, + outcomeUnknown: false, code: 100099) + XCTAssertFalse(generic.requiresFiling) + let unknown = DroneDockPreparationFailure(message: "请处理后重试", stage: .summon, + outcomeUnknown: true, code: 41901) + XCTAssertFalse(unknown.requiresFiling) + XCTAssertEqual(unknown.title, "召唤结果待核对") + } + + /// 用户提供的已结束任务回执属于召唤失败,不能展示为未报备或自动重启。 + func testEndedTaskAndOtherRejectionsAreNotMisclassifiedAsFiling() { + let ended = "任务已结束,无法召唤;失败后请传 restart=true 重新召唤" + let value = DroneDockPreparationFailure(message: ended, stage: .summon, outcomeUnknown: false) + XCTAssertFalse(value.requiresFiling) + XCTAssertEqual(value.title, "任务已结束") + XCTAssertFalse(value.message.contains("restart=true")) + for message in ["无人机忙碌", "已报备,无人机离线", "次数已用完"] { + let failure = DroneDockPreparationFailure(message: message, stage: .creation, outcomeUnknown: false) + XCTAssertFalse(failure.requiresFiling) + XCTAssertEqual(failure.title, "任务创建失败") + XCTAssertEqual(failure.message, message) + } + } + + /// 结果未知不引导直接重试,即使说明文字包含报备关键字。 + func testUnknownOutcomeKeepsReconciliationGuidance() { + let value = DroneDockPreparationFailure(message: "报备未确认;创建结果待核对", stage: .creation, outcomeUnknown: true) + XCTAssertFalse(value.requiresFiling) + XCTAssertEqual(value.title, "任务创建结果待核对") + XCTAssertFalse(value.message.contains("再重试")) + } +} diff --git a/suixinkanTests/DroneDockPreparationRouteTests.swift b/suixinkanTests/DroneDockPreparationRouteTests.swift new file mode 100644 index 0000000..22ad028 --- /dev/null +++ b/suixinkanTests/DroneDockPreparationRouteTests.swift @@ -0,0 +1,209 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用纯内存准备/召唤替身验证准备页替换路由,不连接真实设备或图传。 +@MainActor +final class DroneDockPreparationRouteTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 正常业务栈移除准备页,任务返回原工作台;更早的导航页面仍完整保留。 + func testSuccessfulSummonReplacesPreparationAndReturnsToSameWorkbench() async throws { + for hasEarlierRoot in [false, true] { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .success(try DroneDockShootTestData.response())) + let task = PreparationRouteTaskStub(taskID: 501) + var destinationCount = 0 + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (preparation, projects) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot, + taskControllerFactory: { id, order, context in + destinationCount += 1 + XCTAssertEqual(id, 501) + XCTAssertEqual(order.orderNumber, "TEST-PREPARATION-001") + XCTAssertEqual(context.scenicID, 128) + return task + }) + let workbench = UIViewController() + workbench.title = "机巢工作台(隔离替身)" + let earlier = UIViewController() + let prefix = hasEarlierRoot ? [earlier, workbench] : [workbench] + let navigation = UINavigationController() + navigation.setViewControllers(prefix + [preparation], animated: false) + let window = makeWindow(navigation) + defer { close(window) } + let summon = try button(in: preparation.view, id: "drone.preparation.summon") + try await settle(window) { summon.isEnabled } + summon.sendActions(for: .touchUpInside) + summon.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController === task && navigation.transitionCoordinator == nil } + XCTAssertEqual(navigation.viewControllers.count, prefix.count + 1) + XCTAssertTrue(navigation.viewControllers.dropLast().elementsEqual(prefix, by: { $0 === $1 })) + XCTAssertFalse(navigation.viewControllers.contains { $0 === preparation }) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + XCTAssertEqual(destinationCount, 1) + XCTAssertEqual(projects.requests.count, 2) + + XCTAssertTrue(navigation.popViewController(animated: false) === task) + try await settle(window) { navigation.topViewController === workbench } + XCTAssertTrue(navigation.viewControllers.elementsEqual(prefix, by: { $0 === $1 })) + summon.sendActions(for: .touchUpInside) + try await Task.sleep(for: .milliseconds(80)) + XCTAssertTrue(navigation.topViewController === workbench, "已移除准备页的旧按钮不能再次导航") + XCTAssertEqual(destinationCount, 1) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + XCTAssertEqual(projects.requests.count, 2, "返回工作台不应重新激活已移除准备页的读取") + } + } + + /// 已创建的结束任务仅在用户点击查看时替换准备页,不重发创建或召唤。 + func testExplicitReviewOfCreatedTaskAlsoRemovesPreparation() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .failure(APIError.serverCode(100099, + "任务已结束,无法召唤;失败后请传 restart=true 重新召唤"))) + let task = PreparationRouteTaskStub(taskID: 501) + var destinationCount = 0 + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (preparation, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot, + taskControllerFactory: { id, _, _ in + destinationCount += 1 + XCTAssertEqual(id, 501) + return task + }) + let workbench = UIViewController() + workbench.title = "机巢工作台(隔离替身)" + let navigation = UINavigationController() + navigation.setViewControllers([workbench, preparation], animated: false) + let window = makeWindow(navigation) + defer { close(window) } + let summon = try button(in: preparation.view, id: "drone.preparation.summon") + try await settle(window) { summon.isEnabled } + summon.sendActions(for: .touchUpInside) + try await settle(window) { preparation.viewModel.summonRequiresTaskReview && summon.isEnabled } + XCTAssertTrue(navigation.topViewController === preparation) + XCTAssertEqual(destinationCount, 0) + XCTAssertEqual(summon.title(for: .normal), "查看拍摄任务") + summon.sendActions(for: .touchUpInside) + summon.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController === task && navigation.transitionCoordinator == nil } + XCTAssertTrue(navigation.viewControllers.elementsEqual([workbench, task], by: { $0 === $1 })) + XCTAssertEqual(destinationCount, 1) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + navigation.popViewController(animated: false) + try await settle(window) { navigation.topViewController === workbench } + XCTAssertEqual(navigation.viewControllers.count, 1) + } + + /// 已离开准备页后返回的迟到召唤回执不能覆盖工作台或再次压入任务页。 + func testLateSummonReceiptAfterLeavingPreparationDoesNotNavigate() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = PreparationRouteDeferredShoot() + var destinationCount = 0 + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (preparation, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot, + taskControllerFactory: { id, _, _ in + destinationCount += 1 + return PreparationRouteTaskStub(taskID: id) + }) + let workbench = UIViewController() + workbench.title = "机巢工作台(隔离替身)" + let navigation = UINavigationController() + navigation.setViewControllers([workbench, preparation], animated: false) + let window = makeWindow(navigation) + defer { shoot.finish(); close(window) } + let summon = try button(in: preparation.view, id: "drone.preparation.summon") + try await settle(window) { summon.isEnabled } + summon.sendActions(for: .touchUpInside) + summon.sendActions(for: .touchUpInside) + try await settle(window) { shoot.isPending } + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + navigation.popViewController(animated: false) + try await settle(window) { navigation.topViewController === workbench } + shoot.finish() + try await Task.sleep(for: .milliseconds(100)) + XCTAssertTrue(navigation.topViewController === workbench) + XCTAssertEqual(navigation.viewControllers.count, 1) + XCTAssertEqual(destinationCount, 0) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + } + + private func button(in root: UIView, id: String) throws -> UIButton { + try XCTUnwrap(views(root).first { $0.accessibilityIdentifier == id } as? UIButton) + } + + private func views(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap { self.views($0) } } + + private func makeWindow(_ navigation: UINavigationController) -> UIWindow { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = navigation + window.makeKeyAndVisible() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(4)) + while ContinuousClock.now < deadline { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(for: .milliseconds(80)) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(for: .milliseconds(10)) + } + XCTFail("隔离准备页路由未达到预期状态") + throw NSError(domain: "DroneDockPreparationRouteTests", code: 1) + } +} + +/// 只承接任务身份的空任务页,不运行任何状态请求或设备服务。 +@MainActor +private final class PreparationRouteTaskStub: UIViewController { + let taskID: Int + + init(taskID: Int) { + self.taskID = taskID + super.init(nibName: nil, bundle: nil) + title = "拍摄任务(隔离替身)" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } +} + +/// 故意在页面离开后再完成回执,用于验证取消和导航身份检查,不包含网络传输。 +@MainActor +private final class PreparationRouteDeferredShoot: DroneDockShootServing { + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + var isPending: Bool { continuation != nil } + + func shoot(taskID: Int) async throws -> DroneDockShootResponse { + requests.append(taskID) + return try await withCheckedThrowingContinuation { continuation = $0 } + } + + func finish() { + continuation?.resume(returning: DroneDockShootResponse(dataJSON: #"{"source":"local_mock"}"#)) + continuation = nil + } +} diff --git a/suixinkanTests/DroneDockPreparationSimulationTests.swift b/suixinkanTests/DroneDockPreparationSimulationTests.swift new file mode 100644 index 0000000..0176eeb --- /dev/null +++ b/suixinkanTests/DroneDockPreparationSimulationTests.swift @@ -0,0 +1,144 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用独立内存服务走完整准备与任务页面,不创建真实订单任务或下发设备指令。 +@MainActor +final class DroneDockPreparationSimulationTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 仅点击后模拟创建并召唤,再读相同任务;开拍仍使用同一个隔离会话。 + func testPreparationCreatesSummonsAndOpensSameMockTask() async throws { + let preparation = try XCTUnwrap(DroneDockStartShootSimulation.makeController( + arguments: ["--dock-preparation-mock"]) as? DroneDockRemotePreparationViewController) + let window = makeWindow(preparation) + defer { close(window) } + let button = try button(in: preparation.view, id: "drone.preparation.summon") + try await settle(window) { button.isEnabled && preparation.viewModel.planeStatus != nil } + XCTAssertEqual(preparation.viewModel.selectedSpotID, 301) + XCTAssertEqual(preparation.viewModel.selectedRouteID, 401) + XCTAssertEqual(preparation.viewModel.planeStatus?.recommend?.id, 201) + XCTAssertNil(preparation.viewModel.createdTask) + XCTAssertNil(preparation.viewModel.shootResponse) + button.sendActions(for: .touchUpInside) + button.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(preparation.navigationController) + try await settle(window) { + (navigation.topViewController as? DroneDockShootingTaskViewController)?.viewModel.canStartShooting == true + } + let task = try XCTUnwrap(navigation.topViewController as? DroneDockShootingTaskViewController) + XCTAssertEqual(navigation.viewControllers.count, 2) + XCTAssertEqual(task.viewModel.taskID, 901) + XCTAssertEqual(task.viewModel.order.orderNumber, "LOCAL-MOCK-ORDER-901") + XCTAssertEqual(task.viewModel.context, preparation.viewModel.context) + XCTAssertEqual(preparation.viewModel.createdTask?.taskID, 901) + try self.button(in: task.view, id: "drone.task.remote.primary").sendActions(for: .touchUpInside) + try await settle(window) { task.viewModel.hasSubmittedStart && task.viewModel.presentation.phase == .shooting } + let transcript = try await records(task, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + let posts = entries.filter { $0["method"] as? String == "POST" } + XCTAssertEqual(posts.map { $0["path"] as? String }, [ + "/api/yf-handset-app/photog/multi-plane/tasks/create", "/api/app/airport/shoot", "/api/app/airport/start-shoot" + ]) + let creation = try XCTUnwrap(posts.first?["request_body"] as? [String: Any]) + XCTAssertEqual(Set(creation.keys), ["scenic_id", "order_number", "scenic_spot_id", "air_line_id"]) + XCTAssertEqual(creation["scenic_id"] as? Int, 128) + XCTAssertEqual(creation["order_number"] as? String, "LOCAL-MOCK-ORDER-901") + XCTAssertEqual(creation["scenic_spot_id"] as? Int, 301) + XCTAssertEqual(creation["air_line_id"] as? Int, 401) + let summon = try XCTUnwrap(posts[1]["request_body"] as? [String: Any]) + XCTAssertEqual(Set(summon.keys), ["id", "restart"]) + XCTAssertEqual(summon["id"] as? Int, 901) + XCTAssertEqual(summon["restart"] as? Bool, false) + XCTAssertEqual((posts[2]["request_body"] as? [String: Int]), ["id": 901]) + let taskReads = entries.filter { $0["path"] as? String == "/api/app/airport/shooting" } + XCTAssertEqual(taskReads.count, 2) + XCTAssertTrue(taskReads.allSatisfy { ($0["query"] as? String)?.contains("id=901") == true }) + XCTAssertEqual(transcript["source"] as? String, "local_mock") + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + } + + /// 返回准备页后只查看原模拟任务,不重复创建或召唤,也不会自动跳转。 + func testReturningToPreparationReopensTaskWithoutRepeatedWrites() async throws { + let preparation = try XCTUnwrap(DroneDockStartShootSimulation.makePreparationController()) + let window = makeWindow(preparation) + defer { close(window) } + let button = try button(in: preparation.view, id: "drone.preparation.summon") + try await settle(window) { button.isEnabled } + button.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(preparation.navigationController) + try await settle(window) { + (navigation.topViewController as? DroneDockShootingTaskViewController)?.viewModel.response != nil + } + navigation.popViewController(animated: false) + try await settle(window) { preparation.viewModel.canOpenShootingTask && button.isEnabled } + XCTAssertTrue(navigation.topViewController === preparation) + XCTAssertEqual(navigation.viewControllers.count, 1) + button.sendActions(for: .touchUpInside) + try await settle(window) { + (navigation.topViewController as? DroneDockShootingTaskViewController)?.viewModel.response != nil + } + let task = try XCTUnwrap(navigation.topViewController as? DroneDockShootingTaskViewController) + XCTAssertEqual(task.viewModel.taskID, 901) + let transcript = try await records(task, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(entries.filter { $0["method"] as? String == "POST" }.map { $0["path"] as? String }, [ + "/api/yf-handset-app/photog/multi-plane/tasks/create", "/api/app/airport/shoot" + ]) + XCTAssertEqual(entries.filter { $0["path"] as? String == "/api/app/airport/shooting" }.count, 2) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + } + + private func records(_ controller: UIViewController, window: UIWindow) async throws -> [String: Any] { + let item = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.mock.recordsButton" + }) + let action = try XCTUnwrap(item.action) + _ = UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + try await settle(window) { controller.presentedViewController != nil } + let sheet = try XCTUnwrap(controller.presentedViewController) + let text = try XCTUnwrap(allViews(sheet.view).first { + $0.accessibilityIdentifier == "drone.task.mock.records" + } as? UITextView) + return try XCTUnwrap(JSONSerialization.jsonObject(with: Data(text.text.utf8)) as? [String: Any]) + } + + private func button(in root: UIView, id: String) throws -> UIButton { + try XCTUnwrap(allViews(root).first { $0.accessibilityIdentifier == id } as? UIButton) + } + + private func makeWindow(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 300_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("本地模拟准备与任务流程未在预期时间内完成") + throw NSError(domain: "DroneDockPreparationSimulationTests", code: 1) + } + + private func allViews(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews($0) } } +} diff --git a/suixinkanTests/DroneDockPreparationSubmissionTests.swift b/suixinkanTests/DroneDockPreparationSubmissionTests.swift new file mode 100644 index 0000000..6b1e6b6 --- /dev/null +++ b/suixinkanTests/DroneDockPreparationSubmissionTests.swift @@ -0,0 +1,147 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证移除构建限制后仍保留购买权限、幂等提交和失败核对;所有服务均为内存替身。 +@MainActor +final class DroneDockPreparationSubmissionTests: XCTestCase { + /// 尚未加载购买配置时,直接调用也不能绕过订单与航线门禁。 + func testMissingPurchaseBlocksDirectCallsBeforeLoading() async throws { + let fixture = try PreparationSubmissionFixture() + var callbacks = 0 + await fixture.model.createTask { callbacks += 1 } + await fixture.model.prepareAndSummon { callbacks += 1 } + XCTAssertEqual(callbacks, 0) + XCTAssertEqual(fixture.projects.requestCount, 0) + XCTAssertTrue(fixture.creation.requests.isEmpty) + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertFalse(fixture.model.canCreateTask) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertEqual(fixture.model.primaryButtonTitle, "确认并召唤") + XCTAssertEqual(fixture.model.admissionMessage, "正在加载拍摄准备信息") + } + + /// 后端不允许创建任务时,即使设备空闲,也不能创建或召唤。 + func testBackendPurchaseGateStillBlocksCreationWithReadyPlane() async throws { + let fixture = try PreparationSubmissionFixture() + fixture.projects.canCreateTask = false + await fixture.model.refresh() + await fixture.model.refreshPlaneStatus() + XCTAssertEqual(fixture.model.projectInfo?.order.canCreateTask, false) + XCTAssertEqual(fixture.model.deviceStatusText, "空闲 · 电量 95%") + XCTAssertFalse(fixture.model.canCreateTask) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + await fixture.model.createTask() + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.projects.requestCount, 1) + XCTAssertEqual(fixture.planes.requests, [128]) + XCTAssertTrue(fixture.creation.requests.isEmpty) + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertEqual(fixture.model.primaryButtonTitle, "暂不可召唤") + XCTAssertEqual(fixture.model.admissionMessage, "当前订单暂不可新增拍摄任务,请刷新状态") + } + + /// 纯内存替身验证直接可用的串接,成功后仅查看同一任务,不重发写入。 + func testEligiblePurchaseCreatesAndSummonsOnceWithoutSubmissionOverride() async throws { + let fixture = try PreparationSubmissionFixture() + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canCreateTask) + XCTAssertTrue(fixture.model.isPrimaryActionEnabled) + await fixture.model.prepareAndSummon() + + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + XCTAssertTrue(fixture.model.canOpenShootingTask) + XCTAssertEqual(fixture.model.primaryButtonTitle, "查看拍摄任务") + await fixture.model.prepareAndSummon() + await fixture.model.createTask() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + + /// 后端明确拒绝创建时保留错误,不误报结果未知或自动重发。 + func testCreationBusinessRejectionPreservesReasonWithoutUnknownOutcome() async throws { + let fixture = try PreparationSubmissionFixture() + fixture.creation.result = .failure(APIError.serverCode(100050, "服务暂不可用,请稍后重试")) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + + XCTAssertEqual(fixture.creation.requests.count, 1, "替身记录一次明确业务拒绝") + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + XCTAssertFalse(fixture.model.isCreatingTask) + XCTAssertEqual(fixture.model.taskCreationErrorMessage, "服务暂不可用,请稍后重试") + XCTAssertEqual(fixture.model.admissionMessage, "服务暂不可用,请稍后重试") + fixture.model.invalidate() + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + } + + /// 后端明确拒绝召唤时保留已建任务,不进入结果未知状态。 + func testSummonBusinessRejectionKeepsTaskWithoutUnknownOutcome() async throws { + let fixture = try PreparationSubmissionFixture() + fixture.shoot.result = .failure(APIError.serverCode(100050, "服务暂不可用,请稍后重试")) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + XCTAssertFalse(fixture.model.isSummoning) + XCTAssertFalse(fixture.model.canOpenShootingTask) + XCTAssertEqual(fixture.model.shootErrorMessage, "服务暂不可用,请稍后重试") + XCTAssertEqual(fixture.model.admissionMessage, "服务暂不可用,请稍后重试") + fixture.model.invalidateSummon() + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + } +} + +/// 四项服务全部为内存替身,测试不会建立真实 URLSession 或连接无人机。 +@MainActor +private struct PreparationSubmissionFixture { + let projects: SubmissionProjectService + let planes: DroneDockPlaneStatusTestService + let creation: DroneDockTaskCreationTestService + let shoot: DroneDockShootTestService + let model: DroneDockPreparationViewModel + + /// 使用匿名订单、点位和测试凭证构建可读且具备创建条件的准备状态。 + init() throws { + let context = DroneDockHomeContext(userID: "no-flight-test-user", accountType: "store_user", + scenicID: 128, scenicName: "测试景区", storeID: 37, photographerName: "测试人员", token: "no-flight-test-token") + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: Data(#"{"order_number":"TEST-PREPARATION-001","project_id":101}"#.utf8)) + projects = SubmissionProjectService() + let plane = DroneDockPlaneStatusTestData.plane() + planes = try DroneDockPlaneStatusTestService(response: DroneDockPlaneStatusTestData.response( + planes: [plane], recommend: plane, connected: true)) + creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + shoot = DroneDockShootTestService(result: .success(try DroneDockShootTestData.response())) + model = DroneDockPreparationViewModel(context: context, order: order, service: projects, + planeStatusService: planes, taskCreationService: creation, shootService: shoot, + currentContext: { context }) + } +} + +/// 返回固定合法购买数据并记录读取次数,用于区分正常查询与写入前预检。 +@MainActor +private final class SubmissionProjectService: DroneDockPreparationServing { + private(set) var requestCount = 0 + var canCreateTask = true + + /// 仅从内存 JSON 解码,不请求任何后端。 + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse { + requestCount += 1 + let json = #"{"order_number":"TEST-PREPARATION-001","project_id":101,"shoot_count":5,"shot_count":0,"remaining_count":5,"can_create_task":true,"spot":[{"scenic_spot_id":201,"scenic_spot_name":"测试点位","available":true,"air_lines":[{"air_line_id":301,"air_line_name":"测试航线","available":true}]}]}"# + let data = json.replacingOccurrences(of: "\"can_create_task\":true", with: "\"can_create_task\":\(canCreateTask)") + return try JSONDecoder().decode(DroneDockProjectInfoResponse.self, from: Data(data.utf8)) + } +} diff --git a/suixinkanTests/DroneDockPreparationViewModelTests.swift b/suixinkanTests/DroneDockPreparationViewModelTests.swift new file mode 100644 index 0000000..1b89a11 --- /dev/null +++ b/suixinkanTests/DroneDockPreparationViewModelTests.swift @@ -0,0 +1,712 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证准备页购买配置、独立无人机状态、选择约束及异步身份隔离。 +@MainActor +final class DroneDockPreparationViewModelTests: XCTestCase { + /// 次数和配置来自购买快照,首页旧额度不会覆盖五次套餐。 + func testPurchasedSnapshotOwnsCountsPointsAndRoutes() async throws { + let service = try ImmediatePreparationService() + let model = try makeModel(service: service) + await model.refresh() + XCTAssertEqual(model.projectInfo?.order.shotTotal, 5) + XCTAssertEqual(model.projectInfo?.order.shotUsed, 0) + XCTAssertEqual(model.projectInfo?.order.shotRemain, 5) + XCTAssertEqual(model.spots.map(\.id), [201, 202]) + XCTAssertEqual(model.selectedSpotID, 201) + XCTAssertEqual(model.selectedRouteID, 301) + XCTAssertEqual(model.selectedSpot?.name, "已购点位 201") + XCTAssertEqual(model.routes.map(\.id), [301, 302]) + XCTAssertNil(model.errorMessage) + XCTAssertEqual(service.projectRequests.first?.projectID, 101) + XCTAssertEqual(service.projectRequests.first?.orderNumber, "TEST-PREPARATION-001") + XCTAssertEqual(service.projectRequests.count, 1) + } + + /// 页面刷新只发 project-info GET,不触发定位、旧设备入口或任务写入。 + func testRefreshOnlyRequestsProjectInfo() async throws { + let payload = Data(#"{"code":100000,"msg":"success","data":{"order_number":"TEST-PREPARATION-001","project_id":101,"project_name":"已购五次套餐","shoot_count":5,"shot_count":0,"remaining_count":5,"can_create_task":true,"spot":[]}}"#.utf8) + let session = MockURLSession(responses: [payload]) + let api = DroneDockPreparationAPI(client: APIClient(environment: .testing, session: session)) + let model = try makeModel(service: api) + + await model.refresh() + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/project-info") + let items = try XCTUnwrap(URLComponents(url: XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems) + XCTAssertEqual(Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }), + ["scenic_id": "128", "project_id": "101", "order_number": "TEST-PREPARATION-001"]) + XCTAssertNotNil(model.projectInfo) + XCTAssertNil(model.errorMessage) + } + + /// 仅完成购买读取时设备仍未知,必须由独立无人机状态请求更新。 + func testPurchaseAloneKeepsDeviceUnknownAndSummonUnavailable() async throws { + let model = try makeModel(service: ImmediatePreparationService()) + await model.refresh() + + XCTAssertEqual(model.connectionTitle, "机巢连接待确认") + XCTAssertEqual(model.connectionTone, .gray) + XCTAssertEqual(model.deviceStatusText, "状态待确认") + XCTAssertEqual(model.deviceTone, .gray) + XCTAssertEqual(model.primaryButtonTitle, "确认并召唤") + XCTAssertEqual(model.admissionMessage, "点击后创建任务并召唤无人机") + } + + /// 点位切换重选所属航线,未知及不可用航线不能成为当前选择。 + func testChangingSpotRejectsUnavailableAndForeignRoutes() async throws { + let service = try ImmediatePreparationService() + var second = PreparationFixture.point(202, routes: [401, 402, 403]) + var routes = try XCTUnwrap(second["air_lines"] as? [[String: Any]]) + routes[0]["available"] = false + routes[2]["available"] = NSNull() + second["air_lines"] = routes + service.projectResult = .success(try PreparationFixture.project(spots: [PreparationFixture.point(201), second])) + let model = try makeModel(service: service) + await model.refresh() + model.selectRoute(id: 302) + XCTAssertEqual(model.selectedRouteID, 302) + model.selectSpot(id: 202) + XCTAssertEqual(model.selectedRouteID, 402) + for id in [301, 401, 403, 999] { model.selectRoute(id: id) } + XCTAssertEqual(model.selectedRouteID, 402) + XCTAssertEqual(service.projectRequests.count, 1) + } + + /// 刷新保留仍可用选择,已停用点位或航线回落到首个明确可用项。 + func testRefreshRevalidatesAvailabilityAndSelection() async throws { + let service = try ImmediatePreparationService() + let model = try makeModel(service: service) + await model.refresh() + model.selectSpot(id: 202) + model.selectRoute(id: 402) + await model.refresh() + XCTAssertEqual(model.selectedRouteID, 402) + service.projectResult = .success(try PreparationFixture.project(spots: [PreparationFixture.point(202, routes: [401])])) + await model.refresh() + XCTAssertEqual(model.selectedSpotID, 202) + XCTAssertEqual(model.selectedRouteID, 401) + service.projectResult = .success(try PreparationFixture.project(spots: [PreparationFixture.point(201, routes: [301, 401])])) + await model.refresh() + XCTAssertEqual(model.selectedSpotID, 201) + XCTAssertEqual(model.selectedRouteID, 301, "点位被替换时不沿用旧点位的航线选择") + var unavailable = PreparationFixture.point(202) + unavailable["available"] = false + service.projectResult = .success(try PreparationFixture.project(spots: [unavailable, PreparationFixture.point(201)])) + await model.refresh() + model.selectSpot(id: 202) + XCTAssertEqual(model.selectedSpotID, 201) + service.projectResult = .success(try PreparationFixture.project(spots: [])) + await model.refresh() + XCTAssertNil(model.selectedSpotID) + XCTAssertNil(model.selectedRouteID) + XCTAssertTrue(model.routes.isEmpty) + } + + /// 可用性未知时不猜测可拍,仍保留已购配置供页面解释。 + func testUnknownAvailabilityDoesNotSelectPoint() async throws { + let service = try ImmediatePreparationService() + var point = PreparationFixture.point(201) + point.removeValue(forKey: "available") + service.projectResult = .success(try PreparationFixture.project(spots: [point])) + let model = try makeModel(service: service) + await model.refresh() + model.selectSpot(id: 201) + XCTAssertEqual(model.spots.count, 1) + XCTAssertNil(model.selectedSpotID) + XCTAssertNil(model.selectedRouteID) + XCTAssertEqual(model.admissionMessage, "请选择可用拍摄点") + } + + /// 购买配置失败后清空次数与选择,不继续沿用旧快照。 + func testProjectFailureClearsPurchasedDataAndRetryRestoresIt() async throws { + let service = try ImmediatePreparationService() + let model = try makeModel(service: service) + await model.refresh() + service.projectResult = .failure(APIError.networkFailed("购买配置暂不可用")) + await model.refresh() + XCTAssertNil(model.projectInfo) + XCTAssertTrue(model.spots.isEmpty) + XCTAssertNil(model.selectedSpotID) + XCTAssertTrue(model.errorMessage?.contains("购买配置暂不可用") == true) + service.projectResult = .success(try PreparationFixture.project()) + await model.refresh() + XCTAssertEqual(model.projectInfo?.order.shotRemain, 5) + XCTAssertNil(model.errorMessage) + } + + /// 刷新期间保留旧选择供展示,但不能切换尚未重新确认的配置。 + func testPendingRefreshBlocksSelectionUntilPurchaseReturns() async throws { + let service = SuspendedPreparationService() + let firstStarted = expectation(description: "首次购买请求") + let secondStarted = expectation(description: "购买刷新挂起") + service.requestStarted = { if $0 == 0 { firstStarted.fulfill() } else { secondStarted.fulfill() } } + defer { service.cancelAll() } + let model = try makeModel(service: service) + let first = Task { await model.refresh() } + await fulfillment(of: [firstStarted], timeout: 2) + XCTAssertEqual(model.admissionMessage, "正在获取拍摄准备信息") + try service.finish(index: 0) + await first.value + model.selectRoute(id: 302) + + let second = Task { await model.refresh() } + await fulfillment(of: [secondStarted], timeout: 2) + model.selectSpot(id: 202) + model.selectRoute(id: 301) + XCTAssertEqual(model.selectedSpotID, 201) + XCTAssertEqual(model.selectedRouteID, 302) + try service.finish(index: 1) + await second.value + XCTAssertEqual(model.selectedRouteID, 302) + XCTAssertFalse(model.isLoading) + } + + /// 购买快照必须同时属于当前订单和项目。 + func testMismatchedResponseIdentitiesAreRejected() async throws { + let service = try ImmediatePreparationService() + let model = try makeModel(service: service) + service.projectResult = .success(try PreparationFixture.project(projectID: 999)) + await model.refresh() + XCTAssertNil(model.projectInfo) + XCTAssertNotNil(model.errorMessage) + service.projectResult = .success(try PreparationFixture.project(number: "OTHER-ORDER")) + await model.refresh() + XCTAssertNil(model.projectInfo) + service.projectResult = .success(try PreparationFixture.project()) + await model.refresh() + XCTAssertNotNil(model.projectInfo) + XCTAssertNil(model.errorMessage) + } + + /// 先前素材上传不阻止继续拍摄,最新购买额度与许可仍独立限制创建。 + func testUploadingTaskCanPrepareNextShotOnlyWithRemainingQuotaAndPermission() async throws { + let service = try ImmediatePreparationService() + let model = try makeModel(service: service, orderStatus: 20) + for (remaining, canCreate, expected) in [(4, true, true), (0, true, false), (4, false, false)] { + service.projectResult = .success(try PreparationFixture.project(remaining: remaining, + canCreate: canCreate, orderStatus: 20, materialStatus: 2, activeTaskStatus: 25)) + await model.refresh() + XCTAssertEqual(model.projectInfo?.order.orderStatus, 20) + XCTAssertEqual(model.projectInfo?.order.materialStatus, 2) + XCTAssertNil(model.projectInfo?.order.activeFlightTaskID) + XCTAssertEqual(model.projectInfo?.order.shotRemain, remaining) + XCTAssertEqual(model.canCreateTask, expected) + if remaining == 0 { XCTAssertEqual(model.primaryButtonTitle, "拍摄次数已用完") } + } + XCTAssertEqual(service.projectRequests.count, 3) + XCTAssertNil(model.createdTask, "只核对准备门禁,不调用创建或召唤") + } + + /// 购买权限与次数各自独立,未知或已耗尽不能允许新增任务。 + func testAdmissionUsesPurchasedPermissionAndKnownQuota() async throws { + let service = try ImmediatePreparationService() + let model = try makeModel(service: service) + service.projectResult = .success(try PreparationFixture.project(remaining: 0)) + await model.refresh() + XCTAssertEqual(model.primaryButtonTitle, "拍摄次数已用完") + service.projectResult = .success(try PreparationFixture.project(remaining: nil)) + await model.refresh() + XCTAssertEqual(model.admissionMessage, "拍摄次数待确认,请刷新状态") + service.projectResult = .success(try PreparationFixture.project(canCreate: false)) + await model.refresh() + XCTAssertEqual(model.admissionMessage, "当前订单暂不可新增拍摄任务,请刷新状态") + } + + /// 账号、景区、门店、凭证变化后,旧购买响应失效。 + func testIdentityChangesRejectInFlightResponse() async throws { + for changed in [context(userID: "other"), context(scenicID: 129), context(storeID: 38), context(token: "other-token")] { + let scope = PreparationContextBox(context()) + let service = SuspendedPreparationService() + let started = expectation(description: "购买请求已挂起") + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let model = try makeModel(service: service, scope: scope) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + scope.value = changed + try service.finish(index: 0) + await pending.value + XCTAssertNil(model.projectInfo) + XCTAssertNil(model.selectedSpotID) + XCTAssertNotNil(model.errorMessage) + } + } + + /// 页面取消和主动失效后迟到的回包不能重填数据。 + func testCancellationAndInvalidationRejectLateResponses() async throws { + for invalidate in [false, true] { + let service = SuspendedPreparationService() + let started = expectation(description: "待取消请求") + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let model = try makeModel(service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + if invalidate { model.invalidate() } else { pending.cancel() } + try service.finish(index: 0) + await pending.value + XCTAssertNil(model.projectInfo) + XCTAssertNil(model.selectedSpotID) + XCTAssertFalse(model.isLoading) + } + } + + /// 新刷新先完成时,旧购买配置不能覆盖最新选择与次数。 + func testOlderRefreshCannotOverwriteNewerPurchasedSnapshot() async throws { + let service = SuspendedPreparationService() + let firstStarted = expectation(description: "首批请求") + let secondStarted = expectation(description: "第二批请求") + service.requestStarted = { if $0 == 0 { firstStarted.fulfill() } else { secondStarted.fulfill() } } + defer { service.cancelAll() } + let model = try makeModel(service: service) + let first = Task { await model.refresh() } + await fulfillment(of: [firstStarted], timeout: 2) + let second = Task { await model.refresh() } + await fulfillment(of: [secondStarted], timeout: 2) + try service.finish(index: 1, project: PreparationFixture.project(spots: [PreparationFixture.point(202, routes: [401])], remaining: 2)) + await second.value + try service.finish(index: 0) + await first.value + XCTAssertEqual(model.spots.map(\.id), [202]) + XCTAssertEqual(model.selectedRouteID, 401) + XCTAssertEqual(model.projectInfo?.order.shotRemain, 2) + XCTAssertNil(model.errorMessage) + } + + /// 缺少项目或会话时本地拦截,不请求当前上架项目代替购买快照。 + func testMissingProjectOrSessionDoesNotCallServices() async throws { + let service = try ImmediatePreparationService() + let missingProject = try makeModel(service: service, projectID: nil) + await missingProject.refresh() + XCTAssertNotNil(missingProject.errorMessage) + let missingSession = try makeModel(service: service, scope: PreparationContextBox(context(token: ""))) + await missingSession.refresh() + XCTAssertNotNil(missingSession.errorMessage) + XCTAssertTrue(service.projectRequests.isEmpty) + } + + /// 推荐结果与列表排序独立,刷新无人机不重读购买配置或改变用户选择。 + func testPlaneStatusUsesRecommendationAndPreservesPurchaseSelection() async throws { + let project = try ImmediatePreparationService() + let first = DroneDockPlaneStatusTestData.plane(id: 1, text: "空闲 · 电量 99%", battery: 99) + let recommended = DroneDockPlaneStatusTestData.plane(id: 2, text: "后端推荐 · 电量 13%", battery: 13) + let planes = try DroneDockPlaneStatusTestService(response: DroneDockPlaneStatusTestData.response( + planes: [first, recommended], recommend: recommended, connected: true)) + let model = try makeModel(service: project, planeService: planes) + await model.refresh() + model.selectSpot(id: 202) + model.selectRoute(id: 402) + + await model.refreshPlaneStatus() + + XCTAssertEqual(model.deviceStatusText, "后端推荐 · 电量 13%") + XCTAssertEqual(model.deviceTone, .green) + XCTAssertEqual(model.connectionTitle, "机巢已连接") + XCTAssertEqual(model.connectionTone, .green) + XCTAssertEqual(model.selectedSpotID, 202) + XCTAssertEqual(model.selectedRouteID, 402) + XCTAssertEqual(model.projectInfo?.order.shotRemain, 5) + XCTAssertEqual(project.projectRequests.count, 1) + XCTAssertEqual(planes.requests, [128]) + XCTAssertEqual(model.primaryButtonTitle, "确认并召唤") + XCTAssertEqual(model.admissionMessage, "点击后创建任务并召唤无人机") + } + + /// 已知工作状态只决定标签颜色,连接必须依赖独立 connected 字段。 + func testPlaneStatusColorsAndConnectionUseExplicitFields() async throws { + let planes = try DroneDockPlaneStatusTestService() + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + let cases: [(Int, Bool?, DroneDockStatusTone, String, String)] = [ + (0, false, .gray, "离线", "机巢未连接"), + (1, true, .green, "空闲", "机巢已连接"), + (2, true, .orange, "拍摄中", "机巢已连接"), + (99, nil, .gray, "维护中", "机巢连接待确认") + ] + for (status, connected, tone, label, connection) in cases { + let plane = DroneDockPlaneStatusTestData.plane(status: status, text: label) + planes.result = .success(try DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane, connected: connected)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "\(label) · 电量 95%") + XCTAssertEqual(model.deviceTone, tone) + XCTAssertEqual(model.connectionTitle, connection) + XCTAssertEqual(model.connectionTone, connected == true ? .green : .gray) + } + } + + /// 缺失完整文案时组合后端标签,缺失电量不伪造成零,真实零标签仍保留。 + func testPlaneStatusFallbackLabelsPreserveUnknownAndRealZero() async throws { + let planes = try DroneDockPlaneStatusTestService() + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + var plane = DroneDockPlaneStatusTestData.plane(text: " ", battery: nil) + plane["work_status_label"] = "空闲" + planes.result = .success(try DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "空闲") + plane["battery_label"] = "电量 0%" + planes.result = .success(try DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "空闲 · 电量 0%") + plane.removeValue(forKey: "work_status_label") + plane.removeValue(forKey: "battery_label") + planes.result = .success(try DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "状态待确认") + } + + /// 状态文案只有工作状态时补上电量;真实零、百分比边界、未知和已有电量分别处理。 + func testBatteryFieldsSupplementStatusWithoutDuplicatesOrInventedZero() async throws { + let planes = try DroneDockPlaneStatusTestService() + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + let cases: [(String, Int?, String?, String)] = [ + ("空闲", 95, nil, "空闲 · 电量 95%"), + ("空闲", 0, nil, "空闲 · 电量 0%"), + ("空闲", 100, "电量 100%", "空闲 · 电量 100%"), + ("空闲 · 电量 95%", 95, "电量 95%", "空闲 · 电量 95%"), + ("空闲 · 电量95%", 95, "电量 95%", "空闲 · 电量95%"), + ("空闲", nil, "电量 88%", "空闲 · 电量 88%"), + ("空闲", nil, "", "空闲"), + ("空闲", -1, nil, "空闲"), + ("空闲", 101, nil, "空闲") + ] + for (state, percent, label, expected) in cases { + var plane = DroneDockPlaneStatusTestData.plane(text: state, battery: percent) + plane["battery_label"] = label + planes.result = .success(try DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, expected) + } + } + + /// 无设备与尚无推荐分别展示,不能自行拿列表第一架作为推荐。 + func testEmptyPlanesAndMissingRecommendationRemainDistinct() async throws { + let planes = try DroneDockPlaneStatusTestService() + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "暂无无人机") + XCTAssertEqual(model.deviceTone, .gray) + planes.result = .success(try DroneDockPlaneStatusTestData.response(planes: [DroneDockPlaneStatusTestData.plane()], connected: true)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "状态待确认") + XCTAssertEqual(model.deviceTone, .gray) + XCTAssertEqual(model.connectionTitle, "机巢已连接") + } + + /// 状态失败立刻撤下旧的空闲和电量,但保留购买点位、航线和额度。 + func testPlaneFailureClearsOldStatusWithoutClearingProjectAndRecovers() async throws { + let plane = DroneDockPlaneStatusTestData.plane() + let value = try DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane, connected: true) + let planes = try DroneDockPlaneStatusTestService(response: value) + let project = try ImmediatePreparationService() + let model = try makeModel(service: project, planeService: planes) + await model.refresh() + await model.refreshPlaneStatus() + model.selectRoute(id: 302) + planes.result = .failure(APIError.networkFailed("测试无人机状态暂不可用")) + + await model.refreshPlaneStatus() + + XCTAssertNil(model.planeStatus) + XCTAssertEqual(model.deviceStatusText, "状态待确认") + XCTAssertEqual(model.connectionTitle, "机巢连接待确认") + XCTAssertTrue(model.planeStatusErrorMessage?.contains("测试无人机状态暂不可用") == true) + XCTAssertEqual(model.selectedRouteID, 302) + XCTAssertEqual(model.projectInfo?.order.shotRemain, 5) + XCTAssertNil(model.errorMessage) + planes.result = .success(value) + await model.refreshPlaneStatus() + XCTAssertEqual(model.deviceStatusText, "空闲 · 电量 95%") + XCTAssertNil(model.planeStatusErrorMessage) + XCTAssertEqual(project.projectRequests.count, 1) + } + + /// 购买接口失败不抹去已成功获取的无人机状态,两个接口可以独立重试。 + func testProjectFailureDoesNotClearPlaneStatus() async throws { + let plane = DroneDockPlaneStatusTestData.plane() + let planes = try DroneDockPlaneStatusTestService(response: DroneDockPlaneStatusTestData.response(planes: [plane], recommend: plane)) + let project = try ImmediatePreparationService() + let model = try makeModel(service: project, planeService: planes) + await model.refreshPlaneStatus() + project.projectResult = .failure(APIError.networkFailed("测试购买失败")) + await model.refresh() + XCTAssertNotNil(model.errorMessage) + XCTAssertEqual(model.deviceStatusText, "空闲 · 电量 95%") + XCTAssertNil(model.planeStatusErrorMessage) + XCTAssertEqual(planes.requests.count, 1) + } + + /// 即使测试替身绕过 API 校验,其他景区的无人机响应也不能填入页面。 + func testPlaneResponseFromOtherScenicIsRejected() async throws { + let planes = try DroneDockPlaneStatusTestService(response: DroneDockPlaneStatusTestData.response(scenicID: 999)) + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + await model.refreshPlaneStatus() + XCTAssertNil(model.planeStatus) + XCTAssertNotNil(model.planeStatusErrorMessage) + XCTAssertEqual(model.deviceStatusText, "状态待确认") + } + + /// 无人机请求期间不会锁住点位选择,同一时刻的重复轮询不会再发请求。 + func testPlaneRefreshDeduplicatesRequestsWithoutBlockingSelection() async throws { + let planes = SuspendedPlaneStatusService() + let started = expectation(description: "无人机读取挂起") + planes.requestStarted = { _ in started.fulfill() } + defer { planes.cancelAll() } + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + await model.refresh() + let pending = Task { await model.refreshPlaneStatus() } + await fulfillment(of: [started], timeout: 2) + XCTAssertTrue(model.isLoadingPlaneStatus) + await model.refreshPlaneStatus() + model.selectSpot(id: 202) + model.selectRoute(id: 402) + XCTAssertEqual(planes.requests, [128]) + XCTAssertEqual(model.selectedRouteID, 402) + try planes.finish(index: 0) + await pending.value + XCTAssertFalse(model.isLoadingPlaneStatus) + } + + /// 暂停无人机读取清除其快照,但不会清空购买配置或当前选择。 + func testInvalidatePlaneStatusPreservesPurchasedSnapshot() async throws { + let model = try makeModel(service: ImmediatePreparationService()) + await model.refresh() + await model.refreshPlaneStatus() + model.selectRoute(id: 302) + model.invalidatePlaneStatus() + XCTAssertNil(model.planeStatus) + XCTAssertFalse(model.isLoadingPlaneStatus) + XCTAssertNil(model.planeStatusErrorMessage) + XCTAssertEqual(model.selectedRouteID, 302) + XCTAssertNotNil(model.projectInfo) + model.invalidate() + XCTAssertNil(model.projectInfo) + XCTAssertNil(model.selectedRouteID) + } + + /// 页面取消或主动停止后,网络替身迟到返回也不能恢复旧无人机状态。 + func testPlaneCancellationAndInvalidationRejectLateResponse() async throws { + for invalidate in [false, true] { + let planes = SuspendedPlaneStatusService() + let started = expectation(description: "待取消无人机读取") + planes.requestStarted = { _ in started.fulfill() } + defer { planes.cancelAll() } + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + let pending = Task { await model.refreshPlaneStatus() } + await fulfillment(of: [started], timeout: 2) + if invalidate { model.invalidatePlaneStatus() } else { pending.cancel() } + try planes.finish(index: 0) + await pending.value + XCTAssertNil(model.planeStatus) + XCTAssertFalse(model.isLoadingPlaneStatus) + XCTAssertNil(model.planeStatusErrorMessage) + } + } + + /// 暂停后重启读取时,旧代次的响应不能盖掉新状态或结束新请求。 + func testNewPlaneRequestAfterInvalidationRejectsOlderResponse() async throws { + let planes = SuspendedPlaneStatusService() + let firstStarted = expectation(description: "旧无人机请求") + let secondStarted = expectation(description: "新无人机请求") + planes.requestStarted = { if $0 == 0 { firstStarted.fulfill() } else { secondStarted.fulfill() } } + defer { planes.cancelAll() } + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + let first = Task { await model.refreshPlaneStatus() } + await fulfillment(of: [firstStarted], timeout: 2) + model.invalidatePlaneStatus() + let second = Task { await model.refreshPlaneStatus() } + await fulfillment(of: [secondStarted], timeout: 2) + try planes.finish(index: 0) + await first.value + XCTAssertNil(model.planeStatus) + XCTAssertTrue(model.isLoadingPlaneStatus) + let busy = DroneDockPlaneStatusTestData.plane(status: 2, text: "拍摄中 · 电量 50%", battery: 50) + try planes.finish(index: 1, response: DroneDockPlaneStatusTestData.response(planes: [busy], recommend: busy)) + await second.value + XCTAssertEqual(model.deviceStatusText, "拍摄中 · 电量 50%") + XCTAssertFalse(model.isLoadingPlaneStatus) + } + + /// 登录账号、凭证、门店或景区变化时,购买和无人机状态都不能继续显示。 + func testPlaneIdentityChangesRejectInFlightResponse() async throws { + for changed in [context(userID: "other"), context(scenicID: 129), context(storeID: 38), context(token: "other-token")] { + let scope = PreparationContextBox(context()) + let planes = SuspendedPlaneStatusService() + let started = expectation(description: "无人机身份校验") + planes.requestStarted = { _ in started.fulfill() } + defer { planes.cancelAll() } + let model = try makeModel(service: ImmediatePreparationService(), scope: scope, planeService: planes) + await model.refresh() + let pending = Task { await model.refreshPlaneStatus() } + await fulfillment(of: [started], timeout: 2) + scope.value = changed + try planes.finish(index: 0) + await pending.value + XCTAssertNil(model.planeStatus) + XCTAssertNil(model.projectInfo) + XCTAssertNotNil(model.errorMessage) + XCTAssertNotNil(model.planeStatusErrorMessage) + } + } + + /// 轮询建议缺失或过小使用五秒,较长值保留但最多一分钟。 + func testPlanePollIntervalUsesSafeBounds() async throws { + let planes = try DroneDockPlaneStatusTestService() + let model = try makeModel(service: ImmediatePreparationService(), planeService: planes) + XCTAssertEqual(model.pollIntervalNanoseconds, 5_000_000_000) + for (hint, seconds) in [(nil, 5), (Optional(-1), 5), (0, 5), (1000, 5), (7000, 7), (120000, 60)] { + planes.result = .success(try DroneDockPlaneStatusTestData.response(pollHintMS: hint)) + await model.refreshPlaneStatus() + XCTAssertEqual(model.pollIntervalNanoseconds, UInt64(seconds) * 1_000_000_000) + } + } + + /// 缺少登录会话时在本地拦截无人机读取,不让后台轮询发出无身份请求。 + func testMissingSessionSkipsPlaneRequest() async throws { + let planes = try DroneDockPlaneStatusTestService() + let model = try makeModel(service: ImmediatePreparationService(), + scope: PreparationContextBox(context(token: "")), planeService: planes) + await model.refreshPlaneStatus() + XCTAssertTrue(planes.requests.isEmpty) + XCTAssertNil(model.planeStatus) + XCTAssertNotNil(model.planeStatusErrorMessage) + XCTAssertFalse(model.isLoadingPlaneStatus) + } + + /// 每例使用内存订单和会话,不接触真实账号。 + private func makeModel(service: any DroneDockPreparationServing, scope: PreparationContextBox? = nil, + projectID: Int? = 101, orderStatus: Int? = nil, planeService: (any DroneDockPlaneStatusServing)? = nil) throws -> DroneDockPreparationViewModel { + let scope = scope ?? PreparationContextBox(context()) + var order: [String: Any] = ["order_number": "TEST-PREPARATION-001", "project_name": "旧列表套餐", + "shoot_count": 9, "shot_count": 2, "remaining_count": 7] + order["project_id"] = projectID + order["order_status"] = orderStatus + let decoded = try JSONDecoder().decode(DroneDockHomeOrder.self, from: JSONSerialization.data(withJSONObject: order)) + return DroneDockPreparationViewModel(context: scope.value, order: decoded, service: service, + planeStatusService: try planeService ?? DroneDockPlaneStatusTestService(), + taskCreationService: DroneDockTaskCreationTestService(), + shootService: DroneDockShootTestService(), + currentContext: { scope.value }) + } + + /// 身份参数仅在本例测试对象中变化。 + private func context(userID: String = "preparation-test-user", scenicID: Int = 128, storeID: Int = 37, + token: String = "preparation-test-token") -> DroneDockHomeContext { + DroneDockHomeContext(userID: userID, accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: storeID, photographerName: "测试人员", token: token) + } +} + +/// 购买数据使用不同于首页的名称与额度,以检测旧快照回填。 +private enum PreparationFixture { + /// 购买快照使用五次额度,刻意与首页旧数据不同。 + static func project(spots: [[String: Any]]? = nil, projectID: Int = 101, + number: String = "TEST-PREPARATION-001", remaining: Int? = 5, + canCreate: Bool = true, orderStatus: Int? = nil, materialStatus: Int? = nil, + activeTaskStatus: Int? = nil) throws -> DroneDockProjectInfoResponse { + var value: [String: Any] = ["order_number": number, "project_id": projectID, "project_name": "已购五次套餐", + "shoot_count": 5, "shot_count": 0, "can_create_task": canCreate, + "spot": spots ?? [point(201), point(202, routes: [401, 402])]] + value["remaining_count"] = remaining + value["order_status"] = orderStatus + value["material_status"] = materialStatus + value["active_task_status"] = activeTaskStatus + if activeTaskStatus != nil { value["active_task_id"] = 21 } + return try JSONDecoder().decode(DroneDockProjectInfoResponse.self, from: JSONSerialization.data(withJSONObject: value)) + } + + /// 已购点位和航线具备明确可用性。 + static func point(_ id: Int, routes: [Int] = [301, 302]) -> [String: Any] { + ["scenic_spot_id": id, "scenic_spot_name": "已购点位 \(id)", "available": true, + "air_lines": routes.map { id -> [String: Any] in + ["air_line_id": id, "air_line_name": "已购航线 \(id)", "available": true, "samples": []] + }] + } + +} + +/// 主线程上的可变会话替身。 +@MainActor +private final class PreparationContextBox { + var value: DroneDockHomeContext + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 单一购买配置读取服务,记录当前请求身份。 +@MainActor +private final class ImmediatePreparationService: DroneDockPreparationServing { + var projectResult: Result + private(set) var projectRequests: [(scenicID: Int, projectID: Int, orderNumber: String)] = [] + + /// 使用匿名购买快照作为默认结果。 + init() throws { projectResult = .success(try PreparationFixture.project()) } + + /// 记录唯一的数据读取请求,不提供设备或飞行控制入口。 + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse { + projectRequests.append((scenicID, projectID, orderNumber)) + return try projectResult.get() + } +} + +/// 由测试明确完成单个购买请求,精确控制乱序与取消。 +@MainActor +private final class SuspendedPreparationService: DroneDockPreparationServing { + var requestStarted: ((Int) -> Void)? + private var projects: [CheckedContinuation?] = [] + + /// 挂起购买读取,允许测试更改身份或发出后续刷新。 + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse { + try await withCheckedThrowingContinuation { continuation in + projects.append(continuation) + requestStarted?(projects.count - 1) + } + } + + /// 只完成指定请求,保留其他尚未返回的请求。 + func finish(index: Int, project: DroneDockProjectInfoResponse? = nil) throws { + let value = try project ?? PreparationFixture.project() + let continuation = projects[index] + projects[index] = nil + continuation?.resume(returning: value) + } + + /// 失败退出时释放全部 continuation,避免污染其他测试。 + func cancelAll() { + projects.forEach { $0?.resume(throwing: CancellationError()) } + projects = [] + } +} + +/// 精确控制无人机状态完成次序,验证轮询取消、重入和身份变化。 +@MainActor +private final class SuspendedPlaneStatusService: DroneDockPlaneStatusServing { + var requestStarted: ((Int) -> Void)? + private(set) var requests: [Int] = [] + private var pending: [CheckedContinuation?] = [] + + /// 挂起每个读取,测试负责明确返回或取消。 + func planeStatus(scenicID: Int) async throws -> DroneDockPlaneStatusResponse { + requests.append(scenicID) + return try await withCheckedThrowingContinuation { continuation in + pending.append(continuation) + requestStarted?(pending.count - 1) + } + } + + /// 默认返回测试空态,也可指定不同工作状态核对乱序。 + func finish(index: Int, response: DroneDockPlaneStatusResponse? = nil) throws { + let result = try response ?? DroneDockPlaneStatusTestData.response() + let continuation = pending[index] + pending[index] = nil + continuation?.resume(returning: result) + } + + /// 测试退出时恢复全部等待者,防止 continuation 泄漏。 + func cancelAll() { + pending.forEach { $0?.resume(throwing: CancellationError()) } + pending = [] + } +} diff --git a/suixinkanTests/DroneDockPreparationViewTests.swift b/suixinkanTests/DroneDockPreparationViewTests.swift new file mode 100644 index 0000000..834e40b --- /dev/null +++ b/suixinkanTests/DroneDockPreparationViewTests.swift @@ -0,0 +1,909 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证准备页购买快照、独立设备状态、点位航线选择与错误恢复。 +@MainActor +final class DroneDockPreparationViewTests: XCTestCase { + /// 点位列表超出页面时将所选中间卡片居中,单点位则保留原位置。 + func testPointSelectionCentersOnlyWhenHorizontalContentOverflows() async throws { + for count in [1, 4] { + let spots = (1...count).map { index in + var point = DroneDockPreparationViewFixtures.purchasedSpots()[0] + point["scenic_spot_id"] = 100 + index + point["scenic_spot_name"] = "测试点位\(index)" + return point + } + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [DroneDockPreparationViewFixtures.projectEnvelope(spots: spots)]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.spots.count == count } + let list = try collection(in: controller) + let path = IndexPath(item: count == 1 ? 0 : 1, section: 1) + let originalOffset = list.contentOffset + try select(path, in: list) + try await settle(window) { + guard let cell = list.cellForItem(at: path) else { return false } + let frame = cell.convert(cell.bounds, to: list) + return abs(frame.midX - (count == 1 ? 116 : list.bounds.midX)) < 2 + } + XCTAssertEqual(list.contentOffset.y, originalOffset.y, accuracy: 1) + XCTAssertEqual(controller.viewModel.selectedSpotID, count == 1 ? 101 : 102) + capture(window, name: count == 1 ? "准备页-单点位保持位置" : "准备页-选中点位居中") + } + } + /// 长点位名称完整换行,卡片与航线标题均按实际文本增高。 + func testLongPointNameFitsCardAndRouteHeading() async throws { + let name = "测试景区东南观景平台通往山顶步道的全景航拍打卡点" + var spots = DroneDockPreparationViewFixtures.purchasedSpots() + spots[0]["scenic_spot_name"] = name + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [DroneDockPreparationViewFixtures.projectEnvelope(spots: spots)]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.selectedSpot?.name == name } + let list = try collection(in: controller) + let cell = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 0, section: 1))) + let label = try XCTUnwrap(find(in: cell, id: "drone.preparation.point.name") as? UILabel) + XCTAssertEqual(label.text, name) + XCTAssertEqual(label.numberOfLines, 0) + XCTAssertGreaterThan(cell.bounds.height, 64) + XCTAssertGreaterThanOrEqual(label.bounds.height + 1, + label.sizeThatFits(CGSize(width: label.bounds.width, height: .greatestFiniteMagnitude)).height) + let header = try XCTUnwrap(list.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, + at: IndexPath(item: 0, section: 2))) + let title = try XCTUnwrap(find(in: header, id: "drone.preparation.heading.title") as? UILabel) + XCTAssertEqual(title.text, name + "的航线") + XCTAssertEqual(title.numberOfLines, 0) + XCTAssertGreaterThanOrEqual(title.bounds.height + 1, + title.sizeThatFits(CGSize(width: title.bounds.width, height: .greatestFiniteMagnitude)).height) + XCTAssertLessThanOrEqual(title.convert(title.bounds, to: header).maxX, header.bounds.maxX + 1) + capture(window, name: "准备页-长打卡点名称完整换行") + } + + /// 创建未报备时明确弹窗,保留选择且不会继续召唤。 + func testFilingFailureShowsAlertWithoutSummoning() async throws { + let creation = DroneDockTaskCreationTestService(result: .failure(APIError.serverCode(100099, "当前航线未报备"))) + let shoot = DroneDockShootTestService(result: .success(try DroneDockShootTestData.response())) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { controller.dismiss(animated: false); close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController is UIAlertController } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "请先完成飞行报备") + XCTAssertTrue(alert.message?.contains("确认生效后再重试") == true) + XCTAssertEqual(controller.viewModel.selectedSpotID, 101) + XCTAssertEqual(controller.viewModel.selectedRouteID, 201) + XCTAssertTrue(shoot.requests.isEmpty) + XCTAssertEqual(creation.requests.count, 1) + capture(window, name: "准备页-未报备提示-本地模拟") + } + + /// 按用户真实回执模拟未报备:召唤弹窗要求当日报备截图,留在准备页且保留已创建任务。 + func testSummonFilingRejectionShowsScreenshotGuidanceWithoutNavigation() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let message = "该无人机今日未完成起飞报备,请先提交报备截图" + let shoot = DroneDockShootTestService(result: .failure(APIError.serverCode(41901, message))) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { controller.dismiss(animated: false); close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController is UIAlertController } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "请先完成飞行报备") + XCTAssertTrue(alert.message?.contains(message) == true) + XCTAssertTrue(alert.message?.contains("今日的起飞报备并提交报备截图") == true) + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(controller.viewModel.createdTask?.taskID, 501) + XCTAssertEqual(controller.viewModel.selectedSpotID, 101) + XCTAssertEqual(controller.viewModel.selectedRouteID, 201) + XCTAssertEqual(primary.title(for: .normal), "重试召唤") + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + capture(window, name: "准备页-shoot41901当日起飞未报备-本地模拟") + } + + /// 创建成功不显示 data;已结束任务的召唤失败仅提供显式查看,不自动跳转或再次 POST。 + func testEndedTaskShowsFailureWithoutSuccessJSONAndOpensOnlyOnTap() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .failure(APIError.serverCode(100099, + "任务已结束,无法召唤;失败后请传 restart=true 重新召唤"))) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.summonRequiresTaskReview && primary.isEnabled } + XCTAssertTrue(controller.navigationController?.topViewController === controller) + XCTAssertEqual(primary.title(for: .normal), "查看拍摄任务") + let list = try collection(in: controller) + XCTAssertEqual(list.numberOfItems(inSection: 4), 0, "创建成功不再增加回执区") + XCTAssertNil(find(in: controller.view, id: "drone.preparation.creationResponse")) + XCTAssertFalse(visibleTexts(in: controller.view).contains { $0.contains("task_id") || $0.contains("restart=true") }) + XCTAssertEqual(controller.viewModel.summonFailure?.requiresFiling, false) + capture(window, name: "准备页-任务已结束提示-本地模拟") + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.topViewController is DroneDockPreparationTaskDestinationStub } + XCTAssertEqual((controller.navigationController?.topViewController as? DroneDockPreparationTaskDestinationStub)?.taskID, 501) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + } + private weak var previousKeyWindow: UIWindow? + + /// 有效购买配置直接提供真实操作入口,但页面出现不自动创建或召唤。 + func testEligiblePreparationEnablesSubmissionWithoutAutomaticWrites() async throws { + let creation = DroneDockTaskCreationTestService() + let shoot = DroneDockShootTestService() + let (controller, session) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.projectInfo != nil } + XCTAssertTrue(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + XCTAssertTrue(controller.viewModel.isPrimaryActionEnabled) + XCTAssertNil(controller.viewModel.createdTask) + XCTAssertNil(controller.viewModel.shootResponse) + XCTAssertTrue(creation.requests.isEmpty) + XCTAssertTrue(shoot.requests.isEmpty) + assertOnlyPreparationReads(session) + } + + /// 页面出现只读取;有效购买配置开放召唤,Debug 独立模拟入口不影响正常操作。 + func testProjectSnapshotDisplaysOrderPointsRoutesAfterPageAppears() async throws { + let (controller, session) = try makeController(responses: [DroneDockPreparationViewFixtures.projectEnvelope()]) + XCTAssertTrue(session.requests.isEmpty, "准备页尚未显示时不预先请求或创建任务") + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.projectInfo != nil && list.numberOfItems(inSection: 2) == 2 } + + let texts = visibleTexts(in: controller.view) + XCTAssertEqual(controller.title, "拍摄准备") + XCTAssertTrue(texts.contains("游客 130****0001")) + XCTAssertTrue(texts.contains("测试套餐 · 含 1 次拍摄")) + XCTAssertTrue(texts.contains("已拍摄 0 次")) + XCTAssertTrue(texts.contains("剩余 1 次")) + XCTAssertTrue(texts.contains("测试点一")) + XCTAssertTrue(texts.contains("测试航线甲")) + XCTAssertFalse(texts.contains("距离待确认")) + XCTAssertTrue(texts.contains("机巢连接待确认")) + XCTAssertFalse(texts.contains("位置待确认")) + XCTAssertFalse(texts.contains("机巢未连接")) + XCTAssertFalse(texts.contains("在拍摄范围内")) + XCTAssertTrue(texts.contains("点击后创建任务并召唤无人机")) + XCTAssertEqual(list.numberOfItems(inSection: 1), 2) + #if DEBUG + XCTAssertEqual(controller.navigationItem.rightBarButtonItem?.accessibilityIdentifier, + "drone.preparation.mock.entry", "Debug 独立模拟入口不替代正常召唤按钮") + #else + XCTAssertNil(controller.navigationItem.rightBarButtonItem, "Release 不展示独立模拟入口") + #endif + let summon = try button(in: controller.view, id: "drone.preparation.summon") + XCTAssertTrue(summon.isEnabled) + XCTAssertEqual(summon.title(for: .normal), "确认并召唤") + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + XCTAssertNil(controller.presentedViewController) + XCTAssertEqual(session.requests.count, 1) + assertOnlyPreparationReads(session) + assertUnambiguousLayout(in: controller.view) + capture(window, name: "真实准备页-购买快照与点位航线") + } + + /// 点击点位切换航线和标题,选择航线只更新本地状态且不沿用其他点位的航线。 + func testSelectingPointReplacesRoutesAndKeepsSingleSelection() async throws { + let (controller, session) = try makeController(responses: [DroneDockPreparationViewFixtures.projectEnvelope()]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.selectedRouteID == 201 && list.numberOfItems(inSection: 2) == 2 } + + try select(IndexPath(item: 1, section: 2), in: list) + try await settle(window) { controller.viewModel.selectedRouteID == 202 } + let selectedRoute = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 1, section: 2))) + XCTAssertTrue(selectedRoute.accessibilityTraits.contains(.selected)) + + try select(IndexPath(item: 1, section: 1), in: list) + try await settle(window) { + controller.viewModel.selectedSpotID == 102 && list.numberOfItems(inSection: 2) == 1 + && self.visibleTexts(in: controller.view).contains("测试点二的航线") + } + + XCTAssertEqual(controller.viewModel.selectedRouteID, 301) + let route = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 0, section: 2))) + XCTAssertEqual(route.accessibilityIdentifier, "drone.preparation.route.301") + XCTAssertTrue(route.accessibilityTraits.contains(.selected)) + XCTAssertTrue(visibleTexts(in: route).contains("测试航线丙")) + XCTAssertFalse(visibleTexts(in: route).contains("测试航线乙")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("测试点二 · 测试航线丙")) + XCTAssertEqual(session.requests.count, 1) + assertOnlyPreparationReads(session) + } + + /// 项目接口失败会移除旧购买配置,不把加载失败当作空套餐或沿用旧额度。 + func testRefreshFailureClearsOldOptionsAndRetryRestoresThem() async throws { + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let failure = try TestJSON.errorEnvelope(code: 160001, msg: "测试准备信息暂不可用") + let (controller, session) = try makeController(responses: [project, failure, project]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.projectInfo != nil && list.numberOfItems(inSection: 1) == 2 } + + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { self.visibleTexts(in: controller.view).contains("准备信息加载失败") } + XCTAssertNil(controller.viewModel.projectInfo) + XCTAssertEqual(list.numberOfItems(inSection: 1), 0) + XCTAssertEqual(list.numberOfItems(inSection: 2), 0) + XCTAssertFalse(visibleTexts(in: controller.view).contains("暂无可用拍摄点")) + XCTAssertFalse(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + let failedSummary = try XCTUnwrap(find(in: controller.view, id: "drone.preparation.order")) + XCTAssertTrue(visibleTexts(in: failedSummary).contains("已拍摄 — 次")) + XCTAssertTrue(visibleTexts(in: failedSummary).contains("剩余 — 次")) + XCTAssertFalse(visibleTexts(in: failedSummary).contains("已拍摄 0 次")) + XCTAssertFalse(visibleTexts(in: failedSummary).contains("剩余 1 次")) + + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.projectInfo != nil && list.numberOfItems(inSection: 1) == 2 } + XCTAssertNil(controller.viewModel.errorMessage) + XCTAssertFalse(visibleTexts(in: controller.view).contains("准备信息加载失败")) + XCTAssertEqual(session.requests.count, 3) + assertOnlyPreparationReads(session) + } + + /// 购买快照没有点位和已选点位没有航线使用不同空态,刷新不残留旧配置。 + func testEmptyPointsAndEmptyRoutesHaveDistinctMessages() async throws { + var pointWithoutRoutes = DroneDockPreparationViewFixtures.purchasedSpots()[0] + pointWithoutRoutes["air_lines"] = [] + let (controller, session) = try makeController(responses: [ + DroneDockPreparationViewFixtures.projectEnvelope(spots: []), + DroneDockPreparationViewFixtures.projectEnvelope(spots: [pointWithoutRoutes]) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { self.visibleTexts(in: controller.view).contains("暂无可用拍摄点") } + XCTAssertNil(controller.viewModel.selectedSpotID) + XCTAssertNil(controller.viewModel.selectedRouteID) + XCTAssertEqual(list.numberOfItems(inSection: 2), 0) + + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { self.visibleTexts(in: controller.view).contains("暂无可用航线") } + XCTAssertEqual(controller.viewModel.selectedSpotID, 101) + XCTAssertNil(controller.viewModel.selectedRouteID) + XCTAssertFalse(visibleTexts(in: controller.view).contains("暂无可用拍摄点")) + XCTAssertFalse(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + XCTAssertEqual(session.requests.count, 2) + assertOnlyPreparationReads(session) + } + + /// 项目摘要缺少或返回 null 次数时显示未知,不用首页旧次数填充。 + func testMissingProjectCountsDoNotReuseHomeCounts() async throws { + for counts in [[:], ["shoot_count": NSNull(), "shot_count": NSNull(), "remaining_count": NSNull()]] as [[String: Any]] { + let project = try DroneDockPreparationViewFixtures.projectEnvelope(summary: counts.merging(["project_name": "待核对套餐"]) { _, new in new }) + let (controller, session) = try makeController(responses: [project]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.projectInfo != nil && self.visibleTexts(in: controller.view).contains("已拍摄 — 次") } + let summary = try XCTUnwrap(find(in: controller.view, id: "drone.preparation.order")) + XCTAssertTrue(visibleTexts(in: summary).contains("剩余 — 次")) + XCTAssertFalse(visibleTexts(in: summary).contains("已拍摄 0 次")) + XCTAssertFalse(visibleTexts(in: summary).contains("剩余 1 次")) + assertOnlyPreparationReads(session) + } + } + + /// 已购名称、航线和次数只来自 project-info,首页摘要不能覆盖最新购买快照。 + func testProjectInfoOwnsNamesRoutesAndQuota() async throws { + var point = DroneDockPreparationViewFixtures.purchasedSpots()[0] + point["scenic_spot_name"] = "已购测试点" + point["air_lines"] = [["air_line_id": 202, "air_line_name": "已购唯一航线", "available": true, "samples": []]] + let project = try DroneDockPreparationViewFixtures.projectEnvelope(spots: [point], summary: [ + "project_name": "已购三次套餐", "shoot_count": 3, "shot_count": 1, "remaining_count": 2, + "user_phone": "130****0002", "can_create_task": true + ]) + let (controller, session) = try makeController(responses: [project]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.projectInfo != nil && !controller.viewModel.isLoading } + XCTAssertEqual(list.numberOfItems(inSection: 1), 1) + XCTAssertEqual(list.numberOfItems(inSection: 2), 1) + XCTAssertEqual(controller.viewModel.selectedRouteID, 202) + let texts = visibleTexts(in: controller.view) + XCTAssertTrue(texts.contains("已购三次套餐")) + XCTAssertTrue(texts.contains("已拍摄 1 次")) + XCTAssertTrue(texts.contains("剩余 2 次")) + XCTAssertTrue(texts.contains("已购测试点")) + XCTAssertTrue(texts.contains("已购唯一航线")) + XCTAssertFalse(texts.contains("测试套餐 · 含 1 次拍摄")) + XCTAssertFalse(texts.contains("测试点二")) + XCTAssertFalse(texts.contains("测试航线甲")) + assertOnlyPreparationReads(session) + } + + /// 不可用点位和航线仍可查看原因,但不得被选择或恢复为默认选中项。 + func testUnavailablePurchasedOptionsCannotBeSelected() async throws { + var points = DroneDockPreparationViewFixtures.purchasedSpots() + var routes = try XCTUnwrap(points[0]["air_lines"] as? [[String: Any]]) + routes[0]["available"] = false + routes[0]["unavailable_reason"] = "航线暂停使用" + points[0]["air_lines"] = routes + points[1]["available"] = false + let project = try DroneDockPreparationViewFixtures.projectEnvelope(spots: points) + let (controller, session) = try makeController(responses: [project]) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.selectedRouteID == 202 && !controller.viewModel.isLoading } + XCTAssertEqual(controller.viewModel.selectedSpotID, 101) + XCTAssertFalse(list.delegate?.collectionView?(list, shouldSelectItemAt: IndexPath(item: 0, section: 2)) ?? true) + XCTAssertFalse(list.delegate?.collectionView?(list, shouldSelectItemAt: IndexPath(item: 1, section: 1)) ?? true) + list.delegate?.collectionView?(list, didSelectItemAt: IndexPath(item: 0, section: 2)) + list.delegate?.collectionView?(list, didSelectItemAt: IndexPath(item: 1, section: 1)) + XCTAssertEqual(controller.viewModel.selectedRouteID, 202) + XCTAssertEqual(controller.viewModel.selectedSpotID, 101) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("航线暂停使用") }) + XCTAssertTrue(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + assertOnlyPreparationReads(session) + } + + /// 底栏从朱工接口展示推荐状态和连接状态,创建待飞任务按购买配置开放。 + func testPlaneStatusAPIUpdatesFooterIndependently() async throws { + let plane = DroneDockPlaneStatusTestData.plane() + let payload = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": [ + "scenic_id": 128, "planes": [plane], "recommend": plane, "connected": true, "poll_hint_ms": 5000 + ]]) + let planeSession = MockURLSession(responses: [payload]) + let planeAPI = DroneDockPlaneStatusAPI(client: APIClient(environment: .testing, session: planeSession)) + let (controller, projectSession) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + planeService: planeAPI) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { self.visibleTexts(in: controller.view).contains("空闲 · 电量 95%") } + XCTAssertTrue(visibleTexts(in: controller.view).contains("机巢已连接")) + XCTAssertEqual(planeSession.requests.count, 1) + XCTAssertEqual(planeSession.requests.first?.url?.path, "/api/app/airport/plane-status") + XCTAssertEqual(projectSession.requests.count, 1) + XCTAssertTrue(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + assertUnambiguousLayout(in: controller.view) + capture(window, name: "准备页-无人机状态与电量") + } + + /// 轮询只更新设备底栏,前后台切换和离开页面均停止,并保留购买配置选择。 + func testPlanePollingStopsOutsideForegroundAndPreservesSelection() async throws { + let idle = DroneDockPlaneStatusTestData.plane() + let service = try DroneDockPlaneStatusTestService(response: DroneDockPlaneStatusTestData.response( + planes: [idle], recommend: idle, connected: true)) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, projectSession) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], planeService: service, + pollDelay: { _ in try await Task.sleep(nanoseconds: 40_000_000) }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { service.requests.count >= 2 && controller.viewModel.selectedSpotID == 101 } + try select(IndexPath(item: 1, section: 1), in: list) + let shooting = DroneDockPlaneStatusTestData.plane(status: 2, text: "拍摄中 · 电量 72%", battery: 72) + service.result = .success(try DroneDockPlaneStatusTestData.response(planes: [shooting], recommend: shooting, connected: true)) + try await settle(window) { self.visibleTexts(in: controller.view).contains("拍摄中 · 电量 72%") } + XCTAssertEqual(controller.viewModel.selectedSpotID, 102) + XCTAssertEqual(controller.viewModel.selectedRouteID, 301) + XCTAssertEqual(projectSession.requests.count, 1) + + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + let pausedCount = service.requests.count + try await Task.sleep(nanoseconds: 150_000_000) + XCTAssertEqual(service.requests.count, pausedCount) + XCTAssertNil(controller.viewModel.planeStatus) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { service.requests.count > pausedCount && controller.viewModel.planeStatus != nil } + XCTAssertEqual(controller.viewModel.selectedSpotID, 102) + XCTAssertEqual(projectSession.requests.count, 1) + + let navigation = try XCTUnwrap(controller.navigationController) + navigation.pushViewController(UIViewController(), animated: false) + // UIKit 的 appearance 回调可能晚于 push 返回,先确认页面已实际离开。 + try await settle(window) { controller.viewModel.projectInfo == nil } + let departedCount = service.requests.count + try await Task.sleep(nanoseconds: 150_000_000) + XCTAssertEqual(service.requests.count, departedCount) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 100_000_000) + XCTAssertEqual(service.requests.count, departedCount) + navigation.popViewController(animated: false) + try await settle(window) { service.requests.count > departedCount && controller.viewModel.projectInfo != nil } + XCTAssertEqual(projectSession.requests.count, 2) + } + + /// 轮询发现会话变化时,旧点位与航线同步从页面撤下,不能只更新底栏。 + func testPollingScopeChangeRemovesOldPurchaseCards() async throws { + let context = DroneDockPreparationViewFixtures.context() + let scope = PreparationViewContextBox(context) + let idle = DroneDockPlaneStatusTestData.plane() + let service = try DroneDockPlaneStatusTestService(response: DroneDockPlaneStatusTestData.response( + planes: [idle], recommend: idle, connected: true)) + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: context, order: DroneDockPreparationViewFixtures.order(), planeService: service, + pollDelay: { _ in try await Task.sleep(nanoseconds: 40_000_000) }, currentContext: { scope.value }) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + try await settle(window) { controller.viewModel.projectInfo != nil && controller.viewModel.planeStatus != nil } + scope.value = DroneDockHomeContext(userID: context.userID, accountType: context.accountType, + scenicID: 129, scenicName: "另一测试景区", storeID: context.storeID, + photographerName: context.photographerName, token: "preparation-test-token") + try await settle(window) { self.visibleTexts(in: controller.view).contains("准备信息加载失败") } + XCTAssertNil(controller.viewModel.projectInfo) + XCTAssertNil(controller.viewModel.planeStatus) + XCTAssertEqual(list.numberOfItems(inSection: 1), 0) + XCTAssertEqual(list.numberOfItems(inSection: 2), 0) + XCTAssertFalse(visibleTexts(in: controller.view).contains("测试航线甲")) + XCTAssertFalse(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + } + + /// 设备读取失败不清空点位和航线,手动刷新可从未知状态恢复到离线状态。 + func testPlaneFailureKeepsProjectAndRefreshRecovers() async throws { + let service = try DroneDockPlaneStatusTestService() + service.result = .failure(APIError.networkFailed("测试设备状态暂不可用")) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, projectSession) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], planeService: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.projectInfo != nil && controller.viewModel.planeStatusErrorMessage != nil } + XCTAssertTrue(visibleTexts(in: controller.view).contains("状态待确认")) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("测试设备状态暂不可用") }) + XCTAssertTrue(visibleTexts(in: controller.view).contains("测试航线甲")) + let offline = DroneDockPlaneStatusTestData.plane(status: 0, text: "离线 · 电量未知", battery: nil) + service.result = .success(try DroneDockPlaneStatusTestData.response(planes: [offline], recommend: offline, connected: false)) + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { self.visibleTexts(in: controller.view).contains("离线 · 电量未知") } + XCTAssertTrue(visibleTexts(in: controller.view).contains("机巢未连接")) + XCTAssertNil(controller.viewModel.planeStatusErrorMessage) + XCTAssertEqual(projectSession.requests.count, 2) + XCTAssertEqual(service.requests.count, 2) + XCTAssertTrue(try button(in: controller.view, id: "drone.preparation.summon").isEnabled) + } + + /// 连续点击只创建和召唤一次,成功后导航;返回准备页可查看原任务而不再次 POST。 + func testCreateAndShootSuccessOpensSameTaskOnlyOnce() async throws { + let receipt = try DroneDockTaskCreationTestData.response(remaining: 1) + let data = try JSONSerialization.jsonObject(with: Data(receipt.dataJSON.utf8)) + let envelope = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": data]) + let creationSession = MockURLSession(responses: [envelope]) + let api = DroneDockTaskCreationAPI(client: APIClient(environment: .testing, session: creationSession)) + let shootEnvelope = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": ["test_ack": true]]) + let shootSession = MockURLSession(responses: [shootEnvelope]) + let shootAPI = DroneDockShootAPI(client: APIClient(environment: .testing, session: shootSession)) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, projectSession) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project, project], creationService: api, shootService: shootAPI) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller) + let summon = try button(in: controller.view, id: "drone.preparation.summon") + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window) { summon.isEnabled } + try select(IndexPath(item: 1, section: 2), in: list) + summon.sendActions(for: .touchUpInside) + summon.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneDockPreparationTaskDestinationStub } + let destination = try XCTUnwrap(navigation.topViewController as? DroneDockPreparationTaskDestinationStub) + XCTAssertEqual(destination.taskID, 501) + XCTAssertEqual(navigation.viewControllers.count, 2) + XCTAssertNil(controller.presentedViewController) + XCTAssertEqual(shootSession.requests.count, 1) + let shoot = try XCTUnwrap(shootSession.requests.first) + XCTAssertEqual(shoot.httpMethod, "POST") + XCTAssertEqual(shoot.url?.path, "/api/app/airport/shoot") + let shootBody = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(shoot.httpBody)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: shootBody).isEqual(to: ["id": 501, "restart": false])) + XCTAssertNil(shootBody["plane_id"]) + XCTAssertEqual(creationSession.requests.count, 1) + let request = try XCTUnwrap(creationSession.requests.first) + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: body).isEqual(to: [ + "scenic_id": 128, "order_number": "TEST-PREPARATION-001", "scenic_spot_id": 101, "air_line_id": 202 + ])) + XCTAssertEqual(projectSession.requests.count, 2) + navigation.popViewController(animated: false) + try await settle(window) { navigation.topViewController === controller && projectSession.requests.count == 3 && summon.isEnabled } + XCTAssertEqual(list.numberOfItems(inSection: 4), 0) + XCTAssertEqual(list.numberOfItems(inSection: 5), 0) + XCTAssertNil(find(in: controller.view, id: "drone.preparation.creationResponse")) + XCTAssertNil(find(in: controller.view, id: "drone.preparation.shootResponse")) + XCTAssertEqual(summon.title(for: .normal), "查看拍摄任务") + XCTAssertEqual(navigation.viewControllers.count, 1, "返回不会自动再次跳转") + summon.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneDockPreparationTaskDestinationStub } + XCTAssertEqual((navigation.topViewController as? DroneDockPreparationTaskDestinationStub)?.taskID, 501) + XCTAssertEqual(creationSession.requests.count, 1) + XCTAssertEqual(shootSession.requests.count, 1) + assertOnlyPreparationReads(projectSession) + } + + /// 完整导航后才 GET 同一任务,读取失败与重试不会触发第二次创建或召唤。 + func testSummonNavigationReadsSameTaskAndRetriesOnlyShooting() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .success(DroneDockShootResponse(dataJSON: nil))) + var payload = DroneDockShootingTaskTestData.payload() + payload["order_flight_task"] = ["id": 501, "order_number": "TEST-PREPARATION-001", "scenic_id": 128] + payload["header"] = ["order_number": "TEST-PREPARATION-001", "title": "创建后读取的任务"] + let success = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": payload]) + let readSession = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 100099, msg: "测试任务暂不可读"), success]) + let readAPI = DroneDockShootingAPI(client: APIClient(environment: .testing, session: readSession)) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot, + taskControllerFactory: { id, order, context in + XCTAssertEqual(id, 501) + XCTAssertEqual(shoot.requests, [501], "必须先确认召唤成功,再构造任务页") + XCTAssertTrue(readSession.requests.isEmpty) + let destination = DroneDockShootingTaskViewController(viewModel: DroneDockShootingTaskViewModel( + context: context, taskID: id, order: order, service: readAPI, currentContext: { context })) + destination.loadViewIfNeeded() + XCTAssertTrue(readSession.requests.isEmpty, "构造和加载视图不得提前读取任务") + return destination + }) + let window = makeWindow(root: controller) + defer { close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + XCTAssertTrue(readSession.requests.isEmpty) + primary.sendActions(for: .touchUpInside) + try await settle(window) { + (controller.navigationController?.topViewController as? DroneDockShootingTaskViewController)?.viewModel.errorMessage != nil + } + let destination = try XCTUnwrap(controller.navigationController?.topViewController as? DroneDockShootingTaskViewController) + XCTAssertEqual(destination.viewModel.taskID, 501) + try button(in: destination.view, id: "drone.task.remote.refresh").sendActions(for: .touchUpInside) + try await settle(window) { destination.viewModel.response != nil } + XCTAssertEqual(destination.viewModel.title, "创建后读取的任务") + XCTAssertEqual(readSession.requests.count, 2) + for request in readSession.requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/shooting") + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(Dictionary(uniqueKeysWithValues: query.map { ($0.name, $0.value ?? "") }), ["id": "501", "live_battery": "0"]) + XCTAssertNil(request.httpBody) + } + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(shoot.requests, [501]) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 2) + capture(window, name: "召唤成功后-同任务读取与失败重试") + } + + /// 明确业务失败展示后端提示并允许再次点击,界面不离开准备页。 + func testCreationBusinessFailureIsShownAndAllowsExplicitRetry() async throws { + let creation = DroneDockTaskCreationTestService(result: .failure(APIError.serverCode(160001, "测试航线暂不可用"))) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project, project], creationService: creation) + let window = makeWindow(root: controller) + defer { close(window) } + let summon = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { summon.isEnabled } + summon.sendActions(for: .touchUpInside) + try await settle(window) { self.visibleTexts(in: controller.view).contains("任务创建失败") && summon.isEnabled } + let response = try XCTUnwrap(find(in: controller.view, id: "drone.preparation.creationResponse") as? UILabel) + XCTAssertEqual(response.text, "测试航线暂不可用") + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + creation.result = .success(try DroneDockTaskCreationTestData.response()) + summon.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.createdTask?.taskID == 501 && summon.isEnabled } + XCTAssertEqual(summon.title(for: .normal), "重试召唤") + XCTAssertEqual(creation.requests.count, 2) + XCTAssertNil(controller.presentedViewController) + } + + /// 明确业务拒绝可对原任务重试召唤,不重新创建;购买刷新失败不能隐藏回执。 + func testShootBusinessRejectionRetriesSameTaskWithoutCreatingAgain() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .failure(APIError.serverCode(100099, "测试无人机忙碌"))) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let projectFailure = try TestJSON.errorEnvelope(code: 160001, msg: "测试购买信息暂不可读") + let (controller, projects) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project, projectFailure], creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.shootErrorMessage != nil && primary.isEnabled } + XCTAssertEqual(primary.title(for: .normal), "重试召唤") + XCTAssertEqual(controller.viewModel.createdTask?.taskID, 501) + let failedText = try XCTUnwrap(find(in: controller.view, id: "drone.preparation.shootResponse") as? UILabel) + XCTAssertEqual(failedText.text, "测试无人机忙碌") + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.errorMessage != nil && primary.isEnabled } + shoot.result = .success(try DroneDockShootTestData.response()) + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.topViewController is DroneDockPreparationTaskDestinationStub } + XCTAssertEqual((controller.navigationController?.topViewController as? DroneDockPreparationTaskDestinationStub)?.taskID, 501) + XCTAssertEqual(shoot.requests, [501, 501]) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertEqual(projects.requests.count, 3) + XCTAssertNotNil(controller.viewModel.shootResponse) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 2) + XCTAssertNil(controller.presentedViewController) + XCTAssertFalse(visibleTexts(in: controller.view).contains("无人机已到达")) + } + + /// 接口业务成功但没有 data 时仍携创建所得 ID 导航,不依赖未约定的成功字段。 + func testEmptyShootSuccessStillOpensCreatedTask() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .success(DroneDockShootResponse(dataJSON: nil))) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, _) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project], creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.topViewController is DroneDockPreparationTaskDestinationStub } + XCTAssertEqual((controller.navigationController?.topViewController as? DroneDockPreparationTaskDestinationStub)?.taskID, 501) + XCTAssertNotNil(controller.viewModel.shootResponse) + XCTAssertNil(controller.viewModel.shootDataJSON) + XCTAssertFalse(controller.viewModel.summonOutcomeUnknown) + XCTAssertEqual(shoot.requests, [501]) + } + + /// 召唤请求超时后不能直接重发,保留任务并提示核对结果。 + func testUnknownShootResultLocksRetryEvenAfterRefresh() async throws { + let creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + let shoot = DroneDockShootTestService(result: .failure(APIError.networkFailed("测试召唤超时"))) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, projects) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project, project], creationService: creation, shootService: shoot) + let window = makeWindow(root: controller) + defer { close(window) } + let primary = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { primary.isEnabled } + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.summonOutcomeUnknown && !primary.isEnabled } + XCTAssertEqual(primary.title(for: .normal), "召唤结果待核对") + XCTAssertEqual(controller.viewModel.createdTask?.taskID, 501) + XCTAssertNotNil(find(in: controller.view, id: "drone.preparation.shootResponse")) + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { projects.requests.count == 3 && !controller.viewModel.isLoading } + primary.sendActions(for: .touchUpInside) + XCTAssertEqual(shoot.requests, [501]) + XCTAssertEqual(creation.requests.count, 1) + XCTAssertFalse(primary.isEnabled) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + } + + /// 请求超时不能推断创建失败,原页说明待核对并阻止刷新后重复提交。 + func testAmbiguousCreationFailureStaysLockedOnPage() async throws { + let session = MockURLSession(results: [.failure(URLError(.timedOut))]) + let api = DroneDockTaskCreationAPI(client: APIClient(environment: .testing, session: session)) + let project = try DroneDockPreparationViewFixtures.projectEnvelope() + let (controller, projects) = try DroneDockPreparationViewFixtures.controller( + context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), + responses: [project, project, project], creationService: api) + let window = makeWindow(root: controller) + defer { close(window) } + let summon = try button(in: controller.view, id: "drone.preparation.summon") + try await settle(window) { summon.isEnabled } + summon.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.taskCreationOutcomeUnknown && summon.title(for: .normal) == "结果待核对" } + XCTAssertFalse(summon.isEnabled) + XCTAssertNotNil(find(in: controller.view, id: "drone.preparation.creationResponse")) + try button(in: controller.view, id: "drone.preparation.refreshSummon").sendActions(for: .touchUpInside) + try await settle(window) { projects.requests.count == 3 && !controller.viewModel.isLoading } + summon.sendActions(for: .touchUpInside) + XCTAssertEqual(session.requests.count, 1) + XCTAssertFalse(summon.isEnabled) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + XCTAssertNil(controller.presentedViewController) + } + + /// 创建固定身份和只使用匿名替身的准备页。 + private func makeController(responses: [Data]) throws -> (DroneDockRemotePreparationViewController, MockURLSession) { + try DroneDockPreparationViewFixtures.controller(context: DroneDockPreparationViewFixtures.context(), order: DroneDockPreparationViewFixtures.order(), responses: responses) + } + + private func collection(in controller: UIViewController) throws -> UICollectionView { + controller.loadViewIfNeeded() + return try XCTUnwrap(find(in: controller.view, id: "drone.preparation.remote.list") as? UICollectionView) + } + + private func button(in root: UIView, id: String) throws -> UIButton { + try XCTUnwrap(find(in: root, id: id) as? UIButton) + } + + /// 经真实 collection delegate 执行选择,保持与用户点击相同的页面路径。 + private func select(_ path: IndexPath, in list: UICollectionView) throws { + XCTAssertTrue(list.delegate?.collectionView?(list, shouldSelectItemAt: path) == true) + list.selectItem(at: path, animated: false, scrollPosition: []) + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + + private func makeWindow(root: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: root) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待网络、Diffable 与导航稳定,并重新确认条件仍满足。 + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 300_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("拍摄准备页未在预期时间内稳定显示") + throw NSError(domain: "DroneDockPreparationViewTests", code: 1) + } + + private func views(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { views(in: $0) } } + private func hidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(hidden) ?? false) } + private func find(in root: UIView, id: String) -> UIView? { views(in: root).first { $0.accessibilityIdentifier == id } } + private func visibleTexts(in root: UIView) -> [String] { + views(in: root).compactMap { view in + guard let label = view as? UILabel, !hidden(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + + /// 购买配置服务只请求 project-info,设备状态通过独立替身验证。 + private func assertOnlyPreparationReads(_ session: MockURLSession, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertFalse(session.requests.isEmpty, file: file, line: line) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" && $0.url?.path == "/api/yf-handset-app/photog/multi-plane/project-info" && $0.httpBody == nil }, file: file, line: line) + for request in session.requests { + let items = URLComponents(url: request.url!, resolvingAgainstBaseURL: false)?.queryItems ?? [] + let query = Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + XCTAssertEqual(query["scenic_id"], "128", file: file, line: line) + XCTAssertEqual(query["project_id"], "101", file: file, line: line) + XCTAssertEqual(query["order_number"], "TEST-PREPARATION-001", file: file, line: line) + XCTAssertNil(query["lat"], file: file, line: line) + XCTAssertNil(query["lng"], file: file, line: line) + } + } + + private func assertUnambiguousLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = views(in: root).filter { !hidden($0) && !$0.bounds.isEmpty && $0.hasAmbiguousLayout } + XCTAssertTrue(ambiguous.isEmpty, "可见布局存在歧义:\(ambiguous.map { String(describing: type(of: $0)) })", file: file, line: line) + } + + private func capture(_ window: UIWindow, name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 真实准备页 UI 与首页导航共用的匿名夹具,不接触真实会话或设备。 +@MainActor +enum DroneDockPreparationViewFixtures { + /// 创建用于临时测试窗口的登录范围。 + static func context() -> DroneDockHomeContext { + DroneDockHomeContext(userID: "preparation-ui-user", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "preparation-test-token") + } + + /// 首页所选订单使用固定匿名字段。 + static func order() throws -> DroneDockHomeOrder { + try JSONDecoder().decode(DroneDockHomeOrder.self, from: Data(#"{"order_number":"TEST-PREPARATION-001","project_id":101,"user_phone":"130****0001","project_name":"测试套餐 · 含 1 次拍摄","shoot_count":1,"shot_count":0,"remaining_count":1,"shoot_status":"pending","order_status":20,"can_create_task":true,"can_upload_film":false,"can_confirm":false}"#.utf8)) + } + + /// 张工购买快照中的点位和航线,供选择及未知配置测试使用。 + static func purchasedSpots() -> [[String: Any]] { + [ + ["scenic_spot_id": 101, "scenic_spot_name": "测试点一", "available": true, "cover_url": "", "samples": [], + "air_lines": [ + ["air_line_id": 201, "air_line_name": "测试航线甲", "available": true, "unavailable_reason": "", "samples": []], + ["air_line_id": 202, "air_line_name": "测试航线乙", "available": true, "unavailable_reason": "", "samples": []] + ]], + ["scenic_spot_id": 102, "scenic_spot_name": "测试点二", "available": true, "cover_url": "", "samples": [], + "air_lines": [["air_line_id": 301, "air_line_name": "测试航线丙", "available": true, "unavailable_reason": "", "samples": []]]] + ] + } + + /// 根级订单摘要与购买点位;可独立覆盖摘要以验证未知字段不会被设备数据填充。 + static func projectEnvelope(orderNumber: String = "TEST-PREPARATION-001", projectID: Int = 101, + spots: [[String: Any]]? = nil, summary: [String: Any]? = nil) throws -> Data { + var data = summary ?? [ + "project_name": "测试套餐 · 含 1 次拍摄", "user_phone": "130****0001", + "shoot_count": 1, "shot_count": 0, "remaining_count": 1, "shoot_status": "pending", + "order_status": 20, "can_create_task": true, "can_upload_film": false, "can_confirm": false + ] + data["order_number"] = orderNumber + data["project_id"] = projectID + data["spot"] = spots ?? purchasedSpots() + return try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": data]) + } + + /// 购买与设备各使用独立替身,避免响应顺序影响测试。 + static func controller(context: DroneDockHomeContext, order: DroneDockHomeOrder, + responses: [Data]? = nil, + planeService: (any DroneDockPlaneStatusServing)? = nil, + creationService: (any DroneDockTaskCreating)? = nil, + shootService: (any DroneDockShootServing)? = nil, + taskControllerFactory: (@MainActor (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + pollDelay: @escaping @Sendable (UInt64) async throws -> Void = { try await Task.sleep(nanoseconds: $0) }, + currentContext: (@MainActor @Sendable () -> DroneDockHomeContext)? = nil) throws -> (DroneDockRemotePreparationViewController, MockURLSession) { + let payloads = try responses ?? [projectEnvelope(orderNumber: order.orderNumber ?? "", projectID: order.projectID ?? 101)] + let session = MockURLSession(responses: payloads) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "preparation-test-token" } + let model = DroneDockPreparationViewModel(context: context, order: order, + service: DroneDockPreparationAPI(client: client), + planeStatusService: try planeService ?? DroneDockPlaneStatusTestService(), + taskCreationService: creationService ?? DroneDockTaskCreationTestService(), + shootService: shootService ?? DroneDockShootTestService(), + currentContext: currentContext ?? { context }) + let factory = taskControllerFactory ?? { taskID, _, _ in DroneDockPreparationTaskDestinationStub(taskID: taskID) } + return (DroneDockRemotePreparationViewController(viewModel: model, taskControllerFactory: factory, + planeStatusPollDelay: pollDelay), session) + } +} + +/// 测试中在主线程切换景区,避免并发闭包捕获可变局部变量。 +@MainActor +private final class PreparationViewContextBox { + var value: DroneDockHomeContext + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 导航替身只记录所传任务身份,避免准备页测试意外使用真实查询服务。 +@MainActor +private final class DroneDockPreparationTaskDestinationStub: UIViewController { + let taskID: Int + init(taskID: Int) { self.taskID = taskID; super.init(nibName: nil, bundle: nil) } + @available(*, unavailable) + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + override func viewDidLoad() { super.viewDidLoad(); view.backgroundColor = .white; title = "拍摄任务" } +} diff --git a/suixinkanTests/DroneDockProjectInfoAPITests.swift b/suixinkanTests/DroneDockProjectInfoAPITests.swift new file mode 100644 index 0000000..0d29d6f --- /dev/null +++ b/suixinkanTests/DroneDockProjectInfoAPITests.swift @@ -0,0 +1,242 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用匿名购买快照验证张工 project-info 的请求、身份隔离及可选配置。 +@MainActor +final class DroneDockProjectInfoAPITests: XCTestCase { + /// 准备页始终携带订单号,读取购买快照并复用统一登录凭证。 + func testProjectInfoRequestsPurchasedSnapshotAndReadsSummaryAndRoutes() async throws { + let session = MockURLSession(responses: [try envelope(Self.payload)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "project-info-test-token" } + + let value = try await DroneDockPreparationAPI(client: client) + .projectInfo(scenicID: 128, projectID: 101, orderNumber: "TEST-PROJECT-001") + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.host, "api-test.zhifly.cn") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/project-info") + let items = try XCTUnwrap(URLComponents(url: XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems) + XCTAssertEqual(Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }), + ["scenic_id": "128", "project_id": "101", "order_number": "TEST-PROJECT-001"]) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "project-info-test-token") + XCTAssertNil(request.httpBody) + XCTAssertEqual(value.order.orderID, "TEST-PROJECT-001") + XCTAssertEqual(value.order.projectID, 101) + XCTAssertEqual(value.order.packageTitle, "已购测试套餐") + XCTAssertEqual(value.order.shotTotal, 5) + XCTAssertEqual(value.order.shotUsed, 1) + XCTAssertEqual(value.order.shotRemain, 4) + XCTAssertEqual(value.order.canCreateTask, true) + let spot = try XCTUnwrap(value.spots.first) + XCTAssertEqual(spot.id, 201) + XCTAssertEqual(spot.name, "已购测试点") + XCTAssertEqual(spot.available, true) + XCTAssertEqual(spot.coverURL, "https://example.com/spot.jpg") + let route = try XCTUnwrap(spot.airLines.first) + XCTAssertEqual(route.id, 301) + XCTAssertEqual(route.name, "已购测试航线") + XCTAssertEqual(route.available, true) + XCTAssertEqual(route.samples.first?.id, 401) + XCTAssertEqual(route.samples.first?.name, "测试样片") + XCTAssertEqual(route.samples.first?.coverURL, "https://example.com/sample.jpg") + XCTAssertEqual(route.samples.first?.previewURL, "https://example.com/sample.mp4") + } + + /// 缺少景区、项目或完整订单号时不得退化成浏览上架项目的请求。 + func testInvalidRequestScopeDoesNotSendNetworkRequests() async { + let session = MockURLSession(responses: []) + let api = DroneDockPreparationAPI(client: APIClient(environment: .testing, session: session)) + for (scenic, project, number) in [ + (0, 101, "TEST-PROJECT-001"), (128, 0, "TEST-PROJECT-001"), + (128, -1, "TEST-PROJECT-001"), (128, 101, ""), (128, 101, " \n"), + (128, 101, " TEST-PROJECT-001"), (128, 101, String(repeating: "T", count: 129)) + ] { + do { + _ = try await api.projectInfo(scenicID: scenic, projectID: project, orderNumber: number) + XCTFail("无效购买范围必须在请求前拒绝") + } catch {} + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 返回其他订单或项目时拒绝使用其购买范围,项目缺失也不能用请求值回填。 + func testMismatchedOrMissingPurchaseIdentityIsRejected() async throws { + for (key, value) in [("order_number", "ANOTHER-ORDER" as Any), ("project_id", 102 as Any), + ("project_id", NSNull() as Any)] { + var payload = Self.payload + payload[key] = value + let session = MockURLSession(responses: [try envelope(payload)]) + do { + _ = try await DroneDockPreparationAPI(client: APIClient(environment: .testing, session: session)) + .projectInfo(scenicID: 128, projectID: 101, orderNumber: "TEST-PROJECT-001") + XCTFail("错配或缺失的购买身份必须拒绝") + } catch {} + XCTAssertEqual(session.requests.count, 1) + } + var missingProject = Self.payload + missingProject.removeValue(forKey: "project_id") + XCTAssertThrowsError(try decode(missingProject)) + } + + /// 后端拒绝购买范围时保留业务错误,不能转换成成功空列表。 + func testBackendFailurePreservesBusinessMessage() async throws { + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 160001, msg: "该订单不属于当前项目")]) + do { + _ = try await DroneDockPreparationAPI(client: APIClient(environment: .testing, session: session)) + .projectInfo(scenicID: 128, projectID: 101, orderNumber: "TEST-PROJECT-001") + XCTFail("应保留后端业务拒绝") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "该订单不属于当前项目") + } + } + + /// 明确空点位和空航线是可展示空态,不扩充来自其他接口的配置。 + func testExplicitEmptyPurchasedListsArePreserved() throws { + var payload = Self.payload + payload["spot"] = [] as [Any] + XCTAssertTrue(try decode(payload).spots.isEmpty) + payload["spot"] = [["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": []]] + XCTAssertTrue(try decode(payload).spots[0].airLines.isEmpty) + } + + /// 错误结构和旧 workbench 名称不能冒充张工的购买快照。 + func testMissingAndMalformedRequiredConfigurationIsRejected() throws { + var missingSpots = Self.payload + missingSpots.removeValue(forKey: "spot") + XCTAssertThrowsError(try decode(missingSpots)) + for value: Any in [NSNull(), [:] as [String: Any], + [["scenic_spot_id": 201, "scenic_spot_name": "测试点"]], + [["scenic_spot_id": 201, "name": "旧接口点位", "air_lines": []]], + [["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": NSNull()]], + [["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": [["air_line_id": 301, "name": "旧接口航线"]]]]] { + var payload = Self.payload + payload["spot"] = value + XCTAssertThrowsError(try decode(payload)) + } + } + + /// 点位、航线和样片身份需为正整数,各自列表不得出现重复项。 + func testInvalidAndDuplicateConfigurationIdentitiesAreRejected() throws { + for invalid: Any in [0, -1, 1.5, true, "invalid"] { + var payload = Self.payload + payload["spot"] = [["scenic_spot_id": invalid, "scenic_spot_name": "测试点", "air_lines": []]] + XCTAssertThrowsError(try decode(payload)) + } + let sample: [String: Any] = ["id": 401] + let route: [String: Any] = ["air_line_id": 301, "air_line_name": "测试航线"] + let spot: [String: Any] = ["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": []] + for spots: [[String: Any]] in [ + [spot, spot], + [["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": [route, route]]], + [["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": [ + ["air_line_id": 301, "air_line_name": "测试航线", "samples": [sample, sample]]]]] + ] { + var payload = Self.payload + payload["spot"] = spots + XCTAssertThrowsError(try decode(payload)) + } + for invalid: Any in [0, -1, true, "1.5"] { + let routeData = try JSONSerialization.data(withJSONObject: ["air_line_id": invalid, "air_line_name": "测试航线"]) + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockPurchasedAirLine.self, from: routeData)) + let sampleData = try JSONSerialization.data(withJSONObject: ["id": invalid]) + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockPurchasedSample.self, from: sampleData)) + } + } + + /// 同一航线可出现在不同购买点位中,整数字符串也保持稳定身份。 + func testNumericStringIdentitiesAndRoutesSharedAcrossPointsAreAccepted() throws { + var payload = Self.payload + payload["project_id"] = "101" + payload["spot"] = [201, 202].map { id in + ["scenic_spot_id": String(id), "scenic_spot_name": "测试点\(id)", "air_lines": [ + ["air_line_id": "301", "air_line_name": "同一航线", "samples": [["id": "401"]]]]] as [String: Any] + } + let response = try decode(payload) + XCTAssertEqual(response.spots.map(\.id), [201, 202]) + XCTAssertEqual(response.spots.map { $0.airLines[0].id }, [301, 301]) + XCTAssertEqual(response.spots[0].airLines[0].samples[0].id, 401) + } + + /// 不可用及原因按原值保留;未知状态不能自动变为可用,未知地址不拼接。 + func testUnavailableAndUnknownOptionalFieldsRemainDistinct() throws { + var payload = Self.payload + payload["spot"] = [["scenic_spot_id": 201, "scenic_spot_name": "停用点位", "available": false, + "cover_url": NSNull(), "air_lines": [ + ["air_line_id": 301, "air_line_name": "停用航线", "available": false, + "unavailable_reason": "航线已停用", "samples": NSNull()], + ["air_line_id": 302, "air_line_name": "未知航线", "samples": [["id": 402, "cover_url": "", "preview_url": NSNull()]]] + ]]] + let response = try decode(payload) + let spot = try XCTUnwrap(response.spots.first) + XCTAssertEqual(spot.available, false) + XCTAssertNil(spot.coverURL) + XCTAssertEqual(spot.airLines[0].available, false) + XCTAssertEqual(spot.airLines[0].unavailableReason, "航线已停用") + XCTAssertTrue(spot.airLines[0].samples.isEmpty) + XCTAssertNil(spot.airLines[1].available) + XCTAssertNil(spot.airLines[1].unavailableReason) + XCTAssertEqual(spot.airLines[1].samples[0].coverURL, "") + XCTAssertNil(spot.airLines[1].samples[0].previewURL) + XCTAssertNil(spot.airLines[1].samples[0].name) + } + + /// 可用状态和地址类型错误时拒绝解码,不放宽为可选航线。 + func testMalformedAvailabilitySamplesAndURLsAreRejected() throws { + for extra: [String: Any] in [["available": "true"], ["available": 1], ["samples": [:]], + ["samples": [["id": 401, "preview_url": 123]]]] { + var route: [String: Any] = ["air_line_id": 301, "air_line_name": "测试航线"] + route.merge(extra) { _, new in new } + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockPurchasedAirLine.self, + from: JSONSerialization.data(withJSONObject: route))) + } + for extra: [String: Any] in [["available": "false"], ["cover_url": 123]] { + var spot: [String: Any] = ["scenic_spot_id": 201, "scenic_spot_name": "测试点", "air_lines": []] + spot.merge(extra) { _, new in new } + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockPurchasedSpot.self, + from: JSONSerialization.data(withJSONObject: spot))) + } + } + + /// 次数与套餐只取张工根级摘要,旧 workbench 字段和额外点位不会成为备用数据。 + func testLegacyWorkbenchFieldsDoNotSupplyPurchaseData() throws { + let response = try decode([ + "order_number": "TEST-PROJECT-001", "project_id": 101, "spot": [], + "package_name": "旧套餐", "shot_total": 99, "shot_used": 88, "shot_remain": 11, + "order_progress": ["package_name": "旧套餐", "shot_total": 99], + "spots": [["scenic_spot_id": 999, "name": "未购买点位", "air_lines": []]] + ]) + XCTAssertNil(response.order.packageName) + XCTAssertNil(response.order.shotTotal) + XCTAssertNil(response.order.shotUsed) + XCTAssertNil(response.order.shotRemain) + XCTAssertNil(response.order.canCreateTask) + XCTAssertTrue(response.spots.isEmpty) + } + + /// 固定匿名购买快照,与实际账号、景区和设备无关。 + private static var payload: [String: Any] { + ["order_number": "TEST-PROJECT-001", "project_id": 101, "project_name": "已购测试套餐", + "shoot_count": 5, "shot_count": 1, "remaining_count": 4, "can_create_task": true, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "已购测试点", "available": true, + "cover_url": "https://example.com/spot.jpg", "air_lines": [ + ["air_line_id": 301, "air_line_name": "已购测试航线", "available": true, + "unavailable_reason": "", "samples": [["id": 401, "name": "测试样片", + "cover_url": "https://example.com/sample.jpg", + "preview_url": "https://example.com/sample.mp4"]]]]]]] + } + + /// 构造标准成功响应,网络由 MockURLSession 提供。 + private func envelope(_ payload: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload]) + } + + /// 直接读取模型以验证响应结构,无额外网络调用。 + private func decode(_ payload: [String: Any]) throws -> DroneDockProjectInfoResponse { + try JSONDecoder().decode(DroneDockProjectInfoResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } +} diff --git a/suixinkanTests/DroneDockRTCPlaybackTests.swift b/suixinkanTests/DroneDockRTCPlaybackTests.swift new file mode 100644 index 0000000..62bb829 --- /dev/null +++ b/suixinkanTests/DroneDockRTCPlaybackTests.swift @@ -0,0 +1,728 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证 RTC 会话状态及 UI 生命周期;所有播放事件由内存替身产生。 +@MainActor +final class DroneDockRTCPlaybackTests: XCTestCase { + /// 成功获取凭证只进入连接中,必须等首帧回调才能展示实时画面。 + func testCredentialReceiptWaitsForFirstFrame() async throws { + let (model, service) = try makeModel() + XCTAssertTrue(model.loadsAutomatically) + XCTAssertNil(model.actionTitle) + await model.refresh() + XCTAssertEqual(model.state, .connecting) + XCTAssertFalse(model.loadsAutomatically) + XCTAssertNil(model.playbackURL) + let id = try XCTUnwrap(model.playbackSessionID) + model.receivePlaybackEvent(.firstFrame, sessionID: id) + XCTAssertEqual(model.state, .playing) + XCTAssertEqual(service.count, 1) + } + + /// 刷新请求返回之前保留旧画面;新凭证采用新会话,旧回调不能覆盖它。 + func testRefreshPreservesOldFrameUntilReceiptAndIgnoresOldEvents() async throws { + let (model, service) = try makeModel() + await model.refresh() + let oldID = try XCTUnwrap(model.playbackSessionID) + model.receivePlaybackEvent(.firstFrame, sessionID: oldID) + service.suspend = true + let pending = Task { @MainActor in await model.refresh() } + for _ in 0..<100 where service.count < 2 { await Task.yield() } + XCTAssertEqual(model.state, .playing) + XCTAssertEqual(model.playbackSessionID, oldID) + service.finish() + await pending.value + XCTAssertNotEqual(model.playbackSessionID, oldID) + model.receivePlaybackEvent(.failed("旧回调"), sessionID: oldID) + XCTAssertEqual(model.state, .connecting) + } + + /// 过期停止旧会话,由用户重新获取,不自动重复启动设备推流。 + func testExpiryClearsCredentialsWithoutAutomaticNetworkRequest() async throws { + let (model, service) = try makeModel() + await model.refresh() + let id = try XCTUnwrap(model.playbackSessionID) + model.receivePlaybackEvent(.expired, sessionID: id) + XCTAssertNil(model.rtcConfiguration) + XCTAssertNil(model.playbackSessionID) + XCTAssertEqual(service.count, 1) + XCTAssertTrue(model.canLoad) + XCTAssertEqual(model.state, .unavailable("图传凭证即将或已经过期,请重新获取")) + } + + /// 离页清除凭证,迟到首帧不能让页面恢复播放。 + func testLeavingDiscardsCredentialsAndLateFirstFrame() async throws { + let (model, _) = try makeModel() + await model.refresh() + let id = try XCTUnwrap(model.playbackSessionID) + model.invalidate() + model.receivePlaybackEvent(.firstFrame, sessionID: id) + XCTAssertEqual(model.state, .idle) + XCTAssertNil(model.rtcConfiguration) + XCTAssertNil(model.response) + } + + /// 网络错误不能留下可重连的旧凭证,也不恢复已经失败的会话。 + func testRefreshFailureClearsOldCredentials() async throws { + let (model, service) = try makeModel() + await model.refresh() + service.error = URLError(.timedOut) + await model.refresh() + XCTAssertNil(model.rtcConfiguration) + XCTAssertNil(model.playbackSessionID) + guard case .failed = model.state else { return XCTFail("应显示请求失败") } + XCTAssertEqual(service.count, 2) + } + + /// 未支持供应商保持不可播放,不进入 SDK。 + func testUnsupportedVendorHasNoPlaybackConfiguration() async throws { + let (model, _) = try makeModel(response: DroneDockRTCFixture.response(play: ["url_type": "agora"])) + await model.refresh() + XCTAssertNil(model.rtcConfiguration) + guard case .unavailable(let reason) = model.state else { return XCTFail("应显示不支持") } + XCTAssertTrue(reason.contains("暂不支持")) + } + + /// 同一会话重复刷新 UI 不重建播放器,切后台只释放一次。 + func testViewStartsOnceAndStopsWhenInactive() async throws { + let (model, _) = try makeModel() + await model.refresh() + let player = RTCPlayerProbe() + let view = DroneDockTaskLiveView(rtcPlayer: player) + view.apply(model) + XCTAssertEqual(player.starts, 0) + view.setPlaybackActive(true) + view.apply(model) + XCTAssertEqual(player.starts, 1) + view.setPlaybackActive(false) + view.setPlaybackActive(false) + XCTAssertEqual(player.stops, 1) + } + + /// 替身首帧与失败回调更新图传区域;失败会释放播放器,布局尺寸保持不变。 + func testViewEventsUpdateStateAndReleaseFailedSession() async throws { + let (model, _) = try makeModel() + await model.refresh() + let player = RTCPlayerProbe() + let view = DroneDockTaskLiveView(rtcPlayer: player) + view.frame = CGRect(x: 0, y: 0, width: 390, height: 219.375) + view.onPlaybackEvent = { event, id in model.receivePlaybackEvent(event, sessionID: id) } + view.apply(model) + view.setPlaybackActive(true) + let event = try XCTUnwrap(player.event) + event(.firstFrame) + view.apply(model) + XCTAssertEqual(model.state, .playing) + view.layoutIfNeeded() + XCTAssertEqual(view.accessibilityLabel, "实时图传") + XCTAssertNil(model.actionTitle, "已有实时画面时不提供刷新图传按钮") + let badge = try XCTUnwrap(descendants(view).first { $0.accessibilityIdentifier == "drone.task.remote.live.badge" }) + let source = try XCTUnwrap(descendants(view).first { $0.accessibilityIdentifier == "drone.task.remote.live.source" } as? UILabel) + let dot = try XCTUnwrap(descendants(view).first { $0.accessibilityIdentifier == "drone.task.remote.live.dot" }) + let button = try XCTUnwrap(descendants(view).first { $0.accessibilityIdentifier == "drone.task.remote.live.request" } as? UIButton) + XCTAssertFalse(badge.isHidden) + XCTAssertFalse(dot.isHidden) + XCTAssertEqual(source.text, "实时图传") + XCTAssertEqual(dot.backgroundColor, DroneDockStyle.success) + XCTAssertLessThan(badge.bounds.width, 100, "标识按内容宽度排版,不再占用固定 200 点") + XCTAssertTrue(button.isHidden) + event(.failed("测试中断")) + view.apply(model) + XCTAssertTrue(badge.isHidden, "失败后不能继续显示绿色实时标识") + XCTAssertFalse(button.isHidden, "无画面时仍可主动重试") + XCTAssertEqual(player.stops, 1) + XCTAssertEqual(view.bounds.size, CGSize(width: 390, height: 219.375)) + event(.firstFrame) + XCTAssertEqual(model.state, .failed("测试中断")) + } + + /// 图传接收路径会调用注入工厂,初始化失败如实报告;不初始化真实 SDK。 + func testReceiverUsesInjectedFactoryWithoutBuildRestriction() throws { + var requestedAppIDs: [String] = [] + let player = DroneDockLiveReceiver(makeEngine: { appID, _ in + requestedAppIDs.append(appID) + return nil + }) + let configuration = try DroneDockVolcLiveConfiguration.parse(DroneDockRTCFixture.response(), now: DroneDockRTCFixture.now) + var events: [DroneDockLivePlaybackEvent] = [] + player.start([configuration], in: UIView()) { events.append($0) } + XCTAssertEqual(requestedAppIDs, [configuration.appID]) + XCTAssertEqual(events, [.failed("图传播放器初始化失败")]) + player.stop() + } + + /// 页面进场与回前台自动开启,状态刷新不重复启动;播放器使用无网络替身。 + func testTaskPageAutomaticallyStartsAndResumesWithoutPollingLive() async throws { + let (live, service) = try makeModel() + let player = RTCPlayerProbe() + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: player, + shootingPollDelay: { _ in try await Task.sleep(for: .milliseconds(40)) }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + try await Task.sleep(for: .milliseconds(250)) + XCTAssertEqual(service.count, 1) + XCTAssertEqual(player.starts, 1) + XCTAssertGreaterThan(read.requests.count, 1, "shooting 轮询不能重复请求 live") + XCTAssertTrue(read.requests.allSatisfy { !$0.liveBattery }) + let button = try XCTUnwrap(descendants(controller.view).first { + $0.accessibilityIdentifier == "drone.task.remote.live.request" + } as? UIButton) + XCTAssertTrue(button.isHidden, "自动连接时没有手动开启按钮") + let oldEvent = try XCTUnwrap(player.event) + oldEvent(.firstFrame) + try await wait { live.state == .playing } + controller.viewDidAppear(false) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(for: .milliseconds(80)) + XCTAssertEqual(service.count, 1) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + XCTAssertEqual(player.stops, 1) + XCTAssertNil(live.rtcConfiguration) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await wait { player.starts == 2 } + XCTAssertEqual(service.count, 2) + oldEvent(.firstFrame) + try await Task.sleep(for: .milliseconds(20)) + XCTAssertEqual(live.state, .connecting, "旧播放器事件不能激活新会话") + controller.viewWillDisappear(false) + XCTAssertEqual(player.stops, 2) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(for: .milliseconds(80)) + XCTAssertEqual(service.count, 2, "离页不能自动请求图传") + controller.viewDidAppear(false) + try await wait { player.starts == 3 } + XCTAssertEqual(service.count, 3) + XCTAssertFalse(model.canStartShooting) + XCTAssertFalse(model.canResummon) + } + + /// 自动请求失败后不随状态刷新或重复出现回调重试;保留显式重试入口。 + func testAutomaticLiveFailureDoesNotLoopAndAllowsRetry() async throws { + let (live, service) = try makeModel() + service.error = URLError(.timedOut) + let (controller, window) = try taskPage(live: live) + defer { window.isHidden = true; window.rootViewController = nil } + try await wait { if case .failed = live.state { return true }; return false } + controller.viewDidAppear(false) + try await Task.sleep(for: .milliseconds(120)) + XCTAssertEqual(service.count, 1) + XCTAssertFalse(live.loadsAutomatically) + let button = try XCTUnwrap(descendants(controller.view).first { + $0.accessibilityIdentifier == "drone.task.remote.live.request" + } as? UIButton) + XCTAssertEqual(button.title(for: .normal), "重试") + XCTAssertFalse(button.isHidden) + button.sendActions(for: .touchUpInside) + try await wait { service.count == 2 && !live.isLoading } + XCTAssertEqual(service.count, 2) + } + + /// 自动请求期间防重入;离页后返回的旧凭证不能启动播放器。 + func testAutomaticInFlightRequestIsExclusiveAndLateResponseIsDiscarded() async throws { + let (live, service) = try makeModel() + service.suspend = true + let player = RTCPlayerProbe() + let (controller, window) = try taskPage(live: live, player: player) + defer { service.finish(); window.isHidden = true; window.rootViewController = nil } + try await wait { service.count == 1 } + controller.viewDidAppear(false) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(for: .milliseconds(30)) + XCTAssertEqual(service.count, 1) + controller.viewWillDisappear(false) + service.finish() + try await Task.sleep(for: .milliseconds(30)) + XCTAssertNil(live.rtcConfiguration) + XCTAssertEqual(player.starts, 0) + service.suspend = false + controller.viewDidAppear(false) + try await wait { player.starts == 1 } + XCTAssertEqual(service.count, 2) + } + + /// 按用户要求完整记录 live 原始回执,SDK 播放流程不受日志调整影响。 + func testLiveAPIResponseLogContainsOriginalRTCParameters() async throws { + let payload: [String: Any] = ["order_flight_task_id": 501, "play": ["url": "token=TEST-RTC-TOKEN"]] + let session = MockURLSession(responses: [try DroneDockLiveTestData.envelope(payload)]) + var logs = "" + let client = APIClient(environment: .testing, session: session, debugLogSink: { logs += $0 }, + droneDockLogSink: { logs += $0 }) + _ = try await DroneDockLiveAPI(client: client).live(taskID: 501) + XCTAssertTrue(logs.contains("TEST-RTC-TOKEN")) + XCTAssertFalse(logs.contains("")) + XCTAssertTrue(logs.contains("response.received")) + } + + /// 两路独立解码,play 即使首选无人机,接收配置也以机巢开始。 + func testBothSourcesAreParsedWithAirportFirst() async throws { + let (model, _) = try makeModel(response: dualResponse()) + await model.refresh() + XCTAssertEqual(model.rtcConfigurations.map(\.role), ["airport", "drone"]) + XCTAssertEqual(model.rtcConfiguration?.role, "airport") + XCTAssertEqual(model.state, .connecting) + XCTAssertEqual(model.nextParameterRefreshDelay, 570) + } + + /// 首帧/中断事件驱动两路切换,不根据任务阶段或 available 冒充已有画面。 + func testAirportDroneAndAirportFallbackUpdateSourceLabel() async throws { + let (model, _) = try makeModel(response: dualResponse()) + await model.refresh() + let player = RTCPlayerProbe() + let view = DroneDockTaskLiveView(rtcPlayer: player) + view.onPlaybackEvent = { event, id in model.receivePlaybackEvent(event, sessionID: id) } + view.apply(model); view.setPlaybackActive(true) + var selection = DroneDockLiveSourceSelection() + XCTAssertNil(selection.selectedRole) + for (role, ready, expected) in [("airport", true, "机巢摄像头"), ("drone", true, "无人机摄像头"), ("drone", false, "机巢摄像头")] { + selection.setReady(ready, role: role) + player.event?(.sourceChanged(selection.selectedRole)) + view.apply(model) + XCTAssertEqual(model.state, .playing) + XCTAssertEqual(model.message, expected) + XCTAssertEqual(view.accessibilityLabel, "实时图传", "切换来源后仍使用简洁实时标识") + } + selection.setReady(false, role: "airport") + player.event?(.sourceChanged(selection.selectedRole)); view.apply(model) + XCTAssertEqual(model.state, .connecting) + selection.setReady(true, role: "airport") + player.event?(.sourceChanged(selection.selectedRole)); view.apply(model) + XCTAssertEqual(model.message, "机巢摄像头") + XCTAssertEqual(player.starts, 1, "切源不创建新的业务播放会话") + view.setPlaybackActive(false) + } + + /// 补齐无人机参数时保留机巢画面、会话和在播状态,重复 UI 刷新也不重复更新播放器。 + func testDiscoveryAddsDroneWithoutRestartingAirport() async throws { + let (model, service) = try makeModel(response: dualResponse(droneAvailable: false)) + await model.refresh() + let id = try XCTUnwrap(model.playbackSessionID) + let player = RTCPlayerProbe() + let view = DroneDockTaskLiveView(rtcPlayer: player) + view.onPlaybackEvent = { event, id in model.receivePlaybackEvent(event, sessionID: id) } + view.apply(model); view.setPlaybackActive(true) + player.event?(.sourceChanged("airport")); view.apply(model) + XCTAssertEqual(model.nextParameterRefreshDelay, 30) + service.response = try dualResponse() + await model.refresh(keepingPlayback: true) + view.apply(model); view.apply(model) + XCTAssertEqual(model.playbackSessionID, id) + XCTAssertEqual(model.state, .playing) + XCTAssertEqual(model.message, "机巢摄像头") + XCTAssertEqual(model.rtcConfigurations.count, 2) + XCTAssertEqual(player.starts, 2, "增补参数只更新一次播放器") + XCTAssertEqual(player.stops, 0, "不能先停止健康的机巢会话") + view.setPlaybackActive(false) + } + + /// 凭证轮换保留同一会话;后台接口失败不打断健康画面,权限错误除外。 + func testRenewalAndTransientFailurePreservePlaybackButDeniedClearsIt() async throws { + let (model, service) = try makeModel(response: dualResponse()) + await model.refresh() + let id = try XCTUnwrap(model.playbackSessionID) + model.receivePlaybackEvent(.sourceChanged("airport"), sessionID: id) + service.response = try dualResponse(token: "ROTATED-TEST-TOKEN") + await model.refresh(keepingPlayback: true) + XCTAssertEqual(model.playbackSessionID, id) + XCTAssertEqual(model.rtcConfiguration?.token, "ROTATED-TEST-TOKEN") + XCTAssertEqual(model.state, .playing) + service.error = URLError(.timedOut) + await model.refresh(keepingPlayback: true) + XCTAssertEqual(model.playbackSessionID, id) + XCTAssertEqual(model.state, .playing) + service.error = APIError.serverCode(100099, "无权查看该任务") + await model.refresh(keepingPlayback: true) + XCTAssertNil(model.playbackSessionID) + XCTAssertTrue(model.rtcConfigurations.isEmpty) + } + + /// 错误任务身份即使出现在后台补流响应,也不能继续保留旧订阅。 + func testDiscoveryRejectsWrongTaskAndLateCallback() async throws { + let (model, service) = try makeModel(response: dualResponse()) + await model.refresh() + let id = try XCTUnwrap(model.playbackSessionID) + model.receivePlaybackEvent(.sourceChanged("airport"), sessionID: id) + service.response = try DroneDockRTCFixture.response(root: ["order_flight_task_id": 999]) + await model.refresh(keepingPlayback: true) + XCTAssertNil(model.playbackSessionID) + model.receivePlaybackEvent(.sourceChanged("drone"), sessionID: id) + guard case .failed = model.state else { return XCTFail("任务身份不符必须停止播放") } + } + + /// 一路参数损坏不阻止另一路;机场无画面时允许直接接收有效无人机流。 + func testInvalidDroneStillAllowsAirportAndMissingAirportAllowsDrone() throws { + let airport = stream(role: "airport") + let response = try DroneDockRTCFixture.response(root: ["airport": airport, "drone": ["available": true, "role": "drone", "url_type": "unknown"]]) + XCTAssertEqual(try DroneDockVolcLiveConfiguration.parseSources(response, now: DroneDockRTCFixture.now).map(\.role), ["airport"]) + let droneOnly = try DroneDockVolcLiveConfiguration.parseSources(DroneDockRTCFixture.response(), now: DroneDockRTCFixture.now) + XCTAssertEqual(droneOnly.map(\.role), ["drone"]) + let unavailable = try DroneDockRTCFixture.response(root: ["airport": airport, "drone": ["available": false, "role": "drone"]]) + XCTAssertEqual(try DroneDockVolcLiveConfiguration.parseSources(unavailable, now: DroneDockRTCFixture.now).map(\.role), ["airport"], + "明确不可用的 drone 优先于可能迟滞的 play 首选项") + } + + /// 页面只在缺参数时定时补流;离页立即取消,全部使用内存接口和播放器替身。 + func testPageDiscoversDroneAutomaticallyAndStopsOffscreen() async throws { + let (live, service) = try makeModel(response: dualResponse(droneAvailable: false)) + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: RTCPlayerProbe(), + liveParameterDelay: { interval in + if interval <= 30 { try await Task.sleep(for: .milliseconds(80)) } + else { try await Task.sleep(for: .seconds(3600)) } + }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller); window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + try await wait { service.count == 1 && !live.isLoading } + let id = live.playbackSessionID + service.response = try dualResponse() + try await wait { service.count == 2 && live.rtcConfigurations.count == 2 } + XCTAssertEqual(live.playbackSessionID, id) + try await Task.sleep(for: .milliseconds(100)) + XCTAssertEqual(service.count, 2) + controller.viewWillDisappear(false) + try await Task.sleep(for: .milliseconds(100)) + XCTAssertNil(live.playbackSessionID) + XCTAssertEqual(service.count, 2) + } + + /// RTC 致命失败会取消原先的补流计时,防止错误态稍后偷偷重开 live。 + func testPlaybackFailureCancelsPendingDiscovery() async throws { + let (live, service) = try makeModel(response: dualResponse(droneAvailable: false)) + let player = RTCPlayerProbe() + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: player, + liveParameterDelay: { _ in try await Task.sleep(for: .milliseconds(150)) }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller); window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + try await wait { player.event != nil && !live.isLoading } + player.event?(.failed("模拟 RTC 连接失败")) + try await Task.sleep(for: .milliseconds(300)) + XCTAssertEqual(live.state, .failed("模拟 RTC 连接失败")) + XCTAssertEqual(service.count, 1) + XCTAssertNil(live.playbackSessionID) + } + + /// 设备重新绑定后必须换会话,旧房间的事件不能影响新设备。 + func testDiscoveryChangedDeviceReplacesSession() async throws { + let (model, service) = try makeModel(response: dualResponse()) + await model.refresh() + let oldID = try XCTUnwrap(model.playbackSessionID) + model.receivePlaybackEvent(.sourceChanged("airport"), sessionID: oldID) + service.response = try DroneDockRTCFixture.response(root: ["plane_id": 88, "airport_sn": "TEST-OTHER-AIRPORT"]) + await model.refresh(keepingPlayback: true) + XCTAssertNotEqual(model.playbackSessionID, oldID) + XCTAssertEqual(model.state, .connecting) + model.receivePlaybackEvent(.sourceChanged("airport"), sessionID: oldID) + XCTAssertEqual(model.state, .connecting) + XCTAssertNil(model.activeRole) + } + + /// 实测 live 补取会轮换 user_id;机巢凭证未临期时不重建已有房间。 + func testDiscoveryKeepsExistingViewerWhenBackendRotatesUserID() async throws { + let (model, service) = try makeModel(response: dualResponse(droneAvailable: false)) + await model.refresh() + let airport = try XCTUnwrap(model.rtcConfigurations.first) + let session = model.playbackSessionID + var replacement = stream(role: "airport") + replacement["url"] = "app_id=test-app&room_id=TEST-airport&user_id=NEW-VIEWER&token=NEW-TOKEN" + service.response = try DroneDockRTCFixture.response(root: ["airport": replacement, "drone": stream(role: "drone")]) + await model.refresh(keepingPlayback: true) + XCTAssertEqual(model.rtcConfigurations.first, airport) + XCTAssertEqual(model.rtcConfigurations.count, 2) + XCTAssertEqual(model.playbackSessionID, session) + } + + /// 原用户凭证临期时采用新用户凭证,不能因保留健康房间而错过续期。 + func testDiscoveryReplacesViewerAtExpiryWindow() async throws { + var airport = stream(role: "airport") + airport["expire_ts"] = 2_000_000_020 + let (model, service) = try makeModel(response: DroneDockRTCFixture.response(root: ["airport": airport, "drone": ["available": false, "role": "drone"]])) + await model.refresh() + airport["expire_ts"] = 2_000_000_600 + airport["url"] = "app_id=test-app&room_id=TEST-airport&user_id=RENEWED-VIEWER&token=NEW-TOKEN" + service.response = try DroneDockRTCFixture.response(root: ["airport": airport, "drone": stream(role: "drone")]) + await model.refresh(keepingPlayback: true) + XCTAssertEqual(model.rtcConfigurations.first?.userID, "RENEWED-VIEWER") + } + + /// 录制结束时仍在途的 live 回包作废,不能在完成封面上偷偷开始接收。 + func testRecordingCompletionDiscardsPendingLiveResponse() async throws { + let (live, service) = try makeModel() + service.suspend = true + let player = RTCPlayerProbe() + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: player, + shootingPollDelay: { _ in try await Task.sleep(for: .milliseconds(30)) }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + defer { service.finish(); controller.viewWillDisappear(false); window.isHidden = true; window.rootViewController = nil } + try await wait { service.count == 1 } + read.result = .success(try shootDoneReturningResponse()) + try await wait { model.isRecordingFinished } + service.finish() + try await Task.sleep(for: .milliseconds(50)) + XCTAssertEqual(player.starts, 0) + XCTAssertNil(live.playbackSessionID) + XCTAssertEqual(service.count, 1) + } + + /// 录制完成即停止接收并弹出入口;上传仍为 20,旧帧、前后台、重复包均不能重新启动。 + func testRecordingCompletionStopsVideoAndOpensMaterialsOnce() async throws { + let (live, service) = try makeModel() + let player = RTCPlayerProbe() + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let destination = UIViewController() + var navigations = 0 + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: player, + materialsControllerFactory: { order, scope in + XCTAssertEqual(order.orderNumber, "TEST-TASK-PAGE-001") + XCTAssertEqual(scope.scenicID, 128) + navigations += 1 + return destination + }, shootingPollDelay: { _ in try await Task.sleep(for: .milliseconds(40)) }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + try await wait { player.starts == 1 } + let lateFrame = try XCTUnwrap(player.event) + lateFrame(.firstFrame) + read.result = .success(try shootDoneReturningResponse()) + try await wait { model.isRecordingFinished } + XCTAssertEqual(player.stops, 1) + XCTAssertNil(live.playbackSessionID) + XCTAssertEqual(model.response?.orderFlightTask?.status, 20) + XCTAssertEqual(model.response?.task?.waylineStatus, 24) + XCTAssertTrue(model.isShootCompleteReturning) + XCTAssertTrue(model.presentation.message.contains("无人机正在返航")) + let cover = try XCTUnwrap(descendants(controller.view).first { $0.accessibilityIdentifier == "drone.task.remote.live.cover" }) + XCTAssertFalse(cover.isHidden) + try await Task.sleep(for: .milliseconds(300)) + let attachment = XCTAttachment(image: UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + }) + attachment.name = "录制完成弹窗与静态封面(隔离替身)" + attachment.lifetime = .keepAlways + add(attachment) + let later = try XCTUnwrap(descendants(window).first { $0.accessibilityIdentifier == "drone.task.recordingCompletion.later" } as? UIButton) + later.sendActions(for: .touchUpInside) + window.layoutIfNeeded() + let pageAttachment = XCTAttachment(image: UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + }) + pageAttachment.name = "拍摄完成页面-原型对齐(隔离替身)" + pageAttachment.lifetime = .keepAlways + add(pageAttachment) + var uploading = RealtimeTestData.mediaStagePayload(wayline: 30, version: 2) + uploading["shoot_complete_returning"] = false + read.result = .success(try DroneDockShootingTaskTestData.decode(uploading)) + try await wait { model.response?.stateVersion == 2 } + XCTAssertFalse(model.isShootCompleteReturning) + XCTAssertTrue(model.presentation.message.contains("素材上传中")) + XCTAssertFalse(model.presentation.message.contains("无人机正在返航")) + XCTAssertNil(descendants(window).first { $0.accessibilityIdentifier == "drone.task.recordingCompletion" }) + lateFrame(.firstFrame) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + read.result = .success(try DroneDockShootingTaskTestData.decode(RealtimeTestData.mediaStagePayload(wayline: 50, version: 3))) + try await wait { model.presentation.phase == .completed } + XCTAssertEqual(player.starts, 1) + XCTAssertEqual(service.count, 1) + XCTAssertNil(descendants(window).first { $0.accessibilityIdentifier == "drone.task.recordingCompletion" }) + let primary = try XCTUnwrap(descendants(controller.view).first { $0.accessibilityIdentifier == "drone.task.remote.primary" } as? UIButton) + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + try await wait { controller.navigationController?.topViewController === destination } + XCTAssertEqual(navigations, 1) + } + + /// 已结束任务重新进入时先读状态,不能短暂启动 live;弹窗按钮直达素材库。 + func testEnteringRecordedTaskSkipsLiveAndPopupOpensMaterials() async throws { + let (live, service) = try makeModel() + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.decode( + RealtimeTestData.mediaStagePayload(wayline: 30, version: 1)))) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let destination = UIViewController() + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: RTCPlayerProbe(), + materialsControllerFactory: { _, _ in destination }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil } + try await wait { model.isRecordingFinished } + XCTAssertEqual(service.count, 0) + let button = try XCTUnwrap(descendants(window).first { $0.accessibilityIdentifier == "drone.task.recordingCompletion.materials" } as? UIButton) + button.sendActions(for: .touchUpInside) + try await wait { controller.navigationController?.topViewController === destination } + } + + /// 直接收到素材上传失败也停止图传、保留素材入口,不能弹成功或因重进页面重新启动 live。 + func testMediaUploadFailureStopsVideoWithoutSuccessPopup() async throws { + let (live, service) = try makeModel() + let player = RTCPlayerProbe() + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: player, + shootingPollDelay: { _ in try await Task.sleep(for: .milliseconds(40)) }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + try await wait { player.starts == 1 } + let oldFrame = try XCTUnwrap(player.event) + oldFrame(.firstFrame) + read.result = .success(try DroneDockShootingTaskTestData.response(changes: [ + "task": ["id": 501, "status": 40, "wayline_status": 39], + "order_flight_task": ["id": 501, "status": 40, "result_message": "本地模拟:上传媒体资源出错"], + "ui": ["phase": "post_shoot_upload_failed", "title": "素材上传失败", "commands": []] + ])) + try await wait { model.presentation.phase == .postShootUploadFailed } + window.layoutIfNeeded() + XCTAssertEqual(player.stops, 1) + XCTAssertEqual(service.count, 1) + XCTAssertNil(live.playbackSessionID) + XCTAssertNil(descendants(window).first { $0.accessibilityIdentifier == "drone.task.recordingCompletion" }) + let primary = try XCTUnwrap(descendants(controller.view).first { $0.accessibilityIdentifier == "drone.task.remote.primary" } as? UIButton) + XCTAssertEqual(primary.title(for: .normal), "查看素材") + XCTAssertTrue(primary.isEnabled) + oldFrame(.firstFrame) + controller.viewWillDisappear(false) + controller.viewDidAppear(false) + try await Task.sleep(for: .milliseconds(100)) + XCTAssertEqual(player.starts, 1) + XCTAssertEqual(service.count, 1) + XCTAssertFalse(model.shouldPresentRecordingCompletion) + XCTAssertNil(descendants(window).first { $0.accessibilityIdentifier == "drone.task.recordingCompletion" }) + try await Task.sleep(for: .milliseconds(300)) + window.layoutIfNeeded() + XCTAssertEqual(primary.titleLabel?.text, "查看素材", "实际显示文本与素材动作一致") + let attachment = XCTAttachment(image: UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + }) + attachment.name = "素材上传失败(隔离替身,无成功弹窗)" + attachment.lifetime = .keepAlways + add(attachment) + } + + private func shootDoneReturningResponse() throws -> DroneDockShootingResponse { + var value = RealtimeTestData.mediaStagePayload(wayline: 24, version: 1) + value["shoot_complete_returning"] = true + var task = try XCTUnwrap(value["order_flight_task"] as? [String: Any]) + task["finished_at"] = NSNull() + value["order_flight_task"] = task + value["ui"] = ["phase": "post_shoot_uploading", "title": "拍摄已完成", + "message": "无人机正在返航,请留意现场", "wayline_stage": "shoot_done_returning", + "shoot_complete_returning": true, "commands": []] + return try DroneDockShootingTaskTestData.decode(value) + } + + private func stream(role: String, token: String = "TEST-TOKEN") -> [String: Any] { + ["available": true, "role": role, "url_type": "volc", "expire_ts": 2_000_000_600, + "url": "app_id=test-app&room_id=TEST-\(role)&user_id=TEST-USER&token=\(token)"] + } + + private func dualResponse(droneAvailable: Bool = true, token: String = "TEST-TOKEN") throws -> DroneDockLiveResponse { + let airport = stream(role: "airport", token: token) + let drone = stream(role: "drone", token: token) + return try DroneDockRTCFixture.response(root: ["airport": airport, + "drone": droneAvailable ? drone : ["available": false, "role": "drone"], + "play": droneAvailable ? drone : airport, "protocol": ["refresh_hint_ms": 30_000]]) + } + + private func makeModel(response: DroneDockLiveResponse? = nil) throws -> (DroneDockLiveViewModel, RTCParameterProbe) { + let context = DroneDockShootingTaskTestData.context() + let service = RTCParameterProbe(response: try response ?? DroneDockRTCFixture.response()) + return (DroneDockLiveViewModel(context: context, taskID: 501, service: service, + allowsDevicePlayback: true, now: { DroneDockRTCFixture.now }, currentContext: { context }), service) + } + + private func taskPage(live: DroneDockLiveViewModel, player: RTCPlayerProbe? = nil) throws -> (DroneDockShootingTaskViewController, UIWindow) { + let context = DroneDockShootingTaskTestData.context() + let read = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: read, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, livePlayer: player ?? RTCPlayerProbe(), + shootingPollDelay: { _ in try await Task.sleep(for: .milliseconds(40)) }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return (controller, window) + } + + private func wait(_ condition: () -> Bool) async throws { + for _ in 0..<200 { + if condition() { return } + try await Task.sleep(for: .milliseconds(5)) + } + XCTFail("模拟图传生命周期未按预期完成") + } + + private func descendants(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap(descendants) } +} + +/// 可挂起的参数替身,不含网络传输。 +@MainActor +private final class RTCParameterProbe: DroneDockLiveServing { + var response: DroneDockLiveResponse + var error: Error? + var count = 0 + var suspend = false + private var continuation: CheckedContinuation? + init(response: DroneDockLiveResponse) { self.response = response } + func live(taskID: Int) async throws -> DroneDockLiveResponse { + count += 1 + if suspend { await withCheckedContinuation { continuation = $0 } } + if let error { throw error } + return response + } + func finish() { continuation?.resume(); continuation = nil } +} + +/// 手动产生播放器事件,测试不加载 RTC 引擎。 +@MainActor +private final class RTCPlayerProbe: DroneDockLivePlaying { + var starts = 0 + var stops = 0 + var event: (@MainActor (DroneDockLivePlaybackEvent) -> Void)? + func start(_ configurations: [DroneDockVolcLiveConfiguration], in view: UIView, + onEvent: @escaping @MainActor (DroneDockLivePlaybackEvent) -> Void) { starts += 1; event = onEvent } + func stop() { stops += 1; event = nil } +} diff --git a/suixinkanTests/DroneDockReadRequestPolicyTests.swift b/suixinkanTests/DroneDockReadRequestPolicyTests.swift new file mode 100644 index 0000000..67f8db4 --- /dev/null +++ b/suixinkanTests/DroneDockReadRequestPolicyTests.swift @@ -0,0 +1,112 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 两种构建均允许设备请求到达隔离传输,仅规范任务状态的缓存读取参数。 +@MainActor +final class DroneDockReadRequestPolicyTests: XCTestCase { + /// 准备页电量参数原样保留,任务与状态查询关闭实时采集;无关查询参数不变。 + func testBatteryPolicyDependsOnlyOnReadEndpoint() throws { + for (path, key) in [("plane-status", "live_battery"), ("shooting", "live_battery"), ("status", "live_metrics")] { + for value in ["0", "1"] { + var request = URLRequest(url: try XCTUnwrap(URL(string: + "https://policy.invalid/api/app/airport/\(path)?scenic_id=128&\(key)=\(value)"))) + request.httpMethod = "GET" + let prepared = try DroneDockReadRequestPolicy.prepare(request) + let items = try XCTUnwrap(URLComponents(url: XCTUnwrap(prepared.url), resolvingAgainstBaseURL: false)?.queryItems) + XCTAssertEqual(items.first { $0.name == key }?.value, path == "plane-status" ? value : "0") + XCTAssertEqual(items.first { $0.name == "scenic_id" }?.value, "128") + } + } + } + + /// 普通传输协议不需要模拟豁免标记,测试和生产环境均原样发送已知及未知设备路径。 + func testTypedDeviceRequestsReachOrdinaryInMemoryTransportInBothEnvironments() async throws { + for environment in [APIEnvironment.testing, .production] { + let session = CommandTransportProbe() + let client = APIClient(environment: environment, session: session) + let paths = ["/api/app/airport/shoot", "/api/app/airport/start-shoot", + "/api/app/airport/command", "/api/app/airport/future-control", + "/api/yf-handset-app/photog/multi-plane/tasks/create"] + for path in paths { + let _: EmptyPolicyPayload = try await client.send(APIRequest(method: .post, path: path)) + } + XCTAssertEqual(session.requests.map { $0.url?.path }, paths) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "POST" }) + } + } + + /// 请求策略不替后端校验设备路径方法,也不阻断获取图传参数。 + func testLiveAndOtherDeviceReadPathsAreNotBuildRestricted() async throws { + let session = CommandTransportProbe() + let client = APIClient(environment: .testing, session: session) + for path in ["/api/app/airport/shoot/", "/api/app/airport/command", "/api/app/airport/live"] { + let _: EmptyPolicyPayload = try await client.send(APIRequest(method: .get, path: path)) + } + XCTAssertEqual(session.requests.count, 3) + XCTAssertEqual(session.requests.last?.url?.path, "/api/app/airport/live") + } + + /// 裸 JSON 和 multipart 与强类型入口保持一致,均进入不会联网的普通传输探针。 + func testRawAndMultipartDeviceRequestsReachTransportWithoutRewritingPayload() async throws { + for environment in [APIEnvironment.testing, .production] { + let session = CommandTransportProbe() + let client = APIClient(environment: environment, session: session) + let body = #"{"id":501,"restart":true}"# + let _: EmptyPolicyPayload = try await client.sendRawJSON( + method: .post, path: "/api/app/airport/shoot", jsonBody: body) + let _: EmptyPolicyPayload = try await client.sendMultipart( + path: "/api/app/airport/command", fileName: "test.json", mimeType: "application/json", data: Data("memory-only".utf8)) + XCTAssertEqual(session.requests.count, 2) + XCTAssertEqual(session.requests[0].httpBody, Data(body.utf8)) + XCTAssertEqual(session.requests[1].url?.path, "/api/app/airport/command") + XCTAssertTrue(String(decoding: session.requests[1].httpBody ?? Data(), as: UTF8.self).contains("memory-only")) + } + } + + /// 缓存读取参数去重且补齐,明确模拟传输也遵循同一规则。 + func testStateReadsNormalizeMissingAndDuplicateFlagsForEveryTransport() async throws { + for localSimulation in [false, true] { + let probe = CommandTransportProbe() + let mock = MockURLSession(responses: Array(repeating: Data(#"{"code":100000,"data":{}}"#.utf8), count: 4)) + let session: any URLSessionProtocol = localSimulation ? mock : probe + let client = APIClient(environment: .testing, session: session) + for (path, key) in [("shooting", "live_battery"), ("status", "live_metrics")] { + for supplied in [false, true] { + var query = [URLQueryItem(name: "id", value: "501")] + if supplied { query += [URLQueryItem(name: key, value: "1"), URLQueryItem(name: key, value: "true")] } + let _: EmptyPolicyPayload = try await client.send(APIRequest( + method: .get, path: "/api/app/airport/\(path)", queryItems: query)) + let request = try XCTUnwrap(localSimulation ? mock.requests.last : probe.requests.last) + let items = try XCTUnwrap(URLComponents(url: XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems) + XCTAssertEqual(items.filter { $0.name == key }, [URLQueryItem(name: key, value: "0")]) + XCTAssertEqual(items.first { $0.name == "id" }?.value, "501") + } + } + } + } + + /// 只规范两个 GET 查询,其他方法、正文、请求头和订单路径不被修改。 + func testUnrelatedRequestsAndNonReadMethodsRemainUnchanged() throws { + for path in ["/api/app/airport/shooting", "/api/app/airport/status", "/api/app/airport/future-control", "/api/orders"] { + var request = URLRequest(url: try XCTUnwrap(URL(string: "https://policy.invalid\(path)?live_battery=1"))) + request.httpMethod = "POST" + request.httpBody = Data(#"{"id":501}"#.utf8) + request.setValue("memory-token", forHTTPHeaderField: "token") + XCTAssertEqual(try DroneDockReadRequestPolicy.prepare(request), request) + } + } +} + +/// 实现普通传输协议但绝不调用 URLSession,验证放行不会使测试连接真实设备。 +private final class CommandTransportProbe: URLSessionProtocol { + private(set) var requests: [URLRequest] = [] + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + requests.append(request) + let response = HTTPURLResponse(url: request.url!, statusCode: 200, httpVersion: nil, headerFields: nil)! + return (Data(#"{"code":100000,"data":{}}"#.utf8), response) + } +} + +/// 无业务字段的隔离响应。 +private struct EmptyPolicyPayload: Decodable {} diff --git a/suixinkanTests/DroneDockReceiptsViewModelTests.swift b/suixinkanTests/DroneDockReceiptsViewModelTests.swift new file mode 100644 index 0000000..111a135 --- /dev/null +++ b/suixinkanTests/DroneDockReceiptsViewModelTests.swift @@ -0,0 +1,327 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证真实收款记录的分页、金额分离与账号隔离,所有请求均由内存替身完成。 +@MainActor +final class DroneDockReceiptsViewModelTests: XCTestCase { + /// 只有成功的空响应才产生零汇总,并准确传递景区、套餐和第一页范围。 + func testEmptyResponseUsesServerZeroSummaryAndRequestedProject() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(summaryPaid: "0.00"))) + let model = makeModel(scope: scope, service: service, projectID: 12) + XCTAssertNil(model.summary) + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertFalse(model.hasMore) + + await model.refresh() + + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertEqual(model.summary?.count, 0) + XCTAssertEqual(model.summary?.cashPaid, Decimal.zero) + XCTAssertNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + XCTAssertFalse(model.hasMore) + XCTAssertEqual(service.requests.count, 1) + XCTAssertEqual(service.requests.first?.scenicID, 128) + XCTAssertEqual(service.requests.first?.projectID, 12) + XCTAssertEqual(service.requests.first?.page, 1) + } + + /// 相邻页重复订单更新已有行,现金和积分保留各自服务端汇总,不按已加载列表重算。 + func testPaginationDeduplicatesByOrderNumberAndPreservesSeparateAmounts() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(lastPage: 2, orders: ["A", "B"]))) + let model = makeModel(scope: scope, service: service) + await model.refresh() + XCTAssertTrue(model.hasMore) + + service.result = .success(try response(page: 2, lastPage: 2, orders: ["B", "C"], paid: "0.00", summaryPaid: "85.25", points: 100)) + await model.loadMore() + + XCTAssertEqual(model.receipts.map(\.orderNumber), ["A", "B", "C"]) + XCTAssertEqual(model.receipts[1].cashPaid, Decimal.zero) + XCTAssertEqual(model.receipts[1].pointsPaid, 100) + XCTAssertEqual(model.summary?.cashPaid, Decimal(string: "85.25")) + XCTAssertEqual(model.summary?.pointsPaid, 100) + XCTAssertEqual(model.summary?.pointAmount, Decimal(1)) + XCTAssertFalse(model.hasMore) + XCTAssertEqual(service.requests.map(\.page), [1, 2]) + await model.loadMore() + XCTAssertEqual(service.requests.count, 2) + } + + /// 翻页失败保留已有记录和汇总,点击重试仍请求失败的页码。 + func testLoadMoreFailureKeepsRecordsAndRetriesSamePage() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(lastPage: 2, orders: ["A"]))) + let model = makeModel(scope: scope, service: service) + await model.refresh() + let originalSummary = model.summary + + service.result = .failure(APIError.networkFailed("翻页网络超时")) + await model.loadMore() + + XCTAssertEqual(model.receipts.map(\.orderNumber), ["A"]) + XCTAssertEqual(model.summary, originalSummary) + XCTAssertTrue(model.errorMessage?.contains("翻页网络超时") == true) + XCTAssertTrue(model.hasMore) + XCTAssertFalse(model.isLoading) + + service.result = .success(try response(page: 2, lastPage: 2, orders: ["B"])) + await model.loadMore() + XCTAssertEqual(service.requests.map(\.page), [1, 2, 2]) + XCTAssertEqual(model.receipts.map(\.orderNumber), ["A", "B"]) + XCTAssertNil(model.errorMessage) + XCTAssertFalse(model.hasMore) + } + + /// 刷新失败不能把旧范围汇总当作当前成功结果,随后重试可以重新加载。 + func testRefreshFailureClearsSnapshotAndRetryLoadsFirstPage() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(lastPage: 2, orders: ["A"]))) + let model = makeModel(scope: scope, service: service) + await model.refresh() + + service.result = .failure(APIError.networkFailed("刷新失败")) + await model.refresh() + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertNil(model.summary) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.hasMore) + + service.result = .success(try response(orders: ["B"])) + await model.refresh() + XCTAssertEqual(model.receipts.map(\.orderNumber), ["B"]) + XCTAssertEqual(service.requests.map(\.page), [1, 1, 1]) + XCTAssertNil(model.errorMessage) + } + + /// 账号、景区、门店或 Token 任一变化时丢弃旧范围的迟到回包。 + func testIdentityChangesRejectPendingResponses() async throws { + let changedContexts = [context(userID: "other-user"), context(scenicID: 129), context(storeID: 38), context(token: "new-session")] + for (index, changed) in changedContexts.enumerated() { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub() + defer { service.cancelAll() } + let started = expectation(description: "身份隔离请求 \(index) 已挂起") + service.requestStarted = { _ in started.fulfill() } + let model = makeModel(scope: scope, service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + + scope.value = changed + service.finish(index: 0, with: .success(try response(orders: ["OLD"]))) + await pending.value + + XCTAssertTrue(model.context.hasSameIdentity(as: changed)) + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertNil(model.summary) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + XCTAssertFalse(model.hasMore) + } + } + + /// 翻页前已经换景区时清除旧数据,不能使用原分页状态查询新景区第二页。 + func testChangedIdentityBeforeLoadMoreRequiresRefresh() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(lastPage: 2, orders: ["OLD"]))) + let model = makeModel(scope: scope, service: service) + await model.refresh() + + scope.value = context(scenicID: 129) + await model.loadMore() + + XCTAssertEqual(service.requests.count, 1) + XCTAssertEqual(model.context.scenicID, 129) + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertNil(model.summary) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.hasMore) + } + + /// 刷新优先于已发出的翻页请求,旧分页结果不能混入刷新后的新列表。 + func testRefreshRejectsOldLoadMoreResponseAndDuplicateLoadMoreRequests() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(lastPage: 2, orders: ["A"]))) + defer { service.cancelAll() } + let model = makeModel(scope: scope, service: service) + await model.refresh() + service.result = nil + let moreStarted = expectation(description: "第二页已挂起") + let refreshStarted = expectation(description: "刷新第一页已挂起") + service.requestStarted = { index in + if index == 1 { moreStarted.fulfill() } + if index == 2 { refreshStarted.fulfill() } + } + let more = Task { await model.loadMore() } + await fulfillment(of: [moreStarted], timeout: 2) + await model.loadMore() + XCTAssertEqual(service.requests.count, 2) + + let refresh = Task { await model.refresh() } + await fulfillment(of: [refreshStarted], timeout: 2) + service.finish(index: 2, with: .success(try response(orders: ["NEW"]))) + await refresh.value + service.finish(index: 1, with: .success(try response(page: 2, lastPage: 2, orders: ["OLD-PAGE"]))) + await more.value + + XCTAssertEqual(model.receipts.map(\.orderNumber), ["NEW"]) + XCTAssertEqual(service.requests.map(\.page), [1, 2, 1]) + XCTAssertFalse(model.isLoading) + XCTAssertFalse(model.hasMore) + XCTAssertNil(model.errorMessage) + } + + /// 页面失效后,未完成的请求不能重新展示已清除的收款信息。 + func testInvalidateRejectsPendingResult() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub() + defer { service.cancelAll() } + let started = expectation(description: "待失效请求已挂起") + service.requestStarted = { _ in started.fulfill() } + let model = makeModel(scope: scope, service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + + model.invalidate() + service.finish(index: 0, with: .success(try response(orders: ["LATE"]))) + await pending.value + + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertNil(model.summary) + XCTAssertNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + XCTAssertFalse(model.hasMore) + } + + /// 身份不完整或套餐参数非法时本地拒绝查询,不调用任何真实或替身业务接口。 + func testMissingContextAndInvalidProjectDoNotRequest() async throws { + for invalid in [context(scenicID: 0), context(storeID: 0), context(token: "")] { + let scope = ReceiptContextBox(invalid) + let service = ReceiptServiceStub() + let model = makeModel(scope: scope, service: service) + await model.refresh() + XCTAssertTrue(service.requests.isEmpty) + XCTAssertTrue(model.receipts.isEmpty) + XCTAssertNil(model.summary) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub() + let model = makeModel(scope: scope, service: service, projectID: 0) + await model.refresh() + XCTAssertTrue(service.requests.isEmpty) + XCTAssertNotNil(model.errorMessage) + } + + /// 页码不符时保留上一页,并允许重试所请求的正确页码。 + func testUnexpectedPageDoesNotAdvanceOrReplaceExistingRecords() async throws { + let scope = ReceiptContextBox(context()) + let service = ReceiptServiceStub(result: .success(try response(lastPage: 2, orders: ["A"]))) + let model = makeModel(scope: scope, service: service) + await model.refresh() + service.result = .success(try response(orders: ["WRONG-PAGE"])) + + await model.loadMore() + + XCTAssertEqual(model.receipts.map(\.orderNumber), ["A"]) + XCTAssertTrue(model.hasMore) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + + /// 内存身份不读取、改动真机当前账号。 + private func context(userID: String = "receipt-test-user", scenicID: Int = 128, + storeID: Int = 37, token: String = "receipt-test-session") -> DroneDockHomeContext { + DroneDockHomeContext(userID: userID, accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: storeID, photographerName: "测试员工", token: token) + } + + /// 用后端 JSON 字段创建收款快照,避免测试依赖测试专用模型初始化器。 + private func response(page: Int = 1, lastPage: Int = 1, orders: [String] = [], paid: String = "10.00", + summaryPaid: String = "100.00", points: Int = 0) throws -> DroneDockReceiptsResponse { + let amounts: [String: Any] = ["cash_paid": paid, "cash_refund": "0.00", "cash_net": paid, + "points_paid": points, "points_refund": 0, "points_net": points, + "point_amount": points == 0 ? "0.00" : "1.00"] + let rows = orders.map { order -> [String: Any] in + var row = amounts + row.merge(["order_number": order, "project_id": 12, "project_name": "测试航拍套餐", + "order_status": 1, "pay_time": 1_793_081_600, "payer": "游*客"]) { _, new in new } + return row + } + var summary = amounts + summary["count"] = orders.isEmpty ? 0 : 4 + summary["cash_paid"] = summaryPaid + summary["cash_net"] = summaryPaid + let payload: [String: Any] = [ + "records": ["current_page": page, "per_page": 20, "total": orders.isEmpty ? 0 : 4, + "last_page": lastPage, "data": rows], + "summary": summary + ] + return try JSONDecoder().decode(DroneDockReceiptsResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } + + /// 统一注入本例可变化的身份和服务替身。 + private func makeModel(scope: ReceiptContextBox, service: ReceiptServiceStub, projectID: Int? = nil) -> DroneDockReceiptsViewModel { + DroneDockReceiptsViewModel(context: scope.value, service: service, currentContext: { scope.value }, projectID: projectID) + } +} + +/// 主线程上的身份替身,模拟登录或景区选择变化。 +@MainActor +private final class ReceiptContextBox { + var value: DroneDockHomeContext + + /// 保存本例初始身份。 + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 仅允许收款记录读取,支持立即结果和测试控制的异步乱序结果。 +@MainActor +private final class ReceiptServiceStub: DroneDockPaymentServing { + var result: Result? + var requestStarted: ((Int) -> Void)? + private(set) var requests: [(scenicID: Int, projectID: Int?, page: Int)] = [] + private var pending: [Int: CheckedContinuation] = [:] + + /// nil 结果表示挂起,待测试显式完成。 + init(result: Result? = nil) { self.result = result } + + /// 记录景区、套餐和页码,所有返回值都来自本例内存。 + func receipts(scenicID: Int, projectID: Int?, page: Int) async throws -> DroneDockReceiptsResponse { + let index = requests.count + requests.append((scenicID, projectID, page)) + if let result { return try result.get() } + return try await withCheckedThrowingContinuation { continuation in + pending[index] = continuation + requestStarted?(index) + } + } + + /// 收款记录模型不得额外读取可售套餐。 + func projects(scenicID: Int) async throws -> [DroneDockProject] { + XCTFail("收款记录页不应请求套餐列表") + throw APIError.networkFailed("不支持的测试请求") + } + + /// 收款记录模型不得额外创建收款码。 + func payCode(scenicID: Int, projectID: Int, price: String?) async throws -> DroneDockPayCode { + XCTFail("收款记录页不应生成收款码") + throw APIError.networkFailed("不支持的测试请求") + } + + /// 指定请求单独完成,以测试迟到结果隔离。 + func finish(index: Int, with result: Result) { + pending.removeValue(forKey: index)?.resume(with: result) + } + + /// 测试异常退出时释放挂起请求,避免 continuation 泄漏。 + func cancelAll() { + let remaining = Array(pending.values) + pending.removeAll() + remaining.forEach { $0.resume(throwing: CancellationError()) } + } +} diff --git a/suixinkanTests/DroneDockRemoteHomeViewModelTests.swift b/suixinkanTests/DroneDockRemoteHomeViewModelTests.swift new file mode 100644 index 0000000..cb13ffb --- /dev/null +++ b/suixinkanTests/DroneDockRemoteHomeViewModelTests.swift @@ -0,0 +1,482 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证三个独立首页来源、分页与会话隔离,全部网络结果由内存替身提供。 +@MainActor +final class DroneDockRemoteHomeViewModelTests: XCTestCase { + /// 空列表和零统计必须来自成功响应,初始化不会合成数据。 + func testSuccessfulEmptyResponseRemainsRealEmptyData() async throws { + let service = try ControlledHomeService() + let model = makeModel(service: service) + XCTAssertNil(model.response) + XCTAssertNil(model.ordersResponse) + XCTAssertNil(model.today) + await model.refresh() + XCTAssertEqual(model.response?.airports.count, 0) + XCTAssertTrue(model.orders.isEmpty) + XCTAssertEqual(model.orderTotal, 0) + XCTAssertEqual(model.today?.orderCount, 0) + XCTAssertFalse(model.hasMoreOrders) + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.errorMessage) + XCTAssertEqual(Set(service.requests.map(\.name)), ["home", "orders.1", "stats"]) + XCTAssertTrue(service.requests.allSatisfy { $0.scenicID == 128 }) + XCTAssertEqual(service.requests.first { $0.name == "orders.1" }?.pageSize, 20) + XCTAssertEqual(service.orderFilters, [.all]) + } + + /// 订单失败只清订单,恢复后重新显示订单服务提供的数据。 + func testOrderFailureDoesNotHideDevicesOrStatisticsAndCanRetry() async throws { + let service = try ControlledHomeService() + service.responses["stats"] = .success(try HomeFixtures.stats(count: 12)) + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["ORDER-A"], total: 1)) + let model = makeModel(service: service) + await model.refresh() + XCTAssertEqual(model.orders.map(\.orderID), ["ORDER-A"]) + + service.responses["orders.1"] = .failure(APIError.networkFailed("订单网络超时")) + await model.refresh() + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.orderTotal) + XCTAssertNotNil(model.response) + XCTAssertEqual(model.today?.orderCount, 12) + XCTAssertTrue(model.ordersErrorMessage?.contains("订单网络超时") == true) + XCTAssertNil(model.deviceErrorMessage) + XCTAssertNil(model.statisticsErrorMessage) + XCTAssertNil(model.errorMessage) + + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["ORDER-B"], total: 1)) + await model.refresh() + XCTAssertEqual(model.orders.map(\.orderID), ["ORDER-B"]) + XCTAssertNil(model.ordersErrorMessage) + } + + /// 统计失败使用未知状态,不把旧统计或零值当作成功结果。 + func testStatisticsFailureClearsOnlyStatistics() async throws { + let service = try ControlledHomeService() + service.responses["stats"] = .success(try HomeFixtures.stats(count: 9)) + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["ORDER-A"], total: 1)) + let model = makeModel(service: service) + await model.refresh() + service.responses["stats"] = .failure(APIError.networkFailed("统计失败")) + await model.refresh() + XCTAssertNil(model.today) + XCTAssertNotNil(model.statisticsErrorMessage) + XCTAssertNotNil(model.response) + XCTAssertEqual(model.orders.count, 1) + XCTAssertNil(model.errorMessage) + } + + /// 设备接口失败不影响两个订单模块接口的真实成功结果。 + func testDeviceFailureDoesNotHideOrdersOrStatistics() async throws { + let service = try ControlledHomeService() + service.responses["home"] = .failure(APIError.networkFailed("设备失败")) + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["ORDER-A"], total: 1)) + let model = makeModel(service: service) + await model.refresh() + XCTAssertNil(model.response) + XCTAssertNotNil(model.deviceErrorMessage) + XCTAssertEqual(model.orders.count, 1) + XCTAssertNotNil(model.today) + XCTAssertNil(model.errorMessage) + } + + /// 另一景区设备响应被拒绝,不能串用,但不误伤当前订单和统计。 + func testMismatchedDeviceScenicIsRejectedIndependently() async throws { + let service = try ControlledHomeService() + service.responses["home"] = .success(try HomeFixtures.home(scenicID: 999)) + let model = makeModel(service: service) + await model.refresh() + XCTAssertNil(model.response) + XCTAssertNotNil(model.deviceErrorMessage) + XCTAssertNotNil(model.ordersResponse) + XCTAssertNotNil(model.today) + } + + /// 登录或选择范围不完整时不发起任何接口调用。 + func testMissingSessionOrSelectionDoesNotCallAnyService() async throws { + for missing in [context(scenicID: 0), context(storeID: 0), context(token: "")] { + let service = try ControlledHomeService() + let scope = HomeContextBox(missing) + let model = makeModel(service: service, scope: scope) + await model.refresh() + XCTAssertTrue(service.requests.isEmpty) + XCTAssertNil(model.response) + XCTAssertNil(model.ordersResponse) + XCTAssertNil(model.today) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + } + + /// 三个请求均可在任何一个完成前发出,订单或统计不会等待设备请求。 + func testThreeSourcesStartConcurrently() async throws { + let service = try ControlledHomeService(suspended: true) + let started = expectation(description: "三个接口均已发出") + started.expectedFulfillmentCount = 3 + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let model = makeModel(service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + XCTAssertTrue(model.isLoading) + XCTAssertEqual(service.pendingCount, 3) + try service.finishRefresh(index: 0, count: 7, orderID: "ORDER-CONCURRENT") + await pending.value + XCTAssertEqual(model.today?.orderCount, 7) + XCTAssertEqual(model.orders.first?.orderID, "ORDER-CONCURRENT") + XCTAssertFalse(model.isLoading) + } + + /// 旧批次三个请求全部晚到,也不能覆盖最新刷新内容。 + func testOlderRefreshCannotOverwriteAnyNewerSection() async throws { + let service = try ControlledHomeService(suspended: true) + let firstStarted = expectation(description: "首批接口已发出") + let secondStarted = expectation(description: "第二批接口已发出") + firstStarted.expectedFulfillmentCount = 3 + secondStarted.expectedFulfillmentCount = 3 + service.requestStarted = { key in + if key.hasSuffix("#0") { firstStarted.fulfill() } + if key.hasSuffix("#1") { secondStarted.fulfill() } + } + defer { service.cancelAll() } + let model = makeModel(service: service) + let first = Task { await model.refresh() } + await fulfillment(of: [firstStarted], timeout: 2) + let second = Task { await model.refresh() } + await fulfillment(of: [secondStarted], timeout: 2) + try service.finishRefresh(index: 1, count: 20, orderID: "NEW") + await second.value + try service.finishRefresh(index: 0, count: 10, orderID: "OLD") + await first.value + XCTAssertEqual(model.today?.orderCount, 20) + XCTAssertEqual(model.orders.map(\.orderID), ["NEW"]) + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.errorMessage) + } + + /// 景区、门店、账号或 Token 变化都会丢弃整个旧批次。 + func testChangedIdentityDiscardsAllInFlightSections() async throws { + let changes = [context(scenicID: 129), context(storeID: 38), context(token: "renewed-test-token"), context(userID: "other-test-user")] + for changed in changes { + let service = try ControlledHomeService(suspended: true) + let started = expectation(description: "待切换身份的三个请求") + started.expectedFulfillmentCount = 3 + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let scope = HomeContextBox(context()) + let model = makeModel(service: service, scope: scope) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + scope.value = changed + try service.finishRefresh(index: 0, count: 3, orderID: "OLD") + await pending.value + XCTAssertEqual(model.context, changed) + XCTAssertNil(model.response) + XCTAssertNil(model.ordersResponse) + XCTAssertNil(model.today) + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + } + + /// 旧请求错误不能结束新景区正在进行的加载或写入旧错误。 + func testOldFailureDoesNotChangeNewContextLoadingState() async throws { + let service = try ControlledHomeService(suspended: true) + let firstStarted = expectation(description: "旧景区请求") + let secondStarted = expectation(description: "新景区请求") + firstStarted.expectedFulfillmentCount = 3 + secondStarted.expectedFulfillmentCount = 3 + service.requestStarted = { key in + if key.hasSuffix("#0") { firstStarted.fulfill() } + if key.hasSuffix("#1") { secondStarted.fulfill() } + } + defer { service.cancelAll() } + let scope = HomeContextBox(context()) + let model = makeModel(service: service, scope: scope) + let first = Task { await model.refresh() } + await fulfillment(of: [firstStarted], timeout: 2) + scope.value = context(scenicID: 129) + let second = Task { await model.refresh() } + await fulfillment(of: [secondStarted], timeout: 2) + service.failRefresh(index: 0) + await first.value + XCTAssertTrue(model.isLoading) + XCTAssertNil(model.errorMessage) + XCTAssertNil(model.ordersErrorMessage) + try service.finishRefresh(index: 1, scenicID: 129, count: 3, orderID: "NEW-SCENIC") + await second.value + XCTAssertEqual(model.response?.scenicID, 129) + XCTAssertEqual(model.today?.orderCount, 3) + } + + /// 主动失效后的回包不会重新填充数据。 + func testInvalidateRejectsAllPendingResponses() async throws { + let service = try ControlledHomeService(suspended: true) + let started = expectation(description: "待失效请求") + started.expectedFulfillmentCount = 3 + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let model = makeModel(service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + model.invalidate() + try service.finishRefresh(index: 0, count: 10, orderID: "STALE") + await pending.value + XCTAssertNil(model.response) + XCTAssertNil(model.ordersResponse) + XCTAssertNil(model.today) + XCTAssertNil(model.errorMessage) + XCTAssertFalse(model.isLoading) + } + + /// Swift 任务取消后,即使底层网络随后成功也不展示返回内容。 + func testCancelledRefreshRejectsSuccessfulResponses() async throws { + let service = try ControlledHomeService(suspended: true) + let started = expectation(description: "待取消请求") + started.expectedFulfillmentCount = 3 + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let model = makeModel(service: service) + let pending = Task { await model.refresh() } + await fulfillment(of: [started], timeout: 2) + pending.cancel() + try service.finishRefresh(index: 0, count: 10, orderID: "CANCELLED") + await pending.value + XCTAssertNil(model.response) + XCTAssertNil(model.ordersResponse) + XCTAssertNil(model.today) + XCTAssertFalse(model.isLoading) + } + + /// 翻页按 total 判断,重叠订单更新原卡片,不生成重复身份。 + func testPaginationUsesServerTotalAndDeduplicatesOrderNumbers() async throws { + let service = try ControlledHomeService() + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["A", "B"], total: 21)) + service.responses["orders.2"] = .success(try HomeFixtures.orders(ids: ["B", "C"], total: 21, page: 2)) + let model = makeModel(service: service) + await model.refresh() + XCTAssertEqual(model.orderTotal, 21) + XCTAssertTrue(model.hasMoreOrders) + await model.loadMoreOrders() + XCTAssertEqual(model.orders.map(\.orderID), ["A", "B", "C"]) + XCTAssertEqual(model.ordersResponse?.page, 2) + XCTAssertFalse(model.hasMoreOrders) + XCTAssertFalse(model.isLoadingMore) + XCTAssertEqual(service.requests.filter { $0.name == "home" }.count, 1) + XCTAssertEqual(service.requests.filter { $0.name == "stats" }.count, 1) + } + + /// 分页失败保留首屏,重试仍请求同一页且不重新获取设备和统计。 + func testPaginationFailurePreservesOrdersAndRetriesSamePage() async throws { + let service = try ControlledHomeService() + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["A"], total: 21)) + service.responses["orders.2"] = .failure(APIError.networkFailed("下一页超时")) + let model = makeModel(service: service) + await model.refresh() + await model.loadMoreOrders() + XCTAssertEqual(model.orders.map(\.orderID), ["A"]) + XCTAssertNotNil(model.ordersLoadMoreErrorMessage) + XCTAssertTrue(model.hasMoreOrders) + service.responses["orders.2"] = .success(try HomeFixtures.orders(ids: ["B"], total: 21, page: 2)) + await model.loadMoreOrders() + XCTAssertEqual(model.orders.map(\.orderID), ["A", "B"]) + XCTAssertNil(model.ordersLoadMoreErrorMessage) + XCTAssertEqual(service.requests.filter { $0.name == "orders.2" }.count, 2) + } + + /// 空下一页终止分页,避免数据变动时重复加载同一个空页。 + func testEmptyNextPageStopsPagination() async throws { + let service = try ControlledHomeService() + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["A"], total: 100)) + service.responses["orders.2"] = .success(try HomeFixtures.orders(ids: [], total: 100, page: 2)) + let model = makeModel(service: service) + await model.refresh() + await model.loadMoreOrders() + XCTAssertFalse(model.hasMoreOrders) + await model.loadMoreOrders() + XCTAssertEqual(service.requests.filter { $0.name == "orders.2" }.count, 1) + } + + /// 刷新重置到第一页,并阻止正在加载的旧下一页覆盖新列表。 + func testRefreshInvalidatesPendingPaginationAndResetsToFirstPage() async throws { + let service = try ControlledHomeService() + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["OLD"], total: 21)) + let model = makeModel(service: service) + await model.refresh() + service.suspendedNames = ["orders.2"] + let started = expectation(description: "第二页挂起") + service.requestStarted = { key in if key == "orders.2#0" { started.fulfill() } } + defer { service.cancelAll() } + let page = Task { await model.loadMoreOrders() } + await fulfillment(of: [started], timeout: 2) + await model.loadMoreOrders() + XCTAssertEqual(service.requests.filter { $0.name == "orders.2" }.count, 1) + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["NEW"], total: 1)) + await model.refresh() + service.finish("orders.2#0", result: .success(try HomeFixtures.orders(ids: ["STALE"], total: 21, page: 2))) + await page.value + XCTAssertEqual(model.orders.map(\.orderID), ["NEW"]) + XCTAssertEqual(model.ordersResponse?.page, 1) + XCTAssertFalse(model.hasMoreOrders) + XCTAssertFalse(model.isLoadingMore) + } + + /// 分页期间切换身份,旧订单和全部区域一并清空。 + func testIdentityChangeDuringPaginationClearsAllSections() async throws { + let service = try ControlledHomeService() + service.responses["orders.1"] = .success(try HomeFixtures.orders(ids: ["OLD"], total: 21)) + let scope = HomeContextBox(context()) + let model = makeModel(service: service, scope: scope) + await model.refresh() + service.suspendedNames = ["orders.2"] + let started = expectation(description: "旧账号下一页") + service.requestStarted = { _ in started.fulfill() } + defer { service.cancelAll() } + let page = Task { await model.loadMoreOrders() } + await fulfillment(of: [started], timeout: 2) + scope.value = context(token: "renewed-test-token") + service.finish("orders.2#0", result: .success(try HomeFixtures.orders(ids: ["STALE"], total: 21, page: 2))) + await page.value + XCTAssertTrue(model.orders.isEmpty) + XCTAssertNil(model.response) + XCTAssertNil(model.today) + XCTAssertNotNil(model.errorMessage) + XCTAssertFalse(model.isLoadingMore) + } + + private func context(scenicID: Int = 128, storeID: Int = 37, token: String = "home-test-token", userID: String = "home-test-user") -> DroneDockHomeContext { + DroneDockHomeContext(userID: userID, accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: storeID, photographerName: "测试人员", token: token) + } + + private func makeModel(service: any DroneDockHomeServing, scope: HomeContextBox? = nil) -> DroneDockHomeViewModel { + let box = scope ?? HomeContextBox(context()) + return DroneDockHomeViewModel(context: box.value, service: service, currentContext: { box.value }) + } +} + +/// 内存会话提供器,不读写真实登录信息。 +@MainActor +private final class HomeContextBox { + var value: DroneDockHomeContext + /// 保存本例使用的身份快照。 + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 使用文档字段构造确定性的三个响应。 +private enum HomeFixtures { + /// 设备响应不携带订单和统计。 + static func home(scenicID: Int = 128) throws -> Data { + try JSONSerialization.data(withJSONObject: ["scenic_id": scenicID, "airports": []]) + } + + /// 统计使用张工接口字段及金额字符串。 + static func stats(count: Int = 0) throws -> Data { + try JSONSerialization.data(withJSONObject: ["deal_count": count, "deal_amount": "0.00", "completed_count": 0, + "cash_paid": "0.00", "cash_refund": "0.00", "points_paid": 0, + "points_refund": 0, "points_net": 0]) + } + + /// 订单包含购买项目、服务端次数及明确的操作权限。 + static func orders(ids: [String] = [], total: Int = 0, page: Int = 1) throws -> Data { + let list: [[String: Any]] = ids.map { id in + ["order_number": id, "project_id": 101, "project_name": "测试套餐", "created_at": "2026-10-27 10:00:00", + "user_phone": "130****0001", "shoot_count": 3, "shot_count": 1, "remaining_count": 2, + "shoot_status": "processing", "order_status": 20, "material_status": 0, "film_count": 0, + "can_create_task": true, "can_upload_film": true, "can_confirm": false, "confirm_status": 0, + "confirmed_at": NSNull()] + } + return try JSONSerialization.data(withJSONObject: ["list": list, "total": total, "page": page, "page_size": 20]) + } +} + +/// 可独立完成每个来源、每一页的网络替身,用于精确模拟并发和乱序。 +@MainActor +private final class ControlledHomeService: DroneDockHomeServing { + /// 一次调用的参数,不包含账号真实数据。 + struct Request { + let name: String + let scenicID: Int + let pageSize: Int? + } + var responses: [String: Result] + var suspendedNames: Set = [] + var requestStarted: ((String) -> Void)? + private(set) var requests: [Request] = [] + private(set) var orderFilters: [DroneShootingOrderFilter] = [] + private let suspended: Bool + private var counts: [String: Int] = [:] + private var pending: [String: CheckedContinuation] = [:] + var pendingCount: Int { pending.count } + + /// 可选择立即返回预设数据或挂起所有调用。 + init(suspended: Bool = false) throws { + self.suspended = suspended + responses = ["home": .success(try HomeFixtures.home()), "orders.1": .success(try HomeFixtures.orders()), + "stats": .success(try HomeFixtures.stats())] + } + + /// 记录设备请求并解码预设响应。 + func home(scenicID: Int, storeID: Int) async throws -> DroneDockHomeResponse { + let data = try await request(name: "home", scenicID: scenicID) + return try JSONDecoder().decode(DroneDockHomeResponse.self, from: data) + } + + /// 按页分别记录和完成订单请求。 + func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse { + orderFilters.append(status) + let data = try await request(name: "orders.\(page)", scenicID: scenicID, pageSize: pageSize) + return try JSONDecoder().decode(DroneDockOrdersResponse.self, from: data) + } + + /// 独立记录和完成统计请求。 + func todayStats(scenicID: Int) async throws -> DroneDockHomeToday { + let data = try await request(name: "stats", scenicID: scenicID) + return try JSONDecoder().decode(DroneDockHomeToday.self, from: data) + } + + private func request(name: String, scenicID: Int, pageSize: Int? = nil) async throws -> Data { + requests.append(Request(name: name, scenicID: scenicID, pageSize: pageSize)) + let index = counts[name, default: 0] + counts[name] = index + 1 + let key = "\(name)#\(index)" + if suspended || suspendedNames.contains(name) { + return try await withCheckedThrowingContinuation { continuation in + pending[key] = continuation + requestStarted?(key) + } + } + requestStarted?(key) + guard let result = responses[name] else { throw APIError.networkFailed("未配置测试响应 \(name)") } + return try result.get() + } + + /// 完成指定调用,允许测试精确控制先后顺序。 + func finish(_ key: String, result: Result) { + pending.removeValue(forKey: key)?.resume(with: result) + } + + /// 为同一批三个接口提供成功结果。 + func finishRefresh(index: Int, scenicID: Int = 128, count: Int, orderID: String) throws { + finish("stats#\(index)", result: .success(try HomeFixtures.stats(count: count))) + finish("orders.1#\(index)", result: .success(try HomeFixtures.orders(ids: [orderID], total: 1))) + finish("home#\(index)", result: .success(try HomeFixtures.home(scenicID: scenicID))) + } + + /// 令指定旧批次全部失败。 + func failRefresh(index: Int) { + for name in ["home", "orders.1", "stats"] { + finish("\(name)#\(index)", result: .failure(APIError.networkFailed("旧请求失败"))) + } + } + + /// 清理测试未完成的请求,避免遗留 continuation。 + func cancelAll() { + let continuations = Array(pending.values) + pending.removeAll() + continuations.forEach { $0.resume(throwing: CancellationError()) } + } +} diff --git a/suixinkanTests/DroneDockRemoteHomeViewTests.swift b/suixinkanTests/DroneDockRemoteHomeViewTests.swift new file mode 100644 index 0000000..bc6534b --- /dev/null +++ b/suixinkanTests/DroneDockRemoteHomeViewTests.swift @@ -0,0 +1,1235 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 在测试窗口验证正式首页的真实数据、空态、错误显示和演示流程隔离,网络全部使用替身。 +@MainActor +final class DroneDockRemoteHomeViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 设备请求尚未返回时先展示等高空卡片,返回设备后下方模块不跳动。 + func testPendingDeviceRequestKeepsPlaceholderCardAtFullDeviceHeight() async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let gate = HomeDeviceResponseGate() + defer { Task { await gate.release() } } + let (controller, session) = makeController(responses: [populatedEnvelope], deviceResponseGate: gate) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let path = IndexPath(item: 0, section: 1) + + try await settle(window: window) { + session.requests.count == 3 && controller.viewModel.isLoading + && (collection.cellForItem(at: path) as? DroneDockDeviceCell)?.cardView.accessibilityIdentifier == "drone.device.empty" + && GlobalLoadingManager.shared.isShowing + } + let placeholder = try XCTUnwrap((collection.cellForItem(at: path) as? DroneDockDeviceCell)?.cardView) + let frame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: path)).frame + XCTAssertEqual(collection.numberOfItems(inSection: 1), 1) + XCTAssertEqual(frame.height, 248, accuracy: 0.5) + XCTAssertNil(controller.viewModel.response) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + XCTAssertTrue(window.subviews.contains { $0 is GlobalLoadingOverlayView }) + XCTAssertTrue(visibleTexts(in: placeholder).contains("暂无无人机")) + XCTAssertTrue(visibleTexts(in: placeholder).contains("正在加载")) + XCTAssertEqual(metricTexts(in: placeholder), Dictionary(uniqueKeysWithValues: metricKeys.map { ($0, "—") })) + assertUnambiguousVisibleLayout(in: placeholder) + + await gate.release() + try await settle(window: window) { + (collection.cellForItem(at: path) as? DroneDockDeviceCell)?.cardView.accessibilityIdentifier == "drone.device.58" + && !collection.hasUncommittedUpdates + } + let loadedFrame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: path)).frame + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + XCTAssertEqual(loadedFrame.minY, frame.minY, accuracy: 0.5) + XCTAssertEqual(loadedFrame.height, frame.height, accuracy: 0.5) + assertOnlyReadHomepageRequests(session) + } + + /// 成功空响应显示接口零值,不混入演示设备、订单或演示统计。 + func testSuccessfulEmptyHomeDisplaysZeroStatisticsWithoutDemoData() async throws { + let (controller, session) = makeController(responses: [emptyEnvelope]) + let window = makeWindow(root: controller) + defer { close(window) } + + try await settle(window: window) { + controller.viewModel.response != nil && controller.viewModel.today != nil + && self.visibleTexts(in: controller.view).contains("暂无拍摄订单") + } + + let texts = visibleTexts(in: controller.view) + XCTAssertEqual(controller.title, "机巢工作台") + XCTAssertTrue(texts.contains("测试景区 · 测试工作人员")) + XCTAssertTrue(texts.contains("暂无无人机")) + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let placeholder = try XCTUnwrap(find(in: controller.view, identifier: "drone.device.empty")) + XCTAssertTrue(visibleTexts(in: placeholder).contains("暂无数据")) + XCTAssertEqual(metricTexts(in: placeholder), Dictionary(uniqueKeysWithValues: metricKeys.map { ($0, "—") })) + XCTAssertEqual(collection.numberOfItems(inSection: 1), 1) + XCTAssertEqual(try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: IndexPath(item: 0, section: 1))).frame.height, 248, accuracy: 0.5) + assertUnambiguousVisibleLayout(in: placeholder) + XCTAssertFalse(texts.contains("演示状态 ⌄")) + XCTAssertFalse(texts.contains("01号无人机")) + XCTAssertFalse(texts.contains("¥1,896")) + XCTAssertTrue(controller.viewModel.response?.airports.isEmpty == true) + XCTAssertTrue(controller.viewModel.orders.isEmpty) + assertOnlyReadHomepageRequests(session) + capture(window, named: "机巢真实首页-成功空态和零值统计") + let statistics = try await statisticsCard(in: collection, window: window) + let statisticsTexts = visibleTexts(in: statistics) + XCTAssertTrue(statisticsTexts.contains("成交订单")) + XCTAssertTrue(statisticsTexts.contains("成交金额")) + XCTAssertTrue(statisticsTexts.contains("完成拍摄")) + XCTAssertTrue(statisticsTexts.contains("¥0.00")) + XCTAssertEqual(statisticsTexts.filter { $0 == "0" }.count, 2) + } + + /// 设备接口失败只影响顶部,订单空态和统计仍展示各自接口的成功结果。 + func testFailedDeviceRequestLeavesOrdersAndStatisticsAvailable() async throws { + let errorEnvelope = try TestJSON.errorEnvelope(code: 160001, msg: "机巢首页暂不可用") + let (controller, session) = makeController(responses: [errorEnvelope]) + let window = makeWindow(root: controller) + defer { close(window) } + + try await settle(window: window) { + self.visibleTexts(in: controller.view).contains("设备加载失败") + && controller.viewModel.today != nil + } + + let texts = visibleTexts(in: controller.view) + XCTAssertTrue(texts.contains { $0.contains("机巢首页暂不可用") && $0.contains("请下拉重试") }) + XCTAssertTrue(texts.contains("暂无无人机")) + XCTAssertTrue(texts.contains("暂无拍摄订单")) + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let placeholder = try XCTUnwrap(find(in: controller.view, identifier: "drone.device.empty")) + XCTAssertEqual(metricTexts(in: placeholder), Dictionary(uniqueKeysWithValues: metricKeys.map { ($0, "—") })) + XCTAssertEqual(try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: IndexPath(item: 0, section: 1))).frame.height, 248, accuracy: 0.5) + assertUnambiguousVisibleLayout(in: placeholder) + XCTAssertNil(controller.viewModel.response) + XCTAssertNotNil(controller.viewModel.ordersResponse) + XCTAssertNotNil(controller.viewModel.today) + assertOnlyReadHomepageRequests(session) + let statistics = try await statisticsCard(in: collection, window: window) + XCTAssertTrue(visibleTexts(in: statistics).contains("¥0.00")) + } + + /// 空设备与真实设备互相切换时维持顶部位置,并清除上一架设备的读数。 + func testRefreshingBetweenEmptyAndPopulatedDevicesKeepsCardSpaceAndClearsReadings() async throws { + let readings: [String: (Double, String)] = [ + "battery": (88, "88%"), "env_temp": (21.5, "21.5°C"), "wind_speed": (4.2, "4.2m/s"), + "rainfall": (1, "小雨"), "signal": (4, "良好"), "satellite": (32, "32颗") + ] + let (controller, session) = makeController(responses: [emptyEnvelope, try deviceEnvelope(metricValues: readings), emptyEnvelope]) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let devicePath = IndexPath(item: 0, section: 1) + let orderPath = IndexPath(item: 0, section: 2) + try await settle(window: window) { + controller.viewModel.response?.airports.isEmpty == true + && (collection.cellForItem(at: devicePath) as? DroneDockDeviceCell)?.cardView.accessibilityIdentifier == "drone.device.empty" + } + let emptyFrame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: devicePath)).frame + let orderY = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: orderPath)).frame.minY + let refresh = try XCTUnwrap(collection.refreshControl) + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { + (collection.cellForItem(at: devicePath) as? DroneDockDeviceCell)?.cardView.accessibilityIdentifier == "drone.device.58" + && self.metricTexts(in: controller.view) == readings.mapValues { $0.1 } + && !collection.hasUncommittedUpdates + } + let loadedFrame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: devicePath)).frame + XCTAssertEqual(loadedFrame.minY, emptyFrame.minY, accuracy: 0.5) + XCTAssertEqual(loadedFrame.height, emptyFrame.height, accuracy: 0.5) + XCTAssertEqual(try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: orderPath)).frame.minY, orderY, accuracy: 0.5) + + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { + controller.viewModel.response?.airports.isEmpty == true + && (collection.cellForItem(at: devicePath) as? DroneDockDeviceCell)?.cardView.accessibilityIdentifier == "drone.device.empty" + && !collection.hasUncommittedUpdates + } + let placeholder = try XCTUnwrap((collection.cellForItem(at: devicePath) as? DroneDockDeviceCell)?.cardView) + let finalFrame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: devicePath)).frame + XCTAssertEqual(finalFrame.minY, emptyFrame.minY, accuracy: 0.5) + XCTAssertEqual(finalFrame.height, 248, accuracy: 0.5) + XCTAssertEqual(try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: orderPath)).frame.minY, orderY, accuracy: 0.5) + XCTAssertEqual(collection.numberOfItems(inSection: 1), 1) + XCTAssertEqual(metricTexts(in: placeholder), Dictionary(uniqueKeysWithValues: metricKeys.map { ($0, "—") })) + XCTAssertFalse(visibleTexts(in: placeholder).contains("测试机巢M4D")) + XCTAssertFalse(visibleTexts(in: placeholder).contains("88%")) + XCTAssertTrue(visibleTexts(in: placeholder).contains("暂无数据")) + XCTAssertEqual(session.requests.count, 9) + assertOnlyReadHomepageRequests(session) + } + + /// 收款入口继续进入独立真实收款页,不受订单区新增导航影响。 + func testReceiptEntryStaysOutOfDemoFlow() async throws { + let (controller, session) = makeController(responses: [emptyEnvelope]) + let window = makeWindow(root: controller) + defer { close(window) } + + try await settle(window: window) { + self.visibleTexts(in: controller.view).contains("暂无拍摄订单") + } + let receipt = try XCTUnwrap(controller.navigationItem.rightBarButtonItem) + XCTAssertEqual(receipt.accessibilityIdentifier, "drone.home.receipt") + let action = try XCTUnwrap(receipt.action) + XCTAssertTrue(UIApplication.shared.sendAction(action, to: receipt.target, from: receipt, for: nil)) + try await settle(window: window) { + controller.navigationController?.topViewController is DroneDockPaymentViewController + && controller.navigationController?.transitionCoordinator == nil + } + let payment = try XCTUnwrap(controller.navigationController?.topViewController as? DroneDockPaymentViewController) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 2) + XCTAssertNil(controller.presentedViewController) + XCTAssertEqual(payment.viewModel.context.scenicID, 128) + XCTAssertNil(payment.viewModel.payCode) + XCTAssertNotNil(find(in: payment.view, identifier: "drone.payment.projectPicker")) + assertOnlyReadHomepageRequests(session) + } + + /// 首页即使没有订单也提供查看全部,打开独立真实列表而不进入演示数据。 + func testViewAllIsVisibleForEmptyHomeAndOpensRealEmptyOrders() async throws { + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: try [ + orderEnvelope([]), orderEnvelope([]) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { + controller.viewModel.orderTotal == 0 + && self.find(in: controller.view, identifier: "drone.home.allOrders") != nil + } + + let viewAll = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.allOrders") as? UIButton) + let count = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.orderCount")) + XCTAssertFalse(isHiddenByAncestor(viewAll)) + XCTAssertTrue(viewAll.isEnabled) + XCTAssertTrue(viewAll.currentTitle?.contains("查看全部") == true) + XCTAssertGreaterThanOrEqual(viewAll.convert(viewAll.bounds, to: controller.view).minX, + count.convert(count.bounds, to: controller.view).maxX) + capture(window, named: "机巢真实首页-订单右侧查看全部入口") + viewAll.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window: window) { + guard let orders = navigation.topViewController as? DroneDockOrdersViewController else { return false } + return orders.viewModel.total == 0 && !orders.viewModel.isLoading + && self.visibleTexts(in: orders.view).contains { $0.contains("暂无拍摄订单") } + && navigation.transitionCoordinator == nil + } + + let orders = try XCTUnwrap(navigation.topViewController as? DroneDockOrdersViewController) + XCTAssertEqual(orders.title, "我的拍摄订单") + XCTAssertEqual(orders.viewModel.context.scenicID, 128) + XCTAssertEqual(orders.viewModel.context.userID, "remote-home-ui-test") + XCTAssertTrue(orders.viewModel.orders.isEmpty) + XCTAssertNotNil(find(in: orders.view, identifier: "drone.orders.remote.list")) + XCTAssertTrue(visibleTexts(in: orders.view).contains("全部订单(0)")) + XCTAssertFalse(visibleTexts(in: orders.view).contains("演示状态 ⌄")) + XCTAssertEqual(navigation.viewControllers.count, 2) + XCTAssertEqual(session.requests.count, 4) + XCTAssertEqual(session.requests.filter { $0.url?.path.hasSuffix("/orders") == true }.count, 2) + assertOnlyReadHomepageRequests(session) + capture(window, named: "机巢真实全部订单-成功空态") + } + + /// 全部订单包含已完成记录,分页与刷新独立读取 orders,返回时首页重新同步。 + func testViewAllLoadsEveryStatusAndSupportsPaginationRefreshAndReturn() async throws { + var completed = orderRecord(id: 702) + completed["shoot_status"] = "completed" + completed["order_status"] = 30 + completed["shot_count"] = 1 + completed["remaining_count"] = 0 + completed["can_create_task"] = false + var firstPage = (701...720).map { orderRecord(id: $0) } + firstPage[1] = completed + let (controller, session) = makeController(responses: [emptyEnvelope, emptyEnvelope], ordersResponses: try [ + orderEnvelope([orderRecord(id: 701)]), orderEnvelope(firstPage, total: 21), + orderEnvelope([orderRecord(id: 721)], total: 21, page: 2), + orderEnvelope([orderRecord(id: 801)]), orderEnvelope([orderRecord(id: 901)]) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { controller.viewModel.orders.count == 1 } + let viewAll = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.allOrders") as? UIButton) + viewAll.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window: window) { + guard let orders = navigation.topViewController as? DroneDockOrdersViewController else { return false } + return orders.viewModel.orders.count == 20 && !orders.viewModel.isLoading + && navigation.transitionCoordinator == nil + } + let orders = try XCTUnwrap(navigation.topViewController as? DroneDockOrdersViewController) + let list = try XCTUnwrap(find(in: orders.view, identifier: "drone.orders.remote.list") as? UICollectionView) + XCTAssertEqual(orders.viewModel.total, 21) + XCTAssertTrue(orders.viewModel.hasMore) + XCTAssertEqual(orders.viewModel.orders.map(\.orderID), (701...720).map { "TEST-ORDER-\($0)" }) + XCTAssertEqual(orders.viewModel.orders[1].shootStatus, "completed") + let completedPath = IndexPath(item: 1, section: 0) + list.scrollToItem(at: completedPath, at: .centeredVertically, animated: false) + try await settle(window: window) { + list.cellForItem(at: completedPath)?.accessibilityIdentifier == "drone.orders.order.TEST-ORDER-702" + } + let completedCard = try XCTUnwrap(list.cellForItem(at: completedPath)) + XCTAssertTrue(visibleTexts(in: completedCard).contains("已完成")) + XCTAssertTrue(visibleTexts(in: completedCard).contains { $0.contains("已拍摄") && $0.contains("1") }) + XCTAssertTrue(visibleTexts(in: completedCard).contains { $0.contains("剩余") && $0.contains("0") }) + assertUnambiguousVisibleLayout(in: completedCard) + XCTAssertEqual(session.requests.count, 4, "进入列表只增加 orders 请求") + capture(window, named: "机巢真实全部订单-包含已完成记录") + + list.scrollToItem(at: IndexPath(item: 20, section: 0), at: .centeredVertically, animated: false) + try await settle(window: window) { self.find(in: orders.view, identifier: "drone.orders.loadMore") != nil } + let loadMore = try XCTUnwrap(find(in: orders.view, identifier: "drone.orders.loadMore") as? UIButton) + loadMore.sendActions(for: .touchUpInside) + try await settle(window: window) { orders.viewModel.orders.count == 21 && !orders.viewModel.hasMore } + XCTAssertEqual(orders.viewModel.orders.last?.orderID, "TEST-ORDER-721") + XCTAssertEqual(session.requests.count, 5) + let pagination = try XCTUnwrap(session.requests.last?.url) + XCTAssertTrue(pagination.path.hasSuffix("/orders")) + XCTAssertEqual(URLComponents(url: pagination, resolvingAgainstBaseURL: false)?.queryItems? + .first { $0.name == "page" }?.value, "2") + + let refresh = try XCTUnwrap(list.refreshControl) + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { orders.viewModel.orders.map(\.orderID) == ["TEST-ORDER-801"] && !orders.viewModel.isLoading } + XCTAssertEqual(orders.viewModel.total, 1) + XCTAssertFalse(orders.viewModel.hasMore) + XCTAssertEqual(session.requests.count, 6) + list.setContentOffset(CGPoint(x: 0, y: -list.adjustedContentInset.top), animated: false) + try await settle(window: window) { self.visibleTexts(in: orders.view).contains { $0.contains("TEST-ORDER-801") } } + XCTAssertFalse(visibleTexts(in: orders.view).contains { $0.contains("TEST-ORDER-701") }) + + navigation.popViewController(animated: false) + try await settle(window: window) { controller.viewModel.orders.map(\.orderID) == ["TEST-ORDER-901"] } + XCTAssertTrue(navigation.topViewController === controller) + XCTAssertEqual(navigation.viewControllers.count, 1) + XCTAssertEqual(session.requests.count, 9) + assertOnlyReadHomepageRequests(session) + } + + /// 工作台优先打开后端指定任务,返回后重新获取候选,直到 null 才恢复开始拍摄。 + func testActiveTaskOpensExistingPageAndRefreshesCandidateAfterReturn() async throws { + var first = orderRecord(id: 701) + first["active_task_id"] = 501; first["active_task_status"] = 20 + first["shot_count"] = 1; first["remaining_count"] = 0 + var second = first; second["active_task_id"] = 502 + var finished = first; finished["active_task_id"] = NSNull(); finished["active_task_status"] = NSNull() + var openedIDs: [Int] = [] + var taskSessions: [MockURLSession] = [] + let (controller, session) = makeController(responses: Array(repeating: emptyEnvelope, count: 3), + ordersResponses: try [orderEnvelope([first]), orderEnvelope([second]), orderEnvelope([finished])], + preparationControllerFactory: { _, _ in XCTFail("有执行中任务不能进入创建流程"); return UIViewController() }, + taskControllerFactory: { taskID, order, context in + openedIDs.append(taskID) + let pair = try! DroneDockActiveTaskViewFixtures.controller(taskID: taskID, order: order, context: context) + XCTAssertTrue(pair.1.requests.isEmpty) + taskSessions.append(pair.1) + return pair.0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + let navigation = try XCTUnwrap(controller.navigationController) + for taskID in [501, 502] { + try await settle(window: window) { controller.viewModel.orders.first?.activeTaskID == taskID } + let button = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.order.TEST-ORDER-701.primary") as? UIButton) + XCTAssertEqual(button.title(for: .normal), "继续查看任务") + capture(window, named: "工作台-继续查看任务") + button.sendActions(for: .touchUpInside); button.sendActions(for: .touchUpInside) + try await settle(window: window) { + (navigation.topViewController as? DroneDockShootingTaskViewController)?.viewModel.response != nil + && navigation.transitionCoordinator == nil + } + let task = try XCTUnwrap(navigation.topViewController as? DroneDockShootingTaskViewController) + XCTAssertEqual(task.viewModel.taskID, taskID) + XCTAssertEqual(task.viewModel.order.orderID, "TEST-ORDER-701") + XCTAssertEqual(task.viewModel.context.scenicID, 128) + XCTAssertEqual(navigation.viewControllers.count, 2) + let request = try XCTUnwrap(taskSessions.last?.requests.first) + XCTAssertEqual(request.url?.path, "/api/app/airport/shooting") + let params = Dictionary(uniqueKeysWithValues: (URLComponents(url: request.url!, resolvingAgainstBaseURL: false)?.queryItems ?? []).map { ($0.name, $0.value ?? "") }) + XCTAssertEqual(params["id"], String(taskID)) + XCTAssertEqual(params["live_battery"], "0") + navigation.popViewController(animated: false) + } + try await settle(window: window) { controller.viewModel.orders.first?.activeTaskID == nil && controller.viewModel.orders.count == 1 } + let button = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.order.TEST-ORDER-701.primary") as? UIButton) + XCTAssertEqual(button.title(for: .normal), "开始拍摄") + XCTAssertEqual(openedIDs, [501, 502]) + XCTAssertTrue(taskSessions.allSatisfy { $0.requests.count == 1 && $0.requests.first?.httpMethod == "GET" }) + assertOnlyReadHomepageRequests(session) + } + + /// 工作台以上传任务补足未开始或缺失的素材状态;两次已拍只查看素材,有余次进入准备。 + func testUploadingActiveTaskUsesMaterialsOrPreparationInsteadOfFlightPage() async throws { + for remaining in [0, 1] { + var order = orderRecord(id: 701) + order["shoot_count"] = 2; order["shot_count"] = 2 - remaining; order["remaining_count"] = remaining + order["shoot_status"] = "processing"; order["order_status"] = 20 + if remaining == 0 { order["material_status"] = 0 } + else { order.removeValue(forKey: "material_status") } + order["active_task_id"] = 21; order["active_task_status"] = 25 + order["can_create_task"] = remaining > 0; order["can_upload_film"] = true + var openedFlights = 0 + var openedPreparations = 0 + var openedMaterials = 0 + let destination = UIViewController() + let (controller, session) = makeController(responses: [emptyEnvelope], + ordersResponses: [try orderEnvelope([order])], + preparationControllerFactory: { selected, _ in + openedPreparations += 1 + XCTAssertEqual(selected.activeTaskID, 21) + XCTAssertNil(selected.activeFlightTaskID) + return destination + }, materialsControllerFactory: { _, _ in openedMaterials += 1; return destination }, + taskControllerFactory: { _, _, _ in openedFlights += 1; return UIViewController() }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { controller.viewModel.orders.count == 1 } + let primary = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.order.TEST-ORDER-701.primary") as? UIButton) + XCTAssertEqual(primary.title(for: .normal), remaining > 0 ? "开始拍摄" : "查看素材") + XCTAssertTrue(visibleTexts(in: controller.view).contains("进行中")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("素材上传中")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("未开始上传")) + primary.sendActions(for: .touchUpInside) + try await settle(window: window) { controller.navigationController?.topViewController === destination } + XCTAssertEqual(openedFlights, 0) + XCTAssertEqual(openedPreparations, remaining > 0 ? 1 : 0) + XCTAssertEqual(openedMaterials, remaining == 0 ? 1 : 0) + XCTAssertEqual(session.requests.count, 3) + assertOnlyReadHomepageRequests(session) + } + } + + /// 从工作台进入全部订单后仍使用同一任务入口,不能回落到准备页或默认真实网络。 + func testAllOrdersInheritsActiveTaskFactory() async throws { + var active = orderRecord(id: 802) + active["active_task_id"] = 901; active["active_task_status"] = 20 + var openedIDs: [Int] = [] + let (controller, session) = makeController(responses: [emptyEnvelope], + ordersResponses: try [orderEnvelope([orderRecord(id: 701)]), orderEnvelope([active])], + taskControllerFactory: { id, order, context in + openedIDs.append(id) + return try! DroneDockActiveTaskViewFixtures.controller(taskID: id, order: order, context: context).0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { controller.viewModel.orders.count == 1 } + try XCTUnwrap(find(in: controller.view, identifier: "drone.home.allOrders") as? UIButton).sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window: window) { + (navigation.topViewController as? DroneDockOrdersViewController)?.viewModel.orders.first?.activeTaskID == 901 + && navigation.transitionCoordinator == nil + } + let orders = try XCTUnwrap(navigation.topViewController as? DroneDockOrdersViewController) + try XCTUnwrap(find(in: orders.view, identifier: "drone.orders.order.TEST-ORDER-802.primary") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window: window) { (navigation.topViewController as? DroneDockShootingTaskViewController)?.viewModel.response != nil } + let page = try XCTUnwrap(navigation.topViewController as? DroneDockShootingTaskViewController) + XCTAssertEqual(openedIDs, [901]) + XCTAssertEqual(page.viewModel.order.orderID, "TEST-ORDER-802") + XCTAssertEqual(page.viewModel.context.storeID, 37) + XCTAssertEqual(navigation.viewControllers.count, 3) + assertOnlyReadHomepageRequests(session) + } + + /// 全部订单从自身快照进入拍摄准备,首页离开后清空状态也不会丢失订单身份。 + func testViewAllShootingUsesSelectedListOrderAndCurrentContext() async throws { + var preparationSession: MockURLSession? + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: try [ + orderEnvelope([orderRecord(id: 701)]), orderEnvelope([orderRecord(id: 802)]) + ], preparationControllerFactory: { order, context in + let result = try! DroneDockPreparationViewFixtures.controller(context: context, order: order) + preparationSession = result.1 + return result.0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { controller.viewModel.orders.count == 1 } + let viewAll = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.allOrders") as? UIButton) + viewAll.sendActions(for: .touchUpInside) + let navigation = try XCTUnwrap(controller.navigationController) + try await settle(window: window) { + guard let orders = navigation.topViewController as? DroneDockOrdersViewController else { return false } + return orders.viewModel.orders.first?.orderID == "TEST-ORDER-802" + && navigation.transitionCoordinator == nil + } + let orders = try XCTUnwrap(navigation.topViewController as? DroneDockOrdersViewController) + XCTAssertTrue(controller.viewModel.orders.isEmpty) + let button = try XCTUnwrap(find(in: orders.view, identifier: "drone.orders.order.TEST-ORDER-802.primary") as? UIButton) + XCTAssertTrue(button.isEnabled) + button.sendActions(for: .touchUpInside) + try await settle(window: window) { + (navigation.topViewController as? DroneDockRemotePreparationViewController)?.viewModel.projectInfo != nil + && navigation.transitionCoordinator == nil + } + + let preparation = try XCTUnwrap(navigation.topViewController as? DroneDockRemotePreparationViewController) + XCTAssertEqual(preparation.viewModel.order.orderID, "TEST-ORDER-802") + XCTAssertEqual(preparation.viewModel.order.projectID, 101) + XCTAssertEqual(preparation.viewModel.context.scenicID, 128) + XCTAssertEqual(preparation.viewModel.context.storeID, 37) + XCTAssertEqual(navigation.viewControllers.count, 3) + let request = try XCTUnwrap(preparationSession?.requests.first) + XCTAssertEqual(preparationSession?.requests.count, 1) + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/project-info") + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(query.first { $0.name == "order_number" }?.value, "TEST-ORDER-802") + XCTAssertEqual(query.first { $0.name == "scenic_id" }?.value, "128") + XCTAssertEqual(query.first { $0.name == "project_id" }?.value, "101") + XCTAssertEqual(session.requests.count, 4) + assertOnlyReadHomepageRequests(session) + } + + /// 真实机巢样例按服务端名称、状态展示;尚无遥测时六项读数都保持未知。 + func testRealAirportDisplaysServerNameStatusAndUnknownMetrics() async throws { + let (controller, session) = makeController(responses: [populatedEnvelope]) + let window = makeWindow(root: controller) + defer { close(window) } + + try await settle(window: window) { + self.find(in: controller.view, identifier: "drone.device.58") != nil + && self.metricTexts(in: controller.view).count == 6 + } + + let card = try XCTUnwrap(find(in: controller.view, identifier: "drone.device.58")) + let texts = visibleTexts(in: card) + XCTAssertTrue(texts.contains("测试机巢M4D")) + XCTAssertTrue(texts.contains("空闲")) + XCTAssertEqual(metricTexts(in: card), Dictionary(uniqueKeysWithValues: metricKeys.map { ($0, "—") })) + XCTAssertFalse(visibleTexts(in: controller.view).contains("设备信息暂不可用")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("暂无无人机")) + assertOnlyReadHomepageRequests(session) + capture(window, named: "机巢真实首页-设备名称状态与未知读数") + } + + /// 同一机巢刷新时保留合法零值,之后读数变未知会清除旧值而不残留在复用卡片里。 + func testDeviceRefreshKeepsZeroValuesAndClearsUnavailableReadings() async throws { + let nonzero: [String: (Double, String)] = [ + "battery": (88, "88%"), "env_temp": (21.5, "21.5°C"), "wind_speed": (4.2, "4.2m/s"), + "rainfall": (1, "小雨"), "signal": (4, "良好"), "satellite": (32, "32颗") + ] + let zero: [String: (Double, String)] = [ + "battery": (0, "0%"), "env_temp": (0, "0°C"), "wind_speed": (0, "0m/s"), + "rainfall": (0, "0"), "signal": (0, "0"), "satellite": (0, "0颗") + ] + let responses = try [deviceEnvelope(metricValues: nonzero), deviceEnvelope(metricValues: zero), populatedEnvelope] + let (controller, session) = makeController(responses: responses) + let window = makeWindow(root: controller) + defer { close(window) } + + try await settle(window: window) { self.metricTexts(in: controller.view) == nonzero.mapValues { $0.1 } } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let refresh = try XCTUnwrap(collection.refreshControl) + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { self.metricTexts(in: controller.view) == zero.mapValues { $0.1 } } + + XCTAssertEqual(session.requests.count, 6) + XCTAssertEqual(collection.numberOfItems(inSection: 1), 1) + refresh.sendActions(for: .valueChanged) + let unknown = Dictionary(uniqueKeysWithValues: metricKeys.map { ($0, "—") }) + try await settle(window: window) { self.metricTexts(in: controller.view) == unknown } + + XCTAssertEqual(session.requests.count, 9) + XCTAssertEqual(collection.numberOfItems(inSection: 1), 1) + XCTAssertNotNil(find(in: controller.view, identifier: "drone.device.58")) + assertOnlyReadHomepageRequests(session) + } + + /// 从单机刷新为多机时完整应用设备列表,并切换为能提示横向浏览的卡片宽度。 + func testRefreshingFromOneToTwoAirportsUpdatesCarousel() async throws { + let (controller, session) = makeController(responses: [populatedEnvelope, try deviceEnvelope(addSecondAirport: true)]) + let window = makeWindow(root: controller) + defer { close(window) } + + try await settle(window: window) { self.find(in: controller.view, identifier: "drone.device.58") != nil } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + XCTAssertEqual(collection.numberOfItems(inSection: 1), 1) + let devicePath = IndexPath(item: 0, section: 1) + let singleWidth = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: devicePath)).frame.width + + let refresh = try XCTUnwrap(collection.refreshControl) + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { + collection.numberOfItems(inSection: 1) == 2 + && (collection.collectionViewLayout.layoutAttributesForItem(at: devicePath)?.frame.width ?? singleWidth) < singleWidth + && (self.find(in: controller.view, identifier: "drone.home.devicePages") as? UIPageControl)?.numberOfPages == 2 + } + + let multipleWidth = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: devicePath)).frame.width + XCTAssertGreaterThan(multipleWidth, 0) + XCTAssertLessThan(multipleWidth, singleWidth) + XCTAssertEqual(controller.viewModel.response?.airports.count, 2) + let pages = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.devicePages") as? UIPageControl) + XCTAssertEqual(pages.currentPage, 0) + XCTAssertEqual(session.requests.count, 6) + assertOnlyReadHomepageRequests(session) + capture(window, named: "机巢真实首页-多设备横向卡片") + } + + /// 首次返回设备和多条订单时仍停留页首,避免 Diffable 将页面锚定到新增订单之后。 + func testInitialHomeWithEightOrdersKeepsScenicContextAndDeviceVisible() async throws { + let (controller, session) = makeController(responses: [populatedEnvelope], + ordersResponses: [try orderEnvelope((701...708).map { orderRecord(id: $0) })]) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + + try await settle(window: window) { + collection.numberOfItems(inSection: 2) == 8 + && !collection.hasUncommittedUpdates + && abs(collection.contentOffset.y + collection.adjustedContentInset.top) < 1 + && self.find(in: controller.view, identifier: "drone.device.58") != nil + } + + XCTAssertEqual(collection.contentOffset.y, -collection.adjustedContentInset.top, accuracy: 1) + XCTAssertEqual(collection.numberOfItems(inSection: 2), 8) + let visibleFrame = collection.bounds.inset(by: collection.adjustedContentInset) + let contextFrame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: IndexPath(item: 0, section: 0))).frame + let deviceFrame = try XCTUnwrap(collection.collectionViewLayout.layoutAttributesForItem(at: IndexPath(item: 0, section: 1))).frame + XCTAssertTrue(visibleFrame.contains(contextFrame), "首次加载后景区信息应完整位于可见区域") + XCTAssertTrue(visibleFrame.contains(deviceFrame), "首次加载后设备卡片应完整位于可见区域") + XCTAssertTrue(visibleTexts(in: controller.view).contains("测试景区 · 测试工作人员")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("测试机巢M4D")) + XCTAssertEqual(session.requests.count, 3) + assertOnlyReadHomepageRequests(session) + } + + /// 首页按服务端顺序呈现每条订单,字段来自响应,不替换成演示游客或套餐。 + func testOrdersDisplayServerFieldsAndPreserveServerOrder() async throws { + let orders = [orderRecord(id: 703), orderRecord(id: 701), orderRecord(id: 702)] + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: [try orderEnvelope(orders)]) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + + try await settle(window: window) { collection.numberOfItems(inSection: 2) == 3 } + for (index, id) in [703, 701, 702].enumerated() { + let card = try await orderCard(at: index, id: id, in: collection, window: window) + let texts = visibleTexts(in: card) + XCTAssertTrue(texts.contains("游客 130****0001")) + XCTAssertTrue(texts.contains("订单号 TEST-ORDER-\(id)")) + XCTAssertTrue(texts.contains("测试单次航拍 · 含 1 次拍摄")) + XCTAssertTrue(texts.contains("待拍摄")) + XCTAssertTrue(texts.contains("已拍摄 0/1 次,剩余 1 次")) + XCTAssertTrue(texts.contains("开始拍摄")) + XCTAssertFalse(texts.contains("未开始上传"), "未拍摄且素材未开始上传时隐藏素材栏") + XCTAssertFalse(texts.contains("查看素材 ›")) + XCTAssertFalse(texts.contains("上传完成")) + assertUnambiguousVisibleLayout(in: card) + } + XCTAssertFalse(visibleTexts(in: controller.view).contains("订单信息暂不可用")) + XCTAssertEqual(session.requests.count, 3) + assertOnlyReadHomepageRequests(session) + capture(window, named: "机巢真实首页-订单游客套餐状态与次数") + } + + /// 紧凑卡复用后根据当前订单的拍摄和上传状态折叠或恢复素材栏。 + func testCompactCardReuseCollapsesMaterialFooterAndRestoresNotices() throws { + let card = DroneDockCompactOrderCell(frame: CGRect(x: 0, y: 0, width: 358, height: 220)) + let cases: [(Int?, Int?, Int, String?)] = [ + (0, 25, 0, "素材上传中"), (0, nil, 0, nil), (1, nil, 1, "上传完成"), + (nil, nil, 0, nil), (99, nil, 0, nil), (2, nil, 1, "上传中"), + (3, nil, 1, "上传失败"), (0, nil, 1, "未开始上传"), + (nil, nil, 1, "素材状态待确认"), (99, nil, 1, "素材状态待确认"), + (nil, 25, 0, "素材上传中"), (0, nil, 0, nil) + ] + var collapsedHeight: CGFloat? + var expandedHeight: CGFloat? + for (materialStatus, activeStatus, shotCount, notice) in cases { + var value = orderRecord(id: 701) + value["material_status"] = materialStatus + value["active_task_status"] = activeStatus + value["active_task_id"] = 21 + value["shot_count"] = shotCount + value["remaining_count"] = 1 - shotCount + card.prepareForReuse() + card.apply(homeOrder: try JSONDecoder().decode(DroneDockHomeOrder.self, + from: JSONSerialization.data(withJSONObject: value))) + let size = card.contentView.systemLayoutSizeFitting(CGSize(width: 358, height: 0), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + card.frame.size = size + card.contentView.frame = card.bounds + card.setNeedsLayout() + card.layoutIfNeeded() + let material = try XCTUnwrap(allViews(in: card).compactMap { $0 as? UIButton } + .first { $0.accessibilityLabel?.hasPrefix("查看素材,") == true }) + let footer = try XCTUnwrap(material.superview) + let divider = try XCTUnwrap(footer.subviews.first { !($0 is UIButton) }) + XCTAssertEqual(footer.isHidden, notice == nil) + XCTAssertEqual(isHiddenByAncestor(divider), notice == nil) + if let notice { + XCTAssertEqual(material.configuration?.title, notice) + XCTAssertTrue(visibleTexts(in: card).contains("查看素材 ›")) + XCTAssertGreaterThan(footer.bounds.height, 0) + expandedHeight = size.height + } else { + XCTAssertTrue(isHiddenByAncestor(material)) + XCTAssertFalse(visibleTexts(in: card).contains("查看素材 ›")) + XCTAssertEqual(footer.bounds.height, 0, accuracy: 0.5) + if let collapsedHeight { XCTAssertEqual(size.height, collapsedHeight, accuracy: 0.5) } + collapsedHeight = size.height + } + } + XCTAssertGreaterThan(try XCTUnwrap(expandedHeight), try XCTUnwrap(collapsedHeight) + 20) + } + + /// 同一订单刷新会更新剩余次数与按钮状态,服务端移除的订单和空列表不会残留旧卡片。 + func testOrderRefreshUpdatesExistingCardAndRemovesDeletedOrders() async throws { + var completed = orderRecord(id: 701) + completed["shoot_status"] = "completed" + completed["order_status"] = 30 + completed["shot_count"] = 1 + completed["remaining_count"] = 0 + completed["can_create_task"] = false + let responses = try [ + orderEnvelope([orderRecord(id: 701), orderRecord(id: 702)]), + orderEnvelope([completed]), orderEnvelope([]) + ] + let (controller, session) = makeController(responses: Array(repeating: emptyEnvelope, count: responses.count), ordersResponses: responses) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + try await settle(window: window) { collection.numberOfItems(inSection: 2) == 2 } + _ = try await orderCard(at: 0, id: 701, in: collection, window: window) + + let refresh = try XCTUnwrap(collection.refreshControl) + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { + collection.numberOfItems(inSection: 2) == 1 + && self.visibleTexts(in: controller.view).contains("已拍摄 1/1 次,剩余 0 次") + } + let card = try await orderCard(at: 0, id: 701, in: collection, window: window) + XCTAssertTrue(visibleTexts(in: card).contains("已完成")) + XCTAssertFalse(visibleTexts(in: card).contains("已拍摄 0/1 次,剩余 1 次")) + let button = try XCTUnwrap(find(in: card, identifier: "drone.home.order.TEST-ORDER-701.primary") as? UIButton) + XCTAssertFalse(button.isEnabled) + XCTAssertEqual(visibleOrderCardIdentifiers(in: collection), ["drone.home.order.TEST-ORDER-701"]) + XCTAssertEqual(controller.viewModel.orders.map(\.orderID), ["TEST-ORDER-701"]) + assertUnambiguousVisibleLayout(in: card) + + refresh.sendActions(for: .valueChanged) + try await settle(window: window) { self.visibleTexts(in: controller.view).contains("暂无拍摄订单") } + XCTAssertEqual(collection.numberOfItems(inSection: 2), 1) + XCTAssertTrue(visibleOrderCardIdentifiers(in: collection).isEmpty) + XCTAssertTrue(controller.viewModel.orders.isEmpty) + XCTAssertEqual(session.requests.count, 9) + assertOnlyReadHomepageRequests(session) + } + + /// 首页将正确订单与景区传给真实准备页,导航只读取准备信息,不进入演示任务或发送飞行指令。 + func testOrderShootingActionOpensRealPreparationForSelectedOrder() async throws { + var preparationSession: MockURLSession? + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: [try orderEnvelope([orderRecord(id: 701)])], preparationControllerFactory: { order, context in + let result = try! DroneDockPreparationViewFixtures.controller(context: context, order: order) + preparationSession = result.1 + return result.0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + try await settle(window: window) { self.find(in: controller.view, identifier: "drone.home.order.TEST-ORDER-701") != nil } + let card = try await orderCard(at: 0, id: 701, in: collection, window: window) + let button = try XCTUnwrap(find(in: card, identifier: "drone.home.order.TEST-ORDER-701.primary") as? UIButton) + XCTAssertTrue(button.isEnabled) + button.sendActions(for: .touchUpInside) + + try await settle(window: window) { + (controller.navigationController?.topViewController as? DroneDockRemotePreparationViewController)?.viewModel.projectInfo != nil + && controller.navigationController?.transitionCoordinator == nil + } + let preparation = try XCTUnwrap(controller.navigationController?.topViewController as? DroneDockRemotePreparationViewController) + XCTAssertEqual(preparation.viewModel.order.orderID, "TEST-ORDER-701") + XCTAssertEqual(preparation.viewModel.order.projectID, 101) + XCTAssertEqual(preparation.viewModel.order.orderNumber, "TEST-ORDER-701") + XCTAssertEqual(preparation.viewModel.context.scenicID, 128) + XCTAssertEqual(preparation.viewModel.context.storeID, 37) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 2) + XCTAssertNil(controller.presentedViewController) + XCTAssertTrue(try XCTUnwrap(find(in: preparation.view, identifier: "drone.preparation.summon") as? UIButton).isEnabled) + XCTAssertEqual(preparation.viewModel.projectInfo?.order.orderNumber, "TEST-ORDER-701") + XCTAssertEqual(preparation.viewModel.projectInfo?.order.projectID, 101) + let requests = try XCTUnwrap(preparationSession?.requests) + XCTAssertEqual(requests.count, 1) + XCTAssertEqual(Set(requests.compactMap { $0.url?.path }), ["/api/yf-handset-app/photog/multi-plane/project-info"]) + for request in requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertNil(request.httpBody) + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(query.first { $0.name == "order_number" }?.value, "TEST-ORDER-701") + XCTAssertEqual(query.first { $0.name == "scenic_id" }?.value, "128") + XCTAssertEqual(query.first { $0.name == "project_id" }?.value, "101") + XCTAssertFalse(query.contains { $0.name == "lat" || $0.name == "lng" }) + } + XCTAssertEqual(session.requests.count, 3) + assertOnlyReadHomepageRequests(session) + } + + /// 首页及“查看全部”传递同一素材工厂,以各自选中订单读取真实摘要和任务。 + func testHomeAndAllOrdersUseRealMaterialsEntryForSelectedOrder() async throws { + for throughAllOrders in [false, true] { + var materialsSession: MockURLSession? + var homeOrder = orderRecord(id: 701) + homeOrder["shoot_count"] = 2 + homeOrder["shot_count"] = 1 + homeOrder["shoot_status"] = "processing" + homeOrder["material_status"] = 1 + var listOrder = orderRecord(id: 802) + listOrder["material_status"] = 2 + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: try [ + orderEnvelope([homeOrder]), orderEnvelope([listOrder]) + ], materialsControllerFactory: { order, context in + let result = try! DroneDockMaterialsNavigationFixtures.controller(context: context, order: order) + materialsSession = result.1 + XCTAssertTrue(result.1.requests.isEmpty) + return result.0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { controller.viewModel.orders.count == 1 } + let navigation = try XCTUnwrap(controller.navigationController) + let selectedNumber: String + if throughAllOrders { + try XCTUnwrap(find(in: controller.view, identifier: "drone.home.allOrders") as? UIButton).sendActions(for: .touchUpInside) + try await settle(window: window) { + (navigation.topViewController as? DroneDockOrdersViewController)?.viewModel.orders.first?.orderNumber == "TEST-ORDER-802" + && navigation.transitionCoordinator == nil + } + let orders = try XCTUnwrap(navigation.topViewController as? DroneDockOrdersViewController) + try XCTUnwrap(find(in: orders.view, identifier: "drone.orders.order.TEST-ORDER-802.materials") as? UIControl).sendActions(for: .touchUpInside) + selectedNumber = "TEST-ORDER-802" + } else { + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let card = try await orderCard(at: 0, id: 701, in: collection, window: window) + let entry = try XCTUnwrap(allViews(in: card).compactMap { $0 as? UIButton } + .first { $0.title(for: .normal) == "查看素材 ›" }) + XCTAssertFalse(isHiddenByAncestor(entry)) + XCTAssertTrue(visibleTexts(in: card).contains("上传完成")) + entry.sendActions(for: .touchUpInside) + selectedNumber = "TEST-ORDER-701" + } + try await settle(window: window) { + (navigation.topViewController as? DroneDockMaterialsViewController)?.viewModel.total == 0 + && navigation.transitionCoordinator == nil + } + let materials = try XCTUnwrap(navigation.topViewController as? DroneDockMaterialsViewController) + XCTAssertEqual(materials.viewModel.order.orderNumber, selectedNumber) + XCTAssertEqual(materials.viewModel.context.scenicID, 128) + XCTAssertEqual(materials.viewModel.context.storeID, 37) + let requests = try XCTUnwrap(materialsSession?.requests) + XCTAssertEqual(requests.compactMap { $0.url?.lastPathComponent }, ["detail", "tasks"]) + for request in requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertNil(request.httpBody) + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(query.first { $0.name == "order_number" }?.value, selectedNumber) + XCTAssertEqual(query.first { $0.name == "scenic_id" }?.value, "128") + XCTAssertFalse(query.contains { $0.name == "scenic_spot_id" || $0.name == "page" }) + } + XCTAssertEqual(session.requests.count, throughAllOrders ? 4 : 3) + assertOnlyReadHomepageRequests(session) + } + } + + /// 仅可上传成片时首页主按钮为“查看素材”,与素材栏共用真实入口。 + func testViewMaterialsPrimaryActionOpensRealMaterialsInsteadOfPreparation() async throws { + var record = orderRecord(id: 701) + record["can_create_task"] = false + record["can_confirm"] = false + record["can_upload_film"] = true + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: [try orderEnvelope([record])], + preparationControllerFactory: { _, _ in + XCTFail("查看素材不应进入拍摄准备") + return UIViewController() + }, materialsControllerFactory: { order, context in + try! DroneDockMaterialsNavigationFixtures.controller(context: context, order: order).0 + }) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + try await settle(window: window) { controller.viewModel.orders.count == 1 } + let card = try await orderCard(at: 0, id: 701, in: collection, window: window) + let button = try XCTUnwrap(find(in: card, identifier: "drone.home.order.TEST-ORDER-701.primary") as? UIButton) + XCTAssertEqual(button.title(for: .normal), "查看素材") + button.sendActions(for: .touchUpInside) + try await settle(window: window) { + (controller.navigationController?.topViewController as? DroneDockMaterialsViewController)?.viewModel.total == 0 + && controller.navigationController?.transitionCoordinator == nil + } + XCTAssertNil(controller.presentedViewController) + XCTAssertEqual(session.requests.count, 3) + assertOnlyReadHomepageRequests(session) + } + + /// 刷新后的缺失信息清除旧游客、套餐、次数和操作,不将未知拍摄次数伪装为零。 + func testMissingOrderFieldsClearPreviousDisplayWithoutInventingCounts() async throws { + let minimal: [String: Any] = ["project_id": 101, "order_number": "TEST-ORDER-701"] + let (controller, session) = makeController(responses: [emptyEnvelope, emptyEnvelope], ordersResponses: try [ + orderEnvelope([orderRecord(id: 701)]), orderEnvelope([minimal]) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + try await settle(window: window) { self.find(in: controller.view, identifier: "drone.home.order.TEST-ORDER-701") != nil } + _ = try await orderCard(at: 0, id: 701, in: collection, window: window) + try XCTUnwrap(collection.refreshControl).sendActions(for: .valueChanged) + try await settle(window: window) { self.visibleTexts(in: controller.view).contains("游客信息待确认") } + + let card = try await orderCard(at: 0, id: 701, in: collection, window: window) + let texts = visibleTexts(in: card) + XCTAssertTrue(texts.contains("套餐信息待确认")) + XCTAssertTrue(texts.contains("状态待确认")) + XCTAssertTrue(texts.contains { $0.contains("—") }) + XCTAssertFalse(texts.contains("游客 130****0001")) + XCTAssertFalse(texts.contains("测试单次航拍 · 含 1 次拍摄")) + XCTAssertFalse(texts.contains { $0.contains("0/1") || $0.contains("0/0") }) + if let button = find(in: card, identifier: "drone.home.order.TEST-ORDER-701.primary") { + XCTAssertTrue(isHiddenByAncestor(button)) + } + assertUnambiguousVisibleLayout(in: card) + XCTAssertEqual(session.requests.count, 6) + assertOnlyReadHomepageRequests(session) + } + + /// 订单失败不会清空设备或统计,也不会把失败当成暂无订单。 + func testFailedOrdersRequestDoesNotHideDevicesOrStatistics() async throws { + let ordersError = try TestJSON.errorEnvelope(code: 160001, msg: "拍摄订单暂不可用") + let stats = Data(#"{"code":100000,"msg":"success","data":{"deal_count":12,"deal_amount":"99.50","completed_count":7}}"#.utf8) + let (controller, session) = makeController(responses: [populatedEnvelope], ordersResponses: [ordersError], statsResponses: [stats]) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + try await settle(window: window) { + controller.viewModel.ordersErrorMessage != nil && controller.viewModel.today != nil + } + XCTAssertEqual(controller.viewModel.response?.airports.count, 1) + collection.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window: window) { self.visibleTexts(in: controller.view).contains("订单加载失败") } + XCTAssertFalse(visibleTexts(in: controller.view).contains("暂无拍摄订单")) + collection.scrollToItem(at: IndexPath(item: 0, section: 3), at: .centeredVertically, animated: false) + try await settle(window: window) { self.visibleTexts(in: controller.view).contains("¥99.50") } + XCTAssertTrue(visibleTexts(in: controller.view).contains("12")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("7")) + assertOnlyReadHomepageRequests(session) + } + + /// 统计失败保持未知占位,成功读取的设备与订单仍可展示。 + func testFailedStatisticsShowsUnknownInsteadOfDeviceHomeLegacyValues() async throws { + var devicePayload = try XCTUnwrap(JSONSerialization.jsonObject(with: emptyEnvelope) as? [String: Any]) + var data = try XCTUnwrap(devicePayload["data"] as? [String: Any]) + data["today"] = ["order_count": 88, "order_amount": 8888, "finished_shoot": 88] + data["orders"] = ["旧接口订单不得作为备用数据"] + devicePayload["data"] = data + let statsError = try TestJSON.errorEnvelope(code: 160001, msg: "统计服务暂不可用") + let (controller, session) = makeController(responses: [try JSONSerialization.data(withJSONObject: devicePayload)], statsResponses: [statsError]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { + controller.viewModel.statisticsErrorMessage != nil + && self.visibleTexts(in: controller.view).contains("暂无拍摄订单") + } + let texts = visibleTexts(in: controller.view) + XCTAssertTrue(texts.contains("暂无无人机")) + XCTAssertFalse(texts.contains("¥0.00")) + XCTAssertFalse(texts.contains("88")) + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + let statistics = try await statisticsCard(in: collection, window: window) + let statisticsTexts = visibleTexts(in: statistics) + XCTAssertEqual(statisticsTexts.filter { $0 == "—" }.count, 3) + XCTAssertTrue(statisticsTexts.contains { $0.contains("统计加载失败") }) + assertOnlyReadHomepageRequests(session) + } + + /// 总数取 orders.total,点击加载更多只请求订单下一页并保留已有卡片。 + func testOrderTotalAndLoadMoreUseServerPagination() async throws { + let firstPage = (701...720).map { orderRecord(id: $0) } + let (controller, session) = makeController(responses: [emptyEnvelope], ordersResponses: try [ + orderEnvelope(firstPage, total: 21), orderEnvelope([orderRecord(id: 721)], total: 21, page: 2) + ]) + let window = makeWindow(root: controller) + defer { close(window) } + let collection = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.remote.list") as? UICollectionView) + try await settle(window: window) { controller.viewModel.orders.count == 20 && controller.viewModel.hasMoreOrders } + XCTAssertEqual(controller.viewModel.orderTotal, 21) + let header = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.orderCount") as? UILabel) + XCTAssertEqual(header.text, "我的拍摄订单(21)") + collection.scrollToItem(at: IndexPath(item: 20, section: 2), at: .centeredVertically, animated: false) + try await settle(window: window) { self.find(in: controller.view, identifier: "drone.home.orders.loadMore") != nil } + let loadMore = try XCTUnwrap(find(in: controller.view, identifier: "drone.home.orders.loadMore") as? UIButton) + loadMore.sendActions(for: .touchUpInside) + try await settle(window: window) { controller.viewModel.orders.count == 21 && !controller.viewModel.hasMoreOrders } + XCTAssertEqual(controller.viewModel.orders.map(\.orderID), (701...721).map { "TEST-ORDER-\($0)" }) + XCTAssertEqual(collection.numberOfItems(inSection: 2), 21) + XCTAssertEqual(session.requests.count, 4) + let orderRequests = session.requests.filter { $0.url?.path.hasSuffix("/orders") == true } + XCTAssertEqual(orderRequests.count, 2) + let lastURL = try XCTUnwrap(orderRequests.last?.url) + let query = URLComponents(url: lastURL, resolvingAgainstBaseURL: false)?.queryItems ?? [] + XCTAssertEqual(query.first { $0.name == "page" }?.value, "2") + assertOnlyReadHomepageRequests(session) + } + + /// 张工 orders 接口的匿名夹具,包含项目身份、次数及操作权限。 + private func orderRecord(id: Int) -> [String: Any] { + [ + "order_number": "TEST-ORDER-\(id)", "project_id": 101, + "created_at": "2026-10-28 10:00:00", "user_phone": "130****0001", + "project_name": "测试单次航拍 · 含 1 次拍摄", "shoot_status": "pending", "order_status": 20, + "shoot_count": 1, "shot_count": 0, "remaining_count": 1, + "material_status": 0, "film_count": 0, "confirm_status": 0, + "can_create_task": true, "can_upload_film": false, "can_confirm": false + ] + } + + /// 订单总数由接口提供,允许大于当前页已返回数量。 + private func orderEnvelope(_ orders: [[String: Any]], total: Int? = nil, page: Int = 1) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": [ + "list": orders, "total": total ?? orders.count, "page": page, "page_size": 20 + ]]) + } + + /// 滚动到指定服务端顺序的订单,等待实际复用卡片出现再检查内容。 + private func orderCard(at index: Int, id: Int, in collection: UICollectionView, window: UIWindow) async throws -> UICollectionViewCell { + let path = IndexPath(item: index, section: 2) + collection.scrollToItem(at: path, at: .centeredVertically, animated: false) + try await settle(window: window) { + collection.cellForItem(at: path)?.accessibilityIdentifier == "drone.home.order.TEST-ORDER-\(id)" + } + return try XCTUnwrap(collection.cellForItem(at: path)) + } + + /// 将统计卡片滚入视口,避免设备模块占位高度改变后误读未创建的复用内容。 + private func statisticsCard(in collection: UICollectionView, window: UIWindow) async throws -> UICollectionViewCell { + let path = IndexPath(item: 0, section: 3) + collection.scrollToItem(at: path, at: .centeredVertically, animated: false) + try await settle(window: window) { collection.cellForItem(at: path) != nil } + return try XCTUnwrap(collection.cellForItem(at: path)) + } + + /// 只读取当前可见索引对应的订单卡,排除集合视图复用池中暂存的已删除单元格。 + private func visibleOrderCardIdentifiers(in collection: UICollectionView) -> [String] { + collection.indexPathsForVisibleItems.filter { $0.section == 2 }.sorted().compactMap { path in + guard let cell = collection.cellForItem(at: path), !isHiddenByAncestor(cell), + let identifier = cell.accessibilityIdentifier, identifier.hasPrefix("drone.home.order.") else { return nil } + return identifier + } + } + + /// 检查实际展示的卡片内容约束,隐藏素材栏和按钮不参与可见布局检查。 + private func assertUnambiguousVisibleLayout(in card: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = allViews(in: card).filter { !isHiddenByAncestor($0) && $0.hasAmbiguousLayout } + XCTAssertTrue(ambiguous.isEmpty, "卡片存在布局歧义:\(ambiguous.map { String(describing: type(of: $0)) })", file: file, line: line) + } + + /// 服务端确定的六项读数键,按标识查找而不依赖数组排序。 + private var metricKeys: [String] { ["battery", "env_temp", "wind_speed", "rainfall", "signal", "satellite"] } + + /// 按实际 home 响应结构构造替身,设备名称和序列号使用测试值。 + private var populatedEnvelope: Data { + Data(#"{"code":100000,"msg":"success","data":{"scenic_id":128,"airports":[{"id":58,"name":"测试机巢M4D","sn_number":"test-airport-sn","scenic_area_id":128,"online_status":1,"work_status":1,"work_status_label":"空闲","is_receive_order":1,"task_type":null,"metrics":[{"key":"battery","label":"电池电量","raw":null,"value":"—"},{"key":"env_temp","label":"环境温度","raw":null,"value":"—"},{"key":"wind_speed","label":"风速","raw":null,"value":"—"},{"key":"rainfall","label":"雨量","raw":null,"value":"—"},{"key":"signal","label":"信号状态","raw":null,"value":"—"},{"key":"satellite","label":"搜星状态","raw":null,"value":"—"}]}]},"time":"2026-10-27 14:38:58"}"#.utf8) + } + + /// 在真实结构中替换遥测或追加设备,构造确定的刷新与多机测试输入。 + private func deviceEnvelope(metricValues: [String: (Double, String)]? = nil, addSecondAirport: Bool = false) throws -> Data { + var envelope = try XCTUnwrap(JSONSerialization.jsonObject(with: populatedEnvelope) as? [String: Any]) + var data = try XCTUnwrap(envelope["data"] as? [String: Any]) + var airports = try XCTUnwrap(data["airports"] as? [[String: Any]]) + if let metricValues { + var metrics = try XCTUnwrap(airports[0]["metrics"] as? [[String: Any]]) + for index in metrics.indices { + let key = try XCTUnwrap(metrics[index]["key"] as? String) + let value = try XCTUnwrap(metricValues[key]) + metrics[index]["raw"] = value.0 + metrics[index]["value"] = value.1 + } + airports[0]["metrics"] = metrics + } + if addSecondAirport { + var second = airports[0] + second["id"] = 59 + second["name"] = "测试二号无人机" + second["sn_number"] = "ui-test-second-airport" + airports.append(second) + } + data["airports"] = airports + envelope["data"] = data + return try JSONSerialization.data(withJSONObject: envelope) + } + + /// 从实际设备卡获取已呈现的读数,缺少标签时不会伪造占位值。 + private func metricTexts(in view: UIView) -> [String: String] { + var values: [String: String] = [:] + for key in metricKeys { + guard let label = find(in: view, identifier: "drone.metric.\(key)") as? UILabel, + !isHiddenByAncestor(label), !label.bounds.isEmpty, let text = label.text else { continue } + values[key] = text + } + return values + } + + /// 与实际控制台响应结构一致的成功空数据,不依赖当前登录账户。 + private var emptyEnvelope: Data { + Data(#"{"code":100000,"msg":"success","data":{"scenic_id":128,"airports":[]}}"#.utf8) + } + + /// 创建按 URL 路由的三接口替身,不依赖并行请求的发出顺序。 + private func makeController(responses: [Data], ordersResponses: [Data]? = nil, statsResponses: [Data]? = nil, + deviceResponseGate: HomeDeviceResponseGate? = nil, + preparationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + materialsControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil, + taskControllerFactory: ((Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) -> (DroneDockHomeViewController, HomeViewURLSession) { + let context = DroneDockHomeContext( + userID: "remote-home-ui-test", accountType: "store_user", scenicID: 128, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "test-token" + ) + let emptyOrders = Data(#"{"code":100000,"msg":"success","data":{"list":[],"total":0,"page":1,"page_size":20}}"#.utf8) + let emptyStats = Data(#"{"code":100000,"msg":"success","data":{"deal_count":0,"deal_amount":"0.00","completed_count":0}}"#.utf8) + let session = HomeViewURLSession(responses: [ + "/api/app/airport/home": responses, + "/api/yf-handset-app/photog/multi-plane/orders": ordersResponses ?? Array(repeating: emptyOrders, count: responses.count), + "/api/yf-handset-app/photog/multi-plane/today-stats": statsResponses ?? Array(repeating: emptyStats, count: responses.count) + ], deviceResponseGate: deviceResponseGate) + let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter()) + client.bindAuthTokenProvider { "test-token" } + let viewModel = DroneDockHomeViewModel(context: context, service: DroneDockAPI(client: client), currentContext: { context }) + return (DroneDockHomeViewController(viewModel: viewModel, paymentControllerFactory: { + try! DroneDockPaymentViewFixtures.controller(context: context) + }, preparationControllerFactory: preparationControllerFactory, + materialsControllerFactory: materialsControllerFactory, taskControllerFactory: taskControllerFactory), session) + } + + /// 创建临时测试窗口,结束后恢复原窗口。 + private func makeWindow(root: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: root) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + /// 清理弹层与异步页面任务,不改变原账户及业务窗口。 + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待网络替身、Diffable 和实际窗口布局完成,不靠固定长延迟判断结果。 + private func settle(window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<150 { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 250_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("真实机巢首页未在预期时间内完成渲染") + throw NSError(domain: "DroneDockRemoteHomeViewTests", code: 1) + } + + /// 从实际可见子视图获取文本,排除被隐藏的复用视图。 + private func visibleTexts(in root: UIView) -> [String] { + allViews(in: root).compactMap { view in + guard let label = view as? UILabel, !isHiddenByAncestor(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + + /// 枚举测试窗口里的真实视图,避免读取生产代码私有字段。 + private func allViews(in view: UIView) -> [UIView] { + [view] + view.subviews.flatMap { allViews(in: $0) } + } + + /// 按稳定的辅助功能标识定位实际控件。 + private func find(in root: UIView, identifier: String) -> UIView? { + allViews(in: root).first { $0.accessibilityIdentifier == identifier } + } + + /// 排除隐藏祖先和完全透明的控件。 + private func isHiddenByAncestor(_ view: UIView) -> Bool { + if view.isHidden || view.alpha < 0.01 { return true } + return view.superview.map { isHiddenByAncestor($0) } ?? false + } + + /// 首页只读取三个约定接口,不发出任务创建或飞行控制请求。 + private func assertOnlyReadHomepageRequests(_ session: HomeViewURLSession, file: StaticString = #filePath, line: UInt = #line) { + let paths: Set = ["/api/app/airport/home", "/api/yf-handset-app/photog/multi-plane/orders", + "/api/yf-handset-app/photog/multi-plane/today-stats"] + XCTAssertEqual(Set(session.requests.compactMap { $0.url?.path }), paths, file: file, line: line) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" && paths.contains($0.url?.path ?? "") }, file: file, line: line) + } + + /// 保存测试窗口截图到 xcresult,便于核对页面样式。 + private func capture(_ window: UIWindow, named name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 按请求路径独立推进响应队列,使并行首页请求与刷新可重复验证。 +private final class HomeViewURLSession: URLSessionProtocol { + private let lock = NSLock() + private var recordedRequests: [URLRequest] = [] + private let responses: [String: [Data]] + private var indices: [String: Int] = [:] + private let deviceResponseGate: HomeDeviceResponseGate? + + /// 读取请求快照时与并行写入互斥。 + var requests: [URLRequest] { lock.withLock { recordedRequests } } + + /// 保存每个接口的独立响应序列。 + init(responses: [String: [Data]], deviceResponseGate: HomeDeviceResponseGate? = nil) { + self.responses = responses + self.deviceResponseGate = deviceResponseGate + } + + /// 请求必须命中所配置路径,不能从其他接口借用下一条响应。 + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + let result = try lock.withLock { + recordedRequests.append(request) + guard let url = request.url else { throw URLError(.badURL) } + let index = indices[url.path, default: 0] + guard let queue = responses[url.path], index < queue.count else { throw URLError(.badServerResponse) } + indices[url.path] = index + 1 + let response = HTTPURLResponse(url: url, statusCode: 200, httpVersion: nil, headerFields: nil)! + return (queue[index], response) + } + if request.url?.path == "/api/app/airport/home" { await deviceResponseGate?.wait() } + return result + } +} + +/// 确定性挂起设备响应,供测试检查请求期间的真实布局。 +private actor HomeDeviceResponseGate { + private var isReleased = false + private var continuation: CheckedContinuation? + + /// 仅在测试显式放行后结束等待,不依赖网络或固定延迟。 + func wait() async { + guard !isReleased else { return } + await withCheckedContinuation { continuation = $0 } + } + + /// 恢复挂起请求;重复调用不会重复恢复 continuation。 + func release() { + isReleased = true + continuation?.resume() + continuation = nil + } +} diff --git a/suixinkanTests/DroneDockResummonAPITests.swift b/suixinkanTests/DroneDockResummonAPITests.swift new file mode 100644 index 0000000..f8d04d5 --- /dev/null +++ b/suixinkanTests/DroneDockResummonAPITests.swift @@ -0,0 +1,75 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用隔离网络验证重新召唤合同及请求放行,不连接真实设备。 +@MainActor +final class DroneDockResummonAPITests: XCTestCase { + /// 重召唤只提交同一订单任务及布尔重启标记,不创建任务或覆盖选机、航线。 + func testResummonSendsOnlyExistingTaskAndTrueRestart() async throws { + let session = MockURLSession(responses: [Data(#"{"code":100000,"data":{"order_flight_task":{"id":501},"task_id":9001}}"#.utf8)]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "resummon-test-token" } + let receipt = try await DroneDockShootAPI(client: client).resummon(taskID: 501) + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.url?.path, "/api/app/airport/shoot") + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "resummon-test-token") + let body = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: XCTUnwrap(request.httpBody)) + XCTAssertEqual(body, .object(["id": .number(501), "restart": .bool(true)])) + XCTAssertNotNil(receipt.dataJSON) + } + + /// 非正任务 ID 和调用前取消均在进入传输前终止。 + func testInvalidAndCancelledRequestsNeverReachTransport() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + for id in [0, -1] { + do { _ = try await api.resummon(taskID: id); XCTFail("无效任务不应发送") } catch {} + } + let task = Task { try await api.resummon(taskID: 501) } + task.cancel() + do { _ = try await task.value; XCTFail("已取消请求不应发送") } catch is CancellationError {} + XCTAssertTrue(session.requests.isEmpty) + } + + /// 明确拒绝和超时均不在 API 层重发 POST。 + func testRejectedOrTimedOutResummonDoesNotRetry() async throws { + let rejection = MockURLSession(responses: [Data(#"{"code":100099,"msg":"模拟重启拒绝","data":[]}"#.utf8)]) + do { + _ = try await DroneDockShootAPI(client: APIClient(environment: .testing, session: rejection)).resummon(taskID: 501) + XCTFail("业务拒绝不能成功") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "模拟重启拒绝") + } + XCTAssertEqual(rejection.requests.count, 1) + let timeout = MockURLSession(results: [.failure(URLError(.timedOut))]) + do { + _ = try await DroneDockShootAPI(client: APIClient(environment: .testing, session: timeout)).resummon(taskID: 501) + XCTFail("超时不能成功") + } catch {} + XCTAssertEqual(timeout.requests.count, 1) + } + + /// 重召唤可进入普通传输;隔离探针只记录调用,不访问网络。 + func testRestartReachesOrdinaryInMemoryTransport() async throws { + let probe = ResummonTransportProbe() + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: probe)) + do { _ = try await api.resummon(taskID: 501); XCTFail("隔离传输主动失败") } + catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(probe.requestCount, 1) + } +} + +/// 没有网络能力的普通传输探针,用于核对请求确已到达传输层。 +private final class ResummonTransportProbe: URLSessionProtocol { + private(set) var requestCount = 0 + + /// 记录后立即失败,永不回退 URLSession。 + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + requestCount += 1 + throw URLError(.unsupportedURL) + } +} diff --git a/suixinkanTests/DroneDockResummonLiveViewTests.swift b/suixinkanTests/DroneDockResummonLiveViewTests.swift new file mode 100644 index 0000000..a2b8680 --- /dev/null +++ b/suixinkanTests/DroneDockResummonLiveViewTests.swift @@ -0,0 +1,294 @@ +import AVFoundation +import UIKit +import XCTest +@testable import suixinkan + +/// 通过隔离模拟入口验证重新召唤与图传区域交互,不连接后端或无人机。 +@MainActor +final class DroneDockResummonLiveViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 双击重召唤只提交一次原任务,回查更新页面,固定区域与旧读数保持不变。 + func testResummonSuccessUsesSameTaskOnceAndPreservesFixedLayout() async throws { + let controller = try makeController(kind: "resummon", result: "success") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canResummon } + let fixedIDs = ["top", "stateContainer", "safety"] + let frames = try fixedIDs.map { try XCTUnwrap(find(controller.view, suffix: $0)).frame } + let oldTitle = model.presentation.title + let oldBatch = try XCTUnwrap(model.response?.executionBatch) + let oldBattery = find(controller.view, suffix: "metric.battery")?.accessibilityValue + let button = try XCTUnwrap(find(controller.view, suffix: "failureRetry") as? UIButton) + capture(window, name: "重新召唤-失败任务-本地模拟") + + button.sendActions(for: .touchUpInside) + button.sendActions(for: .touchUpInside) + XCTAssertFalse(button.isEnabled) + XCTAssertEqual(model.presentation.title, oldTitle) + XCTAssertEqual(find(controller.view, suffix: "metric.battery")?.accessibilityValue, oldBattery) + try await settle(window) { + (model.response?.executionBatch ?? 0) > oldBatch + && !model.isResummoning && model.presentation.phase == .ready + } + XCTAssertFalse(model.hasSubmittedResummon, "新的执行批次应清除上一批次的重召唤锁") + XCTAssertFalse(model.canResummon) + XCTAssertTrue(model.canStartShooting) + for (suffix, frame) in zip(fixedIDs, frames) { + XCTAssertEqual(find(controller.view, suffix: suffix)?.frame, frame) + } + capture(window, name: "重新召唤-同任务回查成功-本地模拟") + + let entries = try await records(controller, window: window, name: "重新召唤-成功") + XCTAssertEqual(entries.compactMap { $0["method"] as? String }, ["GET", "POST", "GET"]) + let posts = entries.filter { $0["method"] as? String == "POST" } + XCTAssertEqual(posts.count, 1) + XCTAssertEqual(posts.first?["path"] as? String, "/api/app/airport/shoot") + let body = try XCTUnwrap(posts.first?["request_body"] as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["id", "restart"]) + XCTAssertEqual(body["id"] as? Int, 901) + XCTAssertEqual(body["restart"] as? Bool, true) + XCTAssertEqual(entries.filter { $0["path"] as? String == "/api/app/airport/shooting" }.count, 2) + XCTAssertFalse(entries.contains { ($0["path"] as? String)?.contains("/tasks/create") == true }) + } + + /// 明确业务拒绝保留失败快照,只有用户再次点击才重新请求,不偷偷创建任务。 + func testResummonBusinessFailureAllowsExplicitRetry() async throws { + let controller = try makeController(kind: "resummon", result: "business-failure") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canResummon } + let original = model.response + let button = try XCTUnwrap(find(controller.view, suffix: "failureRetry") as? UIButton) + button.sendActions(for: .touchUpInside) + try await settle(window) { model.resummonErrorMessage != nil && !model.isResummoning } + XCTAssertFalse(model.resummonOutcomeUnknown) + XCTAssertFalse(model.hasSubmittedResummon) + XCTAssertEqual(model.response, original) + XCTAssertTrue(model.canResummon) + XCTAssertTrue(button.isEnabled) + capture(window, name: "重新召唤-业务拒绝-本地模拟") + + button.sendActions(for: .touchUpInside) + try await settle(window) { model.resummonErrorMessage != nil && !model.isResummoning } + let entries = try await records(controller, window: window, name: "重新召唤-明确拒绝后手动重试") + XCTAssertEqual(entries.compactMap { $0["method"] as? String }, ["GET", "POST", "POST"]) + XCTAssertTrue(entries.filter { $0["method"] as? String == "POST" }.allSatisfy { + $0["path"] as? String == "/api/app/airport/shoot" + && ($0["request_body"] as? [String: Any])?["restart"] as? Bool == true + }) + XCTAssertFalse(entries.contains { ($0["path"] as? String)?.contains("/tasks/create") == true }) + } + + /// 超时后锁定重复重召唤,旧失败快照不解锁,只允许手动读取同一任务。 + func testResummonTimeoutKeepsReadRefreshButPreventsSecondPost() async throws { + let controller = try makeController(kind: "resummon", result: "timeout") + let window = makeWindow(controller) + defer { close(window) } + let model = controller.viewModel + try await settle(window) { model.canResummon } + let button = try XCTUnwrap(find(controller.view, suffix: "failureRetry") as? UIButton) + button.sendActions(for: .touchUpInside) + try await settle(window) { model.resummonOutcomeUnknown && !model.isResummoning } + XCTAssertFalse(model.canResummon) + XCTAssertEqual(model.presentation.action, .refresh) + capture(window, name: "重新召唤-超时待核对-本地模拟") + + let refresh = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.remote.navigationRefresh" + }) + XCTAssertTrue(refresh.isEnabled) + send(refresh) + try await settle(window) { !model.isLoading && model.resummonOutcomeUnknown } + XCTAssertFalse(model.canResummon) + let entries = try await records(controller, window: window, name: "重新召唤-超时后只读回查") + XCTAssertEqual(entries.filter { $0["method"] as? String == "POST" }.count, 1) + XCTAssertEqual(entries.filter { $0["path"] as? String == "/api/app/airport/shooting" }.count, 2) + XCTAssertFalse(entries.contains { ($0["path"] as? String)?.contains("/tasks/create") == true }) + } + + /// 图传只读取一次并播放明确标记的本地样片;离开页面后释放 AVPlayer。 + func testLocalLivePreviewIsLabeledDoesNotPollAndStopsOnLeaving() async throws { + let controller = try makeController(kind: "live", result: "success") + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { + controller.liveViewModel.playbackURL != nil && !controller.viewModel.isLoading + } + let url = try XCTUnwrap(controller.liveViewModel.playbackURL) + XCTAssertTrue(url.isFileURL) + XCTAssertEqual(controller.liveViewModel.state, .localPreview(url)) + let source = try XCTUnwrap(find(controller.view, suffix: "live.source") as? UILabel) + XCTAssertFalse(source.isHidden) + XCTAssertEqual(source.text, "本地模拟画面 · 未连接无人机") + let feed = try XCTUnwrap(find(controller.view, suffix: "feedPlaceholder")) + let playerLayer = try XCTUnwrap(feed.layer.sublayers?.compactMap { $0 as? AVPlayerLayer }.first) + XCTAssertNotNil(playerLayer.player) + capture(window, name: "图传-明确标记的本地画面") + try await Task.sleep(nanoseconds: 350_000_000) + + let entries = try await records(controller, window: window, name: "图传-单次本地请求") + let liveEntries = entries.filter { $0["path"] as? String == "/api/app/airport/live" } + XCTAssertEqual(liveEntries.count, 1) + XCTAssertEqual(liveEntries.first?["method"] as? String, "GET") + XCTAssertEqual(liveEntries.first?["query"] as? String, "id=901") + XCTAssertFalse(entries.contains { $0["method"] as? String == "POST" }) + + controller.dismiss(animated: false) + try await settle(window) { controller.presentedViewController == nil } + controller.navigationController?.pushViewController(UIViewController(), animated: false) + try await settle(window) { playerLayer.player == nil } + XCTAssertNil(controller.liveViewModel.playbackURL) + } + + /// 接口只返回设备和任务时显示缺少播放参数,不用演示视频伪装真实流。 + func testLiveMissingPlaybackParametersShowsUnavailableWithoutPlayer() async throws { + let controller = try makeController(kind: "live", result: "missing-parameters") + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { controller.liveViewModel.response != nil && !controller.liveViewModel.isLoading } + XCTAssertEqual(controller.liveViewModel.state, .unavailable("暂未提供图传播放参数")) + XCTAssertNil(controller.liveViewModel.playbackURL) + XCTAssertEqual((find(controller.view, suffix: "live.status") as? UILabel)?.text, "暂未提供图传播放参数") + XCTAssertTrue(try XCTUnwrap(find(controller.view, suffix: "live.badge")).isHidden, + "实时标识整体隐藏后,内部文案标签不需要单独隐藏") + let feed = try XCTUnwrap(find(controller.view, suffix: "feedPlaceholder")) + XCTAssertNil(feed.layer.sublayers?.compactMap { $0 as? AVPlayerLayer }.first?.player) + capture(window, name: "图传-缺少播放参数") + let entries = try await records(controller, window: window, name: "图传-缺少播放参数") + XCTAssertEqual(entries.filter { $0["path"] as? String == "/api/app/airport/live" }.count, 1) + XCTAssertFalse(entries.contains { $0["method"] as? String == "POST" }) + } + + /// 图传业务拒绝和超时均显示错误并允许显式重试,快速双击不叠加请求。 + func testLiveFailureAndTimeoutCanRetryWithoutStartingDeviceCommands() async throws { + for result in ["business-failure", "timeout"] { + let controller = try makeController(kind: "live", result: result) + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { + if case .failed = controller.liveViewModel.state { return !controller.liveViewModel.isLoading } + return false + } + XCTAssertNil(controller.liveViewModel.playbackURL) + XCTAssertFalse(controller.liveViewModel.message.isEmpty) + XCTAssertEqual((find(controller.view, suffix: "live.title") as? UILabel)?.text, "图传加载失败") + let button = try XCTUnwrap(find(controller.view, suffix: "live.request") as? UIButton) + XCTAssertTrue(button.isEnabled) + button.sendActions(for: .touchUpInside) + button.sendActions(for: .touchUpInside) + try await settle(window) { + if case .failed = controller.liveViewModel.state { return !controller.liveViewModel.isLoading } + return false + } + capture(window, name: "图传-\(result)-本地模拟") + let entries = try await records(controller, window: window, name: "图传-\(result)-手动重试") + XCTAssertEqual(entries.filter { $0["path"] as? String == "/api/app/airport/live" }.count, 2) + XCTAssertFalse(entries.contains { $0["method"] as? String == "POST" }) + } + } + + /// 默认页面不注入图传或重召唤能力,仅用隔离替身读取状态,保护不依赖模拟入口标签。 + func testMissingServicesDoNotEnableLiveOrResummon() async throws { + let context = DroneDockShootingTaskTestData.context() + let service = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model) + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { model.response != nil && !model.isLoading } + XCTAssertEqual(controller.liveViewModel.state, .unavailable("当前页面未配置图传服务")) + XCTAssertFalse(controller.liveViewModel.canLoad) + XCTAssertFalse(model.canResummon) + XCTAssertNil(controller.liveViewModel.playbackURL) + XCTAssertTrue(try XCTUnwrap(find(controller.view, suffix: "live.request")).isHidden) + XCTAssertEqual((find(controller.view, suffix: "live.title") as? UILabel)?.text, "图传暂不可用") + XCTAssertEqual(service.requests.count, 1) + } + + private func makeController(kind: String, result: String) throws -> DroneDockShootingTaskViewController { + try XCTUnwrap(DroneDockStartShootSimulation.makeController( + arguments: ["--dock-\(kind)-mock", "--dock-\(kind)-result=\(result)"]) + as? DroneDockShootingTaskViewController) + } + + private func records(_ controller: UIViewController, window: UIWindow, name: String) async throws -> [[String: Any]] { + let item = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.mock.recordsButton" + }) + XCTAssertTrue(item.isEnabled) + send(item) + try await settle(window) { controller.presentedViewController != nil } + let sheet = try XCTUnwrap(controller.presentedViewController) + let text = try XCTUnwrap(allViews(sheet.view).first { + $0.accessibilityIdentifier == "drone.task.mock.records" + } as? UITextView) + let data = Data(text.text.utf8) + let attachment = XCTAttachment(data: data, uniformTypeIdentifier: "public.json") + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + let transcript = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + XCTAssertEqual(transcript["source"] as? String, "local_mock") + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + return try XCTUnwrap(transcript["records"] as? [[String: Any]]) + } + + private func capture(_ window: UIWindow, name: String) { + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } + + private func send(_ item: UIBarButtonItem) { + guard let action = item.action else { return XCTFail("缺少导航操作") } + _ = UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + + private func makeWindow(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 80_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 15_000_000) + } + XCTFail("重新召唤或图传页面未在预期时间内完成状态更新") + throw NSError(domain: "DroneDockResummonLiveViewTests", code: 1) + } + + private func find(_ root: UIView, suffix: String) -> UIView? { + allViews(root).first { $0.accessibilityIdentifier == "drone.task.remote.\(suffix)" } + } + + private func allViews(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews($0) } } +} diff --git a/suixinkanTests/DroneDockResummonViewModelTests.swift b/suixinkanTests/DroneDockResummonViewModelTests.swift new file mode 100644 index 0000000..38eebe9 --- /dev/null +++ b/suixinkanTests/DroneDockResummonViewModelTests.swift @@ -0,0 +1,349 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 重召唤的同任务、防重和旧快照保护;全部依赖只在内存运行。 +@MainActor +final class DroneDockResummonViewModelTests: XCTestCase { + /// 正式入口未注入重启服务,即使任务失败也不会开放操作。 + func testDefaultReadonlyModelCannotResummon() async throws { + let fixture = try ResummonFixture(enabled: false) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + await fixture.model.resummon() + XCTAssertTrue(fixture.write.requests.isEmpty) + } + + /// 只开放当前任务明确失败的模拟状态,离线、返航及身份不完整不允许请求。 + func testIncompleteOrUnavailableSnapshotDoesNotPermitResummon() async throws { + let samples = [ + try ResummonData.snapshot(phase: "shooting", status: 20), + try ResummonData.snapshot(phase: "returning"), + try ResummonData.snapshot(canRestart: false), + try ResummonData.snapshot(includeFlightControl: false), + try ResummonData.snapshot(plane: ["id": 58, "online_status": 2]), + try ResummonData.snapshot(plane: ["id": 0]), + try DroneDockShootingTaskTestData.response(changes: ["task": ["status": 40], "order_flight_task": ["status": 40]]) + ] + for snapshot in samples { + let fixture = try ResummonFixture() + fixture.read.result = .success(snapshot) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canResummon) + await fixture.model.resummon() + XCTAssertTrue(fixture.write.requests.isEmpty) + } + } + + /// 受理回执不切换成到达,待同任务 GET 成功后才更新状态。 + func testSuccessPreservesOldSnapshotUntilSingleSameTaskRefresh() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + let previous = fixture.model.response + let next = try ResummonData.snapshot(phase: "arrived_pending_start", status: 20, batch: 101) + fixture.write.onRequest = { fixture.read.result = .success(next) } + var sawReceiptWithOldSnapshot = false + await fixture.model.resummon { + if fixture.model.resummonResponse != nil && fixture.model.response == previous { + sawReceiptWithOldSnapshot = true + XCTAssertTrue(fixture.model.isResummoning) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + } + } + XCTAssertTrue(sawReceiptWithOldSnapshot) + XCTAssertEqual(fixture.write.requests, [501]) + XCTAssertEqual(fixture.read.requests.map(\.taskID), [501, 501]) + XCTAssertEqual(fixture.model.response, next) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertTrue(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.hasSubmittedResummon, "新执行批次清理上一批次的重召唤锁") + XCTAssertFalse(fixture.model.isResummoning) + } + + /// 后端仍返回旧失败快照时,刷新或离页回来不能使已受理重启再次发送。 + func testStaleFailureNeverReopensAcceptedResummon() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + await fixture.model.resummon() + XCTAssertEqual(fixture.model.presentation.phase, .failed) + XCTAssertEqual(fixture.model.presentation.action, .refresh) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + fixture.model.invalidate(preservingSnapshot: true) + await fixture.model.refresh() + await fixture.model.resummon() + XCTAssertEqual(fixture.write.requests, [501]) + XCTAssertTrue(fixture.model.hasSubmittedResummon) + XCTAssertFalse(fixture.model.resummonOutcomeUnknown) + } + + /// 明确业务拒绝保留旧画面,仅用户再次点击时允许重试同一个任务。 + func testBusinessRejectionAllowsExplicitRetry() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + fixture.write.result = .failure(APIError.serverCode(100099, "模拟设备暂不可重启")) + await fixture.model.resummon() + XCTAssertEqual(fixture.model.resummonErrorMessage, "模拟设备暂不可重启") + XCTAssertFalse(fixture.model.resummonOutcomeUnknown) + XCTAssertTrue(fixture.model.canResummon) + XCTAssertEqual(fixture.read.requests.count, 1) + fixture.write.result = .success(ResummonData.receipt()) + await fixture.model.resummon() + XCTAssertEqual(fixture.write.requests, [501, 501]) + } + + /// 超时、HTTP 或解码错误结果未知,后续刷新只能查看,不能重复重启或控制。 + func testUnknownOutcomeRemainsLockedAcrossRefresh() async throws { + for failure in [APIError.networkFailed("超时"), APIError.httpStatus(500, "错误"), APIError.decodeFailed("损坏回执")] { + let fixture = try ResummonFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.write.result = .failure(failure) + await fixture.model.resummon() + XCTAssertTrue(fixture.model.resummonOutcomeUnknown) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertTrue(fixture.model.statusMessage.contains("重新召唤结果待核对")) + XCTAssertEqual(fixture.model.presentation.action, .refresh) + fixture.model.invalidate(preservingSnapshot: true) + fixture.read.result = .success(try ResummonData.snapshot(phase: "arrived_pending_start", status: 20, version: 2)) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + await fixture.model.resummon() + XCTAssertEqual(fixture.write.requests, [501]) + } + } + + /// 后端明确拒绝不被记录成结果未知,也不在失活时重发。 + func testBusinessRejectionIsNotUnknownRemoteOutcome() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + fixture.write.result = .failure(APIError.serverCode(100050, "服务暂不可用,请稍后重试")) + await fixture.model.resummon() + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertFalse(fixture.model.resummonOutcomeUnknown) + XCTAssertNil(fixture.model.resummonResponse) + XCTAssertEqual(fixture.model.resummonErrorMessage, "服务暂不可用,请稍后重试") + XCTAssertEqual(fixture.read.requests.count, 1) + } + + /// 重启在途禁止第二次重启、开拍、控制和刷新,旧快照仍可显示。 + func testPendingResummonMutuallyExcludesOtherOperations() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.write.suspend = true + let sent = expectation(description: "重启进入内存服务") + fixture.write.onRequest = { sent.fulfill() } + let pending = Task { await fixture.model.resummon() } + await fulfillment(of: [sent], timeout: 2) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertTrue(fixture.model.isResummoning) + await fixture.model.resummon() + await fixture.model.startShooting() + await fixture.model.sendCommand(.pause) + await fixture.model.refresh() + XCTAssertEqual(fixture.write.requests, [501]) + XCTAssertEqual(fixture.read.requests.count, 1) + XCTAssertEqual(fixture.actions.startCount, 0) + XCTAssertEqual(fixture.actions.commandCount, 0) + fixture.write.finish() + await pending.value + } + + /// 取消或页面失效后即使服务迟到返回成功,也不得回填或继续 GET。 + func testCancellationOrInvalidationIgnoresLateReceipt() async throws { + for invalidate in [false, true] { + let fixture = try ResummonFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.write.suspend = true + let sent = expectation(description: "重启挂起") + fixture.write.onRequest = { sent.fulfill() } + let pending = Task { await fixture.model.resummon() } + await fulfillment(of: [sent], timeout: 2) + if invalidate { fixture.model.invalidate(preservingSnapshot: true) } else { pending.cancel() } + fixture.write.finish() + await pending.value + XCTAssertTrue(fixture.model.resummonOutcomeUnknown) + XCTAssertNil(fixture.model.resummonResponse) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertEqual(fixture.read.requests.count, 1) + XCTAssertFalse(fixture.model.isResummoning) + } + } + + /// 切换账号范围前不发请求,切换期间迟到回执撤下旧状态。 + func testIdentityChangeBeforeOrDuringSubmissionRejectsOldScope() async throws { + let before = try ResummonFixture() + await before.model.refresh() + before.scope.scenicID = 999 + await before.model.resummon() + XCTAssertTrue(before.write.requests.isEmpty) + XCTAssertNil(before.model.response) + let during = try ResummonFixture() + await during.model.refresh() + during.write.onRequest = { during.scope.scenicID = 999 } + await during.model.resummon() + XCTAssertNil(during.model.response) + XCTAssertNil(during.model.resummonResponse) + XCTAssertNil(during.model.resummonErrorMessage) + XCTAssertEqual(during.read.requests.count, 1) + } + + /// 错误订单任务身份不能当作成功;顶层航线 task_id 与订单任务不同是允许的。 + func testMismatchedReceiptDoesNotTriggerRead() async throws { + for json in [#"{"order_flight_task_id":999}"#, #"{"order_flight_task":{"id":999}}"#, + #"{"order_flight_task":{"order_number":"OTHER"}}"#, #"{"order_flight_task":{"scenic_id":999}}"#, + #"{"plane_id":999}"#] { + let fixture = try ResummonFixture() + await fixture.model.refresh() + fixture.write.result = .success(DroneDockShootResponse(dataJSON: json)) + await fixture.model.resummon() + XCTAssertTrue(fixture.model.resummonOutcomeUnknown) + XCTAssertNil(fixture.model.resummonResponse) + XCTAssertEqual(fixture.read.requests.count, 1) + } + } + + /// 受理后回查失败仍保留回执和旧状态,允许手动回查,不重复写入。 + func testAcceptedResummonWithFailedRefreshKeepsReceiptAndOldSnapshot() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.read.result = .failure(APIError.networkFailed("模拟查询失败")) + await fixture.model.resummon() + XCTAssertNotNil(fixture.model.resummonResponse) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertFalse(fixture.model.resummonOutcomeUnknown) + XCTAssertEqual(fixture.model.presentation.action, .refresh) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertFalse(fixture.model.canResummon) + } + + /// 前一次开拍成功后任务失败,重启的新就绪快照可开始新一轮拍摄。 + func testNewReadySnapshotResetsPreviousStartSubmissionLock() async throws { + let fixture = try ResummonFixture() + fixture.read.result = .success(try ResummonData.snapshot(phase: "arrived_pending_start", status: 20)) + await fixture.model.refresh() + await fixture.model.startShooting() + XCTAssertTrue(fixture.model.hasSubmittedStart) + fixture.read.result = .success(try ResummonData.snapshot(version: 2)) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canResummon) + let nextReady = try ResummonData.snapshot(phase: "arrived_pending_start", status: 20, batch: 101) + fixture.write.onRequest = { fixture.read.result = .success(nextReady) } + await fixture.model.resummon() + XCTAssertFalse(fixture.model.hasSubmittedStart) + XCTAssertTrue(fixture.model.canStartShooting) + } + + /// 调用前已取消不发送,也不设置未知结果。 + func testCancelledBeforeSubmissionDoesNotSend() async throws { + let fixture = try ResummonFixture() + await fixture.model.refresh() + let pending = Task { await fixture.model.resummon() } + pending.cancel() + await pending.value + XCTAssertTrue(fixture.write.requests.isEmpty) + XCTAssertFalse(fixture.model.resummonOutcomeUnknown) + } +} + +/// 每个用例独立的只读、重启和控制替身,不访问共享登录状态。 +@MainActor +private struct ResummonFixture { + let scope = ResummonScope() + let read: DroneDockShootingTaskTestService + let write = ResummonWriteService() + let actions = ResummonOtherActions() + let model: DroneDockShootingTaskViewModel + + init(enabled: Bool = true) throws { + read = DroneDockShootingTaskTestService(result: .success(try ResummonData.snapshot())) + let boundScope = scope + model = DroneDockShootingTaskViewModel(context: boundScope.value, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: read, startService: actions, + commandService: actions, resummonService: enabled ? write : nil, currentContext: { boundScope.value }) + } +} + +/// 用于模拟请求前后的景区身份切换。 +@MainActor +private final class ResummonScope { + var scenicID = 128 + var value: DroneDockHomeContext { DroneDockShootingTaskTestData.context(scenicID: scenicID) } +} + +/// 支持挂起和错误注入的重启服务,无网络传输能力。 +@MainActor +private final class ResummonWriteService: DroneDockResummonServing { + var result: Result = .success(ResummonData.receipt()) + var onRequest: (() -> Void)? + var suspend = false + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + + /// 记录同一任务并返回当前合成回执。 + func resummon(taskID: Int) async throws -> DroneDockShootResponse { + requests.append(taskID) + onRequest?() + if suspend { return try await withCheckedThrowingContinuation { continuation = $0 } } + return try result.get() + } + + /// 结束挂起请求,允许测试取消和迟到回执。 + func finish() { continuation?.resume(with: result); continuation = nil } +} + +/// 用于验证开拍、指令与重启互斥的隔离替身。 +@MainActor +private final class ResummonOtherActions: DroneDockStartShooting, DroneDockCommandSending { + private(set) var startCount = 0 + private(set) var commandCount = 0 + + /// 返回合成开拍受理,不改变读取快照。 + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + startCount += 1 + return try JSONDecoder().decode(DroneDockStartShootResponse.self, from: Data(#"{"order_flight_task_id":501,"plane_id":58}"#.utf8)) + } + + /// 记录安全指令,不向设备发送请求。 + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + commandCount += 1 + throw APIError.serverCode(100099, "测试指令未启用") + } +} + +/// 合成状态明确标记模拟来源,订单任务 ID 与航线任务 ID 使用不同值。 +private enum ResummonData { + /// 构造失败或后续阶段快照,供验证受理回执不会覆盖真实状态。 + static func snapshot(phase: String = "failed", status: Int = 40, + plane: [String: Any] = ["id": 58, "online_status": 1, "work_status": 1], + canRestart: Bool = true, includeFlightControl: Bool = true, + batch: Int = 100, version: Int = 1) throws -> DroneDockShootingResponse { + let returning = phase == "returning" + let starting = phase == "going_to_spot" + let returned = status == 40 && !returning + let control = DroneDockShootingTaskTestData.flightControl( + state: returned ? "returned" : returning ? "returning" : starting ? "starting" : "executing", batch: batch, + canPause: status == 20 && !starting, canResume: false, canReturn: status == 20, + returnReason: returning ? "manual" : nil, droneInDock: returned || starting ? "inside" : "outside", + isAirborne: !returned && !starting, pauseReason: phase == "arrived_pending_start" ? "arrival_wait" : nil) + return try DroneDockShootingTaskTestData.response(changes: [ + "execution_batch": batch, "state_version": version, "snapshot_kind": "full", + "flight_control": includeFlightControl ? control : NSNull(), + "restart_gate": ["can_restart": canRestart, "code": canRestart ? "ok" : "blocked"], + "order_flight_task": ["id": 501, "status": status], "task": ["id": 501, "status": status], + "current_plane": plane, + "execute_gate": ["can_execute": phase == "arrived_pending_start", "primary_action": "start_shoot"], + "ui": ["phase": phase, "title": "模拟阶段", "message": "本地模拟,无真实设备指令", + "commands": [["command": "flighttask_pause"]]]]) + } + + /// 顶层 task_id 是航线任务,不应误判为订单任务 ID 不一致。 + static func receipt() -> DroneDockShootResponse { + DroneDockShootResponse(dataJSON: #"{"order_flight_task":{"id":501},"task_id":9001,"source":"local_mock"}"#) + } +} diff --git a/suixinkanTests/DroneDockShootAPITests.swift b/suixinkanTests/DroneDockShootAPITests.swift new file mode 100644 index 0000000..af5fad9 --- /dev/null +++ b/suixinkanTests/DroneDockShootAPITests.swift @@ -0,0 +1,163 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证召唤只使用已有任务,成功回执保留原 JSON,所有写请求均通过网络替身验证。 +@MainActor +final class DroneDockShootAPITests: XCTestCase { + /// 按本轮联调要求只发送任务与非重启标记,完全省略 plane_id。 + func testShootSendsOneAuthenticatedPOSTWithOnlyTaskIDAndRestart() async throws { + let session = MockURLSession(responses: [try envelope(data: [:])]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "shoot-test-token" } + _ = try await DroneDockShootAPI(client: client).shoot(taskID: 501) + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/app/airport/shoot") + XCTAssertNil(request.url?.query) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "shoot-test-token") + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["id", "restart"]) + XCTAssertEqual(body["id"] as? Int, 501) + XCTAssertNil(body["plane_id"]) + XCTAssertEqual(body["restart"] as? Bool, false) + let typedBody = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: XCTUnwrap(request.httpBody)) + guard case .object(let values) = typedBody else { return XCTFail("请求必须是 JSON 对象") } + XCTAssertEqual(values["restart"], .bool(false)) + } + + /// 无效任务身份不发送召唤,也不尝试创建任务或选机。 + func testInvalidTaskIDIsRejectedBeforeSending() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + for taskID in [0, -1] { + do { + _ = try await api.shoot(taskID: taskID) + XCTFail("无效任务 ID 不应发送") + } catch {} + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 调用前已取消的任务不会向服务端提交召唤。 + func testCancelledTaskDoesNotSendPOST() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + let pending = Task { @MainActor in try await api.shoot(taskID: 501) } + pending.cancel() + do { + _ = try await pending.value + XCTFail("已取消任务不应发送召唤") + } catch is CancellationError {} + XCTAssertTrue(session.requests.isEmpty) + } + + /// 只有 100000 算业务成功,失败码的 null 或空数据不能被 emptyData 适配误判成功。 + func testBusinessFailureWithEmptyDataPreservesCodeAndMessage() async throws { + for data: Any in [NSNull(), [:] as [String: Any], [] as [Any]] { + let session = MockURLSession(responses: [try envelope(data: data, code: 100099, message: "暂无可用无人机")]) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shoot(taskID: 501) + XCTFail("业务拒绝不能当作成功") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "暂无可用无人机") + } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 用户提供的真实业务失败体:HTTP 200 和空数组不改变 41901 未报备语义。 + func testRealFilingResponsePreservesCodeAndMessage() async throws { + let message = "该无人机今日未完成起飞报备,请先提交报备截图" + let session = MockURLSession(responses: [try envelope(data: [] as [Any], code: 41901, message: message)]) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shoot(taskID: 501) + XCTFail("未报备不能视为召唤成功") + } catch let APIError.serverCode(code, actualMessage) { + XCTAssertEqual(code, 41901) + XCTAssertEqual(actualMessage, message) + } + XCTAssertEqual(session.requests.count, 1) + } + + /// 超时结果不明确时接口层不重试同一写请求。 + func testTimeoutIsNotAutomaticallyRetried() async throws { + let session = MockURLSession(results: [.failure(URLError(.timedOut))]) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shoot(taskID: 501) + XCTFail("超时不能当作成功") + } catch let APIError.networkFailed(message) { + XCTAssertFalse(message.isEmpty) + } + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(session.requests.first?.url?.path, "/api/app/airport/shoot") + } + + /// HTTP 失败即使携带成功业务码也不能转为召唤业务成功。 + func testHTTPFailureIsNotConvertedIntoEmptySuccess() async throws { + let session = MockURLSession(responses: [try envelope(data: NSNull())], statusCode: 500) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shoot(taskID: 501) + XCTFail("HTTP 失败不应成功") + } catch let APIError.httpStatus(code, _) { + XCTAssertEqual(code, 500) + } + XCTAssertEqual(session.requests.count, 1) + } + + /// 畸形响应仍是解析错误,不被成功空 data 的兼容分支吞掉。 + func testMalformedJSONRemainsDecodeFailureWithoutRetry() async throws { + let session = MockURLSession(responses: [Data("{\"code\":100000,\"data\":".utf8)]) + let api = DroneDockShootAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shoot(taskID: 501) + XCTFail("畸形 JSON 不应成功") + } catch let APIError.decodeFailed(message) { + XCTAssertFalse(message.isEmpty) + } + XCTAssertEqual(session.requests.count, 1) + } + + /// 已确认业务成功的 null 或缺失 data 仍算成功,但不伪造可展示 JSON。 + func testBusinessSuccessWithNullOrMissingDataHasNoFabricatedJSON() async throws { + let missing = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success"]) + for response in [try envelope(data: NSNull()), missing] { + let session = MockURLSession(responses: [response]) + let result = try await DroneDockShootAPI(client: APIClient(environment: .testing, session: session)).shoot(taskID: 501) + XCTAssertNil(result.dataJSON) + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 成功 data 的未知对象、空数组、数字和 false 均保留,不要求未约定的任务身份字段。 + func testSuccessDataPreservesArbitraryJSONIncludingEmptyAndFalse() async throws { + let object: [String: Any] = ["future": ["flag": false, "value": NSNull()], + "items": ["001", 0, 12.5, NSNull()], "url": "https://example.invalid/test"] + for data: Any in [object, [:] as [String: Any], [] as [Any], false, 0, "accepted"] { + let session = MockURLSession(responses: [try envelope(data: data)]) + let result = try await DroneDockShootAPI(client: APIClient(environment: .testing, session: session)).shoot(taskID: 501) + let text = try XCTUnwrap(result.dataJSON) + let displayed = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: Data(text.utf8)) + let originalData = try JSONSerialization.data(withJSONObject: data, options: [.fragmentsAllowed]) + let original = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: originalData) + XCTAssertEqual(displayed, original) + XCTAssertEqual(session.requests.count, 1) + if case .object(let fields) = displayed { + XCTAssertNil(fields["task_id"]) + XCTAssertNil(fields["plane_id"]) + XCTAssertNil(fields["code"]) + } + } + } + + private func envelope(data: Any, code: Int = 100000, message: String = "success") throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": data]) + } +} diff --git a/suixinkanTests/DroneDockShootDoneReturningTests.swift b/suixinkanTests/DroneDockShootDoneReturningTests.swift new file mode 100644 index 0000000..0a47386 --- /dev/null +++ b/suixinkanTests/DroneDockShootDoneReturningTests.swift @@ -0,0 +1,263 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证正常拍完返航标记与真实任务结果独立,HTTP/WS 均只消费隔离快照。 +@MainActor +final class DroneDockShootDoneReturningTests: XCTestCase { + /// 新字段保持缺失、null 和真假语义,手动返航结果码也原样保留。 + func testReturningFieldsDecodeMissingNullTrueAndFalse() throws { + for flag: Bool? in [nil, false, true] { + var value = payload() + var ui = try XCTUnwrap(value["ui"] as? [String: Any]) + if let flag { + value["shoot_complete_returning"] = flag + ui["shoot_complete_returning"] = flag + ui["wayline_stage"] = "shoot_done_returning" + } else { + value.removeValue(forKey: "shoot_complete_returning") + ui.removeValue(forKey: "shoot_complete_returning") + ui.removeValue(forKey: "wayline_stage") + } + value["ui"] = ui + let result = try DroneDockShootingTaskTestData.decode(value) + XCTAssertEqual(result.shootCompleteReturning, flag) + XCTAssertEqual(result.ui?.shootCompleteReturning, flag) + XCTAssertEqual(result.ui?.waylineStage, flag == nil ? nil : "shoot_done_returning") + } + var nullable = payload() + nullable["shoot_complete_returning"] = NSNull() + nullable["ui"] = ["phase": "post_shoot_uploading", "shoot_complete_returning": NSNull(), "wayline_stage": NSNull()] + nullable["task"] = ["id": 501, "status": 20, "result_code": "return_home"] + nullable["order_flight_task"] = ["id": 501, "status": 20, "result_code": "return_home"] + let result = try DroneDockShootingTaskTestData.decode(nullable) + XCTAssertNil(result.shootCompleteReturning) + XCTAssertNil(result.ui?.shootCompleteReturning) + XCTAssertNil(result.ui?.waylineStage) + XCTAssertEqual(result.task?.resultCode, "return_home") + XCTAssertEqual(result.orderFlightTask?.resultCode, "return_home") + } + + /// 顶层、UI 布尔或阶段任一明确标记均能展示正常返航说明,不要求任务终态成功。 + func testExplicitReturningMarkersPreserveExecutingTaskAndExposeMaterials() async throws { + let markers: [(Bool?, Bool?, String?)] = [ + (true, nil, nil), (nil, true, nil), (nil, nil, "shoot_done_returning"), + (true, true, "shoot_done_returning") + ] + for (root, nested, stage) in markers { + for wayline in [20, 24] { + let fixture = try makeFixture(payload(root: root, nested: nested, stage: stage, wayline: wayline)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .postShootUploading) + XCTAssertEqual(fixture.model.presentation.title, "拍摄已完成") + XCTAssertTrue(fixture.model.presentation.message.contains("无人机正在返航,请留意现场")) + XCTAssertTrue(fixture.model.isShootCompleteReturning) + XCTAssertTrue(fixture.model.isRecordingFinished) + XCTAssertTrue(fixture.model.shouldPresentRecordingCompletion) + XCTAssertEqual(fixture.model.presentation.action, .materials) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertEqual(fixture.model.response?.task?.status, 20) + XCTAssertEqual(fixture.model.response?.orderFlightTask?.status, 20) + XCTAssertEqual(fixture.model.response?.task?.waylineStatus, wayline) + XCTAssertNil(fixture.model.countdownRemainingSeconds) + XCTAssertEqual(fixture.actions.startCount + fixture.actions.resummonCount, 0) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertTrue(fixture.service.requests.allSatisfy { !$0.liveBattery }) + } + } + } + + /// 明确 false 优先于另一处 true、阶段残值和旧设备返航文案,避免继续展示已撤销标记。 + func testExplicitFalseVetoesConflictingReturningMarkers() async throws { + for (root, nested) in [(false, true), (true, false), (false, false)] { + var value = payload(root: root, nested: nested, stage: "shoot_done_returning") + value["current_plane"] = ["id": 58, "work_status": 2, "work_status_label": "正在返航"] + let fixture = try makeFixture(value) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertFalse(fixture.model.presentation.message.contains("无人机正在返航")) + XCTAssertEqual(fixture.model.presentation.phase, .postShootUploading) + XCTAssertEqual(fixture.model.presentation.action, .materials) + } + } + + /// 真实上传或渲染状态覆盖滞留的返航标记,但不会改写拍摄已经完成的页面阶段。 + func testUploadingAndRenderingOverrideStaleReturningFlags() async throws { + for wayline in [30, 40] { + let fixture = try makeFixture(payload(root: true, nested: true, stage: "shoot_done_returning", wayline: wayline)) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertFalse(fixture.model.presentation.message.contains("无人机正在返航")) + XCTAssertEqual(fixture.model.presentation.title, "拍摄已完成") + XCTAssertEqual(fixture.model.presentation.phase, .postShootUploading) + XCTAssertTrue(fixture.model.shouldPresentRecordingCompletion) + XCTAssertEqual(fixture.model.response?.task?.waylineStatus, wayline) + } + } + + /// 同批次切到上传后说明随完整快照更新,旧返航版本不能再次覆盖上传说明。 + func testReturningSnapshotTransitionsToUploadAndRejectsOldVersion() async throws { + let fixture = try makeFixture(payload()) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.isShootCompleteReturning) + fixture.service.result = .success(try DroneDockShootingTaskTestData.decode( + payload(root: false, nested: false, stage: nil, wayline: 30, version: 2))) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertFalse(fixture.model.presentation.message.contains("无人机正在返航")) + XCTAssertEqual(fixture.model.response?.stateVersion, 2) + XCTAssertEqual(fixture.model.response?.task?.waylineStatus, 30) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(payload())), .outdated) + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertEqual(fixture.model.response?.task?.waylineStatus, 30) + } + + /// 低电等未拍完返航、任务失败与取消优先于错误残留的完成标记。 + func testPartialFailureAndCancellationNeverBecomeSuccessfulRecording() async throws { + for (status, wayline, phase) in [(40, 29, "failed_restartable"), (40, 91, "failed_restartable"), + (50, 90, "post_shoot_uploading"), (60, 20, "post_shoot_uploading")] { + var value = payload() + value["task"] = ["id": 501, "status": status, "wayline_status": wayline] + value["order_flight_task"] = ["id": 501, "status": status, "result_code": "wayline_\(wayline)", + "result_message": "本地模拟:未拍完提前返航"] + value["ui"] = ["phase": phase, "wayline_stage": "shoot_done_returning", "shoot_complete_returning": true, + "message": "本地模拟:未拍完提前返航", "commands": []] + let fixture = try makeFixture(value) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertNotEqual(fixture.model.presentation.action, .materials) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.response?.orderFlightTask?.status, status) + } + } + + /// 手动返航结果码即使伴随残留的运行中摘要或乐观 UI,也必须保持中断失败。 + func testManualReturnHomeResultCodeOverridesResidualCompletedUI() async throws { + for status in [20, 40] { + for field in ["task", "order_flight_task"] { + var value = payload() + value["task"] = ["id": 501, "status": status, "wayline_status": 24] + value["order_flight_task"] = ["id": 501, "status": status] + var task = try XCTUnwrap(value[field] as? [String: Any]) + task["result_code"] = "return_home" + task["result_message"] = "立即返航中断任务" + value[field] = task + let fixture = try makeFixture(value) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .failed) + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertNotEqual(fixture.model.presentation.action, .materials) + XCTAssertFalse(fixture.model.canStartShooting) + } + } + } + + /// 标记只细分可信的录制后阶段,不能凭标记把拍摄中或未知阶段提升为完成。 + func testMarkersDoNotPromoteShootingOrUnknownPhaseToCompletion() async throws { + for phase in ["shooting", "future_phase", "blocked"] { + var value = payload(wayline: 20) + value["ui"] = ["phase": phase, "shoot_complete_returning": true, "wayline_stage": "shoot_done_returning"] + let fixture = try makeFixture(value) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertFalse(fixture.model.isRecordingFinished) + XCTAssertNotEqual(fixture.model.presentation.action, .materials) + } + } + + /// 缺少新字段的旧快照仍可兼容明确设备返航文案,不凭普通忙碌状态编造返航。 + func testLegacySnapshotsUseOnlyExplicitReturningDeviceLabel() async throws { + for label in ["返航中", "正在返航", "拍摄中", "空闲"] { + var value = payload(root: nil, nested: nil, stage: nil) + value["current_plane"] = ["id": 58, "work_status": 2, "work_status_label": label] + let fixture = try makeFixture(value) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.message.contains("无人机正在返航"), ["返航中", "正在返航"].contains(label)) + } + } + + /// HTTP 和 WS 使用同一个完整快照,在飞行任务仍执行中时呈现一致的返航完成界面。 + func testHTTPAndWebSocketNormalReturningSnapshotsAreEquivalent() async throws { + let value = payload() + let http = try makeFixture(value) + await http.model.refresh() + let socket = try makeFixture(payload(root: nil, nested: nil, stage: nil, wayline: 20)) + guard case .snapshot(let snapshot) = try DroneDockShootingSocketMessage.decode(RealtimeTestData.push(value)) else { + return XCTFail("正常返航完整 WS 快照应可解析") + } + XCTAssertEqual(socket.model.applyTaskSnapshot(snapshot), .applied) + XCTAssertEqual(socket.model.presentation, http.model.presentation) + XCTAssertTrue(socket.model.isShootCompleteReturning) + XCTAssertEqual(socket.model.response?.shootCompleteReturning, true) + XCTAssertEqual(socket.model.response?.ui?.waylineStage, "shoot_done_returning") + XCTAssertTrue(socket.service.requests.isEmpty) + XCTAssertEqual(socket.actions.startCount + socket.actions.resummonCount, 0) + } + + /// 新批次上传阶段不会被旧批次或其他任务的返航标记污染。 + func testOlderBatchAndWrongTaskMarkersCannotRestoreReturningNotice() async throws { + let fixture = try makeFixture(payload(root: false, nested: false, stage: nil, wayline: 30, batch: 101, version: 3)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode( + payload(batch: 100, version: 999))), .outdated) + var wrongTask = payload(batch: 101, version: 4) + wrongTask["order_flight_task_id"] = 502 + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(wrongTask)), .invalid) + XCTAssertFalse(fixture.model.isShootCompleteReturning) + XCTAssertEqual(fixture.model.response?.executionBatch, 101) + XCTAssertEqual(fixture.model.response?.stateVersion, 3) + XCTAssertEqual(fixture.model.response?.task?.waylineStatus, 30) + } + + private func payload(root: Bool? = true, nested: Bool? = true, stage: String? = "shoot_done_returning", + wayline: Int = 24, batch: Int = 100, version: Int = 1) -> [String: Any] { + var value = DroneDockShootingTaskTestData.payload() + value["order_flight_task_id"] = 501 + value["execution_batch"] = batch + value["state_version"] = version + value["snapshot_kind"] = "full" + value["task"] = ["id": 501, "status": 20, "wayline_status": wayline] + value["order_flight_task"] = ["id": 501, "status": 20] + value["current_plane"] = ["id": 58, "work_status": 1, "online_status": 1, "work_status_label": "空闲"] + value["execute_gate"] = ["can_execute": false, "primary_action": "blocked"] + if let root { value["shoot_complete_returning"] = root } + var ui: [String: Any] = ["phase": "post_shoot_uploading", "title": "拍摄已完成", "commands": []] + if let nested { ui["shoot_complete_returning"] = nested } + if let stage { ui["wayline_stage"] = stage } + value["ui"] = ui + return value + } + + private func makeFixture(_ payload: [String: Any]) throws -> (model: DroneDockShootingTaskViewModel, + service: DroneDockShootingTaskTestService, actions: ShootDoneReturningActions) { + let context = DroneDockShootingTaskTestData.context() + let service = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.decode(payload))) + let actions = ShootDoneReturningActions() + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: service, startService: actions, + resummonService: actions, currentContext: { context }) + return (model, service, actions) + } +} + +/// 仅记录潜在误触发的控制调用,不存在真实网络或设备传输。 +@MainActor +private final class ShootDoneReturningActions: DroneDockStartShooting, DroneDockResummonServing { + private(set) var startCount = 0 + private(set) var resummonCount = 0 + + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + startCount += 1 + throw APIError.networkFailed("本地模拟:不应发起开拍") + } + + func resummon(taskID: Int) async throws -> DroneDockShootResponse { + resummonCount += 1 + throw APIError.networkFailed("本地模拟:不应发起重召") + } +} diff --git a/suixinkanTests/DroneDockShootTestSupport.swift b/suixinkanTests/DroneDockShootTestSupport.swift new file mode 100644 index 0000000..64c6ce7 --- /dev/null +++ b/suixinkanTests/DroneDockShootTestSupport.swift @@ -0,0 +1,34 @@ +import Foundation +@testable import suixinkan + +/// 召唤请求的匿名回执,仅用于验证真实 data 保留,不模拟飞行完成。 +enum DroneDockShootTestData { + /// 返回匿名成功 data;字段只是测试替身,不作为后端合同或实测响应。 + static func response() throws -> DroneDockShootResponse { + try JSONDecoder().decode(DroneDockShootResponse.self, + from: Data(#"{"test_receipt":"TEST-SHOOT-501","extra":null}"#.utf8)) + } +} + +/// 单次召唤测试服务,只记录接收的任务 ID,不创建任务或读取 shooting。 +@MainActor +final class DroneDockShootTestService: DroneDockShootServing { + /// 本次返回结果,可模拟明确业务拒绝后恢复。 + var result: Result + /// 已接收的任务 ID,供检查重试始终复用同一任务。 + private(set) var requests: [Int] = [] + /// 在调用时观察创建和召唤顺序。 + var onRequest: (() -> Void)? + + /// 默认明确拒绝,使不关注召唤的旧测试无需构造回执。 + init(result: Result? = nil) { + self.result = result ?? .failure(APIError.serverCode(160001, "测试召唤未配置")) + } + + /// 记录一次召唤请求,返回当前配置,不自动重试。 + func shoot(taskID: Int) async throws -> DroneDockShootResponse { + requests.append(taskID) + onRequest?() + return try result.get() + } +} diff --git a/suixinkanTests/DroneDockShootViewModelTests.swift b/suixinkanTests/DroneDockShootViewModelTests.swift new file mode 100644 index 0000000..df92a63 --- /dev/null +++ b/suixinkanTests/DroneDockShootViewModelTests.swift @@ -0,0 +1,397 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证创建后复用任务召唤,以及成功、拒绝、未知结果与生命周期防重复规则。 +@MainActor +final class DroneDockShootViewModelTests: XCTestCase { + /// 未报备发生在创建成功后的召唤;保留任务,状态刷新不会自动重发,手动重试也不重复创建。 + func testFilingRejectionPreservesTaskAndRetriesOnlyOnExplicitAction() async throws { + let fixture = try ShootFlowFixture() + fixture.shoot.result = .failure(APIError.serverCode(41901, "请处理后重试")) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.model.summonFailure?.requiresFiling, true) + XCTAssertTrue(fixture.model.summonFailure?.message.contains("提交报备截图") == true) + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertNil(fixture.model.creationFailure) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.canOpenShootingTask) + XCTAssertTrue(fixture.model.isTaskSelectionLocked) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + await fixture.model.refreshPlaneStatus() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + XCTAssertEqual(fixture.model.primaryButtonTitle, "重试召唤") + + fixture.shoot.result = .failure(APIError.serverCode(100099, "无人机忙碌")) + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.model.summonFailure?.requiresFiling, false, "新错误不能沿用旧的报备错误码") + fixture.shoot.result = .success(try DroneDockShootTestData.response()) + await fixture.model.prepareAndSummon() + XCTAssertNil(fixture.model.summonFailure) + XCTAssertTrue(fixture.model.canOpenShootingTask) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501, 501, 501]) + } + + /// 后端明确任务已结束后,仅允许查看原任务;刷新或再次调用不能重发首次召唤。 + func testEndedTaskAllowsReviewWithoutRepeatedSummonOrCreation() async throws { + let fixture = try ShootFlowFixture() + fixture.shoot.result = .failure(APIError.serverCode(100099, "任务已结束,无法召唤;失败后请传 restart=true 重新召唤")) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertTrue(fixture.model.summonRequiresTaskReview) + XCTAssertTrue(fixture.model.canOpenShootingTask) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertEqual(fixture.model.primaryButtonTitle, "查看拍摄任务") + XCTAssertEqual(fixture.model.summonFailure?.requiresFiling, false) + XCTAssertNil(fixture.model.shootResponse) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + /// 只有拿到张工创建的任务 ID 后才召唤,成功仅表示请求被接受。 + func testFirstActionCreatesThenSummonsSameTask() async throws { + let fixture = try ShootFlowFixture() + await fixture.model.refresh() + var observedRequest = false + var observedSubmitting = false + fixture.shoot.onRequest = { + observedRequest = true + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertEqual(fixture.creation.requests.count, 1) + } + await fixture.model.prepareAndSummon { + if fixture.model.isSummoning { + observedSubmitting = true + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + } + } + XCTAssertTrue(observedRequest) + XCTAssertTrue(observedSubmitting) + XCTAssertEqual(fixture.projects.requests, 2) + XCTAssertEqual(fixture.shoot.requests, [501]) + XCTAssertNotNil(fixture.model.creationDataJSON) + XCTAssertNotNil(fixture.model.shootDataJSON) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertFalse(fixture.model.canCreateTask) + XCTAssertEqual(fixture.model.primaryButtonTitle, "查看拍摄任务") + XCTAssertEqual(fixture.model.admissionMessage, "召唤请求已提交,请等待任务状态更新") + XCTAssertFalse(fixture.model.admissionMessage.contains("已起飞")) + XCTAssertFalse(fixture.model.admissionMessage.contains("已到达")) + } + + /// 业务明确成功但无 data 时仍锁定成功,不伪造 JSON 或误开放重试。 + func testSuccessWithoutDataLocksSubmission() async throws { + let fixture = try ShootFlowFixture() + fixture.shoot.result = .success(DroneDockShootResponse(dataJSON: nil)) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertNotNil(fixture.model.shootResponse) + XCTAssertNil(fixture.model.shootDataJSON) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + + /// 成功回执跨购买刷新、设备轮询和同实例返回保留,绝不再次提交。 + func testSuccessfulSummonSurvivesRefreshAndInvalidation() async throws { + let fixture = try ShootFlowFixture() + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + let receipt = fixture.model.shootDataJSON + await fixture.model.refresh() + await fixture.model.refreshPlaneStatus() + fixture.model.invalidatePlaneStatus() + fixture.model.invalidate() + await fixture.model.refresh() + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertEqual(fixture.model.shootDataJSON, receipt) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + + /// 召唤明确业务拒绝可手动重试,同任务直接召唤,不重复创建或购买预检。 + func testBusinessFailureRetriesSameTaskWithoutCreatingAgain() async throws { + let fixture = try ShootFlowFixture() + fixture.shoot.result = .failure(APIError.serverCode(100099, "测试无人机暂不可用")) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + let receipt = fixture.model.creationDataJSON + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertEqual(fixture.model.shootErrorMessage, "测试无人机暂不可用") + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + XCTAssertTrue(fixture.model.isPrimaryActionEnabled) + XCTAssertEqual(fixture.model.primaryButtonTitle, "重试召唤") + fixture.shoot.result = .success(try DroneDockShootTestData.response()) + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.model.creationDataJSON, receipt) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.projects.requests, 2) + XCTAssertEqual(fixture.shoot.requests, [501, 501]) + XCTAssertNil(fixture.model.shootErrorMessage) + XCTAssertNotNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + } + + /// 召唤 POST 无法确认结果时保留未知锁,刷新和同实例返回均不能重发。 + func testAmbiguousFailureRemainsLockedAfterRefreshAndReturn() async throws { + let errors: [Error] = [APIError.networkFailed("测试超时"), APIError.httpStatus(500, "测试异常"), + APIError.decodeFailed("测试响应无效"), APIError.invalidResponse, CancellationError()] + for error in errors { + let fixture = try ShootFlowFixture() + fixture.shoot.result = .failure(error) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertTrue(fixture.model.summonOutcomeUnknown) + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertEqual(fixture.model.primaryButtonTitle, "召唤结果待核对") + XCTAssertTrue(fixture.model.shootErrorMessage?.contains("勿重复提交") == true) + fixture.model.invalidate() + await fixture.model.refresh() + await fixture.model.refreshPlaneStatus() + await fixture.model.prepareAndSummon() + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + } + + /// 创建明确失败或结果未知,都不能把缺失任务 ID 交给召唤接口。 + func testCreationFailureNeverSummons() async throws { + for error in [APIError.serverCode(160001, "测试拒绝创建"), APIError.networkFailed("测试创建超时")] { + let fixture = try ShootFlowFixture() + fixture.creation.result = .failure(error) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + XCTAssertEqual(fixture.model.isPrimaryActionEnabled, !fixture.model.taskCreationOutcomeUnknown) + } + } + + /// 最新购买权限不允许创建时,两个写接口都不触发。 + func testPreflightRejectionStopsBothWrites() async throws { + let fixture = try ShootFlowFixture() + await fixture.model.refresh() + fixture.projects.allowCreation = false + await fixture.model.prepareAndSummon() + XCTAssertTrue(fixture.creation.requests.isEmpty) + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + } + + /// 已有低层创建回执时主按钮直接复用,不做第二次任务创建。 + func testExistingCreatedTaskCanBeSummonedOnce() async throws { + let fixture = try ShootFlowFixture() + await fixture.model.refresh() + await fixture.model.createTask() + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertEqual(fixture.model.admissionMessage, "任务已创建,等待召唤") + XCTAssertTrue(fixture.model.isPrimaryActionEnabled) + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.projects.requests, 2) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + + /// 召唤进行中重复点击、切点和刷新不会产生并发写请求。 + func testPendingSummonRejectsRepeatedActions() async throws { + let service = SuspendedShootFlowService() + let fixture = try ShootFlowFixture(shootService: service) + let started = expectation(description: "召唤已发送") + service.started = { started.fulfill() } + defer { service.cancelAll() } + await fixture.model.refresh() + let pending = Task { await fixture.model.prepareAndSummon() } + await fulfillment(of: [started], timeout: 2) + XCTAssertTrue(fixture.model.isSummoning) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertTrue(fixture.model.isTaskSelectionLocked) + XCTAssertEqual(fixture.model.primaryButtonTitle, "正在召唤无人机…") + await fixture.model.prepareAndSummon() + fixture.model.selectSpot(id: 202) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.selectedSpotID, 201) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(service.requests, [501]) + try service.finish() + await pending.value + XCTAssertNotNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + } + + /// 召唤发送后取消或离开,即便随后有成功回执,也保持待核对且不自动重发。 + func testCancellationOrInvalidationAfterPostLocksUnknown() async throws { + for invalidate in [false, true] { + let service = SuspendedShootFlowService() + let fixture = try ShootFlowFixture(shootService: service) + let started = expectation(description: "待取消召唤") + service.started = { started.fulfill() } + defer { service.cancelAll() } + await fixture.model.refresh() + let pending = Task { await fixture.model.prepareAndSummon() } + await fulfillment(of: [started], timeout: 2) + if invalidate { fixture.model.invalidate() } else { pending.cancel() } + try service.finish() + await pending.value + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertTrue(fixture.model.summonOutcomeUnknown) + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.isSummoning) + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(service.requests, [501]) + } + } + + /// 创建成功但召唤尚未发出时取消,不误记召唤未知;下次只召唤已有任务。 + func testCancellationBeforeShootDoesNotMarkUnknown() async throws { + let fixture = try ShootFlowFixture() + await fixture.model.refresh() + let pending = Task { + await fixture.model.prepareAndSummon { + if fixture.model.isSummoning { withUnsafeCurrentTask { $0?.cancel() } } + } + } + await pending.value + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertTrue(fixture.shoot.requests.isEmpty) + XCTAssertFalse(fixture.model.summonOutcomeUnknown) + XCTAssertTrue(fixture.model.isPrimaryActionEnabled) + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.shoot.requests, [501]) + } + + /// 召唤期间切换身份,迟到响应不展示,旧实例不能恢复写入入口。 + func testContextChangeRejectsLateSummon() async throws { + let service = SuspendedShootFlowService() + let fixture = try ShootFlowFixture(shootService: service) + let started = expectation(description: "会话切换中的召唤") + service.started = { started.fulfill() } + defer { service.cancelAll() } + await fixture.model.refresh() + let pending = Task { await fixture.model.prepareAndSummon() } + await fulfillment(of: [started], timeout: 2) + fixture.scope.scenicID = 129 + try service.finish() + await pending.value + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertTrue(fixture.model.summonOutcomeUnknown) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + fixture.scope.scenicID = 128 + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(service.requests, [501]) + } + + /// 已成功后由设备轮询发现身份变化,也撤下旧回执而不释放成功防重复锁。 + func testIdentityChangeRemovesSuccessfulReceipt() async throws { + let fixture = try ShootFlowFixture() + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + fixture.scope.scenicID = 129 + await fixture.model.refreshPlaneStatus() + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertFalse(fixture.model.isPrimaryActionEnabled) + fixture.scope.scenicID = 128 + await fixture.model.refresh() + await fixture.model.prepareAndSummon() + XCTAssertEqual(fixture.shoot.requests, [501]) + } +} + +/// 独立内存数据源,所有写入由测试替身处理,不接触真实任务或设备。 +@MainActor +private final class ShootFlowFixture { + let projects = ShootFlowProjectService() + let creation: DroneDockTaskCreationTestService + let shoot: DroneDockShootTestService + let scope = ShootFlowContext() + let model: DroneDockPreparationViewModel + + init(shootService: (any DroneDockShootServing)? = nil) throws { + creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + shoot = DroneDockShootTestService(result: .success(try DroneDockShootTestData.response())) + let currentScope = scope + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, + from: Data(#"{"order_number":"TEST-PREPARATION-001","project_id":101}"#.utf8)) + model = DroneDockPreparationViewModel(context: scope.value, order: order, service: projects, + planeStatusService: try DroneDockPlaneStatusTestService(), + taskCreationService: creation, shootService: shootService ?? shoot, + currentContext: { currentScope.value }) + } +} + +/// 返回已购点位和航线,可在点击前模拟权限变更。 +@MainActor +private final class ShootFlowProjectService: DroneDockPreparationServing { + var allowCreation = true + private(set) var requests = 0 + + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse { + requests += 1 + let data: [String: Any] = ["order_number": "TEST-PREPARATION-001", "project_id": 101, + "shoot_count": 5, "shot_count": 0, "remaining_count": 5, + "can_create_task": allowCreation, + "spot": [["scenic_spot_id": 201, "scenic_spot_name": "测试点位", "available": true, + "air_lines": [["air_line_id": 301, "air_line_name": "测试航线", "available": true, "samples": []]]]]] + return try JSONDecoder().decode(DroneDockProjectInfoResponse.self, from: JSONSerialization.data(withJSONObject: data)) + } +} + +/// 可改变景区的主线程会话替身。 +@MainActor +private final class ShootFlowContext { + var scenicID = 128 + var value: DroneDockHomeContext { + DroneDockHomeContext(userID: "shoot-test-user", accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: 37, photographerName: "测试人员", token: "shoot-test-token") + } +} + +/// 挂起单次召唤 POST,精确控制取消和迟到回执场景。 +@MainActor +private final class SuspendedShootFlowService: DroneDockShootServing { + var started: (() -> Void)? + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + + func shoot(taskID: Int) async throws -> DroneDockShootResponse { + requests.append(taskID) + return try await withCheckedThrowingContinuation { continuation in + self.continuation = continuation + started?() + } + } + + func finish() throws { + let response = try DroneDockShootTestData.response() + let pending = continuation + continuation = nil + pending?.resume(returning: response) + } + + func cancelAll() { + continuation?.resume(throwing: CancellationError()) + continuation = nil + } +} diff --git a/suixinkanTests/DroneDockShootingAPITests.swift b/suixinkanTests/DroneDockShootingAPITests.swift new file mode 100644 index 0000000..6d42d82 --- /dev/null +++ b/suixinkanTests/DroneDockShootingAPITests.swift @@ -0,0 +1,227 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证 shooting 仅按已有任务读取状态,完整展示响应且不发送创建或飞控请求。 +@MainActor +final class DroneDockShootingAPITests: XCTestCase { + /// 任务读取只包含任务 ID 和缓存电量查询项,复用统一登录 Token。 + func testShootingUsesAuthenticatedGETWithExactQueryAndNoBody() async throws { + let session = MockURLSession(responses: [try envelope(payload())]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "shooting-test-token" } + let result = try await DroneDockShootingAPI(client: client).shooting(taskID: 501) + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/shooting") + XCTAssertNil(request.httpBody) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "shooting-test-token") + let components = try XCTUnwrap(URLComponents(url: XCTUnwrap(request.url), resolvingAgainstBaseURL: false)) + XCTAssertEqual(components.queryItems, [URLQueryItem(name: "id", value: "501"), + URLQueryItem(name: "live_battery", value: "0")]) + XCTAssertEqual(result.orderNumber, "TEST-SHOOTING-001") + XCTAssertEqual(result.scenic?.id, 128) + XCTAssertEqual(result.scenicSpot?.id, 201) + XCTAssertEqual(result.airLine?.scenicSpotID, 201) + XCTAssertEqual(result.header?.title, "测试点位 · 测试航线") + XCTAssertEqual(result.currentPlane?.statusText, "状态待确认") + XCTAssertEqual(result.executeGate?.canExecute, false) + XCTAssertEqual(result.executeGate?.code, "wayline_missing") + XCTAssertEqual(result.ui?.phase, "pending") + } + + /// 明确关闭实时电量时仍是同一只读接口,不产生替代写请求。 + func testLiveBatteryFalseIsAnExplicitQueryValue() async throws { + let session = MockURLSession(responses: [try envelope([:])]) + _ = try await DroneDockShootingAPI(client: APIClient(environment: .testing, session: session)) + .shooting(taskID: 502, liveBattery: false) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertNil(request.httpBody) + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems + XCTAssertEqual(query, [URLQueryItem(name: "id", value: "502"), URLQueryItem(name: "live_battery", value: "0")]) + } + + /// 非正整数任务 ID 在发送前拒绝,不尝试根据订单新建任务。 + func testInvalidTaskIDDoesNotSendAnyRequest() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockShootingAPI(client: APIClient(environment: .testing, session: session)) + for taskID in [0, -1] { + do { + _ = try await api.shooting(taskID: taskID) + XCTFail("应拒绝无效任务 ID") + } catch {} + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 后端业务拒绝保留原业务码和文案,不能改为本地拍摄成功状态。 + func testBusinessFailurePreservesBackendCodeAndMessage() async throws { + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 160002, msg: "任务不存在")]) + let api = DroneDockShootingAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shooting(taskID: 501) + XCTFail("应保留业务错误") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160002) + XCTAssertEqual(message, "任务不存在") + } + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(session.requests.first?.httpMethod, "GET") + } + + /// 失败不会自动发请求,显式再读仍使用同一任务 ID 且全程没有 POST。 + func testFailedReadCanBeRetriedForSameTaskWithoutCreatingAnotherTask() async throws { + let httpResponse = try XCTUnwrap(HTTPURLResponse(url: URL(string: "https://api-test.zhifly.cn/mock")!, + statusCode: 200, httpVersion: nil, headerFields: nil)) + let session = MockURLSession(results: [.failure(URLError(.timedOut)), .success((try envelope(payload()), httpResponse))]) + let api = DroneDockShootingAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.shooting(taskID: 501) + XCTFail("首个读取应超时") + } catch {} + XCTAssertEqual(session.requests.count, 1) + let result = try await api.shooting(taskID: 501) + XCTAssertEqual(result.executeGate?.canExecute, false) + XCTAssertEqual(session.requests.count, 2) + for request in session.requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/shooting") + XCTAssertNil(request.httpBody) + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems + XCTAssertEqual(query?.first(where: { $0.name == "id" })?.value, "501") + } + } + + /// 未建模设备读数、未知任务字段和空值完整显示,不伪造已校验的响应任务身份。 + func testDataJSONPreservesUnknownFieldsAndOriginalTypes() throws { + var value = payload() + value["task"] = ["id": 999, "future_flag": false] + value["future"] = ["missing": NSNull(), "values": ["001", false, 0, 12.5]] as [String: Any] + value["metrics"] = [["key": "battery", "value": "0%"], ["key": "satellite", "value": NSNull()]] + value["plane_status"] = ["connected": false, "planes": [], "recommend": NSNull()] as [String: Any] + let response = try decode(value) + let displayed = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(response.dataJSON.utf8)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: displayed).isEqual(to: value)) + XCTAssertTrue(response.dataJSON.contains("\n")) + XCTAssertNil(displayed["code"]) + XCTAssertNil(displayed["msg"]) + XCTAssertNil(displayed["time"]) + XCTAssertNil(displayed["task_id"]) + } + + /// 真实 false、null 和缺失三种响应均可展示,不把未知门禁补成 true 或 false。 + func testOptionalObjectsAndExecutionGatePreserveUnknownAndFalse() throws { + let empty = try decode([:]) + XCTAssertNil(empty.scenic) + XCTAssertNil(empty.currentPlane) + XCTAssertNil(empty.executeGate) + + let emptyObjects = try decode(["scenic": [:], "scenic_spot": [:], "air_line": [:], + "header": [:], "current_plane": [:], "execute_gate": [:], "ui": [:]]) + XCTAssertNil(emptyObjects.scenic?.id) + XCTAssertNil(emptyObjects.executeGate?.canExecute) + + let nulls = try decode(["current_plane": NSNull(), "execute_gate": ["can_execute": NSNull()]]) + XCTAssertNil(nulls.currentPlane) + XCTAssertNil(nulls.executeGate?.canExecute) + let denied = try decode(["execute_gate": ["can_execute": false]]) + XCTAssertEqual(denied.executeGate?.canExecute, false) + let allowed = try decode(["execute_gate": ["can_execute": true]]) + XCTAssertEqual(allowed.executeGate?.canExecute, true) + } + + /// 文案和数字不强转成执行许可,错误的已知字段类型不能展示为可信门禁。 + func testMalformedKnownFieldsAreRejectedWithoutBooleanCoercion() throws { + for value: Any in ["false", "true", 0, 1] { + XCTAssertThrowsError(try decode(["execute_gate": ["can_execute": value]])) + } + XCTAssertThrowsError(try decode(["scenic": "128"])) + XCTAssertThrowsError(try decode(["header": ["title": false]])) + XCTAssertThrowsError(try JSONDecoder().decode(DroneDockShootingResponse.self, from: Data("[]".utf8))) + } + + /// 实测嵌套任务身份、摘要订单号和阶段说明均可解码,供任务页逐项核对。 + func testNestedTaskIdentitiesHeaderAndStatusMessageAreDecoded() throws { + let response = try DroneDockShootingTaskTestData.response() + XCTAssertEqual(response.orderFlightTask?.id, 501) + XCTAssertEqual(response.orderFlightTask?.orderNumber, "TEST-TASK-PAGE-001") + XCTAssertEqual(response.orderFlightTask?.scenicID, 128) + XCTAssertEqual(response.task?.id, 501) + XCTAssertEqual(response.task?.status, 10) + XCTAssertEqual(response.task?.statusLabel, "待执行") + XCTAssertEqual(response.header?.orderNumber, "TEST-TASK-PAGE-001") + XCTAssertEqual(response.ui?.message, "测试阶段说明") + XCTAssertEqual(response.planeStatus?.scenicID, 128) + XCTAssertEqual(response.planeStatus?.pollHintMS, 5000) + } + + /// 六项格式化零值保持可见,连接 false 与缺失/null 不混淆,未知读数仍完整保留。 + func testTelemetryAndPlaneStatusPreserveZeroFalseNullAndUnknownFields() throws { + let value: [String: Any] = [ + "metrics": [["key": "battery", "value": "0%", "raw": 0], + ["key": "wind_speed", "value": "0m/s"], + ["key": "rainfall", "value": NSNull()], + ["key": "future_metric", "value": "测试新读数"]], + "plane_status": ["scenic_id": 128, "connected": false, "poll_hint_ms": 0, + "recommend": NSNull(), "future": ["flag": true]] as [String: Any] + ] + let response = try decode(value) + XCTAssertEqual(response.metrics[0].displayText, "0%") + XCTAssertEqual(response.metrics[0].raw, .number(0)) + XCTAssertEqual(response.metrics[1].displayText, "0m/s") + XCTAssertEqual(response.metrics[2].displayText, "—") + XCTAssertEqual(response.planeStatus?.connected, false) + XCTAssertEqual(response.planeStatus?.pollHintMS, 0) + let unknown = try decode(["plane_status": ["connected": NSNull(), "poll_hint_ms": NSNull()]]) + XCTAssertNil(unknown.planeStatus?.connected) + XCTAssertNil(unknown.planeStatus?.pollHintMS) + let displayed = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(response.dataJSON.utf8)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: displayed).isEqual(to: value)) + } + + /// 格式化读数和连接状态不强转错误类型,避免把接口异常显示为可信设备状态。 + func testMalformedTelemetryAndPlaneStatusAreRejected() throws { + XCTAssertThrowsError(try decode(["metrics": [["key": "battery", "value": false]]])) + XCTAssertThrowsError(try decode(["plane_status": ["connected": "false"]])) + XCTAssertThrowsError(try decode(["plane_status": ["poll_hint_ms": true]])) + XCTAssertThrowsError(try decode(["order_flight_task": ["id": true]])) + } + + /// 航线执行失败与订单任务执行中分别保留,未知新增字段不因展示模型扩展而丢失。 + func testWaylineStatusIsDecodedSeparatelyFromOrderTaskStatus() throws { + let payload: [String: Any] = ["task": ["id": 501, "status": 20, "status_label": "执行中", + "wayline_status": 91, "wayline_status_label": "执行失败", "future": NSNull()]] + let response = try decode(payload) + XCTAssertEqual(response.task?.status, 20) + XCTAssertEqual(response.task?.waylineStatus, 91) + XCTAssertEqual(response.task?.waylineStatusLabel, "执行失败") + let displayed = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(response.dataJSON.utf8)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: displayed).isEqual(to: payload)) + XCTAssertThrowsError(try decode(["task": ["wayline_status": true]])) + XCTAssertNil(try decode(["task": ["wayline_status": NSNull()]]).task?.waylineStatus) + } + + /// 夹具只使用测试身份与文案,读取成功不等同于无人机已召唤。 + private func payload() -> [String: Any] { + ["order_number": "TEST-SHOOTING-001", + "scenic": ["id": 128, "name": "测试景区"], + "scenic_spot": ["id": 201, "name": "测试点位"], + "air_line": ["id": 301, "name": "测试航线", "scenic_spot_id": 201], + "header": ["title": "测试点位 · 测试航线", "tourist_label": "测试游客", "package_name": "测试套餐"], + "current_plane": ["id": 58, "sn_number": "TEST-PLANE-058", "work_status_label": "待确认", "status_text": "状态待确认"], + "execute_gate": ["can_execute": false, "code": "wayline_missing", "message": "尚未绑定飞行任务", + "primary_action": "blocked", "primary_action_label": "等待飞行任务"], + "ui": ["phase": "pending", "title": "任务信息已获取"]] + } + + private func envelope(_ value: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": value]) + } + + private func decode(_ value: [String: Any]) throws -> DroneDockShootingResponse { + try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: value)) + } +} diff --git a/suixinkanTests/DroneDockShootingRealtimeTests.swift b/suixinkanTests/DroneDockShootingRealtimeTests.swift new file mode 100644 index 0000000..b9db5d9 --- /dev/null +++ b/suixinkanTests/DroneDockShootingRealtimeTests.swift @@ -0,0 +1,1160 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用完全隔离的票据/Socket/计时替身,验证订阅生命周期和 HTTP 共用版本规则。 +@MainActor +final class DroneDockShootingRealtimeTests: XCTestCase { + func testTicketAPIUsesAuthenticatedReadOnlyEndpoint() async throws { + let data = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": ["socket_token": "MOCK-TICKET", "expire_seconds": 3600]]) + let transport = MockURLSession(responses: [data]) + let client = APIClient(environment: .testing, session: transport) + client.bindAuthTokenProvider { "MOCK-APP-TOKEN" } + let result = try await DroneDockSocketTokenAPI(client: client).socketTicket() + XCTAssertEqual(result.socketToken, "MOCK-TICKET") + XCTAssertEqual(result.expireSeconds, 3600) + XCTAssertEqual(transport.requests.count, 1) + let request = try XCTUnwrap(transport.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/socket-token") + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "MOCK-APP-TOKEN") + XCTAssertNil(request.httpBody) + } + + func testFailureArrayAndNonSocketEnvelopeAreNotMistakenForSnapshot() throws { + for (code, message) in [(100098, "Token 校验失败或已过期"), (100099, "无权订阅该飞行任务")] { + let result = try DroneDockShootingSocketMessage.decode(RealtimeTestData.rejection(code, message)) + guard case .rejected(let actualCode, let actualMessage) = result else { return XCTFail("必须先解析业务码") } + XCTAssertEqual(actualCode, code) + XCTAssertEqual(actualMessage, message) + } + let http = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": RealtimeTestData.payload()]) + guard case .unrelated = try DroneDockShootingSocketMessage.decode(http) else { return XCTFail("HTTP data 不能冒充推送外壳") } + guard case .subscribed = try DroneDockShootingSocketMessage.decode(RealtimeTestData.ack()) else { + return XCTFail("新版 100000 ack 必须成功解析") + } + guard case .rejected = try DroneDockShootingSocketMessage.decode(RealtimeTestData.rejection(0, "旧协议")) else { + return XCTFail("不能沿用旧版成功码") + } + XCTAssertThrowsError(try DroneDockShootingSocketMessage.decode(Data("[]".utf8))) + var missing = RealtimeTestData.payload() + missing.removeValue(forKey: "state_version") + XCTAssertThrowsError(try DroneDockShootingSocketMessage.decode(RealtimeTestData.push(missing))) + } + + /// 新版订阅失败不含任务 ID,仍须按 type/subscribed 与错误码立即识别。 + func testSubscriptionFailureAckDoesNotRequireTaskIdentity() throws { + for (code, message) in [(100098, "票据已过期"), (100099, "任务不存在")] { + let result = try DroneDockShootingSocketMessage.decode(RealtimeTestData.subscriptionFailure(code, message)) + guard case .subscriptionRejected(let actualCode, let actualMessage) = result else { + return XCTFail("310 失败回执不能等待任务 ID 或成功快照") + } + XCTAssertEqual(actualCode, code) + XCTAssertEqual(actualMessage, message) + } + } + + /// 鉴权超时由正式失败回执的明确 hint 区分,不猜测错误码或要求失败包带任务 ID。 + func testFormalAuthenticationTimeoutUsesTrimmedHintForDifferentBusinessCodes() throws { + for code in [100000, 100050, 100099] { + let message = try DroneDockShootingSocketMessage.decode( + RealtimeTestData.authenticationTimeout(code: code, hint: " 鉴权超时,请稍后重试 \n")) + guard case .subscriptionTimedOut(let reason) = message else { + return XCTFail("正式鉴权超时应保留 HTTP 兜底,不按 \(code) 误判永久无权限") + } + XCTAssertEqual(reason, "鉴权超时,请稍后重试") + } + } + + /// 就绪/入站提示及非明确失败字段不能冒充正式鉴权超时。 + func testTimeoutHintOnDiagnosticOrMalformedAckDoesNotBecomeFormalTimeout() throws { + let variants: [[String: Any]] = [ + ["type": 310, "ack": "ready", "subscribed": false], + ["type": 310, "ack": "received", "subscribed": false], + ["type": 311, "ack": "subscribe", "subscribed": false], + ["type": 310, "ack": "subscribe", "subscribed": true, "order_flight_task_id": 501] + ] + for variant in variants { + let data = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": + variant.merging(["hint": "鉴权超时"]) { old, _ in old }]) + if case .subscriptionTimedOut = try DroneDockShootingSocketMessage.decode(data) { + XCTFail("只有 type310 + subscribe + JSON false 能识别正式超时:\(variant)") + } + } + for subscribed in [0, 1] { + let data = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": [ + "type": 310, "ack": "subscribe", "subscribed": subscribed, "hint": "鉴权超时" + ]]) + XCTAssertThrowsError(try DroneDockShootingSocketMessage.decode(data), "数值不能替代 JSON false") + } + } + + /// 入站回执可能携带 subscribed=false,只有正式 subscribe 才能声明订阅被拒绝。 + func testFailedDiagnosticAckCannotBecomeFormalSubscriptionRejection() throws { + for ack in ["ready", "received", "subscribe_meta"] { + let data = try JSONSerialization.data(withJSONObject: ["code": 100099, "msg": "暂不可用", "data": [ + "type": 310, "ack": ack, "subscribed": false, "hint": "鉴权超时" + ]]) + guard case .rejected(let code, let message) = try DroneDockShootingSocketMessage.decode(data) else { + return XCTFail("非正式失败回执不能按权限永久停止读取") + } + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "暂不可用") + } + } + + /// 下行就绪和订阅入站回执只提供诊断,不能冒充正式订阅结果或吞掉错误码。 + func testReadyAndReceivedAreDiagnosticMessagesOnly() throws { + for ack in ["ready", "received"] { + guard case .unrelated = try DroneDockShootingSocketMessage.decode(RealtimeTestData.transportAck(ack)) else { + return XCTFail("\(ack) 不代表订阅成功") + } + let decorated = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": [ + "ack": ack, "type": 310, "subscribed": true, "has_snapshot": true, "order_flight_task_id": 501, + "action": "app_airport_shooting_updated", "params": RealtimeTestData.payload() + ]]) + guard case .unrelated = try DroneDockShootingSocketMessage.decode(decorated) else { + return XCTFail("诊断 ack 误带订阅或快照字段仍不能推进状态") + } + for code in [100098, 100099] { + guard case .rejected(let actualCode, _) = try DroneDockShootingSocketMessage.decode( + RealtimeTestData.transportAck(ack, code: code)) else { + return XCTFail("诊断 ack 字段不能掩盖失败业务码") + } + XCTAssertEqual(actualCode, code) + } + } + } + + /// 正式订阅的快照提示尚未判定,null、缺失及旧布尔值都不影响订阅身份解析。 + func testFormalSubscriptionAcceptsNullAndIgnoresSnapshotHint() throws { + let hints: [Any?] = [NSNull(), nil, true, false] + for hint in hints { + let message = try DroneDockShootingSocketMessage.decode(RealtimeTestData.ack(hasSnapshot: hint)) + guard case .subscribed(let taskID) = message else { + return XCTFail("正式 subscribe 不应依赖 has_snapshot 的值") + } + XCTAssertEqual(taskID, 501) + } + let root = try XCTUnwrap(JSONSerialization.jsonObject(with: RealtimeTestData.ack()) as? [String: Any]) + let body = try XCTUnwrap(root["data"] as? [String: Any]) + XCTAssertTrue(body["has_snapshot"] is NSNull, "默认测试回执使用新合同的 null") + } + + /// 数值 0/1 不是正式订阅的 JSON 布尔值,不能通过 NSNumber 桥接获得授权。 + func testNumericSubscribedFlagCannotEstablishFormalSubscription() throws { + for subscribed in [0, 1] { + let data = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": [ + "type": 310, "ack": "subscribe", "subscribed": subscribed, + "order_flight_task_id": 501, "has_snapshot": NSNull() + ]]) + XCTAssertThrowsError(try DroneDockShootingSocketMessage.decode(data)) + } + } + + /// 缓存元数据只能解码成独立提示事件,不得冒充正式订阅成功。 + func testSubscriptionMetadataDecodesExplicitTrueAndFalse() throws { + for hasSnapshot in [true, false] { + let message = try DroneDockShootingSocketMessage.decode(RealtimeTestData.metadata(hasSnapshot: hasSnapshot)) + guard case .subscriptionMetadata(let taskID, let actualHasSnapshot, _) = message else { + return XCTFail("subscribe_meta 必须与正式 subscribe 区分") + } + XCTAssertEqual(taskID, 501) + XCTAssertEqual(actualHasSnapshot, hasSnapshot) + } + } + + /// 只有 type=310 且 ack=subscribe 才能建立订阅,未知回执误带快照字段也必须忽略。 + func testUnknownOrWrongTypeAcksCannotEstablishSubscription() throws { + let variants: [[String: Any]] = [ + ["type": 311, "ack": "subscribe"], + ["type": "310", "ack": "subscribe"], + ["ack": "subscribe"], + ["type": 310], + ["type": 310, "ack": "unknown"], + ["type": 310, "ack": "subscribed"] + ] + for variant in variants { + let body = variant.merging([ + "subscribed": true, "order_flight_task_id": 501, "has_snapshot": true + ]) { value, _ in value } + let data = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": body]) + guard case .unrelated = try DroneDockShootingSocketMessage.decode(data) else { + return XCTFail("未知或不完整协议外壳不得确认订阅:\(variant)") + } + } + let decorated = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": [ + "type": 310, "ack": "unknown", "subscribed": true, "order_flight_task_id": 501, + "action": "app_airport_shooting_updated", "params": RealtimeTestData.payload() + ]]) + guard case .unrelated = try DroneDockShootingSocketMessage.decode(decorated) else { + return XCTFail("未知 ack 不能利用附带 params 推进快照状态") + } + } + + /// 元数据缺少必要字段或没有明确 JSON 布尔值时忽略,null 不能解释成无缓存。 + func testIncompleteSubscriptionMetadataIsIgnored() throws { + let complete: [String: Any] = ["type": 310, "ack": "subscribe_meta", "subscribed": true, + "order_flight_task_id": 501, "has_snapshot": true] + var bodies: [[String: Any]] = [] + for field in ["type", "ack", "subscribed", "order_flight_task_id", "has_snapshot"] { + var value = complete + value.removeValue(forKey: field) + bodies.append(value) + } + let invalidHints: [Any] = [NSNull(), "true", "false", 0, 1] + for hint in invalidHints { + var value = complete + value["has_snapshot"] = hint + bodies.append(value) + } + let invalidFields: [(String, Any)] = [("type", 311), ("subscribed", false), ("subscribed", 0), + ("subscribed", 1), ("order_flight_task_id", 0)] + for (field, invalid) in invalidFields { + var value = complete + value[field] = invalid + bodies.append(value) + } + for body in bodies { + let data = try JSONSerialization.data(withJSONObject: ["code": 100000, "data": body]) + guard case .unrelated = try DroneDockShootingSocketMessage.decode(data) else { + return XCTFail("不完整元数据不能确认订阅或解释为无缓存:\(body)") + } + } + } + + /// 明确的 310 拒绝停止 HTTP 与 WS,不依赖中文文案白名单。 + func testSubscriptionFailureCodeStopsReadingRegardlessOfMessage() async throws { + for message in ["任务不存在", "数据不存在", "Permission denied"] { + let harness = RealtimeHarness() + let model = try model() + await model.refresh() + harness.session.onConnectionState = { state in + if case .denied(let reason) = state { model.stopReading(message: reason) } + } + harness.session.start() + await settle { harness.sockets.count == 1 && harness.sockets[0].sent.count == 1 } + harness.sockets[0].emit(try RealtimeTestData.transportAck("ready")) + harness.sockets[0].emit(try RealtimeTestData.transportAck("received")) + harness.sockets[0].emit(try RealtimeTestData.subscriptionFailure(100099, message)) + await settle { harness.session.state == .denied(message) } + XCTAssertFalse(model.canContinuePolling) + XCTAssertFalse(model.presentation.isActionEnabled) + XCTAssertNotNil(model.response, "无权限后保留已有只读画面") + XCTAssertFalse(harness.clock.has(1), "明确拒绝不安排重连") + harness.session.stop() + harness.session.start() + await Task.yield() + XCTAssertEqual(harness.tickets.count, 1) + XCTAssertEqual(harness.sockets[0].closeCount, 1) + } + } + + /// 服务端三秒鉴权失败立刻结束本轮等待;保留只读兜底并换票,旧连接不能恢复实时态。 + func testAuthenticationTimeoutImmediatelyFallsBackAndReconnectsWithoutAccessDenial() async throws { + for code in [100000, 100050, 100099] { + let harness = RealtimeHarness() + let model = try model() + await model.refresh() + var acceptedSnapshots = 0 + var states: [DroneDockShootingRealtimeSession.State] = [] + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.onConnectionState = { state in + states.append(state) + if case .denied(let reason) = state { model.stopReading(message: reason) } + } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.sockets[0].sent.count == 1 && harness.clock.has(12) } + let first = harness.sockets[0] + first.emit(try RealtimeTestData.transportAck("received")) + harness.time = 3 + first.emit(try RealtimeTestData.authenticationTimeout(code: code)) + await settle { harness.clock.has(1) && !harness.clock.has(12) } + XCTAssertEqual(harness.session.state, .fallback("鉴权超时,请稍后重试")) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + XCTAssertEqual(first.closeCount, 1) + XCTAssertTrue(model.canContinuePolling) + XCTAssertNil(model.readAccessError) + XCTAssertNotNil(model.response) + XCTAssertFalse(states.contains { if case .denied = $0 { return true }; return false }) + + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 && harness.sockets[1].sent.count == 1 } + XCTAssertEqual(harness.tickets.count, 2) + XCTAssertTrue(harness.sockets[1].sent[0].contains("MOCK-TICKET-2")) + first.emit(try RealtimeTestData.ack()) + first.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + for _ in 0..<10 { await Task.yield() } + XCTAssertEqual(harness.session.state, .connecting) + XCTAssertEqual(acceptedSnapshots, 0, "旧连接迟到正式回执及快照不能补齐新连接") + + let second = harness.sockets[1] + second.emit(try RealtimeTestData.ack()) + await settle { second.receiveCount >= 3 } + XCTAssertNotEqual(harness.session.state, .live, "新连接仍需有效完整快照") + second.emit(try RealtimeTestData.push(RealtimeTestData.payload(version: 2))) + await settle { harness.session.state == .live } + XCTAssertEqual(acceptedSnapshots, 1) + } + } + + /// 新版无 ID 的票据失败只换票重连,不停止任务读取或误判 App 登录失效。 + func testExpiredSubscriptionFailureAckRenewsTicket() async throws { + let harness = RealtimeHarness() + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.sockets[0].sent.count == 1 } + harness.sockets[0].emit(try RealtimeTestData.transportAck("ready")) + harness.sockets[0].emit(try RealtimeTestData.transportAck("received")) + harness.sockets[0].emit(try RealtimeTestData.subscriptionFailure(100098, "票据已过期")) + await settle { harness.clock.has(1) } + guard case .fallback = harness.session.state else { return XCTFail("换票期间应保留 HTTP 兜底") } + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 && harness.sockets[1].sent.count == 1 } + XCTAssertEqual(harness.tickets.count, 2) + XCTAssertTrue(harness.sockets[1].sent[0].contains("MOCK-TICKET-2")) + } + + /// 非订阅失败的通用业务错误仍走临时兜底,不能仅凭 100099 永久锁定任务。 + func testGenericBusinessErrorDoesNotBecomeSubscriptionDenial() async throws { + let harness = RealtimeHarness() + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.sockets[0].sent.count == 1 } + harness.sockets[0].emit(try RealtimeTestData.rejection(100099, "暂时不可用")) + await settle { harness.clock.has(1) } + guard case .fallback = harness.session.state else { return XCTFail("通用错误应保留重试") } + } + + /// 311 仅用于取消订阅;带完整参数的旧 type 外壳也不能冒充任务推送。 + func testUnsubscribeTypeCannotBeDecodedAsShootingUpdate() throws { + let unsubscribe = try XCTUnwrap(JSONSerialization.jsonObject( + with: Data(DroneDockShootingSocketMessage.unsubscribe(taskID: 501).utf8)) as? [String: Any]) + XCTAssertEqual(unsubscribe["type"] as? Int, 311) + XCTAssertEqual((unsubscribe["params"] as? [String: Any])?["id"] as? Int, 501) + XCTAssertNil((unsubscribe["params"] as? [String: Any])?["socket_token"]) + + let oldEnvelope = try JSONSerialization.data(withJSONObject: [ + "code": 100000, + "data": ["type": 311, "params": RealtimeTestData.payload()] + ]) + guard case .unrelated = try DroneDockShootingSocketMessage.decode(oldEnvelope) else { + return XCTFail("只有 app_airport_shooting_updated action 才是设备状态推送") + } + } + + /// 新飞控状态及素材上传中任务通过既有 action 完整传递,与 HTTP 使用同一解码合同。 + func testFlightControlUpdatesUseActionEnvelopeWithoutChangingUIPhase() throws { + for (index, state) in ["starting", "paused", "executing", "returning", "returned", "unknown"].enumerated() { + var payload = RealtimeTestData.payload(version: index + 10) + payload["ui"] = ["phase": "shooting"] + payload["flight_control"] = [ + "state": state, "execution_batch": 100, + "drone_in_dock": state == "returned" || state == "starting" ? "inside" : "outside", + "is_airborne": state == "unknown" ? NSNull() : (state != "returned" && state != "starting") as Any, + "pause_reason": state == "paused" ? "manual" : NSNull(), + "pending_command": NSNull(), + "can_pause": state == "executing" || state == "returning", "can_resume": state == "paused", + "can_return_home": state == "paused" || state == "executing" + ] + let httpSnapshot = try DroneDockShootingTaskTestData.decode(payload) + guard case .snapshot(let pushedSnapshot) = try DroneDockShootingSocketMessage.decode(RealtimeTestData.push(payload)) else { + return XCTFail("完整飞控状态必须通过既有 action 解析") + } + XCTAssertEqual(pushedSnapshot, httpSnapshot) + XCTAssertEqual(pushedSnapshot.flightControl?.state, state) + XCTAssertEqual(pushedSnapshot.flightControl?.executionBatch, 100) + XCTAssertEqual(pushedSnapshot.ui?.phase, "shooting", "Socket 不自行重写设备状态对应的 UI 阶段") + } + + var uploading = RealtimeTestData.mediaStagePayload(wayline: 30, version: 20) + uploading["task"] = ["id": 501, "status": 25, "wayline_status": 30] + uploading["order_flight_task"] = ["id": 501, "status": 25] + guard case .snapshot(let snapshot) = try DroneDockShootingSocketMessage.decode(RealtimeTestData.push(uploading)) else { + return XCTFail("素材上传中的任务仍须接收完整推送") + } + XCTAssertEqual(snapshot.task?.status, 25) + XCTAssertEqual(snapshot.orderFlightTask?.status, 25) + XCTAssertEqual(snapshot.ui?.phase, "post_shoot_uploading") + } + + /// 正式 null 回执后可省略 meta,仍需有效 WS 全量才停止 HTTP;健康心跳允许业务静默。 + func testConnectionAndAckAloneDoNotStopHTTPAndSilenceWithPongIsHealthy() async throws { + let harness = RealtimeHarness() + let model = try model() + await model.refresh() + harness.session.onSnapshot = { model.applyTaskSnapshot($0) } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 } + XCTAssertEqual(harness.session.state, .connecting) + let socket = try XCTUnwrap(harness.sockets.first) + let request = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(socket.sent[0].utf8)) as? [String: Any]) + XCTAssertEqual(request["type"] as? Int, 310) + XCTAssertEqual((request["params"] as? [String: Any])?["id"] as? Int, 501) + socket.emit(try RealtimeTestData.ack()) + await settle { socket.receiveCount == 3 } + XCTAssertEqual(harness.session.state, .connecting, "正式回执中的 null 不能当成 has_snapshot=false") + XCTAssertTrue(harness.clock.has(12)) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload(version: 2))) + await settle { harness.session.state == .live } + XCTAssertEqual(model.response?.stateVersion, 2) + await settle { !harness.clock.has(12) && harness.clock.has(20) } + // 无业务变化可持续静默;原生 pong 足以说明链路仍可用。 + for _ in 0..<3 { + harness.clock.fire(seconds: 20) + await settle { harness.clock.has(20) && !harness.clock.has(10) } + XCTAssertEqual(harness.session.state, .live) + } + XCTAssertEqual(socket.pingCount, 3) + XCTAssertEqual(harness.tickets.count, 1) + } + + /// 握手后必须先收到 Opened 才发一次 310;重复欢迎帧不能代替 ack 或延长超时。 + func testOnlyOpenedTriggersOneTextSubscriptionBeforeAckAndSnapshot() async throws { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + harness.session.onSnapshot = { _ in .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.clock.has(12) } + let socket = harness.sockets[0] + XCTAssertTrue(socket.sent.isEmpty, "不能把 310 当连接参数提前发送") + XCTAssertFalse(harness.clock.has(20), "尚未收到欢迎帧时不启动业务订阅的心跳") + socket.emit(Data("Opened".utf8)) + socket.emit(Data("\"Opened\"".utf8)) + await settle { socket.receiveCount >= 3 } + XCTAssertEqual(socket.closeCount, 0) + XCTAssertEqual(harness.tickets.count, 1) + XCTAssertEqual(socket.sent.count, 1) + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(socket.sent[0].utf8)) as? [String: Any]) + XCTAssertEqual(body["type"] as? Int, 310) + XCTAssertEqual((body["params"] as? [String: Any])?["socket_token"] as? String, "MOCK-TICKET-1") + XCTAssertNotEqual(harness.session.state, .live) + XCTAssertTrue(harness.clock.has(12), "欢迎消息不能取消订阅超时") + socket.emit(try RealtimeTestData.ack()) + await settle { socket.receiveCount >= 4 } + XCTAssertNotEqual(harness.session.state, .live) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live } + XCTAssertEqual(harness.sockets.count, 1) + } + + /// ready/received 无论乱序、重复或出现在 Opened 前后,都不能发 310 或跳过正式 ack 加完整快照。 + func testDiagnosticAcksKeepSubscriptionAndSnapshotRequirements() async throws { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + var acceptedSnapshots = 0 + var states: [DroneDockShootingRealtimeSession.State] = [] + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.onConnectionState = { states.append($0) } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.clock.has(12) } + let socket = harness.sockets[0] + for ack in ["received", "ready", "ready"] { socket.emit(try RealtimeTestData.transportAck(ack)) } + await settle { socket.receiveCount >= 4 } + XCTAssertTrue(socket.sent.isEmpty) + XCTAssertFalse(harness.clock.has(20)) + XCTAssertEqual(harness.session.state, .connecting) + + socket.emit(Data("Opened".utf8)) + for ack in ["received", "received", "ready"] { socket.emit(try RealtimeTestData.transportAck(ack)) } + socket.emit(Data("Opened".utf8)) + await settle { socket.receiveCount >= 9 } + XCTAssertEqual(socket.sent.count, 1, "只有首次 Opened 触发文本订阅") + XCTAssertEqual(socket.closeCount, 0) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1, "诊断帧不能重设计时期限") + XCTAssertEqual(acceptedSnapshots, 0) + XCTAssertFalse(states.contains(.live)) + + socket.emit(try RealtimeTestData.ack()) + socket.emit(try RealtimeTestData.transportAck("received")) + await settle { socket.receiveCount >= 11 } + XCTAssertFalse(states.contains(.live), "正式 ack 之后仍需完整快照") + XCTAssertTrue(harness.clock.has(12)) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live && !harness.clock.has(12) } + XCTAssertEqual(acceptedSnapshots, 1) + + socket.emit(try RealtimeTestData.transportAck("ready")) + socket.emit(try RealtimeTestData.transportAck("received")) + await settle { socket.receiveCount >= 14 } + XCTAssertEqual(harness.session.state, .live) + XCTAssertEqual(socket.sent.count, 1) + XCTAssertEqual(harness.tickets.count, 1) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + } + + /// 诊断帧持续到达但没有正式订阅结果时,仍使用连接开始的十二秒期限。 + func testDiagnosticAcksDoNotExtendDeadlineWithOrWithoutOpened() async throws { + for receivesOpened in [false, true] { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.clock.has(12) } + let socket = harness.sockets[0] + if receivesOpened { socket.emit(Data("Opened".utf8)) } + for ack in ["ready", "received", "received", "ready"] { + socket.emit(try RealtimeTestData.transportAck(ack)) + } + await settle { socket.receiveCount >= (receivesOpened ? 6 : 5) } + XCTAssertEqual(socket.sent.count, receivesOpened ? 1 : 0) + XCTAssertEqual(harness.session.state, .connecting) + XCTAssertTrue(harness.clock.has(12)) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + harness.clock.fire(seconds: 12) + await settle { harness.clock.has(1) } + XCTAssertEqual(socket.closeCount, 1) + guard case .fallback = harness.session.state else { return XCTFail("无正式结果必须保留 HTTP 兜底") } + } + } + + /// 已入站不等于订阅已通过,缺少正式 ack 的完整快照也不能关闭 HTTP 兜底。 + func testReceivedAckCannotAuthorizeSnapshotBeforeFormalSubscription() async throws { + let harness = RealtimeHarness() + var acceptedSnapshots = 0 + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.transportAck("ready")) + socket.emit(try RealtimeTestData.transportAck("received")) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.clock.has(1) } + XCTAssertEqual(acceptedSnapshots, 0) + XCTAssertEqual(socket.closeCount, 1) + guard case .fallback = harness.session.state else { return XCTFail("入站回执不能替代订阅授权") } + } + + /// 正式订阅后的缓存提示只影响兜底文案,真或假均不能替代有效完整快照。 + func testMetadataAfterFormalAckStillRequiresFullSnapshot() async throws { + for hasSnapshot in [true, false] { + let harness = RealtimeHarness() + var acceptedSnapshots = 0 + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 && harness.clock.has(12) } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.ack()) + await settle { socket.receiveCount >= 3 } + XCTAssertEqual(harness.session.state, .connecting) + socket.emit(try RealtimeTestData.metadata(hasSnapshot: hasSnapshot)) + await settle { socket.receiveCount >= 4 } + XCTAssertNotEqual(harness.session.state, .live) + if hasSnapshot { XCTAssertEqual(harness.session.state, .connecting) } + else if case .fallback = harness.session.state {} else { XCTFail("明确无缓存时保留 HTTP 兜底") } + XCTAssertEqual(acceptedSnapshots, 0) + XCTAssertEqual(socket.closeCount, 0) + XCTAssertEqual(socket.sent.count, 1) + XCTAssertTrue(harness.clock.has(12)) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live && !harness.clock.has(12) } + XCTAssertEqual(acceptedSnapshots, 1) + XCTAssertEqual(harness.tickets.count, 1) + } + } + + /// 乱序元数据不能代替正式授权,即使带 subscribed=true 后接 full 也保持兜底。 + func testMetadataBeforeFormalAckCannotAuthorizeSnapshot() async throws { + for hasSnapshot in [true, false] { + let harness = RealtimeHarness() + var acceptedSnapshots = 0 + var states: [DroneDockShootingRealtimeSession.State] = [] + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.onConnectionState = { states.append($0) } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 && harness.clock.has(12) } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.metadata(hasSnapshot: hasSnapshot)) + socket.emit(try RealtimeTestData.metadata(hasSnapshot: hasSnapshot)) + await settle { socket.receiveCount >= 4 } + XCTAssertEqual(harness.session.state, .connecting, "正式订阅前的 meta 不得改变链路状态") + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.clock.has(1) } + XCTAssertEqual(acceptedSnapshots, 0) + XCTAssertFalse(states.contains(.live)) + XCTAssertEqual(socket.closeCount, 1) + guard case .fallback = harness.session.state else { return XCTFail("meta 不能替代正式订阅") } + } + } + + /// 重复缓存提示不重置首包期限,未收到 full 时仍在原十二秒期限重连。 + func testRepeatedMetadataWithoutFullSnapshotKeepsOriginalDeadline() async throws { + for hasSnapshot in [true, false] { + let harness = RealtimeHarness() + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 && harness.clock.has(12) } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.ack()) + for _ in 0..<3 { socket.emit(try RealtimeTestData.metadata(hasSnapshot: hasSnapshot)) } + await settle { socket.receiveCount >= 6 } + XCTAssertNotEqual(harness.session.state, .live) + XCTAssertTrue(harness.clock.has(12)) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + XCTAssertEqual(socket.sent.count, 1) + harness.clock.fire(seconds: 12) + await settle { harness.clock.has(1) } + XCTAssertEqual(socket.closeCount, 1) + XCTAssertEqual(harness.tickets.count, 1) + guard case .fallback = harness.session.state else { return XCTFail("缓存提示不能无限延长首包等待") } + } + } + + /// 有效 full 后迟到或重复的 meta 不降级实时连接,也不重新启动首包超时。 + func testLateMetadataCannotDowngradeLiveConnectionOrRestartDeadline() async throws { + let harness = RealtimeHarness() + var acceptedSnapshots = 0 + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 && harness.clock.has(12) } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.ack()) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live && !harness.clock.has(12) } + for hasSnapshot in [false, true, false, false] { + let receives = socket.receiveCount + socket.emit(try RealtimeTestData.metadata(hasSnapshot: hasSnapshot)) + await settle { socket.receiveCount > receives } + XCTAssertEqual(harness.session.state, .live) + XCTAssertFalse(harness.clock.has(12)) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + } + XCTAssertEqual(acceptedSnapshots, 1) + XCTAssertEqual(socket.closeCount, 0) + XCTAssertEqual(socket.sent.count, 1) + XCTAssertEqual(harness.tickets.count, 1) + } + + /// 其他任务的 meta 和全量不推进当前连接,当前任务自己的 full 到达后才进入实时。 + func testWrongTaskMetadataAndSnapshotCannotAdvanceConnection() async throws { + let harness = RealtimeHarness() + var acceptedSnapshots = 0 + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 && harness.clock.has(12) } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.ack()) + socket.emit(try RealtimeTestData.metadata(hasSnapshot: false, taskID: 999)) + var otherTask = RealtimeTestData.payload() + otherTask["order_flight_task_id"] = 999 + socket.emit(try RealtimeTestData.push(otherTask)) + await settle { socket.receiveCount >= 5 } + XCTAssertEqual(harness.session.state, .connecting) + XCTAssertEqual(acceptedSnapshots, 0) + XCTAssertTrue(harness.clock.has(12)) + XCTAssertEqual(harness.clock.waitCount(seconds: 12), 1) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live } + XCTAssertEqual(acceptedSnapshots, 1) + let receives = socket.receiveCount + socket.emit(try RealtimeTestData.metadata(hasSnapshot: false, taskID: 999)) + await settle { socket.receiveCount > receives } + XCTAssertEqual(harness.session.state, .live) + } + + /// 正式订阅回执属于其他任务时不能建立授权,立即回到只读兜底。 + func testWrongTaskFormalAckCannotEstablishSubscription() async throws { + let harness = RealtimeHarness() + var acceptedSnapshots = 0 + harness.session.onSnapshot = { _ in acceptedSnapshots += 1; return .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.first?.sent.count == 1 } + let socket = try XCTUnwrap(harness.sockets.first) + socket.emit(try RealtimeTestData.ack(taskID: 999)) + await settle { harness.clock.has(1) } + XCTAssertEqual(acceptedSnapshots, 0) + XCTAssertEqual(socket.closeCount, 1) + guard case .fallback = harness.session.state else { return XCTFail("其他任务的正式回执不能确认本任务订阅") } + } + + /// 只有欢迎消息而没有订阅结果时仍按原期限超时,不能误判为实时连接正常。 + func testOpenedWithoutAckStillTimesOut() async throws { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 && harness.clock.has(12) } + let socket = harness.sockets[0] + socket.emit(Data("Opened".utf8)) + await settle { socket.receiveCount >= 2 } + XCTAssertEqual(socket.sent.count, 1) + harness.clock.fire(seconds: 12) + await settle { harness.clock.has(1) } + XCTAssertEqual(socket.closeCount, 1) + guard case .fallback = harness.session.state else { return XCTFail("未完成订阅仍需 HTTP 兜底") } + } + + /// 连欢迎帧都未收到时保持 HTTP 兜底,重连重新取票;离页不会发送尚未订阅的 311。 + func testMissingOpenedTimesOutAndStoppedConnectionCannotSubscribeLate() async throws { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + harness.session.start() + await settle { harness.sockets.count == 1 && harness.clock.has(12) } + let first = harness.sockets[0] + harness.clock.fire(seconds: 12) + await settle { harness.clock.has(1) } + XCTAssertTrue(first.sent.isEmpty) + guard case .fallback = harness.session.state else { return XCTFail("欢迎帧超时也须兜底") } + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 } + let second = harness.sockets[1] + XCTAssertEqual(harness.tickets.count, 2) + XCTAssertTrue(second.sent.isEmpty) + harness.session.stop() + second.emit(Data("Opened".utf8)) + await Task.yield() + XCTAssertTrue(second.sent.isEmpty) + XCTAssertTrue(second.unsubscribed.isEmpty) + XCTAssertEqual(harness.session.state, .stopped) + } + + /// 本地文本帧发送失败不能视为订阅成功;新连接仍要等新 Opened 并使用新票据。 + func testSubscriptionSendFailureReconnectsAndWaitsForNewOpened() async throws { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 } + let first = harness.sockets[0] + first.sendError = APIError.networkFailed("模拟文本帧发送失败") + first.emit(Data("Opened".utf8)) + await settle { harness.clock.has(1) } + XCTAssertTrue(first.sent.isEmpty) + guard case .fallback = harness.session.state else { return XCTFail("发送失败必须兜底") } + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 } + let second = harness.sockets[1] + XCTAssertTrue(second.sent.isEmpty) + second.emit(Data("Opened".utf8)) + await settle { second.sent.count == 1 } + XCTAssertTrue(second.sent[0].contains("MOCK-TICKET-2")) + } + + /// 连接成功或异常顺序的 ack 都不能跳过实际的 310 订阅。 + func testAckBeforeOpenedDoesNotEstablishSubscription() async throws { + let harness = RealtimeHarness() + harness.automaticallyOpen = false + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 } + harness.sockets[0].emit(try RealtimeTestData.ack()) + await settle { harness.clock.has(1) } + XCTAssertTrue(harness.sockets[0].sent.isEmpty) + guard case .fallback = harness.session.state else { return XCTFail("未发送订阅不能进入实时状态") } + } + + func testDisconnectReconnectGetsNewTicketAndRequiresFreshSnapshot() async throws { + let harness = RealtimeHarness() + let model = try model() + await model.refresh() + harness.session.onSnapshot = { model.applyTaskSnapshot($0) } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 } + let first = harness.sockets[0] + first.emit(try RealtimeTestData.ack()) + first.emit(try RealtimeTestData.push(RealtimeTestData.payload(version: 5))) + await settle { harness.session.state == .live } + first.fail() + await settle { harness.clock.has(1) } + guard case .fallback = harness.session.state else { return XCTFail("断线应兜底") } + XCTAssertEqual(model.response?.stateVersion, 5) + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 } + XCTAssertEqual(harness.tickets.count, 2) + let second = harness.sockets[1] + second.emit(try RealtimeTestData.ack()) + second.emit(try RealtimeTestData.push(RealtimeTestData.payload(version: 3))) + await settle { second.receiveCount >= 4 } + XCTAssertNotEqual(harness.session.state, .live, "旧缓存不能解除兜底") + second.emit(try RealtimeTestData.push(RealtimeTestData.payload(version: 5))) + await settle { harness.session.state == .live } + XCTAssertEqual(model.response?.stateVersion, 5) + } + + func testExpiredTicketRefreshesWithBackoffWithoutAppLogout() async throws { + let harness = RealtimeHarness() + harness.session.start() + defer { harness.session.stop() } + for (index, delay) in [1, 2, 4].enumerated() { + await settle { harness.sockets.count == index + 1 } + harness.sockets[index].emit(try RealtimeTestData.rejection(100098, "Token 校验失败或已过期")) + await settle { harness.clock.has(UInt64(delay)) } + guard case .fallback = harness.session.state else { return XCTFail("票据失败不应停止任务") } + harness.clock.fire(seconds: UInt64(delay)) + } + await settle { harness.sockets.count == 4 && harness.sockets[3].sent.count == 1 } + XCTAssertEqual(harness.sockets.count, 4) + XCTAssertTrue(harness.sockets[3].sent[0].contains("MOCK-TICKET-4")) + } + + func testPermissionDenialStopsReconnectAndRetainsLockedSnapshot() async throws { + let harness = RealtimeHarness() + let model = try model() + await model.refresh() + harness.session.onConnectionState = { state in + if case .denied(let message) = state { model.stopReading(message: message) } + } + harness.session.start() + await settle { harness.sockets.count == 1 } + harness.sockets[0].emit(try RealtimeTestData.rejection(100099, "无权订阅该飞行任务")) + await settle { model.readAccessError != nil } + XCTAssertEqual(harness.session.state, .denied("无权订阅该飞行任务")) + XCTAssertFalse(model.canContinuePolling) + XCTAssertFalse(model.presentation.isActionEnabled) + XCTAssertNotNil(model.response) + harness.session.stop() + harness.session.start() + await Task.yield() + XCTAssertEqual(harness.tickets.count, 1) + XCTAssertEqual(harness.session.state, .denied("无权订阅该飞行任务")) + model.invalidate(preservingSnapshot: true) + XCTAssertEqual(model.errorMessage, "无权订阅该飞行任务") + } + + func testNoSnapshotAndMalformedPacketKeepFallback() async throws { + let harness = RealtimeHarness() + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 } + harness.sockets[0].emit(try RealtimeTestData.ack()) + harness.sockets[0].emit(try RealtimeTestData.metadata(hasSnapshot: false)) + await settle { if case .fallback = harness.session.state { return true }; return false } + harness.sockets[0].emit(Data("invalid JSON".utf8)) + await settle { harness.clock.has(1) } + XCTAssertEqual(harness.sockets[0].closeCount, 1) + } + + func testSubscriptionTimeoutAndPongTimeoutUseFallback() async throws { + let harness = RealtimeHarness() + harness.session.onSnapshot = { _ in .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.clock.has(12) && harness.sockets.count == 1 } + harness.clock.fire(seconds: 12) + await settle { harness.clock.has(1) } + harness.clock.fire(seconds: 1) + await settle { harness.sockets.count == 2 } + let socket = harness.sockets[1] + socket.emit(try RealtimeTestData.ack()) + socket.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await settle { harness.session.state == .live && harness.clock.has(20) } + socket.holdPing = true + harness.clock.fire(seconds: 20) + await settle { harness.clock.has(10) } + harness.clock.fire(seconds: 10) + await settle { harness.clock.has(1) } + guard case .fallback = harness.session.state else { return XCTFail("心跳超时应恢复 HTTP") } + XCTAssertEqual(socket.closeCount, 1) + } + + func testHealthyPongButStaleShootingDataUsesHTTPWithoutReconnect() async throws { + let harness = RealtimeHarness() + harness.session.onSnapshot = { _ in .applied } + harness.session.start() + defer { harness.session.stop() } + await settle { harness.sockets.count == 1 } + let socket = harness.sockets[0] + socket.emit(try RealtimeTestData.ack()) + var payload = RealtimeTestData.payload() + payload["ui"] = ["phase": "shooting"] + socket.emit(try RealtimeTestData.push(payload)) + await settle { harness.session.state == .live && harness.clock.has(20) } + harness.time = 119 + harness.clock.fire(seconds: 20) + await settle { socket.pingCount == 1 && harness.clock.has(20) } + XCTAssertEqual(harness.session.state, .live) + harness.time = 120 + harness.clock.fire(seconds: 20) + await settle { if case .fallback = harness.session.state { return true }; return false } + XCTAssertEqual(harness.tickets.count, 1, "数据陈旧无需重建健康链路") + payload["state_version"] = 2 + payload["metrics_stale"] = true + socket.emit(try RealtimeTestData.push(payload)) + await settle { socket.receiveCount >= 5 } + XCTAssertNotEqual(harness.session.state, .live, "后端确认的陈旧读数不能标成实时正常") + payload["state_version"] = 3 + payload["metrics_stale"] = false + socket.emit(try RealtimeTestData.push(payload)) + await settle { harness.session.state == .live } + XCTAssertEqual(harness.tickets.count, 1) + } + + func testStopAndIdentityChangePreventLateMessagesAndSubscription() async throws { + let harness = RealtimeHarness() + var snapshots = 0 + harness.session.onSnapshot = { _ in snapshots += 1; return .applied } + harness.session.start() + await settle { harness.sockets.first?.sent.count == 1 } + let old = harness.sockets[0] + harness.session.stop() + XCTAssertEqual(old.unsubscribed, [501]) + old.emit(try RealtimeTestData.push(RealtimeTestData.payload())) + await Task.yield() + XCTAssertEqual(snapshots, 0) + XCTAssertEqual(harness.session.state, .stopped) + harness.identityCurrent = false + harness.session.start() + guard case .denied = harness.session.state else { return XCTFail("身份变化必须停止") } + XCTAssertEqual(harness.tickets.count, 1) + } + + func testVersionsBatchIdentityAndFullReplacement() async throws { + let model = try model() + await model.refresh() + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(version: 5)), .applied) + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(version: 5)), .duplicate) + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(version: 4)), .outdated) + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(batch: 99, version: 900)), .outdated) + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(batch: 101, version: 1)), .applied) + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(batch: 100, version: 999)), .outdated) + XCTAssertEqual(model.response?.executionBatch, 101) + var wrong = RealtimeTestData.payload(batch: 102) + wrong["order_flight_task_id"] = 999 + XCTAssertEqual(model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(wrong)), .invalid) + XCTAssertEqual(model.response?.executionBatch, 101) + var empty = RealtimeTestData.payload(batch: 101, version: 2) + empty["metrics"] = [] + empty["metrics_stale"] = true + XCTAssertEqual(model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(empty)), .applied) + XCTAssertEqual(model.telemetry.batteryText, "0%", "同批次保留最近读数并明确显示过期") + XCTAssertTrue(model.isTelemetryStale) + XCTAssertTrue(model.response?.metrics.isEmpty == true, "原始完整快照不合并旧 metrics") + let raw = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(try XCTUnwrap(model.dataJSON).utf8)) as? [String: Any]) + XCTAssertEqual((raw["metrics"] as? [Any])?.count, 0, "展示层缓存不能改写返回 JSON") + } + + func testDelayedHTTPDoesNotOverwriteNewerPushOrIntroduceStaleError() async throws { + let context = DroneDockShootingTaskTestData.context() + let service = RealtimeSuspendedRead() + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + for fails in [false, true] { + let read = Task { await model.refresh() } + await settle { service.pending != nil } + XCTAssertEqual(model.applyTaskSnapshot(try RealtimeTestData.snapshot(version: fails ? 11 : 10)), .applied) + service.pending?.resume(with: fails ? .failure(APIError.networkFailed("模拟迟到错误")) : .success(try RealtimeTestData.snapshot(version: 2))) + service.pending = nil + await read.value + XCTAssertEqual(model.response?.stateVersion, fails ? 11 : 10) + XCTAssertNil(model.errorMessage) + } + XCTAssertEqual(service.liveBatteryValues, [false, false]) + } + + func testHTTPPermissionStopsButGenericBusinessFailureRetries() async throws { + let service = DroneDockShootingTaskTestService(result: .failure(APIError.serverCode(100099, "暂时不可用"))) + let context = DroneDockShootingTaskTestData.context() + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + await model.refresh() + XCTAssertTrue(model.canContinuePolling) + service.result = .failure(APIError.serverCode(100099, "无权查看该飞行任务")) + await model.refresh() + XCTAssertFalse(model.canContinuePolling) + await model.refresh() + XCTAssertEqual(service.requests.count, 2) + } + + private func model() throws -> DroneDockShootingTaskViewModel { + let context = DroneDockShootingTaskTestData.context() + let service = DroneDockShootingTaskTestService(result: .success(try RealtimeTestData.snapshot())) + return try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + } + + private func settle(_ condition: () -> Bool, file: StaticString = #filePath, line: UInt = #line) async { + for _ in 0..<300 { + if condition() { return } + try? await Task.sleep(nanoseconds: 1_000_000) + } + XCTAssertTrue(condition(), file: file, line: line) + } +} + +/// 匿名完整快照,供 Socket、模型和页面测试共用,不含真实设备数据。 +enum RealtimeTestData { + /// 采用新版录制结束契约的隔离数据:24/30/40 仍执行中,50 才是素材就绪。 + static func mediaStagePayload(wayline: Int, version: Int, orderNumber: String = "TEST-TASK-PAGE-001") -> [String: Any] { + let completed = wayline == 50 + var value = payload(version: version) + value["header"] = ["order_number": orderNumber, "title": "本地模拟:测试点位 · 测试航线"] + value["task"] = ["id": 501, "status": completed ? 30 : 20, "wayline_task_id": 100, + "wayline_status": wayline, "status_label": completed ? "成功" : "执行中"] + value["order_flight_task"] = ["id": 501, "status": completed ? 30 : 20, + "wayline_task_id": 100, "finished_at": "2026-01-01 12:00:00"] + value["execute_gate"] = ["can_execute": false, "primary_action": "blocked", + "code": "wayline_not_shooting", "message": "航线任务状态不可拍摄"] + value["ui"] = ["phase": completed ? "completed" : "post_shoot_uploading", + "title": completed ? "素材已就绪" : "拍摄完毕上传中", + "message": "本地模拟:录制已结束,素材处理完成后可查看。未连接无人机。", + "primary_action": completed ? "view_materials" : "wait_upload", + "primary_action_label": completed ? "查看素材" : "上传中", "commands": []] + return value + } + + static func payload(batch: Int = 100, version: Int = 1) -> [String: Any] { + DroneDockShootingTaskTestData.payload().merging([ + "order_flight_task_id": 501, "execution_batch": batch, "state_version": version, + "snapshot_kind": "full", "metrics_stale": false, + "ui": ["phase": "going_to_spot", "title": "本地模拟:前往拍摄点", "message": "未连接真实无人机"] + ]) { _, new in new } + } + static func snapshot(batch: Int = 100, version: Int = 1) throws -> DroneDockShootingResponse { + try DroneDockShootingTaskTestData.decode(payload(batch: batch, version: version)) + } + static func push(_ payload: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "OK", "data": ["action": "app_airport_shooting_updated", "params": payload]]) + } + /// 新版正式回执默认返回 null;传 nil 可模拟省略该提示,布尔值仅用于旧包兼容验证。 + static func ack(hasSnapshot: Any? = NSNull(), taskID: Int = 501) throws -> Data { + var body: [String: Any] = ["type": 310, "ack": "subscribe", "subscribed": true, "order_flight_task_id": taskID] + if let hasSnapshot { body["has_snapshot"] = hasSnapshot } + return try JSONSerialization.data(withJSONObject: ["code": 100000, "data": body]) + } + /// 缓存有无是后续独立消息,只提供明确布尔提示,不代表订阅授权。 + static func metadata(hasSnapshot: Bool, taskID: Int = 501) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "data": [ + "type": 310, "ack": "subscribe_meta", "subscribed": true, + "order_flight_task_id": taskID, "has_snapshot": hasSnapshot + ]]) + } + /// 文档仅约定 ack 字段,ready 不附任务身份,received 可带已入站的 type。 + static func transportAck(_ ack: String, code: Int = 100000) throws -> Data { + var body: [String: Any] = ["ack": ack] + if ack == "received" { body["type"] = 310 } + return try JSONSerialization.data(withJSONObject: ["code": code, "data": body]) + } + /// 只注入文档明确的超时 hint;错误码可变化,不能用于推断永久无权限。 + static func authenticationTimeout(code: Int, hint: String = "鉴权超时,请稍后重试") throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": "订阅失败", + "data": ["type": 310, "ack": "subscribe", "subscribed": false, "hint": hint]]) + } + static func subscriptionFailure(_ code: Int, _ message: String) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, + "data": ["type": 310, "ack": "subscribe", "subscribed": false]]) + } + static func rejection(_ code: Int, _ message: String) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": []]) + } +} + +/// 每次取票返回不同内存值,可验证过期后没有重用旧票据。 +@MainActor +final class RealtimeTestTickets: DroneDockSocketTicketServing { + private(set) var count = 0 + func socketTicket() async throws -> DroneDockSocketTicket { + count += 1 + return DroneDockSocketTicket(socketToken: "MOCK-TICKET-\(count)", expireSeconds: 3600) + } +} + +/// 从不连接 URLSession 的 Socket 替身,手动注入服务端消息与错误。 +@MainActor +final class RealtimeTestSocket: DroneDockShootingSocketTransport { + private(set) var sent: [String] = [] + private(set) var unsubscribed: [Int] = [] + private(set) var closeCount = 0 + private(set) var receiveCount = 0 + private(set) var pingCount = 0 + var holdPing = false + var sendError: Error? + private var inbound: [Result] = [] + private var receiver: CheckedContinuation? + private var pinger: CheckedContinuation? + func send(_ text: String) async throws { + if let sendError { throw sendError } + sent.append(text) + } + func receive() async throws -> Data { + try Task.checkCancellation() + receiveCount += 1 + if !inbound.isEmpty { return try inbound.removeFirst().get() } + return try await withCheckedThrowingContinuation { receiver = $0 } + } + func ping() async throws { + pingCount += 1 + if holdPing { try await withCheckedThrowingContinuation { pinger = $0 } } + } + func close(unsubscribing taskID: Int?) { + closeCount += 1 + if let taskID { unsubscribed.append(taskID) } + receiver?.resume(throwing: CancellationError()); receiver = nil + pinger?.resume(throwing: CancellationError()); pinger = nil + } + func emit(_ data: Data) { deliver(.success(data)) } + func fail() { deliver(.failure(APIError.networkFailed("本地模拟断线"))) } + private func deliver(_ result: Result) { + if let receiver { self.receiver = nil; receiver.resume(with: result) } + else { inbound.append(result) } + } +} + +/// 按指定间隔推进的虚拟时钟;取消会释放等待,不使用实际 30 秒超时。 +@MainActor +final class RealtimeTestClock { + private var pending: [(UUID, UInt64, CheckedContinuation)] = [] + private var waitCounts: [UInt64: Int] = [:] + func wait(_ nanos: UInt64) async throws { + let id = UUID() + try Task.checkCancellation() + waitCounts[nanos, default: 0] += 1 + try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { pending.append((id, nanos, $0)) } + } onCancel: { + Task { @MainActor in + guard let index = self.pending.firstIndex(where: { $0.0 == id }) else { return } + self.pending.remove(at: index).2.resume(throwing: CancellationError()) + } + } + } + /// 统计累计安排次数,区分保留原期限与取消后重新计时。 + func waitCount(seconds: UInt64) -> Int { waitCounts[seconds * 1_000_000_000, default: 0] } + func has(_ seconds: UInt64) -> Bool { pending.contains { $0.1 == seconds * 1_000_000_000 } } + func fire(seconds: UInt64) { + guard let index = pending.firstIndex(where: { $0.1 == seconds * 1_000_000_000 }) else { return } + pending.remove(at: index).2.resume() + } +} + +/// 组装可控连接序列,页面测试可复用同一只读订阅协调器。 +@MainActor +final class RealtimeHarness { + let tickets = RealtimeTestTickets() + let clock = RealtimeTestClock() + var sockets: [RealtimeTestSocket] = [] + var identityCurrent = true + var automaticallyOpen = true + var time: TimeInterval = 0 + lazy var session = DroneDockShootingRealtimeSession(taskID: 501, ticketService: tickets, + makeTransport: { [unowned self] in + let socket = RealtimeTestSocket() + if automaticallyOpen { socket.emit(Data("Opened".utf8)) } + sockets.append(socket) + return socket + }, identityIsCurrent: { [unowned self] in identityCurrent }, source: "local_simulation", now: { [unowned self] in time }, delay: { [clock] in try await clock.wait($0) }) +} + +/// 用于 HTTP/WS 竞争测试的挂起只读请求。 +@MainActor +private final class RealtimeSuspendedRead: DroneDockShootingServing { + var pending: CheckedContinuation? + var liveBatteryValues: [Bool] = [] + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + liveBatteryValues.append(liveBattery) + return try await withCheckedThrowingContinuation { pending = $0 } + } +} diff --git a/suixinkanTests/DroneDockShootingTaskTestSupport.swift b/suixinkanTests/DroneDockShootingTaskTestSupport.swift new file mode 100644 index 0000000..73fa67a --- /dev/null +++ b/suixinkanTests/DroneDockShootingTaskTestSupport.swift @@ -0,0 +1,79 @@ +import Foundation +@testable import suixinkan + +/// 真实拍摄任务页测试共享的匿名任务、订单和设备快照。 +enum DroneDockShootingTaskTestData { + /// 固定测试登录范围,参数可模拟切换景区或凭证。 + static func context(scenicID: Int = 128, token: String = "task-read-test-token") -> DroneDockHomeContext { + DroneDockHomeContext(userID: "task-read-user", accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: 38, photographerName: "测试员工", token: token) + } + + /// 进入页面时的订单摘要与 shooting 套餐名故意不同,验证服务端展示优先级。 + static func order() throws -> DroneDockHomeOrder { + try JSONDecoder().decode(DroneDockHomeOrder.self, from: Data(#"{"order_number":"TEST-TASK-PAGE-001","project_id":101,"project_name":"原订单五次套餐","user_phone":"测试游客","shoot_count":5,"shot_count":0,"remaining_count":5}"#.utf8)) + } + + /// 使用已确认的后端字段结构,测试数据不代表真实飞行结果。 + static func payload() -> [String: Any] { + ["order_flight_task": ["id": 501, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128, + "status": 10, "status_label": "待执行"], + "task": ["id": 501, "status": 10, "status_label": "待执行"], + "scenic": ["id": 128, "name": "测试景区"], + "scenic_spot": ["id": 201, "name": "测试点位"], + "air_line": ["id": 301, "name": "测试航线", "scenic_spot_id": 201], + "header": ["order_number": "TEST-TASK-PAGE-001", "title": "测试点位 · 测试航线", + "tourist_label": "测试游客", "package_name": "接口返回单次套餐"], + "current_plane": ["id": 58, "sn_number": "TEST-PLANE-058", "status_text": "空闲 · 电量 0%"], + "plane_status": ["scenic_id": 128, "connected": true, "poll_hint_ms": 5000], + "metrics": [["key": "battery", "value": "0%", "raw": 0], ["key": "env_temp", "value": "0°C"], + ["key": "wind_speed", "value": "0m/s"], ["key": "rainfall", "value": NSNull()], + ["key": "signal", "value": "—"], ["key": "satellite", "value": "0颗"]], + "execute_gate": ["can_execute": false, "code": "wayline_missing", "message": "测试门禁原因"], + "ui": ["phase": "blocked", "title": "任务尚未关联航线", "message": "测试阶段说明"]] + } + + /// 可覆盖顶层字段以测试缺失、未知状态与身份错误。 + static func response(changes: [String: Any] = [:]) throws -> DroneDockShootingResponse { + try decode(payload().merging(changes) { _, new in new }) + } + + /// 新版飞控合同的显式测试数据;调用方自行选择阶段及权限,缺失场景不自动补齐。 + static func flightControl(state: String = "executing", batch: Int = 100, + canPause: Bool = true, canResume: Bool = false, canReturn: Bool = true, + resumePhase: String? = nil, returnReason: String? = nil, + droneInDock: String? = "outside", isAirborne: Bool? = true, + pauseReason: String? = nil, pendingCommand: [String: Any]? = nil) -> [String: Any] { + ["state": state, "execution_batch": batch, "can_pause": canPause, + "can_resume": canResume, "can_return_home": canReturn, + "resume_phase": resumePhase as Any? ?? NSNull(), + "return_reason": returnReason as Any? ?? NSNull(), + "drone_in_dock": droneInDock as Any? ?? NSNull(), + "is_airborne": isAirborne as Any? ?? NSNull(), + "pause_reason": pauseReason as Any? ?? NSNull(), + "pending_command": pendingCommand as Any? ?? NSNull()] + } + + /// 从任意匿名 data 对象构造真实 DTO。 + static func decode(_ payload: [String: Any]) throws -> DroneDockShootingResponse { + try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } +} + +/// 可配置返回值的只读 shooting 替身,只记录任务 ID 与实时电量参数。 +@MainActor +final class DroneDockShootingTaskTestService: DroneDockShootingServing { + /// 当前读取结果,测试可模拟失败后恢复。 + var result: Result + /// 所有读取记录,不提供任何创建或飞控能力。 + private(set) var requests: [(taskID: Int, liveBattery: Bool)] = [] + + /// 注入匿名快照或读取错误。 + init(result: Result) { self.result = result } + + /// 返回配置结果,不自动重读或发送其他请求。 + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + requests.append((taskID, liveBattery)) + return try result.get() + } +} diff --git a/suixinkanTests/DroneDockShootingTaskViewModelTests.swift b/suixinkanTests/DroneDockShootingTaskViewModelTests.swift new file mode 100644 index 0000000..2ad1fd7 --- /dev/null +++ b/suixinkanTests/DroneDockShootingTaskViewModelTests.swift @@ -0,0 +1,557 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证真实任务页只读刷新保留快照、同任务重入和身份隔离,不接入飞控。 +@MainActor +final class DroneDockShootingTaskViewModelTests: XCTestCase { + /// 从召唤进入先展示同任务前往回执,首个明确到达快照可直接替换,不伪造最低等待时长。 + func testSummonReceiptShowsTravelUntilAuthoritativeArrivalSnapshot() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service, initialSummonReceipt: travelReceipt()) + defer { service.cancelAll() } + XCTAssertEqual(fixture.model.presentation.phase, .navigating) + XCTAssertEqual(fixture.model.statusTitle, "无人机正在赶来") + XCTAssertNil(fixture.model.response, "受理回执不能伪造完整状态或触发图传") + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + let pending = Task { await fixture.model.refresh() } + await waitForRequests(1, service: service) + XCTAssertTrue(fixture.model.isLoading) + XCTAssertEqual(fixture.model.presentation.title, "无人机正在赶来") + service.resolve(0, with: .success(try DroneDockShootingTaskTestData.response(changes: [ + "execution_batch": 100, "state_version": 1, + "flight_control": DroneDockShootingTaskTestData.flightControl( + resumePhase: "arrived_pending_start", pauseReason: "arrival_wait"), + "order_flight_task": ["id": 501, "status": 20], "task": ["id": 501, "status": 20], + "ui": ["phase": "arrived_pending_start", "title": "无人机已到达"], + "execute_gate": ["can_execute": true, "primary_action": "start_shoot"] + ]))) + await pending.value + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.model.presentation.title, "无人机已到达") + fixture.model.invalidate() + XCTAssertNotEqual(fixture.model.presentation.phase, .navigating, "首次回执不能在重入时复活旧的前往阶段") + } + + /// 受理成功、错误任务、缺少身份或非前往阶段都不能凭空生成正在赶来。 + func testTravelReceiptRequiresExplicitPhaseAndMatchingIdentity() throws { + let invalid: [[String: Any]] = [ + ["accepted": false], ["accepted": NSNull()], ["ui": ["phase": "arrived_pending_start"]], + ["ui": ["title": "无人机正在赶来"]], ["order_flight_task": NSNull()], + ["order_flight_task": ["id": 502, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128]], + ["order_flight_task": ["id": 501, "order_number": "OTHER", "scenic_id": 128]], + ["order_flight_task": ["id": 501, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 129]], + ["order_flight_task_id": 502] + ] + for changes in invalid { + let fixture = try ShootingTaskFixture(initialSummonReceipt: travelReceipt(changes)) + XCTAssertNotEqual(fixture.model.presentation.phase, .navigating) + XCTAssertFalse(fixture.model.canStartShooting) + } + } + + /// 状态读取失败和身份变化优先于首次前往回执,不能掩盖失联或串账号。 + func testTravelReceiptDoesNotHideReadFailureOrIdentityChange() async throws { + let fixture = try ShootingTaskFixture(initialSummonReceipt: travelReceipt()) + fixture.service.result = .failure(APIError.networkFailed("本地模拟断网")) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .readError) + fixture.scope.context = DroneDockShootingTaskTestData.context(scenicID: 129) + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertEqual(fixture.model.presentation.phase, .readError) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + } + + /// 匿名回执的顶层 task_id 故意不同,验证它不会被误当订单任务 ID。 + private func travelReceipt(_ changes: [String: Any] = [:]) throws -> DroneDockShootResponse { + let base: [String: Any] = [ + "accepted": true, "task_id": 9001, + "order_flight_task": ["id": 501, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128], + "ui": ["phase": "going_to_spot", "title": "无人机正在前往点位"] + ] + let data = try JSONSerialization.data(withJSONObject: base.merging(changes) { _, new in new }) + return DroneDockShootResponse(dataJSON: String(decoding: data, as: UTF8.self)) + } + /// 同一上传快照无论来自 HTTP 还是 WS,均不能被开拍门禁或 finished_at 误判为阻止/完成。 + func testPostShootStagesMatchAcrossHTTPAndWebSocket() async throws { + for (index, wayline) in [24, 30, 40].enumerated() { + let payload = RealtimeTestData.mediaStagePayload(wayline: wayline, version: index + 1) + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.decode(payload)) + await fixture.model.refresh() + let presentation = fixture.model.presentation + XCTAssertEqual(presentation.phase, .postShootUploading) + XCTAssertEqual(presentation.title, "拍摄已完成") + XCTAssertEqual(presentation.action, .materials, "录制结束即可前往素材库查看上传进度") + XCTAssertTrue(presentation.isActionEnabled) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertTrue(fixture.model.availableSafetyCommands.isEmpty) + XCTAssertEqual(fixture.model.response?.orderFlightTask?.status, 20) + + let socketFixture = try ShootingTaskFixture() + guard case .snapshot(let snapshot) = try DroneDockShootingSocketMessage.decode(RealtimeTestData.push(payload)) else { + return XCTFail("新版 100000 推送必须解析完整快照") + } + XCTAssertEqual(socketFixture.model.applyTaskSnapshot(snapshot), .applied) + XCTAssertEqual(socketFixture.model.presentation, presentation) + } + } + + /// 依次上传、素材就绪后才提供素材入口;迟到的上传包不能回退完成态。 + func testPostShootBecomesCompletedOnlyAfterReadySnapshot() async throws { + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.decode( + RealtimeTestData.mediaStagePayload(wayline: 30, version: 10))) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .postShootUploading) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode( + RealtimeTestData.mediaStagePayload(wayline: 50, version: 11))), .applied) + XCTAssertEqual(fixture.model.presentation.phase, .completed) + XCTAssertEqual(fixture.model.presentation.title, "拍摄已完成") + XCTAssertEqual(fixture.model.presentation.message, "素材已就绪,可前往素材库查看。") + XCTAssertEqual(fixture.model.presentation.action, .materials) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode( + RealtimeTestData.mediaStagePayload(wayline: 30, version: 10))), .outdated) + XCTAssertEqual(fixture.model.presentation.phase, .completed) + } + + /// 新阶段标题缺省有明确兜底;真正失败仍优先,冲突的成功状态不提前开放素材入口。 + func testPostShootFallbackTitleFailureAndConflictingSuccess() async throws { + var payload = RealtimeTestData.mediaStagePayload(wayline: 30, version: 1) + payload["ui"] = ["phase": "post_shoot_uploading"] + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.decode(payload)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.title, "拍摄已完成") + XCTAssertEqual(fixture.model.statusTitle, "拍摄已完成") + XCTAssertEqual(fixture.model.presentation.message, "本次拍摄已结束,可前往查看素材。\n素材上传中,可在素材库查看进度。") + payload["task"] = ["id": 501, "status": 40, "wayline_status": 91] + payload["order_flight_task"] = ["id": 501, "status": 40] + payload["state_version"] = 2 + fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(payload)) + XCTAssertEqual(fixture.model.presentation.phase, .failed) + payload["task"] = ["id": 501, "status": 30, "wayline_status": 50] + payload["order_flight_task"] = ["id": 501, "status": 30] + payload["state_version"] = 3 + fixture.model.applyTaskSnapshot(try DroneDockShootingTaskTestData.decode(payload)) + XCTAssertEqual(fixture.model.presentation.phase, .unknown) + XCTAssertNotEqual(fixture.model.presentation.action, .materials) + } + + /// 完成文案只在当前设备明确返航时提示返航,不把原型文案当作设备事实。 + func testPostShootReturnNoticeRequiresCurrentPlaneReturningState() async throws { + for label in ["返航中", "正在返航", "空闲", "拍摄中", ""] { + var payload = RealtimeTestData.mediaStagePayload(wayline: 24, version: 1) + payload["current_plane"] = ["id": 22, "work_status_label": label] + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.decode(payload)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.message.contains("无人机正在返航"), ["返航中", "正在返航"].contains(label)) + XCTAssertEqual(fixture.model.presentation.action, .materials) + } + } + + /// 缺省/无效间隔回退到五秒,合法建议限制在两至三十秒,避免紧密请求或溢出。 + func testPollingIntervalUsesBoundedServerHint() async throws { + for (hint, expected) in [(0, 5_000), (-1, 5_000), (1, 2_000), (8_000, 8_000), (Int.max, 30_000)] { + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.response( + changes: ["plane_status": ["poll_hint_ms": hint]])) + XCTAssertEqual(fixture.model.pollIntervalNanoseconds, 5_000_000_000) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.pollIntervalNanoseconds, UInt64(expected) * 1_000_000) + } + } + /// 进入、刷新和返回始终读取传入的同一任务,构造本身不发请求。 + func testRefreshAndReturnReadSameTaskWithoutLiveBattery() async throws { + let fixture = try ShootingTaskFixture() + XCTAssertTrue(fixture.service.requests.isEmpty) + await fixture.model.refresh() + await fixture.model.refresh() + fixture.model.invalidate() + XCTAssertNil(fixture.model.response) + await fixture.model.refresh() + XCTAssertEqual(fixture.service.requests.map(\.taskID), [501, 501, 501]) + XCTAssertTrue(fixture.service.requests.allSatisfy { !$0.liveBattery }) + XCTAssertNotNil(fixture.model.dataJSON) + XCTAssertFalse(fixture.model.isLoading) + } + + /// 阶段标题由本地定义,套餐和读数保留接口原值,GET 成功不替换阻止状态。 + func testDisplayUsesLocalTaskStateAndServerPackageAndZeroTelemetry() async throws { + let fixture = try ShootingTaskFixture() + await fixture.model.refresh() + XCTAssertEqual(fixture.model.title, "测试点位 · 测试航线") + XCTAssertEqual(fixture.model.subtitle, "测试游客 · 接口返回单次套餐") + XCTAssertEqual(fixture.model.statusTitle, "当前任务暂不可执行") + XCTAssertEqual(fixture.model.statusMessage, "测试门禁原因") + XCTAssertEqual(fixture.model.deviceStatusText, "空闲 · 电量 0%") + XCTAssertEqual(fixture.model.response?.executeGate?.canExecute, false) + XCTAssertEqual(fixture.model.telemetry.batteryText, "0%") + XCTAssertEqual(fixture.model.telemetry.temperatureText, "0°C") + XCTAssertEqual(fixture.model.telemetry.windText, "0m/s") + XCTAssertEqual(fixture.model.telemetry.satelliteText, "0颗") + XCTAssertEqual(fixture.model.telemetry.rainText, "—") + XCTAssertEqual(fixture.model.telemetry.signalText, "—") + XCTAssertFalse(fixture.model.isTelemetryStale) + } + + /// 未返回任务阶段和读数时显示未知,不从成功响应或 execute_gate=true 编造到达。 + func testMissingFieldsStayUnknownWithoutInferringFlightPhase() async throws { + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.decode(["execute_gate": ["can_execute": true]])) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.title, "拍摄任务") + XCTAssertEqual(fixture.model.statusTitle, "状态待确认") + XCTAssertEqual(fixture.model.statusMessage, "暂无法确认任务状态,请刷新后重试。") + XCTAssertEqual(fixture.model.deviceStatusText, "—") + XCTAssertEqual(fixture.model.telemetry, DroneDockShootingTelemetry(batteryText: "—", temperatureText: "—", + windText: "—", rainText: "—", signalText: "—", satelliteText: "—")) + } + + /// 普通刷新失败保留最近一次成功快照,错误单独提供,成功重试后清除错误。 + func testFailurePreservesPreviousResponseAndCanRecoverSameTask() async throws { + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.response(changes: ["execute_gate": ["can_execute": true]])) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.response?.executeGate?.canExecute, true) + let previousJSON = fixture.model.dataJSON + let previousPresentation = fixture.model.presentation + fixture.service.result = .failure(APIError.networkFailed("测试断网")) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.dataJSON, previousJSON) + XCTAssertEqual(fixture.model.presentation, previousPresentation) + XCTAssertFalse(fixture.model.isTelemetryStale) + XCTAssertEqual(fixture.model.telemetry.batteryText, "0%") + XCTAssertEqual(fixture.model.errorMessage, "网络请求失败:测试断网") + fixture.service.result = .success(try DroneDockShootingTaskTestData.response()) + await fixture.model.refresh() + XCTAssertEqual(fixture.service.requests.map(\.taskID), [501, 501, 501]) + XCTAssertNil(fixture.model.errorMessage) + } + + /// HTTP 200 中的整数 100050 与 data:[] 保留友好业务错误和旧快照,下一次只读成功即可恢复。 + func testIntegerDatabaseErrorFromAPIKeepsSnapshotAndRecoversWithoutPermissionDenial() async throws { + let context = DroneDockShootingTaskTestData.context() + let message = "任务状态处理失败,请稍后重试" + let first = DroneDockShootingTaskTestData.payload().merging([ + "order_flight_task_id": 501, "execution_batch": 9001, "state_version": 1, "snapshot_kind": "full", + "task": ["id": 501, "status": 20], "order_flight_task": ["id": 501, "status": 20], + "ui": ["phase": "shooting"], + "flight_control": DroneDockShootingTaskTestData.flightControl(batch: 9001, resumePhase: "shooting") + ]) { _, new in new } + let next = first.merging(["state_version": 2, "metrics": [["key": "battery", "value": "93%", "raw": 93]]]) { _, new in new } + let bodies: [[String: Any]] = [ + ["code": 100000, "msg": "success", "data": first], + ["code": 100050, "msg": message, "data": []], + ["code": 100000, "msg": "success", "data": next] + ] + let session = MockURLSession(responses: try bodies.map { try JSONSerialization.data(withJSONObject: $0) }) + let model = try DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: DroneDockShootingTaskTestData.order(), + service: DroneDockShootingAPI(client: APIClient(environment: .testing, session: session)), + currentContext: { context }) + await model.refresh() + let previous = model.response + XCTAssertEqual(model.presentation.phase, .shooting) + await model.refresh() + XCTAssertEqual(model.response, previous) + XCTAssertEqual(model.errorMessage, message) + XCTAssertEqual(model.presentation.phase, .shooting) + XCTAssertEqual(model.telemetry.batteryText, "0%") + XCTAssertNil(model.readAccessError) + XCTAssertTrue(model.canContinuePolling) + XCTAssertEqual(session.requests.count, 2, "业务错误不会自行重试请求") + await model.refresh() + XCTAssertNil(model.errorMessage) + XCTAssertEqual(model.response?.stateVersion, 2) + XCTAssertEqual(model.telemetry.batteryText, "93%") + XCTAssertTrue(model.canContinuePolling) + XCTAssertEqual(session.requests.count, 3) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" && $0.url?.path == "/api/app/airport/shooting" }) + XCTAssertTrue(session.requests.allSatisfy { request in + URLComponents(url: request.url!, resolvingAgainstBaseURL: false)?.queryItems? + .first(where: { $0.name == "live_battery" })?.value == "0" + }) + } + + /// 挂起刷新时保留旧标题、阶段与读数,成功回包后一次性换为新快照。 + func testRefreshRetainsSnapshotUntilNewSuccessfulSnapshotArrives() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + try await seedSnapshot(fixture, service: service) + let previousJSON = fixture.model.dataJSON + let previousTelemetry = fixture.model.telemetry + let pending = Task { await fixture.model.refresh() } + await waitForRequests(2, service: service) + XCTAssertTrue(fixture.model.isLoading) + XCTAssertEqual(fixture.model.dataJSON, previousJSON) + XCTAssertEqual(fixture.model.title, "测试点位 · 测试航线") + XCTAssertEqual(fixture.model.statusTitle, "当前任务暂不可执行") + XCTAssertEqual(fixture.model.statusMessage, "测试门禁原因") + XCTAssertEqual(fixture.model.presentation.phase, .blocked) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertEqual(fixture.model.telemetry, previousTelemetry) + XCTAssertFalse(fixture.model.isTelemetryStale) + let next = try DroneDockShootingTaskTestData.response(changes: [ + "header": ["title": "新的点位摘要"], + "ui": ["phase": "shooting", "title": "正在拍摄", "message": "新的任务说明"], + "current_plane": ["status_text": "拍摄中 · 电量 92%"], + "metrics": [["key": "battery", "value": "92%"]] + ]) + service.resolve(1, with: .success(next)) + await pending.value + XCTAssertFalse(fixture.model.isLoading) + XCTAssertEqual(fixture.model.dataJSON, next.dataJSON) + XCTAssertEqual(fixture.model.title, "新的点位摘要") + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertEqual(fixture.model.statusMessage, "请关注现场及实时画面。\n请勿关闭本页或息屏。") + XCTAssertTrue(fixture.model.dataJSON?.contains("新的任务说明") == true, "原始后端说明继续保留在快照中") + XCTAssertEqual(fixture.model.deviceStatusText, "拍摄中 · 电量 92%") + XCTAssertEqual(fixture.model.telemetry.batteryText, "92%") + } + + /// 取消刷新不能使已有内容闪空,也不能接纳被取消请求的迟到成功。 + func testCancelledRefreshPreservesSnapshotAndRejectsLateData() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + try await seedSnapshot(fixture, service: service) + let previousJSON = fixture.model.dataJSON + let pending = Task { await fixture.model.refresh() } + await waitForRequests(2, service: service) + pending.cancel() + service.resolve(1, with: .success(try DroneDockShootingTaskTestData.response(changes: ["ui": ["title": "迟到状态"]]))) + await pending.value + XCTAssertEqual(fixture.model.dataJSON, previousJSON) + XCTAssertFalse(fixture.model.isLoading) + XCTAssertFalse(fixture.model.isTelemetryStale) + XCTAssertNil(fixture.model.errorMessage) + } + + /// 后台保留快照并使旧代次失效,回前台的新读取成功后旧请求不能覆盖。 + func testPreservedInvalidationRejectsLateResponseAndAllowsNewRead() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + try await seedSnapshot(fixture, service: service) + let previousJSON = fixture.model.dataJSON + let oldRequest = Task { await fixture.model.refresh() } + await waitForRequests(2, service: service) + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertEqual(fixture.model.dataJSON, previousJSON) + XCTAssertFalse(fixture.model.isLoading) + let newRequest = Task { await fixture.model.refresh() } + await waitForRequests(3, service: service) + XCTAssertEqual(fixture.model.dataJSON, previousJSON) + service.resolve(2, with: .success(try DroneDockShootingTaskTestData.response(changes: ["ui": ["title": "前台最新状态"]]))) + await newRequest.value + service.resolve(1, with: .success(try DroneDockShootingTaskTestData.response(changes: ["ui": ["title": "后台迟到状态"]]))) + await oldRequest.value + XCTAssertEqual(fixture.model.statusTitle, "状态待确认") + XCTAssertEqual(fixture.model.response?.ui?.title, "前台最新状态") + XCTAssertEqual(service.requests, [501, 501, 501]) + } + + /// 即使要求保留快照,账号、景区或凭证变化也立即清除旧内容并锁定旧任务。 + func testPreservedInvalidationClearsSnapshotAfterContextChange() async throws { + let fixture = try ShootingTaskFixture() + await fixture.model.refresh() + fixture.scope.context = DroneDockShootingTaskTestData.context(token: "changed-token") + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertNil(fixture.model.response) + XCTAssertTrue(fixture.model.errorMessage?.contains("账号或景区已变化") == true) + await fixture.model.refresh() + XCTAssertEqual(fixture.service.requests.count, 1) + } + + /// 保留旧快照的刷新途中换景区,回包时必须撤下旧快照并拒绝新数据。 + func testContextChangeDuringRefreshClearsRetainedSnapshot() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + try await seedSnapshot(fixture, service: service) + let pending = Task { await fixture.model.refresh() } + await waitForRequests(2, service: service) + fixture.scope.context = DroneDockShootingTaskTestData.context(scenicID: 129) + service.resolve(1, with: .success(try DroneDockShootingTaskTestData.response())) + await pending.value + XCTAssertNil(fixture.model.response) + XCTAssertTrue(fixture.model.errorMessage?.contains("账号或景区已变化") == true) + await fixture.model.refresh() + XCTAssertEqual(service.requests.count, 2) + } + + /// 服务端返回另一任务时清空缓存,不能把身份不匹配当作普通刷新失败。 + func testMismatchedRefreshResponseClearsRetainedSnapshot() async throws { + let fixture = try ShootingTaskFixture() + await fixture.model.refresh() + fixture.service.result = .success(try DroneDockShootingTaskTestData.response(changes: ["task": ["id": 502]])) + await fixture.model.refresh() + XCTAssertNil(fixture.model.response) + XCTAssertTrue(fixture.model.isTelemetryStale) + XCTAssertTrue(fixture.model.errorMessage?.contains("不一致") == true) + } + + /// 所有实际返回的任务、订单及景区身份都必须一致,不能只校验根层订单号。 + func testAnyMismatchedReturnedIdentityIsRejected() async throws { + let cases: [[String: Any]] = [ + ["order_number": "OTHER"], ["order_flight_task": ["id": 502]], ["task": ["id": 502]], + ["order_flight_task": ["order_number": "OTHER"]], ["task": ["order_number": "OTHER"]], + ["header": ["order_number": "OTHER"]], ["scenic": ["id": 129]], + ["order_flight_task": ["scenic_id": 129]], ["task": ["scenic_id": 129]], + ["plane_status": ["scenic_id": 129]] + ] + for changes in cases { + let fixture = try ShootingTaskFixture(response: DroneDockShootingTaskTestData.response(changes: changes)) + await fixture.model.refresh() + XCTAssertNil(fixture.model.response) + XCTAssertTrue(fixture.model.errorMessage?.contains("不一致") == true) + XCTAssertEqual(fixture.service.requests.count, 1) + } + } + + /// 缺失任务或登录范围时不发送请求;当前账号切换也在发送前终止。 + func testInvalidInputOrChangedContextDoesNotRequest() async throws { + for taskID in [0, -1] { + let fixture = try ShootingTaskFixture(taskID: taskID) + await fixture.model.refresh() + XCTAssertTrue(fixture.service.requests.isEmpty) + XCTAssertNotNil(fixture.model.errorMessage) + } + let invalid = try ShootingTaskFixture(context: DroneDockShootingTaskTestData.context(token: "")) + await invalid.model.refresh() + XCTAssertTrue(invalid.service.requests.isEmpty) + let changed = try ShootingTaskFixture() + changed.scope.context = DroneDockShootingTaskTestData.context(token: "new-token") + await changed.model.refresh() + XCTAssertTrue(changed.service.requests.isEmpty) + XCTAssertTrue(changed.model.errorMessage?.contains("账号或景区已变化") == true) + changed.scope.context = DroneDockShootingTaskTestData.context() + await changed.model.refresh() + XCTAssertTrue(changed.service.requests.isEmpty) + } + + /// 读取未结束时额外刷新不产生第二个请求。 + func testOverlappingRefreshIsIgnored() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + let first = Task { await fixture.model.refresh() } + await waitForRequests(1, service: service) + XCTAssertTrue(fixture.model.isLoading) + await fixture.model.refresh() + XCTAssertEqual(service.requests, [501]) + service.resolve(0, with: .success(try DroneDockShootingTaskTestData.response())) + await first.value + XCTAssertFalse(fixture.model.isLoading) + } + + /// 离开后迟到回包不能覆盖重新进入后的新快照,读取仍使用同一任务。 + func testInvalidatedOldResponseCannotOverwriteNewRead() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + let first = Task { await fixture.model.refresh() } + await waitForRequests(1, service: service) + fixture.model.invalidate() + let second = Task { await fixture.model.refresh() } + await waitForRequests(2, service: service) + service.resolve(1, with: .success(try DroneDockShootingTaskTestData.response(changes: ["ui": ["title": "最新状态"]]))) + await second.value + service.resolve(0, with: .success(try DroneDockShootingTaskTestData.response(changes: ["ui": ["title": "过期状态"]]))) + await first.value + XCTAssertEqual(fixture.model.statusTitle, "状态待确认") + XCTAssertEqual(fixture.model.response?.ui?.title, "最新状态") + XCTAssertEqual(service.requests, [501, 501]) + } + + /// 取消后的成功回包也不恢复设备与执行门禁快照。 + func testCancelledResponseIsDiscarded() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + let pending = Task { await fixture.model.refresh() } + await waitForRequests(1, service: service) + pending.cancel() + service.resolve(0, with: .success(try DroneDockShootingTaskTestData.response())) + await pending.value + XCTAssertNil(fixture.model.response) + XCTAssertFalse(fixture.model.isLoading) + XCTAssertTrue(fixture.model.isTelemetryStale) + } + + /// 在请求途中换景区,迟到响应被丢弃,后续不再用旧任务发请求。 + func testContextChangeRejectsLateResponseAndFurtherReads() async throws { + let service = DeferredShootingTaskService() + let fixture = try ShootingTaskFixture(service: service) + defer { service.cancelAll() } + let pending = Task { await fixture.model.refresh() } + await waitForRequests(1, service: service) + fixture.scope.context = DroneDockShootingTaskTestData.context(scenicID: 129) + service.resolve(0, with: .success(try DroneDockShootingTaskTestData.response())) + await pending.value + XCTAssertNil(fixture.model.response) + XCTAssertTrue(fixture.model.errorMessage?.contains("账号或景区已变化") == true) + await fixture.model.refresh() + XCTAssertEqual(service.requests, [501]) + } + + private func waitForRequests(_ count: Int, service: DeferredShootingTaskService) async { + for _ in 0..<100 where service.requests.count < count { await Task.yield() } + XCTAssertEqual(service.requests.count, count) + } + + private func seedSnapshot(_ fixture: ShootingTaskFixture, service: DeferredShootingTaskService) async throws { + let initial = Task { await fixture.model.refresh() } + await waitForRequests(1, service: service) + service.resolve(0, with: .success(try DroneDockShootingTaskTestData.response())) + await initial.value + } +} + +/// 每项测试隔离订单、会话和读取服务,避免共享可变全局状态。 +@MainActor +private final class ShootingTaskFixture { + let service: DroneDockShootingTaskTestService + let scope: ShootingTaskScope + let model: DroneDockShootingTaskViewModel + + init(taskID: Int = 501, context: DroneDockHomeContext = DroneDockShootingTaskTestData.context(), + response: DroneDockShootingResponse? = nil, service customService: (any DroneDockShootingServing)? = nil, + initialSummonReceipt: DroneDockShootResponse? = nil) throws { + service = DroneDockShootingTaskTestService(result: .success(try response ?? DroneDockShootingTaskTestData.response())) + scope = ShootingTaskScope(context: context) + let currentScope = scope + model = DroneDockShootingTaskViewModel(context: context, taskID: taskID, order: try DroneDockShootingTaskTestData.order(), + service: customService ?? service, initialSummonReceipt: initialSummonReceipt, + currentContext: { currentScope.context }) + } +} + +/// 当前会话可独立变更,验证页面冻结身份不随外部切换漂移。 +@MainActor +private final class ShootingTaskScope { + var context: DroneDockHomeContext + init(context: DroneDockHomeContext) { self.context = context } +} + +/// 可按任意顺序完成的只读请求替身,用于验证取消与旧响应隔离。 +@MainActor +private final class DeferredShootingTaskService: DroneDockShootingServing { + private(set) var requests: [Int] = [] + private var pending: [Int: CheckedContinuation] = [:] + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + let index = requests.count + requests.append(taskID) + return try await withCheckedThrowingContinuation { pending[index] = $0 } + } + + func resolve(_ index: Int, with result: Result) { + pending.removeValue(forKey: index)?.resume(with: result) + } + + func cancelAll() { + let values = Array(pending.values) + pending.removeAll() + values.forEach { $0.resume(throwing: CancellationError()) } + } +} diff --git a/suixinkanTests/DroneDockShootingTaskViewTests.swift b/suixinkanTests/DroneDockShootingTaskViewTests.swift new file mode 100644 index 0000000..13e74c8 --- /dev/null +++ b/suixinkanTests/DroneDockShootingTaskViewTests.swift @@ -0,0 +1,891 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证任务页前台串行轮询、旧快照保留与生命周期取消;网络均为隔离替身。 +@MainActor +final class DroneDockShootingTaskViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 正常拍摄对齐原型且没有详情/中央刷新动作;导航栏仍能读取同一任务。 + func testShootingMatchesPrototypeAndKeepsNavigationRefresh() async throws { + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "shooting", title: "后端旧拍摄标题")) + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .shooting && clock.pendingCount == 1 } + XCTAssertNil(find(in: controller.view, id: "drone.task.remote.details")) + XCTAssertNil(find(in: controller.view, id: "drone.task.remote.refresh")) + let title = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.statusTitle") as? UILabel) + let message = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.statusMessage") as? UILabel) + let indicator = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.shootingIndicator") as? UIButton) + XCTAssertEqual(title.text, "无人机正在拍摄中") + XCTAssertEqual(message.text, "请关注现场及实时画面。\n请勿关闭本页或息屏。") + XCTAssertFalse(indicator.isEnabled) + XCTAssertFalse(hidden(indicator)) + let regions = fixedFrames(in: controller.view) + indicator.sendActions(for: .touchUpInside) + XCTAssertEqual(service.requests, [501], "禁用的拍摄中展示不产生操作") + try tapNavigationRefresh(controller) + try await settle(window) { service.requests.count == 2 && !controller.viewModel.isLoading } + XCTAssertEqual(service.requests, [501, 501]) + XCTAssertEqual(fixedFrames(in: controller.view), regions) + XCTAssertEqual(controller.viewModel.presentation.phase, .shooting) + try await Task.sleep(for: .milliseconds(300)) + window.layoutIfNeeded() + capture(window, name: "拍摄中-对齐体验网页(隔离替身)") + } + + /// 首份 shooting 挂起期间保留召唤回执的前往提示,页面加载占位不能覆盖它。 + func testInitialReadKeepsAcceptedTravelReceiptVisible() async throws { + let receipt = DroneDockShootResponse(dataJSON: #"{"accepted":true,"task_id":9001,"order_flight_task":{"id":501,"order_number":"TEST-TASK-501","scenic_id":128},"ui":{"phase":"going_to_spot"}}"#) + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "arrived_pending_start", title: "本地模拟:无人机已到达")) + service.suspendNext = true + let controller = try makeController(service: service, initialSummonReceipt: receipt) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { controller.viewModel.isLoading } + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机正在赶来")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("正在获取任务状态")) + service.finish() + try await settle(window) { controller.viewModel.presentation.phase == .ready } + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机已到达")) + } + + /// 使用模拟 WebSocket 推进任务阶段,断线立即 HTTP 兜底,恢复后停轮询;固定布局不变。 + func testRealtimeUpdatesPageAndAutomaticallyFallsBackThenRecovers() async throws { + let harness = RealtimeHarness() + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "going_to_spot", title: "本地模拟:前往拍摄点")) + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }, realtime: harness.session) + let window = makeWindow(root: controller) + defer { harness.session.stop(); service.cancelAll(); close(window) } + try await settle(window) { harness.sockets.count == 1 && clock.pendingCount == 1 } + XCTAssertEqual(service.requests, [501], "首次 HTTP 后才订阅") + let fixedBefore = fixedFrames(in: controller.view) + let socket = harness.sockets[0] + socket.emit(try RealtimeTestData.ack()) + try await settle(window) { socket.receiveCount >= 3 } + XCTAssertEqual(clock.pendingCount, 1, "只有 ack 时继续兜底") + let ready = try realtimeViewSnapshot(version: 2, phase: "arrived_pending_start", title: "本地模拟:无人机已到达") + socket.emit(try RealtimeTestData.push(XCTUnwrap(JSONSerialization.jsonObject(with: Data(ready.dataJSON.utf8)) as? [String: Any]))) + try await settle(window) { controller.viewModel.response?.stateVersion == 2 && clock.pendingCount == 0 } + XCTAssertEqual(controller.viewModel.presentation.phase, .ready) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机已到达")) + service.suspendNext = true + service.response = try realtimeViewSnapshot(version: 3, phase: "shooting", title: "本地模拟:正在拍摄") + socket.fail() + try await settle(window) { service.requests.count == 2 && controller.viewModel.isLoading } + XCTAssertEqual(controller.viewModel.response?.stateVersion, 2, "兜底读取时保留旧画面") + service.finish() + try await settle(window) { controller.viewModel.response?.stateVersion == 3 && clock.pendingCount == 1 && harness.clock.has(1) } + XCTAssertEqual(controller.viewModel.presentation.phase, .shooting) + harness.clock.fire(seconds: 1) + try await settle(window) { harness.sockets.count == 2 } + harness.sockets[1].emit(try RealtimeTestData.ack()) + harness.sockets[1].emit(try RealtimeTestData.push(RealtimeTestData.mediaStagePayload(wayline: 30, version: 4, orderNumber: "TEST-TASK-501"))) + try await settle(window) { controller.viewModel.response?.stateVersion == 4 && clock.pendingCount == 0 } + XCTAssertEqual(controller.viewModel.presentation.phase, .postShootUploading) + try await settle(window) { self.visibleTexts(in: controller.view).contains("查看素材") } + XCTAssertTrue(visibleTexts(in: controller.view).contains("拍摄已完成")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("查看素材")) + XCTAssertEqual(fixedFrames(in: controller.view), fixedBefore) + capture(window, name: "WebSocket 本地模拟:拍摄完成提示(未连接无人机)") + harness.sockets[1].emit(try RealtimeTestData.push(RealtimeTestData.mediaStagePayload(wayline: 50, version: 5, orderNumber: "TEST-TASK-501"))) + try await settle(window) { controller.viewModel.response?.stateVersion == 5 && clock.pendingCount == 0 } + XCTAssertEqual(controller.viewModel.presentation.phase, .completed) + try await settle(window) { self.visibleTexts(in: controller.view).contains("查看素材") } + XCTAssertTrue(visibleTexts(in: controller.view).contains("查看素材")) + XCTAssertEqual(service.requests, [501, 501]) + XCTAssertEqual(fixedFrames(in: controller.view), fixedBefore) + capture(window, name: "WebSocket 本地模拟:HTTP 兜底后恢复推送(未连接无人机)") + } + + /// 无缓存元数据后的新 HTTP 即使版本重复,也能完成握手并停止普通轮询。 + func testNoCacheMetadataUsesFreshHTTPSeedAndStopsPolling() async throws { + let harness = RealtimeHarness() + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "going_to_spot", title: "本地模拟任务")) + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }, realtime: harness.session) + let window = makeWindow(root: controller) + defer { harness.session.stop(); service.cancelAll(); close(window) } + try await settle(window) { harness.sockets.first?.sent.count == 1 && clock.pendingCount == 1 } + let socket = harness.sockets[0] + socket.emit(try RealtimeTestData.ack()) + try await settle(window) { socket.receiveCount >= 3 } + XCTAssertEqual(service.requests.count, 1, "正式 ack 不使用旧 HTTP 证明首包") + XCTAssertNotEqual(harness.session.state, .live) + service.suspendNext = true + socket.emit(try RealtimeTestData.metadata(hasSnapshot: false)) + try await settle(window) { service.requests.count == 2 && controller.viewModel.isLoading } + XCTAssertNotNil(harness.session.pendingHTTPSeedRequest) + XCTAssertNotEqual(harness.session.state, .live) + service.finish() + try await settle(window) { harness.session.state == .live && clock.pendingCount == 0 && !harness.clock.has(12) } + XCTAssertEqual(service.requests, [501, 501]) + XCTAssertEqual(controller.viewModel.response?.stateVersion, 1) + harness.clock.fire(seconds: 12) + await Task.yield() + XCTAssertEqual(harness.tickets.count, 1) + } + + /// 元数据先到、旧查询后结束时,旧查询只更新页面,必须结束后再串行补取首包。 + func testNoCacheMetadataWaitsForOldHTTPThenStartsNewSeed() async throws { + let harness = RealtimeHarness() + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "going_to_spot", title: "本地模拟任务")) + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }, realtime: harness.session) + let window = makeWindow(root: controller) + defer { harness.session.stop(); service.cancelAll(); close(window) } + try await settle(window) { harness.sockets.first?.sent.count == 1 } + let socket = harness.sockets[0] + service.suspendNext = true + try tapNavigationRefresh(controller) + try await settle(window) { service.requests.count == 2 && controller.viewModel.isLoading } + socket.emit(try RealtimeTestData.ack()) + socket.emit(try RealtimeTestData.metadata(hasSnapshot: false)) + try await settle(window) { harness.session.pendingHTTPSeedRequest != nil } + XCTAssertEqual(service.requests.count, 2, "首包补读不能与原查询并发") + service.suspendNext = true + service.finish() + try await settle(window) { service.requests.count == 3 && controller.viewModel.isLoading } + XCTAssertNotEqual(harness.session.state, .live, "旧 HTTP 不能事后追认为首包") + service.finish() + try await settle(window) { harness.session.state == .live && clock.pendingCount == 0 } + XCTAssertEqual(service.requests.count, 3) + } + + /// 连接 A 的首包在途期间重连 B,A 的结果不能完成 B,也不能挡住 B 的串行补读。 + func testReconnectReplacesPendingHTTPSeedWithoutWaitingForPollDelay() async throws { + let harness = RealtimeHarness() + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "going_to_spot", title: "本地模拟任务")) + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }, realtime: harness.session) + let window = makeWindow(root: controller) + defer { harness.session.stop(); service.cancelAll(); close(window) } + try await settle(window) { harness.sockets.first?.sent.count == 1 } + service.suspendNext = true + harness.sockets[0].emit(try RealtimeTestData.ack()) + harness.sockets[0].emit(try RealtimeTestData.metadata(hasSnapshot: false)) + try await settle(window) { service.requests.count == 2 && controller.viewModel.isLoading } + let firstToken = try XCTUnwrap(harness.session.pendingHTTPSeedRequest) + harness.sockets[0].fail() + try await settle(window) { harness.clock.has(1) } + harness.clock.fire(seconds: 1) + try await settle(window) { harness.sockets.count == 2 && harness.sockets[1].sent.count == 1 } + harness.sockets[1].emit(try RealtimeTestData.ack()) + harness.sockets[1].emit(try RealtimeTestData.metadata(hasSnapshot: false)) + try await settle(window) { harness.session.pendingHTTPSeedRequest != nil } + XCTAssertNotEqual(harness.session.pendingHTTPSeedRequest, firstToken) + service.suspendNext = true + service.finish() + try await settle(window) { service.requests.count == 3 && controller.viewModel.isLoading } + XCTAssertNotEqual(harness.session.state, .live) + service.finish() + try await settle(window) { harness.session.state == .live && clock.pendingCount == 0 } + XCTAssertEqual(harness.tickets.count, 2) + } + + /// 后台/离页取消订阅,回前台重读且重新订阅;无权限停止两条读取通道。 + func testRealtimeLifecycleAndPermissionDenialStopBothReaders() async throws { + let harness = RealtimeHarness() + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService(response: realtimeViewSnapshot(version: 1, phase: "going_to_spot", title: "本地模拟任务")) + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }, realtime: harness.session) + let window = makeWindow(root: controller) + defer { harness.session.stop(); close(window) } + try await settle(window) { harness.sockets.first?.sent.count == 1 } + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await settle(window) { harness.session.state == .stopped && clock.pendingCount == 0 } + XCTAssertEqual(harness.sockets[0].unsubscribed, [501]) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { harness.sockets.count == 2 && service.requests.count == 2 } + harness.sockets[1].emit(try RealtimeTestData.rejection(100099, "无权订阅该飞行任务")) + try await settle(window) { controller.viewModel.readAccessError != nil && clock.pendingCount == 0 } + XCTAssertFalse(controller.viewModel.canContinuePolling) + XCTAssertFalse(controller.viewModel.presentation.isActionEnabled) + XCTAssertNotNil(controller.viewModel.response) + try tapNavigationRefresh(controller) + await Task.yield() + XCTAssertEqual(service.requests.count, 2) + } + + /// 设备读数过期时保留数值和固定布局,同时显示缓存过期提示。 + func testRealtimeStaleMetricsKeepVisibleValues() async throws { + var payload = TaskViewData.payload() + payload["metrics_stale"] = true + let service = try TaskViewReadService(response: DroneDockShootingTaskTestData.decode(payload)) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + XCTAssertTrue(visibleTexts(in: controller.view).contains("93%")) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("读数已过期") }) + XCTAssertTrue(controller.viewModel.isTelemetryStale) + } + + private func fixedFrames(in root: UIView) -> [CGRect] { + ["drone.task.remote.top", "drone.task.remote.telemetry", "drone.task.remote.safety"].compactMap { + guard let view = find(in: root, id: $0) else { return nil } + return view.convert(view.bounds, to: root) + } + } + + private func realtimeViewSnapshot(version: Int, phase: String, title: String) throws -> DroneDockShootingResponse { + var payload = TaskViewData.payload() + payload["order_flight_task_id"] = 501 + payload["execution_batch"] = 100 + payload["state_version"] = version + payload["snapshot_kind"] = "full" + payload["execute_gate"] = ["can_execute": phase == "arrived_pending_start", "primary_action": "start_shoot"] + payload["ui"] = ["phase": phase, "title": title, "message": "未连接真实无人机,全部为隔离模拟数据"] + return try DroneDockShootingTaskTestData.decode(payload) + } + + /// 构造和加载视图不请求,完整出现后才使用传入的同一任务 ID 读取。 + func testFirstRequestWaitsUntilPageAppears() async throws { + let service = try TaskViewReadService() + let clock = DroneDockPollTestClock() + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }) + XCTAssertTrue(service.requests.isEmpty) + controller.loadViewIfNeeded() + XCTAssertTrue(service.requests.isEmpty) + XCTAssertNil(controller.viewModel.response) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + XCTAssertEqual(service.requests, [501]) + XCTAssertEqual(controller.viewModel.taskID, 501) + XCTAssertEqual(controller.title, "拍摄任务") + XCTAssertEqual(controller.navigationItem.rightBarButtonItem?.accessibilityIdentifier, "drone.task.remote.navigationRefresh") + XCTAssertFalse(controller.navigationItem.hidesBackButton) + XCTAssertEqual(clock.intervals, [5_000_000_000]) + clock.advance() + try await settle(window) { service.requests.count == 2 && clock.pendingCount == 1 } + XCTAssertEqual(service.requests, [501, 501]) + XCTAssertEqual(clock.intervals, [5_000_000_000, 5_000_000_000]) + } + + /// 轮询期间不并发,旧快照可见;普通失败下一周期恢复,不清空页面。 + func testPollRetainsSnapshotSerializesRequestsAndRecoversFailure() async throws { + let clock = DroneDockPollTestClock() + let service = try TaskViewReadService() + let controller = try makeController(service: service, pollDelay: { try await clock.wait($0) }) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { clock.pendingCount == 1 } + let previous = controller.viewModel.dataJSON + service.suspendNext = true + clock.advance() + try await settle(window) { service.requests.count == 2 && controller.viewModel.isLoading } + XCTAssertEqual(controller.viewModel.dataJSON, previous) + XCTAssertEqual(clock.pendingCount, 0, "请求结束后才启动下一次计时") + try tapNavigationRefresh(controller) + XCTAssertEqual(service.requests.count, 2) + service.finish() + try await settle(window) { clock.pendingCount == 1 } + service.nextError = APIError.networkFailed("模拟断网") + clock.advance() + try await settle(window) { controller.viewModel.errorMessage != nil && clock.pendingCount == 1 } + XCTAssertEqual(controller.viewModel.dataJSON, previous) + clock.advance() + try await settle(window) { service.requests.count == 4 && controller.viewModel.errorMessage == nil } + } + + /// 离页、后台取消计时;前台恢复立即读取,账号/景区变化后不再轮询旧任务。 + func testPollStopsOffscreenInBackgroundAndOnIdentityChange() async throws { + let clock = DroneDockPollTestClock() + let scope = TaskViewScope() + let service = try TaskViewReadService() + let controller = try makeController(service: service, scope: scope, pollDelay: { try await clock.wait($0) }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { clock.pendingCount == 1 } + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await settle(window) { clock.pendingCount == 0 } + clock.advance() + XCTAssertEqual(service.requests.count, 1) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { service.requests.count == 2 && clock.pendingCount == 1 } + let navigation = try XCTUnwrap(controller.navigationController) + navigation.pushViewController(UIViewController(), animated: false) + try await settle(window) { clock.pendingCount == 0 } + clock.advance() + XCTAssertEqual(service.requests.count, 2) + navigation.popViewController(animated: false) + try await settle(window) { service.requests.count == 3 && clock.pendingCount == 1 } + scope.scenicID = 999 + clock.advance() + try await settle(window) { controller.viewModel.errorMessage != nil && clock.pendingCount == 0 } + XCTAssertEqual(service.requests.count, 3) + XCTAssertNil(controller.viewModel.response) + XCTAssertFalse(controller.viewModel.canContinuePolling) + } + + /// 展示后端订单摘要和六项读数,任务阶段使用本地标题及明确门禁原因。 + func testServerSummaryMetricsAndStatusUseRealTaskLayout() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + let texts = visibleTexts(in: controller.view) + XCTAssertTrue(texts.contains("测试点位 · 测试航线")) + XCTAssertTrue(texts.contains { $0.contains("单次航拍 · 含1次拍摄") }) + XCTAssertFalse(texts.contains { $0.contains("入口五次套餐") }) + XCTAssertTrue(texts.contains("当前任务暂不可执行")) + XCTAssertTrue(texts.contains("测试门禁原因")) + XCTAssertFalse(texts.contains("航线任务未关联")) + XCTAssertFalse(texts.contains("测试任务需要等待服务端准备完成")) + XCTAssertTrue(controller.viewModel.dataJSON?.contains("航线任务未关联") == true) + XCTAssertTrue(controller.viewModel.dataJSON?.contains("测试任务需要等待服务端准备完成") == true) + XCTAssertTrue(texts.contains("空闲 · 电量93%")) + XCTAssertTrue(texts.contains("图传暂不可用")) + let values = ["battery": "93%", "temperature": "—", "wind": "0m/s", + "rain": "—", "signal": "—", "satellite": "32颗"] + for (key, value) in values { + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.\(key)")?.accessibilityValue, value) + } + XCTAssertNil(find(in: controller.view, id: "drone.task.primary")) + XCTAssertNil(find(in: controller.view, id: "drone.task.pause")) + XCTAssertNil(find(in: controller.view, id: "drone.task.return")) + for key in ["pause", "return"] { + let control = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.\(key)") as? UIControl) + XCTAssertFalse(control.isEnabled) + XCTAssertFalse(hidden(control)) + } + XCTAssertFalse(texts.contains { $0.contains("本地界面演示") }) + let feed = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.feedPlaceholder")) + XCTAssertEqual(feed.bounds.height, feed.bounds.width * 9 / 16, accuracy: 0.5) + assertUnambiguousLayout(in: controller.view) + capture(window, name: "真实拍摄任务-服务端状态与六项读数") + } + + /// 航线失败使用产品失败组合,离线设备不能重召;刷新和查看原因都不发送飞控。 + func testWaylineFailureShowsReasonAndOfflineNoteWithoutEnablingRetry() async throws { + let reason = "航线任务状态不可拍摄(当前:执行失败)" + var payload = TaskViewData.payload() + payload["task"] = ["id": 501, "status": 20, "wayline_status": 91, "wayline_status_label": "执行失败"] + payload["order_flight_task"] = ["id": 501, "order_number": "TEST-TASK-501", "scenic_id": 128, "status": 20] + payload["current_plane"] = ["id": 1, "online_status": 2, "work_status": 0, + "work_status_label": "离线", "status_text": "离线 · 电量94%"] + payload["execute_gate"] = ["can_execute": false, "code": "wayline_not_shooting", "message": reason] + payload["ui"] = ["phase": "blocked", "title": reason, "message": reason] + let response = try JSONDecoder().decode(DroneDockShootingResponse.self, + from: JSONSerialization.data(withJSONObject: payload)) + let service = try TaskViewReadService(response: response) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { controller.viewModel.response != nil } + let texts = visibleTexts(in: controller.view) + XCTAssertTrue(texts.contains("任务执行失败")) + XCTAssertTrue(texts.contains("失败原因:\(reason)")) + XCTAssertTrue(texts.contains("请排查错误后再次召唤无人机。")) + XCTAssertTrue(texts.contains("无人机离线,暂不可召唤")) + XCTAssertFalse(texts.contains("无人机返航中,暂不可召唤")) + XCTAssertFalse(texts.contains("详情")) + XCTAssertFalse(texts.contains("刷新状态")) + let retry = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.failureRetry") as? UIButton) + XCTAssertEqual(retry.configuration?.title, "重新召唤无人机") + XCTAssertFalse(hidden(retry)) + XCTAssertFalse(retry.isEnabled) + retry.sendActions(for: .touchUpInside) + XCTAssertEqual(service.requests, [501]) + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + assertUnambiguousLayout(in: controller.view) + capture(window, name: "真实任务失败-原因条与离线重召禁用") + + service.suspendNext = true + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.isLoading && service.requests.count == 2 } + XCTAssertEqual(visibleTexts(in: controller.view), texts, "失败态刷新也保留完整旧内容") + XCTAssertFalse(retry.isEnabled) + service.finish() + try await settle(window) { !controller.viewModel.isLoading && controller.navigationItem.rightBarButtonItem?.isEnabled == true } + let details = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.failureDetails") as? UIButton) + details.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController is UIAlertController } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertTrue(alert.message?.contains(reason) == true) + XCTAssertTrue(alert.message?.contains("任务执行失败") == true) + XCTAssertEqual(service.requests, [501, 501]) + controller.dismiss(animated: false) + } + + /// 业务错误留在本页,重新加载只 GET 同一任务,不产生任何写请求。 + func testFailureAndRetryOnlyReadSameTask() async throws { + let session = MockURLSession(responses: [ + try TestJSON.errorEnvelope(code: 100099, msg: "测试任务暂不可读取"), + try TaskViewData.envelope() + ]) + let service = DroneDockShootingAPI(client: APIClient(environment: .testing, session: session)) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.errorMessage != nil } + XCTAssertTrue(visibleTexts(in: controller.view).contains("任务状态读取失败")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("测试任务暂不可读取")) + XCTAssertEqual(try button(in: controller.view).title(for: .normal), "重新读取") + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.battery")?.accessibilityValue, "—") + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(session.requests.count, 1, "失败后等待下一周期或明确点击,不立即密集重试") + try button(in: controller.view).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.response != nil && session.requests.count == 2 } + XCTAssertEqual(controller.navigationController?.viewControllers.count, 1) + for request in session.requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/airport/shooting") + XCTAssertNil(request.httpBody) + let query = URLComponents(url: try XCTUnwrap(request.url), resolvingAgainstBaseURL: false)?.queryItems + XCTAssertEqual(query, [URLQueryItem(name: "id", value: "501"), URLQueryItem(name: "live_battery", value: "0")]) + } + } + + /// 恢复前台及重新进入各读取一次,重复前台通知和不可见期间均不追加 GET。 + func testForegroundAndReentryEachReadSameTaskOnce() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { service.requests.count == 1 && controller.viewModel.response != nil } + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(service.requests, [501]) + + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(service.requests, [501]) + XCTAssertNotNil(controller.viewModel.response) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { service.requests.count == 2 && controller.viewModel.response != nil } + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(service.requests, [501, 501]) + + let navigation = try XCTUnwrap(controller.navigationController) + navigation.pushViewController(UIViewController(), animated: false) + try await settle(window) { navigation.topViewController !== controller } + XCTAssertNotNil(controller.viewModel.response) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(service.requests, [501, 501]) + navigation.popViewController(animated: false) + try await settle(window) { service.requests.count == 3 && controller.viewModel.response != nil } + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(service.requests, [501, 501, 501]) + } + + /// 中间按钮与导航栏刷新各追加一次 GET,固定页面不再包含滚动容器。 + func testButtonAndNavigationRefreshEachReadOnce() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { service.requests.count == 1 && controller.viewModel.response != nil } + try button(in: controller.view).sendActions(for: .touchUpInside) + try await settle(window) { service.requests.count == 2 && controller.viewModel.response != nil } + + XCTAssertFalse(views(in: controller.view).contains { $0 is UIScrollView }) + try tapNavigationRefresh(controller) + try await settle(window) { service.requests.count == 3 && controller.viewModel.response != nil } + try await Task.sleep(nanoseconds: 140_000_000) + XCTAssertEqual(service.requests, [501, 501, 501]) + } + + /// 新请求期间完整保留旧状态和读数,成功后一次替换,连续点击不形成并发请求。 + func testPendingRefreshKeepsSnapshotUntilResponseAndRejectsDoubleTap() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { controller.viewModel.response != nil } + let oldTexts = visibleTexts(in: controller.view) + var payload = TaskViewData.payload() + payload["header"] = ["title": "更新后的点位与航线", "package_name": "更新后的套餐"] + payload["ui"] = ["phase": "shooting", "title": "正在拍摄", "message": "新的拍摄阶段"] + payload["current_plane"] = ["id": 1, "status_text": "拍摄中 · 电量81%"] + payload["metrics"] = [["key": "battery", "value": "81%"], ["key": "satellite", "value": "30颗"]] + service.response = try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + service.suspendNext = true + let refreshButton = try button(in: controller.view) + refreshButton.sendActions(for: .touchUpInside) + XCTAssertEqual(visibleTexts(in: controller.view), oldTexts, "发送请求前的同步刷新也不切换为空态") + try await settle(window) { controller.viewModel.isLoading && service.requests.count == 2 } + XCTAssertEqual(visibleTexts(in: controller.view), oldTexts) + XCTAssertFalse(visibleTexts(in: controller.view).contains("正在获取任务状态")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("空闲 · 电量93%")) + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.battery")?.accessibilityValue, "93%") + XCTAssertTrue(refreshButton.isEnabled) + XCTAssertEqual(controller.navigationItem.rightBarButtonItem?.isEnabled, true) + refreshButton.sendActions(for: .touchUpInside) + try tapNavigationRefresh(controller) + XCTAssertEqual(service.requests.count, 2) + service.finish() + try await settle(window) { controller.viewModel.response != nil && !controller.viewModel.isLoading } + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.battery")?.accessibilityValue, "81%") + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.satellite")?.accessibilityValue, "30颗") + XCTAssertTrue(visibleTexts(in: controller.view).contains("更新后的点位与航线")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机正在拍摄中")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("空闲 · 电量93%")) + XCTAssertTrue(hidden(refreshButton)) + let indicator = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.shootingIndicator") as? UIButton) + XCTAssertFalse(indicator.isEnabled) + } + + /// 后台取消后迟到回执不重新展示当前设备或遥测。 + func testLateResponseAfterBackgroundDoesNotRepopulatePage() async throws { + let service = try TaskViewReadService() + service.suspendNext = true + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { service.requests.count == 1 && controller.viewModel.isLoading } + XCTAssertTrue(visibleTexts(in: controller.view).contains("正在获取任务状态")) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + service.finish() + try await Task.sleep(nanoseconds: 120_000_000) + window.layoutIfNeeded() + XCTAssertNil(controller.viewModel.response) + XCTAssertFalse(visibleTexts(in: controller.view).contains("空闲 · 电量93%")) + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.satellite")?.accessibilityValue, "—") + XCTAssertEqual(service.requests, [501]) + } + + /// 恢复前台发起的读取同样保留上次数据,等待新响应期间不出现空态。 + func testForegroundRefreshKeepsPreviousSnapshotUntilNewResponse() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { controller.viewModel.response != nil } + let oldTexts = visibleTexts(in: controller.view) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + XCTAssertNotNil(controller.viewModel.response) + service.suspendNext = true + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await settle(window) { controller.viewModel.isLoading && service.requests.count == 2 } + XCTAssertEqual(visibleTexts(in: controller.view), oldTexts) + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.battery")?.accessibilityValue, "93%") + service.finish() + try await settle(window) { !controller.viewModel.isLoading } + XCTAssertEqual(service.requests, [501, 501]) + } + + /// 二次刷新失败只提示错误,旧状态和读数继续显示,用户可以明确重试。 + func testRefreshFailurePreservesDataAndOffersRetry() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + service.nextError = APIError.networkFailed("测试刷新断网") + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.errorMessage != nil && !controller.viewModel.isLoading } + XCTAssertNotNil(controller.viewModel.response) + XCTAssertTrue(visibleTexts(in: controller.view).contains("当前任务暂不可执行")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("测试门禁原因")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("空闲 · 电量93%")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("任务状态读取失败")) + XCTAssertTrue(visibleTexts(in: controller.view).contains { $0.contains("刷新失败,当前显示上次数据") }) + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.battery")?.accessibilityValue, "93%") + XCTAssertNil(find(in: controller.view, id: "drone.task.remote.details")) + XCTAssertNotNil(controller.viewModel.errorMessage) + try button(in: controller.view).sendActions(for: .touchUpInside) + try await settle(window) { service.requests.count == 3 && controller.viewModel.errorMessage == nil } + XCTAssertNotNil(controller.viewModel.response) + } + + /// 身份变化后重新读取撤下旧响应,不显示原账号的执行门禁或设备读数。 + func testContextChangeRemovesPreviousTaskState() async throws { + let service = try TaskViewReadService() + let scope = TaskViewScope() + let controller = try makeController(service: service, scope: scope) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + scope.scenicID = 129 + try button(in: controller.view).sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.errorMessage != nil && controller.viewModel.response == nil } + XCTAssertTrue(visibleTexts(in: controller.view).contains("账号或景区已变化,请返回工作台重新进入")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("空闲 · 电量93%")) + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.battery")?.accessibilityValue, "—") + XCTAssertEqual(service.requests, [501]) + } + + /// 缺失所有动态字段时六项均为未知,不显示已到达、已拍摄或假设备连接。 + func testMissingFieldsStayUnknownWithoutDemoValues() async throws { + let service = try TaskViewReadService(response: JSONDecoder().decode(DroneDockShootingResponse.self, from: Data("{}".utf8))) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + for key in ["battery", "temperature", "wind", "rain", "signal", "satellite"] { + XCTAssertEqual(find(in: controller.view, id: "drone.task.remote.metric.\(key)")?.accessibilityValue, "—") + } + XCTAssertTrue(visibleTexts(in: controller.view).contains("状态待确认")) + XCTAssertNil(find(in: controller.view, id: "drone.task.primary")) + assertUnambiguousLayout(in: controller.view) + } + + /// 从旧状态到加载再到长文案异常,固定顶部与底部始终保留相同位置。 + func testRefreshingAndLongStatusDoNotMoveFixedRegions() async throws { + let service = try TaskViewReadService() + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { service.cancelAll(); close(window) } + try await settle(window) { controller.viewModel.response != nil } + let ids = ["top", "summary", "feedPlaceholder", "telemetry", "stateContainer", "safety"] + let regions = try ids.map { try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.\($0)")) } + let frames = regions.map { $0.convert($0.bounds, to: controller.view) } + var payload = TaskViewData.payload() + payload["ui"] = ["phase": "failed", "title": "任务执行失败", "message": String(repeating: "测试长状态说明,请查看完整详情。", count: 20)] + service.response = try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + service.suspendNext = true + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.isLoading } + XCTAssertEqual(regions.map { $0.convert($0.bounds, to: controller.view) }, frames) + service.finish() + try await settle(window) { controller.viewModel.presentation.phase == .failed } + XCTAssertEqual(regions.map { $0.convert($0.bounds, to: controller.view) }, frames) + XCTAssertFalse(views(in: controller.view).contains { $0 is UIScrollView }) + XCTAssertEqual(service.requests, [501, 501]) + } + + /// 待确认任务保留后端完整说明,移除详情按钮也不会开放开拍或安全控制。 + func testFullServerMessageIsPreservedWithoutDetailsButton() async throws { + let message = String(repeating: "测试任务等待后端确认,完整说明应保留。", count: 20) + var payload = TaskViewData.payload() + payload["order_flight_task"] = ["id": 501, "order_number": "TEST-TASK-501", "scenic_id": 128, "status": 60] + payload["execute_gate"] = ["can_execute": false, "message": ""] + payload["ui"] = ["phase": "blocked", "title": "任务暂不可执行", "message": message] + let response = try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + let service = try TaskViewReadService(response: response) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.response != nil } + XCTAssertNil(find(in: controller.view, id: "drone.task.remote.details")) + XCTAssertNil(controller.presentedViewController) + let label = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.statusMessage") as? UILabel) + XCTAssertEqual(label.text, message) + XCTAssertEqual(controller.viewModel.presentation.phase, .blocked) + XCTAssertTrue(visibleTexts(in: controller.view).contains("任务待确认")) + XCTAssertFalse(controller.viewModel.canStartShooting) + for command in [DroneDockSafetyCommand.pause, .resume, .returnHome] { + XCTAssertFalse(controller.viewModel.canSendCommand(command)) + } + XCTAssertTrue(controller.viewModel.dataJSON?.contains(message) == true) + XCTAssertEqual(service.requests, [501]) + } + + /// 明确完成后素材入口沿用当前订单和景区,只跳转一次,不再次创建或召唤。 + func testCompletedActionOpensMaterialsForCurrentOrder() async throws { + var payload = TaskViewData.payload() + payload["order_flight_task"] = ["id": 501, "status": 30, "order_number": "TEST-TASK-501", "scenic_id": 128] + payload["ui"] = ["phase": "completed", "title": "拍摄完成", "message": "测试任务已完成"] + let response = try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + let service = try TaskViewReadService(response: response) + let destination = UIViewController() + var factoryCalls = 0 + let controller = try makeController(service: service, materialsFactory: { order, context in + factoryCalls += 1 + XCTAssertEqual(order.orderNumber, "TEST-TASK-501") + XCTAssertEqual(context.scenicID, 128) + return destination + }) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .completed } + let primary = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary") as? UIButton) + XCTAssertTrue(primary.isEnabled) + XCTAssertEqual(primary.configuration?.title, "查看素材") + XCTAssertTrue(visibleTexts(in: primary).contains("查看素材")) + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + try await settle(window) { controller.navigationController?.topViewController === destination } + XCTAssertEqual(factoryCalls, 1) + XCTAssertEqual(service.requests, [501]) + } + + private func makeController(service: any DroneDockShootingServing, scope: TaskViewScope? = nil, + initialSummonReceipt: DroneDockShootResponse? = nil, + pollDelay: @escaping @Sendable (UInt64) async throws -> Void = { try await Task.sleep(nanoseconds: $0) }, + realtime: DroneDockShootingRealtimeSession? = nil, + materialsFactory: (@MainActor (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) throws -> DroneDockShootingTaskViewController { + let scope = scope ?? TaskViewScope() + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, from: Data(#"{"order_number":"TEST-TASK-501","project_id":101,"project_name":"入口五次套餐","user_phone":"130****0501"}"#.utf8)) + let model = DroneDockShootingTaskViewModel(context: scope.value, taskID: 501, order: order, + service: service, initialSummonReceipt: initialSummonReceipt, currentContext: { scope.value }) + return DroneDockShootingTaskViewController(viewModel: model, realtimeSession: realtime, materialsControllerFactory: materialsFactory, + shootingPollDelay: pollDelay) + } + + private func makeWindow(root: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: root) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<160 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 80_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 15_000_000) + } + XCTFail("真实任务页未在预期时间内稳定显示") + throw NSError(domain: "DroneDockShootingTaskViewTests", code: 1) + } + + private func views(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { views(in: $0) } } + private func hidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(hidden) ?? false) } + private func find(in root: UIView, id: String) -> UIView? { views(in: root).first { $0.accessibilityIdentifier == id } } + private func visibleTexts(in root: UIView) -> [String] { + views(in: root).compactMap { view in + guard let label = view as? UILabel, !hidden(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + private func button(in root: UIView) throws -> UIButton { + try XCTUnwrap(find(in: root, id: "drone.task.remote.refresh") as? UIButton) + } + private func tapNavigationRefresh(_ controller: UIViewController) throws { + let item = try XCTUnwrap(controller.navigationItem.rightBarButtonItem) + let action = try XCTUnwrap(item.action) + _ = UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + private func assertUnambiguousLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = views(in: root).filter { !hidden($0) && !$0.bounds.isEmpty && $0.hasAmbiguousLayout } + XCTAssertTrue(ambiguous.isEmpty, "可见布局存在歧义:\(ambiguous.map { String(describing: type(of: $0)) })", file: file, line: line) + } + private func capture(_ window: UIWindow, name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 手动推进轮询时间,并真正响应取消,避免测试依赖真实的五秒计时。 +@MainActor +final class DroneDockPollTestClock { + private var pending: [(UUID, CheckedContinuation)] = [] + private(set) var intervals: [UInt64] = [] + var pendingCount: Int { pending.count } + + func wait(_ interval: UInt64) async throws { + let id = UUID() + try Task.checkCancellation() + try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { continuation in + intervals.append(interval) + pending.append((id, continuation)) + } + } onCancel: { + Task { @MainActor in + guard let index = self.pending.firstIndex(where: { $0.0 == id }) else { return } + self.pending.remove(at: index).1.resume(throwing: CancellationError()) + } + } + } + + func advance() { + guard !pending.isEmpty else { return } + pending.removeFirst().1.resume() + } +} + +/// 独立任务页 JSON 数据,所有设备、订单和摘要均为匿名测试值。 +private enum TaskViewData { + static func payload() -> [String: Any] { + ["order_number": "TEST-TASK-501", "scenic": ["id": 128, "name": "测试景区"], + "order_flight_task": ["id": 501, "order_number": "TEST-TASK-501", "scenic_id": 128], + "header": ["title": "测试点位 · 测试航线", "tourist_label": "游客130****0501", "package_name": "单次航拍 · 含1次拍摄"], + "current_plane": ["id": 1, "status_text": "空闲 · 电量93%"], + "ui": ["phase": "blocked", "title": "航线任务未关联", "message": "测试任务需要等待服务端准备完成"], + "execute_gate": ["can_execute": false, "message": "测试门禁原因"], + "metrics": [["key": "battery", "value": "93%"], ["key": "env_temp", "value": "—"], + ["key": "wind_speed", "value": "0m/s"], ["key": "rainfall", "value": "—"], + ["key": "signal", "value": "—"], ["key": "satellite", "value": "32颗"]], + "plane_status": ["scenic_id": 128, "connected": true, "poll_hint_ms": 5000]] + } + + static func response() throws -> DroneDockShootingResponse { + try JSONDecoder().decode(DroneDockShootingResponse.self, from: JSONSerialization.data(withJSONObject: payload())) + } + + static func envelope() throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload()]) + } +} + +/// 可挂起下一次读取,验证 UI 不并发查询和不接收迟到数据。 +@MainActor +private final class TaskViewReadService: DroneDockShootingServing { + var response: DroneDockShootingResponse + var suspendNext = false + var nextError: Error? + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + + init(response: DroneDockShootingResponse? = nil) throws { self.response = try response ?? TaskViewData.response() } + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + XCTAssertFalse(liveBattery) + requests.append(taskID) + if let error = nextError { + nextError = nil + throw error + } + if suspendNext { + suspendNext = false + return try await withCheckedThrowingContinuation { continuation = $0 } + } + return response + } + + func finish() { + continuation?.resume(returning: response) + continuation = nil + } + + func cancelAll() { + continuation?.resume(throwing: CancellationError()) + continuation = nil + } +} + +/// 可切换景区的测试会话,不涉及真实登录状态。 +@MainActor +private final class TaskViewScope { + var scenicID = 128 + var value: DroneDockHomeContext { + DroneDockHomeContext(userID: "task-ui-user", accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: 37, photographerName: "测试人员", token: "task-ui-token") + } +} diff --git a/suixinkanTests/DroneDockSilentRefreshTests.swift b/suixinkanTests/DroneDockSilentRefreshTests.swift new file mode 100644 index 0000000..b7eef21 --- /dev/null +++ b/suixinkanTests/DroneDockSilentRefreshTests.swift @@ -0,0 +1,124 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用挂起的内存读取验证无感刷新,以及刷新与用户操作交错时的防重和时序。 +@MainActor +final class DroneDockSilentRefreshTests: XCTestCase { + /// 正常刷新不改变开始/安全按钮可用性;用户点击后才锁定,旧请求迟到不覆盖开拍后快照。 + func testButtonsRemainEnabledAndStartWinsOverPendingRead() async throws { + let service = try SilentRefreshService() + let context = DroneDockShootingTaskTestData.context() + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, startService: service, + commandService: service, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model, simulationRecordsProvider: { "本地模拟" }) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + defer { + service.finishRead() + window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() + } + try await wait { model.canStartShooting } + let primary = try XCTUnwrap(views(controller.view).first { $0.accessibilityIdentifier == "drone.task.remote.primary" } as? UIButton) + let pause = try XCTUnwrap(views(controller.view).first { $0.accessibilityIdentifier == "drone.task.remote.pause" } as? UIControl) + let refresh = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.remote.navigationRefresh" + }) + XCTAssertTrue(primary.isEnabled) + XCTAssertTrue(pause.isEnabled) + _ = UIApplication.shared.sendAction(try XCTUnwrap(refresh.action), to: refresh.target, from: refresh, for: nil) + try await wait { model.isLoading && service.reads == 2 } + XCTAssertTrue(primary.isEnabled) + XCTAssertTrue(pause.isEnabled) + XCTAssertTrue(refresh.isEnabled) + XCTAssertTrue(model.canStartShooting) + XCTAssertTrue(model.canSendCommand(.pause)) + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + XCTAssertFalse(primary.isEnabled) + try await wait { model.hasSubmittedStart && !model.isStartingShooting } + XCTAssertEqual(service.starts, 1) + XCTAssertEqual(service.reads, 3, "提交后必须重新回查,不能被先前的 isLoading 跳过") + XCTAssertEqual(model.presentation.phase, .shooting) + service.finishRead() + try await Task.sleep(for: .milliseconds(40)) + XCTAssertEqual(model.presentation.phase, .shooting, "迟到的 ready 响应不能倒退页面") + XCTAssertEqual(service.starts, 1) + } + + /// 无权限和真实状态变化仍立即撤销按钮许可,无感只适用于请求本身。 + func testNewGateAndPermissionDenialStillDisableActions() async throws { + let service = try SilentRefreshService() + let context = DroneDockShootingTaskTestData.context() + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, startService: service, + commandService: service, currentContext: { context }) + await model.refresh() + XCTAssertTrue(model.canStartShooting) + model.applyTaskSnapshot(try SilentRefreshService.snapshot(shooting: true)) + XCTAssertFalse(model.canStartShooting) + XCTAssertTrue(model.canSendCommand(.pause)) + model.stopReading(message: "无权订阅该飞行任务") + XCTAssertFalse(model.canSendCommand(.pause)) + await model.startShooting() + XCTAssertEqual(service.starts, 0) + } + + private func wait(_ condition: () -> Bool) async throws { + for _ in 0..<200 { + if condition() { return } + try await Task.sleep(for: .milliseconds(10)) + } + XCTFail("本地模拟状态未就绪") + } + + private func views(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap(views) } +} + +/// 第二次读取刻意忽略取消并迟到返回旧快照,第三次回查立即返回操作后状态。 +@MainActor +private final class SilentRefreshService: DroneDockShootingServing, DroneDockStartShooting, DroneDockCommandSending { + var reads = 0 + var starts = 0 + private var continuation: CheckedContinuation? + private let ready: DroneDockShootingResponse + init() throws { ready = try Self.snapshot(shooting: false) } + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + XCTAssertEqual(taskID, 501); XCTAssertFalse(liveBattery) + reads += 1 + if reads == 2 { return await withCheckedContinuation { continuation = $0 } } + return starts == 0 ? ready : try Self.snapshot(shooting: true) + } + + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + starts += 1 + return try JSONDecoder().decode(DroneDockStartShootResponse.self, from: Data(""" + {"order_flight_task_id":501,"plane_id":58,"order_flight_task":{"id":501,"order_number":"TEST-TASK-PAGE-001","scenic_id":128}} + """.utf8)) + } + + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + XCTFail("本测试不提交安全指令") + throw CancellationError() + } + + func finishRead() { continuation?.resume(returning: ready); continuation = nil } + + static func snapshot(shooting: Bool) throws -> DroneDockShootingResponse { + try DroneDockShootingTaskTestData.response(changes: [ + "execution_batch": 100, "state_version": shooting ? 2 : 1, + "flight_control": DroneDockShootingTaskTestData.flightControl( + resumePhase: shooting ? "shooting" : "arrived_pending_start", + pauseReason: shooting ? nil : "arrival_wait"), + "order_flight_task": ["id": 501, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128, "status": 20], + "task": ["id": 501, "status": 20], "current_plane": ["id": 58], + "execute_gate": ["can_execute": !shooting, "primary_action": shooting ? "shooting" : "start_shoot"], + "ui": ["phase": shooting ? "shooting" : "arrived_pending_start", "commands": [["command": "flighttask_pause"], ["command": "return_home"]]] + ]) + } +} diff --git a/suixinkanTests/DroneDockStartShootAPITests.swift b/suixinkanTests/DroneDockStartShootAPITests.swift new file mode 100644 index 0000000..a4f307a --- /dev/null +++ b/suixinkanTests/DroneDockStartShootAPITests.swift @@ -0,0 +1,180 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 通过纯内存 Mock 核验开拍合同,任何用例都不连接后端或真实无人机。 +@MainActor +final class DroneDockStartShootAPITests: XCTestCase { + /// 单次请求只携带原任务 ID,保留鉴权,不发送选机、重启或未经约定的模拟标志。 + func testStartSendsOneAuthenticatedPOSTWithOnlyOrderFlightTaskID() async throws { + let session = MockURLSession(responses: [try envelope(data: payload())]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "start-shoot-test-token" } + let response = try await DroneDockStartShootAPI(client: client).startShooting(taskID: 501) + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/app/airport/start-shoot") + XCTAssertNil(request.url?.query) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "start-shoot-test-token") + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["id"]) + XCTAssertEqual(body["id"] as? Int, 501) + XCTAssertEqual(response.orderFlightTaskID, 501) + XCTAssertEqual(response.orderFlightTask?.id, 501) + XCTAssertEqual(response.planeID, 58) + XCTAssertEqual(response.taskUUID, "TEST-START-UUID") + XCTAssertEqual(response.airportSN, "TEST-AIRPORT-058") + XCTAssertEqual(response.ui?.phase, "shooting") + XCTAssertEqual(response.ui?.title, "模拟:无人机正在拍摄中") + } + + /// 无效任务身份在调用传输前被拒绝,不尝试创建或召唤。 + func testInvalidTaskIDNeverReachesTransport() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)) + for taskID in [0, -1] { + do { + _ = try await api.startShooting(taskID: taskID) + XCTFail("无效任务 ID 不应提交开拍") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 调用前已取消时不产生开拍写请求。 + func testCancelledStartDoesNotReachTransport() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)) + let pending = Task { @MainActor in try await api.startShooting(taskID: 501) } + pending.cancel() + do { + _ = try await pending.value + XCTFail("已取消请求不应发出") + } catch is CancellationError {} + XCTAssertTrue(session.requests.isEmpty) + } + + /// 明确业务拒绝优先于 data 内容,保留后端原因而不转换成成功。 + func testBusinessFailurePreservesBackendCodeAndReason() async throws { + for data: Any in [NSNull(), [:] as [String: Any], [] as [Any], payload()] { + let session = MockURLSession(responses: [try envelope(data: data, code: 100099, message: "模拟:任务当前不可开始拍摄")]) + do { + _ = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTFail("业务拒绝不能算成功") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "模拟:任务当前不可开始拍摄") + } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 超时不自动重复写入;结果是否执行须由上层核对同一任务。 + func testTimeoutIsReturnedWithoutAutomaticRetry() async throws { + let session = MockURLSession(results: [.failure(URLError(.timedOut))]) + do { + _ = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTFail("超时不能伪造成功") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.requests.count, 1) + } + + /// HTTP 失败即使包含成功业务包裹也不视为开拍受理。 + func testHTTPFailureIsNotConvertedToSuccess() async throws { + let session = MockURLSession(responses: [try envelope(data: payload())], statusCode: 503) + do { + _ = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTFail("HTTP 失败不能算开拍成功") + } catch let APIError.httpStatus(code, _) { XCTAssertEqual(code, 503) } + XCTAssertEqual(session.requests.count, 1) + } + + /// 无 data、空对象或缺少顶层任务身份都不构造成功回执。 + func testMissingDataAndMissingIdentityAreRejected() async throws { + let envelopes = [ + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success"]), + try envelope(data: NSNull()), try envelope(data: [:]), try envelope(data: []), + try envelope(data: ["order_flight_task": ["id": 501], "ui": ["phase": "shooting"]]) + ] + for data in envelopes { + let session = MockURLSession(responses: [data]) + do { + _ = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTFail("缺少开拍回执身份不得返回成功") + } catch let error as APIError { + switch error { + case .emptyData, .decodeFailed: break + default: XCTFail("应保留数据缺失或解析错误:\(error)") + } + } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 顶层任务身份与嵌套任务身份分别核对,不把另一个任务的回执交给当前页面。 + func testMismatchedOrInvalidTaskIdentityIsRejectedWithoutRetry() async throws { + let changes: [[String: Any]] = [ + ["order_flight_task_id": 502], ["order_flight_task_id": 0], + ["order_flight_task_id": -1], ["order_flight_task_id": "501"], + ["order_flight_task_id": true], ["order_flight_task": ["id": 502]], + ["order_flight_task": ["id": 0]] + ] + for change in changes { + let session = MockURLSession(responses: [try envelope(data: payload().merging(change) { _, new in new })]) + do { + _ = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTFail("不同或无效任务身份应拒绝") + } catch let APIError.decodeFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.requests.count, 1) + } + } + + /// 后续回执新增字段不丢失,数字、字符串、空值和动作列表保持原 JSON 类型。 + func testFullDataPreservesUnknownFieldsAndOptionalNulls() async throws { + var data = payload() + data["future"] = ["flag": false, "count": 0, "text": "001", "items": [NSNull(), 12.5]] as [String: Any] + data["order_flight_task"] = NSNull() + data["plane_id"] = NSNull() + let session = MockURLSession(responses: [try envelope(data: data)]) + let response = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTAssertNil(response.orderFlightTask) + XCTAssertNil(response.planeID) + let displayed = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: Data(response.dataJSON.utf8)) + let original = try JSONDecoder().decode(DroneDockHomeJSONValue.self, from: JSONSerialization.data(withJSONObject: data)) + XCTAssertEqual(displayed, original) + } + + /// 开拍可进入普通传输;隔离探针主动抛错,绝不调用真实设备。 + func testStartReachesOrdinaryInMemoryTransport() async throws { + let session = StartShootTransportProbe() + do { + _ = try await DroneDockStartShootAPI(client: APIClient(environment: .testing, session: session)).startShooting(taskID: 501) + XCTFail("隔离传输主动失败") + } catch let APIError.networkFailed(message) { XCTAssertFalse(message.isEmpty) } + XCTAssertEqual(session.requestCount, 1) + } + + private func payload() -> [String: Any] { + ["order_flight_task_id": 501, + "order_flight_task": ["id": 501, "order_number": "TEST-START-501", "scenic_id": 128, "status": 20], + "plane_id": 58, "task_uuid": "TEST-START-UUID", "airport_sn": "TEST-AIRPORT-058", + "ui": ["phase": "shooting", "title": "模拟:无人机正在拍摄中", "message": "本地模拟,未发送设备指令", + "primary_action": "shooting", "commands": [["command": "flighttask_pause", "label": "紧急暂停"]]]] + } + + private func envelope(data: Any, code: Int = 100000, message: String = "success") throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": code, "msg": message, "data": data]) + } +} + +/// 仅记录调用并抛错的普通传输探针,不具备联网能力。 +private final class StartShootTransportProbe: URLSessionProtocol { + private(set) var requestCount = 0 + + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + requestCount += 1 + throw URLError(.unsupportedURL) + } +} diff --git a/suixinkanTests/DroneDockStartShootViewModelTests.swift b/suixinkanTests/DroneDockStartShootViewModelTests.swift new file mode 100644 index 0000000..e0b45c6 --- /dev/null +++ b/suixinkanTests/DroneDockStartShootViewModelTests.swift @@ -0,0 +1,348 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 开拍流程仅使用纯内存服务,验证同任务串接、门禁和不可重复提交的边界。 +@MainActor +final class DroneDockStartShootViewModelTests: XCTestCase { + /// 正式入口默认未注入写服务,即使后端允许开始也不能发送开拍。 + func testMissingStartServiceKeepsReadyActionDisabled() async throws { + let fixture = try StartTaskFixture(allowStart: false) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.model.presentation.action, .start) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + await fixture.model.startShooting() + XCTAssertTrue(fixture.start.requests.isEmpty) + } + + /// 到达、明确门禁、动作及锁定飞机四项缺一不可,订单状态 20 本身不等于可开始。 + func testStartRequiresAllExplicitReadyConditions() async throws { + let changes: [[String: Any]] = [ + ["execute_gate": ["can_execute": false, "primary_action": "start_shoot"]], + ["execute_gate": ["can_execute": true]], + ["execute_gate": ["can_execute": true, "primary_action": "blocked"]], + ["current_plane": ["status_text": "空闲"]], + ["current_plane": ["id": 0]], + ["ui": ["phase": "shooting"]], + ["ui": ["phase": "unknown"]], + ["ui": NSNull()], + ["flight_control": NSNull()], + ["flight_control": DroneDockShootingTaskTestData.flightControl(state: "unknown", droneInDock: nil, isAirborne: nil)], + ["flight_control": DroneDockShootingTaskTestData.flightControl(batch: 999)], + ["task": ["id": 501, "status": 20, "wayline_status": 91]] + ] + for change in changes { + let fixture = try StartTaskFixture() + fixture.read.result = .success(try StartTaskData.ready(changes: change)) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canStartShooting, "\(change)") + await fixture.model.startShooting() + XCTAssertTrue(fixture.start.requests.isEmpty) + } + } + + /// 点击只提交既有任务一次,明确受理后查询同一任务,以查询结果更新阶段。 + func testSuccessStartsOnceThenReadsSameTaskWithoutPolling() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + let oldResponse = fixture.model.response + let shooting = try StartTaskData.shooting() + fixture.start.onRequest = { fixture.read.result = .success(shooting) } + var observedAcceptedOldSnapshot = false + await fixture.model.startShooting { + if fixture.model.hasSubmittedStart && fixture.model.response == oldResponse { + observedAcceptedOldSnapshot = true + XCTAssertTrue(fixture.model.isStartingShooting) + XCTAssertFalse(fixture.model.presentation.isActionEnabled) + } + } + XCTAssertTrue(observedAcceptedOldSnapshot) + XCTAssertEqual(fixture.start.requests, [501]) + XCTAssertEqual(fixture.read.requests, [501, 501]) + XCTAssertTrue(fixture.model.hasSubmittedStart) + XCTAssertNotNil(fixture.model.startResponse?.dataJSON) + XCTAssertEqual(fixture.model.response, shooting) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.startOutcomeUnknown) + await fixture.model.startShooting() + fixture.model.invalidate(preservingSnapshot: true) + await fixture.model.refresh() + await fixture.model.startShooting() + XCTAssertEqual(fixture.start.requests, [501]) + XCTAssertEqual(fixture.read.requests, [501, 501, 501]) + } + + /// 已受理后的状态查询失败保留旧画面,刷新即便仍显示 ready 也不能再提交。 + func testAcceptedStartWithFailedFollowupReadRemainsLocked() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + let old = fixture.model.response + fixture.read.result = .failure(APIError.networkFailed("模拟查询超时")) + await fixture.model.startShooting() + XCTAssertTrue(fixture.model.hasSubmittedStart) + XCTAssertNotNil(fixture.model.startResponse) + XCTAssertFalse(fixture.model.startOutcomeUnknown) + XCTAssertEqual(fixture.model.response, old) + XCTAssertNotNil(fixture.model.errorMessage) + XCTAssertEqual(fixture.model.presentation.action, .refresh) + XCTAssertTrue(fixture.model.statusMessage.contains("已受理")) + fixture.read.result = .success(try StartTaskData.ready()) + await fixture.model.refresh() + await fixture.model.startShooting() + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.start.requests, [501]) + } + + /// 明确业务拒绝可以再次点击,重试仍用同一任务且不自动重发。 + func testExplicitRejectionAllowsOnlyManualRetry() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + fixture.start.result = .failure(APIError.serverCode(100099, "模拟设备暂不可开始")) + await fixture.model.startShooting() + XCTAssertEqual(fixture.start.requests, [501]) + XCTAssertEqual(fixture.read.requests, [501]) + XCTAssertFalse(fixture.model.hasSubmittedStart) + XCTAssertFalse(fixture.model.startOutcomeUnknown) + XCTAssertEqual(fixture.model.startErrorMessage, "模拟设备暂不可开始") + XCTAssertTrue(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.presentation.actionTitle, "重试开始拍摄") + fixture.start.result = .success(try StartTaskData.receipt()) + fixture.read.result = .success(try StartTaskData.shooting()) + await fixture.model.startShooting() + XCTAssertEqual(fixture.start.requests, [501, 501]) + XCTAssertNil(fixture.model.startErrorMessage) + XCTAssertTrue(fixture.model.hasSubmittedStart) + } + + /// 网络、HTTP 或解析结果不明确时锁定提交,刷新成功也不把旧门禁当作重试许可。 + func testAmbiguousFailureNeverRetriesAfterRefreshOrReentry() async throws { + for error in [APIError.networkFailed("模拟超时"), APIError.httpStatus(500, "模拟异常"), + APIError.decodeFailed("模拟回执不可解析")] { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.start.result = .failure(error) + await fixture.model.startShooting() + XCTAssertTrue(fixture.model.startOutcomeUnknown) + XCTAssertFalse(fixture.model.hasSubmittedStart) + XCTAssertNil(fixture.model.startResponse) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertTrue(fixture.model.startErrorMessage?.contains("勿重复提交") == true) + XCTAssertEqual(fixture.model.presentation.action, .refresh) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + fixture.model.invalidate(preservingSnapshot: true) + await fixture.model.refresh() + await fixture.model.startShooting() + XCTAssertEqual(fixture.start.requests, [501]) + } + } + + /// 后端明确业务拒绝保留原因,不得伪装为远端超时或成功。 + func testBusinessRejectionPreservesReasonWithoutUnknownLock() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + fixture.start.result = .failure(APIError.serverCode(100050, "服务暂不可用,请稍后重试")) + await fixture.model.startShooting() + XCTAssertEqual(fixture.model.startErrorMessage, "服务暂不可用,请稍后重试") + XCTAssertFalse(fixture.model.startOutcomeUnknown) + XCTAssertFalse(fixture.model.hasSubmittedStart) + XCTAssertNil(fixture.model.startResponse) + XCTAssertEqual(fixture.read.requests, [501]) + fixture.model.invalidate(preservingSnapshot: true) + XCTAssertFalse(fixture.model.startOutcomeUnknown) + } + + /// 挂起提交期间只保留一次 POST,刷新和二次点击不会并发覆盖准备快照。 + func testPendingStartRetainsSnapshotAndRejectsConcurrentActions() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.start.suspend = true + let submitted = expectation(description: "开拍请求进入内存服务") + fixture.start.onRequest = { submitted.fulfill() } + defer { fixture.start.finish() } + let pending = Task { await fixture.model.startShooting() } + await fulfillment(of: [submitted], timeout: 2) + XCTAssertTrue(fixture.model.isStartingShooting) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertEqual(fixture.model.response, previous) + await fixture.model.startShooting() + await fixture.model.refresh() + XCTAssertEqual(fixture.start.requests, [501]) + XCTAssertEqual(fixture.read.requests, [501]) + fixture.read.result = .success(try StartTaskData.shooting()) + fixture.start.finish() + await pending.value + XCTAssertEqual(fixture.read.requests, [501, 501]) + XCTAssertEqual(fixture.model.presentation.phase, .shooting) + } + + /// 取消或离页后的迟到成功回执不能更新页面,也不能触发后续查询或重新提交。 + func testCancellationOrLeavingAfterSubmissionLocksUnknown() async throws { + for leavePage in [false, true] { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + let previous = fixture.model.response + fixture.start.suspend = true + let submitted = expectation(description: "等待取消开拍") + fixture.start.onRequest = { submitted.fulfill() } + defer { fixture.start.finish() } + let pending = Task { await fixture.model.startShooting() } + await fulfillment(of: [submitted], timeout: 2) + if leavePage { fixture.model.invalidate(preservingSnapshot: true) } else { pending.cancel() } + fixture.start.finish() + await pending.value + XCTAssertTrue(fixture.model.startOutcomeUnknown) + XCTAssertFalse(fixture.model.hasSubmittedStart) + XCTAssertNil(fixture.model.startResponse) + XCTAssertEqual(fixture.model.response, previous) + XCTAssertEqual(fixture.read.requests, [501]) + await fixture.model.refresh() + await fixture.model.startShooting() + XCTAssertEqual(fixture.start.requests, [501]) + } + } + + /// 点击前任务已取消或账号已变化,不开始发送;账号变化会清除旧页面快照。 + func testCancellationAndIdentityChangeBeforeSubmitSendNothing() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + let cancelled = Task { await fixture.model.startShooting() } + cancelled.cancel() + await cancelled.value + XCTAssertTrue(fixture.start.requests.isEmpty) + XCTAssertFalse(fixture.model.startOutcomeUnknown) + fixture.scope.scenicID = 999 + await fixture.model.startShooting() + XCTAssertTrue(fixture.start.requests.isEmpty) + XCTAssertNil(fixture.model.response) + XCTAssertFalse(fixture.model.canStartShooting) + } + + /// 回执必须仍属于页面任务和锁定飞机,即使 API 替身返回异常身份也不接受成功。 + func testMismatchedReceiptCannotUpdateStateOrTriggerRead() async throws { + let changes: [[String: Any]] = [ + ["order_flight_task_id": 999], ["plane_id": 999], + ["order_flight_task": ["id": 501, "order_number": "ANOTHER-ORDER"]], + ["order_flight_task": ["id": 501, "scenic_id": 999]] + ] + for change in changes { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + fixture.start.result = .success(try StartTaskData.receipt(changes: change)) + await fixture.model.startShooting() + XCTAssertTrue(fixture.model.startOutcomeUnknown) + XCTAssertFalse(fixture.model.hasSubmittedStart) + XCTAssertNil(fixture.model.startResponse) + XCTAssertEqual(fixture.read.requests, [501]) + } + } + + /// 只读刷新失败后虽然仍显示上次 ready 快照,也必须先读到有效新状态再允许开拍。 + func testStaleReadySnapshotCannotBeUsedAfterFailedRefresh() async throws { + let fixture = try StartTaskFixture() + await fixture.model.refresh() + fixture.read.result = .failure(APIError.networkFailed("模拟读取失败")) + await fixture.model.refresh() + XCTAssertNotNil(fixture.model.response) + XCTAssertFalse(fixture.model.canStartShooting) + await fixture.model.startShooting() + XCTAssertTrue(fixture.start.requests.isEmpty) + } +} + +/// 独立的任务、账号与内存服务组合,不连接共享网络或真实无人机。 +@MainActor +private struct StartTaskFixture { + let scope: StartTaskScope + let read: StartTaskReadService + let start: StartTaskWriteService + let model: DroneDockShootingTaskViewModel + + init(allowStart: Bool = true) throws { + scope = StartTaskScope() + read = StartTaskReadService(result: .success(try StartTaskData.ready())) + start = StartTaskWriteService(result: .success(try StartTaskData.receipt())) + let boundScope = scope + model = DroneDockShootingTaskViewModel(context: boundScope.value, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: read, + startService: allowStart ? start : nil, currentContext: { boundScope.value }) + } +} + +/// 显式可切换景区的测试身份,避免修改共享登录状态。 +@MainActor +private final class StartTaskScope { + var scenicID = 128 + var value: DroneDockHomeContext { DroneDockShootingTaskTestData.context(scenicID: scenicID) } +} + +/// 单次返回指定状态的读取替身,记录每次同任务查询。 +@MainActor +private final class StartTaskReadService: DroneDockShootingServing { + var result: Result + private(set) var requests: [Int] = [] + + init(result: Result) { self.result = result } + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + requests.append(taskID) + return try result.get() + } +} + +/// 可挂起并返回成功或错误的开拍替身,始终只处理内存回执。 +@MainActor +private final class StartTaskWriteService: DroneDockStartShooting { + var result: Result + var onRequest: (() -> Void)? + var suspend = false + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + + init(result: Result) { self.result = result } + + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + requests.append(taskID) + onRequest?() + if suspend { return try await withCheckedThrowingContinuation { continuation = $0 } } + return try result.get() + } + + func finish() { + continuation?.resume(with: result) + continuation = nil + } +} + +/// 根据接口文档组装匿名模拟响应,不能作为真实设备执行证据。 +private enum StartTaskData { + static func ready(changes: [String: Any] = [:]) throws -> DroneDockShootingResponse { + try DroneDockShootingTaskTestData.response(changes: [ + "execution_batch": 100, "state_version": 1, "snapshot_kind": "full", + "flight_control": DroneDockShootingTaskTestData.flightControl(resumePhase: "arrived_pending_start", pauseReason: "arrival_wait"), + "order_flight_task": ["id": 501, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128, "status": 20], + "task": ["id": 501, "status": 20], + "execute_gate": ["can_execute": true, "primary_action": "start_shoot", "primary_action_label": "开始拍摄"], + "ui": ["phase": "arrived_pending_start", "title": "模拟无人机已到达", "message": "模拟确认游客站位"] + ].merging(changes) { _, new in new }) + } + + static func shooting() throws -> DroneDockShootingResponse { + try ready(changes: ["state_version": 2, "flight_control": DroneDockShootingTaskTestData.flightControl(), "ui": ["phase": "shooting", "title": "模拟无人机正在拍摄中", "message": "本地模拟,未下发设备指令"], + "execute_gate": ["can_execute": false, "primary_action": "shooting"]]) + } + + static func receipt(changes: [String: Any] = [:]) throws -> DroneDockStartShootResponse { + let payload: [String: Any] = [ + "order_flight_task_id": 501, "plane_id": 58, "task_uuid": "LOCAL-START-501", + "order_flight_task": ["id": 501, "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128], + "ui": ["phase": "shooting", "title": "模拟无人机正在拍摄中", "message": "本地模拟"] + ] + return try JSONDecoder().decode(DroneDockStartShootResponse.self, + from: JSONSerialization.data(withJSONObject: payload.merging(changes) { _, new in new })) + } +} diff --git a/suixinkanTests/DroneDockStartShootViewTests.swift b/suixinkanTests/DroneDockStartShootViewTests.swift new file mode 100644 index 0000000..7c0d91f --- /dev/null +++ b/suixinkanTests/DroneDockStartShootViewTests.swift @@ -0,0 +1,147 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 通过独立内存传输驱动真实任务页,验证开始按钮与接口流程,不连接任何后端。 +@MainActor +final class DroneDockStartShootViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 双击只提交一次,回执后读同一任务并显示拍摄中,固定区域和旧读数不闪空。 + func testLocalSuccessRefreshesSameTaskAndRejectsDoubleTap() async throws { + let controller = try makeController(result: "success") + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.canStartShooting } + XCTAssertEqual(controller.title, "拍摄任务 · 本地模拟") + let fixedIDs = ["top", "stateContainer", "safety"] + let frames = try fixedIDs.map { try XCTUnwrap(find(controller.view, suffix: $0)).frame } + let oldTitle = controller.viewModel.presentation.title + let oldBattery = find(controller.view, suffix: "metric.battery")?.accessibilityValue + let button = try XCTUnwrap(find(controller.view, suffix: "primary") as? UIButton) + button.sendActions(for: .touchUpInside) + button.sendActions(for: .touchUpInside) + XCTAssertFalse(button.isEnabled) + XCTAssertEqual(find(controller.view, suffix: "metric.battery")?.accessibilityValue, oldBattery) + XCTAssertEqual(controller.viewModel.presentation.title, oldTitle) + try await settle(window) { controller.viewModel.hasSubmittedStart && controller.viewModel.presentation.phase == .shooting } + XCTAssertFalse(controller.viewModel.canStartShooting) + for (index, suffix) in fixedIDs.enumerated() { + XCTAssertEqual(try XCTUnwrap(find(controller.view, suffix: suffix)).frame, frames[index]) + } + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + XCTAssertEqual(entries.map { $0["method"] as? String }, ["GET", "POST", "GET"]) + XCTAssertEqual(entries.filter { $0["method"] as? String == "POST" }.count, 1) + } + + /// 明确业务拒绝保留旧页面,只有再次点击才再次提交;不偷偷创建或召唤。 + func testLocalBusinessFailureAllowsOnlyExplicitRetry() async throws { + let controller = try makeController(result: "business-failure") + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.canStartShooting } + let button = try XCTUnwrap(find(controller.view, suffix: "primary") as? UIButton) + button.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.startErrorMessage != nil && !controller.viewModel.isStartingShooting } + XCTAssertFalse(controller.viewModel.startOutcomeUnknown) + XCTAssertFalse(controller.viewModel.hasSubmittedStart) + XCTAssertTrue(controller.viewModel.canStartShooting) + XCTAssertTrue(button.isEnabled) + button.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.startErrorMessage != nil && !controller.viewModel.isStartingShooting } + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(entries.map { $0["method"] as? String }, ["GET", "POST", "POST"]) + XCTAssertFalse(entries.contains { ($0["path"] as? String)?.contains("/tasks/create") == true }) + XCTAssertFalse(entries.contains { $0["path"] as? String == "/api/app/airport/shoot" }) + } + + /// 超时结果未知时即使读回旧的可开始状态,也不能重发开始请求。 + func testLocalTimeoutLocksStartWhileReadRefreshRemainsAvailable() async throws { + let controller = try makeController(result: "timeout") + let window = makeWindow(controller) + defer { close(window) } + try await settle(window) { controller.viewModel.canStartShooting } + let button = try XCTUnwrap(find(controller.view, suffix: "primary") as? UIButton) + button.sendActions(for: .touchUpInside) + try await settle(window) { controller.viewModel.startOutcomeUnknown && !controller.viewModel.isStartingShooting } + XCTAssertFalse(controller.viewModel.canStartShooting) + let refresh = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.remote.navigationRefresh" + }) + XCTAssertTrue(refresh.isEnabled) + send(refresh) + try await settle(window) { !controller.viewModel.isLoading } + XCTAssertFalse(controller.viewModel.canStartShooting) + let transcript = try await records(controller, window: window) + let entries = try XCTUnwrap(transcript["records"] as? [[String: Any]]) + XCTAssertEqual(entries.filter { $0["method"] as? String == "POST" }.count, 1) + XCTAssertEqual(transcript["network_sent"] as? Bool, false) + } + + private func makeController(result: String) throws -> DroneDockShootingTaskViewController { + try XCTUnwrap(DroneDockStartShootSimulation.makeController( + arguments: ["--dock-start-shoot-mock", "--dock-start-shoot-result=\(result)"]) + as? DroneDockShootingTaskViewController) + } + + private func records(_ controller: UIViewController, window: UIWindow) async throws -> [String: Any] { + let item = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first { + $0.accessibilityIdentifier == "drone.task.mock.recordsButton" + }) + XCTAssertTrue(item.isEnabled) + send(item) + try await settle(window) { controller.presentedViewController != nil } + let sheet = try XCTUnwrap(controller.presentedViewController) + let text = try XCTUnwrap(allViews(sheet.view).first { + $0.accessibilityIdentifier == "drone.task.mock.records" + } as? UITextView) + return try XCTUnwrap(JSONSerialization.jsonObject(with: Data(text.text.utf8)) as? [String: Any]) + } + + private func send(_ item: UIBarButtonItem) { + guard let action = item.action else { return XCTFail("缺少按钮操作") } + _ = UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + + private func makeWindow(_ controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<200 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 80_000_000) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(nanoseconds: 15_000_000) + } + XCTFail("模拟开拍页面未在预期时间内完成状态更新") + throw NSError(domain: "DroneDockStartShootViewTests", code: 1) + } + + private func find(_ root: UIView, suffix: String) -> UIView? { + allViews(root).first { $0.accessibilityIdentifier == "drone.task.remote.\(suffix)" } + } + + private func allViews(_ root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews($0) } } +} diff --git a/suixinkanTests/DroneDockStatusContractTests.swift b/suixinkanTests/DroneDockStatusContractTests.swift new file mode 100644 index 0000000..fe49789 --- /dev/null +++ b/suixinkanTests/DroneDockStatusContractTests.swift @@ -0,0 +1,237 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证 9.9.1 设备、订单任务、航线和页面阶段的职责边界;所有响应均为内存快照。 +@MainActor +final class DroneDockStatusContractTests: XCTestCase { + /// 录制后的上传失败单独显示,即使订单任务已失败,也不变成重新飞行入口。 + func testExplicitMediaFailureStopsRecordingWithoutSuccessNoticeOrResummon() async throws { + for status in [20, 40] { + let fixture = try makeFixture(payload(phase: "post_shoot_upload_failed", status: status, wayline: 39)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .postShootUploadFailed) + XCTAssertTrue(fixture.model.presentation.title.contains("失败")) + XCTAssertEqual(fixture.model.presentation.message, "本地模拟:素材处理失败") + XCTAssertEqual(fixture.model.presentation.action, .materials) + XCTAssertTrue(fixture.model.presentation.isActionEnabled) + XCTAssertTrue(fixture.model.isRecordingFinished) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.canStartShooting) + await fixture.model.resummon() + await fixture.model.startShooting() + XCTAssertEqual(fixture.actions.resummonCount, 0) + XCTAssertEqual(fixture.actions.startCount, 0) + } + } + + /// 航线上传和渲染失败可补足缺少 UI 阶段的快照,不从订单“执行中”误报正在拍摄。 + func testUploadAndRenderFailureFallbackRemainRecordedAndDoNotEnableResummon() async throws { + for wayline in [39, 49] { + for phase: String? in [nil, "blocked"] { + let fixture = try makeFixture(payload(phase: phase, status: 20, wayline: wayline)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .postShootUploadFailed) + XCTAssertTrue(fixture.model.isRecordingFinished) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertEqual(fixture.model.presentation.action, .materials) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertEqual(fixture.model.response?.orderFlightTask?.status, 20, "不得改写后端订单任务状态") + } + } + } + + /// 后端明确返回旧的可重召阶段时保持既有流程,不把新上传失败规则覆盖到它。 + func testExplicitRestartableFailureKeepsExistingResummonFlow() async throws { + let fixture = try makeFixture(payload(phase: "failed_restartable", status: 40, wayline: 39)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .failed) + XCTAssertEqual(fixture.model.presentation.action, .retry) + XCTAssertTrue(fixture.model.canResummon) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + } + + /// 拍摄与执行失败优先于乐观的拍摄阶段,不能弹出录制完成提示。 + func testShootingAndExecutionFailureOverrideOptimisticShootingPhase() async throws { + for wayline in [29, 91] { + let fixture = try makeFixture(payload(phase: "shooting", status: 20, wayline: wayline)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .failed) + XCTAssertFalse(fixture.model.isRecordingFinished) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + XCTAssertFalse(fixture.model.canStartShooting) + } + } + + /// 航线取消不因订单摘要仍“执行中”或开拍门禁残留而开放拍摄。 + func testWaylineCancellationBlocksStartAndResummon() async throws { + let fixture = try makeFixture(payload(phase: "arrived_pending_start", status: 20, wayline: 90)) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .blocked) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.isRecordingFinished) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + } + + /// 待确认任务不能借旧的开拍门禁或安全指令列表继续操作。 + func testUnconfirmedTaskBlocksFlightActionsDespiteOptimisticUI() async throws { + for phase in ["arrived_pending_start", "shooting", "completed"] { + var value = payload(phase: phase, status: 60, wayline: 20) + value["ui"] = ["phase": phase, "title": "本地模拟:旧阶段", "commands": [["command": "flighttask_pause"]]] + let fixture = try makeFixture(value) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.presentation.phase, .blocked) + XCTAssertTrue(fixture.model.presentation.title.contains("待确认")) + XCTAssertFalse(fixture.model.canStartShooting) + XCTAssertFalse(fixture.model.canResummon) + XCTAssertFalse(fixture.model.canSendCommand(.pause)) + XCTAssertFalse(fixture.model.shouldPresentRecordingCompletion) + await fixture.model.startShooting() + await fixture.model.resummon() + await fixture.model.sendCommand(.pause) + XCTAssertEqual(fixture.actions.startCount, 0) + XCTAssertEqual(fixture.actions.resummonCount, 0) + XCTAssertEqual(fixture.actions.commandCount, 0) + } + } + + /// 当前工作态为空闲时,不让历史在线字段 0/2 错误覆盖它。 + func testIdleWorkStatusTakesPrecedenceOverHistoricalOfflineFlags() async throws { + for online in [0, 2] { + let fixture = try makeFixture(payload(phase: "failed_restartable", status: 40, wayline: 29, + plane: ["id": 58, "work_status": 1, "online_status": online])) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canResummon) + XCTAssertFalse(fixture.model.presentation.actionNote?.contains("离线") == true) + } + } + + /// 工作态拍摄中属于忙碌,历史在线字段不能将其显示为离线或空闲。 + func testBusyWorkStatusBlocksResummonWithBusyReason() async throws { + for online in [0, 1, 2] { + let fixture = try makeFixture(payload(phase: "failed_restartable", status: 40, wayline: 29, + plane: ["id": 58, "work_status": 2, "online_status": online])) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canResummon) + XCTAssertEqual(fixture.model.presentation.actionNote, "无人机忙碌,暂不可召唤") + await fixture.model.resummon() + XCTAssertEqual(fixture.actions.resummonCount, 0) + } + } + + /// 工作态明确离线时,即使表字段仍在线也不能重召唤。 + func testOfflineWorkStatusWinsOverOnlineFlag() async throws { + let fixture = try makeFixture(payload(phase: "failed_restartable", status: 40, wayline: 29, + plane: ["id": 58, "work_status": 0, "online_status": 1])) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canResummon) + XCTAssertEqual(fixture.model.presentation.actionNote, "无人机离线,暂不可召唤") + } + + /// 没有可信工作态时,所有明确非 1 在线标记均保守视为离线,而非仅处理历史值 2。 + func testUnknownWorkStatusUsesNonOnlineFlagAsOfflineFallback() async throws { + for online in [0, 2, 99, -1] { + for work: Int? in [nil, 99] { + var plane: [String: Any] = ["id": 58, "online_status": online] + if let work { plane["work_status"] = work } + let fixture = try makeFixture(payload(phase: "failed_restartable", status: 40, wayline: 29, plane: plane)) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canResummon) + XCTAssertEqual(fixture.model.presentation.actionNote, "无人机离线,暂不可召唤") + } + } + } + + /// 同一个完整快照从 HTTP 或 WS 进入时得到相同的素材失败展示与动作许可。 + func testMediaFailureMatchesAcrossHTTPAndWebSocket() async throws { + var value = payload(phase: "post_shoot_upload_failed", status: 40, wayline: 39) + value["order_flight_task_id"] = 501 + value["execution_batch"] = 100 + value["state_version"] = 12 + value["snapshot_kind"] = "full" + let http = try makeFixture(value) + await http.model.refresh() + guard case .snapshot(let snapshot) = try DroneDockShootingSocketMessage.decode(RealtimeTestData.push(value)) else { + return XCTFail("完整 WS 快照必须可解析") + } + let socket = try makeFixture(payload(phase: "shooting", status: 20, wayline: 20)) + XCTAssertEqual(socket.model.applyTaskSnapshot(snapshot), .applied) + XCTAssertEqual(socket.model.presentation, http.model.presentation) + XCTAssertTrue(socket.model.isRecordingFinished) + XCTAssertFalse(socket.model.shouldPresentRecordingCompletion) + XCTAssertFalse(socket.model.canResummon) + XCTAssertTrue(http.service.requests.allSatisfy { !$0.liveBattery }) + XCTAssertTrue(socket.service.requests.isEmpty) + } + + /// 成功提示只保留给录制完成和素材就绪,不因新增素材失败阶段扩大弹窗范围。 + func testRecordingSuccessNoticeOnlyAllowsSuccessfulRecordingPhases() async throws { + for (phase, status, wayline) in [("post_shoot_uploading", 20, 30), ("completed", 30, 50)] { + let fixture = try makeFixture(payload(phase: phase, status: status, wayline: wayline)) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.isRecordingFinished) + XCTAssertTrue(fixture.model.shouldPresentRecordingCompletion) + } + } + + private func payload(phase: String?, status: Int, wayline: Int, + plane: [String: Any] = ["id": 58, "work_status": 1, "online_status": 1]) -> [String: Any] { + var value = DroneDockShootingTaskTestData.payload() + value["execution_batch"] = 100 + value["state_version"] = 1 + value["flight_control"] = DroneDockShootingTaskTestData.flightControl( + state: status == 40 ? "returned" : "executing", canPause: status == 20, + canReturn: status == 20, droneInDock: status == 40 ? "inside" : "outside", + isAirborne: status != 40, pauseReason: phase == "arrived_pending_start" ? "arrival_wait" : nil) + value["restart_gate"] = ["can_restart": phase == "failed_restartable"] + value["task"] = ["id": 501, "status": status, "wayline_status": wayline] + value["order_flight_task"] = ["id": 501, "status": status, "result_message": "本地模拟:素材处理失败"] + value["current_plane"] = plane + value["execute_gate"] = ["can_execute": true, "primary_action": "start_shoot"] + if let phase { + value["ui"] = ["phase": phase, "title": "本地模拟:素材处理失败", "message": "本地模拟:素材处理失败", "commands": []] + } else { + value["ui"] = NSNull() + } + return value + } + + private func makeFixture(_ payload: [String: Any]) throws -> (model: DroneDockShootingTaskViewModel, + service: DroneDockShootingTaskTestService, actions: StatusContractActions) { + let context = DroneDockShootingTaskTestData.context() + let service = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.decode(payload))) + let actions = StatusContractActions() + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, startService: actions, + commandService: actions, resummonService: actions, currentContext: { context }) + return (model, service, actions) + } +} + +/// 只记录被调用次数并返回本地错误,绝无网络或设备传输能力。 +@MainActor +private final class StatusContractActions: DroneDockStartShooting, DroneDockCommandSending, DroneDockResummonServing { + private(set) var startCount = 0 + private(set) var commandCount = 0 + private(set) var resummonCount = 0 + + /// 任何意外的开拍调用都会留下计数,便于检查门禁。 + func startShooting(taskID: Int) async throws -> DroneDockStartShootResponse { + startCount += 1 + throw APIError.networkFailed("本地模拟,无真实设备") + } + + /// 任何意外的安全指令调用都会留下计数,便于检查门禁。 + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + commandCount += 1 + throw APIError.networkFailed("本地模拟,无真实设备") + } + + /// 任何意外的重召唤调用都会留下计数,便于检查门禁。 + func resummon(taskID: Int) async throws -> DroneDockShootResponse { + resummonCount += 1 + throw APIError.networkFailed("本地模拟,无真实设备") + } +} diff --git a/suixinkanTests/DroneDockTaskControlStateViewTests.swift b/suixinkanTests/DroneDockTaskControlStateViewTests.swift new file mode 100644 index 0000000..91811f2 --- /dev/null +++ b/suixinkanTests/DroneDockTaskControlStateViewTests.swift @@ -0,0 +1,707 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用内存快照核验暂停、返航和回巢面板,以及中央继续任务的实际指令连接。 +@MainActor +final class DroneDockTaskControlStateViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 诊断记录实际带秒数的按钮标题,计时更新不会改变其他操作门禁或加载状态。 + func testDiagnosticFieldsReflectCountdownButtonTitleAndKeepControlState() throws { + let view = DroneDockTaskStatusView(frame: CGRect(x: 0, y: 0, width: 375, height: 180)) + view.apply(DroneDockTaskPresentation(phase: .paused, title: "无人机已暂停", message: "当前悬停待命。", + deviceStatus: "", action: .resume, actionTitle: "继续任务", isActionEnabled: true), isPrimaryActionLoading: true) + view.layoutIfNeeded() + XCTAssertEqual(view.diagnosticFields["title"] as? String, "无人机已暂停") + XCTAssertEqual(view.diagnosticFields["action_title"] as? String, "继续任务") + XCTAssertEqual(view.diagnosticFields["action_loading"] as? Bool, true) + XCTAssertEqual(view.diagnosticFields["action_enabled"] as? Bool, false) + + view.apply(DroneDockTaskPresentation(phase: .ready, title: "无人机已到达", message: "确认后开拍", + deviceStatus: "", action: .start, actionTitle: "开始拍摄", isActionEnabled: true, countdownSeconds: 30)) + view.layoutIfNeeded() + var thirty = view.diagnosticFields + XCTAssertEqual(thirty["action_title"] as? String, "开始拍摄(30s)") + XCTAssertEqual(thirty["countdown"] as? String, "running") + XCTAssertFalse(views(in: view).contains { $0.accessibilityIdentifier == "drone.task.remote.countdown" }) + view.updateCountdown(seconds: 29) + var twentyNine = view.diagnosticFields + XCTAssertEqual(twentyNine["action_title"] as? String, "开始拍摄(29s)") + XCTAssertEqual(twentyNine["countdown"] as? String, "running") + thirty.removeValue(forKey: "action_title") + twentyNine.removeValue(forKey: "action_title") + XCTAssertEqual(try JSONSerialization.data(withJSONObject: thirty, options: [.sortedKeys]), + try JSONSerialization.data(withJSONObject: twentyNine, options: [.sortedKeys])) + view.updateCountdown(seconds: 0) + XCTAssertEqual(view.diagnosticFields["action_title"] as? String, "开始拍摄(0s)") + XCTAssertEqual(view.diagnosticFields["countdown"] as? String, "zero") + XCTAssertEqual(view.diagnosticFields["action_enabled"] as? Bool, true) + view.updateCountdown(seconds: nil) + XCTAssertEqual(view.diagnosticFields["action_title"] as? String, "开始拍摄") + XCTAssertEqual(view.diagnosticFields["countdown"] as? String, "hidden") + XCTAssertEqual(view.diagnosticFields["action_enabled"] as? Bool, true) + + let button = DroneShootingTaskSafetyButton(symbol: "pause.circle", color: .orange, filled: true) + button.apply(title: "紧急暂停", subtitle: "悬停待命", enabled: true, isLoading: true) + XCTAssertEqual(button.diagnosticFields["title"] as? String, "紧急暂停") + XCTAssertEqual(button.diagnosticFields["subtitle"] as? String, "悬停待命") + XCTAssertEqual(button.diagnosticFields["loading"] as? Bool, true) + XCTAssertEqual(button.diagnosticFields["enabled"] as? Bool, false) + } + + /// 相同快照重新读取不重复输出 UI 展示;导航来源与真实按钮状态可在统一会话中关联。 + func testTaskPageDiagnosticsShareSessionAndDeduplicateUnchangedRender() async throws { + let logs = ControlStateDiagnosticLog() + let diagnostics = DroneDockTaskDiagnostics(sessionID: "ui-diagnostic-test", sink: { logs.append($0) }) + let service = try ControlStateViewService(state: "paused") + let controller = try makeController(service: service, diagnostics: diagnostics) + controller.recordNavigationEntry(source: "preparation", fields: ["preparation_session_id": "preparation-test"]) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .paused } + let pausedRenders = logs.events.filter { ($0["central"] as? [String: Any])?["phase"] as? String == "paused" } + let render = try XCTUnwrap(pausedRenders.last) + XCTAssertEqual(render["session_id"] as? String, "ui-diagnostic-test") + XCTAssertEqual(render["entry_source"] as? String, "preparation") + let safety = try XCTUnwrap(render["safety"] as? [String: Any]) + XCTAssertEqual((safety["pause"] as? [String: Any])?["enabled"] as? Bool, false) + XCTAssertEqual((safety["return_home"] as? [String: Any])?["enabled"] as? Bool, true) + let before = pausedRenders.count + try tapNavigationRefresh(controller) + try await settle(window) { !controller.viewModel.isLoading } + XCTAssertEqual(logs.events.filter { ($0["central"] as? [String: Any])?["phase"] as? String == "paused" }.count, before) + XCTAssertTrue(logs.events.contains { $0["event"] as? String == "navigation.task_entry" + && $0["preparation_session_id"] as? String == "preparation-test" }) + XCTAssertTrue(service.commands.isEmpty) + } + + /// 控制状态保持固定面板和整行按钮,禁用状态不会调用操作,紧凑布局也保留点击尺寸。 + func testControlPanelsUseLocalCopyAndStableActionArea() throws { + let states: [(DroneDockTaskDisplayPhase, String, String, DroneDockTaskDisplayAction, String, Bool)] = [ + (.paused, "无人机已暂停", "当前悬停待命。\n确认安全后,可继续任务或立即返航。", .resume, "继续任务", true), + (.returning, "无人机正在返航", "本次拍摄已中断。\n请留意实时画面与无人机状态。", .none, "拍摄已中断", false), + (.returned, "本次拍摄已中断", "无人机已返回机巢,可在满足条件后重新召唤。", .retry, "重新召唤无人机", true) + ] + for size in [CGSize(width: 320, height: 100), CGSize(width: 375, height: 160), CGSize(width: 414, height: 240)] { + let view = DroneDockTaskStatusView(frame: CGRect(origin: .zero, size: size)) + var calls = 0 + view.onPrimaryAction = { calls += 1 } + for (phase, title, message, action, buttonTitle, enabled) in states { + view.apply(DroneDockTaskPresentation(phase: phase, title: title, message: message, + deviceStatus: "后端设备摘要不应显示", action: action, actionTitle: buttonTitle, isActionEnabled: enabled)) + view.layoutIfNeeded() + let titleLabel = try XCTUnwrap(find(in: view, id: "drone.task.remote.statusTitle") as? UILabel) + let messageLabel = try XCTUnwrap(views(in: view).first { + $0.accessibilityIdentifier == "drone.task.remote.statusMessage" + } as? UILabel) + let button = try XCTUnwrap(find(in: view, id: action == .refresh ? "drone.task.remote.refresh" : "drone.task.remote.primary") as? UIButton) + XCTAssertEqual(titleLabel.text, title) + XCTAssertEqual(messageLabel.text, message) + XCTAssertEqual(messageLabel.isHidden, size.height < 120) + XCTAssertEqual(button.configuration?.title, buttonTitle) + XCTAssertEqual(button.isEnabled, enabled) + XCTAssertGreaterThanOrEqual(button.bounds.height, 44) + XCTAssertEqual(button.bounds.width, size.width - 36, accuracy: 0.5) + XCTAssertTrue(view.bounds.insetBy(dx: -0.5, dy: -0.5).contains(button.convert(button.bounds, to: view))) + XCTAssertFalse(visibleTexts(in: view).contains("后端设备摘要不应显示")) + XCTAssertEqual(views(in: view).filter { $0.accessibilityIdentifier == "drone.task.remote.statusTitle" }.count, 1) + let previous = calls + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, previous + (enabled ? 1 : 0)) + } + } + } + + /// 真正渲染到 UILabel 的颜色在加载和紧凑布局切换后仍为白色,不可用时才使用灰色。 + func testResumeButtonRenderedForegroundSurvivesLoadingAndLayoutChanges() async throws { + let host = UIViewController() + let panel = DroneDockTaskControlStateView(frame: CGRect(x: 0, y: 100, width: 375, height: 160)) + host.view.addSubview(panel) + panel.setIdentifiersActive(true) + var calls = 0 + panel.onPrimaryAction = { calls += 1 } + let window = makeWindow(root: host) + defer { close(window) } + + for (enabled, loading) in [(true, false), (false, true), (false, false), (true, false)] { + panel.apply(DroneDockTaskPresentation(phase: .paused, title: "无人机已暂停", message: "当前悬停待命。", + deviceStatus: "", action: .resume, actionTitle: "继续任务", isActionEnabled: enabled), + isPrimaryActionLoading: loading) + for height: CGFloat in [160, 240, 160] { + panel.frame.size.height = height + panel.setNeedsLayout() + try await settle(window) { panel.bounds.height == height } + let primary = try XCTUnwrap(find(in: panel, id: "drone.task.remote.primary") as? UIButton) + try assertRenderedForeground(primary, expected: enabled || loading ? .white : UIColor(hex: 0x929BAE)) + assertColor(try XCTUnwrap(primary.configuration?.background.backgroundColor), + equals: enabled || loading ? DroneDockStyle.primary : UIColor(hex: 0xEDF0F5)) + XCTAssertEqual(primary.titleLabel?.text, "继续任务") + XCTAssertEqual(primary.isEnabled, enabled && !loading) + XCTAssertGreaterThanOrEqual(primary.bounds.height, 44) + let before = calls + primary.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, before + (enabled && !loading ? 1 : 0)) + } + if loading { capture(window, name: "继续任务加载-白字蓝底(隔离模拟)") } + } + } + + /// 暂停时中央继续任务只发送一次 recovery,底部暂停禁用;新的执行快照恢复拍摄中。 + func testPausedPrimaryResumesSameTaskAndKeepsSafetyButtonsFixed() async throws { + let service = try ControlStateViewService(state: "paused") + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .paused } + let pause = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton) + let returnButton = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + let primary = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary") as? UIButton) + XCTAssertEqual(pause.accessibilityLabel, "已暂停") + XCTAssertEqual(pause.accessibilityValue, "悬停待命") + XCTAssertFalse(pause.isEnabled) + XCTAssertEqual(returnButton.accessibilityLabel, "立即返航") + XCTAssertTrue(returnButton.isEnabled) + XCTAssertEqual(primary.configuration?.title, "继续任务") + XCTAssertTrue(primary.isEnabled) + capture(window, name: "暂停-继续任务(隔离模拟)") + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + try await settle(window) { service.commands.count == 1 && controller.viewModel.presentation.phase == .shooting } + XCTAssertEqual(service.commands.map(\.taskID), [501]) + XCTAssertEqual(service.commands.map(\.command), [.resume]) + XCTAssertEqual(pause.accessibilityLabel, "紧急暂停") + XCTAssertTrue(pause.isEnabled) + XCTAssertEqual(returnButton.accessibilityLabel, "立即返航") + XCTAssertFalse(visibleTexts(in: controller.view).contains("接口错误按钮名称")) + } + + /// 手动返航不显示拍摄成功,确认回巢后恢复中央重召唤入口并禁用两项安全操作。 + func testManualReturnUpdatesToReturnedAndReopensResummon() async throws { + let service = try ControlStateViewService(state: "returning") + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .returning } + let returnButton = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + var primary = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary") as? UIButton) + XCTAssertEqual(returnButton.accessibilityLabel, "返航中") + XCTAssertEqual(returnButton.accessibilityValue, "返回机巢") + XCTAssertFalse(returnButton.isEnabled) + XCTAssertEqual(primary.configuration?.title, "拍摄已中断") + XCTAssertFalse(primary.isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机正在返航")) + XCTAssertFalse(controller.viewModel.shouldPresentRecordingCompletion) + capture(window, name: "手动返航中(隔离模拟)") + service.response = try ControlStateViewService.snapshot(state: "returned", version: 2) + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.presentation.phase == .returned } + primary = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary") as? UIButton) + XCTAssertEqual(primary.configuration?.title, "重新召唤无人机") + XCTAssertTrue(primary.isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机已返回机巢,可在满足条件后重新召唤。")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机已返回机巢")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("拍摄已完成")) + XCTAssertFalse(controller.viewModel.shouldPresentRecordingCompletion) + XCTAssertEqual(returnButton.accessibilityLabel, "已返航") + XCTAssertEqual(returnButton.accessibilityValue, "已返回机巢") + XCTAssertFalse(returnButton.isEnabled) + XCTAssertFalse(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton).isEnabled) + XCTAssertTrue(service.commands.isEmpty) + capture(window, name: "已返回机巢-可重召唤(隔离模拟)") + } + + /// 暂停受理后只转动暂停按钮,中央保留拍摄状态、返航可点,直到匹配的设备确认。 + func testAcceptedPauseKeepsBusinessPanelAndReturnEnabledUntilConfirmed() async throws { + let service = try ControlStateViewService(state: "executing") + service.confirmsCommand = false + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .shooting } + let pause = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton) + let returnButton = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + pause.sendActions(for: .touchUpInside) + pause.sendActions(for: .touchUpInside) + XCTAssertTrue(returnButton.isEnabled) + try await settle(window) { service.commands.count == 1 && !controller.viewModel.isSendingCommand } + XCTAssertEqual(controller.viewModel.presentation.phase, .shooting) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机正在拍摄中")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("指令已受理")) + XCTAssertEqual(pause.accessibilityLabel, "紧急暂停") + XCTAssertEqual(pause.accessibilityValue, "处理中,悬停待命") + XCTAssertFalse(pause.isEnabled) + let spinner = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause.loading") as? UIActivityIndicatorView) + XCTAssertTrue(spinner.isAnimating) + XCTAssertTrue(returnButton.isEnabled) + XCTAssertEqual(returnButton.accessibilityValue, "中断任务") + XCTAssertEqual(service.commands.map(\.command), [.pause]) + service.response = try ControlStateViewService.snapshot(state: "paused", version: 2, + pendingCommand: service.progress(for: 0, status: "succeeded")) + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.presentation.phase == .paused && !controller.viewModel.isCommandLoading(.pause) } + XCTAssertFalse(spinner.isAnimating) + XCTAssertEqual(pause.accessibilityLabel, "已暂停") + XCTAssertEqual(pause.accessibilityValue, "悬停待命") + XCTAssertTrue(returnButton.isEnabled) + } + + /// 设备确认后立即结束按钮动画,即使紧随其后的 shooting 回查仍挂起;旧权限仍不得重复暂停。 + func testConfirmedCommandStopsSpinnerWhileFollowupReadIsPending() async throws { + let service = try ControlStateViewService(state: "executing") + service.holdsReadsAfterCommand = true + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { service.finishReads(); close(window) } + try await settle(window) { controller.viewModel.canSendCommand(.pause) } + let pause = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton) + let returnButton = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + pause.sendActions(for: .touchUpInside) + try await settle(window) { service.heldReadCount == 1 && !controller.viewModel.isSendingCommand } + XCTAssertEqual(controller.viewModel.commandResponse?.deviceConfirmed, true) + XCTAssertFalse(controller.viewModel.isCommandLoading(.pause)) + let spinner = try XCTUnwrap(views(in: controller.view).first { + $0.accessibilityIdentifier == "drone.task.remote.pause.loading" + } as? UIActivityIndicatorView) + XCTAssertFalse(spinner.isAnimating) + XCTAssertTrue(spinner.isHidden) + XCTAssertFalse(pause.isEnabled, "设备确认并不允许利用旧权限重复提交") + XCTAssertTrue(returnButton.isEnabled) + XCTAssertEqual(controller.viewModel.presentation.phase, .shooting) + pause.sendActions(for: .touchUpInside) + XCTAssertEqual(service.commands.map(\.command), [.pause]) + service.finishReads() + try await settle(window) { controller.viewModel.presentation.phase == .paused } + XCTAssertFalse(spinner.isAnimating) + } + + /// 继续任务待确认时保留暂停面板与独立返航权限,返航可直接提交且不重复发送。 + func testPendingResumeLoadsOnlyPrimaryAndKeepsReturnAvailable() async throws { + let service = try ControlStateViewService(state: "paused") + service.confirmsCommand = false + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .paused } + let primary = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary") as? UIButton) + let returnButton = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + primary.sendActions(for: .touchUpInside) + primary.sendActions(for: .touchUpInside) + XCTAssertFalse(primary.isEnabled) + XCTAssertTrue(returnButton.isEnabled) + try await settle(window) { service.commands.count == 1 && !controller.viewModel.isSendingCommand } + XCTAssertEqual(controller.viewModel.presentation.phase, .paused) + XCTAssertEqual(primary.configuration?.title, "继续任务") + XCTAssertTrue(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary.loading") as? UIActivityIndicatorView).isAnimating) + XCTAssertTrue(returnButton.isEnabled) + XCTAssertEqual(service.commands.map(\.command), [.resume]) + service.response = try ControlStateViewService.snapshot(state: "paused", version: 2, + pendingCommand: service.progress(for: 0, status: "pending")) + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.response?.stateVersion == 2 && !controller.viewModel.isLoading } + XCTAssertEqual(controller.viewModel.presentation.phase, .paused) + XCTAssertFalse(primary.isEnabled) + XCTAssertTrue(controller.viewModel.isCommandLoading(.resume)) + try assertRenderedForeground(primary, expected: .white) + XCTAssertTrue(returnButton.isEnabled) + capture(window, name: "恢复受理待设备确认-保持暂停(隔离模拟)") + returnButton.sendActions(for: .touchUpInside) + returnButton.sendActions(for: .touchUpInside) + XCTAssertNil(controller.presentedViewController, "恢复待确认不会让返航新增确认弹窗") + XCTAssertFalse(returnButton.isEnabled) + let returnSpinner = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return.loading") as? UIActivityIndicatorView) + XCTAssertTrue(returnSpinner.isAnimating) + try await settle(window) { service.commands.count == 2 && !controller.viewModel.isSendingCommand } + XCTAssertEqual(service.commands.map(\.command), [.resume, .returnHome]) + XCTAssertEqual(Set(service.commands.map(\.clientRequestID)).count, 2) + XCTAssertTrue(service.commands.allSatisfy { $0.taskID == 501 }) + XCTAssertTrue(controller.viewModel.isCommandLoading(.returnHome)) + XCTAssertFalse(controller.viewModel.isCommandLoading(.resume), "后受理返航替代旧的继续意图") + XCTAssertEqual(controller.viewModel.presentation.phase, .paused, "受理本身不替代完整设备快照") + XCTAssertNil(controller.presentedViewController) + service.response = try ControlStateViewService.snapshot(state: "returning", version: 3, + pendingCommand: service.progress(for: 1, status: "succeeded")) + try tapNavigationRefresh(controller) + try await settle(window) { controller.viewModel.presentation.phase == .returning && !controller.viewModel.isCommandLoading(.returnHome) } + XCTAssertFalse(returnSpinner.isAnimating) + XCTAssertFalse(returnButton.isEnabled) + XCTAssertEqual(service.commands.count, 2) + XCTAssertFalse(visibleTexts(in: controller.view).contains("指令已受理")) + } + + /// 返航途中高度证据未知时,明确的 can_pause 仍控制暂停入口,不把 null 当作已落地。 + func testReturningWithUnknownAirborneUsesExplicitPausePermission() async throws { + let service = try ControlStateViewService(state: "returning") + service.confirmsCommand = false + service.response = try ControlStateViewService.snapshot(state: "returning", version: 1, airborne: nil) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .returning } + let pause = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton) + XCTAssertTrue(pause.isEnabled) + XCTAssertFalse(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton).isEnabled) + pause.sendActions(for: .touchUpInside) + try await settle(window) { service.commands.count == 1 && !controller.viewModel.isSendingCommand } + XCTAssertEqual(service.commands.map(\.command), [.pause]) + XCTAssertEqual(controller.viewModel.presentation.phase, .returning) + XCTAssertTrue(controller.viewModel.isCommandLoading(.pause)) + } + + /// 已回巢但机巢未恢复空闲时显示回巢状态并禁用重召唤,空闲快照到达后再开放。 + func testReturnedWaitsForDockIdleBeforeEnablingResummon() async throws { + let service = try ControlStateViewService(state: "returned") + service.response = try ControlStateViewService.snapshot(state: "returned", version: 1, awaitDockIdle: true) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .returned } + let primary = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.primary") as? UIButton) + XCTAssertEqual(primary.configuration?.title, "重新召唤无人机") + XCTAssertFalse(primary.isEnabled) + try assertRenderedForeground(primary, expected: UIColor(hex: 0x929BAE)) + XCTAssertFalse(controller.viewModel.shouldPresentRecordingCompletion) + XCTAssertFalse(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton).isEnabled) + service.response = try ControlStateViewService.snapshot(state: "returned", version: 2) + try tapNavigationRefresh(controller) + try await settle(window) { primary.isEnabled } + XCTAssertEqual(controller.viewModel.presentation.phase, .returned) + try assertRenderedForeground(primary, expected: .white) + XCTAssertTrue(service.commands.isEmpty) + } + + /// 后端返航尚在处理中仍允许紧急暂停,不能因为返航按钮加载把另一按钮禁用。 + func testPendingReturnAllowsPauseWithoutReplacingReturningPanel() async throws { + let service = try ControlStateViewService(state: "returning") + service.confirmsCommand = false + service.response = try ControlStateViewService.snapshot(state: "returning", version: 1, pendingCommand: [ + "command_id": "remote-return", "client_request_id": "remote-request", "command": "return_home", "status": "pending"]) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .returning } + let pause = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton) + let returnButton = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + XCTAssertTrue(pause.isEnabled) + XCTAssertFalse(returnButton.isEnabled) + XCTAssertTrue(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return.loading") as? UIActivityIndicatorView).isAnimating) + pause.sendActions(for: .touchUpInside) + try await settle(window) { service.commands.count == 1 && !controller.viewModel.isSendingCommand } + XCTAssertEqual(service.commands.map(\.command), [.pause]) + XCTAssertEqual(controller.viewModel.presentation.phase, .returning) + XCTAssertTrue(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause.loading") as? UIActivityIndicatorView).isAnimating) + XCTAssertFalse(visibleTexts(in: controller.view).contains("指令已受理")) + } + + /// 指令失败或被替代都结束对应按钮的加载,业务面板保留设备已确认的拍摄阶段。 + func testTerminalCommandProgressStopsLoadingWithoutReplacingBusinessPanel() async throws { + for status in ["failed", "superseded"] { + let service = try ControlStateViewService(state: "executing") + service.confirmsCommand = false + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.canSendCommand(.pause) } + let pause = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause") as? UIButton) + pause.sendActions(for: .touchUpInside) + try await settle(window) { service.commands.count == 1 && !controller.viewModel.isSendingCommand } + let spinner = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.pause.loading") as? UIActivityIndicatorView) + XCTAssertTrue(spinner.isAnimating) + service.response = try ControlStateViewService.snapshot(state: "executing", version: 2, + pendingCommand: service.progress(for: 0, status: status)) + try tapNavigationRefresh(controller) + try await settle(window) { !controller.viewModel.isCommandLoading(.pause) } + XCTAssertFalse(spinner.isAnimating) + XCTAssertTrue(pause.isEnabled) + XCTAssertEqual(controller.viewModel.presentation.phase, .shooting) + XCTAssertTrue(try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton).isEnabled) + } + } + + /// 起飞准备即使在巢也展示前往点位,到点自动悬停展示待开拍而非手动暂停。 + func testStartingAndArrivalWaitUseTheirBusinessPanels() async throws { + for (state, arrivalWait, expected) in [("starting", false, DroneDockTaskDisplayPhase.navigating), + ("executing", true, .ready)] { + let service = try ControlStateViewService(state: state) + service.response = try ControlStateViewService.snapshot(state: state, version: 1, arrivalWait: arrivalWait) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == expected } + XCTAssertFalse(visibleTexts(in: controller.view).contains("无人机已暂停")) + XCTAssertFalse(visibleTexts(in: controller.view).contains("无人机已返回机巢")) + } + } + + /// 中央正常拍完的业务状态不覆盖物理返航、回巢或未知状态,安全控制文案保持设备含义。 + func testCompletedRecordingSafetyButtonsFollowPhysicalFlightState() async throws { + let cases = [("returning", "返航中", "返回机巢"), + ("returned", "已返航", "已返回机巢"), + ("unknown", "立即返航", "暂不可用")] + for (state, title, subtitle) in cases { + let service = try ControlStateViewService(state: state) + service.response = try ControlStateViewService.snapshot(state: state, version: 1, normalCompletion: true) + let controller = try makeController(service: service) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { controller.viewModel.presentation.phase == .postShootUploading } + let button = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return") as? UIButton) + XCTAssertEqual(button.accessibilityLabel, title) + XCTAssertEqual(button.accessibilityValue, subtitle) + XCTAssertFalse(button.isEnabled) + XCTAssertTrue(visibleTexts(in: controller.view).contains("拍摄已完成")) + button.sendActions(for: .touchUpInside) + XCTAssertTrue(service.commands.isEmpty) + } + } + + /// 中断返航途中仍可读取图传;首次进入已回巢快照时不请求图传,也不显示拍摄成功。 + func testReturnedSnapshotDoesNotStartLiveWhileReturningStillLoads() async throws { + for state in ["returning", "returned"] { + let service = try ControlStateViewService(state: state) + let liveService = ControlStateLiveService() + let controller = try makeController(service: service, liveService: liveService) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { + controller.viewModel.response != nil && !controller.viewModel.isLoading + && (state == "returned" || liveService.requests == [501]) + } + XCTAssertEqual(liveService.requests, state == "returned" ? [] : [501]) + XCTAssertEqual(controller.viewModel.shouldStopLiveReception, state == "returned") + XCTAssertFalse(controller.viewModel.shouldPresentRecordingCompletion) + XCTAssertFalse(visibleTexts(in: controller.view).contains("拍摄已完成")) + if state == "returned" { + XCTAssertNil(controller.liveViewModel.response) + XCTAssertNil(controller.liveViewModel.playbackSessionID) + XCTAssertTrue(visibleTexts(in: controller.view).contains("无人机已返回机巢")) + XCTAssertTrue(visibleTexts(in: controller.view).contains("拍摄封面 · 实时图传已结束")) + } + } + } + + private func makeController(service: ControlStateViewService, + liveService: (any DroneDockLiveServing)? = nil, + diagnostics: DroneDockTaskDiagnostics = DroneDockTaskDiagnostics()) throws -> DroneDockShootingTaskViewController { + let context = DroneDockShootingTaskTestData.context() + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, + commandService: service, resummonService: service, diagnostics: diagnostics, currentContext: { context }) + let live = DroneDockLiveViewModel(context: context, taskID: 501, service: liveService, currentContext: { context }) + return DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live, + simulationRecordsProvider: { "纯内存替身,未联网" }, + shootingPollDelay: { _ in try await Task.sleep(for: .seconds(60)) }) + } + + private func makeWindow(root: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: root) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<160 { + window.layoutIfNeeded() + if condition() { + try await Task.sleep(for: .milliseconds(80)) + window.layoutIfNeeded() + if condition() { return } + } + try await Task.sleep(for: .milliseconds(15)) + } + XCTFail("隔离任务控制页面未达到预期状态") + throw NSError(domain: "DroneDockTaskControlStateViewTests", code: 1) + } + + private func views(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { views(in: $0) } } + private func hidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(hidden) ?? false) } + private func find(in root: UIView, id: String) -> UIView? { + views(in: root).first { $0.accessibilityIdentifier == id && !hidden($0) } + } + private func visibleTexts(in root: UIView) -> [String] { + views(in: root).compactMap { view in + guard let label = view as? UILabel, !hidden(label), !label.bounds.isEmpty else { return nil } + return label.text + } + } + private func assertRenderedForeground(_ button: UIButton, expected: UIColor, + file: StaticString = #filePath, line: UInt = #line) throws { + button.layoutIfNeeded() + let label = try XCTUnwrap(button.titleLabel, file: file, line: line) + XCTAssertFalse(label.bounds.isEmpty, file: file, line: line) + XCTAssertFalse(try XCTUnwrap(label.text, file: file, line: line).isEmpty, file: file, line: line) + let attributedColor = label.attributedText.flatMap { text -> UIColor? in + guard text.length > 0 else { return nil } + return text.attribute(.foregroundColor, at: 0, effectiveRange: nil) as? UIColor + } + let actual = try XCTUnwrap(attributedColor ?? label.textColor, file: file, line: line) + assertColor(actual, equals: expected, file: file, line: line) + XCTAssertNotNil(button.configuration?.image, file: file, line: line) + let transform = try XCTUnwrap(button.configuration?.imageColorTransformer, file: file, line: line) + assertColor(transform(.black), equals: expected, file: file, line: line) + } + private func assertColor(_ actual: UIColor, equals expected: UIColor, + file: StaticString = #filePath, line: UInt = #line) { + var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0 + var er: CGFloat = 0, eg: CGFloat = 0, eb: CGFloat = 0, ea: CGFloat = 0 + XCTAssertTrue(actual.getRed(&r, green: &g, blue: &b, alpha: &a), file: file, line: line) + XCTAssertTrue(expected.getRed(&er, green: &eg, blue: &eb, alpha: &ea), file: file, line: line) + for (value, target) in [(r, er), (g, eg), (b, eb), (a, ea)] { + XCTAssertEqual(value, target, accuracy: 0.005, file: file, line: line) + } + } + private func tapNavigationRefresh(_ controller: UIViewController) throws { + let item = try XCTUnwrap(controller.navigationItem.rightBarButtonItems?.first) + let action = try XCTUnwrap(item.action) + _ = UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + private func capture(_ window: UIWindow, name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} + +/// 仅把页面诊断 JSON 保存在内存,线程安全且不替换全局控制台。 +private final class ControlStateDiagnosticLog: @unchecked Sendable { + private let lock = NSLock() + private var messages: [String] = [] + + /// 接收一次日志输出,不执行网络或设备操作。 + func append(_ message: String) { + lock.lock() + defer { lock.unlock() } + messages.append(message) + } + + /// 返回调用时的完整 JSON 事件快照。 + var events: [[String: Any]] { + lock.lock() + defer { lock.unlock() } + return messages.compactMap { try? JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any] } + } +} + +/// 只计数并返回内存参数;没有播放地址、RTC 引擎或网络传输能力。 +@MainActor +private final class ControlStateLiveService: DroneDockLiveServing { + private(set) var requests: [Int] = [] + + /// 仅记录同任务的模拟图传读取,不启动设备推流。 + func live(taskID: Int) async throws -> DroneDockLiveResponse { + requests.append(taskID) + return try DroneDockLiveTestData.response() + } +} + +/// 遵守 flight_control 合同的纯内存读写服务,完全不具备网络或设备能力。 +@MainActor +private final class ControlStateViewService: DroneDockShootingServing, DroneDockCommandSending, DroneDockResummonServing { + var response: DroneDockShootingResponse + var confirmsCommand = true + var holdsReadsAfterCommand = false + private(set) var heldReadCount = 0 + private var heldReads: [CheckedContinuation] = [] + private(set) var commands: [(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String)] = [] + + /// 按指定飞控状态初始化同一任务和批次的完整快照。 + init(state: String) throws { response = try Self.snapshot(state: state, version: 1) } + + /// 只读内存快照,不采集设备电量。 + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + guard holdsReadsAfterCommand, !commands.isEmpty else { return response } + heldReadCount += 1 + return await withCheckedContinuation { heldReads.append($0) } + } + + /// 显式释放测试挂起的只读请求,不产生网络或设备操作。 + func finishReads() { + let pending = heldReads + heldReads.removeAll() + pending.forEach { $0.resume(returning: response) } + } + + /// 模拟同任务指令回执;可保持旧快照验证指令受理与设备状态的分离。 + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + commands.append((taskID, command, clientRequestID)) + let progress = progress(for: commands.count - 1, status: confirmsCommand ? "succeeded" : "pending") + if confirmsCommand { + let state = command == .resume ? "executing" : command == .returnHome ? "returning" : "paused" + response = try Self.snapshot(state: state, version: 2, pendingCommand: progress) + } + let payload: [String: Any] = ["accepted": true, "device_confirmed": confirmsCommand, + "acceptance": confirmsCommand ? "device_confirmed" : "accepted", "order_flight_task_id": taskID, + "command_id": progress["command_id"]!, "client_request_id": clientRequestID, "pending_command": progress, + "command": command.rawValue, "execution_batch": 9001, "airport_sn": "LOCAL-CONTROL-058"] + return try JSONDecoder().decode(DroneDockCommandResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } + + /// 为已提交的指令生成同一身份的后端进度,用于模拟后续完整快照。 + func progress(for index: Int, status: String) -> [String: Any] { + let request = commands[index] + return ["command_id": "local-command-\(index)", "client_request_id": request.clientRequestID, + "command": request.command.rawValue, "status": status] + } + + /// 本组测试只检查重召唤许可,不应触发真实或模拟重召唤请求。 + func resummon(taskID: Int) async throws -> DroneDockShootResponse { + XCTFail("状态展示测试不应触发重召唤") + throw APIError.networkFailed("纯内存替身未配置重召唤") + } + + /// 用明确飞控状态、批次和回巢证据创建完整快照,接口展示文案故意与本地文案不同。 + static func snapshot(state: String, version: Int, normalCompletion: Bool = false, + pendingCommand: [String: Any]? = nil, arrivalWait: Bool = false, + airborne: Bool? = true, awaitDockIdle: Bool = false) throws -> DroneDockShootingResponse { + let interrupted = !normalCompletion && ["returning", "returned"].contains(state) + let returnReason: Any = normalCompletion ? "normal_complete" : (interrupted ? "manual" as Any : NSNull()) + let pauseReason: Any = state == "paused" ? "manual" : (arrivalWait ? "arrival_wait" as Any : NSNull()) + let phase = normalCompletion ? "post_shoot_uploading" + : state == "starting" ? "going_to_spot" + : state == "paused" ? "manual_paused" + : arrivalWait ? "arrived_pending_start" + : state == "returning" ? "returning_home" + : state == "returned" ? "failed_restartable" : "shooting" + let task: [String: Any] = ["id": 501, "status": interrupted ? 40 : 20, + "order_number": "TEST-TASK-PAGE-001", "scenic_id": 128, "plane_id": 58, + "wayline_task_id": 9001, "wayline_status": normalCompletion ? 24 : interrupted ? 91 : 20, + "result_code": interrupted ? "return_home" : "", "airport_sn": "LOCAL-CONTROL-058"] + return try DroneDockShootingTaskTestData.response(changes: [ + "order_flight_task_id": 501, "execution_batch": 9001, "state_version": version, "snapshot_kind": "full", + "order_flight_task": task, "task": task, + "current_plane": ["id": 58, "sn_number": "LOCAL-CONTROL-058", "work_status": state == "returned" && !awaitDockIdle ? 1 : 2, + "online_status": 1, "battery_percent": 90, "can_fly": state == "returned" && !awaitDockIdle], + "execute_gate": ["can_execute": arrivalWait, "primary_action": arrivalWait ? "start_shoot" : "blocked"], + "restart_gate": ["can_restart": state == "returned" && !normalCompletion && !awaitDockIdle, + "code": awaitDockIdle ? "await_dock_idle" : state == "returned" ? "ok" : "await_returned", + "primary_action": state == "returned" ? "restart_shoot" : "blocked"], + "ui": ["phase": phase, + "title": "接口错误标题", "message": "接口错误文案", "commands": [ + ["command": "flighttask_pause", "label": "接口错误按钮名称"], + ["command": "flighttask_recovery", "label": "接口错误按钮名称"], + ["command": "return_home", "label": "接口错误按钮名称"]]], + "flight_control": ["state": state, "resume_phase": interrupted || normalCompletion ? "returning" : arrivalWait ? "arrived_pending_start" : "shooting", + "return_reason": returnReason, "execution_batch": 9001, + "is_airborne": ["returned", "starting"].contains(state) ? false : airborne as Any? ?? NSNull(), "pause_reason": pauseReason, + "pending_command": pendingCommand as Any? ?? NSNull(), + "drone_in_dock": ["returned", "starting"].contains(state) ? "inside" : "outside", + "can_pause": ["executing", "returning"].contains(state), "can_resume": state == "paused", + "can_return_home": !interrupted && !normalCompletion] + ]) + } +} diff --git a/suixinkanTests/DroneDockTaskCreationAPITests.swift b/suixinkanTests/DroneDockTaskCreationAPITests.swift new file mode 100644 index 0000000..3fccf09 --- /dev/null +++ b/suixinkanTests/DroneDockTaskCreationAPITests.swift @@ -0,0 +1,144 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证创建待飞任务的参数、身份与完整 data 回执,不调用任何飞控接口。 +@MainActor +final class DroneDockTaskCreationAPITests: XCTestCase { + /// 按张工合同只提交四项字段,登录 Token 沿用统一客户端。 + func testCreateSendsOnlyDocumentedBodyAndPreservesOrderSummary() async throws { + let session = MockURLSession(responses: [try envelope(payload())]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "create-task-test-token" } + let result = try await DroneDockTaskCreationAPI(client: client).createTask( + scenicID: 128, orderNumber: "TEST-TASK-001", spotID: 201, airLineID: 301) + + XCTAssertEqual(session.requests.count, 1) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "POST") + XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/multi-plane/tasks/create") + XCTAssertNil(request.url?.query) + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "create-task-test-token") + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: XCTUnwrap(request.httpBody)) as? [String: Any]) + XCTAssertEqual(Set(body.keys), ["scenic_id", "order_number", "scenic_spot_id", "air_line_id"]) + XCTAssertEqual(body["scenic_id"] as? Int, 128) + XCTAssertEqual(body["order_number"] as? String, "TEST-TASK-001") + XCTAssertEqual(body["scenic_spot_id"] as? Int, 201) + XCTAssertEqual(body["air_line_id"] as? Int, 301) + XCTAssertEqual(result.taskID, 501) + XCTAssertEqual(result.order.shotUsed, 0) + XCTAssertEqual(result.order.shotRemain, 3) + XCTAssertEqual(result.order.shootStatus, "processing") + XCTAssertTrue(result.order.canUploadFilm == true) + } + + /// 无效身份和超长订单号在发送前拒绝,不创建空参数任务。 + func testInvalidParametersNeverReachNetwork() async throws { + let session = MockURLSession(responses: []) + let api = DroneDockTaskCreationAPI(client: APIClient(environment: .testing, session: session)) + for (scenic, spot, line) in [(0, 201, 301), (-1, 201, 301), (128, 0, 301), (128, 201, -1)] { + await assertFailure { _ = try await api.createTask(scenicID: scenic, orderNumber: "TEST", spotID: spot, airLineID: line) } + } + for number in ["", " ", " TEST", "TEST ", "TEST\nORDER", String(repeating: "a", count: 129)] { + await assertFailure { _ = try await api.createTask(scenicID: 128, orderNumber: number, spotID: 201, airLineID: 301) } + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 已发送请求若返回其他订单,应报结果不一致而不是自动再次创建。 + func testMismatchedOrderIsRejectedWithoutAnotherWrite() async throws { + var value = payload() + value["order_number"] = "TEST-OTHER-ORDER" + let session = MockURLSession(responses: [try envelope(value)]) + let api = DroneDockTaskCreationAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.createTask(scenicID: 128, orderNumber: "TEST-TASK-001", spotID: 201, airLineID: 301) + XCTFail("不能接受其他订单的任务") + } catch let APIError.decodeFailed(message) { + XCTAssertTrue(message.contains("订单不一致")) + } + XCTAssertEqual(session.requests.count, 1) + } + + /// 后端业务拒绝保留业务码和原提示,便于页面区分明确失败和结果未知。 + func testBusinessFailurePreservesCodeAndMessage() async throws { + let session = MockURLSession(responses: [try TestJSON.errorEnvelope(code: 160001, msg: "拍摄次数已用完")]) + let api = DroneDockTaskCreationAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.createTask(scenicID: 128, orderNumber: "TEST-TASK-001", spotID: 201, airLineID: 301) + XCTFail("应保留业务失败") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 160001) + XCTAssertEqual(message, "拍摄次数已用完") + } + XCTAssertEqual(session.requests.count, 1) + } + + /// 超时不在接口层重试,以免无去重参数的创建请求产生第二条任务。 + func testTransportFailureIsNotAutomaticallyRetried() async throws { + let session = MockURLSession(results: [.failure(URLError(.timedOut))]) + let api = DroneDockTaskCreationAPI(client: APIClient(environment: .testing, session: session)) + await assertFailure { _ = try await api.createTask(scenicID: 128, orderNumber: "TEST-TASK-001", spotID: 201, airLineID: 301) } + XCTAssertEqual(session.requests.count, 1) + XCTAssertEqual(session.requests.first?.url?.path, "/api/yf-handset-app/photog/multi-plane/tasks/create") + } + + /// 数字字符串任务身份可使用,但展示 JSON 保留原始字符串类型。 + func testStringTaskIDRemainsAStringInDisplayedData() throws { + var value = payload() + value["task_id"] = "501" + let result = try decode(value) + XCTAssertEqual(result.taskID, 501) + let displayed = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(result.dataJSON.utf8)) as? [String: Any]) + XCTAssertEqual(displayed["task_id"] as? String, "501") + } + + /// 完整 data 的未知字段、嵌套结构、空值、布尔和小数不被 DTO 投影丢弃。 + func testDisplayedDataPreservesAllReturnedFieldsWithoutInventingEnvelope() throws { + var value = payload() + value["future"] = ["enabled": true, "optional": NSNull(), "items": ["001", false, 0, 12.5]] as [String: Any] + value["file_url"] = "https://example.invalid/样片.mp4" + let result = try decode(value) + let displayed = try XCTUnwrap(JSONSerialization.jsonObject(with: Data(result.dataJSON.utf8)) as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: displayed).isEqual(to: value)) + XCTAssertTrue(result.dataJSON.contains("\n")) + XCTAssertNil(displayed["code"]) + XCTAssertNil(displayed["msg"]) + XCTAssertNil(displayed["time"]) + } + + /// 没有有效任务 ID 不能标记为创建成功,订单身份与已用次数也需合法。 + func testInvalidTaskIdentityAndMalformedOrderSummaryAreRejected() throws { + for id: Any in [0, -1, 1.5, true, "bad", "1.5", NSNull()] { + var value = payload(); value["task_id"] = id + XCTAssertThrowsError(try decode(value)) + } + var missingID = payload(); missingID.removeValue(forKey: "task_id") + XCTAssertThrowsError(try decode(missingID)) + for changes in [["order_number": " "], ["shot_count": -1], ["can_create_task": "true"]] as [[String: Any]] { + XCTAssertThrowsError(try decode(payload().merging(changes) { _, new in new })) + } + var missingOrder = payload(); missingOrder.removeValue(forKey: "order_number") + XCTAssertThrowsError(try decode(missingOrder)) + } + + /// 创建回执夹具仅使用测试订单,不包含真实游客或设备信息。 + private func payload() -> [String: Any] { + ["task_id": 501, "order_number": "TEST-TASK-001", "project_id": 101, + "project_name": "测试三次套餐", "shoot_count": 3, "shot_count": 0, "remaining_count": 3, + "shoot_status": "processing", "order_status": 20, "can_create_task": true, + "can_upload_film": true, "confirmed_at": NSNull()] + } + + private func envelope(_ value: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": value]) + } + + private func decode(_ value: [String: Any]) throws -> DroneDockCreatedTask { + try JSONDecoder().decode(DroneDockCreatedTask.self, from: JSONSerialization.data(withJSONObject: value)) + } + + private func assertFailure(_ action: () async throws -> Void, file: StaticString = #filePath, line: UInt = #line) async { + do { try await action(); XCTFail("应拒绝无效创建请求或响应", file: file, line: line) } catch {} + } +} diff --git a/suixinkanTests/DroneDockTaskCreationTestSupport.swift b/suixinkanTests/DroneDockTaskCreationTestSupport.swift new file mode 100644 index 0000000..96968fe --- /dev/null +++ b/suixinkanTests/DroneDockTaskCreationTestSupport.swift @@ -0,0 +1,44 @@ +import Foundation +@testable import suixinkan + +/// 创建任务测试共用的匿名回执,保留原始 data 字段供页面核对。 +enum DroneDockTaskCreationTestData { + /// 返回最新订单摘要及稳定测试任务 ID,不附加模拟飞行结果。 + static func response(taskID: Int = 501, orderNumber: String = "TEST-PREPARATION-001", + projectID: Int = 101, remaining: Int = 5) throws -> DroneDockCreatedTask { + let data: [String: Any] = ["task_id": taskID, "order_number": orderNumber, "project_id": projectID, + "project_name": "测试五次套餐", "shoot_count": 5, "shot_count": 0, + "remaining_count": remaining, "shoot_status": "processing", "order_status": 20, + "can_create_task": true, "can_upload_film": true, "can_confirm": false, + "film_count": 0, "user_phone": "130****0001"] + return try JSONDecoder().decode(DroneDockCreatedTask.self, from: JSONSerialization.data(withJSONObject: data)) + } +} + +/// 可注入明确成功或业务拒绝的任务创建服务,默认不创建任何测试任务。 +@MainActor +final class DroneDockTaskCreationTestService: DroneDockTaskCreating { + /// 请求参数稳定记录,供验证一键只发送一次 POST。 + struct Request: Equatable { + let scenicID: Int + let orderNumber: String + let spotID: Int + let airLineID: Int + } + + /// 当前返回结果,允许测试模拟明确拒绝后恢复。 + var result: Result + /// 已收到的创建参数。 + private(set) var requests: [Request] = [] + + /// 默认拒绝用于未关注创建动作的既有准备页测试。 + init(result: Result? = nil) { + self.result = result ?? .failure(APIError.serverCode(160001, "测试任务创建未配置")) + } + + /// 仅记录任务创建调用,不实现召唤或其他飞行动作。 + func createTask(scenicID: Int, orderNumber: String, spotID: Int, airLineID: Int) async throws -> DroneDockCreatedTask { + requests.append(Request(scenicID: scenicID, orderNumber: orderNumber, spotID: spotID, airLineID: airLineID)) + return try result.get() + } +} diff --git a/suixinkanTests/DroneDockTaskCreationViewModelTests.swift b/suixinkanTests/DroneDockTaskCreationViewModelTests.swift new file mode 100644 index 0000000..fd59e91 --- /dev/null +++ b/suixinkanTests/DroneDockTaskCreationViewModelTests.swift @@ -0,0 +1,377 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证准备页只创建待飞任务、保留真实回执,并阻止重复提交不确定请求。 +@MainActor +final class DroneDockTaskCreationViewModelTests: XCTestCase { + /// 未报备时保留选择、不伪造任务,不调用召唤;明确业务拒绝可在处理后手动重试。 + func testFilingRejectionPreservesSelectionAndDoesNotSummon() async throws { + let fixture = try TaskCreationFixture() + fixture.creation.result = .failure(APIError.serverCode(100099, "当前航线未报备")) + await fixture.model.refresh() + fixture.model.selectSpot(id: 202) + await fixture.model.prepareAndSummon() + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.shootResponse) + XCTAssertEqual(fixture.model.selectedSpotID, 202) + XCTAssertEqual(fixture.model.creationFailure?.requiresFiling, true) + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertTrue(fixture.model.isPrimaryActionEnabled) + } + /// 单独建任务只受购买条件约束,不因无设备状态或离线而错误拦截。 + func testValidPurchaseAllowsCreationWithoutPlanePermission() async throws { + let fixture = try TaskCreationFixture() + XCTAssertFalse(fixture.model.canCreateTask) + await fixture.model.refresh() + XCTAssertTrue(fixture.model.canCreateTask) + XCTAssertNil(fixture.model.planeStatus) + fixture.planes.result = .success(try DroneDockPlaneStatusTestData.response(connected: false)) + await fixture.model.refreshPlaneStatus() + XCTAssertTrue(fixture.model.canCreateTask) + XCTAssertEqual(fixture.model.admissionMessage, "点击后创建任务并召唤无人机") + } + + /// 创建前重读购买配置,提交当前点位航线;任务成功不自行扣减拍摄次数。 + func testCreationUsesSelectedIDsAndKeepsReturnedJSON() async throws { + let fixture = try TaskCreationFixture() + await fixture.model.refresh() + fixture.model.selectSpot(id: 202) + fixture.model.selectRoute(id: 402) + var states: [Bool] = [] + await fixture.model.createTask { states.append(fixture.model.isCreatingTask) } + XCTAssertEqual(states, [true, false]) + XCTAssertEqual(fixture.projects.requests.count, 2) + XCTAssertEqual(fixture.creation.requests, [.init(scenicID: 128, orderNumber: "TEST-PREPARATION-001", spotID: 202, airLineID: 402)]) + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertEqual(fixture.model.latestOrderSummary?.shotUsed, 0) + XCTAssertEqual(fixture.model.latestOrderSummary?.shotRemain, 5) + XCTAssertEqual(fixture.model.primaryButtonTitle, "确认并召唤") + XCTAssertTrue(fixture.model.admissionMessage.contains("等待召唤")) + let json = try XCTUnwrap(fixture.model.creationDataJSON?.data(using: .utf8)) + let object = try XCTUnwrap(JSONSerialization.jsonObject(with: json) as? [String: Any]) + XCTAssertEqual(object["task_id"] as? Int, 501) + XCTAssertEqual(object["remaining_count"] as? Int, 5) + XCTAssertNil(object["code"], "展示 data 原文,不伪造外层响应") + XCTAssertFalse(fixture.model.canCreateTask) + await fixture.model.createTask() + XCTAssertEqual(fixture.creation.requests.count, 1) + } + + /// 无额度、无权限、点位或航线不可用均在本地阻止提交。 + func testInvalidPurchaseConditionsNeverCreateTask() async throws { + for payload in [ + try TaskCreationFixtureData.project(remaining: 0), + try TaskCreationFixtureData.project(remaining: nil), + try TaskCreationFixtureData.project(total: 0), + try TaskCreationFixtureData.project(total: nil), + try TaskCreationFixtureData.project(canCreate: false), + try TaskCreationFixtureData.project(spots: []), + try TaskCreationFixtureData.project(spots: [TaskCreationFixtureData.point(201, available: false)]), + try TaskCreationFixtureData.project(spots: [TaskCreationFixtureData.point(201, routes: [], available: true)]) + ] { + let fixture = try TaskCreationFixture() + fixture.projects.result = .success(payload) + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canCreateTask) + await fixture.model.createTask() + XCTAssertTrue(fixture.creation.requests.isEmpty) + } + } + + /// 点选后权限发生变化,预检响应能阻止旧按钮状态触发 POST。 + func testPreflightRejectsChangedPurchasePermission() async throws { + let fixture = try TaskCreationFixture() + await fixture.model.refresh() + fixture.projects.result = .success(try TaskCreationFixtureData.project(remaining: 0, canCreate: false)) + await fixture.model.createTask() + XCTAssertTrue(fixture.creation.requests.isEmpty) + XCTAssertEqual(fixture.model.projectInfo?.order.shotRemain, 0) + XCTAssertNotNil(fixture.model.taskCreationErrorMessage) + XCTAssertFalse(fixture.model.canCreateTask) + } + + /// 原航线失效时要求重新选择,不将旧点击默默发给另一航线。 + func testPreflightDoesNotSubstituteAnotherRoute() async throws { + let fixture = try TaskCreationFixture() + await fixture.model.refresh() + fixture.model.selectRoute(id: 302) + fixture.projects.result = .success(try TaskCreationFixtureData.project(spots: [TaskCreationFixtureData.point(201, routes: [301])])) + await fixture.model.createTask() + XCTAssertTrue(fixture.creation.requests.isEmpty) + XCTAssertEqual(fixture.model.selectedRouteID, 301) + XCTAssertTrue(fixture.model.taskCreationErrorMessage?.contains("重新选择") == true) + } + + /// 提交中重复点击、选择及购买刷新均不产生第二次创建或改变归属。 + func testPendingCreateLocksSelectionAndDuplicateClicks() async throws { + let service = SuspendedTaskCreationService() + let fixture = try TaskCreationFixture(creationService: service) + let started = expectation(description: "创建已发出") + service.started = { started.fulfill() } + defer { service.cancelAll() } + await fixture.model.refresh() + let pending = Task { await fixture.model.createTask() } + await fulfillment(of: [started], timeout: 2) + XCTAssertTrue(fixture.model.isCreatingTask) + XCTAssertTrue(fixture.model.isTaskSelectionLocked) + XCTAssertFalse(fixture.model.canCreateTask) + await fixture.model.createTask() + await fixture.model.refresh() + fixture.model.selectSpot(id: 202) + fixture.model.selectRoute(id: 302) + XCTAssertEqual(fixture.model.selectedSpotID, 201) + XCTAssertEqual(fixture.model.selectedRouteID, 301) + XCTAssertEqual(fixture.projects.requests.count, 2) + XCTAssertEqual(service.requests.count, 1) + try service.finish() + await pending.value + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + } + + /// 明确业务拒绝可由用户再次点击重试,错误文案保留后端语义。 + func testBusinessRejectionAllowsExplicitRetry() async throws { + let fixture = try TaskCreationFixture() + fixture.creation.result = .failure(APIError.serverCode(160001, "测试航线临时不可用")) + await fixture.model.refresh() + await fixture.model.createTask() + XCTAssertEqual(fixture.model.taskCreationErrorMessage, "测试航线临时不可用") + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertTrue(fixture.model.canCreateTask) + fixture.creation.result = .success(try DroneDockTaskCreationTestData.response()) + await fixture.model.createTask() + XCTAssertEqual(fixture.creation.requests.count, 2) + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + } + + /// 网络、HTTP、解码或空数据无法确定是否已创建,刷新也不能解锁重复 POST。 + func testAmbiguousPostFailureRemainsLockedAfterRefresh() async throws { + let errors: [Error] = [APIError.networkFailed("测试超时"), APIError.httpStatus(500, "测试异常"), + APIError.decodeFailed("测试响应无效"), APIError.emptyData] + for error in errors { + let fixture = try TaskCreationFixture() + fixture.creation.result = .failure(error) + await fixture.model.refresh() + await fixture.model.createTask() + XCTAssertTrue(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.canCreateTask) + XCTAssertNil(fixture.model.createdTask) + XCTAssertEqual(fixture.model.primaryButtonTitle, "结果待核对") + await fixture.model.refresh() + fixture.model.selectSpot(id: 202) + await fixture.model.createTask() + XCTAssertFalse(fixture.model.canCreateTask) + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertEqual(fixture.model.selectedSpotID, 201) + } + } + + /// 仅购买预检失败时尚未发出写入,可恢复后重新提交。 + func testPreflightNetworkFailureDoesNotMarkOutcomeUnknown() async throws { + let fixture = try TaskCreationFixture() + await fixture.model.refresh() + fixture.projects.result = .failure(APIError.networkFailed("测试购买读取失败")) + await fixture.model.createTask() + XCTAssertTrue(fixture.creation.requests.isEmpty) + XCTAssertFalse(fixture.model.taskCreationOutcomeUnknown) + XCTAssertTrue(fixture.model.canCreateTask) + fixture.projects.result = .success(try TaskCreationFixtureData.project()) + await fixture.model.createTask() + XCTAssertEqual(fixture.creation.requests.count, 1) + XCTAssertNotNil(fixture.model.createdTask) + } + + /// POST 发出后取消或离开,迟到回执不覆盖页面,结果按待核对处理。 + func testCancellationOrInvalidationAfterPostPreservesUnknownLock() async throws { + for invalidate in [false, true] { + let service = SuspendedTaskCreationService() + let fixture = try TaskCreationFixture(creationService: service) + let started = expectation(description: "待取消创建") + service.started = { started.fulfill() } + defer { service.cancelAll() } + await fixture.model.refresh() + let pending = Task { await fixture.model.createTask() } + await fulfillment(of: [started], timeout: 2) + if invalidate { fixture.model.invalidate() } else { pending.cancel() } + try service.finish() + await pending.value + XCTAssertTrue(fixture.model.taskCreationOutcomeUnknown) + XCTAssertNil(fixture.model.createdTask) + XCTAssertFalse(fixture.model.isCreatingTask) + await fixture.model.refresh() + await fixture.model.createTask() + XCTAssertEqual(service.requests.count, 1) + } + } + + /// 创建响应属于其他订单或项目时锁定未知结果,不能宣告成功或自动补建。 + func testMismatchedReceiptRequiresReconciliation() async throws { + for response in [try DroneDockTaskCreationTestData.response(orderNumber: "TEST-OTHER"), + try DroneDockTaskCreationTestData.response(projectID: 202)] { + let fixture = try TaskCreationFixture() + fixture.creation.result = .success(response) + await fixture.model.refresh() + await fixture.model.createTask() + XCTAssertNil(fixture.model.createdTask) + XCTAssertTrue(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.canCreateTask) + } + } + + /// 创建期间切换景区,迟到响应不显示,旧实例不可恢复创建入口。 + func testContextChangeDuringCreateRejectsReceipt() async throws { + let service = SuspendedTaskCreationService() + let fixture = try TaskCreationFixture(creationService: service) + let started = expectation(description: "创建身份切换") + service.started = { started.fulfill() } + defer { service.cancelAll() } + await fixture.model.refresh() + let pending = Task { await fixture.model.createTask() } + await fulfillment(of: [started], timeout: 2) + fixture.scope.value = TaskCreationFixtureData.context(scenicID: 129) + try service.finish() + await pending.value + XCTAssertNil(fixture.model.createdTask) + XCTAssertNil(fixture.model.projectInfo) + XCTAssertTrue(fixture.model.taskCreationOutcomeUnknown) + XCTAssertFalse(fixture.model.canCreateTask) + fixture.scope.value = TaskCreationFixtureData.context() + await fixture.model.refresh() + XCTAssertFalse(fixture.model.canCreateTask) + } + + /// 成功或结果未知后,刷新及同实例离开返回不得把已提交选择改到另一点位。 + func testSubmittedSelectionDoesNotMoveWhenPurchaseRefreshes() async throws { + for unknown in [false, true] { + let fixture = try TaskCreationFixture() + if unknown { fixture.creation.result = .failure(APIError.networkFailed("测试超时")) } + await fixture.model.refresh() + fixture.model.selectSpot(id: 202) + fixture.model.selectRoute(id: 402) + await fixture.model.createTask() + fixture.model.invalidate() + await fixture.model.refresh() + XCTAssertEqual(fixture.model.selectedSpotID, 202) + XCTAssertEqual(fixture.model.selectedRouteID, 402) + fixture.projects.result = .success(try TaskCreationFixtureData.project(spots: [TaskCreationFixtureData.point(201)])) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.selectedSpotID, 202) + XCTAssertEqual(fixture.model.selectedRouteID, 402) + XCTAssertNil(fixture.model.selectedSpot, "已提交点位被移除时不错误展示另一个点位") + XCTAssertFalse(fixture.model.canCreateTask) + XCTAssertEqual(fixture.creation.requests.count, 1) + } + } + + /// 普通刷新、设备暂停和同实例离开返回,都保留成功回执与防重复创建锁。 + func testSuccessfulReceiptSurvivesRefreshAndPageInvalidation() async throws { + let fixture = try TaskCreationFixture() + await fixture.model.refresh() + await fixture.model.createTask() + fixture.model.invalidatePlaneStatus() + await fixture.model.refresh() + fixture.model.selectSpot(id: 202) + XCTAssertEqual(fixture.model.selectedSpotID, 201) + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + fixture.model.invalidate() + await fixture.model.refresh() + XCTAssertEqual(fixture.model.createdTask?.taskID, 501) + XCTAssertFalse(fixture.model.canCreateTask) + await fixture.model.createTask() + XCTAssertEqual(fixture.creation.requests.count, 1) + } +} + +/// 每例独立构造购买、设备、创建服务与会话;无真实账号和网络。 +@MainActor +private final class TaskCreationFixture { + let projects: TaskCreationProjectService + let planes: DroneDockPlaneStatusTestService + let creation: DroneDockTaskCreationTestService + let scope: TaskCreationContextBox + let model: DroneDockPreparationViewModel + + init(creationService: (any DroneDockTaskCreating)? = nil) throws { + projects = try TaskCreationProjectService() + planes = try DroneDockPlaneStatusTestService() + creation = DroneDockTaskCreationTestService(result: .success(try DroneDockTaskCreationTestData.response())) + scope = TaskCreationContextBox(TaskCreationFixtureData.context()) + let currentScope = scope + let order = try JSONDecoder().decode(DroneDockHomeOrder.self, from: Data(#"{"order_number":"TEST-PREPARATION-001","project_id":101}"#.utf8)) + model = DroneDockPreparationViewModel(context: scope.value, order: order, service: projects, + planeStatusService: planes, taskCreationService: creationService ?? creation, + shootService: DroneDockShootTestService(), + currentContext: { currentScope.value }) + } +} + +/// 创建前购买配置夹具,仅包含任务所需的有效点位与航线。 +private enum TaskCreationFixtureData { + static func context(scenicID: Int = 128) -> DroneDockHomeContext { + DroneDockHomeContext(userID: "task-creation-test-user", accountType: "store_user", scenicID: scenicID, + scenicName: "测试景区", storeID: 37, photographerName: "测试工作人员", token: "task-creation-test-token") + } + + static func project(remaining: Int? = 5, total: Int? = 5, canCreate: Bool = true, + spots: [[String: Any]]? = nil) throws -> DroneDockProjectInfoResponse { + var data: [String: Any] = ["order_number": "TEST-PREPARATION-001", "project_id": 101, + "shot_count": 0, "can_create_task": canCreate, + "spot": spots ?? [point(201), point(202, routes: [401, 402])]] + data["remaining_count"] = remaining + data["shoot_count"] = total + return try JSONDecoder().decode(DroneDockProjectInfoResponse.self, from: JSONSerialization.data(withJSONObject: data)) + } + + static func point(_ id: Int, routes: [Int] = [301, 302], available: Bool = true) -> [String: Any] { + ["scenic_spot_id": id, "scenic_spot_name": "测试点位 \(id)", "available": available, + "air_lines": routes.map { ["air_line_id": $0, "air_line_name": "测试航线 \($0)", "available": true, "samples": []] as [String: Any] }] + } +} + +/// 可更换结果的购买预检替身,记录读取次数以防自动重建。 +@MainActor +private final class TaskCreationProjectService: DroneDockPreparationServing { + var result: Result + private(set) var requests: [String] = [] + + init() throws { result = .success(try TaskCreationFixtureData.project()) } + func projectInfo(scenicID: Int, projectID: Int, orderNumber: String) async throws -> DroneDockProjectInfoResponse { + requests.append(orderNumber) + return try result.get() + } +} + +/// 主线程切换身份,避免可发送闭包捕获可变局部变量。 +@MainActor +private final class TaskCreationContextBox { + var value: DroneDockHomeContext + init(_ value: DroneDockHomeContext) { self.value = value } +} + +/// 挂起单次创建请求,精确验证重复点击、取消和会话变更。 +@MainActor +private final class SuspendedTaskCreationService: DroneDockTaskCreating { + var started: (() -> Void)? + private(set) var requests: [Int] = [] + private var continuation: CheckedContinuation? + + func createTask(scenicID: Int, orderNumber: String, spotID: Int, airLineID: Int) async throws -> DroneDockCreatedTask { + requests.append(spotID) + return try await withCheckedThrowingContinuation { continuation in + self.continuation = continuation + started?() + } + } + + func finish() throws { + let response = try DroneDockTaskCreationTestData.response() + let pending = continuation + continuation = nil + pending?.resume(returning: response) + } + + func cancelAll() { + continuation?.resume(throwing: CancellationError()) + continuation = nil + } +} diff --git a/suixinkanTests/DroneDockTaskDiagnosticsTests.swift b/suixinkanTests/DroneDockTaskDiagnosticsTests.swift new file mode 100644 index 0000000..bed48b5 --- /dev/null +++ b/suixinkanTests/DroneDockTaskDiagnosticsTests.swift @@ -0,0 +1,196 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证任务关键日志的身份、时间、串行顺序及完整输出,不访问真实网络或控制台。 +final class DroneDockTaskDiagnosticsTests: XCTestCase { + func testMessagePreservesNativeFieldsAndProtectsCorrelationMetadata() throws { + let fields: [String: Any] = [ + "diagnostic": "forged", "event": "forged", "timestamp": "forged", "timezone": "UTC", + "elapsed_ms": -99, "sequence": 99, "session_id": "forged", "task_id": 999, + "app_version": "forged", "app_build": "forged", "configuration": "forged", + "can_pause": true, "batch": 2418, "pending": NSNull(), + "state": ["phase": "arrived_pending_start", "values": [0, 1, 2]] + ] + let text = DroneDockTaskDiagnostics.makeMessage("snapshot.applied", taskID: 8, fields: fields, + sessionID: "SESSION-1", sequence: 2, timestamp: Date(timeIntervalSince1970: 0.125), + elapsedMilliseconds: 1500, + metadata: .init(appVersion: "9.9.1", appBuild: "42", configuration: "Release")) + let value = try object(text) + XCTAssertEqual(value["diagnostic"] as? String, "drone_task") + XCTAssertEqual(value["event"] as? String, "snapshot.applied") + XCTAssertEqual(value["timestamp"] as? String, "1970-01-01T08:00:00.125+08:00") + XCTAssertEqual(value["timezone"] as? String, "Asia/Shanghai") + XCTAssertEqual(value["elapsed_ms"] as? Int, 1500) + XCTAssertEqual(value["sequence"] as? Int, 2) + XCTAssertEqual(value["session_id"] as? String, "SESSION-1") + XCTAssertEqual(value["task_id"] as? Int, 8) + XCTAssertEqual(value["app_version"] as? String, "9.9.1") + XCTAssertEqual(value["app_build"] as? String, "42") + XCTAssertEqual(value["configuration"] as? String, "Release") + XCTAssertEqual(value["can_pause"] as? Bool, true) + XCTAssertEqual(value["batch"] as? Int, 2418) + XCTAssertTrue(value["pending"] is NSNull) + let state = try XCTUnwrap(value["state"] as? [String: Any]) + XCTAssertEqual(state["phase"] as? String, "arrived_pending_start") + XCTAssertEqual(state["values"] as? [Int], [0, 1, 2]) + } + + func testMonotonicElapsedAndSequenceSurviveWallClockMovingBackwards() throws { + let clock = TaskDiagnosticClock(date: Date(timeIntervalSince1970: 100), uptime: 10) + let output = TaskDiagnosticOutput() + let diagnostics = DroneDockTaskDiagnostics(sessionID: "ONE-SESSION", + now: { clock.date }, uptime: { clock.uptime }, sink: { output.append($0) }) + clock.set(date: Date(timeIntervalSince1970: 101), uptime: 11.25) + diagnostics.record("page.visible", taskID: 8) + clock.set(date: Date(timeIntervalSince1970: 90), uptime: 12.5) + diagnostics.record("snapshot.applied", taskID: 8) + + let records = try output.messages.map(object) + XCTAssertEqual(records.count, 2) + XCTAssertEqual(records.compactMap { $0["sequence"] as? Int }, [1, 2]) + XCTAssertEqual(records.compactMap { $0["elapsed_ms"] as? Int }, [1250, 2500]) + XCTAssertEqual(records.compactMap { $0["session_id"] as? String }, ["ONE-SESSION", "ONE-SESSION"]) + XCTAssertEqual(records[0]["timestamp"] as? String, "1970-01-01T08:01:41.000+08:00") + XCTAssertEqual(records[1]["timestamp"] as? String, "1970-01-01T08:01:30.000+08:00") + } + + func testSeparateInstancesUseSeparateSessionsAndRestartSequence() throws { + let firstOutput = TaskDiagnosticOutput() + let secondOutput = TaskDiagnosticOutput() + let first = DroneDockTaskDiagnostics(sink: { firstOutput.append($0) }) + let second = DroneDockTaskDiagnostics(sink: { secondOutput.append($0) }) + first.record("page.visible", taskID: 8) + first.record("page.hidden", taskID: 8) + second.record("page.visible", taskID: 8) + + XCTAssertNotEqual(first.sessionID, second.sessionID) + XCTAssertNotNil(UUID(uuidString: first.sessionID)) + XCTAssertNotNil(UUID(uuidString: second.sessionID)) + XCTAssertEqual(try firstOutput.messages.map(object).compactMap { $0["sequence"] as? Int }, [1, 2]) + let secondRecord = try object(XCTUnwrap(secondOutput.messages.first)) + XCTAssertEqual(secondRecord["sequence"] as? Int, 1) + XCTAssertEqual(secondRecord["session_id"] as? String, second.sessionID) + } + + func testConcurrentRecordsReachSinkInOneCompleteSequence() throws { + let output = TaskDiagnosticOutput() + let diagnostics = DroneDockTaskDiagnostics(sink: { output.append($0) }) + DispatchQueue.concurrentPerform(iterations: 60) { index in + diagnostics.record("callback.received", taskID: 8, fields: ["callback_index": index]) + } + + let records = try output.messages.map(object) + XCTAssertEqual(records.count, 60) + XCTAssertEqual(records.compactMap { $0["sequence"] as? Int }, Array(1...60)) + XCTAssertEqual(Set(records.compactMap { $0["callback_index"] as? Int }), Set(0..<60)) + XCTAssertEqual(Set(records.compactMap { $0["session_id"] as? String }), [diagnostics.sessionID]) + } + + func testDebugAndReleaseMetadataBothProduceRenderableEvents() throws { + for configuration in ["Debug", "Release"] { + let output = TaskDiagnosticOutput() + let diagnostics = DroneDockTaskDiagnostics( + metadata: .init(appVersion: "9.9.1", appBuild: "42", configuration: configuration), + sink: { output.append($0) }) + diagnostics.record("command.result", taskID: 8, fields: ["accepted": true]) + + let raw = try XCTUnwrap(output.messages.first) + let rendered = try XCTUnwrap(APIConsoleFormat.render(raw)) + let value = try object(rendered) + XCTAssertEqual(output.messages.count, 1) + XCTAssertEqual(value["configuration"] as? String, configuration) + XCTAssertEqual(value["accepted"] as? Bool, true) + XCTAssertEqual(value["event"] as? String, "command.result") + } + } + + func testCurrentMetadataReportsActualBuildConfiguration() { + let metadata = DroneDockTaskDiagnosticMetadata.current + #if DEBUG + XCTAssertEqual(metadata.configuration, "Debug") + #else + XCTAssertEqual(metadata.configuration, "Release") + #endif + XCTAssertEqual(metadata.appVersion, + Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "unknown") + XCTAssertEqual(metadata.appBuild, + Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "unknown") + } + + func testLongEventReachesExistingSafeWriterWithoutTruncation() throws { + let output = TaskDiagnosticOutput() + let fallback = TaskDiagnosticOutput() + let writer = APIConsoleOutputWriter(writeStandardOutput: { data in + output.append(String(decoding: data, as: UTF8.self)) + }) + let diagnostics = DroneDockTaskDiagnostics(sink: { raw in + guard let rendered = APIConsoleFormat.render(raw) else { return } + writer.write(rendered, prefersStandardOutput: true) { fallback.append($0) } + }) + let detail = String(repeating: "暂停与返航状态😀\n", count: 1500) + "END-OF-EVENT" + diagnostics.record("snapshot.rejected", taskID: 8, fields: ["detail": detail, "values": [1, 2, 3]]) + + XCTAssertEqual(output.messages.count, 1) + XCTAssertTrue(fallback.messages.isEmpty) + let text = try XCTUnwrap(output.messages.first) + XCTAssertTrue(text.hasSuffix("\n")) + let value = try object(text) + XCTAssertEqual(value["detail"] as? String, detail) + XCTAssertEqual(value["values"] as? [Int], [1, 2, 3]) + XCTAssertEqual(value["diagnostic"] as? String, "drone_task") + } + + private func object(_ text: String) throws -> [String: Any] { + try XCTUnwrap(JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String: Any]) + } +} + +/// 线程安全的内存日志出口,用于观察并发记录的实际到达顺序。 +private final class TaskDiagnosticOutput: @unchecked Sendable { + private let lock = NSLock() + private var storage: [String] = [] + + var messages: [String] { + lock.lock() + defer { lock.unlock() } + return storage + } + + func append(_ message: String) { + lock.lock() + defer { lock.unlock() } + storage.append(message) + } +} + +/// 分离墙钟与单调时钟,模拟用户校时而不改变会话经过时长。 +private final class TaskDiagnosticClock: @unchecked Sendable { + private let lock = NSLock() + private var storedDate: Date + private var storedUptime: TimeInterval + + init(date: Date, uptime: TimeInterval) { + storedDate = date + storedUptime = uptime + } + + var date: Date { + lock.lock() + defer { lock.unlock() } + return storedDate + } + + var uptime: TimeInterval { + lock.lock() + defer { lock.unlock() } + return storedUptime + } + + func set(date: Date, uptime: TimeInterval) { + lock.lock() + defer { lock.unlock() } + storedDate = date + storedUptime = uptime + } +} diff --git a/suixinkanTests/DroneDockTaskFixedLayoutTests.swift b/suixinkanTests/DroneDockTaskFixedLayoutTests.swift new file mode 100644 index 0000000..d768a70 --- /dev/null +++ b/suixinkanTests/DroneDockTaskFixedLayoutTests.swift @@ -0,0 +1,704 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证真实任务页三区固定,中间状态在有限高度内保持可读、可点击且不产生滚动。 +@MainActor +final class DroneDockTaskFixedLayoutTests: XCTestCase { + private let compactSize = CGSize(width: 375, height: 146) + private let regularSize = CGSize(width: 402, height: 220) + private let phases: [DroneDockTaskDisplayPhase] = [ + .loading, .navigating, .ready, .shooting, .postShootUploading, .postShootUploadFailed, .paused, .returning, + .returned, .completed, .failed, .blocked, .unknown, .readError + ] + + /// 紧凑屏逐一显示全部业务阶段,控件始终留在固定中间区域内。 + func testAllPhasesFitCompactStatusArea() throws { + let status = makeStatus(size: compactSize) + for phase in phases { + apply(presentation(phase), to: status) + XCTAssertTrue(status.usesCompactLayout, "\(phase)") + XCTAssertEqual(status.bounds.size, compactSize) + try assertReadableContainedContent(in: status) + } + } + + /// 常规屏支持全部阶段,失败态用独立原因区替代通用设备摘要。 + func testAllPhasesFitRegularStatusArea() throws { + let status = makeStatus(size: regularSize) + for phase in phases { + apply(presentation(phase), to: status) + XCTAssertFalse(status.usesCompactLayout, "\(phase)") + XCTAssertEqual(status.bounds.size, regularSize) + let device = try XCTUnwrap(find(in: status, suffix: "deviceStatus") as? UILabel) + if phase == .failed { + XCTAssertTrue(isHidden(device)) + let note = try XCTUnwrap(find(in: status, suffix: "failureNote") as? UILabel) + XCTAssertFalse(isHidden(note)) + XCTAssertEqual(note.text, "无人机离线,暂不可召唤") + } else if [.ready, .shooting, .postShootUploading, .completed, .paused, .returning, .returned].contains(phase) { + XCTAssertTrue(isHidden(device)) + } else { + XCTAssertFalse(isHidden(device)) + XCTAssertEqual(device.text, "空闲 · 电量 93%") + } + try assertReadableContainedContent(in: status) + } + } + + /// 任一阶段的超长后端文案不会挤出容器、压缩点击区域或依赖整体 transform。 + func testLongCopyAcrossAllPhasesKeepsControlsReadableAndContained() throws { + for size in [compactSize, regularSize] { + let status = makeStatus(size: size) + for phase in phases { + let value = presentation(phase, longCopy: true) + apply(value, to: status) + XCTAssertEqual(status.bounds.size, size) + XCTAssertEqual(status.transform, .identity) + let title = try XCTUnwrap(find(in: status, suffix: phase == .failed ? "failureTitle" : "statusTitle") as? UILabel) + let message = try XCTUnwrap(find(in: status, suffix: phase == .failed ? "failureReason" : "statusMessage") as? UILabel) + XCTAssertFalse(isHidden(title)) + XCTAssertFalse(isHidden(message)) + XCTAssertEqual(title.text, value.title, "视觉截断不能丢弃原始详情") + XCTAssertEqual(message.text, phase == .failed ? "失败原因:\(value.message)" : value.message) + try assertReadableContainedContent(in: status) + } + } + } + + /// 移除通用详情后,长错误保留完整文本与可点击的整行刷新入口。 + func testCompactLongErrorHasNoDetailsAndKeepsFullWidthRefresh() throws { + let status = makeStatus(size: compactSize) + let value = presentation(.readError, longCopy: true) + apply(value, to: status) + var actionCalls = 0 + var detailsCalls = 0 + status.onPrimaryAction = { actionCalls += 1 } + status.onDetails = { detailsCalls += 1 } + XCTAssertNil(find(in: status, suffix: "details")) + XCTAssertEqual((find(in: status, suffix: "statusMessage") as? UILabel)?.text, value.message) + let refresh = try XCTUnwrap(find(in: status, suffix: "refresh") as? UIButton) + XCTAssertTrue(refresh.isEnabled) + XCTAssertFalse(isHidden(refresh)) + XCTAssertGreaterThanOrEqual(refresh.bounds.height, 44) + XCTAssertEqual(refresh.bounds.width, compactSize.width - 32, accuracy: 0.5) + let center = refresh.convert(CGPoint(x: refresh.bounds.midX, y: refresh.bounds.midY), to: status) + let hit = status.hitTest(center, with: nil) + XCTAssertTrue(hit === refresh || hit?.isDescendant(of: refresh) == true) + refresh.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 1) + XCTAssertEqual(detailsCalls, 0) + try assertReadableContainedContent(in: status) + } + + /// 拍摄中按原型显示左侧视频状态、右侧两行说明与整行禁用指示,不提供详情或刷新动作。 + func testShootingPanelMatchesPrototypeAndCannotTriggerActions() async throws { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + let host = UIViewController() + window.rootViewController = host + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + for size in [compactSize, regularSize, CGSize(width: 375, height: 95)] { + let status = makeStatus(size: size) + host.view.addSubview(status) + defer { status.removeFromSuperview() } + var actionCalls = 0 + var detailsCalls = 0 + status.onPrimaryAction = { actionCalls += 1 } + status.onDetails = { detailsCalls += 1 } + apply(presentation(.shooting), to: status) + window.layoutIfNeeded() + try await Task.sleep(for: .milliseconds(50)) + layoutHierarchy(status) + let shooting = try XCTUnwrap(find(in: status, suffix: "shooting")) + let title = try XCTUnwrap(find(in: status, suffix: "statusTitle") as? UILabel) + let message = try XCTUnwrap(find(in: status, suffix: "statusMessage") as? UILabel) + let indicator = try XCTUnwrap(find(in: status, suffix: "shootingIndicator") as? UIButton) + XCTAssertFalse(isHidden(shooting)) + XCTAssertEqual(title.text, "无人机正在拍摄中") + XCTAssertEqual(message.text, "请关注现场及实时画面。\n请勿关闭本页或息屏。") + if size.height >= 120 { + XCTAssertFalse(isHidden(message)) + XCTAssertEqual(title.convert(title.bounds, to: status).minX, message.convert(message.bounds, to: status).minX, accuracy: 0.5) + } + XCTAssertFalse(indicator.isEnabled) + XCTAssertEqual(indicator.configuration?.title, "拍摄中") + XCTAssertNotNil(indicator.configuration?.image) + XCTAssertEqual(indicator.configuration?.background.backgroundColor, UIColor(hex: 0xD7E7FF)) + XCTAssertEqual(indicator.configuration?.baseForegroundColor, UIColor(hex: 0x4D91FF)) + XCTAssertEqual(indicator.bounds.width, size.width - 36, accuracy: 0.5) + XCTAssertGreaterThanOrEqual(indicator.bounds.height, 44) + XCTAssertTrue(isHidden(try XCTUnwrap(find(in: status, suffix: "deviceStatus")))) + XCTAssertNil(find(in: status, suffix: "details")) + if let refresh = find(in: status, suffix: "refresh") { XCTAssertTrue(isHidden(refresh)) } + indicator.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 0) + XCTAssertEqual(detailsCalls, 0) + try assertReadableContainedContent(in: status) + if size.height >= 120 { capture(status, name: "拍摄中-原型布局-\(Int(size.width))x\(Int(size.height))") } + } + } + + /// 到达面板采用蓝色圆勾与三级文案,保留完整秒数、整行按钮和实际可点击区域。 + func testReadyPanelMatchesPrototypeAndKeepsCountdownActionTappable() async throws { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + let host = UIViewController() + window.rootViewController = host + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + for size in [CGSize(width: 320, height: 146), compactSize, regularSize] { + let status = makeStatus(size: size) + host.view.addSubview(status) + defer { status.removeFromSuperview() } + let ready = DroneDockTaskPresentation(phase: .ready, title: "无人机已到达", + message: "确认游客站位与取景后开始", deviceStatus: "设备摘要不应显示", action: .start, + actionTitle: "开始拍摄", isActionEnabled: true, countdownSeconds: 30) + apply(ready, to: status) + window.layoutIfNeeded() + try await Task.sleep(for: .milliseconds(50)) + layoutHierarchy(status) + let title = try XCTUnwrap(find(in: status, suffix: "statusTitle") as? UILabel) + let prompt = try XCTUnwrap(find(in: status, suffix: "readyPrompt") as? UILabel) + let message = try XCTUnwrap(find(in: status, suffix: "statusMessage") as? UILabel) + let icon = try XCTUnwrap(find(in: status, suffix: "readyIcon")) + let button = try XCTUnwrap(find(in: status, suffix: "primary") as? UIButton) + XCTAssertEqual(title.text, "无人机已到达") + XCTAssertEqual(prompt.text, "是否开始拍摄?") + XCTAssertEqual(message.text, "确认游客站位与取景后开始") + XCTAssertFalse(isHidden(prompt)) + XCTAssertFalse(isHidden(message)) + XCTAssertEqual(icon.backgroundColor, UIColor(hex: 0xE2EDFF)) + XCTAssertEqual((icon.subviews.first as? UIImageView)?.tintColor, UIColor(hex: 0x0671FF)) + XCTAssertEqual(title.convert(title.bounds, to: status).minY, icon.convert(icon.bounds, to: status).minY, accuracy: 0.5) + XCTAssertEqual(title.convert(title.bounds, to: status).minX, prompt.convert(prompt.bounds, to: status).minX, accuracy: 0.5) + XCTAssertEqual(title.convert(title.bounds, to: status).minX, message.convert(message.bounds, to: status).minX, accuracy: 0.5) + XCTAssertGreaterThan(prompt.convert(prompt.bounds, to: status).minY, title.convert(title.bounds, to: status).maxY) + XCTAssertGreaterThan(message.convert(message.bounds, to: status).minY, prompt.convert(prompt.bounds, to: status).maxY) + XCTAssertTrue(isHidden(try XCTUnwrap(find(in: status, suffix: "deviceStatus")))) + XCTAssertEqual(button.bounds.width, size.width - 36, accuracy: 0.5) + XCTAssertNotNil(button.configuration?.image) + var calls = 0 + status.onPrimaryAction = { calls += 1 } + let initialFrame = button.convert(button.bounds, to: status) + for (index, seconds) in [30, 29, 0].enumerated() { + status.updateCountdown(seconds: seconds) + window.layoutIfNeeded() + try await Task.sleep(for: .milliseconds(50)) + layoutHierarchy(status) + try assertFullButtonTitle("开始拍摄(\(seconds)s)", button: button) + let text = try XCTUnwrap(button.titleLabel) + let image = try XCTUnwrap(button.imageView) + XCTAssertFalse(image.bounds.isEmpty) + assertContained(text, in: button) + assertContained(image, in: button) + let contentFrame = text.convert(text.bounds, to: button).union(image.convert(image.bounds, to: button)) + XCTAssertEqual(contentFrame.midX, button.bounds.midX, accuracy: 1, "开拍图标与文字整体水平居中") + XCTAssertEqual(contentFrame.midY, button.bounds.midY, accuracy: 2, "开拍图标与文字整体垂直居中") + XCTAssertTrue(button.isEnabled) + XCTAssertEqual(button.convert(button.bounds, to: status), initialFrame) + let center = button.convert(CGPoint(x: button.bounds.midX, y: button.bounds.midY), to: status) + let hit = status.hitTest(center, with: nil) + XCTAssertTrue(hit === button || hit?.isDescendant(of: button) == true) + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, index + 1) + } + try assertReadableContainedContent(in: status) + capture(status, name: "已到达-蓝色圆勾三级文案-\(Int(size.width))x\(Int(size.height))") + + status.apply(ready, isPrimaryActionLoading: true) + layoutHierarchy(status) + let spinner = try XCTUnwrap(find(in: status, suffix: "primary.loading") as? UIActivityIndicatorView) + XCTAssertTrue(spinner.isAnimating) + XCTAssertFalse(button.isEnabled) + XCTAssertEqual(title.text, "无人机已到达") + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, 3) + status.updateCountdown(seconds: 0) + XCTAssertFalse(button.isEnabled, "倒计时不能覆盖提交中的操作保护") + status.apply(ready) + layoutHierarchy(status) + XCTAssertFalse(spinner.isAnimating) + XCTAssertTrue(button.isEnabled) + } + } + + /// 开拍结果待核对时继续显示原始说明和刷新动作,不误显示可开拍的倒计时。 + func testReadyPanelPreservesOutcomeMessageAndRefreshAction() throws { + let status = makeStatus(size: regularSize) + let value = DroneDockTaskPresentation(phase: .ready, title: "无人机已到达", + message: "操作结果未知,请刷新核对任务状态。", deviceStatus: "拍摄中", action: .refresh, + actionTitle: "刷新状态", isActionEnabled: true, countdownSeconds: 30) + apply(value, to: status) + let button = try XCTUnwrap(find(in: status, suffix: "refresh") as? UIButton) + XCTAssertEqual((find(in: status, suffix: "statusMessage") as? UILabel)?.text, value.message) + XCTAssertEqual(button.title(for: .normal), "刷新状态") + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden") + var calls = 0 + status.onPrimaryAction = { calls += 1 } + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, 1) + status.apply(value, isRefreshing: true) + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, 1) + XCTAssertFalse(button.isEnabled) + try assertReadableContainedContent(in: status) + } + + /// 从到达到拍摄中再进入错误/完成状态时,独立面板和通用操作互不留下旧入口。 + func testShootingPanelTransitionsClearOldCountdownAndRestoreAllowedAction() throws { + let status = makeStatus(size: regularSize) + var actionCalls = 0 + status.onPrimaryAction = { actionCalls += 1 } + apply(presentation(.ready, countdownSeconds: 12), to: status) + let start = try XCTUnwrap(find(in: status, suffix: "primary") as? UIButton) + XCTAssertEqual(start.title(for: .normal), "开始拍摄(12s)") + XCTAssertNil(find(in: status, suffix: "countdown")) + apply(presentation(.shooting), to: status) + let indicator = try XCTUnwrap(find(in: status, suffix: "shootingIndicator") as? UIButton) + XCTAssertFalse(isHidden(indicator)) + status.updateCountdown(seconds: 5) + layoutHierarchy(status) + XCTAssertNil(find(in: status, suffix: "countdown")) + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden") + XCTAssertEqual(status.diagnosticFields["action_title"] as? String, "拍摄中") + XCTAssertFalse(start.currentTitle?.contains("s)") == true) + indicator.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 0) + apply(presentation(.readError), to: status) + XCTAssertTrue(isHidden(indicator)) + let refresh = try XCTUnwrap(find(in: status, suffix: "refresh") as? UIButton) + XCTAssertFalse(isHidden(refresh)) + XCTAssertTrue(refresh.isEnabled) + XCTAssertEqual(refresh.bounds.width, regularSize.width - 32, accuracy: 0.5) + refresh.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 1) + apply(presentation(.completed), to: status) + XCTAssertTrue(isHidden(indicator)) + let materials = try XCTUnwrap(find(in: status, suffix: "primary") as? UIButton) + XCTAssertFalse(isHidden(materials)) + XCTAssertTrue(materials.isEnabled) + materials.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 2) + XCTAssertNil(find(in: status, suffix: "details")) + try assertReadableContainedContent(in: status) + } + + /// 倒计时在固定小屏内保持可见,数字更新不重建按钮、不扩大现有动作许可。 + func testArrivalCountdownFitsFixedAreasAndUpdatesOnlyDisplay() throws { + for size in [compactSize, regularSize] { + for longCopy in [false, true] { + let status = makeStatus(size: size) + apply(presentation(.ready, longCopy: longCopy, countdownSeconds: 30), to: status) + let primary = try XCTUnwrap(find(in: status, suffix: "primary") as? UIButton) + let title = try XCTUnwrap(find(in: status, suffix: "statusTitle") as? UILabel) + let initialTitle = title.text + let initialFrame = primary.convert(primary.bounds, to: status) + var actionCalls = 0 + status.onPrimaryAction = { actionCalls += 1 } + XCTAssertNil(find(in: status, suffix: "countdown")) + try assertFullButtonTitle("开始拍摄(30s)", button: primary) + XCTAssertFalse(primary.isEnabled) + try assertReadableContainedContent(in: status) + if !longCopy { capture(status, name: "到达倒计时30秒-\(Int(size.width))x\(Int(size.height))") } + + for seconds in [29, 12, 1, 0, -1] { + status.updateCountdown(seconds: seconds) + layoutHierarchy(status) + XCTAssertNil(find(in: status, suffix: "countdown")) + XCTAssertTrue(find(in: status, suffix: "primary") === primary) + try assertFullButtonTitle("开始拍摄(\(max(0, seconds))s)", button: primary) + assertEqual(primary.convert(primary.bounds, to: status), initialFrame, message: "每秒文字刷新保持完整点击区域") + XCTAssertEqual(title.text, initialTitle) + XCTAssertFalse(primary.isEnabled, "倒数到零也不能放开开拍动作") + XCTAssertEqual(actionCalls, 0, "数字更新不能触发开拍或其他主动作") + XCTAssertEqual(status.bounds.size, size) + try assertReadableContainedContent(in: status) + } + if !longCopy { capture(status, name: "到达倒计时0秒-仍待接口更新-\(Int(size.width))x\(Int(size.height))") } + status.updateCountdown(seconds: nil) + layoutHierarchy(status) + XCTAssertNil(find(in: status, suffix: "countdown")) + try assertFullButtonTitle("开始拍摄", button: primary) + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden") + assertEqual(primary.convert(primary.bounds, to: status), initialFrame, message: "清除计时不改变按钮布局") + XCTAssertEqual(actionCalls, 0) + try assertReadableContainedContent(in: status) + } + } + } + + /// 未到达及后端切换到其他阶段时清除数字,迟到的界面计时更新也不能重新显示。 + func testCountdownOnlyAppearsForReadyAndClearsAfterPhaseChange() throws { + let status = makeStatus(size: compactSize) + apply(presentation(.ready, countdownSeconds: 30), to: status) + XCTAssertEqual(status.diagnosticFields["action_title"] as? String, "开始拍摄(30s)") + XCTAssertNil(find(in: status, suffix: "countdown")) + for phase in phases where phase != .ready { + apply(presentation(phase, countdownSeconds: 30), to: status) + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden", "\(phase)") + XCTAssertFalse((status.diagnosticFields["action_title"] as? String)?.contains("s)") == true) + let actionTitle = status.diagnosticFields["action_title"] as? String + status.updateCountdown(seconds: 12) + layoutHierarchy(status) + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden", "迟到计时不得覆盖 \(phase)") + XCTAssertEqual(status.diagnosticFields["action_title"] as? String, actionTitle) + XCTAssertNil(find(in: status, suffix: "countdown")) + } + apply(presentation(.ready), to: status) + XCTAssertEqual(status.diagnosticFields["action_title"] as? String, "开始拍摄") + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden") + XCTAssertNil(find(in: status, suffix: "countdown")) + + let refresh = DroneDockTaskPresentation(phase: .ready, title: "无人机已到达", message: "核对状态", + deviceStatus: "", action: .refresh, actionTitle: "刷新任务状态", isActionEnabled: true, countdownSeconds: 30) + apply(refresh, to: status) + status.updateCountdown(seconds: 12) + layoutHierarchy(status) + XCTAssertEqual(status.diagnosticFields["action_title"] as? String, "刷新任务状态") + XCTAssertEqual(status.diagnosticFields["countdown"] as? String, "hidden", "ready 的其他动作不能带开拍倒计时") + } + + /// 完成态的说明与标题左对齐,素材按钮全宽;刷新或阶段变化不能绕过操作门禁。 + func testCompletionPanelMatchesPrototypeAndKeepsActionGate() async throws { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previous = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + let host = UIViewController() + window.rootViewController = host + window.makeKeyAndVisible() + defer { window.isHidden = true; window.rootViewController = nil; previous?.makeKeyAndVisible() } + for size in [compactSize, regularSize] { + let status = makeStatus(size: size) + host.view.addSubview(status) + defer { status.removeFromSuperview() } + let value = DroneDockTaskPresentation(phase: .postShootUploading, title: "拍摄已完成", + message: "本次拍摄已结束,可前往查看素材。\n素材处理中,可在素材库查看进度。", + deviceStatus: "拍摄中 · 电量 90%", action: .materials, actionTitle: "查看素材", isActionEnabled: true) + apply(value, to: status) + window.layoutIfNeeded() + try await Task.sleep(for: .milliseconds(50)) + layoutHierarchy(status) + let title = try XCTUnwrap(find(in: status, suffix: "statusTitle") as? UILabel) + let message = try XCTUnwrap(find(in: status, suffix: "statusMessage") as? UILabel) + let button = try XCTUnwrap(find(in: status, suffix: "primary") as? UIButton) + XCTAssertEqual(title.convert(title.bounds, to: status).minX, message.convert(message.bounds, to: status).minX, accuracy: 0.5) + XCTAssertEqual(button.bounds.width, size.width - 32, accuracy: 0.5) + XCTAssertNotNil(button.configuration?.image) + let text = try XCTUnwrap(button.titleLabel) + let image = try XCTUnwrap(button.imageView) + let contentFrame = text.convert(text.bounds, to: button).union(image.convert(image.bounds, to: button)) + XCTAssertEqual(contentFrame.midX, button.bounds.midX, accuracy: 1, "素材图标与文字整体居中") + XCTAssertTrue(isHidden(try XCTUnwrap(find(in: status, suffix: "deviceStatus")))) + var calls = 0 + status.onPrimaryAction = { calls += 1 } + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, 1) + capture(status, name: "拍摄完成-原型布局-\(Int(size.width))x\(Int(size.height))") + status.apply(value, isRefreshing: true) + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, 1) + XCTAssertFalse(button.isEnabled) + apply(presentation(.failed), to: status) + XCTAssertTrue(isHidden(button), "上传失败必须显示失败状态,不能保留完成操作面板") + button.sendActions(for: .touchUpInside) + XCTAssertEqual(calls, 1) + XCTAssertTrue(isHidden(try XCTUnwrap(find(in: status, suffix: "completed")))) + try assertReadableContainedContent(in: status) + } + } + + /// 失败长原因在固定小屏与真实剩余高度内可展开,主按钮保持全宽且不能触发召唤。 + func testFailureReasonDetailsAndDisabledRetryFitFixedAreas() throws { + for size in [compactSize, regularSize, CGSize(width: 402, height: 207.875)] { + let status = makeStatus(size: size) + let value = presentation(.failed, longCopy: true) + apply(value, to: status) + var detailsCalls = 0 + var actionCalls = 0 + status.onDetails = { detailsCalls += 1 } + status.onPrimaryAction = { actionCalls += 1 } + let details = try XCTUnwrap(find(in: status, suffix: "failureDetails") as? UIButton) + let retry = try XCTUnwrap(find(in: status, suffix: "failureRetry") as? UIButton) + let reason = try XCTUnwrap(find(in: status, suffix: "failureReason") as? UILabel) + XCTAssertEqual(reason.text, "失败原因:\(value.message)") + XCTAssertTrue(details.accessibilityLabel?.contains(value.message) == true) + XCTAssertFalse(isHidden(details)) + XCTAssertGreaterThanOrEqual(details.bounds.height, 44) + let center = details.convert(CGPoint(x: details.bounds.midX, y: details.bounds.midY), to: status) + let hit = status.hitTest(center, with: nil) + XCTAssertTrue(hit === details || hit?.isDescendant(of: details) == true) + details.sendActions(for: .touchUpInside) + XCTAssertEqual(detailsCalls, 1) + XCTAssertEqual(retry.configuration?.title, "重新召唤无人机") + XCTAssertFalse(retry.isEnabled) + XCTAssertEqual(retry.bounds.width, details.bounds.width, accuracy: 0.5) + retry.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 0) + XCTAssertNil(find(in: status, suffix: "details")) + try assertReadableContainedContent(in: status) + } + } + + /// 状态区只转发已允许的主操作,未接通的开始拍摄按钮不能借布局切换被启用。 + func testActionAvailabilitySurvivesLayoutChanges() throws { + let status = makeStatus(size: compactSize) + var actionCalls = 0 + status.onPrimaryAction = { actionCalls += 1 } + apply(presentation(.ready), to: status) + let start = try XCTUnwrap(find(in: status, suffix: "primary") as? UIButton) + XCTAssertFalse(start.isEnabled) + start.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 0) + + status.frame.size = regularSize + apply(presentation(.readError), to: status) + let refresh = try XCTUnwrap(find(in: status, suffix: "refresh") as? UIButton) + XCTAssertTrue(refresh.isEnabled) + refresh.sendActions(for: .touchUpInside) + XCTAssertEqual(actionCalls, 1) + try assertReadableContainedContent(in: status) + } + + /// 以扣除系统栏后的内容尺寸切换状态,验证真实剩余中间高度及三区稳定性。 + func testPageRegionsRemainFixedAcrossStatesAndStaleTelemetry() throws { + // 离线视图没有系统 safe area:小屏扣除状态栏 20 + 导航栏 44,大屏扣除顶部 106 + 底部 34。 + let viewports: [(size: CGSize, expectedStatusHeight: CGFloat, screen: String)] = [ + (CGSize(width: 375, height: 603), 146.0625, "375x667"), + (CGSize(width: 402, height: 734), 207.875, "402x874") + ] + for viewport in viewports { + let size = viewport.size + let service = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.response())) + let controller = try makeController(service: service, size: size) + let root = try XCTUnwrap(controller.view) + let top = try XCTUnwrap(find(in: root, suffix: "top")) + let status = try XCTUnwrap(find(in: root, suffix: "stateContainer") as? DroneDockTaskStatusView) + let footer = try XCTUnwrap(find(in: root, suffix: "safety")) + let telemetry = try XCTUnwrap(find(in: root, suffix: "telemetry") as? DroneShootingTaskTelemetryView) + let feed = try XCTUnwrap(find(in: root, suffix: "feedPlaceholder")) + XCTAssertTrue(top.superview === root) + XCTAssertTrue(status.superview === root) + XCTAssertTrue(footer.superview === root) + XCTAssertTrue(allViews(in: root).allSatisfy { !($0 is UIScrollView) }) + let stableIDs = ["top", "summary", "feedPlaceholder", "telemetry", "stateContainer", "safety"] + let initial = try regionFrames(in: root, suffixes: stableIDs) + XCTAssertEqual(status.bounds.height, viewport.expectedStatusHeight, accuracy: 0.5) + XCTAssertEqual(top.frame.maxY, status.frame.minY, accuracy: 0.5) + XCTAssertEqual(status.frame.maxY, footer.frame.minY, accuracy: 0.5) + XCTAssertEqual(feed.bounds.height, feed.bounds.width * 9 / 16, accuracy: 0.5) + assertContained(top, in: root) + assertContained(status, in: root) + assertContained(footer, in: root) + for suffix in ["summary", "feedPlaceholder", "telemetry"] { + assertContained(try XCTUnwrap(find(in: root, suffix: suffix)), in: top) + } + for suffix in ["pause", "return"] { + let button = try XCTUnwrap(find(in: footer, suffix: suffix) as? UIButton) + XCTAssertFalse(button.isEnabled) + XCTAssertGreaterThanOrEqual(button.bounds.height, 44) + XCTAssertGreaterThanOrEqual(button.bounds.width, 44) + assertContained(button, in: footer) + } + + for phase in phases { + apply(presentation(phase, longCopy: phase == .readError), to: status) + UIView.performWithoutAnimation { + telemetry.apply(values: ["93%", "10.3℃", "0m/s", "无雨", "信号良好", "32颗"], + isStale: phase == .loading || phase == .readError, + accessibilityPrefix: "drone.task.remote.metric") + layoutHierarchy(root) + } + let current = try regionFrames(in: root, suffixes: stableIDs) + for suffix in stableIDs { + assertEqual(try XCTUnwrap(current[suffix]), try XCTUnwrap(initial[suffix]), + message: "\(Int(size.width))×\(Int(size.height)) \(phase) \(suffix)") + } + try assertReadableContainedContent(in: status) + } + XCTAssertTrue(service.requests.isEmpty, "仅布局测试不得触发网络读取") + capture(root, name: "任务固定三区-内容\(Int(size.width))x\(Int(size.height))-屏幕\(viewport.screen)-长错误文案") + } + } + + /// 将常规、紧凑及长错误文案保存为 XCTest 图片附件供模拟器视觉复核。 + func testCaptureRegularCompactAndLongErrorAttachments() throws { + let samples: [(CGSize, DroneDockTaskPresentation, String)] = [ + (regularSize, presentation(.ready), "状态区-常规402x220-准备就绪"), + (compactSize, presentation(.shooting), "状态区-紧凑375x146-拍摄中"), + (compactSize, presentation(.readError, longCopy: true), "状态区-紧凑375x146-超长错误"), + (regularSize, presentation(.failed), "状态区-常规402x220-任务执行失败"), + (compactSize, presentation(.failed, longCopy: true), "状态区-紧凑375x146-失败长原因"), + (CGSize(width: 402, height: 207.875), presentation(.failed), "状态区-实际402x208-任务执行失败") + ] + for (size, value, name) in samples { + let status = makeStatus(size: size) + apply(value, to: status) + try assertReadableContainedContent(in: status) + capture(status, name: name) + } + } + + private func makeStatus(size: CGSize) -> DroneDockTaskStatusView { + let status = DroneDockTaskStatusView(frame: CGRect(origin: .zero, size: size)) + status.overrideUserInterfaceStyle = .light + return status + } + + private func apply(_ presentation: DroneDockTaskPresentation, to status: DroneDockTaskStatusView) { + UIView.performWithoutAnimation { + status.apply(presentation) + layoutHierarchy(status) + } + } + + private func presentation(_ phase: DroneDockTaskDisplayPhase, longCopy: Bool = false, + countdownSeconds: Int? = nil) -> DroneDockTaskPresentation { + let title: String + let action: DroneDockTaskDisplayAction + let actionTitle: String? + let enabled: Bool + switch phase { + case .loading: (title, action, actionTitle, enabled) = ("正在获取任务状态", .none, nil, false) + case .navigating: (title, action, actionTitle, enabled) = ("无人机正在前往点位", .refresh, "刷新任务状态", true) + case .ready: (title, action, actionTitle, enabled) = ("无人机已到达", .start, "开始拍摄", false) + case .shooting: (title, action, actionTitle, enabled) = ("无人机正在拍摄中", .none, "拍摄中", false) + case .postShootUploading: (title, action, actionTitle, enabled) = ("拍摄已完成", .materials, "查看素材", true) + case .postShootUploadFailed: (title, action, actionTitle, enabled) = ("素材上传失败", .materials, "查看素材", true) + case .paused: (title, action, actionTitle, enabled) = ("无人机已暂停", .resume, "继续任务", true) + case .returning: (title, action, actionTitle, enabled) = ("无人机正在返航", .none, "拍摄已中断", false) + case .returned: (title, action, actionTitle, enabled) = ("本次拍摄已中断", .retry, "重新召唤无人机", true) + case .completed: (title, action, actionTitle, enabled) = ("本次拍摄已完成", .materials, "查看素材", true) + case .failed: (title, action, actionTitle, enabled) = ("任务执行失败", .retry, "重新召唤无人机", false) + case .blocked: (title, action, actionTitle, enabled) = ("当前无法继续拍摄", .refresh, "刷新任务状态", true) + case .unknown: (title, action, actionTitle, enabled) = ("状态待确认", .refresh, "刷新任务状态", true) + case .readError: (title, action, actionTitle, enabled) = ("任务状态读取失败", .refresh, "重新加载", true) + } + let longTitle = String(repeating: "航线任务状态需要确认,", count: 8) + let longMessage = String(repeating: "服务端返回的完整错误说明需要保留供工作人员查看,请检查任务和设备状态。", count: 12) + return DroneDockTaskPresentation(phase: phase, title: longCopy && phase != .failed ? longTitle : title, + message: longCopy ? longMessage : phase == .failed ? "拍摄指令执行失败" + : phase == .shooting ? "请关注现场及实时画面。\n请勿关闭本页或息屏。" : "请确认当前状态后继续操作。", + deviceStatus: "空闲 · 电量 93%", action: action, actionTitle: actionTitle, isActionEnabled: enabled, + actionNote: phase == .failed ? "无人机离线,暂不可召唤" : nil, + countdownSeconds: countdownSeconds) + } + + private func makeController(service: any DroneDockShootingServing, size: CGSize) throws -> DroneDockShootingTaskViewController { + let context = DroneDockShootingTaskTestData.context() + let model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, currentContext: { context }) + let controller = DroneDockShootingTaskViewController(viewModel: model) + UIView.performWithoutAnimation { + controller.loadViewIfNeeded() + controller.view.frame = CGRect(origin: .zero, size: size) + layoutHierarchy(controller.view) + controller.viewDidLayoutSubviews() + layoutHierarchy(controller.view) + } + return controller + } + + private func assertReadableContainedContent(in status: DroneDockTaskStatusView, + file: StaticString = #filePath, line: UInt = #line) throws { + XCTAssertEqual(status.transform, .identity, file: file, line: line) + XCTAssertGreaterThanOrEqual(status.effectiveScale, 0.8, file: file, line: line) + XCTAssertLessThanOrEqual(status.effectiveScale, 1, file: file, line: line) + XCTAssertTrue(allViews(in: status).allSatisfy { !($0 is UIScrollView) }, file: file, line: line) + for view in allViews(in: status) where view !== status && !isHidden(view) && !view.bounds.isEmpty { + assertContained(view, in: status, file: file, line: line) + if let label = view as? UILabel { + XCTAssertGreaterThanOrEqual(label.font.pointSize, 12, file: file, line: line) + if label.adjustsFontSizeToFitWidth { + XCTAssertGreaterThanOrEqual(label.font.pointSize * label.minimumScaleFactor, 12, file: file, line: line) + } + } + if let button = view as? UIButton { + XCTAssertGreaterThanOrEqual(button.bounds.height, 44, file: file, line: line) + XCTAssertGreaterThanOrEqual(button.bounds.width, 44, file: file, line: line) + if let title = button.currentTitle, !title.isEmpty { + let label = try XCTUnwrap(button.titleLabel, file: file, line: line) + XCTAssertEqual(label.text, title, file: file, line: line) + XCTAssertFalse(label.bounds.isEmpty, file: file, line: line) + XCTAssertFalse(isHidden(label), file: file, line: line) + } + } + } + XCTAssertNil(find(in: status, suffix: "details"), file: file, line: line) + let failure = try XCTUnwrap(find(in: status, suffix: "failure"), file: file, line: line) + if !isHidden(failure) { + let details = try XCTUnwrap(find(in: status, suffix: "failureDetails") as? UIButton, file: file, line: line) + XCTAssertFalse(isHidden(details), file: file, line: line) + } + } + + private func assertContained(_ view: UIView, in container: UIView, + file: StaticString = #filePath, line: UInt = #line) { + let frame = view.convert(view.bounds, to: container) + XCTAssertTrue(container.bounds.insetBy(dx: -0.5, dy: -0.5).contains(frame), + "\(view.accessibilityIdentifier ?? String(describing: type(of: view))) 越界:\(frame),容器:\(container.bounds)", + file: file, line: line) + } + + /// 同时核对模型标题和 UILabel 的实际内容、文字宽度,避免秒数被尾部裁切。 + private func assertFullButtonTitle(_ expected: String, button: UIButton, + file: StaticString = #filePath, line: UInt = #line) throws { + XCTAssertEqual(button.title(for: .normal), expected, file: file, line: line) + let label = try XCTUnwrap(button.titleLabel, file: file, line: line) + XCTAssertEqual(label.text, expected, file: file, line: line) + let size = (expected as NSString).size(withAttributes: [.font: label.font as Any]) + XCTAssertGreaterThanOrEqual(label.bounds.width + 1, ceil(size.width), "按钮标题不能裁切秒数", file: file, line: line) + XCTAssertGreaterThanOrEqual(button.bounds.height, 44, file: file, line: line) + } + + private func assertEqual(_ lhs: CGRect, _ rhs: CGRect, message: String, + file: StaticString = #filePath, line: UInt = #line) { + XCTAssertEqual(lhs.origin.x, rhs.origin.x, accuracy: 0.5, message, file: file, line: line) + XCTAssertEqual(lhs.origin.y, rhs.origin.y, accuracy: 0.5, message, file: file, line: line) + XCTAssertEqual(lhs.size.width, rhs.size.width, accuracy: 0.5, message, file: file, line: line) + XCTAssertEqual(lhs.size.height, rhs.size.height, accuracy: 0.5, message, file: file, line: line) + } + + private func regionFrames(in root: UIView, suffixes: [String]) throws -> [String: CGRect] { + var frames: [String: CGRect] = [:] + for suffix in suffixes { + let view = try XCTUnwrap(find(in: root, suffix: suffix), "缺少固定区域 \(suffix)") + frames[suffix] = view.convert(view.bounds, to: root) + } + return frames + } + + private func allViews(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews(in: $0) } } + private func isHidden(_ view: UIView) -> Bool { view.isHidden || view.alpha < 0.01 || (view.superview.map(isHidden) ?? false) } + private func find(in root: UIView, suffix: String) -> UIView? { + allViews(in: root).first { $0.accessibilityIdentifier == "drone.task.remote.\(suffix)" } + } + + /// 离线布局完成后显式刷新按钮标题图层,避免截图落在标题切换的过渡帧。 + private func layoutHierarchy(_ view: UIView) { + view.setNeedsLayout() + view.layoutIfNeeded() + for child in view.subviews { layoutHierarchy(child) } + if let button = view as? UIButton { + button.layoutIfNeeded() + button.titleLabel?.setNeedsLayout() + button.titleLabel?.layoutIfNeeded() + button.titleLabel?.layer.setNeedsDisplay() + button.titleLabel?.layer.displayIfNeeded() + } + } + + private func capture(_ view: UIView, name: String) { + UIView.performWithoutAnimation { layoutHierarchy(view) } + let image = UIGraphicsImageRenderer(bounds: view.bounds).image { context in + view.layer.render(in: context.cgContext) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/suixinkanTests/DroneDockTaskPresentationTests.swift b/suixinkanTests/DroneDockTaskPresentationTests.swift new file mode 100644 index 0000000..bb0b2a3 --- /dev/null +++ b/suixinkanTests/DroneDockTaskPresentationTests.swift @@ -0,0 +1,339 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证任务页展示阶段和动作的保守映射;阶段夹具用于显示测试,不代表全部状态已经后端实测。 +@MainActor +final class DroneDockTaskPresentationTests: XCTestCase { + /// 状态标题由本地枚举定义,后端标题不覆盖产品文案;设备读数仍保留原值。 + func testExplicitDisplayPhaseFixturesUseLocalTitles() async throws { + let phases: [(String, DroneDockTaskDisplayPhase)] = [ + ("going_to_spot", .navigating), ("blocked", .blocked) + ] + for (phase, expected) in phases { + let result = try await presentation([ + "ui": ["phase": phase, "title": "服务端阶段标题", "message": "服务端完整阶段说明"], + "current_plane": ["status_text": "服务端设备文案"] + ]) + XCTAssertEqual(result.phase, expected) + XCTAssertEqual(result.title, expected == .navigating ? "无人机正在赶来" : "当前任务暂不可执行") + XCTAssertEqual(result.deviceStatus, "服务端设备文案") + XCTAssertEqual(result.action, .refresh) + XCTAssertTrue(result.isActionEnabled) + } + } + + /// 拍摄中的正常提示采用体验网页文案,中央只显示禁用状态,状态刷新仍走导航栏。 + func testShootingMatchesPrototypeWithoutPrimaryAction() async throws { + let result = try await presentation([ + "ui": ["phase": "shooting", "title": "后端拍摄阶段", "message": "后端旧提示"], + "current_plane": ["status_text": "拍摄中 · 电量95%"] + ]) + XCTAssertEqual(result.phase, .shooting) + XCTAssertEqual(result.title, "无人机正在拍摄中") + XCTAssertEqual(result.message, "请关注现场及实时画面。\n请勿关闭本页或息屏。") + XCTAssertEqual(result.action, .none) + XCTAssertEqual(result.actionTitle, "拍摄中") + XCTAssertFalse(result.isActionEnabled) + XCTAssertEqual(result.deviceStatus, "拍摄中 · 电量95%") + } + + /// 只读模型未注入写服务,即使飞控允许也不发送;恢复按钮与开拍门禁互相独立。 + func testStartAndResumeRemainDisabledWithoutWriteServices() async throws { + let ready = try await presentation([ + "execution_batch": 100, + "flight_control": DroneDockShootingTaskTestData.flightControl(pauseReason: "arrival_wait"), + "ui": ["phase": "arrived_pending_start", "title": "无人机已到达"], + "execute_gate": ["can_execute": true, "primary_action": "start_shoot", "primary_action_label": "开始拍摄"] + ]) + XCTAssertEqual(ready.phase, .ready) + XCTAssertEqual(ready.action, .start) + XCTAssertEqual(ready.actionTitle, "开始拍摄") + XCTAssertFalse(ready.isActionEnabled) + let paused = try await presentation([ + "execution_batch": 100, + "flight_control": DroneDockShootingTaskTestData.flightControl(state: "paused", canPause: false, canResume: true, resumePhase: "shooting", pauseReason: "manual"), + "ui": ["phase": "manual_paused"], + "execute_gate": ["can_execute": true, "primary_action": "flighttask_recovery", "primary_action_label": "继续执行"] + ]) + XCTAssertEqual(paused.phase, .paused) + XCTAssertEqual(paused.action, .resume) + XCTAssertEqual(paused.actionTitle, "继续任务") + XCTAssertEqual(paused.title, "无人机已暂停") + XCTAssertEqual(paused.message, "当前悬停待命。\n确认安全后,可继续任务或立即返航。") + XCTAssertFalse(paused.isActionEnabled) + } + + /// 开拍门禁独立于明确到达阶段,拒绝时保留到达并说明原因,暂停仍展示继续任务。 + func testDeniedStartGateDoesNotReplacePausedResumeAction() async throws { + let denied = try await presentation([ + "ui": ["phase": "arrived_pending_start", "title": "无人机已到达 是否开始拍摄?"], + "execute_gate": ["can_execute": false, "message": "电量不足", "primary_action": "start_shoot"] + ]) + XCTAssertEqual(denied.phase, .ready) + XCTAssertEqual(denied.title, "无人机已到达") + XCTAssertTrue(denied.message.contains("电量不足")) + XCTAssertEqual(denied.action, .start) + XCTAssertFalse(denied.isActionEnabled) + let paused = try await presentation([ + "execution_batch": 100, + "flight_control": DroneDockShootingTaskTestData.flightControl(state: "paused", canPause: false, canResume: false, resumePhase: "shooting", pauseReason: "manual"), + "ui": ["phase": "manual_paused"], "execute_gate": ["can_execute": false]]) + XCTAssertEqual(paused.action, .resume) + XCTAssertEqual(paused.actionTitle, "继续任务") + XCTAssertFalse(paused.isActionEnabled) + } + + /// 缺少新版飞控证据的旧暂停/返航别名不能作为已确认设备状态。 + func testLegacyControlAliasesRemainUnknownWithoutFlightControl() async throws { + for phase in ["paused", "returning"] { + let result = try await presentation([ + "ui": ["phase": phase, "title": "旧后端控制标题"], + "execute_gate": ["can_execute": true, "primary_action": "flighttask_recovery"]]) + XCTAssertEqual(result.phase, .unknown) + XCTAssertEqual(result.title, "状态待确认") + XCTAssertEqual(result.action, .refresh) + } + } + + /// 实测任务 6 的结构:航线 91 执行失败优先于订单任务 20 执行中,指令列表不等于可操作。 + func testObservedWaylineFailureWinsOverExecutingTaskAndBlockedUI() async throws { + let reason = "航线任务状态不可拍摄(当前:执行失败)" + let result = try await presentation([ + "task": ["id": 501, "status": 20, "status_label": "执行中", "wayline_status": 91, "wayline_status_label": "执行失败"], + "order_flight_task": ["id": 501, "status": 20, "status_label": "执行中"], + "execute_gate": ["can_execute": false, "code": "wayline_not_shooting", "message": reason, "primary_action": "blocked"], + "ui": ["phase": "blocked", "title": reason, "message": reason, + "commands": [["command": "flighttask_pause", "label": "紧急暂停"], ["command": "return_home", "label": "立即返航"]]] + ]) + XCTAssertEqual(result.phase, .failed) + XCTAssertEqual(result.title, "任务执行失败") + XCTAssertEqual(result.message, reason) + XCTAssertEqual(result.action, .retry) + XCTAssertEqual(result.actionTitle, "重新召唤无人机") + XCTAssertFalse(result.isActionEnabled) + XCTAssertEqual(result.actionNote, "等待设备确认已返回机巢后再重新召唤") + } + + /// 开始拍摄门禁允许也不代表可重新召唤,失败标题与按钮保持产品失败态。 + func testWaylineFailureRetryRemainsDisabledDespiteExecutePermission() async throws { + let result = try await presentation([ + "task": ["id": 501, "status": 20, "wayline_status": 91], + "ui": ["phase": "arrived_pending_start", "title": "无人机已到达"], + "execute_gate": ["can_execute": true, "primary_action": "start_shoot"] + ]) + XCTAssertEqual(result.phase, .failed) + XCTAssertEqual(result.title, "任务执行失败") + XCTAssertEqual(result.action, .retry) + XCTAssertEqual(result.actionTitle, "重新召唤无人机") + XCTAssertFalse(result.isActionEnabled) + XCTAssertEqual(result.message, "暂未返回具体失败原因") + } + + /// 任务结果中的具体失败原因优先于门禁通用说明,空结果退回门禁,不丢失真实原因。 + func testFailureReasonPrefersTaskResultThenGateThenUI() async throws { + let base: [String: Any] = [ + "ui": ["phase": "failed", "title": "服务端标题", "message": "阶段说明"], + "execute_gate": ["message": "航线不可拍摄"] + ] + let cases: [([String: Any], String)] = [ + (["order_flight_task": ["result_message": "任务明确失败原因"], "task": ["result_message": "摘要原因"]], "任务明确失败原因"), + (["order_flight_task": ["result_message": " "], "task": ["result_message": "摘要失败原因"]], "摘要失败原因"), + (["order_flight_task": ["result_message": NSNull()]], "航线不可拍摄"), + (["execute_gate": ["message": " "]], "阶段说明") + ] + for (changes, expected) in cases { + let result = try await presentation(base.merging(changes) { _, new in new }) + XCTAssertEqual(result.title, "任务执行失败") + XCTAssertEqual(result.message, expected) + XCTAssertFalse(result.isActionEnabled) + } + } + + /// 明确离线或返航才显示对应限制,空闲与未知保持中性,不能冒称已具备重新召唤条件。 + func testFailureActionNoteUsesOnlyExplicitDeviceState() async throws { + let neutral = "等待设备确认已返回机巢后再重新召唤" + let cases: [([String: Any], String)] = [ + (["online_status": 2, "work_status": 0, "work_status_label": "离线"], "无人机离线,暂不可召唤"), + (["online_status": 2, "work_status_label": "返航中"], "无人机离线,暂不可召唤"), + (["work_status": 0], "无人机离线,暂不可召唤"), + (["work_status_label": "返航中"], "无人机返航中,暂不可召唤"), + (["work_status_label": "正在返航"], "无人机返航中,暂不可召唤"), + (["online_status": 1, "work_status": 1, "work_status_label": "空闲"], neutral), + ([:], neutral) + ] + for (plane, expected) in cases { + let result = try await presentation([ + "task": ["wayline_status": 91], "current_plane": plane + ]) + XCTAssertEqual(result.actionNote, expected) + XCTAssertEqual(result.action, .retry) + XCTAssertFalse(result.isActionEnabled) + } + let normal = try await presentation(["ui": ["phase": "navigating"]]) + XCTAssertNil(normal.actionNote) + } + + /// 素材成功不被正常返航覆盖;拍摄结果和设备执行态保持独立。 + func testMaterialsRequiresExplicitUnconflictedCompletion() async throws { + for payload: [String: Any] in [ + ["task": ["id": 501, "status": 30, "status_label": "拍摄成功"]], + ["ui": ["phase": "completed", "title": "本次拍摄已完成"]] + ] { + let result = try await presentation(payload) + XCTAssertEqual(result.phase, .completed) + XCTAssertEqual(result.action, .materials) + XCTAssertEqual(result.actionTitle, "查看素材") + XCTAssertTrue(result.isActionEnabled) + } + let returning = try await presentation([ + "task": ["status": 30], "ui": ["phase": "completed"], "execution_batch": 100, + "flight_control": DroneDockShootingTaskTestData.flightControl(state: "returning", canPause: false, + canReturn: false, returnReason: "normal_complete")]) + XCTAssertEqual(returning.phase, .completed) + XCTAssertEqual(returning.action, .materials) + } + + /// 未知阶段、执行中摘要及矛盾字段不转换成到达、拍摄中或完成。 + func testUnknownAndConflictingStatesUseRefreshOnly() async throws { + let payloads: [[String: Any]] = [ + [:], ["task": ["status": 20, "status_label": "执行中"]], + ["ui": ["phase": "future_phase", "title": "未知阶段"], "task": ["status": 30]], + ["task": ["status": 20], "order_flight_task": ["status": 30]], + ["task": ["status": 20], "ui": ["phase": "completed"]], + ["task": ["status": 30], "ui": ["phase": "shooting"]], + ["ui": ["phase": "arrived_pending_start"], "execute_gate": ["can_execute": true, "primary_action": "blocked"]] + ] + for payload in payloads { + let result = try await presentation(payload) + XCTAssertEqual(result.phase, .unknown) + XCTAssertEqual(result.title, "状态待确认") + XCTAssertEqual(result.action, .refresh) + XCTAssertTrue(result.isActionEnabled) + } + } + + /// 明确到达但没有开拍门禁时保留到达展示,不借文案开放开始按钮。 + func testExplicitArrivalWithoutStartGateRemainsReadyButDisabled() async throws { + let result = try await presentation(["ui": ["phase": "arrived_pending_start"]]) + XCTAssertEqual(result.phase, .ready) + XCTAssertEqual(result.title, "无人机已到达") + XCTAssertEqual(result.action, .start) + XCTAssertFalse(result.isActionEnabled) + } + + /// 明确失败或取消不受笼统阶段文案覆盖,更不能开放素材完成入口。 + func testFailedAndCancelledTaskStatesOverrideOptimisticUI() async throws { + let failed = try await presentation(["task": ["status": 40, "status_label": "执行失败"], "ui": ["phase": "completed"]]) + XCTAssertEqual(failed.phase, .failed) + XCTAssertEqual(failed.title, "任务执行失败") + XCTAssertEqual(failed.action, .retry) + XCTAssertFalse(failed.isActionEnabled) + let cancelled = try await presentation(["task": ["status": 50, "status_label": "任务已取消"], "ui": ["phase": "shooting"]]) + XCTAssertEqual(cancelled.phase, .blocked) + XCTAssertEqual(cancelled.title, "任务已取消") + XCTAssertEqual(cancelled.action, .refresh) + } + + /// 刷新失败继续展示旧完成态,但不允许按旧快照进入素材,错误由页面另行提示。 + func testReadErrorPreservesPreviousCompletedPresentationAndDisablesAction() async throws { + let service = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.decode(["task": ["status": 30]]))) + let model = try makeModel(service: service) + await model.refresh() + XCTAssertEqual(model.presentation.action, .materials) + let previous = model.presentation + let readError = APIError.networkFailed("测试读取失败") + service.result = .failure(readError) + await model.refresh() + XCTAssertEqual(model.presentation.phase, .completed) + XCTAssertEqual(model.presentation.title, previous.title) + XCTAssertEqual(model.presentation.message, previous.message) + XCTAssertEqual(model.presentation.action, .materials) + XCTAssertEqual(model.presentation.actionTitle, previous.actionTitle) + XCTAssertFalse(model.presentation.isActionEnabled) + XCTAssertEqual(model.errorMessage, readError.localizedDescription) + XCTAssertEqual(model.presentation.deviceStatus, "—") + } + + /// 已有可信完成态时,无感刷新保留素材入口可点,不因只读请求短暂锁住按钮。 + func testLoadingPreservesPreviousCompletedPresentationWithEnabledAction() async throws { + let service = PresentationPendingService(response: try DroneDockShootingTaskTestData.decode(["task": ["status": 30]])) + let model = try makeModel(service: service) + await model.refresh() + service.shouldHold = true + let pending = Task { await model.refresh() } + for _ in 0..<100 where !service.isPending { await Task.yield() } + XCTAssertTrue(service.isPending) + XCTAssertEqual(model.presentation.phase, .completed) + XCTAssertEqual(model.presentation.action, .materials) + XCTAssertEqual(model.presentation.actionTitle, "查看素材") + XCTAssertTrue(model.presentation.isActionEnabled) + service.finish() + await pending.value + XCTAssertEqual(model.presentation.phase, .completed) + XCTAssertTrue(model.presentation.isActionEnabled) + } + + /// 没有任何成功快照时仍显示首次加载,不能虚构此前阶段。 + func testInitialReadWithoutSnapshotShowsLoading() async throws { + let service = PresentationPendingService(response: try DroneDockShootingTaskTestData.decode(["task": ["status": 30]])) + service.shouldHold = true + let model = try makeModel(service: service) + let pending = Task { await model.refresh() } + for _ in 0..<100 where !service.isPending { await Task.yield() } + XCTAssertTrue(service.isPending) + XCTAssertEqual(model.presentation.phase, .loading) + XCTAssertEqual(model.presentation.action, .none) + XCTAssertFalse(model.presentation.isActionEnabled) + XCTAssertNil(model.response) + service.finish() + await pending.value + } + + /// 首次读取失败没有快照可保留,继续显示错误及重新读取动作。 + func testInitialReadErrorWithoutSnapshotShowsFailure() async throws { + let readError = APIError.networkFailed("首次读取失败") + let service = DroneDockShootingTaskTestService(result: .failure(readError)) + let model = try makeModel(service: service) + await model.refresh() + XCTAssertEqual(model.presentation.phase, .readError) + XCTAssertEqual(model.presentation.message, readError.localizedDescription) + XCTAssertEqual(model.presentation.action, .refresh) + XCTAssertTrue(model.presentation.isActionEnabled) + XCTAssertNil(model.response) + } + + private func presentation(_ payload: [String: Any]) async throws -> DroneDockTaskPresentation { + let service = DroneDockShootingTaskTestService(result: .success(try DroneDockShootingTaskTestData.decode(payload))) + let model = try makeModel(service: service) + await model.refresh() + return model.presentation + } + + private func makeModel(service: any DroneDockShootingServing) throws -> DroneDockShootingTaskViewModel { + let context = DroneDockShootingTaskTestData.context() + return DroneDockShootingTaskViewModel(context: context, taskID: 501, order: try DroneDockShootingTaskTestData.order(), + service: service, currentContext: { context }) + } +} + +/// 手动挂起一次读取,验证加载状态优先级,不访问真实网络。 +@MainActor +private final class PresentationPendingService: DroneDockShootingServing { + var shouldHold = false + private let response: DroneDockShootingResponse + private var continuation: CheckedContinuation? + var isPending: Bool { continuation != nil } + + init(response: DroneDockShootingResponse) { self.response = response } + + func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse { + if shouldHold { return try await withCheckedThrowingContinuation { continuation = $0 } } + return response + } + + func finish() { + continuation?.resume(returning: response) + continuation = nil + } +} diff --git a/suixinkanTests/DroneDockTaskTraceTests.swift b/suixinkanTests/DroneDockTaskTraceTests.swift new file mode 100644 index 0000000..194347a --- /dev/null +++ b/suixinkanTests/DroneDockTaskTraceTests.swift @@ -0,0 +1,358 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 关键日志与真实 ViewModel 判断一起验证;全部读取和指令由纯内存替身完成。 +@MainActor +final class DroneDockTaskTraceTests: XCTestCase { + func testStartingInsideLogsBackendEvidenceAndLocalTravelSeparately() async throws { + let fixture = try DroneTaskTraceFixture(snapshot: Self.snapshot(state: "starting", phase: "going_to_spot")) + await fixture.model.refresh() + + let event = try fixture.output.last("snapshot.applied") + let state = try dictionary(event["state"]) + let backend = try dictionary(state["backend"]) + let local = try dictionary(state["local"]) + let control = try dictionary(backend["flight_control"]) + XCTAssertEqual(event["source"] as? String, "http") + XCTAssertEqual(event["session_id"] as? String, fixture.model.diagnosticSessionID) + XCTAssertEqual(event["task_id"] as? Int, 501) + XCTAssertEqual(event["execution_batch"] as? Int, 9001) + XCTAssertEqual(control["state"] as? String, "starting") + XCTAssertEqual(control["drone_in_dock"] as? String, "inside") + XCTAssertEqual(control["is_airborne"] as? Bool, false) + XCTAssertEqual(local["phase"] as? String, "navigating") + XCTAssertEqual(local["title"] as? String, fixture.model.presentation.title) + XCTAssertEqual(local["pause_allowed"] as? Bool, false) + XCTAssertEqual(local["return_allowed"] as? Bool, true) + XCTAssertTrue(local["countdown_seconds"] is NSNull) + XCTAssertEqual(fixture.model.presentation.phase, .navigating) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertTrue(fixture.commands.requests.isEmpty) + } + + func testArrivalWaitLogsReadyAndStartsCountdownOnceDespiteRawDJIPause() async throws { + let clock = DroneDockCountdownTestClock() + var control = DroneDockShootingTaskTestData.flightControl(batch: 9001, + resumePhase: "arrived_pending_start", pauseReason: "arrival_wait") + control["dji_task_status"] = "paused" + let initial = try Self.snapshot(phase: "arrived_pending_start", changes: ["flight_control": control]) + let fixture = try DroneTaskTraceFixture(snapshot: initial, countdownNow: { clock.now() }) + await fixture.model.refresh() + clock.advance(by: .seconds(9)) + let updated = try Self.snapshot(version: 2, phase: "arrived_pending_start", changes: ["flight_control": control]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(updated, source: .webSocket), .applied) + + let countdownEvents = try fixture.output.events("countdown.started") + XCTAssertEqual(countdownEvents.count, 1) + XCTAssertEqual(countdownEvents.first?["seconds"] as? Int, 30) + XCTAssertEqual(countdownEvents.first?["source"] as? String, "http") + let event = try fixture.output.last("snapshot.applied") + let state = try dictionary(event["state"]) + let backend = try dictionary(state["backend"]) + let loggedControl = try dictionary(backend["flight_control"]) + let local = try dictionary(state["local"]) + XCTAssertEqual(event["source"] as? String, "websocket") + XCTAssertEqual(backend["ui_phase"] as? String, "arrived_pending_start") + XCTAssertEqual(loggedControl["state"] as? String, "executing") + XCTAssertEqual(loggedControl["pause_reason"] as? String, "arrival_wait") + XCTAssertEqual(loggedControl["dji_task_status"] as? String, "paused") + XCTAssertEqual(local["phase"] as? String, "ready") + XCTAssertEqual(local["countdown_seconds"] as? Int, 21) + XCTAssertEqual(local["resume_allowed"] as? Bool, false) + XCTAssertEqual(fixture.model.presentation.phase, .ready) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertTrue(fixture.commands.requests.isEmpty) + } + + func testSnapshotSourcesAndRejectionReasonsPreserveAcceptedSnapshot() async throws { + let fixture = try DroneTaskTraceFixture(snapshot: Self.snapshot()) + await fixture.model.refresh() + let accepted = try Self.snapshot(version: 3) + XCTAssertEqual(fixture.model.applyTaskSnapshot(accepted, source: .webSocket), .applied) + let acceptedJSON = fixture.model.response?.dataJSON + XCTAssertEqual(fixture.model.applyTaskSnapshot(accepted, source: .http), .duplicate) + XCTAssertEqual(fixture.model.applyTaskSnapshot(try Self.snapshot(version: 2), source: .webSocket), .outdated) + let invalid = try Self.snapshot(version: 4, changes: ["order_flight_task_id": 999]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(invalid), .invalid) + + let applied = try fixture.output.events("snapshot.applied") + XCTAssertEqual(applied.compactMap { $0["source"] as? String }, ["http", "websocket"]) + let ignored = try fixture.output.events("snapshot.ignored") + XCTAssertEqual(ignored.compactMap { $0["source"] as? String }, ["http", "websocket", "unspecified"]) + XCTAssertEqual(ignored.compactMap { $0["result"] as? String }, ["duplicate", "outdated", "invalid"]) + XCTAssertEqual(ignored.compactMap { $0["reason"] as? String }, [ + "same_batch_and_version", "older_batch_or_version", "task_order_or_scenic_mismatch"]) + let rejectedIdentity = try dictionary(try XCTUnwrap(ignored.last)["incoming"]) + XCTAssertEqual(rejectedIdentity["order_flight_task_id"] as? Int, 999) + XCTAssertEqual(fixture.model.response?.dataJSON, acceptedJSON) + XCTAssertEqual(fixture.model.response?.stateVersion, 3) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertTrue(fixture.commands.requests.isEmpty) + } + + func testCommandEventsCorrelateOneRequestThroughReceiptAndSnapshotWithoutExtraCalls() async throws { + let fixture = try DroneTaskTraceFixture(snapshot: Self.snapshot()) + await fixture.model.refresh() + await fixture.model.sendCommand(.pause) + let request = try XCTUnwrap(fixture.commands.requests.first) + XCTAssertTrue(fixture.model.isCommandLoading(.pause)) + let progress: [String: Any] = ["command": DroneDockSafetyCommand.pause.rawValue, + "command_id": "TRACE-COMMAND-1", "client_request_id": request.clientRequestID, + "status": "succeeded", "message": ""] + let control = DroneDockShootingTaskTestData.flightControl(state: "paused", batch: 9001, + canPause: false, canResume: true, resumePhase: "shooting", pauseReason: "manual", pendingCommand: progress) + let confirmed = try Self.snapshot(version: 3, state: "paused", phase: "manual_paused", + changes: ["flight_control": control]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(confirmed, source: .webSocket), .applied) + + let events = try fixture.output.all().filter { ($0["event"] as? String)?.hasPrefix("command.") == true } + XCTAssertEqual(events.compactMap { $0["event"] as? String }, [ + "command.requested", "command.queued", "command.sending", "command.receipt_received", + "command.receipt_applied", "command.progress_changed", "command.snapshot_confirmed"]) + let correlated = Array(events.dropFirst()) + XCTAssertEqual(Set(correlated.compactMap { $0["client_request_id"] as? String }), [request.clientRequestID]) + XCTAssertEqual(Set(correlated.compactMap { $0["submitted_batch"] as? Int }), [9001]) + XCTAssertEqual(Set(events.compactMap { $0["session_id"] as? String }), [fixture.model.diagnosticSessionID]) + let receipt = try fixture.output.last("command.receipt_received") + XCTAssertEqual(receipt["receipt_client_request_id"] as? String, request.clientRequestID) + XCTAssertEqual(receipt["receipt_command_id"] as? String, "TRACE-COMMAND-1") + XCTAssertEqual(receipt["accepted"] as? Bool, true) + XCTAssertEqual(receipt["device_confirmed"] as? Bool, false) + let finished = try fixture.output.last("command.snapshot_confirmed") + XCTAssertEqual(finished["command_id"] as? String, "TRACE-COMMAND-1") + XCTAssertEqual(finished["button_loading"] as? Bool, false) + XCTAssertEqual(finished["confirmed_flight_state"] as? String, "paused") + XCTAssertFalse(fixture.model.isCommandLoading(.pause)) + XCTAssertEqual(fixture.model.presentation.phase, .paused) + XCTAssertEqual(fixture.commands.requests.count, 1) + XCTAssertEqual(fixture.service.requests.count, 2, "只有首次读取与既有指令后回查,诊断不增加请求") + XCTAssertTrue(fixture.service.requests.allSatisfy { $0.taskID == 501 && !$0.liveBattery }) + } + + func testStaleMetricsAndNullFlightEvidenceStayDistinctFromRetainedDisplay() async throws { + let fixture = try DroneTaskTraceFixture(snapshot: Self.snapshot(changes: [ + "metrics": [["key": "battery", "raw": 0, "value": "0%", "source": "airport"]], + "metrics_stale": false, "metrics_updated_at": "2026-11-04 10:11:12"])) + await fixture.model.refresh() + let firstState = try dictionary(try fixture.output.last("snapshot.applied")["state"]) + let firstBackend = try dictionary(firstState["backend"]) + let firstMetric = try XCTUnwrap((firstBackend["metrics"] as? [[String: Any]])?.first) + XCTAssertEqual(firstMetric["raw"] as? Int, 0) + XCTAssertEqual(firstMetric["value"] as? String, "0%") + XCTAssertEqual(firstMetric["source"] as? String, "airport") + let control = DroneDockShootingTaskTestData.flightControl(batch: 9001, isAirborne: nil) + let stale = try Self.snapshot(version: 2, changes: ["flight_control": control, + "metrics": [["key": "battery", "raw": NSNull(), "value": NSNull(), "source": "airport"]], + "metrics_stale": true, "metrics_updated_at": NSNull()]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(stale, source: .webSocket), .applied) + + let event = try fixture.output.last("snapshot.applied") + let state = try dictionary(event["state"]) + let backend = try dictionary(state["backend"]) + let local = try dictionary(state["local"]) + let loggedControl = try dictionary(backend["flight_control"]) + XCTAssertEqual(backend["metrics_count"] as? Int, 1) + let missingMetric = try XCTUnwrap((backend["metrics"] as? [[String: Any]])?.first) + XCTAssertTrue(missingMetric["raw"] is NSNull) + XCTAssertTrue(missingMetric["value"] is NSNull) + XCTAssertEqual(missingMetric["source"] as? String, "airport") + XCTAssertEqual(backend["metrics_stale"] as? Bool, true) + XCTAssertTrue(backend["metrics_updated_at"] is NSNull) + XCTAssertTrue(loggedControl["is_airborne"] is NSNull, "未知在飞证据不能补为 false") + XCTAssertEqual(local["using_retained_metrics"] as? Bool, true) + XCTAssertEqual(local["telemetry_stale"] as? Bool, true) + XCTAssertEqual(local["pause_allowed"] as? Bool, true, "遥测未知不覆盖后端明确暂停许可") + let telemetry = try dictionary(local["telemetry"]) + XCTAssertEqual(telemetry["battery"] as? String, "0%") + XCTAssertEqual(fixture.model.telemetry.batteryText, "0%") + XCTAssertEqual(fixture.model.response?.metrics.count, 1) + let raw = try dictionary(JSONSerialization.jsonObject(with: Data(stale.dataJSON.utf8))) + let rawMetric = try XCTUnwrap((raw["metrics"] as? [[String: Any]])?.first) + XCTAssertTrue(rawMetric["raw"] is NSNull) + XCTAssertTrue(rawMetric["value"] is NSNull) + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertTrue(fixture.commands.requests.isEmpty) + } + + /// 遥测证据原样记录;三态不被补造,也不覆盖独立的后端安全许可。 + func testDroneTelemetryEvidencePreservesValuesAndExplicitUnknownAirborne() async throws { + for airborne: Bool? in [true, nil] { + let evidence: [String: Any] = [ + "drone_sn": "TEST-DRONE-058", "telemetry_source": "drone", + "elevation": airborne == true ? 30.25 as Any : NSNull(), + "horizontal_speed": airborne == true ? 0 as Any : NSNull(), + "vertical_speed": airborne == true ? -0.5 as Any : NSNull(), + "is_airborne": airborne as Any? ?? NSNull() + ] + var control = DroneDockShootingTaskTestData.flightControl(batch: 9001, isAirborne: airborne) + control["evidence"] = evidence + let snapshot = try Self.snapshot(changes: ["flight_control": control]) + let fixture = try DroneTaskTraceFixture(snapshot: snapshot) + await fixture.model.refresh() + + let raw = try dictionary(JSONSerialization.jsonObject(with: Data(snapshot.dataJSON.utf8))) + let rawControl = try dictionary(raw["flight_control"]) + let rawEvidence = try dictionary(rawControl["evidence"]) + let state = try dictionary(try fixture.output.last("snapshot.applied")["state"]) + let backend = try dictionary(state["backend"]) + let loggedControl = try dictionary(backend["flight_control"]) + let loggedEvidence = try dictionary(loggedControl["evidence"]) + XCTAssertTrue(NSDictionary(dictionary: rawEvidence).isEqual(to: evidence)) + XCTAssertTrue(NSDictionary(dictionary: loggedEvidence).isEqual(to: evidence)) + XCTAssertEqual(fixture.model.response?.flightControl?.isAirborne, airborne) + XCTAssertTrue(fixture.model.canSendCommand(.pause)) + XCTAssertTrue(fixture.model.canSendCommand(.returnHome)) + if airborne == nil { + XCTAssertTrue(rawControl["is_airborne"] is NSNull) + XCTAssertTrue(loggedControl["is_airborne"] is NSNull) + } + XCTAssertEqual(fixture.service.requests.count, 1) + XCTAssertFalse(try XCTUnwrap(fixture.service.requests.first).liveBattery) + XCTAssertTrue(fixture.commands.requests.isEmpty) + } + } + + /// 服务端补采的新版本立即更新六项读数;过期缓存保留最近值,后续有效读数恢复新鲜样式。 + func testNewMetricsVersionAdvancesDisplayAndPreservesLastValuesWhenStale() async throws { + let initialMetrics: [[String: Any]] = [ + ["key": "battery", "raw": 76, "value": "76%", "source": "drone"], + ["key": "wind_speed", "raw": 2, "value": "2m/s"] + ] + let refreshedMetrics: [[String: Any]] = [ + ["key": "battery", "raw": 75, "value": "75%", "source": "drone"], + ["key": "wind_speed", "raw": 0, "value": "0m/s"] + ] + let fixture = try DroneTaskTraceFixture(snapshot: Self.snapshot(changes: [ + "metrics": initialMetrics, "metrics_stale": false, "metrics_updated_at": "2026-11-04 15:00:00" + ])) + await fixture.model.refresh() + XCTAssertEqual(fixture.model.telemetry.batteryText, "76%") + XCTAssertEqual(fixture.model.telemetry.windText, "2m/s") + + let refreshed = try Self.snapshot(version: 2, changes: [ + "metrics": refreshedMetrics, "metrics_stale": false, "metrics_updated_at": "2026-11-04 15:00:15" + ]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(refreshed, source: .http), .applied) + XCTAssertEqual(fixture.model.telemetry.batteryText, "75%") + XCTAssertEqual(fixture.model.telemetry.windText, "0m/s") + XCTAssertEqual(fixture.model.response?.metricsUpdatedAt, "2026-11-04 15:00:15") + XCTAssertFalse(fixture.model.isTelemetryStale) + + let stale = try Self.snapshot(version: 3, changes: [ + "metrics": refreshedMetrics, "metrics_stale": true, "metrics_updated_at": "2026-11-04 15:00:15" + ]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(stale, source: .http), .applied) + XCTAssertEqual(fixture.model.telemetry.batteryText, "75%") + XCTAssertEqual(fixture.model.telemetry.windText, "0m/s") + XCTAssertTrue(fixture.model.isTelemetryStale) + let staleState = try dictionary(try fixture.output.last("snapshot.applied")["state"]) + let staleBackend = try dictionary(staleState["backend"]) + let staleLocal = try dictionary(staleState["local"]) + XCTAssertEqual(staleBackend["metrics_updated_at"] as? String, "2026-11-04 15:00:15") + XCTAssertEqual(staleLocal["telemetry_stale"] as? Bool, true) + XCTAssertEqual(staleLocal["using_retained_metrics"] as? Bool, false, "完整缓存来自当前回包,不冒充 App 补值") + + let recovered = try Self.snapshot(version: 4, changes: [ + "metrics": [["key": "battery", "raw": 74, "value": "74%", "source": "drone"], + ["key": "wind_speed", "raw": 1.3, "value": "1.3m/s"]], + "metrics_stale": false, "metrics_updated_at": "2026-11-04 15:02:30" + ]) + XCTAssertEqual(fixture.model.applyTaskSnapshot(recovered, source: .http), .applied) + XCTAssertEqual(fixture.model.response?.executionBatch, 9001) + XCTAssertEqual(fixture.model.telemetry.batteryText, "74%") + XCTAssertEqual(fixture.model.telemetry.windText, "1.3m/s") + XCTAssertEqual(fixture.model.response?.metricsUpdatedAt, "2026-11-04 15:02:30") + XCTAssertFalse(fixture.model.isTelemetryStale) + XCTAssertEqual(fixture.service.requests.count, 1, "接收补采快照不新增状态请求或图传请求") + XCTAssertTrue(fixture.service.requests.allSatisfy { !$0.liveBattery }) + XCTAssertTrue(fixture.commands.requests.isEmpty) + } + + private func dictionary(_ value: Any?) throws -> [String: Any] { + try XCTUnwrap(value as? [String: Any]) + } + + /// 匿名完整快照,状态和权限来自显式合同字段,不依赖真实账号或设备。 + private static func snapshot(version: Int = 1, state: String = "executing", phase: String = "shooting", + changes: [String: Any] = [:]) throws -> DroneDockShootingResponse { + let starting = state == "starting" + let control = DroneDockShootingTaskTestData.flightControl(state: state, batch: 9001, + canPause: !starting, resumePhase: phase, droneInDock: starting ? "inside" : "outside", + isAirborne: !starting) + let payload: [String: Any] = ["order_flight_task_id": 501, "execution_batch": 9001, + "state_version": version, "snapshot_kind": "full", "task": ["id": 501, "status": 20], + "order_flight_task": ["id": 501, "status": 20], + "current_plane": ["id": 58, "sn_number": "TEST-TRACE-058", "work_status": 2], + "flight_control": control, "ui": ["phase": phase], + "execute_gate": ["can_execute": phase == "arrived_pending_start", "primary_action": "start_shoot"]] + return try DroneDockShootingTaskTestData.response(changes: payload.merging(changes) { _, new in new }) + } +} + +/// 每个用例拥有独立日志和内存服务,诊断代码无法转发网络。 +@MainActor +private struct DroneTaskTraceFixture { + let output: DroneTaskTraceOutput + let service: DroneDockShootingTaskTestService + let commands: DroneTaskTraceCommandService + let model: DroneDockShootingTaskViewModel + + init(snapshot: DroneDockShootingResponse, + countdownNow: @escaping @Sendable () -> ContinuousClock.Instant = { ContinuousClock.now }) throws { + let output = DroneTaskTraceOutput() + self.output = output + service = DroneDockShootingTaskTestService(result: .success(snapshot)) + commands = DroneTaskTraceCommandService() + let context = DroneDockShootingTaskTestData.context() + model = DroneDockShootingTaskViewModel(context: context, taskID: 501, + order: try DroneDockShootingTaskTestData.order(), service: service, commandService: commands, + countdownNow: countdownNow, diagnostics: DroneDockTaskDiagnostics(sink: { output.append($0) }), + currentContext: { context }) + } +} + +/// 受理回执显式回显客户端幂等键,随后由测试注入完整设备确认快照。 +@MainActor +private final class DroneTaskTraceCommandService: DroneDockCommandSending { + private(set) var requests: [(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String)] = [] + + func sendCommand(taskID: Int, command: DroneDockSafetyCommand, clientRequestID: String) async throws -> DroneDockCommandResponse { + requests.append((taskID, command, clientRequestID)) + let payload: [String: Any] = ["order_flight_task_id": taskID, "execution_batch": 9001, + "state_version": 2, "plane_id": 58, "airport_sn": "TEST-TRACE-058", "accepted": true, + "device_confirmed": false, "command": command.rawValue, "command_id": "TRACE-COMMAND-1", + "client_request_id": clientRequestID, + "pending_command": ["command": command.rawValue, "command_id": "TRACE-COMMAND-1", + "client_request_id": clientRequestID, "status": "pending", "message": ""]] + return try JSONDecoder().decode(DroneDockCommandResponse.self, + from: JSONSerialization.data(withJSONObject: payload)) + } +} + +/// 线程安全保存原始日志;读取时解析真实输出,任何无效 JSON 都会令测试失败。 +private final class DroneTaskTraceOutput: @unchecked Sendable { + private let lock = NSLock() + private var messages: [String] = [] + + func append(_ message: String) { + lock.lock() + defer { lock.unlock() } + messages.append(message) + } + + func all() throws -> [[String: Any]] { + lock.lock() + let snapshot = messages + lock.unlock() + return try snapshot.map { try XCTUnwrap(JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any]) } + } + + func events(_ name: String) throws -> [[String: Any]] { + try all().filter { $0["event"] as? String == name } + } + + func last(_ name: String) throws -> [String: Any] { + try XCTUnwrap(events(name).last, "未收到关键事件 \(name)") + } +} diff --git a/suixinkanTests/DroneDockViewModelTests.swift b/suixinkanTests/DroneDockViewModelTests.swift new file mode 100644 index 0000000..1f2cce2 --- /dev/null +++ b/suixinkanTests/DroneDockViewModelTests.swift @@ -0,0 +1,196 @@ +import XCTest +@testable import suixinkan + +/// 验证首轮机巢 UI 的订单范围、履约分类、任务恢复与遥测占位规则。 +final class DroneDockViewModelTests: XCTestCase { + func testOrdersAreScopedToCurrentUserAndScenic() { + let visible = order(id: "mine") + let otherUser = order(id: "other-user", userID: "another-user") + let otherScenic = order(id: "other-scenic", scenicID: "another-scenic") + let store = DroneDockDemoStore(context: context, orders: [visible, otherUser, otherScenic], devices: []) + + XCTAssertEqual(DroneDockWorkbenchViewModel(store: store).orders.map(\.id), ["mine"]) + XCTAssertEqual(DroneShootingOrdersViewModel(store: store).orders.map(\.id), ["mine"]) + } + + func testZeroQuotaReturningOrderLeavesHomeButRetainsTaskInCompletedTab() { + let returning = order(id: "returning", total: 1, successful: 1, task: task(.returning, result: .succeeded)) + let pending = order(id: "pending") + let store = DroneDockDemoStore(context: context, orders: [returning, pending], devices: []) + let home = DroneDockWorkbenchViewModel(store: store) + let completed = DroneShootingOrdersViewModel(store: store, initialFilter: .completed) + + XCTAssertEqual(home.orders.map(\.id), ["pending"]) + XCTAssertEqual(completed.orders.map(\.id), ["returning"]) + XCTAssertEqual(completed.orders.first?.primaryAction, .viewCurrentTask) + XCTAssertEqual(completed.orders.first?.statusTitle, "返航中") + XCTAssertEqual(completed.orders.first?.fulfillmentState, .completed) + } + + func testActiveOrderIsStablyPinnedAheadOfOtherEligibleOrders() { + let first = order(id: "first") + let active = order(id: "active", task: task(.arrived)) + let partial = order(id: "partial", total: 5, successful: 2) + let store = DroneDockDemoStore(context: context, orders: [first, active, partial], devices: []) + + XCTAssertEqual(DroneDockWorkbenchViewModel(store: store).orders.map(\.id), ["active", "first", "partial"]) + } + + func testPartiallyShotOrderRemainsInProgressWithoutFlight() { + let partial = order(id: "partial", total: 5, successful: 2) + XCTAssertNil(partial.activeTask) + XCTAssertEqual(partial.fulfillmentState, .inProgress) + XCTAssertEqual(partial.remainingShootingCount, 3) + XCTAssertEqual(partial.primaryAction, .continueShooting) + XCTAssertTrue(DroneShootingOrderFilter.inProgress.includes(partial)) + XCTAssertFalse(DroneShootingOrderFilter.pending.includes(partial)) + } + + func testFiltersUseFulfillmentInsteadOfUploadOrDelivery() { + let pending = order(id: "pending") + let partial = order(id: "partial", total: 5, successful: 2, material: .failed) + let completedUploading = order(id: "uploading", total: 1, successful: 1, material: .uploading) + let completedConfirmed = order( + id: "confirmed", total: 5, successful: 5, material: .ready, + delivered: 2, confirmation: .confirmed + ) + let viewModel = DroneShootingOrdersViewModel(store: DroneDockDemoStore( + context: context, orders: [pending, partial, completedUploading, completedConfirmed], devices: [] + )) + + XCTAssertEqual(viewModel.count(for: .all), 4) + XCTAssertEqual(viewModel.count(for: .pending), 1) + XCTAssertEqual(viewModel.count(for: .inProgress), 1) + XCTAssertEqual(viewModel.count(for: .completed), 2) + viewModel.selectFilter(.completed) + XCTAssertEqual(viewModel.orders.map(\.id), ["uploading", "confirmed"]) + } + + func testPrimaryActionPreservesStartContinueRecoveryAndCurrentTaskMeaning() { + XCTAssertEqual(order(id: "new").primaryAction, .startShooting) + XCTAssertEqual(order(id: "partial", total: 3, successful: 1).primaryAction, .continueShooting) + XCTAssertEqual(order(id: "failed", needsRepreparation: true).primaryAction, .prepareAgain) + XCTAssertEqual(order(id: "done", total: 1, successful: 1).primaryAction, .none) + for phase in DroneShootingTaskPhase.allCases { + XCTAssertEqual(order(id: phase.rawValue, task: task(phase)).primaryAction, .viewCurrentTask) + } + } + + func testSevenTaskLabelsAndIndependentSuccessfulReturn() { + XCTAssertEqual(DroneShootingTaskPhase.allCases.map(\.title), [ + "前往拍摄点中", "已到达,待拍摄", "拍摄中", "拍摄已暂停", "返航中", "返航已暂停", "任务状态待确认" + ]) + let succeeded = order(id: "success", total: 3, successful: 1, task: task(.returning, result: .succeeded)) + XCTAssertEqual(succeeded.activeTask?.shootingResult, .succeeded) + XCTAssertEqual(succeeded.activeTask?.phase, .returning) + XCTAssertEqual(succeeded.remainingShootingCount, 2) + XCTAssertEqual(succeeded.primaryAction.title, "查看当前任务") + } + + func testRepeatedPageRefreshDoesNotChangeTaskOrConsumeQuota() { + let active = order(id: "active", total: 5, successful: 2, task: task(.unconfirmed, result: .unknown)) + let store = DroneDockDemoStore(context: context, orders: [active], devices: []) + let home = DroneDockWorkbenchViewModel(store: store) + let list = DroneShootingOrdersViewModel(store: store) + + for _ in 0..<5 { + home.refresh() + list.selectFilter(.inProgress) + list.refresh() + } + + XCTAssertEqual(home.orders, [active]) + XCTAssertEqual(list.orders, [active]) + XCTAssertEqual(store.orders.first?.remainingShootingCount, 3) + } + + func testScenicSwitchPreservesOriginalTaskOnReturn() { + let original = order(id: "active", task: task(.shootingPaused)) + let store = DroneDockDemoStore(context: context, orders: [original], devices: []) + let home = DroneDockWorkbenchViewModel(store: store) + let other = DroneDockContext( + scenicID: "another-scenic", scenicName: "另一景区", + userID: context.userID, photographerName: context.photographerName + ) + + home.switchContext(to: other) + XCTAssertNil(home.order(id: original.id)) + XCTAssertTrue(home.orders.allSatisfy { $0.scenicID == other.scenicID }) + home.switchContext(to: context) + XCTAssertEqual(home.orders, [original]) + XCTAssertEqual(home.orders.first?.activeTask?.phase, .shootingPaused) + } + + func testUnknownTelemetryDiffersFromMeasuredZero() { + let unknown = DroneDockTelemetry.unknown + XCTAssertNil(unknown.batteryProgress) + XCTAssertEqual([ + unknown.batteryText, unknown.temperatureText, unknown.windText, + unknown.rainText, unknown.signalText, unknown.satelliteText + ], Array(repeating: "—", count: 6)) + + let zero = DroneDockTelemetry( + batteryPercent: 0, temperatureCelsius: 0, windSpeed: 0, + rainDescription: "无雨", signalDescription: "无信号", satelliteCount: 0 + ) + XCTAssertEqual(zero.batteryProgress, 0) + XCTAssertEqual(zero.batteryText, "0%") + XCTAssertEqual(zero.temperatureText, "0.0°C") + XCTAssertEqual(zero.windText, "0m/s") + XCTAssertEqual(zero.satelliteText, "0颗") + } + + func testPaymentOriginCanOpenPendingFilterWithoutChangingDefaultAllEntry() { + let store = DroneDockDemoStore(context: context) + XCTAssertEqual(DroneShootingOrdersViewModel(store: store).selectedFilter, .all) + let fromPayment = DroneShootingOrdersViewModel(store: store, initialFilter: .pending) + XCTAssertEqual(fromPayment.selectedFilter, .pending) + XCTAssertTrue(fromPayment.orders.allSatisfy { $0.fulfillmentState == .pending }) + } + + #if DEBUG + func testScenarioChangesAreVisibleToSharedOrderPageOnRefresh() { + let store = DroneDockDemoStore(context: context) + let home = DroneDockWorkbenchViewModel(store: store) + let completed = DroneShootingOrdersViewModel(store: store, initialFilter: .completed) + + home.applyScenario(.completedReturning) + completed.refresh() + let returning = completed.orders.first { $0.activeTask?.phase == .returning } + XCTAssertNotNil(returning) + XCTAssertEqual(returning?.remainingShootingCount, 0) + XCTAssertFalse(home.orders.contains { $0.id == returning?.id }) + + home.applyScenario(.emptyOrders) + completed.refresh() + XCTAssertTrue(home.orders.isEmpty) + XCTAssertTrue(completed.orders.isEmpty) + XCTAssertEqual(home.statistics.orderCount, 0) + } + #endif + + private var context: DroneDockContext { + DroneDockContext(scenicID: "scenic", scenicName: "测试景区", userID: "user", photographerName: "工作人员") + } + + private func task( + _ phase: DroneShootingTaskPhase, result: DroneShootingResult = .inProgress + ) -> DroneShootingTask { + DroneShootingTask(id: "test-task", phase: phase, shootingResult: result) + } + + private func order( + id: String, scenicID: String = "scenic", userID: String = "user", + total: Int = 1, successful: Int = 0, task: DroneShootingTask? = nil, + needsRepreparation: Bool = false, material: DroneShootingMaterialState = .none, + delivered: Int = 0, confirmation: DroneVisitorConfirmationState = .none + ) -> DroneShootingOrder { + DroneShootingOrder( + id: id, scenicID: scenicID, assignedUserID: userID, customerName: "游客136****2806", + orderNumber: "TEST-\(id)", createdAtText: "10-23 09:00", packageName: "测试航拍套餐", + totalShootingCount: total, successfulShootingCount: successful, + activeTask: task, needsRepreparation: needsRepreparation, materialState: material, + deliveredVideoCount: delivered, visitorConfirmationState: confirmation + ) + } +} diff --git a/suixinkanTests/DroneDockViewTests.swift b/suixinkanTests/DroneDockViewTests.swift new file mode 100644 index 0000000..c311fd3 --- /dev/null +++ b/suixinkanTests/DroneDockViewTests.swift @@ -0,0 +1,285 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 在真机窗口中验证机巢页面的交互连线与布局,并保留视觉验收截图。 +@MainActor +final class DroneDockViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 本地订单演示也仅在成功拍满套餐后显示游客确认,复用回未拍满状态不能保留入口。 + func testDemoVisitorConfirmationRequiresFullSuccessfulQuota() throws { + let card = DroneShootingOrderCardView() + var confirmationCount = 0 + card.onConfirmationTap = { confirmationCount += 1 } + for (total, used, visible) in [(5, 4, false), (5, 5, true), (5, 4, false), (0, 0, false)] { + let order = DroneShootingOrder(id: "quota", scenicID: "local", assignedUserID: "local", + customerName: "本地游客", orderNumber: "TEST-QUOTA", createdAtText: "10-30 10:00", + packageName: "测试套餐", totalShootingCount: total, successfulShootingCount: used, + activeTask: nil, needsRepreparation: false, materialState: .ready, deliveredVideoCount: 1, + visitorConfirmationState: .none) + card.apply(order: order) + let control = try XCTUnwrap(find(in: card, identifier: "drone.order.quota.confirmation") as? UIControl) + XCTAssertEqual(control.isHidden, !visible) + XCTAssertEqual(control.isEnabled, visible) + control.sendActions(for: .touchUpInside) + } + XCTAssertEqual(confirmationCount, 1) + } + + /// 零次订单仍在返航时,完整订单卡保留当前任务入口,渲染及点击都不改变次数。 + func testCompletedReturningCardKeepsCurrentTaskActionWithoutChangingQuota() async throws { + let order = returningOrder() + let store = DroneDockDemoStore(context: .demo, orders: [order], devices: []) + let controller = UIViewController() + controller.title = "返航中的已完成订单" + controller.view.backgroundColor = .systemGroupedBackground + let card = DroneShootingOrderCardView() + card.translatesAutoresizingMaskIntoConstraints = false + controller.view.addSubview(card) + NSLayoutConstraint.activate([ + card.leadingAnchor.constraint(equalTo: controller.view.leadingAnchor, constant: 16), + card.trailingAnchor.constraint(equalTo: controller.view.trailingAnchor, constant: -16), + card.topAnchor.constraint(equalTo: controller.view.safeAreaLayoutGuide.topAnchor, constant: 16) + ]) + var currentTaskTapCount = 0 + var deliveryTapCount = 0 + card.onShootingTap = { currentTaskTapCount += 1 } + card.onDeliveryTap = { deliveryTapCount += 1 } + card.apply(order: order) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { card.bounds.height > 0 } + + let action = try button(in: card, identifier: "drone.order.\(order.id).primary") + XCTAssertEqual(action.title(for: .normal), "查看当前任务") + assertVisibleAndEnabled(action, in: window) + XCTAssertTrue(labels(in: card).contains { $0.text == "返航中" }) + for _ in 0..<3 { + card.apply(order: order) + action.sendActions(for: .touchUpInside) + } + + XCTAssertEqual(currentTaskTapCount, 3) + XCTAssertEqual(deliveryTapCount, 0) + XCTAssertEqual(store.orders, [order]) + XCTAssertEqual(store.orders.first?.remainingShootingCount, 0) + XCTAssertEqual(store.orders.first?.activeTask?.shootingResult, .succeeded) + assertUnambiguousVisibleLayout(in: card) + capture(window, named: "机巢-零次仍返航订单卡") + } + + /// 工作台实际展示本地设备与订单,查看全部通过真实按钮进入共享数据的订单页。 + func testWorkbenchRendersAndViewAllOpensOrders() async throws { + let store = DroneDockDemoStore() + let controller = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller.view, identifier: "drone.workbench.list") + try await settle(window: window) { + !list.visibleCells.isEmpty && self.find(in: controller.view, identifier: "drone.workbench.allOrders") != nil + } + + XCTAssertEqual(controller.title, "机巢工作台") + let firstDevice = try XCTUnwrap(store.devices.first) + XCTAssertTrue(allViews(in: controller.view).contains { $0.accessibilityIdentifier == "drone.device.\(firstDevice.id)" }) + XCTAssertTrue(controller.navigationItem.rightBarButtonItems?.contains { $0.accessibilityLabel == "收款码" } == true) + let viewAll = try button(in: controller.view, identifier: "drone.workbench.allOrders") + assertVisibleAndEnabled(viewAll, in: window) + assertUnambiguousVisibleLayout(in: controller.view) + capture(window, named: "机巢-工作台首屏") + + viewAll.sendActions(for: .touchUpInside) + try await settle(window: window) { + controller.navigationController?.topViewController is DroneShootingOrdersViewController + && controller.navigationController?.transitionCoordinator == nil + } + let ordersController = try XCTUnwrap(controller.navigationController?.topViewController as? DroneShootingOrdersViewController) + let ordersList = try collection(in: ordersController.view, identifier: "drone.orders.list") + try await settle(window: window) { ordersList.numberOfSections > 0 && ordersList.numberOfItems(inSection: 0) == store.orders.count } + let allFilter = try button(in: ordersController.view, identifier: "drone.orders.filter.all") + XCTAssertTrue(allFilter.accessibilityTraits.contains(.selected)) + capture(window, named: "机巢-查看全部进入拍摄订单") + } + + /// 通过真实 Tab 切到已完成后,零次返航订单仍可回到同一任务,素材和交付状态不改变分类。 + func testCompletedOrdersRenderAndKeepReturningTaskCallback() async throws { + let demo = DroneDockDemoStore() + let returning = returningOrder() + let store = DroneDockDemoStore(context: .demo, orders: [returning] + demo.orders, devices: demo.devices) + let originalOrders = store.orders + let viewModel = DroneShootingOrdersViewModel(store: store) + let controller = DroneShootingOrdersViewController(viewModel: viewModel) + let delegate = DroneDockOrdersDelegateSpy() + controller.delegate = delegate + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller.view, identifier: "drone.orders.list") + try await settle(window: window) { list.numberOfSections > 0 && list.numberOfItems(inSection: 0) == originalOrders.count } + + let completedTab = try button(in: controller.view, identifier: "drone.orders.filter.completed") + assertVisibleAndEnabled(completedTab, in: window) + completedTab.sendActions(for: .touchUpInside) + let completedCount = originalOrders.filter { $0.fulfillmentState == .completed }.count + try await settle(window: window) { + viewModel.selectedFilter == .completed + && list.numberOfSections > 0 && list.numberOfItems(inSection: 0) == completedCount + && self.find(in: controller.view, identifier: "drone.order.\(returning.id).primary") != nil + } + + XCTAssertTrue(completedTab.accessibilityTraits.contains(.selected)) + XCTAssertTrue(viewModel.orders.allSatisfy { $0.remainingShootingCount == 0 }) + XCTAssertEqual(viewModel.orders.first?.id, returning.id) + let currentTask = try button(in: controller.view, identifier: "drone.order.\(returning.id).primary") + XCTAssertEqual(currentTask.title(for: .normal), "查看当前任务") + assertVisibleAndEnabled(currentTask, in: window) + assertUnambiguousVisibleLayout(in: controller.view) + capture(window, named: "机巢-已完成订单含零次返航") + currentTask.sendActions(for: .touchUpInside) + + XCTAssertEqual(delegate.shootingOrders, [returning]) + XCTAssertTrue(delegate.materialOrders.isEmpty) + XCTAssertTrue(delegate.deliveryOrders.isEmpty) + XCTAssertEqual(store.orders, originalOrders) + + let pendingTab = try button(in: controller.view, identifier: "drone.orders.filter.pending") + pendingTab.sendActions(for: .touchUpInside) + try await settle(window: window) { + viewModel.selectedFilter == .pending + && list.numberOfSections > 0 && list.numberOfItems(inSection: 0) == viewModel.orders.count + } + XCTAssertFalse(viewModel.orders.contains { $0.id == returning.id }) + XCTAssertTrue(viewModel.orders.allSatisfy { $0.fulfillmentState == .pending }) + } + + /// 创建真实场景中的临时窗口,不更改会话或权限。 + private func makeWindow(root controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + /// 关闭临时窗口并恢复测试前的主窗口。 + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待 Diffable 快照及导航布局完成,再给自适应单元格一次稳定布局机会。 + private func settle(window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<150 { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 350_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("机巢页面未在预期时间内完成快照和布局") + throw NSError(domain: "DroneDockViewTests", code: 1) + } + + /// 仅查询实际视图树中的控件,避免依赖页面私有存储。 + private func allViews(in view: UIView) -> [UIView] { + [view] + view.subviews.flatMap { allViews(in: $0) } + } + + private func find(in view: UIView, identifier: String) -> UIView? { + allViews(in: view).first { $0.accessibilityIdentifier == identifier } + } + + private func button(in view: UIView, identifier: String) throws -> UIButton { + try XCTUnwrap(find(in: view, identifier: identifier) as? UIButton, "缺少按钮 \(identifier)") + } + + private func collection(in view: UIView, identifier: String) throws -> UICollectionView { + try XCTUnwrap(find(in: view, identifier: identifier) as? UICollectionView, "缺少列表 \(identifier)") + } + + private func labels(in view: UIView) -> [UILabel] { + allViews(in: view).compactMap { $0 as? UILabel } + } + + /// 排除隐藏祖先的控件,检查实际可见按钮有可触达的面积。 + private func assertVisibleAndEnabled(_ button: UIButton, in window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertTrue(button.isEnabled, file: file, line: line) + XCTAssertFalse(isHiddenByAncestor(button), file: file, line: line) + let frame = button.convert(button.bounds, to: window) + XCTAssertGreaterThan(frame.width, 0, file: file, line: line) + XCTAssertGreaterThanOrEqual(frame.height, 30, file: file, line: line) + XCTAssertTrue(window.bounds.contains(frame), "按钮超出窗口:\(frame)", file: file, line: line) + } + + /// 只检查可见且参与约束布局的应用内容,不检查 UIKit 私有视图或隐藏复用内容。 + private func assertUnambiguousVisibleLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = allViews(in: root).filter { + !$0.translatesAutoresizingMaskIntoConstraints && !isHiddenByAncestor($0) + && !$0.bounds.isEmpty && !String(describing: type(of: $0)).hasPrefix("_") && $0.hasAmbiguousLayout + } + let descriptions = ambiguous.map { "\(type(of: $0)) \($0.accessibilityIdentifier ?? "") \($0.frame)" } + XCTAssertTrue(ambiguous.isEmpty, "布局存在歧义:\(descriptions)", file: file, line: line) + } + + private func isHiddenByAncestor(_ view: UIView) -> Bool { + if view.isHidden || view.alpha < 0.01 { return true } + return view.superview.map { isHiddenByAncestor($0) } ?? false + } + + /// 将页面保留到真机 xcresult,供开发者按新版原型进行视觉复核。 + private func capture(_ window: UIWindow, named name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } + + /// 构造已成功扣完一次、但无人机仍在返航的确定性订单。 + private func returningOrder() -> DroneShootingOrder { + DroneShootingOrder( + id: "ui-returning-completed", scenicID: DroneDockContext.demo.scenicID, + assignedUserID: DroneDockContext.demo.userID, customerName: "游客136****2806", + orderNumber: "HT202610230001", createdAtText: "10-23 09:00", packageName: "单次航拍", + totalShootingCount: 1, successfulShootingCount: 1, + activeTask: DroneShootingTask(id: "ui-returning-task", phase: .returning, shootingResult: .succeeded), + needsRepreparation: false, materialState: .uploading, deliveredVideoCount: 0, + visitorConfirmationState: .none + ) + } +} + +/// 记录订单页发出的语义导航回调,不弹出未完成的下级业务页面。 +@MainActor +private final class DroneDockOrdersDelegateSpy: DroneShootingOrdersViewControllerDelegate { + var shootingOrders: [DroneShootingOrder] = [] + var materialOrders: [DroneShootingOrder] = [] + var deliveryOrders: [DroneShootingOrder] = [] + + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectShooting order: DroneShootingOrder) { + shootingOrders.append(order) + } + + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectMaterials order: DroneShootingOrder) { + materialOrders.append(order) + } + + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectDelivery order: DroneShootingOrder) { + deliveryOrders.append(order) + } + + func shootingOrdersViewController(_ controller: DroneShootingOrdersViewController, didSelectConfirmation order: DroneShootingOrder) {} +} diff --git a/suixinkanTests/DroneMaterialPreviewViewTests.swift b/suixinkanTests/DroneMaterialPreviewViewTests.swift new file mode 100644 index 0000000..3c1e022 --- /dev/null +++ b/suixinkanTests/DroneMaterialPreviewViewTests.swift @@ -0,0 +1,192 @@ +import AVFoundation +import AVKit +import UIKit +import XCTest +@testable import suixinkan + +/// 在真机窗口验证素材预览的就绪过滤、初始页、静帧说明和关闭路径。 +@MainActor +final class DroneMaterialPreviewViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 本地演示视频随应用打包,点击播放才呈现播放器,不访问远程媒体。 + func testBundledDemoVideoIsPlayableAndOpensOnlyAfterTap() async throws { + let url = try XCTUnwrap(Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4")) + XCTAssertTrue(url.isFileURL) + let playable = try await AVURLAsset(url: url).load(.isPlayable) + XCTAssertTrue(playable) + let material = DroneMaterial(id: "local-video", title: "演示视频", kind: .video, + previewURL: url, durationText: "00:03") + let controller = DroneMaterialPreviewViewController(items: [material], initialMaterialID: material.id) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { + self.find(in: controller.view, identifier: "drone.material.preview.play") != nil + } + XCTAssertNil(controller.presentedViewController) + let play = try XCTUnwrap(find(in: controller.view, identifier: "drone.material.preview.play") as? UIButton) + assertHitTestReaches(play, in: window) + play.sendActions(for: .touchUpInside) + try await settle(window: window) { controller.presentedViewController is AVPlayerViewController } + let player = try XCTUnwrap(controller.presentedViewController as? AVPlayerViewController) + XCTAssertEqual((player.player?.currentItem?.asset as? AVURLAsset)?.url, url) + player.player?.pause() + player.dismiss(animated: false) + } + + /// 指定素材从过滤后的正确页打开,真实本地图可见并保留预览截图。 + func testReadyMaterialsOpenAtRequestedPageAndRenderLocalImage() async throws { + let items = [ + DroneMaterial(id: "photo-01", title: "素材01", previewAssetName: "drone_demo_mountain"), + DroneMaterial(id: "failed-02", title: "素材02", uploadState: .failed), + DroneMaterial(id: "photo-03", title: "素材03", previewAssetName: "drone_demo_pagoda") + ] + let controller = DroneMaterialPreviewViewController(items: items, initialMaterialID: "photo-03") + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window: window) { + self.previewImage(in: controller.view, title: "素材03", window: window) != nil + } + + let labels = visibleViews(in: controller.view).compactMap { $0 as? UILabel } + XCTAssertTrue(labels.contains { $0.text == "2 / 2" }) + XCTAssertTrue(labels.contains { $0.text == "照片 · 本地演示图片" }) + XCTAssertFalse(labels.contains { $0.text?.contains("素材02") == true }) + let image = try XCTUnwrap(previewImage(in: controller.view, title: "素材03", window: window)) + XCTAssertNotNil(image.image) + XCTAssertEqual(image.accessibilityLabel, "素材03") + XCTAssertGreaterThan(image.bounds.width, 100) + XCTAssertGreaterThan(image.bounds.height, 100) + assertHitTestReaches(image, in: window) + let close = try XCTUnwrap(find(in: controller.view, identifier: "drone.material.preview.close") as? UIButton) + assertVisible(close, in: window) + XCTAssertFalse(visibleViews(in: controller.view).contains { + !$0.translatesAutoresizingMaskIntoConstraints && !String(describing: type(of: $0)).hasPrefix("_") && $0.hasAmbiguousLayout + }) + capture(window, named: "机巢-素材预览-就绪图片与页码") + } + + /// 无本地片源的视频明确标识为静帧,关闭后回到原页面而不触发播放或其他操作。 + func testVideoWithoutLocalClipShowsHonestStillFrameAndCloses() async throws { + let material = DroneMaterial(id: "video-01", title: "素材视频01", kind: .video, + previewAssetName: "drone_demo_mountain", previewURL: nil) + let host = UIViewController() + host.view.backgroundColor = .systemBackground + host.view.accessibilityIdentifier = "drone.material.preview.testHost" + let window = makeWindow(root: host) + defer { close(window) } + let controller = DroneMaterialPreviewViewController(items: [material], initialMaterialID: material.id) + host.present(controller, animated: false) + try await settle(window: window) { + controller.view.window != nil && controller.presentingViewController === host + && self.previewImage(in: controller.view, title: material.title, window: window) != nil + } + + let labels = visibleViews(in: controller.view).compactMap { $0 as? UILabel } + XCTAssertTrue(labels.contains { $0.text == "视频 · 本地演示静帧 · 暂无演示视频" }) + XCTAssertFalse(visibleViews(in: controller.view).contains { $0.accessibilityIdentifier == "drone.material.preview.play" }) + XCTAssertNil(controller.presentedViewController) + capture(window, named: "机巢-素材预览-视频静帧明确说明") + let close = try XCTUnwrap(find(in: controller.view, identifier: "drone.material.preview.close") as? UIButton) + assertHitTestReaches(close, in: window) + close.sendActions(for: .touchUpInside) + try await settle(window: window) { host.presentedViewController == nil } + XCTAssertTrue(window.rootViewController === host) + XCTAssertNotNil(host.view.window) + } + + /// 使用真机当前场景创建隔离窗口,保持测试前的主窗口可恢复。 + private func makeWindow(root controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.rootViewController = controller + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待分页快照和关闭转场完成后验证实际可见内容。 + private func settle(window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<150 { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 250_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("素材预览未在预期时间内完成布局或关闭") + throw NSError(domain: "DroneMaterialPreviewViewTests", code: 1) + } + + private func allViews(in view: UIView) -> [UIView] { + [view] + view.subviews.flatMap { allViews(in: $0) } + } + + private func visibleViews(in view: UIView) -> [UIView] { + allViews(in: view).filter { + !isHiddenByAncestor($0) && !$0.bounds.isEmpty && $0.convert($0.bounds, to: view).intersects(view.bounds) + } + } + + private func find(in view: UIView, identifier: String) -> UIView? { + allViews(in: view).first { $0.accessibilityIdentifier == identifier } + } + + /// 等待有真实图像尺寸且中心触摸可达的当前页,不能仅以标题出现判定预览完成。 + private func previewImage(in view: UIView, title: String, window: UIWindow) -> UIImageView? { + visibleViews(in: view).compactMap { $0 as? UIImageView }.first { + $0.accessibilityIdentifier == "drone.material.preview.image" && $0.accessibilityLabel == title + && $0.image != nil && $0.bounds.width > 100 && $0.bounds.height > 100 + && isHitTestReachable($0, in: window) + } + } + + private func isHitTestReachable(_ view: UIView, in window: UIWindow) -> Bool { + let center = view.convert(CGPoint(x: view.bounds.midX, y: view.bounds.midY), to: window) + guard window.bounds.contains(center), let hit = window.hitTest(center, with: nil) else { return false } + return hit === view || hit.isDescendant(of: view) + } + + /// 验证实际触摸命中目标或其子视图,捕获空尺寸、裁切或透明覆盖导致的假可见内容。 + private func assertHitTestReaches(_ view: UIView, in window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertTrue(isHitTestReachable(view, in: window), "触摸无法到达 \(view.accessibilityIdentifier ?? String(describing: type(of: view)))", file: file, line: line) + } + + private func isHiddenByAncestor(_ view: UIView) -> Bool { + if view.isHidden || view.alpha < 0.01 { return true } + return view.superview.map { isHiddenByAncestor($0) } ?? false + } + + private func assertVisible(_ button: UIButton, in window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertTrue(button.isEnabled, file: file, line: line) + let frame = button.convert(button.bounds, to: window) + XCTAssertGreaterThanOrEqual(frame.height, 44, file: file, line: line) + XCTAssertGreaterThanOrEqual(frame.width, 44, file: file, line: line) + XCTAssertTrue(window.bounds.contains(frame), file: file, line: line) + assertHitTestReaches(button, in: window, file: file, line: line) + } + + /// 把预览的静态画面保留到真机测试 xcresult 中,供按原型复核。 + private func capture(_ window: UIWindow, named name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/suixinkanTests/DroneMaterialsFlowViewTests.swift b/suixinkanTests/DroneMaterialsFlowViewTests.swift new file mode 100644 index 0000000..77b9d31 --- /dev/null +++ b/suixinkanTests/DroneMaterialsFlowViewTests.swift @@ -0,0 +1,363 @@ +import UIKit +import XCTest +@testable import suixinkan + +#if DEBUG +/// 在已连接 iPhone 的隔离窗口中验证素材入口、选择、演示下载与生命周期联动。 +@MainActor +final class DroneMaterialsFlowViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 工作台真实素材按钮进入整单素材库;预览打开和关闭不改变选择或批次。 + func testWorkbenchMaterialsSelectAllAndPreviewKeepSelectionAndBatch() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let seed = DroneMaterialsViewModel(store: store, orderID: order.id) + seed.applyScenario(.mixed) + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let navigation = try XCTUnwrap(workbench.navigationController) + let list = try collection(in: workbench.view, identifier: "drone.workbench.list") + try await settle(window) { list.numberOfSections > 2 && list.numberOfItems(inSection: 2) == 1 } + list.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.home.\(order.id)") != nil } + let card = try XCTUnwrap(find(in: workbench.view, identifier: "drone.home.\(order.id)")) + let materialEntry = try XCTUnwrap(allViews(in: card).compactMap { $0 as? UIButton }.first { + $0.accessibilityLabel?.hasPrefix("查看素材,") == true + }) + materialEntry.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneMaterialsViewController && navigation.transitionCoordinator == nil } + let controller = try XCTUnwrap(navigation.topViewController as? DroneMaterialsViewController) + let viewModel = controller.viewModel + XCTAssertNil(viewModel.pointID) + try await waitForLibrary(controller, window: window) + assertLayout(in: controller.view) + capture(window, named: "素材流程-混合上传状态") + + let selectAll = try button(in: controller.view, identifier: "drone.materials.selectAll") + selectAll.sendActions(for: .touchUpInside) + try await settle(window) { viewModel.selectedCount == viewModel.downloadableIDs.count && viewModel.selectedCount > 0 } + XCTAssertEqual(viewModel.selectedIDs, viewModel.downloadableIDs) + XCTAssertTrue(selectAll.accessibilityTraits.contains(.selected)) + capture(window, named: "素材流程-全选可下载素材") + let originalSelection = viewModel.selectedIDs + let originalBatch = viewModel.batch + let previewMaterial = try XCTUnwrap(viewModel.sections.first?.materials.first { $0.canPreview }) + let preview = try button(in: controller.view, identifier: "drone.materials.preview.\(previewMaterial.id)") + preview.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController is DroneMaterialPreviewViewController } + let previewController = try XCTUnwrap(controller.presentedViewController as? DroneMaterialPreviewViewController) + XCTAssertEqual(viewModel.selectedIDs, originalSelection) + XCTAssertEqual(viewModel.batch, originalBatch) + try button(in: previewController.view, identifier: "drone.material.preview.close").sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController == nil } + XCTAssertTrue(navigation.topViewController === controller) + XCTAssertEqual(viewModel.selectedIDs, originalSelection) + XCTAssertEqual(viewModel.batch, originalBatch) + XCTAssertEqual(store.shootingOrder(id: order.id), order) + } + + /// 整单入口可通过芯片筛选;任务成功后的真实入口只显示会话点位且不能扩大范围。 + func testWholeOrderFilterAndTaskEntryKeepDifferentPointScopes() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let wholeModel = DroneMaterialsViewModel(store: store, orderID: order.id) + wholeModel.applyScenario(.ready) + let whole = DroneMaterialsViewController(viewModel: wholeModel) + let window = makeWindow(root: whole) + defer { close(window) } + try await waitForLibrary(whole, window: window) + let allRecordCount = wholeModel.sections.count + XCTAssertGreaterThan(wholeModel.filters.count, 2) + let filter = try XCTUnwrap(wholeModel.filters.first { $0.id != nil }) + let filterID = try XCTUnwrap(filter.id) + let list = try collection(in: whole.view, identifier: "drone.materials.list") + let filterIndex = try XCTUnwrap(wholeModel.filters.firstIndex { $0.id == filterID }) + select(list, item: filterIndex, section: 1) + try await settle(window) { wholeModel.selectedFilterID == filterID && wholeModel.sections.allSatisfy { $0.pointID == filterID } } + XCTAssertLessThan(wholeModel.sections.count, allRecordCount) + let selectedChip = try XCTUnwrap(find(in: whole.view, identifier: "drone.materials.filter.\(filterID)")) + XCTAssertTrue(selectedChip.accessibilityTraits.contains(.selected)) + assertLayout(in: whole.view) + + let preparation = DroneShootingPreparationViewModel(store: store, orderID: order.id) + XCTAssertEqual(preparation.admission, .ready) + XCTAssertFalse(preparation.summon()) + XCTAssertTrue(preparation.confirmSummon()) + let taskModel = DroneShootingTaskViewModel(store: store, orderID: order.id) + taskModel.applyScenario(.succeededReturning) + let pointID = try XCTUnwrap(taskModel.session?.point.id) + let unchangedOrder = taskModel.order + let unchangedTask = taskModel.session + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let navigation = try XCTUnwrap(whole.navigationController) + navigation.setViewControllers([workbench], animated: false) + let homeList = try collection(in: workbench.view, identifier: "drone.workbench.list") + try await settle(window) { homeList.numberOfSections > 2 && homeList.numberOfItems(inSection: 2) == 1 } + homeList.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.home.\(order.id).primary") != nil } + try button(in: workbench.view, identifier: "drone.home.\(order.id).primary").sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneShootingTaskViewController && navigation.transitionCoordinator == nil } + let task = try XCTUnwrap(navigation.topViewController as? DroneShootingTaskViewController) + try button(in: task.view, identifier: "drone.task.primary").sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneMaterialsViewController && navigation.transitionCoordinator == nil } + let scoped = try XCTUnwrap(navigation.topViewController as? DroneMaterialsViewController) + try await waitForLibrary(scoped, window: window) + XCTAssertEqual(scoped.viewModel.pointID, pointID) + XCTAssertEqual(scoped.viewModel.selectedFilterID, pointID) + XCTAssertEqual(scoped.viewModel.filters.count, 1) + XCTAssertTrue(scoped.viewModel.sections.allSatisfy { $0.pointID == pointID }) + XCTAssertNil(find(in: scoped.view, identifier: "drone.materials.filter.all")) + XCTAssertTrue(visibleViews(in: scoped.view).contains { $0.accessibilityLabel?.contains("仅显示当前打卡点素材") == true }) + scoped.viewModel.selectFilter(id: nil) + XCTAssertEqual(scoped.viewModel.selectedFilterID, pointID) + XCTAssertEqual(store.shootingOrder(id: order.id), unchangedOrder) + XCTAssertEqual(store.shootingSession(orderID: order.id), unchangedTask) + assertLayout(in: scoped.view) + } + + /// 点击下载启动本地驱动并自动完成单文件,结果明确为演示且订单履约不变。 + func testDownloadButtonRunsLocalDemoDriverToSimulationCompletion() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let viewModel = DroneMaterialsViewModel(store: store, orderID: order.id) + viewModel.applyScenario(.ready) + let materialID = try XCTUnwrap(viewModel.previewMaterials.first?.id) + viewModel.toggleSelection(id: materialID) + let controller = DroneMaterialsViewController(viewModel: viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForLibrary(controller, window: window) + let download = try button(in: controller.view, identifier: "drone.materials.download") + XCTAssertTrue(download.isEnabled) + download.sendActions(for: .touchUpInside) + XCTAssertEqual(viewModel.batch?.itemIDs, [materialID]) + XCTAssertEqual(viewModel.downloadPhase, .downloading) + XCTAssertTrue(viewModel.isSelectionLocked) + assertLayout(in: controller.view) + capture(window, named: "素材流程-下载演示进行中") + + try await settle(window, timeout: 6) { viewModel.downloadPhase == .completed } + XCTAssertEqual(viewModel.material(id: materialID)?.downloadState, .completed(isSimulation: true)) + XCTAssertEqual(viewModel.completedCount, 1) + XCTAssertTrue(visibleViews(in: controller.view).compactMap { $0 as? UILabel }.contains { + $0.text?.contains("未写入系统相册") == true + }) + let selectMore = try button(in: controller.view, identifier: "drone.materials.continueSelecting") + XCTAssertTrue(selectMore.isEnabled) + XCTAssertEqual(store.shootingOrder(id: order.id), order) + assertLayout(in: controller.view) + capture(window, named: "素材流程-演示完成未写入相册") + } + + /// 后台立即停止驱动并作废旧令牌;前台保持暂停,手动继续只处理未完成项。 + func testBackgroundPausesAndForegroundRequiresManualContinueKeepingCompletedItems() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let viewModel = DroneMaterialsViewModel(store: store, orderID: order.id) + viewModel.applyScenario(.paused) + let completed = viewModel.sections.flatMap(\.materials).filter { $0.downloadState.isCompleted } + XCTAssertEqual(completed.count, 1) + let controller = DroneMaterialsViewController(viewModel: viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForLibrary(controller, window: window) + try button(in: controller.view, identifier: "drone.materials.continue").sendActions(for: .touchUpInside) + let oldBatch = try XCTUnwrap(viewModel.batch) + let pendingID = try XCTUnwrap(oldBatch.itemIDs.first { viewModel.material(id: $0)?.downloadState.isCompleted == false }) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + let pausedBatch = try XCTUnwrap(viewModel.batch) + let pausedMaterials = viewModel.sections.flatMap(\.materials) + XCTAssertTrue(pausedBatch.isPaused) + XCTAssertEqual(pausedBatch.pauseReason, .background) + XCTAssertNotEqual(pausedBatch.id, oldBatch.id) + XCTAssertEqual(viewModel.downloadPhase, .paused) + viewModel.receive(.downloadCompleted, materialID: pendingID, batchID: oldBatch.id) + XCTAssertEqual(viewModel.sections.flatMap(\.materials), pausedMaterials) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 450_000_000) + XCTAssertEqual(viewModel.batch, pausedBatch) + XCTAssertEqual(viewModel.sections.flatMap(\.materials), pausedMaterials) + assertLayout(in: controller.view) + capture(window, named: "素材流程-后台暂停待手动继续") + + try button(in: controller.view, identifier: "drone.materials.continue").sendActions(for: .touchUpInside) + let continuedBatch = try XCTUnwrap(viewModel.batch) + XCTAssertFalse(continuedBatch.isPaused) + XCTAssertNotEqual(continuedBatch.id, pausedBatch.id) + XCTAssertEqual(continuedBatch.itemIDs, pausedBatch.itemIDs) + for material in completed { XCTAssertEqual(viewModel.material(id: material.id), material) } + XCTAssertEqual(viewModel.completedCount, completed.count) + XCTAssertEqual(viewModel.material(id: pendingID)?.downloadState, .downloading(progress: 0)) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + XCTAssertEqual(store.shootingOrder(id: order.id), order) + } + + /// 重试仅重做失败项,执行时锁定选择;权限按钮只展示本地演示说明且恢复后不自动开始。 + func testRetryOnlyFailedItemsLocksSelectionAndPermissionRemainsDemoOnly() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let viewModel = DroneMaterialsViewModel(store: store, orderID: order.id) + viewModel.applyScenario(.partialFailure) + let completed = viewModel.sections.flatMap(\.materials).filter { $0.downloadState.isCompleted } + let failedIDs = Set(viewModel.sections.flatMap(\.materials).filter { $0.downloadState.isFailed }.map(\.id)) + let controller = DroneMaterialsViewController(viewModel: viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + try await waitForLibrary(controller, window: window) + assertLayout(in: controller.view) + capture(window, named: "素材流程-部分失败仅重试失败项") + try button(in: controller.view, identifier: "drone.materials.retry").sendActions(for: .touchUpInside) + XCTAssertEqual(viewModel.failedCount, 0) + for material in completed { XCTAssertEqual(viewModel.material(id: material.id), material) } + XCTAssertEqual(Set(viewModel.sections.flatMap(\.materials).filter { $0.downloadState.isRunning }.map(\.id)), failedIDs) + let selectionBefore = viewModel.selectedIDs + let filterBefore = viewModel.selectedFilterID + let libraryList = try collection(in: controller.view, identifier: "drone.materials.list") + try await settle(window) { self.find(in: controller.view, identifier: "drone.materials.selectAll") != nil } + let selectAll = try button(in: controller.view, identifier: "drone.materials.selectAll") + XCTAssertFalse(selectAll.isEnabled) + selectAll.sendActions(for: .touchUpInside) + select(libraryList, item: 1, section: 1) + XCTAssertEqual(viewModel.selectedIDs, selectionBefore) + XCTAssertEqual(viewModel.selectedFilterID, filterBefore) + XCTAssertTrue(viewModel.isSelectionLocked) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + + viewModel.applyScenario(.permissionDenied) + viewModel.selectAll() + let denied = DroneMaterialsViewController(viewModel: viewModel) + let navigation = try XCTUnwrap(controller.navigationController) + navigation.setViewControllers([denied], animated: false) + try await waitForLibrary(denied, window: window) + let deniedSelection = viewModel.selectedIDs + try button(in: denied.view, identifier: "drone.materials.permission").sendActions(for: .touchUpInside) + try await settle(window) { denied.presentedViewController is UIAlertController } + let alert = try XCTUnwrap(denied.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "无法保存到手机相册") + XCTAssertEqual(alert.actions.map(\.title), ["暂不下载", "模拟恢复权限"]) + XCTAssertTrue(alert.message?.contains("不读取或修改系统相册权限") == true) + XCTAssertEqual(viewModel.photoPermission, .denied) + XCTAssertEqual(viewModel.selectedIDs, deniedSelection) + XCTAssertNil(viewModel.batch) + alert.dismiss(animated: false) + viewModel.setPhotoPermission(.allowed) + let refresh = try XCTUnwrap(denied.navigationItem.rightBarButtonItems?.first) + let refreshAction = try XCTUnwrap(refresh.action) + XCTAssertTrue(UIApplication.shared.sendAction(refreshAction, to: refresh.target, from: refresh, for: nil)) + try await settle(window) { self.find(in: denied.view, identifier: "drone.materials.download") != nil } + XCTAssertNil(viewModel.batch) + XCTAssertEqual(viewModel.downloadPhase, .idle) + XCTAssertEqual(viewModel.selectedIDs, deniedSelection) + XCTAssertTrue(try button(in: denied.view, identifier: "drone.materials.download").isEnabled) + XCTAssertEqual(store.shootingOrder(id: order.id), order) + assertLayout(in: denied.view) + } + + /// 保留三条成功记录和一台设备,覆盖多点位素材且令工作台入口稳定可见。 + private func makeStore() -> DroneDockDemoStore { + let demo = DroneDockDemoStore() + return DroneDockDemoStore(context: .demo, orders: [demo.orders[0]], devices: Array(demo.devices.prefix(1))) + } + + private func makeWindow(root controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + private func close(_ window: UIWindow) { + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待快照、导航和布局稳定;只在完成测试中允许较长的明确驱动等待。 + private func settle(_ window: UIWindow, timeout: TimeInterval = 4, until condition: () -> Bool) async throws { + let deadline = Date().addingTimeInterval(timeout) + while Date() < deadline { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 250_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("素材流程未在预期时间内完成快照、导航或驱动回执") + throw NSError(domain: "DroneMaterialsFlowViewTests", code: 1) + } + + private func waitForLibrary(_ controller: DroneMaterialsViewController, window: UIWindow) async throws { + let list = try collection(in: controller.view, identifier: "drone.materials.list") + try await settle(window) { list.numberOfSections >= 4 && self.find(in: controller.view, identifier: "drone.materials.selectAll") != nil } + } + + /// 通过真实集合代理发送点位芯片选择,业务许可仍由页面与 ViewModel 执行。 + private func select(_ list: UICollectionView, item: Int, section: Int) { + let path = IndexPath(item: item, section: section) + guard section < list.numberOfSections, item < list.numberOfItems(inSection: section) else { + XCTFail("预期点位筛选不存在") + return + } + list.delegate?.collectionView?(list, didSelectItemAt: path) + } + + private func allViews(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews(in: $0) } } + + private func visibleViews(in root: UIView) -> [UIView] { + allViews(in: root).filter { + !isHiddenByAncestor($0) && !$0.bounds.isEmpty && $0.convert($0.bounds, to: root).intersects(root.bounds) + } + } + + private func isHiddenByAncestor(_ view: UIView) -> Bool { + if view.isHidden || view.alpha < 0.01 { return true } + return view.superview.map { isHiddenByAncestor($0) } ?? false + } + + private func find(in root: UIView, identifier: String) -> UIView? { + allViews(in: root).first { $0.accessibilityIdentifier == identifier } + } + + private func button(in root: UIView, identifier: String) throws -> UIButton { + try XCTUnwrap(find(in: root, identifier: identifier) as? UIButton, "缺少按钮 \(identifier)") + } + + private func collection(in root: UIView, identifier: String) throws -> UICollectionView { + try XCTUnwrap(find(in: root, identifier: identifier) as? UICollectionView, "缺少列表 \(identifier)") + } + + /// 仅检查应用的可见约束视图,避免把 UIKit 私有子视图计为业务布局错误。 + private func assertLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = visibleViews(in: root).filter { + !$0.translatesAutoresizingMaskIntoConstraints && !String(describing: type(of: $0)).hasPrefix("_") && $0.hasAmbiguousLayout + } + XCTAssertTrue(ambiguous.isEmpty, "布局歧义:\(ambiguous.map { String(describing: type(of: $0)) + " " + ($0.accessibilityIdentifier ?? "") })", file: file, line: line) + } + + /// 所有关键状态画面始终保留在真机 xcresult 中。 + private func capture(_ window: UIWindow, named name: String) { + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} +#endif diff --git a/suixinkanTests/DroneMaterialsFooterLayoutTests.swift b/suixinkanTests/DroneMaterialsFooterLayoutTests.swift new file mode 100644 index 0000000..84e31e2 --- /dev/null +++ b/suixinkanTests/DroneMaterialsFooterLayoutTests.swift @@ -0,0 +1,85 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证演示下载底栏的状态组合在小屏与标准宽度下不裁切、不覆盖操作。 +@MainActor +final class DroneMaterialsFooterLayoutTests: XCTestCase { + /// 选择、下载、暂停、失败、完成与权限状态在不同宽度下保持标题、说明和操作顺序。 + func testFooterStatesFitCompactAndRegularWidths() throws { + for width in [375.0, 402.0] { + let footer = DroneMaterialsFooterView() + for state in 0..<6 { + apply(state, to: footer) + layout(footer, width: width) + let primary = try XCTUnwrap(allViews(footer).first { + $0.accessibilityIdentifier == "footer.primary" + } as? UIButton) + XCTAssertGreaterThanOrEqual(primary.bounds.height, 44) + XCTAssertLessThanOrEqual(primary.convert(primary.bounds, to: footer).maxY, footer.bounds.maxY + 0.5) + for view in allViews(footer).filter({ !$0.isHidden && ($0.accessibilityIdentifier?.hasPrefix("drone.materials.footer.") == true || $0 is UIButton) && isVisible($0, within: footer) }) { + let rect = view.convert(view.bounds, to: footer) + XCTAssertGreaterThanOrEqual(rect.minX, -0.5) + XCTAssertLessThanOrEqual(rect.maxX, width + 0.5) + XCTAssertGreaterThan(view.bounds.height, 0) + } + let title = try XCTUnwrap(allViews(footer).first { $0.accessibilityIdentifier == "drone.materials.footer.title" }) + let trailing = try XCTUnwrap(allViews(footer).first { $0.accessibilityIdentifier == "drone.materials.footer.trailing" }) + if !trailing.isHidden { + XCTAssertLessThanOrEqual(title.convert(title.bounds, to: footer).maxX, + trailing.convert(trailing.bounds, to: footer).minX) + } + } + } + } + + /// 完成后回到选择状态不残留结果图标、交付按钮或旧进度;演示提示仍明确不写相册。 + func testCompletedFooterResetsCleanlyToSelection() throws { + let footer = DroneMaterialsFooterView() + apply(4, to: footer) + layout(footer, width: 375) + let delivery = try XCTUnwrap(allViews(footer).first { $0.accessibilityIdentifier == "drone.materials.completedDelivery" } as? UIButton) + XCTAssertFalse(delivery.isHidden) + XCTAssertEqual(delivery.layer.borderWidth, 1) + let detail = try XCTUnwrap(allViews(footer).first { $0.accessibilityIdentifier == "drone.materials.footer.detail" } as? UILabel) + XCTAssertTrue(detail.text?.contains("未写入系统相册") == true) + apply(0, to: footer) + layout(footer, width: 375) + XCTAssertTrue(delivery.isHidden) + XCTAssertEqual(delivery.layer.borderWidth, 0) + XCTAssertTrue(detail.isHidden) + let icon = try XCTUnwrap(allViews(footer).first { $0.accessibilityIdentifier == "drone.materials.footer.resultIcon" }) + XCTAssertTrue(icon.isHidden) + } + + private func apply(_ state: Int, to footer: DroneMaterialsFooterView) { + let titles = ["已选择2项", "本次下载2项", "下载已暂停", "部分素材下载失败", "本次素材下载完成(演示)", "无法保存到手机相册"] + let details = ["", "请保持本页开启,下载期间不可更改选择", "已完成项会保留;继续时仅处理未完成文件。", "演示成功1项 · 失败1项,已完成的无需重复下载", "2项演示完成,未写入系统相册", "演示相册权限未开启,恢复后请手动继续。"] + let symbols: [String?] = [nil, nil, "pause.circle", "exclamationmark.triangle", "checkmark.circle", "lock"] + footer.apply(title: titles[state], detail: details[state], primaryTitle: state == 3 ? "重试失败素材(1)" : "下载所选素材", + primarySymbol: "arrow.down.to.line", enabled: state != 1, identifier: "footer.primary", + progress: state == 1 || state == 2 ? 0.5 : nil, + secondaryTitle: state == 3 ? "选择其他素材" : state == 4 ? "交付成片" : nil, + tone: state == 4 ? .green : .orange, + trailingText: state == 0 ? "仅可选择已上传素材" : state == 1 || state == 2 ? "已完成1/2项" : nil, + resultSymbol: symbols[state], secondaryOutlined: state == 4) + } + + private func layout(_ footer: UIView, width: Double) { + let size = footer.systemLayoutSizeFitting(CGSize(width: width, height: 1), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + footer.frame = CGRect(origin: .zero, size: size) + footer.layoutIfNeeded() + } + + private func allViews(_ view: UIView) -> [UIView] { [view] + view.subviews.flatMap { allViews($0) } } + + private func isVisible(_ view: UIView, within root: UIView) -> Bool { + var ancestor = view.superview + while let current = ancestor, current !== root { + if current.isHidden { return false } + ancestor = current.superview + } + return true + } +} diff --git a/suixinkanTests/DroneMaterialsViewModelTests.swift b/suixinkanTests/DroneMaterialsViewModelTests.swift new file mode 100644 index 0000000..a41e435 --- /dev/null +++ b/suixinkanTests/DroneMaterialsViewModelTests.swift @@ -0,0 +1,453 @@ +import XCTest +@testable import suixinkan + +/// 验证原素材分组、点位选择、前台下载与演示保存的独立状态规则。 +final class DroneMaterialsViewModelTests: XCTestCase { + func testRecordsAreNewestFirstAndUnshotOrderDoesNotInventMaterials() { + let store = makeStore(successful: 3) + let viewModel = DroneMaterialsViewModel(store: store, orderID: "order-a") + XCTAssertEqual(viewModel.sections.map(\.sequenceNumber), [3, 2, 1]) + XCTAssertEqual(viewModel.filters.first?.title, "全部点位") + XCTAssertEqual(viewModel.previewMaterials.count, 6) + + let unshot = DroneMaterialsViewModel(store: makeStore(successful: 0, materialState: .none), orderID: "order-a") + XCTAssertTrue(unshot.sections.isEmpty) + XCTAssertFalse(unshot.canStartDownload) + } + + func testRefreshingPreviouslyEmptyLibraryAppendsNewSuccessOnceWithoutConsumingQuota() { + let store = makeStore(successful: 0, materialState: .none) + let viewModel = DroneMaterialsViewModel(store: store, orderID: "order-a") + store.replaceShootingOrder(order(successful: 1, materialState: .uploading)) + viewModel.refresh() + viewModel.refresh() + XCTAssertEqual(viewModel.sections.count, 1) + XCTAssertTrue(viewModel.sections[0].materials.allSatisfy { $0.uploadState == .uploading }) + XCTAssertEqual(store.shootingOrder(id: "order-a")?.successfulShootingCount, 1) + XCTAssertEqual(store.shootingOrder(id: "order-a")?.remainingShootingCount, 4) + } + + func testPartiallyReadyAllowsOnlyReadyPreviewAndSelectAllUsesCurrentDownloadableItems() throws { + let store = makeStore(successful: 2, materialState: .partiallyReady) + let viewModel = DroneMaterialsViewModel(store: store, orderID: "order-a") + let uploading = try XCTUnwrap(viewModel.sections.flatMap(\.materials).first { $0.uploadState == .uploading }) + XCTAssertFalse(uploading.canPreview) + viewModel.toggleSelection(id: uploading.id) + XCTAssertEqual(viewModel.selectedCount, 0) + viewModel.selectAll() + XCTAssertEqual(viewModel.selectedIDs, viewModel.downloadableIDs) + XCTAssertEqual(viewModel.selectedCount, 3) + XCTAssertTrue(viewModel.isAllSelected) + XCTAssertEqual(viewModel.previewMaterials.count, 3) + viewModel.selectAll() + XCTAssertEqual(viewModel.selectedCount, 0) + XCTAssertFalse(viewModel.isAllSelected) + } + + func testUploadFailureAndUnavailableCannotPreviewOrSelect() { + let store = makeStore(successful: 1) + let viewModel = DroneMaterialsViewModel(store: store, orderID: "order-a") + mutateLibrary(store) { state in + state.records[0].materials[0].uploadState = .failed + state.records[0].materials[1].uploadState = .unavailable + } + viewModel.selectAll() + XCTAssertEqual(viewModel.selectedCount, 0) + XCTAssertTrue(viewModel.previewMaterials.isEmpty) + XCTAssertFalse(viewModel.isAllSelected) + } + + func testChangingPointFilterClearsSelectionAndFixedTaskScopeCannotExpand() throws { + let store = makeStore(successful: 3) + let wholeOrder = DroneMaterialsViewModel(store: store, orderID: "order-a") + wholeOrder.selectAll() + let pointID = try XCTUnwrap(wholeOrder.filters.dropFirst().first?.id) + wholeOrder.selectFilter(id: pointID) + XCTAssertEqual(wholeOrder.selectedCount, 0) + XCTAssertTrue(wholeOrder.sections.allSatisfy { $0.pointID == pointID }) + wholeOrder.selectAll() + XCTAssertEqual(wholeOrder.selectedCount, wholeOrder.sections.flatMap(\.materials).count) + + let taskScope = DroneMaterialsViewModel(store: store, orderID: "order-a", pointID: pointID) + XCTAssertEqual(taskScope.filters.count, 1) + taskScope.selectFilter(id: nil) + XCTAssertEqual(taskScope.selectedFilterID, pointID) + XCTAssertTrue(taskScope.sections.allSatisfy { $0.pointID == pointID }) + let other = try XCTUnwrap(wholeOrder.filters.first { $0.id != nil && $0.id != pointID }?.id) + taskScope.selectFilter(id: other) + XCTAssertEqual(taskScope.selectedFilterID, pointID) + } + + func testStartedBatchLocksSelectionAndPreviewRefreshPreservesSelectedItems() throws { + let viewModel = makeViewModel() + viewModel.selectAll() + let originalSelection = viewModel.selectedIDs + let originalFilter = viewModel.selectedFilterID + XCTAssertTrue(viewModel.startDownload()) + let batchID = try XCTUnwrap(viewModel.batch?.id) + viewModel.toggleSelection(id: try XCTUnwrap(originalSelection.first)) + viewModel.selectAll() + viewModel.selectFilter(id: "point-sanhuang") + viewModel.refresh() // Closing a preview returns through viewWillAppear. + XCTAssertTrue(viewModel.isSelectionLocked) + XCTAssertEqual(viewModel.selectedIDs, originalSelection) + XCTAssertEqual(viewModel.selectedCount, originalSelection.count) + XCTAssertEqual(viewModel.selectedFilterID, originalFilter) + XCTAssertEqual(viewModel.batch?.id, batchID) + XCTAssertFalse(viewModel.startDownload()) + XCTAssertEqual(viewModel.previewMaterials.count, 4) + } + + func testDownloadCompletionAndAlbumSaveAreSeparateAndDuplicateSuccessIsIgnored() throws { + let viewModel = makeViewModel(successful: 1) + let id = try XCTUnwrap(viewModel.downloadableIDs.first) + viewModel.toggleSelection(id: id) + XCTAssertTrue(viewModel.startDownload()) + let batchID = try XCTUnwrap(viewModel.batch?.id) + viewModel.receive(.saveSucceeded, materialID: id, batchID: batchID) + XCTAssertEqual(viewModel.completedCount, 0) + viewModel.receive(.downloadCompleted, materialID: id, batchID: batchID) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .awaitingSave) + XCTAssertEqual(viewModel.completedCount, 0) + viewModel.receive(.saveSucceeded, materialID: id, batchID: batchID) + XCTAssertEqual(viewModel.completedCount, 0) + viewModel.receive(.saveStarted, materialID: id, batchID: batchID) + viewModel.receive(.saveSucceeded, materialID: id, batchID: batchID) + viewModel.receive(.saveSucceeded, materialID: id, batchID: batchID) + viewModel.receive(.downloadFailed(message: "迟到失败"), materialID: id, batchID: batchID) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .completed(isSimulation: true)) + XCTAssertEqual(viewModel.material(id: id)?.statusTitle, "演示完成 · 未写入相册") + XCTAssertEqual(viewModel.completedCount, 1) + XCTAssertEqual(viewModel.batchProgress, 1) + XCTAssertEqual(viewModel.downloadPhase, .completed) + } + + func testProgressIsMonotonicClampedAndRejectsNonfiniteValues() throws { + let viewModel = makeViewModel(successful: 1) + viewModel.selectAll() + viewModel.startDownload() + let batch = try XCTUnwrap(viewModel.batch) + let id = try XCTUnwrap(batch.itemIDs.first) + viewModel.receive(.progress(0.6), materialID: id, batchID: batch.id) + viewModel.receive(.progress(0.1), materialID: id, batchID: batch.id) + viewModel.receive(.progress(.nan), materialID: id, batchID: batch.id) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .downloading(progress: 0.6)) + viewModel.receive(.progress(20), materialID: id, batchID: batch.id) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .downloading(progress: 1)) + XCTAssertEqual(viewModel.completedCount, 0) + } + + func testPauseInvalidatesOldCallbacksAndResumeRestartsOnlyUnfinishedFiles() throws { + let viewModel = makeViewModel(successful: 1) + viewModel.selectAll() + viewModel.startDownload() + let original = try XCTUnwrap(viewModel.batch) + let saved = original.itemIDs[0] + let unfinished = original.itemIDs[1] + finish(viewModel, id: saved, batchID: original.id) + viewModel.receive(.progress(0.7), materialID: unfinished, batchID: original.id) + viewModel.pauseDownloads(reason: .background) + let pausedID = try XCTUnwrap(viewModel.batch?.id) + XCTAssertNotEqual(pausedID, original.id) + XCTAssertEqual(viewModel.downloadPhase, .paused) + XCTAssertEqual(viewModel.material(id: unfinished)?.downloadState, .paused) + viewModel.receive(.downloadCompleted, materialID: unfinished, batchID: original.id) + viewModel.refresh() + XCTAssertEqual(viewModel.material(id: unfinished)?.downloadState, .paused) + XCTAssertEqual(viewModel.batch?.isPaused, true) + XCTAssertTrue(viewModel.continueDownload()) + let resumedID = try XCTUnwrap(viewModel.batch?.id) + XCTAssertNotEqual(resumedID, pausedID) + XCTAssertEqual(viewModel.material(id: unfinished)?.downloadState, .downloading(progress: 0)) + XCTAssertEqual(viewModel.material(id: saved)?.downloadState, .completed(isSimulation: true)) + viewModel.receive(.downloadCompleted, materialID: unfinished, batchID: original.id) + XCTAssertEqual(viewModel.material(id: unfinished)?.downloadState, .downloading(progress: 0)) + finish(viewModel, id: unfinished, batchID: resumedID) + XCTAssertEqual(viewModel.completedCount, 2) + } + + func testLockAndLeavingPageKeepCompletedFilesAndRequireManualContinue() throws { + for reason in [DroneMaterialPauseReason.locked, .leavingPage] { + let viewModel = makeViewModel(successful: 1) + viewModel.selectAll() + viewModel.startDownload() + let batch = try XCTUnwrap(viewModel.batch) + finish(viewModel, id: batch.itemIDs[0], batchID: batch.id) + if reason == .leavingPage { viewModel.leavePage() } else { viewModel.pauseDownloads(reason: reason) } + viewModel.refresh() + XCTAssertEqual(viewModel.batch?.pauseReason, reason) + XCTAssertEqual(viewModel.completedCount, 1) + XCTAssertEqual(viewModel.pendingCount, 1) + XCTAssertEqual(viewModel.downloadPhase, .paused) + XCTAssertTrue(viewModel.continueDownload()) + } + } + + func testPauseWhileSavingKeepsDownloadedFileAndResumeDoesNotDownloadAgain() throws { + let viewModel = makeViewModel(successful: 1) + let id = try XCTUnwrap(viewModel.downloadableIDs.first) + viewModel.toggleSelection(id: id) + viewModel.startDownload() + let batch = try XCTUnwrap(viewModel.batch) + viewModel.receive(.downloadCompleted, materialID: id, batchID: batch.id) + viewModel.receive(.saveStarted, materialID: id, batchID: batch.id) + viewModel.pauseDownloads(reason: .locked) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .awaitingSave) + XCTAssertTrue(viewModel.continueDownload()) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .awaitingSave) + let resumed = try XCTUnwrap(viewModel.batch?.id) + viewModel.receive(.saveStarted, materialID: id, batchID: resumed) + viewModel.receive(.saveSucceeded, materialID: id, batchID: resumed) + XCTAssertEqual(viewModel.completedCount, 1) + } + + func testRetryOnlyFailedItemsPreservesSuccessAndRejectsOldAttemptReceipt() throws { + let viewModel = makeViewModel(successful: 1) + viewModel.selectAll() + viewModel.startDownload() + let original = try XCTUnwrap(viewModel.batch) + let success = original.itemIDs[0] + let failure = original.itemIDs[1] + finish(viewModel, id: success, batchID: original.id) + viewModel.receive(.downloadFailed(message: "演示传输失败"), materialID: failure, batchID: original.id) + XCTAssertEqual(viewModel.downloadPhase, .partialFailure) + XCTAssertFalse(viewModel.startDownload()) + XCTAssertFalse(viewModel.continueDownload()) + XCTAssertTrue(viewModel.retryFailed()) + let retriedID = try XCTUnwrap(viewModel.batch?.id) + XCTAssertNotEqual(retriedID, original.id) + XCTAssertEqual(viewModel.material(id: success)?.downloadState, .completed(isSimulation: true)) + XCTAssertEqual(viewModel.material(id: failure)?.downloadState, .downloading(progress: 0)) + viewModel.receive(.downloadFailed(message: "旧批次失败"), materialID: failure, batchID: original.id) + XCTAssertEqual(viewModel.failedCount, 0) + finish(viewModel, id: failure, batchID: retriedID) + XCTAssertEqual(viewModel.completedCount, 2) + } + + func testContinueLeavesFailedItemsUntouchedUntilSeparateRetry() throws { + let viewModel = makeViewModel(successful: 1) + viewModel.selectAll() + viewModel.startDownload() + let original = try XCTUnwrap(viewModel.batch) + let failure = original.itemIDs[0] + let pending = original.itemIDs[1] + viewModel.receive(.downloadFailed(message: "演示失败"), materialID: failure, batchID: original.id) + viewModel.pauseDownloads(reason: .background) + XCTAssertFalse(viewModel.retryFailed()) + XCTAssertTrue(viewModel.continueDownload()) + let resumed = try XCTUnwrap(viewModel.batch?.id) + XCTAssertEqual(viewModel.material(id: failure)?.downloadState, .downloadFailed(message: "演示失败")) + finish(viewModel, id: pending, batchID: resumed) + XCTAssertTrue(viewModel.retryFailed()) + XCTAssertEqual(viewModel.material(id: pending)?.downloadState, .completed(isSimulation: true)) + } + + func testSaveFailureRetriesSaveWithoutMarkingSavedOrRedownloading() throws { + let viewModel = makeViewModel(successful: 1) + let id = try XCTUnwrap(viewModel.downloadableIDs.first) + viewModel.toggleSelection(id: id) + viewModel.startDownload() + let batch = try XCTUnwrap(viewModel.batch) + viewModel.receive(.downloadCompleted, materialID: id, batchID: batch.id) + viewModel.receive(.saveStarted, materialID: id, batchID: batch.id) + viewModel.receive(.saveFailed(message: "演示空间不足"), materialID: id, batchID: batch.id) + XCTAssertEqual(viewModel.completedCount, 0) + XCTAssertEqual(viewModel.failedCount, 1) + XCTAssertTrue(viewModel.retryFailed()) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .awaitingSave) + let retryID = try XCTUnwrap(viewModel.batch?.id) + viewModel.receive(.saveStarted, materialID: id, batchID: retryID) + viewModel.receive(.saveSucceeded, materialID: id, batchID: retryID) + XCTAssertEqual(viewModel.completedCount, 1) + } + + func testPermissionDeniedCreatesNoBatchAndPermissionRestoreDoesNotAutoStart() { + let viewModel = makeViewModel() + viewModel.selectAll() + let selected = viewModel.selectedIDs + viewModel.setPhotoPermission(.denied) + XCTAssertFalse(viewModel.startDownload()) + XCTAssertNil(viewModel.batch) + XCTAssertEqual(viewModel.failedCount, 0) + XCTAssertEqual(viewModel.selectedIDs, selected) + viewModel.setPhotoPermission(.allowed) + XCTAssertNil(viewModel.batch) + XCTAssertTrue(viewModel.startDownload()) + } + + func testPermissionRevokedWhileSavingPausesInsteadOfFakingFailureOrSuccess() throws { + let viewModel = makeViewModel(successful: 1) + let id = try XCTUnwrap(viewModel.downloadableIDs.first) + viewModel.toggleSelection(id: id) + viewModel.startDownload() + let batch = try XCTUnwrap(viewModel.batch) + viewModel.receive(.downloadCompleted, materialID: id, batchID: batch.id) + viewModel.receive(.saveStarted, materialID: id, batchID: batch.id) + viewModel.setPhotoPermission(.restricted) + viewModel.receive(.saveSucceeded, materialID: id, batchID: batch.id) + XCTAssertEqual(viewModel.material(id: id)?.downloadState, .awaitingSave) + XCTAssertEqual(viewModel.completedCount, 0) + XCTAssertEqual(viewModel.failedCount, 0) + XCTAssertEqual(viewModel.batch?.pauseReason, .permissionDenied) + XCTAssertFalse(viewModel.continueDownload()) + viewModel.setPhotoPermission(.allowed) + XCTAssertEqual(viewModel.downloadPhase, .paused) + XCTAssertTrue(viewModel.continueDownload()) + } + + func testCompletedItemsPersistOnReentryCannotBeSelectedAndDoNotImplyVisitorDelivery() throws { + let store = makeStore(successful: 1) + let viewModel = DroneMaterialsViewModel(store: store, orderID: "order-a") + let before = try XCTUnwrap(store.shootingOrder(id: "order-a")) + viewModel.selectAll() + viewModel.startDownload() + let batch = try XCTUnwrap(viewModel.batch) + for id in batch.itemIDs { finish(viewModel, id: id, batchID: batch.id) } + viewModel.clearBatch() + let reopened = DroneMaterialsViewModel(store: store, orderID: "order-a") + reopened.selectAll() + XCTAssertEqual(reopened.selectedCount, 0) + XCTAssertTrue(reopened.downloadableIDs.isEmpty) + XCTAssertEqual(reopened.previewMaterials.count, 2) + XCTAssertEqual(store.shootingOrder(id: "order-a"), before) + } + + func testOrdersAndScenicContextsRejectForeignBatchCallbacksAndKeepSeparateCaches() throws { + let store = makeStore(successful: 1, includeSecondOrder: true) + let first = DroneMaterialsViewModel(store: store, orderID: "order-a") + let second = DroneMaterialsViewModel(store: store, orderID: "order-b") + first.selectAll() + first.startDownload() + second.selectAll() + second.startDownload() + let firstBatch = try XCTUnwrap(first.batch) + let secondBatch = try XCTUnwrap(second.batch) + second.receive(.downloadCompleted, materialID: secondBatch.itemIDs[0], batchID: firstBatch.id) + XCTAssertEqual(second.material(id: secondBatch.itemIDs[0])?.downloadState, .downloading(progress: 0)) + store.switchContext(to: DroneDockContext(scenicID: "other", scenicName: "其他景区", userID: "user", photographerName: "工作人员")) + first.receive(.downloadCompleted, materialID: firstBatch.itemIDs[0], batchID: firstBatch.id) + XCTAssertNil(first.order) + XCTAssertTrue(first.sections.isEmpty) + first.refresh() + store.switchContext(to: context) + first.refresh() + XCTAssertEqual(first.downloadPhase, .paused) + XCTAssertEqual(first.material(id: firstBatch.itemIDs[0])?.downloadState, .paused) + XCTAssertEqual(second.batch?.id, secondBatch.id) + } + + func testFixedPointEntryPausesAndNarrowsRunningWholeOrderBatchPreservingHiddenResults() throws { + let store = makeStore(successful: 2) + let wholeOrder = DroneMaterialsViewModel(store: store, orderID: "order-a") + let target = wholeOrder.sections[0] + let other = wholeOrder.sections[1] + wholeOrder.selectAll() + XCTAssertTrue(wholeOrder.startDownload()) + let original = try XCTUnwrap(wholeOrder.batch) + let hiddenSaved = other.materials[0].id + let hiddenDownloaded = other.materials[1].id + finish(wholeOrder, id: hiddenSaved, batchID: original.id) + wholeOrder.receive(.downloadCompleted, materialID: hiddenDownloaded, batchID: original.id) + wholeOrder.receive(.saveStarted, materialID: hiddenDownloaded, batchID: original.id) + + let fixedPoint = DroneMaterialsViewModel(store: store, orderID: "order-a", pointID: target.pointID) + let narrowed = try XCTUnwrap(fixedPoint.batch) + XCTAssertNotEqual(narrowed.id, original.id) + XCTAssertEqual(Set(narrowed.itemIDs), Set(target.materials.map(\.id))) + XCTAssertEqual(fixedPoint.downloadPhase, .paused) + XCTAssertNil(fixedPoint.material(id: hiddenSaved)) + XCTAssertTrue(fixedPoint.continueDownload()) + let resumedID = try XCTUnwrap(fixedPoint.batch?.id) + for id in narrowed.itemIDs { finish(fixedPoint, id: id, batchID: resumedID) } + fixedPoint.clearBatch() + + wholeOrder.refresh() + XCTAssertEqual(wholeOrder.material(id: hiddenSaved)?.downloadState, .completed(isSimulation: true)) + XCTAssertEqual(wholeOrder.material(id: hiddenDownloaded)?.downloadState, .awaitingSave) + XCTAssertEqual(wholeOrder.downloadableIDs, Set([hiddenDownloaded])) + XCTAssertEqual(wholeOrder.selectedIDs, Set([hiddenDownloaded])) + XCTAssertTrue(wholeOrder.isAllSelected) + XCTAssertTrue(wholeOrder.startDownload()) + XCTAssertEqual(wholeOrder.material(id: hiddenDownloaded)?.downloadState, .awaitingSave) + wholeOrder.receive(.saveSucceeded, materialID: hiddenDownloaded, batchID: original.id) + XCTAssertEqual(wholeOrder.material(id: hiddenDownloaded)?.downloadState, .awaitingSave) + } + + func testFixedPointEntryWithNoBatchIntersectionClearsBatchAndKeepsOtherPointPaused() throws { + let store = makeStore(successful: 2) + let wholeOrder = DroneMaterialsViewModel(store: store, orderID: "order-a") + let other = wholeOrder.sections[0] + let target = wholeOrder.sections[1] + wholeOrder.selectFilter(id: other.pointID) + wholeOrder.selectAll() + XCTAssertTrue(wholeOrder.startDownload()) + let original = try XCTUnwrap(wholeOrder.batch) + wholeOrder.pauseDownloads(reason: .background) + + let fixedPoint = DroneMaterialsViewModel(store: store, orderID: "order-a", pointID: target.pointID) + XCTAssertNil(fixedPoint.batch) + XCTAssertFalse(fixedPoint.continueDownload()) + XCTAssertFalse(fixedPoint.isSelectionLocked) + XCTAssertTrue(fixedPoint.sections.allSatisfy { $0.pointID == target.pointID }) + XCTAssertTrue(original.itemIDs.allSatisfy { wholeOrder.material(id: $0)?.downloadState == .paused }) + fixedPoint.selectAll() + XCTAssertTrue(fixedPoint.startDownload()) + XCTAssertTrue(Set(try XCTUnwrap(fixedPoint.batch?.itemIDs)).isDisjoint(with: Set(original.itemIDs))) + } + + func testFixedPointEntryNarrowsPausedBatchAndKeepsItsAlreadyCompletedFile() throws { + let store = makeStore(successful: 2) + let wholeOrder = DroneMaterialsViewModel(store: store, orderID: "order-a") + let target = wholeOrder.sections[0] + let hidden = wholeOrder.sections[1].materials.map(\.id) + wholeOrder.selectAll() + wholeOrder.startDownload() + let original = try XCTUnwrap(wholeOrder.batch) + finish(wholeOrder, id: target.materials[0].id, batchID: original.id) + wholeOrder.pauseDownloads(reason: .background) + let fixedPoint = DroneMaterialsViewModel(store: store, orderID: "order-a", pointID: target.pointID) + XCTAssertEqual(fixedPoint.completedCount, 1) + XCTAssertEqual(fixedPoint.pendingCount, 1) + XCTAssertEqual(fixedPoint.batchTotalCount, 2) + XCTAssertTrue(fixedPoint.continueDownload()) + XCTAssertEqual(fixedPoint.material(id: target.materials[0].id)?.downloadState, .completed(isSimulation: true)) + XCTAssertEqual(fixedPoint.material(id: target.materials[1].id)?.downloadState, .downloading(progress: 0)) + XCTAssertTrue(hidden.allSatisfy { wholeOrder.material(id: $0)?.downloadState == .paused }) + } + + private var context: DroneDockContext { + DroneDockContext(scenicID: "scenic", scenicName: "测试景区", userID: "user", photographerName: "工作人员") + } + + private func order(id: String = "order-a", successful: Int, materialState: DroneShootingMaterialState = .ready) -> DroneShootingOrder { + DroneShootingOrder(id: id, scenicID: context.scenicID, assignedUserID: context.userID, + customerName: "游客136****2806", orderNumber: "TEST-\(id)", createdAtText: "10-23 09:00", + packageName: "航拍套餐", totalShootingCount: 5, successfulShootingCount: successful, + activeTask: nil, needsRepreparation: false, materialState: materialState, + deliveredVideoCount: 0, visitorConfirmationState: .none) + } + + private func makeStore(successful: Int, materialState: DroneShootingMaterialState = .ready, + includeSecondOrder: Bool = false) -> DroneDockDemoStore { + var orders = [order(successful: successful, materialState: materialState)] + if includeSecondOrder { orders.append(order(id: "order-b", successful: successful, materialState: materialState)) } + return DroneDockDemoStore(context: context, orders: orders, devices: []) + } + + private func makeViewModel(successful: Int = 2) -> DroneMaterialsViewModel { + DroneMaterialsViewModel(store: makeStore(successful: successful), orderID: "order-a") + } + + private func mutateLibrary(_ store: DroneDockDemoStore, update: (inout DroneMaterialLibraryState) -> Void) { + let key = DroneShootingSessionKey(context: context, orderID: "order-a") + guard var state = store.materialLibraries[key] else { return XCTFail("缺少本地素材库") } + update(&state) + store.materialLibraries[key] = state + } + + private func finish(_ viewModel: DroneMaterialsViewModel, id: String, batchID: UUID) { + viewModel.receive(.downloadCompleted, materialID: id, batchID: batchID) + viewModel.receive(.saveStarted, materialID: id, batchID: batchID) + viewModel.receive(.saveSucceeded, materialID: id, batchID: batchID) + } +} diff --git a/suixinkanTests/DroneShootingFlowViewTests.swift b/suixinkanTests/DroneShootingFlowViewTests.swift new file mode 100644 index 0000000..e10286e --- /dev/null +++ b/suixinkanTests/DroneShootingFlowViewTests.swift @@ -0,0 +1,394 @@ +import UIKit +import XCTest +@testable import suixinkan + +#if DEBUG +/// 使用真机临时窗口验证准备与任务的实际导航、按钮行为和可见布局。 +@MainActor +final class DroneShootingFlowViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 从工作台按钮进入准备,召唤只提交一次;返回工作台后恢复同一个任务。 + func testWorkbenchPreparationTaskAndBackRestoreOriginalTaskWithoutCharging() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let originalQuota = order.remainingShootingCount + let workbench = DroneDockWorkbenchViewController(viewModel: DroneDockWorkbenchViewModel(store: store)) + let window = makeWindow(root: workbench) + defer { close(window) } + let navigation = try XCTUnwrap(workbench.navigationController) + let homeList = try collection(in: workbench.view, identifier: "drone.workbench.list") + try await settle(window) { homeList.numberOfSections > 2 && homeList.numberOfItems(inSection: 2) == 1 } + homeList.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.home.\(order.id).primary") != nil } + + let start = try button(in: workbench.view, identifier: "drone.home.\(order.id).primary") + XCTAssertEqual(start.title(for: .normal), "开始拍摄") + start.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneShootingPreparationViewController && navigation.transitionCoordinator == nil } + let preparation = try XCTUnwrap(navigation.topViewController as? DroneShootingPreparationViewController) + let list = try collection(in: preparation.view, identifier: "drone.preparation.list") + try await settle(window) { list.numberOfSections == 3 && list.numberOfItems(inSection: 2) > 1 } + + select(list, item: 1, section: 1) + XCTAssertEqual(preparation.viewModel.selectedPoint?.id, preparation.viewModel.points[1].id) + select(list, item: 0, section: 1) + select(list, item: 1, section: 2) + XCTAssertEqual(preparation.viewModel.selectedPoint?.id, preparation.viewModel.points[0].id) + XCTAssertEqual(preparation.viewModel.selectedRoute?.id, preparation.viewModel.routes[1].id) + try await settle(window) { preparation.viewModel.admission == .ready } + let summon = try button(in: preparation.view, identifier: "drone.preparation.summon") + assertVisible(summon, in: window) + XCTAssertTrue(summon.isEnabled) + assertLayout(in: preparation.view) + capture(window, named: "拍摄流程-准备正常") + + summon.sendActions(for: .touchUpInside) + let submitted = try XCTUnwrap(store.shootingSession(orderID: order.id)) + XCTAssertEqual(submitted.commands[.summon]?.status, .processing) + XCTAssertEqual(submitted.phase, .unconfirmed) + XCTAssertFalse(summon.isEnabled) + XCTAssertTrue(navigation.topViewController === preparation) + XCTAssertNil(preparation.presentedViewController) + for _ in 0..<3 { summon.sendActions(for: .touchUpInside) } + XCTAssertEqual(store.shootingSession(orderID: order.id)?.id, submitted.id) + XCTAssertEqual(store.shootingOrder(id: order.id)?.remainingShootingCount, originalQuota) + + XCTAssertTrue(preparation.viewModel.confirmSummon()) + preparation.delegate?.shootingPreparationViewController(preparation, didRequestTaskFor: order.id) + try await settle(window) { navigation.topViewController is DroneShootingTaskViewController && navigation.transitionCoordinator == nil } + let task = try XCTUnwrap(navigation.topViewController as? DroneShootingTaskViewController) + let back = try XCTUnwrap(task.navigationItem.leftBarButtonItem) + let action = try XCTUnwrap(back.action) + XCTAssertTrue(UIApplication.shared.sendAction(action, to: back.target, from: back, for: nil)) + try await settle(window) { navigation.topViewController === workbench && navigation.transitionCoordinator == nil } + XCTAssertEqual(navigation.viewControllers.count, 1) + XCTAssertNil(workbench.presentedViewController) + XCTAssertEqual(store.shootingSession(orderID: order.id)?.id, submitted.id) + XCTAssertEqual(store.shootingOrder(id: order.id)?.remainingShootingCount, originalQuota) + + homeList.scrollToItem(at: IndexPath(item: 0, section: 2), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: workbench.view, identifier: "drone.home.\(order.id).primary") != nil } + let reopen = try button(in: workbench.view, identifier: "drone.home.\(order.id).primary") + XCTAssertEqual(reopen.title(for: .normal), "查看当前任务") + reopen.sendActions(for: .touchUpInside) + try await settle(window) { navigation.topViewController is DroneShootingTaskViewController && navigation.transitionCoordinator == nil } + XCTAssertEqual(navigation.viewControllers.count, 2) + XCTAssertEqual(store.shootingSession(orderID: order.id)?.id, submitted.id) + XCTAssertEqual(store.shootingOrder(id: order.id)?.remainingShootingCount, originalQuota) + } + + /// 到达后点击开始只进入指令处理中,不提前宣称拍摄、不弹确认、不扣次。 + func testArrivedStartButtonWaitsForExplicitDeviceConfirmation() async throws { + let fixture = try taskFixture(scenario: .arrived) + let controller = DroneShootingTaskViewController(viewModel: fixture.viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { self.find(in: controller.view, identifier: "drone.task.primary") != nil } + let primary = try button(in: controller.view, identifier: "drone.task.primary") + XCTAssertTrue(primary.isEnabled) + XCTAssertEqual(primary.configuration?.title, "开始拍摄") + assertVisible(primary, in: window) + assertLayout(in: controller.view) + capture(window, named: "拍摄流程-任务已到达") + + primary.sendActions(for: .touchUpInside) + let pending = try XCTUnwrap(fixture.viewModel.session) + XCTAssertEqual(pending.commands[.start]?.status, .processing) + XCTAssertEqual(pending.phase, .arrived) + XCTAssertEqual(pending.result, .notStarted) + XCTAssertFalse(primary.isEnabled) + XCTAssertNil(controller.presentedViewController) + for _ in 0..<3 { primary.sendActions(for: .touchUpInside) } + XCTAssertEqual(fixture.viewModel.session, pending) + XCTAssertEqual(fixture.viewModel.order?.remainingShootingCount, fixture.originalQuota) + assertLayout(in: controller.view) + } + + /// 紧急暂停直接提交,确认前仍拍摄;收到回执后再显示已暂停与继续按钮。 + func testPauseButtonSubmitsDirectlyAndPausedScreenUsesConfirmedState() async throws { + let fixture = try taskFixture(scenario: .shooting) + let controller = DroneShootingTaskViewController(viewModel: fixture.viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { self.find(in: controller.view, identifier: "drone.task.pause") != nil } + let pause = try button(in: controller.view, identifier: "drone.task.pause") + XCTAssertTrue(pause.isEnabled) + pause.sendActions(for: .touchUpInside) + let pending = try XCTUnwrap(fixture.viewModel.session) + XCTAssertEqual(pending.commands[.pause]?.status, .processing) + XCTAssertEqual(pending.phase, .shooting) + XCTAssertFalse(pause.isEnabled) + XCTAssertNil(controller.presentedViewController) + for _ in 0..<3 { pause.sendActions(for: .touchUpInside) } + XCTAssertEqual(fixture.viewModel.session, pending) + XCTAssertEqual(fixture.viewModel.order?.remainingShootingCount, fixture.originalQuota) + + fixture.viewModel.receive(.commandConfirmed(.pause)) + let paused = DroneShootingTaskViewController(viewModel: fixture.viewModel) + controller.navigationController?.setViewControllers([paused], animated: false) + try await settle(window) { paused.viewIfLoaded?.window != nil } + XCTAssertEqual(fixture.viewModel.session?.phase, .shootingPaused) + let primary = try button(in: paused.view, identifier: "drone.task.primary") + XCTAssertEqual(primary.configuration?.title, "继续任务") + XCTAssertTrue(primary.isEnabled) + XCTAssertFalse(try button(in: paused.view, identifier: "drone.task.pause").isEnabled) + assertLayout(in: paused.view) + capture(window, named: "拍摄流程-任务已暂停") + } + + /// 返航直接发送并等待回执;成功扣完次数与返航控制仍分别呈现。 + func testReturnButtonHasNoConfirmationAndZeroQuotaReturningRetainsTask() async throws { + let fixture = try taskFixture(scenario: .arrived) + let controller = DroneShootingTaskViewController(viewModel: fixture.viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + try await settle(window) { self.find(in: controller.view, identifier: "drone.task.return") != nil } + let returnButton = try button(in: controller.view, identifier: "drone.task.return") + XCTAssertTrue(returnButton.isEnabled) + returnButton.sendActions(for: .touchUpInside) + let pending = try XCTUnwrap(fixture.viewModel.session) + XCTAssertEqual(pending.commands[.returnHome]?.status, .processing) + XCTAssertEqual(pending.phase, .arrived) + XCTAssertFalse(returnButton.isEnabled) + XCTAssertNil(controller.presentedViewController) + for _ in 0..<3 { returnButton.sendActions(for: .touchUpInside) } + XCTAssertEqual(fixture.viewModel.session, pending) + XCTAssertEqual(fixture.viewModel.order?.remainingShootingCount, fixture.originalQuota) + + fixture.viewModel.applyScenario(.succeededReturning) + fixture.viewModel.dismissResultNotice() + let returning = DroneShootingTaskViewController(viewModel: fixture.viewModel) + controller.navigationController?.setViewControllers([returning], animated: false) + try await settle(window) { returning.viewIfLoaded?.window != nil } + XCTAssertEqual(fixture.viewModel.order?.remainingShootingCount, 0) + XCTAssertEqual(fixture.viewModel.order?.activeTask?.id, pending.id) + XCTAssertEqual(fixture.viewModel.order?.activeTask?.phase, .returning) + XCTAssertEqual(fixture.viewModel.statusTitle, "拍摄已完成") + XCTAssertEqual(try button(in: returning.view, identifier: "drone.task.primary").configuration?.title, "查看素材") + XCTAssertFalse(try button(in: returning.view, identifier: "drone.task.return").isEnabled) + assertLayout(in: returning.view) + capture(window, named: "拍摄流程-零次仍返航") + + fixture.viewModel.receive(.phaseConfirmed(.returnPaused)) + let returnPaused = DroneShootingTaskViewController(viewModel: fixture.viewModel) + returning.navigationController?.setViewControllers([returnPaused], animated: false) + try await settle(window) { returnPaused.viewIfLoaded?.window != nil } + let resumeReturn = try button(in: returnPaused.view, identifier: "drone.task.primary") + XCTAssertEqual(resumeReturn.configuration?.title, "继续返航") + XCTAssertTrue(resumeReturn.isEnabled) + let materials = try button(in: returnPaused.view, identifier: "drone.task.materials") + assertVisible(materials, in: window) + XCTAssertFalse(materials.isHidden) + XCTAssertEqual(fixture.viewModel.order?.remainingShootingCount, 0) + assertLayout(in: returnPaused.view) + capture(window, named: "拍摄流程-成功后返航暂停仍可查看素材") + } + + /// 占用时可以选择点位航线,但不会召唤;未知设备也保持明确阻断。 + func testOccupiedPreparationAllowsSelectionButBlocksSummonAndUnknownRemainsBlocked() async throws { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let viewModel = DroneShootingPreparationViewModel(store: store, orderID: order.id) + viewModel.applyScenario(.occupied) + let controller = DroneShootingPreparationViewController(viewModel: viewModel) + let window = makeWindow(root: controller) + defer { close(window) } + let list = try collection(in: controller.view, identifier: "drone.preparation.list") + try await settle(window) { list.numberOfSections == 3 && list.numberOfItems(inSection: 2) > 1 } + select(list, item: 1, section: 1) + XCTAssertEqual(viewModel.selectedPoint?.id, viewModel.points[1].id) + select(list, item: 0, section: 1) + select(list, item: 1, section: 2) + XCTAssertEqual(viewModel.selectedRoute?.id, viewModel.routes[1].id) + XCTAssertEqual(viewModel.admission, .occupied) + let summon = try button(in: controller.view, identifier: "drone.preparation.summon") + XCTAssertFalse(summon.isEnabled) + summon.sendActions(for: .touchUpInside) + XCTAssertNil(store.shootingSession(orderID: order.id)) + XCTAssertEqual(store.shootingOrder(id: order.id)?.remainingShootingCount, order.remainingShootingCount) + try await settle(window) { !list.visibleCells.isEmpty } + assertLayout(in: controller.view) + capture(window, named: "拍摄流程-准备占用仍可选线") + + viewModel.applyScenario(.unknown) + let unknown = DroneShootingPreparationViewController(viewModel: viewModel) + controller.navigationController?.setViewControllers([unknown], animated: false) + try await settle(window) { unknown.viewIfLoaded?.window != nil } + XCTAssertEqual(viewModel.admission, .unknownDevice) + XCTAssertFalse(try button(in: unknown.view, identifier: "drone.preparation.summon").isEnabled) + XCTAssertTrue(labels(in: unknown.view).contains { $0.text?.contains("待确认") == true }) + assertLayout(in: unknown.view) + capture(window, named: "拍摄流程-设备未知") + } + + /// 手机断网、仅图传断流、指令结果未知分别显示,重连不会自动重发或扣次。 + func testPhoneOfflineStreamLossAndUnconfirmedCommandHaveIndependentControlsAndLayout() async throws { + let fixture = try taskFixture(scenario: .phoneOffline) + let placeholder = UIViewController() + let window = makeWindow(root: placeholder) + defer { close(window) } + let navigation = try XCTUnwrap(placeholder.navigationController) + for scenario in [DroneShootingTaskScenario.phoneOffline, .streamLost, .commandUnconfirmed] { + fixture.viewModel.applyScenario(scenario) + let controller = DroneShootingTaskViewController(viewModel: fixture.viewModel) + navigation.setViewControllers([controller], animated: false) + try await settle(window) { controller.viewIfLoaded?.window != nil } + let pause = try button(in: controller.view, identifier: "drone.task.pause") + let primary = try button(in: controller.view, identifier: "drone.task.primary") + switch scenario { + case .phoneOffline: + XCTAssertEqual(fixture.viewModel.phoneConnection, .disconnected) + XCTAssertFalse(pause.isEnabled) + XCTAssertFalse(primary.isEnabled) + XCTAssertFalse(try button(in: controller.view, identifier: "drone.task.return").isEnabled) + XCTAssertGreaterThanOrEqual(labels(in: controller.view).filter { $0.text == "—" }.count, 6) + assertLayout(in: controller.view) + capture(window, named: "拍摄流程-手机离线") + let reconnect = try button(in: controller.view, identifier: "drone.task.feed.reconnect") + XCTAssertTrue(reconnect.isEnabled) + reconnect.sendActions(for: .touchUpInside) + XCTAssertEqual(fixture.viewModel.phoneConnection, .reconnecting) + XCTAssertFalse(reconnect.isEnabled) + case .streamLost: + XCTAssertEqual(fixture.viewModel.phoneConnection, .connected) + XCTAssertEqual(fixture.viewModel.feedConnection, .disconnected) + XCTAssertTrue(pause.isEnabled) + XCTAssertFalse(primary.isEnabled) + XCTAssertFalse(labels(in: controller.view).contains { $0.text == "—" }) + assertLayout(in: controller.view) + capture(window, named: "拍摄流程-仅图传断流") + let reconnect = try button(in: controller.view, identifier: "drone.task.feed.reconnect") + reconnect.sendActions(for: .touchUpInside) + XCTAssertEqual(fixture.viewModel.feedConnection, .reconnecting) + XCTAssertEqual(fixture.viewModel.session?.phase, .shooting) + XCTAssertEqual(fixture.viewModel.phoneConnection, .connected) + case .commandUnconfirmed: + XCTAssertEqual(fixture.viewModel.session?.commands[.start]?.status, .unconfirmed) + XCTAssertFalse(primary.isEnabled) + let sync = try button(in: controller.view, identifier: "drone.task.sync") + assertVisible(sync, in: window) + assertLayout(in: controller.view) + capture(window, named: "拍摄流程-指令结果待确认") + sync.sendActions(for: .touchUpInside) + XCTAssertEqual(fixture.viewModel.phoneConnection, .synchronizing) + XCTAssertEqual(fixture.viewModel.session?.commands[.start]?.status, .unconfirmed) + default: XCTFail("未覆盖的连接演示场景") + } + XCTAssertEqual(fixture.viewModel.order?.remainingShootingCount, fixture.originalQuota) + XCTAssertNil(controller.presentedViewController) + } + } + + /// 仅保留演示订单 2 和一台设备,使工作台入口在真机窗口中稳定可见。 + private func makeStore() -> DroneDockDemoStore { + let demo = DroneDockDemoStore() + return DroneDockDemoStore(context: .demo, orders: [demo.orders[1]], devices: Array(demo.devices.prefix(1))) + } + + /// 所有任务先从准备模型提交并明确确认,再显式应用待验收的设备事件。 + private func taskFixture(scenario: DroneShootingTaskScenario) throws -> (viewModel: DroneShootingTaskViewModel, originalQuota: Int) { + let store = makeStore() + let order = try XCTUnwrap(store.orders.first) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: order.id) + XCTAssertEqual(preparation.admission, .ready) + XCTAssertFalse(preparation.summon()) + XCTAssertTrue(preparation.confirmSummon()) + let viewModel = DroneShootingTaskViewModel(store: store, orderID: order.id) + viewModel.applyScenario(scenario) + return (viewModel, order.remainingShootingCount) + } + + /// 点位卡和航线行通过真实 collection delegate 传递选择意图。 + private func select(_ list: UICollectionView, item: Int, section: Int) { + let indexPath = IndexPath(item: item, section: section) + guard item < list.numberOfItems(inSection: section), + list.delegate?.collectionView?(list, shouldSelectItemAt: indexPath) != false else { + XCTFail("预期可以选择点位或航线") + return + } + list.delegate?.collectionView?(list, didSelectItemAt: indexPath) + } + + /// 在已连接真机的应用场景里创建测试窗口,不启动模拟器。 + private func makeWindow(root controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + /// 结束窗口测试,恢复应用原有主窗口。 + private func close(_ window: UIWindow) { + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + /// 等待导航与 Diffable 完成,再为截图与布局断言提供稳定帧。 + private func settle(_ window: UIWindow, until condition: () -> Bool) async throws { + for _ in 0..<150 { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 350_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("拍摄页面未在预期时间内完成布局或导航") + throw NSError(domain: "DroneShootingFlowViewTests", code: 1) + } + + private func allViews(in view: UIView) -> [UIView] { [view] + view.subviews.flatMap { allViews(in: $0) } } + private func find(in view: UIView, identifier: String) -> UIView? { allViews(in: view).first { $0.accessibilityIdentifier == identifier } } + private func button(in view: UIView, identifier: String) throws -> UIButton { + try XCTUnwrap(find(in: view, identifier: identifier) as? UIButton, "缺少按钮:\(identifier)") + } + private func collection(in view: UIView, identifier: String) throws -> UICollectionView { + try XCTUnwrap(find(in: view, identifier: identifier) as? UICollectionView, "缺少列表:\(identifier)") + } + private func labels(in view: UIView) -> [UILabel] { allViews(in: view).compactMap { $0 as? UILabel } } + private func isHiddenByAncestor(_ view: UIView) -> Bool { + view.isHidden || view.alpha < 0.01 || (view.superview.map { isHiddenByAncestor($0) } ?? false) + } + + /// 只检查可见、参与 Auto Layout 的应用视图,排除 UIKit 内部视图。 + private func assertLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = allViews(in: root).filter { + !$0.translatesAutoresizingMaskIntoConstraints && !isHiddenByAncestor($0) && !$0.bounds.isEmpty + && !String(describing: type(of: $0)).hasPrefix("_") && $0.hasAmbiguousLayout + } + XCTAssertTrue(ambiguous.isEmpty, "布局歧义:\(ambiguous.map { String(describing: type(of: $0)) + " " + ($0.accessibilityIdentifier ?? "") })", file: file, line: line) + } + + /// 确认可见控件留在窗口内,包含固定底部操作区。 + private func assertVisible(_ control: UIView, in window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertFalse(isHiddenByAncestor(control), file: file, line: line) + let frame = control.convert(control.bounds, to: window) + XCTAssertGreaterThan(frame.width, 0, file: file, line: line) + XCTAssertGreaterThanOrEqual(frame.height, 30, file: file, line: line) + XCTAssertTrue(window.bounds.contains(frame), "操作区超出窗口:\(frame)", file: file, line: line) + } + + /// 将关键状态截图始终保留在真机 xcresult 中。 + private func capture(_ window: UIWindow, named name: String) { + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } +} +#endif diff --git a/suixinkanTests/DroneShootingSessionViewModelTests.swift b/suixinkanTests/DroneShootingSessionViewModelTests.swift new file mode 100644 index 0000000..07bf5a2 --- /dev/null +++ b/suixinkanTests/DroneShootingSessionViewModelTests.swift @@ -0,0 +1,466 @@ +import XCTest +@testable import suixinkan + +/// 验证本地准备及任务页共享状态、明确回执和成功扣次规则。 +final class DroneShootingSessionViewModelTests: XCTestCase { + func testPointSwitchRestoresItsOwnRouteAndRepeatedSelectionDoesNotClearIt() throws { + let store = makeStore() + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + let firstPoint = try XCTUnwrap(preparation.selectedPoint) + let secondRoute = try XCTUnwrap(preparation.routes.dropFirst().first) + preparation.selectRoute(id: secondRoute.id) + preparation.selectRoute(id: secondRoute.id) + XCTAssertEqual(preparation.selectedRoute?.id, secondRoute.id) + + let secondPoint = try XCTUnwrap(preparation.points.dropFirst().first) + preparation.selectPoint(id: secondPoint.id) + XCTAssertNotEqual(preparation.selectedRoute?.id, secondRoute.id) + XCTAssertTrue(preparation.routes.allSatisfy { $0.id.hasPrefix(secondPoint.id) }) + preparation.selectPoint(id: firstPoint.id) + XCTAssertEqual(preparation.selectedRoute?.id, secondRoute.id) + + let reopened = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + XCTAssertEqual(reopened.selectedPoint?.id, firstPoint.id) + XCTAssertEqual(reopened.selectedRoute?.id, secondRoute.id) + } + + func testInvalidRouteIsClearedWithoutSelectingSameNamedReplacement() throws { + let store = makeStore() + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + let point = try XCTUnwrap(preparation.selectedPoint) + let oldRoute = try XCTUnwrap(preparation.selectedRoute) + let replacement = DroneShootingRoute(id: "different-route-id", name: oldRoute.name) + store.updateShootingPoints(preparation.points, routesByPointID: [point.id: [replacement]], orderID: "order-a") + preparation.refresh() + + XCTAssertNil(preparation.selectedRoute) + XCTAssertEqual(preparation.admission, .noRoute) + preparation.selectRoute(id: oldRoute.id) + XCTAssertNil(preparation.selectedRoute) + preparation.selectRoute(id: replacement.id) + XCTAssertEqual(preparation.selectedRoute, replacement) + } + + func testRangeUpdatePreservesPointOrderAndSelectionButBlocksSummon() throws { + let store = makeStore() + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + let originalIDs = preparation.points.map(\.id) + let selected = try XCTUnwrap(preparation.selectedPoint) + let selectedRoute = try XCTUnwrap(preparation.selectedRoute) + let updated = preparation.points.map { + DroneShootingPoint(id: $0.id, name: $0.name, range: .unknown, successfulCount: $0.successfulCount) + } + store.updateShootingPoints(updated, routesByPointID: [selected.id: preparation.routes], orderID: "order-a") + preparation.refresh() + + XCTAssertEqual(preparation.points.map(\.id), originalIDs) + XCTAssertEqual(preparation.selectedPoint?.id, selected.id) + XCTAssertEqual(preparation.selectedRoute, selectedRoute) + XCTAssertEqual(preparation.admission, .unknownRange) + XCTAssertFalse(preparation.summon()) + XCTAssertNil(store.shootingOrder(id: "order-a")?.activeTask) + } + + func testOutOfRangePointAndRoutesRemainSelectable() throws { + let preparation = DroneShootingPreparationViewModel(store: makeStore(), orderID: "order-a") + let point = try XCTUnwrap(preparation.points.dropFirst().first) + preparation.selectPoint(id: point.id) + let route = try XCTUnwrap(preparation.routes.last) + preparation.selectRoute(id: route.id) + + XCTAssertEqual(preparation.selectedPoint?.id, point.id) + XCTAssertEqual(preparation.selectedRoute, route) + XCTAssertEqual(preparation.admission, .outOfRange) + XCTAssertFalse(preparation.primaryButtonEnabled) + XCTAssertFalse(preparation.summon()) + } + + func testEveryExplicitDeviceBlockPreventsSummonWithoutUsingBatteryThreshold() { + let cases: [(DroneDockDeviceState, DroneShootingAdmission)] = [ + (.occupied, .occupied), (.disconnected, .disconnected), (.noSignal, .noSignal), + (.lowBattery, .lowBattery), (.unknown, .unknownDevice) + ] + for (state, expected) in cases { + let store = makeStore(deviceState: state) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + XCTAssertEqual(preparation.admission, expected) + XCTAssertFalse(preparation.summon()) + XCTAssertNil(store.shootingOrder(id: "order-a")?.activeTask) + } + let explicitReady = DroneShootingPreparationViewModel(store: makeStore(deviceState: .ready, battery: 18), orderID: "order-a") + XCTAssertTrue(explicitReady.admission.canSummon) + } + + func testMissingDeviceNoRoutesNoQuotaAndUnknownOrderAreDistinctBlocks() throws { + let noDevice = DroneShootingPreparationViewModel(store: DroneDockDemoStore(context: context, orders: [order()], devices: []), orderID: "order-a") + XCTAssertEqual(noDevice.admission, .unknownDevice) + let zeroQuota = DroneShootingPreparationViewModel(store: makeStore(orders: [order(total: 1, successful: 1)]), orderID: "order-a") + XCTAssertEqual(zeroQuota.admission, .noQuota) + let unavailable = DroneShootingPreparationViewModel(store: makeStore(), orderID: "missing") + XCTAssertEqual(unavailable.admission, .orderUnavailable) + + let store = makeStore() + let noRoute = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + store.updateShootingPoints(noRoute.points, routesByPointID: [:], orderID: "order-a") + noRoute.refresh() + XCTAssertEqual(noRoute.admission, .noRoutes) + XCTAssertNil(noRoute.selectedRoute) + XCTAssertFalse(noRoute.summon()) + } + + func testSummonStaysPendingCreatesOneSharedTaskAndFreezesSubmittedSelection() throws { + let store = makeStore() + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + let selectedPoint = try XCTUnwrap(preparation.selectedPoint) + let selectedRoute = try XCTUnwrap(preparation.selectedRoute) + XCTAssertFalse(preparation.summon()) + let pending = try XCTUnwrap(store.shootingSession(orderID: "order-a")) + XCTAssertEqual(pending.phase, .unconfirmed) + XCTAssertEqual(pending.commands[.summon]?.status, .processing) + XCTAssertTrue(preparation.hasPendingSummon) + XCTAssertEqual(preparation.primaryButtonTitle, "召唤处理中") + XCTAssertFalse(preparation.primaryButtonEnabled) + + preparation.selectPoint(id: preparation.points[1].id) + preparation.selectRoute(id: preparation.routes[1].id) + XCTAssertEqual(preparation.selectedPoint, selectedPoint) + XCTAssertEqual(preparation.selectedRoute, selectedRoute) + XCTAssertFalse(preparation.summon()) + XCTAssertEqual(store.shootingSession(orderID: "order-a")?.id, pending.id) + XCTAssertEqual(store.shootingOrder(id: "order-a")?.successfulShootingCount, 0) + XCTAssertEqual(DroneDockWorkbenchViewModel(store: store).orders.first?.activeTask?.id, pending.id) + + store.receiveShootingEvent(.commandConfirmed(.summon), orderID: "order-a", taskID: pending.id) + XCTAssertEqual(preparation.admission, .currentTask) + XCTAssertTrue(preparation.summon()) + XCTAssertEqual(store.shootingSession(orderID: "order-a")?.id, pending.id) + } + + func testOtherOrdersCanPrepareButCannotSummonWhenOriginalTaskOccupiesDevice() throws { + let store = makeStore(orders: [order(), order(id: "order-b")]) + let first = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + first.summon() + let second = DroneShootingPreparationViewModel(store: store, orderID: "order-b") + let nextPoint = try XCTUnwrap(second.points.dropFirst().first) + second.selectPoint(id: nextPoint.id) + XCTAssertEqual(second.selectedPoint?.id, nextPoint.id) + XCTAssertNotNil(second.selectedRoute) + second.selectPoint(id: second.points[0].id) + XCTAssertEqual(second.deviceState, .occupied) + XCTAssertEqual(second.admission, .occupied) + XCTAssertFalse(second.summon()) + XCTAssertNil(store.shootingOrder(id: "order-b")?.activeTask) + } + + func testStartPauseAndResumeRequireExplicitAcknowledgments() throws { + let (store, task) = try arrivedTask() + let id = try XCTUnwrap(task.session?.id) + XCTAssertTrue(task.startShooting()) + XCTAssertFalse(task.startShooting()) + XCTAssertEqual(task.session?.phase, .arrived) + XCTAssertEqual(task.session?.result, .notStarted) + XCTAssertEqual(task.commandTitle, "开始拍摄处理中") + task.receive(.commandConfirmed(.start)) + XCTAssertEqual(task.session?.phase, .shooting) + XCTAssertEqual(task.session?.result, .inProgress) + + XCTAssertTrue(task.pause()) + XCTAssertEqual(task.session?.phase, .shooting) + XCTAssertEqual(task.pauseTitle, "暂停处理中") + XCTAssertFalse(task.pause()) + task.receive(.commandConfirmed(.pause)) + XCTAssertEqual(task.session?.phase, .shootingPaused) + XCTAssertTrue(task.resume()) + XCTAssertEqual(task.session?.phase, .shootingPaused) + XCTAssertFalse(task.resume()) + task.receive(.commandConfirmed(.resume)) + XCTAssertEqual(task.session?.phase, .shooting) + XCTAssertEqual(store.shootingOrder(id: "order-a")?.successfulShootingCount, 0) + XCTAssertEqual(store.shootingOrder(id: "order-a")?.activeTask?.id, id) + } + + func testReturnDirectlySubmitsAndReturningPauseRestoresReturnInsteadOfShooting() throws { + let (_, task) = try arrivedTask() + XCTAssertTrue(task.requestReturn()) + XCTAssertEqual(task.session?.phase, .arrived) + XCTAssertEqual(task.returnTitle, "正在发送返航指令") + XCTAssertEqual(task.returnSubtitle, "尚未确认返航") + XCTAssertFalse(task.requestReturn()) + task.receive(.commandConfirmed(.returnHome)) + XCTAssertEqual(task.session?.phase, .returning) + XCTAssertTrue(task.pause()) + task.receive(.commandConfirmed(.pause)) + XCTAssertEqual(task.session?.phase, .returnPaused) + XCTAssertTrue(task.resume()) + XCTAssertEqual(task.session?.phase, .returnPaused) + task.receive(.commandConfirmed(.resume)) + XCTAssertEqual(task.session?.phase, .returning) + XCTAssertEqual(task.order?.successfulShootingCount, 0) + } + + func testCommandTimeoutAndRejectionDoNotBecomeShootingFailureOrDeductQuota() throws { + let (_, task) = try arrivedTask() + task.startShooting() + task.receive(.commandResultUnknown(.start)) + XCTAssertEqual(task.session?.result, .notStarted) + XCTAssertEqual(task.session?.phase, .arrived) + XCTAssertEqual(task.phase, .unconfirmed) + XCTAssertTrue(task.shouldShowCommandRefresh) + XCTAssertFalse(task.startShooting()) + XCTAssertFalse(task.primaryEnabled) + XCTAssertNil(task.resultNotice) + task.refreshTaskStatus() + XCTAssertEqual(task.phoneConnection, .synchronizing) + XCTAssertEqual(task.session?.commands[.start]?.status, .unconfirmed) + task.receive(.synchronized(phase: .arrived, result: .notStarted, flightFinished: false, deviceReady: false)) + XCTAssertTrue(task.primaryEnabled) + + task.startShooting() + task.receive(.commandRejected(.start, message: "设备拒绝开始")) + XCTAssertEqual(task.session?.result, .notStarted) + XCTAssertEqual(task.commandTitle, "指令未执行") + XCTAssertNil(task.resultNotice) + XCTAssertEqual(task.order?.successfulShootingCount, 0) + } + + func testSuccessConsumesExactlyOneQuotaAndDoesNotChangeFlightPhase() throws { + let (store, task) = try arrivedTask(total: 1) + task.startShooting() + task.receive(.commandConfirmed(.start)) + task.receive(.shootingSucceeded) + task.receive(.shootingSucceeded) + XCTAssertEqual(task.session?.phase, .shooting) + XCTAssertEqual(task.session?.result, .succeeded) + XCTAssertEqual(task.order?.remainingShootingCount, 0) + XCTAssertEqual(task.order?.materialState, .uploading) + XCTAssertEqual(task.order?.activeTask?.shootingResult, .succeeded) + XCTAssertEqual(task.primaryAction, .viewMaterials) + XCTAssertTrue(DroneDockWorkbenchViewModel(store: store).orders.isEmpty) + + task.receive(.phaseConfirmed(.returning)) + let completed = DroneShootingOrdersViewModel(store: store, initialFilter: .completed) + XCTAssertEqual(completed.orders.first?.primaryAction, .viewCurrentTask) + XCTAssertEqual(completed.orders.first?.activeTask?.phase, .returning) + task.receive(.flightFinished(deviceReady: true)) + completed.refresh() + XCTAssertNil(completed.orders.first?.activeTask) + XCTAssertEqual(completed.orders.first?.primaryAction, DroneShootingPrimaryAction.none) + XCTAssertEqual(task.order?.successfulShootingCount, 1) + } + + func testSuccessSnapshotCannotBeOverwrittenByLateFailureOrNonterminalSync() throws { + let (_, task) = try arrivedTask(total: 3) + task.receive(.shootingSucceeded) + task.receive(.shootingFailed(reason: "迟到失败")) + task.receive(.synchronized(phase: .returning, result: .inProgress, flightFinished: false, deviceReady: false)) + XCTAssertEqual(task.session?.result, .succeeded) + XCTAssertEqual(task.order?.successfulShootingCount, 1) + XCTAssertEqual(task.session?.phase, .returning) + } + + func testFailureCannotPrepareAgainUntilFlightEndsAndDeviceIsReady() throws { + let (store, task) = try arrivedTask(total: 3) + let preparationBefore = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + let point = preparationBefore.selectedPoint + let route = preparationBefore.selectedRoute + task.receive(.shootingFailed(reason: "拍摄执行失败")) + task.receive(.phaseConfirmed(.returning)) + XCTAssertEqual(task.primaryAction, .prepareAgain) + XCTAssertFalse(task.primaryEnabled) + XCTAssertNotNil(task.order?.activeTask) + XCTAssertEqual(task.order?.successfulShootingCount, 0) + + task.receive(.flightFinished(deviceReady: false)) + XCTAssertNil(task.order?.activeTask) + XCTAssertFalse(task.primaryEnabled) + task.receive(.flightFinished(deviceReady: true)) + XCTAssertTrue(task.primaryEnabled) + XCTAssertEqual(task.order?.primaryAction, .prepareAgain) + + let preparationAfter = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + XCTAssertEqual(preparationAfter.selectedPoint, point) + XCTAssertEqual(preparationAfter.selectedRoute, route) + XCTAssertEqual(preparationAfter.admission, .ready) + XCTAssertNil(task.order?.activeTask) + } + + func testUnknownResultAfterFlightEndStillRetainsOriginalTaskAndBlocksNewSummon() throws { + let (store, task) = try arrivedTask() + task.receive(.protectiveReturn(reason: "设备保护")) + task.receive(.flightFinished(deviceReady: true)) + XCTAssertTrue(task.session?.isFlightFinished == true) + XCTAssertEqual(task.session?.result, .unknown) + XCTAssertNotNil(task.order?.activeTask) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + XCTAssertEqual(preparation.admission, .currentTask) + XCTAssertTrue(preparation.summon()) + XCTAssertEqual(store.shootingSession(orderID: "order-a")?.id, task.session?.id) + XCTAssertEqual(task.order?.successfulShootingCount, 0) + } + + func testStreamLossDoesNotChangePhoneNetworkTelemetryOrSafetyPermissions() throws { + let (_, task) = try arrivedTask() + task.receive(.phaseConfirmed(.shooting)) + let telemetry = task.telemetry + task.receive(.feedConnectionChanged(.disconnected)) + XCTAssertEqual(task.phoneConnection, .connected) + XCTAssertEqual(task.feedConnection, .disconnected) + XCTAssertEqual(task.telemetry, telemetry) + XCTAssertEqual(task.session?.phase, .shooting) + XCTAssertTrue(task.canPause) + XCTAssertTrue(task.canReturn) + task.reconnectFeed() + XCTAssertEqual(task.feedConnection, .reconnecting) + XCTAssertEqual(task.phoneConnection, .connected) + } + + func testPhoneReconnectWaitsForExplicitTaskSyncAndDoesNotRestoreLostFeed() throws { + let (_, task) = try arrivedTask() + task.receive(.feedConnectionChanged(.disconnected)) + task.receive(.phoneConnectionChanged(.disconnected)) + XCTAssertEqual(task.phase, .unconfirmed) + XCTAssertEqual(task.telemetry, .unknown) + XCTAssertFalse(task.canPause) + XCTAssertFalse(task.canReturn) + XCTAssertEqual(task.session?.result, .notStarted) + task.reconnectPhone() + XCTAssertEqual(task.phoneConnection, .reconnecting) + XCTAssertFalse(task.primaryEnabled) + task.receive(.synchronized(phase: .arrived, result: .notStarted, flightFinished: false, deviceReady: false)) + XCTAssertEqual(task.phoneConnection, .connected) + XCTAssertEqual(task.feedConnection, .disconnected) + XCTAssertEqual(task.phase, .arrived) + XCTAssertTrue(task.primaryEnabled) + } + + func testProtectiveReturnDoesNotAssumeFailureSuccessOrQuotaConsumption() throws { + let (_, task) = try arrivedTask() + task.receive(.protectiveReturn(reason: "电量不足")) + XCTAssertEqual(task.session?.phase, .returning) + XCTAssertEqual(task.session?.result, .unknown) + XCTAssertEqual(task.statusTitle, "无人机自动返航") + XCTAssertEqual(task.primaryTitle, "结果待确认") + XCTAssertEqual(task.order?.successfulShootingCount, 0) + XCTAssertNil(task.resultNotice) + } + + func testResultDialogDismissalAndPageRefreshDoNotCreateTaskOrDeductAgain() throws { + let (store, task) = try arrivedTask(total: 3) + let id = try XCTUnwrap(task.session?.id) + task.receive(.shootingSucceeded) + XCTAssertNotNil(task.resultNotice) + task.dismissResultNotice() + for _ in 0..<5 { task.refresh() } + let reopened = DroneShootingTaskViewModel(store: store, orderID: "order-a") + XCTAssertEqual(reopened.session?.id, id) + XCTAssertEqual(reopened.order?.successfulShootingCount, 1) + XCTAssertNil(reopened.resultNotice) + } + + func testNewSessionIgnoresLateEventsFromFinishedTask() throws { + let (store, task) = try arrivedTask(total: 3) + let oldID = try XCTUnwrap(task.session?.id) + task.receive(.shootingFailed(reason: "本次失败")) + task.receive(.flightFinished(deviceReady: true)) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + XCTAssertFalse(preparation.summon()) + let newID = try XCTUnwrap(store.shootingSession(orderID: "order-a")?.id) + XCTAssertNotEqual(newID, oldID) + store.receiveShootingEvent(.shootingSucceeded, orderID: "order-a", taskID: oldID) + XCTAssertEqual(store.shootingOrder(id: "order-a")?.successfulShootingCount, 0) + XCTAssertEqual(store.shootingSession(orderID: "order-a")?.result, .notStarted) + } + + func testScenicSwitchHidesStaleControllersAndPreservesOriginalTaskForReturn() throws { + let (store, task) = try arrivedTask(total: 3) + let originalID = try XCTUnwrap(task.session?.id) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + let other = DroneDockContext(scenicID: "other", scenicName: "另一景区", userID: context.userID, photographerName: context.photographerName) + store.switchContext(to: other) + XCTAssertNil(task.order) + XCTAssertNil(task.session) + XCTAssertEqual(preparation.admission, .orderUnavailable) + XCTAssertFalse(task.pause()) + XCTAssertFalse(preparation.summon()) + store.switchContext(to: context) + task.refresh() + XCTAssertEqual(task.session?.id, originalID) + XCTAssertEqual(task.session?.phase, .arrived) + XCTAssertEqual(task.order?.successfulShootingCount, 0) + } + + func testExistingTaskReferenceIsRestoredWithoutCreatingNewTaskOrChargingSuccessAgain() throws { + let active = DroneShootingTask(id: "existing-task", phase: .returning, shootingResult: .succeeded) + let store = makeStore(orders: [order(total: 3, successful: 1, task: active)]) + let task = DroneShootingTaskViewModel(store: store, orderID: "order-a") + XCTAssertEqual(task.session?.id, active.id) + XCTAssertEqual(task.session?.result, .succeeded) + task.receive(.shootingSucceeded) + XCTAssertEqual(task.order?.successfulShootingCount, 1) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + XCTAssertEqual(preparation.primaryButtonTitle, "查看当前任务") + XCTAssertTrue(preparation.summon()) + XCTAssertEqual(store.shootingSession(orderID: "order-a")?.id, active.id) + } + + #if DEBUG + func testWorkbenchScenarioResetDiscardsOldSessionAndRestoresNewReferencedTask() throws { + let store = DroneDockDemoStore(context: context) + let pendingOrder = try XCTUnwrap(store.orders.first { $0.fulfillmentState == .pending }) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: pendingOrder.id) + preparation.summon() + let oldID = try XCTUnwrap(store.shootingSession(orderID: pendingOrder.id)?.id) + store.applyScenario(.standard) + XCTAssertNil(store.shootingSession(orderID: pendingOrder.id)) + store.applyScenario(.shootingPaused) + let activeOrder = try XCTUnwrap(store.orders.first { $0.activeTask != nil }) + let restored = try XCTUnwrap(store.shootingSession(orderID: activeOrder.id)) + XCTAssertEqual(restored.id, activeOrder.activeTask?.id) + XCTAssertNotEqual(restored.id, oldID) + XCTAssertEqual(restored.phase, .shootingPaused) + } + + func testPreparationPreviewRestoresOriginalQuotaAndTaskPreviewNeverDoubleChargesSameSession() throws { + let store = makeStore(orders: [order(total: 3, successful: 1)]) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + preparation.applyScenario(.noQuota) + XCTAssertEqual(preparation.order?.remainingShootingCount, 0) + preparation.applyScenario(.ready) + XCTAssertEqual(preparation.order?.remainingShootingCount, 2) + preparation.summon() + XCTAssertTrue(preparation.confirmSummon()) + let task = DroneShootingTaskViewModel(store: store, orderID: "order-a") + task.applyScenario(.succeededReturning) + task.applyScenario(.succeededReturning) + task.applyScenario(.succeededFinished) + XCTAssertEqual(task.order?.successfulShootingCount, 2) + } + #endif + + private var context: DroneDockContext { + DroneDockContext(scenicID: "scenic", scenicName: "测试景区", userID: "user", photographerName: "工作人员") + } + + private func order(id: String = "order-a", total: Int = 3, successful: Int = 0, task: DroneShootingTask? = nil) -> DroneShootingOrder { + DroneShootingOrder(id: id, scenicID: context.scenicID, assignedUserID: context.userID, + customerName: "游客136****2806", orderNumber: "TEST-\(id)", createdAtText: "10-23 09:00", + packageName: "航拍套餐", totalShootingCount: total, successfulShootingCount: successful, + activeTask: task, needsRepreparation: false, materialState: .none, + deliveredVideoCount: 0, visitorConfirmationState: .none) + } + + private func makeStore(orders: [DroneShootingOrder]? = nil, deviceState: DroneDockDeviceState = .ready, battery: Int? = 95) -> DroneDockDemoStore { + let telemetry = DroneDockTelemetry(batteryPercent: battery, temperatureCelsius: 20.3, windSpeed: 0, rainDescription: "无雨", signalDescription: "良好", satelliteCount: 36) + return DroneDockDemoStore(context: context, orders: orders ?? [order()], devices: [DroneDockDevice(id: "device", name: "01号无人机", state: deviceState, telemetry: telemetry)]) + } + + private func arrivedTask(total: Int = 3) throws -> (DroneDockDemoStore, DroneShootingTaskViewModel) { + let store = makeStore(orders: [order(total: total)]) + let preparation = DroneShootingPreparationViewModel(store: store, orderID: "order-a") + preparation.summon() + let id = try XCTUnwrap(store.shootingSession(orderID: "order-a")?.id) + store.receiveShootingEvent(.commandConfirmed(.summon), orderID: "order-a", taskID: id) + store.receiveShootingEvent(.phaseConfirmed(.arrived), orderID: "order-a", taskID: id) + return (store, DroneShootingTaskViewModel(store: store, orderID: "order-a")) + } +} diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-broken.docx b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-broken.docx new file mode 100644 index 0000000..3aa079e --- /dev/null +++ b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-broken.docx @@ -0,0 +1 @@ +Not a ZIP document \ No newline at end of file diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-gb18030.txt b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-gb18030.txt new file mode 100644 index 0000000..735ba6f --- /dev/null +++ b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-gb18030.txt @@ -0,0 +1,2 @@ +Åàѵ¿γÌ GB18030 +ÖÐÎÄÄÚÈÝÕý³£ÏÔʾ¡£ \ No newline at end of file diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.docx b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.docx new file mode 100644 index 0000000..e59995c Binary files /dev/null and b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.docx differ diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.md b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.md new file mode 100644 index 0000000..65a0f21 --- /dev/null +++ b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.md @@ -0,0 +1,18 @@ +# 培训课程 + +这是 **Markdown** 附件内容。 + +- 服务规范 +- 现场安全 + +| 项目 | 要求 | +|---|---| +| 阅读 | 完整阅读 | + +[外部资料](https://example.com/training) + +![禁止远程图片](https://example.com/image.png) + + + +[恶意链接](javascript:alert(1)) diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.pdf b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.pdf new file mode 100644 index 0000000..cb4266e --- /dev/null +++ b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.pdf @@ -0,0 +1,32 @@ +%PDF-1.4 +1 0 obj +<< /Type /Catalog /Pages 2 0 R >> +endobj +2 0 obj +<< /Type /Pages /Kids [3 0 R] /Count 1 >> +endobj +3 0 obj +<< /Type /Page /Parent 2 0 R /MediaBox [0 0 320 440] /Resources << /Font << /F1 4 0 R >> >> /Contents 5 0 R >> +endobj +4 0 obj +<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> +endobj +5 0 obj +<< /Length 109 >> +stream +BT /F1 20 Tf 28 380 Td (Training Course PDF) Tj 0 -32 Td /F1 12 Tf (Read the complete course document.) Tj ET +endstream +endobj +xref +0 6 +0000000000 65535 f +0000000009 00000 n +0000000058 00000 n +0000000115 00000 n +0000000241 00000 n +0000000311 00000 n +trailer +<< /Size 6 /Root 1 0 R >> +startxref +471 +%%EOF diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.txt b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.txt new file mode 100644 index 0000000..bb2d23d --- /dev/null +++ b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-sample.txt @@ -0,0 +1,4 @@ +培训课程 +这是一份 UTF-8 文本附件。 + +第二段正文。 \ No newline at end of file diff --git a/suixinkanTests/Fixtures/TrainingDocuments/training-preview-utf16.txt b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-utf16.txt new file mode 100644 index 0000000..a778f9b Binary files /dev/null and b/suixinkanTests/Fixtures/TrainingDocuments/training-preview-utf16.txt differ diff --git a/suixinkanTests/GlobalLoadingManagerTests.swift b/suixinkanTests/GlobalLoadingManagerTests.swift index fd3f953..cbaaafd 100644 --- a/suixinkanTests/GlobalLoadingManagerTests.swift +++ b/suixinkanTests/GlobalLoadingManagerTests.swift @@ -51,4 +51,48 @@ final class GlobalLoadingManagerTests: XCTestCase { manager.hide() XCTAssertFalse(manager.isShowing) } + + /// 清理旧请求后,旧响应的释放不能关闭新请求或普通 show 持有的 Loading。 + func testStaleRequestTokenDoesNotHideNewLoading() { + let manager = GlobalLoadingManager.shared + let previous = manager.beginRequest() + manager.hideAll() + let current = manager.beginRequest() + manager.endRequest(previous) + XCTAssertTrue(manager.isShowing) + manager.endRequest(current) + XCTAssertFalse(manager.isShowing) + manager.show() + manager.endRequest(current) + XCTAssertTrue(manager.isShowing) + manager.hide() + XCTAssertFalse(manager.isShowing) + } + + /// 请求令牌与已有 show/hide 引用计数可以共存,重复结束不影响其它持有者。 + func testRequestTokensRespectOtherLoadingOwners() { + let manager = GlobalLoadingManager.shared + manager.show() + let first = manager.beginRequest() + let second = manager.beginRequest() + manager.endRequest(first) + manager.endRequest(first) + XCTAssertTrue(manager.isShowing) + manager.hide() + XCTAssertTrue(manager.isShowing) + manager.endRequest(second) + XCTAssertFalse(manager.isShowing) + } + + /// 旧普通请求在全局清理后的迟到 hide 不能抵消新培训请求的独立票据。 + func testLateLegacyHideCannotEndRequestToken() { + let manager = GlobalLoadingManager.shared + manager.show() + manager.hideAll() + let current = manager.beginRequest() + manager.hide() + XCTAssertTrue(manager.isShowing) + manager.endRequest(current) + XCTAssertFalse(manager.isShowing) + } } diff --git a/suixinkanTests/GlobalPageLoadingTests.swift b/suixinkanTests/GlobalPageLoadingTests.swift new file mode 100644 index 0000000..fd658a9 --- /dev/null +++ b/suixinkanTests/GlobalPageLoadingTests.swift @@ -0,0 +1,90 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 页面通用 Loading 必须跟随可见性,并与其它页面或请求的令牌相互独立。 +@MainActor +final class GlobalPageLoadingTests: XCTestCase { + override func setUp() { + super.setUp() + GlobalLoadingManager.shared.hideAll() + } + + override func tearDown() { + GlobalLoadingManager.shared.hideAll() + super.tearDown() + } + + /// 页面首次读取可以提前标记,但只有完整出现后才使用通用遮罩。 + func testLoadingWaitsForVisiblePageAndFinishesWithoutLeaking() { + let controller = makeController() + controller.setPageLoading(true) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + controller.viewDidAppear(false) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + controller.setPageLoading(false) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + controller.viewWillDisappear(false) + } + + /// 同步重复刷新展示不会重复持有令牌,成功或错误结束都只需一次释放。 + func testRepeatedLoadingUpdatesOwnOnlyOneToken() { + let controller = makeController() + controller.viewDidAppear(false) + controller.setPageLoading(true) + controller.setPageLoading(true) + controller.setPageLoading(true) + controller.setPageLoading(false) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + controller.viewWillDisappear(false) + } + + /// 离页时释放本页;迟到的结束不能关闭另一请求,迟到开始也不能覆盖新页面。 + func testLeavingAndLateUpdatesCannotHideOrCoverAnotherPage() { + let controller = makeController() + controller.viewDidAppear(false) + controller.setPageLoading(true) + let other = GlobalLoadingManager.shared.beginRequest() + controller.viewWillDisappear(false) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + controller.setPageLoading(false) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + GlobalLoadingManager.shared.endRequest(other) + controller.setPageLoading(true) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + } + + /// 后台关闭通用遮罩,返回前台只恢复仍可见且读取未结束的页面。 + func testBackgroundAndForegroundRespectPendingReadAndVisibility() { + let controller = makeController() + controller.viewDidAppear(false) + controller.setPageLoading(true) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + GlobalLoadingManager.shared.hideAll() + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + controller.viewWillDisappear(false) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + } + + /// 请求已在后台完成时,不因页面回到前台而重新展示过期遮罩。 + func testReadFinishingInBackgroundDoesNotRestoreLoading() { + let controller = makeController() + controller.viewDidAppear(false) + controller.setPageLoading(true) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + controller.setPageLoading(false) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + controller.viewWillDisappear(false) + } + + private func makeController() -> GlobalLoadingPageViewController { + let controller = GlobalLoadingPageViewController() + controller.loadViewIfNeeded() + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + return controller + } +} diff --git a/suixinkanTests/HomeCommonMenuStoreTests.swift b/suixinkanTests/HomeCommonMenuStoreTests.swift index 582e1cc..4da7a49 100644 --- a/suixinkanTests/HomeCommonMenuStoreTests.swift +++ b/suixinkanTests/HomeCommonMenuStoreTests.swift @@ -103,4 +103,56 @@ final class HomeCommonMenuStoreTests: XCTestCase { XCTAssertEqual(HomeMenuCatalog.item(for: "/scenic-queue")?.iconName, "person.3.fill") XCTAssertEqual(HomeMenuItem.moreFunctions.iconName, "ellipsis") } + + /// 同时下发两种培训权限时保留第一条的位置与文案,不改变其它菜单重复行为。 + func testTrainingPermissionAliasesShareCatalogEntryAndKeepFirstPosition() { + for aliases in [["training", "/training"], ["/training", "training"]] { + let permissions = [ + HomePermissionItem(id: "cloud", name: "云盘", uri: "cloud_management"), + HomePermissionItem(id: "training-first", name: "首次培训", uri: aliases[0]), + HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet"), + HomePermissionItem(id: "training-second", name: "重复培训", uri: aliases[1]), + HomePermissionItem(id: "wallet-again", name: "钱包重复", uri: "wallet"), + ] + let menus = HomeMenuCatalog.visibleMenus(from: permissions) + XCTAssertEqual(menus.map(\.uri), ["cloud_management", "/training", "wallet", "wallet"]) + XCTAssertEqual(menus[1].serverName, "首次培训") + } + XCTAssertEqual(HomeMenuCatalog.item(for: "training"), HomeMenuCatalog.item(for: "/training")) + for invalid in ["Training", " training", "training/", "/training/"] { + XCTAssertNil(HomeMenuCatalog.item(for: invalid)) + } + } + + /// 培训双形式在取默认前四项之前合并,未知项与其它重复项仍保留原语义。 + func testDefaultCommonURIsCanonicalizeTrainingBeforeTakingFirstFour() { + let uris = ["training", "/training", "wallet", "cloud_management", "task_management", "system_settings"] + let permissions = uris.enumerated().map { HomePermissionItem(id: "\($0.offset)", name: "菜单", uri: $0.element) } + XCTAssertEqual(HomeCommonMenuStore.defaultCommonURIs(from: permissions), ["/training", "wallet", "cloud_management", "task_management"]) + XCTAssertEqual(HomeMenuCatalog.canonicalURIs(["unknown", "wallet", "wallet", "training", "/training"]), + ["unknown", "wallet", "wallet", "/training"]) + } + + /// 兼容两种历史常用配置,读取时迁移并去重;分组始终使用内部 URI。 + func testSavedTrainingAliasesMigrateAndGroupWithEitherPermissionForm() { + let key = "scenic_user_u1_role_photographer_common_uris" + for saved in [["training"], ["/training"], ["training", "/training"], ["/training", "training"]] { + defaults.set(["wallet"] + saved, forKey: key) + XCTAssertEqual(store.savedCommonURIs(accountScope: "scenic_user_u1", roleCode: "photographer"), ["wallet", "/training"]) + XCTAssertEqual(defaults.stringArray(forKey: key), ["wallet", "/training"]) + for permissionURI in ["training", "/training"] { + let menus = HomeMenuCatalog.visibleMenus(from: [ + HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet"), + HomePermissionItem(id: "training", name: "培训", uri: permissionURI), + ]) + let split = HomeCommonMenuStore.splitMenus(from: menus, commonURIs: ["wallet"] + saved) + XCTAssertEqual(split.common.map(\.uri), ["wallet", "/training"]) + XCTAssertTrue(split.more.isEmpty) + let common = store.commonMenus(from: menus, permissions: [], accountScope: "scenic_user_u1", roleCode: "photographer") + XCTAssertEqual(common.map(\.uri), ["wallet", "/training"]) + } + } + store.saveCommonURIs(["training", "wallet", "/training"], accountScope: "scenic_user_u1", roleCode: "photographer") + XCTAssertEqual(defaults.stringArray(forKey: key), ["/training", "wallet"]) + } } diff --git a/suixinkanTests/HomeViewModelTests.swift b/suixinkanTests/HomeViewModelTests.swift index 953750c..61c04f8 100644 --- a/suixinkanTests/HomeViewModelTests.swift +++ b/suixinkanTests/HomeViewModelTests.swift @@ -200,7 +200,7 @@ final class HomeViewModelTests: XCTestCase { XCTAssertFalse(viewModel.showPermissionDialog) XCTAssertTrue(viewModel.isMinimalTopRole) - XCTAssertEqual(viewModel.commonMenus.count, 2) + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet", "cloud_management"]) XCTAssertEqual(viewModel.storeItem?.name, "测试门店") } @@ -231,6 +231,68 @@ final class HomeViewModelTests: XCTestCase { XCTAssertEqual(session.requests.count, 1) } + /// 账号类型和本地旧配置均不能替代后台下发的两种培训权限 URI。 + func testTrainingEntryRequiresRecognizedPermissionEvenForStoreAccountAndSavedMenu() { + let menuStore = HomeCommonMenuStore(defaults: defaults) + appStore.session.accountType = .storeUser + appStore.session.roleCode = AppRoleCode.storeAdmin.rawValue + menuStore.saveCommonURIs(["wallet", "/training"], accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode) + let viewModel = HomeViewModel(appStore: appStore, commonMenuStore: menuStore) + + for trainingURI in [nil, "Training", " training", "training/", "/training/"] as [String?] { + var permissions = [HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet")] + if let trainingURI { permissions.append(HomePermissionItem(id: "training", name: "培训", uri: trainingURI)) } + appStore.permissions.savePermissionItems(permissions) + viewModel.rebuildCommonMenus() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet"]) + } + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), ["wallet", "/training"]) + } + + /// 菜单可见性只由权限控制;权限撤回后本地已保存的入口立即隐藏。 + func testTrainingPermissionIsVisibleForStoreAndScenicAccountsUntilWithdrawn() { + let menuStore = HomeCommonMenuStore(defaults: defaults) + let viewModel = HomeViewModel(appStore: appStore, commonMenuStore: menuStore) + for accountType in [AppAccountType.storeUser, .scenicUser] { + appStore.session.accountType = accountType + appStore.session.roleCode = accountType == .storeUser ? AppRoleCode.storeAdmin.rawValue : AppRoleCode.photographer.rawValue + for trainingURI in ["training", "/training"] { + appStore.permissions.savePermissionItems([ + HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet"), + HomePermissionItem(id: "training", name: "培训", uri: trainingURI), + ]) + viewModel.rebuildCommonMenus() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet", "/training"]) + + appStore.permissions.savePermissionItems([HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet")]) + viewModel.rebuildCommonMenus() + XCTAssertEqual(viewModel.commonMenus.map(\.uri), ["wallet"]) + } + } + } + + /// 用户从全部功能移出培训后,首页继续尊重保存的常用分组。 + func testRemovingTrainingFromCommonMenusDoesNotForceItBackOnHome() throws { + appStore.session.accountType = .storeUser + appStore.session.roleCode = AppRoleCode.storeAdmin.rawValue + appStore.permissions.savePermissionItems([ + HomePermissionItem(id: "wallet", name: "钱包", uri: "wallet"), + HomePermissionItem(id: "training", name: "培训", uri: "/training"), + ]) + let menuStore = HomeCommonMenuStore(defaults: defaults) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + functions.loadFunctions() + functions.removeFromCommon(try XCTUnwrap(functions.commonMenus.first { $0.uri == "/training" })) + let home = HomeViewModel(appStore: appStore, commonMenuStore: menuStore) + + home.rebuildCommonMenus() + + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["/training"]) + } + func testUnreadMessageStatusUsesCountEndpointAndUpdatesBadgeState() async { let api = HomeMessageCenterAPIMock() api.unreadCountResponses = [ diff --git a/suixinkanTests/MockURLSession.swift b/suixinkanTests/MockURLSession.swift index 96faa88..aab0917 100644 --- a/suixinkanTests/MockURLSession.swift +++ b/suixinkanTests/MockURLSession.swift @@ -7,7 +7,7 @@ import Foundation @testable import suixinkan /// 按顺序返回预设响应的 URLSession 测试替身。 -final class MockURLSession: URLSessionProtocol { +final class MockURLSession: LocalSimulationURLSession { private(set) var requests: [URLRequest] = [] private var responses: [Result<(Data, URLResponse), Error>] private var responseIndex = 0 diff --git a/suixinkanTests/OrderCardCellRefundVisibilityTests.swift b/suixinkanTests/OrderCardCellRefundVisibilityTests.swift new file mode 100644 index 0000000..5223c48 --- /dev/null +++ b/suixinkanTests/OrderCardCellRefundVisibilityTests.swift @@ -0,0 +1,133 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 使用真实订单卡片与本地 JSON 验证退款入口的状态、类型及只读限制。 +@MainActor +final class OrderCardCellRefundVisibilityTests: XCTestCase { + func testPaidMultiPointAerialOrderShowsRefund() throws { + let cell = makeCell() + + try configure(cell, orderType: 25, orderStatus: 20) + + try assertRefundVisible(true, in: cell) + } + + func testReadOnlyMultiPointAerialOrdersHideRefund() throws { + let cell = makeCell() + + for status in [18, 20, 30] { + try configure(cell, orderType: 25, orderStatus: status, readOnly: true) + try assertRefundVisible(false, in: cell) + } + } + + func testOtherPaidOrderTypesKeepRefundHidden() throws { + let cell = makeCell() + + for type in [11, 14] { + try configure(cell, orderType: type, orderStatus: 20) + try assertRefundVisible(false, in: cell) + } + } + + func testMultiTravelOrdersKeepRefundHidden() throws { + let cell = makeCell() + + for status in [18, 20, 30] { + try configure(cell, orderType: 19, orderStatus: status) + try assertRefundVisible(false, in: cell) + } + } + + func testDepositPaidAndCompletedOrdersKeepRefundVisible() throws { + let cell = makeCell() + + for type in [11, 14, 25] { + for status in [18, 30] { + try configure(cell, orderType: type, orderStatus: status) + try assertRefundVisible(true, in: cell) + } + } + } + + func testOtherMultiPointAerialStatusesHideRefund() throws { + let cell = makeCell() + + for status in [0, 10, 40, 50] { + try configure(cell, orderType: 25, orderStatus: status) + try assertRefundVisible(false, in: cell) + } + } + + func testReusedCellUpdatesRefundVisibility() throws { + let cell = makeCell() + + try configure(cell, orderType: 25, orderStatus: 20, readOnly: true) + try assertRefundVisible(false, in: cell) + + try configure(cell, orderType: 25, orderStatus: 20) + try assertRefundVisible(true, in: cell) + + try configure(cell, orderType: 25, orderStatus: 50) + try assertRefundVisible(false, in: cell) + + try configure(cell, orderType: 14, orderStatus: 30) + try assertRefundVisible(true, in: cell) + + try configure(cell, orderType: 14, orderStatus: 20) + try assertRefundVisible(false, in: cell) + } + + private func makeCell() -> OrderCardCell { + OrderCardCell(style: .default, reuseIdentifier: OrderCardCell.reuseIdentifier) + } + + private func configure( + _ cell: OrderCardCell, + orderType: Int, + orderStatus: Int, + readOnly: Bool = false + ) throws { + let json = """ + {"order_number":"refund-visibility-test","order_type":\(orderType),"order_status":\(orderStatus)} + """ + let order = try JSONDecoder().decode(OrderEntity.self, from: Data(json.utf8)) + cell.configure( + order: order, + hideWriteActions: readOnly, + actions: OrderCardActions(), + showOrderSource: false, + sourceSelection: nil + ) + } + + /// 同时检查退款按钮及其父视图,避免操作行被隐藏时误判为可见。 + private func assertRefundVisible( + _ expected: Bool, + in cell: OrderCardCell, + file: StaticString = #filePath, + line: UInt = #line + ) throws { + let button = try XCTUnwrap(refundButton(in: cell), file: file, line: line) + var view: UIView? = button + var visible = true + while let current = view { + visible = visible && !current.isHidden + view = current.superview + } + XCTAssertEqual(visible, expected, file: file, line: line) + } + + private func refundButton(in view: UIView) -> OrderActionButton? { + if let button = view as? OrderActionButton, button.title(for: .normal) == "退款" { + return button + } + for subview in view.subviews { + if let button = refundButton(in: subview) { + return button + } + } + return nil + } +} diff --git a/suixinkanTests/OrderListUITokensTests.swift b/suixinkanTests/OrderListUITokensTests.swift index fa2bde6..b94388c 100644 --- a/suixinkanTests/OrderListUITokensTests.swift +++ b/suixinkanTests/OrderListUITokensTests.swift @@ -72,3 +72,88 @@ private extension UIColor { return UInt(r << 16 | g << 8 | b) } } + +/// 回归通知刷新时表格仍请求旧行的场景,使用 mock 数据覆盖两种订单页面。 +@MainActor +final class OrderNotificationListSnapshotTests: XCTestCase { + private var appStore: AppStore! + private var suiteName: String! + + override func setUp() { + super.setUp() + suiteName = "OrderNotificationListSnapshotTests.\(UUID().uuidString)" + appStore = AppStore(defaults: UserDefaults(suiteName: suiteName)!) + appStore.session.configureTestAccount(userId: "push-list-test", accountType: .storeUser, scenicId: 10) + appStore.session.currentStoreId = 20 + } + + override func tearDown() { + UserDefaults.standard.removePersistentDomain(forName: suiteName) + appStore = nil + super.tearDown() + } + + func testPhotographerRowsRemainReadableWhileNotificationRefreshClearsModel() async throws { + try await verifyRefreshUsesSnapshot(storeMode: false) + } + + func testDepositRowsRemainReadableWhileNotificationRefreshClearsModel() async throws { + try await verifyRefreshUsesSnapshot(storeMode: true) + } + + private func verifyRefreshUsesSnapshot(storeMode: Bool) async throws { + appStore.session.roleCode = storeMode ? AppRoleCode.storeAdmin.rawValue : AppRoleCode.photographer.rawValue + let initial = Data(#"{"code":100000,"msg":"success","data":{"list":[{"order_number":"push-order-a","order_status":30},{"order_number":"push-order-b","order_status":30}],"total":2}}"#.utf8) + let empty = Data(#"{"code":100000,"msg":"success","data":{"list":[],"total":0}}"#.utf8) + let session = MockURLSession(responses: [initial, empty, initial]) + let api = OrderAPI(client: APIClient(environment: .testing, session: session)) + let orders = OrderListViewModel(appStore: appStore) + let deposits = DepositOrderListViewModel(appStore: appStore) + let controller = OrdersViewController(orderAPI: api, orderListViewModel: orders, depositViewModel: deposits, appStore: appStore) + controller.openFromOrderNotification() + let list = try XCTUnwrap(controller.view.subviews.first { $0 is OrderListView } as? OrderListView) + let table = list.tableView + await waitForRows(2, in: table) + let source = try XCTUnwrap(table.dataSource) + + // 保持表格的旧快照,精确模拟模型已清空、主线程 UI 回调尚未执行的窗口。 + let notify = storeMode ? deposits.onStateChange : orders.onStateChange + if storeMode { + deposits.onStateChange = nil + deposits.resetFiltersForOrderNotification() + await deposits.refreshOrderList(api: api) + XCTAssertTrue(deposits.orderList.isEmpty) + } else { + orders.onStateChange = nil + orders.resetFiltersForOrderNotification() + await orders.refreshOrderList(api: api) + XCTAssertTrue(orders.orderList.isEmpty) + } + XCTAssertEqual(source.tableView(table, numberOfRowsInSection: 0), 2) + for index in 0..<2 { + let cell = source.tableView(table, cellForRowAt: IndexPath(row: index, section: 0)) + if storeMode { + XCTAssertTrue(cell is DepositOrderCardCell) + } else { + XCTAssertTrue(cell is OrderCardCell) + } + } + if storeMode { deposits.onStateChange = notify } else { orders.onStateChange = notify } + notify?() + await waitForRows(0, in: table) + + // 已打开的订单页再次点击通知,仍能加载完整列表。 + controller.openFromOrderNotification() + await waitForRows(2, in: table) + XCTAssertEqual(session.requests.count, 3) + } + + private func waitForRows(_ count: Int, in table: UITableView) async { + let applied = expectation(for: NSPredicate { _, _ in + MainActor.assumeIsolated { + table.numberOfRows(inSection: 0) == count + } + }, evaluatedWith: nil) + await fulfillment(of: [applied], timeout: 3) + } +} diff --git a/suixinkanTests/OrderListViewModelTests.swift b/suixinkanTests/OrderListViewModelTests.swift index e2fef2e..a4a54dc 100644 --- a/suixinkanTests/OrderListViewModelTests.swift +++ b/suixinkanTests/OrderListViewModelTests.swift @@ -20,6 +20,20 @@ final class OrderListViewModelTests: XCTestCase { super.tearDown() } + func testOrderNotificationResetsFilters() { + let viewModel = OrderListViewModel() + viewModel.onSearchTextChange("13800138000") + viewModel.onFilterChange(orderStatus: 18, isRefined: 1) + viewModel.onDateRangeSelected(start: Date(), end: Date()) + viewModel.resetFiltersForOrderNotification() + XCTAssertEqual(viewModel.searchText, "") + XCTAssertEqual(viewModel.tabIndex, 0) + XCTAssertEqual(viewModel.filterLabel, "全部") + XCTAssertNil(viewModel.startTime) + XCTAssertNil(viewModel.endTime) + XCTAssertEqual(viewModel.rTabIndex, 0) + } + func testOrderStatusQueryMapping() { XCTAssertNil(OrderListQueryBuilder.orderStatusQuery(tabIndex: 0)) XCTAssertEqual(OrderListQueryBuilder.orderStatusQuery(tabIndex: 18), "18") diff --git a/suixinkanTests/PaymentCollectionDetailsViewModelTests.swift b/suixinkanTests/PaymentCollectionDetailsViewModelTests.swift index 1ee75c5..0ac2320 100644 --- a/suixinkanTests/PaymentCollectionDetailsViewModelTests.swift +++ b/suixinkanTests/PaymentCollectionDetailsViewModelTests.swift @@ -4,6 +4,7 @@ // import XCTest +import UIKit @testable import suixinkan /// 收款详情 ViewModel 测试。 @@ -187,14 +188,14 @@ final class PaymentCollectionDetailsViewModelTests: XCTestCase { ) } - func testNonNalatiDoesNotRequestPayPageConfig() async { + func testUnbrandedScenicDoesNotRequestPayPageConfig() async { let session = MockURLSession(responses: []) let api = PaymentAPI(client: APIClient(environment: .testing, session: session)) let viewModel = PaymentCollectionDetailsViewModel(appStore: appStore) await viewModel.loadPayPageConfig(api: api) - XCTAssertFalse(viewModel.usesNalatiBranding) + XCTAssertFalse(viewModel.usesBranding) XCTAssertEqual(session.requests.count, 0) } @@ -209,4 +210,96 @@ final class PaymentCollectionDetailsViewModelTests: XCTestCase { XCTAssertEqual(production.config(scenicId: 128), .nalatiDefault) XCTAssertNil(testing.config(scenicId: 128)) } + + func testSailimuRefreshPersistsOnlyItsOwnConfigAndReusesBrandUI() async throws { + let suite = "PaymentCollectionDetailsViewModelTests.Sailimu.\(UUID().uuidString)" + let defaults = UserDefaults(suiteName: suite)! + defer { defaults.removePersistentDomain(forName: suite) } + let cache = PayPageConfigCache(defaults: defaults, environment: .testing) + cache.save(.nalatiDefault, scenicId: 128) + let cached = PayPageConfig( + background: "https://cache.example.com/sailimu.png", + logo: "https://cache.example.com/sailimu-logo.png", + title: "缓存赛里木湖标题", + subtitle: "赛里木湖景区" + ) + cache.save(cached, scenicId: 125) + appStore.session.currentScenicId = 125 + let viewModel = PaymentCollectionDetailsViewModel(appStore: appStore, payPageConfigCache: cache) + XCTAssertTrue(viewModel.usesBranding) + XCTAssertEqual(viewModel.payPageConfig, cached) + + let response = """ + {"code":100000,"msg":"success","data":{ + "background":"https://new.example.com/sailimu.png", + "logo":"", "title":"最新赛里木湖标题", "subtitle":"" + }} + """.data(using: .utf8)! + let session = MockURLSession(responses: [response]) + let api = PaymentAPI(client: APIClient(environment: .testing, session: session)) + await viewModel.loadPayPageConfig(api: api) + + let url = try XCTUnwrap(session.requests.first?.url) + XCTAssertEqual(url.path, "/api/yf-handset-app/photog/pay-page-config") + XCTAssertEqual(URLComponents(url: url, resolvingAgainstBaseURL: false)? + .queryItems?.first(where: { $0.name == "scenic_id" })?.value, "125") + XCTAssertEqual(viewModel.payPageConfig.title, "最新赛里木湖标题") + XCTAssertEqual(viewModel.payPageConfig.background, "https://new.example.com/sailimu.png") + XCTAssertEqual(viewModel.payPageConfig.logo, cached.logo) + XCTAssertEqual(viewModel.payPageConfig.subtitle, cached.subtitle) + XCTAssertEqual(viewModel.brandingRefreshVersion, 1) + XCTAssertEqual(cache.config(scenicId: 128), .nalatiDefault) + XCTAssertEqual(cache.config(scenicId: 125), viewModel.payPageConfig) + let reopened = PaymentCollectionDetailsViewModel(appStore: appStore, payPageConfigCache: cache) + XCTAssertEqual(reopened.payPageConfig, viewModel.payPageConfig) + + appStore.session.currentScenicId = 128 + viewModel.refreshLocalState() + XCTAssertEqual(viewModel.payPageConfig, .nalatiDefault) + appStore.session.currentScenicId = 125 + viewModel.refreshLocalState() + XCTAssertEqual(viewModel.payPageConfig, reopened.payPageConfig) + } + + func testSailimuRequestFailurePreservesDefaultsOrItsOwnCache() async { + let suite = "PaymentCollectionDetailsViewModelTests.SailimuFailure.\(UUID().uuidString)" + let defaults = UserDefaults(suiteName: suite)! + defer { defaults.removePersistentDomain(forName: suite) } + let cache = PayPageConfigCache(defaults: defaults, environment: .testing) + cache.save(.nalatiDefault, scenicId: 128) + appStore.session.currentScenicId = 125 + let viewModel = PaymentCollectionDetailsViewModel(appStore: appStore, payPageConfigCache: cache) + let session = MockURLSession(responses: []) + let api = PaymentAPI(client: APIClient(environment: .testing, session: session)) + XCTAssertEqual(viewModel.payPageConfig, .sailimuDefault) + await viewModel.loadPayPageConfig(api: api) + XCTAssertEqual(viewModel.payPageConfig, .sailimuDefault) + XCTAssertNil(cache.config(scenicId: 125)) + + let cached = PayPageConfig(background: "https://cache.example.com/lake.png", + logo: "", title: "缓存标题", subtitle: "赛里木湖") + cache.save(cached, scenicId: 125) + viewModel.refreshLocalState() + await viewModel.loadPayPageConfig(api: api) + XCTAssertEqual(viewModel.payPageConfig, cached) + XCTAssertEqual(cache.config(scenicId: 125), cached) + XCTAssertEqual(cache.config(scenicId: 128), .nalatiDefault) + XCTAssertEqual(viewModel.brandingRefreshVersion, 0) + } + + + func testBrandPresentationUsesMatchingBundledAssetsAndTitleLines() { + let viewModel = PaymentCollectionDetailsViewModel(appStore: appStore) + for (scenicId, prefix, lines) in [(125, "payment_sailimu", 2), (128, "payment_nalati", 1)] { + appStore.session.currentScenicId = scenicId + viewModel.refreshLocalState() + XCTAssertTrue(viewModel.usesBranding) + XCTAssertEqual(viewModel.brandBackgroundAssetName, "\(prefix)_background") + XCTAssertEqual(viewModel.brandLogoAssetName, "\(prefix)_logo") + XCTAssertEqual(viewModel.brandTitleNumberOfLines, lines) + XCTAssertNotNil(UIImage(named: viewModel.brandBackgroundAssetName)) + XCTAssertNotNil(UIImage(named: viewModel.brandLogoAssetName)) + } + } + } diff --git a/suixinkanTests/PaymentModelsTests.swift b/suixinkanTests/PaymentModelsTests.swift index 60f54e7..b34a7bb 100644 --- a/suixinkanTests/PaymentModelsTests.swift +++ b/suixinkanTests/PaymentModelsTests.swift @@ -55,6 +55,16 @@ final class PaymentModelsTests: XCTestCase { XCTAssertFalse(PayPageBrandingPolicy.isNalati(scenicId: 0)) } + func testBrandDefaultsAreScopedToSupportedScenicIds() { + XCTAssertEqual(PayPageBrandingPolicy.defaultConfig(scenicId: 128), .nalatiDefault) + XCTAssertEqual(PayPageBrandingPolicy.defaultConfig(scenicId: 125), .sailimuDefault) + XCTAssertEqual(PayPageConfig.sailimuDefault.title, "赛里木湖旅拍管理\n收费平台") + XCTAssertEqual(PayPageConfig.sailimuDefault.subtitle, "赛里木湖景区") + XCTAssertFalse(PayPageBrandingPolicy.isNalati(scenicId: 125)) + XCTAssertNil(PayPageBrandingPolicy.defaultConfig(scenicId: 127)) + XCTAssertNil(PayPageBrandingPolicy.defaultConfig(scenicId: 0)) + } + func testPaymentAccountDisplayFormatterUsesRealNameAndAllUniqueStores() { XCTAssertEqual( PaymentAccountDisplayFormatter.photographerName(realName: " 摄影师真实姓名 "), diff --git a/suixinkanTests/ProfileViewModelTests.swift b/suixinkanTests/ProfileViewModelTests.swift index bce3086..7be674f 100644 --- a/suixinkanTests/ProfileViewModelTests.swift +++ b/suixinkanTests/ProfileViewModelTests.swift @@ -3,6 +3,7 @@ // suixinkanTests // +import UIKit import XCTest @testable import suixinkan @@ -88,6 +89,60 @@ final class ProfileViewModelTests: XCTestCase { AppStore.shared.session.accountType = .unknown("") } + /// 我的入口兼容两种精确权限 URI,缺失或撤回时隐藏。 + func testTrainingEntryRecognizesBothPermissionURIsForStoreAndScenicAccounts() { + let viewModel = ProfileViewModel() + for accountType in [AppAccountType.storeUser, .scenicUser] { + AppStore.shared.session.accountType = accountType + AppStore.shared.permissions.savePermissionItems([]) + XCTAssertFalse(viewModel.showsTrainingEntry) + for trainingURI in ["training", "/training"] { + AppStore.shared.permissions.savePermissionItems([HomePermissionItem(id: "training", name: "培训", uri: trainingURI)]) + XCTAssertTrue(viewModel.showsTrainingEntry) + AppStore.shared.permissions.savePermissionItems([]) + XCTAssertFalse(viewModel.showsTrainingEntry) + } + for trainingURI in ["Training", " training", "training/", "/training/"] { + AppStore.shared.permissions.savePermissionItems([HomePermissionItem(id: "training", name: "培训", uri: trainingURI)]) + XCTAssertFalse(viewModel.showsTrainingEntry) + } + AppStore.shared.permissions.savePermissionItems([]) + } + } + + /// 已创建的 ViewModel 实时读取撤回权限和切换后账号的权限范围。 + func testTrainingEntryDoesNotCachePermissionAcrossRevocationOrAccountSwitch() { + let originalScope = AppStore.shared.session.accountCachePrefix + defer { AppStore.shared.permissions.clear(accountScope: originalScope) } + AppStore.shared.permissions.savePermissionItems([HomePermissionItem(id: "training", name: "培训", uri: "/training")]) + let viewModel = ProfileViewModel() + XCTAssertTrue(viewModel.showsTrainingEntry) + AppStore.shared.permissions.savePermissionItems([]) + XCTAssertFalse(viewModel.showsTrainingEntry) + AppStore.shared.permissions.savePermissionItems([HomePermissionItem(id: "training", name: "培训", uri: "/training")]) + AppStore.shared.session.configureTestAccount(userId: "profile-training-other", accountType: .storeUser) + XCTAssertFalse(viewModel.showsTrainingEntry) + } + + /// 培训两种点击 URI 走同一路由,仍保留门店账号的业务访问限制。 + func testTrainingRouteAliasesKeepStoreAccountAccessGuard() { + let root = UIViewController() + let navigation = UINavigationController(rootViewController: root) + AppStore.shared.session.accountType = .storeUser + AppStore.shared.session.currentScenicId = 0 + for uri in ["training", "/training"] { + HomeRouteHandler.open(uri: uri, from: root, storeItem: nil) + XCTAssertTrue(navigation.topViewController is TrainingCenterViewController) + navigation.setViewControllers([root], animated: false) + } + AppStore.shared.session.accountType = .scenicUser + AppStore.shared.session.currentScenicId = 0 + for uri in ["training", "/training"] { + HomeRouteHandler.open(uri: uri, from: root, storeItem: nil) + XCTAssertTrue(navigation.topViewController === root) + } + } + func testApplyLocalProfileUpdateSyncsNicknameAndAvatar() { AppStore.shared.session.userName = "全局昵称" AppStore.shared.session.avatar = "https://cdn.example.com/new.jpg" diff --git a/suixinkanTests/PushNotificationTests.swift b/suixinkanTests/PushNotificationTests.swift index 73ae235..f603cd0 100644 --- a/suixinkanTests/PushNotificationTests.swift +++ b/suixinkanTests/PushNotificationTests.swift @@ -27,10 +27,10 @@ final class PushNotificationTests: XCTestCase { super.tearDown() } - func testPayloadRoutesPaymentTypesToTheirPages() { + func testPayloadRoutesOrderAndScanTypesToTheirPages() { XCTAssertEqual( PushPayload(userInfo: ["type": 1, "route": "message_center"]).destination, - .paymentRecord + .orders ) XCTAssertEqual( PushPayload(userInfo: ["type": "6", "action": "task_management"]).destination, @@ -38,6 +38,36 @@ final class PushNotificationTests: XCTestCase { ) } + func testOrderTypesSupportNumbersStringsAndVendorWrappers() { + for type in [1, 5] { + XCTAssertEqual(PushPayload(userInfo: ["type": type]).destination, .orders) + XCTAssertEqual(PushPayload(userInfo: ["type": "\(type)"]).destination, .orders) + XCTAssertEqual(PushPayload(userInfo: ["extras": "{\"type\":\(type)}"]).destination, .orders) + XCTAssertEqual(PushPayload(values: ["type": "\(type)"]).destination, .orders) + } + } + + func testOrderNotificationReturnsToOrdersRootAndDeduplicatesPendingRoute() { + let coordinator = PushRouteCoordinator(appStore: appStore) + let window = UIWindow(frame: UIScreen.main.bounds) + coordinator.attach(window: window) + coordinator.handle(destination: .orders, requestIdentifier: "order-request") + authenticate(userID: "100") + let mainTab = MainTabBarController() + mainTab.loadViewIfNeeded() + mainTab.selectTab(.orders) + let ordersNavigation = mainTab.selectedViewController as? TabNavigationController + ordersNavigation?.pushViewController(UIViewController(), animated: false) + mainTab.selectTab(.home) + window.rootViewController = mainTab + coordinator.routePendingIfPossible() + XCTAssertTrue(mainTab.selectedViewController === ordersNavigation) + XCTAssertEqual(ordersNavigation?.viewControllers.count, 1) + XCTAssertTrue(ordersNavigation?.topViewController is OrdersViewController) + coordinator.handle(destination: .messageCenter, requestIdentifier: "order-request") + XCTAssertTrue(mainTab.selectedViewController === ordersNavigation) + } + func testPayloadIgnoresNonTypeRoutingFieldsAndOtherTypesFallBackToMessageCenter() { let conflictingFields: [AnyHashable: Any] = [ "type": 2, @@ -46,7 +76,7 @@ final class PushNotificationTests: XCTestCase { "action": "收款", ] - [0, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 100, 999].forEach { type in + [0, 2, 3, 4, 7, 8, 9, 10, 11, 12, 100, 999].forEach { type in XCTAssertEqual(PushPayload(userInfo: ["type": type]).destination, .messageCenter) } XCTAssertEqual(PushPayload(userInfo: conflictingFields).destination, .messageCenter) @@ -220,7 +250,7 @@ final class PushNotificationTests: XCTestCase { payload: PushPayload(userInfo: ["type": 1, "route": "task_management"]), requestIdentifier: "request-1" ) - XCTAssertEqual(router.destinations, [.paymentRecord]) + XCTAssertEqual(router.destinations, [.orders]) } func testRemoteNotificationNotifiesUnreadMessageStateChange() async { diff --git a/suixinkanTests/QRCodeCaptureSessionControllerTests.swift b/suixinkanTests/QRCodeCaptureSessionControllerTests.swift new file mode 100644 index 0000000..48438a4 --- /dev/null +++ b/suixinkanTests/QRCodeCaptureSessionControllerTests.swift @@ -0,0 +1,105 @@ +import XCTest +@testable import suixinkan + +/// 回归验证相机配置期间启动、快速关闭和重复启动的顺序。 +final class QRCodeCaptureSessionControllerTests: XCTestCase { + func testStartWaitsForConfigurationCommit() { + let session = RecordingCaptureSession() + let queue = DispatchQueue(label: "qr-capture-test") + let controller = QRCodeCaptureSessionController(session: session, queue: queue) + let entered = DispatchSemaphore(value: 0) + let release = DispatchSemaphore(value: 0) + let completed = expectation(description: "configuration committed") + + controller.configure({ + entered.signal() + _ = release.wait(timeout: .now() + 5) + return true + }, completion: { succeeded in + XCTAssertTrue(Thread.isMainThread) + XCTAssertTrue(succeeded) + completed.fulfill() + }) + XCTAssertEqual(entered.wait(timeout: .now() + 5), .success) + controller.setRunning(true) + release.signal() + queue.sync { + XCTAssertEqual(session.events, ["begin", "commit", "start"]) + XCTAssertFalse(session.startedDuringConfiguration) + } + wait(for: [completed], timeout: 5) + } + + func testImmediateCloseStopsPendingStart() { + let session = RecordingCaptureSession() + let queue = DispatchQueue(label: "qr-capture-test") + let controller = QRCodeCaptureSessionController(session: session, queue: queue) + controller.configure({ true }, completion: { _ in }) + controller.setRunning(true) + controller.setRunning(false) + queue.sync { + XCTAssertEqual(session.events, ["begin", "commit", "start", "stop"]) + XCTAssertFalse(session.isRunning) + } + } + + func testRepeatedStartAndStopAreIdempotent() { + let session = RecordingCaptureSession() + let queue = DispatchQueue(label: "qr-capture-test") + let controller = QRCodeCaptureSessionController(session: session, queue: queue) + controller.configure({ true }, completion: { _ in }) + controller.setRunning(true) + controller.setRunning(true) + controller.setRunning(false) + controller.setRunning(false) + queue.sync { + XCTAssertEqual(session.events, ["begin", "commit", "start", "stop"]) + } + } + + func testFailedConfigurationCommitsButDoesNotStart() { + let session = RecordingCaptureSession() + let queue = DispatchQueue(label: "qr-capture-test") + let controller = QRCodeCaptureSessionController(session: session, queue: queue) + let completed = expectation(description: "configuration failed") + controller.configure({ false }, completion: { succeeded in + XCTAssertFalse(succeeded) + completed.fulfill() + }) + controller.setRunning(true) + queue.sync { + XCTAssertEqual(session.events, ["begin", "commit"]) + XCTAssertFalse(session.isRunning) + } + wait(for: [completed], timeout: 5) + } +} + +/// 记录调用顺序并检测配置事务内启动的会话替身,仅在测试串行队列读写。 +private final class RecordingCaptureSession: QRCodeCaptureSession { + var isRunning = false + var events: [String] = [] + var startedDuringConfiguration = false + private var configuring = false + + func beginConfiguration() { + configuring = true + events.append("begin") + } + + func commitConfiguration() { + configuring = false + events.append("commit") + } + + func startRunning() { + startedDuringConfiguration = configuring + isRunning = true + events.append("start") + } + + func stopRunning() { + isRunning = false + events.append("stop") + } +} diff --git a/suixinkanTests/ScenicLibraryHomeRouteTests.swift b/suixinkanTests/ScenicLibraryHomeRouteTests.swift new file mode 100644 index 0000000..78665fe --- /dev/null +++ b/suixinkanTests/ScenicLibraryHomeRouteTests.swift @@ -0,0 +1,73 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证空境库正式权限入口使用当前景区,且不注入本地预览素材。 +@MainActor +final class ScenicLibraryHomeRouteTests: XCTestCase { + /// 未选景区时沿用首页提示,不能打开空境库。 + func testScenicLibraryRequiresSelectedScenic() { + withTemporaryScenic(0) { + let root = ScenicLibraryRouteProbeController() + let navigation = UINavigationController(rootViewController: root) + + HomeRouteHandler.open(uri: "sceniclibrary", from: root, storeItem: nil) + + XCTAssertTrue(navigation.topViewController === root) + XCTAssertEqual(navigation.viewControllers.count, 1) + XCTAssertEqual(root.lastPresentedMessage, "请先选择景区") + } + } + + /// 正式入口传递真实账号和景区;未接入素材接口前不展示演示航线或片段。 + func testScenicLibraryOpensCurrentScenicWithoutDemoMaterials() throws { + try withTemporaryScenic(271) { + let session = AppStore.shared.session + let root = ScenicLibraryRouteProbeController() + let navigation = UINavigationController(rootViewController: root) + + HomeRouteHandler.open(uri: "sceniclibrary", from: root, storeItem: nil) + + let library = try XCTUnwrap(navigation.topViewController as? ScenicMaterialsViewController) + XCTAssertEqual(navigation.viewControllers.count, 2) + XCTAssertTrue(library.hidesBottomBarWhenPushed) + XCTAssertEqual(library.viewModel.context.userID, session.userId) + XCTAssertEqual(library.viewModel.context.scenicID, "271") + XCTAssertEqual(library.viewModel.context.scenicName, "测试景区") + XCTAssertTrue(library.viewModel.routes.isEmpty) + XCTAssertTrue(library.viewModel.allGroups.isEmpty) + XCTAssertFalse(library.viewModel.canStartDownload) + XCTAssertNil(root.lastPresentedMessage) + library.loadViewIfNeeded() + XCTAssertEqual(library.title, "景区空境库") + } + } + + /// 使用独立账号键,退出测试后还原真机会话并删除临时景区数据。 + private func withTemporaryScenic(_ scenicID: Int, perform body: () throws -> Void) rethrows { + let session = AppStore.shared.session + let originalUserID = session.userId + let originalAccountType = session.accountType + session.configureTestAccount(userId: "scenic-library-route-\(UUID().uuidString)", scenicId: scenicID) + session.currentScenicName = "测试景区" + let temporaryKeys = ["key_in_current_scenic_id", "key_in_current_scenic_name"] + .compactMap { session.accountScopedKey($0) } + defer { + temporaryKeys.forEach { UserDefaults.standard.removeObject(forKey: $0) } + session.userId = originalUserID + session.accountType = originalAccountType + } + try body() + } +} + +/// 捕获首页的景区选择提示,测试不创建真实弹层。 +@MainActor +private final class ScenicLibraryRouteProbeController: UIViewController { + private(set) var lastPresentedMessage: String? + + override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) { + lastPresentedMessage = (viewControllerToPresent as? UIAlertController)?.message + completion?() + } +} diff --git a/suixinkanTests/ScenicLibraryPermissionTests.swift b/suixinkanTests/ScenicLibraryPermissionTests.swift new file mode 100644 index 0000000..ece2b8c --- /dev/null +++ b/suixinkanTests/ScenicLibraryPermissionTests.swift @@ -0,0 +1,178 @@ +import XCTest +@testable import suixinkan + +/// 验证景区空境库由后台权限控制,并沿用首页与全部功能共享的常用配置。 +@MainActor +final class ScenicLibraryPermissionTests: XCTestCase { + /// 接口顶层权限生成本地入口;撤权后残留常用配置不能继续展示或重新添加入口。 + func testPermissionResponseBuildsEntryAndRevocationHidesSavedMenu() async throws { + let fixture = try makeFixture() + defer { fixture.defaults.removePersistentDomain(forName: fixture.suiteName) } + let appStore = fixture.appStore + let menuStore = fixture.menuStore + let session = MockURLSession(responses: [ + permissionResponse(includeScenicLibrary: true), + permissionResponse(includeScenicLibrary: false), + ]) + let api = HomeAPI(client: APIClient(environment: .testing, session: session)) + let home = makeHome(appStore: appStore, menuStore: menuStore) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + + await home.loadPermissions(api: api, force: true) + functions.loadFunctions() + + XCTAssertFalse(home.showPermissionDialog) + XCTAssertEqual(appStore.permissions.permissionItems().map(\.id), ["1", "369"]) + XCTAssertEqual(appStore.permissions.permissionItems().map(\.uri), ["wallet", "sceniclibrary"]) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet", "sceniclibrary"]) + let scenicLibrary = try XCTUnwrap(home.commonMenus.first { $0.uri == "sceniclibrary" }) + XCTAssertEqual(scenicLibrary.title, "景区空境库") + XCTAssertEqual(scenicLibrary.iconName, "photo.on.rectangle.angled") + XCTAssertEqual(scenicLibrary.serverName, "后台配置的空境入口") + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet", "sceniclibrary"]) + XCTAssertTrue(functions.moreMenus.isEmpty) + + await home.loadPermissions(api: api, force: true) + functions.loadFunctions() + + XCTAssertFalse(home.showPermissionDialog) + XCTAssertEqual(appStore.permissions.permissionItems().map(\.uri), ["wallet"]) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet"]) + XCTAssertTrue(functions.moreMenus.isEmpty) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), + ["wallet", "sceniclibrary"]) + + functions.addToCommon(scenicLibrary) + home.rebuildCommonMenus() + + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet"]) + XCTAssertTrue(functions.moreMenus.isEmpty) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(session.requests.map { $0.httpMethod }, ["GET", "GET"]) + XCTAssertEqual(session.requests.map { $0.url?.path }, [ + "/api/yf-handset-app/role-permission", + "/api/yf-handset-app/role-permission", + ]) + } + + /// 已保存的钱包常用配置保持有效,用户增删空境库后首页读取同一份配置。 + func testExistingCommonSelectionChangesOnlyAfterAddingOrRemovingScenicLibrary() throws { + let fixture = try makeFixture() + defer { fixture.defaults.removePersistentDomain(forName: fixture.suiteName) } + let appStore = fixture.appStore + let menuStore = fixture.menuStore + appStore.permissions.savePermissionItems([walletPermission, scenicLibraryPermission]) + menuStore.saveCommonURIs(["wallet"], accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + let home = makeHome(appStore: appStore, menuStore: menuStore) + + functions.loadFunctions() + home.rebuildCommonMenus() + + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["sceniclibrary"]) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + let scenicLibrary = try XCTUnwrap(functions.moreMenus.first) + + functions.addToCommon(scenicLibrary) + home.rebuildCommonMenus() + + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet", "sceniclibrary"]) + XCTAssertTrue(functions.moreMenus.isEmpty) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet", "sceniclibrary"]) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), + ["wallet", "sceniclibrary"]) + + functions.removeFromCommon(scenicLibrary) + functions.loadFunctions() + home.rebuildCommonMenus() + + XCTAssertEqual(functions.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["sceniclibrary"]) + XCTAssertEqual(home.commonMenus.map(\.uri), ["wallet"]) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), ["wallet"]) + } + + /// 首次无自定义时沿用权限前四项策略,第五项空境库保留在更多功能。 + func testDefaultFirstFourKeepsScenicLibraryInMoreFunctions() throws { + let fixture = try makeFixture() + defer { fixture.defaults.removePersistentDomain(forName: fixture.suiteName) } + let appStore = fixture.appStore + let menuStore = fixture.menuStore + appStore.permissions.savePermissionItems([ + walletPermission, + HomePermissionItem(id: "cloud", name: "云盘", uri: "cloud_management"), + HomePermissionItem(id: "task", name: "任务", uri: "task_management"), + HomePermissionItem(id: "settings", name: "设置", uri: "system_settings"), + scenicLibraryPermission, + ]) + let functions = AllFunctionsViewModel(appStore: appStore, commonMenuStore: menuStore) + let home = makeHome(appStore: appStore, menuStore: menuStore) + + functions.loadFunctions() + home.rebuildCommonMenus() + + let expected = ["wallet", "cloud_management", "task_management", "system_settings"] + XCTAssertEqual(functions.commonMenus.map(\.uri), expected) + XCTAssertEqual(home.commonMenus.map(\.uri), expected) + XCTAssertEqual(functions.moreMenus.map(\.uri), ["sceniclibrary"]) + XCTAssertEqual(menuStore.savedCommonURIs(accountScope: appStore.session.accountCachePrefix, + roleCode: appStore.session.roleCode), expected) + } + + private var walletPermission: HomePermissionItem { + HomePermissionItem(id: "1", name: "我的钱包", uri: "wallet") + } + + private var scenicLibraryPermission: HomePermissionItem { + HomePermissionItem(id: "369", name: "后台配置的空境入口", uri: "sceniclibrary") + } + + /// 模拟后台顶层节点省略 children 的授权与撤权响应,角色保持不变。 + private func permissionResponse(includeScenicLibrary: Bool) -> Data { + let scenicLibrary = includeScenicLibrary + ? #",{"icon_src":"","id":369,"name":"后台配置的空境入口","pid":0,"uri":"sceniclibrary"}"# + : "" + return Data(""" + { + "code": 100000, + "msg": "success", + "data": [{ + "role": { + "id": 41, + "name": "摄影师", + "role_code": "photographer", + "notes": null, + "permission": [ + {"icon_src":"","id":1,"name":"我的钱包","pid":0,"uri":"wallet"}\(scenicLibrary) + ] + }, + "scenic": [{"id":11,"name":"测试景区","status":1}], + "store": [] + }] + } + """.utf8) + } + + /// 独立账号与 UserDefaults 隔离权限、景区和常用配置,不读写真机现有会话。 + private func makeFixture() throws -> (suiteName: String, defaults: UserDefaults, appStore: AppStore, menuStore: HomeCommonMenuStore) { + let suiteName = "ScenicLibraryPermissionTests.\(UUID().uuidString)" + let defaults = try XCTUnwrap(UserDefaults(suiteName: suiteName)) + let appStore = AppStore(defaults: defaults) + appStore.session.configureTestAccount(userId: "scenic-library-menu", scenicId: 11) + appStore.session.currentScenicName = "测试景区" + appStore.session.roleCode = AppRoleCode.photographer.rawValue + return (suiteName, defaults, appStore, HomeCommonMenuStore(defaults: defaults)) + } + + /// 定位与在线状态均使用隔离替身,菜单测试不触发真实接口或系统授权。 + private func makeHome(appStore: AppStore, menuStore: HomeCommonMenuStore) -> HomeViewModel { + HomeViewModel(appStore: appStore, locationStateStore: HomeLocationStateStore(store: appStore), + commonMenuStore: menuStore, locationProvider: MockLocationProvider()) + } +} diff --git a/suixinkanTests/ScenicMaterialDateFilterRegressionTests.swift b/suixinkanTests/ScenicMaterialDateFilterRegressionTests.swift new file mode 100644 index 0000000..8ff6676 --- /dev/null +++ b/suixinkanTests/ScenicMaterialDateFilterRegressionTests.swift @@ -0,0 +1,193 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 在真实窗口中覆盖月日滚轮初始化及行数变短时的 UIKit 过渡回调。 +@MainActor +final class ScenicMaterialDateFilterRegressionTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 正式 90 天范围首月有 31 行、当前月只有 30 行,从全部时间打开不能越界。 + func testOpeningRealRetentionRangeSelectsOctober30WithConsistentRows() async throws { + let sheet = ScenicMaterialDateFilterViewController(start: nil, end: nil, + minimumDate: date(2026, 8, 1), maximumDate: date(2026, 10, 30), calendar: calendar) + let window = makeWindow() + defer { close(window) } + try await present(sheet, in: window) + let picker = try picker(in: sheet) + + XCTAssertEqual(picker.numberOfComponents, 2) + XCTAssertEqual(picker.numberOfRows(inComponent: 0), 3) + XCTAssertEqual(picker.numberOfRows(inComponent: 1), 30) + XCTAssertEqual(sheet.pickerView(picker, numberOfRowsInComponent: 1), 30) + XCTAssertEqual(picker.selectedRow(inComponent: 0), 2) + XCTAssertEqual(picker.selectedRow(inComponent: 1), 29) + XCTAssertEqual(try button("start", in: sheet).accessibilityLabel, "开始日期,10月30日") + XCTAssertEqual(try button("end", in: sheet).accessibilityLabel, "结束日期,10月30日") + let lastDay = sheet.pickerView(picker, viewForRow: 29, forComponent: 1, reusing: nil) as? UILabel + XCTAssertEqual(lastDay?.text, "30日") + + let range = try await confirm(sheet) + XCTAssertEqual(range.start, date(2026, 10, 30)) + XCTAssertEqual(range.end, date(2026, 10, 30)) + } + + /// 从 31 日切到二月收敛到月末,切换起止端点时重新同步合法行号及日列数量。 + func testShortMonthAndEndpointSwitchesKeepValidDates() async throws { + let sheet = ScenicMaterialDateFilterViewController(start: date(2026, 1, 31), end: date(2026, 3, 31), + minimumDate: date(2026, 1, 1), maximumDate: date(2026, 3, 31), calendar: calendar) + let window = makeWindow() + defer { close(window) } + try await present(sheet, in: window) + let picker = try picker(in: sheet) + XCTAssertEqual(picker.numberOfRows(inComponent: 1), 31) + XCTAssertEqual(picker.selectedRow(inComponent: 1), 30) + + select(row: 1, component: 0, in: picker, sheet: sheet) + XCTAssertEqual(picker.numberOfRows(inComponent: 1), 28) + XCTAssertEqual(picker.selectedRow(inComponent: 1), 27) + XCTAssertEqual(try button("start", in: sheet).accessibilityLabel, "开始日期,2月28日") + XCTAssertEqual(try button("end", in: sheet).accessibilityLabel, "结束日期,3月31日") + + try button("end", in: sheet).sendActions(for: .touchUpInside) + XCTAssertEqual(picker.numberOfRows(inComponent: 1), 31) + XCTAssertEqual(picker.selectedRow(inComponent: 0), 2) + XCTAssertEqual(picker.selectedRow(inComponent: 1), 30) + select(row: 1, component: 0, in: picker, sheet: sheet) + XCTAssertEqual(picker.numberOfRows(inComponent: 1), 28) + XCTAssertEqual(picker.selectedRow(inComponent: 1), 27) + XCTAssertEqual(try button("end", in: sheet).accessibilityLabel, "结束日期,2月28日") + + try button("start", in: sheet).sendActions(for: .touchUpInside) + select(row: 0, component: 0, in: picker, sheet: sheet) + select(row: 30, component: 1, in: picker, sheet: sheet) + XCTAssertEqual(try button("start", in: sheet).accessibilityLabel, "开始日期,1月31日") + try button("end", in: sheet).sendActions(for: .touchUpInside) + XCTAssertEqual(picker.numberOfRows(inComponent: 1), 28) + XCTAssertEqual(picker.selectedRow(inComponent: 0), 1) + XCTAssertEqual(picker.selectedRow(inComponent: 1), 27) + + let range = try await confirm(sheet) + XCTAssertEqual(range.start, date(2026, 1, 31)) + XCTAssertEqual(range.end, date(2026, 2, 28)) + } + + /// 旧日列的第 31 行及无效行号只能被忽略,不能改写日期草稿或取消全部时间状态。 + func testStaleAndInvalidPickerCallbacksDoNotChangeSubmittedRange() async throws { + for usesAllDates in [false, true] { + let expectedStart = date(2026, 10, 28) + let expectedEnd = date(2026, 10, 30) + let sheet = ScenicMaterialDateFilterViewController(start: expectedStart, end: expectedEnd, + minimumDate: date(2026, 8, 1), maximumDate: expectedEnd, calendar: calendar) + let window = makeWindow() + defer { close(window) } + try await present(sheet, in: window) + let picker = try picker(in: sheet) + if usesAllDates { try button("all", in: sheet).sendActions(for: .touchUpInside) } + let startLabel = try button("start", in: sheet).accessibilityLabel + let endLabel = try button("end", in: sheet).accessibilityLabel + let monthRow = picker.selectedRow(inComponent: 0) + let dayRow = picker.selectedRow(inComponent: 1) + + for (row, component) in [(30, 1), (-1, 1), (NSNotFound, 1), + (3, 0), (-1, 0), (NSNotFound, 0)] { + let reused = UILabel() + reused.text = "旧行" + _ = sheet.pickerView(picker, viewForRow: row, forComponent: component, reusing: reused) + sheet.pickerView(picker, didSelectRow: row, inComponent: component) + } + + XCTAssertEqual(picker.selectedRow(inComponent: 0), monthRow) + XCTAssertEqual(picker.selectedRow(inComponent: 1), dayRow) + XCTAssertEqual(try button("start", in: sheet).accessibilityLabel, startLabel) + XCTAssertEqual(try button("end", in: sheet).accessibilityLabel, endLabel) + XCTAssertEqual(picker.isUserInteractionEnabled, !usesAllDates) + let range = try await confirm(sheet) + XCTAssertEqual(range.start, usesAllDates ? nil : expectedStart) + XCTAssertEqual(range.end, usesAllDates ? nil : expectedEnd) + } + } + + /// 固定上海时区,避免运行日期、地区或系统日历改变边界。 + private var calendar: Calendar { + var value = Calendar(identifier: .gregorian) + value.timeZone = TimeZone(identifier: "Asia/Shanghai")! + return value + } + + /// 创建已归一到日界线的固定测试日期。 + private func date(_ year: Int, _ month: Int, _ day: Int) -> Date { + calendar.date(from: DateComponents(year: year, month: month, day: day))! + } + + /// 让原生 Sheet 在可见 UIWindow 中完成实际布局和滚轮数据源调用。 + private func makeWindow() -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.rootViewController = UIViewController() + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + /// 使用真实呈现完成回调等待,不用固定睡眠猜测动画时机。 + private func present(_ sheet: UIViewController, in window: UIWindow) async throws { + let presenter = try XCTUnwrap(window.rootViewController) + let completed = expectation(description: "时间筛选已呈现") + presenter.present(sheet, animated: false) { completed.fulfill() } + await fulfillment(of: [completed], timeout: 2) + window.layoutIfNeeded() + sheet.view.layoutIfNeeded() + XCTAssertNotNil(sheet.view.window) + } + + /// 经实际确定按钮和 dismiss 完成回调取得提交范围。 + private func confirm(_ sheet: ScenicMaterialDateFilterViewController) async throws -> (start: Date?, end: Date?) { + let completed = expectation(description: "日期草稿已提交") + var submitted: (start: Date?, end: Date?)? + sheet.onSelectRange = { start, end in + submitted = (start, end) + completed.fulfill() + } + try button("confirm", in: sheet).sendActions(for: .touchUpInside) + await fulfillment(of: [completed], timeout: 2) + return try XCTUnwrap(submitted) + } + + /// 模拟合法滚轮选择;先变更控件行号,再进入生产 delegate 路径。 + private func select(row: Int, component: Int, in picker: UIPickerView, + sheet: ScenicMaterialDateFilterViewController) { + picker.selectRow(row, inComponent: component, animated: false) + sheet.pickerView(picker, didSelectRow: row, inComponent: component) + } + + /// 从可访问标识取得生产月日滚轮。 + private func picker(in sheet: UIViewController) throws -> UIPickerView { + try XCTUnwrap(find(in: sheet.view, identifier: "scenic.materials.date.picker") as? UIPickerView) + } + + /// 从可访问标识取得生产按钮,不依赖层级或坐标。 + private func button(_ suffix: String, in sheet: UIViewController) throws -> UIButton { + try XCTUnwrap(find(in: sheet.view, identifier: "scenic.materials.date.\(suffix)") as? UIButton) + } + + /// 仅遍历当前弹窗的视图树。 + private func find(in view: UIView, identifier: String) -> UIView? { + if view.accessibilityIdentifier == identifier { return view } + for child in view.subviews { + if let result = find(in: child, identifier: identifier) { return result } + } + return nil + } + + /// 释放隔离窗口并恢复此前窗口,避免影响同批其他 UI 测试。 + private func close(_ window: UIWindow) { + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } +} diff --git a/suixinkanTests/ScenicMaterialDatePickerOptionsTests.swift b/suixinkanTests/ScenicMaterialDatePickerOptionsTests.swift new file mode 100644 index 0000000..2ea6dca --- /dev/null +++ b/suixinkanTests/ScenicMaterialDatePickerOptionsTests.swift @@ -0,0 +1,90 @@ +import XCTest +@testable import suixinkan + +/// 验证两列日期滚轮只有保留期内的日期,跨年与月末不会生成越界值。 +final class ScenicMaterialDatePickerOptionsTests: XCTestCase { + /// 首尾月只保留允许的日号,所有选项都包含在闭区间内。 + func testPartialBoundaryMonthsContainOnlyRetainedDays() { + let options = makeOptions(from: date(2026, 7, 29), through: date(2026, 10, 26)) + XCTAssertEqual(options.months.map(\.number), [7, 8, 9, 10]) + XCTAssertEqual(options.months.map { $0.dates.count }, [3, 31, 30, 26]) + XCTAssertEqual(options.months.first?.dates.first, date(2026, 7, 29)) + XCTAssertEqual(options.months.last?.dates.last, date(2026, 10, 26)) + XCTAssertTrue(options.months.flatMap(\.dates).allSatisfy { options.minimumDate <= $0 && $0 <= options.maximumDate }) + XCTAssertEqual(options.date(inMonthAt: 0, preferredDay: 1), date(2026, 7, 29)) + XCTAssertEqual(options.date(inMonthAt: 3, preferredDay: 31), date(2026, 10, 26)) + } + + /// 12 月与次年 1 月属于不同年月,滚轮日号不会回到上一年。 + func testCrossYearMonthsPreserveYearAndChronologicalOrder() { + let options = makeOptions(from: date(2026, 11, 30), through: date(2027, 1, 5)) + XCTAssertEqual(options.months.map(\.year), [2026, 2026, 2027]) + XCTAssertEqual(options.months.map(\.number), [11, 12, 1]) + XCTAssertEqual(options.monthIndex(for: date(2027, 1, 1)), 2) + XCTAssertEqual(options.monthTitle(at: 2), "1月") + XCTAssertEqual(options.date(inMonthAt: 2, preferredDay: 31), date(2027, 1, 5)) + } + + /// 从 31 日切换到平年 2 月时落到 28 日,再切换长月可以正常选 31 日。 + func testShortMonthClampsDayWithoutOverflowingIntoMarch() { + let options = makeOptions(from: date(2026, 1, 1), through: date(2026, 3, 31)) + XCTAssertEqual(options.date(inMonthAt: 1, preferredDay: 31), date(2026, 2, 28)) + XCTAssertEqual(options.date(inMonthAt: 2, preferredDay: 31), date(2026, 3, 31)) + XCTAssertEqual(options.months[1].dates.count, 28) + } + + /// 闰年 2 月 29 日保留为有效选项,不硬编码每月天数。 + func testLeapDayIsSelectable() { + let options = makeOptions(from: date(2028, 1, 31), through: date(2028, 3, 1)) + XCTAssertEqual(options.months[1].dates.count, 29) + XCTAssertEqual(options.date(inMonthAt: 1, preferredDay: 31), date(2028, 2, 29)) + } + + /// 保留期外的传入日期收敛到最近边界,同时去除时分秒。 + func testExternalDatesClampToInclusiveDayBoundaries() { + let options = makeOptions(from: date(2026, 10, 1), through: date(2026, 10, 30)) + XCTAssertEqual(options.clamped(date(2026, 9, 30)), date(2026, 10, 1)) + XCTAssertEqual(options.clamped(date(2026, 10, 31)), date(2026, 10, 30)) + XCTAssertEqual(options.clamped(date(2026, 10, 15).addingTimeInterval(12 * 3600)), date(2026, 10, 15)) + } + + /// 非法倒置边界收敛成一天,滚轮仍有可选值。 + func testInvertedBoundsProduceOneValidDay() { + let options = makeOptions(from: date(2026, 10, 30), through: date(2026, 10, 1)) + XCTAssertEqual(options.months.flatMap(\.dates), [date(2026, 10, 30)]) + XCTAssertEqual(options.maximumDate, options.minimumDate) + } + + /// 长区间出现同名月份时显示年份,防止两条“1 月”无法区分。 + func testRepeatedMonthNamesIncludeYear() { + let options = makeOptions(from: date(2026, 1, 31), through: date(2027, 1, 1)) + XCTAssertEqual(options.monthTitle(at: 0), "2026年1月") + XCTAssertEqual(options.monthTitle(at: 12), "2027年1月") + XCTAssertEqual(options.monthTitle(at: 1), "2月") + } + + /// 夏令时切换不跳过日期,也不会生成非零点的日期选项。 + func testDayEnumerationUsesCalendarAcrossDaylightSavingTransition() throws { + var localCalendar = Calendar(identifier: .gregorian) + localCalendar.timeZone = try XCTUnwrap(TimeZone(identifier: "America/Los_Angeles")) + let start = try XCTUnwrap(localCalendar.date(from: DateComponents(year: 2026, month: 3, day: 7))) + let end = try XCTUnwrap(localCalendar.date(from: DateComponents(year: 2026, month: 3, day: 10))) + let options = ScenicMaterialDatePickerOptions(minimumDate: start, maximumDate: end, calendar: localCalendar) + XCTAssertEqual(options.months[0].dates.map { localCalendar.component(.day, from: $0) }, [7, 8, 9, 10]) + XCTAssertTrue(options.months[0].dates.allSatisfy { localCalendar.component(.hour, from: $0) == 0 }) + } + + private var calendar: Calendar { + var calendar = Calendar(identifier: .gregorian) + calendar.timeZone = TimeZone(secondsFromGMT: 8 * 3600)! + return calendar + } + + private func date(_ year: Int, _ month: Int, _ day: Int) -> Date { + calendar.date(from: DateComponents(year: year, month: month, day: day))! + } + + private func makeOptions(from minimum: Date, through maximum: Date) -> ScenicMaterialDatePickerOptions { + ScenicMaterialDatePickerOptions(minimumDate: minimum, maximumDate: maximum, calendar: calendar) + } +} diff --git a/suixinkanTests/ScenicMaterialDownloadServiceTests.swift b/suixinkanTests/ScenicMaterialDownloadServiceTests.swift new file mode 100644 index 0000000..7fc5dc2 --- /dev/null +++ b/suixinkanTests/ScenicMaterialDownloadServiceTests.swift @@ -0,0 +1,212 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 真实空境下载的成功边界、取消竞态和临时文件清理,不访问系统相册或外网。 +@MainActor +final class ScenicMaterialDownloadServiceTests: XCTestCase { + /// 同一素材重复出现只下载保存一次,成功回执之后临时文件已清理。 + func testSuccessfulSaveDeduplicatesItemsAndCleansTemporaryFiles() async throws { + let downloader = ScenicDownloadStub() + let saver = ScenicPhotoSaveStub() + let service = ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver) + let token = UUID() + let recorder = ScenicDownloadEventRecorder() + let item = makeItem() + + service.start(items: [item, item], batchID: token, onEvent: recorder.receive) + await service.waitForPendingOperations() + + XCTAssertEqual(recorder.completedTokens, [token]) + XCTAssertTrue(recorder.failedTokens.isEmpty) + let downloadCount = await downloader.calls + let saveCount = await saver.calls + XCTAssertEqual(downloadCount, 1) + XCTAssertEqual(saveCount, 1) + let files = await downloader.files + XCTAssertEqual(files.count, 1) + XCTAssertFalse(FileManager.default.fileExists(atPath: try XCTUnwrap(files.first).path)) + } + + /// 下载失败不会提交相册事务或产生成功事件。 + func testDownloadFailureDoesNotSaveOrComplete() async { + let downloader = ScenicDownloadStub(failure: .httpFailure(403)) + let saver = ScenicPhotoSaveStub() + let service = ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver) + let token = UUID() + let recorder = ScenicDownloadEventRecorder() + + service.start(items: [makeItem()], batchID: token, onEvent: recorder.receive) + await service.waitForPendingOperations() + + XCTAssertEqual(recorder.failedTokens, [token]) + XCTAssertTrue(recorder.completedTokens.isEmpty) + let count = await saver.calls + XCTAssertEqual(count, 0) + } + + /// 相册拒绝或保存失败只产生失败回执,同时删除已经下载的临时文件。 + func testPhotoPermissionFailureCleansDownloadWithoutCompleting() async throws { + let downloader = ScenicDownloadStub() + let saver = ScenicPhotoSaveStub(failure: true) + let service = ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver) + let token = UUID() + let recorder = ScenicDownloadEventRecorder() + + service.start(items: [makeItem()], batchID: token, onEvent: recorder.receive) + await service.waitForPendingOperations() + + XCTAssertEqual(recorder.failedTokens, [token]) + XCTAssertTrue(recorder.completedTokens.isEmpty) + let files = await downloader.files + XCTAssertFalse(FileManager.default.fileExists(atPath: try XCTUnwrap(files.first).path)) + } + + /// 已提交的 Photos 事务在暂停后成功,继续时只同步成功事实,不再次下载或保存。 + func testResumeWaitsForUncancellableSaveAndAvoidsDuplicateAsset() async { + let downloader = ScenicDownloadStub() + let saver = ScenicPhotoSaveStub(isSuspended: true) + let service = ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver) + let oldToken = UUID() + let newToken = UUID() + let recorder = ScenicDownloadEventRecorder() + let item = makeItem() + service.start(items: [item], batchID: oldToken, onEvent: recorder.receive) + await saver.waitForSaveStart() + + service.stop() + service.start(items: [item], batchID: newToken, onEvent: recorder.receive) + await saver.finishSave() + await service.waitForPendingOperations() + + XCTAssertEqual(recorder.completedTokens, [newToken]) + XCTAssertTrue(recorder.failedTokens.isEmpty) + let saveCount = await saver.calls + let downloadCount = await downloader.calls + XCTAssertEqual(saveCount, 1) + XCTAssertEqual(downloadCount, 1) + } + + /// 即使下载器取消后仍返回文件,服务也会清理文件并拒绝旧回执及相册保存。 + func testCancelledDownloadDoesNotSaveLateFileOrPublishOldReceipt() async throws { + let downloader = ScenicDownloadStub(isSuspended: true) + let saver = ScenicPhotoSaveStub() + let service = ScenicMaterialDownloadService(downloader: downloader, photoSaver: saver) + let recorder = ScenicDownloadEventRecorder() + service.start(items: [makeItem()], batchID: UUID(), onEvent: recorder.receive) + await downloader.waitForDownloadStart() + + service.stop() + await downloader.finishDownload() + await service.waitForPendingOperations() + + XCTAssertTrue(recorder.completedTokens.isEmpty) + XCTAssertTrue(recorder.failedTokens.isEmpty) + let saveCount = await saver.calls + XCTAssertEqual(saveCount, 0) + let files = await downloader.files + XCTAssertFalse(FileManager.default.fileExists(atPath: try XCTUnwrap(files.first).path)) + } + + /// 原片 URL 仅允许 HTTP(S),不读取本地路径或执行非下载协议。 + func testDownloaderRejectsNonHTTPURL() async { + do { + _ = try await ScenicMaterialURLSessionDownloader().downloadFile(remoteURL: "file:///tmp/video.mp4", + fileName: "video.mp4", onProgress: { _ in }) + XCTFail("本地文件不能当作远程素材地址") + } catch { + XCTAssertEqual(error as? ScenicMaterialDownloadError, .invalidURL) + } + } + + private func makeItem() -> ScenicMaterialDownloadItem { + ScenicMaterialDownloadItem(id: "session-1/material-2", remoteURL: URL(string: "https://example.com/video.mp4")!) + } +} + +/// 主线程事件收集器,只记录终态,便于检验过期批次不会回写 UI。 +@MainActor +private final class ScenicDownloadEventRecorder { + private(set) var completedTokens: [UUID] = [] + private(set) var failedTokens: [UUID] = [] + + func receive(_ id: String, _ token: UUID, _ event: ScenicMaterialTransferEvent) { + switch event { + case .completed: completedTokens.append(token) + case .failed: failedTokens.append(token) + case .progress: break + } + } +} + +/// 下载替身可模拟错误与忽略取消的迟到响应,用独立临时文件验证清理。 +private actor ScenicDownloadStub: CloudFileDownloading { + private let failure: ScenicMaterialDownloadError? + private let isSuspended: Bool + private var continuation: CheckedContinuation? + private var startWaiter: CheckedContinuation? + private(set) var calls = 0 + private(set) var files: [URL] = [] + + init(failure: ScenicMaterialDownloadError? = nil, isSuspended: Bool = false) { + self.failure = failure + self.isSuspended = isSuspended + } + + func downloadFile(remoteURL: String, fileName: String, onProgress: @escaping @Sendable (Int) -> Void) async throws -> URL { + calls += 1 + if let failure { throw failure } + if isSuspended { + await withCheckedContinuation { continuation in + self.continuation = continuation + self.startWaiter?.resume() + self.startWaiter = nil + } + } + let file = FileManager.default.temporaryDirectory.appendingPathComponent("scenic-test-\(UUID().uuidString).mp4") + try Data("test-video".utf8).write(to: file) + files.append(file) + onProgress(100) + return file + } + + func waitForDownloadStart() async { + if continuation != nil { return } + await withCheckedContinuation { startWaiter = $0 } + } + + func finishDownload() { continuation?.resume(); continuation = nil } +} + +/// 模拟 Photos 不可取消的提交窗口,支持授权拒绝和手动完成保存。 +private actor ScenicPhotoSaveStub: CloudPhotoSaving { + private let failure: Bool + private let isSuspended: Bool + private var continuation: CheckedContinuation? + private var startWaiter: CheckedContinuation? + private(set) var calls = 0 + + init(failure: Bool = false, isSuspended: Bool = false) { + self.failure = failure + self.isSuspended = isSuspended + } + + func saveToPhotoLibrary(fileURL: URL, fileType: Int) async throws { + calls += 1 + if failure { throw CloudTransferError.photoPermissionDenied } + if isSuspended { + await withCheckedContinuation { continuation in + self.continuation = continuation + self.startWaiter?.resume() + self.startWaiter = nil + } + } + } + + func waitForSaveStart() async { + if continuation != nil { return } + await withCheckedContinuation { startWaiter = $0 } + } + + func finishSave() { continuation?.resume(); continuation = nil } +} diff --git a/suixinkanTests/ScenicMaterialPageFooterTests.swift b/suixinkanTests/ScenicMaterialPageFooterTests.swift new file mode 100644 index 0000000..d1851e9 --- /dev/null +++ b/suixinkanTests/ScenicMaterialPageFooterTests.swift @@ -0,0 +1,29 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 分页末行的加载与失败重试按钮不能在忙碌状态重复触发请求。 +@MainActor +final class ScenicMaterialPageFooterTests: XCTestCase { + /// 禁用、重试及复用时保持一致的点击语义。 + func testLoadingDisablesActionAndReuseClearsOldCallback() throws { + let cell = ScenicMaterialPageFooterCell(frame: CGRect(x: 0, y: 0, width: 320, height: 48)) + let button = try XCTUnwrap(cell.contentView.subviews.compactMap { $0 as? UIButton }.first) + var requests = 0 + cell.onLoadMore = { requests += 1 } + cell.configure(title: "正在加载更多场次…", enabled: false) + button.sendActions(for: .touchUpInside) + XCTAssertEqual(requests, 0) + + cell.configure(title: "加载失败,点击重试", enabled: true) + button.sendActions(for: .touchUpInside) + XCTAssertEqual(requests, 1) + XCTAssertEqual(button.accessibilityIdentifier, "scenic.materials.loadMore") + cell.layoutIfNeeded() + XCTAssertGreaterThanOrEqual(button.bounds.height, 44) + + cell.prepareForReuse() + button.sendActions(for: .touchUpInside) + XCTAssertEqual(requests, 1) + } +} diff --git a/suixinkanTests/ScenicMaterialPreviewPlaybackTests.swift b/suixinkanTests/ScenicMaterialPreviewPlaybackTests.swift new file mode 100644 index 0000000..91dadd6 --- /dev/null +++ b/suixinkanTests/ScenicMaterialPreviewPlaybackTests.swift @@ -0,0 +1,75 @@ +import AVKit +import UIKit +import XCTest +@testable import suixinkan + +/// 使用包内短片验证预览进度来自真实播放器,并在暂停和关闭时停止推进。 +@MainActor +final class ScenicMaterialPreviewPlaybackTests: XCTestCase { + /// 本地演示的实际 3 秒时长不能伪装为素材元信息的 28 秒,关闭后也不能继续回调进度。 + func testDemoProgressUsesAssetDurationAndStopsAfterClosing() async throws { + let clip = ScenicMaterialClip(id: "preview:1", groupID: "preview", ordinal: 1, + durationSeconds: 28, fileSizeBytes: 178_000_000, resolution: "4K", + coverAssetName: "drone_demo_mountain") + let controller = ScenicMaterialPreviewViewController(clip: clip, routeName: "测试航线", + capturedAt: Date(timeIntervalSince1970: 1_700_000_000)) + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = controller + window.makeKeyAndVisible() + window.layoutIfNeeded() + defer { + controller.viewWillDisappear(false) + controller.viewDidDisappear(false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + let play = try XCTUnwrap(find(in: controller.view, identifier: "scenic.materials.preview.play") as? UIButton) + let progress = try XCTUnwrap(find(in: controller.view, identifier: "scenic.materials.preview.progress") as? UIProgressView) + let time = try XCTUnwrap(find(in: controller.view, identifier: "scenic.materials.preview.playbackTime") as? UILabel) + let playerController = try XCTUnwrap(controller.children.compactMap { $0 as? AVPlayerViewController }.first) + XCTAssertEqual(time.text, "00:00 / 原片 00:28") + + play.sendActions(for: .touchUpInside) + try await waitUntil { progress.progress > 0.05 } + let player = try XCTUnwrap(playerController.player) + XCTAssertTrue(time.text?.hasSuffix(" / 00:03") == true) + XCTAssertFalse(time.text?.contains("00:28") == true) + + play.sendActions(for: .touchUpInside) + XCTAssertEqual(player.rate, 0) + try await Task.sleep(nanoseconds: 150_000_000) + let pausedProgress = progress.progress + try await Task.sleep(nanoseconds: 200_000_000) + XCTAssertEqual(progress.progress, pausedProgress, accuracy: 0.02) + + play.sendActions(for: .touchUpInside) + XCTAssertTrue(playerController.player === player) + try await waitUntil { progress.progress > pausedProgress + 0.04 } + + let done = try XCTUnwrap(find(in: controller.view, identifier: "scenic.materials.preview.done") as? UIButton) + done.sendActions(for: .touchUpInside) + XCTAssertNil(playerController.player) + XCTAssertEqual(player.rate, 0) + XCTAssertEqual(progress.progress, 0) + try await Task.sleep(nanoseconds: 250_000_000) + XCTAssertEqual(progress.progress, 0) + XCTAssertEqual(time.text, "00:00 / 原片 00:28") + } + + private func waitUntil(_ condition: () -> Bool) async throws { + let deadline = Date().addingTimeInterval(4) + while Date() < deadline { + if condition() { return } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("本地预览播放器未在限定时间内推进") + } + + private func find(in root: UIView, identifier: String) -> UIView? { + if root.accessibilityIdentifier == identifier { return root } + return root.subviews.lazy.compactMap { self.find(in: $0, identifier: identifier) }.first + } +} diff --git a/suixinkanTests/ScenicMaterialRemotePreviewTests.swift b/suixinkanTests/ScenicMaterialRemotePreviewTests.swift new file mode 100644 index 0000000..abf5a57 --- /dev/null +++ b/suixinkanTests/ScenicMaterialRemotePreviewTests.swift @@ -0,0 +1,101 @@ +import AVKit +import UIKit +import XCTest +@testable import suixinkan + +/// 验证正式空境卡片与预览的元信息,以及缺失地址时不会播放包内演示文件。 +@MainActor +final class ScenicMaterialRemotePreviewTests: XCTestCase { + /// 仅构造预览界面,不点击远程播放,也不提供封面地址以避免测试联网。 + func testRemotePreviewShowsOriginalVideoInstructionsAndMetadata() throws { + let clip = makeClip(remoteURL: URL(string: "https://example.invalid/original.mp4")) + let controller = makePreview(clip) + + XCTAssertTrue(labels(in: controller.view).contains { $0.text == "点击播放原片" }) + XCTAssertFalse(labels(in: controller.view).contains { $0.text?.contains("本地演示") == true }) + let play = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.play") as? UIButton) + XCTAssertEqual(play.accessibilityLabel, "播放景区视频") + let metadata = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.metadata") as? UILabel) + let playbackTime = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.playbackTime") as? UILabel) + XCTAssertEqual(playbackTime.text, "00:00 / 01:05") + XCTAssertEqual(metadata.text, "01:05 · 12MB") + XCTAssertFalse(labels(in: controller.view).contains { $0.text?.contains(clip.resolution) == true }) + let route = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.route") as? UILabel) + XCTAssertEqual(route.text, "测试景区航线") + XCTAssertNil(controller.children.compactMap { $0 as? AVPlayerViewController }.first?.player) + } + + /// 首段卡展示时长及大小,小卡保留时长;重用卡片时不残留分辨率或首段大小。 + func testRemoteCardMetadataOmitsKnownAndUnknownResolutionAcrossReuse() { + let cell = ScenicMaterialClipCell(frame: .zero) + for resolution in ["4K", "分辨率未知"] { + let clip = makeClip(remoteURL: nil, resolution: resolution) + cell.configure(clip: clip, selected: false, isSelectionEnabled: true, isHero: true) + XCTAssertTrue(labels(in: cell).contains { $0.text == "01:05 · 12MB" }) + XCTAssertFalse(labels(in: cell).contains { $0.text?.contains(resolution) == true }) + + cell.configure(clip: clip, selected: false, isSelectionEnabled: true, isHero: false) + XCTAssertTrue(labels(in: cell).contains { $0.text == "01:05" }) + XCTAssertFalse(labels(in: cell).contains { $0.text?.contains("12MB") == true }) + XCTAssertFalse(labels(in: cell).contains { $0.text?.contains(resolution) == true }) + } + } + + /// 即便片段标为可用且演示文件存在,正式片段地址缺失也只显示可重试提示。 + func testMissingRemoteAddressDoesNotFallBackToBundledDemoVideo() throws { + let controller = makePreview(makeClip(remoteURL: nil)) + let play = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.play") as? UIButton) + + play.sendActions(for: .touchUpInside) + + XCTAssertTrue(labels(in: controller.view).contains { $0.text == "视频地址暂不可用" }) + XCTAssertTrue(play.isEnabled) + XCTAssertFalse(play.isHidden) + XCTAssertNil(controller.children.compactMap { $0 as? AVPlayerViewController }.first?.player) + XCTAssertFalse(labels(in: controller.view).contains { $0.text?.contains("本地演示") == true }) + } + + /// 缺失元信息以未知展示,不能用 0 秒或 0 MB 暗示已知的空文件。 + func testUnknownMetadataIsNotPresentedAsZero() throws { + let clip = ScenicMaterialClip(id: "session-1:media-2", groupID: "session-1", ordinal: 2, + durationSeconds: -1, fileSizeBytes: -1, resolution: "分辨率未知", + coverAssetName: "", isAvailable: false, isRemote: true) + let controller = makePreview(clip) + let metadata = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.metadata") as? UILabel) + let playbackTime = try XCTUnwrap(view(in: controller.view, identifier: "scenic.materials.preview.playbackTime") as? UILabel) + + XCTAssertEqual(clip.durationText, "时长未知") + XCTAssertEqual(clip.sizeText, "大小未知") + XCTAssertEqual(playbackTime.text, "00:00 / 时长未知") + XCTAssertEqual(metadata.text, "时长未知 · 大小未知") + XCTAssertFalse(labels(in: controller.view).contains { $0.text?.contains("分辨率") == true }) + XCTAssertFalse(metadata.text?.contains("00:00") == true) + XCTAssertFalse(metadata.text?.contains("0MB") == true) + } + + /// 创建不含封面网络请求的正式片段,测试仅检查界面及缺失地址分支。 + private func makeClip(remoteURL: URL?, resolution: String = "1920×1080") -> ScenicMaterialClip { + ScenicMaterialClip(id: "session-1:media-1", groupID: "session-1", ordinal: 1, + durationSeconds: 65, fileSizeBytes: 12_000_000, + resolution: resolution, coverAssetName: "drone_demo_mountain", + isAvailable: true, remoteURL: remoteURL, coverURL: nil, + fileLabel: "本次素材01", isRemote: true) + } + + /// 直接加载 UIKit 视图,测试无需登录账号、可见窗口或系统相册。 + private func makePreview(_ clip: ScenicMaterialClip) -> ScenicMaterialPreviewViewController { + let controller = ScenicMaterialPreviewViewController(clip: clip, routeName: "测试景区航线", + capturedAt: Date(timeIntervalSince1970: 1_700_000_000)) + controller.loadViewIfNeeded() + return controller + } + + private func view(in root: UIView, identifier: String) -> UIView? { + if root.accessibilityIdentifier == identifier { return root } + return root.subviews.lazy.compactMap { self.view(in: $0, identifier: identifier) }.first + } + + private func labels(in root: UIView) -> [UILabel] { + (root as? UILabel).map { [$0] } ?? root.subviews.flatMap { labels(in: $0) } + } +} diff --git a/suixinkanTests/ScenicMaterialsAPITests.swift b/suixinkanTests/ScenicMaterialsAPITests.swift new file mode 100644 index 0000000..eac4d31 --- /dev/null +++ b/suixinkanTests/ScenicMaterialsAPITests.swift @@ -0,0 +1,166 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证景区空境库请求按文档携带分页与筛选范围,不使用订单素材身份。 +@MainActor +final class ScenicMaterialsAPITests: XCTestCase { + /// 部署接口返回 100000/msg,沿用 token 头,并保留空库和服务端保留期提示。 + func testSessionsUsesObservedEnvelopeAndExactReadOnlyParameters() async throws { + let session = MockURLSession(responses: [Self.emptyResponse]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "scenic-library-test-token" } + let response = try await ScenicMaterialsAPI(client: client).sessions(query: ScenicMaterialsQuery(scenicID: 271)) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/scenic-media/sessions") + XCTAssertEqual(request.value(forHTTPHeaderField: "token"), "scenic-library-test-token") + XCTAssertNil(request.httpBody) + XCTAssertEqual(try requestQuery(request), ["scenic_id": "271", "page": "1", "page_size": "20", "retention_days": "90"]) + XCTAssertEqual(response.total, 0) + XCTAssertTrue(response.list.isEmpty) + XCTAssertTrue(response.groups.isEmpty) + XCTAssertTrue(response.airLines.isEmpty) + XCTAssertEqual(response.retentionTips, "素材保留 90 天,请及时下载") + } + + /// 场次详情只使用 scenic_media_id,原素材字段按实际 JSON 类型保留。 + func testSessionDetailUsesOnlyScenicMediaIDAndPreservesMaterialFields() async throws { + let payload = Data(#"{"code":100000,"msg":"success","data":{"materials":[{"file_label":"片段一","selectable":true,"oss_url":"https://example.com/clip.mp4?signature=scenic-signed-url-do-not-log"}]}}"#.utf8) + let session = MockURLSession(responses: [payload]) + let response = try await ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session)) + .sessionDetail(scenicMediaID: 501) + let request = try XCTUnwrap(session.requests.first) + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(request.url?.path, "/api/app/scenic-media/session-detail") + XCTAssertEqual(try requestQuery(request), ["scenic_media_id": "501"]) + XCTAssertNil(request.httpBody) + XCTAssertEqual(response.materials.first?["file_label"], .string("片段一")) + XCTAssertEqual(response.materials.first?["selectable"], .bool(true)) + XCTAssertEqual(response.materials.first?["oss_url"], .string("https://example.com/clip.mp4?signature=scenic-signed-url-do-not-log")) + } + + /// 后端账号或景区拒绝必须显示为错误,不能当作真实空库。 + func testBusinessErrorsArePreserved() async throws { + let payload = Data(#"{"code":100099,"msg":"请使用门店账号登录","data":[]}"#.utf8) + let session = MockURLSession(responses: [payload]) + do { + _ = try await ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session)) + .sessions(query: ScenicMaterialsQuery(scenicID: 271)) + XCTFail("账号权限错误不能转为空库") + } catch let APIError.serverCode(code, message) { + XCTAssertEqual(code, 100099) + XCTAssertEqual(message, "请使用门店账号登录") + } + } + + /// 文档的 code=0 示例不是部署接口成功码,不能悄悄改变全局鉴权和响应规则。 + func testUndeployedZeroSuccessCodeIsRejected() async throws { + let payload = Data(#"{"code":0,"message":"success","data":{"materials":[]}}"#.utf8) + let session = MockURLSession(responses: [payload]) + do { + _ = try await ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session)).sessionDetail(scenicMediaID: 501) + XCTFail("应保持部署接口的成功码语义") + } catch let APIError.serverCode(code, _) { + XCTAssertEqual(code, 0) + } + } + + /// 请求校验在网络之前执行,场次身份不接受 0 或负值。 + func testInvalidRequestsDoNotReachNetwork() async { + let session = MockURLSession(responses: []) + let api = ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session)) + do { + _ = try await api.sessions(query: ScenicMaterialsQuery(scenicID: 0)) + XCTFail("非法景区不应请求网络") + } catch {} + for id in [0, -1] { + do { _ = try await api.sessionDetail(scenicMediaID: id); XCTFail("非法场次不应请求网络") } + catch {} + } + XCTAssertTrue(session.requests.isEmpty) + } + + /// 缺失或错误数组不得伪装成空列表;详情要求材料对象数组。 + func testMalformedContainersAreRejected() throws { + var root = try XCTUnwrap(JSONSerialization.jsonObject(with: Self.emptyResponse) as? [String: Any]) + let original = try XCTUnwrap(root["data"] as? [String: Any]) + for key in ["list", "groups", "filter_options"] { + var payload = original + payload.removeValue(forKey: key) + root["data"] = payload + XCTAssertThrowsError(try JSONDecoder().decode(APIEnvelope.self, + from: JSONSerialization.data(withJSONObject: root))) + } + for payload in [#"{}"#, #"{"materials":null}"#, #"{"materials":[1]}"#] { + XCTAssertThrowsError(try JSONDecoder().decode(ScenicMaterialsSessionDetailResponse.self, from: Data(payload.utf8))) + } + } + + /// 返回其他页或筛选的响应不能混入当前页面。 + func testMismatchedResponsePageAndFiltersAreRejected() async { + for query in [ScenicMaterialsQuery(scenicID: 271, page: 2), ScenicMaterialsQuery(scenicID: 271, airLineID: 123), + ScenicMaterialsQuery(scenicID: 271, dateFrom: "2026-10-01"), ScenicMaterialsQuery(scenicID: 271, retentionDays: 30)] { + let session = MockURLSession(responses: [Self.emptyResponse]) + do { + _ = try await ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session)).sessions(query: query) + XCTFail("响应条件必须与请求一致") + } catch let error as APIError { + guard case .decodeFailed = error else { return XCTFail("应拒绝响应范围不一致") } + } catch { XCTFail("应使用统一接口错误") } + } + } + + /// 默认请求显式传递分页和 90 天窗口,全部筛选省略可选参数。 + func testDefaultQueryContainsOnlyDocumentedScopeAndPagination() throws { + let query = ScenicMaterialsQuery(scenicID: 271) + XCTAssertEqual(try values(query), ["scenic_id": "271", "page": "1", "page_size": "20", "retention_days": "90"]) + } + + /// 航线和日期均作为服务端查询参数发送;翻页保留原筛选。 + func testFilteredQueryKeepsDateRangeAndAirLineWhenPaginating() throws { + let query = ScenicMaterialsQuery(scenicID: 271, page: 2, pageSize: 100, airLineID: 123, + dateFrom: "2026-10-01", dateTo: "2026-10-29", retentionDays: 30) + XCTAssertEqual(try values(query), ["scenic_id": "271", "page": "2", "page_size": "100", "retention_days": "30", + "air_line_id": "123", "date_from": "2026-10-01", "date_to": "2026-10-29"]) + } + + /// 无效分页、身份和日期不能发出请求,日期不自动修正为其他日期。 + func testInvalidScopePaginationAndDatesAreRejected() { + let invalid = [ + ScenicMaterialsQuery(scenicID: 0), + ScenicMaterialsQuery(scenicID: 271, page: 0), + ScenicMaterialsQuery(scenicID: 271, pageSize: 0), + ScenicMaterialsQuery(scenicID: 271, pageSize: 101), + ScenicMaterialsQuery(scenicID: 271, airLineID: 0), + ScenicMaterialsQuery(scenicID: 271, retentionDays: 0), + ScenicMaterialsQuery(scenicID: 271, retentionDays: 366), + ScenicMaterialsQuery(scenicID: 271, dateFrom: "2026-02-30"), + ScenicMaterialsQuery(scenicID: 271, dateTo: "2026-1-1"), + ScenicMaterialsQuery(scenicID: 271, dateFrom: ""), + ScenicMaterialsQuery(scenicID: 271, dateFrom: "2026-10-30", dateTo: "2026-10-29"), + ] + for query in invalid { XCTAssertThrowsError(try query.queryItems()) } + } + + /// 文档允许起止字段分别可选,单端日期不能被客户端抛弃。 + func testSingleDateEndpointIsPreserved() throws { + XCTAssertEqual(try values(ScenicMaterialsQuery(scenicID: 271, dateFrom: "2024-02-29"))["date_from"], "2024-02-29") + XCTAssertEqual(try values(ScenicMaterialsQuery(scenicID: 271, dateTo: "2026-10-29"))["date_to"], "2026-10-29") + } + + /// 转为键值表检查完整参数集合,避免额外订单或任务参数混入。 + private func values(_ query: ScenicMaterialsQuery) throws -> [String: String] { + Dictionary(uniqueKeysWithValues: try query.queryItems().map { ($0.name, $0.value ?? "") }) + } + + /// 从请求检查完整查询字段。 + private func requestQuery(_ request: URLRequest) throws -> [String: String] { + let url = try XCTUnwrap(request.url) + let items = try XCTUnwrap(URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems) + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } + + /// 依据 2026-10-29 当前景区部署接口的实际空库响应。 + private static let emptyResponse = Data(#"{"code":100000,"msg":"success","data":{"list":[],"groups":[],"total":0,"page":1,"page_size":20,"retention_days":90,"retention_tips":"素材保留 90 天,请及时下载","filter":{"air_line_id":0,"date_from":"","date_to":""},"filter_options":{"air_lines":[]}}}"#.utf8) +} diff --git a/suixinkanTests/ScenicMaterialsFlowViewTests.swift b/suixinkanTests/ScenicMaterialsFlowViewTests.swift new file mode 100644 index 0000000..7518681 --- /dev/null +++ b/suixinkanTests/ScenicMaterialsFlowViewTests.swift @@ -0,0 +1,470 @@ +import UIKit +import XCTest +@testable import suixinkan + +#if DEBUG +/// 在隔离窗口验证独立空镜库的布局、筛选、预览与本地下载流程。 +@MainActor +final class ScenicMaterialsFlowViewTests: XCTestCase { + private weak var previousKeyWindow: UIWindow? + + /// 独立入口不创建工作台;首段和双列可点,整组选中包括折叠的第六段。 + func testIndependentEntryAndSixClipGroupSelectionAcrossExpandedLayout() async throws { + XCTAssertNil(ScenicMaterialsPreview.navigationController(arguments: [])) + let navigation = try XCTUnwrap(ScenicMaterialsPreview.navigationController(arguments: ["--scenic-materials-preview"])) + XCTAssertEqual(navigation.viewControllers.count, 1) + let controller = try XCTUnwrap(navigation.topViewController as? ScenicMaterialsViewController) + let window = makeWindow(root: navigation) + defer { close(window) } + let model = controller.viewModel + let list = try await waitForLibrary(controller, window: window) + let firstGroup = try XCTUnwrap(model.filteredGroups.first) + let hero = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 0, section: 1))) + let left = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 1, section: 1))) + let right = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 2, section: 1))) + XCTAssertGreaterThan(hero.bounds.width, left.bounds.width * 1.8) + XCTAssertGreaterThan(hero.bounds.height, 100) + XCTAssertEqual(left.frame.minY, right.frame.minY, accuracy: 1) + XCTAssertLessThan(left.frame.maxX, right.frame.minX) + capture(window, named: "空镜库-常态首段与双列") + let heroSelect = try button(in: controller.view, identifier: "scenic.materials.select.\(firstGroup.clips[0].id)") + assertReachable(heroSelect, window: window) + heroSelect.sendActions(for: .touchUpInside) + XCTAssertEqual(model.selectedIDs, [firstGroup.clips[0].id]) + let tileSelect = try button(in: controller.view, identifier: "scenic.materials.select.\(firstGroup.clips[1].id)") + assertReachable(tileSelect, window: window) + tileSelect.sendActions(for: .touchUpInside) + XCTAssertEqual(model.selectedCount, 2) + assertLayout(in: controller.view) + capture(window, named: "空镜库-双列片段选择") + + model.toggleSelection(id: firstGroup.clips[0].id) + model.toggleSelection(id: firstGroup.clips[1].id) + controller.refreshDisplay(animated: false) + let groupIndex = try XCTUnwrap(model.filteredGroups.firstIndex { $0.clips.count == 6 }) + let group = model.filteredGroups[groupIndex] + let section = groupIndex + 1 + try await showGroupHeader(section: section, list: list, window: window) + let groupSelect = try button(in: controller.view, identifier: "scenic.materials.group.\(group.id)") + assertReachable(groupSelect, window: window) + groupSelect.sendActions(for: .touchUpInside) + XCTAssertEqual(model.selectedIDs, Set(group.clips.map(\.id))) + XCTAssertEqual(model.visibleClips(in: group).count, 5) + XCTAssertEqual(list.numberOfItems(inSection: section), 6) + try await settle(window) { + self.find(in: controller.view, identifier: "scenic.materials.group.\(group.id)")?.accessibilityTraits.contains(.selected) == true + } + capture(window, named: "空镜库-整组六段含折叠选择") + list.scrollToItem(at: IndexPath(item: 5, section: section), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: controller.view, identifier: "scenic.materials.expand.\(group.id)") != nil } + let expand = try button(in: controller.view, identifier: "scenic.materials.expand.\(group.id)") + assertReachable(expand, window: window) + expand.sendActions(for: .touchUpInside) + try await settle(window) { list.numberOfItems(inSection: section) == 7 } + XCTAssertEqual(model.visibleClips(in: group).count, 6) + XCTAssertEqual(model.selectedIDs, Set(group.clips.map(\.id))) + list.scrollToItem(at: IndexPath(item: 5, section: section), at: .centeredVertically, animated: false) + try await settle(window) { self.find(in: controller.view, identifier: "scenic.materials.clip.\(group.clips[5].id)") != nil } + let sixth = try XCTUnwrap(list.layoutAttributesForItem(at: IndexPath(item: 5, section: section))) + let collapse = try XCTUnwrap(list.layoutAttributesForItem(at: IndexPath(item: 6, section: section))) + let groupHero = try XCTUnwrap(list.layoutAttributesForItem(at: IndexPath(item: 0, section: section))) + XCTAssertGreaterThan(collapse.frame.minY, sixth.frame.maxY, "收起按钮必须独占第六段下方一行") + XCTAssertEqual(collapse.frame.width, groupHero.frame.width, accuracy: 1, "收起按钮应与首段卡片等宽") + XCTAssertEqual(collapse.frame.minX, groupHero.frame.minX, accuracy: 1) + assertLayout(in: controller.view) + capture(window, named: "空镜库-展开第六段") + } + + /// 航线无结果可重置;日期面板的实际控件只在确定后应用按日筛选。 + func testRouteAndDateSheetCallbacksFilterResultsAndResetEmptyRoute() async throws { + let controller = ScenicMaterialsViewController() + let window = makeWindow(root: controller) + defer { close(window) } + let model = controller.viewModel + _ = try await waitForLibrary(controller, window: window) + let originalCount = model.filteredGroups.count + try button(in: controller.view, identifier: "scenic.materials.routeFilter").sendActions(for: .touchUpInside) + try await settle(window) { self.isPresentationSettled(controller, type: ScenicMaterialRouteFilterViewController.self) } + let routeSheet = try XCTUnwrap(controller.presentedViewController as? ScenicMaterialRouteFilterViewController) + let table = try XCTUnwrap(find(in: routeSheet.view, identifier: "scenic.materials.route.list") as? UITableView) + let path = IndexPath(row: 3, section: 0) + let row = try XCTUnwrap(table.cellForRow(at: path)) + assertReachable(row, window: window) + capture(window, named: "空镜库-航线筛选") + table.delegate?.tableView?(table, didSelectRowAt: path) + try await settle(window) { controller.presentedViewController == nil && model.filteredGroups.isEmpty } + XCTAssertEqual(model.selectedRouteID, model.routes[2].id) + let reset = try button(in: controller.view, identifier: "scenic.materials.resetFilters") + assertReachable(reset, window: window) + capture(window, named: "空镜库-航线无结果") + reset.sendActions(for: .touchUpInside) + try await settle(window) { model.filteredGroups.count == originalCount } + XCTAssertNil(model.selectedRouteID) + + let day = try XCTUnwrap(model.filteredGroups.first?.capturedAt) + let expected = model.filteredGroups.filter { model.calendar.isDate($0.capturedAt, inSameDayAs: day) } + let hiddenID = try XCTUnwrap(model.filteredGroups.first { !model.calendar.isDate($0.capturedAt, inSameDayAs: day) }?.clips.first?.id) + model.toggleSelection(id: hiddenID) + controller.refreshDisplay(animated: false) + try button(in: controller.view, identifier: "scenic.materials.dateFilter").sendActions(for: .touchUpInside) + try await settle(window) { self.isPresentationSettled(controller, type: ScenicMaterialDateFilterViewController.self) } + let dateSheet = try XCTUnwrap(controller.presentedViewController as? ScenicMaterialDateFilterViewController) + let picker = try XCTUnwrap(find(in: dateSheet.view, identifier: "scenic.materials.date.picker") as? UIPickerView) + XCTAssertEqual(picker.numberOfComponents, 2, "日期筛选只展示月、日两列") + let start = try button(in: dateSheet.view, identifier: "scenic.materials.date.start") + assertReachable(start, window: window) + start.sendActions(for: .touchUpInside) + try selectDate(day, in: picker, minimumDate: model.minimumDate, calendar: model.calendar) + let end = try button(in: dateSheet.view, identifier: "scenic.materials.date.end") + end.sendActions(for: .touchUpInside) + try selectDate(day, in: picker, minimumDate: model.minimumDate, calendar: model.calendar) + let formatter = DateFormatter() + formatter.calendar = model.calendar + formatter.timeZone = model.calendar.timeZone + formatter.locale = Locale(identifier: "zh_CN") + formatter.dateFormat = "M月d日" + let selectedDay = formatter.string(from: day) + try await settle(window) { + self.visibleLabel(in: start, text: "开始日期") != nil && self.visibleLabel(in: start, text: selectedDay) != nil + && self.visibleLabel(in: end, text: "结束日期") != nil && self.visibleLabel(in: end, text: selectedDay) != nil + } + for (endpoint, title) in [(start, "开始日期"), (end, "结束日期")] { + assertReachable(endpoint, window: window) + for text in [title, selectedDay] { + let label = try XCTUnwrap(visibleLabel(in: endpoint, text: text), "日期端点文字未渲染:\(text)") + XCTAssertGreaterThan(label.bounds.width, 0) + XCTAssertGreaterThan(label.bounds.height, 0) + XCTAssertTrue(endpoint.bounds.contains(label.convert(label.bounds, to: endpoint)), "日期端点文字超出按钮:\(text)") + } + } + XCTAssertNil(model.dateRange) + XCTAssertEqual(model.selectedIDs, [hiddenID]) + assertLayout(in: dateSheet.view) + capture(window, named: "空镜库-起止日期筛选") + let confirm = try button(in: dateSheet.view, identifier: "scenic.materials.date.confirm") + assertReachable(confirm, window: window) + confirm.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController == nil && model.dateRange != nil } + XCTAssertEqual(model.filteredGroups.map(\.id), expected.map(\.id)) + XCTAssertEqual(model.dateRange?.start, model.calendar.startOfDay(for: day)) + XCTAssertEqual(model.dateRange?.end, model.calendar.startOfDay(for: day)) + XCTAssertTrue(model.selectedIDs.isEmpty) + capture(window, named: "空镜库-日期筛选结果") + } + + /// 月日滚轮编辑与全部时间都是草稿;取消不提交,确定才清除已有日期筛选。 + func testDateDraftCancellationAndAllDatesRequireConfirmation() async throws { + let controller = ScenicMaterialsViewController() + let window = makeWindow(root: controller) + defer { close(window) } + let model = controller.viewModel + _ = try await waitForLibrary(controller, window: window) + let day = try XCTUnwrap(model.filteredGroups.first?.capturedAt) + XCTAssertTrue(model.setDateRange(start: day, end: day)) + let originalRange = model.dateRange + controller.refreshDisplay(animated: false) + + try button(in: controller.view, identifier: "scenic.materials.dateFilter").sendActions(for: .touchUpInside) + try await settle(window) { self.isPresentationSettled(controller, type: ScenicMaterialDateFilterViewController.self) } + let cancelledSheet = try XCTUnwrap(controller.presentedViewController as? ScenicMaterialDateFilterViewController) + let picker = try XCTUnwrap(find(in: cancelledSheet.view, identifier: "scenic.materials.date.picker") as? UIPickerView) + try selectDate(model.minimumDate, in: picker, minimumDate: model.minimumDate, calendar: model.calendar) + XCTAssertEqual(model.dateRange, originalRange) + try button(in: cancelledSheet.view, identifier: "scenic.materials.date.cancel").sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController == nil } + XCTAssertEqual(model.dateRange, originalRange) + + try button(in: controller.view, identifier: "scenic.materials.dateFilter").sendActions(for: .touchUpInside) + try await settle(window) { self.isPresentationSettled(controller, type: ScenicMaterialDateFilterViewController.self) } + let allDatesSheet = try XCTUnwrap(controller.presentedViewController as? ScenicMaterialDateFilterViewController) + try button(in: allDatesSheet.view, identifier: "scenic.materials.date.all").sendActions(for: .touchUpInside) + XCTAssertEqual(model.dateRange, originalRange) + try button(in: allDatesSheet.view, identifier: "scenic.materials.date.confirm").sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController == nil && model.dateRange == nil } + XCTAssertEqual(model.dateFilterTitle, "全部时间") + } + + /// 预览从真实卡片打开并关闭,暂停中的选择和下载批次不受 Sheet 生命周期影响。 + func testPreviewOpenAndClosePreservesPausedBatchAndSelection() async throws { + let model = ScenicMaterialsViewModel() + model.applyScenario(.paused) + let controller = ScenicMaterialsViewController(viewModel: model) + let window = makeWindow(root: controller) + defer { close(window) } + _ = try await waitForLibrary(controller, window: window) + let clipID = try XCTUnwrap(model.filteredGroups.first?.clips.first?.id) + let selected = model.selectedIDs + let token = model.batchID + let completed = model.completedIDs + let preview = try button(in: controller.view, identifier: "scenic.materials.preview.\(clipID)") + assertReachable(preview, window: window) + preview.sendActions(for: .touchUpInside) + try await settle(window) { self.isPresentationSettled(controller, type: ScenicMaterialPreviewViewController.self) } + let sheet = try XCTUnwrap(controller.presentedViewController as? ScenicMaterialPreviewViewController) + assertLayout(in: sheet.view) + capture(window, named: "空镜库-视频预览") + let play = try button(in: sheet.view, identifier: "scenic.materials.preview.play") + assertReachable(play, window: window) + play.sendActions(for: .touchUpInside) + try await settle(window) { + self.allViews(in: sheet.view).compactMap { $0 as? UILabel }.contains { $0.text?.hasPrefix("正在播放 3 秒本地演示") == true } + } + XCTAssertEqual(model.batchID, token) + XCTAssertEqual(model.phase, .paused) + let closeButton = try button(in: sheet.view, identifier: "scenic.materials.preview.done") + assertReachable(closeButton, window: window) + closeButton.sendActions(for: .touchUpInside) + try await settle(window) { controller.presentedViewController == nil && controller.navigationController?.transitionCoordinator == nil } + XCTAssertEqual(model.selectedIDs, selected) + XCTAssertEqual(model.batchID, token) + XCTAssertEqual(model.completedIDs, completed) + XCTAssertEqual(model.phase, .paused) + } + + /// 实际下载按钮驱动单段演示到完成,继续选择后保留成功状态且不重复下载。 + func testDownloadButtonCompletesLocalDemoAndKeepsSuccessfulClipUnavailable() async throws { + let controller = ScenicMaterialsViewController() + let window = makeWindow(root: controller) + defer { close(window) } + let model = controller.viewModel + _ = try await waitForLibrary(controller, window: window) + let clipID = try XCTUnwrap(model.filteredGroups.first?.clips.first?.id) + try button(in: controller.view, identifier: "scenic.materials.select.\(clipID)").sendActions(for: .touchUpInside) + try await settle(window) { model.selectedCount == 1 } + let download = try button(in: controller.view, identifier: "scenic.materials.primary") + assertReachable(download, window: window) + XCTAssertTrue(download.isEnabled) + download.sendActions(for: .touchUpInside) + XCTAssertEqual(model.phase, .downloading) + XCTAssertEqual(model.batchItemIDs, [clipID]) + XCTAssertTrue(model.isSelectionLocked) + capture(window, named: "空镜库-本地下载演示") + try await settle(window, timeout: 6) { model.phase == .completed } + XCTAssertEqual(model.completedIDs, [clipID]) + XCTAssertEqual(model.completedCount, 1) + XCTAssertTrue(allViews(in: controller.view).compactMap { $0 as? UILabel }.contains { $0.text?.contains("未写入系统相册") == true }) + assertLayout(in: controller.view) + capture(window, named: "空镜库-下载演示完成") + try button(in: controller.view, identifier: "scenic.materials.primary").sendActions(for: .touchUpInside) + XCTAssertEqual(model.phase, .idle) + XCTAssertNil(model.batchID) + XCTAssertEqual(model.completedIDs, [clipID]) + XCTAssertFalse(model.canSelect(id: clipID)) + } + + /// 后台作废旧下载令牌,回前台保持暂停,手动继续仅处理剩余素材。 + func testBackgroundPausesRejectsStaleCallbacksAndRequiresManualResume() async throws { + let model = ScenicMaterialsViewModel() + model.applyScenario(.paused) + let controller = ScenicMaterialsViewController(viewModel: model) + let window = makeWindow(root: controller) + defer { close(window) } + _ = try await waitForLibrary(controller, window: window) + let completed = model.completedIDs + let pending = try XCTUnwrap(model.pendingIDs.first) + try button(in: controller.view, identifier: "scenic.materials.primary").sendActions(for: .touchUpInside) + let oldToken = try XCTUnwrap(model.batchID) + XCTAssertEqual(model.phase, .downloading) + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + let pausedToken = try XCTUnwrap(model.batchID) + XCTAssertNotEqual(oldToken, pausedToken) + XCTAssertEqual(model.phase, .paused) + model.receive(.completed, clipID: pending, batchID: oldToken) + XCTAssertEqual(model.completedIDs, completed) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await Task.sleep(nanoseconds: 450_000_000) + XCTAssertEqual(model.phase, .paused) + XCTAssertEqual(model.batchID, pausedToken) + XCTAssertEqual(model.completedIDs, completed) + capture(window, named: "空镜库-后台暂停待继续") + try button(in: controller.view, identifier: "scenic.materials.primary").sendActions(for: .touchUpInside) + XCTAssertNotEqual(model.batchID, pausedToken) + XCTAssertEqual(model.pendingIDs, [pending]) + XCTAssertEqual(model.completedIDs, completed) + try await settle(window, timeout: 6) { model.phase == .completed } + XCTAssertEqual(model.completedIDs, completed.union([pending])) + } + + /// 部分失败重试仅恢复失败段,已有成功段及批次顺序保持不变。 + func testRetryFailureOnlyRunsFailedClipAndPreservesSuccessfulDownloads() async throws { + let model = ScenicMaterialsViewModel() + model.applyScenario(.partialFailure) + let controller = ScenicMaterialsViewController(viewModel: model) + let window = makeWindow(root: controller) + defer { close(window) } + _ = try await waitForLibrary(controller, window: window) + let completed = model.completedIDs + let failed = model.failedIDs + let originalItems = model.batchItemIDs + XCTAssertEqual(completed.count, 1) + XCTAssertEqual(failed.count, 1) + capture(window, named: "空镜库-部分失败可重试") + let retry = try button(in: controller.view, identifier: "scenic.materials.primary") + assertReachable(retry, window: window) + retry.sendActions(for: .touchUpInside) + XCTAssertEqual(model.phase, .downloading) + XCTAssertEqual(Set(model.pendingIDs), failed) + XCTAssertEqual(model.batchItemIDs, originalItems) + XCTAssertEqual(model.completedIDs, completed) + XCTAssertTrue(model.failedIDs.isEmpty) + XCTAssertTrue(model.isSelectionLocked) + try await settle(window, timeout: 6) { model.phase == .completed } + XCTAssertEqual(model.completedIDs, completed.union(failed)) + XCTAssertEqual(model.completedCount, originalItems.count) + capture(window, named: "空镜库-失败重试完成") + } + + /// 演示权限不足时下载按钮只显示本地说明,不创建批次或触碰系统相册权限。 + func testDeniedDemoPermissionShowsExplanationWithoutStartingBatch() async throws { + let controller = ScenicMaterialsViewController(isDemoPhotoPermissionAllowed: false) + let window = makeWindow(root: controller) + defer { close(window) } + let model = controller.viewModel + _ = try await waitForLibrary(controller, window: window) + let clipID = try XCTUnwrap(model.filteredGroups.first?.clips.first?.id) + try button(in: controller.view, identifier: "scenic.materials.select.\(clipID)").sendActions(for: .touchUpInside) + try await settle(window) { model.selectedCount == 1 } + try button(in: controller.view, identifier: "scenic.materials.primary").sendActions(for: .touchUpInside) + try await settle(window) { self.isPresentationSettled(controller, type: UIAlertController.self) } + let alert = try XCTUnwrap(controller.presentedViewController as? UIAlertController) + XCTAssertEqual(alert.title, "需要相册保存权限") + XCTAssertTrue(alert.message?.contains("演示") == true) + XCTAssertEqual(alert.actions.count, 2) + XCTAssertNil(model.batchID) + XCTAssertEqual(model.phase, .idle) + XCTAssertEqual(model.selectedIDs, [clipID]) + capture(window, named: "空镜库-相册权限演示说明") + alert.dismiss(animated: false) + try await settle(window) { controller.presentedViewController == nil } + XCTAssertNil(model.batchID) + } + + private func makeWindow(root controller: UIViewController) -> UIWindow { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first + previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + window.overrideUserInterfaceStyle = .light + window.rootViewController = controller is UINavigationController ? controller : UINavigationController(rootViewController: controller) + window.makeKeyAndVisible() + window.layoutIfNeeded() + return window + } + + /// 通过两列滚轮的真实 delegate 路径选择日期,覆盖月份重载和按日提交。 + private func selectDate(_ date: Date, in picker: UIPickerView, minimumDate: Date, calendar: Calendar) throws { + let firstMonth = try XCTUnwrap(calendar.dateInterval(of: .month, for: minimumDate)?.start) + let desiredMonth = try XCTUnwrap(calendar.dateInterval(of: .month, for: date)?.start) + let monthRow = try XCTUnwrap(calendar.dateComponents([.month], from: firstMonth, to: desiredMonth).month) + picker.selectRow(monthRow, inComponent: 0, animated: false) + picker.delegate?.pickerView?(picker, didSelectRow: monthRow, inComponent: 0) + let firstDay = monthRow == 0 ? calendar.component(.day, from: minimumDate) : 1 + let dayRow = calendar.component(.day, from: date) - firstDay + XCTAssertGreaterThanOrEqual(dayRow, 0) + XCTAssertLessThan(dayRow, picker.numberOfRows(inComponent: 1)) + picker.selectRow(dayRow, inComponent: 1, animated: false) + picker.delegate?.pickerView?(picker, didSelectRow: dayRow, inComponent: 1) + } + + private func close(_ window: UIWindow) { + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + window.endEditing(true) + window.rootViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + + private func waitForLibrary(_ controller: ScenicMaterialsViewController, window: UIWindow) async throws -> UICollectionView { + let list = try XCTUnwrap(find(in: controller.view, identifier: "scenic.materials.list") as? UICollectionView) + try await settle(window) { list.numberOfSections > 2 && list.cellForItem(at: IndexPath(item: 0, section: 1)) != nil } + return list + } + + private func showGroupHeader(section: Int, list: UICollectionView, window: UIWindow) async throws { + let path = IndexPath(item: 0, section: section) + let attributes = try XCTUnwrap(list.collectionViewLayout.layoutAttributesForSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, at: path)) + list.setContentOffset(CGPoint(x: 0, y: max(-list.adjustedContentInset.top, attributes.frame.minY - 4)), animated: false) + try await settle(window) { list.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, at: path) != nil } + } + + private func isPresentationSettled(_ presenter: UIViewController, type: T.Type) -> Bool { + guard let presented = presenter.presentedViewController as? T else { return false } + return !presented.isBeingPresented && presented.transitionCoordinator == nil && presented.view.window != nil + } + + private func settle(_ window: UIWindow, timeout: TimeInterval = 4, condition: () -> Bool) async throws { + let deadline = Date().addingTimeInterval(timeout) + while Date() < deadline { + window.layoutIfNeeded() + window.rootViewController?.view.layoutIfNeeded() + if condition() { + try await Task.sleep(nanoseconds: 300_000_000) + window.layoutIfNeeded() + return + } + try await Task.sleep(nanoseconds: 20_000_000) + } + XCTFail("空镜库 UI 未在限定时间内进入预期状态") + } + + private func allViews(in root: UIView) -> [UIView] { [root] + root.subviews.flatMap { allViews(in: $0) } } + + private func find(in root: UIView, identifier: String) -> UIView? { + allViews(in: root).first { $0.accessibilityIdentifier == identifier } + } + + private func button(in root: UIView, identifier: String) throws -> UIButton { + try XCTUnwrap(find(in: root, identifier: identifier) as? UIButton, "缺少按钮 \(identifier)") + } + + private func isHiddenByAncestor(_ view: UIView) -> Bool { + view.isHidden || view.alpha < 0.01 || (view.superview.map { isHiddenByAncestor($0) } ?? false) + } + + private func visibleLabel(in root: UIView, text: String) -> UILabel? { + allViews(in: root).compactMap { $0 as? UILabel }.first { + ($0.text ?? $0.attributedText?.string) == text && !isHiddenByAncestor($0) + && !$0.bounds.isEmpty && $0.convert($0.bounds, to: root).intersects(root.bounds) + } + } + + private func assertReachable(_ view: UIView, window: UIWindow, file: StaticString = #filePath, line: UInt = #line) { + XCTAssertFalse(view.bounds.isEmpty, file: file, line: line) + XCTAssertFalse(isHiddenByAncestor(view), file: file, line: line) + let center = view.convert(CGPoint(x: view.bounds.midX, y: view.bounds.midY), to: window) + XCTAssertTrue(window.bounds.contains(center), "控件超出窗口:\(view.accessibilityIdentifier ?? "")", file: file, line: line) + let hit = window.hitTest(center, with: nil) + XCTAssertTrue(hit === view || hit?.isDescendant(of: view) == true, + "控件被遮挡:\(view.accessibilityIdentifier ?? "")", file: file, line: line) + } + + private func assertLayout(in root: UIView, file: StaticString = #filePath, line: UInt = #line) { + let ambiguous = allViews(in: root).filter { + !isHiddenByAncestor($0) && !$0.bounds.isEmpty && $0.convert($0.bounds, to: root).intersects(root.bounds) + && !$0.translatesAutoresizingMaskIntoConstraints && !String(describing: type(of: $0)).hasPrefix("_") && $0.hasAmbiguousLayout + } + XCTAssertTrue(ambiguous.isEmpty, "布局歧义:\(ambiguous.map { String(describing: type(of: $0)) + " " + ($0.accessibilityIdentifier ?? "") })", file: file, line: line) + } + + /// 截图保存在 xcresult 及应用临时目录,便于导出视觉证据。 + private func capture(_ window: UIWindow, named name: String) { + window.layoutIfNeeded() + let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in + window.drawHierarchy(in: window.bounds, afterScreenUpdates: true) + } + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("scenic-materials-ui-proof", isDirectory: true) + do { + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + try image.pngData()?.write(to: directory.appendingPathComponent(name + ".png"), options: .atomic) + } catch { + XCTFail("空镜库截图临时文件写入失败:\(error)") + } + } +} +#endif diff --git a/suixinkanTests/ScenicMaterialsFooterLayoutTests.swift b/suixinkanTests/ScenicMaterialsFooterLayoutTests.swift new file mode 100644 index 0000000..822015c --- /dev/null +++ b/suixinkanTests/ScenicMaterialsFooterLayoutTests.swift @@ -0,0 +1,254 @@ +import UIKit +import XCTest +@testable import suixinkan + +/// 验证景区素材下载底栏在窄屏及状态切换后仍能完整展示摘要并正确响应操作。 +@MainActor +final class ScenicMaterialsFooterLayoutTests: XCTestCase { + /// 选择、下载、暂停、失败和完成状态均不裁切文字、进度或操作按钮。 + func testFooterStatesFitCompactAndRegularWidths() throws { + for width in [320.0, 375.0, 393.0] { + let footer = ScenicMaterialsFooterView() + for state in 0..<6 { + apply(state, to: footer) + layout(footer, width: width) + XCTAssertGreaterThan(footer.bounds.height, 0) + let primary: UIButton = try control("scenic.materials.primary", in: footer) + XCTAssertGreaterThanOrEqual(primary.bounds.height, 44) + try assertCompleteSingleLineTitle(primary) + let visibleControls = allViews(footer).filter { + ($0.accessibilityIdentifier?.hasPrefix("scenic.materials.") == true) && isVisible($0, within: footer) + } + for view in visibleControls { + let rect = view.convert(view.bounds, to: footer) + XCTAssertGreaterThan(rect.width, 0, "状态 \(state):\(view.accessibilityIdentifier ?? "") 无宽度") + XCTAssertGreaterThan(rect.height, 0) + XCTAssertGreaterThanOrEqual(rect.minX, -0.5) + XCTAssertGreaterThanOrEqual(rect.minY, -0.5) + XCTAssertLessThanOrEqual(rect.maxX, width + 0.5) + XCTAssertLessThanOrEqual(rect.maxY, footer.bounds.maxY + 0.5) + if let label = view as? UILabel, !(label.text ?? "").isEmpty { + let needed = label.sizeThatFits(CGSize(width: label.bounds.width, height: .greatestFiniteMagnitude)) + XCTAssertLessThanOrEqual(needed.height, label.bounds.height + 1, "状态 \(state):文字被裁切") + } + if let button = view as? UIButton { try assertCompleteSingleLineTitle(button) } + } + } + } + } + + /// 真正挂载窗口后,初始完成态及从选择态切入完成态都显示完整按钮文字,防止内部标题被约束挤成窄列。 + func testButtonTitlesStayReadableInWindowAcrossInitialAndTransitionedStates() async throws { + for width in [320.0, 375.0, 393.0] { + for states in [[5], [0, 5], [1, 2, 3, 4, 5, 1, 5]] { + let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + .first { $0.activationState == .foregroundActive } + ?? UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first + let previousKeyWindow = scene?.windows.first { $0.isKeyWindow } + let window = scene.map { UIWindow(windowScene: $0) } ?? UIWindow(frame: UIScreen.main.bounds) + window.frame = scene?.coordinateSpace.bounds ?? UIScreen.main.bounds + let controller = UIViewController() + let footer = ScenicMaterialsFooterView() + // 在入窗前设置首个状态,覆盖直接打开“下载完成”演示时的初次布局。 + apply(try XCTUnwrap(states.first), to: footer) + window.rootViewController = controller + controller.loadViewIfNeeded() + controller.view.addSubview(footer) + footer.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + footer.widthAnchor.constraint(equalToConstant: width), + footer.centerXAnchor.constraint(equalTo: controller.view.centerXAnchor), + footer.bottomAnchor.constraint(equalTo: controller.view.bottomAnchor) + ]) + window.makeKeyAndVisible() + defer { + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } + for state in states { + apply(state, to: footer) + window.setNeedsLayout() + window.layoutIfNeeded() + try await Task.sleep(nanoseconds: 20_000_000) + controller.view.layoutIfNeeded() + footer.layoutIfNeeded() + XCTAssertTrue(footer.window === window) + XCTAssertEqual(footer.bounds.width, width, accuracy: 0.5) + let primary: UIButton = try control("scenic.materials.primary", in: footer) + try assertCompleteSingleLineTitle(primary) + if let secondary = allViews(footer).first(where: { + $0.accessibilityIdentifier == "scenic.materials.secondary" + }) as? UIButton, isVisible(secondary, within: footer) { + try assertCompleteSingleLineTitle(secondary) + } + if state == 5 { + XCTAssertEqual(primary.titleLabel?.text, "继续选择素材") + XCTAssertGreaterThan(primary.bounds.width, width * 0.8) + } + } + } + } + } + + /// 下载摘要和取消位于同一行,进度条与通栏按钮依次放在其下方。 + func testDownloadingKeepsCancelBesideSummaryAndPrimaryBelowProgress() throws { + let footer = ScenicMaterialsFooterView() + apply(2, to: footer) + layout(footer, width: 375) + let title: UILabel = try control("scenic.materials.footer.title", in: footer) + let cancel: UIButton = try control("scenic.materials.secondary", in: footer) + let progress: UIProgressView = try control("scenic.materials.footer.progress", in: footer) + let primary: UIButton = try control("scenic.materials.primary", in: footer) + let titleRect = title.convert(title.bounds, to: footer) + let cancelRect = cancel.convert(cancel.bounds, to: footer) + let progressRect = progress.convert(progress.bounds, to: footer) + let primaryRect = primary.convert(primary.bounds, to: footer) + XCTAssertEqual(titleRect.midY, cancelRect.midY, accuracy: 1) + XCTAssertLessThanOrEqual(titleRect.maxX, cancelRect.minX) + XCTAssertLessThanOrEqual(max(titleRect.maxY, cancelRect.maxY), progressRect.minY) + XCTAssertLessThan(progressRect.maxY, primaryRect.minY) + XCTAssertEqual(primaryRect.minX, progressRect.minX, accuracy: 1) + XCTAssertEqual(primaryRect.maxX, progressRect.maxX, accuracy: 1) + } + + /// 失败时继续选择和重试并排;完成后仅保留通栏主操作,回到选择态不残留旧进度。 + func testResultAndSelectionTransitionsRemoveStaleControls() throws { + let footer = ScenicMaterialsFooterView() + apply(1, to: footer) + layout(footer, width: 320) + let selectionHeight = footer.bounds.height + for _ in 0..<3 { + apply(2, to: footer) + layout(footer, width: 320) + let progress: UIProgressView = try control("scenic.materials.footer.progress", in: footer) + apply(4, to: footer) + layout(footer, width: 320) + let secondary: UIButton = try control("scenic.materials.secondary", in: footer) + let primary: UIButton = try control("scenic.materials.primary", in: footer) + let secondaryRect = secondary.convert(secondary.bounds, to: footer) + let primaryRect = primary.convert(primary.bounds, to: footer) + XCTAssertTrue(isVisible(secondary, within: footer)) + XCTAssertEqual(secondaryRect.midY, primaryRect.midY, accuracy: 1) + XCTAssertLessThan(secondaryRect.maxX, primaryRect.minX) + XCTAssertEqual(secondaryRect.width, primaryRect.width, accuracy: 1) + + apply(5, to: footer) + layout(footer, width: 320) + XCTAssertFalse(isVisible(secondary, within: footer)) + let detail: UILabel = try control("scenic.materials.footer.detail", in: footer) + XCTAssertTrue(detail.text?.contains("未写入系统相册") == true) + XCTAssertGreaterThan(primary.bounds.width, primaryRect.width * 1.8) + + apply(1, to: footer) + layout(footer, width: 320) + XCTAssertEqual(footer.bounds.height, selectionHeight, accuracy: 1) + XCTAssertEqual(primary.title(for: .normal), "下载所选(2)") + let activity: UIActivityIndicatorView = try control("scenic.materials.footer.activity", in: footer) + XCTAssertFalse(isVisible(secondary, within: footer)) + XCTAssertFalse(isVisible(progress, within: footer)) + XCTAssertFalse(activity.isAnimating) + XCTAssertFalse(isVisible(activity, within: footer)) + } + } + + /// 忙碌时主操作禁用而取消可用;暂停及失败状态继续派发各自的操作回调。 + func testBusyPrimaryCannotDispatchButCancelAndResumeCan() throws { + let footer = ScenicMaterialsFooterView() + var primaryCalls = 0 + var secondaryCalls = 0 + footer.onPrimaryTap = { primaryCalls += 1 } + footer.onSecondaryTap = { secondaryCalls += 1 } + apply(2, to: footer) + layout(footer, width: 393) + let primary: UIButton = try control("scenic.materials.primary", in: footer) + let secondary: UIButton = try control("scenic.materials.secondary", in: footer) + let activity: UIActivityIndicatorView = try control("scenic.materials.footer.activity", in: footer) + XCTAssertFalse(primary.isEnabled) + XCTAssertEqual(primary.backgroundColor, ScenicMaterialsStyle.primary) + XCTAssertTrue(activity.isAnimating) + XCTAssertTrue(secondary.isEnabled) + primary.sendActions(for: .touchUpInside) + secondary.sendActions(for: .touchUpInside) + XCTAssertEqual(primaryCalls, 0) + XCTAssertEqual(secondaryCalls, 1) + + for state in [3, 4] { + apply(state, to: footer) + layout(footer, width: 393) + XCTAssertTrue(primary.isEnabled) + XCTAssertFalse(activity.isAnimating) + primary.sendActions(for: .touchUpInside) + secondary.sendActions(for: .touchUpInside) + } + XCTAssertEqual(primaryCalls, 2) + XCTAssertEqual(secondaryCalls, 3) + } + + private func apply(_ state: Int, to footer: ScenicMaterialsFooterView) { + switch state { + case 0, 1: + footer.configure(title: "已选 \(state == 0 ? 0 : 2) 段", detail: "本地演示 · 不下载或保存真实文件", + primaryTitle: state == 0 ? "下载所选" : "下载所选(2)", primaryEnabled: state == 1, + layout: .selection) + case 2: + footer.configure(title: "下载中 · 0/2 段", detail: nil, primaryTitle: "正在下载…", primaryEnabled: false, + secondaryTitle: "取消", progress: 0.35, layout: .progress, isBusy: true) + case 3: + footer.configure(title: "已暂停 · 已完成 1/2 段", detail: "已完成项已保留,请手动继续", + primaryTitle: "继续下载", primaryEnabled: true, secondaryTitle: "取消", + progress: 0.5, layout: .progress) + case 4: + footer.configure(title: "完成 1 段 · 失败 1 段", detail: "演示结果 · 未保存真实文件", + primaryTitle: "重试失败(1)", primaryEnabled: true, secondaryTitle: "继续选择", + layout: .result) + default: + footer.configure(title: "演示完成 2 段", detail: "未写入系统相册", primaryTitle: "继续选择素材", + primaryEnabled: true, layout: .result) + } + } + + private func layout(_ footer: UIView, width: Double) { + let size = footer.systemLayoutSizeFitting(CGSize(width: width, height: 1), + withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) + footer.frame = CGRect(origin: .zero, size: size) + footer.setNeedsLayout() + footer.layoutIfNeeded() + } + + private func control(_ identifier: String, in root: UIView) throws -> T { + try XCTUnwrap(allViews(root).first { $0.accessibilityIdentifier == identifier } as? T) + } + + private func assertCompleteSingleLineTitle(_ button: UIButton, + file: StaticString = #filePath, line: UInt = #line) throws { + let label = try XCTUnwrap(button.titleLabel, file: file, line: line) + let title = try XCTUnwrap(button.currentTitle, file: file, line: line) + let font = try XCTUnwrap(label.font, file: file, line: line) + let measured = (title as NSString).size(withAttributes: [.font: font]) + let rect = label.convert(label.bounds, to: button) + XCTAssertEqual(label.text, title, file: file, line: line) + XCTAssertEqual(label.numberOfLines, 1, "按钮应单行完整显示:\(title)", file: file, line: line) + XCTAssertTrue(isVisible(label, within: button), file: file, line: line) + XCTAssertGreaterThanOrEqual(rect.width + 1, measured.width, "按钮标题被挤窄:\(title)", file: file, line: line) + XCTAssertGreaterThanOrEqual(rect.height + 1, font.lineHeight, file: file, line: line) + XCTAssertGreaterThanOrEqual(rect.minX, -0.5, file: file, line: line) + XCTAssertGreaterThanOrEqual(rect.minY, -0.5, file: file, line: line) + XCTAssertLessThanOrEqual(rect.maxX, button.bounds.maxX + 0.5, file: file, line: line) + XCTAssertLessThanOrEqual(rect.maxY, button.bounds.maxY + 0.5, file: file, line: line) + let fitted = label.sizeThatFits(CGSize(width: rect.width, height: .greatestFiniteMagnitude)) + XCTAssertLessThanOrEqual(fitted.height, font.lineHeight + 1, "按钮标题被挤成多行:\(title)", file: file, line: line) + } + + private func allViews(_ view: UIView) -> [UIView] { [view] + view.subviews.flatMap { allViews($0) } } + + private func isVisible(_ view: UIView, within root: UIView) -> Bool { + var current: UIView? = view + while let candidate = current { + if candidate.isHidden || candidate.alpha == 0 { return false } + if candidate === root { return true } + current = candidate.superview + } + return false + } +} diff --git a/suixinkanTests/ScenicMaterialsRemoteLoadingTests.swift b/suixinkanTests/ScenicMaterialsRemoteLoadingTests.swift new file mode 100644 index 0000000..5becf9f --- /dev/null +++ b/suixinkanTests/ScenicMaterialsRemoteLoadingTests.swift @@ -0,0 +1,193 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 验证正式空境库的真实请求、可重试错误和离页后迟到响应隔离。 +@MainActor +final class ScenicMaterialsRemoteLoadingTests: XCTestCase { + /// 正式模式不生成预览素材;真实空响应仍保存保留策略与原始响应。 + func testEmptyResponseFinishesLoadingWithoutGeneratingDemoData() async throws { + let session = MockURLSession(responses: [try envelope()]) + let model = makeModel() + XCTAssertTrue(model.routes.isEmpty) + XCTAssertTrue(model.allGroups.isEmpty) + + await model.loadRemoteSessions(api: ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session))) + + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.loadError) + XCTAssertEqual(model.remoteSessions?.total, 0) + XCTAssertEqual(model.retentionDays, 90) + XCTAssertEqual(model.retentionTips, "素材保留 90 天,请及时下载") + XCTAssertTrue(model.routes.isEmpty) + XCTAssertTrue(model.allGroups.isEmpty) + XCTAssertTrue(model.selectedIDs.isEmpty) + XCTAssertFalse(model.canStartDownload) + XCTAssertEqual(model.emptyTitle, "暂无景区素材") + XCTAssertEqual(try query(session.requests[0])["scenic_id"], "271") + } + + /// 业务错误不能成为真实空库,用户重试成功后清除错误。 + func testBusinessErrorCanRecoverWithExplicitRetry() async throws { + let failure = Data(#"{"code":100099,"msg":"景区素材暂不可用","data":[]}"#.utf8) + let session = MockURLSession(responses: [failure, try envelope()]) + let api = ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session)) + let model = makeModel() + + await model.loadRemoteSessions(api: api) + + XCTAssertFalse(model.isLoading) + XCTAssertEqual(model.loadError, "景区素材暂不可用") + XCTAssertEqual(model.emptyTitle, "素材加载失败") + XCTAssertNil(model.remoteSessions) + + await model.loadRemoteSessions(api: api) + + XCTAssertEqual(session.requests.count, 2) + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.loadError) + XCTAssertEqual(model.emptyTitle, "暂无景区素材") + XCTAssertNotNil(model.remoteSessions) + } + + /// 日期筛选实际发送到接口,空筛选结果不称为全库无素材。 + func testDateFilterIsSentAsInclusiveCalendarDates() async throws { + let session = MockURLSession(responses: [try envelope(dateFrom: "2026-10-01", dateTo: "2026-10-29")]) + let model = makeModel() + XCTAssertTrue(model.setDateRange(start: date(2026, 10, 1), end: date(2026, 10, 29))) + + await model.loadRemoteSessions(api: ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session))) + + XCTAssertEqual(try query(session.requests[0]), ["scenic_id": "271", "page": "1", "page_size": "20", + "retention_days": "90", "date_from": "2026-10-01", "date_to": "2026-10-29"]) + XCTAssertNil(model.loadError) + XCTAssertEqual(model.emptyTitle, "没有符合条件的素材") + XCTAssertEqual(model.emptyMessage, "试试其他航线或时间范围") + } + + /// 未确认的非空对象必须保留原值并显示可重试错误,不能冒充空库或演示素材。 + func testUnknownNonemptyObjectsRemainAvailableForContractInspection() async throws { + let session = MockURLSession(responses: [try envelope(list: [["unconfirmed_identity": 501]], total: 1)]) + let model = makeModel() + + await model.loadRemoteSessions(api: ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session))) + + XCTAssertFalse(model.isLoading) + XCTAssertNotNil(model.loadError) + XCTAssertEqual(model.emptyTitle, "素材加载失败") + XCTAssertEqual(model.remoteSessions?.total, 1) + XCTAssertEqual(model.remoteSessions?.list.first?["unconfirmed_identity"], .number(Decimal(501))) + XCTAssertTrue(model.allGroups.isEmpty) + XCTAssertTrue(model.routes.isEmpty) + XCTAssertFalse(model.canStartDownload) + } + + /// 离页先作废请求,即使网络无法及时取消,迟到成功也不恢复页面数据。 + func testCancelRemoteLoadRejectsLateSuccess() async throws { + let requested = expectation(description: "场次请求已发出") + let api = ScenicMaterialsDeferredAPI { requested.fulfill() } + let model = makeModel() + let task = Task { await model.loadRemoteSessions(api: api) } + await fulfillment(of: [requested], timeout: 1) + XCTAssertTrue(model.isLoading) + XCTAssertEqual(model.emptyTitle, "正在加载素材") + + model.cancelRemoteLoad() + api.complete(try response()) + await task.value + + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.remoteSessions) + XCTAssertNil(model.loadError) + XCTAssertTrue(model.allGroups.isEmpty) + } + + /// 调用方只取消任务时,不能留下永久加载状态或接纳随后返回的成功值。 + func testTaskCancellationFinishesLoadingAndRejectsLateSuccess() async throws { + let requested = expectation(description: "场次请求已发出") + let api = ScenicMaterialsDeferredAPI { requested.fulfill() } + let model = makeModel() + let task = Task { await model.loadRemoteSessions(api: api) } + await fulfillment(of: [requested], timeout: 1) + + task.cancel() + api.complete(try response()) + await task.value + + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.remoteSessions) + XCTAssertNil(model.loadError) + } + + /// 使用固定公历和上海时区,日期查询不依赖运行机器的日历或当天时间。 + private func makeModel() -> ScenicMaterialsViewModel { + ScenicMaterialsViewModel(context: ScenicMaterialContext(userID: "remote-loading-user", scenicID: "271", scenicName: "测试景区"), + now: date(2026, 10, 29), calendar: calendar, isRemote: true) + } + + /// 接口日期与页面日历统一使用上海日期。 + private var calendar: Calendar { + var calendar = Calendar(identifier: .gregorian) + calendar.timeZone = TimeZone(identifier: "Asia/Shanghai")! + return calendar + } + + /// 构造测试内固定日界限。 + private func date(_ year: Int, _ month: Int, _ day: Int) -> Date { + calendar.date(from: DateComponents(year: year, month: month, day: day))! + } + + /// 保留部署接口真实根结构,未知非空子项只用于验证原样保留而不表示协议。 + private func envelope(list: [[String: Any]] = [], total: Int = 0, dateFrom: String = "", dateTo: String = "") throws -> Data { + let payload: [String: Any] = [ + "list": list, "groups": [] as [Any], "total": total, "page": 1, "page_size": 20, + "retention_days": 90, "retention_tips": "素材保留 90 天,请及时下载", + "filter": ["air_line_id": 0, "date_from": dateFrom, "date_to": dateTo], + "filter_options": ["air_lines": [] as [Any]], + ] + return try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload]) + } + + /// 延迟替身返回与真实接口一致的空响应。 + private func response() throws -> ScenicMaterialsSessionsResponse { + try XCTUnwrap(JSONDecoder().decode(APIEnvelope.self, from: envelope()).data) + } + + /// 检查完整服务端查询范围。 + private func query(_ request: URLRequest) throws -> [String: String] { + let url = try XCTUnwrap(request.url) + let items = try XCTUnwrap(URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems) + return Dictionary(uniqueKeysWithValues: items.map { ($0.name, $0.value ?? "") }) + } +} + +/// 可控制响应返回时机的只读服务替身,模拟取消后仍返回成功的网络层。 +@MainActor +private final class ScenicMaterialsDeferredAPI: ScenicMaterialsServing { + private var continuation: CheckedContinuation? + private let onRequest: () -> Void + + /// 请求挂起后通过回调唤醒测试,避免轮询或固定等待。 + init(onRequest: @escaping () -> Void) { self.onRequest = onRequest } + + /// 挂起场次请求直到测试发出回执。 + func sessions(query: ScenicMaterialsQuery) async throws -> ScenicMaterialsSessionsResponse { + try await withCheckedThrowingContinuation { continuation in + self.continuation = continuation + onRequest() + } + } + + /// 列表加载测试不应请求任何场次详情。 + func sessionDetail(scenicMediaID: Int) async throws -> ScenicMaterialsSessionDetailResponse { + XCTFail("列表加载不应请求场次详情") + throw APIError.networkFailed("测试不提供详情") + } + + /// 返回一次成功结果,模拟异步请求的迟到回执。 + func complete(_ response: ScenicMaterialsSessionsResponse) { + let pending = continuation + continuation = nil + pending?.resume(returning: response) + } +} diff --git a/suixinkanTests/ScenicMaterialsRemoteMapperTests.swift b/suixinkanTests/ScenicMaterialsRemoteMapperTests.swift new file mode 100644 index 0000000..83bff17 --- /dev/null +++ b/suixinkanTests/ScenicMaterialsRemoteMapperTests.swift @@ -0,0 +1,232 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 使用实测字段形态的内存夹具验证场次映射,不访问接口、媒体或相册。 +final class ScenicMaterialsRemoteMapperTests: XCTestCase { + /// 场次和航线使用后端独立身份,拍摄时间按指定业务时区读取。 + func testObservedSessionAndRouteFieldsMapWithoutUsingOrderOrTaskIdentity() throws { + let response = try sessionsResponse() + let routes = try ScenicMaterialsRemoteMapper.routes(from: response) + let sessions = try ScenicMaterialsRemoteMapper.sessions(from: response, scenicID: 271, calendar: calendar) + + XCTAssertEqual(routes, [ScenicMaterialRoute(id: "287", name: "赛湖东岸八分钟观景航线")]) + XCTAssertEqual(sessions.count, 1) + let session = try XCTUnwrap(sessions.first) + XCTAssertEqual(session.id, 1433) + XCTAssertEqual(session.scenicID, 271) + XCTAssertEqual(session.routeID, "287") + XCTAssertEqual(session.routeName, routes[0].name) + XCTAssertEqual(session.materialCount, 2) + XCTAssertEqual(calendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: session.capturedAt), + DateComponents(year: 2026, month: 10, day: 29, hour: 11, minute: 1, second: 56)) + } + + /// 素材地址保持签名值,大小使用原始字节数;旧响应缺失时长时不伪造。 + func testObservedDetailPreservesRemoteMetadataAndSortsClipNumbers() throws { + let session = try mappedSession() + let signedURL = "https://media.example.com/clip.mp4?Signature=fixture-signature&Expires=123" + let detail = try detailResponse(materials: [ + material(id: 5412, ordinal: "02"), + material(id: 5413, ordinal: "01", extra: ["oss_url": signedURL, "size_bytes": 67_541_303_296]), + ]) + let group = try ScenicMaterialsRemoteMapper.group(session: session, detail: detail) + + XCTAssertEqual(group.id, "1433") + XCTAssertEqual(group.routeID, "287") + XCTAssertEqual(group.capturedAt, session.capturedAt) + XCTAssertEqual(group.clips.map(\.ordinal), [1, 2]) + let clip = try XCTUnwrap(group.clips.first) + XCTAssertEqual(clip.id, "scenic-media:1433:5413") + XCTAssertEqual(clip.groupID, "1433") + XCTAssertEqual(clip.remoteURL?.absoluteString, signedURL) + XCTAssertEqual(clip.coverURL?.absoluteString, "https://media.example.com/cover.jpg") + XCTAssertEqual(clip.fileSizeBytes, 67_541_303_296) + XCTAssertEqual(clip.fileLabel, "片段01") + XCTAssertEqual(clip.durationSeconds, -1) + XCTAssertEqual(clip.durationText, "时长未知") + XCTAssertEqual(clip.resolution, "分辨率未知") + XCTAssertTrue(clip.coverAssetName.isEmpty) + XCTAssertTrue(clip.isRemote) + XCTAssertTrue(clip.isAvailable) + } + + /// 新版详情使用片段秒数和字节数,不把场次时长或展示文案当作视频元数据。 + func testUpdatedDetailMapsClipDurationAndCorrectedBytes() throws { + let detail = try detailResponse(materials: [ + material(id: 5406, extra: ["duration_seconds": 9, "duration": 999, + "duration_label": "忽略文案", "size_bytes": 46_778_020]), + material(id: 5407, ordinal: "02", extra: ["duration_seconds": 46, "size_bytes": 100_409_939]), + ], identityExtra: ["duration_seconds": 477]) + let clips = try ScenicMaterialsRemoteMapper.group(session: mappedSession(), detail: detail).clips + + XCTAssertEqual(clips.map(\.durationSeconds), [9, 46]) + XCTAssertEqual(clips.map(\.durationText), ["00:09", "00:46"]) + XCTAssertEqual(clips.map(\.fileSizeBytes), [46_778_020, 100_409_939]) + XCTAssertEqual(clips.map(\.sizeText), ["46.8MB", "100.4MB"]) + } + + /// 缺失、错误类型、负数、小数或溢出的元数据保持未知,不能变成零或猜测其他字段。 + func testInvalidDurationAndSizeStayUnknown() throws { + let invalidValues: [Any] = [NSNull(), true, "9", -1, 1.5, 1e30] + for value in invalidValues { + let detail = try detailResponse(materials: [material(extra: [ + "duration_seconds": value, "duration": 9, "size_bytes": value, + ])]) + let clip = try XCTUnwrap(ScenicMaterialsRemoteMapper.group(session: mappedSession(), detail: detail).clips.first) + XCTAssertEqual(clip.durationSeconds, -1) + XCTAssertEqual(clip.durationText, "时长未知") + XCTAssertEqual(clip.fileSizeBytes, -1) + XCTAssertEqual(clip.sizeText, "大小未知") + } + } + + /// 分秒及小时边界正确;后端异常大秒数也不擅自转换成毫秒或截断为 32 位整数。 + func testDurationFormattingPreservesZeroHourBoundaryAndBackendLargeValue() throws { + let samples: [(Int, String)] = [ + (0, "00:00"), (59, "00:59"), (60, "01:00"), (3_599, "59:59"), + (3_600, "01:00:00"), (3_661, "01:01:01"), (19_004_641, "5279:04:01"), + (Int.max, "2562047788015215:30:07"), + ] + for (seconds, expected) in samples { + let detail = try detailResponse(materials: [material(extra: ["duration_seconds": seconds, "size_bytes": 0])]) + let clip = try XCTUnwrap(ScenicMaterialsRemoteMapper.group(session: mappedSession(), detail: detail).clips.first) + XCTAssertEqual(clip.durationSeconds, seconds) + XCTAssertEqual(clip.durationText, expected) + XCTAssertEqual(clip.fileSizeBytes, 0) + XCTAssertEqual(clip.sizeText, "0MB") + } + } + + /// 缺地址、非网络地址及权限关闭均保留元数据,但不能变成可播放的演示文件。 + func testUnavailableAndUnsupportedMaterialsNeverFallBackToDemo() throws { + let session = try mappedSession() + let variants: [[String: Any]] = [ + ["oss_url": NSNull()], ["oss_url": "file:///private/clip.mp4"], + ["oss_url": "ftp://example.com/clip.mp4"], ["oss_url": "/clip.mp4"], + ["selectable": false], ["downloadable": false], ["file_type": 1], + ] + for extra in variants { + let detail = try detailResponse(materials: [material(extra: extra)]) + let clip = try XCTUnwrap(ScenicMaterialsRemoteMapper.group(session: session, detail: detail).clips.first) + XCTAssertTrue(clip.isRemote) + XCTAssertFalse(clip.isAvailable) + XCTAssertTrue(clip.coverAssetName.isEmpty) + if extra["oss_url"] != nil { XCTAssertNil(clip.remoteURL) } + } + } + + /// 列表、详情及素材的所属身份必须相互一致,不能跨场次或跨景区展示。 + func testCrossScenicSessionAndDetailIdentitiesAreRejected() throws { + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.sessions(from: sessionsResponse(), scenicID: 999, calendar: calendar)) + let session = try mappedSession() + for extra in [["scenic_media_id": 1432], ["scenic_id": 999], ["air_line_id": 273]] { + let detail = try detailResponse(identityExtra: extra) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.group(session: session, detail: detail)) + } + let wrongMaterial = try detailResponse(materials: [material(extra: ["scenic_media_id": 1432])]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.group(session: session, detail: wrongMaterial)) + let missingSession = try JSONDecoder().decode(ScenicMaterialsSessionDetailResponse.self, + from: Data(#"{"materials":[]}"#.utf8)) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.group(session: session, detail: missingSession)) + } + + /// 重复身份会破坏 Diffable 与整组选择,必须在进入页面前拒绝。 + func testDuplicateSessionRouteAndMaterialIdentitiesAreRejected() throws { + let repeatedSession = try sessionsResponse(list: [sessionFields(), sessionFields()]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.sessions(from: repeatedSession, scenicID: 271, calendar: calendar)) + let repeatedRoute = try sessionsResponse(routes: [routeFields(), routeFields()]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.routes(from: repeatedRoute)) + let session = try mappedSession() + let repeatedMaterial = try detailResponse(materials: [material(), material()]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.group(session: session, detail: repeatedMaterial)) + } + + /// 小数、越界或缺失的关键字段不能被截断或猜测成有效身份及拍摄日期。 + func testMalformedSessionIdentityDateAndCountAreRejected() throws { + for extra: [String: Any] in [ + ["scenic_media_id": 0], ["scenic_media_id": 1.5], ["scenic_media_id": "1433"], + ["scenic_media_id": NSNull()], ["scenic_media_id": 1e30], ["air_line_id": -1], + ["material_count": -1], ["log_stime": "2026-02-30 11:01:56"], ["log_stime": NSNull()], + ] { + let response = try sessionsResponse(list: [sessionFields(extra: extra)]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.sessions(from: response, scenicID: 271, calendar: calendar)) + } + let unknown = try sessionsResponse(list: [["unconfirmed_identity": 1433]]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.sessions(from: unknown, scenicID: 271, calendar: calendar)) + } + + /// 元数据缺失显示未知,详情声明的数量与数组不一致时不能执行不完整的整组选择。 + func testUnknownSizeAndIncompleteDetailCountAreHandledExplicitly() throws { + let session = try mappedSession() + let unknownSize = try detailResponse(materials: [material(extra: ["size_bytes": NSNull(), "cover_url": "file:///cover.jpg"])]) + let clip = try XCTUnwrap(ScenicMaterialsRemoteMapper.group(session: session, detail: unknownSize).clips.first) + XCTAssertEqual(clip.fileSizeBytes, -1) + XCTAssertEqual(clip.sizeText, "大小未知") + XCTAssertNil(clip.coverURL) + let incomplete = try detailResponse(materials: [material()], reportedCount: 2) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.group(session: session, detail: incomplete)) + } + + /// 航线显示名称为空时使用同一接口的 air_line_name,不采用本地演示名称。 + func testRouteLabelFallsBackOnlyToBackendAirLineName() throws { + let response = try sessionsResponse(routes: [routeFields(extra: ["route_label": " "])]) + XCTAssertEqual(try ScenicMaterialsRemoteMapper.routes(from: response).first?.name, "赛湖东岸八分钟观景航线") + let missing = try sessionsResponse(routes: [routeFields(extra: ["route_label": NSNull(), "air_line_name": NSNull()])]) + XCTAssertThrowsError(try ScenicMaterialsRemoteMapper.routes(from: missing)) + } + + /// 测试时区固定为接口业务使用的上海时区。 + private var calendar: Calendar { + var value = Calendar(identifier: .gregorian) + value.timeZone = TimeZone(identifier: "Asia/Shanghai")! + return value + } + + /// 以实测字段形态创建一个场次摘要。 + private func sessionFields(extra: [String: Any] = [:]) -> [String: Any] { + ["scenic_media_id": 1433, "scenic_id": 271, "air_line_id": 287, + "route_label": "赛湖东岸八分钟观景航线", "air_line_name": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", "material_count": 2].merging(extra) { _, new in new } + } + + /// 以实测字段形态创建航线选项。 + private func routeFields(extra: [String: Any] = [:]) -> [String: Any] { + ["air_line_id": 287, "route_label": "赛湖东岸八分钟观景航线", + "air_line_name": "赛湖东岸八分钟观景航线", "session_count": 1].merging(extra) { _, new in new } + } + + /// 构造页面接口已确认的分页容器。 + private func sessionsResponse(list: [[String: Any]]? = nil, routes: [[String: Any]]? = nil) throws -> ScenicMaterialsSessionsResponse { + let list = list ?? [sessionFields()] + let payload: [String: Any] = [ + "list": list, "groups": [] as [Any], "total": list.count, "page": 1, "page_size": 20, + "retention_days": 90, "retention_tips": "素材保留 90 天,请及时下载", + "filter": ["air_line_id": 0, "date_from": "", "date_to": ""], + "filter_options": ["air_lines": routes ?? [routeFields()]], + ] + return try JSONDecoder().decode(ScenicMaterialsSessionsResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } + + /// 取得其他测试共用的已映射场次。 + private func mappedSession() throws -> ScenicMaterialsRemoteSession { + try XCTUnwrap(ScenicMaterialsRemoteMapper.sessions(from: sessionsResponse(), scenicID: 271, calendar: calendar).first) + } + + /// 媒体测试仅使用保留域名,绝不请求真实文件。 + private func material(id: Int = 5413, ordinal: String = "01", extra: [String: Any] = [:]) -> [String: Any] { + ["id": id, "scenic_media_id": 1433, "view_album_detail_id": id, "fly_plan_log_id": 3571, + "clip_no": ordinal, "file_label": "片段\(ordinal)", "file_type": 2, + "oss_url": "https://media.example.com/clip.mp4", "cover_url": "https://media.example.com/cover.jpg", + "size_bytes": 123_456, "selectable": true, "downloadable": true].merging(extra) { _, new in new } + } + + /// 详情必须带有 session 归属,素材数量可覆盖用于模拟损坏响应。 + private func detailResponse(materials: [[String: Any]]? = nil, identityExtra: [String: Any] = [:], + reportedCount: Int? = nil) throws -> ScenicMaterialsSessionDetailResponse { + let materials = materials ?? [material()] + let payload: [String: Any] = ["session": sessionFields(extra: identityExtra), "materials": materials, + "material_count": reportedCount ?? materials.count] + return try JSONDecoder().decode(ScenicMaterialsSessionDetailResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } +} diff --git a/suixinkanTests/ScenicMaterialsRemotePagingTests.swift b/suixinkanTests/ScenicMaterialsRemotePagingTests.swift new file mode 100644 index 0000000..730d48f --- /dev/null +++ b/suixinkanTests/ScenicMaterialsRemotePagingTests.swift @@ -0,0 +1,355 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 基于实测字段的隔离分页测试,覆盖非空场次、详情并发和筛选后的迟到响应。 +@MainActor +final class ScenicMaterialsRemotePagingTests: XCTestCase { + /// 非空列表映射真实航线与完整片段,首屏不再被占位错误阻断。 + func testNonemptySessionsLoadRealGroupsAndAllRouteOptions() async throws { + let api = ScenicMaterialsPagingAPI(pages: [1: [.success(try fixture.page(ids: [501, 502], total: 3))]]) + let model = makeModel() + + await model.loadRemoteSessions(api: api) + + XCTAssertNil(model.loadError) + XCTAssertFalse(model.isLoading) + XCTAssertEqual(model.allGroups.map(\.id), ["501", "502"]) + XCTAssertEqual(model.routes.map(\.id), ["287", "273"]) + XCTAssertEqual(model.filteredClips.count, 2) + XCTAssertTrue(model.filteredClips.allSatisfy { $0.isRemote && $0.remoteURL != nil }) + XCTAssertEqual(model.remoteTotalCount, 3) + XCTAssertEqual(model.loadedRemoteSessionCount, 2) + XCTAssertTrue(model.hasMoreRemoteSessions) + XCTAssertEqual(Set(api.detailRequests), Set([501, 502])) + model.toggleGroup(id: "501") + XCTAssertEqual(model.selectedCount, 1) + XCTAssertTrue(model.canStartDownload) + } + + /// 分页去重且不清空选择;列表终点由真实场次总数决定。 + func testNextPageDeduplicatesSessionsAndKeepsSelection() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501, 502], total: 3))], + 2: [.success(try fixture.page(ids: [502, 503], total: 3, page: 2))], + ]) + let model = makeModel() + await model.loadRemoteSessions(api: api) + model.toggleGroup(id: "501") + let selected = model.selectedIDs + + await model.loadMoreRemoteSessions(api: api) + + XCTAssertNil(model.loadMoreError) + XCTAssertFalse(model.isLoadingMore) + XCTAssertEqual(model.allGroups.map(\.id), ["501", "502", "503"]) + XCTAssertEqual(model.selectedIDs, selected) + XCTAssertEqual(api.detailRequests.filter { $0 == 502 }.count, 1) + XCTAssertEqual(api.queries.map(\.page), [1, 2]) + XCTAssertFalse(model.hasMoreRemoteSessions) + await model.loadMoreRemoteSessions(api: api) + XCTAssertEqual(api.queries.count, 2) + } + + /// 下一页详情未完成时不能启动下载,完成后仍可下载首屏保留的选择。 + func testDownloadCannotStartWhileNextPageDetailsAreLoading() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501], total: 2))], + 2: [.success(try fixture.page(ids: [502], total: 2, page: 2))], + ]) + api.heldDetailIDs = [502] + let pendingDetail = expectation(description: "下一页详情挂起") + api.onDetailRequest = { if $0 == 502 { pendingDetail.fulfill() } } + let model = makeModel() + await model.loadRemoteSessions(api: api) + model.toggleGroup(id: "501") + XCTAssertTrue(model.canStartDownload) + let selected = model.selectedIDs + let task = Task { await model.loadMoreRemoteSessions(api: api) } + await fulfillment(of: [pendingDetail], timeout: 1) + + XCTAssertTrue(model.isLoadingMore) + XCTAssertFalse(model.canStartDownload) + XCTAssertFalse(model.startDownload()) + XCTAssertNil(model.batchID) + XCTAssertEqual(model.phase, .idle) + XCTAssertEqual(model.selectedIDs, selected) + + api.releaseHeldDetails() + await task.value + + XCTAssertFalse(model.isLoadingMore) + XCTAssertTrue(model.canStartDownload) + XCTAssertEqual(model.selectedIDs, selected) + XCTAssertTrue(model.startDownload()) + XCTAssertEqual(Set(model.batchItemIDs), selected) + } + + /// 第二页失败保留首屏和选择,重试同一页而不是跳页。 + func testPageFailureRetainsContentAndRetriesSamePage() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501], total: 2))], + 2: [.failure(.networkFailed("离线")), .success(try fixture.page(ids: [502], total: 2, page: 2))], + ]) + let model = makeModel() + await model.loadRemoteSessions(api: api) + model.toggleGroup(id: "501") + + await model.loadMoreRemoteSessions(api: api) + + XCTAssertEqual(model.allGroups.map(\.id), ["501"]) + XCTAssertEqual(model.selectedCount, 1) + XCTAssertNotNil(model.loadMoreError) + XCTAssertNil(model.loadError) + XCTAssertTrue(model.hasMoreRemoteSessions) + + await model.loadMoreRemoteSessions(api: api) + + XCTAssertEqual(api.queries.map(\.page), [1, 2, 2]) + XCTAssertNil(model.loadMoreError) + XCTAssertEqual(model.allGroups.count, 2) + XCTAssertFalse(model.hasMoreRemoteSessions) + } + + /// 详情失败不把不完整场次当作成功空组,重新加载能恢复。 + func testDetailFailureIsRetryableWithoutPartialPageOrDemoData() async throws { + let response = try fixture.page(ids: [501, 502], total: 2) + let api = ScenicMaterialsPagingAPI(pages: [1: [.success(response), .success(response)]]) + api.failingDetailIDs = [502] + let model = makeModel() + + await model.loadRemoteSessions(api: api) + + XCTAssertNotNil(model.loadError) + XCTAssertEqual(model.remoteSessions?.total, 2) + XCTAssertTrue(model.allGroups.isEmpty) + XCTAssertFalse(model.hasMoreRemoteSessions) + api.failingDetailIDs = [] + + await model.loadRemoteSessions(api: api) + + XCTAssertNil(model.loadError) + XCTAssertEqual(model.allGroups.count, 2) + } + + /// 切换航线和日期作废旧页码及选择,下一页仍携带完整筛选。 + func testFiltersResetPaginationAndNextPageKeepsExactQuery() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501], total: 2)), + .success(try fixture.page(ids: [601], total: 2, routeID: 273))], + 2: [.success(try fixture.page(ids: [602], total: 2, page: 2, routeID: 273))], + ]) + api.routeIDBySession = [601: 273, 602: 273] + let model = makeModel() + await model.loadRemoteSessions(api: api) + model.toggleGroup(id: "501") + + XCTAssertTrue(model.setRoute(id: "273")) + XCTAssertTrue(model.setDateRange(start: fixture.date(2026, 10, 28), end: fixture.date(2026, 10, 30))) + XCTAssertTrue(model.selectedIDs.isEmpty) + XCTAssertTrue(model.allGroups.isEmpty) + XCTAssertFalse(model.hasMoreRemoteSessions) + await model.loadRemoteSessions(api: api) + await model.loadMoreRemoteSessions(api: api) + + XCTAssertEqual(api.queries.map(\.page), [1, 1, 2]) + for query in api.queries.dropFirst() { + XCTAssertEqual(query.scenicID, 271) + XCTAssertEqual(query.airLineID, 273) + XCTAssertEqual(query.dateFrom, "2026-10-28") + XCTAssertEqual(query.dateTo, "2026-10-30") + XCTAssertEqual(query.pageSize, 20) + XCTAssertEqual(query.retentionDays, 90) + } + XCTAssertEqual(model.filteredGroups.map(\.id), ["601", "602"]) + } + + /// 10 月 30 日的实测 90 天窗口包含 8 月 1 日,客户端不能再次裁掉边界素材。 + func testServerRetentionBoundaryIsVisibleAndSelectable() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501], total: 1, capturedAt: "2026-08-01 12:00:00"))], + ]) + let model = makeModel() + + await model.loadRemoteSessions(api: api) + + XCTAssertEqual(model.minimumDate, fixture.date(2026, 8, 1)) + XCTAssertEqual(model.filteredGroups.map(\.id), ["501"]) + XCTAssertTrue(model.hasAnyMaterials) + model.toggleGroup(id: "501") + XCTAssertEqual(model.selectedCount, 1) + XCTAssertTrue(model.setDateRange(start: fixture.date(2026, 8, 1), end: fixture.date(2026, 8, 1))) + } + + /// 开始四个详情请求后等待回执,不向服务端一次性并发发出整页请求。 + func testDetailsHaveAtMostFourConcurrentRequests() async throws { + let ids = Array(501...508) + let api = ScenicMaterialsPagingAPI(pages: [1: [.success(try fixture.page(ids: ids, total: ids.count))]]) + api.heldDetailIDs = Set(ids) + let firstBatch = expectation(description: "首批四个详情已发出") + let secondBatch = expectation(description: "第二批四个详情已发出") + api.onDetailRequest = { _ in + if api.detailRequests.count == 4 { firstBatch.fulfill() } + if api.detailRequests.count == 8 { secondBatch.fulfill() } + } + let model = makeModel() + let task = Task { await model.loadRemoteSessions(api: api) } + await fulfillment(of: [firstBatch], timeout: 1) + + XCTAssertEqual(api.detailRequests.count, 4) + XCTAssertEqual(api.maximumConcurrentDetails, 4) + api.releaseHeldDetails() + await fulfillment(of: [secondBatch], timeout: 1) + XCTAssertEqual(api.maximumConcurrentDetails, 4) + api.releaseHeldDetails() + await task.value + + XCTAssertNil(model.loadError) + XCTAssertEqual(model.allGroups.map(\.id), ids.map(String.init)) + } + + /// 刷新期间上一页详情即使晚返回,也不能覆盖已完成的新查询结果。 + func testRefreshRejectsLateDetailsAndResetsPagination() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501], total: 2)), .success(try fixture.page(ids: [601], total: 1))], + ]) + api.heldDetailIDs = [501] + let oldDetail = expectation(description: "旧详情挂起") + api.onDetailRequest = { if $0 == 501 { oldDetail.fulfill() } } + let model = makeModel() + let oldTask = Task { await model.loadRemoteSessions(api: api) } + await fulfillment(of: [oldDetail], timeout: 1) + + await model.loadRemoteSessions(api: api) + XCTAssertEqual(model.allGroups.map(\.id), ["601"]) + api.releaseHeldDetails() + await oldTask.value + + XCTAssertEqual(model.allGroups.map(\.id), ["601"]) + XCTAssertEqual(model.remoteTotalCount, 1) + XCTAssertFalse(model.hasMoreRemoteSessions) + XCTAssertFalse(model.isLoading) + XCTAssertNil(model.loadError) + } + + /// 无新数据却仍声称有下一页时保留可重试错误,不静默显示“全部加载完成”。 + func testRepeatedPageDoesNotAdvanceOrClaimCompletion() async throws { + let api = ScenicMaterialsPagingAPI(pages: [ + 1: [.success(try fixture.page(ids: [501], total: 2))], + 2: [.success(try fixture.page(ids: [501], total: 2, page: 2))], + ]) + let model = makeModel() + await model.loadRemoteSessions(api: api) + + await model.loadMoreRemoteSessions(api: api) + + XCTAssertNotNil(model.loadMoreError) + XCTAssertTrue(model.hasMoreRemoteSessions) + XCTAssertEqual(model.allGroups.map(\.id), ["501"]) + XCTAssertEqual(api.detailRequests, [501]) + } + + private let fixture = ScenicMaterialsPagingFixture() + + /// 正式上下文固定为本次接口联调的景区及上海业务日期,不访问真实登录态。 + private func makeModel() -> ScenicMaterialsViewModel { + ScenicMaterialsViewModel(context: ScenicMaterialContext(userID: "paging-test", scenicID: "271", scenicName: "测试景区"), + now: fixture.date(2026, 10, 30), calendar: fixture.calendar, isRemote: true) + } +} + +/// 按已观察字段构造可变页码、场次和详情,仅作为隔离测试数据。 +private struct ScenicMaterialsPagingFixture { + var calendar: Calendar { + var value = Calendar(identifier: .gregorian) + value.timeZone = TimeZone(identifier: "Asia/Shanghai")! + return value + } + + /// 生成固定业务日期。 + func date(_ year: Int, _ month: Int, _ day: Int) -> Date { + calendar.date(from: DateComponents(year: year, month: month, day: day))! + } + + /// 创建真实格式的场次页,筛选回显由 API 层既有测试单独验证。 + func page(ids: [Int], total: Int, page: Int = 1, routeID: Int = 287, + capturedAt: String = "2026-10-29 11:01:56") throws -> ScenicMaterialsSessionsResponse { + let payload: [String: Any] = [ + "list": ids.map { ["scenic_media_id": $0, "scenic_id": 271, "air_line_id": routeID, + "route_label": "航线\(routeID)", "log_stime": capturedAt, "material_count": 1] }, + "groups": [], "total": total, "page": page, "page_size": 20, "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": ["air_line_id": 0, "date_from": "", "date_to": ""], + "filter_options": ["air_lines": [287, 273].map { ["air_line_id": $0, "route_label": "航线\($0)"] }], + ] + return try JSONDecoder().decode(ScenicMaterialsSessionsResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } + + /// 完整详情不包含网络资源,URL 仅用于检查真实片段的传递。 + func detail(id: Int, routeID: Int = 287) throws -> ScenicMaterialsSessionDetailResponse { + let payload: [String: Any] = [ + "session": ["scenic_media_id": id, "scenic_id": 271, "air_line_id": routeID], + "material_count": 1, + "materials": [["id": id + 10000, "scenic_media_id": id, "clip_no": "01", "file_label": "片段1", + "file_type": 2, "size_bytes": 123456, "selectable": true, "downloadable": true, + "oss_url": "https://example.com/\(id).mp4", "cover_url": "https://example.com/\(id).jpg"]], + ] + return try JSONDecoder().decode(ScenicMaterialsSessionDetailResponse.self, from: JSONSerialization.data(withJSONObject: payload)) + } +} + +/// 内存服务可控制分页失败和详情返回时机,不使用 URLSession 或真实接口。 +@MainActor +private final class ScenicMaterialsPagingAPI: ScenicMaterialsServing { + var pages: [Int: [Result]] + var routeIDBySession: [Int: Int] = [:] + var failingDetailIDs: Set = [] + var heldDetailIDs: Set = [] + var onDetailRequest: ((Int) -> Void)? + private(set) var queries: [ScenicMaterialsQuery] = [] + private(set) var detailRequests: [Int] = [] + private(set) var maximumConcurrentDetails = 0 + private var activeDetails = 0 + private var held: [Int: CheckedContinuation] = [:] + private let fixture = ScenicMaterialsPagingFixture() + + /// 按页码注入独立响应队列,重试消耗同一页下一个响应。 + init(pages: [Int: [Result]]) { self.pages = pages } + + /// 记录查询并返回对应页的预设结果。 + func sessions(query: ScenicMaterialsQuery) async throws -> ScenicMaterialsSessionsResponse { + queries.append(query) + guard var responses = pages[query.page], !responses.isEmpty else { + throw APIError.networkFailed("测试未提供该页") + } + let result = responses.removeFirst() + pages[query.page] = responses + return try result.get() + } + + /// 详情按场次生成,可挂起以断言并发上限与异步结果隔离。 + func sessionDetail(scenicMediaID: Int) async throws -> ScenicMaterialsSessionDetailResponse { + detailRequests.append(scenicMediaID) + activeDetails += 1 + maximumConcurrentDetails = max(maximumConcurrentDetails, activeDetails) + defer { activeDetails -= 1 } + if failingDetailIDs.contains(scenicMediaID) { throw APIError.networkFailed("详情暂不可用") } + if heldDetailIDs.contains(scenicMediaID) { + return try await withCheckedThrowingContinuation { continuation in + held[scenicMediaID] = continuation + onDetailRequest?(scenicMediaID) + } + } + onDetailRequest?(scenicMediaID) + return try fixture.detail(id: scenicMediaID, routeID: routeIDBySession[scenicMediaID] ?? 287) + } + + /// 释放当前挂起的一批详情,保留后续场次的挂起规则。 + func releaseHeldDetails() { + let pending = held + held.removeAll() + for (id, continuation) in pending { + continuation.resume(with: Result { try fixture.detail(id: id, routeID: routeIDBySession[id] ?? 287) }) + } + } +} diff --git a/suixinkanTests/ScenicMaterialsRequestLoggingTests.swift b/suixinkanTests/ScenicMaterialsRequestLoggingTests.swift new file mode 100644 index 0000000..1e715c1 --- /dev/null +++ b/suixinkanTests/ScenicMaterialsRequestLoggingTests.swift @@ -0,0 +1,212 @@ +import Foundation +import XCTest +@testable import suixinkan + +#if DEBUG +/// 使用内存响应核对空境库完整日志;普通模块仍保留原有日志策略。 +@MainActor +final class ScenicMaterialsRequestLoggingTests: XCTestCase { + /// 空境库使用统一机巢日志,保留分页筛选、请求头和完整响应。 + func testSessionsLogsParametersAndCompleteResponse() async throws { + let payload = Data(#"{"code":100000,"msg":"success","data":{"list":[],"groups":[],"total":0,"page":2,"page_size":30,"retention_days":90,"retention_tips":"素材保留 90 天,请及时下载","filter":{"air_line_id":123,"date_from":"2026-10-01","date_to":"2026-10-29"},"filter_options":{"air_lines":[]}}}"#.utf8) + let session = MockURLSession(responses: [payload]) + var logs: [String] = [] + var legacy: [String] = [] + let client = APIClient(environment: .testing, session: session, debugLogSink: { legacy.append($0) }, + droneDockLogSink: { logs.append($0) }) + client.bindAuthTokenProvider { "test-header-token" } + let result = try await ScenicMaterialsAPI(client: client).sessions(query: ScenicMaterialsQuery( + scenicID: 271, page: 2, pageSize: 30, airLineID: 123, + dateFrom: "2026-10-01", dateTo: "2026-10-29")) + XCTAssertTrue(legacy.isEmpty) + XCTAssertEqual(logs.count, 3) + let request = try event("request.started", in: logs) + XCTAssertEqual(request["method"] as? String, "GET") + XCTAssertEqual(request["path"] as? String, "/api/app/scenic-media/sessions") + let query = try XCTUnwrap(request["query"] as? [[String: String]]) + XCTAssertEqual(query.reduce(into: [String: String]()) { $0.merge($1) { _, new in new } }, [ + "scenic_id": "271", "page": "2", "page_size": "30", "retention_days": "90", + "air_line_id": "123", "date_from": "2026-10-01", "date_to": "2026-10-29"]) + let headers = try XCTUnwrap(request["request_headers"] as? [String: String]) + XCTAssertTrue(headers.values.contains("test-header-token")) + let response = try event("response.received", in: logs) + XCTAssertEqual(response["http_status"] as? Int, 200) + let envelope = try XCTUnwrap(response["body"] as? [String: Any]) + let data = try XCTUnwrap(envelope["data"] as? [String: Any]) + XCTAssertEqual(data["retention_tips"] as? String, result.retentionTips) + XCTAssertEqual(data["page"] as? Int, 2) + XCTAssertEqual(session.requests.count, 1) + } + + /// 完整签名 URL、嵌套凭证和业务字段保持原样,日志不改写 DTO。 + func testDetailPreservesNestedCredentialsAndSignedURL() async throws { + let signedURL = "https://test-user:test-password@media.example.com/clip.mp4?signature=test-signature#fragment" + let body: [String: Any] = ["code": 100000, "data": ["materials": [[ + "file_label": "片段一", "oss_url": signedURL, + "nested": ["items": [["token": "test-token", "Authorization": "test-authorization"]]] + ]]]] + let session = MockURLSession(responses: [try JSONSerialization.data(withJSONObject: body)]) + var logs: [String] = [] + let api = ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session, + droneDockLogSink: { logs.append($0) })) + let result = try await api.sessionDetail(scenicMediaID: 501) + let response = try event("response.received", in: logs) + let logged = try XCTUnwrap(response["body"] as? [String: Any]) + XCTAssertTrue(NSDictionary(dictionary: logged).isEqual(to: body)) + XCTAssertEqual(result.materials.first?["oss_url"], .string(signedURL)) + XCTAssertFalse(logs.joined().contains("")) + } + + /// 业务和 HTTP 拒绝在抛错前完整记录回包。 + func testRejectedResponsesKeepStatusAndOriginalBody() async throws { + for status in [200, 503] { + let body = Data(#"{"code":100099,"msg":"服务暂不可用","token":"test-token","data":null}"#.utf8) + var logs: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(responses: [body], statusCode: status), + droneDockLogSink: { logs.append($0) }) + do { + _ = try await ScenicMaterialsAPI(client: client).sessionDetail(scenicMediaID: 501) + XCTFail("必须保留业务错误") + } catch {} + let response = try event("response.received", in: logs) + XCTAssertEqual(response["http_status"] as? Int, status) + XCTAssertEqual((response["body"] as? [String: Any])?["token"] as? String, "test-token") + XCTAssertNotNil(try event("response.rejected", in: logs)) + } + } + + /// 网络失败记录原始说明和出错地址,仍向页面返回原有错误语义。 + func testNetworkFailureKeepsOriginalDescriptionAndURL() async throws { + let address = "https://example.com/clip.mp4?signature=test-signature" + let error = URLError(.timedOut, userInfo: [NSLocalizedDescriptionKey: "test-network-description", + NSURLErrorFailingURLStringErrorKey: address]) + var logs: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(results: [.failure(error)]), + droneDockLogSink: { logs.append($0) }) + do { + _ = try await ScenicMaterialsAPI(client: client).sessionDetail(scenicMediaID: 501) + XCTFail("网络失败必须抛出") + } catch let APIError.networkFailed(message) { XCTAssertEqual(message, "请求超时,请稍后重试") } + let failure = try event("request.failed", in: logs) + XCTAssertEqual(failure["code"] as? Int, -1001) + XCTAssertEqual(failure["message"] as? String, "test-network-description") + XCTAssertEqual(failure["failing_url"] as? String, address) + } + + /// 两种取消都只有请求和取消事件,不伪造响应。 + func testCancellationLogsEventForBothCancellationTypes() async throws { + for error in [CancellationError(), URLError(.cancelled)] as [Error] { + var logs: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(results: [.failure(error)]), + droneDockLogSink: { logs.append($0) }) + do { + _ = try await ScenicMaterialsAPI(client: client).sessionDetail(scenicMediaID: 501) + XCTFail("取消必须抛出") + } catch is CancellationError {} + XCTAssertEqual(logs.count, 2) + XCTAssertNotNil(try event("request.cancelled", in: logs)) + XCTAssertFalse(logs.joined().contains("response.received")) + } + } + + /// 无效参数在发起请求前被拒绝,不产生虚假网络日志。 + func testInvalidRequestsProduceNoLogsOrNetworkCalls() async { + let session = MockURLSession(responses: []) + var logs: [String] = [] + let api = ScenicMaterialsAPI(client: APIClient(environment: .testing, session: session, + droneDockLogSink: { logs.append($0) })) + do { _ = try await api.sessions(query: ScenicMaterialsQuery(scenicID: 0)); XCTFail("应拒绝") } catch {} + for id in [0, -1] { + do { _ = try await api.sessionDetail(scenicMediaID: id); XCTFail("应拒绝") } catch {} + } + XCTAssertTrue(session.requests.isEmpty) + XCTAssertTrue(logs.isEmpty) + } + + /// HTML 等文本响应也完整显示,便于排查网关错误。 + func testNonJSONResponsePreservesFullText() async throws { + let body = "test-token https://example.com/clip.mp4?signature=test-signature" + var logs: [String] = [] + let client = APIClient(environment: .testing, session: MockURLSession(responses: [Data(body.utf8)], statusCode: 502), + droneDockLogSink: { logs.append($0) }) + do { _ = try await ScenicMaterialsAPI(client: client).sessionDetail(scenicMediaID: 501); XCTFail("应失败") } + catch let APIError.httpStatus(status, _) { XCTAssertEqual(status, 502) } + XCTAssertEqual(try event("response.received", in: logs)["body"] as? String, body) + } + + /// 根据事件名读取结构化机巢日志。 + private func event(_ name: String, in logs: [String]) throws -> [String: Any] { + let objects = try logs.map(loggedJSON) + return try XCTUnwrap(objects.first { $0["event"] as? String == name }) + } + + /// 模块标签不能覆盖关闭正文日志的选项,请求与响应仍只记录概要。 + func testRedactedCategoryStillRespectsDisabledPayloadLogging() async throws { + let payload = Data(#"{"code":100000,"msg":"success","data":{"note":"response-private-note"}}"#.utf8) + let session = MockURLSession(responses: [payload]) + var logs: [String] = [] + let client = APIClient(environment: .testing, session: session, debugLogSink: { logs.append($0) }) + + let _: EmptyPayload = try await client.send(APIRequest( + method: .post, path: "/api/mock/logging-policy", + body: ["note": "request-private-note"], + logsPayload: false, redactedLogCategory: "景区空境库" + )) + + XCTAssertEqual(logs.count, 2) + XCTAssertEqual(try loggedJSON(logs[0])["path"] as? String, "/api/mock/logging-policy") + XCTAssertNotNil(try loggedJSON(logs[1])["response"]) + XCTAssertTrue(logs[1].contains("")) + XCTAssertFalse(logs.joined().contains("request-private-note")) + XCTAssertFalse(logs.joined().contains("response-private-note")) + let sentBody = try XCTUnwrap(session.requests.first?.httpBody) + let body = try XCTUnwrap(JSONSerialization.jsonObject(with: sentBody) as? [String: String]) + XCTAssertEqual(body["note"], "request-private-note") + } + + /// 请求地址及单独参数行均须脱敏,实际发送的参数和鉴权头保持不变。 + func testRequestQueryCredentialsAreRedactedWithoutChangingTransmission() async throws { + let payload = Data(#"{"code":100000,"msg":"success","data":{}}"#.utf8) + let session = MockURLSession(responses: [payload]) + var logs: [String] = [] + let client = APIClient(environment: .testing, session: session, debugLogSink: { logs.append($0) }) + let queryValues = [ + "token": "query-private-token", + "X-Amz-Credential": "query-private-credential", + "security_token": "query-private-security-token", + "page": "4", + "resource": "https://media.example.com/clip.mp4?Signature=query-private-url-signature#query-private-fragment", + ] + + let _: EmptyPayload = try await client.send(APIRequest( + method: .get, path: "/api/mock/logging-policy", + queryItems: queryValues.map { URLQueryItem(name: $0.key, value: $0.value) }, + headers: ["Authorization": "query-private-authorization"], + redactedLogCategory: "景区空境库" + )) + + XCTAssertEqual(logs.count, 2) + let combined = logs.joined(separator: "\n") + for secret in ["query-private-token", "query-private-credential", "query-private-security-token", + "query-private-url-signature", "query-private-fragment", "query-private-authorization"] { + XCTAssertFalse(combined.contains(secret), "请求日志泄漏敏感值:\(secret)") + } + let params = try XCTUnwrap(try loggedJSON(logs[0])["params"] as? [String: String]) + XCTAssertEqual(params["page"], "4") + XCTAssertEqual(params["resource"], "https://media.example.com/clip.mp4") + let sentRequest = try XCTUnwrap(session.requests.first) + let sentURL = try XCTUnwrap(sentRequest.url) + let sentItems = try XCTUnwrap(URLComponents(url: sentURL, resolvingAgainstBaseURL: false)?.queryItems) + let sentValues = Dictionary(uniqueKeysWithValues: sentItems.map { ($0.name, $0.value ?? "") }) + XCTAssertEqual(sentValues, queryValues) + XCTAssertEqual(sentRequest.value(forHTTPHeaderField: "Authorization"), "query-private-authorization") + } + + /// 解析响应日志首个 JSON 对象,以字段断言代替依赖字典键顺序。 + private func loggedJSON(_ log: String) throws -> [String: Any] { + let start = try XCTUnwrap(log.firstIndex(of: "{")) + let data = Data(log[start...].utf8) + return try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + } +} +#endif diff --git a/suixinkanTests/ScenicMaterialsViewModelTests.swift b/suixinkanTests/ScenicMaterialsViewModelTests.swift new file mode 100644 index 0000000..caae58c --- /dev/null +++ b/suixinkanTests/ScenicMaterialsViewModelTests.swift @@ -0,0 +1,365 @@ +import XCTest +@testable import suixinkan + +/// 验证独立空镜库的完整分组、日期范围和本机演示下载状态,不访问真实订单、相册或网络。 +final class ScenicMaterialsViewModelTests: XCTestCase { + /// 演示库包含两条有素材航线和一条空航线,同一航线按拍摄时间倒序排列。 + func testDemoLibraryGroupsRoutesAndDatesIndependentlyOfOrders() { + let model = makeModel() + XCTAssertEqual(model.routes.count, 3) + XCTAssertEqual(model.filteredGroups.map { $0.clips.count }, [5, 6, 3, 4, 5]) + XCTAssertEqual(model.filteredClips.count, 23) + XCTAssertEqual(model.filteredGroups.prefix(3).map(\.routeID), Array(repeating: model.routes[0].id, count: 3)) + XCTAssertGreaterThan(model.filteredGroups[0].capturedAt, model.filteredGroups[1].capturedAt) + XCTAssertEqual(model.capturedAtText(for: model.filteredGroups[0]), "10-23 17:20") + XCTAssertEqual(model.minimumDate, date(2026, 7, 29)) + XCTAssertEqual(model.maximumDate, date(2026, 10, 26)) + XCTAssertEqual(model.routeFilterTitle, "全部航线") + XCTAssertEqual(model.dateFilterTitle, "全部时间") + } + + /// 整组选择必须包含默认折叠的第六段,展开收起不增减选择。 + func testSelectWholeGroupIncludesCollapsedSixthClip() throws { + let model = makeModel() + let group = try XCTUnwrap(model.filteredGroups.first { $0.clips.count == 6 }) + XCTAssertEqual(model.visibleClips(in: group).count, 5) + model.toggleGroup(id: group.id) + XCTAssertEqual(model.selectedIDs, Set(group.clips.map(\.id))) + XCTAssertEqual(model.selectedCount, 6) + XCTAssertTrue(model.isGroupSelected(id: group.id)) + model.toggleExpandedGroup(id: group.id) + XCTAssertEqual(model.visibleClips(in: group).count, 6) + XCTAssertTrue(model.selectedIDs.contains(group.clips[5].id)) + model.toggleExpandedGroup(id: group.id) + XCTAssertEqual(model.visibleClips(in: group).count, 5) + XCTAssertEqual(model.selectedCount, 6) + model.toggleGroup(id: group.id) + XCTAssertTrue(model.selectedIDs.isEmpty) + } + + /// 不可用片段不能预览下载或被全组选中,空组也不表现为已全选。 + func testUnavailableClipsAreExcludedFromSelectionAndBatch() throws { + let route = ScenicMaterialRoute(id: "r", name: "测试航线") + let good = clip(id: "good", groupID: "g") + let unavailable = clip(id: "unavailable", groupID: "g", available: false) + let group = ScenicMaterialGroup(id: "g", routeID: route.id, capturedAt: date(2026, 10, 25), clips: [good, unavailable]) + let model = makeModel(routes: [route], groups: [group]) + model.toggleSelection(id: unavailable.id) + model.toggleSelection(id: "unknown") + XCTAssertTrue(model.selectedIDs.isEmpty) + XCTAssertFalse(model.canSelect(id: unavailable.id)) + XCTAssertEqual(model.downloadState(for: unavailable.id), .unavailable) + model.toggleGroup(id: group.id) + XCTAssertEqual(model.selectedIDs, [good.id]) + XCTAssertTrue(model.isGroupSelected(id: group.id)) + XCTAssertFalse(model.isGroupSelected(id: "unknown")) + XCTAssertTrue(model.startDownload()) + XCTAssertEqual(model.batchItemIDs, [good.id]) + let token = try XCTUnwrap(model.batchID) + model.receive(.completed, clipID: unavailable.id, batchID: token) + XCTAssertEqual(model.completedCount, 0) + } + + /// 切换航线移除隐藏选择,不把不可见素材带入下一次下载。 + func testChangingRoutePrunesHiddenSelectionAndUnknownRouteIsRejected() throws { + let model = makeModel() + let firstRouteGroup = model.filteredGroups[0] + let secondRouteGroup = try XCTUnwrap(model.filteredGroups.first { $0.routeID == model.routes[1].id }) + model.toggleSelection(id: firstRouteGroup.clips[0].id) + model.toggleSelection(id: secondRouteGroup.clips[0].id) + XCTAssertEqual(model.selectedCount, 2) + XCTAssertTrue(model.setRoute(id: model.routes[1].id)) + XCTAssertEqual(model.selectedIDs, [secondRouteGroup.clips[0].id]) + XCTAssertTrue(model.filteredGroups.allSatisfy { $0.routeID == model.routes[1].id }) + XCTAssertFalse(model.setRoute(id: "missing-route")) + XCTAssertEqual(model.selectedRouteID, model.routes[1].id) + model.resetFilters() + XCTAssertEqual(model.filteredGroups.count, 5) + XCTAssertEqual(model.selectedIDs, [secondRouteGroup.clips[0].id]) + } + + /// 日期按同一时区的日历日计算,包含首尾日全部时刻。 + func testDateRangeIncludesBothBoundaryDaysAndPrunesHiddenSelection() { + let model = makeModel() + model.toggleSelection(id: model.filteredGroups[4].clips[0].id) + model.toggleSelection(id: model.filteredGroups[0].clips[0].id) + XCTAssertTrue(model.setDateRange(start: date(2026, 10, 22, 12), end: date(2026, 10, 23, 8))) + XCTAssertEqual(model.dateRange, ScenicMaterialDateRange(start: date(2026, 10, 22), end: date(2026, 10, 23))) + XCTAssertEqual(model.filteredGroups.count, 4) + XCTAssertEqual(model.selectedCount, 1) + XCTAssertEqual(model.dateFilterTitle, "10.22 – 10.23") + XCTAssertTrue(model.setDateRange(start: date(2026, 10, 23), end: date(2026, 10, 23))) + XCTAssertEqual(model.filteredGroups.count, 3) + XCTAssertEqual(model.dateFilterTitle, "10.23") + XCTAssertTrue(model.setDateRange(start: nil, end: nil)) + XCTAssertEqual(model.filteredGroups.count, 5) + } + + /// 保留期外及未来批次不进入列表,即使没有手动设置日期筛选也不可选择。 + func testRetentionWindowIncludesFirstAndLastDayAndExcludesOutsideDates() { + let route = ScenicMaterialRoute(id: "route", name: "保留期航线") + let groups = [ + group(id: "expired", routeID: route.id, capturedAt: date(2026, 7, 28, 23)), + group(id: "first-day", routeID: route.id, capturedAt: date(2026, 7, 29, 0)), + group(id: "today", routeID: route.id, capturedAt: date(2026, 10, 26, 23)), + group(id: "future", routeID: route.id, capturedAt: date(2026, 10, 27)) + ] + let model = makeModel(routes: [route], groups: groups) + XCTAssertEqual(model.filteredGroups.map(\.id), ["today", "first-day"]) + XCTAssertFalse(model.canSelect(id: "expired-clip")) + XCTAssertFalse(model.canSelect(id: "future-clip")) + XCTAssertTrue(model.setDateRange(start: model.minimumDate, end: model.maximumDate)) + XCTAssertEqual(model.filteredGroups.count, 2) + } + + /// 反向、未来、保留期外和不完整日期不会悄悄改变已应用的有效筛选。 + func testInvalidDateRangesKeepPreviouslyAppliedRange() throws { + let model = makeModel() + XCTAssertTrue(model.setDateRange(start: date(2026, 10, 22), end: date(2026, 10, 23))) + let original = try XCTUnwrap(model.dateRange) + XCTAssertFalse(model.setDateRange(start: date(2026, 10, 24), end: date(2026, 10, 23))) + XCTAssertFalse(model.setDateRange(start: date(2026, 7, 28), end: date(2026, 10, 23))) + XCTAssertFalse(model.setDateRange(start: date(2026, 10, 23), end: date(2026, 10, 27))) + XCTAssertFalse(model.setDateRange(start: nil, end: date(2026, 10, 23))) + XCTAssertFalse(model.setDateRange(start: date(2026, 10, 23), end: nil)) + XCTAssertEqual(model.dateRange, original) + } + + /// 航线和日期共同生效,筛选空结果能恢复完整库而不改写源数据。 + func testCombinedFiltersAndResetRecoverNoResults() { + let model = makeModel() + XCTAssertTrue(model.setRoute(id: model.routes[1].id)) + XCTAssertTrue(model.setDateRange(start: date(2026, 10, 22), end: date(2026, 10, 22))) + XCTAssertTrue(model.filteredGroups.isEmpty) + XCTAssertEqual(model.emptyTitle, "没有符合条件的素材") + model.resetFilters() + XCTAssertEqual(model.filteredGroups.count, 5) + XCTAssertNil(model.selectedRouteID) + XCTAssertNil(model.dateRange) + } + + /// 开始下载冻结已选完整范围;选择和筛选无效,展开收起仍可浏览。 + func testRunningBatchFreezesSelectionAndFiltersButAllowsExpansion() throws { + let model = makeModel() + let group = try XCTUnwrap(model.filteredGroups.first { $0.clips.count == 6 }) + model.toggleGroup(id: group.id) + XCTAssertTrue(model.startDownload()) + let original = model.batchItemIDs + let token = try XCTUnwrap(model.batchID) + XCTAssertTrue(model.isSelectionLocked) + XCTAssertFalse(model.canStartDownload) + XCTAssertFalse(model.startDownload()) + XCTAssertFalse(model.setRoute(id: model.routes[2].id)) + XCTAssertFalse(model.setDateRange(start: model.maximumDate, end: model.maximumDate)) + model.toggleGroup(id: group.id) + model.toggleSelection(id: group.clips[0].id) + model.resetFilters() + model.toggleExpandedGroup(id: group.id) + XCTAssertEqual(model.visibleClips(in: group).count, 6) + XCTAssertEqual(model.selectedIDs, Set(original)) + XCTAssertEqual(model.batchItemIDs, original) + XCTAssertEqual(model.batchID, token) + XCTAssertNil(model.selectedRouteID) + XCTAssertNil(model.dateRange) + } + + /// 失败回执只结束该项,所有项有结果后才显示部分失败;重试不重复成功项。 + func testPartialFailureRetryKeepsSuccessfulItemsAndRejectsOldCallbacks() throws { + let model = makeModel() + let clips = Array(model.filteredClips.prefix(3)) + clips.forEach { model.toggleSelection(id: $0.id) } + XCTAssertTrue(model.startDownload()) + let oldToken = try XCTUnwrap(model.batchID) + model.receive(.completed, clipID: clips[0].id, batchID: oldToken) + model.receive(.failed, clipID: clips[1].id, batchID: oldToken) + XCTAssertEqual(model.phase, .downloading) + XCTAssertEqual(model.pendingIDs, [clips[2].id]) + model.receive(.completed, clipID: clips[2].id, batchID: oldToken) + XCTAssertEqual(model.phase, .partialFailure) + XCTAssertEqual(model.completedCount, 2) + XCTAssertEqual(model.failedCount, 1) + XCTAssertEqual(model.selectedIDs, [clips[1].id]) + XCTAssertTrue(model.retryFailedDownloads()) + let newToken = try XCTUnwrap(model.batchID) + XCTAssertNotEqual(newToken, oldToken) + XCTAssertEqual(model.totalCount, 3) + XCTAssertEqual(model.pendingIDs, [clips[1].id]) + model.receive(.completed, clipID: clips[1].id, batchID: oldToken) + XCTAssertEqual(model.completedCount, 2) + model.receive(.failed, clipID: clips[0].id, batchID: newToken) + XCTAssertEqual(model.completedCount, 2) + model.receive(.completed, clipID: clips[1].id, batchID: newToken) + XCTAssertEqual(model.phase, .completed) + XCTAssertEqual(model.completedCount, 3) + XCTAssertEqual(model.downloadProgress, 1) + XCTAssertTrue(model.selectedIDs.isEmpty) + } + + /// 暂停作废旧令牌;没有主动继续就保持暂停,继续仅处理尚未完成项。 + func testPauseResumeInvalidatesCallbacksAndPreservesCompletedFiles() throws { + let model = makeModel() + model.applyScenario(.selected) + XCTAssertTrue(model.startDownload()) + let original = model.batchItemIDs + let oldToken = try XCTUnwrap(model.batchID) + model.receive(.completed, clipID: original[0], batchID: oldToken) + model.receive(.progress(0.65), clipID: original[1], batchID: oldToken) + model.pauseDownload() + let pausedToken = try XCTUnwrap(model.batchID) + XCTAssertNotEqual(pausedToken, oldToken) + XCTAssertEqual(model.phase, .paused) + XCTAssertEqual(model.downloadState(for: original[1]), .paused) + model.receive(.completed, clipID: original[1], batchID: oldToken) + model.receive(.completed, clipID: original[1], batchID: pausedToken) + XCTAssertEqual(model.phase, .paused) + XCTAssertEqual(model.completedCount, 1) + XCTAssertFalse(model.setRoute(id: model.routes[1].id)) + XCTAssertTrue(model.continueDownload()) + XCTAssertNotEqual(model.batchID, pausedToken) + XCTAssertEqual(model.pendingIDs, [original[1]]) + XCTAssertEqual(model.progressByID[original[1]], 0) + XCTAssertEqual(model.completedCount, 1) + } + + /// 取消后旧回调失效,仅成功项保留,新批次不会把已成功文件重新下载。 + func testCancelPreservesOnlySuccessAndNewBatchExcludesCompleted() throws { + let model = makeModel() + let group = model.filteredGroups[0] + model.toggleGroup(id: group.id) + XCTAssertTrue(model.startDownload()) + let token = try XCTUnwrap(model.batchID) + let successfulID = group.clips[0].id + model.receive(.completed, clipID: successfulID, batchID: token) + model.receive(.failed, clipID: group.clips[1].id, batchID: token) + model.cancelDownload() + XCTAssertEqual(model.phase, .idle) + XCTAssertNil(model.batchID) + XCTAssertTrue(model.selectedIDs.isEmpty) + XCTAssertTrue(model.failedIDs.isEmpty) + XCTAssertEqual(model.completedIDs, [successfulID]) + model.receive(.completed, clipID: group.clips[2].id, batchID: token) + XCTAssertEqual(model.completedIDs, [successfulID]) + model.toggleGroup(id: group.id) + XCTAssertEqual(model.selectedCount, 4) + XCTAssertFalse(model.selectedIDs.contains(successfulID)) + XCTAssertTrue(model.startDownload()) + XCTAssertEqual(model.totalCount, 4) + XCTAssertFalse(model.batchItemIDs.contains(successfulID)) + } + + /// 进度不能倒退或被非有限值污染,重复终态不会把成功改回失败。 + func testProgressClampsAndTerminalCallbacksCannotRegressSuccess() throws { + let model = makeModel() + let id = model.filteredClips[0].id + model.toggleSelection(id: id) + XCTAssertTrue(model.startDownload()) + let token = try XCTUnwrap(model.batchID) + model.receive(.progress(0.8), clipID: id, batchID: token) + model.receive(.progress(0.3), clipID: id, batchID: token) + model.receive(.progress(.nan), clipID: id, batchID: token) + model.receive(.progress(.infinity), clipID: id, batchID: token) + XCTAssertEqual(model.progressByID[id], 0.8) + model.receive(.progress(2), clipID: id, batchID: token) + XCTAssertEqual(model.progressByID[id], 1) + XCTAssertEqual(model.phase, .downloading) + model.receive(.completed, clipID: id, batchID: token) + model.receive(.failed, clipID: id, batchID: token) + model.receive(.progress(0.1), clipID: id, batchID: token) + XCTAssertEqual(model.downloadState(for: id), .completed) + XCTAssertEqual(model.phase, .completed) + XCTAssertEqual(model.failedCount, 0) + } + + /// 完成后手动继续选择解锁筛选,但保留已经完成的本地演示标记。 + func testContinueSelectingKeepsCompletedHistoryAndUnlocksFilters() { + let model = makeModel() + model.applyScenario(.completed) + let completed = model.completedIDs + XCTAssertEqual(model.phase, .completed) + XCTAssertEqual(model.completedCount, 2) + XCTAssertTrue(model.isSelectionLocked) + model.continueSelecting() + XCTAssertEqual(model.phase, .idle) + XCTAssertFalse(model.isSelectionLocked) + XCTAssertEqual(model.completedIDs, completed) + XCTAssertTrue(model.setRoute(id: model.routes[1].id)) + XCTAssertEqual(model.totalCount, 0) + } + + /// 正在执行和暂停中的批次不能通过继续选择绕过取消/恢复。 + func testContinueSelectingDoesNotDiscardActiveOrPausedBatch() throws { + let model = makeModel() + model.applyScenario(.downloading) + let token = try XCTUnwrap(model.batchID) + model.continueSelecting() + XCTAssertEqual(model.phase, .downloading) + XCTAssertEqual(model.batchID, token) + model.pauseDownload() + let paused = model.batchID + model.continueSelecting() + XCTAssertEqual(model.phase, .paused) + XCTAssertEqual(model.batchID, paused) + } + + /// 空库与筛选空结果可分别演示,恢复正常时不保留上一演示状态。 + func testScenariosResetScopeAndSeparateEmptyLibraryFromNoResults() { + let model = makeModel() + model.applyScenario(.empty) + XCTAssertEqual(model.emptyTitle, "暂无景区素材") + XCTAssertTrue(model.allGroups.isEmpty) + XCTAssertFalse(model.hasAnyMaterials) + XCTAssertTrue(model.setRoute(id: model.routes[0].id)) + XCTAssertEqual(model.emptyTitle, "暂无景区素材") + model.applyScenario(.noResults) + XCTAssertEqual(model.allGroups.count, 5) + XCTAssertTrue(model.filteredGroups.isEmpty) + XCTAssertTrue(model.hasAnyMaterials) + XCTAssertNotNil(model.selectedRouteID) + XCTAssertEqual(model.emptyTitle, "没有符合条件的素材") + model.applyScenario(.normal) + XCTAssertEqual(model.filteredGroups.count, 5) + XCTAssertNil(model.selectedRouteID) + XCTAssertEqual(model.phase, .idle) + XCTAssertTrue(model.completedIDs.isEmpty) + } + + /// 不同账号/景区的素材身份与下载状态不串用,不需要拍摄订单才能初始化。 + func testIndependentContextsDoNotShareMaterialIDsOrDownloadState() { + let first = makeModel(context: ScenicMaterialContext(userID: "u1", scenicID: "s1", scenicName: "甲景区")) + let second = makeModel(context: ScenicMaterialContext(userID: "u1", scenicID: "s2", scenicName: "乙景区")) + let otherUser = makeModel(context: ScenicMaterialContext(userID: "u2", scenicID: "s1", scenicName: "甲景区")) + first.applyScenario(.completed) + XCTAssertEqual(first.completedIDs.count, 2) + XCTAssertTrue(second.completedIDs.isEmpty) + XCTAssertTrue(otherUser.completedIDs.isEmpty) + XCTAssertTrue(Set(first.filteredClips.map(\.id)).isDisjoint(with: Set(second.filteredClips.map(\.id)))) + XCTAssertTrue(Set(first.filteredClips.map(\.id)).isDisjoint(with: Set(otherUser.filteredClips.map(\.id)))) + second.toggleSelection(id: first.filteredClips[0].id) + XCTAssertEqual(second.selectedCount, 0) + } + + private func makeModel(context: ScenicMaterialContext = .demo, routes: [ScenicMaterialRoute]? = nil, + groups: [ScenicMaterialGroup]? = nil) -> ScenicMaterialsViewModel { + ScenicMaterialsViewModel(context: context, now: date(2026, 10, 26, 14), calendar: calendar, routes: routes, groups: groups) + } + + private var calendar: Calendar { + var value = Calendar(identifier: .gregorian) + value.timeZone = TimeZone(secondsFromGMT: 8 * 3_600)! + value.locale = Locale(identifier: "zh_CN") + return value + } + + private func date(_ year: Int, _ month: Int, _ day: Int, _ hour: Int = 0) -> Date { + calendar.date(from: DateComponents(year: year, month: month, day: day, hour: hour))! + } + + private func clip(id: String, groupID: String, available: Bool = true) -> ScenicMaterialClip { + ScenicMaterialClip(id: id, groupID: groupID, ordinal: 1, durationSeconds: 28, fileSizeBytes: 178_000_000, + resolution: "4K", coverAssetName: "drone_demo_mountain", isAvailable: available) + } + + private func group(id: String, routeID: String, capturedAt: Date) -> ScenicMaterialGroup { + ScenicMaterialGroup(id: id, routeID: routeID, capturedAt: capturedAt, clips: [clip(id: "\(id)-clip", groupID: id)]) + } +} diff --git a/suixinkanTests/TrainingAPITests.swift b/suixinkanTests/TrainingAPITests.swift new file mode 100644 index 0000000..e399b94 --- /dev/null +++ b/suixinkanTests/TrainingAPITests.swift @@ -0,0 +1,314 @@ +import Foundation +import XCTest +@testable import suixinkan + +/// 正式培训契约测试:校验独立资源、请求体、日期、稳定错误及身份边界。 +@MainActor +final class TrainingAPITests: XCTestCase { + private let dateText = "2026-10-14T10:00:00+08:00" + + func testSummaryTaskPageAndFlatDetailDecodeServerTypes() async throws { + var detail = taskJSON + detail.merge(["required_reading_seconds": 20, "reading_rule": "course_duration", "scoring": NSNull(), "server_time": dateText]) { _, new in new } + let session = MockURLSession(responses: [ + try envelope(["pending_count": 7, "completed_count": 12, "latest_attempt": NSNull(), "server_time": dateText]), + try envelope(["items": [taskJSON], "next_cursor": NSNull(), "has_more": false, "server_time": dateText]), + try envelope(detail), + try envelope(["items": [], "next_cursor": NSNull(), "has_more": false, "server_time": dateText]), + ]) + let client = APIClient(environment: .testing, session: session) + client.bindAuthTokenProvider { "current-token" } + let api = TrainingAPI(client: client) + + let summary = try await api.summary() + let page = try await api.tasks(status: .pendingExam, keyword: "游客 服务", cursor: nil, limit: 3) + let task = try await api.task(id: "task_101") + let empty = try await api.tasks(status: nil, keyword: "", cursor: "cursor+opaque", limit: 80) + + XCTAssertEqual(summary.pendingCount, 7) + XCTAssertNil(summary.latestAttempt) + XCTAssertEqual(page.items.first?.learnerStatus, .pendingExam) + XCTAssertNil(page.items.first?.startAt) + XCTAssertNil(page.items.first?.endAt) + XCTAssertNil(page.items.first?.paperSnapshotID) + XCTAssertNil(page.items.first?.passScore) + XCTAssertEqual(task.summary.id, "task_101") + XCTAssertEqual(task.requiredReadingSeconds, 20) + XCTAssertEqual(task.readingRule, "course_duration") + XCTAssertEqual(task.serverTime, try XCTUnwrap(ISO8601DateFormatter().date(from: dateText))) + XCTAssertTrue(empty.items.isEmpty) + XCTAssertNil(empty.nextCursor) + XCTAssertEqual(try query(session.requests[1]), ["learner_status": "pending", "keyword": "游客 服务", "limit": "3"]) + XCTAssertEqual(try query(session.requests[3]), ["cursor": "cursor+opaque", "limit": "50"]) + XCTAssertEqual(session.requests[0].value(forHTTPHeaderField: "token"), "current-token") + XCTAssertEqual(session.requests[0].value(forHTTPHeaderField: "X-OS-TYPE"), "iOS") + } + + func testEndedTaskFilterAndReadOnlyResourcesDecodeServerState() async throws { + var endedFlags = flagsJSON + endedFlags.merge(["can_study": false, "can_start_exam": false, "block_reason": "ended"]) { _, new in new } + var endedTask = taskJSON + endedTask.merge(["task_status": "closed", "learner_status": "ended", "learning": endedFlags]) { _, new in new } + var endedDetail = endedTask + endedDetail.merge(["required_reading_seconds": 20, "reading_rule": "course_duration", "scoring": NSNull(), "server_time": dateText]) { _, new in new } + var endedProgress = progressJSON + endedProgress.merge(endedFlags) { _, new in new } + endedProgress["learner_status"] = "ended" + let taskState: [String: Any] = ["learner_status": "ended", "completed_at": dateText, "can_retry": false, "block_reason": "ended"] + let session = MockURLSession(responses: [ + try envelope(["items": [endedTask], "next_cursor": NSNull(), "has_more": false, "server_time": dateText]), + try envelope(endedDetail), + try envelope(endedProgress), + try envelope(["attempt": attemptJSON, "task_state": taskState, "server_time": dateText]), + ]) + let api = TrainingAPI(client: APIClient(environment: .testing, session: session)) + + let page = try await api.tasks(status: .ended, keyword: "规范", cursor: nil, limit: 20) + let task = try await api.task(id: "task_101") + let progress = try await api.progress(taskID: "task_101") + let attempt = try await api.attempt(id: "attempt_12") + + let summary = try XCTUnwrap(page.items.first) + for item in [summary, task.summary] { + XCTAssertEqual(item.learnerStatus, .ended) + XCTAssertEqual(item.taskStatus, .closed) + XCTAssertTrue(item.learning.canViewCourse) + XCTAssertFalse(item.learning.canStudy) + XCTAssertFalse(item.learning.canStartExam) + XCTAssertEqual(item.learning.blockReason, "ended") + } + XCTAssertEqual(progress.learnerStatus, .ended) + XCTAssertTrue(progress.canViewCourse) + XCTAssertFalse(progress.canStudy) + XCTAssertFalse(progress.canStartExam) + XCTAssertFalse(progress.canRetry) + XCTAssertEqual(progress.blockReason, "ended") + XCTAssertEqual(attempt.taskState.learnerStatus, .ended) + XCTAssertNotNil(attempt.taskState.completedAt, "已结束状态仍保留此前完成记录") + XCTAssertFalse(attempt.taskState.canRetry) + XCTAssertEqual(attempt.taskState.blockReason, "ended") + XCTAssertEqual(try query(session.requests[0]), ["learner_status": "ended", "keyword": "规范", "limit": "20"]) + XCTAssertEqual(session.requests.map { $0.url?.path }, [ + "/api/app/training/tasks", "/api/app/training/tasks/task_101", + "/api/app/training/tasks/task_101/progress", "/api/app/training/attempts/attempt_12", + ]) + XCTAssertTrue(session.requests.allSatisfy { $0.httpMethod == "GET" }) + let encoded = try JSONEncoder().encode(TrainingLearnerStatus.ended) + XCTAssertEqual(try JSONDecoder().decode(String.self, from: encoded), "ended") + } + + func testCourseResourcesCarryTaskAuthorizationAndDoNotAggregate() async throws { + let session = MockURLSession(responses: [ + try envelope(["course_snapshot_id": "cs_3", "title": "规范", "introduction": "简介", "section_count": 1, "attachment_count": 1]), + try envelope(["items": [["section_id": "section_1", "order": 1, "title": "正文"]], "next_cursor": NSNull(), "has_more": false]), + try envelope(["section_id": "section_1", "order": 1, "title": "正文", "content_html": "

    正式内容

    "]), + try envelope(["items": [["attachment_id": "file_1", "name": "规范.pdf", "mime_type": "application/pdf", "size_bytes": 4096, "file_id": "file_1", "download_url": NSNull(), "expires_at": NSNull()]], "next_cursor": NSNull(), "has_more": false]), + try envelope(["attachment_id": "file_1", "name": "规范.pdf", "url": "https://files.zhifly.cn/private?signature=one", "expires_at": dateText]), + ]) + let api = TrainingAPI(client: APIClient(environment: .testing, session: session)) + let course = try await api.course(id: "cs_3", taskID: "task_101") + let sections = try await api.sections(courseID: "cs_3", taskID: "task_101", cursor: nil, limit: 20) + let content = try await api.section(courseID: "cs_3", sectionID: "section_1", taskID: "task_101") + let attachments = try await api.attachments(courseID: "cs_3", taskID: "task_101", cursor: "attachment-cursor", limit: 20) + let link = try await api.attachmentURL(courseID: "cs_3", attachmentID: "file_1", taskID: "task_101") + + XCTAssertEqual(course.id, "cs_3") + XCTAssertEqual(sections.items.first?.id, "section_1") + XCTAssertEqual(content.contentHTML, "

    正式内容

    ") + XCTAssertNil(attachments.items.first?.downloadURL) + XCTAssertEqual(link.url.host, "files.zhifly.cn") + XCTAssertEqual(session.requests.count, 5) + for request in session.requests { + XCTAssertEqual(request.httpMethod, "GET") + XCTAssertEqual(try query(request)["task_id"], "task_101") + } + XCTAssertEqual(session.requests[2].url?.path, "/api/app/training/courses/cs_3/sections/section_1") + XCTAssertEqual(session.requests[4].url?.path, "/api/app/training/courses/cs_3/attachments/file_1") + XCTAssertEqual(try query(session.requests[3])["cursor"], "attachment-cursor") + } + + func testReadingSessionAndHeartbeatKeepCallerIdempotencyData() async throws { + let session = MockURLSession(responses: [ + try envelope(progressJSON), + try envelope(["session_id": "session-uuid", "expires_at": dateText, "heartbeat_interval_seconds": 5, "max_heartbeat_gap_seconds": 15, "progress": progressJSON]), + try envelope(["session_id": "session-uuid", "accepted_sequence": 1, "accepted_active_seconds_total": 5, "session_closed": true, "progress": progressJSON]), + ]) + let api = TrainingAPI(client: APIClient(environment: .testing, session: session)) + let progress = try await api.progress(taskID: "task_101") + let reading = try await api.startReading(taskID: "task_101", requestID: "read-id") + let confirmation = try await api.heartbeat(sessionID: reading.sessionID, sequence: 1, activeSecondsTotal: 5, final: true) + + XCTAssertEqual(progress.readingSeconds, 12) + XCTAssertEqual(reading.heartbeatIntervalSeconds, 5) + XCTAssertEqual(confirmation.acceptedSequence, 1) + XCTAssertEqual(confirmation.acceptedActiveSecondsTotal, 5) + XCTAssertTrue(confirmation.sessionClosed) + XCTAssertEqual(try body(session.requests[1])["request_id"] as? String, "read-id") + let heartbeat = try body(session.requests[2]) + XCTAssertEqual(Set(heartbeat.keys), ["sequence", "active_seconds_total", "final"]) + XCTAssertEqual(heartbeat["active_seconds_total"] as? Int, 5) + XCTAssertEqual(heartbeat["final"] as? Bool, true) + } + + func testQuestionDraftAndPatchUseFrozenPositionsAndVersion() async throws { + let session = MockURLSession(responses: [ + try envelope(["paper_snapshot_id": "ps_3", "scoring": "equal-percentage-v1", "question_count": 30, "max_options_per_question": 6]), + try envelope(["paper_snapshot_id": "ps_3", "total": 30, "offset": 10, "next_offset": 20, "has_more": true, "items": [questionJSON]]), + try envelope(draftJSON), + try envelope(["draft_revision": 5, "saved_at": dateText, "answered_count": 2]), + try envelope(["draft_revision": 8, "saved_at": dateText, "answered_count": 3]), + ]) + let api = TrainingAPI(client: APIClient(environment: .testing, session: session)) + let paper = try await api.paper(id: "ps_3", taskID: "task_101") + let questions = try await api.questions(paperID: "ps_3", taskID: "task_101", offset: 10, limit: 10) + let draft = try await api.draft(taskID: "task_101", offset: 0, limit: 0) + let saved = try await api.saveDraft(taskID: "task_101", request: TrainingDraftSaveRequest(requestID: "save-id", paperSnapshotID: "ps_3", baseRevision: 4, lastQuestionOrder: 11, changes: [TrainingDraftChange(questionID: "101", selectedOptionIDs: ["A", "B"])])) + let reset = try await api.resetDraft(taskID: "task_101", request: TrainingDraftResetRequest(requestID: "reset-id", paperSnapshotID: "ps_3", baseRevision: 5)) + + XCTAssertEqual(paper.questionCount, 30) + XCTAssertEqual(questions.items.first?.id, "101") + XCTAssertEqual(questions.items.first?.options.map(\.id), ["A", "B"]) + XCTAssertEqual(questions.offset, 10) + XCTAssertEqual(draft.answeredQuestionOrders, [1, 11]) + XCTAssertNil(draft.savedAt) + XCTAssertEqual(try query(session.requests[2])["limit"], "0") + XCTAssertEqual(saved.draftRevision, 5) + XCTAssertEqual(reset.draftRevision, 8) + XCTAssertEqual(reset.answeredCount, 3, "重置重试可能返回已重新作答的实况,不能假定为零") + XCTAssertEqual(session.requests[3].httpMethod, "PATCH") + let patch = try body(session.requests[3]) + XCTAssertEqual(patch["request_id"] as? String, "save-id") + XCTAssertEqual(patch["base_revision"] as? Int, 4) + let changes = try XCTUnwrap(patch["changes"] as? [[String: Any]]) + XCTAssertEqual(changes.first?["selected_option_ids"] as? [String], ["A", "B"]) + XCTAssertEqual(session.requests[4].url?.path, "/api/app/training/tasks/task_101/draft/reset") + } + + func testSubmissionUsesOnlyDraftVersionAndResultRecoveryIsPrecise() async throws { + let taskState: [String: Any] = ["learner_status": "completed", "completed_at": dateText, "can_retry": false, "block_reason": "completed"] + var review = questionJSON + review.merge(["selected_option_ids": ["A"], "correct_option_ids": ["A"], "is_correct": true, "explanation": "说明服务规则"]) { _, new in new } + let session = MockURLSession(responses: [ + try envelope(["attempt": attemptJSON, "task_state": taskState, "draft_revision": 6, "server_time": dateText]), + try envelope(["items": [attemptJSON], "next_cursor": NSNull(), "has_more": false]), + try envelope(["attempt": attemptJSON, "task_state": taskState, "server_time": dateText]), + try envelope(["attempt_id": "attempt_12", "items": [review], "next_cursor": NSNull(), "has_more": false]), + ]) + let api = TrainingAPI(client: APIClient(environment: .testing, session: session)) + let result = try await api.submit(taskID: "task_101", request: TrainingSubmissionRequest(submissionID: "submit-id", paperSnapshotID: "ps_3", draftRevision: 5)) + let recovered = try await api.attempts(taskID: "task_101", submissionID: "submit-id", cursor: nil, limit: 1) + let detail = try await api.attempt(id: "attempt_12") + let reviews = try await api.reviews(attemptID: "attempt_12", cursor: nil, limit: 50) + + let submission = try body(session.requests[0]) + XCTAssertEqual(Set(submission.keys), ["submission_id", "paper_snapshot_id", "draft_revision"]) + XCTAssertNil(submission["answers"]) + XCTAssertEqual(result.attempt.id, "attempt_12") + XCTAssertEqual(result.attempt.scoreText, "87.5") + XCTAssertEqual(result.draftRevision, 6) + XCTAssertEqual(recovered.items.first?.id, result.attempt.id) + XCTAssertEqual(try query(session.requests[1]), ["task_id": "task_101", "submission_id": "submit-id", "limit": "1"]) + XCTAssertFalse(detail.taskState.canRetry) + XCTAssertEqual(reviews.items.first?.correctOptionIDs, ["A"]) + XCTAssertEqual(try query(session.requests[3])["limit"], "10") + } + + func testStableTrainingErrorsAreMappedWithoutSwallowingAuthenticationErrors() async throws { + let codes = Array(150100...150113) + let responses = try codes.map { try TestJSON.errorEnvelope(code: $0, msg: "业务错误") } + [try TestJSON.errorEnvelope(code: 100060, msg: "登录失效")] + let api = TrainingAPI(client: APIClient(environment: .testing, session: MockURLSession(responses: responses))) + for code in codes { + do { _ = try await api.summary(); XCTFail("应抛培训业务错误") } + catch let error as TrainingRemoteError { + XCTAssertEqual(error.code, code) + XCTAssertEqual(error.errorDescription, "业务错误") + } + } + do { _ = try await api.summary(); XCTFail("应保留登录失效错误") } + catch let APIError.serverCode(code, _) { XCTAssertEqual(code, 100060) } + } + + func testInvalidAccountAndChangedIdentityNeverDeliverTrainingData() async throws { + let unused = MockURLSession(responses: [try envelope([:])]) + let ineligible = TrainingAPI(client: APIClient(environment: .testing, session: unused), eligible: false) + do { _ = try await ineligible.summary(); XCTFail("应拒绝非店铺身份") } + catch let error as TrainingRemoteError { XCTAssertEqual(error.code, 150100) } + XCTAssertTrue(unused.requests.isEmpty) + + let before = TrainingAPI(client: APIClient(environment: .testing, session: unused), validateContext: { false }) + do { _ = try await before.summary(); XCTFail("请求前应校验身份") } + catch let error as TrainingRemoteError { XCTAssertEqual(error, .identityChanged) } + XCTAssertTrue(unused.requests.isEmpty) + + let identity = TrainingAPITestIdentity() + let delayed = TrainingIdentityChangingSession(response: try envelope(["pending_count": 0, "completed_count": 0, "latest_attempt": NSNull(), "server_time": dateText]), change: { identity.isCurrent = false }) + let after = TrainingAPI(client: APIClient(environment: .testing, session: delayed), tokenOverride: "frozen-token", validateContext: { identity.isCurrent }) + do { _ = try await after.summary(); XCTFail("迟到响应不得返回给新身份") } + catch let error as TrainingRemoteError { XCTAssertEqual(error, .identityChanged) } + let token = await delayed.lastToken + XCTAssertEqual(token, "frozen-token") + } + + func testRFC3339FractionalSecondsAndInvalidDatesStayLocalToTrainingDTOs() throws { + let decoder = JSONDecoder() + let json = #"{"attempt_id":"attempt_1","score_hundredths":9999,"submitted_at":"2026-10-14T10:00:00.123+08:00"}"# + let attempt = try decoder.decode(TrainingLatestAttempt.self, from: Data(json.utf8)) + XCTAssertEqual(attempt.submittedAt.timeIntervalSince1970.truncatingRemainder(dividingBy: 1), 0.123, accuracy: 0.001) + let invalid = json.replacingOccurrences(of: "2026-10-14T10:00:00.123+08:00", with: "2026-10-14 10:00:00") + XCTAssertThrowsError(try decoder.decode(TrainingLatestAttempt.self, from: Data(invalid.utf8))) + } + + private var flagsJSON: [String: Any] { + ["progress_percent": 0, "reading_completed": false, "has_draft": false, "can_view_course": true, "can_study": true, "can_start_exam": false, "block_reason": "reading_required"] + } + private var taskJSON: [String: Any] { + ["task_id": "task_101", "title": "规范培训", "publisher_name": NSNull(), "mode": "study", "task_status": "published", "learner_status": "pending", "start_at": NSNull(), "end_at": NSNull(), "course_snapshot_id": "cs_3", "course_title": "规范", "paper_snapshot_id": NSNull(), "section_count": 1, "question_count": 0, "pass_score": NSNull(), "learning": flagsJSON] + } + private var progressJSON: [String: Any] { + var fields = flagsJSON + fields.merge(["task_id": "task_101", "reading_seconds": 12, "required_reading_seconds": 20, "completed_section_count": 0, "section_count": 1, "learner_status": "pending", "completed_at": NSNull(), "can_retry": false, "server_time": dateText]) { _, new in new } + return fields + } + private var questionJSON: [String: Any] { + ["question_id": "101", "order": 11, "type": "multiple", "stem": "请选择", "options": [["option_id": "A", "text": "说明规范"], ["option_id": "B", "text": "确认费用"]]] + } + private var draftJSON: [String: Any] { + ["task_id": "task_101", "paper_snapshot_id": "ps_3", "draft_revision": 4, "saved_at": NSNull(), "last_question_order": 11, "answered_count": 2, "answered_question_orders": [1, 11], "total": 30, "offset": 0, "next_offset": NSNull(), "has_more": false, "items": []] + } + private var attemptJSON: [String: Any] { + ["attempt_id": "attempt_12", "task_id": "task_101", "task_title": "规范培训", "course_snapshot_id": "cs_3", "course_title": "规范", "paper_snapshot_id": "ps_3", "submitted_at": dateText, "score_hundredths": 8750, "correct_count": 7, "question_count": 8, "pass_score": 80, "passed": true, "review_available": true] + } + private func envelope(_ payload: [String: Any]) throws -> Data { + try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": payload]) + } + private func body(_ request: URLRequest) throws -> [String: Any] { + try XCTUnwrap(JSONSerialization.jsonObject(with: try XCTUnwrap(request.httpBody)) as? [String: Any]) + } + private func query(_ request: URLRequest) throws -> [String: String] { + let url = try XCTUnwrap(request.url) + return Dictionary(uniqueKeysWithValues: (URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? []).compactMap { item in item.value.map { (item.name, $0) } }) + } +} + +/// 测试中可控的主 Actor 身份标记。 +@MainActor +private final class TrainingAPITestIdentity { + var isCurrent = true +} + +/// 在响应返回前切换身份,验证生产数据源丢弃迟到结果。 +private actor TrainingIdentityChangingSession: URLSessionProtocol { + private let response: Data + private let change: @MainActor @Sendable () -> Void + private(set) var lastToken: String? + + init(response: Data, change: @escaping @MainActor @Sendable () -> Void) { + self.response = response + self.change = change + } + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + lastToken = request.value(forHTTPHeaderField: "token") + await change() + return (response, HTTPURLResponse(url: request.url!, statusCode: 200, httpVersion: nil, headerFields: nil)!) + } +} diff --git a/suixinkanTests/TrainingCourseRequestLoadingTests.swift b/suixinkanTests/TrainingCourseRequestLoadingTests.swift new file mode 100644 index 0000000..ff1a81e --- /dev/null +++ b/suixinkanTests/TrainingCourseRequestLoadingTests.swift @@ -0,0 +1,262 @@ +import UIKit +import WebKit +import XCTest +@testable import suixinkan + +/// 明确挂起响应,验证等待期间的进度与重复点击,而不依赖固定网络延时。 +private actor TrainingCourseLoadingGate { + private var continuations: [CheckedContinuation] = [] + private var released = false + private(set) var requestCount = 0 + + /// 所有意外并发请求分别等待,方便断言请求数量。 + func wait() async { + requestCount += 1 + guard !released else { return } + await withCheckedContinuation { continuations.append($0) } + } + + /// 释放所有挂起响应,测试失败时也不会遗留 continuation。 + func release() { + released = true + let pending = continuations + continuations = [] + pending.forEach { $0.resume() } + } +} + +/// 真机课程请求交互:用户动作显示全局进度,缓存与自动读时不显示。 +@MainActor +final class TrainingCourseRequestLoadingTests: XCTestCase { + private var previousKeyWindow: UIWindow? + + override func tearDown() { + GlobalLoadingManager.shared.hideAll() + super.tearDown() + } + + /// 首次失败释放进度;主动重试保持按钮外观,快速重复点击不重复请求。 + func testColdLoadFailureAndButtonRetryReleaseLoading() async throws { + let first = TrainingCourseLoadingGate() + let retry = TrainingCourseLoadingGate() + defer { Task { await first.release(); await retry.release() } } + let source = TrainingDataStub() + await source.configure { + $0.taskHandler = { _ in await first.wait(); throw URLError(.timedOut) } + } + let controller = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: TrainingFixtureDocumentLoader()) + let window = try makeWindow(controller) + defer { closeWindow(window, controller: controller) } + try await waitUntil { await first.requestCount == 1 } + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + await first.release() + let action = try button("training.reading.action", in: controller.view) + try await waitUntil { action.isEnabled && action.isUserInteractionEnabled && !GlobalLoadingManager.shared.isShowing } + await source.configure { + $0.taskHandler = { _ in await retry.wait(); return TrainingRemoteFixtures.detail() } + } + let appearance = (action.isEnabled, action.alpha, action.configuration?.baseBackgroundColor) + action.sendActions(for: .touchUpInside) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + XCTAssertEqual(action.isEnabled, appearance.0) + XCTAssertEqual(action.alpha, appearance.1) + XCTAssertEqual(action.configuration?.baseBackgroundColor, appearance.2) + XCTAssertFalse(action.isUserInteractionEnabled) + action.sendActions(for: .touchUpInside) + try await waitUntil { await retry.requestCount == 1 } + let calls = await source.calls + XCTAssertEqual(calls.filter { $0.name == "task" }.count, 2) + await retry.release() + try await waitUntil { self.isReady(controller) } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + } + + /// 下载错误保留原生课程信息;用户重试重新授权文件并保持全局进度与防重复请求。 + func testDocumentDownloadFailureAndRetryKeepMetadataAndLoading() async throws { + let download = TrainingCourseLoadingGate() + let retry = TrainingCourseLoadingGate() + defer { Task { await download.release(); await retry.release() } } + let loader = TrainingFixtureDocumentLoader { _, _ in + await download.wait() + if await download.requestCount == 1 { throw URLError(.networkConnectionLost) } + await retry.wait() + return try TrainingDocumentTestFixtures.document() + } + let source = TrainingDataStub() + let controller = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: loader) + let window = try makeWindow(controller) + defer { closeWindow(window, controller: controller) } + try await waitUntil { await download.requestCount == 1 } + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + await download.release() + let action = try button("training.reading.action", in: controller.view) + try await waitUntil { action.isEnabled && action.isUserInteractionEnabled && !GlobalLoadingManager.shared.isShowing } + XCTAssertEqual(action.configuration?.title, "重新加载附件") + let labels = allViews(controller.view).compactMap { $0 as? UILabel } + XCTAssertEqual(labels.first { $0.accessibilityIdentifier == "training.reading.taskTitle" }?.text, "一线服务规范学习") + XCTAssertEqual(labels.first { $0.accessibilityIdentifier == "training.reading.courseName" }?.text, "景区服务规范") + let appearance = (action.isEnabled, action.alpha, action.configuration?.baseBackgroundColor) + action.sendActions(for: .touchUpInside) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + XCTAssertEqual(action.isEnabled, appearance.0) + XCTAssertEqual(action.alpha, appearance.1) + XCTAssertEqual(action.configuration?.baseBackgroundColor, appearance.2) + XCTAssertFalse(action.isUserInteractionEnabled) + action.sendActions(for: .touchUpInside) + try await waitUntil { await retry.requestCount == 1 } + let pendingCalls = await source.calls + XCTAssertEqual(pendingCalls.filter { $0.name == "attachmentURL" }.count, 2) + XCTAssertEqual(pendingCalls.filter { $0.name == "task" }.count, 1) + await retry.release() + try await waitUntil { self.isReady(controller) } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + let downloadCount = await download.requestCount + XCTAssertEqual(downloadCount, 2) + } + + /// 离页取消请求后清理原票据,迟到响应不能隐藏其它请求,返回会重新加载课程。 + func testLeavingAndReturningRestoresCanceledCourseWithoutEndingOtherLoading() async throws { + let body = TrainingCourseLoadingGate() + defer { Task { await body.release() } } + let source = TrainingDataStub() + let loader = TrainingFixtureDocumentLoader { _, _ in + await body.wait() + return try TrainingDocumentTestFixtures.document() + } + let controller = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: loader) + let window = try makeWindow(controller) + defer { closeWindow(window, controller: controller) } + try await waitUntil { await body.requestCount == 1 } + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + let navigation = try XCTUnwrap(controller.navigationController) + try await waitUntil { + controller.transitionCoordinator == nil && navigation.transitionCoordinator == nil + } + let destination = UIViewController() + navigation.pushViewController(destination, animated: false) + // 文件下载仍被 gate 挂起;这里只等待 UIKit 完成真实离页与页面票据释放。 + try await waitUntil { + navigation.topViewController === destination && destination.view.window === window + && navigation.transitionCoordinator == nil && controller.transitionCoordinator == nil + && !GlobalLoadingManager.shared.isShowing + } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + let other = GlobalLoadingManager.shared.beginRequest() + defer { GlobalLoadingManager.shared.endRequest(other) } + await body.release() + let action = try button("training.reading.action", in: controller.view) + try await waitUntil { action.isUserInteractionEnabled } + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + GlobalLoadingManager.shared.endRequest(other) + navigation.popViewController(animated: false) + try await waitUntil { + navigation.topViewController === controller && controller.view.window === window + && navigation.transitionCoordinator == nil && controller.transitionCoordinator == nil + } + let webView = try XCTUnwrap(allViews(controller.view).compactMap { $0 as? WKWebView }.first) + try await waitUntil { + guard self.isReady(controller), !webView.isLoading else { return false } + let text = try? await webView.evaluateJavaScript("document.body.textContent") as? String + return text?.contains("这是一份 UTF-8 文本附件。") == true + } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + let calls = await source.calls + XCTAssertEqual(calls.filter { $0.name == "attachmentURL" }.count, 2) + let downloadCount = await body.requestCount + XCTAssertEqual(downloadCount, 2) + XCTAssertFalse(calls.contains { ["section", "sections"].contains($0.name) }) + } + + /// 正文就绪后的自动会话、暂停保存与恢复不显示进度,只有用户重试失败会话显示。 + func testReadingRetryShowsLoadingAndAutomaticSessionRequestsDoNot() async throws { + let initial = TrainingCourseLoadingGate() + let retry = TrainingCourseLoadingGate() + let automatic = TrainingCourseLoadingGate() + defer { Task { await initial.release(); await retry.release(); await automatic.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.readingSeconds = 0 + configuration.startReadingHandler = { _ in + await initial.wait() + throw URLError(.timedOut) + } + let source = TrainingDataStub(configuration: configuration) + let controller = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: TrainingFixtureDocumentLoader()) + let window = try makeWindow(controller) + defer { closeWindow(window, controller: controller) } + try await waitUntil { await initial.requestCount == 1 } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + await initial.release() + let action = try button("training.reading.action", in: controller.view) + try await waitUntil { action.isEnabled && action.configuration?.title == "重试保存并继续学习" } + await source.configure { + $0.startReadingHandler = { requestID in + await retry.wait() + return TrainingStudySession(sessionID: requestID, expiresAt: Date().addingTimeInterval(60), heartbeatIntervalSeconds: 5, + maxHeartbeatGapSeconds: 15, progress: TrainingRemoteFixtures.progress(seconds: 0)) + } + } + action.sendActions(for: .touchUpInside) + XCTAssertTrue(GlobalLoadingManager.shared.isShowing) + XCTAssertTrue(action.isEnabled) + action.sendActions(for: .touchUpInside) + try await waitUntil { await retry.requestCount == 1 } + await retry.release() + try await waitUntil { !GlobalLoadingManager.shared.isShowing && !action.isEnabled && action.isUserInteractionEnabled } + await source.configure { + $0.startReadingHandler = { requestID in + await automatic.wait() + return TrainingStudySession(sessionID: requestID, expiresAt: Date().addingTimeInterval(60), heartbeatIntervalSeconds: 5, + maxHeartbeatGapSeconds: 15, progress: TrainingRemoteFixtures.progress(seconds: 0)) + } + } + NotificationCenter.default.post(name: UIApplication.willResignActiveNotification, object: nil) + try await waitUntil { await source.heartbeats.contains { $0.final } } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) + try await waitUntil { await automatic.requestCount == 1 } + XCTAssertFalse(GlobalLoadingManager.shared.isShowing) + await automatic.release() + } + + private func makeWindow(_ controller: TrainingCourseViewController) throws -> UIWindow { + let scene = try XCTUnwrap(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first) + previousKeyWindow = scene.windows.first { $0.isKeyWindow } + let window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + let navigation = UINavigationController(rootViewController: controller) + window.rootViewController = navigation + window.makeKeyAndVisible() + navigation.view.layoutIfNeeded() + return window + } + + private func closeWindow(_ window: UIWindow, controller: TrainingCourseViewController) { + controller.presentedViewController?.dismiss(animated: false) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKey() + previousKeyWindow = nil + } + + private func isReady(_ controller: TrainingCourseViewController) -> Bool { + let views = allViews(controller.view) + guard let step = views.first(where: { $0 is TrainingStepView }), !step.isHidden, + let preview = views.compactMap({ $0 as? TrainingDocumentPreviewView }).first, + let action = try? button("training.reading.action", in: controller.view) else { return false } + return preview.isReady && action.isUserInteractionEnabled && !GlobalLoadingManager.shared.isShowing + } + + private func allViews(_ view: UIView) -> [UIView] { [view] + view.subviews.flatMap { allViews($0) } } + + private func button(_ identifier: String, in view: UIView) throws -> UIButton { + try XCTUnwrap(allViews(view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == identifier }) + } + + private func waitUntil(_ condition: @MainActor () async -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(15)) + while !(await condition()), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + let reached = await condition() + XCTAssertTrue(reached, "未在期限内进入预期 UI / 请求状态") + guard reached else { throw CancellationError() } + } +} diff --git a/suixinkanTests/TrainingDataTestSupport.swift b/suixinkanTests/TrainingDataTestSupport.swift new file mode 100644 index 0000000..0f17db3 --- /dev/null +++ b/suixinkanTests/TrainingDataTestSupport.swift @@ -0,0 +1,293 @@ +import Foundation +@testable import suixinkan + +/// 正式 DTO 测试样例,所有数据在内存中生成,不发出真实请求。 +enum TrainingRemoteFixtures { + static let now = Date(timeIntervalSince1970: 1_800_000_000) + /// 固定试卷的一题。 + static func question(_ order: Int) -> TrainingQuestionItem { + TrainingQuestionItem(id: "q\(order)", order: order, type: .single, stem: "培训题目 \(order)", options: [TrainingQuestionOption(id: "A", text: "正确选择"), TrainingQuestionOption(id: "B", text: "另一选择")]) + } + /// 不含正文和答案的任务摘要。 + static func task(id: String = "task_1", title: String = "一线服务规范学习", questionCount: Int = 30, readingCompleted: Bool = true, learnerStatus: TrainingLearnerStatus = .pendingExam) -> TrainingTaskSummary { + TrainingTaskSummary(id: id, title: title, publisherName: "培训负责人", mode: .exam, + taskStatus: learnerStatus == .ended ? .closed : .published, learnerStatus: learnerStatus, + startAt: nil, endAt: nil, courseSnapshotID: "course_1", courseTitle: "景区服务规范", paperSnapshotID: "paper_1", + sectionCount: 2, questionCount: questionCount, passScore: 80, + learning: TrainingLearningFlags(progressPercent: readingCompleted ? 100 : 0, readingCompleted: readingCompleted, + hasDraft: false, canViewCourse: true, canStudy: learnerStatus == .pendingExam && !readingCompleted, + canStartExam: learnerStatus == .pendingExam && readingCompleted, + blockReason: learnerStatus == .ended ? "ended" : readingCompleted ? nil : "reading_required")) + } + /// 轻量任务详情。 + static func detail(questionCount: Int = 30, readingCompleted: Bool = true) -> TrainingTaskDetail { + TrainingTaskDetail(summary: task(questionCount: questionCount, readingCompleted: readingCompleted), requiredReadingSeconds: 20, readingRule: "course_duration", scoring: "equal-percentage-v1", serverTime: now) + } + /// 服务端确认读时与资格。 + static func progress(seconds: Int = 20, completed: Bool = false, learnerStatus: TrainingLearnerStatus? = nil) -> TrainingProgressSnapshot { + let status = learnerStatus ?? (completed ? .completed : .pendingExam) + return TrainingProgressSnapshot(taskID: "task_1", readingSeconds: seconds, requiredReadingSeconds: 20, + completedSectionCount: seconds >= 20 ? 2 : 0, sectionCount: 2, progressPercent: seconds >= 20 ? 100 : 0, + readingCompleted: seconds >= 20, learnerStatus: status, completedAt: completed ? now : nil, hasDraft: false, + canViewCourse: true, canStudy: seconds < 20 && status == .pendingExam, + canStartExam: seconds >= 20 && status == .pendingExam, canRetry: status == .pendingExam, + blockReason: status == .ended ? "ended" : completed ? "completed" : seconds < 20 ? "reading_required" : nil, + serverTime: now) + } + /// 轻量课程文档,默认使用可由本地替身稳定预览的纯文本。 + static func attachment(id: String = "file_1", name: String = "培训资料.txt", mimeType: String = "text/plain") -> TrainingAttachmentInfo { + TrainingAttachmentInfo(id: id, name: name, mimeType: mimeType, sizeBytes: 1024, + fileID: id, downloadURL: nil, expiresAt: nil) + } + /// 单次已提交成绩。 + static func attempt(id: String = "attempt_1", passed: Bool = true, questionCount: Int = 30, reviewAvailable: Bool = true) -> TrainingAttemptSummary { + TrainingAttemptSummary(id: id, taskID: "task_1", taskTitle: "一线服务规范学习", courseSnapshotID: "course_1", courseTitle: "景区服务规范", paperSnapshotID: "paper_1", submittedAt: now, scoreHundredths: passed ? 10000 : 5000, correctCount: passed ? questionCount : questionCount / 2, questionCount: questionCount, passScore: 80, passed: passed, reviewAvailable: reviewAvailable) + } + /// 冻结成绩的当前操作资格。 + static func result(passed: Bool = true, reviewAvailable: Bool = true, questionCount: Int = 30) -> TrainingAttemptDetail { + TrainingAttemptDetail(attempt: attempt(passed: passed, questionCount: questionCount, reviewAvailable: reviewAvailable), taskState: TrainingTaskState(learnerStatus: passed ? .completed : .pendingExam, completedAt: passed ? now : nil, canRetry: !passed, blockReason: passed ? "completed" : nil), serverTime: now) + } + /// 一页解析。 + static func review(_ order: Int = 1) -> TrainingReviewItem { + let question = question(order) + return TrainingReviewItem(id: question.id, order: order, type: question.type, stem: question.stem, options: question.options, selectedOptionIDs: ["A"], correctOptionIDs: ["A"], isCorrect: true, explanation: "应先向游客说明服务内容与费用。") + } +} + +/// 通用培训替身,允许测试注入失败和丢响应,记录实际的轻量资源调用。 +actor TrainingDataStub: TrainingDataServing { + /// 可核对分页、上报和资源范围的调用参数。 + struct Call: Equatable, Sendable { + let name: String + var taskID: String? = nil + var cursor: String? = nil + var offset: Int? = nil + var limit: Int? = nil + var resourceID: String? = nil + } + /// 心跳的固定幂等负载。 + struct HeartbeatCall: Equatable, Sendable { + let sessionID: String + let sequence: Int + let activeSecondsTotal: Int + let final: Bool + } + /// 各方法可替换响应,未替换的方法使用独立内存状态。 + struct Configuration: Sendable { + var questionCount = 30 + var readingSeconds = 20 + var summaryHandler: (@Sendable () async throws -> TrainingSummary)? + var tasksHandler: (@Sendable (TrainingLearnerStatus?, String, String?, Int) async throws -> TrainingCursorPage)? + var taskHandler: (@Sendable (String) async throws -> TrainingTaskDetail)? + var progressHandler: (@Sendable (String) async throws -> TrainingProgressSnapshot)? + var courseHandler: (@Sendable () async throws -> TrainingCourseInfo)? + var sectionsHandler: (@Sendable (String?) async throws -> TrainingCursorPage)? + var sectionHandler: (@Sendable (String) async throws -> TrainingSectionContent)? + var attachmentsHandler: (@Sendable (String?) async throws -> TrainingCursorPage)? + var attachmentURLHandler: (@Sendable (String) async throws -> TrainingAttachmentLink)? + var startReadingHandler: (@Sendable (String) async throws -> TrainingStudySession)? + var heartbeatHandler: (@Sendable (HeartbeatCall) async throws -> TrainingHeartbeatConfirmation)? + var questionsHandler: (@Sendable (Int, Int) async throws -> TrainingQuestionPage)? + var draftHandler: (@Sendable (Int, Int) async throws -> TrainingDraftPage)? + var saveHandler: (@Sendable (TrainingDraftSaveRequest) async throws -> TrainingDraftConfirmation)? + var resetHandler: (@Sendable (TrainingDraftResetRequest) async throws -> TrainingDraftConfirmation)? + var submitHandler: (@Sendable (TrainingSubmissionRequest) async throws -> TrainingSubmissionResult)? + var attemptsHandler: (@Sendable (String?, String?, String?) async throws -> TrainingCursorPage)? + var attemptHandler: (@Sendable (String) async throws -> TrainingAttemptDetail)? + var reviewsHandler: (@Sendable (String?) async throws -> TrainingReviewPage)? + } + private var configuration: Configuration + private(set) var calls: [Call] = [] + private(set) var savedRequests: [TrainingDraftSaveRequest] = [] + private(set) var resetRequests: [TrainingDraftResetRequest] = [] + private(set) var submissionRequests: [TrainingSubmissionRequest] = [] + private(set) var heartbeats: [HeartbeatCall] = [] + private(set) var startReadingRequests: [String] = [] + private var revision = 1 + private var answers: [String: [String]] = [:] + private var lastOrder = 0 + private var submitted: [String: TrainingSubmissionResult] = [:] + private var savedPayloads: [String: TrainingDraftSaveRequest] = [:] + private var resetPayloads: [String: TrainingDraftResetRequest] = [:] + private var submissionPayloads: [String: TrainingSubmissionRequest] = [:] + private var readingBases: [String: Int] = [:] + private var heartbeatConfirmations: [String: TrainingHeartbeatConfirmation] = [:] + private var heartbeatPayloads: [String: HeartbeatCall] = [:] + private var savedConfirmations: [String: TrainingDraftConfirmation] = [:] + private var readingSeconds: Int + + /// 每个测试独立初始化,默认不复用其他测试状态。 + init(configuration: Configuration = Configuration()) { + self.configuration = configuration + readingSeconds = configuration.readingSeconds + } + /// 在 actor 内更换响应配置。 + func configure(_ update: @Sendable (inout Configuration) -> Void) { update(&configuration) } + /// 注入一个已有草稿,供跨设备和恢复测试。 + func seedDraft(revision: Int, answers: [String: [String]], lastOrder: Int = 0) { + self.revision = revision; self.answers = answers; self.lastOrder = lastOrder + } + /// 读取概览,不派生全量任务历史。 + func summary() async throws -> TrainingSummary { + calls.append(Call(name: "summary")) + if let handler = configuration.summaryHandler { return try await handler() } + return TrainingSummary(pendingCount: 1, completedCount: 0, latestAttempt: nil, serverTime: TrainingRemoteFixtures.now) + } + /// 记录任务过滤及游标。 + func tasks(status: TrainingLearnerStatus?, keyword: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + calls.append(Call(name: "tasks", cursor: cursor, limit: limit)) + if let handler = configuration.tasksHandler { return try await handler(status, keyword, cursor, limit) } + return TrainingCursorPage(items: [TrainingRemoteFixtures.task(questionCount: configuration.questionCount)], nextCursor: nil, hasMore: false, serverTime: TrainingRemoteFixtures.now) + } + /// 任务详情仍不携带正文或试卷。 + func task(id: String) async throws -> TrainingTaskDetail { + calls.append(Call(name: "task", taskID: id)) + if let handler = configuration.taskHandler { return try await handler(id) } + return TrainingRemoteFixtures.detail(questionCount: configuration.questionCount, readingCompleted: readingSeconds >= 20) + } + /// 课程元信息。 + func course(id: String, taskID: String) async throws -> TrainingCourseInfo { + calls.append(Call(name: "course", taskID: taskID)) + if let handler = configuration.courseHandler { return try await handler() } + return TrainingCourseInfo(id: id, title: "景区服务规范", introduction: "正式课程简介", sectionCount: 2, attachmentCount: 1) + } + /// 小节目录,仅含标题与序号。 + func sections(courseID: String, taskID: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + calls.append(Call(name: "sections", taskID: taskID, cursor: cursor, limit: limit)) + if let handler = configuration.sectionsHandler { return try await handler(cursor) } + return TrainingCursorPage(items: [TrainingSectionInfo(id: "s1", order: 1, title: "接待礼仪"), TrainingSectionInfo(id: "s2", order: 2, title: "问题处理")], nextCursor: nil, hasMore: false, serverTime: nil) + } + /// 仅请求指定小节正文。 + func section(courseID: String, sectionID: String, taskID: String) async throws -> TrainingSectionContent { + calls.append(Call(name: "section", taskID: taskID)) + if let handler = configuration.sectionHandler { return try await handler(sectionID) } + return TrainingSectionContent(id: sectionID, order: sectionID == "s1" ? 1 : 2, title: "接待礼仪", contentHTML: "

    主动问候,并清晰说明服务内容。

    ") + } + /// 分页附件元数据。 + func attachments(courseID: String, taskID: String, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + calls.append(Call(name: "attachments", taskID: taskID, cursor: cursor, limit: limit)) + if let handler = configuration.attachmentsHandler { return try await handler(cursor) } + return TrainingCursorPage(items: [TrainingRemoteFixtures.attachment()], nextCursor: nil, hasMore: false, serverTime: nil) + } + /// 返回供文档加载替身读取的授权 HTTPS URL。 + func attachmentURL(courseID: String, attachmentID: String, taskID: String) async throws -> TrainingAttachmentLink { + calls.append(Call(name: "attachmentURL", taskID: taskID, resourceID: attachmentID)) + if let handler = configuration.attachmentURLHandler { return try await handler(attachmentID) } + return TrainingAttachmentLink(id: attachmentID, name: "培训资料.txt", url: URL(string: "https://example.test/training.txt")!, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(3600)) + } + /// 只返回权威读时。 + func progress(taskID: String) async throws -> TrainingProgressSnapshot { + calls.append(Call(name: "progress", taskID: taskID)) + if let handler = configuration.progressHandler { return try await handler(taskID) } + return TrainingRemoteFixtures.progress(seconds: readingSeconds) + } + /// 创建会话,记录幂等键。 + func startReading(taskID: String, requestID: String) async throws -> TrainingStudySession { + calls.append(Call(name: "startReading", taskID: taskID)); startReadingRequests.append(requestID) + if let handler = configuration.startReadingHandler { return try await handler(requestID) } + if readingBases[requestID] == nil { readingBases[requestID] = readingSeconds } + return TrainingStudySession(sessionID: requestID, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(3600), heartbeatIntervalSeconds: 5, maxHeartbeatGapSeconds: 15, progress: TrainingRemoteFixtures.progress(seconds: readingSeconds)) + } + /// 测试按序号返回确认,不接触真实学员记录。 + func heartbeat(sessionID: String, sequence: Int, activeSecondsTotal: Int, final: Bool) async throws -> TrainingHeartbeatConfirmation { + let call = HeartbeatCall(sessionID: sessionID, sequence: sequence, activeSecondsTotal: activeSecondsTotal, final: final) + heartbeats.append(call); calls.append(Call(name: "heartbeat")) + if let handler = configuration.heartbeatHandler { return try await handler(call) } + let key = "\(sessionID):\(sequence)" + if let prior = heartbeatConfirmations[key] { + guard heartbeatPayloads[key] == call else { throw TrainingRemoteError.sessionConflict("序号冲突") } + return prior + } + readingSeconds = min(20, max(readingSeconds, (readingBases[sessionID] ?? 0) + activeSecondsTotal)) + let result = TrainingHeartbeatConfirmation(sessionID: sessionID, acceptedSequence: sequence, acceptedActiveSecondsTotal: activeSecondsTotal, sessionClosed: final, progress: TrainingRemoteFixtures.progress(seconds: readingSeconds)) + heartbeatConfirmations[key] = result; heartbeatPayloads[key] = call + return result + } + /// 不含题目数组的试卷元信息。 + func paper(id: String, taskID: String) async throws -> TrainingPaperInfo { + calls.append(Call(name: "paper", taskID: taskID)) + return TrainingPaperInfo(id: id, scoring: "equal-percentage-v1", questionCount: configuration.questionCount, maxOptionsPerQuestion: 6) + } + /// 仅生成请求范围内的固定题位。 + func questions(paperID: String, taskID: String, offset: Int, limit: Int) async throws -> TrainingQuestionPage { + calls.append(Call(name: "questions", taskID: taskID, offset: offset, limit: limit)) + if let handler = configuration.questionsHandler { return try await handler(offset, limit) } + let end = min(configuration.questionCount, offset + limit) + let items = offset < end ? ((offset + 1)...end).map(TrainingRemoteFixtures.question) : [] + return TrainingQuestionPage(paperSnapshotID: paperID, total: configuration.questionCount, offset: offset, nextOffset: end < configuration.questionCount ? end : nil, hasMore: end < configuration.questionCount, items: items) + } + /// 草稿元信息覆盖全卷,答案仅提供当前范围。 + func draft(taskID: String, offset: Int, limit: Int) async throws -> TrainingDraftPage { + calls.append(Call(name: "draft", taskID: taskID, offset: offset, limit: limit)) + if let handler = configuration.draftHandler { return try await handler(offset, limit) } + let orders = answers.filter { !$0.value.isEmpty }.keys.compactMap { Int($0.dropFirst()) }.sorted() + let end = min(configuration.questionCount, offset + limit) + let items = limit > 0 ? orders.filter { $0 > offset && $0 <= end }.map { TrainingDraftAnswerItem(questionID: "q\($0)", order: $0, selectedOptionIDs: answers["q\($0)"] ?? []) } : [] + return TrainingDraftPage(taskID: taskID, paperSnapshotID: "paper_1", draftRevision: revision, savedAt: answers.isEmpty ? nil : TrainingRemoteFixtures.now, lastQuestionOrder: lastOrder, answeredCount: orders.count, answeredQuestionOrders: orders, total: configuration.questionCount, offset: offset, nextOffset: limit > 0 && end < configuration.questionCount ? end : nil, hasMore: limit > 0 && end < configuration.questionCount, items: items) + } + /// 默认实现模拟版本比较与单题替换。 + func saveDraft(taskID: String, request: TrainingDraftSaveRequest) async throws -> TrainingDraftConfirmation { + savedRequests.append(request); calls.append(Call(name: "saveDraft", taskID: taskID)) + if let handler = configuration.saveHandler { return try await handler(request) } + if let confirmation = savedConfirmations[request.requestID] { + guard savedPayloads[request.requestID] == request else { throw TrainingRemoteError.idempotencyConflict("幂等键冲突") } + return confirmation + } + guard request.baseRevision == revision else { throw TrainingRemoteError.draftRevisionConflict("版本冲突") } + for change in request.changes { answers[change.questionID] = change.selectedOptionIDs } + if let order = request.lastQuestionOrder { lastOrder = order } + if !request.changes.isEmpty { revision += 1 } + let result = TrainingDraftConfirmation(draftRevision: revision, savedAt: TrainingRemoteFixtures.now, answeredCount: answers.values.filter { !$0.isEmpty }.count) + savedConfirmations[request.requestID] = result + savedPayloads[request.requestID] = request + return result + } + /// 重置确认可由测试返回非空当前实况。 + func resetDraft(taskID: String, request: TrainingDraftResetRequest) async throws -> TrainingDraftConfirmation { + resetRequests.append(request); calls.append(Call(name: "resetDraft", taskID: taskID)) + if let handler = configuration.resetHandler { return try await handler(request) } + if let prior = resetPayloads[request.requestID] { + guard prior == request else { throw TrainingRemoteError.idempotencyConflict("幂等键冲突") } + return TrainingDraftConfirmation(draftRevision: revision, savedAt: TrainingRemoteFixtures.now, answeredCount: answers.values.filter { !$0.isEmpty }.count) + } + guard request.baseRevision == revision else { throw TrainingRemoteError.draftRevisionConflict("版本冲突") } + resetPayloads[request.requestID] = request + answers = [:]; revision += 1; lastOrder = 0 + return TrainingDraftConfirmation(draftRevision: revision, savedAt: TrainingRemoteFixtures.now, answeredCount: 0) + } + /// 默认交卷只消费已经保存的版本。 + func submit(taskID: String, request: TrainingSubmissionRequest) async throws -> TrainingSubmissionResult { + submissionRequests.append(request); calls.append(Call(name: "submit", taskID: taskID)) + if let handler = configuration.submitHandler { return try await handler(request) } + if let result = submitted[request.submissionID] { + guard submissionPayloads[request.submissionID] == request else { throw TrainingRemoteError.idempotencyConflict("幂等键冲突") } + return result + } + guard request.draftRevision == revision else { throw TrainingRemoteError.draftRevisionConflict("版本冲突") } + guard answers.values.filter({ !$0.isEmpty }).count == configuration.questionCount else { throw TrainingRemoteError.answerIncomplete("存在未答题") } + let detail = TrainingRemoteFixtures.result(questionCount: configuration.questionCount) + revision += 1; answers = [:] + let result = TrainingSubmissionResult(attempt: detail.attempt, taskState: detail.taskState, draftRevision: revision, serverTime: TrainingRemoteFixtures.now) + submitted[request.submissionID] = result + submissionPayloads[request.submissionID] = request + return result + } + /// 记录列表或提交恢复只返回摘要。 + func attempts(taskID: String?, submissionID: String?, cursor: String?, limit: Int) async throws -> TrainingCursorPage { + calls.append(Call(name: "attempts", taskID: taskID, cursor: cursor, limit: limit)) + if let handler = configuration.attemptsHandler { return try await handler(taskID, submissionID, cursor) } + return TrainingCursorPage(items: submissionID.flatMap { submitted[$0]?.attempt }.map { [$0] } ?? [], nextCursor: nil, hasMore: false, serverTime: nil) + } + /// 成绩首屏没有解析数组。 + func attempt(id: String) async throws -> TrainingAttemptDetail { + calls.append(Call(name: "attempt")) + if let handler = configuration.attemptHandler { return try await handler(id) } + return TrainingRemoteFixtures.result(questionCount: configuration.questionCount) + } + /// 展开解析时才记录调用。 + func reviews(attemptID: String, cursor: String?, limit: Int) async throws -> TrainingReviewPage { + calls.append(Call(name: "reviews", cursor: cursor, limit: limit)) + if let handler = configuration.reviewsHandler { return try await handler(cursor) } + return TrainingReviewPage(attemptID: attemptID, items: [TrainingRemoteFixtures.review()], nextCursor: nil, hasMore: false) + } +} diff --git a/suixinkanTests/TrainingDocumentPreviewTests.swift b/suixinkanTests/TrainingDocumentPreviewTests.swift new file mode 100644 index 0000000..216deed --- /dev/null +++ b/suixinkanTests/TrainingDocumentPreviewTests.swift @@ -0,0 +1,584 @@ +import PDFKit +import UIKit +import WebKit +import XCTest +@testable import suixinkan + +/// 真机使用正式预览组件读取本地文件,验证实际内容与渲染成功事件。 +@MainActor +final class TrainingDocumentPreviewTests: XCTestCase { + private var previousKeyWindow: UIWindow? + + /// PDF 经 PDFKit 显示并保留可阅读的页内容。 + func testPDFFileRendersWithPDFKit() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + try await showDocument(.pdf, in: preview) + let pdf = try XCTUnwrap(allViews(preview).compactMap { $0 as? TrainingPDFDocumentView }.first) + XCTAssertFalse(pdf.isHidden) + XCTAssertEqual(pdf.document?.pageCount, 1) + XCTAssertTrue(pdf.document?.string?.contains("Training Course PDF") == true) + let image = UIGraphicsImageRenderer(size: preview.bounds.size).image { _ in + preview.drawHierarchy(in: preview.bounds, afterScreenUpdates: true) + } + record(image, name: "课程附件-PDF真机预览") + } + + /// 文件已装入但预览仍隐藏时不得发 ready;可见页真实绘制后才打开门禁。 + func testPDFDoesNotBecomeReadyUntilVisiblePageIsDrawn() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + preview.isHidden = true + let id = UUID() + var readyID: UUID? + preview.onReady = { readyID = $0 } + preview.show(try TrainingDocumentTestFixtures.document(kind: .pdf), requestID: id) + try await Task.sleep(for: .milliseconds(100)) + XCTAssertNil(readyID) + XCTAssertFalse(preview.isReady) + preview.isHidden = false + try await waitUntil { readyID == id } + XCTAssertTrue(preview.isReady) + } + + /// 祖先滚动区域裁剪掉 PDF 时,即使图层已排版也不能开始读时。 + func testPDFWaitsUntilItsDrawnPageEntersOuterViewport() async throws { + let controller = UIViewController() + let scroll = UIScrollView(frame: CGRect(x: 0, y: 80, width: 390, height: 600)) + scroll.clipsToBounds = true + scroll.contentInsetAdjustmentBehavior = .never + scroll.contentSize = CGSize(width: 390, height: 1600) + let preview = TrainingDocumentPreviewView() + preview.frame = CGRect(x: 12, y: 850, width: 366, height: 550) + controller.view.addSubview(scroll) + scroll.addSubview(preview) + let window = try makeWindow(controller) + defer { closeWindow(window) } + let id = UUID() + var readyID: UUID? + preview.onReady = { readyID = $0 } + preview.show(try TrainingDocumentTestFixtures.document(kind: .pdf), requestID: id) + _ = UIGraphicsImageRenderer(size: preview.bounds.size).image { _ in + preview.drawHierarchy(in: preview.bounds, afterScreenUpdates: true) + } + preview.notifyIfRenderedAndVisible() + try await Task.sleep(for: .milliseconds(100)) + XCTAssertNil(readyID) + XCTAssertFalse(preview.isReady) + scroll.setContentOffset(CGPoint(x: 0, y: 800), animated: false) + controller.view.layoutIfNeeded() + preview.notifyIfRenderedAndVisible() + try await waitUntil { readyID == id } + XCTAssertTrue(preview.isReady) + } + + /// 切到 PDF 后,旧 WebView 进程退出不能把当前 PDF 当成预览失败。 + func testOldWebProcessTerminationDoesNotInvalidateCurrentPDF() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + try await showDocument(.docx, in: preview) + let oldWeb = try documentWebView(in: preview) + try await showDocument(.pdf, in: preview) + var failure: String? + preview.onFailure = { _, message in failure = message } + preview.webViewWebContentProcessDidTerminate(oldWeb) + XCTAssertNil(failure) + XCTAssertTrue(preview.isReady) + XCTAssertFalse(try XCTUnwrap(allViews(preview).compactMap { $0 as? TrainingPDFDocumentView }.first).isHidden) + } + + /// DOCX 必须通过正式本地 JS 解析器产生段落与表格,不能只报告页面加载完成。 + func testDOCXFileRendersRealParagraphAndTable() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + try await showDocument(.docx, in: preview) + let web = try documentWebView(in: preview) + let text = try await web.evaluateJavaScript("document.getElementById('document').textContent") as? String + XCTAssertTrue(text?.contains("培训课程 DOCX") == true) + XCTAssertTrue(text?.contains("这是 Word 文档正文,包含中文内容。") == true) + XCTAssertTrue(text?.contains("服务规范") == true) + let tableCount = try await web.evaluateJavaScript("document.querySelectorAll('#document table').length") as? Int + XCTAssertEqual(tableCount, 1) + record(try await web.takeSnapshot(configuration: nil), name: "课程附件-DOCX真机预览") + } + + /// TXT 显示原文字面量,不能把文件里的 HTML 片段执行成网页。 + func testTXTFileRendersPlainText() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + try await showDocument(.txt, in: preview) + let web = try documentWebView(in: preview) + let text = try await web.evaluateJavaScript("document.querySelector('#document pre').textContent") as? String + XCTAssertTrue(text?.contains("这是一份 UTF-8 文本附件。") == true) + XCTAssertTrue(text?.contains("") == true) + let scriptCount = try await web.evaluateJavaScript("document.querySelectorAll('#document script').length") as? Int + XCTAssertEqual(scriptCount, 0) + record(try await web.takeSnapshot(configuration: nil), name: "课程附件-TXT真机预览") + } + + /// Markdown 渲染成标题、强调和表格,外部图片与危险链接不能进入有效属性。 + func testMarkdownFileRendersFormattedContent() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + try await showDocument(.md, in: preview) + let web = try documentWebView(in: preview) + let heading = try await web.evaluateJavaScript("document.querySelector('#document h1').textContent") as? String + let strong = try await web.evaluateJavaScript("document.querySelector('#document strong').textContent") as? String + let tableCount = try await web.evaluateJavaScript("document.querySelectorAll('#document table').length") as? Int + let unsafeCount = try await web.evaluateJavaScript("document.querySelectorAll('#document script, #document img[src], #document a[href^=\"javascript:\"]').length") as? Int + XCTAssertEqual(heading, "培训课程") + XCTAssertEqual(strong, "Markdown") + XCTAssertEqual(tableCount, 1) + XCTAssertEqual(unsafeCount, 0) + record(try await web.takeSnapshot(configuration: nil), name: "课程附件-Markdown真机预览") + } + + /// ZIP 损坏必须通过失败回调回到原生重试状态,不能累计阅读。 + func testBrokenDOCXFailsWithoutReadyEvent() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + let requestID = UUID() + var readyID: UUID? + var failureID: UUID? + var failureMessage: String? + preview.onReady = { readyID = $0 } + preview.onFailure = { failureID = $0; failureMessage = $1 } + preview.show(try TrainingDocumentTestFixtures.document(kind: .docx, resource: "training-preview-broken"), requestID: requestID) + try await waitUntil { failureID != nil || readyID != nil } + XCTAssertEqual(failureID, requestID) + XCTAssertNil(readyID) + XCTAssertNotNil(failureMessage) + XCTAssertFalse(preview.isReady) + } + + /// 旧 DOC 文件明确拒绝,即使服务器错误地声明为 DOCX MIME。 + func testLegacyDOCIsRejectedBeforeDownload() async throws { + let url = try XCTUnwrap(URL(string: "https://example.test/legacy.doc")) + for mime in ["application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] { + XCTAssertThrowsError(try TrainingDocumentKind.resolve(name: "旧版文档.doc", mimeType: mime, url: url)) { error in + XCTAssertEqual(error.localizedDescription, TrainingDocumentError.unsupported.localizedDescription) + } + } + let attachment = TrainingRemoteFixtures.attachment(name: "旧版文档.doc", mimeType: "application/msword") + let link = TrainingAttachmentLink(id: attachment.id, name: attachment.name, url: url, + expiresAt: Date().addingTimeInterval(60)) + do { + _ = try await TrainingFixtureDocumentLoader().load(attachment: attachment, link: link) + XCTFail("旧 DOC 不应被当作 DOCX 或文本加载") + } catch { + XCTAssertEqual(error.localizedDescription, TrainingDocumentError.unsupported.localizedDescription) + } + } + + /// 课程元信息只出现在 UIKit 标签中,WebView DOM 只包含附件文件内容。 + func testCourseMetadataIsNativeAndAbsentFromDocument() async throws { + let source = TrainingDataStub() + await source.configure { + $0.taskHandler = { _ in + TrainingTaskDetail(summary: TrainingRemoteFixtures.task(title: "NATIVE_TASK_ONLY"), requiredReadingSeconds: 20, + readingRule: "course_duration", scoring: "equal-percentage-v1", serverTime: TrainingRemoteFixtures.now) + } + $0.courseHandler = { + TrainingCourseInfo(id: "course_1", title: "NATIVE_COURSE_ONLY", introduction: "NATIVE_INTRODUCTION_ONLY", sectionCount: 1, attachmentCount: 1) + } + } + let controller = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: TrainingFixtureDocumentLoader()) + let window = try makeWindow(UINavigationController(rootViewController: controller)) + defer { closeWindow(window) } + try await waitUntil { + self.allViews(controller.view).compactMap { $0 as? TrainingDocumentPreviewView }.first?.isReady == true + } + let labels = allViews(controller.view).compactMap { $0 as? UILabel } + let expected = ["training.reading.taskTitle": "NATIVE_TASK_ONLY", "training.reading.courseName": "NATIVE_COURSE_ONLY", + "training.reading.examInfo": "学习 + 考试 · 30 题 · 80 分及格", "training.reading.introduction": "NATIVE_INTRODUCTION_ONLY"] + for (identifier, value) in expected { + XCTAssertEqual(labels.first { $0.accessibilityIdentifier == identifier }?.text, value) + } + let web = try documentWebView(in: controller.view) + let content = try await web.evaluateJavaScript("document.body.textContent") as? String + let text = try XCTUnwrap(content) + XCTAssertTrue(text.contains("这是一份 UTF-8 文本附件。")) + for value in expected.values { XCTAssertFalse(text.contains(value)) } + let calls = await source.calls + XCTAssertFalse(calls.contains { ["sections", "section"].contains($0.name) }) + } + + /// 实际课程滚动回调持续触发时,按钮倒计时仍随有效阅读时间减少。 + func testContinuousCourseScrollingKeepsCountdownRunning() async throws { + let document = try temporaryDocument(text: (1...120).map { "第 \($0) 行:滑动阅读时仍应累计有效读时。" }.joined(separator: "\n"), kind: .txt) + defer { try? FileManager.default.removeItem(at: document.fileURL.deletingLastPathComponent()) } + let (controller, _, scroll, window) = try await makeCourseWindow(document: document, readingSeconds: 0) + defer { closeWindow(window) } + let action = try XCTUnwrap(allViews(controller.view).compactMap { $0 as? UIButton } + .first { $0.accessibilityIdentifier == "training.reading.action" }) + func remainingSeconds() -> Int? { + guard let title = action.configuration?.title, let start = title.lastIndex(of: "("), + let end = title.range(of: "s)")?.lowerBound else { return nil } + return Int(title[title.index(after: start).. scroll.bounds.height * 3 } + XCTAssertFalse(web.scrollView.isScrollEnabled) + let title = try XCTUnwrap(allViews(controller.view).compactMap { $0 as? UILabel } + .first { $0.accessibilityIdentifier == "training.reading.taskTitle" }) + let initialTitleY = title.convert(title.bounds, to: controller.view).minY + scrollToBottom(scroll) + controller.view.layoutIfNeeded() + let movedTitle = title.convert(title.bounds, to: controller.view) + XCTAssertLessThan(movedTitle.maxY, scroll.frame.minY) + XCTAssertLessThan(movedTitle.minY, initialTitleY - scroll.bounds.height) + let documentBottom = web.convert(CGPoint(x: 0, y: web.bounds.maxY), to: scroll).y + XCTAssertLessThanOrEqual(documentBottom, scroll.bounds.maxY + 3) + XCTAssertGreaterThan(documentBottom, scroll.bounds.minY) + XCTAssertEqual(web.scrollView.contentOffset.y, 0, accuracy: 1) + let originalHeight = preview.preferredContentHeight + let shortDocument = try temporaryDocument(text: "新的短文档,只有一行。", kind: .txt) + defer { try? FileManager.default.removeItem(at: shortDocument.fileURL.deletingLastPathComponent()) } + preview.show(shortDocument, requestID: UUID()) + try await waitUntil { preview.isReady && preview.preferredContentHeight < originalHeight / 4 } + controller.view.layoutIfNeeded() + XCTAssertLessThan(scroll.contentSize.height, scroll.bounds.height) + XCTAssertEqual(scroll.contentOffset.y, -scroll.adjustedContentInset.top, accuracy: 1) + XCTAssertEqual(web.scrollView.contentOffset.y, 0, accuracy: 1) + XCTAssertTrue(title.convert(title.bounds, to: controller.view).intersects(scroll.frame)) + } + + /// 异步排版变化和宽度重排会撑开或缩回卡片,不能依赖固定 WebView 高度。 + func testMarkdownAndDOCXTrackLateLayoutAndWidthChanges() async throws { + let (preview, window) = try makePreviewWindow() + defer { closeWindow(window) } + preview.onContentHeightChange = { [weak preview] height in + guard let preview else { return } + preview.frame.size.height = height + preview.layoutIfNeeded() + } + for kind in [TrainingDocumentKind.md, .docx] { + preview.frame.size.width = 366 + try await showDocument(kind, in: preview) + let web = try documentWebView(in: preview) + let baseline = preview.preferredContentHeight + _ = try await web.evaluateJavaScript(""" + (() => { + const section = document.createElement('section'); + section.id = 'late-course-content'; + for (let i = 0; i < 20; i++) { + const paragraph = document.createElement('p'); + paragraph.textContent = '动态课程段落应完整排版,字体与宽度变化后,页面仍能读到最后一行。'.repeat(4); + section.appendChild(paragraph); + } + document.getElementById('document').appendChild(section); + })(); + """) + try await waitUntil { preview.preferredContentHeight > baseline + 500 } + let wideHeight = preview.preferredContentHeight + preview.frame.size.width = 220 + preview.layoutIfNeeded() + try await waitUntil { preview.preferredContentHeight > wideHeight + 100 } + XCTAssertFalse(web.scrollView.isScrollEnabled) + XCTAssertEqual(web.scrollView.contentOffset.y, 0, accuracy: 1) + _ = try await web.evaluateJavaScript("document.getElementById('late-course-content').remove()") + preview.frame.size.width = 366 + preview.layoutIfNeeded() + try await waitUntil { abs(preview.preferredContentHeight - baseline) < 5 } + XCTAssertEqual(preview.bounds.height, preview.preferredContentHeight, accuracy: 1) + XCTAssertTrue(preview.isReady) + } + } + + /// 文内目录定位使用外层页面偏移,WebView 自己不能跳到目标而截断顶部内容。 + func testDocumentAnchorScrollsOuterPageWithoutMovingInnerWebView() async throws { + let document = try TrainingDocumentTestFixtures.document(kind: .md) + let (controller, preview, scroll, window) = try await makeCourseWindow(document: document) + defer { closeWindow(window) } + let web = try documentWebView(in: preview) + _ = try await web.evaluateJavaScript(""" + (() => { + const content = document.getElementById('document'); + const link = document.createElement('a'); + link.id = 'course-directory-link'; link.href = '#course-last-heading'; link.textContent = '跳到课程结尾'; + content.prepend(link); + for (let i = 0; i < 55; i++) { + const paragraph = document.createElement('p'); + paragraph.textContent = '课程学习段落 ' + i + ':继续阅读服务规范。'; content.appendChild(paragraph); + } + const target = document.createElement('h2'); + target.id = 'course-last-heading'; target.textContent = 'COURSE_ANCHOR_DESTINATION'; content.appendChild(target); + const footer = document.createElement('div'); footer.style.height = '700px'; content.appendChild(footer); + })(); + """) + try await waitUntil { preview.preferredContentHeight > 2500 } + _ = try await web.evaluateJavaScript("document.getElementById('course-directory-link').click()") + try await waitUntil { scroll.contentOffset.y > 1000 && !scroll.isDecelerating && !scroll.isDragging } + let targetResult = try await web.evaluateJavaScript("document.getElementById('course-last-heading').getBoundingClientRect().top") as? Double + let targetY = try XCTUnwrap(targetResult) + try await waitUntil { + let position = web.convert(CGPoint(x: 0, y: CGFloat(targetY)), to: scroll).y - scroll.bounds.minY + return abs(position - scroll.adjustedContentInset.top) < 5 + } + XCTAssertFalse(web.scrollView.isScrollEnabled) + XCTAssertEqual(web.scrollView.contentOffset.y, 0, accuracy: 1) + let innerOffset = try await web.evaluateJavaScript("window.scrollY") as? Double + XCTAssertEqual(innerOffset ?? -1, 0, accuracy: 1) + record(UIGraphicsImageRenderer(size: controller.view.bounds.size).image { _ in + controller.view.drawHierarchy(in: controller.view.bounds, afterScreenUpdates: true) + }, name: "课程附件-文内锚点整页定位") + } + + /// 多页 PDF 完整撑高,最后一页可通过课程页面滚动抵达,不再嵌套 PDFKit 滚动容器。 + func testMultipagePDFReachesLastPageUsingOuterScrollView() async throws { + let renderer = UIGraphicsPDFRenderer(bounds: CGRect(x: 0, y: 0, width: 300, height: 450)) + let headingFont = try XCTUnwrap(UIFont(name: "Helvetica", size: 18)) + let markerFont = try XCTUnwrap(UIFont(name: "Helvetica", size: 14)) + let data = renderer.pdfData { context in + for page in 1...6 { + context.beginPage() + ("Training PDF page \(page) of 6" as NSString).draw(at: CGPoint(x: 24, y: 28), withAttributes: [.font: headingFont]) + ("PDF_PAGE_END_\(page)" as NSString).draw(at: CGPoint(x: 24, y: 410), withAttributes: [.font: markerFont]) + } + } + let fixture = try XCTUnwrap(PDFDocument(data: data)) + // 页身份保存在 PDF 自身的注解中,避免把字体字形映射的文本抽取能力混入滚动回归。 + for index in 0.. TrainingLocalDocument { + try temporaryDocument(data: Data(text.utf8), kind: kind) + } + + private func temporaryDocument(data: Data, kind: TrainingDocumentKind) throws -> TrainingLocalDocument { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("training-scroll-test-\(UUID().uuidString)") + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let file = directory.appendingPathComponent("course.\(kind.rawValue)") + try data.write(to: file) + return TrainingLocalDocument(fileURL: file, kind: kind, name: file.lastPathComponent, temporaryDirectory: nil) + } + + private func makeCourseWindow(document: TrainingLocalDocument, readingSeconds: Int = 20) async throws -> (TrainingCourseViewController, TrainingDocumentPreviewView, UIScrollView, UIWindow) { + var configuration = TrainingDataStub.Configuration() + configuration.readingSeconds = readingSeconds + let source = TrainingDataStub(configuration: configuration) + let name = document.name + let mime: String + switch document.kind { + case .pdf: mime = "application/pdf" + case .docx: mime = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + case .txt: mime = "text/plain" + case .md: mime = "text/markdown" + } + await source.configure { + $0.attachmentsHandler = { _ in TrainingCursorPage(items: [TrainingRemoteFixtures.attachment(name: name, mimeType: mime)], nextCursor: nil, hasMore: false, serverTime: nil) } + } + let controller = TrainingCourseViewController(taskID: "task_1", service: source, + documentLoader: TrainingFixtureDocumentLoader { _, _ in document }) + let window = try makeWindow(UINavigationController(rootViewController: controller)) + do { + let preview = try XCTUnwrap(allViews(controller.view).compactMap { $0 as? TrainingDocumentPreviewView }.first) + try await waitUntil { preview.isReady } + let scroll = try XCTUnwrap(allViews(controller.view).compactMap { $0 as? UIScrollView } + .first { $0.accessibilityIdentifier == "training.reading.scroll" }) + return (controller, preview, scroll, window) + } catch { + closeWindow(window) + throw error + } + } + + private func scrollToBottom(_ scroll: UIScrollView) { + let bottom = max(-scroll.adjustedContentInset.top, + scroll.contentSize.height - scroll.bounds.height + scroll.adjustedContentInset.bottom) + scroll.setContentOffset(CGPoint(x: 0, y: bottom), animated: false) + } + + private func showDocument(_ kind: TrainingDocumentKind, in preview: TrainingDocumentPreviewView) async throws { + let id = UUID() + var readyID: UUID? + var failure: String? + preview.onReady = { readyID = $0 } + preview.onFailure = { _, message in failure = message } + preview.show(try TrainingDocumentTestFixtures.document(kind: kind), requestID: id) + try await waitUntil { readyID != nil || failure != nil } + XCTAssertNil(failure) + XCTAssertEqual(readyID, id) + XCTAssertTrue(preview.isReady) + guard preview.isReady else { throw TrainingDocumentError.invalidFile } + } + + private func makePreviewWindow() throws -> (TrainingDocumentPreviewView, UIWindow) { + let controller = UIViewController() + let preview = TrainingDocumentPreviewView() + controller.view.addSubview(preview) + preview.frame = CGRect(x: 12, y: 80, width: 366, height: 640) + return (preview, try makeWindow(controller)) + } + + private func makeWindow(_ controller: UIViewController) throws -> UIWindow { + let scene = try XCTUnwrap(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first) + previousKeyWindow = scene.windows.first { $0.isKeyWindow } + let window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + window.rootViewController = controller + window.makeKeyAndVisible() + controller.view.layoutIfNeeded() + return window + } + + private func closeWindow(_ window: UIWindow) { + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKey() + previousKeyWindow = nil + } + + private func documentWebView(in view: UIView) throws -> WKWebView { + try XCTUnwrap(allViews(view).compactMap { $0 as? WKWebView }.first) + } + + private func allViews(_ view: UIView) -> [UIView] { [view] + view.subviews.flatMap { allViews($0) } } + + private func record(_ image: UIImage, name: String) { + let attachment = XCTAttachment(image: image) + attachment.name = name + attachment.lifetime = .keepAlways + add(attachment) + } + + private func waitUntil(_ condition: @MainActor () async -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(15)) + while !(await condition()), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + let reached = await condition() + XCTAssertTrue(reached, "文档未在期限内完成真实渲染或返回失败事件") + guard reached else { throw CancellationError() } + } +} + +/// 精确挂起课程心跳响应,确保超时或断言失败后也能释放所有等待。 +private actor TrainingCourseHeartbeatGate { + private var releasedSequences: Set = [] + private var didReleaseAll = false + private var waiters: [Int: [CheckedContinuation]] = [:] + + func wait(sequence: Int) async { + guard !didReleaseAll, !releasedSequences.contains(sequence) else { return } + await withCheckedContinuation { waiters[sequence, default: []].append($0) } + } + + func release(sequence: Int) { + releasedSequences.insert(sequence) + waiters.removeValue(forKey: sequence)?.forEach { $0.resume() } + } + + func releaseAll() { + didReleaseAll = true + let pending = waiters.values.flatMap { $0 } + waiters.removeAll() + pending.forEach { $0.resume() } + } +} diff --git a/suixinkanTests/TrainingDocumentTestSupport.swift b/suixinkanTests/TrainingDocumentTestSupport.swift new file mode 100644 index 0000000..0e7885d --- /dev/null +++ b/suixinkanTests/TrainingDocumentTestSupport.swift @@ -0,0 +1,35 @@ +import Foundation +@testable import suixinkan + +/// 定位测试 target 的附件资源,避免依赖开发机文件路径或真实网络。 +enum TrainingDocumentTestFixtures { + /// 返回已打包的本地文档,资源不会由预览器删除。 + static func document(kind: TrainingDocumentKind = .txt, resource: String = "training-preview-sample") throws -> TrainingLocalDocument { + let bundle = Bundle(for: TrainingDocumentBundleMarker.self) + let file = bundle.url(forResource: resource, withExtension: kind.rawValue) + ?? bundle.url(forResource: resource, withExtension: kind.rawValue, subdirectory: "Fixtures/TrainingDocuments") + guard let file else { throw CocoaError(.fileNoSuchFile) } + return TrainingLocalDocument(fileURL: file, kind: kind, name: "\(resource).\(kind.rawValue)", temporaryDirectory: nil) + } +} + +/// 给 Bundle 定位测试资源使用的普通 NSObject 类型。 +private final class TrainingDocumentBundleMarker: NSObject {} + +/// 注入真实本地文件,可在下载入口挂起或失败,仍通过正式渲染器展示。 +struct TrainingFixtureDocumentLoader: TrainingDocumentLoading { + /// 可覆盖一次下载过程;默认依据授权附件类型读取测试文件。 + var handler: (@Sendable (TrainingAttachmentInfo, TrainingAttachmentLink) async throws -> TrainingLocalDocument)? + + /// 创建无网络的文档加载器,允许测试控制请求的完成时机。 + init(handler: (@Sendable (TrainingAttachmentInfo, TrainingAttachmentLink) async throws -> TrainingLocalDocument)? = nil) { + self.handler = handler + } + + /// 保留正式格式识别规则,只替换文件获取路径。 + func load(attachment: TrainingAttachmentInfo, link: TrainingAttachmentLink) async throws -> TrainingLocalDocument { + if let handler { return try await handler(attachment, link) } + let kind = try TrainingDocumentKind.resolve(name: attachment.name, mimeType: attachment.mimeType, url: link.url) + return try TrainingDocumentTestFixtures.document(kind: kind) + } +} diff --git a/suixinkanTests/TrainingDraftStoreTests.swift b/suixinkanTests/TrainingDraftStoreTests.swift new file mode 100644 index 0000000..1bf4e24 --- /dev/null +++ b/suixinkanTests/TrainingDraftStoreTests.swift @@ -0,0 +1,110 @@ +import Foundation +import Testing +@testable import suixinkan + +/// 草稿日志的身份隔离、格式校验与跨页面代次保护。 +@Suite("培训本机草稿持久化") +struct TrainingDraftStoreTests { + private let context = TrainingContext(accountScope: "account_1", scenicID: 10, storeID: 3) + + @Test("原子文件在新存储实例和不同defaults域中恢复同一日志,不依赖异步defaults刷新") + func atomicFileSurvivesReconstruction() throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("TrainingDraftStore-\(UUID().uuidString)") + defer { try? FileManager.default.removeItem(at: directory) } + let name = "TrainingDraftStoreTests-\(UUID().uuidString)" + let otherName = name + "-other" + let defaults = try #require(UserDefaults(suiteName: name)) + let otherDefaults = try #require(UserDefaults(suiteName: otherName)) + defer { defaults.removePersistentDomain(forName: name); otherDefaults.removePersistentDomain(forName: otherName) } + let original = TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", context: context, revision: 5, + answers: [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["A"])]) + let store = TrainingDraftStore(defaults: defaults, directoryURL: directory) + let generation = try store.save(original, replacing: nil) + let reconstructed = TrainingDraftStore(defaults: otherDefaults, directoryURL: directory) + let restored = try #require(try reconstructed.load(taskID: "task_1", paperSnapshotID: "paper_1", context: context)) + #expect(restored.generation == generation) + #expect(restored.answers == original.answers) + #expect(try FileManager.default.contentsOfDirectory(atPath: directory.path).count == 1) + #expect(defaults.persistentDomain(forName: name)?.isEmpty != false) + } + + @Test("按账号景区店铺任务试卷隔离,恢复原请求与本机较新意图且不含token") + func partitionedRecovery() throws { + let name = "TrainingDraftStoreTests-\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: name)) + defer { defaults.removePersistentDomain(forName: name) } + let store = TrainingDraftStore(defaults: defaults) + let request = TrainingDraftSaveRequest(requestID: "original", paperSnapshotID: "paper_1", baseRevision: 5, + lastQuestionOrder: 2, changes: [TrainingDraftChange(questionID: "q2", selectedOptionIDs: ["A"])]) + let record = TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", context: context, revision: 5, + answers: [TrainingDraftLocalAnswer(questionID: "q2", order: 2, selectedOptionIDs: ["A", "B"])], + lastQuestionOrder: 2, pendingSave: request) + try store.save(record, replacing: nil) + let restored = try #require(try store.load(taskID: "task_1", paperSnapshotID: "paper_1", context: context)) + #expect(restored.answers == record.answers) + #expect(restored.pendingSave == request) + for other in [TrainingContext(accountScope: "account_2", scenicID: 10, storeID: 3), + TrainingContext(accountScope: "account_1", scenicID: 11, storeID: 3), + TrainingContext(accountScope: "account_1", scenicID: 10, storeID: 4)] { + #expect(try store.load(taskID: "task_1", paperSnapshotID: "paper_1", context: other) == nil) + } + #expect(try store.load(taskID: "task_2", paperSnapshotID: "paper_1", context: context) == nil) + #expect(try store.load(taskID: "task_1", paperSnapshotID: "paper_2", context: context) == nil) + let values = defaults.persistentDomain(forName: name)?.values.compactMap { $0 as? Data } ?? [] + let encoded = try #require(values.first.flatMap { String(data: $0, encoding: .utf8) }) + #expect(!encoded.lowercased().contains("token")) + } + + @Test("新页面接管后,旧ACK不能清除新选择,已保存的空日志仍拒绝旧代次复写") + func compareAndSwapProtectsNewPage() throws { + let name = "TrainingDraftStoreTests-\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: name)) + defer { defaults.removePersistentDomain(forName: name) } + let store = TrainingDraftStore(defaults: defaults) + var record = TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", context: context, revision: 1, + answers: [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["A"])]) + let oldGeneration = try store.save(record, replacing: nil) + record.answers = [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["B"])] + let newGeneration = try store.save(record, replacing: oldGeneration) + record.answers = [] + #expect(throws: TrainingDraftStorageError.replaced) { try store.save(record, replacing: oldGeneration) } + #expect(try store.load(taskID: "task_1", paperSnapshotID: "paper_1", context: context)?.answers.first?.selectedOptionIDs == ["B"]) + try store.save(record, replacing: newGeneration) + #expect(throws: TrainingDraftStorageError.replaced) { try store.save(record, replacing: oldGeneration) } + #expect(throws: TrainingDraftStorageError.replaced) { try store.save(record, replacing: nil) } + } + + @Test("重复题号、非法选项、越界位置或超过20条的在飞请求不能覆盖有效日志") + func rejectsMalformedRecords() throws { + let name = "TrainingDraftStoreTests-\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: name)) + defer { defaults.removePersistentDomain(forName: name) } + let store = TrainingDraftStore(defaults: defaults) + let valid = TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", context: context, revision: 3) + let generation = try store.save(valid, replacing: nil) + var malformed: [TrainingDraftRecord] = [] + var record = valid + record.answers = [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["A"]), + TrainingDraftLocalAnswer(questionID: "q2", order: 1, selectedOptionIDs: ["B"])] + malformed.append(record) + record = valid + record.answers = [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: [""])] + malformed.append(record) + record = valid + record.lastQuestionOrder = 501 + malformed.append(record) + record = valid + record.pendingSave = TrainingDraftSaveRequest(requestID: "invalid", paperSnapshotID: "paper_1", baseRevision: 3, + lastQuestionOrder: 1, changes: (1...21).map { TrainingDraftChange(questionID: "q\($0)", selectedOptionIDs: ["A"]) }) + malformed.append(record) + record = valid + record.pendingSave = TrainingDraftSaveRequest(requestID: "duplicate", paperSnapshotID: "paper_1", baseRevision: 3, + lastQuestionOrder: 1, changes: [TrainingDraftChange(questionID: "q1", selectedOptionIDs: ["A"]), + TrainingDraftChange(questionID: "q1", selectedOptionIDs: ["B"])]) + malformed.append(record) + for value in malformed { + #expect(throws: TrainingDraftStorageError.invalidRecord) { try store.save(value, replacing: generation) } + } + #expect(try store.load(taskID: "task_1", paperSnapshotID: "paper_1", context: context)?.generation == generation) + } +} diff --git a/suixinkanTests/TrainingDraftWriterTests.swift b/suixinkanTests/TrainingDraftWriterTests.swift new file mode 100644 index 0000000..376c889 --- /dev/null +++ b/suixinkanTests/TrainingDraftWriterTests.swift @@ -0,0 +1,391 @@ +import Foundation +import Testing +@testable import suixinkan + +/// 暂停第一批 ACK,允许测试在请求未确认期间继续点击和切题。 +private actor TrainingDraftWriterGate { + private var continuation: CheckedContinuation? + private var released = false + private var count = 0 + + /// 只暂停首次保存,后续串行批次直接返回。 + func pauseFirst() async { + count += 1 + guard count == 1, !released else { return } + await withCheckedContinuation { continuation = $0 } + } + + /// 释放尚未确认的请求,也支持在请求进入前释放。 + func release() { released = true; continuation?.resume(); continuation = nil } +} + +/// 确保超时重试可以单独返回原请求的历史 ACK。 +private actor TrainingDraftRetryCounter { + private var count = 0 + /// 递增调用次数。 + func next() -> Int { count += 1; return count } +} + +/// 请求悬停期间切换身份的可控来源。 +@MainActor +private final class TrainingDraftTestIdentity { + var context: TrainingContext? + /// 固定首次进入时的账号范围。 + init(_ context: TrainingContext) { self.context = context } +} + +/// 本机意图、后台串行保存、持久恢复和交卷屏障的独立回归。 +@Suite("培训草稿后台合并保存") +@MainActor +struct TrainingDraftWriterTests { + private let context = TrainingContext(accountScope: "draft_writer", scenicID: 10, storeID: 3) + + private func domain() throws -> (String, UserDefaults) { + let name = "TrainingDraftWriterTests-\(UUID().uuidString)" + return (name, try #require(UserDefaults(suiteName: name))) + } + + private func model(_ defaults: UserDefaults) -> TrainingRemoteExamViewModel { + let scope = context + return TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), + debounceNanoseconds: 60_000_000_000, currentContext: { scope }) + } + + private func waitUntil(_ predicate: () async -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !(await predicate()), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(5)) } + #expect(await predicate()) + } + + @Test("重复单选无请求,快速多选及跨缓存题变化合并成一批") + func coalescesLocalChoicesAcrossCachedQuestions() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionsHandler = { offset, limit in + let end = min(30, offset + limit) + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 30, offset: offset, + nextOffset: end < 30 ? end : nil, hasMore: end < 30, + items: ((offset + 1)...end).map { order in + let value = TrainingRemoteFixtures.question(order) + return TrainingQuestionItem(id: value.id, order: order, type: order == 2 ? .multiple : .single, + stem: value.stem, options: value.options) + }) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 3, answers: ["q1": ["A"]]) + let vm = model(defaults) + await vm.load(service: source) + #expect(!vm.selectLocally(optionID: "A", service: source)) + #expect(vm.selectLocally(optionID: "B", service: source)) + #expect(vm.goToCachedQuestion(1, service: source)) + #expect(vm.selectLocally(optionID: "A", service: source)) + #expect(vm.selectLocally(optionID: "B", service: source)) + #expect(vm.currentSelectedIDs == ["A", "B"]) + #expect(vm.answeredQuestionOrders == [1, 2]) + #expect(await source.savedRequests.isEmpty) + #expect(await vm.flushDraft(service: source)) + let requests = await source.savedRequests + #expect(requests.count == 1) + #expect(requests.first?.baseRevision == 3) + #expect(requests.first?.changes == [TrainingDraftChange(questionID: "q1", selectedOptionIDs: ["B"]), + TrainingDraftChange(questionID: "q2", selectedOptionIDs: ["A", "B"])]) + #expect(!vm.hasUnsavedChanges) + } + + @Test("超过20题的本机修改按协议边界串行拆批,并逐批推进确认版本") + func batchesAtTwentyChanges() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let source = TrainingDataStub() + let vm = model(defaults) + await vm.load(service: source) + for index in 0..<25 { + if index != vm.currentIndex { await vm.goToQuestion(index, service: source) } + #expect(vm.selectLocally(optionID: "A", service: source)) + } + #expect(await source.savedRequests.isEmpty) + #expect(await vm.flushDraft(service: source)) + let requests = await source.savedRequests + #expect(requests.map { $0.changes.count } == [20, 5]) + #expect(requests.map(\.baseRevision) == [1, 2]) + #expect(vm.answeredCount == 25) + #expect(!vm.hasUnsavedChanges) + } + + @Test("未缓存题读取悬停时防抖及离页flush都等读取完成,不并发写旧版本") + func uncachedReadCoordinatesDebounceAndFlush() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let gate = TrainingDraftWriterGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.questionsHandler = { offset, limit in + if offset == 10 { await gate.pauseFirst() } + let end = min(30, offset + limit) + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 30, offset: offset, + nextOffset: end < 30 ? end : nil, hasMore: end < 30, + items: ((offset + 1)...end).map(TrainingRemoteFixtures.question)) + } + let source = TrainingDataStub(configuration: configuration) + let scope = context + let vm = TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), + debounceNanoseconds: 20_000_000, currentContext: { scope }) + await vm.load(service: source) + vm.selectLocally(optionID: "A", service: source) + let navigate = Task { await vm.goToQuestion(10, service: source) } + try await waitUntil { (await source.calls).contains { $0.name == "questions" && $0.offset == 10 } } + let leavingFlush = Task { await vm.flushDraft(service: source) } + try await Task.sleep(for: .milliseconds(50)) + #expect(await source.savedRequests.isEmpty) + await gate.release() + await navigate.value + #expect(await leavingFlush.value) + #expect(vm.currentQuestion?.id == "q11") + #expect(await source.savedRequests.count == 1) + #expect(await source.savedRequests.first?.lastQuestionOrder == 11) + } + + @Test("原子日志写入失败时保留期望选择并阻止发起PATCH") + func failedDiskWriteStopsNetworkMutation() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let directory = FileManager.default.temporaryDirectory.appendingPathComponent("TrainingDraftWriteFailure-\(UUID().uuidString)") + defer { try? FileManager.default.removeItem(at: directory) } + let source = TrainingDataStub() + let scope = context + let vm = TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), + draftStore: TrainingDraftStore(defaults: defaults, directoryURL: directory), + debounceNanoseconds: 60_000_000_000, currentContext: { scope }) + await vm.load(service: source) + #expect(vm.canEdit) + try FileManager.default.removeItem(at: directory) + try Data("blocks-directory".utf8).write(to: directory) + #expect(vm.selectLocally(optionID: "A", service: source)) + #expect(vm.currentSelectedIDs == ["A"]) + #expect(!vm.canEdit && vm.hasPendingMutation) + #expect(!(await vm.flushDraft(service: source))) + #expect(await source.savedRequests.isEmpty) + } + + @Test("B已确认、A在飞时改回B,慢ACK不能清除新意图且下批用最新版本") + func slowAcknowledgementCannotOverwriteReverseSelection() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let gate = TrainingDraftWriterGate() + defer { Task { await gate.release() } } + let source = TrainingDataStub() + await source.seedDraft(revision: 5, answers: ["q1": ["B"]]) + await source.configure { configuration in + configuration.saveHandler = { request in + await gate.pauseFirst() + await source.seedDraft(revision: request.baseRevision + 1, + answers: ["q1": request.changes.first?.selectedOptionIDs ?? []]) + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, + savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + } + let vm = model(defaults) + await vm.load(service: source) + vm.selectLocally(optionID: "A", service: source) + let flush = Task { await vm.flushDraft(service: source) } + try await waitUntil { await source.savedRequests.count == 1 } + #expect(vm.isSaving && vm.canEdit && !vm.isBusy) + vm.selectLocally(optionID: "B", service: source) + #expect(vm.currentSelectedIDs == ["B"]) + let journal = try #require(try TrainingDraftStore(defaults: defaults).load(taskID: "task_1", paperSnapshotID: "paper_1", context: context)) + #expect(journal.pendingSave?.changes.first?.selectedOptionIDs == ["A"]) + #expect(journal.answers.first?.selectedOptionIDs == ["B"]) + await gate.release() + #expect(await flush.value) + let requests = await source.savedRequests + #expect(requests.map(\.baseRevision) == [5, 6]) + #expect(requests.map { $0.changes.first?.selectedOptionIDs } == [["A"], ["B"]]) + #expect(vm.currentSelectedIDs == ["B"]) + #expect(!vm.hasUnsavedChanges) + } + + @Test("交卷等待在飞及后续意图全部确认,期间锁编辑并只提交最终版本") + func submissionFlushesAllChangesBeforeRequest() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let gate = TrainingDraftWriterGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 1 + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: ["q1": ["B"]]) + await source.configure { configuration in + configuration.saveHandler = { request in + await gate.pauseFirst() + await source.seedDraft(revision: request.baseRevision + 1, + answers: ["q1": request.changes.first?.selectedOptionIDs ?? []]) + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, + savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + } + let vm = model(defaults) + await vm.load(service: source) + vm.selectLocally(optionID: "A", service: source) + let save = Task { await vm.flushDraft(service: source) } + try await waitUntil { await source.savedRequests.count == 1 } + vm.selectLocally(optionID: "B", service: source) + let submit = Task { await vm.submit(service: source) } + try await waitUntil { vm.isBusy } + #expect(!vm.canEdit) + #expect(!vm.selectLocally(optionID: "A", service: source)) + #expect(await source.submissionRequests.isEmpty) + await gate.release() + #expect(await save.value) + #expect(await submit.value?.id == "attempt_1") + #expect(await source.submissionRequests.first?.draftRevision == 7) + #expect(await source.savedRequests.count == 2) + } + + @Test("恢复尚未发送的选择发现服务端版本已改变,保留overlay并等待明确确认") + func recoveredDirtyDraftDoesNotOverwriteNewRemoteRevision() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let store = TrainingDraftStore(defaults: defaults) + try store.save(TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", context: context, revision: 2, + answers: [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["A"])], lastQuestionOrder: 1), replacing: nil) + let source = TrainingDataStub() + await source.seedDraft(revision: 9, answers: ["q1": ["B"]]) + let vm = model(defaults) + await vm.load(service: source) + #expect(vm.currentSelectedIDs == ["A"]) + #expect(vm.hasDraftConflict && vm.canEdit) + #expect(!(await vm.flushDraft(service: source))) + #expect(await source.savedRequests.isEmpty) + await vm.resolveDraftConflict(useLocalAnswers: true, service: source) + #expect(await source.savedRequests.first?.baseRevision == 9) + #expect(vm.currentSelectedIDs == ["A"]) + #expect(!vm.hasDraftConflict && !vm.hasUnsavedChanges) + } + + @Test("未知原请求跨页面恢复后先同键确认,再发送本机较新选择") + func restoresFrozenRequestAndNewerIntent() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let request = TrainingDraftSaveRequest(requestID: "frozen", paperSnapshotID: "paper_1", baseRevision: 4, + lastQuestionOrder: 1, changes: [TrainingDraftChange(questionID: "q1", selectedOptionIDs: ["A"])]) + try TrainingDraftStore(defaults: defaults).save(TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", + context: context, revision: 4, answers: [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["B"])], + lastQuestionOrder: 1, pendingSave: request), replacing: nil) + let source = TrainingDataStub() + await source.seedDraft(revision: 4, answers: [:]) + let vm = model(defaults) + await vm.load(service: source) + let requests = await source.savedRequests + #expect(requests.count == 2) + #expect(requests.first == request) + #expect(requests.last?.baseRevision == 5) + #expect(requests.last?.changes.first?.selectedOptionIDs == ["B"]) + #expect(vm.currentSelectedIDs == ["B"]) + #expect(!vm.hasUnsavedChanges) + } + + @Test("重建重考页恢复未知reset只用原键,成功返回的新答案不被第二次新键清空") + func restoredResetDoesNotCreateSecondReset() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let request = TrainingDraftResetRequest(requestID: "original_reset", paperSnapshotID: "paper_1", baseRevision: 3) + try TrainingDraftStore(defaults: defaults).save(TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", + context: context, revision: 3, pendingReset: request), replacing: nil) + let source = TrainingDataStub() + await source.seedDraft(revision: 5, answers: ["q1": ["B"]]) + await source.configure { configuration in + configuration.resetHandler = { _ in + TrainingDraftConfirmation(draftRevision: 5, savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + } + let vm = model(defaults) + await vm.load(service: source, resetDraft: true) + #expect(await source.resetRequests == [request]) + #expect(vm.currentSelectedIDs == ["B"]) + #expect(vm.canEdit) + } + + @Test("未知请求重试返回历史ACK低于已观察版本时,较新意图不得静默覆盖云端") + func historicalAcknowledgementRequiresConflictConfirmation() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let request = TrainingDraftSaveRequest(requestID: "frozen", paperSnapshotID: "paper_1", baseRevision: 5, + lastQuestionOrder: 1, changes: [TrainingDraftChange(questionID: "q1", selectedOptionIDs: ["A"])]) + try TrainingDraftStore(defaults: defaults).save(TrainingDraftRecord(taskID: "task_1", paperSnapshotID: "paper_1", + context: context, revision: 5, answers: [TrainingDraftLocalAnswer(questionID: "q1", order: 1, selectedOptionIDs: ["B"])], + lastQuestionOrder: 1, pendingSave: request), replacing: nil) + let counter = TrainingDraftRetryCounter() + let source = TrainingDataStub() + await source.seedDraft(revision: 100, answers: ["q1": ["A"]]) + await source.configure { configuration in + configuration.saveHandler = { _ in + if await counter.next() == 1 { throw URLError(.timedOut) } + return TrainingDraftConfirmation(draftRevision: 6, savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + } + let vm = model(defaults) + await vm.load(service: source) + #expect(vm.draftRevision == 100) + #expect(vm.currentSelectedIDs == ["B"]) + await vm.retryMutation(service: source) + #expect(vm.hasDraftConflict) + #expect(vm.currentSelectedIDs == ["B"]) + #expect(await source.savedRequests == [request, request]) + #expect(!(await vm.flushDraft(service: source))) + #expect(await source.savedRequests.count == 2) + } + + @Test("身份变化拒绝迟到ACK,原账号日志保留且不向新账号继续发送") + func identityChangePreservesOriginalJournal() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let identity = TrainingDraftTestIdentity(context) + let source = TrainingDataStub() + let gate = TrainingDraftWriterGate() + defer { Task { await gate.release() } } + await source.configure { configuration in + configuration.saveHandler = { request in + await gate.pauseFirst() + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, + savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + } + let vm = TrainingRemoteExamViewModel(taskID: "task_1", context: context, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), + debounceNanoseconds: 60_000_000_000, currentContext: { identity.context }) + await vm.load(service: source) + vm.selectLocally(optionID: "A", service: source) + let flush = Task { await vm.flushDraft(service: source) } + try await waitUntil { await source.savedRequests.count == 1 } + let store = TrainingDraftStore(defaults: defaults) + let original = try #require(try store.load(taskID: "task_1", paperSnapshotID: "paper_1", context: context)) + identity.context = TrainingContext(accountScope: "other", scenicID: 10, storeID: 3) + await gate.release() + #expect(!(await flush.value)) + #expect(vm.isIdentityInvalid && vm.shouldReturnToCenter) + #expect(vm.currentQuestion == nil && vm.currentSelectedIDs.isEmpty) + #expect(try store.load(taskID: "task_1", paperSnapshotID: "paper_1", context: context) == original) + #expect(await source.savedRequests.count == 1) + } + + @Test("普通版本冲突明确选择云端时只丢本机未保存意图,不重发PATCH") + func conflictCanUseSavedAnswers() async throws { + let (name, defaults) = try domain() + defer { defaults.removePersistentDomain(forName: name) } + let source = TrainingDataStub() + let vm = model(defaults) + await vm.load(service: source) + await source.seedDraft(revision: 7, answers: ["q1": ["B"]]) + vm.selectLocally(optionID: "A", service: source) + #expect(!(await vm.flushDraft(service: source))) + #expect(vm.currentSelectedIDs == ["A"] && vm.hasDraftConflict) + await vm.resolveDraftConflict(useLocalAnswers: false, service: source) + #expect(vm.currentSelectedIDs == ["B"]) + #expect(await source.savedRequests.count == 1) + #expect(!vm.hasUnsavedChanges && !vm.hasDraftConflict) + } +} diff --git a/suixinkanTests/TrainingExamNavigationInteractionTests.swift b/suixinkanTests/TrainingExamNavigationInteractionTests.swift new file mode 100644 index 0000000..afed073 --- /dev/null +++ b/suixinkanTests/TrainingExamNavigationInteractionTests.swift @@ -0,0 +1,406 @@ +import Foundation +import Testing +import UIKit +@testable import suixinkan + +/// 仅未缓存题页读取需要同步动作锁,位置保存由后台串行处理。 +enum TrainingNavigationScenario: String, CaseIterable, Sendable { + case previousQuestions, nextQuestions + + var isPrevious: Bool { self == .previousQuestions } + var initialOrder: Int { isPrevious ? 11 : 10 } + var targetOrder: Int { isPrevious ? 10 : 11 } + var initialOffset: Int { isPrevious ? 10 : 0 } + var targetOffset: Int { isPrevious ? 0 : 10 } +} + +/// 精确挂起选定请求,允许验证网络等待时的外观和重复操作。 +private actor TrainingNavigationRequestGate { + private var continuations: [CheckedContinuation] = [] + private var released = false + private(set) var requestCount = 0 + + /// 每次请求独立登记,重复写入不会覆盖已等待的响应。 + func wait() async { + requestCount += 1 + if released { return } + await withCheckedContinuation { continuations.append($0) } + } + + /// 完成全部已等待响应,也用于异常退出时释放测试任务。 + func release() { + released = true + let pending = continuations + continuations = [] + pending.forEach { $0.resume() } + } +} + +/// 记录按钮的实际外观,区分业务禁用与请求期间的交互暂停。 +private struct TrainingNavigationButtonAppearance: Equatable { + let isEnabled: Bool + let alpha: CGFloat + let backgroundColor: UIColor? + let normalTitleColor: UIColor? + let configuredBackgroundColor: UIColor? + let configuredForegroundColor: UIColor? + + /// 同时覆盖 AppButton 和选项 Configuration 的颜色。 + @MainActor + init(_ button: UIButton) { + isEnabled = button.isEnabled + alpha = button.alpha + backgroundColor = button.backgroundColor + normalTitleColor = button.titleColor(for: .normal) + configuredBackgroundColor = button.configuration?.baseBackgroundColor + configuredForegroundColor = button.configuration?.baseForegroundColor + } +} + +/// 在真实窗口验证前后翻题和答题卡返回,不接触全局登录态或真实网络。 +@Suite("培训答题翻题和答题卡交互", .serialized) +@MainActor +struct TrainingExamNavigationInteractionTests { + private let context = TrainingContext(accountScope: "exam_navigation", scenicID: 10, storeID: 3) + + @Test("未缓存题页读取时不置灰,重复动作不会偏离目标", arguments: TrainingNavigationScenario.allCases) + func navigationPreservesAppearanceAndTarget(scenario: TrainingNavigationScenario) async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingNavigationRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.questionsHandler = { offset, limit in + if offset == scenario.targetOffset { await gate.wait() } + return Self.questions(total: 30, offset: offset, limit: limit) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: Dictionary(uniqueKeysWithValues: (1...30).map { ("q\($0)", ["A"]) }), lastOrder: scenario.initialOrder) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + try await waitUntil { model.canEdit && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + let previous = try #require(button("training.exam.previous", in: controller.view)) + let next = try #require(button("training.exam.next", in: controller.view)) + let submit = try #require(button("training.exam.submit", in: controller.view)) + let optionA = try #require(button("training.option.A", in: controller.view)) + let optionB = try #require(button("training.option.B", in: controller.view)) + let answerCard = try #require(controller.navigationItem.rightBarButtonItem) + let controls = [previous, next, submit, optionA, optionB] + let appearances = controls.map { TrainingNavigationButtonAppearance($0) } + let moving = scenario.isPrevious ? previous : next + #expect(controls.allSatisfy { $0.isEnabled }) + #expect(answerCard.isEnabled) + #expect(model.currentIndex == scenario.initialOrder - 1) + + moving.sendActions(for: .touchUpInside) + // 同一 main actor 中连续动作,验证 Task 启动之前就已串行化。 + moving.sendActions(for: .touchUpInside) + previous.sendActions(for: .touchUpInside) + next.sendActions(for: .touchUpInside) + optionB.sendActions(for: .touchUpInside) + submit.sendActions(for: .touchUpInside) + try activate(answerCard) + #expect(controls.map { TrainingNavigationButtonAppearance($0) } == appearances) + #expect(answerCard.isEnabled) + #expect(controller.presentedViewController == nil) + try await waitUntil { await gate.requestCount > 0 } + #expect(model.isBusy) + #expect(model.currentIndex == scenario.targetOrder - 1) + #expect(controls.map { TrainingNavigationButtonAppearance($0) } == appearances) + #expect(controls.allSatisfy { !$0.isUserInteractionEnabled }) + #expect(answerCard.isEnabled) + #expect(allViews(controller.view).compactMap { $0 as? UILabel }.contains { $0.text == "正在加载题目…" }) + #expect(navigation.topViewController === controller) + #expect(controller.presentedViewController == nil) + #expect(await source.submissionRequests.isEmpty) + let questionsWhileWaiting = await source.calls.filter { $0.name == "questions" } + #expect(questionsWhileWaiting.map(\.offset) == [scenario.initialOffset, scenario.targetOffset]) + #expect(await source.savedRequests.isEmpty) + + await gate.release() + try await waitUntil { + model.canEdit && model.currentQuestion?.order == scenario.targetOrder && next.isUserInteractionEnabled + } + #expect(model.currentIndex == scenario.targetOrder - 1) + #expect(model.currentSelectedIDs == ["A"]) + #expect(model.errorMessage == nil) + #expect([previous, next, submit].allSatisfy { $0.isEnabled && $0.isUserInteractionEnabled }) + #expect([previous, next, submit].map { TrainingNavigationButtonAppearance($0) } == Array(appearances.prefix(3))) + #expect(await model.flushDraft(service: source)) + let requests = await source.savedRequests + #expect(requests.count == 1) + #expect(requests.first?.lastQuestionOrder == scenario.targetOrder) + #expect(requests.first?.changes.isEmpty == true) + #expect(requests.first?.baseRevision == 5) + #expect(await gate.requestCount == 1) + let calls = await source.calls + #expect(calls.filter { $0.name == "questions" }.map(\.offset) == [scenario.initialOffset, scenario.targetOffset]) + #expect(calls.filter { $0.name == "task" || $0.name == "progress" || $0.name == "paper" }.map(\.name) == ["task", "progress", "paper"]) + #expect(calls.filter { $0.name == "draft" && $0.limit == 0 }.count == 1) + #expect(navigation.topViewController === controller) + #expect(controller.presentedViewController == nil) + } + + @Test("首末题仅禁用越界方向,完成请求不会把所有控件一律启用", arguments: [1, 30]) + func firstAndLastQuestionKeepBoundaryDisabled(targetOrder: Int) async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let source = TrainingDataStub() + await source.seedDraft(revision: 3, answers: [:], lastOrder: targetOrder == 1 ? 2 : 29) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + try await waitUntil { model.canEdit && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + let previous = try #require(button("training.exam.previous", in: controller.view)) + let next = try #require(button("training.exam.next", in: controller.view)) + let moving = targetOrder == 1 ? previous : next + moving.sendActions(for: .touchUpInside) + try await waitUntil { model.canEdit && model.currentQuestion?.order == targetOrder && moving.isUserInteractionEnabled } + let disabled = targetOrder == 1 ? previous : next + let allowed = targetOrder == 1 ? next : previous + #expect(!disabled.isEnabled) + #expect(allowed.isEnabled) + #expect(abs(disabled.alpha - 0.6) < 0.001) + #expect(allowed.alpha == 1) + #expect(button("training.exam.submit", in: controller.view)?.isEnabled == true) + #expect(controller.navigationItem.rightBarButtonItem?.isEnabled == true) + #expect(await model.flushDraft(service: source)) + let before = await source.calls + disabled.sendActions(for: .touchUpInside) + try await settleTransitions([navigation, controller]) + #expect(model.currentIndex == targetOrder - 1) + #expect(!disabled.isEnabled && allowed.isEnabled) + #expect(await source.calls == before) + } + + @Test("答题卡完成或系统关闭不重载课程,500题跨页选择只请求目标页") + func answerCardDismissalAndRandomAccessAvoidFullReload() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingNavigationRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 500 + configuration.questionsHandler = { offset, limit in + if offset == 490 { await gate.wait() } + return Self.questions(total: 500, offset: offset, limit: limit) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: ["q401": ["B"], "q500": ["A"]], lastOrder: 401) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + try await waitUntil { model.canEdit && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + let initialCalls = await source.calls + + let doneSheet = try await openAnswerCard(controller) + let doneCard = try #require(doneSheet.topViewController as? TrainingAnswerCardViewController) + let done = try #require(doneCard.navigationItem.rightBarButtonItem) + // 正规 appearance transition 模拟答题卡完全覆盖考试页的系统回调。 + controller.beginAppearanceTransition(false, animated: false) + controller.endAppearanceTransition() + try activate(done) + try await waitUntil { controller.presentedViewController == nil } + try await settleTransitions([navigation, controller, doneSheet]) + controller.beginAppearanceTransition(true, animated: false) + controller.endAppearanceTransition() + try await settleTransitions([navigation, controller]) + #expect(model.currentIndex == 400 && model.currentSelectedIDs == ["B"]) + #expect(await source.calls == initialCalls) + + let systemSheet = try await openAnswerCard(controller) + let presentation = systemSheet.presentationController + controller.beginAppearanceTransition(false, animated: false) + controller.endAppearanceTransition() + systemSheet.dismiss(animated: true) + try await waitUntil { controller.presentedViewController == nil } + try await settleTransitions([navigation, controller, systemSheet]) + // 转发交互关闭的公开 delegate 回调,覆盖手势关闭后的业务入口。 + if let presentation { presentation.delegate?.presentationControllerDidDismiss?(presentation) } + controller.beginAppearanceTransition(true, animated: false) + controller.endAppearanceTransition() + try await settleTransitions([navigation, controller]) + #expect(model.currentIndex == 400 && model.currentSelectedIDs == ["B"]) + #expect(await source.calls == initialCalls) + #expect(button("training.exam.next", in: controller.view)?.isEnabled == true) + #expect(controller.navigationItem.rightBarButtonItem?.isEnabled == true) + + let selectionSheet = try await openAnswerCard(controller) + let card = try #require(selectionSheet.topViewController as? TrainingAnswerCardViewController) + let collection = try #require(allViews(card.view).first { $0 is UICollectionView } as? UICollectionView) + try await waitUntil { collection.numberOfItems(inSection: 0) == 500 } + let previous = try #require(button("training.exam.previous", in: controller.view)) + let next = try #require(button("training.exam.next", in: controller.view)) + let submit = try #require(button("training.exam.submit", in: controller.view)) + let appearances = [previous, next, submit].map { TrainingNavigationButtonAppearance($0) } + let target = IndexPath(item: 499, section: 0) + collection.scrollToItem(at: target, at: .centeredVertically, animated: false) + collection.layoutIfNeeded() + collection.selectItem(at: target, animated: false, scrollPosition: []) + collection.delegate?.collectionView?(collection, didSelectItemAt: target) + try await waitUntil { await gate.requestCount > 0 } + #expect(controller.presentedViewController == nil) + #expect(model.currentIndex == 499) + #expect([previous, next, submit].map { TrainingNavigationButtonAppearance($0) } == appearances) + #expect(controller.navigationItem.rightBarButtonItem?.isEnabled == true) + #expect([previous, next, submit].allSatisfy { !$0.isUserInteractionEnabled }) + #expect(await source.calls.filter { $0.name == "questions" }.map(\.offset) == [400, 490]) + await gate.release() + try await waitUntil { model.canEdit && model.currentQuestion?.id == "q500" && next.isUserInteractionEnabled } + try await settleTransitions([navigation, controller, selectionSheet]) + #expect(model.currentIndex == 499 && model.currentSelectedIDs == ["A"]) + #expect(model.answeredCount == 2) + #expect(previous.isEnabled && !next.isEnabled) + #expect(navigation.topViewController === controller) + let finalCalls = await source.calls + #expect(finalCalls.filter { $0.name == "task" || $0.name == "progress" || $0.name == "paper" } == initialCalls.filter { $0.name == "task" || $0.name == "progress" || $0.name == "paper" }) + #expect(finalCalls.filter { $0.name == "questions" }.map(\.offset) == [400, 490]) + #expect(finalCalls.filter { $0.name == "draft" }.map(\.limit) == [0, 10, 10]) + #expect(finalCalls.filter { $0.name == "questions" }.allSatisfy { $0.limit == 10 }) + #expect(await model.flushDraft(service: source)) + let saves = await source.savedRequests + #expect(saves.count == 1) + #expect(saves.first?.lastQuestionOrder == 500 && saves.first?.changes.isEmpty == true) + #expect(await source.submissionRequests.isEmpty) + } + + @Test("保存挂起时缓存翻题和答题卡继续可用,本地答案不会被旧页刷新覆盖") + func cachedNavigationAndAnswerCardRemainAvailableWhileSaving() async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingNavigationRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + configuration.saveHandler = { request in + await gate.wait() + return TrainingDraftConfirmation(draftRevision: request.baseRevision + (request.changes.isEmpty ? 0 : 1), + savedAt: TrainingRemoteFixtures.now, answeredCount: 3) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: ["q1": ["A"], "q2": ["A"], "q3": ["A"]], lastOrder: 2) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + try await waitUntil { model.canEdit && !manager.isShowing && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + let initialReads = await source.calls.filter { ["task", "progress", "paper", "questions", "draft"].contains($0.name) } + let optionB = try #require(button("training.option.B", in: controller.view)) + optionB.sendActions(for: .touchUpInside) + try await waitUntil { await gate.requestCount == 1 } + #expect(model.isSaving && model.canEdit && !manager.isShowing) + let next = try #require(button("training.exam.next", in: controller.view)) + next.sendActions(for: .touchUpInside) + // 缓存跳转须当场完成,不能等正在保存的首批请求。 + #expect(model.currentIndex == 2 && model.currentQuestion?.id == "q3") + #expect(!model.isBusy && model.isSaving && !manager.isShowing) + #expect(!next.isEnabled) + let previous = try #require(button("training.exam.previous", in: controller.view)) + #expect(previous.isEnabled && previous.isUserInteractionEnabled) + previous.sendActions(for: .touchUpInside) + #expect(model.currentIndex == 1 && model.currentSelectedIDs == ["B"]) + #expect(button("training.option.B", in: controller.view)?.accessibilityTraits.contains(.selected) == true) + #expect(!manager.isShowing && model.canEdit) + let cardSheet = try await openAnswerCard(controller) + let card = try #require(cardSheet.topViewController as? TrainingAnswerCardViewController) + let collection = try #require(allViews(card.view).compactMap { $0 as? UICollectionView }.first) + try await waitUntil { collection.numberOfItems(inSection: 0) == 3 } + #expect(!manager.isShowing && model.isSaving) + let done = try #require(card.navigationItem.rightBarButtonItem) + try activate(done) + try await waitUntil { controller.presentedViewController == nil } + try await settleTransitions([navigation, controller, cardSheet]) + #expect(model.currentIndex == 1 && model.currentSelectedIDs == ["B"]) + #expect(!manager.isShowing && model.canEdit) + #expect(await source.savedRequests.count == 1) + let finalReads = await source.calls.filter { ["task", "progress", "paper", "questions", "draft"].contains($0.name) } + #expect(finalReads == initialReads) + #expect(navigation.topViewController === controller) + await gate.release() + #expect(await model.flushDraft(service: source)) + #expect(!model.isSaving && !model.hasUnsavedChanges && model.currentSelectedIDs == ["B"]) + } + + private nonisolated static func questions(total: Int, offset: Int, limit: Int) -> TrainingQuestionPage { + let end = min(total, offset + limit) + let items: [TrainingQuestionItem] = offset < end ? ((offset + 1)...end).map(TrainingRemoteFixtures.question) : [] + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: total, offset: offset, + nextOffset: end < total ? end : nil, hasMore: end < total, items: items) + } + + private func makeDefaults() throws -> (name: String, defaults: UserDefaults) { + let name = "TrainingExamNavigationInteractionTests-\(UUID().uuidString)" + return (name, try #require(UserDefaults(suiteName: name))) + } + + private func makeModel(defaults: UserDefaults) -> TrainingRemoteExamViewModel { + let scope = context + return TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), currentContext: { scope }) + } + + private func makeWindow(_ navigation: UINavigationController) throws -> UIWindow { + let scene = try #require(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first) + let window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + window.rootViewController = navigation + window.isHidden = false + navigation.view.layoutIfNeeded() + return window + } + + private func openAnswerCard(_ controller: TrainingExamViewController) async throws -> UINavigationController { + let item = try #require(controller.navigationItem.rightBarButtonItem) + try activate(item) + try await waitUntil { controller.presentedViewController is UINavigationController } + let presented = try #require(controller.presentedViewController as? UINavigationController) + try await settleTransitions([controller, presented]) + return presented + } + + private func activate(_ item: UIBarButtonItem) throws { + if let action = item.primaryAction { + let dispatcher = UIButton(type: .system) + dispatcher.addAction(action, for: .touchUpInside) + dispatcher.sendActions(for: .touchUpInside) + } else { + let action = try #require(item.action) + UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + } + + private func allViews(_ view: UIView) -> [UIView] { + [view] + view.subviews.flatMap { allViews($0) } + } + + private func button(_ identifier: String, in view: UIView) -> UIButton? { + allViews(view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == identifier } + } + + private func settleTransitions(_ controllers: [UIViewController]) async throws { + try await Task.sleep(for: .milliseconds(20)) + try await waitUntil { controllers.allSatisfy { $0.transitionCoordinator == nil && !$0.isBeingPresented && !$0.isBeingDismissed } } + } + + private func waitUntil(_ condition: @MainActor () async -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !(await condition()), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + let reached = await condition() + try #require(reached) + } +} diff --git a/suixinkanTests/TrainingExamSelectionInteractionTests.swift b/suixinkanTests/TrainingExamSelectionInteractionTests.swift new file mode 100644 index 0000000..b1c73f6 --- /dev/null +++ b/suixinkanTests/TrainingExamSelectionInteractionTests.swift @@ -0,0 +1,269 @@ +import Foundation +import Testing +import UIKit +@testable import suixinkan + +/// 明确挂起首批保存响应,后续批次只能在原确认后发送。 +private actor TrainingSelectionSaveGate { + private var responses: [CheckedContinuation] = [] + private var released = false + private(set) var requestCount = 0 + + /// 保存请求等待测试释放,意外并发也不会覆盖原 continuation。 + func wait() async { + requestCount += 1 + if released { return } + await withCheckedContinuation { responses.append($0) } + } + + /// 释放全部已挂起请求,异常退出也不会遗留测试任务。 + func release() { + released = true + let pending = responses + responses = [] + pending.forEach { $0.resume() } + } +} + +/// 首批保存丢失响应,后续确认用于检查同键恢复与较新本地选择的串行提交。 +private actor TrainingSelectionTimeoutResponse { + private var count = 0 + + /// 首次失败,其后每次只确认调用方传入的冻结版本。 + func confirm(_ request: TrainingDraftSaveRequest) throws -> TrainingDraftConfirmation { + count += 1 + if count == 1 { throw URLError(.timedOut) } + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, + savedAt: TrainingRemoteFixtures.now, answeredCount: 3) + } +} + +/// 捕获实际按钮外观,避免保存时重新出现置灰或透明度变化。 +private struct TrainingSelectionButtonAppearance: Equatable { + let isEnabled: Bool + let alpha: CGFloat + let backgroundColor: UIColor? + let normalTitleColor: UIColor? + + /// 同步读取 UIKit 外观,独立于业务 ViewModel 状态。 + @MainActor + init(_ button: UIButton) { + isEnabled = button.isEnabled + alpha = button.alpha + backgroundColor = button.backgroundColor + normalTitleColor = button.titleColor(for: .normal) + } +} + +/// 在真实 keyWindow 检查全局遮罩,结束后恢复原应用窗口。 +@MainActor +private final class TrainingSelectionWindowScope { + let window: UIWindow + private weak var previousKeyWindow: UIWindow? + + /// 由 UIKit 自己发送 appearance 生命周期,不手动重复调用。 + init(_ navigation: UINavigationController) throws { + let scene = try #require(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first) + previousKeyWindow = scene.windows.first { $0.isKeyWindow } + window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + window.rootViewController = navigation + window.makeKeyAndVisible() + navigation.view.layoutIfNeeded() + } + + /// 清理本例窗口并恢复先前的 keyWindow。 + func close() { + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKey() + } +} + +/// 本地即时选择与串行后台保存的真实 UIKit 回归,不操作真实学员数据。 +@Suite("培训答题选项保存交互", .serialized) +@MainActor +struct TrainingExamSelectionInteractionTests { + private let context = TrainingContext(accountScope: "exam_selection", scenicID: 10, storeID: 3) + + @Test("后台保存不显示遮罩,在途连续改选保持即时高亮且按确认版本串行写入", arguments: [TrainingQuestionType.single, .multiple]) + func selectionRemainsInteractiveDuringBackgroundSave(type: TrainingQuestionType) async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingSelectionSaveGate() + defer { Task { await gate.release() } } + var configuration = makeConfiguration(type: type) + configuration.saveHandler = { request in + await gate.wait() + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, + savedAt: TrainingRemoteFixtures.now, answeredCount: 3) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: ["q1": ["A"], "q2": ["B"], "q3": ["A"]], lastOrder: 2) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingSelectionWindowScope(navigation) + defer { scope.close() } + try await waitUntil { model.canEdit && !manager.isShowing && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + let optionA = try #require(button("training.option.A", in: controller.view)) + let optionB = try #require(button("training.option.B", in: controller.view)) + let controls = try ["training.exam.previous", "training.exam.next", "training.exam.submit"].map { + try #require(button($0, in: controller.view)) + } + let appearances = controls.map { TrainingSelectionButtonAppearance($0) } + let firstSelection: Set = type == .single ? ["A"] : ["A", "B"] + #expect(model.currentIndex == 1 && model.currentSelectedIDs == ["B"]) + + optionA.sendActions(for: .touchUpInside) + // 不让出主 actor:选择与落盘先完成,网络防抖不能延迟高亮。 + #expect(model.currentSelectedIDs == firstSelection) + #expect(optionA.accessibilityTraits.contains(.selected)) + #expect(optionB.accessibilityTraits.contains(.selected) == (type == .multiple)) + #expect(!manager.isShowing) + #expect(model.canEdit && !model.isBusy) + #expect(controls.map { TrainingSelectionButtonAppearance($0) } == appearances) + try await waitUntil { await gate.requestCount == 1 } + #expect(model.isSaving && model.hasUnsavedChanges && model.canEdit && !model.isBusy) + #expect(!manager.isShowing) + #expect(!scope.window.subviews.contains { $0 is GlobalLoadingOverlayView && !$0.isHidden }) + + optionB.sendActions(for: .touchUpInside) + #expect(model.currentSelectedIDs == (type == .single ? ["B"] : ["A"])) + optionA.sendActions(for: .touchUpInside) + #expect(model.currentSelectedIDs == (type == .single ? ["A"] : [])) + if type == .multiple { #expect(model.answeredCount == 2) } + optionB.sendActions(for: .touchUpInside) + #expect(model.currentSelectedIDs == ["B"]) + #expect(!optionA.accessibilityTraits.contains(.selected) && optionB.accessibilityTraits.contains(.selected)) + #expect(optionA.isEnabled && optionB.isEnabled && optionA.isUserInteractionEnabled && optionB.isUserInteractionEnabled) + #expect(controls.map { TrainingSelectionButtonAppearance($0) } == appearances) + #expect(controls.allSatisfy { $0.isUserInteractionEnabled }) + #expect(controller.navigationItem.rightBarButtonItem?.isEnabled == true) + #expect(button("training.option.A", in: controller.view) === optionA) + #expect(button("training.option.B", in: controller.view) === optionB) + #expect(await source.savedRequests.count == 1) + let firstRequests = await source.savedRequests + let first = try #require(firstRequests.first) + #expect(first.baseRevision == 5) + #expect(first.changes == [TrainingDraftChange(questionID: "q2", selectedOptionIDs: firstSelection.sorted())]) + #expect(await source.submissionRequests.isEmpty) + #expect(allViews(controller.view).compactMap { $0 as? UILabel }.contains { $0.text?.contains("保存") == true }) + navigation.view.layoutIfNeeded() + let screenshot = UIGraphicsImageRenderer(size: navigation.view.bounds.size).image { output in + navigation.view.layer.render(in: output.cgContext) + } + Attachment.record(screenshot, named: "后台保存中仍可改选-\(type == .single ? "单选" : "多选")", as: .png) + + await gate.release() + try await waitUntil { !model.hasUnsavedChanges && !model.isSaving && model.currentSelectedIDs == ["B"] } + #expect(model.draftRevision == 7 && model.answeredCount == 3) + #expect(model.canEdit && model.errorMessage == nil) + let requests = await source.savedRequests + #expect(requests.count == 2) + #expect(requests.last?.baseRevision == 6) + #expect(requests.last?.requestID != first.requestID) + #expect(requests.last?.changes == [TrainingDraftChange(questionID: "q2", selectedOptionIDs: ["B"])]) + #expect(button("training.option.A", in: controller.view) === optionA) + #expect(button("training.option.B", in: controller.view) === optionB) + #expect(!optionA.accessibilityTraits.contains(.selected) && optionB.accessibilityTraits.contains(.selected)) + #expect(!manager.isShowing && navigation.topViewController === controller) + } + + @Test("超时保留本地选择,继续改选不替换原键,重试后再保存较新答案") + func timeoutKeepsDesiredAnswerAndRetriesFrozenPayloadBeforeLatestSelection() async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let response = TrainingSelectionTimeoutResponse() + var configuration = makeConfiguration(type: .single) + configuration.saveHandler = { request in try await response.confirm(request) } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: ["q1": ["A"], "q2": ["B"], "q3": ["A"]], lastOrder: 2) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingSelectionWindowScope(navigation) + defer { scope.close() } + try await waitUntil { model.canEdit && !manager.isShowing && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + let optionA = try #require(button("training.option.A", in: controller.view)) + let optionB = try #require(button("training.option.B", in: controller.view)) + optionA.sendActions(for: .touchUpInside) + try await waitUntil { model.hasPendingMutation && model.errorMessage != nil && self.button("training.exam.submit", in: controller.view)?.title(for: .normal) == "重试保存" } + #expect(model.canEdit && model.currentSelectedIDs == ["A"]) + #expect(optionA.accessibilityTraits.contains(.selected) && !optionB.accessibilityTraits.contains(.selected)) + #expect(!manager.isShowing && model.draftRevision == 5) + let originals = await source.savedRequests + let original = try #require(originals.first) + #expect(original.baseRevision == 5) + #expect(original.changes == [TrainingDraftChange(questionID: "q2", selectedOptionIDs: ["A"])]) + optionB.sendActions(for: .touchUpInside) + #expect(model.currentSelectedIDs == ["B"] && optionB.accessibilityTraits.contains(.selected)) + // 覆盖完整防抖窗口,确认失败的冻结请求没有被新选择偷偷换键重发。 + try await Task.sleep(for: .milliseconds(350)) + #expect(await source.savedRequests.count == 1) + #expect(model.hasPendingMutation && !manager.isShowing) + let retry = try #require(button("training.exam.submit", in: controller.view)) + #expect(retry.isEnabled && retry.isUserInteractionEnabled) + retry.sendActions(for: .touchUpInside) + try await waitUntil { model.canEdit && !model.hasPendingMutation && !model.hasUnsavedChanges && model.currentSelectedIDs == ["B"] } + let requests = await source.savedRequests + #expect(requests.count == 3) + #expect(requests[1] == original) + #expect(requests[2].baseRevision == 6 && requests[2].requestID != original.requestID) + #expect(requests[2].changes == [TrainingDraftChange(questionID: "q2", selectedOptionIDs: ["B"])]) + #expect(model.draftRevision == 7 && model.errorMessage == nil) + #expect(button("training.option.A", in: controller.view) === optionA) + #expect(button("training.option.B", in: controller.view) === optionB) + #expect(!optionA.accessibilityTraits.contains(.selected) && optionB.accessibilityTraits.contains(.selected)) + #expect(navigation.topViewController === controller) + #expect(await source.submissionRequests.isEmpty) + } + + private func makeConfiguration(type: TrainingQuestionType) -> TrainingDataStub.Configuration { + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + configuration.questionsHandler = { offset, limit in + let end = min(3, offset + limit) + let items: [TrainingQuestionItem] = offset < end ? ((offset + 1)...end).map { order in + let question = TrainingRemoteFixtures.question(order) + return TrainingQuestionItem(id: question.id, order: order, type: order == 2 ? type : .single, + stem: question.stem, options: question.options) + } : [] + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 3, offset: offset, + nextOffset: end < 3 ? end : nil, hasMore: end < 3, items: items) + } + return configuration + } + + private func makeDefaults() throws -> (name: String, defaults: UserDefaults) { + let name = "TrainingExamSelectionInteractionTests-\(UUID().uuidString)" + return (name, try #require(UserDefaults(suiteName: name))) + } + + private func makeModel(defaults: UserDefaults) -> TrainingRemoteExamViewModel { + let scope = context + return TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), currentContext: { scope }) + } + + private func allViews(_ view: UIView) -> [UIView] { + [view] + view.subviews.flatMap { allViews($0) } + } + + private func button(_ identifier: String, in view: UIView) -> UIButton? { + allViews(view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == identifier } + } + + private func waitUntil(_ condition: @MainActor () async -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !(await condition()), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + let reached = await condition() + try #require(reached) + } +} diff --git a/suixinkanTests/TrainingFeatureTests.swift b/suixinkanTests/TrainingFeatureTests.swift new file mode 100644 index 0000000..591c17a --- /dev/null +++ b/suixinkanTests/TrainingFeatureTests.swift @@ -0,0 +1,408 @@ +import Foundation +import Testing +@testable import suixinkan + +#if DEBUG +/// 所有状态均为每个测试独立创建的可失败存储。 +private final class TrainingMemoryStorage: TrainingDemoStoring, @unchecked Sendable { + private let lock = NSLock() + private var values: [String: Data] = [:] + private var writeFailure = false + + /// 模拟持久化失败,不修改原有记录。 + func failWrites(_ value: Bool) { lock.lock(); defer { lock.unlock() }; writeFailure = value } + func read(key: String) throws -> Data? { lock.lock(); defer { lock.unlock() }; return values[key] } + func write(_ data: Data, key: String) throws { + lock.lock() + defer { lock.unlock() } + if writeFailure { throw TrainingError.saveFailed } + values[key] = data + } +} + +/// 培训功能边界测试,仅 mock 数据源,不发起真实网络或提交成绩。 +@Suite("培训中心学习与答题") +@MainActor +struct TrainingFeatureTests { + private let now = Date(timeIntervalSince1970: 1_800_000_000) + private let context = TrainingContext(accountScope: "scenic_user_1001", scenicID: 10, storeID: 3) + private let storage = TrainingMemoryStorage() + + private func service(packs: [TrainingDemoPack]? = nil, date: Date? = nil, + context: TrainingContext? = nil) -> TrainingDemoService { + let date = date ?? now + let fixtures = packs ?? TrainingDemoFixtures.makePacks(now: now) + return TrainingDemoService(context: context ?? self.context, storage: storage, now: { date }, seed: { _ in fixtures }) + } + + private func readCourse(_ service: TrainingDemoService, id: String = "demo-service") async throws { + for _ in 0..) async throws { + let source = service() + try await readCourse(source) + var answers = correctAnswers + answers["q2"] = selected + let attempt = try await source.submit(taskID: "demo-service", answers: answers, submissionID: "attempt") + #expect(attempt.correctCount == 3) + #expect(attempt.scoreText == "75") + #expect(!attempt.passed) + } + + @Test("全对100分;交卷幂等,通过后不可再次提交") + func passingAndIdempotency() async throws { + let source = service() + try await readCourse(source) + let first = try await source.submit(taskID: "demo-service", answers: correctAnswers, submissionID: "same") + let repeated = try await source.submit(taskID: "demo-service", answers: correctAnswers, submissionID: "same") + #expect(first == repeated) + #expect(first.passed) + #expect(first.scoreText == "100") + let task = try await source.task(id: "demo-service") + #expect(task.progress.attempts.count == 1) + #expect(task.progress.draftAnswers.isEmpty) + #expect(task.learnerStatus == .completed) + await #expect(throws: TrainingError.self) { + try await source.submit(taskID: task.id, answers: correctAnswers, submissionID: "new") + } + } + + @Test("未通过可不限次重考,保留每次成绩") + func unlimitedRetakesAndHistory() async throws { + let source = service() + try await readCourse(source) + var wrong = correctAnswers + wrong["q1"] = ["B"] + for number in 1...6 { + let result = try await source.submit(taskID: "demo-service", answers: wrong, submissionID: "fail-\(number)") + #expect(!result.passed) + } + let before = try await source.task(id: "demo-service") + #expect(before.learnerStatus == .pendingExam) + #expect(before.progress.attempts.count == 6) + let passed = try await source.submit(taskID: before.id, answers: correctAnswers, submissionID: "pass") + #expect(passed.passed) + let after = try await source.task(id: before.id) + #expect(after.progress.attempts.count == 7) + } + + @Test("500题边界不逐题取整,小数舍去且按精确比例判断及格") + func exactPercentageScoring() async throws { + for (count, correct, passScore, score, passed) in [(100, 80, 80, "80", true), (3, 2, 67, "66.66", false), (499, 494, 99, "98.99", false), (500, 500, 100, "100", true)] { + let base = TrainingDemoFixtures.makePacks(now: now)[0].task + let questions = (0.. Int { value += 1; return value } +} + +/// 为当前页失败和恢复测试建立稀疏草稿响应。 +private enum TrainingExamDraftFixtures { + /// 仅返回请求题位范围内的答案,元信息仍覆盖完整试卷。 + static func page(total: Int, revision: Int, answers: [Int: [String]], offset: Int, limit: Int) -> TrainingDraftPage { + let orders = answers.filter { !$0.value.isEmpty }.keys.sorted() + let end = min(total, offset + limit) + let items = limit > 0 ? orders.filter { $0 > offset && $0 <= end }.map { + TrainingDraftAnswerItem(questionID: "q\($0)", order: $0, selectedOptionIDs: answers[$0] ?? []) + } : [] + return TrainingDraftPage(taskID: "task_1", paperSnapshotID: "paper_1", draftRevision: revision, + savedAt: TrainingRemoteFixtures.now, lastQuestionOrder: 1, answeredCount: orders.count, + answeredQuestionOrders: orders, total: total, offset: offset, + nextOffset: limit > 0 && end < total ? end : nil, hasMore: limit > 0 && end < total, items: items) + } +} + +/// 可在请求之间切换的业务身份,不依赖 AppStore 单例。 +@MainActor +private final class TrainingExamTestIdentity { + var context: TrainingContext? + /// 固定测试开始时的账号范围。 + init(_ context: TrainingContext) { self.context = context } +} + +/// 正式分页答题、版本保存及未知交卷恢复测试;全部使用内存网络替身。 +@Suite("培训中心正式答题与交卷恢复") +@MainActor +struct TrainingRemoteExamTests { + private let context = TrainingContext(accountScope: "exam_user", scenicID: 10, storeID: 3) + + private func makeDefaults() throws -> (name: String, defaults: UserDefaults) { + let name = "TrainingRemoteExamTests-\(UUID().uuidString)" + return (name, try #require(UserDefaults(suiteName: name))) + } + + private func makeModel(defaults: UserDefaults, identity: TrainingExamTestIdentity? = nil) -> TrainingRemoteExamViewModel { + let scope = identity?.context ?? context + return TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), debounceNanoseconds: 60_000_000_000, currentContext: { if let identity { return identity.context }; return scope }) + } + + @Test("500题恢复和随机跳题只下载所在页,已答状态来自全局题号") + func lazyPagesAndGlobalAnswers() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 500 + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 6, answers: ["q401": ["A"], "q500": ["B"]], lastOrder: 401) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + #expect(model.currentIndex == 400) + #expect(model.currentQuestion?.id == "q401") + #expect(model.currentSelectedIDs == ["A"]) + #expect(model.answeredCount == 2) + #expect(model.firstUnansweredIndex == 0) + await model.goToQuestion(499, service: source) + #expect(model.currentSelectedIDs == ["B"]) + await model.goToQuestion(400, service: source) + await model.goToQuestion(500, service: source) + #expect(model.currentIndex == 400) + let calls = await source.calls + #expect(calls.filter { $0.name == "questions" }.map(\.offset) == [400, 490]) + #expect(calls.filter { $0.name == "questions" }.allSatisfy { $0.limit == 10 }) + #expect(calls.filter { $0.name == "draft" }.map(\.limit) == [0, 10, 10]) + #expect(model.answeredQuestionOrders == [401, 500]) + } + + @Test("响应按字节预算缩页时,随机目标直接补取而不扫描全卷") + func shortPageRandomAccess() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionsHandler = { offset, _ in + let end = min(30, offset + 3) + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 30, offset: offset, + nextOffset: end < 30 ? end : nil, hasMore: end < 30, + items: ((offset + 1)...end).map(TrainingRemoteFixtures.question)) + } + configuration.draftHandler = { offset, limit in + let end = limit == 0 ? offset : min(30, offset + 3) + let items: [TrainingDraftAnswerItem] = limit > 0 && offset < 19 && end >= 19 + ? [TrainingDraftAnswerItem(questionID: "q19", order: 19, selectedOptionIDs: ["B"])] : [] + return TrainingDraftPage(taskID: "task_1", paperSnapshotID: "paper_1", draftRevision: 1, + savedAt: TrainingRemoteFixtures.now, lastQuestionOrder: 1, answeredCount: 1, + answeredQuestionOrders: [19], total: 30, offset: offset, + nextOffset: limit > 0 && end < 30 ? end : nil, hasMore: limit > 0 && end < 30, items: items) + } + configuration.saveHandler = { request in + TrainingDraftConfirmation(draftRevision: request.baseRevision, savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + let source = TrainingDataStub(configuration: configuration) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await model.goToQuestion(18, service: source) + #expect(model.currentQuestion?.id == "q19") + #expect(model.currentSelectedIDs == ["B"]) + #expect(model.firstUnansweredIndex == 0) + let calls = await source.calls + #expect(calls.filter { $0.name == "questions" }.map(\.offset) == [0, 10, 18]) + #expect(calls.filter { $0.name == "draft" && $0.limit != 0 }.map(\.offset) == [0, 10, 18]) + } + + @Test("全部已答即使只缓存一页也可交卷,不全量读取或回传草稿") + func submitSavedRevisionWithoutReadingWholeDraft() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 500 + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 15, answers: Dictionary(uniqueKeysWithValues: (1...500).map { ("q\($0)", ["A"]) })) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + #expect(model.answeredCount == 500) + #expect(model.firstUnansweredIndex == nil) + #expect(await model.submit(service: source)?.id == "attempt_1") + let requests = await source.submissionRequests + #expect(requests.count == 1) + #expect(requests.first?.draftRevision == 15) + #expect(requests.first?.paperSnapshotID == "paper_1") + let calls = await source.calls + #expect(calls.filter { $0.name == "draft" }.map(\.limit) == [0, 10]) + #expect(calls.filter { $0.name == "questions" }.count == 1) + #expect(!model.hasPendingSubmission) + #expect(model.submittedResult?.attempt.id == "attempt_1") + } + + @Test("选择仅保存一题变化且使用最新确认版本") + func incrementalSaveAndRevision() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let source = TrainingDataStub() + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect(model.draftRevision == 2) + #expect(model.answeredQuestionOrders == [1]) + await model.select(optionID: "B", service: source) + _ = await model.flushDraft(service: source) + let requests = await source.savedRequests + #expect(requests.map(\.baseRevision) == [1, 2]) + #expect(requests.allSatisfy { $0.changes.count == 1 && $0.changes.first?.questionID == "q1" }) + #expect(requests.last?.changes.first?.selectedOptionIDs == ["B"]) + #expect(requests[0].requestID != requests[1].requestID) + #expect(model.currentSelectedIDs == ["B"]) + #expect(model.answeredCount == 1) + } + + @Test("多选切换提交规范化集合,取消一项不丢失其它选择") + func multipleChoiceIncrementalToggle() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionsHandler = { offset, limit in + let end = min(30, offset + limit) + let questions = ((offset + 1)...end).map { order -> TrainingQuestionItem in + let original = TrainingRemoteFixtures.question(order) + return TrainingQuestionItem(id: original.id, order: order, type: order == 1 ? .multiple : .single, + stem: original.stem, options: original.options) + } + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 30, offset: offset, + nextOffset: end < 30 ? end : nil, hasMore: end < 30, items: questions) + } + let source = TrainingDataStub(configuration: configuration) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + await model.select(optionID: "B", service: source) + _ = await model.flushDraft(service: source) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect(model.currentSelectedIDs == ["B"]) + #expect((await source.savedRequests).map { $0.changes.first?.selectedOptionIDs } == [["A"], ["A", "B"], ["B"]]) + #expect(model.answeredCount == 1) + } + + @Test("保存超时保留本机选择,重试原请求后再保存较新的改选") + func saveFailureRetainsOriginalRequest() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let counter = TrainingExamFailureCounter() + var configuration = TrainingDataStub.Configuration() + configuration.saveHandler = { request in + if await counter.next() == 1 { throw URLError(.timedOut) } + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + let source = TrainingDataStub(configuration: configuration) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect(model.hasPendingMutation) + #expect(model.canEdit) + #expect(model.currentSelectedIDs == ["A"]) + await model.select(optionID: "B", service: source) + _ = await model.flushDraft(service: source) + #expect(await source.savedRequests.count == 1) + await model.retryMutation(service: source) + let requests = await source.savedRequests + #expect(requests.count == 3) + #expect(requests[0] == requests[1]) + #expect(requests[2].baseRevision == requests[1].baseRevision + 1) + #expect(requests[2].changes.first?.selectedOptionIDs == ["B"]) + #expect(model.currentSelectedIDs == ["B"]) + #expect(!model.hasPendingMutation) + } + + @Test("版本冲突读取权威草稿并保留本机意图,明确确认前不覆盖其他设备") + func conflictRefreshesCurrentPage() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let source = TrainingDataStub() + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await source.seedDraft(revision: 8, answers: ["q1": ["B"], "q10": ["A"]]) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect(model.draftRevision == 8) + #expect(model.currentSelectedIDs == ["A"]) + #expect(model.answeredCount == 2) + #expect(model.errorMessage != nil) + #expect(model.hasPendingMutation) + #expect(model.hasDraftConflict) + #expect(await source.savedRequests.count == 1) + let calls = await source.calls + #expect(calls.filter { $0.name == "draft" }.map(\.limit) == [0, 10, 0, 10]) + } + + @Test("重置超时沿原键恢复,成功响应含新答案时不盲清") + func resetRetryUsesCurrentDraftState() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let counter = TrainingExamFailureCounter() + var configuration = TrainingDataStub.Configuration() + configuration.resetHandler = { _ in + if await counter.next() == 1 { throw URLError(.networkConnectionLost) } + return TrainingDraftConfirmation(draftRevision: 5, savedAt: TrainingRemoteFixtures.now, answeredCount: 1) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 3, answers: ["q1": ["A"]]) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source, resetDraft: true) + #expect(model.hasPendingMutation) + await source.seedDraft(revision: 5, answers: ["q1": ["B"]]) + await model.retryMutation(service: source) + let requests = await source.resetRequests + #expect(requests.count == 2) + #expect(requests[0] == requests[1]) + #expect(model.draftRevision == 5) + #expect(model.currentSelectedIDs == ["B"]) + #expect(model.answeredQuestionOrders == [1]) + #expect(!model.hasPendingMutation) + } + + @Test("未知交卷跨页面重建恢复;查询0条重试原请求,通过后也可找回原成绩") + func durableUnknownSubmissionRecovery() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + configuration.submitHandler = { _ in throw URLError(.timedOut) } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 7, answers: ["q1": ["A"], "q2": ["A"], "q3": ["A"]]) + let first = makeModel(defaults: domain.defaults) + await first.load(service: source) + #expect(await first.submit(service: source) == nil) + #expect(first.hasPendingSubmission) + #expect(!first.canEdit) + let stored = try TrainingPendingSubmissionStore(defaults: domain.defaults).load(taskID: "task_1", context: context) + let saved = try #require(stored) + + let second = makeModel(defaults: domain.defaults) + await second.load(service: source) + #expect(second.hasPendingSubmission) + let requests = await source.submissionRequests + #expect(requests.count == 2) + #expect(requests[0] == requests[1]) + #expect(requests[1] == saved.request) + + await source.configure { + $0.progressHandler = { _ in TrainingRemoteFixtures.progress(completed: true) } + $0.attemptsHandler = { _, _, _ in + TrainingCursorPage(items: [TrainingRemoteFixtures.attempt()], nextCursor: nil, hasMore: false, serverTime: nil) + } + } + let restored = makeModel(defaults: domain.defaults) + await restored.load(service: source) + #expect(restored.submittedAttempt?.id == "attempt_1") + #expect(restored.submittedResult?.taskState.canRetry == false) + #expect(!restored.hasPendingSubmission) + #expect(await source.submissionRequests.count == 2) + #expect(try TrainingPendingSubmissionStore(defaults: domain.defaults).load(taskID: "task_1", context: context) == nil) + } + + @Test("账号景区店铺隔离待确认请求,身份切换不消费旧账号记录") + func pendingScopeAndIdentityIsolation() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let store = TrainingPendingSubmissionStore(defaults: domain.defaults) + let pending = TrainingPendingSubmission(taskID: "task_1", request: TrainingSubmissionRequest(submissionID: "original", paperSnapshotID: "paper_1", draftRevision: 4), context: context) + try store.save(pending) + for different in [TrainingContext(accountScope: "other", scenicID: 10, storeID: 3), + TrainingContext(accountScope: context.accountScope, scenicID: 11, storeID: 3), + TrainingContext(accountScope: context.accountScope, scenicID: 10, storeID: 4)] { + #expect(try store.load(taskID: "task_1", context: different) == nil) + } + let identity = TrainingExamTestIdentity(TrainingContext(accountScope: "other", scenicID: 10, storeID: 3)) + let source = TrainingDataStub() + await source.seedDraft(revision: 2, answers: ["q1": ["B"]]) + let model = makeModel(defaults: domain.defaults, identity: identity) + await model.load(service: source) + #expect(model.currentQuestion?.id == "q1") + #expect(model.currentSelectedIDs == ["B"]) + #expect(!model.hasPendingSubmission) + #expect(!(await source.calls).contains { $0.name == "attempts" || $0.name == "submit" }) + #expect(try store.load(taskID: "task_1", context: context) == pending) + identity.context = context + await model.validateIdentity() + #expect(model.isIdentityInvalid) + #expect(model.shouldReturnToCenter) + #expect(model.currentQuestion == nil) + #expect(model.currentSelectedIDs.isEmpty) + #expect(model.task == nil && model.progress == nil && model.paper == nil) + #expect(model.answeredQuestionOrders.isEmpty) + #expect(!model.canEdit) + #expect(try store.load(taskID: "task_1", context: context) == pending) + + var failedConfiguration = TrainingDataStub.Configuration() + failedConfiguration.submitHandler = { _ in throw URLError(.timedOut) } + let failed = TrainingDataStub(configuration: failedConfiguration) + identity.context = context + let original = makeModel(defaults: domain.defaults, identity: identity) + await original.load(service: failed) + #expect(original.hasPendingSubmission) + identity.context = TrainingContext(accountScope: "other", scenicID: 10, storeID: 3) + _ = await original.submit(service: failed) + #expect(original.isIdentityInvalid) + #expect(original.shouldReturnToCenter) + #expect(original.currentQuestion == nil) + #expect(await failed.submissionRequests.count == 1) + #expect(try store.load(taskID: "task_1", context: context) == pending) + } + + @Test("同任务页面不能覆盖待确认记录,交卷前优先恢复已有持久化键") + func existingPendingRequestCannotBeOverwritten() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + configuration.submitHandler = { _ in throw URLError(.timedOut) } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 9, answers: ["q1": ["A"], "q2": ["A"], "q3": ["A"]]) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + let store = TrainingPendingSubmissionStore(defaults: domain.defaults) + let pending = TrainingPendingSubmission(taskID: "task_1", + request: TrainingSubmissionRequest(submissionID: "original", paperSnapshotID: "paper_1", draftRevision: 9), context: context) + try store.save(pending) + let replacement = TrainingPendingSubmission(taskID: "task_1", + request: TrainingSubmissionRequest(submissionID: "replacement", paperSnapshotID: "paper_1", draftRevision: 9), context: context) + #expect(throws: TrainingPendingSubmissionError.alreadyPending) { try store.save(replacement) } + #expect(await model.submit(service: source) == nil) + #expect(await source.submissionRequests == [pending.request]) + #expect(try store.load(taskID: "task_1", context: context) == pending) + } + + @Test("服务端已完成或已结束资格阻止读取试卷和新的交卷", arguments: [TrainingLearnerStatus.completed, .ended]) + func completedGatePreventsNewSubmission(status: TrainingLearnerStatus) async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.progressHandler = { _ in TrainingRemoteFixtures.progress(completed: status == .completed, learnerStatus: status) } + let source = TrainingDataStub(configuration: configuration) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + #expect(!model.canEdit) + #expect(await model.submit(service: source) == nil) + #expect(!(await source.calls).contains { $0.name == "paper" || $0.name == "questions" || $0.name == "submit" }) + } + + @Test("明确漏答业务拒绝释放待确认请求,并恢复最新漏答题号") + func definiteRejectionReleasesPendingSubmission() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 4, answers: ["q1": ["A"], "q2": ["A"], "q3": ["A"]]) + await source.configure { + $0.submitHandler = { request in + await source.seedDraft(revision: request.draftRevision, answers: ["q1": ["A"], "q2": ["A"]]) + throw TrainingRemoteError.answerIncomplete("第3题尚未作答") + } + } + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + #expect(await model.submit(service: source) == nil) + #expect(!model.hasPendingSubmission) + #expect(model.answeredCount == 2) + #expect(model.firstUnansweredIndex == 2) + #expect(try TrainingPendingSubmissionStore(defaults: domain.defaults).load(taskID: "task_1", context: context) == nil) + } + + @Test("题目成功而草稿页失败时禁止编辑,多选恢复后保留原B再加入A") + func failedDraftPageCannotOverwriteUnloadedAnswers() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let counter = TrainingExamFailureCounter() + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 20 + configuration.questionsHandler = { offset, limit in + let end = min(20, offset + limit) + let items = ((offset + 1)...end).map { order -> TrainingQuestionItem in + let original = TrainingRemoteFixtures.question(order) + return TrainingQuestionItem(id: original.id, order: order, type: order == 11 ? .multiple : .single, + stem: original.stem, options: original.options) + } + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 20, offset: offset, + nextOffset: end < 20 ? end : nil, hasMore: end < 20, items: items) + } + configuration.draftHandler = { offset, limit in + if offset == 10, limit > 0, await counter.next() == 1 { throw URLError(.timedOut) } + return TrainingExamDraftFixtures.page(total: 20, revision: 3, answers: [1: ["A"], 11: ["B"]], offset: offset, limit: limit) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 3, answers: ["q1": ["A"], "q11": ["B"]]) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await model.goToQuestion(10, service: source) + #expect(model.currentQuestion?.id == "q11") + #expect(!model.isCurrentPageReady) + #expect(!model.canEdit) + #expect(model.canRetryCurrentPage) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect(await source.savedRequests.isEmpty) + await model.retryCurrentPage(service: source) + #expect(model.currentSelectedIDs == ["B"]) + #expect(model.canEdit) + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect((await source.savedRequests).last?.changes.first?.selectedOptionIDs == ["A", "B"]) + await model.goToQuestion(0, service: source) + #expect(model.currentSelectedIDs == ["A"]) + #expect((await source.calls).filter { $0.name == "draft" && $0.offset == 0 }.count == 2) + } + + @Test("冲突后元信息刷新断网仍有当前页重试入口,不会永久锁页") + func conflictRefreshFailureCanRetryCurrentPage() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let source = TrainingDataStub() + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + await source.seedDraft(revision: 8, answers: ["q1": ["B"]]) + let counter = TrainingExamFailureCounter() + await source.configure { + $0.draftHandler = { offset, limit in + if await counter.next() == 1 { throw URLError(.networkConnectionLost) } + return TrainingExamDraftFixtures.page(total: 30, revision: 8, answers: [1: ["B"]], offset: offset, limit: limit) + } + } + await model.select(optionID: "A", service: source) + _ = await model.flushDraft(service: source) + #expect(!model.canEdit) + #expect(model.canRetryCurrentPage) + #expect(model.hasPendingMutation) + await model.retryCurrentPage(service: source) + #expect(model.currentSelectedIDs == ["A"]) + #expect(model.hasDraftConflict) + #expect(model.draftRevision == 8) + #expect(model.canEdit) + #expect(await source.savedRequests.count == 1) + } + + @Test("交卷成功时考试页被覆盖,返回后仍直接进入已有成绩") + func coveredExamPresentsCompletedResultWhenVisibleAgain() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 2, answers: ["q1": ["A"], "q2": ["A"], "q3": ["A"]]) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !model.canEdit, ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + #expect(model.canEdit) + try await settleTransitions(in: navigation) + let covering = UIViewController() + navigation.pushViewController(covering, animated: false) + try await settleTransitions(in: navigation) + #expect(await model.submit(service: source)?.id == "attempt_1") + #expect(navigation.topViewController === covering) + navigation.popViewController(animated: true) + let resultDeadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !(navigation.topViewController is TrainingResultViewController), ContinuousClock.now < resultDeadline { + try await Task.sleep(for: .milliseconds(10)) + } + try await settleTransitions(in: navigation) + #expect(navigation.topViewController is TrainingResultViewController) + #expect(!(await source.calls).contains { $0.name == "attempt" }) + } + + @Test("身份切换后返回考试页清理旧数据并退出根页面,保留未知交卷键") + func changedIdentityReturnsToRootWithoutConsumingSubmission() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.questionCount = 3 + configuration.submitHandler = { _ in throw URLError(.timedOut) } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 2, answers: ["q1": ["A"], "q2": ["A"], "q3": ["A"]]) + let identity = TrainingExamTestIdentity(context) + let model = makeModel(defaults: domain.defaults, identity: identity) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let root = UIViewController() + let center = TrainingCenterViewController(service: source) + let navigation = UINavigationController() + navigation.setViewControllers([root, center, controller], animated: false) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !model.canEdit, ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + #expect(model.canEdit) + try await settleTransitions(in: navigation) + let covering = UIViewController() + navigation.pushViewController(covering, animated: false) + try await settleTransitions(in: navigation) + #expect(await model.submit(service: source) == nil) + let store = TrainingPendingSubmissionStore(defaults: domain.defaults) + let stored = try store.load(taskID: "task_1", context: context) + let pending = try #require(stored) + identity.context = TrainingContext(accountScope: "other", scenicID: 10, storeID: 3) + navigation.popViewController(animated: true) + let exitDeadline = ContinuousClock.now.advanced(by: .seconds(3)) + while navigation.topViewController !== root, ContinuousClock.now < exitDeadline { + try await Task.sleep(for: .milliseconds(10)) + } + try await settleTransitions(in: navigation) + #expect(navigation.topViewController === root) + #expect(model.isIdentityInvalid && model.shouldReturnToCenter) + #expect(model.currentQuestion == nil && model.submittedAttempt == nil) + #expect(try store.load(taskID: "task_1", context: context) == pending) + #expect(await source.submissionRequests.count == 1) + } + + private func makeWindow(_ navigation: UINavigationController) throws -> UIWindow { + let scene = try #require(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first) + let window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + window.rootViewController = navigation + navigation.beginAppearanceTransition(true, animated: false) + window.isHidden = false + navigation.endAppearanceTransition() + navigation.view.layoutIfNeeded() + return window + } + + private func settleTransitions(in navigation: UINavigationController) async throws { + // 非动画栈替换也可能在当前 main loop 中尚未结束。 + try await Task.sleep(for: .milliseconds(20)) + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while navigation.transitionCoordinator != nil, ContinuousClock.now < deadline { + try await Task.sleep(for: .milliseconds(10)) + } + #expect(navigation.transitionCoordinator == nil) + } + + @Test("再次加载重考页刷新资格但不重复清稿") + func returningExamDoesNotRepeatInitialReset() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let source = TrainingDataStub() + await source.seedDraft(revision: 3, answers: ["q1": ["A"]]) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source, resetDraft: true) + await model.select(optionID: "B", service: source) + _ = await model.flushDraft(service: source) + await model.load(service: source, resetDraft: true) + #expect(await source.resetRequests.count == 1) + #expect(model.currentSelectedIDs == ["B"]) + } + + @Test("未知交卷恢复遇权限拒绝请求退出考试,但保留原持久化提交键") + func forbiddenRecoveryRetainsOriginalSubmission() async throws { + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + var configuration = TrainingDataStub.Configuration() + configuration.submitHandler = { _ in throw TrainingRemoteError.forbidden("任务暂不可访问") } + let source = TrainingDataStub(configuration: configuration) + let store = TrainingPendingSubmissionStore(defaults: domain.defaults) + let pending = TrainingPendingSubmission(taskID: "task_1", + request: TrainingSubmissionRequest(submissionID: "original", paperSnapshotID: "paper_1", draftRevision: 3), context: context) + try store.save(pending) + let model = makeModel(defaults: domain.defaults) + await model.load(service: source) + #expect(model.shouldReturnToCenter) + #expect(model.hasPendingSubmission) + #expect(try store.load(taskID: "task_1", context: context) == pending) + #expect(await source.submissionRequests == [pending.request]) + } +} diff --git a/suixinkanTests/TrainingRemoteListTests.swift b/suixinkanTests/TrainingRemoteListTests.swift new file mode 100644 index 0000000..25497aa --- /dev/null +++ b/suixinkanTests/TrainingRemoteListTests.swift @@ -0,0 +1,121 @@ +import Foundation +import Testing +@testable import suixinkan + +/// 任务和成绩的分页、请求边界与缓存复用回归。 +@Suite("正式培训摘要与解析") +struct TrainingRemoteListTests { + @Test("首页只请求概览与三条任务摘要") + func homeUsesSmallResources() async { + let source = TrainingDataStub() + await source.configure { + $0.tasksHandler = { status, _, cursor, limit in + #expect(status == .pendingExam) + #expect(cursor == nil) + #expect(limit == 3) + return TrainingCursorPage(items: [TrainingRemoteFixtures.task()], nextCursor: nil, hasMore: false, serverTime: nil) + } + } + let model = TrainingRemoteCenterViewModel() + await model.load(service: source) + let calls = await source.calls + #expect(Set(calls.map(\.name)) == Set(["summary", "tasks"])) + #expect(calls.first { $0.name == "tasks" }?.limit == 3) + #expect(model.tasks.count == 1) + #expect(model.latestScore == "—") + } + + @Test("任务筛选传给服务端,用户翻页才消费游标", arguments: [TrainingLearnerStatus.completed, .ended]) + func serverFilteringAndPagination(status expectedStatus: TrainingLearnerStatus) async { + let source = TrainingDataStub() + await source.configure { + $0.tasksHandler = { status, keyword, cursor, _ in + #expect(status == expectedStatus) + #expect(keyword == "服务") + return TrainingCursorPage(items: [TrainingRemoteFixtures.task(id: cursor == nil ? "first" : "second", learnerStatus: expectedStatus)], nextCursor: cursor == nil ? "next" : nil, hasMore: cursor == nil, serverTime: nil) + } + } + let model = TrainingRemoteCenterViewModel() + model.selectTab(.tasks) + model.filter = expectedStatus + model.keyword = " 服务 " + await model.load(service: source) + #expect(model.tasks.map(\.id) == ["first"]) + #expect(model.hasMore) + await model.loadMore(service: source) + #expect(model.tasks.map(\.id) == ["first", "second"]) + #expect(model.tasks.allSatisfy { $0.learnerStatus == expectedStatus }) + #expect(!model.hasMore) + #expect(await source.calls.count == 3) + } + + @Test("记录页不读取任务、试卷或课程") + func recordsAreIndependent() async { + let source = TrainingDataStub() + let model = TrainingRemoteCenterViewModel() + model.selectTab(.records) + await model.load(service: source) + #expect(Set(await source.calls.map(\.name)) == Set(["summary", "attempts"])) + } + + @Test("成绩首屏不预取解析,展开后只取一页并复用") + func reviewsAreLazyAndCached() async { + let source = TrainingDataStub() + let model = TrainingRemoteResultViewModel(attemptID: "attempt_1") + await model.load(service: source) + #expect(await source.calls.map(\.name) == ["attempt"]) + #expect(model.reviews.isEmpty) + await model.loadReviews(service: source) + await model.loadReviews(service: source) + #expect(model.reviews.count == 1) + #expect(await source.calls.filter { $0.name == "reviews" }.count == 1) + } + + @Test("解析失败保留成绩并能重试") + func reviewsFailureDoesNotHideScore() async { + let source = TrainingDataStub() + await source.configure { $0.reviewsHandler = { _ in throw APIError.networkFailed("离线") } } + let model = TrainingRemoteResultViewModel(attemptID: "attempt_1") + await model.load(service: source) + await model.loadReviews(service: source) + #expect(model.detail != nil) + #expect(model.reviewErrorMessage != nil) + await source.configure { $0.reviewsHandler = nil } + await model.loadReviews(service: source) + #expect(model.hasLoadedReviews) + } + + @Test("刷新成绩后解析不可用时移除此前缓存") + func reviewAvailabilityClearsCachedPages() async { + let source = TrainingDataStub() + let model = TrainingRemoteResultViewModel(attemptID: "attempt_1") + await model.load(service: source) + await model.loadReviews(service: source) + #expect(!model.reviews.isEmpty) + await source.configure { $0.attemptHandler = { _ in TrainingRemoteFixtures.result(reviewAvailable: false) } } + await model.load(service: source) + #expect(model.detail != nil) + #expect(model.reviews.isEmpty) + #expect(!model.hasLoadedReviews) + await model.loadReviews(service: source) + #expect(await source.calls.filter { $0.name == "reviews" }.count == 1) + } + + @Test("身份变化或权限撤回后清空已缓存成绩与解析", arguments: [TrainingRemoteError.identityChanged, .forbidden("任务权限已撤回")]) + func identityChangeClearsCachedResult(error: TrainingRemoteError) async { + let source = TrainingDataStub() + await source.configure { $0.reviewsHandler = { _ in + TrainingReviewPage(attemptID: "attempt_1", items: [TrainingRemoteFixtures.review()], nextCursor: "next", hasMore: true) + } } + let model = TrainingRemoteResultViewModel(attemptID: "attempt_1") + await model.load(service: source) + await model.loadReviews(service: source) + #expect(!model.reviews.isEmpty) + await source.configure { $0.reviewsHandler = { _ in throw error } } + await model.loadReviews(service: source, nextPage: true) + #expect(model.isIdentityInvalid == (error == .identityChanged)) + #expect(model.isAccessRevoked == (error.code == 150101)) + #expect(model.detail == nil) + #expect(model.reviews.isEmpty) + } +} diff --git a/suixinkanTests/TrainingRemoteReadingTests.swift b/suixinkanTests/TrainingRemoteReadingTests.swift new file mode 100644 index 0000000..1edf39b --- /dev/null +++ b/suixinkanTests/TrainingRemoteReadingTests.swift @@ -0,0 +1,957 @@ +import Foundation +import Testing +@testable import suixinkan + +/// 正式课程的按需资源、前台计时和幂等恢复;只使用内存替身,不修改真实学员记录。 +@Suite("正式培训课程与读时") +@MainActor +struct TrainingRemoteReadingTests { + private func source(seconds: Int = 0) -> TrainingDataStub { + var configuration = TrainingDataStub.Configuration() + configuration.readingSeconds = seconds + return TrainingDataStub(configuration: configuration) + } + + private func model(_ source: TrainingDataStub) -> TrainingRemoteReadingViewModel { + TrainingRemoteReadingViewModel(taskID: "task_1", service: source, now: { TrainingRemoteFixtures.now }) + } + + private func bind(_ server: TrainingReadingReplyController, to source: TrainingDataStub) async { + await source.configure { + $0.progressHandler = { _ in await server.progress() } + $0.startReadingHandler = { try await server.create(requestID: $0) } + $0.heartbeatHandler = { try await server.confirm($0) } + } + } + + private func loadRendered(_ model: TrainingRemoteReadingViewModel) async { + await model.load() + if let id = model.currentAttachmentID, let previewID = model.attachmentPreviewID { + #expect(model.markAttachmentRendered(id: id, previewID: previewID)) + } + } + + @Test("已结束任务可加载附件回顾,但不建立学习会话或上报读时") + func endedTaskIsReadOnly() async { + let source = source(seconds: 0) + await source.configure { + $0.taskHandler = { _ in + TrainingTaskDetail(summary: TrainingRemoteFixtures.task(readingCompleted: false, learnerStatus: .ended), + requiredReadingSeconds: 20, readingRule: "course_duration", scoring: "equal-percentage-v1", serverTime: TrainingRemoteFixtures.now) + } + $0.progressHandler = { _ in TrainingRemoteFixtures.progress(seconds: 0, learnerStatus: .ended) } + } + let model = model(source) + await loadRendered(model) + #expect(model.currentAttachmentLink != nil) + #expect(model.isAttachmentRendered) + #expect(!model.canStudy) + await model.startReading(at: 0) + await model.recordVisibleTime(at: 10) + #expect(!model.isReading) + #expect(!(await source.calls).contains { ["startReading", "heartbeat"].contains($0.name) }) + #expect(await source.heartbeats.isEmpty) + } + + /// 首屏只读取一页附件并授权首项,不请求已经停用的小节 HTML。 + @Test("首次仅请求附件第一页并授权首项,不加载小节 HTML") + func lazyCourseResources() async { + let source = source() + await source.configure { + $0.courseHandler = { TrainingCourseInfo(id: "course_1", title: "课程", introduction: "简介", sectionCount: 100, attachmentCount: 20) } + $0.attachmentsHandler = { _ in + TrainingCursorPage(items: (1...20).map { TrainingRemoteFixtures.attachment(id: "file_\($0)") }, + nextCursor: "next", hasMore: true, serverTime: nil) + } + } + let model = model(source) + await model.load() + let calls = await source.calls + #expect(model.attachments.count == 20) + #expect(model.currentAttachmentID == "file_1") + #expect(model.currentAttachmentLink?.id == "file_1") + #expect(calls.filter { $0.name == "attachments" }.count == 1) + #expect(calls.first { $0.name == "attachments" }?.limit == 20) + #expect(calls.filter { $0.name == "attachmentURL" }.map(\.resourceID) == ["file_1"]) + #expect(!calls.contains { ["sections", "section", "paper", "questions", "draft", "attempts"].contains($0.name) }) + #expect(!model.isAttachmentRendered) + } + + /// 倒计时本地刷新,五秒合并网络上报,最后一个片段关闭会话。 + @Test("每五秒上报且门槛由后端确认,完成后停止会话") + func batchedHeartbeatAndCompletion() async { + let source = source() + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...4 { await model.recordVisibleTime(at: Double(second)) } + #expect(await source.heartbeats.isEmpty) + #expect(model.progress?.readingSeconds == 0) + for second in 5...20 { await model.recordVisibleTime(at: Double(second)) } + let calls = await source.heartbeats + #expect(calls.map(\.activeSecondsTotal) == [5, 10, 15, 20]) + #expect(calls.map(\.sequence) == [1, 2, 3, 4]) + #expect(calls.last?.final == true) + #expect(model.progress?.readingCompleted == true) + #expect(!model.isReading) + #expect(model.remainingSeconds == 0) + } + + /// 滚动每帧重新确认正文可见,不能重置已经运行的整秒计时片段。 + @Test("持续滚动十秒仍正常倒计时,只按五秒间隔上报") + func continuousScrollingPreservesReadingTime() async { + let source = source() + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for frame in 1...600 { + let uptime = Double(frame) / 60 + await model.startReading(at: uptime) + if frame.isMultiple(of: 15) { await model.recordVisibleTime(at: uptime) } + } + #expect(model.isReading) + #expect(model.activeSecondsTotal == 10) + #expect(model.remainingSeconds == 10) + #expect(model.progress?.readingSeconds == 10) + #expect(await source.startReadingRequests.count == 1) + let heartbeats = await source.heartbeats + #expect(heartbeats.map(\.activeSecondsTotal) == [5, 10]) + #expect(heartbeats.map(\.sequence) == [1, 2]) + #expect(heartbeats.allSatisfy { !$0.final }) + } + + /// 请求等待响应期间,本地倒计时继续;迟到确认不能覆盖后续可见读时。 + @Test("五秒心跳挂起时继续累计到八秒,确认后倒计时不回跳") + func slowHeartbeatDoesNotBlockLocalCountdown() async { + let source = source() + let gate = TrainingReadingHeartbeatGate() + await source.configure { $0.heartbeatHandler = { await gate.confirm($0) } } + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...4 { await model.recordVisibleTime(at: Double(second)) } + let operation = Task { await model.recordVisibleTime(at: 5) } + await gate.waitUntilRequested() + for second in 6...8 { #expect(model.accumulateVisibleTime(at: Double(second))) } + #expect(model.activeSecondsTotal == 8) + #expect(model.remainingSeconds == 12) + #expect(model.progress?.readingSeconds == 0) + #expect(!model.needsReadingFlush) + #expect(await source.heartbeats.count == 1) + await gate.release() + await operation.value + #expect(model.activeSecondsTotal == 8) + #expect(model.remainingSeconds == 12) + #expect(model.progress?.readingSeconds == 5) + #expect(!model.needsReadingFlush) + #expect(model.accumulateVisibleTime(at: 9)) + #expect(!model.needsReadingFlush) + #expect(model.accumulateVisibleTime(at: 10)) + #expect(model.needsReadingFlush) + await model.flush() + let heartbeats = await source.heartbeats + #expect(heartbeats.map(\.activeSecondsTotal) == [5, 10]) + #expect(heartbeats.map(\.sequence) == [1, 2]) + #expect(heartbeats.allSatisfy { !$0.final }) + #expect(model.activeSecondsTotal == 10) + #expect(model.remainingSeconds == 10) + #expect(model.progress?.readingSeconds == 10) + #expect(await source.startReadingRequests.count == 1) + } + + /// 慢请求已经提交但丢响应时,后续本地读时不能混入同序号重试负载。 + @Test("慢心跳丢响应后冻结五秒负载重试,后续读时使用新序号") + func slowHeartbeatResponseLossKeepsFrozenPayload() async { + let source = source() + let server = TrainingReadingReplyController(loseHeartbeatResponse: true) + let gate = TrainingReadingHeartbeatGate() + await bind(server, to: source) + await source.configure { $0.heartbeatHandler = { call in + _ = await gate.confirm(call) + return try await server.confirm(call) + } } + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...4 { await model.recordVisibleTime(at: Double(second)) } + let operation = Task { await model.recordVisibleTime(at: 5) } + await gate.waitUntilRequested() + for second in 6...8 { #expect(model.accumulateVisibleTime(at: Double(second))) } + await gate.release() + await operation.value + #expect(model.readingErrorMessage != nil) + #expect(!model.isReading) + #expect(model.activeSecondsTotal == 8) + #expect(model.remainingSeconds == 12) + #expect(!model.needsReadingFlush) + #expect(!model.accumulateVisibleTime(at: 9)) + await model.flush() + let retried = await source.heartbeats + #expect(retried.count == 2) + #expect(retried[0] == retried[1]) + #expect(retried[0].activeSecondsTotal == 5 && !retried[0].final) + #expect(model.progress?.readingSeconds == 5) + #expect(model.activeSecondsTotal == 8) + #expect(model.remainingSeconds == 12) + await model.startReading(at: 100) + #expect(model.accumulateVisibleTime(at: 101)) + #expect(model.accumulateVisibleTime(at: 102)) + #expect(model.needsReadingFlush) + await model.flush() + let heartbeats = await source.heartbeats + #expect(heartbeats.map(\.activeSecondsTotal) == [5, 5, 10]) + #expect(heartbeats.map(\.sequence) == [1, 1, 2]) + #expect(model.progress?.readingSeconds == 10) + #expect(model.remainingSeconds == 10) + #expect(await source.startReadingRequests.count == 1) + } + + /// 首次建会话期间到达的重复恢复,等待完成后也不能覆盖首个计时起点。 + @Test("并发恢复等待同一会话,返回后不重置正在运行的时钟") + func concurrentResumesPreserveFirstReadingStart() async { + let source = source() + let server = TrainingReadingReplyController() + let gate = TrainingReadingSessionGate() + await bind(server, to: source) + await source.configure { $0.startReadingHandler = { requestID in + let session = try await server.create(requestID: requestID) + await gate.wait() + return session + } } + let model = model(source) + await loadRendered(model) + let starting = Task { await model.startReading(at: 0) } + await gate.waitUntilRequested() + let probes = (0..<3).map { _ in TrainingReadingResumeProbe() } + let repeated = probes.map { probe in + Task { + probe.started = true + await model.startReading(at: 0.75) + probe.finished = true + } + } + while probes.contains(where: { !$0.started }) { await Task.yield() } + #expect(probes.allSatisfy { !$0.finished }) + #expect(await source.startReadingRequests.count == 1) + await gate.release() + await starting.value + for operation in repeated { await operation.value } + await model.recordVisibleTime(at: 1) + #expect(model.isReading) + #expect(model.activeSecondsTotal == 1) + #expect(model.remainingSeconds == 19) + #expect(await source.startReadingRequests.count == 1) + #expect(await source.heartbeats.isEmpty) + } + + /// 已保存读时不混入会话累计;不足五秒的门槛片段也即时确认。 + @Test("历史十二秒加新会话八秒,心跳总数仍从零开始") + func historyAndSessionAreSeparate() async { + let source = source(seconds: 12) + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...8 { await model.recordVisibleTime(at: Double(second)) } + let calls = await source.heartbeats + #expect(calls.map(\.activeSecondsTotal) == [5, 8]) + #expect(calls.last?.final == true) + #expect(model.progress?.readingSeconds == 20) + #expect(model.progress?.readingCompleted == true) + } + + /// 后台间隔与未满秒片段均不补算,重开会话使用独立序号和累计秒数。 + @Test("暂停后长时间停留不补读时,恢复会话从零计时") + func pauseDoesNotCountBackgroundTime() async { + let source = source() + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...3 { await model.recordVisibleTime(at: Double(second)) } + model.pauseReading() + await model.flush() + await model.recordVisibleTime(at: 999) + await model.startReading(at: 1000) + await model.recordVisibleTime(at: 1000.5) + await model.recordVisibleTime(at: 1001) + await model.recordVisibleTime(at: 1002) + model.pauseReading() + await model.flush() + let calls = await source.heartbeats + #expect(calls.map(\.activeSecondsTotal) == [3, 2]) + #expect(calls.map(\.sequence) == [1, 1]) + #expect(calls.allSatisfy { $0.final }) + #expect(calls[0].sessionID != calls[1].sessionID) + #expect(model.progress?.readingSeconds == 5) + } + + /// 创建已成功但响应丢失时,同一创建键恢复原会话。 + @Test("创建会话丢响应重试沿用 requestID") + func createResponseLossUsesSameRequestID() async { + let source = source() + let server = TrainingReadingReplyController(loseCreateResponse: true) + await bind(server, to: source) + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + #expect(model.readingErrorMessage != nil) + await model.startReading(at: 10) + let requests = await source.startReadingRequests + #expect(requests.count == 2) + #expect(requests[0] == requests[1]) + #expect(model.isReading) + #expect(model.activeSecondsTotal == 0) + } + + /// 服务端已接受的普通心跳丢响应,不能改变序号或负载再次累计。 + @Test("心跳丢响应同序号同负载重试,不重复增记") + func heartbeatResponseLossIsIdempotent() async { + let source = source() + let server = TrainingReadingReplyController(loseHeartbeatResponse: true) + await bind(server, to: source) + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...5 { await model.recordVisibleTime(at: Double(second)) } + #expect(model.progress?.readingSeconds == 0) + await model.flush() + let calls = await source.heartbeats + #expect(calls.count == 2) + #expect(calls[0] == calls[1]) + #expect(calls[0].final == false) + #expect(model.progress?.readingSeconds == 5) + #expect(await server.progress().readingSeconds == 5) + } + + /// 最终关闭请求同样冻结 final 和累计秒数,重试不能改成普通心跳。 + @Test("final 关闭丢响应保持原 final 负载,之后使用新会话") + func finalResponseLossKeepsPayload() async { + let source = source() + let server = TrainingReadingReplyController(loseHeartbeatResponse: true) + await bind(server, to: source) + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...3 { await model.recordVisibleTime(at: Double(second)) } + model.pauseReading() + await model.flush() + #expect(model.readingErrorMessage != nil) + await model.flush(final: true) + let calls = await source.heartbeats + #expect(calls.count == 2) + #expect(calls[0] == calls[1]) + #expect(calls[0].final) + #expect(model.progress?.readingSeconds == 3) + await model.startReading(at: 100) + let requests = await source.startReadingRequests + #expect(requests.count == 2) + #expect(requests[0] != requests[1]) + #expect(model.activeSecondsTotal == 0) + } + + /// 慢请求中新增读时先留在本地,暂停后确认旧负载,再以新序号关闭全部片段。 + @Test("普通心跳请求中继续累计后暂停,确认旧负载再 final 保存全部读时") + func pauseDuringHeartbeatFinishesSequentially() async { + let source = source() + let gate = TrainingReadingHeartbeatGate() + await source.configure { $0.heartbeatHandler = { await gate.confirm($0) } } + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...4 { await model.recordVisibleTime(at: Double(second)) } + let operation = Task { await model.recordVisibleTime(at: 5) } + await gate.waitUntilRequested() + #expect(model.accumulateVisibleTime(at: 6)) + #expect(model.accumulateVisibleTime(at: 7)) + #expect(model.activeSecondsTotal == 7) + #expect(model.remainingSeconds == 13) + model.pauseReading() + #expect(!model.accumulateVisibleTime(at: 8)) + let closing = Task { await model.flush() } + #expect(await source.heartbeats.count == 1) + #expect(await source.heartbeats.first?.activeSecondsTotal == 5) + await gate.release() + await operation.value + await closing.value + let calls = await source.heartbeats + #expect(calls.count == 2) + #expect(calls[0].sequence == 1 && !calls[0].final) + #expect(calls[1].sequence == 2 && calls[1].final) + #expect(calls[0].activeSecondsTotal == 5) + #expect(calls[1].activeSecondsTotal == 7) + #expect(!model.isReading) + #expect(model.progress?.readingSeconds == 7) + } + + /// 前台恢复发生在 final 请求中途,等待结束后必须真正建立新会话。 + @Test("final 请求仍在飞时恢复阅读,串行等待关闭后启动") + func resumeWaitsForFinalConfirmation() async { + let source = source() + let server = TrainingReadingReplyController() + let gate = TrainingReadingHeartbeatGate() + await bind(server, to: source) + await source.configure { $0.heartbeatHandler = { call in + _ = await gate.confirm(call) + return try await server.confirm(call) + } } + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...3 { await model.recordVisibleTime(at: Double(second)) } + let closing = Task { await model.flush(final: true) } + await gate.waitUntilRequested() + let probe = TrainingReadingResumeProbe() + let resuming = Task { + probe.started = true + await model.startReading(at: 100) + probe.finished = true + } + while !probe.started { await Task.yield() } + #expect(!probe.finished) + #expect(await source.startReadingRequests.count == 1) + await gate.release() + await closing.value + await resuming.value + #expect(model.isReading) + #expect(await source.startReadingRequests.count == 2) + #expect(model.activeSecondsTotal == 0) + #expect(model.progress?.readingSeconds == 3) + await model.recordVisibleTime(at: 101) + #expect(model.activeSecondsTotal == 1) + } + + /// 任务截止后刷新只读资格,不可通过重试重新累计有效读时。 + @Test("150102刷新为只读资格,不能重新建立学习会话") + func notWritableRefreshesReadOnlyState() async { + let source = source() + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + let saved = TrainingRemoteFixtures.progress(seconds: 7) + let readOnly = TrainingProgressSnapshot(taskID: saved.taskID, readingSeconds: saved.readingSeconds, + requiredReadingSeconds: saved.requiredReadingSeconds, + completedSectionCount: saved.completedSectionCount, sectionCount: saved.sectionCount, + progressPercent: saved.progressPercent, readingCompleted: false, + learnerStatus: .pendingExam, completedAt: nil, hasDraft: false, + canViewCourse: true, canStudy: false, canStartExam: false, + canRetry: false, blockReason: "closed", serverTime: saved.serverTime) + await source.configure { + $0.heartbeatHandler = { _ in throw TrainingRemoteError.notWritable("arbitrary closed message") } + $0.progressHandler = { _ in readOnly } + } + for second in 1...5 { await model.recordVisibleTime(at: Double(second)) } + #expect(!model.canStudy) + #expect(model.progress?.blockReason == "closed") + #expect(model.currentAttachmentLink != nil) + await model.startReading(at: 100) + #expect(await source.startReadingRequests.count == 1) + #expect(!model.isReading) + } + + /// 稳定权限拒绝清空正文与进度,让页面立即退出而非保留旧内容。 + @Test("账号失效或培训权限撤回时清内容退出", arguments: [ + TrainingRemoteError.accountInvalid("account no longer eligible"), + TrainingRemoteError.forbidden("assignment revoked") + ]) + func accessDenialInvalidatesCourse(_ failure: TrainingRemoteError) async { + let source = source() + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + await source.configure { $0.heartbeatHandler = { _ in throw failure } } + for second in 1...5 { await model.recordVisibleTime(at: Double(second)) } + #expect(model.isInvalidated) + #expect(model.currentAttachmentLink == nil) + #expect(model.progress == nil) + #expect(model.attachments.isEmpty) + #expect(!model.isReading) + } + + /// 只按稳定业务码恢复过期与冲突,不依据错误文案。 + @Test("会话过期或冲突先读权威进度,重建新会话序号", arguments: [ + TrainingRemoteError.sessionExpired("arbitrary expired message"), + TrainingRemoteError.sessionConflict("arbitrary conflict message") + ]) + func expiredSessionRestoresProgress(_ failure: TrainingRemoteError) async { + let source = source() + let server = TrainingReadingReplyController(nextFailure: failure) + await bind(server, to: source) + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + for second in 1...5 { await model.recordVisibleTime(at: Double(second)) } + #expect(model.isReading) + #expect(model.activeSecondsTotal == 0) + #expect(await source.startReadingRequests.count == 2) + for second in 6...10 { await model.recordVisibleTime(at: Double(second)) } + let calls = await source.heartbeats + #expect(calls.count == 2) + #expect(calls[0].sessionID != calls[1].sessionID) + #expect(calls[1].sequence == 1) + #expect(calls[1].activeSecondsTotal == 5) + #expect(model.progress?.readingSeconds == 5) + #expect((await source.calls).filter { $0.name == "progress" }.count >= 2) + } + + /// 授权请求挂起时切身份,旧短链不能重新打开已经关闭的页面。 + @Test("身份切换丢弃迟到附件授权和权威进度") + func identityChangeDiscardsLateAttachment() async { + let source = source() + let gate = TrainingReadingAttachmentGate() + await source.configure { $0.attachmentURLHandler = { _ in await gate.link() } } + let model = model(source) + let operation = Task { await model.load() } + await gate.waitUntilRequested() + model.invalidate() + await gate.release() + await operation.value + #expect(model.isInvalidated) + #expect(model.task == nil) + #expect(model.currentAttachment == nil) + #expect(model.currentAttachmentLink == nil) + #expect(model.attachmentPreviewID == nil) + #expect(model.progress == nil) + #expect(model.attachments.isEmpty) + } + + /// 后续附件页需要用户主动读取,分页不能提前授权其余文档。 + @Test("附件目录主动分页且只在选择时授权后续附件") + func attachmentsAreLazyAndAuthorized() async { + let source = source(seconds: 20) + await source.configure { + $0.attachmentsHandler = { cursor in + let id = cursor == nil ? "file_1" : "file_2" + return TrainingCursorPage(items: [TrainingRemoteFixtures.attachment(id: id)], + nextCursor: cursor == nil ? "next" : nil, + hasMore: cursor == nil, serverTime: nil) + } + } + let model = model(source) + await model.load() + await model.loadAttachments() + await model.loadAttachments() + #expect((await source.calls).filter { $0.name == "attachments" }.count == 1) + #expect((await source.calls).filter { $0.name == "attachmentURL" }.count == 1) + await model.loadAttachments(loadMore: true) + #expect(model.attachments.count == 2) + #expect((await source.calls).filter { $0.name == "attachments" }.last?.cursor == "next") + #expect((await source.calls).filter { $0.name == "attachmentURL" }.count == 1) + await model.selectAttachment(id: "file_2") + #expect(model.currentAttachmentID == "file_2") + #expect(model.currentAttachmentLink?.expiresAt == TrainingRemoteFixtures.now.addingTimeInterval(3600)) + #expect((await source.calls).filter { $0.name == "attachmentURL" }.map(\.resourceID) == ["file_1", "file_2"]) + #expect(!model.isAttachmentRendered) + } + + /// 分页失败只提示列表错误,不能把已显示文件变成失败态或丢弃已累计秒数。 + @Test("附件分页失败可重试,当前文档继续阅读且成功后清提示") + func attachmentPaginationErrorDoesNotInterruptReading() async throws { + let source = source() + await source.configure { + $0.attachmentsHandler = { _ in + TrainingCursorPage(items: [TrainingRemoteFixtures.attachment()], nextCursor: "next", hasMore: true, serverTime: nil) + } + } + let model = model(source) + await loadRendered(model) + let previewID = try #require(model.attachmentPreviewID) + let link = try #require(model.currentAttachmentLink) + await model.startReading(at: 0) + await model.recordVisibleTime(at: 1) + await source.configure { $0.attachmentsHandler = { _ in throw URLError(.timedOut) } } + await model.loadAttachments(loadMore: true) + #expect(model.attachmentListErrorMessage != nil) + #expect(model.attachmentErrorMessage == nil && model.errorMessage == nil) + #expect(model.isAttachmentRendered && model.isReading && model.canStudy) + #expect(model.currentAttachmentLink == link && model.attachmentPreviewID == previewID) + #expect(model.attachments.count == 1 && model.hasMoreAttachments) + #expect(model.markAttachmentRendered(id: "file_1", previewID: previewID)) + await model.recordVisibleTime(at: 2) + #expect(model.activeSecondsTotal == 2) + await source.configure { + $0.attachmentsHandler = { _ in + TrainingCursorPage(items: [TrainingRemoteFixtures.attachment(id: "file_2")], nextCursor: nil, hasMore: false, serverTime: nil) + } + } + await model.loadAttachments(loadMore: true) + #expect(model.attachmentListErrorMessage == nil && model.errorMessage == nil) + #expect(model.attachments.map(\.id) == ["file_1", "file_2"]) + #expect(!model.hasMoreAttachments) + #expect(model.currentAttachmentLink == link && model.attachmentPreviewID == previewID) + #expect(model.isAttachmentRendered && model.isReading) + await model.recordVisibleTime(at: 3) + model.pauseReading() + await model.flush() + let heartbeats = await source.heartbeats + #expect(heartbeats.count == 1) + #expect(heartbeats.first?.activeSecondsTotal == 3 && heartbeats.first?.final == true) + #expect(await source.startReadingRequests.count == 1) + let calls = await source.calls + #expect(calls.filter { $0.name == "attachments" }.map(\.cursor) == [nil, "next", "next"]) + #expect(calls.filter { $0.name == "attachmentURL" }.count == 1) + } + + /// 授权被撤回不是普通分页故障,必须清理已经可读的文件并立即停止学习。 + @Test("附件分页返回账号或权限失效时仍清内容退出", arguments: [ + TrainingRemoteError.accountInvalid("account no longer eligible"), + TrainingRemoteError.forbidden("assignment revoked") + ]) + func attachmentPaginationAccessDenialInvalidatesCourse(_ failure: TrainingRemoteError) async { + let source = source() + await source.configure { + $0.attachmentsHandler = { _ in + TrainingCursorPage(items: [TrainingRemoteFixtures.attachment()], nextCursor: "next", hasMore: true, serverTime: nil) + } + } + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + await source.configure { $0.attachmentsHandler = { _ in throw failure } } + await model.loadAttachments(loadMore: true) + #expect(model.isInvalidated) + #expect(!model.isReading && !model.isAttachmentRendered) + #expect(model.attachments.isEmpty && model.currentAttachmentLink == nil) + #expect(model.attachmentListErrorMessage == nil) + } + + /// 只有文档下载与渲染都结束并由页面确认后才建立学习会话。 + @Test("附件授权不代表已展示,渲染确认前不能累计读时") + func authorizedAttachmentWaitsForRendering() async throws { + let source = source() + let model = model(source) + await model.load() + #expect(model.currentAttachmentLink != nil) + await model.startReading(at: 0) + await model.recordVisibleTime(at: 100) + #expect(await source.startReadingRequests.isEmpty) + #expect(await source.heartbeats.isEmpty) + let previewID = try #require(model.attachmentPreviewID) + #expect(!model.markAttachmentRendered(id: "another-file", previewID: previewID)) + #expect(!model.markAttachmentRendered(id: "file_1", previewID: UUID())) + #expect(model.markAttachmentRendered(id: "file_1", previewID: previewID)) + await model.startReading(at: 200) + await model.recordVisibleTime(at: 201) + #expect(model.isReading) + #expect(model.activeSecondsTotal == 1) + #expect(await source.startReadingRequests.count == 1) + } + + /// 没有课程文档时保留元信息空态,不请求 HTML,也不能通过空白页获得进度。 + @Test("无附件保留课程元信息但不建立会话或回退 HTML") + func missingAttachmentDoesNotCountReading() async { + let source = source() + await source.configure { + $0.attachmentsHandler = { _ in TrainingCursorPage(items: [], nextCursor: nil, hasMore: false, serverTime: nil) } + } + let model = model(source) + await model.load() + await model.startReading(at: 0) + await model.recordVisibleTime(at: 1000) + #expect(model.task != nil && model.course != nil && model.progress != nil) + #expect(model.hasLoadedAttachments) + #expect(model.currentAttachment == nil) + #expect(model.currentAttachmentLink == nil) + #expect(!model.isAttachmentRendered) + #expect(!model.markAttachmentRendered(id: "file_1", previewID: UUID())) + #expect(!(await source.calls).contains { ["section", "sections", "attachmentURL", "startReading", "heartbeat"].contains($0.name) }) + } + + /// 授权失败仍展示课程规则和附件名,重试成功后也要等待实际渲染。 + @Test("授权失败可重试同一附件,课程元信息不丢失") + func authorizationFailureKeepsMetadataForRetry() async throws { + let source = source() + await source.configure { $0.attachmentURLHandler = { _ in throw URLError(.timedOut) } } + let model = model(source) + await model.load() + #expect(model.task != nil && model.course != nil && model.progress != nil) + #expect(model.currentAttachmentID == "file_1") + #expect(model.currentAttachmentLink == nil) + #expect(model.attachmentErrorMessage != nil) + await model.startReading(at: 0) + #expect(await source.startReadingRequests.isEmpty) + let failedPreviewID = try #require(model.attachmentPreviewID) + await source.configure { $0.attachmentURLHandler = nil } + await model.selectAttachment(id: "file_1") + let nextPreviewID = try #require(model.attachmentPreviewID) + #expect(nextPreviewID != failedPreviewID) + #expect(model.currentAttachmentLink != nil) + #expect(model.attachmentErrorMessage == nil) + #expect(!model.markAttachmentRendered(id: "file_1", previewID: failedPreviewID)) + #expect(model.markAttachmentRendered(id: "file_1", previewID: nextPreviewID)) + } + + /// 预览失败停止当前片段,进度刷新不得误清错误或恢复读时。 + @Test("附件预览失败停止读时,错误跨进度刷新保留") + func previewFailureStopsReadingAndSurvivesProgressRefresh() async throws { + let source = source() + let model = model(source) + await loadRendered(model) + let previewID = try #require(model.attachmentPreviewID) + await model.startReading(at: 0) + for second in 1...3 { await model.recordVisibleTime(at: Double(second)) } + model.reportAttachmentFailure(id: "file_1", previewID: previewID, message: "文档加载失败") + #expect(!model.isReading && !model.isAttachmentRendered) + await model.flush() + await model.refreshProgress() + #expect(model.attachmentErrorMessage == "文档加载失败") + #expect(model.errorMessage == "文档加载失败") + #expect(!model.markAttachmentRendered(id: "file_1", previewID: previewID)) + await model.startReading(at: 100) + await model.recordVisibleTime(at: 101) + let calls = await source.heartbeats + #expect(calls.count == 1) + #expect(calls.first?.activeSecondsTotal == 3 && calls.first?.final == true) + #expect(await source.startReadingRequests.count == 1) + #expect(model.progress?.readingSeconds == 3) + } + + /// 切文档关闭旧片段,旧下载成功或失败回调都不能改变新文档。 + @Test("切附件先 final 保存,旧预览回调无效,新文档重新计时") + func switchingAttachmentClosesReadingAndRejectsLatePreview() async throws { + let source = source() + await source.configure { + $0.attachmentsHandler = { _ in TrainingCursorPage(items: [TrainingRemoteFixtures.attachment(), TrainingRemoteFixtures.attachment(id: "file_2")], nextCursor: nil, hasMore: false, serverTime: nil) } + } + let model = model(source) + await loadRendered(model) + let oldPreviewID = try #require(model.attachmentPreviewID) + await model.startReading(at: 0) + for second in 1...3 { await model.recordVisibleTime(at: Double(second)) } + await model.selectAttachment(id: "file_2") + let calls = await source.heartbeats + #expect(calls.count == 1) + #expect(calls.first?.activeSecondsTotal == 3 && calls.first?.final == true) + #expect(!model.isReading && !model.isAttachmentRendered) + #expect(!model.markAttachmentRendered(id: "file_1", previewID: oldPreviewID)) + model.reportAttachmentFailure(id: "file_1", previewID: oldPreviewID, message: "迟到错误") + #expect(model.attachmentErrorMessage == nil) + await model.startReading(at: 100) + #expect(await source.startReadingRequests.count == 1) + let previewID = try #require(model.attachmentPreviewID) + #expect(model.markAttachmentRendered(id: "file_2", previewID: previewID)) + await model.startReading(at: 200) + await model.recordVisibleTime(at: 201) + #expect(model.activeSecondsTotal == 1) + #expect(await source.startReadingRequests.count == 2) + #expect(model.progress?.readingSeconds == 3) + } + + /// 不能显示服务端错误返回的另一份附件,即使地址本身和有效期合法。 + @Test("附件授权响应必须匹配所选附件标识") + func mismatchedAttachmentAuthorizationIsRejected() async { + let source = source() + await source.configure { $0.attachmentURLHandler = { _ in + TrainingAttachmentLink(id: "other-file", name: "另一份文档.txt", + url: URL(string: "https://example.test/other.txt")!, + expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(60)) + } } + let model = model(source) + await model.load() + #expect(model.currentAttachmentID == "file_1") + #expect(model.currentAttachmentLink == nil) + #expect(model.attachmentErrorMessage != nil) + await model.startReading(at: 0) + #expect(await source.startReadingRequests.isEmpty) + } + + /// 两种网页协议都能打开,带签名的查询参数不在客户端改写。 + @Test("HTTP 和 HTTPS 附件原样返回有效签名地址", arguments: ["http", "https", "HTTP", "HTTPS"]) + func attachmentAcceptsWebSchemes(_ scheme: String) async throws { + let url = try #require(URL(string: "\(scheme)://example.test/training.pdf?Expires=1800003600&Signature=a%2Bb%3D")) + let source = source(seconds: 20) + await source.configure { $0.attachmentURLHandler = { id in + TrainingAttachmentLink(id: id, name: "培训.pdf", url: url, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(60)) + } } + let model = model(source) + await model.load() + let link = await model.authorizeAttachment(id: "file_1") + #expect(link?.url.absoluteString == url.absoluteString) + #expect(model.errorMessage == nil) + } + + /// 放行 HTTP 不能绕过服务端签名链接的有效期。 + @Test("HTTP 和 HTTPS 附件到期或已过期时仍拒绝打开", arguments: ["http", "https"]) + func expiredAttachmentIsRejected(_ scheme: String) async throws { + let url = try #require(URL(string: "\(scheme)://example.test/training.pdf")) + let source = source(seconds: 20) + let model = model(source) + await model.load() + for offset: TimeInterval in [0, -1] { + await source.configure { $0.attachmentURLHandler = { id in + TrainingAttachmentLink(id: id, name: "培训.pdf", url: url, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(offset)) + } } + #expect(await model.authorizeAttachment(id: "file_1") == nil) + #expect(model.errorMessage == "附件访问地址无效或已过期,请重试") + } + } + + /// 非网页协议、空主机和 URL 内嵌账号均不交给浏览器。 + @Test("附件拒绝非网页协议和无效身份地址", arguments: [ + "file:///private/training.pdf", "content://app/file", "javascript:alert(1)", "intent://app/file", + "http:///file", "http://user:password@example.test/file", "https://user@example.test/file", + ]) + func invalidAttachmentIsRejected(_ value: String) async throws { + let url = try #require(URL(string: value)) + let source = source(seconds: 20) + await source.configure { $0.attachmentURLHandler = { id in + TrainingAttachmentLink(id: id, name: "培训.pdf", url: url, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(60)) + } } + let model = model(source) + await model.load() + #expect(await model.authorizeAttachment(id: "file_1") == nil) + #expect(model.errorMessage == "附件访问地址无效或已过期,请重试") + } + + /// 只读回顾仍能加载正文,但不创建会话、不增加读时。 + @Test("已读完的只读课程不新建学习会话") + func readOnlyDoesNotStartSession() async { + let source = source(seconds: 20) + let model = model(source) + await loadRendered(model) + await model.startReading(at: 0) + await model.recordVisibleTime(at: 1000) + #expect(model.currentAttachmentLink != nil) + #expect(await source.startReadingRequests.isEmpty) + #expect(await source.heartbeats.isEmpty) + #expect(!model.isReading) + } +} + +/// 只模拟创建与心跳的服务器确认,支持先持久确认再丢响应和稳定业务失败。 +private actor TrainingReadingReplyController { + private var seconds = 0 + private var sessions: [String: TrainingStudySession] = [:] + private var bases: [String: Int] = [:] + private var confirmations: [String: (TrainingDataStub.HeartbeatCall, TrainingHeartbeatConfirmation)] = [:] + private var loseCreateResponse: Bool + private var loseHeartbeatResponse: Bool + private var nextFailure: TrainingRemoteError? + + /// 每个测试独立配置一次响应丢失或一次稳定业务错误。 + init(loseCreateResponse: Bool = false, loseHeartbeatResponse: Bool = false, nextFailure: TrainingRemoteError? = nil) { + self.loseCreateResponse = loseCreateResponse + self.loseHeartbeatResponse = loseHeartbeatResponse + self.nextFailure = nextFailure + } + + /// 当前权威读时由服务端状态生成。 + func progress() -> TrainingProgressSnapshot { TrainingRemoteFixtures.progress(seconds: seconds) } + + /// 同创建键返回原会话;响应丢失不撤销已经创建的会话。 + func create(requestID: String) throws -> TrainingStudySession { + if let saved = sessions[requestID] { return saved } + let session = TrainingStudySession(sessionID: requestID, expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(3600), + heartbeatIntervalSeconds: 5, maxHeartbeatGapSeconds: 15, progress: progress()) + sessions[requestID] = session + bases[requestID] = seconds + if loseCreateResponse { loseCreateResponse = false; throw URLError(.timedOut) } + return session + } + + /// 先记服务端确认,再抛超时;重试必须保留完整的原负载。 + func confirm(_ call: TrainingDataStub.HeartbeatCall) throws -> TrainingHeartbeatConfirmation { + if let failure = nextFailure { nextFailure = nil; throw failure } + let key = "\(call.sessionID):\(call.sequence)" + if let (prior, saved) = confirmations[key] { + guard prior == call else { throw TrainingRemoteError.sessionConflict("changed retry payload") } + return saved + } + seconds = min(20, max(seconds, (bases[call.sessionID] ?? 0) + call.activeSecondsTotal)) + let result = TrainingHeartbeatConfirmation(sessionID: call.sessionID, acceptedSequence: call.sequence, + acceptedActiveSecondsTotal: call.activeSecondsTotal, + sessionClosed: call.final, progress: progress()) + confirmations[key] = (call, result) + if loseHeartbeatResponse { loseHeartbeatResponse = false; throw URLError(.timedOut) } + return result + } +} + +/// 不使用固定延时的附件授权响应闸门,控制身份切换和迟到响应顺序。 +private actor TrainingReadingAttachmentGate { + private var response: CheckedContinuation? + private var waiters: [CheckedContinuation] = [] + + /// 等待测试释放短链,通知测试请求已挂起。 + func link() async -> TrainingAttachmentLink { + await withCheckedContinuation { + response = $0 + waiters.forEach { $0.resume() } + waiters = [] + } + } + + /// 等待授权请求已经挂起。 + func waitUntilRequested() async { + if response != nil { return } + await withCheckedContinuation { waiters.append($0) } + } + + /// 在身份变化后返回旧任务附件地址。 + func release() { + response?.resume(returning: TrainingAttachmentLink(id: "file_1", name: "旧文档.txt", + url: URL(string: "https://example.test/training.txt")!, + expiresAt: TrainingRemoteFixtures.now.addingTimeInterval(3600))) + response = nil + } +} + +/// 精确挂起首个普通心跳,验证后续读时、暂停和重试不会更改已发送负载。 +private actor TrainingReadingHeartbeatGate { + private var response: CheckedContinuation? + private var waiters: [CheckedContinuation] = [] + private var hasDelayed = false + + /// 首个请求等待测试释放,后续请求立即确认。 + func confirm(_ call: TrainingDataStub.HeartbeatCall) async -> TrainingHeartbeatConfirmation { + if !hasDelayed { + hasDelayed = true + await withCheckedContinuation { + response = $0 + waiters.forEach { $0.resume() } + waiters = [] + } + } + return TrainingHeartbeatConfirmation(sessionID: call.sessionID, acceptedSequence: call.sequence, + acceptedActiveSecondsTotal: call.activeSecondsTotal, sessionClosed: call.final, + progress: TrainingRemoteFixtures.progress(seconds: call.activeSecondsTotal)) + } + + /// 不使用时间延迟,等待首个网络请求已经挂起。 + func waitUntilRequested() async { + if response != nil { return } + await withCheckedContinuation { waiters.append($0) } + } + + /// 释放已挂起的普通心跳,让测试检查迟到确认之后的状态。 + func release() { response?.resume(); response = nil } +} + +/// 挂起首次建会话响应,让并发可见性恢复请求稳定进入等待队列。 +private actor TrainingReadingSessionGate { + private var response: CheckedContinuation? + private var waiters: [CheckedContinuation] = [] + + /// 等待测试释放创建响应,不使用真实时间延时。 + func wait() async { + await withCheckedContinuation { + response = $0 + waiters.forEach { $0.resume() } + waiters = [] + } + } + + /// 等待首次会话创建已在响应边界挂起。 + func waitUntilRequested() async { + if response != nil { return } + await withCheckedContinuation { waiters.append($0) } + } + + /// 允许首次创建完成,其余恢复应复用已经运行的会话。 + func release() { response?.resume(); response = nil } +} + +/// 记录恢复动作是否已进入和完成,避免用固定延时验证串行等待。 +@MainActor +private final class TrainingReadingResumeProbe { + var started = false + var finished = false +} diff --git a/suixinkanTests/TrainingRequestLoadingTests.swift b/suixinkanTests/TrainingRequestLoadingTests.swift new file mode 100644 index 0000000..57f5561 --- /dev/null +++ b/suixinkanTests/TrainingRequestLoadingTests.swift @@ -0,0 +1,465 @@ +import Foundation +import Testing +import UIKit +@testable import suixinkan + +/// 选项后台保存不展示 Loading,未缓存题页请求仍持有前台 Loading。 +enum TrainingLoadingExamScenario: String, CaseIterable, Sendable { + case selectionSuccess, selectionFailure, nextSuccess, nextFailure + var selectsAnswer: Bool { self == .selectionSuccess || self == .selectionFailure } + var fails: Bool { self == .selectionFailure || self == .nextFailure } +} + +/// 列表显式分页和错误重试均应持有请求 Loading。 +enum TrainingLoadingCenterScenario: String, CaseIterable, Sendable { + case nextPage, retry +} + +/// 让请求响应明确等待测试确认,观察同步 Loading 和页面离开后的迟到回调。 +private actor TrainingLoadingRequestGate { + private var continuations: [CheckedContinuation] = [] + private var released = false + private(set) var requestCount = 0 + + /// 记录并挂起请求,不使用固定网络延时。 + func wait() async { + requestCount += 1 + if released { return } + await withCheckedContinuation { continuations.append($0) } + } + + /// 释放全部挂起响应,重复释放无副作用。 + func release() { + released = true + let pending = continuations + continuations = [] + pending.forEach { $0.resume() } + } +} + +/// 初次恢复失败后挂起下一次精确查询,测试公开的恢复交卷按钮。 +private actor TrainingLoadingSubmissionRecovery { + private var count = 0 + + /// 初次抛出网络错误,让页面显示恢复按钮;随后只返回原提交的一条成绩。 + func recover(gate: TrainingLoadingRequestGate) async throws -> TrainingCursorPage { + count += 1 + if count == 1 { throw URLError(.timedOut) } + await gate.wait() + return TrainingCursorPage(items: [TrainingRemoteFixtures.attempt()], nextCursor: nil, + hasMore: false, serverTime: TrainingRemoteFixtures.now) + } +} + +/// 将全局 Loading 放进本例独立的真实 keyWindow,关闭后恢复原 keyWindow。 +@MainActor +private final class TrainingLoadingWindowScope { + let window: UIWindow + private weak var previousKeyWindow: UIWindow? + + /// 本例只接管窗口,不写入 AppStore 的账号、景区或店铺。 + init(_ navigation: UINavigationController) throws { + let scene = try #require(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first) + previousKeyWindow = scene.windows.first { $0.isKeyWindow } + window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + window.rootViewController = navigation + window.makeKeyAndVisible() + navigation.view.layoutIfNeeded() + } + + /// 隐藏测试窗口并恢复之前的应用窗口。 + func close() { + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKey() + } +} + +/// 请求 Loading 的页面生命周期回归;每例清理全局展示并使用独立网络和持久化域。 +@Suite("培训页面请求 Loading", .serialized) +@MainActor +struct TrainingRequestLoadingTests { + private let context = TrainingContext(accountScope: "training_loading", scenicID: 10, storeID: 3) + + @Test("选项保存不显示 Loading,未缓存翻题同步显示且成功失败均关闭", arguments: TrainingLoadingExamScenario.allCases) + func examRequestsOwnLoadingUntilResponse(scenario: TrainingLoadingExamScenario) async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingLoadingRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + if scenario.selectsAnswer { + configuration.saveHandler = { request in + await gate.wait() + if scenario.fails { throw URLError(.timedOut) } + return TrainingDraftConfirmation(draftRevision: request.baseRevision + 1, + savedAt: TrainingRemoteFixtures.now, answeredCount: 30) + } + } else { + configuration.questionsHandler = { offset, limit in + if offset == 10 { + await gate.wait() + if scenario.fails { throw URLError(.timedOut) } + } + return Self.questions(offset: offset, limit: limit) + } + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: Dictionary(uniqueKeysWithValues: (1...30).map { ("q\($0)", ["A"]) }), lastOrder: 10) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingLoadingWindowScope(navigation) + defer { scope.close() } + try await waitUntil { model.canEdit && !manager.isShowing && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + #expect(scope.window.isKeyWindow) + #expect(!hasVisibleOverlay(in: scope.window)) + let action = try #require(button(scenario.selectsAnswer ? "training.option.B" : "training.exam.next", in: controller.view)) + action.sendActions(for: .touchUpInside) + // 未缓存翻题当场持有 Loading;本地选择在防抖和后台保存期间均不阻塞页面。 + #expect(manager.isShowing == !scenario.selectsAnswer) + #expect(hasVisibleOverlay(in: scope.window) == !scenario.selectsAnswer) + action.sendActions(for: .touchUpInside) + try await waitUntil { await gate.requestCount > 0 } + #expect(model.isBusy == !scenario.selectsAnswer) + #expect(model.isSaving == scenario.selectsAnswer) + #expect(manager.isShowing == !scenario.selectsAnswer) + #expect(hasVisibleOverlay(in: scope.window) == !scenario.selectsAnswer) + #expect(await gate.requestCount == 1) + #expect(await source.savedRequests.count == (scenario.selectsAnswer ? 1 : 0)) + await gate.release() + try await waitUntil { !model.isBusy && !model.isSaving && !manager.isShowing && (scenario.fails ? model.errorMessage != nil : model.canEdit) } + #expect(!hasVisibleOverlay(in: scope.window)) + #expect(navigation.topViewController === controller) + if scenario.fails { + #expect(model.errorMessage != nil) + let retry = try #require(button("training.exam.submit", in: controller.view)) + #expect(retry.isEnabled) + #expect(retry.title(for: .normal) == (scenario.selectsAnswer ? "重试保存" : "重试加载本题")) + } else { + #expect(model.currentIndex == (scenario.selectsAnswer ? 9 : 10)) + #expect(model.currentSelectedIDs == (scenario.selectsAnswer ? ["B"] : ["A"])) + #expect(model.errorMessage == nil) + #expect(await model.flushDraft(service: source)) + } + } + + @Test("答题卡打开和完成关闭是本地操作,不显示 Loading 或重读任务") + func localAnswerCardDoesNotStartRequestLoading() async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let source = TrainingDataStub() + await source.seedDraft(revision: 3, answers: ["q10": ["B"]], lastOrder: 10) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingLoadingWindowScope(navigation) + defer { scope.close() } + try await waitUntil { model.canEdit && !manager.isShowing && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + let before = await source.calls + let answerCard = try #require(controller.navigationItem.rightBarButtonItem) + try activate(answerCard) + #expect(!manager.isShowing) + #expect(!hasVisibleOverlay(in: scope.window)) + try await waitUntil { controller.presentedViewController is UINavigationController } + let presented = try #require(controller.presentedViewController as? UINavigationController) + try await settleTransitions([controller, presented]) + #expect(!manager.isShowing) + let card = try #require(presented.topViewController as? TrainingAnswerCardViewController) + let done = try #require(card.navigationItem.rightBarButtonItem) + try activate(done) + #expect(!manager.isShowing) + try await waitUntil { controller.presentedViewController == nil } + try await settleTransitions([navigation, controller, presented]) + #expect(!manager.isShowing && !hasVisibleOverlay(in: scope.window)) + #expect(await source.calls == before) + #expect(model.currentIndex == 9 && model.currentSelectedIDs == ["B"]) + } + + @Test("离开考试页立即释放自身 Loading,旧响应不能关闭后来请求的令牌") + func leavingExamReleasesOwnedLoadingWithoutHidingNewRequest() async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingLoadingRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.questionsHandler = { offset, limit in + if offset == 10 { await gate.wait() } + return Self.questions(offset: offset, limit: limit) + } + let source = TrainingDataStub(configuration: configuration) + await source.seedDraft(revision: 5, answers: [:], lastOrder: 10) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingLoadingWindowScope(navigation) + defer { scope.close() } + try await waitUntil { model.canEdit && !manager.isShowing && self.button("training.exam.next", in: controller.view)?.isEnabled == true } + try await settleTransitions([navigation, controller]) + let next = try #require(button("training.exam.next", in: controller.view)) + next.sendActions(for: .touchUpInside) + try await waitUntil { await gate.requestCount > 0 } + #expect(manager.isShowing) + let covering = UIViewController() + navigation.pushViewController(covering, animated: false) + try await settleTransitions([navigation, controller, covering]) + #expect(!manager.isShowing) + #expect(!hasVisibleOverlay(in: scope.window)) + #expect(model.isBusy) + let newerToken = manager.beginRequest() + defer { manager.endRequest(newerToken) } + #expect(manager.isShowing && hasVisibleOverlay(in: scope.window)) + await gate.release() + try await waitUntil { model.canEdit && model.currentQuestion?.order == 11 && next.isUserInteractionEnabled } + #expect(manager.isShowing) + #expect(hasVisibleOverlay(in: scope.window)) + #expect(navigation.topViewController === covering) + manager.endRequest(newerToken) + #expect(!manager.isShowing) + #expect(!hasVisibleOverlay(in: scope.window)) + #expect(await model.flushDraft(service: source)) + } + + @Test("恢复未知交卷结果继续使用前台 Loading,不新建交卷或重放草稿") + func recoveringSubmissionOwnsLoadingAndKeepsOriginalRequest() async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let domain = try makeDefaults() + defer { domain.defaults.removePersistentDomain(forName: domain.name) } + let gate = TrainingLoadingRequestGate() + defer { Task { await gate.release() } } + let recovery = TrainingLoadingSubmissionRecovery() + let store = TrainingPendingSubmissionStore(defaults: domain.defaults) + let original = TrainingPendingSubmission(taskID: "task_1", + request: TrainingSubmissionRequest(submissionID: "original-unknown-submit", paperSnapshotID: "paper_1", draftRevision: 5), context: context) + try store.save(original) + var configuration = TrainingDataStub.Configuration() + configuration.attemptsHandler = { _, _, _ in try await recovery.recover(gate: gate) } + let source = TrainingDataStub(configuration: configuration) + let model = makeModel(defaults: domain.defaults) + let controller = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingLoadingWindowScope(navigation) + defer { scope.close() } + try await waitUntil { + model.hasPendingSubmission && !manager.isShowing && self.button("training.exam.submit", in: controller.view)?.title(for: .normal) == "恢复交卷结果" + } + let restore = try #require(button("training.exam.submit", in: controller.view)) + restore.sendActions(for: .touchUpInside) + #expect(manager.isShowing && hasVisibleOverlay(in: scope.window)) + try await waitUntil { await gate.requestCount == 1 } + #expect(model.isBusy && manager.isShowing) + let stillPending = try store.load(taskID: "task_1", context: context) + #expect(stillPending == original) + #expect(await source.submissionRequests.isEmpty) + #expect(await source.savedRequests.isEmpty) + await gate.release() + try await waitUntil { model.submittedAttempt != nil && !model.isBusy && !manager.isShowing } + #expect(!hasVisibleOverlay(in: scope.window)) + let pendingAfter = try store.load(taskID: "task_1", context: context) + #expect(pendingAfter == nil) + #expect(await source.submissionRequests.isEmpty) + #expect(await source.savedRequests.isEmpty) + #expect(await source.calls.filter { $0.name == "attempts" }.count == 2) + } + + @Test("培训列表下一页和错误重试同步展示 Loading,确认后关闭", arguments: TrainingLoadingCenterScenario.allCases) + func centerExplicitRequestsOwnLoading(scenario: TrainingLoadingCenterScenario) async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let gate = TrainingLoadingRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.attemptsHandler = { _, _, cursor in + if scenario == .retry { throw URLError(.timedOut) } + if cursor != nil { await gate.wait() } + return TrainingCursorPage(items: [TrainingRemoteFixtures.attempt(id: cursor == nil ? "first" : "second")], + nextCursor: cursor == nil ? "next" : nil, hasMore: cursor == nil, serverTime: nil) + } + let source = TrainingDataStub(configuration: configuration) + let controller = TrainingCenterViewController(service: source, showsHistory: true) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingLoadingWindowScope(navigation) + defer { scope.close() } + let identifier = scenario == .nextPage ? "training.center.more" : "training.center.retry" + let title = scenario == .nextPage ? "加载更多" : "重新加载" + try await waitUntil { + !manager.isShowing && self.centerButton(identifier: identifier, title: title, in: controller.view).map { !$0.isHidden && $0.isEnabled } == true + } + try await settleTransitions([navigation, controller]) + let action = try #require(centerButton(identifier: identifier, title: title, in: controller.view)) + let table = try #require(allViews(controller.view).first { $0 is UITableView } as? UITableView) + let statistics = try statisticLabels(in: controller.view) + let initialStatistics = statistics.map(\.text) + if scenario == .retry { + #expect(rowCount(in: table) == 0) + await source.configure { + $0.attemptsHandler = { _, _, _ in + await gate.wait() + return TrainingCursorPage(items: [TrainingRemoteFixtures.attempt(id: "recovered")], nextCursor: nil, hasMore: false, serverTime: nil) + } + } + } else { + #expect(rowCount(in: table) == 1) + #expect(initialStatistics == ["1", "0", "—"]) + } + action.sendActions(for: .touchUpInside) + #expect(manager.isShowing) + #expect(hasVisibleOverlay(in: scope.window)) + try await waitUntil { await gate.requestCount > 0 } + #expect(manager.isShowing) + #expect(hasVisibleOverlay(in: scope.window)) + if scenario == .nextPage { + #expect(rowCount(in: table) == 1) + #expect(statistics.map(\.text) == initialStatistics) + } + await gate.release() + try await waitUntil { !manager.isShowing && self.rowCount(in: table) == (scenario == .nextPage ? 2 : 1) } + #expect(!hasVisibleOverlay(in: scope.window)) + #expect(statistics.map(\.text) == ["1", "0", "—"]) + #expect(navigation.topViewController === controller) + let requests = await source.calls.filter { $0.name == "attempts" } + #expect(requests.count == 2) + let expectedCursors: [String?] = scenario == .nextPage ? [nil, "next"] : [nil, nil] + #expect(requests.map(\.cursor) == expectedCursors) + #expect(await gate.requestCount == 1) + } + + @Test("切换列表按钮取消旧搜索防抖,不重发记录请求或提前关闭 Loading") + func centerTabRequestCancelsPendingSearchDebounce() async throws { + let manager = GlobalLoadingManager.shared + manager.hideAll() + defer { manager.hideAll() } + let gate = TrainingLoadingRequestGate() + defer { Task { await gate.release() } } + var configuration = TrainingDataStub.Configuration() + configuration.attemptsHandler = { _, _, _ in + await gate.wait() + return TrainingCursorPage(items: [TrainingRemoteFixtures.attempt(id: "records_target")], + nextCursor: nil, hasMore: false, serverTime: nil) + } + let source = TrainingDataStub(configuration: configuration) + let controller = TrainingCenterViewController(service: source) + let navigation = UINavigationController(rootViewController: controller) + let scope = try TrainingLoadingWindowScope(navigation) + defer { scope.close() } + let table = try #require(allViews(controller.view).first { $0 is UITableView } as? UITableView) + try await waitUntil { !manager.isShowing && self.rowCount(in: table) == 1 } + controller.selectTab(.tasks) + let search = try #require(allViews(controller.view).compactMap { $0 as? UITextField }.first { + $0.accessibilityIdentifier == "training.search" + }) + try await waitUntil { !manager.isShowing && !search.isHidden && self.rowCount(in: table) == 1 } + try await settleTransitions([navigation, controller]) + let taskCallsBefore = await source.calls.filter { $0.name == "tasks" } + #expect(await source.calls.filter { $0.name == "attempts" }.isEmpty) + + search.text = "服务" + search.sendActions(for: .editingChanged) + #expect(!manager.isShowing) + // 仍在同一主 actor 回合内,按钮请求必须取消刚安排的 300ms 搜索任务。 + controller.selectTab(.records) + #expect(manager.isShowing) + #expect(hasVisibleOverlay(in: scope.window)) + try await waitUntil { await gate.requestCount > 0 } + // 此处只等待超过真实防抖期限,响应始终由 gate 控制,不能提前结束请求。 + try await Task.sleep(for: .milliseconds(450)) + #expect(manager.isShowing) + #expect(hasVisibleOverlay(in: scope.window)) + #expect(await gate.requestCount == 1) + #expect(await source.calls.filter { $0.name == "attempts" }.count == 1) + #expect(await source.calls.filter { $0.name == "tasks" } == taskCallsBefore) + await gate.release() + try await waitUntil { !manager.isShowing && self.rowCount(in: table) == 1 } + #expect(!hasVisibleOverlay(in: scope.window)) + #expect(button("training.tab.2", in: controller.view)?.accessibilityTraits.contains(.selected) == true) + #expect(await source.calls.filter { $0.name == "attempts" }.count == 1) + #expect(navigation.topViewController === controller) + } + + private nonisolated static func questions(offset: Int, limit: Int) -> TrainingQuestionPage { + let end = min(30, offset + limit) + let items: [TrainingQuestionItem] = offset < end ? ((offset + 1)...end).map(TrainingRemoteFixtures.question) : [] + return TrainingQuestionPage(paperSnapshotID: "paper_1", total: 30, offset: offset, + nextOffset: end < 30 ? end : nil, hasMore: end < 30, items: items) + } + + private func makeDefaults() throws -> (name: String, defaults: UserDefaults) { + let name = "TrainingRequestLoadingTests-\(UUID().uuidString)" + return (name, try #require(UserDefaults(suiteName: name))) + } + + private func makeModel(defaults: UserDefaults) -> TrainingRemoteExamViewModel { + let scope = context + return TrainingRemoteExamViewModel(taskID: "task_1", context: scope, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), currentContext: { scope }) + } + + private func hasVisibleOverlay(in window: UIWindow) -> Bool { + window.subviews.contains { $0 is GlobalLoadingOverlayView && !$0.isHidden } + } + + private func allViews(_ view: UIView) -> [UIView] { + [view] + view.subviews.flatMap { allViews($0) } + } + + private func button(_ identifier: String, in view: UIView) -> UIButton? { + allViews(view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == identifier } + } + + private func centerButton(identifier: String, title: String, in view: UIView) -> UIButton? { + button(identifier, in: view) ?? allViews(view).compactMap { $0 as? UIButton }.first { + ($0.configuration?.title ?? $0.title(for: .normal)) == title + } + } + + private func rowCount(in table: UITableView) -> Int { + table.numberOfSections > 0 ? table.numberOfRows(inSection: 0) : 0 + } + + private func statisticLabels(in view: UIView) throws -> [UILabel] { + let labels = allViews(view).compactMap { $0 as? UILabel } + return try ["待考试", "已完成", "最近得分"].map { title in + let caption = try #require(labels.first { $0.text == title }) + let column = try #require(caption.superview as? UIStackView) + return try #require(column.arrangedSubviews.compactMap { $0 as? UILabel }.first { $0 !== caption }) + } + } + + private func activate(_ item: UIBarButtonItem) throws { + if let action = item.primaryAction { + let dispatcher = UIButton(type: .system) + dispatcher.addAction(action, for: .touchUpInside) + dispatcher.sendActions(for: .touchUpInside) + } else { + let action = try #require(item.action) + UIApplication.shared.sendAction(action, to: item.target, from: item, for: nil) + } + } + + private func settleTransitions(_ controllers: [UIViewController]) async throws { + try await Task.sleep(for: .milliseconds(20)) + try await waitUntil { controllers.allSatisfy { $0.transitionCoordinator == nil && !$0.isBeingPresented && !$0.isBeingDismissed } } + } + + private func waitUntil(_ condition: @MainActor () async -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !(await condition()), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + let reached = await condition() + try #require(reached) + } +} diff --git a/suixinkanTests/TrainingResultRequestLoadingTests.swift b/suixinkanTests/TrainingResultRequestLoadingTests.swift new file mode 100644 index 0000000..8249694 --- /dev/null +++ b/suixinkanTests/TrainingResultRequestLoadingTests.swift @@ -0,0 +1,340 @@ +import Foundation +import Testing +import UIKit +@testable import suixinkan + +/// 可控挂起成绩或解析请求,验证通用 Loading 覆盖真实等待区间。 +private actor TrainingResultLoadingGate { + private var continuations: [CheckedContinuation] = [] + private var released = false + private(set) var requestCount = 0 + + /// 记录实际请求次数,不用固定网络延时冒充在途状态。 + func wait() async { + requestCount += 1 + if released { return } + await withCheckedContinuation { continuations.append($0) } + } + + /// 测试完成和异常退出均释放所有挂起请求。 + func release() { + released = true + let pending = continuations + continuations = [] + pending.forEach { $0.resume() } + } +} + +/// 只操作内存替身和独立窗口,验证成绩请求 Loading、缓存及重试。 +@Suite("培训成绩请求 Loading", .serialized) +@MainActor +struct TrainingResultRequestLoadingTests { + @Test("成绩重载合并请求,等待期间展示通用 Loading 且按钮外观不变") + func reloadOwnsOneLoadingTokenAndKeepsButtonEnabled() async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let gate = TrainingResultLoadingGate() + defer { Task { await gate.release() } } + let source = TrainingDataStub() + await source.configure { $0.attemptHandler = { _ in + await gate.wait() + return TrainingRemoteFixtures.result() + } } + let controller = makeController(source: source) + controller.loadViewIfNeeded() + let action = try #require(button("training.result.action", in: controller.view)) + let background = action.configuration?.baseBackgroundColor + let foreground = action.configuration?.baseForegroundColor + let request = Task { @MainActor in await controller.reload() } + try await waitForGate(gate) + let scene = try TrainingResultLoadingWindow(controller) + defer { scene.close() } + let joined = Task { @MainActor in await controller.reload() } + action.sendActions(for: .touchUpInside) + await Task.yield() + + #expect(GlobalLoadingManager.shared.isShowing) + #expect(action.isEnabled) + #expect(!action.isUserInteractionEnabled) + #expect(action.configuration?.baseBackgroundColor == background) + #expect(action.configuration?.baseForegroundColor == foreground) + #expect(await source.calls.filter { $0.name == "attempt" }.count == 1) + #expect(await gate.requestCount == 1) + + await gate.release() + await request.value + await joined.value + try await waitUntil { !GlobalLoadingManager.shared.isShowing && action.isUserInteractionEnabled } + #expect(action.isEnabled) + #expect(hasLabel("100", in: controller.view)) + } + + @Test("成绩请求失败或取消后释放 Loading,按钮重试仍持有 Loading", arguments: [false, true]) + func summaryFailureCanRetryWithLoading(cancelled: Bool) async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let source = TrainingDataStub() + await source.configure { $0.attemptHandler = { _ in + if cancelled { throw CancellationError() } + throw APIError.networkFailed("成绩查询离线") + } } + let controller = makeController(source: source) + let scene = try TrainingResultLoadingWindow(controller) + defer { scene.close() } + try await waitUntil { self.button("training.result.action", in: controller.view)?.configuration?.title == "重新加载" } + #expect(!GlobalLoadingManager.shared.isShowing) + let gate = TrainingResultLoadingGate() + defer { Task { await gate.release() } } + await source.configure { $0.attemptHandler = { _ in + await gate.wait() + return TrainingRemoteFixtures.result() + } } + let retry = try #require(button("training.result.action", in: controller.view)) + retry.sendActions(for: .touchUpInside) + retry.sendActions(for: .touchUpInside) + try await waitForGate(gate) + #expect(GlobalLoadingManager.shared.isShowing) + #expect(retry.isEnabled && !retry.isUserInteractionEnabled) + #expect(await source.calls.filter { $0.name == "attempt" }.count == 2) + await gate.release() + try await waitUntil { !GlobalLoadingManager.shared.isShowing && self.hasLabel("100", in: controller.view) } + #expect(retry.isUserInteractionEnabled) + } + + @Test("首次展开解析展示 Loading,交卷摘要和缓存展开收起均不请求或闪 Loading") + func firstReviewsShowLoadingAndCachedTogglesDoNot() async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let gate = TrainingResultLoadingGate() + defer { Task { await gate.release() } } + let source = TrainingDataStub() + await source.configure { $0.reviewsHandler = { _ in + await gate.wait() + return TrainingReviewPage(attemptID: "attempt_1", items: [TrainingRemoteFixtures.review()], nextCursor: nil, hasMore: false) + } } + let controller = makeController(source: source, initial: TrainingRemoteFixtures.result()) + let scene = try TrainingResultLoadingWindow(controller) + defer { scene.close() } + #expect(!GlobalLoadingManager.shared.isShowing) + #expect(await source.calls.isEmpty) + let details = try #require(button("training.result.details", in: controller.view)) + details.sendActions(for: .touchUpInside) + let waitingDetails = try #require(button("training.result.details", in: controller.view)) + waitingDetails.sendActions(for: .touchUpInside) + try await waitForGate(gate) + #expect(GlobalLoadingManager.shared.isShowing) + #expect(waitingDetails.isEnabled) + #expect(await source.calls.filter { $0.name == "reviews" }.count == 1) + await gate.release() + try await waitUntil { !GlobalLoadingManager.shared.isShowing && self.hasLabel(TrainingRemoteFixtures.review().stem, in: controller.view) } + + let collapse = try #require(button("training.result.details", in: controller.view)) + collapse.sendActions(for: .touchUpInside) + #expect(!GlobalLoadingManager.shared.isShowing) + #expect(!hasLabel(TrainingRemoteFixtures.review().stem, in: controller.view)) + let reopen = try #require(button("training.result.details", in: controller.view)) + reopen.sendActions(for: .touchUpInside) + #expect(!GlobalLoadingManager.shared.isShowing) + #expect(hasLabel(TrainingRemoteFixtures.review().stem, in: controller.view)) + await Task.yield() + #expect(await source.calls.filter { $0.name == "reviews" }.count == 1) + #expect(await source.calls.filter { $0.name == "attempt" }.isEmpty) + } + + @Test("解析首次失败可重试,成绩保持显示且 Loading 按请求结束") + func firstReviewFailureRetriesWithLoading() async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let source = TrainingDataStub() + await source.configure { $0.reviewsHandler = { _ in throw APIError.networkFailed("解析离线") } } + let controller = makeController(source: source, initial: TrainingRemoteFixtures.result()) + let scene = try TrainingResultLoadingWindow(controller) + defer { scene.close() } + let details = try #require(button("training.result.details", in: controller.view)) + details.sendActions(for: .touchUpInside) + try await waitUntil { self.button("training.result.reviews.more", in: controller.view)?.configuration?.title == "重试加载解析" } + #expect(!GlobalLoadingManager.shared.isShowing) + #expect(hasLabel("100", in: controller.view)) + let gate = TrainingResultLoadingGate() + defer { Task { await gate.release() } } + await source.configure { $0.reviewsHandler = { cursor in + #expect(cursor == nil) + await gate.wait() + return TrainingReviewPage(attemptID: "attempt_1", items: [TrainingRemoteFixtures.review()], nextCursor: nil, hasMore: false) + } } + let retry = try #require(button("training.result.reviews.more", in: controller.view)) + retry.sendActions(for: .touchUpInside) + retry.sendActions(for: .touchUpInside) + try await waitForGate(gate) + #expect(GlobalLoadingManager.shared.isShowing) + #expect(retry.isEnabled) + #expect(await source.calls.filter { $0.name == "reviews" }.count == 2) + await gate.release() + try await waitUntil { !GlobalLoadingManager.shared.isShowing && self.hasLabel(TrainingRemoteFixtures.review().stem, in: controller.view) } + #expect(button("training.result.reviews.more", in: controller.view) == nil) + } + + @Test("解析下一页失败和重试使用同一游标,各请求分别释放 Loading") + func nextReviewPageFailureRetriesSameCursor() async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let source = TrainingDataStub() + await source.configure { $0.reviewsHandler = { _ in + TrainingReviewPage(attemptID: "attempt_1", items: [TrainingRemoteFixtures.review()], nextCursor: "next", hasMore: true) + } } + let controller = makeController(source: source, initial: TrainingRemoteFixtures.result()) + let scene = try TrainingResultLoadingWindow(controller) + defer { scene.close() } + let details = try #require(button("training.result.details", in: controller.view)) + details.sendActions(for: .touchUpInside) + try await waitUntil { self.button("training.result.reviews.more", in: controller.view) != nil && !GlobalLoadingManager.shared.isShowing } + let failureGate = TrainingResultLoadingGate() + defer { Task { await failureGate.release() } } + await source.configure { $0.reviewsHandler = { cursor in + #expect(cursor == "next") + await failureGate.wait() + throw APIError.networkFailed("下一页离线") + } } + let more = try #require(button("training.result.reviews.more", in: controller.view)) + more.sendActions(for: .touchUpInside) + try await waitForGate(failureGate) + #expect(GlobalLoadingManager.shared.isShowing) + await failureGate.release() + try await waitUntil { !GlobalLoadingManager.shared.isShowing && self.button("training.result.reviews.more", in: controller.view)?.configuration?.title == "重试加载解析" } + #expect(hasLabel(TrainingRemoteFixtures.review().stem, in: controller.view)) + let retryGate = TrainingResultLoadingGate() + defer { Task { await retryGate.release() } } + await source.configure { $0.reviewsHandler = { cursor in + #expect(cursor == "next") + await retryGate.wait() + return TrainingReviewPage(attemptID: "attempt_1", items: [TrainingRemoteFixtures.review(2)], nextCursor: nil, hasMore: false) + } } + let retry = try #require(button("training.result.reviews.more", in: controller.view)) + retry.sendActions(for: .touchUpInside) + try await waitForGate(retryGate) + #expect(GlobalLoadingManager.shared.isShowing) + await retryGate.release() + try await waitUntil { !GlobalLoadingManager.shared.isShowing && self.hasLabel(TrainingRemoteFixtures.review(2).stem, in: controller.view) } + let calls = await source.calls.filter { $0.name == "reviews" } + #expect(calls.map(\.cursor) == [nil, "next", "next"]) + } + + @Test("离开成绩页或 hideAll 后,旧请求结束不关闭其它请求 Loading", arguments: [false, true]) + func leavingOrResettingLoadingCannotHideNewRequest(resetAll: Bool) async throws { + GlobalLoadingManager.shared.hideAll() + defer { GlobalLoadingManager.shared.hideAll() } + let gate = TrainingResultLoadingGate() + defer { Task { await gate.release() } } + let source = TrainingDataStub() + await source.configure { $0.attemptHandler = { _ in + await gate.wait() + return TrainingRemoteFixtures.result() + } } + let controller = makeController(source: source) + let root = TrainingResultLoadingAppearanceController() + let navigation = TrainingResultLoadingNavigationController(rootViewController: root) + navigation.setViewControllers([root, controller], animated: false) + let scene = try TrainingResultLoadingWindow(navigation: navigation) + defer { scene.close() } + try await waitForGate(gate) + try await waitUntil { + navigation.didAppear && navigation.topViewController === controller + && navigation.transitionCoordinator == nil + } + #expect(GlobalLoadingManager.shared.isShowing) + if resetAll { GlobalLoadingManager.shared.hideAll() } + else { + navigation.popViewController(animated: false) + try await waitUntil { + root.didAppear && navigation.topViewController === root + && navigation.transitionCoordinator == nil + } + } + #expect(!GlobalLoadingManager.shared.isShowing) + let newer = GlobalLoadingManager.shared.beginRequest() + defer { GlobalLoadingManager.shared.endRequest(newer) } + await gate.release() + await controller.reload() + #expect(GlobalLoadingManager.shared.isShowing, "旧结束回调只能归还原票据") + GlobalLoadingManager.shared.endRequest(newer) + #expect(!GlobalLoadingManager.shared.isShowing) + } + + private func makeController(source: any TrainingDataServing, initial: TrainingAttemptDetail? = nil) -> TrainingResultViewController { + TrainingResultViewController(taskID: "task_1", attemptID: "attempt_1", service: source, initialDetail: initial) + } + + private func waitForGate(_ gate: TrainingResultLoadingGate) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while await gate.requestCount == 0, ContinuousClock.now < deadline { + try await Task.sleep(for: .milliseconds(10)) + } + let count = await gate.requestCount + try #require(count > 0) + } + + private func waitUntil(_ condition: () -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !condition(), ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) } + try #require(condition()) + } + + private func allViews(_ view: UIView) -> [UIView] { [view] + view.subviews.flatMap(allViews) } + private func button(_ identifier: String, in view: UIView) -> UIButton? { + allViews(view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == identifier } + } + private func hasLabel(_ text: String, in view: UIView) -> Bool { + allViews(view).compactMap { $0 as? UILabel }.contains { $0.text == text } + } +} + +/// 记录首次窗口展示已经完成,避免在导航仍进行 appearance 时立即移除请求页面。 +@MainActor +private final class TrainingResultLoadingNavigationController: UINavigationController { + private(set) var didAppear = false + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + didAppear = true + } +} + +/// 用真实目标页面的 appearance 确认 pop 已结束,再检查离页释放的 Loading。 +@MainActor +private final class TrainingResultLoadingAppearanceController: UIViewController { + private(set) var didAppear = false + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + didAppear = true + } +} + +/// 保留上一键窗口,关闭测试窗口时恢复,避免影响其它页面的 Loading 归属。 +@MainActor +private final class TrainingResultLoadingWindow { + let window: UIWindow + private weak var previousKeyWindow: UIWindow? + + convenience init(_ controller: UIViewController) throws { + try self.init(navigation: UINavigationController(rootViewController: controller)) + } + + init(navigation: UINavigationController) throws { + let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } + let scene = try #require(scenes.first { $0.activationState == .foregroundActive } ?? scenes.first) + previousKeyWindow = scene.windows.first { $0.isKeyWindow } + window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: 390, height: 844) + window.rootViewController = navigation + window.makeKeyAndVisible() + navigation.view.layoutIfNeeded() + } + + func close() { + window.endEditing(true) + window.isHidden = true + window.rootViewController = nil + previousKeyWindow?.makeKeyAndVisible() + } +} diff --git a/suixinkanTests/TrainingUIRenderingTests.swift b/suixinkanTests/TrainingUIRenderingTests.swift new file mode 100644 index 0000000..3ea8f11 --- /dev/null +++ b/suixinkanTests/TrainingUIRenderingTests.swift @@ -0,0 +1,356 @@ +import Foundation +import Testing +import UIKit +import WebKit +@testable import suixinkan + +#if DEBUG +/// 在连接的 iPhone 真机中渲染任务列表、成绩页和答题卡,附件用于视觉检查。 +@Suite("培训中心原生布局", .serialized) +@MainActor +struct TrainingUIRenderingTests { + @Test("原生任务列表与窄屏长文本卡片不裁切") + func taskListAndLongTitleLayout() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + defer { try? FileManager.default.removeItem(at: directory) } + let source = TrainingDemoService(context: TrainingContext(accountScope: "render", scenicID: 1, storeID: 1), + storage: TrainingDemoFileStorage(directory: directory)) + let controller = TrainingCenterViewController(service: TrainingDataStub()) + controller.loadViewIfNeeded() + await controller.reload() + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + navigation.view.layoutIfNeeded() + Attachment.record(render(navigation.view), named: "培训首页", as: .png) + let labels = allViews(controller.view).compactMap { $0 as? UILabel } + #expect(labels.contains { $0.text == "一线服务规范学习" }) + #expect(labels.contains { $0.text == "学习 + 考试 · 30 题 · 80 分及格" }) + #expect(!labels.contains { $0.text?.contains("未同步景区后台") == true }) + + let original = try await source.task(id: "demo-service") + let longTask = TrainingTask(id: original.id, title: String(repeating: "游客沟通与接待服务规范培训", count: 3), + publisherName: "景区培训负责人", mode: .exam, status: .published, + startAt: original.startAt, endAt: original.endAt, passScore: original.passScore, + scoring: original.scoring, course: original.course, questions: original.questions, progress: original.progress) + let cell = TrainingTaskCell(style: .default, reuseIdentifier: nil) + cell.configure(task: longTask) + #expect(allViews(cell.contentView).compactMap { $0 as? UILabel }.contains { + $0.text == "学习 + 考试 · \(longTask.questions.count) 题 · \(longTask.passScore) 分及格" + }) + let width: CGFloat = 320 + let shortCell = TrainingTaskCell(style: .default, reuseIdentifier: nil) + shortCell.configure(task: original) + let shortSize = shortCell.contentView.systemLayoutSizeFitting(CGSize(width: width, height: 0), + withHorizontalFittingPriority: .required, + verticalFittingPriority: .fittingSizeLevel) + let size = cell.contentView.systemLayoutSizeFitting(CGSize(width: width, height: 0), + withHorizontalFittingPriority: .required, + verticalFittingPriority: .fittingSizeLevel) + cell.frame = CGRect(x: 0, y: 0, width: width, height: size.height) + cell.layoutIfNeeded() + #expect(size.height > shortSize.height) + for label in allViews(cell.contentView).compactMap({ $0 as? UILabel }).filter(isVisible) { + let frame = label.convert(label.bounds, to: cell.contentView) + #expect(frame.minX >= 0 && frame.maxX <= width + 1) + #expect(frame.minY >= 0 && frame.maxY <= size.height + 1) + } + let cardImage = UIGraphicsImageRenderer(size: cell.bounds.size).image { context in + cell.layer.render(in: context.cgContext) + } + Attachment.record(cardImage, named: "320点长标题任务卡", as: .png) + cell.configure(task: try await source.task(id: "demo-study")) + #expect(allViews(cell.contentView).compactMap { $0 as? UILabel }.contains { $0.text == "仅学习" }) + } + + @Test("任务页三种筛选独立查询,已结束任务显示回顾入口") + func endedFilterAndReadOnlyCard() async throws { + let source = TrainingDataStub() + await source.configure { + $0.tasksHandler = { status, _, _, _ in + let state = status ?? .pendingExam + return TrainingCursorPage(items: [TrainingRemoteFixtures.task(id: state.apiValue, + title: "\(state.title)任务", learnerStatus: state)], nextCursor: nil, hasMore: false, serverTime: nil) + } + } + for width: CGFloat in [320, 390] { + let controller = TrainingCenterViewController(service: source) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation, width: width) + defer { window.isHidden = true } + controller.selectTab(.tasks) + let buttons = allViews(controller.view).compactMap { $0 as? UIButton } + .filter { $0.accessibilityIdentifier?.hasPrefix("training.filter.") == true } + #expect(buttons.count == 3) + for state in [TrainingLearnerStatus.ended, .completed, .pendingExam, .ended] { + let index = try #require(TrainingLearnerStatus.allCases.firstIndex(of: state)) + let button = try #require(buttons.first { $0.tag == index }) + button.sendActions(for: .touchUpInside) + let deadline = ContinuousClock.now.advanced(by: .seconds(5)) + while ContinuousClock.now < deadline { + navigation.view.layoutIfNeeded() + let hasTask = allViews(controller.view).compactMap { $0 as? UILabel }.contains { $0.text == "\(state.title)任务" } + if button.accessibilityTraits.contains(.selected), hasTask { break } + try await Task.sleep(for: .milliseconds(10)) + } + #expect(button.accessibilityTraits.contains(.selected)) + #expect(buttons.filter { $0.accessibilityTraits.contains(.selected) }.count == 1) + #expect(allViews(controller.view).compactMap { $0 as? UILabel }.contains { $0.text == "\(state.title)任务" }) + } + #expect(buttons.map { $0.configuration?.title } == ["待考试 1", "已完成 0", "已结束"]) + for button in buttons { + let frame = button.convert(button.bounds, to: controller.view) + #expect(frame.minX >= 0 && frame.maxX <= width + 1) + #expect(frame.height >= 44) + } + let labels = allViews(controller.view).compactMap { $0 as? UILabel } + #expect(labels.contains { $0.text == "已结束" && $0.textColor == TrainingUI.muted }) + #expect(labels.contains { $0.text == "任务已结束,仅可回顾课程内容" }) + let action = try #require(allViews(controller.view).compactMap { $0 as? UIButton } + .first { $0.accessibilityIdentifier == "training.task.action.ended" }) + #expect(action.configuration?.title == "回顾学习") + #expect(action.isEnabled) + Attachment.record(render(navigation.view), named: "\(Int(width))点-已结束筛选与只读任务", as: .png) + } + } + + @Test("课程与考试步骤等宽居中,窄屏和大字体不裁切") + func learningAndExamStepLayout() async throws { + for width: CGFloat in [320, 390] { + let domain = "training_step_layout_\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: domain)) + defer { defaults.removePersistentDomain(forName: domain) } + let context = TrainingContext(accountScope: domain, scenicID: 1, storeID: 1) + let model = TrainingRemoteExamViewModel(taskID: "task_1", context: context, + pendingStore: TrainingPendingSubmissionStore(defaults: defaults), currentContext: { context }) + let source = TrainingDataStub() + let course = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: TrainingFixtureDocumentLoader()) + let exam = TrainingExamViewController(taskID: "task_1", service: source, viewModel: model) + for (controller, selectedTitle) in [(course as UIViewController, "1 课程学习"), (exam, "2 在线考试")] { + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation, width: width) + defer { window.isHidden = true } + let isReady: () -> Bool = { + guard self.allViews(controller.view).contains(where: { $0 is TrainingStepView && !$0.isHidden }) else { return false } + if controller === course { + return self.allViews(controller.view).compactMap({ $0 as? TrainingDocumentPreviewView }).first?.isReady == true + } + return model.canEdit + } + let deadline = ContinuousClock.now.advanced(by: .seconds(15)) + while !isReady(), ContinuousClock.now < deadline { + try await Task.sleep(for: .milliseconds(10)) + } + #expect(isReady()) + let steps = allViews(controller.view).compactMap { $0 as? TrainingStepView } + #expect(steps.count == 1) + let step = try #require(steps.first) + navigation.view.layoutIfNeeded() + let labels = allViews(step).compactMap { $0 as? UILabel } + #expect(labels.map(\.text) == ["1 课程学习", "2 在线考试"]) + let first = try #require(labels.first) + let second = try #require(labels.last) + #expect(abs(first.bounds.width - second.bounds.width) < 1) + #expect(first.convert(first.bounds, to: step).maxX <= second.convert(second.bounds, to: step).minX) + #expect(labels.allSatisfy { $0.textAlignment == .center }) + #expect(labels.filter { $0.accessibilityTraits.contains(.selected) }.map(\.text) == [selectedTitle]) + #expect(labels.first { $0.text == selectedTitle }?.textColor == TrainingUI.primary) + #expect(step.bounds.height >= 44) + if controller === course { + let buttons = allViews(controller.view).compactMap { $0 as? UIButton } + #expect(!buttons.contains { $0.accessibilityIdentifier == "training.reading.sections" || $0.accessibilityIdentifier == "training.reading.attachments" }) + #expect(!buttons.contains { $0.configuration?.title == "章节目录" || $0.configuration?.title == "课程附件" }) + #expect(!buttons.contains { $0.accessibilityIdentifier == "training.reading.documentPicker" }) + #expect(!buttons.contains { $0.configuration?.title == "切换附件" || $0.configuration?.title == "培训资料.txt" }) + let frame = step.convert(step.bounds, to: controller.view) + #expect(abs(frame.minY - controller.view.safeAreaInsets.top - 8) < 1) + let preview = try #require(allViews(controller.view).compactMap { $0 as? TrainingDocumentPreviewView }.first) + let scroll = try #require(preview.superview?.superview as? UIScrollView) + #expect(abs(scroll.frame.minY - frame.maxY - 8) < 1) + let metadataLabels = allViews(controller.view).compactMap { $0 as? UILabel }.filter { + ["training.reading.taskTitle", "training.reading.courseName", "training.reading.examInfo", "training.reading.introduction"].contains($0.accessibilityIdentifier ?? "") + } + #expect(metadataLabels.count == 4) + for label in metadataLabels { + let labelFrame = label.convert(label.bounds, to: scroll) + #expect(labelFrame.minX >= 0 && labelFrame.maxX <= scroll.bounds.width + 1) + #expect(label.numberOfLines == 0) + } + let web = try #require(allViews(preview).compactMap { $0 as? WKWebView }.first) + if width == 390 { + let webImage = try await web.takeSnapshot(configuration: nil) + let image = UIGraphicsImageRenderer(size: navigation.view.bounds.size).image { _ in + navigation.view.drawHierarchy(in: navigation.view.bounds, afterScreenUpdates: true) + webImage.draw(in: web.convert(web.bounds, to: navigation.view)) + } + Attachment.record(image, named: "课程页原生信息与附件正文", as: .png) + } + } + Attachment.record(render(step), named: "\(Int(width))点-\(selectedTitle)", as: .png) + + if width == 320 { + navigation.setOverrideTraitCollection(UITraitCollection(preferredContentSizeCategory: .accessibilityExtraExtraExtraLarge), forChild: controller) + navigation.view.layoutIfNeeded() + #expect(first.font.pointSize > 13) + for label in labels { + let frame = label.convert(label.bounds, to: step) + #expect(frame.minY >= 0 && frame.maxY <= step.bounds.height + 1) + #expect(label.sizeThatFits(CGSize(width: label.bounds.width, height: .greatestFiniteMagnitude)).height <= label.bounds.height + 1) + } + Attachment.record(render(step), named: "大字体-\(selectedTitle)", as: .png) + } + if controller === course { + step.configure(mode: .study) + #expect(second.text == "完成学习") + #expect(first.accessibilityTraits.contains(.selected)) + } + } + } + } + + @Test("未通过成绩可展开解析并返回已有课程,旧失败成绩在通过后不可重考") + func resultLearningAndReviewNavigation() async throws { + let source = TrainingDataStub() + await source.configure { $0.attemptHandler = { _ in TrainingRemoteFixtures.result(passed: false) } } + let attempt = TrainingRemoteFixtures.attempt(passed: false) + let center = TrainingCenterViewController(service: source) + let course = TrainingCourseViewController(taskID: "task_1", service: source, documentLoader: TrainingFixtureDocumentLoader()) + let result = TrainingResultViewController(taskID: "task_1", attemptID: attempt.id, service: source, documentLoader: TrainingFixtureDocumentLoader()) + let navigation = UINavigationController() + navigation.setViewControllers([center, course, result], animated: false) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + result.loadViewIfNeeded() + await result.reload() + try await settleTransitions(in: navigation) + navigation.view.layoutIfNeeded() + let learning = try #require(allViews(result.view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == "training.result.learning" }) + let details = try #require(allViews(result.view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == "training.result.details" }) + let action = try #require(allViews(result.view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == "training.result.action" }) + #expect(action.configuration?.title == "再考一次") + #expect(!allViews(result.view).compactMap { $0 as? UILabel }.contains { $0.text == TrainingRemoteFixtures.review().stem }) + Attachment.record(render(navigation.view), named: "未通过成绩默认收起解析", as: .png) + details.sendActions(for: .touchUpInside) + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !allViews(result.view).compactMap({ $0 as? UILabel }).contains(where: { $0.text == TrainingRemoteFixtures.review().stem }), ContinuousClock.now < deadline { + try await Task.sleep(for: .milliseconds(10)) + } + navigation.view.layoutIfNeeded() + #expect(allViews(result.view).compactMap { $0 as? UILabel }.contains { $0.text == TrainingRemoteFixtures.review().stem }) + Attachment.record(render(navigation.view), named: "成绩答案解析展开", as: .png) + learning.sendActions(for: .touchUpInside) + try await waitForNavigation(in: navigation) { $0 === course } + try await settleTransitions(in: navigation) + #expect(navigation.topViewController === course) + navigation.setViewControllers([center, result], animated: false) + try await settleTransitions(in: navigation) + await result.reload() + let newLearning = try #require(allViews(result.view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == "training.result.learning" }) + newLearning.sendActions(for: .touchUpInside) + try await waitForNavigation(in: navigation) { ($0 as? TrainingCourseViewController)?.taskID == "task_1" } + try await settleTransitions(in: navigation) + #expect((navigation.topViewController as? TrainingCourseViewController)?.taskID == "task_1") + await source.configure { $0.attemptHandler = { _ in + TrainingAttemptDetail(attempt: TrainingRemoteFixtures.attempt(passed: false), taskState: TrainingRemoteFixtures.result(passed: true).taskState, serverTime: TrainingRemoteFixtures.now) + } } + let passed = TrainingRemoteFixtures.attempt(passed: true) + navigation.setViewControllers([center, result], animated: false) + try await settleTransitions(in: navigation) + await result.reload() + #expect(action.configuration?.title == "完成,返回培训中心") + await source.configure { $0.attemptHandler = { _ in TrainingRemoteFixtures.result(passed: true) } } + let passedResult = TrainingResultViewController(taskID: "task_1", attemptID: passed.id, service: source, documentLoader: TrainingFixtureDocumentLoader()) + navigation.setViewControllers([center, passedResult], animated: false) + try await settleTransitions(in: navigation) + await passedResult.reload() + navigation.view.layoutIfNeeded() + Attachment.record(render(navigation.view), named: "通过成绩仍可返回学习", as: .png) + let completion = try #require(allViews(passedResult.view).compactMap { $0 as? UIButton }.first { $0.accessibilityIdentifier == "training.result.action" }) + completion.sendActions(for: .touchUpInside) + try await waitForNavigation(in: navigation) { $0 === center } + try await settleTransitions(in: navigation) + #expect(navigation.topViewController === center) + } + + private func makeWindow(_ navigation: UINavigationController, width: CGFloat = 390) throws -> UIWindow { + let scene = try #require(UIApplication.shared.connectedScenes.first as? UIWindowScene) + let window = UIWindow(windowScene: scene) + window.frame = CGRect(x: 0, y: 0, width: width, height: 844) + window.rootViewController = navigation + window.makeKeyAndVisible() + navigation.view.layoutIfNeeded() + return window + } + + private func render(_ view: UIView) -> UIImage { + UIGraphicsImageRenderer(size: view.bounds.size).image { context in view.layer.render(in: context.cgContext) } + } + + @Test("100题答题卡可滚动并保留当前题与已答状态") + func largeAnswerCardIsScrollable() async throws { + let original = TrainingDemoFixtures.makePacks(now: Date())[0].task + let questions = (0..<100).map { TrainingQuestion(id: "q\($0)", type: .single, stem: "题目\($0)", options: original.questions[0].options) } + let task = TrainingTask(id: original.id, title: original.title, publisherName: nil, mode: .exam, status: .published, + startAt: original.startAt, endAt: original.endAt, passScore: 80, scoring: original.scoring, + course: original.course, questions: questions, progress: original.progress) + let controller = TrainingAnswerCardViewController(task: task, answers: ["q0": ["A"], "q4": ["B"]], currentIndex: 4) + let navigation = UINavigationController(rootViewController: controller) + let window = try makeWindow(navigation) + defer { window.isHidden = true } + let collection = try #require(allViews(controller.view).first { $0 is UICollectionView } as? UICollectionView) + let currentCell = try await waitForVisibleCell(at: IndexPath(item: 4, section: 0), in: collection) + #expect(collection.numberOfItems(inSection: 0) == 100) + #expect(collection.contentSize.height > collection.bounds.height) + #expect(currentCell.accessibilityLabel == "第 5 题,已答,当前题") + let firstCell = try #require(collection.cellForItem(at: IndexPath(item: 0, section: 0))) + let secondRowCell = try #require(collection.cellForItem(at: IndexPath(item: 5, section: 0))) + #expect(abs(firstCell.frame.minY - currentCell.frame.minY) < 1) + #expect(currentCell.frame.maxX <= collection.bounds.width) + #expect(secondRowCell.frame.minY > currentCell.frame.maxY) + let image = UIGraphicsImageRenderer(size: controller.view.bounds.size).image { context in + controller.view.layer.render(in: context.cgContext) + } + Attachment.record(image, named: "100题答题卡", as: .png) + } + + /// 等待实际目标页面,避免转场尚未开始时误把 nil coordinator 当作完成。 + private func waitForNavigation(in navigation: UINavigationController, matches: (UIViewController?) -> Bool) async throws { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while !matches(navigation.topViewController), ContinuousClock.now < deadline { + try await Task.sleep(for: .milliseconds(10)) + } + let reached = matches(navigation.topViewController) + try #require(reached) + } + + /// 前一导航动画结束后再执行后续操作,避免测试同时驱动互相冲突的转场。 + private func settleTransitions(in navigation: UINavigationController) async throws { + await Task.yield() + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while navigation.transitionCoordinator != nil, ContinuousClock.now < deadline { + try await Task.sleep(for: .milliseconds(10)) + } + #expect(navigation.transitionCoordinator == nil) + } + + /// 按实际可见状态等待差异化列表动画,超时后让测试明确失败。 + private func waitForVisibleCell(at indexPath: IndexPath, in collection: UICollectionView) async throws -> UICollectionViewCell { + let deadline = ContinuousClock.now.advanced(by: .seconds(3)) + while ContinuousClock.now < deadline { + collection.layoutIfNeeded() + if let cell = collection.cellForItem(at: indexPath) { return cell } + try await Task.sleep(for: .milliseconds(10)) + } + return try #require(collection.cellForItem(at: indexPath)) + } + + private func allViews(_ view: UIView) -> [UIView] { + [view] + view.subviews.flatMap(allViews) + } + + private func isVisible(_ view: UIView) -> Bool { + if view.isHidden { return false } + return view.superview.map(isVisible) ?? true + } +} +#endif diff --git a/景区空境库页面接口对接记录.md b/景区空境库页面接口对接记录.md new file mode 100644 index 0000000..3d27d80 --- /dev/null +++ b/景区空境库页面接口对接记录.md @@ -0,0 +1,632 @@ +# 景区空境库页面接口对接记录 + +> 更新日期:2026-10-30(北京时间;已补充 11:49 起的时长、大小新响应及模拟器展示)\ +> 范围:随心瞰商家版 iOS「景区空境库」,首页权限 URI 为 `sceniclibrary`。朱工文档中的「景区空镜库」指同一模块。\ +> 用途:按页面记录接口、调用时机、请求参数、返回 JSON、代码位置和待补齐事项。 + +## 1. 当前接入状态与证据说明 + +**2026-10-30 测试环境已返回真实非空数据:首轮查询景区 `271` 的 90 天窗口有 `109` 个场次、`4` 条航线。当前对接根据真实响应映射场次、航线和素材,并补齐按页加载及场次详情串联;后续响应与模拟器验证状态由第 12 节单独记录,数量以各次采集为准。** + +| 标记 | 含义 | +| --- | --- | +| 真实响应 | 2026-10-30 使用当前登录账号只读查询测试环境取得;2026-10-29 空响应保留为历史证据。 | +| 缓存节选 | 从 App 已缓存的权限内容中摘取,不是本次重新请求的完整响应。 | +| 结构示意 | 为说明已知容器或参数而整理;不能当作后端实际返回或完整字段合同。 | +| 待确认 | 当前响应未覆盖的字段语义、异常与边界,不能根据样本自行推断。 | + +2026-10-29 查询时,景区 `271` 的 90 天、365 天窗口确实均为空;这不再代表当前数据状态。本轮已取得默认第一页、第二页、单条分页、日期筛选、航线 `273` 筛选,以及场次 `1433` 的详情。原先页面遇到非空响应即显示“暂时无法显示素材”的分支,是缺少字段样本时留下的客户端限制,并非本轮接口失败。 + +完整脱敏证据位于本地 [scenic-sessions-debug-2026-10-30](docs/9.9.1/scenic-sessions-debug-2026-10-30/)。真实联调 JSON 和截图仅保留本地,不随代码提交;下文对应链接用于本机复核。每个 API JSON 文件含采集时间、方法、路径、查询参数、HTTP 状态、耗时及完整 `response`;未包含登录凭证,媒体 URL 已移除查询串。 + +本记录依据: + +- 朱工提供的 `随心瞰9.9.1-App机巢与素材库接口.md`(2026-10-29 本轮提供的版本)。 +- 当前工程代码及本轮联调响应。 +- [景区空镜库 UI 实现说明](docs/9.9.1/景区空镜库UI实现说明.md)。 + +## 2. 页面与接口总表 + +| 页面 / 区域 | 接口或系统能力 | 调用时机 | 当前状态 | +| --- | --- | --- | --- | +| 首页「景区空境库」入口 | `GET /api/yf-handset-app/role-permission` | 首页初始化、需要重新加载权限时 | 已接入,按当前角色顶层权限展示入口。 | +| 「全部功能」中的空境库入口 | 读取首页缓存的权限,无独立素材请求 | 进入全部功能、权限更新、调整常用应用时 | 已接入;添加常用只保存本地配置。 | +| 景区空境库主页面 | `GET /api/app/scenic-media/sessions` | 首次进入、下拉刷新、失败重试、应用/重置筛选及加载下一页时 | 根据 10/30 真实 `list`、分页信息映射;按页追加实现本轮补齐。 | +| 航线筛选弹层 | 使用列表的 `filter_options.air_lines`;确认后由主页面再请求 `sessions` | 打开弹层不发请求,确认选项后更新查询 | 根据 10/30 真实 `air_line_id`、`route_label/air_line_name` 映射;已实测航线 273 筛选。 | +| 时间筛选弹层 | 确认后由主页面再请求 `sessions` | 确认有效日期范围或选择全部时间 | 已接入日期参数;弹层本身没有单独接口。 | +| 场次片段展示(主页面内分组,非独立详情页) | `GET /api/app/scenic-media/session-detail` | 列表取得 `scenic_media_id` 后读取该场次完整片段 | 根据 10/30 详情中的 `session`、`materials` 映射,本轮补齐列表与详情串联。 | +| 视频预览弹层 | AVPlayer 读取 `oss_url`;Kingfisher 读取 `cover_url` | 点击预览/播放 | 数据来源已由真实详情确认;不新增业务 JSON 接口。真实播放结果另行验证。 | +| 下载栏 / 进度 / 失败重试 | URLSession 下载 `oss_url`,Photos 保存相册 | 用户开始、继续或重试下载 | 按详情的素材身份及可选状态映射;本轮未以接口成功代替真实下载保存成功。 | +| 相册权限提示 / 去设置 | Photos `.addOnly` 授权、系统设置 | 下载前无添加权限 | 系统能力,无业务 JSON。 | +| Debug「空镜预览」与状态菜单 | 本地演示数据和随包视频 | 显式打开 Debug 预览 | 不请求上述素材业务接口,不保存真实素材。 | + +## 3. 公共请求与响应约定 + +| 项目 | 当前工程与联调结果 | +| --- | --- | +| 测试环境 | `https://api-test.zhifly.cn` | +| 生产环境 | `https://api.zhifly.cn`(本记录未进行生产联调) | +| 账号要求 | `store_user` 门店账号;正式页检查当前账号与当前景区是否匹配。 | +| 鉴权 | 统一 `APIClient` 注入 HTTP Header `token`;本文不保存实际凭证。 | +| 公共请求头 | `Accept: application/json`、`X-APP-VERSION`、`X-OS-TYPE`。 | +| GET 参数 | URL 查询串。 | +| 实际成功包 | `code: 100000`、`msg: "success"`、`data`,实测另含 `time`。 | +| 实际业务失败包 | 非成功 `code` 与 `msg`;不能只凭 HTTP 200 判断成功。 | +| 日志 | Debug / SimulatorDebug 下,场次与详情输出 `[API][景区空境库]` 标签、请求参数、HTTP 状态及格式化脱敏 JSON;Release 不输出。 | + +朱工文档顶部写有 `YFHandSetAppToken` 鉴权标识,示意成功包为 `code=0/message`;本轮部署接口实际使用 `token` 请求头和 `100000/msg` 包装。当前实现沿用经过实测的统一客户端,不把文档示意的 `code=0` 当成功。 + +### 3.1 控制台查看方式 + +在 Xcode 控制台搜索 `[API][景区空境库]`。进入正式空境库、刷新或确认筛选后,可见 `sessions` 的 `Request` 和 `Response`;调用场次详情 API 时同样记录 `session-detail`。网络失败标记为 `Failure`,取消标记为 `Cancelled`。本地演示模式不发业务请求,因此不会产生这两条接口日志。 + +请求日志保留景区、航线、分页和日期参数。响应 JSON 保留字段和嵌套结构,凭证字段替换为 ``;素材 URL 仅保留协议、域名及路径,删除用户信息、查询串和片段。鉴权请求头不输出,非 JSON 正文仅显示字节数。脱敏只作用于日志,不改变请求、解析结果或播放/下载地址。 + +## 4. 首页与全部功能:权限入口 + +**接口:** `GET /api/yf-handset-app/role-permission` + +本模块不增加请求参数。首页将当前角色的顶层 `role.permission` 映射为菜单,识别 URI `sceniclibrary`。本地入口标题是「景区空境库」;后台缓存名称为「景区空镜库」。 + +### 4.1 权限 JSON + +**结构示意:以下仅为响应结构与本模块节点的精简示意,不是完整抓包。** `data` 为角色数组;角色、景区、门店均可能有其他项。 + +```json +{ + "code": 100000, + "msg": "success", + "data": [ + { + "role": { + "id": 41, + "name": "app摄影师", + "role_code": "photographer", + "notes": "", + "permission": [ + { + "id": 370, + "pid": 0, + "name": "景区空镜库", + "uri": "sceniclibrary", + "icon_src": "" + } + ] + }, + "scenic": [], + "store": [] + } + ] +} +``` + +其中 `id=370` 的权限节点来自本轮已查看的 App 缓存;代码只匹配 `uri`,不硬编码权限 ID。示意中的空 `scenic/store` 只为精简结构,不表示当前账号没有景区或门店。 + +### 4.2 页面行为 + +- 有该权限时入口进入可用菜单;已有常用配置时,可在「更多功能」中加入首页常用。 +- 没有自定义配置时沿用默认前四项规则,不保证新权限直接出现在首页常用区。 +- 权限刷新后撤销该 URI,入口从首页和全部功能隐藏;旧常用配置不能绕过权限。 +- 首页路由要求已选择景区;正式素材页发请求前进一步要求门店账号与进入页时的账号、景区一致。 + +代码:[HomeAPI](suixinkan/Features/Home/API/HomeAPI.swift)、[HomeViewModel](suixinkan/Features/Home/ViewModels/HomeViewModel.swift)、[HomeMenuCatalog](suixinkan/Features/Home/Services/HomeMenuCatalog.swift)、[HomeRouteHandler](suixinkan/Features/Home/Services/HomeRouteHandler.swift)。 + +## 5. 景区空境库主页面:场次列表 + +页面:`ScenicMaterialsViewController`。 + +**接口:** `GET /api/app/scenic-media/sessions` + +### 5.1 请求参数 + +| 参数 | 必填 | 默认值 / 范围 | 用途 | +| --- | --- | --- | --- | +| `scenic_id` | 是 | 当前景区,正整数 | 限定景区。 | +| `page` | 否 | `1`,正整数 | 场次页码。 | +| `page_size` | 否 | `20`,`1...100` | 每页场次数。 | +| `air_line_id` | 否 | 不传代表全部航线;指定时正整数 | 航线筛选。 | +| `date_from` | 否 | `yyyy-MM-dd` | 起始日期。 | +| `date_to` | 否 | `yyyy-MM-dd` | 结束日期。 | +| `retention_days` | 否 | `90`;客户端限制 `1...365` | 保留期查询窗口;上限 365 已由真实错误响应验证。 | + +主页面从第 1 页开始,每页 20 条;本轮按真实 `total/page/page_size` 补齐下一页追加。刷新或筛选变化从第 1 页重新开始,避免将不同查询范围混到同一列表。 + +正式页面首次请求示意: + +```http +GET /api/app/scenic-media/sessions?scenic_id=271&page=1&page_size=20&retention_days=90 +``` + +### 5.2 本轮真实返回:109 个场次、4 条航线 + +以下请求均为测试环境只读 GET,HTTP `200`、业务 `code=100000`。 + +| 请求 | 采集时间(2026-10-30,北京时间) | 结果 | 完整脱敏 JSON | +| --- | --- | --- | --- | +| 默认 `page=1&page_size=20&retention_days=90` | 11:10:13 | `total=109`,本页 20 个场次,首个 1433 | [default.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/default.json) | +| `page=2&page_size=20` | 11:10:28 | `total=109`,本页 20 个场次,首个 1413 | [page2.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/page2.json) | +| `page=1&page_size=1` | 11:10:28 | `total=109`,本页只有场次 1433 | [size1.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/size1.json) | +| `date_from=2026-10-24&date_to=2026-10-30` | 11:10:27 | `total=17`,本页 17 个场次 | [date.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/date.json) | +| `air_line_id=273` | 11:11:23 | `total=2`,场次 1327、1326 | [route273.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/route273.json) | + +以上均使用 `scenic_id=271`、`retention_days=90`;未特别注明时为第 1 页、每页 20 条。`groups[].sessions` 是同一页 `list` 按航线分组后的内容,不应重复插入。`filter_options.air_lines` 在日期或航线筛选后仍返回全部 4 个选项和 105 / 2 / 1 / 1 的场次数,不等于当前筛选的 `total`。 + +下面是 `page_size=1` 请求的完整真实响应,便于同时查看场次、分组和航线字段: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "list": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ], + "groups": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "sessions": [ + { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "sync_time": "2026-10-29 11:29:42", + "time_label": "10-29 11:01 · 8 段素材", + "name": "赛湖东岸八分钟观景航线2026-10-29 11:01:56", + "material_count": 8, + "source": "fly_plan" + } + ] + } + ], + "total": 109, + "page": 1, + "page_size": 1, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [ + { + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "session_count": 105 + }, + { + "air_line_id": 273, + "air_line_name": "三台观景航线(5、6镜头)", + "route_label": "三台观景航线(5、6镜头)", + "session_count": 2 + }, + { + "air_line_id": 264, + "air_line_name": "三台观景航线(7、8镜头)", + "route_label": "三台观景航线(7、8镜头)", + "session_count": 1 + }, + { + "air_line_id": 254, + "air_line_name": "三台观景航线(1、2镜头)", + "route_label": "三台观景航线(1、2镜头)", + "session_count": 1 + } + ] + } + }, + "time": "2026-10-30 11:10:28" +} +``` + +### 5.3 历史真实返回 JSON:90 天空列表 + +采集时间:2026-10-29 17:49:53。只读联调请求传入 `scenic_id=271&page=1&page_size=20`,未显式传 `retention_days`,服务端按默认 90 天返回。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "list": [], + "groups": [], + "total": 0, + "page": 1, + "page_size": 20, + "retention_days": 90, + "retention_tips": "素材保留 90 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [] + } + }, + "time": "2026-10-29 17:49:53" +} +``` + +### 5.4 已确认的根字段与场次字段 + +| JSON 路径 | 实测形态 | 页面用途与当前限制 | +| --- | --- | --- | +| `data.list` | 场次对象数组 | 当前页场次;身份为 `scenic_media_id`,不是素材 ID。 | +| `data.groups` | 航线对象数组,内含 `sessions[]` | 同一页场次按 `air_line_id` 分组;不与 `list` 重复累计。 | +| `data.total` | 整数 | 当前筛选的总场次数。 | +| `data.page` / `data.page_size` | 整数 | 当前页与每页数量;API 校验与请求一致。 | +| `data.retention_days` | 整数 | 查询窗口及日期范围限制。 | +| `data.retention_tips` | 字符串 | 页面保留期说明。 | +| `data.filter.air_line_id` | 整数,全部为 `0` | 回显实际航线筛选。 | +| `data.filter.date_from` / `date_to` | 字符串,未筛选为空字符串 | 回显实际日期筛选。 | +| `data.filter_options.air_lines` | 航线对象数组 | 使用 `air_line_id`、`air_line_name`、`route_label`;`session_count` 不是当前筛选结果总数。 | +| `time` | 字符串 | 后端响应时间,当前业务模型不使用它定位素材。 | + +场次子项由 10/30 真实响应确认: + +| 场次字段 | 实测形态 / 用途 | +| --- | --- | +| `scenic_media_id` | 整数,场次身份;传给 `session-detail`。 | +| `scenic_id` | 整数,当前景区;核对不能混入其他景区。 | +| `air_line_id` | 整数,关联航线筛选和分组。 | +| `air_line_name` / `route_label` | 字符串,本轮样本两者相同,用于航线名称。 | +| `log_stime` / `log_etime` | `yyyy-MM-dd HH:mm:ss`,场次拍摄起止时间;UI 拍摄时间取开始时间。 | +| `sync_time` | 同格式时间字符串,同步时间,不当作拍摄时间。 | +| `time_label` | 如 `10-29 11:01 · 8 段素材`,服务端展示文案。 | +| `name` | 场次名称字符串。 | +| `material_count` | 整数,场次片段数;列表本身不含完整素材数组。 | +| `source` | 本轮为 `fly_plan`。 | + +保留期存在需核对的边界:10/30 的 `retention_days=90` 响应包含 08/01 场次,而“包含今天共 90 个日历日”的客户端算法下界为 08/02。正式列表应以服务端返回范围为准,避免二次过滤丢失已返回的场次;精确的保留期边界语义仍需后端说明。 + +### 5.5 历史真实返回 JSON:365 天空列表 + +采集时间:2026-10-29 17:50:45。此请求仅用于检查是否有历史样本,不是正式页面默认窗口。 + +```http +GET /api/app/scenic-media/sessions?scenic_id=271&page=1&page_size=100&retention_days=365 +``` + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "list": [], + "groups": [], + "total": 0, + "page": 1, + "page_size": 100, + "retention_days": 365, + "retention_tips": "素材保留 365 天,请及时下载", + "filter": { + "air_line_id": 0, + "date_from": "", + "date_to": "" + }, + "filter_options": { + "air_lines": [] + } + }, + "time": "2026-10-29 17:50:45" +} +``` + +### 5.6 历史真实返回 JSON:保留期超限 + +联调时传入 `retention_days=3650`,服务端返回如下错误,随后改用上限 365 查询。正式客户端会在发请求前拒绝超限参数。 + +```json +{ + "code": 100099, + "msg": "The retention days may not be greater than 365.", + "data": [], + "time": "2026-10-29 17:50:26" +} +``` + +### 5.7 加载、刷新与重试 + +首次进入、下拉刷新、点击「重新加载」都请求第 1 页;筛选变化重新建立查询范围。下一页沿用同一筛选并按场次身份追加,依据 `total` 和本页返回数量判断结束;后续页失败不能清掉已加载素材。列表取得场次身份后,调用详情获取片段。素材下载批次锁定期间不刷新;确认离页后取消加载并丢弃迟到回执,取消返回手势则保留原加载。当前没有定时轮询。本段描述本轮对接行为,测试完成情况见第 12 节。 + +代码:[ScenicMaterialsAPI](suixinkan/Features/ScenicMaterials/API/ScenicMaterialsAPI.swift)、[ScenicMaterialsQuery](suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsQuery.swift)、[ScenicMaterialsAPIModels](suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsAPIModels.swift)、[ScenicMaterialsViewModel](suixinkan/Features/ScenicMaterials/ViewModels/ScenicMaterialsViewModel.swift)、[ScenicMaterialsViewController](suixinkan/UI/ScenicMaterials/ScenicMaterialsViewController.swift)。 + +## 6. 航线筛选弹层 + +页面:`ScenicMaterialRouteFilterViewController`。 + +打开弹层没有独立接口,读取 `sessions.data.filter_options.air_lines`。本轮真实航线如下: + +| `air_line_id` | `route_label` / `air_line_name` | `session_count` | +| --- | --- | --- | +| 287 | 赛湖东岸八分钟观景航线 | 105 | +| 273 | 三台观景航线(5、6镜头) | 2 | +| 264 | 三台观景航线(7、8镜头) | 1 | +| 254 | 三台观景航线(1、2镜头) | 1 | + +选中航线后由主页面重新请求第 1 页。以下为 10/30 11:11:23 的真实请求: + +```http +GET /api/app/scenic-media/sessions?scenic_id=271&page=1&page_size=20&retention_days=90&air_line_id=273 +``` + +返回 `total=2`,`filter.air_line_id=273`,场次为 1327、1326;完整响应见 [route273.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/route273.json)。`filter_options` 仍包含全部 4 条航线,避免筛选后丢失其他选项。选择「全部航线」时省略 `air_line_id`。 + +代码:[ScenicMaterialFilterViewControllers](suixinkan/UI/ScenicMaterials/ScenicMaterialFilterViewControllers.swift)。 + +## 7. 时间筛选弹层 + +页面:`ScenicMaterialDateFilterViewController`。 + +打开弹层、滚动日期、取消弹层均不请求接口;确认有效起止日期后由主页面重新请求第 1 页。查询日期使用 `yyyy-MM-dd`;UI 选区包含首尾日期,不选择未来日期。 + +10/30 11:10:27 真实请求: + +```http +GET /api/app/scenic-media/sessions?scenic_id=271&page=1&page_size=20&retention_days=90&date_from=2026-10-24&date_to=2026-10-30 +``` + +返回 `total=17`,17 个场次均处于所查日期范围,首个场次为 1433;完整响应见 [date.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/date.json)。以下为该响应的真实筛选回显节选: + +```json +{ + "filter": { + "air_line_id": 0, + "date_from": "2026-10-24", + "date_to": "2026-10-30" + } +} +``` + +选择全部时间时不传 `date_from/date_to`;主页面「重置筛选」同时清空航线与时间并重新请求。API 层允许只传一个日期端点,当前页面交互要求两个日期一起确定。跨零点及保留期首日边界仍需与后端约定核对,不能把此次日期样本当成所有边界均已验证。 + +## 8. 场次片段展示:场次详情接口 + +UI 没有单独的场次详情控制器,片段在空境库主页面按场次显示。 + +**接口:** `GET /api/app/scenic-media/session-detail` + +| 参数 | 必填 | 说明 | +| --- | --- | --- | +| `scenic_media_id` | 是 | 来源为 `sessions.data.list[].scenic_media_id`,正整数。不是订单 ID、飞行任务 ID 或片段 ID。 | + +本轮真实请求: + +```http +GET /api/app/scenic-media/session-detail?scenic_media_id=1433 +``` + +### 8.1 真实返回 JSON 与字段映射 + +10/30 11:11:24 返回 HTTP `200`、`code=100000`,包含 `session`、8 个 `materials` 和 `material_count=8`。完整脱敏响应见 [detail1433.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/detail1433.json)。以下节选保留为历史证据;11:49 新响应已补充时长并修正文件大小,当前字段与展示见第 12.3 节。 + +以下为真实响应节选,仅保留第一段素材;`material_count=8` 是后端真实总数,其余 7 项请查看完整文件: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "session": { + "scenic_media_id": 1433, + "scenic_id": 271, + "air_line_id": 287, + "air_line_name": "赛湖东岸八分钟观景航线", + "route_label": "赛湖东岸八分钟观景航线", + "log_stime": "2026-10-29 11:01:56", + "log_etime": "2026-10-29 11:09:53", + "time_label": "10-29 11:01 · 8 段素材", + "group_select_label": "10-29 11:01 8 段素材" + }, + "materials": [ + { + "id": 5413, + "view_album_detail_id": 5413, + "scenic_media_id": 1433, + "fly_plan_log_id": 3571, + "clip_no": "01", + "file_label": "片段1", + "preview_label": "10-29 11:01片段1", + "file_type": 2, + "oss_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120552_0008_V.mp4", + "cover_url": "https://capture-android-dev.oss-cn-shanghai.aliyuncs.com/fly-prod/260323/DJI_20260323120552_0008_V.jpg", + "size_bytes": 67541303296, + "download_times": 9, + "handpick": 1, + "selectable": true, + "downloadable": true, + "source": "fly_plan" + } + ], + "material_count": 8 + }, + "time": "2026-10-30 11:11:24" +} +``` + +| JSON 路径 | 本轮实测形态与用途 | +| --- | --- | +| `session.scenic_media_id/scenic_id/air_line_id` | 场次、景区和航线整数身份,需与列表场次核对。 | +| `session.route_label/air_line_name` | 航线名称字符串。 | +| `session.log_stime/log_etime` | 场次起止时间字符串。 | +| `session.time_label/group_select_label` | 场次展示及组选择文案。 | +| `materials[].id/view_album_detail_id` | 本轮两者相等,片段身份;不能拿来调用场次详情。 | +| `materials[].scenic_media_id` | 所属场次,须与请求一致。 | +| `materials[].fly_plan_log_id` | 飞行计划日志身份,仅保留,不能当作场次 ID。 | +| `materials[].clip_no/file_label/preview_label` | 字符串,分别用于片段序号、名称和预览说明。 | +| `materials[].oss_url/cover_url` | 字符串,原片与封面 URL;文档证据已移除查询串。 | +| `materials[].selectable/downloadable` | 本轮为布尔值 `true`,表示选择和下载能力。 | +| `materials[].file_type` | 本轮为整数 `2`,该样本 OSS 返回 `video/mp4`;其他类型枚举需后端说明。 | +| `materials[].duration_seconds` | 11:49 新响应提供的整数秒数,映射片段时长;异常样本见第 12.3 节。 | +| `materials[].size_bytes` | 整数字节数,客户端直接映射;片段 5413 的历史大小异常已在新响应修正,详见第 9.1 节。 | +| `materials[].download_times/handpick/source` | 本轮分别为整数、整数和 `fly_plan` 字符串;不能用服务端下载次数推断本机已保存。 | + +本轮根据以上真实字段将列表场次身份连接到 `sessionDetail(scenicMediaID:)`,再映射成页面片段。列表的 `material_count` 仅为数量,不代替详情数组;身份不匹配、详情失败或缺失必须保留错误语义,不以演示素材替代。 + +代码:[ScenicMaterialsAPI](suixinkan/Features/ScenicMaterials/API/ScenicMaterialsAPI.swift)、[ScenicMaterialsAPIModels](suixinkan/Features/ScenicMaterials/Models/ScenicMaterialsAPIModels.swift)。 + +## 9. 视频预览弹层与封面 + +页面:`ScenicMaterialPreviewViewController`;列表封面由 `ScenicMaterialClipCell` 展示。 + +| 行为 | 数据来源 / 请求 | 返回内容 | +| --- | --- | --- | +| 显示封面 | Kingfisher 读取详情 `cover_url` | 图片二进制,没有业务 JSON。 | +| 点击播放 | AVPlayer / AVURLAsset 读取详情 `oss_url` | 媒体文件或播放器需要的资源,不经过 App 业务 JSON 包装。 | +| 显示片段名称 | `file_label`、`clip_no`、`preview_label` | 详情中的真实字段,不再请求业务接口。 | +| 显示时长 | 详情 `duration_seconds`,单位秒 | 首卡、普通卡和预览使用真实元数据;缺失或无效时显示“时长未知”,播放器进度独立读取实际播放时间。 | +| 文件大小 | 详情 `size_bytes`,单位字节 | 首卡和预览以十进制 MB 显示;新响应已修正片段 5413 的大小,无需除以 1024。 | +| 分辨率 | 不再展示 | 首卡和预览移除分辨率及“分辨率未知”,不再作为待后端补充的展示字段。 | +| 关闭或退到后台 | 暂停播放器 | 无接口、无 JSON。 | + +正式素材缺少地址时不会回退到随包演示视频。本轮取得真实地址不等于已完成所有素材播放、签名过期与下载保存场景验证。 + +### 9.1 历史文件大小异常:片段 5413 已修正 + +此前只对片段 `5413` 的原片做 HTTP `HEAD` 核对,未下载媒体内容: + +| 来源 | 值 | +| --- | --- | +| 详情 `size_bytes` | `67541303296` | +| OSS HTTP 状态 | `200` | +| OSS `Content-Type` | `video/mp4` | +| OSS `Content-Length` | `65958304` | +| 两者比值 | `1024` | + +历史证据见 [media-head.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/media-head.json)。11:49 新详情中,该片段的 `size_bytes` 已变为 `65958304`,与此前 HEAD 的 `Content-Length` 一致,页面显示 `66.0MB`。客户端直接使用返回的字节数,不执行除以 1024 的补偿转换;新响应见 [metadata-updated-detail1433.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-detail1433.json)。此次未再次请求视频 HEAD,也未下载媒体。该核对只确认片段 5413,不能代替所有文件的大小验证。 + +代码:[ScenicMaterialPreviewViewController](suixinkan/UI/ScenicMaterials/ScenicMaterialPreviewViewController.swift)、[ScenicMaterialComponents](suixinkan/UI/ScenicMaterials/ScenicMaterialComponents.swift)。 + +## 10. 下载栏、进度、重试与相册权限 + +这些是主页面内的操作状态和系统弹窗,没有独立业务页面接口。 + +| 步骤 | 调用内容 | 返回内容 / 成功标准 | +| --- | --- | --- | +| 请求相册权限 | `PHPhotoLibrary.requestAuthorization(for: .addOnly)` | 系统授权状态枚举,无 JSON。 | +| 下载原片 | URLSession 对片段 `remoteURL` 发出 HTTP(S) 下载请求 | 文件二进制;要求 HTTP 2xx 且本地文件非空。 | +| 写入相册 | `PHPhotoLibrary.performChanges` 添加视频资源 | 系统完成回调或错误,无 JSON;保存成功才计为已完成。 | +| 暂停 / 取消 | 停止当前下载并作废旧回执 | 本地状态变化,无业务 JSON。已提交的 Photos 保存需等待落定。 | +| 继续 / 重试失败 | 重新处理未完成项或失败项 | 复用素材地址;当前服务实例记录已保存素材,避免重复保存。 | +| 去设置 | 打开 iOS 系统设置 | 无业务接口、无 JSON。 | + +下载请求不向素材 URL 附加 App 的登录凭证。下载与保存能力此前已通过隔离测试,本轮根据真实详情映射素材身份、可选状态和原片地址。真实相册写入、实际 URL 过期和不可下载片段仍需后续场景验证;不能把只读详情成功或 HEAD 成功记为下载保存成功。保存记录目前不是跨页面的持久化下载历史。 + +代码:[ScenicMaterialDownloadService](suixinkan/Features/ScenicMaterials/Services/ScenicMaterialDownloadService.swift)、[ScenicMaterialsViewController](suixinkan/UI/ScenicMaterials/ScenicMaterialsViewController.swift)。 + +### 10.1 本模块不调用的同前缀接口 + +| 接口 | 当前不用于景区空境库的原因 | +| --- | --- | +| `GET /api/app/scenic-media/order-materials` | 查询订单素材,按订单号组织,不是空境场次列表。 | +| `POST /api/app/scenic-media/mark-download` | 文档的 `media_id` 明确为 `order_flight_task_media.id`,不能用空境场次/片段 ID 回写。 | +| `POST /api/app/scenic-media/retry-upload` | 重试订单素材上传,不能当作空境文件下载重试。 | +| `POST /api/app/scenic-media/retry-failed` | 整单重试失败上传,属于订单素材。 | + +本模块不调用机巢召唤、开始拍摄、飞控或实时图传接口。 + +## 11. 待后端补充的 JSON 与联调项目 + +| 待确认项目 | 当前证据与用途 | +| --- | --- | +| 片段 5413 的异常时长 | 11:49 详情返回 `duration_seconds=19004641`、`duration_label="5279小时4分"`,需朱工核对源视频元数据及单位。客户端仍按秒映射并显示 `5279:04:01`,不猜测换算。 | +| 保留期首日与日期边界 | 90 天窗口实际含 08/01 场次;需确认是按日界线还是时间戳截断,避免客户端二次过滤丢数据。 | +| 非视频、不可选、不可下载片段 | 当前详情仅覆盖可用视频样本,需确认类型枚举和失败原因字段。 | +| URL 有效期、过期后的刷新方式 | 文档证据已移除查询串;尚未构造有效期边界测试。 | +| 动态数据下的分页稳定性 | 已实测第 6 页 9 项、第 7 页为空;仍需后端明确新增/删除场次期间的稳定排序语义。客户端按场次 ID 去重,整页重复或提前为空时提示刷新。 | + +已取得非空 `sessions`、4 个航线选项和场次 1433 的真实详情,不再将这些列为缺失样本。时长字段已返回,片段 5413 的大小已与此前 HEAD 对齐;分辨率按产品要求不再展示,这三项不再作为待补字段。文档指明空境数据来自 `scenic_media` 场次和 `view_album / view_album_detail` 拍摄文件;具体后台录入入口仍需朱工确认。不能用订单素材样本替代空境场次样本。 + +## 12. 验证记录与后续维护 + +- 2026-10-29:测试环境景区 271 的 90 天和 365 天查询成功,均为空;3650 天请求得到保留期超限错误。这些是历史响应,不描述 10/30 的数据状态。 +- 2026-10-29:模拟器首轮 55 项测试通过;生命周期修正后追加 13 项 UI/加载回归通过,属于此前空态及隔离替身覆盖。 +- 2026-10-30 日志调整:模拟器上日志、API 和网络客户端相关 31 项测试通过,验证日志脱敏不改变传输数据;不能代替本轮非空映射验证。 +- 2026-10-30 只读真实接口:默认列表、第二页、单条分页、日期筛选、航线筛选、场次详情均为 HTTP 200 / code 100000;原始查询参数、采集时间和完整脱敏 JSON 已归档。 +- 2026-10-30 媒体核对:片段 5413 仅做 HEAD,发现 `size_bytes` 与 OSS Content-Length 差 1024 倍;未下载媒体,也未写入相册。 +- 2026-10-30 分页末尾:`page=6&page_size=20` 返回 9 项,`page=7` 返回空列表,两次 `total=109`,均 HTTP 200 / code 100000。证据:[page6.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/page6.json)、[page7.json](docs/9.9.1/scenic-sessions-debug-2026-10-30/page7.json)。 +- 最终在 iPhone 17e / iOS 27.0 模拟器运行 **80 项相关测试,全部通过,0 失败、0 跳过**。覆盖真实字段映射、最多 4 个并发详情、分页去重/重试/筛选、迟到响应、保留期边界、分页期间禁止开始下载,以及原有预览、下载替身和页面交互。结果包:`/private/tmp/suixinkan-scenic-sessions-final-20261030.xcresult`。 +- iPhone 18 Pro 模拟器使用已有登录态实测正式页面:首屏显示真实封面和 8 段素材,航线选项为 4 条;筛选航线 273 后显示 08/02 与 08/01 两场;点击加载更多后场次计数从 20/109 增加到 40/109。预览弹层正确使用真实封面和元数据。本轮未点击真实视频播放,也未执行真实下载或相册保存。 +- 所有新增客户端验证仅使用模拟器或隔离替身;不调用无人机指令,不创建真实待飞任务。真实网络联调仅调用只读素材接口、封面读取及单个视频 HEAD。 + +### 12.1 正式页面模拟器截图 + +以下为 11:49 接口更新前的真实数据历史截图,非本地演示;其中的异常文件大小来自当时的后端 `size_bytes`。最新时长、大小和去除分辨率后的截图见第 12.3 节。 + +| 真实列表 | 航线选项 | 保留期边界 | +| --- | --- | --- | +| ![真实列表](docs/9.9.1/scenic-sessions-debug-2026-10-30/library-real.jpg) | ![航线选项](docs/9.9.1/scenic-sessions-debug-2026-10-30/routes-real.jpg) | ![08/01 边界场次](docs/9.9.1/scenic-sessions-debug-2026-10-30/retention-boundary-real.jpg) | + +| 预览信息 | 第一页末尾 | 第二页末尾 | +| --- | --- | --- | +| ![预览信息](docs/9.9.1/scenic-sessions-debug-2026-10-30/preview-real.jpg) | ![20/109](docs/9.9.1/scenic-sessions-debug-2026-10-30/page1-real.jpg) | ![40/109](docs/9.9.1/scenic-sessions-debug-2026-10-30/page2-real.jpg) | + +### 12.2 时间筛选首次打开崩溃修复 + +- 2026-10-30 在 iPhone 18 Pro 模拟器复现:正式列表点击“全部时间”后发生 `Index out of range`。崩溃堆栈指向 `ScenicMaterialDateFilterViewController.pickerView(_:viewForRow:forComponent:reusing:)` 的日数组取值。 +- 原因:08/01–10/30 范围的首月有 31 行、当前月只有 30 行。滚轮先切换月份、再刷新日列,UIKit 过渡回调仍可能携带旧日列的第 31 行,造成数组越界。此前演示范围从 08/02 开始,未覆盖这一边界。 +- 修复:初始化日列的独立月份状态,再统一刷新两列并定位选中行;渲染和选择回调均检查行号,忽略过渡期无效行,不改写日期草稿或“全部时间”状态。 +- 在 iPhone 17e / iOS 27.0 模拟器执行 29 项相关测试,全部通过;包括新增 3 项真实 UIWindow 弹层回归,以及原有日期范围、页面流程、远程分页测试。结果包:`/private/tmp/suixinkan-scenic-date-crash-fix-20261030.xcresult`。 +- 修复版已在 iPhone 18 Pro 模拟器从正式列表打开时间筛选,验证切换起止端点、选择全部时间并确定可正常返回。 + +![时间筛选崩溃修复后的正式页面](docs/9.9.1/scenic-sessions-debug-2026-10-30/date-filter-crash-fixed.jpg) + +### 12.3 视频时长、大小更新与分辨率移除 + +2026-10-30 11:49:18 只读请求 `GET /api/app/scenic-media/session-detail?scenic_media_id=1433`,11:50:12 请求 `GET /api/app/scenic-media/sessions?scenic_id=271&page=1&page_size=1&retention_days=90`,均返回 HTTP `200`、`code=100000`。完整脱敏证据:[最新场次详情](docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-detail1433.json)、[最新单条分页列表](docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-size1.json)。旧响应及截图继续保留为历史记录。 + +片段元信息使用详情 `materials[].duration_seconds`(秒)及 `materials[].size_bytes`(字节),不使用场次总时长代替片段时长。以下为新详情的第一段和第八段元信息节选,省略其余字段及中间六段;不是完整响应: + +```json +[ + { + "id": 5406, + "clip_no": "01", + "duration_seconds": 9, + "duration_label": "9秒", + "size_bytes": 46778020 + }, + { + "id": 5413, + "clip_no": "08", + "duration_seconds": 19004641, + "duration_label": "5279小时4分", + "size_bytes": 65958304 + } +] +``` + +- 首卡和预览元信息显示“时长 · 大小”,真实第一段为 `00:09 · 46.8MB`;普通小卡保留时长显示。 +- 首卡与预览不再显示 `4K`、分辨率数值或“分辨率未知”。时长、大小缺失或无效时仍显示对应的未知状态,不填充演示数值。 +- 时长按秒直接映射,长视频用 `时:分:秒` 展示。片段 5413 的 `19004641` 秒显示为 `5279:04:01`;异常原值已记录,交由后端核对,不推测为毫秒或其他单位。 +- 片段 5413 的大小现为 `65958304` 字节,与此前 HEAD 一致,客户端无需除以 1024。 +- 已在模拟器正式页面查看真实列表及预览弹层。本轮只读取列表、详情和封面,未点击视频播放,未执行下载、相册保存或任何无人机指令。 +- iPhone 18 Pro / iOS 27.0 模拟器执行 26 项相关测试,全部通过,0 失败、0 跳过;覆盖 `ScenicMaterialsRemoteMapperTests`、`ScenicMaterialRemotePreviewTests`、`ScenicMaterialPreviewPlaybackTests`、`ScenicMaterialsRemotePagingTests`。结果包:`/private/tmp/suixinkan-scenic-metadata-20261030.xcresult`。 + +| 更新后的真实列表 | 更新后的真实预览 | +| --- | --- | +| ![时长及大小更新后的真实列表](docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-library.png) | ![时长及大小更新后的真实预览](docs/9.9.1/scenic-sessions-debug-2026-10-30/metadata-updated-preview.png) | + +后续每次更新请保留:页面与调用时机、实际请求参数、完整脱敏响应、采集时间和环境、当前接入状态。真实凭证和有效的签名下载 URL 不写入文档;新增示例必须标明是抓包、文档示意还是测试构造。 diff --git a/朱工-实时图传与重新召唤接口确认.md b/朱工-实时图传与重新召唤接口确认.md new file mode 100644 index 0000000..baf5909 --- /dev/null +++ b/朱工-实时图传与重新召唤接口确认.md @@ -0,0 +1,59 @@ +# 拍摄任务页:实时图传与重新召唤接口确认 + +日期:2026-10-30 + +适用范围:随心瞰商家版 iOS,类型 25 多点位航拍订单。 + +朱工,App 已完成拍摄任务页图传请求、状态展示及失败后重新召唤的客户端代码和本地模拟验证;真实图传播放仍需补齐协议。下面是现有文档已明确的约定,以及需要补充的字段与规则,可直接在原接口文档中更新。 + +**当前仍处于禁飞调试阶段。客户端只使用不联网的 Mock 和本地演示视频,不真实调用 `live` 或 `shoot`,也不创建真实待飞任务。本地模拟通过不代表后端受理、设备执行或真实图传成功。** + +## 1. 任务 ID 与调用方式 + +所有请求均使用张工 `tasks/create` 返回的订单飞行任务 ID,即 `order_flight_task.id`。不能把 `shoot` 响应中的实际航线任务 `task_id` / `wayline_task_id` 当作后续接口的 `id`。 + +| 用途 | 请求 | 客户端处理 | +| --- | --- | --- | +| 读取图传信息 | `GET /api/app/airport/live?id=501` | 当前文档要求任务已锁定 `airport_sn`,后端按任务找到飞机。 | +| 失败后重新召唤 | `POST /api/app/airport/shoot`,Body:`{"id":501,"restart":true}` | 按同一订单飞行任务预接,不再调用 `tasks/create`,不传 `plane_id` 或覆盖航线;`restart=true` 的具体规则请按第 3 节确认。 | +| 回查任务状态 | `GET /api/app/airport/shooting?id=501&live_battery=0` | 受理后读取同一任务,不把 POST 受理回执直接当作已到达,也不自动重复召唤。 | + +以上 ID 为示意值,不是本次真实联调任务。 + +## 2. 实时图传:请补齐可播放合同 + +当前 `live` 响应示例只有 `order_flight_task_id`、`airport`、`drone`、`task`、`airport_sn`、`metrics`,还没有可用于播放器建立连接的参数。请补充: + +| 需要确认 | 请提供的内容 | +| --- | --- | +| 播放技术 | 实际协议、服务厂商;若需 RTC SDK,请给 iOS SDK 名称、版本及接入文档。若是可直接播放的流,请说明协议。由后端实际实现决定,App 不预设。 | +| 连接参数 | 成功响应中全部播放参数的字段名、类型、是否可空、用途。若方案需要应用标识、房间/频道、用户标识、订阅流标识、Token 或播放 URL,请按实际方案给出,不能只返回空对象。 | +| 任务与画面对应 | 如何确认收到的是当前任务锁定飞机的画面;任务换机、重召唤后,原连接是否失效,是否需要重新获取参数。 | +| 有效期与重连 | 凭证/URL 有效期、刷新方法;断线、切后台、返回前台和重复进入页面时如何重连;是否需要主动关闭会话。 | +| 设备影响 | `GET live` 是只读已有流,还是会启动设备推流?停止、续期及重连是否会给设备下指令?请明确哪些操作具备设备副作用。 | +| 不可用状态 | 任务未锁定飞机、设备离线、暂未出流、凭证过期、无权限时的 HTTP 状态、业务码、提示文案,以及客户端是否可重试。 | + +请提供至少一份**完整、脱敏的成功 JSON**和一份**不可播放/拒绝 JSON**,包含实际统一响应包。字段结构、枚举、有效期保留;真实 Token、密钥、签名及可用设备凭证替换为占位值。播放参数的字段名应由正式合同明确,客户端不会把猜测字段当作真实协议。 + +禁飞期间,如需验证真实播放器连接,请提供明确不会操作设备的独立模拟服务或录制样例,并说明隔离方式。未确认前,App 继续使用本地文件模拟,不通过测试环境或自行增加 `dry_run` 参数尝试真实图传。 + +## 3. 重新召唤:请确认 `restart=true` 的业务规则 + +现有文档列出了 `restart`,但尚未说明失败后重启的完整语义。请确认: + +1. **适用状态与权限:**哪些任务状态、航线失败码允许重新召唤?取消任务、主动返航中断、返航中、离线、低电量是否允许?`shooting` 能否明确返回“允许重新召唤”及不可用原因,并说明字段位置和值?现有 `execute_gate.can_execute` 描述的是开始拍摄,App 不将其当成重召唤许可。 +2. **任务与飞机:**是否始终复用原 `order_flight_task.id`?是否新建实际航线任务并更新 `wayline_task_id/task_uuid`?原飞机锁定如何处理,哪些情况下重新派机?不传 `plane_id/air_line_id` 是否足够? +3. **状态、素材与次数:**重启会重置哪些失败/执行字段?原素材是否保留?拍摄次数何时扣减,如何保证同一订单飞行任务不会因重启重复扣次?已经成功计次的任务是否禁止重启? +4. **受理与设备到达:**`shoot` 返回成功代表排队、已下发还是设备已确认?后续 `shooting` 如何表示正在重新召唤、前往点位、已到达、再次失败?请给对应状态和 UI 字段示例。 +5. **重复请求与结果未知:**同一任务重复提交 `restart=true` 时后端如何防重?请求超时后应查询哪些字段判断“已受理”或“明确未执行”?何种拒绝可由用户重试,何种情况必须等待?若需要幂等标识,请给字段及生成/复用规则。 + +请补充**重召唤成功、明确拒绝**的完整脱敏响应,以及成功后的 `shooting` 状态示例。未明确结果前,客户端保持禁止重复提交,不通过重新创建任务规避失败。 + +## 4. 客户端交付边界 + +- 按现有文档接入请求参数、响应解析和任务身份校验;页面保留最近一次任务数据,避免请求时闪回空态。 +- 重新召唤使用同一任务,验证重复点击、业务拒绝、超时和离页后的迟到回执;禁飞期间仅在显式本地模拟入口开放。 +- 图传区域支持加载、不可用、失败及本地演示画面;本地视频始终标明模拟来源。收到真实播放合同前,不显示“真实图传已连接”。 +- 原有禁飞拦截继续生效。后续补齐协议后可完成真实播放器适配;真实设备联调须等禁飞限制明确解除并取得授权。 + +本文件只记录接口确认事项,不作为真实飞行或图传联调通过的验收记录。 diff --git a/朱工-拍摄任务WebSocket实时数据与HTTP兜底接入需求.md b/朱工-拍摄任务WebSocket实时数据与HTTP兜底接入需求.md new file mode 100644 index 0000000..6cf63ea --- /dev/null +++ b/朱工-拍摄任务WebSocket实时数据与HTTP兜底接入需求.md @@ -0,0 +1,284 @@ +# 拍摄任务页:WebSocket 实时数据与 HTTP 兜底接入需求 + +日期:2026-11-02 + +对接人:朱工(机巢任务状态及设备数据),iOS 客户端 + +## 0. 最新确认结果(2026-11-02) + +朱工已在接口文档 9.1 节补齐订阅协议,并经用户转述确认以下后台行为及错误响应。**客户端已接入任务 WebSocket,并在异常时使用 shooting 自动兜底;当前已完成隔离模拟器验证,真实服务推送尚未联调。** 下文第 3~7 节保留原始需求清单,已确认内容以本节和最新接口文档为准,不再作为未答复问题。 + +### 0.1 主动推送与设备读数 + +App 停止调用 `shooting` 后,服务端仍主动更新 Redis 并推送: + +| 变化 | 后端触发方式 | +|---|---| +| 到达待拍 | `RealtimeChecker` 检测到首点暂停后立即刷新推送 | +| 拍摄完成、失败等 | 航线状态变更时刷新推送 | +| 电量等设备读数 | 该任务已有 shooting 快照时,拍摄中约每 30 秒拉司空刷新,不启动图传 | + +前提:进页已写入 shooting 快照、客户端已通过 `310` 订阅,并且后端 `realtime_checker` 正常运行。联调时需由后端核实目标环境中的该进程运行情况;以上为后端确认的合同,不是客户端实测结果。 + +### 0.2 已确认协议 + +- 地址:测试 `wss://api-test.zhifly.cn/wss`,正式 `wss://api.zhifly.cn/wss`。 +- 票据:`GET /api/app/socket-token`,读取 `socket_token`、`expire_seconds`;在订阅消息的 `params` 中传票据。 +- 订阅:`{"type":310,"params":{"socket_token":"","id":501}}`。 +- 取消订阅:`{"type":311,"params":{"id":501}}`。 +- 成功包 `code=0`;订阅 ack 先于快照,包含任务身份、`subscribed`、`has_snapshot`。 +- 推送:`data.action=app_airport_shooting_updated`,`data.params` 为与 `shooting.data` 一致的完整快照,`snapshot_kind=full`。 +- 同任务先比较 `execution_batch`,再比较 `state_version`;丢弃旧批次、旧版本及重复消息。 +- `metrics_updated_at`、`metrics_stale` 表达读数时间和过期状态;连接存活与设备读数新鲜度分别判断。 +- 无缓存或尚未取得有效首份快照时,继续用 HTTP 查询;收到订阅 ack 不单独作为退出兜底的依据。 + +### 0.3 订阅失败与客户端处理 + +票据失败: + +```json +{ + "code": 100098, + "msg": "Token 校验失败或已过期", + "data": [] +} +``` + +重新获取 WebSocket 票据并重连、重新订阅;采用有间隔的重试,避免持续失败时密集请求。该码在此表示 WebSocket 票据失效,不直接将 App 登录状态清空。 + +任务订阅无权限: + +```json +{ + "code": 100099, + "msg": "无权订阅该飞行任务", + "data": [] +} +``` + +此订阅错误停止当前任务的自动订阅及 HTTP 兜底重试,提示用户返回核对账号与任务权限。按订阅场景及明确错误语义处理,不将其他 HTTP 接口的通用 `100099` 一概当作无权限。 + +失败包 `data` 为数组,必须先解析业务码再解码成功对象;WebSocket 成功码 `0` 与 App 当前 HTTP 成功码 `100000` 分开处理。 + +### 0.4 客户端实施顺序 + +1. 进入任务页先用同一任务 ID 查询 `shooting?live_battery=0`,初始化完整快照。 +2. 获取票据并通过 `310` 订阅;核对 ack 及完整推送的任务身份、批次与版本。 +3. 取得有效快照后停止常规 HTTP 轮询,优先使用推送。 +4. 连接、心跳或订阅异常时,启用串行 HTTP 兜底并尝试恢复订阅;保留旧画面。 +5. 拍摄中约 30 秒一次设备读数更新,不能用原 HTTP 的 5 秒间隔作为“无推送即断线”的阈值;普通任务状态仅变化时推送。客户端还需处理读数过期与更新异常,不能只依赖 Ping/Pong。 +6. 恢复订阅并取得有效完整状态后退出兜底;离页/后台取消当前页订阅、查询和计时。 + +客户端实现及隔离模拟器验证已完成。后续可由用户与后端核对目标环境的只读推送;本次代理未连接真实 WebSocket、未创建真实任务或调用任何设备操作。连接恢复不触发创建、召唤、开拍、安全控制或图传启动。 + +### 0.5 已实施的客户端规则 + +- 进页、回前台先 GET `shooting?id=<同一任务>&live_battery=0`,随后获取新票据、订阅 `310`。HTTP 可用后也需收到订阅 ack 和有效完整快照,才停止兜底轮询。 +- 首次取票、握手、ack/首包共限时 12 秒。每 20 秒发原生 Ping,10 秒未收到 Pong 切换兜底;不使用“5 秒没有状态消息”判断断线。 +- 重连间隔依次为 1、2、4、8、16、30 秒,之后保持 30 秒;每次重新获取票据。正常完整快照到达后重置重试次数。 +- 有效实时连接断开后立即尝试一次 GET;已有读取或操作则合并等待。后续串行 HTTP 默认 5 秒,按后端提示限制为 2~30 秒。反复重连失败不重置或加速 HTTP 计时。 +- 心跳正常但 `metrics_stale=true` 时继续保留连接,使用 HTTP 核对;拍摄中连续 120 秒没有有效完整推送也启用 HTTP。其它阶段仅变化时推送,不因静默判定异常。 +- 设备读数过期仍保留旧值,用灰色和“读数已过期”提示;页面顶部、参数和底部安全控制位置不变。 +- HTTP 与 WS 使用同一份完整快照更新入口;先比较批次,再比较版本。迟到 HTTP 成功/失败不能把更新的 WS 状态回退。旧批次、旧版本和其它任务的消息不更新 UI。 +- 离页/后台停止读取、重连和心跳,尽力发送 `311`,最多一秒后关闭连接。返回前台重新获取快照和票据。 +- `100098` 刷新 Socket 票据,不注销 App;明确无权限/任务不存在或 HTTP 鉴权失败停止自动读取、锁定操作并提示。通用 `100099` 不一概当作权限错误。 +- 保留手动刷新、手动操作后的一次状态核对。Socket 恢复不会重发任何飞控 POST。 +- 2026-11-03 按最新要求简化控制台:WS 只输出 `path=/wss`、`params` 与 `response` 的缩进 JSON;取票路径为 `/api/app/socket-token`。不再输出模块标签、心跳、重连或其它诊断元数据。内存测试的模拟来源仍记录在内部测试事件中,不表示真实后端成功。 + +### 0.6 模拟器验证结果 + +- 设备:iPhone 17 Pro 模拟器,`suixinkan-Simulator` / `SimulatorDebug`。HTTP、Socket、票据和计时均使用隔离替身,没有真实后端成功回包或飞行记录。 +- 105 项任务页/HTTP/实时订阅/开拍/指令/重召唤回归通过。最终改动后再复验实时订阅、页面及 Debug 禁飞策略共 40 项,全部通过(含重复复验,合计覆盖 113 项不同测试)。 +- 验证:订阅 ack 与首包、缓存未就绪、断线与自动重连、票据过期、无权限 `data=[]`、非法包、心跳超时、心跳正常但数据陈旧、HTTP/WS 乱序、批次切换、重复消息、后台/离页取消,以及旧数据/固定布局保留。 +- 页面场景:初始 HTTP 前往点位 → WS 到达 → 模拟断线 → HTTP 兜底拍摄中 → 新连接 WS 完成。整段仅两次模拟 shooting 读取,推送正常时无定时 HTTP。 +- 结果包:`test_sim_2026-11-02T10-05-29-217Z_pid2672_75f353a4.xcresult`(105 项)、`test_sim_2026-11-02T10-09-54-284Z_pid2672_9862b56a.xcresult`(最终 40 项),位于本机 XcodeBuildMCP 的 `result-bundles` 目录。 +- [模拟器截图:兜底后恢复推送](docs/9.9.1/shooting-websocket-2026-11-02/websocket-fallback-mock.png)。截图中的“拍摄完成”来自 Mock,并非无人机真实执行结果。 + +下文为原始对接需求存档;当前实现以第 0 节为准。 + +## 1. 本次需求 + +“拍摄任务”页面改为优先通过 WebSocket 接收实时状态和无人机参数。当连接、订阅或数据更新异常时,App 自动调用现有 `shooting` 接口查询,恢复推送后退出兜底轮询。 + +进入页面先读取一次完整状态;后续更新保留旧画面,不切回无数据状态。页面上的状态、参数、操作许可必须来自同一任务,不能因断线重连或旧消息到达而显示回旧状态。 + +本次范围: + +- WebSocket:读取任务状态、设备参数、操作许可和失败原因。 +- HTTP 查询:继续使用 `GET /api/app/airport/shooting?id=<任务ID>&live_battery=0`。 +- HTTP 操作:召唤、开始拍摄、暂停、恢复、返航等继续使用现有 `shoot`、`start-shoot`、`command` 接口。 +- 视频画面:继续使用现有 `live` 接口和火山 RTC,不通过本次 WebSocket 传输视频。 + +连接、订阅、重连及查询仅用于获取状态,不能触发召唤、起飞、拍摄或启动图传。连接恢复不会自动重发飞控操作。 + +## 2. 当前客户端已有能力 + +| 项目 | 当前情况 | +|---|---| +| 任务身份 | 张工 `tasks/create` 返回的 `task_id`,对应 `order_flight_task.id`;后续飞行接口沿用此 ID | +| 完整任务查询 | 已接入朱工 `GET /api/app/airport/shooting` | +| 当前刷新方式 | 页面前台可见时串行轮询,默认 5 秒;按 `plane_status.poll_hint_ms` 调整并限制在 2~30 秒 | +| 页面更新 | 刷新期间保留旧数据;离页、后台停止轮询;校验任务、订单和景区身份 | +| 现有 WebSocket 配置 | 工程已有测试 `wss://api-test.zhifly.cn/wss`、正式 `wss://api.zhifly.cn/wss`,用于其他业务 | +| 现有票据接口 | 其他业务已有 `GET /api/app/socket-token`,返回 `socket_token` | +| 当前缺口 | 协议及后端行为已确认;尚需客户端实现和联调验证 | + +以上 WebSocket 地址及票据接口已确认支持机巢任务;机巢使用 `310/311`,不复用排队模块的订阅消息。 + +## 3. 请后端补充或确认的协议 + +### 3.1 连接与鉴权 + +请提供: + +1. 测试、正式环境的连接地址,是否复用当前 `/wss`。 +2. 是否复用 `/api/app/socket-token`;若复用,门店账号是否可获取并订阅机巢任务。 +3. 票据携带方式:握手 Header、Query,还是连接后发送鉴权消息;请提供完整示例。 +4. 票据有效期、到期通知、重新获取和重连规则。 +5. 鉴权成功、票据过期、无任务访问权限的响应及关闭码。 + +服务端按当前门店账号校验任务访问权限,不能仅凭传入任务 ID 订阅其他门店的数据。 + +### 3.2 订阅、取消订阅与首份数据 + +请提供实际消息类型、字段名及完整 JSON 示例: + +- 订阅当前任务:使用 `order_flight_task.id`,明确字段叫 `id`、`task_id` 或其他名称。 +- 订阅成功确认,以及任务不存在、无权限等失败响应。 +- 订阅成功后,是否立即发送一份完整快照;若不会,客户端如何取得订阅生效时的完整状态。 +- 离开页面时取消订阅的请求和响应。 +- 同一账号多台手机同时查看任务、重复订阅同一任务时的处理规则。 + +请明确订阅确认与首份快照的先后关系,保证从首次 HTTP 查询切换到推送时,不会遗漏中间发生的状态变化。 + +### 3.3 推送内容 + +**第一版建议推送完整任务快照,业务字段与 `shooting.data` 保持一致。** HTTP 与 WebSocket 可使用同一套解析和页面更新逻辑,减少两份合同不一致的问题。 + +请确认是否覆盖下列页面数据,字段名以最终后端协议为准: + +| 页面需要的数据 | 当前 HTTP 对应内容 | +|---|---| +| 任务及所属信息 | `order_flight_task` / `task`、订单号、景区、点位、航线 | +| 页面摘要 | `header` | +| 当前锁定无人机 | `current_plane` | +| 无人机与环境参数 | `metrics`、`plane_status` 中相关连接状态 | +| 当前执行阶段 | `ui.phase`、标题、提示、进度及实际提供的任务状态 | +| 开始拍摄许可 | `execute_gate` | +| 重新召唤许可 | `restart_gate` | +| 安全控制按钮 | 当前允许的暂停、恢复、返航、取消返航等操作及限制原因,如 `ui.commands` | +| 执行结果 | 成功、失败、结束状态及具体失败原因 | + +如果已有服务只支持增量推送,请补充: + +- 消息如何区分完整快照和增量。 +- 未出现字段表示“保持原值”还是“清空”;`null`、空数组的含义。 +- 嵌套对象和数组是整体替换还是局部合并。 +- 增量适用的基础版本,以及基础版本缺失时如何重新同步。 + +如果目前只推送“任务有变化”的通知,App 仍需在收到通知后查询 `shooting`。请明确说明;这种模式与直接推送页面实时数据不同。 + +### 3.4 任务版本与消息顺序 + +HTTP 查询和 WebSocket 推送可能交错到达,需要防止较旧的 HTTP 响应覆盖较新的推送状态。 + +请两种来源提供同口径的以下信息(名称可沿用后端已有字段): + +| 信息 | 用途 | +|---|---| +| 任务 ID | 只处理当前页面任务的消息 | +| 单任务递增版本号 | 对比 HTTP 与推送的新旧,丢弃重复及旧版本 | +| 状态更新时间 | 展示最近更新时间、协助排查延迟 | +| 设备数据采集时间 | 区分任务状态正常但设备读数已经过期的情况 | + +请说明版本号何时递增、是否可能重置。若同一任务重新召唤后会切换执行批次或重置版本,需要同时提供执行批次标识及比较规则,避免上一批次的迟到消息覆盖当前执行。 + +建议完整快照即使跳过部分中间版本,也能直接恢复到最新状态。若使用增量,则需要明确丢消息后的补齐办法。 + +### 3.5 心跳、推送频率与数据新鲜度 + +请明确: + +- 使用 WebSocket Ping/Pong 还是业务 JSON 心跳;由哪一端发送,格式及周期是什么。 +- 心跳等待多久无响应判定连接异常。 +- 任务状态、设备读数分别按什么频率推送,还是仅变化时推送。 +- 状态不变时,如何确认任务订阅仍有效;例如周期快照,或携带任务版本的订阅存活消息。 +- 设备离线、后端未收到新设备数据时,如何表达连接状态和读数过期。 + +不能仅根据“没有状态变化消息”判定断线,也不能仅根据“心跳正常”判定设备读数实时有效。客户端会分别处理连接存活、订阅有效和设备数据是否过期。 + +### 3.6 HTTP 兜底的数据来源 + +请确认 `shooting?live_battery=0` 能从持续更新的服务端状态或缓存中读取最新任务信息,并与 WebSocket 使用相同的数据来源、版本及字段含义。 + +如果 `live_battery=0` 下设备参数不会更新,请说明哪些字段受影响、如何获得已缓存的最新读数。本次不通过自动切换为 `live_battery=1` 或启动图传来补数据。 + +同时请给出 HTTP 查询建议频率或限流要求。鉴权失效、任务无权限等确定性错误,应有明确响应供客户端停止无效重试。 + +## 4. 客户端拟采用的更新流程 + +以下为接入方案,具体心跳和超时时间待协议确认后配置。 + +| 情况 | App 行为 | +|---|---| +| 首次进入、回到前台 | 查询一次 `shooting` 获取完整数据,同时连接并订阅当前任务;按版本处理交错到达的数据 | +| 订阅成功且数据正常 | 接收推送更新 UI,停止常规 HTTP 轮询 | +| 连接或订阅失败、心跳超时、按协议判定订阅失效 | 立即触发一次 HTTP 查询,后续启用串行兜底轮询;已有请求进行中则合并触发,避免并发 | +| 兜底期间 | 暂沿用现有默认 5 秒及后端轮询建议;连接重试逐步延长间隔,避免反复连接 | +| 网络完全不可用 | 保留旧数据并提示更新异常;网络恢复后重新查询、订阅 | +| WebSocket 恢复 | 确认订阅成功并取得有效的最新完整状态后,停止兜底轮询;只连接成功还不能退出兜底 | +| 收到重复、旧版本或其他任务消息 | 丢弃,不覆盖当前页面 | +| 操作接口返回后 | 保留现有一次状态回查;根据版本与推送合并,不把操作受理回执当作设备已完成执行 | +| 离开页面、进入后台 | 取消当前页面订阅、计时和轮询;若连接由其他模块共享,只取消本页面订阅 | +| 账号、景区或任务身份变化 | 停止旧订阅并使旧回调失效,禁止旧数据更新新页面 | + +客户端继续保留旧快照,失败时不清空页面。过期的状态不能被解释为新的操作许可;实际指令仍由后端校验,读取恢复不会自动重发任何写操作。 + +## 5. 请提供的联调资料 + +请提供可以直接用于客户端解析的完整 JSON,而不仅是字段描述: + +1. 鉴权、订阅、取消订阅的请求和成功/失败响应。 +2. 一份完整任务推送,以及同一任务、同一版本的 `shooting` 响应。 +3. 前往点位、到达待拍、拍摄中、暂停、返航、完成、执行失败等状态示例,包含对应按钮许可和失败原因。 +4. 心跳、票据过期、任务无权限、设备离线及数据过期示例。 +5. 断线重连、重新订阅后的完整快照或补消息示例。 + +请同时提供不触发真实无人机操作的联调方式,例如独立模拟任务推送或服务端事件回放。iOS 侧先用隔离替身验证,再验证只读订阅;真实设备飞行由用户自行安排,不以真实召唤作为本次开发验证的前提。 + +## 6. 分工与验收 + +### 后端 + +- 朱工确认并提供上述机巢 WebSocket 合同及样例;已有能力可直接写明复用方式。 +- 保证推送与 `shooting` 的身份、状态、操作许可、版本及数据来源一致。 +- 提供订阅授权、失效反馈和无需真实飞行的测试数据。 +- 张工的 `tasks/create` 继续提供任务 ID,目前没有因本需求必须修改的部分;如推送涉及订单次数更新,由后端内部确认数据来源。 + +### iOS + +- 实现任务订阅、消息解析、生命周期管理及重连。 +- 实现 WebSocket 与 HTTP 自动切换、请求合并、版本比较和旧快照保留。 +- 补充连接、订阅、推送、忽略旧消息、兜底切换的控制台日志。 +- 使用模拟数据验证正常更新、断线、恢复、迟到响应、乱序和账号切换。 + +### 验收要点 + +- 推送正常时,任务状态、参数和操作许可能够更新,常规 HTTP 轮询停止。 +- 断线或订阅异常后自动查询 `shooting`,无重复并发轮询。 +- 心跳正常但设备数据过期时,有明确状态,不误显示为实时有效。 +- 重新连接并同步后,退出兜底且不遗漏当前任务状态。 +- 旧 HTTP 响应、重复推送及上一执行批次消息不能覆盖较新数据。 +- 离页、后台和账号切换后,旧任务消息不再更新页面。 +- 所有自动恢复行为仅恢复读取,不触发或重发飞控、创建任务、图传启动。 + +## 7. 请朱工回复 + +请优先确认以下四项,以便开始客户端接入: + +1. 是否已有机巢任务 WebSocket 推送?连接、鉴权及订阅示例是什么? +2. 能否直接推送与 `shooting.data` 一致的完整快照? +3. HTTP 与推送是否能提供可比较的任务版本,以及明确的数据更新时间? +4. 心跳、更新频率、重连同步规则及无真实飞行的联调方式是什么? + +本节及第 3~6 节为原始需求清单;已确认的字段和行为见第 0 节及朱工最新接口文档,尚未实施的客户端策略不代表 App 已具备该行为。 diff --git a/机巢工作台页面接口对接记录.md b/机巢工作台页面接口对接记录.md new file mode 100644 index 0000000..605fa16 --- /dev/null +++ b/机巢工作台页面接口对接记录.md @@ -0,0 +1,2064 @@ +# 机巢工作台页面接口对接记录 + +> 更新日期:2026-11-03 +> **最新 Release 授权(覆盖下文历史禁飞范围):**用户已明确回复“开放 Release 真实操作,Debug 保持拦截”。Release 开放真实创建、召唤、开拍、安全控制;2026-11-03 后续要求图传自动开启。使用现有身份、门禁和防重校验;Debug 仍拦截。代理仅用模拟器/隔离替身验证,真实操作由用户自行测试。 +> **Debug 禁飞限制(Release 以本页最新授权为准):**按用户最新要求,调试不得向真实无人机下发指令。Debug 准备页禁止真实创建和召唤;统一网络层在传输前阻断 `tasks/create`、机场操作请求(包括 `shoot/start-shoot/command/live` 及未确认的新接口)。状态 GET 仅允许已确认的 `home/plane-status/shooting/status`,其中实时采集参数强制为 `live_battery=0` 或 `live_metrics=0`。只有完全不联网的 Mock 传输可以验证原始请求合同。下文任务 6、11 的真实召唤均发生于此限制之前,不作为继续真实联调的授权。 +> 核对范围:当前工作区。准备页使用张工 `project-info` 和朱工 `plane-status`;“确认并召唤”按 `project-info → tasks/create → shoot` 执行,召唤业务成功后进入任务页;2026-11-02 按用户要求恢复 `shooting` 前台轮询:进入及回前台立即读取,之后每次请求结束按 `poll_hint_ms` 延时再读,默认 5 秒、限制 2~30 秒;离页/后台停止,刷新保留旧快照。准备页 `plane-status` 保持轮询。最新 2026-10-29 17:18–17:19 模拟器实操新建任务 11,再以 `{id:11,restart:false}` 召唤;两个接口均成功,绑定飞机 61、航线任务 1931。17:19:04 首次查询允许开始,17:19:59 手动回查已为航线执行失败、禁止拍摄,当前待朱工定位 1931 失败原因与自动派机条件(见 7.7.3)。任务 6 / 航线 1926 的先前失败记录保留。召唤回执的“已到达”不是物理验证,本轮未调用开始拍摄或控制接口。任务 2 的参数、订单类型及机场状态失败保留为历史,原因不因新任务成功而作推断。`workbench`、定位请求已停用;`start-shoot` 已实现纯本地模拟(见 7.6.2),真实开拍入口保持禁用;`command` 已实现纯本地模拟(见 7.6.3),真实控制保持禁用;图传已于 2026-11-02 接入火山 RTC 参数与播放器(Release 手动开启,Debug 保持拦截,真实画面待用户联调,见 7.6.5);2026-10-30 已完成真实成片上传、保存及回查,见 9.4。 +> 用途:记录每个页面实际调用的接口、提供人、调用时机、请求参数和返回 JSON,供 iOS 与后端持续联调。 + +## 2026-11-03:任务页移除详情与拍摄中原型对齐 + +依据用户本轮要求,已对照打开的 [机巢体验交互原型](https://voicestudio.suixinkan.cn/) 调整拍摄任务页;原型核对未执行真实任务创建、飞控或图传操作。 + +- 移除任务页通用“详情”按钮,其他阶段主按钮占整行。失败原因区域仍支持点击展开完整原因。 +- 拍摄中优先使用产品文案“无人机正在拍摄中”,说明分两行显示“请关注现场及实时画面。”和“请勿关闭本页或息屏。”;左侧浅蓝圆形视频图标、右侧标题与说明,下方整行浅蓝禁用“拍摄中”指示按钮,保留相机图标。 +- 拍摄中面板不再展示设备摘要或中央刷新按钮,导航栏刷新保留;禁用状态指示不触发主操作。 +- 展示调整不改写后端阶段、订单或航线任务终态。失败/取消、身份与版本校验、安全门禁、HTTP/WS 读取规则及 Debug 禁飞保护沿用既有约定。 + +验证:157 项相关模拟器隔离测试全部通过,覆盖按钮移除、375/402 点宽及极小高度布局、到达倒计时切换、导航刷新、手动开拍、安全控制和完成/错误状态切换。结果包 `test_sim_2026-11-03T08-28-06-515Z_pid38943_07d96fc4.xcresult`;已检查完整页面及 375×146、402×220 状态区截图,图文及按钮无重叠。Release 无签名编译通过(`/private/tmp/suixinkan-shooting-prototype-release-build.log`)。未执行真实任务创建、飞控或图传,未将原型演示或模拟数据记为后端真实成功。 + +## 2026-11-03:任务页返回直达机巢工作台 + +用户要求工作台进入准备页、再进入任务页时,把准备页从导航栈移除。准备页的自动成功跳转和手动查看任务统一以任务页替换栈顶准备页,保留原工作台及其上游页面;任务页的普通返回与系统侧滑返回直接回到该工作台,不新建工作台、不再次创建或召唤任务。工作台已有任务的直接入口仍沿用原有 push。 + +仅独立模拟/调试启动时,准备页自身就是导航根页面,没有可返回的工作台,此时保留根页回退入口。该兼容不影响工作台正常业务路径。 + +验证:36 项相关模拟器隔离测试全部通过,含新增 3 项路由用例,覆盖完整导航栈替换、返回原工作台、更早页面保留、显式查看已创建任务、连点与迟到回执,以及独立模拟根页兼容。结果包 `test_sim_2026-11-03T08-04-56-551Z_pid38943_09fd825e.xcresult`。Release 无签名编译通过(`/private/tmp/suixinkan-preparation-stack-release-build.log`);不执行真实任务创建、召唤或图传。 + +## 2026-11-03:正常拍完开始返航即显示拍摄完成 + +依据用户补充及 Downloads 中朱工更新的《随心瞰9.9.1-App机巢与素材库接口.md》“正常拍完开始返航”说明和样例 A/B。现有 `post_shoot_uploading` 可直接复用:后端确认司空 `taskDetail.status=success` 后写返航标记并进入航线 24、更新缓存和推送;前端不必等待回到机巢、`finished_at` 或素材全就绪,也不直接查询司空或执行后端内部方法。 + +| 可信快照 | 前端展示与处理 | +| --- | --- | +| `ui.phase=post_shoot_uploading`,顶层/UI `shoot_complete_returning=true` 或 `ui.wayline_stage=shoot_done_returning` | “拍摄已完成”及“无人机正在返航,请留意现场”;停止本机 RTC、显示静态封面、按任务批次去重完成提示,保留查看当前订单素材入口 | +| 航线 30,返航标记已清理 | 完成标题保留,说明切“素材上传中,可在素材库查看进度” | +| 航线 40 | 完成标题保留,说明切“素材渲染中,可在素材库查看进度” | +| `partially_done` 对应航线 29 / 订单任务 40 / `failed_restartable` | 保留失败原因与既有重召流程,不弹拍摄完成 | +| `result_code=return_home` | 明确手动中断,按失败处理,残留完成文案或标记不能覆盖 | + +新增 DTO 分别保留顶层和 UI 布尔以及 UI 子阶段,缺失/null 兼容旧回包;完整快照替换后不沿用旧标记。显式 false 或已进入航线 30/40/50 时不再显示返航说明;旧回包只有明确设备返航文案时保留原有兼容。标记只补充已确认完成阶段的说明,不能单独把失败、取消、待确认、矛盾或未知 UI 阶段改为完成。 + +订单飞行任务仍可为 20、航线仍为后端真实 20/24,`finished_at` 可为 null;不修改终态、不宣告素材就绪、不提前扣次。HTTP `shooting?live_battery=0` 和 WebSocket `app_airport_shooting_updated` 继续共用任务身份、execution_batch、state_version 校验。 + +验证:151 项不同相关隔离用例最终全部通过,其中新增 11 项返航标记合同测试;首轮 150 项通过、一项页面用例误用了无标记旧夹具,修正后所属 28 项播放/页面用例全部复测通过。覆盖正常返航、`finished_at=null`、订单任务20、上传/渲染清标记、提前/手动中断、残留矛盾标记、HTTP/WS、版本/批次/身份,以及完成弹窗去重与本机图传释放。结果包 `test_sim_2026-11-03T07-46-53-966Z_pid38943_c272e6bd.xcresult`、`test_sim_2026-11-03T07-50-16-581Z_pid38943_42691c6c.xcresult`;后者保留正常拍完返航完成页截图。Release 无签名编译通过(`/private/tmp/suixinkan-shoot-done-returning-release-build.log`),未连接真实设备或调用图传/飞控。 + +## 2026-11-03:App 本地到达倒计时(用户最新确认) + +用户已明确倒计时由 App 自行创建、维护,进入已到达状态后仅显示剩余秒数;后端自动开始拍摄后,App 依据接口阶段更新 UI。本节覆盖此前等待后端补充截止时间、剩余秒数和服务端时间字段的提案,无需为当前展示新增接口字段。 + +- 接受身份、批次及版本校验通过的 `arrived_pending_start` 且开拍门禁允许后,以本地单调时钟建立 30 秒期限。相同任务、相同 `execution_batch` 的重复包和新版本到达包不重置;缺少批次的旧回包在当前页面会话按默认批次维护,新执行批次重新计时。 +- 独立秒数标签每秒更新,向上取整显示 30~0;逐秒更新不重建状态或按钮,不发送开拍、飞控、图传或额外状态请求。0 秒继续显示,仍保持后端到达阶段;常规 HTTP/WS 状态读取沿用既有流程。 +- 后端返回 `shooting` 时立即清除秒数并切换拍摄 UI,不等待 App 数完。失败、取消、暂停、返回前往等非到达阶段隐藏数字;同批次再次到达仍沿用原期限,避免显示被刷新重新拉回 30 秒。 +- 离页或后台取消 UI 定时任务,单调时钟期限保留;同一页面会话返回后计算已过去的时间。新建页面的独立 ViewModel 从本地首次可信到达开始,不保存到磁盘或跨账号共享。身份失效、权限终止或清除快照后不继续显示旧倒计时。 +- 数字展示不改变手动开拍门禁、防重复提交、结果未知锁、设备状态或后端任务结果。Debug 拦截和代理仅使用隔离替身/模拟器验证的约定继续保持。 +- 用户补充确认手动“开始拍摄”和倒计时并行:已到达、后端门禁允许且没有提交/未知结果锁时,30 秒、倒数中和 0 秒均可手动点击。手动提交只发送一次同任务开拍,受理后仍等接口返回阶段;倒计时不是按钮禁用条件。现有 Release 入口和按钮流程已符合此规则,本次补充实际点击回归验证。 + +手动开拍补测:18 项相关隔离测试全部通过,覆盖 30/18/0 秒时按钮实际触发开拍替身、连点仅提交一次、受理后按后端切换,以及业务拒绝/结果未知保护。结果包 `test_sim_2026-11-03T07-23-59-050Z_pid38943_49c0435f.xcresult`。本次无需修改生产按钮或倒计时逻辑,未调用真实设备接口。 + +验证:124 项相关模拟器测试全部通过,含 12 项倒计时逻辑、2 项页面生命周期及 2 项数字显示/固定布局新用例;覆盖 30~0 秒取整、到零零请求、提前开拍、同批次刷新/新批次、后台/离页和身份权限清理。结果包 `test_sim_2026-11-03T07-14-26-247Z_pid38943_e9f1673f.xcresult`;页面截图单项复测 `test_sim_2026-11-03T07-19-36-432Z_pid38943_8cdd56cb.xcresult`,等待按钮文字过渡结束后核对 30/0 秒实际显示。375/402 点宽截图已检查,倒计时与至少 44 点按钮不重叠。Release 无签名编译通过(`/private/tmp/suixinkan-local-countdown-release-build.log`)。未调用真实开拍、图传或其他设备接口。 + +## 2026-11-03:无人机状态枚举补充与客户端修正 + +来源为用户本次直接提供的 9.9.1 合同,适用于同名接口字段;不把不同状态域的数字互相转换。 + +| 字段域 | 已确认取值 | 使用职责 | +| --- | --- | --- | +| `work_status` | 0 离线、1 空闲、2 拍摄中 | 工作台/列表的忙闲;不表示已到首点或具体拍摄页进度 | +| `online_status` | 1 在线;0、2 等非 1 为离线 | 飞机表在线标记;明确工作态优先,缺失或未知工作态才作保守兜底 | +| `is_receive_order` | 1 可接单、2 暂停接单 | 接单配置,不等同于起飞许可 | +| `order_flight_task.status` / `task.status` | 10 待执行、20 执行中、30 成功、40 失败、50 取消、60 待确认 | 订单飞行任务结果,不从 20 推断正在拍摄 | +| `task.wayline_status` | 10 待拍摄、20 拍摄中、24 下载中、29 拍摄失败、30 上传媒体、39 上传失败、40 渲染中、49 渲染失败、50 已完成、90 取消、91 执行失败 | 具体航线阶段;与订单任务 status 独立 | +| `ui.phase` | `waiting_summon`、`going_to_spot`、`arrived_pending_start`、`shooting`、`post_shoot_uploading`、`post_shoot_upload_failed`、`completed`、`failed_restartable`、`blocked` | 拍摄页主要展示依据;兼容原有 `paused` / `returning` 等既有阶段 | + +本次修正此前漏掉的 `post_shoot_upload_failed`,独立显示素材上传/渲染失败与当前订单的素材入口,保留具体失败原因;停止本机图传并使用静态封面,不弹“拍摄已完成”成功提示。航线 39/49 在缺少明确 UI 阶段时可回退到素材处理失败;后端明确 `failed_restartable` 则保留既有失败重召流程,不用上传失败码自行新增重召许可。航线 29/91 按拍摄/执行失败,90 按取消处理;订单任务 60 显示“任务待确认”,仅允许刷新核对。 + +设备重召校验先使用工作态:明确 0 离线、2 忙碌时禁止;明确 1 不受历史 `online_status=0/2` 覆盖;工作态缺失或未知时,已提供的非 1 在线标记保守视为离线。准备页原本使用 `work_status` 展示忙闲,仍由后端门禁决定是否允许提交,未根据“在线/可接单”新增可飞许可。 + +这份枚举没有定义自动开拍时间字段;后续用户已确认使用 App 本地显示倒计时,见本页顶部最新约定,无需等待时间字段。 + +验证:140 项相关模拟器测试全部通过,包含新增 12 项状态合同测试与素材失败图传/页面测试,覆盖 HTTP/WS 同义、工作态优先、忙碌/离线限制、待确认门禁、旧重召流程及固定区域布局。结果包 `test_sim_2026-11-03T06-59-06-641Z_pid38943_a7568fa4.xcresult`;页面单项复测包 `test_sim_2026-11-03T07-02-58-767Z_pid38943_ced185fe.xcresult` 等待按钮标题过渡结束后再次核对实际“查看素材”文字,并保留上传失败且无成功弹窗的稳定截图。Release 无签名编译通过(`/private/tmp/suixinkan-status-contract-release-build.log`)。使用隔离网络、播放器及操作替身,未执行真实设备请求。 + +## 2026-11-03:任务页原型对齐与倒计时历史排查 + +用户补充任务 8 / 执行批次 2418 的日志。首个 `arrived_pending_start` 为 14:27:09,14:28:34 首次出现 `shooting`,观测间隔约 85 秒。`started_at`、`state_updated_at` 和 `estimated_fly_time` 不用于倒计时。此前曾建议后端增加精确期限,现已按用户最新确认改为首次可信到达后的 App 本地 30 秒显示,实际开拍仍以接口为准。 + +旧时间字段增量提案已撤销,不再作为接入前置条件;实现规则以本页顶部的 App 本地倒计时为准。 + +任务页已按 [机巢体验原型](https://voicestudio.suixinkan.cn/) 调整:播放中隐藏“刷新图传”,左上只显示小绿点和“实时图传”;首帧前/失败不显示实时标识,无画面时保留显式重试。拍摄完成面板使用浅绿圆形勾、右侧标题与说明、下方整行带图片图标的“查看素材”,移除该面板内的设备摘要和“详情”。“正在返航”仅在当前设备明确返回返航状态时显示;素材处理中不宣告素材已就绪。任务初次读取时也保留已校验召唤回执的“无人机正在赶来”。 + +本段日志最后是 `status=40` / `wayline_status=39` / `result_code=wayline_39`,后端明确报“上传媒体资源出错”。完成面板不覆盖后续失败状态;具体上传失败原因仍需后端核查。WebSocket 本段仍仅见 Opened 与发送 310,不能据此认定订阅/推送成功。 + +验证:本轮共 107 项不同相关用例最终通过,覆盖简洁图传标识、首帧/失败与切源、完成态及失败态切换、当前订单素材跳转、防重与刷新禁用、首份读取期间的前往回执;另在真实模拟器窗口内复核 375/402 点宽完成面板的图文居中和操作尺寸,截图无重叠。首轮旧来源标识断言及改用 UIButton.Configuration 后的旧标题读取断言已同步更新并重测。结果包为 `test_sim_2026-11-03T06-43-42-509Z_pid38943_c7ead8cc.xcresult`、`test_sim_2026-11-03T06-46-41-073Z_pid38943_2fe4d45b.xcresult`,最终单项复测分别为 `test_sim_2026-11-03T06-48-30-678Z_pid38943_68f5cd2f.xcresult`、`test_sim_2026-11-03T06-49-56-081Z_pid38943_b343e4e5.xcresult`。Release 无签名编译通过,日志 `/private/tmp/suixinkan-task-prototype-final-release-build.log`。全部验证使用隔离替身,不连接真实飞控或图传;该轮尚未包含 App 本地数字倒计时,后续实现见本页顶部最新约定。 + +## 2026-11-03:准备页电量与“无人机正在赶来” + +本节依据用户提供的任务 7 / 航线任务 2417 日志及 Downloads 中朱工最新版接口文档;没有由代理执行真实设备请求。 + +- 准备页 `plane-status` 的服务原已请求 `live_battery=1`,但网络保护对 Debug/Release 一律改为 0。这次日志的推荐设备 `battery_percent=null`、`battery_label=""`,因此没有电量可展示。现按用户要求,仅 Release 准备页保留实时电量参数;Debug 继续读缓存,任务页 `shooting=0` 和 `status` 的 `live_metrics=0` 不变。底栏在 `status_text` 只有工作状态时补充返回的电量字段,真实 0% 可显示,不编造缺失读数。 +- 13:42:53 `shoot` 返回 `accepted=true`、`ui.phase=going_to_spot`;13:42:55 首份 `shooting` 已返回 `arrived_pending_start`、`execute_gate.can_execute=true`。客户端直接显示到达的依据是这份后端快照,并非根据任务状态 20 推断。 +- 现将匹配任务、订单和景区的前往回执带入页面,首份状态返回前显示“无人机正在赶来”,不开放开拍或伪造完整快照。后续 HTTP/WS 前往阶段使用同一文案,收到明确到达状态才切换,不增加人为最低等待时间。 + +**给朱工的核查事项(未发送):**现有 `going_to_spot` / `arrived_pending_start` 已足够区分界面阶段,无需为文案新增接口。如果现场在 13:42:55 尚未到达,请核查航线任务 2417 的到达首点判定。文档写明 `RealtimeChecker` 根据 `paused_at` 更新阶段,应确认该值来自本次航线执行、确为首点到达等待开拍,而非起飞前暂停、旧设备/旧批次缓存或一般暂停;HTTP、WS 和 `execute_gate` 应使用同一可信判定。仅业务受理、订单任务 20 或航线状态 20 均不能作为到达依据。若底层拿不到可靠到达事件,应保持前往/待确认且禁止开拍,再补充可靠的到达来源;可补充批次绑定的 `arrived_at` / 原因供诊断,但 App 无法从现有快照独立验证物理到达。根因待朱工核实,不能仅凭两秒间隔断定具体哪条判断有误。 + +验证:137 项相关模拟器测试全部通过,覆盖电量补充与去重、真实零值、缺失/越界值、首次前往回执的身份校验、读取失败和后续到达切换、准备页及任务页生命周期。结果包 `test_sim_2026-11-03T06-14-43-559Z_pid38943_55e0a9b1.xcresult`。另以仅构造 URLRequest 的隔离检查分别验证 Debug/Release 各 10 项网络策略,未创建任何网络传输。Release 无签名编译通过,日志 `/private/tmp/suixinkan-battery-arrival-release-build.log`;实际电量与物理到达由用户后续真机复测,未记为真实联调成功。 + +## 2026-11-03:图传无画面排查与录制完成交互 + +用户提供任务 7 / 批次 2417 的运行日志:首次 live 只有机巢可用,约 34 秒后机巢、无人机均返回火山参数;可用凭证不等于已收到视频帧。13:46:30 的 shooting 首次进入 post_shoot_uploading,航线为 24,订单任务仍为 20;13:47:59 转为航线 30。日志末尾仍未素材就绪,不能认定上传已完成。 + +- 修正接收端首帧等待超时误走致命失败的问题:超时只开放第二路,保留房间等待晚到的视频发布。订阅按新版 SDK 返回的 streamId,不再额外要求 streamIndex 为 0。SDK 入房/订阅失败在页面保留错误码;不增加控制台事件噪声。 +- live 补流会生成新 user_id,原入房凭证未临期时保留当前房间;新无人机参数独立增补,临期再换身份。SDK 适配器和接收协调器分离,后者可直接用内存房间验证,不初始化 SDK。 +- 按用户最新产品要求,可信 post_shoot_uploading 即提示“拍摄已完成”,显示原型样式的“稍后再去 / 去查看”弹窗;去查看进入当前订单素材库查看上传进度,不修改状态、扣次或伪造就绪。此约定覆盖下表旧的任务页上传文案。 +- 录制结束后释放本地 RTC、取消 live 补流/续期及在途请求,覆盖静态点位封面;缺少封面时使用中性图案。重复包、前后台及旧播放回调不能恢复图传。打开已有结束任务时先读 shooting,不先启动 live。 +- 本段日志的 WebSocket 只有 Opened 与已发送的 310,未见订阅 ack 或完整推送;HTTP 兜底持续更新。尚不能确认服务端订阅成功,且该状态通道不承载 RTC 视频。 + +验证仅使用模拟器、隔离网络及 RTC 房间替身和无签名 Release 编译;不复用日志凭证,不调用真实 live 或飞控。真实设备视频效果仍需用户复测。 + +验证结果:共 93 项不同相关用例最终通过;首轮 91 项中一项旧按钮文案断言早于动画结束,补充等待后受影响的 51 项(含新增两项)全部通过。结果包分别为 `test_sim_2026-11-03T06-02-18-041Z_pid38943_bb5083a4.xcresult`、`test_sim_2026-11-03T06-06-15-587Z_pid38943_daa4cc56.xcresult`。后者保留完成弹窗/封面截图,已核对无文字重叠。Release 无签名编译通过,日志 `/private/tmp/suixinkan-recording-completion-release-build.log`。 + +## 2026-11-03:朱工 WebSocket 订阅顺序与拍摄后上传阶段 + +依据 Downloads 中最新版《随心瞰9.9.1-App机巢与素材库接口.md》§9.1 和朱工补充说明。以下为协议示意与本地模拟验证范围,不代表真实环境已完成联调。 + +代码核查:原客户端已调用 `URLSessionWebSocketTask.send(.string(...))`,但在收到 `Opened` 之前发送;此前控制台的 310 请求记录也在发送调用之前打印,不能据此证明服务端接受了订阅。另一个差异是旧解析使用 WS 成功码 0,新文档明确为 100000。 + +当前顺序: + +1. 初次读取 `GET /api/app/airport/shooting?id=<任务ID>&live_battery=0`,再取 `GET /api/app/socket-token`。 +2. 连接 `/wss`,收到纯文本 `Opened`。 +3. 显式发送文本帧(示例任务与票据为测试值): + +```json +{"type":310,"params":{"id":501,"socket_token":"MOCK-TICKET"}} +``` + +4. 收到成功 ack,再接收完整快照;这两步完成前保留 HTTP 兜底: + +```json +{"code":100000,"msg":"OK","data":{"subscribed":true,"order_flight_task_id":501,"has_snapshot":true}} +``` + +5. 推送仍为 `data.action=app_airport_shooting_updated`,`data.params` 与 shooting.data 同结构,按任务身份、execution_batch、state_version 统一接收。收到重复欢迎帧不再发 310;新连接必须重新取票、等 Opened 再订阅。 + +310 的简洁请求日志改在本地 send 成功返回后记录,格式仍是 `{path,params}`;这只证明本地完成发送,服务端是否接受以 ack 为准。欢迎帧、ack 和推送仍打印为 `{path,params,response}`。断线、超时、票据过期及无权限按既有兜底规则处理,不把 Opened 或 ack 单独视为实时快照正常。 + +| 后端阶段 | 订单任务状态 | App 显示及操作 | +| --- | --- | --- | +| `shooting` / wayline 20 | 20 | 正在拍摄 | +| `post_shoot_uploading` / wayline 24、30、40 | 20,finished_at 可有值 | 按最新产品要求显示拍摄已完成并提示前往订单素材库;停止本机图传,不提供开拍或重召唤,不宣告素材就绪 | +| `completed` / wayline 50 | 30 | 素材就绪,显示查看素材 | + +`execute_gate.can_execute=false` 仅表示不能再次开拍,不能覆盖明确的上传阶段。也不以 finished_at 判断素材就绪;真正失败、取消和矛盾字段仍按原有保守规则处理。新阶段沿用任务页中间固定区域,顶部图传/读数和底部安全模块位置不变。 + +验证:共 82 项不同相关模拟器用例最终通过,覆盖欢迎帧前禁止发送、重复欢迎帧、防重/超时/重连换票、100000 ack/快照、HTTP 兜底、上传到完成切换及固定布局。最近一轮受影响的 35 项全部通过,结果包 `test_sim_2026-11-03T03-53-57-307Z_pid38943_1be9681a.xcresult` 包含上传中与素材就绪截图;其余用例见 `test_sim_2026-11-03T03-50-52-288Z_pid38943_3d36a687.xcresult`。Release 无签名编译通过(`/private/tmp/suixinkan-opened-upload-release-build.log`)。未创建真实任务、未调用真实图传/飞控,真实环境订阅需由用户复测确认 ack 与推送。 + +## 2026-11-03:张工 orders 增量——继续查看任务 + +依据用户提供的增量文档 `multi-plane-orders-active-task-app.md`(2026-11-03),请求路径、参数、分页与原字段定义保持不变;本节补充原 orders 合同。 + +| 新增字段(data.list[]) | 含义 | App 使用 | +| --- | --- | --- | +| `active_task_id` | `order_flight_task.id`,有候选时为正整数,否则 null | 工作台和“我的拍摄订单”优先显示“继续查看任务”,直接进入共用任务页 | +| `active_task_status` | 有候选时为 20,否则 null | 保留订单摘要值,任务页实际阶段以 shooting/WS 完整快照为准 | + +字段示例(增量示意,非真实环境实测响应): + +```json +{ + "list": [ + { "order_number": "TEST-ACTIVE-001", "active_task_id": 501, "active_task_status": 20, "can_create_task": true }, + { "order_number": "TEST-IDLE-002", "active_task_id": null, "active_task_status": null, "can_create_task": true } + ], + "total": 2, + "page": 1, + "page_size": 20 +} +``` + +- 入口优先级:有 `active_task_id` → 继续查看任务;无 ID → 继续按 `can_create_task`、交付/确认权限展示。其它摘要没有新增字段时兼容旧格式,不给详情接口补造任务身份。 +- 点击后使用 `GET /api/app/airport/shooting?id=&live_battery=0` 读取任务,后续沿用任务页已有 WS、HTTP 兜底及图传生命周期。入口本身不调用 `tasks/create`、`shoot` 或查询 `tasks`。 +- 后端筛选有效状态 20 的任务,并排除关联航线已经成功、失败或取消的旧任务。多条候选按创建时间升序、ID 升序选最早一条;状态 20 还可包含下载、上传、渲染。App 不将它直接当作“正在拍摄”画面。 +- 返回列表会重新请求 orders;原候选结束时切换为下一条,全部结束时恢复原有按钮。两个页面的入口都携带本次列表中的订单、景区和任务身份,连点不会重复压入任务页。 +- 本轮使用隔离 HTTP 替身与模拟器验证;未请求真实设备接口。 +- 验证:共 98 个不同模拟器用例取得通过结果;首次回归 96 项通过、1 项旧测试配置不符,明确该准备页测试的只读配置后,4 项导航复跑全部通过(含新增的全部订单工厂传递用例)。Release 真机架构无签名编译通过,日志 `/private/tmp/suixinkan-active-task-release-build.log`。 + +## 2026-11-03:无感刷新、双路图传与订单入口核对 + +- 拍摄任务已有快照时,HTTP 兜底/手动刷新不临时禁用按钮,不切换加载空态。真正提交开拍、重召唤或安全指令时仍锁定防重;权限或门禁变化按新快照立即生效。操作前作废旧读取,迟到的旧响应不能覆盖操作后的回查。 +- 图传继续使用朱工 `GET /api/app/airport/live?id=`。现在分别解析 `airport`、`drone` 的火山参数,兼容只有 `play` 的回执。单引擎双房间,先显示机巢,再按无人机实际首帧切换;无人机停流、卡顿或连接失败时回退到仍有画面的机巢,两路均中断则显示等待。只收视频,不发布音视频,不订阅音频。 +- 机巢首帧最多等待 20 秒,未出现也允许连接无人机;一路参数缺失时按后端提示(默认 30 秒)重新获取,取得两路参数后只在凭证临期时续期。补流/续期复用现有房间,普通 shooting 和 WebSocket 更新不重复请求 live。离页/后台全部取消。 +- 本轮没有访问真实 live、创建任务或发送飞控指令;所有切源事件均来自内存替身。实际视频质量、真实停流回调仍由用户使用 Release 包现场验证。 + +验证:iPhone 17 Pro / iOS 27 模拟器共 155 个不同用例通过(首轮完整相关回归 154 项,末轮图传与无感刷新 32 项含 1 项新增)。覆盖刷新期间可点击、连点防重、迟到读取、双路选流、停流回退、参数增补/续期、身份变化、后台取消、RTC 失败取消补流计时及 Debug 真实连接拦截。结果包:`test_sim_2026-11-03T03-05-40-430Z_pid38943_14bcd8d4.xcresult`、`test_sim_2026-11-03T03-08-02-534Z_pid38943_2f652fd8.xcresult`。 + +历史问题说明:此前仅按 `can_create_task` 显示“开始拍摄”,缺少进行中的任务身份。张工现已通过本页最上方的增量合同补齐 `active_task_id` / `active_task_status`;两个列表入口已按该合同改为优先继续查看,旧的待补字段说明不再适用。 + +## 2026-11-03:图传自动开启、控制台断连及 Socket 欢迎消息修复 + +- 按用户要求,Release 拍摄任务页完整出现、可见时回前台自动 GET `/api/app/airport/live?id=<同一 task_id>`,等待 RTC 首帧后显示实时画面。覆盖下文“手动开启图传”的历史规则。 +- 同一可见周期只自动开启一次;HTTP 轮询、Socket 推送及重复出现回调不重复启动。失败保留重试,离页/后台释放本地播放器并作废在途结果;不自动重发创建、召唤或任何飞控指令。Debug 的真实 live/RTC 双层拦截不变。 +- 用户提供的 10:03 日志与截图显示 `NSFileHandleOperationException`,原因是标准输出 `writeData:` 返回 `Input/output error`。改用可抛 Swift 错误的写入方式,并阻止断管 SIGPIPE;失败后当前及后续记录转入系统日志,不改变请求结果或页面状态。 +- 同份日志中 live 返回 `code=100000`、`playable=true`、`play.url_type=volc`,仅证明后端提供了参数,不作为 RTC 首帧播放成功的证据。原始 token、设备编号与连接 URL 不写入本记录。 +- `/wss` 多次返回文本 `Opened`,旧解析器将其作为非法 JSON 触发重连。现在仅忽略此欢迎消息,保留原有订阅 ack、完整快照、任务校验、版本规则及超时兜底。 +- 模拟器 79 项测试通过:覆盖 EIO 回退、真实关闭的隔离管道、无效描述符、长 JSON 完整写入、自动图传/前后台/防重/迟到响应、欢迎消息后订阅/超时以及 Debug 禁飞保护。结果包:`test_sim_2026-11-03T02-11-58-734Z_pid38943_17bdc80a.xcresult`。 +- Release 真机架构无签名编译通过,日志 `/private/tmp/suixinkan-auto-live-console-fix-release.log`;未安装或运行 Release App,未访问真实图传或飞控。 + +## 2026-11-03:控制台仅输出路径、入参和返回 JSON + +- 当前格式为缩进 JSON:`path`、`params`、`response`;请求发送时先输出前两项,响应到达后附完整后端 Envelope。HTTP、WebSocket 都适用,WebSocket 的 `path` 为 `/wss`。 +- 不再输出模块标签、session/entry/part、Header、耗时、版本和页面/心跳/RTC 事件。业务错误不重复打印解析失败信息;本地无响应错误放在 `response.local_error`。 +- Xcode Run/Attach 下完整写入 Debug/Release 调试控制台,独立运行保留系统日志。网络行为和 Debug 禁飞保护不变。本节覆盖下文历史日志格式描述。 +- 验证:58 项不同模拟器测试通过;Release 无签名编译通过。未调用真实无人机操作。 + +## 2026-11-02:任务 WebSocket 已接入,异常时 HTTP 兜底 + +- 朱工已补齐 `/wss`、`socket-token`、`310` 订阅、`311` 取消及 `app_airport_shooting_updated` 完整快照协议。HTTP 与推送按 `execution_batch/state_version` 比较,使用同一 `order_flight_task.id`。 +- 用户转述确认:App 停止查询后,`RealtimeChecker` 在检测首点暂停时主动推送到达;航线完成/失败等状态变化时主动推送;拍摄中约每 30 秒刷新设备读数,不启图传。前提是任务已有快照、已订阅且 `realtime_checker` 正常运行。 +- 订阅 `100098`(票据校验失败或已过期)需刷新票据后重连;订阅 `100099` 且提示“无权订阅该飞行任务”时停止当前任务自动读取并提示权限错误,不将所有 HTTP `100099` 泛化为权限错误。 +- App 已实施:首次/回前台 GET 建快照 → 取 Socket 票据 → `310` 订阅 → ack 与有效完整包都确认后停常规轮询。断线/心跳异常、订阅超时、数据陈旧时使用 `shooting?live_battery=0` 串行兜底,恢复有效推送后退出。 +- HTTP 兜底默认 5 秒、限制 2~30 秒;Socket 重连退避 1/2/4/8/16/30 秒。订阅总超时 12 秒;Ping 每 20 秒、Pong 超时 10 秒。拍摄中 120 秒无有效包时只读核对,其它阶段不因静默判定断线。 +- 同任务按批次、版本丢弃旧响应;更新/失败保留旧画面。过期读数保留旧值并标记;后台/离页取消订阅与自动读取。 +- 验证:105 项相关回归通过,最终实时订阅/页面/Debug 拦截 40 项复验通过(含重复项)。[模拟器画面](docs/9.9.1/shooting-websocket-2026-11-02/websocket-fallback-mock.png)为纯 Mock。 +- 本次只使用模拟器和隔离网络替身,未调用真实设备指令、创建真实待飞任务或启动图传。完整规则与失败 JSON 见 [WebSocket 接入文档](朱工-拍摄任务WebSocket实时数据与HTTP兜底接入需求.md)。 + +本页新增使用以下朱工接口(下方 JSON 为脱离真实设备的协议示例): + +| 时机 | 接口 | 返回用途 | +|---|---|---| +| 进页、回前台、手动刷新和异常兜底 | `GET /api/app/airport/shooting?id=501&live_battery=0` | HTTP 完整快照 | +| 每次建立/重建订阅 | `GET /api/app/socket-token` | `socket_token`、`expire_seconds` | +| 首次读取后 | `/wss`,type `310` | 订阅 ack、`app_airport_shooting_updated` 完整快照 | +| 后台/离页 | `/wss`,type `311` | 尽力取消当前任务订阅;关闭连接清理 fd | + +```json +{"code":100000,"msg":"success","data":{"socket_token":"MOCK-TICKET","expire_seconds":3600}} +``` + +```json +{"type":310,"params":{"socket_token":"MOCK-TICKET","id":501}} +``` + +```json +{"code":0,"msg":"OK","data":{"subscribed":true,"order_flight_task_id":501,"has_snapshot":true,"state_version":12,"execution_batch":88901}} +``` + +```json +{"code":0,"msg":"OK","data":{"action":"app_airport_shooting_updated","params":{"order_flight_task_id":501,"state_version":13,"execution_batch":88901,"snapshot_kind":"full","metrics_stale":false,"ui":{"phase":"shooting"},"metrics":[],"execute_gate":{},"restart_gate":{}}}} +``` + +`params` 与 `shooting.data` 一致;实际完整包还可以包含任务、订单、设备、标题等字段,上述仅展示协议关键字段。HTTP 成功码 `100000` 与 Socket 成功码 `0` 分别处理。 + +## 2026-11-02:任务状态轮询与 Release 日志 + +- `shooting` 恢复轮询,只读同一 `task_id`,始终 `live_battery=0`。默认五秒,后端 `plane_status.poll_hint_ms` 限制为 2~30 秒;从上次请求结束后计时,操作提交期间暂停。 +- 离页、后台取消请求和计时,返回前台立即读取;普通失败保留旧数据并在下一周期重试,身份失效停止旧任务读取。轮询不会调用 `live`、创建任务或重发飞控请求。 +- 新增 Debug/Release 共用的系统日志,最新前缀按用户要求改为 `【模块-Request】` / `【模块-Response】`,包含请求关联、完整响应、业务状态、页面生命周期和 RTC 回调。使用说明见 [Release 日志与轮询](docs/9.9.1/Release机巢日志与轮询-2026-11-02.md)。历史“不轮询”记录仅描述当时版本。 +- 按后续要求扩大到机巢全部业务接口:机场、张工 multi-plane、景区空境库和共用 STS 均逐次打印请求与完整 JSON 响应,包含重复轮询;文件上传/下载另记录传输摘要。控制台按 `【机巢工作台-`、`【景区空境库-` 等模块标签过滤,或按 `path`、`request_id` 定位。 +- 最新用户要求取消控制台脱敏:请求头、URL、JSON/文本响应原样记录,包含 RTC/STS 字段;不再替换 ``。仅影响日志,不改变 UI 脱敏展示、文档历史示例或 Debug 禁飞限制。 + +## 2026-11-02:准备页长名称与提交反馈 + +- 点位卡片的名称完整换行,整行按最长名称统一增高;当前点位的航线标题同样完整换行,保留右侧航线数量。 +- 创建和召唤成功后不在正式准备页显示回执 JSON、任务 ID 或大块调试结果。任务身份及原始 data 仍供流程、控制台日志使用,订单次数摘要照常更新。 +- 创建失败、召唤失败分别显示业务原因;结果未知继续提示核对且锁定重复提交。明确包含未报备、报备未生效/失败/过期等文字时,显示“请先完成飞行报备”提醒,保留已选点位和航线,不继续召唤。 +- 用户提供的真实日志是 `shoot` 返回 `code=100099`、`msg=任务已结束,无法召唤;失败后请传 restart=true 重新召唤`,不是 `tasks/create` 未报备。不能仅凭 `100099` 判定报备问题。该场景保留原任务,按钮改为“查看拍摄任务”,必须明确点击才导航;不自动重发首次召唤、不自动 `restart=true`。 +- 用户于 2026-11-02 补充真实生产日志:`tasks/create` 成功后,朱工 `shoot` 返回 `41901`,提示当日未完成起飞报备,详见下节。准备页按该召唤错误码及明确文字显示报备提醒;不把通用 `100099` 当作未报备。 +- 验证:准备页相关 89 项模拟器测试全部通过;已检查长名称、未报备弹窗和任务已结束提示的截图。Release 无签名编译通过。本轮未创建真实任务、召唤无人机或开启图传。 + +## 2026-11-02:用户补充 shoot 未报备真实响应 + +来源为用户提供的生产环境控制台日志,代理未重放请求。16:52:13 张工 `POST /api/yf-handset-app/photog/multi-plane/tasks/create` 返回 `code=100000`,创建任务 `task_id=3`;随后朱工 `POST /api/app/airport/shoot` 收到 `{ "id": 3, "restart": false }`,于 16:52:14 返回 HTTP 200: + +```json +{ + "code": 41901, + "data": [], + "msg": "该无人机今日未完成起飞报备,请先提交报备截图", + "time": "2026-11-02 16:52:14" +} +``` + +- 失败发生在召唤步骤,任务创建已成功;HTTP 200 不等于业务成功。 +- 客户端保留业务码,仅在召唤阶段将 `41901` 识别为未报备;同时兼容“未完成起飞报备”等明确文字。不将该错误码推断为张工创建接口的合同。 +- 准备页显示“请先完成飞行报备”弹窗,保留后端原文,并提示联系相关负责人完成该无人机今日起飞报备、提交报备截图,确认生效后再重试。 +- 保留原任务、点位与航线,留在准备页。状态刷新不自动重发;用户手动点击“重试召唤”时复用当前任务,不重复创建,不擅自改为 `restart=true`。 +- 测试使用隔离替身与虚构任务身份,不将登录凭证或原始日志纳入工程。 +- 验证:67 项相关模拟器测试全部通过,覆盖 41901 解包、报备弹窗、保留原任务、手动重试、防重复创建及结果未知保护。本次没有调用真实创建或召唤接口。 + +## 1. 阅读说明 + +- **底部安全控制模拟入口**:`--dock-command-mock` 直接进入模拟拍摄中;支持暂停、继续、返航及取消返航,右上角查看完整请求与回执。只在内存处理,详见 7.6.3。 +- **开始拍摄模拟入口**:`--dock-start-shoot-mock`;只使用内存响应,不联网。成功/业务拒绝/超时三种场景与完整回执见第 7.6.2 节。 +- **准备到任务的模拟入口**:Debug 真实准备页右上角“本地模拟”,或启动参数 `--dock-preparation-mock`。进入独立模拟准备页后点击“确认并召唤(模拟)”,在内存中完成创建、召唤并带同一任务 ID 跳到模拟任务页;真实提交保护不变。 +- **当前模拟调试方式**:`--dock-ui-preparation-preview`、`--dock-ui-task-preview` 使用纯内存演示状态;接口合同用 Mock 响应验证参数、解析、成功/失败和页面切换。模拟结果不能记成真实接口成功。`--dock-*-live` 仍连接真实服务,受 Debug 禁飞保护,不能用于执行飞控。 +- **后端模拟协议**:当前提供的文档没有 `dry_run` 或模拟设备参数。不得自行添加一个未约定的字段后调用真实 `shoot`;后端提供明确不会向设备下发指令的独立模拟协议并经用户确认后,才对接该模拟服务,不能因此放行真实飞控。 +- **禁飞保护验证**:2026-10-29 模拟器 77 项相关测试通过,全部使用内存响应或不联网探针;覆盖真实传输零指令、创建前阻断、强类型/裸 JSON/multipart 三条发送入口、只读查询关闭实时采集、本地拦截不进入结果未知锁及既有 Mock 合同。未调用真实创建、召唤或设备控制接口。 + +- **已接入**:当前正式页面已发出请求并处理响应。 +- **已实现,待真实联调**:代码和测试已接入,但尚未取得该动作的真实成功响应。 +- **历史已停用**:保留此前联调响应供追溯,当前正式页面不再调用。 +- **未接入**:只有演示 UI 或后端文档设计,当前正式页面没有调用对应业务接口。 +- 本文“实测示例”来自已保存的控制台响应,标注各自时间;独立订单页第 4.4 节已采样四个状态,素材库第 8 节已采样摘要、全部任务与两个点位。空记录只代表采样时的情况。 +- JSON 均可独立解析。设备序列号、订单号、手机号、工作人员 ID、付款码/样片地址和点位位置已替换为测试值;景区 `271`、项目 `386`、点位/航线 ID、业务字段、数值类型、空值及业务错误保持原结构。`TEST-ORDER-001` 在首页与准备页中表示同一笔采样订单。 +- `example.com` 地址只是字段格式示例,不能用于实际收款或播放。未记录登录 Token。 +- 本地原始响应目录目前属于联调资料,未纳入此前代码提交;克隆仓库后这些原始文件链接可能不可用,正文仍包含必要 JSON。 + +## 2. 页面与接口总览 + +当前机巢模块已实现 **18 个业务接口及 1 个通用 STS 接口**(其中 `start-shoot`、`command`、`shoot` 的重召唤和 `live` 仅启用纯本地模拟;`live` 的真实播放协议待补齐)。游客交付确认新增 `orders/confirm-code`,并复用 `orders/detail` 和 `tasks`,见 9.5。拍摄任务页复用已实现的 `shooting` API;它由任务页读取,准备页不直接调用。`shooting` 已取得类型 25 的真实响应;`tasks/create → shoot` 对任务 6 业务成功,但随后回查显示航线执行失败、禁止拍摄。任务页成功导航仍有网络替身测试覆盖;成片保存及 STS 上传已于 2026-10-30 完成真实联调,游客确认仍待真实联调。独立订单页复用首页已使用的 `orders`。 + +| 页面/区域 | 提供人 | 方法与完整路径 | 当前状态 | +| --- | --- | --- | --- | +| 首页:顶部无人机 | 朱工 | `GET /api/app/airport/home` | 已接入,仅使用设备信息 | +| 首页:我的拍摄订单 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/orders` | 已接入,支持分页 | +| 我的拍摄订单独立页:四分类列表 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/orders` | 已接入,支持状态筛选与分页 | +| 首页:今日统计 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/today-stats` | 已接入 | +| 订单交付确认:生成游客确认小程序码 | 张工 | `POST /api/yf-handset-app/photog/multi-plane/orders/confirm-code` | 已实现,待真实联调;点击核对后出码 | +| 订单交付确认:整单清单及确认结果 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/orders/detail`、`GET /api/yf-handset-app/photog/multi-plane/tasks` | 进入读取整单;出码后的状态刷新只读 detail,无定时轮询 | +| 机巢套餐收款页:套餐选择 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/projects` | 已接入 | +| 机巢套餐收款页:生成小程序收款码 | 张工 | `POST /api/yf-handset-app/photog/multi-plane/pay-code` | 已接入 | +| 收款记录页 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/receipts` | 已接入,支持分页 | +| 拍摄准备页:已购套餐、点位、航线、次数 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/project-info` | 已接入 | +| 拍摄准备页:机巢连接、推荐无人机状态与电量 | 朱工 | `GET /api/app/airport/plane-status` | 已接入,页面可见且 App 活跃时轮询 | +| 拍摄准备页:创建待飞任务 | 张工 | `POST /api/yf-handset-app/photog/multi-plane/tasks/create` | 已实测成功;最新 16:03:01 创建 task_id=6,剩余 5,随后调用 shoot | +| 拍摄准备页:对已创建任务确认并召唤 | 朱工 | `POST /api/app/airport/shoot` | 16:03:31 真实成功,id=6 且省略 plane_id;回执绑定飞机 61、航线任务 1926,业务成功后进入同任务页 | +| 拍摄任务页:任务摘要、六项读数与阶段状态 | 朱工 | `GET /api/app/airport/shooting` | 已接入,取消定时轮询;进入、可见时返回前台或手动刷新各读一次;16:04:52 任务 6 的航线执行失败、门禁阻止拍摄 | +| 拍摄任务页:开始拍摄 | 朱工 | `POST /api/app/airport/start-shoot` | 已实现纯内存 Mock;真实入口禁用,84 项相关测试通过,见 7.6.2 | +| 拍摄任务页:底部安全控制 | 朱工 | `POST /api/app/airport/command` | 已实现纯内存 Mock;真实入口禁用,暂停/继续/返航/取消返航共用,见 7.6.3 | +| 拍摄任务页:实时图传 | 朱工 | `GET /api/app/airport/live?id=原任务ID` | 2026-11-02 已接火山 RTC 参数及播放器;Release 手动开启,Debug 继续拦截;真实画面尚未联调,见 7.6.5 | +| 拍摄任务页:失败后重新召唤 | 朱工 | `POST /api/app/airport/shoot`,`id/restart=true` | 已实现同任务纯内存模拟、受理后单次回查和防重;真实入口禁用,见 7.6.4 | +| 订单素材库:整单摘要与点位标签 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/orders/detail` | 已接入 | +| 订单素材库:任务、原素材与点位筛选 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/tasks` | 已接入,不分页 | +| 订单素材库:下载所选素材并保存相册 | 张工提供素材地址,客户端下载及保存 | `GET materials[].file_url` | 直接下载已就绪原素材;无需新增业务接口,见 8.3 | +| 交付成片:订单权限与购买点位 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/orders/detail` | 复用已接入接口 | +| 交付成片:任务选择与已有成片 | 张工 | `GET /api/yf-handset-app/photog/multi-plane/tasks` | 复用已接入接口,读取全部任务后本地筛选 | +| 交付成片:上传凭证 | 既有通用接口,张工文档指定复用 | `GET /api/app/config/get-sts-token` | 2026-10-30 真实上传成功,见 9.4 | +| 交付成片:保存或替换成片 | 张工 | `POST /api/yf-handset-app/photog/multi-plane/tasks/film` | 2026-10-30 真实保存及回查成功,见 9.4;替换流程已通过模拟验证 | + +准备页已停用朱工 `workbench`,历史响应保留在第 7.3 节;召唤 `shoot` 见第 7.7 节。订单素材库见第 8 节;交付成片见第 9 节。到达后开始拍摄已通过纯本地模拟,真实入口禁用,见第 7.6.2 节;暂停/继续/返航/取消返航已支持纯本地模拟,见 7.6.3;订单原素材批量下载与保存相册已接入,见 8.3;游客交付确认已实现,待真实联调,见 9.5。 + +## 3. 公共约定 + +| 项目 | 当前约定 | +| --- | --- | +| 测试环境 | `https://api-test.zhifly.cn` | +| 生产环境 | `https://api.zhifly.cn` | +| 当前 App 鉴权 | 统一 `APIClient` 注入 HTTP Header `token: <当前登录凭证>` | +| 其他公共请求头 | `Accept: application/json`、`Content-Type: application/json`、`X-APP-VERSION`、`X-OS-TYPE` | +| GET 参数 | URL 查询串 | +| POST 参数 | JSON body | +| 成功判断 | HTTP 成功后还需检查业务 `code == 100000`;其他业务码显示 `msg` | +| 返回包裹 | `code`、`msg`、`data`,通常还有 `time`;`data` 的对象/数组类型由具体接口决定 | +| 账号范围 | 当前登录的门店工作人员及当前景区;不通过传其他工作人员 ID 切换归属 | +| 页面隔离 | 账号、Token、景区、门店变化后,旧请求结果不能回填当前页面 | + +朱工文档顶部写有 `YFHandSetAppToken` 鉴权标识;**当前 App 实际发送的请求头名是 `token`**,不要把两者混写成已验证的两套 HTTP Header。 + +代码依据:[APIClient.swift](suixinkan/Core/Networking/APIClient.swift)。 + +## 4. 机巢工作台首页 + +页面:[DroneDockHomeViewController.swift](suixinkan/UI/DroneDock/DroneDockHomeViewController.swift) +API:[DroneDockAPI.swift](suixinkan/Features/DroneDock/API/DroneDockAPI.swift) +状态:[DroneDockHomeViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockHomeViewModel.swift) + +页面出现、返回首页或下拉刷新时,并行读取设备、订单第一页和今日统计。三个请求分别处理失败,某一区域失败不会清空其他区域的成功结果;本轮请求结束后统一刷新界面。点击“加载更多订单”只读取 `orders` 下一页。 + +### 4.1 顶部无人机:朱工 home + +`GET /api/app/airport/home?scenic_id=271` + +| 参数 | 必填 | 当前使用 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 ID | + +新版请求不再发送 `store_id`。代码保留门店 ID 仅用于本地身份有效性校验。 + +**实测响应:2026-10-28 15:51:40,成功。** 原响应有两台设备,以下截取一台,保留单台设备的全部字段与六项读数。 + +```json +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "河南嵩山", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "TEST-AIRPORT-61", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-28 15:51:40" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/home-split-integration-2026-10-28/home-response.json)。 + +页面使用 `name`、`work_status_label`、`metrics` 等字段。六项读数按 `battery/env_temp/wind_speed/rainfall/signal/satellite` 匹配;缺失或未知显示“—”,不显示为 0。当前样本两台设备均离线。 + +新版首页**不再从 home 读取订单和统计,也不以旧字段作为失败回退数据**。 + +### 4.2 我的拍摄订单:张工 orders + +`GET /api/yf-handset-app/photog/multi-plane/orders?scenic_id=271&status=all&page=1&page_size=20` + +| 参数 | 必填 | 当前 App 使用 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 ID | +| `status` | 否 | 首页固定 `all`;后端另支持 `pending/processing/completed` | +| `page` | 否 | 首次 1,后续递增 | +| `page_size` | 否 | 当前 20;后端最大 100 | + +**实测响应:2026-10-28 15:51:40,成功;总共两笔订单。** + +```json +{ + "code": 100000, + "data": { + "list": [ + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + }, + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:16:18", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-002", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + } + ], + "page": 1, + "page_size": 20, + "total": 2 + }, + "msg": "success", + "time": "2026-10-28 15:51:40" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/home-split-integration-2026-10-28/orders-response.json)。 + +字段与页面对应: + +| 返回字段 | 用途 | +| --- | --- | +| `order_number` | 订单编号,也是 Diffable 列表稳定身份 | +| `project_id` | 已购项目 ID,随订单传给准备页 | +| `project_name`、`user_phone` | 套餐名称、已脱敏游客手机号 | +| `shoot_count/shot_count/remaining_count` | 总次数、已成功拍摄次数、剩余次数,直接使用后端值 | +| `shoot_status` | `pending` 待拍摄、`processing` 进行中、`completed` 已完成 | +| `can_create_task` | 为 true 时提供“开始拍摄”入口;不是起飞许可 | +| `can_confirm`、`can_upload_film` | 首页卡片当前用于动作入口映射;成片上传已从独立订单页和素材库接入,首页直接入口与游客确认尚未接入 | +| `material_status` | 0 未开始、1 已完成、2 上传中、3 上传失败;不等于订单完成状态 | +| `total` | 标题中的订单总数,不能用当前页 `list.count` 代替 | + +“开始拍摄”当前只负责打开准备页,传入景区、订单号、项目 ID;**跳转前不发创建任务或召唤请求**,也没有额外调用 `orders/detail`。 + +### 4.3 今日统计:张工 today-stats + +`GET /api/yf-handset-app/photog/multi-plane/today-stats?scenic_id=271` + +必填参数只有 `scenic_id`,App 不传本地日期。 + +**实测响应:2026-10-28 15:51:40,成功。** + +```json +{ + "code": 100000, + "data": { + "cash_paid": "0.00", + "cash_refund": "0.00", + "completed_count": 0, + "deal_amount": "0.00", + "deal_count": 0, + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + }, + "msg": "success", + "time": "2026-10-28 15:51:40" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/home-split-integration-2026-10-28/today-stats-response.json)。 + +| 首页文案 | 返回字段 | 统计口径(张工文档) | +| --- | --- | --- | +| 成交订单 | `deal_count` | 今天付款,当前仍为已付款/已完成的订单数 | +| 成交金额 | `deal_amount` | 上述订单现金实收减成功现金退款 | +| 完成拍摄 | `completed_count` | 今天经游客确认完成、当前状态为已完成的订单数;并非飞行成功任务数 | + +仅统计本人、当前景区、类型 25;日界限为 `Asia/Shanghai` 当天。当前样本均为 0。接口失败保持未知占位和错误提示,不能显示成成功零值。 + +### 4.4 我的拍摄订单独立页面:张工 orders + +页面:[DroneDockOrdersViewController.swift](suixinkan/UI/DroneDock/DroneDockOrdersViewController.swift) + +状态:[DroneDockOrdersViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockOrdersViewModel.swift) + +完整订单卡:[DroneShootingOrderCardView.swift](suixinkan/UI/DroneDock/DroneShootingOrderCardView.swift) + +正式入口:首页“我的拍摄订单”右侧“查看全部”。进入列表默认查询 `all`;页面出现、从准备页返回、下拉刷新及失败重试重新查询当前分类第 1 页。每页 20 条;“加载更多订单”请求下一页。列表分页独立于首页,只读取 `orders`。 + +`GET /api/yf-handset-app/photog/multi-plane/orders?scenic_id=271&status=all&page=1&page_size=20` + +| 页面筛选 | 请求 status | 当前实测 total(2026-10-28) | +| --- | --- | --- | +| 全部 | `all` | 2 | +| 待拍摄 | `pending` | 2 | +| 进行中 | `processing` | 0 | +| 已完成 | `completed` | 0 | + +切换分类从第 1 页重新请求,不在当前已加载页上做本地筛选。翻页继续传相同 `status`。数量取服务端 `total`,不以当前页条数替代;下一页失败保留已有订单并重试同一页。分类、账号、景区或门店变化后拒绝旧请求回填。 + +卡片展示游客手机号、订单号、创建时间、套餐、已拍/总次数、剩余次数、进度条、素材与交付/确认摘要。状态取 `shoot_status`,次数取 `shoot_count/shot_count/remaining_count`;剩余 0 不自行判为已完成。未知次数显示“—”,不填 0。`can_create_task=true` 时进入现有真实准备页,跳转前不请求 `workbench`,也不创建任务;进入准备页后读取 `project-info` 和 `plane-status`。“查看素材”进入真实订单素材库(第 8 节),页面出现后请求摘要与任务;“交付成片”已进入第 9 节共用页,交付确认入口仍提示暂未开放。 + +以下为本轮模拟器通过当前登录账号、景区 `271` 实际请求的脱敏响应;`pending` 的两条订单结构与 `all` 相同,完整样本见下方存档链接。 + +**`status=all` 实测返回:2026-10-28 17:24:48。** + +```json +{ + "code": 100000, + "data": { + "list": [ + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + }, + { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:16:18", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-002", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "user_phone": "130****0001" + } + ], + "page": 1, + "page_size": 20, + "total": 2 + }, + "msg": "success", + "time": "2026-10-28 17:24:48" +} +``` + +**`status=processing` 实测返回:2026-10-28 17:25:15。** + +```json +{ + "code": 100000, + "data": { + "list": [], + "page": 1, + "page_size": 20, + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:25:15" +} +``` + +**`status=completed` 实测返回:2026-10-28 17:25:28。** + +```json +{ + "code": 100000, + "data": { + "list": [], + "page": 1, + "page_size": 20, + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:25:28" +} +``` + +响应存档:[全部](docs/9.9.1/orders-integration-2026-10-28/orders-all-response.redacted.json)、[待拍摄](docs/9.9.1/orders-integration-2026-10-28/orders-pending-response.redacted.json)、[进行中](docs/9.9.1/orders-integration-2026-10-28/orders-processing-response.redacted.json)、[已完成](docs/9.9.1/orders-integration-2026-10-28/orders-completed-response.redacted.json)。 + +页面截图:[真实订单列表](docs/9.9.1/orders-integration-2026-10-28/orders-all-real.jpg)(本地联调留存,不随代码提交)。订单号与手机号在 JSON 中已替换为测试值;截图为 App 原有脱敏展示。 + +本轮验证:模拟器构建成功,相关 **87 项测试均已通过**,包括四状态请求、切换分类后的迟到响应隔离、分页失败重试、准备页导航及共用完整卡的旧流程回归。首轮 86 项通过;分页 UI 用例修正为从当前可见分页行读取重试按钮后,订单页全部 8 项复跑通过。真实环境只有两笔待拍订单,非空进行中/已完成和第二页数据使用匿名测试替身验证。 + +## 5. 机巢套餐收款页 + +页面:[DroneDockPaymentViewController.swift](suixinkan/UI/DroneDock/DroneDockPaymentViewController.swift) +API:[DroneDockPaymentAPI.swift](suixinkan/Features/DroneDock/API/DroneDockPaymentAPI.swift) + +### 5.1 获取可售套餐:张工 projects + +`GET /api/yf-handset-app/photog/multi-plane/projects?scenic_id=271` + +- 必填 `scenic_id`,没有分页。 +- 首次进入、身份变化及套餐加载失败重试时读取。 +- 正式页面进入时仅加载套餐,**不会自动生成付款码**。 + +**实测响应:2026-10-27 15:37:44,成功。** + +```json +{ + "code": 100000, + "data": [ + { + "id": 386, + "name": "多点位航拍", + "price": "99.00", + "shoot_count": 5 + } + ], + "msg": "success", + "time": "2026-10-27 15:37:44" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/payment-integration-2026-10-27/projects-scenic271-response.json)。 + +`price` 为元字符串,`shoot_count` 为整个套餐共享次数。成功但 `data: []` 表示暂无可售套餐,页面显示空态。 + +### 5.2 生成小程序收款码:张工 pay-code + +`POST /api/yf-handset-app/photog/multi-plane/pay-code` + +| body 字段 | 必填 | 当前使用 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 | +| `project_id` | 是 | 选中的可售套餐 | +| `price` | 否 | 本次报价字符串;省略时使用后端默认售价,不发空串或 null | + +使用套餐默认价的请求示例: + +```json +{ + "scenic_id": 271, + "project_id": 386 +} +``` + +修改报价的请求格式示例(并非下方实测响应对应的请求): + +```json +{ + "scenic_id": 271, + "project_id": 386, + "price": "88.00" +} +``` + +调用时机:确认套餐、确认修改金额、生成失败重试、点击“重新生成”。付款码图片下载失败后的“重新加载图片”只重试图片,不重新创建付款码。 + +**实测响应:2026-10-27 17:22:00,成功;小程序码图片版本。** + +```json +{ + "code": 100000, + "data": { + "pay_url": "https://example.com/mini_qr/pay-code.png", + "price": "99.00", + "project_id": 386, + "project_name": "多点位航拍", + "shoot_count": 5, + "store_id": 38, + "store_user_id": 51 + }, + "msg": "success", + "time": "2026-10-27 17:22:00" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/payment-integration-2026-10-27/pay-code-mini-program-responses.json)。 + +`pay_url` 是后端生成的**微信小程序码图片 URL**,App 直接加载图片,不把 URL 字符串再次编码成二维码。生成成功只表示得到收款码,不表示游客已付款。同一码可被多人购买,实际收款需查看收款记录。 + +旧存档 `pay-code-scenic271-response.json` 返回的是 `/wma/multi-plane/pay?...` 地址,属于早期合同,**不能作为当前图片展示接口的依据**。 + +Debug 联调参数 `--dock-payment-probe` 下存在自动选首套餐生成码的逻辑,仅用于联调,不属于正常页面行为。 + +## 6. 收款记录页 + +页面:[DroneDockReceiptsViewController.swift](suixinkan/UI/DroneDock/DroneDockReceiptsViewController.swift) +状态:[DroneDockReceiptsViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockReceiptsViewModel.swift) + +### 6.1 查询收款记录:张工 receipts + +`GET /api/yf-handset-app/photog/multi-plane/receipts?scenic_id=271&page=1` + +| 参数 | 当前 App 使用 | +| --- | --- | +| `scenic_id` | 必填,当前景区 | +| `page` | 第一页为 1,加载更多递增 | +| `project_id` | 可选;顶部“收款记录”不传,码区域“刷新收款记录”传当前码的项目 ID | +| `start_date/end_date/page_size` | 后端支持,但当前页面不传,使用后端默认值 | + +页面出现、下拉刷新、加载更多时调用。后端文档默认日期为最近 7 天、每页 20 条。汇总取后端 `summary`,不累加当前已加载页。 + +**实测响应:2026-10-27 15:34:27,成功空态。** 以下仅省略分页导航 URL、`links/from/to/path` 等辅助字段,保留当前 App 使用的完整分页与汇总字段。 + +```json +{ + "code": 100000, + "data": { + "records": { + "current_page": 1, + "data": [], + "last_page": 1, + "per_page": 20, + "total": 0 + }, + "summary": { + "cash_net": "0.00", + "cash_paid": "0.00", + "cash_refund": "0.00", + "count": 0, + "point_amount": "0.00", + "points_net": 0, + "points_paid": 0, + "points_refund": 0 + } + }, + "msg": "success", + "time": "2026-10-27 15:34:27" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/payment-integration-2026-10-27/receipts-scenic271-response.json)。 + +该样本不能说明目前仍没有收款记录。为便于后续非空数据联调,下面附**张工接口文档的 `data` 非空示例**(不是实测响应,不含外层 `code/msg/time`): + +```json +{ + "records": { + "current_page": 1, + "per_page": 20, + "total": 1, + "last_page": 1, + "data": [ + { + "project_id": 101, + "project_name": "三点位航拍", + "order_number": "HT202610270001", + "order_status": 20, + "pay_time": 1793066400, + "payer": "张**", + "cash_paid": "88.00", + "cash_refund": "8.00", + "cash_net": "80.00", + "points_paid": 0, + "points_refund": 0, + "points_net": 0, + "point_amount": "0.00" + } + ] + }, + "summary": { + "count": 1, + "cash_paid": "88.00", + "cash_refund": "8.00", + "cash_net": "80.00", + "points_paid": 0, + "points_refund": 0, + "points_net": 0, + "point_amount": "0.00" + } +} +``` + +注意:收款分页是 `data.records.data`,首页拍摄订单分页是 `data.list`,两者不能共用同一解析结构。`pay_time` 为 Unix 秒,金额为元字符串。收款记录不能直接判定“当前展示的小程序码刚刚支付成功”。 + +## 7. 拍摄准备页 + +页面:[DroneDockRemotePreparationViewController.swift](suixinkan/UI/DroneDock/DroneDockRemotePreparationViewController.swift) +API:[DroneDockPreparationAPI.swift](suixinkan/Features/DroneDock/API/DroneDockPreparationAPI.swift) +任务创建:[DroneDockTaskCreationAPI.swift](suixinkan/Features/DroneDock/API/DroneDockTaskCreationAPI.swift) + +确认召唤:[DroneDockShootAPI.swift](suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift) + +任务状态(准备页不再调用):[DroneDockShootingAPI.swift](suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift) +购买模型:[DroneDockProjectInfoModels.swift](suixinkan/Features/DroneDock/Models/DroneDockProjectInfoModels.swift) +状态:[DroneDockPreparationViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockPreparationViewModel.swift) + +### 7.1 调用顺序与数据归属 + +1. 首页点击“开始拍摄”,先跳转到准备页。 +2. 准备页出现后分别请求张工 `project-info` 和朱工 `plane-status`,购买配置与设备状态独立更新;不请求定位,也不调用 `workbench`。 +3. 页面下拉或点击“刷新状态”重新读取两个接口。无人机状态还在页面可见且 App 活跃时持续轮询,每次响应完成后等待 `poll_hint_ms` 建议间隔再请求,默认 5 秒并限制在 5~60 秒;不叠加未完成请求。 +4. 离开页面或 App 失去活跃状态时取消状态请求与轮询,返回前台且页面可见时重新读取。状态接口失败会清除旧设备状态并显示未知,不清空已购配置或改变所选点位、航线。 +5. 用户首次明确点击“确认并召唤”后,先重新请求 `project-info` 复核权限、次数和所选点位航线,再发送一次 `tasks/create`;创建成功后自动以返回的 `task_id` 作为朱工 `shoot.id` 提交召唤。召唤业务成功后自动跳转到拍摄任务页,传递同一个任务 ID、订单和景区身份。内部仍保留两份回执,正式准备页不展示成功 JSON。详见第 7.5~7.7 节。 +6. 已有创建回执时保留该任务 ID。`shoot` 明确业务拒绝后允许“重试召唤”,只重试同任务的 `shoot`,不重建任务;召唤成功或结果未知时锁定再次提交。从任务页返回后,准备页按钮显示“查看拍摄任务”,再次点击只进入该任务,不重复创建或召唤。进入准备页、购买刷新和无人机轮询均不自动创建任务或发送召唤;`shooting` 由任务页出现后读取。 + +| 页面内容 | 权威数据来源 | +| --- | --- | +| 套餐名称、总次数、已拍次数、剩余次数、订单操作权限 | 张工 `project-info` 的根级订单摘要;创建成功后优先使用 `tasks/create` 返回的最新订单摘要 | +| 可选点位、可选航线及可用性 | 张工 `project-info.spot` | +| 点位封面 | 优先 `spot[].cover_url`;缺失或地址无效时,按接口顺序取同一点位 `air_lines[].samples[].cover_url` 的首个有效地址;均不可用时使用中性占位,不使用其他点位图片或视频地址 | +| 样片元数据 | `air_lines[].samples` 已解析保留,当前准备页尚未新增样片播放入口 | +| 机巢连接 | 朱工 `plane-status.connected`;true 已连接、false 未连接、缺失或请求失败待确认 | +| 无人机工作状态与电量 | 优先使用朱工 `plane-status.recommend.status_text`;不按设备列表自行重选推荐设备 | +| 待飞任务 ID 与创建结果 | 张工 `tasks/create.task_id` 及 `data`(内部使用与控制台日志,不在页面展示 JSON);仅明确点击后创建 | +| 召唤提交结果 | 朱工 `shoot` 的业务成功/错误及实际 `data` JSON;已取得任务 6 成功样本,订单飞行任务 ID 读取 `order_flight_task.id`,见 7.7.2 | +| 任务状态与后续飞行阶段 | 拍摄任务页读取朱工 `shooting` 的任务摘要、`ui/execute_gate`、`current_plane` 和六项读数;准备页不直接读取,见 7.6 | +| 实际飞行执行 | 当前只接召唤提交,不执行 `start-shoot/command`;连接成功、空闲、`can_fly=true` 或召唤受理均不能表示已到达、已起飞或拍摄完成 | +| 距离、位置与范围 | 2026-10-29 产品确认移除相关展示,包括点位卡范围/米数/定位图标和底部范围状态,不保留“距离待确认”“位置待确认”占位 | +| 点位已拍信息 | `project-info` 未提供;不使用历史 workbench 响应补充,缺失值保持未知 | + +已购点位、航线和次数仅使用 `project-info`,不使用历史 workbench 数据回填。`available=false` 或缺失时不可选择;航线不可用原因直接展示后端文案。 + +2026-11-02 封面修复:用户提供的真实响应中,三个点位的 `cover_url` 均为空,但本点位航线样片的封面有效;三个图片地址只读检查均返回 HTTP 200、`image/png`。客户端已按上表补充同点位样片封面回退,并在卡片复用或缺图时清除旧加载身份。38 项相关模拟器测试通过,包含缓存图片实际展示、不同点位切换和缺图清理;没有调用创建或飞控接口。 + +### 7.2 获取已购配置:张工 project-info + +`GET /api/yf-handset-app/photog/multi-plane/project-info?scenic_id=271&project_id=386&order_number=TEST-ORDER-001` + +| 参数 | 必填 | 来源 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 | +| `project_id` | 是 | 首页 orders 返回的项目 ID | +| `order_number` | 拍摄准备必须传 | 首页选中订单号,必须与项目对应 | + +缺少项目 ID 或订单号时在本地拦截,不改成查询当前在售套餐;不另调 `orders/detail`。响应中的订单号、项目 ID 必须与本次请求一致。 + +**实测响应:2026-10-28 16:23:11,成功。** 当前订单有两个已购点位,各一条航线;总次数 5、已拍 0、剩余 5。以下完整保留字段结构,位置和媒体地址已替换为示例值。 + +```json +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-001", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "spot": [ + { + "air_lines": [ + { + "air_line_id": 302, + "air_line_name": "天门寻梦", + "available": true, + "samples": [ + { + "cover_url": "https://example.com/samples/318.png", + "id": 318, + "name": "天门寻梦", + "preview_url": "https://example.com/samples/318.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "测试景区拍摄点", + "lat": 32.4, + "lot": 119.4, + "scenic_spot_str": "测试点位" + }, + "sample_piece_ids": [ + 318 + ], + "samples": [ + { + "id": 318, + "name": "天门寻梦" + } + ], + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "air_lines": [ + { + "air_line_id": 304, + "air_line_name": "天门远山", + "available": true, + "samples": [ + { + "cover_url": "https://example.com/samples/319.png", + "id": 319, + "name": "天门远山", + "preview_url": "https://example.com/samples/319.mp4" + } + ], + "unavailable_reason": "" + } + ], + "available": true, + "cover_url": "", + "region": { + "address": "测试景区拍摄点", + "lat": 32.4, + "lot": 119.4, + "scenic_spot_str": "测试点位" + }, + "sample_piece_ids": [ + 319 + ], + "samples": [ + { + "id": 319, + "name": "天门远山" + } + ], + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0001" + }, + "msg": "success", + "time": "2026-10-28 16:23:11" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/project-info-integration-2026-10-28/project-info-response.json)。 + +关键差异: + +- 购买点位数组字段是单数 **`spot`**,不是 `spots`。 +- 点位名称字段是 **`scenic_spot_name`**;航线名称字段是 **`air_line_name`**。 +- `region` 本次真实返回为对象,文档允许缺失/空值;当前页面不根据该字段自行计算距离或拍摄半径。 +- 点位 `cover_url` 本次为空;航线样片中有 `cover_url/preview_url`,不能把点位缺图描述成后端完全没有样片图片。 +- 项目后续编辑、改价、下架不应扩大或收回已购范围;后端仍需校验点位、航线的当前可用性。 +- 项目接口失败时清除购买配置与选中项,不回退到朱工列表或历史缓存中的设备响应。 + +### 7.3 历史已停用:朱工 workbench + +**当前准备页不再调用此接口,也不再为此请求定位。** 以下仅保留停用前的请求参数与真实响应,供追溯接口分工和旧数据结构。 + +`GET /api/app/airport/workbench?scenic_id=271&order_number=TEST-ORDER-001` + +| 参数 | 停用前的请求方式 | +| --- | --- | +| `scenic_id` | 必填,当前景区 | +| `order_number` | 必填,选中订单号 | +| `lat/lng` | 定位成功后成对传入;失败时两者都省略 | + +**停用前多点位订单的历史真实响应:2026-10-28 16:23:21。HTTP 为 200,但业务失败,不能按成功解析。** + +```json +{ + "code": 100099, + "data": [], + "msg": "多点位航拍请使用专用订单接口", + "time": "2026-10-28 16:23:21" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/project-info-integration-2026-10-28/workbench-response.json)。 + +此前停用 `workbench` 后,页面使用 `project-info` 返回的已购套餐、点位和航线,设备状态保持未知。2026-10-29 已改由第 7.4 节 `plane-status` 提供实时设备状态;距离与范围模块仍已移除,不再展示这次历史业务失败作为当前请求错误。 + +**当前衔接:**按朱工 14:50 版合同,张工 `tasks/create` 的 `task_id` 作为朱工 `shoot` 的 `id`,见第 7.5、7.7 节;准备页不再调用 `shooting`。实时设备展示继续使用 `plane-status`,购买权限、设备展示状态或召唤请求被接受都不能据此判断实际起飞已经发生。 + +下面为**此前另一笔订单的历史成功响应节选**(2026-10-28 14:47:44),只用于说明旧 workbench 结构,不代表当前多点位订单已经支持。设备数组和点位数组各保留一项: + +```json +{ + "code": 100000, + "data": { + "airports": [ + { + "id": 61, + "is_receive_order": 1, + "metrics": [ + { + "key": "battery", + "label": "电池电量", + "raw": null, + "value": "—" + }, + { + "key": "env_temp", + "label": "环境温度", + "raw": null, + "value": "—" + }, + { + "key": "wind_speed", + "label": "风速", + "raw": null, + "value": "—" + }, + { + "key": "rainfall", + "label": "雨量", + "raw": null, + "value": "—" + }, + { + "key": "signal", + "label": "信号状态", + "raw": null, + "value": "—" + }, + { + "key": "satellite", + "label": "搜星状态", + "raw": null, + "value": "—" + } + ], + "name": "河南嵩山", + "online_status": 2, + "scenic_area_id": 271, + "sn_number": "TEST-AIRPORT-61", + "task_type": null, + "work_status": 0, + "work_status_label": "离线" + } + ], + "order_number": "LEGACY-ORDER-001", + "order_progress": { + "order_number": "LEGACY-ORDER-001", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_remain": 1, + "shot_total": 1, + "shot_used": 0, + "status_label": "待拍摄" + }, + "recommend_plane": null, + "scenic_id": 271, + "shoot_gate": { + "can_shoot": false, + "code": "dock_offline", + "message": "机巢未连接", + "primary_action": "blocked", + "primary_action_label": "机巢未连接" + }, + "spots": [ + { + "air_lines": [ + { + "air_line_id": 301, + "estimated_fly_time": 279, + "fly_type": 1, + "line_video_duration": 14, + "name": "vue3" + } + ], + "distance_label": "3311.1 km", + "distance_m": 3311086, + "in_range": false, + "name": "测试打卡点", + "scenic_spot_id": 411, + "shot_count": 0, + "shot_status_label": "未拍摄" + } + ], + "tips": "每次拍摄成功后扣减 1 次,未成功不扣次数。" + }, + "msg": "success", + "time": "2026-10-28 14:47:44" +} +``` + +响应来源:[本地联调存档](docs/9.9.1/preparation-integration-2026-10-28/workbench-latest-response.json)。 + +这次历史请求未传经纬度,却返回约 3311 公里及 `in_range=false`。当前准备页不再读取或使用这类 workbench 距离/范围结果。后续对接实时入口时,需明确无定位的未知值语义,以及坐标系和范围校验规则。 + +### 7.4 底部无人机状态:朱工 plane-status + +API:[DroneDockPlaneStatusAPI.swift](suixinkan/Features/DroneDock/API/DroneDockPlaneStatusAPI.swift) + +模型:[DroneDockPlaneStatusModels.swift](suixinkan/Features/DroneDock/Models/DroneDockPlaneStatusModels.swift) + +`GET /api/app/airport/plane-status?scenic_id=271&live_battery=1` + +| 参数 | 当前使用 | +| --- | --- | +| `scenic_id` | 当前景区,必须为正整数;响应景区必须一致 | +| `live_battery` | 显式传 `1`,请求实时电量 | + +不传订单号、项目 ID、门店 ID、经纬度或任务 ID。底栏使用服务端推荐设备的 `recommend.status_text`;该文案缺失时仅组合后端的 `work_status_label` 和 `battery_label`,不把缺失电量补为 0。无设备显示“暂无无人机”,有设备但没有推荐设备时显示“状态待确认”。`work_status` 的 1 显示绿色、2 显示橙色、0 或未知显示灰色;此枚举使用本接口约定,不套用首页状态。 + +**实测响应:2026-10-29 11:06:12,HTTP 200、业务码 100000。** 景区 271 返回三台设备:58 空闲、电量 93%,61 和 57 离线且电量未知;推荐设备为 58,`connected=true`。模拟器底栏已显示“机巢已连接”和“空闲 · 电量 93%”。以下截取推荐设备及整体状态,`planes` 完整三条记录见脱敏存档: + +```json +{ + "code": 100000, + "data": { + "connected": true, + "has_idle": true, + "has_shooting": false, + "poll_hint_ms": 5000, + "recommend": { + "battery_label": "电量 93%", + "battery_percent": 93, + "can_fly": true, + "id": 58, + "is_receive_order": 1, + "name": "测试设备 58", + "online_status": 1, + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%", + "task_type": null, + "work_status": 1, + "work_status_label": "空闲" + }, + "scenic_id": 271 + }, + "msg": "success", + "time": "2026-10-29 11:06:12" +} +``` + +完整响应来源:[plane-status-redacted.json](docs/9.9.1/plane-status-integration-2026-10-29/plane-status-redacted.json)。仅将设备名称和序列号替换为测试值,其余字段、顺序、类型、空串与 null 保持实测内容。请求仅用于只读展示,不恢复定位、`workbench` 或召唤写入。 + +验证:模拟器构建、真实响应显示通过,相关 **49 项不同测试通过**(plane-status API/Model 10、准备页 ViewModel 28、页面 11)。覆盖推荐状态与电量、连接/离线/未知、错误恢复、轮询与手动刷新、前后台及离开取消、购买配置独立更新,以及账号/景区变化时撤下旧点位和航线。 + +### 7.5 “确认并召唤”:张工 tasks/create,创建后调用召唤 + +`POST /api/yf-handset-app/photog/multi-plane/tasks/create` + +**创建已实测成功:11:56:26 创建任务 1;16:03:01 按用户明确要求重新创建一次,返回任务 6。** 当前流程使用创建回执 ID 调用朱工 `shoot`;任务 6 于 16:03:31 的召唤接口业务成功,16:04:52 回查显示航线执行失败,详见 7.7.2。成功后自动进入拍摄任务页的客户端流程由网络替身验证;内部保留两份回执,正式准备页不展示成功 JSON,返回后可查看原任务。新任务 6 是用户明确要求的一次新建,不是对任务 2 失败的自动重建或重试。本轮未调用 `start-shoot/command`。 + +| 参数 | 必填 | 当前来源 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 ID | +| `order_number` | 是 | 进入准备页时选中的订单号,最长 128 字符 | +| `scenic_spot_id` | 是 | 当前选择的已购可用点位 ID | +| `air_line_id` | 是 | 当前点位下选择的已购可用航线 ID | + +ID 必须为正整数。请求仅包含上述四项,不传 `project_id`、无人机 ID、门店 ID、经纬度或起飞控制参数。 + +**实测请求(景区 271,订单号已脱敏):** + +```json +{ + "scenic_id": 271, + "order_number": "TEST-ORDER-004", + "scenic_spot_id": 412, + "air_line_id": 302 +} +``` + +创建流程与按钮条件: + +1. 已成功加载当前订单购买配置,身份和订单项目对应;`can_create_task=true`、总次数有效且大于 0、剩余次数大于 0;所选点位与航线的 `available` 均明确为 true 时,允许首次点击。先创建待飞任务再提交召唤,不以 `plane-status` 的连接、电量或 `can_fly` 作为创建门槛。 +2. 点击后立即禁用重复提交并冻结点位航线,重新读取张工 `project-info`。如权限或次数已失效,则不发送 POST;原选择已失效时提示重新选择,不把此次点击自动转交给另一条航线。 +3. 预检通过后只发送一次 `tasks/create`。响应校验任务 ID 及订单归属,内部保留返回的 `data` 及未建模字段,正式页面不展示 JSON;不拼造 `code/msg/time` 或飞行状态。创建后的次数以返回的最新订单摘要为准,客户端不自行扣次。 +4. 创建成功后自动以同一个 `task_id` 请求 `shoot`,提交期间显示“正在召唤无人机…”并禁用重复点击。已创建任务始终保留创建回执及防重建锁;召唤重试也不会再发送 `tasks/create`。普通购买刷新、设备轮询、同实例离开返回均不清除此锁。 +5. 创建被后端明确业务拒绝时展示其错误,允许用户再次点击;购买预检失败尚未发出 POST,可重试。创建 POST 超时、网络/HTTP/解码错误,以及提交后取消或离开而结果未知时,显示“结果待核对”并保留防重复锁,不自动重发,也不继续调用 `shoot`。需先核对订单任务,再决定后续处理;本轮不增加未知创建结果的自动核对接口或任务重建流程。 +6. 账号、Token、景区或门店变化后拒绝迟到回执,旧页面实例不能恢复创建入口。 + +**实测完整响应:HTTP 200,业务码 100000。仅订单号和手机号脱敏。** + +```json +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": true, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "processing", + "shot_count": 0, + "task_id": 1, + "user_phone": "130****0004" + }, + "msg": "success", + "time": "2026-10-29 11:56:26" +} +``` + +张工约定:待飞任务不预占额度、不增加已成功拍摄次数;没有请求去重参数。返回的 `task_id` 是订单飞行任务 ID,飞行模块复用并更新该任务,不能再新建另一条订单任务。当前将该 ID 传给朱工 `shoot` 提交召唤;`start-shoot` 属于到达后的开始拍摄,当前不调用。 + +**此前单独创建阶段的实测记录:**完整响应见 [tasks-create-redacted.json](docs/9.9.1/task-create-integration-2026-10-29/tasks-create-redacted.json)。实际返回 `task_id=1`,订单进入 `processing`,已拍摄仍为 0、剩余 5,`can_upload_film=true`。创建时没有扣减次数。当时日志确认仅发出一次 `tasks/create` 写请求,没有朱工飞行接口调用;页面原位展示完整 data,按钮当时为“任务已创建”。随后曾改为同任务 `shooting` 读取,现已按上述规则改为同任务 `shoot` 召唤;未将历史创建响应写成新的创建记录。 + +此前创建阶段验证:模拟器构建及真实请求通过;相关 **64 项不同测试全部通过**(创建 API/Model 8、创建 ViewModel 14、准备页 ViewModel 28、页面 14)。覆盖提交参数、创建前复核、完整 JSON、成功/错误回显、单次 POST、重复点击锁、业务拒绝重试、未知结果锁及不跳页。真实环境只创建一次,未用真实订单重复执行成功测试。此前读取串接验证见第 7.6 节;当前召唤串接说明见第 7.7 节。 + +**任务 6 最新创建记录(2026-10-29 16:03:01):**先通过 `orders/detail` 与 `project-info` 确认同订单 `TEST-ORDER-004`、项目 386 的剩余次数为 5、`can_create_task=true`,点位 412 和航线 302 均可用,再发送上述四字段请求。返回 `code=100000`、`task_id=6`、`shoot_count=5`、`shot_count=0`、`remaining_count=5`,未因创建扣次。完整脱敏响应:[create-task6-redacted.json](docs/9.9.1/task-create-integration-2026-10-29/create-task6-redacted.json)。 + +### 7.6 拍摄任务页:朱工 shooting(含历史联调记录) + +页面:[DroneDockShootingTaskViewController.swift](suixinkan/UI/DroneDock/DroneDockShootingTaskViewController.swift) + +状态:[DroneDockShootingTaskViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockShootingTaskViewModel.swift) + +API:[DroneDockShootingAPI.swift](suixinkan/Features/DroneDock/API/DroneDockShootingAPI.swift) + +`GET /api/app/airport/shooting?id=&live_battery=1` + +**当前状态:真实拍摄任务页已接入,类型 25 已读取成功;最新任务 11 的召唤后回查显示航线执行失败、禁止拍摄,见 7.7.3。** 朱工 2026-10-29 14:50 版文档约定根据外部已创建的 `order_flight_task.id` 反查任务、航线、点位、景区及飞机信息;该接口只读任务,不创建或召唤。准备页在 `shoot` 业务成功后自动进入此页,首次 GET 在任务页实际出现后发送;任务 ID 始终来自同次创建回执。DEBUG 只读入口还可读取明确已存在的测试任务,不代表已执行召唤。 + +| 参数 | 必填 | 当前来源 | +| --- | --- | --- | +| `id` | 是 | 已明确创建成功的 `tasks/create.data.task_id`,不是订单号、点位 ID 或航线 ID | +| `live_battery` | 否 | API 合同及纯内存 Mock 使用 `1`;禁飞期间 Debug 真实传输强制为 `0`,不触发实时采集;布尔查询使用 `1/0` 编码 | + +该 GET 不发送 JSON body,不额外传景区、订单、点位、航线或经纬度参数。正式任务页只注入查询服务,没有创建、召唤或飞行控制依赖;独立 DEBUG 本地模拟入口另外注入开拍服务,见第 7.6.2 节。 + +**当前布局与状态动作:**顶部固定显示订单摘要、16:9 图传占位和六项读数,底部固定保留安全控制;加载、错误或业务状态变化不改变这两块区域的位置。中间占用剩余高度,按加载、前往、就绪、拍摄、暂停、返航、完成、失败、阻止、未知或读取错误组合图标、标题、说明、设备状态和主操作,没有滚动容器,也不使用整体 transform 缩放。 + +空间不足时收紧间距、图标和字号,正文不小于 12 点,操作点击高度不小于 44 点;紧凑布局可隐藏设备摘要、截断长文案,通过“详情”查看完整说明。未确认或冲突状态显示待确认,不补造进度。正式页面开始/恢复拍摄及底部暂停/返航仍是禁用状态;仅独立本地模拟入口允许开始拍摄,不调用真实控制接口;只有明确完成态提供“查看素材”,进入当前订单的真实订单素材库。 + +2026-10-29 失败态按产品体验网页单独组合:淡红圆底警示图标、固定标题“任务执行失败”、淡红失败原因条、排查提示、全宽带循环箭头的“重新召唤无人机”按钮和设备限制提示。不再显示通用“刷新状态+详情”按钮行;点击失败原因区域仍可查看完整说明,导航栏仍可手动刷新。原因优先使用 `order_flight_task.result_message / task.result_message`,再使用 `execute_gate.message / ui.message`;任务 11 当前明确离线,显示“无人机离线,暂不可召唤”,不套用网页示例的“返航中”。重新召唤尚未接入,始终禁用,不能将 `can_execute` 开始拍摄许可用于重召。顶部、底部位置固定,小屏仅收紧中间区域排版。 + +失败态对齐验证:模拟器 **65 项相关测试通过**(API 12、ViewModel 16、页面 15、固定布局 8、展示 14)。覆盖 375×146、402×220、402×207.875 的中间区域、长原因查看详情、禁用重召、固定三区及刷新保留旧内容;另以任务 11 的真实只读 `shooting` 响应验证页面,没有重新创建或召唤任务。 + +2026-10-29 16:56 模拟器重新运行此固定布局页面,只读 `shooting?id=6&live_battery=1` 一次。真实回执仍显示航线执行失败、当前设备离线,页面如实展示错误原因与当前六项读数;没有调用创建、召唤或飞行控制。本地截图(不纳入 Git):`docs/9.9.1/shooting-integration-2026-10-29/task6-fixed-layout-real.jpg`。 + +固定布局阶段验证:模拟器构建成功,相关 **52 项不同测试通过**(任务 API 12、任务 ViewModel 10、任务页面 12、布局 7、阶段展示 9、准备页串接 1、共用遥测旧页面回归 1)。首轮错误文案用例遗漏通用网络错误前缀,修正测试预期后阶段展示 9 项复跑通过;实际内容区域 `375×603`、`402×734` 的布局 7 项再次通过。覆盖 11 种展示状态、长文案与详情、固定区域不随加载/状态/遥测变化、最小点击尺寸、完成态素材导航、单次 GET 及无轮询。阶段组合使用匿名替身验证;真实任务仍处于失败态,没有模拟飞控执行成功。 + +**当前刷新与生命周期(按用户要求取消任务页定时轮询):** + +1. 每次进入任务页且 App 活跃时读取一次;返回前台且任务页仍可见时读取一次。不设定时器,不按 5 秒或 `plane_status.poll_hint_ms` 自动重复请求,不叠加未完成请求。 +2. 已移除下拉刷新;点击导航栏刷新按钮、中间状态区的“刷新状态”或错误后的“重新读取”,各只 GET 同一个任务 ID 一次。首次读取无数据时显示加载;已有成功快照时,刷新期间保留标题、任务状态、设备状态和六项读数,成功后一次性替换为新快照,不先切成空态。刷新中暂时禁用操作,防止重复请求。普通刷新失败保留旧数据并提示“刷新失败,当前显示上次数据”,详情也保留错误原因;非刷新动作保持禁用,用户可通过导航栏重试。首次读取失败仍显示错误页,不自动重试。 +3. 离开任务页或 App 失去活跃状态时取消进行中的请求并拒绝迟到响应;同一个页面实例、同一身份保留最近成功快照,返回后继续展示至新请求成功。不在后台或页面不可见时读取,不重建任务或重新召唤;账号、景区或门店等身份变化、响应身份不匹配时仍清除旧快照。 +4. 响应内提供的任务 ID、订单号、景区 ID 均与页面身份核对;账号、Token、景区或门店变化后不再使用旧页面读取。 +5. 返回同一个准备页实例后保留创建和召唤回执,按钮为“查看拍摄任务”;再次点击仅导航到原任务,没有第二次 `tasks/create` 或 `shoot`。自动跳转对同一任务只触发一次。 + +保留刷新快照阶段验证:模拟器 **49 项相关测试通过**(任务 ViewModel 16、阶段展示 11、任务页面 14、固定布局 7、准备页串接 1)。挂起网络请求验证同步点击及等待期间标题、状态和读数均不变,成功回包后更新为新数据;另覆盖首次加载、刷新失败提示与重试、回前台保留、重复点击抑制、取消后迟到数据隔离和身份变化清空。测试使用网络替身,没有发送真实创建、召唤或飞行控制请求。 + +**文档字段结构与页面使用:**以下字段来自朱工合同及 15:07 的真实响应,未返回的展示值保持未知;完整 `data` 保留原始 JSON,当前页面按字段展示,不额外铺开 JSON 文本。 + +| 返回字段 | 当前解析与展示 | +| --- | --- | +| `order_type/order_type_label`、`order_flight_task`、`task` | 保留订单类型、任务 ID、状态、航线任务关联等;合同任务状态为 10 待执行、20 执行中、30 成功、40 失败、50 取消、60 待确认,不从 GET 成功推导飞行完成 | +| `header.title` | 顶部标题;缺失时组合当前响应的点位和航线名称,仍缺失则显示“拍摄任务” | +| `header.tourist_label/package_name` | 顶部游客与套餐;仅缺失时使用入口订单摘要,不覆盖后端已返回文案;当前套餐口径冲突见下文 | +| `scenic`、`scenic_spot`、`air_line` | 解析景区、点位与航线摘要;用于身份核对和缺失标题的备用文本 | +| `current_plane.status_text/work_status_label/online_status/work_status` | 展示接口返回的任务设备状态;失败态依据明确离线或返航状态显示重召限制,不自行推断设备就绪;不使用准备页或 `plane_status.recommend` 替换 | +| `metrics[]` | 展示 `battery/env_temp/wind_speed/rainfall/signal/satellite` 六项,使用服务端文案及单位,0 为有效值,缺失显示“—” | +| `plane_status` | 保留设备列表、推荐设备、连接状态及原始 `poll_hint_ms`;任务页不再使用该建议间隔驱动请求,不作为派机或起飞许可 | +| `ui.title/message` | 结合任务、航线状态与门禁确定当前显示阶段;保留后端说明,缺失时使用 execute_gate.message。长文案在固定中间区域省略,详情可查看完整文字;不将任务总状态 20 直接当作正在拍摄 | +| `execute_gate`、`ui.primary_action/commands` | 保留门禁、原因及建议动作;开始/恢复/重新召唤和底部暂停/返航禁用,不发控制请求;明确完成态提供“查看素材”进入当前订单素材库;失败态刷新位于导航栏,其余可读状态保留单次刷新入口 | +| 图传区域 | 显示“图传暂未接入”的中性占位;未调用 `/airport/live`,不填充演示画面 | + +**真实成功响应:2026-10-29 15:07:25,HTTP 200、业务码 100000。** 只读已存在的 `task_id=1`,没有新的 `tasks/create` 或真实 `shoot` POST。完整响应见 [shooting-success-redacted.json](docs/9.9.1/shooting-integration-2026-10-29/shooting-success-redacted.json);以下为关键字段节选,省略字段不表示原响应缺失: + +```json +{ + "code": 100000, + "data": { + "order_type": 25, + "order_type_label": "多点位航拍", + "order_flight_task": { + "id": 1, + "order_number": "TEST-ORDER-004", + "scenic_id": 271, + "scenic_spot_id": 412, + "air_line_id": 302, + "status": 10, + "status_label": "待执行", + "plane_id": 0, + "airport_sn": "", + "wayline_task_id": 0 + }, + "header": { + "order_number": "TEST-ORDER-004", + "title": "天门寻梦 · 天门寻梦", + "tourist_label": "游客 130****0004", + "package_name": "单次航拍 · 含 1 次拍摄", + "shot_total": 1, + "shot_remain": 1 + }, + "current_plane": { + "id": 58, + "name": "测试设备 58", + "sn_number": "TEST-PLANE-58", + "status_text": "空闲 · 电量 93%" + }, + "metrics": [ + { "key": "battery", "value": "93%", "raw": 93 }, + { "key": "env_temp", "value": "—", "raw": null }, + { "key": "wind_speed", "value": "0m/s", "raw": 0 }, + { "key": "rainfall", "value": "—", "raw": null }, + { "key": "signal", "value": "—", "raw": null }, + { "key": "satellite", "value": "32颗", "raw": 32 } + ], + "plane_status": { "scenic_id": 271, "connected": true, "poll_hint_ms": 5000 }, + "execute_gate": { + "can_execute": false, + "code": "wayline_missing", + "message": "航线任务未关联,请先完成召唤起飞", + "primary_action": "blocked" + }, + "ui": { + "phase": "blocked", + "title": "航线任务未关联,请先完成召唤起飞", + "message": "航线任务未关联,请先完成召唤起飞", + "primary_action": "blocked" + } + }, + "msg": "success", + "time": "2026-10-29 15:07:25" +} +``` + +任务 1 在 15:07:25 采样时为**待执行**,`plane_id=0`、`airport_sn=""`、`wayline_task_id=0`,`execute_gate.can_execute=false`。这是未实发 `shoot` 时的只读结果;`current_plane` 返回空闲 93% 不能证明任务已锁定飞机、已经召唤或正在飞行。响应中的暂停、返航 `ui.commands` 仍不执行;当前底部安全控制仅保留禁用占位。 + +**待两位后端核对:**同一响应根级为 `order_type=25`“多点位航拍”,但 `header.package_name` 为“单次航拍 · 含 1 次拍摄”,`shot_total/shot_remain=1`;张工同订单购买/创建摘要为“多点位航拍”、总次数 5、剩余 5。请朱工与张工统一任务页 header 的套餐和次数来源。客户端目前按 `header` 展示任务页文案,不用它覆盖张工购买权限或整单次数,也不把该差异解释成已扣 4 次。 + +历史任务页接入阶段验证(当时含定时轮询,现已取消):模拟器构建、运行及任务 1 真实读取通过,**61 项不同相关测试全部通过**。首轮 60 项通过,1 项因错误文案断言漏掉统一前缀失败;修正断言后重跑任务页 ViewModel 全部 11 项通过,其余 50 项对应代码未改动。覆盖创建/召唤后同任务导航、返回查看不重复 POST、只读刷新、轮询前后台与离页取消、身份核对及失败撤下旧数据。模拟器实际显示六项“93%、—、0m/s、—、—、32颗”和待召唤的阻止原因;实点刷新仍只 GET `id=1&live_battery=1`。真实页面截图保留本地(不纳入 Git):`docs/9.9.1/shooting-integration-2026-10-29/shooting-task-real.jpg`。该阶段没有真实召唤或飞行控制 POST;写入和成功导航用网络替身验证。之后任务 2 的真实召唤拒绝记录见第 7.7 节。 + +此前取消任务页定时轮询阶段验证(当时仍有下拉刷新,现已移除):模拟器构建及 **21 项相关测试全部通过**(任务页页面 9、任务页 ViewModel 10、准备页跳转与同任务读取 2)。覆盖停留超过原五秒周期仍仅一次 GET、进入/恢复前台各一次、重复前台通知不重复读取、按钮与下拉刷新、并发抑制、离开取消与迟到响应隔离。准备页 `plane-status` 的原有轮询规则见 7.1、7.4,继续保留。 + +#### 7.6.1 历史:准备页直接读取及类型 25 失败 + +此前准备页的调用与重试规则(已停用): + +1. 首次主按钮按 `project-info → tasks/create → shooting` 顺序执行;`shooting.id` 必须来自该次创建成功回执。 +2. 读取成功后按钮为“刷新任务状态”,再次点击只 GET 同一个 ID;读取失败则保留创建回执,按钮为“重试读取任务”,同样只 GET 同一个 ID。读取失败不会设置“创建结果未知”,也不会补发创建请求。 +3. 串接与读取期间禁用主按钮,点位航线保持原创建归属;页面进入、购买刷新、无人机轮询均不触发额外 `shooting` 请求,也没有自动重试。 +4. 页面离开或任务取消后拒绝迟到读取响应,已创建 ID 保留用于同实例后续重读;账号、Token、景区或门店变化时撤下旧回执并禁止旧页面继续操作。 +5. GET 成功只代表任务信息已读取,不能宣告已召唤、已起飞或拍摄完成。当时不调用 `shoot`、`start-shoot`、`command`,不导航至拍摄任务页。 + +**实测请求与失败响应:2026-10-29 14:14:42。** 对上轮已创建的 `task_id=1` 读取,未再次创建任务。第一次发送 `live_battery=true`,后端返回 `code=100099` 和 `The live battery field must be true or false`;改为 `1/0` 编码后发送以下请求,参数校验通过后仍被类型 25 业务校验拒绝。 + +`GET /api/app/airport/shooting?id=1&live_battery=1` + +HTTP 200,完整业务响应: + +```json +{ + "code": 100099, + "data": [], + "msg": "多点位航拍请使用专用订单接口", + "time": "2026-10-29 14:14:42" +} +``` + +该轮真实验证只有上述两次 GET,没有 `tasks/create` POST 或飞行控制调用。随后朱工 14:50 版合同明确类型 25 支持,15:07:25 对同一任务的新 GET 已真实成功,见上文。保留这份旧失败供追溯,不表示新版仍拒绝类型 25,也不将历史 HTTP 200 记为业务成功。真实失败响应文件:[shooting-rejected.json](docs/9.9.1/shooting-integration-2026-10-29/shooting-rejected.json)。 + +此前读取串接阶段验证:模拟器构建通过;相关 **83 项不同测试全部通过**(shooting API/Model 8、shooting 串接 ViewModel 10、创建 API/Model 8、创建 ViewModel 14、准备页 ViewModel 28、页面 15)。包括创建后携同一 ID 读取、GET 失败后不重建、并发点击、取消/身份切换、原始 JSON 回显、购买读取失败仍保留任务回执。该阶段测试中的成功回执均为匿名替身,当时尚无真实成功响应;后续 15:07 的真实成功记录单列于上文。 + +#### 7.6.2 开始拍摄:朱工 start-shoot,仅本地模拟 + +**本节 JSON 均为合成 Mock 回执,不是后端响应。** 禁飞期间未向后端或无人机发送开拍请求。正式任务页未注入开拍服务,按钮保持禁用;网络层在传输前继续阻断真实指令。 + +**准备页衔接:**Debug 真实准备页提供显式“本地模拟”入口,打开使用合成订单 `LOCAL-MOCK-ORDER-901` 的独立准备页。模拟 `project-info/plane-status` 读取后,点击“确认并召唤(模拟)”依次触发内存 `tasks/create`(返回任务 901)、`shoot`(`id=901,restart=false`),成功跳转任务页并读取 `shooting?id=901`。全部服务由同一模拟客户端注入,没有真实网络回退;模拟准备页及任务页标题、底部提示和回执均标明来源。返回后只“查看拍摄任务”,不重复创建或召唤。复现说明见[本地模拟调试记录](docs/9.9.1/start-shoot-mock-2026-10-29/README.md)。 + +准备页衔接验证:模拟器 **35 项相关测试全部通过**,其中准备页面 19、完整模拟流程 2、禁飞准备页 5、网络保护 6、原开拍模拟页 3;覆盖独立模拟入口、同任务导航、重复点击及返回重进。 + +请求合同:`POST /api/app/airport/start-shoot`,参数只传当前 `order_flight_task.id`,与任务页 `shooting.id` 相同,不传航线 ID、`plane_id` 或未约定的 `dry_run`。 + +```json +{"id": 901} +``` + +模拟成功回执主要字段如下;[完整 JSON](docs/9.9.1/start-shoot-mock-2026-10-29/start-shoot-response.mock.json) 保留其余字段。 + +```json +{ + "code": 100000, + "msg": "local mock success", + "data": { + "order_flight_task_id": 901, + "order_flight_task": { + "id": 901, + "order_number": "LOCAL-MOCK-ORDER-901", + "scenic_id": 128, + "status": 20, + "status_label": "执行中(模拟)", + "wayline_status": 20, + "wayline_status_label": "执行中(模拟)" + }, + "plane_id": 201, + "task_uuid": "LOCAL-MOCK-TASK-UUID-901", + "airport_sn": "LOCAL-MOCK-DOCK-201", + "ui": { + "phase": "shooting", + "title": "无人机正在拍摄中(模拟)", + "message": "本地模拟开拍回执,不代表真实设备执行。", + "primary_action": "shooting" + } + } +} +``` + +客户端仅在已注入开拍服务、最近一次读取成功、就绪状态无冲突、`execute_gate.can_execute=true`、`ui.primary_action=start_shoot`、已绑定正数飞机 ID,且没有进行中/已成功/结果未知的开拍请求时启用按钮。POST 成功并核对任务、订单、景区与飞机身份后,单次 GET 同一任务 `shooting`,然后恢复前台可见时的状态轮询(2026-11-02)。刷新期间保留旧快照,直到回查成功再更新页面,不把 POST 成功直接当成设备开始拍摄。 + +连续点击只发送一次;明确业务拒绝可手动重试,超时、响应无法确认、发送后取消等锁定重复提交,只允许状态回查。页面离开或身份变化后丢弃迟到回执。底部安全控制的真实请求仍被禁用;2026-10-30 新增纯本地模拟指令流程,见 7.6.3。 + +2026-10-29 模拟器手动走通 `GET shooting → POST start-shoot → GET shooting`,本地状态由就绪变为拍摄中;全部请求交给 `https://mock.invalid` 对应的内存传输,不会回退真实网络。右上角可查看带 `source=local_mock`、`network_sent=false` 的完整模拟接口记录。 + +验证:**84 项相关测试全部通过**,涵盖开拍 API 10、开拍 ViewModel 12、模拟页面 3、原任务 ViewModel 16、原任务页面 15、阶段展示 14、固定布局 8、禁飞保护 6。成功、业务拒绝、超时、重复点击、身份核对、离页取消及真实传输前阻断均有覆盖。调试参数、[完整三次请求回执与截图](docs/9.9.1/start-shoot-mock-2026-10-29/README.md) 已保存;后端接收和真实设备执行尚未验证。 + +### 7.6.3 底部安全控制:朱工 command(仅本地模拟) + +`POST /api/app/airport/command`,请求只有原订单飞行任务 `id` 与 `command`,不传飞机 ID、机场 SN 或自行定义的 `dry_run`。 + +| 按钮 | command | +| --- | --- | +| 紧急暂停 | `flighttask_pause` | +| 继续拍摄 | `flighttask_recovery` | +| 立即返航 | `return_home` | +| 取消返航 | `return_home_cancel` | + +模拟暂停请求: + +```json +{"id":901,"command":"flighttask_pause"} +``` + +模拟响应的 data 结构(非后端真实返回): + +```json +{ + "order_flight_task_id": 901, + "command": "flighttask_pause", + "airport_sn": "LOCAL-MOCK-DOCK-201", + "dji_status": "paused", + "metrics": [ + {"key":"battery","value":"95%"}, + {"key":"env_temp","value":"20.3℃"}, + {"key":"wind_speed","value":"0m/s"}, + {"key":"rainfall","value":"无雨"}, + {"key":"signal","value":"良好"}, + {"key":"satellite","value":"36颗"} + ] +} +``` + +当前正式入口不注入指令服务;Debug 网络层继续拦截所有真实 command。模拟页仅在快照 `ui.commands` 明确给出白名单指令、任务及锁定飞机有效时启用;不将开拍 `execute_gate.can_execute` 当成暂停/返航许可。回执必须回显同一任务和指令,成功后 GET 同一任务一次并恢复前台状态轮询;不自动重发控制指令,不用受理回执直接替代状态快照。 + +提交期间按钮互斥并保留旧 UI。明确拒绝可手动重试;超时、异常回执、发出后取消等结果未知时锁定控制操作,仍可手动只读刷新。迟滞快照下已受理的同项指令不会重发;账号/景区变化时拒绝旧响应。返航前确认;模拟返航按文档标记任务中断,取消返航也不会恢复任务、重新创建或自动开拍。 + +详细场景、模拟器截图与完整回执见 [安全控制模拟记录](docs/9.9.1/safety-command-mock-2026-10-30/README.md)。当前仅验证客户端请求合同与交互;尚无后端真实指令受理或设备执行证据。 + +### 7.6.5 火山 RTC 播放接入(2026-11-02) + +朱工已补齐 `volc` 的 querystring 格式及脱敏成功回执。App 接入固定版本火山 RTC SDK,解析 `playable/play.available/play.url_type/play.url/play.expire_ts`,订阅 `app_id/room_id/user_id/token` 对应房间的视频。首帧到达后才显示真实图传状态;错误、过期、离页和后台均释放会话,不轮询或自动重新调用 live。 + +正式包由用户进入已有任务页后手动点击“开启实时图传”;页面出现不启动设备推流。Debug 保持 live 和 SDK 连接双重拦截,飞控服务仍不向正式任务页注入。任务页 shooting 明确使用 `live_battery=0`。 + +当前支持 `volc`,其它类型明确提示不支持;本次未连接真实设备。详细合同、打包入口、验证范围见 [火山图传接入记录](docs/9.9.1/live-rtc-integration-2026-11-02/README.md)。下节为旧版合同的历史记录。 + +### 7.6.4 实时图传与失败重召唤(2026-10-30,仅本地模拟,历史记录) + +用户再次明确当前禁止飞行。真实任务页不注入 `live` 或重召唤服务;Debug 传输层仍阻断所有真实设备操作,无放行开关。本轮不请求真实 `live/shoot`,不创建真实待飞任务。 + +- 图传:`GET /api/app/airport/live?id=901`。解析文档已知任务、机场和读数字段,严格核对原订单飞行任务 ID。文档尚无播放协议、URL 或 RTC 凭证,只有已知 JSON 时显示“暂未提供图传播放参数”;不猜字段、不将接口响应当作真实连接成功。 +- 图传演示使用独立注入的随包 MP4,画面固定标注“本地模拟画面 · 未连接无人机”。离页或后台释放播放器并作废迟到响应;无定时轮询。模拟入口 `--dock-live-mock`,`--dock-live-result=success/missing-parameters/business-failure/timeout`。 +- 失败后重新召唤:只发送 `POST /api/app/airport/shoot`,Body `{"id":901,"restart":true}`。始终使用原订单任务,不调用 `tasks/create`,不覆盖飞机或航线。受理后只读同一任务 `shooting` 一次,继续保留旧状态直至新快照到达。 +- 连点只发一次;明确业务拒绝可手动再试;超时、取消或身份不一致导致结果未知时只允许状态回查。受理后仍返回旧失败快照不会重新解锁召唤。正式后端重启权限尚待确认,不能把开拍 `execute_gate.can_execute` 当作重召唤许可。 +- 重召唤模拟入口 `--dock-resummon-mock`,`--dock-resummon-result=success/business-failure/timeout`。模拟任务固定为 `901`,会话不联网,未知请求在本机失败。 + +完整模拟响应、验证结果与截图见 [本地验证记录](docs/9.9.1/live-resummon-mock-2026-10-30/README.md)。可直接转给后端的确认清单见 [朱工-实时图传与重新召唤接口确认.md](朱工-实时图传与重新召唤接口确认.md)。模拟结果不代表后端或无人机执行成功。 + +### 7.7 “确认并召唤”:朱工 shoot,复用已创建任务 + +API:[DroneDockShootAPI.swift](suixinkan/Features/DroneDock/API/DroneDockShootAPI.swift) + +回执:[DroneDockShootModels.swift](suixinkan/Features/DroneDock/Models/DroneDockShootModels.swift) + +`POST /api/app/airport/shoot` + +**当前省略 `plane_id`,请求仅发送 `id/restart`;任务 6 于 16:03:31 返回真实业务成功,完整 JSON 见 7.7.2。** 此接口提交召唤,不是任务页的状态查询。准备页当前顺序为:用户明确点击 → `project-info` 复核 → 张工 `tasks/create` → 朱工 `shoot`。创建失败或创建结果未知时不继续召唤。最初按朱工 14:50 文档发送 `plane_id=0` 的实现和仅网络替身验证属于历史阶段,真实联调结果见下文。 + +| 参数 | 当前 App 发送 | 来源与含义 | +| --- | --- | --- | +| `id` | 必填,正整数 | 同次张工 `tasks/create` 成功回执的 `task_id`,即已建 `order_flight_task.id` | +| `plane_id` | 省略 | 按用户最终指示不传该字段;不发送 `0`、`null` 或 `recommend.id` | +| `restart` | 固定 `false` | 本轮不发重新开始指令 | +| `air_line_id` | 省略 | 复用已创建任务上绑定的航线;不发送文档示例中的 `0` 覆盖值 | + +**当前客户端请求格式及最新成功请求(2026-10-29 16:03:31):** + +```json +{ + "id": 6, + "restart": false +} +``` + +请求不额外传 `plane_id`、`order_number`、`scenic_id`、`scenic_spot_id` 或经纬度。朱工 14:50 合同原约定 `plane_id=0` 时按任务景区派机,并将 `plane_id/airport_sn` 写回任务占位;已有锁定时复用。该参数约定与 15:26 的真实校验不一致;当前省略字段已在任务 6 的真实成功回执中返回飞机 61,仍需朱工将文档与实际参数约定统一。召唤成功后的任务使用唯一锁定飞机,后续 `shooting/start-shoot/command` 以该任务飞机为准;本轮客户端已接任务页 `shooting` 查询,尚不接 `start-shoot/command` 控制动作。 + +提交、回显与重试规则: + +1. 创建与召唤提交期间禁用重复点击并冻结点位航线;创建回执一旦成功保留任务 ID,后续不能重新调用 `tasks/create`。 +2. 准备页保留张工创建回执和朱工召唤的成功状态、实际 `data` 或错误;召唤成功且页面仍可见、App 活跃时,自动跳转到同一任务的拍摄任务页,由该页开始 GET `shooting`。返回后按钮为“查看拍摄任务”,只重新进入同一任务;不调用 `start-shoot/command`。 +3. `shoot` 返回 HTTP 成功且业务 `code=100000` 时,记录“召唤请求已提交”,锁定再次发送并开放任务查看入口。此成功仅表示接口受理,不推断已起飞、已到达、正在拍摄或拍摄完成。 +4. 朱工明确业务拒绝时保留创建任务,允许用户点击“重试召唤”;只对同一个任务 ID 重试 `shoot`,不重新预检购买配置或重建任务。 +5. `shoot` 的网络、HTTP、解码错误,或请求发出后取消、离开等导致结果未知时,显示“召唤结果待核对”并锁定重发。成功与未知结果均不会因普通刷新、轮询或同页面实例返回而重新发送。需先核对任务实际状态,再决定后续处理;本轮没有实现未知结果的自动查询或重发流程。 +6. 账号、Token、景区、门店变化后拒绝迟到回执,撤下旧回执并禁止旧页面继续操作。页面出现、刷新购买配置和设备轮询本身不触发召唤写入。 + +**返回 JSON 处理:**朱工当前文档没有提供 `shoot` 成功 `data` 的确定字段结构,因此保留实际返回的任意 JSON 值(对象、数组、字符串、数值、布尔或 null),不预设 `task_uuid`、飞机、到达状态等字段,也不补造外层 `code/msg/time`。业务明确成功但 `data` 为 null 或缺失时,仍可记为召唤提交成功,并说明无返回数据;不生成假 `{}`、假任务详情或假飞行状态。最新任务 6 已返回对象型成功 `data`,结构与 ID 含义见 7.7.2;客户端仍保留完整实际 JSON,不假设每次都具有相同字段。 + +#### 7.7.1 历史真实召唤拒绝:任务 2 + +**2026-10-29 15:26:18,用户提供的真实日志:**请求 `POST /api/app/airport/shoot`,body 为: + +```json +{ + "id": 2, + "plane_id": 0, + "restart": false +} +``` + +响应 HTTP 200、业务 `code=100099`,`msg="The plane id must be at least 1."`。这表明当时后端校验拒绝 `plane_id=0`,不能视作召唤成功。用户最初提出改用 `recommend.id`,随后明确改为“不传 plane_id 试一下”;当前以最后指示为准,未采用推荐设备 ID 方案。 + +**2026-10-29 15:34:31,按最终指示实测省略 `plane_id`:**使用当前模拟器账号,先只读确认已有任务 2 为待执行、`plane_id=0`、`wayline_task_id=0`,随后只发送一次上方 `{"id":2,"restart":false}` 的真实 POST,没有新建任务或自动重试。HTTP 200,完整业务响应如下: + +```json +{ + "code": 100099, + "msg": "不支持的订单类型", + "data": [], + "time": "2026-10-29 15:34:31" +} +``` + +原响应文件:[shoot-without-plane-rejected.json](docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-rejected.json),不含需要脱敏的身份字段,保留原文。省略字段后得到订单类型拒绝,说明本次仍未成功召唤;不能据此认定派机、锁定飞机或后续导航已在真实环境成功。 + +**15:34 阶段记录的待朱工修改/确认事项(保留历史):**`shoot` 需要支持张工 `tasks/create` 已创建的类型 25 `order_flight_task.id`,复用该任务及已选航线;当时需修复“不支持的订单类型”,并明确省略 `plane_id` 时的服务端派机规则。此问题发生在 `shoot`,与 15:07 已读取成功的 `shooting` 不同。后端修改后再按同任务核对,不因该拒绝重新创建任务或自动连续重发。 + +**2026-10-29 15:41:41,后端告知已修改后的再次验证:**按用户指示,先 GET 确认任务 2 仍为待执行、`plane_id=0`、`wayline_task_id=0`,再只发送一次 `POST /api/app/airport/shoot`,body 仍为 `{"id":2,"restart":false}`。HTTP 200,业务返回仍为 `code=100099`、`msg="不支持的订单类型"`、`data=[]`,尚未召唤成功;没有创建新任务或自动重试。完整响应见 [shoot-without-plane-retry-rejected-154141.json](docs/9.9.1/shooting-integration-2026-10-29/shoot-without-plane-retry-rejected-154141.json)。需后端核对测试环境实际生效版本及类型 25 处理路径;仅凭本次响应不能确定是否部署问题。 + +**2026-10-29 15:58:52,用户再次明确要求验证后的结果:**15:58:27 先 GET 确认已有任务 2 仍为待执行、`plane_id=0`、`wayline_task_id=0`,随后仅发送一次 `POST /api/app/airport/shoot`,body 为 `{"id":2,"restart":false}`,未传 `plane_id`。HTTP 200,完整业务响应如下: + +```json +{ + "code": 180031, + "msg": "无法获取机场状态,暂时不可起飞", + "data": [], + "time": "2026-10-29 15:58:52" +} +``` + +原响应文件:[shoot-airport-state-rejected-155852.json](docs/9.9.1/shooting-integration-2026-10-29/shoot-airport-state-rejected-155852.json),不含需要脱敏的身份字段,按原文保存。本次没有新建任务或自动重试,没有召唤成功 JSON。错误已从之前的订单类型拒绝变为机场状态获取失败;这只能说明本次返回的阻止原因变化,不能据此断言类型 25 的所有处理路径、派机或飞机锁定已经打通。 + +**任务 2 历史待核对:**参数、类型和机场状态失败均保留;后续新任务 6 成功不能证明任务 2 的失败原因,仍需朱工结合服务端日志解释其 `180031`。这不是客户端收到错误后自动重建任务的依据。 + +此前省略 `plane_id` 的模拟器构建和 **27 项相关测试全部通过**(shoot API/Model 9、准备页页面 18)。测试明确验证请求体仅有 `id/restart`、不存在 `plane_id`,并回归同任务导航、防重复提交及错误重试。该阶段真实请求为上述明确业务拒绝;后续任务 6 的成功记录见下节。 + +此前召唤原页回执阶段验证:模拟器构建通过,**89 项相关测试全部通过**(shoot API/Model 9、shoot 串接 ViewModel 13、创建 API/Model 8、创建 ViewModel 14、准备页 ViewModel 28、页面 17)。覆盖准确 POST 参数与鉴权、create→shoot 同任务次序、并发点击、明确拒绝重试、不确定结果锁、取消/身份变化、空 data 成功、原页两份回执及购买刷新失败后仍可展示回执。全部召唤请求由网络替身接收;未对真实无人机发送召唤。 + +#### 7.7.2 任务 6:创建与召唤业务成功,回查航线执行失败 + +用户明确要求“新建任务再召唤”。本次先复核原订单购买配置,只发送一次 `tasks/create` 并取得 `task_id=6`,再只发送一次 `shoot {"id":6,"restart":false}`,省略 `plane_id/air_line_id`;无自动重试。`shoot` 于 **2026-10-29 16:03:31** 返回 HTTP 200、`code=100000`、`msg="success"`。完整脱敏响应:[shoot-task6-success-redacted.json](docs/9.9.1/shooting-integration-2026-10-29/shoot-task6-success-redacted.json)。 + +| 成功回执字段 | 真实值及客户端含义 | +| --- | --- | +| `order_flight_task.id` | `6`,订单飞行任务 ID;后续 `shooting?id=6` 始终使用它 | +| `order_flight_task.status/status_label` | `20 / 执行中`,按服务端返回展示,不视为拍摄完成 | +| `order_flight_task.plane_id/airport_sn` | `61 / TEST-PLANE-61`(序列号已脱敏),本次回执已绑定设备 | +| `order_flight_task.wayline_task_id` 与根级 `data.task_id` | 均为 `1926`,是航线任务 ID;**不能拿 1926 替换 shooting 的入参 6** | +| `ui.phase/title` | `arrived_pending_start / 无人机已到达`,是后端返回的阶段提示 | +| `ui.primary_action/commands` | 返回开始拍摄、暂停和返航建议;本轮没有发送 `start-shoot/command` | +| `order_progress` | “单次航拍 · 含 1 次拍摄”、总/剩余 1,与本次创建摘要“多点位航拍”、总/剩余 5 仍不一致,待朱工和张工统一 | + +**召唤后只读回查(2026-10-29 16:04:52):**`GET /api/app/airport/shooting?id=6&live_battery=1` 返回 `code=100000`,但 `task.wayline_task_id=1926`、`wayline_status=91`“执行失败”,`execute_gate.can_execute=false`、`code=wayline_not_shooting`,说明为“航线任务状态不可拍摄(当前:执行失败)”,`ui.phase=blocked`。`order_flight_task/task.status` 仍为 20“执行中”:订单飞行任务状态与航线状态是不同层次,应同时保留,不能仅凭这一差异认定前后端错误。完整响应:[shooting-task6-after-shoot-redacted.json](docs/9.9.1/shooting-integration-2026-10-29/shooting-task6-after-shoot-redacted.json)。 + +同一回查的 `current_plane.id=61`、`work_status=0`、`online_status=2`、`can_fly=false`,显示“离线 · 电量 94%”;`plane_status.connected=true` 是景区整体连接状态,不能替代该任务飞机的在线状态。请朱工排查航线任务 1926 的失败原因,并核对分配飞机 61 的在线状态和派机条件;现有响应不足以确定两者因果。`shoot.ui` 的“已到达”只是先前回执文案,不作为飞机物理到达的实证。 + +本轮仅创建 1 次、召唤 POST 1 次、随后任务 GET 1 次,无自动重试或任何 `start-shoot/command`。接口业务成功不等于航线执行成功,当前被阻止继续拍摄;不据此解释旧任务 2 的失败原因,也不自动重建或重发召唤。 + +#### 7.7.3 任务 11:新版文档后的模拟器起飞流程实测 + +2026-10-29 按用户要求,在模拟器从真实首页订单 `261027271004` 进入准备页,选择点位 `412` / 航线 `302`,点击一次“确认并召唤”。17:18:59 张工 `tasks/create` 返回任务 **11**;17:19:01 朱工 `shoot {"id":11,"restart":false}` 返回成功,绑定飞机 **61**、航线任务 **1931**,随后自动进入拍摄任务页。同一任务的两次 GET 均使用 `shooting?id=11&live_battery=1`。 + +- 17:19:04 首次查询:`wayline_status=20`、`execute_gate.can_execute=true`,`ui.phase=arrived_pending_start`。 +- 17:19:59 手动刷新:`wayline_status=91` 执行失败、`can_execute=false`、`code=wayline_not_shooting`,飞机 61 显示离线。 +- 创建 1 次、召唤 1 次、任务 GET 2 次;没有重试召唤、调用 `start-shoot/command` 或恢复任务页轮询。召唤业务受理成功不代表实际起飞、到达成功。 +- 召唤前 `plane-status` 中所有飞机 `can_fly=false`,飞机 61 为离线却被派机;首次任务查询设备 `online_status=2` 与 `can_execute=true` 并存。需朱工核对派机和执行门禁以及航线 1931 的具体失败原因,现有回执不足以确认因果。 +- 订单次数仍有差异:张工总/剩余 5 次,朱工总/剩余 1 次。文档成功码 0 与实测 100000 的差异也已记录。 + +完整操作、请求参数、逐步响应和待核对事项保存在本机 `docs/9.9.1/takeoff-integration-2026-10-29-1718/README.md`(本地联调资料,不随代码提交)。记录包含全部 25 次请求(24 份响应、1 次离页取消的准备页状态读取),设备标识及游客脱敏手机号已替换为测试值;截图与原始记录也保留本地。本次模拟器构建运行通过,没有修改业务代码。 + +## 8. 订单素材库 + +页面:[DroneDockMaterialsViewController.swift](suixinkan/UI/DroneDock/DroneDockMaterialsViewController.swift) + +API:[DroneDockMaterialsAPI.swift](suixinkan/Features/DroneDock/API/DroneDockMaterialsAPI.swift) + +状态:[DroneDockMaterialsViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockMaterialsViewModel.swift) + +首页和“我的拍摄订单”的“查看素材”均进入此真实页面。进入页面后先读摘要与点位,再读全部任务;整页刷新重读两个接口。切换点位、切回全部或重试任务只读 `tasks`,顶部整单统计与完整点位标签保持不变。点位刷新后若已不在购买快照内,恢复为全部点位。不会调用 `workbench`,不会创建飞行任务或主动同步素材。 + +2026-10-29 已按产品体验网页适配正式页 UI:订单状态徽章、整单次数、点位标签、拍摄记录标题与交付入口、两列素材图、独立勾选、全选和固定底栏。上传状态使用单文件 `upload_status`;任务尚无文件时使用 `material_status` 区分等待、上传中、失败与未知。选择只包含当前点位就绪且地址有效的原素材,以任务 ID+素材 ID 唯一标识,切点/刷新/离页后清空。2026-10-30 已补充正式页面的原素材下载及保存相册流程,见 8.3;上传重试仍未开放。详情见[UI 对齐记录](docs/9.9.1/订单素材库UI对齐-2026-10-29.md)。 + +2026-10-30 按用户明确的页面职责调整:订单素材库只展示原素材并提供交付入口,不展示、预览已交付成片,也不显示“暂无视频成片”提示。任务按钮文案固定为“交付成片”,与是否存在 `film` 无关;仍按 `can_upload_film` 控制入口。进入云端交付页后才读取并处理已有成片,上传替换确认继续保留;游客确认页仍展示云端成片清单。 + +本次模拟器构建、含成片的本地场景展示及 13 项回归测试通过(素材页面 12、云端替换确认 1)。覆盖成片不展示/不计选择、只有成片时保留原素材空态、固定入口文案、任务预选与返回刷新;未上传新文件或改变后端记录。 + +### 8.1 整单摘要与点位:张工 orders/detail + +`GET /api/yf-handset-app/photog/multi-plane/orders/detail?scenic_id=271&order_number=TEST-ORDER-004` + +| 参数 | 必填 | 当前使用 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 ID | +| `order_number` | 是 | 入口选中的真实订单号 | + +不传 `scenic_spot_id`。整单次数、游客、套餐、订单状态取根级订单摘要,筛选标签取单数 `spot` 数组,不从任务列表推导点位。 + +**实测响应:2026-10-28 17:57:44,景区 271,订单号与手机号已脱敏。** + +```json +{ + "code": 100000, + "data": { + "can_confirm": false, + "can_create_task": true, + "can_upload_film": false, + "confirm_status": 0, + "confirmed_at": null, + "created_at": "2026-10-27 17:39:10", + "film_count": 0, + "material_status": 0, + "order_number": "TEST-ORDER-004", + "order_status": 20, + "project_id": 386, + "project_name": "多点位航拍", + "remaining_count": 5, + "shoot_count": 5, + "shoot_status": "pending", + "shot_count": 0, + "spot": [ + { + "scenic_spot_id": 412, + "scenic_spot_name": "天门寻梦" + }, + { + "scenic_spot_id": 413, + "scenic_spot_name": "天门远山" + } + ], + "user_phone": "130****0001" + }, + "msg": "success", + "time": "2026-10-28 17:57:44" +} +``` + +### 8.2 任务、素材与点位筛选:张工 tasks + +`GET /api/yf-handset-app/photog/multi-plane/tasks` + +| 参数 | 必填 | 当前使用 | +| --- | --- | --- | +| `scenic_id` | 是 | 当前景区 ID | +| `order_number` | 是 | 与摘要一致的真实订单号 | +| `scenic_spot_id` | 否 | 选择点位时传其 ID;全部点位省略此参数 | + +不传 `page`、`page_size`。`list` 一次返回当前范围内的全部有效任务,保留服务端顺序。`total` 是任务记录数,包括待飞、失败等任务,不能用作已拍摄次数;整单已用次数始终读取摘要的 `shot_count`。 + +**全部点位实测响应:2026-10-28 17:57:44。** + +```json +{ + "code": 100000, + "data": { + "list": [], + "order_number": "TEST-ORDER-004", + "total": 0 + }, + "msg": "success", + "time": "2026-10-28 17:57:44" +} +``` + +随后切换点位 `412`(天门寻梦,17:57:53)与 `413`(天门远山,17:58:21)均返回 `code=100000、total=0、list=[]`;切回全部仅重读不带 `scenic_spot_id` 的 `tasks`。当前真实订单尚无任务或媒体,页面显示相应空态。 + +| 有任务时的字段 | 页面处理 | +| --- | --- | +| `id/task_id`、`seq`、`scenic_spot_id/name`、`air_line_name`、`created_at` | 按任务分组显示任务序号、点位、航线与时间 | +| `flight_status` | 显示待飞行、执行中、飞行成功、飞行失败、已取消、待确认;未知值显示待确认,不丢弃任务 | +| `materials[]` | 展示原素材缩略图、文件名、图片/视频类型与上传状态 | +| `upload_status` | 0 待上传、1 就绪、2 上传中、3 失败;失败不假装可以重试上传 | +| `file_url`、`file_type` | 原素材仅在 `upload_status=1`、类型为图片/视频且 HTTP(S) 地址有效时可预览、选择和下载 | +| `film` | 保留接口解码,订单素材库不展示或预览;云端交付页及游客确认页按各自职责使用 | +| 缺失展示字段 | 显示占位,必要列表/身份字段异常则显示可重试错误,不误显示成成功空态 | + +原素材图片使用 Kingfisher,视频使用 AVPlayer。首屏错误、任务错误分别提供重试;快速切点、离开页面或账号/景区/门店变化时拒绝旧响应回填。非空任务分组与媒体就绪判断使用网络替身测试,不能视为真实后端已有文件。任务级入口统一显示“交付成片”,见第 9 节;批量下载、保存相册见 8.3。游客交付确认已实现,见 9.5。 + +验证:模拟器构建通过;素材 API/Model、ViewModel、页面及首页/订单列表入口合计 **63 项不同测试通过**(首轮 62 项,首页主按钮分派补充后再跑 3 项,其中 1 项新增)。覆盖整单计数与任务数分离、筛选只读 tasks、错误重试、媒体就绪判断、会话隔离及导航。非空任务截图来自测试替身,真实截图为当前空态。 + +脱敏原响应:[detail](docs/9.9.1/materials-integration-2026-10-28/detail-redacted.json)、[全部任务](docs/9.9.1/materials-integration-2026-10-28/tasks-all-redacted.json)、[点位 412](docs/9.9.1/materials-integration-2026-10-28/tasks-412-redacted.json)、[点位 413](docs/9.9.1/materials-integration-2026-10-28/tasks-413-redacted.json)。 + + +### 8.3 下载所选原素材并保存系统相册 + +2026-10-30 接入“下载所选素材”。素材来源仍为张工 `tasks` 的 `list[].materials[]`,点击下载时冻结当前选择,逐项使用已有 `file_url` 发起 HTTP(S) GET 并保存到系统相册。文件响应是媒体二进制,不是新的业务 JSON;不会上传文件、获取 STS 或调用设备操作接口,也不包含独立 `film` 成片。 + +| 字段或阶段 | 当前处理 | +| --- | --- | +| `upload_status`、`file_url` | 仅 `upload_status=1` 且 HTTP(S) 地址有效的原素材可以下载;未就绪、无地址、未知类型均不可选 | +| `file_type` | 张工的 `1` 图片、`2` 视频显式映射为通用相册保存器的图片 `0`、视频 `1`,不直接透传 | +| 下载身份 | 使用任务 ID+素材 ID 区分同一订单内的原素材;本页批次固定,不因列表变化扩大下载范围 | +| 原片 GET | 使用服务端提供的完整地址,不附加 App 登录 Token;校验 HTTP 成功状态及非空文件 | +| 进度与完成 | 文件下载占单项进度的 90%;Photos 成功创建相册资产后才计为保存完成和 100%,不能把下载完成记成保存成功 | +| 相册权限 | 仅请求添加照片与视频权限;拒绝时明确提示并提供前往设置入口,不显示保存成功 | +| 暂停、继续、取消 | 支持暂停后继续和取消;切到后台或退出页面停止在途下载,不在后台持续执行新下载或保存任务 | +| 失败重试 | 显示保存成功与失败数量及错误原因,仅重试失败项;同页已确认保存成功的素材不重复写入相册 | +| 取消时已提交的保存 | 系统相册事务一经提交不可撤回,待其落定后清理临时文件;继续时复用保存事实,避免重复生成资产 | + +此流程**不调用**朱工的 `/api/app/scenic-media/mark-download` 或 `retry-upload`。张工文档明确本组接口不提供下载状态回写,且朱工 `media_id` 指 `order_flight_task_media.id`,当前没有确认它与张工 `materials[].id` 的对应关系。下载状态仅表示当前页面的本地操作,不改后端素材上传状态、任务状态或订单交付状态。 + +代码接入与后端真实媒体验证分开记录;本节不将本地模拟或网络替身结果记为真实原素材下载成功。 + +验证:2026-10-30 模拟器 56 项相关测试通过;用本机 HTTP 测试服务实际下载一张图片和一段视频,Photos 各新增一项,页面显示“已保存 2 项”。任务及媒体均为本地演示样例,不代表后端真实订单下载成功。详见[下载与相册验证记录](docs/9.9.1/materials-download-2026-10-30/README.md)。 + +## 9. 交付成片:共用页面与云端上传 + +页面:[DroneDockDeliveryViewController.swift](suixinkan/UI/DroneDock/DroneDockDeliveryViewController.swift) + +状态:[DroneDockDeliveryViewModel.swift](suixinkan/Features/DroneDock/ViewModels/DroneDockDeliveryViewModel.swift) + +API:[DroneDockDeliveryAPI.swift](suixinkan/Features/DroneDock/API/DroneDockDeliveryAPI.swift) + +上传:[DroneDockFilmUploader.swift](suixinkan/Features/DroneDock/Services/DroneDockFilmUploader.swift) + +### 9.1 入口与调用时机 + +| 入口 | 进入交付页后的行为 | +| --- | --- | +| 我的拍摄订单 → 交付成片 | 先打开交付方式弹窗,无新增请求;选择云端后在同一弹窗内读取摘要与全部任务;用户选择点位、任务和视频,不默认绑定第一条任务 | +| 订单素材库 → 某任务的交付成片 | 按钮文案固定;先打开与订单列表相同的交付方式弹窗,无新增请求;选择云端后传当前订单与该任务 ID,从最新任务列表定位并预选点位、任务;原任务失效时提示重新选择 | +| 订单交付确认 → 还未交齐,继续交付 | 先选择交付方式,云端使用同一正式上传页;关闭后重新读取交付确认页的订单摘要与任务 | + +入口依据后端 `can_upload_film` 显示。交付页还会核对 `order_status=20`,提交前和视频上传后均重新读取权限与任务,避免使用进入页面时的过期状态。返回订单列表或素材库会刷新对应数据。 + +2026-10-30 交互调整:订单和素材库所有交付入口均先弹出交付方式。仅取消方式弹窗保留原列表、筛选和勾选,不额外刷新;进入云端后关闭弹窗才刷新对应订单或素材页。面对面闪传现进入独立局域网扫码页面,见第 9.4 节。云端禁止下拉绕过退出确认,上传处理中关闭需确认停止。本地演示有历史上传批次时仍先选方式,选择云端后恢复原队列,不自动上传。见[弹窗适配记录](docs/9.9.1/订单交付方式弹窗-2026-10-30.md)。 + +1. 进入、刷新时依次调用 `orders/detail` 和不带点位参数的 `tasks`;切点位只筛选已读取的全部任务。 +2. 用户选择单个视频,复制到本功能临时目录并检查视频轨道、大小和格式;支持相册或文件选择、本地预览与移除。当前沿用 App 的 2 GB 文件上限。 +3. 点击上传后重新读取摘要、任务;已有成片先弹出替换确认。 +4. 请求 STS,以文件流和 `video/*` Content-Type 上传至返回配置对应的 OSS。 +5. 上传成功后再核对最新摘要、任务;调用 `tasks/film` 保存该任务的文件 URL。 +6. 保存成功后刷新摘要与任务。只有保存成功或重新查询确认已保存,页面才显示“成片交付成功”;OSS 达到 100% 时显示“正在保存成片”。 + +一个有效任务仅交付一个视频。飞行成功不是唯一可选条件,是否允许交付以订单权限和有效任务为准。已有成片再次提交会替换原记录,失败保留旧记录。保存失败时本页保留已上传地址,重试先查询是否已经保存,必要时只重试保存;不会自动重复上传同一文件。 + +### 9.2 读取订单与任务:张工接口 + +```text +GET /api/yf-handset-app/photog/multi-plane/orders/detail?scenic_id=271&order_number=TEST-ORDER-001 +GET /api/yf-handset-app/photog/multi-plane/tasks?scenic_id=271&order_number=TEST-ORDER-001 +``` + +结构及字段见第 8 节。**2026-10-29 09:57:48 实测读取仍成功,但当前测试订单 `can_upload_film=false`、任务为空。** 摘要与任务的完整脱敏响应存于 [detail-redacted.json](docs/9.9.1/delivery-integration-2026-10-29/detail-redacted.json) 与 [tasks-redacted.json](docs/9.9.1/delivery-integration-2026-10-29/tasks-redacted.json)。当前任务响应如下: + +```json +{ + "code": 100000, + "data": { + "list": [], + "order_number": "TEST-ORDER-001", + "total": 0 + }, + "msg": "success", + "time": "2026-10-29 09:57:48" +} +``` + +10 月 29 日用户确认先跳过真实上传。**10 月 30 日已按用户指定订单完成真实 STS、OSS、`tasks/film` 保存及回读,详见 9.4 下方联调记录。** 上述无任务响应仅为历史样本。 + +### 9.3 通用 STS 与 OSS 文件上传 + +`GET /api/app/config/get-sts-token?bucket=default` + +复用现有 `UploadAPI`,使用同一登录 Token。以下为**依据张工文档及现有模型整理的格式示例,非本次实测**;所有凭证均为占位值;按 2026-11-02 最新用户要求,控制台会输出完整 STS 响应体。 + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "base_url": "https://example-bucket.oss-cn-shanghai.aliyuncs.com", + "endpoint": "https://oss-cn-shanghai.aliyuncs.com", + "region": "cn-shanghai", + "bucket": "example-bucket", + "expire_seconds": 3600, + "credentials": { + "access_key_id": "", + "access_key_secret": "", + "security_token": "", + "expiration": "2026-10-29T04:00:00Z" + } + } +} +``` + +使用 SDK 向配置中的 bucket 上传文件,SDK 成功回执不是业务 JSON。保存地址按 STS `base_url + 编码后的 object key` 构造,不替换为 CDN、不添加签名查询参数。支持后端列明的 `mp4/avi/mov/mkv/flv/wmv/webm`;其他格式提示先导出 MP4。选取文件、获取 STS 后分别检查实际文件属性,文件发生变化会中止提交。 + +2026-10-30 兼容调整:成片对象键使用 `task/<日期>/<景区>/_film.<小写扩展名>`,对象名只含 ASCII,避免中文、空格、`#` 的路径编码差异;保存接口的 `file_name` 仍保留用户选择的原文件名。通用上传模块的对象键规则不变。 + +### 9.4 保存/替换成片:张工 tasks/film + +`POST /api/yf-handset-app/photog/multi-plane/tasks/film` + +请求示例: + +```json +{ + "scenic_id": 271, + "task_id": 501, + "file_url": "https://example-bucket.oss-cn-shanghai.aliyuncs.com/film.mp4", + "file_name": "测试成片.mp4" +} +``` + +四项必填;文件名最长 255 字符、URL 最长 2048 字符。客户端不传封面或文件大小,由服务端检查实际视频并生成。以下为**后端文档的 `data` 示例,非实测响应**,真实外层仍由统一 `code/msg/data` 协议处理: + +```json +{ + "task_id": 501, + "film": { + "id": 901, + "task_id": 501, + "file_url": "https://example-bucket.oss-cn-shanghai.aliyuncs.com/film.mp4", + "cover_url": "https://example-bucket.oss-cn-shanghai.aliyuncs.com/film-cover.jpg", + "file_name": "测试成片.mp4", + "file_size": 30480000, + "created_at": "2026-10-27 10:30:00", + "updated_at": "2026-10-27 10:30:00" + } +} +``` + +客户端核对返回任务 ID 和文件 URL;保存成功但刷新失败仍保留成功提示,并提示稍后刷新。此动作不会调用 `orders/confirm-code`,不会把订单标记为游客已确认,也不会创建或召唤飞行任务。 + +验证:iPhone 18 Pro 模拟器构建与运行通过,相关 **62 项不同测试通过**(API 7、上传器 9、ViewModel 20、交付页面 9、订单页面 10、素材页面 7)。首轮发现文件属性缓存导致上传前复查读到旧大小,改为每次读取实际文件属性后原测试通过。覆盖两个入口、任务预选、权限变化、替换确认、上传/保存分阶段、保存重试、取消、有效视频复制与临时文件清理。成功与替换流程使用网络替身,真实后端仅验证到无任务空态;用户要求先跳过真实上传。 + +**2026-10-30 真实云端上传联调:** + +- 用户指定测试订单,景区 `271`、已有任务 `13`;只使用工程内置演示视频 `接口联调演示视频.mp4`(93,058 字节),没有新建飞行任务或下发设备指令。 +- 16:33:54 首次保存失败:含中文编码的文件 URL 已上传 OSS,直接 HEAD 返回 `200`、`video/mp4`、`Content-Length=93058`,但 `tasks/film` 返回 `code=0`、“获取文件信息失败”。App 保留已上传地址并显示“重试保存成片”。 +- 改为 ASCII 对象名后,同一中文文件名在 16:39:52 保存成功:`code=100000`、`task_id=13`、`film.id=1`、`file_size=93058`,返回视频与封面 URL。 +- 16:39:53 回读确认:任务 `13` 的 `film` 与保存回执一致,订单 `film_count=1`、`order_status=20`。页面显示“成片交付成功”。这是测试环境的真实上传/保存结果,视频内容为演示素材。 +- 本次 55 项模拟器测试通过:API 7、上传器 10、ViewModel 20、页面 11、完整链路 4、三个入口导航各 1。成功/失败/重试/权限变化的自动化测试使用隔离网络替身,不将其当成真实后端响应。 + +完整请求与响应见 [10 月 30 日云端成片联调记录](docs/9.9.1/cloud-film-integration-2026-10-30/README.md)。客户端已兼容;含编码路径的失败原因仍需后端结合 OSS RequestId 排查,当前未查看服务端代码。 + +### 9.4 面对面闪传:局域网扫码直传(2026-10-30) + +订单列表和订单素材库的交付方式弹窗共用 `DroneDockNearbyTransferViewController`。选择本机相册视频后,用户显式生成二维码,手机才启动临时本地文件服务。进入闪传页、生成码、游客下载均不请求张工/朱工接口,不获取 STS、不上传 OSS、不保存成片 URL,也不改变订单的云端交付状态。历史演示入口同样进入此本地传输页,但不自动使用演示素材或生成会话。 + +| 请求 | 提供方 | 返回内容 | +| --- | --- | --- | +| `GET /s/<随机令牌>` | 发送手机本机 | 随 App 打包的 HTML/CSS 接收页,无 JSON 或外部资源 | +| `GET /s/<随机令牌>/video` | 发送手机本机 | 所选视频二进制流;支持 `HEAD` 和单段 `Range`,不返回云端链接 | + +第一版当前实现 iOS 发送端;iPhone / 安卓游客使用浏览器接收,安卓发送端需另按同一协议实现。双方必须处于允许互访的同一局域网,二维码为私网 IPv4 + 动态端口,10 分钟到期,退出、切后台或结束闪传会撤销二维码及下载连接。仅完整文件发送结束展示“文件已发送”,不将 HTTP 返回或发送完毕记为游客已保存相册。 + +相册读取明确关闭 iCloud 网络下载;无本地视频时不自动访问云端素材。接口、错误与浏览器保存边界见[局域网协议](docs/9.9.1/面对面闪传-局域网协议.md)。本地传输的测试结果不代表已完成真实双手机兼容验收,也不是后端接口返回。 + +### 9.5 游客确认交付:张工 orders/confirm-code(2026-10-30) + +**状态:已实现,待真实联调。** 正式首页的“邀请确认”和“我的拍摄订单”的确认/查看记录入口共用 `DroneDockConfirmationViewController`。历史演示确认页继续只使用本地状态。 + +2026-10-30 入口规则调整:“我的拍摄订单”仅在 `shoot_count > 0` 且 `shot_count >= shoot_count` 时显示游客确认摘要;未拍满、次数缺失或零次套餐均隐藏。邀请确认主按钮同时要求 `can_confirm=true`,点击导航再次校验,不因后端提前给权限而绕过拍满限制。拍满次数不等于游客已确认,订单完成状态仍以服务端为准。本地演示入口使用相同的成功次数规则。 + +调用顺序:进入页 `GET orders/detail` → `GET tasks`(省略点位,读取整单)→ 工作人员勾选已核对 → 再次 `GET orders/detail` 校验最新权限 → `POST orders/confirm-code` → 原样展示 `confirm_url` 图片。手动刷新或页面可见时返回前台只查询 `orders/detail`,不自动生成码或轮询。返回首页/订单列表后通过既有生命周期刷新摘要。 + +请求由 `APIClient` 带当前 `token`,路径前缀为 `/api/yf-handset-app/photog/multi-plane`,JSON body 只有以下两项: + +```json +{ "scenic_id": 100, "order_number": "TEST-CONFIRM-ORDER" } +``` + +以下为**后端文档结构示例,不是本轮真实响应**: + +```json +{ + "code": 100000, + "msg": "success", + "data": { + "order_number": "TEST-CONFIRM-ORDER", + "confirm_status": 1, + "confirm_url": "https://example.com/mini_qr/confirm.png" + } +} +``` + +`confirm_url` 是微信小程序码图片;复用 Kingfisher 原图加载器,不再次编码为普通二维码。图片失败可单独重载同一 URL;生成业务失败展示后端 `msg` 并允许重试。重复生成由后端复用确认记录,前端不虚构新会话或有效期。 + +最新摘要 `order_status=20 && can_confirm=true` 且已核对才可出码。无云端成片、原素材为空或失败不额外禁止邀请确认;整单清单请求失败与真实空清单分开,失败须重试。上传、出码和扫码都不在 App 内完成订单;**只有 `orders/detail.order_status=30` 才展示“游客已确认收货”**,确认时间使用 `confirmed_at`,缺失显示“—”。完成后隐藏码;不编造游客查看状态、工作人员姓名、历史冻结清单或反馈回执。 + +刷新失败保留旧码和旧数据并提示重试;取消页面、账号/Token/景区/门店变化后拒绝迟到网络及图片回调。测试全部使用隔离的 Mock 数据,不替游客点击确认、不创建飞行任务、不发送无人机指令。模拟入口 `--dock-confirmation-mock=ready`,另支持 `empty`、`completeAfterRefresh`、`generationFailed`、`imageFailed`、`confirmed`;页面标记本地模拟,图片为“不可扫码”文字占位。真实小程序扫码与原下单人的确认闭环仍待测试订单联调。 + +验证:iPhone 17 Pro / iOS 27.0 模拟器,52 个不同回归用例均取得通过结果(新接口 8、ViewModel 14、导航 3、确认页 3、既有订单/首页 24)。修复完成态立即清图及清单变化后强制重读后,相关 17 项复跑全部通过,结果包 `test_sim_2026-10-30T07-38-09-947Z_pid2189_3cbb6f2f.xcresult`。手动模拟流程记录仅有 `GET detail → GET tasks → GET detail → POST confirm-code → GET detail`,生成响应 `confirm_status=1` 时保持待确认,末次模拟详情 `order_status=30` 才展示完成并移除码;所有日志标记 `[LOCAL MOCK]`。 + +UI 对齐(2026-10-30):已现场核对[产品体验网页](https://voicestudio.suixinkan.cn/)的整单核对、等待确认和确认完成三种状态。核对态采用订单抬头、核对引导、数量条、横排清单标题、分点位双列成片卡和固定底栏;等待态使用渐变确认码卡及可展开的云端成片清单;完成态使用绿色成功标识与确认时间信息卡。统计及清单明确为当前云端内容,不当作历史冻结回执;成片接口未提供时长时隐藏时长角标。核对态的“还未交齐,继续交付”打开统一交付方式弹窗,云端交付关闭后重读订单和任务;等待态仍只刷新确认状态。此轮不新增接口,不调用任何设备指令。 + +UI 验证:确认页 5 项与共用交付流程 8 项回归全部通过,导航 3 项及 ViewModel 14 项在本轮前一批验证通过。最终构建及模拟器手动核对、出码、展开清单、确认完成均通过;展开清单未增加接口请求,完成后清码并回到页面顶部。所有确认流程返回均为隔离 Mock。UI 回归结果包 `test_sim_2026-10-30T08-03-43-535Z_pid2189_be76a5e8.xcresult`。 + +## 10. 其他页面与尚未接入的功能 + +以下区分已接入页面与仍保留的演示流程、后端候选能力;候选接口不代表已完成接入。 + +| 页面/功能 | 当前实现状态 | 文档中的后续候选接口与提供人 | 返回 JSON 记录 | +| --- | --- | --- | --- | +| 历史演示订单页 `DroneShootingOrdersViewController` | 仅演示流程继续使用本地数据;正式首页“查看全部”已进入真实 `DroneDockOrdersViewController` | 正式页张工 `GET /orders` 已接入,见 4.4 | 演示数据不能作为接口实测证据 | +| 拍摄任务页 `DroneDockShootingTaskViewController` | 顶部和底部固定,中间按状态组合且无滚动;进入、可见时返回前台立即读取,随后串行轮询同一任务,导航栏支持手动刷新,无下拉刷新;明确完成态可查看订单素材 | 朱工 `/airport/shooting` 已接入;`/airport/start-shoot` 已实现纯本地模拟、真实入口禁用;`/airport/command` 已实现纯本地模拟、真实入口禁用;图传 `/airport/live` 已预接请求及本地播放,待补真实播放合同;失败重召唤 `shoot restart=true` 已完成本地模拟,当前不另调 `/airport/status` | 类型 25 真实读取成功见 7.6;开始拍摄模拟回执见 7.6.2;尚无真实开始拍摄或控制成功记录 | +| 历史素材演示/下载 `DroneMaterialsViewController`、`DroneMaterialPreviewViewController` | 仅演示流程保留;正式入口已切换真实素材库,正式下载与保存相册见 8.3 | 张工返回有效原素材 URL,由客户端直接下载;历史演示仍不代表真实下载 | 正式页面响应见第 8 节 | +| 历史交付演示 `DroneDeliveryUploadViewController`、`DroneDeliveryReviewViewController` | 仅演示流程保留;正式上传使用第 9 节新共用页,正式游客确认使用 9.5 新页 | 张工 `POST /orders/confirm-code`、`GET /orders/detail` 已实现 | 正式上传记录见第 9 节;游客确认暂无真实扫码回执,模拟结果见 9.5 | +| 收款页“线下收款” | 跳转既有 `OfflineCollectionRegistrationViewController` | 复用原通用线下收款模块,不属于本次机巢类型 25 专用接口接入 | 本文未审计该旧模块 JSON,不将它记为新接口已打通 | + +表中张工短路径前缀为 `/api/yf-handset-app/photog/multi-plane`;朱工短路径前缀为 `/api/app`。景区空镜库为另一个模块,不纳入本文页面清单。 + +## 11. 当前联调问题与约定 + +| 事项 | 当前证据/约定 | 责任归属/后续 | +| --- | --- | --- | +| 多点位订单实时准备信息 | 购买配置读取张工 `project-info`,设备状态读取朱工 `plane-status`,后者已实测显示“空闲 · 电量 93%”;`workbench` 的 100099 响应仅为历史记录 | 已完成创建后调用 shoot 的客户端衔接,当前按用户指示省略 plane_id;设备展示不作为起飞许可 | +| 任务创建后召唤 | 16:03:01 新建任务 6,16:03:31 省略 plane_id 的召唤接口业务成功;回执绑定飞机 61、航线任务 1926,后续 shooting 仍传 6 | 已取得成功样本;请朱工统一省略 plane_id 的文档约定。任务 2 的失败历史保留,原因不能由任务 6 成功反推;未调用开始拍摄或控制接口 | +| 任务状态读取与航线失败 | 16:04:52 shooting?id=6 读取成功:航线 1926 状态 91“执行失败”,任务总状态 20“执行中”,execute_gate=false、ui=blocked;任务飞机 61 显示离线且 can_fly=false,景区 connected=true | 朱工排查 1926 失败原因及飞机 61 在线状态、派机条件;区分任务/航线/景区状态层次,现有响应不足以确认故障因果;当前不继续拍摄 | +| 任务页套餐与次数 | shooting.header 及任务 6 的 shoot.order_progress 均为“单次航拍 · 含 1 次拍摄”、总/剩余 1;张工同单最新创建摘要为多点位航拍、总/剩余 5 | 朱工与张工统一 header/order_progress 来源;客户端不据此扣次或覆盖购买权限、整单次数 | +| 权威次数 | 类型 25 以张工订单摘要为准;仅有效成功任务计次 | 不回退朱工旧 `project_count/capture_num` 口径 | +| 位置与范围 | 准备页已移除仅服务 workbench 的定位请求;产品确认不再展示距离、范围或定位占位 | 此次仅调整显示;后续召唤接口的服务端校验仍需按正式约定接入 | +| 付款码返回语义 | 新返回为小程序码图片 URL,旧支付链接存档已过时 | 按最新图片合同展示,不能重新编码 URL | +| 素材真实非空样本 | 10 月 28 日素材采样时两个点位任务均为空;10 月 29 日 11:56 已创建任务 1,但尚无本页真实原素材或成片非空样本 | 后续飞行模块回写素材后继续验证真实预览,不将旧空态当成当前任务永远为空 | +| 成片上传真实数据 | 10 月 30 日 16:39:52 已用演示视频完成真实 STS→OSS→`tasks/film`,任务 13、成片 1;回读 `film_count=1` | 客户端以 ASCII 对象名兼容编码路径;张工可依据失败 RequestId 排查中文编码 URL 的文件信息读取,详见 9.4 | +| 空收款记录样本 | 本地有 10 月 27 日空态响应 | 后续取得非空真实响应时补充;当前非空 JSON 仅引用后端文档 | + +## 12. 维护与证据索引 + +每接入一个页面或后端修改字段时,更新以下内容: + +1. 页面/动作与接口提供人,完整路径、方法、实际参数和触发时机。 +2. 成功、空态、业务失败的 JSON;标明实测时间或“后端文档示例”。 +3. 页面使用哪些字段,哪些值可缺失、哪些权限必须明确为 true。 +4. 当前错误与待后端确认事项,避免把旧样本或演示状态写成已完成联调。 + +### 12.1 本文依据 + +- 张工提供:`multi-plane-app-integration.md`,本机输入文件位于 Desktop;以用户最新确认的接口分工为准。 +- 朱工提供:`随心瞰9.9.1-App机巢与素材库接口.md`,本机输入文件位于 Desktop;召唤衔接最初依据 2026-10-29 14:50 更新版,当前省略 `plane_id` 以用户随后明确指示为准,真实拒绝记录见 7.7.1。 +- 当前 App 的 API、ViewModel 与正式页面代码,正文各节已附项目内链接。 + +### 12.2 本地响应目录 + +| 目录 | 内容 | +| --- | --- | +| [task-create-integration-2026-10-29](docs/9.9.1/task-create-integration-2026-10-29/) | 张工 tasks/create 的任务 1 历史成功响应,以及 16:03:01 按用户明确要求新建任务 6 的完整脱敏成功响应 | +| [shooting-integration-2026-10-29](docs/9.9.1/shooting-integration-2026-10-29/) | shooting 的历史失败与任务 1 成功响应;任务 2 各次 shoot 失败历史;16:03:31 任务 6 的 shoot 成功响应及 16:04:52 shooting 回查航线执行失败的完整脱敏响应 | +| [plane-status-integration-2026-10-29](docs/9.9.1/plane-status-integration-2026-10-29/) | 准备页无人机状态的完整脱敏实测响应,含三台设备、推荐状态与轮询间隔 | +| [delivery-integration-2026-10-29](docs/9.9.1/delivery-integration-2026-10-29/) | 交付前订单摘要、任务空态的真实脱敏响应;模拟器验证状态见第 9 节 | +| [cloud-film-integration-2026-10-30](docs/9.9.1/cloud-film-integration-2026-10-30/) | 真实成片保存失败与成功请求/响应、OSS HEAD 证据、保存后摘要与任务回读(已移除用户与无关设备标识) | +| [materials-integration-2026-10-28](docs/9.9.1/materials-integration-2026-10-28/) | 订单摘要、全部任务与两个点位筛选的脱敏响应;真实截图仅留本地 | +| [orders-integration-2026-10-28](docs/9.9.1/orders-integration-2026-10-28/) | 我的拍摄订单四种状态的脱敏响应 | +| [home-split-integration-2026-10-28](docs/9.9.1/home-split-integration-2026-10-28/) | 首页三个新接口响应及截图 | +| [payment-integration-2026-10-27](docs/9.9.1/payment-integration-2026-10-27/) | 套餐、付款码、收款记录的历史响应;付款码以 mini-program 文件为准 | +| [project-info-integration-2026-10-28](docs/9.9.1/project-info-integration-2026-10-28/) | project-info 成功样本;停用前的 workbench 业务失败与页面截图 | +| [preparation-integration-2026-10-28](docs/9.9.1/preparation-integration-2026-10-28/) | 旧订单 workbench 成功样本,不能当作类型 25 成功证据 | + +此前停用 `workbench` 时,模拟器构建通过,准备页 API/Model、ViewModel、页面、首页入口及共用拍摄页面相关 **59 项测试全部通过**,覆盖首次进入、刷新和重试仅请求 `project-info`。本次交付页验证见第 9 节。测试替身验证与真实后端响应分别记录,单元测试通过不代表已完成真实飞行或支付交付。